summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2023-02-14 02:13:44 +0100
committerGitHub <noreply@github.com>2023-02-14 02:13:44 +0100
commit0f1349bca8d40dff23098e141363c956a8dd7875 (patch)
treedcf35d1e29081973134a7fc9bff2bf55b2ef098c
parentbd6ddd9b469b01b3663bbd275b7b11f7ac6e1ec2 (diff)
feat: Deprecate 'deno bundle' subcommand (#17695)
This commit adds a deprecation warning when using "deno bundle" subcommand and removes it from the output of "deno help".
-rw-r--r--cli/args/flags.rs1
-rw-r--r--cli/tests/integration/watcher_tests.rs7
-rw-r--r--cli/tests/testdata/bundle/shebang_file.bundle.out2
-rw-r--r--cli/tools/bundle.rs9
4 files changed, 17 insertions, 2 deletions
diff --git a/cli/args/flags.rs b/cli/args/flags.rs
index ee8ec2563..21a940dc5 100644
--- a/cli/args/flags.rs
+++ b/cli/args/flags.rs
@@ -767,6 +767,7 @@ glob {*_,*.,}bench.{js,mjs,ts,mts,jsx,tsx}:
fn bundle_subcommand<'a>() -> Command<'a> {
compile_args(Command::new("bundle"))
+ .hide(true)
.arg(
Arg::new("source_file")
.takes_value(true)
diff --git a/cli/tests/integration/watcher_tests.rs b/cli/tests/integration/watcher_tests.rs
index 5ba16cd5e..99d5a5727 100644
--- a/cli/tests/integration/watcher_tests.rs
+++ b/cli/tests/integration/watcher_tests.rs
@@ -402,6 +402,8 @@ fn bundle_js_watch() {
let (_stdout_lines, mut stderr_lines) = child_lines(&mut deno);
+ assert_contains!(stderr_lines.next().unwrap(), "Warning");
+ assert_contains!(stderr_lines.next().unwrap(), "deno_emit");
assert_contains!(stderr_lines.next().unwrap(), "Check");
let next_line = stderr_lines.next().unwrap();
assert_contains!(&next_line, "Bundle started");
@@ -455,8 +457,9 @@ fn bundle_watch_not_exit() {
.unwrap();
let (_stdout_lines, mut stderr_lines) = child_lines(&mut deno);
- let next_line = stderr_lines.next().unwrap();
- assert_contains!(&next_line, "Bundle started");
+ assert_contains!(stderr_lines.next().unwrap(), "Warning");
+ assert_contains!(stderr_lines.next().unwrap(), "deno_emit");
+ assert_contains!(stderr_lines.next().unwrap(), "Bundle started");
assert_contains!(stderr_lines.next().unwrap(), "error:");
assert_eq!(stderr_lines.next().unwrap(), "");
assert_eq!(stderr_lines.next().unwrap(), " syntax error ^^");
diff --git a/cli/tests/testdata/bundle/shebang_file.bundle.out b/cli/tests/testdata/bundle/shebang_file.bundle.out
index df425f656..978fe6d97 100644
--- a/cli/tests/testdata/bundle/shebang_file.bundle.out
+++ b/cli/tests/testdata/bundle/shebang_file.bundle.out
@@ -1,3 +1,5 @@
+Warning "deno bundle" is deprecated and will be removed in the future.
+Use alternative bundlers 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
diff --git a/cli/tools/bundle.rs b/cli/tools/bundle.rs
index 86b28828b..6a9019cd8 100644
--- a/cli/tools/bundle.rs
+++ b/cli/tools/bundle.rs
@@ -25,6 +25,15 @@ pub async fn bundle(
bundle_flags: BundleFlags,
) -> Result<(), AnyError> {
let cli_options = Arc::new(CliOptions::from_flags(flags)?);
+
+ log::info!(
+ "{} \"deno bundle\" is deprecated and will be removed in the future.",
+ colors::yellow("Warning"),
+ );
+ log::info!(
+ "Use alternative bundlers like \"deno_emit\", \"esbuild\" or \"rollup\" instead."
+ );
+
let resolver = |_| {
let cli_options = cli_options.clone();
let source_file1 = &bundle_flags.source_file;