diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2024-01-24 23:44:06 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-24 23:44:06 +0100 |
commit | 44f8b05f5bf45453496e80c69dc7850aa98c9af8 (patch) | |
tree | ba31d15374e1b658a444e5727abc7b157a2efc73 /cli/tests/testdata/compile/npm_fs/main.ts | |
parent | 801ed74118baabef49842bbfb2164f971d2cdb03 (diff) |
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.
Diffstat (limited to 'cli/tests/testdata/compile/npm_fs/main.ts')
-rw-r--r-- | cli/tests/testdata/compile/npm_fs/main.ts | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/cli/tests/testdata/compile/npm_fs/main.ts b/cli/tests/testdata/compile/npm_fs/main.ts index f9951d7a4..6361610a9 100644 --- a/cli/tests/testdata/compile/npm_fs/main.ts +++ b/cli/tests/testdata/compile/npm_fs/main.ts @@ -154,7 +154,7 @@ await assert.rejects( } // read dir -const readDirNames = ["main.d.mts", "main.mjs", "package.json"]; +const readDirNames = ["main.d.mts", "main.mjs", "other.mjs", "package.json"]; { const names = Array.from(Deno.readDirSync(dirPath)) .map((e) => e.name); |