diff options
Diffstat (limited to 'cli')
-rw-r--r-- | cli/Cargo.toml | 12 | ||||
-rw-r--r-- | cli/args/mod.rs | 1 | ||||
-rw-r--r-- | cli/errors.rs | 5 | ||||
-rw-r--r-- | cli/graph_util.rs | 36 | ||||
-rw-r--r-- | cli/lsp/documents.rs | 1 | ||||
-rw-r--r-- | cli/tests/testdata/run/error_type_definitions.ts.out | 2 | ||||
-rw-r--r-- | cli/tools/info.rs | 57 | ||||
-rw-r--r-- | cli/tools/repl/session.rs | 1 |
8 files changed, 63 insertions, 52 deletions
diff --git a/cli/Cargo.toml b/cli/Cargo.toml index fc08a7074..17167a0d6 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -49,16 +49,16 @@ deno_ast = { workspace = true, features = ["bundler", "cjs", "codegen", "dep_gra deno_cache_dir = "=0.6.0" deno_config = "=0.4.0" deno_core = { workspace = true, features = ["include_js_files_for_snapshotting"] } -deno_doc = "=0.69.1" -deno_emit = "=0.31.0" -deno_graph = "=0.58.0" -deno_lint = { version = "=0.52.1", features = ["docs"] } +deno_doc = "=0.69.2" +deno_emit = "=0.31.1" +deno_graph = "=0.59.0" +deno_lint = { version = "=0.52.2", features = ["docs"] } deno_lockfile.workspace = true deno_npm = "0.15.2" deno_runtime = { workspace = true, features = ["dont_create_runtime_snapshot", "exclude_runtime_main_js", "include_js_files_for_snapshotting"] } deno_semver = "0.5.1" deno_task_shell = "=0.13.2" -eszip = "=0.55.1" +eszip = "=0.55.2" napi_sym.workspace = true async-trait.workspace = true @@ -78,7 +78,7 @@ data-url.workspace = true dissimilar = "=1.0.4" dprint-plugin-json = "=0.19.0" dprint-plugin-markdown = "=0.16.2" -dprint-plugin-typescript = "=0.88.2" +dprint-plugin-typescript = "=0.88.3" encoding_rs.workspace = true env_logger = "=0.10.0" fancy-regex = "=0.10.0" diff --git a/cli/args/mod.rs b/cli/args/mod.rs index a95c4d840..390e16698 100644 --- a/cli/args/mod.rs +++ b/cli/args/mod.rs @@ -127,6 +127,7 @@ pub fn ts_config_to_emit_options( jsx_factory: options.jsx_factory, jsx_fragment_factory: options.jsx_fragment_factory, jsx_import_source: options.jsx_import_source, + precompile_jsx: false, transform_jsx, var_decl_imports: false, } diff --git a/cli/errors.rs b/cli/errors.rs index 8c240c1e6..0e3ff4f30 100644 --- a/cli/errors.rs +++ b/cli/errors.rs @@ -39,7 +39,10 @@ fn get_module_graph_error_class(err: &ModuleGraphError) -> &'static str { | ModuleError::UnknownPackage { .. } | ModuleError::UnknownPackageReq { .. } => "NotFound", }, - ModuleGraphError::ResolutionError(err) => get_resolution_error_class(err), + ModuleGraphError::ResolutionError(err) + | ModuleGraphError::TypesResolutionError(err) => { + get_resolution_error_class(err) + } } } diff --git a/cli/graph_util.rs b/cli/graph_util.rs index a7c230e17..9a2b805fd 100644 --- a/cli/graph_util.rs +++ b/cli/graph_util.rs @@ -92,15 +92,23 @@ pub fn graph_valid( .errors() .flat_map(|error| { let is_root = match &error { - ModuleGraphError::ResolutionError(_) => false, + ModuleGraphError::ResolutionError(_) + | ModuleGraphError::TypesResolutionError(_) => false, ModuleGraphError::ModuleError(error) => { roots.contains(error.specifier()) } }; - let mut message = if let ModuleGraphError::ResolutionError(err) = &error { - enhanced_resolution_error_message(err) - } else { - format!("{error}") + let mut message = match &error { + ModuleGraphError::ResolutionError(resolution_error) => { + enhanced_resolution_error_message(resolution_error) + } + ModuleGraphError::TypesResolutionError(resolution_error) => { + format!( + "Failed resolving types. {}", + enhanced_resolution_error_message(resolution_error,) + ) + } + ModuleGraphError::ModuleError(_) => format!("{error}"), }; if let Some(range) = error.maybe_range() { @@ -125,14 +133,18 @@ pub fn graph_valid( } // ignore invalid downgrades and invalid local imports when vendoring - if let ModuleGraphError::ResolutionError(err) = &error { - if matches!( - err, - ResolutionError::InvalidDowngrade { .. } - | ResolutionError::InvalidLocalImport { .. } - ) { - return None; + match &error { + ModuleGraphError::ResolutionError(err) + | ModuleGraphError::TypesResolutionError(err) => { + if matches!( + err, + ResolutionError::InvalidDowngrade { .. } + | ResolutionError::InvalidLocalImport { .. } + ) { + return None; + } } + ModuleGraphError::ModuleError(_) => {} } } diff --git a/cli/lsp/documents.rs b/cli/lsp/documents.rs index bab94080f..57957780b 100644 --- a/cli/lsp/documents.rs +++ b/cli/lsp/documents.rs @@ -1796,6 +1796,7 @@ fn analyze_module( ) -> ModuleResult { match parsed_source_result { Ok(parsed_source) => Ok(deno_graph::parse_module_from_ast( + deno_graph::GraphKind::All, specifier, maybe_headers, parsed_source, diff --git a/cli/tests/testdata/run/error_type_definitions.ts.out b/cli/tests/testdata/run/error_type_definitions.ts.out index 5e1d73ca4..d60d4d483 100644 --- a/cli/tests/testdata/run/error_type_definitions.ts.out +++ b/cli/tests/testdata/run/error_type_definitions.ts.out @@ -1,2 +1,2 @@ -[WILDCARD]error: Relative import path "baz" not prefixed with / or ./ or ../ +[WILDCARD]error: Failed resolving types. Relative import path "baz" not prefixed with / or ./ or ../ at [WILDCARD]/type_definitions/bar.d.ts:[WILDCARD] diff --git a/cli/tools/info.rs b/cli/tools/info.rs index fa0ede437..9321eccb7 100644 --- a/cli/tools/info.rs +++ b/cli/tools/info.rs @@ -15,7 +15,6 @@ use deno_graph::GraphKind; use deno_graph::Module; use deno_graph::ModuleError; use deno_graph::ModuleGraph; -use deno_graph::ModuleGraphError; use deno_graph::Resolution; use deno_npm::resolution::NpmResolutionSnapshot; use deno_npm::NpmPackageId; @@ -508,8 +507,7 @@ impl<'a> GraphDisplayContext<'a> { Ok(()) } Err(err) => { - if let ModuleGraphError::ModuleError(ModuleError::Missing(_, _)) = *err - { + if let ModuleError::Missing(_, _) = *err { writeln!( writer, "{} module could not be found", @@ -648,39 +646,34 @@ impl<'a> GraphDisplayContext<'a> { fn build_error_info( &mut self, - err: &ModuleGraphError, + err: &ModuleError, specifier: &ModuleSpecifier, ) -> TreeNode { self.seen.insert(specifier.to_string()); match err { - ModuleGraphError::ModuleError(err) => match err { - ModuleError::InvalidTypeAssertion { .. } => { - self.build_error_msg(specifier, "(invalid import attribute)") - } - ModuleError::LoadingErr(_, _, _) => { - self.build_error_msg(specifier, "(loading error)") - } - ModuleError::ParseErr(_, _) => { - self.build_error_msg(specifier, "(parsing error)") - } - ModuleError::UnsupportedImportAttributeType { .. } => { - self.build_error_msg(specifier, "(unsupported import attribute)") - } - ModuleError::UnsupportedMediaType { .. } => { - self.build_error_msg(specifier, "(unsupported)") - } - ModuleError::Missing(_, _) | ModuleError::MissingDynamic(_, _) => { - self.build_error_msg(specifier, "(missing)") - } - ModuleError::UnknownPackage { .. } => { - self.build_error_msg(specifier, "(unknown package)") - } - ModuleError::UnknownPackageReq { .. } => { - self.build_error_msg(specifier, "(unknown package constraint)") - } - }, - ModuleGraphError::ResolutionError(_) => { - self.build_error_msg(specifier, "(resolution error)") + ModuleError::InvalidTypeAssertion { .. } => { + self.build_error_msg(specifier, "(invalid import attribute)") + } + ModuleError::LoadingErr(_, _, _) => { + self.build_error_msg(specifier, "(loading error)") + } + ModuleError::ParseErr(_, _) => { + self.build_error_msg(specifier, "(parsing error)") + } + ModuleError::UnsupportedImportAttributeType { .. } => { + self.build_error_msg(specifier, "(unsupported import attribute)") + } + ModuleError::UnsupportedMediaType { .. } => { + self.build_error_msg(specifier, "(unsupported)") + } + ModuleError::Missing(_, _) | ModuleError::MissingDynamic(_, _) => { + self.build_error_msg(specifier, "(missing)") + } + ModuleError::UnknownPackage { .. } => { + self.build_error_msg(specifier, "(unknown package)") + } + ModuleError::UnknownPackageReq { .. } => { + self.build_error_msg(specifier, "(unknown package constraint)") } } } diff --git a/cli/tools/repl/session.rs b/cli/tools/repl/session.rs index 8f8d085dd..1bf813b93 100644 --- a/cli/tools/repl/session.rs +++ b/cli/tools/repl/session.rs @@ -542,6 +542,7 @@ impl ReplSession { jsx_factory: "React.createElement".into(), jsx_fragment_factory: "React.Fragment".into(), jsx_import_source: None, + precompile_jsx: false, var_decl_imports: true, })? .text; |