From 8ae1d52f8ca4489223e3ac2b2dae3a6f13ce6ebf Mon Sep 17 00:00:00 2001 From: Karolis2011 Date: Sat, 29 Nov 2025 23:28:40 +0200 Subject: [PATCH] Add import_map.json and use it for remote script execution --- import_map.json | 7 +++++++ loader.ts | 9 ++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 import_map.json diff --git a/import_map.json b/import_map.json new file mode 100644 index 0000000..f927f0e --- /dev/null +++ b/import_map.json @@ -0,0 +1,7 @@ +{ + "imports": { + "@std/cli": "jsr:@std/cli@^1.0.0", + "@std/fs": "jsr:@std/fs@^1.0.0", + "@std/path": "jsr:@std/path@^1.0.0" + } +} diff --git a/loader.ts b/loader.ts index 9215549..d426f7f 100644 --- a/loader.ts +++ b/loader.ts @@ -365,7 +365,14 @@ scripts() { return 127; fi - deno run --allow-all "$url" "$@"; + local import_map_url + if [[ "$ref" == v* ]]; then + import_map_url="${BASE_RAW}/tag/$ref/import_map.json" + else + import_map_url="${BASE_RAW}/branch/$ref/import_map.json" + fi + + deno run --allow-all --import-map="$import_map_url" "$url" "$@"; } # --- Autocompletion ---------------------------------------------------