Skip to content
This repository has been archived by the owner on Jan 7, 2025. It is now read-only.

new: Add register_extension methods. #7

Merged
merged 2 commits into from
Aug 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 31 additions & 30 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@ members = ["crates/*"]
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_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/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
Expand Down
12 changes: 12 additions & 0 deletions crates/download/src/download_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,18 @@ extern "ExtismHost" {
fn to_virtual_path(path: String) -> String;
}

#[plugin_fn]
pub fn register_extension(
Json(_): Json<ExtensionMetadataInput>,
) -> FnResult<Json<ExtensionMetadataOutput>> {
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)]
Expand Down
4 changes: 2 additions & 2 deletions crates/migrate-nx/src/lib.rs
Original file line number Diff line number Diff line change
@@ -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::*;
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,18 @@ extern "ExtismHost" {
fn host_log(input: Json<HostLogInput>);
}

#[plugin_fn]
pub fn register_extension(
Json(_): Json<ExtensionMetadataInput>,
) -> FnResult<Json<ExtensionMetadataOutput>> {
Ok(Json(ExtensionMetadataOutput {
name: "Migrate Nx".into(),
description: Some("Migrate an Nx repository to moon by converting all <file>nx.json</file> and <file>project.json</file> files into moon configuration files.".into()),
plugin_version: env!("CARGO_PKG_VERSION").into(),
config_schema: None,
}))
}

#[derive(Args)]
pub struct MigrateNxExtensionArgs {
#[arg(long)]
Expand Down
4 changes: 2 additions & 2 deletions crates/migrate-turborepo/src/lib.rs
Original file line number Diff line number Diff line change
@@ -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::*;
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,18 @@ extern "ExtismHost" {
fn host_log(input: Json<HostLogInput>);
}

#[plugin_fn]
pub fn register_extension(
Json(_): Json<ExtensionMetadataInput>,
) -> FnResult<Json<ExtensionMetadataOutput>> {
Ok(Json(ExtensionMetadataOutput {
name: "Migrate Turborepo".into(),
description: Some("Migrate a Turborepo repository to moon by converting all <file>turbo.json</file> files into moon configuration files.".into()),
plugin_version: env!("CARGO_PKG_VERSION").into(),
config_schema: None,
}))
}

#[derive(Args)]
pub struct MigrateTurborepoExtensionArgs {
#[arg(long)]
Expand Down
12 changes: 12 additions & 0 deletions crates/unpack/src/unpack_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@ extern "ExtismHost" {
fn to_virtual_path(path: String) -> String;
}

#[plugin_fn]
pub fn register_extension(
Json(_): Json<ExtensionMetadataInput>,
) -> FnResult<Json<ExtensionMetadataOutput>> {
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)]
Expand Down