From 44f8b05f5bf45453496e80c69dc7850aa98c9af8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Wed, 24 Jan 2024 23:44:06 +0100 Subject: feat: Expand 'imports' section of deno.json (#22087) This commit adds automatic expansion of "imports" field in "deno.json" file. If "npm:" or "jsr:" imports are encountered we automatically try to add a "directory" remapping. Previously users had to specify entries for both `foo` and `foo/` to be able to import like `import { symbol1 } from "foo";` and `import { symbol2 } from "foo/some_file.js"`: ``` { "imports": { "foo": "npm:@foo/bar", "foo/": "npm:/@foo/bar/", } ``` With this change users can only add entry for `foo`: ``` { "imports": { "foo": "npm:@foo/bar", } ``` The entry for `foo/` will be provided automatically. Similarly if user provides "directory" remapping explicitly, we will not overwrite it. --- cli/tests/testdata/npm/registry/@denotest/esm-basic/1.0.0/other.mjs | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 cli/tests/testdata/npm/registry/@denotest/esm-basic/1.0.0/other.mjs (limited to 'cli/tests/testdata/npm/registry/@denotest') diff --git a/cli/tests/testdata/npm/registry/@denotest/esm-basic/1.0.0/other.mjs b/cli/tests/testdata/npm/registry/@denotest/esm-basic/1.0.0/other.mjs new file mode 100644 index 000000000..00ed99da4 --- /dev/null +++ b/cli/tests/testdata/npm/registry/@denotest/esm-basic/1.0.0/other.mjs @@ -0,0 +1,3 @@ +export function hello() { + return "hello, world!"; +} \ No newline at end of file -- cgit v1.2.3