mdream 1.2.2 → 1.3.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/napi/index.mjs CHANGED
@@ -529,23 +529,33 @@ function requireNative() {
529
529
 
530
530
  nativeBinding = requireNative()
531
531
 
532
- if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
532
+ // NAPI_RS_FORCE_WASI is a tri-state flag:
533
+ // unset / any other value → native binding preferred, WASI is only a fallback
534
+ // 'true' → force WASI fallback even if native loaded
535
+ // 'error' → force WASI and throw if no WASI binding is found
536
+ // Treating any non-empty string as truthy (the historical behavior) meant
537
+ // NAPI_RS_FORCE_WASI=false, NAPI_RS_FORCE_WASI=0, etc. inadvertently triggered
538
+ // the WASI path, causing ENOENT for packages shipped without a .wasi.cjs file.
539
+ const forceWasi =
540
+ process.env.NAPI_RS_FORCE_WASI === 'true' || process.env.NAPI_RS_FORCE_WASI === 'error'
541
+
542
+ if (!nativeBinding || forceWasi) {
533
543
  let wasiBinding = null
534
544
  let wasiBindingError = null
535
545
  try {
536
546
  wasiBinding = require('./rust.wasi.cjs')
537
547
  nativeBinding = wasiBinding
538
548
  } catch (err) {
539
- if (process.env.NAPI_RS_FORCE_WASI) {
549
+ if (forceWasi) {
540
550
  wasiBindingError = err
541
551
  }
542
552
  }
543
- if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
553
+ if (!nativeBinding || forceWasi) {
544
554
  try {
545
555
  wasiBinding = require('@mdream/rust-wasm32-wasi')
546
556
  nativeBinding = wasiBinding
547
557
  } catch (err) {
548
- if (process.env.NAPI_RS_FORCE_WASI) {
558
+ if (forceWasi) {
549
559
  if (!wasiBindingError) {
550
560
  wasiBindingError = err
551
561
  } else {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mdream",
3
3
  "type": "module",
4
- "version": "1.2.2",
4
+ "version": "1.3.0",
5
5
  "description": "Ultra-performant HTML to Markdown Convertor Optimized for LLMs and llm.txt artifacts.",
6
6
  "author": {
7
7
  "name": "Harlan Wilton",
@@ -52,22 +52,22 @@
52
52
  "browser": "./dist/browser.mjs",
53
53
  "dependencies": {},
54
54
  "optionalDependencies": {
55
- "@mdream/rust-android-arm-eabi": "1.2.2",
56
- "@mdream/rust-android-arm64": "1.2.2",
57
- "@mdream/rust-darwin-arm64": "1.2.2",
58
- "@mdream/rust-darwin-x64": "1.2.2",
59
- "@mdream/rust-linux-arm64-gnu": "1.2.2",
60
- "@mdream/rust-freebsd-x64": "1.2.2",
61
- "@mdream/rust-linux-arm64-musl": "1.2.2",
62
- "@mdream/rust-linux-arm-gnueabihf": "1.2.2",
63
- "@mdream/rust-linux-x64-gnu": "1.2.2",
64
- "@mdream/rust-linux-x64-musl": "1.2.2",
65
- "@mdream/rust-win32-x64-msvc": "1.2.2",
66
- "@mdream/rust-wasm32-wasi": "1.2.2",
67
- "@mdream/rust-win32-arm64-msvc": "1.2.2"
55
+ "@mdream/rust-android-arm64": "1.3.0",
56
+ "@mdream/rust-darwin-arm64": "1.3.0",
57
+ "@mdream/rust-android-arm-eabi": "1.3.0",
58
+ "@mdream/rust-darwin-x64": "1.3.0",
59
+ "@mdream/rust-linux-arm-gnueabihf": "1.3.0",
60
+ "@mdream/rust-linux-x64-gnu": "1.3.0",
61
+ "@mdream/rust-linux-arm64-gnu": "1.3.0",
62
+ "@mdream/rust-linux-arm64-musl": "1.3.0",
63
+ "@mdream/rust-freebsd-x64": "1.3.0",
64
+ "@mdream/rust-wasm32-wasi": "1.3.0",
65
+ "@mdream/rust-win32-arm64-msvc": "1.3.0",
66
+ "@mdream/rust-win32-x64-msvc": "1.3.0",
67
+ "@mdream/rust-linux-x64-musl": "1.3.0"
68
68
  },
69
69
  "devDependencies": {
70
- "@mdream/js": "1.2.2"
70
+ "@mdream/js": "1.3.0"
71
71
  },
72
72
  "scripts": {
73
73
  "flame": "pnpm build && unbuild bench/bundle && clinic flame -- node bench/bundle/dist/string.mjs 10",
Binary file
package/wasm/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "mdream-edge",
3
3
  "type": "module",
4
4
  "description": "WebAssembly edge runtime bindings for mdream HTML-to-Markdown converter",
5
- "version": "1.2.2",
5
+ "version": "1.3.0",
6
6
  "license": "MIT",
7
7
  "files": [
8
8
  "mdream_edge_bg.wasm",
Binary file
@@ -2,7 +2,7 @@
2
2
  "name": "mdream-edge",
3
3
  "type": "module",
4
4
  "description": "WebAssembly edge runtime bindings for mdream HTML-to-Markdown converter",
5
- "version": "1.2.2",
5
+ "version": "1.3.0",
6
6
  "license": "MIT",
7
7
  "files": [
8
8
  "mdream_edge_bg.wasm",