mdream 2.1.0 → 2.2.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/README.md +26 -1
- package/dist/browser-markdown.d.mts +129 -0
- package/dist/browser-markdown.mjs +229 -0
- package/dist/browser.d.mts +33 -12
- package/dist/browser.mjs +106 -63
- package/dist/edge-markdown.d.mts +128 -0
- package/dist/edge-markdown.mjs +222 -0
- package/dist/edge.d.mts +32 -7
- package/dist/edge.mjs +100 -52
- package/dist/iife.js +1 -1
- package/dist/index.mjs +10 -2
- package/dist/wasm.mjs +48 -2
- package/napi/index.mjs +56 -56
- package/package.json +33 -19
- package/wasm/mdream_edge.js +9 -0
- package/{wasm-bundler → wasm}/mdream_edge_bg.js +9 -0
- package/wasm/mdream_edge_bg.wasm +0 -0
- package/wasm/package.json +1 -1
- package/wasm-bundler/mdream_edge.js +4 -4
- package/wasm-bundler/mdream_markdown.d.ts +45 -0
- package/wasm-bundler/mdream_markdown.js +15 -0
- package/wasm-bundler/mdream_markdown_bg.js +372 -0
- package/wasm-bundler/mdream_markdown_bg.wasm +0 -0
- package/wasm-bundler/mdream_markdown_web.d.ts +90 -0
- package/wasm-bundler/mdream_markdown_web.js +476 -0
- package/wasm-bundler/mdream_edge_bg.wasm +0 -0
- package/wasm-bundler/mdream_edge_bg.wasm.d.ts +0 -20
- package/wasm-bundler/package.json +0 -19
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/* @ts-self-types="./mdream_markdown.d.ts" */
|
|
2
|
+
import wasmModule from "./mdream_markdown_bg.wasm";
|
|
3
|
+
import * as imports from "./mdream_markdown_bg.js";
|
|
4
|
+
const wasm = wasmModule instanceof WebAssembly.Module
|
|
5
|
+
? new WebAssembly.Instance(wasmModule, { "./mdream_markdown_bg.js": imports }).exports
|
|
6
|
+
: wasmModule;
|
|
7
|
+
import { __wbg_set_wasm } from "./mdream_markdown_bg.js";
|
|
8
|
+
|
|
9
|
+
function initialize() {
|
|
10
|
+
__wbg_set_wasm(wasm);
|
|
11
|
+
wasm.__wbindgen_start();
|
|
12
|
+
return imports;
|
|
13
|
+
}
|
|
14
|
+
export const { MarkdownStream, __mdreamTakePanicMessage, htmlToMarkdown, htmlToMarkdownBytes, htmlToMarkdownResult, install_panic_hook } = initialize();
|
|
15
|
+
|
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
export class MarkdownStream {
|
|
2
|
+
[Symbol.dispose]() {
|
|
3
|
+
this.free();
|
|
4
|
+
}
|
|
5
|
+
__destroy_into_raw() {
|
|
6
|
+
const ptr = this.__wbg_ptr;
|
|
7
|
+
this.__wbg_ptr = 0;
|
|
8
|
+
MarkdownStreamFinalization.unregister(this);
|
|
9
|
+
return ptr;
|
|
10
|
+
}
|
|
11
|
+
free() {
|
|
12
|
+
const ptr = this.__destroy_into_raw();
|
|
13
|
+
wasm.__wbg_markdownstream_free(ptr, 0);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* @returns {string}
|
|
17
|
+
*/
|
|
18
|
+
finish() {
|
|
19
|
+
let deferred1_0;
|
|
20
|
+
let deferred1_1;
|
|
21
|
+
try {
|
|
22
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
23
|
+
wasm.markdownstream_finish(retptr, this.__wbg_ptr);
|
|
24
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
25
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
26
|
+
deferred1_0 = r0;
|
|
27
|
+
deferred1_1 = r1;
|
|
28
|
+
return getStringFromWasm0(r0, r1);
|
|
29
|
+
} finally {
|
|
30
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
31
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* @param {any} options
|
|
36
|
+
*/
|
|
37
|
+
constructor(options) {
|
|
38
|
+
const ret = wasm.markdownstream_new(addHeapObject(options));
|
|
39
|
+
this.__wbg_ptr = ret;
|
|
40
|
+
MarkdownStreamFinalization.register(this, this.__wbg_ptr, this);
|
|
41
|
+
return this;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Byte chunk in, string out, skipping the transcode per chunk. A sequence
|
|
45
|
+
* split across chunks carries to the next call rather than decoding early,
|
|
46
|
+
* matching `TextDecoder({ stream: true })`; invalid bytes become U+FFFD.
|
|
47
|
+
* @param {Uint8Array} chunk
|
|
48
|
+
* @returns {string}
|
|
49
|
+
*/
|
|
50
|
+
processChunkBytes(chunk) {
|
|
51
|
+
let deferred2_0;
|
|
52
|
+
let deferred2_1;
|
|
53
|
+
try {
|
|
54
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
55
|
+
const ptr0 = passArray8ToWasm0(chunk, wasm.__wbindgen_export);
|
|
56
|
+
const len0 = WASM_VECTOR_LEN;
|
|
57
|
+
wasm.markdownstream_processChunkBytes(retptr, this.__wbg_ptr, ptr0, len0);
|
|
58
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
59
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
60
|
+
deferred2_0 = r0;
|
|
61
|
+
deferred2_1 = r1;
|
|
62
|
+
return getStringFromWasm0(r0, r1);
|
|
63
|
+
} finally {
|
|
64
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
65
|
+
wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* A carried byte tail cannot be completed by a string chunk, so it is
|
|
70
|
+
* flushed first. Byte and string chunks may be mixed freely.
|
|
71
|
+
* @param {string} chunk
|
|
72
|
+
* @returns {string}
|
|
73
|
+
*/
|
|
74
|
+
processChunk(chunk) {
|
|
75
|
+
let deferred2_0;
|
|
76
|
+
let deferred2_1;
|
|
77
|
+
try {
|
|
78
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
79
|
+
const ptr0 = passStringToWasm0(chunk, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
80
|
+
const len0 = WASM_VECTOR_LEN;
|
|
81
|
+
wasm.markdownstream_processChunk(retptr, this.__wbg_ptr, ptr0, len0);
|
|
82
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
83
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
84
|
+
deferred2_0 = r0;
|
|
85
|
+
deferred2_1 = r1;
|
|
86
|
+
return getStringFromWasm0(r0, r1);
|
|
87
|
+
} finally {
|
|
88
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
89
|
+
wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Frontmatter and extracted elements collected so far, as
|
|
94
|
+
* `{ frontmatter?, extracted? }`. Call after `finish()` for the complete
|
|
95
|
+
* data. Extracted elements drain on each call.
|
|
96
|
+
* @returns {any}
|
|
97
|
+
*/
|
|
98
|
+
takeData() {
|
|
99
|
+
const ret = wasm.markdownstream_takeData(this.__wbg_ptr);
|
|
100
|
+
return takeObject(ret);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Consumes the message of the panic that aborted the last export call.
|
|
106
|
+
* @returns {string | undefined}
|
|
107
|
+
*/
|
|
108
|
+
export function __mdreamTakePanicMessage() {
|
|
109
|
+
try {
|
|
110
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
111
|
+
wasm.__mdreamTakePanicMessage(retptr);
|
|
112
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
113
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
114
|
+
let v1;
|
|
115
|
+
if (r0 !== 0) {
|
|
116
|
+
v1 = getStringFromWasm0(r0, r1);
|
|
117
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
118
|
+
}
|
|
119
|
+
return v1;
|
|
120
|
+
} finally {
|
|
121
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* @param {string} html
|
|
127
|
+
* @param {any} options
|
|
128
|
+
* @returns {string}
|
|
129
|
+
*/
|
|
130
|
+
export function htmlToMarkdown(html, options) {
|
|
131
|
+
let deferred2_0;
|
|
132
|
+
let deferred2_1;
|
|
133
|
+
try {
|
|
134
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
135
|
+
const ptr0 = passStringToWasm0(html, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
136
|
+
const len0 = WASM_VECTOR_LEN;
|
|
137
|
+
wasm.htmlToMarkdown(retptr, ptr0, len0, addHeapObject(options));
|
|
138
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
139
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
140
|
+
deferred2_0 = r0;
|
|
141
|
+
deferred2_1 = r1;
|
|
142
|
+
return getStringFromWasm0(r0, r1);
|
|
143
|
+
} finally {
|
|
144
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
145
|
+
wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Bytes in, string out: skips the transcode (~14% of a convert) for a
|
|
151
|
+
* caller already holding UTF-8 bytes. Encoding a string to get here
|
|
152
|
+
* measures 1-16% *slower* than [`html_to_markdown`] — only worth it when
|
|
153
|
+
* the bytes are already in hand.
|
|
154
|
+
* @param {Uint8Array} html
|
|
155
|
+
* @param {any} options
|
|
156
|
+
* @returns {string}
|
|
157
|
+
*/
|
|
158
|
+
export function htmlToMarkdownBytes(html, options) {
|
|
159
|
+
let deferred2_0;
|
|
160
|
+
let deferred2_1;
|
|
161
|
+
try {
|
|
162
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
163
|
+
const ptr0 = passArray8ToWasm0(html, wasm.__wbindgen_export);
|
|
164
|
+
const len0 = WASM_VECTOR_LEN;
|
|
165
|
+
wasm.htmlToMarkdownBytes(retptr, ptr0, len0, addHeapObject(options));
|
|
166
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
167
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
168
|
+
deferred2_0 = r0;
|
|
169
|
+
deferred2_1 = r1;
|
|
170
|
+
return getStringFromWasm0(r0, r1);
|
|
171
|
+
} finally {
|
|
172
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
173
|
+
wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* @param {string} html
|
|
179
|
+
* @param {any} options
|
|
180
|
+
* @returns {any}
|
|
181
|
+
*/
|
|
182
|
+
export function htmlToMarkdownResult(html, options) {
|
|
183
|
+
const ptr0 = passStringToWasm0(html, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
184
|
+
const len0 = WASM_VECTOR_LEN;
|
|
185
|
+
const ret = wasm.htmlToMarkdownResult(ptr0, len0, addHeapObject(options));
|
|
186
|
+
return takeObject(ret);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export function install_panic_hook() {
|
|
190
|
+
wasm.install_panic_hook();
|
|
191
|
+
}
|
|
192
|
+
export function __wbg___wbindgen_is_null_e343b7d08827ba72(arg0) {
|
|
193
|
+
const ret = getObject(arg0) === null;
|
|
194
|
+
return ret;
|
|
195
|
+
}
|
|
196
|
+
export function __wbg___wbindgen_is_undefined_8865fb403f8fe9d8(arg0) {
|
|
197
|
+
const ret = getObject(arg0) === undefined;
|
|
198
|
+
return ret;
|
|
199
|
+
}
|
|
200
|
+
export function __wbg___wbindgen_string_get_0380ccaa2f57f0d9(arg0, arg1) {
|
|
201
|
+
const obj = getObject(arg1);
|
|
202
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
203
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
204
|
+
var len1 = WASM_VECTOR_LEN;
|
|
205
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
206
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
207
|
+
}
|
|
208
|
+
export function __wbg___wbindgen_throw_41e9ee4f547fc59a(arg0, arg1) {
|
|
209
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
210
|
+
}
|
|
211
|
+
export function __wbg_get_31af05bd4842a84f() { return handleError(function (arg0, arg1) {
|
|
212
|
+
const ret = Reflect.get(getObject(arg0), getObject(arg1));
|
|
213
|
+
return addHeapObject(ret);
|
|
214
|
+
}, arguments); }
|
|
215
|
+
export function __wbg_new_617a8cdb8bb1130e() {
|
|
216
|
+
const ret = new Object();
|
|
217
|
+
return addHeapObject(ret);
|
|
218
|
+
}
|
|
219
|
+
export function __wbg_set_145a351398b48c65() { return handleError(function (arg0, arg1, arg2) {
|
|
220
|
+
const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
|
|
221
|
+
return ret;
|
|
222
|
+
}, arguments); }
|
|
223
|
+
export function __wbindgen_generic_0000000000000001(arg0, arg1) {
|
|
224
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
225
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
226
|
+
return addHeapObject(ret);
|
|
227
|
+
}
|
|
228
|
+
export function __wbindgen_object_drop_ref(arg0) {
|
|
229
|
+
takeObject(arg0);
|
|
230
|
+
}
|
|
231
|
+
const MarkdownStreamFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
232
|
+
? { register: () => {}, unregister: () => {} }
|
|
233
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_markdownstream_free(ptr, 1));
|
|
234
|
+
|
|
235
|
+
function addHeapObject(obj) {
|
|
236
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
237
|
+
const idx = heap_next;
|
|
238
|
+
heap_next = heap[idx];
|
|
239
|
+
|
|
240
|
+
heap[idx] = obj;
|
|
241
|
+
return idx;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
function dropObject(idx) {
|
|
245
|
+
if (idx < 1028) return;
|
|
246
|
+
heap[idx] = heap_next;
|
|
247
|
+
heap_next = idx;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
let cachedDataViewMemory0 = null;
|
|
251
|
+
function getDataViewMemory0() {
|
|
252
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
253
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
254
|
+
}
|
|
255
|
+
return cachedDataViewMemory0;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
function getStringFromWasm0(ptr, len) {
|
|
259
|
+
return decodeText(ptr >>> 0, len);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
let cachedUint8ArrayMemory0 = null;
|
|
263
|
+
function getUint8ArrayMemory0() {
|
|
264
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
265
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
266
|
+
}
|
|
267
|
+
return cachedUint8ArrayMemory0;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
function getObject(idx) { return heap[idx]; }
|
|
271
|
+
|
|
272
|
+
function handleError(f, args) {
|
|
273
|
+
try {
|
|
274
|
+
return f.apply(this, args);
|
|
275
|
+
} catch (e) {
|
|
276
|
+
wasm.__wbindgen_export3(addHeapObject(e));
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
let heap = new Array(1024).fill(undefined);
|
|
281
|
+
heap.push(undefined, null, true, false);
|
|
282
|
+
|
|
283
|
+
let heap_next = heap.length;
|
|
284
|
+
|
|
285
|
+
function isLikeNone(x) {
|
|
286
|
+
return x === undefined || x === null;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
290
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
291
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
292
|
+
WASM_VECTOR_LEN = arg.length;
|
|
293
|
+
return ptr;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
297
|
+
if (realloc === undefined) {
|
|
298
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
299
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
300
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
301
|
+
WASM_VECTOR_LEN = buf.length;
|
|
302
|
+
return ptr;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
let len = arg.length;
|
|
306
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
307
|
+
|
|
308
|
+
const mem = getUint8ArrayMemory0();
|
|
309
|
+
|
|
310
|
+
let offset = 0;
|
|
311
|
+
|
|
312
|
+
for (; offset < len; offset++) {
|
|
313
|
+
const code = arg.charCodeAt(offset);
|
|
314
|
+
if (code > 0x7F) break;
|
|
315
|
+
mem[ptr + offset] = code;
|
|
316
|
+
}
|
|
317
|
+
if (offset !== len) {
|
|
318
|
+
if (offset !== 0) {
|
|
319
|
+
arg = arg.slice(offset);
|
|
320
|
+
}
|
|
321
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
322
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
323
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
324
|
+
|
|
325
|
+
offset += ret.written;
|
|
326
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
WASM_VECTOR_LEN = offset;
|
|
330
|
+
return ptr;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
function takeObject(idx) {
|
|
334
|
+
const ret = getObject(idx);
|
|
335
|
+
dropObject(idx);
|
|
336
|
+
return ret;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
340
|
+
cachedTextDecoder.decode();
|
|
341
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
342
|
+
let numBytesDecoded = 0;
|
|
343
|
+
function decodeText(ptr, len) {
|
|
344
|
+
numBytesDecoded += len;
|
|
345
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
346
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
347
|
+
cachedTextDecoder.decode();
|
|
348
|
+
numBytesDecoded = len;
|
|
349
|
+
}
|
|
350
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
const cachedTextEncoder = new TextEncoder();
|
|
354
|
+
|
|
355
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
356
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
357
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
358
|
+
view.set(buf);
|
|
359
|
+
return {
|
|
360
|
+
read: arg.length,
|
|
361
|
+
written: buf.length
|
|
362
|
+
};
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
let WASM_VECTOR_LEN = 0;
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
let wasm;
|
|
370
|
+
export function __wbg_set_wasm(val) {
|
|
371
|
+
wasm = val;
|
|
372
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
export class MarkdownStream {
|
|
5
|
+
free(): void;
|
|
6
|
+
[Symbol.dispose](): void;
|
|
7
|
+
finish(): string;
|
|
8
|
+
constructor(options: any);
|
|
9
|
+
/**
|
|
10
|
+
* Byte chunk in, string out, skipping the transcode per chunk. A sequence
|
|
11
|
+
* split across chunks carries to the next call rather than decoding early,
|
|
12
|
+
* matching `TextDecoder({ stream: true })`; invalid bytes become U+FFFD.
|
|
13
|
+
*/
|
|
14
|
+
processChunkBytes(chunk: Uint8Array): string;
|
|
15
|
+
/**
|
|
16
|
+
* A carried byte tail cannot be completed by a string chunk, so it is
|
|
17
|
+
* flushed first. Byte and string chunks may be mixed freely.
|
|
18
|
+
*/
|
|
19
|
+
processChunk(chunk: string): string;
|
|
20
|
+
/**
|
|
21
|
+
* Frontmatter and extracted elements collected so far, as
|
|
22
|
+
* `{ frontmatter?, extracted? }`. Call after `finish()` for the complete
|
|
23
|
+
* data. Extracted elements drain on each call.
|
|
24
|
+
*/
|
|
25
|
+
takeData(): any;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Consumes the message of the panic that aborted the last export call.
|
|
30
|
+
*/
|
|
31
|
+
export function __mdreamTakePanicMessage(): string | undefined;
|
|
32
|
+
|
|
33
|
+
export function htmlToMarkdown(html: string, options: any): string;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Bytes in, string out: skips the transcode (~14% of a convert) for a
|
|
37
|
+
* caller already holding UTF-8 bytes. Encoding a string to get here
|
|
38
|
+
* measures 1-16% *slower* than [`html_to_markdown`] — only worth it when
|
|
39
|
+
* the bytes are already in hand.
|
|
40
|
+
*/
|
|
41
|
+
export function htmlToMarkdownBytes(html: Uint8Array, options: any): string;
|
|
42
|
+
|
|
43
|
+
export function htmlToMarkdownResult(html: string, options: any): any;
|
|
44
|
+
|
|
45
|
+
export function install_panic_hook(): void;
|
|
46
|
+
|
|
47
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
48
|
+
|
|
49
|
+
export interface InitOutput {
|
|
50
|
+
readonly memory: WebAssembly.Memory;
|
|
51
|
+
readonly __mdreamTakePanicMessage: (a: number) => void;
|
|
52
|
+
readonly __wbg_markdownstream_free: (a: number, b: number) => void;
|
|
53
|
+
readonly htmlToMarkdown: (a: number, b: number, c: number, d: number) => void;
|
|
54
|
+
readonly htmlToMarkdownBytes: (a: number, b: number, c: number, d: number) => void;
|
|
55
|
+
readonly htmlToMarkdownResult: (a: number, b: number, c: number) => number;
|
|
56
|
+
readonly install_panic_hook: () => void;
|
|
57
|
+
readonly markdownstream_finish: (a: number, b: number) => void;
|
|
58
|
+
readonly markdownstream_new: (a: number) => number;
|
|
59
|
+
readonly markdownstream_processChunk: (a: number, b: number, c: number, d: number) => void;
|
|
60
|
+
readonly markdownstream_processChunkBytes: (a: number, b: number, c: number, d: number) => void;
|
|
61
|
+
readonly markdownstream_takeData: (a: number) => number;
|
|
62
|
+
readonly __wbindgen_export: (a: number, b: number) => number;
|
|
63
|
+
readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
64
|
+
readonly __wbindgen_export3: (a: number) => void;
|
|
65
|
+
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
66
|
+
readonly __wbindgen_export4: (a: number, b: number, c: number) => void;
|
|
67
|
+
readonly __wbindgen_start: () => void;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
74
|
+
* a precompiled `WebAssembly.Module`.
|
|
75
|
+
*
|
|
76
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
77
|
+
*
|
|
78
|
+
* @returns {InitOutput}
|
|
79
|
+
*/
|
|
80
|
+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
84
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
85
|
+
*
|
|
86
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
87
|
+
*
|
|
88
|
+
* @returns {Promise<InitOutput>}
|
|
89
|
+
*/
|
|
90
|
+
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|