@takazudo/mdx-formatter 1.0.3 → 1.0.4
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/rust-formatter.js +11 -10
- package/package.json +2 -2
package/dist/rust-formatter.js
CHANGED
|
@@ -24,7 +24,15 @@ function getPackageName() {
|
|
|
24
24
|
return platformMap[platformName]?.[archName] ?? '';
|
|
25
25
|
}
|
|
26
26
|
function loadNativeModule() {
|
|
27
|
-
//
|
|
27
|
+
// In the repo, prefer a freshly built local native module so tests exercise
|
|
28
|
+
// the code from the current checkout instead of the last published binary.
|
|
29
|
+
try {
|
|
30
|
+
const native = require('../crates/mdx-formatter-napi/mdx-formatter-napi.node');
|
|
31
|
+
return native.format;
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
// Local build not present, fall back to platform-specific npm package.
|
|
35
|
+
}
|
|
28
36
|
const packageName = getPackageName();
|
|
29
37
|
if (packageName) {
|
|
30
38
|
try {
|
|
@@ -32,17 +40,10 @@ function loadNativeModule() {
|
|
|
32
40
|
return native.format;
|
|
33
41
|
}
|
|
34
42
|
catch {
|
|
35
|
-
// Platform package not installed,
|
|
43
|
+
// Platform package not installed, surface a build hint below.
|
|
36
44
|
}
|
|
37
45
|
}
|
|
38
|
-
|
|
39
|
-
try {
|
|
40
|
-
const native = require('../crates/mdx-formatter-napi/mdx-formatter-napi.node');
|
|
41
|
-
return native.format;
|
|
42
|
-
}
|
|
43
|
-
catch {
|
|
44
|
-
throw new Error('Rust native module not available. Build it with: pnpm build:rust');
|
|
45
|
-
}
|
|
46
|
+
throw new Error('Rust native module not available. Build it with: pnpm build:rust');
|
|
46
47
|
}
|
|
47
48
|
/**
|
|
48
49
|
* The native format function. Loaded once at module init.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@takazudo/mdx-formatter",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "AST-based markdown and MDX formatter with Japanese text support",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"benchmark": "npx tsx benchmark/run.ts",
|
|
45
45
|
"build:wasm": ". \"$HOME/.cargo/env\" && wasm-pack build crates/mdx-formatter-wasm --target web --out-dir ../../wasm/pkg",
|
|
46
46
|
"build:wasm:bundler": ". \"$HOME/.cargo/env\" && wasm-pack build crates/mdx-formatter-wasm --target bundler --out-dir ../../wasm/pkg-bundler",
|
|
47
|
-
"build:wasm:doc": ". \"$HOME/.cargo/env\" && wasm-pack build crates/mdx-formatter-wasm --target web --out-dir ../../doc/src/wasm-pkg && mkdir -p doc/public/wasm && cp doc/src/wasm-pkg/mdx_formatter_wasm_bg.wasm doc/public/wasm/",
|
|
47
|
+
"build:wasm:doc": ". \"$HOME/.cargo/env\" && wasm-pack build crates/mdx-formatter-wasm --target web --out-dir ../../doc/src/wasm-pkg && mkdir -p doc/public/wasm && cp doc/src/wasm-pkg/mdx_formatter_wasm_bg.wasm doc/public/wasm/ && cp doc/src/wasm-pkg/mdx_formatter_wasm.js doc/public/wasm/",
|
|
48
48
|
"b4push": "./scripts/run-b4push.sh",
|
|
49
49
|
"doc:start": "pnpm --dir doc start",
|
|
50
50
|
"prepublishOnly": "tsc && vitest run"
|