satteri 0.5.0 → 0.6.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/dist/compile.d.ts CHANGED
@@ -85,6 +85,24 @@ export interface MdxOnlyOptions {
85
85
  * `new Function()` or `evaluate()`.
86
86
  */
87
87
  outputFormat?: "program" | "function-body";
88
+ /**
89
+ * Casing for HTML/SVG attribute names on plain (rehype-produced) elements.
90
+ *
91
+ * - `"react"` (default): `className`, `htmlFor`, `strokeLinecap`, `xmlLang`.
92
+ * - `"html"`: `class`, `for`, `stroke-linecap`, `xml:lang`.
93
+ *
94
+ * Does not affect attributes on user-written MDX JSX; those are emitted as
95
+ * the author wrote them.
96
+ */
97
+ elementAttributeNameCase?: "react" | "html";
98
+ /**
99
+ * Casing for keys in `style` objects parsed from `style="…"` strings on
100
+ * plain (rehype-produced) elements.
101
+ *
102
+ * - `"dom"` (default): `{backgroundColor: …, WebkitLineClamp: …}`.
103
+ * - `"css"`: `{"background-color": …, "-webkit-line-clamp": …}`.
104
+ */
105
+ stylePropertyNameCase?: "dom" | "css";
88
106
  }
89
107
  export interface MdxCompileOptions extends CompileOptions, MdxOnlyOptions {
90
108
  }
package/dist/compile.js CHANGED
@@ -96,7 +96,9 @@ function mdxOptionsToNative(opts) {
96
96
  opts.pragma !== undefined ||
97
97
  opts.pragmaFrag !== undefined ||
98
98
  opts.pragmaImportSource !== undefined ||
99
- opts.outputFormat !== undefined;
99
+ opts.outputFormat !== undefined ||
100
+ opts.elementAttributeNameCase !== undefined ||
101
+ opts.stylePropertyNameCase !== undefined;
100
102
  if (!hasAny)
101
103
  return undefined;
102
104
  const result = {};
@@ -120,22 +122,41 @@ function mdxOptionsToNative(opts) {
120
122
  result.pragmaImportSource = opts.pragmaImportSource;
121
123
  if (opts.outputFormat !== undefined)
122
124
  result.outputFormat = opts.outputFormat;
125
+ if (opts.elementAttributeNameCase !== undefined)
126
+ result.elementAttributeNameCase = opts.elementAttributeNameCase;
127
+ if (opts.stylePropertyNameCase !== undefined)
128
+ result.stylePropertyNameCase = opts.stylePropertyNameCase;
123
129
  return result;
124
130
  }
125
131
  export function markdownToHtml(source, options = {}) {
126
132
  const { mdastPlugins = [], hastPlugins = [], features, filename = "<unknown>" } = options;
127
133
  const nativeFeatures = featuresToNative(features);
128
134
  const result = createHastHandleFromMdast(source, mdastPlugins, false, filename, nativeFeatures);
129
- const render = (h, frontmatter) => {
130
- const html = renderHandle(h);
131
- dropHandle(h);
132
- return { html, frontmatter };
135
+ const renderAndDrop = (h, frontmatter) => {
136
+ try {
137
+ const html = renderHandle(h);
138
+ return { html, frontmatter };
139
+ }
140
+ finally {
141
+ dropHandle(h);
142
+ }
133
143
  };
134
144
  const runHastThenRender = (r) => {
135
- const hastResult = runHastPluginsOnHandle(r.hastHandle, hastPlugins, source, filename);
136
- if (hastResult instanceof Promise)
137
- return hastResult.then(() => render(r.hastHandle, r.frontmatter));
138
- return render(r.hastHandle, r.frontmatter);
145
+ let hastResult;
146
+ try {
147
+ hastResult = runHastPluginsOnHandle(r.hastHandle, hastPlugins, source, filename);
148
+ }
149
+ catch (err) {
150
+ dropHandle(r.hastHandle);
151
+ throw err;
152
+ }
153
+ if (hastResult instanceof Promise) {
154
+ return hastResult.then(() => renderAndDrop(r.hastHandle, r.frontmatter), (err) => {
155
+ dropHandle(r.hastHandle);
156
+ throw err;
157
+ });
158
+ }
159
+ return renderAndDrop(r.hastHandle, r.frontmatter);
139
160
  };
140
161
  if (result instanceof Promise)
141
162
  return result.then(runHastThenRender);
@@ -146,16 +167,31 @@ export function mdxToJs(source, options = {}) {
146
167
  const mdxOptions = mdxOptionsToNative(mdxFields);
147
168
  const nativeFeatures = featuresToNative(features);
148
169
  const result = createHastHandleFromMdast(source, mdastPlugins, true, filename, nativeFeatures);
149
- const compile = (h, frontmatter) => {
150
- const code = compileHandle(h, mdxOptions);
151
- dropHandle(h);
152
- return { code, frontmatter };
170
+ const compileAndDrop = (h, frontmatter) => {
171
+ try {
172
+ const code = compileHandle(h, mdxOptions);
173
+ return { code, frontmatter };
174
+ }
175
+ finally {
176
+ dropHandle(h);
177
+ }
153
178
  };
154
179
  const runHastThenCompile = (r) => {
155
- const hastResult = runHastPluginsOnHandle(r.hastHandle, hastPlugins, source, filename);
156
- if (hastResult instanceof Promise)
157
- return hastResult.then(() => compile(r.hastHandle, r.frontmatter));
158
- return compile(r.hastHandle, r.frontmatter);
180
+ let hastResult;
181
+ try {
182
+ hastResult = runHastPluginsOnHandle(r.hastHandle, hastPlugins, source, filename);
183
+ }
184
+ catch (err) {
185
+ dropHandle(r.hastHandle);
186
+ throw err;
187
+ }
188
+ if (hastResult instanceof Promise) {
189
+ return hastResult.then(() => compileAndDrop(r.hastHandle, r.frontmatter), (err) => {
190
+ dropHandle(r.hastHandle);
191
+ throw err;
192
+ });
193
+ }
194
+ return compileAndDrop(r.hastHandle, r.frontmatter);
159
195
  };
160
196
  if (result instanceof Promise)
161
197
  return result.then(runHastThenCompile);
@@ -194,52 +230,77 @@ nativeFeatures) {
194
230
  const mdastHandle = mdx
195
231
  ? createMdxMdastHandle(source, nativeFeatures)
196
232
  : createMdastHandle(source, nativeFeatures);
197
- if (mdastPlugins.length === 0) {
198
- const frontmatter = readFrontmatter(mdastHandle);
199
- const hastHandle = convertMdastToHastHandle(mdastHandle);
200
- return { hastHandle, frontmatter };
201
- }
202
- const mdastResult = runMdastPluginsOnHandle(mdastHandle, mdastPlugins, filename);
203
- // Splits the previous fused apply+convert call so we can read frontmatter
204
- // off the mutated MDAST handle before the conversion consumes it.
233
+ // finally{drop} is intentional: convertMdastToHastHandle empties the arena
234
+ // on success, but if any step here throws the handle would otherwise leak.
205
235
  const finalize = (r) => {
206
- if (r.pendingCommands) {
207
- applyCommandsToMdastHandle(r.handle, r.pendingCommands);
236
+ try {
237
+ if (r.pendingCommands) {
238
+ applyCommandsToMdastHandle(r.handle, r.pendingCommands);
239
+ }
240
+ const frontmatter = readFrontmatter(r.handle);
241
+ const hastHandle = convertMdastToHastHandle(r.handle);
242
+ return { hastHandle, frontmatter };
243
+ }
244
+ finally {
245
+ dropHandle(r.handle);
208
246
  }
209
- const frontmatter = readFrontmatter(r.handle);
210
- const hastHandle = convertMdastToHastHandle(r.handle);
211
- return { hastHandle, frontmatter };
212
247
  };
213
- if (mdastResult instanceof Promise)
214
- return mdastResult.then(finalize);
215
- return finalize(mdastResult);
248
+ try {
249
+ if (mdastPlugins.length === 0) {
250
+ return finalize({ handle: mdastHandle, pendingCommands: null });
251
+ }
252
+ const mdastResult = runMdastPluginsOnHandle(mdastHandle, mdastPlugins, filename);
253
+ if (mdastResult instanceof Promise) {
254
+ return mdastResult.then(finalize, (err) => {
255
+ dropHandle(mdastHandle);
256
+ throw err;
257
+ });
258
+ }
259
+ return finalize(mdastResult);
260
+ }
261
+ catch (err) {
262
+ dropHandle(mdastHandle);
263
+ throw err;
264
+ }
216
265
  }
217
266
  // Step-by-step API: individual pipeline stages with materialized trees
218
267
  /** Parse Markdown source into a materialized mdast tree. */
219
268
  export function markdownToMdast(source, options = {}) {
220
269
  const handle = createMdastHandle(source, featuresToNative(options.features));
221
- const buf = serializeHandle(handle);
222
- dropHandle(handle);
223
- return materializeMdastTree(new MdastReader(buf));
270
+ try {
271
+ return materializeMdastTree(new MdastReader(serializeHandle(handle)));
272
+ }
273
+ finally {
274
+ dropHandle(handle);
275
+ }
224
276
  }
225
277
  /** Parse MDX source into a materialized mdast tree. */
226
278
  export function mdxToMdast(source, options = {}) {
227
279
  const handle = createMdxMdastHandle(source, featuresToNative(options.features));
228
- const buf = serializeHandle(handle);
229
- dropHandle(handle);
230
- return materializeMdastTree(new MdastReader(buf));
280
+ try {
281
+ return materializeMdastTree(new MdastReader(serializeHandle(handle)));
282
+ }
283
+ finally {
284
+ dropHandle(handle);
285
+ }
231
286
  }
232
287
  /** Convert Markdown source to a materialized hast tree. */
233
288
  export function markdownToHast(source, options = {}) {
234
289
  const handle = createHastHandle(source, featuresToNative(options.features));
235
- const buf = serializeHandle(handle);
236
- dropHandle(handle);
237
- return materializeHastTree(new HastReader(buf));
290
+ try {
291
+ return materializeHastTree(new HastReader(serializeHandle(handle)));
292
+ }
293
+ finally {
294
+ dropHandle(handle);
295
+ }
238
296
  }
239
297
  /** Convert MDX source to a materialized hast tree. */
240
298
  export function mdxToHast(source, options = {}) {
241
299
  const handle = createMdxHastHandle(source, featuresToNative(options.features));
242
- const buf = serializeHandle(handle);
243
- dropHandle(handle);
244
- return materializeHastTree(new HastReader(buf));
300
+ try {
301
+ return materializeHastTree(new HastReader(serializeHandle(handle)));
302
+ }
303
+ finally {
304
+ dropHandle(handle);
305
+ }
245
306
  }
@@ -134,12 +134,41 @@ export function materializeHastNode(reader, nodeId) {
134
134
  break;
135
135
  case HAST_MDX_FLOW_EXPRESSION:
136
136
  case HAST_MDX_TEXT_EXPRESSION:
137
+ Object.defineProperties(node, {
138
+ // Substitute U+F002 phantom-space sentinels (see PHANTOM_SPACE in
139
+ // satteri-pulldown-cmark/src/mdx.rs) back to regular spaces — mdast
140
+ // and hast keep phantoms in the value field; only the compile path
141
+ // drops them.
142
+ value: lazyProp("value", () => reader.getTextValue(nodeId).replaceAll("", " ")),
143
+ });
144
+ break;
137
145
  case HAST_MDX_ESM:
138
146
  Object.defineProperties(node, {
139
147
  value: lazyProp("value", () => reader.getTextValue(nodeId)),
140
148
  });
141
149
  break;
142
150
  }
151
+ // Plugins can set `data` on any node type, so rehydrate generically
152
+ // (see website/content/docs/divergences.md for the code-block case).
153
+ const rawData = reader.getNodeData(nodeId);
154
+ if (rawData !== null) {
155
+ try {
156
+ const parsed = JSON.parse(rawData);
157
+ if (parsed && typeof parsed === "object" && Object.keys(parsed).length > 0) {
158
+ Object.defineProperty(node, "data", {
159
+ value: parsed,
160
+ writable: true,
161
+ configurable: true,
162
+ enumerable: true,
163
+ });
164
+ }
165
+ }
166
+ catch (err) {
167
+ if (process.env.NODE_ENV !== "production") {
168
+ console.warn(`materializeHastNode: malformed node_data for nodeId=${nodeId}`, err);
169
+ }
170
+ }
171
+ }
143
172
  return node;
144
173
  }
145
174
  /**
@@ -19,6 +19,13 @@ export interface HastProperty {
19
19
  export declare class HastReader {
20
20
  #private;
21
21
  constructor(buffer: ArrayBuffer | Uint8Array);
22
+ /**
23
+ * Per-node JSON `data` blob (set via `Arena::set_node_data` on the Rust
24
+ * side). Returns `null` when the node has no entry. Lazy-builds a
25
+ * `Map<id, string>` on first call so a materialization pass on a
26
+ * data-heavy tree stays O(nodes) rather than O(nodes × entries).
27
+ */
28
+ getNodeData(nodeId: number): string | null;
22
29
  get nodeCount(): number;
23
30
  get header(): BufferHeader;
24
31
  /** Get the full source string (string pool). */
@@ -84,8 +84,36 @@ export class HastReader {
84
84
  typeDataOffset: v.getUint32(32, true),
85
85
  sourceLen: v.getUint32(36, true),
86
86
  sourceOffset: v.getUint32(40, true),
87
+ nodeDataCount: v.getUint32(44, true),
88
+ nodeDataOffset: v.getUint32(48, true),
87
89
  };
88
90
  }
91
+ #nodeDataTable = null;
92
+ /**
93
+ * Per-node JSON `data` blob (set via `Arena::set_node_data` on the Rust
94
+ * side). Returns `null` when the node has no entry. Lazy-builds a
95
+ * `Map<id, string>` on first call so a materialization pass on a
96
+ * data-heavy tree stays O(nodes) rather than O(nodes × entries).
97
+ */
98
+ getNodeData(nodeId) {
99
+ if (this.#header.nodeDataCount === 0)
100
+ return null;
101
+ if (this.#nodeDataTable === null) {
102
+ this.#nodeDataTable = new Map();
103
+ const v = this.#view;
104
+ let pos = this.#header.nodeDataOffset;
105
+ for (let i = 0; i < this.#header.nodeDataCount; i++) {
106
+ const id = v.getUint32(pos, true);
107
+ pos += 4;
108
+ const len = v.getUint32(pos, true);
109
+ pos += 4;
110
+ const slice = new Uint8Array(this.#view.buffer, this.#view.byteOffset + pos, len);
111
+ this.#nodeDataTable.set(id, this.#textDecoder.decode(slice));
112
+ pos += len;
113
+ }
114
+ }
115
+ return this.#nodeDataTable.get(nodeId) ?? null;
116
+ }
89
117
  get nodeCount() {
90
118
  return this.#header.nodeCount;
91
119
  }
@@ -285,14 +313,14 @@ export class HastReader {
285
313
  name: this.getString(attrNameRef.offset, attrNameRef.len),
286
314
  value: {
287
315
  type: "mdxJsxAttributeValueExpression",
288
- value: this.getString(attrValueRef.offset, attrValueRef.len),
316
+ value: this.getString(attrValueRef.offset, attrValueRef.len).replaceAll("", " "),
289
317
  },
290
318
  });
291
319
  break;
292
320
  case MDX_ATTR_SPREAD:
293
321
  attributes.push({
294
322
  type: "mdxJsxExpressionAttribute",
295
- value: this.getString(attrValueRef.offset, attrValueRef.len),
323
+ value: this.getString(attrValueRef.offset, attrValueRef.len).replaceAll("", " "),
296
324
  });
297
325
  break;
298
326
  }
@@ -382,6 +382,7 @@ function readMdxJsxFromBinary(view, buf, offset, nodeId, nodeType, resolver) {
382
382
  const node = { type: typeName, name, attributes };
383
383
  nodeIdMap.set(node, nodeId);
384
384
  makeLazyChildren(node, childIds, resolver);
385
+ resolver.attachLazyData(node, nodeId);
385
386
  return node;
386
387
  }
387
388
  function readMatchedNode(view, buf, offset, nodeId, nodeType, resolver) {
@@ -423,28 +424,31 @@ class LazyChildResolver {
423
424
  }
424
425
  materializeChildren(childIds) {
425
426
  const reader = this.#ensure();
426
- const handle = this.#handle;
427
427
  return childIds.map((id) => {
428
428
  const node = materializeHastNode(reader, id);
429
- // Override data with a lazy getter backed by the Rust arena's node_data.
430
- Object.defineProperty(node, "data", {
431
- get() {
432
- const json = napiGetNodeData(handle, id);
433
- const val = json ? JSON.parse(json) : null;
434
- Object.defineProperty(this, "data", {
435
- value: val,
436
- writable: true,
437
- enumerable: true,
438
- configurable: true,
439
- });
440
- return val;
441
- },
442
- configurable: true,
443
- enumerable: true,
444
- });
429
+ this.attachLazyData(node, id);
445
430
  return node;
446
431
  });
447
432
  }
433
+ /** Attach a lazy `data` getter backed by the Rust arena's node_data. */
434
+ attachLazyData(node, nodeId) {
435
+ const handle = this.#handle;
436
+ Object.defineProperty(node, "data", {
437
+ get() {
438
+ const json = napiGetNodeData(handle, nodeId);
439
+ const val = json ? JSON.parse(json) : null;
440
+ Object.defineProperty(this, "data", {
441
+ value: val,
442
+ writable: true,
443
+ enumerable: true,
444
+ configurable: true,
445
+ });
446
+ return val;
447
+ },
448
+ configurable: true,
449
+ enumerable: true,
450
+ });
451
+ }
448
452
  }
449
453
  /** Create a lazy `children` property backed by the handle. */
450
454
  function makeLazyChildren(node, childIds, resolver) {
@@ -140,10 +140,10 @@ export function materializeNode(reader, nodeId) {
140
140
  const rawNode = reader.getNode(nodeId);
141
141
  const nodeType = rawNode.type;
142
142
  const typeName = TYPE_NAMES[nodeType] ?? `unknown(${nodeType})`;
143
- const node = {
144
- type: typeName,
145
- position: rawNode.position,
146
- };
143
+ const node = { type: typeName };
144
+ if (rawNode.position !== undefined) {
145
+ node.position = rawNode.position;
146
+ }
147
147
  // _nodeId: non-enumerable internal reference
148
148
  Object.defineProperty(node, "_nodeId", {
149
149
  value: nodeId,
@@ -153,6 +153,27 @@ export function materializeNode(reader, nodeId) {
153
153
  });
154
154
  // Type-specific lazy properties
155
155
  addTypeProperties(node, reader, nodeId, nodeType);
156
+ // Plugin-set `data` survives the visitor walk via its own getter but
157
+ // would be dropped when materialized from a serialized handle.
158
+ const rawData = reader.getNodeData(nodeId);
159
+ if (rawData !== null) {
160
+ try {
161
+ const parsed = JSON.parse(rawData);
162
+ if (parsed && typeof parsed === "object" && Object.keys(parsed).length > 0) {
163
+ Object.defineProperty(node, "data", {
164
+ value: parsed,
165
+ writable: true,
166
+ configurable: true,
167
+ enumerable: true,
168
+ });
169
+ }
170
+ }
171
+ catch (err) {
172
+ if (process.env.NODE_ENV !== "production") {
173
+ console.warn(`materializeNode: malformed node_data for nodeId=${nodeId}`, err);
174
+ }
175
+ }
176
+ }
156
177
  // children: lazy getter (only for non-leaf nodes)
157
178
  if (!LEAF_TYPES.has(nodeType)) {
158
179
  Object.defineProperty(node, "children", {
@@ -42,6 +42,10 @@ export declare const NodeTypeName: Record<number, string>;
42
42
  export declare class MdastReader {
43
43
  #private;
44
44
  constructor(buffer: ArrayBuffer | Uint8Array);
45
+ /** Per-node JSON `data` blob (set via `Arena::set_node_data` on the Rust
46
+ * side). Lazy-builds a `Map<id, string>` on first call so materialization
47
+ * of a data-heavy tree stays O(nodes) rather than O(nodes × entries). */
48
+ getNodeData(nodeId: number): string | null;
45
49
  get nodeCount(): number;
46
50
  get header(): BufferHeader;
47
51
  getSource(): string;
@@ -125,8 +125,33 @@ export class MdastReader {
125
125
  typeDataOffset: v.getUint32(32, true),
126
126
  sourceLen: v.getUint32(36, true),
127
127
  sourceOffset: v.getUint32(40, true),
128
+ nodeDataCount: v.getUint32(44, true),
129
+ nodeDataOffset: v.getUint32(48, true),
128
130
  };
129
131
  }
132
+ #nodeDataTable = null;
133
+ /** Per-node JSON `data` blob (set via `Arena::set_node_data` on the Rust
134
+ * side). Lazy-builds a `Map<id, string>` on first call so materialization
135
+ * of a data-heavy tree stays O(nodes) rather than O(nodes × entries). */
136
+ getNodeData(nodeId) {
137
+ if (this.#header.nodeDataCount === 0)
138
+ return null;
139
+ if (this.#nodeDataTable === null) {
140
+ this.#nodeDataTable = new Map();
141
+ const v = this.#view;
142
+ let pos = this.#header.nodeDataOffset;
143
+ for (let i = 0; i < this.#header.nodeDataCount; i++) {
144
+ const id = v.getUint32(pos, true);
145
+ pos += 4;
146
+ const len = v.getUint32(pos, true);
147
+ pos += 4;
148
+ const slice = new Uint8Array(this.#view.buffer, this.#view.byteOffset + pos, len);
149
+ this.#nodeDataTable.set(id, this.#textDecoder.decode(slice));
150
+ pos += len;
151
+ }
152
+ }
153
+ return this.#nodeDataTable.get(nodeId) ?? null;
154
+ }
130
155
  get nodeCount() {
131
156
  return this.#header.nodeCount;
132
157
  }
@@ -156,15 +181,17 @@ export class MdastReader {
156
181
  const base = nodesOffset + nodeId * nodeStructSize;
157
182
  const v = this.#view;
158
183
  const type = v.getUint8(base + FIELD.node_type);
159
- return {
160
- id: v.getUint32(base + FIELD.id, true),
161
- type,
162
- typeName: NodeTypeName[type] ?? `Unknown(${type})`,
163
- parent: v.getUint32(base + FIELD.parent, true),
164
- position: {
184
+ const startLine = v.getUint32(base + FIELD.start_line, true);
185
+ const startOffset = v.getUint32(base + FIELD.start_offset, true);
186
+ // Sentinel: nodes with both line=0 and offset=0 are synthesized
187
+ // without source position (e.g. GFM autolink-literal nodes that
188
+ // remark-gfm produces via mdast-util-find-and-replace).
189
+ const position = startLine === 0 && startOffset === 0
190
+ ? undefined
191
+ : {
165
192
  start: {
166
- offset: v.getUint32(base + FIELD.start_offset, true),
167
- line: v.getUint32(base + FIELD.start_line, true),
193
+ offset: startOffset,
194
+ line: startLine,
168
195
  column: v.getUint32(base + FIELD.start_column, true),
169
196
  },
170
197
  end: {
@@ -172,7 +199,13 @@ export class MdastReader {
172
199
  line: v.getUint32(base + FIELD.end_line, true),
173
200
  column: v.getUint32(base + FIELD.end_column, true),
174
201
  },
175
- },
202
+ };
203
+ return {
204
+ id: v.getUint32(base + FIELD.id, true),
205
+ type,
206
+ typeName: NodeTypeName[type] ?? `Unknown(${type})`,
207
+ parent: v.getUint32(base + FIELD.parent, true),
208
+ position,
176
209
  childrenStart: v.getUint32(base + FIELD.children_start, true),
177
210
  childrenCount: v.getUint32(base + FIELD.children_count, true),
178
211
  dataOffset: v.getUint32(base + FIELD.data_offset, true),
@@ -452,14 +485,14 @@ export class MdastReader {
452
485
  name: this.getString(attrNameRef.offset, attrNameRef.len),
453
486
  value: {
454
487
  type: "mdxJsxAttributeValueExpression",
455
- value: this.getString(attrValueRef.offset, attrValueRef.len),
488
+ value: this.getString(attrValueRef.offset, attrValueRef.len).replaceAll("", " "),
456
489
  },
457
490
  });
458
491
  break;
459
492
  case 3: // Spread
460
493
  attributes.push({
461
494
  type: "mdxJsxExpressionAttribute",
462
- value: this.getString(attrValueRef.offset, attrValueRef.len),
495
+ value: this.getString(attrValueRef.offset, attrValueRef.len).replaceAll("", " "),
463
496
  });
464
497
  break;
465
498
  }
@@ -499,7 +532,7 @@ export class MdastReader {
499
532
  getExpressionValue(nodeId) {
500
533
  const data = this.getTypeData(nodeId);
501
534
  const valueRef = this.readStringRef(data, 0);
502
- return this.getString(valueRef.offset, valueRef.len);
535
+ return this.getString(valueRef.offset, valueRef.len).replaceAll("", " ");
503
536
  }
504
537
  /**
505
538
  * Walk the tree depth-first. Return false from visitor to skip children.
package/dist/types.d.ts CHANGED
@@ -65,7 +65,7 @@ export interface MdastNodeRaw {
65
65
  type: number;
66
66
  typeName: string;
67
67
  parent: number;
68
- position: Position;
68
+ position: Position | undefined;
69
69
  childrenStart: number;
70
70
  childrenCount: number;
71
71
  dataOffset: number;
@@ -81,4 +81,8 @@ export interface BufferHeader {
81
81
  typeDataOffset: number;
82
82
  sourceLen: number;
83
83
  sourceOffset: number;
84
+ /** Number of nodes that carry an extra JSON `data` blob. */
85
+ nodeDataCount: number;
86
+ /** Offset of the node-data section: `[id u32][len u32][bytes...]` repeated. */
87
+ nodeDataOffset: number;
84
88
  }
package/index.d.ts CHANGED
@@ -123,6 +123,18 @@ export interface JsMdxOptions {
123
123
  pragmaImportSource?: string
124
124
  /** Output format: "program" (default) or "function-body". */
125
125
  outputFormat?: string
126
+ /**
127
+ * Casing for HTML/SVG attribute names on plain (rehype-produced)
128
+ * elements. "react" (default) emits `className`, `htmlFor`, etc.;
129
+ * "html" emits `class`, `for`, `stroke-linecap`, etc.
130
+ */
131
+ elementAttributeNameCase?: string
132
+ /**
133
+ * Casing for keys in `style` objects parsed from `style="…"` strings.
134
+ * "dom" (default) emits `{backgroundColor: …}`; "css" emits
135
+ * `{"background-color": …}`.
136
+ */
137
+ stylePropertyNameCase?: string
126
138
  }
127
139
 
128
140
  /** Static optimization config passed from JavaScript. */
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.4.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.4.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
84
+ if (bindingPackageVersion !== '0.5.1' && 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.5.1 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.4.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.4.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
100
+ if (bindingPackageVersion !== '0.5.1' && 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.5.1 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.4.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.4.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
121
+ if (bindingPackageVersion !== '0.5.1' && 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.5.1 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.4.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.4.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
137
+ if (bindingPackageVersion !== '0.5.1' && 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.5.1 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.4.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.4.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
154
+ if (bindingPackageVersion !== '0.5.1' && 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.5.1 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.4.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.4.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
170
+ if (bindingPackageVersion !== '0.5.1' && 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.5.1 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.4.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.4.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
189
+ if (bindingPackageVersion !== '0.5.1' && 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.5.1 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.4.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.4.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
205
+ if (bindingPackageVersion !== '0.5.1' && 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.5.1 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.4.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.4.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
221
+ if (bindingPackageVersion !== '0.5.1' && 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.5.1 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.4.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.4.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
241
+ if (bindingPackageVersion !== '0.5.1' && 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.5.1 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.4.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.4.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
257
+ if (bindingPackageVersion !== '0.5.1' && 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.5.1 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.4.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.4.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
278
+ if (bindingPackageVersion !== '0.5.1' && 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.5.1 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.4.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.4.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
294
+ if (bindingPackageVersion !== '0.5.1' && 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.5.1 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.4.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.4.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
312
+ if (bindingPackageVersion !== '0.5.1' && 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.5.1 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.4.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.4.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
328
+ if (bindingPackageVersion !== '0.5.1' && 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.5.1 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.4.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.4.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
346
+ if (bindingPackageVersion !== '0.5.1' && 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.5.1 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.4.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.4.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
362
+ if (bindingPackageVersion !== '0.5.1' && 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.5.1 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.4.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.4.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
380
+ if (bindingPackageVersion !== '0.5.1' && 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.5.1 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.4.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.4.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
396
+ if (bindingPackageVersion !== '0.5.1' && 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.5.1 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.4.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.4.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
414
+ if (bindingPackageVersion !== '0.5.1' && 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.5.1 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.4.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.4.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
430
+ if (bindingPackageVersion !== '0.5.1' && 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.5.1 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.4.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.4.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
447
+ if (bindingPackageVersion !== '0.5.1' && 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.5.1 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.4.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.4.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
463
+ if (bindingPackageVersion !== '0.5.1' && 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.5.1 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.4.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.4.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
483
+ if (bindingPackageVersion !== '0.5.1' && 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.5.1 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.4.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.4.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
499
+ if (bindingPackageVersion !== '0.5.1' && 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.5.1 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.4.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.4.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
515
+ if (bindingPackageVersion !== '0.5.1' && 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.5.1 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.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "High-performance Markdown and MDX processing",
5
5
  "repository": {
6
6
  "type": "git",
@@ -79,23 +79,24 @@
79
79
  ]
80
80
  },
81
81
  "optionalDependencies": {
82
- "@bruits/satteri-linux-x64-gnu": "0.5.0",
83
- "@bruits/satteri-darwin-x64": "0.5.0",
84
- "@bruits/satteri-darwin-arm64": "0.5.0",
85
- "@bruits/satteri-win32-x64-msvc": "0.5.0",
86
- "@bruits/satteri-wasm32-wasi": "0.5.0"
82
+ "@bruits/satteri-linux-x64-gnu": "0.6.0",
83
+ "@bruits/satteri-darwin-x64": "0.6.0",
84
+ "@bruits/satteri-darwin-arm64": "0.6.0",
85
+ "@bruits/satteri-win32-x64-msvc": "0.6.0",
86
+ "@bruits/satteri-wasm32-wasi": "0.6.0"
87
87
  },
88
88
  "scripts": {
89
- "build:wasm": "napi build --manifest-path ../../crates/satteri-napi-binding/Cargo.toml --output-dir . --platform --release --esm --strip --target wasm32-wasip1-threads",
90
- "postbuild:wasm": "node patch-binding.js",
91
- "build:native": "napi build --manifest-path ../../crates/satteri-napi-binding/Cargo.toml --output-dir . --platform --release --esm --strip",
92
- "postbuild:native": "node patch-binding.js",
93
- "build:native:cross": "napi build --manifest-path ../../crates/satteri-napi-binding/Cargo.toml --output-dir . --platform --release --esm --strip --cross-compile",
94
- "postbuild:native:cross": "node patch-binding.js",
95
- "build:native:debug": "napi build --manifest-path ../../crates/satteri-napi-binding/Cargo.toml --output-dir . --platform --esm",
96
- "postbuild:native:debug": "node patch-binding.js",
89
+ "build:binary:wasm": "napi build --manifest-path ../../crates/satteri-napi-binding/Cargo.toml --output-dir . --platform --release --esm --strip --target wasm32-wasip1-threads",
90
+ "postbuild:binary:wasm": "node patch-binding.js",
91
+ "build:binary:native": "napi build --manifest-path ../../crates/satteri-napi-binding/Cargo.toml --output-dir . --platform --release --esm --strip",
92
+ "postbuild:binary:native": "node patch-binding.js",
93
+ "build:binary:native:cross": "napi build --manifest-path ../../crates/satteri-napi-binding/Cargo.toml --output-dir . --platform --release --esm --strip --cross-compile",
94
+ "postbuild:binary:native:cross": "node patch-binding.js",
95
+ "build:binary:native:debug": "napi build --manifest-path ../../crates/satteri-napi-binding/Cargo.toml --output-dir . --platform --esm",
96
+ "postbuild:binary:native:debug": "node patch-binding.js",
97
97
  "build:ts": "tsc --project tsconfig.build.json",
98
- "build": "pnpm build:native && pnpm build:ts",
98
+ "build": "pnpm build:ts && pnpm build:binary:native",
99
+ "build:wasm": "pnpm build:ts && pnpm build:binary:wasm",
99
100
  "artifacts": "napi create-npm-dirs && napi artifacts",
100
101
  "dev": "tsc --watch",
101
102
  "vitest": "vitest",