Skip to content

Commit

Permalink
refactor: move denort to separate crate (#27688)
Browse files Browse the repository at this point in the history
This slightly degrades the performance of CJS export analysis on
subsequent runs because I changed it to no longer cache in the DENO_DIR
with this PR (denort now properly has no idea about the DENO_DIR). We'll
have to change it to embed this data in the binary and that will also
allow us to get rid of swc in denort (will do that in a follow-up PR).
  • Loading branch information
dsherret authored Jan 17, 2025
1 parent 0540757 commit 57dd66e
Show file tree
Hide file tree
Showing 112 changed files with 5,696 additions and 5,500 deletions.
93 changes: 62 additions & 31 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ members = [
"bench_util",
"cli",
"cli/lib",
"cli/rt",
"cli/snapshot",
"ext/broadcast_channel",
"ext/cache",
"ext/canvas",
Expand Down Expand Up @@ -100,6 +102,7 @@ deno_webstorage = { version = "0.181.0", path = "./ext/webstorage" }
deno_lib = { version = "0.2.0", path = "./cli/lib" }
deno_npm_cache = { version = "0.5.0", path = "./resolvers/npm_cache" }
deno_resolver = { version = "0.17.0", path = "./resolvers/deno" }
deno_snapshots = { version = "0.1.0", path = "./cli/snapshot" }
node_resolver = { version = "0.24.0", path = "./resolvers/node" }

aes = "=0.8.3"
Expand Down Expand Up @@ -154,6 +157,7 @@ ipnet = "2.3"
jsonc-parser = { version = "=0.26.2", features = ["serde"] }
lazy-regex = "3"
libc = "0.2.168"
libsui = "0.5.0"
libz-sys = { version = "1.1.20", default-features = false }
log = { version = "0.4.20", features = ["kv"] }
lsp-types = "=0.97.0" # used by tower-lsp and "proposed" feature is unstable in patch releases
Expand Down
17 changes: 7 additions & 10 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ name = "deno"
path = "main.rs"
doc = false

[[bin]]
name = "denort"
path = "mainrt.rs"
doc = false

[[test]]
name = "integration"
path = "integration_tests_runner.rs"
Expand Down Expand Up @@ -49,7 +44,7 @@ dhat-heap = ["dhat"]
upgrade = []
# A dev feature to disable creations and loading of snapshots in favor of
# loading JS sources at runtime.
hmr = ["deno_runtime/hmr"]
hmr = ["deno_runtime/hmr", "deno_snapshots/disable"]
# Vendor zlib as zlib-ng
__vendored_zlib_ng = ["flate2/zlib-ng-compat", "libz-sys/zlib-ng"]

Expand All @@ -60,10 +55,12 @@ lazy-regex.workspace = true
serde.workspace = true
serde_json.workspace = true
zstd.workspace = true
glibc_version = "0.1.2"
flate2 = { workspace = true, features = ["default"] }
deno_error.workspace = true

[target.'cfg(unix)'.build-dependencies]
glibc_version = "0.1.2"

[target.'cfg(windows)'.build-dependencies]
winapi.workspace = true
winres.workspace = true
Expand All @@ -86,10 +83,11 @@ deno_path_util.workspace = true
deno_resolver = { workspace = true, features = ["sync"] }
deno_runtime = { workspace = true, features = ["include_js_files_for_snapshotting"] }
deno_semver.workspace = true
deno_snapshots = { workspace = true }
deno_task_shell = "=0.20.2"
deno_telemetry.workspace = true
deno_terminal.workspace = true
libsui = "0.5.0"
libsui.workspace = true
node_resolver.workspace = true

anstream = "0.6.14"
Expand All @@ -115,7 +113,6 @@ dprint-plugin-json = "=0.19.4"
dprint-plugin-jupyter = "=0.1.5"
dprint-plugin-markdown = "=0.17.8"
dprint-plugin-typescript = "=0.93.3"
env_logger = "=0.10.0"
fancy-regex = "=0.10.0"
faster-hex.workspace = true
# If you disable the default __vendored_zlib_ng feature above, you _must_ be able to link against `-lz`.
Expand Down Expand Up @@ -156,7 +153,6 @@ rustyline-derive = "=0.7.0"
serde.workspace = true
serde_repr.workspace = true
sha2.workspace = true
shell-escape = "=0.1.5"
spki = { version = "0.7", features = ["pem"] }
sqlformat = "=0.3.2"
strsim = "0.11.1"
Expand Down Expand Up @@ -185,6 +181,7 @@ winapi = { workspace = true, features = ["knownfolders", "mswsock", "objbase", "

[target.'cfg(unix)'.dependencies]
nix.workspace = true
shell-escape = "=0.1.5"

[dev-dependencies]
deno_bench_util.workspace = true
Expand Down
34 changes: 8 additions & 26 deletions cli/args/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ use deno_core::error::AnyError;
use deno_core::resolve_url_or_path;
use deno_core::url::Url;
use deno_graph::GraphKind;
use deno_lib::args::CaData;
use deno_lib::args::UnstableConfig;
use deno_lib::version::DENO_VERSION_INFO;
use deno_path_util::normalize_path;
use deno_path_util::url_to_file_path;
use deno_runtime::deno_permissions::SysDescriptor;
Expand Down Expand Up @@ -546,15 +549,6 @@ impl Default for TypeCheckMode {
}
}

#[derive(Clone, Debug, Eq, PartialEq)]
pub enum CaData {
/// The string is a file path
File(String),
/// This variant is not exposed as an option in the CLI, it is used internally
/// for standalone binaries.
Bytes(Vec<u8>),
}

// Info needed to run NPM lifecycle scripts
#[derive(Clone, Debug, Eq, PartialEq, Default)]
pub struct LifecycleScriptsConfig {
Expand Down Expand Up @@ -582,19 +576,6 @@ fn parse_packages_allowed_scripts(s: &str) -> Result<String, AnyError> {
}
}

#[derive(
Clone, Default, Debug, Eq, PartialEq, serde::Serialize, serde::Deserialize,
)]
pub struct UnstableConfig {
// TODO(bartlomieju): remove in Deno 2.5
pub legacy_flag_enabled: bool, // --unstable
pub bare_node_builtins: bool,
pub detect_cjs: bool,
pub sloppy_imports: bool,
pub npm_lazy_caching: bool,
pub features: Vec<String>, // --unstabe-kv --unstable-cron
}

#[derive(Clone, Debug, Eq, PartialEq, Default)]
pub struct InternalFlags {
/// Used when the language server is configured with an
Expand Down Expand Up @@ -1484,14 +1465,15 @@ fn handle_repl_flags(flags: &mut Flags, repl_flags: ReplFlags) {
}

pub fn clap_root() -> Command {
debug_assert_eq!(DENO_VERSION_INFO.typescript, deno_snapshots::TS_VERSION);
let long_version = format!(
"{} ({}, {}, {})\nv8 {}\ntypescript {}",
crate::version::DENO_VERSION_INFO.deno,
crate::version::DENO_VERSION_INFO.release_channel.name(),
DENO_VERSION_INFO.deno,
DENO_VERSION_INFO.release_channel.name(),
env!("PROFILE"),
env!("TARGET"),
deno_core::v8::VERSION_STRING,
crate::version::DENO_VERSION_INFO.typescript
DENO_VERSION_INFO.typescript
);

run_args(Command::new("deno"), true)
Expand All @@ -1507,7 +1489,7 @@ pub fn clap_root() -> Command {
)
.color(ColorChoice::Auto)
.term_width(800)
.version(crate::version::DENO_VERSION_INFO.deno)
.version(DENO_VERSION_INFO.deno)
.long_version(long_version)
.disable_version_flag(true)
.disable_help_flag(true)
Expand Down
Loading

0 comments on commit 57dd66e

Please sign in to comment.