@pandacss/compiler-wasm 2.0.0-beta.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/LICENSE.md +21 -0
- package/README.md +14 -0
- package/dist/chunk-R2J25HLY.js +108 -0
- package/dist/index.d.ts +222 -0
- package/dist/index.js +93 -0
- package/dist/web-Z44NGLTK.js +12 -0
- package/dist/web.d.ts +166 -0
- package/dist/web.js +107 -0
- package/package.json +54 -0
- package/pkg-node/compiler_wasm.d.ts +381 -0
- package/pkg-node/compiler_wasm.js +1788 -0
- package/pkg-node/compiler_wasm_bg.wasm +0 -0
- package/pkg-node/compiler_wasm_bg.wasm.d.ts +68 -0
- package/pkg-node/package.json +3 -0
- package/pkg-web/compiler_wasm.d.ts +474 -0
- package/pkg-web/compiler_wasm.js +1879 -0
- package/pkg-web/compiler_wasm_bg.wasm +0 -0
- package/pkg-web/compiler_wasm_bg.wasm.d.ts +68 -0
- package/pkg-web/package.json +3 -0
|
@@ -0,0 +1,1788 @@
|
|
|
1
|
+
/* @ts-self-types="./compiler_wasm.d.ts" */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* JS-facing project handle. Constructed once per session with a
|
|
5
|
+
* [`WasmFileSystem`] (whose contents the cross-file resolver reads),
|
|
6
|
+
* plus a resolved Panda config snapshot.
|
|
7
|
+
*
|
|
8
|
+
* ```js
|
|
9
|
+
* const fs = new WasmFileSystem()
|
|
10
|
+
* fs.addFile('/proj/tokens.ts', "export const brand = '#ef4444';")
|
|
11
|
+
* fs.addFile('/proj/main.tsx', "import { brand } from './tokens'\ncss({ color: brand })")
|
|
12
|
+
* const compiler = WasmCompiler.fromConfig(fs, config)
|
|
13
|
+
* project.parseFile('/proj/main.tsx', fs.readFile('/proj/main.tsx'))
|
|
14
|
+
* const atoms = project.atoms()
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
class WasmCompiler {
|
|
18
|
+
static __wrap(ptr) {
|
|
19
|
+
const obj = Object.create(WasmCompiler.prototype);
|
|
20
|
+
obj.__wbg_ptr = ptr;
|
|
21
|
+
WasmCompilerFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
22
|
+
return obj;
|
|
23
|
+
}
|
|
24
|
+
__destroy_into_raw() {
|
|
25
|
+
const ptr = this.__wbg_ptr;
|
|
26
|
+
this.__wbg_ptr = 0;
|
|
27
|
+
WasmCompilerFinalization.unregister(this);
|
|
28
|
+
return ptr;
|
|
29
|
+
}
|
|
30
|
+
free() {
|
|
31
|
+
const ptr = this.__destroy_into_raw();
|
|
32
|
+
wasm.__wbg_wasmcompiler_free(ptr, 0);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Hydrate an external build info into this project (additive), optionally
|
|
36
|
+
* restricted to imported modules (tree-shaking). Returns `false` on a
|
|
37
|
+
* schema-version mismatch.
|
|
38
|
+
*
|
|
39
|
+
* # Errors
|
|
40
|
+
* Returns a JS error if `build_info` isn't a valid build-info document.
|
|
41
|
+
* @param {string} name
|
|
42
|
+
* @param {any} build_info
|
|
43
|
+
* @param {any} only
|
|
44
|
+
* @returns {boolean}
|
|
45
|
+
*/
|
|
46
|
+
applyBuildInfo(name, build_info, only) {
|
|
47
|
+
try {
|
|
48
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
49
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
50
|
+
const len0 = WASM_VECTOR_LEN;
|
|
51
|
+
wasm.wasmcompiler_applyBuildInfo(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(build_info), addHeapObject(only));
|
|
52
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
53
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
54
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
55
|
+
if (r2) {
|
|
56
|
+
throw takeObject(r1);
|
|
57
|
+
}
|
|
58
|
+
return r0 !== 0;
|
|
59
|
+
} finally {
|
|
60
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Deduplicated atoms across every currently-known file, sorted by
|
|
65
|
+
* `(prop, conditions, value)` for stable iteration.
|
|
66
|
+
*
|
|
67
|
+
* # Errors
|
|
68
|
+
* Returns a JS error if serializing the atom array fails.
|
|
69
|
+
* @returns {any}
|
|
70
|
+
*/
|
|
71
|
+
atoms() {
|
|
72
|
+
try {
|
|
73
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
74
|
+
wasm.wasmcompiler_atoms(retptr, this.__wbg_ptr);
|
|
75
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
76
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
77
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
78
|
+
if (r2) {
|
|
79
|
+
throw takeObject(r1);
|
|
80
|
+
}
|
|
81
|
+
return takeObject(r0);
|
|
82
|
+
} finally {
|
|
83
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* The build-info wire-format version this binding reads/writes.
|
|
88
|
+
* @returns {number}
|
|
89
|
+
*/
|
|
90
|
+
buildInfoSchemaVersion() {
|
|
91
|
+
const ret = wasm.wasmcompiler_buildInfoSchemaVersion(this.__wbg_ptr);
|
|
92
|
+
return ret >>> 0;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Drop every path's state. Keeps the config-derived extractor,
|
|
96
|
+
* token dictionary, and cross-file resolver intact.
|
|
97
|
+
*/
|
|
98
|
+
clear() {
|
|
99
|
+
wasm.wasmcompiler_clear(this.__wbg_ptr);
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Compile to CSS. Mirrors the NAPI `Project.compile()`.
|
|
103
|
+
*
|
|
104
|
+
* # Errors
|
|
105
|
+
* Returns a JS error if serializing fails.
|
|
106
|
+
* @param {any | null} [options]
|
|
107
|
+
* @returns {any}
|
|
108
|
+
*/
|
|
109
|
+
compile(options) {
|
|
110
|
+
try {
|
|
111
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
112
|
+
wasm.wasmcompiler_compile(retptr, this.__wbg_ptr, isLikeNone(options) ? 0 : addHeapObject(options));
|
|
113
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
114
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
115
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
116
|
+
if (r2) {
|
|
117
|
+
throw takeObject(r1);
|
|
118
|
+
}
|
|
119
|
+
return takeObject(r0);
|
|
120
|
+
} finally {
|
|
121
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Return the serialized config snapshot this project was constructed
|
|
126
|
+
* with.
|
|
127
|
+
*
|
|
128
|
+
* # Errors
|
|
129
|
+
* Returns a JS error if serializing fails.
|
|
130
|
+
* @returns {any}
|
|
131
|
+
*/
|
|
132
|
+
config() {
|
|
133
|
+
try {
|
|
134
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
135
|
+
wasm.wasmcompiler_config(retptr, this.__wbg_ptr);
|
|
136
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
137
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
138
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
139
|
+
if (r2) {
|
|
140
|
+
throw takeObject(r1);
|
|
141
|
+
}
|
|
142
|
+
return takeObject(r0);
|
|
143
|
+
} finally {
|
|
144
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Engine-owned fingerprint of the resolved config's output-affecting fields,
|
|
149
|
+
* stamped into build info as `configFingerprint`.
|
|
150
|
+
* @returns {string}
|
|
151
|
+
*/
|
|
152
|
+
configFingerprint() {
|
|
153
|
+
let deferred1_0;
|
|
154
|
+
let deferred1_1;
|
|
155
|
+
try {
|
|
156
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
157
|
+
wasm.wasmcompiler_configFingerprint(retptr, this.__wbg_ptr);
|
|
158
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
159
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
160
|
+
deferred1_0 = r0;
|
|
161
|
+
deferred1_1 = r1;
|
|
162
|
+
return getStringFromWasm0(r0, r1);
|
|
163
|
+
} finally {
|
|
164
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
165
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Config validation diagnostics from construction.
|
|
170
|
+
*
|
|
171
|
+
* # Errors
|
|
172
|
+
* Returns a JS error if serializing fails.
|
|
173
|
+
* @returns {any}
|
|
174
|
+
*/
|
|
175
|
+
diagnostics() {
|
|
176
|
+
try {
|
|
177
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
178
|
+
wasm.wasmcompiler_diagnostics(retptr, this.__wbg_ptr);
|
|
179
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
180
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
181
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
182
|
+
if (r2) {
|
|
183
|
+
throw takeObject(r1);
|
|
184
|
+
}
|
|
185
|
+
return takeObject(r0);
|
|
186
|
+
} finally {
|
|
187
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* @param {string} path
|
|
192
|
+
* @returns {string}
|
|
193
|
+
*/
|
|
194
|
+
dirname(path) {
|
|
195
|
+
let deferred2_0;
|
|
196
|
+
let deferred2_1;
|
|
197
|
+
try {
|
|
198
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
199
|
+
const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
200
|
+
const len0 = WASM_VECTOR_LEN;
|
|
201
|
+
wasm.wasmcompiler_dirname(retptr, this.__wbg_ptr, ptr0, len0);
|
|
202
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
203
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
204
|
+
deferred2_0 = r0;
|
|
205
|
+
deferred2_1 = r1;
|
|
206
|
+
return getStringFromWasm0(r0, r1);
|
|
207
|
+
} finally {
|
|
208
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
209
|
+
wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Encoded config recipe styles, separate from atomic utility atoms.
|
|
214
|
+
*
|
|
215
|
+
* # Errors
|
|
216
|
+
* Returns a JS error if serializing fails.
|
|
217
|
+
* @returns {any}
|
|
218
|
+
*/
|
|
219
|
+
encodedRecipes() {
|
|
220
|
+
try {
|
|
221
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
222
|
+
wasm.wasmcompiler_encodedRecipes(retptr, this.__wbg_ptr);
|
|
223
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
224
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
225
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
226
|
+
if (r2) {
|
|
227
|
+
throw takeObject(r1);
|
|
228
|
+
}
|
|
229
|
+
return takeObject(r0);
|
|
230
|
+
} finally {
|
|
231
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Stateless single-file extraction — raw `{ calls, jsx, diagnostics }`,
|
|
236
|
+
* using the project's configured matchers + token dictionary. Unlike
|
|
237
|
+
* `parseFile`, it registers nothing; it's the read-only peek companion.
|
|
238
|
+
*
|
|
239
|
+
* # Errors
|
|
240
|
+
* Returns a JS error string when serializing the result fails.
|
|
241
|
+
* @param {string} path
|
|
242
|
+
* @param {string} source
|
|
243
|
+
* @returns {any}
|
|
244
|
+
*/
|
|
245
|
+
extractFileSource(path, source) {
|
|
246
|
+
try {
|
|
247
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
248
|
+
const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
249
|
+
const len0 = WASM_VECTOR_LEN;
|
|
250
|
+
const ptr1 = passStringToWasm0(source, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
251
|
+
const len1 = WASM_VECTOR_LEN;
|
|
252
|
+
wasm.wasmcompiler_extractFileSource(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
253
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
254
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
255
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
256
|
+
if (r2) {
|
|
257
|
+
throw takeObject(r1);
|
|
258
|
+
}
|
|
259
|
+
return takeObject(r0);
|
|
260
|
+
} finally {
|
|
261
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* `(path, hex source_hash)` for every known file, sorted by path.
|
|
266
|
+
*
|
|
267
|
+
* # Errors
|
|
268
|
+
* Returns a JS error if serializing fails.
|
|
269
|
+
* @returns {any}
|
|
270
|
+
*/
|
|
271
|
+
fileManifest() {
|
|
272
|
+
try {
|
|
273
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
274
|
+
wasm.wasmcompiler_fileManifest(retptr, this.__wbg_ptr);
|
|
275
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
276
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
277
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
278
|
+
if (r2) {
|
|
279
|
+
throw takeObject(r1);
|
|
280
|
+
}
|
|
281
|
+
return takeObject(r0);
|
|
282
|
+
} finally {
|
|
283
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Construct a compiler from the resolved, JSON-safe Panda config snapshot.
|
|
288
|
+
*
|
|
289
|
+
* # Errors
|
|
290
|
+
* Returns a JS error when `config` doesn't deserialize into JSON.
|
|
291
|
+
* @param {WasmFileSystem} fs
|
|
292
|
+
* @param {any} config
|
|
293
|
+
* @param {any} options
|
|
294
|
+
* @returns {WasmCompiler}
|
|
295
|
+
*/
|
|
296
|
+
static fromConfig(fs, config, options) {
|
|
297
|
+
try {
|
|
298
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
299
|
+
_assertClass(fs, WasmFileSystem);
|
|
300
|
+
wasm.wasmcompiler_fromConfig(retptr, fs.__wbg_ptr, addHeapObject(config), addBorrowedObject(options));
|
|
301
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
302
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
303
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
304
|
+
if (r2) {
|
|
305
|
+
throw takeObject(r1);
|
|
306
|
+
}
|
|
307
|
+
return WasmCompiler.__wrap(r0);
|
|
308
|
+
} finally {
|
|
309
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
310
|
+
heap[stack_pointer++] = undefined;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Generate artifacts affected by the provided config dependency names.
|
|
315
|
+
*
|
|
316
|
+
* # Errors
|
|
317
|
+
* Returns a JS error if dependencies/options are invalid or serializing fails.
|
|
318
|
+
* @param {any} dependencies
|
|
319
|
+
* @param {any} options
|
|
320
|
+
* @returns {any}
|
|
321
|
+
*/
|
|
322
|
+
generateAffectedArtifacts(dependencies, options) {
|
|
323
|
+
try {
|
|
324
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
325
|
+
wasm.wasmcompiler_generateAffectedArtifacts(retptr, this.__wbg_ptr, addHeapObject(dependencies), addBorrowedObject(options));
|
|
326
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
327
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
328
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
329
|
+
if (r2) {
|
|
330
|
+
throw takeObject(r1);
|
|
331
|
+
}
|
|
332
|
+
return takeObject(r0);
|
|
333
|
+
} finally {
|
|
334
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
335
|
+
heap[stack_pointer++] = undefined;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* Generate one codegen artifact by id.
|
|
340
|
+
*
|
|
341
|
+
* # Errors
|
|
342
|
+
* Returns a JS error if the id/options are invalid or serializing fails.
|
|
343
|
+
* @param {string} id
|
|
344
|
+
* @param {any} options
|
|
345
|
+
* @returns {any}
|
|
346
|
+
*/
|
|
347
|
+
generateArtifact(id, options) {
|
|
348
|
+
try {
|
|
349
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
350
|
+
const ptr0 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
351
|
+
const len0 = WASM_VECTOR_LEN;
|
|
352
|
+
wasm.wasmcompiler_generateArtifact(retptr, this.__wbg_ptr, ptr0, len0, addBorrowedObject(options));
|
|
353
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
354
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
355
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
356
|
+
if (r2) {
|
|
357
|
+
throw takeObject(r1);
|
|
358
|
+
}
|
|
359
|
+
return takeObject(r0);
|
|
360
|
+
} finally {
|
|
361
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
362
|
+
heap[stack_pointer++] = undefined;
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* Generate every codegen artifact from the resolved project state.
|
|
367
|
+
*
|
|
368
|
+
* # Errors
|
|
369
|
+
* Returns a JS error if options are invalid or serializing fails.
|
|
370
|
+
* @param {any} options
|
|
371
|
+
* @returns {any}
|
|
372
|
+
*/
|
|
373
|
+
generateArtifacts(options) {
|
|
374
|
+
try {
|
|
375
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
376
|
+
wasm.wasmcompiler_generateArtifacts(retptr, this.__wbg_ptr, addBorrowedObject(options));
|
|
377
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
378
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
379
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
380
|
+
if (r2) {
|
|
381
|
+
throw takeObject(r1);
|
|
382
|
+
}
|
|
383
|
+
return takeObject(r0);
|
|
384
|
+
} finally {
|
|
385
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
386
|
+
heap[stack_pointer++] = undefined;
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* Per-file view; returns `null` when `path` isn't known.
|
|
391
|
+
*
|
|
392
|
+
* # Errors
|
|
393
|
+
* Returns a JS error if serializing fails.
|
|
394
|
+
* @param {string} path
|
|
395
|
+
* @returns {any}
|
|
396
|
+
*/
|
|
397
|
+
getFile(path) {
|
|
398
|
+
try {
|
|
399
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
400
|
+
const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
401
|
+
const len0 = WASM_VECTOR_LEN;
|
|
402
|
+
wasm.wasmcompiler_getFile(retptr, this.__wbg_ptr, ptr0, len0);
|
|
403
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
404
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
405
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
406
|
+
if (r2) {
|
|
407
|
+
throw takeObject(r1);
|
|
408
|
+
}
|
|
409
|
+
return takeObject(r0);
|
|
410
|
+
} finally {
|
|
411
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* Whether `css` declares Panda's cascade layers (`@layer reset, base, …;`),
|
|
416
|
+
* marking it as the stylesheet root to inject the compiled CSS into.
|
|
417
|
+
* @param {string} css
|
|
418
|
+
* @returns {boolean}
|
|
419
|
+
*/
|
|
420
|
+
hasLayerDeclaration(css) {
|
|
421
|
+
const ptr0 = passStringToWasm0(css, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
422
|
+
const len0 = WASM_VECTOR_LEN;
|
|
423
|
+
const ret = wasm.wasmcompiler_hasLayerDeclaration(this.__wbg_ptr, ptr0, len0);
|
|
424
|
+
return ret !== 0;
|
|
425
|
+
}
|
|
426
|
+
/**
|
|
427
|
+
* Stateless source inspection for tooling (reporting, lint, IDE). Returns
|
|
428
|
+
* classified Panda usage sites plus file-local extraction diagnostics.
|
|
429
|
+
*
|
|
430
|
+
* # Errors
|
|
431
|
+
* Returns a JS error if serialization fails.
|
|
432
|
+
* @param {string} path
|
|
433
|
+
* @param {string} source
|
|
434
|
+
* @returns {any}
|
|
435
|
+
*/
|
|
436
|
+
inspectFileSource(path, source) {
|
|
437
|
+
try {
|
|
438
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
439
|
+
const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
440
|
+
const len0 = WASM_VECTOR_LEN;
|
|
441
|
+
const ptr1 = passStringToWasm0(source, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
442
|
+
const len1 = WASM_VECTOR_LEN;
|
|
443
|
+
wasm.wasmcompiler_inspectFileSource(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
444
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
445
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
446
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
447
|
+
if (r2) {
|
|
448
|
+
throw takeObject(r1);
|
|
449
|
+
}
|
|
450
|
+
return takeObject(r0);
|
|
451
|
+
} finally {
|
|
452
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
/**
|
|
456
|
+
* Returns `true` when the project has no files and no accumulated output.
|
|
457
|
+
* @returns {boolean}
|
|
458
|
+
*/
|
|
459
|
+
isEmpty() {
|
|
460
|
+
const ret = wasm.wasmcompiler_isEmpty(this.__wbg_ptr);
|
|
461
|
+
return ret !== 0;
|
|
462
|
+
}
|
|
463
|
+
/**
|
|
464
|
+
* Whether `path` is a source file the project extracts from — its
|
|
465
|
+
* `cwd`-relative form matches the configured `include`/`exclude` globs.
|
|
466
|
+
* @param {string} path
|
|
467
|
+
* @returns {boolean}
|
|
468
|
+
*/
|
|
469
|
+
isSourceFile(path) {
|
|
470
|
+
const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
471
|
+
const len0 = WASM_VECTOR_LEN;
|
|
472
|
+
const ret = wasm.wasmcompiler_isSourceFile(this.__wbg_ptr, ptr0, len0);
|
|
473
|
+
return ret !== 0;
|
|
474
|
+
}
|
|
475
|
+
/**
|
|
476
|
+
* @param {any} parts
|
|
477
|
+
* @returns {string}
|
|
478
|
+
*/
|
|
479
|
+
joinPath(parts) {
|
|
480
|
+
let deferred2_0;
|
|
481
|
+
let deferred2_1;
|
|
482
|
+
try {
|
|
483
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
484
|
+
wasm.wasmcompiler_joinPath(retptr, this.__wbg_ptr, addHeapObject(parts));
|
|
485
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
486
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
487
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
488
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
489
|
+
var ptr1 = r0;
|
|
490
|
+
var len1 = r1;
|
|
491
|
+
if (r3) {
|
|
492
|
+
ptr1 = 0; len1 = 0;
|
|
493
|
+
throw takeObject(r2);
|
|
494
|
+
}
|
|
495
|
+
deferred2_0 = ptr1;
|
|
496
|
+
deferred2_1 = len1;
|
|
497
|
+
return getStringFromWasm0(ptr1, len1);
|
|
498
|
+
} finally {
|
|
499
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
500
|
+
wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
/**
|
|
504
|
+
* CSS for the named cascade layers, concatenated in order. Sliced in Rust
|
|
505
|
+
* (byte offsets stay valid); unknown layer names are skipped.
|
|
506
|
+
* @param {string[]} layers
|
|
507
|
+
* @returns {string}
|
|
508
|
+
*/
|
|
509
|
+
layerCss(layers) {
|
|
510
|
+
let deferred2_0;
|
|
511
|
+
let deferred2_1;
|
|
512
|
+
try {
|
|
513
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
514
|
+
const ptr0 = passArrayJsValueToWasm0(layers, wasm.__wbindgen_export);
|
|
515
|
+
const len0 = WASM_VECTOR_LEN;
|
|
516
|
+
wasm.wasmcompiler_layerCss(retptr, this.__wbg_ptr, ptr0, len0);
|
|
517
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
518
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
519
|
+
deferred2_0 = r0;
|
|
520
|
+
deferred2_1 = r1;
|
|
521
|
+
return getStringFromWasm0(r0, r1);
|
|
522
|
+
} finally {
|
|
523
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
524
|
+
wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
/**
|
|
528
|
+
* The resolved cascade-layer names (config overrides merged over defaults).
|
|
529
|
+
*
|
|
530
|
+
* # Errors
|
|
531
|
+
* Returns a JS error if serializing fails.
|
|
532
|
+
* @returns {any}
|
|
533
|
+
*/
|
|
534
|
+
layers() {
|
|
535
|
+
try {
|
|
536
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
537
|
+
wasm.wasmcompiler_layers(retptr, this.__wbg_ptr);
|
|
538
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
539
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
540
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
541
|
+
if (r2) {
|
|
542
|
+
throw takeObject(r1);
|
|
543
|
+
}
|
|
544
|
+
return takeObject(r0);
|
|
545
|
+
} finally {
|
|
546
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
/**
|
|
550
|
+
* Read a source file from the in-memory filesystem and parse it.
|
|
551
|
+
*
|
|
552
|
+
* # Errors
|
|
553
|
+
* Returns a JS error if serializing the per-call report fails.
|
|
554
|
+
* @param {string} path
|
|
555
|
+
* @returns {any}
|
|
556
|
+
*/
|
|
557
|
+
parseFile(path) {
|
|
558
|
+
try {
|
|
559
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
560
|
+
const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
561
|
+
const len0 = WASM_VECTOR_LEN;
|
|
562
|
+
wasm.wasmcompiler_parseFile(retptr, this.__wbg_ptr, ptr0, len0);
|
|
563
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
564
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
565
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
566
|
+
if (r2) {
|
|
567
|
+
throw takeObject(r1);
|
|
568
|
+
}
|
|
569
|
+
return takeObject(r0);
|
|
570
|
+
} finally {
|
|
571
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
/**
|
|
575
|
+
* Extract + encode provided source text. Replaces any prior contribution
|
|
576
|
+
* from `path`.
|
|
577
|
+
*
|
|
578
|
+
* # Errors
|
|
579
|
+
* Returns a JS error if serializing the per-call report fails.
|
|
580
|
+
* @param {string} path
|
|
581
|
+
* @param {string} source
|
|
582
|
+
* @returns {any}
|
|
583
|
+
*/
|
|
584
|
+
parseFileSource(path, source) {
|
|
585
|
+
try {
|
|
586
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
587
|
+
const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
588
|
+
const len0 = WASM_VECTOR_LEN;
|
|
589
|
+
const ptr1 = passStringToWasm0(source, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
590
|
+
const len1 = WASM_VECTOR_LEN;
|
|
591
|
+
wasm.wasmcompiler_parseFileSource(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
592
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
593
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
594
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
595
|
+
if (r2) {
|
|
596
|
+
throw takeObject(r1);
|
|
597
|
+
}
|
|
598
|
+
return takeObject(r0);
|
|
599
|
+
} finally {
|
|
600
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
/**
|
|
604
|
+
* Read + parse source paths returned from `scan()`. Returns one report per
|
|
605
|
+
* successfully parsed path.
|
|
606
|
+
*
|
|
607
|
+
* # Errors
|
|
608
|
+
* Returns a JS error when `paths` is malformed or serializing the report fails.
|
|
609
|
+
* @param {any} paths
|
|
610
|
+
* @returns {any}
|
|
611
|
+
*/
|
|
612
|
+
parseFiles(paths) {
|
|
613
|
+
try {
|
|
614
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
615
|
+
wasm.wasmcompiler_parseFiles(retptr, this.__wbg_ptr, addHeapObject(paths));
|
|
616
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
617
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
618
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
619
|
+
if (r2) {
|
|
620
|
+
throw takeObject(r1);
|
|
621
|
+
}
|
|
622
|
+
return takeObject(r0);
|
|
623
|
+
} finally {
|
|
624
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
/**
|
|
628
|
+
* Real on-disk path (symlinks followed) from the in-memory filesystem, so two
|
|
629
|
+
* paths to the same file compare equal. Returns the input when unresolved.
|
|
630
|
+
* @param {string} path
|
|
631
|
+
* @returns {string}
|
|
632
|
+
*/
|
|
633
|
+
realpath(path) {
|
|
634
|
+
let deferred2_0;
|
|
635
|
+
let deferred2_1;
|
|
636
|
+
try {
|
|
637
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
638
|
+
const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
639
|
+
const len0 = WASM_VECTOR_LEN;
|
|
640
|
+
wasm.wasmcompiler_realpath(retptr, this.__wbg_ptr, ptr0, len0);
|
|
641
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
642
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
643
|
+
deferred2_0 = r0;
|
|
644
|
+
deferred2_1 = r1;
|
|
645
|
+
return getStringFromWasm0(r0, r1);
|
|
646
|
+
} finally {
|
|
647
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
648
|
+
wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
/**
|
|
652
|
+
* Every `cva()` recipe entry in `(file, span_start)` order.
|
|
653
|
+
*
|
|
654
|
+
* # Errors
|
|
655
|
+
* Returns a JS error if serializing fails.
|
|
656
|
+
* @returns {any}
|
|
657
|
+
*/
|
|
658
|
+
recipes() {
|
|
659
|
+
try {
|
|
660
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
661
|
+
wasm.wasmcompiler_recipes(retptr, this.__wbg_ptr);
|
|
662
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
663
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
664
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
665
|
+
if (r2) {
|
|
666
|
+
throw takeObject(r1);
|
|
667
|
+
}
|
|
668
|
+
return takeObject(r0);
|
|
669
|
+
} finally {
|
|
670
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
/**
|
|
674
|
+
* Re-read `path` from the in-memory filesystem and re-parse it only if
|
|
675
|
+
* already known. Returns `true` when the file was present and got
|
|
676
|
+
* re-parsed.
|
|
677
|
+
* @param {string} path
|
|
678
|
+
* @returns {boolean}
|
|
679
|
+
*/
|
|
680
|
+
refreshFile(path) {
|
|
681
|
+
try {
|
|
682
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
683
|
+
const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
684
|
+
const len0 = WASM_VECTOR_LEN;
|
|
685
|
+
wasm.wasmcompiler_refreshFile(retptr, this.__wbg_ptr, ptr0, len0);
|
|
686
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
687
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
688
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
689
|
+
if (r2) {
|
|
690
|
+
throw takeObject(r1);
|
|
691
|
+
}
|
|
692
|
+
return r0 !== 0;
|
|
693
|
+
} finally {
|
|
694
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
/**
|
|
698
|
+
* Re-parse provided source text only if `path` is already known.
|
|
699
|
+
* @param {string} path
|
|
700
|
+
* @param {string} source
|
|
701
|
+
* @returns {boolean}
|
|
702
|
+
*/
|
|
703
|
+
refreshFileSource(path, source) {
|
|
704
|
+
const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
705
|
+
const len0 = WASM_VECTOR_LEN;
|
|
706
|
+
const ptr1 = passStringToWasm0(source, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
707
|
+
const len1 = WASM_VECTOR_LEN;
|
|
708
|
+
const ret = wasm.wasmcompiler_refreshFileSource(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
709
|
+
return ret !== 0;
|
|
710
|
+
}
|
|
711
|
+
/**
|
|
712
|
+
* Register a JS-backed pattern transform callback. The wrapper package
|
|
713
|
+
* installs callbacks referenced by the serialized config snapshot.
|
|
714
|
+
* @param {string} id
|
|
715
|
+
* @param {Function} callback
|
|
716
|
+
*/
|
|
717
|
+
registerPatternTransform(id, callback) {
|
|
718
|
+
const ptr0 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
719
|
+
const len0 = WASM_VECTOR_LEN;
|
|
720
|
+
wasm.wasmcompiler_registerPatternTransform(this.__wbg_ptr, ptr0, len0, addHeapObject(callback));
|
|
721
|
+
}
|
|
722
|
+
/**
|
|
723
|
+
* Register a JS-backed `parser:before` source transform with a Rust-side
|
|
724
|
+
* filter. The filter is evaluated before calling into JS.
|
|
725
|
+
* @param {string} id
|
|
726
|
+
* @param {any} filter
|
|
727
|
+
* @param {Function} callback
|
|
728
|
+
*/
|
|
729
|
+
registerSourceTransform(id, filter, callback) {
|
|
730
|
+
try {
|
|
731
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
732
|
+
const ptr0 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
733
|
+
const len0 = WASM_VECTOR_LEN;
|
|
734
|
+
wasm.wasmcompiler_registerSourceTransform(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(filter), addHeapObject(callback));
|
|
735
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
736
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
737
|
+
if (r1) {
|
|
738
|
+
throw takeObject(r0);
|
|
739
|
+
}
|
|
740
|
+
} finally {
|
|
741
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
/**
|
|
745
|
+
* Register a JS-backed utility transform callback. The JS package wraps
|
|
746
|
+
* the user callback so Rust only has to pass the raw value.
|
|
747
|
+
* @param {string} id
|
|
748
|
+
* @param {Function} callback
|
|
749
|
+
*/
|
|
750
|
+
registerUtilityTransform(id, callback) {
|
|
751
|
+
const ptr0 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
752
|
+
const len0 = WASM_VECTOR_LEN;
|
|
753
|
+
wasm.wasmcompiler_registerUtilityTransform(this.__wbg_ptr, ptr0, len0, addHeapObject(callback));
|
|
754
|
+
}
|
|
755
|
+
/**
|
|
756
|
+
* Drop a file's contribution. Returns `true` if the path was known.
|
|
757
|
+
* @param {string} path
|
|
758
|
+
* @returns {boolean}
|
|
759
|
+
*/
|
|
760
|
+
removeFile(path) {
|
|
761
|
+
const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
762
|
+
const len0 = WASM_VECTOR_LEN;
|
|
763
|
+
const ret = wasm.wasmcompiler_removeFile(this.__wbg_ptr, ptr0, len0);
|
|
764
|
+
return ret !== 0;
|
|
765
|
+
}
|
|
766
|
+
/**
|
|
767
|
+
* @param {string} path
|
|
768
|
+
* @param {string | null} [cwd]
|
|
769
|
+
* @returns {string}
|
|
770
|
+
*/
|
|
771
|
+
resolvePath(path, cwd) {
|
|
772
|
+
let deferred3_0;
|
|
773
|
+
let deferred3_1;
|
|
774
|
+
try {
|
|
775
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
776
|
+
const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
777
|
+
const len0 = WASM_VECTOR_LEN;
|
|
778
|
+
var ptr1 = isLikeNone(cwd) ? 0 : passStringToWasm0(cwd, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
779
|
+
var len1 = WASM_VECTOR_LEN;
|
|
780
|
+
wasm.wasmcompiler_resolvePath(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
781
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
782
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
783
|
+
deferred3_0 = r0;
|
|
784
|
+
deferred3_1 = r1;
|
|
785
|
+
return getStringFromWasm0(r0, r1);
|
|
786
|
+
} finally {
|
|
787
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
788
|
+
wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
/**
|
|
792
|
+
* Source paths matching the config's `include`/`exclude` (overridable via
|
|
793
|
+
* `options`) from the in-memory filesystem. For discovery and the host's
|
|
794
|
+
* watch list.
|
|
795
|
+
*
|
|
796
|
+
* # Errors
|
|
797
|
+
* Returns a JS error when `options` is malformed or the scan fails.
|
|
798
|
+
* @param {any} options
|
|
799
|
+
* @returns {any}
|
|
800
|
+
*/
|
|
801
|
+
scan(options) {
|
|
802
|
+
try {
|
|
803
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
804
|
+
wasm.wasmcompiler_scan(retptr, this.__wbg_ptr, addHeapObject(options));
|
|
805
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
806
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
807
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
808
|
+
if (r2) {
|
|
809
|
+
throw takeObject(r1);
|
|
810
|
+
}
|
|
811
|
+
return takeObject(r0);
|
|
812
|
+
} finally {
|
|
813
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
/**
|
|
817
|
+
* Serialize the project's encoded atoms + recipes into a portable build info
|
|
818
|
+
* (the `panda buildinfo` producer). `configFingerprint` is engine-owned; the
|
|
819
|
+
* caller supplies only the published `panda` peer range.
|
|
820
|
+
*
|
|
821
|
+
* # Errors
|
|
822
|
+
* Returns a JS error if serializing the build info fails.
|
|
823
|
+
* @param {string} panda
|
|
824
|
+
* @returns {any}
|
|
825
|
+
*/
|
|
826
|
+
serializeBuildInfo(panda) {
|
|
827
|
+
try {
|
|
828
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
829
|
+
const ptr0 = passStringToWasm0(panda, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
830
|
+
const len0 = WASM_VECTOR_LEN;
|
|
831
|
+
wasm.wasmcompiler_serializeBuildInfo(retptr, this.__wbg_ptr, ptr0, len0);
|
|
832
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
833
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
834
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
835
|
+
if (r2) {
|
|
836
|
+
throw takeObject(r1);
|
|
837
|
+
}
|
|
838
|
+
return takeObject(r0);
|
|
839
|
+
} finally {
|
|
840
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
/**
|
|
844
|
+
* Every `sva()` slot-recipe entry.
|
|
845
|
+
*
|
|
846
|
+
* # Errors
|
|
847
|
+
* Returns a JS error if serializing fails.
|
|
848
|
+
* @returns {any}
|
|
849
|
+
*/
|
|
850
|
+
slotRecipes() {
|
|
851
|
+
try {
|
|
852
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
853
|
+
wasm.wasmcompiler_slotRecipes(retptr, this.__wbg_ptr);
|
|
854
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
855
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
856
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
857
|
+
if (r2) {
|
|
858
|
+
throw takeObject(r1);
|
|
859
|
+
}
|
|
860
|
+
return takeObject(r0);
|
|
861
|
+
} finally {
|
|
862
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
/**
|
|
866
|
+
* Source globs + their static base dirs (for the host watcher).
|
|
867
|
+
*
|
|
868
|
+
* # Errors
|
|
869
|
+
* Returns a JS error if serialization fails.
|
|
870
|
+
* @returns {any}
|
|
871
|
+
*/
|
|
872
|
+
sources() {
|
|
873
|
+
try {
|
|
874
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
875
|
+
wasm.wasmcompiler_sources(retptr, this.__wbg_ptr);
|
|
876
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
877
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
878
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
879
|
+
if (r2) {
|
|
880
|
+
throw takeObject(r1);
|
|
881
|
+
}
|
|
882
|
+
return takeObject(r0);
|
|
883
|
+
} finally {
|
|
884
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
/**
|
|
888
|
+
* Tooling introspection snapshot (read once, index on the host).
|
|
889
|
+
*
|
|
890
|
+
* # Errors
|
|
891
|
+
* Returns a JS error if the snapshot fails to serialize.
|
|
892
|
+
* @returns {any}
|
|
893
|
+
*/
|
|
894
|
+
spec() {
|
|
895
|
+
try {
|
|
896
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
897
|
+
wasm.wasmcompiler_spec(retptr, this.__wbg_ptr);
|
|
898
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
899
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
900
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
901
|
+
if (r2) {
|
|
902
|
+
throw takeObject(r1);
|
|
903
|
+
}
|
|
904
|
+
return takeObject(r0);
|
|
905
|
+
} finally {
|
|
906
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
/**
|
|
910
|
+
* Split the stylesheet into per-file outputs (one per layer + per recipe,
|
|
911
|
+
* plus `recipes.css` / `styles.css` index files) for `--splitting`.
|
|
912
|
+
*
|
|
913
|
+
* # Errors
|
|
914
|
+
* Returns a JS error if serializing fails.
|
|
915
|
+
* @returns {any}
|
|
916
|
+
*/
|
|
917
|
+
splitCss() {
|
|
918
|
+
try {
|
|
919
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
920
|
+
wasm.wasmcompiler_splitCss(retptr, this.__wbg_ptr);
|
|
921
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
922
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
923
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
924
|
+
if (r2) {
|
|
925
|
+
throw takeObject(r1);
|
|
926
|
+
}
|
|
927
|
+
return takeObject(r0);
|
|
928
|
+
} finally {
|
|
929
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
930
|
+
}
|
|
931
|
+
}
|
|
932
|
+
/**
|
|
933
|
+
* `staticCss.patterns` expansion as raw atoms, without compiling.
|
|
934
|
+
*
|
|
935
|
+
* # Errors
|
|
936
|
+
* Returns a JS error if serializing fails.
|
|
937
|
+
* @returns {any}
|
|
938
|
+
*/
|
|
939
|
+
staticPatternAtoms() {
|
|
940
|
+
try {
|
|
941
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
942
|
+
wasm.wasmcompiler_staticPatternAtoms(retptr, this.__wbg_ptr);
|
|
943
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
944
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
945
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
946
|
+
if (r2) {
|
|
947
|
+
throw takeObject(r1);
|
|
948
|
+
}
|
|
949
|
+
return takeObject(r0);
|
|
950
|
+
} finally {
|
|
951
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
/**
|
|
955
|
+
* Aggregate counts.
|
|
956
|
+
*
|
|
957
|
+
* # Errors
|
|
958
|
+
* Returns a JS error if serializing fails.
|
|
959
|
+
* @returns {any}
|
|
960
|
+
*/
|
|
961
|
+
summary() {
|
|
962
|
+
try {
|
|
963
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
964
|
+
wasm.wasmcompiler_summary(retptr, this.__wbg_ptr);
|
|
965
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
966
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
967
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
968
|
+
if (r2) {
|
|
969
|
+
throw takeObject(r1);
|
|
970
|
+
}
|
|
971
|
+
return takeObject(r0);
|
|
972
|
+
} finally {
|
|
973
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
/**
|
|
977
|
+
* Rust-built token dictionary projected into the small JS interop shape.
|
|
978
|
+
* @returns {any}
|
|
979
|
+
*/
|
|
980
|
+
token_dictionary() {
|
|
981
|
+
try {
|
|
982
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
983
|
+
wasm.wasmcompiler_token_dictionary(retptr, this.__wbg_ptr);
|
|
984
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
985
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
986
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
987
|
+
if (r2) {
|
|
988
|
+
throw takeObject(r1);
|
|
989
|
+
}
|
|
990
|
+
return takeObject(r0);
|
|
991
|
+
} finally {
|
|
992
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
993
|
+
}
|
|
994
|
+
}
|
|
995
|
+
/**
|
|
996
|
+
* Generate artifacts and write them under `outdir` via the in-memory fs.
|
|
997
|
+
* Returns the written paths.
|
|
998
|
+
*
|
|
999
|
+
* # Errors
|
|
1000
|
+
* Returns a JS error if a file fails to write or results fail to serialize.
|
|
1001
|
+
* @param {string} outdir
|
|
1002
|
+
* @param {string | null | undefined} cwd
|
|
1003
|
+
* @param {any} options
|
|
1004
|
+
* @returns {any}
|
|
1005
|
+
*/
|
|
1006
|
+
writeArtifacts(outdir, cwd, options) {
|
|
1007
|
+
try {
|
|
1008
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1009
|
+
const ptr0 = passStringToWasm0(outdir, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1010
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1011
|
+
var ptr1 = isLikeNone(cwd) ? 0 : passStringToWasm0(cwd, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1012
|
+
var len1 = WASM_VECTOR_LEN;
|
|
1013
|
+
wasm.wasmcompiler_writeArtifacts(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, addBorrowedObject(options));
|
|
1014
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1015
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1016
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1017
|
+
if (r2) {
|
|
1018
|
+
throw takeObject(r1);
|
|
1019
|
+
}
|
|
1020
|
+
return takeObject(r0);
|
|
1021
|
+
} finally {
|
|
1022
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1023
|
+
heap[stack_pointer++] = undefined;
|
|
1024
|
+
}
|
|
1025
|
+
}
|
|
1026
|
+
/**
|
|
1027
|
+
* @param {string} outfile
|
|
1028
|
+
* @param {string | null} [cwd]
|
|
1029
|
+
* @param {any | null} [options]
|
|
1030
|
+
* @returns {any}
|
|
1031
|
+
*/
|
|
1032
|
+
writeCss(outfile, cwd, options) {
|
|
1033
|
+
try {
|
|
1034
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1035
|
+
const ptr0 = passStringToWasm0(outfile, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1036
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1037
|
+
var ptr1 = isLikeNone(cwd) ? 0 : passStringToWasm0(cwd, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1038
|
+
var len1 = WASM_VECTOR_LEN;
|
|
1039
|
+
wasm.wasmcompiler_writeCss(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, isLikeNone(options) ? 0 : addHeapObject(options));
|
|
1040
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1041
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1042
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1043
|
+
if (r2) {
|
|
1044
|
+
throw takeObject(r1);
|
|
1045
|
+
}
|
|
1046
|
+
return takeObject(r0);
|
|
1047
|
+
} finally {
|
|
1048
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1049
|
+
}
|
|
1050
|
+
}
|
|
1051
|
+
/**
|
|
1052
|
+
* @param {string} outdir
|
|
1053
|
+
* @param {string | null} [cwd]
|
|
1054
|
+
* @returns {any}
|
|
1055
|
+
*/
|
|
1056
|
+
writeSplitCss(outdir, cwd) {
|
|
1057
|
+
try {
|
|
1058
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1059
|
+
const ptr0 = passStringToWasm0(outdir, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1060
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1061
|
+
var ptr1 = isLikeNone(cwd) ? 0 : passStringToWasm0(cwd, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1062
|
+
var len1 = WASM_VECTOR_LEN;
|
|
1063
|
+
wasm.wasmcompiler_writeSplitCss(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
1064
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1065
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1066
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1067
|
+
if (r2) {
|
|
1068
|
+
throw takeObject(r1);
|
|
1069
|
+
}
|
|
1070
|
+
return takeObject(r0);
|
|
1071
|
+
} finally {
|
|
1072
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1073
|
+
}
|
|
1074
|
+
}
|
|
1075
|
+
}
|
|
1076
|
+
if (Symbol.dispose) WasmCompiler.prototype[Symbol.dispose] = WasmCompiler.prototype.free;
|
|
1077
|
+
exports.WasmCompiler = WasmCompiler;
|
|
1078
|
+
|
|
1079
|
+
/**
|
|
1080
|
+
* JS-facing extractor handle. Constructed once per session with a
|
|
1081
|
+
* [`WasmFileSystem`] handle and a `MatchersInput`; the cross-file
|
|
1082
|
+
* resolver is wired up automatically against the same FS.
|
|
1083
|
+
*
|
|
1084
|
+
* ```js
|
|
1085
|
+
* const fs = new WasmFileSystem();
|
|
1086
|
+
* fs.addFile('/src/code.tsx', '...');
|
|
1087
|
+
* const ext = new WasmExtractor(fs, matchers);
|
|
1088
|
+
* const result = ext.parseFile('/src/code.tsx', source);
|
|
1089
|
+
* ```
|
|
1090
|
+
*/
|
|
1091
|
+
class WasmExtractor {
|
|
1092
|
+
__destroy_into_raw() {
|
|
1093
|
+
const ptr = this.__wbg_ptr;
|
|
1094
|
+
this.__wbg_ptr = 0;
|
|
1095
|
+
WasmExtractorFinalization.unregister(this);
|
|
1096
|
+
return ptr;
|
|
1097
|
+
}
|
|
1098
|
+
free() {
|
|
1099
|
+
const ptr = this.__destroy_into_raw();
|
|
1100
|
+
wasm.__wbg_wasmextractor_free(ptr, 0);
|
|
1101
|
+
}
|
|
1102
|
+
/**
|
|
1103
|
+
* Construct from a JS matchers object (see `MatchersInput`).
|
|
1104
|
+
*
|
|
1105
|
+
* # Errors
|
|
1106
|
+
* Returns a JS error string when `matchers` doesn't deserialize
|
|
1107
|
+
* into a `MatchersInput` shape.
|
|
1108
|
+
* @param {WasmFileSystem} fs
|
|
1109
|
+
* @param {any} matchers
|
|
1110
|
+
*/
|
|
1111
|
+
constructor(fs, matchers) {
|
|
1112
|
+
try {
|
|
1113
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1114
|
+
_assertClass(fs, WasmFileSystem);
|
|
1115
|
+
wasm.wasmextractor_new(retptr, fs.__wbg_ptr, addHeapObject(matchers));
|
|
1116
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1117
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1118
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1119
|
+
if (r2) {
|
|
1120
|
+
throw takeObject(r1);
|
|
1121
|
+
}
|
|
1122
|
+
this.__wbg_ptr = r0;
|
|
1123
|
+
WasmExtractorFinalization.register(this, this.__wbg_ptr, this);
|
|
1124
|
+
return this;
|
|
1125
|
+
} finally {
|
|
1126
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1127
|
+
}
|
|
1128
|
+
}
|
|
1129
|
+
/**
|
|
1130
|
+
* Single-file extract. Returns the lean `ExtractUsage` shape as a
|
|
1131
|
+
* plain JS object (`{ calls, jsx, diagnostics }`).
|
|
1132
|
+
*
|
|
1133
|
+
* # Errors
|
|
1134
|
+
* Returns a JS error string when serializing the result to `JsValue`
|
|
1135
|
+
* fails (effectively never — the shape is bounded JSON).
|
|
1136
|
+
* @param {string} path
|
|
1137
|
+
* @param {string} source
|
|
1138
|
+
* @returns {any}
|
|
1139
|
+
*/
|
|
1140
|
+
parseFile(path, source) {
|
|
1141
|
+
try {
|
|
1142
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1143
|
+
const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1144
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1145
|
+
const ptr1 = passStringToWasm0(source, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1146
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1147
|
+
wasm.wasmextractor_parseFile(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
1148
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1149
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1150
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1151
|
+
if (r2) {
|
|
1152
|
+
throw takeObject(r1);
|
|
1153
|
+
}
|
|
1154
|
+
return takeObject(r0);
|
|
1155
|
+
} finally {
|
|
1156
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1157
|
+
}
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
if (Symbol.dispose) WasmExtractor.prototype[Symbol.dispose] = WasmExtractor.prototype.free;
|
|
1161
|
+
exports.WasmExtractor = WasmExtractor;
|
|
1162
|
+
|
|
1163
|
+
/**
|
|
1164
|
+
* JS-facing handle over [`MemoryFileSystem`]. Cheap to clone — shares
|
|
1165
|
+
* state via `Arc<RwLock>` internally — so the JS host can pass the same
|
|
1166
|
+
* handle into multiple `WasmExtractor` instances and edits flow through
|
|
1167
|
+
* to all consumers.
|
|
1168
|
+
*/
|
|
1169
|
+
class WasmFileSystem {
|
|
1170
|
+
__destroy_into_raw() {
|
|
1171
|
+
const ptr = this.__wbg_ptr;
|
|
1172
|
+
this.__wbg_ptr = 0;
|
|
1173
|
+
WasmFileSystemFinalization.unregister(this);
|
|
1174
|
+
return ptr;
|
|
1175
|
+
}
|
|
1176
|
+
free() {
|
|
1177
|
+
const ptr = this.__destroy_into_raw();
|
|
1178
|
+
wasm.__wbg_wasmfilesystem_free(ptr, 0);
|
|
1179
|
+
}
|
|
1180
|
+
/**
|
|
1181
|
+
* Write or overwrite a file. Parent dirs auto-register.
|
|
1182
|
+
* @param {string} path
|
|
1183
|
+
* @param {string} content
|
|
1184
|
+
*/
|
|
1185
|
+
addFile(path, content) {
|
|
1186
|
+
const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1187
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1188
|
+
const ptr1 = passStringToWasm0(content, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1189
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1190
|
+
wasm.wasmfilesystem_addFile(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
1191
|
+
}
|
|
1192
|
+
/**
|
|
1193
|
+
* `true` when `path` exists as file or directory.
|
|
1194
|
+
* @param {string} path
|
|
1195
|
+
* @returns {boolean}
|
|
1196
|
+
*/
|
|
1197
|
+
exists(path) {
|
|
1198
|
+
const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1199
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1200
|
+
const ret = wasm.wasmfilesystem_exists(this.__wbg_ptr, ptr0, len0);
|
|
1201
|
+
return ret !== 0;
|
|
1202
|
+
}
|
|
1203
|
+
/**
|
|
1204
|
+
* Number of files stored. Convenience for diagnostics / tests.
|
|
1205
|
+
* @returns {number}
|
|
1206
|
+
*/
|
|
1207
|
+
fileCount() {
|
|
1208
|
+
const ret = wasm.wasmfilesystem_fileCount(this.__wbg_ptr);
|
|
1209
|
+
return ret >>> 0;
|
|
1210
|
+
}
|
|
1211
|
+
constructor() {
|
|
1212
|
+
const ret = wasm.wasmfilesystem_new();
|
|
1213
|
+
this.__wbg_ptr = ret;
|
|
1214
|
+
WasmFileSystemFinalization.register(this, this.__wbg_ptr, this);
|
|
1215
|
+
return this;
|
|
1216
|
+
}
|
|
1217
|
+
/**
|
|
1218
|
+
* Read a file. Returns `undefined` when missing.
|
|
1219
|
+
* @param {string} path
|
|
1220
|
+
* @returns {string | undefined}
|
|
1221
|
+
*/
|
|
1222
|
+
readFile(path) {
|
|
1223
|
+
try {
|
|
1224
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1225
|
+
const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1226
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1227
|
+
wasm.wasmfilesystem_readFile(retptr, this.__wbg_ptr, ptr0, len0);
|
|
1228
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1229
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1230
|
+
let v2;
|
|
1231
|
+
if (r0 !== 0) {
|
|
1232
|
+
v2 = getStringFromWasm0(r0, r1).slice();
|
|
1233
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
1234
|
+
}
|
|
1235
|
+
return v2;
|
|
1236
|
+
} finally {
|
|
1237
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1238
|
+
}
|
|
1239
|
+
}
|
|
1240
|
+
/**
|
|
1241
|
+
* `true` when the file existed and was removed.
|
|
1242
|
+
* @param {string} path
|
|
1243
|
+
* @returns {boolean}
|
|
1244
|
+
*/
|
|
1245
|
+
removeFile(path) {
|
|
1246
|
+
const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1247
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1248
|
+
const ret = wasm.wasmfilesystem_removeFile(this.__wbg_ptr, ptr0, len0);
|
|
1249
|
+
return ret !== 0;
|
|
1250
|
+
}
|
|
1251
|
+
}
|
|
1252
|
+
if (Symbol.dispose) WasmFileSystem.prototype[Symbol.dispose] = WasmFileSystem.prototype.free;
|
|
1253
|
+
exports.WasmFileSystem = WasmFileSystem;
|
|
1254
|
+
|
|
1255
|
+
/**
|
|
1256
|
+
* Install a panic hook so Rust panics surface as readable stack traces in
|
|
1257
|
+
* the browser console. Idempotent — safe to call multiple times.
|
|
1258
|
+
*/
|
|
1259
|
+
function installPanicHook() {
|
|
1260
|
+
wasm.installPanicHook();
|
|
1261
|
+
}
|
|
1262
|
+
exports.installPanicHook = installPanicHook;
|
|
1263
|
+
function __wbg_get_imports() {
|
|
1264
|
+
const import0 = {
|
|
1265
|
+
__proto__: null,
|
|
1266
|
+
__wbg_Error_bce6d499ff0a4aff: function(arg0, arg1) {
|
|
1267
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
1268
|
+
return addHeapObject(ret);
|
|
1269
|
+
},
|
|
1270
|
+
__wbg_Number_b7972a139bfbfdf0: function(arg0) {
|
|
1271
|
+
const ret = Number(getObject(arg0));
|
|
1272
|
+
return ret;
|
|
1273
|
+
},
|
|
1274
|
+
__wbg_String_8564e559799eccda: function(arg0, arg1) {
|
|
1275
|
+
const ret = String(getObject(arg1));
|
|
1276
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1277
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1278
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1279
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1280
|
+
},
|
|
1281
|
+
__wbg___wbindgen_bigint_get_as_i64_410e28c7b761ad83: function(arg0, arg1) {
|
|
1282
|
+
const v = getObject(arg1);
|
|
1283
|
+
const ret = typeof(v) === 'bigint' ? v : undefined;
|
|
1284
|
+
getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
|
|
1285
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
1286
|
+
},
|
|
1287
|
+
__wbg___wbindgen_boolean_get_2304fb8c853028c8: function(arg0) {
|
|
1288
|
+
const v = getObject(arg0);
|
|
1289
|
+
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
1290
|
+
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
1291
|
+
},
|
|
1292
|
+
__wbg___wbindgen_debug_string_edece8177ad01481: function(arg0, arg1) {
|
|
1293
|
+
const ret = debugString(getObject(arg1));
|
|
1294
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1295
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1296
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1297
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1298
|
+
},
|
|
1299
|
+
__wbg___wbindgen_in_07056af4f902c445: function(arg0, arg1) {
|
|
1300
|
+
const ret = getObject(arg0) in getObject(arg1);
|
|
1301
|
+
return ret;
|
|
1302
|
+
},
|
|
1303
|
+
__wbg___wbindgen_is_bigint_aeae3893f30ed54e: function(arg0) {
|
|
1304
|
+
const ret = typeof(getObject(arg0)) === 'bigint';
|
|
1305
|
+
return ret;
|
|
1306
|
+
},
|
|
1307
|
+
__wbg___wbindgen_is_function_5cd60d5cf78b4eef: function(arg0) {
|
|
1308
|
+
const ret = typeof(getObject(arg0)) === 'function';
|
|
1309
|
+
return ret;
|
|
1310
|
+
},
|
|
1311
|
+
__wbg___wbindgen_is_null_2042690d351e14f0: function(arg0) {
|
|
1312
|
+
const ret = getObject(arg0) === null;
|
|
1313
|
+
return ret;
|
|
1314
|
+
},
|
|
1315
|
+
__wbg___wbindgen_is_object_b4593df85baada48: function(arg0) {
|
|
1316
|
+
const val = getObject(arg0);
|
|
1317
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
1318
|
+
return ret;
|
|
1319
|
+
},
|
|
1320
|
+
__wbg___wbindgen_is_string_dde0fd9020db4434: function(arg0) {
|
|
1321
|
+
const ret = typeof(getObject(arg0)) === 'string';
|
|
1322
|
+
return ret;
|
|
1323
|
+
},
|
|
1324
|
+
__wbg___wbindgen_is_undefined_35bb9f4c7fd651d5: function(arg0) {
|
|
1325
|
+
const ret = getObject(arg0) === undefined;
|
|
1326
|
+
return ret;
|
|
1327
|
+
},
|
|
1328
|
+
__wbg___wbindgen_jsval_eq_c0ed08b3e0f393b9: function(arg0, arg1) {
|
|
1329
|
+
const ret = getObject(arg0) === getObject(arg1);
|
|
1330
|
+
return ret;
|
|
1331
|
+
},
|
|
1332
|
+
__wbg___wbindgen_jsval_loose_eq_0ad77b7717db155c: function(arg0, arg1) {
|
|
1333
|
+
const ret = getObject(arg0) == getObject(arg1);
|
|
1334
|
+
return ret;
|
|
1335
|
+
},
|
|
1336
|
+
__wbg___wbindgen_number_get_f73a1244370fcc2c: function(arg0, arg1) {
|
|
1337
|
+
const obj = getObject(arg1);
|
|
1338
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
1339
|
+
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
1340
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
1341
|
+
},
|
|
1342
|
+
__wbg___wbindgen_string_get_d109740c0d18f4d7: function(arg0, arg1) {
|
|
1343
|
+
const obj = getObject(arg1);
|
|
1344
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
1345
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1346
|
+
var len1 = WASM_VECTOR_LEN;
|
|
1347
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1348
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1349
|
+
},
|
|
1350
|
+
__wbg___wbindgen_throw_9c31b086c2b26051: function(arg0, arg1) {
|
|
1351
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
1352
|
+
},
|
|
1353
|
+
__wbg_call_13665d9f14390edc: function() { return handleError(function (arg0, arg1) {
|
|
1354
|
+
const ret = getObject(arg0).call(getObject(arg1));
|
|
1355
|
+
return addHeapObject(ret);
|
|
1356
|
+
}, arguments); },
|
|
1357
|
+
__wbg_call_dfde26266607c996: function() { return handleError(function (arg0, arg1, arg2) {
|
|
1358
|
+
const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
|
|
1359
|
+
return addHeapObject(ret);
|
|
1360
|
+
}, arguments); },
|
|
1361
|
+
__wbg_call_faa0a261f288f846: function() { return handleError(function (arg0, arg1, arg2, arg3) {
|
|
1362
|
+
const ret = getObject(arg0).call(getObject(arg1), getObject(arg2), getObject(arg3));
|
|
1363
|
+
return addHeapObject(ret);
|
|
1364
|
+
}, arguments); },
|
|
1365
|
+
__wbg_done_54b8da57023b7ed2: function(arg0) {
|
|
1366
|
+
const ret = getObject(arg0).done;
|
|
1367
|
+
return ret;
|
|
1368
|
+
},
|
|
1369
|
+
__wbg_entries_564a7e8b1e54ede5: function(arg0) {
|
|
1370
|
+
const ret = Object.entries(getObject(arg0));
|
|
1371
|
+
return addHeapObject(ret);
|
|
1372
|
+
},
|
|
1373
|
+
__wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
|
|
1374
|
+
let deferred0_0;
|
|
1375
|
+
let deferred0_1;
|
|
1376
|
+
try {
|
|
1377
|
+
deferred0_0 = arg0;
|
|
1378
|
+
deferred0_1 = arg1;
|
|
1379
|
+
console.error(getStringFromWasm0(arg0, arg1));
|
|
1380
|
+
} finally {
|
|
1381
|
+
wasm.__wbindgen_export4(deferred0_0, deferred0_1, 1);
|
|
1382
|
+
}
|
|
1383
|
+
},
|
|
1384
|
+
__wbg_from_fa561fa561dc8031: function(arg0) {
|
|
1385
|
+
const ret = Array.from(getObject(arg0));
|
|
1386
|
+
return addHeapObject(ret);
|
|
1387
|
+
},
|
|
1388
|
+
__wbg_get_3e9a707ab7d352eb: function() { return handleError(function (arg0, arg1) {
|
|
1389
|
+
const ret = Reflect.get(getObject(arg0), getObject(arg1));
|
|
1390
|
+
return addHeapObject(ret);
|
|
1391
|
+
}, arguments); },
|
|
1392
|
+
__wbg_get_98fdf51d029a75eb: function(arg0, arg1) {
|
|
1393
|
+
const ret = getObject(arg0)[arg1 >>> 0];
|
|
1394
|
+
return addHeapObject(ret);
|
|
1395
|
+
},
|
|
1396
|
+
__wbg_get_dcf82ab8aad1a593: function() { return handleError(function (arg0, arg1) {
|
|
1397
|
+
const ret = Reflect.get(getObject(arg0), getObject(arg1));
|
|
1398
|
+
return addHeapObject(ret);
|
|
1399
|
+
}, arguments); },
|
|
1400
|
+
__wbg_get_unchecked_1dfe6d05ad91d9b7: function(arg0, arg1) {
|
|
1401
|
+
const ret = getObject(arg0)[arg1 >>> 0];
|
|
1402
|
+
return addHeapObject(ret);
|
|
1403
|
+
},
|
|
1404
|
+
__wbg_get_with_ref_key_6412cf3094599694: function(arg0, arg1) {
|
|
1405
|
+
const ret = getObject(arg0)[getObject(arg1)];
|
|
1406
|
+
return addHeapObject(ret);
|
|
1407
|
+
},
|
|
1408
|
+
__wbg_instanceof_ArrayBuffer_53db37b06f6b9afe: function(arg0) {
|
|
1409
|
+
let result;
|
|
1410
|
+
try {
|
|
1411
|
+
result = getObject(arg0) instanceof ArrayBuffer;
|
|
1412
|
+
} catch (_) {
|
|
1413
|
+
result = false;
|
|
1414
|
+
}
|
|
1415
|
+
const ret = result;
|
|
1416
|
+
return ret;
|
|
1417
|
+
},
|
|
1418
|
+
__wbg_instanceof_Error_b3f7e146d654031a: function(arg0) {
|
|
1419
|
+
let result;
|
|
1420
|
+
try {
|
|
1421
|
+
result = getObject(arg0) instanceof Error;
|
|
1422
|
+
} catch (_) {
|
|
1423
|
+
result = false;
|
|
1424
|
+
}
|
|
1425
|
+
const ret = result;
|
|
1426
|
+
return ret;
|
|
1427
|
+
},
|
|
1428
|
+
__wbg_instanceof_Map_16f217b9a2a08d8c: function(arg0) {
|
|
1429
|
+
let result;
|
|
1430
|
+
try {
|
|
1431
|
+
result = getObject(arg0) instanceof Map;
|
|
1432
|
+
} catch (_) {
|
|
1433
|
+
result = false;
|
|
1434
|
+
}
|
|
1435
|
+
const ret = result;
|
|
1436
|
+
return ret;
|
|
1437
|
+
},
|
|
1438
|
+
__wbg_instanceof_Uint8Array_abd07d4bd221d50b: function(arg0) {
|
|
1439
|
+
let result;
|
|
1440
|
+
try {
|
|
1441
|
+
result = getObject(arg0) instanceof Uint8Array;
|
|
1442
|
+
} catch (_) {
|
|
1443
|
+
result = false;
|
|
1444
|
+
}
|
|
1445
|
+
const ret = result;
|
|
1446
|
+
return ret;
|
|
1447
|
+
},
|
|
1448
|
+
__wbg_isArray_94898ed3aad6947b: function(arg0) {
|
|
1449
|
+
const ret = Array.isArray(getObject(arg0));
|
|
1450
|
+
return ret;
|
|
1451
|
+
},
|
|
1452
|
+
__wbg_isSafeInteger_01e964d144ad3a55: function(arg0) {
|
|
1453
|
+
const ret = Number.isSafeInteger(getObject(arg0));
|
|
1454
|
+
return ret;
|
|
1455
|
+
},
|
|
1456
|
+
__wbg_iterator_1441b47f341dc34f: function() {
|
|
1457
|
+
const ret = Symbol.iterator;
|
|
1458
|
+
return addHeapObject(ret);
|
|
1459
|
+
},
|
|
1460
|
+
__wbg_length_2591a0f4f659a55c: function(arg0) {
|
|
1461
|
+
const ret = getObject(arg0).length;
|
|
1462
|
+
return ret;
|
|
1463
|
+
},
|
|
1464
|
+
__wbg_length_56fcd3e2b7e0299d: function(arg0) {
|
|
1465
|
+
const ret = getObject(arg0).length;
|
|
1466
|
+
return ret;
|
|
1467
|
+
},
|
|
1468
|
+
__wbg_message_324ac511aeaf710e: function(arg0) {
|
|
1469
|
+
const ret = getObject(arg0).message;
|
|
1470
|
+
return addHeapObject(ret);
|
|
1471
|
+
},
|
|
1472
|
+
__wbg_new_02d162bc6cf02f60: function() {
|
|
1473
|
+
const ret = new Object();
|
|
1474
|
+
return addHeapObject(ret);
|
|
1475
|
+
},
|
|
1476
|
+
__wbg_new_070df68d66325372: function() {
|
|
1477
|
+
const ret = new Map();
|
|
1478
|
+
return addHeapObject(ret);
|
|
1479
|
+
},
|
|
1480
|
+
__wbg_new_227d7c05414eb861: function() {
|
|
1481
|
+
const ret = new Error();
|
|
1482
|
+
return addHeapObject(ret);
|
|
1483
|
+
},
|
|
1484
|
+
__wbg_new_310879b66b6e95e1: function() {
|
|
1485
|
+
const ret = new Array();
|
|
1486
|
+
return addHeapObject(ret);
|
|
1487
|
+
},
|
|
1488
|
+
__wbg_new_7ddec6de44ff8f5d: function(arg0) {
|
|
1489
|
+
const ret = new Uint8Array(getObject(arg0));
|
|
1490
|
+
return addHeapObject(ret);
|
|
1491
|
+
},
|
|
1492
|
+
__wbg_next_2a4e19f4f5083b0f: function(arg0) {
|
|
1493
|
+
const ret = getObject(arg0).next;
|
|
1494
|
+
return addHeapObject(ret);
|
|
1495
|
+
},
|
|
1496
|
+
__wbg_next_6429a146bf756f93: function() { return handleError(function (arg0) {
|
|
1497
|
+
const ret = getObject(arg0).next();
|
|
1498
|
+
return addHeapObject(ret);
|
|
1499
|
+
}, arguments); },
|
|
1500
|
+
__wbg_parse_2c1cad6215e84999: function() { return handleError(function (arg0, arg1) {
|
|
1501
|
+
const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
|
|
1502
|
+
return addHeapObject(ret);
|
|
1503
|
+
}, arguments); },
|
|
1504
|
+
__wbg_prototypesetcall_5f9bdc8d75e07276: function(arg0, arg1, arg2) {
|
|
1505
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
|
|
1506
|
+
},
|
|
1507
|
+
__wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
|
|
1508
|
+
getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
|
|
1509
|
+
},
|
|
1510
|
+
__wbg_set_78ea6a19f4818587: function(arg0, arg1, arg2) {
|
|
1511
|
+
getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
|
|
1512
|
+
},
|
|
1513
|
+
__wbg_set_facb7a5914e0fa39: function(arg0, arg1, arg2) {
|
|
1514
|
+
const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
|
|
1515
|
+
return addHeapObject(ret);
|
|
1516
|
+
},
|
|
1517
|
+
__wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
|
|
1518
|
+
const ret = getObject(arg1).stack;
|
|
1519
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1520
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1521
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1522
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1523
|
+
},
|
|
1524
|
+
__wbg_value_9cc0518af87a489c: function(arg0) {
|
|
1525
|
+
const ret = getObject(arg0).value;
|
|
1526
|
+
return addHeapObject(ret);
|
|
1527
|
+
},
|
|
1528
|
+
__wbindgen_cast_0000000000000001: function(arg0) {
|
|
1529
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
1530
|
+
const ret = arg0;
|
|
1531
|
+
return addHeapObject(ret);
|
|
1532
|
+
},
|
|
1533
|
+
__wbindgen_cast_0000000000000002: function(arg0) {
|
|
1534
|
+
// Cast intrinsic for `I64 -> Externref`.
|
|
1535
|
+
const ret = arg0;
|
|
1536
|
+
return addHeapObject(ret);
|
|
1537
|
+
},
|
|
1538
|
+
__wbindgen_cast_0000000000000003: function(arg0, arg1) {
|
|
1539
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
1540
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
1541
|
+
return addHeapObject(ret);
|
|
1542
|
+
},
|
|
1543
|
+
__wbindgen_cast_0000000000000004: function(arg0) {
|
|
1544
|
+
// Cast intrinsic for `U64 -> Externref`.
|
|
1545
|
+
const ret = BigInt.asUintN(64, arg0);
|
|
1546
|
+
return addHeapObject(ret);
|
|
1547
|
+
},
|
|
1548
|
+
__wbindgen_object_clone_ref: function(arg0) {
|
|
1549
|
+
const ret = getObject(arg0);
|
|
1550
|
+
return addHeapObject(ret);
|
|
1551
|
+
},
|
|
1552
|
+
__wbindgen_object_drop_ref: function(arg0) {
|
|
1553
|
+
takeObject(arg0);
|
|
1554
|
+
},
|
|
1555
|
+
};
|
|
1556
|
+
return {
|
|
1557
|
+
__proto__: null,
|
|
1558
|
+
"./compiler_wasm_bg.js": import0,
|
|
1559
|
+
};
|
|
1560
|
+
}
|
|
1561
|
+
|
|
1562
|
+
const WasmCompilerFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1563
|
+
? { register: () => {}, unregister: () => {} }
|
|
1564
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmcompiler_free(ptr, 1));
|
|
1565
|
+
const WasmExtractorFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1566
|
+
? { register: () => {}, unregister: () => {} }
|
|
1567
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmextractor_free(ptr, 1));
|
|
1568
|
+
const WasmFileSystemFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1569
|
+
? { register: () => {}, unregister: () => {} }
|
|
1570
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmfilesystem_free(ptr, 1));
|
|
1571
|
+
|
|
1572
|
+
function addHeapObject(obj) {
|
|
1573
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
1574
|
+
const idx = heap_next;
|
|
1575
|
+
heap_next = heap[idx];
|
|
1576
|
+
|
|
1577
|
+
heap[idx] = obj;
|
|
1578
|
+
return idx;
|
|
1579
|
+
}
|
|
1580
|
+
|
|
1581
|
+
function _assertClass(instance, klass) {
|
|
1582
|
+
if (!(instance instanceof klass)) {
|
|
1583
|
+
throw new Error(`expected instance of ${klass.name}`);
|
|
1584
|
+
}
|
|
1585
|
+
}
|
|
1586
|
+
|
|
1587
|
+
function addBorrowedObject(obj) {
|
|
1588
|
+
if (stack_pointer == 1) throw new Error('out of js stack');
|
|
1589
|
+
heap[--stack_pointer] = obj;
|
|
1590
|
+
return stack_pointer;
|
|
1591
|
+
}
|
|
1592
|
+
|
|
1593
|
+
function debugString(val) {
|
|
1594
|
+
// primitive types
|
|
1595
|
+
const type = typeof val;
|
|
1596
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
1597
|
+
return `${val}`;
|
|
1598
|
+
}
|
|
1599
|
+
if (type == 'string') {
|
|
1600
|
+
return `"${val}"`;
|
|
1601
|
+
}
|
|
1602
|
+
if (type == 'symbol') {
|
|
1603
|
+
const description = val.description;
|
|
1604
|
+
if (description == null) {
|
|
1605
|
+
return 'Symbol';
|
|
1606
|
+
} else {
|
|
1607
|
+
return `Symbol(${description})`;
|
|
1608
|
+
}
|
|
1609
|
+
}
|
|
1610
|
+
if (type == 'function') {
|
|
1611
|
+
const name = val.name;
|
|
1612
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
1613
|
+
return `Function(${name})`;
|
|
1614
|
+
} else {
|
|
1615
|
+
return 'Function';
|
|
1616
|
+
}
|
|
1617
|
+
}
|
|
1618
|
+
// objects
|
|
1619
|
+
if (Array.isArray(val)) {
|
|
1620
|
+
const length = val.length;
|
|
1621
|
+
let debug = '[';
|
|
1622
|
+
if (length > 0) {
|
|
1623
|
+
debug += debugString(val[0]);
|
|
1624
|
+
}
|
|
1625
|
+
for(let i = 1; i < length; i++) {
|
|
1626
|
+
debug += ', ' + debugString(val[i]);
|
|
1627
|
+
}
|
|
1628
|
+
debug += ']';
|
|
1629
|
+
return debug;
|
|
1630
|
+
}
|
|
1631
|
+
// Test for built-in
|
|
1632
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
1633
|
+
let className;
|
|
1634
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
1635
|
+
className = builtInMatches[1];
|
|
1636
|
+
} else {
|
|
1637
|
+
// Failed to match the standard '[object ClassName]'
|
|
1638
|
+
return toString.call(val);
|
|
1639
|
+
}
|
|
1640
|
+
if (className == 'Object') {
|
|
1641
|
+
// we're a user defined class or Object
|
|
1642
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
1643
|
+
// easier than looping through ownProperties of `val`.
|
|
1644
|
+
try {
|
|
1645
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
1646
|
+
} catch (_) {
|
|
1647
|
+
return 'Object';
|
|
1648
|
+
}
|
|
1649
|
+
}
|
|
1650
|
+
// errors
|
|
1651
|
+
if (val instanceof Error) {
|
|
1652
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
1653
|
+
}
|
|
1654
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
1655
|
+
return className;
|
|
1656
|
+
}
|
|
1657
|
+
|
|
1658
|
+
function dropObject(idx) {
|
|
1659
|
+
if (idx < 1028) return;
|
|
1660
|
+
heap[idx] = heap_next;
|
|
1661
|
+
heap_next = idx;
|
|
1662
|
+
}
|
|
1663
|
+
|
|
1664
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
1665
|
+
ptr = ptr >>> 0;
|
|
1666
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
1667
|
+
}
|
|
1668
|
+
|
|
1669
|
+
let cachedDataViewMemory0 = null;
|
|
1670
|
+
function getDataViewMemory0() {
|
|
1671
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
1672
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
1673
|
+
}
|
|
1674
|
+
return cachedDataViewMemory0;
|
|
1675
|
+
}
|
|
1676
|
+
|
|
1677
|
+
function getStringFromWasm0(ptr, len) {
|
|
1678
|
+
return decodeText(ptr >>> 0, len);
|
|
1679
|
+
}
|
|
1680
|
+
|
|
1681
|
+
let cachedUint8ArrayMemory0 = null;
|
|
1682
|
+
function getUint8ArrayMemory0() {
|
|
1683
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
1684
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
1685
|
+
}
|
|
1686
|
+
return cachedUint8ArrayMemory0;
|
|
1687
|
+
}
|
|
1688
|
+
|
|
1689
|
+
function getObject(idx) { return heap[idx]; }
|
|
1690
|
+
|
|
1691
|
+
function handleError(f, args) {
|
|
1692
|
+
try {
|
|
1693
|
+
return f.apply(this, args);
|
|
1694
|
+
} catch (e) {
|
|
1695
|
+
wasm.__wbindgen_export3(addHeapObject(e));
|
|
1696
|
+
}
|
|
1697
|
+
}
|
|
1698
|
+
|
|
1699
|
+
let heap = new Array(1024).fill(undefined);
|
|
1700
|
+
heap.push(undefined, null, true, false);
|
|
1701
|
+
|
|
1702
|
+
let heap_next = heap.length;
|
|
1703
|
+
|
|
1704
|
+
function isLikeNone(x) {
|
|
1705
|
+
return x === undefined || x === null;
|
|
1706
|
+
}
|
|
1707
|
+
|
|
1708
|
+
function passArrayJsValueToWasm0(array, malloc) {
|
|
1709
|
+
const ptr = malloc(array.length * 4, 4) >>> 0;
|
|
1710
|
+
const mem = getDataViewMemory0();
|
|
1711
|
+
for (let i = 0; i < array.length; i++) {
|
|
1712
|
+
mem.setUint32(ptr + 4 * i, addHeapObject(array[i]), true);
|
|
1713
|
+
}
|
|
1714
|
+
WASM_VECTOR_LEN = array.length;
|
|
1715
|
+
return ptr;
|
|
1716
|
+
}
|
|
1717
|
+
|
|
1718
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
1719
|
+
if (realloc === undefined) {
|
|
1720
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
1721
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
1722
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
1723
|
+
WASM_VECTOR_LEN = buf.length;
|
|
1724
|
+
return ptr;
|
|
1725
|
+
}
|
|
1726
|
+
|
|
1727
|
+
let len = arg.length;
|
|
1728
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
1729
|
+
|
|
1730
|
+
const mem = getUint8ArrayMemory0();
|
|
1731
|
+
|
|
1732
|
+
let offset = 0;
|
|
1733
|
+
|
|
1734
|
+
for (; offset < len; offset++) {
|
|
1735
|
+
const code = arg.charCodeAt(offset);
|
|
1736
|
+
if (code > 0x7F) break;
|
|
1737
|
+
mem[ptr + offset] = code;
|
|
1738
|
+
}
|
|
1739
|
+
if (offset !== len) {
|
|
1740
|
+
if (offset !== 0) {
|
|
1741
|
+
arg = arg.slice(offset);
|
|
1742
|
+
}
|
|
1743
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
1744
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
1745
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
1746
|
+
|
|
1747
|
+
offset += ret.written;
|
|
1748
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
1749
|
+
}
|
|
1750
|
+
|
|
1751
|
+
WASM_VECTOR_LEN = offset;
|
|
1752
|
+
return ptr;
|
|
1753
|
+
}
|
|
1754
|
+
|
|
1755
|
+
let stack_pointer = 1024;
|
|
1756
|
+
|
|
1757
|
+
function takeObject(idx) {
|
|
1758
|
+
const ret = getObject(idx);
|
|
1759
|
+
dropObject(idx);
|
|
1760
|
+
return ret;
|
|
1761
|
+
}
|
|
1762
|
+
|
|
1763
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
1764
|
+
cachedTextDecoder.decode();
|
|
1765
|
+
function decodeText(ptr, len) {
|
|
1766
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
1767
|
+
}
|
|
1768
|
+
|
|
1769
|
+
const cachedTextEncoder = new TextEncoder();
|
|
1770
|
+
|
|
1771
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
1772
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
1773
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
1774
|
+
view.set(buf);
|
|
1775
|
+
return {
|
|
1776
|
+
read: arg.length,
|
|
1777
|
+
written: buf.length
|
|
1778
|
+
};
|
|
1779
|
+
};
|
|
1780
|
+
}
|
|
1781
|
+
|
|
1782
|
+
let WASM_VECTOR_LEN = 0;
|
|
1783
|
+
|
|
1784
|
+
const wasmPath = `${__dirname}/compiler_wasm_bg.wasm`;
|
|
1785
|
+
const wasmBytes = require('fs').readFileSync(wasmPath);
|
|
1786
|
+
const wasmModule = new WebAssembly.Module(wasmBytes);
|
|
1787
|
+
let wasmInstance = new WebAssembly.Instance(wasmModule, __wbg_get_imports());
|
|
1788
|
+
let wasm = wasmInstance.exports;
|