diff --git a/packages/next-swc/Cargo.lock b/packages/next-swc/Cargo.lock index 8b57fb6ae3..bc2b367fb1 100644 --- a/packages/next-swc/Cargo.lock +++ b/packages/next-swc/Cargo.lock @@ -234,7 +234,7 @@ checksum = "0e97ce7de6cf12de5d7226c73f5ba9811622f4db3a5b91b55c53e987e5f91cba" dependencies = [ "proc-macro2", "quote", - "syn 2.0.7", + "syn 2.0.8", ] [[package]] @@ -300,7 +300,7 @@ checksum = "86ea188f25f0255d8f92797797c97ebf5631fa88178beb1a46fdf5622c9a00e4" dependencies = [ "proc-macro2", "quote", - "syn 2.0.7", + "syn 2.0.8", ] [[package]] @@ -337,7 +337,7 @@ dependencies = [ [[package]] name = "auto-hash-map" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230323.1#40ba20ba0939a19598a25d435b7c9396ecfb15c1" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230323.3#f11b983fb08dfc7c66b538c3815e9a0a7e972a84" dependencies = [ "serde", ] @@ -889,6 +889,26 @@ version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fbdcdcb6d86f71c5e97409ad45898af11cbc995b4ee8112d59095a28d376c935" +[[package]] +name = "const_format" +version = "0.2.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7309d9b4d3d2c0641e018d449232f2e28f1b22933c137f157d3dbc14228b8c0e" +dependencies = [ + "const_format_proc_macros", +] + +[[package]] +name = "const_format_proc_macros" +version = "0.2.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d897f47bf7270cf70d370f8f98c1abb6d2d4cf60a6845d30e05bfb90c6568650" +dependencies = [ + "proc-macro2", + "quote", + "unicode-xid", +] + [[package]] name = "constant_time_eq" version = "0.2.5" @@ -1180,9 +1200,9 @@ dependencies = [ [[package]] name = "curl-sys" -version = "0.4.61+curl-8.0.1" +version = "0.4.60+curl-7.88.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14d05c10f541ae6f3bc5b3d923c20001f47db7d5f0b2bc6ad16490133842db79" +checksum = "717abe2cb465a5da6ce06617388a3980c9a2844196734bec8ccb8e575250f13f" dependencies = [ "cc", "libc", @@ -1218,7 +1238,7 @@ dependencies = [ "proc-macro2", "quote", "scratch", - "syn 2.0.7", + "syn 2.0.8", ] [[package]] @@ -1235,7 +1255,7 @@ checksum = "631569015d0d8d54e6c241733f944042623ab6df7bc3be7466874b05fcdb1c5f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.7", + "syn 2.0.8", ] [[package]] @@ -3261,7 +3281,7 @@ dependencies = [ [[package]] name = "node-file-trace" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230323.1#40ba20ba0939a19598a25d435b7c9396ecfb15c1" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230323.3#f11b983fb08dfc7c66b538c3815e9a0a7e972a84" dependencies = [ "anyhow", "clap 4.1.11", @@ -4476,7 +4496,7 @@ checksum = "e801c1712f48475582b7696ac71e0ca34ebb30e09338425384269d9717c62cad" dependencies = [ "proc-macro2", "quote", - "syn 2.0.7", + "syn 2.0.8", ] [[package]] @@ -4936,9 +4956,9 @@ dependencies = [ [[package]] name = "swc" -version = "0.255.21" +version = "0.255.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "630a74e8f8b5345225ea4829c588fde46c5031ac06a32e5a0425573746bcc902" +checksum = "23d93b381ac343f8548ef10a400aaf91604e94258e5c11753cece061275ed4c1" dependencies = [ "ahash", "anyhow", @@ -5290,9 +5310,9 @@ dependencies = [ [[package]] name = "swc_ecma_ast" -version = "0.100.2" +version = "0.100.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e636d10ea834f572d8e1b5e87eb9eae830f2e9fa1ebdad24d75501753351bea" +checksum = "6b135a8de6b20bcc99711a95e6c7c2ffd75e2ce7ef530e67eec4093bd3d063e0" dependencies = [ "bitflags 1.3.2", "is-macro", @@ -5308,9 +5328,9 @@ dependencies = [ [[package]] name = "swc_ecma_codegen" -version = "0.135.7" +version = "0.135.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ebb4d7ab6fc44de75644847314390517c3a9ee2e8e548498de1e2d3fe67bf3b" +checksum = "5eea38f0aa2bdafb48927cb30a714ad6cc27c17cd40a867ab1f2c0782e6080e6" dependencies = [ "memchr", "num-bigint", @@ -5340,9 +5360,9 @@ dependencies = [ [[package]] name = "swc_ecma_ext_transforms" -version = "0.99.7" +version = "0.99.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75b36dabcf256f051da0dbf85bd8f21f9676225f339cf2f5e7024ac9797d3b91" +checksum = "bdc9c335e425617120ec2f2af01c59541571afd7d834b9d7c312faf9d8acc7c4" dependencies = [ "phf", "swc_atoms", @@ -5354,9 +5374,9 @@ dependencies = [ [[package]] name = "swc_ecma_lints" -version = "0.77.12" +version = "0.77.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bfa431594cf0aeaf183e2044cda25a34d9d956b8259d681de2de36b624ffc3a" +checksum = "463fd2faab68aad3197670627ec7d9a9250cfe28641afa8a8c7aa8d21d6014df" dependencies = [ "ahash", "auto_impl", @@ -5397,9 +5417,9 @@ dependencies = [ [[package]] name = "swc_ecma_minifier" -version = "0.175.17" +version = "0.175.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba83fba738f445e9dd5b053e8eb9d6296590df7aa4b27b43bd83dd76d72dd471" +checksum = "89c2cd0cb9f66b75be8ba3ae6122a7989afe0f45af5ea72a1ab6755240e6183c" dependencies = [ "ahash", "arrayvec", @@ -5433,9 +5453,9 @@ dependencies = [ [[package]] name = "swc_ecma_parser" -version = "0.130.6" +version = "0.130.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d9734a65e45f866fb35a89a340fedb4405d23ecd33e6c565065d47bc8af86ba" +checksum = "b79a4d3b941551a586d2dc06bd05ef654e500ce1e1da2425a3a97b98cecd282b" dependencies = [ "either", "enum_kind", @@ -5454,9 +5474,9 @@ dependencies = [ [[package]] name = "swc_ecma_preset_env" -version = "0.189.15" +version = "0.189.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32245446715276f550043f832c6b97b9150ddb1673438e069f2284ea165c7c4b" +checksum = "33f5d2be1bdf27dec511d2108c0bc25f0f955a248b2d307b352a45eac7fcf117" dependencies = [ "ahash", "anyhow", @@ -5479,9 +5499,9 @@ dependencies = [ [[package]] name = "swc_ecma_quote_macros" -version = "0.41.6" +version = "0.41.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a67a54c53456110664db461edbe3954ca372827048369306a825386c9186795" +checksum = "0bf398b83e9b77ee80fca2bb079cd3495f3d2e1b52ccb7645f1b33b395d6410e" dependencies = [ "anyhow", "pmutil", @@ -5509,9 +5529,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms" -version = "0.212.15" +version = "0.212.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a4450231e31c1aa5c7c45db367bc0ef1ad6d81952b011ce7fd672897624cf6e" +checksum = "ad7490393ee05987fe77719bd965ce853f760e20dac1dab53129b8d636dc46c1" dependencies = [ "swc_atoms", "swc_common", @@ -5529,9 +5549,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_base" -version = "0.122.12" +version = "0.122.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "476c98b881033f14d66f4217a27e13749faf901960a798886ccc3dea70f291db" +checksum = "96253f9d410d18a9aae6c7f59ddc697dd78dcd130f5d1a8750cc5b8f5d71472e" dependencies = [ "better_scoped_tls", "bitflags 1.3.2", @@ -5553,9 +5573,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_classes" -version = "0.111.12" +version = "0.111.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3554cfcf434703f324683f9b6d13777d1fbdcd87d1db8f8c8cfc33bc400d819d" +checksum = "3fc315b53be4d9004134001b46258b32fee64ebc5dd964f72c2b1258324246a7" dependencies = [ "swc_atoms", "swc_common", @@ -5567,9 +5587,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_compat" -version = "0.148.14" +version = "0.148.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cbe71e817be88a85899b8891fbeac36c68749b02e454c4c529001e39e7dbfcc" +checksum = "b5a1a4a3c413bfd03e38e8ee9fb9bb761f478ebe4f8b1f51e154375fcc1ca17a" dependencies = [ "ahash", "arrayvec", @@ -5607,9 +5627,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_module" -version = "0.165.14" +version = "0.165.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a91b9f29345a403d287a8fc36120d32b5c632a234148db94e214a33dacd445bd" +checksum = "8f53c50506abc0db9a768b190d28dbc6968844d6f6f7fe98967f01bf4c0890ba" dependencies = [ "Inflector", "ahash", @@ -5635,9 +5655,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_optimization" -version = "0.181.15" +version = "0.181.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a4d72e0552f6d81f9903a282b00ab4f1747d488c0574450698d1b4aa9b284e4" +checksum = "08181f21f6bafb718ef3bed83817545f53af69852550177de19cc20d618a95b7" dependencies = [ "ahash", "dashmap", @@ -5661,9 +5681,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_proposal" -version = "0.156.14" +version = "0.156.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2bfd6afb5a17c971dbfb82a4675e1e33aab2bce6deba2dfc499cc468f9d6940" +checksum = "478c09b747e7829d22f6fe393fb002487133483967d4bd051d9b69a1d5d65a8a" dependencies = [ "either", "serde", @@ -5680,9 +5700,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_react" -version = "0.167.15" +version = "0.167.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "589df42a8ff3681f81fef1487e2ee9ed90da7826d24bddce7dd5e65e43b31946" +checksum = "a423b55598ab93ecd4e2a232b9f9a33a0e742b9ba2229a00972ead82bf0a6693" dependencies = [ "ahash", "base64 0.13.1", @@ -5733,9 +5753,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_typescript" -version = "0.171.15" +version = "0.171.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89e8710b64100c931450acfe2a04cee6c31dee43e38b7695b6d69b9572bc67c7" +checksum = "39ba6c548f2b4ad7e1b71c85c4771242a800886547933129f41a7877a5c47332" dependencies = [ "serde", "swc_atoms", @@ -5749,9 +5769,9 @@ dependencies = [ [[package]] name = "swc_ecma_usage_analyzer" -version = "0.9.8" +version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0be7ba013e93d1907522e76205af72a00b91120c6d328ba89e64fea7bfca1e" +checksum = "0ab0dcc471e8a980062c21257070ed522f48e77f83e61f2522f8a26f96f6ce89" dependencies = [ "ahash", "indexmap", @@ -5767,9 +5787,9 @@ dependencies = [ [[package]] name = "swc_ecma_utils" -version = "0.113.7" +version = "0.113.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3aa6814656d8ff0f6afe8133bcb89e43d7907d2d8ac939e9ccd88372cd2f8b97" +checksum = "6d422284424a29a95ce5d896ab4f8da35316cd0291e15759c0aae30abd2947be" dependencies = [ "indexmap", "num_cpus", @@ -5786,9 +5806,9 @@ dependencies = [ [[package]] name = "swc_ecma_visit" -version = "0.86.3" +version = "0.86.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bdd22762d52cf9bd3ea56429e1a39e0200632861bbbbd02e6e0b300a0be0fb8" +checksum = "2cb3aaa504f9a520cb73e8d361d30aaceeb8643cc2f048e0dc1808d213ef76a9" dependencies = [ "num-bigint", "swc_atoms", @@ -5916,9 +5936,9 @@ dependencies = [ [[package]] name = "swc_plugin_proxy" -version = "0.29.2" +version = "0.29.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "686b0830dda2e063168170b4cfde1dfda2bde6167a5acf7df0351c21cd27454f" +checksum = "eb64bf10458ef02e97ca7e43b75a3519373f97bf77728c50148799d87a14658c" dependencies = [ "better_scoped_tls", "rkyv", @@ -5930,9 +5950,9 @@ dependencies = [ [[package]] name = "swc_plugin_runner" -version = "0.91.6" +version = "0.91.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a516f50b22af99ace3d7149a644d9dd9f06d84bff07c1474072b90d0e47ddcde" +checksum = "1c790a1870b2f5460f72622ff7a2f72c16597608683e3bfa7feb762bc6392df0" dependencies = [ "anyhow", "enumset", @@ -5953,9 +5973,9 @@ dependencies = [ [[package]] name = "swc_timer" -version = "0.17.40" +version = "0.17.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8bf7db20a9aca571d89bf052fc1fc419caeb98963ca9c63d1ca7a1b8c67ff9f" +checksum = "d11afada7873b24725061271e1b3e49f2f8f625535fee2b4c55603b6f1a5fa0b" dependencies = [ "tracing", ] @@ -6008,9 +6028,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.7" +version = "2.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a9a90d19f27bb60792270bb90225f96d97fc5705395134b2ca1dcbb3acc27f4" +checksum = "bcc02725fd69ab9f26eab07fad303e2497fad6fb9eba4f96c4d1687bdf704ad9" dependencies = [ "proc-macro2", "quote", @@ -6082,9 +6102,9 @@ dependencies = [ [[package]] name = "testing_macros" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6d536c776d47c59f8f47fbf4e7062b23095be9fce218d11d9c9fb988b579dfa" +checksum = "a5315a85a7262fe1a8898890b616de62c152dd43cb5974752c0927aaabe48891" dependencies = [ "anyhow", "glob", @@ -6131,7 +6151,7 @@ checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.7", + "syn 2.0.8", ] [[package]] @@ -6580,7 +6600,7 @@ dependencies = [ [[package]] name = "turbo-malloc" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230323.1#40ba20ba0939a19598a25d435b7c9396ecfb15c1" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230323.3#f11b983fb08dfc7c66b538c3815e9a0a7e972a84" dependencies = [ "mimalloc", ] @@ -6588,7 +6608,7 @@ dependencies = [ [[package]] name = "turbo-tasks" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230323.1#40ba20ba0939a19598a25d435b7c9396ecfb15c1" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230323.3#f11b983fb08dfc7c66b538c3815e9a0a7e972a84" dependencies = [ "anyhow", "auto-hash-map", @@ -6618,7 +6638,7 @@ dependencies = [ [[package]] name = "turbo-tasks-build" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230323.1#40ba20ba0939a19598a25d435b7c9396ecfb15c1" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230323.3#f11b983fb08dfc7c66b538c3815e9a0a7e972a84" dependencies = [ "anyhow", "cargo-lock", @@ -6630,7 +6650,7 @@ dependencies = [ [[package]] name = "turbo-tasks-bytes" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230323.1#40ba20ba0939a19598a25d435b7c9396ecfb15c1" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230323.3#f11b983fb08dfc7c66b538c3815e9a0a7e972a84" dependencies = [ "anyhow", "bytes", @@ -6645,7 +6665,7 @@ dependencies = [ [[package]] name = "turbo-tasks-env" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230323.1#40ba20ba0939a19598a25d435b7c9396ecfb15c1" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230323.3#f11b983fb08dfc7c66b538c3815e9a0a7e972a84" dependencies = [ "anyhow", "dotenvy", @@ -6659,7 +6679,7 @@ dependencies = [ [[package]] name = "turbo-tasks-fetch" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230323.1#40ba20ba0939a19598a25d435b7c9396ecfb15c1" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230323.3#f11b983fb08dfc7c66b538c3815e9a0a7e972a84" dependencies = [ "anyhow", "indexmap", @@ -6676,7 +6696,7 @@ dependencies = [ [[package]] name = "turbo-tasks-fs" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230323.1#40ba20ba0939a19598a25d435b7c9396ecfb15c1" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230323.3#f11b983fb08dfc7c66b538c3815e9a0a7e972a84" dependencies = [ "anyhow", "auto-hash-map", @@ -6705,7 +6725,7 @@ dependencies = [ [[package]] name = "turbo-tasks-hash" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230323.1#40ba20ba0939a19598a25d435b7c9396ecfb15c1" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230323.3#f11b983fb08dfc7c66b538c3815e9a0a7e972a84" dependencies = [ "base16", "hex", @@ -6717,7 +6737,7 @@ dependencies = [ [[package]] name = "turbo-tasks-macros" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230323.1#40ba20ba0939a19598a25d435b7c9396ecfb15c1" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230323.3#f11b983fb08dfc7c66b538c3815e9a0a7e972a84" dependencies = [ "anyhow", "convert_case 0.6.0", @@ -6731,7 +6751,7 @@ dependencies = [ [[package]] name = "turbo-tasks-macros-shared" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230323.1#40ba20ba0939a19598a25d435b7c9396ecfb15c1" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230323.3#f11b983fb08dfc7c66b538c3815e9a0a7e972a84" dependencies = [ "proc-macro2", "quote", @@ -6741,7 +6761,7 @@ dependencies = [ [[package]] name = "turbo-tasks-memory" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230323.1#40ba20ba0939a19598a25d435b7c9396ecfb15c1" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230323.3#f11b983fb08dfc7c66b538c3815e9a0a7e972a84" dependencies = [ "anyhow", "auto-hash-map", @@ -6763,7 +6783,7 @@ dependencies = [ [[package]] name = "turbo-tasks-testing" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230323.1#40ba20ba0939a19598a25d435b7c9396ecfb15c1" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230323.3#f11b983fb08dfc7c66b538c3815e9a0a7e972a84" dependencies = [ "anyhow", "auto-hash-map", @@ -6775,7 +6795,7 @@ dependencies = [ [[package]] name = "turbopack" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230323.1#40ba20ba0939a19598a25d435b7c9396ecfb15c1" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230323.3#f11b983fb08dfc7c66b538c3815e9a0a7e972a84" dependencies = [ "anyhow", "async-recursion", @@ -6801,7 +6821,7 @@ dependencies = [ [[package]] name = "turbopack-cli-utils" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230323.1#40ba20ba0939a19598a25d435b7c9396ecfb15c1" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230323.3#f11b983fb08dfc7c66b538c3815e9a0a7e972a84" dependencies = [ "anyhow", "clap 4.1.11", @@ -6817,7 +6837,7 @@ dependencies = [ [[package]] name = "turbopack-core" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230323.1#40ba20ba0939a19598a25d435b7c9396ecfb15c1" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230323.3#f11b983fb08dfc7c66b538c3815e9a0a7e972a84" dependencies = [ "anyhow", "async-trait", @@ -6844,7 +6864,7 @@ dependencies = [ [[package]] name = "turbopack-create-test-app" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230323.1#40ba20ba0939a19598a25d435b7c9396ecfb15c1" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230323.3#f11b983fb08dfc7c66b538c3815e9a0a7e972a84" dependencies = [ "anyhow", "clap 4.1.11", @@ -6857,7 +6877,7 @@ dependencies = [ [[package]] name = "turbopack-css" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230323.1#40ba20ba0939a19598a25d435b7c9396ecfb15c1" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230323.3#f11b983fb08dfc7c66b538c3815e9a0a7e972a84" dependencies = [ "anyhow", "async-trait", @@ -6879,7 +6899,7 @@ dependencies = [ [[package]] name = "turbopack-dev" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230323.1#40ba20ba0939a19598a25d435b7c9396ecfb15c1" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230323.3#f11b983fb08dfc7c66b538c3815e9a0a7e972a84" dependencies = [ "anyhow", "indexmap", @@ -6898,7 +6918,7 @@ dependencies = [ [[package]] name = "turbopack-dev-server" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230323.1#40ba20ba0939a19598a25d435b7c9396ecfb15c1" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230323.3#f11b983fb08dfc7c66b538c3815e9a0a7e972a84" dependencies = [ "anyhow", "async-compression", @@ -6932,7 +6952,7 @@ dependencies = [ [[package]] name = "turbopack-ecmascript" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230323.1#40ba20ba0939a19598a25d435b7c9396ecfb15c1" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230323.3#f11b983fb08dfc7c66b538c3815e9a0a7e972a84" dependencies = [ "anyhow", "async-trait", @@ -6967,7 +6987,7 @@ dependencies = [ [[package]] name = "turbopack-env" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230323.1#40ba20ba0939a19598a25d435b7c9396ecfb15c1" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230323.3#f11b983fb08dfc7c66b538c3815e9a0a7e972a84" dependencies = [ "anyhow", "serde", @@ -6982,7 +7002,7 @@ dependencies = [ [[package]] name = "turbopack-json" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230323.1#40ba20ba0939a19598a25d435b7c9396ecfb15c1" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230323.3#f11b983fb08dfc7c66b538c3815e9a0a7e972a84" dependencies = [ "anyhow", "serde", @@ -6997,7 +7017,7 @@ dependencies = [ [[package]] name = "turbopack-mdx" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230323.1#40ba20ba0939a19598a25d435b7c9396ecfb15c1" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230323.3#f11b983fb08dfc7c66b538c3815e9a0a7e972a84" dependencies = [ "anyhow", "mdxjs", @@ -7012,15 +7032,19 @@ dependencies = [ [[package]] name = "turbopack-node" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230323.1#40ba20ba0939a19598a25d435b7c9396ecfb15c1" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230323.3#f11b983fb08dfc7c66b538c3815e9a0a7e972a84" dependencies = [ "anyhow", "async-stream", "bytes", + "const_format", "futures", "futures-retry", "indexmap", "mime", + "once_cell", + "owo-colors", + "regex", "serde", "serde_json", "serde_qs", @@ -7031,6 +7055,7 @@ dependencies = [ "turbo-tasks-env", "turbo-tasks-fs", "turbo-tasks-hash", + "turbopack-cli-utils", "turbopack-core", "turbopack-dev-server", "turbopack-ecmascript", @@ -7041,7 +7066,7 @@ dependencies = [ [[package]] name = "turbopack-static" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230323.1#40ba20ba0939a19598a25d435b7c9396ecfb15c1" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230323.3#f11b983fb08dfc7c66b538c3815e9a0a7e972a84" dependencies = [ "anyhow", "serde", @@ -7057,7 +7082,7 @@ dependencies = [ [[package]] name = "turbopack-swc-utils" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230323.1#40ba20ba0939a19598a25d435b7c9396ecfb15c1" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230323.3#f11b983fb08dfc7c66b538c3815e9a0a7e972a84" dependencies = [ "swc_core", "turbo-tasks", @@ -7068,7 +7093,7 @@ dependencies = [ [[package]] name = "turbopack-test-utils" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230323.1#40ba20ba0939a19598a25d435b7c9396ecfb15c1" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-230323.3#f11b983fb08dfc7c66b538c3815e9a0a7e972a84" dependencies = [ "anyhow", "once_cell", @@ -7086,7 +7111,7 @@ version = "1.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" dependencies = [ - "cfg-if 1.0.0", + "cfg-if 0.1.10", "rand", "static_assertions", ] @@ -7176,6 +7201,12 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" +[[package]] +name = "unicode-xid" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" + [[package]] name = "unsafe-libyaml" version = "0.2.7" diff --git a/packages/next-swc/Cargo.toml b/packages/next-swc/Cargo.toml index 1c1c6efea6..ed4e235d13 100644 --- a/packages/next-swc/Cargo.toml +++ b/packages/next-swc/Cargo.toml @@ -46,38 +46,38 @@ swc_emotion = { version = "0.29.10" } testing = { version = "0.31.31" } # Turbo crates -auto-hash-map = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230323.1" } -node-file-trace = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230323.1" } -swc-ast-explorer = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230323.1" } -turbo-malloc = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230323.1", default-features = false } -turbo-tasks = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230323.1" } -turbo-tasks-build = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230323.1" } -turbo-tasks-bytes = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230323.1" } -turbo-tasks-env = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230323.1" } -turbo-tasks-fetch = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230323.1", default-features = false } -turbo-tasks-fs = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230323.1" } -turbo-tasks-hash = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230323.1" } -turbo-tasks-macros = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230323.1" } -turbo-tasks-macros-shared = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230323.1" } -turbo-tasks-memory = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230323.1" } -turbo-tasks-testing = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230323.1" } -turbo-updater = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230323.1" } -turbopack = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230323.1" } -turbopack-cli-utils = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230323.1" } -turbopack-core = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230323.1" } -turbopack-create-test-app = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230323.1" } -turbopack-css = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230323.1" } -turbopack-dev = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230323.1" } -turbopack-dev-server = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230323.1" } -turbopack-ecmascript = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230323.1" } -turbopack-env = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230323.1" } -turbopack-json = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230323.1" } -turbopack-mdx = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230323.1" } -turbopack-node = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230323.1" } -turbopack-static = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230323.1" } -turbopack-swc-utils = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230323.1" } -turbopack-test-utils = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230323.1" } -turbopack-tests = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230323.1" } +auto-hash-map = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230323.3" } +node-file-trace = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230323.3" } +swc-ast-explorer = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230323.3" } +turbo-malloc = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230323.3", default-features = false } +turbo-tasks = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230323.3" } +turbo-tasks-build = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230323.3" } +turbo-tasks-bytes = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230323.3" } +turbo-tasks-env = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230323.3" } +turbo-tasks-fetch = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230323.3", default-features = false } +turbo-tasks-fs = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230323.3" } +turbo-tasks-hash = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230323.3" } +turbo-tasks-macros = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230323.3" } +turbo-tasks-macros-shared = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230323.3" } +turbo-tasks-memory = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230323.3" } +turbo-tasks-testing = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230323.3" } +turbo-updater = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230323.3" } +turbopack = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230323.3" } +turbopack-cli-utils = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230323.3" } +turbopack-core = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230323.3" } +turbopack-create-test-app = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230323.3" } +turbopack-css = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230323.3" } +turbopack-dev = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230323.3" } +turbopack-dev-server = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230323.3" } +turbopack-ecmascript = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230323.3" } +turbopack-env = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230323.3" } +turbopack-json = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230323.3" } +turbopack-mdx = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230323.3" } +turbopack-node = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230323.3" } +turbopack-static = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230323.3" } +turbopack-swc-utils = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230323.3" } +turbopack-test-utils = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230323.3" } +turbopack-tests = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230323.3" } # General Deps diff --git a/packages/next-swc/crates/core/Cargo.toml b/packages/next-swc/crates/core/Cargo.toml index 0dbf26ef64..eab0b32601 100644 --- a/packages/next-swc/crates/core/Cargo.toml +++ b/packages/next-swc/crates/core/Cargo.toml @@ -13,7 +13,7 @@ easy-error = "1.0.0" either = "1" fxhash = "0.2.1" hex = "0.4.3" -once_cell = "1.13.0" +once_cell = { workspace = true } next-transform-font = {"workspace" = true} pathdiff = "0.2.0" regex = "1.5" diff --git a/packages/next-swc/crates/napi/Cargo.toml b/packages/next-swc/crates/napi/Cargo.toml index bd45cc8ba7..e199259245 100644 --- a/packages/next-swc/crates/napi/Cargo.toml +++ b/packages/next-swc/crates/napi/Cargo.toml @@ -32,7 +32,7 @@ napi = { version = "2", default-features = false, features = [ ] } napi-derive = "2" next-swc = { version = "0.0.0", path = "../core" } -once_cell = "1.13.0" +once_cell = { workspace = true } serde = "1" serde_json = "1" tracing = { version = "0.1.37", features = ["release_max_level_info"] } diff --git a/packages/next-swc/crates/next-core/js/src/ipc/index.ts b/packages/next-swc/crates/next-core/js/src/ipc/index.ts index cee988fd05..e50096854c 100644 --- a/packages/next-swc/crates/next-core/js/src/ipc/index.ts +++ b/packages/next-swc/crates/next-core/js/src/ipc/index.ts @@ -1,179 +1,181 @@ -import { createConnection } from "node:net"; +import { createConnection } from 'node:net' import { StackFrame, parse as parseStackTrace, -} from "@vercel/turbopack-next/compiled/stacktrace-parser"; +} from '@vercel/turbopack-next/compiled/stacktrace-parser' export type StructuredError = { - name: string; - message: string; - stack: StackFrame[]; -}; + name: string + message: string + stack: StackFrame[] +} export function structuredError(e: Error): StructuredError { return { name: e.name, message: e.message, stack: parseStackTrace(e.stack!), - }; + } } type State = | { - type: "waiting"; + type: 'waiting' } | { - type: "packet"; - length: number; - }; + type: 'packet' + length: number + } export type Ipc = { - recv(): Promise; - send(message: TOutgoing): Promise; - sendError(error: Error): Promise; -}; + recv(): Promise + send(message: TOutgoing): Promise + sendError(error: Error): Promise +} function createIpc( port: number ): Ipc { - const socket = createConnection(port, "127.0.0.1"); - const packetQueue: Buffer[] = []; - const recvPromiseResolveQueue: Array<(message: TIncoming) => void> = []; + const socket = createConnection(port, '127.0.0.1') + const packetQueue: Buffer[] = [] + const recvPromiseResolveQueue: Array<(message: TIncoming) => void> = [] function pushPacket(packet: Buffer) { - const recvPromiseResolve = recvPromiseResolveQueue.shift(); + const recvPromiseResolve = recvPromiseResolveQueue.shift() if (recvPromiseResolve != null) { - recvPromiseResolve(JSON.parse(packet.toString("utf8")) as TIncoming); + recvPromiseResolve(JSON.parse(packet.toString('utf8')) as TIncoming) } else { - packetQueue.push(packet); + packetQueue.push(packet) } } - let state: State = { type: "waiting" }; - let buffer: Buffer = Buffer.alloc(0); - socket.once("connect", () => { - socket.on("data", (chunk) => { - buffer = Buffer.concat([buffer, chunk]); + let state: State = { type: 'waiting' } + let buffer: Buffer = Buffer.alloc(0) + socket.once('connect', () => { + socket.on('data', (chunk) => { + buffer = Buffer.concat([buffer, chunk]) loop: while (true) { switch (state.type) { - case "waiting": { + case 'waiting': { if (buffer.length >= 4) { - const length = buffer.readUInt32BE(0); - buffer = buffer.subarray(4); - state = { type: "packet", length }; + const length = buffer.readUInt32BE(0) + buffer = buffer.subarray(4) + state = { type: 'packet', length } } else { - break loop; + break loop } - break; + break } - case "packet": { + case 'packet': { if (buffer.length >= state.length) { - const packet = buffer.subarray(0, state.length); - buffer = buffer.subarray(state.length); - state = { type: "waiting" }; - pushPacket(packet); + const packet = buffer.subarray(0, state.length) + buffer = buffer.subarray(state.length) + state = { type: 'waiting' } + pushPacket(packet) } else { - break loop; + break loop } - break; + break } } } - }); - }); + }) + }) function send(message: any): Promise { - const packet = Buffer.from(JSON.stringify(message), "utf8"); - const length = Buffer.alloc(4); - length.writeUInt32BE(packet.length); - socket.write(length); + const packet = Buffer.from(JSON.stringify(message), 'utf8') + const length = Buffer.alloc(4) + length.writeUInt32BE(packet.length) + socket.write(length) return new Promise((resolve, reject) => { socket.write(packet, (err) => { + process.stderr.write(`TURBOPACK_OUTPUT_D\n`) + process.stdout.write(`TURBOPACK_OUTPUT_D\n`) if (err != null) { - reject(err); + reject(err) } else { - resolve(); + resolve() } - }); - }); + }) + }) } return { async recv() { - const packet = packetQueue.shift(); + const packet = packetQueue.shift() if (packet != null) { - return JSON.parse(packet.toString("utf8")) as TIncoming; + return JSON.parse(packet.toString('utf8')) as TIncoming } const result = await new Promise((resolve) => { recvPromiseResolveQueue.push((result) => { - resolve(result); - }); - }); + resolve(result) + }) + }) - return result; + return result }, send(message: TOutgoing) { - return send(message); + return send(message) }, async sendError(error: Error): Promise { try { await send({ - type: "error", + type: 'error', ...structuredError(error), - }); + }) } catch (err) { // ignore and exit anyway } - process.exit(1); + process.exit(1) }, - }; + } } -const PORT = process.argv[2]; +const PORT = process.argv[2] -export const IPC = createIpc(parseInt(PORT, 10)); +export const IPC = createIpc(parseInt(PORT, 10)) -process.on("uncaughtException", (err) => { - IPC.sendError(err); -}); +process.on('uncaughtException', (err) => { + IPC.sendError(err) +}) const improveConsole = (name: string, stream: string, addStack: boolean) => { // @ts-ignore - const original = console[name]; + const original = console[name] // @ts-ignore - const stdio = process[stream]; + const stdio = process[stream] // @ts-ignore console[name] = (...args: any[]) => { - stdio.write(`TURBOPACK_OUTPUT_B\n`); - original(...args); + stdio.write(`TURBOPACK_OUTPUT_B\n`) + original(...args) if (addStack) { - const stack = new Error().stack?.replace(/^.+\n.+\n/, "") + "\n"; - stdio.write("TURBOPACK_OUTPUT_S\n"); - stdio.write(stack); + const stack = new Error().stack?.replace(/^.+\n.+\n/, '') + '\n' + stdio.write('TURBOPACK_OUTPUT_S\n') + stdio.write(stack) } - stdio.write("TURBOPACK_OUTPUT_E\n"); - }; -}; + stdio.write('TURBOPACK_OUTPUT_E\n') + } +} -improveConsole("error", "stderr", true); -improveConsole("warn", "stderr", true); -improveConsole("count", "stdout", true); -improveConsole("trace", "stderr", false); -improveConsole("log", "stdout", true); -improveConsole("group", "stdout", true); -improveConsole("groupCollapsed", "stdout", true); -improveConsole("table", "stdout", true); -improveConsole("debug", "stdout", true); -improveConsole("info", "stdout", true); -improveConsole("dir", "stdout", true); -improveConsole("dirxml", "stdout", true); -improveConsole("timeEnd", "stdout", true); -improveConsole("timeLog", "stdout", true); -improveConsole("timeStamp", "stdout", true); -improveConsole("assert", "stderr", true); +improveConsole('error', 'stderr', true) +improveConsole('warn', 'stderr', true) +improveConsole('count', 'stdout', true) +improveConsole('trace', 'stderr', false) +improveConsole('log', 'stdout', true) +improveConsole('group', 'stdout', true) +improveConsole('groupCollapsed', 'stdout', true) +improveConsole('table', 'stdout', true) +improveConsole('debug', 'stdout', true) +improveConsole('info', 'stdout', true) +improveConsole('dir', 'stdout', true) +improveConsole('dirxml', 'stdout', true) +improveConsole('timeEnd', 'stdout', true) +improveConsole('timeLog', 'stdout', true) +improveConsole('timeStamp', 'stdout', true) +improveConsole('assert', 'stderr', true) diff --git a/packages/next-swc/crates/next-core/js/src/overlay/internal/helpers/magic-identifier.ts b/packages/next-swc/crates/next-core/js/src/overlay/internal/helpers/magic-identifier.ts index 1411474136..90e6ac51d4 100644 --- a/packages/next-swc/crates/next-core/js/src/overlay/internal/helpers/magic-identifier.ts +++ b/packages/next-swc/crates/next-core/js/src/overlay/internal/helpers/magic-identifier.ts @@ -1,5 +1,7 @@ +// see vercel/turbo crates/turbopack-ecmascript/src/magic_identifier.rs for the rust version + function decodeHex(hexStr: string): string { - if (hexStr.trim() == "") { + if (hexStr.trim() === "") { throw new Error("can't decode empty hex"); } @@ -36,38 +38,39 @@ function decodeMagicIdentifier(identifier: string): string { const char = inner[i]; if (mode === Mode.Text) { - if (char == "_") { + if (char === "_") { mode = Mode.Underscore; - } else if (char == "$") { + } else if (char === "$") { mode = Mode.Hex; } else { output += char; } } else if (mode === Mode.Underscore) { - if (char == "_") { + if (char === "_") { output += " "; mode = Mode.Text; - } else if (char == "$") { + } else if (char === "$") { output += "_"; mode = Mode.Hex; } else { + output += "_"; output += char; mode = Mode.Text; } } else if (mode === Mode.Hex) { - if (buffer.length == 2) { + if (buffer.length === 2) { output += decodeHex(buffer); buffer = ""; } - if (char == "_") { - if (buffer != "") { + if (char === "_") { + if (buffer !== "") { throw new Error(`invalid hex: \`${buffer}\``); } mode = Mode.LongHex; - } else if (char == "$") { - if (buffer != "") { + } else if (char === "$") { + if (buffer !== "") { throw new Error(`invalid hex: \`${buffer}\``); } @@ -76,9 +79,9 @@ function decodeMagicIdentifier(identifier: string): string { buffer += char; } } else if (mode === Mode.LongHex) { - if (char == "_") { + if (char === "_") { throw new Error(`invalid hex: \`${buffer + char}\``); - } else if (char == "$") { + } else if (char === "$") { output += decodeHex(buffer); buffer = ""; diff --git a/packages/next-swc/crates/next-core/src/app_source.rs b/packages/next-swc/crates/next-core/src/app_source.rs index f967d842da..441fa34727 100644 --- a/packages/next-swc/crates/next-core/src/app_source.rs +++ b/packages/next-swc/crates/next-core/src/app_source.rs @@ -551,11 +551,11 @@ impl AppRendererVc { let mut imports = BTreeMap::new(); for (key, file) in segment.files.iter() { let file_str = file.to_string().await?; - let identifier = magic_identifier::encode(&format!( + let identifier = magic_identifier::mangle(&format!( "imported namespace {}", file_str )); - let chunks_identifier = magic_identifier::encode(&format!( + let chunks_identifier = magic_identifier::mangle(&format!( "client chunks for {}", file_str )); @@ -649,6 +649,7 @@ import BOOTSTRAP from {}; ) .layer("ssr") .css_chunk_root_path(this.server_root.join("_next/static/chunks")) + .reference_chunk_source_maps(false) .build(); Ok(NodeRenderingEntry { @@ -671,6 +672,7 @@ import BOOTSTRAP from {}; chunking_context, intermediate_output_path, output_root: intermediate_output_path.root(), + project_dir: this.project_path, } .cell()) } @@ -721,6 +723,7 @@ impl AppRouteVc { ) .layer("ssr") .css_chunk_root_path(this.server_root.join("_next/static/chunks")) + .reference_chunk_source_maps(false) .build(); let entry = this.context.with_transition("next-route").process( @@ -743,6 +746,7 @@ impl AppRouteVc { chunking_context, intermediate_output_path: this.intermediate_output_path, output_root: this.output_root, + project_dir: this.project_path, } .cell()) } diff --git a/packages/next-swc/crates/next-core/src/next_import_map.rs b/packages/next-swc/crates/next-core/src/next_import_map.rs index 34fc8d483e..b1804c379b 100644 --- a/packages/next-swc/crates/next-core/src/next_import_map.rs +++ b/packages/next-swc/crates/next-core/src/next_import_map.rs @@ -254,7 +254,7 @@ pub fn get_next_client_resolved_map( let glob_mappings = vec![ // Temporary hack to replace the hot reloader until this is passable by props in next.js ( - context, + context.root(), GlobVc::new("**/next/dist/client/components/react-dev-overlay/hot-reloader-client.js"), ImportMapping::PrimaryAlternative( "@vercel/turbopack-next/dev/hot-reloader.tsx".to_string(), diff --git a/packages/next-swc/crates/next-core/src/page_source.rs b/packages/next-swc/crates/next-core/src/page_source.rs index 8b0911d8f4..ade2f6911e 100644 --- a/packages/next-swc/crates/next-core/src/page_source.rs +++ b/packages/next-swc/crates/next-core/src/page_source.rs @@ -323,6 +323,7 @@ async fn create_page_source_for_file( ), server_context.compile_time_info().environment(), ) + .reference_chunk_source_maps(false) .build(); let data_intermediate_output_path = intermediate_output_path.join("data"); @@ -337,6 +338,7 @@ async fn create_page_source_for_file( ), server_context.compile_time_info().environment(), ) + .reference_chunk_source_maps(false) .build(); let client_chunking_context = get_client_chunking_context( @@ -364,6 +366,7 @@ async fn create_page_source_for_file( chunking_context: server_chunking_context, intermediate_output_path, output_root, + project_path, } .cell() .into(), @@ -381,6 +384,7 @@ async fn create_page_source_for_file( chunking_context: server_chunking_context, intermediate_output_path, output_root, + project_path, } .cell() .into(); @@ -392,6 +396,7 @@ async fn create_page_source_for_file( chunking_context: server_data_chunking_context, intermediate_output_path: data_intermediate_output_path, output_root, + project_path, } .cell() .into(); @@ -471,6 +476,7 @@ async fn create_not_found_page_source( ), server_context.compile_time_info().environment(), ) + .reference_chunk_source_maps(false) .build(); let client_chunking_context = get_client_chunking_context( @@ -506,6 +512,7 @@ async fn create_not_found_page_source( chunking_context: server_chunking_context, intermediate_output_path, output_root: intermediate_output_path, + project_path, } .cell() .into(); @@ -648,6 +655,7 @@ struct SsrEntry { chunking_context: ChunkingContextVc, intermediate_output_path: FileSystemPathVc, output_root: FileSystemPathVc, + project_path: FileSystemPathVc, } #[turbo_tasks::value_impl] @@ -733,6 +741,7 @@ impl SsrEntryVc { chunking_context: this.chunking_context, intermediate_output_path: this.intermediate_output_path, output_root: this.output_root, + project_dir: this.project_path, } .cell()) } diff --git a/packages/next-swc/crates/next-core/src/router.rs b/packages/next-swc/crates/next-core/src/router.rs index d0fb04f296..84001051db 100644 --- a/packages/next-swc/crates/next-core/src/router.rs +++ b/packages/next-swc/crates/next-core/src/router.rs @@ -31,7 +31,7 @@ use turbopack_ecmascript::{ use turbopack_node::{ evaluate::evaluate, execution_context::{ExecutionContext, ExecutionContextVc}, - StructuredError, + source_map::StructuredError, }; use crate::{ diff --git a/packages/next-swc/crates/next-dev-tests/test-harness/harness.ts b/packages/next-swc/crates/next-dev-tests/test-harness/harness.ts index ed175f5c3c..15db1eae38 100644 --- a/packages/next-swc/crates/next-dev-tests/test-harness/harness.ts +++ b/packages/next-swc/crates/next-dev-tests/test-harness/harness.ts @@ -1,72 +1,130 @@ -import * as jest from "jest-circus-browser/dist/umd/jest-circus"; -import expectMod from "expect/build-es5/index"; +import * as jest from 'jest-circus-browser/dist/umd/jest-circus' +import expectMod from 'expect/build-es5/index' type CallSignature unknown> = ( ...a: Parameters -) => ReturnType; +) => ReturnType declare global { - var __jest__: typeof jest; - var expect: typeof expectMod; + var __jest__: typeof jest + var expect: typeof expectMod // We need to extract only the call signature as `autoReady(jest.describe)` drops all the other properties - var describe: CallSignature; - var it: CallSignature; - var READY: (arg: string) => void; - var nsObj: (obj: any) => any; + var describe: CallSignature + var it: CallSignature + var READY: (arg: string) => void + var nsObj: (obj: any) => any interface Window { - NEXT_HYDRATED?: boolean; - onNextHydrated?: () => void; + NEXT_HYDRATED?: boolean + onNextHydrated?: () => void } } -let isReady = false; +let isReady = false function autoReady unknown>( fn: (...args: Parameters) => ReturnType ): (...args: Parameters) => ReturnType { return (...args) => { if (!isReady) { - isReady = true; + isReady = true requestIdleCallback( () => { - READY(""); + if (typeof READY === 'function') { + READY('') + } else { + console.info( + '%cTurbopack tests:', + 'font-weight: bold;', + 'Entering debug mode. Run `await __jest__.run()` in the browser console to run tests.' + ) + } }, { timeout: 20000 } - ); + ) } - return fn(...args); - }; + return fn(...args) + } } -globalThis.__jest__ = jest; -globalThis.expect = expectMod; -globalThis.describe = autoReady(jest.describe); -globalThis.it = autoReady(jest.it); +globalThis.__jest__ = jest +globalThis.expect = expectMod +globalThis.describe = autoReady(jest.describe) +globalThis.it = autoReady(jest.it) // From https://github.com/webpack/webpack/blob/9fcaa243573005d6fdece9a3f8d89a0e8b399613/test/TestCases.template.js#L422 globalThis.nsObj = function nsObj(obj) { Object.defineProperty(obj, Symbol.toStringTag, { - value: "Module", - }); - return obj; -}; + value: 'Module', + }) + return obj +} -function wait(ms: number): Promise { +export function wait(ms: number): Promise { return new Promise((resolve) => { - setTimeout(resolve, ms); - }); + setTimeout(resolve, ms) + }) } async function waitForPath(contentWindow: Window, path: string): Promise { while (true) { if (contentWindow.location.pathname === path) { - break; + break } - await wait(1); + await wait(1) } } +export function waitForLoaded(iframe: HTMLIFrameElement): Promise { + return new Promise((resolve) => { + if ( + iframe.contentDocument != null && + iframe.contentDocument.readyState === 'complete' + ) { + resolve() + } else { + iframe.addEventListener('load', () => { + resolve() + }) + } + }) +} + +export function waitForSelector( + node: ParentNode | HTMLIFrameElement | ShadowRoot, + selector: string +): Promise { + return new Promise((resolve, reject) => { + const document = 'contentDocument' in node ? node.contentDocument! : node + const timeout = 30000 + let element = document.querySelector(selector) + if (element) { + return resolve(element) + } + const observer = new MutationObserver(async () => { + let el = document.querySelector(selector) + if (el) { + resolve(el) + observer.disconnect() + } + }) + observer.observe(document, { childList: true, subtree: true }) + if (timeout) { + setTimeout(() => { + observer.disconnect() + reject(new Error(`Timed out waiting for selector "${selector}"`)) + }, timeout) + } + }) +} + +export async function waitForErrorOverlay( + node: ParentNode | HTMLIFrameElement +): Promise { + let element = await waitForSelector(node, 'nextjs-portal') + return element.shadowRoot! +} + export function waitForHydration( iframe: HTMLIFrameElement, path: string @@ -74,37 +132,37 @@ export function waitForHydration( return new Promise((resolve) => { if ( iframe.contentDocument != null && - iframe.contentDocument.readyState === "complete" + iframe.contentDocument.readyState === 'complete' ) { - waitForHydrationAndResolve(iframe.contentWindow!, path).then(resolve); + waitForHydrationAndResolve(iframe.contentWindow!, path).then(resolve) } else { - iframe.addEventListener("load", () => { - waitForHydrationAndResolve(iframe.contentWindow!, path).then(resolve); - }); + iframe.addEventListener('load', () => { + waitForHydrationAndResolve(iframe.contentWindow!, path).then(resolve) + }) } - }); + }) } async function waitForHydrationAndResolve( contentWindow: Window, path: string ): Promise { - await waitForPath(contentWindow, path); + await waitForPath(contentWindow, path) return await new Promise((resolve) => { if (contentWindow.NEXT_HYDRATED) { - resolve(); + resolve() } else { contentWindow.onNextHydrated = () => { - resolve(); - }; + resolve() + } } - }); + }) } export function markAsHydrated() { - window.NEXT_HYDRATED = true; - if (typeof window.onNextHydrated === "function") { - window.onNextHydrated(); + window.NEXT_HYDRATED = true + if (typeof window.onNextHydrated === 'function') { + window.onNextHydrated() } } diff --git a/packages/next-swc/crates/next-dev-tests/tests/integration.rs b/packages/next-swc/crates/next-dev-tests/tests/integration.rs index 44657652ab..30578bce44 100644 --- a/packages/next-swc/crates/next-dev-tests/tests/integration.rs +++ b/packages/next-swc/crates/next-dev-tests/tests/integration.rs @@ -6,7 +6,7 @@ use regex::{Captures, Regex, Replacer}; use std::{ env, fmt::Write, - future::Future, + future::{pending, Future}, net::SocketAddr, panic::{catch_unwind, resume_unwind, AssertUnwindSafe}, path::{Path, PathBuf}, @@ -69,9 +69,11 @@ struct JestTestResult { } lazy_static! { - // Allows for interactive manual debugging of a test case in a browser with: - // `TURBOPACK_DEBUG_BROWSER=1 cargo test -p next-dev-tests -- test_my_pattern --nocapture` + /// Allows for interactive manual debugging of a test case in a browser with: + /// `TURBOPACK_DEBUG_BROWSER=1 cargo test -p next-dev-tests -- test_my_pattern --nocapture` static ref DEBUG_BROWSER: bool = env::var("TURBOPACK_DEBUG_BROWSER").is_ok(); + /// Only starts the dev server on port 3000, but doesn't spawn a browser or run any tests. + static ref DEBUG_START: bool = env::var("TURBOPACK_DEBUG_START").is_ok(); } fn run_async_test<'a, T>(future: impl Future + Send + 'a) -> T { @@ -161,6 +163,8 @@ fn test_skipped_fails(resource: PathBuf) { async fn run_test(resource: PathBuf) -> JestRunResult { register(); + let is_debug_start = *DEBUG_START; + let resource = canonicalize(resource).unwrap(); assert!(resource.exists(), "{} does not exist", resource.display()); assert!( @@ -181,7 +185,11 @@ async fn run_test(resource: PathBuf) -> JestRunResult { let test_dir = resource.to_path_buf(); let workspace_root = cargo_workspace_root.parent().unwrap().parent().unwrap(); let project_dir = test_dir.join("input"); - let requested_addr = get_free_local_addr().unwrap(); + let requested_addr = if is_debug_start { + "127.0.0.1:3000".parse().unwrap() + } else { + get_free_local_addr().unwrap() + }; let mock_dir = resource.join("__httpmock__"); let mock_server_future = get_mock_server_future(&mock_dir); @@ -219,6 +227,16 @@ async fn run_test(resource: PathBuf) -> JestRunResult { address = server.addr ); + if *DEBUG_START { + webbrowser::open(&server.addr.to_string()).unwrap(); + tokio::select! { + _ = mock_server_future => {}, + _ = pending() => {}, + _ = server.future => {}, + }; + panic!("Never resolves") + } + let result = tokio::select! { // Poll the mock_server first to add the env var _ = mock_server_future => panic!("Never resolves"), @@ -383,14 +401,21 @@ async fn run_browser(addr: SocketAddr) -> Result { writeln!(message, " at {} ({}:{}:{})", frame.function_name, frame.url, frame.line_number, frame.column_number)?; } } + let expected_error = !message.contains("(expected error)"); let message = message.trim_end(); if !is_debugging { - return Err(anyhow!( - "Exception throw in page: {}", - message - )) + if !expected_error { + return Err(anyhow!( + "Exception throw in page: {}", + message + )) + } } else { - println!("Exception throw in page (this would fail the test case without TURBOPACK_DEBUG_BROWSER):\n{}", message); + if expected_error { + println!("Exception throw in page:\n{}", message); + } else { + println!("Exception throw in page (this would fail the test case without TURBOPACK_DEBUG_BROWSER):\n{}", message); + } } } else { return Err(anyhow!("Error events channel ended unexpectedly")); @@ -546,9 +571,19 @@ impl Issue for NormalizedIssue { #[turbo_tasks::function] async fn description(&self) -> Result { let str = self.0.description().await?; - let regex = Regex::new(r"\n at (.+) \((.+)\)").unwrap(); + let regex1 = Regex::new(r"\n +at (.+) \((.+)\)(?: \[.+\])?").unwrap(); + let regex2 = Regex::new(r"\n +at ()(.+) \[.+\]").unwrap(); + let regex3 = Regex::new(r"\n +\[at .+\]").unwrap(); Ok(StringVc::cell( - regex.replace_all(&str, StackTraceReplacer).to_string(), + regex3 + .replace_all( + ®ex2.replace_all( + ®ex1.replace_all(&str, StackTraceReplacer), + StackTraceReplacer, + ), + "", + ) + .to_string(), )) } diff --git a/packages/next-swc/crates/next-dev-tests/tests/integration/next/error/ssr/input/app/broken-app/page.tsx b/packages/next-swc/crates/next-dev-tests/tests/integration/next/error/ssr/input/app/broken-app/page.tsx new file mode 100644 index 0000000000..5fa6286d3e --- /dev/null +++ b/packages/next-swc/crates/next-dev-tests/tests/integration/next/error/ssr/input/app/broken-app/page.tsx @@ -0,0 +1,3 @@ +export default function Page() { + throw new Error('Broken app (expected error)') +} diff --git a/packages/next-swc/crates/next-dev-tests/tests/integration/next/error/ssr/input/app/layout.tsx b/packages/next-swc/crates/next-dev-tests/tests/integration/next/error/ssr/input/app/layout.tsx new file mode 100644 index 0000000000..7f4de05aba --- /dev/null +++ b/packages/next-swc/crates/next-dev-tests/tests/integration/next/error/ssr/input/app/layout.tsx @@ -0,0 +1,7 @@ +export default function RootLayout({ children }: { children: any }) { + return ( + + {children} + + ); +} diff --git a/packages/next-swc/crates/next-dev-tests/tests/integration/next/error/ssr/input/next.config.js b/packages/next-swc/crates/next-dev-tests/tests/integration/next/error/ssr/input/next.config.js new file mode 100644 index 0000000000..cfa3ac3d7a --- /dev/null +++ b/packages/next-swc/crates/next-dev-tests/tests/integration/next/error/ssr/input/next.config.js @@ -0,0 +1,5 @@ +module.exports = { + experimental: { + appDir: true, + }, +} diff --git a/packages/next-swc/crates/next-dev-tests/tests/integration/next/error/ssr/input/pages/broken.tsx b/packages/next-swc/crates/next-dev-tests/tests/integration/next/error/ssr/input/pages/broken.tsx new file mode 100644 index 0000000000..1fa3922485 --- /dev/null +++ b/packages/next-swc/crates/next-dev-tests/tests/integration/next/error/ssr/input/pages/broken.tsx @@ -0,0 +1,3 @@ +export default function Page() { + throw new Error('Broken page (expected error)') +} diff --git a/packages/next-swc/crates/next-dev-tests/tests/integration/next/error/ssr/input/pages/index.tsx b/packages/next-swc/crates/next-dev-tests/tests/integration/next/error/ssr/input/pages/index.tsx new file mode 100644 index 0000000000..f3898d20d5 --- /dev/null +++ b/packages/next-swc/crates/next-dev-tests/tests/integration/next/error/ssr/input/pages/index.tsx @@ -0,0 +1,83 @@ +import { useEffect, useRef } from 'react' + +export default function Page() { + const iframeRef = useRef(null) + const appIframeRef = useRef(null) + + useEffect(() => { + // Only run on client + import('@turbo/pack-test-harness').then((mod) => + runTests(mod, iframeRef.current!, appIframeRef.current) + ) + }) + + return ( + <> +