Skip to content

Commit 57dd66e

Browse files
authored
refactor: move denort to separate crate (#27688)
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).
1 parent 0540757 commit 57dd66e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+5696
-5500
lines changed

Cargo.lock

Lines changed: 62 additions & 31 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ members = [
66
"bench_util",
77
"cli",
88
"cli/lib",
9+
"cli/rt",
10+
"cli/snapshot",
911
"ext/broadcast_channel",
1012
"ext/cache",
1113
"ext/canvas",
@@ -100,6 +102,7 @@ deno_webstorage = { version = "0.181.0", path = "./ext/webstorage" }
100102
deno_lib = { version = "0.2.0", path = "./cli/lib" }
101103
deno_npm_cache = { version = "0.5.0", path = "./resolvers/npm_cache" }
102104
deno_resolver = { version = "0.17.0", path = "./resolvers/deno" }
105+
deno_snapshots = { version = "0.1.0", path = "./cli/snapshot" }
103106
node_resolver = { version = "0.24.0", path = "./resolvers/node" }
104107

105108
aes = "=0.8.3"
@@ -154,6 +157,7 @@ ipnet = "2.3"
154157
jsonc-parser = { version = "=0.26.2", features = ["serde"] }
155158
lazy-regex = "3"
156159
libc = "0.2.168"
160+
libsui = "0.5.0"
157161
libz-sys = { version = "1.1.20", default-features = false }
158162
log = { version = "0.4.20", features = ["kv"] }
159163
lsp-types = "=0.97.0" # used by tower-lsp and "proposed" feature is unstable in patch releases

cli/Cargo.toml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,6 @@ name = "deno"
1616
path = "main.rs"
1717
doc = false
1818

19-
[[bin]]
20-
name = "denort"
21-
path = "mainrt.rs"
22-
doc = false
23-
2419
[[test]]
2520
name = "integration"
2621
path = "integration_tests_runner.rs"
@@ -49,7 +44,7 @@ dhat-heap = ["dhat"]
4944
upgrade = []
5045
# A dev feature to disable creations and loading of snapshots in favor of
5146
# loading JS sources at runtime.
52-
hmr = ["deno_runtime/hmr"]
47+
hmr = ["deno_runtime/hmr", "deno_snapshots/disable"]
5348
# Vendor zlib as zlib-ng
5449
__vendored_zlib_ng = ["flate2/zlib-ng-compat", "libz-sys/zlib-ng"]
5550

@@ -60,10 +55,12 @@ lazy-regex.workspace = true
6055
serde.workspace = true
6156
serde_json.workspace = true
6257
zstd.workspace = true
63-
glibc_version = "0.1.2"
6458
flate2 = { workspace = true, features = ["default"] }
6559
deno_error.workspace = true
6660

61+
[target.'cfg(unix)'.build-dependencies]
62+
glibc_version = "0.1.2"
63+
6764
[target.'cfg(windows)'.build-dependencies]
6865
winapi.workspace = true
6966
winres.workspace = true
@@ -86,10 +83,11 @@ deno_path_util.workspace = true
8683
deno_resolver = { workspace = true, features = ["sync"] }
8784
deno_runtime = { workspace = true, features = ["include_js_files_for_snapshotting"] }
8885
deno_semver.workspace = true
86+
deno_snapshots = { workspace = true }
8987
deno_task_shell = "=0.20.2"
9088
deno_telemetry.workspace = true
9189
deno_terminal.workspace = true
92-
libsui = "0.5.0"
90+
libsui.workspace = true
9391
node_resolver.workspace = true
9492

9593
anstream = "0.6.14"
@@ -115,7 +113,6 @@ dprint-plugin-json = "=0.19.4"
115113
dprint-plugin-jupyter = "=0.1.5"
116114
dprint-plugin-markdown = "=0.17.8"
117115
dprint-plugin-typescript = "=0.93.3"
118-
env_logger = "=0.10.0"
119116
fancy-regex = "=0.10.0"
120117
faster-hex.workspace = true
121118
# If you disable the default __vendored_zlib_ng feature above, you _must_ be able to link against `-lz`.
@@ -156,7 +153,6 @@ rustyline-derive = "=0.7.0"
156153
serde.workspace = true
157154
serde_repr.workspace = true
158155
sha2.workspace = true
159-
shell-escape = "=0.1.5"
160156
spki = { version = "0.7", features = ["pem"] }
161157
sqlformat = "=0.3.2"
162158
strsim = "0.11.1"
@@ -185,6 +181,7 @@ winapi = { workspace = true, features = ["knownfolders", "mswsock", "objbase", "
185181

186182
[target.'cfg(unix)'.dependencies]
187183
nix.workspace = true
184+
shell-escape = "=0.1.5"
188185

189186
[dev-dependencies]
190187
deno_bench_util.workspace = true

cli/args/flags.rs

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ use deno_core::error::AnyError;
3131
use deno_core::resolve_url_or_path;
3232
use deno_core::url::Url;
3333
use deno_graph::GraphKind;
34+
use deno_lib::args::CaData;
35+
use deno_lib::args::UnstableConfig;
36+
use deno_lib::version::DENO_VERSION_INFO;
3437
use deno_path_util::normalize_path;
3538
use deno_path_util::url_to_file_path;
3639
use deno_runtime::deno_permissions::SysDescriptor;
@@ -546,15 +549,6 @@ impl Default for TypeCheckMode {
546549
}
547550
}
548551

549-
#[derive(Clone, Debug, Eq, PartialEq)]
550-
pub enum CaData {
551-
/// The string is a file path
552-
File(String),
553-
/// This variant is not exposed as an option in the CLI, it is used internally
554-
/// for standalone binaries.
555-
Bytes(Vec<u8>),
556-
}
557-
558552
// Info needed to run NPM lifecycle scripts
559553
#[derive(Clone, Debug, Eq, PartialEq, Default)]
560554
pub struct LifecycleScriptsConfig {
@@ -582,19 +576,6 @@ fn parse_packages_allowed_scripts(s: &str) -> Result<String, AnyError> {
582576
}
583577
}
584578

585-
#[derive(
586-
Clone, Default, Debug, Eq, PartialEq, serde::Serialize, serde::Deserialize,
587-
)]
588-
pub struct UnstableConfig {
589-
// TODO(bartlomieju): remove in Deno 2.5
590-
pub legacy_flag_enabled: bool, // --unstable
591-
pub bare_node_builtins: bool,
592-
pub detect_cjs: bool,
593-
pub sloppy_imports: bool,
594-
pub npm_lazy_caching: bool,
595-
pub features: Vec<String>, // --unstabe-kv --unstable-cron
596-
}
597-
598579
#[derive(Clone, Debug, Eq, PartialEq, Default)]
599580
pub struct InternalFlags {
600581
/// Used when the language server is configured with an
@@ -1484,14 +1465,15 @@ fn handle_repl_flags(flags: &mut Flags, repl_flags: ReplFlags) {
14841465
}
14851466

14861467
pub fn clap_root() -> Command {
1468+
debug_assert_eq!(DENO_VERSION_INFO.typescript, deno_snapshots::TS_VERSION);
14871469
let long_version = format!(
14881470
"{} ({}, {}, {})\nv8 {}\ntypescript {}",
1489-
crate::version::DENO_VERSION_INFO.deno,
1490-
crate::version::DENO_VERSION_INFO.release_channel.name(),
1471+
DENO_VERSION_INFO.deno,
1472+
DENO_VERSION_INFO.release_channel.name(),
14911473
env!("PROFILE"),
14921474
env!("TARGET"),
14931475
deno_core::v8::VERSION_STRING,
1494-
crate::version::DENO_VERSION_INFO.typescript
1476+
DENO_VERSION_INFO.typescript
14951477
);
14961478

14971479
run_args(Command::new("deno"), true)
@@ -1507,7 +1489,7 @@ pub fn clap_root() -> Command {
15071489
)
15081490
.color(ColorChoice::Auto)
15091491
.term_width(800)
1510-
.version(crate::version::DENO_VERSION_INFO.deno)
1492+
.version(DENO_VERSION_INFO.deno)
15111493
.long_version(long_version)
15121494
.disable_version_flag(true)
15131495
.disable_help_flag(true)

0 commit comments

Comments
 (0)