샘플
parse-conflict-json 4.0.0: parseConflictJson
검증된 샘플 — npm parse-conflict-json 4.0.0: parseConflictJson. node 22 · linux debian/x64 · docker에서 contract를 실행해 통과했습니다: parseConflictJson parses plain JSON…
sha256:7501185ed7b5c23c437828dee24fc37cd635b56b4c90a957f6b3a116d19fc762
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
MIT-0
실행 증거
선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.
- 증거 기준
- 서명된 컨트랙트 통과
- 검증 영수증
- 1
- 빌드한 서명 키
- 1
선언된 환경
linux 24 · ubuntu · glibc 2.39 x64 npm
검증 실행 환경
| 환경 | 컨트랙트 | 단계 | 실행일 |
|---|---|---|---|
| node 22 · linux debian/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1node:22@sha256:8a34c4ab3ea2… |
2026-10-18 |
케이스
HOW- 목표
- verify parseConflictJson in pkg:npm/parse-conflict-json@4.0.0
- 심벌
-
- parseConflictJson
- 생성일
- 2026-10-18T09:51:23Z
컨트랙트
- parseConflictJson parses plain JSON without conflict markers and parseConflictJson.isDiff returns falsy
- parseConflictJson resolves diff3-style JSON conflicts (<{7}, |{7}, ={7}, >{7}) preferring 'ours' by default or 'theirs' when specified
- parseConflictJson applies an optional JSON reviver to parent, ours, and theirs branches before merging
- parseConflictJson throws TypeError when prefer is neither 'ours' nor 'theirs'
파일
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.mjs
- test/contract.mjs
소스
Clean-room public code sample — generation instructions
Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.
A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.
Goal: verify parseConflictJson in pkg:npm/parse-conflict-json@4.0.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/parse-conflict-json@4.0.0
Demonstrate these symbols/APIs:
- parseConflictJson
Rules:
- One focused purpose; the smallest project that proves the goal.
- Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
- Pin every dependency with a lockfile so resolution is reproducible.
- No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
- No personal names, emails, company names, or project identifiers of any kind.
- No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
- Keep it under 200 files and 256KB packed.
{"case":{"caseId":"case:sha256:5eb226814e0360da5a067efe67921af12d4dc83cdec07ba9d8f1af9de039e123","contract":["parseConflictJson parses plain JSON without conflict markers and parseConflictJson.isDiff returns falsy","parseConflictJson resolves diff3-style JSON conflicts (\u003c{7}, |{7}, ={7}, \u003e{7}) preferring 'ours' by default or 'theirs' when specified","parseConflictJson applies an optional JSON reviver to parent, ours, and theirs branches before merging","parseConflictJson throws TypeError when prefer is neither 'ours' nor 'theirs'"],"goal":"verify parseConflictJson in pkg:npm/parse-conflict-json@4.0.0","kind":"HOW","packages":["pkg:npm/parse-conflict-json@4.0.0"],"schemaVersion":1,"symbols":["parseConflictJson"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"npm","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/parse-conflict-json@4.0.0"],"schemaVersion":1,"subject":"pkg:npm/parse-conflict-json@4.0.0","symbols":["parseConflictJson"],"verifierAdapter":"node-typescript@1"}
{
"name": "verify-parse-conflict-json",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "verify-parse-conflict-json",
"version": "1.0.0",
"dependencies": {
"parse-conflict-json": "4.0.0"
}
},
"node_modules/json-parse-even-better-errors": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-4.0.0.tgz",
"integrity": "sha512-lR4MXjGNgkJc7tkQ97kb2nuEMnNCyU//XYVH0MKTGcXEiSudQ5MKGKen3C5QubYy0vmq+JGitUg92uuywGEwIA==",
"license": "MIT",
"engines": {
"node": "^18.17.0 || >=20.5.0"
}
},
"node_modules/just-diff": {
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/just-diff/-/just-diff-6.0.2.tgz",
"integrity": "sha512-S59eriX5u3/QhMNq3v/gm8Kd0w8OS6Tz2FS1NG4blv+z0MuQcBRJyFWjdovM0Rad4/P4aUPFtnkNjMjyMlMSYA==",
"license": "MIT"
},
"node_modules/just-diff-apply": {
"version": "5.5.0",
"resolved": "https://registry.npmjs.org/just-diff-apply/-/just-diff-apply-5.5.0.tgz",
"integrity": "sha512-OYTthRfSh55WOItVqwpefPtNt2VdKsq5AnAK6apdtR6yCH8pr0CmSr710J0Mf+WdQy7K/OzMy7K2MgAfdQURDw==",
"license": "MIT"
},
"node_modules/parse-conflict-json": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/parse-conflict-json/-/parse-conflict-json-4.0.0.tgz",
"integrity": "sha512-37CN2VtcuvKgHUs8+0b1uJeEsbGn61GRHz469C94P5xiOoqpDYJYwjg4RY9Vmz39WyZAVkR5++nbJwLMIgOCnQ==",
"license": "ISC",
"dependencies": {
"json-parse-even-better-errors": "^4.0.0",
"just-diff": "^6.0.0",
"just-diff-apply": "^5.2.0"
},
"engines": {
"node": "^18.17.0 || >=20.5.0"
}
}
}
}
{
"name": "verify-parse-conflict-json",
"version": "1.0.0",
"private": true,
"type": "module",
"dependencies": {
"parse-conflict-json": "4.0.0"
}
}
{
"schemaVersion": 1,
"goal": "verify parseConflictJson in pkg:npm/parse-conflict-json@4.0.0",
"kind": "HOW",
"packages": [
"pkg:npm/parse-conflict-json@4.0.0"
],
"symbols": [
"parseConflictJson"
]
}
import parseConflictJson from 'parse-conflict-json';
export function resolveConflictJson(jsonText, reviver, prefer) {
return parseConflictJson(jsonText, reviver, prefer);
}
export function detectConflictMarkers(jsonText) {
return Boolean(parseConflictJson.isDiff(jsonText));
}
import assert from 'node:assert/strict';
import parseConflictJson from 'parse-conflict-json';
import { resolveConflictJson, detectConflictMarkers } from '../src/index.mjs';
const toPlainObject = (obj) => JSON.parse(JSON.stringify(obj));
// 1. Plain JSON without conflict markers
const cleanJson = '{"version": "1.0.0", "items": [1, 2]}';
assert.equal(detectConflictMarkers(cleanJson), false);
const parsedClean = resolveConflictJson(cleanJson);
assert.deepEqual(toPlainObject(parsedClean), { version: '1.0.0', items: [1, 2] });
assert.equal(parsedClean[Symbol.for('indent')], '');
assert.equal(parsedClean[Symbol.for('newline')], '');
// 2. Diff3-style 3-way conflict resolution
const conflictedJson = [
'{',
'<<<<<<< HEAD',
' "mode": "ours",',
' "oursField": 100',
'||||||| base',
' "mode": "base"',
'=======',
' "mode": "theirs",',
' "theirsField": 200',
'>>>>>>> feature',
'}'
].join('\n');
assert.equal(detectConflictMarkers(conflictedJson), true);
// Default prefer is 'ours'
const mergedOurs = resolveConflictJson(conflictedJson);
assert.deepEqual(toPlainObject(mergedOurs), {
mode: 'ours',
oursField: 100,
theirsField: 200
});
// Explicit prefer 'theirs'
const mergedTheirs = resolveConflictJson(conflictedJson, null, 'theirs');
assert.deepEqual(toPlainObject(mergedTheirs), {
mode: 'theirs',
oursField: 100,
theirsField: 200
});
// 3. Custom JSON reviver applied across conflict branches
const mergedRevived = parseConflictJson(
conflictedJson,
(_key, val) => (typeof val === 'number' ? val + 5 : val),
'ours'
);
assert.deepEqual(toPlainObject(mergedRevived), {
mode: 'ours',
oursField: 105,
theirsField: 205
});
// 4. Invalid prefer argument throws TypeError
assert.throws(
() => parseConflictJson(cleanJson, null, 'unknown'),
{
name: 'TypeError',
message: /prefer param must be "ours" or "theirs" if set/
}
);
오리진 시더
익명