diff options
| author | David Sherret <dsherret@users.noreply.github.com> | 2023-11-04 12:41:51 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-11-04 16:41:51 +0000 |
| commit | e4c947dd2b63726ecc9b4303e03921b6839adade (patch) | |
| tree | 9619bdb6649d1f460fb02ab8e448c27c95dbfa74 /cli/tests/testdata/npm/registry/@denotest | |
| parent | 0b75a7169b2e123cac04e7ffcaf16a28eb356fd0 (diff) | |
fix(node): use closest package.json to resolve package.json imports (#21075)
Diffstat (limited to 'cli/tests/testdata/npm/registry/@denotest')
8 files changed, 41 insertions, 0 deletions
diff --git a/cli/tests/testdata/npm/registry/@denotest/imports-package-json/1.0.0/hi.js b/cli/tests/testdata/npm/registry/@denotest/imports-package-json/1.0.0/hi.js new file mode 100644 index 000000000..407090812 --- /dev/null +++ b/cli/tests/testdata/npm/registry/@denotest/imports-package-json/1.0.0/hi.js @@ -0,0 +1 @@ +export default "hi"; diff --git a/cli/tests/testdata/npm/registry/@denotest/imports-package-json/1.0.0/import_not_defined.js b/cli/tests/testdata/npm/registry/@denotest/imports-package-json/1.0.0/import_not_defined.js new file mode 100644 index 000000000..07864fd2c --- /dev/null +++ b/cli/tests/testdata/npm/registry/@denotest/imports-package-json/1.0.0/import_not_defined.js @@ -0,0 +1,3 @@ +import notDefined from "#not-defined"; + +export default notDefined; diff --git a/cli/tests/testdata/npm/registry/@denotest/imports-package-json/1.0.0/main.js b/cli/tests/testdata/npm/registry/@denotest/imports-package-json/1.0.0/main.js new file mode 100644 index 000000000..46625479e --- /dev/null +++ b/cli/tests/testdata/npm/registry/@denotest/imports-package-json/1.0.0/main.js @@ -0,0 +1,7 @@ +import hi from "#hi"; +import bye from "./sub_path/main.js"; + +export default { + hi, + bye, +}; diff --git a/cli/tests/testdata/npm/registry/@denotest/imports-package-json/1.0.0/package.json b/cli/tests/testdata/npm/registry/@denotest/imports-package-json/1.0.0/package.json new file mode 100644 index 000000000..a4fbc8889 --- /dev/null +++ b/cli/tests/testdata/npm/registry/@denotest/imports-package-json/1.0.0/package.json @@ -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" + } +} diff --git a/cli/tests/testdata/npm/registry/@denotest/imports-package-json/1.0.0/sub_path/bye.js b/cli/tests/testdata/npm/registry/@denotest/imports-package-json/1.0.0/sub_path/bye.js new file mode 100644 index 000000000..6fc719e48 --- /dev/null +++ b/cli/tests/testdata/npm/registry/@denotest/imports-package-json/1.0.0/sub_path/bye.js @@ -0,0 +1 @@ +export default "bye"; diff --git a/cli/tests/testdata/npm/registry/@denotest/imports-package-json/1.0.0/sub_path/import_not_defined.js b/cli/tests/testdata/npm/registry/@denotest/imports-package-json/1.0.0/sub_path/import_not_defined.js new file mode 100644 index 000000000..ffaa2b1ad --- /dev/null +++ b/cli/tests/testdata/npm/registry/@denotest/imports-package-json/1.0.0/sub_path/import_not_defined.js @@ -0,0 +1,4 @@ +// this won't be defined in the closest package.json and will fail +import hi from "#hi"; + +export default hi; diff --git a/cli/tests/testdata/npm/registry/@denotest/imports-package-json/1.0.0/sub_path/main.js b/cli/tests/testdata/npm/registry/@denotest/imports-package-json/1.0.0/sub_path/main.js new file mode 100644 index 000000000..260ca79ae --- /dev/null +++ b/cli/tests/testdata/npm/registry/@denotest/imports-package-json/1.0.0/sub_path/main.js @@ -0,0 +1,3 @@ +import bye from "#bye"; + +export default bye; diff --git a/cli/tests/testdata/npm/registry/@denotest/imports-package-json/1.0.0/sub_path/package.json b/cli/tests/testdata/npm/registry/@denotest/imports-package-json/1.0.0/sub_path/package.json new file mode 100644 index 000000000..3f2c2bbd8 --- /dev/null +++ b/cli/tests/testdata/npm/registry/@denotest/imports-package-json/1.0.0/sub_path/package.json @@ -0,0 +1,6 @@ +{ + "type": "module", + "imports": { + "#bye": "./bye.js" + } +} |
