forked from denoland/deno
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(node): use closest package.json to resolve package.json imports (d…
- Loading branch information
Showing
25 changed files
with
149 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
cli/tests/testdata/npm/imports_package_json/import_not_defined.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import data from "@denotest/imports-package-json/import-not-defined"; | ||
|
||
console.log(data); |
6 changes: 6 additions & 0 deletions
6
cli/tests/testdata/npm/imports_package_json/import_not_defined.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Download http://localhost:4545/npm/registry/@denotest/imports-package-json | ||
Download http://localhost:4545/npm/registry/@denotest/imports-package-json/1.0.0.tgz | ||
error: Could not resolve '#not-defined' from 'file:///[WILDCARD]/@denotest/imports-package-json/1.0.0/import_not_defined.js'. | ||
|
||
Caused by: | ||
[ERR_PACKAGE_IMPORT_NOT_DEFINED] Package import specifier "#not-defined" is not defined in package [WILDCARD]package.json imported from [WILDCARD]import_not_defined.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import data from "@denotest/imports-package-json"; | ||
|
||
console.log(data.hi); | ||
console.log(data.bye); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Download http://localhost:4545/npm/registry/@denotest/imports-package-json | ||
Download http://localhost:4545/npm/registry/@denotest/imports-package-json/1.0.0.tgz | ||
hi | ||
bye |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"name": "my-test", | ||
"dependencies": { | ||
"@denotest/imports-package-json": "1.0.0" | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
cli/tests/testdata/npm/imports_package_json/sub_path_import_not_defined.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import data from "@denotest/imports-package-json/sub-path-import-not-defined"; | ||
|
||
console.log(data); |
6 changes: 6 additions & 0 deletions
6
cli/tests/testdata/npm/imports_package_json/sub_path_import_not_defined.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Download http://localhost:4545/npm/registry/@denotest/imports-package-json | ||
Download http://localhost:4545/npm/registry/@denotest/imports-package-json/1.0.0.tgz | ||
error: Could not resolve '#hi' from 'file:///[WILDCARD]/@denotest/imports-package-json/1.0.0/sub_path/import_not_defined.js'. | ||
|
||
Caused by: | ||
[ERR_PACKAGE_IMPORT_NOT_DEFINED] Package import specifier "#hi" is not defined in package [WILDCARD]sub_path[WILDCARD]package.json imported from [WILDCARD]import_not_defined.js |
1 change: 1 addition & 0 deletions
1
cli/tests/testdata/npm/registry/@denotest/imports-package-json/1.0.0/hi.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export default "hi"; |
3 changes: 3 additions & 0 deletions
3
cli/tests/testdata/npm/registry/@denotest/imports-package-json/1.0.0/import_not_defined.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import notDefined from "#not-defined"; | ||
|
||
export default notDefined; |
7 changes: 7 additions & 0 deletions
7
cli/tests/testdata/npm/registry/@denotest/imports-package-json/1.0.0/main.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import hi from "#hi"; | ||
import bye from "./sub_path/main.js"; | ||
|
||
export default { | ||
hi, | ||
bye, | ||
}; |
16 changes: 16 additions & 0 deletions
16
cli/tests/testdata/npm/registry/@denotest/imports-package-json/1.0.0/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"name": "imports-package-json", | ||
"type": "module", | ||
"version": "1.0.0", | ||
"description": "", | ||
"license": "ISC", | ||
"author": "", | ||
"exports": { | ||
".": "./main.js", | ||
"./import-not-defined": "./import_not_defined.js", | ||
"./sub-path-import-not-defined": "./sub_path/import_not_defined.js" | ||
}, | ||
"imports": { | ||
"#hi": "./hi.js" | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
cli/tests/testdata/npm/registry/@denotest/imports-package-json/1.0.0/sub_path/bye.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export default "bye"; |
4 changes: 4 additions & 0 deletions
4
...testdata/npm/registry/@denotest/imports-package-json/1.0.0/sub_path/import_not_defined.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// this won't be defined in the closest package.json and will fail | ||
import hi from "#hi"; | ||
|
||
export default hi; |
3 changes: 3 additions & 0 deletions
3
cli/tests/testdata/npm/registry/@denotest/imports-package-json/1.0.0/sub_path/main.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import bye from "#bye"; | ||
|
||
export default bye; |
6 changes: 6 additions & 0 deletions
6
cli/tests/testdata/npm/registry/@denotest/imports-package-json/1.0.0/sub_path/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"type": "module", | ||
"imports": { | ||
"#bye": "./bye.js" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.