satteri 0.3.5 → 0.4.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 +3 -3
- package/dist/compile.js +4 -2
- package/dist/index.d.ts +1 -1
- package/dist/plugin.d.ts +10 -0
- package/package.json +6 -6
package/dist/compile.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { MdastPluginInput, HastPluginInput } from "./plugin.js";
|
|
2
2
|
import type { MdastNode, HastNode } from "./types.js";
|
|
3
3
|
/** Configuration for static subtree collapsing during MDX compilation. */
|
|
4
4
|
export interface OptimizeStaticConfig {
|
|
@@ -45,8 +45,8 @@ export interface Features {
|
|
|
45
45
|
smartPunctuation?: boolean | SmartPunctuationOptions;
|
|
46
46
|
}
|
|
47
47
|
export interface CompileOptions {
|
|
48
|
-
mdastPlugins?:
|
|
49
|
-
hastPlugins?:
|
|
48
|
+
mdastPlugins?: MdastPluginInput[];
|
|
49
|
+
hastPlugins?: HastPluginInput[];
|
|
50
50
|
features?: Features;
|
|
51
51
|
filename?: string;
|
|
52
52
|
}
|
package/dist/compile.js
CHANGED
|
@@ -41,7 +41,8 @@ function runMdastPluginsOnHandle(handle, plugins, filename) {
|
|
|
41
41
|
const runNext = () => {
|
|
42
42
|
while (i < plugins.length) {
|
|
43
43
|
const idx = i++;
|
|
44
|
-
const
|
|
44
|
+
const raw = plugins[idx];
|
|
45
|
+
const plugin = typeof raw === "function" ? raw() : raw;
|
|
45
46
|
const subs = resolveMdastSubscriptions(plugin);
|
|
46
47
|
const result = visitMdastHandle(handle, plugin, subs, () => getHandleSource(handle), filename);
|
|
47
48
|
if (result instanceof Promise) {
|
|
@@ -72,8 +73,9 @@ function runHastPluginsOnHandle(handle, plugins, source, filename) {
|
|
|
72
73
|
let i = 0;
|
|
73
74
|
const runNext = () => {
|
|
74
75
|
while (i < plugins.length) {
|
|
75
|
-
const
|
|
76
|
+
const raw = plugins[i];
|
|
76
77
|
i++;
|
|
78
|
+
const plugin = typeof raw === "function" ? raw() : raw;
|
|
77
79
|
const subs = resolveSubscriptions(plugin);
|
|
78
80
|
const result = visitHastHandle(handle, plugin, subs, source, filename);
|
|
79
81
|
if (result instanceof Promise) {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { markdownToHtml, mdxToJs, evaluate, markdownToMdast, mdxToMdast, markdownToHast, mdxToHast, } from "./compile.js";
|
|
2
2
|
export type { CompileOptions, MdxCompileOptions, EvaluateOptions, OptimizeStaticConfig, Features, SmartPunctuationOptions, } from "./compile.js";
|
|
3
3
|
export { defineMdastPlugin, defineHastPlugin } from "./plugin.js";
|
|
4
|
-
export type { MdastPluginDefinition, HastPluginDefinition } from "./plugin.js";
|
|
4
|
+
export type { MdastPluginDefinition, HastPluginDefinition, MdastPluginInput, HastPluginInput, } from "./plugin.js";
|
|
5
5
|
export type { HastVisitorInstance, HastVisitorContext, HastFilteredVisitor, EstreeProgram, } from "./hast/hast-visitor.js";
|
|
6
6
|
export type { MdastNode, HastNode, Position, Point, MdxJsxAttributeNode, MdxJsxExpressionAttributeNode, MdxJsxAttributeValueExpressionNode, MdxJsxAttributeUnion, } from "./types.js";
|
|
7
7
|
export { visitMdastHandle, resolveMdastSubscriptions } from "./mdast/mdast-visitor.js";
|
package/dist/plugin.d.ts
CHANGED
|
@@ -6,5 +6,15 @@ export type MdastPluginDefinition = MdastPluginInstance & {
|
|
|
6
6
|
export type HastPluginDefinition = HastVisitorInstance & {
|
|
7
7
|
name: string;
|
|
8
8
|
};
|
|
9
|
+
/**
|
|
10
|
+
* Entry accepted by `mdastPlugins`: a definition reused across documents,
|
|
11
|
+
* or a factory called once per compile so closures reset per document.
|
|
12
|
+
*/
|
|
13
|
+
export type MdastPluginInput = MdastPluginDefinition | (() => MdastPluginDefinition);
|
|
14
|
+
/**
|
|
15
|
+
* Entry accepted by `hastPlugins`: a definition reused across documents,
|
|
16
|
+
* or a factory called once per compile so closures reset per document.
|
|
17
|
+
*/
|
|
18
|
+
export type HastPluginInput = HastPluginDefinition | (() => HastPluginDefinition);
|
|
9
19
|
export declare function defineMdastPlugin(definition: MdastPluginDefinition): MdastPluginDefinition;
|
|
10
20
|
export declare function defineHastPlugin(definition: HastPluginDefinition): HastPluginDefinition;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "satteri",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "High-performance Markdown and MDX processing",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -78,11 +78,11 @@
|
|
|
78
78
|
]
|
|
79
79
|
},
|
|
80
80
|
"optionalDependencies": {
|
|
81
|
-
"@bruits/satteri-linux-x64-gnu": "0.
|
|
82
|
-
"@bruits/satteri-darwin-x64": "0.
|
|
83
|
-
"@bruits/satteri-darwin-arm64": "0.
|
|
84
|
-
"@bruits/satteri-win32-x64-msvc": "0.
|
|
85
|
-
"@bruits/satteri-wasm32-wasi": "0.
|
|
81
|
+
"@bruits/satteri-linux-x64-gnu": "0.4.0",
|
|
82
|
+
"@bruits/satteri-darwin-x64": "0.4.0",
|
|
83
|
+
"@bruits/satteri-darwin-arm64": "0.4.0",
|
|
84
|
+
"@bruits/satteri-win32-x64-msvc": "0.4.0",
|
|
85
|
+
"@bruits/satteri-wasm32-wasi": "0.4.0"
|
|
86
86
|
},
|
|
87
87
|
"scripts": {
|
|
88
88
|
"build:wasm": "napi build --manifest-path ../../crates/satteri-napi-binding/Cargo.toml --output-dir . --platform --release --esm --strip --target wasm32-wasip1-threads",
|