@braincloud/cloudsync-core
Advanced tools
| export interface Merge3Labels { | ||
| /** Label for the local side in conflict markers (default "local"). */ | ||
| local?: string; | ||
| /** Label for the brainCloud side in conflict markers (default "brainCloud"). */ | ||
| remote?: string; | ||
| } | ||
| export interface Merge3Result { | ||
| /** The merged text. On conflict, contains git-style `<<<<<<< / ======= / >>>>>>>` markers. */ | ||
| merged: string; | ||
| /** True if any hunk overlapped and could not be auto-merged. */ | ||
| conflict: boolean; | ||
| } | ||
| /** | ||
| * Three-way merge of cloud-code script bodies: | ||
| * local — the working-tree body | ||
| * base — the last-synced body (recovered from brainCloud version history) | ||
| * remote — the current brainCloud body | ||
| * | ||
| * Non-overlapping edits on each side merge cleanly. Identical edits on both sides collapse to one | ||
| * (no false conflict). Only genuinely overlapping hunks become conflicts, marked git-style for the | ||
| * developer to resolve. Comparison is line-based and CRLF-normalised so cosmetic EOL differences | ||
| * don't manufacture conflicts. | ||
| */ | ||
| export declare function merge3(local: string, base: string, remote: string, labels?: Merge3Labels): Merge3Result; | ||
| //# sourceMappingURL=merge.d.ts.map |
| {"version":3,"file":"merge.d.ts","sourceRoot":"","sources":["../src/merge.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,YAAY;IAC3B,sEAAsE;IACtE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gFAAgF;IAChF,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,YAAY;IAC3B,8FAA8F;IAC9F,MAAM,EAAE,MAAM,CAAC;IACf,gEAAgE;IAChE,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,MAAM,CACpB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,MAAM,GAAE,YAAiB,GACxB,YAAY,CAMd"} |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.merge3 = merge3; | ||
| const node_diff3_1 = require("node-diff3"); | ||
| /** | ||
| * Three-way merge of cloud-code script bodies: | ||
| * local — the working-tree body | ||
| * base — the last-synced body (recovered from brainCloud version history) | ||
| * remote — the current brainCloud body | ||
| * | ||
| * Non-overlapping edits on each side merge cleanly. Identical edits on both sides collapse to one | ||
| * (no false conflict). Only genuinely overlapping hunks become conflicts, marked git-style for the | ||
| * developer to resolve. Comparison is line-based and CRLF-normalised so cosmetic EOL differences | ||
| * don't manufacture conflicts. | ||
| */ | ||
| function merge3(local, base, remote, labels = {}) { | ||
| const result = (0, node_diff3_1.merge)(toLines(local), toLines(base), toLines(remote), { | ||
| excludeFalseConflicts: true, | ||
| label: { a: labels.local ?? 'local', b: labels.remote ?? 'brainCloud' }, | ||
| }); | ||
| return { merged: result.result.join('\n'), conflict: result.conflict }; | ||
| } | ||
| function toLines(text) { | ||
| return text.replace(/\r\n/g, '\n').split('\n'); | ||
| } | ||
| //# sourceMappingURL=merge.js.map |
| {"version":3,"file":"merge.js","sourceRoot":"","sources":["../src/merge.ts"],"names":[],"mappings":";;AA2BA,wBAWC;AAtCD,2CAAmC;AAgBnC;;;;;;;;;;GAUG;AACH,SAAgB,MAAM,CACpB,KAAa,EACb,IAAY,EACZ,MAAc,EACd,SAAuB,EAAE;IAEzB,MAAM,MAAM,GAAG,IAAA,kBAAK,EAAC,OAAO,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,EAAE;QACnE,qBAAqB,EAAE,IAAI;QAC3B,KAAK,EAAE,EAAE,CAAC,EAAE,MAAM,CAAC,KAAK,IAAI,OAAO,EAAE,CAAC,EAAE,MAAM,CAAC,MAAM,IAAI,YAAY,EAAE;KACxE,CAAC,CAAC;IACH,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC;AACzE,CAAC;AAED,SAAS,OAAO,CAAC,IAAY;IAC3B,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AACjD,CAAC"} |
+1
-0
@@ -10,2 +10,3 @@ /** | ||
| export { computeSyncHash, canonicalString } from './hash'; | ||
| export { merge3, type Merge3Labels, type Merge3Result } from './merge'; | ||
| export { parseBcSync, serializeBcSync, resolveBranchApp, parseBcSyncLocal, serializeBcSyncLocal, getOrCreateBranchState, upsertBranchScript, removeBranchScript, type BranchMapping, type BcSyncConfig, type ScriptSyncRecord, type BranchSyncState, type BcSyncLocal, } from './bcsync'; | ||
@@ -12,0 +13,0 @@ export { classifyScript, classifyScripts, type SyncAction, type ScriptComparison, type ScriptStatus, } from './sync'; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EACL,WAAW,EACX,oBAAoB,EACpB,kBAAkB,EAClB,gBAAgB,EAChB,SAAS,EACT,SAAS,EACT,KAAK,cAAc,EACnB,KAAK,UAAU,GAChB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAE1D,OAAO,EACL,WAAW,EACX,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,oBAAoB,EACpB,sBAAsB,EACtB,kBAAkB,EAClB,kBAAkB,EAClB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,WAAW,GACjB,MAAM,UAAU,CAAC;AAElB,OAAO,EACL,cAAc,EACd,eAAe,EACf,KAAK,UAAU,EACf,KAAK,gBAAgB,EACrB,KAAK,YAAY,GAClB,MAAM,QAAQ,CAAC;AAEhB,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAExE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC"} | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EACL,WAAW,EACX,oBAAoB,EACpB,kBAAkB,EAClB,gBAAgB,EAChB,SAAS,EACT,SAAS,EACT,KAAK,cAAc,EACnB,KAAK,UAAU,GAChB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAE1D,OAAO,EAAE,MAAM,EAAE,KAAK,YAAY,EAAE,KAAK,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvE,OAAO,EACL,WAAW,EACX,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,oBAAoB,EACpB,sBAAsB,EACtB,kBAAkB,EAClB,kBAAkB,EAClB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,WAAW,GACjB,MAAM,UAAU,CAAC;AAElB,OAAO,EACL,cAAc,EACd,eAAe,EACf,KAAK,UAAU,EACf,KAAK,gBAAgB,EACrB,KAAK,YAAY,GAClB,MAAM,QAAQ,CAAC;AAEhB,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAExE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC"} |
+3
-1
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.BcSyncParseError = exports.CcjsBuildError = exports.CcjsParseError = exports.expandExportZip = exports.buildImportZip = exports.classifyScripts = exports.classifyScript = exports.removeBranchScript = exports.upsertBranchScript = exports.getOrCreateBranchState = exports.serializeBcSyncLocal = exports.parseBcSyncLocal = exports.resolveBranchApp = exports.serializeBcSync = exports.parseBcSync = exports.canonicalString = exports.computeSyncHash = exports.buildCcjs = exports.parseCcjs = exports.HASH_META_FIELDS = exports.BOOKKEEPING_FIELDS = exports.AUTHORITATIVE_FIELDS = exports.META_MARKER = void 0; | ||
| exports.BcSyncParseError = exports.CcjsBuildError = exports.CcjsParseError = exports.expandExportZip = exports.buildImportZip = exports.classifyScripts = exports.classifyScript = exports.removeBranchScript = exports.upsertBranchScript = exports.getOrCreateBranchState = exports.serializeBcSyncLocal = exports.parseBcSyncLocal = exports.resolveBranchApp = exports.serializeBcSync = exports.parseBcSync = exports.merge3 = exports.canonicalString = exports.computeSyncHash = exports.buildCcjs = exports.parseCcjs = exports.HASH_META_FIELDS = exports.BOOKKEEPING_FIELDS = exports.AUTHORITATIVE_FIELDS = exports.META_MARKER = void 0; | ||
| /** | ||
@@ -21,2 +21,4 @@ * @braincloud/cloudsync-core | ||
| Object.defineProperty(exports, "canonicalString", { enumerable: true, get: function () { return hash_1.canonicalString; } }); | ||
| var merge_1 = require("./merge"); | ||
| Object.defineProperty(exports, "merge3", { enumerable: true, get: function () { return merge_1.merge3; } }); | ||
| var bcsync_1 = require("./bcsync"); | ||
@@ -23,0 +25,0 @@ Object.defineProperty(exports, "parseBcSync", { enumerable: true, get: function () { return bcsync_1.parseBcSync; } }); |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA;;;;;;GAMG;AACH,uCASoB;AARlB,uGAAA,WAAW,OAAA;AACX,gHAAA,oBAAoB,OAAA;AACpB,8GAAA,kBAAkB,OAAA;AAClB,4GAAA,gBAAgB,OAAA;AAChB,qGAAA,SAAS,OAAA;AACT,qGAAA,SAAS,OAAA;AAKX,+BAA0D;AAAjD,uGAAA,eAAe,OAAA;AAAE,uGAAA,eAAe,OAAA;AAEzC,mCAckB;AAbhB,qGAAA,WAAW,OAAA;AACX,yGAAA,eAAe,OAAA;AACf,0GAAA,gBAAgB,OAAA;AAChB,0GAAA,gBAAgB,OAAA;AAChB,8GAAA,oBAAoB,OAAA;AACpB,gHAAA,sBAAsB,OAAA;AACtB,4GAAA,kBAAkB,OAAA;AAClB,4GAAA,kBAAkB,OAAA;AAQpB,+BAMgB;AALd,sGAAA,cAAc,OAAA;AACd,uGAAA,eAAe,OAAA;AAMjB,6BAAwE;AAA/D,qGAAA,cAAc,OAAA;AAAE,sGAAA,eAAe,OAAA;AAExC,mCAA4E;AAAnE,wGAAA,cAAc,OAAA;AAAE,wGAAA,cAAc,OAAA;AAAE,0GAAA,gBAAgB,OAAA"} | ||
| {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA;;;;;;GAMG;AACH,uCASoB;AARlB,uGAAA,WAAW,OAAA;AACX,gHAAA,oBAAoB,OAAA;AACpB,8GAAA,kBAAkB,OAAA;AAClB,4GAAA,gBAAgB,OAAA;AAChB,qGAAA,SAAS,OAAA;AACT,qGAAA,SAAS,OAAA;AAKX,+BAA0D;AAAjD,uGAAA,eAAe,OAAA;AAAE,uGAAA,eAAe,OAAA;AAEzC,iCAAuE;AAA9D,+FAAA,MAAM,OAAA;AAEf,mCAckB;AAbhB,qGAAA,WAAW,OAAA;AACX,yGAAA,eAAe,OAAA;AACf,0GAAA,gBAAgB,OAAA;AAChB,0GAAA,gBAAgB,OAAA;AAChB,8GAAA,oBAAoB,OAAA;AACpB,gHAAA,sBAAsB,OAAA;AACtB,4GAAA,kBAAkB,OAAA;AAClB,4GAAA,kBAAkB,OAAA;AAQpB,+BAMgB;AALd,sGAAA,cAAc,OAAA;AACd,uGAAA,eAAe,OAAA;AAMjB,6BAAwE;AAA/D,qGAAA,cAAc,OAAA;AAAE,sGAAA,eAAe,OAAA;AAExC,mCAA4E;AAAnE,wGAAA,cAAc,OAAA;AAAE,wGAAA,cAAc,OAAA;AAAE,0GAAA,gBAAgB,OAAA"} |
+3
-2
| { | ||
| "name": "@braincloud/cloudsync-core", | ||
| "version": "0.1.0", | ||
| "version": "0.2.0-dev.0", | ||
| "description": "Shared on-disk format and sync logic for brainCloud cloud-code: .bcsync / .ccjs parsing, metadata comment block, change-detection hashing, sync-state classification, and zip build/expand. Host-agnostic (no vscode or MCP deps).", | ||
@@ -28,3 +28,4 @@ "main": "dist/index.js", | ||
| "dependencies": { | ||
| "fflate": "^0.8.2" | ||
| "fflate": "^0.8.2", | ||
| "node-diff3": "^3.1.2" | ||
| }, | ||
@@ -31,0 +32,0 @@ "devDependencies": { |
85214
4.74%36
12.5%950
5.79%2
100%+ Added
+ Added