From 576b20aa005c233b95afe6e3692a899ae8f755f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Thu, 28 Dec 2023 20:37:10 +0100 Subject: fix: allow npm: specifiers in import.meta.resolve (#21716) Closes https://github.com/denoland/deno/issues/21298. "npm:" specifiers are matched against import map entries and if no match is found they are passed through. --- cli/tests/testdata/run/import_meta/main.ts | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'cli/tests/testdata/run/import_meta/main.ts') diff --git a/cli/tests/testdata/run/import_meta/main.ts b/cli/tests/testdata/run/import_meta/main.ts index b6d9c506e..96d63ba78 100644 --- a/cli/tests/testdata/run/import_meta/main.ts +++ b/cli/tests/testdata/run/import_meta/main.ts @@ -32,8 +32,15 @@ assertThrows(() => { assertThrows(() => { import.meta.resolve("://malformed/url?asdf"); }, TypeError); -try { - import.meta.resolve("npm:cowsay"); -} catch (e) { - console.log(e); -} +console.log( + "Resolving npm:cowsay", + import.meta.resolve("npm:cowsay"), +); +console.log( + "Resolving npm:cowsay@1", + import.meta.resolve("npm:cowsay@1"), +); +console.log( + "Resolving npm:preact from import map", + import.meta.resolve("npm:preact"), +); -- cgit v1.2.3