mirror of
https://github.com/denoland/deno.git
synced 2025-07-07 13:25:07 +00:00
perf: bust emit cache only on deno_ast version change (#29984)
The emit cache is pretty stable nowadays, so we could probably just cache bust whenever the deno_ast version changes instead of the CLI version. This will also allow stuff like deno-js-loader to reuse cached emits.
This commit is contained in:
parent
9379a74e08
commit
f2129e4f94
6 changed files with 11 additions and 21 deletions
4
Cargo.lock
generated
4
Cargo.lock
generated
|
@ -1636,9 +1636,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "deno_ast"
|
||||
version = "0.48.0"
|
||||
version = "0.48.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0f883bd8eae4dfc8019d925ec3dd04b634b6af9346a5168acc259d55f5f5021d"
|
||||
checksum = "0ced09fdb8884e29716cc0691e8510f9c655762bbb9da3111dacc0a2ef6e8960"
|
||||
dependencies = [
|
||||
"base64 0.22.1",
|
||||
"capacity_builder",
|
||||
|
|
|
@ -58,7 +58,7 @@ license = "MIT"
|
|||
repository = "https://github.com/denoland/deno"
|
||||
|
||||
[workspace.dependencies]
|
||||
deno_ast = { version = "=0.48.0", features = ["transpiling"] }
|
||||
deno_ast = { version = "=0.48.1", features = ["transpiling"] }
|
||||
deno_core = { version = "0.352.0" }
|
||||
|
||||
deno_cache_dir = "=0.23.0"
|
||||
|
|
|
@ -1220,9 +1220,6 @@ fn new_workspace_factory_options(
|
|||
}
|
||||
ConfigFlag::Disabled => ConfigDiscoveryOption::Disabled,
|
||||
},
|
||||
emit_cache_version: Cow::Borrowed(
|
||||
deno_lib::version::DENO_VERSION_INFO.deno,
|
||||
),
|
||||
maybe_custom_deno_dir_root: flags.internal.cache_path.clone(),
|
||||
// For `deno install/add/remove/init` we want to force the managed
|
||||
// resolver so it can set up the `node_modules/` directory.
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
// Copyright 2018-2025 the Deno authors. MIT license.
|
||||
|
||||
use std::borrow::Cow;
|
||||
use std::collections::BTreeMap;
|
||||
use std::collections::BTreeSet;
|
||||
use std::collections::HashMap;
|
||||
|
@ -1478,9 +1477,6 @@ impl ConfigData {
|
|||
config_discovery: ConfigDiscoveryOption::DiscoverCwd,
|
||||
maybe_custom_deno_dir_root: None,
|
||||
is_package_manager_subcommand: false,
|
||||
emit_cache_version: Cow::Borrowed(
|
||||
deno_lib::version::DENO_VERSION_INFO.deno,
|
||||
),
|
||||
frozen_lockfile: None,
|
||||
lock_arg: None,
|
||||
lockfile_skip_write: false,
|
||||
|
|
11
libs/resolver/cache/emit.rs
vendored
11
libs/resolver/cache/emit.rs
vendored
|
@ -40,13 +40,10 @@ impl<TSys: EmitCacheSys> EmitCache<TSys> {
|
|||
disk_cache: DiskCache<TSys>,
|
||||
cache_version: Cow<'static, str>,
|
||||
) -> Self {
|
||||
let mode = match sys
|
||||
.env_var("DENO_EMIT_CACHE_MODE")
|
||||
.unwrap_or_default()
|
||||
.as_str()
|
||||
{
|
||||
"normal" | "" => Mode::Normal,
|
||||
"disable" => Mode::Disable,
|
||||
let emit_cache_mode = sys.env_var_os("DENO_EMIT_CACHE_MODE");
|
||||
let mode = match emit_cache_mode.as_ref().and_then(|s| s.to_str()) {
|
||||
Some("normal") | Some("") | None => Mode::Normal,
|
||||
Some("disable") => Mode::Disable,
|
||||
_ => {
|
||||
log::warn!("Unknown DENO_EMIT_CACHE_MODE value, defaulting to normal");
|
||||
Mode::Normal
|
||||
|
|
|
@ -198,9 +198,6 @@ pub struct WorkspaceFactoryOptions {
|
|||
pub additional_config_file_names: &'static [&'static str],
|
||||
pub config_discovery: ConfigDiscoveryOption,
|
||||
pub is_package_manager_subcommand: bool,
|
||||
/// Version to use for the emit cache. This is something that
|
||||
/// should change when the version of the underlying emit changes.
|
||||
pub emit_cache_version: Cow<'static, str>,
|
||||
pub frozen_lockfile: Option<bool>,
|
||||
pub lock_arg: Option<String>,
|
||||
/// Whether to skip writing to the lockfile.
|
||||
|
@ -301,7 +298,10 @@ impl<TSys: WorkspaceFactorySys> WorkspaceFactory<TSys> {
|
|||
Ok(new_rc(EmitCache::new(
|
||||
&self.sys,
|
||||
self.deno_dir()?.gen_cache.clone(),
|
||||
self.options.emit_cache_version.clone(),
|
||||
#[cfg(feature = "deno_ast")]
|
||||
Cow::Borrowed(deno_ast::VERSION),
|
||||
#[cfg(not(feature = "deno_ast"))]
|
||||
Cow::Borrowed(env!("CARGO_PKG_VERSION")),
|
||||
)))
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue