[rust] Fixture tests for parsing and lowering
Adds a new `fixtures` crate intended for running end-to-end tests of the compiler. As we expand the compiler this will eventually match our JS fixture setup, where we have .js files as input and produce memoized JS output. For now, this does the following: * Parses with SWC (omg this was painful to setup) * Runs SWC's name resolution, which annotates the SWC ast in-place * Convert the SWC ast into our `estree` representation * Convert `estree` into `hir` for each top-level function declaration in the input program * Print the Rust `Debug` view of the resulting HIR As a next step i'll add a pretty-printer for the HIR to roughly match what we have in JS.
Joe Savona committed
Jul 6, 2023 at 09:24 UTC
d3b9948b5e26b8e28e6f079acca7e435672fa4e8
19 files changed
+2168
-147
compiler/forget/Cargo.lock
+1439
-128
@@ -12,6 +12,32 @@ dependencies = [
12
"regex",
13
]
14
15
+[[package]]
16
+name = "addr2line"
17
+version = "0.20.0"
18
+source = "registry+https://github.com/rust-lang/crates.io-index"
19
+checksum = "f4fa78e18c64fce05e902adecd7a5eed15a5e0a3439f7b0e169f0252214865e3"
20
+dependencies = [
21
+ "gimli",
22
+]
23
+
24
+[[package]]
25
+name = "adler"
26
+version = "1.0.2"
27
+source = "registry+https://github.com/rust-lang/crates.io-index"
28
+checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
29
+
30
+[[package]]
31
+name = "ahash"
32
+version = "0.7.6"
33
+source = "registry+https://github.com/rust-lang/crates.io-index"
34
+checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47"
35
+dependencies = [
36
+ "getrandom",
37
+ "once_cell",
38
+ "version_check",
39
+]
40
+
41
[[package]]
42
name = "ahash"
43
version = "0.8.3"
@@ -21,6 +47,7 @@ dependencies = [
47
"cfg-if",
48
"getrandom",
49
"once_cell",
50
+ "serde",
51
"version_check",
52
]
53
@@ -42,12 +69,33 @@ dependencies = [
69
"memchr",
70
]
71
72
+[[package]]
73
+name = "android-tzdata"
74
+version = "0.1.1"
75
+source = "registry+https://github.com/rust-lang/crates.io-index"
76
+checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0"
77
+
78
+[[package]]
79
+name = "android_system_properties"
80
+version = "0.1.5"
81
+source = "registry+https://github.com/rust-lang/crates.io-index"
82
+checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311"
83
+dependencies = [
84
+ "libc",
85
+]
86
+
87
[[package]]
88
name = "anyhow"
89
version = "1.0.71"
90
source = "registry+https://github.com/rust-lang/crates.io-index"
91
checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8"
92
93
+[[package]]
94
+name = "arrayvec"
95
+version = "0.7.4"
96
+source = "registry+https://github.com/rust-lang/crates.io-index"
97
+checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711"
98
+
99
[[package]]
100
name = "ast_node"
101
version = "0.9.5"
@@ -58,7 +106,7 @@ dependencies = [
106
"proc-macro2",
107
"quote",
108
"swc_macros_common",
61
- "syn 2.0.18",
109
+ "syn 2.0.23",
110
]
111
112
[[package]]
@@ -72,12 +120,45 @@ dependencies = [
120
"winapi",
121
]
122
123
+[[package]]
124
+name = "auto_impl"
125
+version = "1.1.0"
126
+source = "registry+https://github.com/rust-lang/crates.io-index"
127
+checksum = "fee3da8ef1276b0bee5dd1c7258010d8fffd31801447323115a25560e1327b89"
128
+dependencies = [
129
+ "proc-macro-error",
130
+ "proc-macro2",
131
+ "quote",
132
+ "syn 1.0.109",
133
+]
134
+
135
[[package]]
136
name = "autocfg"
137
version = "1.1.0"
138
source = "registry+https://github.com/rust-lang/crates.io-index"
139
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
140
141
+[[package]]
142
+name = "backtrace"
143
+version = "0.3.68"
144
+source = "registry+https://github.com/rust-lang/crates.io-index"
145
+checksum = "4319208da049c43661739c5fade2ba182f09d1dc2299b32298d3a31692b17e12"
146
+dependencies = [
147
+ "addr2line",
148
+ "cc",
149
+ "cfg-if",
150
+ "libc",
151
+ "miniz_oxide",
152
+ "object",
153
+ "rustc-demangle",
154
+]
155
+
156
+[[package]]
157
+name = "base64"
158
+version = "0.13.1"
159
+source = "registry+https://github.com/rust-lang/crates.io-index"
160
+checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8"
161
+
162
[[package]]
163
name = "better_scoped_tls"
164
version = "0.1.1"
@@ -95,9 +176,43 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
176
177
[[package]]
178
name = "bitflags"
98
-version = "2.3.2"
179
+version = "2.3.3"
180
+source = "registry+https://github.com/rust-lang/crates.io-index"
181
+checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42"
182
+
183
+[[package]]
184
+name = "block-buffer"
185
+version = "0.10.4"
186
+source = "registry+https://github.com/rust-lang/crates.io-index"
187
+checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71"
188
+dependencies = [
189
+ "generic-array",
190
+]
191
+
192
+[[package]]
193
+name = "browserslist-rs"
194
+version = "0.12.4"
195
source = "registry+https://github.com/rust-lang/crates.io-index"
100
-checksum = "6dbe3c979c178231552ecba20214a8272df4e09f232a87aef4320cf06539aded"
196
+checksum = "d9bda9b4595376bf255f68dafb5dcc5b0e2842b38dc2a7b52c4e0bfe9fd1c651"
197
+dependencies = [
198
+ "ahash 0.8.3",
199
+ "anyhow",
200
+ "chrono",
201
+ "either",
202
+ "getrandom",
203
+ "itertools",
204
+ "js-sys",
205
+ "nom",
206
+ "once_cell",
207
+ "quote",
208
+ "serde",
209
+ "serde-wasm-bindgen",
210
+ "serde_json",
211
+ "string_cache",
212
+ "string_cache_codegen",
213
+ "thiserror",
214
+ "wasm-bindgen",
215
+]
216
217
[[package]]
218
name = "bstr"
@@ -137,6 +252,21 @@ version = "1.0.0"
252
source = "registry+https://github.com/rust-lang/crates.io-index"
253
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
254
255
+[[package]]
256
+name = "chrono"
257
+version = "0.4.26"
258
+source = "registry+https://github.com/rust-lang/crates.io-index"
259
+checksum = "ec837a71355b28f6556dbd569b37b3f363091c0bd4b2e735674521b4c5fd9bc5"
260
+dependencies = [
261
+ "android-tzdata",
262
+ "iana-time-zone",
263
+ "js-sys",
264
+ "num-traits",
265
+ "time 0.1.45",
266
+ "wasm-bindgen",
267
+ "winapi",
268
+]
269
+
270
[[package]]
271
name = "console"
272
version = "0.15.7"
@@ -149,12 +279,103 @@ dependencies = [
279
"windows-sys",
280
]
281
282
+[[package]]
283
+name = "core-foundation-sys"
284
+version = "0.8.4"
285
+source = "registry+https://github.com/rust-lang/crates.io-index"
286
+checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa"
287
+
288
+[[package]]
289
+name = "cpufeatures"
290
+version = "0.2.8"
291
+source = "registry+https://github.com/rust-lang/crates.io-index"
292
+checksum = "03e69e28e9f7f77debdedbaafa2866e1de9ba56df55a8bd7cfc724c25a09987c"
293
+dependencies = [
294
+ "libc",
295
+]
296
+
297
+[[package]]
298
+name = "crossbeam-channel"
299
+version = "0.5.8"
300
+source = "registry+https://github.com/rust-lang/crates.io-index"
301
+checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200"
302
+dependencies = [
303
+ "cfg-if",
304
+ "crossbeam-utils",
305
+]
306
+
307
+[[package]]
308
+name = "crossbeam-deque"
309
+version = "0.8.3"
310
+source = "registry+https://github.com/rust-lang/crates.io-index"
311
+checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef"
312
+dependencies = [
313
+ "cfg-if",
314
+ "crossbeam-epoch",
315
+ "crossbeam-utils",
316
+]
317
+
318
+[[package]]
319
+name = "crossbeam-epoch"
320
+version = "0.9.15"
321
+source = "registry+https://github.com/rust-lang/crates.io-index"
322
+checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7"
323
+dependencies = [
324
+ "autocfg",
325
+ "cfg-if",
326
+ "crossbeam-utils",
327
+ "memoffset",
328
+ "scopeguard",
329
+]
330
+
331
+[[package]]
332
+name = "crossbeam-utils"
333
+version = "0.8.16"
334
+source = "registry+https://github.com/rust-lang/crates.io-index"
335
+checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294"
336
+dependencies = [
337
+ "cfg-if",
338
+]
339
+
340
+[[package]]
341
+name = "crypto-common"
342
+version = "0.1.6"
343
+source = "registry+https://github.com/rust-lang/crates.io-index"
344
+checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3"
345
+dependencies = [
346
+ "generic-array",
347
+ "typenum",
348
+]
349
+
350
+[[package]]
351
+name = "dashmap"
352
+version = "5.4.0"
353
+source = "registry+https://github.com/rust-lang/crates.io-index"
354
+checksum = "907076dfda823b0b36d2a1bb5f90c96660a5bbcd7729e10727f07858f22c4edc"
355
+dependencies = [
356
+ "cfg-if",
357
+ "hashbrown 0.12.3",
358
+ "lock_api",
359
+ "once_cell",
360
+ "parking_lot_core",
361
+]
362
+
363
[[package]]
364
name = "data-encoding"
365
version = "2.4.0"
366
source = "registry+https://github.com/rust-lang/crates.io-index"
367
checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308"
368
369
+[[package]]
370
+name = "digest"
371
+version = "0.10.7"
372
+source = "registry+https://github.com/rust-lang/crates.io-index"
373
+checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
374
+dependencies = [
375
+ "block-buffer",
376
+ "crypto-common",
377
+]
378
+
379
[[package]]
380
name = "either"
381
version = "1.8.1"
@@ -193,7 +414,7 @@ checksum = "eecf8589574ce9b895052fa12d69af7a233f99e6107f5cb8dd1044f2a17bfdcb"
414
dependencies = [
415
"proc-macro2",
416
"quote",
196
- "syn 2.0.18",
417
+ "syn 2.0.23",
418
]
419
420
[[package]]
@@ -219,8 +440,26 @@ name = "estree-swc"
440
version = "0.1.0"
441
dependencies = [
442
"estree",
222
- "swc_common",
223
- "swc_ecma_ast",
443
+ "swc",
444
+ "swc_core 0.79.9",
445
+]
446
+
447
+[[package]]
448
+name = "fixedbitset"
449
+version = "0.4.2"
450
+source = "registry+https://github.com/rust-lang/crates.io-index"
451
+checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80"
452
+
453
+[[package]]
454
+name = "fixtures"
455
+version = "0.1.0"
456
+dependencies = [
457
+ "build-hir",
458
+ "bumpalo",
459
+ "estree",
460
+ "estree-swc",
461
+ "hir",
462
+ "insta",
463
]
464
465
[[package]]
@@ -247,7 +486,17 @@ dependencies = [
486
"pmutil",
487
"proc-macro2",
488
"swc_macros_common",
250
- "syn 2.0.18",
489
+ "syn 2.0.23",
490
+]
491
+
492
+[[package]]
493
+name = "generic-array"
494
+version = "0.14.7"
495
+source = "registry+https://github.com/rust-lang/crates.io-index"
496
+checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a"
497
+dependencies = [
498
+ "typenum",
499
+ "version_check",
500
]
501
502
[[package]]
@@ -257,8 +506,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
506
checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427"
507
dependencies = [
508
"cfg-if",
509
+ "js-sys",
510
"libc",
261
- "wasi",
511
+ "wasi 0.11.0+wasi-snapshot-preview1",
512
+ "wasm-bindgen",
513
]
514
515
[[package]]
@@ -273,6 +524,12 @@ dependencies = [
524
"syn 1.0.109",
525
]
526
527
+[[package]]
528
+name = "gimli"
529
+version = "0.27.3"
530
+source = "registry+https://github.com/rust-lang/crates.io-index"
531
+checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e"
532
+
533
[[package]]
534
name = "globset"
535
version = "0.4.10"
@@ -291,6 +548,18 @@ name = "hashbrown"
548
version = "0.12.3"
549
source = "registry+https://github.com/rust-lang/crates.io-index"
550
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
551
+dependencies = [
552
+ "ahash 0.7.6",
553
+]
554
+
555
+[[package]]
556
+name = "hashbrown"
557
+version = "0.13.2"
558
+source = "registry+https://github.com/rust-lang/crates.io-index"
559
+checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e"
560
+dependencies = [
561
+ "ahash 0.8.3",
562
+]
563
564
[[package]]
565
name = "hashbrown"
@@ -309,12 +578,9 @@ dependencies = [
578
579
[[package]]
580
name = "hermit-abi"
312
-version = "0.2.6"
581
+version = "0.3.2"
582
source = "registry+https://github.com/rust-lang/crates.io-index"
314
-checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7"
315
-dependencies = [
316
- "libc",
317
-]
583
+checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b"
584
585
[[package]]
586
name = "hir"
@@ -325,6 +591,29 @@ dependencies = [
591
"serde",
592
]
593
594
+[[package]]
595
+name = "iana-time-zone"
596
+version = "0.1.57"
597
+source = "registry+https://github.com/rust-lang/crates.io-index"
598
+checksum = "2fad5b825842d2b38bd206f3e81d6957625fd7f0a361e345c30e01a0ae2dd613"
599
+dependencies = [
600
+ "android_system_properties",
601
+ "core-foundation-sys",
602
+ "iana-time-zone-haiku",
603
+ "js-sys",
604
+ "wasm-bindgen",
605
+ "windows",
606
+]
607
+
608
+[[package]]
609
+name = "iana-time-zone-haiku"
610
+version = "0.1.2"
611
+source = "registry+https://github.com/rust-lang/crates.io-index"
612
+checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f"
613
+dependencies = [
614
+ "cc",
615
+]
616
+
617
[[package]]
618
name = "idna"
619
version = "0.4.0"
@@ -349,6 +638,7 @@ checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99"
638
dependencies = [
639
"autocfg",
640
"hashbrown 0.12.3",
641
+ "serde",
642
]
643
644
[[package]]
@@ -386,14 +676,47 @@ dependencies = [
676
"pmutil",
677
"proc-macro2",
678
"quote",
389
- "syn 2.0.18",
679
+ "syn 2.0.23",
680
+]
681
+
682
+[[package]]
683
+name = "is_ci"
684
+version = "1.1.1"
685
+source = "registry+https://github.com/rust-lang/crates.io-index"
686
+checksum = "616cde7c720bb2bb5824a224687d8f77bfd38922027f01d825cd7453be5099fb"
687
+
688
+[[package]]
689
+name = "itertools"
690
+version = "0.10.5"
691
+source = "registry+https://github.com/rust-lang/crates.io-index"
692
+checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473"
693
+dependencies = [
694
+ "either",
695
]
696
697
[[package]]
698
name = "itoa"
394
-version = "1.0.6"
699
+version = "1.0.8"
700
+source = "registry+https://github.com/rust-lang/crates.io-index"
701
+checksum = "62b02a5381cc465bd3041d84623d0fa3b66738b52b8e2fc3bab8ad63ab032f4a"
702
+
703
+[[package]]
704
+name = "js-sys"
705
+version = "0.3.64"
706
+source = "registry+https://github.com/rust-lang/crates.io-index"
707
+checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a"
708
+dependencies = [
709
+ "wasm-bindgen",
710
+]
711
+
712
+[[package]]
713
+name = "jsonc-parser"
714
+version = "0.21.1"
715
source = "registry+https://github.com/rust-lang/crates.io-index"
396
-checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6"
716
+checksum = "7b56a20e76235284255a09fcd1f45cf55d3c524ea657ebd3854735925c57743d"
717
+dependencies = [
718
+ "serde_json",
719
+]
720
721
[[package]]
722
name = "lazy_static"
@@ -476,9 +799,9 @@ dependencies = [
799
800
[[package]]
801
name = "libc"
479
-version = "0.2.146"
802
+version = "0.2.147"
803
source = "registry+https://github.com/rust-lang/crates.io-index"
481
-checksum = "f92be4933c13fd498862a9e02a3055f8a8d9c039ce33db97306fd5a6caa7f29b"
804
+checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3"
805
806
[[package]]
807
name = "linked-hash-map"
@@ -503,69 +826,167 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
826
checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4"
827
828
[[package]]
506
-name = "memchr"
507
-version = "2.5.0"
829
+name = "lru"
830
+version = "0.10.1"
831
source = "registry+https://github.com/rust-lang/crates.io-index"
509
-checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
832
+checksum = "718e8fae447df0c7e1ba7f5189829e63fd536945c8988d61444c19039f16b670"
833
+dependencies = [
834
+ "hashbrown 0.13.2",
835
+]
836
837
[[package]]
512
-name = "new_debug_unreachable"
513
-version = "1.0.4"
838
+name = "memchr"
839
+version = "2.5.0"
840
source = "registry+https://github.com/rust-lang/crates.io-index"
515
-checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54"
841
+checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
842
843
[[package]]
518
-name = "num-bigint"
519
-version = "0.4.3"
844
+name = "memoffset"
845
+version = "0.9.0"
846
source = "registry+https://github.com/rust-lang/crates.io-index"
521
-checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f"
847
+checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c"
848
dependencies = [
849
"autocfg",
524
- "num-integer",
525
- "num-traits",
526
- "serde",
850
]
851
852
[[package]]
530
-name = "num-integer"
531
-version = "0.1.45"
853
+name = "miette"
854
+version = "4.7.1"
855
source = "registry+https://github.com/rust-lang/crates.io-index"
533
-checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9"
856
+checksum = "1c90329e44f9208b55f45711f9558cec15d7ef8295cc65ecd6d4188ae8edc58c"
857
dependencies = [
535
- "autocfg",
536
- "num-traits",
858
+ "atty",
859
+ "backtrace",
860
+ "miette-derive",
861
+ "once_cell",
862
+ "owo-colors",
863
+ "supports-color",
864
+ "supports-hyperlinks",
865
+ "supports-unicode",
866
+ "terminal_size",
867
+ "textwrap",
868
+ "thiserror",
869
+ "unicode-width",
870
]
871
872
[[package]]
540
-name = "num-traits"
541
-version = "0.2.15"
873
+name = "miette-derive"
874
+version = "4.7.1"
875
source = "registry+https://github.com/rust-lang/crates.io-index"
543
-checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd"
876
+checksum = "6b5bc45b761bcf1b5e6e6c4128cd93b84c218721a8d9b894aa0aff4ed180174c"
877
dependencies = [
545
- "autocfg",
878
+ "proc-macro2",
879
+ "quote",
880
+ "syn 1.0.109",
881
]
882
883
[[package]]
549
-name = "num_cpus"
550
-version = "1.15.0"
884
+name = "minimal-lexical"
885
+version = "0.2.1"
886
+source = "registry+https://github.com/rust-lang/crates.io-index"
887
+checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
888
+
889
+[[package]]
890
+name = "miniz_oxide"
891
+version = "0.7.1"
892
source = "registry+https://github.com/rust-lang/crates.io-index"
552
-checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b"
893
+checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7"
894
dependencies = [
554
- "hermit-abi 0.2.6",
555
- "libc",
895
+ "adler",
896
]
897
898
[[package]]
559
-name = "once_cell"
560
-version = "1.18.0"
899
+name = "new_debug_unreachable"
900
+version = "1.0.4"
901
source = "registry+https://github.com/rust-lang/crates.io-index"
562
-checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d"
902
+checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54"
903
904
[[package]]
565
-name = "parking_lot"
566
-version = "0.12.1"
905
+name = "nom"
906
+version = "7.1.3"
907
source = "registry+https://github.com/rust-lang/crates.io-index"
568
-checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f"
908
+checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
909
+dependencies = [
910
+ "memchr",
911
+ "minimal-lexical",
912
+]
913
+
914
+[[package]]
915
+name = "normpath"
916
+version = "0.2.0"
917
+source = "registry+https://github.com/rust-lang/crates.io-index"
918
+checksum = "2a9da8c9922c35a1033d76f7272dfc2e7ee20392083d75aeea6ced23c6266578"
919
+dependencies = [
920
+ "winapi",
921
+]
922
+
923
+[[package]]
924
+name = "num-bigint"
925
+version = "0.4.3"
926
+source = "registry+https://github.com/rust-lang/crates.io-index"
927
+checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f"
928
+dependencies = [
929
+ "autocfg",
930
+ "num-integer",
931
+ "num-traits",
932
+ "serde",
933
+]
934
+
935
+[[package]]
936
+name = "num-integer"
937
+version = "0.1.45"
938
+source = "registry+https://github.com/rust-lang/crates.io-index"
939
+checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9"
940
+dependencies = [
941
+ "autocfg",
942
+ "num-traits",
943
+]
944
+
945
+[[package]]
946
+name = "num-traits"
947
+version = "0.2.15"
948
+source = "registry+https://github.com/rust-lang/crates.io-index"
949
+checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd"
950
+dependencies = [
951
+ "autocfg",
952
+]
953
+
954
+[[package]]
955
+name = "num_cpus"
956
+version = "1.16.0"
957
+source = "registry+https://github.com/rust-lang/crates.io-index"
958
+checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43"
959
+dependencies = [
960
+ "hermit-abi 0.3.2",
961
+ "libc",
962
+]
963
+
964
+[[package]]
965
+name = "object"
966
+version = "0.31.1"
967
+source = "registry+https://github.com/rust-lang/crates.io-index"
968
+checksum = "8bda667d9f2b5051b8833f59f3bf748b28ef54f850f4fcb389a252aa383866d1"
969
+dependencies = [
970
+ "memchr",
971
+]
972
+
973
+[[package]]
974
+name = "once_cell"
975
+version = "1.18.0"
976
+source = "registry+https://github.com/rust-lang/crates.io-index"
977
+checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d"
978
+
979
+[[package]]
980
+name = "owo-colors"
981
+version = "3.5.0"
982
+source = "registry+https://github.com/rust-lang/crates.io-index"
983
+checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f"
984
+
985
+[[package]]
986
+name = "parking_lot"
987
+version = "0.12.1"
988
+source = "registry+https://github.com/rust-lang/crates.io-index"
989
+checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f"
990
dependencies = [
991
"lock_api",
992
"parking_lot_core",
@@ -581,15 +1002,37 @@ dependencies = [
1002
"libc",
1003
"redox_syscall",
1004
"smallvec",
584
- "windows-targets 0.48.0",
1005
+ "windows-targets 0.48.1",
1006
]
1007
1008
+[[package]]
1009
+name = "path-clean"
1010
+version = "0.1.0"
1011
+source = "registry+https://github.com/rust-lang/crates.io-index"
1012
+checksum = "ecba01bf2678719532c5e3059e0b5f0811273d94b397088b82e3bd0a78c78fdd"
1013
+
1014
+[[package]]
1015
+name = "pathdiff"
1016
+version = "0.2.1"
1017
+source = "registry+https://github.com/rust-lang/crates.io-index"
1018
+checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd"
1019
+
1020
[[package]]
1021
name = "percent-encoding"
1022
version = "2.3.0"
1023
source = "registry+https://github.com/rust-lang/crates.io-index"
1024
checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94"
1025
1026
+[[package]]
1027
+name = "petgraph"
1028
+version = "0.6.3"
1029
+source = "registry+https://github.com/rust-lang/crates.io-index"
1030
+checksum = "4dd7d28ee937e54fe3080c91faa1c3a46c06de6252988a7f4592ba2310ef22a4"
1031
+dependencies = [
1032
+ "fixedbitset",
1033
+ "indexmap 1.9.3",
1034
+]
1035
+
1036
[[package]]
1037
name = "phf"
1038
version = "0.10.1"
@@ -636,9 +1079,9 @@ dependencies = [
1079
1080
[[package]]
1081
name = "pin-project-lite"
639
-version = "0.2.9"
1082
+version = "0.2.10"
1083
source = "registry+https://github.com/rust-lang/crates.io-index"
641
-checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116"
1084
+checksum = "4c40d25201921e5ff0c862a505c6557ea88568a4e3ace775ab55e93f2f4f9d57"
1085
1086
[[package]]
1087
name = "pmutil"
@@ -648,7 +1091,7 @@ checksum = "52a40bc70c2c58040d2d8b167ba9a5ff59fc9dab7ad44771cfde3dcfde7a09c6"
1091
dependencies = [
1092
"proc-macro2",
1093
"quote",
651
- "syn 2.0.18",
1094
+ "syn 2.0.23",
1095
]
1096
1097
[[package]]
@@ -663,6 +1106,24 @@ version = "0.1.1"
1106
source = "registry+https://github.com/rust-lang/crates.io-index"
1107
checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c"
1108
1109
+[[package]]
1110
+name = "preset_env_base"
1111
+version = "0.4.5"
1112
+source = "registry+https://github.com/rust-lang/crates.io-index"
1113
+checksum = "ae83c5857727636a1f2c7188632c8a57986d2f1d2e2cf45f2642f5856c5b8e85"
1114
+dependencies = [
1115
+ "ahash 0.8.3",
1116
+ "anyhow",
1117
+ "browserslist-rs",
1118
+ "dashmap",
1119
+ "from_variant",
1120
+ "once_cell",
1121
+ "semver 1.0.17",
1122
+ "serde",
1123
+ "st-map",
1124
+ "tracing",
1125
+]
1126
+
1127
[[package]]
1128
name = "proc-macro-error"
1129
version = "1.0.4"
@@ -695,9 +1156,9 @@ checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068"
1156
1157
[[package]]
1158
name = "proc-macro2"
698
-version = "1.0.60"
1159
+version = "1.0.63"
1160
source = "registry+https://github.com/rust-lang/crates.io-index"
700
-checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406"
1161
+checksum = "7b368fba921b0dce7e60f5e04ec15e565b3303972b42bcfde1d0713b881959eb"
1162
dependencies = [
1163
"unicode-ident",
1164
]
@@ -713,13 +1174,19 @@ dependencies = [
1174
1175
[[package]]
1176
name = "quote"
716
-version = "1.0.28"
1177
+version = "1.0.29"
1178
source = "registry+https://github.com/rust-lang/crates.io-index"
718
-checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488"
1179
+checksum = "573015e8ab27661678357f27dc26460738fd2b6c86e46f386fde94cb5d913105"
1180
dependencies = [
1181
"proc-macro2",
1182
]
1183
1184
+[[package]]
1185
+name = "radix_fmt"
1186
+version = "1.0.0"
1187
+source = "registry+https://github.com/rust-lang/crates.io-index"
1188
+checksum = "ce082a9940a7ace2ad4a8b7d0b1eac6aa378895f18be598230c5f2284ac05426"
1189
+
1190
[[package]]
1191
name = "rand"
1192
version = "0.8.5"
@@ -750,6 +1217,28 @@ dependencies = [
1217
"getrandom",
1218
]
1219
1220
+[[package]]
1221
+name = "rayon"
1222
+version = "1.7.0"
1223
+source = "registry+https://github.com/rust-lang/crates.io-index"
1224
+checksum = "1d2df5196e37bcc87abebc0053e20787d73847bb33134a69841207dd0a47f03b"
1225
+dependencies = [
1226
+ "either",
1227
+ "rayon-core",
1228
+]
1229
+
1230
+[[package]]
1231
+name = "rayon-core"
1232
+version = "1.11.0"
1233
+source = "registry+https://github.com/rust-lang/crates.io-index"
1234
+checksum = "4b8f95bd6966f5c87776639160a66bd8ab9895d9d4ab01ddba9fc60661aebe8d"
1235
+dependencies = [
1236
+ "crossbeam-channel",
1237
+ "crossbeam-deque",
1238
+ "crossbeam-utils",
1239
+ "num_cpus",
1240
+]
1241
+
1242
[[package]]
1243
name = "redox_syscall"
1244
version = "0.3.5"
@@ -776,6 +1265,12 @@ version = "0.7.2"
1265
source = "registry+https://github.com/rust-lang/crates.io-index"
1266
checksum = "436b050e76ed2903236f032a59761c1eb99e1b0aead2c257922771dab1fc8c78"
1267
1268
+[[package]]
1269
+name = "rustc-demangle"
1270
+version = "0.1.23"
1271
+source = "registry+https://github.com/rust-lang/crates.io-index"
1272
+checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76"
1273
+
1274
[[package]]
1275
name = "rustc-hash"
1276
version = "1.1.0"
@@ -788,20 +1283,26 @@ version = "0.2.3"
1283
source = "registry+https://github.com/rust-lang/crates.io-index"
1284
checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
1285
dependencies = [
791
- "semver",
1286
+ "semver 0.9.0",
1287
]
1288
1289
[[package]]
1290
name = "rustversion"
796
-version = "1.0.12"
1291
+version = "1.0.13"
1292
source = "registry+https://github.com/rust-lang/crates.io-index"
798
-checksum = "4f3208ce4d8448b3f3e7d168a73f5e0c43a61e32930de3bceeccedb388b6bf06"
1293
+checksum = "dc31bd9b61a32c31f9650d18add92aa83a49ba979c143eefd27fe7177b05bd5f"
1294
1295
[[package]]
1296
name = "ryu"
802
-version = "1.0.13"
1297
+version = "1.0.14"
1298
+source = "registry+https://github.com/rust-lang/crates.io-index"
1299
+checksum = "fe232bdf6be8c8de797b22184ee71118d63780ea42ac85b61d1baa6d3b782ae9"
1300
+
1301
+[[package]]
1302
+name = "ryu-js"
1303
+version = "0.2.2"
1304
source = "registry+https://github.com/rust-lang/crates.io-index"
804
-checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041"
1305
+checksum = "6518fc26bced4d53678a22d6e423e9d8716377def84545fe328236e3af070e7f"
1306
1307
[[package]]
1308
name = "same-file"
@@ -833,6 +1334,15 @@ dependencies = [
1334
"semver-parser",
1335
]
1336
1337
+[[package]]
1338
+name = "semver"
1339
+version = "1.0.17"
1340
+source = "registry+https://github.com/rust-lang/crates.io-index"
1341
+checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed"
1342
+dependencies = [
1343
+ "serde",
1344
+]
1345
+
1346
[[package]]
1347
name = "semver-parser"
1348
version = "0.7.0"
@@ -841,35 +1351,57 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
1351
1352
[[package]]
1353
name = "serde"
844
-version = "1.0.164"
1354
+version = "1.0.166"
1355
source = "registry+https://github.com/rust-lang/crates.io-index"
846
-checksum = "9e8c8cf938e98f769bc164923b06dce91cea1751522f46f8466461af04c9027d"
1356
+checksum = "d01b7404f9d441d3ad40e6a636a7782c377d2abdbe4fa2440e2edcc2f4f10db8"
1357
dependencies = [
1358
"serde_derive",
1359
]
1360
1361
+[[package]]
1362
+name = "serde-wasm-bindgen"
1363
+version = "0.4.5"
1364
+source = "registry+https://github.com/rust-lang/crates.io-index"
1365
+checksum = "e3b4c031cd0d9014307d82b8abf653c0290fbdaeb4c02d00c63cf52f728628bf"
1366
+dependencies = [
1367
+ "js-sys",
1368
+ "serde",
1369
+ "wasm-bindgen",
1370
+]
1371
+
1372
[[package]]
1373
name = "serde_derive"
853
-version = "1.0.164"
1374
+version = "1.0.166"
1375
source = "registry+https://github.com/rust-lang/crates.io-index"
855
-checksum = "d9735b638ccc51c28bf6914d90a2e9725b377144fc612c49a611fddd1b631d68"
1376
+checksum = "5dd83d6dde2b6b2d466e14d9d1acce8816dedee94f735eac6395808b3483c6d6"
1377
dependencies = [
1378
"proc-macro2",
1379
"quote",
859
- "syn 2.0.18",
1380
+ "syn 2.0.23",
1381
]
1382
1383
[[package]]
1384
name = "serde_json"
864
-version = "1.0.99"
1385
+version = "1.0.100"
1386
source = "registry+https://github.com/rust-lang/crates.io-index"
866
-checksum = "46266871c240a00b8f503b877622fe33430b3c7d963bdc0f2adc511e54a1eae3"
1387
+checksum = "0f1e14e89be7aa4c4b78bdbdc9eb5bf8517829a600ae8eaa39a6e1d960b5185c"
1388
dependencies = [
1389
"itoa",
1390
"ryu",
1391
"serde",
1392
]
1393
1394
+[[package]]
1395
+name = "sha-1"
1396
+version = "0.10.0"
1397
+source = "registry+https://github.com/rust-lang/crates.io-index"
1398
+checksum = "028f48d513f9678cda28f6e4064755b3fbb2af6acd672f2c209b62323f7aea0f"
1399
+dependencies = [
1400
+ "cfg-if",
1401
+ "cpufeatures",
1402
+ "digest",
1403
+]
1404
+
1405
[[package]]
1406
name = "similar"
1407
version = "2.2.1"
@@ -899,6 +1431,12 @@ dependencies = [
1431
"version_check",
1432
]
1433
1434
+[[package]]
1435
+name = "smawk"
1436
+version = "0.3.1"
1437
+source = "registry+https://github.com/rust-lang/crates.io-index"
1438
+checksum = "f67ad224767faa3c7d8b6d91985b78e70a1324408abcb1cfcc2be4c06bc06043"
1439
+
1440
[[package]]
1441
name = "sourcemap"
1442
version = "6.2.3"
@@ -914,6 +1452,16 @@ dependencies = [
1452
"url",
1453
]
1454
1455
+[[package]]
1456
+name = "st-map"
1457
+version = "0.2.0"
1458
+source = "registry+https://github.com/rust-lang/crates.io-index"
1459
+checksum = "f352d5d14be5a1f956d76ae0c8060c3487aaa2a080f10a4b4ff023c7c05a9047"
1460
+dependencies = [
1461
+ "arrayvec",
1462
+ "static-map-macro",
1463
+]
1464
+
1465
[[package]]
1466
name = "stable_deref_trait"
1467
version = "1.2.0"
@@ -933,6 +1481,18 @@ dependencies = [
1481
"winapi",
1482
]
1483
1484
+[[package]]
1485
+name = "static-map-macro"
1486
+version = "0.3.0"
1487
+source = "registry+https://github.com/rust-lang/crates.io-index"
1488
+checksum = "7628ae0bd92555d3de4303da41a5c8b1c5363e892001325f34e4be9ed024d0d7"
1489
+dependencies = [
1490
+ "pmutil",
1491
+ "proc-macro2",
1492
+ "quote",
1493
+ "syn 2.0.23",
1494
+]
1495
+
1496
[[package]]
1497
name = "static_assertions"
1498
version = "1.1.0"
@@ -975,7 +1535,83 @@ dependencies = [
1535
"proc-macro2",
1536
"quote",
1537
"swc_macros_common",
978
- "syn 2.0.18",
1538
+ "syn 2.0.23",
1539
+]
1540
+
1541
+[[package]]
1542
+name = "supports-color"
1543
+version = "1.3.1"
1544
+source = "registry+https://github.com/rust-lang/crates.io-index"
1545
+checksum = "8ba6faf2ca7ee42fdd458f4347ae0a9bd6bcc445ad7cb57ad82b383f18870d6f"
1546
+dependencies = [
1547
+ "atty",
1548
+ "is_ci",
1549
+]
1550
+
1551
+[[package]]
1552
+name = "supports-hyperlinks"
1553
+version = "1.2.0"
1554
+source = "registry+https://github.com/rust-lang/crates.io-index"
1555
+checksum = "590b34f7c5f01ecc9d78dba4b3f445f31df750a67621cf31626f3b7441ce6406"
1556
+dependencies = [
1557
+ "atty",
1558
+]
1559
+
1560
+[[package]]
1561
+name = "supports-unicode"
1562
+version = "1.0.2"
1563
+source = "registry+https://github.com/rust-lang/crates.io-index"
1564
+checksum = "a8b945e45b417b125a8ec51f1b7df2f8df7920367700d1f98aedd21e5735f8b2"
1565
+dependencies = [
1566
+ "atty",
1567
+]
1568
+
1569
+[[package]]
1570
+name = "swc"
1571
+version = "0.264.8"
1572
+source = "registry+https://github.com/rust-lang/crates.io-index"
1573
+checksum = "c96d692a45418867d3b208ad320c9cd27ef8ca4f58d0a043ad30887b32c5144b"
1574
+dependencies = [
1575
+ "ahash 0.8.3",
1576
+ "anyhow",
1577
+ "base64",
1578
+ "dashmap",
1579
+ "either",
1580
+ "indexmap 1.9.3",
1581
+ "jsonc-parser",
1582
+ "lru",
1583
+ "once_cell",
1584
+ "parking_lot",
1585
+ "pathdiff",
1586
+ "regex",
1587
+ "rustc-hash",
1588
+ "serde",
1589
+ "serde_json",
1590
+ "sourcemap",
1591
+ "swc_atoms",
1592
+ "swc_cached",
1593
+ "swc_common",
1594
+ "swc_config",
1595
+ "swc_ecma_ast 0.107.0",
1596
+ "swc_ecma_codegen",
1597
+ "swc_ecma_ext_transforms",
1598
+ "swc_ecma_lints",
1599
+ "swc_ecma_loader",
1600
+ "swc_ecma_minifier",
1601
+ "swc_ecma_parser 0.137.1",
1602
+ "swc_ecma_preset_env",
1603
+ "swc_ecma_transforms",
1604
+ "swc_ecma_transforms_base 0.130.1",
1605
+ "swc_ecma_transforms_compat",
1606
+ "swc_ecma_transforms_optimization",
1607
+ "swc_ecma_utils 0.120.1",
1608
+ "swc_ecma_visit 0.93.0",
1609
+ "swc_error_reporters",
1610
+ "swc_node_comments",
1611
+ "swc_timer",
1612
+ "swc_visit",
1613
+ "tracing",
1614
+ "url",
1615
]
1616
1617
[[package]]
@@ -983,10 +1619,10 @@ name = "swc-demo"
1619
version = "0.1.0"
1620
dependencies = [
1621
"swc_common",
986
- "swc_core",
987
- "swc_ecma_parser",
988
- "swc_ecma_transforms_base",
989
- "swc_ecma_visit",
1622
+ "swc_core 0.78.28",
1623
+ "swc_ecma_parser 0.136.8",
1624
+ "swc_ecma_transforms_base 0.129.15",
1625
+ "swc_ecma_visit 0.92.5",
1626
"swc_visit",
1627
]
1628
@@ -1004,13 +1640,27 @@ dependencies = [
1640
"triomphe",
1641
]
1642
1643
+[[package]]
1644
+name = "swc_cached"
1645
+version = "0.3.17"
1646
+source = "registry+https://github.com/rust-lang/crates.io-index"
1647
+checksum = "97b8051bbf1c23817f9f2912fce18d9a6efcaaf8f8e1a4c69dbaf72bcaf71136"
1648
+dependencies = [
1649
+ "ahash 0.8.3",
1650
+ "anyhow",
1651
+ "dashmap",
1652
+ "once_cell",
1653
+ "regex",
1654
+ "serde",
1655
+]
1656
+
1657
[[package]]
1658
name = "swc_common"
1659
version = "0.31.16"
1660
source = "registry+https://github.com/rust-lang/crates.io-index"
1661
checksum = "c6414bd4e553f5638961d39b07075ffd37a3d63176829592f4a5900260d94ca1"
1662
dependencies = [
1013
- "ahash",
1663
+ "ahash 0.8.3",
1664
"anyhow",
1665
"ast_node",
1666
"atty",
@@ -1021,6 +1671,7 @@ dependencies = [
1671
"new_debug_unreachable",
1672
"num-bigint",
1673
"once_cell",
1674
+ "parking_lot",
1675
"rustc-hash",
1676
"serde",
1677
"siphasher",
@@ -1035,12 +1686,53 @@ dependencies = [
1686
"url",
1687
]
1688
1689
+[[package]]
1690
+name = "swc_config"
1691
+version = "0.1.7"
1692
+source = "registry+https://github.com/rust-lang/crates.io-index"
1693
+checksum = "9ba1c7a40d38f9dd4e9a046975d3faf95af42937b34b2b963be4d8f01239584b"
1694
+dependencies = [
1695
+ "indexmap 1.9.3",
1696
+ "serde",
1697
+ "serde_json",
1698
+ "swc_config_macro",
1699
+]
1700
+
1701
+[[package]]
1702
+name = "swc_config_macro"
1703
+version = "0.1.2"
1704
+source = "registry+https://github.com/rust-lang/crates.io-index"
1705
+checksum = "e5b5aaca9a0082be4515f0fbbecc191bf5829cd25b5b9c0a2810f6a2bb0d6829"
1706
+dependencies = [
1707
+ "pmutil",
1708
+ "proc-macro2",
1709
+ "quote",
1710
+ "swc_macros_common",
1711
+ "syn 2.0.23",
1712
+]
1713
+
1714
+[[package]]
1715
+name = "swc_core"
1716
+version = "0.78.28"
1717
+source = "registry+https://github.com/rust-lang/crates.io-index"
1718
+checksum = "7e38b2fd17f97d84f1152eb82d7ebc089e98ddd02b5b750af37a0c91dec81c87"
1719
+dependencies = [
1720
+ "vergen",
1721
+]
1722
+
1723
[[package]]
1724
name = "swc_core"
1040
-version = "0.78.15"
1725
+version = "0.79.9"
1726
source = "registry+https://github.com/rust-lang/crates.io-index"
1042
-checksum = "433f38bf3dd31fc55e6264479a889ea1bef3caec0df8e33358f3bf2de0e569c4"
1727
+checksum = "c51e91b0c4f50dd65f94f18a3e3fb9bef463a0d6836470b91c23575ca0778e63"
1728
dependencies = [
1729
+ "swc",
1730
+ "swc_atoms",
1731
+ "swc_common",
1732
+ "swc_ecma_ast 0.107.0",
1733
+ "swc_ecma_parser 0.137.1",
1734
+ "swc_ecma_transforms_base 0.130.1",
1735
+ "swc_ecma_visit 0.93.0",
1736
"vergen",
1737
]
1738
@@ -1050,11 +1742,10 @@ version = "0.106.6"
1742
source = "registry+https://github.com/rust-lang/crates.io-index"
1743
checksum = "ebf4d6804b1da4146c4c0359d129e3dd43568d321f69d7953d9abbca4ded76ba"
1744
dependencies = [
1053
- "bitflags 2.3.2",
1745
+ "bitflags 2.3.3",
1746
"is-macro",
1747
"num-bigint",
1748
"scoped-tls",
1057
- "serde",
1749
"string_enum",
1750
"swc_atoms",
1751
"swc_common",
@@ -1062,53 +1753,485 @@ dependencies = [
1753
]
1754
1755
[[package]]
1065
-name = "swc_ecma_parser"
1066
-version = "0.136.2"
1756
+name = "swc_ecma_ast"
1757
+version = "0.107.0"
1758
source = "registry+https://github.com/rust-lang/crates.io-index"
1068
-checksum = "d0ed358c991cf61d91b045769eb0336689549d6c444073c360ffa9a94af9e965"
1759
+checksum = "5693558188efdd5b664e517b69ba8056a7f64c214ca8cd034e3ae8314566b866"
1760
dependencies = [
1070
- "either",
1071
- "lexical",
1761
+ "bitflags 2.3.3",
1762
+ "is-macro",
1763
"num-bigint",
1764
+ "scoped-tls",
1765
"serde",
1074
- "smallvec",
1075
- "smartstring",
1076
- "stacker",
1766
+ "string_enum",
1767
"swc_atoms",
1768
"swc_common",
1079
- "swc_ecma_ast",
1080
- "tracing",
1081
- "typed-arena",
1769
+ "unicode-id",
1770
]
1771
1772
[[package]]
1085
-name = "swc_ecma_transforms_base"
1086
-version = "0.129.8"
1773
+name = "swc_ecma_codegen"
1774
+version = "0.142.1"
1775
source = "registry+https://github.com/rust-lang/crates.io-index"
1088
-checksum = "e659ba3b910dc0cc0deb8731293151f56054d603ee47f0042fda530b7d487517"
1776
+checksum = "12a1e2c520108525667676df493a636afe679112f19fc51a2d226f853f7513a1"
1777
dependencies = [
1090
- "better_scoped_tls",
1091
- "bitflags 2.3.2",
1092
- "indexmap 1.9.3",
1778
+ "memchr",
1779
+ "num-bigint",
1780
"once_cell",
1094
- "phf",
1781
"rustc-hash",
1782
"serde",
1097
- "smallvec",
1783
+ "sourcemap",
1784
"swc_atoms",
1785
"swc_common",
1100
- "swc_ecma_ast",
1101
- "swc_ecma_parser",
1102
- "swc_ecma_utils",
1103
- "swc_ecma_visit",
1786
+ "swc_ecma_ast 0.107.0",
1787
+ "swc_ecma_codegen_macros",
1788
"tracing",
1789
]
1790
1791
+[[package]]
1792
+name = "swc_ecma_codegen_macros"
1793
+version = "0.7.3"
1794
+source = "registry+https://github.com/rust-lang/crates.io-index"
1795
+checksum = "dcdff076dccca6cc6a0e0b2a2c8acfb066014382bc6df98ec99e755484814384"
1796
+dependencies = [
1797
+ "pmutil",
1798
+ "proc-macro2",
1799
+ "quote",
1800
+ "swc_macros_common",
1801
+ "syn 2.0.23",
1802
+]
1803
+
1804
+[[package]]
1805
+name = "swc_ecma_ext_transforms"
1806
+version = "0.106.1"
1807
+source = "registry+https://github.com/rust-lang/crates.io-index"
1808
+checksum = "38f16586ee4665969223337d81c1d5a2f3c212b2996c0c2e953fe77590cdcb39"
1809
+dependencies = [
1810
+ "phf",
1811
+ "swc_atoms",
1812
+ "swc_common",
1813
+ "swc_ecma_ast 0.107.0",
1814
+ "swc_ecma_utils 0.120.1",
1815
+ "swc_ecma_visit 0.93.0",
1816
+]
1817
+
1818
+[[package]]
1819
+name = "swc_ecma_lints"
1820
+version = "0.85.1"
1821
+source = "registry+https://github.com/rust-lang/crates.io-index"
1822
+checksum = "9303e33d47e5e524cece64a1d61cff6c02d1cd026aba60bc97954d03a21ac4f9"
1823
+dependencies = [
1824
+ "ahash 0.8.3",
1825
+ "auto_impl",
1826
+ "dashmap",
1827
+ "parking_lot",
1828
+ "rayon",
1829
+ "regex",
1830
+ "serde",
1831
+ "swc_atoms",
1832
+ "swc_common",
1833
+ "swc_config",
1834
+ "swc_ecma_ast 0.107.0",
1835
+ "swc_ecma_utils 0.120.1",
1836
+ "swc_ecma_visit 0.93.0",
1837
+]
1838
+
1839
+[[package]]
1840
+name = "swc_ecma_loader"
1841
+version = "0.43.18"
1842
+source = "registry+https://github.com/rust-lang/crates.io-index"
1843
+checksum = "8d40f8d1626b33ba85ee17f43268b3bb6382278b9d3a3c1faa52c57e71769a60"
1844
+dependencies = [
1845
+ "ahash 0.8.3",
1846
+ "anyhow",
1847
+ "dashmap",
1848
+ "lru",
1849
+ "normpath",
1850
+ "once_cell",
1851
+ "parking_lot",
1852
+ "path-clean",
1853
+ "pathdiff",
1854
+ "serde",
1855
+ "serde_json",
1856
+ "swc_cached",
1857
+ "swc_common",
1858
+ "tracing",
1859
+]
1860
+
1861
+[[package]]
1862
+name = "swc_ecma_minifier"
1863
+version = "0.184.7"
1864
+source = "registry+https://github.com/rust-lang/crates.io-index"
1865
+checksum = "6c1106ce1d65d21c38857dd0338f59a261b6cdc38f581954b1798a785d014524"
1866
+dependencies = [
1867
+ "ahash 0.8.3",
1868
+ "arrayvec",
1869
+ "indexmap 1.9.3",
1870
+ "num-bigint",
1871
+ "num_cpus",
1872
+ "once_cell",
1873
+ "parking_lot",
1874
+ "radix_fmt",
1875
+ "regex",
1876
+ "rustc-hash",
1877
+ "ryu-js",
1878
+ "serde",
1879
+ "serde_json",
1880
+ "swc_atoms",
1881
+ "swc_cached",
1882
+ "swc_common",
1883
+ "swc_config",
1884
+ "swc_ecma_ast 0.107.0",
1885
+ "swc_ecma_codegen",
1886
+ "swc_ecma_parser 0.137.1",
1887
+ "swc_ecma_transforms_base 0.130.1",
1888
+ "swc_ecma_transforms_optimization",
1889
+ "swc_ecma_usage_analyzer",
1890
+ "swc_ecma_utils 0.120.1",
1891
+ "swc_ecma_visit 0.93.0",
1892
+ "swc_timer",
1893
+ "tracing",
1894
+]
1895
+
1896
+[[package]]
1897
+name = "swc_ecma_parser"
1898
+version = "0.136.8"
1899
+source = "registry+https://github.com/rust-lang/crates.io-index"
1900
+checksum = "45d40421c607d7a48334f78a9b24a5cbde1f36250f9986746ec082208d68b39f"
1901
+dependencies = [
1902
+ "either",
1903
+ "lexical",
1904
+ "num-bigint",
1905
+ "serde",
1906
+ "smallvec",
1907
+ "smartstring",
1908
+ "stacker",
1909
+ "swc_atoms",
1910
+ "swc_common",
1911
+ "swc_ecma_ast 0.106.6",
1912
+ "tracing",
1913
+ "typed-arena",
1914
+]
1915
+
1916
+[[package]]
1917
+name = "swc_ecma_parser"
1918
+version = "0.137.1"
1919
+source = "registry+https://github.com/rust-lang/crates.io-index"
1920
+checksum = "8ea1915adb15d9ca1695e76d41524beb4806e9b603280edb7eedbaebe706a41c"
1921
+dependencies = [
1922
+ "either",
1923
+ "lexical",
1924
+ "num-bigint",
1925
+ "serde",
1926
+ "smallvec",
1927
+ "smartstring",
1928
+ "stacker",
1929
+ "swc_atoms",
1930
+ "swc_common",
1931
+ "swc_ecma_ast 0.107.0",
1932
+ "tracing",
1933
+ "typed-arena",
1934
+]
1935
+
1936
+[[package]]
1937
+name = "swc_ecma_preset_env"
1938
+version = "0.198.4"
1939
+source = "registry+https://github.com/rust-lang/crates.io-index"
1940
+checksum = "6835b856cbae281ea2aba64af208b3011528e5ef815441f4e4e234674f805472"
1941
+dependencies = [
1942
+ "ahash 0.8.3",
1943
+ "anyhow",
1944
+ "dashmap",
1945
+ "indexmap 1.9.3",
1946
+ "once_cell",
1947
+ "preset_env_base",
1948
+ "semver 1.0.17",
1949
+ "serde",
1950
+ "serde_json",
1951
+ "st-map",
1952
+ "string_enum",
1953
+ "swc_atoms",
1954
+ "swc_common",
1955
+ "swc_ecma_ast 0.107.0",
1956
+ "swc_ecma_transforms",
1957
+ "swc_ecma_utils 0.120.1",
1958
+ "swc_ecma_visit 0.93.0",
1959
+]
1960
+
1961
+[[package]]
1962
+name = "swc_ecma_transforms"
1963
+version = "0.221.4"
1964
+source = "registry+https://github.com/rust-lang/crates.io-index"
1965
+checksum = "a4f578a16ff264c1f306d38a10b900256b33f636426ebeb5eab980205e8fc9f5"
1966
+dependencies = [
1967
+ "swc_atoms",
1968
+ "swc_common",
1969
+ "swc_ecma_ast 0.107.0",
1970
+ "swc_ecma_transforms_base 0.130.1",
1971
+ "swc_ecma_transforms_compat",
1972
+ "swc_ecma_transforms_module",
1973
+ "swc_ecma_transforms_optimization",
1974
+ "swc_ecma_transforms_proposal",
1975
+ "swc_ecma_transforms_react",
1976
+ "swc_ecma_transforms_typescript",
1977
+ "swc_ecma_utils 0.120.1",
1978
+ "swc_ecma_visit 0.93.0",
1979
+]
1980
+
1981
+[[package]]
1982
+name = "swc_ecma_transforms_base"
1983
+version = "0.129.15"
1984
+source = "registry+https://github.com/rust-lang/crates.io-index"
1985
+checksum = "7707e724db259cd93150fd5bc04559ace997edbce968d29be9c881e317c9b3fb"
1986
+dependencies = [
1987
+ "better_scoped_tls",
1988
+ "bitflags 2.3.3",
1989
+ "indexmap 1.9.3",
1990
+ "once_cell",
1991
+ "phf",
1992
+ "rustc-hash",
1993
+ "serde",
1994
+ "smallvec",
1995
+ "swc_atoms",
1996
+ "swc_common",
1997
+ "swc_ecma_ast 0.106.6",
1998
+ "swc_ecma_parser 0.136.8",
1999
+ "swc_ecma_utils 0.119.10",
2000
+ "swc_ecma_visit 0.92.5",
2001
+ "tracing",
2002
+]
2003
+
2004
+[[package]]
2005
+name = "swc_ecma_transforms_base"
2006
+version = "0.130.1"
2007
+source = "registry+https://github.com/rust-lang/crates.io-index"
2008
+checksum = "84594423bc24ec9133265197c314db437c42c2cdbaba275c81e1d3673b8d6beb"
2009
+dependencies = [
2010
+ "better_scoped_tls",
2011
+ "bitflags 2.3.3",
2012
+ "indexmap 1.9.3",
2013
+ "once_cell",
2014
+ "phf",
2015
+ "rustc-hash",
2016
+ "serde",
2017
+ "smallvec",
2018
+ "swc_atoms",
2019
+ "swc_common",
2020
+ "swc_ecma_ast 0.107.0",
2021
+ "swc_ecma_parser 0.137.1",
2022
+ "swc_ecma_utils 0.120.1",
2023
+ "swc_ecma_visit 0.93.0",
2024
+ "tracing",
2025
+]
2026
+
2027
+[[package]]
2028
+name = "swc_ecma_transforms_classes"
2029
+version = "0.119.1"
2030
+source = "registry+https://github.com/rust-lang/crates.io-index"
2031
+checksum = "a288e0d1a702f1944df7c1b57468f505a9549d7d7a51d89dfa18d8f956abdbf5"
2032
+dependencies = [
2033
+ "swc_atoms",
2034
+ "swc_common",
2035
+ "swc_ecma_ast 0.107.0",
2036
+ "swc_ecma_transforms_base 0.130.1",
2037
+ "swc_ecma_utils 0.120.1",
2038
+ "swc_ecma_visit 0.93.0",
2039
+]
2040
+
2041
+[[package]]
2042
+name = "swc_ecma_transforms_compat"
2043
+version = "0.156.3"
2044
+source = "registry+https://github.com/rust-lang/crates.io-index"
2045
+checksum = "0ff9b38ea8bf338a46dda895b841de54360973b600c012c18e1bf93bfba35c06"
2046
+dependencies = [
2047
+ "ahash 0.8.3",
2048
+ "arrayvec",
2049
+ "indexmap 1.9.3",
2050
+ "is-macro",
2051
+ "num-bigint",
2052
+ "serde",
2053
+ "smallvec",
2054
+ "swc_atoms",
2055
+ "swc_common",
2056
+ "swc_config",
2057
+ "swc_ecma_ast 0.107.0",
2058
+ "swc_ecma_transforms_base 0.130.1",
2059
+ "swc_ecma_transforms_classes",
2060
+ "swc_ecma_transforms_macros",
2061
+ "swc_ecma_utils 0.120.1",
2062
+ "swc_ecma_visit 0.93.0",
2063
+ "swc_trace_macro",
2064
+ "tracing",
2065
+]
2066
+
2067
+[[package]]
2068
+name = "swc_ecma_transforms_macros"
2069
+version = "0.5.2"
2070
+source = "registry+https://github.com/rust-lang/crates.io-index"
2071
+checksum = "f59c4b6ed5d78d3ad9fc7c6f8ab4f85bba99573d31d9a2c0a712077a6b45efd2"
2072
+dependencies = [
2073
+ "pmutil",
2074
+ "proc-macro2",
2075
+ "quote",
2076
+ "swc_macros_common",
2077
+ "syn 2.0.23",
2078
+]
2079
+
2080
+[[package]]
2081
+name = "swc_ecma_transforms_module"
2082
+version = "0.173.3"
2083
+source = "registry+https://github.com/rust-lang/crates.io-index"
2084
+checksum = "729cb914afb891896bd3f1648f194e003492568471e6c9483f7667bf3c14fd9b"
2085
+dependencies = [
2086
+ "Inflector",
2087
+ "ahash 0.8.3",
2088
+ "anyhow",
2089
+ "bitflags 2.3.3",
2090
+ "indexmap 1.9.3",
2091
+ "is-macro",
2092
+ "path-clean",
2093
+ "pathdiff",
2094
+ "regex",
2095
+ "serde",
2096
+ "swc_atoms",
2097
+ "swc_cached",
2098
+ "swc_common",
2099
+ "swc_ecma_ast 0.107.0",
2100
+ "swc_ecma_loader",
2101
+ "swc_ecma_parser 0.137.1",
2102
+ "swc_ecma_transforms_base 0.130.1",
2103
+ "swc_ecma_utils 0.120.1",
2104
+ "swc_ecma_visit 0.93.0",
2105
+ "tracing",
2106
+]
2107
+
2108
+[[package]]
2109
+name = "swc_ecma_transforms_optimization"
2110
+version = "0.190.4"
2111
+source = "registry+https://github.com/rust-lang/crates.io-index"
2112
+checksum = "32c1e2751df41e27e22bf3ad304c3a1831fad141f1491b08c2b7907ccd9d66c5"
2113
+dependencies = [
2114
+ "ahash 0.8.3",
2115
+ "dashmap",
2116
+ "indexmap 1.9.3",
2117
+ "once_cell",
2118
+ "petgraph",
2119
+ "rustc-hash",
2120
+ "serde_json",
2121
+ "swc_atoms",
2122
+ "swc_common",
2123
+ "swc_ecma_ast 0.107.0",
2124
+ "swc_ecma_parser 0.137.1",
2125
+ "swc_ecma_transforms_base 0.130.1",
2126
+ "swc_ecma_transforms_macros",
2127
+ "swc_ecma_utils 0.120.1",
2128
+ "swc_ecma_visit 0.93.0",
2129
+ "swc_fast_graph",
2130
+ "tracing",
2131
+]
2132
+
2133
+[[package]]
2134
+name = "swc_ecma_transforms_proposal"
2135
+version = "0.164.3"
2136
+source = "registry+https://github.com/rust-lang/crates.io-index"
2137
+checksum = "2a1a942506b915e48989c13ee3c6bd63eb9b895593b8a47008d9607e2857d4c7"
2138
+dependencies = [
2139
+ "either",
2140
+ "rustc-hash",
2141
+ "serde",
2142
+ "smallvec",
2143
+ "swc_atoms",
2144
+ "swc_common",
2145
+ "swc_ecma_ast 0.107.0",
2146
+ "swc_ecma_transforms_base 0.130.1",
2147
+ "swc_ecma_transforms_classes",
2148
+ "swc_ecma_transforms_macros",
2149
+ "swc_ecma_utils 0.120.1",
2150
+ "swc_ecma_visit 0.93.0",
2151
+]
2152
+
2153
+[[package]]
2154
+name = "swc_ecma_transforms_react"
2155
+version = "0.176.3"
2156
+source = "registry+https://github.com/rust-lang/crates.io-index"
2157
+checksum = "094c9def9589d2687c15cfe859ffab87989a92217e73c93b3ce48e58c4a4ebfe"
2158
+dependencies = [
2159
+ "ahash 0.8.3",
2160
+ "base64",
2161
+ "dashmap",
2162
+ "indexmap 1.9.3",
2163
+ "once_cell",
2164
+ "serde",
2165
+ "sha-1",
2166
+ "string_enum",
2167
+ "swc_atoms",
2168
+ "swc_common",
2169
+ "swc_config",
2170
+ "swc_ecma_ast 0.107.0",
2171
+ "swc_ecma_parser 0.137.1",
2172
+ "swc_ecma_transforms_base 0.130.1",
2173
+ "swc_ecma_transforms_macros",
2174
+ "swc_ecma_utils 0.120.1",
2175
+ "swc_ecma_visit 0.93.0",
2176
+]
2177
+
2178
+[[package]]
2179
+name = "swc_ecma_transforms_typescript"
2180
+version = "0.180.3"
2181
+source = "registry+https://github.com/rust-lang/crates.io-index"
2182
+checksum = "4d3a7740e75e9a8c690320f2a3507560eb9cb1ce91662174619f21357bb517d3"
2183
+dependencies = [
2184
+ "serde",
2185
+ "swc_atoms",
2186
+ "swc_common",
2187
+ "swc_ecma_ast 0.107.0",
2188
+ "swc_ecma_transforms_base 0.130.1",
2189
+ "swc_ecma_transforms_react",
2190
+ "swc_ecma_utils 0.120.1",
2191
+ "swc_ecma_visit 0.93.0",
2192
+]
2193
+
2194
+[[package]]
2195
+name = "swc_ecma_usage_analyzer"
2196
+version = "0.16.2"
2197
+source = "registry+https://github.com/rust-lang/crates.io-index"
2198
+checksum = "6b3c6eb57ce96ed026f21315e510d6710fbfe65b8706ae89ff0ff657e580eb74"
2199
+dependencies = [
2200
+ "ahash 0.8.3",
2201
+ "indexmap 1.9.3",
2202
+ "rustc-hash",
2203
+ "swc_atoms",
2204
+ "swc_common",
2205
+ "swc_ecma_ast 0.107.0",
2206
+ "swc_ecma_utils 0.120.1",
2207
+ "swc_ecma_visit 0.93.0",
2208
+ "swc_timer",
2209
+ "tracing",
2210
+]
2211
+
2212
+[[package]]
2213
+name = "swc_ecma_utils"
2214
+version = "0.119.10"
2215
+source = "registry+https://github.com/rust-lang/crates.io-index"
2216
+checksum = "452c66399edeb88a97bfdc3bbf11e45db85fdf883bfd4fc8bdd93abb92152b9b"
2217
+dependencies = [
2218
+ "indexmap 1.9.3",
2219
+ "num_cpus",
2220
+ "once_cell",
2221
+ "rustc-hash",
2222
+ "swc_atoms",
2223
+ "swc_common",
2224
+ "swc_ecma_ast 0.106.6",
2225
+ "swc_ecma_visit 0.92.5",
2226
+ "tracing",
2227
+ "unicode-id",
2228
+]
2229
+
2230
[[package]]
2231
name = "swc_ecma_utils"
1109
-version = "0.119.4"
2232
+version = "0.120.1"
2233
source = "registry+https://github.com/rust-lang/crates.io-index"
1111
-checksum = "266eaf9dc1ba58fca1fd34e97f9493e4df655eecde468104f32ab40d7147efac"
2234
+checksum = "58ce2d8b6a3ed69ac1a8146efe1f0b1bdb8676cab204b839f42ac8b62fefc772"
2235
dependencies = [
2236
"indexmap 1.9.3",
2237
"num_cpus",
@@ -1116,22 +2239,36 @@ dependencies = [
2239
"rustc-hash",
2240
"swc_atoms",
2241
"swc_common",
1119
- "swc_ecma_ast",
1120
- "swc_ecma_visit",
2242
+ "swc_ecma_ast 0.107.0",
2243
+ "swc_ecma_visit 0.93.0",
2244
"tracing",
2245
"unicode-id",
2246
]
2247
2248
[[package]]
2249
name = "swc_ecma_visit"
1127
-version = "0.92.1"
2250
+version = "0.92.5"
2251
source = "registry+https://github.com/rust-lang/crates.io-index"
1129
-checksum = "418a300bfde6ea4ab8e40e1ecdb3723f31ab3dbdbf9ac9e986164d63caba9d3e"
2252
+checksum = "0f61da6cac0ec3b7e62d367cfbd9e38e078a4601271891ad94f0dac5ff69f839"
2253
dependencies = [
2254
"num-bigint",
2255
"swc_atoms",
2256
"swc_common",
1134
- "swc_ecma_ast",
2257
+ "swc_ecma_ast 0.106.6",
2258
+ "swc_visit",
2259
+ "tracing",
2260
+]
2261
+
2262
+[[package]]
2263
+name = "swc_ecma_visit"
2264
+version = "0.93.0"
2265
+source = "registry+https://github.com/rust-lang/crates.io-index"
2266
+checksum = "82bb87ee3345a7049efcbedc419f121933e0e3967457922848d0026fb3b79dac"
2267
+dependencies = [
2268
+ "num-bigint",
2269
+ "swc_atoms",
2270
+ "swc_common",
2271
+ "swc_ecma_ast 0.107.0",
2272
"swc_visit",
2273
"tracing",
2274
]
@@ -1145,7 +2282,32 @@ dependencies = [
2282
"pmutil",
2283
"proc-macro2",
2284
"quote",
1148
- "syn 2.0.18",
2285
+ "syn 2.0.23",
2286
+]
2287
+
2288
+[[package]]
2289
+name = "swc_error_reporters"
2290
+version = "0.15.16"
2291
+source = "registry+https://github.com/rust-lang/crates.io-index"
2292
+checksum = "108322b719696e8c368c39dc6d8748494ea2aa870e7d80ea5956078aa6b4dd4d"
2293
+dependencies = [
2294
+ "anyhow",
2295
+ "miette",
2296
+ "once_cell",
2297
+ "parking_lot",
2298
+ "swc_common",
2299
+]
2300
+
2301
+[[package]]
2302
+name = "swc_fast_graph"
2303
+version = "0.19.16"
2304
+source = "registry+https://github.com/rust-lang/crates.io-index"
2305
+checksum = "b19b76468219b923c34efdeff812fa951fe1a1ecaba78118b013d034a1669ff5"
2306
+dependencies = [
2307
+ "indexmap 1.9.3",
2308
+ "petgraph",
2309
+ "rustc-hash",
2310
+ "swc_common",
2311
]
2312
2313
[[package]]
@@ -1157,7 +2319,39 @@ dependencies = [
2319
"pmutil",
2320
"proc-macro2",
2321
"quote",
1160
- "syn 2.0.18",
2322
+ "syn 2.0.23",
2323
+]
2324
+
2325
+[[package]]
2326
+name = "swc_node_comments"
2327
+version = "0.18.16"
2328
+source = "registry+https://github.com/rust-lang/crates.io-index"
2329
+checksum = "61839f8a936b5c95ce644d539914bb944b094eee9bd156c3dc41fe8e7eaa84ea"
2330
+dependencies = [
2331
+ "ahash 0.8.3",
2332
+ "dashmap",
2333
+ "swc_atoms",
2334
+ "swc_common",
2335
+]
2336
+
2337
+[[package]]
2338
+name = "swc_timer"
2339
+version = "0.19.19"
2340
+source = "registry+https://github.com/rust-lang/crates.io-index"
2341
+checksum = "9889bf48909289e13e0f343eb8d1238e674e9380a4dd6c6346f62b83cb30236f"
2342
+dependencies = [
2343
+ "tracing",
2344
+]
2345
+
2346
+[[package]]
2347
+name = "swc_trace_macro"
2348
+version = "0.1.3"
2349
+source = "registry+https://github.com/rust-lang/crates.io-index"
2350
+checksum = "ff9719b6085dd2824fd61938a881937be14b08f95e2d27c64c825a9f65e052ba"
2351
+dependencies = [
2352
+ "proc-macro2",
2353
+ "quote",
2354
+ "syn 2.0.23",
2355
]
2356
2357
[[package]]
@@ -1181,7 +2375,7 @@ dependencies = [
2375
"proc-macro2",
2376
"quote",
2377
"swc_macros_common",
1184
- "syn 2.0.18",
2378
+ "syn 2.0.23",
2379
]
2380
2381
[[package]]
@@ -1197,9 +2391,9 @@ dependencies = [
2391
2392
[[package]]
2393
name = "syn"
1200
-version = "2.0.18"
2394
+version = "2.0.23"
2395
source = "registry+https://github.com/rust-lang/crates.io-index"
1202
-checksum = "32d41677bcbe24c20c52e7c70b0d8db04134c5d1066bf98662e2871ad200ea3e"
2396
+checksum = "59fb7d6d8281a51045d62b8eb3a7d1ce347b76f312af50cd3dc0af39c87c1737"
2397
dependencies = [
2398
"proc-macro2",
2399
"quote",
@@ -1215,24 +2409,56 @@ dependencies = [
2409
"winapi-util",
2410
]
2411
2412
+[[package]]
2413
+name = "terminal_size"
2414
+version = "0.1.17"
2415
+source = "registry+https://github.com/rust-lang/crates.io-index"
2416
+checksum = "633c1a546cee861a1a6d0dc69ebeca693bf4296661ba7852b9d21d159e0506df"
2417
+dependencies = [
2418
+ "libc",
2419
+ "winapi",
2420
+]
2421
+
2422
+[[package]]
2423
+name = "textwrap"
2424
+version = "0.15.2"
2425
+source = "registry+https://github.com/rust-lang/crates.io-index"
2426
+checksum = "b7b3e525a49ec206798b40326a44121291b530c963cfb01018f63e135bac543d"
2427
+dependencies = [
2428
+ "smawk",
2429
+ "unicode-linebreak",
2430
+ "unicode-width",
2431
+]
2432
+
2433
[[package]]
2434
name = "thiserror"
1220
-version = "1.0.40"
2435
+version = "1.0.41"
2436
source = "registry+https://github.com/rust-lang/crates.io-index"
1222
-checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac"
2437
+checksum = "c16a64ba9387ef3fdae4f9c1a7f07a0997fce91985c0336f1ddc1822b3b37802"
2438
dependencies = [
2439
"thiserror-impl",
2440
]
2441
2442
[[package]]
2443
name = "thiserror-impl"
1229
-version = "1.0.40"
2444
+version = "1.0.41"
2445
source = "registry+https://github.com/rust-lang/crates.io-index"
1231
-checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f"
2446
+checksum = "d14928354b01c4d6a4f0e549069adef399a284e7995c7ccca94e8a07a5346c59"
2447
dependencies = [
2448
"proc-macro2",
2449
"quote",
1235
- "syn 2.0.18",
2450
+ "syn 2.0.23",
2451
+]
2452
+
2453
+[[package]]
2454
+name = "time"
2455
+version = "0.1.45"
2456
+source = "registry+https://github.com/rust-lang/crates.io-index"
2457
+checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a"
2458
+dependencies = [
2459
+ "libc",
2460
+ "wasi 0.10.0+wasi-snapshot-preview1",
2461
+ "winapi",
2462
]
2463
2464
[[package]]
@@ -1291,13 +2517,13 @@ dependencies = [
2517
2518
[[package]]
2519
name = "tracing-attributes"
1294
-version = "0.1.25"
2520
+version = "0.1.26"
2521
source = "registry+https://github.com/rust-lang/crates.io-index"
1296
-checksum = "8803eee176538f94ae9a14b55b2804eb7e1441f8210b1c31290b3bccdccff73b"
2522
+checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab"
2523
dependencies = [
2524
"proc-macro2",
2525
"quote",
1300
- "syn 2.0.18",
2526
+ "syn 2.0.23",
2527
]
2528
2529
[[package]]
@@ -1325,6 +2551,12 @@ version = "2.0.2"
2551
source = "registry+https://github.com/rust-lang/crates.io-index"
2552
checksum = "6af6ae20167a9ece4bcb41af5b80f8a1f1df981f6391189ce00fd257af04126a"
2553
2554
+[[package]]
2555
+name = "typenum"
2556
+version = "1.16.0"
2557
+source = "registry+https://github.com/rust-lang/crates.io-index"
2558
+checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba"
2559
+
2560
[[package]]
2561
name = "unicode-bidi"
2562
version = "0.3.13"
@@ -1339,9 +2571,19 @@ checksum = "d70b6494226b36008c8366c288d77190b3fad2eb4c10533139c1c1f461127f1a"
2571
2572
[[package]]
2573
name = "unicode-ident"
1342
-version = "1.0.9"
2574
+version = "1.0.10"
2575
source = "registry+https://github.com/rust-lang/crates.io-index"
1344
-checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0"
2576
+checksum = "22049a19f4a68748a168c0fc439f9516686aa045927ff767eca0a85101fb6e73"
2577
+
2578
+[[package]]
2579
+name = "unicode-linebreak"
2580
+version = "0.1.4"
2581
+source = "registry+https://github.com/rust-lang/crates.io-index"
2582
+checksum = "c5faade31a542b8b35855fff6e8def199853b2da8da256da52f52f1316ee3137"
2583
+dependencies = [
2584
+ "hashbrown 0.12.3",
2585
+ "regex",
2586
+]
2587
2588
[[package]]
2589
name = "unicode-normalization"
@@ -1381,7 +2623,7 @@ dependencies = [
2623
"getset",
2624
"rustversion",
2625
"thiserror",
1384
- "time",
2626
+ "time 0.3.22",
2627
]
2628
2629
[[package]]
@@ -1400,12 +2642,72 @@ dependencies = [
2642
"winapi-util",
2643
]
2644
2645
+[[package]]
2646
+name = "wasi"
2647
+version = "0.10.0+wasi-snapshot-preview1"
2648
+source = "registry+https://github.com/rust-lang/crates.io-index"
2649
+checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f"
2650
+
2651
[[package]]
2652
name = "wasi"
2653
version = "0.11.0+wasi-snapshot-preview1"
2654
source = "registry+https://github.com/rust-lang/crates.io-index"
2655
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
2656
2657
+[[package]]
2658
+name = "wasm-bindgen"
2659
+version = "0.2.87"
2660
+source = "registry+https://github.com/rust-lang/crates.io-index"
2661
+checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342"
2662
+dependencies = [
2663
+ "cfg-if",
2664
+ "wasm-bindgen-macro",
2665
+]
2666
+
2667
+[[package]]
2668
+name = "wasm-bindgen-backend"
2669
+version = "0.2.87"
2670
+source = "registry+https://github.com/rust-lang/crates.io-index"
2671
+checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd"
2672
+dependencies = [
2673
+ "bumpalo",
2674
+ "log",
2675
+ "once_cell",
2676
+ "proc-macro2",
2677
+ "quote",
2678
+ "syn 2.0.23",
2679
+ "wasm-bindgen-shared",
2680
+]
2681
+
2682
+[[package]]
2683
+name = "wasm-bindgen-macro"
2684
+version = "0.2.87"
2685
+source = "registry+https://github.com/rust-lang/crates.io-index"
2686
+checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d"
2687
+dependencies = [
2688
+ "quote",
2689
+ "wasm-bindgen-macro-support",
2690
+]
2691
+
2692
+[[package]]
2693
+name = "wasm-bindgen-macro-support"
2694
+version = "0.2.87"
2695
+source = "registry+https://github.com/rust-lang/crates.io-index"
2696
+checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b"
2697
+dependencies = [
2698
+ "proc-macro2",
2699
+ "quote",
2700
+ "syn 2.0.23",
2701
+ "wasm-bindgen-backend",
2702
+ "wasm-bindgen-shared",
2703
+]
2704
+
2705
+[[package]]
2706
+name = "wasm-bindgen-shared"
2707
+version = "0.2.87"
2708
+source = "registry+https://github.com/rust-lang/crates.io-index"
2709
+checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1"
2710
+
2711
[[package]]
2712
name = "winapi"
2713
version = "0.3.9"
@@ -1437,6 +2739,15 @@ version = "0.4.0"
2739
source = "registry+https://github.com/rust-lang/crates.io-index"
2740
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
2741
2742
+[[package]]
2743
+name = "windows"
2744
+version = "0.48.0"
2745
+source = "registry+https://github.com/rust-lang/crates.io-index"
2746
+checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f"
2747
+dependencies = [
2748
+ "windows-targets 0.48.1",
2749
+]
2750
+
2751
[[package]]
2752
name = "windows-sys"
2753
version = "0.45.0"
@@ -1463,9 +2774,9 @@ dependencies = [
2774
2775
[[package]]
2776
name = "windows-targets"
1466
-version = "0.48.0"
2777
+version = "0.48.1"
2778
source = "registry+https://github.com/rust-lang/crates.io-index"
1468
-checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5"
2779
+checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f"
2780
dependencies = [
2781
"windows_aarch64_gnullvm 0.48.0",
2782
"windows_aarch64_msvc 0.48.0",
compiler/forget/Cargo.toml
+1
@@ -2,6 +2,7 @@
2
3
members = [
4
"crates/build-hir",
5
+ "crates/fixtures",
6
"crates/hir",
7
"crates/swc-demo",
8
"crates/estree",
compiler/forget/crates/build-hir/src/build.rs
+3
-3
@@ -102,7 +102,7 @@ fn lower_statement<'a>(
102
Statement::EmptyStatement(_) => {
103
// no-op
104
}
105
- _ => todo!(),
105
+ _ => todo!("Lower {stmt:#?}"),
106
}
107
Ok(())
108
}
@@ -148,7 +148,7 @@ fn lower_expression<'a>(
148
ExpressionLike::SpreadElement(_) => {
149
panic!("SpreadElement may not appear in normal expression position")
150
}
151
- _ => todo!(),
151
+ _ => todo!("Lower expr {expr:#?}"),
152
}
153
}
154
@@ -197,7 +197,7 @@ fn lower_primitive<'a>(
197
LiteralValue::Null => PrimitiveValue::Null,
198
LiteralValue::Number(value) => PrimitiveValue::Number(f64::from(value).into()),
199
LiteralValue::String(s) => PrimitiveValue::String(String::from_str_in(&s, &env.allocator)),
200
- _ => todo!(),
200
+ _ => todo!("Lower literal {literal:#?}"),
201
}
202
}
203
compiler/forget/crates/build-hir/src/builder.rs
+21
-4
@@ -58,12 +58,25 @@ impl<'a> Builder<'a> {
58
blocks: self.completed,
59
};
60
61
+ assert!(hir.blocks.len() > 0, "initial block count");
62
reverse_postorder_blocks(&mut hir);
63
+ assert!(hir.blocks.len() > 0, "after reverse_postorder_blocks");
64
remove_unreachable_for_updates(&mut hir);
65
+ assert!(hir.blocks.len() > 0, "after remove_unreachable_for_updates");
66
remove_unreachable_fallthroughs(&mut hir);
67
+ assert!(
68
+ hir.blocks.len() > 0,
69
+ "after remove_unreachable_fallthroughs"
70
+ );
71
remove_unreachable_do_while_statements(&mut hir);
72
+ assert!(
73
+ hir.blocks.len() > 0,
74
+ "after remove_unreachable_do_while_statements"
75
+ );
76
mark_instruction_ids(&mut hir)?;
77
+ assert!(hir.blocks.len() > 0, "after mark_instruction_ids");
78
mark_predecessors(&mut hir);
79
+ assert!(hir.blocks.len() > 0, "after mark_predecessors");
80
81
Ok(hir)
82
}
@@ -166,6 +179,7 @@ fn reverse_postorder_blocks<'a>(hir: &mut HIR<'a>) {
179
}
180
TerminalValue::ReturnTerminal(..) => { /* no-op */ }
181
}
182
+ postorder.push(block_id);
183
}
184
visit(hir.entry, &hir, &mut visited, &mut postorder);
185
@@ -241,7 +255,9 @@ fn mark_instruction_ids<'a>(hir: &mut HIR<'a>) -> Result<(), Diagnostic> {
255
let mut visited = HashSet::<(usize, usize)>::new();
256
for (block_ix, block) in hir.blocks.values_mut().enumerate() {
257
for (instr_ix, instr) in block.instructions.iter_mut().enumerate() {
244
- invariant(!visited.insert((block_ix, instr_ix)), || ())?;
258
+ invariant(visited.insert((block_ix, instr_ix)), || {
259
+ format!("Expected bb{block_ix} i{instr_ix} not to have been visited yet")
260
+ })?;
261
instr.id = id_gen.next();
262
}
263
block.terminal.id = id_gen.next();
@@ -275,12 +291,13 @@ fn mark_predecessors<'a>(hir: &mut HIR<'a>) {
291
visit(hir.entry, None, hir, &mut visited);
292
}
293
278
-fn invariant<F>(cond: bool, _f: F) -> Result<(), Diagnostic>
294
+fn invariant<F>(cond: bool, f: F) -> Result<(), Diagnostic>
295
where
280
- F: FnOnce() -> Diagnostic,
296
+ F: FnOnce() -> String,
297
{
298
if !cond {
283
- panic!("Oops invariant failed");
299
+ let msg = f();
300
+ panic!("Invariant: {msg}");
301
}
302
Ok(())
303
}
compiler/forget/crates/estree-swc/Cargo.toml
+2
-2
@@ -6,6 +6,6 @@ edition = "2021"
6
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
7
8
[dependencies]
9
-swc_ecma_ast = { version = "0.106.6", features = ["serde", "serde-impl"] }
9
estree = { path = "../estree" }
11
-swc_common = "0.31.16"
10
+swc = "0.264.8"
11
+swc_core = { version = "0.79.9", features = ["swc_ecma_visit", "__ecma_transforms", "swc_ecma_ast", "swc_common", "swc", "swc_ecma_parser", "__ecma", "__common", "ecma_ast", "__visit", "__parser"] }
compiler/forget/crates/estree-swc/src/lib.rs
+43
-6
@@ -1,12 +1,49 @@
1
-use std::num::NonZeroU32;
1
+use std::{io::stderr, num::NonZeroU32, sync::Arc};
2
3
-use swc_common::{source_map::Pos, Span};
4
-use swc_ecma_ast::{
5
- AssignOp, BinaryOp, BlockStmt, Decl, Expr, Ident, Lit, ModuleItem, Pat, PatOrExpr, Program,
6
- Stmt, UnaryOp, VarDeclKind, VarDeclOrExpr,
3
+use swc::Compiler;
4
+use swc_core::common::errors::Handler;
5
+use swc_core::common::source_map::Pos;
6
+use swc_core::common::{FileName, FilePathMapping, Mark, SourceMap, Span, GLOBALS};
7
+use swc_core::ecma::ast::{
8
+ AssignOp, BinaryOp, BlockStmt, Decl, EsVersion, Expr, Ident, Lit, ModuleItem, Pat, PatOrExpr,
9
+ Program, Stmt, UnaryOp, VarDeclKind, VarDeclOrExpr,
10
};
11
+use swc_core::ecma::parser::Syntax;
12
+use swc_core::ecma::transforms::base::resolver;
13
+use swc_core::ecma::visit::FoldWith;
14
9
-pub fn convert_program(program: &Program) -> estree::Program {
15
+/// Parses source text into an estree::Program via SWC, internally performing the parsing
16
+/// and SWC -> ESTree conversion.
17
+pub fn parse(source: &str, file: &str) -> Result<estree::Program, Box<dyn std::error::Error>> {
18
+ GLOBALS.set(&Default::default(), || {
19
+ let cm = Arc::new(SourceMap::new(FilePathMapping::empty()));
20
+ let c = Compiler::new(cm);
21
+ let fm =
22
+ c.cm.new_source_file(FileName::Real(file.into()), source.to_string());
23
+
24
+ let handler = Handler::with_emitter_writer(Box::new(stderr()), Some(c.cm.clone()));
25
+
26
+ let comments = c.comments().clone();
27
+ let module = c.parse_js(
28
+ fm.clone(),
29
+ &handler,
30
+ EsVersion::Es5,
31
+ Syntax::Typescript(Default::default()),
32
+ swc::config::IsModule::Bool(true),
33
+ Some(&comments),
34
+ )?;
35
+
36
+ let module = c.run_transform(&handler, false, || {
37
+ let unresolved_mark = Mark::new();
38
+ let top_level_mark = Mark::new();
39
+ module.fold_with(&mut resolver(unresolved_mark, top_level_mark, true))
40
+ });
41
+
42
+ Ok(convert_program(&module))
43
+ })
44
+}
45
+
46
+fn convert_program(program: &Program) -> estree::Program {
47
let mut program_items: Vec<estree::ModuleItem>;
48
match program {
49
Program::Module(program) => {
compiler/forget/crates/fixtures/Cargo.toml
new
+15
@@ -0,0 +1,15 @@
1
+[package]
2
+name = "fixtures"
3
+version = "0.1.0"
4
+edition = "2021"
5
+publish = false
6
+
7
+# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
8
+
9
+[dependencies]
10
+insta = "1.30.0"
11
+estree = { path = "../estree" }
12
+estree-swc = { path = "../estree-swc" }
13
+hir = { path = "../hir" }
14
+build-hir = { path = "../build-hir" }
15
+bumpalo = { version = "3.13.0", features = ["collections"] }
compiler/forget/crates/fixtures/README.md
new
+3
@@ -0,0 +1,3 @@
1
+# fixtures
2
+
3
+This crate is for tests only, and runs the suite of compiler fixture tests.
\ No newline at end of file
compiler/forget/crates/fixtures/src/lib.rs
new
+1
@@ -0,0 +1 @@
1
+
compiler/forget/crates/fixtures/tests/fixtures/simple.js
new
+4
@@ -0,0 +1,4 @@
1
+function test() {
2
+ [true, false, null, 1, 3.14, "hello world!"];
3
+ return 2;
4
+}
compiler/forget/crates/fixtures/tests/fixtures_test.rs
new
+36
@@ -0,0 +1,36 @@
1
+use build_hir::build;
2
+use bumpalo::Bump;
3
+use estree::{ModuleItem, Statement};
4
+use estree_swc::parse;
5
+use hir::{Environment, Registry};
6
+use insta::{assert_snapshot, glob};
7
+
8
+#[test]
9
+fn fixtures() {
10
+ glob!("fixtures/**.js", |path| {
11
+ let input = std::fs::read_to_string(path).unwrap();
12
+ let ast = parse(&input, path.to_str().unwrap()).unwrap();
13
+
14
+ let mut output = Vec::new();
15
+
16
+ for item in ast.body {
17
+ if let ModuleItem::Statement(stmt) = item {
18
+ if let Statement::FunctionDeclaration(fun) = *stmt {
19
+ let allocator = Bump::new();
20
+ let environment = allocator.alloc(Environment::new(
21
+ &allocator,
22
+ hir::Features {
23
+ validate_frozen_lambdas: true,
24
+ },
25
+ Registry,
26
+ ));
27
+ let hir = build(&environment, *fun).unwrap();
28
+ output.push(format!("{hir:#?}"));
29
+ }
30
+ }
31
+ }
32
+
33
+ let joined = output.join("\n\n");
34
+ assert_snapshot!(format!("Input:\n{input}\n\nOutput:\n{joined}"));
35
+ });
36
+}
compiler/forget/crates/fixtures/tests/snapshots/fixtures_test__fixtures.snap
new
+560
@@ -0,0 +1,560 @@
1
+---
2
+source: crates/fixtures/tests/fixtures_test.rs
3
+expression: "format!(\"Input:\\n{input}\\n\\nOutput:\\n{joined}\")"
4
+input_file: crates/fixtures/tests/fixtures/simple.js
5
+---
6
+Input:
7
+function test() {
8
+ [true, false, null, 1, 3.14, "hello world!"];
9
+ return 2;
10
+}
11
+
12
+
13
+Output:
14
+Function {
15
+ body: HIR {
16
+ entry: BlockId(
17
+ 0,
18
+ ),
19
+ blocks: {
20
+ BlockId(
21
+ 0,
22
+ ): BasicBlock {
23
+ id: BlockId(
24
+ 0,
25
+ ),
26
+ kind: Block,
27
+ instructions: [
28
+ Instruction {
29
+ id: InstructionId(
30
+ 0,
31
+ ),
32
+ lvalue: Place {
33
+ identifier: Identifier {
34
+ id: IdentifierId(
35
+ 0,
36
+ ),
37
+ name: None,
38
+ data: RefCell {
39
+ value: IdentifierData {
40
+ mutable_range: MutableRange {
41
+ start: InstructionId(
42
+ 0,
43
+ ),
44
+ end: InstructionId(
45
+ 0,
46
+ ),
47
+ },
48
+ scope: None,
49
+ type_: Var(
50
+ TypeVarId(
51
+ 0,
52
+ ),
53
+ ),
54
+ },
55
+ },
56
+ },
57
+ effect: None,
58
+ },
59
+ value: Primitive(
60
+ Primitive {
61
+ value: Boolean(
62
+ true,
63
+ ),
64
+ },
65
+ ),
66
+ },
67
+ Instruction {
68
+ id: InstructionId(
69
+ 1,
70
+ ),
71
+ lvalue: Place {
72
+ identifier: Identifier {
73
+ id: IdentifierId(
74
+ 1,
75
+ ),
76
+ name: None,
77
+ data: RefCell {
78
+ value: IdentifierData {
79
+ mutable_range: MutableRange {
80
+ start: InstructionId(
81
+ 0,
82
+ ),
83
+ end: InstructionId(
84
+ 0,
85
+ ),
86
+ },
87
+ scope: None,
88
+ type_: Var(
89
+ TypeVarId(
90
+ 1,
91
+ ),
92
+ ),
93
+ },
94
+ },
95
+ },
96
+ effect: None,
97
+ },
98
+ value: Primitive(
99
+ Primitive {
100
+ value: Boolean(
101
+ false,
102
+ ),
103
+ },
104
+ ),
105
+ },
106
+ Instruction {
107
+ id: InstructionId(
108
+ 2,
109
+ ),
110
+ lvalue: Place {
111
+ identifier: Identifier {
112
+ id: IdentifierId(
113
+ 2,
114
+ ),
115
+ name: None,
116
+ data: RefCell {
117
+ value: IdentifierData {
118
+ mutable_range: MutableRange {
119
+ start: InstructionId(
120
+ 0,
121
+ ),
122
+ end: InstructionId(
123
+ 0,
124
+ ),
125
+ },
126
+ scope: None,
127
+ type_: Var(
128
+ TypeVarId(
129
+ 2,
130
+ ),
131
+ ),
132
+ },
133
+ },
134
+ },
135
+ effect: None,
136
+ },
137
+ value: Primitive(
138
+ Primitive {
139
+ value: Null,
140
+ },
141
+ ),
142
+ },
143
+ Instruction {
144
+ id: InstructionId(
145
+ 3,
146
+ ),
147
+ lvalue: Place {
148
+ identifier: Identifier {
149
+ id: IdentifierId(
150
+ 3,
151
+ ),
152
+ name: None,
153
+ data: RefCell {
154
+ value: IdentifierData {
155
+ mutable_range: MutableRange {
156
+ start: InstructionId(
157
+ 0,
158
+ ),
159
+ end: InstructionId(
160
+ 0,
161
+ ),
162
+ },
163
+ scope: None,
164
+ type_: Var(
165
+ TypeVarId(
166
+ 3,
167
+ ),
168
+ ),
169
+ },
170
+ },
171
+ },
172
+ effect: None,
173
+ },
174
+ value: Primitive(
175
+ Primitive {
176
+ value: Number(
177
+ Number(
178
+ 4607182418800017408,
179
+ ),
180
+ ),
181
+ },
182
+ ),
183
+ },
184
+ Instruction {
185
+ id: InstructionId(
186
+ 4,
187
+ ),
188
+ lvalue: Place {
189
+ identifier: Identifier {
190
+ id: IdentifierId(
191
+ 4,
192
+ ),
193
+ name: None,
194
+ data: RefCell {
195
+ value: IdentifierData {
196
+ mutable_range: MutableRange {
197
+ start: InstructionId(
198
+ 0,
199
+ ),
200
+ end: InstructionId(
201
+ 0,
202
+ ),
203
+ },
204
+ scope: None,
205
+ type_: Var(
206
+ TypeVarId(
207
+ 4,
208
+ ),
209
+ ),
210
+ },
211
+ },
212
+ },
213
+ effect: None,
214
+ },
215
+ value: Primitive(
216
+ Primitive {
217
+ value: Number(
218
+ Number(
219
+ 4614253070214989087,
220
+ ),
221
+ ),
222
+ },
223
+ ),
224
+ },
225
+ Instruction {
226
+ id: InstructionId(
227
+ 5,
228
+ ),
229
+ lvalue: Place {
230
+ identifier: Identifier {
231
+ id: IdentifierId(
232
+ 5,
233
+ ),
234
+ name: None,
235
+ data: RefCell {
236
+ value: IdentifierData {
237
+ mutable_range: MutableRange {
238
+ start: InstructionId(
239
+ 0,
240
+ ),
241
+ end: InstructionId(
242
+ 0,
243
+ ),
244
+ },
245
+ scope: None,
246
+ type_: Var(
247
+ TypeVarId(
248
+ 5,
249
+ ),
250
+ ),
251
+ },
252
+ },
253
+ },
254
+ effect: None,
255
+ },
256
+ value: Primitive(
257
+ Primitive {
258
+ value: String(
259
+ "hello world!",
260
+ ),
261
+ },
262
+ ),
263
+ },
264
+ Instruction {
265
+ id: InstructionId(
266
+ 6,
267
+ ),
268
+ lvalue: Place {
269
+ identifier: Identifier {
270
+ id: IdentifierId(
271
+ 6,
272
+ ),
273
+ name: None,
274
+ data: RefCell {
275
+ value: IdentifierData {
276
+ mutable_range: MutableRange {
277
+ start: InstructionId(
278
+ 0,
279
+ ),
280
+ end: InstructionId(
281
+ 0,
282
+ ),
283
+ },
284
+ scope: None,
285
+ type_: Var(
286
+ TypeVarId(
287
+ 6,
288
+ ),
289
+ ),
290
+ },
291
+ },
292
+ },
293
+ effect: None,
294
+ },
295
+ value: Array(
296
+ Array {
297
+ elements: [
298
+ Place(
299
+ Place {
300
+ identifier: Identifier {
301
+ id: IdentifierId(
302
+ 0,
303
+ ),
304
+ name: None,
305
+ data: RefCell {
306
+ value: IdentifierData {
307
+ mutable_range: MutableRange {
308
+ start: InstructionId(
309
+ 0,
310
+ ),
311
+ end: InstructionId(
312
+ 0,
313
+ ),
314
+ },
315
+ scope: None,
316
+ type_: Var(
317
+ TypeVarId(
318
+ 0,
319
+ ),
320
+ ),
321
+ },
322
+ },
323
+ },
324
+ effect: None,
325
+ },
326
+ ),
327
+ Place(
328
+ Place {
329
+ identifier: Identifier {
330
+ id: IdentifierId(
331
+ 1,
332
+ ),
333
+ name: None,
334
+ data: RefCell {
335
+ value: IdentifierData {
336
+ mutable_range: MutableRange {
337
+ start: InstructionId(
338
+ 0,
339
+ ),
340
+ end: InstructionId(
341
+ 0,
342
+ ),
343
+ },
344
+ scope: None,
345
+ type_: Var(
346
+ TypeVarId(
347
+ 1,
348
+ ),
349
+ ),
350
+ },
351
+ },
352
+ },
353
+ effect: None,
354
+ },
355
+ ),
356
+ Place(
357
+ Place {
358
+ identifier: Identifier {
359
+ id: IdentifierId(
360
+ 2,
361
+ ),
362
+ name: None,
363
+ data: RefCell {
364
+ value: IdentifierData {
365
+ mutable_range: MutableRange {
366
+ start: InstructionId(
367
+ 0,
368
+ ),
369
+ end: InstructionId(
370
+ 0,
371
+ ),
372
+ },
373
+ scope: None,
374
+ type_: Var(
375
+ TypeVarId(
376
+ 2,
377
+ ),
378
+ ),
379
+ },
380
+ },
381
+ },
382
+ effect: None,
383
+ },
384
+ ),
385
+ Place(
386
+ Place {
387
+ identifier: Identifier {
388
+ id: IdentifierId(
389
+ 3,
390
+ ),
391
+ name: None,
392
+ data: RefCell {
393
+ value: IdentifierData {
394
+ mutable_range: MutableRange {
395
+ start: InstructionId(
396
+ 0,
397
+ ),
398
+ end: InstructionId(
399
+ 0,
400
+ ),
401
+ },
402
+ scope: None,
403
+ type_: Var(
404
+ TypeVarId(
405
+ 3,
406
+ ),
407
+ ),
408
+ },
409
+ },
410
+ },
411
+ effect: None,
412
+ },
413
+ ),
414
+ Place(
415
+ Place {
416
+ identifier: Identifier {
417
+ id: IdentifierId(
418
+ 4,
419
+ ),
420
+ name: None,
421
+ data: RefCell {
422
+ value: IdentifierData {
423
+ mutable_range: MutableRange {
424
+ start: InstructionId(
425
+ 0,
426
+ ),
427
+ end: InstructionId(
428
+ 0,
429
+ ),
430
+ },
431
+ scope: None,
432
+ type_: Var(
433
+ TypeVarId(
434
+ 4,
435
+ ),
436
+ ),
437
+ },
438
+ },
439
+ },
440
+ effect: None,
441
+ },
442
+ ),
443
+ Place(
444
+ Place {
445
+ identifier: Identifier {
446
+ id: IdentifierId(
447
+ 5,
448
+ ),
449
+ name: None,
450
+ data: RefCell {
451
+ value: IdentifierData {
452
+ mutable_range: MutableRange {
453
+ start: InstructionId(
454
+ 0,
455
+ ),
456
+ end: InstructionId(
457
+ 0,
458
+ ),
459
+ },
460
+ scope: None,
461
+ type_: Var(
462
+ TypeVarId(
463
+ 5,
464
+ ),
465
+ ),
466
+ },
467
+ },
468
+ },
469
+ effect: None,
470
+ },
471
+ ),
472
+ ],
473
+ },
474
+ ),
475
+ },
476
+ Instruction {
477
+ id: InstructionId(
478
+ 7,
479
+ ),
480
+ lvalue: Place {
481
+ identifier: Identifier {
482
+ id: IdentifierId(
483
+ 7,
484
+ ),
485
+ name: None,
486
+ data: RefCell {
487
+ value: IdentifierData {
488
+ mutable_range: MutableRange {
489
+ start: InstructionId(
490
+ 0,
491
+ ),
492
+ end: InstructionId(
493
+ 0,
494
+ ),
495
+ },
496
+ scope: None,
497
+ type_: Var(
498
+ TypeVarId(
499
+ 7,
500
+ ),
501
+ ),
502
+ },
503
+ },
504
+ },
505
+ effect: None,
506
+ },
507
+ value: Primitive(
508
+ Primitive {
509
+ value: Number(
510
+ Number(
511
+ 4611686018427387904,
512
+ ),
513
+ ),
514
+ },
515
+ ),
516
+ },
517
+ ],
518
+ terminal: Terminal {
519
+ id: InstructionId(
520
+ 8,
521
+ ),
522
+ value: ReturnTerminal(
523
+ ReturnTerminal {
524
+ value: Place {
525
+ identifier: Identifier {
526
+ id: IdentifierId(
527
+ 7,
528
+ ),
529
+ name: None,
530
+ data: RefCell {
531
+ value: IdentifierData {
532
+ mutable_range: MutableRange {
533
+ start: InstructionId(
534
+ 0,
535
+ ),
536
+ end: InstructionId(
537
+ 0,
538
+ ),
539
+ },
540
+ scope: None,
541
+ type_: Var(
542
+ TypeVarId(
543
+ 7,
544
+ ),
545
+ ),
546
+ },
547
+ },
548
+ },
549
+ effect: None,
550
+ },
551
+ },
552
+ ),
553
+ },
554
+ predecessors: {},
555
+ },
556
+ },
557
+ },
558
+ is_async: false,
559
+ is_generator: false,
560
+}
compiler/forget/crates/hir/src/basic_block.rs
+2
@@ -8,6 +8,7 @@ use crate::{id_types::BlockId, Instruction, Terminal};
8
/// continue.
9
///
10
/// [1] Assuming no exceptions are thrown.
11
+#[derive(Debug)]
12
pub struct BasicBlock<'a> {
13
/// The identifier for the block
14
pub id: BlockId,
@@ -28,6 +29,7 @@ pub struct BasicBlock<'a> {
29
pub predecessors: HashSet<BlockId>,
30
}
31
32
+#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
33
pub enum BlockKind {
34
Block,
35
Value,
compiler/forget/crates/hir/src/function.rs
+2
@@ -3,6 +3,7 @@ use indexmap::IndexMap;
3
use crate::{BasicBlock, BlockId};
4
5
/// Represents either a React function or a function expression
6
+#[derive(Debug)]
7
pub struct Function<'a> {
8
pub body: HIR<'a>,
9
pub is_async: bool,
@@ -13,6 +14,7 @@ pub struct Function<'a> {
14
/// Blocks are stored in reverse postorder (predecessors before successors)
15
/// so that compiler passes can complete forward data flow analysis in a
16
/// single pass over the CFG in the case where there are no loops.
17
+#[derive(Debug)]
18
pub struct HIR<'a> {
19
/// The id of the first block
20
pub entry: BlockId,
compiler/forget/crates/hir/src/id_types.rs
+4
@@ -39,6 +39,7 @@ impl TypeVarId {
39
///
40
/// TODO: rename to more clearly indicate that this is for sequencing
41
/// and to reflect that it is applied to terminals as well
42
+#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Hash, Debug)]
43
pub struct InstructionId(pub(crate) u32);
44
45
pub struct InstructionIdGenerator(u32);
@@ -56,10 +57,13 @@ impl InstructionIdGenerator {
57
}
58
59
/// Uniquely identifies a reactive scope
60
+#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Hash, Debug)]
61
pub struct ScopeId(pub(crate) u32);
62
63
/// Uniquely identifiers a builtin function type in the type registry
64
+#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Hash, Debug)]
65
pub struct FunctionId(pub(crate) u32);
66
67
/// Uniquely identifiers a builtin object type in the type registry
68
+#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Hash, Debug)]
69
pub struct ObjectId(pub(crate) u32);
compiler/forget/crates/hir/src/instruction.rs
+19
-3
@@ -4,12 +4,14 @@ use bumpalo::collections::{String, Vec};
4
5
use crate::{IdentifierId, InstructionId, ScopeId, Type};
6
7
+#[derive(Debug)]
8
pub struct Instruction<'a> {
9
pub id: InstructionId,
10
pub lvalue: Place<'a>,
11
pub value: InstructionValue<'a>,
12
}
13
14
+#[derive(Debug)]
15
pub enum InstructionValue<'a> {
16
Array(Array<'a>),
17
// Await(Await<'a>),
@@ -46,19 +48,23 @@ pub enum InstructionValue<'a> {
48
// Unsupported(Unsupported<'a>),
49
}
50
51
+#[derive(Debug)]
52
pub struct Array<'a> {
53
pub elements: Vec<'a, ArrayElement<'a>>,
54
}
55
56
+#[derive(Debug)]
57
pub enum ArrayElement<'a> {
58
Place(Place<'a>),
59
Spread(Place<'a>),
60
}
61
62
+#[derive(Debug)]
63
pub struct Primitive<'a> {
64
pub value: PrimitiveValue<'a>,
65
}
66
67
+#[derive(Debug)]
68
pub enum PrimitiveValue<'a> {
69
Boolean(bool),
70
Null,
@@ -84,38 +90,45 @@ impl From<Number> for f64 {
90
}
91
}
92
93
+#[derive(Debug)]
94
pub struct LoadLocal<'a> {
95
pub place: Place<'a>,
96
}
97
98
+#[derive(Debug)]
99
pub struct LoadContext<'a> {
100
pub place: Place<'a>,
101
}
102
103
+#[derive(Debug)]
104
pub struct DeclareLocal<'a> {
105
pub lvalue: LValue<'a>,
106
}
107
108
+#[derive(Debug)]
109
pub struct DeclareContext<'a> {
110
pub lvalue: LValue<'a>, // note: kind must be InstructionKind::Let
111
}
112
113
+#[derive(Debug)]
114
pub struct StoreLocal<'a> {
115
pub lvalue: LValue<'a>,
116
pub value: Place<'a>,
117
}
118
108
-#[derive(Clone)]
119
+#[derive(Clone, Debug)]
120
pub struct Place<'a> {
121
pub identifier: Identifier<'a>,
122
pub effect: Option<Effect>,
123
}
124
125
+#[derive(Debug)]
126
pub struct LValue<'a> {
127
pub place: Place<'a>,
128
pub kind: InstructionKind,
129
}
130
131
+#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
132
pub enum InstructionKind {
133
/// `const` declaration
134
Const,
@@ -127,7 +140,7 @@ pub enum InstructionKind {
140
Reassign,
141
}
142
130
-#[derive(Clone, Copy, PartialEq, Eq, Debug)]
143
+#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
144
pub enum Effect {
145
/// This reference freezes the value (corresponds to a place where codegen should emit a freeze instruction)
146
Freeze,
@@ -163,7 +176,7 @@ impl Effect {
176
}
177
}
178
166
-#[derive(Clone)]
179
+#[derive(Clone, Debug)]
180
pub struct Identifier<'a> {
181
/// Uniquely identifiers this identifier
182
pub id: IdentifierId,
@@ -172,6 +185,7 @@ pub struct Identifier<'a> {
185
pub data: Rc<RefCell<IdentifierData>>,
186
}
187
188
+#[derive(Debug)]
189
pub struct IdentifierData {
190
pub mutable_range: MutableRange,
191
@@ -185,6 +199,7 @@ pub struct IdentifierData {
199
///
200
/// Start is inclusive, end is exclusive (ie end is the "first" instruction
201
/// for which the value is not mutable).
202
+#[derive(Clone, Debug)]
203
pub struct MutableRange {
204
/// start of the range, inclusive.
205
pub start: InstructionId,
@@ -208,6 +223,7 @@ impl Default for MutableRange {
223
}
224
}
225
226
+#[derive(Clone, Debug)]
227
pub struct ReactiveScope {
228
pub id: ScopeId,
229
pub range: MutableRange,
compiler/forget/crates/hir/src/terminal.rs
+8
-1
@@ -2,11 +2,13 @@ use crate::{instruction::Place, BlockId, InstructionId};
2
3
/// Terminals represent statements or expressions that affect control flow,
4
/// such as for-of, if-else, return, logical (??), ternaries (?:), etc.
5
+#[derive(Debug)]
6
pub struct Terminal<'a> {
7
pub id: InstructionId,
8
pub value: TerminalValue<'a>,
9
}
10
11
+#[derive(Debug)]
12
pub enum TerminalValue<'a> {
13
// BranchTerminal(BranchTerminal),
14
DoWhileTerminal(DoWhileTerminal),
@@ -69,23 +71,26 @@ impl<'a> TerminalValue<'a> {
71
}
72
}
73
74
+#[derive(Debug)]
75
pub struct GotoTerminal {
76
pub block: BlockId,
77
pub kind: GotoKind,
78
}
79
77
-#[derive(Clone, Copy)]
80
+#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
81
pub enum GotoKind {
82
Break,
83
Continue,
84
}
85
86
+#[derive(Debug)]
87
pub struct DoWhileTerminal {
88
pub body: BlockId,
89
pub test: BlockId,
90
pub fallthrough: BlockId,
91
}
92
93
+#[derive(Debug)]
94
pub struct IfTerminal<'a> {
95
pub test: Place<'a>,
96
pub consequent: BlockId,
@@ -93,10 +98,12 @@ pub struct IfTerminal<'a> {
98
pub fallthrough: Option<BlockId>,
99
}
100
101
+#[derive(Debug)]
102
pub struct ReturnTerminal<'a> {
103
pub value: Place<'a>,
104
}
105
106
+#[derive(Debug)]
107
pub struct ForTerminal {
108
pub init: BlockId,
109
pub test: BlockId,
compiler/forget/crates/hir/src/types.rs
+2
@@ -1,5 +1,6 @@
1
use crate::{FunctionId, ObjectId, TypeVarId};
2
3
+#[derive(Debug)]
4
pub enum Type {
5
Builtin(BuiltinType),
6
// Phi(Box<PhiType>),
@@ -8,6 +9,7 @@ pub enum Type {
9
// Prop(Box<PropType>),
10
}
11
12
+#[derive(Debug)]
13
pub enum BuiltinType {
14
Primitive,
15
Function(Option<FunctionId>),
compiler/forget/rust-toolchain.toml
new
+3
@@ -0,0 +1,3 @@
1
+[toolchain]
2
+# Sigh, because SWC
3
+channel = "nightly"
\ No newline at end of file