macroforge 0.1.78 → 0.1.79

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1083 @@
1
+ /* @ts-self-types="./macroforge_ts.d.ts" */
2
+
3
+ function Derive() {
4
+ wasm.Derive();
5
+ }
6
+ exports.Derive = Derive;
7
+
8
+ class NativeMapper {
9
+ static __wrap(ptr) {
10
+ ptr = ptr >>> 0;
11
+ const obj = Object.create(NativeMapper.prototype);
12
+ obj.__wbg_ptr = ptr;
13
+ NativeMapperFinalization.register(obj, obj.__wbg_ptr, obj);
14
+ return obj;
15
+ }
16
+ __destroy_into_raw() {
17
+ const ptr = this.__wbg_ptr;
18
+ this.__wbg_ptr = 0;
19
+ NativeMapperFinalization.unregister(this);
20
+ return ptr;
21
+ }
22
+ free() {
23
+ const ptr = this.__destroy_into_raw();
24
+ wasm.__wbg_nativemapper_free(ptr, 0);
25
+ }
26
+ /**
27
+ * @param {number} pos
28
+ * @returns {number | undefined}
29
+ */
30
+ expandedToOriginal(pos) {
31
+ const ret = wasm.nativemapper_expandedToOriginal(this.__wbg_ptr, pos);
32
+ return ret === 0x100000001 ? undefined : ret;
33
+ }
34
+ /**
35
+ * @param {number} pos
36
+ * @returns {string | undefined}
37
+ */
38
+ generatedBy(pos) {
39
+ const ret = wasm.nativemapper_generatedBy(this.__wbg_ptr, pos);
40
+ let v1;
41
+ if (ret[0] !== 0) {
42
+ v1 = getStringFromWasm0(ret[0], ret[1]).slice();
43
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 1, 1);
44
+ }
45
+ return v1;
46
+ }
47
+ /**
48
+ * @returns {boolean}
49
+ */
50
+ isEmpty() {
51
+ const ret = wasm.nativemapper_isEmpty(this.__wbg_ptr);
52
+ return ret !== 0;
53
+ }
54
+ /**
55
+ * @param {number} pos
56
+ * @returns {boolean}
57
+ */
58
+ isInGenerated(pos) {
59
+ const ret = wasm.nativemapper_isInGenerated(this.__wbg_ptr, pos);
60
+ return ret !== 0;
61
+ }
62
+ /**
63
+ * @param {number} start
64
+ * @param {number} length
65
+ * @returns {any}
66
+ */
67
+ mapSpanToExpanded(start, length) {
68
+ const ret = wasm.nativemapper_mapSpanToExpanded(this.__wbg_ptr, start, length);
69
+ return ret;
70
+ }
71
+ /**
72
+ * @param {number} start
73
+ * @param {number} length
74
+ * @returns {any}
75
+ */
76
+ mapSpanToOriginal(start, length) {
77
+ const ret = wasm.nativemapper_mapSpanToOriginal(this.__wbg_ptr, start, length);
78
+ return ret;
79
+ }
80
+ /**
81
+ * @param {number} pos
82
+ * @returns {number}
83
+ */
84
+ originalToExpanded(pos) {
85
+ const ret = wasm.nativemapper_originalToExpanded(this.__wbg_ptr, pos);
86
+ return ret >>> 0;
87
+ }
88
+ }
89
+ if (Symbol.dispose) NativeMapper.prototype[Symbol.dispose] = NativeMapper.prototype.free;
90
+ exports.NativeMapper = NativeMapper;
91
+
92
+ class NativePlugin {
93
+ __destroy_into_raw() {
94
+ const ptr = this.__wbg_ptr;
95
+ this.__wbg_ptr = 0;
96
+ NativePluginFinalization.unregister(this);
97
+ return ptr;
98
+ }
99
+ free() {
100
+ const ptr = this.__destroy_into_raw();
101
+ wasm.__wbg_nativeplugin_free(ptr, 0);
102
+ }
103
+ /**
104
+ * @param {string} code
105
+ * @param {string} filepath
106
+ * @param {any} options
107
+ * @returns {any}
108
+ */
109
+ expandSync(code, filepath, options) {
110
+ const ptr0 = passStringToWasm0(code, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
111
+ const len0 = WASM_VECTOR_LEN;
112
+ const ptr1 = passStringToWasm0(filepath, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
113
+ const len1 = WASM_VECTOR_LEN;
114
+ const ret = wasm.nativeplugin_expandSync(this.__wbg_ptr, ptr0, len0, ptr1, len1, options);
115
+ if (ret[2]) {
116
+ throw takeFromExternrefTable0(ret[1]);
117
+ }
118
+ return takeFromExternrefTable0(ret[0]);
119
+ }
120
+ /**
121
+ * @param {string} filepath
122
+ * @returns {NativeMapper | undefined}
123
+ */
124
+ getMapper(filepath) {
125
+ const ptr0 = passStringToWasm0(filepath, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
126
+ const len0 = WASM_VECTOR_LEN;
127
+ const ret = wasm.nativeplugin_getMapper(this.__wbg_ptr, ptr0, len0);
128
+ return ret === 0 ? undefined : NativeMapper.__wrap(ret);
129
+ }
130
+ /**
131
+ * @param {string} _message
132
+ */
133
+ log(_message) {
134
+ const ptr0 = passStringToWasm0(_message, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
135
+ const len0 = WASM_VECTOR_LEN;
136
+ wasm.nativeplugin_log(this.__wbg_ptr, ptr0, len0);
137
+ }
138
+ /**
139
+ * @param {string} filepath
140
+ * @param {any} diags
141
+ * @returns {any}
142
+ */
143
+ mapDiagnostics(filepath, diags) {
144
+ const ptr0 = passStringToWasm0(filepath, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
145
+ const len0 = WASM_VECTOR_LEN;
146
+ const ret = wasm.nativeplugin_mapDiagnostics(this.__wbg_ptr, ptr0, len0, diags);
147
+ if (ret[2]) {
148
+ throw takeFromExternrefTable0(ret[1]);
149
+ }
150
+ return takeFromExternrefTable0(ret[0]);
151
+ }
152
+ constructor() {
153
+ const ret = wasm.nativeplugin_new();
154
+ this.__wbg_ptr = ret >>> 0;
155
+ NativePluginFinalization.register(this, this.__wbg_ptr, this);
156
+ return this;
157
+ }
158
+ /**
159
+ * @param {string} filepath
160
+ * @param {string} code
161
+ * @param {any} options
162
+ * @returns {any}
163
+ */
164
+ processFile(filepath, code, options) {
165
+ const ptr0 = passStringToWasm0(filepath, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
166
+ const len0 = WASM_VECTOR_LEN;
167
+ const ptr1 = passStringToWasm0(code, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
168
+ const len1 = WASM_VECTOR_LEN;
169
+ const ret = wasm.nativeplugin_processFile(this.__wbg_ptr, ptr0, len0, ptr1, len1, options);
170
+ if (ret[2]) {
171
+ throw takeFromExternrefTable0(ret[1]);
172
+ }
173
+ return takeFromExternrefTable0(ret[0]);
174
+ }
175
+ /**
176
+ * @param {string} code
177
+ * @param {string} filepath
178
+ * @returns {any}
179
+ */
180
+ transformSync(code, filepath) {
181
+ const ptr0 = passStringToWasm0(code, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
182
+ const len0 = WASM_VECTOR_LEN;
183
+ const ptr1 = passStringToWasm0(filepath, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
184
+ const len1 = WASM_VECTOR_LEN;
185
+ const ret = wasm.nativeplugin_transformSync(this.__wbg_ptr, ptr0, len0, ptr1, len1);
186
+ if (ret[2]) {
187
+ throw takeFromExternrefTable0(ret[1]);
188
+ }
189
+ return takeFromExternrefTable0(ret[0]);
190
+ }
191
+ }
192
+ if (Symbol.dispose) NativePlugin.prototype[Symbol.dispose] = NativePlugin.prototype.free;
193
+ exports.NativePlugin = NativePlugin;
194
+
195
+ class NativePositionMapper {
196
+ __destroy_into_raw() {
197
+ const ptr = this.__wbg_ptr;
198
+ this.__wbg_ptr = 0;
199
+ NativePositionMapperFinalization.unregister(this);
200
+ return ptr;
201
+ }
202
+ free() {
203
+ const ptr = this.__destroy_into_raw();
204
+ wasm.__wbg_nativepositionmapper_free(ptr, 0);
205
+ }
206
+ /**
207
+ * @param {number} _line
208
+ * @param {number} _column
209
+ * @returns {any}
210
+ */
211
+ mapToExpanded(_line, _column) {
212
+ const ret = wasm.nativepositionmapper_mapToExpanded(this.__wbg_ptr, _line, _column);
213
+ return ret;
214
+ }
215
+ /**
216
+ * @param {number} _line
217
+ * @param {number} _column
218
+ * @returns {any}
219
+ */
220
+ mapToOriginal(_line, _column) {
221
+ const ret = wasm.nativepositionmapper_mapToOriginal(this.__wbg_ptr, _line, _column);
222
+ return ret;
223
+ }
224
+ /**
225
+ * @param {any} _mapping
226
+ */
227
+ constructor(_mapping) {
228
+ const ret = wasm.nativepositionmapper_new(_mapping);
229
+ this.__wbg_ptr = ret >>> 0;
230
+ NativePositionMapperFinalization.register(this, this.__wbg_ptr, this);
231
+ return this;
232
+ }
233
+ }
234
+ if (Symbol.dispose) NativePositionMapper.prototype[Symbol.dispose] = NativePositionMapper.prototype.free;
235
+ exports.NativePositionMapper = NativePositionMapper;
236
+
237
+ /**
238
+ * @returns {any}
239
+ */
240
+ function __macroforgeDebugDescriptors() {
241
+ const ret = wasm.__macroforgeDebugDescriptors();
242
+ if (ret[2]) {
243
+ throw takeFromExternrefTable0(ret[1]);
244
+ }
245
+ return takeFromExternrefTable0(ret[0]);
246
+ }
247
+ exports.__macroforgeDebugDescriptors = __macroforgeDebugDescriptors;
248
+
249
+ /**
250
+ * @returns {any}
251
+ */
252
+ function __macroforgeDebugGetModules() {
253
+ const ret = wasm.__macroforgeDebugGetModules();
254
+ if (ret[2]) {
255
+ throw takeFromExternrefTable0(ret[1]);
256
+ }
257
+ return takeFromExternrefTable0(ret[0]);
258
+ }
259
+ exports.__macroforgeDebugGetModules = __macroforgeDebugGetModules;
260
+
261
+ /**
262
+ * @param {string} module
263
+ * @param {string} name
264
+ * @returns {string}
265
+ */
266
+ function __macroforgeDebugLookup(module, name) {
267
+ let deferred3_0;
268
+ let deferred3_1;
269
+ try {
270
+ const ptr0 = passStringToWasm0(module, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
271
+ const len0 = WASM_VECTOR_LEN;
272
+ const ptr1 = passStringToWasm0(name, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
273
+ const len1 = WASM_VECTOR_LEN;
274
+ const ret = wasm.__macroforgeDebugLookup(ptr0, len0, ptr1, len1);
275
+ deferred3_0 = ret[0];
276
+ deferred3_1 = ret[1];
277
+ return getStringFromWasm0(ret[0], ret[1]);
278
+ } finally {
279
+ wasm.__wbindgen_free_command_export(deferred3_0, deferred3_1, 1);
280
+ }
281
+ }
282
+ exports.__macroforgeDebugLookup = __macroforgeDebugLookup;
283
+
284
+ /**
285
+ * @returns {any}
286
+ */
287
+ function __macroforgeGetMacroNames() {
288
+ const ret = wasm.__macroforgeGetMacroNames();
289
+ if (ret[2]) {
290
+ throw takeFromExternrefTable0(ret[1]);
291
+ }
292
+ return takeFromExternrefTable0(ret[0]);
293
+ }
294
+ exports.__macroforgeGetMacroNames = __macroforgeGetMacroNames;
295
+
296
+ /**
297
+ * @returns {any}
298
+ */
299
+ function __macroforgeGetManifest() {
300
+ const ret = wasm.__macroforgeGetManifest();
301
+ if (ret[2]) {
302
+ throw takeFromExternrefTable0(ret[1]);
303
+ }
304
+ return takeFromExternrefTable0(ret[0]);
305
+ }
306
+ exports.__macroforgeGetManifest = __macroforgeGetManifest;
307
+
308
+ /**
309
+ * @returns {boolean}
310
+ */
311
+ function __macroforgeIsMacroPackage() {
312
+ const ret = wasm.__macroforgeIsMacroPackage();
313
+ return ret !== 0;
314
+ }
315
+ exports.__macroforgeIsMacroPackage = __macroforgeIsMacroPackage;
316
+
317
+ /**
318
+ * @param {string} context_json
319
+ * @returns {string}
320
+ */
321
+ function __macroforgeRunClone(context_json) {
322
+ let deferred3_0;
323
+ let deferred3_1;
324
+ try {
325
+ const ptr0 = passStringToWasm0(context_json, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
326
+ const len0 = WASM_VECTOR_LEN;
327
+ const ret = wasm.__macroforgeRunClone(ptr0, len0);
328
+ var ptr2 = ret[0];
329
+ var len2 = ret[1];
330
+ if (ret[3]) {
331
+ ptr2 = 0; len2 = 0;
332
+ throw takeFromExternrefTable0(ret[2]);
333
+ }
334
+ deferred3_0 = ptr2;
335
+ deferred3_1 = len2;
336
+ return getStringFromWasm0(ptr2, len2);
337
+ } finally {
338
+ wasm.__wbindgen_free_command_export(deferred3_0, deferred3_1, 1);
339
+ }
340
+ }
341
+ exports.__macroforgeRunClone = __macroforgeRunClone;
342
+
343
+ /**
344
+ * @param {string} context_json
345
+ * @returns {string}
346
+ */
347
+ function __macroforgeRunDebug(context_json) {
348
+ let deferred3_0;
349
+ let deferred3_1;
350
+ try {
351
+ const ptr0 = passStringToWasm0(context_json, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
352
+ const len0 = WASM_VECTOR_LEN;
353
+ const ret = wasm.__macroforgeRunDebug(ptr0, len0);
354
+ var ptr2 = ret[0];
355
+ var len2 = ret[1];
356
+ if (ret[3]) {
357
+ ptr2 = 0; len2 = 0;
358
+ throw takeFromExternrefTable0(ret[2]);
359
+ }
360
+ deferred3_0 = ptr2;
361
+ deferred3_1 = len2;
362
+ return getStringFromWasm0(ptr2, len2);
363
+ } finally {
364
+ wasm.__wbindgen_free_command_export(deferred3_0, deferred3_1, 1);
365
+ }
366
+ }
367
+ exports.__macroforgeRunDebug = __macroforgeRunDebug;
368
+
369
+ /**
370
+ * @param {string} context_json
371
+ * @returns {string}
372
+ */
373
+ function __macroforgeRunDefault(context_json) {
374
+ let deferred3_0;
375
+ let deferred3_1;
376
+ try {
377
+ const ptr0 = passStringToWasm0(context_json, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
378
+ const len0 = WASM_VECTOR_LEN;
379
+ const ret = wasm.__macroforgeRunDefault(ptr0, len0);
380
+ var ptr2 = ret[0];
381
+ var len2 = ret[1];
382
+ if (ret[3]) {
383
+ ptr2 = 0; len2 = 0;
384
+ throw takeFromExternrefTable0(ret[2]);
385
+ }
386
+ deferred3_0 = ptr2;
387
+ deferred3_1 = len2;
388
+ return getStringFromWasm0(ptr2, len2);
389
+ } finally {
390
+ wasm.__wbindgen_free_command_export(deferred3_0, deferred3_1, 1);
391
+ }
392
+ }
393
+ exports.__macroforgeRunDefault = __macroforgeRunDefault;
394
+
395
+ /**
396
+ * @param {string} context_json
397
+ * @returns {string}
398
+ */
399
+ function __macroforgeRunDeserialize(context_json) {
400
+ let deferred3_0;
401
+ let deferred3_1;
402
+ try {
403
+ const ptr0 = passStringToWasm0(context_json, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
404
+ const len0 = WASM_VECTOR_LEN;
405
+ const ret = wasm.__macroforgeRunDeserialize(ptr0, len0);
406
+ var ptr2 = ret[0];
407
+ var len2 = ret[1];
408
+ if (ret[3]) {
409
+ ptr2 = 0; len2 = 0;
410
+ throw takeFromExternrefTable0(ret[2]);
411
+ }
412
+ deferred3_0 = ptr2;
413
+ deferred3_1 = len2;
414
+ return getStringFromWasm0(ptr2, len2);
415
+ } finally {
416
+ wasm.__wbindgen_free_command_export(deferred3_0, deferred3_1, 1);
417
+ }
418
+ }
419
+ exports.__macroforgeRunDeserialize = __macroforgeRunDeserialize;
420
+
421
+ /**
422
+ * @param {string} context_json
423
+ * @returns {string}
424
+ */
425
+ function __macroforgeRunHash(context_json) {
426
+ let deferred3_0;
427
+ let deferred3_1;
428
+ try {
429
+ const ptr0 = passStringToWasm0(context_json, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
430
+ const len0 = WASM_VECTOR_LEN;
431
+ const ret = wasm.__macroforgeRunHash(ptr0, len0);
432
+ var ptr2 = ret[0];
433
+ var len2 = ret[1];
434
+ if (ret[3]) {
435
+ ptr2 = 0; len2 = 0;
436
+ throw takeFromExternrefTable0(ret[2]);
437
+ }
438
+ deferred3_0 = ptr2;
439
+ deferred3_1 = len2;
440
+ return getStringFromWasm0(ptr2, len2);
441
+ } finally {
442
+ wasm.__wbindgen_free_command_export(deferred3_0, deferred3_1, 1);
443
+ }
444
+ }
445
+ exports.__macroforgeRunHash = __macroforgeRunHash;
446
+
447
+ /**
448
+ * @param {string} context_json
449
+ * @returns {string}
450
+ */
451
+ function __macroforgeRunOrd(context_json) {
452
+ let deferred3_0;
453
+ let deferred3_1;
454
+ try {
455
+ const ptr0 = passStringToWasm0(context_json, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
456
+ const len0 = WASM_VECTOR_LEN;
457
+ const ret = wasm.__macroforgeRunOrd(ptr0, len0);
458
+ var ptr2 = ret[0];
459
+ var len2 = ret[1];
460
+ if (ret[3]) {
461
+ ptr2 = 0; len2 = 0;
462
+ throw takeFromExternrefTable0(ret[2]);
463
+ }
464
+ deferred3_0 = ptr2;
465
+ deferred3_1 = len2;
466
+ return getStringFromWasm0(ptr2, len2);
467
+ } finally {
468
+ wasm.__wbindgen_free_command_export(deferred3_0, deferred3_1, 1);
469
+ }
470
+ }
471
+ exports.__macroforgeRunOrd = __macroforgeRunOrd;
472
+
473
+ /**
474
+ * @param {string} context_json
475
+ * @returns {string}
476
+ */
477
+ function __macroforgeRunPartialEq(context_json) {
478
+ let deferred3_0;
479
+ let deferred3_1;
480
+ try {
481
+ const ptr0 = passStringToWasm0(context_json, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
482
+ const len0 = WASM_VECTOR_LEN;
483
+ const ret = wasm.__macroforgeRunPartialEq(ptr0, len0);
484
+ var ptr2 = ret[0];
485
+ var len2 = ret[1];
486
+ if (ret[3]) {
487
+ ptr2 = 0; len2 = 0;
488
+ throw takeFromExternrefTable0(ret[2]);
489
+ }
490
+ deferred3_0 = ptr2;
491
+ deferred3_1 = len2;
492
+ return getStringFromWasm0(ptr2, len2);
493
+ } finally {
494
+ wasm.__wbindgen_free_command_export(deferred3_0, deferred3_1, 1);
495
+ }
496
+ }
497
+ exports.__macroforgeRunPartialEq = __macroforgeRunPartialEq;
498
+
499
+ /**
500
+ * @param {string} context_json
501
+ * @returns {string}
502
+ */
503
+ function __macroforgeRunPartialOrd(context_json) {
504
+ let deferred3_0;
505
+ let deferred3_1;
506
+ try {
507
+ const ptr0 = passStringToWasm0(context_json, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
508
+ const len0 = WASM_VECTOR_LEN;
509
+ const ret = wasm.__macroforgeRunPartialOrd(ptr0, len0);
510
+ var ptr2 = ret[0];
511
+ var len2 = ret[1];
512
+ if (ret[3]) {
513
+ ptr2 = 0; len2 = 0;
514
+ throw takeFromExternrefTable0(ret[2]);
515
+ }
516
+ deferred3_0 = ptr2;
517
+ deferred3_1 = len2;
518
+ return getStringFromWasm0(ptr2, len2);
519
+ } finally {
520
+ wasm.__wbindgen_free_command_export(deferred3_0, deferred3_1, 1);
521
+ }
522
+ }
523
+ exports.__macroforgeRunPartialOrd = __macroforgeRunPartialOrd;
524
+
525
+ /**
526
+ * @param {string} context_json
527
+ * @returns {string}
528
+ */
529
+ function __macroforgeRunSerialize(context_json) {
530
+ let deferred3_0;
531
+ let deferred3_1;
532
+ try {
533
+ const ptr0 = passStringToWasm0(context_json, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
534
+ const len0 = WASM_VECTOR_LEN;
535
+ const ret = wasm.__macroforgeRunSerialize(ptr0, len0);
536
+ var ptr2 = ret[0];
537
+ var len2 = ret[1];
538
+ if (ret[3]) {
539
+ ptr2 = 0; len2 = 0;
540
+ throw takeFromExternrefTable0(ret[2]);
541
+ }
542
+ deferred3_0 = ptr2;
543
+ deferred3_1 = len2;
544
+ return getStringFromWasm0(ptr2, len2);
545
+ } finally {
546
+ wasm.__wbindgen_free_command_export(deferred3_0, deferred3_1, 1);
547
+ }
548
+ }
549
+ exports.__macroforgeRunSerialize = __macroforgeRunSerialize;
550
+
551
+ /**
552
+ * @param {string} code
553
+ * @param {string} filepath
554
+ * @returns {any}
555
+ */
556
+ function checkSyntax(code, filepath) {
557
+ const ptr0 = passStringToWasm0(code, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
558
+ const len0 = WASM_VECTOR_LEN;
559
+ const ptr1 = passStringToWasm0(filepath, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
560
+ const len1 = WASM_VECTOR_LEN;
561
+ const ret = wasm.checkSyntax(ptr0, len0, ptr1, len1);
562
+ if (ret[2]) {
563
+ throw takeFromExternrefTable0(ret[1]);
564
+ }
565
+ return takeFromExternrefTable0(ret[0]);
566
+ }
567
+ exports.checkSyntax = checkSyntax;
568
+
569
+ function clearConfigCache() {
570
+ wasm.clearConfigCache();
571
+ }
572
+ exports.clearConfigCache = clearConfigCache;
573
+
574
+ /**
575
+ * @param {string} code
576
+ * @param {string} filepath
577
+ * @param {any} options
578
+ * @returns {any}
579
+ */
580
+ function expandSync(code, filepath, options) {
581
+ const ptr0 = passStringToWasm0(code, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
582
+ const len0 = WASM_VECTOR_LEN;
583
+ const ptr1 = passStringToWasm0(filepath, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
584
+ const len1 = WASM_VECTOR_LEN;
585
+ const ret = wasm.expandSync(ptr0, len0, ptr1, len1, options);
586
+ if (ret[2]) {
587
+ throw takeFromExternrefTable0(ret[1]);
588
+ }
589
+ return takeFromExternrefTable0(ret[0]);
590
+ }
591
+ exports.expandSync = expandSync;
592
+
593
+ /**
594
+ * @param {string} content
595
+ * @param {string} filepath
596
+ * @returns {any}
597
+ */
598
+ function loadConfig(content, filepath) {
599
+ const ptr0 = passStringToWasm0(content, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
600
+ const len0 = WASM_VECTOR_LEN;
601
+ const ptr1 = passStringToWasm0(filepath, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
602
+ const len1 = WASM_VECTOR_LEN;
603
+ const ret = wasm.loadConfig(ptr0, len0, ptr1, len1);
604
+ if (ret[2]) {
605
+ throw takeFromExternrefTable0(ret[1]);
606
+ }
607
+ return takeFromExternrefTable0(ret[0]);
608
+ }
609
+ exports.loadConfig = loadConfig;
610
+
611
+ /**
612
+ * @param {string} code
613
+ * @param {string} filepath
614
+ * @returns {any}
615
+ */
616
+ function parseImportSources(code, filepath) {
617
+ const ptr0 = passStringToWasm0(code, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
618
+ const len0 = WASM_VECTOR_LEN;
619
+ const ptr1 = passStringToWasm0(filepath, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
620
+ const len1 = WASM_VECTOR_LEN;
621
+ const ret = wasm.parseImportSources(ptr0, len0, ptr1, len1);
622
+ if (ret[2]) {
623
+ throw takeFromExternrefTable0(ret[1]);
624
+ }
625
+ return takeFromExternrefTable0(ret[0]);
626
+ }
627
+ exports.parseImportSources = parseImportSources;
628
+
629
+ /**
630
+ * @param {string} root_dir
631
+ * @param {any} options
632
+ * @returns {any}
633
+ */
634
+ function scanProjectSync(root_dir, options) {
635
+ const ptr0 = passStringToWasm0(root_dir, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
636
+ const len0 = WASM_VECTOR_LEN;
637
+ const ret = wasm.scanProjectSync(ptr0, len0, options);
638
+ if (ret[2]) {
639
+ throw takeFromExternrefTable0(ret[1]);
640
+ }
641
+ return takeFromExternrefTable0(ret[0]);
642
+ }
643
+ exports.scanProjectSync = scanProjectSync;
644
+
645
+ /**
646
+ * Register JS callbacks for resolving and running external (user-defined) macros.
647
+ *
648
+ * Required for WASM builds. The native (NAPI) build resolves external macros
649
+ * by spawning a Node subprocess, but WASM cannot spawn processes. Instead, the
650
+ * host JS environment must provide two callbacks:
651
+ *
652
+ * resolve: Given a package path, return an array of decorator names exported by that package.
653
+ *
654
+ * run: Given a JSON-serialized MacroContextIR, execute the external macro and return a JSON-serialized MacroResult.
655
+ *
656
+ * Must be called before expandSync if the source uses import macro comments.
657
+ * Does not exist on NAPI builds, so guard the call.
658
+ * @param {Function} resolve
659
+ * @param {Function} run
660
+ */
661
+ function setupExternalMacros(resolve, run) {
662
+ wasm.setupExternalMacros(resolve, run);
663
+ }
664
+ exports.setupExternalMacros = setupExternalMacros;
665
+
666
+ /**
667
+ * @param {string} code
668
+ * @param {string} filepath
669
+ * @returns {any}
670
+ */
671
+ function transformSync(code, filepath) {
672
+ const ptr0 = passStringToWasm0(code, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
673
+ const len0 = WASM_VECTOR_LEN;
674
+ const ptr1 = passStringToWasm0(filepath, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
675
+ const len1 = WASM_VECTOR_LEN;
676
+ const ret = wasm.transformSync(ptr0, len0, ptr1, len1);
677
+ if (ret[2]) {
678
+ throw takeFromExternrefTable0(ret[1]);
679
+ }
680
+ return takeFromExternrefTable0(ret[0]);
681
+ }
682
+ exports.transformSync = transformSync;
683
+
684
+ function __wbg_get_imports() {
685
+ const import0 = {
686
+ __proto__: null,
687
+ __wbg_Error_2e59b1b37a9a34c3: function(arg0, arg1) {
688
+ const ret = Error(getStringFromWasm0(arg0, arg1));
689
+ return ret;
690
+ },
691
+ __wbg_Number_e6ffdb596c888833: function(arg0) {
692
+ const ret = Number(arg0);
693
+ return ret;
694
+ },
695
+ __wbg_String_8564e559799eccda: function(arg0, arg1) {
696
+ const ret = String(arg1);
697
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
698
+ const len1 = WASM_VECTOR_LEN;
699
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
700
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
701
+ },
702
+ __wbg___wbindgen_boolean_get_a86c216575a75c30: function(arg0) {
703
+ const v = arg0;
704
+ const ret = typeof(v) === 'boolean' ? v : undefined;
705
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
706
+ },
707
+ __wbg___wbindgen_debug_string_dd5d2d07ce9e6c57: function(arg0, arg1) {
708
+ const ret = debugString(arg1);
709
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
710
+ const len1 = WASM_VECTOR_LEN;
711
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
712
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
713
+ },
714
+ __wbg___wbindgen_in_4bd7a57e54337366: function(arg0, arg1) {
715
+ const ret = arg0 in arg1;
716
+ return ret;
717
+ },
718
+ __wbg___wbindgen_is_function_49868bde5eb1e745: function(arg0) {
719
+ const ret = typeof(arg0) === 'function';
720
+ return ret;
721
+ },
722
+ __wbg___wbindgen_is_null_344c8750a8525473: function(arg0) {
723
+ const ret = arg0 === null;
724
+ return ret;
725
+ },
726
+ __wbg___wbindgen_is_object_40c5a80572e8f9d3: function(arg0) {
727
+ const val = arg0;
728
+ const ret = typeof(val) === 'object' && val !== null;
729
+ return ret;
730
+ },
731
+ __wbg___wbindgen_is_string_b29b5c5a8065ba1a: function(arg0) {
732
+ const ret = typeof(arg0) === 'string';
733
+ return ret;
734
+ },
735
+ __wbg___wbindgen_is_undefined_c0cca72b82b86f4d: function(arg0) {
736
+ const ret = arg0 === undefined;
737
+ return ret;
738
+ },
739
+ __wbg___wbindgen_jsval_loose_eq_3a72ae764d46d944: function(arg0, arg1) {
740
+ const ret = arg0 == arg1;
741
+ return ret;
742
+ },
743
+ __wbg___wbindgen_number_get_7579aab02a8a620c: function(arg0, arg1) {
744
+ const obj = arg1;
745
+ const ret = typeof(obj) === 'number' ? obj : undefined;
746
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
747
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
748
+ },
749
+ __wbg___wbindgen_string_get_914df97fcfa788f2: function(arg0, arg1) {
750
+ const obj = arg1;
751
+ const ret = typeof(obj) === 'string' ? obj : undefined;
752
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
753
+ var len1 = WASM_VECTOR_LEN;
754
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
755
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
756
+ },
757
+ __wbg___wbindgen_throw_81fc77679af83bc6: function(arg0, arg1) {
758
+ throw new Error(getStringFromWasm0(arg0, arg1));
759
+ },
760
+ __wbg_call_7f2987183bb62793: function() { return handleError(function (arg0, arg1) {
761
+ const ret = arg0.call(arg1);
762
+ return ret;
763
+ }, arguments); },
764
+ __wbg_call_d578befcc3145dee: function() { return handleError(function (arg0, arg1, arg2) {
765
+ const ret = arg0.call(arg1, arg2);
766
+ return ret;
767
+ }, arguments); },
768
+ __wbg_done_547d467e97529006: function(arg0) {
769
+ const ret = arg0.done;
770
+ return ret;
771
+ },
772
+ __wbg_entries_616b1a459b85be0b: function(arg0) {
773
+ const ret = Object.entries(arg0);
774
+ return ret;
775
+ },
776
+ __wbg_get_4848e350b40afc16: function(arg0, arg1) {
777
+ const ret = arg0[arg1 >>> 0];
778
+ return ret;
779
+ },
780
+ __wbg_get_ed0642c4b9d31ddf: function() { return handleError(function (arg0, arg1) {
781
+ const ret = Reflect.get(arg0, arg1);
782
+ return ret;
783
+ }, arguments); },
784
+ __wbg_get_unchecked_7d7babe32e9e6a54: function(arg0, arg1) {
785
+ const ret = arg0[arg1 >>> 0];
786
+ return ret;
787
+ },
788
+ __wbg_get_with_ref_key_6412cf3094599694: function(arg0, arg1) {
789
+ const ret = arg0[arg1];
790
+ return ret;
791
+ },
792
+ __wbg_instanceof_ArrayBuffer_ff7c1337a5e3b33a: function(arg0) {
793
+ let result;
794
+ try {
795
+ result = arg0 instanceof ArrayBuffer;
796
+ } catch (_) {
797
+ result = false;
798
+ }
799
+ const ret = result;
800
+ return ret;
801
+ },
802
+ __wbg_instanceof_Uint8Array_4b8da683deb25d72: function(arg0) {
803
+ let result;
804
+ try {
805
+ result = arg0 instanceof Uint8Array;
806
+ } catch (_) {
807
+ result = false;
808
+ }
809
+ const ret = result;
810
+ return ret;
811
+ },
812
+ __wbg_isArray_db61795ad004c139: function(arg0) {
813
+ const ret = Array.isArray(arg0);
814
+ return ret;
815
+ },
816
+ __wbg_isSafeInteger_ea83862ba994770c: function(arg0) {
817
+ const ret = Number.isSafeInteger(arg0);
818
+ return ret;
819
+ },
820
+ __wbg_iterator_de403ef31815a3e6: function() {
821
+ const ret = Symbol.iterator;
822
+ return ret;
823
+ },
824
+ __wbg_length_0c32cb8543c8e4c8: function(arg0) {
825
+ const ret = arg0.length;
826
+ return ret;
827
+ },
828
+ __wbg_length_6e821edde497a532: function(arg0) {
829
+ const ret = arg0.length;
830
+ return ret;
831
+ },
832
+ __wbg_new_4f9fafbb3909af72: function() {
833
+ const ret = new Object();
834
+ return ret;
835
+ },
836
+ __wbg_new_a560378ea1240b14: function(arg0) {
837
+ const ret = new Uint8Array(arg0);
838
+ return ret;
839
+ },
840
+ __wbg_new_f3c9df4f38f3f798: function() {
841
+ const ret = new Array();
842
+ return ret;
843
+ },
844
+ __wbg_next_01132ed6134b8ef5: function(arg0) {
845
+ const ret = arg0.next;
846
+ return ret;
847
+ },
848
+ __wbg_next_b3713ec761a9dbfd: function() { return handleError(function (arg0) {
849
+ const ret = arg0.next();
850
+ return ret;
851
+ }, arguments); },
852
+ __wbg_prototypesetcall_3e05eb9545565046: function(arg0, arg1, arg2) {
853
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
854
+ },
855
+ __wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
856
+ arg0[arg1] = arg2;
857
+ },
858
+ __wbg_set_6c60b2e8ad0e9383: function(arg0, arg1, arg2) {
859
+ arg0[arg1 >>> 0] = arg2;
860
+ },
861
+ __wbg_set_8ee2d34facb8466e: function() { return handleError(function (arg0, arg1, arg2) {
862
+ const ret = Reflect.set(arg0, arg1, arg2);
863
+ return ret;
864
+ }, arguments); },
865
+ __wbg_value_7f6052747ccf940f: function(arg0) {
866
+ const ret = arg0.value;
867
+ return ret;
868
+ },
869
+ __wbindgen_cast_0000000000000001: function(arg0) {
870
+ // Cast intrinsic for `F64 -> Externref`.
871
+ const ret = arg0;
872
+ return ret;
873
+ },
874
+ __wbindgen_cast_0000000000000002: function(arg0, arg1) {
875
+ // Cast intrinsic for `Ref(String) -> Externref`.
876
+ const ret = getStringFromWasm0(arg0, arg1);
877
+ return ret;
878
+ },
879
+ __wbindgen_init_externref_table: function() {
880
+ const table = wasm.__wbindgen_externrefs;
881
+ const offset = table.grow(4);
882
+ table.set(0, undefined);
883
+ table.set(offset + 0, undefined);
884
+ table.set(offset + 1, null);
885
+ table.set(offset + 2, true);
886
+ table.set(offset + 3, false);
887
+ },
888
+ };
889
+ return {
890
+ __proto__: null,
891
+ "./macroforge_ts_bg.js": import0,
892
+ };
893
+ }
894
+
895
+ const NativePluginFinalization = (typeof FinalizationRegistry === 'undefined')
896
+ ? { register: () => {}, unregister: () => {} }
897
+ : new FinalizationRegistry(ptr => wasm.__wbg_nativeplugin_free(ptr >>> 0, 1));
898
+ const NativePositionMapperFinalization = (typeof FinalizationRegistry === 'undefined')
899
+ ? { register: () => {}, unregister: () => {} }
900
+ : new FinalizationRegistry(ptr => wasm.__wbg_nativepositionmapper_free(ptr >>> 0, 1));
901
+ const NativeMapperFinalization = (typeof FinalizationRegistry === 'undefined')
902
+ ? { register: () => {}, unregister: () => {} }
903
+ : new FinalizationRegistry(ptr => wasm.__wbg_nativemapper_free(ptr >>> 0, 1));
904
+
905
+ function addToExternrefTable0(obj) {
906
+ const idx = wasm.__externref_table_alloc_command_export();
907
+ wasm.__wbindgen_externrefs.set(idx, obj);
908
+ return idx;
909
+ }
910
+
911
+ function debugString(val) {
912
+ // primitive types
913
+ const type = typeof val;
914
+ if (type == 'number' || type == 'boolean' || val == null) {
915
+ return `${val}`;
916
+ }
917
+ if (type == 'string') {
918
+ return `"${val}"`;
919
+ }
920
+ if (type == 'symbol') {
921
+ const description = val.description;
922
+ if (description == null) {
923
+ return 'Symbol';
924
+ } else {
925
+ return `Symbol(${description})`;
926
+ }
927
+ }
928
+ if (type == 'function') {
929
+ const name = val.name;
930
+ if (typeof name == 'string' && name.length > 0) {
931
+ return `Function(${name})`;
932
+ } else {
933
+ return 'Function';
934
+ }
935
+ }
936
+ // objects
937
+ if (Array.isArray(val)) {
938
+ const length = val.length;
939
+ let debug = '[';
940
+ if (length > 0) {
941
+ debug += debugString(val[0]);
942
+ }
943
+ for(let i = 1; i < length; i++) {
944
+ debug += ', ' + debugString(val[i]);
945
+ }
946
+ debug += ']';
947
+ return debug;
948
+ }
949
+ // Test for built-in
950
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
951
+ let className;
952
+ if (builtInMatches && builtInMatches.length > 1) {
953
+ className = builtInMatches[1];
954
+ } else {
955
+ // Failed to match the standard '[object ClassName]'
956
+ return toString.call(val);
957
+ }
958
+ if (className == 'Object') {
959
+ // we're a user defined class or Object
960
+ // JSON.stringify avoids problems with cycles, and is generally much
961
+ // easier than looping through ownProperties of `val`.
962
+ try {
963
+ return 'Object(' + JSON.stringify(val) + ')';
964
+ } catch (_) {
965
+ return 'Object';
966
+ }
967
+ }
968
+ // errors
969
+ if (val instanceof Error) {
970
+ return `${val.name}: ${val.message}\n${val.stack}`;
971
+ }
972
+ // TODO we could test for more things here, like `Set`s and `Map`s.
973
+ return className;
974
+ }
975
+
976
+ function getArrayU8FromWasm0(ptr, len) {
977
+ ptr = ptr >>> 0;
978
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
979
+ }
980
+
981
+ let cachedDataViewMemory0 = null;
982
+ function getDataViewMemory0() {
983
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
984
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
985
+ }
986
+ return cachedDataViewMemory0;
987
+ }
988
+
989
+ function getStringFromWasm0(ptr, len) {
990
+ ptr = ptr >>> 0;
991
+ return decodeText(ptr, len);
992
+ }
993
+
994
+ let cachedUint8ArrayMemory0 = null;
995
+ function getUint8ArrayMemory0() {
996
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
997
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
998
+ }
999
+ return cachedUint8ArrayMemory0;
1000
+ }
1001
+
1002
+ function handleError(f, args) {
1003
+ try {
1004
+ return f.apply(this, args);
1005
+ } catch (e) {
1006
+ const idx = addToExternrefTable0(e);
1007
+ wasm.__wbindgen_exn_store_command_export(idx);
1008
+ }
1009
+ }
1010
+
1011
+ function isLikeNone(x) {
1012
+ return x === undefined || x === null;
1013
+ }
1014
+
1015
+ function passStringToWasm0(arg, malloc, realloc) {
1016
+ if (realloc === undefined) {
1017
+ const buf = cachedTextEncoder.encode(arg);
1018
+ const ptr = malloc(buf.length, 1) >>> 0;
1019
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
1020
+ WASM_VECTOR_LEN = buf.length;
1021
+ return ptr;
1022
+ }
1023
+
1024
+ let len = arg.length;
1025
+ let ptr = malloc(len, 1) >>> 0;
1026
+
1027
+ const mem = getUint8ArrayMemory0();
1028
+
1029
+ let offset = 0;
1030
+
1031
+ for (; offset < len; offset++) {
1032
+ const code = arg.charCodeAt(offset);
1033
+ if (code > 0x7F) break;
1034
+ mem[ptr + offset] = code;
1035
+ }
1036
+ if (offset !== len) {
1037
+ if (offset !== 0) {
1038
+ arg = arg.slice(offset);
1039
+ }
1040
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
1041
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
1042
+ const ret = cachedTextEncoder.encodeInto(arg, view);
1043
+
1044
+ offset += ret.written;
1045
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
1046
+ }
1047
+
1048
+ WASM_VECTOR_LEN = offset;
1049
+ return ptr;
1050
+ }
1051
+
1052
+ function takeFromExternrefTable0(idx) {
1053
+ const value = wasm.__wbindgen_externrefs.get(idx);
1054
+ wasm.__externref_table_dealloc_command_export(idx);
1055
+ return value;
1056
+ }
1057
+
1058
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1059
+ cachedTextDecoder.decode();
1060
+ function decodeText(ptr, len) {
1061
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
1062
+ }
1063
+
1064
+ const cachedTextEncoder = new TextEncoder();
1065
+
1066
+ if (!('encodeInto' in cachedTextEncoder)) {
1067
+ cachedTextEncoder.encodeInto = function (arg, view) {
1068
+ const buf = cachedTextEncoder.encode(arg);
1069
+ view.set(buf);
1070
+ return {
1071
+ read: arg.length,
1072
+ written: buf.length
1073
+ };
1074
+ };
1075
+ }
1076
+
1077
+ let WASM_VECTOR_LEN = 0;
1078
+
1079
+ const wasmPath = `${__dirname}/macroforge_ts_bg.wasm`;
1080
+ const wasmBytes = require('fs').readFileSync(wasmPath);
1081
+ const wasmModule = new WebAssembly.Module(wasmBytes);
1082
+ let wasm = new WebAssembly.Instance(wasmModule, __wbg_get_imports()).exports;
1083
+ wasm.__wbindgen_start();