satteri 0.10.2 → 0.10.3
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 +16 -0
- package/dist/compile.js +91 -89
- package/dist/generated/parse-options.d.ts +19 -0
- package/dist/generated/parse-options.js +25 -0
- package/dist/index.d.ts +8 -2
- package/dist/index.js +25 -2
- package/index.d.ts +16 -75
- package/index.js +52 -52
- package/package.json +10 -10
package/dist/compile.d.ts
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
import type { MdastPluginList, HastPluginList } from "./plugin.js";
|
|
2
|
+
import { markdownToHtmlFast } from "#binding";
|
|
2
3
|
import type { MdastNode, HastNode, Data } from "./types.js";
|
|
4
|
+
export declare const DEFAULT_PARSE_OPTIONS: number;
|
|
5
|
+
type NativeConvertOptions = NonNullable<Parameters<typeof markdownToHtmlFast>[2]>;
|
|
6
|
+
type NativeCompileOptions = {
|
|
7
|
+
parseOptions: number;
|
|
8
|
+
convertOptions: NativeConvertOptions | undefined;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Split the user-facing `Features` into the packed parser options plus the
|
|
12
|
+
* conversion-side `JsConvertOptions` carrying the footnote i18n strings and the
|
|
13
|
+
* raw-HTML reparse. The public API only exposes `features`; both halves are
|
|
14
|
+
* routed to napi internally.
|
|
15
|
+
*/
|
|
16
|
+
export declare function featuresToNative(features: Features | undefined): NativeCompileOptions;
|
|
3
17
|
/** Configuration for static subtree collapsing during MDX compilation. */
|
|
4
18
|
export interface OptimizeStaticConfig {
|
|
5
19
|
component: string;
|
|
@@ -54,6 +68,8 @@ export interface FootnoteOptions {
|
|
|
54
68
|
* for each backref.
|
|
55
69
|
*/
|
|
56
70
|
backLabel?: string | FootnoteBackrefCallback;
|
|
71
|
+
/** Prefix applied to footnote IDs to prevent DOM clobbering. Default: `"user-content-"`. */
|
|
72
|
+
clobberPrefix?: string;
|
|
57
73
|
}
|
|
58
74
|
/** Granular GFM toggles, nested under {@link Features.gfm}. */
|
|
59
75
|
export interface GfmOptions {
|
package/dist/compile.js
CHANGED
|
@@ -2,79 +2,85 @@ import { visitHastHandle, visitHastHandleCollect, visitHastHook, visitHastHookCo
|
|
|
2
2
|
import { visitMdastHandle, visitMdastHook, resolveMdastSubscriptions, } from "./mdast/mdast-visitor.js";
|
|
3
3
|
import { normalizePlugins } from "./plugin.js";
|
|
4
4
|
import { applyCommandsAndCompileHandle, applyCommandsAndRenderHandle, applyCommandsToMdastHandle, applyMdastCommandsAndConvertAndCompile, applyMdastCommandsAndConvertAndRender, compileHandle, convertMdastToHastHandle, createHastHandle, createHastHandleFromHtml, createMdastHandle, createMdxHastHandle, createMdxMdastHandle, dropHandle, getHandleSource, createHastHandleWithFrontmatter, createMdxHastHandleWithFrontmatter, getMdastFrontmatter, markdownToHtmlFast, markdownToJsFast, mdxToJsFast, renderHandle, serializeHandle, } from "#binding";
|
|
5
|
+
import { ENABLE_DEFINITION_LIST, ENABLE_DIRECTIVE, ENABLE_FOOTNOTES, ENABLE_GFM, ENABLE_HEADING_ATTRIBUTES, ENABLE_MATH, ENABLE_MATH_MULTI_DOLLAR, ENABLE_PLUSES_DELIMITED_METADATA_BLOCKS, ENABLE_SMART_DASHES, ENABLE_SMART_ELLIPSES, ENABLE_SMART_PUNCTUATION, ENABLE_SMART_QUOTES, ENABLE_STRIKETHROUGH, ENABLE_SUBSCRIPT, ENABLE_SUPERSCRIPT, ENABLE_TABLES, ENABLE_TASKLISTS, ENABLE_WIKILINKS, ENABLE_YAML_STYLE_METADATA_BLOCKS, } from "./generated/parse-options.js";
|
|
5
6
|
import { MdastReader } from "./mdast/mdast-reader.js";
|
|
6
7
|
import { materializeMdastTree } from "./mdast/mdast-materializer.js";
|
|
7
8
|
import { markHandleMutated } from "./lazy-child-resolver.js";
|
|
8
9
|
import { HastReader } from "./hast/hast-reader.js";
|
|
9
10
|
import { materializeHastTree } from "./hast/hast-materializer.js";
|
|
11
|
+
const GFM_PARSE_OPTIONS = ENABLE_TABLES | ENABLE_STRIKETHROUGH | ENABLE_TASKLISTS | ENABLE_GFM;
|
|
12
|
+
const FRONTMATTER_PARSE_OPTIONS = ENABLE_YAML_STYLE_METADATA_BLOCKS | ENABLE_PLUSES_DELIMITED_METADATA_BLOCKS;
|
|
13
|
+
export const DEFAULT_PARSE_OPTIONS = GFM_PARSE_OPTIONS | ENABLE_FOOTNOTES | FRONTMATTER_PARSE_OPTIONS;
|
|
14
|
+
/** Packs into the bit set napi reads straight back as `satteri_pulldown_cmark::Options`. */
|
|
15
|
+
function featuresToParseOptions(features) {
|
|
16
|
+
let options = 0;
|
|
17
|
+
const { gfm } = features;
|
|
18
|
+
if (typeof gfm === "object") {
|
|
19
|
+
options |= GFM_PARSE_OPTIONS;
|
|
20
|
+
if (gfm.footnotes !== false)
|
|
21
|
+
options |= ENABLE_FOOTNOTES;
|
|
22
|
+
}
|
|
23
|
+
else if (gfm ?? true) {
|
|
24
|
+
options |= GFM_PARSE_OPTIONS | ENABLE_FOOTNOTES;
|
|
25
|
+
}
|
|
26
|
+
if (features.frontmatter ?? true)
|
|
27
|
+
options |= FRONTMATTER_PARSE_OPTIONS;
|
|
28
|
+
// Opting out of single-dollar math sets the multi-dollar sub-flag so the parser skips lone `$`.
|
|
29
|
+
const { math } = features;
|
|
30
|
+
if (typeof math === "object") {
|
|
31
|
+
options |= math.singleDollarTextMath === false ? ENABLE_MATH_MULTI_DOLLAR : ENABLE_MATH;
|
|
32
|
+
}
|
|
33
|
+
else if (math) {
|
|
34
|
+
options |= ENABLE_MATH;
|
|
35
|
+
}
|
|
36
|
+
if (features.headingAttributes)
|
|
37
|
+
options |= ENABLE_HEADING_ATTRIBUTES;
|
|
38
|
+
if (features.directive)
|
|
39
|
+
options |= ENABLE_DIRECTIVE;
|
|
40
|
+
if (features.superscript)
|
|
41
|
+
options |= ENABLE_SUPERSCRIPT;
|
|
42
|
+
if (features.subscript)
|
|
43
|
+
options |= ENABLE_SUBSCRIPT;
|
|
44
|
+
if (features.wikilinks)
|
|
45
|
+
options |= ENABLE_WIKILINKS;
|
|
46
|
+
if (features.definitionList)
|
|
47
|
+
options |= ENABLE_DEFINITION_LIST;
|
|
48
|
+
const smartPunctuation = features.smartPunctuation;
|
|
49
|
+
if (typeof smartPunctuation === "object") {
|
|
50
|
+
if (smartPunctuation.quotes ?? true)
|
|
51
|
+
options |= ENABLE_SMART_QUOTES;
|
|
52
|
+
if (smartPunctuation.dashes ?? true)
|
|
53
|
+
options |= ENABLE_SMART_DASHES;
|
|
54
|
+
if (smartPunctuation.ellipses ?? true)
|
|
55
|
+
options |= ENABLE_SMART_ELLIPSES;
|
|
56
|
+
}
|
|
57
|
+
else if (smartPunctuation) {
|
|
58
|
+
options |= ENABLE_SMART_PUNCTUATION;
|
|
59
|
+
}
|
|
60
|
+
return options;
|
|
61
|
+
}
|
|
10
62
|
/**
|
|
11
|
-
* Split the user-facing `Features`
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
63
|
+
* Split the user-facing `Features` into the packed parser options plus the
|
|
64
|
+
* conversion-side `JsConvertOptions` carrying the footnote i18n strings and the
|
|
65
|
+
* raw-HTML reparse. The public API only exposes `features`; both halves are
|
|
66
|
+
* routed to napi internally.
|
|
15
67
|
*/
|
|
16
|
-
function featuresToNative(features) {
|
|
68
|
+
export function featuresToNative(features) {
|
|
17
69
|
if (!features)
|
|
18
|
-
return {
|
|
19
|
-
const result = {};
|
|
70
|
+
return { parseOptions: DEFAULT_PARSE_OPTIONS, convertOptions: undefined };
|
|
20
71
|
let convertOptions;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
if (g.footnotes.backLabel !== undefined)
|
|
34
|
-
convertOptions.footnoteBackLabel = g.footnotes.backLabel;
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
gfmOpts.footnotes = g.footnotes;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
result.gfmOptions = gfmOpts;
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
result.gfm = features.gfm;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
if (features.frontmatter !== undefined)
|
|
47
|
-
result.frontmatter = features.frontmatter;
|
|
48
|
-
if (features.math !== undefined) {
|
|
49
|
-
if (typeof features.math === "object") {
|
|
50
|
-
const mathOpts = {};
|
|
51
|
-
if (features.math.singleDollarTextMath !== undefined)
|
|
52
|
-
mathOpts.singleDollarTextMath = features.math.singleDollarTextMath;
|
|
53
|
-
result.mathOptions = mathOpts;
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
result.math = features.math;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
if (features.headingAttributes !== undefined)
|
|
60
|
-
result.headingAttributes = features.headingAttributes;
|
|
61
|
-
if (features.directive !== undefined)
|
|
62
|
-
result.directive = features.directive;
|
|
63
|
-
if (features.superscript !== undefined)
|
|
64
|
-
result.superscript = features.superscript;
|
|
65
|
-
if (features.subscript !== undefined)
|
|
66
|
-
result.subscript = features.subscript;
|
|
67
|
-
if (features.wikilinks !== undefined)
|
|
68
|
-
result.wikilinks = features.wikilinks;
|
|
69
|
-
if (features.definitionList !== undefined)
|
|
70
|
-
result.definitionList = features.definitionList;
|
|
71
|
-
if (features.smartPunctuation !== undefined) {
|
|
72
|
-
if (typeof features.smartPunctuation === "object") {
|
|
73
|
-
result.smartPunctuationOptions = features.smartPunctuation;
|
|
74
|
-
}
|
|
75
|
-
else {
|
|
76
|
-
result.smartPunctuation = features.smartPunctuation;
|
|
77
|
-
}
|
|
72
|
+
const { gfm } = features;
|
|
73
|
+
if (typeof gfm === "object" && typeof gfm.footnotes === "object") {
|
|
74
|
+
const { label, backContent, backLabel, clobberPrefix } = gfm.footnotes;
|
|
75
|
+
convertOptions = {};
|
|
76
|
+
if (label !== undefined)
|
|
77
|
+
convertOptions.footnoteLabel = label;
|
|
78
|
+
if (backContent !== undefined)
|
|
79
|
+
convertOptions.footnoteBackContent = backContent;
|
|
80
|
+
if (backLabel !== undefined)
|
|
81
|
+
convertOptions.footnoteBackLabel = backLabel;
|
|
82
|
+
if (clobberPrefix !== undefined)
|
|
83
|
+
convertOptions.clobberPrefix = clobberPrefix;
|
|
78
84
|
}
|
|
79
85
|
if (features.rawHtml !== undefined) {
|
|
80
86
|
// Routed to convert options so every pipeline (fast paths, plugin paths,
|
|
@@ -82,7 +88,7 @@ function featuresToNative(features) {
|
|
|
82
88
|
convertOptions = convertOptions ?? {};
|
|
83
89
|
convertOptions.rawHtml = features.rawHtml;
|
|
84
90
|
}
|
|
85
|
-
return {
|
|
91
|
+
return { parseOptions: featuresToParseOptions(features), convertOptions };
|
|
86
92
|
}
|
|
87
93
|
/** Free a handle's arena. A plugin's visitor can hand child stubs to user code;
|
|
88
94
|
* pass `invalidateStubs` so the epoch bump makes any stub retained past this
|
|
@@ -271,12 +277,12 @@ export function markdownToHtml(source, options = {}) {
|
|
|
271
277
|
const mdastPlugins = normalizePlugins(options.mdastPlugins ?? [], "mdastPlugins", source, fileURL, "markdown", data);
|
|
272
278
|
const hastPlugins = normalizePlugins(options.hastPlugins ?? [], "hastPlugins", source, fileURL, "markdown", data);
|
|
273
279
|
const hastMayHaveStubs = hastPlugins.length > 0;
|
|
274
|
-
const {
|
|
280
|
+
const { parseOptions, convertOptions: nativeConvertOptions } = featuresToNative(features);
|
|
275
281
|
// Fast path: no plugins → parse, convert, render, and frontmatter all happen
|
|
276
282
|
// inside a single NAPI call. Skips 5 handle-NAPI roundtrips that the
|
|
277
283
|
// plugin-capable path needs to keep the arena live across passes.
|
|
278
284
|
if (mdastPlugins.length === 0 && hastPlugins.length === 0) {
|
|
279
|
-
const { html, frontmatter } = markdownToHtmlFast(source,
|
|
285
|
+
const { html, frontmatter } = markdownToHtmlFast(source, parseOptions, nativeConvertOptions);
|
|
280
286
|
return { html, frontmatter: frontmatter ?? null, data };
|
|
281
287
|
}
|
|
282
288
|
// Track source positions only when some plugin opts in with `position: true`;
|
|
@@ -287,7 +293,7 @@ export function markdownToHtml(source, options = {}) {
|
|
|
287
293
|
// happen inside a single NAPI roundtrip. Saves the convert-to-hast handle
|
|
288
294
|
// create + render + drop crossings the generic path makes separately.
|
|
289
295
|
if (hastPlugins.length === 0) {
|
|
290
|
-
const mdastHandle = createMdastHandle(source,
|
|
296
|
+
const mdastHandle = createMdastHandle(source, parseOptions, trackPositions);
|
|
291
297
|
try {
|
|
292
298
|
const mdastResult = runMdastPluginsOnHandle(mdastHandle, mdastPlugins, fileURL, data, "markdown", true);
|
|
293
299
|
const finishMdast = (r) => {
|
|
@@ -322,7 +328,7 @@ export function markdownToHtml(source, options = {}) {
|
|
|
322
328
|
throw err;
|
|
323
329
|
}
|
|
324
330
|
}
|
|
325
|
-
const result = createHastHandleFromMdast(source, mdastPlugins, false, fileURL,
|
|
331
|
+
const result = createHastHandleFromMdast(source, mdastPlugins, false, fileURL, parseOptions, nativeConvertOptions, data, trackPositions);
|
|
326
332
|
const runHastThenRender = (r) => {
|
|
327
333
|
// Run all but the last HAST plugin normally (each one applies its
|
|
328
334
|
// commands inline); collect the last plugin's commands and fuse apply +
|
|
@@ -379,12 +385,12 @@ function toJsImpl(source, options, mdx) {
|
|
|
379
385
|
const hastPlugins = normalizePlugins(hastInput, "hastPlugins", source, fileURL, sourceFormat, data);
|
|
380
386
|
const hastMayHaveStubs = hastPlugins.length > 0;
|
|
381
387
|
const mdxOptions = mdxOptionsToNative(mdxFields);
|
|
382
|
-
const {
|
|
388
|
+
const { parseOptions, convertOptions: nativeConvertOptions } = featuresToNative(features);
|
|
383
389
|
// Fast path: same trick as `markdownToHtml`. Parse → MDAST → HAST → JS plus
|
|
384
390
|
// frontmatter extraction all happen inside a single NAPI call. Skips 5 of
|
|
385
391
|
// the 6 handle-based crossings the plugin-capable path needs.
|
|
386
392
|
if (mdastPlugins.length === 0 && hastPlugins.length === 0) {
|
|
387
|
-
const { code, frontmatter } = (mdx ? mdxToJsFast : markdownToJsFast)(source,
|
|
393
|
+
const { code, frontmatter } = (mdx ? mdxToJsFast : markdownToJsFast)(source, parseOptions, mdxOptions, nativeConvertOptions);
|
|
388
394
|
return { code, frontmatter: frontmatter ?? null, data };
|
|
389
395
|
}
|
|
390
396
|
// Track positions only when a plugin opts in (see `markdownToHtml`).
|
|
@@ -393,8 +399,8 @@ function toJsImpl(source, options, mdx) {
|
|
|
393
399
|
// frontmatter + convert + simplify + compile happen in one NAPI call.
|
|
394
400
|
if (hastPlugins.length === 0) {
|
|
395
401
|
const mdastHandle = mdx
|
|
396
|
-
? createMdxMdastHandle(source,
|
|
397
|
-
: createMdastHandle(source,
|
|
402
|
+
? createMdxMdastHandle(source, parseOptions, trackPositions)
|
|
403
|
+
: createMdastHandle(source, parseOptions, trackPositions);
|
|
398
404
|
try {
|
|
399
405
|
const mdastResult = runMdastPluginsOnHandle(mdastHandle, mdastPlugins, fileURL, data, mdx ? "mdx" : "markdown", true);
|
|
400
406
|
const finishMdast = (r) => {
|
|
@@ -426,7 +432,7 @@ function toJsImpl(source, options, mdx) {
|
|
|
426
432
|
throw err;
|
|
427
433
|
}
|
|
428
434
|
}
|
|
429
|
-
const result = createHastHandleFromMdast(source, mdastPlugins, mdx, fileURL,
|
|
435
|
+
const result = createHastHandleFromMdast(source, mdastPlugins, mdx, fileURL, parseOptions, nativeConvertOptions, data, trackPositions);
|
|
430
436
|
const runHastThenCompile = (r) => {
|
|
431
437
|
let collected;
|
|
432
438
|
try {
|
|
@@ -493,23 +499,19 @@ function readFrontmatter(handle) {
|
|
|
493
499
|
/** Parse, run mdast plugins, capture frontmatter, then convert to HAST.
|
|
494
500
|
* Frontmatter is read from the post-plugin MDAST so visitor mutations to
|
|
495
501
|
* the yaml/toml node are reflected in the returned value. */
|
|
496
|
-
function createHastHandleFromMdast(source, mdastPlugins, mdx, fileURL,
|
|
497
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
498
|
-
nativeFeatures,
|
|
499
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
500
|
-
nativeConvertOptions, data, trackPositions) {
|
|
502
|
+
function createHastHandleFromMdast(source, mdastPlugins, mdx, fileURL, parseOptions, nativeConvertOptions, data, trackPositions) {
|
|
501
503
|
if (mdastPlugins.length === 0) {
|
|
502
504
|
const [hastHandle, raw] = mdx
|
|
503
|
-
? createMdxHastHandleWithFrontmatter(source,
|
|
504
|
-
: createHastHandleWithFrontmatter(source,
|
|
505
|
+
? createMdxHastHandleWithFrontmatter(source, parseOptions, nativeConvertOptions, trackPositions)
|
|
506
|
+
: createHastHandleWithFrontmatter(source, parseOptions, nativeConvertOptions, trackPositions);
|
|
505
507
|
return {
|
|
506
508
|
hastHandle,
|
|
507
509
|
frontmatter: raw ? { kind: raw.kind === "toml" ? "toml" : "yaml", value: raw.value } : null,
|
|
508
510
|
};
|
|
509
511
|
}
|
|
510
512
|
const mdastHandle = mdx
|
|
511
|
-
? createMdxMdastHandle(source,
|
|
512
|
-
: createMdastHandle(source,
|
|
513
|
+
? createMdxMdastHandle(source, parseOptions, trackPositions)
|
|
514
|
+
: createMdastHandle(source, parseOptions, trackPositions);
|
|
513
515
|
const sourceFormat = mdx ? "mdx" : "markdown";
|
|
514
516
|
const mdastMayHaveStubs = mdastPlugins.length > 0;
|
|
515
517
|
// finally{release} is intentional: convertMdastToHastHandle empties the arena
|
|
@@ -544,7 +546,7 @@ nativeConvertOptions, data, trackPositions) {
|
|
|
544
546
|
}
|
|
545
547
|
/** Parse Markdown source into a materialized mdast tree. */
|
|
546
548
|
export function markdownToMdast(source, options = {}) {
|
|
547
|
-
const handle = createMdastHandle(source, featuresToNative(options.features).
|
|
549
|
+
const handle = createMdastHandle(source, featuresToNative(options.features).parseOptions, options.position);
|
|
548
550
|
try {
|
|
549
551
|
return materializeMdastTree(new MdastReader(serializeHandle(handle)));
|
|
550
552
|
}
|
|
@@ -554,7 +556,7 @@ export function markdownToMdast(source, options = {}) {
|
|
|
554
556
|
}
|
|
555
557
|
/** Parse MDX source into a materialized mdast tree. */
|
|
556
558
|
export function mdxToMdast(source, options = {}) {
|
|
557
|
-
const handle = createMdxMdastHandle(source, featuresToNative(options.features).
|
|
559
|
+
const handle = createMdxMdastHandle(source, featuresToNative(options.features).parseOptions, options.position);
|
|
558
560
|
try {
|
|
559
561
|
return materializeMdastTree(new MdastReader(serializeHandle(handle)));
|
|
560
562
|
}
|
|
@@ -564,8 +566,8 @@ export function mdxToMdast(source, options = {}) {
|
|
|
564
566
|
}
|
|
565
567
|
/** Convert Markdown source to a materialized hast tree. */
|
|
566
568
|
export function markdownToHast(source, options = {}) {
|
|
567
|
-
const {
|
|
568
|
-
const handle = createHastHandle(source,
|
|
569
|
+
const { parseOptions, convertOptions } = featuresToNative(options.features);
|
|
570
|
+
const handle = createHastHandle(source, parseOptions, convertOptions, options.position);
|
|
569
571
|
try {
|
|
570
572
|
return materializeHastTree(new HastReader(serializeHandle(handle)));
|
|
571
573
|
}
|
|
@@ -575,8 +577,8 @@ export function markdownToHast(source, options = {}) {
|
|
|
575
577
|
}
|
|
576
578
|
/** Convert MDX source to a materialized hast tree. */
|
|
577
579
|
export function mdxToHast(source, options = {}) {
|
|
578
|
-
const {
|
|
579
|
-
const handle = createMdxHastHandle(source,
|
|
580
|
+
const { parseOptions, convertOptions } = featuresToNative(options.features);
|
|
581
|
+
const handle = createMdxHastHandle(source, parseOptions, convertOptions, options.position);
|
|
580
582
|
try {
|
|
581
583
|
return materializeHastTree(new HastReader(serializeHandle(handle)));
|
|
582
584
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare const ENABLE_TABLES: number;
|
|
2
|
+
export declare const ENABLE_FOOTNOTES: number;
|
|
3
|
+
export declare const ENABLE_STRIKETHROUGH: number;
|
|
4
|
+
export declare const ENABLE_TASKLISTS: number;
|
|
5
|
+
export declare const ENABLE_SMART_PUNCTUATION: number;
|
|
6
|
+
export declare const ENABLE_HEADING_ATTRIBUTES: number;
|
|
7
|
+
export declare const ENABLE_YAML_STYLE_METADATA_BLOCKS: number;
|
|
8
|
+
export declare const ENABLE_PLUSES_DELIMITED_METADATA_BLOCKS: number;
|
|
9
|
+
export declare const ENABLE_MATH: number;
|
|
10
|
+
export declare const ENABLE_GFM: number;
|
|
11
|
+
export declare const ENABLE_DEFINITION_LIST: number;
|
|
12
|
+
export declare const ENABLE_SUPERSCRIPT: number;
|
|
13
|
+
export declare const ENABLE_SUBSCRIPT: number;
|
|
14
|
+
export declare const ENABLE_WIKILINKS: number;
|
|
15
|
+
export declare const ENABLE_DIRECTIVE: number;
|
|
16
|
+
export declare const ENABLE_SMART_QUOTES: number;
|
|
17
|
+
export declare const ENABLE_SMART_DASHES: number;
|
|
18
|
+
export declare const ENABLE_SMART_ELLIPSES: number;
|
|
19
|
+
export declare const ENABLE_MATH_MULTI_DOLLAR: number;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// @generated by `cargo run -p satteri-layout-codegen`. Do not edit by hand.
|
|
2
|
+
// Parser option bits, declared once in `satteri-layout-codegen/src/schema.rs`.
|
|
3
|
+
// `featuresToNative` packs them into the `parseOptions` integer the NAPI entry
|
|
4
|
+
// points take; the compile-time asserts in
|
|
5
|
+
// `satteri-napi-binding/src/generated/parse_options.rs` pin them to the real
|
|
6
|
+
// `satteri_pulldown_cmark::Options` flags.
|
|
7
|
+
export const ENABLE_TABLES = 1 << 1;
|
|
8
|
+
export const ENABLE_FOOTNOTES = 1 << 2;
|
|
9
|
+
export const ENABLE_STRIKETHROUGH = 1 << 3;
|
|
10
|
+
export const ENABLE_TASKLISTS = 1 << 4;
|
|
11
|
+
export const ENABLE_SMART_PUNCTUATION = 1 << 5;
|
|
12
|
+
export const ENABLE_HEADING_ATTRIBUTES = 1 << 6;
|
|
13
|
+
export const ENABLE_YAML_STYLE_METADATA_BLOCKS = 1 << 7;
|
|
14
|
+
export const ENABLE_PLUSES_DELIMITED_METADATA_BLOCKS = 1 << 8;
|
|
15
|
+
export const ENABLE_MATH = 1 << 10;
|
|
16
|
+
export const ENABLE_GFM = 1 << 11;
|
|
17
|
+
export const ENABLE_DEFINITION_LIST = 1 << 12;
|
|
18
|
+
export const ENABLE_SUPERSCRIPT = 1 << 13;
|
|
19
|
+
export const ENABLE_SUBSCRIPT = 1 << 14;
|
|
20
|
+
export const ENABLE_WIKILINKS = 1 << 15;
|
|
21
|
+
export const ENABLE_DIRECTIVE = 1 << 16;
|
|
22
|
+
export const ENABLE_SMART_QUOTES = 1 << 18;
|
|
23
|
+
export const ENABLE_SMART_DASHES = 1 << 19;
|
|
24
|
+
export const ENABLE_SMART_ELLIPSES = 1 << 20;
|
|
25
|
+
export const ENABLE_MATH_MULTI_DOLLAR = 1 << 23;
|
package/dist/index.d.ts
CHANGED
|
@@ -13,9 +13,15 @@ export { MdastReader } from "./mdast/mdast-reader.js";
|
|
|
13
13
|
export { materializeMdastTree } from "./mdast/mdast-materializer.js";
|
|
14
14
|
export { HastReader } from "./hast/hast-reader.js";
|
|
15
15
|
export { materializeHastTree } from "./hast/hast-materializer.js";
|
|
16
|
-
export {
|
|
17
|
-
import { applyCommandsAndConvertToHastHandle as napiApplyCommandsAndConvertToHastHandle, convertMdastToHastHandle as napiConvertMdastToHastHandle } from "#binding";
|
|
16
|
+
export { serializeHandle, renderHandle, compileHandle, getHandleSource } from "#binding";
|
|
17
|
+
import { applyCommandsAndConvertToHastHandle as napiApplyCommandsAndConvertToHastHandle, convertMdastToHastHandle as napiConvertMdastToHastHandle, createHastHandle as napiCreateHastHandle } from "#binding";
|
|
18
|
+
import type { Features } from "./compile.js";
|
|
18
19
|
import type { AnyHandle } from "./handles.js";
|
|
20
|
+
type NativeConvertOptions = NonNullable<Parameters<typeof napiCreateHastHandle>[2]>;
|
|
21
|
+
export declare function createMdastHandle(source: string, features?: Features, trackPositions?: boolean): MdastHandle;
|
|
22
|
+
export declare function createMdxMdastHandle(source: string, features?: Features, trackPositions?: boolean): MdastHandle;
|
|
23
|
+
export declare function createHastHandle(source: string, features?: Features, convertOptions?: NativeConvertOptions, trackPositions?: boolean): HastHandle;
|
|
24
|
+
export declare function createMdxHastHandle(source: string, features?: Features, convertOptions?: NativeConvertOptions, trackPositions?: boolean): HastHandle;
|
|
19
25
|
export declare function applyCommandsToMdastHandle(handle: MdastHandle, commandBuf: Uint8Array): number;
|
|
20
26
|
export declare function convertMdastToHastHandle(handle: MdastHandle, convertOptions?: Parameters<typeof napiConvertMdastToHastHandle>[1]): HastHandle;
|
|
21
27
|
export declare function dropHandle(handle: AnyHandle): void;
|
package/dist/index.js
CHANGED
|
@@ -11,9 +11,32 @@ export { MdastReader } from "./mdast/mdast-reader.js";
|
|
|
11
11
|
export { materializeMdastTree } from "./mdast/mdast-materializer.js";
|
|
12
12
|
export { HastReader } from "./hast/hast-reader.js";
|
|
13
13
|
export { materializeHastTree } from "./hast/hast-materializer.js";
|
|
14
|
-
export {
|
|
15
|
-
import { applyCommandsToMdastHandle as napiApplyCommandsToMdastHandle, applyCommandsAndConvertToHastHandle as napiApplyCommandsAndConvertToHastHandle, convertMdastToHastHandle as napiConvertMdastToHastHandle, dropHandle as napiDropHandle, } from "#binding";
|
|
14
|
+
export { serializeHandle, renderHandle, compileHandle, getHandleSource } from "#binding";
|
|
15
|
+
import { applyCommandsToMdastHandle as napiApplyCommandsToMdastHandle, applyCommandsAndConvertToHastHandle as napiApplyCommandsAndConvertToHastHandle, convertMdastToHastHandle as napiConvertMdastToHastHandle, createHastHandle as napiCreateHastHandle, createMdastHandle as napiCreateMdastHandle, createMdxHastHandle as napiCreateMdxHastHandle, createMdxMdastHandle as napiCreateMdxMdastHandle, dropHandle as napiDropHandle, } from "#binding";
|
|
16
|
+
import { featuresToNative } from "./compile.js";
|
|
16
17
|
import { markHandleMutated } from "./lazy-child-resolver.js";
|
|
18
|
+
// The napi creators take pre-packed parser bits; these keep `Features` the public shape.
|
|
19
|
+
export function createMdastHandle(source, features, trackPositions) {
|
|
20
|
+
return napiCreateMdastHandle(source, featuresToNative(features).parseOptions, trackPositions);
|
|
21
|
+
}
|
|
22
|
+
export function createMdxMdastHandle(source, features, trackPositions) {
|
|
23
|
+
return napiCreateMdxMdastHandle(source, featuresToNative(features).parseOptions, trackPositions);
|
|
24
|
+
}
|
|
25
|
+
export function createHastHandle(source, features, convertOptions, trackPositions) {
|
|
26
|
+
const native = featuresToNative(features);
|
|
27
|
+
return napiCreateHastHandle(source, native.parseOptions, mergeConvertOptions(native.convertOptions, convertOptions), trackPositions);
|
|
28
|
+
}
|
|
29
|
+
export function createMdxHastHandle(source, features, convertOptions, trackPositions) {
|
|
30
|
+
const native = featuresToNative(features);
|
|
31
|
+
return napiCreateMdxHastHandle(source, native.parseOptions, mergeConvertOptions(native.convertOptions, convertOptions), trackPositions);
|
|
32
|
+
}
|
|
33
|
+
function mergeConvertOptions(fromFeatures, explicit) {
|
|
34
|
+
if (fromFeatures === undefined)
|
|
35
|
+
return explicit;
|
|
36
|
+
if (explicit === undefined)
|
|
37
|
+
return fromFeatures;
|
|
38
|
+
return { ...fromFeatures, ...explicit };
|
|
39
|
+
}
|
|
17
40
|
// The raw NAPI mutators renumber or empty the arena; without the epoch bump a
|
|
18
41
|
// child stub retained past a manual-pipeline pass would silently snapshot the
|
|
19
42
|
// changed arena (or die with an opaque RangeError) instead of hitting the
|
package/index.d.ts
CHANGED
|
@@ -66,7 +66,7 @@ export interface CompileJsOneShot {
|
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
/** Compile MDX source directly to JavaScript. */
|
|
69
|
-
export declare function compileMdx(source: string, options
|
|
69
|
+
export declare function compileMdx(source: string, options: JsMdxOptions | undefined | null, parseOptions: number, convertOptions?: JsConvertOptions | undefined | null): string
|
|
70
70
|
|
|
71
71
|
/** Convert an MDAST handle to a HAST handle. The MDAST handle is consumed (emptied). */
|
|
72
72
|
export declare function convertMdastToHastHandle(handle: MdastHandle, convertOptions?: JsConvertOptions | undefined | null): HastHandle
|
|
@@ -75,7 +75,7 @@ export declare function convertMdastToHastHandle(handle: MdastHandle, convertOpt
|
|
|
75
75
|
* Parse markdown source and convert to HAST. Returns an opaque handle.
|
|
76
76
|
* The arena stays in Rust memory, no buffer is copied to JS.
|
|
77
77
|
*/
|
|
78
|
-
export declare function createHastHandle(source: string,
|
|
78
|
+
export declare function createHastHandle(source: string, parseOptions: number, convertOptions?: JsConvertOptions | undefined | null, trackPositions?: boolean | undefined | null): HastHandle
|
|
79
79
|
|
|
80
80
|
/**
|
|
81
81
|
* Parse an HTML string into structured HAST (elements, text, comments).
|
|
@@ -90,7 +90,7 @@ export declare function createHastHandleFromHtml(html: string, fragment?: boolea
|
|
|
90
90
|
* Parse + frontmatter + HAST conversion in one crossing (HAST-plugin path
|
|
91
91
|
* head). Returns a `[handle, frontmatter]` pair.
|
|
92
92
|
*/
|
|
93
|
-
export declare function createHastHandleWithFrontmatter(source: string,
|
|
93
|
+
export declare function createHastHandleWithFrontmatter(source: string, parseOptions: number, convertOptions?: JsConvertOptions | undefined | null, trackPositions?: boolean | undefined | null): [HastHandle, JsFrontmatter | undefined | null]
|
|
94
94
|
|
|
95
95
|
/**
|
|
96
96
|
* Parse markdown source into an MDAST arena handle.
|
|
@@ -99,16 +99,16 @@ export declare function createHastHandleWithFrontmatter(source: string, features
|
|
|
99
99
|
* on nodes. The plugin pipeline passes `false` when no plugin reads positions,
|
|
100
100
|
* skipping the `LineIndex` build + per-node line/column lookups (~15% of parse).
|
|
101
101
|
*/
|
|
102
|
-
export declare function createMdastHandle(source: string,
|
|
102
|
+
export declare function createMdastHandle(source: string, parseOptions: number, trackPositions?: boolean | undefined | null): MdastHandle
|
|
103
103
|
|
|
104
104
|
/** Parse MDX source and convert to HAST. Returns an opaque handle. */
|
|
105
|
-
export declare function createMdxHastHandle(source: string,
|
|
105
|
+
export declare function createMdxHastHandle(source: string, parseOptions: number, convertOptions?: JsConvertOptions | undefined | null, trackPositions?: boolean | undefined | null): HastHandle
|
|
106
106
|
|
|
107
107
|
/** MDX variant of [`create_hast_handle_with_frontmatter`]. */
|
|
108
|
-
export declare function createMdxHastHandleWithFrontmatter(source: string,
|
|
108
|
+
export declare function createMdxHastHandleWithFrontmatter(source: string, parseOptions: number, convertOptions?: JsConvertOptions | undefined | null, trackPositions?: boolean | undefined | null): [HastHandle, JsFrontmatter | undefined | null]
|
|
109
109
|
|
|
110
110
|
/** Parse MDX source into an MDAST arena handle. */
|
|
111
|
-
export declare function createMdxMdastHandle(source: string,
|
|
111
|
+
export declare function createMdxMdastHandle(source: string, parseOptions: number, trackPositions?: boolean | undefined | null): MdastHandle
|
|
112
112
|
|
|
113
113
|
/**
|
|
114
114
|
* Empty a handle's arena into the thread-local pool; the handle stays valid
|
|
@@ -151,6 +151,11 @@ export interface JsConvertOptions {
|
|
|
151
151
|
* Default: `"Back to reference {reference}"`.
|
|
152
152
|
*/
|
|
153
153
|
footnoteBackLabel?: string | ((arg0: number, arg1: number) => string)
|
|
154
|
+
/**
|
|
155
|
+
* Prefix applied to footnote IDs to prevent DOM clobbering.
|
|
156
|
+
* Default: `"user-content-"`.
|
|
157
|
+
*/
|
|
158
|
+
clobberPrefix?: string
|
|
154
159
|
/**
|
|
155
160
|
* Reparse raw HTML embedded in markdown into real HAST nodes. Default:
|
|
156
161
|
* false. Only effective in builds with the `from-html` feature.
|
|
@@ -158,36 +163,6 @@ export interface JsConvertOptions {
|
|
|
158
163
|
rawHtml?: boolean
|
|
159
164
|
}
|
|
160
165
|
|
|
161
|
-
/** Feature toggles for the Markdown/MDX parser, passed from JavaScript. */
|
|
162
|
-
export interface JsFeatures {
|
|
163
|
-
/** GFM: tables, footnotes, strikethrough, task lists. Default: true. */
|
|
164
|
-
gfm?: boolean
|
|
165
|
-
/** Granular GFM control (overrides `gfm`). */
|
|
166
|
-
gfmOptions?: JsGfmOptions
|
|
167
|
-
/** Frontmatter: YAML (`--- ... ---`) and TOML (`+++ ... +++`). Default: true. */
|
|
168
|
-
frontmatter?: boolean
|
|
169
|
-
/** Math blocks and inline math (`$$ ... $$`, `$ ... $`). Default: false. */
|
|
170
|
-
math?: boolean
|
|
171
|
-
/** Granular math control (overrides `math`). */
|
|
172
|
-
mathOptions?: JsMathOptions
|
|
173
|
-
/** Heading attributes (`# text { #id .class }`). Default: false. */
|
|
174
|
-
headingAttributes?: boolean
|
|
175
|
-
/** Colon-delimited container directive blocks (`:::`). Default: false. */
|
|
176
|
-
directive?: boolean
|
|
177
|
-
/** Superscript (`^super^`). Default: false. */
|
|
178
|
-
superscript?: boolean
|
|
179
|
-
/** Subscript (`~sub~`). Default: false. */
|
|
180
|
-
subscript?: boolean
|
|
181
|
-
/** Obsidian-style wikilinks (`[[link]]`). Default: false. */
|
|
182
|
-
wikilinks?: boolean
|
|
183
|
-
/** Definition lists (`Term` then `: definition`). Default: false. */
|
|
184
|
-
definitionList?: boolean
|
|
185
|
-
/** Smart punctuation: all categories on. Default: false. */
|
|
186
|
-
smartPunctuation?: boolean
|
|
187
|
-
/** Granular smart-punctuation control (overrides `smart_punctuation`). */
|
|
188
|
-
smartPunctuationOptions?: JsSmartPunctuationOptions
|
|
189
|
-
}
|
|
190
|
-
|
|
191
166
|
/** Frontmatter extracted from an MDAST arena. */
|
|
192
167
|
export interface JsFrontmatter {
|
|
193
168
|
/** Either `"yaml"` or `"toml"`. */
|
|
@@ -196,30 +171,6 @@ export interface JsFrontmatter {
|
|
|
196
171
|
value: string
|
|
197
172
|
}
|
|
198
173
|
|
|
199
|
-
/**
|
|
200
|
-
* Granular GFM toggles, nested under `features.gfm`. The footnote i18n
|
|
201
|
-
* strings (label, back-content, back-label) travel separately via the
|
|
202
|
-
* `JsConvertOptions` argument on conversion entry points; the JS package
|
|
203
|
-
* extracts them from `features.gfm.footnotes` before calling in.
|
|
204
|
-
*/
|
|
205
|
-
export interface JsGfmOptions {
|
|
206
|
-
/**
|
|
207
|
-
* Enable GFM footnotes (`[^id]`). Default: true. Set `false` to drop
|
|
208
|
-
* footnote parsing while keeping the rest of the GFM bundle.
|
|
209
|
-
*/
|
|
210
|
-
footnotes?: boolean
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
/** Granular math toggles, nested under `features.math`. */
|
|
214
|
-
export interface JsMathOptions {
|
|
215
|
-
/**
|
|
216
|
-
* Treat single-dollar runs (`$ ... $`) as inline math. Default: true.
|
|
217
|
-
* Set `false` to keep single `$` as literal text (prose with currency)
|
|
218
|
-
* while still parsing double-dollar (`$$ ... $$`) display math.
|
|
219
|
-
*/
|
|
220
|
-
singleDollarTextMath?: boolean
|
|
221
|
-
}
|
|
222
|
-
|
|
223
174
|
/** MDX compile options passed from JavaScript. */
|
|
224
175
|
export interface JsMdxOptions {
|
|
225
176
|
/**
|
|
@@ -277,16 +228,6 @@ export interface JsOptimizeStaticConfig {
|
|
|
277
228
|
ignoreElements?: Array<string>
|
|
278
229
|
}
|
|
279
230
|
|
|
280
|
-
/** Granular smart-punctuation toggles. */
|
|
281
|
-
export interface JsSmartPunctuationOptions {
|
|
282
|
-
/** Replace straight quotes with curly/smart quotes. Default: true. */
|
|
283
|
-
quotes?: boolean
|
|
284
|
-
/** Replace `--`/`---` with en-dash/em-dash. Default: true. */
|
|
285
|
-
dashes?: boolean
|
|
286
|
-
/** Replace `...` with ellipsis (`…`). Default: true. */
|
|
287
|
-
ellipses?: boolean
|
|
288
|
-
}
|
|
289
|
-
|
|
290
231
|
/** A subscription passed from JS. */
|
|
291
232
|
export interface JsSubscription {
|
|
292
233
|
nodeType: number
|
|
@@ -319,13 +260,13 @@ export interface MarkdownHtmlOneShot {
|
|
|
319
260
|
* path makes (createMdast, getFrontmatter, convertToHast, dropMdast, render,
|
|
320
261
|
* dropHast → just one call).
|
|
321
262
|
*/
|
|
322
|
-
export declare function markdownToHtmlFast(source: string,
|
|
263
|
+
export declare function markdownToHtmlFast(source: string, parseOptions: number, convertOptions?: JsConvertOptions | undefined | null): MarkdownHtmlOneShot
|
|
323
264
|
|
|
324
265
|
/**
|
|
325
266
|
* Plain-Markdown variant of [`mdx_to_js_fast`]: MDX syntax stays literal text.
|
|
326
267
|
* Used by `markdownToJs` when the caller didn't configure any plugins.
|
|
327
268
|
*/
|
|
328
|
-
export declare function markdownToJsFast(source: string,
|
|
269
|
+
export declare function markdownToJsFast(source: string, parseOptions: number, options?: JsMdxOptions | undefined | null, convertOptions?: JsConvertOptions | undefined | null): MdxJsOneShot
|
|
329
270
|
|
|
330
271
|
/**
|
|
331
272
|
* Collect the concatenated text content of an MDAST node and all its descendants.
|
|
@@ -348,7 +289,7 @@ export interface MdxJsOneShot {
|
|
|
348
289
|
* single NAPI roundtrip. Used by `mdxToJs` when the caller didn't configure
|
|
349
290
|
* any plugins. Skips 5 of the 6 NAPI crossings the handle-based path makes.
|
|
350
291
|
*/
|
|
351
|
-
export declare function mdxToJsFast(source: string,
|
|
292
|
+
export declare function mdxToJsFast(source: string, parseOptions: number, options?: JsMdxOptions | undefined | null, convertOptions?: JsConvertOptions | undefined | null): MdxJsOneShot
|
|
352
293
|
|
|
353
294
|
/** Parse ESM (import/export statements) and return ESTree-compatible AST as JSON. */
|
|
354
295
|
export declare function parseEsm(source: string): string | null
|
|
@@ -360,7 +301,7 @@ export declare function parseEsm(source: string): string | null
|
|
|
360
301
|
export declare function parseExpression(source: string): string | null
|
|
361
302
|
|
|
362
303
|
/** Parse Markdown source and return HTML string directly. */
|
|
363
|
-
export declare function parseToHtml(source: string,
|
|
304
|
+
export declare function parseToHtml(source: string, parseOptions: number, convertOptions?: JsConvertOptions | undefined | null): string
|
|
364
305
|
|
|
365
306
|
/** Render a HAST handle's arena to HTML. Does not consume the handle. */
|
|
366
307
|
export declare function renderHandle(handle: HastHandle): string
|
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.10.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.10.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.
|
|
101
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
100
|
+
if (bindingPackageVersion !== '0.10.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.10.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.
|
|
122
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
121
|
+
if (bindingPackageVersion !== '0.10.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.10.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.
|
|
138
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
137
|
+
if (bindingPackageVersion !== '0.10.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.10.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.
|
|
155
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
154
|
+
if (bindingPackageVersion !== '0.10.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.10.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.
|
|
171
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
170
|
+
if (bindingPackageVersion !== '0.10.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.10.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.
|
|
190
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
189
|
+
if (bindingPackageVersion !== '0.10.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.10.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.
|
|
206
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
205
|
+
if (bindingPackageVersion !== '0.10.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.10.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.
|
|
222
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
221
|
+
if (bindingPackageVersion !== '0.10.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.10.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.
|
|
242
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
241
|
+
if (bindingPackageVersion !== '0.10.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.10.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.
|
|
258
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
257
|
+
if (bindingPackageVersion !== '0.10.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.10.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.
|
|
279
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
278
|
+
if (bindingPackageVersion !== '0.10.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.10.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.
|
|
295
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
294
|
+
if (bindingPackageVersion !== '0.10.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.10.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.
|
|
313
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
312
|
+
if (bindingPackageVersion !== '0.10.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.10.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.
|
|
329
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
328
|
+
if (bindingPackageVersion !== '0.10.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.10.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.
|
|
347
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
346
|
+
if (bindingPackageVersion !== '0.10.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.10.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.
|
|
363
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
362
|
+
if (bindingPackageVersion !== '0.10.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.10.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.
|
|
381
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
380
|
+
if (bindingPackageVersion !== '0.10.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.10.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.
|
|
397
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
396
|
+
if (bindingPackageVersion !== '0.10.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.10.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.
|
|
415
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
414
|
+
if (bindingPackageVersion !== '0.10.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.10.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.
|
|
431
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
430
|
+
if (bindingPackageVersion !== '0.10.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.10.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.
|
|
448
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
447
|
+
if (bindingPackageVersion !== '0.10.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.10.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.
|
|
464
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
463
|
+
if (bindingPackageVersion !== '0.10.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.10.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.
|
|
484
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
483
|
+
if (bindingPackageVersion !== '0.10.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.10.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.
|
|
500
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
499
|
+
if (bindingPackageVersion !== '0.10.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.10.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.
|
|
516
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
515
|
+
if (bindingPackageVersion !== '0.10.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.10.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.10.
|
|
3
|
+
"version": "0.10.3",
|
|
4
4
|
"description": "High-performance Markdown and MDX processing",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -88,15 +88,15 @@
|
|
|
88
88
|
}
|
|
89
89
|
},
|
|
90
90
|
"optionalDependencies": {
|
|
91
|
-
"@bruits/satteri-linux-x64-gnu": "0.10.
|
|
92
|
-
"@bruits/satteri-linux-arm64-gnu": "0.10.
|
|
93
|
-
"@bruits/satteri-linux-x64-musl": "0.10.
|
|
94
|
-
"@bruits/satteri-linux-arm64-musl": "0.10.
|
|
95
|
-
"@bruits/satteri-darwin-x64": "0.10.
|
|
96
|
-
"@bruits/satteri-darwin-arm64": "0.10.
|
|
97
|
-
"@bruits/satteri-win32-x64-msvc": "0.10.
|
|
98
|
-
"@bruits/satteri-win32-arm64-msvc": "0.10.
|
|
99
|
-
"@bruits/satteri-wasm32-wasi": "0.10.
|
|
91
|
+
"@bruits/satteri-linux-x64-gnu": "0.10.3",
|
|
92
|
+
"@bruits/satteri-linux-arm64-gnu": "0.10.3",
|
|
93
|
+
"@bruits/satteri-linux-x64-musl": "0.10.3",
|
|
94
|
+
"@bruits/satteri-linux-arm64-musl": "0.10.3",
|
|
95
|
+
"@bruits/satteri-darwin-x64": "0.10.3",
|
|
96
|
+
"@bruits/satteri-darwin-arm64": "0.10.3",
|
|
97
|
+
"@bruits/satteri-win32-x64-msvc": "0.10.3",
|
|
98
|
+
"@bruits/satteri-win32-arm64-msvc": "0.10.3",
|
|
99
|
+
"@bruits/satteri-wasm32-wasi": "0.10.3"
|
|
100
100
|
},
|
|
101
101
|
"scripts": {
|
|
102
102
|
"build:binary:wasm": "napi build --manifest-path ../../crates/satteri-napi-binding/Cargo.toml --output-dir . --platform --release --esm --strip --target wasm32-wasip1-threads",
|