@parcel/rust 2.12.1-dev.3262 → 2.12.1-dev.3264

Sign up to get free protection for your applications and to get access to all the features.
package/lib/db.js ADDED
@@ -0,0 +1,1300 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.TargetSourceMapOptions = exports.Target = exports.SymbolFlags = exports.Symbol = exports.SpecifierType = exports.SourceType = exports.SourceLocation = exports.Priority = exports.OutputFormat = exports.Location = exports.ImportAttribute = exports.ExportsCondition = exports.EnvironmentFlags = exports.EnvironmentContext = exports.Environment = exports.Engines = exports.DependencyFlags = exports.Dependency = exports.BundleBehavior = exports.AssetType = exports.AssetStats = exports.AssetFlags = exports.AssetAst = exports.Asset = void 0;
7
+ exports.readCachedString = readCachedString;
8
+ var _index = require("../index");
9
+ let heapSymbol = global.Symbol('heap');
10
+ let heapU32Symbol = global.Symbol('heapU32');
11
+ let stringCacheSymbol = global.Symbol('stringCache');
12
+
13
+ // $FlowFixMe
14
+ _index.ParcelDb.deserialize = serialized => {
15
+ // $FlowFixMe
16
+ let res = _index.ParcelDb.deserializeNative(serialized);
17
+ init(res);
18
+ return res;
19
+ };
20
+
21
+ // $FlowFixMe
22
+ _index.ParcelDb.create = options => {
23
+ let db = new _index.ParcelDb(options);
24
+ init(db);
25
+ return db;
26
+ };
27
+
28
+ // $FlowFixMe
29
+ _index.ParcelDb.read = (filename, options) => {
30
+ // $FlowFixMe
31
+ let db = _index.ParcelDb._read(filename, options);
32
+ init(db);
33
+ return db;
34
+ };
35
+
36
+ // $FlowFixMe
37
+ _index.ParcelDb.fromBuffer = (buffer, options) => {
38
+ // $FlowFixMe
39
+ let db = _index.ParcelDb._fromBuffer(buffer, options);
40
+ init(db);
41
+ return db;
42
+ };
43
+ function init(db) {
44
+ db[heapSymbol] = [];
45
+ db[heapU32Symbol] = [];
46
+ db[stringCacheSymbol] = new Map();
47
+ db.starSymbol = db.getStringId('*');
48
+ db.defaultSymbol = db.getStringId('default');
49
+ }
50
+ const PAGE_INDEX_SIZE = 16;
51
+ const PAGE_INDEX_SHIFT = 32 - PAGE_INDEX_SIZE;
52
+ const PAGE_INDEX_MASK = (1 << PAGE_INDEX_SIZE) - 1 << PAGE_INDEX_SHIFT;
53
+ const PAGE_OFFSET_MASK = (1 << PAGE_INDEX_SHIFT) - 1;
54
+ function copy(db, from, to, size) {
55
+ var _heap$fromPage, _heap$toPage;
56
+ let fromPage = (from & PAGE_INDEX_MASK) >> PAGE_INDEX_SHIFT;
57
+ let fromOffset = from & PAGE_OFFSET_MASK;
58
+ let heap = db[heapSymbol];
59
+ let fromHeapPage = (_heap$fromPage = heap[fromPage]) !== null && _heap$fromPage !== void 0 ? _heap$fromPage : heap[fromPage] = db.getPage(fromPage);
60
+ let toPage = (to & PAGE_INDEX_MASK) >> PAGE_INDEX_SHIFT;
61
+ let toHeapPage = (_heap$toPage = heap[toPage]) !== null && _heap$toPage !== void 0 ? _heap$toPage : heap[toPage] = db.getPage(toPage);
62
+ toHeapPage.set(fromHeapPage.subarray(fromOffset, fromOffset + size), to & PAGE_OFFSET_MASK);
63
+ }
64
+ function readU8(db, addr) {
65
+ var _heap$page;
66
+ let page = (addr & PAGE_INDEX_MASK) >> PAGE_INDEX_SHIFT;
67
+ let heap = db[heapSymbol];
68
+ let heapPage = (_heap$page = heap[page]) !== null && _heap$page !== void 0 ? _heap$page : heap[page] = db.getPage(page);
69
+ return heapPage[addr & PAGE_OFFSET_MASK];
70
+ }
71
+ function writeU8(db, addr, value) {
72
+ var _heap$page2;
73
+ let page = (addr & PAGE_INDEX_MASK) >> PAGE_INDEX_SHIFT;
74
+ let heap = db[heapSymbol];
75
+ let heapPage = (_heap$page2 = heap[page]) !== null && _heap$page2 !== void 0 ? _heap$page2 : heap[page] = db.getPage(page);
76
+ return heapPage[addr & PAGE_OFFSET_MASK] = value;
77
+ }
78
+ function readU32(db, addr) {
79
+ var _heap_u32$page, _heap$page3;
80
+ let page = (addr & PAGE_INDEX_MASK) >> PAGE_INDEX_SHIFT;
81
+ let heap = db[heapSymbol];
82
+ let heap_u32 = db[heapU32Symbol];
83
+ let heapPage = (_heap_u32$page = heap_u32[page]) !== null && _heap_u32$page !== void 0 ? _heap_u32$page : heap_u32[page] = new Uint32Array(((_heap$page3 = heap[page]) !== null && _heap$page3 !== void 0 ? _heap$page3 : heap[page] = db.getPage(page)).buffer);
84
+ return heapPage[(addr & PAGE_OFFSET_MASK) >> 2];
85
+ }
86
+ function writeU32(db, addr, value) {
87
+ var _heap_u32$page2, _heap$page4;
88
+ let page = (addr & PAGE_INDEX_MASK) >> PAGE_INDEX_SHIFT;
89
+ let heap = db[heapSymbol];
90
+ let heap_u32 = db[heapU32Symbol];
91
+ let heapPage = (_heap_u32$page2 = heap_u32[page]) !== null && _heap_u32$page2 !== void 0 ? _heap_u32$page2 : heap_u32[page] = new Uint32Array(((_heap$page4 = heap[page]) !== null && _heap$page4 !== void 0 ? _heap$page4 : heap[page] = db.getPage(page)).buffer);
92
+ return heapPage[(addr & PAGE_OFFSET_MASK) >> 2] = value;
93
+ }
94
+ function readCachedString(db, addr) {
95
+ let stringCache = db[stringCacheSymbol];
96
+ let v = stringCache.get(addr);
97
+ if (v != null) return v;
98
+ v = db.readString(addr);
99
+ stringCache.set(addr, v);
100
+ return v;
101
+ }
102
+ class Vec {
103
+ /*::
104
+ @@iterator(): Iterator<T> { return ({}: any); }
105
+ */
106
+
107
+ constructor(db, addr, size, accessor) {
108
+ this.db = db;
109
+ this.addr = addr;
110
+ this.size = size;
111
+ this.accessor = accessor;
112
+ }
113
+ get length() {
114
+ return readU32(this.db, this.addr + 4);
115
+ }
116
+ get capacity() {
117
+ return readU32(this.db, this.addr + 8);
118
+ }
119
+ get(index) {
120
+ let bufAddr = readU32(this.db, this.addr + 0);
121
+ return this.accessor.get(this.db, bufAddr + index * this.size);
122
+ }
123
+ set(index, value) {
124
+ if (index >= this.length) {
125
+ throw new Error(`Index out of bounds: ${index} >= ${this.length}`);
126
+ }
127
+ let bufAddr = readU32(this.db, this.addr + 0);
128
+ this.accessor.set(this.db, bufAddr + index * this.size, value);
129
+ }
130
+ reserve(count) {
131
+ if (this.length + count > this.capacity) {
132
+ this.db.extendVec(this.accessor.typeId, this.addr, count);
133
+ }
134
+ }
135
+ push(value) {
136
+ this.reserve(1);
137
+ writeU32(this.db, this.addr + 4, readU32(this.db, this.addr + 4) + 1);
138
+ this.set(this.length - 1, value);
139
+ }
140
+ extend() {
141
+ this.reserve(1);
142
+ writeU32(this.db, this.addr + 4, readU32(this.db, this.addr + 4) + 1);
143
+ return this.get(this.length - 1);
144
+ }
145
+ delete(index) {
146
+ let bufAddr = readU32(this.db, this.addr + 0);
147
+ let fromAddr = bufAddr + (index + 1) * this.size;
148
+ let toAddr = bufAddr + index * this.size;
149
+ copy(this.db, fromAddr, toAddr, (this.length - index + 1) * this.size);
150
+ writeU32(this.db, this.addr + 4, readU32(this.db, this.addr + 4) - 1);
151
+ }
152
+ clear() {
153
+ // TODO: run Rust destructors?
154
+ writeU32(this.db, this.addr + 4, 0);
155
+ }
156
+ init() {
157
+ writeU32(this.db, this.addr + 4, 0);
158
+ writeU32(this.db, this.addr + 8, 0);
159
+ writeU32(this.db, this.addr + 0, 0);
160
+ }
161
+ copyFrom(from) {
162
+ this.clear();
163
+ this.reserve(from.length);
164
+ let fromAddr = readU32(this.db, from.addr + 0);
165
+ let toAddr = readU32(this.db, this.addr + 0);
166
+ copy(this.db, fromAddr, toAddr, from.length * this.size);
167
+ writeU32(this.db, this.addr + 4, from.length);
168
+ }
169
+
170
+ // $FlowFixMe
171
+ *[globalThis.Symbol.iterator]() {
172
+ let addr = readU32(this.db, this.addr + 0);
173
+ for (let i = 0, len = this.length; i < len; i++, addr += this.size) {
174
+ yield this.accessor.get(this.db, addr);
175
+ }
176
+ }
177
+ find(pred) {
178
+ let addr = readU32(this.db, this.addr + 0);
179
+ for (let i = 0, len = this.length; i < len; i++, addr += this.size) {
180
+ let value = this.accessor.get(this.db, addr);
181
+ if (pred(value)) {
182
+ return value;
183
+ }
184
+ }
185
+ }
186
+ findIndex(pred) {
187
+ let addr = readU32(this.db, this.addr + 0);
188
+ for (let i = 0, len = this.length; i < len; i++, addr += this.size) {
189
+ let value = this.accessor.get(this.db, addr);
190
+ if (pred(value)) {
191
+ return i;
192
+ }
193
+ }
194
+ return -1;
195
+ }
196
+ some(pred) {
197
+ let addr = readU32(this.db, this.addr + 0);
198
+ for (let i = 0, len = this.length; i < len; i++, addr += this.size) {
199
+ let value = this.accessor.get(this.db, addr);
200
+ if (pred(value)) {
201
+ return true;
202
+ }
203
+ }
204
+ return false;
205
+ }
206
+ every(pred) {
207
+ let addr = readU32(this.db, this.addr + 0);
208
+ for (let i = 0, len = this.length; i < len; i++, addr += this.size) {
209
+ let value = this.accessor.get(this.db, addr);
210
+ if (!pred(value)) {
211
+ return false;
212
+ }
213
+ }
214
+ return true;
215
+ }
216
+ }
217
+ class Target {
218
+ static typeId = 10;
219
+ constructor(db, addr) {
220
+ this.db = db;
221
+ this.addr = addr !== null && addr !== void 0 ? addr : db.alloc(10);
222
+ }
223
+ static get(db, addr) {
224
+ return new Target(db, addr);
225
+ }
226
+ static set(db, addr, value) {
227
+ copy(db, value.addr, addr, 44);
228
+ }
229
+ dealloc() {
230
+ this.db.dealloc(10, this.addr);
231
+ }
232
+ get env() {
233
+ return readU32(this.db, this.addr + 0);
234
+ }
235
+ set env(value) {
236
+ writeU32(this.db, this.addr + 0, value);
237
+ }
238
+ get distDir() {
239
+ return readCachedString(this.db, readU32(this.db, this.addr + 4));
240
+ }
241
+ set distDir(value) {
242
+ writeU32(this.db, this.addr + 4, this.db.getStringId(value));
243
+ }
244
+ get distEntry() {
245
+ return readU32(this.db, this.addr + 16 + 0) === 0 ? null : readCachedString(this.db, readU32(this.db, this.addr + 16));
246
+ }
247
+ set distEntry(value) {
248
+ if (value == null) {
249
+ writeU32(this.db, this.addr + 16 + 0, 0);
250
+ } else {
251
+ writeU32(this.db, this.addr + 16, this.db.getStringId(value));
252
+ }
253
+ }
254
+ get name() {
255
+ return readCachedString(this.db, readU32(this.db, this.addr + 8));
256
+ }
257
+ set name(value) {
258
+ writeU32(this.db, this.addr + 8, this.db.getStringId(value));
259
+ }
260
+ get publicUrl() {
261
+ return readCachedString(this.db, readU32(this.db, this.addr + 12));
262
+ }
263
+ set publicUrl(value) {
264
+ writeU32(this.db, this.addr + 12, this.db.getStringId(value));
265
+ }
266
+ get loc() {
267
+ return readU32(this.db, this.addr + 20 + 0) === 0 ? null : SourceLocation.get(this.db, this.addr + 20);
268
+ }
269
+ set loc(value) {
270
+ if (value == null) {
271
+ writeU32(this.db, this.addr + 20 + 0, 0);
272
+ } else {
273
+ SourceLocation.set(this.db, this.addr + 20, value);
274
+ }
275
+ }
276
+ get pipeline() {
277
+ return readU32(this.db, this.addr + 40 + 0) === 0 ? null : readCachedString(this.db, readU32(this.db, this.addr + 40));
278
+ }
279
+ set pipeline(value) {
280
+ if (value == null) {
281
+ writeU32(this.db, this.addr + 40 + 0, 0);
282
+ } else {
283
+ writeU32(this.db, this.addr + 40, this.db.getStringId(value));
284
+ }
285
+ }
286
+ }
287
+ exports.Target = Target;
288
+ class Environment {
289
+ static typeId = 5;
290
+ constructor(db, addr) {
291
+ this.db = db;
292
+ this.addr = addr !== null && addr !== void 0 ? addr : db.alloc(5);
293
+ }
294
+ static get(db, addr) {
295
+ return new Environment(db, addr);
296
+ }
297
+ static set(db, addr, value) {
298
+ copy(db, value.addr, addr, 60);
299
+ }
300
+ dealloc() {
301
+ this.db.dealloc(5, this.addr);
302
+ }
303
+ get context() {
304
+ return EnvironmentContext.get(this.db, this.addr + 57);
305
+ }
306
+ set context(value) {
307
+ EnvironmentContext.set(this.db, this.addr + 57, value);
308
+ }
309
+ get outputFormat() {
310
+ return OutputFormat.get(this.db, this.addr + 58);
311
+ }
312
+ set outputFormat(value) {
313
+ OutputFormat.set(this.db, this.addr + 58, value);
314
+ }
315
+ get sourceType() {
316
+ return SourceType.get(this.db, this.addr + 59);
317
+ }
318
+ set sourceType(value) {
319
+ SourceType.set(this.db, this.addr + 59, value);
320
+ }
321
+ get flags() {
322
+ return readU8(this.db, this.addr + 56);
323
+ }
324
+ set flags(value) {
325
+ writeU8(this.db, this.addr + 56, value);
326
+ }
327
+ get sourceMap() {
328
+ return readU8(this.db, this.addr + 24 + 5) === 2 ? null : TargetSourceMapOptions.get(this.db, this.addr + 24);
329
+ }
330
+ set sourceMap(value) {
331
+ if (value == null) {
332
+ writeU8(this.db, this.addr + 24 + 5, 2);
333
+ } else {
334
+ TargetSourceMapOptions.set(this.db, this.addr + 24, value);
335
+ }
336
+ }
337
+ get loc() {
338
+ return readU32(this.db, this.addr + 32 + 0) === 0 ? null : SourceLocation.get(this.db, this.addr + 32);
339
+ }
340
+ set loc(value) {
341
+ if (value == null) {
342
+ writeU32(this.db, this.addr + 32 + 0, 0);
343
+ } else {
344
+ SourceLocation.set(this.db, this.addr + 32, value);
345
+ }
346
+ }
347
+ get includeNodeModules() {
348
+ return readCachedString(this.db, readU32(this.db, this.addr + 52));
349
+ }
350
+ set includeNodeModules(value) {
351
+ writeU32(this.db, this.addr + 52, this.db.getStringId(value));
352
+ }
353
+ get engines() {
354
+ return Engines.get(this.db, this.addr + 0);
355
+ }
356
+ set engines(value) {
357
+ Engines.set(this.db, this.addr + 0, value);
358
+ }
359
+ }
360
+ exports.Environment = Environment;
361
+ class Engines {
362
+ static typeId = 4;
363
+ constructor(db, addr) {
364
+ this.db = db;
365
+ this.addr = addr !== null && addr !== void 0 ? addr : db.alloc(4);
366
+ }
367
+ static get(db, addr) {
368
+ return new Engines(db, addr);
369
+ }
370
+ static set(db, addr, value) {
371
+ copy(db, value.addr, addr, 24);
372
+ }
373
+ dealloc() {
374
+ this.db.dealloc(4, this.addr);
375
+ }
376
+ get browsers() {
377
+ return new Vec(this.db, this.addr + 0, 4, InternedString);
378
+ }
379
+ set browsers(value) {
380
+ copy(this.db, value.addr, this.addr + 0, 12);
381
+ }
382
+ get electron() {
383
+ return readU32(this.db, this.addr + 12 + 0) === 0 ? null : readCachedString(this.db, readU32(this.db, this.addr + 12));
384
+ }
385
+ set electron(value) {
386
+ if (value == null) {
387
+ writeU32(this.db, this.addr + 12 + 0, 0);
388
+ } else {
389
+ writeU32(this.db, this.addr + 12, this.db.getStringId(value));
390
+ }
391
+ }
392
+ get node() {
393
+ return readU32(this.db, this.addr + 16 + 0) === 0 ? null : readCachedString(this.db, readU32(this.db, this.addr + 16));
394
+ }
395
+ set node(value) {
396
+ if (value == null) {
397
+ writeU32(this.db, this.addr + 16 + 0, 0);
398
+ } else {
399
+ writeU32(this.db, this.addr + 16, this.db.getStringId(value));
400
+ }
401
+ }
402
+ get parcel() {
403
+ return readU32(this.db, this.addr + 20 + 0) === 0 ? null : readCachedString(this.db, readU32(this.db, this.addr + 20));
404
+ }
405
+ set parcel(value) {
406
+ if (value == null) {
407
+ writeU32(this.db, this.addr + 20 + 0, 0);
408
+ } else {
409
+ writeU32(this.db, this.addr + 20, this.db.getStringId(value));
410
+ }
411
+ }
412
+ }
413
+ exports.Engines = Engines;
414
+ class TargetSourceMapOptions {
415
+ static typeId = 11;
416
+ constructor(db, addr) {
417
+ this.db = db;
418
+ this.addr = addr !== null && addr !== void 0 ? addr : db.alloc(11);
419
+ }
420
+ static get(db, addr) {
421
+ return new TargetSourceMapOptions(db, addr);
422
+ }
423
+ static set(db, addr, value) {
424
+ copy(db, value.addr, addr, 8);
425
+ }
426
+ dealloc() {
427
+ this.db.dealloc(11, this.addr);
428
+ }
429
+ get sourceRoot() {
430
+ return readU32(this.db, this.addr + 0 + 0) === 0 ? null : readCachedString(this.db, readU32(this.db, this.addr + 0));
431
+ }
432
+ set sourceRoot(value) {
433
+ if (value == null) {
434
+ writeU32(this.db, this.addr + 0 + 0, 0);
435
+ } else {
436
+ writeU32(this.db, this.addr + 0, this.db.getStringId(value));
437
+ }
438
+ }
439
+ get inline() {
440
+ return !!readU8(this.db, this.addr + 4);
441
+ }
442
+ set inline(value) {
443
+ writeU8(this.db, this.addr + 4, value ? 1 : 0);
444
+ }
445
+ get inlineSources() {
446
+ return !!readU8(this.db, this.addr + 5);
447
+ }
448
+ set inlineSources(value) {
449
+ writeU8(this.db, this.addr + 5, value ? 1 : 0);
450
+ }
451
+ }
452
+ exports.TargetSourceMapOptions = TargetSourceMapOptions;
453
+ class SourceLocation {
454
+ static typeId = 8;
455
+ constructor(db, addr) {
456
+ this.db = db;
457
+ this.addr = addr !== null && addr !== void 0 ? addr : db.alloc(8);
458
+ }
459
+ static get(db, addr) {
460
+ return new SourceLocation(db, addr);
461
+ }
462
+ static set(db, addr, value) {
463
+ copy(db, value.addr, addr, 20);
464
+ }
465
+ dealloc() {
466
+ this.db.dealloc(8, this.addr);
467
+ }
468
+ get filePath() {
469
+ return readCachedString(this.db, readU32(this.db, this.addr + 0));
470
+ }
471
+ set filePath(value) {
472
+ writeU32(this.db, this.addr + 0, this.db.getStringId(value));
473
+ }
474
+ get start() {
475
+ return Location.get(this.db, this.addr + 4);
476
+ }
477
+ set start(value) {
478
+ Location.set(this.db, this.addr + 4, value);
479
+ }
480
+ get end() {
481
+ return Location.get(this.db, this.addr + 12);
482
+ }
483
+ set end(value) {
484
+ Location.set(this.db, this.addr + 12, value);
485
+ }
486
+ }
487
+ exports.SourceLocation = SourceLocation;
488
+ class Location {
489
+ static typeId = 7;
490
+ constructor(db, addr) {
491
+ this.db = db;
492
+ this.addr = addr !== null && addr !== void 0 ? addr : db.alloc(7);
493
+ }
494
+ static get(db, addr) {
495
+ return new Location(db, addr);
496
+ }
497
+ static set(db, addr, value) {
498
+ copy(db, value.addr, addr, 8);
499
+ }
500
+ dealloc() {
501
+ this.db.dealloc(7, this.addr);
502
+ }
503
+ get line() {
504
+ return readU32(this.db, this.addr + 0);
505
+ }
506
+ set line(value) {
507
+ writeU32(this.db, this.addr + 0, value);
508
+ }
509
+ get column() {
510
+ return readU32(this.db, this.addr + 4);
511
+ }
512
+ set column(value) {
513
+ writeU32(this.db, this.addr + 4, value);
514
+ }
515
+ }
516
+ exports.Location = Location;
517
+ const EnvironmentFlags = exports.EnvironmentFlags = {
518
+ IS_LIBRARY: 0b1,
519
+ SHOULD_OPTIMIZE: 0b10,
520
+ SHOULD_SCOPE_HOIST: 0b100
521
+ };
522
+ class EnvironmentContext {
523
+ static get(db, addr) {
524
+ switch (readU8(db, addr + 0)) {
525
+ case 0:
526
+ return 'browser';
527
+ case 1:
528
+ return 'web-worker';
529
+ case 2:
530
+ return 'service-worker';
531
+ case 3:
532
+ return 'worklet';
533
+ case 4:
534
+ return 'node';
535
+ case 5:
536
+ return 'electron-main';
537
+ case 6:
538
+ return 'electron-renderer';
539
+ default:
540
+ throw new Error(`Unknown EnvironmentContext value: ${readU8(db, addr)}`);
541
+ }
542
+ }
543
+ static set(db, addr, value) {
544
+ let write = writeU8;
545
+ switch (value) {
546
+ case 'browser':
547
+ write(db, addr + 0, 0);
548
+ break;
549
+ case 'web-worker':
550
+ write(db, addr + 0, 1);
551
+ break;
552
+ case 'service-worker':
553
+ write(db, addr + 0, 2);
554
+ break;
555
+ case 'worklet':
556
+ write(db, addr + 0, 3);
557
+ break;
558
+ case 'node':
559
+ write(db, addr + 0, 4);
560
+ break;
561
+ case 'electron-main':
562
+ write(db, addr + 0, 5);
563
+ break;
564
+ case 'electron-renderer':
565
+ write(db, addr + 0, 6);
566
+ break;
567
+ default:
568
+ throw new Error(`Unknown EnvironmentContext value: ${value}`);
569
+ }
570
+ }
571
+ }
572
+ exports.EnvironmentContext = EnvironmentContext;
573
+ class SourceType {
574
+ static get(db, addr) {
575
+ switch (readU8(db, addr + 0)) {
576
+ case 0:
577
+ return 'module';
578
+ case 1:
579
+ return 'script';
580
+ default:
581
+ throw new Error(`Unknown SourceType value: ${readU8(db, addr)}`);
582
+ }
583
+ }
584
+ static set(db, addr, value) {
585
+ let write = writeU8;
586
+ switch (value) {
587
+ case 'module':
588
+ write(db, addr + 0, 0);
589
+ break;
590
+ case 'script':
591
+ write(db, addr + 0, 1);
592
+ break;
593
+ default:
594
+ throw new Error(`Unknown SourceType value: ${value}`);
595
+ }
596
+ }
597
+ }
598
+ exports.SourceType = SourceType;
599
+ class OutputFormat {
600
+ static get(db, addr) {
601
+ switch (readU8(db, addr + 0)) {
602
+ case 0:
603
+ return 'global';
604
+ case 1:
605
+ return 'commonjs';
606
+ case 2:
607
+ return 'esmodule';
608
+ default:
609
+ throw new Error(`Unknown OutputFormat value: ${readU8(db, addr)}`);
610
+ }
611
+ }
612
+ static set(db, addr, value) {
613
+ let write = writeU8;
614
+ switch (value) {
615
+ case 'global':
616
+ write(db, addr + 0, 0);
617
+ break;
618
+ case 'commonjs':
619
+ write(db, addr + 0, 1);
620
+ break;
621
+ case 'esmodule':
622
+ write(db, addr + 0, 2);
623
+ break;
624
+ default:
625
+ throw new Error(`Unknown OutputFormat value: ${value}`);
626
+ }
627
+ }
628
+ }
629
+ exports.OutputFormat = OutputFormat;
630
+ class Asset {
631
+ static typeId = 0;
632
+ constructor(db, addr) {
633
+ this.db = db;
634
+ this.addr = addr !== null && addr !== void 0 ? addr : db.alloc(0);
635
+ }
636
+ static get(db, addr) {
637
+ return new Asset(db, addr);
638
+ }
639
+ static set(db, addr, value) {
640
+ copy(db, value.addr, addr, 100);
641
+ }
642
+ dealloc() {
643
+ this.db.dealloc(0, this.addr);
644
+ }
645
+ get id() {
646
+ return readU32(this.db, this.addr + 8);
647
+ }
648
+ set id(value) {
649
+ writeU32(this.db, this.addr + 8, value);
650
+ }
651
+ get filePath() {
652
+ return readCachedString(this.db, readU32(this.db, this.addr + 12));
653
+ }
654
+ set filePath(value) {
655
+ writeU32(this.db, this.addr + 12, this.db.getStringId(value));
656
+ }
657
+ get env() {
658
+ return readU32(this.db, this.addr + 16);
659
+ }
660
+ set env(value) {
661
+ writeU32(this.db, this.addr + 16, value);
662
+ }
663
+ get query() {
664
+ return readU32(this.db, this.addr + 28 + 0) === 0 ? null : readCachedString(this.db, readU32(this.db, this.addr + 28));
665
+ }
666
+ set query(value) {
667
+ if (value == null) {
668
+ writeU32(this.db, this.addr + 28 + 0, 0);
669
+ } else {
670
+ writeU32(this.db, this.addr + 28, this.db.getStringId(value));
671
+ }
672
+ }
673
+ get assetType() {
674
+ return AssetType.get(this.db, this.addr + 0);
675
+ }
676
+ set assetType(value) {
677
+ AssetType.set(this.db, this.addr + 0, value);
678
+ }
679
+ get contentKey() {
680
+ return readCachedString(this.db, readU32(this.db, this.addr + 20));
681
+ }
682
+ set contentKey(value) {
683
+ writeU32(this.db, this.addr + 20, this.db.getStringId(value));
684
+ }
685
+ get mapKey() {
686
+ return readU32(this.db, this.addr + 32 + 0) === 0 ? null : readCachedString(this.db, readU32(this.db, this.addr + 32));
687
+ }
688
+ set mapKey(value) {
689
+ if (value == null) {
690
+ writeU32(this.db, this.addr + 32 + 0, 0);
691
+ } else {
692
+ writeU32(this.db, this.addr + 32, this.db.getStringId(value));
693
+ }
694
+ }
695
+ get outputHash() {
696
+ return readCachedString(this.db, readU32(this.db, this.addr + 24));
697
+ }
698
+ set outputHash(value) {
699
+ writeU32(this.db, this.addr + 24, this.db.getStringId(value));
700
+ }
701
+ get pipeline() {
702
+ return readU32(this.db, this.addr + 36 + 0) === 0 ? null : readCachedString(this.db, readU32(this.db, this.addr + 36));
703
+ }
704
+ set pipeline(value) {
705
+ if (value == null) {
706
+ writeU32(this.db, this.addr + 36 + 0, 0);
707
+ } else {
708
+ writeU32(this.db, this.addr + 36, this.db.getStringId(value));
709
+ }
710
+ }
711
+ get meta() {
712
+ return readU32(this.db, this.addr + 40 + 0) === 0 ? null : readCachedString(this.db, readU32(this.db, this.addr + 40));
713
+ }
714
+ set meta(value) {
715
+ if (value == null) {
716
+ writeU32(this.db, this.addr + 40 + 0, 0);
717
+ } else {
718
+ writeU32(this.db, this.addr + 40, this.db.getStringId(value));
719
+ }
720
+ }
721
+ get stats() {
722
+ return AssetStats.get(this.db, this.addr + 44);
723
+ }
724
+ set stats(value) {
725
+ AssetStats.set(this.db, this.addr + 44, value);
726
+ }
727
+ get bundleBehavior() {
728
+ return BundleBehavior.get(this.db, this.addr + 96);
729
+ }
730
+ set bundleBehavior(value) {
731
+ BundleBehavior.set(this.db, this.addr + 96, value);
732
+ }
733
+ get flags() {
734
+ return readU32(this.db, this.addr + 52);
735
+ }
736
+ set flags(value) {
737
+ writeU32(this.db, this.addr + 52, value);
738
+ }
739
+ get symbols() {
740
+ return new Vec(this.db, this.addr + 56, 32, Symbol);
741
+ }
742
+ set symbols(value) {
743
+ copy(this.db, value.addr, this.addr + 56, 12);
744
+ }
745
+ get uniqueKey() {
746
+ return readU32(this.db, this.addr + 68 + 0) === 0 ? null : readCachedString(this.db, readU32(this.db, this.addr + 68));
747
+ }
748
+ set uniqueKey(value) {
749
+ if (value == null) {
750
+ writeU32(this.db, this.addr + 68 + 0, 0);
751
+ } else {
752
+ writeU32(this.db, this.addr + 68, this.db.getStringId(value));
753
+ }
754
+ }
755
+ get ast() {
756
+ return readU32(this.db, this.addr + 72 + 0) === 0 ? null : AssetAst.get(this.db, this.addr + 72);
757
+ }
758
+ set ast(value) {
759
+ if (value == null) {
760
+ writeU32(this.db, this.addr + 72 + 0, 0);
761
+ } else {
762
+ AssetAst.set(this.db, this.addr + 72, value);
763
+ }
764
+ }
765
+ }
766
+ exports.Asset = Asset;
767
+ class AssetAst {
768
+ static typeId = 1;
769
+ constructor(db, addr) {
770
+ this.db = db;
771
+ this.addr = addr !== null && addr !== void 0 ? addr : db.alloc(1);
772
+ }
773
+ static get(db, addr) {
774
+ return new AssetAst(db, addr);
775
+ }
776
+ static set(db, addr, value) {
777
+ copy(db, value.addr, addr, 24);
778
+ }
779
+ dealloc() {
780
+ this.db.dealloc(1, this.addr);
781
+ }
782
+ get key() {
783
+ return readCachedString(this.db, readU32(this.db, this.addr + 0));
784
+ }
785
+ set key(value) {
786
+ writeU32(this.db, this.addr + 0, this.db.getStringId(value));
787
+ }
788
+ get plugin() {
789
+ return readCachedString(this.db, readU32(this.db, this.addr + 4));
790
+ }
791
+ set plugin(value) {
792
+ writeU32(this.db, this.addr + 4, this.db.getStringId(value));
793
+ }
794
+ get configPath() {
795
+ return readCachedString(this.db, readU32(this.db, this.addr + 8));
796
+ }
797
+ set configPath(value) {
798
+ writeU32(this.db, this.addr + 8, this.db.getStringId(value));
799
+ }
800
+ get configKeyPath() {
801
+ return readU32(this.db, this.addr + 20 + 0) === 0 ? null : readCachedString(this.db, readU32(this.db, this.addr + 20));
802
+ }
803
+ set configKeyPath(value) {
804
+ if (value == null) {
805
+ writeU32(this.db, this.addr + 20 + 0, 0);
806
+ } else {
807
+ writeU32(this.db, this.addr + 20, this.db.getStringId(value));
808
+ }
809
+ }
810
+ get generator() {
811
+ return readCachedString(this.db, readU32(this.db, this.addr + 12));
812
+ }
813
+ set generator(value) {
814
+ writeU32(this.db, this.addr + 12, this.db.getStringId(value));
815
+ }
816
+ get version() {
817
+ return readCachedString(this.db, readU32(this.db, this.addr + 16));
818
+ }
819
+ set version(value) {
820
+ writeU32(this.db, this.addr + 16, this.db.getStringId(value));
821
+ }
822
+ }
823
+ exports.AssetAst = AssetAst;
824
+ class AssetType {
825
+ static get(db, addr) {
826
+ switch (readU32(db, addr + 0)) {
827
+ case 0:
828
+ return 'js';
829
+ case 1:
830
+ return 'jsx';
831
+ case 2:
832
+ return 'ts';
833
+ case 3:
834
+ return 'tsx';
835
+ case 4:
836
+ return 'css';
837
+ case 5:
838
+ return 'html';
839
+ case 6:
840
+ return readCachedString(db, readU32(db, addr + 4));
841
+ default:
842
+ throw new Error(`Unknown AssetType value: ${readU32(db, addr)}`);
843
+ }
844
+ }
845
+ static set(db, addr, value) {
846
+ let write = writeU32;
847
+ switch (value) {
848
+ case 'js':
849
+ write(db, addr + 0, 0);
850
+ break;
851
+ case 'jsx':
852
+ write(db, addr + 0, 1);
853
+ break;
854
+ case 'ts':
855
+ write(db, addr + 0, 2);
856
+ break;
857
+ case 'tsx':
858
+ write(db, addr + 0, 3);
859
+ break;
860
+ case 'css':
861
+ write(db, addr + 0, 4);
862
+ break;
863
+ case 'html':
864
+ write(db, addr + 0, 5);
865
+ break;
866
+ default:
867
+ write(db, addr + 0, 6);
868
+ writeU32(db, addr + 4, db.getStringId(value));
869
+ break;
870
+ }
871
+ }
872
+ }
873
+ exports.AssetType = AssetType;
874
+ class BundleBehavior {
875
+ static get(db, addr) {
876
+ switch (readU8(db, addr + 0)) {
877
+ case 0:
878
+ return 'none';
879
+ case 1:
880
+ return 'inline';
881
+ case 2:
882
+ return 'isolated';
883
+ default:
884
+ throw new Error(`Unknown BundleBehavior value: ${readU8(db, addr)}`);
885
+ }
886
+ }
887
+ static set(db, addr, value) {
888
+ let write = writeU8;
889
+ switch (value) {
890
+ case 'none':
891
+ write(db, addr + 0, 0);
892
+ break;
893
+ case 'inline':
894
+ write(db, addr + 0, 1);
895
+ break;
896
+ case 'isolated':
897
+ write(db, addr + 0, 2);
898
+ break;
899
+ default:
900
+ throw new Error(`Unknown BundleBehavior value: ${value}`);
901
+ }
902
+ }
903
+ }
904
+ exports.BundleBehavior = BundleBehavior;
905
+ class AssetStats {
906
+ static typeId = 2;
907
+ constructor(db, addr) {
908
+ this.db = db;
909
+ this.addr = addr !== null && addr !== void 0 ? addr : db.alloc(2);
910
+ }
911
+ static get(db, addr) {
912
+ return new AssetStats(db, addr);
913
+ }
914
+ static set(db, addr, value) {
915
+ copy(db, value.addr, addr, 8);
916
+ }
917
+ dealloc() {
918
+ this.db.dealloc(2, this.addr);
919
+ }
920
+ get size() {
921
+ return readU32(this.db, this.addr + 0);
922
+ }
923
+ set size(value) {
924
+ writeU32(this.db, this.addr + 0, value);
925
+ }
926
+ get time() {
927
+ return readU32(this.db, this.addr + 4);
928
+ }
929
+ set time(value) {
930
+ writeU32(this.db, this.addr + 4, value);
931
+ }
932
+ }
933
+ exports.AssetStats = AssetStats;
934
+ const AssetFlags = exports.AssetFlags = {
935
+ IS_SOURCE: 0b1,
936
+ SIDE_EFFECTS: 0b10,
937
+ IS_BUNDLE_SPLITTABLE: 0b100,
938
+ LARGE_BLOB: 0b1000,
939
+ HAS_CJS_EXPORTS: 0b10000,
940
+ STATIC_EXPORTS: 0b100000,
941
+ SHOULD_WRAP: 0b1000000,
942
+ IS_CONSTANT_MODULE: 0b10000000,
943
+ HAS_NODE_REPLACEMENTS: 0b100000000,
944
+ HAS_SYMBOLS: 0b1000000000
945
+ };
946
+ const ExportsCondition = exports.ExportsCondition = {
947
+ IMPORT: 0b1,
948
+ REQUIRE: 0b10,
949
+ MODULE: 0b100,
950
+ STYLE: 0b1000000000000,
951
+ SASS: 0b10000000000000,
952
+ LESS: 0b100000000000000,
953
+ STYLUS: 0b1000000000000000
954
+ };
955
+ class Dependency {
956
+ static typeId = 3;
957
+ constructor(db, addr) {
958
+ this.db = db;
959
+ this.addr = addr !== null && addr !== void 0 ? addr : db.alloc(3);
960
+ }
961
+ static get(db, addr) {
962
+ return new Dependency(db, addr);
963
+ }
964
+ static set(db, addr, value) {
965
+ copy(db, value.addr, addr, 112);
966
+ }
967
+ dealloc() {
968
+ this.db.dealloc(3, this.addr);
969
+ }
970
+ get id() {
971
+ return readU32(this.db, this.addr + 96);
972
+ }
973
+ set id(value) {
974
+ writeU32(this.db, this.addr + 96, value);
975
+ }
976
+ get sourceAssetId() {
977
+ return readU32(this.db, this.addr + 0 + 0) === 0 ? null : readU32(this.db, this.addr + 0);
978
+ }
979
+ set sourceAssetId(value) {
980
+ if (value == null) {
981
+ writeU32(this.db, this.addr + 0 + 0, 0);
982
+ } else {
983
+ writeU32(this.db, this.addr + 0, value);
984
+ }
985
+ }
986
+ get env() {
987
+ return readU32(this.db, this.addr + 100);
988
+ }
989
+ set env(value) {
990
+ writeU32(this.db, this.addr + 100, value);
991
+ }
992
+ get specifier() {
993
+ return readCachedString(this.db, readU32(this.db, this.addr + 104));
994
+ }
995
+ set specifier(value) {
996
+ writeU32(this.db, this.addr + 104, this.db.getStringId(value));
997
+ }
998
+ get specifierType() {
999
+ return SpecifierType.get(this.db, this.addr + 109);
1000
+ }
1001
+ set specifierType(value) {
1002
+ SpecifierType.set(this.db, this.addr + 109, value);
1003
+ }
1004
+ get resolveFrom() {
1005
+ return readU32(this.db, this.addr + 4 + 0) === 0 ? null : readCachedString(this.db, readU32(this.db, this.addr + 4));
1006
+ }
1007
+ set resolveFrom(value) {
1008
+ if (value == null) {
1009
+ writeU32(this.db, this.addr + 4 + 0, 0);
1010
+ } else {
1011
+ writeU32(this.db, this.addr + 4, this.db.getStringId(value));
1012
+ }
1013
+ }
1014
+ get range() {
1015
+ return readU32(this.db, this.addr + 8 + 0) === 0 ? null : readCachedString(this.db, readU32(this.db, this.addr + 8));
1016
+ }
1017
+ set range(value) {
1018
+ if (value == null) {
1019
+ writeU32(this.db, this.addr + 8 + 0, 0);
1020
+ } else {
1021
+ writeU32(this.db, this.addr + 8, this.db.getStringId(value));
1022
+ }
1023
+ }
1024
+ get priority() {
1025
+ return Priority.get(this.db, this.addr + 110);
1026
+ }
1027
+ set priority(value) {
1028
+ Priority.set(this.db, this.addr + 110, value);
1029
+ }
1030
+ get bundleBehavior() {
1031
+ return BundleBehavior.get(this.db, this.addr + 111);
1032
+ }
1033
+ set bundleBehavior(value) {
1034
+ BundleBehavior.set(this.db, this.addr + 111, value);
1035
+ }
1036
+ get flags() {
1037
+ return readU8(this.db, this.addr + 108);
1038
+ }
1039
+ set flags(value) {
1040
+ writeU8(this.db, this.addr + 108, value);
1041
+ }
1042
+ get loc() {
1043
+ return readU32(this.db, this.addr + 12 + 0) === 0 ? null : SourceLocation.get(this.db, this.addr + 12);
1044
+ }
1045
+ set loc(value) {
1046
+ if (value == null) {
1047
+ writeU32(this.db, this.addr + 12 + 0, 0);
1048
+ } else {
1049
+ SourceLocation.set(this.db, this.addr + 12, value);
1050
+ }
1051
+ }
1052
+ get placeholder() {
1053
+ return readU32(this.db, this.addr + 32 + 0) === 0 ? null : readCachedString(this.db, readU32(this.db, this.addr + 32));
1054
+ }
1055
+ set placeholder(value) {
1056
+ if (value == null) {
1057
+ writeU32(this.db, this.addr + 32 + 0, 0);
1058
+ } else {
1059
+ writeU32(this.db, this.addr + 32, this.db.getStringId(value));
1060
+ }
1061
+ }
1062
+ get target() {
1063
+ return readU32(this.db, this.addr + 36 + 0) === 0 ? null : readU32(this.db, this.addr + 36);
1064
+ }
1065
+ set target(value) {
1066
+ if (value == null) {
1067
+ writeU32(this.db, this.addr + 36 + 0, 0);
1068
+ } else {
1069
+ writeU32(this.db, this.addr + 36, value);
1070
+ }
1071
+ }
1072
+ get symbols() {
1073
+ return new Vec(this.db, this.addr + 40, 32, Symbol);
1074
+ }
1075
+ set symbols(value) {
1076
+ copy(this.db, value.addr, this.addr + 40, 12);
1077
+ }
1078
+ get promiseSymbol() {
1079
+ return readU32(this.db, this.addr + 52 + 0) === 0 ? null : readCachedString(this.db, readU32(this.db, this.addr + 52));
1080
+ }
1081
+ set promiseSymbol(value) {
1082
+ if (value == null) {
1083
+ writeU32(this.db, this.addr + 52 + 0, 0);
1084
+ } else {
1085
+ writeU32(this.db, this.addr + 52, this.db.getStringId(value));
1086
+ }
1087
+ }
1088
+ get importAttributes() {
1089
+ return new Vec(this.db, this.addr + 56, 8, ImportAttribute);
1090
+ }
1091
+ set importAttributes(value) {
1092
+ copy(this.db, value.addr, this.addr + 56, 12);
1093
+ }
1094
+ get pipeline() {
1095
+ return readU32(this.db, this.addr + 68 + 0) === 0 ? null : readCachedString(this.db, readU32(this.db, this.addr + 68));
1096
+ }
1097
+ set pipeline(value) {
1098
+ if (value == null) {
1099
+ writeU32(this.db, this.addr + 68 + 0, 0);
1100
+ } else {
1101
+ writeU32(this.db, this.addr + 68, this.db.getStringId(value));
1102
+ }
1103
+ }
1104
+ get meta() {
1105
+ return readU32(this.db, this.addr + 72 + 0) === 0 ? null : readCachedString(this.db, readU32(this.db, this.addr + 72));
1106
+ }
1107
+ set meta(value) {
1108
+ if (value == null) {
1109
+ writeU32(this.db, this.addr + 72 + 0, 0);
1110
+ } else {
1111
+ writeU32(this.db, this.addr + 72, this.db.getStringId(value));
1112
+ }
1113
+ }
1114
+ get resolverMeta() {
1115
+ return readU32(this.db, this.addr + 76 + 0) === 0 ? null : readCachedString(this.db, readU32(this.db, this.addr + 76));
1116
+ }
1117
+ set resolverMeta(value) {
1118
+ if (value == null) {
1119
+ writeU32(this.db, this.addr + 76 + 0, 0);
1120
+ } else {
1121
+ writeU32(this.db, this.addr + 76, this.db.getStringId(value));
1122
+ }
1123
+ }
1124
+ get packageConditions() {
1125
+ return readU32(this.db, this.addr + 80);
1126
+ }
1127
+ set packageConditions(value) {
1128
+ writeU32(this.db, this.addr + 80, value);
1129
+ }
1130
+ get customPackageConditions() {
1131
+ return new Vec(this.db, this.addr + 84, 4, InternedString);
1132
+ }
1133
+ set customPackageConditions(value) {
1134
+ copy(this.db, value.addr, this.addr + 84, 12);
1135
+ }
1136
+ }
1137
+ exports.Dependency = Dependency;
1138
+ class ImportAttribute {
1139
+ static typeId = 6;
1140
+ constructor(db, addr) {
1141
+ this.db = db;
1142
+ this.addr = addr !== null && addr !== void 0 ? addr : db.alloc(6);
1143
+ }
1144
+ static get(db, addr) {
1145
+ return new ImportAttribute(db, addr);
1146
+ }
1147
+ static set(db, addr, value) {
1148
+ copy(db, value.addr, addr, 8);
1149
+ }
1150
+ dealloc() {
1151
+ this.db.dealloc(6, this.addr);
1152
+ }
1153
+ get key() {
1154
+ return readCachedString(this.db, readU32(this.db, this.addr + 0));
1155
+ }
1156
+ set key(value) {
1157
+ writeU32(this.db, this.addr + 0, this.db.getStringId(value));
1158
+ }
1159
+ get value() {
1160
+ return !!readU8(this.db, this.addr + 4);
1161
+ }
1162
+ set value(value) {
1163
+ writeU8(this.db, this.addr + 4, value ? 1 : 0);
1164
+ }
1165
+ }
1166
+ exports.ImportAttribute = ImportAttribute;
1167
+ const DependencyFlags = exports.DependencyFlags = {
1168
+ ENTRY: 0b1,
1169
+ OPTIONAL: 0b10,
1170
+ NEEDS_STABLE_NAME: 0b100,
1171
+ SHOULD_WRAP: 0b1000,
1172
+ IS_ESM: 0b10000,
1173
+ IS_WEBWORKER: 0b100000,
1174
+ HAS_SYMBOLS: 0b1000000
1175
+ };
1176
+ class SpecifierType {
1177
+ static get(db, addr) {
1178
+ switch (readU8(db, addr + 0)) {
1179
+ case 0:
1180
+ return 'esm';
1181
+ case 1:
1182
+ return 'commonjs';
1183
+ case 2:
1184
+ return 'url';
1185
+ case 3:
1186
+ return 'custom';
1187
+ default:
1188
+ throw new Error(`Unknown SpecifierType value: ${readU8(db, addr)}`);
1189
+ }
1190
+ }
1191
+ static set(db, addr, value) {
1192
+ let write = writeU8;
1193
+ switch (value) {
1194
+ case 'esm':
1195
+ write(db, addr + 0, 0);
1196
+ break;
1197
+ case 'commonjs':
1198
+ write(db, addr + 0, 1);
1199
+ break;
1200
+ case 'url':
1201
+ write(db, addr + 0, 2);
1202
+ break;
1203
+ case 'custom':
1204
+ write(db, addr + 0, 3);
1205
+ break;
1206
+ default:
1207
+ throw new Error(`Unknown SpecifierType value: ${value}`);
1208
+ }
1209
+ }
1210
+ }
1211
+ exports.SpecifierType = SpecifierType;
1212
+ class Priority {
1213
+ static get(db, addr) {
1214
+ switch (readU8(db, addr + 0)) {
1215
+ case 0:
1216
+ return 'sync';
1217
+ case 1:
1218
+ return 'parallel';
1219
+ case 2:
1220
+ return 'lazy';
1221
+ default:
1222
+ throw new Error(`Unknown Priority value: ${readU8(db, addr)}`);
1223
+ }
1224
+ }
1225
+ static set(db, addr, value) {
1226
+ let write = writeU8;
1227
+ switch (value) {
1228
+ case 'sync':
1229
+ write(db, addr + 0, 0);
1230
+ break;
1231
+ case 'parallel':
1232
+ write(db, addr + 0, 1);
1233
+ break;
1234
+ case 'lazy':
1235
+ write(db, addr + 0, 2);
1236
+ break;
1237
+ default:
1238
+ throw new Error(`Unknown Priority value: ${value}`);
1239
+ }
1240
+ }
1241
+ }
1242
+ exports.Priority = Priority;
1243
+ class Symbol {
1244
+ static typeId = 9;
1245
+ constructor(db, addr) {
1246
+ this.db = db;
1247
+ this.addr = addr !== null && addr !== void 0 ? addr : db.alloc(9);
1248
+ }
1249
+ static get(db, addr) {
1250
+ return new Symbol(db, addr);
1251
+ }
1252
+ static set(db, addr, value) {
1253
+ copy(db, value.addr, addr, 32);
1254
+ }
1255
+ dealloc() {
1256
+ this.db.dealloc(9, this.addr);
1257
+ }
1258
+ get exported() {
1259
+ return readU32(this.db, this.addr + 0);
1260
+ }
1261
+ set exported(value) {
1262
+ writeU32(this.db, this.addr + 0, value);
1263
+ }
1264
+ get local() {
1265
+ return readU32(this.db, this.addr + 4);
1266
+ }
1267
+ set local(value) {
1268
+ writeU32(this.db, this.addr + 4, value);
1269
+ }
1270
+ get loc() {
1271
+ return readU32(this.db, this.addr + 8 + 0) === 0 ? null : SourceLocation.get(this.db, this.addr + 8);
1272
+ }
1273
+ set loc(value) {
1274
+ if (value == null) {
1275
+ writeU32(this.db, this.addr + 8 + 0, 0);
1276
+ } else {
1277
+ SourceLocation.set(this.db, this.addr + 8, value);
1278
+ }
1279
+ }
1280
+ get flags() {
1281
+ return readU8(this.db, this.addr + 28);
1282
+ }
1283
+ set flags(value) {
1284
+ writeU8(this.db, this.addr + 28, value);
1285
+ }
1286
+ }
1287
+ exports.Symbol = Symbol;
1288
+ const SymbolFlags = exports.SymbolFlags = {
1289
+ IS_WEAK: 0b1,
1290
+ IS_ESM: 0b10
1291
+ };
1292
+ class InternedString {
1293
+ static typeId = 12;
1294
+ static get(db, addr) {
1295
+ return readCachedString(db, readU32(db, addr));
1296
+ }
1297
+ static set(db, addr, value) {
1298
+ writeU32(db, addr, db.getStringId(value));
1299
+ }
1300
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parcel/rust",
3
- "version": "2.12.1-dev.3262+8b1749694",
3
+ "version": "2.12.1-dev.3264+5b2eaaf7b",
4
4
  "license": "MIT",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -27,6 +27,7 @@
27
27
  "index.d.ts",
28
28
  "index.js",
29
29
  "index.js.flow",
30
+ "lib",
30
31
  "*.node",
31
32
  "*.wasm"
32
33
  ],
@@ -41,5 +42,5 @@
41
42
  "wasm:build": "cargo build -p parcel-node-bindings --target wasm32-unknown-unknown && cp ../../../target/wasm32-unknown-unknown/debug/parcel_node_bindings.wasm .",
42
43
  "wasm:build-release": "CARGO_PROFILE_RELEASE_LTO=true cargo build -p parcel-node-bindings --target wasm32-unknown-unknown --release && wasm-opt --strip-debug -O ../../../target/wasm32-unknown-unknown/release/parcel_node_bindings.wasm -o parcel_node_bindings.wasm"
43
44
  },
44
- "gitHead": "8b1749694c0ef79cefdacad40bb90c869a93993a"
45
+ "gitHead": "5b2eaaf7bcb1a4eceffcb265a7841caf441167cf"
45
46
  }