Unverified Commit 4bf13443 authored by Benjamin Woodruff's avatar Benjamin Woodruff Committed by GitHub

Turbopack: chore: Remove dead experimental.ppr struct field (#85792)

- `experimental.ppr` was replaced with `cacheComponents`.
- It's still in the zod and TS type schemas, I think for our error messages on the Next.js side, but Turbopack only needs to know about the fields that Turbopack cares about. Serde silently ignores unknown fields by default.
- Nothing was reading this field from this struct.
- This unit test coverage is very overkill.
parent 5080ce53
......@@ -863,9 +863,6 @@ pub struct ExperimentalConfig {
/// Automatically apply the "modularize_imports" optimization to imports of
/// the specified packages.
optimize_package_imports: Option<Vec<RcStr>>,
/// Using this feature will enable the `react@experimental` for the `app`
/// directory.
ppr: Option<ExperimentalPartialPrerendering>,
taint: Option<bool>,
proxy_timeout: Option<f64>,
/// enables the minification of server code.
......@@ -962,53 +959,6 @@ fn test_cache_life_profiles_invalid() {
);
}
#[derive(
Clone, Debug, PartialEq, Serialize, Deserialize, TraceRawVcs, NonLocalValue, OperationValue,
)]
#[serde(rename_all = "lowercase")]
pub enum ExperimentalPartialPrerenderingIncrementalValue {
Incremental,
}
#[derive(
Clone, Debug, PartialEq, Deserialize, Serialize, TraceRawVcs, NonLocalValue, OperationValue,
)]
#[serde(untagged)]
pub enum ExperimentalPartialPrerendering {
Boolean(bool),
Incremental(ExperimentalPartialPrerenderingIncrementalValue),
}
#[test]
fn test_parse_experimental_partial_prerendering() {
let json = serde_json::json!({
"ppr": "incremental"
});
let config: ExperimentalConfig = serde_json::from_value(json).unwrap();
assert_eq!(
config.ppr,
Some(ExperimentalPartialPrerendering::Incremental(
ExperimentalPartialPrerenderingIncrementalValue::Incremental
))
);
let json = serde_json::json!({
"ppr": true
});
let config: ExperimentalConfig = serde_json::from_value(json).unwrap();
assert_eq!(
config.ppr,
Some(ExperimentalPartialPrerendering::Boolean(true))
);
// Expect if we provide a random string, it will fail.
let json = serde_json::json!({
"ppr": "random"
});
let config = serde_json::from_value::<ExperimentalConfig>(json);
assert!(config.is_err());
}
#[derive(
Clone, Debug, PartialEq, Eq, Serialize, Deserialize, TraceRawVcs, NonLocalValue, OperationValue,
)]
......@@ -1719,22 +1669,6 @@ impl NextConfig {
}
}
#[turbo_tasks::function]
pub fn enable_ppr(&self) -> Vc<bool> {
Vc::cell(
self.experimental
.ppr
.as_ref()
.map(|ppr| match ppr {
ExperimentalPartialPrerendering::Incremental(
ExperimentalPartialPrerenderingIncrementalValue::Incremental,
) => true,
ExperimentalPartialPrerendering::Boolean(b) => *b,
})
.unwrap_or(false),
)
}
#[turbo_tasks::function]
pub fn enable_taint(&self) -> Vc<bool> {
Vc::cell(self.experimental.taint.unwrap_or(false))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment