From f245ff861f39aa4aa0f6ee17d56677fc1cbf8454 Mon Sep 17 00:00:00 2001 From: Manu MA Date: Fri, 13 May 2022 23:19:31 -0700 Subject: [PATCH] fix(optimizer): keep extensions and dropped imports (#478) --- Cargo.lock | 463 ++++++++-------- packages/qwik/src/optimizer/core/Cargo.toml | 19 +- .../qwik/src/optimizer/core/src/code_move.rs | 24 +- .../src/optimizer/core/src/entry_strategy.rs | 6 +- packages/qwik/src/optimizer/core/src/lib.rs | 4 +- packages/qwik/src/optimizer/core/src/parse.rs | 31 +- .../snapshots/qwik_core__test__example_1.snap | 18 +- .../qwik_core__test__example_10.snap | 6 +- .../qwik_core__test__example_11.snap | 18 +- .../snapshots/qwik_core__test__example_2.snap | 12 +- .../snapshots/qwik_core__test__example_3.snap | 12 +- .../snapshots/qwik_core__test__example_4.snap | 12 +- .../snapshots/qwik_core__test__example_5.snap | 12 +- .../snapshots/qwik_core__test__example_6.snap | 6 +- .../snapshots/qwik_core__test__example_7.snap | 18 +- .../snapshots/qwik_core__test__example_8.snap | 12 +- .../snapshots/qwik_core__test__example_9.snap | 6 +- ...k_core__test__example_capture_imports.snap | 18 +- ...ore__test__example_capturing_fn_class.snap | 12 +- ...est__example_custom_inlined_functions.snap | 24 +- ...st__example_explicit_ext_no_transpile.snap | 54 +- ..._test__example_explicit_ext_transpile.snap | 18 +- .../qwik_core__test__example_exports.snap | 12 +- ...e__test__example_functional_component.snap | 6 +- ..._test__example_functional_component_2.snap | 18 +- ...le_functional_component_capture_props.snap | 18 +- ...ore__test__example_invalid_hook_expr1.snap | 18 +- ...ore__test__example_invalid_references.snap | 12 +- .../qwik_core__test__example_jsx.snap | 12 +- ...core__test__example_jsx_import_source.snap | 6 +- ...wik_core__test__example_jsx_listeners.snap | 78 ++- ..._test__example_lightweight_functional.snap | 18 +- ...wik_core__test__example_multi_capture.snap | 24 +- .../qwik_core__test__example_prod_node.snap | 24 +- ...wik_core__test__example_qwik_conflict.snap | 30 +- ...k_core__test__example_renamed_exports.snap | 12 +- ...core__test__example_use_client_effect.snap | 52 +- ..._core__test__example_use_server_mount.snap | 272 ++++++++++ .../qwik_core__test__example_with_style.snap | 12 +- ...qwik_core__test__example_with_tagname.snap | 12 +- .../snapshots/qwik_core__test__issue_150.snap | 18 +- .../snapshots/qwik_core__test__issue_476.snap | 49 ++ packages/qwik/src/optimizer/core/src/test.rs | 127 ++++- .../qwik/src/optimizer/core/src/transform.rs | 26 +- packages/qwik/src/optimizer/core/src/words.rs | 1 + packages/qwik/src/wasm/Cargo.lock | 501 ++++++++---------- packages/qwik/src/wasm/Cargo.toml | 6 +- 47 files changed, 1433 insertions(+), 736 deletions(-) create mode 100644 packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_use_server_mount.snap create mode 100644 packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__issue_476.snap diff --git a/Cargo.lock b/Cargo.lock index 408c7c78237..04a9b0bee1b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -18,7 +18,7 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" dependencies = [ - "getrandom 0.2.3", + "getrandom", "once_cell", "version_check", ] @@ -34,15 +34,15 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.56" +version = "1.0.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4361135be9122e0870de935d7c439aef945b9f9ddd4199a553b5270b49c82a27" +checksum = "08f9b8508dccb7687a1d6c4ce66b2b0ecef467c94667de27d8d7fe1f8d2a9cdc" [[package]] name = "arrayvec" -version = "0.5.2" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" +checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" [[package]] name = "ast_node" @@ -104,9 +104,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "block-buffer" -version = "0.9.0" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" +checksum = "0bf7fe51849ea569fd452f37822f606a5cabb684dc918707a0193fd4664ff324" dependencies = [ "generic-array", ] @@ -117,12 +117,6 @@ version = "1.0.71" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "79c2681d6594606957bbb8631c4b90a7fcaaa72cdb714743a437b156d6a7eedd" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -160,15 +154,6 @@ dependencies = [ "syn", ] -[[package]] -name = "cloudabi" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4344512281c643ae7638bbabc3af17a11307803ec8f0fcad9fae512a8bf36467" -dependencies = [ - "bitflags", -] - [[package]] name = "console" version = "0.15.0" @@ -197,7 +182,7 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06ed27e177f16d65f0f0c22a213e17c696ace5dd64b14258b52f9417ccb52db4" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "crossbeam-utils", ] @@ -207,7 +192,7 @@ version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6455c0ca19f0d2fbf751b908d5c55c1f5cbc65e03c4225427254b46890bdde1e" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "crossbeam-epoch", "crossbeam-utils", ] @@ -218,7 +203,7 @@ version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ec02e091aa634e2c3ada4a392989e7c3116673ef0ac5b72232439094d73b7fd" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "crossbeam-utils", "lazy_static", "memoffset", @@ -231,10 +216,20 @@ version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d82cfc11ce7f2c3faef78d8a684447b40d503d9681acebed6cb728d45940c4db" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "lazy_static", ] +[[package]] +name = "crypto-common" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57952ca27b5e3606ff4dd79b0020231aaf9d6aa76dc05fd30137538c50bd3ce8" +dependencies = [ + "generic-array", + "typenum", +] + [[package]] name = "darling" version = "0.10.2" @@ -270,25 +265,15 @@ dependencies = [ "syn", ] -[[package]] -name = "dashmap" -version = "4.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e77a43b28d0668df09411cb0bc9a8c2adc40f9a048afe863e05fd43251e8e39c" -dependencies = [ - "cfg-if 1.0.0", - "num_cpus", -] - [[package]] name = "dashmap" version = "5.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0834a35a3fce649144119e18da2a4d8ed12ef3862f47183fd46f625d072d96c" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "num_cpus", - "parking_lot 0.12.0", + "parking_lot", ] [[package]] @@ -313,11 +298,12 @@ dependencies = [ [[package]] name = "digest" -version = "0.9.0" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +checksum = "f2fb860ca6fafa5552fb6d0e816a69c8e49f0908bf524e30a90d97c85892d506" dependencies = [ - "generic-array", + "block-buffer", + "crypto-common", ] [[package]] @@ -388,26 +374,15 @@ dependencies = [ "version_check", ] -[[package]] -name = "getrandom" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" -dependencies = [ - "cfg-if 1.0.0", - "libc", - "wasi 0.9.0+wasi-snapshot-preview1", -] - [[package]] name = "getrandom" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", - "wasi 0.10.2+wasi-snapshot-preview1", + "wasi", ] [[package]] @@ -469,9 +444,9 @@ dependencies = [ [[package]] name = "insta" -version = "1.12.0" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4c0c443f6dceb3a1cb7607c87501aa91e4b9c976044f725c2a74ca2152c91a4" +checksum = "689960f187c43c01650c805fb6bc6f55ab944499d86d4ffe9474ad78991d8e94" dependencies = [ "console", "once_cell", @@ -481,15 +456,6 @@ dependencies = [ "similar", ] -[[package]] -name = "instant" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" -dependencies = [ - "cfg-if 1.0.0", -] - [[package]] name = "is-macro" version = "0.2.0" @@ -517,24 +483,74 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "lexical" -version = "5.2.2" +version = "6.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f404a90a744e32e8be729034fc33b90cf2a56418fbf594d69aa3c0214ad414e5" +checksum = "ccd3e434c16f0164124ade12dcdee324fcc3dafb1cad0c7f1d8c2451a1aa6886" dependencies = [ - "cfg-if 1.0.0", "lexical-core", ] [[package]] name = "lexical-core" -version = "0.7.6" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6607c62aa161d23d17a9072cc5da0be67cdfc89d3afb1e8d9c842bebc2525ffe" +checksum = "92912c4af2e7d9075be3e5e3122c4d7263855fa6cce34fbece4dd08e5884624d" +dependencies = [ + "lexical-parse-float", + "lexical-parse-integer", + "lexical-util", + "lexical-write-float", + "lexical-write-integer", +] + +[[package]] +name = "lexical-parse-float" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f518eed87c3be6debe6d26b855c97358d8a11bf05acec137e5f53080f5ad2dd8" +dependencies = [ + "lexical-parse-integer", + "lexical-util", + "static_assertions", +] + +[[package]] +name = "lexical-parse-integer" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afc852ec67c6538bbb2b9911116a385b24510e879a69ab516e6a151b15a79168" +dependencies = [ + "lexical-util", + "static_assertions", +] + +[[package]] +name = "lexical-util" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c72a9d52c5c4e62fa2cdc2cb6c694a39ae1382d9c2a17a466f18e272a0930eb1" dependencies = [ - "arrayvec", - "bitflags", - "cfg-if 1.0.0", - "ryu", + "static_assertions", +] + +[[package]] +name = "lexical-write-float" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a89ec1d062e481210c309b672f73a0567b7855f21e7d2fae636df44d12e97f9" +dependencies = [ + "lexical-util", + "lexical-write-integer", + "static_assertions", +] + +[[package]] +name = "lexical-write-integer" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "094060bd2a7c2ff3a16d5304a6ae82727cb3cc9d1c70f813cc73f744c319337e" +dependencies = [ + "lexical-util", "static_assertions", ] @@ -650,9 +666,9 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.2.6" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "090c7f9998ee0ff65aa5b723e4009f7b217707f1fb5ea551329cc4d6231fb304" +checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f" dependencies = [ "autocfg", "num-integer", @@ -691,15 +707,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da32515d9f6e6e489d7bc9d84c71b060db7247dc035bbe44eac88cf87486d8d5" - -[[package]] -name = "opaque-debug" -version = "0.3.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" +checksum = "87f3e037eac156d1775da914196f0f37741a274155e34a0b7e427c35d2a2ecb9" [[package]] name = "os_str_bytes" @@ -710,17 +720,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "parking_lot" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d7744ac029df22dca6284efe4e898991d28e3085c706c972bcd7da4a27a15eb" -dependencies = [ - "instant", - "lock_api", - "parking_lot_core 0.8.0", -] - [[package]] name = "parking_lot" version = "0.12.0" @@ -728,22 +727,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "87f5ec2493a61ac0506c0f4199f99070cbe83857b0337006a30f3e6719b8ef58" dependencies = [ "lock_api", - "parking_lot_core 0.9.1", -] - -[[package]] -name = "parking_lot_core" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c361aa727dd08437f2f1447be8b59a33b0edd15e0fcee698f935613d9efbca9b" -dependencies = [ - "cfg-if 0.1.10", - "cloudabi", - "instant", - "libc", - "redox_syscall 0.1.57", - "smallvec", - "winapi", + "parking_lot_core", ] [[package]] @@ -752,9 +736,9 @@ version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28141e0cc4143da2443301914478dc976a61ffdb3f043058310c70df2fed8954" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", - "redox_syscall 0.2.11", + "redox_syscall", "smallvec", "windows-sys", ] @@ -803,48 +787,39 @@ checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" [[package]] name = "phf" -version = "0.8.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dfb61232e34fcb633f43d12c58f83c1df82962dcdfa565a4e866ffc17dafe12" +checksum = "fabbf1ead8a5bcbc20f5f8b939ee3f5b0f6f281b6ad3468b84656b658b455259" dependencies = [ "phf_macros", - "phf_shared 0.8.0", + "phf_shared", "proc-macro-hack", ] [[package]] name = "phf_generator" -version = "0.8.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17367f0cc86f2d25802b2c26ee58a7b23faeccf78a396094c13dced0d0182526" +checksum = "5d5285893bb5eb82e6aaf5d59ee909a06a16737a8970984dd7746ba9283498d6" dependencies = [ - "phf_shared 0.8.0", + "phf_shared", "rand", ] [[package]] name = "phf_macros" -version = "0.8.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f6fde18ff429ffc8fe78e2bf7f8b7a5a5a6e2a8b58bc5a9ac69198bbda9189c" +checksum = "58fdf3184dd560f160dd73922bea2d5cd6e8f064bf4b13110abd81b03697b4e0" dependencies = [ "phf_generator", - "phf_shared 0.8.0", + "phf_shared", "proc-macro-hack", "proc-macro2", "quote", "syn", ] -[[package]] -name = "phf_shared" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c00cf8b9eafe68dde5e9eaa2cef8ee84a9336a47d566ec55ca16589633b65af7" -dependencies = [ - "siphasher", -] - [[package]] name = "phf_shared" version = "0.10.0" @@ -952,7 +927,6 @@ dependencies = [ "path-slash", "pathdiff", "rayon", - "regex", "relative-path", "serde", "serde_bytes", @@ -976,23 +950,20 @@ dependencies = [ [[package]] name = "rand" -version = "0.7.3" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ - "getrandom 0.1.16", "libc", "rand_chacha", "rand_core", - "rand_hc", - "rand_pcg", ] [[package]] name = "rand_chacha" -version = "0.2.2" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "ppv-lite86", "rand_core", @@ -1000,29 +971,11 @@ dependencies = [ [[package]] name = "rand_core" -version = "0.5.1" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" dependencies = [ - "getrandom 0.1.16", -] - -[[package]] -name = "rand_hc" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" -dependencies = [ - "rand_core", -] - -[[package]] -name = "rand_pcg" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" -dependencies = [ - "rand_core", + "getrandom", ] [[package]] @@ -1050,12 +1003,6 @@ dependencies = [ "num_cpus", ] -[[package]] -name = "redox_syscall" -version = "0.1.57" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" - [[package]] name = "redox_syscall" version = "0.2.11" @@ -1084,9 +1031,9 @@ checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" [[package]] name = "relative-path" -version = "1.6.1" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a49a831dc1e13c9392b660b162333d4cb0033bbbdfe6a1687177e59e89037c86" +checksum = "b4e112eddc95bbf25365df3b5414354ad2fe7ee465eddb9965a515faf8c3b6d9" [[package]] name = "retain_mut" @@ -1144,27 +1091,27 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.136" +version = "1.0.137" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce31e24b01e1e524df96f1c2fdd054405f8d7376249a5110886fb4b658484789" +checksum = "61ea8d54c77f8315140a05f4c7237403bf38b72704d031543aa1d16abbf517d1" dependencies = [ "serde_derive", ] [[package]] name = "serde_bytes" -version = "0.11.5" +version = "0.11.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16ae07dd2f88a366f15bd0632ba725227018c69a1c8550a927324f8eb8368bb9" +checksum = "212e73464ebcde48d723aa02eb270ba62eff38a9b732df31f33f1b4e145f3a54" dependencies = [ "serde", ] [[package]] name = "serde_derive" -version = "1.0.136" +version = "1.0.137" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08597e7152fcd306f41838ed3e37be9eaeed2b61c42e2117266a554fab4662f9" +checksum = "1f26faba0c3959972377d3b2d306ee9f71faee9714294e41bb777f83f88578be" dependencies = [ "proc-macro2", "quote", @@ -1173,9 +1120,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.78" +version = "1.0.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d23c1ba4cf0efd44be32017709280b32d1cea5c3f1275c3b6d9e8bc54f758085" +checksum = "9b7ce2b32a1aed03c558dc61a5cd328f15aff2dbc17daad8fb8af04d2100e15c" dependencies = [ "itoa", "ryu", @@ -1196,15 +1143,13 @@ dependencies = [ [[package]] name = "sha-1" -version = "0.9.8" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99cd6713db3cf16b6c84e06321e049a9b9f699826e16096d23bbcc44d15d51a6" +checksum = "028f48d513f9678cda28f6e4064755b3fbb2af6acd672f2c209b62323f7aea0f" dependencies = [ - "block-buffer", - "cfg-if 1.0.0", + "cfg-if", "cpufeatures", "digest", - "opaque-debug", ] [[package]] @@ -1227,9 +1172,9 @@ checksum = "a86232ab60fa71287d7f2ddae4a7073f6b7aac33631c3015abb556f08c6d0a3e" [[package]] name = "smallvec" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ecab6c735a6bb4139c0caafd0cc3635748bbb3acf4550e8138122099251f309" +checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83" [[package]] name = "sourcemap" @@ -1255,26 +1200,26 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "string_cache" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33994d0838dc2d152d17a62adf608a869b5e846b65b389af7f3dbc1de45c5b26" +checksum = "213494b7a2b503146286049378ce02b482200519accc31872ee8be91fa820a08" dependencies = [ - "lazy_static", "new_debug_unreachable", - "parking_lot 0.11.1", - "phf_shared 0.10.0", + "once_cell", + "parking_lot", + "phf_shared", "precomputed-hash", "serde", ] [[package]] name = "string_cache_codegen" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f24c8e5e19d22a726626f1a5e16fe15b132dcf21d10177fa5a45ce7962996b97" +checksum = "6bb30289b722be4ff74a408c3cc27edeaad656e06cb1fe8fa9231fa59c728988" dependencies = [ "phf_generator", - "phf_shared 0.8.0", + "phf_shared", "proc-macro2", "quote", ] @@ -1306,9 +1251,9 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "swc_atoms" -version = "0.2.9" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f5229fe227ff0060e13baa386d6e368797700eab909523f730008d191ee53ae" +checksum = "ba8735ce37e421749498e038955abc1135eec6a4af0b54a173e55d2e5542d472" dependencies = [ "string_cache", "string_cache_codegen", @@ -1322,7 +1267,7 @@ checksum = "84fed4a980e12c737171a7b17c5e0a2f4272899266fa0632ea4e31264ebdfdb5" dependencies = [ "ahash", "anyhow", - "dashmap 5.1.0", + "dashmap", "once_cell", "regex", "serde", @@ -1331,14 +1276,14 @@ dependencies = [ [[package]] name = "swc_common" -version = "0.17.14" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1e413d6e2d304b45adb55f85d9ba684e1020616156a7483e6a060a2e47db972" +checksum = "4ec38be09c030adbebf10014d0157df25826dba7254f60ef30d73cc24c267a06" dependencies = [ "ahash", "ast_node", "better_scoped_tls", - "cfg-if 0.1.10", + "cfg-if", "debug_unreachable", "either", "from_variant", @@ -1356,11 +1301,37 @@ dependencies = [ "url", ] +[[package]] +name = "swc_config" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8bb05ef56c14b95dd7e62e95960153af811b9a447287f1f6ca59f1337fb83d4" +dependencies = [ + "anyhow", + "indexmap", + "serde", + "serde_json", + "swc_config_macro", +] + +[[package]] +name = "swc_config_macro" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb64bc03d90fd5c90d6ab917bb2b1d7fbd31957df39e31ea24a3f554b4372251" +dependencies = [ + "pmutil", + "proc-macro2", + "quote", + "swc_macros_common", + "syn", +] + [[package]] name = "swc_ecma_ast" -version = "0.69.1" +version = "0.78.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4b2e9a1a9e3f71557971dd096aa3fff7487f2c419d2f93c0d71445352a36dc8" +checksum = "6ed68ad13e4489f309ffed9d302337d7c8bde11d00b8b275b7aa7fda4da035bf" dependencies = [ "is-macro", "num-bigint", @@ -1373,14 +1344,15 @@ dependencies = [ [[package]] name = "swc_ecma_codegen" -version = "0.94.1" +version = "0.107.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f352c9d36b0d5b92ccab7e774bbf243a1d3be721792798815b76f69e1e56e32" +checksum = "b08ceb40519303a12fa987ff2d1888cb64e654adab7d5f475cc0b389ff3b0fba" dependencies = [ "bitflags", "memchr", "num-bigint", "once_cell", + "rustc-hash", "sourcemap", "swc_atoms", "swc_common", @@ -1391,9 +1363,9 @@ dependencies = [ [[package]] name = "swc_ecma_codegen_macros" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdbf826c739281cdb3b3c23883fd1a7586ea1c15b1287530e7123a7fad8f0e25" +checksum = "59949619b2ef45eedb6c399d05f2c3c7bc678b5074b3103bb670f9e05bb99042" dependencies = [ "pmutil", "proc-macro2", @@ -1404,16 +1376,17 @@ dependencies = [ [[package]] name = "swc_ecma_loader" -version = "0.29.0" +version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9ab69df5d4de425833e02de111f14b5544b39ad9c9b82c97e4835fc55c8f1b6" +checksum = "0f7baaa5b99cdf49e830caf54b837891c5c38275ac94c31d555859be95f6479c" dependencies = [ "ahash", "anyhow", - "dashmap 4.0.2", + "dashmap", "normpath", "once_cell", "path-clean", + "pathdiff", "serde", "serde_json", "swc_common", @@ -1422,27 +1395,30 @@ dependencies = [ [[package]] name = "swc_ecma_minifier" -version = "0.88.1" +version = "0.113.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "795c58670d843f62f1e349fe537a8ec65dac21c78fd527db5b83ae0952cf78bd" +checksum = "1c4ea20be3e04071bb9a5df3dcf159dcfb2c11010d88b13c9baa8f8106e189a8" dependencies = [ "ahash", + "arrayvec", "indexmap", "once_cell", - "parking_lot 0.12.0", + "parking_lot", "rayon", "regex", "retain_mut", + "rustc-hash", "serde", "serde_json", "swc_atoms", "swc_cached", "swc_common", + "swc_config", "swc_ecma_ast", "swc_ecma_codegen", "swc_ecma_parser", - "swc_ecma_transforms", "swc_ecma_transforms_base", + "swc_ecma_transforms_optimization", "swc_ecma_utils", "swc_ecma_visit", "swc_timer", @@ -1452,9 +1428,9 @@ dependencies = [ [[package]] name = "swc_ecma_parser" -version = "0.92.7" +version = "0.104.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d53e529ee2504ac513171e8c31c77c6c527d56a27259807d1950ed58b3901a28" +checksum = "efb97dc6efc95313dedc5158055cc811da77395ef7b54be61948b5ad097a3671" dependencies = [ "either", "enum_kind", @@ -1472,9 +1448,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms" -version = "0.130.0" +version = "0.153.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a9333d80deef03e37cfbf0a396d1604fbec8a6d72ad6cb27138367c1d19fc94" +checksum = "5755ffcda1942d7c261a8acd3ae49fe686e2b7476eeecd6cb5e377a95eb1f5d9" dependencies = [ "swc_atoms", "swc_common", @@ -1490,13 +1466,14 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_base" -version = "0.66.1" +version = "0.84.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8a3def66ae98c8e3cd6436e02e42a787fc2ee7956ee73e13a8b449c0560a328" +checksum = "6be33c0ca26095f5d8e83f9df14f5798233e29f09125d3afaf925b70920da8a1" dependencies = [ "better_scoped_tls", "once_cell", "phf", + "rustc-hash", "serde", "smallvec", "swc_atoms", @@ -1523,9 +1500,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_module" -version = "0.90.0" +version = "0.111.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60762763c4c5ec8f9f8a86408fd0cfa01802d5a274f8ecdb4327ba6292fff52a" +checksum = "e6baca7d64bf60c7d184d647dae50dea51a8edcc262ffaceb07a91b81d64aa36" dependencies = [ "Inflector", "ahash", @@ -1547,14 +1524,15 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_optimization" -version = "0.100.0" +version = "0.123.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98ce53a1efa05e9bbeb2f8a16a1e153801708d7bea692776442bf43576f1921b" +checksum = "cd5c7efdde630a05a3f6ff453dd54946011f4cdc92fe94fbb081f87dcd72b403" dependencies = [ "ahash", - "dashmap 4.0.2", + "dashmap", "indexmap", "once_cell", + "rustc-hash", "serde_json", "swc_atoms", "swc_common", @@ -1569,13 +1547,13 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_react" -version = "0.92.0" +version = "0.113.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b618bfc4d3a99df1081bfe0b833d14572ab36dd2c245d1ab51c581b2d74b843" +checksum = "a32b923408e146e3caec63e829f81a7979c0efa46dfec20656fed7bd0fe7a917" dependencies = [ "ahash", "base64 0.13.0", - "dashmap 4.0.2", + "dashmap", "indexmap", "once_cell", "regex", @@ -1584,6 +1562,7 @@ dependencies = [ "string_enum", "swc_atoms", "swc_common", + "swc_config", "swc_ecma_ast", "swc_ecma_parser", "swc_ecma_transforms_base", @@ -1594,9 +1573,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_typescript" -version = "0.95.0" +version = "0.116.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b126d9e2545e975d2ae09277c2f16bb682b0111f03e643e3b59e56831a7f6b4" +checksum = "8dcda94818a971a654899b1a5fe04cad5435da5e3542ebbcc4ecbb027e904e5d" dependencies = [ "serde", "swc_atoms", @@ -1610,9 +1589,9 @@ dependencies = [ [[package]] name = "swc_ecma_utils" -version = "0.71.0" +version = "0.85.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee41829a14f59d6f93a5f5721f08797b214caa4d037913b51ab61a9d31e10576" +checksum = "dff9d469b284a48317a695a81346a9609d04ce3a31da4493aac508e0d48a4257" dependencies = [ "indexmap", "once_cell", @@ -1625,9 +1604,9 @@ dependencies = [ [[package]] name = "swc_ecma_visit" -version = "0.55.0" +version = "0.64.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b359c0ddd3f474dcc379d3c011670be3b855229bcb523e6571897c5beae42957" +checksum = "f2d3783a0dd1e301ae2945ab1241405f913427f9512ec62756d3d2072f7c21bb" dependencies = [ "num-bigint", "swc_atoms", @@ -1639,9 +1618,9 @@ dependencies = [ [[package]] name = "swc_ecmascript" -version = "0.131.0" +version = "0.156.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ef93d48b2d35cd2eda8d07a7d2af932d3cb3432d19859948bd6383110ed632c" +checksum = "67f282a0e17a9f48d72b04f611f0553bad26049b7b1bf2fa6b9074682f46462e" dependencies = [ "swc_ecma_ast", "swc_ecma_codegen", @@ -1666,9 +1645,9 @@ dependencies = [ [[package]] name = "swc_macros_common" -version = "0.3.2" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf7c68e78ffbcba3d38abe6d0b76a0e1a37888b5c9301db3426537207090ada3" +checksum = "d5dca3f08d02da4684c3373150f7c045128f81ea00f0c434b1b012bc65a6cce3" dependencies = [ "pmutil", "proc-macro2", @@ -1678,9 +1657,9 @@ dependencies = [ [[package]] name = "swc_timer" -version = "0.4.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1371a950402552de1a2bf7beeb619b7fff9e4ab7e50f516db9a791869a4f731f" +checksum = "60ca6c177dc2b848c73d721eea6c33f047c82a1e4a5795ea9b8114ced027f8ed" dependencies = [ "tracing", ] @@ -1711,9 +1690,9 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.81" +version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2afee18b8beb5a596ecb4a2dce128c719b4ba399d34126b9e4396e3f9860966" +checksum = "a07e33e919ebcd69113d5be0e4d70c5707004ff45188910106854f38b960df4a" dependencies = [ "proc-macro2", "quote", @@ -1769,7 +1748,7 @@ version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a1bdf54a7c28a2bbf701e1d2233f6c77f473486b94bee4f9678da5a148dca7f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "pin-project-lite", "tracing-attributes", "tracing-core", @@ -1888,12 +1867,6 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" -[[package]] -name = "wasi" -version = "0.9.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" - [[package]] name = "wasi" version = "0.10.2+wasi-snapshot-preview1" diff --git a/packages/qwik/src/optimizer/core/Cargo.toml b/packages/qwik/src/optimizer/core/Cargo.toml index 0bffb9a4df9..bba836ea017 100644 --- a/packages/qwik/src/optimizer/core/Cargo.toml +++ b/packages/qwik/src/optimizer/core/Cargo.toml @@ -13,25 +13,24 @@ categories = ["development-tools", "development-tools::cargo-plugins"] crate-type = ["rlib"] [dependencies] -swc_ecmascript = { version = "0.131.0", features = ["parser", "transforms", "module", "typescript", "optimization", "minifier", "react", "utils", "visit", "codegen", "utils"] } -swc_common = { version = "0.17.14", features = ["sourcemap"] } -swc_atoms = "0.2.9" -serde = "1.0.136" -serde_bytes = "0.11.5" +swc_ecmascript = { version = "0.156.0", features = ["parser", "transforms", "module", "typescript", "optimization", "minifier", "react", "utils", "visit", "codegen", "utils"] } +swc_common = { version = "0.18.1", features = ["sourcemap"] } +swc_atoms = "0.2.11" +serde = "1.0.137" +serde_bytes = "0.11.6" simple-error = "0.2.3" base64 = "0.13.0" pathdiff = "0.2.1" -relative-path = "1.6.1" +relative-path = "1.7.0" lazy_static = "1.4.0" -regex = "1.5.4" -anyhow = "1.0.53" +anyhow = "1.0.57" derivative = "2.2.0" rayon = "1.5.1" path-slash="0.1.4" [dev-dependencies] -insta = "1.12.0" -serde_json = "1.0.78" +insta = "1.14.0" +serde_json = "1.0.81" [features] fs=[] diff --git a/packages/qwik/src/optimizer/core/src/code_move.rs b/packages/qwik/src/optimizer/core/src/code_move.rs index 76ef5bd2324..8ad663bdc60 100644 --- a/packages/qwik/src/optimizer/core/src/code_move.rs +++ b/packages/qwik/src/optimizer/core/src/code_move.rs @@ -80,8 +80,7 @@ pub fn new_module(ctx: NewModuleCtx) -> Result<(ast::Module, SingleThreadedComme src: ast::Str { span: DUMMY_SP, value: fix_path(ctx.origin, "a", import.source.as_ref())?, - kind: ast::StrKind::Synthesized, - has_escape: false, + raw: None, }, specifiers: vec![specifier], }, @@ -100,8 +99,7 @@ pub fn new_module(ctx: NewModuleCtx) -> Result<(ast::Module, SingleThreadedComme src: ast::Str { span: DUMMY_SP, value: fix_path(ctx.origin, "a", &format!("./{}", ctx.path.file_stem))?, - kind: ast::StrKind::Synthesized, - has_escape: false, + raw: None, }, specifiers: vec![ast::ImportSpecifier::Named(ast::ImportNamedSpecifier { is_type_only: false, @@ -217,7 +215,10 @@ fn test_fix_path() { assert!(fix_path("/components", "a", "./state").is_err()) } -pub fn generate_entries(mut output: TransformOutput) -> Result { +pub fn generate_entries( + mut output: TransformOutput, + explicity_extensions: bool, +) -> Result { let source_map = Lrc::new(SourceMap::default()); let mut entries_map: BTreeMap<&str, Vec<&HookAnalysis>> = BTreeMap::new(); let mut new_modules = Vec::with_capacity(output.modules.len()); @@ -233,7 +234,7 @@ pub fn generate_entries(mut output: TransformOutput) -> Result Result ast::Module { +fn new_entry_module(hooks: &[&HookAnalysis], explicity_extensions: bool) -> ast::Module { let mut module = ast::Module { span: DUMMY_SP, body: Vec::with_capacity(hooks.len()), shebang: None, }; for hook in hooks { + let mut src = ["./", &hook.canonical_filename].concat(); + if explicity_extensions { + src = src + "." + hook.extension.as_ref(); + } module .body .push(ast::ModuleItem::ModuleDecl(ast::ModuleDecl::ExportNamed( @@ -267,9 +272,8 @@ fn new_entry_module(hooks: &[&HookAnalysis]) -> ast::Module { asserts: None, src: Some(ast::Str { span: DUMMY_SP, - value: JsWord::from(["./", &hook.canonical_filename].concat()), - kind: ast::StrKind::Synthesized, - has_escape: false, + value: JsWord::from(src), + raw: None, }), specifiers: vec![ast::ExportSpecifier::Named(ast::ExportNamedSpecifier { is_type_only: false, diff --git a/packages/qwik/src/optimizer/core/src/entry_strategy.rs b/packages/qwik/src/optimizer/core/src/entry_strategy.rs index 7eee23aa0c2..eb75d19f4c8 100644 --- a/packages/qwik/src/optimizer/core/src/entry_strategy.rs +++ b/packages/qwik/src/optimizer/core/src/entry_strategy.rs @@ -1,5 +1,6 @@ use crate::parse::PathData; use crate::transform::HookData; +use crate::words::*; use serde::{Deserialize, Serialize}; use std::collections::HashMap; use swc_atoms::JsWord; @@ -89,11 +90,12 @@ impl EntryPolicy for SmartStrategy { _symbol: &str, _path: &PathData, context: &[String], - _hook_data: &HookData, + hook_data: &HookData, ) -> Option { - if context.iter().any(|h| h == "onMount") { + if hook_data.ctx_name == *USE_SERVER_MOUNT { return Some(ENTRY_SERVER.clone()); } + if context.iter().any(|h| h == "onMount") {} Some(context.first().map_or_else( || ENTRY_HOOKS.clone(), |root| JsWord::from(["entry_", root].concat()), diff --git a/packages/qwik/src/optimizer/core/src/lib.rs b/packages/qwik/src/optimizer/core/src/lib.rs index 0d49895328f..f37deafecc2 100644 --- a/packages/qwik/src/optimizer/core/src/lib.rs +++ b/packages/qwik/src/optimizer/core/src/lib.rs @@ -107,7 +107,7 @@ pub fn transform_fs(config: TransformFsOptions) -> Result Result Result Result Result Result Resultdep3(ev) "parent": "Header_component_UVBJuFYfvDo", "ctxKind": "function", "ctxName": "$", - "captures": false + "captures": false, + "loc": [ + 242, + 258 + ] } */ ============================= header_component_uvbjufyfvdo.tsx == @@ -73,7 +77,11 @@ export const Header_component_UVBJuFYfvDo = ()=>{ "parent": null, "ctxKind": "function", "ctxName": "component$", - "captures": false + "captures": false, + "loc": [ + 194, + 323 + ] } */ ============================= app_component_wgkrhwxaqjs.tsx == @@ -97,7 +105,11 @@ export const App_component_wGkRHWXaqjs = ()=>{ "parent": null, "ctxKind": "function", "ctxName": "component$", - "captures": false + "captures": false, + "loc": [ + 357, + 419 + ] } */ ============================= project/test.tsx == diff --git a/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_2.snap b/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_2.snap index f3f9a81054e..1614ecbfe50 100644 --- a/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_2.snap +++ b/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_2.snap @@ -37,7 +37,11 @@ export { hW as handleWatch }; "parent": null, "ctxKind": "function", "ctxName": "component$", - "captures": false + "captures": false, + "loc": [ + 85, + 194 + ] } */ ============================= test.tsx == @@ -68,7 +72,11 @@ export { hW as handleWatch }; "parent": "Header_component_J4uyIhaBNR4", "ctxKind": "function", "ctxName": "$", - "captures": false + "captures": false, + "loc": [ + 156, + 181 + ] } */ == DIAGNOSTICS == diff --git a/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_3.snap b/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_3.snap index 03e20d880c5..92aa54c27af 100644 --- a/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_3.snap +++ b/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_3.snap @@ -40,7 +40,11 @@ export { hW as handleWatch }; "parent": null, "ctxKind": "function", "ctxName": "component$", - "captures": false + "captures": false, + "loc": [ + 109, + 238 + ] } */ ============================= app_header_component_div_onclick_ao7ui7iw6oq.tsx (ENTRY POINT)== @@ -64,7 +68,11 @@ export { hW as handleWatch }; "parent": "App_Header_component_B9F3YeqcO1w", "ctxKind": "function", "ctxName": "$", - "captures": false + "captures": false, + "loc": [ + 192, + 217 + ] } */ ============================= test.tsx == diff --git a/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_4.snap b/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_4.snap index 3db14174935..c83f043f0b1 100644 --- a/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_4.snap +++ b/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_4.snap @@ -40,7 +40,11 @@ export { hW as handleWatch }; "parent": null, "ctxKind": "function", "ctxName": "component$", - "captures": false + "captures": false, + "loc": [ + 106, + 235 + ] } */ ============================= app_header_component_div_onclick_ao7ui7iw6oq.tsx (ENTRY POINT)== @@ -64,7 +68,11 @@ export { hW as handleWatch }; "parent": "App_Header_component_B9F3YeqcO1w", "ctxKind": "function", "ctxName": "$", - "captures": false + "captures": false, + "loc": [ + 189, + 214 + ] } */ ============================= test.tsx == diff --git a/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_5.snap b/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_5.snap index 6ad283ae4f9..08e7d943f0c 100644 --- a/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_5.snap +++ b/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_5.snap @@ -45,7 +45,11 @@ export { hW as handleWatch }; "parent": null, "ctxKind": "function", "ctxName": "component$", - "captures": false + "captures": false, + "loc": [ + 85, + 250 + ] } */ ============================= test.tsx == @@ -76,7 +80,11 @@ export { hW as handleWatch }; "parent": "Header_component_J4uyIhaBNR4", "ctxKind": "function", "ctxName": "$", - "captures": false + "captures": false, + "loc": [ + 200, + 225 + ] } */ == DIAGNOSTICS == diff --git a/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_6.snap b/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_6.snap index 3d097c6f125..9cd204655c1 100644 --- a/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_6.snap +++ b/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_6.snap @@ -29,7 +29,11 @@ export { hW as handleWatch }; "parent": null, "ctxKind": "function", "ctxName": "$", - "captures": false + "captures": false, + "loc": [ + 74, + 99 + ] } */ ============================= test.tsx == diff --git a/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_7.snap b/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_7.snap index 4c06bde7cc6..bf6b1a41f31 100644 --- a/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_7.snap +++ b/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_7.snap @@ -44,7 +44,11 @@ export { hW as handleWatch }; "parent": null, "ctxKind": "function", "ctxName": "component$", - "captures": false + "captures": false, + "loc": [ + 86, + 197 + ] } */ ============================= test.tsx == @@ -79,7 +83,11 @@ export { hW as handleWatch }; "parent": null, "ctxKind": "function", "ctxName": "component$", - "captures": false + "captures": false, + "loc": [ + 224, + 271 + ] } */ ============================= header_component_div_onclick_i7ekvwh3674.tsx (ENTRY POINT)== @@ -103,7 +111,11 @@ export { hW as handleWatch }; "parent": "Header_component_J4uyIhaBNR4", "ctxKind": "function", "ctxName": "$", - "captures": false + "captures": false, + "loc": [ + 157, + 182 + ] } */ == DIAGNOSTICS == diff --git a/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_8.snap b/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_8.snap index 00bc47ad28c..1d3fcce0121 100644 --- a/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_8.snap +++ b/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_8.snap @@ -41,7 +41,11 @@ export { hW as handleWatch }; "parent": null, "ctxKind": "function", "ctxName": "component$", - "captures": false + "captures": false, + "loc": [ + 86, + 296 + ] } */ ============================= header_component_1_2b8d0oh9zwc.tsx (ENTRY POINT)== @@ -70,7 +74,11 @@ export { hW as handleWatch }; "parent": "Header_component_J4uyIhaBNR4", "ctxKind": "function", "ctxName": "$", - "captures": false + "captures": false, + "loc": [ + 107, + 292 + ] } */ ============================= test.tsx == diff --git a/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_9.snap b/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_9.snap index 9557e803d09..cc5d2137573 100644 --- a/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_9.snap +++ b/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_9.snap @@ -48,7 +48,11 @@ export { hW as handleWatch }; "parent": null, "ctxKind": "function", "ctxName": "$", - "captures": false + "captures": false, + "loc": [ + 69, + 376 + ] } */ ============================= test.tsx == diff --git a/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_capture_imports.snap b/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_capture_imports.snap index 80aa7de380e..66a1dc7c0cd 100644 --- a/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_capture_imports.snap +++ b/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_capture_imports.snap @@ -44,7 +44,11 @@ export { hW as handleWatch }; "parent": "App_component_ckEPmXZlub0", "ctxKind": "function", "ctxName": "useStyles$", - "captures": false + "captures": false, + "loc": [ + 212, + 228 + ] } */ ============================= app_component_ckepmxzlub0.js (ENTRY POINT)== @@ -73,7 +77,11 @@ export { hW as handleWatch }; "parent": null, "ctxKind": "function", "ctxName": "component$", - "captures": false + "captures": false, + "loc": [ + 189, + 254 + ] } */ ============================= app_component_usestyles_1_xbk4w0zkwe8.js (ENTRY POINT)== @@ -97,7 +105,11 @@ export { hW as handleWatch }; "parent": "App_component_ckEPmXZlub0", "ctxKind": "function", "ctxName": "useStyles$", - "captures": false + "captures": false, + "loc": [ + 246, + 250 + ] } */ == DIAGNOSTICS == diff --git a/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_capturing_fn_class.snap b/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_capturing_fn_class.snap index 2fe3ae85673..11fe3b416ac 100644 --- a/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_capturing_fn_class.snap +++ b/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_capturing_fn_class.snap @@ -60,7 +60,11 @@ export { hW as handleWatch }; "parent": null, "ctxKind": "function", "ctxName": "component$", - "captures": false + "captures": false, + "loc": [ + 83, + 293 + ] } */ ============================= app_component_1_w0t0o3qmovu.js (ENTRY POINT)== @@ -88,7 +92,11 @@ export { hW as handleWatch }; "parent": "App_component_ckEPmXZlub0", "ctxKind": "function", "ctxName": "$", - "captures": false + "captures": false, + "loc": [ + 198, + 289 + ] } */ == DIAGNOSTICS == diff --git a/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_custom_inlined_functions.snap b/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_custom_inlined_functions.snap index b28a9cd5fcf..789cd5f3865 100644 --- a/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_custom_inlined_functions.snap +++ b/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_custom_inlined_functions.snap @@ -68,7 +68,11 @@ export { hW as handleWatch }; "parent": "App_component_ckEPmXZlub0", "ctxKind": "function", "ctxName": "useMemo$", - "captures": true + "captures": true, + "loc": [ + 280, + 327 + ] } */ ============================= lightweight_usememo_uicxvtqf1a8.js (ENTRY POINT)== @@ -93,7 +97,11 @@ export { hW as handleWatch }; "parent": null, "ctxKind": "function", "ctxName": "useMemo$", - "captures": false + "captures": false, + "loc": [ + 450, + 497 + ] } */ ============================= app_component_ckepmxzlub0.js (ENTRY POINT)== @@ -130,7 +138,11 @@ export { hW as handleWatch }; "parent": null, "ctxKind": "function", "ctxName": "component$", - "captures": false + "captures": false, + "loc": [ + 214, + 393 + ] } */ ============================= app_component_1_w0t0o3qmovu.js (ENTRY POINT)== @@ -159,7 +171,11 @@ export { hW as handleWatch }; "parent": "App_component_ckEPmXZlub0", "ctxKind": "function", "ctxName": "$", - "captures": true + "captures": true, + "loc": [ + 343, + 389 + ] } */ == DIAGNOSTICS == diff --git a/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_explicit_ext_no_transpile.snap b/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_explicit_ext_no_transpile.snap index c23d1bd2018..370f25b0ec3 100644 --- a/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_explicit_ext_no_transpile.snap +++ b/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_explicit_ext_no_transpile.snap @@ -18,22 +18,19 @@ export const App = component$((props) => { import * as qwik from "@builder.io/qwik"; import { componentQrl } from "@builder.io/qwik"; -export const App = /*#__PURE__*/ componentQrl(qwik.qrl(()=>import("./app_component_ckepmxzlub0.tsx") +export const App = /*#__PURE__*/ componentQrl(qwik.qrl(()=>import("./entry_hooks.tsx") , "App_component_ckEPmXZlub0")); -============================= app_component_usestyles_t35nsa5uv7u.tsx (ENTRY POINT)== +============================= app_component_usestyles_t35nsa5uv7u.tsx == import * as qwik from "@builder.io/qwik"; export const App_component_useStyles_t35nSa5UV7U = 'hola'; -import { handleWatch as hW } from "@builder.io/qwik"; -hW.issue456 && hW.issue123(); -export { hW as handleWatch }; /* { "origin": "test.tsx", "name": "App_component_useStyles_t35nSa5UV7U", - "entry": null, + "entry": "entry_hooks", "displayName": "App_component_useStyles", "hash": "t35nSa5UV7U", "canonicalFilename": "app_component_usestyles_t35nsa5uv7u", @@ -41,28 +38,29 @@ export { hW as handleWatch }; "parent": "App_component_ckEPmXZlub0", "ctxKind": "function", "ctxName": "useStyles$", - "captures": false + "captures": false, + "loc": [ + 123, + 129 + ] } */ -============================= app_component_ckepmxzlub0.tsx (ENTRY POINT)== +============================= app_component_ckepmxzlub0.tsx == import * as qwik from "@builder.io/qwik"; import { useStylesQrl } from "@builder.io/qwik"; export const App_component_ckEPmXZlub0 = (props)=>{ - useStylesQrl(qwik.qrl(()=>import("./app_component_usestyles_t35nsa5uv7u.tsx") + useStylesQrl(qwik.qrl(()=>import("./entry_hooks.tsx") , "App_component_useStyles_t35nSa5UV7U")); - return qwik.qrl(()=>import("./app_component_1_w0t0o3qmovu.tsx") + return qwik.qrl(()=>import("./entry_hooks.tsx") , "App_component_1_w0t0o3QMovU"); }; -import { handleWatch as hW } from "@builder.io/qwik"; -hW.issue456 && hW.issue123(); -export { hW as handleWatch }; /* { "origin": "test.tsx", "name": "App_component_ckEPmXZlub0", - "entry": null, + "entry": "entry_hooks", "displayName": "App_component", "hash": "ckEPmXZlub0", "canonicalFilename": "app_component_ckepmxzlub0", @@ -70,23 +68,24 @@ export { hW as handleWatch }; "parent": null, "ctxKind": "function", "ctxName": "component$", - "captures": false + "captures": false, + "loc": [ + 95, + 182 + ] } */ -============================= app_component_1_w0t0o3qmovu.tsx (ENTRY POINT)== +============================= app_component_1_w0t0o3qmovu.tsx == import * as qwik from "@builder.io/qwik"; export const App_component_1_w0t0o3QMovU = ()=>
; -import { handleWatch as hW } from "@builder.io/qwik"; -hW.issue456 && hW.issue123(); -export { hW as handleWatch }; /* { "origin": "test.tsx", "name": "App_component_1_w0t0o3QMovU", - "entry": null, + "entry": "entry_hooks", "displayName": "App_component_1", "hash": "w0t0o3QMovU", "canonicalFilename": "app_component_1_w0t0o3qmovu", @@ -94,9 +93,22 @@ export { hW as handleWatch }; "parent": "App_component_ckEPmXZlub0", "ctxKind": "function", "ctxName": "$", - "captures": false + "captures": false, + "loc": [ + 145, + 178 + ] } */ +============================= entry_hooks.js (ENTRY POINT)== + +export { App_component_useStyles_t35nSa5UV7U } from "./app_component_usestyles_t35nsa5uv7u.tsx"; +export { App_component_ckEPmXZlub0 } from "./app_component_ckepmxzlub0.tsx"; +export { App_component_1_w0t0o3QMovU } from "./app_component_1_w0t0o3qmovu.tsx"; +import { handleWatch as hW } from "@builder.io/qwik"; +hW.issue456 && hW.issue123(); +export { hW as handleWatch }; + == DIAGNOSTICS == [] diff --git a/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_explicit_ext_transpile.snap b/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_explicit_ext_transpile.snap index f4e2a505121..25de84cf431 100644 --- a/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_explicit_ext_transpile.snap +++ b/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_explicit_ext_transpile.snap @@ -41,7 +41,11 @@ export { hW as handleWatch }; "parent": "App_component_ckEPmXZlub0", "ctxKind": "function", "ctxName": "useStyles$", - "captures": false + "captures": false, + "loc": [ + 123, + 129 + ] } */ ============================= app_component_ckepmxzlub0.js (ENTRY POINT)== @@ -70,7 +74,11 @@ export { hW as handleWatch }; "parent": null, "ctxKind": "function", "ctxName": "component$", - "captures": false + "captures": false, + "loc": [ + 95, + 182 + ] } */ ============================= app_component_1_w0t0o3qmovu.js (ENTRY POINT)== @@ -95,7 +103,11 @@ export { hW as handleWatch }; "parent": "App_component_ckEPmXZlub0", "ctxKind": "function", "ctxName": "$", - "captures": false + "captures": false, + "loc": [ + 145, + 178 + ] } */ == DIAGNOSTICS == diff --git a/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_exports.snap b/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_exports.snap index d51ec95bb05..52dc1a20c4a 100644 --- a/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_exports.snap +++ b/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_exports.snap @@ -52,7 +52,11 @@ export { hW as handleWatch }; "parent": null, "ctxKind": "function", "ctxName": "component$", - "captures": false + "captures": false, + "loc": [ + 307, + 499 + ] } */ ============================= project/test.tsx == @@ -110,7 +114,11 @@ export { hW as handleWatch }; "parent": "Header_component_UVBJuFYfvDo", "ctxKind": "function", "ctxName": "$", - "captures": false + "captures": false, + "loc": [ + 328, + 496 + ] } */ == DIAGNOSTICS == diff --git a/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_functional_component.snap b/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_functional_component.snap index dd11d67324e..d85fd03f701 100644 --- a/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_functional_component.snap +++ b/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_functional_component.snap @@ -40,7 +40,11 @@ export { hW as handleWatch }; "parent": null, "ctxKind": "function", "ctxName": "component$", - "captures": false + "captures": false, + "loc": [ + 88, + 205 + ] } */ ============================= test.tsx == diff --git a/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_functional_component_2.snap b/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_functional_component_2.snap index 35b99cf6a3e..c5f179df91a 100644 --- a/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_functional_component_2.snap +++ b/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_functional_component_2.snap @@ -71,7 +71,11 @@ export { hW as handleWatch }; "parent": "App_component_ckEPmXZlub0", "ctxKind": "event", "ctxName": "onClick$", - "captures": true + "captures": true, + "loc": [ + 366, + 391 + ] } */ ============================= app_component_div_button_onclick_f5nww9e63a4.js (ENTRY POINT)== @@ -98,7 +102,11 @@ export { hW as handleWatch }; "parent": "App_component_ckEPmXZlub0", "ctxKind": "event", "ctxName": "onClick$", - "captures": true + "captures": true, + "loc": [ + 522, + 590 + ] } */ ============================= app_component_ckepmxzlub0.js (ENTRY POINT)== @@ -156,7 +164,11 @@ export { hW as handleWatch }; "parent": null, "ctxKind": "function", "ctxName": "component$", - "captures": false + "captures": false, + "loc": [ + 186, + 708 + ] } */ == DIAGNOSTICS == diff --git a/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_functional_component_capture_props.snap b/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_functional_component_capture_props.snap index 213357fd15d..1d2f6cca633 100644 --- a/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_functional_component_capture_props.snap +++ b/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_functional_component_capture_props.snap @@ -51,7 +51,11 @@ export { hW as handleWatch }; "parent": "App_component_1_w0t0o3QMovU", "ctxKind": "event", "ctxName": "onClick$", - "captures": true + "captures": true, + "loc": [ + 345, + 379 + ] } */ ============================= app_component_ckepmxzlub0.js (ENTRY POINT)== @@ -99,7 +103,11 @@ export { hW as handleWatch }; "parent": null, "ctxKind": "function", "ctxName": "component$", - "captures": false + "captures": false, + "loc": [ + 93, + 540 + ] } */ ============================= app_component_1_w0t0o3qmovu.js (ENTRY POINT)== @@ -151,7 +159,11 @@ export { hW as handleWatch }; "parent": "App_component_ckEPmXZlub0", "ctxKind": "function", "ctxName": "$", - "captures": true + "captures": true, + "loc": [ + 293, + 536 + ] } */ == DIAGNOSTICS == diff --git a/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_invalid_hook_expr1.snap b/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_invalid_hook_expr1.snap index f19f1d8c6fe..115623afb19 100644 --- a/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_invalid_hook_expr1.snap +++ b/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_invalid_hook_expr1.snap @@ -47,7 +47,11 @@ export { hW as handleWatch }; "parent": "App_component_ckEPmXZlub0", "ctxKind": "function", "ctxName": "useStyles$", - "captures": false + "captures": false, + "loc": [ + 219, + 224 + ] } */ ============================= app_component_ckepmxzlub0.js (ENTRY POINT)== @@ -83,7 +87,11 @@ export { hW as handleWatch }; "parent": null, "ctxKind": "function", "ctxName": "component$", - "captures": false + "captures": false, + "loc": [ + 160, + 335 + ] } */ ============================= app_component_1_w0t0o3qmovu.js (ENTRY POINT)== @@ -106,7 +114,11 @@ export { hW as handleWatch }; "parent": "App_component_ckEPmXZlub0", "ctxKind": "function", "ctxName": "$", - "captures": false + "captures": false, + "loc": [ + 325, + 331 + ] } */ == DIAGNOSTICS == diff --git a/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_invalid_references.snap b/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_invalid_references.snap index b9a2da7e724..085c09d2478 100644 --- a/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_invalid_references.snap +++ b/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_invalid_references.snap @@ -55,7 +55,11 @@ export { hW as handleWatch }; "parent": null, "ctxKind": "function", "ctxName": "component$", - "captures": false + "captures": false, + "loc": [ + 191, + 381 + ] } */ ============================= app_component_1_w0t0o3qmovu.js (ENTRY POINT)== @@ -81,7 +85,11 @@ export { hW as handleWatch }; "parent": "App_component_ckEPmXZlub0", "ctxKind": "function", "ctxName": "$", - "captures": false + "captures": false, + "loc": [ + 313, + 377 + ] } */ == DIAGNOSTICS == diff --git a/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_jsx.snap b/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_jsx.snap index c6412532d51..c343f0a7a4b 100644 --- a/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_jsx.snap +++ b/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_jsx.snap @@ -92,7 +92,11 @@ export { hW as handleWatch }; "parent": null, "ctxKind": "function", "ctxName": "component$", - "captures": false + "captures": false, + "loc": [ + 279, + 895 + ] } */ ============================= foo_component_1_dvu6fitwgly.js (ENTRY POINT)== @@ -157,7 +161,11 @@ export { hW as handleWatch }; "parent": "Foo_component_HTDRsvUbLiE", "ctxKind": "function", "ctxName": "$", - "captures": true + "captures": true, + "loc": [ + 305, + 891 + ] } */ == DIAGNOSTICS == diff --git a/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_jsx_import_source.snap b/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_jsx_import_source.snap index fc796faa82a..8ce58903103 100644 --- a/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_jsx_import_source.snap +++ b/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_jsx_import_source.snap @@ -53,7 +53,11 @@ export { hW as handleWatch }; "parent": null, "ctxKind": "function", "ctxName": "qwikify$", - "captures": false + "captures": false, + "loc": [ + 180, + 240 + ] } */ == DIAGNOSTICS == diff --git a/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_jsx_listeners.snap b/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_jsx_listeners.snap index f4f5423e695..d299a2443f0 100644 --- a/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_jsx_listeners.snap +++ b/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_jsx_listeners.snap @@ -58,7 +58,11 @@ export { hW as handleWatch }; "parent": "Foo_component_1_DvU6FitWglY", "ctxKind": "event", "ctxName": "host:onDocumentScroll$", - "captures": false + "captures": false, + "loc": [ + 712, + 753 + ] } */ ============================= test.js == @@ -93,7 +97,11 @@ export { hW as handleWatch }; "parent": null, "ctxKind": "function", "ctxName": "component$", - "captures": false + "captures": false, + "loc": [ + 83, + 1042 + ] } */ ============================= foo_component_div_host_onclick_cpeh970jbey.js (ENTRY POINT)== @@ -117,7 +125,11 @@ export { hW as handleWatch }; "parent": "Foo_component_1_DvU6FitWglY", "ctxKind": "event", "ctxName": "host:onClick$", - "captures": false + "captures": false, + "loc": [ + 638, + 670 + ] } */ ============================= foo_component_1_dvu6fitwgly.js (ENTRY POINT)== @@ -169,7 +181,11 @@ export { hW as handleWatch }; "parent": "Foo_component_HTDRsvUbLiE", "ctxKind": "function", "ctxName": "$", - "captures": false + "captures": false, + "loc": [ + 105, + 1038 + ] } */ ============================= foo_component_div_host_ondocumentscroll_1_em1lspk7jvg.js (ENTRY POINT)== @@ -193,7 +209,11 @@ export { hW as handleWatch }; "parent": "Foo_component_1_DvU6FitWglY", "ctxKind": "event", "ctxName": "host:onDocumentScroll$", - "captures": false + "captures": false, + "loc": [ + 795, + 834 + ] } */ ============================= foo_component_div_custom_pyhnxab17ms.js (ENTRY POINT)== @@ -217,7 +237,11 @@ export { hW as handleWatch }; "parent": "Foo_component_1_DvU6FitWglY", "ctxKind": "event", "ctxName": "custom$", - "captures": false + "captures": false, + "loc": [ + 981, + 1006 + ] } */ ============================= foo_component_div_ondocument_scroll_1q0sgr8te3g.js (ENTRY POINT)== @@ -241,7 +265,11 @@ export { hW as handleWatch }; "parent": "Foo_component_1_DvU6FitWglY", "ctxKind": "event", "ctxName": "onDocument-scroLL$", - "captures": false + "captures": false, + "loc": [ + 568, + 604 + ] } */ ============================= foo_component_div_ondocumentscroll_1_cwneogpmtzi.js (ENTRY POINT)== @@ -265,7 +293,11 @@ export { hW as handleWatch }; "parent": "Foo_component_1_DvU6FitWglY", "ctxKind": "event", "ctxName": "onDocumentScroll$", - "captures": false + "captures": false, + "loc": [ + 365, + 398 + ] } */ ============================= foo_component_div_on_click_ioasjw8vyjc.js (ENTRY POINT)== @@ -289,7 +321,11 @@ export { hW as handleWatch }; "parent": "Foo_component_1_DvU6FitWglY", "ctxKind": "event", "ctxName": "on-cLick$", - "captures": false + "captures": false, + "loc": [ + 428, + 456 + ] } */ ============================= foo_component_div_onclick_m48dyiidsjw.js (ENTRY POINT)== @@ -313,7 +349,11 @@ export { hW as handleWatch }; "parent": "Foo_component_1_DvU6FitWglY", "ctxKind": "event", "ctxName": "onClick$", - "captures": false + "captures": false, + "loc": [ + 229, + 256 + ] } */ ============================= foo_component_div_ondocumentscroll_rwfftfivukc.js (ENTRY POINT)== @@ -337,7 +377,11 @@ export { hW as handleWatch }; "parent": "Foo_component_1_DvU6FitWglY", "ctxKind": "event", "ctxName": "onDocumentScroll$", - "captures": false + "captures": false, + "loc": [ + 293, + 328 + ] } */ ============================= foo_component_handler_h10xztd0e7w.js (ENTRY POINT)== @@ -361,7 +405,11 @@ export { hW as handleWatch }; "parent": "Foo_component_1_DvU6FitWglY", "ctxKind": "function", "ctxName": "$", - "captures": false + "captures": false, + "loc": [ + 139, + 166 + ] } */ ============================= foo_component_div_ondocument_scroll_5vnik61pzom.js (ENTRY POINT)== @@ -385,7 +433,11 @@ export { hW as handleWatch }; "parent": "Foo_component_1_DvU6FitWglY", "ctxKind": "event", "ctxName": "onDocument-sCroll$", - "captures": false + "captures": false, + "loc": [ + 494, + 530 + ] } */ == DIAGNOSTICS == diff --git a/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_lightweight_functional.snap b/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_lightweight_functional.snap index 6599a012715..8736fcab91a 100644 --- a/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_lightweight_functional.snap +++ b/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_lightweight_functional.snap @@ -60,7 +60,11 @@ export { hW as handleWatch }; "parent": null, "ctxKind": "function", "ctxName": "component$", - "captures": false + "captures": false, + "loc": [ + 83, + 221 + ] } */ ============================= buttonarrow_button_onclick_9npo43figik.tsx (ENTRY POINT)== @@ -86,7 +90,11 @@ export { hW as handleWatch }; "parent": null, "ctxKind": "event", "ctxName": "onClick$", - "captures": true + "captures": true, + "loc": [ + 503, + 531 + ] } */ ============================= button_button_onclick_nsm0jyv00jw.tsx (ENTRY POINT)== @@ -112,7 +120,11 @@ export { hW as handleWatch }; "parent": null, "ctxKind": "event", "ctxName": "onClick$", - "captures": true + "captures": true, + "loc": [ + 346, + 374 + ] } */ ============================= test.tsx == diff --git a/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_multi_capture.snap b/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_multi_capture.snap index 7949ca7074c..c29f2a7d859 100644 --- a/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_multi_capture.snap +++ b/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_multi_capture.snap @@ -56,7 +56,11 @@ export { hW as handleWatch }; "parent": null, "ctxKind": "function", "ctxName": "component$", - "captures": false + "captures": false, + "loc": [ + 83, + 278 + ] } */ ============================= bar_component_l80ps8hxf1y.tsx (ENTRY POINT)== @@ -84,7 +88,11 @@ export { hW as handleWatch }; "parent": null, "ctxKind": "function", "ctxName": "component$", - "captures": false + "captures": false, + "loc": [ + 311, + 438 + ] } */ ============================= foo_component_1_dvu6fitwgly.tsx (ENTRY POINT)== @@ -116,7 +124,11 @@ export { hW as handleWatch }; "parent": "Foo_component_HTDRsvUbLiE", "ctxKind": "function", "ctxName": "$", - "captures": true + "captures": true, + "loc": [ + 130, + 274 + ] } */ ============================= bar_component_1_0xsynsnvu3k.tsx (ENTRY POINT)== @@ -146,7 +158,11 @@ export { hW as handleWatch }; "parent": "Bar_component_L80pS8Hxf1Y", "ctxKind": "function", "ctxName": "$", - "captures": true + "captures": true, + "loc": [ + 337, + 434 + ] } */ ============================= test.tsx == diff --git a/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_prod_node.snap b/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_prod_node.snap index a1325f746e0..96ff6717cae 100644 --- a/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_prod_node.snap +++ b/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_prod_node.snap @@ -50,7 +50,11 @@ export { hW as handleWatch }; "parent": null, "ctxKind": "function", "ctxName": "component$", - "captures": false + "captures": false, + "loc": [ + 80, + 310 + ] } */ ============================= s_9dcjc0ujddo.tsx (ENTRY POINT)== @@ -74,7 +78,11 @@ export { hW as handleWatch }; "parent": "s_HTDRsvUbLiE", "ctxKind": "event", "ctxName": "onClick$", - "captures": false + "captures": false, + "loc": [ + 142, + 168 + ] } */ ============================= s_w9ptfrbvk1e.tsx (ENTRY POINT)== @@ -98,7 +106,11 @@ export { hW as handleWatch }; "parent": "s_HTDRsvUbLiE", "ctxKind": "event", "ctxName": "onClick$", - "captures": false + "captures": false, + "loc": [ + 257, + 283 + ] } */ ============================= s_rjqdy8i0mxc.tsx (ENTRY POINT)== @@ -122,7 +134,11 @@ export { hW as handleWatch }; "parent": "s_HTDRsvUbLiE", "ctxKind": "event", "ctxName": "onClick$", - "captures": false + "captures": false, + "loc": [ + 199, + 226 + ] } */ ============================= test.tsx == diff --git a/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_qwik_conflict.snap b/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_qwik_conflict.snap index b380b18032e..7891d78bfc2 100644 --- a/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_qwik_conflict.snap +++ b/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_qwik_conflict.snap @@ -82,7 +82,11 @@ export { hW1 as handleWatch }; "parent": null, "ctxKind": "function", "ctxName": "component$", - "captures": false + "captures": false, + "loc": [ + 216, + 383 + ] } */ ============================= foo_component_1_dvu6fitwgly.js (ENTRY POINT)== @@ -108,7 +112,11 @@ export { hW as handleWatch }; "parent": "Foo_component_HTDRsvUbLiE", "ctxKind": "function", "ctxName": "$", - "captures": false + "captures": false, + "loc": [ + 320, + 379 + ] } */ ============================= root_component_royhjyacbye.js (ENTRY POINT)== @@ -137,7 +145,11 @@ export { hW as handleWatch }; "parent": null, "ctxKind": "function", "ctxName": "component$", - "captures": false + "captures": false, + "loc": [ + 446, + 557 + ] } */ ============================= root_component_1_cbpqnyduhi4.js (ENTRY POINT)== @@ -160,7 +172,11 @@ export { hW as handleWatch }; "parent": "Root_component_royhjYaCbYE", "ctxKind": "function", "ctxName": "$", - "captures": false + "captures": false, + "loc": [ + 470, + 477 + ] } */ ============================= root_component_2_iqsg9sgbdfk.js (ENTRY POINT)== @@ -186,7 +202,11 @@ export { hW as handleWatch }; "parent": "Root_component_royhjYaCbYE", "ctxKind": "function", "ctxName": "$", - "captures": false + "captures": false, + "loc": [ + 494, + 553 + ] } */ == DIAGNOSTICS == diff --git a/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_renamed_exports.snap b/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_renamed_exports.snap index 33e5636d9f8..a2c51ce3411 100644 --- a/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_renamed_exports.snap +++ b/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_renamed_exports.snap @@ -48,7 +48,11 @@ export { hW as handleWatch }; "parent": "App_Component_NuXFTHRjvXE", "ctxKind": "function", "ctxName": "$", - "captures": true + "captures": true, + "loc": [ + 191, + 237 + ] } */ ============================= app_component_nuxfthrjvxe.js (ENTRY POINT)== @@ -80,7 +84,11 @@ export { hW as handleWatch }; "parent": null, "ctxKind": "function", "ctxName": "component$", - "captures": false + "captures": false, + "loc": [ + 117, + 241 + ] } */ == DIAGNOSTICS == diff --git a/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_use_client_effect.snap b/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_use_client_effect.snap index 4fa899c72d3..3b1f88b5236 100644 --- a/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_use_client_effect.snap +++ b/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_use_client_effect.snap @@ -5,29 +5,29 @@ expression: output ==INPUT== - import { component$, useClientEffect$, useStore, useStyles$ } from '@builder.io/qwik'; +import { component$, useClientEffect$, useStore, useStyles$ } from '@builder.io/qwik'; - export const Child = component$(() => { - const state = useStore({ - count: 0 - }); +export const Child = component$(() => { + const state = useStore({ + count: 0 + }); - // Double count watch - useClientEffect$(() => { - const timer = setInterval(() => { - state.count++; - }, 1000); - return () => { - clearInterval(timer); - } - }); + // Double count watch + useClientEffect$(() => { + const timer = setInterval(() => { + state.count++; + }, 1000); + return () => { + clearInterval(timer); + } + }); - return ( -
- {state.count} -
- ); - }); + return ( +
+ {state.count} +
+ ); +}); ============================= test.js == @@ -72,7 +72,11 @@ export { hW as handleWatch }; "parent": null, "ctxKind": "function", "ctxName": "component$", - "captures": false + "captures": false, + "loc": [ + 122, + 463 + ] } */ ============================= child_component_useclienteffect_kyrt1iert9g.js (ENTRY POINT)== @@ -103,7 +107,11 @@ export { hW as handleWatch }; "parent": "Child_component_9GyF01GDKqw", "ctxKind": "function", "ctxName": "useClientEffect$", - "captures": true + "captures": true, + "loc": [ + 232, + 391 + ] } */ == DIAGNOSTICS == diff --git a/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_use_server_mount.snap b/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_use_server_mount.snap new file mode 100644 index 00000000000..862709e5f0d --- /dev/null +++ b/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_use_server_mount.snap @@ -0,0 +1,272 @@ +--- +source: packages/qwik/src/optimizer/core/src/test.rs +expression: output +--- +==INPUT== + + +import { component$, useServerMount$, useStore, useStyles$ } from '@builder.io/qwik'; +import mongo from 'mongodb'; +import redis from 'redis'; + +export const Parent = component$(() => { + const state = useStore({ + text: '' + }); + + // Double count watch + useServerMount$(async () => { + state.text = await mongo.users(); + redis.set(state.text); + }); + + return ( +
console.log('parent')}> + {state.text} +
+ ); +}); + +export const Child = component$(() => { + const state = useStore({ + text: '' + }); + + // Double count watch + useServerMount$(async () => { + state.text = await mongo.users(); + }); + + return ( +
console.log('child')}> + {state.text} +
+ ); +}); + +============================= test.js == + +import * as qwik from "@builder.io/qwik"; +import { componentQrl } from "@builder.io/qwik"; +export const Parent = /*#__PURE__*/ componentQrl(qwik.qrl(()=>import("./entry_Parent") +, "Parent_component_0TaiDayHrlo")); +export const Child = /*#__PURE__*/ componentQrl(qwik.qrl(()=>import("./entry_Child") +, "Child_component_9GyF01GDKqw")); + +============================= parent_component_0taidayhrlo.js == + +import * as qwik from "@builder.io/qwik"; +import { jsx as _jsx } from "@builder.io/qwik/jsx-runtime"; +import { useServerMountQrl } from "@builder.io/qwik"; +import { useStore } from "@builder.io/qwik"; +export const Parent_component_0TaiDayHrlo = ()=>{ + const state = useStore({ + text: '' + }); + // Double count watch + useServerMountQrl(qwik.qrl(()=>import("./entry_server") + , "Parent_component_useServerMount_cQrQm0HrrM8", [ + state + ])); + return /*#__PURE__*/ _jsx("div", { + onClickQrl: qwik.qrl(()=>import("./entry_Parent") + , "Parent_component_div_onClick_C5XE49Nqd3A"), + children: state.text + }); +}; + +/* +{ + "origin": "test.tsx", + "name": "Parent_component_0TaiDayHrlo", + "entry": "entry_Parent", + "displayName": "Parent_component", + "hash": "0TaiDayHrlo", + "canonicalFilename": "parent_component_0taidayhrlo", + "extension": "js", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 178, + 497 + ] +} +*/ +============================= child_component_useservermount_lne1dxu8z28.js == + +import * as qwik from "@builder.io/qwik"; +import mongo from "mongodb"; +export const Child_component_useServerMount_lnE1dxU8z28 = async ()=>{ + const [state] = qwik.useLexicalScope(); + state.text = await mongo.users(); +}; + +/* +{ + "origin": "test.tsx", + "name": "Child_component_useServerMount_lnE1dxU8z28", + "entry": "entry_server", + "displayName": "Child_component_useServerMount", + "hash": "lnE1dxU8z28", + "canonicalFilename": "child_component_useservermount_lne1dxu8z28", + "extension": "js", + "parent": "Child_component_9GyF01GDKqw", + "ctxKind": "function", + "ctxName": "useServerMount$", + "captures": true, + "loc": [ + 642, + 703 + ] +} +*/ +============================= parent_component_div_onclick_c5xe49nqd3a.js == + +import * as qwik from "@builder.io/qwik"; +export const Parent_component_div_onClick_C5XE49Nqd3A = ()=>console.log('parent') +; + +/* +{ + "origin": "test.tsx", + "name": "Parent_component_div_onClick_C5XE49Nqd3A", + "entry": "entry_Parent", + "displayName": "Parent_component_div_onClick", + "hash": "C5XE49Nqd3A", + "canonicalFilename": "parent_component_div_onclick_c5xe49nqd3a", + "extension": "js", + "parent": "Parent_component_0TaiDayHrlo", + "ctxKind": "event", + "ctxName": "onClick$", + "captures": false, + "loc": [ + 419, + 446 + ] +} +*/ +============================= child_component_9gyf01gdkqw.js == + +import * as qwik from "@builder.io/qwik"; +import { jsx as _jsx } from "@builder.io/qwik/jsx-runtime"; +import { useServerMountQrl } from "@builder.io/qwik"; +import { useStore } from "@builder.io/qwik"; +export const Child_component_9GyF01GDKqw = ()=>{ + const state = useStore({ + text: '' + }); + // Double count watch + useServerMountQrl(qwik.qrl(()=>import("./entry_server") + , "Child_component_useServerMount_lnE1dxU8z28", [ + state + ])); + return /*#__PURE__*/ _jsx("div", { + onClickQrl: qwik.qrl(()=>import("./entry_Child") + , "Child_component_div_onClick_elliVSnAiOQ"), + children: state.text + }); +}; + +/* +{ + "origin": "test.tsx", + "name": "Child_component_9GyF01GDKqw", + "entry": "entry_Child", + "displayName": "Child_component", + "hash": "9GyF01GDKqw", + "canonicalFilename": "child_component_9gyf01gdkqw", + "extension": "js", + "parent": null, + "ctxKind": "function", + "ctxName": "component$", + "captures": false, + "loc": [ + 533, + 820 + ] +} +*/ +============================= parent_component_useservermount_cqrqm0hrrm8.js == + +import * as qwik from "@builder.io/qwik"; +import mongo from "mongodb"; +import redis from "redis"; +export const Parent_component_useServerMount_cQrQm0HrrM8 = async ()=>{ + const [state] = qwik.useLexicalScope(); + state.text = await mongo.users(); + redis.set(state.text); +}; + +/* +{ + "origin": "test.tsx", + "name": "Parent_component_useServerMount_cQrQm0HrrM8", + "entry": "entry_server", + "displayName": "Parent_component_useServerMount", + "hash": "cQrQm0HrrM8", + "canonicalFilename": "parent_component_useservermount_cqrqm0hrrm8", + "extension": "js", + "parent": "Parent_component_0TaiDayHrlo", + "ctxKind": "function", + "ctxName": "useServerMount$", + "captures": true, + "loc": [ + 287, + 379 + ] +} +*/ +============================= child_component_div_onclick_ellivsnaioq.js == + +import * as qwik from "@builder.io/qwik"; +export const Child_component_div_onClick_elliVSnAiOQ = ()=>console.log('child') +; + +/* +{ + "origin": "test.tsx", + "name": "Child_component_div_onClick_elliVSnAiOQ", + "entry": "entry_Child", + "displayName": "Child_component_div_onClick", + "hash": "elliVSnAiOQ", + "canonicalFilename": "child_component_div_onclick_ellivsnaioq", + "extension": "js", + "parent": "Child_component_9GyF01GDKqw", + "ctxKind": "event", + "ctxName": "onClick$", + "captures": false, + "loc": [ + 743, + 769 + ] +} +*/ +============================= entry_Child.js (ENTRY POINT)== + +export { Child_component_9GyF01GDKqw } from "./child_component_9gyf01gdkqw"; +export { Child_component_div_onClick_elliVSnAiOQ } from "./child_component_div_onclick_ellivsnaioq"; +import { handleWatch as hW } from "@builder.io/qwik"; +hW.issue456 && hW.issue123(); +export { hW as handleWatch }; + +============================= entry_Parent.js (ENTRY POINT)== + +export { Parent_component_0TaiDayHrlo } from "./parent_component_0taidayhrlo"; +export { Parent_component_div_onClick_C5XE49Nqd3A } from "./parent_component_div_onclick_c5xe49nqd3a"; +import { handleWatch as hW } from "@builder.io/qwik"; +hW.issue456 && hW.issue123(); +export { hW as handleWatch }; + +============================= entry_server.js (ENTRY POINT)== + +export { Child_component_useServerMount_lnE1dxU8z28 } from "./child_component_useservermount_lne1dxu8z28"; +export { Parent_component_useServerMount_cQrQm0HrrM8 } from "./parent_component_useservermount_cqrqm0hrrm8"; +import { handleWatch as hW } from "@builder.io/qwik"; +hW.issue456 && hW.issue123(); +export { hW as handleWatch }; + +== DIAGNOSTICS == + +[] diff --git a/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_with_style.snap b/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_with_style.snap index e15a697b8ed..b0d3f1ee2a4 100644 --- a/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_with_style.snap +++ b/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_with_style.snap @@ -36,7 +36,11 @@ export { hW as handleWatch }; "parent": "Foo_component_HTDRsvUbLiE", "ctxKind": "function", "ctxName": "useStyles$", - "captures": false + "captures": false, + "loc": [ + 118, + 129 + ] } */ ============================= foo_component_htdrsvublie.tsx (ENTRY POINT)== @@ -64,7 +68,11 @@ export { hW as handleWatch }; "parent": null, "ctxKind": "function", "ctxName": "component$", - "captures": false + "captures": false, + "loc": [ + 95, + 182 + ] } */ ============================= test.tsx == diff --git a/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_with_tagname.snap b/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_with_tagname.snap index 9f1b8239a51..9d0ccb83223 100644 --- a/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_with_tagname.snap +++ b/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_with_tagname.snap @@ -41,7 +41,11 @@ export { hW as handleWatch }; "parent": null, "ctxKind": "function", "ctxName": "component$", - "captures": false + "captures": false, + "loc": [ + 83, + 185 + ] } */ ============================= foo_component_1_dvu6fitwgly.tsx (ENTRY POINT)== @@ -68,7 +72,11 @@ export { hW as handleWatch }; "parent": "Foo_component_HTDRsvUbLiE", "ctxKind": "function", "ctxName": "$", - "captures": false + "captures": false, + "loc": [ + 104, + 181 + ] } */ ============================= test.tsx == diff --git a/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__issue_150.snap b/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__issue_150.snap index c63fca3c35a..ca2d9e0041e 100644 --- a/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__issue_150.snap +++ b/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__issue_150.snap @@ -47,7 +47,11 @@ export { hW as handleWatch }; "parent": null, "ctxKind": "function", "ctxName": "$", - "captures": false + "captures": false, + "loc": [ + 187, + 211 + ] } */ ============================= greeter_component_1_krcndswhx4u.js (ENTRY POINT)== @@ -73,7 +77,11 @@ export { hW as handleWatch }; "parent": "Greeter_component_n7HuG2hhU0Q", "ctxKind": "function", "ctxName": "$", - "captures": false + "captures": false, + "loc": [ + 108, + 167 + ] } */ ============================= greeter_component_n7hug2hhu0q.js (ENTRY POINT)== @@ -99,7 +107,11 @@ export { hW as handleWatch }; "parent": null, "ctxKind": "function", "ctxName": "component$", - "captures": false + "captures": false, + "loc": [ + 87, + 171 + ] } */ == DIAGNOSTICS == diff --git a/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__issue_476.snap b/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__issue_476.snap new file mode 100644 index 00000000000..0016ee47965 --- /dev/null +++ b/packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__issue_476.snap @@ -0,0 +1,49 @@ +--- +source: packages/qwik/src/optimizer/core/src/test.rs +expression: output +--- +==INPUT== + + +import { Counter } from "./counter.tsx"; + +export const Root = () => { + return ( + + + + Qwik Blank App + + + + + + ); +}; + +============================= test.tsx == + +import { Counter } from "./counter.tsx"; +export const Root = ()=>{ + return + + + + + + Qwik Blank App + + + + + + + + + + ; +}; + +== DIAGNOSTICS == + +[] diff --git a/packages/qwik/src/optimizer/core/src/test.rs b/packages/qwik/src/optimizer/core/src/test.rs index 83929797303..e1237e8806a 100644 --- a/packages/qwik/src/optimizer/core/src/test.rs +++ b/packages/qwik/src/optimizer/core/src/test.rs @@ -899,6 +899,7 @@ export const App = component$((props) => { "# .to_string(), explicity_extensions: true, + entry_strategy: EntryStrategy::Single, ..TestInput::default() }); } @@ -952,33 +953,83 @@ export const Foo = component$(() => { fn example_use_client_effect() { test_input!(TestInput { code: r#" - import { component$, useClientEffect$, useStore, useStyles$ } from '@builder.io/qwik'; - - export const Child = component$(() => { - const state = useStore({ - count: 0 - }); - - // Double count watch - useClientEffect$(() => { - const timer = setInterval(() => { - state.count++; - }, 1000); - return () => { - clearInterval(timer); - } - }); - - return ( -
- {state.count} -
- ); - }); +import { component$, useClientEffect$, useStore, useStyles$ } from '@builder.io/qwik'; + +export const Child = component$(() => { + const state = useStore({ + count: 0 + }); + + // Double count watch + useClientEffect$(() => { + const timer = setInterval(() => { + state.count++; + }, 1000); + return () => { + clearInterval(timer); + } + }); + + return ( +
+ {state.count} +
+ ); +}); + +"# + .to_string(), + transpile: true, + ..TestInput::default() + }); +} + +#[test] +fn example_use_server_mount() { + test_input!(TestInput { + code: r#" +import { component$, useServerMount$, useStore, useStyles$ } from '@builder.io/qwik'; +import mongo from 'mongodb'; +import redis from 'redis'; + +export const Parent = component$(() => { + const state = useStore({ + text: '' + }); + + // Double count watch + useServerMount$(async () => { + state.text = await mongo.users(); + redis.set(state.text); + }); + + return ( +
console.log('parent')}> + {state.text} +
+ ); +}); + +export const Child = component$(() => { + const state = useStore({ + text: '' + }); + + // Double count watch + useServerMount$(async () => { + state.text = await mongo.users(); + }); + return ( +
console.log('child')}> + {state.text} +
+ ); +}); "# .to_string(), transpile: true, + entry_strategy: EntryStrategy::Smart, ..TestInput::default() }); } @@ -1032,13 +1083,43 @@ const d = $(()=>console.log('thing')); let last_module = res.modules.last().unwrap(); assert_eq!(last_module.path, r"C:/users/apps/components/apps/apps.tsx") } +#[test] +fn issue_476() { + test_input!(TestInput { + code: r#" +import { Counter } from "./counter.tsx"; + +export const Root = () => { + return ( + + + + Qwik Blank App + + + + + + ); +}; +"# + .to_string(), + transpile: false, + ..TestInput::default() + }); +} #[test] fn consistent_hashes() { let code = r#" import { component$, $ } from '@builder.io/qwik'; +import mongo from 'mongodb'; export const Greeter = component$(() => { + // Double count watch + useServerMount$(async () => { + await mongo.users(); + }); return (
{}}/> diff --git a/packages/qwik/src/optimizer/core/src/transform.rs b/packages/qwik/src/optimizer/core/src/transform.rs index 0095a2602aa..844b87b6334 100644 --- a/packages/qwik/src/optimizer/core/src/transform.rs +++ b/packages/qwik/src/optimizer/core/src/transform.rs @@ -14,7 +14,7 @@ use std::hash::Hasher; use swc_atoms::JsWord; use swc_common::comments::{Comments, SingleThreadedComments}; -use swc_common::{errors::HANDLER, Mark, Spanned, DUMMY_SP}; +use swc_common::{errors::HANDLER, Mark, Span, Spanned, DUMMY_SP}; use swc_ecmascript::ast; use swc_ecmascript::utils::{private_ident, ExprFactory}; use swc_ecmascript::visit::{fold_expr, noop_fold_type, Fold, FoldWith, VisitWith}; @@ -50,6 +50,7 @@ pub struct Hook { pub expr: Box, pub data: HookData, pub hash: u64, + pub span: Span, } #[derive(Debug, Clone)] @@ -262,6 +263,7 @@ impl<'a> QwikTransform<'a> { let invalid_decl: HashSet = invalid_decl.into_iter().map(|a| a.0).collect(); self.hook_stack.push(symbol_name.clone()); + let span = first_arg.span(); let folded = fold_expr(self, first_arg); self.hook_stack.pop(); @@ -364,6 +366,7 @@ impl<'a> QwikTransform<'a> { let o = create_inline_qrl(&self.qwik_ident, import_path, &symbol_name, &scoped_idents); self.hooks.push(Hook { entry, + span, canonical_filename, name: symbol_name, data: hook_data, @@ -866,11 +869,8 @@ pub fn create_synthetic_wildcard_import(local: &Id, src: &JsWord) -> ast::Module span: DUMMY_SP, src: ast::Str { span: DUMMY_SP, - has_escape: false, value: src.clone(), - kind: ast::StrKind::Normal { - contains_quote: false, - }, + raw: None, }, asserts: None, type_only: false, @@ -892,11 +892,8 @@ pub fn create_synthetic_named_import_auto( span: DUMMY_SP, src: ast::Str { span: DUMMY_SP, - has_escape: false, value: src.clone(), - kind: ast::StrKind::Normal { - contains_quote: false, - }, + raw: None, }, asserts: None, type_only: false, @@ -939,11 +936,8 @@ fn create_synthetic_named_import(local: &Id, src: &JsWord) -> ast::ModuleItem { span: DUMMY_SP, src: ast::Str { span: DUMMY_SP, - has_escape: false, value: src.clone(), - kind: ast::StrKind::Normal { - contains_quote: false, - }, + raw: None, }, asserts: None, type_only: false, @@ -977,8 +971,7 @@ fn create_inline_qrl(qwik_ident: &Id, url: JsWord, symbol: &str, idents: &[Id]) expr: Box::new(ast::Expr::Lit(ast::Lit::Str(ast::Str { span: DUMMY_SP, value: url, - has_escape: false, - kind: ast::StrKind::Synthesized, + raw: None, }))), }], }))), @@ -986,8 +979,7 @@ fn create_inline_qrl(qwik_ident: &Id, url: JsWord, symbol: &str, idents: &[Id]) ast::Expr::Lit(ast::Lit::Str(ast::Str { span: DUMMY_SP, value: symbol.into(), - has_escape: false, - kind: ast::StrKind::Synthesized, + raw: None, })), ]; diff --git a/packages/qwik/src/optimizer/core/src/words.rs b/packages/qwik/src/optimizer/core/src/words.rs index 15f46e16564..26a5227519f 100644 --- a/packages/qwik/src/optimizer/core/src/words.rs +++ b/packages/qwik/src/optimizer/core/src/words.rs @@ -14,6 +14,7 @@ lazy_static! { pub static ref BUILDER_IO_QWIK_JSX: JsWord = JsWord::from("@builder.io/qwik/jsx-runtime"); pub static ref QCOMPONENT: JsWord = JsWord::from("component$"); pub static ref USE_CLOSURE: JsWord = JsWord::from("useLexicalScope"); + pub static ref USE_SERVER_MOUNT: JsWord = JsWord::from("useServerMount$"); pub static ref H: JsWord = JsWord::from("h"); pub static ref FRAGMENT: JsWord = JsWord::from("Fragment"); } diff --git a/packages/qwik/src/wasm/Cargo.lock b/packages/qwik/src/wasm/Cargo.lock index c4e09b13f13..0fbb9ddfdbb 100644 --- a/packages/qwik/src/wasm/Cargo.lock +++ b/packages/qwik/src/wasm/Cargo.lock @@ -18,7 +18,7 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" dependencies = [ - "getrandom 0.2.3", + "getrandom", "once_cell", "version_check", ] @@ -34,15 +34,15 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.56" +version = "1.0.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4361135be9122e0870de935d7c439aef945b9f9ddd4199a553b5270b49c82a27" +checksum = "08f9b8508dccb7687a1d6c4ce66b2b0ecef467c94667de27d8d7fe1f8d2a9cdc" [[package]] name = "arrayvec" -version = "0.5.2" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" +checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" [[package]] name = "ast_node" @@ -93,9 +93,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "block-buffer" -version = "0.9.0" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" +checksum = "0bf7fe51849ea569fd452f37822f606a5cabb684dc918707a0193fd4664ff324" dependencies = [ "generic-array", ] @@ -118,15 +118,6 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" -[[package]] -name = "cloudabi" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4344512281c643ae7638bbabc3af17a11307803ec8f0fcad9fae512a8bf36467" -dependencies = [ - "bitflags", -] - [[package]] name = "console_error_panic_hook" version = "0.1.7" @@ -190,6 +181,16 @@ dependencies = [ "lazy_static", ] +[[package]] +name = "crypto-common" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57952ca27b5e3606ff4dd79b0020231aaf9d6aa76dc05fd30137538c50bd3ce8" +dependencies = [ + "generic-array", + "typenum", +] + [[package]] name = "darling" version = "0.10.2" @@ -225,16 +226,6 @@ dependencies = [ "syn", ] -[[package]] -name = "dashmap" -version = "4.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e77a43b28d0668df09411cb0bc9a8c2adc40f9a048afe863e05fd43251e8e39c" -dependencies = [ - "cfg-if 1.0.0", - "num_cpus", -] - [[package]] name = "dashmap" version = "5.1.0" @@ -243,7 +234,7 @@ checksum = "c0834a35a3fce649144119e18da2a4d8ed12ef3862f47183fd46f625d072d96c" dependencies = [ "cfg-if 1.0.0", "num_cpus", - "parking_lot 0.12.0", + "parking_lot", ] [[package]] @@ -268,11 +259,12 @@ dependencies = [ [[package]] name = "digest" -version = "0.9.0" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +checksum = "f2fb860ca6fafa5552fb6d0e816a69c8e49f0908bf524e30a90d97c85892d506" dependencies = [ - "generic-array", + "block-buffer", + "crypto-common", ] [[package]] @@ -331,17 +323,6 @@ dependencies = [ "version_check", ] -[[package]] -name = "getrandom" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" -dependencies = [ - "cfg-if 1.0.0", - "libc", - "wasi 0.9.0+wasi-snapshot-preview1", -] - [[package]] name = "getrandom" version = "0.2.3" @@ -350,7 +331,7 @@ checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753" dependencies = [ "cfg-if 1.0.0", "libc", - "wasi 0.10.2+wasi-snapshot-preview1", + "wasi", ] [[package]] @@ -401,15 +382,6 @@ dependencies = [ "hashbrown", ] -[[package]] -name = "instant" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" -dependencies = [ - "cfg-if 1.0.0", -] - [[package]] name = "is-macro" version = "0.2.0" @@ -446,24 +418,74 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "lexical" -version = "5.2.2" +version = "6.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f404a90a744e32e8be729034fc33b90cf2a56418fbf594d69aa3c0214ad414e5" +checksum = "ccd3e434c16f0164124ade12dcdee324fcc3dafb1cad0c7f1d8c2451a1aa6886" dependencies = [ - "cfg-if 1.0.0", "lexical-core", ] [[package]] name = "lexical-core" -version = "0.7.6" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6607c62aa161d23d17a9072cc5da0be67cdfc89d3afb1e8d9c842bebc2525ffe" +checksum = "92912c4af2e7d9075be3e5e3122c4d7263855fa6cce34fbece4dd08e5884624d" +dependencies = [ + "lexical-parse-float", + "lexical-parse-integer", + "lexical-util", + "lexical-write-float", + "lexical-write-integer", +] + +[[package]] +name = "lexical-parse-float" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f518eed87c3be6debe6d26b855c97358d8a11bf05acec137e5f53080f5ad2dd8" +dependencies = [ + "lexical-parse-integer", + "lexical-util", + "static_assertions", +] + +[[package]] +name = "lexical-parse-integer" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afc852ec67c6538bbb2b9911116a385b24510e879a69ab516e6a151b15a79168" +dependencies = [ + "lexical-util", + "static_assertions", +] + +[[package]] +name = "lexical-util" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c72a9d52c5c4e62fa2cdc2cb6c694a39ae1382d9c2a17a466f18e272a0930eb1" dependencies = [ - "arrayvec", - "bitflags", - "cfg-if 1.0.0", - "ryu", + "static_assertions", +] + +[[package]] +name = "lexical-write-float" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a89ec1d062e481210c309b672f73a0567b7855f21e7d2fae636df44d12e97f9" +dependencies = [ + "lexical-util", + "lexical-write-integer", + "static_assertions", +] + +[[package]] +name = "lexical-write-integer" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "094060bd2a7c2ff3a16d5304a6ae82727cb3cc9d1c70f813cc73f744c319337e" +dependencies = [ + "lexical-util", "static_assertions", ] @@ -535,9 +557,9 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.2.6" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "090c7f9998ee0ff65aa5b723e4009f7b217707f1fb5ea551329cc4d6231fb304" +checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f" dependencies = [ "autocfg", "num-integer", @@ -580,23 +602,6 @@ version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "87f3e037eac156d1775da914196f0f37741a274155e34a0b7e427c35d2a2ecb9" -[[package]] -name = "opaque-debug" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" - -[[package]] -name = "parking_lot" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d7744ac029df22dca6284efe4e898991d28e3085c706c972bcd7da4a27a15eb" -dependencies = [ - "instant", - "lock_api", - "parking_lot_core 0.8.0", -] - [[package]] name = "parking_lot" version = "0.12.0" @@ -604,33 +609,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "87f5ec2493a61ac0506c0f4199f99070cbe83857b0337006a30f3e6719b8ef58" dependencies = [ "lock_api", - "parking_lot_core 0.9.1", + "parking_lot_core", ] [[package]] name = "parking_lot_core" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c361aa727dd08437f2f1447be8b59a33b0edd15e0fcee698f935613d9efbca9b" -dependencies = [ - "cfg-if 0.1.10", - "cloudabi", - "instant", - "libc", - "redox_syscall 0.1.57", - "smallvec", - "winapi", -] - -[[package]] -name = "parking_lot_core" -version = "0.9.1" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28141e0cc4143da2443301914478dc976a61ffdb3f043058310c70df2fed8954" +checksum = "09a279cbf25cb0757810394fbc1e359949b59e348145c643a939a525692e6929" dependencies = [ "cfg-if 1.0.0", "libc", - "redox_syscall 0.2.11", + "redox_syscall", "smallvec", "windows-sys", ] @@ -666,28 +656,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fabbf1ead8a5bcbc20f5f8b939ee3f5b0f6f281b6ad3468b84656b658b455259" dependencies = [ "phf_macros", - "phf_shared 0.10.0", + "phf_shared", "proc-macro-hack", ] -[[package]] -name = "phf_generator" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17367f0cc86f2d25802b2c26ee58a7b23faeccf78a396094c13dced0d0182526" -dependencies = [ - "phf_shared 0.8.0", - "rand 0.7.3", -] - [[package]] name = "phf_generator" version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5d5285893bb5eb82e6aaf5d59ee909a06a16737a8970984dd7746ba9283498d6" dependencies = [ - "phf_shared 0.10.0", - "rand 0.8.5", + "phf_shared", + "rand", ] [[package]] @@ -696,23 +676,14 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "58fdf3184dd560f160dd73922bea2d5cd6e8f064bf4b13110abd81b03697b4e0" dependencies = [ - "phf_generator 0.10.0", - "phf_shared 0.10.0", + "phf_generator", + "phf_shared", "proc-macro-hack", "proc-macro2", "quote", "syn", ] -[[package]] -name = "phf_shared" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c00cf8b9eafe68dde5e9eaa2cef8ee84a9336a47d566ec55ca16589633b65af7" -dependencies = [ - "siphasher", -] - [[package]] name = "phf_shared" version = "0.10.0" @@ -786,7 +757,6 @@ dependencies = [ "path-slash", "pathdiff", "rayon", - "regex", "relative-path", "serde", "serde_bytes", @@ -802,7 +772,7 @@ version = "0.1.0" dependencies = [ "console_error_panic_hook", "js-sys", - "parking_lot_core 0.8.0", + "parking_lot_core", "qwik-core", "serde", "serde-wasm-bindgen", @@ -810,20 +780,6 @@ dependencies = [ "wee_alloc", ] -[[package]] -name = "rand" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" -dependencies = [ - "getrandom 0.1.16", - "libc", - "rand_chacha 0.2.2", - "rand_core 0.5.1", - "rand_hc", - "rand_pcg", -] - [[package]] name = "rand" version = "0.8.5" @@ -831,18 +787,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", - "rand_chacha 0.3.1", - "rand_core 0.6.3", -] - -[[package]] -name = "rand_chacha" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" -dependencies = [ - "ppv-lite86", - "rand_core 0.5.1", + "rand_chacha", + "rand_core", ] [[package]] @@ -852,16 +798,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "ppv-lite86", - "rand_core 0.6.3", -] - -[[package]] -name = "rand_core" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" -dependencies = [ - "getrandom 0.1.16", + "rand_core", ] [[package]] @@ -870,25 +807,7 @@ version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" dependencies = [ - "getrandom 0.2.3", -] - -[[package]] -name = "rand_hc" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" -dependencies = [ - "rand_core 0.5.1", -] - -[[package]] -name = "rand_pcg" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" -dependencies = [ - "rand_core 0.5.1", + "getrandom", ] [[package]] @@ -916,12 +835,6 @@ dependencies = [ "num_cpus", ] -[[package]] -name = "redox_syscall" -version = "0.1.57" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" - [[package]] name = "redox_syscall" version = "0.2.11" @@ -950,9 +863,9 @@ checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" [[package]] name = "relative-path" -version = "1.6.1" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a49a831dc1e13c9392b660b162333d4cb0033bbbdfe6a1687177e59e89037c86" +checksum = "b4e112eddc95bbf25365df3b5414354ad2fe7ee465eddb9965a515faf8c3b6d9" [[package]] name = "retain_mut" @@ -1010,9 +923,9 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.136" +version = "1.0.137" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce31e24b01e1e524df96f1c2fdd054405f8d7376249a5110886fb4b658484789" +checksum = "61ea8d54c77f8315140a05f4c7237403bf38b72704d031543aa1d16abbf517d1" dependencies = [ "serde_derive", ] @@ -1031,18 +944,18 @@ dependencies = [ [[package]] name = "serde_bytes" -version = "0.11.5" +version = "0.11.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16ae07dd2f88a366f15bd0632ba725227018c69a1c8550a927324f8eb8368bb9" +checksum = "212e73464ebcde48d723aa02eb270ba62eff38a9b732df31f33f1b4e145f3a54" dependencies = [ "serde", ] [[package]] name = "serde_derive" -version = "1.0.136" +version = "1.0.137" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08597e7152fcd306f41838ed3e37be9eaeed2b61c42e2117266a554fab4662f9" +checksum = "1f26faba0c3959972377d3b2d306ee9f71faee9714294e41bb777f83f88578be" dependencies = [ "proc-macro2", "quote", @@ -1062,15 +975,13 @@ dependencies = [ [[package]] name = "sha-1" -version = "0.9.8" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99cd6713db3cf16b6c84e06321e049a9b9f699826e16096d23bbcc44d15d51a6" +checksum = "028f48d513f9678cda28f6e4064755b3fbb2af6acd672f2c209b62323f7aea0f" dependencies = [ - "block-buffer", "cfg-if 1.0.0", "cpufeatures", "digest", - "opaque-debug", ] [[package]] @@ -1115,26 +1026,26 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "string_cache" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33994d0838dc2d152d17a62adf608a869b5e846b65b389af7f3dbc1de45c5b26" +checksum = "213494b7a2b503146286049378ce02b482200519accc31872ee8be91fa820a08" dependencies = [ - "lazy_static", "new_debug_unreachable", - "parking_lot 0.11.1", - "phf_shared 0.10.0", + "once_cell", + "parking_lot", + "phf_shared", "precomputed-hash", "serde", ] [[package]] name = "string_cache_codegen" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f24c8e5e19d22a726626f1a5e16fe15b132dcf21d10177fa5a45ce7962996b97" +checksum = "6bb30289b722be4ff74a408c3cc27edeaad656e06cb1fe8fa9231fa59c728988" dependencies = [ - "phf_generator 0.8.0", - "phf_shared 0.8.0", + "phf_generator", + "phf_shared", "proc-macro2", "quote", ] @@ -1160,9 +1071,9 @@ checksum = "6446ced80d6c486436db5c078dde11a9f73d42b57fb273121e160b84f63d894c" [[package]] name = "swc_atoms" -version = "0.2.9" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f5229fe227ff0060e13baa386d6e368797700eab909523f730008d191ee53ae" +checksum = "ba8735ce37e421749498e038955abc1135eec6a4af0b54a173e55d2e5542d472" dependencies = [ "string_cache", "string_cache_codegen", @@ -1176,7 +1087,7 @@ checksum = "84fed4a980e12c737171a7b17c5e0a2f4272899266fa0632ea4e31264ebdfdb5" dependencies = [ "ahash", "anyhow", - "dashmap 5.1.0", + "dashmap", "once_cell", "regex", "serde", @@ -1185,14 +1096,14 @@ dependencies = [ [[package]] name = "swc_common" -version = "0.17.14" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1e413d6e2d304b45adb55f85d9ba684e1020616156a7483e6a060a2e47db972" +checksum = "4ec38be09c030adbebf10014d0157df25826dba7254f60ef30d73cc24c267a06" dependencies = [ "ahash", "ast_node", "better_scoped_tls", - "cfg-if 0.1.10", + "cfg-if 1.0.0", "debug_unreachable", "either", "from_variant", @@ -1210,11 +1121,37 @@ dependencies = [ "url", ] +[[package]] +name = "swc_config" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8bb05ef56c14b95dd7e62e95960153af811b9a447287f1f6ca59f1337fb83d4" +dependencies = [ + "anyhow", + "indexmap", + "serde", + "serde_json", + "swc_config_macro", +] + +[[package]] +name = "swc_config_macro" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb64bc03d90fd5c90d6ab917bb2b1d7fbd31957df39e31ea24a3f554b4372251" +dependencies = [ + "pmutil", + "proc-macro2", + "quote", + "swc_macros_common", + "syn", +] + [[package]] name = "swc_ecma_ast" -version = "0.69.1" +version = "0.78.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4b2e9a1a9e3f71557971dd096aa3fff7487f2c419d2f93c0d71445352a36dc8" +checksum = "6ed68ad13e4489f309ffed9d302337d7c8bde11d00b8b275b7aa7fda4da035bf" dependencies = [ "is-macro", "num-bigint", @@ -1227,14 +1164,15 @@ dependencies = [ [[package]] name = "swc_ecma_codegen" -version = "0.94.1" +version = "0.107.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f352c9d36b0d5b92ccab7e774bbf243a1d3be721792798815b76f69e1e56e32" +checksum = "b08ceb40519303a12fa987ff2d1888cb64e654adab7d5f475cc0b389ff3b0fba" dependencies = [ "bitflags", "memchr", "num-bigint", "once_cell", + "rustc-hash", "sourcemap", "swc_atoms", "swc_common", @@ -1245,9 +1183,9 @@ dependencies = [ [[package]] name = "swc_ecma_codegen_macros" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdbf826c739281cdb3b3c23883fd1a7586ea1c15b1287530e7123a7fad8f0e25" +checksum = "59949619b2ef45eedb6c399d05f2c3c7bc678b5074b3103bb670f9e05bb99042" dependencies = [ "pmutil", "proc-macro2", @@ -1258,16 +1196,17 @@ dependencies = [ [[package]] name = "swc_ecma_loader" -version = "0.29.0" +version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9ab69df5d4de425833e02de111f14b5544b39ad9c9b82c97e4835fc55c8f1b6" +checksum = "0f7baaa5b99cdf49e830caf54b837891c5c38275ac94c31d555859be95f6479c" dependencies = [ "ahash", "anyhow", - "dashmap 4.0.2", + "dashmap", "normpath", "once_cell", "path-clean", + "pathdiff", "serde", "serde_json", "swc_common", @@ -1276,27 +1215,30 @@ dependencies = [ [[package]] name = "swc_ecma_minifier" -version = "0.88.1" +version = "0.113.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "795c58670d843f62f1e349fe537a8ec65dac21c78fd527db5b83ae0952cf78bd" +checksum = "1c4ea20be3e04071bb9a5df3dcf159dcfb2c11010d88b13c9baa8f8106e189a8" dependencies = [ "ahash", + "arrayvec", "indexmap", "once_cell", - "parking_lot 0.12.0", + "parking_lot", "rayon", "regex", "retain_mut", + "rustc-hash", "serde", "serde_json", "swc_atoms", "swc_cached", "swc_common", + "swc_config", "swc_ecma_ast", "swc_ecma_codegen", "swc_ecma_parser", - "swc_ecma_transforms", "swc_ecma_transforms_base", + "swc_ecma_transforms_optimization", "swc_ecma_utils", "swc_ecma_visit", "swc_timer", @@ -1306,9 +1248,9 @@ dependencies = [ [[package]] name = "swc_ecma_parser" -version = "0.92.7" +version = "0.104.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d53e529ee2504ac513171e8c31c77c6c527d56a27259807d1950ed58b3901a28" +checksum = "efb97dc6efc95313dedc5158055cc811da77395ef7b54be61948b5ad097a3671" dependencies = [ "either", "enum_kind", @@ -1326,9 +1268,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms" -version = "0.130.0" +version = "0.153.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a9333d80deef03e37cfbf0a396d1604fbec8a6d72ad6cb27138367c1d19fc94" +checksum = "5755ffcda1942d7c261a8acd3ae49fe686e2b7476eeecd6cb5e377a95eb1f5d9" dependencies = [ "swc_atoms", "swc_common", @@ -1344,13 +1286,14 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_base" -version = "0.66.2" +version = "0.84.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5d8e201110d4389e44c0fc8c39d127be57df2bde7ad3639327d7c0cd357bab3" +checksum = "6be33c0ca26095f5d8e83f9df14f5798233e29f09125d3afaf925b70920da8a1" dependencies = [ "better_scoped_tls", "once_cell", "phf", + "rustc-hash", "serde", "smallvec", "swc_atoms", @@ -1377,9 +1320,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_module" -version = "0.90.0" +version = "0.111.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60762763c4c5ec8f9f8a86408fd0cfa01802d5a274f8ecdb4327ba6292fff52a" +checksum = "e6baca7d64bf60c7d184d647dae50dea51a8edcc262ffaceb07a91b81d64aa36" dependencies = [ "Inflector", "ahash", @@ -1401,14 +1344,15 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_optimization" -version = "0.100.0" +version = "0.123.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98ce53a1efa05e9bbeb2f8a16a1e153801708d7bea692776442bf43576f1921b" +checksum = "cd5c7efdde630a05a3f6ff453dd54946011f4cdc92fe94fbb081f87dcd72b403" dependencies = [ "ahash", - "dashmap 4.0.2", + "dashmap", "indexmap", "once_cell", + "rustc-hash", "serde_json", "swc_atoms", "swc_common", @@ -1423,13 +1367,13 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_react" -version = "0.92.0" +version = "0.113.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b618bfc4d3a99df1081bfe0b833d14572ab36dd2c245d1ab51c581b2d74b843" +checksum = "a32b923408e146e3caec63e829f81a7979c0efa46dfec20656fed7bd0fe7a917" dependencies = [ "ahash", "base64 0.13.0", - "dashmap 4.0.2", + "dashmap", "indexmap", "once_cell", "regex", @@ -1438,6 +1382,7 @@ dependencies = [ "string_enum", "swc_atoms", "swc_common", + "swc_config", "swc_ecma_ast", "swc_ecma_parser", "swc_ecma_transforms_base", @@ -1448,9 +1393,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_typescript" -version = "0.95.0" +version = "0.116.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b126d9e2545e975d2ae09277c2f16bb682b0111f03e643e3b59e56831a7f6b4" +checksum = "8dcda94818a971a654899b1a5fe04cad5435da5e3542ebbcc4ecbb027e904e5d" dependencies = [ "serde", "swc_atoms", @@ -1464,9 +1409,9 @@ dependencies = [ [[package]] name = "swc_ecma_utils" -version = "0.71.0" +version = "0.85.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee41829a14f59d6f93a5f5721f08797b214caa4d037913b51ab61a9d31e10576" +checksum = "dff9d469b284a48317a695a81346a9609d04ce3a31da4493aac508e0d48a4257" dependencies = [ "indexmap", "once_cell", @@ -1479,9 +1424,9 @@ dependencies = [ [[package]] name = "swc_ecma_visit" -version = "0.55.0" +version = "0.64.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b359c0ddd3f474dcc379d3c011670be3b855229bcb523e6571897c5beae42957" +checksum = "f2d3783a0dd1e301ae2945ab1241405f913427f9512ec62756d3d2072f7c21bb" dependencies = [ "num-bigint", "swc_atoms", @@ -1493,9 +1438,9 @@ dependencies = [ [[package]] name = "swc_ecmascript" -version = "0.131.0" +version = "0.156.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ef93d48b2d35cd2eda8d07a7d2af932d3cb3432d19859948bd6383110ed632c" +checksum = "67f282a0e17a9f48d72b04f611f0553bad26049b7b1bf2fa6b9074682f46462e" dependencies = [ "swc_ecma_ast", "swc_ecma_codegen", @@ -1520,9 +1465,9 @@ dependencies = [ [[package]] name = "swc_macros_common" -version = "0.3.3" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08ed2e930f5a1a4071fe62c90fd3a296f6030e5d94bfe13993244423caf59a78" +checksum = "d5dca3f08d02da4684c3373150f7c045128f81ea00f0c434b1b012bc65a6cce3" dependencies = [ "pmutil", "proc-macro2", @@ -1532,9 +1477,9 @@ dependencies = [ [[package]] name = "swc_timer" -version = "0.4.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1371a950402552de1a2bf7beeb619b7fff9e4ab7e50f516db9a791869a4f731f" +checksum = "60ca6c177dc2b848c73d721eea6c33f047c82a1e4a5795ea9b8114ced027f8ed" dependencies = [ "tracing", ] @@ -1565,9 +1510,9 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.65" +version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3a1d708c221c5a612956ef9f75b37e454e88d1f7b899fbd3a18d4252012d663" +checksum = "a07e33e919ebcd69113d5be0e4d70c5707004ff45188910106854f38b960df4a" dependencies = [ "proc-macro2", "quote", @@ -1699,12 +1644,6 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" -[[package]] -name = "wasi" -version = "0.9.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" - [[package]] name = "wasi" version = "0.10.2+wasi-snapshot-preview1" @@ -1713,9 +1652,9 @@ checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" [[package]] name = "wasm-bindgen" -version = "0.2.72" +version = "0.2.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fe8f61dba8e5d645a4d8132dc7a0a66861ed5e1045d2c0ed940fab33bac0fbe" +checksum = "27370197c907c55e3f1a9fbe26f44e937fe6451368324e009cba39e139dc08ad" dependencies = [ "cfg-if 1.0.0", "wasm-bindgen-macro", @@ -1723,9 +1662,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.72" +version = "0.2.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "046ceba58ff062da072c7cb4ba5b22a37f00a302483f7e2a6cdc18fedbdc1fd3" +checksum = "53e04185bfa3a779273da532f5025e33398409573f348985af9a1cbf3774d3f4" dependencies = [ "bumpalo", "lazy_static", @@ -1738,9 +1677,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.72" +version = "0.2.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ef9aa01d36cda046f797c57959ff5f3c615c9cc63997a8d545831ec7976819b" +checksum = "17cae7ff784d7e83a2fe7611cfe766ecf034111b49deb850a3dc7699c08251f5" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -1748,9 +1687,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.72" +version = "0.2.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96eb45c1b2ee33545a813a92dbb53856418bf7eb54ab34f7f7ff1448a5b3735d" +checksum = "99ec0dc7a4756fffc231aab1b9f2f578d23cd391390ab27f952ae0c9b3ece20b" dependencies = [ "proc-macro2", "quote", @@ -1761,9 +1700,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.72" +version = "0.2.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7148f4696fb4960a346eaa60bbfb42a1ac4ebba21f750f75fc1375b098d5ffa" +checksum = "d554b7f530dee5964d9a9468d95c1f8b8acae4f282807e7d27d4b03099a46744" [[package]] name = "wee_alloc" @@ -1801,9 +1740,9 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windows-sys" -version = "0.32.0" +version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3df6e476185f92a12c072be4a189a0210dcdcf512a1891d6dff9edb874deadc6" +checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" dependencies = [ "windows_aarch64_msvc", "windows_i686_gnu", @@ -1814,30 +1753,30 @@ dependencies = [ [[package]] name = "windows_aarch64_msvc" -version = "0.32.0" +version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8e92753b1c443191654ec532f14c199742964a061be25d77d7a96f09db20bf5" +checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" [[package]] name = "windows_i686_gnu" -version = "0.32.0" +version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a711c68811799e017b6038e0922cb27a5e2f43a2ddb609fe0b6f3eeda9de615" +checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" [[package]] name = "windows_i686_msvc" -version = "0.32.0" +version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "146c11bb1a02615db74680b32a68e2d61f553cc24c4eb5b4ca10311740e44172" +checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" [[package]] name = "windows_x86_64_gnu" -version = "0.32.0" +version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c912b12f7454c6620635bbff3450962753834be2a594819bd5e945af18ec64bc" +checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" [[package]] name = "windows_x86_64_msvc" -version = "0.32.0" +version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "504a2476202769977a040c6364301a3f65d0cc9e3fb08600b2bda150a0488316" +checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" diff --git a/packages/qwik/src/wasm/Cargo.toml b/packages/qwik/src/wasm/Cargo.toml index b330f397b6f..3276f1caff2 100644 --- a/packages/qwik/src/wasm/Cargo.toml +++ b/packages/qwik/src/wasm/Cargo.toml @@ -13,12 +13,12 @@ categories = ["development-tools", "development-tools::cargo-plugins"] crate-type = ["cdylib"] [dependencies] -js-sys = "0.3" +js-sys = "0.3.37" qwik-core = { path = "../optimizer/core" } serde = "1" serde-wasm-bindgen = "0.3.0" -wasm-bindgen = "0.2" -parking_lot_core = "=0.8.0" +wasm-bindgen = "0.2.80" +parking_lot_core = "=0.9.3" console_error_panic_hook = { version = "0.1.1", optional = true } wee_alloc = { version = "0.4.2" }