From ec5deddec107209a2fb2d3fe443dac885e9bc9d2 Mon Sep 17 00:00:00 2001 From: Miles Johnson Date: Fri, 30 Aug 2024 16:39:21 -0700 Subject: [PATCH 1/2] Add register methods. --- Cargo.lock | 57 ++++++++----------- Cargo.toml | 20 +++---- crates/download/src/download_ext.rs | 12 ++++ crates/migrate-nx/src/lib.rs | 4 +- .../src/{migrate_nx.rs => migrate_nx_ext.rs} | 12 ++++ crates/migrate-turborepo/src/lib.rs | 4 +- ..._turborepo.rs => migrate_turborepo_ext.rs} | 12 ++++ crates/unpack/src/unpack_ext.rs | 12 ++++ 8 files changed, 85 insertions(+), 48 deletions(-) rename crates/migrate-nx/src/{migrate_nx.rs => migrate_nx_ext.rs} (85%) rename crates/migrate-turborepo/src/{migrate_turborepo.rs => migrate_turborepo_ext.rs} (78%) diff --git a/Cargo.lock b/Cargo.lock index 60e4758..4a8c24e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1147,7 +1147,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" dependencies = [ "fallible-iterator", - "indexmap 2.4.0", + "indexmap 2.5.0", "stable_deref_trait", ] @@ -1199,7 +1199,7 @@ dependencies = [ "futures-core", "futures-sink", "http", - "indexmap 2.4.0", + "indexmap 2.5.0", "slab", "tokio", "tokio-util", @@ -1425,9 +1425,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93ead53efc7ea8ed3cfb0c79fc8023fbb782a5432b52830b6518941cebe6505c" +checksum = "68b900aa2f7301e21c36462b170ee99994de34dff39a4a6a528e80e7376d07e5" dependencies = [ "equivalent", "hashbrown 0.14.5", @@ -1767,8 +1767,6 @@ dependencies = [ [[package]] name = "moon_common" version = "0.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "854b7e24a2c03b9136d2d1297eabc0b8222b1ed9d1606b12900233987a9ca902" dependencies = [ "dirs 5.0.1", "miette", @@ -1784,10 +1782,8 @@ dependencies = [ [[package]] name = "moon_config" version = "0.0.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "219ffb426909e12d7c69a29d4522121cddb81ac1e4b4dfeaa6bf25afedbeabe7" dependencies = [ - "indexmap 2.4.0", + "indexmap 2.5.0", "miette", "moon_common", "moon_target", @@ -1868,8 +1864,6 @@ dependencies = [ [[package]] name = "moon_pdk" version = "0.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4084824e8ea5ecd9c63b1ce8b76043ef130e6a70cd06da9a5b1d2391f1ab4a6" dependencies = [ "clap", "extism-pdk", @@ -1881,8 +1875,6 @@ dependencies = [ [[package]] name = "moon_pdk_api" version = "0.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e125867bc9b986ae5880071fa2c59c54b3567cb341670ffd71684945a01b8a88" dependencies = [ "moon_common", "moon_config", @@ -1895,8 +1887,6 @@ dependencies = [ [[package]] name = "moon_pdk_test_utils" version = "0.0.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89d3760aff453d7b71a8db547596a774b53e74f59342c7640e97cced65fefab1" dependencies = [ "extism", "moon_pdk_api", @@ -1908,8 +1898,6 @@ dependencies = [ [[package]] name = "moon_target" version = "0.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c1a34384f1819ffdd66db597eadbc5eaf06ce1807fb40e4475545c10203fc07" dependencies = [ "miette", "moon_common", @@ -1977,7 +1965,7 @@ checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" dependencies = [ "crc32fast", "hashbrown 0.14.5", - "indexmap 2.4.0", + "indexmap 2.5.0", "memchr", ] @@ -2621,7 +2609,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a27ae5ae2fb243bce05160f4983d7e258978843e5b9dbb21375c4311cec68300" dependencies = [ "garde", - "indexmap 2.4.0", + "indexmap 2.5.0", "miette", "schematic_macros", "schematic_types", @@ -2653,7 +2641,7 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "653e1eacf66aa291a836204f0bbe8c2ae7adbc943b3e3ef8f4a2abfac77d12dd" dependencies = [ - "indexmap 2.4.0", + "indexmap 2.5.0", "semver", "serde", "serde_json", @@ -2730,7 +2718,7 @@ version = "1.0.127" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8043c06d9f82bd7271361ed64f415fe5e12a77fdb52e573e7f06a516dea329ad" dependencies = [ - "indexmap 2.4.0", + "indexmap 2.5.0", "itoa", "memchr", "ryu", @@ -2774,7 +2762,7 @@ version = "0.9.34+deprecated" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47" dependencies = [ - "indexmap 2.4.0", + "indexmap 2.5.0", "itoa", "ryu", "serde", @@ -3228,7 +3216,7 @@ version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" dependencies = [ - "indexmap 2.4.0", + "indexmap 2.5.0", "toml_datetime", "winnow 0.5.40", ] @@ -3239,7 +3227,7 @@ version = "0.22.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "583c44c02ad26b0c3f3066fe629275e50627026c51ac2e595cca4c230ce1ce1d" dependencies = [ - "indexmap 2.4.0", + "indexmap 2.5.0", "serde", "serde_spanned", "toml_datetime", @@ -3491,13 +3479,14 @@ dependencies = [ [[package]] name = "warpgate" -version = "0.17.0" +version = "0.17.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fb9948cc8854946cd87aa6a1ee8e99fc4fde22c8f13c9facb0f229abd169185" +checksum = "74503571955128c578ca6721426c6013419861ec4b7bb7d0dd8abfce2e43749d" dependencies = [ "extism", "miette", "once_cell", + "regalloc2", "regex", "reqwest", "scc", @@ -3681,7 +3670,7 @@ version = "0.118.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77f1154f1ab868e2a01d9834a805faca7bf8b50d041b4ca714d005d0dab1c50c" dependencies = [ - "indexmap 2.4.0", + "indexmap 2.5.0", "semver", ] @@ -3692,7 +3681,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9dbe55c8f9d0dbd25d9447a5a889ff90c0cc3feaa7395310d3d826b2c703eaab" dependencies = [ "bitflags", - "indexmap 2.4.0", + "indexmap 2.5.0", "semver", ] @@ -3719,7 +3708,7 @@ dependencies = [ "cfg-if", "encoding_rs", "fxprof-processed-profile", - "indexmap 2.4.0", + "indexmap 2.5.0", "libc", "log", "object 0.32.2", @@ -3845,7 +3834,7 @@ dependencies = [ "anyhow", "cranelift-entity", "gimli 0.28.1", - "indexmap 2.4.0", + "indexmap 2.5.0", "log", "object 0.32.2", "serde", @@ -3934,7 +3923,7 @@ dependencies = [ "cc", "cfg-if", "encoding_rs", - "indexmap 2.4.0", + "indexmap 2.5.0", "libc", "log", "mach", @@ -4038,7 +4027,7 @@ checksum = "af5fbb1adaadad70271fe18a3f938741edb2b5178bf2fc164ab20544018626b8" dependencies = [ "anyhow", "heck 0.4.1", - "indexmap 2.4.0", + "indexmap 2.5.0", "wit-parser", ] @@ -4425,7 +4414,7 @@ checksum = "316b36a9f0005f5aa4b03c39bc3728d045df136f8c13a73b7db4510dec725e08" dependencies = [ "anyhow", "id-arena", - "indexmap 2.4.0", + "indexmap 2.5.0", "log", "semver", "serde", @@ -4510,7 +4499,7 @@ dependencies = [ "crossbeam-utils", "displaydoc", "flate2", - "indexmap 2.4.0", + "indexmap 2.5.0", "memchr", "thiserror", "zopfli", diff --git a/Cargo.toml b/Cargo.toml index 5739998..0a57c01 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,11 +4,11 @@ members = ["crates/*"] [workspace.dependencies] extism-pdk = "1.2.1" -moon_common = "0.0.8" -moon_config = "0.0.10" -moon_pdk = "0.0.9" -moon_pdk_test_utils = "0.0.10" -moon_target = "0.0.7" +# moon_common = "0.0.8" +# moon_config = "0.0.10" +# moon_pdk = "0.0.9" +# moon_pdk_test_utils = "0.0.10" +# moon_target = "0.0.7" rustc-hash = "2.0.0" serde = { version = "1.0.209", features = ["derive"] } serde_json = "1.0.127" @@ -17,11 +17,11 @@ starbase_utils = { version = "0.8.7", default-features = false } starbase_sandbox = "0.7.2" tokio = { version = "1.39.2", features = ["full"] } -# moon_common = { path = "../moon/nextgen/common" } -# moon_config = { path = "../moon/nextgen/config" } -# moon_pdk = { path = "../moon/nextgen/pdk" } -# moon_pdk_test_utils = { path = "../moon/nextgen/pdk-test-utils" } -# moon_target = { path = "../moon/nextgen/target" } +moon_common = { path = "../moon/crates/common" } +moon_config = { path = "../moon/crates/config" } +moon_pdk = { path = "../moon/crates/pdk" } +moon_pdk_test_utils = { path = "../moon/crates/pdk-test-utils" } +moon_target = { path = "../moon/crates/target" } [profile.release] codegen-units = 1 diff --git a/crates/download/src/download_ext.rs b/crates/download/src/download_ext.rs index c8a9130..c6a1a59 100644 --- a/crates/download/src/download_ext.rs +++ b/crates/download/src/download_ext.rs @@ -9,6 +9,18 @@ extern "ExtismHost" { fn to_virtual_path(path: String) -> String; } +#[plugin_fn] +pub fn register_extension( + Json(_): Json, +) -> FnResult> { + Ok(Json(ExtensionMetadataOutput { + name: "Download".into(), + description: Some("Download a file from a URL into the current working directory.".into()), + plugin_version: env!("CARGO_PKG_VERSION").into(), + config_schema: None, + })) +} + #[derive(Args)] pub struct DownloadExtensionArgs { #[arg(long, short = 'u', required = true)] diff --git a/crates/migrate-nx/src/lib.rs b/crates/migrate-nx/src/lib.rs index 5c457c4..1db6a2d 100644 --- a/crates/migrate-nx/src/lib.rs +++ b/crates/migrate-nx/src/lib.rs @@ -1,8 +1,8 @@ #[cfg(feature = "wasm")] -mod migrate_nx; +mod migrate_nx_ext; mod nx_json; mod nx_migrator; mod nx_project_json; #[cfg(feature = "wasm")] -pub use migrate_nx::*; +pub use migrate_nx_ext::*; diff --git a/crates/migrate-nx/src/migrate_nx.rs b/crates/migrate-nx/src/migrate_nx_ext.rs similarity index 85% rename from crates/migrate-nx/src/migrate_nx.rs rename to crates/migrate-nx/src/migrate_nx_ext.rs index 340012b..7e8a8bd 100644 --- a/crates/migrate-nx/src/migrate_nx.rs +++ b/crates/migrate-nx/src/migrate_nx_ext.rs @@ -8,6 +8,18 @@ extern "ExtismHost" { fn host_log(input: Json); } +#[plugin_fn] +pub fn register_extension( + Json(_): Json, +) -> FnResult> { + Ok(Json(ExtensionMetadataOutput { + name: "Migrate Nx".into(), + description: Some("Migrate an Nx repository to moon by converting all nx.json and project.json files into moon configuration files.".into()), + plugin_version: env!("CARGO_PKG_VERSION").into(), + config_schema: None, + })) +} + #[derive(Args)] pub struct MigrateNxExtensionArgs { #[arg(long)] diff --git a/crates/migrate-turborepo/src/lib.rs b/crates/migrate-turborepo/src/lib.rs index 47222cb..978f0cc 100644 --- a/crates/migrate-turborepo/src/lib.rs +++ b/crates/migrate-turborepo/src/lib.rs @@ -1,7 +1,7 @@ #[cfg(feature = "wasm")] -mod migrate_turborepo; +mod migrate_turborepo_ext; mod turbo_json; mod turbo_migrator; #[cfg(feature = "wasm")] -pub use migrate_turborepo::*; +pub use migrate_turborepo_ext::*; diff --git a/crates/migrate-turborepo/src/migrate_turborepo.rs b/crates/migrate-turborepo/src/migrate_turborepo_ext.rs similarity index 78% rename from crates/migrate-turborepo/src/migrate_turborepo.rs rename to crates/migrate-turborepo/src/migrate_turborepo_ext.rs index 155e3bc..4369cc3 100644 --- a/crates/migrate-turborepo/src/migrate_turborepo.rs +++ b/crates/migrate-turborepo/src/migrate_turborepo_ext.rs @@ -8,6 +8,18 @@ extern "ExtismHost" { fn host_log(input: Json); } +#[plugin_fn] +pub fn register_extension( + Json(_): Json, +) -> FnResult> { + Ok(Json(ExtensionMetadataOutput { + name: "Migrate Turborepo".into(), + description: Some("Migrate a Turborepo repository to moon by converting all turbo.json files into moon configuration files.".into()), + plugin_version: env!("CARGO_PKG_VERSION").into(), + config_schema: None, + })) +} + #[derive(Args)] pub struct MigrateTurborepoExtensionArgs { #[arg(long)] diff --git a/crates/unpack/src/unpack_ext.rs b/crates/unpack/src/unpack_ext.rs index eb017da..27b3307 100644 --- a/crates/unpack/src/unpack_ext.rs +++ b/crates/unpack/src/unpack_ext.rs @@ -11,6 +11,18 @@ extern "ExtismHost" { fn to_virtual_path(path: String) -> String; } +#[plugin_fn] +pub fn register_extension( + Json(_): Json, +) -> FnResult> { + Ok(Json(ExtensionMetadataOutput { + name: "Unpack".into(), + description: Some("Unpack an archive into the provided destination.".into()), + plugin_version: env!("CARGO_PKG_VERSION").into(), + config_schema: None, + })) +} + #[derive(Args)] pub struct UnpackExtensionArgs { #[arg(long, short = 's', required = true)] From 52905a30076b785f0095c572bfd103830f255ee6 Mon Sep 17 00:00:00 2001 From: Miles Johnson Date: Fri, 30 Aug 2024 16:49:20 -0700 Subject: [PATCH 2/2] Update deps. --- Cargo.lock | 22 +++++++++++++++++----- Cargo.toml | 22 +++++++++++----------- 2 files changed, 28 insertions(+), 16 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4a8c24e..f299696 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1767,6 +1767,8 @@ dependencies = [ [[package]] name = "moon_common" version = "0.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "854b7e24a2c03b9136d2d1297eabc0b8222b1ed9d1606b12900233987a9ca902" dependencies = [ "dirs 5.0.1", "miette", @@ -1782,6 +1784,8 @@ dependencies = [ [[package]] name = "moon_config" version = "0.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "219ffb426909e12d7c69a29d4522121cddb81ac1e4b4dfeaa6bf25afedbeabe7" dependencies = [ "indexmap 2.5.0", "miette", @@ -1863,7 +1867,9 @@ dependencies = [ [[package]] name = "moon_pdk" -version = "0.0.9" +version = "0.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2806f0abed0dc802ce6170326112265181f117a44b47bf900d9daa48b0dc341" dependencies = [ "clap", "extism-pdk", @@ -1874,7 +1880,9 @@ dependencies = [ [[package]] name = "moon_pdk_api" -version = "0.0.9" +version = "0.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81f1e3ebaa9cd50fac8b5010b1165c628a40cce16e2690604f4d9b57e912e594" dependencies = [ "moon_common", "moon_config", @@ -1886,7 +1894,9 @@ dependencies = [ [[package]] name = "moon_pdk_test_utils" -version = "0.0.10" +version = "0.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4c76c678b58b23ad01460ef4b56e5518ab10f6ee5c2e8e773408c401204f6aa" dependencies = [ "extism", "moon_pdk_api", @@ -1898,6 +1908,8 @@ dependencies = [ [[package]] name = "moon_target" version = "0.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c1a34384f1819ffdd66db597eadbc5eaf06ce1807fb40e4475545c10203fc07" dependencies = [ "miette", "moon_common", @@ -3128,9 +3140,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.39.3" +version = "1.40.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9babc99b9923bfa4804bd74722ff02c0381021eafa4db9949217e3be8e84fff5" +checksum = "e2b070231665d27ad9ec9b8df639893f46727666c6767db40317fbe920a5d998" dependencies = [ "backtrace", "bytes", diff --git a/Cargo.toml b/Cargo.toml index 0a57c01..13d6591 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,24 +4,24 @@ members = ["crates/*"] [workspace.dependencies] extism-pdk = "1.2.1" -# moon_common = "0.0.8" -# moon_config = "0.0.10" -# moon_pdk = "0.0.9" -# moon_pdk_test_utils = "0.0.10" -# moon_target = "0.0.7" +moon_common = "0.0.8" +moon_config = "0.0.10" +moon_pdk = "0.0.10" +moon_pdk_test_utils = "0.0.11" +moon_target = "0.0.7" rustc-hash = "2.0.0" serde = { version = "1.0.209", features = ["derive"] } serde_json = "1.0.127" serde_yaml = "0.9.34" starbase_utils = { version = "0.8.7", default-features = false } starbase_sandbox = "0.7.2" -tokio = { version = "1.39.2", features = ["full"] } +tokio = { version = "1.40.0", features = ["full"] } -moon_common = { path = "../moon/crates/common" } -moon_config = { path = "../moon/crates/config" } -moon_pdk = { path = "../moon/crates/pdk" } -moon_pdk_test_utils = { path = "../moon/crates/pdk-test-utils" } -moon_target = { path = "../moon/crates/target" } +# moon_common = { path = "../moon/crates/common" } +# moon_config = { path = "../moon/crates/config" } +# moon_pdk = { path = "../moon/crates/pdk" } +# moon_pdk_test_utils = { path = "../moon/crates/pdk-test-utils" } +# moon_target = { path = "../moon/crates/target" } [profile.release] codegen-units = 1