Files
gitmost/packages/git-sync/build/index.js
claude code agent 227 ba2118e24a feat(git-sync): CommonJS build + §13.1 editor-ext idempotency gate (Phase A.2)
Make @docmost/git-sync natively consumable by the CommonJS server (and jest):
build to CommonJS (tsconfig module CommonJS, drop type:module, strip .js from
relative imports), and lazy-load the only ESM-only dep (marked) via the dynamic
Function('import()') trick (mirrors docmost-client.loader.ts) with a require()
fallback so vitest's evaluator works too. git-sync tests stay green (314 pass,
3 expected fail).

Add the §13.1 idempotency gate (apps/server .../git-sync-converter-gate.spec.ts):
13 editor-ext docs (paragraphs/headings, marks, links, bullet/ordered/task lists,
blockquote, callouts, code block, hr, table, nested mix) round-trip
content(editor-ext) -> convertProseMirrorToMarkdown -> markdownToProseMirror ->
TiptapTransformer.toYdoc/fromYdoc(tiptapExtensions) -> canonicalize and assert
docsCanonicallyEqual. All green => the vendored converter's docmost-schema is
schema-compatible with editor-ext (no node/mark/attr loss), which the plan §13.1
requires before Phase B. The one intrinsic markdown-image lossiness (width/height
/align can't ride plain ![](src)) is isolated in a KNOWN DIVERGENCE block, not
hidden. Server tsc clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-24 13:34:44 +03:00

36 lines
3.4 KiB
JavaScript

"use strict";
/**
* Public surface of `@docmost/git-sync`.
*
* Phase A (plan §12.A) vendors only the PURE converter + pure engine modules
* from docmost-sync. Server integration (GitmostDataSource, orchestrator,
* VaultGit, pull/push) is added in later steps.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.bodyHash = exports.stabilizePageFile = exports.disambiguate = exports.sanitizeTitle = exports.buildVaultLayout = exports.MASS_DELETE_FRACTION = exports.MASS_DELETE_MIN_EXISTING = exports.decideAbsenceDeletions = exports.planReconciliation = exports.docsCanonicallyEqual = exports.canonicalizeContent = exports.markdownToProseMirror = exports.convertProseMirrorToMarkdown = exports.parseDocmostMarkdown = exports.serializeDocmostMarkdownBody = exports.serializeDocmostMarkdown = void 0;
// Pure converter (markdown <-> ProseMirror, file envelope, canonicalization).
var index_1 = require("./lib/index");
Object.defineProperty(exports, "serializeDocmostMarkdown", { enumerable: true, get: function () { return index_1.serializeDocmostMarkdown; } });
Object.defineProperty(exports, "serializeDocmostMarkdownBody", { enumerable: true, get: function () { return index_1.serializeDocmostMarkdownBody; } });
Object.defineProperty(exports, "parseDocmostMarkdown", { enumerable: true, get: function () { return index_1.parseDocmostMarkdown; } });
Object.defineProperty(exports, "convertProseMirrorToMarkdown", { enumerable: true, get: function () { return index_1.convertProseMirrorToMarkdown; } });
Object.defineProperty(exports, "markdownToProseMirror", { enumerable: true, get: function () { return index_1.markdownToProseMirror; } });
Object.defineProperty(exports, "canonicalizeContent", { enumerable: true, get: function () { return index_1.canonicalizeContent; } });
Object.defineProperty(exports, "docsCanonicallyEqual", { enumerable: true, get: function () { return index_1.docsCanonicallyEqual; } });
// Pure engine (no IO): reconcile planner, vault layout, sanitize, stabilize,
// loop-guard body hash.
var reconcile_1 = require("./engine/reconcile");
Object.defineProperty(exports, "planReconciliation", { enumerable: true, get: function () { return reconcile_1.planReconciliation; } });
Object.defineProperty(exports, "decideAbsenceDeletions", { enumerable: true, get: function () { return reconcile_1.decideAbsenceDeletions; } });
Object.defineProperty(exports, "MASS_DELETE_MIN_EXISTING", { enumerable: true, get: function () { return reconcile_1.MASS_DELETE_MIN_EXISTING; } });
Object.defineProperty(exports, "MASS_DELETE_FRACTION", { enumerable: true, get: function () { return reconcile_1.MASS_DELETE_FRACTION; } });
var layout_1 = require("./engine/layout");
Object.defineProperty(exports, "buildVaultLayout", { enumerable: true, get: function () { return layout_1.buildVaultLayout; } });
var sanitize_1 = require("./engine/sanitize");
Object.defineProperty(exports, "sanitizeTitle", { enumerable: true, get: function () { return sanitize_1.sanitizeTitle; } });
Object.defineProperty(exports, "disambiguate", { enumerable: true, get: function () { return sanitize_1.disambiguate; } });
var stabilize_1 = require("./engine/stabilize");
Object.defineProperty(exports, "stabilizePageFile", { enumerable: true, get: function () { return stabilize_1.stabilizePageFile; } });
var loop_guard_1 = require("./engine/loop-guard");
Object.defineProperty(exports, "bodyHash", { enumerable: true, get: function () { return loop_guard_1.bodyHash; } });