diff options
| author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2024-04-02 23:43:03 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-03 00:43:03 +0200 |
| commit | c0b7454175afdefa0b8e73a04aadeb874eb2e766 (patch) | |
| tree | 6872a1169a0dc8afcdc132041973755ea594383b /cli | |
| parent | 29085895c9e7dc348f393c1154f7890663008612 (diff) | |
FUTURE: enable BYONM by default (#23194)
When `DENO_FUTURE=1` env var is present, then BYONM
("bring your own node_modules") is enabled by default.
That means that is there's a `package.json` present, users
are expected to explicitly install dependencies from that file.
Towards https://github.com/denoland/deno/issues/23151
Diffstat (limited to 'cli')
| -rw-r--r-- | cli/args/mod.rs | 10 | ||||
| -rw-r--r-- | cli/factory.rs | 2 | ||||
| -rw-r--r-- | cli/standalone/binary.rs | 2 |
3 files changed, 11 insertions, 3 deletions
diff --git a/cli/args/mod.rs b/cli/args/mod.rs index 76de434fd..e138e9d0b 100644 --- a/cli/args/mod.rs +++ b/cli/args/mod.rs @@ -1102,7 +1102,11 @@ impl CliOptions { } pub fn has_node_modules_dir(&self) -> bool { - self.maybe_node_modules_folder.is_some() || self.unstable_byonm() + if self.enable_future_features() { + self.maybe_node_modules_folder.is_some() + } else { + self.maybe_node_modules_folder.is_some() || self.unstable_byonm() + } } pub fn node_modules_dir_path(&self) -> Option<PathBuf> { @@ -1590,6 +1594,10 @@ impl CliOptions { .unwrap_or(false) } + pub fn use_byonm(&self) -> bool { + self.enable_future_features() + } + pub fn unstable_byonm(&self) -> bool { self.flags.unstable_config.byonm || NPM_PROCESS_STATE diff --git a/cli/factory.rs b/cli/factory.rs index a2755c129..bd8fa7ef6 100644 --- a/cli/factory.rs +++ b/cli/factory.rs @@ -402,7 +402,7 @@ impl CliFactory { .npm_resolver .get_or_try_init_async(async { let fs = self.fs(); - create_cli_npm_resolver(if self.options.unstable_byonm() { + create_cli_npm_resolver(if self.options.use_byonm() || self.options.unstable_byonm() { CliNpmResolverCreateOptions::Byonm(CliNpmResolverByonmCreateOptions { fs: fs.clone(), root_node_modules_dir: match self.options.node_modules_dir_path().clone() { diff --git a/cli/standalone/binary.rs b/cli/standalone/binary.rs index 2fc0c30c2..bd0735dd1 100644 --- a/cli/standalone/binary.rs +++ b/cli/standalone/binary.rs @@ -635,7 +635,7 @@ impl<'a> DenoCompileBinaryWriter<'a> { unstable_config: UnstableConfig { legacy_flag_enabled: cli_options.legacy_unstable_flag(), bare_node_builtins: cli_options.unstable_bare_node_builtins(), - byonm: cli_options.unstable_byonm(), + byonm: cli_options.use_byonm() || cli_options.unstable_byonm(), sloppy_imports: cli_options.unstable_sloppy_imports(), features: cli_options.unstable_features(), }, |
