@abraca/convert 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/index.ts ADDED
@@ -0,0 +1,103 @@
1
+ // @abraca/convert — Bullet-proof Markdown ↔ Yjs/TipTap round-trip.
2
+ //
3
+ // One canonical source for converting between Markdown text (with MDC
4
+ // extensions covering every TipTap node/mark) and Yjs XmlFragments that
5
+ // match the cou-sh / abracadabra-nuxt / @abraca/mcp prose schema.
6
+ //
7
+ // Consumers (cou-sh, abracadabra-nuxt, @abraca/mcp) import these
8
+ // functions instead of maintaining their own copies. The full wire
9
+ // spec is in SPEC.md.
10
+
11
+ export {
12
+ filenameToLabel,
13
+ parseFrontmatter,
14
+ populateYDocFromMarkdown,
15
+ type FrontmatterResult,
16
+ } from './markdown-to-yjs.ts'
17
+
18
+ export { yjsToMarkdown, yjsToHtml, yjsToPlainText } from './yjs-to-markdown.ts'
19
+
20
+ export {
21
+ populateYDocFromHtml,
22
+ appendHtmlToFragment,
23
+ } from './html-to-yjs.ts'
24
+
25
+ export type { DocPageMeta } from './types.ts'
26
+
27
+ // Structural Y.XmlFragment ↔ JSON converter + diff. Used by the
28
+ // integration test suite and available to consumers who want to
29
+ // author golden fixtures or do their own assertions.
30
+ export {
31
+ yfragmentToJson,
32
+ jsonToYFragment,
33
+ diffYjs,
34
+ diffJson,
35
+ stringifyJsonNode,
36
+ type YjsJsonNode,
37
+ type YjsJsonElement,
38
+ type YjsJsonText,
39
+ type YjsTextRun,
40
+ type YjsDiff,
41
+ type JsonAttr,
42
+ } from './diff.ts'
43
+
44
+ // Wire-format spec registries — see SPEC.md for the human-readable
45
+ // version. The registries are the executable source of truth.
46
+ export {
47
+ NODE_SPECS,
48
+ NODE_SPEC_BY_NAME,
49
+ mdcTagOf,
50
+ type NodeSpec,
51
+ type NodeAttrSpec,
52
+ type NodeWireKind,
53
+ MARK_SPECS,
54
+ MARK_SPEC_BY_NAME,
55
+ MARK_SPEC_BY_DELIM,
56
+ type MarkSpec,
57
+ type MarkAttrSpec,
58
+ type MarkWireKind,
59
+ UNIVERSAL_META_KEYS,
60
+ UNIVERSAL_META_KEY_NAMES,
61
+ buildAliasMap,
62
+ type UniversalMetaKey,
63
+ type MetaValueType,
64
+ } from './spec/index.ts'
65
+
66
+ // File-block sidecar utilities (FS-sync). These have a soft runtime
67
+ // dependency on `@tauri-apps/plugin-fs` (loaded via dynamic import).
68
+ // Consumers that don't ship Tauri can use the pure helpers (path
69
+ // resolution, manifest mutation) without the FS-bound load/save.
70
+ export {
71
+ manifestDir,
72
+ trashDir,
73
+ orphansDir,
74
+ conflictsDir,
75
+ createEmptyManifest,
76
+ loadManifest,
77
+ saveManifest,
78
+ lookupByDocId,
79
+ lookupByPath,
80
+ lookupByHash,
81
+ setEntry,
82
+ removeEntry,
83
+ buildReverseLookup,
84
+ setFsAdapter,
85
+ getFsAdapter,
86
+ type FsAdapter,
87
+ type UploadManifestEntry,
88
+ type ManifestEntry,
89
+ type FsSyncManifest,
90
+ } from './file-blocks/manifest.ts'
91
+
92
+ export {
93
+ labelToFilename,
94
+ fsFilenameToLabel,
95
+ hasChildren,
96
+ buildRelativePath,
97
+ getDocDir,
98
+ resolveParentFromPath,
99
+ simpleHash,
100
+ getTreeData,
101
+ nextOrder,
102
+ type FsTreeEntry,
103
+ } from './file-blocks/paths.ts'