From a6c5d7ece973de60fcf1d142b910ef3433396860 Mon Sep 17 00:00:00 2001 From: Craig Condon Date: Tue, 16 Jan 2024 15:48:03 -0600 Subject: [PATCH] start on emulator --- Cargo.lock | 86 ++++++++++++++----------- Cargo.toml | 1 + libs/core/src/proto/ast_mutate/utils.rs | 1 + libs/emulator/Cargo.toml | 12 ++++ libs/emulator/README.md | 3 + libs/emulator/src/bundle.rs | 3 + libs/emulator/src/lib.rs | 1 + 7 files changed, 69 insertions(+), 38 deletions(-) create mode 100644 libs/emulator/Cargo.toml create mode 100644 libs/emulator/README.md create mode 100644 libs/emulator/src/bundle.rs create mode 100644 libs/emulator/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index 1c83ea246..cd511d836 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1849,6 +1849,16 @@ dependencies = [ "wax", ] +[[package]] +name = "paperclip_emulator" +version = "0.1.0" +dependencies = [ + "paperclip_common", + "paperclip_core", + "paperclip_proto", + "swc", +] + [[package]] name = "paperclip_evaluator" version = "0.1.1" @@ -2972,9 +2982,9 @@ dependencies = [ [[package]] name = "swc" -version = "0.270.18" +version = "0.270.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a27aa57c85cbd942540fe5e50f5d665723a1666305506f0cf0daf423903e2a9" +checksum = "748cdbde112e921fb1ad7ebf7e9969190ebea1b6eaec8c1ace9073b6c1579e1b" dependencies = [ "anyhow", "base64 0.21.5", @@ -3074,9 +3084,9 @@ dependencies = [ [[package]] name = "swc_compiler_base" -version = "0.4.16" +version = "0.4.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b8a76c7c388f1db934d10ba7fd293ea69e6ed8bd031855b579e4794aff5af85" +checksum = "8efb9de5372be0e973016ce7aa2f151af54f9d0d84f514dfeeb95bd7ca477aa3" dependencies = [ "anyhow", "base64 0.21.5", @@ -3169,9 +3179,9 @@ dependencies = [ [[package]] name = "swc_ecma_compat_bugfixes" -version = "0.2.14" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a69ac870b965a458340c6a5a31059f8473093595a1f9efb169002f23bc05261" +checksum = "0337067ede6103a274191a20c4de238ded32bb8b3d3e99561ca3e7811e089b21" dependencies = [ "swc_atoms", "swc_common", @@ -3199,9 +3209,9 @@ dependencies = [ [[package]] name = "swc_ecma_compat_es2015" -version = "0.2.14" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6189b89270bca5d3b103818a49c8decca0f9a63b4507f4f5301b052b0fb42d51" +checksum = "a6912d92bcfc313d7b05d1da0ae8d283bce24baf4e1fd09541acd52f32ab1e32" dependencies = [ "arrayvec", "indexmap 2.1.0", @@ -3225,9 +3235,9 @@ dependencies = [ [[package]] name = "swc_ecma_compat_es2016" -version = "0.2.10" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0708c1ae05f82d4e19da2f02a5b093e4e50d581e9bfac527f4aa7693bd791cf7" +checksum = "52f4824f2bd45b02b70bc85824daa35c9c07477589f008f888748c115d4b0b97" dependencies = [ "swc_atoms", "swc_common", @@ -3242,9 +3252,9 @@ dependencies = [ [[package]] name = "swc_ecma_compat_es2017" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3701ee2c0321f79258a2acc3633b875af7770cd0173e17a0615d9e707ba32ac" +checksum = "c85bcb454c2d69e38777fd739864938fbc18ed45b6ee4dd314b9fc0a463a63c1" dependencies = [ "serde", "swc_atoms", @@ -3260,9 +3270,9 @@ dependencies = [ [[package]] name = "swc_ecma_compat_es2018" -version = "0.2.12" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "def1e23336a20ca46d297685c2f5c60703eb2d7aea0b8996fefa577be3fad508" +checksum = "3d47d63860994814c49e8ad5996d182d1d7804e96d6f7bdab0bf1282716d9884" dependencies = [ "serde", "swc_atoms", @@ -3279,9 +3289,9 @@ dependencies = [ [[package]] name = "swc_ecma_compat_es2019" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72dd4288e3dfbba53a72410daf190d84d7601f91300e6c524ddea1f0708f2495" +checksum = "f20b2d70b26e48926bba3b7629b6bc10de724a8f076fdf4eb9267fe12a1db17b" dependencies = [ "swc_atoms", "swc_common", @@ -3295,9 +3305,9 @@ dependencies = [ [[package]] name = "swc_ecma_compat_es2020" -version = "0.2.12" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f654fe803d73320c723ba25e88b4b561fd1d53ad59ad8622f209fe03f6849b3b" +checksum = "973a0bca6c9e85869d62b38937b80e13ee5e105df4eb18576177c4ebb41e5bb9" dependencies = [ "serde", "swc_atoms", @@ -3348,9 +3358,9 @@ dependencies = [ [[package]] name = "swc_ecma_compat_es3" -version = "0.2.10" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b2f3ac54636b7690f17adc9430318d83bf8423635ca848bbb9f9c045e01e377" +checksum = "ce5624a8b906965af30484a0b8e2ed9b0d68675a1b8bdba6a242882f38e3270e" dependencies = [ "swc_common", "swc_ecma_ast", @@ -3418,9 +3428,9 @@ dependencies = [ [[package]] name = "swc_ecma_minifier" -version = "0.190.15" +version = "0.190.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdd196fa7d01ddd4eaa935f0ddd12854df57db21243aebde9169882d22d381f3" +checksum = "675d4e7296593506ce790ba38e61fe175e6613bac5a80715fc5eaf57ff9c4792" dependencies = [ "arrayvec", "indexmap 2.1.0", @@ -3474,9 +3484,9 @@ dependencies = [ [[package]] name = "swc_ecma_preset_env" -version = "0.204.15" +version = "0.204.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94556b1404aa1c8e9f22312fe83a11b5c882b0122557daae1187826575162627" +checksum = "83101b23a76bf32b592193be46d6a3f109385450f459bda481b9175570d769dd" dependencies = [ "anyhow", "dashmap", @@ -3499,9 +3509,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms" -version = "0.227.15" +version = "0.227.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b319ba24f6311afa72c5d7e81f06f52b1cd9ad4debf0524eac599b7640b9039a" +checksum = "42ca294ecda1e74ac2218e17e1fc77ffa9742195f3fead022fe8103321ed12d4" dependencies = [ "swc_atoms", "swc_common", @@ -3556,9 +3566,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_compat" -version = "0.161.14" +version = "0.161.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93a7192ebd94fa4454114ff79513000260ac583d3b80067d9037daa119f318df" +checksum = "f46cfe232648c0994922d136d686c0a598c73a30334d92b14ba5a61e768bb4e7" dependencies = [ "arrayvec", "indexmap 2.1.0", @@ -3604,9 +3614,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_module" -version = "0.178.15" +version = "0.178.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc1ba85cf4620c7690eb67f00bf2b1efa0d88265bbbf8cea60dfc7aec59c3e99" +checksum = "48e51136811754dcbd7400cdd62da7117deabd029c8049a6740cff75934e3f40" dependencies = [ "Inflector", "anyhow", @@ -3631,9 +3641,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_optimization" -version = "0.196.14" +version = "0.196.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eefef9f5a80afdbd4b517401dc053825d1ac0d95bb63f3ae92d2b335d8d7d4f8" +checksum = "fec185cf4d18e90b7c8b18b0d1f04a5707e6f4c7b57c1bfd5086392cd07b75a9" dependencies = [ "dashmap", "indexmap 2.1.0", @@ -3655,9 +3665,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_proposal" -version = "0.169.14" +version = "0.169.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86de99757fc31d8977f47c02a26e5c9a243cb63b03fe8aa8b36d79924b8fa29c" +checksum = "ed89d6ff74f60de490fb56e1cc505b057905e36c13d405d7d61dd5c9f6ee8fc9" dependencies = [ "either", "rustc-hash", @@ -3675,9 +3685,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_react" -version = "0.181.15" +version = "0.181.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9918e22caf1ea4a71085f5d818d6c0bf5c19d669cfb9d38f9fdc3da0496abdc7" +checksum = "e31a2f879fd21d18080b6c42e633e0ae8c6f3d54b83c1de876767d82b458c999" dependencies = [ "base64 0.21.5", "dashmap", @@ -3699,9 +3709,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_typescript" -version = "0.186.14" +version = "0.186.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1d1495c969ffdc224384f1fb73646b9c1b170779f20fdb984518deb054aa522" +checksum = "3e4263372cc7cd1a3b4570ccf7438f3c1e1575f134fd05cdf074edb322480a5b" dependencies = [ "ryu-js", "serde", diff --git a/Cargo.toml b/Cargo.toml index 4efaae811..44306eb18 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,6 +10,7 @@ members = [ "libs/evaluator", "libs/tidy", "libs/paperclip-loader", + "libs/emulator", "libs/workspace", "libs/infer", "libs/proto", diff --git a/libs/core/src/proto/ast_mutate/utils.rs b/libs/core/src/proto/ast_mutate/utils.rs index 691534718..fa2092831 100644 --- a/libs/core/src/proto/ast_mutate/utils.rs +++ b/libs/core/src/proto/ast_mutate/utils.rs @@ -162,6 +162,7 @@ pub fn upsert_render_expr<'a, Mutation>( component_body_item::Inner::Render(Render { id: ctx.new_id(), range: None, + before: None, node: if create_node { Some(parse_node("div", &ctx.new_id())) } else { diff --git a/libs/emulator/Cargo.toml b/libs/emulator/Cargo.toml new file mode 100644 index 000000000..d8e17bd9a --- /dev/null +++ b/libs/emulator/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "paperclip_emulator" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +swc = "0.270.23" +paperclip_common = { path = "../rs_common" } +paperclip_proto = { path = "../proto" } +paperclip_core = { path = "../core" } diff --git a/libs/emulator/README.md b/libs/emulator/README.md new file mode 100644 index 000000000..60bfc9428 --- /dev/null +++ b/libs/emulator/README.md @@ -0,0 +1,3 @@ +## Considerations + +- Bundler may include Paperclip files diff --git a/libs/emulator/src/bundle.rs b/libs/emulator/src/bundle.rs new file mode 100644 index 000000000..8b7a7f5fe --- /dev/null +++ b/libs/emulator/src/bundle.rs @@ -0,0 +1,3 @@ +use paperclip_proto::ast::graph::Graph; + +pub fn bundle(graph: Graph) {} diff --git a/libs/emulator/src/lib.rs b/libs/emulator/src/lib.rs new file mode 100644 index 000000000..ced4c376f --- /dev/null +++ b/libs/emulator/src/lib.rs @@ -0,0 +1 @@ +pub mod bundle;