6dcc19ce59
git-sync's converter-core (src/lib) was a byte-identical duplicate of the new @docmost/prosemirror-markdown package (created in the previous commit). Switch git-sync to consume the package and delete its copy — ending the duplication that the whole #293 effort targets. Pure no-op: NO format/behavior change. - git-sync depends on @docmost/prosemirror-markdown (workspace:*); engine (stabilize/push/pull) + src/index barrel + 12 engine tests re-point their converter imports to the package. - Delete git-sync/src/lib (8 files) and the 23 duplicate converter-core test files + their fixtures — the converter and its ~440 tests now live once, in the package. git-sync keeps only its ENGINE tests, which exercise the converter through the package (the no-op proof). Kept roundtrip-helpers.ts (an engine test imports firstDivergence from it; pure helper, no double-run). - Added docmostExtensions to the package barrel (a kept engine schema-validity test needs it). Verified: editor-ext + prosemirror-markdown + git-sync all tsc EXIT 0; git-sync vitest 28 files, 268 passed, 0 failures (engine cycle/roundtrip/push/ pull/reconcile green = no-op proof); prosemirror-markdown vitest still 443 passed | 1 expected-fail; pnpm --frozen-lockfile EXIT 0; no ../lib refs remain in git-sync. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
131 lines
3.5 KiB
TypeScript
131 lines
3.5 KiB
TypeScript
/**
|
|
* Public surface of `@docmost/git-sync`.
|
|
*
|
|
* Exposes the pure converter (markdown <-> ProseMirror, file envelope,
|
|
* canonicalization) and the sync engine (reconcile planner, vault layout,
|
|
* pull/push, the git wrapper, and the settings parser) that the gitmost server
|
|
* drives in-process.
|
|
*/
|
|
|
|
// Pure converter (markdown <-> ProseMirror, file envelope, canonicalization).
|
|
// Re-exported from the standalone `@docmost/prosemirror-markdown` package,
|
|
// which is the single source of truth for the converter core; git-sync keeps
|
|
// only the engine (vault/git/orchestrator) and re-surfaces the converter for
|
|
// in-process consumers of the git-sync barrel.
|
|
export {
|
|
serializeDocmostMarkdown,
|
|
serializeDocmostMarkdownBody,
|
|
parseDocmostMarkdown,
|
|
convertProseMirrorToMarkdown,
|
|
markdownToProseMirror,
|
|
canonicalizeContent,
|
|
docsCanonicallyEqual,
|
|
} from "@docmost/prosemirror-markdown";
|
|
export type { DocmostMdMeta } from "@docmost/prosemirror-markdown";
|
|
|
|
// Pure engine (no IO): reconcile planner, vault layout, sanitize, stabilize,
|
|
// loop-guard body hash.
|
|
export {
|
|
planReconciliation,
|
|
decideAbsenceDeletions,
|
|
MASS_DELETE_MIN_EXISTING,
|
|
MASS_DELETE_FRACTION,
|
|
} from "./engine/reconcile.js";
|
|
export type {
|
|
LiveEntry,
|
|
ExistingEntry,
|
|
WriteEntry,
|
|
MovedEntry,
|
|
ReconciliationPlan,
|
|
DeletionDecision,
|
|
} from "./engine/reconcile.js";
|
|
|
|
export { buildVaultLayout } from "./engine/layout.js";
|
|
export type { PageNode, VaultEntry } from "./engine/layout.js";
|
|
|
|
export { sanitizeTitle, disambiguate } from "./engine/sanitize.js";
|
|
|
|
export { stabilizePageFile } from "./engine/stabilize.js";
|
|
export type { PageMeta } from "./engine/stabilize.js";
|
|
|
|
export { bodyHash } from "./engine/loop-guard.js";
|
|
|
|
// IO engine: the client seam, the VaultGit git wrapper, the
|
|
// pull (Docmost->FS) + push (FS->Docmost) planners/appliers, and the (pure)
|
|
// settings parser. The engine consumes the native `GitSyncClient` seam (the
|
|
// server implements it) rather than any REST client.
|
|
export type { GitSyncClient, GitSyncPageNodeLite } from "./engine/client.types.js";
|
|
|
|
export {
|
|
VaultGit,
|
|
vaultGitEnv,
|
|
buildCommitMessage,
|
|
BOT_AUTHOR_NAME,
|
|
BOT_AUTHOR_EMAIL,
|
|
DEFAULT_BRANCH,
|
|
} from "./engine/git.js";
|
|
export type { DiffEntry, MergeResult, CommitOptions } from "./engine/git.js";
|
|
|
|
export {
|
|
readExisting,
|
|
computePullActions,
|
|
applyPullActions,
|
|
} from "./engine/pull.js";
|
|
export type {
|
|
ReadExistingDeps,
|
|
PullActionsInput,
|
|
PullActions,
|
|
ApplyPullActionsDeps,
|
|
ApplyResult,
|
|
} from "./engine/pull.js";
|
|
|
|
export {
|
|
classifyRenameMoves,
|
|
computePushActions,
|
|
applyPushActions,
|
|
runPush,
|
|
parentFolderFile,
|
|
LAST_PUSHED_REF,
|
|
DOCMOST_BRANCH,
|
|
LOCAL_AUTHOR_NAME,
|
|
LOCAL_AUTHOR_EMAIL,
|
|
LOCAL_SOURCE_TRAILER,
|
|
} from "./engine/push.js";
|
|
export type {
|
|
CreateAction,
|
|
UpdateAction,
|
|
DeleteAction,
|
|
RenameMoveAction,
|
|
RenameMoveActionClassified,
|
|
ClassifyRenameMovesDeps,
|
|
PushActions,
|
|
PushActionsInput,
|
|
MetaSide,
|
|
ApplyPushDeps,
|
|
WrittenBackPage,
|
|
PushedPageRecord,
|
|
PushFailure,
|
|
PushNoop,
|
|
ApplyPushResult,
|
|
PushDeps,
|
|
PushRunResult,
|
|
} from "./engine/push.js";
|
|
|
|
export type { Settings } from "./engine/settings.js";
|
|
|
|
export { runCycle } from "./engine/cycle.js";
|
|
export type {
|
|
RunCycleDeps,
|
|
RunCycleResult,
|
|
CycleFs,
|
|
} from "./engine/cycle.js";
|
|
|
|
export {
|
|
assertVaultPathSafe,
|
|
isWithinRoot,
|
|
VaultPathUnsafeError,
|
|
} from "./engine/path-guard.js";
|
|
export type { PathGuardIo, VaultPathUnsafeReason } from "./engine/path-guard.js";
|
|
|
|
export { parsePageFile, serializePageFile } from "@docmost/prosemirror-markdown";
|