diff options
-rw-r--r-- | cli/args/flags.rs | 10 | ||||
-rw-r--r-- | cli/tests/integration/publish_tests.rs | 6 | ||||
-rw-r--r-- | cli/tests/testdata/publish/invalid_fast_check.out | 4 | ||||
-rw-r--r-- | cli/tests/testdata/publish/no_zap.out (renamed from cli/tests/testdata/publish/no_fast_check.out) | 0 | ||||
-rw-r--r-- | cli/tools/registry/diagnostics.rs | 13 | ||||
-rw-r--r-- | cli/tools/registry/mod.rs | 12 |
6 files changed, 31 insertions, 14 deletions
diff --git a/cli/args/flags.rs b/cli/args/flags.rs index 3708f0d98..aa59eb36a 100644 --- a/cli/args/flags.rs +++ b/cli/args/flags.rs @@ -301,7 +301,7 @@ pub struct VendorFlags { pub struct PublishFlags { pub token: Option<String>, pub dry_run: bool, - pub no_fast_check: bool, + pub no_zap: bool, } #[derive(Clone, Debug, Eq, PartialEq)] @@ -2386,9 +2386,9 @@ fn publish_subcommand() -> Command { .action(ArgAction::SetTrue), ) .arg( - Arg::new("no-fast-check") - .long("no-fast-check") - .help("Skip Fast Check compatibility validation") + Arg::new("no-zap") + .long("no-zap") + .help("Skip Zap compatibility validation") .action(ArgAction::SetTrue), ) }) @@ -3824,7 +3824,7 @@ fn publish_parse(flags: &mut Flags, matches: &mut ArgMatches) { flags.subcommand = DenoSubcommand::Publish(PublishFlags { token: matches.remove_one("token"), dry_run: matches.get_flag("dry-run"), - no_fast_check: matches.get_flag("no-fast-check"), + no_zap: matches.get_flag("no-zap"), }); } diff --git a/cli/tests/integration/publish_tests.rs b/cli/tests/integration/publish_tests.rs index 675ceced2..6b6fac70d 100644 --- a/cli/tests/integration/publish_tests.rs +++ b/cli/tests/integration/publish_tests.rs @@ -36,9 +36,9 @@ itest!(invalid_fast_check { exit_code: 1, }); -itest!(no_fast_check { - args: "publish --no-fast-check --token 'sadfasdf'", - output: "publish/no_fast_check.out", +itest!(no_zap { + args: "publish --no-zap --token 'sadfasdf'", + output: "publish/no_zap.out", cwd: Some("publish/invalid_fast_check"), exit_code: 1, }); diff --git a/cli/tests/testdata/publish/invalid_fast_check.out b/cli/tests/testdata/publish/invalid_fast_check.out index f37638b9f..34b9b0314 100644 --- a/cli/tests/testdata/publish/invalid_fast_check.out +++ b/cli/tests/testdata/publish/invalid_fast_check.out @@ -9,4 +9,8 @@ error[zap-missing-explicit-return-type]: missing explicit return type in the pub info: all functions in the public API must have an explicit return type docs: https://jsr.io/go/zap-missing-explicit-return-type +This package contains Zap errors. Although conforming to Zap will +significantly improve the type checking performance of your library, +you can choose to skip it by providing the --no-zap flag. + error: Found 1 problem diff --git a/cli/tests/testdata/publish/no_fast_check.out b/cli/tests/testdata/publish/no_zap.out index ac26c67c2..ac26c67c2 100644 --- a/cli/tests/testdata/publish/no_fast_check.out +++ b/cli/tests/testdata/publish/no_zap.out diff --git a/cli/tools/registry/diagnostics.rs b/cli/tools/registry/diagnostics.rs index bd2a64d35..643a4fb2d 100644 --- a/cli/tools/registry/diagnostics.rs +++ b/cli/tools/registry/diagnostics.rs @@ -36,6 +36,7 @@ impl PublishDiagnosticsCollector { sources: &dyn ParsedSourceStore, ) -> Result<(), AnyError> { let mut errors = 0; + let mut has_zap_errors = false; let diagnostics = self.diagnostics.lock().unwrap().take(); let sources = SourceTextParsedSourceStore(sources); for diagnostic in diagnostics { @@ -43,8 +44,20 @@ impl PublishDiagnosticsCollector { if matches!(diagnostic.level(), DiagnosticLevel::Error) { errors += 1; } + if matches!(diagnostic, PublishDiagnostic::FastCheck(..)) { + has_zap_errors = true; + } } if errors > 0 { + if has_zap_errors { + eprintln!( + "This package contains Zap errors. Although conforming to Zap will" + ); + eprintln!("significantly improve the type checking performance of your library,"); + eprintln!("you can choose to skip it by providing the --no-zap flag."); + eprintln!(); + } + Err(anyhow!( "Found {} problem{}", errors, diff --git a/cli/tools/registry/mod.rs b/cli/tools/registry/mod.rs index cc2488a10..b2e7b2aad 100644 --- a/cli/tools/registry/mod.rs +++ b/cli/tools/registry/mod.rs @@ -641,7 +641,7 @@ async fn publish_package( async fn prepare_packages_for_publishing( cli_factory: &CliFactory, - no_fast_check: bool, + no_zap: bool, diagnostics_collector: &PublishDiagnosticsCollector, deno_json: ConfigFile, import_map: Arc<ImportMap>, @@ -664,7 +664,7 @@ async fn prepare_packages_for_publishing( module_graph_builder, type_checker, cli_options, - no_fast_check, + no_zap, diagnostics_collector, &[MemberRoots { name: get_deno_json_package_name(&deno_json)?, @@ -695,7 +695,7 @@ async fn prepare_packages_for_publishing( module_graph_builder, type_checker, cli_options, - no_fast_check, + no_zap, diagnostics_collector, &roots, ) @@ -740,7 +740,7 @@ async fn build_and_check_graph_for_publish( module_graph_builder: &ModuleGraphBuilder, type_checker: &TypeChecker, cli_options: &CliOptions, - no_fast_check: bool, + no_zap: bool, diagnostics_collector: &PublishDiagnosticsCollector, packages: &[MemberRoots], ) -> Result<Arc<deno_graph::ModuleGraph>, deno_core::anyhow::Error> { @@ -764,7 +764,7 @@ async fn build_and_check_graph_for_publish( collect_invalid_external_imports(&graph, diagnostics_collector); let mut has_fast_check_diagnostics = false; - if !no_fast_check { + if !no_zap { log::info!("Checking fast check type graph for errors..."); has_fast_check_diagnostics = collect_fast_check_type_graph_diagnostics( &graph, @@ -831,7 +831,7 @@ pub async fn publish( let (publish_order_graph, prepared_package_by_name) = prepare_packages_for_publishing( &cli_factory, - publish_flags.no_fast_check, + publish_flags.no_zap, &diagnostics_collector, config_file.clone(), import_map, |