Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Turbopack] add telemetry for persistent caching usage #73554

Merged
merged 2 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.

Loading