From 4f15aada02450824a0a6e2602dde2fffdd9fd90a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Thu, 11 Jul 2024 17:43:28 +0100 Subject: [PATCH] fix(workspace): allow using --import-map flag with workspace (#24527) This is a temporary fix, which is not perfect - specifying `--import-map` will break resolution of packages defined in `workspace` setting, but erroring on `--import-map` currently causes regression in code that worked fine in v1.44.x. --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- .../specs/run/workspaces/explicit_import_map/__test__.jsonc | 5 +++++ .../specs/run/workspaces/explicit_import_map/import_map.json | 5 +++++ tests/specs/run/workspaces/explicit_import_map/main.out | 2 ++ tests/specs/run/workspaces/explicit_import_map/main.ts | 3 +++ tests/specs/run/workspaces/explicit_import_map/package.json | 3 +++ 7 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 tests/specs/run/workspaces/explicit_import_map/__test__.jsonc create mode 100644 tests/specs/run/workspaces/explicit_import_map/import_map.json create mode 100644 tests/specs/run/workspaces/explicit_import_map/main.out create mode 100644 tests/specs/run/workspaces/explicit_import_map/main.ts create mode 100644 tests/specs/run/workspaces/explicit_import_map/package.json diff --git a/Cargo.lock b/Cargo.lock index c00aa22265..8d5865d69c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1308,9 +1308,9 @@ dependencies = [ [[package]] name = "deno_config" -version = "0.21.0" +version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47d457bbaff2200897ab1f635863c477f10524412a1f568535ea26763b96d5c9" +checksum = "c2df23da1c85522dd6cb23372d7953ecf576ec416c5d517b046aeeca281ca5a4" dependencies = [ "anyhow", "deno_semver", diff --git a/Cargo.toml b/Cargo.toml index 8f3fccef62..e26ccc84f7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -101,7 +101,7 @@ console_static_text = "=0.8.1" data-encoding = "2.3.3" data-url = "=0.3.0" deno_cache_dir = "=0.10.0" -deno_config = { version = "=0.21.0", default-features = false } +deno_config = { version = "=0.21.1", default-features = false } dlopen2 = "0.6.1" ecb = "=0.1.2" elliptic-curve = { version = "0.13.4", features = ["alloc", "arithmetic", "ecdh", "std", "pem"] } diff --git a/tests/specs/run/workspaces/explicit_import_map/__test__.jsonc b/tests/specs/run/workspaces/explicit_import_map/__test__.jsonc new file mode 100644 index 0000000000..2bd0d3bcce --- /dev/null +++ b/tests/specs/run/workspaces/explicit_import_map/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run -A --import-map=./import_map.json main.ts", + "output": "main.out", + "tempDir": true +} diff --git a/tests/specs/run/workspaces/explicit_import_map/import_map.json b/tests/specs/run/workspaces/explicit_import_map/import_map.json new file mode 100644 index 0000000000..a2827b1710 --- /dev/null +++ b/tests/specs/run/workspaces/explicit_import_map/import_map.json @@ -0,0 +1,5 @@ +{ + "imports": { + "chalk": "npm:chalk" + } +} diff --git a/tests/specs/run/workspaces/explicit_import_map/main.out b/tests/specs/run/workspaces/explicit_import_map/main.out new file mode 100644 index 0000000000..c420c18532 --- /dev/null +++ b/tests/specs/run/workspaces/explicit_import_map/main.out @@ -0,0 +1,2 @@ +[WILDCARD] +hello diff --git a/tests/specs/run/workspaces/explicit_import_map/main.ts b/tests/specs/run/workspaces/explicit_import_map/main.ts new file mode 100644 index 0000000000..56dcea6788 --- /dev/null +++ b/tests/specs/run/workspaces/explicit_import_map/main.ts @@ -0,0 +1,3 @@ +import chalk from "chalk"; + +console.log(chalk.green("hello")); diff --git a/tests/specs/run/workspaces/explicit_import_map/package.json b/tests/specs/run/workspaces/explicit_import_map/package.json new file mode 100644 index 0000000000..e5e2f6f5df --- /dev/null +++ b/tests/specs/run/workspaces/explicit_import_map/package.json @@ -0,0 +1,3 @@ +{ + "workspaces": ["packages/*"] +}