Skip to content

Commit

Permalink
[Turbopack] add telemetry for persistent caching usage (#73554)
Browse files Browse the repository at this point in the history
### What?

Report persistent caching as feature
  • Loading branch information
sokra authored Dec 6, 2024
1 parent 98de5db commit 43c13f4
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
4 changes: 4 additions & 0 deletions crates/next-api/src/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -823,6 +823,10 @@ impl Project {
"skipTrailingSlashRedirect",
*config.skip_trailing_slash_redirect().await?,
);
emit_event(
"persistentCaching",
*config.persistent_caching_enabled().await?,
);

let config = &config.await?;

Expand Down
12 changes: 12 additions & 0 deletions crates/next-core/src/next_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,7 @@ pub struct ExperimentalTurboConfig {
pub tree_shaking: Option<bool>,
pub module_id_strategy: Option<ModuleIdStrategy>,
pub minify: Option<bool>,
pub unstable_persistent_caching: Option<bool>,
}

#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, TraceRawVcs)]
Expand Down Expand Up @@ -1041,6 +1042,17 @@ impl NextConfig {
Vc::cell(Some(ResolvedVc::cell(rules)))
}

#[turbo_tasks::function]
pub fn persistent_caching_enabled(&self) -> Result<Vc<bool>> {
Ok(Vc::cell(
self.experimental
.turbo
.as_ref()
.and_then(|t| t.unstable_persistent_caching)
.unwrap_or_default(),
))
}

#[turbo_tasks::function]
pub fn resolve_alias_options(&self) -> Result<Vc<ResolveAliasMap>> {
let Some(resolve_alias) = self
Expand Down
7 changes: 7 additions & 0 deletions test/development/basic/__snapshots__/next-rs-api.test.ts.snap

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

0 comments on commit 43c13f4

Please sign in to comment.