mdream 2.0.0-beta.1 → 2.0.1
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/README.md +319 -128
- package/bin/mdream.mjs +45 -24
- package/dist/browser-stub.mjs +7 -0
- package/dist/browser.d.mts +1 -3
- package/dist/browser.mjs +41 -30
- package/dist/edge.d.mts +0 -2
- package/dist/edge.mjs +41 -30
- package/dist/iife.js +1 -605
- package/dist/index.d.mts +0 -2
- package/dist/index.mjs +42 -32
- package/dist/wasm.d.mts +2 -5
- package/dist/wasm.mjs +41 -31
- package/napi/index.d.mts +0 -33
- package/napi/index.d.ts +0 -33
- package/napi/index.mjs +55 -58
- package/package.json +34 -34
- package/skills/mdream/SKILL.md +9 -5
- package/skills/mdream/references/runtimes.md +17 -9
- package/wasm/mdream_edge.js +3 -1
- package/wasm/mdream_edge_bg.wasm +0 -0
- package/wasm/package.json +1 -1
- package/wasm-bundler/mdream_edge_bg.js +3 -1
- package/wasm-bundler/mdream_edge_bg.wasm +0 -0
- package/wasm-bundler/package.json +1 -1
- package/dist/worker.d.mts +0 -101
- package/dist/worker.mjs +0 -217
package/napi/index.mjs
CHANGED
|
@@ -92,8 +92,8 @@ function requireNative() {
|
|
|
92
92
|
try {
|
|
93
93
|
const binding = require('@mdream/rust-android-arm64')
|
|
94
94
|
const bindingPackageVersion = require('@mdream/rust-android-arm64/package.json').version
|
|
95
|
-
if (bindingPackageVersion !== '0.
|
|
96
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
95
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
96
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
97
97
|
}
|
|
98
98
|
return binding
|
|
99
99
|
} catch (e) {
|
|
@@ -108,8 +108,8 @@ function requireNative() {
|
|
|
108
108
|
try {
|
|
109
109
|
const binding = require('@mdream/rust-android-arm-eabi')
|
|
110
110
|
const bindingPackageVersion = require('@mdream/rust-android-arm-eabi/package.json').version
|
|
111
|
-
if (bindingPackageVersion !== '0.
|
|
112
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
111
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
112
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
113
113
|
}
|
|
114
114
|
return binding
|
|
115
115
|
} catch (e) {
|
|
@@ -129,8 +129,8 @@ function requireNative() {
|
|
|
129
129
|
try {
|
|
130
130
|
const binding = require('@mdream/rust-win32-x64-gnu')
|
|
131
131
|
const bindingPackageVersion = require('@mdream/rust-win32-x64-gnu/package.json').version
|
|
132
|
-
if (bindingPackageVersion !== '0.
|
|
133
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
132
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
133
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
134
134
|
}
|
|
135
135
|
return binding
|
|
136
136
|
} catch (e) {
|
|
@@ -145,8 +145,8 @@ function requireNative() {
|
|
|
145
145
|
try {
|
|
146
146
|
const binding = require('@mdream/rust-win32-x64-msvc')
|
|
147
147
|
const bindingPackageVersion = require('@mdream/rust-win32-x64-msvc/package.json').version
|
|
148
|
-
if (bindingPackageVersion !== '0.
|
|
149
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
148
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
149
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
150
150
|
}
|
|
151
151
|
return binding
|
|
152
152
|
} catch (e) {
|
|
@@ -162,8 +162,8 @@ function requireNative() {
|
|
|
162
162
|
try {
|
|
163
163
|
const binding = require('@mdream/rust-win32-ia32-msvc')
|
|
164
164
|
const bindingPackageVersion = require('@mdream/rust-win32-ia32-msvc/package.json').version
|
|
165
|
-
if (bindingPackageVersion !== '0.
|
|
166
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
165
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
166
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
167
167
|
}
|
|
168
168
|
return binding
|
|
169
169
|
} catch (e) {
|
|
@@ -178,8 +178,8 @@ function requireNative() {
|
|
|
178
178
|
try {
|
|
179
179
|
const binding = require('@mdream/rust-win32-arm64-msvc')
|
|
180
180
|
const bindingPackageVersion = require('@mdream/rust-win32-arm64-msvc/package.json').version
|
|
181
|
-
if (bindingPackageVersion !== '0.
|
|
182
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
181
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
182
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
183
183
|
}
|
|
184
184
|
return binding
|
|
185
185
|
} catch (e) {
|
|
@@ -197,8 +197,8 @@ function requireNative() {
|
|
|
197
197
|
try {
|
|
198
198
|
const binding = require('@mdream/rust-darwin-universal')
|
|
199
199
|
const bindingPackageVersion = require('@mdream/rust-darwin-universal/package.json').version
|
|
200
|
-
if (bindingPackageVersion !== '0.
|
|
201
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
200
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
201
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
202
202
|
}
|
|
203
203
|
return binding
|
|
204
204
|
} catch (e) {
|
|
@@ -213,8 +213,8 @@ function requireNative() {
|
|
|
213
213
|
try {
|
|
214
214
|
const binding = require('@mdream/rust-darwin-x64')
|
|
215
215
|
const bindingPackageVersion = require('@mdream/rust-darwin-x64/package.json').version
|
|
216
|
-
if (bindingPackageVersion !== '0.
|
|
217
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
216
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
217
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
218
218
|
}
|
|
219
219
|
return binding
|
|
220
220
|
} catch (e) {
|
|
@@ -229,8 +229,8 @@ function requireNative() {
|
|
|
229
229
|
try {
|
|
230
230
|
const binding = require('@mdream/rust-darwin-arm64')
|
|
231
231
|
const bindingPackageVersion = require('@mdream/rust-darwin-arm64/package.json').version
|
|
232
|
-
if (bindingPackageVersion !== '0.
|
|
233
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
232
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
233
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
234
234
|
}
|
|
235
235
|
return binding
|
|
236
236
|
} catch (e) {
|
|
@@ -249,8 +249,8 @@ function requireNative() {
|
|
|
249
249
|
try {
|
|
250
250
|
const binding = require('@mdream/rust-freebsd-x64')
|
|
251
251
|
const bindingPackageVersion = require('@mdream/rust-freebsd-x64/package.json').version
|
|
252
|
-
if (bindingPackageVersion !== '0.
|
|
253
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
252
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
253
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
254
254
|
}
|
|
255
255
|
return binding
|
|
256
256
|
} catch (e) {
|
|
@@ -265,8 +265,8 @@ function requireNative() {
|
|
|
265
265
|
try {
|
|
266
266
|
const binding = require('@mdream/rust-freebsd-arm64')
|
|
267
267
|
const bindingPackageVersion = require('@mdream/rust-freebsd-arm64/package.json').version
|
|
268
|
-
if (bindingPackageVersion !== '0.
|
|
269
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
268
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
269
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
270
270
|
}
|
|
271
271
|
return binding
|
|
272
272
|
} catch (e) {
|
|
@@ -286,8 +286,8 @@ function requireNative() {
|
|
|
286
286
|
try {
|
|
287
287
|
const binding = require('@mdream/rust-linux-x64-musl')
|
|
288
288
|
const bindingPackageVersion = require('@mdream/rust-linux-x64-musl/package.json').version
|
|
289
|
-
if (bindingPackageVersion !== '0.
|
|
290
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
289
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
290
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
291
291
|
}
|
|
292
292
|
return binding
|
|
293
293
|
} catch (e) {
|
|
@@ -302,8 +302,8 @@ function requireNative() {
|
|
|
302
302
|
try {
|
|
303
303
|
const binding = require('@mdream/rust-linux-x64-gnu')
|
|
304
304
|
const bindingPackageVersion = require('@mdream/rust-linux-x64-gnu/package.json').version
|
|
305
|
-
if (bindingPackageVersion !== '0.
|
|
306
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
305
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
306
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
307
307
|
}
|
|
308
308
|
return binding
|
|
309
309
|
} catch (e) {
|
|
@@ -320,8 +320,8 @@ function requireNative() {
|
|
|
320
320
|
try {
|
|
321
321
|
const binding = require('@mdream/rust-linux-arm64-musl')
|
|
322
322
|
const bindingPackageVersion = require('@mdream/rust-linux-arm64-musl/package.json').version
|
|
323
|
-
if (bindingPackageVersion !== '0.
|
|
324
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
323
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
324
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
325
325
|
}
|
|
326
326
|
return binding
|
|
327
327
|
} catch (e) {
|
|
@@ -336,8 +336,8 @@ function requireNative() {
|
|
|
336
336
|
try {
|
|
337
337
|
const binding = require('@mdream/rust-linux-arm64-gnu')
|
|
338
338
|
const bindingPackageVersion = require('@mdream/rust-linux-arm64-gnu/package.json').version
|
|
339
|
-
if (bindingPackageVersion !== '0.
|
|
340
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
339
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
340
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
341
341
|
}
|
|
342
342
|
return binding
|
|
343
343
|
} catch (e) {
|
|
@@ -354,8 +354,8 @@ function requireNative() {
|
|
|
354
354
|
try {
|
|
355
355
|
const binding = require('@mdream/rust-linux-arm-musleabihf')
|
|
356
356
|
const bindingPackageVersion = require('@mdream/rust-linux-arm-musleabihf/package.json').version
|
|
357
|
-
if (bindingPackageVersion !== '0.
|
|
358
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
357
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
358
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
359
359
|
}
|
|
360
360
|
return binding
|
|
361
361
|
} catch (e) {
|
|
@@ -370,8 +370,8 @@ function requireNative() {
|
|
|
370
370
|
try {
|
|
371
371
|
const binding = require('@mdream/rust-linux-arm-gnueabihf')
|
|
372
372
|
const bindingPackageVersion = require('@mdream/rust-linux-arm-gnueabihf/package.json').version
|
|
373
|
-
if (bindingPackageVersion !== '0.
|
|
374
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
373
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
374
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
375
375
|
}
|
|
376
376
|
return binding
|
|
377
377
|
} catch (e) {
|
|
@@ -388,8 +388,8 @@ function requireNative() {
|
|
|
388
388
|
try {
|
|
389
389
|
const binding = require('@mdream/rust-linux-loong64-musl')
|
|
390
390
|
const bindingPackageVersion = require('@mdream/rust-linux-loong64-musl/package.json').version
|
|
391
|
-
if (bindingPackageVersion !== '0.
|
|
392
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
391
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
392
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
393
393
|
}
|
|
394
394
|
return binding
|
|
395
395
|
} catch (e) {
|
|
@@ -404,8 +404,8 @@ function requireNative() {
|
|
|
404
404
|
try {
|
|
405
405
|
const binding = require('@mdream/rust-linux-loong64-gnu')
|
|
406
406
|
const bindingPackageVersion = require('@mdream/rust-linux-loong64-gnu/package.json').version
|
|
407
|
-
if (bindingPackageVersion !== '0.
|
|
408
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
407
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
408
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
409
409
|
}
|
|
410
410
|
return binding
|
|
411
411
|
} catch (e) {
|
|
@@ -422,8 +422,8 @@ function requireNative() {
|
|
|
422
422
|
try {
|
|
423
423
|
const binding = require('@mdream/rust-linux-riscv64-musl')
|
|
424
424
|
const bindingPackageVersion = require('@mdream/rust-linux-riscv64-musl/package.json').version
|
|
425
|
-
if (bindingPackageVersion !== '0.
|
|
426
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
425
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
426
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
427
427
|
}
|
|
428
428
|
return binding
|
|
429
429
|
} catch (e) {
|
|
@@ -438,8 +438,8 @@ function requireNative() {
|
|
|
438
438
|
try {
|
|
439
439
|
const binding = require('@mdream/rust-linux-riscv64-gnu')
|
|
440
440
|
const bindingPackageVersion = require('@mdream/rust-linux-riscv64-gnu/package.json').version
|
|
441
|
-
if (bindingPackageVersion !== '0.
|
|
442
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
441
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
442
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
443
443
|
}
|
|
444
444
|
return binding
|
|
445
445
|
} catch (e) {
|
|
@@ -455,8 +455,8 @@ function requireNative() {
|
|
|
455
455
|
try {
|
|
456
456
|
const binding = require('@mdream/rust-linux-ppc64-gnu')
|
|
457
457
|
const bindingPackageVersion = require('@mdream/rust-linux-ppc64-gnu/package.json').version
|
|
458
|
-
if (bindingPackageVersion !== '0.
|
|
459
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
458
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
459
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
460
460
|
}
|
|
461
461
|
return binding
|
|
462
462
|
} catch (e) {
|
|
@@ -471,8 +471,8 @@ function requireNative() {
|
|
|
471
471
|
try {
|
|
472
472
|
const binding = require('@mdream/rust-linux-s390x-gnu')
|
|
473
473
|
const bindingPackageVersion = require('@mdream/rust-linux-s390x-gnu/package.json').version
|
|
474
|
-
if (bindingPackageVersion !== '0.
|
|
475
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
474
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
475
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
476
476
|
}
|
|
477
477
|
return binding
|
|
478
478
|
} catch (e) {
|
|
@@ -491,8 +491,8 @@ function requireNative() {
|
|
|
491
491
|
try {
|
|
492
492
|
const binding = require('@mdream/rust-openharmony-arm64')
|
|
493
493
|
const bindingPackageVersion = require('@mdream/rust-openharmony-arm64/package.json').version
|
|
494
|
-
if (bindingPackageVersion !== '0.
|
|
495
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
494
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
495
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
496
496
|
}
|
|
497
497
|
return binding
|
|
498
498
|
} catch (e) {
|
|
@@ -507,8 +507,8 @@ function requireNative() {
|
|
|
507
507
|
try {
|
|
508
508
|
const binding = require('@mdream/rust-openharmony-x64')
|
|
509
509
|
const bindingPackageVersion = require('@mdream/rust-openharmony-x64/package.json').version
|
|
510
|
-
if (bindingPackageVersion !== '0.
|
|
511
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
510
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
511
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
512
512
|
}
|
|
513
513
|
return binding
|
|
514
514
|
} catch (e) {
|
|
@@ -523,8 +523,8 @@ function requireNative() {
|
|
|
523
523
|
try {
|
|
524
524
|
const binding = require('@mdream/rust-openharmony-arm')
|
|
525
525
|
const bindingPackageVersion = require('@mdream/rust-openharmony-arm/package.json').version
|
|
526
|
-
if (bindingPackageVersion !== '0.
|
|
527
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
526
|
+
if (bindingPackageVersion !== '2.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
527
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
528
528
|
}
|
|
529
529
|
return binding
|
|
530
530
|
} catch (e) {
|
|
@@ -664,8 +664,8 @@ if (!nativeBinding || forceWasi) {
|
|
|
664
664
|
if (!candidateFailed) {
|
|
665
665
|
if (process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
666
666
|
const bindingPackageVersion = require('@mdream/rust-wasm32-wasi/package.json').version
|
|
667
|
-
if (bindingPackageVersion !== '0.
|
|
668
|
-
throw new Error(`WASI binding package version mismatch, expected 0.
|
|
667
|
+
if (bindingPackageVersion !== '2.0.1') {
|
|
668
|
+
throw new Error(`WASI binding package version mismatch, expected 2.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
669
669
|
}
|
|
670
670
|
}
|
|
671
671
|
wasiBinding = require('@mdream/rust-wasm32-wasi')
|
|
@@ -716,10 +716,7 @@ if (!nativeBinding) {
|
|
|
716
716
|
throw new Error(`Failed to load native binding`)
|
|
717
717
|
}
|
|
718
718
|
|
|
719
|
-
const { MarkdownStream, htmlToMarkdown
|
|
719
|
+
const { MarkdownStream, htmlToMarkdown } = nativeBinding
|
|
720
720
|
export { MarkdownStream }
|
|
721
721
|
export { htmlToMarkdown }
|
|
722
|
-
export { htmlToMarkdownBytes }
|
|
723
|
-
export { htmlToMarkdownChunks }
|
|
724
|
-
export { splitMarkdown }
|
|
725
722
|
export const __napiBindingTarget = __napiLoadedBindingTarget
|
package/package.json
CHANGED
|
@@ -1,19 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mdream",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.1",
|
|
5
5
|
"description": "Ultra-performant HTML to Markdown Convertor Optimized for LLMs and llm.txt artifacts.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Harlan Wilton",
|
|
8
8
|
"email": "harlan@harlanzw.com",
|
|
9
9
|
"url": "https://harlanzw.com/"
|
|
10
10
|
},
|
|
11
|
+
"contributors": [
|
|
12
|
+
{
|
|
13
|
+
"name": "André Cruz",
|
|
14
|
+
"url": "https://github.com/edevil"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"name": "Bernardo Pereira",
|
|
18
|
+
"url": "https://github.com/BernardoPe"
|
|
19
|
+
}
|
|
20
|
+
],
|
|
11
21
|
"license": "MIT",
|
|
12
22
|
"repository": {
|
|
13
23
|
"type": "git",
|
|
14
24
|
"url": "https://github.com/harlan-zw/mdream",
|
|
15
25
|
"directory": "packages/mdream"
|
|
16
26
|
},
|
|
27
|
+
"sideEffects": [
|
|
28
|
+
"./wasm-bundler/mdream_edge.js"
|
|
29
|
+
],
|
|
17
30
|
"exports": {
|
|
18
31
|
".": {
|
|
19
32
|
"workerd": {
|
|
@@ -24,24 +37,17 @@
|
|
|
24
37
|
"types": "./dist/edge.d.mts",
|
|
25
38
|
"default": "./dist/edge.mjs"
|
|
26
39
|
},
|
|
27
|
-
"browser": {
|
|
28
|
-
"types": "./dist/browser.d.mts",
|
|
29
|
-
"default": "./dist/browser.mjs"
|
|
30
|
-
},
|
|
31
40
|
"types": "./dist/index.d.mts",
|
|
41
|
+
"browser": "./dist/browser-stub.mjs",
|
|
32
42
|
"import": {
|
|
33
43
|
"types": "./dist/index.d.mts",
|
|
34
44
|
"default": "./dist/index.mjs"
|
|
35
45
|
},
|
|
36
46
|
"default": "./dist/index.mjs"
|
|
37
47
|
},
|
|
38
|
-
"./
|
|
39
|
-
"types": "./dist/
|
|
40
|
-
"
|
|
41
|
-
"types": "./dist/worker.d.mts",
|
|
42
|
-
"default": "./dist/worker.mjs"
|
|
43
|
-
},
|
|
44
|
-
"default": "./dist/worker.mjs"
|
|
48
|
+
"./browser": {
|
|
49
|
+
"types": "./dist/browser.d.mts",
|
|
50
|
+
"default": "./dist/browser.mjs"
|
|
45
51
|
},
|
|
46
52
|
"./wasm": {
|
|
47
53
|
"types": "./dist/wasm.d.mts",
|
|
@@ -64,33 +70,28 @@
|
|
|
64
70
|
"wasm-bundler/",
|
|
65
71
|
"wasm/"
|
|
66
72
|
],
|
|
67
|
-
"browser": "./dist/browser.mjs",
|
|
68
73
|
"dependencies": {},
|
|
69
74
|
"optionalDependencies": {
|
|
70
|
-
"@mdream/rust-android-arm-eabi": "2.0.
|
|
71
|
-
"@mdream/rust-android-arm64": "2.0.
|
|
72
|
-
"@mdream/rust-darwin-arm64": "2.0.
|
|
73
|
-
"@mdream/rust-darwin-x64": "2.0.
|
|
74
|
-
"@mdream/rust-freebsd-x64": "2.0.
|
|
75
|
-
"@mdream/rust-linux-arm-gnueabihf": "2.0.
|
|
76
|
-
"@mdream/rust-linux-arm64-gnu": "2.0.
|
|
77
|
-
"@mdream/rust-linux-arm64-musl": "2.0.
|
|
78
|
-
"@mdream/rust-linux-x64-gnu": "2.0.
|
|
79
|
-
"@mdream/rust-linux-x64-musl": "2.0.
|
|
80
|
-
"@mdream/rust-wasm32-wasi": "2.0.
|
|
81
|
-
"@mdream/rust-win32-arm64-msvc": "2.0.
|
|
82
|
-
"@mdream/rust-win32-x64-msvc": "2.0.
|
|
75
|
+
"@mdream/rust-android-arm-eabi": "2.0.1",
|
|
76
|
+
"@mdream/rust-android-arm64": "2.0.1",
|
|
77
|
+
"@mdream/rust-darwin-arm64": "2.0.1",
|
|
78
|
+
"@mdream/rust-darwin-x64": "2.0.1",
|
|
79
|
+
"@mdream/rust-freebsd-x64": "2.0.1",
|
|
80
|
+
"@mdream/rust-linux-arm-gnueabihf": "2.0.1",
|
|
81
|
+
"@mdream/rust-linux-arm64-gnu": "2.0.1",
|
|
82
|
+
"@mdream/rust-linux-arm64-musl": "2.0.1",
|
|
83
|
+
"@mdream/rust-linux-x64-gnu": "2.0.1",
|
|
84
|
+
"@mdream/rust-linux-x64-musl": "2.0.1",
|
|
85
|
+
"@mdream/rust-wasm32-wasi": "2.0.1",
|
|
86
|
+
"@mdream/rust-win32-arm64-msvc": "2.0.1",
|
|
87
|
+
"@mdream/rust-win32-x64-msvc": "2.0.1"
|
|
83
88
|
},
|
|
84
89
|
"devDependencies": {
|
|
85
|
-
"@mdream/js": "2.0.
|
|
86
|
-
"@mdream/rust-build": "0.
|
|
90
|
+
"@mdream/js": "2.0.1",
|
|
91
|
+
"@mdream/rust-build": "2.0.1",
|
|
92
|
+
"rolldown": "^1.2.13"
|
|
87
93
|
},
|
|
88
94
|
"scripts": {
|
|
89
|
-
"flame": "pnpm build && unbuild bench/bundle && clinic flame -- node bench/bundle/dist/string.mjs 10",
|
|
90
|
-
"bench:build": "pnpm build && unbuild bench/bundle",
|
|
91
|
-
"bench:stream": "pnpm build && unbuild bench/bundle && hyperfine --runs 100 'node bench/bundle/dist/stream.mjs' --warmup 3",
|
|
92
|
-
"bench:await": "pnpm build && unbuild bench/bundle && hyperfine --runs 100 'node bench/bundle/dist/await.mjs' --warmup 3",
|
|
93
|
-
"bench:string": "pnpm build && unbuild bench/bundle && hyperfine --runs 100 'node bench/bundle/dist/string.mjs' --warmup 3",
|
|
94
95
|
"ts": "node --experimental-strip-types",
|
|
95
96
|
"test:live": "curl -s https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax | node ./bin/mdream.mjs --origin https://docs.github.com | tee test/github-markdown.md",
|
|
96
97
|
"test:images": "cat test/fixtures/test-origin.html | node ./bin/mdream.mjs --origin https://docs.github.com",
|
|
@@ -104,7 +105,6 @@
|
|
|
104
105
|
"typecheck": "tsc --noEmit",
|
|
105
106
|
"dev:prepare": "obuild --stub",
|
|
106
107
|
"test": "vitest test",
|
|
107
|
-
"test:browser": "vitest test --project=browser",
|
|
108
108
|
"test:attw": "attw --pack"
|
|
109
109
|
}
|
|
110
110
|
}
|
package/skills/mdream/SKILL.md
CHANGED
|
@@ -5,7 +5,9 @@ description: Convert HTML to Markdown, plain text, or safe HTML with mdream, the
|
|
|
5
5
|
|
|
6
6
|
# mdream
|
|
7
7
|
|
|
8
|
-
This Skill covers
|
|
8
|
+
This Skill covers v2.
|
|
9
|
+
For an earlier release, read the Skill at its release tag.
|
|
10
|
+
The package wraps a Rust converter: NAPI in Node, WASM on edge runtimes and in the browser.
|
|
9
11
|
`@mdream/js` is a separate pure JS engine. It has hook plugins, the splitter, `llms.txt` generation, and content negotiation. Its option shape differs; see [Traps](#traps).
|
|
10
12
|
|
|
11
13
|
## Setup
|
|
@@ -58,7 +60,8 @@ const markdown = htmlToMarkdown('<html><head><title>T</title></head><body><a hre
|
|
|
58
60
|
})
|
|
59
61
|
```
|
|
60
62
|
|
|
61
|
-
Stream a large response
|
|
63
|
+
Stream a large response with the same options.
|
|
64
|
+
Callbacks run once, after the last chunk is read:
|
|
62
65
|
|
|
63
66
|
```ts
|
|
64
67
|
import { streamHtmlToMarkdown } from 'mdream'
|
|
@@ -95,11 +98,12 @@ CLI: `curl -s URL | mdream --origin URL --preset minimal`. It streams stdin to s
|
|
|
95
98
|
|
|
96
99
|
## Traps
|
|
97
100
|
|
|
98
|
-
- **
|
|
99
|
-
-
|
|
101
|
+
- **Unknown options throw.** A key outside the [Config](#config) list throws a `TypeError` that names the fix. Pass `{ minimal: true }`, not `preset`. Pass `clean: { urls: true }`, not `cleanUrls`. Pass plugin options at the top level, not in a `plugins` object. A key set to `undefined` does not throw. The CLI exits with code 1 on an unknown flag.
|
|
102
|
+
- **Hook plugins are not in this package.** An array in `plugins` throws `Custom hook plugins require @mdream/js`. Use `@mdream/js` with `plugins: [createPlugin({...})]` from `@mdream/js/plugins`.
|
|
103
|
+
- **`@mdream/js` takes plugins as an array.** It throws a `TypeError` on `minimal`, `format`, `frontmatter`, `isolateMain`, `tailwind`, `filter`, or `extraction` at the top level. Use `withMinimalPreset()` from `@mdream/js/preset/minimal`, or `{ plugins: [frontmatterPlugin()] }` from `@mdream/js/plugins`. For text or HTML output, use `@mdream/js/text` or `@mdream/js/html`.
|
|
100
104
|
- **Emphasis is `*`, not `_`.** Headings are ATX, bullets are `-`, rules are `---`. Only `tagOverrides` changes a delimiter, for example `em: { enter: '_', exit: '_', isInline: true }`.
|
|
101
105
|
- **Filter selectors also drop inline `position: absolute` and `position: fixed` elements.**
|
|
102
|
-
- **Browser
|
|
106
|
+
- **Browser bundles import `mdream/browser`.** In a browser bundle, the root `mdream` entry throws a `TypeError` when called. Every entry takes the same options and produces the same string. `mdream/browser` and the CDN script return `Promise<string>`, so `await` them. Read [references/runtimes.md](references/runtimes.md) before you use `mdream` outside Node or a Cloudflare Worker.
|
|
103
107
|
|
|
104
108
|
## Version limits
|
|
105
109
|
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
# mdream outside Node
|
|
2
2
|
|
|
3
|
-
`mdream` picks an entry by export condition.
|
|
3
|
+
`mdream` picks an entry by export condition.
|
|
4
|
+
Its conversion entries take the same `MdreamOptions`, including `minimal`, `frontmatter`, `filter`, `extraction`, and `tagOverrides`.
|
|
5
|
+
Callbacks work in every supported runtime.
|
|
6
|
+
Some entries return a string; others return `Promise<string>`.
|
|
4
7
|
|
|
5
8
|
| Import | Resolved by | Returns |
|
|
6
9
|
|---|---|---|
|
|
7
10
|
| `mdream` | Node | `string` |
|
|
8
11
|
| `mdream` | `workerd`, `edge-light` | `string` |
|
|
9
|
-
| `mdream` | `browser` | `
|
|
10
|
-
| `mdream/
|
|
12
|
+
| `mdream` | `browser` | throws a `TypeError` when called |
|
|
13
|
+
| `mdream/browser` | direct import | `Promise<string>` |
|
|
11
14
|
| `mdream/wasm` | direct import | `string`, after `init()` |
|
|
12
15
|
| `dist/iife.js` (CDN) | script tag | `Promise<string>` |
|
|
13
16
|
|
|
14
|
-
|
|
17
|
+
The `mdream` types always describe the synchronous API. The `mdream/browser` types return `Promise<string>` and need no `customConditions` setting.
|
|
15
18
|
|
|
16
19
|
## Cloudflare Workers and Vercel Edge
|
|
17
20
|
|
|
@@ -32,18 +35,23 @@ A Rust panic becomes a normal `Error` with the message `mdream WASM panic, pleas
|
|
|
32
35
|
|
|
33
36
|
## Browser bundles
|
|
34
37
|
|
|
35
|
-
In a Vite, webpack, or esbuild client build,
|
|
38
|
+
In a Vite, webpack, or esbuild client build, import from `mdream/browser`.
|
|
39
|
+
This entry fetches the WASM binary on first use and returns `Promise<string>`.
|
|
40
|
+
Await the result.
|
|
41
|
+
Options and callbacks work as in Node.
|
|
36
42
|
|
|
37
43
|
```ts
|
|
38
|
-
import { htmlToMarkdown } from 'mdream'
|
|
44
|
+
import { htmlToMarkdown } from 'mdream/browser'
|
|
39
45
|
|
|
40
46
|
const markdown = await htmlToMarkdown(html, { minimal: true })
|
|
41
47
|
```
|
|
42
48
|
|
|
43
|
-
|
|
49
|
+
In a browser bundle, the root `mdream` entry throws a `TypeError` when called. The import itself does not throw. A module that runs on the server and the client can import `mdream` and call it only on the server.
|
|
50
|
+
|
|
51
|
+
For browser code that wants a plain string with no WASM, `@mdream/js` is synchronous. It takes plugins as an array of imports from `@mdream/js/plugins`.
|
|
44
52
|
|
|
45
53
|
## Web Worker, raw WASM, and CDN
|
|
46
54
|
|
|
47
|
-
- `mdream/
|
|
55
|
+
- Web Worker: v2 has no worker entry. Write a module worker that imports `mdream/browser`, and start it with `new Worker(new URL('./md.worker.ts', import.meta.url), { type: 'module' })`. Functions cannot cross `postMessage`, so set callbacks inside the worker.
|
|
48
56
|
- `mdream/wasm`: the wasm-bindgen build. Await the default export `init({ module_or_path })` before the first `htmlToMarkdown(html, options)` call. Its `MarkdownStream` runs the callbacks in `finish()`.
|
|
49
|
-
- `https://unpkg.com/mdream/dist/iife.js`: the WASM is inlined and ready at load. `window.mdream` has only `htmlToMarkdown`. There is no `init()`. The call returns `Promise<string>`, the same as
|
|
57
|
+
- `https://unpkg.com/mdream/dist/iife.js`: the WASM is inlined and ready at load. `window.mdream` has only `htmlToMarkdown`. There is no `init()`. The call returns `Promise<string>`, the same as `mdream/browser`.
|
package/wasm/mdream_edge.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
/* @ts-self-types="./mdream_edge.d.ts" */
|
|
2
2
|
|
|
3
3
|
export class MarkdownStream {
|
|
4
|
+
[Symbol.dispose]() {
|
|
5
|
+
this.free();
|
|
6
|
+
}
|
|
4
7
|
__destroy_into_raw() {
|
|
5
8
|
const ptr = this.__wbg_ptr;
|
|
6
9
|
this.__wbg_ptr = 0;
|
|
@@ -99,7 +102,6 @@ export class MarkdownStream {
|
|
|
99
102
|
return takeObject(ret);
|
|
100
103
|
}
|
|
101
104
|
}
|
|
102
|
-
if (Symbol.dispose) MarkdownStream.prototype[Symbol.dispose] = MarkdownStream.prototype.free;
|
|
103
105
|
|
|
104
106
|
/**
|
|
105
107
|
* Consumes the message of the panic that aborted the last export call.
|
package/wasm/mdream_edge_bg.wasm
CHANGED
|
Binary file
|
package/wasm/package.json
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export class MarkdownStream {
|
|
2
|
+
[Symbol.dispose]() {
|
|
3
|
+
this.free();
|
|
4
|
+
}
|
|
2
5
|
__destroy_into_raw() {
|
|
3
6
|
const ptr = this.__wbg_ptr;
|
|
4
7
|
this.__wbg_ptr = 0;
|
|
@@ -97,7 +100,6 @@ export class MarkdownStream {
|
|
|
97
100
|
return takeObject(ret);
|
|
98
101
|
}
|
|
99
102
|
}
|
|
100
|
-
if (Symbol.dispose) MarkdownStream.prototype[Symbol.dispose] = MarkdownStream.prototype.free;
|
|
101
103
|
|
|
102
104
|
/**
|
|
103
105
|
* Consumes the message of the panic that aborted the last export call.
|
|
Binary file
|