@hongdown/wasm 0.2.0-dev.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/hongdown_bg.wasm +0 -0
- package/dist/index.cjs +508 -0
- package/dist/index.d.cts +236 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +236 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +508 -0
- package/dist/index.mjs.map +1 -0
- package/dist/loader-node.cjs +17 -0
- package/dist/loader-node.d.cts +9 -0
- package/dist/loader-node.d.cts.map +1 -0
- package/dist/loader-node.d.mts +9 -0
- package/dist/loader-node.d.mts.map +1 -0
- package/dist/loader-node.mjs +18 -0
- package/dist/loader-node.mjs.map +1 -0
- package/dist/loader-web.cjs +13 -0
- package/dist/loader-web.d.cts +9 -0
- package/dist/loader-web.d.cts.map +1 -0
- package/dist/loader-web.d.mts +9 -0
- package/dist/loader-web.d.mts.map +1 -0
- package/dist/loader-web.mjs +13 -0
- package/dist/loader-web.mjs.map +1 -0
- package/package.json +79 -0
|
Binary file
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,508 @@
|
|
|
1
|
+
let _wasm_loader = require("#wasm-loader");
|
|
2
|
+
|
|
3
|
+
//#region pkg/hongdown.js
|
|
4
|
+
let wasm;
|
|
5
|
+
function addToExternrefTable0(obj) {
|
|
6
|
+
const idx = wasm.__externref_table_alloc();
|
|
7
|
+
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
8
|
+
return idx;
|
|
9
|
+
}
|
|
10
|
+
function debugString(val) {
|
|
11
|
+
const type = typeof val;
|
|
12
|
+
if (type == "number" || type == "boolean" || val == null) return `${val}`;
|
|
13
|
+
if (type == "string") return `"${val}"`;
|
|
14
|
+
if (type == "symbol") {
|
|
15
|
+
const description = val.description;
|
|
16
|
+
if (description == null) return "Symbol";
|
|
17
|
+
else return `Symbol(${description})`;
|
|
18
|
+
}
|
|
19
|
+
if (type == "function") {
|
|
20
|
+
const name = val.name;
|
|
21
|
+
if (typeof name == "string" && name.length > 0) return `Function(${name})`;
|
|
22
|
+
else return "Function";
|
|
23
|
+
}
|
|
24
|
+
if (Array.isArray(val)) {
|
|
25
|
+
const length = val.length;
|
|
26
|
+
let debug = "[";
|
|
27
|
+
if (length > 0) debug += debugString(val[0]);
|
|
28
|
+
for (let i = 1; i < length; i++) debug += ", " + debugString(val[i]);
|
|
29
|
+
debug += "]";
|
|
30
|
+
return debug;
|
|
31
|
+
}
|
|
32
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
33
|
+
let className;
|
|
34
|
+
if (builtInMatches && builtInMatches.length > 1) className = builtInMatches[1];
|
|
35
|
+
else return toString.call(val);
|
|
36
|
+
if (className == "Object") try {
|
|
37
|
+
return "Object(" + JSON.stringify(val) + ")";
|
|
38
|
+
} catch (_) {
|
|
39
|
+
return "Object";
|
|
40
|
+
}
|
|
41
|
+
if (val instanceof Error) return `${val.name}: ${val.message}\n${val.stack}`;
|
|
42
|
+
return className;
|
|
43
|
+
}
|
|
44
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
45
|
+
ptr = ptr >>> 0;
|
|
46
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
47
|
+
}
|
|
48
|
+
let cachedDataViewMemory0 = null;
|
|
49
|
+
function getDataViewMemory0() {
|
|
50
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || cachedDataViewMemory0.buffer.detached === void 0 && cachedDataViewMemory0.buffer !== wasm.memory.buffer) cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
51
|
+
return cachedDataViewMemory0;
|
|
52
|
+
}
|
|
53
|
+
function getStringFromWasm0(ptr, len) {
|
|
54
|
+
ptr = ptr >>> 0;
|
|
55
|
+
return decodeText(ptr, len);
|
|
56
|
+
}
|
|
57
|
+
let cachedUint8ArrayMemory0 = null;
|
|
58
|
+
function getUint8ArrayMemory0() {
|
|
59
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
60
|
+
return cachedUint8ArrayMemory0;
|
|
61
|
+
}
|
|
62
|
+
function handleError(f, args) {
|
|
63
|
+
try {
|
|
64
|
+
return f.apply(this, args);
|
|
65
|
+
} catch (e) {
|
|
66
|
+
const idx = addToExternrefTable0(e);
|
|
67
|
+
wasm.__wbindgen_exn_store(idx);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
function isLikeNone(x) {
|
|
71
|
+
return x === void 0 || x === null;
|
|
72
|
+
}
|
|
73
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
74
|
+
if (realloc === void 0) {
|
|
75
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
76
|
+
const ptr$1 = malloc(buf.length, 1) >>> 0;
|
|
77
|
+
getUint8ArrayMemory0().subarray(ptr$1, ptr$1 + buf.length).set(buf);
|
|
78
|
+
WASM_VECTOR_LEN = buf.length;
|
|
79
|
+
return ptr$1;
|
|
80
|
+
}
|
|
81
|
+
let len = arg.length;
|
|
82
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
83
|
+
const mem = getUint8ArrayMemory0();
|
|
84
|
+
let offset = 0;
|
|
85
|
+
for (; offset < len; offset++) {
|
|
86
|
+
const code = arg.charCodeAt(offset);
|
|
87
|
+
if (code > 127) break;
|
|
88
|
+
mem[ptr + offset] = code;
|
|
89
|
+
}
|
|
90
|
+
if (offset !== len) {
|
|
91
|
+
if (offset !== 0) arg = arg.slice(offset);
|
|
92
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
93
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
94
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
95
|
+
offset += ret.written;
|
|
96
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
97
|
+
}
|
|
98
|
+
WASM_VECTOR_LEN = offset;
|
|
99
|
+
return ptr;
|
|
100
|
+
}
|
|
101
|
+
function takeFromExternrefTable0(idx) {
|
|
102
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
103
|
+
wasm.__externref_table_dealloc(idx);
|
|
104
|
+
return value;
|
|
105
|
+
}
|
|
106
|
+
let cachedTextDecoder = new TextDecoder("utf-8", {
|
|
107
|
+
ignoreBOM: true,
|
|
108
|
+
fatal: true
|
|
109
|
+
});
|
|
110
|
+
cachedTextDecoder.decode();
|
|
111
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
112
|
+
let numBytesDecoded = 0;
|
|
113
|
+
function decodeText(ptr, len) {
|
|
114
|
+
numBytesDecoded += len;
|
|
115
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
116
|
+
cachedTextDecoder = new TextDecoder("utf-8", {
|
|
117
|
+
ignoreBOM: true,
|
|
118
|
+
fatal: true
|
|
119
|
+
});
|
|
120
|
+
cachedTextDecoder.decode();
|
|
121
|
+
numBytesDecoded = len;
|
|
122
|
+
}
|
|
123
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
124
|
+
}
|
|
125
|
+
const cachedTextEncoder = new TextEncoder();
|
|
126
|
+
if (!("encodeInto" in cachedTextEncoder)) cachedTextEncoder.encodeInto = function(arg, view) {
|
|
127
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
128
|
+
view.set(buf);
|
|
129
|
+
return {
|
|
130
|
+
read: arg.length,
|
|
131
|
+
written: buf.length
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
let WASM_VECTOR_LEN = 0;
|
|
135
|
+
/**
|
|
136
|
+
* Format Markdown according to Hong Minhee's style conventions.
|
|
137
|
+
*
|
|
138
|
+
* # Arguments
|
|
139
|
+
*
|
|
140
|
+
* * `input` - Markdown source to format
|
|
141
|
+
* * `options` - Optional formatting options as a JavaScript object
|
|
142
|
+
*
|
|
143
|
+
* # Returns
|
|
144
|
+
*
|
|
145
|
+
* The formatted Markdown string.
|
|
146
|
+
* @param {string} input
|
|
147
|
+
* @param {any} options
|
|
148
|
+
* @returns {string}
|
|
149
|
+
*/
|
|
150
|
+
function format$1(input, options) {
|
|
151
|
+
let deferred3_0;
|
|
152
|
+
let deferred3_1;
|
|
153
|
+
try {
|
|
154
|
+
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
155
|
+
const len0 = WASM_VECTOR_LEN;
|
|
156
|
+
const ret = wasm.format(ptr0, len0, options);
|
|
157
|
+
var ptr2 = ret[0];
|
|
158
|
+
var len2 = ret[1];
|
|
159
|
+
if (ret[3]) {
|
|
160
|
+
ptr2 = 0;
|
|
161
|
+
len2 = 0;
|
|
162
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
163
|
+
}
|
|
164
|
+
deferred3_0 = ptr2;
|
|
165
|
+
deferred3_1 = len2;
|
|
166
|
+
return getStringFromWasm0(ptr2, len2);
|
|
167
|
+
} finally {
|
|
168
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Format Markdown and return both output and warnings.
|
|
173
|
+
*
|
|
174
|
+
* # Arguments
|
|
175
|
+
*
|
|
176
|
+
* * `input` - Markdown source to format
|
|
177
|
+
* * `options` - Optional formatting options as a JavaScript object
|
|
178
|
+
*
|
|
179
|
+
* # Returns
|
|
180
|
+
*
|
|
181
|
+
* An object with `output` (formatted string) and `warnings` (array of warning objects).
|
|
182
|
+
* @param {string} input
|
|
183
|
+
* @param {any} options
|
|
184
|
+
* @returns {any}
|
|
185
|
+
*/
|
|
186
|
+
function formatWithWarnings$1(input, options) {
|
|
187
|
+
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
188
|
+
const len0 = WASM_VECTOR_LEN;
|
|
189
|
+
const ret = wasm.formatWithWarnings(ptr0, len0, options);
|
|
190
|
+
if (ret[2]) throw takeFromExternrefTable0(ret[1]);
|
|
191
|
+
return takeFromExternrefTable0(ret[0]);
|
|
192
|
+
}
|
|
193
|
+
const EXPECTED_RESPONSE_TYPES = new Set([
|
|
194
|
+
"basic",
|
|
195
|
+
"cors",
|
|
196
|
+
"default"
|
|
197
|
+
]);
|
|
198
|
+
async function __wbg_load(module$1, imports) {
|
|
199
|
+
if (typeof Response === "function" && module$1 instanceof Response) {
|
|
200
|
+
if (typeof WebAssembly.instantiateStreaming === "function") try {
|
|
201
|
+
return await WebAssembly.instantiateStreaming(module$1, imports);
|
|
202
|
+
} catch (e) {
|
|
203
|
+
if (module$1.ok && EXPECTED_RESPONSE_TYPES.has(module$1.type) && module$1.headers.get("Content-Type") !== "application/wasm") console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
|
|
204
|
+
else throw e;
|
|
205
|
+
}
|
|
206
|
+
const bytes = await module$1.arrayBuffer();
|
|
207
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
208
|
+
} else {
|
|
209
|
+
const instance = await WebAssembly.instantiate(module$1, imports);
|
|
210
|
+
if (instance instanceof WebAssembly.Instance) return {
|
|
211
|
+
instance,
|
|
212
|
+
module: module$1
|
|
213
|
+
};
|
|
214
|
+
else return instance;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
function __wbg_get_imports() {
|
|
218
|
+
const imports = {};
|
|
219
|
+
imports.wbg = {};
|
|
220
|
+
imports.wbg.__wbg_Error_52673b7de5a0ca89 = function(arg0, arg1) {
|
|
221
|
+
return Error(getStringFromWasm0(arg0, arg1));
|
|
222
|
+
};
|
|
223
|
+
imports.wbg.__wbg_Number_2d1dcfcf4ec51736 = function(arg0) {
|
|
224
|
+
return Number(arg0);
|
|
225
|
+
};
|
|
226
|
+
imports.wbg.__wbg_String_8f0eb39a4a4c2f66 = function(arg0, arg1) {
|
|
227
|
+
const ptr1 = passStringToWasm0(String(arg1), wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
228
|
+
const len1 = WASM_VECTOR_LEN;
|
|
229
|
+
getDataViewMemory0().setInt32(arg0 + 4, len1, true);
|
|
230
|
+
getDataViewMemory0().setInt32(arg0 + 0, ptr1, true);
|
|
231
|
+
};
|
|
232
|
+
imports.wbg.__wbg___wbindgen_bigint_get_as_i64_6e32f5e6aff02e1d = function(arg0, arg1) {
|
|
233
|
+
const v = arg1;
|
|
234
|
+
const ret = typeof v === "bigint" ? v : void 0;
|
|
235
|
+
getDataViewMemory0().setBigInt64(arg0 + 8, isLikeNone(ret) ? BigInt(0) : ret, true);
|
|
236
|
+
getDataViewMemory0().setInt32(arg0 + 0, !isLikeNone(ret), true);
|
|
237
|
+
};
|
|
238
|
+
imports.wbg.__wbg___wbindgen_boolean_get_dea25b33882b895b = function(arg0) {
|
|
239
|
+
const v = arg0;
|
|
240
|
+
const ret = typeof v === "boolean" ? v : void 0;
|
|
241
|
+
return isLikeNone(ret) ? 16777215 : ret ? 1 : 0;
|
|
242
|
+
};
|
|
243
|
+
imports.wbg.__wbg___wbindgen_debug_string_adfb662ae34724b6 = function(arg0, arg1) {
|
|
244
|
+
const ptr1 = passStringToWasm0(debugString(arg1), wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
245
|
+
const len1 = WASM_VECTOR_LEN;
|
|
246
|
+
getDataViewMemory0().setInt32(arg0 + 4, len1, true);
|
|
247
|
+
getDataViewMemory0().setInt32(arg0 + 0, ptr1, true);
|
|
248
|
+
};
|
|
249
|
+
imports.wbg.__wbg___wbindgen_in_0d3e1e8f0c669317 = function(arg0, arg1) {
|
|
250
|
+
return arg0 in arg1;
|
|
251
|
+
};
|
|
252
|
+
imports.wbg.__wbg___wbindgen_is_bigint_0e1a2e3f55cfae27 = function(arg0) {
|
|
253
|
+
return typeof arg0 === "bigint";
|
|
254
|
+
};
|
|
255
|
+
imports.wbg.__wbg___wbindgen_is_function_8d400b8b1af978cd = function(arg0) {
|
|
256
|
+
return typeof arg0 === "function";
|
|
257
|
+
};
|
|
258
|
+
imports.wbg.__wbg___wbindgen_is_null_dfda7d66506c95b5 = function(arg0) {
|
|
259
|
+
return arg0 === null;
|
|
260
|
+
};
|
|
261
|
+
imports.wbg.__wbg___wbindgen_is_object_ce774f3490692386 = function(arg0) {
|
|
262
|
+
const val = arg0;
|
|
263
|
+
return typeof val === "object" && val !== null;
|
|
264
|
+
};
|
|
265
|
+
imports.wbg.__wbg___wbindgen_is_undefined_f6b95eab589e0269 = function(arg0) {
|
|
266
|
+
return arg0 === void 0;
|
|
267
|
+
};
|
|
268
|
+
imports.wbg.__wbg___wbindgen_jsval_eq_b6101cc9cef1fe36 = function(arg0, arg1) {
|
|
269
|
+
return arg0 === arg1;
|
|
270
|
+
};
|
|
271
|
+
imports.wbg.__wbg___wbindgen_jsval_loose_eq_766057600fdd1b0d = function(arg0, arg1) {
|
|
272
|
+
return arg0 == arg1;
|
|
273
|
+
};
|
|
274
|
+
imports.wbg.__wbg___wbindgen_number_get_9619185a74197f95 = function(arg0, arg1) {
|
|
275
|
+
const obj = arg1;
|
|
276
|
+
const ret = typeof obj === "number" ? obj : void 0;
|
|
277
|
+
getDataViewMemory0().setFloat64(arg0 + 8, isLikeNone(ret) ? 0 : ret, true);
|
|
278
|
+
getDataViewMemory0().setInt32(arg0 + 0, !isLikeNone(ret), true);
|
|
279
|
+
};
|
|
280
|
+
imports.wbg.__wbg___wbindgen_string_get_a2a31e16edf96e42 = function(arg0, arg1) {
|
|
281
|
+
const obj = arg1;
|
|
282
|
+
const ret = typeof obj === "string" ? obj : void 0;
|
|
283
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
284
|
+
var len1 = WASM_VECTOR_LEN;
|
|
285
|
+
getDataViewMemory0().setInt32(arg0 + 4, len1, true);
|
|
286
|
+
getDataViewMemory0().setInt32(arg0 + 0, ptr1, true);
|
|
287
|
+
};
|
|
288
|
+
imports.wbg.__wbg___wbindgen_throw_dd24417ed36fc46e = function(arg0, arg1) {
|
|
289
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
290
|
+
};
|
|
291
|
+
imports.wbg.__wbg_call_abb4ff46ce38be40 = function() {
|
|
292
|
+
return handleError(function(arg0, arg1) {
|
|
293
|
+
return arg0.call(arg1);
|
|
294
|
+
}, arguments);
|
|
295
|
+
};
|
|
296
|
+
imports.wbg.__wbg_done_62ea16af4ce34b24 = function(arg0) {
|
|
297
|
+
return arg0.done;
|
|
298
|
+
};
|
|
299
|
+
imports.wbg.__wbg_entries_83c79938054e065f = function(arg0) {
|
|
300
|
+
return Object.entries(arg0);
|
|
301
|
+
};
|
|
302
|
+
imports.wbg.__wbg_get_6b7bd52aca3f9671 = function(arg0, arg1) {
|
|
303
|
+
return arg0[arg1 >>> 0];
|
|
304
|
+
};
|
|
305
|
+
imports.wbg.__wbg_get_af9dab7e9603ea93 = function() {
|
|
306
|
+
return handleError(function(arg0, arg1) {
|
|
307
|
+
return Reflect.get(arg0, arg1);
|
|
308
|
+
}, arguments);
|
|
309
|
+
};
|
|
310
|
+
imports.wbg.__wbg_get_with_ref_key_1dc361bd10053bfe = function(arg0, arg1) {
|
|
311
|
+
return arg0[arg1];
|
|
312
|
+
};
|
|
313
|
+
imports.wbg.__wbg_instanceof_ArrayBuffer_f3320d2419cd0355 = function(arg0) {
|
|
314
|
+
let result;
|
|
315
|
+
try {
|
|
316
|
+
result = arg0 instanceof ArrayBuffer;
|
|
317
|
+
} catch (_) {
|
|
318
|
+
result = false;
|
|
319
|
+
}
|
|
320
|
+
return result;
|
|
321
|
+
};
|
|
322
|
+
imports.wbg.__wbg_instanceof_Map_084be8da74364158 = function(arg0) {
|
|
323
|
+
let result;
|
|
324
|
+
try {
|
|
325
|
+
result = arg0 instanceof Map;
|
|
326
|
+
} catch (_) {
|
|
327
|
+
result = false;
|
|
328
|
+
}
|
|
329
|
+
return result;
|
|
330
|
+
};
|
|
331
|
+
imports.wbg.__wbg_instanceof_Uint8Array_da54ccc9d3e09434 = function(arg0) {
|
|
332
|
+
let result;
|
|
333
|
+
try {
|
|
334
|
+
result = arg0 instanceof Uint8Array;
|
|
335
|
+
} catch (_) {
|
|
336
|
+
result = false;
|
|
337
|
+
}
|
|
338
|
+
return result;
|
|
339
|
+
};
|
|
340
|
+
imports.wbg.__wbg_isArray_51fd9e6422c0a395 = function(arg0) {
|
|
341
|
+
return Array.isArray(arg0);
|
|
342
|
+
};
|
|
343
|
+
imports.wbg.__wbg_isSafeInteger_ae7d3f054d55fa16 = function(arg0) {
|
|
344
|
+
return Number.isSafeInteger(arg0);
|
|
345
|
+
};
|
|
346
|
+
imports.wbg.__wbg_iterator_27b7c8b35ab3e86b = function() {
|
|
347
|
+
return Symbol.iterator;
|
|
348
|
+
};
|
|
349
|
+
imports.wbg.__wbg_length_22ac23eaec9d8053 = function(arg0) {
|
|
350
|
+
return arg0.length;
|
|
351
|
+
};
|
|
352
|
+
imports.wbg.__wbg_length_d45040a40c570362 = function(arg0) {
|
|
353
|
+
return arg0.length;
|
|
354
|
+
};
|
|
355
|
+
imports.wbg.__wbg_new_1ba21ce319a06297 = function() {
|
|
356
|
+
return /* @__PURE__ */ new Object();
|
|
357
|
+
};
|
|
358
|
+
imports.wbg.__wbg_new_25f239778d6112b9 = function() {
|
|
359
|
+
return new Array();
|
|
360
|
+
};
|
|
361
|
+
imports.wbg.__wbg_new_6421f6084cc5bc5a = function(arg0) {
|
|
362
|
+
return new Uint8Array(arg0);
|
|
363
|
+
};
|
|
364
|
+
imports.wbg.__wbg_next_138a17bbf04e926c = function(arg0) {
|
|
365
|
+
return arg0.next;
|
|
366
|
+
};
|
|
367
|
+
imports.wbg.__wbg_next_3cfe5c0fe2a4cc53 = function() {
|
|
368
|
+
return handleError(function(arg0) {
|
|
369
|
+
return arg0.next();
|
|
370
|
+
}, arguments);
|
|
371
|
+
};
|
|
372
|
+
imports.wbg.__wbg_prototypesetcall_dfe9b766cdc1f1fd = function(arg0, arg1, arg2) {
|
|
373
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
374
|
+
};
|
|
375
|
+
imports.wbg.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
|
|
376
|
+
arg0[arg1] = arg2;
|
|
377
|
+
};
|
|
378
|
+
imports.wbg.__wbg_set_7df433eea03a5c14 = function(arg0, arg1, arg2) {
|
|
379
|
+
arg0[arg1 >>> 0] = arg2;
|
|
380
|
+
};
|
|
381
|
+
imports.wbg.__wbg_value_57b7b035e117f7ee = function(arg0) {
|
|
382
|
+
return arg0.value;
|
|
383
|
+
};
|
|
384
|
+
imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
|
|
385
|
+
return getStringFromWasm0(arg0, arg1);
|
|
386
|
+
};
|
|
387
|
+
imports.wbg.__wbindgen_cast_4625c577ab2ec9ee = function(arg0) {
|
|
388
|
+
return BigInt.asUintN(64, arg0);
|
|
389
|
+
};
|
|
390
|
+
imports.wbg.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
|
|
391
|
+
return arg0;
|
|
392
|
+
};
|
|
393
|
+
imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
|
|
394
|
+
return arg0;
|
|
395
|
+
};
|
|
396
|
+
imports.wbg.__wbindgen_init_externref_table = function() {
|
|
397
|
+
const table = wasm.__wbindgen_externrefs;
|
|
398
|
+
const offset = table.grow(4);
|
|
399
|
+
table.set(0, void 0);
|
|
400
|
+
table.set(offset + 0, void 0);
|
|
401
|
+
table.set(offset + 1, null);
|
|
402
|
+
table.set(offset + 2, true);
|
|
403
|
+
table.set(offset + 3, false);
|
|
404
|
+
};
|
|
405
|
+
return imports;
|
|
406
|
+
}
|
|
407
|
+
function __wbg_finalize_init(instance, module$1) {
|
|
408
|
+
wasm = instance.exports;
|
|
409
|
+
__wbg_init.__wbindgen_wasm_module = module$1;
|
|
410
|
+
cachedDataViewMemory0 = null;
|
|
411
|
+
cachedUint8ArrayMemory0 = null;
|
|
412
|
+
wasm.__wbindgen_start();
|
|
413
|
+
return wasm;
|
|
414
|
+
}
|
|
415
|
+
async function __wbg_init(module_or_path) {
|
|
416
|
+
if (wasm !== void 0) return wasm;
|
|
417
|
+
if (typeof module_or_path !== "undefined") if (Object.getPrototypeOf(module_or_path) === Object.prototype) ({module_or_path} = module_or_path);
|
|
418
|
+
else console.warn("using deprecated parameters for the initialization function; pass a single object instead");
|
|
419
|
+
if (typeof module_or_path === "undefined") module_or_path = new URL("hongdown_bg.wasm", require("url").pathToFileURL(__filename).href);
|
|
420
|
+
const imports = __wbg_get_imports();
|
|
421
|
+
if (typeof module_or_path === "string" || typeof Request === "function" && module_or_path instanceof Request || typeof URL === "function" && module_or_path instanceof URL) module_or_path = fetch(module_or_path);
|
|
422
|
+
const { instance, module: module$1 } = await __wbg_load(await module_or_path, imports);
|
|
423
|
+
return __wbg_finalize_init(instance, module$1);
|
|
424
|
+
}
|
|
425
|
+
var hongdown_default = __wbg_init;
|
|
426
|
+
|
|
427
|
+
//#endregion
|
|
428
|
+
//#region src/index.ts
|
|
429
|
+
let initialized = false;
|
|
430
|
+
let initPromise = null;
|
|
431
|
+
/**
|
|
432
|
+
* Ensure the WASM module is initialized.
|
|
433
|
+
* @internal
|
|
434
|
+
*/
|
|
435
|
+
async function ensureInitialized() {
|
|
436
|
+
if (initialized) return;
|
|
437
|
+
if (!initPromise) initPromise = (async () => {
|
|
438
|
+
await hongdown_default({ module_or_path: await (0, _wasm_loader.loadWasmBuffer)() });
|
|
439
|
+
initialized = true;
|
|
440
|
+
})();
|
|
441
|
+
await initPromise;
|
|
442
|
+
}
|
|
443
|
+
/**
|
|
444
|
+
* Format Markdown according to Hong Minhee's style conventions.
|
|
445
|
+
*
|
|
446
|
+
* This function supports formatting directives embedded in HTML comments:
|
|
447
|
+
*
|
|
448
|
+
* - `<!-- hongdown-disable-file -->` - Disable formatting for the entire file.
|
|
449
|
+
* - `<!-- hongdown-disable-next-line -->` - Disable formatting for the next block.
|
|
450
|
+
* - `<!-- hongdown-disable-next-section -->` - Disable formatting until the next
|
|
451
|
+
* section heading.
|
|
452
|
+
* - `<!-- hongdown-disable -->` - Disable formatting from this point.
|
|
453
|
+
* - `<!-- hongdown-enable -->` - Re-enable formatting.
|
|
454
|
+
*
|
|
455
|
+
* @param input - Markdown source to format
|
|
456
|
+
* @param options - Formatting options (all optional)
|
|
457
|
+
* @returns The formatted Markdown string
|
|
458
|
+
*
|
|
459
|
+
* @example
|
|
460
|
+
* ```typescript
|
|
461
|
+
* import { format } from "@hongdown/wasm";
|
|
462
|
+
*
|
|
463
|
+
* // Basic usage
|
|
464
|
+
* const result = await format("# Hello\nWorld");
|
|
465
|
+
*
|
|
466
|
+
* // With options
|
|
467
|
+
* const result = await format(markdown, {
|
|
468
|
+
* lineWidth: 100,
|
|
469
|
+
* setextH1: false,
|
|
470
|
+
* fenceChar: "`",
|
|
471
|
+
* });
|
|
472
|
+
* ```
|
|
473
|
+
*/
|
|
474
|
+
async function format(input, options = {}) {
|
|
475
|
+
await ensureInitialized();
|
|
476
|
+
return format$1(input, options);
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
* Format Markdown and return both output and warnings.
|
|
480
|
+
*
|
|
481
|
+
* This is similar to {@link format}, but also returns any warnings generated
|
|
482
|
+
* during formatting (e.g., inconsistent table column counts).
|
|
483
|
+
*
|
|
484
|
+
* @param input - Markdown source to format
|
|
485
|
+
* @param options - Formatting options (all optional)
|
|
486
|
+
* @returns Object with formatted output and any warnings
|
|
487
|
+
*
|
|
488
|
+
* @example
|
|
489
|
+
* ```typescript
|
|
490
|
+
* import { formatWithWarnings } from "@hongdown/wasm";
|
|
491
|
+
*
|
|
492
|
+
* const { output, warnings } = await formatWithWarnings(markdown);
|
|
493
|
+
*
|
|
494
|
+
* if (warnings.length > 0) {
|
|
495
|
+
* for (const warning of warnings) {
|
|
496
|
+
* console.warn(`Line ${warning.line}: ${warning.message}`);
|
|
497
|
+
* }
|
|
498
|
+
* }
|
|
499
|
+
* ```
|
|
500
|
+
*/
|
|
501
|
+
async function formatWithWarnings(input, options = {}) {
|
|
502
|
+
await ensureInitialized();
|
|
503
|
+
return formatWithWarnings$1(input, options);
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
//#endregion
|
|
507
|
+
exports.format = format;
|
|
508
|
+
exports.formatWithWarnings = formatWithWarnings;
|