@takazudo/zfb-md-wasm 3.0.0 → 3.2.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/README.md +15 -15
- package/dist/browser.js.map +1 -1
- package/dist/highlight-browser.js.map +1 -1
- package/dist/highlight.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/mdast.js.map +1 -1
- package/dist/parse-browser.js.map +1 -1
- package/dist/parse.js.map +1 -1
- package/dist/render-browser.js.map +1 -1
- package/dist/render.js.map +1 -1
- package/dist/runtime-core.js.map +1 -1
- package/dist/wasm/zfb_md_wasm_bg.wasm +0 -0
- package/dist/wasm-highlight/zfb_md_wasm_highlight_bg.wasm +0 -0
- package/dist/wasm-parse/zfb_md_wasm_parse_bg.wasm +0 -0
- package/dist/wasm-render/zfb_md_wasm_render_bg.wasm +0 -0
- package/package.json +7 -5
package/README.md
CHANGED
|
@@ -31,12 +31,12 @@ migration. `./highlight` is also backward-compatible. New `./render` and
|
|
|
31
31
|
`zfb-render` but intentionally retain `zfb-content` and `syntect-fancy`.
|
|
32
32
|
`./parse` is not syntect-free.
|
|
33
33
|
|
|
34
|
-
| Entry | gzip-9 wasm (3.
|
|
34
|
+
| Entry | gzip-9 wasm (3.2.0) | Exact runtime values | Exact exported types |
|
|
35
35
|
| ------------- | -------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
36
|
-
| `.` | 1,
|
|
37
|
-
| `./highlight` | 817,
|
|
38
|
-
| `./render` | 1,
|
|
39
|
-
| `./parse` |
|
|
36
|
+
| `.` | 1,517,425 B | `init`, `compile`, `renderHtml`, `parseToAst`, `highlightCode`, `version`, `__forceTrapForTests`, `__getTrapRecoveryStateForTests`, `toMdastRoot`, `ZfbMdWasmTrapError`, `ZfbMdWasmTrapRecoveryLimitError`, `MdastAdapterError` | Full current compile/render/parse/raw-mdast/highlight surface |
|
|
37
|
+
| `./highlight` | 817,812 B | `init`, `highlightCode`, `version`, `__forceTrapForTests`, `__getTrapRecoveryStateForTests`, `ZfbMdWasmTrapError`, `ZfbMdWasmTrapRecoveryLimitError` | `HighlightRole`, `HighlightCodeOptions`, `HighlightCodeResult`, `HighlightDiagnostic`, `HighlightDiagnosticSource` |
|
|
38
|
+
| `./render` | 1,092,054 B | `init`, `renderHtml`, `version`, `ZfbMdWasmTrapError`, `ZfbMdWasmTrapRecoveryLimitError`, `__forceTrapForTests`, `__getTrapRecoveryStateForTests` | `RenderHtmlResult`, `Diagnostic`, `DiagnosticSource`, `ZfbMdWasmOptions`, `ParseDialect`, `PipelineOptions`, `GfmOptions`, `CodeHighlightMode`, `CodeHighlightOptions`, `MarkdownFeaturesConfig`, `HighlightRole` |
|
|
39
|
+
| `./parse` | 284,271 B | `init`, `parseToAst`, `toMdastRoot`, `MdastAdapterError`, `version`, `ZfbMdWasmTrapError`, `ZfbMdWasmTrapRecoveryLimitError`, `__forceTrapForTests`, `__getTrapRecoveryStateForTests` | `ParseToAstResult`, `ParseToAstOptions`, `ParseDialect`, `FrontmatterPolicy`, `ParsePipelineOptions`, `Diagnostic`, `DiagnosticSource`, `AstPoint`, `AstPosition`, `RawMdastData`, `MarkdownRsStop`, `MdastNode`, `MdastRoot`, `UnknownMdastNode`, `Root`, `Paragraph`, `Heading`, `ThematicBreak`, `Blockquote`, `List`, `ListItem`, `Html`, `Code`, `Definition`, `Text`, `DirectiveNodeBase`, `ContainerDirective`, `LeafDirective`, `TextDirective`, `Emphasis`, `Strong`, `InlineCode`, `Break`, `Link`, `Image`, `ReferenceKind`, `LinkReference`, `ImageReference`, `FootnoteDefinition`, `FootnoteReference`, `TableAlign`, `Table`, `TableRow`, `TableCell`, `Delete`, `Yaml`, `MdxFlowExpression`, `MdxTextExpression`, `MdxJsxFlowElement`, `MdxJsxTextElement`, `MdxJsxAttributeContent`, `MdxJsxAttribute`, `MdxJsxAttributeValueExpression`, `MdxJsxExpressionAttribute` |
|
|
40
40
|
|
|
41
41
|
The focused entries own private resource pairs:
|
|
42
42
|
|
|
@@ -705,8 +705,8 @@ suite gates exact-match). Deliberate limitations of the browser build:
|
|
|
705
705
|
- **Choose a focused artifact for non-compile calls.** The root remains the
|
|
706
706
|
compatibility entry and carries the complete compiler graph. `./highlight`
|
|
707
707
|
keeps its public API and resources while the post-#2449/#2450 graph is
|
|
708
|
-
proven SWC-free — and its payload shows it: 817,
|
|
709
|
-
1,
|
|
708
|
+
proven SWC-free — and its payload shows it: 817,812 B gzip-9 versus
|
|
709
|
+
1,517,425 B for root. `./render` and `./parse` are also SWC-free and omit
|
|
710
710
|
`zfb-render`; parse intentionally retains `zfb-content`/`syntect-fancy`, so
|
|
711
711
|
it is not syntect-free. Use `./render` or `./parse` when a consumer does
|
|
712
712
|
not need `compile`; root and highlight callers otherwise require no
|
|
@@ -743,23 +743,23 @@ three-step repair sequence:
|
|
|
743
743
|
they are compressor output (CI prints a warning inside the band), while
|
|
744
744
|
final wasm and glue remain byte-exact.
|
|
745
745
|
|
|
746
|
-
These are the shipped **3.
|
|
746
|
+
These are the shipped **3.2.0** artifact rows — optimized final wasm after
|
|
747
747
|
wasm-bindgen and wasm-opt, Node `gzipSync(..., { level: 9 })`, and glue
|
|
748
748
|
bytes/gzip:
|
|
749
749
|
|
|
750
750
|
| Entry/graph | final wasm | gzip-9 | glue | glue gzip-9 |
|
|
751
751
|
| ----------- | ----------: | ----------: | -------: | ----------: |
|
|
752
|
-
| root (full) | 3,
|
|
753
|
-
| highlight | 1,
|
|
754
|
-
| render | 2,
|
|
755
|
-
| parse | 700,
|
|
752
|
+
| root (full) | 3,393,514 B | 1,517,425 B | 14,998 B | 4,199 B |
|
|
753
|
+
| highlight | 1,537,556 B | 817,812 B | 8,758 B | 2,637 B |
|
|
754
|
+
| render | 2,192,801 B | 1,092,054 B | 8,772 B | 2,661 B |
|
|
755
|
+
| parse | 700,397 B | 284,271 B | 11,159 B | 3,797 B |
|
|
756
756
|
|
|
757
757
|
The #2447 decision snapshot measured the split package at 3,638,607 B versus
|
|
758
758
|
2,314,818 B for the root-plus-highlight package. Locked gzip-9 ceilings are
|
|
759
759
|
root 1,600,000 B, highlight 880,000 B, render 1,100,000 B, and parse
|
|
760
760
|
325,000 B; the complete packed tarball ceiling is 3,900,000 B. All four ship
|
|
761
|
-
inside their ceilings, with
|
|
762
|
-
(render), and
|
|
761
|
+
inside their ceilings, with 82,575 B (root), 62,188 B (highlight), 7,946 B
|
|
762
|
+
(render), and 40,729 B (parse) of headroom. These are 3.2.0 measurements, not
|
|
763
763
|
permanent promises — re-measure against the version you actually install.
|
|
764
764
|
The clean four-step production ceiling is 210 seconds; the selected #2447
|
|
765
765
|
median was 155.015 s [153.496, 165.977].
|
|
@@ -780,7 +780,7 @@ raw and 8,765 B smaller gzip-9 (758,244 B) — wasm-opt was already
|
|
|
780
780
|
dead-stripping the unreachable `swc_core`, and #2450's exact-parity and
|
|
781
781
|
no-`swc_core` assertions turned that emergent property into a guaranteed one.
|
|
782
782
|
The delta that matters to a highlight-only consumer is root versus
|
|
783
|
-
highlight: the highlight artifact is 1,
|
|
783
|
+
highlight: the highlight artifact is 1,855,958 B smaller raw and 699,613 B
|
|
784
784
|
smaller gzip-9, landing at about 45% of root's raw bytes and 54% of its
|
|
785
785
|
gzipped bytes.
|
|
786
786
|
|
package/dist/browser.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser.js","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,8CAA8C,CAAC;AACpE,OAAO,QAAQ,MAAM,gCAAgC,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,2EAA2E;A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,EAAE,MAAM,YAAY,CAAC","sourcesContent":["import glueHref from \"./wasm/zfb_md_wasm_glue.zfb-resource.mjs?url\";\nimport wasmHref from \"./wasm/zfb_md_wasm_bg.wasm?url\";\nimport { createWasmApi } from \"./runtime.js\";\n\n// `?url` is the explicit cross-bundler asset contract: both Vite and zfb's\n// pinned esbuild file loaders replace these imports with URL strings. Resolving\n// them from the final entry keeps relative esbuild output correct while also\n// accepting Vite's base-prefixed URLs.\nconst GLUE_URL = new URL(glueHref, import.meta.url);\nconst WASM_URL = new URL(wasmHref, import.meta.url);\n\nasync function loadBrowserWasmBytes(): Promise<ArrayBuffer> {\n const response = await fetch(WASM_URL);\n if (!response.ok) {\n throw new Error(\n `zfb-md-wasm: failed to fetch wasm binary: ${response.status} ${response.statusText}`,\n );\n }\n return response.arrayBuffer();\n}\n\nconst api = createWasmApi({\n glueUrl: GLUE_URL,\n loadWasmBytes: loadBrowserWasmBytes,\n});\n\nexport const {\n init,\n compile,\n renderHtml,\n // Raw-mdast export (zfb#1857, epic zfb#1854) -- see types.ts's\n // ParseToAstResult/MdastNode docs for the result shape and contract.\n parseToAst,\n highlightCode,\n version,\n __forceTrapForTests,\n __getTrapRecoveryStateForTests,\n} = api;\n\nexport { ZfbMdWasmTrapError, ZfbMdWasmTrapRecoveryLimitError } from \"./runtime.js\";\nexport { MdastAdapterError, toMdastRoot } from \"./mdast.js\";\n\nexport type {\n CompileResult,\n RenderHtmlResult,\n ParseToAstResult,\n ParseToAstOptions,\n ParseDialect,\n FrontmatterPolicy,\n ParsePipelineOptions,\n Diagnostic,\n DiagnosticSource,\n ZfbMdWasmOptions,\n PipelineOptions,\n GfmOptions,\n CodeHighlightMode,\n CodeHighlightOptions,\n MarkdownFeaturesConfig,\n HighlightRole,\n HighlightCodeOptions,\n HighlightCodeResult,\n HighlightDiagnostic,\n HighlightDiagnosticSource,\n AstPoint,\n AstPosition,\n RawMdastData,\n MarkdownRsStop,\n MdastNode,\n MdastRoot,\n UnknownMdastNode,\n Root,\n Paragraph,\n Heading,\n ThematicBreak,\n Blockquote,\n List,\n ListItem,\n Html,\n Code,\n Definition,\n Text,\n DirectiveNodeBase,\n ContainerDirective,\n LeafDirective,\n TextDirective,\n Emphasis,\n Strong,\n InlineCode,\n Break,\n Link,\n Image,\n ReferenceKind,\n LinkReference,\n ImageReference,\n FootnoteDefinition,\n FootnoteReference,\n TableAlign,\n Table,\n TableRow,\n TableCell,\n Delete,\n Yaml,\n MdxFlowExpression,\n MdxTextExpression,\n MdxJsxFlowElement,\n MdxJsxTextElement,\n MdxJsxAttributeContent,\n MdxJsxAttribute,\n MdxJsxAttributeValueExpression,\n MdxJsxExpressionAttribute,\n} from \"./types.js\";\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"highlight-browser.js","sourceRoot":"","sources":["../src/highlight-browser.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,kEAAkE,CAAC;AACxF,OAAO,QAAQ,MAAM,oDAAoD,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,0EAA0E;AAC1E,wEAAwE;AACxE,yEAAyE;AACzE,kDAAkD;AAClD,EAAE;AACF,2EAA2E;AAC3E,gFAAgF;AAChF,6EAA6E;AAC7E,uCAAuC;AACvC,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,QAAQ,EAAE,
|
|
1
|
+
{"version":3,"file":"highlight-browser.js","sourceRoot":"","sources":["../src/highlight-browser.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,kEAAkE,CAAC;AACxF,OAAO,QAAQ,MAAM,oDAAoD,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,0EAA0E;AAC1E,wEAAwE;AACxE,yEAAyE;AACzE,kDAAkD;AAClD,EAAE;AACF,2EAA2E;AAC3E,gFAAgF;AAChF,6EAA6E;AAC7E,uCAAuC;AACvC,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,QAAQ,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;AACpD,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,QAAQ,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;AAEpD,KAAK,UAAU,oBAAoB;IACjC,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,QAAQ,CAAC,CAAC;IACvC,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CACb,6CAA6C,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,UAAU,EAAE,CACtF,CAAC;IACJ,CAAC;IACD,OAAO,QAAQ,CAAC,WAAW,EAAE,CAAC;AAChC,CAAC;AAED,MAAM,GAAG,GAAG,aAAa,CAAC;IACxB,OAAO,EAAE,QAAQ;IACjB,aAAa,EAAE,oBAAoB;CACpC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,EAAE,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,mBAAmB,EAAE,8BAA8B,EAAE,GAChG,GAAG,CAAC;AAEN,OAAO,EAAE,kBAAkB,EAAE,+BAA+B,EAAE,MAAM,cAAc,CAAC","sourcesContent":["import glueHref from \"./wasm-highlight/zfb_md_wasm_highlight_glue.zfb-resource.mjs?url\";\nimport wasmHref from \"./wasm-highlight/zfb_md_wasm_highlight_bg.wasm?url\";\nimport { createWasmApi } from \"./runtime.js\";\n\n// Mirrors src/browser.ts, but points at the highlight-only artifact under\n// src/wasm-highlight/ (zfb#1849, epic zfb#1845) and re-exports only the\n// highlight-surface API -- see src/highlight.ts for the direct/Node twin\n// and why `compile`/`renderHtml` are absent here.\n//\n// `?url` is the explicit cross-bundler asset contract: both Vite and zfb's\n// pinned esbuild file loaders replace these imports with URL strings. Resolving\n// them from the final entry keeps relative esbuild output correct while also\n// accepting Vite's base-prefixed URLs.\nconst GLUE_URL = new URL(glueHref, import.meta.url);\nconst WASM_URL = new URL(wasmHref, import.meta.url);\n\nasync function loadBrowserWasmBytes(): Promise<ArrayBuffer> {\n const response = await fetch(WASM_URL);\n if (!response.ok) {\n throw new Error(\n `zfb-md-wasm: failed to fetch wasm binary: ${response.status} ${response.statusText}`,\n );\n }\n return response.arrayBuffer();\n}\n\nconst api = createWasmApi({\n glueUrl: GLUE_URL,\n loadWasmBytes: loadBrowserWasmBytes,\n});\n\nexport const { init, highlightCode, version, __forceTrapForTests, __getTrapRecoveryStateForTests } =\n api;\n\nexport { ZfbMdWasmTrapError, ZfbMdWasmTrapRecoveryLimitError } from \"./runtime.js\";\n\nexport type {\n HighlightRole,\n HighlightCodeOptions,\n HighlightCodeResult,\n HighlightDiagnostic,\n HighlightDiagnosticSource,\n} from \"./types.js\";\n"]}
|
package/dist/highlight.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"highlight.js","sourceRoot":"","sources":["../src/highlight.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,wEAAwE;AACxE,wEAAwE;AACxE,2EAA2E;AAC3E,2EAA2E;AAC3E,2CAA2C;AAC3C,MAAM,QAAQ,GAAG,IAAI,GAAG,CACtB,8DAA8D,EAC9D,
|
|
1
|
+
{"version":3,"file":"highlight.js","sourceRoot":"","sources":["../src/highlight.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,wEAAwE;AACxE,wEAAwE;AACxE,2EAA2E;AAC3E,2EAA2E;AAC3E,2CAA2C;AAC3C,MAAM,QAAQ,GAAG,IAAI,GAAG,CACtB,8DAA8D,EAC9D,OAAO,IAAI,CAAC,GAAG,CAChB,CAAC;AACF,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,gDAAgD,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;AAE5F,SAAS,MAAM;IACb,OAAO,OAAO,OAAO,KAAK,WAAW,IAAI,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC;AACpE,CAAC;AAED,6EAA6E;AAC7E,+EAA+E;AAC/E,8EAA8E;AAC9E,SAAS;AACT,KAAK,UAAU,mBAAmB;IAChC,IAAI,MAAM,EAAE,EAAE,CAAC;QACb,MAAM,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,aAAa,EAAE,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;YAC1D,MAAM,CAAC,kBAAkB,CAAC;YAC1B,MAAM,CAAC,UAAU,CAAC;SACnB,CAAC,CAAC;QACH,MAAM,KAAK,GAAG,MAAM,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC;QACtD,OAAO,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,UAAU,GAAG,KAAK,CAAC,UAAU,CAAgB,CAAC;IAClG,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,QAAQ,CAAC,CAAC;IACvC,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CACb,6CAA6C,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,UAAU,EAAE,CACtF,CAAC;IACJ,CAAC;IACD,OAAO,QAAQ,CAAC,WAAW,EAAE,CAAC;AAChC,CAAC;AAED,MAAM,GAAG,GAAG,aAAa,CAAC;IACxB,OAAO,EAAE,QAAQ;IACjB,aAAa,EAAE,mBAAmB;CACnC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,EAAE,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,mBAAmB,EAAE,8BAA8B,EAAE,GAChG,GAAG,CAAC;AAEN,OAAO,EAAE,kBAAkB,EAAE,+BAA+B,EAAE,MAAM,cAAc,CAAC","sourcesContent":["import { createWasmApi } from \"./runtime.js\";\n\n// Mirrors src/index.ts, but points at the highlight-only artifact under\n// src/wasm-highlight/ (zfb#1849, epic zfb#1845) and re-exports only the\n// highlight-surface API -- no `compile`/`renderHtml`, which the underlying\n// wasm module doesn't even export (built with the `pipeline` Cargo feature\n// off, see crates/zfb-md-wasm/Cargo.toml).\nconst GLUE_URL = new URL(\n \"./wasm-highlight/zfb_md_wasm_highlight_glue.zfb-resource.mjs\",\n import.meta.url,\n);\nconst WASM_URL = new URL(\"./wasm-highlight/zfb_md_wasm_highlight_bg.wasm\", import.meta.url);\n\nfunction isNode(): boolean {\n return typeof process !== \"undefined\" && !!process.versions?.node;\n}\n\n// Node's fetch cannot load file: URLs, while direct browser/module consumers\n// should keep fetching the files relative to this package entry. Browser-aware\n// bundlers select highlight-browser.ts instead, which has static resource URL\n// edges.\nasync function loadDirectWasmBytes(): Promise<ArrayBuffer> {\n if (isNode()) {\n const [{ readFile }, { fileURLToPath }] = await Promise.all([\n import(\"node:fs/promises\"),\n import(\"node:url\"),\n ]);\n const bytes = await readFile(fileURLToPath(WASM_URL));\n return bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength) as ArrayBuffer;\n }\n\n const response = await fetch(WASM_URL);\n if (!response.ok) {\n throw new Error(\n `zfb-md-wasm: failed to fetch wasm binary: ${response.status} ${response.statusText}`,\n );\n }\n return response.arrayBuffer();\n}\n\nconst api = createWasmApi({\n glueUrl: GLUE_URL,\n loadWasmBytes: loadDirectWasmBytes,\n});\n\nexport const { init, highlightCode, version, __forceTrapForTests, __getTrapRecoveryStateForTests } =\n api;\n\nexport { ZfbMdWasmTrapError, ZfbMdWasmTrapRecoveryLimitError } from \"./runtime.js\";\n\nexport type {\n HighlightRole,\n HighlightCodeOptions,\n HighlightCodeResult,\n HighlightDiagnostic,\n HighlightDiagnosticSource,\n} from \"./types.js\";\n"]}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7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,CAAC,WAAW,EAAE,CAAC;AAChC,CAAC;AAED,MAAM,GAAG,GAAG,aAAa,CAAC;IACxB,OAAO,EAAE,QAAQ;IACjB,aAAa,EAAE,mBAAmB;CACnC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,EACX,IAAI,EACJ,OAAO,EACP,UAAU;AACV,+DAA+D;AAC/D,qEAAqE;AACrE,UAAU,EACV,aAAa,EACb,OAAO,EACP,mBAAmB,EACnB,8BAA8B,GAC/B,GAAG,GAAG,CAAC;AAER,OAAO,EAAE,kBAAkB,EAAE,+BAA+B,EAAE,MAAM,cAAc,CAAC;AACnF,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC","sourcesContent":["import { createWasmApi } from \"./runtime.js\";\n\nconst GLUE_URL = new URL(\"./wasm/zfb_md_wasm_glue.zfb-resource.mjs\", import.meta.url);\nconst WASM_URL = new URL(\"./wasm/zfb_md_wasm_bg.wasm\", import.meta.url);\n\nfunction isNode(): boolean {\n return typeof process !== \"undefined\" && !!process.versions?.node;\n}\n\n// Node's fetch cannot load file: URLs, while direct browser/module consumers\n// should keep fetching the files relative to this package entry. Browser-aware\n// bundlers select browser.ts instead, which has static resource URL edges.\nasync function loadDirectWasmBytes(): Promise<ArrayBuffer> {\n if (isNode()) {\n const [{ readFile }, { fileURLToPath }] = await Promise.all([\n import(\"node:fs/promises\"),\n import(\"node:url\"),\n ]);\n const bytes = await readFile(fileURLToPath(WASM_URL));\n return bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength) as ArrayBuffer;\n }\n\n const response = await fetch(WASM_URL);\n if (!response.ok) {\n throw new Error(\n `zfb-md-wasm: failed to fetch wasm binary: ${response.status} ${response.statusText}`,\n );\n }\n return response.arrayBuffer();\n}\n\nconst api = createWasmApi({\n glueUrl: GLUE_URL,\n loadWasmBytes: loadDirectWasmBytes,\n});\n\nexport const {\n init,\n compile,\n renderHtml,\n // Raw-mdast export (zfb#1857, epic zfb#1854) -- see types.ts's\n // ParseToAstResult/MdastNode docs for the result shape and contract.\n parseToAst,\n highlightCode,\n version,\n __forceTrapForTests,\n __getTrapRecoveryStateForTests,\n} = api;\n\nexport { ZfbMdWasmTrapError, ZfbMdWasmTrapRecoveryLimitError } from \"./runtime.js\";\nexport { MdastAdapterError, toMdastRoot } from \"./mdast.js\";\n\nexport type {\n CompileResult,\n RenderHtmlResult,\n ParseToAstResult,\n ParseToAstOptions,\n ParseDialect,\n FrontmatterPolicy,\n ParsePipelineOptions,\n Diagnostic,\n DiagnosticSource,\n ZfbMdWasmOptions,\n PipelineOptions,\n GfmOptions,\n CodeHighlightMode,\n CodeHighlightOptions,\n MarkdownFeaturesConfig,\n HighlightRole,\n HighlightCodeOptions,\n HighlightCodeResult,\n HighlightDiagnostic,\n HighlightDiagnosticSource,\n AstPoint,\n AstPosition,\n RawMdastData,\n MarkdownRsStop,\n MdastNode,\n MdastRoot,\n UnknownMdastNode,\n Root,\n Paragraph,\n Heading,\n ThematicBreak,\n Blockquote,\n List,\n ListItem,\n Html,\n Code,\n Definition,\n Text,\n DirectiveNodeBase,\n ContainerDirective,\n LeafDirective,\n TextDirective,\n Emphasis,\n Strong,\n InlineCode,\n Break,\n Link,\n Image,\n ReferenceKind,\n LinkReference,\n ImageReference,\n FootnoteDefinition,\n FootnoteReference,\n TableAlign,\n Table,\n TableRow,\n TableCell,\n Delete,\n Yaml,\n MdxFlowExpression,\n MdxTextExpression,\n MdxJsxFlowElement,\n MdxJsxTextElement,\n MdxJsxAttributeContent,\n MdxJsxAttribute,\n MdxJsxAttributeValueExpression,\n MdxJsxExpressionAttribute,\n} from \"./types.js\";\n"]}
|
package/dist/mdast.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mdast.js","sourceRoot":"","sources":["../src/mdast.ts"],"names":[],"mappings":"AA+BA,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC;IAC7B,OAAO;IACP,QAAQ;IACR,UAAU;IACV,m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CAAC,CAAC;IACxC,OAAO;QACL,IAAI;QACJ,QAAQ,EAAE,QAAQ,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,CAAC;QACpC,GAAG,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;QACrD,QAAQ,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,YAAY,EAAE,IAAI,EAAE,aAAa,CAAC;KACtE,CAAC;AACJ,CAAC","sourcesContent":["// Empty type re-exports are the declaration-emitting form of augmentation\n// imports: TypeScript elides `import type {}` from `.d.ts` output, while these\n// remain in the published declaration and load both content-model registries.\nexport type {} from \"mdast-util-directive\";\nexport type {} from \"mdast-util-mdx\";\nimport type {\n BlockContent,\n DefinitionContent,\n ListItem,\n Paragraph,\n PhrasingContent,\n Root as EcosystemRoot,\n RootContent,\n TableCell,\n TableRow,\n TopLevelContent,\n} from \"mdast\";\nimport type {\n MdxJsxAttribute,\n MdxJsxAttributeValueExpression,\n MdxJsxExpressionAttribute,\n} from \"mdast-util-mdx\";\n\nimport type { MdastRoot } from \"./types.js\";\n\ntype RecordValue = Record<string, unknown>;\ntype FlowContent = BlockContent | DefinitionContent;\ntype Position = NonNullable<EcosystemRoot[\"position\"]>;\ntype Point = Position[\"start\"];\ntype ValidPoint = Point & { line: number; column: number; offset: number };\n\nconst PHRASING_TYPES = new Set([\n \"break\",\n \"delete\",\n \"emphasis\",\n \"footnoteReference\",\n \"html\",\n \"image\",\n \"imageReference\",\n \"inlineCode\",\n \"link\",\n \"linkReference\",\n \"mdxJsxTextElement\",\n \"mdxTextExpression\",\n \"strong\",\n \"text\",\n \"textDirective\",\n]);\n\nconst FLOW_TYPES = new Set([\n \"blockquote\",\n \"code\",\n \"containerDirective\",\n \"definition\",\n \"footnoteDefinition\",\n \"heading\",\n \"html\",\n \"leafDirective\",\n \"list\",\n \"mdxFlowExpression\",\n \"mdxJsxFlowElement\",\n \"paragraph\",\n \"table\",\n \"thematicBreak\",\n]);\n\nconst TOP_LEVEL_TYPES = new Set([...FLOW_TYPES, \"yaml\"]);\n\n/** A deterministic validation failure raised by {@link toMdastRoot}. */\nexport class MdastAdapterError extends TypeError {\n readonly path: string;\n readonly nodeType: string | null;\n\n constructor(path: string, nodeType: string | null, detail: string) {\n const displayType = nodeType === null ? \"null\" : JSON.stringify(nodeType);\n super(`Invalid mdast node at ${path} (type ${displayType}): ${detail}`);\n this.name = \"MdastAdapterError\";\n this.path = path;\n this.nodeType = nodeType;\n }\n}\n\nfunction fail(path: string, nodeType: string | null, detail: string): never {\n throw new MdastAdapterError(path, nodeType, detail);\n}\n\nfunction isRecord(value: unknown): value is RecordValue {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction isPlainRecord(value: unknown): value is RecordValue {\n if (!isRecord(value)) return false;\n const prototype: unknown = Object.getPrototypeOf(value);\n return prototype === Object.prototype || prototype === null;\n}\n\nfunction observedType(value: unknown): string | null {\n return isRecord(value) && typeof value.type === \"string\" ? value.type : null;\n}\n\nfunction assertOnlyKeys(\n value: RecordValue,\n allowed: readonly string[],\n path: string,\n nodeType: string | null,\n): void {\n const allowedSet = new Set(allowed);\n for (const key of Object.keys(value)) {\n if (!allowedSet.has(key)) {\n fail(`${path}.${key}`, nodeType, `unexpected field ${JSON.stringify(key)}`);\n }\n }\n}\n\nfunction requiredString(\n value: RecordValue,\n key: string,\n path: string,\n nodeType: string | null,\n): string {\n const field = value[key];\n if (typeof field !== \"string\") fail(`${path}.${key}`, nodeType, \"expected a string\");\n return field;\n}\n\nfunction optionalString(\n value: RecordValue,\n key: string,\n path: string,\n nodeType: string | null,\n): string | undefined {\n if (!(key in value)) return undefined;\n return requiredString(value, key, path, nodeType);\n}\n\nfunction requiredBoolean(\n value: RecordValue,\n key: string,\n path: string,\n nodeType: string | null,\n): boolean {\n const field = value[key];\n if (typeof field !== \"boolean\") fail(`${path}.${key}`, nodeType, \"expected a boolean\");\n return field;\n}\n\nfunction optionalBoolean(\n value: RecordValue,\n key: string,\n path: string,\n nodeType: string | null,\n): boolean | undefined {\n if (!(key in value)) return undefined;\n return requiredBoolean(value, key, path, nodeType);\n}\n\nfunction integer(value: unknown, path: string, nodeType: string | null, minimum: number): number {\n if (typeof value !== \"number\" || !Number.isInteger(value) || value < minimum) {\n fail(path, nodeType, `expected an integer greater than or equal to ${minimum}`);\n }\n return value;\n}\n\nfunction point(value: unknown, path: string, nodeType: string | null): ValidPoint {\n if (!isRecord(value)) fail(path, nodeType, \"expected a point object\");\n assertOnlyKeys(value, [\"line\", \"column\", \"offset\"], path, nodeType);\n return {\n line: integer(value.line, `${path}.line`, nodeType, 1),\n column: integer(value.column, `${path}.column`, nodeType, 1),\n offset: integer(value.offset, `${path}.offset`, nodeType, 0),\n };\n}\n\nfunction position(value: RecordValue, path: string, nodeType: string): Position {\n const raw = value.position;\n if (!isRecord(raw)) fail(`${path}.position`, nodeType, \"expected a position object\");\n assertOnlyKeys(raw, [\"start\", \"end\"], `${path}.position`, nodeType);\n const start = point(raw.start, `${path}.position.start`, nodeType);\n const end = point(raw.end, `${path}.position.end`, nodeType);\n if (\n end.offset < start.offset ||\n end.line < start.line ||\n (end.line === start.line && end.column < start.column)\n ) {\n fail(`${path}.position.end`, nodeType, \"position end precedes position start\");\n }\n return { start, end };\n}\n\nfunction cloneDataValue(\n value: unknown,\n path: string,\n nodeType: string,\n ancestors: Set<object>,\n): unknown {\n if (\n value === null ||\n value === undefined ||\n typeof value === \"string\" ||\n typeof value === \"boolean\"\n ) {\n return value;\n }\n if (typeof value === \"number\") {\n if (!Number.isFinite(value)) fail(path, nodeType, \"data contains a non-finite number\");\n return value;\n }\n if (typeof value !== \"object\") fail(path, nodeType, \"data must contain cloneable values\");\n if (ancestors.has(value)) fail(path, nodeType, \"data must not contain cycles\");\n ancestors.add(value);\n let cloned: unknown;\n if (Array.isArray(value)) {\n cloned = value.map((item, index) =>\n cloneDataValue(item, `${path}[${index}]`, nodeType, ancestors),\n );\n } else {\n if (!isPlainRecord(value)) fail(path, nodeType, \"data must contain only plain objects\");\n cloned = Object.fromEntries(\n Object.entries(value).map(([key, item]) => [\n key,\n cloneDataValue(item, `${path}.${key}`, nodeType, ancestors),\n ]),\n );\n }\n ancestors.delete(value);\n return cloned;\n}\n\nfunction data(value: RecordValue, path: string, nodeType: string): RecordValue | undefined {\n if (!(\"data\" in value)) return undefined;\n if (!isPlainRecord(value.data)) {\n fail(`${path}.data`, nodeType, \"expected a non-null plain object\");\n }\n const cloned = cloneDataValue(value.data, `${path}.data`, nodeType, new Set());\n if (!isRecord(cloned)) fail(`${path}.data`, nodeType, \"expected a data object\");\n return cloned;\n}\n\nfunction base(value: RecordValue, path: string, nodeType: string) {\n const nodeData = data(value, path, nodeType);\n return {\n position: position(value, path, nodeType),\n ...(nodeData === undefined ? {} : { data: nodeData }),\n };\n}\n\nfunction array(value: unknown, path: string, nodeType: string): unknown[] {\n if (!Array.isArray(value)) fail(path, nodeType, \"expected an array\");\n return value;\n}\n\nfunction stops(value: unknown, path: string, nodeType: string): void {\n for (const [index, pair] of array(value, path, nodeType).entries()) {\n const pairPath = `${path}[${index}]`;\n if (!Array.isArray(pair) || pair.length !== 2) {\n fail(pairPath, nodeType, \"expected a two-integer markdown-rs stop pair\");\n }\n integer(pair[0], `${pairPath}[0]`, nodeType, 0);\n integer(pair[1], `${pairPath}[1]`, nodeType, 0);\n }\n}\n\nfunction attributes(value: unknown, path: string, nodeType: string) {\n return array(value, path, nodeType).map((attribute, index) =>\n attributeRecord(attribute, `${path}[${index}]`, nodeType),\n );\n}\n\nfunction attributeRecord(\n value: unknown,\n path: string,\n parentType: string,\n): MdxJsxAttribute | MdxJsxExpressionAttribute {\n if (!isRecord(value)) fail(path, parentType, \"expected an MDX JSX attribute record\");\n const type = typeof value.type === \"string\" ? value.type : null;\n if (type === \"mdxJsxAttribute\") {\n assertOnlyKeys(value, [\"type\", \"data\", \"name\", \"value\"], path, type);\n const name = requiredString(value, \"name\", path, type);\n const nodeData = data(value, path, type);\n if (!(\"value\" in value)) {\n return { type, ...(nodeData === undefined ? {} : { data: nodeData }), name };\n }\n if (typeof value.value === \"string\") {\n return {\n type,\n ...(nodeData === undefined ? {} : { data: nodeData }),\n name,\n value: value.value,\n };\n }\n return {\n type,\n ...(nodeData === undefined ? {} : { data: nodeData }),\n name,\n value: attributeValue(value.value, `${path}.value`),\n };\n }\n if (type === \"mdxJsxExpressionAttribute\") {\n assertOnlyKeys(value, [\"type\", \"data\", \"value\", \"_markdownRsStops\"], path, type);\n const expression = requiredString(value, \"value\", path, type);\n stops(value._markdownRsStops, `${path}._markdownRsStops`, type);\n const nodeData = data(value, path, type);\n return { type, ...(nodeData === undefined ? {} : { data: nodeData }), value: expression };\n }\n fail(path, type, \"unsupported MDX JSX attribute type\");\n}\n\nfunction attributeValue(value: unknown, path: string): MdxJsxAttributeValueExpression {\n const type = observedType(value);\n if (!isRecord(value) || type !== \"mdxJsxAttributeValueExpression\") {\n fail(path, type, \"expected an MDX JSX attribute value expression\");\n }\n assertOnlyKeys(value, [\"type\", \"data\", \"value\", \"_markdownRsStops\"], path, type);\n const expression = requiredString(value, \"value\", path, type);\n stops(value._markdownRsStops, `${path}._markdownRsStops`, type);\n const nodeData = data(value, path, type);\n return { type, ...(nodeData === undefined ? {} : { data: nodeData }), value: expression };\n}\n\nfunction directiveAttributes(\n value: unknown,\n path: string,\n nodeType: string,\n): Record<string, string> {\n if (!isPlainRecord(value)) fail(path, nodeType, \"expected a plain attribute object\");\n const entries: [string, string][] = [];\n for (const [key, item] of Object.entries(value)) {\n if (typeof item !== \"string\") fail(`${path}.${key}`, nodeType, \"expected a string\");\n entries.push([key, item]);\n }\n return Object.fromEntries(entries);\n}\n\nfunction children<T>(\n value: unknown,\n path: string,\n nodeType: string,\n adapt: (child: unknown, childPath: string) => T,\n): T[] {\n return array(value, path, nodeType).map((child, index) => adapt(child, `${path}[${index}]`));\n}\n\nfunction adaptPhrasing(value: unknown, path: string): PhrasingContent {\n const type = observedType(value);\n if (type === null || !PHRASING_TYPES.has(type)) {\n fail(path, type, \"node is not valid phrasing content\");\n }\n const node = adaptContent(value, path);\n if (!isPhrasing(node)) fail(path, type, \"node is not valid phrasing content\");\n return node;\n}\n\nfunction adaptFlow(value: unknown, path: string): FlowContent {\n const type = observedType(value);\n if (type === null || !FLOW_TYPES.has(type)) fail(path, type, \"node is not valid flow content\");\n const node = adaptContent(value, path);\n if (!isFlow(node)) fail(path, type, \"node is not valid flow content\");\n return node;\n}\n\nfunction adaptTopLevel(value: unknown, path: string): TopLevelContent {\n const type = observedType(value);\n if (type === null || !TOP_LEVEL_TYPES.has(type)) {\n fail(path, type, \"node is not valid top-level content\");\n }\n const node = adaptContent(value, path);\n if (!isTopLevel(node)) fail(path, type, \"node is not valid top-level content\");\n return node;\n}\n\nfunction isPhrasing(node: RootContent): node is PhrasingContent {\n return PHRASING_TYPES.has(node.type);\n}\n\nfunction isFlow(node: RootContent): node is FlowContent {\n return FLOW_TYPES.has(node.type);\n}\n\nfunction isTopLevel(node: RootContent): node is TopLevelContent {\n return TOP_LEVEL_TYPES.has(node.type);\n}\n\nfunction adaptContent(value: unknown, path: string): RootContent {\n const type = observedType(value);\n if (!isRecord(value) || type === null) fail(path, type, \"expected an object with a string type\");\n const nodeBase = base(value, path, type);\n\n switch (type) {\n case \"paragraph\": {\n assertOnlyKeys(value, [\"type\", \"position\", \"data\", \"children\"], path, type);\n const node: Paragraph = {\n type,\n ...nodeBase,\n children: children(value.children, `${path}.children`, type, adaptPhrasing),\n };\n return node;\n }\n case \"heading\": {\n assertOnlyKeys(value, [\"type\", \"position\", \"data\", \"depth\", \"children\"], path, type);\n const depth = integer(value.depth, `${path}.depth`, type, 1);\n if (depth > 6) fail(`${path}.depth`, type, \"expected an integer from 1 through 6\");\n const headingDepth =\n depth === 1 ? 1 : depth === 2 ? 2 : depth === 3 ? 3 : depth === 4 ? 4 : depth === 5 ? 5 : 6;\n return {\n type,\n ...nodeBase,\n depth: headingDepth,\n children: children(value.children, `${path}.children`, type, adaptPhrasing),\n };\n }\n case \"blockquote\":\n case \"footnoteDefinition\": {\n const association = type === \"footnoteDefinition\";\n assertOnlyKeys(\n value,\n association\n ? [\"type\", \"position\", \"data\", \"identifier\", \"label\", \"children\"]\n : [\"type\", \"position\", \"data\", \"children\"],\n path,\n type,\n );\n const childNodes = children(value.children, `${path}.children`, type, adaptFlow);\n if (type === \"blockquote\") return { type, ...nodeBase, children: childNodes };\n const identifier = requiredString(value, \"identifier\", path, type);\n const label = optionalString(value, \"label\", path, type);\n return {\n type,\n ...nodeBase,\n identifier,\n ...(label === undefined ? {} : { label }),\n children: childNodes,\n };\n }\n case \"list\": {\n assertOnlyKeys(\n value,\n [\"type\", \"position\", \"data\", \"ordered\", \"start\", \"spread\", \"children\"],\n path,\n type,\n );\n const ordered = requiredBoolean(value, \"ordered\", path, type);\n const spread = requiredBoolean(value, \"spread\", path, type);\n let start: number | undefined;\n if (\"start\" in value) start = integer(value.start, `${path}.start`, type, 0);\n if (!ordered && start !== undefined)\n fail(`${path}.start`, type, \"unordered lists must omit start\");\n return {\n type,\n ...nodeBase,\n ordered,\n ...(start === undefined ? {} : { start }),\n spread,\n children: children(value.children, `${path}.children`, type, (child, childPath) => {\n const adapted = adaptContent(child, childPath);\n if (adapted.type !== \"listItem\")\n fail(childPath, adapted.type, \"list children must be listItem nodes\");\n return adapted;\n }),\n };\n }\n case \"listItem\": {\n assertOnlyKeys(\n value,\n [\"type\", \"position\", \"data\", \"spread\", \"checked\", \"children\"],\n path,\n type,\n );\n const checked = optionalBoolean(value, \"checked\", path, type);\n const node: ListItem = {\n type,\n ...nodeBase,\n spread: requiredBoolean(value, \"spread\", path, type),\n ...(checked === undefined ? {} : { checked }),\n children: children(value.children, `${path}.children`, type, adaptFlow),\n };\n return node;\n }\n case \"table\": {\n assertOnlyKeys(value, [\"type\", \"position\", \"data\", \"align\", \"children\"], path, type);\n const align = array(value.align, `${path}.align`, type).map((item, index) => {\n if (item !== null && item !== \"left\" && item !== \"right\" && item !== \"center\") {\n fail(`${path}.align[${index}]`, type, \"expected left, right, center, or null\");\n }\n return item;\n });\n return {\n type,\n ...nodeBase,\n align,\n children: children(value.children, `${path}.children`, type, (child, childPath) => {\n const adapted = adaptContent(child, childPath);\n if (adapted.type !== \"tableRow\")\n fail(childPath, adapted.type, \"table children must be tableRow nodes\");\n return adapted;\n }),\n };\n }\n case \"tableRow\": {\n assertOnlyKeys(value, [\"type\", \"position\", \"data\", \"children\"], path, type);\n const row: TableRow = {\n type,\n ...nodeBase,\n children: children(value.children, `${path}.children`, type, (child, childPath) => {\n const adapted = adaptContent(child, childPath);\n if (adapted.type !== \"tableCell\")\n fail(childPath, adapted.type, \"table row children must be tableCell nodes\");\n return adapted;\n }),\n };\n return row;\n }\n case \"tableCell\": {\n assertOnlyKeys(value, [\"type\", \"position\", \"data\", \"children\"], path, type);\n const cell: TableCell = {\n type,\n ...nodeBase,\n children: children(value.children, `${path}.children`, type, adaptPhrasing),\n };\n return cell;\n }\n case \"emphasis\":\n case \"strong\":\n case \"delete\":\n case \"link\":\n case \"linkReference\": {\n const resource = type === \"link\";\n const reference = type === \"linkReference\";\n const allowed = [\"type\", \"position\", \"data\", \"children\"];\n if (resource) allowed.push(\"url\", \"title\");\n if (reference) allowed.push(\"referenceType\", \"identifier\", \"label\");\n assertOnlyKeys(value, allowed, path, type);\n const childNodes = children(value.children, `${path}.children`, type, adaptPhrasing);\n if (type === \"emphasis\" || type === \"strong\" || type === \"delete\") {\n return { type, ...nodeBase, children: childNodes };\n }\n if (type === \"link\") {\n const title = optionalString(value, \"title\", path, type);\n return {\n type,\n ...nodeBase,\n url: requiredString(value, \"url\", path, type),\n ...(title === undefined ? {} : { title }),\n children: childNodes,\n };\n }\n const referenceType = referenceKind(value.referenceType, `${path}.referenceType`, type);\n const label = optionalString(value, \"label\", path, type);\n return {\n type,\n ...nodeBase,\n referenceType,\n identifier: requiredString(value, \"identifier\", path, type),\n ...(label === undefined ? {} : { label }),\n children: childNodes,\n };\n }\n case \"containerDirective\":\n case \"leafDirective\":\n case \"textDirective\": {\n assertOnlyKeys(\n value,\n [\"type\", \"position\", \"data\", \"name\", \"attributes\", \"children\"],\n path,\n type,\n );\n const shared = {\n type,\n ...nodeBase,\n name: requiredString(value, \"name\", path, type),\n attributes: directiveAttributes(value.attributes, `${path}.attributes`, type),\n };\n return type === \"containerDirective\"\n ? {\n ...shared,\n type,\n children: children(value.children, `${path}.children`, type, adaptFlow),\n }\n : {\n ...shared,\n type,\n children: children(value.children, `${path}.children`, type, adaptPhrasing),\n };\n }\n case \"mdxJsxFlowElement\":\n case \"mdxJsxTextElement\": {\n assertOnlyKeys(\n value,\n [\"type\", \"position\", \"data\", \"name\", \"attributes\", \"children\"],\n path,\n type,\n );\n const name = optionalString(value, \"name\", path, type) ?? null;\n const nodeAttributes = attributes(value.attributes, `${path}.attributes`, type);\n return type === \"mdxJsxFlowElement\"\n ? {\n type,\n ...nodeBase,\n name,\n attributes: nodeAttributes,\n children: children(value.children, `${path}.children`, type, adaptFlow),\n }\n : {\n type,\n ...nodeBase,\n name,\n attributes: nodeAttributes,\n children: children(value.children, `${path}.children`, type, adaptPhrasing),\n };\n }\n case \"mdxFlowExpression\":\n case \"mdxTextExpression\": {\n assertOnlyKeys(value, [\"type\", \"position\", \"data\", \"value\", \"_markdownRsStops\"], path, type);\n const expression = requiredString(value, \"value\", path, type);\n stops(value._markdownRsStops, `${path}._markdownRsStops`, type);\n return { type, ...nodeBase, value: expression };\n }\n case \"definition\": {\n assertOnlyKeys(\n value,\n [\"type\", \"position\", \"data\", \"url\", \"title\", \"identifier\", \"label\"],\n path,\n type,\n );\n const title = optionalString(value, \"title\", path, type);\n const label = optionalString(value, \"label\", path, type);\n return {\n type,\n ...nodeBase,\n url: requiredString(value, \"url\", path, type),\n ...(title === undefined ? {} : { title }),\n identifier: requiredString(value, \"identifier\", path, type),\n ...(label === undefined ? {} : { label }),\n };\n }\n case \"image\":\n case \"imageReference\": {\n const reference = type === \"imageReference\";\n assertOnlyKeys(\n value,\n reference\n ? [\"type\", \"position\", \"data\", \"alt\", \"referenceType\", \"identifier\", \"label\"]\n : [\"type\", \"position\", \"data\", \"alt\", \"url\", \"title\"],\n path,\n type,\n );\n const alt = requiredString(value, \"alt\", path, type);\n if (type === \"image\") {\n const title = optionalString(value, \"title\", path, type);\n return {\n type,\n ...nodeBase,\n alt,\n url: requiredString(value, \"url\", path, type),\n ...(title === undefined ? {} : { title }),\n };\n }\n const label = optionalString(value, \"label\", path, type);\n return {\n type,\n ...nodeBase,\n alt,\n referenceType: referenceKind(value.referenceType, `${path}.referenceType`, type),\n identifier: requiredString(value, \"identifier\", path, type),\n ...(label === undefined ? {} : { label }),\n };\n }\n case \"footnoteReference\": {\n assertOnlyKeys(value, [\"type\", \"position\", \"data\", \"identifier\", \"label\"], path, type);\n const label = optionalString(value, \"label\", path, type);\n return {\n type,\n ...nodeBase,\n identifier: requiredString(value, \"identifier\", path, type),\n ...(label === undefined ? {} : { label }),\n };\n }\n case \"code\": {\n assertOnlyKeys(value, [\"type\", \"position\", \"data\", \"lang\", \"meta\", \"value\"], path, type);\n const lang = optionalString(value, \"lang\", path, type);\n const meta = optionalString(value, \"meta\", path, type);\n return {\n type,\n ...nodeBase,\n ...(lang === undefined ? {} : { lang }),\n ...(meta === undefined ? {} : { meta }),\n value: requiredString(value, \"value\", path, type),\n };\n }\n case \"html\":\n case \"text\":\n case \"inlineCode\":\n case \"yaml\": {\n assertOnlyKeys(value, [\"type\", \"position\", \"data\", \"value\"], path, type);\n return { type, ...nodeBase, value: requiredString(value, \"value\", path, type) };\n }\n case \"thematicBreak\":\n case \"break\": {\n assertOnlyKeys(value, [\"type\", \"position\", \"data\"], path, type);\n return { type, ...nodeBase };\n }\n case \"root\":\n fail(path, type, \"nested root nodes are not supported\");\n case \"math\":\n case \"inlineMath\":\n case \"toml\":\n case \"mdxjsEsm\":\n fail(path, type, \"node type is currently unsupported by the adapter\");\n default:\n fail(path, type, \"unknown node type\");\n }\n}\n\nfunction referenceKind(value: unknown, path: string, nodeType: string) {\n if (value !== \"shortcut\" && value !== \"collapsed\" && value !== \"full\") {\n fail(path, nodeType, \"expected shortcut, collapsed, or full\");\n }\n return value;\n}\n\n/**\n * Validate a raw `parseToAst` tree and return a detached canonical mdast tree.\n *\n * This strict adapter is intentionally separate from the forward-compatible\n * raw tier: unsupported or malformed nodes throw instead of being dropped.\n */\nexport function toMdastRoot(ast: MdastRoot | null): EcosystemRoot {\n if (ast === null) fail(\"$\", null, \"expected a root node\");\n const value: unknown = ast;\n const type = observedType(value);\n if (!isRecord(value) || type !== \"root\") fail(\"$\", type, \"expected a root node\");\n assertOnlyKeys(value, [\"type\", \"position\", \"data\", \"children\"], \"$\", type);\n const nodeData = data(value, \"$\", type);\n return {\n type,\n position: position(value, \"$\", type),\n ...(nodeData === undefined ? {} : { data: nodeData }),\n children: children(value.children, \"$.children\", type, adaptTopLevel),\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"mdast.js","sourceRoot":"","sources":["../src/mdast.ts"],"names":[],"mappings":"AA+BA,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC;IAC7B,OAAO;IACP,QAAQ;IACR,UAAU;IACV,mBAAmB;IACnB,MAAM;IACN,OAAO;IACP,gBAAgB;IAChB,YAAY;IACZ,MAAM;IACN,eAAe;IACf,mBAAmB;IACnB,mBAAmB;IACnB,QAAQ;IACR,MAAM;IACN,eAAe;CAChB,CAAC,CAAC;AAEH,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC;IACzB,YAAY;IACZ,MAAM;IACN,oBAAoB;IACpB,YAAY;IACZ,oBAAoB;IACpB,SAAS;IACT,MAAM;IACN,eAAe;IACf,MAAM;IACN,mBAAmB;IACnB,mBAAmB;IACnB,WAAW;IACX,OAAO;IACP,eAAe;CAChB,CAAC,CAAC;AAEH,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC,CAAC,GAA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AAM,EAAE,CAAC;QACtE,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,uCAAuC,CAAC,CAAC;IAChE,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CAAC,GAAqB;IAC/C,IAAI,GAAG,KAAK,IAAI;QAAE,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,sBAAsB,CAAC,CAAC;IAC1D,MAAM,KAAK,GAAY,GAAG,CAAC;IAC3B,MAAM,IAAI,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;IACjC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,IAAI,KAAK,MAAM;QAAE,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,sBAAsB,CAAC,CAAC;IACjF,cAAc,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;IAC3E,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;IACxC,OAAO;QACL,IAAI;QACJ,QAAQ,EAAE,QAAQ,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,CAAC;QACpC,GAAG,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;QACrD,QAAQ,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,YAAY,EAAE,IAAI,EAAE,aAAa,CAAC;KACtE,CAAC;AACJ,CAAC","sourcesContent":["// Empty type re-exports are the declaration-emitting form of augmentation\n// imports: TypeScript elides `import type {}` from `.d.ts` output, while these\n// remain in the published declaration and load both content-model registries.\nexport type {} from \"mdast-util-directive\";\nexport type {} from \"mdast-util-mdx\";\nimport type {\n BlockContent,\n DefinitionContent,\n ListItem,\n Paragraph,\n PhrasingContent,\n Root as EcosystemRoot,\n RootContent,\n TableCell,\n TableRow,\n TopLevelContent,\n} from \"mdast\";\nimport type {\n MdxJsxAttribute,\n MdxJsxAttributeValueExpression,\n MdxJsxExpressionAttribute,\n} from \"mdast-util-mdx\";\n\nimport type { MdastRoot } from \"./types.js\";\n\ntype RecordValue = Record<string, unknown>;\ntype FlowContent = BlockContent | DefinitionContent;\ntype Position = NonNullable<EcosystemRoot[\"position\"]>;\ntype Point = Position[\"start\"];\ntype ValidPoint = Point & { line: number; column: number; offset: number };\n\nconst PHRASING_TYPES = new Set([\n \"break\",\n \"delete\",\n \"emphasis\",\n \"footnoteReference\",\n \"html\",\n \"image\",\n \"imageReference\",\n \"inlineCode\",\n \"link\",\n \"linkReference\",\n \"mdxJsxTextElement\",\n \"mdxTextExpression\",\n \"strong\",\n \"text\",\n \"textDirective\",\n]);\n\nconst FLOW_TYPES = new Set([\n \"blockquote\",\n \"code\",\n \"containerDirective\",\n \"definition\",\n \"footnoteDefinition\",\n \"heading\",\n \"html\",\n \"leafDirective\",\n \"list\",\n \"mdxFlowExpression\",\n \"mdxJsxFlowElement\",\n \"paragraph\",\n \"table\",\n \"thematicBreak\",\n]);\n\nconst TOP_LEVEL_TYPES = new Set([...FLOW_TYPES, \"yaml\"]);\n\n/** A deterministic validation failure raised by {@link toMdastRoot}. */\nexport class MdastAdapterError extends TypeError {\n readonly path: string;\n readonly nodeType: string | null;\n\n constructor(path: string, nodeType: string | null, detail: string) {\n const displayType = nodeType === null ? \"null\" : JSON.stringify(nodeType);\n super(`Invalid mdast node at ${path} (type ${displayType}): ${detail}`);\n this.name = \"MdastAdapterError\";\n this.path = path;\n this.nodeType = nodeType;\n }\n}\n\nfunction fail(path: string, nodeType: string | null, detail: string): never {\n throw new MdastAdapterError(path, nodeType, detail);\n}\n\nfunction isRecord(value: unknown): value is RecordValue {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction isPlainRecord(value: unknown): value is RecordValue {\n if (!isRecord(value)) return false;\n const prototype: unknown = Object.getPrototypeOf(value);\n return prototype === Object.prototype || prototype === null;\n}\n\nfunction observedType(value: unknown): string | null {\n return isRecord(value) && typeof value.type === \"string\" ? value.type : null;\n}\n\nfunction assertOnlyKeys(\n value: RecordValue,\n allowed: readonly string[],\n path: string,\n nodeType: string | null,\n): void {\n const allowedSet = new Set(allowed);\n for (const key of Object.keys(value)) {\n if (!allowedSet.has(key)) {\n fail(`${path}.${key}`, nodeType, `unexpected field ${JSON.stringify(key)}`);\n }\n }\n}\n\nfunction requiredString(\n value: RecordValue,\n key: string,\n path: string,\n nodeType: string | null,\n): string {\n const field = value[key];\n if (typeof field !== \"string\") fail(`${path}.${key}`, nodeType, \"expected a string\");\n return field;\n}\n\nfunction optionalString(\n value: RecordValue,\n key: string,\n path: string,\n nodeType: string | null,\n): string | undefined {\n if (!(key in value)) return undefined;\n return requiredString(value, key, path, nodeType);\n}\n\nfunction requiredBoolean(\n value: RecordValue,\n key: string,\n path: string,\n nodeType: string | null,\n): boolean {\n const field = value[key];\n if (typeof field !== \"boolean\") fail(`${path}.${key}`, nodeType, \"expected a boolean\");\n return field;\n}\n\nfunction optionalBoolean(\n value: RecordValue,\n key: string,\n path: string,\n nodeType: string | null,\n): boolean | undefined {\n if (!(key in value)) return undefined;\n return requiredBoolean(value, key, path, nodeType);\n}\n\nfunction integer(value: unknown, path: string, nodeType: string | null, minimum: number): number {\n if (typeof value !== \"number\" || !Number.isInteger(value) || value < minimum) {\n fail(path, nodeType, `expected an integer greater than or equal to ${minimum}`);\n }\n return value;\n}\n\nfunction point(value: unknown, path: string, nodeType: string | null): ValidPoint {\n if (!isRecord(value)) fail(path, nodeType, \"expected a point object\");\n assertOnlyKeys(value, [\"line\", \"column\", \"offset\"], path, nodeType);\n return {\n line: integer(value.line, `${path}.line`, nodeType, 1),\n column: integer(value.column, `${path}.column`, nodeType, 1),\n offset: integer(value.offset, `${path}.offset`, nodeType, 0),\n };\n}\n\nfunction position(value: RecordValue, path: string, nodeType: string): Position {\n const raw = value.position;\n if (!isRecord(raw)) fail(`${path}.position`, nodeType, \"expected a position object\");\n assertOnlyKeys(raw, [\"start\", \"end\"], `${path}.position`, nodeType);\n const start = point(raw.start, `${path}.position.start`, nodeType);\n const end = point(raw.end, `${path}.position.end`, nodeType);\n if (\n end.offset < start.offset ||\n end.line < start.line ||\n (end.line === start.line && end.column < start.column)\n ) {\n fail(`${path}.position.end`, nodeType, \"position end precedes position start\");\n }\n return { start, end };\n}\n\nfunction cloneDataValue(\n value: unknown,\n path: string,\n nodeType: string,\n ancestors: Set<object>,\n): unknown {\n if (\n value === null ||\n value === undefined ||\n typeof value === \"string\" ||\n typeof value === \"boolean\"\n ) {\n return value;\n }\n if (typeof value === \"number\") {\n if (!Number.isFinite(value)) fail(path, nodeType, \"data contains a non-finite number\");\n return value;\n }\n if (typeof value !== \"object\") fail(path, nodeType, \"data must contain cloneable values\");\n if (ancestors.has(value)) fail(path, nodeType, \"data must not contain cycles\");\n ancestors.add(value);\n let cloned: unknown;\n if (Array.isArray(value)) {\n cloned = value.map((item, index) =>\n cloneDataValue(item, `${path}[${index}]`, nodeType, ancestors),\n );\n } else {\n if (!isPlainRecord(value)) fail(path, nodeType, \"data must contain only plain objects\");\n cloned = Object.fromEntries(\n Object.entries(value).map(([key, item]) => [\n key,\n cloneDataValue(item, `${path}.${key}`, nodeType, ancestors),\n ]),\n );\n }\n ancestors.delete(value);\n return cloned;\n}\n\nfunction data(value: RecordValue, path: string, nodeType: string): RecordValue | undefined {\n if (!(\"data\" in value)) return undefined;\n if (!isPlainRecord(value.data)) {\n fail(`${path}.data`, nodeType, \"expected a non-null plain object\");\n }\n const cloned = cloneDataValue(value.data, `${path}.data`, nodeType, new Set());\n if (!isRecord(cloned)) fail(`${path}.data`, nodeType, \"expected a data object\");\n return cloned;\n}\n\nfunction base(value: RecordValue, path: string, nodeType: string) {\n const nodeData = data(value, path, nodeType);\n return {\n position: position(value, path, nodeType),\n ...(nodeData === undefined ? {} : { data: nodeData }),\n };\n}\n\nfunction array(value: unknown, path: string, nodeType: string): unknown[] {\n if (!Array.isArray(value)) fail(path, nodeType, \"expected an array\");\n return value;\n}\n\nfunction stops(value: unknown, path: string, nodeType: string): void {\n for (const [index, pair] of array(value, path, nodeType).entries()) {\n const pairPath = `${path}[${index}]`;\n if (!Array.isArray(pair) || pair.length !== 2) {\n fail(pairPath, nodeType, \"expected a two-integer markdown-rs stop pair\");\n }\n integer(pair[0], `${pairPath}[0]`, nodeType, 0);\n integer(pair[1], `${pairPath}[1]`, nodeType, 0);\n }\n}\n\nfunction attributes(value: unknown, path: string, nodeType: string) {\n return array(value, path, nodeType).map((attribute, index) =>\n attributeRecord(attribute, `${path}[${index}]`, nodeType),\n );\n}\n\nfunction attributeRecord(\n value: unknown,\n path: string,\n parentType: string,\n): MdxJsxAttribute | MdxJsxExpressionAttribute {\n if (!isRecord(value)) fail(path, parentType, \"expected an MDX JSX attribute record\");\n const type = typeof value.type === \"string\" ? value.type : null;\n if (type === \"mdxJsxAttribute\") {\n assertOnlyKeys(value, [\"type\", \"data\", \"name\", \"value\"], path, type);\n const name = requiredString(value, \"name\", path, type);\n const nodeData = data(value, path, type);\n if (!(\"value\" in value)) {\n return { type, ...(nodeData === undefined ? {} : { data: nodeData }), name };\n }\n if (typeof value.value === \"string\") {\n return {\n type,\n ...(nodeData === undefined ? {} : { data: nodeData }),\n name,\n value: value.value,\n };\n }\n return {\n type,\n ...(nodeData === undefined ? {} : { data: nodeData }),\n name,\n value: attributeValue(value.value, `${path}.value`),\n };\n }\n if (type === \"mdxJsxExpressionAttribute\") {\n assertOnlyKeys(value, [\"type\", \"data\", \"value\", \"_markdownRsStops\"], path, type);\n const expression = requiredString(value, \"value\", path, type);\n stops(value._markdownRsStops, `${path}._markdownRsStops`, type);\n const nodeData = data(value, path, type);\n return { type, ...(nodeData === undefined ? {} : { data: nodeData }), value: expression };\n }\n fail(path, type, \"unsupported MDX JSX attribute type\");\n}\n\nfunction attributeValue(value: unknown, path: string): MdxJsxAttributeValueExpression {\n const type = observedType(value);\n if (!isRecord(value) || type !== \"mdxJsxAttributeValueExpression\") {\n fail(path, type, \"expected an MDX JSX attribute value expression\");\n }\n assertOnlyKeys(value, [\"type\", \"data\", \"value\", \"_markdownRsStops\"], path, type);\n const expression = requiredString(value, \"value\", path, type);\n stops(value._markdownRsStops, `${path}._markdownRsStops`, type);\n const nodeData = data(value, path, type);\n return { type, ...(nodeData === undefined ? {} : { data: nodeData }), value: expression };\n}\n\nfunction directiveAttributes(\n value: unknown,\n path: string,\n nodeType: string,\n): Record<string, string> {\n if (!isPlainRecord(value)) fail(path, nodeType, \"expected a plain attribute object\");\n const entries: [string, string][] = [];\n for (const [key, item] of Object.entries(value)) {\n if (typeof item !== \"string\") fail(`${path}.${key}`, nodeType, \"expected a string\");\n entries.push([key, item]);\n }\n return Object.fromEntries(entries);\n}\n\nfunction children<T>(\n value: unknown,\n path: string,\n nodeType: string,\n adapt: (child: unknown, childPath: string) => T,\n): T[] {\n return array(value, path, nodeType).map((child, index) => adapt(child, `${path}[${index}]`));\n}\n\nfunction adaptPhrasing(value: unknown, path: string): PhrasingContent {\n const type = observedType(value);\n if (type === null || !PHRASING_TYPES.has(type)) {\n fail(path, type, \"node is not valid phrasing content\");\n }\n const node = adaptContent(value, path);\n if (!isPhrasing(node)) fail(path, type, \"node is not valid phrasing content\");\n return node;\n}\n\nfunction adaptFlow(value: unknown, path: string): FlowContent {\n const type = observedType(value);\n if (type === null || !FLOW_TYPES.has(type)) fail(path, type, \"node is not valid flow content\");\n const node = adaptContent(value, path);\n if (!isFlow(node)) fail(path, type, \"node is not valid flow content\");\n return node;\n}\n\nfunction adaptTopLevel(value: unknown, path: string): TopLevelContent {\n const type = observedType(value);\n if (type === null || !TOP_LEVEL_TYPES.has(type)) {\n fail(path, type, \"node is not valid top-level content\");\n }\n const node = adaptContent(value, path);\n if (!isTopLevel(node)) fail(path, type, \"node is not valid top-level content\");\n return node;\n}\n\nfunction isPhrasing(node: RootContent): node is PhrasingContent {\n return PHRASING_TYPES.has(node.type);\n}\n\nfunction isFlow(node: RootContent): node is FlowContent {\n return FLOW_TYPES.has(node.type);\n}\n\nfunction isTopLevel(node: RootContent): node is TopLevelContent {\n return TOP_LEVEL_TYPES.has(node.type);\n}\n\nfunction adaptContent(value: unknown, path: string): RootContent {\n const type = observedType(value);\n if (!isRecord(value) || type === null) fail(path, type, \"expected an object with a string type\");\n const nodeBase = base(value, path, type);\n\n switch (type) {\n case \"paragraph\": {\n assertOnlyKeys(value, [\"type\", \"position\", \"data\", \"children\"], path, type);\n const node: Paragraph = {\n type,\n ...nodeBase,\n children: children(value.children, `${path}.children`, type, adaptPhrasing),\n };\n return node;\n }\n case \"heading\": {\n assertOnlyKeys(value, [\"type\", \"position\", \"data\", \"depth\", \"children\"], path, type);\n const depth = integer(value.depth, `${path}.depth`, type, 1);\n if (depth > 6) fail(`${path}.depth`, type, \"expected an integer from 1 through 6\");\n const headingDepth =\n depth === 1 ? 1 : depth === 2 ? 2 : depth === 3 ? 3 : depth === 4 ? 4 : depth === 5 ? 5 : 6;\n return {\n type,\n ...nodeBase,\n depth: headingDepth,\n children: children(value.children, `${path}.children`, type, adaptPhrasing),\n };\n }\n case \"blockquote\":\n case \"footnoteDefinition\": {\n const association = type === \"footnoteDefinition\";\n assertOnlyKeys(\n value,\n association\n ? [\"type\", \"position\", \"data\", \"identifier\", \"label\", \"children\"]\n : [\"type\", \"position\", \"data\", \"children\"],\n path,\n type,\n );\n const childNodes = children(value.children, `${path}.children`, type, adaptFlow);\n if (type === \"blockquote\") return { type, ...nodeBase, children: childNodes };\n const identifier = requiredString(value, \"identifier\", path, type);\n const label = optionalString(value, \"label\", path, type);\n return {\n type,\n ...nodeBase,\n identifier,\n ...(label === undefined ? {} : { label }),\n children: childNodes,\n };\n }\n case \"list\": {\n assertOnlyKeys(\n value,\n [\"type\", \"position\", \"data\", \"ordered\", \"start\", \"spread\", \"children\"],\n path,\n type,\n );\n const ordered = requiredBoolean(value, \"ordered\", path, type);\n const spread = requiredBoolean(value, \"spread\", path, type);\n let start: number | undefined;\n if (\"start\" in value) start = integer(value.start, `${path}.start`, type, 0);\n if (!ordered && start !== undefined)\n fail(`${path}.start`, type, \"unordered lists must omit start\");\n return {\n type,\n ...nodeBase,\n ordered,\n ...(start === undefined ? {} : { start }),\n spread,\n children: children(value.children, `${path}.children`, type, (child, childPath) => {\n const adapted = adaptContent(child, childPath);\n if (adapted.type !== \"listItem\")\n fail(childPath, adapted.type, \"list children must be listItem nodes\");\n return adapted;\n }),\n };\n }\n case \"listItem\": {\n assertOnlyKeys(\n value,\n [\"type\", \"position\", \"data\", \"spread\", \"checked\", \"children\"],\n path,\n type,\n );\n const checked = optionalBoolean(value, \"checked\", path, type);\n const node: ListItem = {\n type,\n ...nodeBase,\n spread: requiredBoolean(value, \"spread\", path, type),\n ...(checked === undefined ? {} : { checked }),\n children: children(value.children, `${path}.children`, type, adaptFlow),\n };\n return node;\n }\n case \"table\": {\n assertOnlyKeys(value, [\"type\", \"position\", \"data\", \"align\", \"children\"], path, type);\n const align = array(value.align, `${path}.align`, type).map((item, index) => {\n if (item !== null && item !== \"left\" && item !== \"right\" && item !== \"center\") {\n fail(`${path}.align[${index}]`, type, \"expected left, right, center, or null\");\n }\n return item;\n });\n return {\n type,\n ...nodeBase,\n align,\n children: children(value.children, `${path}.children`, type, (child, childPath) => {\n const adapted = adaptContent(child, childPath);\n if (adapted.type !== \"tableRow\")\n fail(childPath, adapted.type, \"table children must be tableRow nodes\");\n return adapted;\n }),\n };\n }\n case \"tableRow\": {\n assertOnlyKeys(value, [\"type\", \"position\", \"data\", \"children\"], path, type);\n const row: TableRow = {\n type,\n ...nodeBase,\n children: children(value.children, `${path}.children`, type, (child, childPath) => {\n const adapted = adaptContent(child, childPath);\n if (adapted.type !== \"tableCell\")\n fail(childPath, adapted.type, \"table row children must be tableCell nodes\");\n return adapted;\n }),\n };\n return row;\n }\n case \"tableCell\": {\n assertOnlyKeys(value, [\"type\", \"position\", \"data\", \"children\"], path, type);\n const cell: TableCell = {\n type,\n ...nodeBase,\n children: children(value.children, `${path}.children`, type, adaptPhrasing),\n };\n return cell;\n }\n case \"emphasis\":\n case \"strong\":\n case \"delete\":\n case \"link\":\n case \"linkReference\": {\n const resource = type === \"link\";\n const reference = type === \"linkReference\";\n const allowed = [\"type\", \"position\", \"data\", \"children\"];\n if (resource) allowed.push(\"url\", \"title\");\n if (reference) allowed.push(\"referenceType\", \"identifier\", \"label\");\n assertOnlyKeys(value, allowed, path, type);\n const childNodes = children(value.children, `${path}.children`, type, adaptPhrasing);\n if (type === \"emphasis\" || type === \"strong\" || type === \"delete\") {\n return { type, ...nodeBase, children: childNodes };\n }\n if (type === \"link\") {\n const title = optionalString(value, \"title\", path, type);\n return {\n type,\n ...nodeBase,\n url: requiredString(value, \"url\", path, type),\n ...(title === undefined ? {} : { title }),\n children: childNodes,\n };\n }\n const referenceType = referenceKind(value.referenceType, `${path}.referenceType`, type);\n const label = optionalString(value, \"label\", path, type);\n return {\n type,\n ...nodeBase,\n referenceType,\n identifier: requiredString(value, \"identifier\", path, type),\n ...(label === undefined ? {} : { label }),\n children: childNodes,\n };\n }\n case \"containerDirective\":\n case \"leafDirective\":\n case \"textDirective\": {\n assertOnlyKeys(\n value,\n [\"type\", \"position\", \"data\", \"name\", \"attributes\", \"children\"],\n path,\n type,\n );\n const shared = {\n type,\n ...nodeBase,\n name: requiredString(value, \"name\", path, type),\n attributes: directiveAttributes(value.attributes, `${path}.attributes`, type),\n };\n return type === \"containerDirective\"\n ? {\n ...shared,\n type,\n children: children(value.children, `${path}.children`, type, adaptFlow),\n }\n : {\n ...shared,\n type,\n children: children(value.children, `${path}.children`, type, adaptPhrasing),\n };\n }\n case \"mdxJsxFlowElement\":\n case \"mdxJsxTextElement\": {\n assertOnlyKeys(\n value,\n [\"type\", \"position\", \"data\", \"name\", \"attributes\", \"children\"],\n path,\n type,\n );\n const name = optionalString(value, \"name\", path, type) ?? null;\n const nodeAttributes = attributes(value.attributes, `${path}.attributes`, type);\n return type === \"mdxJsxFlowElement\"\n ? {\n type,\n ...nodeBase,\n name,\n attributes: nodeAttributes,\n children: children(value.children, `${path}.children`, type, adaptFlow),\n }\n : {\n type,\n ...nodeBase,\n name,\n attributes: nodeAttributes,\n children: children(value.children, `${path}.children`, type, adaptPhrasing),\n };\n }\n case \"mdxFlowExpression\":\n case \"mdxTextExpression\": {\n assertOnlyKeys(value, [\"type\", \"position\", \"data\", \"value\", \"_markdownRsStops\"], path, type);\n const expression = requiredString(value, \"value\", path, type);\n stops(value._markdownRsStops, `${path}._markdownRsStops`, type);\n return { type, ...nodeBase, value: expression };\n }\n case \"definition\": {\n assertOnlyKeys(\n value,\n [\"type\", \"position\", \"data\", \"url\", \"title\", \"identifier\", \"label\"],\n path,\n type,\n );\n const title = optionalString(value, \"title\", path, type);\n const label = optionalString(value, \"label\", path, type);\n return {\n type,\n ...nodeBase,\n url: requiredString(value, \"url\", path, type),\n ...(title === undefined ? {} : { title }),\n identifier: requiredString(value, \"identifier\", path, type),\n ...(label === undefined ? {} : { label }),\n };\n }\n case \"image\":\n case \"imageReference\": {\n const reference = type === \"imageReference\";\n assertOnlyKeys(\n value,\n reference\n ? [\"type\", \"position\", \"data\", \"alt\", \"referenceType\", \"identifier\", \"label\"]\n : [\"type\", \"position\", \"data\", \"alt\", \"url\", \"title\"],\n path,\n type,\n );\n const alt = requiredString(value, \"alt\", path, type);\n if (type === \"image\") {\n const title = optionalString(value, \"title\", path, type);\n return {\n type,\n ...nodeBase,\n alt,\n url: requiredString(value, \"url\", path, type),\n ...(title === undefined ? {} : { title }),\n };\n }\n const label = optionalString(value, \"label\", path, type);\n return {\n type,\n ...nodeBase,\n alt,\n referenceType: referenceKind(value.referenceType, `${path}.referenceType`, type),\n identifier: requiredString(value, \"identifier\", path, type),\n ...(label === undefined ? {} : { label }),\n };\n }\n case \"footnoteReference\": {\n assertOnlyKeys(value, [\"type\", \"position\", \"data\", \"identifier\", \"label\"], path, type);\n const label = optionalString(value, \"label\", path, type);\n return {\n type,\n ...nodeBase,\n identifier: requiredString(value, \"identifier\", path, type),\n ...(label === undefined ? {} : { label }),\n };\n }\n case \"code\": {\n assertOnlyKeys(value, [\"type\", \"position\", \"data\", \"lang\", \"meta\", \"value\"], path, type);\n const lang = optionalString(value, \"lang\", path, type);\n const meta = optionalString(value, \"meta\", path, type);\n return {\n type,\n ...nodeBase,\n ...(lang === undefined ? {} : { lang }),\n ...(meta === undefined ? {} : { meta }),\n value: requiredString(value, \"value\", path, type),\n };\n }\n case \"html\":\n case \"text\":\n case \"inlineCode\":\n case \"yaml\": {\n assertOnlyKeys(value, [\"type\", \"position\", \"data\", \"value\"], path, type);\n return { type, ...nodeBase, value: requiredString(value, \"value\", path, type) };\n }\n case \"thematicBreak\":\n case \"break\": {\n assertOnlyKeys(value, [\"type\", \"position\", \"data\"], path, type);\n return { type, ...nodeBase };\n }\n case \"root\":\n fail(path, type, \"nested root nodes are not supported\");\n case \"math\":\n case \"inlineMath\":\n case \"toml\":\n case \"mdxjsEsm\":\n fail(path, type, \"node type is currently unsupported by the adapter\");\n default:\n fail(path, type, \"unknown node type\");\n }\n}\n\nfunction referenceKind(value: unknown, path: string, nodeType: string) {\n if (value !== \"shortcut\" && value !== \"collapsed\" && value !== \"full\") {\n fail(path, nodeType, \"expected shortcut, collapsed, or full\");\n }\n return value;\n}\n\n/**\n * Validate a raw `parseToAst` tree and return a detached canonical mdast tree.\n *\n * This strict adapter is intentionally separate from the forward-compatible\n * raw tier: unsupported or malformed nodes throw instead of being dropped.\n */\nexport function toMdastRoot(ast: MdastRoot | null): EcosystemRoot {\n if (ast === null) fail(\"$\", null, \"expected a root node\");\n const value: unknown = ast;\n const type = observedType(value);\n if (!isRecord(value) || type !== \"root\") fail(\"$\", type, \"expected a root node\");\n assertOnlyKeys(value, [\"type\", \"position\", \"data\", \"children\"], \"$\", type);\n const nodeData = data(value, \"$\", type);\n return {\n type,\n position: position(value, \"$\", type),\n ...(nodeData === undefined ? {} : { data: nodeData }),\n children: children(value.children, \"$.children\", type, adaptTopLevel),\n };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-browser.js","sourceRoot":"","sources":["../src/parse-browser.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,0DAA0D,CAAC;AAChF,OAAO,QAAQ,MAAM,4CAA4C,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,QAAQ,EAAE,
|
|
1
|
+
{"version":3,"file":"parse-browser.js","sourceRoot":"","sources":["../src/parse-browser.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,0DAA0D,CAAC;AAChF,OAAO,QAAQ,MAAM,4CAA4C,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,QAAQ,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;AACpD,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,QAAQ,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;AAEpD,KAAK,UAAU,oBAAoB;IACjC,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,QAAQ,CAAC,CAAC;IACvC,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CACb,6CAA6C,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,UAAU,EAAE,CACtF,CAAC;IACJ,CAAC;IACD,OAAO,QAAQ,CAAC,WAAW,EAAE,CAAC;AAChC,CAAC;AAED,MAAM,GAAG,GAAG,aAAa,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,oBAAoB,EAAE,CAAC,CAAC;AAEtF,MAAM,CAAC,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,mBAAmB,EAAE,8BAA8B,EAAE,GAC7F,GAAG,CAAC;AAEN,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,+BAA+B,EAAE,MAAM,cAAc,CAAC","sourcesContent":["import glueHref from \"./wasm-parse/zfb_md_wasm_parse_glue.zfb-resource.mjs?url\";\nimport wasmHref from \"./wasm-parse/zfb_md_wasm_parse_bg.wasm?url\";\nimport { createWasmApi } from \"./runtime.js\";\n\nconst GLUE_URL = new URL(glueHref, import.meta.url);\nconst WASM_URL = new URL(wasmHref, import.meta.url);\n\nasync function loadBrowserWasmBytes(): Promise<ArrayBuffer> {\n const response = await fetch(WASM_URL);\n if (!response.ok) {\n throw new Error(\n `zfb-md-wasm: failed to fetch wasm binary: ${response.status} ${response.statusText}`,\n );\n }\n return response.arrayBuffer();\n}\n\nconst api = createWasmApi({ glueUrl: GLUE_URL, loadWasmBytes: loadBrowserWasmBytes });\n\nexport const { init, parseToAst, version, __forceTrapForTests, __getTrapRecoveryStateForTests } =\n api;\n\nexport { MdastAdapterError, toMdastRoot } from \"./mdast.js\";\nexport { ZfbMdWasmTrapError, ZfbMdWasmTrapRecoveryLimitError } from \"./runtime.js\";\nexport type {\n ParseToAstResult,\n ParseToAstOptions,\n ParseDialect,\n FrontmatterPolicy,\n ParsePipelineOptions,\n Diagnostic,\n DiagnosticSource,\n AstPoint,\n AstPosition,\n RawMdastData,\n MarkdownRsStop,\n MdastNode,\n MdastRoot,\n UnknownMdastNode,\n Root,\n Paragraph,\n Heading,\n ThematicBreak,\n Blockquote,\n List,\n ListItem,\n Html,\n Code,\n Definition,\n Text,\n DirectiveNodeBase,\n ContainerDirective,\n LeafDirective,\n TextDirective,\n Emphasis,\n Strong,\n InlineCode,\n Break,\n Link,\n Image,\n ReferenceKind,\n LinkReference,\n ImageReference,\n FootnoteDefinition,\n FootnoteReference,\n TableAlign,\n Table,\n TableRow,\n TableCell,\n Delete,\n Yaml,\n MdxFlowExpression,\n MdxTextExpression,\n MdxJsxFlowElement,\n MdxJsxTextElement,\n MdxJsxAttributeContent,\n MdxJsxAttribute,\n MdxJsxAttributeValueExpression,\n MdxJsxExpressionAttribute,\n} from \"./types.js\";\n"]}
|
package/dist/parse.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse.js","sourceRoot":"","sources":["../src/parse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,sDAAsD,EAAE,
|
|
1
|
+
{"version":3,"file":"parse.js","sourceRoot":"","sources":["../src/parse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,sDAAsD,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;AAClG,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,wCAAwC,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;AAEpF,KAAK,UAAU,mBAAmB;IAChC,IAAI,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC;QAC7D,MAAM,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,aAAa,EAAE,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;YAC1D,MAAM,CAAC,kBAAkB,CAAC;YAC1B,MAAM,CAAC,UAAU,CAAC;SACnB,CAAC,CAAC;QACH,MAAM,KAAK,GAAG,MAAM,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC;QACtD,OAAO,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,UAAU,GAAG,KAAK,CAAC,UAAU,CAAgB,CAAC;IAClG,CAAC;IACD,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,QAAQ,CAAC,CAAC;IACvC,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CACb,6CAA6C,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,UAAU,EAAE,CACtF,CAAC;IACJ,CAAC;IACD,OAAO,QAAQ,CAAC,WAAW,EAAE,CAAC;AAChC,CAAC;AAED,MAAM,GAAG,GAAG,aAAa,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,mBAAmB,EAAE,CAAC,CAAC;AAErF,MAAM,CAAC,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,mBAAmB,EAAE,8BAA8B,EAAE,GAC7F,GAAG,CAAC;AAEN,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,+BAA+B,EAAE,MAAM,cAAc,CAAC","sourcesContent":["import { createWasmApi } from \"./runtime.js\";\n\nconst GLUE_URL = new URL(\"./wasm-parse/zfb_md_wasm_parse_glue.zfb-resource.mjs\", import.meta.url);\nconst WASM_URL = new URL(\"./wasm-parse/zfb_md_wasm_parse_bg.wasm\", import.meta.url);\n\nasync function loadDirectWasmBytes(): Promise<ArrayBuffer> {\n if (typeof process !== \"undefined\" && process.versions?.node) {\n const [{ readFile }, { fileURLToPath }] = await Promise.all([\n import(\"node:fs/promises\"),\n import(\"node:url\"),\n ]);\n const bytes = await readFile(fileURLToPath(WASM_URL));\n return bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength) as ArrayBuffer;\n }\n const response = await fetch(WASM_URL);\n if (!response.ok) {\n throw new Error(\n `zfb-md-wasm: failed to fetch wasm binary: ${response.status} ${response.statusText}`,\n );\n }\n return response.arrayBuffer();\n}\n\nconst api = createWasmApi({ glueUrl: GLUE_URL, loadWasmBytes: loadDirectWasmBytes });\n\nexport const { init, parseToAst, version, __forceTrapForTests, __getTrapRecoveryStateForTests } =\n api;\n\nexport { MdastAdapterError, toMdastRoot } from \"./mdast.js\";\nexport { ZfbMdWasmTrapError, ZfbMdWasmTrapRecoveryLimitError } from \"./runtime.js\";\nexport type {\n ParseToAstResult,\n ParseToAstOptions,\n ParseDialect,\n FrontmatterPolicy,\n ParsePipelineOptions,\n Diagnostic,\n DiagnosticSource,\n AstPoint,\n AstPosition,\n RawMdastData,\n MarkdownRsStop,\n MdastNode,\n MdastRoot,\n UnknownMdastNode,\n Root,\n Paragraph,\n Heading,\n ThematicBreak,\n Blockquote,\n List,\n ListItem,\n Html,\n Code,\n Definition,\n Text,\n DirectiveNodeBase,\n ContainerDirective,\n LeafDirective,\n TextDirective,\n Emphasis,\n Strong,\n InlineCode,\n Break,\n Link,\n Image,\n ReferenceKind,\n LinkReference,\n ImageReference,\n FootnoteDefinition,\n FootnoteReference,\n TableAlign,\n Table,\n TableRow,\n TableCell,\n Delete,\n Yaml,\n MdxFlowExpression,\n MdxTextExpression,\n MdxJsxFlowElement,\n MdxJsxTextElement,\n MdxJsxAttributeContent,\n MdxJsxAttribute,\n MdxJsxAttributeValueExpression,\n MdxJsxExpressionAttribute,\n} from \"./types.js\";\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-browser.js","sourceRoot":"","sources":["../src/render-browser.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,4DAA4D,CAAC;AAClF,OAAO,QAAQ,MAAM,8CAA8C,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,QAAQ,EAAE,
|
|
1
|
+
{"version":3,"file":"render-browser.js","sourceRoot":"","sources":["../src/render-browser.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,4DAA4D,CAAC;AAClF,OAAO,QAAQ,MAAM,8CAA8C,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,QAAQ,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;AACpD,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,QAAQ,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;AAEpD,KAAK,UAAU,oBAAoB;IACjC,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,QAAQ,CAAC,CAAC;IACvC,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CACb,6CAA6C,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,UAAU,EAAE,CACtF,CAAC;IACJ,CAAC;IACD,OAAO,QAAQ,CAAC,WAAW,EAAE,CAAC;AAChC,CAAC;AAED,MAAM,GAAG,GAAG,aAAa,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,oBAAoB,EAAE,CAAC,CAAC;AAEtF,MAAM,CAAC,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,mBAAmB,EAAE,8BAA8B,EAAE,GAC7F,GAAG,CAAC;AAEN,OAAO,EAAE,kBAAkB,EAAE,+BAA+B,EAAE,MAAM,cAAc,CAAC","sourcesContent":["import glueHref from \"./wasm-render/zfb_md_wasm_render_glue.zfb-resource.mjs?url\";\nimport wasmHref from \"./wasm-render/zfb_md_wasm_render_bg.wasm?url\";\nimport { createWasmApi } from \"./runtime.js\";\n\nconst GLUE_URL = new URL(glueHref, import.meta.url);\nconst WASM_URL = new URL(wasmHref, import.meta.url);\n\nasync function loadBrowserWasmBytes(): Promise<ArrayBuffer> {\n const response = await fetch(WASM_URL);\n if (!response.ok) {\n throw new Error(\n `zfb-md-wasm: failed to fetch wasm binary: ${response.status} ${response.statusText}`,\n );\n }\n return response.arrayBuffer();\n}\n\nconst api = createWasmApi({ glueUrl: GLUE_URL, loadWasmBytes: loadBrowserWasmBytes });\n\nexport const { init, renderHtml, version, __forceTrapForTests, __getTrapRecoveryStateForTests } =\n api;\n\nexport { ZfbMdWasmTrapError, ZfbMdWasmTrapRecoveryLimitError } from \"./runtime.js\";\nexport type {\n RenderHtmlResult,\n Diagnostic,\n DiagnosticSource,\n ZfbMdWasmOptions,\n ParseDialect,\n PipelineOptions,\n GfmOptions,\n CodeHighlightMode,\n CodeHighlightOptions,\n MarkdownFeaturesConfig,\n HighlightRole,\n} from \"./types.js\";\n"]}
|
package/dist/render.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.js","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,wDAAwD,EAAE,
|
|
1
|
+
{"version":3,"file":"render.js","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,wDAAwD,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;AACpG,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,0CAA0C,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;AAEtF,KAAK,UAAU,mBAAmB;IAChC,IAAI,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC;QAC7D,MAAM,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,aAAa,EAAE,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;YAC1D,MAAM,CAAC,kBAAkB,CAAC;YAC1B,MAAM,CAAC,UAAU,CAAC;SACnB,CAAC,CAAC;QACH,MAAM,KAAK,GAAG,MAAM,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC;QACtD,OAAO,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,UAAU,GAAG,KAAK,CAAC,UAAU,CAAgB,CAAC;IAClG,CAAC;IACD,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,QAAQ,CAAC,CAAC;IACvC,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CACb,6CAA6C,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,UAAU,EAAE,CACtF,CAAC;IACJ,CAAC;IACD,OAAO,QAAQ,CAAC,WAAW,EAAE,CAAC;AAChC,CAAC;AAED,MAAM,GAAG,GAAG,aAAa,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,mBAAmB,EAAE,CAAC,CAAC;AAErF,MAAM,CAAC,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,mBAAmB,EAAE,8BAA8B,EAAE,GAC7F,GAAG,CAAC;AAEN,OAAO,EAAE,kBAAkB,EAAE,+BAA+B,EAAE,MAAM,cAAc,CAAC","sourcesContent":["import { createWasmApi } from \"./runtime.js\";\n\nconst GLUE_URL = new URL(\"./wasm-render/zfb_md_wasm_render_glue.zfb-resource.mjs\", import.meta.url);\nconst WASM_URL = new URL(\"./wasm-render/zfb_md_wasm_render_bg.wasm\", import.meta.url);\n\nasync function loadDirectWasmBytes(): Promise<ArrayBuffer> {\n if (typeof process !== \"undefined\" && process.versions?.node) {\n const [{ readFile }, { fileURLToPath }] = await Promise.all([\n import(\"node:fs/promises\"),\n import(\"node:url\"),\n ]);\n const bytes = await readFile(fileURLToPath(WASM_URL));\n return bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength) as ArrayBuffer;\n }\n const response = await fetch(WASM_URL);\n if (!response.ok) {\n throw new Error(\n `zfb-md-wasm: failed to fetch wasm binary: ${response.status} ${response.statusText}`,\n );\n }\n return response.arrayBuffer();\n}\n\nconst api = createWasmApi({ glueUrl: GLUE_URL, loadWasmBytes: loadDirectWasmBytes });\n\nexport const { init, renderHtml, version, __forceTrapForTests, __getTrapRecoveryStateForTests } =\n api;\n\nexport { ZfbMdWasmTrapError, ZfbMdWasmTrapRecoveryLimitError } from \"./runtime.js\";\nexport type {\n RenderHtmlResult,\n Diagnostic,\n DiagnosticSource,\n ZfbMdWasmOptions,\n ParseDialect,\n PipelineOptions,\n GfmOptions,\n CodeHighlightMode,\n CodeHighlightOptions,\n MarkdownFeaturesConfig,\n HighlightRole,\n} from \"./types.js\";\n"]}
|
package/dist/runtime-core.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-core.js","sourceRoot":"","sources":["../src/runtime-core.ts"],"names":[],"mappings":"AA8BA,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAC3C,YAAY,KAAc;QACxB,KAAK,CACH,uFAAuF;YACrF,yFAAyF;YACzF,mCAAmC,CACtC,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;QACjC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;CACF;AAED,MAAM,OAAO,+BAAgC,SAAQ,KAAK;IACxD,YAAY,aAAqB,EAAE,KAAc;QAC/C,KAAK,CACH,uDAAuD,aAAa,GAAG;YACrE,gFAAgF;YAChF,mFAAmF;YACnF,uEAAuE,CAC1E,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,iCAAiC,CAAC;QAC9C,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;CACF;AAOD,sFAAsF;AACtF,MAAM,UAAU,yBAAyB,CAAC,QAA8B;IACtE,MAAM,mBAAmB,GAAG,EAAE,CAAC;IAE/B,IAAI,iBAAiB,GAAG,CAAC,CAAC;IAC1B,IAAI,qBAAqB,GAAG,CAAC,CAAC;IAC9B,IAAI,mBAAmB,GAAG,CAAC,CAAC;IAC5B,uEAAuE;IACvE,IAAI,kBAAkB,GAAG,CAAC,CA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eResult,\n ParseToAstOptions,\n ParseToAstResult,\n RenderHtmlResult,\n ZfbMdWasmOptions,\n} from \"./types.js\";\n\nexport interface WasmGlueModule {\n // Keep this deliberately structural instead of importing the generated\n // glue's declaration file. The browser entry imports that file as a *URL\n // resource*, while the direct entry imports it dynamically. Both paths\n // nevertheless use the same wasm-bindgen surface and recovery\n // implementation below.\n //\n // Capability functions are structural and optional because each singleton\n // artifact's wasm-bindgen glue contains only its selected Rust export.\n // Public entries expose only the matching calls from `createWasmApi`.\n initSync(input?: { module: WebAssembly.Module }): unknown;\n compile?(source: string, optionsJson: string): string;\n renderHtml?(source: string, optionsJson: string): string;\n // Raw-mdast export (zfb#1857, epic zfb#1854).\n parseToAst?(source: string, optionsJson: string): string;\n highlightCode?(code: string, optionsJson: string): string;\n version(): string;\n __forceTrapForTests(): void;\n}\n\nexport class ZfbMdWasmTrapError extends Error {\n constructor(cause: unknown) {\n super(\n \"zfb-md-wasm: the wasm instance trapped (a Rust panic or internal fault) and has been \" +\n \"automatically re-instantiated. This is always a bug in zfb-md-wasm -- please report it \" +\n \"with the input that triggered it.\",\n );\n this.name = \"ZfbMdWasmTrapError\";\n this.cause = cause;\n }\n}\n\nexport class ZfbMdWasmTrapRecoveryLimitError extends Error {\n constructor(maxRecoveries: number, cause: unknown) {\n super(\n `zfb-md-wasm: wasm trap recovery limit reached after ${maxRecoveries} ` +\n `successful re-instantiations. Further automatic recovery is disabled to avoid ` +\n `unbounded recovery resource growth. Reload the JS realm before using zfb-md-wasm ` +\n `again, and please report the input that triggered the repeated traps.`,\n );\n this.name = \"ZfbMdWasmTrapRecoveryLimitError\";\n this.cause = cause;\n }\n}\n\nexport interface WasmInstanceStrategy {\n getModule(onLoad: () => void): Promise<WebAssembly.Module>;\n createGlue(generation: number, attempt: number): WasmGlueModule | Promise<WasmGlueModule>;\n}\n\n/** Shared instance lifecycle and bounded trap recovery for URL and static entries. */\nexport function createWasmApiFromStrategy(strategy: WasmInstanceStrategy) {\n const MAX_TRAP_RECOVERIES = 16;\n\n let currentGeneration = 0;\n let trapRecoveriesStarted = 0;\n let freshInstanceStarts = 0;\n // For the static strategy, glueImportAttempts counts createGlue calls.\n let glueImportAttempts = 0;\n let compiledModuleLoads = 0;\n let terminalTrapRecoveryError: ZfbMdWasmTrapRecoveryLimitError | undefined;\n\n interface Instance {\n generation: number;\n glue: WasmGlueModule;\n }\n\n /**\n * Every fresh instance attempt creates new wasm-bindgen glue. The attempt\n * counter is independent of the trap generation: transient glue/initSync\n * failures must not consume the bounded trap-recovery budget.\n */\n async function freshInstance(generation: number): Promise<Instance> {\n freshInstanceStarts += 1;\n glueImportAttempts += 1;\n const [module, glue] = await Promise.all([\n strategy.getModule(() => {\n compiledModuleLoads += 1;\n }),\n // A synchronous factory throw is a retryable instance rejection.\n Promise.resolve().then(() => strategy.createGlue(generation, glueImportAttempts)),\n ]);\n glue.initSync({ module });\n return { generation, glue };\n }\n\n let instancePromise: Promise<Instance> | undefined;\n\n function startInstance(generation: number): Promise<Instance> {\n const attempt = freshInstance(generation);\n instancePromise = attempt;\n void attempt.catch(() => {\n // Trap recovery can replace the installed instance promise. Never let a\n // stale initialization rejection clear that newer attempt.\n if (instancePromise === attempt) {\n instancePromise = undefined;\n }\n });\n return attempt;\n }\n\n function getInstance(): Promise<Instance> {\n if (terminalTrapRecoveryError) {\n return Promise.reject(terminalTrapRecoveryError);\n }\n if (!instancePromise) {\n return startInstance(currentGeneration);\n }\n return instancePromise;\n }\n\n function isTrap(err: unknown): boolean {\n return typeof WebAssembly !== \"undefined\" && err instanceof WebAssembly.RuntimeError;\n }\n\n async function recoverAfterTrap(observedGeneration: number, cause: unknown): Promise<void> {\n if (terminalTrapRecoveryError) {\n throw terminalTrapRecoveryError;\n }\n\n // CAS-style single-flight: reporters for an already-replaced generation\n // await its replacement instead of creating another glue instance.\n if (observedGeneration !== currentGeneration) {\n await getInstance();\n return;\n }\n\n if (trapRecoveriesStarted >= MAX_TRAP_RECOVERIES) {\n terminalTrapRecoveryError = new ZfbMdWasmTrapRecoveryLimitError(MAX_TRAP_RECOVERIES, cause);\n instancePromise = undefined;\n throw terminalTrapRecoveryError;\n }\n\n trapRecoveriesStarted += 1;\n currentGeneration += 1;\n await startInstance(currentGeneration);\n }\n\n async function callWasm<T>(fn: (instance: Instance) => T): Promise<T> {\n const instance = await getInstance();\n try {\n return fn(instance);\n } catch (err) {\n if (!isTrap(err)) {\n throw err;\n }\n await recoverAfterTrap(instance.generation, err);\n throw new ZfbMdWasmTrapError(err);\n }\n }\n\n async function init(): Promise<void> {\n await getInstance();\n }\n\n // Public entry surfaces make missing calls unreachable. This guard keeps\n // structural glue mismatches artifact-neutral and actionable.\n function requireCapability<T>(fn: T | undefined, name: string): T {\n if (!fn) {\n throw new Error(\n `zfb-md-wasm: ${name}() is not available in this wasm artifact. ` +\n `Import an entry whose artifact provides that capability.`,\n );\n }\n return fn;\n }\n\n async function compile(source: string, options: ZfbMdWasmOptions = {}): Promise<CompileResult> {\n const optionsJson = JSON.stringify(options);\n const json = await callWasm(({ glue }) =>\n requireCapability(glue.compile, \"compile\").call(glue, source, optionsJson),\n );\n return JSON.parse(json) as CompileResult;\n }\n\n async function renderHtml(\n source: string,\n options: ZfbMdWasmOptions = {},\n ): Promise<RenderHtmlResult> {\n const optionsJson = JSON.stringify(options);\n const json = await callWasm(({ glue }) =>\n requireCapability(glue.renderHtml, \"renderHtml\").call(glue, source, optionsJson),\n );\n return JSON.parse(json) as RenderHtmlResult;\n }\n\n /**\n * Parse markdown/MDX into a raw mdast tree (zfb#1857, epic zfb#1854).\n * The `parseToAst + JSON.parse` round trip here IS the product cost the\n * epic's benchmark measures against remark-parse. See `types.ts`'s\n * `ParseToAstResult`/`MdastNode` docs for the result shape and the\n * UTF-16 position contract.\n */\n async function parseToAst(\n source: string,\n options: ParseToAstOptions = {},\n ): Promise<ParseToAstResult> {\n const optionsJson = JSON.stringify(options);\n const json = await callWasm(({ glue }) =>\n requireCapability(glue.parseToAst, \"parseToAst\").call(glue, source, optionsJson),\n );\n return JSON.parse(json) as ParseToAstResult;\n }\n\n async function highlightCode(\n code: string,\n options: HighlightCodeOptions,\n ): Promise<HighlightCodeResult> {\n const optionsJson = JSON.stringify(options);\n const json = await callWasm(({ glue }) =>\n requireCapability(glue.highlightCode, \"highlightCode\").call(glue, code, optionsJson),\n );\n return JSON.parse(json) as HighlightCodeResult;\n }\n\n async function version(): Promise<string> {\n return callWasm(({ glue }) => glue.version());\n }\n\n /** @internal Test-only hook that forces the current instance to trap. */\n async function __forceTrapForTests(): Promise<void> {\n await callWasm(({ glue }) => glue.__forceTrapForTests());\n }\n\n /** @internal Test-only observability for the bounded recovery contract. */\n function __getTrapRecoveryStateForTests(): {\n compiledModuleLoads: number;\n currentGeneration: number;\n freshInstanceStarts: number;\n glueImportAttempts: number;\n maxTrapRecoveries: number;\n trapRecoveriesStarted: number;\n terminal: boolean;\n } {\n return {\n compiledModuleLoads,\n currentGeneration,\n freshInstanceStarts,\n glueImportAttempts,\n maxTrapRecoveries: MAX_TRAP_RECOVERIES,\n trapRecoveriesStarted,\n terminal: !!terminalTrapRecoveryError,\n };\n }\n\n return {\n init,\n compile,\n renderHtml,\n parseToAst,\n highlightCode,\n version,\n __forceTrapForTests,\n __getTrapRecoveryStateForTests,\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"runtime-core.js","sourceRoot":"","sources":["../src/runtime-core.ts"],"names":[],"mappings":"AA8BA,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAC3C,YAAY,KAAc;QACxB,KAAK,CACH,uFAAuF;YACrF,yFAAyF;YACzF,mCAAmC,CACtC,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;QACjC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;CACF;AAED,MAAM,OAAO,+BAAgC,SAAQ,KAAK;IACxD,YAAY,aAAqB,EAAE,KAAc;QAC/C,KAAK,CACH,uDAAuD,aAAa,GAAG;YACrE,gFAAgF;Y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AmB,EAAE,CAAC,CAAC;IAC3D,CAAC;IAED,2EAA2E;IAC3E,SAAS,8BAA8B;QASrC,OAAO;YACL,mBAAmB;YACnB,iBAAiB;YACjB,mBAAmB;YACnB,kBAAkB;YAClB,iBAAiB,EAAE,mBAAmB;YACtC,qBAAqB;YACrB,QAAQ,EAAE,CAAC,CAAC,yBAAyB;SACtC,CAAC;IACJ,CAAC;IAED,OAAO;QACL,IAAI;QACJ,OAAO;QACP,UAAU;QACV,UAAU;QACV,aAAa;QACb,OAAO;QACP,mBAAmB;QACnB,8BAA8B;KAC/B,CAAC;AACJ,CAAC","sourcesContent":["import type {\n CompileResult,\n HighlightCodeOptions,\n HighlightCodeResult,\n ParseToAstOptions,\n ParseToAstResult,\n RenderHtmlResult,\n ZfbMdWasmOptions,\n} from \"./types.js\";\n\nexport interface WasmGlueModule {\n // Keep this deliberately structural instead of importing the generated\n // glue's declaration file. The browser entry imports that file as a *URL\n // resource*, while the direct entry imports it dynamically. Both paths\n // nevertheless use the same wasm-bindgen surface and recovery\n // implementation below.\n //\n // Capability functions are structural and optional because each singleton\n // artifact's wasm-bindgen glue contains only its selected Rust export.\n // Public entries expose only the matching calls from `createWasmApi`.\n initSync(input?: { module: WebAssembly.Module }): unknown;\n compile?(source: string, optionsJson: string): string;\n renderHtml?(source: string, optionsJson: string): string;\n // Raw-mdast export (zfb#1857, epic zfb#1854).\n parseToAst?(source: string, optionsJson: string): string;\n highlightCode?(code: string, optionsJson: string): string;\n version(): string;\n __forceTrapForTests(): void;\n}\n\nexport class ZfbMdWasmTrapError extends Error {\n constructor(cause: unknown) {\n super(\n \"zfb-md-wasm: the wasm instance trapped (a Rust panic or internal fault) and has been \" +\n \"automatically re-instantiated. This is always a bug in zfb-md-wasm -- please report it \" +\n \"with the input that triggered it.\",\n );\n this.name = \"ZfbMdWasmTrapError\";\n this.cause = cause;\n }\n}\n\nexport class ZfbMdWasmTrapRecoveryLimitError extends Error {\n constructor(maxRecoveries: number, cause: unknown) {\n super(\n `zfb-md-wasm: wasm trap recovery limit reached after ${maxRecoveries} ` +\n `successful re-instantiations. Further automatic recovery is disabled to avoid ` +\n `unbounded recovery resource growth. Reload the JS realm before using zfb-md-wasm ` +\n `again, and please report the input that triggered the repeated traps.`,\n );\n this.name = \"ZfbMdWasmTrapRecoveryLimitError\";\n this.cause = cause;\n }\n}\n\nexport interface WasmInstanceStrategy {\n getModule(onLoad: () => void): Promise<WebAssembly.Module>;\n createGlue(generation: number, attempt: number): WasmGlueModule | Promise<WasmGlueModule>;\n}\n\n/** Shared instance lifecycle and bounded trap recovery for URL and static entries. */\nexport function createWasmApiFromStrategy(strategy: WasmInstanceStrategy) {\n const MAX_TRAP_RECOVERIES = 16;\n\n let currentGeneration = 0;\n let trapRecoveriesStarted = 0;\n let freshInstanceStarts = 0;\n // For the static strategy, glueImportAttempts counts createGlue calls.\n let glueImportAttempts = 0;\n let compiledModuleLoads = 0;\n let terminalTrapRecoveryError: ZfbMdWasmTrapRecoveryLimitError | undefined;\n\n interface Instance {\n generation: number;\n glue: WasmGlueModule;\n }\n\n /**\n * Every fresh instance attempt creates new wasm-bindgen glue. The attempt\n * counter is independent of the trap generation: transient glue/initSync\n * failures must not consume the bounded trap-recovery budget.\n */\n async function freshInstance(generation: number): Promise<Instance> {\n freshInstanceStarts += 1;\n glueImportAttempts += 1;\n const [module, glue] = await Promise.all([\n strategy.getModule(() => {\n compiledModuleLoads += 1;\n }),\n // A synchronous factory throw is a retryable instance rejection.\n Promise.resolve().then(() => strategy.createGlue(generation, glueImportAttempts)),\n ]);\n glue.initSync({ module });\n return { generation, glue };\n }\n\n let instancePromise: Promise<Instance> | undefined;\n\n function startInstance(generation: number): Promise<Instance> {\n const attempt = freshInstance(generation);\n instancePromise = attempt;\n void attempt.catch(() => {\n // Trap recovery can replace the installed instance promise. Never let a\n // stale initialization rejection clear that newer attempt.\n if (instancePromise === attempt) {\n instancePromise = undefined;\n }\n });\n return attempt;\n }\n\n function getInstance(): Promise<Instance> {\n if (terminalTrapRecoveryError) {\n return Promise.reject(terminalTrapRecoveryError);\n }\n if (!instancePromise) {\n return startInstance(currentGeneration);\n }\n return instancePromise;\n }\n\n function isTrap(err: unknown): boolean {\n return typeof WebAssembly !== \"undefined\" && err instanceof WebAssembly.RuntimeError;\n }\n\n async function recoverAfterTrap(observedGeneration: number, cause: unknown): Promise<void> {\n if (terminalTrapRecoveryError) {\n throw terminalTrapRecoveryError;\n }\n\n // CAS-style single-flight: reporters for an already-replaced generation\n // await its replacement instead of creating another glue instance.\n if (observedGeneration !== currentGeneration) {\n await getInstance();\n return;\n }\n\n if (trapRecoveriesStarted >= MAX_TRAP_RECOVERIES) {\n terminalTrapRecoveryError = new ZfbMdWasmTrapRecoveryLimitError(MAX_TRAP_RECOVERIES, cause);\n instancePromise = undefined;\n throw terminalTrapRecoveryError;\n }\n\n trapRecoveriesStarted += 1;\n currentGeneration += 1;\n await startInstance(currentGeneration);\n }\n\n async function callWasm<T>(fn: (instance: Instance) => T): Promise<T> {\n const instance = await getInstance();\n try {\n return fn(instance);\n } catch (err) {\n if (!isTrap(err)) {\n throw err;\n }\n await recoverAfterTrap(instance.generation, err);\n throw new ZfbMdWasmTrapError(err);\n }\n }\n\n async function init(): Promise<void> {\n await getInstance();\n }\n\n // Public entry surfaces make missing calls unreachable. This guard keeps\n // structural glue mismatches artifact-neutral and actionable.\n function requireCapability<T>(fn: T | undefined, name: string): T {\n if (!fn) {\n throw new Error(\n `zfb-md-wasm: ${name}() is not available in this wasm artifact. ` +\n `Import an entry whose artifact provides that capability.`,\n );\n }\n return fn;\n }\n\n async function compile(source: string, options: ZfbMdWasmOptions = {}): Promise<CompileResult> {\n const optionsJson = JSON.stringify(options);\n const json = await callWasm(({ glue }) =>\n requireCapability(glue.compile, \"compile\").call(glue, source, optionsJson),\n );\n return JSON.parse(json) as CompileResult;\n }\n\n async function renderHtml(\n source: string,\n options: ZfbMdWasmOptions = {},\n ): Promise<RenderHtmlResult> {\n const optionsJson = JSON.stringify(options);\n const json = await callWasm(({ glue }) =>\n requireCapability(glue.renderHtml, \"renderHtml\").call(glue, source, optionsJson),\n );\n return JSON.parse(json) as RenderHtmlResult;\n }\n\n /**\n * Parse markdown/MDX into a raw mdast tree (zfb#1857, epic zfb#1854).\n * The `parseToAst + JSON.parse` round trip here IS the product cost the\n * epic's benchmark measures against remark-parse. See `types.ts`'s\n * `ParseToAstResult`/`MdastNode` docs for the result shape and the\n * UTF-16 position contract.\n */\n async function parseToAst(\n source: string,\n options: ParseToAstOptions = {},\n ): Promise<ParseToAstResult> {\n const optionsJson = JSON.stringify(options);\n const json = await callWasm(({ glue }) =>\n requireCapability(glue.parseToAst, \"parseToAst\").call(glue, source, optionsJson),\n );\n return JSON.parse(json) as ParseToAstResult;\n }\n\n async function highlightCode(\n code: string,\n options: HighlightCodeOptions,\n ): Promise<HighlightCodeResult> {\n const optionsJson = JSON.stringify(options);\n const json = await callWasm(({ glue }) =>\n requireCapability(glue.highlightCode, \"highlightCode\").call(glue, code, optionsJson),\n );\n return JSON.parse(json) as HighlightCodeResult;\n }\n\n async function version(): Promise<string> {\n return callWasm(({ glue }) => glue.version());\n }\n\n /** @internal Test-only hook that forces the current instance to trap. */\n async function __forceTrapForTests(): Promise<void> {\n await callWasm(({ glue }) => glue.__forceTrapForTests());\n }\n\n /** @internal Test-only observability for the bounded recovery contract. */\n function __getTrapRecoveryStateForTests(): {\n compiledModuleLoads: number;\n currentGeneration: number;\n freshInstanceStarts: number;\n glueImportAttempts: number;\n maxTrapRecoveries: number;\n trapRecoveriesStarted: number;\n terminal: boolean;\n } {\n return {\n compiledModuleLoads,\n currentGeneration,\n freshInstanceStarts,\n glueImportAttempts,\n maxTrapRecoveries: MAX_TRAP_RECOVERIES,\n trapRecoveriesStarted,\n terminal: !!terminalTrapRecoveryError,\n };\n }\n\n return {\n init,\n compile,\n renderHtml,\n parseToAst,\n highlightCode,\n version,\n __forceTrapForTests,\n __getTrapRecoveryStateForTests,\n };\n}\n"]}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@takazudo/zfb-md-wasm",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "zfb's md/mdx -> JS/HTML conversion pipeline compiled to WebAssembly, for browser-side dynamic conversion (CMS live preview with parity to zfb's production output).",
|
|
@@ -78,16 +78,18 @@
|
|
|
78
78
|
"remark-gfm": "^4.0.1",
|
|
79
79
|
"remark-mdx": "^3.1.1",
|
|
80
80
|
"remark-parse": "^11.0.0",
|
|
81
|
-
"typescript": "
|
|
81
|
+
"typescript": "7.0.2",
|
|
82
|
+
"typescript-5.9": "npm:typescript@5.9.3",
|
|
83
|
+
"typescript-6.0": "npm:typescript@6.0.3",
|
|
82
84
|
"unified": "^11.0.5",
|
|
83
85
|
"unist-util-visit": "^5.0.0",
|
|
84
|
-
"
|
|
86
|
+
"vite-plus": "1.0.0"
|
|
85
87
|
},
|
|
86
88
|
"scripts": {
|
|
87
89
|
"build": "node scripts/build.mjs",
|
|
88
90
|
"pretest": "node scripts/assert-consumer-artifacts.mjs",
|
|
89
|
-
"test": "pnpm typecheck:consumer &&
|
|
90
|
-
"test:watch": "
|
|
91
|
+
"test": "pnpm typecheck:consumer && vp test run",
|
|
92
|
+
"test:watch": "vp test",
|
|
91
93
|
"typecheck": "tsc --noEmit",
|
|
92
94
|
"typecheck:consumer": "tsc --project test/tsconfig.consumer.json"
|
|
93
95
|
}
|