From 13acc07ecfae72e1d65d9ba0a13c9a94c06ea912 Mon Sep 17 00:00:00 2001 From: Nayeem Rahman Date: Thu, 26 Sep 2024 04:26:05 +0100 Subject: [PATCH 1/3] feat: provide full import statement range --- src/analyzer.rs | 58 +++++++++- src/ast.rs | 2 + src/graph.rs | 101 +++++++++++++----- src/lib.rs | 7 +- tests/specs/graph/jsr/module_graph_info_1.txt | 12 ++- .../module_graph_info_1_leading_comments.txt | 3 +- tests/specs/graph/jsr/module_graph_info_2.txt | 12 ++- ...odule_graph_info_modified_cached_files.txt | 15 ++- .../graph/jsr/same_package_multiple_times.txt | 3 +- 9 files changed, 170 insertions(+), 43 deletions(-) diff --git a/src/analyzer.rs b/src/analyzer.rs index 09d36a4a6..c89e326da 100644 --- a/src/analyzer.rs +++ b/src/analyzer.rs @@ -123,6 +123,8 @@ pub struct StaticDependencyDescriptor { pub specifier: String, /// The range of the specifier. pub specifier_range: PositionRange, + /// The range of the import statement. + pub range: PositionRange, /// Import attributes for this dependency. #[serde(skip_serializing_if = "ImportAttributes::is_none", default)] pub import_attributes: ImportAttributes, @@ -172,6 +174,7 @@ pub struct DynamicDependencyDescriptor { pub argument: DynamicArgument, /// The range of the argument. pub argument_range: PositionRange, + pub range: PositionRange, /// Import attributes for this dependency. #[serde(skip_serializing_if = "ImportAttributes::is_none", default)] pub import_attributes: ImportAttributes, @@ -375,6 +378,16 @@ mod test { character: 4, }, }, + range: PositionRange { + start: Position { + line: 1, + character: 0, + }, + end: Position { + line: 3, + character: 5, + }, + }, import_attributes: ImportAttributes::None, } .into(), @@ -385,6 +398,10 @@ mod test { start: Position::zeroed(), end: Position::zeroed(), }, + range: PositionRange { + start: Position::zeroed(), + end: Position::zeroed(), + }, import_attributes: ImportAttributes::Known(HashMap::from([ ("key".to_string(), ImportAttribute::Unknown), ( @@ -414,10 +431,12 @@ mod test { }, "specifier": "./test", "specifierRange": [[1, 2], [3, 4]], + "range": [[1, 0], [3, 5]], }, { "type": "dynamic", "argument": "./test2", "argumentRange": [[0, 0], [0, 0]], + "range": [[0, 0], [0, 0]], "importAttributes": { "known": { "key": null, @@ -596,6 +615,10 @@ mod test { start: Position::zeroed(), end: Position::zeroed(), }, + range: PositionRange { + start: Position::zeroed(), + end: Position::zeroed(), + }, import_attributes: ImportAttributes::Unknown, }); run_serialization_test( @@ -609,6 +632,7 @@ mod test { }, "specifier": "./test", "specifierRange": [[0, 0], [0, 0]], + "range": [[0, 0], [0, 0]], "importAttributes": "unknown", }), ); @@ -630,6 +654,10 @@ mod test { start: Position::zeroed(), end: Position::zeroed(), }, + range: PositionRange { + start: Position::zeroed(), + end: Position::zeroed(), + }, import_attributes: ImportAttributes::Unknown, }), json!({ @@ -639,6 +667,7 @@ mod test { "range": [[0, 0], [0, 0]], }, "argumentRange": [[0, 0], [0, 0]], + "range": [[0, 0], [0, 0]], "importAttributes": "unknown", }), ); @@ -651,12 +680,17 @@ mod test { start: Position::zeroed(), end: Position::zeroed(), }, + range: PositionRange { + start: Position::zeroed(), + end: Position::zeroed(), + }, import_attributes: ImportAttributes::Unknown, }), json!({ "type": "dynamic", "argument": "test", "argumentRange": [[0, 0], [0, 0]], + "range": [[0, 0], [0, 0]], "importAttributes": "unknown", }), ); @@ -728,6 +762,16 @@ mod test { character: 4, }, }, + range: PositionRange { + start: Position { + line: 1, + character: 0, + }, + end: Position { + line: 3, + character: 5, + }, + }, types_specifier: Some(SpecifierWithRange { text: "./a.d.ts".to_string(), range: PositionRange { @@ -756,6 +800,7 @@ mod test { "kind": "import", "specifier": "./a.js", "specifierRange": [[1, 2], [3, 4]], + "range": [[1, 0], [3, 5]], "leadingComments": [{ "text": " @deno-types=\"./a.d.ts\"", "range": [[0, 0], [0, 25]], @@ -782,6 +827,16 @@ mod test { character: 4, }, }, + range: PositionRange { + start: Position { + line: 1, + character: 0, + }, + end: Position { + line: 3, + character: 5, + }, + }, types_specifier: None, import_attributes: ImportAttributes::None, }, @@ -797,7 +852,8 @@ mod test { "type": "static", "kind": "import", "specifier": "./a.js", - "specifierRange": [[1, 2], [3, 4]] + "specifierRange": [[1, 2], [3, 4]], + "range": [[1, 0], [3, 5]], }] }); run_v1_deserialization_test(json, &expected); diff --git a/src/ast.rs b/src/ast.rs index 62f715749..f7ed79ba9 100644 --- a/src/ast.rs +++ b/src/ast.rs @@ -462,6 +462,7 @@ fn analyze_dependencies( d.specifier_range, text_info, ), + range: PositionRange::from_source_range(d.range, text_info), import_attributes: d.import_attributes, }) } @@ -498,6 +499,7 @@ fn analyze_dependencies( d.argument_range, text_info, ), + range: PositionRange::from_source_range(d.range, text_info), import_attributes: d.import_attributes, }) } diff --git a/src/graph.rs b/src/graph.rs index 6d18b65bd..967d9597b 100644 --- a/src/graph.rs +++ b/src/graph.rs @@ -669,7 +669,10 @@ pub struct Import { pub specifier: String, #[serde(skip_serializing_if = "ImportKind::is_es")] pub kind: ImportKind, - pub range: Range, + #[serde(rename = "range")] + pub specifier_range: Range, + #[serde(skip_serializing)] + pub full_range: Option, #[serde(skip_serializing_if = "is_false")] pub is_dynamic: bool, // Don't include attributes in `deno info --json` until someone has a need. @@ -716,8 +719,8 @@ impl Dependency { /// otherwise none. pub fn includes(&self, position: &Position) -> Option<&Range> { for import in &self.imports { - if import.range.includes(position) { - return Some(&import.range); + if import.specifier_range.includes(position) { + return Some(&import.specifier_range); } } // `@deno-types` directives won't be associated with an import. @@ -2414,7 +2417,8 @@ pub(crate) fn parse_js_module_from_module_info( dep.imports.push(Import { specifier: specifier.text, kind: ImportKind::TsReferencePath, - range, + specifier_range: range, + full_range: None, is_dynamic: false, attributes: Default::default(), }); @@ -2452,7 +2456,8 @@ pub(crate) fn parse_js_module_from_module_info( dep.imports.push(Import { specifier: specifier.text, kind: ImportKind::TsReferenceTypes, - range, + specifier_range: range, + full_range: None, is_dynamic: false, attributes: Default::default(), }); @@ -2574,7 +2579,8 @@ pub(crate) fn parse_js_module_from_module_info( dep.imports.push(Import { specifier: specifier_text, kind: ImportKind::JsxImportSource, - range, + specifier_range: range, + full_range: None, is_dynamic: false, attributes: Default::default(), }); @@ -2588,12 +2594,12 @@ pub(crate) fn parse_js_module_from_module_info( .dependencies .entry(specifier.text.clone()) .or_default(); - let range = + let specifier_range = Range::from_position_range(module.specifier.clone(), specifier.range); if dep.maybe_type.is_none() { dep.maybe_type = resolve( &specifier.text, - range.clone(), + specifier_range.clone(), ResolutionMode::Types, jsr_url_provider, maybe_resolver, @@ -2603,7 +2609,8 @@ pub(crate) fn parse_js_module_from_module_info( dep.imports.push(Import { specifier: specifier.text, kind: ImportKind::JsDoc, - range, + specifier_range, + full_range: None, is_dynamic: false, attributes: Default::default(), }); @@ -2714,11 +2721,12 @@ fn fill_module_dependencies( if is_import_or_export_type && !graph_kind.include_types() { continue; // skip } - let range = Range::from_position_range( + let specifier_range = Range::from_position_range( module_specifier.clone(), desc.specifier_range, ); - + let full_range = + Range::from_position_range(module_specifier.clone(), desc.range); ( vec![Import { specifier: desc.specifier, @@ -2726,7 +2734,8 @@ fn fill_module_dependencies( true => ImportKind::TsType, false => ImportKind::Es, }, - range, + specifier_range, + full_range: Some(full_range), is_dynamic: false, attributes: desc.import_attributes, }], @@ -2756,17 +2765,20 @@ fn fill_module_dependencies( } _ => continue, }; - let range = Range::from_position_range( + let specifier_range = Range::from_position_range( module_specifier.clone(), desc.argument_range, ); + let full_range = + Range::from_position_range(module_specifier.clone(), desc.range); ( specifiers .into_iter() .map(|specifier| Import { specifier, kind: ImportKind::Es, - range: range.clone(), + specifier_range: specifier_range.clone(), + full_range: Some(full_range.clone()), is_dynamic: true, attributes: import_attributes.clone(), }) @@ -2806,7 +2818,7 @@ fn fill_module_dependencies( if dep.maybe_type.is_none() { dep.maybe_type = resolve( &import.specifier, - import.range.clone(), + import.specifier_range.clone(), ResolutionMode::Types, jsr_url_provider, maybe_resolver, @@ -2818,7 +2830,7 @@ fn fill_module_dependencies( // Resolve and determine the initial `is_dynamic` value from it. dep.maybe_code = resolve( &import.specifier, - import.range.clone(), + import.specifier_range.clone(), ResolutionMode::Execution, jsr_url_provider, maybe_resolver, @@ -2835,7 +2847,7 @@ fn fill_module_dependencies( if graph_kind.include_types() && dep.maybe_type.is_none() { let maybe_type = resolve( &import.specifier, - import.range.clone(), + import.specifier_range.clone(), ResolutionMode::Types, jsr_url_provider, maybe_resolver, @@ -5162,7 +5174,7 @@ mod tests { Import { specifier: "./b.ts".to_string(), kind: ImportKind::Es, - range: Range { + specifier_range: Range { specifier: specifier.clone(), start: Position { line: 0, @@ -5173,13 +5185,18 @@ mod tests { character: 27, }, }, + full_range: Some(Range { + specifier: specifier.clone(), + start: Position::new(2, 16), + end: Position::new(2, 65), + }), is_dynamic: false, attributes: Default::default(), }, Import { specifier: "./b.ts".to_string(), kind: ImportKind::Es, - range: Range { + specifier_range: Range { specifier: specifier.clone(), start: Position { line: 1, @@ -5190,6 +5207,11 @@ mod tests { character: 27, }, }, + full_range: Some(Range { + specifier: specifier.clone(), + start: Position::new(2, 16), + end: Position::new(2, 65), + }), is_dynamic: false, attributes: Default::default(), }, @@ -5830,7 +5852,7 @@ mod tests { Import { specifier: "file:///bar.ts".to_string(), kind: ImportKind::TsReferencePath, - range: Range { + specifier_range: Range { specifier: Url::parse("file:///foo.ts").unwrap(), start: Position { line: 1, @@ -5841,13 +5863,14 @@ mod tests { character: 52, }, }, + full_range: None, is_dynamic: false, attributes: ImportAttributes::None, }, Import { specifier: "file:///bar.ts".to_string(), kind: ImportKind::TsReferenceTypes, - range: Range { + specifier_range: Range { specifier: Url::parse("file:///foo.ts").unwrap(), start: Position { line: 2, @@ -5858,13 +5881,14 @@ mod tests { character: 53, }, }, + full_range: None, is_dynamic: false, attributes: ImportAttributes::None, }, Import { specifier: "file:///bar.ts".to_string(), kind: ImportKind::Es, - range: Range { + specifier_range: Range { specifier: Url::parse("file:///foo.ts").unwrap(), start: Position { line: 4, @@ -5875,13 +5899,18 @@ mod tests { character: 39, }, }, + full_range: Some(Range { + specifier: Url::parse("file:///foo.ts").unwrap(), + start: Position::new(4, 16), + end: Position::new(4, 40), + }), is_dynamic: false, attributes: ImportAttributes::None, }, Import { specifier: "file:///bar.ts".to_string(), kind: ImportKind::Es, - range: Range { + specifier_range: Range { specifier: Url::parse("file:///foo.ts").unwrap(), start: Position { line: 5, @@ -5892,13 +5921,18 @@ mod tests { character: 45, }, }, + full_range: Some(Range { + specifier: Url::parse("file:///foo.ts").unwrap(), + start: Position::new(5, 22), + end: Position::new(5, 46), + }), is_dynamic: true, attributes: ImportAttributes::None, }, Import { specifier: "file:///bar.ts".to_string(), kind: ImportKind::Es, - range: Range { + specifier_range: Range { specifier: Url::parse("file:///foo.ts").unwrap(), start: Position { line: 6, @@ -5909,13 +5943,18 @@ mod tests { character: 45, }, }, + full_range: Some(Range { + specifier: Url::parse("file:///foo.ts").unwrap(), + start: Position::new(6, 22), + end: Position::new(6, 68), + }), is_dynamic: true, attributes: ImportAttributes::Unknown, }, Import { specifier: "file:///bar.ts".to_string(), kind: ImportKind::TsType, - range: Range { + specifier_range: Range { specifier: Url::parse("file:///foo.ts").unwrap(), start: Position { line: 8, @@ -5926,6 +5965,11 @@ mod tests { character: 52, }, }, + full_range: Some(Range { + specifier: Url::parse("file:///foo.ts").unwrap(), + start: Position::new(8, 16), + end: Position::new(8, 53), + }), is_dynamic: false, attributes: ImportAttributes::None, }, @@ -5936,7 +5980,7 @@ mod tests { vec![Import { specifier: "file:///baz.json".to_string(), kind: ImportKind::Es, - range: Range { + specifier_range: Range { specifier: Url::parse("file:///foo.ts").unwrap(), start: Position { line: 7, @@ -5947,6 +5991,11 @@ mod tests { character: 41, }, }, + full_range: Some(Range { + specifier: Url::parse("file:///foo.ts").unwrap(), + start: Position::new(7, 16), + end: Position::new(7, 66), + }), is_dynamic: false, attributes: ImportAttributes::Known(HashMap::from_iter(vec![( "type".to_string(), diff --git a/src/lib.rs b/src/lib.rs index 28c086fcd..9e6281abf 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3316,11 +3316,16 @@ export const foo = 'bar';"#, imports: vec![Import { specifier: "./a.js".to_string(), kind: ImportKind::Es, - range: Range { + specifier_range: Range { specifier: specifier.clone(), start: Position::new(2, 22), end: Position::new(2, 30), }, + full_range: Some(Range { + specifier: specifier.clone(), + start: Position::new(2, 4), + end: Position::new(2, 31), + }), is_dynamic: false, attributes: Default::default(), }], diff --git a/tests/specs/graph/jsr/module_graph_info_1.txt b/tests/specs/graph/jsr/module_graph_info_1.txt index dc76d7290..001c3eca2 100644 --- a/tests/specs/graph/jsr/module_graph_info_1.txt +++ b/tests/specs/graph/jsr/module_graph_info_1.txt @@ -16,7 +16,8 @@ "type": "static", "kind": "import", "specifier": "./a.ts", - "specifierRange": [[5, 6], [7, 8]] + "specifierRange": [[5, 6], [7, 8]], + "range": [[5, 0], [7, 8]] }] }, "/a.ts": { @@ -24,12 +25,14 @@ "type": "static", "kind": "import", "specifier": "./b.ts", - "specifierRange": [[13, 14], [15, 16]] + "specifierRange": [[13, 14], [15, 16]], + "range": [[13, 0], [15, 16]] }, { "type": "static", "kind": "import", "specifier": "jsr:@scope/b/export", - "specifierRange": [[5, 6], [7, 8]] + "specifierRange": [[5, 6], [7, 8]], + "range": [[5, 0], [7, 8]] }] } } @@ -53,7 +56,8 @@ "type": "static", "kind": "import", "specifier": "./inner.ts", - "specifierRange": [[5, 6], [7, 8]] + "specifierRange": [[5, 6], [7, 8]], + "range": [[5, 0], [7, 8]] }] } } diff --git a/tests/specs/graph/jsr/module_graph_info_1_leading_comments.txt b/tests/specs/graph/jsr/module_graph_info_1_leading_comments.txt index 06fc8bff1..1d5767d08 100644 --- a/tests/specs/graph/jsr/module_graph_info_1_leading_comments.txt +++ b/tests/specs/graph/jsr/module_graph_info_1_leading_comments.txt @@ -20,7 +20,8 @@ "range": [[0, 0], [0, 25]] }], "specifier": "./a.js", - "specifierRange": [[5, 6], [7, 8]] + "specifierRange": [[5, 6], [7, 8]], + "range": [[5, 0], [7, 8]] }] }, "/a.js": {}, diff --git a/tests/specs/graph/jsr/module_graph_info_2.txt b/tests/specs/graph/jsr/module_graph_info_2.txt index 10b360092..95b513a06 100644 --- a/tests/specs/graph/jsr/module_graph_info_2.txt +++ b/tests/specs/graph/jsr/module_graph_info_2.txt @@ -16,7 +16,8 @@ "type": "static", "kind": "import", "specifier": "./a.ts", - "specifierRange": [[5, 6], [7, 8]] + "specifierRange": [[5, 6], [7, 8]], + "range": [[5, 0], [7, 8]] }] }, "/a.ts": { @@ -24,12 +25,14 @@ "type": "static", "kind": "import", "specifier": "./b.ts", - "specifierRange": [[13, 14], [15, 16]] + "specifierRange": [[13, 14], [15, 16]], + "range": [[13, 0], [15, 16]] }, { "type": "static", "kind": "import", "specifier": "jsr:@scope/b/export", - "specifierRange": [[5, 6], [7, 8]] + "specifierRange": [[5, 6], [7, 8]], + "range": [[5, 0], [7, 8]] }] } } @@ -53,7 +56,8 @@ "type": "static", "kind": "import", "specifier": "./inner.ts", - "specifierRange": [[5, 6], [7, 8]] + "specifierRange": [[5, 6], [7, 8]], + "range": [[5, 0], [7, 8]] }] } } diff --git a/tests/specs/graph/jsr/module_graph_info_modified_cached_files.txt b/tests/specs/graph/jsr/module_graph_info_modified_cached_files.txt index c1dd00242..945d00c4b 100644 --- a/tests/specs/graph/jsr/module_graph_info_modified_cached_files.txt +++ b/tests/specs/graph/jsr/module_graph_info_modified_cached_files.txt @@ -16,7 +16,8 @@ "type": "static", "kind": "import", "specifier": "./a.ts", - "specifierRange": [[5, 6], [7, 8]] + "specifierRange": [[5, 6], [7, 8]], + "range": [[5, 0], [7, 8]] }] }, "/a.ts": { @@ -24,12 +25,14 @@ "type": "static", "kind": "import", "specifier": "./b.ts", - "specifierRange": [[13, 14], [15, 16]] + "specifierRange": [[13, 14], [15, 16]], + "range": [[13, 0], [15, 16]] }, { "type": "static", "kind": "import", "specifier": "jsr:@scope/b", - "specifierRange": [[5, 6], [7, 8]] + "specifierRange": [[5, 6], [7, 8]], + "range": [[5, 0], [7, 8]] }] }, "/b.ts": { @@ -37,7 +40,8 @@ "type": "static", "kind": "import", "specifier": "./c.ts", - "specifierRange": [[13, 14], [15, 16]] + "specifierRange": [[13, 14], [15, 16]], + "range": [[13, 0], [15, 16]] }] }, "/c.ts": {} @@ -62,7 +66,8 @@ "type": "static", "kind": "import", "specifier": "./inner.ts", - "specifierRange": [[5, 6], [7, 8]] + "specifierRange": [[5, 6], [7, 8]], + "range": [[5, 0], [7, 8]] }] } } diff --git a/tests/specs/graph/jsr/same_package_multiple_times.txt b/tests/specs/graph/jsr/same_package_multiple_times.txt index b095c1f6c..fa19bd4d8 100644 --- a/tests/specs/graph/jsr/same_package_multiple_times.txt +++ b/tests/specs/graph/jsr/same_package_multiple_times.txt @@ -16,7 +16,8 @@ "type": "static", "kind": "import", "specifier": "jsr:@scope/b@1", - "specifierRange": [[5, 6], [7, 8]] + "specifierRange": [[5, 6], [7, 8]], + "range": [[5, 0], [7, 8]] }] } } From 6834bcdb52dde97f1454d3813799ffc2c85a2160 Mon Sep 17 00:00:00 2001 From: Nayeem Rahman Date: Thu, 26 Sep 2024 13:20:05 +0100 Subject: [PATCH 2/3] fix ecosystem tests --- .../ecosystem/kwhinnery/animals/0_0_14.test | 7 ++++++- .../ecosystem/kwhinnery/animals/0_0_15.test | 7 ++++++- .../ecosystem/kwhinnery/animals/0_0_16.test | 16 +--------------- .../ecosystem/kwhinnery/animals/0_0_17.test | 16 +--------------- tests/specs/ecosystem/neon/serverless/0_9_0.test | 4 +--- 5 files changed, 15 insertions(+), 35 deletions(-) diff --git a/tests/specs/ecosystem/kwhinnery/animals/0_0_14.test b/tests/specs/ecosystem/kwhinnery/animals/0_0_14.test index d707f36af..36ee2232f 100644 --- a/tests/specs/ecosystem/kwhinnery/animals/0_0_14.test +++ b/tests/specs/ecosystem/kwhinnery/animals/0_0_14.test @@ -9,4 +9,9 @@ kwhinnery/animals/0.0.14 == FAST CHECK EMIT PASSED == -== TYPE CHECK PASSED == +<== TYPE CHECK FAILED == +<-- stdout -- +< +<-- stderr -- +/dist/animal.js". +< at file:///dist/mod.d.ts:1:15 diff --git a/tests/specs/ecosystem/kwhinnery/animals/0_0_15.test b/tests/specs/ecosystem/kwhinnery/animals/0_0_15.test index fc234666a..1e4ef175f 100644 --- a/tests/specs/ecosystem/kwhinnery/animals/0_0_15.test +++ b/tests/specs/ecosystem/kwhinnery/animals/0_0_15.test @@ -9,4 +9,9 @@ kwhinnery/animals/0.0.15 == FAST CHECK EMIT PASSED == -== TYPE CHECK PASSED == +<== TYPE CHECK FAILED == +<-- stdout -- +< +<-- stderr -- +/dist/animal.js". +< at file:///dist/mod.d.ts:1:15 diff --git a/tests/specs/ecosystem/kwhinnery/animals/0_0_16.test b/tests/specs/ecosystem/kwhinnery/animals/0_0_16.test index 92a9e623f..4dbd6a90b 100644 --- a/tests/specs/ecosystem/kwhinnery/animals/0_0_16.test +++ b/tests/specs/ecosystem/kwhinnery/animals/0_0_16.test @@ -13,20 +13,6 @@ kwhinnery/animals/0.0.16 -- stdout -- -- stderr -- -error: TS2834 [ERROR]: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -export * from "./animal"; - ~~~~~~~~~~ +error: Module not found "file:///types/animal". at file:///types/mod.d.ts:1:15 -TS2834 [ERROR]: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -export * from "./cat"; - ~~~~~~~ - at file:///types/mod.d.ts:2:15 - -TS2834 [ERROR]: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -export * from "./dog"; - ~~~~~~~ - at file:///types/mod.d.ts:3:15 - -Found 3 errors. - diff --git a/tests/specs/ecosystem/kwhinnery/animals/0_0_17.test b/tests/specs/ecosystem/kwhinnery/animals/0_0_17.test index 83a239e64..fa0dfb268 100644 --- a/tests/specs/ecosystem/kwhinnery/animals/0_0_17.test +++ b/tests/specs/ecosystem/kwhinnery/animals/0_0_17.test @@ -13,20 +13,6 @@ kwhinnery/animals/0.0.17 -- stdout -- -- stderr -- -error: TS2834 [ERROR]: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -export * from "./animal"; - ~~~~~~~~~~ +error: Module not found "file:///types/animal". at file:///types/mod.d.ts:1:15 -TS2834 [ERROR]: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -export * from "./cat"; - ~~~~~~~ - at file:///types/mod.d.ts:2:15 - -TS2834 [ERROR]: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -export * from "./dog"; - ~~~~~~~ - at file:///types/mod.d.ts:3:15 - -Found 3 errors. - diff --git a/tests/specs/ecosystem/neon/serverless/0_9_0.test b/tests/specs/ecosystem/neon/serverless/0_9_0.test index c6d044da0..07f2d52c3 100644 --- a/tests/specs/ecosystem/neon/serverless/0_9_0.test +++ b/tests/specs/ecosystem/neon/serverless/0_9_0.test @@ -72,8 +72,6 @@ neon/serverless/0.9.0 -- stdout -- -- stderr -- -error: TS2834 [ERROR]: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -export { DatabaseError } from "./pg-protocol"; - ~~~~~~~~~~~~~~~ +error: Module not found "file:///pg-protocol". at file:///index.d.ts:1:31 From 067579df2c56334e6e815522607de84a05544320 Mon Sep 17 00:00:00 2001 From: Nayeem Rahman Date: Thu, 26 Sep 2024 14:11:59 +0100 Subject: [PATCH 3/3] fixup! fix ecosystem tests --- .../ecosystem/amit/neon_serverless_driver/0_0_3.test | 4 +--- tests/specs/ecosystem/kwhinnery/animals/0_0_14.test | 12 ++++++------ tests/specs/ecosystem/kwhinnery/animals/0_0_15.test | 12 ++++++------ tests/specs/ecosystem/neon/serverless/0_9_2.test | 4 +--- 4 files changed, 14 insertions(+), 18 deletions(-) diff --git a/tests/specs/ecosystem/amit/neon_serverless_driver/0_0_3.test b/tests/specs/ecosystem/amit/neon_serverless_driver/0_0_3.test index f53b9ccbe..b6c3472a8 100644 --- a/tests/specs/ecosystem/amit/neon_serverless_driver/0_0_3.test +++ b/tests/specs/ecosystem/amit/neon_serverless_driver/0_0_3.test @@ -72,8 +72,6 @@ amit/neon-serverless-driver/0.0.3 -- stdout -- -- stderr -- -error: TS2834 [ERROR]: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -export { DatabaseError } from "./pg-protocol"; - ~~~~~~~~~~~~~~~ +error: Module not found "file:///pg-protocol". at file:///index.d.ts:1:31 diff --git a/tests/specs/ecosystem/kwhinnery/animals/0_0_14.test b/tests/specs/ecosystem/kwhinnery/animals/0_0_14.test index 36ee2232f..0975461c8 100644 --- a/tests/specs/ecosystem/kwhinnery/animals/0_0_14.test +++ b/tests/specs/ecosystem/kwhinnery/animals/0_0_14.test @@ -9,9 +9,9 @@ kwhinnery/animals/0.0.14 == FAST CHECK EMIT PASSED == -<== TYPE CHECK FAILED == -<-- stdout -- -< -<-- stderr -- -/dist/animal.js". -< at file:///dist/mod.d.ts:1:15 +== TYPE CHECK FAILED == +-- stdout -- + +-- stderr -- +error: Module not found "file:///dist/animal.js". + at file:///dist/mod.d.ts:1:15 diff --git a/tests/specs/ecosystem/kwhinnery/animals/0_0_15.test b/tests/specs/ecosystem/kwhinnery/animals/0_0_15.test index 1e4ef175f..acfc4138b 100644 --- a/tests/specs/ecosystem/kwhinnery/animals/0_0_15.test +++ b/tests/specs/ecosystem/kwhinnery/animals/0_0_15.test @@ -9,9 +9,9 @@ kwhinnery/animals/0.0.15 == FAST CHECK EMIT PASSED == -<== TYPE CHECK FAILED == -<-- stdout -- -< -<-- stderr -- -/dist/animal.js". -< at file:///dist/mod.d.ts:1:15 +== TYPE CHECK FAILED == +-- stdout -- + +-- stderr -- +error: Module not found "file:///dist/animal.js". + at file:///dist/mod.d.ts:1:15 diff --git a/tests/specs/ecosystem/neon/serverless/0_9_2.test b/tests/specs/ecosystem/neon/serverless/0_9_2.test index 2cf1b10a6..734a093d1 100644 --- a/tests/specs/ecosystem/neon/serverless/0_9_2.test +++ b/tests/specs/ecosystem/neon/serverless/0_9_2.test @@ -72,8 +72,6 @@ neon/serverless/0.9.2 -- stdout -- -- stderr -- -error: TS2834 [ERROR]: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -export { DatabaseError } from "./pg-protocol"; - ~~~~~~~~~~~~~~~ +error: Module not found "file:///pg-protocol". at file:///index.d.ts:1:31