Add import_map.json and use it for remote script execution

This commit is contained in:
Karolis2011 2025-11-29 23:28:40 +02:00
parent df5df0ea92
commit 8ae1d52f8c
2 changed files with 15 additions and 1 deletions

7
import_map.json Normal file
View file

@ -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"
}
}

View file

@ -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 ---------------------------------------------------