satteri 0.7.0 → 0.8.1
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.d.ts +2 -0
- package/dist/command-buffer.js +5 -0
- package/dist/compile.d.ts +2 -2
- package/dist/compile.js +12 -4
- package/dist/hast/hast-visitor.d.ts +17 -6
- package/dist/hast/hast-visitor.js +55 -8
- package/dist/mdast/mdast-visitor.d.ts +12 -4
- package/dist/mdast/mdast-visitor.js +52 -4
- package/index.d.ts +9 -4
- package/index.js +52 -52
- package/package.json +6 -6
package/dist/command-buffer.d.ts
CHANGED
|
@@ -52,6 +52,8 @@ export declare class CommandBuffer {
|
|
|
52
52
|
}): void;
|
|
53
53
|
/** Write a REPLACE command with a pre-serialized JSON payload. */
|
|
54
54
|
replaceRawJson(nodeId: number, json: string): void;
|
|
55
|
+
/** Replace a node's child list (Root-wrapped `json`) while keeping the node. */
|
|
56
|
+
setChildren(nodeId: number, json: string): void;
|
|
55
57
|
/** Write any structural command with a pre-serialized JSON payload. */
|
|
56
58
|
insertBeforeRawJson(nodeId: number, json: string): void;
|
|
57
59
|
insertAfterRawJson(nodeId: number, json: string): void;
|
package/dist/command-buffer.js
CHANGED
|
@@ -17,6 +17,7 @@ const CMD_APPEND_CHILD = 0x08;
|
|
|
17
17
|
const CMD_WRAP = 0x09;
|
|
18
18
|
const CMD_REPLACE = 0x0b;
|
|
19
19
|
const CMD_SET_PROPERTY = 0x0c;
|
|
20
|
+
const CMD_SET_CHILDREN = 0x0d;
|
|
20
21
|
// Payload types (0x10+, distinct range from commands)
|
|
21
22
|
const PAYLOAD_RAW_MARKDOWN = 0x10;
|
|
22
23
|
const PAYLOAD_RAW_HTML = 0x11;
|
|
@@ -119,6 +120,10 @@ export class CommandBuffer {
|
|
|
119
120
|
replaceRawJson(nodeId, json) {
|
|
120
121
|
this.writeRawJsonCommand(CMD_REPLACE, nodeId, json);
|
|
121
122
|
}
|
|
123
|
+
/** Replace a node's child list (Root-wrapped `json`) while keeping the node. */
|
|
124
|
+
setChildren(nodeId, json) {
|
|
125
|
+
this.writeRawJsonCommand(CMD_SET_CHILDREN, nodeId, json);
|
|
126
|
+
}
|
|
122
127
|
/** Write any structural command with a pre-serialized JSON payload. */
|
|
123
128
|
insertBeforeRawJson(nodeId, json) {
|
|
124
129
|
this.writeRawJsonCommand(CMD_INSERT_BEFORE, nodeId, json);
|
package/dist/compile.d.ts
CHANGED
|
@@ -92,7 +92,7 @@ export interface Features {
|
|
|
92
92
|
/** Frontmatter: YAML (`--- ... ---`) and TOML (`+++ ... +++`). Default: true. */
|
|
93
93
|
frontmatter?: boolean;
|
|
94
94
|
/**
|
|
95
|
-
* Math blocks and inline math. Default:
|
|
95
|
+
* Math blocks and inline math. Default: false.
|
|
96
96
|
*
|
|
97
97
|
* Pass an options object for granular control:
|
|
98
98
|
* ```ts
|
|
@@ -100,7 +100,7 @@ export interface Features {
|
|
|
100
100
|
* ```
|
|
101
101
|
*/
|
|
102
102
|
math?: boolean | MathOptions;
|
|
103
|
-
/** Heading attributes (`# text { #id .class }`). Default:
|
|
103
|
+
/** Heading attributes (`# text { #id .class }`). Default: false. */
|
|
104
104
|
headingAttributes?: boolean;
|
|
105
105
|
/** Colon-delimited container directive blocks (`:::`). Default: false. */
|
|
106
106
|
directive?: boolean;
|
package/dist/compile.js
CHANGED
|
@@ -74,10 +74,10 @@ function featuresToNative(features) {
|
|
|
74
74
|
}
|
|
75
75
|
return { features: result, convertOptions };
|
|
76
76
|
}
|
|
77
|
-
function warnDroppedTransforms(plugin, dropped) {
|
|
77
|
+
function warnDroppedTransforms(plugin, dropped, kind) {
|
|
78
78
|
const name = plugin.name ?? "<anonymous>";
|
|
79
79
|
const noun = dropped === 1 ? "transform" : "transforms";
|
|
80
|
-
console.warn(`satteri: plugin "${name}" queued ${dropped}
|
|
80
|
+
console.warn(`satteri: plugin "${name}" queued ${dropped} ${kind} ${noun} on node(s) that were removed or ` +
|
|
81
81
|
`replaced earlier in the same pass; ${dropped === 1 ? "it was" : "they were"} dropped.`);
|
|
82
82
|
}
|
|
83
83
|
function runMdastPluginsOnHandle(handle, plugins, fileURL) {
|
|
@@ -94,7 +94,7 @@ function runMdastPluginsOnHandle(handle, plugins, fileURL) {
|
|
|
94
94
|
return;
|
|
95
95
|
const dropped = applyCommandsToMdastHandle(handle, r.commandBuffer);
|
|
96
96
|
if (dropped)
|
|
97
|
-
warnDroppedTransforms(plugin, dropped);
|
|
97
|
+
warnDroppedTransforms(plugin, dropped, "mdast");
|
|
98
98
|
};
|
|
99
99
|
return result instanceof Promise ? result.then(apply) : apply(result);
|
|
100
100
|
};
|
|
@@ -122,9 +122,17 @@ function runHastPluginsOnHandle(handle, plugins, source, fileURL) {
|
|
|
122
122
|
const plugin = typeof raw === "function" ? raw() : raw;
|
|
123
123
|
const subs = resolveSubscriptions(plugin);
|
|
124
124
|
const result = visitHastHandle(handle, plugin, subs, source, fileURL);
|
|
125
|
+
const warnIfDropped = (dropped) => {
|
|
126
|
+
if (dropped)
|
|
127
|
+
warnDroppedTransforms(plugin, dropped, "hast");
|
|
128
|
+
};
|
|
125
129
|
if (result instanceof Promise) {
|
|
126
|
-
return result.then(
|
|
130
|
+
return result.then((dropped) => {
|
|
131
|
+
warnIfDropped(dropped);
|
|
132
|
+
return runNext();
|
|
133
|
+
});
|
|
127
134
|
}
|
|
135
|
+
warnIfDropped(result);
|
|
128
136
|
}
|
|
129
137
|
};
|
|
130
138
|
return runNext();
|
|
@@ -23,11 +23,20 @@ export interface HastVisitorContext {
|
|
|
23
23
|
readonly fileURL: URL | undefined;
|
|
24
24
|
removeNode(node: Readonly<HastNode>): void;
|
|
25
25
|
replaceNode(node: Readonly<HastNode>, newNode: HastNode): void;
|
|
26
|
-
insertBefore(node: Readonly<HastNode>, newNode: HastNode): void;
|
|
27
|
-
insertAfter(node: Readonly<HastNode>, newNode: HastNode): void;
|
|
26
|
+
insertBefore(node: Readonly<HastNode>, newNode: HastNode | HastNode[]): void;
|
|
27
|
+
insertAfter(node: Readonly<HastNode>, newNode: HastNode | HastNode[]): void;
|
|
28
|
+
/**
|
|
29
|
+
* Wrap `node` in `parentNode`, making it `parentNode`'s first child. Any
|
|
30
|
+
* children `parentNode` declares are kept after it, so a `div` with an anchor
|
|
31
|
+
* child wraps a heading as `div > [heading, anchor]`.
|
|
32
|
+
*/
|
|
28
33
|
wrapNode(node: Readonly<HastNode>, parentNode: HastNode): void;
|
|
29
|
-
prependChild(node: Readonly<HastNode>, childNode: HastNode): void;
|
|
30
|
-
appendChild(node: Readonly<HastNode>, childNode: HastNode): void;
|
|
34
|
+
prependChild(node: Readonly<HastNode>, childNode: HastNode | HastNode[]): void;
|
|
35
|
+
appendChild(node: Readonly<HastNode>, childNode: HastNode | HastNode[]): void;
|
|
36
|
+
/** Insert one node or an array at `index`; clamps (`0` or less prepends, past the end appends). */
|
|
37
|
+
insertChildAt(node: Readonly<HastNode>, index: number, childNode: HastNode | HastNode[]): void;
|
|
38
|
+
/** Remove the `index`-th child of `node`; a no-op when there is no such child. */
|
|
39
|
+
removeChildAt(node: Readonly<HastNode>, index: number): void;
|
|
31
40
|
setProperty(node: Readonly<HastNode>, key: string, value: unknown): void;
|
|
32
41
|
/** Collect the concatenated text of all descendant text nodes (like DOM textContent). */
|
|
33
42
|
textContent(node: Readonly<HastNode>): string;
|
|
@@ -73,7 +82,9 @@ export declare function resolveSubscriptions(plugin: HastVisitorInstance): Resol
|
|
|
73
82
|
* Walk a handle's arena in Rust, dispatch matched nodes to JS visitor functions,
|
|
74
83
|
* and apply mutations back to the handle. No arena buffers cross NAPI.
|
|
75
84
|
*
|
|
76
|
-
* Returns
|
|
85
|
+
* Returns the number of patches dropped because their target was removed or
|
|
86
|
+
* replaced earlier in the same pass (the caller warns when non-zero), or a
|
|
87
|
+
* Promise of that count if any visitor is async.
|
|
77
88
|
*/
|
|
78
|
-
export declare function visitHastHandle(handle: HastHandle, plugin: HastVisitorInstance, subs: ResolvedSubscription[], source: string | (() => string), fileURL: URL | undefined):
|
|
89
|
+
export declare function visitHastHandle(handle: HastHandle, plugin: HastVisitorInstance, subs: ResolvedSubscription[], source: string | (() => string), fileURL: URL | undefined): number | Promise<number>;
|
|
79
90
|
export {};
|
|
@@ -58,6 +58,9 @@ function markHastNode(node, isRoot) {
|
|
|
58
58
|
function nid(node) {
|
|
59
59
|
return nodeIdMap.get(node) ?? node._nodeId;
|
|
60
60
|
}
|
|
61
|
+
function asArray(value) {
|
|
62
|
+
return Array.isArray(value) ? value : [value];
|
|
63
|
+
}
|
|
61
64
|
class HastVisitorContextImpl {
|
|
62
65
|
#commandBuffer = new CommandBuffer();
|
|
63
66
|
#diagnostics = [];
|
|
@@ -85,22 +88,62 @@ class HastVisitorContextImpl {
|
|
|
85
88
|
this.#pendingNodes.set(id, newNode);
|
|
86
89
|
}
|
|
87
90
|
insertBefore(node, newNode) {
|
|
88
|
-
|
|
91
|
+
const id = nid(node);
|
|
92
|
+
for (const n of asArray(newNode)) {
|
|
93
|
+
this.#commandBuffer.insertBeforeRawJson(id, JSON.stringify(markHast(n)));
|
|
94
|
+
}
|
|
89
95
|
}
|
|
90
96
|
insertAfter(node, newNode) {
|
|
91
|
-
|
|
97
|
+
const id = nid(node);
|
|
98
|
+
for (const n of asArray(newNode)) {
|
|
99
|
+
this.#commandBuffer.insertAfterRawJson(id, JSON.stringify(markHast(n)));
|
|
100
|
+
}
|
|
92
101
|
}
|
|
93
102
|
wrapNode(node, parentNode) {
|
|
94
103
|
this.#commandBuffer.wrapNodeRawJson(nid(node), JSON.stringify(markHast(parentNode)));
|
|
95
104
|
}
|
|
96
105
|
prependChild(node, childNode) {
|
|
97
|
-
|
|
106
|
+
const id = nid(node);
|
|
107
|
+
for (const n of asArray(childNode)) {
|
|
108
|
+
this.#commandBuffer.prependChildRawJson(id, JSON.stringify(markHast(n)));
|
|
109
|
+
}
|
|
98
110
|
}
|
|
99
111
|
appendChild(node, childNode) {
|
|
100
|
-
|
|
112
|
+
const id = nid(node);
|
|
113
|
+
for (const n of asArray(childNode)) {
|
|
114
|
+
this.#commandBuffer.appendChildRawJson(id, JSON.stringify(markHast(n)));
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
insertChildAt(node, index, childNode) {
|
|
118
|
+
const children = "children" in node ? node.children : [];
|
|
119
|
+
if (index <= 0 || children.length === 0) {
|
|
120
|
+
this.prependChild(node, childNode);
|
|
121
|
+
}
|
|
122
|
+
else if (index >= children.length) {
|
|
123
|
+
this.appendChild(node, childNode);
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
this.insertBefore(children[index], childNode);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
removeChildAt(node, index) {
|
|
130
|
+
const child = "children" in node ? node.children[index] : undefined;
|
|
131
|
+
if (child)
|
|
132
|
+
this.removeNode(child);
|
|
101
133
|
}
|
|
102
134
|
setProperty(node, key, value) {
|
|
103
135
|
const id = nid(node);
|
|
136
|
+
if (key === "children") {
|
|
137
|
+
// children is structural: set-children keeps the node and swaps only its
|
|
138
|
+
// child list (reused children keep their id).
|
|
139
|
+
const wrapper = {
|
|
140
|
+
_hast: true,
|
|
141
|
+
type: "root",
|
|
142
|
+
children: value.map((child) => markHastNode(child, false)),
|
|
143
|
+
};
|
|
144
|
+
this.#commandBuffer.setChildren(id, JSON.stringify(wrapper));
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
104
147
|
if (key === "data") {
|
|
105
148
|
this.#commandBuffer.setProperty(id, key, value != null ? JSON.stringify(value) : null);
|
|
106
149
|
return;
|
|
@@ -556,7 +599,9 @@ function mergeAndReset(returnBuffer, ctx) {
|
|
|
556
599
|
* Walk a handle's arena in Rust, dispatch matched nodes to JS visitor functions,
|
|
557
600
|
* and apply mutations back to the handle. No arena buffers cross NAPI.
|
|
558
601
|
*
|
|
559
|
-
* Returns
|
|
602
|
+
* Returns the number of patches dropped because their target was removed or
|
|
603
|
+
* replaced earlier in the same pass (the caller warns when non-zero), or a
|
|
604
|
+
* Promise of that count if any visitor is async.
|
|
560
605
|
*/
|
|
561
606
|
export function visitHastHandle(handle, plugin, subs, source, fileURL) {
|
|
562
607
|
const getSource = typeof source === "function" ? source : () => source;
|
|
@@ -572,14 +617,16 @@ export function visitHastHandle(handle, plugin, subs, source, fileURL) {
|
|
|
572
617
|
returnBuffer.replaceRawJson(nodeId, JSON.stringify(markHast(result)));
|
|
573
618
|
}
|
|
574
619
|
}
|
|
575
|
-
applyMutations(handle, returnBuffer, ctx);
|
|
620
|
+
return applyMutations(handle, returnBuffer, ctx);
|
|
576
621
|
});
|
|
577
622
|
}
|
|
578
|
-
applyMutations(handle, returnBuffer, ctx);
|
|
623
|
+
return applyMutations(handle, returnBuffer, ctx);
|
|
579
624
|
}
|
|
625
|
+
/** Returns the number of patches dropped as stranded (0 when none). */
|
|
580
626
|
function applyMutations(handle, returnBuffer, ctx) {
|
|
581
627
|
const { merged, hasMutations } = mergeAndReset(returnBuffer, ctx);
|
|
582
628
|
if (hasMutations) {
|
|
583
|
-
applyCommandsToHandle(handle, merged);
|
|
629
|
+
return applyCommandsToHandle(handle, merged);
|
|
584
630
|
}
|
|
631
|
+
return 0;
|
|
585
632
|
}
|
|
@@ -22,11 +22,19 @@ export declare class MdastVisitorContext {
|
|
|
22
22
|
constructor(handle: MdastHandle, getSource: () => string, fileURL: URL | undefined);
|
|
23
23
|
get source(): string;
|
|
24
24
|
removeNode(node: Readonly<MdastNode>): void;
|
|
25
|
-
insertBefore(node: Readonly<MdastNode>, newNode: MdastNode): void;
|
|
26
|
-
insertAfter(node: Readonly<MdastNode>, newNode: MdastNode): void;
|
|
25
|
+
insertBefore(node: Readonly<MdastNode>, newNode: MdastNode | MdastNode[]): void;
|
|
26
|
+
insertAfter(node: Readonly<MdastNode>, newNode: MdastNode | MdastNode[]): void;
|
|
27
|
+
/**
|
|
28
|
+
* Wrap `node` in `parentNode`, making it `parentNode`'s first child. Any
|
|
29
|
+
* children `parentNode` declares are kept after it.
|
|
30
|
+
*/
|
|
27
31
|
wrapNode(node: Readonly<MdastNode>, parentNode: MdastNode): void;
|
|
28
|
-
prependChild(node: Readonly<MdastNode>, childNode: MdastNode): void;
|
|
29
|
-
appendChild(node: Readonly<MdastNode>, childNode: MdastNode): void;
|
|
32
|
+
prependChild(node: Readonly<MdastNode>, childNode: MdastNode | MdastNode[]): void;
|
|
33
|
+
appendChild(node: Readonly<MdastNode>, childNode: MdastNode | MdastNode[]): void;
|
|
34
|
+
/** Insert one node or an array at `index`; clamps (`0` or less prepends, past the end appends). */
|
|
35
|
+
insertChildAt(node: Readonly<MdastNode>, index: number, childNode: MdastNode | MdastNode[]): void;
|
|
36
|
+
/** Remove the `index`-th child of `node`; a no-op when there is no such child. */
|
|
37
|
+
removeChildAt(node: Readonly<MdastNode>, index: number): void;
|
|
30
38
|
replaceNode(node: Readonly<MdastNode>, newNode: MdastNode): void;
|
|
31
39
|
setProperty<N extends MdastNode, K extends keyof N & string>(node: Readonly<N>, key: K, value: N[K]): void;
|
|
32
40
|
/** Collect the concatenated text of all descendant text nodes (like mdast-util-to-string). */
|
|
@@ -55,6 +55,9 @@ const mdastNodeIdMap = new WeakMap();
|
|
|
55
55
|
function nid(node) {
|
|
56
56
|
return mdastNodeIdMap.get(node) ?? node._nodeId;
|
|
57
57
|
}
|
|
58
|
+
function asArray(value) {
|
|
59
|
+
return Array.isArray(value) ? value : [value];
|
|
60
|
+
}
|
|
58
61
|
export class MdastVisitorContext {
|
|
59
62
|
#commandBuffer = new CommandBuffer();
|
|
60
63
|
#diagnostics = [];
|
|
@@ -80,24 +83,62 @@ export class MdastVisitorContext {
|
|
|
80
83
|
this.#commandBuffer.removeNode(nid(node));
|
|
81
84
|
}
|
|
82
85
|
insertBefore(node, newNode) {
|
|
83
|
-
|
|
86
|
+
const id = nid(node);
|
|
87
|
+
for (const n of asArray(newNode))
|
|
88
|
+
this.#commandBuffer.insertBefore(id, n);
|
|
84
89
|
}
|
|
85
90
|
insertAfter(node, newNode) {
|
|
86
|
-
|
|
91
|
+
const id = nid(node);
|
|
92
|
+
for (const n of asArray(newNode))
|
|
93
|
+
this.#commandBuffer.insertAfter(id, n);
|
|
87
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* Wrap `node` in `parentNode`, making it `parentNode`'s first child. Any
|
|
97
|
+
* children `parentNode` declares are kept after it.
|
|
98
|
+
*/
|
|
88
99
|
wrapNode(node, parentNode) {
|
|
89
100
|
this.#commandBuffer.wrapNode(nid(node), parentNode);
|
|
90
101
|
}
|
|
91
102
|
prependChild(node, childNode) {
|
|
92
|
-
|
|
103
|
+
const id = nid(node);
|
|
104
|
+
for (const n of asArray(childNode))
|
|
105
|
+
this.#commandBuffer.prependChild(id, n);
|
|
93
106
|
}
|
|
94
107
|
appendChild(node, childNode) {
|
|
95
|
-
|
|
108
|
+
const id = nid(node);
|
|
109
|
+
for (const n of asArray(childNode))
|
|
110
|
+
this.#commandBuffer.appendChild(id, n);
|
|
111
|
+
}
|
|
112
|
+
/** Insert one node or an array at `index`; clamps (`0` or less prepends, past the end appends). */
|
|
113
|
+
insertChildAt(node, index, childNode) {
|
|
114
|
+
const children = "children" in node ? node.children : [];
|
|
115
|
+
if (index <= 0 || children.length === 0) {
|
|
116
|
+
this.prependChild(node, childNode);
|
|
117
|
+
}
|
|
118
|
+
else if (index >= children.length) {
|
|
119
|
+
this.appendChild(node, childNode);
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
this.insertBefore(children[index], childNode);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
/** Remove the `index`-th child of `node`; a no-op when there is no such child. */
|
|
126
|
+
removeChildAt(node, index) {
|
|
127
|
+
const child = "children" in node ? node.children[index] : undefined;
|
|
128
|
+
if (child)
|
|
129
|
+
this.removeNode(child);
|
|
96
130
|
}
|
|
97
131
|
replaceNode(node, newNode) {
|
|
98
132
|
this.#commandBuffer.replace(nid(node), newNode);
|
|
99
133
|
}
|
|
100
134
|
setProperty(node, key, value) {
|
|
135
|
+
if (key === "children") {
|
|
136
|
+
// children is structural: set-children keeps the node and swaps only its
|
|
137
|
+
// child list (reused children keep their id).
|
|
138
|
+
const wrapper = refifyReusedNodes({ type: "root", children: value }, true);
|
|
139
|
+
this.#commandBuffer.setChildren(nid(node), JSON.stringify(wrapper));
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
101
142
|
if (key === "data") {
|
|
102
143
|
// data is stored as JSON in the arena, serialize it for the command buffer
|
|
103
144
|
this.#commandBuffer.setProperty(nid(node), key, value != null ? JSON.stringify(value) : null);
|
|
@@ -392,11 +433,18 @@ function readMdastMatchedNode(view, buf, dataOffset, nodeId, nodeType, resolver)
|
|
|
392
433
|
node.label = rstr(buf, pos, labelLen);
|
|
393
434
|
pos += labelLen;
|
|
394
435
|
const kind = buf[pos];
|
|
436
|
+
pos += 1;
|
|
395
437
|
// Only link/image references carry `referenceType`; the mdast spec
|
|
396
438
|
// defines it for those two, not for `footnoteReference`.
|
|
397
439
|
if (nodeType !== 20) {
|
|
398
440
|
node.referenceType = ["shortcut", "collapsed", "full"][kind] ?? "shortcut";
|
|
399
441
|
}
|
|
442
|
+
// imageReference also carries `alt` (the serializer appends it).
|
|
443
|
+
if (nodeType === 18) {
|
|
444
|
+
const altLen = ru16(view, pos);
|
|
445
|
+
pos += 2;
|
|
446
|
+
node.alt = rstr(buf, pos, altLen);
|
|
447
|
+
}
|
|
400
448
|
break;
|
|
401
449
|
}
|
|
402
450
|
case 19: {
|
package/index.d.ts
CHANGED
|
@@ -6,8 +6,13 @@
|
|
|
6
6
|
*/
|
|
7
7
|
export declare function applyCommandsAndConvertToHastHandle(handle: MdastHandle, commandBuf: Uint8Array, convertOptions?: JsConvertOptions | undefined | null): HastHandle
|
|
8
8
|
|
|
9
|
-
/**
|
|
10
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Apply a command buffer to a HAST handle's arena in-place. Returns how many
|
|
11
|
+
* patches were dropped because their target lived inside a subtree this pass
|
|
12
|
+
* removed or replaced (see the lenient note below); the JS pipeline warns when
|
|
13
|
+
* non-zero. Mirrors `apply_commands_to_mdast_handle`.
|
|
14
|
+
*/
|
|
15
|
+
export declare function applyCommandsToHandle(handle: HastHandle, commandBuf: Uint8Array): number
|
|
11
16
|
|
|
12
17
|
/**
|
|
13
18
|
* Apply a command buffer to an MDAST handle in-place. Returns how many patches
|
|
@@ -91,11 +96,11 @@ export interface JsFeatures {
|
|
|
91
96
|
gfmOptions?: JsGfmOptions
|
|
92
97
|
/** Frontmatter: YAML (`--- ... ---`) and TOML (`+++ ... +++`). Default: true. */
|
|
93
98
|
frontmatter?: boolean
|
|
94
|
-
/** Math blocks and inline math (`$$ ... $$`, `$ ... $`). Default:
|
|
99
|
+
/** Math blocks and inline math (`$$ ... $$`, `$ ... $`). Default: false. */
|
|
95
100
|
math?: boolean
|
|
96
101
|
/** Granular math control (overrides `math`). */
|
|
97
102
|
mathOptions?: JsMathOptions
|
|
98
|
-
/** Heading attributes (`# text { #id .class }`). Default:
|
|
103
|
+
/** Heading attributes (`# text { #id .class }`). Default: false. */
|
|
99
104
|
headingAttributes?: boolean
|
|
100
105
|
/** Colon-delimited container directive blocks (`:::`). Default: false. */
|
|
101
106
|
directive?: boolean
|
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.
|
|
85
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
84
|
+
if (bindingPackageVersion !== '0.7.0' && 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.7.0 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.
|
|
101
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
100
|
+
if (bindingPackageVersion !== '0.7.0' && 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.7.0 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.
|
|
122
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
121
|
+
if (bindingPackageVersion !== '0.7.0' && 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.7.0 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.
|
|
138
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
137
|
+
if (bindingPackageVersion !== '0.7.0' && 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.7.0 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.
|
|
155
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
154
|
+
if (bindingPackageVersion !== '0.7.0' && 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.7.0 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.
|
|
171
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
170
|
+
if (bindingPackageVersion !== '0.7.0' && 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.7.0 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.
|
|
190
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
189
|
+
if (bindingPackageVersion !== '0.7.0' && 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.7.0 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.
|
|
206
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
205
|
+
if (bindingPackageVersion !== '0.7.0' && 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.7.0 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.
|
|
222
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
221
|
+
if (bindingPackageVersion !== '0.7.0' && 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.7.0 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.
|
|
242
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
241
|
+
if (bindingPackageVersion !== '0.7.0' && 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.7.0 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.
|
|
258
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
257
|
+
if (bindingPackageVersion !== '0.7.0' && 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.7.0 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.
|
|
279
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
278
|
+
if (bindingPackageVersion !== '0.7.0' && 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.7.0 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.
|
|
295
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
294
|
+
if (bindingPackageVersion !== '0.7.0' && 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.7.0 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.
|
|
313
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
312
|
+
if (bindingPackageVersion !== '0.7.0' && 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.7.0 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.
|
|
329
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
328
|
+
if (bindingPackageVersion !== '0.7.0' && 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.7.0 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.
|
|
347
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
346
|
+
if (bindingPackageVersion !== '0.7.0' && 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.7.0 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.
|
|
363
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
362
|
+
if (bindingPackageVersion !== '0.7.0' && 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.7.0 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.
|
|
381
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
380
|
+
if (bindingPackageVersion !== '0.7.0' && 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.7.0 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.
|
|
397
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
396
|
+
if (bindingPackageVersion !== '0.7.0' && 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.7.0 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.
|
|
415
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
414
|
+
if (bindingPackageVersion !== '0.7.0' && 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.7.0 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.
|
|
431
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
430
|
+
if (bindingPackageVersion !== '0.7.0' && 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.7.0 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.
|
|
448
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
447
|
+
if (bindingPackageVersion !== '0.7.0' && 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.7.0 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.
|
|
464
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
463
|
+
if (bindingPackageVersion !== '0.7.0' && 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.7.0 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.
|
|
484
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
483
|
+
if (bindingPackageVersion !== '0.7.0' && 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.7.0 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.
|
|
500
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
499
|
+
if (bindingPackageVersion !== '0.7.0' && 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.7.0 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.
|
|
516
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
515
|
+
if (bindingPackageVersion !== '0.7.0' && 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.7.0 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.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"description": "High-performance Markdown and MDX processing",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -80,11 +80,11 @@
|
|
|
80
80
|
]
|
|
81
81
|
},
|
|
82
82
|
"optionalDependencies": {
|
|
83
|
-
"@bruits/satteri-linux-x64-gnu": "0.
|
|
84
|
-
"@bruits/satteri-darwin-x64": "0.
|
|
85
|
-
"@bruits/satteri-darwin-arm64": "0.
|
|
86
|
-
"@bruits/satteri-win32-x64-msvc": "0.
|
|
87
|
-
"@bruits/satteri-wasm32-wasi": "0.
|
|
83
|
+
"@bruits/satteri-linux-x64-gnu": "0.8.1",
|
|
84
|
+
"@bruits/satteri-darwin-x64": "0.8.1",
|
|
85
|
+
"@bruits/satteri-darwin-arm64": "0.8.1",
|
|
86
|
+
"@bruits/satteri-win32-x64-msvc": "0.8.1",
|
|
87
|
+
"@bruits/satteri-wasm32-wasi": "0.8.1"
|
|
88
88
|
},
|
|
89
89
|
"scripts": {
|
|
90
90
|
"build:binary:wasm": "napi build --manifest-path ../../crates/satteri-napi-binding/Cargo.toml --output-dir . --platform --release --esm --strip --target wasm32-wasip1-threads",
|