{"name":"parse-conflict-json","version":"6.0.0","author":{"name":"GitHub Inc."},"license":"ISC","_id":"parse-conflict-json@6.0.0","maintainers":[{"name":"saquibkhan","email":"saquibkhan@github.com"},{"name":"npm-cli-ops","email":"npm-cli+bot@github.com"},{"name":"reggi","email":"reggi@github.com"},{"name":"owlstronaut","email":"owlstronaut@github.com"}],"homepage":"https://github.com/npm/parse-conflict-json#readme","bugs":{"url":"https://github.com/npm/parse-conflict-json/issues"},"tap":{"nyc-arg":["--exclude","tap-snapshots/**"],"check-coverage":true},"dist":{"shasum":"745118c8c1c0c599a302cd1a0b30363776b959b3","tarball":"http://registry-npm.ywwl.com/parse-conflict-json/download/parse-conflict-json-6.0.0.tgz","fileCount":4,"integrity":"sha512-JIdsITvN0yVRpYxiip9DpCduYi75AryIDSCf6ez/Yul6PV46L0B/8SxSvLiMmWiUZKopLrD1BZgexxCfufoT9w==","signatures":[{"sig":"MEUCIEi8WSqHZXxBeTCy2aNJJkb8OThH0JXkjrmcF+LOymDRAiEA93oLIylBdFrGRsB7ynmrfHUaiJ4pSWzaoEmpzQ3rlqs=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/parse-conflict-json@6.0.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":6408,"size":2973,"noattachment":false,"key":"/parse-conflict-json/-/parse-conflict-json-6.0.0.tgz"},"main":"lib","engines":{"node":"^22.22.2 || ^24.15.0 || >=26.0.0"},"gitHead":"4dfd42b0f71916b44bcc7d1b142e9250df77eea4","scripts":{"lint":"npm run eslint","snap":"tap","test":"tap","eslint":"eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"","lintfix":"npm run eslint -- --fix","postlint":"template-oss-check","posttest":"npm run lint","template-oss-apply":"template-oss-apply --force"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:f3a99145-2de3-4deb-941e-3b7d9a796a42"}},"repository":{"url":"git+https://github.com/npm/parse-conflict-json.git","type":"git"},"_npmVersion":"11.14.1","description":"Parse a JSON string that has git merge conflicts, resolving if possible","directories":{},"templateOSS":{"publish":true,"version":"5.1.0","//@npmcli/template-oss":"This file is partially managed by @npmcli/template-oss. Edits may be overwritten."},"_nodeVersion":"26.1.0","dependencies":{"just-diff":"^6.0.0","just-diff-apply":"^5.2.0","json-parse-even-better-errors":"^6.0.0"},"_hasShrinkwrap":false,"devDependencies":{"tap":"^16.0.1","@npmcli/template-oss":"5.1.0","@npmcli/eslint-config":"^6.0.0"},"_npmOperationalInternal":{"tmp":"tmp/parse-conflict-json_6.0.0_1778870867405_0.5800365149858784","host":"s3://npm-registry-packages-npm-production"},"readme":"# parse-conflict-json\n\nParse a JSON string that has git merge conflicts, resolving if possible.\n\nIf the JSON is valid, it just does `JSON.parse` as normal.\n\nIf either side of the conflict is invalid JSON, then an error is thrown for\nthat.\n\n## USAGE\n\n```js\n// after a git merge that left some conflicts there\nconst data = fs.readFileSync('package-lock.json', 'utf8')\n\n// reviverFunction is passed to JSON.parse as the reviver function\n// preference defaults to 'ours', set to 'theirs' to prefer the other\n// side's changes.\nconst parsed = parseConflictJson(data, reviverFunction, preference)\n\n// returns true if the data looks like a conflicted diff file\nparsed.isDiff(data)\n```\n\n## Algorithm\n\nIf `prefer` is set to `theirs`, then the vaules of `theirs` and `ours` are\nswitched in the resolver function.  (Ie, we'll apply their changes on top\nof our object, rather than the other way around.)\n\n- Parse the conflicted file into 3 pieces: `ours`, `theirs`, and `parent`\n\n- Get the [diff](https://github.com/angus-c/just#just-diff) from `parent`\n  to `ours`.\n\n- [Apply](https://github.com/angus-c/just#just-diff-apply) each change of\n  that diff to `theirs`.\n\n    If any change in the diff set cannot be applied (ie, because they\n    changed an object into a non-object and we changed a field on that\n    object), then replace the object at the specified path with the object\n    at the path in `ours`.\n","publish_time":1778870867563,"_cnpm_publish_time":1778870867563,"dist-tags":{"latest":"6.0.0"}}