diff --git a/CHANGELOG.md b/CHANGELOG.md index f8e4106..8ab4260 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # Changelog +## 0.6.0 + +#### 🚀 Updates + +- Added 2 new settings: `intercept-globals` and `bundled-npm`. +- Updated to support proto v0.24 release. + +#### ⚙️ Internal + +- Updated dependencies. + ## 0.5.3 #### 🐞 Fixes diff --git a/Cargo.lock b/Cargo.lock index d52d88d..d49b87d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -136,7 +136,7 @@ checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -332,6 +332,15 @@ dependencies = [ "winx 0.35.1", ] +[[package]] +name = "castaway" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a17ed5635fc8536268e5d4de1e22e81ac34419e5f052d4d51f4e01dcc263fcc" +dependencies = [ + "rustversion", +] + [[package]] name = "cbindgen" version = "0.24.5" @@ -382,6 +391,28 @@ dependencies = [ "windows-targets 0.48.5", ] +[[package]] +name = "chrono-tz" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e23185c0e21df6ed832a12e2bda87c7d1def6842881fb634a8511ced741b0d76" +dependencies = [ + "chrono", + "chrono-tz-build", + "phf", +] + +[[package]] +name = "chrono-tz-build" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "433e39f13c9a060046954e0592a8d0a4bcb1040125cbf91cb8ee58964cfb350f" +dependencies = [ + "parse-zoneinfo", + "phf", + "phf_codegen", +] + [[package]] name = "clap" version = "3.2.25" @@ -412,6 +443,19 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aaa6b4b263a5d737e9bf6b7c09b72c41a5480aec4d7219af827f6564e950b6a5" +[[package]] +name = "compact_str" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f86b9c4c00838774a6d902ef931eff7470720c51d90c2e32cfe15dc304737b3f" +dependencies = [ + "castaway", + "cfg-if", + "itoa", + "ryu", + "static_assertions", +] + [[package]] name = "console" version = "0.15.7" @@ -444,6 +488,15 @@ dependencies = [ "unicode-xid", ] +[[package]] +name = "convert_case" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec182b0ca2f35d8fc196cf3404988fd8b8c739a4d270ff118a398feb0cbec1ca" +dependencies = [ + "unicode-segmentation", +] + [[package]] name = "core-foundation" version = "0.9.3" @@ -693,7 +746,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -715,7 +768,7 @@ checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" dependencies = [ "darling_core 0.20.3", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -757,6 +810,12 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c877555693c14d2f84191cfd3ad8582790fc52b5e2274b40b59cf5f5cea25c7" +[[package]] +name = "deunicode" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a1abaf4d861455be59f64fd2b55606cb151fce304ede7165f410243ce96bde6" + [[package]] name = "diff" version = "0.1.13" @@ -910,9 +969,9 @@ dependencies = [ [[package]] name = "extism" -version = "0.5.4" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67e81d3e7d1592412579984e773bd553703a664bbfb1ddded742bf6dfae63847" +checksum = "1b7809353b2a431222219d4699947200c49a043d978fb28b4e199ced449117ef" dependencies = [ "anyhow", "extism-manifest", @@ -955,14 +1014,14 @@ checksum = "d2be216330f7304de051e0faf1578880e9e0dc1ecbd2c0fea5765c63a079d0ba" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] name = "extism-runtime" -version = "0.5.4" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "126b884cfa74fc386eedff1095bac8ef6c2ae5efdb656e508f12a41434d0bf0c" +checksum = "6bf6aade8203c23185bcf12871168fc5959b9d62e7a59a4287fe2d5be69a68d5" dependencies = [ "anyhow", "cbindgen", @@ -1054,9 +1113,9 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "form_urlencoded" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" dependencies = [ "percent-encoding", ] @@ -1138,7 +1197,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -1193,6 +1252,31 @@ dependencies = [ "serde_json", ] +[[package]] +name = "garde" +version = "0.16.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f0bde634ca1248cfcd67a29f7b3798997d328406020f5e19b502b0a0d5e8cae" +dependencies = [ + "compact_str", + "garde_derive", + "once_cell", + "regex", + "smallvec", +] + +[[package]] +name = "garde_derive" +version = "0.16.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "feafd106c73dd61d6f10f2fa782cdb6212b3422aee5b953a094818e9575078aa" +dependencies = [ + "proc-macro2", + "quote", + "regex", + "syn 2.0.39", +] + [[package]] name = "generic-array" version = "0.14.7" @@ -1366,6 +1450,15 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "140a09c9305e6d5e557e2ed7cbc68e05765a7d4213975b87cb04920689cc6219" +[[package]] +name = "humansize" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6cb51c9a029ddc91b07a787f1d86b53ccfa49b0e86688c946ebe8d3555685dd7" +dependencies = [ + "libm", +] + [[package]] name = "humantime" version = "2.1.0" @@ -1447,9 +1540,9 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" [[package]] name = "idna" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" dependencies = [ "unicode-bidi", "unicode-normalization", @@ -1651,6 +1744,12 @@ version = "0.2.150" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" +[[package]] +name = "libm" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" + [[package]] name = "linked-hash-map" version = "0.5.6" @@ -1799,7 +1898,7 @@ checksum = "49e7bc1560b95a3c4a25d03de42fe76ca718ab92d1a22a55b9b4cf67b3ae635c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -1850,7 +1949,7 @@ dependencies = [ [[package]] name = "node_depman_plugin" -version = "0.5.3" +version = "0.6.0" dependencies = [ "extism-pdk", "node_common", @@ -1865,7 +1964,7 @@ dependencies = [ [[package]] name = "node_plugin" -version = "0.5.3" +version = "0.6.0" dependencies = [ "extism-pdk", "node_common", @@ -1941,9 +2040,9 @@ checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "once_map" -version = "0.4.10" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3388ad2ab0b17d90355995011856a3337e0a98147950f076ee9a73ad5d4a553e" +checksum = "eba3de7c2ff90d756ee0713daaae3a3547fa2424b3b9cca46bce0b4dcd1d7ef2" dependencies = [ "ahash", "hashbrown 0.14.2", @@ -2007,6 +2106,15 @@ dependencies = [ "windows-targets 0.48.5", ] +[[package]] +name = "parse-zoneinfo" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c705f256449c60da65e11ff6626e0c16a0a0b96aaa348de61376b249bc340f41" +dependencies = [ + "regex", +] + [[package]] name = "paste" version = "1.0.14" @@ -2015,9 +2123,92 @@ checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" [[package]] name = "percent-encoding" -version = "2.3.0" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" + +[[package]] +name = "pest" +version = "2.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae9cee2a55a544be8b89dc6848072af97a20f2422603c10865be2a42b580fff5" +dependencies = [ + "memchr", + "thiserror", + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81d78524685f5ef2a3b3bd1cafbc9fcabb036253d9b1463e726a91cd16e2dfc2" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68bd1206e71118b5356dae5ddc61c8b11e28b09ef6a31acbd15ea48a28e0c227" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn 2.0.39", +] + +[[package]] +name = "pest_meta" +version = "2.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" +checksum = "7c747191d4ad9e4a4ab9c8798f1e82a39affe7ef9648390b7e5548d18e099de6" +dependencies = [ + "once_cell", + "pest", + "sha2", +] + +[[package]] +name = "phf" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc" +dependencies = [ + "phf_shared", +] + +[[package]] +name = "phf_codegen" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8d39688d359e6b34654d328e262234662d16cc0f60ec8dcbe5e718709342a5a" +dependencies = [ + "phf_generator", + "phf_shared", +] + +[[package]] +name = "phf_generator" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0" +dependencies = [ + "phf_shared", + "rand", +] + +[[package]] +name = "phf_shared" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b" +dependencies = [ + "siphasher", +] [[package]] name = "pin-project-lite" @@ -2095,18 +2286,18 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.69" +version = "1.0.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" +checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b" dependencies = [ "unicode-ident", ] [[package]] name = "proto_core" -version = "0.23.4" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37b4467e6e2819e74fc2247ff2d69486713414386fcc6549d172748bbcfa2a57" +checksum = "0fd739ac06372f62e810f289a0dc7346d56534c7c0f87c8f61a149f5b2522620" dependencies = [ "cached", "extism", @@ -2117,6 +2308,7 @@ dependencies = [ "proto_pdk_api", "regex", "reqwest", + "schematic", "semver", "serde", "serde_json", @@ -2126,8 +2318,8 @@ dependencies = [ "starbase_styles", "starbase_utils", "system_env", + "tera", "thiserror", - "tinytemplate", "tracing", "url", "version_spec", @@ -2136,9 +2328,9 @@ dependencies = [ [[package]] name = "proto_pdk" -version = "0.10.3" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d089171d7324c74fdc56f1ff246f9d9c34eda19549d3de142ac09faaadf9e61e" +checksum = "2745021ea55463efafc466ad7218b9bd797853e95ca73249eb225dce60d03c54" dependencies = [ "anyhow", "extism-pdk", @@ -2148,9 +2340,9 @@ dependencies = [ [[package]] name = "proto_pdk_api" -version = "0.10.4" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cde8df4fbd8eeea007157df37376c24bf1cde6bffb3638aeefa95583911b15a5" +checksum = "72325283c00030c565ff067fab5bee7ce22c3c345aea6f5b48ffb28d60234f58" dependencies = [ "anyhow", "semver", @@ -2164,9 +2356,9 @@ dependencies = [ [[package]] name = "proto_pdk_test_utils" -version = "0.11.1" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a2d0ec151cb028a169a2a87f184f54e3c6bda24c62a1cc22154df26be485343" +checksum = "60027d4095318e5fe36443ce3d5a4f011101350ac8344d6c241cddc93bfbf0ad" dependencies = [ "extism", "proto_core", @@ -2509,6 +2701,12 @@ dependencies = [ "untrusted", ] +[[package]] +name = "rustversion" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" + [[package]] name = "ryu" version = "1.0.15" @@ -2533,6 +2731,43 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "schematic" +version = "0.12.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "710a6af816c586a37dc9b8b304370f36d8b90751785bbb245942bed0ae00a69d" +dependencies = [ + "garde", + "miette", + "schematic_macros", + "schematic_types", + "serde", + "serde_path_to_error", + "starbase_styles", + "thiserror", + "toml 0.8.8", + "tracing", +] + +[[package]] +name = "schematic_macros" +version = "0.12.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10e8b482f96eaca0fdc4fe3441c2eda44f5aeeb1a93b653d214ee2ecf4975be4" +dependencies = [ + "convert_case", + "darling 0.20.3", + "proc-macro2", + "quote", + "syn 2.0.39", +] + +[[package]] +name = "schematic_types" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c38cdd0968bde35f7e093600c90e0306da6af5ffd1b3cb175dbfde1146debcf2" + [[package]] name = "scopeguard" version = "1.2.0" @@ -2608,7 +2843,7 @@ checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -2622,6 +2857,16 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_path_to_error" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4beec8bce849d58d06238cb50db2e1c417cfeafa4c63f692b15c82b7c80f8335" +dependencies = [ + "itoa", + "serde", +] + [[package]] name = "serde_spanned" version = "0.6.4" @@ -2677,7 +2922,7 @@ checksum = "91d129178576168c589c9ec973feedf7d3126c01ac2bf08795109aa35b69fb8f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -2721,6 +2966,12 @@ version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "420acb44afdae038210c99e69aae24109f32f15500aa708e81d46c9f29d55fcf" +[[package]] +name = "siphasher" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" + [[package]] name = "slab" version = "0.4.9" @@ -2736,6 +2987,16 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "826167069c09b99d56f31e9ae5c99049e932a98c9dc2dac47645b08dbbf76ba7" +[[package]] +name = "slug" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bd94acec9c8da640005f8e135a39fc0372e74535e6b368b7a04b875f784c8c4" +dependencies = [ + "deunicode", + "wasm-bindgen", +] + [[package]] name = "smallvec" version = "1.11.0" @@ -2820,7 +3081,7 @@ dependencies = [ "darling 0.20.3", "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -2873,6 +3134,12 @@ dependencies = [ "wax", ] +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + [[package]] name = "strsim" version = "0.10.0" @@ -2902,9 +3169,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.38" +version = "2.0.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" +checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" dependencies = [ "proc-macro2", "quote", @@ -2950,9 +3217,9 @@ dependencies = [ [[package]] name = "system_env" -version = "0.1.5" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63476c953552c18056a153eaabc04d2987bc64f07633acc80d6a65a8574f1a3b" +checksum = "221c4406bc1af727cb66618e377d1ed799eb59e029c93d9aabe67f4d2b67274f" dependencies = [ "serde", "serde_json", @@ -3000,6 +3267,28 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "tera" +version = "1.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "970dff17c11e884a4a09bc76e3a17ef71e01bb13447a11e85226e254fe6d10b8" +dependencies = [ + "chrono", + "chrono-tz", + "globwalk", + "humansize", + "lazy_static", + "percent-encoding", + "pest", + "pest_derive", + "rand", + "regex", + "serde", + "serde_json", + "slug", + "unic-segment", +] + [[package]] name = "termcolor" version = "1.2.0" @@ -3038,7 +3327,7 @@ checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -3073,16 +3362,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "tinytemplate" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc" -dependencies = [ - "serde", - "serde_json", -] - [[package]] name = "tinyvec" version = "1.6.0" @@ -3125,7 +3404,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -3246,7 +3525,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -3279,6 +3558,62 @@ version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" +[[package]] +name = "ucd-trie" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9" + +[[package]] +name = "unic-char-property" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8c57a407d9b6fa02b4795eb81c5b6652060a15a7903ea981f3d723e6c0be221" +dependencies = [ + "unic-char-range", +] + +[[package]] +name = "unic-char-range" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0398022d5f700414f6b899e10b8348231abf9173fa93144cbc1a43b9793c1fbc" + +[[package]] +name = "unic-common" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80d7ff825a6a654ee85a63e80f92f054f904f21e7d12da4e22f9834a4aaa35bc" + +[[package]] +name = "unic-segment" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4ed5d26be57f84f176157270c112ef57b86debac9cd21daaabbe56db0f88f23" +dependencies = [ + "unic-ucd-segment", +] + +[[package]] +name = "unic-ucd-segment" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2079c122a62205b421f499da10f3ee0f7697f012f55b675e002483c73ea34700" +dependencies = [ + "unic-char-property", + "unic-char-range", + "unic-ucd-version", +] + +[[package]] +name = "unic-ucd-version" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96bd2f2237fe450fcd0a1d2f5f4e91711124f7857ba2e964247776ebeeb7b0c4" +dependencies = [ + "unic-common", +] + [[package]] name = "unicase" version = "2.7.0" @@ -3309,6 +3644,12 @@ dependencies = [ "tinyvec", ] +[[package]] +name = "unicode-segmentation" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" + [[package]] name = "unicode-width" version = "0.1.10" @@ -3354,9 +3695,9 @@ dependencies = [ [[package]] name = "url" -version = "2.4.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5" +checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" dependencies = [ "form_urlencoded", "idna", @@ -3386,9 +3727,9 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "version_spec" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a874b9ff438ee535ce27c6099a76f23483b475e5942b85fd97d4a6806abaa3f3" +checksum = "f3aaaf40ae0d800122ce8ef646ddd08ea02a42a141b249e08496e10ae3eb4440" dependencies = [ "human-sort", "regex", @@ -3426,9 +3767,9 @@ dependencies = [ [[package]] name = "warpgate" -version = "0.5.14" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2662e91ce31608be2b2f653bb7d7f4b35f4862721c9b4439110cd21a22684279" +checksum = "8a7753f1234515fcfb16f532527e6d4c3bf20a9745b89ca6d450f7ae9b04fbdd" dependencies = [ "extism", "miette", @@ -3449,9 +3790,9 @@ dependencies = [ [[package]] name = "warpgate_api" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a4834d752d83450aab41986e1b9a08d069bbe09a83fe016532de19d0a87e24e" +checksum = "5fe2fae4f5a428c7c697e057909240e376abdd45577beec6d4bd9798b451f20c" dependencies = [ "serde", ] @@ -3533,7 +3874,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", "wasm-bindgen-shared", ] @@ -3567,7 +3908,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", "wasm-bindgen-backend", "wasm-bindgen-shared", ] diff --git a/Cargo.toml b/Cargo.toml index 1fb2733..119dc85 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,9 +4,9 @@ members = ["crates/*"] [workspace.dependencies] extism-pdk = "0.3.4" -proto_pdk = { version = "0.10.3" } # , path = "../../proto/crates/pdk" } -proto_pdk_api = { version = "0.10.4" } # , path = "../../proto/crates/pdk-api" } -proto_pdk_test_utils = { version = "0.11.1" } # , path = "../../proto/crates/pdk-test-utils" } +proto_pdk = { version = "0.11.1" } # , path = "../../proto/crates/pdk" } +proto_pdk_api = { version = "0.11.1" } # , path = "../../proto/crates/pdk-api" } +proto_pdk_test_utils = { version = "0.12.0" } # , path = "../../proto/crates/pdk-test-utils" } regex = { version = "1.10.2", default-features = false, features = [ "std", "unicode", diff --git a/README.md b/README.md index 0288213..404b1c0 100644 --- a/README.md +++ b/README.md @@ -2,15 +2,39 @@ Node.js, npm, pnpm, and yarn WASM plugins for [proto](https://github.com/moonrepo/proto). +## Installation + ```shell proto install node proto install npm ``` -## Post-install hook +These plugins are built-in to proto, but if you want to override it with an explicit version, add the following to `.prototools`. + +```toml +[plugins] +node = "source:https://github.com/moonrepo/node-plugin/releases/download/vX.Y.Z/node_plugin.wasm" +npm|pnpm|yarn = "source:https://github.com/moonrepo/node-plugin/releases/download/vX.Y.Z/node_depman_plugin.wasm" +``` + +## Configuration + +All plugins can be configured with a `.prototools` file. + +- `bundled-npm` (bool) - When `node` is installed, also install `npm` with the version of npm that came bundled with Node.js. Defaults to `true`. +- `intercept-globals` (bool) - When npm, pnpm, or yarn attempt to install a global package, intercept the call and fail with an error message encouraging the use of `proto install-global` instead. Defaults to `true`. + +```toml +[tools.node] +bundled-npm = false +``` + +## Hooks + +### Post-install After installation, the version of npm that came bundled with Node.js will also be installed. This -functionality can be skipped by passing `--no-bundled-npm` during installation. +functionality can be skipped by passing `--no-bundled-npm` during installation, or setting the `bundled-npm` configuration to `false`. ```shell proto install node -- --no-bundled-npm @@ -24,7 +48,7 @@ Build the plugins: cargo build --target wasm32-wasi ``` -Test the plugins by running `proto` commands. Requires proto >= v0.12. +Test the plugins by running `proto` commands. ```shell proto install node-test diff --git a/crates/common/src/config.rs b/crates/common/src/config.rs new file mode 100644 index 0000000..45bcf20 --- /dev/null +++ b/crates/common/src/config.rs @@ -0,0 +1,15 @@ +#[derive(Debug, serde::Deserialize)] +#[serde(default, deny_unknown_fields, rename_all = "kebab-case")] +pub struct PluginConfig { + pub bundled_npm: bool, + pub intercept_globals: bool, +} + +impl Default for PluginConfig { + fn default() -> Self { + Self { + bundled_npm: true, + intercept_globals: true, + } + } +} diff --git a/crates/common/src/lib.rs b/crates/common/src/lib.rs index 2391104..8c158cf 100644 --- a/crates/common/src/lib.rs +++ b/crates/common/src/lib.rs @@ -1,6 +1,8 @@ pub mod commands; +mod config; mod node_dist; mod package_json; +pub use config::*; pub use node_dist::*; pub use package_json::*; diff --git a/crates/node-depman/Cargo.toml b/crates/node-depman/Cargo.toml index e573bc5..af194a8 100644 --- a/crates/node-depman/Cargo.toml +++ b/crates/node-depman/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "node_depman_plugin" -version = "0.5.3" +version = "0.6.0" edition = "2021" license = "MIT" publish = false diff --git a/crates/node-depman/src/proto.rs b/crates/node-depman/src/proto.rs index 385c3a1..f6df43f 100644 --- a/crates/node-depman/src/proto.rs +++ b/crates/node-depman/src/proto.rs @@ -3,7 +3,7 @@ use crate::package_manager::PackageManager; use extism_pdk::*; use node_common::{ commands::{self, get_global_prefix}, - BinField, NodeDistVersion, PackageJson, + BinField, NodeDistVersion, PackageJson, PluginConfig, }; use proto_pdk::*; use std::collections::HashMap; @@ -351,12 +351,9 @@ pub fn uninstall_global( #[plugin_fn] pub fn pre_run(Json(input): Json) -> FnResult<()> { let args = &input.passthrough_args; - let user_config = get_proto_user_config()?; + let config = get_tool_config::()?; - if args.len() < 3 - || host_env!("PROTO_INSTALL_GLOBAL").is_some() - || !user_config.node_intercept_globals - { + if args.len() < 3 || !config.intercept_globals || host_env!("PROTO_INSTALL_GLOBAL").is_some() { return Ok(()); } @@ -387,8 +384,8 @@ pub fn pre_run(Json(input): Json) -> FnResult<()> { return err!( "Global binaries must be installed with `proto install-global {}`!\nLearn more: {}\n\nOpt-out of this functionality with `{}`.", manager.to_string(), - "https://moonrepo.dev/docs/proto/faq#how-can-i-install-a-global-binary-for-a-language", - "node-intercept-globals = false", + "https://github.com/moonrepo/node-plugin#configuration", + "tools.node.intercept-globals = false", ); } diff --git a/crates/node-depman/tests/hooks_test.rs b/crates/node-depman/tests/hooks_test.rs index 4d97134..119879e 100644 --- a/crates/node-depman/tests/hooks_test.rs +++ b/crates/node-depman/tests/hooks_test.rs @@ -1,7 +1,7 @@ // Importing proto_pdk crashes Windows because it contains WASM code #[cfg(not(windows))] mod hooks { - use proto_pdk::{RunHook, ToolContext, UserConfigSettings}; + use proto_pdk::{RunHook, ToolContext}; use proto_pdk_test_utils::create_plugin; use starbase_sandbox::create_empty_sandbox; use std::env; @@ -38,12 +38,8 @@ mod hooks { let mut plugin = create_plugin("npm-test", sandbox.path()); plugin.tool.plugin.manifest.config.insert( - "proto_user_config".into(), - serde_json::to_string(&UserConfigSettings { - node_intercept_globals: false, - ..UserConfigSettings::default() - }) - .unwrap(), + "proto_tool_config".into(), + r#"{"intercept-globals":false}"#.to_owned(), ); plugin.tool.plugin.reload_config().unwrap(); diff --git a/crates/node-depman/tests/snapshots/shims_test__npm__creates_global_shims-2.snap b/crates/node-depman/tests/snapshots/shims_test__npm__creates_global_shims-2.snap index b48b524..5ee69c5 100644 --- a/crates/node-depman/tests/snapshots/shims_test__npm__creates_global_shims-2.snap +++ b/crates/node-depman/tests/snapshots/shims_test__npm__creates_global_shims-2.snap @@ -4,9 +4,11 @@ expression: "std::fs::read_to_string(sandbox.path().join(\".proto/shims\").join( --- #!/usr/bin/env bash set -e -[ -n "$PROTO_DEBUG" ] && set -x +if [ -n "$PROTO_DEBUG" ]; then + set -x + echo "Running with npm-test.sh shim" +fi exec proto run npm-test --alt "npx" -- "$@" - diff --git a/crates/node-depman/tests/snapshots/shims_test__npm__creates_global_shims-3.snap b/crates/node-depman/tests/snapshots/shims_test__npm__creates_global_shims-3.snap index d148166..0714ee1 100644 --- a/crates/node-depman/tests/snapshots/shims_test__npm__creates_global_shims-3.snap +++ b/crates/node-depman/tests/snapshots/shims_test__npm__creates_global_shims-3.snap @@ -4,9 +4,11 @@ expression: "std::fs::read_to_string(sandbox.path().join(\".proto/shims\").join( --- #!/usr/bin/env bash set -e -[ -n "$PROTO_DEBUG" ] && set -x +if [ -n "$PROTO_DEBUG" ]; then + set -x + echo "Running with npm-test.sh shim" +fi exec proto run npm-test --alt "node-gyp" -- "$@" - diff --git a/crates/node-depman/tests/snapshots/shims_test__npm__creates_global_shims.snap b/crates/node-depman/tests/snapshots/shims_test__npm__creates_global_shims.snap index fe1ffbe..a26040f 100644 --- a/crates/node-depman/tests/snapshots/shims_test__npm__creates_global_shims.snap +++ b/crates/node-depman/tests/snapshots/shims_test__npm__creates_global_shims.snap @@ -4,9 +4,11 @@ expression: "std::fs::read_to_string(sandbox.path().join(\".proto/shims\").join( --- #!/usr/bin/env bash set -e -[ -n "$PROTO_DEBUG" ] && set -x +if [ -n "$PROTO_DEBUG" ]; then + set -x + echo "Running with npm-test.sh shim" +fi exec proto run npm-test -- "$@" - diff --git a/crates/node-depman/tests/snapshots/shims_test__pnpm__creates_global_shims-2.snap b/crates/node-depman/tests/snapshots/shims_test__pnpm__creates_global_shims-2.snap index 7e431e5..04eca6b 100644 --- a/crates/node-depman/tests/snapshots/shims_test__pnpm__creates_global_shims-2.snap +++ b/crates/node-depman/tests/snapshots/shims_test__pnpm__creates_global_shims-2.snap @@ -4,9 +4,11 @@ expression: "std::fs::read_to_string(sandbox.path().join(\".proto/shims\").join( --- #!/usr/bin/env bash set -e -[ -n "$PROTO_DEBUG" ] && set -x +if [ -n "$PROTO_DEBUG" ]; then + set -x + echo "Running with pnpm-test.sh shim" +fi exec proto run pnpm-test -- dlx "$@" - diff --git a/crates/node-depman/tests/snapshots/shims_test__pnpm__creates_global_shims.snap b/crates/node-depman/tests/snapshots/shims_test__pnpm__creates_global_shims.snap index e56a1f5..05ae342 100644 --- a/crates/node-depman/tests/snapshots/shims_test__pnpm__creates_global_shims.snap +++ b/crates/node-depman/tests/snapshots/shims_test__pnpm__creates_global_shims.snap @@ -4,9 +4,11 @@ expression: "std::fs::read_to_string(sandbox.path().join(\".proto/shims\").join( --- #!/usr/bin/env bash set -e -[ -n "$PROTO_DEBUG" ] && set -x +if [ -n "$PROTO_DEBUG" ]; then + set -x + echo "Running with pnpm-test.sh shim" +fi exec proto run pnpm-test -- "$@" - diff --git a/crates/node-depman/tests/snapshots/shims_test__yarn__creates_global_shims-2.snap b/crates/node-depman/tests/snapshots/shims_test__yarn__creates_global_shims-2.snap index 7f1e501..1362fbe 100644 --- a/crates/node-depman/tests/snapshots/shims_test__yarn__creates_global_shims-2.snap +++ b/crates/node-depman/tests/snapshots/shims_test__yarn__creates_global_shims-2.snap @@ -4,9 +4,11 @@ expression: "std::fs::read_to_string(sandbox.path().join(\".proto/shims\").join( --- #!/usr/bin/env bash set -e -[ -n "$PROTO_DEBUG" ] && set -x +if [ -n "$PROTO_DEBUG" ]; then + set -x + echo "Running with yarn-test.sh shim" +fi exec proto run yarn-test --alt "yarnpkg" -- "$@" - diff --git a/crates/node-depman/tests/snapshots/shims_test__yarn__creates_global_shims.snap b/crates/node-depman/tests/snapshots/shims_test__yarn__creates_global_shims.snap index 2b010ff..fc444f0 100644 --- a/crates/node-depman/tests/snapshots/shims_test__yarn__creates_global_shims.snap +++ b/crates/node-depman/tests/snapshots/shims_test__yarn__creates_global_shims.snap @@ -4,9 +4,11 @@ expression: "std::fs::read_to_string(sandbox.path().join(\".proto/shims\").join( --- #!/usr/bin/env bash set -e -[ -n "$PROTO_DEBUG" ] && set -x +if [ -n "$PROTO_DEBUG" ]; then + set -x + echo "Running with yarn-test.sh shim" +fi exec proto run yarn-test -- "$@" - diff --git a/crates/node/Cargo.toml b/crates/node/Cargo.toml index 227e5fb..dabf2b0 100644 --- a/crates/node/Cargo.toml +++ b/crates/node/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "node_plugin" -version = "0.5.3" +version = "0.6.0" edition = "2021" license = "MIT" publish = false diff --git a/crates/node/src/proto.rs b/crates/node/src/proto.rs index 5a0e90d..8b3d61e 100644 --- a/crates/node/src/proto.rs +++ b/crates/node/src/proto.rs @@ -1,7 +1,7 @@ use extism_pdk::*; use node_common::{ commands::{self, get_global_prefix}, - NodeDistLTS, NodeDistVersion, PackageJson, + NodeDistLTS, NodeDistVersion, PackageJson, PluginConfig, }; use proto_pdk::*; @@ -249,10 +249,13 @@ pub fn uninstall_global( #[plugin_fn] pub fn post_install(Json(input): Json) -> FnResult<()> { - if input - .passthrough_args - .iter() - .any(|arg| arg == "--no-bundled-npm") + let config = get_tool_config::()?; + + if !config.bundled_npm + || input + .passthrough_args + .iter() + .any(|arg| arg == "--no-bundled-npm") { return Ok(()); } @@ -265,15 +268,21 @@ pub fn post_install(Json(input): Json) -> FnResult<()> { args.push("--pin"); } - if !input.passthrough_args.is_empty() { + let passthrough_args = input + .passthrough_args + .iter() + .filter_map(|arg| { + if arg.as_str() == "--no-bundled-npm" { + None + } else { + Some(arg.as_str()) + } + }) + .collect::>(); + + if !passthrough_args.is_empty() { args.push("--"); - args.extend( - input - .passthrough_args - .iter() - .map(|a| a.as_str()) - .collect::>(), - ); + args.extend(passthrough_args); } exec_command!(inherit, "proto", args); diff --git a/crates/node/tests/snapshots/shims_test__creates_global_shims.snap b/crates/node/tests/snapshots/shims_test__creates_global_shims.snap index e0150b5..accd6a0 100644 --- a/crates/node/tests/snapshots/shims_test__creates_global_shims.snap +++ b/crates/node/tests/snapshots/shims_test__creates_global_shims.snap @@ -4,9 +4,11 @@ expression: "std::fs::read_to_string(sandbox.path().join(\".proto/shims\").join( --- #!/usr/bin/env bash set -e -[ -n "$PROTO_DEBUG" ] && set -x +if [ -n "$PROTO_DEBUG" ]; then + set -x + echo "Running with node-test.sh shim" +fi exec proto run node-test -- "$@" - diff --git a/crates/node/tests/versions_test.rs b/crates/node/tests/versions_test.rs index 5da45c6..ac1bec9 100644 --- a/crates/node/tests/versions_test.rs +++ b/crates/node/tests/versions_test.rs @@ -7,7 +7,7 @@ generate_resolve_versions_tests!("node-test", { "lts-gallium" => "16.20.2", "lts/fermium" => "14.21.3", "stable" => "20.10.0", - "node" => "21.2.0", + "node" => "21.4.0", }); #[test]