satteri 0.2.6 → 0.2.7
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/dist/command-buffer.js +2 -2
- package/dist/compile.d.ts +47 -5
- package/dist/compile.js +34 -9
- package/dist/hast/hast-reader.d.ts +1 -1
- package/dist/hast/hast-reader.js +7 -1
- package/dist/hast/hast-visitor.js +3 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/mdast/mdast-materializer.js +24 -6
- package/dist/mdast/mdast-reader.d.ts +24 -0
- package/dist/mdast/mdast-reader.js +47 -0
- package/dist/mdast/mdast-visitor.js +10 -6
- package/index.d.ts +17 -11
- package/index.js +52 -52
- package/package.json +24 -6
package/dist/command-buffer.js
CHANGED
|
@@ -26,8 +26,8 @@ const PROP_STRING = 0;
|
|
|
26
26
|
const PROP_BOOL_TRUE = 1;
|
|
27
27
|
const PROP_BOOL_FALSE = 2;
|
|
28
28
|
const PROP_SPACE_SEP = 3;
|
|
29
|
-
const PROP_INT =
|
|
30
|
-
const PROP_NULL =
|
|
29
|
+
const PROP_INT = 5;
|
|
30
|
+
const PROP_NULL = 6;
|
|
31
31
|
export function classifyReturn(value) {
|
|
32
32
|
if (value === undefined || value === null)
|
|
33
33
|
return "no_change";
|
package/dist/compile.d.ts
CHANGED
|
@@ -7,9 +7,18 @@ export interface OptimizeStaticConfig {
|
|
|
7
7
|
wrapPropValue?: boolean;
|
|
8
8
|
ignoreElements?: string[];
|
|
9
9
|
}
|
|
10
|
+
/** Granular smart-punctuation toggles. Omitted fields default to true. */
|
|
11
|
+
export interface SmartPunctuationOptions {
|
|
12
|
+
/** Replace straight quotes with curly/smart quotes. Default: true. */
|
|
13
|
+
quotes?: boolean;
|
|
14
|
+
/** Replace `--`/`---` with en-dash/em-dash. Default: true. */
|
|
15
|
+
dashes?: boolean;
|
|
16
|
+
/** Replace `...` with ellipsis (`…`). Default: true. */
|
|
17
|
+
ellipses?: boolean;
|
|
18
|
+
}
|
|
10
19
|
/** Parser feature toggles. All default to their documented value when omitted. */
|
|
11
20
|
export interface Features {
|
|
12
|
-
/** GFM: tables, footnotes, strikethrough, task lists
|
|
21
|
+
/** GFM: tables, footnotes, strikethrough, task lists. Default: true. */
|
|
13
22
|
gfm?: boolean;
|
|
14
23
|
/** Frontmatter: YAML (`--- ... ---`) and TOML (`+++ ... +++`). Default: true. */
|
|
15
24
|
frontmatter?: boolean;
|
|
@@ -25,10 +34,15 @@ export interface Features {
|
|
|
25
34
|
subscript?: boolean;
|
|
26
35
|
/** Obsidian-style wikilinks (`[[link]]`). Default: false. */
|
|
27
36
|
wikilinks?: boolean;
|
|
28
|
-
/**
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
37
|
+
/**
|
|
38
|
+
* Smart punctuation à la SmartyPants. Default: false.
|
|
39
|
+
*
|
|
40
|
+
* Pass `true` to enable all categories, or an options object for granular control:
|
|
41
|
+
* ```ts
|
|
42
|
+
* smartPunctuation: { dashes: false } // quotes + ellipses only
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
smartPunctuation?: boolean | SmartPunctuationOptions;
|
|
32
46
|
}
|
|
33
47
|
export interface CompileOptions {
|
|
34
48
|
mdastPlugins?: MdastPluginDefinition[];
|
|
@@ -54,9 +68,37 @@ export interface MdxCompileOptions extends CompileOptions {
|
|
|
54
68
|
pragmaFrag?: string;
|
|
55
69
|
/** Where to import the pragma from in classic runtime (default: "react"). */
|
|
56
70
|
pragmaImportSource?: string;
|
|
71
|
+
/**
|
|
72
|
+
* Output format: "program" (default) or "function-body".
|
|
73
|
+
*
|
|
74
|
+
* - `"program"`: ES module with `import`/`export` statements.
|
|
75
|
+
* - `"function-body"`: Function body that reads runtime from `arguments[0]`
|
|
76
|
+
* and returns `{ default: MDXContent, ...exports }`. Suitable for
|
|
77
|
+
* `new Function()` or `evaluate()`.
|
|
78
|
+
*/
|
|
79
|
+
outputFormat?: "program" | "function-body";
|
|
57
80
|
}
|
|
58
81
|
export declare function markdownToHtml(source: string, options?: CompileOptions): string | Promise<string>;
|
|
59
82
|
export declare function mdxToJs(source: string, options?: MdxCompileOptions): string | Promise<string>;
|
|
83
|
+
export interface EvaluateOptions extends Omit<MdxCompileOptions, "jsx" | "outputFormat"> {
|
|
84
|
+
Fragment: unknown;
|
|
85
|
+
jsx: (type: unknown, props: unknown, key?: unknown) => unknown;
|
|
86
|
+
jsxs: (type: unknown, props: unknown, key?: unknown) => unknown;
|
|
87
|
+
jsxDEV?: (type: unknown, props: unknown, key: unknown, isStaticChildren: boolean, source: unknown, self: unknown) => unknown;
|
|
88
|
+
useMDXComponents?: () => Record<string, unknown>;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Compile and evaluate MDX in one step.
|
|
92
|
+
*
|
|
93
|
+
* Returns the module's exports, including `default` (the MDX component).
|
|
94
|
+
* Returns a Promise when async plugins are used, otherwise returns synchronously.
|
|
95
|
+
*
|
|
96
|
+
* ```ts
|
|
97
|
+
* import * as runtime from "react/jsx-runtime";
|
|
98
|
+
* const { default: Content } = evaluate("# Hello", { ...runtime });
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
101
|
+
export declare function evaluate(source: string, options: EvaluateOptions): Record<string, unknown> | Promise<Record<string, unknown>>;
|
|
60
102
|
/** Parse Markdown source into a materialized mdast tree. */
|
|
61
103
|
export declare function markdownToMdast(source: string, options?: {
|
|
62
104
|
features?: Features;
|
package/dist/compile.js
CHANGED
|
@@ -8,7 +8,6 @@ import { materializeHastTree } from "./hast/hast-materializer.js";
|
|
|
8
8
|
function featuresToNative(features) {
|
|
9
9
|
if (!features)
|
|
10
10
|
return undefined;
|
|
11
|
-
// Build object with only defined keys to satisfy exactOptionalPropertyTypes
|
|
12
11
|
const result = {};
|
|
13
12
|
if (features.gfm !== undefined)
|
|
14
13
|
result.gfm = features.gfm;
|
|
@@ -26,10 +25,14 @@ function featuresToNative(features) {
|
|
|
26
25
|
result.subscript = features.subscript;
|
|
27
26
|
if (features.wikilinks !== undefined)
|
|
28
27
|
result.wikilinks = features.wikilinks;
|
|
29
|
-
if (features.smartPunctuation !== undefined)
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
if (features.smartPunctuation !== undefined) {
|
|
29
|
+
if (typeof features.smartPunctuation === "object") {
|
|
30
|
+
result.smartPunctuationOptions = features.smartPunctuation;
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
result.smartPunctuation = features.smartPunctuation;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
33
36
|
return result;
|
|
34
37
|
}
|
|
35
38
|
function runMdastPluginsOnHandle(handle, plugins, filename) {
|
|
@@ -91,7 +94,8 @@ function mdxOptionsToNative(opts) {
|
|
|
91
94
|
opts.providerImportSource !== undefined ||
|
|
92
95
|
opts.pragma !== undefined ||
|
|
93
96
|
opts.pragmaFrag !== undefined ||
|
|
94
|
-
opts.pragmaImportSource !== undefined
|
|
97
|
+
opts.pragmaImportSource !== undefined ||
|
|
98
|
+
opts.outputFormat !== undefined;
|
|
95
99
|
if (!hasAny)
|
|
96
100
|
return undefined;
|
|
97
101
|
const result = {};
|
|
@@ -113,14 +117,15 @@ function mdxOptionsToNative(opts) {
|
|
|
113
117
|
result.pragmaFrag = opts.pragmaFrag;
|
|
114
118
|
if (opts.pragmaImportSource !== undefined)
|
|
115
119
|
result.pragmaImportSource = opts.pragmaImportSource;
|
|
120
|
+
if (opts.outputFormat !== undefined)
|
|
121
|
+
result.outputFormat = opts.outputFormat;
|
|
116
122
|
return result;
|
|
117
123
|
}
|
|
118
124
|
export function markdownToHtml(source, options = {}) {
|
|
119
125
|
const { mdastPlugins = [], hastPlugins = [], features, filename = "<unknown>" } = options;
|
|
120
126
|
const nativeFeatures = featuresToNative(features);
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
}
|
|
127
|
+
// TODO: When there's no plugins, we shouldn't go through all the steps below, we could just call parseToHtml directly.
|
|
128
|
+
// However right now pulldown-cmark's HTML output is super different from our target (unified's). So until that's fixed, we'll do the slower pipeline
|
|
124
129
|
const handleResult = createHastHandleFromMdast(source, mdastPlugins, false, filename, nativeFeatures);
|
|
125
130
|
const finish = (hastHandle) => {
|
|
126
131
|
const asyncResult = runHastPluginsOnHandle(hastHandle, hastPlugins, source, filename);
|
|
@@ -166,6 +171,26 @@ export function mdxToJs(source, options = {}) {
|
|
|
166
171
|
}
|
|
167
172
|
return finish(handleResult);
|
|
168
173
|
}
|
|
174
|
+
/**
|
|
175
|
+
* Compile and evaluate MDX in one step.
|
|
176
|
+
*
|
|
177
|
+
* Returns the module's exports, including `default` (the MDX component).
|
|
178
|
+
* Returns a Promise when async plugins are used, otherwise returns synchronously.
|
|
179
|
+
*
|
|
180
|
+
* ```ts
|
|
181
|
+
* import * as runtime from "react/jsx-runtime";
|
|
182
|
+
* const { default: Content } = evaluate("# Hello", { ...runtime });
|
|
183
|
+
* ```
|
|
184
|
+
*/
|
|
185
|
+
export function evaluate(source, options) {
|
|
186
|
+
const { Fragment, jsx, jsxs, jsxDEV, useMDXComponents, ...compileOpts } = options;
|
|
187
|
+
const runtime = { Fragment, jsx, jsxs, jsxDEV, useMDXComponents };
|
|
188
|
+
const code = mdxToJs(source, { ...compileOpts, outputFormat: "function-body" });
|
|
189
|
+
if (code instanceof Promise) {
|
|
190
|
+
return code.then((resolved) => new Function(resolved)(runtime));
|
|
191
|
+
}
|
|
192
|
+
return new Function(code)(runtime);
|
|
193
|
+
}
|
|
169
194
|
// Pipeline: parse → mdast plugins → hast conversion → hast plugins
|
|
170
195
|
// All arenas stay in Rust. No intermediate buffer copies to JS.
|
|
171
196
|
/** Parse + mdast plugins + convert to HAST handle. */
|
|
@@ -14,7 +14,7 @@ export declare const HAST_MDX_ESM = 13;
|
|
|
14
14
|
export declare const HAST_MDX_TEXT_EXPRESSION = 14;
|
|
15
15
|
export interface HastProperty {
|
|
16
16
|
name: string;
|
|
17
|
-
value: string | boolean | string[];
|
|
17
|
+
value: string | number | boolean | string[];
|
|
18
18
|
}
|
|
19
19
|
export declare class HastReader {
|
|
20
20
|
#private;
|
package/dist/hast/hast-reader.js
CHANGED
|
@@ -209,7 +209,7 @@ export class HastReader {
|
|
|
209
209
|
properties.push({ name, value: true });
|
|
210
210
|
break;
|
|
211
211
|
case PROP_BOOL_FALSE:
|
|
212
|
-
|
|
212
|
+
properties.push({ name, value: false });
|
|
213
213
|
break;
|
|
214
214
|
case PROP_STRING:
|
|
215
215
|
properties.push({ name, value: this.getString(valueRef.offset, valueRef.len) });
|
|
@@ -230,6 +230,12 @@ export class HastReader {
|
|
|
230
230
|
});
|
|
231
231
|
break;
|
|
232
232
|
}
|
|
233
|
+
case 5: {
|
|
234
|
+
// PROP_INT
|
|
235
|
+
const raw = this.getString(valueRef.offset, valueRef.len);
|
|
236
|
+
properties.push({ name, value: Number(raw) });
|
|
237
|
+
break;
|
|
238
|
+
}
|
|
233
239
|
}
|
|
234
240
|
}
|
|
235
241
|
return { tagName, properties };
|
|
@@ -195,6 +195,9 @@ function decodeProperties(view, buf, pos) {
|
|
|
195
195
|
case 3: // PROP_SPACE_SEP
|
|
196
196
|
properties[name] = valStr.split(" ").filter((s) => s.length > 0);
|
|
197
197
|
break;
|
|
198
|
+
case 5: // PROP_INT
|
|
199
|
+
properties[name] = Number(valStr);
|
|
200
|
+
break;
|
|
198
201
|
}
|
|
199
202
|
}
|
|
200
203
|
return properties;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { markdownToHtml, mdxToJs, markdownToMdast, mdxToMdast, markdownToHast, mdxToHast, } from "./compile.js";
|
|
2
|
-
export type { CompileOptions, MdxCompileOptions, OptimizeStaticConfig, Features, } from "./compile.js";
|
|
1
|
+
export { markdownToHtml, mdxToJs, evaluate, markdownToMdast, mdxToMdast, markdownToHast, mdxToHast, } from "./compile.js";
|
|
2
|
+
export type { CompileOptions, MdxCompileOptions, EvaluateOptions, OptimizeStaticConfig, Features, SmartPunctuationOptions, } from "./compile.js";
|
|
3
3
|
export { defineMdastPlugin, defineHastPlugin } from "./plugin.js";
|
|
4
4
|
export type { MdastPluginDefinition, HastPluginDefinition } from "./plugin.js";
|
|
5
5
|
export type { HastVisitorInstance, HastVisitorContext, HastFilteredVisitor, EstreeProgram, } from "./hast/hast-visitor.js";
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Public API: compile functions
|
|
2
|
-
export { markdownToHtml, mdxToJs, markdownToMdast, mdxToMdast, markdownToHast, mdxToHast, } from "./compile.js";
|
|
2
|
+
export { markdownToHtml, mdxToJs, evaluate, markdownToMdast, mdxToMdast, markdownToHast, mdxToHast, } from "./compile.js";
|
|
3
3
|
// Plugin definitions
|
|
4
4
|
export { defineMdastPlugin, defineHastPlugin } from "./plugin.js";
|
|
5
5
|
// Visitor pipeline (for manual plugin execution)
|
|
@@ -29,14 +29,19 @@ export const TYPE_NAMES = {
|
|
|
29
29
|
26: "toml",
|
|
30
30
|
27: "math",
|
|
31
31
|
28: "inlineMath",
|
|
32
|
+
30: "containerDirective",
|
|
33
|
+
31: "leafDirective",
|
|
34
|
+
32: "textDirective",
|
|
32
35
|
100: "mdxJsxFlowElement",
|
|
33
36
|
101: "mdxJsxTextElement",
|
|
34
37
|
102: "mdxFlowExpression",
|
|
35
38
|
103: "mdxTextExpression",
|
|
36
39
|
104: "mdxjsEsm",
|
|
37
40
|
};
|
|
38
|
-
// Leaf node types that do NOT have children
|
|
39
|
-
|
|
41
|
+
// Leaf node types that do NOT have children.
|
|
42
|
+
// Type 9 = `definition`; type 18 = `imageReference` — leaves per mdast spec
|
|
43
|
+
// (imageReference carries `alt` as a string, not children).
|
|
44
|
+
const LEAF_TYPES = new Set([9, 10, 13, 7, 8, 14, 3, 16, 18, 20, 25, 26, 27, 28, 102, 103, 104]);
|
|
40
45
|
/**
|
|
41
46
|
* Add type-specific lazy properties to a node object.
|
|
42
47
|
*/
|
|
@@ -52,7 +57,6 @@ function addTypeProperties(node, reader, nodeId, nodeType) {
|
|
|
52
57
|
case 7: // html
|
|
53
58
|
case 25: // yaml
|
|
54
59
|
case 26: // toml
|
|
55
|
-
case 28: // inlineMath
|
|
56
60
|
Object.defineProperties(node, {
|
|
57
61
|
value: lazyProp("value", () => reader.getTextValue(nodeId)),
|
|
58
62
|
});
|
|
@@ -63,6 +67,11 @@ function addTypeProperties(node, reader, nodeId, nodeType) {
|
|
|
63
67
|
case 27: // math
|
|
64
68
|
lazyGroup(node, ["meta", "value"], () => reader.getMathData(nodeId));
|
|
65
69
|
break;
|
|
70
|
+
case 28: // inlineMath
|
|
71
|
+
Object.defineProperties(node, {
|
|
72
|
+
value: lazyProp("value", () => reader.getMathData(nodeId).value),
|
|
73
|
+
});
|
|
74
|
+
break;
|
|
66
75
|
case 15: // link
|
|
67
76
|
lazyGroup(node, ["url", "title"], () => reader.getLinkData(nodeId));
|
|
68
77
|
break;
|
|
@@ -82,13 +91,17 @@ function addTypeProperties(node, reader, nodeId, nodeType) {
|
|
|
82
91
|
break;
|
|
83
92
|
}
|
|
84
93
|
case 6: // listItem
|
|
85
|
-
lazyGroup(node, ["
|
|
94
|
+
lazyGroup(node, ["spread", "checked"], () => reader.getListItemData(nodeId));
|
|
86
95
|
break;
|
|
87
96
|
case 17: // linkReference
|
|
88
|
-
case 18: // imageReference
|
|
89
|
-
case 20: // footnoteReference
|
|
90
97
|
lazyGroup(node, ["identifier", "label", "referenceType"], () => reader.getReferenceData(nodeId));
|
|
91
98
|
break;
|
|
99
|
+
case 20: // footnoteReference — no `referenceType` per mdast spec
|
|
100
|
+
lazyGroup(node, ["identifier", "label"], () => reader.getReferenceData(nodeId));
|
|
101
|
+
break;
|
|
102
|
+
case 18: // imageReference — leaf with alt (remark treats it as a void node)
|
|
103
|
+
lazyGroup(node, ["identifier", "label", "referenceType", "alt"], () => reader.getImageReferenceData(nodeId));
|
|
104
|
+
break;
|
|
92
105
|
case 19: // footnoteDefinition
|
|
93
106
|
lazyGroup(node, ["identifier", "label"], () => reader.getFootnoteDefinitionData(nodeId));
|
|
94
107
|
break;
|
|
@@ -97,6 +110,11 @@ function addTypeProperties(node, reader, nodeId, nodeType) {
|
|
|
97
110
|
align: lazyProp("align", () => reader.getTableAlign(nodeId)),
|
|
98
111
|
});
|
|
99
112
|
break;
|
|
113
|
+
case 30: // containerDirective
|
|
114
|
+
case 31: // leafDirective
|
|
115
|
+
case 32: // textDirective
|
|
116
|
+
lazyGroup(node, ["name", "attributes"], () => reader.getDirectiveData(nodeId));
|
|
117
|
+
break;
|
|
100
118
|
case 100: // mdxJsxFlowElement
|
|
101
119
|
case 101: // mdxJsxTextElement
|
|
102
120
|
lazyGroup(node, ["name", "attributes"], () => reader.getMdxJsxElementData(nodeId));
|
|
@@ -29,6 +29,9 @@ export declare const NodeType: Readonly<{
|
|
|
29
29
|
readonly Toml: 26;
|
|
30
30
|
readonly Math: 27;
|
|
31
31
|
readonly InlineMath: 28;
|
|
32
|
+
readonly ContainerDirective: 30;
|
|
33
|
+
readonly LeafDirective: 31;
|
|
34
|
+
readonly TextDirective: 32;
|
|
32
35
|
readonly MdxJsxFlowElement: 100;
|
|
33
36
|
readonly MdxJsxTextElement: 101;
|
|
34
37
|
readonly MdxFlowExpression: 102;
|
|
@@ -130,6 +133,17 @@ export declare class MdastReader {
|
|
|
130
133
|
label: string;
|
|
131
134
|
referenceType: string;
|
|
132
135
|
};
|
|
136
|
+
/**
|
|
137
|
+
* ImageReference layout: 20-byte ReferenceData header + 8-byte alt StringRef.
|
|
138
|
+
* Parser-emitted image references carry alt inline; plugin-created ones
|
|
139
|
+
* may lack this suffix, in which case `alt` is empty.
|
|
140
|
+
*/
|
|
141
|
+
getImageReferenceData(nodeId: number): {
|
|
142
|
+
identifier: string;
|
|
143
|
+
label: string;
|
|
144
|
+
referenceType: string;
|
|
145
|
+
alt: string;
|
|
146
|
+
};
|
|
133
147
|
/**
|
|
134
148
|
* FootnoteDefinitionData #[repr(C)]: identifier(0..8), label(8..16).
|
|
135
149
|
*/
|
|
@@ -160,6 +174,16 @@ export declare class MdastReader {
|
|
|
160
174
|
name: string | null;
|
|
161
175
|
attributes: MdxJsxAttributeUnion[];
|
|
162
176
|
};
|
|
177
|
+
/**
|
|
178
|
+
* DirectiveData layout:
|
|
179
|
+
* [name: StringRef(8B)][attr_count: u32(4B)][_pad: u32(4B)] = 16-byte header
|
|
180
|
+
* then attr_count × 16 bytes:
|
|
181
|
+
* [key: StringRef(8B)][value: StringRef(8B)]
|
|
182
|
+
*/
|
|
183
|
+
getDirectiveData(nodeId: number): {
|
|
184
|
+
name: string;
|
|
185
|
+
attributes: Record<string, string>;
|
|
186
|
+
};
|
|
163
187
|
/**
|
|
164
188
|
* ExpressionData #[repr(C)]: value StringRef (0..8).
|
|
165
189
|
* Valid for MdxFlowExpression, MdxTextExpression, MdxjsEsm.
|
|
@@ -29,6 +29,10 @@ export const NodeType = Object.freeze({
|
|
|
29
29
|
Toml: 26,
|
|
30
30
|
Math: 27,
|
|
31
31
|
InlineMath: 28,
|
|
32
|
+
// Directives
|
|
33
|
+
ContainerDirective: 30,
|
|
34
|
+
LeafDirective: 31,
|
|
35
|
+
TextDirective: 32,
|
|
32
36
|
// MDX
|
|
33
37
|
MdxJsxFlowElement: 100,
|
|
34
38
|
MdxJsxTextElement: 101,
|
|
@@ -347,6 +351,23 @@ export class MdastReader {
|
|
|
347
351
|
referenceType: referenceTypes[kindByte] ?? "shortcut",
|
|
348
352
|
};
|
|
349
353
|
}
|
|
354
|
+
/**
|
|
355
|
+
* ImageReference layout: 20-byte ReferenceData header + 8-byte alt StringRef.
|
|
356
|
+
* Parser-emitted image references carry alt inline; plugin-created ones
|
|
357
|
+
* may lack this suffix, in which case `alt` is empty.
|
|
358
|
+
*/
|
|
359
|
+
getImageReferenceData(nodeId) {
|
|
360
|
+
const base = this.getReferenceData(nodeId);
|
|
361
|
+
const data = this.getTypeData(nodeId);
|
|
362
|
+
if (data.length >= 28) {
|
|
363
|
+
const altRef = this.readStringRef(data, 20);
|
|
364
|
+
return {
|
|
365
|
+
...base,
|
|
366
|
+
alt: this.getString(altRef.offset, altRef.len),
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
return { ...base, alt: "" };
|
|
370
|
+
}
|
|
350
371
|
/**
|
|
351
372
|
* FootnoteDefinitionData #[repr(C)]: identifier(0..8), label(8..16).
|
|
352
373
|
*/
|
|
@@ -444,6 +465,32 @@ export class MdastReader {
|
|
|
444
465
|
}
|
|
445
466
|
return { name, attributes };
|
|
446
467
|
}
|
|
468
|
+
/**
|
|
469
|
+
* DirectiveData layout:
|
|
470
|
+
* [name: StringRef(8B)][attr_count: u32(4B)][_pad: u32(4B)] = 16-byte header
|
|
471
|
+
* then attr_count × 16 bytes:
|
|
472
|
+
* [key: StringRef(8B)][value: StringRef(8B)]
|
|
473
|
+
*/
|
|
474
|
+
getDirectiveData(nodeId) {
|
|
475
|
+
const data = this.getTypeData(nodeId);
|
|
476
|
+
if (data.length < 16) {
|
|
477
|
+
return { name: "", attributes: {} };
|
|
478
|
+
}
|
|
479
|
+
const nameRef = this.readStringRef(data, 0);
|
|
480
|
+
const name = this.getString(nameRef.offset, nameRef.len);
|
|
481
|
+
const view = new DataView(data.buffer, data.byteOffset + 8);
|
|
482
|
+
const attrCount = view.getUint32(0, true);
|
|
483
|
+
const attributes = {};
|
|
484
|
+
for (let i = 0; i < attrCount; i++) {
|
|
485
|
+
const base = 16 + i * 16;
|
|
486
|
+
const keyRef = this.readStringRef(data, base);
|
|
487
|
+
const valRef = this.readStringRef(data, base + 8);
|
|
488
|
+
const key = this.getString(keyRef.offset, keyRef.len);
|
|
489
|
+
const val = this.getString(valRef.offset, valRef.len);
|
|
490
|
+
attributes[key] = val;
|
|
491
|
+
}
|
|
492
|
+
return { name, attributes };
|
|
493
|
+
}
|
|
447
494
|
/**
|
|
448
495
|
* ExpressionData #[repr(C)]: value StringRef (0..8).
|
|
449
496
|
* Valid for MdxFlowExpression, MdxTextExpression, MdxjsEsm.
|
|
@@ -273,9 +273,8 @@ function readMdastMatchedNode(view, buf, dataOffset, nodeId, nodeType, resolver)
|
|
|
273
273
|
case 13:
|
|
274
274
|
case 7:
|
|
275
275
|
case 25:
|
|
276
|
-
case 26:
|
|
277
|
-
|
|
278
|
-
// text, inlineCode, html, yaml, toml, inlineMath
|
|
276
|
+
case 26: {
|
|
277
|
+
// text, inlineCode, html, yaml, toml
|
|
279
278
|
const vlen = ru32(view, pos);
|
|
280
279
|
node.value = rstr(buf, pos + 4, vlen);
|
|
281
280
|
break;
|
|
@@ -295,8 +294,9 @@ function readMdastMatchedNode(view, buf, dataOffset, nodeId, nodeType, resolver)
|
|
|
295
294
|
node.value = rstr(buf, pos, valLen);
|
|
296
295
|
break;
|
|
297
296
|
}
|
|
298
|
-
case 27:
|
|
299
|
-
|
|
297
|
+
case 27:
|
|
298
|
+
case 28: {
|
|
299
|
+
// math, inlineMath
|
|
300
300
|
const metaLen = ru16(view, pos);
|
|
301
301
|
pos += 2;
|
|
302
302
|
node.meta = metaLen > 0 ? rstr(buf, pos, metaLen) : null;
|
|
@@ -380,7 +380,11 @@ function readMdastMatchedNode(view, buf, dataOffset, nodeId, nodeType, resolver)
|
|
|
380
380
|
node.label = rstr(buf, pos, labelLen);
|
|
381
381
|
pos += labelLen;
|
|
382
382
|
const kind = buf[pos];
|
|
383
|
-
|
|
383
|
+
// Only link/image references carry `referenceType`; the mdast spec
|
|
384
|
+
// defines it for those two, not for `footnoteReference`.
|
|
385
|
+
if (nodeType !== 20) {
|
|
386
|
+
node.referenceType = ["shortcut", "collapsed", "full"][kind] ?? "shortcut";
|
|
387
|
+
}
|
|
384
388
|
break;
|
|
385
389
|
}
|
|
386
390
|
case 19: {
|
package/index.d.ts
CHANGED
|
@@ -50,10 +50,7 @@ export declare function getNodeData(handle: ArenaHandle, nodeId: number): string
|
|
|
50
50
|
|
|
51
51
|
/** Feature toggles for the Markdown/MDX parser, passed from JavaScript. */
|
|
52
52
|
export interface JsFeatures {
|
|
53
|
-
/**
|
|
54
|
-
* GFM: tables, footnotes, strikethrough, task lists, blockquote tags.
|
|
55
|
-
* Default: true.
|
|
56
|
-
*/
|
|
53
|
+
/** GFM: tables, footnotes, strikethrough, task lists. Default: true. */
|
|
57
54
|
gfm?: boolean
|
|
58
55
|
/** Frontmatter: YAML (`--- ... ---`) and TOML (`+++ ... +++`). Default: true. */
|
|
59
56
|
frontmatter?: boolean
|
|
@@ -69,10 +66,10 @@ export interface JsFeatures {
|
|
|
69
66
|
subscript?: boolean
|
|
70
67
|
/** Obsidian-style wikilinks (`[[link]]`). Default: false. */
|
|
71
68
|
wikilinks?: boolean
|
|
72
|
-
/** Smart punctuation
|
|
69
|
+
/** Smart punctuation: all categories on. Default: false. */
|
|
73
70
|
smartPunctuation?: boolean
|
|
74
|
-
/**
|
|
75
|
-
|
|
71
|
+
/** Granular smart-punctuation control (overrides `smart_punctuation`). */
|
|
72
|
+
smartPunctuationOptions?: JsSmartPunctuationOptions
|
|
76
73
|
}
|
|
77
74
|
|
|
78
75
|
/** MDX compile options passed from JavaScript. */
|
|
@@ -104,6 +101,8 @@ export interface JsMdxOptions {
|
|
|
104
101
|
pragmaFrag?: string
|
|
105
102
|
/** Where to import the pragma from in classic runtime (default: "react"). */
|
|
106
103
|
pragmaImportSource?: string
|
|
104
|
+
/** Output format: "program" (default) or "function-body". */
|
|
105
|
+
outputFormat?: string
|
|
107
106
|
}
|
|
108
107
|
|
|
109
108
|
/** Static optimization config passed from JavaScript. */
|
|
@@ -118,6 +117,16 @@ export interface JsOptimizeStaticConfig {
|
|
|
118
117
|
ignoreElements?: Array<string>
|
|
119
118
|
}
|
|
120
119
|
|
|
120
|
+
/** Granular smart-punctuation toggles. */
|
|
121
|
+
export interface JsSmartPunctuationOptions {
|
|
122
|
+
/** Replace straight quotes with curly/smart quotes. Default: true. */
|
|
123
|
+
quotes?: boolean
|
|
124
|
+
/** Replace `--`/`---` with en-dash/em-dash. Default: true. */
|
|
125
|
+
dashes?: boolean
|
|
126
|
+
/** Replace `...` with ellipsis (`…`). Default: true. */
|
|
127
|
+
ellipses?: boolean
|
|
128
|
+
}
|
|
129
|
+
|
|
121
130
|
/** A subscription passed from JS. */
|
|
122
131
|
export interface JsSubscription {
|
|
123
132
|
nodeType: number
|
|
@@ -147,10 +156,7 @@ export declare function parseEsm(source: string): string | null
|
|
|
147
156
|
*/
|
|
148
157
|
export declare function parseExpression(source: string): string | null
|
|
149
158
|
|
|
150
|
-
/**
|
|
151
|
-
* Parse Markdown source and return HTML string directly.
|
|
152
|
-
* Uses pulldown-cmark's streaming renderer, skipping the arena entirely.
|
|
153
|
-
*/
|
|
159
|
+
/** Parse Markdown source and return HTML string directly. */
|
|
154
160
|
export declare function parseToHtml(source: string, features?: JsFeatures | undefined | null): string
|
|
155
161
|
|
|
156
162
|
/** Render a handle's HAST arena to HTML. Does not consume the handle. */
|
package/index.js
CHANGED
|
@@ -81,8 +81,8 @@ function requireNative() {
|
|
|
81
81
|
try {
|
|
82
82
|
const binding = require('@bruits/satteri-android-arm64')
|
|
83
83
|
const bindingPackageVersion = require('@bruits/satteri-android-arm64/package.json').version
|
|
84
|
-
if (bindingPackageVersion !== '0.2.
|
|
85
|
-
throw new Error(`Native binding package version mismatch, expected 0.2.
|
|
84
|
+
if (bindingPackageVersion !== '0.2.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
85
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
86
86
|
}
|
|
87
87
|
return binding
|
|
88
88
|
} catch (e) {
|
|
@@ -97,8 +97,8 @@ function requireNative() {
|
|
|
97
97
|
try {
|
|
98
98
|
const binding = require('@bruits/satteri-android-arm-eabi')
|
|
99
99
|
const bindingPackageVersion = require('@bruits/satteri-android-arm-eabi/package.json').version
|
|
100
|
-
if (bindingPackageVersion !== '0.2.
|
|
101
|
-
throw new Error(`Native binding package version mismatch, expected 0.2.
|
|
100
|
+
if (bindingPackageVersion !== '0.2.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
101
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
102
102
|
}
|
|
103
103
|
return binding
|
|
104
104
|
} catch (e) {
|
|
@@ -118,8 +118,8 @@ function requireNative() {
|
|
|
118
118
|
try {
|
|
119
119
|
const binding = require('@bruits/satteri-win32-x64-gnu')
|
|
120
120
|
const bindingPackageVersion = require('@bruits/satteri-win32-x64-gnu/package.json').version
|
|
121
|
-
if (bindingPackageVersion !== '0.2.
|
|
122
|
-
throw new Error(`Native binding package version mismatch, expected 0.2.
|
|
121
|
+
if (bindingPackageVersion !== '0.2.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
122
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
123
123
|
}
|
|
124
124
|
return binding
|
|
125
125
|
} catch (e) {
|
|
@@ -134,8 +134,8 @@ function requireNative() {
|
|
|
134
134
|
try {
|
|
135
135
|
const binding = require('@bruits/satteri-win32-x64-msvc')
|
|
136
136
|
const bindingPackageVersion = require('@bruits/satteri-win32-x64-msvc/package.json').version
|
|
137
|
-
if (bindingPackageVersion !== '0.2.
|
|
138
|
-
throw new Error(`Native binding package version mismatch, expected 0.2.
|
|
137
|
+
if (bindingPackageVersion !== '0.2.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
138
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
139
139
|
}
|
|
140
140
|
return binding
|
|
141
141
|
} catch (e) {
|
|
@@ -151,8 +151,8 @@ function requireNative() {
|
|
|
151
151
|
try {
|
|
152
152
|
const binding = require('@bruits/satteri-win32-ia32-msvc')
|
|
153
153
|
const bindingPackageVersion = require('@bruits/satteri-win32-ia32-msvc/package.json').version
|
|
154
|
-
if (bindingPackageVersion !== '0.2.
|
|
155
|
-
throw new Error(`Native binding package version mismatch, expected 0.2.
|
|
154
|
+
if (bindingPackageVersion !== '0.2.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
155
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
156
156
|
}
|
|
157
157
|
return binding
|
|
158
158
|
} catch (e) {
|
|
@@ -167,8 +167,8 @@ function requireNative() {
|
|
|
167
167
|
try {
|
|
168
168
|
const binding = require('@bruits/satteri-win32-arm64-msvc')
|
|
169
169
|
const bindingPackageVersion = require('@bruits/satteri-win32-arm64-msvc/package.json').version
|
|
170
|
-
if (bindingPackageVersion !== '0.2.
|
|
171
|
-
throw new Error(`Native binding package version mismatch, expected 0.2.
|
|
170
|
+
if (bindingPackageVersion !== '0.2.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
171
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
172
172
|
}
|
|
173
173
|
return binding
|
|
174
174
|
} catch (e) {
|
|
@@ -186,8 +186,8 @@ function requireNative() {
|
|
|
186
186
|
try {
|
|
187
187
|
const binding = require('@bruits/satteri-darwin-universal')
|
|
188
188
|
const bindingPackageVersion = require('@bruits/satteri-darwin-universal/package.json').version
|
|
189
|
-
if (bindingPackageVersion !== '0.2.
|
|
190
|
-
throw new Error(`Native binding package version mismatch, expected 0.2.
|
|
189
|
+
if (bindingPackageVersion !== '0.2.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
190
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
191
191
|
}
|
|
192
192
|
return binding
|
|
193
193
|
} catch (e) {
|
|
@@ -202,8 +202,8 @@ function requireNative() {
|
|
|
202
202
|
try {
|
|
203
203
|
const binding = require('@bruits/satteri-darwin-x64')
|
|
204
204
|
const bindingPackageVersion = require('@bruits/satteri-darwin-x64/package.json').version
|
|
205
|
-
if (bindingPackageVersion !== '0.2.
|
|
206
|
-
throw new Error(`Native binding package version mismatch, expected 0.2.
|
|
205
|
+
if (bindingPackageVersion !== '0.2.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
206
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
207
207
|
}
|
|
208
208
|
return binding
|
|
209
209
|
} catch (e) {
|
|
@@ -218,8 +218,8 @@ function requireNative() {
|
|
|
218
218
|
try {
|
|
219
219
|
const binding = require('@bruits/satteri-darwin-arm64')
|
|
220
220
|
const bindingPackageVersion = require('@bruits/satteri-darwin-arm64/package.json').version
|
|
221
|
-
if (bindingPackageVersion !== '0.2.
|
|
222
|
-
throw new Error(`Native binding package version mismatch, expected 0.2.
|
|
221
|
+
if (bindingPackageVersion !== '0.2.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
222
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
223
223
|
}
|
|
224
224
|
return binding
|
|
225
225
|
} catch (e) {
|
|
@@ -238,8 +238,8 @@ function requireNative() {
|
|
|
238
238
|
try {
|
|
239
239
|
const binding = require('@bruits/satteri-freebsd-x64')
|
|
240
240
|
const bindingPackageVersion = require('@bruits/satteri-freebsd-x64/package.json').version
|
|
241
|
-
if (bindingPackageVersion !== '0.2.
|
|
242
|
-
throw new Error(`Native binding package version mismatch, expected 0.2.
|
|
241
|
+
if (bindingPackageVersion !== '0.2.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
242
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
243
243
|
}
|
|
244
244
|
return binding
|
|
245
245
|
} catch (e) {
|
|
@@ -254,8 +254,8 @@ function requireNative() {
|
|
|
254
254
|
try {
|
|
255
255
|
const binding = require('@bruits/satteri-freebsd-arm64')
|
|
256
256
|
const bindingPackageVersion = require('@bruits/satteri-freebsd-arm64/package.json').version
|
|
257
|
-
if (bindingPackageVersion !== '0.2.
|
|
258
|
-
throw new Error(`Native binding package version mismatch, expected 0.2.
|
|
257
|
+
if (bindingPackageVersion !== '0.2.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
258
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
259
259
|
}
|
|
260
260
|
return binding
|
|
261
261
|
} catch (e) {
|
|
@@ -275,8 +275,8 @@ function requireNative() {
|
|
|
275
275
|
try {
|
|
276
276
|
const binding = require('@bruits/satteri-linux-x64-musl')
|
|
277
277
|
const bindingPackageVersion = require('@bruits/satteri-linux-x64-musl/package.json').version
|
|
278
|
-
if (bindingPackageVersion !== '0.2.
|
|
279
|
-
throw new Error(`Native binding package version mismatch, expected 0.2.
|
|
278
|
+
if (bindingPackageVersion !== '0.2.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
279
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
280
280
|
}
|
|
281
281
|
return binding
|
|
282
282
|
} catch (e) {
|
|
@@ -291,8 +291,8 @@ function requireNative() {
|
|
|
291
291
|
try {
|
|
292
292
|
const binding = require('@bruits/satteri-linux-x64-gnu')
|
|
293
293
|
const bindingPackageVersion = require('@bruits/satteri-linux-x64-gnu/package.json').version
|
|
294
|
-
if (bindingPackageVersion !== '0.2.
|
|
295
|
-
throw new Error(`Native binding package version mismatch, expected 0.2.
|
|
294
|
+
if (bindingPackageVersion !== '0.2.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
295
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
296
296
|
}
|
|
297
297
|
return binding
|
|
298
298
|
} catch (e) {
|
|
@@ -309,8 +309,8 @@ function requireNative() {
|
|
|
309
309
|
try {
|
|
310
310
|
const binding = require('@bruits/satteri-linux-arm64-musl')
|
|
311
311
|
const bindingPackageVersion = require('@bruits/satteri-linux-arm64-musl/package.json').version
|
|
312
|
-
if (bindingPackageVersion !== '0.2.
|
|
313
|
-
throw new Error(`Native binding package version mismatch, expected 0.2.
|
|
312
|
+
if (bindingPackageVersion !== '0.2.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
313
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
314
314
|
}
|
|
315
315
|
return binding
|
|
316
316
|
} catch (e) {
|
|
@@ -325,8 +325,8 @@ function requireNative() {
|
|
|
325
325
|
try {
|
|
326
326
|
const binding = require('@bruits/satteri-linux-arm64-gnu')
|
|
327
327
|
const bindingPackageVersion = require('@bruits/satteri-linux-arm64-gnu/package.json').version
|
|
328
|
-
if (bindingPackageVersion !== '0.2.
|
|
329
|
-
throw new Error(`Native binding package version mismatch, expected 0.2.
|
|
328
|
+
if (bindingPackageVersion !== '0.2.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
329
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
330
330
|
}
|
|
331
331
|
return binding
|
|
332
332
|
} catch (e) {
|
|
@@ -343,8 +343,8 @@ function requireNative() {
|
|
|
343
343
|
try {
|
|
344
344
|
const binding = require('@bruits/satteri-linux-arm-musleabihf')
|
|
345
345
|
const bindingPackageVersion = require('@bruits/satteri-linux-arm-musleabihf/package.json').version
|
|
346
|
-
if (bindingPackageVersion !== '0.2.
|
|
347
|
-
throw new Error(`Native binding package version mismatch, expected 0.2.
|
|
346
|
+
if (bindingPackageVersion !== '0.2.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
347
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
348
348
|
}
|
|
349
349
|
return binding
|
|
350
350
|
} catch (e) {
|
|
@@ -359,8 +359,8 @@ function requireNative() {
|
|
|
359
359
|
try {
|
|
360
360
|
const binding = require('@bruits/satteri-linux-arm-gnueabihf')
|
|
361
361
|
const bindingPackageVersion = require('@bruits/satteri-linux-arm-gnueabihf/package.json').version
|
|
362
|
-
if (bindingPackageVersion !== '0.2.
|
|
363
|
-
throw new Error(`Native binding package version mismatch, expected 0.2.
|
|
362
|
+
if (bindingPackageVersion !== '0.2.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
363
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
364
364
|
}
|
|
365
365
|
return binding
|
|
366
366
|
} catch (e) {
|
|
@@ -377,8 +377,8 @@ function requireNative() {
|
|
|
377
377
|
try {
|
|
378
378
|
const binding = require('@bruits/satteri-linux-loong64-musl')
|
|
379
379
|
const bindingPackageVersion = require('@bruits/satteri-linux-loong64-musl/package.json').version
|
|
380
|
-
if (bindingPackageVersion !== '0.2.
|
|
381
|
-
throw new Error(`Native binding package version mismatch, expected 0.2.
|
|
380
|
+
if (bindingPackageVersion !== '0.2.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
381
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
382
382
|
}
|
|
383
383
|
return binding
|
|
384
384
|
} catch (e) {
|
|
@@ -393,8 +393,8 @@ function requireNative() {
|
|
|
393
393
|
try {
|
|
394
394
|
const binding = require('@bruits/satteri-linux-loong64-gnu')
|
|
395
395
|
const bindingPackageVersion = require('@bruits/satteri-linux-loong64-gnu/package.json').version
|
|
396
|
-
if (bindingPackageVersion !== '0.2.
|
|
397
|
-
throw new Error(`Native binding package version mismatch, expected 0.2.
|
|
396
|
+
if (bindingPackageVersion !== '0.2.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
397
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
398
398
|
}
|
|
399
399
|
return binding
|
|
400
400
|
} catch (e) {
|
|
@@ -411,8 +411,8 @@ function requireNative() {
|
|
|
411
411
|
try {
|
|
412
412
|
const binding = require('@bruits/satteri-linux-riscv64-musl')
|
|
413
413
|
const bindingPackageVersion = require('@bruits/satteri-linux-riscv64-musl/package.json').version
|
|
414
|
-
if (bindingPackageVersion !== '0.2.
|
|
415
|
-
throw new Error(`Native binding package version mismatch, expected 0.2.
|
|
414
|
+
if (bindingPackageVersion !== '0.2.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
415
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
416
416
|
}
|
|
417
417
|
return binding
|
|
418
418
|
} catch (e) {
|
|
@@ -427,8 +427,8 @@ function requireNative() {
|
|
|
427
427
|
try {
|
|
428
428
|
const binding = require('@bruits/satteri-linux-riscv64-gnu')
|
|
429
429
|
const bindingPackageVersion = require('@bruits/satteri-linux-riscv64-gnu/package.json').version
|
|
430
|
-
if (bindingPackageVersion !== '0.2.
|
|
431
|
-
throw new Error(`Native binding package version mismatch, expected 0.2.
|
|
430
|
+
if (bindingPackageVersion !== '0.2.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
431
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
432
432
|
}
|
|
433
433
|
return binding
|
|
434
434
|
} catch (e) {
|
|
@@ -444,8 +444,8 @@ function requireNative() {
|
|
|
444
444
|
try {
|
|
445
445
|
const binding = require('@bruits/satteri-linux-ppc64-gnu')
|
|
446
446
|
const bindingPackageVersion = require('@bruits/satteri-linux-ppc64-gnu/package.json').version
|
|
447
|
-
if (bindingPackageVersion !== '0.2.
|
|
448
|
-
throw new Error(`Native binding package version mismatch, expected 0.2.
|
|
447
|
+
if (bindingPackageVersion !== '0.2.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
448
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
449
449
|
}
|
|
450
450
|
return binding
|
|
451
451
|
} catch (e) {
|
|
@@ -460,8 +460,8 @@ function requireNative() {
|
|
|
460
460
|
try {
|
|
461
461
|
const binding = require('@bruits/satteri-linux-s390x-gnu')
|
|
462
462
|
const bindingPackageVersion = require('@bruits/satteri-linux-s390x-gnu/package.json').version
|
|
463
|
-
if (bindingPackageVersion !== '0.2.
|
|
464
|
-
throw new Error(`Native binding package version mismatch, expected 0.2.
|
|
463
|
+
if (bindingPackageVersion !== '0.2.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
464
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
465
465
|
}
|
|
466
466
|
return binding
|
|
467
467
|
} catch (e) {
|
|
@@ -480,8 +480,8 @@ function requireNative() {
|
|
|
480
480
|
try {
|
|
481
481
|
const binding = require('@bruits/satteri-openharmony-arm64')
|
|
482
482
|
const bindingPackageVersion = require('@bruits/satteri-openharmony-arm64/package.json').version
|
|
483
|
-
if (bindingPackageVersion !== '0.2.
|
|
484
|
-
throw new Error(`Native binding package version mismatch, expected 0.2.
|
|
483
|
+
if (bindingPackageVersion !== '0.2.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
484
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
485
485
|
}
|
|
486
486
|
return binding
|
|
487
487
|
} catch (e) {
|
|
@@ -496,8 +496,8 @@ function requireNative() {
|
|
|
496
496
|
try {
|
|
497
497
|
const binding = require('@bruits/satteri-openharmony-x64')
|
|
498
498
|
const bindingPackageVersion = require('@bruits/satteri-openharmony-x64/package.json').version
|
|
499
|
-
if (bindingPackageVersion !== '0.2.
|
|
500
|
-
throw new Error(`Native binding package version mismatch, expected 0.2.
|
|
499
|
+
if (bindingPackageVersion !== '0.2.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
500
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
501
501
|
}
|
|
502
502
|
return binding
|
|
503
503
|
} catch (e) {
|
|
@@ -512,8 +512,8 @@ function requireNative() {
|
|
|
512
512
|
try {
|
|
513
513
|
const binding = require('@bruits/satteri-openharmony-arm')
|
|
514
514
|
const bindingPackageVersion = require('@bruits/satteri-openharmony-arm/package.json').version
|
|
515
|
-
if (bindingPackageVersion !== '0.2.
|
|
516
|
-
throw new Error(`Native binding package version mismatch, expected 0.2.
|
|
515
|
+
if (bindingPackageVersion !== '0.2.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
516
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
517
517
|
}
|
|
518
518
|
return binding
|
|
519
519
|
} catch (e) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "satteri",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7",
|
|
4
4
|
"description": "High-performance Markdown and MDX processing",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -42,9 +42,27 @@
|
|
|
42
42
|
"@codspeed/vitest-plugin": "^5.2.0",
|
|
43
43
|
"@emnapi/core": "^1.9.1",
|
|
44
44
|
"@emnapi/runtime": "^1.9.1",
|
|
45
|
+
"@mdx-js/mdx": "^3.1.1",
|
|
45
46
|
"@napi-rs/wasm-runtime": "^1.1.2",
|
|
46
47
|
"@types/node": "^25.5.0",
|
|
48
|
+
"@types/react": "^19.2.14",
|
|
49
|
+
"@types/react-dom": "^19.2.3",
|
|
50
|
+
"fast-check": "^4.7.0",
|
|
51
|
+
"mdast-util-mdx": "^3.0.0",
|
|
52
|
+
"mdast-util-to-hast": "^13.2.1",
|
|
53
|
+
"react": "^19.2.5",
|
|
54
|
+
"react-dom": "^19.2.5",
|
|
55
|
+
"rehype-stringify": "^10.0.1",
|
|
56
|
+
"remark": "^15.0.1",
|
|
57
|
+
"remark-directive": "^4.0.0",
|
|
58
|
+
"remark-frontmatter": "^5.0.0",
|
|
59
|
+
"remark-gfm": "^4.0.1",
|
|
60
|
+
"remark-math": "^6.0.0",
|
|
61
|
+
"remark-mdx": "^3.1.1",
|
|
62
|
+
"remark-parse": "^11.0.0",
|
|
63
|
+
"remark-rehype": "^11.1.2",
|
|
47
64
|
"shiki": "^4.0.2",
|
|
65
|
+
"unified": "^11.0.5",
|
|
48
66
|
"vitest": "^4"
|
|
49
67
|
},
|
|
50
68
|
"napi": {
|
|
@@ -59,11 +77,11 @@
|
|
|
59
77
|
]
|
|
60
78
|
},
|
|
61
79
|
"optionalDependencies": {
|
|
62
|
-
"@bruits/satteri-linux-x64-gnu": "0.2.
|
|
63
|
-
"@bruits/satteri-darwin-x64": "0.2.
|
|
64
|
-
"@bruits/satteri-darwin-arm64": "0.2.
|
|
65
|
-
"@bruits/satteri-win32-x64-msvc": "0.2.
|
|
66
|
-
"@bruits/satteri-wasm32-wasi": "0.2.
|
|
80
|
+
"@bruits/satteri-linux-x64-gnu": "0.2.7",
|
|
81
|
+
"@bruits/satteri-darwin-x64": "0.2.7",
|
|
82
|
+
"@bruits/satteri-darwin-arm64": "0.2.7",
|
|
83
|
+
"@bruits/satteri-win32-x64-msvc": "0.2.7",
|
|
84
|
+
"@bruits/satteri-wasm32-wasi": "0.2.7"
|
|
67
85
|
},
|
|
68
86
|
"scripts": {
|
|
69
87
|
"build:wasm": "napi build --manifest-path ../../crates/satteri-napi-binding/Cargo.toml --output-dir . --platform --release --esm --strip --target wasm32-wasip1-threads",
|