Skip to content

Commit 8cd9fa6

Browse files
dsherretbartlomieju
authored andcommitted
fix(node): correct resolution of dynamic import of esm from cjs (#27071)
Ensures a dynamic import in a CJS file will consider the referrer as an import for node resolution. Also adds fixes (adds) support for `"resolution-mode"` in TypeScript.
1 parent 525d231 commit 8cd9fa6

File tree

92 files changed

+868
-1673
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+868
-1673
lines changed

Cargo.lock

Lines changed: 8 additions & 145 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cli/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ deno_ast = { workspace = true, features = ["bundler", "cjs", "codegen", "proposa
7272
deno_cache_dir.workspace = true
7373
deno_config.workspace = true
7474
deno_core = { workspace = true, features = ["include_js_files_for_snapshotting"] }
75-
deno_doc = { version = "0.160.0", features = ["rust", "comrak"] }
76-
deno_graph = { version = "=0.85.1" }
75+
deno_doc = { version = "=0.161.1", features = ["rust", "comrak"] }
76+
deno_graph = { version = "=0.86.2" }
7777
deno_lint = { version = "=0.68.0", features = ["docs"] }
7878
deno_lockfile.workspace = true
7979
deno_npm.workspace = true

cli/cache/module_info.rs

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ fn serialize_media_type(media_type: MediaType) -> i64 {
284284

285285
#[cfg(test)]
286286
mod test {
287+
use deno_graph::JsDocImportInfo;
287288
use deno_graph::PositionRange;
288289
use deno_graph::SpecifierWithRange;
289290

@@ -308,18 +309,21 @@ mod test {
308309
);
309310

310311
let mut module_info = ModuleInfo::default();
311-
module_info.jsdoc_imports.push(SpecifierWithRange {
312-
range: PositionRange {
313-
start: deno_graph::Position {
314-
line: 0,
315-
character: 3,
316-
},
317-
end: deno_graph::Position {
318-
line: 1,
319-
character: 2,
312+
module_info.jsdoc_imports.push(JsDocImportInfo {
313+
specifier: SpecifierWithRange {
314+
range: PositionRange {
315+
start: deno_graph::Position {
316+
line: 0,
317+
character: 3,
318+
},
319+
end: deno_graph::Position {
320+
line: 1,
321+
character: 2,
322+
},
320323
},
324+
text: "test".to_string(),
321325
},
322-
text: "test".to_string(),
326+
resolution_mode: None,
323327
});
324328
cache
325329
.set_module_info(

0 commit comments

Comments
 (0)