@takazudo/zfb-md-wasm 2.22.0 → 3.0.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 +29 -34
- package/dist/browser.d.ts +1 -1
- package/dist/browser.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js.map +1 -1
- package/dist/render-browser.d.ts +1 -1
- package/dist/render-browser.js.map +1 -1
- package/dist/render.d.ts +1 -1
- package/dist/render.js.map +1 -1
- package/dist/types.d.ts +0 -4
- package/dist/types.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 +1 -1
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 (
|
|
34
|
+
| Entry | gzip-9 wasm (3.0.0) | Exact runtime values | Exact exported types |
|
|
35
35
|
| ------------- | -------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
36
|
-
| `.` | 1,516,
|
|
37
|
-
| `./highlight` | 817,
|
|
38
|
-
| `./render` | 1,091,
|
|
39
|
-
| `./parse` | 283,
|
|
36
|
+
| `.` | 1,516,161 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,948 B | `init`, `highlightCode`, `version`, `__forceTrapForTests`, `__getTrapRecoveryStateForTests`, `ZfbMdWasmTrapError`, `ZfbMdWasmTrapRecoveryLimitError` | `HighlightRole`, `HighlightCodeOptions`, `HighlightCodeResult`, `HighlightDiagnostic`, `HighlightDiagnosticSource` |
|
|
38
|
+
| `./render` | 1,091,667 B | `init`, `renderHtml`, `version`, `ZfbMdWasmTrapError`, `ZfbMdWasmTrapRecoveryLimitError`, `__forceTrapForTests`, `__getTrapRecoveryStateForTests` | `RenderHtmlResult`, `Diagnostic`, `DiagnosticSource`, `ZfbMdWasmOptions`, `ParseDialect`, `PipelineOptions`, `GfmOptions`, `CodeHighlightMode`, `CodeHighlightOptions`, `MarkdownFeaturesConfig`, `HighlightRole` |
|
|
39
|
+
| `./parse` | 283,986 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
|
|
|
@@ -113,7 +113,7 @@ import { compile } from "@takazudo/zfb-md-wasm";
|
|
|
113
113
|
|
|
114
114
|
const { code, frontmatter, diagnostics } = await compile(
|
|
115
115
|
"---\ntitle: Hello\n---\n\n# Welcome\n\n<Callout>Sum is {1 + 2}</Callout>\n",
|
|
116
|
-
{ filename: "post.mdx"
|
|
116
|
+
{ filename: "post.mdx" },
|
|
117
117
|
);
|
|
118
118
|
// code -> ES-module JS source (string) or null on failure
|
|
119
119
|
// frontmatter -> { title: "Hello" }
|
|
@@ -144,7 +144,8 @@ const { html, frontmatter, diagnostics } = await renderHtml("Budget <8 ms\n", {
|
|
|
144
144
|
`dialect: "markdown" | "mdx"` overrides either valid extension. Omitting the
|
|
145
145
|
filename uses `<anonymous>.md`, hence CommonMark. `compile` remains MDX-only
|
|
146
146
|
and accepts/ignores `dialect`, while `renderHtml` accepts/ignores
|
|
147
|
-
`
|
|
147
|
+
`development`, so one options object can serve both tiers. The removed
|
|
148
|
+
`jsxRuntime` key is rejected by both calls.
|
|
148
149
|
|
|
149
150
|
### `version()` / `init()`
|
|
150
151
|
|
|
@@ -520,7 +521,6 @@ creates independent wasm state; no entry evicts or shares another's instance.
|
|
|
520
521
|
interface ZfbMdWasmOptions {
|
|
521
522
|
filename?: string; // must end .md/.mdx; drives frontmatter dispatch + diagnostics
|
|
522
523
|
dialect?: "markdown" | "mdx"; // renderHtml only; inferred from filename when absent
|
|
523
|
-
jsxRuntime?: "preact" | "react"; // compile only; default "preact"
|
|
524
524
|
development?: boolean; // compile only; default false
|
|
525
525
|
pipeline?: {
|
|
526
526
|
// A syntect theme name. Absent, or explicit `null`, keeps the built-in
|
|
@@ -619,33 +619,28 @@ URL.revokeObjectURL(url);
|
|
|
619
619
|
Pass your PascalCase components (the `<Callout>` in the source above) through
|
|
620
620
|
the module's `components` prop.
|
|
621
621
|
|
|
622
|
-
###
|
|
623
|
-
|
|
624
|
-
The compiled module imports its JSX runtime by bare specifier
|
|
625
|
-
(`preact/jsx-runtime` or `react/jsx-runtime`), so the page must resolve those —
|
|
626
|
-
via an [import map](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script/type/importmap)
|
|
627
|
-
or your bundler.
|
|
622
|
+
### Resolving the owned JSX runtime
|
|
628
623
|
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
624
|
+
Compiled modules import JSX factories and `Fragment` from
|
|
625
|
+
`@takazudo/zfb/zudo-react/jsx-runtime`. Development output uses
|
|
626
|
+
`@takazudo/zfb/zudo-react/jsx-dev-runtime` for factories while `Fragment`
|
|
627
|
+
still comes from the owned `jsx-runtime` subpath. A browser host must resolve
|
|
628
|
+
these package subpaths through its bundler or an import map. For example, after
|
|
629
|
+
serving the installed package's runtime modules at local asset URLs:
|
|
635
630
|
|
|
636
631
|
```html
|
|
637
632
|
<script type="importmap">
|
|
638
633
|
{
|
|
639
634
|
"imports": {
|
|
640
|
-
"
|
|
641
|
-
"react/jsx-runtime": "
|
|
635
|
+
"@takazudo/zfb/zudo-react/jsx-runtime": "/assets/zudo-react/jsx-runtime.js",
|
|
636
|
+
"@takazudo/zfb/zudo-react/jsx-dev-runtime": "/assets/zudo-react/jsx-dev-runtime.js"
|
|
642
637
|
}
|
|
643
638
|
}
|
|
644
639
|
</script>
|
|
645
640
|
```
|
|
646
641
|
|
|
647
|
-
|
|
648
|
-
|
|
642
|
+
The paths above are host-owned assets, not CDN URLs. No React/Preact alias is
|
|
643
|
+
needed for the emitted module.
|
|
649
644
|
|
|
650
645
|
## Node usage
|
|
651
646
|
|
|
@@ -710,8 +705,8 @@ suite gates exact-match). Deliberate limitations of the browser build:
|
|
|
710
705
|
- **Choose a focused artifact for non-compile calls.** The root remains the
|
|
711
706
|
compatibility entry and carries the complete compiler graph. `./highlight`
|
|
712
707
|
keeps its public API and resources while the post-#2449/#2450 graph is
|
|
713
|
-
proven SWC-free — and its payload shows it: 817,
|
|
714
|
-
1,516,
|
|
708
|
+
proven SWC-free — and its payload shows it: 817,948 B gzip-9 versus
|
|
709
|
+
1,516,161 B for root. `./render` and `./parse` are also SWC-free and omit
|
|
715
710
|
`zfb-render`; parse intentionally retains `zfb-content`/`syntect-fancy`, so
|
|
716
711
|
it is not syntect-free. Use `./render` or `./parse` when a consumer does
|
|
717
712
|
not need `compile`; root and highlight callers otherwise require no
|
|
@@ -748,23 +743,23 @@ three-step repair sequence:
|
|
|
748
743
|
they are compressor output (CI prints a warning inside the band), while
|
|
749
744
|
final wasm and glue remain byte-exact.
|
|
750
745
|
|
|
751
|
-
These are the shipped **
|
|
746
|
+
These are the shipped **3.0.0** artifact rows — optimized final wasm after
|
|
752
747
|
wasm-bindgen and wasm-opt, Node `gzipSync(..., { level: 9 })`, and glue
|
|
753
748
|
bytes/gzip:
|
|
754
749
|
|
|
755
750
|
| Entry/graph | final wasm | gzip-9 | glue | glue gzip-9 |
|
|
756
751
|
| ----------- | ----------: | ----------: | -------: | ----------: |
|
|
757
|
-
| root (full) | 3,
|
|
758
|
-
| highlight | 1,539,334 B | 817,
|
|
759
|
-
| render | 2,
|
|
760
|
-
| parse | 700,
|
|
752
|
+
| root (full) | 3,398,096 B | 1,516,161 B | 14,998 B | 4,199 B |
|
|
753
|
+
| highlight | 1,539,334 B | 817,948 B | 8,758 B | 2,637 B |
|
|
754
|
+
| render | 2,195,015 B | 1,091,667 B | 8,772 B | 2,661 B |
|
|
755
|
+
| parse | 700,367 B | 283,986 B | 11,159 B | 3,797 B |
|
|
761
756
|
|
|
762
757
|
The #2447 decision snapshot measured the split package at 3,638,607 B versus
|
|
763
758
|
2,314,818 B for the root-plus-highlight package. Locked gzip-9 ceilings are
|
|
764
759
|
root 1,600,000 B, highlight 880,000 B, render 1,100,000 B, and parse
|
|
765
760
|
325,000 B; the complete packed tarball ceiling is 3,900,000 B. All four ship
|
|
766
|
-
inside their ceilings, with 83,
|
|
767
|
-
(render), and 41,
|
|
761
|
+
inside their ceilings, with 83,839 B (root), 62,052 B (highlight), 8,333 B
|
|
762
|
+
(render), and 41,014 B (parse) of headroom. These are 3.0.0 measurements, not
|
|
768
763
|
permanent promises — re-measure against the version you actually install.
|
|
769
764
|
The clean four-step production ceiling is 210 seconds; the selected #2447
|
|
770
765
|
median was 155.015 s [153.496, 165.977].
|
|
@@ -785,7 +780,7 @@ raw and 8,765 B smaller gzip-9 (758,244 B) — wasm-opt was already
|
|
|
785
780
|
dead-stripping the unreachable `swc_core`, and #2450's exact-parity and
|
|
786
781
|
no-`swc_core` assertions turned that emergent property into a guaranteed one.
|
|
787
782
|
The delta that matters to a highlight-only consumer is root versus
|
|
788
|
-
highlight: the highlight artifact is 1,
|
|
783
|
+
highlight: the highlight artifact is 1,858,762 B smaller raw and 698,213 B
|
|
789
784
|
smaller gzip-9, landing at about 45% of root's raw bytes and 54% of its
|
|
790
785
|
gzipped bytes.
|
|
791
786
|
|
package/dist/browser.d.ts
CHANGED
|
@@ -9,4 +9,4 @@ export declare const init: () => Promise<void>, compile: (source: string, option
|
|
|
9
9
|
};
|
|
10
10
|
export { ZfbMdWasmTrapError, ZfbMdWasmTrapRecoveryLimitError } from "./runtime.js";
|
|
11
11
|
export { MdastAdapterError, toMdastRoot } from "./mdast.js";
|
|
12
|
-
export type { CompileResult, RenderHtmlResult, ParseToAstResult, ParseToAstOptions, ParseDialect, FrontmatterPolicy, ParsePipelineOptions, Diagnostic, DiagnosticSource, ZfbMdWasmOptions, PipelineOptions, GfmOptions, CodeHighlightMode, CodeHighlightOptions, MarkdownFeaturesConfig,
|
|
12
|
+
export type { CompileResult, RenderHtmlResult, ParseToAstResult, ParseToAstOptions, ParseDialect, FrontmatterPolicy, ParsePipelineOptions, Diagnostic, DiagnosticSource, ZfbMdWasmOptions, PipelineOptions, GfmOptions, CodeHighlightMode, CodeHighlightOptions, MarkdownFeaturesConfig, HighlightRole, HighlightCodeOptions, HighlightCodeResult, HighlightDiagnostic, HighlightDiagnosticSource, 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, } from "./types.js";
|
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;AAC3E,gFAAgF;AAChF,6EAA6E;AAC7E,uCAAuC;AACvC,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACpD,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,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,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 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
|
|
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;AAC3E,gFAAgF;AAChF,6EAA6E;AAC7E,uCAAuC;AACvC,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACpD,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,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,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 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"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -9,4 +9,4 @@ export declare const init: () => Promise<void>, compile: (source: string, option
|
|
|
9
9
|
};
|
|
10
10
|
export { ZfbMdWasmTrapError, ZfbMdWasmTrapRecoveryLimitError } from "./runtime.js";
|
|
11
11
|
export { MdastAdapterError, toMdastRoot } from "./mdast.js";
|
|
12
|
-
export type { CompileResult, RenderHtmlResult, ParseToAstResult, ParseToAstOptions, ParseDialect, FrontmatterPolicy, ParsePipelineOptions, Diagnostic, DiagnosticSource, ZfbMdWasmOptions, PipelineOptions, GfmOptions, CodeHighlightMode, CodeHighlightOptions, MarkdownFeaturesConfig,
|
|
12
|
+
export type { CompileResult, RenderHtmlResult, ParseToAstResult, ParseToAstOptions, ParseDialect, FrontmatterPolicy, ParsePipelineOptions, Diagnostic, DiagnosticSource, ZfbMdWasmOptions, PipelineOptions, GfmOptions, CodeHighlightMode, CodeHighlightOptions, MarkdownFeaturesConfig, HighlightRole, HighlightCodeOptions, HighlightCodeResult, HighlightDiagnostic, HighlightDiagnosticSource, 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, } from "./types.js";
|
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;AAE7C,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,0CAA0C,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACtF,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,4BAA4B,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAExE,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,2EAA2E;AAC3E,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,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
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,0CAA0C,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACtF,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,4BAA4B,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAExE,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,2EAA2E;AAC3E,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,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/render-browser.d.ts
CHANGED
|
@@ -8,4 +8,4 @@ export declare const init: () => Promise<void>, renderHtml: (source: string, opt
|
|
|
8
8
|
terminal: boolean;
|
|
9
9
|
};
|
|
10
10
|
export { ZfbMdWasmTrapError, ZfbMdWasmTrapRecoveryLimitError } from "./runtime.js";
|
|
11
|
-
export type { RenderHtmlResult, Diagnostic, DiagnosticSource, ZfbMdWasmOptions, ParseDialect, PipelineOptions, GfmOptions, CodeHighlightMode, CodeHighlightOptions, MarkdownFeaturesConfig,
|
|
11
|
+
export type { RenderHtmlResult, Diagnostic, DiagnosticSource, ZfbMdWasmOptions, ParseDialect, PipelineOptions, GfmOptions, CodeHighlightMode, CodeHighlightOptions, MarkdownFeaturesConfig, HighlightRole, } from "./types.js";
|
|
@@ -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,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACpD,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,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
|
|
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,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACpD,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,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.d.ts
CHANGED
|
@@ -8,4 +8,4 @@ export declare const init: () => Promise<void>, renderHtml: (source: string, opt
|
|
|
8
8
|
terminal: boolean;
|
|
9
9
|
};
|
|
10
10
|
export { ZfbMdWasmTrapError, ZfbMdWasmTrapRecoveryLimitError } from "./runtime.js";
|
|
11
|
-
export type { RenderHtmlResult, Diagnostic, DiagnosticSource, ZfbMdWasmOptions, ParseDialect, PipelineOptions, GfmOptions, CodeHighlightMode, CodeHighlightOptions, MarkdownFeaturesConfig,
|
|
11
|
+
export type { RenderHtmlResult, Diagnostic, DiagnosticSource, ZfbMdWasmOptions, ParseDialect, PipelineOptions, GfmOptions, CodeHighlightMode, CodeHighlightOptions, MarkdownFeaturesConfig, HighlightRole, } from "./types.js";
|
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,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACpG,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,0CAA0C,EAAE,MAAM,CAAC,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
|
|
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,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACpG,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,0CAA0C,EAAE,MAAM,CAAC,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/types.d.ts
CHANGED
|
@@ -95,8 +95,6 @@ export interface PipelineOptions {
|
|
|
95
95
|
codeHighlight?: CodeHighlightOptions | null;
|
|
96
96
|
features?: MarkdownFeaturesConfig;
|
|
97
97
|
}
|
|
98
|
-
/** `jsxRuntime` option values. Consumed only by `compile`. */
|
|
99
|
-
export type JsxRuntime = "preact" | "react";
|
|
100
98
|
/**
|
|
101
99
|
* The options JSON document shared by `compile` and `renderHtml`. Every
|
|
102
100
|
* field is optional; `{}` selects all defaults. Unknown fields are
|
|
@@ -115,8 +113,6 @@ export interface ZfbMdWasmOptions {
|
|
|
115
113
|
*/
|
|
116
114
|
dialect?: ParseDialect;
|
|
117
115
|
/** Consumed only by `compile`; `renderHtml` accepts and ignores it. */
|
|
118
|
-
jsxRuntime?: JsxRuntime;
|
|
119
|
-
/** Consumed only by `compile`; `renderHtml` accepts and ignores it. */
|
|
120
116
|
development?: boolean;
|
|
121
117
|
pipeline?: PipelineOptions;
|
|
122
118
|
}
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,2EAA2E;AAC3E,qEAAqE;AACrE,gCAAgC","sourcesContent":["// Mirrors the JSON contracts of the `zfb-md-wasm` Rust crate (zfb#1576)\n// literally -- see that crate's `src/lib.rs` rustdoc for the authoritative\n// shape. Keep this file in lock-step with the crate when the crate's\n// options/result shapes change.\n\n/** `zfb_content::facade::PipelineOptions`'s `gfm` sub-object, verbatim. */\nexport interface GfmOptions {\n strikethrough?: boolean;\n table?: boolean;\n autolinkLiteral?: boolean;\n taskListItem?: boolean;\n footnoteDefinition?: boolean;\n}\n\n/** Base syntax selected by `parseToAst` and `renderHtml`. */\nexport type ParseDialect = \"markdown\" | \"mdx\";\n\n/** How `parseToAst` handles recognized YAML frontmatter. */\nexport type FrontmatterPolicy = \"extract\" | \"node\" | \"none\";\n\n/** Raw-parser pipeline options. Visitor/serializer options are not accepted. */\nexport interface ParsePipelineOptions {\n gfm?: GfmOptions;\n}\n\n/**\n * The distinct, closed options document consumed by `parseToAst`.\n *\n * `filename` must end in lowercase `.md` or `.mdx`. With no explicit\n * `dialect`, `.md` selects CommonMark and `.mdx` selects MDX; omitting the\n * filename uses `<anonymous>.mdx`, hence MDX. An explicit dialect overrides\n * either valid extension but does not waive that extension gate.\n */\nexport interface ParseToAstOptions {\n filename?: string;\n dialect?: ParseDialect;\n /** Parse generic remark-directive syntax. Default: `false`. */\n directives?: boolean;\n /**\n * YAML handling policy. Default: `\"extract\"`.\n *\n * - `extract`: parse the stripped body, return YAML as JSON, no YAML node;\n * - `node`: parse the full logical source, return JSON plus canonical YAML node;\n * - `none`: parse every logical-source byte as Markdown/MDX and always return null.\n *\n * Malformed/unterminated YAML fails `extract`/`node` with one\n * `frontmatter` diagnostic; `none` never produces a YAML diagnostic.\n */\n frontmatter?: FrontmatterPolicy;\n pipeline?: ParsePipelineOptions;\n}\n\n/**\n * `MarkdownFeaturesConfig` (see `crates/zfb-md-ast/src/features_config.rs`).\n * Left as an open record here -- the wasm boundary passes it through to the\n * Rust `deny_unknown_fields` deserializer verbatim, which is the\n * authoritative validator for its keys.\n */\nexport type MarkdownFeaturesConfig = Record<string, unknown>;\n\n/**\n * `zfb_content::facade::CodeHighlightOptions`'s `mode` field -- mirrors the\n * `\"inline\"` / `\"class\"` string-literal union in native `zfb.config.ts`\n * (`CodeHighlightConfig.mode`).\n */\nexport type CodeHighlightMode = \"inline\" | \"class\";\n\n/**\n * `zfb_content::facade::CodeHighlightOptions`, verbatim (Highlight Tokens\n * epic zfb#1528, wasm routing sub zfb#1852).\n */\nexport interface CodeHighlightOptions {\n /** Output mode for fenced-code highlighting. Defaults to `\"inline\"` --\n * reproduces the pre-existing per-token inline-color behaviour\n * byte-for-byte. */\n mode?: CodeHighlightMode;\n /** Class-name prefix for class-mode role classes (e.g. the default\n * `\"hi-\"` yields `hi-kw`, `hi-str`, ...). Only meaningful when `mode` is\n * `\"class\"`. */\n classPrefix?: string;\n /** Per-role class overrides for class mode. Absent or `null` uses\n * `{classPrefix}{role}` for every role. Only meaningful when `mode` is\n * `\"class\"`. */\n roleClasses?: Partial<Record<HighlightRole, string>> | null;\n}\n\n/** `zfb_content::facade::PipelineOptions`, verbatim. */\nexport interface PipelineOptions {\n /**\n * A syntect theme name. Absent, or explicit `null`, keeps the built-in\n * default theme (`base16-ocean.dark`) -- fenced code is ALWAYS\n * highlighted through this field; there is no \"no syntax highlighting\"\n * value (this comment previously claimed `null` meant no highlighting,\n * which was never true of the Rust deserializer -- corrected in\n * zfb#1852). Mutually exclusive with `codeHighlight.mode: \"class\"`.\n */\n theme?: string | null;\n gfm?: GfmOptions;\n cjkFriendly?: boolean;\n hardBreaks?: boolean;\n /**\n * Output mode + class-mode knobs for fenced-code highlighting\n * (Highlight Tokens epic zfb#1528). Absent, `null`, or\n * `{ mode: \"inline\" }` reproduce the pre-existing inline-color\n * behaviour byte-for-byte. `{ mode: \"class\" }` is mutually exclusive\n * with a top-level `theme`.\n */\n codeHighlight?: CodeHighlightOptions | null;\n features?: MarkdownFeaturesConfig;\n}\n\n/** `jsxRuntime` option values. Consumed only by `compile`. */\nexport type JsxRuntime = \"preact\" | \"react\";\n\n/**\n * The options JSON document shared by `compile` and `renderHtml`. Every\n * field is optional; `{}` selects all defaults. Unknown fields are\n * rejected by the Rust side at both nesting levels (`deny_unknown_fields`).\n */\nexport interface ZfbMdWasmOptions {\n /**\n * Must end in `.md` or `.mdx`. Drives frontmatter dispatch and\n * diagnostics display. Defaults to `<anonymous>.mdx` for `compile` and\n * `<anonymous>.md` for `renderHtml`.\n */\n filename?: string;\n /**\n * Consumed only by `renderHtml`; `compile` accepts and ignores it.\n * Without an override, `.md` selects CommonMark and `.mdx` selects MDX.\n */\n dialect?: ParseDialect;\n /** Consumed only by `compile`; `renderHtml` accepts and ignores it. */\n jsxRuntime?: JsxRuntime;\n /** Consumed only by `compile`; `renderHtml` accepts and ignores it. */\n development?: boolean;\n pipeline?: PipelineOptions;\n}\n\n/** `source` values a `Diagnostic` can carry. */\nexport type DiagnosticSource = \"options\" | \"frontmatter\" | \"markdown\" | \"compile\";\n\n/**\n * One diagnostic entry. `line`/`column` are the sole supported diagnostic\n * location and are 1-based. For `\"markdown\"` / `\"frontmatter\"` they point\n * into the *original source* (frontmatter lines included) in JavaScript\n * UTF-16 code units. For `\"options\"` they point into the *options JSON\n * document*. They are `null` when the underlying error carries no location.\n */\nexport interface Diagnostic {\n severity: \"error\";\n source: DiagnosticSource;\n /**\n * Opaque display text from this package or an upstream dependency. Do not\n * parse or rewrite it: embedded coordinates, when present, are not public\n * API and may use the dependency's own coordinate space. Use structured\n * `line` and `column` for the supported location instead.\n */\n message: string;\n line: number | null;\n column: number | null;\n}\n\n/** Result document of `compile`. */\nexport interface CompileResult {\n /** ES-module JS source on success, `null` on failure. */\n code: string | null;\n /** Parsed YAML frontmatter as JSON, `null` when absent or unextractable. */\n frontmatter: unknown;\n diagnostics: Diagnostic[];\n}\n\n/**\n * One point in the original source (unist convention). `line` is 1-based\n * and unit-agnostic. `column` is 1-based and `offset` is 0-based, BOTH in\n * **UTF-16 code units** (zfb#1856, epic zfb#1854) — the indexing\n * `String.prototype.slice`, `mdast-util-to-hast`, and consumer mdast\n * plugins already use, and remark/unist's own convention. This is NOT\n * Unicode scalar values/code points: a scalar value outside the Basic\n * Multilingual Plane (most emoji) is 2 UTF-16 code units but 1 code point,\n * so a surrogate-pair character advances `offset`/`column` by 2, not 1.\n * Pure-ASCII sources have byte offsets == UTF-16 offsets, so this only\n * matters once the source has non-ASCII content.\n */\nexport interface AstPoint {\n line: number;\n column: number;\n offset: number;\n}\n\n/** Start/end span of two {@link AstPoint}s (unist convention). */\nexport interface AstPosition {\n start: AstPoint;\n end: AstPoint;\n}\n\n/** Optional unist data carried losslessly by known raw tree nodes. */\nexport interface RawMdastData {\n data?: Record<string, unknown>;\n}\n\n/**\n * Internal markdown-rs re-parse bookkeeping carried by MDX expression/ESM\n * nodes: `[indexInValue, absoluteSourceOffset]`. Internal, unstable, and\n * (unlike {@link AstPosition}) **UTF-8 BYTE**-based -- markdown-rs uses it\n * to re-resolve sub-positions inside an expression's own re-parse pass.\n * Never slice a string with it; it does not share `position`'s UTF-16 unit\n * contract.\n */\nexport type MarkdownRsStop = readonly [indexInValue: number, absoluteSourceOffsetBytes: number];\n\n/** GFM alignment for a table column. `null` means no explicit alignment. */\nexport type TableAlign = \"left\" | \"right\" | \"center\" | null;\n\n/** Explicitness of a `link`/`image` reference (GFM footnotes reuse it too). */\nexport type ReferenceKind = \"shortcut\" | \"collapsed\" | \"full\";\n\n// ── mdast core node set ─────────────────────────────────────────────────────\n// Mirrors `markdown::mdast::Node`'s variants (markdown-rs, `serde(tag =\n// \"type\", rename_all = \"camelCase\")`) -- see that crate's `src/mdast.rs` for\n// the authoritative field shapes. Every variant here always carries\n// `position` (requirement 2 of zfb#1828); the one documented exception,\n// `mdxJsxAttribute`/its value/expression-attribute siblings, is intentionally\n// NOT part of the `MdastNode` union below -- they are attribute records\n// embedded in `MdxJsxFlowElement`/`MdxJsxTextElement.attributes`, not\n// standalone tree nodes.\n\nexport interface Root extends RawMdastData {\n type: \"root\";\n position: AstPosition;\n children: MdastNode[];\n}\nexport interface Paragraph extends RawMdastData {\n type: \"paragraph\";\n position: AstPosition;\n children: MdastNode[];\n}\nexport interface Heading extends RawMdastData {\n type: \"heading\";\n position: AstPosition;\n depth: 1 | 2 | 3 | 4 | 5 | 6;\n children: MdastNode[];\n}\nexport interface ThematicBreak extends RawMdastData {\n type: \"thematicBreak\";\n position: AstPosition;\n}\nexport interface Blockquote extends RawMdastData {\n type: \"blockquote\";\n position: AstPosition;\n children: MdastNode[];\n}\nexport interface List extends RawMdastData {\n type: \"list\";\n position: AstPosition;\n ordered: boolean;\n /**\n * Absent for an unordered list. Rust serializes `None` here by OMITTING\n * the key (`#[serde(skip_serializing_if = \"Option::is_none\")]`), not as\n * JSON `null` -- hence `?:`, not `| null`.\n */\n start?: number;\n spread: boolean;\n children: MdastNode[];\n}\nexport interface ListItem extends RawMdastData {\n type: \"listItem\";\n position: AstPosition;\n spread: boolean;\n /** GFM task-list state; absent (not `null` -- see {@link List.start}) for a plain (non-task) item. */\n checked?: boolean;\n children: MdastNode[];\n}\nexport interface Html extends RawMdastData {\n type: \"html\";\n position: AstPosition;\n value: string;\n}\nexport interface Code extends RawMdastData {\n type: \"code\";\n position: AstPosition;\n /** Absent when the fence has no language (see {@link List.start}). */\n lang?: string;\n /** Absent when the fence has no meta string (see {@link List.start}). */\n meta?: string;\n value: string;\n}\nexport interface Definition extends RawMdastData {\n type: \"definition\";\n position: AstPosition;\n url: string;\n /** Absent when there is no title (see {@link List.start}). */\n title?: string;\n identifier: string;\n /** Absent when there is no label (see {@link List.start}). */\n label?: string;\n}\nexport interface Text extends RawMdastData {\n type: \"text\";\n position: AstPosition;\n value: string;\n}\n\n/** Shared raw shape of the three generic remark-directive node kinds. */\nexport interface DirectiveNodeBase extends RawMdastData {\n position: AstPosition;\n name: string;\n /** Always present; boolean attributes are represented by an empty string. */\n attributes: Record<string, string>;\n children: MdastNode[];\n}\nexport interface ContainerDirective extends DirectiveNodeBase {\n type: \"containerDirective\";\n}\nexport interface LeafDirective extends DirectiveNodeBase {\n type: \"leafDirective\";\n}\nexport interface TextDirective extends DirectiveNodeBase {\n type: \"textDirective\";\n}\nexport interface Emphasis extends RawMdastData {\n type: \"emphasis\";\n position: AstPosition;\n children: MdastNode[];\n}\nexport interface Strong extends RawMdastData {\n type: \"strong\";\n position: AstPosition;\n children: MdastNode[];\n}\nexport interface InlineCode extends RawMdastData {\n type: \"inlineCode\";\n position: AstPosition;\n value: string;\n}\nexport interface Break extends RawMdastData {\n type: \"break\";\n position: AstPosition;\n}\nexport interface Link extends RawMdastData {\n type: \"link\";\n position: AstPosition;\n url: string;\n /** Absent when there is no title (see {@link List.start}). */\n title?: string;\n children: MdastNode[];\n}\nexport interface Image extends RawMdastData {\n type: \"image\";\n position: AstPosition;\n alt: string;\n url: string;\n /** Absent when there is no title (see {@link List.start}). */\n title?: string;\n}\nexport interface LinkReference extends RawMdastData {\n type: \"linkReference\";\n position: AstPosition;\n referenceType: ReferenceKind;\n identifier: string;\n /** Absent when there is no label (see {@link List.start}). */\n label?: string;\n children: MdastNode[];\n}\nexport interface ImageReference extends RawMdastData {\n type: \"imageReference\";\n position: AstPosition;\n alt: string;\n referenceType: ReferenceKind;\n identifier: string;\n /** Absent when there is no label (see {@link List.start}). */\n label?: string;\n}\n/** GFM footnote definition (`[^id]: ...`). */\nexport interface FootnoteDefinition extends RawMdastData {\n type: \"footnoteDefinition\";\n position: AstPosition;\n identifier: string;\n /** Absent when there is no label (see {@link List.start}). */\n label?: string;\n children: MdastNode[];\n}\n/** GFM footnote reference (`[^id]`). */\nexport interface FootnoteReference extends RawMdastData {\n type: \"footnoteReference\";\n position: AstPosition;\n identifier: string;\n /** Absent when there is no label (see {@link List.start}). */\n label?: string;\n}\n/** GFM table. */\nexport interface Table extends RawMdastData {\n type: \"table\";\n position: AstPosition;\n align: TableAlign[];\n children: MdastNode[];\n}\nexport interface TableRow extends RawMdastData {\n type: \"tableRow\";\n position: AstPosition;\n children: MdastNode[];\n}\nexport interface TableCell extends RawMdastData {\n type: \"tableCell\";\n position: AstPosition;\n children: MdastNode[];\n}\n/** GFM strikethrough (`~~text~~`). */\nexport interface Delete extends RawMdastData {\n type: \"delete\";\n position: AstPosition;\n children: MdastNode[];\n}\n/**\n * Canonical markdown-rs YAML frontmatter node emitted by\n * `frontmatter: \"node\"`. Its value excludes fences and line endings while\n * its position covers the complete fenced block.\n */\nexport interface Yaml extends RawMdastData {\n type: \"yaml\";\n position: AstPosition;\n value: string;\n}\n\n// ── MDX node set ─────────────────────────────────────────────────────────\n\n/** MDX flow expression (`{...}` on its own line). */\nexport interface MdxFlowExpression extends RawMdastData {\n type: \"mdxFlowExpression\";\n position: AstPosition;\n value: string;\n /** Internal/unstable/byte-based -- see {@link MarkdownRsStop}. */\n _markdownRsStops: MarkdownRsStop[];\n}\n/** MDX text expression (`{...}` inline in phrasing content). */\nexport interface MdxTextExpression extends RawMdastData {\n type: \"mdxTextExpression\";\n position: AstPosition;\n value: string;\n _markdownRsStops: MarkdownRsStop[];\n}\n/** MDX JSX element as flow (block-level) content. */\nexport interface MdxJsxFlowElement extends RawMdastData {\n type: \"mdxJsxFlowElement\";\n position: AstPosition;\n /** Absent for a JSX fragment (`<>...</>`) -- see {@link List.start}. */\n name?: string;\n attributes: MdxJsxAttributeContent[];\n children: MdastNode[];\n}\n/** MDX JSX element as phrasing (inline) content. */\nexport interface MdxJsxTextElement extends RawMdastData {\n type: \"mdxJsxTextElement\";\n position: AstPosition;\n /** Absent for a JSX fragment (`<>...</>`) -- see {@link List.start}. */\n name?: string;\n attributes: MdxJsxAttributeContent[];\n children: MdastNode[];\n}\n\n/**\n * A JSX attribute's value: a plain string literal, or a `{...}` expression\n * value. Divergence: expression attribute VALUES carry no `position`\n * (mirrors the `mdxJsxAttribute`/`mdxJsxExpressionAttribute` divergence\n * below -- markdown-rs does not model attribute positions anywhere).\n */\nexport interface MdxJsxAttributeValueExpression extends RawMdastData {\n type: \"mdxJsxAttributeValueExpression\";\n value: string;\n _markdownRsStops: MarkdownRsStop[];\n}\n/**\n * One `name=\"value\"` / `name={expr}` / bare `name` JSX attribute.\n * Divergence: carries no `position` -- markdown-rs does not model attribute\n * positions (zfb#1828 requirement 2's one documented exception).\n */\nexport interface MdxJsxAttribute extends RawMdastData {\n type: \"mdxJsxAttribute\";\n name: string;\n /** Absent for a bare boolean attribute (`<a b />`) -- see {@link List.start}. */\n value?: string | MdxJsxAttributeValueExpression;\n}\n/**\n * A JSX spread attribute (`{...expr}`). Divergence: carries no `position`,\n * same reason as {@link MdxJsxAttribute}.\n */\nexport interface MdxJsxExpressionAttribute extends RawMdastData {\n type: \"mdxJsxExpressionAttribute\";\n value: string;\n _markdownRsStops: MarkdownRsStop[];\n}\n/** One entry of `MdxJsxFlowElement`/`MdxJsxTextElement.attributes`. */\nexport type MdxJsxAttributeContent = MdxJsxAttribute | MdxJsxExpressionAttribute;\n\n/**\n * Catch-all for any mdast node type not enumerated above -- keeps\n * unrecognized/future node types TYPED (requirement 3 of zfb#1828: an opaque\n * `unknown` would silently drop this contract) rather than falling back to\n * `unknown`. `type` is deliberately the general `string` here (not a\n * literal), so TypeScript's discriminated-union narrowing on `type` keeps\n * this member alongside any single literal match; disambiguate with an\n * explicit assertion once a runtime `type` check has confirmed which shape\n * you actually have (see `test/consumer-compatibility-parse-to-ast.ts` for\n * the pattern).\n */\nexport interface UnknownMdastNode {\n type: string;\n position: AstPosition;\n [key: string]: unknown;\n}\n\n/**\n * Any node markdown-rs's raw mdast serialization can produce through\n * `parseToAst` -- the documented mdast core set, the documented MDX set, or\n * {@link UnknownMdastNode} for anything else. Attribute-record shapes\n * ({@link MdxJsxAttributeContent} and its members) are intentionally NOT\n * part of this union -- see their own docs.\n */\nexport type MdastNode =\n | Root\n | Paragraph\n | Heading\n | ThematicBreak\n | Blockquote\n | List\n | ListItem\n | Html\n | Code\n | Definition\n | Text\n | Emphasis\n | Strong\n | InlineCode\n | Break\n | Link\n | Image\n | LinkReference\n | ImageReference\n | FootnoteDefinition\n | FootnoteReference\n | Table\n | TableRow\n | TableCell\n | Delete\n | Yaml\n | MdxFlowExpression\n | MdxTextExpression\n | MdxJsxFlowElement\n | MdxJsxTextElement\n | ContainerDirective\n | LeafDirective\n | TextDirective\n | UnknownMdastNode;\n\n/** The tree root `parseToAst` returns -- always a `root` node when present. */\nexport type MdastRoot = Root;\n\n/**\n * Result document of `parseToAst` (zfb#1857, epic zfb#1854). `ast` is the\n * raw markdown-rs mdast converted through its serde shape into an open\n * carrier (unist-shaped `type`, fields, and `position`) and PRE-zfb-visitors.\n * Source selection follows {@link FrontmatterPolicy}. When `directives` is\n * true the carrier can also contain the three generic directive kinds;\n * otherwise directive-looking text survives exactly as markdown-rs parsed\n * it. `position.offset` and\n * `position.column` are UTF-16 code units (see {@link AstPoint}).\n *\n * Markdown mode preserves CommonMark HTML/comments, angle autolinks,\n * indented code, and literal braces. MDX mode enables JSX/expressions and\n * keeps markdown-rs's conflicting CommonMark constructs disabled. Both\n * modes apply the same five independent {@link GfmOptions} switches.\n *\n * Documented divergences from remark-parse / remark-mdx in MDX mode:\n * - `mdxJsxAttribute` (and its value/expression-attribute siblings) carry no\n * `position` -- markdown-rs does not model attribute positions.\n * - Top-level `import`/`export` degrade to paragraphs (no `mdxjsEsm` nodes),\n * and MDX expressions carry no estree data -- the wasm boundary cannot\n * host a JS ESM/acorn parser. Consumers needing remark-mdx-equivalent\n * ESM/estree keep remark for those documents.\n * - `_markdownRsStops` is internal, unstable, and byte-based (not UTF-16) --\n * see {@link MarkdownRsStop}.\n */\nexport interface ParseToAstResult {\n /** Serialized raw mdast root on success, `null` on failure. */\n ast: MdastRoot | null;\n /** Parsed YAML frontmatter as JSON, `null` when absent or unextractable. */\n frontmatter: unknown;\n diagnostics: Diagnostic[];\n}\n\n/** Result document of `renderHtml`. */\nexport interface RenderHtmlResult {\n /** HTML fragment on success, `null` on failure. */\n html: string | null;\n frontmatter: unknown;\n diagnostics: Diagnostic[];\n}\n\n/**\n * The fixed 18-role semantic taxonomy emitted by `highlightCode`. This union\n * is mechanically checked against Rust's canonical `HiRole::FULL_NAMES` by\n * `zfb`'s role-drift guard; do not add a second unguarded role list.\n */\nexport type HighlightRole =\n | \"escape\"\n | \"operator\"\n | \"comment\"\n | \"string\"\n | \"number\"\n | \"constant\"\n | \"keyword\"\n | \"function\"\n | \"type\"\n | \"namespace\"\n | \"property\"\n | \"variable\"\n | \"tag\"\n | \"attribute\"\n | \"punctuation\"\n | \"inserted\"\n | \"deleted\"\n | \"heading\";\n\n/** Options for direct arbitrary-code semantic class highlighting. */\nexport interface HighlightCodeOptions {\n /** Required syntax token, for example `\"html\"`, `\"css\"`, or `\"javascript\"`. */\n language: string;\n /** The only supported direct output mode. Defaults to `\"class\"`. */\n mode?: \"class\";\n /** Semantic role class prefix. Defaults to `\"hi-\"`. */\n classPrefix?: string;\n /** Full-name role overrides, for example `{ keyword: \"text-violet-600\" }`. */\n roleClasses?: Partial<Record<HighlightRole, string>>;\n}\n\n/** Sources used by direct `highlightCode` diagnostics. */\nexport type HighlightDiagnosticSource = \"options\" | \"highlight\" | \"internal\";\n\n/** A structured direct-highlighting diagnostic. */\nexport interface HighlightDiagnostic {\n severity: \"error\" | \"warning\";\n source: HighlightDiagnosticSource;\n message: string;\n /** Always `null` for semantic/highlight diagnostics; JSON option parse locations are 1-based. */\n line: number | null;\n /** Always `null` for semantic/highlight diagnostics; JSON option parse locations are 1-based. */\n column: number | null;\n}\n\n/** Result document returned by {@link highlightCode}. */\nexport interface HighlightCodeResult {\n /** Complete semantic `<pre><code>` wrapper, or `null` for invalid options/internal errors. */\n html: string | null;\n diagnostics: HighlightDiagnostic[];\n}\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,2EAA2E;AAC3E,qEAAqE;AACrE,gCAAgC","sourcesContent":["// Mirrors the JSON contracts of the `zfb-md-wasm` Rust crate (zfb#1576)\n// literally -- see that crate's `src/lib.rs` rustdoc for the authoritative\n// shape. Keep this file in lock-step with the crate when the crate's\n// options/result shapes change.\n\n/** `zfb_content::facade::PipelineOptions`'s `gfm` sub-object, verbatim. */\nexport interface GfmOptions {\n strikethrough?: boolean;\n table?: boolean;\n autolinkLiteral?: boolean;\n taskListItem?: boolean;\n footnoteDefinition?: boolean;\n}\n\n/** Base syntax selected by `parseToAst` and `renderHtml`. */\nexport type ParseDialect = \"markdown\" | \"mdx\";\n\n/** How `parseToAst` handles recognized YAML frontmatter. */\nexport type FrontmatterPolicy = \"extract\" | \"node\" | \"none\";\n\n/** Raw-parser pipeline options. Visitor/serializer options are not accepted. */\nexport interface ParsePipelineOptions {\n gfm?: GfmOptions;\n}\n\n/**\n * The distinct, closed options document consumed by `parseToAst`.\n *\n * `filename` must end in lowercase `.md` or `.mdx`. With no explicit\n * `dialect`, `.md` selects CommonMark and `.mdx` selects MDX; omitting the\n * filename uses `<anonymous>.mdx`, hence MDX. An explicit dialect overrides\n * either valid extension but does not waive that extension gate.\n */\nexport interface ParseToAstOptions {\n filename?: string;\n dialect?: ParseDialect;\n /** Parse generic remark-directive syntax. Default: `false`. */\n directives?: boolean;\n /**\n * YAML handling policy. Default: `\"extract\"`.\n *\n * - `extract`: parse the stripped body, return YAML as JSON, no YAML node;\n * - `node`: parse the full logical source, return JSON plus canonical YAML node;\n * - `none`: parse every logical-source byte as Markdown/MDX and always return null.\n *\n * Malformed/unterminated YAML fails `extract`/`node` with one\n * `frontmatter` diagnostic; `none` never produces a YAML diagnostic.\n */\n frontmatter?: FrontmatterPolicy;\n pipeline?: ParsePipelineOptions;\n}\n\n/**\n * `MarkdownFeaturesConfig` (see `crates/zfb-md-ast/src/features_config.rs`).\n * Left as an open record here -- the wasm boundary passes it through to the\n * Rust `deny_unknown_fields` deserializer verbatim, which is the\n * authoritative validator for its keys.\n */\nexport type MarkdownFeaturesConfig = Record<string, unknown>;\n\n/**\n * `zfb_content::facade::CodeHighlightOptions`'s `mode` field -- mirrors the\n * `\"inline\"` / `\"class\"` string-literal union in native `zfb.config.ts`\n * (`CodeHighlightConfig.mode`).\n */\nexport type CodeHighlightMode = \"inline\" | \"class\";\n\n/**\n * `zfb_content::facade::CodeHighlightOptions`, verbatim (Highlight Tokens\n * epic zfb#1528, wasm routing sub zfb#1852).\n */\nexport interface CodeHighlightOptions {\n /** Output mode for fenced-code highlighting. Defaults to `\"inline\"` --\n * reproduces the pre-existing per-token inline-color behaviour\n * byte-for-byte. */\n mode?: CodeHighlightMode;\n /** Class-name prefix for class-mode role classes (e.g. the default\n * `\"hi-\"` yields `hi-kw`, `hi-str`, ...). Only meaningful when `mode` is\n * `\"class\"`. */\n classPrefix?: string;\n /** Per-role class overrides for class mode. Absent or `null` uses\n * `{classPrefix}{role}` for every role. Only meaningful when `mode` is\n * `\"class\"`. */\n roleClasses?: Partial<Record<HighlightRole, string>> | null;\n}\n\n/** `zfb_content::facade::PipelineOptions`, verbatim. */\nexport interface PipelineOptions {\n /**\n * A syntect theme name. Absent, or explicit `null`, keeps the built-in\n * default theme (`base16-ocean.dark`) -- fenced code is ALWAYS\n * highlighted through this field; there is no \"no syntax highlighting\"\n * value (this comment previously claimed `null` meant no highlighting,\n * which was never true of the Rust deserializer -- corrected in\n * zfb#1852). Mutually exclusive with `codeHighlight.mode: \"class\"`.\n */\n theme?: string | null;\n gfm?: GfmOptions;\n cjkFriendly?: boolean;\n hardBreaks?: boolean;\n /**\n * Output mode + class-mode knobs for fenced-code highlighting\n * (Highlight Tokens epic zfb#1528). Absent, `null`, or\n * `{ mode: \"inline\" }` reproduce the pre-existing inline-color\n * behaviour byte-for-byte. `{ mode: \"class\" }` is mutually exclusive\n * with a top-level `theme`.\n */\n codeHighlight?: CodeHighlightOptions | null;\n features?: MarkdownFeaturesConfig;\n}\n\n/**\n * The options JSON document shared by `compile` and `renderHtml`. Every\n * field is optional; `{}` selects all defaults. Unknown fields are\n * rejected by the Rust side at both nesting levels (`deny_unknown_fields`).\n */\nexport interface ZfbMdWasmOptions {\n /**\n * Must end in `.md` or `.mdx`. Drives frontmatter dispatch and\n * diagnostics display. Defaults to `<anonymous>.mdx` for `compile` and\n * `<anonymous>.md` for `renderHtml`.\n */\n filename?: string;\n /**\n * Consumed only by `renderHtml`; `compile` accepts and ignores it.\n * Without an override, `.md` selects CommonMark and `.mdx` selects MDX.\n */\n dialect?: ParseDialect;\n /** Consumed only by `compile`; `renderHtml` accepts and ignores it. */\n development?: boolean;\n pipeline?: PipelineOptions;\n}\n\n/** `source` values a `Diagnostic` can carry. */\nexport type DiagnosticSource = \"options\" | \"frontmatter\" | \"markdown\" | \"compile\";\n\n/**\n * One diagnostic entry. `line`/`column` are the sole supported diagnostic\n * location and are 1-based. For `\"markdown\"` / `\"frontmatter\"` they point\n * into the *original source* (frontmatter lines included) in JavaScript\n * UTF-16 code units. For `\"options\"` they point into the *options JSON\n * document*. They are `null` when the underlying error carries no location.\n */\nexport interface Diagnostic {\n severity: \"error\";\n source: DiagnosticSource;\n /**\n * Opaque display text from this package or an upstream dependency. Do not\n * parse or rewrite it: embedded coordinates, when present, are not public\n * API and may use the dependency's own coordinate space. Use structured\n * `line` and `column` for the supported location instead.\n */\n message: string;\n line: number | null;\n column: number | null;\n}\n\n/** Result document of `compile`. */\nexport interface CompileResult {\n /** ES-module JS source on success, `null` on failure. */\n code: string | null;\n /** Parsed YAML frontmatter as JSON, `null` when absent or unextractable. */\n frontmatter: unknown;\n diagnostics: Diagnostic[];\n}\n\n/**\n * One point in the original source (unist convention). `line` is 1-based\n * and unit-agnostic. `column` is 1-based and `offset` is 0-based, BOTH in\n * **UTF-16 code units** (zfb#1856, epic zfb#1854) — the indexing\n * `String.prototype.slice`, `mdast-util-to-hast`, and consumer mdast\n * plugins already use, and remark/unist's own convention. This is NOT\n * Unicode scalar values/code points: a scalar value outside the Basic\n * Multilingual Plane (most emoji) is 2 UTF-16 code units but 1 code point,\n * so a surrogate-pair character advances `offset`/`column` by 2, not 1.\n * Pure-ASCII sources have byte offsets == UTF-16 offsets, so this only\n * matters once the source has non-ASCII content.\n */\nexport interface AstPoint {\n line: number;\n column: number;\n offset: number;\n}\n\n/** Start/end span of two {@link AstPoint}s (unist convention). */\nexport interface AstPosition {\n start: AstPoint;\n end: AstPoint;\n}\n\n/** Optional unist data carried losslessly by known raw tree nodes. */\nexport interface RawMdastData {\n data?: Record<string, unknown>;\n}\n\n/**\n * Internal markdown-rs re-parse bookkeeping carried by MDX expression/ESM\n * nodes: `[indexInValue, absoluteSourceOffset]`. Internal, unstable, and\n * (unlike {@link AstPosition}) **UTF-8 BYTE**-based -- markdown-rs uses it\n * to re-resolve sub-positions inside an expression's own re-parse pass.\n * Never slice a string with it; it does not share `position`'s UTF-16 unit\n * contract.\n */\nexport type MarkdownRsStop = readonly [indexInValue: number, absoluteSourceOffsetBytes: number];\n\n/** GFM alignment for a table column. `null` means no explicit alignment. */\nexport type TableAlign = \"left\" | \"right\" | \"center\" | null;\n\n/** Explicitness of a `link`/`image` reference (GFM footnotes reuse it too). */\nexport type ReferenceKind = \"shortcut\" | \"collapsed\" | \"full\";\n\n// ── mdast core node set ─────────────────────────────────────────────────────\n// Mirrors `markdown::mdast::Node`'s variants (markdown-rs, `serde(tag =\n// \"type\", rename_all = \"camelCase\")`) -- see that crate's `src/mdast.rs` for\n// the authoritative field shapes. Every variant here always carries\n// `position` (requirement 2 of zfb#1828); the one documented exception,\n// `mdxJsxAttribute`/its value/expression-attribute siblings, is intentionally\n// NOT part of the `MdastNode` union below -- they are attribute records\n// embedded in `MdxJsxFlowElement`/`MdxJsxTextElement.attributes`, not\n// standalone tree nodes.\n\nexport interface Root extends RawMdastData {\n type: \"root\";\n position: AstPosition;\n children: MdastNode[];\n}\nexport interface Paragraph extends RawMdastData {\n type: \"paragraph\";\n position: AstPosition;\n children: MdastNode[];\n}\nexport interface Heading extends RawMdastData {\n type: \"heading\";\n position: AstPosition;\n depth: 1 | 2 | 3 | 4 | 5 | 6;\n children: MdastNode[];\n}\nexport interface ThematicBreak extends RawMdastData {\n type: \"thematicBreak\";\n position: AstPosition;\n}\nexport interface Blockquote extends RawMdastData {\n type: \"blockquote\";\n position: AstPosition;\n children: MdastNode[];\n}\nexport interface List extends RawMdastData {\n type: \"list\";\n position: AstPosition;\n ordered: boolean;\n /**\n * Absent for an unordered list. Rust serializes `None` here by OMITTING\n * the key (`#[serde(skip_serializing_if = \"Option::is_none\")]`), not as\n * JSON `null` -- hence `?:`, not `| null`.\n */\n start?: number;\n spread: boolean;\n children: MdastNode[];\n}\nexport interface ListItem extends RawMdastData {\n type: \"listItem\";\n position: AstPosition;\n spread: boolean;\n /** GFM task-list state; absent (not `null` -- see {@link List.start}) for a plain (non-task) item. */\n checked?: boolean;\n children: MdastNode[];\n}\nexport interface Html extends RawMdastData {\n type: \"html\";\n position: AstPosition;\n value: string;\n}\nexport interface Code extends RawMdastData {\n type: \"code\";\n position: AstPosition;\n /** Absent when the fence has no language (see {@link List.start}). */\n lang?: string;\n /** Absent when the fence has no meta string (see {@link List.start}). */\n meta?: string;\n value: string;\n}\nexport interface Definition extends RawMdastData {\n type: \"definition\";\n position: AstPosition;\n url: string;\n /** Absent when there is no title (see {@link List.start}). */\n title?: string;\n identifier: string;\n /** Absent when there is no label (see {@link List.start}). */\n label?: string;\n}\nexport interface Text extends RawMdastData {\n type: \"text\";\n position: AstPosition;\n value: string;\n}\n\n/** Shared raw shape of the three generic remark-directive node kinds. */\nexport interface DirectiveNodeBase extends RawMdastData {\n position: AstPosition;\n name: string;\n /** Always present; boolean attributes are represented by an empty string. */\n attributes: Record<string, string>;\n children: MdastNode[];\n}\nexport interface ContainerDirective extends DirectiveNodeBase {\n type: \"containerDirective\";\n}\nexport interface LeafDirective extends DirectiveNodeBase {\n type: \"leafDirective\";\n}\nexport interface TextDirective extends DirectiveNodeBase {\n type: \"textDirective\";\n}\nexport interface Emphasis extends RawMdastData {\n type: \"emphasis\";\n position: AstPosition;\n children: MdastNode[];\n}\nexport interface Strong extends RawMdastData {\n type: \"strong\";\n position: AstPosition;\n children: MdastNode[];\n}\nexport interface InlineCode extends RawMdastData {\n type: \"inlineCode\";\n position: AstPosition;\n value: string;\n}\nexport interface Break extends RawMdastData {\n type: \"break\";\n position: AstPosition;\n}\nexport interface Link extends RawMdastData {\n type: \"link\";\n position: AstPosition;\n url: string;\n /** Absent when there is no title (see {@link List.start}). */\n title?: string;\n children: MdastNode[];\n}\nexport interface Image extends RawMdastData {\n type: \"image\";\n position: AstPosition;\n alt: string;\n url: string;\n /** Absent when there is no title (see {@link List.start}). */\n title?: string;\n}\nexport interface LinkReference extends RawMdastData {\n type: \"linkReference\";\n position: AstPosition;\n referenceType: ReferenceKind;\n identifier: string;\n /** Absent when there is no label (see {@link List.start}). */\n label?: string;\n children: MdastNode[];\n}\nexport interface ImageReference extends RawMdastData {\n type: \"imageReference\";\n position: AstPosition;\n alt: string;\n referenceType: ReferenceKind;\n identifier: string;\n /** Absent when there is no label (see {@link List.start}). */\n label?: string;\n}\n/** GFM footnote definition (`[^id]: ...`). */\nexport interface FootnoteDefinition extends RawMdastData {\n type: \"footnoteDefinition\";\n position: AstPosition;\n identifier: string;\n /** Absent when there is no label (see {@link List.start}). */\n label?: string;\n children: MdastNode[];\n}\n/** GFM footnote reference (`[^id]`). */\nexport interface FootnoteReference extends RawMdastData {\n type: \"footnoteReference\";\n position: AstPosition;\n identifier: string;\n /** Absent when there is no label (see {@link List.start}). */\n label?: string;\n}\n/** GFM table. */\nexport interface Table extends RawMdastData {\n type: \"table\";\n position: AstPosition;\n align: TableAlign[];\n children: MdastNode[];\n}\nexport interface TableRow extends RawMdastData {\n type: \"tableRow\";\n position: AstPosition;\n children: MdastNode[];\n}\nexport interface TableCell extends RawMdastData {\n type: \"tableCell\";\n position: AstPosition;\n children: MdastNode[];\n}\n/** GFM strikethrough (`~~text~~`). */\nexport interface Delete extends RawMdastData {\n type: \"delete\";\n position: AstPosition;\n children: MdastNode[];\n}\n/**\n * Canonical markdown-rs YAML frontmatter node emitted by\n * `frontmatter: \"node\"`. Its value excludes fences and line endings while\n * its position covers the complete fenced block.\n */\nexport interface Yaml extends RawMdastData {\n type: \"yaml\";\n position: AstPosition;\n value: string;\n}\n\n// ── MDX node set ─────────────────────────────────────────────────────────\n\n/** MDX flow expression (`{...}` on its own line). */\nexport interface MdxFlowExpression extends RawMdastData {\n type: \"mdxFlowExpression\";\n position: AstPosition;\n value: string;\n /** Internal/unstable/byte-based -- see {@link MarkdownRsStop}. */\n _markdownRsStops: MarkdownRsStop[];\n}\n/** MDX text expression (`{...}` inline in phrasing content). */\nexport interface MdxTextExpression extends RawMdastData {\n type: \"mdxTextExpression\";\n position: AstPosition;\n value: string;\n _markdownRsStops: MarkdownRsStop[];\n}\n/** MDX JSX element as flow (block-level) content. */\nexport interface MdxJsxFlowElement extends RawMdastData {\n type: \"mdxJsxFlowElement\";\n position: AstPosition;\n /** Absent for a JSX fragment (`<>...</>`) -- see {@link List.start}. */\n name?: string;\n attributes: MdxJsxAttributeContent[];\n children: MdastNode[];\n}\n/** MDX JSX element as phrasing (inline) content. */\nexport interface MdxJsxTextElement extends RawMdastData {\n type: \"mdxJsxTextElement\";\n position: AstPosition;\n /** Absent for a JSX fragment (`<>...</>`) -- see {@link List.start}. */\n name?: string;\n attributes: MdxJsxAttributeContent[];\n children: MdastNode[];\n}\n\n/**\n * A JSX attribute's value: a plain string literal, or a `{...}` expression\n * value. Divergence: expression attribute VALUES carry no `position`\n * (mirrors the `mdxJsxAttribute`/`mdxJsxExpressionAttribute` divergence\n * below -- markdown-rs does not model attribute positions anywhere).\n */\nexport interface MdxJsxAttributeValueExpression extends RawMdastData {\n type: \"mdxJsxAttributeValueExpression\";\n value: string;\n _markdownRsStops: MarkdownRsStop[];\n}\n/**\n * One `name=\"value\"` / `name={expr}` / bare `name` JSX attribute.\n * Divergence: carries no `position` -- markdown-rs does not model attribute\n * positions (zfb#1828 requirement 2's one documented exception).\n */\nexport interface MdxJsxAttribute extends RawMdastData {\n type: \"mdxJsxAttribute\";\n name: string;\n /** Absent for a bare boolean attribute (`<a b />`) -- see {@link List.start}. */\n value?: string | MdxJsxAttributeValueExpression;\n}\n/**\n * A JSX spread attribute (`{...expr}`). Divergence: carries no `position`,\n * same reason as {@link MdxJsxAttribute}.\n */\nexport interface MdxJsxExpressionAttribute extends RawMdastData {\n type: \"mdxJsxExpressionAttribute\";\n value: string;\n _markdownRsStops: MarkdownRsStop[];\n}\n/** One entry of `MdxJsxFlowElement`/`MdxJsxTextElement.attributes`. */\nexport type MdxJsxAttributeContent = MdxJsxAttribute | MdxJsxExpressionAttribute;\n\n/**\n * Catch-all for any mdast node type not enumerated above -- keeps\n * unrecognized/future node types TYPED (requirement 3 of zfb#1828: an opaque\n * `unknown` would silently drop this contract) rather than falling back to\n * `unknown`. `type` is deliberately the general `string` here (not a\n * literal), so TypeScript's discriminated-union narrowing on `type` keeps\n * this member alongside any single literal match; disambiguate with an\n * explicit assertion once a runtime `type` check has confirmed which shape\n * you actually have (see `test/consumer-compatibility-parse-to-ast.ts` for\n * the pattern).\n */\nexport interface UnknownMdastNode {\n type: string;\n position: AstPosition;\n [key: string]: unknown;\n}\n\n/**\n * Any node markdown-rs's raw mdast serialization can produce through\n * `parseToAst` -- the documented mdast core set, the documented MDX set, or\n * {@link UnknownMdastNode} for anything else. Attribute-record shapes\n * ({@link MdxJsxAttributeContent} and its members) are intentionally NOT\n * part of this union -- see their own docs.\n */\nexport type MdastNode =\n | Root\n | Paragraph\n | Heading\n | ThematicBreak\n | Blockquote\n | List\n | ListItem\n | Html\n | Code\n | Definition\n | Text\n | Emphasis\n | Strong\n | InlineCode\n | Break\n | Link\n | Image\n | LinkReference\n | ImageReference\n | FootnoteDefinition\n | FootnoteReference\n | Table\n | TableRow\n | TableCell\n | Delete\n | Yaml\n | MdxFlowExpression\n | MdxTextExpression\n | MdxJsxFlowElement\n | MdxJsxTextElement\n | ContainerDirective\n | LeafDirective\n | TextDirective\n | UnknownMdastNode;\n\n/** The tree root `parseToAst` returns -- always a `root` node when present. */\nexport type MdastRoot = Root;\n\n/**\n * Result document of `parseToAst` (zfb#1857, epic zfb#1854). `ast` is the\n * raw markdown-rs mdast converted through its serde shape into an open\n * carrier (unist-shaped `type`, fields, and `position`) and PRE-zfb-visitors.\n * Source selection follows {@link FrontmatterPolicy}. When `directives` is\n * true the carrier can also contain the three generic directive kinds;\n * otherwise directive-looking text survives exactly as markdown-rs parsed\n * it. `position.offset` and\n * `position.column` are UTF-16 code units (see {@link AstPoint}).\n *\n * Markdown mode preserves CommonMark HTML/comments, angle autolinks,\n * indented code, and literal braces. MDX mode enables JSX/expressions and\n * keeps markdown-rs's conflicting CommonMark constructs disabled. Both\n * modes apply the same five independent {@link GfmOptions} switches.\n *\n * Documented divergences from remark-parse / remark-mdx in MDX mode:\n * - `mdxJsxAttribute` (and its value/expression-attribute siblings) carry no\n * `position` -- markdown-rs does not model attribute positions.\n * - Top-level `import`/`export` degrade to paragraphs (no `mdxjsEsm` nodes),\n * and MDX expressions carry no estree data -- the wasm boundary cannot\n * host a JS ESM/acorn parser. Consumers needing remark-mdx-equivalent\n * ESM/estree keep remark for those documents.\n * - `_markdownRsStops` is internal, unstable, and byte-based (not UTF-16) --\n * see {@link MarkdownRsStop}.\n */\nexport interface ParseToAstResult {\n /** Serialized raw mdast root on success, `null` on failure. */\n ast: MdastRoot | null;\n /** Parsed YAML frontmatter as JSON, `null` when absent or unextractable. */\n frontmatter: unknown;\n diagnostics: Diagnostic[];\n}\n\n/** Result document of `renderHtml`. */\nexport interface RenderHtmlResult {\n /** HTML fragment on success, `null` on failure. */\n html: string | null;\n frontmatter: unknown;\n diagnostics: Diagnostic[];\n}\n\n/**\n * The fixed 18-role semantic taxonomy emitted by `highlightCode`. This union\n * is mechanically checked against Rust's canonical `HiRole::FULL_NAMES` by\n * `zfb`'s role-drift guard; do not add a second unguarded role list.\n */\nexport type HighlightRole =\n | \"escape\"\n | \"operator\"\n | \"comment\"\n | \"string\"\n | \"number\"\n | \"constant\"\n | \"keyword\"\n | \"function\"\n | \"type\"\n | \"namespace\"\n | \"property\"\n | \"variable\"\n | \"tag\"\n | \"attribute\"\n | \"punctuation\"\n | \"inserted\"\n | \"deleted\"\n | \"heading\";\n\n/** Options for direct arbitrary-code semantic class highlighting. */\nexport interface HighlightCodeOptions {\n /** Required syntax token, for example `\"html\"`, `\"css\"`, or `\"javascript\"`. */\n language: string;\n /** The only supported direct output mode. Defaults to `\"class\"`. */\n mode?: \"class\";\n /** Semantic role class prefix. Defaults to `\"hi-\"`. */\n classPrefix?: string;\n /** Full-name role overrides, for example `{ keyword: \"text-violet-600\" }`. */\n roleClasses?: Partial<Record<HighlightRole, string>>;\n}\n\n/** Sources used by direct `highlightCode` diagnostics. */\nexport type HighlightDiagnosticSource = \"options\" | \"highlight\" | \"internal\";\n\n/** A structured direct-highlighting diagnostic. */\nexport interface HighlightDiagnostic {\n severity: \"error\" | \"warning\";\n source: HighlightDiagnosticSource;\n message: string;\n /** Always `null` for semantic/highlight diagnostics; JSON option parse locations are 1-based. */\n line: number | null;\n /** Always `null` for semantic/highlight diagnostics; JSON option parse locations are 1-based. */\n column: number | null;\n}\n\n/** Result document returned by {@link highlightCode}. */\nexport interface HighlightCodeResult {\n /** Complete semantic `<pre><code>` wrapper, or `null` for invalid options/internal errors. */\n html: string | null;\n diagnostics: HighlightDiagnostic[];\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
|
+
"version": "3.0.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).",
|