@vedivad/typst-web-service 0.15.4 → 0.17.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 +68 -74
- package/dist/index.d.ts +89 -481
- package/dist/index.js +298 -635
- package/dist/index.js.map +1 -1
- package/dist/typsten-worker.js +509 -0
- package/dist/typsten-worker.js.map +1 -0
- package/dist/typsten_bg.wasm +0 -0
- package/package.json +5 -17
- package/dist/analyzer-worker.js +0 -1045
- package/dist/analyzer-worker.js.map +0 -1
- package/dist/compiler-worker.js +0 -2207
- package/dist/compiler-worker.js.map +0 -1
- package/dist/renderer-worker.js +0 -5261
- package/dist/renderer-worker.js.map +0 -1
package/dist/compiler-worker.js
DELETED
|
@@ -1,2207 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
3
|
-
var __esm = (fn, res) => function __init() {
|
|
4
|
-
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
5
|
-
};
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
// ../../node_modules/.bun/@myriaddreamin+typst-ts-web-compiler@0.7.0-rc2/node_modules/@myriaddreamin/typst-ts-web-compiler/pkg/typst_ts_web_compiler.mjs
|
|
12
|
-
function addHeapObject(obj) {
|
|
13
|
-
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
14
|
-
const idx = heap_next;
|
|
15
|
-
heap_next = heap[idx];
|
|
16
|
-
heap[idx] = obj;
|
|
17
|
-
return idx;
|
|
18
|
-
}
|
|
19
|
-
function _assertClass(instance, klass) {
|
|
20
|
-
if (!(instance instanceof klass)) {
|
|
21
|
-
throw new Error(`expected instance of ${klass.name}`);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
function debugString(val) {
|
|
25
|
-
const type = typeof val;
|
|
26
|
-
if (type == "number" || type == "boolean" || val == null) {
|
|
27
|
-
return `${val}`;
|
|
28
|
-
}
|
|
29
|
-
if (type == "string") {
|
|
30
|
-
return `"${val}"`;
|
|
31
|
-
}
|
|
32
|
-
if (type == "symbol") {
|
|
33
|
-
const description = val.description;
|
|
34
|
-
if (description == null) {
|
|
35
|
-
return "Symbol";
|
|
36
|
-
} else {
|
|
37
|
-
return `Symbol(${description})`;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
if (type == "function") {
|
|
41
|
-
const name = val.name;
|
|
42
|
-
if (typeof name == "string" && name.length > 0) {
|
|
43
|
-
return `Function(${name})`;
|
|
44
|
-
} else {
|
|
45
|
-
return "Function";
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
if (Array.isArray(val)) {
|
|
49
|
-
const length = val.length;
|
|
50
|
-
let debug = "[";
|
|
51
|
-
if (length > 0) {
|
|
52
|
-
debug += debugString(val[0]);
|
|
53
|
-
}
|
|
54
|
-
for (let i = 1; i < length; i++) {
|
|
55
|
-
debug += ", " + debugString(val[i]);
|
|
56
|
-
}
|
|
57
|
-
debug += "]";
|
|
58
|
-
return debug;
|
|
59
|
-
}
|
|
60
|
-
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
61
|
-
let className;
|
|
62
|
-
if (builtInMatches && builtInMatches.length > 1) {
|
|
63
|
-
className = builtInMatches[1];
|
|
64
|
-
} else {
|
|
65
|
-
return toString.call(val);
|
|
66
|
-
}
|
|
67
|
-
if (className == "Object") {
|
|
68
|
-
try {
|
|
69
|
-
return "Object(" + JSON.stringify(val) + ")";
|
|
70
|
-
} catch (_) {
|
|
71
|
-
return "Object";
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
if (val instanceof Error) {
|
|
75
|
-
return `${val.name}: ${val.message}
|
|
76
|
-
${val.stack}`;
|
|
77
|
-
}
|
|
78
|
-
return className;
|
|
79
|
-
}
|
|
80
|
-
function dropObject(idx) {
|
|
81
|
-
if (idx < 132) return;
|
|
82
|
-
heap[idx] = heap_next;
|
|
83
|
-
heap_next = idx;
|
|
84
|
-
}
|
|
85
|
-
function getArrayJsValueFromWasm0(ptr, len) {
|
|
86
|
-
ptr = ptr >>> 0;
|
|
87
|
-
const mem = getDataViewMemory0();
|
|
88
|
-
const result = [];
|
|
89
|
-
for (let i = ptr; i < ptr + 4 * len; i += 4) {
|
|
90
|
-
result.push(takeObject(mem.getUint32(i, true)));
|
|
91
|
-
}
|
|
92
|
-
return result;
|
|
93
|
-
}
|
|
94
|
-
function getArrayU32FromWasm0(ptr, len) {
|
|
95
|
-
ptr = ptr >>> 0;
|
|
96
|
-
return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
97
|
-
}
|
|
98
|
-
function getArrayU8FromWasm0(ptr, len) {
|
|
99
|
-
ptr = ptr >>> 0;
|
|
100
|
-
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
101
|
-
}
|
|
102
|
-
function getDataViewMemory0() {
|
|
103
|
-
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || cachedDataViewMemory0.buffer.detached === void 0 && cachedDataViewMemory0.buffer !== wasm.memory.buffer) {
|
|
104
|
-
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
105
|
-
}
|
|
106
|
-
return cachedDataViewMemory0;
|
|
107
|
-
}
|
|
108
|
-
function getStringFromWasm0(ptr, len) {
|
|
109
|
-
ptr = ptr >>> 0;
|
|
110
|
-
return decodeText(ptr, len);
|
|
111
|
-
}
|
|
112
|
-
function getUint32ArrayMemory0() {
|
|
113
|
-
if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
|
|
114
|
-
cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
|
|
115
|
-
}
|
|
116
|
-
return cachedUint32ArrayMemory0;
|
|
117
|
-
}
|
|
118
|
-
function getUint8ArrayMemory0() {
|
|
119
|
-
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
120
|
-
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
121
|
-
}
|
|
122
|
-
return cachedUint8ArrayMemory0;
|
|
123
|
-
}
|
|
124
|
-
function getObject(idx) {
|
|
125
|
-
return heap[idx];
|
|
126
|
-
}
|
|
127
|
-
function handleError(f, args) {
|
|
128
|
-
try {
|
|
129
|
-
return f.apply(this, args);
|
|
130
|
-
} catch (e) {
|
|
131
|
-
wasm.__wbindgen_export3(addHeapObject(e));
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
function isLikeNone(x) {
|
|
135
|
-
return x === void 0 || x === null;
|
|
136
|
-
}
|
|
137
|
-
function makeMutClosure(arg0, arg1, dtor, f) {
|
|
138
|
-
const state = { a: arg0, b: arg1, cnt: 1, dtor };
|
|
139
|
-
const real = (...args) => {
|
|
140
|
-
state.cnt++;
|
|
141
|
-
const a = state.a;
|
|
142
|
-
state.a = 0;
|
|
143
|
-
try {
|
|
144
|
-
return f(a, state.b, ...args);
|
|
145
|
-
} finally {
|
|
146
|
-
state.a = a;
|
|
147
|
-
real._wbg_cb_unref();
|
|
148
|
-
}
|
|
149
|
-
};
|
|
150
|
-
real._wbg_cb_unref = () => {
|
|
151
|
-
if (--state.cnt === 0) {
|
|
152
|
-
state.dtor(state.a, state.b);
|
|
153
|
-
state.a = 0;
|
|
154
|
-
CLOSURE_DTORS.unregister(state);
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
|
-
CLOSURE_DTORS.register(real, state, state);
|
|
158
|
-
return real;
|
|
159
|
-
}
|
|
160
|
-
function passArray8ToWasm0(arg, malloc) {
|
|
161
|
-
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
162
|
-
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
163
|
-
WASM_VECTOR_LEN = arg.length;
|
|
164
|
-
return ptr;
|
|
165
|
-
}
|
|
166
|
-
function passArrayJsValueToWasm0(array, malloc) {
|
|
167
|
-
const ptr = malloc(array.length * 4, 4) >>> 0;
|
|
168
|
-
const mem = getDataViewMemory0();
|
|
169
|
-
for (let i = 0; i < array.length; i++) {
|
|
170
|
-
mem.setUint32(ptr + 4 * i, addHeapObject(array[i]), true);
|
|
171
|
-
}
|
|
172
|
-
WASM_VECTOR_LEN = array.length;
|
|
173
|
-
return ptr;
|
|
174
|
-
}
|
|
175
|
-
function passStringToWasm0(arg, malloc, realloc) {
|
|
176
|
-
if (realloc === void 0) {
|
|
177
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
178
|
-
const ptr2 = malloc(buf.length, 1) >>> 0;
|
|
179
|
-
getUint8ArrayMemory0().subarray(ptr2, ptr2 + buf.length).set(buf);
|
|
180
|
-
WASM_VECTOR_LEN = buf.length;
|
|
181
|
-
return ptr2;
|
|
182
|
-
}
|
|
183
|
-
let len = arg.length;
|
|
184
|
-
let ptr = malloc(len, 1) >>> 0;
|
|
185
|
-
const mem = getUint8ArrayMemory0();
|
|
186
|
-
let offset = 0;
|
|
187
|
-
for (; offset < len; offset++) {
|
|
188
|
-
const code = arg.charCodeAt(offset);
|
|
189
|
-
if (code > 127) break;
|
|
190
|
-
mem[ptr + offset] = code;
|
|
191
|
-
}
|
|
192
|
-
if (offset !== len) {
|
|
193
|
-
if (offset !== 0) {
|
|
194
|
-
arg = arg.slice(offset);
|
|
195
|
-
}
|
|
196
|
-
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
197
|
-
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
198
|
-
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
199
|
-
offset += ret.written;
|
|
200
|
-
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
201
|
-
}
|
|
202
|
-
WASM_VECTOR_LEN = offset;
|
|
203
|
-
return ptr;
|
|
204
|
-
}
|
|
205
|
-
function takeObject(idx) {
|
|
206
|
-
const ret = getObject(idx);
|
|
207
|
-
dropObject(idx);
|
|
208
|
-
return ret;
|
|
209
|
-
}
|
|
210
|
-
function decodeText(ptr, len) {
|
|
211
|
-
numBytesDecoded += len;
|
|
212
|
-
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
213
|
-
cachedTextDecoder = new TextDecoder("utf-8", { ignoreBOM: true, fatal: true });
|
|
214
|
-
cachedTextDecoder.decode();
|
|
215
|
-
numBytesDecoded = len;
|
|
216
|
-
}
|
|
217
|
-
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
218
|
-
}
|
|
219
|
-
function __wasm_bindgen_func_elem_944(arg0, arg1, arg2) {
|
|
220
|
-
wasm.__wasm_bindgen_func_elem_944(arg0, arg1, addHeapObject(arg2));
|
|
221
|
-
}
|
|
222
|
-
function __wasm_bindgen_func_elem_37348(arg0, arg1, arg2, arg3) {
|
|
223
|
-
wasm.__wasm_bindgen_func_elem_37348(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
224
|
-
}
|
|
225
|
-
function get_font_info(buffer) {
|
|
226
|
-
const ret = wasm.get_font_info(addHeapObject(buffer));
|
|
227
|
-
return takeObject(ret);
|
|
228
|
-
}
|
|
229
|
-
async function __wbg_load(module, imports) {
|
|
230
|
-
if (typeof Response === "function" && module instanceof Response) {
|
|
231
|
-
if (typeof WebAssembly.instantiateStreaming === "function") {
|
|
232
|
-
try {
|
|
233
|
-
return await WebAssembly.instantiateStreaming(module, imports);
|
|
234
|
-
} catch (e) {
|
|
235
|
-
const validResponse = module.ok && EXPECTED_RESPONSE_TYPES.has(module.type);
|
|
236
|
-
if (validResponse && module.headers.get("Content-Type") !== "application/wasm") {
|
|
237
|
-
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);
|
|
238
|
-
} else {
|
|
239
|
-
throw e;
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
const bytes = await module.arrayBuffer();
|
|
244
|
-
return await WebAssembly.instantiate(bytes, imports);
|
|
245
|
-
} else {
|
|
246
|
-
const instance = await WebAssembly.instantiate(module, imports);
|
|
247
|
-
if (instance instanceof WebAssembly.Instance) {
|
|
248
|
-
return { instance, module };
|
|
249
|
-
} else {
|
|
250
|
-
return instance;
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
function __wbg_get_imports() {
|
|
255
|
-
const imports = {};
|
|
256
|
-
imports.wbg = {};
|
|
257
|
-
imports.wbg.__wbg_Error_52673b7de5a0ca89 = function(arg0, arg1) {
|
|
258
|
-
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
259
|
-
return addHeapObject(ret);
|
|
260
|
-
};
|
|
261
|
-
imports.wbg.__wbg_Number_2d1dcfcf4ec51736 = function(arg0) {
|
|
262
|
-
const ret = Number(getObject(arg0));
|
|
263
|
-
return ret;
|
|
264
|
-
};
|
|
265
|
-
imports.wbg.__wbg___wbindgen_bigint_get_as_i64_6e32f5e6aff02e1d = function(arg0, arg1) {
|
|
266
|
-
const v = getObject(arg1);
|
|
267
|
-
const ret = typeof v === "bigint" ? v : void 0;
|
|
268
|
-
getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
|
|
269
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
270
|
-
};
|
|
271
|
-
imports.wbg.__wbg___wbindgen_boolean_get_dea25b33882b895b = function(arg0) {
|
|
272
|
-
const v = getObject(arg0);
|
|
273
|
-
const ret = typeof v === "boolean" ? v : void 0;
|
|
274
|
-
return isLikeNone(ret) ? 16777215 : ret ? 1 : 0;
|
|
275
|
-
};
|
|
276
|
-
imports.wbg.__wbg___wbindgen_debug_string_adfb662ae34724b6 = function(arg0, arg1) {
|
|
277
|
-
const ret = debugString(getObject(arg1));
|
|
278
|
-
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
279
|
-
const len1 = WASM_VECTOR_LEN;
|
|
280
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
281
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
282
|
-
};
|
|
283
|
-
imports.wbg.__wbg___wbindgen_in_0d3e1e8f0c669317 = function(arg0, arg1) {
|
|
284
|
-
const ret = getObject(arg0) in getObject(arg1);
|
|
285
|
-
return ret;
|
|
286
|
-
};
|
|
287
|
-
imports.wbg.__wbg___wbindgen_is_bigint_0e1a2e3f55cfae27 = function(arg0) {
|
|
288
|
-
const ret = typeof getObject(arg0) === "bigint";
|
|
289
|
-
return ret;
|
|
290
|
-
};
|
|
291
|
-
imports.wbg.__wbg___wbindgen_is_function_8d400b8b1af978cd = function(arg0) {
|
|
292
|
-
const ret = typeof getObject(arg0) === "function";
|
|
293
|
-
return ret;
|
|
294
|
-
};
|
|
295
|
-
imports.wbg.__wbg___wbindgen_is_object_ce774f3490692386 = function(arg0) {
|
|
296
|
-
const val = getObject(arg0);
|
|
297
|
-
const ret = typeof val === "object" && val !== null;
|
|
298
|
-
return ret;
|
|
299
|
-
};
|
|
300
|
-
imports.wbg.__wbg___wbindgen_is_string_704ef9c8fc131030 = function(arg0) {
|
|
301
|
-
const ret = typeof getObject(arg0) === "string";
|
|
302
|
-
return ret;
|
|
303
|
-
};
|
|
304
|
-
imports.wbg.__wbg___wbindgen_is_undefined_f6b95eab589e0269 = function(arg0) {
|
|
305
|
-
const ret = getObject(arg0) === void 0;
|
|
306
|
-
return ret;
|
|
307
|
-
};
|
|
308
|
-
imports.wbg.__wbg___wbindgen_jsval_eq_b6101cc9cef1fe36 = function(arg0, arg1) {
|
|
309
|
-
const ret = getObject(arg0) === getObject(arg1);
|
|
310
|
-
return ret;
|
|
311
|
-
};
|
|
312
|
-
imports.wbg.__wbg___wbindgen_jsval_loose_eq_766057600fdd1b0d = function(arg0, arg1) {
|
|
313
|
-
const ret = getObject(arg0) == getObject(arg1);
|
|
314
|
-
return ret;
|
|
315
|
-
};
|
|
316
|
-
imports.wbg.__wbg___wbindgen_number_get_9619185a74197f95 = function(arg0, arg1) {
|
|
317
|
-
const obj = getObject(arg1);
|
|
318
|
-
const ret = typeof obj === "number" ? obj : void 0;
|
|
319
|
-
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
320
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
321
|
-
};
|
|
322
|
-
imports.wbg.__wbg___wbindgen_string_get_a2a31e16edf96e42 = function(arg0, arg1) {
|
|
323
|
-
const obj = getObject(arg1);
|
|
324
|
-
const ret = typeof obj === "string" ? obj : void 0;
|
|
325
|
-
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
326
|
-
var len1 = WASM_VECTOR_LEN;
|
|
327
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
328
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
329
|
-
};
|
|
330
|
-
imports.wbg.__wbg___wbindgen_throw_dd24417ed36fc46e = function(arg0, arg1) {
|
|
331
|
-
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
332
|
-
};
|
|
333
|
-
imports.wbg.__wbg__wbg_cb_unref_87dfb5aaa0cbcea7 = function(arg0) {
|
|
334
|
-
getObject(arg0)._wbg_cb_unref();
|
|
335
|
-
};
|
|
336
|
-
imports.wbg.__wbg_call_3020136f7a2d6e44 = function() {
|
|
337
|
-
return handleError(function(arg0, arg1, arg2) {
|
|
338
|
-
const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
|
|
339
|
-
return addHeapObject(ret);
|
|
340
|
-
}, arguments);
|
|
341
|
-
};
|
|
342
|
-
imports.wbg.__wbg_call_78f94eb02ec7f9b2 = function() {
|
|
343
|
-
return handleError(function(arg0, arg1, arg2, arg3, arg4) {
|
|
344
|
-
const ret = getObject(arg0).call(getObject(arg1), getObject(arg2), getObject(arg3), getObject(arg4));
|
|
345
|
-
return addHeapObject(ret);
|
|
346
|
-
}, arguments);
|
|
347
|
-
};
|
|
348
|
-
imports.wbg.__wbg_call_abb4ff46ce38be40 = function() {
|
|
349
|
-
return handleError(function(arg0, arg1) {
|
|
350
|
-
const ret = getObject(arg0).call(getObject(arg1));
|
|
351
|
-
return addHeapObject(ret);
|
|
352
|
-
}, arguments);
|
|
353
|
-
};
|
|
354
|
-
imports.wbg.__wbg_done_62ea16af4ce34b24 = function(arg0) {
|
|
355
|
-
const ret = getObject(arg0).done;
|
|
356
|
-
return ret;
|
|
357
|
-
};
|
|
358
|
-
imports.wbg.__wbg_entries_83c79938054e065f = function(arg0) {
|
|
359
|
-
const ret = Object.entries(getObject(arg0));
|
|
360
|
-
return addHeapObject(ret);
|
|
361
|
-
};
|
|
362
|
-
imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
|
|
363
|
-
let deferred0_0;
|
|
364
|
-
let deferred0_1;
|
|
365
|
-
try {
|
|
366
|
-
deferred0_0 = arg0;
|
|
367
|
-
deferred0_1 = arg1;
|
|
368
|
-
console.error(getStringFromWasm0(arg0, arg1));
|
|
369
|
-
} finally {
|
|
370
|
-
wasm.__wbindgen_export4(deferred0_0, deferred0_1, 1);
|
|
371
|
-
}
|
|
372
|
-
};
|
|
373
|
-
imports.wbg.__wbg_error_85faeb8919b11cc6 = function(arg0, arg1, arg2) {
|
|
374
|
-
console.error(getObject(arg0), getObject(arg1), getObject(arg2));
|
|
375
|
-
};
|
|
376
|
-
imports.wbg.__wbg_getTimezoneOffset_45389e26d6f46823 = function(arg0) {
|
|
377
|
-
const ret = getObject(arg0).getTimezoneOffset();
|
|
378
|
-
return ret;
|
|
379
|
-
};
|
|
380
|
-
imports.wbg.__wbg_get_6b7bd52aca3f9671 = function(arg0, arg1) {
|
|
381
|
-
const ret = getObject(arg0)[arg1 >>> 0];
|
|
382
|
-
return addHeapObject(ret);
|
|
383
|
-
};
|
|
384
|
-
imports.wbg.__wbg_get_af9dab7e9603ea93 = function() {
|
|
385
|
-
return handleError(function(arg0, arg1) {
|
|
386
|
-
const ret = Reflect.get(getObject(arg0), getObject(arg1));
|
|
387
|
-
return addHeapObject(ret);
|
|
388
|
-
}, arguments);
|
|
389
|
-
};
|
|
390
|
-
imports.wbg.__wbg_get_with_ref_key_1dc361bd10053bfe = function(arg0, arg1) {
|
|
391
|
-
const ret = getObject(arg0)[getObject(arg1)];
|
|
392
|
-
return addHeapObject(ret);
|
|
393
|
-
};
|
|
394
|
-
imports.wbg.__wbg_info_ce6bcc489c22f6f0 = function(arg0) {
|
|
395
|
-
console.info(getObject(arg0));
|
|
396
|
-
};
|
|
397
|
-
imports.wbg.__wbg_instanceof_ArrayBuffer_f3320d2419cd0355 = function(arg0) {
|
|
398
|
-
let result;
|
|
399
|
-
try {
|
|
400
|
-
result = getObject(arg0) instanceof ArrayBuffer;
|
|
401
|
-
} catch (_) {
|
|
402
|
-
result = false;
|
|
403
|
-
}
|
|
404
|
-
const ret = result;
|
|
405
|
-
return ret;
|
|
406
|
-
};
|
|
407
|
-
imports.wbg.__wbg_instanceof_Map_084be8da74364158 = function(arg0) {
|
|
408
|
-
let result;
|
|
409
|
-
try {
|
|
410
|
-
result = getObject(arg0) instanceof Map;
|
|
411
|
-
} catch (_) {
|
|
412
|
-
result = false;
|
|
413
|
-
}
|
|
414
|
-
const ret = result;
|
|
415
|
-
return ret;
|
|
416
|
-
};
|
|
417
|
-
imports.wbg.__wbg_instanceof_Uint8Array_da54ccc9d3e09434 = function(arg0) {
|
|
418
|
-
let result;
|
|
419
|
-
try {
|
|
420
|
-
result = getObject(arg0) instanceof Uint8Array;
|
|
421
|
-
} catch (_) {
|
|
422
|
-
result = false;
|
|
423
|
-
}
|
|
424
|
-
const ret = result;
|
|
425
|
-
return ret;
|
|
426
|
-
};
|
|
427
|
-
imports.wbg.__wbg_isArray_51fd9e6422c0a395 = function(arg0) {
|
|
428
|
-
const ret = Array.isArray(getObject(arg0));
|
|
429
|
-
return ret;
|
|
430
|
-
};
|
|
431
|
-
imports.wbg.__wbg_isSafeInteger_ae7d3f054d55fa16 = function(arg0) {
|
|
432
|
-
const ret = Number.isSafeInteger(getObject(arg0));
|
|
433
|
-
return ret;
|
|
434
|
-
};
|
|
435
|
-
imports.wbg.__wbg_iterator_27b7c8b35ab3e86b = function() {
|
|
436
|
-
const ret = Symbol.iterator;
|
|
437
|
-
return addHeapObject(ret);
|
|
438
|
-
};
|
|
439
|
-
imports.wbg.__wbg_length_22ac23eaec9d8053 = function(arg0) {
|
|
440
|
-
const ret = getObject(arg0).length;
|
|
441
|
-
return ret;
|
|
442
|
-
};
|
|
443
|
-
imports.wbg.__wbg_length_d45040a40c570362 = function(arg0) {
|
|
444
|
-
const ret = getObject(arg0).length;
|
|
445
|
-
return ret;
|
|
446
|
-
};
|
|
447
|
-
imports.wbg.__wbg_new_1ba21ce319a06297 = function() {
|
|
448
|
-
const ret = new Object();
|
|
449
|
-
return addHeapObject(ret);
|
|
450
|
-
};
|
|
451
|
-
imports.wbg.__wbg_new_25f239778d6112b9 = function() {
|
|
452
|
-
const ret = new Array();
|
|
453
|
-
return addHeapObject(ret);
|
|
454
|
-
};
|
|
455
|
-
imports.wbg.__wbg_new_6421f6084cc5bc5a = function(arg0) {
|
|
456
|
-
const ret = new Uint8Array(getObject(arg0));
|
|
457
|
-
return addHeapObject(ret);
|
|
458
|
-
};
|
|
459
|
-
imports.wbg.__wbg_new_8a6f238a6ece86ea = function() {
|
|
460
|
-
const ret = new Error();
|
|
461
|
-
return addHeapObject(ret);
|
|
462
|
-
};
|
|
463
|
-
imports.wbg.__wbg_new_b2db8aa2650f793a = function(arg0) {
|
|
464
|
-
const ret = new Date(getObject(arg0));
|
|
465
|
-
return addHeapObject(ret);
|
|
466
|
-
};
|
|
467
|
-
imports.wbg.__wbg_new_df1173567d5ff028 = function(arg0, arg1) {
|
|
468
|
-
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
469
|
-
return addHeapObject(ret);
|
|
470
|
-
};
|
|
471
|
-
imports.wbg.__wbg_new_ff12d2b041fb48f1 = function(arg0, arg1) {
|
|
472
|
-
try {
|
|
473
|
-
var state0 = { a: arg0, b: arg1 };
|
|
474
|
-
var cb0 = (arg02, arg12) => {
|
|
475
|
-
const a = state0.a;
|
|
476
|
-
state0.a = 0;
|
|
477
|
-
try {
|
|
478
|
-
return __wasm_bindgen_func_elem_37348(a, state0.b, arg02, arg12);
|
|
479
|
-
} finally {
|
|
480
|
-
state0.a = a;
|
|
481
|
-
}
|
|
482
|
-
};
|
|
483
|
-
const ret = new Promise(cb0);
|
|
484
|
-
return addHeapObject(ret);
|
|
485
|
-
} finally {
|
|
486
|
-
state0.a = state0.b = 0;
|
|
487
|
-
}
|
|
488
|
-
};
|
|
489
|
-
imports.wbg.__wbg_new_from_slice_db0691b69e9d3891 = function(arg0, arg1) {
|
|
490
|
-
const ret = new Uint32Array(getArrayU32FromWasm0(arg0, arg1));
|
|
491
|
-
return addHeapObject(ret);
|
|
492
|
-
};
|
|
493
|
-
imports.wbg.__wbg_new_from_slice_f9c22b9153b26992 = function(arg0, arg1) {
|
|
494
|
-
const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
|
|
495
|
-
return addHeapObject(ret);
|
|
496
|
-
};
|
|
497
|
-
imports.wbg.__wbg_new_no_args_cb138f77cf6151ee = function(arg0, arg1) {
|
|
498
|
-
const ret = new Function(getStringFromWasm0(arg0, arg1));
|
|
499
|
-
return addHeapObject(ret);
|
|
500
|
-
};
|
|
501
|
-
imports.wbg.__wbg_new_with_args_df9e7125ffe55248 = function(arg0, arg1, arg2, arg3) {
|
|
502
|
-
const ret = new Function(getStringFromWasm0(arg0, arg1), getStringFromWasm0(arg2, arg3));
|
|
503
|
-
return addHeapObject(ret);
|
|
504
|
-
};
|
|
505
|
-
imports.wbg.__wbg_next_138a17bbf04e926c = function(arg0) {
|
|
506
|
-
const ret = getObject(arg0).next;
|
|
507
|
-
return addHeapObject(ret);
|
|
508
|
-
};
|
|
509
|
-
imports.wbg.__wbg_next_3cfe5c0fe2a4cc53 = function() {
|
|
510
|
-
return handleError(function(arg0) {
|
|
511
|
-
const ret = getObject(arg0).next();
|
|
512
|
-
return addHeapObject(ret);
|
|
513
|
-
}, arguments);
|
|
514
|
-
};
|
|
515
|
-
imports.wbg.__wbg_now_69d776cd24f5215b = function() {
|
|
516
|
-
const ret = Date.now();
|
|
517
|
-
return ret;
|
|
518
|
-
};
|
|
519
|
-
imports.wbg.__wbg_prototypesetcall_dfe9b766cdc1f1fd = function(arg0, arg1, arg2) {
|
|
520
|
-
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
|
|
521
|
-
};
|
|
522
|
-
imports.wbg.__wbg_proxycontext_new = function(arg0) {
|
|
523
|
-
const ret = ProxyContext.__wrap(arg0);
|
|
524
|
-
return addHeapObject(ret);
|
|
525
|
-
};
|
|
526
|
-
imports.wbg.__wbg_push_7d9be8f38fc13975 = function(arg0, arg1) {
|
|
527
|
-
const ret = getObject(arg0).push(getObject(arg1));
|
|
528
|
-
return ret;
|
|
529
|
-
};
|
|
530
|
-
imports.wbg.__wbg_queueMicrotask_9b549dfce8865860 = function(arg0) {
|
|
531
|
-
const ret = getObject(arg0).queueMicrotask;
|
|
532
|
-
return addHeapObject(ret);
|
|
533
|
-
};
|
|
534
|
-
imports.wbg.__wbg_queueMicrotask_fca69f5bfad613a5 = function(arg0) {
|
|
535
|
-
queueMicrotask(getObject(arg0));
|
|
536
|
-
};
|
|
537
|
-
imports.wbg.__wbg_resolve_fd5bfbaa4ce36e1e = function(arg0) {
|
|
538
|
-
const ret = Promise.resolve(getObject(arg0));
|
|
539
|
-
return addHeapObject(ret);
|
|
540
|
-
};
|
|
541
|
-
imports.wbg.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
|
|
542
|
-
getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
|
|
543
|
-
};
|
|
544
|
-
imports.wbg.__wbg_set_781438a03c0c3c81 = function() {
|
|
545
|
-
return handleError(function(arg0, arg1, arg2) {
|
|
546
|
-
const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
|
|
547
|
-
return ret;
|
|
548
|
-
}, arguments);
|
|
549
|
-
};
|
|
550
|
-
imports.wbg.__wbg_set_7df433eea03a5c14 = function(arg0, arg1, arg2) {
|
|
551
|
-
getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
|
|
552
|
-
};
|
|
553
|
-
imports.wbg.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {
|
|
554
|
-
const ret = getObject(arg1).stack;
|
|
555
|
-
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
556
|
-
const len1 = WASM_VECTOR_LEN;
|
|
557
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
558
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
559
|
-
};
|
|
560
|
-
imports.wbg.__wbg_static_accessor_GLOBAL_769e6b65d6557335 = function() {
|
|
561
|
-
const ret = typeof global === "undefined" ? null : global;
|
|
562
|
-
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
563
|
-
};
|
|
564
|
-
imports.wbg.__wbg_static_accessor_GLOBAL_THIS_60cf02db4de8e1c1 = function() {
|
|
565
|
-
const ret = typeof globalThis === "undefined" ? null : globalThis;
|
|
566
|
-
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
567
|
-
};
|
|
568
|
-
imports.wbg.__wbg_static_accessor_SELF_08f5a74c69739274 = function() {
|
|
569
|
-
const ret = typeof self === "undefined" ? null : self;
|
|
570
|
-
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
571
|
-
};
|
|
572
|
-
imports.wbg.__wbg_static_accessor_WINDOW_a8924b26aa92d024 = function() {
|
|
573
|
-
const ret = typeof window === "undefined" ? null : window;
|
|
574
|
-
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
575
|
-
};
|
|
576
|
-
imports.wbg.__wbg_then_4f95312d68691235 = function(arg0, arg1) {
|
|
577
|
-
const ret = getObject(arg0).then(getObject(arg1));
|
|
578
|
-
return addHeapObject(ret);
|
|
579
|
-
};
|
|
580
|
-
imports.wbg.__wbg_typstcompiler_new = function(arg0) {
|
|
581
|
-
const ret = TypstCompiler.__wrap(arg0);
|
|
582
|
-
return addHeapObject(ret);
|
|
583
|
-
};
|
|
584
|
-
imports.wbg.__wbg_typstfontresolver_new = function(arg0) {
|
|
585
|
-
const ret = TypstFontResolver.__wrap(arg0);
|
|
586
|
-
return addHeapObject(ret);
|
|
587
|
-
};
|
|
588
|
-
imports.wbg.__wbg_value_57b7b035e117f7ee = function(arg0) {
|
|
589
|
-
const ret = getObject(arg0).value;
|
|
590
|
-
return addHeapObject(ret);
|
|
591
|
-
};
|
|
592
|
-
imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
|
|
593
|
-
const ret = getStringFromWasm0(arg0, arg1);
|
|
594
|
-
return addHeapObject(ret);
|
|
595
|
-
};
|
|
596
|
-
imports.wbg.__wbindgen_cast_3334ea73b4b28ba3 = function(arg0, arg1) {
|
|
597
|
-
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_957, __wasm_bindgen_func_elem_944);
|
|
598
|
-
return addHeapObject(ret);
|
|
599
|
-
};
|
|
600
|
-
imports.wbg.__wbindgen_cast_4625c577ab2ec9ee = function(arg0) {
|
|
601
|
-
const ret = BigInt.asUintN(64, arg0);
|
|
602
|
-
return addHeapObject(ret);
|
|
603
|
-
};
|
|
604
|
-
imports.wbg.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
|
|
605
|
-
const ret = arg0;
|
|
606
|
-
return addHeapObject(ret);
|
|
607
|
-
};
|
|
608
|
-
imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
|
|
609
|
-
const ret = arg0;
|
|
610
|
-
return addHeapObject(ret);
|
|
611
|
-
};
|
|
612
|
-
imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
|
|
613
|
-
const ret = getObject(arg0);
|
|
614
|
-
return addHeapObject(ret);
|
|
615
|
-
};
|
|
616
|
-
imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
|
|
617
|
-
takeObject(arg0);
|
|
618
|
-
};
|
|
619
|
-
return imports;
|
|
620
|
-
}
|
|
621
|
-
function __wbg_finalize_init(instance, module) {
|
|
622
|
-
wasm = instance.exports;
|
|
623
|
-
__wbg_init.__wbindgen_wasm_module = module;
|
|
624
|
-
cachedDataViewMemory0 = null;
|
|
625
|
-
cachedUint32ArrayMemory0 = null;
|
|
626
|
-
cachedUint8ArrayMemory0 = null;
|
|
627
|
-
return wasm;
|
|
628
|
-
}
|
|
629
|
-
function initSync(module) {
|
|
630
|
-
if (wasm !== void 0) return wasm;
|
|
631
|
-
if (typeof module !== "undefined") {
|
|
632
|
-
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
633
|
-
({ module } = module);
|
|
634
|
-
} else {
|
|
635
|
-
console.warn("using deprecated parameters for `initSync()`; pass a single object instead");
|
|
636
|
-
}
|
|
637
|
-
}
|
|
638
|
-
const imports = __wbg_get_imports();
|
|
639
|
-
if (!(module instanceof WebAssembly.Module)) {
|
|
640
|
-
module = new WebAssembly.Module(module);
|
|
641
|
-
}
|
|
642
|
-
const instance = new WebAssembly.Instance(module, imports);
|
|
643
|
-
return __wbg_finalize_init(instance, module);
|
|
644
|
-
}
|
|
645
|
-
async function __wbg_init(module_or_path) {
|
|
646
|
-
if (wasm !== void 0) return wasm;
|
|
647
|
-
if (typeof module_or_path !== "undefined") {
|
|
648
|
-
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
649
|
-
({ module_or_path } = module_or_path);
|
|
650
|
-
} else {
|
|
651
|
-
console.warn("using deprecated parameters for the initialization function; pass a single object instead");
|
|
652
|
-
}
|
|
653
|
-
}
|
|
654
|
-
if (typeof module_or_path === "undefined") {
|
|
655
|
-
module_or_path = importWasmModule("typst_ts_web_compiler_bg.wasm", import.meta.url);
|
|
656
|
-
}
|
|
657
|
-
const imports = __wbg_get_imports();
|
|
658
|
-
if (typeof module_or_path === "string" || typeof Request === "function" && module_or_path instanceof Request || typeof URL === "function" && module_or_path instanceof URL) {
|
|
659
|
-
module_or_path = fetch(module_or_path);
|
|
660
|
-
}
|
|
661
|
-
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
662
|
-
return __wbg_finalize_init(instance, module);
|
|
663
|
-
}
|
|
664
|
-
function setImportWasmModule(importer) {
|
|
665
|
-
importWasmModule = importer;
|
|
666
|
-
}
|
|
667
|
-
var wasm, CLOSURE_DTORS, cachedDataViewMemory0, cachedUint32ArrayMemory0, cachedUint8ArrayMemory0, heap, heap_next, cachedTextDecoder, MAX_SAFARI_DECODE_BYTES, numBytesDecoded, cachedTextEncoder, WASM_VECTOR_LEN, IncrServerFinalization, ProxyContextFinalization, TypstCompileWorldFinalization, TypstCompilerFinalization, TypstCompilerBuilderFinalization, TypstFontResolverFinalization, TypstFontResolverBuilderFinalization, IncrServer, ProxyContext, TypstCompileWorld, TypstCompiler, TypstCompilerBuilder, TypstFontResolver, TypstFontResolverBuilder, EXPECTED_RESPONSE_TYPES, typst_ts_web_compiler_default, importWasmModule;
|
|
668
|
-
var init_typst_ts_web_compiler = __esm({
|
|
669
|
-
"../../node_modules/.bun/@myriaddreamin+typst-ts-web-compiler@0.7.0-rc2/node_modules/@myriaddreamin/typst-ts-web-compiler/pkg/typst_ts_web_compiler.mjs"() {
|
|
670
|
-
"use strict";
|
|
671
|
-
CLOSURE_DTORS = typeof FinalizationRegistry === "undefined" ? { register: () => {
|
|
672
|
-
}, unregister: () => {
|
|
673
|
-
} } : new FinalizationRegistry((state) => state.dtor(state.a, state.b));
|
|
674
|
-
cachedDataViewMemory0 = null;
|
|
675
|
-
cachedUint32ArrayMemory0 = null;
|
|
676
|
-
cachedUint8ArrayMemory0 = null;
|
|
677
|
-
heap = new Array(128).fill(void 0);
|
|
678
|
-
heap.push(void 0, null, true, false);
|
|
679
|
-
heap_next = heap.length;
|
|
680
|
-
cachedTextDecoder = new TextDecoder("utf-8", { ignoreBOM: true, fatal: true });
|
|
681
|
-
cachedTextDecoder.decode();
|
|
682
|
-
MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
683
|
-
numBytesDecoded = 0;
|
|
684
|
-
cachedTextEncoder = new TextEncoder();
|
|
685
|
-
if (!("encodeInto" in cachedTextEncoder)) {
|
|
686
|
-
cachedTextEncoder.encodeInto = function(arg, view) {
|
|
687
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
688
|
-
view.set(buf);
|
|
689
|
-
return {
|
|
690
|
-
read: arg.length,
|
|
691
|
-
written: buf.length
|
|
692
|
-
};
|
|
693
|
-
};
|
|
694
|
-
}
|
|
695
|
-
WASM_VECTOR_LEN = 0;
|
|
696
|
-
IncrServerFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
|
|
697
|
-
}, unregister: () => {
|
|
698
|
-
} } : new FinalizationRegistry((ptr) => wasm.__wbg_incrserver_free(ptr >>> 0, 1));
|
|
699
|
-
ProxyContextFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
|
|
700
|
-
}, unregister: () => {
|
|
701
|
-
} } : new FinalizationRegistry((ptr) => wasm.__wbg_proxycontext_free(ptr >>> 0, 1));
|
|
702
|
-
TypstCompileWorldFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
|
|
703
|
-
}, unregister: () => {
|
|
704
|
-
} } : new FinalizationRegistry((ptr) => wasm.__wbg_typstcompileworld_free(ptr >>> 0, 1));
|
|
705
|
-
TypstCompilerFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
|
|
706
|
-
}, unregister: () => {
|
|
707
|
-
} } : new FinalizationRegistry((ptr) => wasm.__wbg_typstcompiler_free(ptr >>> 0, 1));
|
|
708
|
-
TypstCompilerBuilderFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
|
|
709
|
-
}, unregister: () => {
|
|
710
|
-
} } : new FinalizationRegistry((ptr) => wasm.__wbg_typstcompilerbuilder_free(ptr >>> 0, 1));
|
|
711
|
-
TypstFontResolverFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
|
|
712
|
-
}, unregister: () => {
|
|
713
|
-
} } : new FinalizationRegistry((ptr) => wasm.__wbg_typstfontresolver_free(ptr >>> 0, 1));
|
|
714
|
-
TypstFontResolverBuilderFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
|
|
715
|
-
}, unregister: () => {
|
|
716
|
-
} } : new FinalizationRegistry((ptr) => wasm.__wbg_typstfontresolverbuilder_free(ptr >>> 0, 1));
|
|
717
|
-
IncrServer = class _IncrServer {
|
|
718
|
-
static __wrap(ptr) {
|
|
719
|
-
ptr = ptr >>> 0;
|
|
720
|
-
const obj = Object.create(_IncrServer.prototype);
|
|
721
|
-
obj.__wbg_ptr = ptr;
|
|
722
|
-
IncrServerFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
723
|
-
return obj;
|
|
724
|
-
}
|
|
725
|
-
__destroy_into_raw() {
|
|
726
|
-
const ptr = this.__wbg_ptr;
|
|
727
|
-
this.__wbg_ptr = 0;
|
|
728
|
-
IncrServerFinalization.unregister(this);
|
|
729
|
-
return ptr;
|
|
730
|
-
}
|
|
731
|
-
free() {
|
|
732
|
-
const ptr = this.__destroy_into_raw();
|
|
733
|
-
wasm.__wbg_incrserver_free(ptr, 0);
|
|
734
|
-
}
|
|
735
|
-
/**
|
|
736
|
-
* @param {boolean} attach
|
|
737
|
-
*/
|
|
738
|
-
set_attach_debug_info(attach) {
|
|
739
|
-
wasm.incrserver_set_attach_debug_info(this.__wbg_ptr, attach);
|
|
740
|
-
}
|
|
741
|
-
/**
|
|
742
|
-
* @returns {Uint8Array | undefined}
|
|
743
|
-
*/
|
|
744
|
-
current() {
|
|
745
|
-
try {
|
|
746
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
747
|
-
wasm.incrserver_current(retptr, this.__wbg_ptr);
|
|
748
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
749
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
750
|
-
let v1;
|
|
751
|
-
if (r0 !== 0) {
|
|
752
|
-
v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
753
|
-
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
754
|
-
}
|
|
755
|
-
return v1;
|
|
756
|
-
} finally {
|
|
757
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
758
|
-
}
|
|
759
|
-
}
|
|
760
|
-
reset() {
|
|
761
|
-
wasm.incrserver_reset(this.__wbg_ptr);
|
|
762
|
-
}
|
|
763
|
-
};
|
|
764
|
-
if (Symbol.dispose) IncrServer.prototype[Symbol.dispose] = IncrServer.prototype.free;
|
|
765
|
-
ProxyContext = class _ProxyContext {
|
|
766
|
-
static __wrap(ptr) {
|
|
767
|
-
ptr = ptr >>> 0;
|
|
768
|
-
const obj = Object.create(_ProxyContext.prototype);
|
|
769
|
-
obj.__wbg_ptr = ptr;
|
|
770
|
-
ProxyContextFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
771
|
-
return obj;
|
|
772
|
-
}
|
|
773
|
-
__destroy_into_raw() {
|
|
774
|
-
const ptr = this.__wbg_ptr;
|
|
775
|
-
this.__wbg_ptr = 0;
|
|
776
|
-
ProxyContextFinalization.unregister(this);
|
|
777
|
-
return ptr;
|
|
778
|
-
}
|
|
779
|
-
free() {
|
|
780
|
-
const ptr = this.__destroy_into_raw();
|
|
781
|
-
wasm.__wbg_proxycontext_free(ptr, 0);
|
|
782
|
-
}
|
|
783
|
-
/**
|
|
784
|
-
* Creates a new `ProxyContext` instance.
|
|
785
|
-
* @param {any} context
|
|
786
|
-
*/
|
|
787
|
-
constructor(context) {
|
|
788
|
-
const ret = wasm.proxycontext_new(addHeapObject(context));
|
|
789
|
-
this.__wbg_ptr = ret >>> 0;
|
|
790
|
-
ProxyContextFinalization.register(this, this.__wbg_ptr, this);
|
|
791
|
-
return this;
|
|
792
|
-
}
|
|
793
|
-
/**
|
|
794
|
-
* Returns the JavaScript this.
|
|
795
|
-
* @returns {any}
|
|
796
|
-
*/
|
|
797
|
-
get context() {
|
|
798
|
-
const ret = wasm.proxycontext_context(this.__wbg_ptr);
|
|
799
|
-
return takeObject(ret);
|
|
800
|
-
}
|
|
801
|
-
/**
|
|
802
|
-
* A convenience function to untar a tarball and call a callback for each
|
|
803
|
-
* entry.
|
|
804
|
-
* @param {Uint8Array} data
|
|
805
|
-
* @param {Function} cb
|
|
806
|
-
*/
|
|
807
|
-
untar(data, cb) {
|
|
808
|
-
try {
|
|
809
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
810
|
-
const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_export);
|
|
811
|
-
const len0 = WASM_VECTOR_LEN;
|
|
812
|
-
wasm.proxycontext_untar(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(cb));
|
|
813
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
814
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
815
|
-
if (r1) {
|
|
816
|
-
throw takeObject(r0);
|
|
817
|
-
}
|
|
818
|
-
} finally {
|
|
819
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
820
|
-
}
|
|
821
|
-
}
|
|
822
|
-
};
|
|
823
|
-
if (Symbol.dispose) ProxyContext.prototype[Symbol.dispose] = ProxyContext.prototype.free;
|
|
824
|
-
TypstCompileWorld = class _TypstCompileWorld {
|
|
825
|
-
static __wrap(ptr) {
|
|
826
|
-
ptr = ptr >>> 0;
|
|
827
|
-
const obj = Object.create(_TypstCompileWorld.prototype);
|
|
828
|
-
obj.__wbg_ptr = ptr;
|
|
829
|
-
TypstCompileWorldFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
830
|
-
return obj;
|
|
831
|
-
}
|
|
832
|
-
__destroy_into_raw() {
|
|
833
|
-
const ptr = this.__wbg_ptr;
|
|
834
|
-
this.__wbg_ptr = 0;
|
|
835
|
-
TypstCompileWorldFinalization.unregister(this);
|
|
836
|
-
return ptr;
|
|
837
|
-
}
|
|
838
|
-
free() {
|
|
839
|
-
const ptr = this.__destroy_into_raw();
|
|
840
|
-
wasm.__wbg_typstcompileworld_free(ptr, 0);
|
|
841
|
-
}
|
|
842
|
-
/**
|
|
843
|
-
* @param {number} kind
|
|
844
|
-
* @param {number} diagnostics_format
|
|
845
|
-
* @returns {any}
|
|
846
|
-
*/
|
|
847
|
-
compile(kind, diagnostics_format) {
|
|
848
|
-
try {
|
|
849
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
850
|
-
wasm.typstcompileworld_compile(retptr, this.__wbg_ptr, kind, diagnostics_format);
|
|
851
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
852
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
853
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
854
|
-
if (r2) {
|
|
855
|
-
throw takeObject(r1);
|
|
856
|
-
}
|
|
857
|
-
return takeObject(r0);
|
|
858
|
-
} finally {
|
|
859
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
860
|
-
}
|
|
861
|
-
}
|
|
862
|
-
/**
|
|
863
|
-
* @param {number} kind
|
|
864
|
-
* @returns {string | undefined}
|
|
865
|
-
*/
|
|
866
|
-
title(kind) {
|
|
867
|
-
try {
|
|
868
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
869
|
-
wasm.typstcompileworld_title(retptr, this.__wbg_ptr, kind);
|
|
870
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
871
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
872
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
873
|
-
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
874
|
-
if (r3) {
|
|
875
|
-
throw takeObject(r2);
|
|
876
|
-
}
|
|
877
|
-
let v1;
|
|
878
|
-
if (r0 !== 0) {
|
|
879
|
-
v1 = getStringFromWasm0(r0, r1).slice();
|
|
880
|
-
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
881
|
-
}
|
|
882
|
-
return v1;
|
|
883
|
-
} finally {
|
|
884
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
885
|
-
}
|
|
886
|
-
}
|
|
887
|
-
/**
|
|
888
|
-
* @param {number} fmt
|
|
889
|
-
* @param {number} diagnostics_format
|
|
890
|
-
* @returns {any}
|
|
891
|
-
*/
|
|
892
|
-
get_artifact(fmt, diagnostics_format) {
|
|
893
|
-
try {
|
|
894
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
895
|
-
wasm.typstcompileworld_get_artifact(retptr, this.__wbg_ptr, fmt, diagnostics_format);
|
|
896
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
897
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
898
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
899
|
-
if (r2) {
|
|
900
|
-
throw takeObject(r1);
|
|
901
|
-
}
|
|
902
|
-
return takeObject(r0);
|
|
903
|
-
} finally {
|
|
904
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
905
|
-
}
|
|
906
|
-
}
|
|
907
|
-
/**
|
|
908
|
-
* @param {number} kind
|
|
909
|
-
* @param {string} selector
|
|
910
|
-
* @param {string | null} [field]
|
|
911
|
-
* @returns {string}
|
|
912
|
-
*/
|
|
913
|
-
query(kind, selector, field) {
|
|
914
|
-
let deferred4_0;
|
|
915
|
-
let deferred4_1;
|
|
916
|
-
try {
|
|
917
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
918
|
-
const ptr0 = passStringToWasm0(selector, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
919
|
-
const len0 = WASM_VECTOR_LEN;
|
|
920
|
-
var ptr1 = isLikeNone(field) ? 0 : passStringToWasm0(field, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
921
|
-
var len1 = WASM_VECTOR_LEN;
|
|
922
|
-
wasm.typstcompileworld_query(retptr, this.__wbg_ptr, kind, ptr0, len0, ptr1, len1);
|
|
923
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
924
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
925
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
926
|
-
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
927
|
-
var ptr3 = r0;
|
|
928
|
-
var len3 = r1;
|
|
929
|
-
if (r3) {
|
|
930
|
-
ptr3 = 0;
|
|
931
|
-
len3 = 0;
|
|
932
|
-
throw takeObject(r2);
|
|
933
|
-
}
|
|
934
|
-
deferred4_0 = ptr3;
|
|
935
|
-
deferred4_1 = len3;
|
|
936
|
-
return getStringFromWasm0(ptr3, len3);
|
|
937
|
-
} finally {
|
|
938
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
939
|
-
wasm.__wbindgen_export4(deferred4_0, deferred4_1, 1);
|
|
940
|
-
}
|
|
941
|
-
}
|
|
942
|
-
/**
|
|
943
|
-
* @param {IncrServer} state
|
|
944
|
-
* @param {number} diagnostics_format
|
|
945
|
-
* @returns {any}
|
|
946
|
-
*/
|
|
947
|
-
incr_compile(state, diagnostics_format) {
|
|
948
|
-
try {
|
|
949
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
950
|
-
_assertClass(state, IncrServer);
|
|
951
|
-
wasm.typstcompileworld_incr_compile(retptr, this.__wbg_ptr, state.__wbg_ptr, diagnostics_format);
|
|
952
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
953
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
954
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
955
|
-
if (r2) {
|
|
956
|
-
throw takeObject(r1);
|
|
957
|
-
}
|
|
958
|
-
return takeObject(r0);
|
|
959
|
-
} finally {
|
|
960
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
961
|
-
}
|
|
962
|
-
}
|
|
963
|
-
};
|
|
964
|
-
if (Symbol.dispose) TypstCompileWorld.prototype[Symbol.dispose] = TypstCompileWorld.prototype.free;
|
|
965
|
-
TypstCompiler = class _TypstCompiler {
|
|
966
|
-
static __wrap(ptr) {
|
|
967
|
-
ptr = ptr >>> 0;
|
|
968
|
-
const obj = Object.create(_TypstCompiler.prototype);
|
|
969
|
-
obj.__wbg_ptr = ptr;
|
|
970
|
-
TypstCompilerFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
971
|
-
return obj;
|
|
972
|
-
}
|
|
973
|
-
__destroy_into_raw() {
|
|
974
|
-
const ptr = this.__wbg_ptr;
|
|
975
|
-
this.__wbg_ptr = 0;
|
|
976
|
-
TypstCompilerFinalization.unregister(this);
|
|
977
|
-
return ptr;
|
|
978
|
-
}
|
|
979
|
-
free() {
|
|
980
|
-
const ptr = this.__destroy_into_raw();
|
|
981
|
-
wasm.__wbg_typstcompiler_free(ptr, 0);
|
|
982
|
-
}
|
|
983
|
-
reset() {
|
|
984
|
-
try {
|
|
985
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
986
|
-
wasm.typstcompiler_reset(retptr, this.__wbg_ptr);
|
|
987
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
988
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
989
|
-
if (r1) {
|
|
990
|
-
throw takeObject(r0);
|
|
991
|
-
}
|
|
992
|
-
} finally {
|
|
993
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
994
|
-
}
|
|
995
|
-
}
|
|
996
|
-
/**
|
|
997
|
-
* @param {TypstFontResolver} fonts
|
|
998
|
-
*/
|
|
999
|
-
set_fonts(fonts) {
|
|
1000
|
-
try {
|
|
1001
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1002
|
-
_assertClass(fonts, TypstFontResolver);
|
|
1003
|
-
wasm.typstcompiler_set_fonts(retptr, this.__wbg_ptr, fonts.__wbg_ptr);
|
|
1004
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1005
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1006
|
-
if (r1) {
|
|
1007
|
-
throw takeObject(r0);
|
|
1008
|
-
}
|
|
1009
|
-
} finally {
|
|
1010
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1011
|
-
}
|
|
1012
|
-
}
|
|
1013
|
-
/**
|
|
1014
|
-
* @param {any} inputs
|
|
1015
|
-
*/
|
|
1016
|
-
set_inputs(inputs) {
|
|
1017
|
-
try {
|
|
1018
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1019
|
-
wasm.typstcompiler_set_inputs(retptr, this.__wbg_ptr, addHeapObject(inputs));
|
|
1020
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1021
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1022
|
-
if (r1) {
|
|
1023
|
-
throw takeObject(r0);
|
|
1024
|
-
}
|
|
1025
|
-
} finally {
|
|
1026
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1027
|
-
}
|
|
1028
|
-
}
|
|
1029
|
-
/**
|
|
1030
|
-
* @param {string} path
|
|
1031
|
-
* @param {string} content
|
|
1032
|
-
* @returns {boolean}
|
|
1033
|
-
*/
|
|
1034
|
-
add_source(path, content) {
|
|
1035
|
-
const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1036
|
-
const len0 = WASM_VECTOR_LEN;
|
|
1037
|
-
const ptr1 = passStringToWasm0(content, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1038
|
-
const len1 = WASM_VECTOR_LEN;
|
|
1039
|
-
const ret = wasm.typstcompiler_add_source(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
1040
|
-
return ret !== 0;
|
|
1041
|
-
}
|
|
1042
|
-
/**
|
|
1043
|
-
* @param {string} path
|
|
1044
|
-
* @param {Uint8Array} content
|
|
1045
|
-
* @returns {boolean}
|
|
1046
|
-
*/
|
|
1047
|
-
map_shadow(path, content) {
|
|
1048
|
-
const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1049
|
-
const len0 = WASM_VECTOR_LEN;
|
|
1050
|
-
const ptr1 = passArray8ToWasm0(content, wasm.__wbindgen_export);
|
|
1051
|
-
const len1 = WASM_VECTOR_LEN;
|
|
1052
|
-
const ret = wasm.typstcompiler_map_shadow(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
1053
|
-
return ret !== 0;
|
|
1054
|
-
}
|
|
1055
|
-
/**
|
|
1056
|
-
* @param {string} path
|
|
1057
|
-
* @returns {boolean}
|
|
1058
|
-
*/
|
|
1059
|
-
unmap_shadow(path) {
|
|
1060
|
-
const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1061
|
-
const len0 = WASM_VECTOR_LEN;
|
|
1062
|
-
const ret = wasm.typstcompiler_unmap_shadow(this.__wbg_ptr, ptr0, len0);
|
|
1063
|
-
return ret !== 0;
|
|
1064
|
-
}
|
|
1065
|
-
reset_shadow() {
|
|
1066
|
-
wasm.typstcompiler_reset_shadow(this.__wbg_ptr);
|
|
1067
|
-
}
|
|
1068
|
-
/**
|
|
1069
|
-
* @returns {string[]}
|
|
1070
|
-
*/
|
|
1071
|
-
get_loaded_fonts() {
|
|
1072
|
-
try {
|
|
1073
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1074
|
-
wasm.typstcompiler_get_loaded_fonts(retptr, this.__wbg_ptr);
|
|
1075
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1076
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1077
|
-
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
1078
|
-
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
1079
|
-
return v1;
|
|
1080
|
-
} finally {
|
|
1081
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1082
|
-
}
|
|
1083
|
-
}
|
|
1084
|
-
/**
|
|
1085
|
-
* @param {string} main_file_path
|
|
1086
|
-
* @returns {string}
|
|
1087
|
-
*/
|
|
1088
|
-
get_ast(main_file_path) {
|
|
1089
|
-
let deferred3_0;
|
|
1090
|
-
let deferred3_1;
|
|
1091
|
-
try {
|
|
1092
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1093
|
-
const ptr0 = passStringToWasm0(main_file_path, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1094
|
-
const len0 = WASM_VECTOR_LEN;
|
|
1095
|
-
wasm.typstcompiler_get_ast(retptr, this.__wbg_ptr, ptr0, len0);
|
|
1096
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1097
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1098
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1099
|
-
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
1100
|
-
var ptr2 = r0;
|
|
1101
|
-
var len2 = r1;
|
|
1102
|
-
if (r3) {
|
|
1103
|
-
ptr2 = 0;
|
|
1104
|
-
len2 = 0;
|
|
1105
|
-
throw takeObject(r2);
|
|
1106
|
-
}
|
|
1107
|
-
deferred3_0 = ptr2;
|
|
1108
|
-
deferred3_1 = len2;
|
|
1109
|
-
return getStringFromWasm0(ptr2, len2);
|
|
1110
|
-
} finally {
|
|
1111
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1112
|
-
wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
|
|
1113
|
-
}
|
|
1114
|
-
}
|
|
1115
|
-
/**
|
|
1116
|
-
* @returns {any}
|
|
1117
|
-
*/
|
|
1118
|
-
get_semantic_token_legend() {
|
|
1119
|
-
try {
|
|
1120
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1121
|
-
wasm.typstcompiler_get_semantic_token_legend(retptr, this.__wbg_ptr);
|
|
1122
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1123
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1124
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1125
|
-
if (r2) {
|
|
1126
|
-
throw takeObject(r1);
|
|
1127
|
-
}
|
|
1128
|
-
return takeObject(r0);
|
|
1129
|
-
} finally {
|
|
1130
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1131
|
-
}
|
|
1132
|
-
}
|
|
1133
|
-
/**
|
|
1134
|
-
* @param {string} offset_encoding
|
|
1135
|
-
* @param {string | null} [file_path]
|
|
1136
|
-
* @param {string | null} [result_id]
|
|
1137
|
-
* @returns {object}
|
|
1138
|
-
*/
|
|
1139
|
-
get_semantic_tokens(offset_encoding, file_path, result_id) {
|
|
1140
|
-
try {
|
|
1141
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1142
|
-
const ptr0 = passStringToWasm0(offset_encoding, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1143
|
-
const len0 = WASM_VECTOR_LEN;
|
|
1144
|
-
var ptr1 = isLikeNone(file_path) ? 0 : passStringToWasm0(file_path, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1145
|
-
var len1 = WASM_VECTOR_LEN;
|
|
1146
|
-
var ptr2 = isLikeNone(result_id) ? 0 : passStringToWasm0(result_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1147
|
-
var len2 = WASM_VECTOR_LEN;
|
|
1148
|
-
wasm.typstcompiler_get_semantic_tokens(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
1149
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1150
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1151
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1152
|
-
if (r2) {
|
|
1153
|
-
throw takeObject(r1);
|
|
1154
|
-
}
|
|
1155
|
-
return takeObject(r0);
|
|
1156
|
-
} finally {
|
|
1157
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1158
|
-
}
|
|
1159
|
-
}
|
|
1160
|
-
/**
|
|
1161
|
-
* @param {string | null} [root]
|
|
1162
|
-
* @param {string | null} [main_file_path]
|
|
1163
|
-
* @param {(Array<any>)[] | null} [inputs]
|
|
1164
|
-
* @returns {TypstCompileWorld}
|
|
1165
|
-
*/
|
|
1166
|
-
snapshot(root, main_file_path, inputs) {
|
|
1167
|
-
try {
|
|
1168
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1169
|
-
var ptr0 = isLikeNone(root) ? 0 : passStringToWasm0(root, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1170
|
-
var len0 = WASM_VECTOR_LEN;
|
|
1171
|
-
var ptr1 = isLikeNone(main_file_path) ? 0 : passStringToWasm0(main_file_path, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1172
|
-
var len1 = WASM_VECTOR_LEN;
|
|
1173
|
-
var ptr2 = isLikeNone(inputs) ? 0 : passArrayJsValueToWasm0(inputs, wasm.__wbindgen_export);
|
|
1174
|
-
var len2 = WASM_VECTOR_LEN;
|
|
1175
|
-
wasm.typstcompiler_snapshot(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
1176
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1177
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1178
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1179
|
-
if (r2) {
|
|
1180
|
-
throw takeObject(r1);
|
|
1181
|
-
}
|
|
1182
|
-
return TypstCompileWorld.__wrap(r0);
|
|
1183
|
-
} finally {
|
|
1184
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1185
|
-
}
|
|
1186
|
-
}
|
|
1187
|
-
/**
|
|
1188
|
-
* @param {string} fmt
|
|
1189
|
-
* @param {number} diagnostics_format
|
|
1190
|
-
* @returns {any}
|
|
1191
|
-
*/
|
|
1192
|
-
get_artifact(fmt, diagnostics_format) {
|
|
1193
|
-
try {
|
|
1194
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1195
|
-
const ptr0 = passStringToWasm0(fmt, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1196
|
-
const len0 = WASM_VECTOR_LEN;
|
|
1197
|
-
wasm.typstcompiler_get_artifact(retptr, this.__wbg_ptr, ptr0, len0, diagnostics_format);
|
|
1198
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1199
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1200
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1201
|
-
if (r2) {
|
|
1202
|
-
throw takeObject(r1);
|
|
1203
|
-
}
|
|
1204
|
-
return takeObject(r0);
|
|
1205
|
-
} finally {
|
|
1206
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1207
|
-
}
|
|
1208
|
-
}
|
|
1209
|
-
/**
|
|
1210
|
-
* @param {string | null | undefined} main_file_path
|
|
1211
|
-
* @param {(Array<any>)[] | null | undefined} inputs
|
|
1212
|
-
* @param {string} fmt
|
|
1213
|
-
* @param {number} diagnostics_format
|
|
1214
|
-
* @returns {any}
|
|
1215
|
-
*/
|
|
1216
|
-
compile(main_file_path, inputs, fmt, diagnostics_format) {
|
|
1217
|
-
try {
|
|
1218
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1219
|
-
var ptr0 = isLikeNone(main_file_path) ? 0 : passStringToWasm0(main_file_path, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1220
|
-
var len0 = WASM_VECTOR_LEN;
|
|
1221
|
-
var ptr1 = isLikeNone(inputs) ? 0 : passArrayJsValueToWasm0(inputs, wasm.__wbindgen_export);
|
|
1222
|
-
var len1 = WASM_VECTOR_LEN;
|
|
1223
|
-
const ptr2 = passStringToWasm0(fmt, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1224
|
-
const len2 = WASM_VECTOR_LEN;
|
|
1225
|
-
wasm.typstcompiler_compile(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, diagnostics_format);
|
|
1226
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1227
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1228
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1229
|
-
if (r2) {
|
|
1230
|
-
throw takeObject(r1);
|
|
1231
|
-
}
|
|
1232
|
-
return takeObject(r0);
|
|
1233
|
-
} finally {
|
|
1234
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1235
|
-
}
|
|
1236
|
-
}
|
|
1237
|
-
/**
|
|
1238
|
-
* @param {string} main_file_path
|
|
1239
|
-
* @param {(Array<any>)[] | null | undefined} inputs
|
|
1240
|
-
* @param {string} selector
|
|
1241
|
-
* @param {string | null} [field]
|
|
1242
|
-
* @returns {string}
|
|
1243
|
-
*/
|
|
1244
|
-
query(main_file_path, inputs, selector, field) {
|
|
1245
|
-
let deferred6_0;
|
|
1246
|
-
let deferred6_1;
|
|
1247
|
-
try {
|
|
1248
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1249
|
-
const ptr0 = passStringToWasm0(main_file_path, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1250
|
-
const len0 = WASM_VECTOR_LEN;
|
|
1251
|
-
var ptr1 = isLikeNone(inputs) ? 0 : passArrayJsValueToWasm0(inputs, wasm.__wbindgen_export);
|
|
1252
|
-
var len1 = WASM_VECTOR_LEN;
|
|
1253
|
-
const ptr2 = passStringToWasm0(selector, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1254
|
-
const len2 = WASM_VECTOR_LEN;
|
|
1255
|
-
var ptr3 = isLikeNone(field) ? 0 : passStringToWasm0(field, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1256
|
-
var len3 = WASM_VECTOR_LEN;
|
|
1257
|
-
wasm.typstcompiler_query(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
1258
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1259
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1260
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1261
|
-
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
1262
|
-
var ptr5 = r0;
|
|
1263
|
-
var len5 = r1;
|
|
1264
|
-
if (r3) {
|
|
1265
|
-
ptr5 = 0;
|
|
1266
|
-
len5 = 0;
|
|
1267
|
-
throw takeObject(r2);
|
|
1268
|
-
}
|
|
1269
|
-
deferred6_0 = ptr5;
|
|
1270
|
-
deferred6_1 = len5;
|
|
1271
|
-
return getStringFromWasm0(ptr5, len5);
|
|
1272
|
-
} finally {
|
|
1273
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1274
|
-
wasm.__wbindgen_export4(deferred6_0, deferred6_1, 1);
|
|
1275
|
-
}
|
|
1276
|
-
}
|
|
1277
|
-
/**
|
|
1278
|
-
* @returns {IncrServer}
|
|
1279
|
-
*/
|
|
1280
|
-
create_incr_server() {
|
|
1281
|
-
try {
|
|
1282
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1283
|
-
wasm.typstcompiler_create_incr_server(retptr, this.__wbg_ptr);
|
|
1284
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1285
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1286
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1287
|
-
if (r2) {
|
|
1288
|
-
throw takeObject(r1);
|
|
1289
|
-
}
|
|
1290
|
-
return IncrServer.__wrap(r0);
|
|
1291
|
-
} finally {
|
|
1292
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1293
|
-
}
|
|
1294
|
-
}
|
|
1295
|
-
/**
|
|
1296
|
-
* @param {string} main_file_path
|
|
1297
|
-
* @param {(Array<any>)[] | null | undefined} inputs
|
|
1298
|
-
* @param {IncrServer} state
|
|
1299
|
-
* @param {number} diagnostics_format
|
|
1300
|
-
* @returns {any}
|
|
1301
|
-
*/
|
|
1302
|
-
incr_compile(main_file_path, inputs, state, diagnostics_format) {
|
|
1303
|
-
try {
|
|
1304
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1305
|
-
const ptr0 = passStringToWasm0(main_file_path, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1306
|
-
const len0 = WASM_VECTOR_LEN;
|
|
1307
|
-
var ptr1 = isLikeNone(inputs) ? 0 : passArrayJsValueToWasm0(inputs, wasm.__wbindgen_export);
|
|
1308
|
-
var len1 = WASM_VECTOR_LEN;
|
|
1309
|
-
_assertClass(state, IncrServer);
|
|
1310
|
-
wasm.typstcompiler_incr_compile(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, state.__wbg_ptr, diagnostics_format);
|
|
1311
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1312
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1313
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1314
|
-
if (r2) {
|
|
1315
|
-
throw takeObject(r1);
|
|
1316
|
-
}
|
|
1317
|
-
return takeObject(r0);
|
|
1318
|
-
} finally {
|
|
1319
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1320
|
-
}
|
|
1321
|
-
}
|
|
1322
|
-
};
|
|
1323
|
-
if (Symbol.dispose) TypstCompiler.prototype[Symbol.dispose] = TypstCompiler.prototype.free;
|
|
1324
|
-
TypstCompilerBuilder = class {
|
|
1325
|
-
__destroy_into_raw() {
|
|
1326
|
-
const ptr = this.__wbg_ptr;
|
|
1327
|
-
this.__wbg_ptr = 0;
|
|
1328
|
-
TypstCompilerBuilderFinalization.unregister(this);
|
|
1329
|
-
return ptr;
|
|
1330
|
-
}
|
|
1331
|
-
free() {
|
|
1332
|
-
const ptr = this.__destroy_into_raw();
|
|
1333
|
-
wasm.__wbg_typstcompilerbuilder_free(ptr, 0);
|
|
1334
|
-
}
|
|
1335
|
-
constructor() {
|
|
1336
|
-
try {
|
|
1337
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1338
|
-
wasm.typstcompilerbuilder_new(retptr);
|
|
1339
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1340
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1341
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1342
|
-
if (r2) {
|
|
1343
|
-
throw takeObject(r1);
|
|
1344
|
-
}
|
|
1345
|
-
this.__wbg_ptr = r0 >>> 0;
|
|
1346
|
-
TypstCompilerBuilderFinalization.register(this, this.__wbg_ptr, this);
|
|
1347
|
-
return this;
|
|
1348
|
-
} finally {
|
|
1349
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1350
|
-
}
|
|
1351
|
-
}
|
|
1352
|
-
set_dummy_access_model() {
|
|
1353
|
-
try {
|
|
1354
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1355
|
-
wasm.typstcompilerbuilder_set_dummy_access_model(retptr, this.__wbg_ptr);
|
|
1356
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1357
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1358
|
-
if (r1) {
|
|
1359
|
-
throw takeObject(r0);
|
|
1360
|
-
}
|
|
1361
|
-
} finally {
|
|
1362
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1363
|
-
}
|
|
1364
|
-
}
|
|
1365
|
-
/**
|
|
1366
|
-
* @param {any} context
|
|
1367
|
-
* @param {Function} mtime_fn
|
|
1368
|
-
* @param {Function} is_file_fn
|
|
1369
|
-
* @param {Function} real_path_fn
|
|
1370
|
-
* @param {Function} read_all_fn
|
|
1371
|
-
* @returns {Promise<void>}
|
|
1372
|
-
*/
|
|
1373
|
-
set_access_model(context, mtime_fn, is_file_fn, real_path_fn, read_all_fn) {
|
|
1374
|
-
const ret = wasm.typstcompilerbuilder_set_access_model(this.__wbg_ptr, addHeapObject(context), addHeapObject(mtime_fn), addHeapObject(is_file_fn), addHeapObject(real_path_fn), addHeapObject(read_all_fn));
|
|
1375
|
-
return takeObject(ret);
|
|
1376
|
-
}
|
|
1377
|
-
/**
|
|
1378
|
-
* @param {any} context
|
|
1379
|
-
* @param {Function} real_resolve_fn
|
|
1380
|
-
* @returns {Promise<void>}
|
|
1381
|
-
*/
|
|
1382
|
-
set_package_registry(context, real_resolve_fn) {
|
|
1383
|
-
const ret = wasm.typstcompilerbuilder_set_package_registry(this.__wbg_ptr, addHeapObject(context), addHeapObject(real_resolve_fn));
|
|
1384
|
-
return takeObject(ret);
|
|
1385
|
-
}
|
|
1386
|
-
/**
|
|
1387
|
-
* @param {Uint8Array} data
|
|
1388
|
-
* @returns {Promise<void>}
|
|
1389
|
-
*/
|
|
1390
|
-
add_raw_font(data) {
|
|
1391
|
-
const ret = wasm.typstcompilerbuilder_add_raw_font(this.__wbg_ptr, addHeapObject(data));
|
|
1392
|
-
return takeObject(ret);
|
|
1393
|
-
}
|
|
1394
|
-
/**
|
|
1395
|
-
* @param {any} font
|
|
1396
|
-
* @param {Function} blob
|
|
1397
|
-
* @returns {Promise<void>}
|
|
1398
|
-
*/
|
|
1399
|
-
add_lazy_font(font, blob) {
|
|
1400
|
-
const ret = wasm.typstcompilerbuilder_add_lazy_font(this.__wbg_ptr, addHeapObject(font), addHeapObject(blob));
|
|
1401
|
-
return takeObject(ret);
|
|
1402
|
-
}
|
|
1403
|
-
/**
|
|
1404
|
-
* @returns {Promise<TypstCompiler>}
|
|
1405
|
-
*/
|
|
1406
|
-
build() {
|
|
1407
|
-
const ptr = this.__destroy_into_raw();
|
|
1408
|
-
const ret = wasm.typstcompilerbuilder_build(ptr);
|
|
1409
|
-
return takeObject(ret);
|
|
1410
|
-
}
|
|
1411
|
-
};
|
|
1412
|
-
if (Symbol.dispose) TypstCompilerBuilder.prototype[Symbol.dispose] = TypstCompilerBuilder.prototype.free;
|
|
1413
|
-
TypstFontResolver = class _TypstFontResolver {
|
|
1414
|
-
static __wrap(ptr) {
|
|
1415
|
-
ptr = ptr >>> 0;
|
|
1416
|
-
const obj = Object.create(_TypstFontResolver.prototype);
|
|
1417
|
-
obj.__wbg_ptr = ptr;
|
|
1418
|
-
TypstFontResolverFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1419
|
-
return obj;
|
|
1420
|
-
}
|
|
1421
|
-
__destroy_into_raw() {
|
|
1422
|
-
const ptr = this.__wbg_ptr;
|
|
1423
|
-
this.__wbg_ptr = 0;
|
|
1424
|
-
TypstFontResolverFinalization.unregister(this);
|
|
1425
|
-
return ptr;
|
|
1426
|
-
}
|
|
1427
|
-
free() {
|
|
1428
|
-
const ptr = this.__destroy_into_raw();
|
|
1429
|
-
wasm.__wbg_typstfontresolver_free(ptr, 0);
|
|
1430
|
-
}
|
|
1431
|
-
};
|
|
1432
|
-
if (Symbol.dispose) TypstFontResolver.prototype[Symbol.dispose] = TypstFontResolver.prototype.free;
|
|
1433
|
-
TypstFontResolverBuilder = class {
|
|
1434
|
-
__destroy_into_raw() {
|
|
1435
|
-
const ptr = this.__wbg_ptr;
|
|
1436
|
-
this.__wbg_ptr = 0;
|
|
1437
|
-
TypstFontResolverBuilderFinalization.unregister(this);
|
|
1438
|
-
return ptr;
|
|
1439
|
-
}
|
|
1440
|
-
free() {
|
|
1441
|
-
const ptr = this.__destroy_into_raw();
|
|
1442
|
-
wasm.__wbg_typstfontresolverbuilder_free(ptr, 0);
|
|
1443
|
-
}
|
|
1444
|
-
constructor() {
|
|
1445
|
-
try {
|
|
1446
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1447
|
-
wasm.typstfontresolverbuilder_new(retptr);
|
|
1448
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1449
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1450
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1451
|
-
if (r2) {
|
|
1452
|
-
throw takeObject(r1);
|
|
1453
|
-
}
|
|
1454
|
-
this.__wbg_ptr = r0 >>> 0;
|
|
1455
|
-
TypstFontResolverBuilderFinalization.register(this, this.__wbg_ptr, this);
|
|
1456
|
-
return this;
|
|
1457
|
-
} finally {
|
|
1458
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1459
|
-
}
|
|
1460
|
-
}
|
|
1461
|
-
/**
|
|
1462
|
-
* @param {Uint8Array} buffer
|
|
1463
|
-
* @returns {any}
|
|
1464
|
-
*/
|
|
1465
|
-
get_font_info(buffer) {
|
|
1466
|
-
try {
|
|
1467
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1468
|
-
wasm.typstfontresolverbuilder_get_font_info(retptr, this.__wbg_ptr, addHeapObject(buffer));
|
|
1469
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1470
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1471
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1472
|
-
if (r2) {
|
|
1473
|
-
throw takeObject(r1);
|
|
1474
|
-
}
|
|
1475
|
-
return takeObject(r0);
|
|
1476
|
-
} finally {
|
|
1477
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1478
|
-
}
|
|
1479
|
-
}
|
|
1480
|
-
/**
|
|
1481
|
-
* Adds font data to the searcher.
|
|
1482
|
-
* @param {Uint8Array} buffer
|
|
1483
|
-
*/
|
|
1484
|
-
add_raw_font(buffer) {
|
|
1485
|
-
try {
|
|
1486
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1487
|
-
wasm.typstfontresolverbuilder_add_raw_font(retptr, this.__wbg_ptr, addHeapObject(buffer));
|
|
1488
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1489
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1490
|
-
if (r1) {
|
|
1491
|
-
throw takeObject(r0);
|
|
1492
|
-
}
|
|
1493
|
-
} finally {
|
|
1494
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1495
|
-
}
|
|
1496
|
-
}
|
|
1497
|
-
/**
|
|
1498
|
-
* Adds callback that loads font data lazily to the searcher.
|
|
1499
|
-
* `get_font_info` can be used to get the font info.
|
|
1500
|
-
* @param {any} font
|
|
1501
|
-
* @param {Function} blob
|
|
1502
|
-
*/
|
|
1503
|
-
add_lazy_font(font, blob) {
|
|
1504
|
-
try {
|
|
1505
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1506
|
-
wasm.typstfontresolverbuilder_add_lazy_font(retptr, this.__wbg_ptr, addHeapObject(font), addHeapObject(blob));
|
|
1507
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1508
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1509
|
-
if (r1) {
|
|
1510
|
-
throw takeObject(r0);
|
|
1511
|
-
}
|
|
1512
|
-
} finally {
|
|
1513
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1514
|
-
}
|
|
1515
|
-
}
|
|
1516
|
-
/**
|
|
1517
|
-
* @returns {Promise<TypstFontResolver>}
|
|
1518
|
-
*/
|
|
1519
|
-
build() {
|
|
1520
|
-
const ptr = this.__destroy_into_raw();
|
|
1521
|
-
const ret = wasm.typstfontresolverbuilder_build(ptr);
|
|
1522
|
-
return takeObject(ret);
|
|
1523
|
-
}
|
|
1524
|
-
};
|
|
1525
|
-
if (Symbol.dispose) TypstFontResolverBuilder.prototype[Symbol.dispose] = TypstFontResolverBuilder.prototype.free;
|
|
1526
|
-
EXPECTED_RESPONSE_TYPES = /* @__PURE__ */ new Set(["basic", "cors", "default"]);
|
|
1527
|
-
typst_ts_web_compiler_default = __wbg_init;
|
|
1528
|
-
importWasmModule = async function(wasm_name, url) {
|
|
1529
|
-
throw new Error("Cannot import wasm module without importer: " + wasm_name + " " + url);
|
|
1530
|
-
};
|
|
1531
|
-
}
|
|
1532
|
-
});
|
|
1533
|
-
|
|
1534
|
-
// ../../node_modules/.bun/@myriaddreamin+typst-ts-web-compiler@0.7.0-rc2/node_modules/@myriaddreamin/typst-ts-web-compiler/pkg/wasm-pack-shim.mjs
|
|
1535
|
-
var wasm_pack_shim_exports = {};
|
|
1536
|
-
__export(wasm_pack_shim_exports, {
|
|
1537
|
-
IncrServer: () => IncrServer,
|
|
1538
|
-
ProxyContext: () => ProxyContext,
|
|
1539
|
-
TypstCompileWorld: () => TypstCompileWorld,
|
|
1540
|
-
TypstCompiler: () => TypstCompiler,
|
|
1541
|
-
TypstCompilerBuilder: () => TypstCompilerBuilder,
|
|
1542
|
-
TypstFontResolver: () => TypstFontResolver,
|
|
1543
|
-
TypstFontResolverBuilder: () => TypstFontResolverBuilder,
|
|
1544
|
-
default: () => wasm_pack_shim_default,
|
|
1545
|
-
get_font_info: () => get_font_info,
|
|
1546
|
-
initSync: () => initSync,
|
|
1547
|
-
setImportWasmModule: () => setImportWasmModule
|
|
1548
|
-
});
|
|
1549
|
-
var wasm_pack_shim_default, nodeJsImportWasmModule, isNode;
|
|
1550
|
-
var init_wasm_pack_shim = __esm({
|
|
1551
|
-
"../../node_modules/.bun/@myriaddreamin+typst-ts-web-compiler@0.7.0-rc2/node_modules/@myriaddreamin/typst-ts-web-compiler/pkg/wasm-pack-shim.mjs"() {
|
|
1552
|
-
"use strict";
|
|
1553
|
-
init_typst_ts_web_compiler();
|
|
1554
|
-
init_typst_ts_web_compiler();
|
|
1555
|
-
init_typst_ts_web_compiler();
|
|
1556
|
-
wasm_pack_shim_default = typst_ts_web_compiler_default;
|
|
1557
|
-
nodeJsImportWasmModule = async function(wasm_name, url) {
|
|
1558
|
-
const escapeImport = new Function("m", "return import(m)");
|
|
1559
|
-
const { readFileSync } = await escapeImport("fs");
|
|
1560
|
-
const wasmPath = new URL(wasm_name, url);
|
|
1561
|
-
return await readFileSync(wasmPath).buffer;
|
|
1562
|
-
};
|
|
1563
|
-
isNode = typeof process !== "undefined" && process.versions != null && process.versions.node != null;
|
|
1564
|
-
if (isNode) {
|
|
1565
|
-
setImportWasmModule(nodeJsImportWasmModule);
|
|
1566
|
-
}
|
|
1567
|
-
}
|
|
1568
|
-
});
|
|
1569
|
-
|
|
1570
|
-
// src/compiler-worker.ts
|
|
1571
|
-
import * as Comlink from "comlink";
|
|
1572
|
-
|
|
1573
|
-
// ../../node_modules/.bun/@myriaddreamin+typst.ts@0.7.0-rc2+5e675a3c06b42b50/node_modules/@myriaddreamin/typst.ts/dist/esm/init.mjs
|
|
1574
|
-
var ComponentBuilder = class {
|
|
1575
|
-
loadedFonts = /* @__PURE__ */ new Set();
|
|
1576
|
-
fetcher = fetch;
|
|
1577
|
-
setFetcher(fetcher) {
|
|
1578
|
-
this.fetcher = fetcher;
|
|
1579
|
-
}
|
|
1580
|
-
async loadFonts(builder, fonts) {
|
|
1581
|
-
const escapeImport = new Function("m", "return import(m)");
|
|
1582
|
-
const fetcher = this.fetcher ||= await (async function() {
|
|
1583
|
-
const { fetchBuilder, FileSystemCache } = await escapeImport("node-fetch-cache");
|
|
1584
|
-
const cache = new FileSystemCache({
|
|
1585
|
-
/// By default, we don't have a complicated cache policy.
|
|
1586
|
-
cacheDirectory: ".cache/typst/fonts"
|
|
1587
|
-
});
|
|
1588
|
-
const cachedFetcher = fetchBuilder.withCache(cache);
|
|
1589
|
-
return function(input, init) {
|
|
1590
|
-
const timeout = setTimeout(() => {
|
|
1591
|
-
console.warn("font fetching is stucking:", input);
|
|
1592
|
-
}, 15e3);
|
|
1593
|
-
return cachedFetcher(input, init).finally(() => {
|
|
1594
|
-
clearTimeout(timeout);
|
|
1595
|
-
});
|
|
1596
|
-
};
|
|
1597
|
-
})();
|
|
1598
|
-
const fontsToLoad = fonts.filter((font) => {
|
|
1599
|
-
if (font instanceof Uint8Array || typeof font === "object" && "info" in font) {
|
|
1600
|
-
return true;
|
|
1601
|
-
}
|
|
1602
|
-
if (this.loadedFonts.has(font)) {
|
|
1603
|
-
return false;
|
|
1604
|
-
}
|
|
1605
|
-
this.loadedFonts.add(font);
|
|
1606
|
-
return true;
|
|
1607
|
-
});
|
|
1608
|
-
const fontLists = await Promise.all(fontsToLoad.map(async (font) => {
|
|
1609
|
-
if (font instanceof Uint8Array) {
|
|
1610
|
-
await builder.add_raw_font(font);
|
|
1611
|
-
return;
|
|
1612
|
-
}
|
|
1613
|
-
if (typeof font === "object" && "info" in font) {
|
|
1614
|
-
await builder.add_lazy_font(font, "blob" in font ? font.blob : loadFontSync(font));
|
|
1615
|
-
return;
|
|
1616
|
-
}
|
|
1617
|
-
return new Uint8Array(await (await fetcher(font)).arrayBuffer());
|
|
1618
|
-
}));
|
|
1619
|
-
for (const font of fontLists) {
|
|
1620
|
-
if (!font) {
|
|
1621
|
-
continue;
|
|
1622
|
-
}
|
|
1623
|
-
await builder.add_raw_font(font);
|
|
1624
|
-
}
|
|
1625
|
-
}
|
|
1626
|
-
async build(options, builder, hooks) {
|
|
1627
|
-
const buildCtx = { ref: this, builder, hooks };
|
|
1628
|
-
for (const fn of options?.beforeBuild ?? []) {
|
|
1629
|
-
await fn(void 0, buildCtx);
|
|
1630
|
-
}
|
|
1631
|
-
if (hooks.latelyBuild) {
|
|
1632
|
-
hooks.latelyBuild(buildCtx);
|
|
1633
|
-
}
|
|
1634
|
-
return await builder.build();
|
|
1635
|
-
}
|
|
1636
|
-
};
|
|
1637
|
-
async function buildComponent(options, gModule, Builder, hooks) {
|
|
1638
|
-
await gModule.init(options?.getModule?.());
|
|
1639
|
-
return await new ComponentBuilder().build(options, new Builder(), hooks);
|
|
1640
|
-
}
|
|
1641
|
-
function loadFontSync(font) {
|
|
1642
|
-
return () => {
|
|
1643
|
-
const xhr = new XMLHttpRequest();
|
|
1644
|
-
xhr.overrideMimeType("text/plain; charset=x-user-defined");
|
|
1645
|
-
xhr.open("GET", font.url, false);
|
|
1646
|
-
xhr.send(null);
|
|
1647
|
-
if (xhr.status === 200 && (xhr.response instanceof String || typeof xhr.response === "string")) {
|
|
1648
|
-
return Uint8Array.from(xhr.response, (c) => c.charCodeAt(0));
|
|
1649
|
-
}
|
|
1650
|
-
return new Uint8Array();
|
|
1651
|
-
};
|
|
1652
|
-
}
|
|
1653
|
-
|
|
1654
|
-
// ../../node_modules/.bun/@myriaddreamin+typst.ts@0.7.0-rc2+5e675a3c06b42b50/node_modules/@myriaddreamin/typst.ts/dist/esm/internal.types.mjs
|
|
1655
|
-
var kObject = /* @__PURE__ */ Symbol.for("reflexo-obj");
|
|
1656
|
-
var TypstDefaultParams;
|
|
1657
|
-
(function(TypstDefaultParams2) {
|
|
1658
|
-
TypstDefaultParams2[TypstDefaultParams2["PIXEL_PER_PT"] = 3] = "PIXEL_PER_PT";
|
|
1659
|
-
})(TypstDefaultParams || (TypstDefaultParams = {}));
|
|
1660
|
-
|
|
1661
|
-
// ../../node_modules/.bun/@myriaddreamin+typst.ts@0.7.0-rc2+5e675a3c06b42b50/node_modules/@myriaddreamin/typst.ts/dist/esm/options.init.mjs
|
|
1662
|
-
var _textFonts = [
|
|
1663
|
-
"DejaVuSansMono-Bold.ttf",
|
|
1664
|
-
"DejaVuSansMono-BoldOblique.ttf",
|
|
1665
|
-
"DejaVuSansMono-Oblique.ttf",
|
|
1666
|
-
"DejaVuSansMono.ttf",
|
|
1667
|
-
"LibertinusSerif-Bold.otf",
|
|
1668
|
-
"LibertinusSerif-BoldItalic.otf",
|
|
1669
|
-
"LibertinusSerif-Italic.otf",
|
|
1670
|
-
"LibertinusSerif-Regular.otf",
|
|
1671
|
-
"LibertinusSerif-Semibold.otf",
|
|
1672
|
-
"LibertinusSerif-SemiboldItalic.otf",
|
|
1673
|
-
"NewCM10-Bold.otf",
|
|
1674
|
-
"NewCM10-BoldItalic.otf",
|
|
1675
|
-
"NewCM10-Italic.otf",
|
|
1676
|
-
"NewCM10-Regular.otf",
|
|
1677
|
-
"NewCMMath-Bold.otf",
|
|
1678
|
-
"NewCMMath-Book.otf",
|
|
1679
|
-
"NewCMMath-Regular.otf"
|
|
1680
|
-
];
|
|
1681
|
-
var _cjkFonts = [
|
|
1682
|
-
"InriaSerif-Bold.ttf",
|
|
1683
|
-
"InriaSerif-BoldItalic.ttf",
|
|
1684
|
-
"InriaSerif-Italic.ttf",
|
|
1685
|
-
"InriaSerif-Regular.ttf",
|
|
1686
|
-
"Roboto-Regular.ttf",
|
|
1687
|
-
"NotoSerifCJKsc-Regular.otf"
|
|
1688
|
-
];
|
|
1689
|
-
var _emojiFonts = ["TwitterColorEmoji.ttf", "NotoColorEmoji-Regular-COLR.subset.ttf"];
|
|
1690
|
-
function _resolveAssets(options) {
|
|
1691
|
-
const fonts = [];
|
|
1692
|
-
if (options && options?.assets !== false && options?.assets?.length && options?.assets?.length > 0) {
|
|
1693
|
-
let defaultPrefix = {
|
|
1694
|
-
text: "https://cdn.jsdelivr.net/gh/typst/typst-assets@v0.13.1/files/fonts/",
|
|
1695
|
-
_: "https://cdn.jsdelivr.net/gh/typst/typst-dev-assets@v0.13.1/files/fonts/"
|
|
1696
|
-
};
|
|
1697
|
-
let assetUrlPrefix = options.assetUrlPrefix ?? defaultPrefix;
|
|
1698
|
-
if (typeof assetUrlPrefix === "string") {
|
|
1699
|
-
assetUrlPrefix = { _: assetUrlPrefix };
|
|
1700
|
-
} else {
|
|
1701
|
-
assetUrlPrefix = { ...defaultPrefix, ...assetUrlPrefix };
|
|
1702
|
-
}
|
|
1703
|
-
for (const key of Object.keys(assetUrlPrefix)) {
|
|
1704
|
-
const u = assetUrlPrefix[key];
|
|
1705
|
-
if (u[u.length - 1] !== "/") {
|
|
1706
|
-
assetUrlPrefix[key] = u + "/";
|
|
1707
|
-
}
|
|
1708
|
-
}
|
|
1709
|
-
const prefix = (asset, f) => f.map((font) => (assetUrlPrefix[asset] || assetUrlPrefix["_"]) + font);
|
|
1710
|
-
for (const asset of options.assets) {
|
|
1711
|
-
switch (asset) {
|
|
1712
|
-
case "text":
|
|
1713
|
-
fonts.push(...prefix(asset, _textFonts));
|
|
1714
|
-
break;
|
|
1715
|
-
case "cjk":
|
|
1716
|
-
fonts.push(...prefix(asset, _cjkFonts));
|
|
1717
|
-
break;
|
|
1718
|
-
case "emoji":
|
|
1719
|
-
fonts.push(...prefix(asset, _emojiFonts));
|
|
1720
|
-
break;
|
|
1721
|
-
}
|
|
1722
|
-
}
|
|
1723
|
-
}
|
|
1724
|
-
return fonts;
|
|
1725
|
-
}
|
|
1726
|
-
function loadFonts(userFonts, options) {
|
|
1727
|
-
const assetFonts = _resolveAssets(options);
|
|
1728
|
-
const loader = async (_, { ref, builder }) => {
|
|
1729
|
-
if (options?.fetcher) {
|
|
1730
|
-
ref.setFetcher(options.fetcher);
|
|
1731
|
-
}
|
|
1732
|
-
await ref.loadFonts(builder, [...userFonts, ...assetFonts]);
|
|
1733
|
-
};
|
|
1734
|
-
loader._preloadRemoteFontOptions = options;
|
|
1735
|
-
loader._kind = "fontLoader";
|
|
1736
|
-
return loader;
|
|
1737
|
-
}
|
|
1738
|
-
function withPackageRegistry(packageRegistry) {
|
|
1739
|
-
return async (_, { builder }) => {
|
|
1740
|
-
return new Promise((resolve) => {
|
|
1741
|
-
builder.set_package_registry(packageRegistry, function(spec) {
|
|
1742
|
-
return packageRegistry.resolve(spec, this);
|
|
1743
|
-
});
|
|
1744
|
-
resolve();
|
|
1745
|
-
});
|
|
1746
|
-
};
|
|
1747
|
-
}
|
|
1748
|
-
function withAccessModel(accessModel) {
|
|
1749
|
-
return async (_, ctx) => {
|
|
1750
|
-
if (ctx.alreadySetAccessModel) {
|
|
1751
|
-
throw new Error(`already set some assess model before: ${ctx.alreadySetAccessModel.constructor?.name}(${ctx.alreadySetAccessModel})`);
|
|
1752
|
-
}
|
|
1753
|
-
ctx.alreadySetAccessModel = accessModel;
|
|
1754
|
-
return new Promise((resolve) => {
|
|
1755
|
-
ctx.builder.set_access_model(accessModel, (path) => {
|
|
1756
|
-
const lastModified = accessModel.getMTime(path);
|
|
1757
|
-
if (lastModified) {
|
|
1758
|
-
return lastModified.getTime();
|
|
1759
|
-
}
|
|
1760
|
-
return 0;
|
|
1761
|
-
}, (path) => {
|
|
1762
|
-
return accessModel.isFile(path) || false;
|
|
1763
|
-
}, (path) => {
|
|
1764
|
-
return accessModel.getRealPath(path) || path;
|
|
1765
|
-
}, (path) => {
|
|
1766
|
-
return accessModel.readAll(path);
|
|
1767
|
-
});
|
|
1768
|
-
resolve();
|
|
1769
|
-
});
|
|
1770
|
-
};
|
|
1771
|
-
}
|
|
1772
|
-
|
|
1773
|
-
// ../../node_modules/.bun/@myriaddreamin+typst.ts@0.7.0-rc2+5e675a3c06b42b50/node_modules/@myriaddreamin/typst.ts/dist/esm/wasm.mjs
|
|
1774
|
-
var once = (fn) => {
|
|
1775
|
-
let called = false;
|
|
1776
|
-
let res;
|
|
1777
|
-
return () => {
|
|
1778
|
-
if (called) {
|
|
1779
|
-
return res;
|
|
1780
|
-
}
|
|
1781
|
-
called = true;
|
|
1782
|
-
return res = fn();
|
|
1783
|
-
};
|
|
1784
|
-
};
|
|
1785
|
-
var LazyWasmModule = class {
|
|
1786
|
-
wasmBin;
|
|
1787
|
-
initOnce;
|
|
1788
|
-
constructor(initFn) {
|
|
1789
|
-
if (typeof initFn !== "function") {
|
|
1790
|
-
throw new Error("initFn is not a function");
|
|
1791
|
-
}
|
|
1792
|
-
this.initOnce = once(async () => {
|
|
1793
|
-
await initFn(this.wasmBin);
|
|
1794
|
-
});
|
|
1795
|
-
}
|
|
1796
|
-
async init(module) {
|
|
1797
|
-
this.wasmBin = module;
|
|
1798
|
-
await this.initOnce();
|
|
1799
|
-
}
|
|
1800
|
-
};
|
|
1801
|
-
|
|
1802
|
-
// ../../node_modules/.bun/@myriaddreamin+typst.ts@0.7.0-rc2+5e675a3c06b42b50/node_modules/@myriaddreamin/typst.ts/dist/esm/compiler.mjs
|
|
1803
|
-
var CompileFormatEnum;
|
|
1804
|
-
(function(CompileFormatEnum2) {
|
|
1805
|
-
CompileFormatEnum2[CompileFormatEnum2["vector"] = 0] = "vector";
|
|
1806
|
-
CompileFormatEnum2[CompileFormatEnum2["pdf"] = 1] = "pdf";
|
|
1807
|
-
CompileFormatEnum2[CompileFormatEnum2["_dummy"] = 2] = "_dummy";
|
|
1808
|
-
})(CompileFormatEnum || (CompileFormatEnum = {}));
|
|
1809
|
-
var IncrementalServer = class {
|
|
1810
|
-
/**
|
|
1811
|
-
* @internal
|
|
1812
|
-
*/
|
|
1813
|
-
[kObject];
|
|
1814
|
-
/**
|
|
1815
|
-
* @internal
|
|
1816
|
-
*/
|
|
1817
|
-
constructor(s) {
|
|
1818
|
-
this[kObject] = s;
|
|
1819
|
-
}
|
|
1820
|
-
/**
|
|
1821
|
-
* Reset the incremental server to the initial state.
|
|
1822
|
-
*/
|
|
1823
|
-
reset() {
|
|
1824
|
-
this[kObject].reset();
|
|
1825
|
-
}
|
|
1826
|
-
/**
|
|
1827
|
-
* Return current result.
|
|
1828
|
-
*/
|
|
1829
|
-
current() {
|
|
1830
|
-
return this[kObject].current();
|
|
1831
|
-
}
|
|
1832
|
-
/**
|
|
1833
|
-
* Also attach the debug info to the result.
|
|
1834
|
-
*/
|
|
1835
|
-
setAttachDebugInfo(enable) {
|
|
1836
|
-
this[kObject].set_attach_debug_info(enable);
|
|
1837
|
-
}
|
|
1838
|
-
};
|
|
1839
|
-
var TypstFontResolverCons;
|
|
1840
|
-
/* @__PURE__ */ (function(TypstFontResolverCons2) {
|
|
1841
|
-
})(TypstFontResolverCons || (TypstFontResolverCons = {}));
|
|
1842
|
-
var TypstWorld = class {
|
|
1843
|
-
[kObject];
|
|
1844
|
-
constructor(world) {
|
|
1845
|
-
this[kObject] = world;
|
|
1846
|
-
}
|
|
1847
|
-
/**
|
|
1848
|
-
* Compile the paged document.
|
|
1849
|
-
*
|
|
1850
|
-
* @param {DiagnosticsFormat} format - The format of the diagnostics.
|
|
1851
|
-
* @returns {Promise<{ diagnostics?: DiagnosticsData[DiagnosticsFormat][] }>} - The result of the compilation.
|
|
1852
|
-
*/
|
|
1853
|
-
compile(opts) {
|
|
1854
|
-
return this[kObject].compile(0, getDiagnosticsArg(opts?.diagnostics));
|
|
1855
|
-
}
|
|
1856
|
-
/**
|
|
1857
|
-
* Compile the paged document.
|
|
1858
|
-
*
|
|
1859
|
-
* @param {DiagnosticsFormat} format - The format of the diagnostics.
|
|
1860
|
-
* @returns {Promise<{ diagnostics?: DiagnosticsData[DiagnosticsFormat][] }>} - The result of the compilation.
|
|
1861
|
-
*/
|
|
1862
|
-
compileHtml(opts) {
|
|
1863
|
-
return this[kObject].compile(1, getDiagnosticsArg(opts?.diagnostics));
|
|
1864
|
-
}
|
|
1865
|
-
/**
|
|
1866
|
-
* Runs query on the paged document.
|
|
1867
|
-
*/
|
|
1868
|
-
async query(options) {
|
|
1869
|
-
return JSON.parse(this[kObject].query(0, options.selector, options.field));
|
|
1870
|
-
}
|
|
1871
|
-
/**
|
|
1872
|
-
* Get the title of the paged document.
|
|
1873
|
-
* Throw error if the world didn't compile the paged document.
|
|
1874
|
-
*
|
|
1875
|
-
* @returns {string | undefined} - The title of the paged document.
|
|
1876
|
-
*/
|
|
1877
|
-
title() {
|
|
1878
|
-
return this[kObject].title(0);
|
|
1879
|
-
}
|
|
1880
|
-
/**
|
|
1881
|
-
* Export the paged document as vector format.
|
|
1882
|
-
*
|
|
1883
|
-
* @returns {Uint8Array | undefined} - The title of the paged document.
|
|
1884
|
-
*/
|
|
1885
|
-
vector(opts) {
|
|
1886
|
-
return this[kObject].get_artifact(0, getDiagnosticsArg(opts?.diagnostics)) || {};
|
|
1887
|
-
}
|
|
1888
|
-
/**
|
|
1889
|
-
* Export the paged document to PDF.
|
|
1890
|
-
*
|
|
1891
|
-
* @returns {Uint8Array | undefined} - The title of the paged document.
|
|
1892
|
-
*/
|
|
1893
|
-
pdf(opts) {
|
|
1894
|
-
return this[kObject].get_artifact(1, getDiagnosticsArg(opts?.diagnostics)) || {};
|
|
1895
|
-
}
|
|
1896
|
-
};
|
|
1897
|
-
var gCompilerModule = (module) => new LazyWasmModule(async (bin) => {
|
|
1898
|
-
return await module.default(bin);
|
|
1899
|
-
});
|
|
1900
|
-
function createTypstCompiler() {
|
|
1901
|
-
return new TypstCompilerDriver();
|
|
1902
|
-
}
|
|
1903
|
-
var TypstCompilerDriver = class _TypstCompilerDriver {
|
|
1904
|
-
compiler;
|
|
1905
|
-
compilerJs;
|
|
1906
|
-
static defaultAssets = ["text"];
|
|
1907
|
-
constructor() {
|
|
1908
|
-
}
|
|
1909
|
-
async init(options) {
|
|
1910
|
-
this.compilerJs = await (options?.getWrapper?.() || Promise.resolve().then(() => (init_wasm_pack_shim(), wasm_pack_shim_exports)));
|
|
1911
|
-
const TypstCompilerBuilder2 = this.compilerJs.TypstCompilerBuilder;
|
|
1912
|
-
const compilerOptions = { ...options || {} };
|
|
1913
|
-
const beforeBuild = compilerOptions.beforeBuild ??= [];
|
|
1914
|
-
const hasPreloadRemoteFonts = beforeBuild.some((fn) => fn._preloadRemoteFontOptions !== void 0);
|
|
1915
|
-
const hasSpecifiedAssets = beforeBuild.some((fn) => fn._preloadRemoteFontOptions?.assets !== void 0);
|
|
1916
|
-
const hasDisableAssets = beforeBuild.some((fn) => fn._preloadRemoteFontOptions?.assets === false);
|
|
1917
|
-
if (!hasPreloadRemoteFonts || !hasSpecifiedAssets && !hasDisableAssets) {
|
|
1918
|
-
beforeBuild.push(loadFonts([], { assets: _TypstCompilerDriver.defaultAssets }));
|
|
1919
|
-
}
|
|
1920
|
-
const hasFontLoader = beforeBuild.some((fn) => fn._kind === "fontLoader");
|
|
1921
|
-
if (!hasFontLoader) {
|
|
1922
|
-
throw new Error("TypstCompiler: no font loader found, please use font loaders, e.g. loadFonts or preloadSystemFonts");
|
|
1923
|
-
}
|
|
1924
|
-
this.compiler = await buildComponent(options, gCompilerModule(this.compilerJs), TypstCompilerBuilder2, {});
|
|
1925
|
-
}
|
|
1926
|
-
setFonts(fonts) {
|
|
1927
|
-
this.compiler.set_fonts(fonts);
|
|
1928
|
-
}
|
|
1929
|
-
compile(options) {
|
|
1930
|
-
return new Promise((resolve) => {
|
|
1931
|
-
const world = this.compiler.snapshot(options.root, options.mainFilePath, convertInputs(options.inputs));
|
|
1932
|
-
if ("incrementalServer" in options) {
|
|
1933
|
-
resolve(world.incr_compile(options.incrementalServer[kObject], getDiagnosticsArg(options.diagnostics)));
|
|
1934
|
-
return;
|
|
1935
|
-
}
|
|
1936
|
-
resolve(world.get_artifact(options.format || CompileFormatEnum.vector, getDiagnosticsArg(options.diagnostics)));
|
|
1937
|
-
});
|
|
1938
|
-
}
|
|
1939
|
-
async runWithWorld(options, cb) {
|
|
1940
|
-
const world = this.compiler.snapshot(options.root, options.mainFilePath, convertInputs(options.inputs));
|
|
1941
|
-
let result = await cb(new TypstWorld(world));
|
|
1942
|
-
world.free();
|
|
1943
|
-
return result;
|
|
1944
|
-
}
|
|
1945
|
-
query(options) {
|
|
1946
|
-
return this.runWithWorld(options, async (world) => {
|
|
1947
|
-
return JSON.parse(await world.query(options));
|
|
1948
|
-
});
|
|
1949
|
-
}
|
|
1950
|
-
getSemanticTokenLegend() {
|
|
1951
|
-
return new Promise((resolve) => {
|
|
1952
|
-
resolve(this.compiler.get_semantic_token_legend());
|
|
1953
|
-
});
|
|
1954
|
-
}
|
|
1955
|
-
getSemanticTokens(opts) {
|
|
1956
|
-
return new Promise((resolve) => {
|
|
1957
|
-
this.compiler.reset();
|
|
1958
|
-
resolve(this.compiler.get_semantic_tokens(opts.offsetEncoding || "utf-16", opts.mainFilePath, opts.resultId));
|
|
1959
|
-
});
|
|
1960
|
-
}
|
|
1961
|
-
async withIncrementalServer(f) {
|
|
1962
|
-
const srv = new IncrementalServer(this.compiler.create_incr_server());
|
|
1963
|
-
try {
|
|
1964
|
-
return await f(srv);
|
|
1965
|
-
} finally {
|
|
1966
|
-
srv[kObject].free();
|
|
1967
|
-
}
|
|
1968
|
-
}
|
|
1969
|
-
async getAst(mainFilePath) {
|
|
1970
|
-
return this.compiler.get_ast(mainFilePath);
|
|
1971
|
-
}
|
|
1972
|
-
async reset() {
|
|
1973
|
-
await new Promise((resolve) => {
|
|
1974
|
-
this.compiler.reset();
|
|
1975
|
-
resolve(void 0);
|
|
1976
|
-
});
|
|
1977
|
-
}
|
|
1978
|
-
addSource(path, source) {
|
|
1979
|
-
if (arguments.length > 2) {
|
|
1980
|
-
throw new Error("use of addSource(path, source, isMain) is deprecated, please use addSource(path, source) instead");
|
|
1981
|
-
}
|
|
1982
|
-
this.compiler.add_source(path, source);
|
|
1983
|
-
}
|
|
1984
|
-
mapShadow(path, content) {
|
|
1985
|
-
this.compiler.map_shadow(path, content);
|
|
1986
|
-
}
|
|
1987
|
-
unmapShadow(path) {
|
|
1988
|
-
this.compiler.unmap_shadow(path);
|
|
1989
|
-
}
|
|
1990
|
-
resetShadow() {
|
|
1991
|
-
this.compiler.reset_shadow();
|
|
1992
|
-
}
|
|
1993
|
-
renderPageToCanvas() {
|
|
1994
|
-
throw new Error("Please use the api TypstRenderer.renderToCanvas in v0.4.0");
|
|
1995
|
-
}
|
|
1996
|
-
};
|
|
1997
|
-
createTypstCompiler._impl = TypstCompilerDriver;
|
|
1998
|
-
function convertInputs(inputs) {
|
|
1999
|
-
return inputs ? Object.entries(inputs) : void 0;
|
|
2000
|
-
}
|
|
2001
|
-
function getDiagnosticsArg(diagnostics) {
|
|
2002
|
-
switch (diagnostics) {
|
|
2003
|
-
case "none":
|
|
2004
|
-
return 1;
|
|
2005
|
-
case "unix":
|
|
2006
|
-
return 2;
|
|
2007
|
-
case "full":
|
|
2008
|
-
default:
|
|
2009
|
-
return 3;
|
|
2010
|
-
}
|
|
2011
|
-
}
|
|
2012
|
-
|
|
2013
|
-
// ../../node_modules/.bun/@myriaddreamin+typst.ts@0.7.0-rc2+5e675a3c06b42b50/node_modules/@myriaddreamin/typst.ts/dist/esm/fs/memory.mjs
|
|
2014
|
-
var MemoryAccessModel = class {
|
|
2015
|
-
mTimes = /* @__PURE__ */ new Map();
|
|
2016
|
-
mData = /* @__PURE__ */ new Map();
|
|
2017
|
-
constructor() {
|
|
2018
|
-
}
|
|
2019
|
-
reset() {
|
|
2020
|
-
this.mTimes.clear();
|
|
2021
|
-
this.mData.clear();
|
|
2022
|
-
}
|
|
2023
|
-
insertFile(path, data, mtime) {
|
|
2024
|
-
this.mTimes.set(path, mtime);
|
|
2025
|
-
this.mData.set(path, data);
|
|
2026
|
-
}
|
|
2027
|
-
removeFile(path) {
|
|
2028
|
-
this.mTimes.delete(path);
|
|
2029
|
-
this.mData.delete(path);
|
|
2030
|
-
}
|
|
2031
|
-
getMTime(path) {
|
|
2032
|
-
if (!path.startsWith("/@memory/")) {
|
|
2033
|
-
return void 0;
|
|
2034
|
-
}
|
|
2035
|
-
if (this.mTimes.has(path)) {
|
|
2036
|
-
return this.mTimes.get(path);
|
|
2037
|
-
}
|
|
2038
|
-
return void 0;
|
|
2039
|
-
}
|
|
2040
|
-
isFile() {
|
|
2041
|
-
return true;
|
|
2042
|
-
}
|
|
2043
|
-
getRealPath(path) {
|
|
2044
|
-
return path;
|
|
2045
|
-
}
|
|
2046
|
-
readAll(path) {
|
|
2047
|
-
if (!path.startsWith("/@memory/")) {
|
|
2048
|
-
return void 0;
|
|
2049
|
-
}
|
|
2050
|
-
if (this.mData.has(path)) {
|
|
2051
|
-
return this.mData.get(path);
|
|
2052
|
-
}
|
|
2053
|
-
return void 0;
|
|
2054
|
-
}
|
|
2055
|
-
};
|
|
2056
|
-
|
|
2057
|
-
// ../../node_modules/.bun/@myriaddreamin+typst.ts@0.7.0-rc2+5e675a3c06b42b50/node_modules/@myriaddreamin/typst.ts/dist/esm/fs/package.mjs
|
|
2058
|
-
var FetchPackageRegistry = class {
|
|
2059
|
-
am;
|
|
2060
|
-
cache = /* @__PURE__ */ new Map();
|
|
2061
|
-
constructor(am) {
|
|
2062
|
-
this.am = am;
|
|
2063
|
-
}
|
|
2064
|
-
resolvePath(path) {
|
|
2065
|
-
return `https://packages.typst.org/preview/${path.name}-${path.version}.tar.gz`;
|
|
2066
|
-
}
|
|
2067
|
-
pullPackageData(path) {
|
|
2068
|
-
const request = new XMLHttpRequest();
|
|
2069
|
-
request.overrideMimeType("text/plain; charset=x-user-defined");
|
|
2070
|
-
request.open("GET", this.resolvePath(path), false);
|
|
2071
|
-
request.send(null);
|
|
2072
|
-
if (request.status === 200 && (request.response instanceof String || typeof request.response === "string")) {
|
|
2073
|
-
return Uint8Array.from(request.response, (c) => c.charCodeAt(0));
|
|
2074
|
-
}
|
|
2075
|
-
return void 0;
|
|
2076
|
-
}
|
|
2077
|
-
resolve(spec, context) {
|
|
2078
|
-
if (spec.namespace !== "preview") {
|
|
2079
|
-
return void 0;
|
|
2080
|
-
}
|
|
2081
|
-
const path = this.resolvePath(spec);
|
|
2082
|
-
if (this.cache.has(path)) {
|
|
2083
|
-
return this.cache.get(path)();
|
|
2084
|
-
}
|
|
2085
|
-
const data = this.pullPackageData(spec);
|
|
2086
|
-
if (!data) {
|
|
2087
|
-
return void 0;
|
|
2088
|
-
}
|
|
2089
|
-
const previewDir = `/@memory/fetch/packages/${spec.namespace}/${spec.name}/${spec.version}`;
|
|
2090
|
-
const entries = [];
|
|
2091
|
-
context.untar(data, (path2, data2, mtime) => {
|
|
2092
|
-
entries.push([previewDir + "/" + path2, data2, new Date(mtime)]);
|
|
2093
|
-
});
|
|
2094
|
-
const cacheClosure = () => {
|
|
2095
|
-
for (const [path2, data2, mtime] of entries) {
|
|
2096
|
-
this.am.insertFile(path2, data2, mtime);
|
|
2097
|
-
}
|
|
2098
|
-
return previewDir;
|
|
2099
|
-
};
|
|
2100
|
-
this.cache.set(path, cacheClosure);
|
|
2101
|
-
return cacheClosure();
|
|
2102
|
-
}
|
|
2103
|
-
};
|
|
2104
|
-
|
|
2105
|
-
// src/diagnostics-sort.ts
|
|
2106
|
-
function sortDiagnosticsByFileAndRange(diagnostics) {
|
|
2107
|
-
return [...diagnostics].sort(
|
|
2108
|
-
(a, b) => a.path.localeCompare(b.path) || a.range.startLine - b.range.startLine || a.range.startCol - b.range.startCol || a.range.endLine - b.range.endLine || a.range.endCol - b.range.endCol || a.message.localeCompare(b.message)
|
|
2109
|
-
);
|
|
2110
|
-
}
|
|
2111
|
-
|
|
2112
|
-
// src/compiler-worker.ts
|
|
2113
|
-
var MAIN_FILE = "/main.typ";
|
|
2114
|
-
var CompilerWorker = class {
|
|
2115
|
-
#compiler = null;
|
|
2116
|
-
#accessModel = new MemoryAccessModel();
|
|
2117
|
-
#packageRegistry;
|
|
2118
|
-
constructor() {
|
|
2119
|
-
this.#packageRegistry = new FetchPackageRegistry(this.#accessModel);
|
|
2120
|
-
}
|
|
2121
|
-
#ensureCompiler() {
|
|
2122
|
-
if (!this.#compiler) throw new Error("Compiler not initialized");
|
|
2123
|
-
return this.#compiler;
|
|
2124
|
-
}
|
|
2125
|
-
async init(wasmUrl, fontUrls, packages) {
|
|
2126
|
-
this.#compiler = createTypstCompiler();
|
|
2127
|
-
await this.#compiler.init({
|
|
2128
|
-
getModule: () => wasmUrl,
|
|
2129
|
-
beforeBuild: [
|
|
2130
|
-
loadFonts(fontUrls),
|
|
2131
|
-
...packages ? [
|
|
2132
|
-
withAccessModel(this.#accessModel),
|
|
2133
|
-
withPackageRegistry(this.#packageRegistry)
|
|
2134
|
-
] : []
|
|
2135
|
-
]
|
|
2136
|
-
});
|
|
2137
|
-
}
|
|
2138
|
-
async compile(entry) {
|
|
2139
|
-
const { rawDiagnostics, vector } = await this.#ensureCompiler().runWithWorld(
|
|
2140
|
-
{ mainFilePath: entry ?? MAIN_FILE },
|
|
2141
|
-
async (world) => {
|
|
2142
|
-
const v = await world.vector({ diagnostics: "full" });
|
|
2143
|
-
if (!("result" in v)) {
|
|
2144
|
-
return { rawDiagnostics: v.diagnostics, vector: void 0 };
|
|
2145
|
-
}
|
|
2146
|
-
let rawDiagnostics2 = [];
|
|
2147
|
-
try {
|
|
2148
|
-
const c = await world.compile({ diagnostics: "full" });
|
|
2149
|
-
rawDiagnostics2 = c.diagnostics;
|
|
2150
|
-
} catch (err) {
|
|
2151
|
-
console.error("[typst-web-service] compile() threw after vector():", err);
|
|
2152
|
-
}
|
|
2153
|
-
return { rawDiagnostics: rawDiagnostics2, vector: v.result };
|
|
2154
|
-
}
|
|
2155
|
-
);
|
|
2156
|
-
const diagnostics = sortDiagnosticsByFileAndRange(
|
|
2157
|
-
rawDiagnostics.map((d) => {
|
|
2158
|
-
const m = d.range.match(/(\d+):(\d+)-(\d+):(\d+)/);
|
|
2159
|
-
return {
|
|
2160
|
-
...d,
|
|
2161
|
-
severity: d.severity,
|
|
2162
|
-
range: m ? { startLine: +m[1], startCol: +m[2], endLine: +m[3], endCol: +m[4] } : { startLine: 0, startCol: 0, endLine: 0, endCol: 0 }
|
|
2163
|
-
};
|
|
2164
|
-
})
|
|
2165
|
-
);
|
|
2166
|
-
if (vector) {
|
|
2167
|
-
return Comlink.transfer({ diagnostics, vector }, [
|
|
2168
|
-
vector.buffer
|
|
2169
|
-
]);
|
|
2170
|
-
}
|
|
2171
|
-
return { diagnostics };
|
|
2172
|
-
}
|
|
2173
|
-
async compilePdf(entry) {
|
|
2174
|
-
const result = await this.#ensureCompiler().compile({
|
|
2175
|
-
mainFilePath: entry ?? MAIN_FILE,
|
|
2176
|
-
format: CompileFormatEnum.pdf,
|
|
2177
|
-
diagnostics: "none"
|
|
2178
|
-
});
|
|
2179
|
-
if (!result.result) throw new Error("Compilation produced no output");
|
|
2180
|
-
return Comlink.transfer(result.result, [
|
|
2181
|
-
result.result.buffer
|
|
2182
|
-
]);
|
|
2183
|
-
}
|
|
2184
|
-
mapShadow(path, content) {
|
|
2185
|
-
this.#ensureCompiler().mapShadow(path, content);
|
|
2186
|
-
}
|
|
2187
|
-
mapShadowMany(files) {
|
|
2188
|
-
const compiler = this.#ensureCompiler();
|
|
2189
|
-
for (const [path, content] of Object.entries(files)) {
|
|
2190
|
-
compiler.mapShadow(path, content);
|
|
2191
|
-
}
|
|
2192
|
-
}
|
|
2193
|
-
unmapShadow(path) {
|
|
2194
|
-
this.#ensureCompiler().unmapShadow(path);
|
|
2195
|
-
}
|
|
2196
|
-
resetShadow() {
|
|
2197
|
-
this.#ensureCompiler().resetShadow();
|
|
2198
|
-
}
|
|
2199
|
-
destroy() {
|
|
2200
|
-
this.#compiler = null;
|
|
2201
|
-
}
|
|
2202
|
-
};
|
|
2203
|
-
Comlink.expose(new CompilerWorker());
|
|
2204
|
-
export {
|
|
2205
|
-
CompilerWorker
|
|
2206
|
-
};
|
|
2207
|
-
//# sourceMappingURL=compiler-worker.js.map
|