Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: handle specifying an import map in an ancestor dir of deno.json #23602

Merged
merged 4 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
deno_emit = "=0.40.1"
Expand Down
2 changes: 1 addition & 1 deletion cli/args/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
9 changes: 9 additions & 0 deletions tests/specs/run/import_map_parent_dir/__test__.jsonc
Original file line number Diff line number Diff line change
@@ -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 changes: 5 additions & 0 deletions tests/specs/run/import_map_parent_dir/import_map.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"imports": {
"~/shared/": "./shared/"
}
}
7 changes: 7 additions & 0 deletions tests/specs/run/import_map_parent_dir/info.out
Original file line number Diff line number Diff line change
@@ -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 change: 1 addition & 0 deletions tests/specs/run/import_map_parent_dir/run.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Check file:///[WILDLINE]/main.ts
1 change: 1 addition & 0 deletions tests/specs/run/import_map_parent_dir/shared/models.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export class Model {}
3 changes: 3 additions & 0 deletions tests/specs/run/import_map_parent_dir/sub/deno.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"importMap": "../import_map.json"
}
1 change: 1 addition & 0 deletions tests/specs/run/import_map_parent_dir/sub/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import "~/shared/models.ts";