diff options
99 files changed, 35 insertions, 1769 deletions
diff --git a/cli/args/flags.rs b/cli/args/flags.rs index f20252352..991e71b06 100644 --- a/cli/args/flags.rs +++ b/cli/args/flags.rs @@ -99,13 +99,6 @@ pub struct BenchFlags { } #[derive(Clone, Debug, Eq, PartialEq)] -pub struct BundleFlags { - pub source_file: String, - pub out_file: Option<String>, - pub watch: Option<WatchFlags>, -} - -#[derive(Clone, Debug, Eq, PartialEq)] pub struct CacheFlags { pub files: Vec<String>, } @@ -445,7 +438,7 @@ pub enum DenoSubcommand { Add(AddFlags), Remove(RemoveFlags), Bench(BenchFlags), - Bundle(BundleFlags), + Bundle, Cache(CacheFlags), Check(CheckFlags), Clean, @@ -1053,14 +1046,6 @@ impl Flags { }), .. }) - | DenoSubcommand::Bundle(BundleFlags { - watch: - Some(WatchFlags { - exclude: excluded_paths, - .. - }), - .. - }) | DenoSubcommand::Bench(BenchFlags { watch: Some(WatchFlags { @@ -1656,30 +1641,10 @@ glob {*_,*.,}bench.{js,mjs,ts,mts,jsx,tsx}: } fn bundle_subcommand() -> Command { - command("bundle", "⚠️ Warning: `deno bundle` is deprecated and will be removed in Deno 2.0. -Use an alternative bundler like \"deno_emit\", \"esbuild\" or \"rollup\" instead. - -Output a single JavaScript file with all dependencies. - deno bundle jsr:@std/http/file-server file_server.bundle.js + command("bundle", "⚠️ `deno bundle` was removed in Deno 2. -If no output file is given, the output is written to standard output: - deno bundle jsr:@std/http/file-server", UnstableArgsConfig::ResolutionOnly) +See the Deno 1.x to 2.x Migration Guide for migration instructions: https://docs.deno.com/runtime/manual/advanced/migrate_deprecations", UnstableArgsConfig::ResolutionOnly) .hide(true) - .defer(|cmd| { - compile_args(cmd) - .hide(true) - .arg(check_arg(true)) - .arg( - Arg::new("source_file") - .required_unless_present("help") - .value_hint(ValueHint::FilePath), - ) - .arg(Arg::new("out_file").value_hint(ValueHint::FilePath)) - .arg(watch_arg(false)) - .arg(watch_exclude_arg()) - .arg(no_clear_screen_arg()) - .arg(executable_ext_arg()) - }) } fn cache_subcommand() -> Command { @@ -4077,29 +4042,8 @@ fn bench_parse(flags: &mut Flags, matches: &mut ArgMatches) { }); } -fn bundle_parse(flags: &mut Flags, matches: &mut ArgMatches) { - flags.type_check_mode = TypeCheckMode::Local; - - compile_args_parse(flags, matches); - unstable_args_parse(flags, matches, UnstableArgsConfig::ResolutionOnly); - - let source_file = matches.remove_one::<String>("source_file").unwrap(); - - let out_file = - if let Some(out_file) = matches.remove_one::<String>("out_file") { - flags.permissions.allow_write = Some(vec![]); - Some(out_file) - } else { - None - }; - - ext_arg_parse(flags, matches); - - flags.subcommand = DenoSubcommand::Bundle(BundleFlags { - source_file, - out_file, - watch: watch_arg_parse(matches), - }); +fn bundle_parse(flags: &mut Flags, _matches: &mut ArgMatches) { + flags.subcommand = DenoSubcommand::Bundle; } fn cache_parse(flags: &mut Flags, matches: &mut ArgMatches) { @@ -7722,174 +7666,6 @@ mod tests { } #[test] - fn bundle() { - let r = flags_from_vec(svec!["deno", "bundle", "source.ts"]); - assert_eq!( - r.unwrap(), - Flags { - subcommand: DenoSubcommand::Bundle(BundleFlags { - source_file: "source.ts".to_string(), - out_file: None, - watch: Default::default(), - }), - type_check_mode: TypeCheckMode::Local, - ..Flags::default() - } - ); - } - - #[test] - fn bundle_with_config() { - let r = flags_from_vec(svec![ - "deno", - "bundle", - "--no-remote", - "--config", - "tsconfig.json", - "source.ts", - "bundle.js" - ]); - assert_eq!( - r.unwrap(), - Flags { - subcommand: DenoSubcommand::Bundle(BundleFlags { - source_file: "source.ts".to_string(), - out_file: Some("bundle.js".to_string()), - watch: Default::default(), - }), - permissions: PermissionFlags { - allow_write: Some(vec![]), - ..Default::default() - }, - no_remote: true, - type_check_mode: TypeCheckMode::Local, - config_flag: ConfigFlag::Path("tsconfig.json".to_owned()), - ..Flags::default() - } - ); - } - - #[test] - fn bundle_with_output() { - let r = flags_from_vec(svec!["deno", "bundle", "source.ts", "bundle.js"]); - assert_eq!( - r.unwrap(), - Flags { - subcommand: DenoSubcommand::Bundle(BundleFlags { - source_file: "source.ts".to_string(), - out_file: Some("bundle.js".to_string()), - watch: Default::default(), - }), - type_check_mode: TypeCheckMode::Local, - permissions: PermissionFlags { - allow_write: Some(vec![]), - ..Default::default() - }, - ..Flags::default() - } - ); - } - - #[test] - fn bundle_with_lock() { - let r = - flags_from_vec(svec!["deno", "bundle", "--lock=lock.json", "source.ts"]); - assert_eq!( - r.unwrap(), - Flags { - subcommand: DenoSubcommand::Bundle(BundleFlags { - source_file: "source.ts".to_string(), - out_file: None, - watch: Default::default(), - }), - type_check_mode: TypeCheckMode::Local, - lock: Some(String::from("lock.json")), - ..Flags::default() - } - ); - } - - #[test] - fn bundle_with_reload() { - let r = flags_from_vec(svec!["deno", "bundle", "--reload", "source.ts"]); - assert_eq!( - r.unwrap(), - Flags { - reload: true, - subcommand: DenoSubcommand::Bundle(BundleFlags { - source_file: "source.ts".to_string(), - out_file: None, - watch: Default::default(), - }), - type_check_mode: TypeCheckMode::Local, - ..Flags::default() - } - ); - } - - #[test] - fn bundle_nocheck() { - let r = flags_from_vec(svec!["deno", "bundle", "--no-check", "script.ts"]) - .unwrap(); - assert_eq!( - r, - Flags { - subcommand: DenoSubcommand::Bundle(BundleFlags { - source_file: "script.ts".to_string(), - out_file: None, - watch: Default::default(), - }), - type_check_mode: TypeCheckMode::None, - ..Flags::default() - } - ); - } - - #[test] - fn bundle_watch() { - let r = flags_from_vec(svec!["deno", "bundle", "--watch", "source.ts"]); - assert_eq!( - r.unwrap(), - Flags { - subcommand: DenoSubcommand::Bundle(BundleFlags { - source_file: "source.ts".to_string(), - out_file: None, - watch: Some(Default::default()), - }), - type_check_mode: TypeCheckMode::Local, - ..Flags::default() - } - ) - } - - #[test] - fn bundle_watch_with_no_clear_screen() { - let r = flags_from_vec(svec![ - "deno", - "bundle", - "--watch", - "--no-clear-screen", - "source.ts" - ]); - assert_eq!( - r.unwrap(), - Flags { - subcommand: DenoSubcommand::Bundle(BundleFlags { - source_file: "source.ts".to_string(), - out_file: None, - watch: Some(WatchFlags { - hmr: false, - no_clear_screen: true, - exclude: vec![], - }), - }), - type_check_mode: TypeCheckMode::Local, - ..Flags::default() - } - ) - } - - #[test] fn run_import_map() { let r = flags_from_vec(svec![ "deno", @@ -9389,30 +9165,6 @@ mod tests { } #[test] - fn bundle_with_cafile() { - let r = flags_from_vec(svec![ - "deno", - "bundle", - "--cert", - "example.crt", - "source.ts" - ]); - assert_eq!( - r.unwrap(), - Flags { - subcommand: DenoSubcommand::Bundle(BundleFlags { - source_file: "source.ts".to_string(), - out_file: None, - watch: Default::default(), - }), - type_check_mode: TypeCheckMode::Local, - ca_data: Some(CaData::File("example.crt".to_owned())), - ..Flags::default() - } - ); - } - - #[test] fn upgrade_with_ca_file() { let r = flags_from_vec(svec!["deno", "upgrade", "--cert", "example.crt"]); assert_eq!( diff --git a/cli/args/mod.rs b/cli/args/mod.rs index 030b19d80..aed5bc1b2 100644 --- a/cli/args/mod.rs +++ b/cli/args/mod.rs @@ -1136,9 +1136,6 @@ impl CliOptions { pub fn resolve_main_module(&self) -> Result<ModuleSpecifier, AnyError> { let main_module = match &self.flags.subcommand { - DenoSubcommand::Bundle(bundle_flags) => { - resolve_url_or_path(&bundle_flags.source_file, self.initial_cwd())? - } DenoSubcommand::Compile(compile_flags) => { resolve_url_or_path(&compile_flags.source_file, self.initial_cwd())? } @@ -1265,23 +1262,7 @@ impl CliOptions { &self, config_type: TsConfigType, ) -> Result<TsConfigForEmit, AnyError> { - let result = self.workspace().resolve_ts_config_for_emit(config_type); - - match result { - Ok(mut ts_config_for_emit) => { - if matches!(self.flags.subcommand, DenoSubcommand::Bundle(..)) { - // For backwards compatibility, force `experimentalDecorators` setting - // to true. - *ts_config_for_emit - .ts_config - .0 - .get_mut("experimentalDecorators") - .unwrap() = serde_json::Value::Bool(true); - } - Ok(ts_config_for_emit) - } - Err(err) => Err(err), - } + self.workspace().resolve_ts_config_for_emit(config_type) } pub fn resolve_inspector_server( diff --git a/cli/bench/main.rs b/cli/bench/main.rs index 68f4c6ce3..72fa7e963 100644 --- a/cli/bench/main.rs +++ b/cli/bench/main.rs @@ -143,29 +143,6 @@ const EXEC_TIME_BENCHMARKS: &[(&str, &[&str], Option<i32>)] = &[ ], None, ), - ( - "bundle", - &[ - "bundle", - "--unstable", - "--config", - "tests/config/deno.json", - "tests/util/std/http/file_server_test.ts", - ], - None, - ), - ( - "bundle_no_check", - &[ - "bundle", - "--no-check", - "--unstable", - "--config", - "tests/config/deno.json", - "tests/util/std/http/file_server_test.ts", - ], - None, - ), ]; const RESULT_KEYS: &[&str] = @@ -314,40 +291,6 @@ fn get_binary_sizes(target_dir: &Path) -> Result<HashMap<String, i64>> { Ok(sizes) } -const BUNDLES: &[(&str, &str)] = &[ - ("file_server", "./tests/util/std/http/file_server.ts"), - ("welcome", "./tests/testdata/welcome.ts"), -]; -fn bundle_benchmark(deno_exe: &Path) -> Result<HashMap<String, i64>> { - let mut sizes = HashMap::<String, i64>::new(); - - for (name, url) in BUNDLES { - let path = format!("{name}.bundle.js"); - test_util::run( - &[ - deno_exe.to_str().unwrap(), - "bundle", - "--unstable", - "--config", - "tests/config/deno.json", - url, - &path, - ], - None, - None, - None, - true, - ); - - let file = PathBuf::from(path); - assert!(file.is_file()); - sizes.insert(name.to_string(), file.metadata()?.len() as i64); - let _ = fs::remove_file(file); - } - - Ok(sizes) -} - fn run_max_mem_benchmark(deno_exe: &Path) -> Result<HashMap<String, i64>> { let mut results = HashMap::<String, i64>::new(); @@ -415,7 +358,6 @@ async fn main() -> Result<()> { let mut args = env::args(); let mut benchmarks = vec![ - "bundle", "exec_time", "binary_size", "cargo_deps", @@ -465,11 +407,6 @@ async fn main() -> Result<()> { ..Default::default() }; - if benchmarks.contains(&"bundle") { - let bundle_size = bundle_benchmark(&deno_exe)?; - new_data.bundle_size = bundle_size; - } - if benchmarks.contains(&"exec_time") { let exec_times = run_exec_time(&deno_exe, &target_dir)?; new_data.benchmark = exec_times; diff --git a/cli/graph_util.rs b/cli/graph_util.rs index f1188505e..bfd547a12 100644 --- a/cli/graph_util.rs +++ b/cli/graph_util.rs @@ -26,7 +26,6 @@ use deno_graph::ModuleLoadError; use deno_graph::WorkspaceFastCheckOption; use deno_runtime::fs_util::specifier_to_file_path; -use deno_core::anyhow::bail; use deno_core::error::custom_error; use deno_core::error::AnyError; use deno_core::parking_lot::Mutex; @@ -35,7 +34,6 @@ use deno_graph::source::Loader; use deno_graph::source::ResolutionMode; use deno_graph::source::ResolveError; use deno_graph::GraphKind; -use deno_graph::Module; use deno_graph::ModuleError; use deno_graph::ModuleGraph; use deno_graph::ModuleGraphError; @@ -722,23 +720,6 @@ impl ModuleGraphBuilder { } } -pub fn error_for_any_npm_specifier( - graph: &ModuleGraph, -) -> Result<(), AnyError> { - for module in graph.modules() { - match module { - Module::Npm(module) => { - bail!("npm specifiers have not yet been implemented for this subcommand (https://github.com/denoland/deno/issues/15960). Found: {}", module.specifier) - } - Module::Node(module) => { - bail!("Node specifiers have not yet been implemented for this subcommand (https://github.com/denoland/deno/issues/15960). Found: node:{}", module.module_name) - } - Module::Js(_) | Module::Json(_) | Module::External(_) => {} - } - } - Ok(()) -} - /// Adds more explanatory information to a resolution error. pub fn enhanced_resolution_error_message(error: &ResolutionError) -> String { let mut message = format_deno_graph_error(error); diff --git a/cli/main.rs b/cli/main.rs index 1c545ea45..33ccc198c 100644 --- a/cli/main.rs +++ b/cli/main.rs @@ -110,9 +110,7 @@ async fn run_subcommand(flags: Arc<Flags>) -> Result<i32, AnyError> { tools::bench::run_benchmarks(flags, bench_flags).await } }), - DenoSubcommand::Bundle(bundle_flags) => spawn_subcommand(async { - tools::bundle::bundle(flags, bundle_flags).await - }), + DenoSubcommand::Bundle => exit_with_message("⚠️ `deno bundle` was removed in Deno 2.\n\nSee the Deno 1.x to 2.x Migration Guide for migration instructions: https://docs.deno.com/runtime/manual/advanced/migrate_deprecations", 1), DenoSubcommand::Doc(doc_flags) => { spawn_subcommand(async { tools::doc::doc(flags, doc_flags).await }) } diff --git a/cli/tools/bundle.rs b/cli/tools/bundle.rs deleted file mode 100644 index f2157ecd8..000000000 --- a/cli/tools/bundle.rs +++ /dev/null @@ -1,164 +0,0 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. - -use std::path::PathBuf; -use std::sync::Arc; - -use deno_core::error::AnyError; -use deno_graph::Module; -use deno_terminal::colors; - -use crate::args::BundleFlags; -use crate::args::CliOptions; -use crate::args::Flags; -use crate::args::TsConfigType; -use crate::factory::CliFactory; -use crate::graph_util::error_for_any_npm_specifier; -use crate::util; -use crate::util::display; - -pub async fn bundle( - flags: Arc<Flags>, - bundle_flags: BundleFlags, -) -> Result<(), AnyError> { - log::info!( - "{}", - colors::yellow("⚠️ Warning: `deno bundle` is deprecated and will be removed in Deno 2.0.\nUse an alternative bundler like \"deno_emit\", \"esbuild\" or \"rollup\" instead."), - ); - - if let Some(watch_flags) = &bundle_flags.watch { - util::file_watcher::watch_func( - flags, - util::file_watcher::PrintConfig::new( - "Bundle", - !watch_flags.no_clear_screen, - ), - move |flags, watcher_communicator, _changed_paths| { - let bundle_flags = bundle_flags.clone(); - Ok(async move { - let factory = CliFactory::from_flags_for_watcher( - flags, - watcher_communicator.clone(), - ); - let cli_options = factory.cli_options()?; - let _ = watcher_communicator.watch_paths(cli_options.watch_paths()); - bundle_action(factory, &bundle_flags).await?; - - Ok(()) - }) - }, - ) - .await?; - } else { - let factory = CliFactory::from_flags(flags); - bundle_action(factory, &bundle_flags).await?; - } - - Ok(()) -} - -async fn bundle_action( - factory: CliFactory, - bundle_flags: &BundleFlags, -) -> Result<(), AnyError> { - let cli_options = factory.cli_options()?; - let module_specifier = cli_options.resolve_main_module()?; - log::debug!(">>>>> bundle START"); - let module_graph_creator = factory.module_graph_creator().await?; - let cli_options = factory.cli_options()?; - - let graph = module_graph_creator - .create_graph_and_maybe_check(vec![module_specifier.clone()]) - .await?; - - let mut paths_to_watch: Vec<PathBuf> = graph - .specifiers() - .filter_map(|(_, r)| { - r.ok().and_then(|module| match module { - Module::Js(m) => m.specifier.to_file_path().ok(), - Module::Json(m) => m.specifier.to_file_path().ok(), - // nothing to watch - Module::Node(_) | Module::Npm(_) | Module::External(_) => None, - }) - }) - .collect(); - - if let Ok(Some(import_map_path)) = cli_options - .resolve_specified_import_map_specifier() - .map(|ms| ms.and_then(|ref s| s.to_file_path().ok())) - { - paths_to_watch.push(import_map_path); - } - - // at the moment, we don't support npm specifiers in deno bundle, so show an error - error_for_any_npm_specifier(&graph)?; - - let bundle_output = bundle_module_graph(graph.as_ref(), cli_options)?; - log::debug!(">>>>> bundle END"); - let out_file = &bundle_flags.out_file; - - if let Some(out_file) = out_file { - let out_file = cli_options.initial_cwd().join(out_file); - let output_bytes = bundle_output.code.as_bytes(); - let output_len = output_bytes.len(); - util::fs::write_file(&out_file, output_bytes, 0o644)?; - log::info!( - "{} {:?} ({})", - colors::green("Emit"), - out_file, - colors::gray(display::human_size(output_len as f64)) - ); - if let Some(bundle_map) = bundle_output.maybe_map { - let map_bytes = bundle_map.as_bytes(); - let map_len = map_bytes.len(); - let ext = if let Some(curr_ext) = out_file.extension() { - format!("{}.map", curr_ext.to_string_lossy()) - } else { - "map".to_string() - }; - let map_out_file = out_file.with_extension(ext); - util::fs::write_file(&map_out_file, map_bytes, 0o644)?; - log::info!( - "{} {:?} ({})", - colors::green("Emit"), - map_out_file, - colors::gray(display::human_size(map_len as f64)) - ); - } - } else { - #[allow(clippy::print_stdout)] - { - println!("{}", bundle_output.code); - } - } - Ok(()) -} - -fn bundle_module_graph( - graph: &deno_graph::ModuleGraph, - cli_options: &CliOptions, -) -> Result<deno_emit::BundleEmit, AnyError> { - log::info!("{} {}", colors::green("Bundle"), graph.roots[0]); - - let ts_config_result = - cli_options.resolve_ts_config_for_emit(TsConfigType::Bundle)?; - if !cli_options.type_check_mode().is_true() { - if let Some(ignored_options) = ts_config_result.maybe_ignored_options { - log::warn!("{}", ignored_options); - } - } - - let (transpile_options, emit_options) = - crate::args::ts_config_to_transpile_and_emit_options( - ts_config_result.ts_config, - )?; - deno_emit::bundle_graph( - graph, - deno_emit::BundleOptions { - minify: false, - bundle_type: deno_emit::BundleType::Module, - emit_options, - emit_ignore_directives: true, - transpile_options, - }, - ) -} diff --git a/cli/tools/mod.rs b/cli/tools/mod.rs index 1e1c65565..0b720e2ac 100644 --- a/cli/tools/mod.rs +++ b/cli/tools/mod.rs @@ -1,7 +1,6 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. pub mod bench; -pub mod bundle; pub mod check; pub mod clean; pub mod compile; diff --git a/ext/node/polyfills/internal/child_process.ts b/ext/node/polyfills/internal/child_process.ts index 3547897b9..30c249277 100644 --- a/ext/node/polyfills/internal/child_process.ts +++ b/ext/node/polyfills/internal/child_process.ts @@ -1099,7 +1099,6 @@ const kNodeFlagsMap = new Map([ const kDenoSubcommands = new Set([ "add", "bench", - "bundle", "cache", "check", "compile", diff --git a/tests/integration/bundle_tests.rs b/tests/integration/bundle_tests.rs deleted file mode 100644 index 20f883293..000000000 --- a/tests/integration/bundle_tests.rs +++ /dev/null @@ -1,476 +0,0 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. - -use test_util as util; -use test_util::assert_contains; -use test_util::assert_ends_with; -use test_util::itest; -use test_util::TempDir; - -#[test] -fn bundle_exports() { - // First we have to generate a bundle of some module that has exports. - let mod1 = util::testdata_path().join("subdir/mod1.ts"); - assert!(mod1.is_file()); - let t = TempDir::new(); - let bundle = t.path().join("mod1.bundle.js"); - let mut deno = util::deno_cmd() - .current_dir(util::testdata_path()) - .arg("bundle") - .arg(mod1) - .arg(&bundle) - .spawn() - .unwrap(); - let status = deno.wait().unwrap(); - assert!(status.success()); - assert!(bundle.is_file()); - - // Now we try to use that bundle from another module. - let test = t.path().join("test.js"); - std::fs::write( - &test, - " - import { printHello3 } from \"./mod1.bundle.js\"; - printHello3(); ", - ) - .unwrap(); - - let output = util::deno_cmd() - .current_dir(util::testdata_path()) - .arg("run") - .arg(&test) - .output() - .unwrap(); - // check the output of the test.ts program. - assert_ends_with!( - std::str::from_utf8(&output.stdout).unwrap().trim(), - "Hello", - ); - assert_eq!(output.stderr, b""); -} - -#[test] -fn bundle_exports_no_check() { - // First we have to generate a bundle of some module that has exports. - let mod1 = util::testdata_path().join("subdir/mod1.ts"); - assert!(mod1.is_file()); - let t = TempDir::new(); - let bundle = t.path().join("mod1.bundle.js"); - let mut deno = util::deno_cmd() - .current_dir(util::testdata_path()) - .arg("bundle") - .arg(mod1) - .arg(&bundle) - .spawn() - .unwrap(); - let status = deno.wait().unwrap(); - assert!(status.success()); - assert!(bundle.is_file()); - - // Now we try to use that bundle from another module. - let test = t.path().join("test.js"); - std::fs::write( - &test, - " - import { printHello3 } from \"./mod1.bundle.js\"; - printHello3(); ", - ) - .unwrap(); - - let output = util::deno_cmd() - .current_dir(util::testdata_path()) - .arg("run") - .arg(&test) - .output() - .unwrap(); - // check the output of the test.ts program. - assert_ends_with!( - std::str::from_utf8(&output.stdout).unwrap().trim(), - "Hello", - ); - assert_eq!(output.stderr, b""); -} - -#[test] -fn bundle_circular() { - // First we have to generate a bundle of some module that has exports. - let circular1_path = util::testdata_path().join("subdir/circular1.ts"); - assert!(circular1_path.is_file()); - let t = TempDir::new(); - let bundle_path = t.path().join("circular1.bundle.js"); - - // run this twice to ensure it works even when cached - for _ in 0..2 { - let mut deno = util::deno_cmd_with_deno_dir(&t) - .current_dir(util::testdata_path()) - .arg("bundle") - .arg(&circular1_path) - .arg(&bundle_path) - .spawn() - .unwrap(); - let status = deno.wait().unwrap(); - assert!(status.success()); - assert!(bundle_path.is_file()); - } - - let output = util::deno_cmd_with_deno_dir(&t) - .current_dir(util::testdata_path()) - .arg("run") - .arg(&bundle_path) - .output() - .unwrap(); - // check the output of the bundle program. - assert_ends_with!( - std::str::from_utf8(&output.stdout).unwrap().trim(), - "f2\nf1", - ); - assert_eq!(output.stderr, b""); -} - -#[test] -fn bundle_single_module() { - // First we have to generate a bundle of some module that has exports. - let single_module = util::testdata_path().join("subdir/single_module.ts"); - assert!(single_module.is_file()); - let t = TempDir::new(); - let bundle = t.path().join("single_module.bundle.js"); - let mut deno = util::deno_cmd() - .current_dir(util::testdata_path()) - .arg("bundle") - .arg(single_module) - .arg(&bundle) - .spawn() - .unwrap(); - let status = deno.wait().unwrap(); - assert!(status.success()); - assert!(bundle.is_file()); - - let output = util::deno_cmd() - .current_dir(util::testdata_path()) - .arg("run") - .arg(&bundle) - .output() - .unwrap(); - // check the output of the bundle program. - assert_ends_with!( - std::str::from_utf8(&output.stdout).unwrap().trim(), - "Hello world!", - ); - assert_eq!(output.stderr, b""); -} - -#[test] -fn bundle_tla() { - // First we have to generate a bundle of some module that has exports. - let tla_import = util::testdata_path().join("subdir/tla.ts"); - assert!(tla_import.is_file()); - let t = TempDir::new(); - let bundle = t.path().join("tla.bundle.js"); - let mut deno = util::deno_cmd() - .current_dir(util::testdata_path()) - .arg("bundle") - .arg(tla_import) - .arg(&bundle) - .spawn() - .unwrap(); - let status = deno.wait().unwrap(); - assert!(status.success()); - assert!(bundle.is_file()); - - // Now we try to use that bundle from another module. - let test = t.path().join("test.js"); - std::fs::write( - &test, - " - import { foo } from \"./tla.bundle.js\"; - console.log(foo); ", - ) - .unwrap(); - - let output = util::deno_cmd() - .current_dir(util::testdata_path()) - .arg("run") - .arg(&test) - .output() - .unwrap(); - // check the output of the test.ts program. - assert_ends_with!( - std::str::from_utf8(&output.stdout).unwrap().trim(), - "Hello", - ); - assert_eq!(output.stderr, b""); -} - -#[test] -fn bundle_js() { - // First we have to generate a bundle of some module that has exports. - let mod6 = util::testdata_path().join("subdir/mod6.js"); - assert!(mod6.is_file()); - let t = TempDir::new(); - let bundle = t.path().join("mod6.bundle.js"); - let mut deno = util::deno_cmd() - .current_dir(util::testdata_path()) - .arg("bundle") - .arg(mod6) - .arg(&bundle) - .spawn() - .unwrap(); - let status = deno.wait().unwrap(); - assert!(status.success()); - assert!(bundle.is_file()); - - let output = util::deno_cmd() - .current_dir(util::testdata_path()) - .arg("run") - .arg(&bundle) - .output() - .unwrap(); - // check that nothing went to stderr - assert_eq!(output.stderr, b""); -} - -#[test] -fn bundle_dynamic_import() { - let _g = util::http_server(); - let dynamic_import = util::testdata_path().join("bundle/dynamic_import.ts"); - assert!(dynamic_import.is_file()); - let t = TempDir::new(); - let output_path = t.path().join("bundle_dynamic_import.bundle.js"); - let mut deno = util::deno_cmd() - .current_dir(util::testdata_path()) - .arg("bundle") - .arg(dynamic_import) - .arg(&output_path) - .spawn() - .unwrap(); - let status = deno.wait().unwrap(); - assert!(status.success()); - assert!(output_path.is_file()); - - let output = util::deno_cmd() - .current_dir(util::testdata_path()) - .arg("run") - .arg("--allow-net") - .arg("--quiet") - .arg(&output_path) - .output() - .unwrap(); - // check the output of the test.ts program. - assert_ends_with!( - std::str::from_utf8(&output.stdout).unwrap().trim(), - "Hello", - ); - assert_eq!(output.stderr, b""); -} - -#[test] -fn bundle_import_map() { - let import = util::testdata_path().join("bundle/import_map/main.ts"); - let import_map_path = - util::testdata_path().join("bundle/import_map/import_map.json"); - assert!(import.is_file()); - let t = TempDir::new(); - let output_path = t.path().join("import_map.bundle.js"); - let mut deno = util::deno_cmd() - .current_dir(util::testdata_path()) - .arg("bundle") - .arg("--import-map") - .arg(import_map_path) - .arg(import) - .arg(&output_path) - .spawn() - .unwrap(); - let status = deno.wait().unwrap(); - assert!(status.success()); - assert!(output_path.is_file()); - - // Now we try to use that bundle from another module. - let test = t.path().join("test.js"); - std::fs::write( - &test, - " - import { printHello3 } from \"./import_map.bundle.js\"; - printHello3(); ", - ) - .unwrap(); - - let output = util::deno_cmd() - .current_dir(util::testdata_path()) - .arg("run") - .arg("--check") - .arg(&test) - .output() - .unwrap(); - // check the output of the test.ts program. - assert_ends_with!( - std::str::from_utf8(&output.stdout).unwrap().trim(), - "Hello", - ); - assert_eq!(output.stderr, b""); -} - -#[test] -fn bundle_import_map_no_check() { - let import = util::testdata_path().join("bundle/import_map/main.ts"); - let import_map_path = - util::testdata_path().join("bundle/import_map/import_map.json"); - assert!(import.is_file()); - let t = TempDir::new(); - let output_path = t.path().join("import_map.bundle.js"); - let mut deno = util::deno_cmd() - .current_dir(util::testdata_path()) - .arg("bundle") - .arg("--import-map") - .arg(import_map_path) - .arg(import) - .arg(&output_path) - .spawn() - .unwrap(); - let status = deno.wait().unwrap(); - assert!(status.success()); - assert!(output_path.is_file()); - - // Now we try to use that bundle from another module. - let test = t.path().join("test.js"); - std::fs::write( - &test, - " - import { printHello3 } from \"./import_map.bundle.js\"; - printHello3(); ", - ) - .unwrap(); - - let output = util::deno_cmd() - .current_dir(util::testdata_path()) - .arg("run") - .arg(&test) - .output() - .unwrap(); - // check the output of the test.ts program. - assert_ends_with!( - std::str::from_utf8(&output.stdout).unwrap().trim(), - "Hello", - ); - assert_eq!(output.stderr, b""); -} - -#[test] -fn bundle_json_module() { - // First we have to generate a bundle of some module that has exports. - let mod7 = util::testdata_path().join("subdir/mod7.js"); - assert!(mod7.is_file()); - let t = TempDir::new(); - let bundle = t.path().join("mod7.bundle.js"); - let mut deno = util::deno_cmd() - .current_dir(util::testdata_path()) - .arg("bundle") - .arg(mod7) - .arg(&bundle) - .spawn() - .unwrap(); - let status = deno.wait().unwrap(); - assert!(status.success()); - assert!(bundle.is_file()); - - let output = util::deno_cmd() - .current_dir(util::testdata_path()) - .arg("run") - .arg(&bundle) - .output() - .unwrap(); - // check that nothing went to stderr - assert_eq!(output.stderr, b""); - // ensure the output looks right - assert_contains!(String::from_utf8(output.stdout).unwrap(), "with space",); -} - -#[test] -fn bundle_json_module_escape_sub() { - // First we have to generate a bundle of some module that has exports. - let mod8 = util::testdata_path().join("subdir/mod8.js"); - assert!(mod8.is_file()); - let t = TempDir::new(); - let bundle = t.path().join("mod8.bundle.js"); - let mut deno = util::deno_cmd() - .current_dir(util::testdata_path()) - .arg("bundle") - .arg(mod8) - .arg(&bundle) - .spawn() - .unwrap(); - let status = deno.wait().unwrap(); - assert!(status.success()); - assert!(bundle.is_file()); - - let output = util::deno_cmd() - .current_dir(util::testdata_path()) - .arg("run") - .arg(&bundle) - .output() - .unwrap(); - // check that nothing went to stderr - assert_eq!(output.stderr, b""); - // make sure the output looks right and the escapes were effective - assert_contains!( - String::from_utf8(output.stdout).unwrap(), - "${globalThis}`and string literal`", - ); -} - -itest!(bundle { - args: "bundle subdir/mod1.ts", - output: "bundle/bundle.test.out", -}); - -itest!(bundle_jsx { - args: "bundle run/jsx_import_from_ts.ts", - output: "bundle/jsx.out", -}); - -itest!(error_bundle_with_bare_import { - args: "bundle bundle/bare_imports/error_with_bare_import.ts", - output: "bundle/bare_imports/error_with_bare_import.ts.out", - exit_code: 1, -}); - -itest!(ts_decorators_bundle { - args: "bundle bundle/decorators/ts_decorators.ts", - output: "bundle/decorators/ts_decorators.out", -}); - -itest!(bundle_export_specifier_with_alias { - args: "bundle bundle/file_tests-fixture16.ts", - output: "bundle/fixture16.out", -}); - -itest!(bundle_ignore_directives { - args: "bundle subdir/mod1.ts", - output: "bundle/ignore_directives.test.out", -}); - -itest!(check_local_by_default_no_errors { - args: "bundle --quiet bundle/check_local_by_default/no_errors.ts", - output: "bundle/check_local_by_default/no_errors.out", - http_server: true, -}); - -itest!(check_local_by_default_type_error { - args: "bundle --quiet bundle/check_local_by_default/type_error.ts", - output: "bundle/check_local_by_default/type_error.out", - http_server: true, - exit_code: 1, -}); - -itest!(ts_without_extension { - args: "bundle --ext ts file_extensions/ts_without_extension", - output: "bundle/file_extensions/ts_without_extension.out", -}); - -itest!(js_without_extension { - args: "bundle --ext js file_extensions/js_without_extension", - output: "bundle/file_extensions/js_without_extension.out", -}); - -itest!(bundle_shebang_file { - args: "bundle subdir/shebang_file.js", - output: "bundle/shebang_file.bundle.out", -}); diff --git a/tests/integration/check_tests.rs b/tests/integration/check_tests.rs index bcc01cf5d..8bb0ddde2 100644 --- a/tests/integration/check_tests.rs +++ b/tests/integration/check_tests.rs @@ -37,11 +37,6 @@ itest!(check_jsximportsource_importmap_config { output_str: Some(""), }); -itest!(bundle_jsximportsource_importmap_config { - args: "bundle --quiet --config check/jsximportsource_importmap_config/deno.json check/jsximportsource_importmap_config/main.tsx", - output: "check/jsximportsource_importmap_config/main.bundle.js", -}); - itest!(jsx_not_checked { args: "check check/jsx_not_checked/main.jsx", output: "check/jsx_not_checked/main.out", diff --git a/tests/integration/lsp_tests.rs b/tests/integration/lsp_tests.rs index c3f2f9daa..f6dee785d 100644 --- a/tests/integration/lsp_tests.rs +++ b/tests/integration/lsp_tests.rs @@ -1184,8 +1184,7 @@ fn lsp_deno_task() { "deno.jsonc", r#"{ "tasks": { - "build": "deno test", - "some:test": "deno bundle mod.ts" + "build": "deno test" } }"#, ); @@ -1204,10 +1203,6 @@ fn lsp_deno_task() { "name": "build", "detail": "deno test", "sourceUri": temp_dir.url().join("deno.jsonc").unwrap(), - }, { - "name": "some:test", - "detail": "deno bundle mod.ts", - "sourceUri": temp_dir.url().join("deno.jsonc").unwrap(), } ]) ); diff --git a/tests/integration/mod.rs b/tests/integration/mod.rs index d35fabc02..ea3269aaa 100644 --- a/tests/integration/mod.rs +++ b/tests/integration/mod.rs @@ -9,8 +9,6 @@ #[path = "bench_tests.rs"] mod bench; -#[path = "bundle_tests.rs"] -mod bundle; #[path = "cache_tests.rs"] mod cache; #[path = "check_tests.rs"] diff --git a/tests/integration/watcher_tests.rs b/tests/integration/watcher_tests.rs index abc5365b8..91ac5611f 100644 --- a/tests/integration/watcher_tests.rs +++ b/tests/integration/watcher_tests.rs @@ -10,8 +10,6 @@ use util::DenoChild; use util::assert_not_contains; -const CLEAR_SCREEN: &str = r#"[2J"#; - /// Logs to stderr every time next_line() is called struct LoggingLines<R> where @@ -492,143 +490,6 @@ async fn fmt_check_all_files_on_each_change_test() { } #[flaky_test(tokio)] -async fn bundle_js_watch() { - use std::path::PathBuf; - // Test strategy extends this of test bundle_js by adding watcher - let t = TempDir::new(); - let file_to_watch = t.path().join("file_to_watch.ts"); - file_to_watch.write("console.log('Hello world');"); - assert!(file_to_watch.is_file()); - let t = TempDir::new(); - let bundle = t.path().join("mod6.bundle.js"); - let mut deno = util::deno_cmd() - .current_dir(t.path()) - .arg("bundle") - .arg(&file_to_watch) - .arg(&bundle) - .arg("--watch") - .env("NO_COLOR", "1") - .piped_output() - .spawn() - .unwrap(); - - let (_stdout_lines, mut stderr_lines) = child_lines(&mut deno); - - assert_contains!(next_line(&mut stderr_lines).await.unwrap(), "Warning"); - assert_contains!(next_line(&mut stderr_lines).await.unwrap(), "deno_emit"); - assert_contains!( - next_line(&mut stderr_lines).await.unwrap(), - "Bundle started" - ); - let line = next_line(&mut stderr_lines).await.unwrap(); - assert_contains!(line, "file_to_watch.ts"); - assert_contains!(line, "Check"); - assert_contains!(next_line(&mut stderr_lines).await.unwrap(), "Bundle"); - assert_contains!( - next_line(&mut stderr_lines).await.unwrap(), - "mod6.bundle.js" - ); - let file = PathBuf::from(&bundle); - assert!(file.is_file()); - - wait_contains("Bundle finished", &mut stderr_lines).await; - - file_to_watch.write("console.log('Hello world2');"); - - let line = next_line(&mut stderr_lines).await.unwrap(); - // Should not clear screen, as we are in non-TTY environment - assert_not_contains!(&line, CLEAR_SCREEN); - assert_contains!(&line, "File change detected!"); - assert_contains!(next_line(&mut stderr_lines).await.unwrap(), "Check"); - assert_contains!( - next_line(&mut stderr_lines).await.unwrap(), - "file_to_watch.ts" - ); - assert_contains!( - next_line(&mut stderr_lines).await.unwrap(), - "mod6.bundle.js" - ); - let file = PathBuf::from(&bundle); - assert!(file.is_file()); - wait_contains("Bundle finished", &mut stderr_lines).await; - - // Confirm that the watcher keeps on working even if the file is updated and has invalid syntax - file_to_watch.write("syntax error ^^"); - - assert_contains!( - next_line(&mut stderr_lines).await.unwrap(), - "File change detected!" - ); - assert_contains!(next_line(&mut stderr_lines).await.unwrap(), "error: "); - wait_contains("Bundle failed", &mut stderr_lines).await; - check_alive_then_kill(deno); -} - -/// Confirm that the watcher continues to work even if module resolution fails at the *first* attempt -#[flaky_test(tokio)] -async fn bundle_watch_not_exit() { - let t = TempDir::new(); - let file_to_watch = t.path().join("file_to_watch.ts"); - file_to_watch.write("syntax error ^^"); - let target_file = t.path().join("target.js"); - - let mut deno = util::deno_cmd() - .current_dir(t.path()) - .arg("bundle") - .arg(&file_to_watch) - .arg(&target_file) - .arg("--watch") - .env("NO_COLOR", "1") - .piped_output() - .spawn() - .unwrap(); - let (_stdout_lines, mut stderr_lines) = child_lines(&mut deno); - - assert_contains!(next_line(&mut stderr_lines).await.unwrap(), "Warning"); - assert_contains!(next_line(&mut stderr_lines).await.unwrap(), "deno_emit"); - assert_contains!( - next_line(&mut stderr_lines).await.unwrap(), - "Bundle started" - ); - assert_contains!(next_line(&mut stderr_lines).await.unwrap(), "error:"); - assert_eq!(next_line(&mut stderr_lines).await.unwrap(), ""); - assert_eq!( - next_line(&mut stderr_lines).await.unwrap(), - " syntax error ^^" - ); - assert_eq!( - next_line(&mut stderr_lines).await.unwrap(), - " ~~~~~" - ); - assert_contains!( - next_line(&mut stderr_lines).await.unwrap(), - "Bundle failed" - ); - // the target file hasn't been created yet - assert!(!target_file.is_file()); - - // Make sure the watcher actually restarts and works fine with the proper syntax - file_to_watch.write("console.log(42);"); - - assert_contains!( - next_line(&mut stderr_lines).await.unwrap(), - "File change detected" - ); - assert_contains!(next_line(&mut stderr_lines).await.unwrap(), "Check"); - let line = next_line(&mut stderr_lines).await.unwrap(); - // Should not clear screen, as we are in non-TTY environment - assert_not_contains!(&line, CLEAR_SCREEN); - assert_contains!(line, "file_to_watch.ts"); - assert_contains!(next_line(&mut stderr_lines).await.unwrap(), "target.js"); - - wait_contains("Bundle finished", &mut stderr_lines).await; - - // bundled file is created - assert!(target_file.is_file()); - check_alive_then_kill(deno); -} - -#[flaky_test(tokio)] async fn run_watch_no_dynamic() { let t = TempDir::new(); let file_to_watch = t.path().join("file_to_watch.js"); diff --git a/tests/specs/bundle/lockfile/__test__.jsonc b/tests/specs/bundle/lockfile/__test__.jsonc deleted file mode 100644 index 3fe64a28b..000000000 --- a/tests/specs/bundle/lockfile/__test__.jsonc +++ /dev/null @@ -1,5 +0,0 @@ -{ - "args": "bundle --lock=check_error.json http://127.0.0.1:4545/subdir/mod1.ts", - "output": "check_error.out", - "exitCode": 10 -} diff --git a/tests/specs/bundle/lockfile/check_error.json b/tests/specs/bundle/lockfile/check_error.json deleted file mode 100644 index a218d7000..000000000 --- a/tests/specs/bundle/lockfile/check_error.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "http://127.0.0.1:4545/subdir/mod1.ts": "bfc1037b02c99abc20367f739bca7455813a5950066abd77965bff33b6eece0f", - "http://127.0.0.1:4545/subdir/print_hello.ts": "fa6692c8f9ff3fb107e773c3ece5274e9d08be282867a1e3ded1d9c00fcaa63c", - "http://127.0.0.1:4545/subdir/subdir2/mod2.ts": "bad" -} diff --git a/tests/specs/bundle/lockfile/check_error.out b/tests/specs/bundle/lockfile/check_error.out deleted file mode 100644 index 6a63a01b4..000000000 --- a/tests/specs/bundle/lockfile/check_error.out +++ /dev/null @@ -1,12 +0,0 @@ -[WILDCARD] -error: Integrity check failed for remote specifier. The source code is invalid, as it does not match the expected hash in the lock file. - - Specifier: http://127.0.0.1:4545/subdir/subdir2/mod2.ts - Actual: 8b3b670d25d238dfa72df119140406b96766a00fee635f3606429fe065b18fd1 - Expected: bad - -This could be caused by: - * the lock file may be corrupt - * the source itself may be corrupt - -Investigate the lockfile; delete it to regenerate the lockfile or --reload to reload the source code from the server. diff --git a/tests/specs/bundle/removed/__test__.jsonc b/tests/specs/bundle/removed/__test__.jsonc new file mode 100644 index 000000000..b33842de2 --- /dev/null +++ b/tests/specs/bundle/removed/__test__.jsonc @@ -0,0 +1,13 @@ +{ + "steps": [ + { + "args": "bundle", + "output": "bundle.out", + "exitCode": 1 + }, + { + "args": "bundle --help", + "output": "bundle_help.out" + } + ] +} diff --git a/tests/specs/bundle/removed/bundle.out b/tests/specs/bundle/removed/bundle.out new file mode 100644 index 000000000..d1d8d00d6 --- /dev/null +++ b/tests/specs/bundle/removed/bundle.out @@ -0,0 +1,3 @@ +error: ⚠️ `deno bundle` was removed in Deno 2. + +See the Deno 1.x to 2.x Migration Guide for migration instructions: https://docs.deno.com/runtime/manual/advanced/migrate_deprecations diff --git a/tests/specs/bundle/removed/bundle_help.out b/tests/specs/bundle/removed/bundle_help.out new file mode 100644 index 000000000..d8e83b95d --- /dev/null +++ b/tests/specs/bundle/removed/bundle_help.out @@ -0,0 +1,10 @@ +⚠️ `deno bundle` was removed in Deno 2. + +See the Deno 1.x to 2.x Migration Guide for migration instructions: https://docs.deno.com/runtime/manual/advanced/migrate_deprecations + +Usage: deno bundle [OPTIONS] + +Options: + -q, --quiet Suppress diagnostic output + --unstable Enable all unstable features and APIs. Instead of using this flag, consider enabling individual unstable features + To view the list of individual unstable feature flags, run this command again with --help=unstable diff --git a/tests/specs/cert/cafile_bundle/RootCA.pem b/tests/specs/cert/cafile_bundle/RootCA.pem deleted file mode 100644 index c2f84ceeb..000000000 --- a/tests/specs/cert/cafile_bundle/RootCA.pem +++ /dev/null @@ -1,19 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIDIzCCAgugAwIBAgIJAMKPPW4tsOymMA0GCSqGSIb3DQEBCwUAMCcxCzAJBgNV -BAYTAlVTMRgwFgYDVQQDDA9FeGFtcGxlLVJvb3QtQ0EwIBcNMTkxMDIxMTYyODIy -WhgPMjExODA5MjcxNjI4MjJaMCcxCzAJBgNVBAYTAlVTMRgwFgYDVQQDDA9FeGFt -cGxlLVJvb3QtQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDMH/IO -2qtHfyBKwANNPB4K0q5JVSg8XxZdRpTTlz0CwU0oRO3uHrI52raCCfVeiQutyZop -eFZTDWeXGudGAFA2B5m3orWt0s+touPi8MzjsG2TQ+WSI66QgbXTNDitDDBtTVcV -5G3Ic+3SppQAYiHSekLISnYWgXLl+k5CnEfTowg6cjqjVr0KjL03cTN3H7b+6+0S -ws4rYbW1j4ExR7K6BFNH6572yq5qR20E6GqlY+EcOZpw4CbCk9lS8/CWuXze/vMs -OfDcc6K+B625d27wyEGZHedBomT2vAD7sBjvO8hn/DP1Qb46a8uCHR6NSfnJ7bXO -G1igaIbgY1zXirNdAgMBAAGjUDBOMB0GA1UdDgQWBBTzut+pwwDfqmMYcI9KNWRD -hxcIpTAfBgNVHSMEGDAWgBTzut+pwwDfqmMYcI9KNWRDhxcIpTAMBgNVHRMEBTAD -AQH/MA0GCSqGSIb3DQEBCwUAA4IBAQB9AqSbZ+hEglAgSHxAMCqRFdhVu7MvaQM0 -P090mhGlOCt3yB7kdGfsIrUW6nQcTz7PPQFRaJMrFHPvFvPootkBUpTYR4hTkdce -H6RCRu2Jxl4Y9bY/uezd9YhGCYfUtfjA6/TH9FcuZfttmOOlxOt01XfNvVMIR6RM -z/AYhd+DeOXjr35F/VHeVpnk+55L0PYJsm1CdEbOs5Hy1ecR7ACuDkXnbM4fpz9I -kyIWJwk2zJReKcJMgi1aIinDM9ao/dca1G99PHOw8dnr4oyoTiv8ao6PWiSRHHMi -MNf4EgWfK+tZMnuqfpfO9740KzfcVoMNo4QJD4yn5YxroUOO/Azi ------END CERTIFICATE----- diff --git a/tests/specs/cert/cafile_bundle/__test__.jsonc b/tests/specs/cert/cafile_bundle/__test__.jsonc deleted file mode 100644 index 75c6c87a9..000000000 --- a/tests/specs/cert/cafile_bundle/__test__.jsonc +++ /dev/null @@ -1,11 +0,0 @@ -{ - "tempDir": true, - "steps": [{ - "args": "bundle --cert RootCA.pem https://localhost:5545/subdir/mod1.ts mod1.bundle.js", - "flaky": true, - "output": "[WILDCARD]" - }, { - "args": "run --quiet --check test.js", - "output": "[WILDCARD]Hello\n" - }] -} diff --git a/tests/specs/cert/cafile_bundle/test.js b/tests/specs/cert/cafile_bundle/test.js deleted file mode 100644 index 475af44d2..000000000 --- a/tests/specs/cert/cafile_bundle/test.js +++ /dev/null @@ -1,2 +0,0 @@ -import { printHello3 } from "./mod1.bundle.js"; -printHello3(); diff --git a/tests/specs/npm/es_module/__test__.jsonc b/tests/specs/npm/es_module/__test__.jsonc index d72db753f..2ab61686e 100644 --- a/tests/specs/npm/es_module/__test__.jsonc +++ b/tests/specs/npm/es_module/__test__.jsonc @@ -14,11 +14,6 @@ "import chalk from 'npm:chalk@5'; console.log(chalk.green('chalk esm loads'));" ], "output": "main.out" - }, - "bundle": { - "args": "bundle --quiet main.js", - "output": "bundle.out", - "exitCode": 1 } } } diff --git a/tests/specs/npm/es_module/bundle.out b/tests/specs/npm/es_module/bundle.out deleted file mode 100644 index c749a236a..000000000 --- a/tests/specs/npm/es_module/bundle.out +++ /dev/null @@ -1 +0,0 @@ -error: npm specifiers have not yet been implemented for this subcommand (https://github.com/denoland/deno/issues/15960). Found: npm:/chalk@5.0.1 diff --git a/tests/testdata/bundle/bare_imports/error_with_bare_import.ts b/tests/testdata/bundle/bare_imports/error_with_bare_import.ts deleted file mode 100644 index c0748305d..000000000 --- a/tests/testdata/bundle/bare_imports/error_with_bare_import.ts +++ /dev/null @@ -1 +0,0 @@ -import "foo"; diff --git a/tests/testdata/bundle/bare_imports/error_with_bare_import.ts.out b/tests/testdata/bundle/bare_imports/error_with_bare_import.ts.out deleted file mode 100644 index 44d063a5e..000000000 --- a/tests/testdata/bundle/bare_imports/error_with_bare_import.ts.out +++ /dev/null @@ -1,2 +0,0 @@ -[WILDCARD]error: Relative import path "foo" not prefixed with / or ./ or ../ - at file:///[WILDCARD]/error_with_bare_import.ts:[WILDCARD] diff --git a/tests/testdata/bundle/bundle.test.out b/tests/testdata/bundle/bundle.test.out deleted file mode 100644 index 6b1c109d3..000000000 --- a/tests/testdata/bundle/bundle.test.out +++ /dev/null @@ -1,27 +0,0 @@ -[WILDCARD] -function printHello() { - console.log("Hello"); -} -function returnsFoo() { - return "Foo"; -} -function printHello2() { - printHello(); -} -function returnsHi() { - return "Hi"; -} -function returnsFoo2() { - return returnsFoo(); -} -function printHello3() { - printHello2(); -} -function throwsError() { - throw Error("exception from mod1"); -} -export { returnsHi as returnsHi }; -export { returnsFoo2 as returnsFoo2 }; -export { printHello3 as printHello3 }; -export { throwsError as throwsError }; - diff --git a/tests/testdata/bundle/check_local_by_default/no_errors.out b/tests/testdata/bundle/check_local_by_default/no_errors.out deleted file mode 100644 index c4559d1fa..000000000 --- a/tests/testdata/bundle/check_local_by_default/no_errors.out +++ /dev/null @@ -1,6 +0,0 @@ -// deno-fmt-ignore-file -// deno-lint-ignore-file -// This code was bundled using `deno bundle` and it's not recommended to edit it manually - -console.log(12); - diff --git a/tests/testdata/bundle/check_local_by_default/no_errors.ts b/tests/testdata/bundle/check_local_by_default/no_errors.ts deleted file mode 100644 index 2ae8c2692..000000000 --- a/tests/testdata/bundle/check_local_by_default/no_errors.ts +++ /dev/null @@ -1,3 +0,0 @@ -import * as a from "http://localhost:4545/subdir/type_error.ts"; - -console.log(a.a); diff --git a/tests/testdata/bundle/check_local_by_default/type_error.out b/tests/testdata/bundle/check_local_by_default/type_error.out deleted file mode 100644 index 6d53e9498..000000000 --- a/tests/testdata/bundle/check_local_by_default/type_error.out +++ /dev/null @@ -1,4 +0,0 @@ -error: TS2322 [ERROR]: Type '12' is not assignable to type '"b"'. -const b: "b" = 12; - ^ - at [WILDCARD]bundle/check_local_by_default/type_error.ts:3:7 diff --git a/tests/testdata/bundle/check_local_by_default/type_error.ts b/tests/testdata/bundle/check_local_by_default/type_error.ts deleted file mode 100644 index 5177ff944..000000000 --- a/tests/testdata/bundle/check_local_by_default/type_error.ts +++ /dev/null @@ -1,6 +0,0 @@ -import * as a from "http://localhost:4545/subdir/type_error.ts"; - -const b: "b" = 12; - -console.log(a.a); -console.log(b); diff --git a/tests/testdata/bundle/decorators/ts_decorators.out b/tests/testdata/bundle/decorators/ts_decorators.out deleted file mode 100644 index e988aadd3..000000000 --- a/tests/testdata/bundle/decorators/ts_decorators.out +++ /dev/null @@ -1,49 +0,0 @@ -[WILDCARD] -// deno-fmt-ignore-file -// deno-lint-ignore-file -// This code was bundled using `deno bundle` and it's not recommended to edit it manually - -function _ts_decorate(decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; -} -function a() { - console.log("a(): evaluated"); - return (_target, _propertyKey, _descriptor)=>{ - console.log("a(): called"); - }; -} -class B { - method() { - console.log("method"); - } -} -_ts_decorate([ - a() -], B.prototype, "method", null); -function _ts_decorate1(decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; -} -function Decorator() { - return function(target, propertyKey, descriptor) { - const originalFn = descriptor.value; - descriptor.value = async function(...args) { - return await originalFn.apply(this, args); - }; - return descriptor; - }; -} -class SomeClass { - async test() {} -} -_ts_decorate1([ - Decorator() -], SomeClass.prototype, "test", null); -new SomeClass().test(); -new B().method(); -[WILDCARD]
\ No newline at end of file diff --git a/tests/testdata/bundle/decorators/ts_decorators.ts b/tests/testdata/bundle/decorators/ts_decorators.ts deleted file mode 100644 index 61299bccf..000000000 --- a/tests/testdata/bundle/decorators/ts_decorators.ts +++ /dev/null @@ -1,25 +0,0 @@ -// deno-lint-ignore-file - -import { B } from "../../subdir/more_decorators.ts"; - -function Decorator() { - return function ( - target: Record<string, any>, - propertyKey: string, - descriptor: TypedPropertyDescriptor<any>, - ) { - const originalFn: Function = descriptor.value as Function; - descriptor.value = async function (...args: any[]) { - return await originalFn.apply(this, args); - }; - return descriptor; - }; -} - -class SomeClass { - @Decorator() - async test() {} -} - -new SomeClass().test(); -new B().method(); diff --git a/tests/testdata/bundle/dynamic_import.ts b/tests/testdata/bundle/dynamic_import.ts deleted file mode 100644 index d8c7d08ec..000000000 --- a/tests/testdata/bundle/dynamic_import.ts +++ /dev/null @@ -1,3 +0,0 @@ -const mod1 = await import("http://localhost:4545/subdir/mod1.ts"); - -mod1.printHello3(); diff --git a/tests/testdata/bundle/file_extensions/js_without_extension.out b/tests/testdata/bundle/file_extensions/js_without_extension.out deleted file mode 100644 index 0273e6207..000000000 --- a/tests/testdata/bundle/file_extensions/js_without_extension.out +++ /dev/null @@ -1,8 +0,0 @@ -[WILDCARD] -// deno-fmt-ignore-file -// deno-lint-ignore-file -// This code was bundled using `deno bundle` and it's not recommended to edit it manually - -"hello"; -console.log("executing javascript with no extension"); - diff --git a/tests/testdata/bundle/file_extensions/ts_without_extension.out b/tests/testdata/bundle/file_extensions/ts_without_extension.out deleted file mode 100644 index 39e355d14..000000000 --- a/tests/testdata/bundle/file_extensions/ts_without_extension.out +++ /dev/null @@ -1,7 +0,0 @@ -[WILDCARD] -// deno-fmt-ignore-file -// deno-lint-ignore-file -// This code was bundled using `deno bundle` and it's not recommended to edit it manually - -console.log("executing typescript with no extension"); - diff --git a/tests/testdata/bundle/file_tests-fixture01.ts b/tests/testdata/bundle/file_tests-fixture01.ts deleted file mode 100644 index 3598d0298..000000000 --- a/tests/testdata/bundle/file_tests-fixture01.ts +++ /dev/null @@ -1,3 +0,0 @@ -import * as a from "./subdir/a.ts"; - -console.log(a); diff --git a/tests/testdata/bundle/file_tests-fixture02.ts b/tests/testdata/bundle/file_tests-fixture02.ts deleted file mode 100644 index 0cd291329..000000000 --- a/tests/testdata/bundle/file_tests-fixture02.ts +++ /dev/null @@ -1,4 +0,0 @@ -import * as b from "./subdir/b.ts"; - -console.log(b.b); // "b" -console.log(b.c); // { c: "c", default: class C } diff --git a/tests/testdata/bundle/file_tests-fixture03.ts b/tests/testdata/bundle/file_tests-fixture03.ts deleted file mode 100644 index 78365ce13..000000000 --- a/tests/testdata/bundle/file_tests-fixture03.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { d } from "./subdir/d.ts"; - -console.log(d); diff --git a/tests/testdata/bundle/file_tests-fixture04.ts b/tests/testdata/bundle/file_tests-fixture04.ts deleted file mode 100644 index 590f4fef9..000000000 --- a/tests/testdata/bundle/file_tests-fixture04.ts +++ /dev/null @@ -1,3 +0,0 @@ -const a = await import("./subdir/a.ts"); - -console.log(a); diff --git a/tests/testdata/bundle/file_tests-fixture05.ts b/tests/testdata/bundle/file_tests-fixture05.ts deleted file mode 100644 index 19541ce59..000000000 --- a/tests/testdata/bundle/file_tests-fixture05.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { a } from "./subdir/e.ts"; - -console.log(a); diff --git a/tests/testdata/bundle/file_tests-fixture06.ts b/tests/testdata/bundle/file_tests-fixture06.ts deleted file mode 100644 index 3d94332df..000000000 --- a/tests/testdata/bundle/file_tests-fixture06.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { isMain, modUrl } from "./subdir/f.ts"; - -console.log(isMain, modUrl); -console.log(import.meta.main, import.meta.url); diff --git a/tests/testdata/bundle/file_tests-fixture07.ts b/tests/testdata/bundle/file_tests-fixture07.ts deleted file mode 100644 index 0475a6c53..000000000 --- a/tests/testdata/bundle/file_tests-fixture07.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { G } from "./subdir/g.ts"; -import { H } from "./subdir/h.ts"; - -console.log(new G(true), new H(true)); diff --git a/tests/testdata/bundle/file_tests-fixture08.ts b/tests/testdata/bundle/file_tests-fixture08.ts deleted file mode 100644 index 6af5d172e..000000000 --- a/tests/testdata/bundle/file_tests-fixture08.ts +++ /dev/null @@ -1 +0,0 @@ -export * as a from "./subdir/a.ts"; diff --git a/tests/testdata/bundle/file_tests-fixture09.ts b/tests/testdata/bundle/file_tests-fixture09.ts deleted file mode 100644 index 30ba983ee..000000000 --- a/tests/testdata/bundle/file_tests-fixture09.ts +++ /dev/null @@ -1 +0,0 @@ -export { a } from "./subdir/k.ts"; diff --git a/tests/testdata/bundle/file_tests-fixture10.ts b/tests/testdata/bundle/file_tests-fixture10.ts deleted file mode 100644 index bec555da8..000000000 --- a/tests/testdata/bundle/file_tests-fixture10.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { a as defaultA } from "./subdir/l.ts"; - -const o: { a?: string } = {}; - -const { a = defaultA } = o; - -console.log(a); diff --git a/tests/testdata/bundle/file_tests-fixture11.ts b/tests/testdata/bundle/file_tests-fixture11.ts deleted file mode 100644 index 1c361438f..000000000 --- a/tests/testdata/bundle/file_tests-fixture11.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { a as defaultA, O } from "./subdir/m.ts"; -export { O } from "./subdir/m.ts"; - -interface AOptions { - a?(); - c?: O; -} - -class A { - #a: () => void; - #c?: O; - constructor(o: AOptions = {}) { - const { - a = defaultA, - c, - } = o; - this.#a = a; - this.#c = c; - } - - a() { - this.#a(); - } - - c() { - console.log(this.#c); - } -} - -const a = new A(); -a.a(); -a.c(); diff --git a/tests/testdata/bundle/file_tests-fixture12.ts b/tests/testdata/bundle/file_tests-fixture12.ts deleted file mode 100644 index 32b9566bd..000000000 --- a/tests/testdata/bundle/file_tests-fixture12.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { a } from "./subdir/p.ts"; - -function b() { - a(); -} - -b(); diff --git a/tests/testdata/bundle/file_tests-fixture13.ts b/tests/testdata/bundle/file_tests-fixture13.ts deleted file mode 100644 index 7dc13534c..000000000 --- a/tests/testdata/bundle/file_tests-fixture13.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { D, d } from "./subdir/q.ts"; - -class A { - private s: D = d(); - - a() { - this.s.resolve(); - } -} - -new A(); diff --git a/tests/testdata/bundle/file_tests-fixture14.ts b/tests/testdata/bundle/file_tests-fixture14.ts deleted file mode 100644 index aa8eef1b8..000000000 --- a/tests/testdata/bundle/file_tests-fixture14.ts +++ /dev/null @@ -1,4 +0,0 @@ -// @deno-types="https://deno.land/x/lib/mod.d.ts" -import * as lib from "https://deno.land/x/lib/mod.js"; - -console.log(lib); diff --git a/tests/testdata/bundle/file_tests-fixture15.ts b/tests/testdata/bundle/file_tests-fixture15.ts deleted file mode 100644 index c1dd3bc89..000000000 --- a/tests/testdata/bundle/file_tests-fixture15.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function getIndex(c: string): number { - return "\x00\r\n\x85\u2028\u2029".indexOf(c); -} diff --git a/tests/testdata/bundle/file_tests-fixture16.ts b/tests/testdata/bundle/file_tests-fixture16.ts deleted file mode 100644 index 5d0b05e92..000000000 --- a/tests/testdata/bundle/file_tests-fixture16.ts +++ /dev/null @@ -1,6 +0,0 @@ -// todo(dsherret): use ./subdir/a.ts once fixtures are restored -export { a as test1 } from "./file_tests-fixture16_2.ts"; -export { a as test2 } from "./file_tests-fixture16_2.ts"; -import { a } from "./file_tests-fixture16_2.ts"; - -console.log(a); diff --git a/tests/testdata/bundle/file_tests-fixture16_2.ts b/tests/testdata/bundle/file_tests-fixture16_2.ts deleted file mode 100644 index 7115949c9..000000000 --- a/tests/testdata/bundle/file_tests-fixture16_2.ts +++ /dev/null @@ -1,2 +0,0 @@ -// todo(dsherret): delete this and use ./subdir/a.ts in the file once fixtures are restored -export const a = "a"; diff --git a/tests/testdata/bundle/file_tests-subdir-a.ts b/tests/testdata/bundle/file_tests-subdir-a.ts deleted file mode 100644 index 9233cce2f..000000000 --- a/tests/testdata/bundle/file_tests-subdir-a.ts +++ /dev/null @@ -1 +0,0 @@ -export const a = "a"; diff --git a/tests/testdata/bundle/file_tests-subdir-b.ts b/tests/testdata/bundle/file_tests-subdir-b.ts deleted file mode 100644 index 1cf751c22..000000000 --- a/tests/testdata/bundle/file_tests-subdir-b.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * as c from "./c.ts"; - -export const b = "b"; diff --git a/tests/testdata/bundle/file_tests-subdir-c.ts b/tests/testdata/bundle/file_tests-subdir-c.ts deleted file mode 100644 index 7cc01f993..000000000 --- a/tests/testdata/bundle/file_tests-subdir-c.ts +++ /dev/null @@ -1,2 +0,0 @@ -export const c = "c"; -export default class C {} diff --git a/tests/testdata/bundle/file_tests-subdir-d.ts b/tests/testdata/bundle/file_tests-subdir-d.ts deleted file mode 100644 index 9f1ba7f67..000000000 --- a/tests/testdata/bundle/file_tests-subdir-d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { a } from "./a.ts"; - -export const d = { a }; diff --git a/tests/testdata/bundle/file_tests-subdir-e.ts b/tests/testdata/bundle/file_tests-subdir-e.ts deleted file mode 100644 index 55e8e0e18..000000000 --- a/tests/testdata/bundle/file_tests-subdir-e.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./a.ts"; diff --git a/tests/testdata/bundle/file_tests-subdir-f.ts b/tests/testdata/bundle/file_tests-subdir-f.ts deleted file mode 100644 index 8bc8d9bf4..000000000 --- a/tests/testdata/bundle/file_tests-subdir-f.ts +++ /dev/null @@ -1,2 +0,0 @@ -export const isMain = import.meta.main; -export const modUrl = import.meta.url; diff --git a/tests/testdata/bundle/file_tests-subdir-g.ts b/tests/testdata/bundle/file_tests-subdir-g.ts deleted file mode 100644 index 3eb4cd3cc..000000000 --- a/tests/testdata/bundle/file_tests-subdir-g.ts +++ /dev/null @@ -1,12 +0,0 @@ -const g: number[] = []; - -export class G { - #g!: number[]; - constructor(shared: boolean) { - if (shared) { - this.#g = g; - } else { - this.#g = []; - } - } -} diff --git a/tests/testdata/bundle/file_tests-subdir-h.ts b/tests/testdata/bundle/file_tests-subdir-h.ts deleted file mode 100644 index 9c86dd5c5..000000000 --- a/tests/testdata/bundle/file_tests-subdir-h.ts +++ /dev/null @@ -1,12 +0,0 @@ -const g: number[] = []; - -export class H { - #g!: number[]; - constructor(shared: boolean) { - if (shared) { - this.#g = g; - } else { - this.#g = []; - } - } -} diff --git a/tests/testdata/bundle/file_tests-subdir-i.ts b/tests/testdata/bundle/file_tests-subdir-i.ts deleted file mode 100644 index 4ad9ce449..000000000 --- a/tests/testdata/bundle/file_tests-subdir-i.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function a(...d: string[]): string { - return d.join(" "); -} diff --git a/tests/testdata/bundle/file_tests-subdir-j.ts b/tests/testdata/bundle/file_tests-subdir-j.ts deleted file mode 100644 index ac7bce0ea..000000000 --- a/tests/testdata/bundle/file_tests-subdir-j.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function a(...d: string[]): string { - return d.join("/"); -} diff --git a/tests/testdata/bundle/file_tests-subdir-k.ts b/tests/testdata/bundle/file_tests-subdir-k.ts deleted file mode 100644 index 1b8a533f1..000000000 --- a/tests/testdata/bundle/file_tests-subdir-k.ts +++ /dev/null @@ -1,11 +0,0 @@ -import * as _i from "./i.ts"; -import * as _j from "./j.ts"; - -const k = globalThis.value ? _i : _j; - -export const i = _i; -export const j = _j; - -export const { - a, -} = k; diff --git a/tests/testdata/bundle/file_tests-subdir-l.ts b/tests/testdata/bundle/file_tests-subdir-l.ts deleted file mode 100644 index d767e6ad0..000000000 --- a/tests/testdata/bundle/file_tests-subdir-l.ts +++ /dev/null @@ -1 +0,0 @@ -export { a } from "./a.ts"; diff --git a/tests/testdata/bundle/file_tests-subdir-m.ts b/tests/testdata/bundle/file_tests-subdir-m.ts deleted file mode 100644 index 21e86d07c..000000000 --- a/tests/testdata/bundle/file_tests-subdir-m.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { a } from "./n.ts"; -export { O } from "./o.ts"; diff --git a/tests/testdata/bundle/file_tests-subdir-n.ts b/tests/testdata/bundle/file_tests-subdir-n.ts deleted file mode 100644 index ac3c37005..000000000 --- a/tests/testdata/bundle/file_tests-subdir-n.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function a() { - console.log("a"); -} diff --git a/tests/testdata/bundle/file_tests-subdir-o.ts b/tests/testdata/bundle/file_tests-subdir-o.ts deleted file mode 100644 index ab9753fea..000000000 --- a/tests/testdata/bundle/file_tests-subdir-o.ts +++ /dev/null @@ -1,5 +0,0 @@ -export enum O { - A, - B, - C, -} diff --git a/tests/testdata/bundle/file_tests-subdir-p.ts b/tests/testdata/bundle/file_tests-subdir-p.ts deleted file mode 100644 index 19b486f71..000000000 --- a/tests/testdata/bundle/file_tests-subdir-p.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./i.ts"; diff --git a/tests/testdata/bundle/file_tests-subdir-q.ts b/tests/testdata/bundle/file_tests-subdir-q.ts deleted file mode 100644 index eebe0a38b..000000000 --- a/tests/testdata/bundle/file_tests-subdir-q.ts +++ /dev/null @@ -1,13 +0,0 @@ -// deno-lint-ignore-file -export interface D { - resolve: any; - reject: any; -} - -export function d(): D { - let methods; - const promise = new Promise((resolve, reject) => { - methods = { resolve, reject }; - }); - return Object.assign(promise, methods); -} diff --git a/tests/testdata/bundle/fixture01.out b/tests/testdata/bundle/fixture01.out deleted file mode 100644 index a825140b7..000000000 --- a/tests/testdata/bundle/fixture01.out +++ /dev/null @@ -1,7 +0,0 @@ -const a = "a"; -const mod = function() { - return { - a: a - }; -}(); -console.log(mod); diff --git a/tests/testdata/bundle/fixture02.out b/tests/testdata/bundle/fixture02.out deleted file mode 100644 index 5c502e2f0..000000000 --- a/tests/testdata/bundle/fixture02.out +++ /dev/null @@ -1,12 +0,0 @@ -const c = "c"; -class C { -} -const mod = function() { - return { - default: C, - c: c - }; -}(); -const b = "b"; -console.log(b); -console.log(mod); diff --git a/tests/testdata/bundle/fixture03.out b/tests/testdata/bundle/fixture03.out deleted file mode 100644 index 524e77abb..000000000 --- a/tests/testdata/bundle/fixture03.out +++ /dev/null @@ -1,5 +0,0 @@ -const a = "a"; -const d = { - a -}; -console.log(d); diff --git a/tests/testdata/bundle/fixture04.out b/tests/testdata/bundle/fixture04.out deleted file mode 100644 index 37869205b..000000000 --- a/tests/testdata/bundle/fixture04.out +++ /dev/null @@ -1,2 +0,0 @@ -const a = await import("./subdir/a.ts"); -console.log(a); diff --git a/tests/testdata/bundle/fixture05.out b/tests/testdata/bundle/fixture05.out deleted file mode 100644 index 1289cca5f..000000000 --- a/tests/testdata/bundle/fixture05.out +++ /dev/null @@ -1,2 +0,0 @@ -const a = "a"; -console.log(a); diff --git a/tests/testdata/bundle/fixture06.out b/tests/testdata/bundle/fixture06.out deleted file mode 100644 index 47288d5e4..000000000 --- a/tests/testdata/bundle/fixture06.out +++ /dev/null @@ -1,12 +0,0 @@ -const importMeta = { - url: "file:///tests/subdir/f.ts", - main: false -}; -const isMain = importMeta.main; -const modUrl = importMeta.url; -const importMeta1 = { - url: "file:///tests/fixture06.ts", - main: import.meta.main -}; -console.log(isMain, modUrl); -console.log(importMeta1.main, importMeta1.url); diff --git a/tests/testdata/bundle/fixture07.out b/tests/testdata/bundle/fixture07.out deleted file mode 100644 index 39e6a11e8..000000000 --- a/tests/testdata/bundle/fixture07.out +++ /dev/null @@ -1,23 +0,0 @@ -const g = []; -class G { - #g; - constructor(shared){ - if (shared) { - this.#g = g; - } else { - this.#g = []; - } - } -} -const g1 = []; -class H { - #g; - constructor(shared1){ - if (shared1) { - this.#g = g1; - } else { - this.#g = []; - } - } -} -console.log(new G(true), new H(true)); diff --git a/tests/testdata/bundle/fixture08.out b/tests/testdata/bundle/fixture08.out deleted file mode 100644 index bfe40aa37..000000000 --- a/tests/testdata/bundle/fixture08.out +++ /dev/null @@ -1,7 +0,0 @@ -const a1 = "a"; -const mod = function() { - return { - a: a1 - }; -}(); -export { mod as a }; diff --git a/tests/testdata/bundle/fixture09.out b/tests/testdata/bundle/fixture09.out deleted file mode 100644 index e06cc92de..000000000 --- a/tests/testdata/bundle/fixture09.out +++ /dev/null @@ -1,19 +0,0 @@ -function a3(...d) { - return d.join(" "); -} -const mod = function() { - return { - a: a3 - }; -}(); -function a1(...d) { - return d.join("/"); -} -const mod1 = function() { - return { - a: a1 - }; -}(); -const k = globalThis.value ? mod : mod1; -const { a: a2 , } = k; -export { a2 as a }; diff --git a/tests/testdata/bundle/fixture10.out b/tests/testdata/bundle/fixture10.out deleted file mode 100644 index 5491e5e7f..000000000 --- a/tests/testdata/bundle/fixture10.out +++ /dev/null @@ -1,5 +0,0 @@ -const a = "a"; -const o = { -}; -const { a: a1 = a } = o; -console.log(a1); diff --git a/tests/testdata/bundle/fixture11.out b/tests/testdata/bundle/fixture11.out deleted file mode 100644 index 4f333a513..000000000 --- a/tests/testdata/bundle/fixture11.out +++ /dev/null @@ -1,30 +0,0 @@ -function a() { - console.log("a"); -} -var O1; -(function(O) { - O[O["A"] = 0] = "A"; - O[O["B"] = 1] = "B"; - O[O["C"] = 2] = "C"; -})(O1 || (O1 = { -})); -export { O1 as O }; -class A { - #a; - #c; - constructor(o = { - }){ - const { a: a1 = a , c , } = o; - this.#a = a1; - this.#c = c; - } - a() { - this.#a(); - } - c() { - console.log(this.#c); - } -} -const a2 = new A(); -a2.a(); -a2.c(); diff --git a/tests/testdata/bundle/fixture12.out b/tests/testdata/bundle/fixture12.out deleted file mode 100644 index 64e2d6cdb..000000000 --- a/tests/testdata/bundle/fixture12.out +++ /dev/null @@ -1,7 +0,0 @@ -function a(...d) { - return d.join(" "); -} -function b() { - a(); -} -b(); diff --git a/tests/testdata/bundle/fixture13.out b/tests/testdata/bundle/fixture13.out deleted file mode 100644 index 1c7a8c991..000000000 --- a/tests/testdata/bundle/fixture13.out +++ /dev/null @@ -1,17 +0,0 @@ -function d() { - let methods; - const promise = new Promise((resolve, reject)=>{ - methods = { - resolve, - reject - }; - }); - return Object.assign(promise, methods); -} -class A { - s = d(); - a() { - this.s.resolve(); - } -} -new A(); diff --git a/tests/testdata/bundle/fixture14.out b/tests/testdata/bundle/fixture14.out deleted file mode 100644 index 392bb6478..000000000 --- a/tests/testdata/bundle/fixture14.out +++ /dev/null @@ -1,2 +0,0 @@ -const mod = []; -console.log(mod); diff --git a/tests/testdata/bundle/fixture15.out b/tests/testdata/bundle/fixture15.out deleted file mode 100644 index dc72fdeff..000000000 --- a/tests/testdata/bundle/fixture15.out +++ /dev/null @@ -1,4 +0,0 @@ -function getIndex1(c) { - return "\x00\r\n\x85\u2028\u2029".indexOf(c); -} -export { getIndex1 as getIndex }; diff --git a/tests/testdata/bundle/fixture16.out b/tests/testdata/bundle/fixture16.out deleted file mode 100644 index 5e21c2a71..000000000 --- a/tests/testdata/bundle/fixture16.out +++ /dev/null @@ -1,6 +0,0 @@ -[WILDCARD] -const a = "a"; -export { a as test1 }; -export { a as test2 }; -console.log(a); - diff --git a/tests/testdata/bundle/https_deno.land-x-lib-a.ts b/tests/testdata/bundle/https_deno.land-x-lib-a.ts deleted file mode 100644 index a0a6f8e94..000000000 --- a/tests/testdata/bundle/https_deno.land-x-lib-a.ts +++ /dev/null @@ -1 +0,0 @@ -export const a: string[] = []; diff --git a/tests/testdata/bundle/https_deno.land-x-lib-b.js b/tests/testdata/bundle/https_deno.land-x-lib-b.js deleted file mode 100644 index 13cacdd8b..000000000 --- a/tests/testdata/bundle/https_deno.land-x-lib-b.js +++ /dev/null @@ -1 +0,0 @@ -export const b = []; diff --git a/tests/testdata/bundle/https_deno.land-x-lib-c.d.ts b/tests/testdata/bundle/https_deno.land-x-lib-c.d.ts deleted file mode 100644 index fac988e49..000000000 --- a/tests/testdata/bundle/https_deno.land-x-lib-c.d.ts +++ /dev/null @@ -1 +0,0 @@ -export const c: string[]; diff --git a/tests/testdata/bundle/https_deno.land-x-lib-c.js b/tests/testdata/bundle/https_deno.land-x-lib-c.js deleted file mode 100644 index 620ca0b66..000000000 --- a/tests/testdata/bundle/https_deno.land-x-lib-c.js +++ /dev/null @@ -1,3 +0,0 @@ -/// <reference types="./c.d.ts" /> - -export const c = []; diff --git a/tests/testdata/bundle/https_deno.land-x-lib-mod.d.ts b/tests/testdata/bundle/https_deno.land-x-lib-mod.d.ts deleted file mode 100644 index 76ed81df0..000000000 --- a/tests/testdata/bundle/https_deno.land-x-lib-mod.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -export * as a from "./a.ts"; -export * as b from "./b.js"; -export * as c from "./c.js"; - -export interface A { - a: string; -} - -export const mod: A[]; diff --git a/tests/testdata/bundle/https_deno.land-x-lib-mod.js b/tests/testdata/bundle/https_deno.land-x-lib-mod.js deleted file mode 100644 index 505162094..000000000 --- a/tests/testdata/bundle/https_deno.land-x-lib-mod.js +++ /dev/null @@ -1,5 +0,0 @@ -export * as a from "./a.ts"; -export * as b from "./b.js"; -export * as c from "./c.js"; - -export const mod = []; diff --git a/tests/testdata/bundle/ignore_directives.test.out b/tests/testdata/bundle/ignore_directives.test.out deleted file mode 100644 index b69c2632c..000000000 --- a/tests/testdata/bundle/ignore_directives.test.out +++ /dev/null @@ -1,6 +0,0 @@ -[WILDCARD] -// deno-fmt-ignore-file -// deno-lint-ignore-file -// This code was bundled using `deno bundle` and it's not recommended to edit it manually - -[WILDCARD] diff --git a/tests/testdata/bundle/import_map/import_map.json b/tests/testdata/bundle/import_map/import_map.json deleted file mode 100644 index c02f72718..000000000 --- a/tests/testdata/bundle/import_map/import_map.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "imports": { - "mod2": "../../subdir/subdir2/mod2.ts" - } -} diff --git a/tests/testdata/bundle/import_map/main.ts b/tests/testdata/bundle/import_map/main.ts deleted file mode 100644 index 74834de20..000000000 --- a/tests/testdata/bundle/import_map/main.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { printHello2, returnsFoo } from "mod2"; - -export function returnsHi(): string { - return "Hi"; -} - -export function returnsFoo2(): string { - return returnsFoo(); -} - -export function printHello3() { - printHello2(); -} - -export function throwsError() { - throw Error("exception from mod1"); -} diff --git a/tests/testdata/bundle/jsx.out b/tests/testdata/bundle/jsx.out deleted file mode 100644 index da83cde82..000000000 --- a/tests/testdata/bundle/jsx.out +++ /dev/null @@ -1,9 +0,0 @@ -[WILDCARD] -const React = { - createElement () {} -}; -function app() { - return React.createElement("div", null, React.createElement("h2", null, "asdf")); -} -console.log(app); - diff --git a/tests/testdata/bundle/shebang_file.bundle.out b/tests/testdata/bundle/shebang_file.bundle.out deleted file mode 100644 index d3369bc9c..000000000 --- a/tests/testdata/bundle/shebang_file.bundle.out +++ /dev/null @@ -1,12 +0,0 @@ -⚠️ Warning: `deno bundle` is deprecated and will be removed in Deno 2.0. -Use an alternative bundler like "deno_emit", "esbuild" or "rollup" instead. -Bundle file:///[WILDCARD]/subdir/shebang_file.js -#!/usr/bin/env -S deno run --allow-read -// deno-fmt-ignore-file -// deno-lint-ignore-file -// This code was bundled using `deno bundle` and it's not recommended to edit it manually - -for (const item of Deno.readDirSync(".")){ - console.log(item.name); -} - diff --git a/tests/testdata/check/jsximportsource_importmap_config/main.bundle.js b/tests/testdata/check/jsximportsource_importmap_config/main.bundle.js deleted file mode 100644 index 6f39c876e..000000000 --- a/tests/testdata/check/jsximportsource_importmap_config/main.bundle.js +++ /dev/null @@ -1,9 +0,0 @@ -// deno-fmt-ignore-file -// deno-lint-ignore-file -// This code was bundled using `deno bundle` and it's not recommended to edit it manually - -const makeParagraph = ()=>jsx("p", { - children: "A paragraph!" - }); -export { makeParagraph as makeParagraph }; - diff --git a/tools/lint.js b/tools/lint.js index ef47180c2..b644cb8c2 100755 --- a/tools/lint.js +++ b/tools/lint.js @@ -196,10 +196,9 @@ async function ensureNoNewITests() { // replace them with spec tests. const iTestCounts = { "bench_tests.rs": 0, - "bundle_tests.rs": 11, "cache_tests.rs": 0, "cert_tests.rs": 0, - "check_tests.rs": 23, + "check_tests.rs": 22, "compile_tests.rs": 0, "coverage_tests.rs": 0, "doc_tests.rs": 15, |