mirror of
https://github.com/denoland/deno.git
synced 2024-11-25 15:29:32 -05:00
refactor: remove DENO_FUTURE (#25314)
This commit is contained in:
parent
55137c9db4
commit
f891e73bbf
42 changed files with 248 additions and 478 deletions
4
Cargo.lock
generated
4
Cargo.lock
generated
|
@ -1375,9 +1375,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "deno_config"
|
name = "deno_config"
|
||||||
version = "0.31.0"
|
version = "0.32.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "efba70c2fbec59e6d0c6040376644803f2cebbb4d55a651cbab4794e390a8592"
|
checksum = "c774f2e49b4ca47f1fe5c39e1775d1434280a4f168252fed8f4a3f2230868448"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"deno_package_json",
|
"deno_package_json",
|
||||||
|
|
|
@ -65,7 +65,7 @@ winres.workspace = true
|
||||||
[dependencies]
|
[dependencies]
|
||||||
deno_ast = { workspace = true, features = ["bundler", "cjs", "codegen", "proposal", "react", "sourcemap", "transforms", "typescript", "view", "visit"] }
|
deno_ast = { workspace = true, features = ["bundler", "cjs", "codegen", "proposal", "react", "sourcemap", "transforms", "typescript", "view", "visit"] }
|
||||||
deno_cache_dir = { workspace = true }
|
deno_cache_dir = { workspace = true }
|
||||||
deno_config = { version = "=0.31.0", features = ["workspace", "sync"] }
|
deno_config = { version = "=0.32.0", features = ["workspace", "sync"] }
|
||||||
deno_core = { workspace = true, features = ["include_js_files_for_snapshotting"] }
|
deno_core = { workspace = true, features = ["include_js_files_for_snapshotting"] }
|
||||||
deno_doc = { version = "0.148.0", features = ["html", "syntect"] }
|
deno_doc = { version = "0.148.0", features = ["html", "syntect"] }
|
||||||
deno_emit = "=0.45.0"
|
deno_emit = "=0.45.0"
|
||||||
|
|
|
@ -10,7 +10,7 @@ use clap::ColorChoice;
|
||||||
use clap::Command;
|
use clap::Command;
|
||||||
use clap::ValueHint;
|
use clap::ValueHint;
|
||||||
use color_print::cstr;
|
use color_print::cstr;
|
||||||
use deno_config::deno_json::NodeModulesMode;
|
use deno_config::deno_json::NodeModulesDirMode;
|
||||||
use deno_config::glob::FilePatterns;
|
use deno_config::glob::FilePatterns;
|
||||||
use deno_config::glob::PathOrPatternSet;
|
use deno_config::glob::PathOrPatternSet;
|
||||||
use deno_core::anyhow::bail;
|
use deno_core::anyhow::bail;
|
||||||
|
@ -41,7 +41,6 @@ use crate::args::resolve_no_prompt;
|
||||||
use crate::util::fs::canonicalize_path;
|
use crate::util::fs::canonicalize_path;
|
||||||
|
|
||||||
use super::flags_net;
|
use super::flags_net;
|
||||||
use super::DENO_FUTURE;
|
|
||||||
|
|
||||||
#[derive(Clone, Debug, Default, Eq, PartialEq)]
|
#[derive(Clone, Debug, Default, Eq, PartialEq)]
|
||||||
pub enum ConfigFlag {
|
pub enum ConfigFlag {
|
||||||
|
@ -580,7 +579,6 @@ fn parse_packages_allowed_scripts(s: &str) -> Result<String, AnyError> {
|
||||||
pub struct UnstableConfig {
|
pub struct UnstableConfig {
|
||||||
pub legacy_flag_enabled: bool, // --unstable
|
pub legacy_flag_enabled: bool, // --unstable
|
||||||
pub bare_node_builtins: bool, // --unstable-bare-node-builts
|
pub bare_node_builtins: bool, // --unstable-bare-node-builts
|
||||||
pub byonm: bool,
|
|
||||||
pub sloppy_imports: bool,
|
pub sloppy_imports: bool,
|
||||||
pub features: Vec<String>, // --unstabe-kv --unstable-cron
|
pub features: Vec<String>, // --unstabe-kv --unstable-cron
|
||||||
}
|
}
|
||||||
|
@ -602,8 +600,7 @@ pub struct Flags {
|
||||||
pub cached_only: bool,
|
pub cached_only: bool,
|
||||||
pub type_check_mode: TypeCheckMode,
|
pub type_check_mode: TypeCheckMode,
|
||||||
pub config_flag: ConfigFlag,
|
pub config_flag: ConfigFlag,
|
||||||
pub node_modules_dir: Option<bool>,
|
pub node_modules_dir: Option<NodeModulesDirMode>,
|
||||||
pub node_modules_mode: Option<NodeModulesMode>,
|
|
||||||
pub vendor: Option<bool>,
|
pub vendor: Option<bool>,
|
||||||
pub enable_op_summary_metrics: bool,
|
pub enable_op_summary_metrics: bool,
|
||||||
pub enable_testing_features: bool,
|
pub enable_testing_features: bool,
|
||||||
|
@ -1114,7 +1111,6 @@ static ENV_VARIABLES_HELP: &str = cstr!(
|
||||||
<g>DENO_AUTH_TOKENS</> A semi-colon separated list of bearer tokens and hostnames
|
<g>DENO_AUTH_TOKENS</> A semi-colon separated list of bearer tokens and hostnames
|
||||||
to use when fetching remote modules from private repositories
|
to use when fetching remote modules from private repositories
|
||||||
<p(245)>(e.g. "abcde12345@deno.land;54321edcba@github.com")</>
|
<p(245)>(e.g. "abcde12345@deno.land;54321edcba@github.com")</>
|
||||||
<g>DENO_FUTURE</> Set to "1" to enable APIs that will take effect in Deno 2
|
|
||||||
<g>DENO_CERT</> Load certificate authorities from PEM encoded file
|
<g>DENO_CERT</> Load certificate authorities from PEM encoded file
|
||||||
<g>DENO_DIR</> Set the cache directory
|
<g>DENO_DIR</> Set the cache directory
|
||||||
<g>DENO_INSTALL_ROOT</> Set deno install's output directory
|
<g>DENO_INSTALL_ROOT</> Set deno install's output directory
|
||||||
|
@ -1508,11 +1504,7 @@ pub fn clap_root() -> Command {
|
||||||
.subcommand(fmt_subcommand())
|
.subcommand(fmt_subcommand())
|
||||||
.subcommand(init_subcommand())
|
.subcommand(init_subcommand())
|
||||||
.subcommand(info_subcommand())
|
.subcommand(info_subcommand())
|
||||||
.subcommand(if *DENO_FUTURE {
|
.subcommand(future_install_subcommand())
|
||||||
future_install_subcommand()
|
|
||||||
} else {
|
|
||||||
install_subcommand()
|
|
||||||
})
|
|
||||||
.subcommand(json_reference_subcommand())
|
.subcommand(json_reference_subcommand())
|
||||||
.subcommand(jupyter_subcommand())
|
.subcommand(jupyter_subcommand())
|
||||||
.subcommand(uninstall_subcommand())
|
.subcommand(uninstall_subcommand())
|
||||||
|
@ -2365,7 +2357,7 @@ TypeScript compiler cache: Subdirectory containing TS compiler output.",
|
||||||
.arg(no_lock_arg())
|
.arg(no_lock_arg())
|
||||||
.arg(config_arg())
|
.arg(config_arg())
|
||||||
.arg(import_map_arg())
|
.arg(import_map_arg())
|
||||||
.args(node_modules_args())
|
.arg(node_modules_dir_arg())
|
||||||
.arg(vendor_arg())
|
.arg(vendor_arg())
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new("json")
|
Arg::new("json")
|
||||||
|
@ -2375,22 +2367,13 @@ TypeScript compiler cache: Subdirectory containing TS compiler output.",
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn install_args(cmd: Command, deno_future: bool) -> Command {
|
fn install_args(cmd: Command) -> Command {
|
||||||
let cmd = if deno_future {
|
let cmd = cmd.arg(
|
||||||
cmd.arg(
|
Arg::new("cmd")
|
||||||
Arg::new("cmd")
|
.required_if_eq("global", "true")
|
||||||
.required_if_eq("global", "true")
|
.num_args(1..)
|
||||||
.num_args(1..)
|
.value_hint(ValueHint::FilePath),
|
||||||
.value_hint(ValueHint::FilePath),
|
);
|
||||||
)
|
|
||||||
} else {
|
|
||||||
cmd.arg(
|
|
||||||
Arg::new("cmd")
|
|
||||||
.required_unless_present("help")
|
|
||||||
.num_args(1..)
|
|
||||||
.value_hint(ValueHint::FilePath),
|
|
||||||
)
|
|
||||||
};
|
|
||||||
cmd
|
cmd
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new("name")
|
Arg::new("name")
|
||||||
|
@ -2466,40 +2449,7 @@ These must be added to the path manually if required.", UnstableArgsConfig::Reso
|
||||||
.visible_alias("i")
|
.visible_alias("i")
|
||||||
.defer(|cmd| {
|
.defer(|cmd| {
|
||||||
let cmd = runtime_args(cmd, true, true).arg(check_arg(true)).arg(allow_scripts_arg());
|
let cmd = runtime_args(cmd, true, true).arg(check_arg(true)).arg(allow_scripts_arg());
|
||||||
install_args(cmd, true)
|
install_args(cmd)
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
fn install_subcommand() -> Command {
|
|
||||||
command("install",
|
|
||||||
"Installs a script as an executable in the installation root's bin directory.
|
|
||||||
|
|
||||||
deno install --global --allow-net --allow-read jsr:@std/http/file-server
|
|
||||||
deno install -g https://examples.deno.land/color-logging.ts
|
|
||||||
|
|
||||||
To change the executable name, use -n/--name:
|
|
||||||
deno install -g --allow-net --allow-read -n serve jsr:@std/http/file-server
|
|
||||||
|
|
||||||
The executable name is inferred by default:
|
|
||||||
- Attempt to take the file stem of the URL path. The above example would
|
|
||||||
become 'file_server'.
|
|
||||||
- If the file stem is something generic like 'main', 'mod', 'index' or 'cli',
|
|
||||||
and the path has no parent, take the file name of the parent path. Otherwise
|
|
||||||
settle with the generic name.
|
|
||||||
- If the resulting name has an '@...' suffix, strip it.
|
|
||||||
|
|
||||||
To change the installation root, use --root:
|
|
||||||
deno install -g --allow-net --allow-read --root /usr/local jsr:@std/http/file-server
|
|
||||||
|
|
||||||
The installation root is determined, in order of precedence:
|
|
||||||
- --root option
|
|
||||||
- DENO_INSTALL_ROOT environment variable
|
|
||||||
- $HOME/.deno
|
|
||||||
|
|
||||||
These must be added to the path manually if required.", UnstableArgsConfig::ResolutionAndRuntime)
|
|
||||||
.defer(|cmd| {
|
|
||||||
let cmd = runtime_args(cmd, true, true).arg(check_arg(true));
|
|
||||||
install_args(cmd, false)
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3180,7 +3130,7 @@ Remote modules and multiple modules may also be specified:
|
||||||
.arg(config_arg())
|
.arg(config_arg())
|
||||||
.arg(import_map_arg())
|
.arg(import_map_arg())
|
||||||
.arg(lock_arg())
|
.arg(lock_arg())
|
||||||
.args(node_modules_args())
|
.arg(node_modules_dir_arg())
|
||||||
.arg(vendor_arg())
|
.arg(vendor_arg())
|
||||||
.arg(reload_arg())
|
.arg(reload_arg())
|
||||||
.arg(ca_file_arg())
|
.arg(ca_file_arg())
|
||||||
|
@ -3242,7 +3192,7 @@ fn compile_args_without_check_args(app: Command) -> Command {
|
||||||
.arg(import_map_arg())
|
.arg(import_map_arg())
|
||||||
.arg(no_remote_arg())
|
.arg(no_remote_arg())
|
||||||
.arg(no_npm_arg())
|
.arg(no_npm_arg())
|
||||||
.args(node_modules_args())
|
.arg(node_modules_dir_arg())
|
||||||
.arg(vendor_arg())
|
.arg(vendor_arg())
|
||||||
.arg(config_arg())
|
.arg(config_arg())
|
||||||
.arg(no_config_arg())
|
.arg(no_config_arg())
|
||||||
|
@ -3919,48 +3869,35 @@ fn no_npm_arg() -> Arg {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn node_modules_arg_parse(flags: &mut Flags, matches: &mut ArgMatches) {
|
fn node_modules_arg_parse(flags: &mut Flags, matches: &mut ArgMatches) {
|
||||||
if *DENO_FUTURE {
|
let value = matches.remove_one::<NodeModulesDirMode>("node-modules-dir");
|
||||||
let value = matches.remove_one::<NodeModulesMode>("node-modules");
|
if let Some(mode) = value {
|
||||||
if let Some(mode) = value {
|
flags.node_modules_dir = Some(mode);
|
||||||
flags.node_modules_mode = Some(mode);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
flags.node_modules_dir = matches.remove_one::<bool>("node-modules-dir");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn node_modules_args() -> Vec<Arg> {
|
fn node_modules_dir_arg() -> Arg {
|
||||||
if *DENO_FUTURE {
|
fn parse_node_modules_dir_mode(
|
||||||
vec![
|
s: &str,
|
||||||
Arg::new("node-modules")
|
) -> Result<NodeModulesDirMode, String> {
|
||||||
.long("node-modules")
|
match s {
|
||||||
.num_args(0..=1)
|
"auto" | "true" => Ok(NodeModulesDirMode::Auto),
|
||||||
.value_parser(NodeModulesMode::parse)
|
"manual" => Ok(NodeModulesDirMode::Manual),
|
||||||
.value_name("MODE")
|
"none" | "false" => Ok(NodeModulesDirMode::None),
|
||||||
.require_equals(true)
|
_ => Err(format!(
|
||||||
.help("Sets the node modules management mode for npm packages")
|
"Invalid value '{}': expected \"auto\", \"manual\" or \"none\"",
|
||||||
.help_heading(DEPENDENCY_MANAGEMENT_HEADING),
|
s
|
||||||
Arg::new("node-modules-dir")
|
)),
|
||||||
.long("node-modules-dir")
|
}
|
||||||
.num_args(0..=1)
|
|
||||||
.value_parser(clap::builder::UnknownArgumentValueParser::suggest_arg(
|
|
||||||
"--node-modules",
|
|
||||||
))
|
|
||||||
.require_equals(true),
|
|
||||||
]
|
|
||||||
} else {
|
|
||||||
vec![
|
|
||||||
Arg::new("node-modules-dir")
|
|
||||||
.long("node-modules-dir")
|
|
||||||
.num_args(0..=1)
|
|
||||||
.value_parser(value_parser!(bool))
|
|
||||||
.value_name("ENABLED")
|
|
||||||
.default_missing_value("true")
|
|
||||||
.require_equals(true)
|
|
||||||
.help("Enables or disables the use of a local node_modules folder for npm packages")
|
|
||||||
.help_heading(DEPENDENCY_MANAGEMENT_HEADING)
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Arg::new("node-modules-dir")
|
||||||
|
.long("node-modules-dir")
|
||||||
|
.num_args(0..=1)
|
||||||
|
.value_parser(clap::builder::ValueParser::new(parse_node_modules_dir_mode))
|
||||||
|
.value_name("MODE")
|
||||||
|
.require_equals(true)
|
||||||
|
.help("Sets the node modules management mode for npm packages")
|
||||||
|
.help_heading(DEPENDENCY_MANAGEMENT_HEADING)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn vendor_arg() -> Arg {
|
fn vendor_arg() -> Arg {
|
||||||
|
@ -4039,7 +3976,6 @@ impl Iterator for UnstableArgsIter {
|
||||||
Arg::new("unstable-byonm")
|
Arg::new("unstable-byonm")
|
||||||
.long("unstable-byonm")
|
.long("unstable-byonm")
|
||||||
.help("Enable unstable 'bring your own node_modules' feature")
|
.help("Enable unstable 'bring your own node_modules' feature")
|
||||||
.env("DENO_UNSTABLE_BYONM")
|
|
||||||
.value_parser(FalseyValueParser::new())
|
.value_parser(FalseyValueParser::new())
|
||||||
.action(ArgAction::SetTrue)
|
.action(ArgAction::SetTrue)
|
||||||
.hide(true)
|
.hide(true)
|
||||||
|
@ -4476,7 +4412,7 @@ fn install_parse(flags: &mut Flags, matches: &mut ArgMatches) {
|
||||||
runtime_args_parse(flags, matches, true, true);
|
runtime_args_parse(flags, matches, true, true);
|
||||||
|
|
||||||
let global = matches.get_flag("global");
|
let global = matches.get_flag("global");
|
||||||
if global || !*DENO_FUTURE {
|
if global {
|
||||||
let root = matches.remove_one::<String>("root");
|
let root = matches.remove_one::<String>("root");
|
||||||
let force = matches.get_flag("force");
|
let force = matches.get_flag("force");
|
||||||
let name = matches.remove_one::<String>("name");
|
let name = matches.remove_one::<String>("name");
|
||||||
|
@ -5422,7 +5358,6 @@ fn unstable_args_parse(
|
||||||
|
|
||||||
flags.unstable_config.bare_node_builtins =
|
flags.unstable_config.bare_node_builtins =
|
||||||
matches.get_flag("unstable-bare-node-builtins");
|
matches.get_flag("unstable-bare-node-builtins");
|
||||||
flags.unstable_config.byonm = matches.get_flag("unstable-byonm");
|
|
||||||
flags.unstable_config.sloppy_imports =
|
flags.unstable_config.sloppy_imports =
|
||||||
matches.get_flag("unstable-sloppy-imports");
|
matches.get_flag("unstable-sloppy-imports");
|
||||||
|
|
||||||
|
|
|
@ -239,12 +239,6 @@ impl CliLockfile {
|
||||||
}
|
}
|
||||||
let lockfile = self.lockfile.lock();
|
let lockfile = self.lockfile.lock();
|
||||||
if lockfile.has_content_changed {
|
if lockfile.has_content_changed {
|
||||||
let suggested = if *super::DENO_FUTURE {
|
|
||||||
"`deno cache --frozen=false`, `deno install --frozen=false`,"
|
|
||||||
} else {
|
|
||||||
"`deno cache --frozen=false`"
|
|
||||||
};
|
|
||||||
|
|
||||||
let contents =
|
let contents =
|
||||||
std::fs::read_to_string(&lockfile.filename).unwrap_or_default();
|
std::fs::read_to_string(&lockfile.filename).unwrap_or_default();
|
||||||
let new_contents = lockfile.as_json_string();
|
let new_contents = lockfile.as_json_string();
|
||||||
|
@ -252,7 +246,7 @@ impl CliLockfile {
|
||||||
// has an extra newline at the end
|
// has an extra newline at the end
|
||||||
let diff = diff.trim_end();
|
let diff = diff.trim_end();
|
||||||
Err(deno_core::anyhow::anyhow!(
|
Err(deno_core::anyhow::anyhow!(
|
||||||
"The lockfile is out of date. Run {suggested} or rerun with `--frozen=false` to update it.\nchanges:\n{diff}"
|
"The lockfile is out of date. Run `deno cache --frozen=false`, `deno install --frozen=false`, or rerun with `--frozen=false` to update it.\nchanges:\n{diff}"
|
||||||
))
|
))
|
||||||
} else {
|
} else {
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
131
cli/args/mod.rs
131
cli/args/mod.rs
|
@ -8,8 +8,9 @@ mod lockfile;
|
||||||
mod package_json;
|
mod package_json;
|
||||||
|
|
||||||
use deno_ast::SourceMapOption;
|
use deno_ast::SourceMapOption;
|
||||||
use deno_config::deno_json::NodeModulesMode;
|
use deno_config::deno_json::NodeModulesDirMode;
|
||||||
use deno_config::workspace::CreateResolverOptions;
|
use deno_config::workspace::CreateResolverOptions;
|
||||||
|
use deno_config::workspace::FolderConfigs;
|
||||||
use deno_config::workspace::PackageJsonDepResolution;
|
use deno_config::workspace::PackageJsonDepResolution;
|
||||||
use deno_config::workspace::VendorEnablement;
|
use deno_config::workspace::VendorEnablement;
|
||||||
use deno_config::workspace::Workspace;
|
use deno_config::workspace::Workspace;
|
||||||
|
@ -51,7 +52,6 @@ use deno_core::anyhow::Context;
|
||||||
use deno_core::error::AnyError;
|
use deno_core::error::AnyError;
|
||||||
use deno_core::serde_json;
|
use deno_core::serde_json;
|
||||||
use deno_core::url::Url;
|
use deno_core::url::Url;
|
||||||
use deno_runtime::deno_node::PackageJson;
|
|
||||||
use deno_runtime::deno_permissions::PermissionsOptions;
|
use deno_runtime::deno_permissions::PermissionsOptions;
|
||||||
use deno_runtime::deno_tls::deno_native_certs::load_native_certs;
|
use deno_runtime::deno_tls::deno_native_certs::load_native_certs;
|
||||||
use deno_runtime::deno_tls::rustls;
|
use deno_runtime::deno_tls::rustls;
|
||||||
|
@ -64,6 +64,7 @@ use dotenvy::from_filename;
|
||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
|
use std::borrow::Cow;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::io::BufReader;
|
use std::io::BufReader;
|
||||||
|
@ -117,9 +118,6 @@ pub static DENO_DISABLE_PEDANTIC_NODE_WARNINGS: Lazy<bool> = Lazy::new(|| {
|
||||||
.is_some()
|
.is_some()
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO(2.0): remove this in a follow up.
|
|
||||||
pub static DENO_FUTURE: Lazy<bool> = Lazy::new(|| true);
|
|
||||||
|
|
||||||
pub fn jsr_url() -> &'static Url {
|
pub fn jsr_url() -> &'static Url {
|
||||||
static JSR_URL: Lazy<Url> = Lazy::new(|| {
|
static JSR_URL: Lazy<Url> = Lazy::new(|| {
|
||||||
let env_var_name = "JSR_URL";
|
let env_var_name = "JSR_URL";
|
||||||
|
@ -814,15 +812,12 @@ impl CliOptions {
|
||||||
}
|
}
|
||||||
|
|
||||||
let maybe_lockfile = maybe_lockfile.filter(|_| !force_global_cache);
|
let maybe_lockfile = maybe_lockfile.filter(|_| !force_global_cache);
|
||||||
let root_folder = start_dir.workspace.root_folder_configs();
|
|
||||||
let deno_dir_provider =
|
let deno_dir_provider =
|
||||||
Arc::new(DenoDirProvider::new(flags.cache_path.clone()));
|
Arc::new(DenoDirProvider::new(flags.cache_path.clone()));
|
||||||
let maybe_node_modules_folder = resolve_node_modules_folder(
|
let maybe_node_modules_folder = resolve_node_modules_folder(
|
||||||
&initial_cwd,
|
&initial_cwd,
|
||||||
&flags,
|
&flags,
|
||||||
&start_dir.workspace,
|
&start_dir.workspace,
|
||||||
root_folder.deno_json.as_deref(),
|
|
||||||
root_folder.pkg_json.as_deref(),
|
|
||||||
&deno_dir_provider,
|
&deno_dir_provider,
|
||||||
)
|
)
|
||||||
.with_context(|| "Resolving node_modules folder.")?;
|
.with_context(|| "Resolving node_modules folder.")?;
|
||||||
|
@ -919,10 +914,6 @@ impl CliOptions {
|
||||||
};
|
};
|
||||||
|
|
||||||
for diagnostic in start_dir.workspace.diagnostics() {
|
for diagnostic in start_dir.workspace.diagnostics() {
|
||||||
// TODO(2.0): remove
|
|
||||||
if matches!(diagnostic.kind, deno_config::workspace::WorkspaceDiagnosticKind::DeprecatedNodeModulesDirOption(_)) && !*DENO_FUTURE {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
log::warn!("{} {}", colors::yellow("Warning"), diagnostic);
|
log::warn!("{} {}", colors::yellow("Warning"), diagnostic);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1143,10 +1134,6 @@ impl CliOptions {
|
||||||
self.flags.env_file.as_ref()
|
self.flags.env_file.as_ref()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn enable_future_features(&self) -> bool {
|
|
||||||
*DENO_FUTURE
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn resolve_main_module(&self) -> Result<ModuleSpecifier, AnyError> {
|
pub fn resolve_main_module(&self) -> Result<ModuleSpecifier, AnyError> {
|
||||||
let main_module = match &self.flags.subcommand {
|
let main_module = match &self.flags.subcommand {
|
||||||
DenoSubcommand::Bundle(bundle_flags) => {
|
DenoSubcommand::Bundle(bundle_flags) => {
|
||||||
|
@ -1261,29 +1248,13 @@ impl CliOptions {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn node_modules_mode(&self) -> Result<Option<NodeModulesMode>, AnyError> {
|
pub fn node_modules_dir(
|
||||||
if *DENO_FUTURE {
|
&self,
|
||||||
if let Some(flag) = self.flags.node_modules_mode {
|
) -> Result<Option<NodeModulesDirMode>, AnyError> {
|
||||||
return Ok(Some(flag));
|
if let Some(flag) = self.flags.node_modules_dir {
|
||||||
}
|
return Ok(Some(flag));
|
||||||
self.workspace().node_modules_mode().map_err(Into::into)
|
|
||||||
} else {
|
|
||||||
Ok(
|
|
||||||
self
|
|
||||||
.flags
|
|
||||||
.node_modules_dir
|
|
||||||
.or_else(|| self.workspace().node_modules_dir())
|
|
||||||
.map(|enabled| {
|
|
||||||
if enabled && self.byonm_enabled() {
|
|
||||||
NodeModulesMode::LocalManual
|
|
||||||
} else if enabled {
|
|
||||||
NodeModulesMode::LocalAuto
|
|
||||||
} else {
|
|
||||||
NodeModulesMode::GlobalAuto
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
self.workspace().node_modules_dir_mode().map_err(Into::into)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn vendor_dir_path(&self) -> Option<&PathBuf> {
|
pub fn vendor_dir_path(&self) -> Option<&PathBuf> {
|
||||||
|
@ -1637,17 +1608,15 @@ impl CliOptions {
|
||||||
|
|
||||||
fn byonm_enabled(&self) -> bool {
|
fn byonm_enabled(&self) -> bool {
|
||||||
// check if enabled via unstable
|
// check if enabled via unstable
|
||||||
self.flags.unstable_config.byonm
|
self.node_modules_dir().ok().flatten() == Some(NodeModulesDirMode::Manual)
|
||||||
|| NPM_PROCESS_STATE
|
|| NPM_PROCESS_STATE
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.map(|s| matches!(s.kind, NpmProcessStateKind::Byonm))
|
.map(|s| matches!(s.kind, NpmProcessStateKind::Byonm))
|
||||||
.unwrap_or(false)
|
.unwrap_or(false)
|
||||||
|| self.workspace().has_unstable("byonm")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn use_byonm(&self) -> bool {
|
pub fn use_byonm(&self) -> bool {
|
||||||
if self.enable_future_features()
|
if self.node_modules_dir().ok().flatten().is_none()
|
||||||
&& self.node_modules_mode().ok().flatten().is_none()
|
|
||||||
&& self.maybe_node_modules_folder.is_some()
|
&& self.maybe_node_modules_folder.is_some()
|
||||||
&& self
|
&& self
|
||||||
.workspace()
|
.workspace()
|
||||||
|
@ -1680,19 +1649,17 @@ impl CliOptions {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO(2.0): remove this conditional and enable these features in `99_main.js` by default.
|
// TODO(2.0): remove this code and enable these features in `99_main.js` by default.
|
||||||
if *DENO_FUTURE {
|
let future_features = [
|
||||||
let future_features = [
|
deno_runtime::deno_ffi::UNSTABLE_FEATURE_NAME.to_string(),
|
||||||
deno_runtime::deno_ffi::UNSTABLE_FEATURE_NAME.to_string(),
|
deno_runtime::deno_fs::UNSTABLE_FEATURE_NAME.to_string(),
|
||||||
deno_runtime::deno_fs::UNSTABLE_FEATURE_NAME.to_string(),
|
deno_runtime::deno_webgpu::UNSTABLE_FEATURE_NAME.to_string(),
|
||||||
deno_runtime::deno_webgpu::UNSTABLE_FEATURE_NAME.to_string(),
|
];
|
||||||
];
|
future_features.iter().for_each(|future_feature| {
|
||||||
future_features.iter().for_each(|future_feature| {
|
if !from_config_file.contains(future_feature) {
|
||||||
if !from_config_file.contains(future_feature) {
|
from_config_file.push(future_feature.to_string());
|
||||||
from_config_file.push(future_feature.to_string());
|
}
|
||||||
}
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if !from_config_file.is_empty() {
|
if !from_config_file.is_empty() {
|
||||||
// collect unstable granular flags
|
// collect unstable granular flags
|
||||||
|
@ -1792,54 +1759,54 @@ fn resolve_node_modules_folder(
|
||||||
cwd: &Path,
|
cwd: &Path,
|
||||||
flags: &Flags,
|
flags: &Flags,
|
||||||
workspace: &Workspace,
|
workspace: &Workspace,
|
||||||
maybe_config_file: Option<&ConfigFile>,
|
|
||||||
maybe_package_json: Option<&PackageJson>,
|
|
||||||
deno_dir_provider: &Arc<DenoDirProvider>,
|
deno_dir_provider: &Arc<DenoDirProvider>,
|
||||||
) -> Result<Option<PathBuf>, AnyError> {
|
) -> Result<Option<PathBuf>, AnyError> {
|
||||||
let use_node_modules_dir = if *DENO_FUTURE {
|
fn resolve_from_root(root_folder: &FolderConfigs, cwd: &Path) -> PathBuf {
|
||||||
if let Some(mode) = flags.node_modules_mode {
|
root_folder
|
||||||
Some(mode.uses_node_modules_dir())
|
.deno_json
|
||||||
} else {
|
.as_ref()
|
||||||
workspace
|
.map(|c| Cow::Owned(c.dir_path()))
|
||||||
.node_modules_mode()?
|
.or_else(|| {
|
||||||
.map(|m| m.uses_node_modules_dir())
|
root_folder
|
||||||
.or(flags.vendor)
|
.pkg_json
|
||||||
.or_else(|| maybe_config_file.and_then(|c| c.json.vendor))
|
.as_ref()
|
||||||
}
|
.map(|c| Cow::Borrowed(c.dir_path()))
|
||||||
|
})
|
||||||
|
.unwrap_or(Cow::Borrowed(cwd))
|
||||||
|
.join("node_modules")
|
||||||
|
}
|
||||||
|
|
||||||
|
let root_folder = workspace.root_folder_configs();
|
||||||
|
let use_node_modules_dir = if let Some(mode) = flags.node_modules_dir {
|
||||||
|
Some(mode.uses_node_modules_dir())
|
||||||
} else {
|
} else {
|
||||||
flags
|
workspace
|
||||||
.node_modules_dir
|
.node_modules_dir_mode()?
|
||||||
.or_else(|| maybe_config_file.and_then(|c| c.json.node_modules_dir))
|
.map(|m| m.uses_node_modules_dir())
|
||||||
.or(flags.vendor)
|
.or(flags.vendor)
|
||||||
.or_else(|| maybe_config_file.and_then(|c| c.json.vendor))
|
.or_else(|| root_folder.deno_json.as_ref().and_then(|c| c.json.vendor))
|
||||||
};
|
};
|
||||||
let path = if use_node_modules_dir == Some(false) {
|
let path = if use_node_modules_dir == Some(false) {
|
||||||
return Ok(None);
|
return Ok(None);
|
||||||
} else if let Some(state) = &*NPM_PROCESS_STATE {
|
} else if let Some(state) = &*NPM_PROCESS_STATE {
|
||||||
return Ok(state.local_node_modules_path.as_ref().map(PathBuf::from));
|
return Ok(state.local_node_modules_path.as_ref().map(PathBuf::from));
|
||||||
} else if let Some(package_json_path) = maybe_package_json.map(|c| &c.path) {
|
} else if workspace.package_jsons().next().is_some() {
|
||||||
|
let node_modules_dir = resolve_from_root(root_folder, cwd);
|
||||||
if let Ok(deno_dir) = deno_dir_provider.get_or_create() {
|
if let Ok(deno_dir) = deno_dir_provider.get_or_create() {
|
||||||
// `deno_dir.root` can be symlink in macOS
|
// `deno_dir.root` can be symlink in macOS
|
||||||
if let Ok(root) = canonicalize_path_maybe_not_exists(&deno_dir.root) {
|
if let Ok(root) = canonicalize_path_maybe_not_exists(&deno_dir.root) {
|
||||||
if package_json_path.starts_with(root) {
|
if node_modules_dir.starts_with(root) {
|
||||||
// if the package.json is in deno_dir, then do not use node_modules
|
// if the package.json is in deno_dir, then do not use node_modules
|
||||||
// next to it as local node_modules dir
|
// next to it as local node_modules dir
|
||||||
return Ok(None);
|
return Ok(None);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// auto-discover the local_node_modules_folder when a package.json exists
|
node_modules_dir
|
||||||
// and it's not in deno_dir
|
|
||||||
package_json_path.parent().unwrap().join("node_modules")
|
|
||||||
} else if use_node_modules_dir.is_none() {
|
} else if use_node_modules_dir.is_none() {
|
||||||
return Ok(None);
|
return Ok(None);
|
||||||
} else if let Some(config_path) = maybe_config_file
|
|
||||||
.as_ref()
|
|
||||||
.and_then(|c| c.specifier.to_file_path().ok())
|
|
||||||
{
|
|
||||||
config_path.parent().unwrap().join("node_modules")
|
|
||||||
} else {
|
} else {
|
||||||
cwd.join("node_modules")
|
resolve_from_root(root_folder, cwd)
|
||||||
};
|
};
|
||||||
Ok(Some(canonicalize_path_maybe_not_exists(&path)?))
|
Ok(Some(canonicalize_path_maybe_not_exists(&path)?))
|
||||||
}
|
}
|
||||||
|
|
|
@ -793,20 +793,12 @@ impl CliFactory {
|
||||||
self.maybe_inspector_server()?.clone(),
|
self.maybe_inspector_server()?.clone(),
|
||||||
cli_options.maybe_lockfile().cloned(),
|
cli_options.maybe_lockfile().cloned(),
|
||||||
self.feature_checker()?.clone(),
|
self.feature_checker()?.clone(),
|
||||||
self.create_cli_main_worker_options()?,
|
|
||||||
cli_options.node_ipc_fd(),
|
|
||||||
cli_options.serve_port(),
|
|
||||||
cli_options.serve_host(),
|
|
||||||
cli_options.enable_future_features(),
|
|
||||||
// TODO(bartlomieju): temporarily disabled
|
|
||||||
// cli_options.disable_deprecated_api_warning,
|
|
||||||
true,
|
|
||||||
cli_options.verbose_deprecated_api_warning,
|
|
||||||
if cli_options.code_cache_enabled() {
|
if cli_options.code_cache_enabled() {
|
||||||
Some(self.code_cache()?.clone())
|
Some(self.code_cache()?.clone())
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
},
|
},
|
||||||
|
self.create_cli_main_worker_options()?,
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -871,6 +863,13 @@ impl CliFactory {
|
||||||
unstable: cli_options.legacy_unstable_flag(),
|
unstable: cli_options.legacy_unstable_flag(),
|
||||||
create_hmr_runner,
|
create_hmr_runner,
|
||||||
create_coverage_collector,
|
create_coverage_collector,
|
||||||
|
node_ipc: cli_options.node_ipc_fd(),
|
||||||
|
serve_port: cli_options.serve_port(),
|
||||||
|
serve_host: cli_options.serve_host(),
|
||||||
|
// TODO(bartlomieju): temporarily disabled
|
||||||
|
disable_deprecated_api_warning: true,
|
||||||
|
verbose_deprecated_api_warning: cli_options
|
||||||
|
.verbose_deprecated_api_warning,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -543,7 +543,7 @@ impl ModuleGraphBuilder {
|
||||||
// opted into using a node_modules directory
|
// opted into using a node_modules directory
|
||||||
if self
|
if self
|
||||||
.options
|
.options
|
||||||
.node_modules_mode()?
|
.node_modules_dir()?
|
||||||
.map(|m| m.uses_node_modules_dir())
|
.map(|m| m.uses_node_modules_dir())
|
||||||
.unwrap_or(false)
|
.unwrap_or(false)
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,7 +5,7 @@ use deno_config::deno_json::DenoJsonCache;
|
||||||
use deno_config::deno_json::FmtConfig;
|
use deno_config::deno_json::FmtConfig;
|
||||||
use deno_config::deno_json::FmtOptionsConfig;
|
use deno_config::deno_json::FmtOptionsConfig;
|
||||||
use deno_config::deno_json::LintConfig;
|
use deno_config::deno_json::LintConfig;
|
||||||
use deno_config::deno_json::NodeModulesMode;
|
use deno_config::deno_json::NodeModulesDirMode;
|
||||||
use deno_config::deno_json::TestConfig;
|
use deno_config::deno_json::TestConfig;
|
||||||
use deno_config::deno_json::TsConfig;
|
use deno_config::deno_json::TsConfig;
|
||||||
use deno_config::fs::DenoConfigFs;
|
use deno_config::fs::DenoConfigFs;
|
||||||
|
@ -55,7 +55,6 @@ use crate::args::CliLockfile;
|
||||||
use crate::args::ConfigFile;
|
use crate::args::ConfigFile;
|
||||||
use crate::args::LintFlags;
|
use crate::args::LintFlags;
|
||||||
use crate::args::LintOptions;
|
use crate::args::LintOptions;
|
||||||
use crate::args::DENO_FUTURE;
|
|
||||||
use crate::cache::FastInsecureHasher;
|
use crate::cache::FastInsecureHasher;
|
||||||
use crate::file_fetcher::FileFetcher;
|
use crate::file_fetcher::FileFetcher;
|
||||||
use crate::lsp::logging::lsp_warn;
|
use crate::lsp::logging::lsp_warn;
|
||||||
|
@ -1388,24 +1387,14 @@ impl ConfigData {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let byonm = std::env::var("DENO_UNSTABLE_BYONM").is_ok()
|
let node_modules_dir = member_dir
|
||||||
|| member_dir.workspace.has_unstable("byonm")
|
.workspace
|
||||||
|| (*DENO_FUTURE
|
.node_modules_dir_mode()
|
||||||
&& matches!(
|
.unwrap_or_default();
|
||||||
member_dir.workspace.node_modules_mode().unwrap_or_default(),
|
let byonm = match node_modules_dir {
|
||||||
Some(NodeModulesMode::LocalManual)
|
Some(mode) => mode == NodeModulesDirMode::Manual,
|
||||||
))
|
None => member_dir.workspace.package_jsons().next().is_some(),
|
||||||
|| (
|
};
|
||||||
*DENO_FUTURE
|
|
||||||
&& member_dir.workspace.package_jsons().next().is_some()
|
|
||||||
&& member_dir
|
|
||||||
.workspace
|
|
||||||
.node_modules_mode()
|
|
||||||
.ok()
|
|
||||||
.flatten()
|
|
||||||
.is_none()
|
|
||||||
// TODO(2.0): remove
|
|
||||||
);
|
|
||||||
if byonm {
|
if byonm {
|
||||||
lsp_log!(" Enabled 'bring your own node_modules'.");
|
lsp_log!(" Enabled 'bring your own node_modules'.");
|
||||||
}
|
}
|
||||||
|
@ -1879,27 +1868,16 @@ fn resolve_node_modules_dir(
|
||||||
// `nodeModulesDir: true` setting in the deno.json file. This is to
|
// `nodeModulesDir: true` setting in the deno.json file. This is to
|
||||||
// reduce the chance of modifying someone's node_modules directory
|
// reduce the chance of modifying someone's node_modules directory
|
||||||
// without them having asked us to do so.
|
// without them having asked us to do so.
|
||||||
let node_modules_mode = workspace.node_modules_mode().ok().flatten();
|
let node_modules_mode = workspace.node_modules_dir_mode().ok().flatten();
|
||||||
let node_modules_dir_option = workspace.node_modules_dir();
|
let explicitly_disabled = node_modules_mode == Some(NodeModulesDirMode::None);
|
||||||
let explicitly_disabled = if *DENO_FUTURE {
|
|
||||||
node_modules_mode == Some(NodeModulesMode::GlobalAuto)
|
|
||||||
} else {
|
|
||||||
node_modules_dir_option == Some(false)
|
|
||||||
};
|
|
||||||
if explicitly_disabled {
|
if explicitly_disabled {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
let enabled = if *DENO_FUTURE {
|
let enabled = byonm
|
||||||
byonm
|
|| node_modules_mode
|
||||||
|| node_modules_mode
|
.map(|m| m.uses_node_modules_dir())
|
||||||
.map(|m| m.uses_node_modules_dir())
|
.unwrap_or(false)
|
||||||
.unwrap_or(false)
|
|| workspace.vendor_dir_path().is_some();
|
||||||
|| workspace.vendor_dir_path().is_some()
|
|
||||||
} else {
|
|
||||||
byonm
|
|
||||||
|| workspace.node_modules_dir() == Some(true)
|
|
||||||
|| workspace.vendor_dir_path().is_some()
|
|
||||||
};
|
|
||||||
|
|
||||||
if !enabled {
|
if !enabled {
|
||||||
return None;
|
return None;
|
||||||
|
|
28
cli/main.rs
28
cli/main.rs
|
@ -32,7 +32,6 @@ mod worker;
|
||||||
use crate::args::flags_from_vec;
|
use crate::args::flags_from_vec;
|
||||||
use crate::args::DenoSubcommand;
|
use crate::args::DenoSubcommand;
|
||||||
use crate::args::Flags;
|
use crate::args::Flags;
|
||||||
use crate::args::DENO_FUTURE;
|
|
||||||
use crate::graph_container::ModuleGraphContainer;
|
use crate::graph_container::ModuleGraphContainer;
|
||||||
use crate::util::display;
|
use crate::util::display;
|
||||||
use crate::util::v8::get_v8_flags_from_env;
|
use crate::util::v8::get_v8_flags_from_env;
|
||||||
|
@ -454,30 +453,19 @@ fn resolve_flags_and_init(
|
||||||
// https://github.com/microsoft/vscode/blob/48d4ba271686e8072fc6674137415bc80d936bc7/extensions/typescript-language-features/src/configuration/configuration.ts#L213-L214
|
// https://github.com/microsoft/vscode/blob/48d4ba271686e8072fc6674137415bc80d936bc7/extensions/typescript-language-features/src/configuration/configuration.ts#L213-L214
|
||||||
DenoSubcommand::Lsp => vec!["--max-old-space-size=3072".to_string()],
|
DenoSubcommand::Lsp => vec!["--max-old-space-size=3072".to_string()],
|
||||||
_ => {
|
_ => {
|
||||||
if *DENO_FUTURE {
|
// TODO(bartlomieju): I think this can be removed as it's handled by `deno_core`
|
||||||
// TODO(bartlomieju): I think this can be removed as it's handled by `deno_core`
|
// and its settings.
|
||||||
// and its settings.
|
// deno_ast removes TypeScript `assert` keywords, so this flag only affects JavaScript
|
||||||
// deno_ast removes TypeScript `assert` keywords, so this flag only affects JavaScript
|
// TODO(petamoriken): Need to check TypeScript `assert` keywords in deno_ast
|
||||||
// TODO(petamoriken): Need to check TypeScript `assert` keywords in deno_ast
|
vec!["--no-harmony-import-assertions".to_string()]
|
||||||
vec!["--no-harmony-import-assertions".to_string()]
|
|
||||||
} else {
|
|
||||||
vec![
|
|
||||||
// TODO(bartlomieju): I think this can be removed as it's handled by `deno_core`
|
|
||||||
// and its settings.
|
|
||||||
// If we're still in v1.X version we want to support import assertions.
|
|
||||||
// V8 12.6 unshipped the support by default, so force it by passing a
|
|
||||||
// flag.
|
|
||||||
"--harmony-import-assertions".to_string(),
|
|
||||||
// Verify with DENO_FUTURE for now.
|
|
||||||
"--no-maglev".to_string(),
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
init_v8_flags(&default_v8_flags, &flags.v8_flags, get_v8_flags_from_env());
|
init_v8_flags(&default_v8_flags, &flags.v8_flags, get_v8_flags_from_env());
|
||||||
// TODO(bartlomieju): remove last argument in Deno 2.
|
// TODO(bartlomieju): remove last argument in Deno 2.
|
||||||
deno_core::JsRuntime::init_platform(None, !*DENO_FUTURE);
|
deno_core::JsRuntime::init_platform(
|
||||||
|
None, /* import assertions enabled */ false,
|
||||||
|
);
|
||||||
util::logger::init(flags.log_level);
|
util::logger::init(flags.log_level);
|
||||||
|
|
||||||
Ok(flags)
|
Ok(flags)
|
||||||
|
|
|
@ -831,22 +831,14 @@ async fn sync_resolution_with_fs(
|
||||||
}
|
}
|
||||||
|
|
||||||
if !packages_with_scripts_not_run.is_empty() {
|
if !packages_with_scripts_not_run.is_empty() {
|
||||||
let (maybe_install, maybe_install_example) = if *crate::args::DENO_FUTURE {
|
|
||||||
(
|
|
||||||
" or `deno install`",
|
|
||||||
" or `deno install --allow-scripts=pkg1,pkg2`",
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
("", "")
|
|
||||||
};
|
|
||||||
let packages = packages_with_scripts_not_run
|
let packages = packages_with_scripts_not_run
|
||||||
.iter()
|
.iter()
|
||||||
.map(|(_, p)| format!("npm:{p}"))
|
.map(|(_, p)| format!("npm:{p}"))
|
||||||
.collect::<Vec<_>>()
|
.collect::<Vec<_>>()
|
||||||
.join(", ");
|
.join(", ");
|
||||||
log::warn!("{}: Packages contained npm lifecycle scripts (preinstall/install/postinstall) that were not executed.
|
log::warn!("{}: Packages contained npm lifecycle scripts (preinstall/install/postinstall) that were not executed.
|
||||||
This may cause the packages to not work correctly. To run them, use the `--allow-scripts` flag with `deno cache`{maybe_install}
|
This may cause the packages to not work correctly. To run them, use the `--allow-scripts` flag with `deno cache` or `deno install`
|
||||||
(e.g. `deno cache --allow-scripts=pkg1,pkg2 <entrypoint>`{maybe_install_example}):\n {packages}", crate::colors::yellow("warning"));
|
(e.g. `deno cache --allow-scripts=pkg1,pkg2 <entrypoint>` or `deno install --allow-scripts=pkg1,pkg2`):\n {packages}", crate::colors::yellow("warning"));
|
||||||
for (scripts_warned_path, _) in packages_with_scripts_not_run {
|
for (scripts_warned_path, _) in packages_with_scripts_not_run {
|
||||||
let _ignore_err = fs::write(scripts_warned_path, "");
|
let _ignore_err = fs::write(scripts_warned_path, "");
|
||||||
}
|
}
|
||||||
|
|
|
@ -225,13 +225,8 @@ impl CliNodeResolver {
|
||||||
let package_json_path = package_folder.join("package.json");
|
let package_json_path = package_folder.join("package.json");
|
||||||
if !self.fs.exists_sync(&package_json_path) {
|
if !self.fs.exists_sync(&package_json_path) {
|
||||||
return Err(anyhow!(
|
return Err(anyhow!(
|
||||||
"Could not find '{}'. Deno expects the node_modules/ directory to be up to date. Did you forget to run `{}`?",
|
"Could not find '{}'. Deno expects the node_modules/ directory to be up to date. Did you forget to run `deno install`?",
|
||||||
package_json_path.display(),
|
package_json_path.display(),
|
||||||
if *crate::args::DENO_FUTURE {
|
|
||||||
"deno install"
|
|
||||||
} else {
|
|
||||||
"npm install"
|
|
||||||
},
|
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -629,7 +629,6 @@ impl<'a> DenoCompileBinaryWriter<'a> {
|
||||||
unstable_config: UnstableConfig {
|
unstable_config: UnstableConfig {
|
||||||
legacy_flag_enabled: cli_options.legacy_unstable_flag(),
|
legacy_flag_enabled: cli_options.legacy_unstable_flag(),
|
||||||
bare_node_builtins: cli_options.unstable_bare_node_builtins(),
|
bare_node_builtins: cli_options.unstable_bare_node_builtins(),
|
||||||
byonm: cli_options.use_byonm(),
|
|
||||||
sloppy_imports: cli_options.unstable_sloppy_imports(),
|
sloppy_imports: cli_options.unstable_sloppy_imports(),
|
||||||
features: cli_options.unstable_features(),
|
features: cli_options.unstable_features(),
|
||||||
},
|
},
|
||||||
|
|
|
@ -706,6 +706,8 @@ pub async fn run(
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
feature_checker,
|
feature_checker,
|
||||||
|
// Code cache is not supported for standalone binary yet.
|
||||||
|
None,
|
||||||
CliMainWorkerOptions {
|
CliMainWorkerOptions {
|
||||||
argv: metadata.argv,
|
argv: metadata.argv,
|
||||||
log_level: WorkerLogLevel::Info,
|
log_level: WorkerLogLevel::Info,
|
||||||
|
@ -732,17 +734,13 @@ pub async fn run(
|
||||||
unstable: metadata.unstable_config.legacy_flag_enabled,
|
unstable: metadata.unstable_config.legacy_flag_enabled,
|
||||||
create_hmr_runner: None,
|
create_hmr_runner: None,
|
||||||
create_coverage_collector: None,
|
create_coverage_collector: None,
|
||||||
|
node_ipc: None,
|
||||||
|
serve_port: None,
|
||||||
|
serve_host: None,
|
||||||
|
// TODO(bartlomieju): temporarily disabled
|
||||||
|
disable_deprecated_api_warning: true,
|
||||||
|
verbose_deprecated_api_warning: false,
|
||||||
},
|
},
|
||||||
None,
|
|
||||||
None,
|
|
||||||
None,
|
|
||||||
false,
|
|
||||||
// TODO(bartlomieju): temporarily disabled
|
|
||||||
// metadata.disable_deprecated_api_warning,
|
|
||||||
true,
|
|
||||||
false,
|
|
||||||
// Code cache is not supported for standalone binary yet.
|
|
||||||
None,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// Initialize v8 once from the main thread.
|
// Initialize v8 once from the main thread.
|
||||||
|
|
|
@ -140,10 +140,10 @@ impl DenoOrPackageJson {
|
||||||
),
|
),
|
||||||
factory,
|
factory,
|
||||||
)),
|
)),
|
||||||
(None, Some(package_json)) if options.enable_future_features() => {
|
(None, Some(package_json)) => {
|
||||||
Ok((DenoOrPackageJson::Npm(package_json.clone(), None), factory))
|
Ok((DenoOrPackageJson::Npm(package_json.clone(), None), factory))
|
||||||
}
|
}
|
||||||
(None, Some(_) | None) => {
|
(None, None) => {
|
||||||
std::fs::write(options.initial_cwd().join("deno.json"), "{}\n")
|
std::fs::write(options.initial_cwd().join("deno.json"), "{}\n")
|
||||||
.context("Failed to create deno.json file")?;
|
.context("Failed to create deno.json file")?;
|
||||||
drop(factory); // drop to prevent use
|
drop(factory); // drop to prevent use
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
use std::io::Read;
|
use std::io::Read;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
|
use deno_config::deno_json::NodeModulesDirMode;
|
||||||
use deno_core::error::AnyError;
|
use deno_core::error::AnyError;
|
||||||
use deno_runtime::deno_permissions::Permissions;
|
use deno_runtime::deno_permissions::Permissions;
|
||||||
use deno_runtime::deno_permissions::PermissionsContainer;
|
use deno_runtime::deno_permissions::PermissionsContainer;
|
||||||
|
@ -194,11 +195,8 @@ pub async fn eval_command(
|
||||||
pub async fn maybe_npm_install(factory: &CliFactory) -> Result<(), AnyError> {
|
pub async fn maybe_npm_install(factory: &CliFactory) -> Result<(), AnyError> {
|
||||||
// ensure an "npm install" is done if the user has explicitly
|
// ensure an "npm install" is done if the user has explicitly
|
||||||
// opted into using a managed node_modules directory
|
// opted into using a managed node_modules directory
|
||||||
if factory
|
if factory.cli_options()?.node_modules_dir()?
|
||||||
.cli_options()?
|
== Some(NodeModulesDirMode::Auto)
|
||||||
.node_modules_mode()?
|
|
||||||
.map(|m| m.uses_node_modules_dir())
|
|
||||||
.unwrap_or(false)
|
|
||||||
{
|
{
|
||||||
if let Some(npm_resolver) = factory.npm_resolver().await?.as_managed() {
|
if let Some(npm_resolver) = factory.npm_resolver().await?.as_managed() {
|
||||||
npm_resolver.ensure_top_level_package_json_install().await?;
|
npm_resolver.ensure_top_level_package_json_install().await?;
|
||||||
|
|
14
cli/tools/vendor/mod.rs
vendored
14
cli/tools/vendor/mod.rs
vendored
|
@ -89,7 +89,7 @@ pub async fn vendor(
|
||||||
let npm_package_count = graph.npm_packages.len();
|
let npm_package_count = graph.npm_packages.len();
|
||||||
let try_add_node_modules_dir = npm_package_count > 0
|
let try_add_node_modules_dir = npm_package_count > 0
|
||||||
&& cli_options
|
&& cli_options
|
||||||
.node_modules_mode()?
|
.node_modules_dir()?
|
||||||
.map(|m| m.uses_node_modules_dir())
|
.map(|m| m.uses_node_modules_dir())
|
||||||
.unwrap_or(true);
|
.unwrap_or(true);
|
||||||
|
|
||||||
|
@ -344,7 +344,7 @@ fn update_config_text(
|
||||||
let insert_position = obj.range.end - 1;
|
let insert_position = obj.range.end - 1;
|
||||||
text_changes.push(TextChange {
|
text_changes.push(TextChange {
|
||||||
range: insert_position..insert_position,
|
range: insert_position..insert_position,
|
||||||
new_text: r#""nodeModulesDir": true"#.to_string(),
|
new_text: r#""nodeModulesDir": "auto""#.to_string(),
|
||||||
});
|
});
|
||||||
should_format = true;
|
should_format = true;
|
||||||
modified_result.added_node_modules_dir = true;
|
modified_result.added_node_modules_dir = true;
|
||||||
|
@ -454,7 +454,7 @@ mod internal_test {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
result.new_text.unwrap(),
|
result.new_text.unwrap(),
|
||||||
r#"{
|
r#"{
|
||||||
"nodeModulesDir": true,
|
"nodeModulesDir": "auto",
|
||||||
"importMap": "./vendor/import_map.json"
|
"importMap": "./vendor/import_map.json"
|
||||||
}
|
}
|
||||||
"#
|
"#
|
||||||
|
@ -467,7 +467,7 @@ mod internal_test {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
result.new_text.unwrap(),
|
result.new_text.unwrap(),
|
||||||
r#"{
|
r#"{
|
||||||
"nodeModulesDir": true
|
"nodeModulesDir": "auto"
|
||||||
}
|
}
|
||||||
"#
|
"#
|
||||||
);
|
);
|
||||||
|
@ -546,10 +546,10 @@ mod internal_test {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn no_update_node_modules_dir() {
|
fn no_update_node_modules_dir() {
|
||||||
// will not update if this is already set (even if it's false)
|
// will not update if this is already set (even if it's "none")
|
||||||
let result = update_config_text(
|
let result = update_config_text(
|
||||||
r#"{
|
r#"{
|
||||||
"nodeModulesDir": false
|
"nodeModulesDir": "none"
|
||||||
}
|
}
|
||||||
"#,
|
"#,
|
||||||
&Default::default(),
|
&Default::default(),
|
||||||
|
@ -563,7 +563,7 @@ mod internal_test {
|
||||||
|
|
||||||
let result = update_config_text(
|
let result = update_config_text(
|
||||||
r#"{
|
r#"{
|
||||||
"nodeModulesDir": true
|
"nodeModulesDir": "auto"
|
||||||
}
|
}
|
||||||
"#,
|
"#,
|
||||||
&Default::default(),
|
&Default::default(),
|
||||||
|
|
|
@ -116,6 +116,11 @@ pub struct CliMainWorkerOptions {
|
||||||
pub skip_op_registration: bool,
|
pub skip_op_registration: bool,
|
||||||
pub create_hmr_runner: Option<CreateHmrRunnerCb>,
|
pub create_hmr_runner: Option<CreateHmrRunnerCb>,
|
||||||
pub create_coverage_collector: Option<CreateCoverageCollectorCb>,
|
pub create_coverage_collector: Option<CreateCoverageCollectorCb>,
|
||||||
|
pub node_ipc: Option<i64>,
|
||||||
|
pub serve_port: Option<u16>,
|
||||||
|
pub serve_host: Option<String>,
|
||||||
|
pub disable_deprecated_api_warning: bool,
|
||||||
|
pub verbose_deprecated_api_warning: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct SharedWorkerState {
|
struct SharedWorkerState {
|
||||||
|
@ -135,13 +140,8 @@ struct SharedWorkerState {
|
||||||
maybe_inspector_server: Option<Arc<InspectorServer>>,
|
maybe_inspector_server: Option<Arc<InspectorServer>>,
|
||||||
maybe_lockfile: Option<Arc<CliLockfile>>,
|
maybe_lockfile: Option<Arc<CliLockfile>>,
|
||||||
feature_checker: Arc<FeatureChecker>,
|
feature_checker: Arc<FeatureChecker>,
|
||||||
node_ipc: Option<i64>,
|
|
||||||
enable_future_features: bool,
|
enable_future_features: bool,
|
||||||
disable_deprecated_api_warning: bool,
|
|
||||||
verbose_deprecated_api_warning: bool,
|
|
||||||
code_cache: Option<Arc<dyn code_cache::CodeCache>>,
|
code_cache: Option<Arc<dyn code_cache::CodeCache>>,
|
||||||
serve_port: Option<u16>,
|
|
||||||
serve_host: Option<String>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SharedWorkerState {
|
impl SharedWorkerState {
|
||||||
|
@ -434,14 +434,8 @@ impl CliMainWorkerFactory {
|
||||||
maybe_inspector_server: Option<Arc<InspectorServer>>,
|
maybe_inspector_server: Option<Arc<InspectorServer>>,
|
||||||
maybe_lockfile: Option<Arc<CliLockfile>>,
|
maybe_lockfile: Option<Arc<CliLockfile>>,
|
||||||
feature_checker: Arc<FeatureChecker>,
|
feature_checker: Arc<FeatureChecker>,
|
||||||
options: CliMainWorkerOptions,
|
|
||||||
node_ipc: Option<i64>,
|
|
||||||
serve_port: Option<u16>,
|
|
||||||
serve_host: Option<String>,
|
|
||||||
enable_future_features: bool,
|
|
||||||
disable_deprecated_api_warning: bool,
|
|
||||||
verbose_deprecated_api_warning: bool,
|
|
||||||
code_cache: Option<Arc<dyn code_cache::CodeCache>>,
|
code_cache: Option<Arc<dyn code_cache::CodeCache>>,
|
||||||
|
options: CliMainWorkerOptions,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
Self {
|
Self {
|
||||||
shared: Arc::new(SharedWorkerState {
|
shared: Arc::new(SharedWorkerState {
|
||||||
|
@ -461,12 +455,8 @@ impl CliMainWorkerFactory {
|
||||||
maybe_inspector_server,
|
maybe_inspector_server,
|
||||||
maybe_lockfile,
|
maybe_lockfile,
|
||||||
feature_checker,
|
feature_checker,
|
||||||
node_ipc,
|
// TODO(2.0): remove?
|
||||||
serve_port,
|
enable_future_features: true,
|
||||||
serve_host,
|
|
||||||
enable_future_features,
|
|
||||||
disable_deprecated_api_warning,
|
|
||||||
verbose_deprecated_api_warning,
|
|
||||||
code_cache,
|
code_cache,
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
@ -602,13 +592,17 @@ impl CliMainWorkerFactory {
|
||||||
has_node_modules_dir: shared.options.has_node_modules_dir,
|
has_node_modules_dir: shared.options.has_node_modules_dir,
|
||||||
argv0: shared.options.argv0.clone(),
|
argv0: shared.options.argv0.clone(),
|
||||||
node_debug: shared.options.node_debug.clone(),
|
node_debug: shared.options.node_debug.clone(),
|
||||||
node_ipc_fd: shared.node_ipc,
|
node_ipc_fd: shared.options.node_ipc,
|
||||||
disable_deprecated_api_warning: shared.disable_deprecated_api_warning,
|
disable_deprecated_api_warning: shared
|
||||||
verbose_deprecated_api_warning: shared.verbose_deprecated_api_warning,
|
.options
|
||||||
|
.disable_deprecated_api_warning,
|
||||||
|
verbose_deprecated_api_warning: shared
|
||||||
|
.options
|
||||||
|
.verbose_deprecated_api_warning,
|
||||||
future: shared.enable_future_features,
|
future: shared.enable_future_features,
|
||||||
mode,
|
mode,
|
||||||
serve_port: shared.serve_port,
|
serve_port: shared.options.serve_port,
|
||||||
serve_host: shared.serve_host.clone(),
|
serve_host: shared.options.serve_host.clone(),
|
||||||
},
|
},
|
||||||
extensions: custom_extensions,
|
extensions: custom_extensions,
|
||||||
startup_snapshot: crate::js::deno_isolate_init(),
|
startup_snapshot: crate::js::deno_isolate_init(),
|
||||||
|
@ -801,12 +795,16 @@ fn create_web_worker_callback(
|
||||||
argv0: shared.options.argv0.clone(),
|
argv0: shared.options.argv0.clone(),
|
||||||
node_debug: shared.options.node_debug.clone(),
|
node_debug: shared.options.node_debug.clone(),
|
||||||
node_ipc_fd: None,
|
node_ipc_fd: None,
|
||||||
disable_deprecated_api_warning: shared.disable_deprecated_api_warning,
|
disable_deprecated_api_warning: shared
|
||||||
verbose_deprecated_api_warning: shared.verbose_deprecated_api_warning,
|
.options
|
||||||
|
.disable_deprecated_api_warning,
|
||||||
|
verbose_deprecated_api_warning: shared
|
||||||
|
.options
|
||||||
|
.verbose_deprecated_api_warning,
|
||||||
future: shared.enable_future_features,
|
future: shared.enable_future_features,
|
||||||
mode: WorkerExecutionMode::Worker,
|
mode: WorkerExecutionMode::Worker,
|
||||||
serve_port: shared.serve_port,
|
serve_port: shared.options.serve_port,
|
||||||
serve_host: shared.serve_host.clone(),
|
serve_host: shared.options.serve_host.clone(),
|
||||||
},
|
},
|
||||||
extensions: vec![],
|
extensions: vec![],
|
||||||
startup_snapshot: crate::js::deno_isolate_init(),
|
startup_snapshot: crate::js::deno_isolate_init(),
|
||||||
|
|
|
@ -989,7 +989,7 @@ fn run_npm_bin_compile_test(opts: RunNpmBinCompileOptions) {
|
||||||
args.extend(opts.compile_args.iter().map(|s| s.to_string()));
|
args.extend(opts.compile_args.iter().map(|s| s.to_string()));
|
||||||
|
|
||||||
if opts.node_modules_local {
|
if opts.node_modules_local {
|
||||||
args.push("--node-modules=local-auto".to_string());
|
args.push("--node-modules-dir=auto".to_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(bin_name) = opts.input_name {
|
if let Some(bin_name) = opts.input_name {
|
||||||
|
@ -1052,7 +1052,7 @@ fn compile_node_modules_symlink_outside() {
|
||||||
// compile folder
|
// compile folder
|
||||||
let output = context
|
let output = context
|
||||||
.new_command()
|
.new_command()
|
||||||
.args("compile --allow-read --node-modules=local-auto --output bin main.ts")
|
.args("compile --allow-read --node-modules-dir=auto --output bin main.ts")
|
||||||
.run();
|
.run();
|
||||||
output.assert_exit_code(0);
|
output.assert_exit_code(0);
|
||||||
output.assert_matches_file(
|
output.assert_matches_file(
|
||||||
|
@ -1075,7 +1075,7 @@ fn compile_node_modules_symlink_outside() {
|
||||||
// compile
|
// compile
|
||||||
let output = context
|
let output = context
|
||||||
.new_command()
|
.new_command()
|
||||||
.args("compile --allow-read --node-modules=local-auto --output bin main.ts")
|
.args("compile --allow-read --node-modules-dir=auto --output bin main.ts")
|
||||||
.run();
|
.run();
|
||||||
output.assert_exit_code(0);
|
output.assert_exit_code(0);
|
||||||
output.assert_matches_file(
|
output.assert_matches_file(
|
||||||
|
@ -1105,7 +1105,7 @@ console.log(getValue());"#,
|
||||||
// compile folder
|
// compile folder
|
||||||
let output = context
|
let output = context
|
||||||
.new_command()
|
.new_command()
|
||||||
.args("compile --allow-read --node-modules=local-auto --output bin main.ts")
|
.args("compile --allow-read --node-modules-dir=auto --output bin main.ts")
|
||||||
.run();
|
.run();
|
||||||
output.assert_exit_code(0);
|
output.assert_exit_code(0);
|
||||||
output.assert_matches_text(
|
output.assert_matches_text(
|
||||||
|
|
|
@ -9035,7 +9035,7 @@ fn lsp_completions_node_specifier_node_modules_dir() {
|
||||||
temp_dir.write(
|
temp_dir.write(
|
||||||
temp_dir.path().join("deno.json"),
|
temp_dir.path().join("deno.json"),
|
||||||
json!({
|
json!({
|
||||||
"nodeModulesDir": true,
|
"nodeModulesDir": "auto",
|
||||||
})
|
})
|
||||||
.to_string(),
|
.to_string(),
|
||||||
);
|
);
|
||||||
|
@ -9442,7 +9442,7 @@ fn lsp_npmrc() {
|
||||||
temp_dir.write(
|
temp_dir.write(
|
||||||
temp_dir.path().join("deno.json"),
|
temp_dir.path().join("deno.json"),
|
||||||
json!({
|
json!({
|
||||||
"nodeModules": "local-auto",
|
"nodeModulesDir": "auto",
|
||||||
})
|
})
|
||||||
.to_string(),
|
.to_string(),
|
||||||
);
|
);
|
||||||
|
@ -12372,7 +12372,7 @@ fn lsp_node_modules_dir() {
|
||||||
temp_dir.write(
|
temp_dir.write(
|
||||||
"deno.json",
|
"deno.json",
|
||||||
json!({
|
json!({
|
||||||
"nodeModules": "global-auto",
|
"nodeModulesDir": "none",
|
||||||
})
|
})
|
||||||
.to_string(),
|
.to_string(),
|
||||||
);
|
);
|
||||||
|
@ -12413,7 +12413,7 @@ fn lsp_node_modules_dir() {
|
||||||
|
|
||||||
temp_dir.write(
|
temp_dir.write(
|
||||||
temp_dir.path().join("deno.json"),
|
temp_dir.path().join("deno.json"),
|
||||||
"{ \"nodeModules\": \"local-auto\", \"lock\": false }\n",
|
"{ \"nodeModulesDir\": \"auto\", \"lock\": false }\n",
|
||||||
);
|
);
|
||||||
let refresh_config = |client: &mut LspClient| {
|
let refresh_config = |client: &mut LspClient| {
|
||||||
client.change_configuration(json!({ "deno": {
|
client.change_configuration(json!({ "deno": {
|
||||||
|
@ -12449,7 +12449,7 @@ fn lsp_node_modules_dir() {
|
||||||
// now add a lockfile and cache
|
// now add a lockfile and cache
|
||||||
temp_dir.write(
|
temp_dir.write(
|
||||||
temp_dir.path().join("deno.json"),
|
temp_dir.path().join("deno.json"),
|
||||||
"{ \"nodeModules\": \"local-auto\" }\n",
|
"{ \"nodeModulesDir\": \"auto\" }\n",
|
||||||
);
|
);
|
||||||
refresh_config(&mut client);
|
refresh_config(&mut client);
|
||||||
cache(&mut client);
|
cache(&mut client);
|
||||||
|
@ -13056,21 +13056,21 @@ fn lsp_deno_json_scopes_node_modules_dir() {
|
||||||
temp_dir.write(
|
temp_dir.write(
|
||||||
"project1/deno.json",
|
"project1/deno.json",
|
||||||
json!({
|
json!({
|
||||||
"nodeModules": "local-auto",
|
"nodeModulesDir": "auto",
|
||||||
})
|
})
|
||||||
.to_string(),
|
.to_string(),
|
||||||
);
|
);
|
||||||
temp_dir.write(
|
temp_dir.write(
|
||||||
"project2/deno.json",
|
"project2/deno.json",
|
||||||
json!({
|
json!({
|
||||||
"nodeModules": "local-auto",
|
"nodeModulesDir": "auto",
|
||||||
})
|
})
|
||||||
.to_string(),
|
.to_string(),
|
||||||
);
|
);
|
||||||
temp_dir.write(
|
temp_dir.write(
|
||||||
"project2/project3/deno.json",
|
"project2/project3/deno.json",
|
||||||
json!({
|
json!({
|
||||||
"nodeModules": "local-auto",
|
"nodeModulesDir": "auto",
|
||||||
})
|
})
|
||||||
.to_string(),
|
.to_string(),
|
||||||
);
|
);
|
||||||
|
@ -14247,7 +14247,7 @@ fn lsp_deno_json_workspace_node_modules_dir() {
|
||||||
"project1/deno.json",
|
"project1/deno.json",
|
||||||
json!({
|
json!({
|
||||||
"workspace": ["project2"],
|
"workspace": ["project2"],
|
||||||
"nodeModules": "local-auto",
|
"nodeModulesDir": "auto",
|
||||||
})
|
})
|
||||||
.to_string(),
|
.to_string(),
|
||||||
);
|
);
|
||||||
|
@ -14383,7 +14383,7 @@ fn lsp_npm_workspace() {
|
||||||
temp_dir.write(
|
temp_dir.write(
|
||||||
"deno.json",
|
"deno.json",
|
||||||
json!({
|
json!({
|
||||||
"nodeModules": "local-auto",
|
"nodeModulesDir": "auto",
|
||||||
})
|
})
|
||||||
.to_string(),
|
.to_string(),
|
||||||
);
|
);
|
||||||
|
@ -14625,11 +14625,8 @@ fn lsp_jupyter_byonm_diagnostics() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn lsp_deno_future_env_byonm() {
|
fn lsp_byonm() {
|
||||||
let context = TestContextBuilder::for_npm()
|
let context = TestContextBuilder::for_npm().use_temp_cwd().build();
|
||||||
.env("DENO_FUTURE", "1")
|
|
||||||
.use_temp_cwd()
|
|
||||||
.build();
|
|
||||||
let temp_dir = context.temp_dir();
|
let temp_dir = context.temp_dir();
|
||||||
temp_dir.path().join("package.json").write_json(&json!({
|
temp_dir.path().join("package.json").write_json(&json!({
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -15187,7 +15184,6 @@ fn lsp_cjs_internal_types_default_export() {
|
||||||
.use_http_server()
|
.use_http_server()
|
||||||
.use_temp_cwd()
|
.use_temp_cwd()
|
||||||
.add_npm_env_vars()
|
.add_npm_env_vars()
|
||||||
.env("DENO_FUTURE", "1")
|
|
||||||
.build();
|
.build();
|
||||||
let temp_dir = context.temp_dir();
|
let temp_dir = context.temp_dir();
|
||||||
temp_dir.write("deno.json", r#"{}"#);
|
temp_dir.write("deno.json", r#"{}"#);
|
||||||
|
@ -15236,7 +15232,6 @@ fn lsp_cjs_import_dual() {
|
||||||
.use_http_server()
|
.use_http_server()
|
||||||
.use_temp_cwd()
|
.use_temp_cwd()
|
||||||
.add_npm_env_vars()
|
.add_npm_env_vars()
|
||||||
.env("DENO_FUTURE", "1")
|
|
||||||
.build();
|
.build();
|
||||||
let temp_dir = context.temp_dir();
|
let temp_dir = context.temp_dir();
|
||||||
temp_dir.write("deno.json", r#"{}"#);
|
temp_dir.write("deno.json", r#"{}"#);
|
||||||
|
|
|
@ -107,7 +107,6 @@ fn node_unit_test(test: String) {
|
||||||
|
|
||||||
let mut deno = util::deno_cmd()
|
let mut deno = util::deno_cmd()
|
||||||
.current_dir(util::root_path())
|
.current_dir(util::root_path())
|
||||||
.env("DENO_FUTURE", "1")
|
|
||||||
.arg("test")
|
.arg("test")
|
||||||
.arg("--config")
|
.arg("--config")
|
||||||
.arg(deno_config_path())
|
.arg(deno_config_path())
|
||||||
|
|
|
@ -140,7 +140,7 @@ itest!(mixed_case_package_name_global_dir {
|
||||||
|
|
||||||
itest!(mixed_case_package_name_local_dir {
|
itest!(mixed_case_package_name_local_dir {
|
||||||
args:
|
args:
|
||||||
"run --node-modules=local-auto -A $TESTDATA/npm/mixed_case_package_name/local.ts",
|
"run --node-modules-dir=auto -A $TESTDATA/npm/mixed_case_package_name/local.ts",
|
||||||
output: "npm/mixed_case_package_name/local.out",
|
output: "npm/mixed_case_package_name/local.out",
|
||||||
exit_code: 0,
|
exit_code: 0,
|
||||||
envs: env_vars_for_npm_tests(),
|
envs: env_vars_for_npm_tests(),
|
||||||
|
@ -374,7 +374,7 @@ itest!(permissions_outside_package {
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(run_existing_npm_package {
|
itest!(run_existing_npm_package {
|
||||||
args: "run --allow-read --node-modules=local-auto npm:@denotest/bin",
|
args: "run --allow-read --node-modules-dir=auto npm:@denotest/bin",
|
||||||
output: "npm/run_existing_npm_package/main.out",
|
output: "npm/run_existing_npm_package/main.out",
|
||||||
envs: env_vars_for_npm_tests(),
|
envs: env_vars_for_npm_tests(),
|
||||||
http_server: true,
|
http_server: true,
|
||||||
|
@ -385,7 +385,7 @@ itest!(run_existing_npm_package {
|
||||||
|
|
||||||
itest!(run_existing_npm_package_with_subpath {
|
itest!(run_existing_npm_package_with_subpath {
|
||||||
args:
|
args:
|
||||||
"run --allow-read --node-modules=local-auto npm:@denotest/bin/cli-esm dev --help",
|
"run --allow-read --node-modules-dir=auto npm:@denotest/bin/cli-esm dev --help",
|
||||||
output: "npm/run_existing_npm_package_with_subpath/main.out",
|
output: "npm/run_existing_npm_package_with_subpath/main.out",
|
||||||
envs: env_vars_for_npm_tests(),
|
envs: env_vars_for_npm_tests(),
|
||||||
http_server: true,
|
http_server: true,
|
||||||
|
@ -813,7 +813,7 @@ itest!(builtin_module_module {
|
||||||
|
|
||||||
itest!(node_modules_dir_require_added_node_modules_folder {
|
itest!(node_modules_dir_require_added_node_modules_folder {
|
||||||
args:
|
args:
|
||||||
"run --node-modules=local-auto -A --quiet $TESTDATA/npm/require_added_nm_folder/main.js",
|
"run --node-modules-dir=auto -A --quiet $TESTDATA/npm/require_added_nm_folder/main.js",
|
||||||
output: "npm/require_added_nm_folder/main.out",
|
output: "npm/require_added_nm_folder/main.out",
|
||||||
envs: env_vars_for_npm_tests(),
|
envs: env_vars_for_npm_tests(),
|
||||||
http_server: true,
|
http_server: true,
|
||||||
|
@ -831,7 +831,7 @@ itest!(node_modules_dir_require_main_entry {
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(node_modules_dir_with_deps {
|
itest!(node_modules_dir_with_deps {
|
||||||
args: "run --allow-read --allow-env --node-modules=local-auto $TESTDATA/npm/cjs_with_deps/main.js",
|
args: "run --allow-read --allow-env --node-modules-dir=auto $TESTDATA/npm/cjs_with_deps/main.js",
|
||||||
output: "npm/cjs_with_deps/main_node_modules.out",
|
output: "npm/cjs_with_deps/main_node_modules.out",
|
||||||
envs: env_vars_for_npm_tests(),
|
envs: env_vars_for_npm_tests(),
|
||||||
http_server: true,
|
http_server: true,
|
||||||
|
@ -839,7 +839,7 @@ itest!(node_modules_dir_with_deps {
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(node_modules_dir_yargs {
|
itest!(node_modules_dir_yargs {
|
||||||
args: "run --allow-read --allow-env --node-modules=local-auto $TESTDATA/npm/cjs_yargs/main.js",
|
args: "run --allow-read --allow-env --node-modules-dir=auto $TESTDATA/npm/cjs_yargs/main.js",
|
||||||
output: "npm/cjs_yargs/main.out",
|
output: "npm/cjs_yargs/main.out",
|
||||||
envs: env_vars_for_npm_tests(),
|
envs: env_vars_for_npm_tests(),
|
||||||
http_server: true,
|
http_server: true,
|
||||||
|
@ -855,7 +855,7 @@ fn node_modules_dir_cache() {
|
||||||
let deno = util::deno_cmd_with_deno_dir(&deno_dir)
|
let deno = util::deno_cmd_with_deno_dir(&deno_dir)
|
||||||
.current_dir(deno_dir.path())
|
.current_dir(deno_dir.path())
|
||||||
.arg("cache")
|
.arg("cache")
|
||||||
.arg("--node-modules=local-auto")
|
.arg("--node-modules-dir=auto")
|
||||||
.arg("--quiet")
|
.arg("--quiet")
|
||||||
.arg(util::testdata_path().join("npm/dual_cjs_esm/main.ts"))
|
.arg(util::testdata_path().join("npm/dual_cjs_esm/main.ts"))
|
||||||
.envs(env_vars_for_npm_tests())
|
.envs(env_vars_for_npm_tests())
|
||||||
|
@ -888,7 +888,7 @@ fn node_modules_dir_cache() {
|
||||||
let deno = util::deno_cmd_with_deno_dir(&deno_dir)
|
let deno = util::deno_cmd_with_deno_dir(&deno_dir)
|
||||||
.current_dir(deno_dir.path())
|
.current_dir(deno_dir.path())
|
||||||
.arg("run")
|
.arg("run")
|
||||||
.arg("--node-modules=local-auto")
|
.arg("--node-modules-dir=auto")
|
||||||
.arg("--quiet")
|
.arg("--quiet")
|
||||||
.arg("-A")
|
.arg("-A")
|
||||||
.arg(util::testdata_path().join("npm/dual_cjs_esm/main.ts"))
|
.arg(util::testdata_path().join("npm/dual_cjs_esm/main.ts"))
|
||||||
|
@ -1496,7 +1496,7 @@ fn peer_deps_with_copied_folders_and_lockfile() {
|
||||||
// now run with local node modules
|
// now run with local node modules
|
||||||
let output = context
|
let output = context
|
||||||
.new_command()
|
.new_command()
|
||||||
.args("run -A --node-modules=local-auto main.ts")
|
.args("run -A --node-modules-dir=auto main.ts")
|
||||||
.run();
|
.run();
|
||||||
output.assert_exit_code(0);
|
output.assert_exit_code(0);
|
||||||
output.assert_matches_file(
|
output.assert_matches_file(
|
||||||
|
@ -1514,7 +1514,7 @@ fn peer_deps_with_copied_folders_and_lockfile() {
|
||||||
// now again run with local node modules
|
// now again run with local node modules
|
||||||
let output = context
|
let output = context
|
||||||
.new_command()
|
.new_command()
|
||||||
.args("run -A --node-modules=local-auto main.ts")
|
.args("run -A --node-modules-dir=auto main.ts")
|
||||||
.run();
|
.run();
|
||||||
output.assert_exit_code(0);
|
output.assert_exit_code(0);
|
||||||
output.assert_matches_text("1\n2\n");
|
output.assert_matches_text("1\n2\n");
|
||||||
|
@ -1522,7 +1522,7 @@ fn peer_deps_with_copied_folders_and_lockfile() {
|
||||||
// now ensure it works with reloading
|
// now ensure it works with reloading
|
||||||
let output = context
|
let output = context
|
||||||
.new_command()
|
.new_command()
|
||||||
.args("run -A --reload --node-modules=local-auto main.ts")
|
.args("run -A --reload --node-modules-dir=auto main.ts")
|
||||||
.run();
|
.run();
|
||||||
output.assert_exit_code(0);
|
output.assert_exit_code(0);
|
||||||
output.assert_matches_file(
|
output.assert_matches_file(
|
||||||
|
@ -1532,7 +1532,7 @@ fn peer_deps_with_copied_folders_and_lockfile() {
|
||||||
// now ensure it works with reloading and no lockfile
|
// now ensure it works with reloading and no lockfile
|
||||||
let output = context
|
let output = context
|
||||||
.new_command()
|
.new_command()
|
||||||
.args("run -A --reload --node-modules=local-auto --no-lock main.ts")
|
.args("run -A --reload --node-modules-dir=auto --no-lock main.ts")
|
||||||
.run();
|
.run();
|
||||||
output.assert_exit_code(0);
|
output.assert_exit_code(0);
|
||||||
output.assert_matches_file(
|
output.assert_matches_file(
|
||||||
|
@ -1880,7 +1880,7 @@ fn binary_package_with_optional_dependencies() {
|
||||||
|
|
||||||
let output = context
|
let output = context
|
||||||
.new_command()
|
.new_command()
|
||||||
.args("run -A --node-modules=local-auto main.js")
|
.args("run -A --node-modules-dir=auto main.js")
|
||||||
.run();
|
.run();
|
||||||
|
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
|
@ -1971,7 +1971,7 @@ fn node_modules_dir_config_file() {
|
||||||
let node_modules_dir = temp_dir.path().join("node_modules");
|
let node_modules_dir = temp_dir.path().join("node_modules");
|
||||||
let rm_node_modules = || std::fs::remove_dir_all(&node_modules_dir).unwrap();
|
let rm_node_modules = || std::fs::remove_dir_all(&node_modules_dir).unwrap();
|
||||||
|
|
||||||
temp_dir.write("deno.json", r#"{ "nodeModules": "local-auto" }"#);
|
temp_dir.write("deno.json", r#"{ "nodeModulesDir": "auto" }"#);
|
||||||
temp_dir.write("main.ts", "import 'npm:@denotest/esm-basic';");
|
temp_dir.write("main.ts", "import 'npm:@denotest/esm-basic';");
|
||||||
|
|
||||||
let deno_cache_cmd = test_context.new_command().args("cache --quiet main.ts");
|
let deno_cache_cmd = test_context.new_command().args("cache --quiet main.ts");
|
||||||
|
@ -1985,7 +1985,7 @@ fn node_modules_dir_config_file() {
|
||||||
assert!(node_modules_dir.exists());
|
assert!(node_modules_dir.exists());
|
||||||
|
|
||||||
rm_node_modules();
|
rm_node_modules();
|
||||||
temp_dir.write("deno.json", r#"{ "nodeModules": "global-auto" }"#);
|
temp_dir.write("deno.json", r#"{ "nodeModulesDir": "none" }"#);
|
||||||
|
|
||||||
deno_cache_cmd.run();
|
deno_cache_cmd.run();
|
||||||
assert!(!node_modules_dir.exists());
|
assert!(!node_modules_dir.exists());
|
||||||
|
@ -1996,7 +1996,7 @@ fn node_modules_dir_config_file() {
|
||||||
|
|
||||||
test_context
|
test_context
|
||||||
.new_command()
|
.new_command()
|
||||||
.args("cache --quiet --node-modules=local-auto main.ts")
|
.args("cache --quiet --node-modules-dir=auto main.ts")
|
||||||
.run();
|
.run();
|
||||||
assert!(node_modules_dir.exists());
|
assert!(node_modules_dir.exists());
|
||||||
|
|
||||||
|
@ -2004,7 +2004,7 @@ fn node_modules_dir_config_file() {
|
||||||
rm_node_modules();
|
rm_node_modules();
|
||||||
test_context
|
test_context
|
||||||
.new_command()
|
.new_command()
|
||||||
.args("cache --quiet --node-modules=global-auto --vendor main.ts")
|
.args("cache --quiet --node-modules-dir=none --vendor main.ts")
|
||||||
.run();
|
.run();
|
||||||
assert!(!node_modules_dir.exists());
|
assert!(!node_modules_dir.exists());
|
||||||
}
|
}
|
||||||
|
@ -2021,7 +2021,7 @@ fn top_level_install_package_json_explicit_opt_in() {
|
||||||
|
|
||||||
// when the node_modules_dir is explicitly opted into, we should always
|
// when the node_modules_dir is explicitly opted into, we should always
|
||||||
// ensure a top level package.json install occurs
|
// ensure a top level package.json install occurs
|
||||||
temp_dir.write("deno.json", "{ \"nodeModules\": \"local-auto\" }");
|
temp_dir.write("deno.json", "{ \"nodeModulesDir\": \"auto\" }");
|
||||||
temp_dir.write(
|
temp_dir.write(
|
||||||
"package.json",
|
"package.json",
|
||||||
"{ \"dependencies\": { \"@denotest/esm-basic\": \"1.0\" }}",
|
"{ \"dependencies\": { \"@denotest/esm-basic\": \"1.0\" }}",
|
||||||
|
@ -2110,7 +2110,7 @@ itest!(check_package_file_dts_dmts_dcts {
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(require_resolve_url_paths {
|
itest!(require_resolve_url_paths {
|
||||||
args: "run -A --quiet --node-modules=local-auto url_paths.ts",
|
args: "run -A --quiet --node-modules-dir=auto url_paths.ts",
|
||||||
output: "npm/require_resolve_url/url_paths.out",
|
output: "npm/require_resolve_url/url_paths.out",
|
||||||
envs: env_vars_for_npm_tests(),
|
envs: env_vars_for_npm_tests(),
|
||||||
http_server: true,
|
http_server: true,
|
||||||
|
@ -2121,10 +2121,7 @@ itest!(require_resolve_url_paths {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn byonm_cjs_esm_packages() {
|
fn byonm_cjs_esm_packages() {
|
||||||
let test_context = TestContextBuilder::for_npm()
|
let test_context = TestContextBuilder::for_npm().use_temp_cwd().build();
|
||||||
.env("DENO_UNSTABLE_BYONM", "1")
|
|
||||||
.use_temp_cwd()
|
|
||||||
.build();
|
|
||||||
let dir = test_context.temp_dir();
|
let dir = test_context.temp_dir();
|
||||||
|
|
||||||
test_context.run_npm("init -y");
|
test_context.run_npm("init -y");
|
||||||
|
@ -2206,10 +2203,7 @@ console.log(getKind());
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn future_byonm_cjs_esm_packages() {
|
fn future_byonm_cjs_esm_packages() {
|
||||||
let test_context = TestContextBuilder::for_npm()
|
let test_context = TestContextBuilder::for_npm().use_temp_cwd().build();
|
||||||
.env("DENO_FUTURE", "1")
|
|
||||||
.use_temp_cwd()
|
|
||||||
.build();
|
|
||||||
let dir = test_context.temp_dir();
|
let dir = test_context.temp_dir();
|
||||||
|
|
||||||
test_context.run_npm("init -y");
|
test_context.run_npm("init -y");
|
||||||
|
@ -2290,59 +2284,13 @@ console.log(getKind());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn byonm_import_map() {
|
fn node_modules_dir_manual_import_map() {
|
||||||
let test_context = TestContextBuilder::for_npm().use_temp_cwd().build();
|
let test_context = TestContextBuilder::for_npm().use_temp_cwd().build();
|
||||||
let dir = test_context.temp_dir();
|
let dir = test_context.temp_dir();
|
||||||
dir.write(
|
dir.write(
|
||||||
"deno.json",
|
"deno.json",
|
||||||
r#"{
|
r#"{
|
||||||
"imports": {
|
"nodeModulesDir": "manual",
|
||||||
"basic": "npm:@denotest/esm-basic"
|
|
||||||
},
|
|
||||||
"unstable": [ "byonm" ]
|
|
||||||
}"#,
|
|
||||||
);
|
|
||||||
dir.write(
|
|
||||||
"package.json",
|
|
||||||
r#"{
|
|
||||||
"name": "my-project",
|
|
||||||
"version": "1.0.0",
|
|
||||||
"type": "module",
|
|
||||||
"dependencies": {
|
|
||||||
"@denotest/esm-basic": "^1.0"
|
|
||||||
}
|
|
||||||
}"#,
|
|
||||||
);
|
|
||||||
test_context.run_npm("install");
|
|
||||||
|
|
||||||
dir.write(
|
|
||||||
"main.ts",
|
|
||||||
r#"
|
|
||||||
// import map should resolve
|
|
||||||
import { getValue } from "basic";
|
|
||||||
// and resolving via node resolution
|
|
||||||
import { setValue } from "@denotest/esm-basic";
|
|
||||||
|
|
||||||
setValue(5);
|
|
||||||
console.log(getValue());
|
|
||||||
"#,
|
|
||||||
);
|
|
||||||
let output = test_context.new_command().args("run main.ts").run();
|
|
||||||
output.assert_matches_text("5\n");
|
|
||||||
let output = test_context.new_command().args("check main.ts").run();
|
|
||||||
output.assert_matches_text("Check file:///[WILDCARD]/main.ts\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn future_byonm_import_map() {
|
|
||||||
let test_context = TestContextBuilder::for_npm()
|
|
||||||
.env("DENO_FUTURE", "1")
|
|
||||||
.use_temp_cwd()
|
|
||||||
.build();
|
|
||||||
let dir = test_context.temp_dir();
|
|
||||||
dir.write(
|
|
||||||
"deno.json",
|
|
||||||
r#"{
|
|
||||||
"imports": {
|
"imports": {
|
||||||
"basic": "npm:@denotest/esm-basic"
|
"basic": "npm:@denotest/esm-basic"
|
||||||
}
|
}
|
||||||
|
@ -2381,10 +2329,7 @@ console.log(getValue());
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn byonm_package_specifier_not_installed_and_invalid_subpath() {
|
fn byonm_package_specifier_not_installed_and_invalid_subpath() {
|
||||||
let test_context = TestContextBuilder::for_npm()
|
let test_context = TestContextBuilder::for_npm().use_temp_cwd().build();
|
||||||
.env("DENO_UNSTABLE_BYONM", "1")
|
|
||||||
.use_temp_cwd()
|
|
||||||
.build();
|
|
||||||
let dir = test_context.temp_dir();
|
let dir = test_context.temp_dir();
|
||||||
dir.path().join("package.json").write_json(&json!({
|
dir.path().join("package.json").write_json(&json!({
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -2525,10 +2470,7 @@ console.log(getValue());
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn future_byonm_npm_workspaces() {
|
fn future_byonm_npm_workspaces() {
|
||||||
let test_context = TestContextBuilder::for_npm()
|
let test_context = TestContextBuilder::for_npm().use_temp_cwd().build();
|
||||||
.env("DENO_FUTURE", "1")
|
|
||||||
.use_temp_cwd()
|
|
||||||
.build();
|
|
||||||
let dir = test_context.temp_dir();
|
let dir = test_context.temp_dir();
|
||||||
|
|
||||||
dir.write(
|
dir.write(
|
||||||
|
@ -2781,7 +2723,7 @@ fn cjs_export_analysis_import_cjs_directly_relative_import() {
|
||||||
|
|
||||||
itest!(imports_package_json {
|
itest!(imports_package_json {
|
||||||
args:
|
args:
|
||||||
"run --no-lock --node-modules=global-auto npm/imports_package_json/main.js",
|
"run --no-lock --node-modules-dir=none npm/imports_package_json/main.js",
|
||||||
output: "npm/imports_package_json/main.out",
|
output: "npm/imports_package_json/main.out",
|
||||||
envs: env_vars_for_npm_tests(),
|
envs: env_vars_for_npm_tests(),
|
||||||
http_server: true,
|
http_server: true,
|
||||||
|
@ -2789,7 +2731,7 @@ itest!(imports_package_json {
|
||||||
|
|
||||||
itest!(imports_package_json_import_not_defined {
|
itest!(imports_package_json_import_not_defined {
|
||||||
args:
|
args:
|
||||||
"run --no-lock --node-modules=global-auto npm/imports_package_json/import_not_defined.js",
|
"run --no-lock --node-modules-dir=none npm/imports_package_json/import_not_defined.js",
|
||||||
output: "npm/imports_package_json/import_not_defined.out",
|
output: "npm/imports_package_json/import_not_defined.out",
|
||||||
envs: env_vars_for_npm_tests(),
|
envs: env_vars_for_npm_tests(),
|
||||||
exit_code: 1,
|
exit_code: 1,
|
||||||
|
@ -2798,7 +2740,7 @@ itest!(imports_package_json_import_not_defined {
|
||||||
|
|
||||||
itest!(imports_package_json_sub_path_import_not_defined {
|
itest!(imports_package_json_sub_path_import_not_defined {
|
||||||
args:
|
args:
|
||||||
"run --no-lock --node-modules=global-auto npm/imports_package_json/sub_path_import_not_defined.js",
|
"run --no-lock --node-modules-dir=none npm/imports_package_json/sub_path_import_not_defined.js",
|
||||||
output: "npm/imports_package_json/sub_path_import_not_defined.out",
|
output: "npm/imports_package_json/sub_path_import_not_defined.out",
|
||||||
envs: env_vars_for_npm_tests(),
|
envs: env_vars_for_npm_tests(),
|
||||||
exit_code: 1,
|
exit_code: 1,
|
||||||
|
@ -2806,7 +2748,7 @@ itest!(imports_package_json_sub_path_import_not_defined {
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(different_nested_dep_node_modules_dir_false {
|
itest!(different_nested_dep_node_modules_dir_false {
|
||||||
args: "run --quiet --no-lock --node-modules=global-auto npm/different_nested_dep/main.js",
|
args: "run --quiet --no-lock --node-modules-dir=none npm/different_nested_dep/main.js",
|
||||||
output: "npm/different_nested_dep/main.out",
|
output: "npm/different_nested_dep/main.out",
|
||||||
envs: env_vars_for_npm_tests(),
|
envs: env_vars_for_npm_tests(),
|
||||||
exit_code: 0,
|
exit_code: 0,
|
||||||
|
@ -2814,7 +2756,7 @@ itest!(different_nested_dep_node_modules_dir_false {
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(different_nested_dep_node_modules_dir_true {
|
itest!(different_nested_dep_node_modules_dir_true {
|
||||||
args: "run --no-lock --quiet --node-modules=local-auto main.js",
|
args: "run --no-lock --quiet --node-modules-dir=auto main.js",
|
||||||
output: "npm/different_nested_dep/main.out",
|
output: "npm/different_nested_dep/main.out",
|
||||||
copy_temp_dir: Some("npm/different_nested_dep/"),
|
copy_temp_dir: Some("npm/different_nested_dep/"),
|
||||||
cwd: Some("npm/different_nested_dep/"),
|
cwd: Some("npm/different_nested_dep/"),
|
||||||
|
@ -2848,11 +2790,7 @@ fn different_nested_dep_byonm_future() {
|
||||||
|
|
||||||
test_context.run_npm("install");
|
test_context.run_npm("install");
|
||||||
|
|
||||||
let output = test_context
|
let output = test_context.new_command().args("run main.js").run();
|
||||||
.new_command()
|
|
||||||
.args("run main.js")
|
|
||||||
.env("DENO_FUTURE", "1")
|
|
||||||
.run();
|
|
||||||
output.assert_matches_file("npm/different_nested_dep/main.out");
|
output.assert_matches_file("npm/different_nested_dep/main.out");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1106,7 +1106,7 @@ fn lock_deno_json_package_json_deps_workspace() {
|
||||||
// deno.json
|
// deno.json
|
||||||
let deno_json = temp_dir.join("deno.json");
|
let deno_json = temp_dir.join("deno.json");
|
||||||
deno_json.write_json(&json!({
|
deno_json.write_json(&json!({
|
||||||
"nodeModules": "local-auto"
|
"nodeModulesDir": "auto"
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// package.json
|
// package.json
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
{
|
{
|
||||||
"nodeModules": "local-auto"
|
"nodeModulesDir": "auto"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"nodeModules": "local-auto",
|
"nodeModulesDir": "auto",
|
||||||
"tasks": {
|
"tasks": {
|
||||||
"cat": "cat",
|
"cat": "cat",
|
||||||
"rm_node_modules": "rm -rf node_modules"
|
"rm_node_modules": "rm -rf node_modules"
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
{
|
{
|
||||||
"nodeModules": "local-auto"
|
"nodeModulesDir": "auto"
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,12 +15,12 @@
|
||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
"auto_install": {
|
"auto_install": {
|
||||||
"args": "check --node-modules=local-auto --quiet main.ts",
|
"args": "check --node-modules-dir=auto --quiet main.ts",
|
||||||
"exitCode": 1,
|
"exitCode": 1,
|
||||||
"output": "expected.out"
|
"output": "expected.out"
|
||||||
},
|
},
|
||||||
"global_folder": {
|
"global_folder": {
|
||||||
"args": "check --node-modules=global-auto --quiet main.ts",
|
"args": "check --node-modules-dir=none --quiet main.ts",
|
||||||
"exitCode": 1,
|
"exitCode": 1,
|
||||||
"output": "expected.out"
|
"output": "expected.out"
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,12 +15,12 @@
|
||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
"auto_install": {
|
"auto_install": {
|
||||||
"args": "check --node-modules=local-auto --quiet main_auto_install.ts",
|
"args": "check --node-modules-dir=auto --quiet main_auto_install.ts",
|
||||||
"exitCode": 1,
|
"exitCode": 1,
|
||||||
"output": "expected.out"
|
"output": "expected.out"
|
||||||
},
|
},
|
||||||
"global_folder": {
|
"global_folder": {
|
||||||
"args": "check --node-modules=global-auto --quiet main_auto_install.ts",
|
"args": "check --node-modules-dir=none --quiet main_auto_install.ts",
|
||||||
"exitCode": 1,
|
"exitCode": 1,
|
||||||
"output": "expected.out"
|
"output": "expected.out"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"tempDir": true,
|
"tempDir": true,
|
||||||
"args": "run --allow-read --node-modules=local-auto main.js",
|
"args": "run --allow-read --node-modules-dir=auto main.js",
|
||||||
"output": "main.out"
|
"output": "main.out"
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,11 +10,11 @@
|
||||||
"exitCode": 1
|
"exitCode": 1
|
||||||
}, {
|
}, {
|
||||||
// this should override byonm
|
// this should override byonm
|
||||||
"args": "run --node-modules=global-auto --quiet main.ts",
|
"args": "run --node-modules-dir=none --quiet main.ts",
|
||||||
"output": "main.out"
|
"output": "main.out"
|
||||||
}, {
|
}, {
|
||||||
// same with this
|
// same with this
|
||||||
"args": "run --node-modules=local-auto --quiet main.ts",
|
"args": "run --node-modules-dir=auto --quiet main.ts",
|
||||||
"output": "main.out"
|
"output": "main.out"
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
|
|
|
@ -135,7 +135,7 @@
|
||||||
"output": ""
|
"output": ""
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"args": "cache --allow-scripts --node-modules=local-auto no_deno_json.js",
|
"args": "cache --allow-scripts --node-modules-dir=auto no_deno_json.js",
|
||||||
"output": "no_deno_json.out"
|
"output": "no_deno_json.out"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -148,7 +148,7 @@
|
||||||
"output": ""
|
"output": ""
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"args": "cache --allow-scripts --node-modules=local-auto conflicting_bin.js",
|
"args": "cache --allow-scripts --node-modules-dir=auto conflicting_bin.js",
|
||||||
"output": "conflicting_bin.out"
|
"output": "conflicting_bin.out"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
{
|
{
|
||||||
"nodeModules": "local-auto"
|
"nodeModulesDir": "auto"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"nodeModules": "local-auto",
|
"nodeModulesDir": "auto",
|
||||||
"imports": {
|
"imports": {
|
||||||
"preact": "npm:preact",
|
"preact": "npm:preact",
|
||||||
"preact-render-to-string": "npm:preact-render-to-string"
|
"preact-render-to-string": "npm:preact-render-to-string"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"args": "run --node-modules=local-auto --allow-read main.mjs",
|
"args": "run --node-modules-dir=auto --allow-read main.mjs",
|
||||||
"output": "main.out",
|
"output": "main.out",
|
||||||
"exitCode": 0,
|
"exitCode": 0,
|
||||||
"tempDir": true
|
"tempDir": true
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
"run_node_modules_dir": {
|
"run_node_modules_dir": {
|
||||||
"args": "run --node-modules=local-auto -A --quiet main.js",
|
"args": "run --node-modules-dir=auto -A --quiet main.js",
|
||||||
"output": "main.out"
|
"output": "main.out"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,13 +3,13 @@
|
||||||
"tests": {
|
"tests": {
|
||||||
"auth_success": {
|
"auth_success": {
|
||||||
"cwd": "success",
|
"cwd": "success",
|
||||||
"args": "run --node-modules=local-auto -A main.js",
|
"args": "run --node-modules-dir=auto -A main.js",
|
||||||
"output": "success/main.out",
|
"output": "success/main.out",
|
||||||
"exitCode": 1
|
"exitCode": 1
|
||||||
},
|
},
|
||||||
"auth_fail": {
|
"auth_fail": {
|
||||||
"cwd": "fail",
|
"cwd": "fail",
|
||||||
"args": "run --node-modules=local-auto -A main.js",
|
"args": "run --node-modules-dir=auto -A main.js",
|
||||||
"output": "fail/main.out",
|
"output": "fail/main.out",
|
||||||
"exitCode": 1
|
"exitCode": 1
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,15 +2,15 @@
|
||||||
"tempDir": true,
|
"tempDir": true,
|
||||||
"tests": {
|
"tests": {
|
||||||
"global_cache": {
|
"global_cache": {
|
||||||
"args": "run --node-modules=global-auto b/main.ts",
|
"args": "run --node-modules-dir=none b/main.ts",
|
||||||
"output": "b/main_global_cache.out"
|
"output": "b/main_global_cache.out"
|
||||||
},
|
},
|
||||||
"global_cache_bare_specifier_not_in_pkg": {
|
"global_cache_bare_specifier_not_in_pkg": {
|
||||||
"args": "run --node-modules=global-auto main.ts",
|
"args": "run --node-modules-dir=none main.ts",
|
||||||
"output": "main.out"
|
"output": "main.out"
|
||||||
},
|
},
|
||||||
"node_modules_dir": {
|
"node_modules_dir": {
|
||||||
"args": "run --node-modules=local-auto b/main.ts",
|
"args": "run --node-modules-dir=auto b/main.ts",
|
||||||
"output": "b/main_node_modules_dir.out"
|
"output": "b/main_node_modules_dir.out"
|
||||||
},
|
},
|
||||||
"byonm": {
|
"byonm": {
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
{
|
{
|
||||||
"nodeModules": "local-auto"
|
"nodeModulesDir": "auto"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{
|
{
|
||||||
"args": "run --node-modules=global-auto main.ts",
|
"args": "run --node-modules-dir=none main.ts",
|
||||||
"output": "main.out"
|
"output": "main.out"
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,5 +4,5 @@
|
||||||
"exports": {
|
"exports": {
|
||||||
".": "./mod.ts"
|
".": "./mod.ts"
|
||||||
},
|
},
|
||||||
"nodeModules": "global-auto"
|
"nodeModulesDir": "none"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
{
|
{
|
||||||
"nodeModules": "local-auto"
|
"nodeModulesDir": "auto"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"nodeModules": "local-auto",
|
"nodeModulesDir": "auto",
|
||||||
"tasks": {
|
"tasks": {
|
||||||
"repro": "echo hi"
|
"repro": "echo hi"
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,9 +51,6 @@ const validPrefixes = [
|
||||||
"Reland ",
|
"Reland ",
|
||||||
// Allow landing breaking changes that are properly marked
|
// Allow landing breaking changes that are properly marked
|
||||||
"BREAKING",
|
"BREAKING",
|
||||||
// Allow landing breaking changes that will be applied in Deno 2, or available
|
|
||||||
// immediately with DENO_FUTURE=1 env var
|
|
||||||
"FUTURE",
|
|
||||||
];
|
];
|
||||||
|
|
||||||
if (validPrefixes.some((prefix) => prTitle.startsWith(prefix))) {
|
if (validPrefixes.some((prefix) => prTitle.startsWith(prefix))) {
|
||||||
|
|
Loading…
Reference in a new issue