From 08b4c36d40406c2c5230ac85c7152143cf84153c Mon Sep 17 00:00:00 2001 From: Yohe-Am <56622350+Yohe-Am@users.noreply.github.com> Date: Thu, 30 Nov 2023 13:43:15 +0300 Subject: [PATCH] refactor: native js `unarchive` --- core/asdf.ts | 5 +- deno.lock | 130 ++++++++++++++++++++++++++++++++++++++++ deps/plug.ts | 2 + ghjk.ts | 2 +- plug.ts | 25 +++++++- plugs/act.ts | 14 +---- plugs/cargo-binstall.ts | 33 +++------- plugs/jco.ts | 9 +-- plugs/mold.ts | 19 ++---- plugs/node.ts | 18 +----- plugs/protoc.ts | 14 +---- plugs/ruff.ts | 12 +--- plugs/wasmedge.ts | 14 +---- plugs/whiz.ts | 14 +---- tests/e2e.ts | 2 +- tests/test.Dockerfile | 3 +- 16 files changed, 189 insertions(+), 127 deletions(-) diff --git a/core/asdf.ts b/core/asdf.ts index 23188d3a..865b2eb4 100644 --- a/core/asdf.ts +++ b/core/asdf.ts @@ -9,14 +9,16 @@ import { } from "./types.ts"; import { depBinShimPath, + getInstallId, pathWithDepShims, spawn, spawnOutput, - getInstallId } from "./utils.ts"; // import * as std_plugs from "../std.ts"; import { std_fs, std_path } from "../deps/common.ts"; +// FIXME: find a better way to expose std_plug.plug_id s +// that allows standard plugs to depend on each other const curl_aa_id = { id: "curl@aa", }; @@ -29,7 +31,6 @@ export const manifest = { name: "asdf@asdf", version: "0.1.0", moduleSpecifier: import.meta.url, - // deps: [std_plugs.tar_aa, std_plugs.git_aa], deps: [curl_aa_id, git_aa_id], }; diff --git a/deno.lock b/deno.lock index 53c72ab1..cf61d088 100644 --- a/deno.lock +++ b/deno.lock @@ -6,6 +6,104 @@ "https://deno.land/x/graphql_request/mod.ts": "https://deno.land/x/graphql_request@v4.1.0/mod.ts" }, "remote": { + "https://deno.land/std@0.129.0/_util/assert.ts": "e94f2eb37cebd7f199952e242c77654e43333c1ac4c5c700e929ea3aa5489f74", + "https://deno.land/std@0.129.0/_util/os.ts": "49b92edea1e82ba295ec946de8ffd956ed123e2948d9bd1d3e901b04e4307617", + "https://deno.land/std@0.129.0/archive/tar.ts": "35ea1baddec7988cc4034765a2cee7613bc8074bd40940d3f5e98f63070a716a", + "https://deno.land/std@0.129.0/async/abortable.ts": "a896ac6b0d4237bd2d2d248217cfa1f0d85ccda93cb25ebda55e33850e526be6", + "https://deno.land/std@0.129.0/async/deadline.ts": "48ac998d7564969f3e6ec6b6f9bf0217ebd00239b1b2292feba61272d5dd58d0", + "https://deno.land/std@0.129.0/async/debounce.ts": "564273ef242bcfcda19a439132f940db8694173abffc159ea34f07d18fc42620", + "https://deno.land/std@0.129.0/async/deferred.ts": "bc18e28108252c9f67dfca2bbc4587c3cbf3aeb6e155f8c864ca8ecff992b98a", + "https://deno.land/std@0.129.0/async/delay.ts": "cbbdf1c87d1aed8edc7bae13592fb3e27e3106e0748f089c263390d4f49e5f6c", + "https://deno.land/std@0.129.0/async/mod.ts": "2240c6841157738414331f47dee09bb8c0482c5b1980b6e3234dd03515c8132f", + "https://deno.land/std@0.129.0/async/mux_async_iterator.ts": "f4d1d259b0c694d381770ddaaa4b799a94843eba80c17f4a2ec2949168e52d1e", + "https://deno.land/std@0.129.0/async/pool.ts": "97b0dd27c69544e374df857a40902e74e39532f226005543eabacb551e277082", + "https://deno.land/std@0.129.0/async/tee.ts": "1341feb1f5b1a96f8628d0f8fc07d8c43d3813423f18a63bf1b4785568d21b1f", + "https://deno.land/std@0.129.0/bytes/bytes_list.ts": "67eb118e0b7891d2f389dad4add35856f4ad5faab46318ff99653456c23b025d", + "https://deno.land/std@0.129.0/bytes/equals.ts": "fc16dff2090cced02497f16483de123dfa91e591029f985029193dfaa9d894c9", + "https://deno.land/std@0.129.0/bytes/mod.ts": "d3b455c0dbd4804644159d1e25946ade5ee385d2359894de49e2c6101b18b7a9", + "https://deno.land/std@0.129.0/encoding/base64.ts": "c8c16b4adaa60d7a8eee047c73ece26844435e8f7f1328d74593dbb2dd58ea4f", + "https://deno.land/std@0.129.0/encoding/base64url.ts": "55f9d13df02efac10c6f96169daa3e702606a64e8aa27c0295f645f198c27130", + "https://deno.land/std@0.129.0/fmt/colors.ts": "30455035d6d728394781c10755351742dd731e3db6771b1843f9b9e490104d37", + "https://deno.land/std@0.129.0/fmt/printf.ts": "e2c0f72146aed1efecf0c39ab928b26ae493a2278f670a871a0fbdcf36ff3379", + "https://deno.land/std@0.129.0/fs/_util.ts": "0fb24eb4bfebc2c194fb1afdb42b9c3dda12e368f43e8f2321f84fc77d42cb0f", + "https://deno.land/std@0.129.0/fs/ensure_dir.ts": "9dc109c27df4098b9fc12d949612ae5c9c7169507660dcf9ad90631833209d9d", + "https://deno.land/std@0.129.0/fs/ensure_file.ts": "7d353e64fee3d4d1e7c6b6726a2a5e987ba402c15fb49566309042887349c545", + "https://deno.land/std@0.129.0/io/buffer.ts": "bd0c4bf53db4b4be916ca5963e454bddfd3fcd45039041ea161dbf826817822b", + "https://deno.land/std@0.129.0/io/files.ts": "d199ef64e918a256320ba8d8d44ae91de87c9077df8f8d6cca013f1b9fbbe285", + "https://deno.land/std@0.129.0/io/readers.ts": "679471f3b9929b54393c9cd75b6bd178b4bc6d9aab5c0f1f9538f862cf4746fe", + "https://deno.land/std@0.129.0/io/util.ts": "078da53bba767bec0d45f7da44411f6dbf269e51ef7fcfea5e3714e04681c674", + "https://deno.land/std@0.129.0/node/_buffer.mjs": "f4a7df481d4eed06dc0151b833177d8ef74fc3a96dd4d2b073e690b6ced9474d", + "https://deno.land/std@0.129.0/node/_core.ts": "568d277be2e086af996cbdd599fec569f5280e9a494335ca23ad392b130d7bb9", + "https://deno.land/std@0.129.0/node/_events.mjs": "c0e3e0e290a8b81fee9d2973a529c8dcd5ebb4406782d1f91085274e2cb8490f", + "https://deno.land/std@0.129.0/node/_fixed_queue.ts": "455b3c484de48e810b13bdf95cd1658ecb1ba6bcb8b9315ffe994efcde3ba5f5", + "https://deno.land/std@0.129.0/node/_next_tick.ts": "64c361f6bca21df2a72dd77b84bd49d80d97a694dd3080703bc78f52146351d1", + "https://deno.land/std@0.129.0/node/_process/exiting.ts": "bc9694769139ffc596f962087155a8bfef10101d03423b9dcbc51ce6e1f88fce", + "https://deno.land/std@0.129.0/node/_util/_util_callbackify.ts": "79928ad80df3e469f7dcdb198118a7436d18a9f6c08bd7a4382332ad25a718cf", + "https://deno.land/std@0.129.0/node/_utils.ts": "c2c352e83c4c96f5ff994b1c8246bff2abcb21bfc3f1c06162cb3af1d201e615", + "https://deno.land/std@0.129.0/node/buffer.ts": "fbecbf3f237fa49bec96e97ecf56a7b92d48037b3d11219288e68943cc921600", + "https://deno.land/std@0.129.0/node/events.ts": "a1d40fc0dbccc944379ef968b80ea08f9fce579e88b5057fdb64e4f0812476dd", + "https://deno.land/std@0.129.0/node/internal/buffer.mjs": "6662fe7fe517329453545be34cea27a24f8ccd6d09afd4f609f11ade2b6dfca7", + "https://deno.land/std@0.129.0/node/internal/crypto/keys.ts": "16ce7b15a9fc5e4e3dee8fde75dae12f3d722558d5a1a6e65a9b4f86d64a21e9", + "https://deno.land/std@0.129.0/node/internal/crypto/util.mjs": "1de55a47fdbed6721b467a77ba48fdd1550c10b5eee77bbdb602eaffee365a5e", + "https://deno.land/std@0.129.0/node/internal/error_codes.ts": "ac03c4eae33de3a69d6c98e8678003207eecf75a6900eb847e3fea3c8c9e6d8f", + "https://deno.land/std@0.129.0/node/internal/errors.ts": "0d3a1eb03b654beb29b8354759a6902f45a840d4f957e9a3c632a24ce4c32632", + "https://deno.land/std@0.129.0/node/internal/hide_stack_frames.ts": "a91962ec84610bc7ec86022c4593cdf688156a5910c07b5bcd71994225c13a03", + "https://deno.land/std@0.129.0/node/internal/normalize_encoding.mjs": "3779ec8a7adf5d963b0224f9b85d1bc974a2ec2db0e858396b5d3c2c92138a0a", + "https://deno.land/std@0.129.0/node/internal/util.mjs": "684653b962fae84fd2bc08997291b1a50bed09b95dcfa7d35e3c4143163e879a", + "https://deno.land/std@0.129.0/node/internal/util/comparisons.ts": "680b55fe8bdf1613633bc469fa0440f43162c76dbe36af9aa2966310e1bb9f6e", + "https://deno.land/std@0.129.0/node/internal/util/debuglog.ts": "99e91bdf26f6c67861031f684817e1705a5bc300e81346585b396f413387edfb", + "https://deno.land/std@0.129.0/node/internal/util/inspect.mjs": "d1c2569c66a3dab45eec03208f22ad4351482527859c0011a28a6c797288a0aa", + "https://deno.land/std@0.129.0/node/internal/util/types.ts": "b2dacb8f1f5d28a51c4da5c5b75172b7fcf694073ce95ca141323657e18b0c60", + "https://deno.land/std@0.129.0/node/internal/validators.mjs": "a7e82eafb7deb85c332d5f8d9ffef052f46a42d4a121eada4a54232451acc49a", + "https://deno.land/std@0.129.0/node/internal_binding/_libuv_winerror.ts": "801e05c2742ae6cd42a5f0fd555a255a7308a65732551e962e5345f55eedc519", + "https://deno.land/std@0.129.0/node/internal_binding/_node.ts": "e4075ba8a37aef4eb5b592c8e3807c39cb49ca8653faf8e01a43421938076c1b", + "https://deno.land/std@0.129.0/node/internal_binding/_utils.ts": "1c50883b5751a9ea1b38951e62ed63bacfdc9d69ea665292edfa28e1b1c5bd94", + "https://deno.land/std@0.129.0/node/internal_binding/_winerror.ts": "8811d4be66f918c165370b619259c1f35e8c3e458b8539db64c704fbde0a7cd2", + "https://deno.land/std@0.129.0/node/internal_binding/buffer.ts": "722c62b85f966e0777b2d98c021b60e75d7f2c2dabc43413ef37d60dbd13a5d9", + "https://deno.land/std@0.129.0/node/internal_binding/constants.ts": "aff06aac49eda4234bd3a2b0b8e1fbfc67824e281c532ff9960831ab503014cc", + "https://deno.land/std@0.129.0/node/internal_binding/string_decoder.ts": "5cb1863763d1e9b458bc21d6f976f16d9c18b3b3f57eaf0ade120aee38fba227", + "https://deno.land/std@0.129.0/node/internal_binding/types.ts": "4c26fb74ba2e45de553c15014c916df6789529a93171e450d5afb016b4c765e7", + "https://deno.land/std@0.129.0/node/internal_binding/util.ts": "90364292e2bd598ab5d105b48ca49817b6708f2d1d9cbaf08b2b3ab5ca4c90a7", + "https://deno.land/std@0.129.0/node/internal_binding/uv.ts": "3821bc5e676d6955d68f581988c961d77dd28190aba5a9c59f16001a4deb34ba", + "https://deno.land/std@0.129.0/node/util.ts": "7fd6933b37af89a8e64d73dc6ee1732455a59e7e6d0965311fbd73cd634ea630", + "https://deno.land/std@0.129.0/node/util/types.mjs": "f9288198cacd374b41bae7e92a23179d3160f4c0eaf14e19be3a4e7057219a60", + "https://deno.land/std@0.129.0/path/_constants.ts": "df1db3ffa6dd6d1252cc9617e5d72165cd2483df90e93833e13580687b6083c3", + "https://deno.land/std@0.129.0/path/_interface.ts": "ee3b431a336b80cf445441109d089b70d87d5e248f4f90ff906820889ecf8d09", + "https://deno.land/std@0.129.0/path/_util.ts": "c1e9686d0164e29f7d880b2158971d805b6e0efc3110d0b3e24e4b8af2190d2b", + "https://deno.land/std@0.129.0/path/common.ts": "bee563630abd2d97f99d83c96c2fa0cca7cee103e8cb4e7699ec4d5db7bd2633", + "https://deno.land/std@0.129.0/path/glob.ts": "cb5255638de1048973c3e69e420c77dc04f75755524cb3b2e160fe9277d939ee", + "https://deno.land/std@0.129.0/path/mod.ts": "4275129bb766f0e475ecc5246aa35689eeade419d72a48355203f31802640be7", + "https://deno.land/std@0.129.0/path/posix.ts": "663e4a6fe30a145f56aa41a22d95114c4c5582d8b57d2d7c9ed27ad2c47636bb", + "https://deno.land/std@0.129.0/path/separator.ts": "fe1816cb765a8068afb3e8f13ad272351c85cbc739af56dacfc7d93d710fe0f9", + "https://deno.land/std@0.129.0/path/win32.ts": "e7bdf63e8d9982b4d8a01ef5689425c93310ece950e517476e22af10f41a136e", + "https://deno.land/std@0.129.0/streams/conversion.ts": "712585bfa0172a97fb68dd46e784ae8ad59d11b88079d6a4ab098ff42e697d21", + "https://deno.land/std@0.129.0/testing/_diff.ts": "9d849cd6877694152e01775b2d93f9d6b7aef7e24bfe3bfafc4d7a1ac8e9f392", + "https://deno.land/std@0.129.0/testing/asserts.ts": "0a95d9e8076dd3e7f0eeb605a67c148078b4b11f4abcd5eef115b0361b0736a2", + "https://deno.land/std@0.133.0/_deno_unstable.ts": "23a1a36928f1b6d3b0170aaa67de09af12aa998525f608ff7331b9fb364cbde6", + "https://deno.land/std@0.133.0/_util/assert.ts": "e94f2eb37cebd7f199952e242c77654e43333c1ac4c5c700e929ea3aa5489f74", + "https://deno.land/std@0.133.0/_util/os.ts": "49b92edea1e82ba295ec946de8ffd956ed123e2948d9bd1d3e901b04e4307617", + "https://deno.land/std@0.133.0/fs/_util.ts": "0fb24eb4bfebc2c194fb1afdb42b9c3dda12e368f43e8f2321f84fc77d42cb0f", + "https://deno.land/std@0.133.0/fs/copy.ts": "9248d1492599957af8c693ceb10a432b09f0b0b61c60a4d6aff29b0c7d3a17b3", + "https://deno.land/std@0.133.0/fs/empty_dir.ts": "7274d87160de34cbed0531e284df383045cf43543bbeadeb97feac598bd8f3c5", + "https://deno.land/std@0.133.0/fs/ensure_dir.ts": "9dc109c27df4098b9fc12d949612ae5c9c7169507660dcf9ad90631833209d9d", + "https://deno.land/std@0.133.0/fs/ensure_file.ts": "7d353e64fee3d4d1e7c6b6726a2a5e987ba402c15fb49566309042887349c545", + "https://deno.land/std@0.133.0/fs/ensure_link.ts": "489e23df9fe3e6636048b5830ddf0f111eb29621eb85719255ad9bd645f3471b", + "https://deno.land/std@0.133.0/fs/ensure_symlink.ts": "88dc83de1bc90ed883dd458c2d2eae3d5834a4617d12925734836e1f0803b274", + "https://deno.land/std@0.133.0/fs/eol.ts": "b92f0b88036de507e7e6fbedbe8f666835ea9dcbf5ac85917fa1fadc919f83a5", + "https://deno.land/std@0.133.0/fs/exists.ts": "cb734d872f8554ea40b8bff77ad33d4143c1187eac621a55bf37781a43c56f6d", + "https://deno.land/std@0.133.0/fs/expand_glob.ts": "0c10130d67c9b02164b03df8e43c6d6defbf8e395cb69d09e84a8586e6d72ac3", + "https://deno.land/std@0.133.0/fs/mod.ts": "4dc052c461c171abb5c25f6e0f218ab838a716230930b534ba351745864b7d6d", + "https://deno.land/std@0.133.0/fs/move.ts": "0573cedcf583f09a9494f2dfccbf67de68a93629942d6b5e6e74a9e45d4e8a2e", + "https://deno.land/std@0.133.0/fs/walk.ts": "117403ccd21fd322febe56ba06053b1ad5064c802170f19b1ea43214088fe95f", + "https://deno.land/std@0.133.0/path/_constants.ts": "df1db3ffa6dd6d1252cc9617e5d72165cd2483df90e93833e13580687b6083c3", + "https://deno.land/std@0.133.0/path/_interface.ts": "ee3b431a336b80cf445441109d089b70d87d5e248f4f90ff906820889ecf8d09", + "https://deno.land/std@0.133.0/path/_util.ts": "c1e9686d0164e29f7d880b2158971d805b6e0efc3110d0b3e24e4b8af2190d2b", + "https://deno.land/std@0.133.0/path/common.ts": "bee563630abd2d97f99d83c96c2fa0cca7cee103e8cb4e7699ec4d5db7bd2633", + "https://deno.land/std@0.133.0/path/glob.ts": "cb5255638de1048973c3e69e420c77dc04f75755524cb3b2e160fe9277d939ee", + "https://deno.land/std@0.133.0/path/mod.ts": "4275129bb766f0e475ecc5246aa35689eeade419d72a48355203f31802640be7", + "https://deno.land/std@0.133.0/path/posix.ts": "663e4a6fe30a145f56aa41a22d95114c4c5582d8b57d2d7c9ed27ad2c47636bb", + "https://deno.land/std@0.133.0/path/separator.ts": "fe1816cb765a8068afb3e8f13ad272351c85cbc739af56dacfc7d93d710fe0f9", + "https://deno.land/std@0.133.0/path/win32.ts": "e7bdf63e8d9982b4d8a01ef5689425c93310ece950e517476e22af10f41a136e", "https://deno.land/std@0.196.0/assert/assert.ts": "9a97dad6d98c238938e7540736b826440ad8c1c1e54430ca4c4e623e585607ee", "https://deno.land/std@0.196.0/assert/assertion_error.ts": "4d0bde9b374dfbcbe8ac23f54f567b77024fb67dbb1906a852d67fe050d42f56", "https://deno.land/std@0.196.0/console/_data.json": "cf2cc9d039a192b3adbfe64627167c7e6212704c888c25c769fc8f1709e1e1b8", @@ -240,6 +338,33 @@ "https://deno.land/x/cliffy@v1.0.0-rc.3/table/deps.ts": "1226c4d39d53edc81d7c3e661fb8a79f2e704937c276c60355cd4947a0fe9153", "https://deno.land/x/cliffy@v1.0.0-rc.3/table/row.ts": "79eb1468aafdd951e5963898cdafe0752d4ab4c519d5f847f3d8ecb8fe857d4f", "https://deno.land/x/cliffy@v1.0.0-rc.3/table/table.ts": "298671e72e61f1ab18b42ae36643181993f79e29b39dc411fdc6ffd53aa04684", + "https://deno.land/x/compress@v0.4.5/deps.ts": "096395daebc7ed8a18f0484e4ffcc3a7f70e50946735f7df9611a7fcfd8272cc", + "https://deno.land/x/compress@v0.4.5/gzip/gzip.ts": "4bf22e9cd3368332928324dd9443ef72cabd05e9234e5a37dd7b3517d50e945e", + "https://deno.land/x/compress@v0.4.5/gzip/gzip_file.ts": "b044ec0df4266c084baa033a4ab5394882e44a86d09d5616636467dcb39c671d", + "https://deno.land/x/compress@v0.4.5/gzip/gzip_stream.ts": "6781cf0e47648e3e5631cba4cc2cd018a24935ce09fdaa86e0cabcf78b5012df", + "https://deno.land/x/compress@v0.4.5/gzip/mod.ts": "4ade8edbe01b54a84f289351e137ebdfc040a74cd616636770cf1724fbf522d1", + "https://deno.land/x/compress@v0.4.5/gzip/writer_gunzip.ts": "5aba34394820b835c414048ac2e15f52d443f1f773ebe61fd2517c938572d616", + "https://deno.land/x/compress@v0.4.5/gzip/writer_gzip.ts": "c7aad0c51ab4f5952c068088186339cfc79a2ee1e057d6e16731b1175f342645", + "https://deno.land/x/compress@v0.4.5/interface.ts": "fc5f87bd208ab8a03a1f65972b11781967c3d21c3d756fe9ae99ca98e10e5780", + "https://deno.land/x/compress@v0.4.5/mod.ts": "ae8b15826334021583a5bd1978c63840f85156ea3635f5941bfc6733aad247e5", + "https://deno.land/x/compress@v0.4.5/tar/mod.ts": "6d9073005e678479908047cbe9e4716e484f80d1f2a1e15d3d6ac92213ffaeba", + "https://deno.land/x/compress@v0.4.5/tgz/mod.ts": "2fd4e99f26b57b0055d4d2f87721682304541ed1ca41bbb49c034d121f936f00", + "https://deno.land/x/compress@v0.4.5/utils/uint8.ts": "9c82e09c065f1f4bc648e3b14df441b43a7960fc7bdb29e9fb8d3a69c7e9d425", + "https://deno.land/x/compress@v0.4.5/zlib/deflate.ts": "e1e3b406dcc3e20021e53cde427b4b9ced752b72df820de73fec17c6e5ba999e", + "https://deno.land/x/compress@v0.4.5/zlib/inflate.ts": "618cc3dd25d202bf6b89d92f3ab2865e7495884cafce950638c77cbc1537aeb1", + "https://deno.land/x/compress@v0.4.5/zlib/mod.ts": "4dca9c1e934b7ab27f31c318abd7bfd39b09be96fd76ba27bd46f3a4e73b4ad0", + "https://deno.land/x/compress@v0.4.5/zlib/zlib/adler32.ts": "e34c7596d63a655755c4b0a44a40d4f9c1d1c4d3b891e5c1f3f840f8939e1940", + "https://deno.land/x/compress@v0.4.5/zlib/zlib/crc32.ts": "b9bc4adaf327d32585205d1176bd52f6453c06dd1040544611d4c869e638119c", + "https://deno.land/x/compress@v0.4.5/zlib/zlib/deflate.ts": "8d1dd88630279313e50deed4fe5feefe8128307cc48fa560e659b5234ab09d83", + "https://deno.land/x/compress@v0.4.5/zlib/zlib/gzheader.ts": "11e6da7383447aae9791308dc2350a809fa341a876a2da396b03a2a31408c20c", + "https://deno.land/x/compress@v0.4.5/zlib/zlib/inffast.ts": "282daf5ea16bb876d26e342f3c24fe1a8ec84640e713a970b02232955a853f86", + "https://deno.land/x/compress@v0.4.5/zlib/zlib/inflate.ts": "76751c1a5b18d70a929fa31ce4959db0bde1b9097bfa1b5ea3b4d1fba2ab92fa", + "https://deno.land/x/compress@v0.4.5/zlib/zlib/inftrees.ts": "8a6d765a5c42bf3b6990060cabbe52e88493f8ce6d082e6e35d97756914cfb8e", + "https://deno.land/x/compress@v0.4.5/zlib/zlib/messages.ts": "c82229bd67ccc3b6162f3aca1c5e7f936e546aa91ac9a9ac4fcfefc3a9dc5ac8", + "https://deno.land/x/compress@v0.4.5/zlib/zlib/status.ts": "5987864d2d43d59bbbfa2e6ef4d5a07284c1d10489cc5843ddf41ac547957ac3", + "https://deno.land/x/compress@v0.4.5/zlib/zlib/trees.ts": "6b65a767646e031e87e7b725ffad0c511fe701f393a01652e1e7ee8884f60fee", + "https://deno.land/x/compress@v0.4.5/zlib/zlib/zstream.ts": "c110fd5919235e317d64933852e24a1bba0126202be592e90e58f7b19315ad93", + "https://deno.land/x/crc32@v0.2.0/mod.ts": "de7a3fa2d4ef24b96fc21e1cc4d2d65d1d2b1dcea92f63960e3e11bfa82df0fa", "https://deno.land/x/denocker@v0.2.1/container.ts": "b13512efec6ec20655ddd263732f1386ac05b72926f9a45e9142b2200ff71275", "https://deno.land/x/denocker@v0.2.1/index.ts": "c9f67e6ce29d7d6cc0516c1d0aedc4b927d66338a75226020e9a5670b8167452", "https://deno.land/x/denocker@v0.2.1/lib/client/auth.ts": "dc672975a3356bc9e95e29106e6526cb27791daf7be340a1af55a85f4fd44897", @@ -396,6 +521,11 @@ "https://deno.land/x/monads@v0.5.10/mod.ts": "f1b16a34d47e58fdf9f1f54c49d2fe6df67b3d2e077e21638f25fbe080eee6cf", "https://deno.land/x/monads@v0.5.10/option/option.ts": "76ef03c3370207112759f932f39aab04999cdd1a5c5a954769b3868602faf883", "https://deno.land/x/monads@v0.5.10/result/result.ts": "bb482b7b90949d3a67e78b4b0dd949774eccaa808df39ac83f6a585526edeb37", + "https://deno.land/x/zip@v1.2.5/compress.ts": "43d9f4440960d15a85aec58f5d365acc25530d3d4186b2f5f896c090ecac20e8", + "https://deno.land/x/zip@v1.2.5/decompress.ts": "0bce3d453726f686274fab3f6c19b72b5e74223a00d89c176b1de49a5dd5528d", + "https://deno.land/x/zip@v1.2.5/deps.ts": "79548387594b3ae1efaaa870b5a507c4d6bedede13dbd5d4ad42f6cda0aeef86", + "https://deno.land/x/zip@v1.2.5/mod.ts": "28eecbc3e1e5adf564f4aa465e64268713a05653104bacdcb04561533f8caf57", + "https://deno.land/x/zip@v1.2.5/utils.ts": "43c323f2b79f9db1976c5739bbb1f9cced20e8077ca7e7e703f9d01d4330bd9d", "https://deno.land/x/zod@v3.22.4/ZodError.ts": "4de18ff525e75a0315f2c12066b77b5c2ae18c7c15ef7df7e165d63536fdf2ea", "https://deno.land/x/zod@v3.22.4/errors.ts": "5285922d2be9700cc0c70c95e4858952b07ae193aa0224be3cbd5cd5567eabef", "https://deno.land/x/zod@v3.22.4/external.ts": "a6cfbd61e9e097d5f42f8a7ed6f92f93f51ff927d29c9fbaec04f03cbce130fe", diff --git a/deps/plug.ts b/deps/plug.ts index d61da08f..c52ebfc1 100644 --- a/deps/plug.ts +++ b/deps/plug.ts @@ -1,3 +1,5 @@ //! This contains dependencies used by plugins export * from "./common.ts"; +export * as compress from "https://deno.land/x/compress@v0.4.5/mod.ts"; +export * as zip from "https://deno.land/x/zip@v1.2.5/mod.ts"; diff --git a/ghjk.ts b/ghjk.ts index 48747f7a..2c5e1096 100644 --- a/ghjk.ts +++ b/ghjk.ts @@ -33,4 +33,4 @@ import whiz from "./plugs/whiz.ts"; // protoc({}); // earthly({}); // ruff({}); -whiz({}); +// whiz({}); diff --git a/plug.ts b/plug.ts index 2e2a30a8..069bc732 100644 --- a/plug.ts +++ b/plug.ts @@ -13,7 +13,7 @@ import { registerPlug, validators, } from "./core/mod.ts"; -import { log, std_fs, std_path, std_url } from "./deps/plug.ts"; +import { compress, log, std_fs, std_path, std_url, zip } from "./deps/plug.ts"; import { initDenoWorkerPlug, isWorker } from "./core/worker.ts"; import * as asdf from "./core/asdf.ts"; import logger from "./core/logger.ts"; @@ -161,4 +161,27 @@ export async function downloadFile( ); } +/// Uses file extension to determine type +export async function unarchive( + path: string, + dest = "./", + ext = std_path.extname(path), +) { + switch (ext) { + case ".gz": + case ".tar.gz": + case ".tgz": + await compress.tgz.uncompress(path, dest); + break; + case ".tar": + await compress.tar.uncompress(path, dest); + break; + case ".zip": + await zip.decompress(path, dest); + break; + default: + throw Error("unsupported archive extension: ${ext}"); + } +} + export const removeFile = Deno.remove; diff --git a/plugs/act.ts b/plugs/act.ts index becc53cf..e1308d09 100644 --- a/plugs/act.ts +++ b/plugs/act.ts @@ -1,6 +1,5 @@ import { addInstallGlobal, - depBinShimPath, DownloadArgs, downloadFile, InstallArgs, @@ -9,20 +8,16 @@ import { PlugBase, registerDenoPlugGlobal, removeFile, - spawn, std_fs, std_path, std_url, + unarchive, } from "../plug.ts"; -import * as std_plugs from "../std.ts"; const manifest = { name: "act@ghrel", version: "0.1.0", moduleSpecifier: import.meta.url, - deps: [ - std_plugs.tar_aa, - ], }; registerDenoPlugGlobal(manifest, () => new Plug()); @@ -80,12 +75,7 @@ export class Plug extends PlugBase { ); const fileDwnPath = std_path.resolve(args.downloadPath, fileName); - await spawn([ - depBinShimPath(std_plugs.tar_aa, "tar", args.depShims), - "xf", - fileDwnPath, - `--directory=${args.tmpDirPath}`, - ]); + await unarchive(fileDwnPath, args.tmpDirPath); if (await std_fs.exists(args.installPath)) { await removeFile(args.installPath, { recursive: true }); diff --git a/plugs/cargo-binstall.ts b/plugs/cargo-binstall.ts index aa56322b..81b58eef 100644 --- a/plugs/cargo-binstall.ts +++ b/plugs/cargo-binstall.ts @@ -1,6 +1,5 @@ import { addInstallGlobal, - depBinShimPath, DownloadArgs, downloadFile, InstallArgs, @@ -9,24 +8,16 @@ import { PlugBase, registerDenoPlugGlobal, removeFile, - spawn, std_fs, std_path, std_url, + unarchive, } from "../plug.ts"; -// FIXME: find a better way to expose std_plug.plug_Id -// that allows standard plugs to depend on each other -// import * as std_plugs from "../std.ts"; - -const tar_aa_id = { - id: "tar@aa", -}; export const manifest = { name: "cargo-binstall@ghrel", version: "0.1.0", moduleSpecifier: import.meta.url, - deps: [tar_aa_id], }; registerDenoPlugGlobal(manifest, () => new Plug()); @@ -38,15 +29,13 @@ export default function install(config: InstallConfigBase = {}) { }); } -const repoAddress = "https://github.com/cargo-bins/cargo-binstall"; +const repoOwner = "cargo-bins"; +const repoName = "cargo-binstall"; +const repoAddress = `https://github.com/${repoOwner}/${repoName}`; export class Plug extends PlugBase { manifest = manifest; - listBinPaths(): string[] { - return ["cargo-binstall", "detect-targets", "detect-wasi"]; - } - async listAll() { const metadataRequest = await fetch( `https://index.crates.io/ca/rg/cargo-binstall`, @@ -73,20 +62,14 @@ export class Plug extends PlugBase { ); const fileDwnPath = std_path.resolve(args.downloadPath, fileName); - await spawn([ - depBinShimPath(tar_aa_id, "tar", args.depShims), - "xf", - fileDwnPath, - `--directory=${args.tmpDirPath}`, - ]); + await unarchive(fileDwnPath, args.tmpDirPath); if (await std_fs.exists(args.installPath)) { await removeFile(args.installPath, { recursive: true }); } - await std_fs.copy( args.tmpDirPath, - args.installPath, + std_path.resolve(args.installPath, "bin"), ); } } @@ -105,12 +88,12 @@ function downloadUrl(installVersion: string, platform: PlatformInfo) { } if (platform.os == "darwin") { // NOTE: the archive file name extensions are different from os to os - return `${repoAddress}/releases/download/v${installVersion}/cargo-binstall-${arch}-apple-darwin.full.zip`; + return `${repoAddress}/releases/download/v${installVersion}/${repoName}-${arch}-apple-darwin.full.zip`; } else if (platform.os == "linux") { // TODO: support for ubuntu/debian versions // we'll need a way to expose that to plugs const os = "unknown-linux-musl"; - return `${repoAddress}/releases/download/v${installVersion}/cargo-binstall-${arch}-${os}.full.tgz`; + return `${repoAddress}/releases/download/v${installVersion}/${repoName}-${arch}-${os}.full.tgz`; } else { throw new Error(`unsupported os: ${platform.os}`); } diff --git a/plugs/jco.ts b/plugs/jco.ts index 57d79fde..b0234408 100644 --- a/plugs/jco.ts +++ b/plugs/jco.ts @@ -15,6 +15,7 @@ import { std_fs, std_path, std_url, + unarchive, } from "../plug.ts"; import node from "./node.ts"; import * as std_plugs from "../std.ts"; @@ -24,7 +25,6 @@ const manifest = { version: "0.1.0", moduleSpecifier: import.meta.url, deps: [ - std_plugs.tar_aa, std_plugs.node_org, ], }; @@ -73,12 +73,7 @@ class Plug extends PlugBase { ); const fileDwnPath = std_path.resolve(args.downloadPath, fileName); - await spawn([ - depBinShimPath(std_plugs.tar_aa, "tar", args.depShims), - "xf", - fileDwnPath, - `--directory=${args.tmpDirPath}`, - ]); + await unarchive(fileDwnPath, args.tmpDirPath); if (await std_fs.exists(args.installPath)) { await removeFile(args.installPath, { recursive: true }); diff --git a/plugs/mold.ts b/plugs/mold.ts index 525d264e..1e7ec983 100644 --- a/plugs/mold.ts +++ b/plugs/mold.ts @@ -1,6 +1,5 @@ import { addInstallGlobal, - depBinShimPath, DownloadArgs, downloadFile, InstallArgs, @@ -9,20 +8,16 @@ import { PlugBase, registerDenoPlugGlobal, removeFile, - spawn, std_fs, std_path, std_url, + unarchive, } from "../plug.ts"; -import * as std_plugs from "../std.ts"; const manifest = { name: "mold@ghrel", version: "0.1.0", moduleSpecifier: import.meta.url, - deps: [ - std_plugs.tar_aa, - ], }; registerDenoPlugGlobal(manifest, () => new Plug()); @@ -75,12 +70,7 @@ export class Plug extends PlugBase { ); const fileDwnPath = std_path.resolve(args.downloadPath, fileName); - await spawn([ - depBinShimPath(std_plugs.tar_aa, "tar", args.depShims), - "xf", - fileDwnPath, - `--directory=${args.tmpDirPath}`, - ]); + await unarchive(fileDwnPath args.tmpDirPath) if (await std_fs.exists(args.installPath)) { await removeFile(args.installPath, { recursive: true }); @@ -118,9 +108,8 @@ function downloadUrl(installVersion: string, platform: PlatformInfo) { default: throw new Error(`unsupported arch: ${platform.arch}`); } - return `${repoAddress}/releases/download/${installVersion}/${repoName}-${ - installVersion.startsWith("v") ? installVersion.slice(1) : installVersion - }-${arch}-${os}.tar.gz`; + return `${repoAddress}/releases/download/${installVersion}/${repoName}-${installVersion.startsWith("v") ? installVersion.slice(1) : installVersion + }-${arch}-${os}.tar.gz`; } else { throw new Error(`unsupported os: ${platform.os}`); } diff --git a/plugs/node.ts b/plugs/node.ts index d5c51fa4..43ec5310 100644 --- a/plugs/node.ts +++ b/plugs/node.ts @@ -1,6 +1,5 @@ import { addInstallGlobal, - depBinShimPath, DownloadArgs, downloadFile, ExecEnvArgs, @@ -11,25 +10,17 @@ import { PlugBase, registerDenoPlugGlobal, removeFile, - spawn, std_fs, std_path, std_url, + unarchive, } from "../plug.ts"; -// import * as std_plugs from "../std.ts"; - -const tar_aa_id = { - id: "tar@aa", -}; // TODO: sanity check exports of all plugs export const manifest = { name: "node@org", version: "0.1.0", moduleSpecifier: import.meta.url, - deps: [ - tar_aa_id, - ], }; registerDenoPlugGlobal(manifest, () => new Plug()); @@ -77,12 +68,7 @@ export class Plug extends PlugBase { artifactUrl(args.installVersion, args.platform), ); const fileDwnPath = std_path.resolve(args.downloadPath, fileName); - await spawn([ - depBinShimPath(tar_aa_id, "tar", args.depShims), - "xf", - fileDwnPath, - `--directory=${args.tmpDirPath}`, - ]); + await unarchive(fileDwnPath, args.tmpDirPath); if (await std_fs.exists(args.installPath)) { await removeFile(args.installPath, { recursive: true }); diff --git a/plugs/protoc.ts b/plugs/protoc.ts index 238c9950..726bd8be 100644 --- a/plugs/protoc.ts +++ b/plugs/protoc.ts @@ -1,6 +1,5 @@ import { addInstallGlobal, - depBinShimPath, DownloadArgs, downloadFile, InstallArgs, @@ -9,20 +8,16 @@ import { PlugBase, registerDenoPlugGlobal, removeFile, - spawn, std_fs, std_path, std_url, + unarchive, } from "../plug.ts"; -import * as std_plugs from "../std.ts"; const manifest = { name: "protoc@ghrel", version: "0.1.0", moduleSpecifier: import.meta.url, - deps: [ - std_plugs.unzip_aa, - ], }; registerDenoPlugGlobal(manifest, () => new Plug()); @@ -75,12 +70,7 @@ export class Plug extends PlugBase { ); const fileDwnPath = std_path.resolve(args.downloadPath, fileName); - await spawn([ - depBinShimPath(std_plugs.unzip_aa, "unzip", args.depShims), - fileDwnPath, - "-d", - args.tmpDirPath, - ]); + await unarchive(fileDwnPath, args.tmpDirPath); if (await std_fs.exists(args.installPath)) { await removeFile(args.installPath, { recursive: true }); diff --git a/plugs/ruff.ts b/plugs/ruff.ts index 32b9d2c6..874e592c 100644 --- a/plugs/ruff.ts +++ b/plugs/ruff.ts @@ -13,16 +13,13 @@ import { std_fs, std_path, std_url, + unarchive, } from "../plug.ts"; -import * as std_plugs from "../std.ts"; const manifest = { name: "ruff@ghrel", version: "0.1.0", moduleSpecifier: import.meta.url, - deps: [ - std_plugs.tar_aa, - ], }; registerDenoPlugGlobal(manifest, () => new Plug()); @@ -75,12 +72,7 @@ export class Plug extends PlugBase { ); const fileDwnPath = std_path.resolve(args.downloadPath, fileName); - await spawn([ - depBinShimPath(std_plugs.tar_aa, "tar", args.depShims), - "xf", - fileDwnPath, - `--directory=${args.tmpDirPath}`, - ]); + await unarchive(fileDwnPath, args.tmpDirPath); if (await std_fs.exists(args.installPath)) { await removeFile(args.installPath, { recursive: true }); diff --git a/plugs/wasmedge.ts b/plugs/wasmedge.ts index 778f4de8..97acffaf 100644 --- a/plugs/wasmedge.ts +++ b/plugs/wasmedge.ts @@ -1,6 +1,5 @@ import { addInstallGlobal, - depBinShimPath, DownloadArgs, downloadFile, ExecEnvArgs, @@ -10,20 +9,16 @@ import { PlugBase, registerDenoPlugGlobal, removeFile, - spawn, std_fs, std_path, std_url, + unarchive, } from "../plug.ts"; -import * as std_plugs from "../std.ts"; const manifest = { name: "wasmedge@ghrel", version: "0.1.0", moduleSpecifier: import.meta.url, - deps: [ - std_plugs.tar_aa, - ], }; registerDenoPlugGlobal(manifest, () => new Plug()); @@ -110,12 +105,7 @@ export class Plug extends PlugBase { ); const fileDwnPath = std_path.resolve(args.downloadPath, fileName); - await spawn([ - depBinShimPath(std_plugs.tar_aa, "tar", args.depShims), - "xf", - fileDwnPath, - `--directory=${args.tmpDirPath}`, - ]); + await unarchive(fileDwnPath, args.tmpDirPath); if (await std_fs.exists(args.installPath)) { await removeFile(args.installPath, { recursive: true }); diff --git a/plugs/whiz.ts b/plugs/whiz.ts index 6c04736b..2ea892f8 100644 --- a/plugs/whiz.ts +++ b/plugs/whiz.ts @@ -1,6 +1,5 @@ import { addInstallGlobal, - depBinShimPath, DownloadArgs, downloadFile, InstallArgs, @@ -9,20 +8,16 @@ import { PlugBase, registerDenoPlugGlobal, removeFile, - spawn, std_fs, std_path, std_url, + unarchive, } from "../plug.ts"; -import * as std_plugs from "../std.ts"; const manifest = { name: "whiz@ghrel", version: "0.1.0", moduleSpecifier: import.meta.url, - deps: [ - std_plugs.tar_aa, - ], }; registerDenoPlugGlobal(manifest, () => new Plug()); @@ -75,12 +70,7 @@ export class Plug extends PlugBase { ); const fileDwnPath = std_path.resolve(args.downloadPath, fileName); - await spawn([ - depBinShimPath(std_plugs.tar_aa, "tar", args.depShims), - "xf", - fileDwnPath, - `--directory=${args.tmpDirPath}`, - ]); + await unarchive(fileDwnPath, args.tmpDirPath); if (await std_fs.exists(args.installPath)) { await removeFile(args.installPath, { recursive: true }); diff --git a/tests/e2e.ts b/tests/e2e.ts index 78236dc3..3f284bf4 100644 --- a/tests/e2e.ts +++ b/tests/e2e.ts @@ -193,7 +193,7 @@ await dockerTest([ }`, ePoint: `pnpm --version`, }, - // pnpm + more megs + // node + more megs { name: "jco", imports: `import plug from "$ghjk/plugs/jco.ts"`, diff --git a/tests/test.Dockerfile b/tests/test.Dockerfile index e6c37742..b05529c3 100644 --- a/tests/test.Dockerfile +++ b/tests/test.Dockerfile @@ -4,7 +4,8 @@ RUN set -eux; \ export DEBIAN_FRONTEND=noninteractive; \ apt update; \ apt install --yes \ - git curl xz-utils unzip \ + # asdf deps + git curl \ ;\ apt clean autoclean; apt autoremove --yes; rm -rf /var/lib/{apt,dpkg,cache,log}/;