inkspan 0.0.0-stage → 0.1.0-beta.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.
@@ -0,0 +1,277 @@
1
+ // Generated by scripts/build.mjs from wasm-bindgen output.
2
+ export function createEngine() {
3
+ /**
4
+ * @param {string} source
5
+ * @param {boolean} mdx
6
+ * @param {string[]} ignored
7
+ * @returns {string | undefined}
8
+ */
9
+ function outline(source, mdx, ignored) {
10
+ const ptr0 = passStringToWasm0(source, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
11
+ const len0 = WASM_VECTOR_LEN;
12
+ const ptr1 = passArrayJsValueToWasm0(ignored, wasm.__wbindgen_malloc);
13
+ const len1 = WASM_VECTOR_LEN;
14
+ const ret = wasm.outline(ptr0, len0, mdx, ptr1, len1);
15
+ let v3;
16
+ if (ret[0] !== 0) {
17
+ v3 = getStringFromWasm0(ret[0], ret[1]);
18
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
19
+ }
20
+ return v3;
21
+ }
22
+
23
+ /**
24
+ * @param {string} source
25
+ * @param {boolean} mdx
26
+ * @param {boolean} components
27
+ * @param {string[]} names
28
+ * @param {boolean} fences
29
+ * @returns {string | undefined}
30
+ */
31
+ function structural_index(source, mdx, components, names, fences) {
32
+ const ptr0 = passStringToWasm0(source, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
33
+ const len0 = WASM_VECTOR_LEN;
34
+ const ptr1 = passArrayJsValueToWasm0(names, wasm.__wbindgen_malloc);
35
+ const len1 = WASM_VECTOR_LEN;
36
+ const ret = wasm.structural_index(ptr0, len0, mdx, components, ptr1, len1, fences);
37
+ let v3;
38
+ if (ret[0] !== 0) {
39
+ v3 = getStringFromWasm0(ret[0], ret[1]);
40
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
41
+ }
42
+ return v3;
43
+ }
44
+ function __wbg_get_imports() {
45
+ const import0 = {
46
+ __proto__: null,
47
+ __wbg___wbindgen_string_get_92ab86bb19cbc12f: function(arg0, arg1) {
48
+ const obj = arg1;
49
+ const ret = typeof(obj) === 'string' ? obj : undefined;
50
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
51
+ var len1 = WASM_VECTOR_LEN;
52
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
53
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
54
+ },
55
+ __wbg___wbindgen_throw_5d9e815e6fdf150f: function(arg0, arg1) {
56
+ throw new Error(getStringFromWasm0(arg0, arg1));
57
+ },
58
+ __wbindgen_init_externref_table: function() {
59
+ const table = wasm.__wbindgen_externrefs;
60
+ const offset = table.grow(4);
61
+ table.set(0, undefined);
62
+ table.set(offset + 0, undefined);
63
+ table.set(offset + 1, null);
64
+ table.set(offset + 2, true);
65
+ table.set(offset + 3, false);
66
+ },
67
+ };
68
+ return {
69
+ __proto__: null,
70
+ "./engine_bg.js": import0,
71
+ };
72
+ }
73
+
74
+ function addToExternrefTable0(obj) {
75
+ const idx = wasm.__externref_table_alloc();
76
+ wasm.__wbindgen_externrefs.set(idx, obj);
77
+ return idx;
78
+ }
79
+
80
+ let cachedDataViewMemory0 = null;
81
+ function getDataViewMemory0() {
82
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
83
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
84
+ }
85
+ return cachedDataViewMemory0;
86
+ }
87
+
88
+ function getStringFromWasm0(ptr, len) {
89
+ return decodeText(ptr >>> 0, len);
90
+ }
91
+
92
+ let cachedUint8ArrayMemory0 = null;
93
+ function getUint8ArrayMemory0() {
94
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
95
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
96
+ }
97
+ return cachedUint8ArrayMemory0;
98
+ }
99
+
100
+ function isLikeNone(x) {
101
+ return x === undefined || x === null;
102
+ }
103
+
104
+ function passArrayJsValueToWasm0(array, malloc) {
105
+ const ptr = malloc(array.length * 4, 4) >>> 0;
106
+ for (let i = 0; i < array.length; i++) {
107
+ const add = addToExternrefTable0(array[i]);
108
+ getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
109
+ }
110
+ WASM_VECTOR_LEN = array.length;
111
+ return ptr;
112
+ }
113
+
114
+ function passStringToWasm0(arg, malloc, realloc) {
115
+ if (realloc === undefined) {
116
+ const buf = cachedTextEncoder.encode(arg);
117
+ const ptr = malloc(buf.length, 1) >>> 0;
118
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
119
+ WASM_VECTOR_LEN = buf.length;
120
+ return ptr;
121
+ }
122
+
123
+ let len = arg.length;
124
+ let ptr = malloc(len, 1) >>> 0;
125
+
126
+ const mem = getUint8ArrayMemory0();
127
+
128
+ let offset = 0;
129
+
130
+ for (; offset < len; offset++) {
131
+ const code = arg.charCodeAt(offset);
132
+ if (code > 0x7F) break;
133
+ mem[ptr + offset] = code;
134
+ }
135
+ if (offset !== len) {
136
+ if (offset !== 0) {
137
+ arg = arg.slice(offset);
138
+ }
139
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
140
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
141
+ const ret = cachedTextEncoder.encodeInto(arg, view);
142
+
143
+ offset += ret.written;
144
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
145
+ }
146
+
147
+ WASM_VECTOR_LEN = offset;
148
+ return ptr;
149
+ }
150
+
151
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
152
+ cachedTextDecoder.decode();
153
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
154
+ let numBytesDecoded = 0;
155
+ function decodeText(ptr, len) {
156
+ numBytesDecoded += len;
157
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
158
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
159
+ cachedTextDecoder.decode();
160
+ numBytesDecoded = len;
161
+ }
162
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
163
+ }
164
+
165
+ const cachedTextEncoder = new TextEncoder();
166
+
167
+ if (!('encodeInto' in cachedTextEncoder)) {
168
+ cachedTextEncoder.encodeInto = function (arg, view) {
169
+ const buf = cachedTextEncoder.encode(arg);
170
+ view.set(buf);
171
+ return {
172
+ read: arg.length,
173
+ written: buf.length
174
+ };
175
+ };
176
+ }
177
+
178
+ let WASM_VECTOR_LEN = 0;
179
+
180
+ let wasmModule, wasmInstance, wasm;
181
+ function __wbg_finalize_init(instance, module) {
182
+ wasmInstance = instance;
183
+ wasm = instance.exports;
184
+ wasmModule = module;
185
+ cachedDataViewMemory0 = null;
186
+ cachedUint8ArrayMemory0 = null;
187
+ wasm.__wbindgen_start();
188
+ return wasm;
189
+ }
190
+
191
+ async function __wbg_load(module, imports) {
192
+ if (typeof Response === 'function' && module instanceof Response) {
193
+ if (!module.ok) {
194
+ throw new Error(`failed to fetch Wasm: ${module.status} ${module.statusText} fetching '${module.url}'`);
195
+ }
196
+
197
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
198
+ try {
199
+ return await WebAssembly.instantiateStreaming(module, imports);
200
+ } catch (e) {
201
+ const validResponse = expectedResponseType(module.type);
202
+
203
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
204
+ 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);
205
+
206
+ } else { throw e; }
207
+ }
208
+ }
209
+
210
+ const bytes = await module.arrayBuffer();
211
+ return await WebAssembly.instantiate(bytes, imports);
212
+ } else {
213
+ const instance = await WebAssembly.instantiate(module, imports);
214
+
215
+ if (instance instanceof WebAssembly.Instance) {
216
+ return { instance, module };
217
+ } else {
218
+ return instance;
219
+ }
220
+ }
221
+
222
+ function expectedResponseType(type) {
223
+ switch (type) {
224
+ case 'basic': case 'cors': case 'default': return true;
225
+ }
226
+ return false;
227
+ }
228
+ }
229
+
230
+ function initSync(module) {
231
+ if (wasm !== undefined) return wasm;
232
+
233
+
234
+ if (module !== undefined) {
235
+ if (Object.getPrototypeOf(module) === Object.prototype) {
236
+ ({module} = module)
237
+ } else {
238
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
239
+ }
240
+ }
241
+
242
+ const imports = __wbg_get_imports();
243
+ if (!(module instanceof WebAssembly.Module)) {
244
+ module = new WebAssembly.Module(module);
245
+ }
246
+ const instance = new WebAssembly.Instance(module, imports);
247
+ return __wbg_finalize_init(instance, module);
248
+ }
249
+
250
+ async function __wbg_init(module_or_path) {
251
+ if (wasm !== undefined) return wasm;
252
+
253
+
254
+ if (module_or_path !== undefined) {
255
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
256
+ ({module_or_path} = module_or_path)
257
+ } else {
258
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
259
+ }
260
+ }
261
+
262
+
263
+ const imports = __wbg_get_imports();
264
+
265
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
266
+ module_or_path = fetch(module_or_path);
267
+ }
268
+
269
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
270
+
271
+ return __wbg_finalize_init(instance, module);
272
+ }
273
+
274
+
275
+
276
+ return { init: __wbg_init, outline, structural_index };
277
+ }
@@ -0,0 +1,272 @@
1
+ /**
2
+ * @param {string} source
3
+ * @param {boolean} mdx
4
+ * @param {string[]} ignored
5
+ * @returns {string | undefined}
6
+ */
7
+ export function outline(source, mdx, ignored) {
8
+ const ptr0 = passStringToWasm0(source, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
9
+ const len0 = WASM_VECTOR_LEN;
10
+ const ptr1 = passArrayJsValueToWasm0(ignored, wasm.__wbindgen_malloc);
11
+ const len1 = WASM_VECTOR_LEN;
12
+ const ret = wasm.outline(ptr0, len0, mdx, ptr1, len1);
13
+ let v3;
14
+ if (ret[0] !== 0) {
15
+ v3 = getStringFromWasm0(ret[0], ret[1]);
16
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
17
+ }
18
+ return v3;
19
+ }
20
+
21
+ /**
22
+ * @param {string} source
23
+ * @param {boolean} mdx
24
+ * @param {boolean} components
25
+ * @param {string[]} names
26
+ * @param {boolean} fences
27
+ * @returns {string | undefined}
28
+ */
29
+ export function structural_index(source, mdx, components, names, fences) {
30
+ const ptr0 = passStringToWasm0(source, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
31
+ const len0 = WASM_VECTOR_LEN;
32
+ const ptr1 = passArrayJsValueToWasm0(names, wasm.__wbindgen_malloc);
33
+ const len1 = WASM_VECTOR_LEN;
34
+ const ret = wasm.structural_index(ptr0, len0, mdx, components, ptr1, len1, fences);
35
+ let v3;
36
+ if (ret[0] !== 0) {
37
+ v3 = getStringFromWasm0(ret[0], ret[1]);
38
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
39
+ }
40
+ return v3;
41
+ }
42
+ function __wbg_get_imports() {
43
+ const import0 = {
44
+ __proto__: null,
45
+ __wbg___wbindgen_string_get_92ab86bb19cbc12f: function(arg0, arg1) {
46
+ const obj = arg1;
47
+ const ret = typeof(obj) === 'string' ? obj : undefined;
48
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
49
+ var len1 = WASM_VECTOR_LEN;
50
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
51
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
52
+ },
53
+ __wbg___wbindgen_throw_5d9e815e6fdf150f: function(arg0, arg1) {
54
+ throw new Error(getStringFromWasm0(arg0, arg1));
55
+ },
56
+ __wbindgen_init_externref_table: function() {
57
+ const table = wasm.__wbindgen_externrefs;
58
+ const offset = table.grow(4);
59
+ table.set(0, undefined);
60
+ table.set(offset + 0, undefined);
61
+ table.set(offset + 1, null);
62
+ table.set(offset + 2, true);
63
+ table.set(offset + 3, false);
64
+ },
65
+ };
66
+ return {
67
+ __proto__: null,
68
+ "./engine_bg.js": import0,
69
+ };
70
+ }
71
+
72
+ function addToExternrefTable0(obj) {
73
+ const idx = wasm.__externref_table_alloc();
74
+ wasm.__wbindgen_externrefs.set(idx, obj);
75
+ return idx;
76
+ }
77
+
78
+ let cachedDataViewMemory0 = null;
79
+ function getDataViewMemory0() {
80
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
81
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
82
+ }
83
+ return cachedDataViewMemory0;
84
+ }
85
+
86
+ function getStringFromWasm0(ptr, len) {
87
+ return decodeText(ptr >>> 0, len);
88
+ }
89
+
90
+ let cachedUint8ArrayMemory0 = null;
91
+ function getUint8ArrayMemory0() {
92
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
93
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
94
+ }
95
+ return cachedUint8ArrayMemory0;
96
+ }
97
+
98
+ function isLikeNone(x) {
99
+ return x === undefined || x === null;
100
+ }
101
+
102
+ function passArrayJsValueToWasm0(array, malloc) {
103
+ const ptr = malloc(array.length * 4, 4) >>> 0;
104
+ for (let i = 0; i < array.length; i++) {
105
+ const add = addToExternrefTable0(array[i]);
106
+ getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
107
+ }
108
+ WASM_VECTOR_LEN = array.length;
109
+ return ptr;
110
+ }
111
+
112
+ function passStringToWasm0(arg, malloc, realloc) {
113
+ if (realloc === undefined) {
114
+ const buf = cachedTextEncoder.encode(arg);
115
+ const ptr = malloc(buf.length, 1) >>> 0;
116
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
117
+ WASM_VECTOR_LEN = buf.length;
118
+ return ptr;
119
+ }
120
+
121
+ let len = arg.length;
122
+ let ptr = malloc(len, 1) >>> 0;
123
+
124
+ const mem = getUint8ArrayMemory0();
125
+
126
+ let offset = 0;
127
+
128
+ for (; offset < len; offset++) {
129
+ const code = arg.charCodeAt(offset);
130
+ if (code > 0x7F) break;
131
+ mem[ptr + offset] = code;
132
+ }
133
+ if (offset !== len) {
134
+ if (offset !== 0) {
135
+ arg = arg.slice(offset);
136
+ }
137
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
138
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
139
+ const ret = cachedTextEncoder.encodeInto(arg, view);
140
+
141
+ offset += ret.written;
142
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
143
+ }
144
+
145
+ WASM_VECTOR_LEN = offset;
146
+ return ptr;
147
+ }
148
+
149
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
150
+ cachedTextDecoder.decode();
151
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
152
+ let numBytesDecoded = 0;
153
+ function decodeText(ptr, len) {
154
+ numBytesDecoded += len;
155
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
156
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
157
+ cachedTextDecoder.decode();
158
+ numBytesDecoded = len;
159
+ }
160
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
161
+ }
162
+
163
+ const cachedTextEncoder = new TextEncoder();
164
+
165
+ if (!('encodeInto' in cachedTextEncoder)) {
166
+ cachedTextEncoder.encodeInto = function (arg, view) {
167
+ const buf = cachedTextEncoder.encode(arg);
168
+ view.set(buf);
169
+ return {
170
+ read: arg.length,
171
+ written: buf.length
172
+ };
173
+ };
174
+ }
175
+
176
+ let WASM_VECTOR_LEN = 0;
177
+
178
+ let wasmModule, wasmInstance, wasm;
179
+ function __wbg_finalize_init(instance, module) {
180
+ wasmInstance = instance;
181
+ wasm = instance.exports;
182
+ wasmModule = module;
183
+ cachedDataViewMemory0 = null;
184
+ cachedUint8ArrayMemory0 = null;
185
+ wasm.__wbindgen_start();
186
+ return wasm;
187
+ }
188
+
189
+ async function __wbg_load(module, imports) {
190
+ if (typeof Response === 'function' && module instanceof Response) {
191
+ if (!module.ok) {
192
+ throw new Error(`failed to fetch Wasm: ${module.status} ${module.statusText} fetching '${module.url}'`);
193
+ }
194
+
195
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
196
+ try {
197
+ return await WebAssembly.instantiateStreaming(module, imports);
198
+ } catch (e) {
199
+ const validResponse = expectedResponseType(module.type);
200
+
201
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
202
+ 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);
203
+
204
+ } else { throw e; }
205
+ }
206
+ }
207
+
208
+ const bytes = await module.arrayBuffer();
209
+ return await WebAssembly.instantiate(bytes, imports);
210
+ } else {
211
+ const instance = await WebAssembly.instantiate(module, imports);
212
+
213
+ if (instance instanceof WebAssembly.Instance) {
214
+ return { instance, module };
215
+ } else {
216
+ return instance;
217
+ }
218
+ }
219
+
220
+ function expectedResponseType(type) {
221
+ switch (type) {
222
+ case 'basic': case 'cors': case 'default': return true;
223
+ }
224
+ return false;
225
+ }
226
+ }
227
+
228
+ function initSync(module) {
229
+ if (wasm !== undefined) return wasm;
230
+
231
+
232
+ if (module !== undefined) {
233
+ if (Object.getPrototypeOf(module) === Object.prototype) {
234
+ ({module} = module)
235
+ } else {
236
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
237
+ }
238
+ }
239
+
240
+ const imports = __wbg_get_imports();
241
+ if (!(module instanceof WebAssembly.Module)) {
242
+ module = new WebAssembly.Module(module);
243
+ }
244
+ const instance = new WebAssembly.Instance(module, imports);
245
+ return __wbg_finalize_init(instance, module);
246
+ }
247
+
248
+ async function __wbg_init(module_or_path) {
249
+ if (wasm !== undefined) return wasm;
250
+
251
+
252
+ if (module_or_path !== undefined) {
253
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
254
+ ({module_or_path} = module_or_path)
255
+ } else {
256
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
257
+ }
258
+ }
259
+
260
+
261
+ const imports = __wbg_get_imports();
262
+
263
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
264
+ module_or_path = fetch(module_or_path);
265
+ }
266
+
267
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
268
+
269
+ return __wbg_finalize_init(instance, module);
270
+ }
271
+
272
+ export { initSync, __wbg_init as default };