From 2f651b2d64523bdd377d22b8b7213a04ad82f459 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Tue, 2 May 2023 02:35:33 +0200 Subject: fix(npm): canonicalize filename before returning (#18948) This commit changes how paths for npm packages are handled, by canonicalizing them when resolving. This is done so that instead of returning "node_modules/@/node_modules//index.js" (which is a symlink) we "node_modules/@/index.js. Fixes https://github.com/denoland/deno/issues/18924 Fixes https://github.com/bluwy/create-vite-extra/issues/31 --------- Co-authored-by: David Sherret --- cli/tests/testdata/npm/local_dir_resolves_symlinks/index.js | 3 +++ cli/tests/testdata/npm/local_dir_resolves_symlinks/index.out | 2 ++ cli/tests/testdata/npm/local_dir_resolves_symlinks/package.json | 7 +++++++ 3 files changed, 12 insertions(+) create mode 100644 cli/tests/testdata/npm/local_dir_resolves_symlinks/index.js create mode 100644 cli/tests/testdata/npm/local_dir_resolves_symlinks/index.out create mode 100644 cli/tests/testdata/npm/local_dir_resolves_symlinks/package.json (limited to 'cli/tests/testdata/npm/local_dir_resolves_symlinks') diff --git a/cli/tests/testdata/npm/local_dir_resolves_symlinks/index.js b/cli/tests/testdata/npm/local_dir_resolves_symlinks/index.js new file mode 100644 index 000000000..72d8913f5 --- /dev/null +++ b/cli/tests/testdata/npm/local_dir_resolves_symlinks/index.js @@ -0,0 +1,3 @@ +import * as d from "define-properties"; + +console.log(typeof d.default === "function", "it works"); diff --git a/cli/tests/testdata/npm/local_dir_resolves_symlinks/index.out b/cli/tests/testdata/npm/local_dir_resolves_symlinks/index.out new file mode 100644 index 000000000..25d44c6b8 --- /dev/null +++ b/cli/tests/testdata/npm/local_dir_resolves_symlinks/index.out @@ -0,0 +1,2 @@ +Download [WILDCARD] +true it works diff --git a/cli/tests/testdata/npm/local_dir_resolves_symlinks/package.json b/cli/tests/testdata/npm/local_dir_resolves_symlinks/package.json new file mode 100644 index 000000000..4c974022e --- /dev/null +++ b/cli/tests/testdata/npm/local_dir_resolves_symlinks/package.json @@ -0,0 +1,7 @@ +{ + "name": "foo", + "type": "module", + "dependencies": { + "define-properties": "^1.2.0" + } +} -- cgit v1.2.3