mirror of
https://github.com/denoland/deno.git
synced 2024-12-23 15:49:44 -05:00
fix: handle specifying an import map in an ancestor dir of deno.json (#23602)
* https://github.com/denoland/deno_config/pull/51 Closes https://github.com/denoland/deno/issues/21440
This commit is contained in:
parent
e6f4c8f531
commit
4384a126bb
10 changed files with 31 additions and 4 deletions
4
Cargo.lock
generated
4
Cargo.lock
generated
|
@ -1272,9 +1272,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "deno_config"
|
||||
version = "0.16.1"
|
||||
version = "0.16.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1bc55559b6b4ebf190c75ad76a4204c792ac27e64e83e685fb5f4e4317bb94c5"
|
||||
checksum = "f28ad258b58ade470cd745191eacee35562db3c967ffb26b4aa6f0f88f0882dd"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"glob",
|
||||
|
|
|
@ -65,7 +65,7 @@ winres.workspace = true
|
|||
[dependencies]
|
||||
deno_ast = { workspace = true, features = ["bundler", "cjs", "codegen", "proposal", "react", "sourcemap", "transforms", "typescript", "view", "visit"] }
|
||||
deno_cache_dir = { workspace = true }
|
||||
deno_config = "=0.16.1"
|
||||
deno_config = "=0.16.2"
|
||||
deno_core = { workspace = true, features = ["include_js_files_for_snapshotting"] }
|
||||
deno_doc = { version = "=0.128.1", features = ["html", "syntect"] }
|
||||
deno_emit = "=0.40.1"
|
||||
|
|
|
@ -943,7 +943,7 @@ impl CliOptions {
|
|||
&self,
|
||||
) -> Result<Option<ModuleSpecifier>, AnyError> {
|
||||
match self.overrides.import_map_specifier.clone() {
|
||||
Some(maybe_path) => Ok(maybe_path),
|
||||
Some(maybe_url) => Ok(maybe_url),
|
||||
None => resolve_import_map_specifier(
|
||||
self.flags.import_map_path.as_deref(),
|
||||
self.maybe_config_file.as_ref(),
|
||||
|
|
9
tests/specs/run/import_map_parent_dir/__test__.jsonc
Normal file
9
tests/specs/run/import_map_parent_dir/__test__.jsonc
Normal file
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"steps": [{
|
||||
"args": "info --config=sub/deno.json sub/main.ts",
|
||||
"output": "info.out"
|
||||
}, {
|
||||
"args": "run --check sub/main.ts",
|
||||
"output": "run.out"
|
||||
}]
|
||||
}
|
5
tests/specs/run/import_map_parent_dir/import_map.json
Normal file
5
tests/specs/run/import_map_parent_dir/import_map.json
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"imports": {
|
||||
"~/shared/": "./shared/"
|
||||
}
|
||||
}
|
7
tests/specs/run/import_map_parent_dir/info.out
Normal file
7
tests/specs/run/import_map_parent_dir/info.out
Normal file
|
@ -0,0 +1,7 @@
|
|||
local: [WILDLINE]main.ts
|
||||
type: TypeScript
|
||||
dependencies: 1 unique
|
||||
size: [WILDLINE]
|
||||
|
||||
file:///[WILDLINE]/sub/main.ts ([WILDLINE])
|
||||
└── file:///[WILDLINE]/shared/models.ts ([WILDLINE])
|
1
tests/specs/run/import_map_parent_dir/run.out
Normal file
1
tests/specs/run/import_map_parent_dir/run.out
Normal file
|
@ -0,0 +1 @@
|
|||
Check file:///[WILDLINE]/main.ts
|
1
tests/specs/run/import_map_parent_dir/shared/models.ts
Normal file
1
tests/specs/run/import_map_parent_dir/shared/models.ts
Normal file
|
@ -0,0 +1 @@
|
|||
export class Model {}
|
3
tests/specs/run/import_map_parent_dir/sub/deno.json
Normal file
3
tests/specs/run/import_map_parent_dir/sub/deno.json
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"importMap": "../import_map.json"
|
||||
}
|
1
tests/specs/run/import_map_parent_dir/sub/main.ts
Normal file
1
tests/specs/run/import_map_parent_dir/sub/main.ts
Normal file
|
@ -0,0 +1 @@
|
|||
import "~/shared/models.ts";
|
Loading…
Reference in a new issue