Unverified Commit a51f3556 authored by Luke Sandberg's avatar Luke Sandberg Committed by GitHub

Remove turbopackMemoryLimit it is dead (#94483)

This feature has never worked, and we should just drop it
parent 0d0dbb6c
......@@ -272,8 +272,6 @@ pub struct NapiDefineEnv {
#[napi(object)]
pub struct NapiTurboEngineOptions {
/// An upper bound of memory that turbopack will attempt to stay under.
pub memory_limit: Option<f64>,
/// Track dependencies between tasks. If false, any change during build will error.
pub dependency_tracking: Option<bool>,
/// Whether the project is running in a CI environment.
......@@ -555,10 +553,6 @@ pub fn project_new(
env.spawn_future(
async move {
let memory_limit = turbo_engine_options
.memory_limit
.map(|m| m as usize)
.unwrap_or(usize::MAX);
let dependency_tracking = turbo_engine_options.dependency_tracking.unwrap_or(true);
let is_ci = turbo_engine_options.is_ci.unwrap_or(false);
let is_short_session = turbo_engine_options.is_short_session.unwrap_or(false);
......@@ -568,7 +562,6 @@ pub fn project_new(
PathBuf::from(&options.dist_dir),
&options.next_version,
options.is_persistent_caching_enabled,
memory_limit,
dependency_tracking,
is_ci,
is_short_session,
......
......@@ -248,7 +248,6 @@ pub fn create_turbo_tasks(
output_path: PathBuf,
next_version: &str,
persistent_caching: bool,
_memory_limit: usize,
dependency_tracking: bool,
is_ci: bool,
is_short_session: bool,
......
......@@ -3,7 +3,6 @@ const config = {
experimental: {
serverActions: true,
typedRoutes: false,
turbopackMemoryLimit: 4096,
turbopackMinify: true,
turbopackTreeShaking: false,
turbopackSourceMaps: true
......
......@@ -2,7 +2,6 @@ export default {
experimental: {
serverActions: true,
typedRoutes: false,
turbopackMemoryLimit: 4096,
turbopackMinify: true,
turbopackTreeShaking: false,
turbopackSourceMaps: true
......
......@@ -2,7 +2,6 @@ module.exports = {
experimental: {
serverActions: true,
typedRoutes: false,
turbopackMemoryLimit: 4096,
turbopackMinify: true,
turbopackTreeShaking: false,
turbopackSourceMaps: true
......
......@@ -5,8 +5,8 @@ const config = {
resolveAlias: {
underscore: 'lodash',
},
memoryLimit: 4096,
},
turbopackMemoryLimit: 4096,
typedRoutes: true,
},
};
......
// CommonJS configuration with variable declaration and modification
const config = {
experimental: {
typedRoutes: true,
turbopackMemoryLimit: 4096,
typedRoutes: true
},
turbopack: {
......
......@@ -14,6 +14,7 @@ const config = {
config.experimental.turbo.resolveAlias.foo = 'bar';
config.experimental.turbo.minify = true;
config.experimental.turbo.memoryLimit = 4096;
config.experimental.turbopackMemoryLimit = 4096;
// Add regular property
config.images = {
......
......@@ -14,7 +14,6 @@ const config = {
// Add properties to the turbo object
config.turbopack.resolveAlias.foo = 'bar';
config.experimental.turbopackMinify = true;
config.experimental.turbopackMemoryLimit = 4096;
// Add regular property
config.images = {
......
......@@ -3,7 +3,6 @@ import type { NextConfig } from 'next';
const config = {
experimental: {
typedRoutes: true,
turbopackMemoryLimit: 4096,
turbopackMinify: true,
turbopackTreeShaking: false,
turbopackSourceMaps: true
......
......@@ -5,7 +5,6 @@ const config: NextConfig = {
// Removed serverActions due to TypeScript compatibility
typedRoutes: true,
turbopackMemoryLimit: 4096,
turbopackMinify: true,
turbopackTreeShaking: false,
turbopackSourceMaps: true
......
......@@ -2,7 +2,6 @@
const nextConfig = {
experimental: {
typedRoutes: true,
turbopackMemoryLimit: 4096,
turbopackMinify: true,
turbopackTreeShaking: false,
turbopackSourceMaps: true
......
......@@ -3,8 +3,12 @@
* the new top-level `turbopack` configuration.
*
* It moves most properties from experimental.turbo to the top-level turbopack
* property, with special handling for certain properties like memoryLimit, minify,
* property, with special handling for certain properties like minify,
* treeShaking, and sourceMaps which become experimental.turbopack* properties instead.
*
* The `memoryLimit` option is no longer supported, so it is removed entirely in
* both its old location (`experimental.turbo.memoryLimit`) and the location the
* previous version of this codemod produced (`experimental.turbopackMemoryLimit`).
*/
import type {
......@@ -23,12 +27,17 @@ import { isNextConfigFile } from './lib/utils'
// Properties that need to be moved to experimental.turbopack*
const RENAMED_EXPERIMENTAL_PROPERTIES = {
memoryLimit: 'turbopackMemoryLimit',
minify: 'turbopackMinify',
treeShaking: 'turbopackTreeShaking',
sourceMaps: 'turbopackSourceMaps',
}
// `memoryLimit` is no longer supported and is removed entirely. We drop it under
// both its old `experimental.turbo.*` name and the `experimental.*` name produced
// by the previous version of this codemod.
const REMOVED_TURBO_PROPERTY = 'memoryLimit'
const REMOVED_EXPERIMENTAL_PROPERTY = 'turbopackMemoryLimit'
export default function transformer(
file: FileInfo,
_api: JSCodeShiftAPI,
......@@ -87,6 +96,16 @@ export default function transformer(
const specialProps = []
turboObj.properties.forEach((prop) => {
if (
isStaticProperty(prop) &&
prop.key &&
prop.key.type === 'Identifier' &&
prop.key.name === REMOVED_TURBO_PROPERTY
) {
// Drop: `memoryLimit` is no longer supported.
return
}
if (
isStaticProperty(prop) &&
prop.key &&
......@@ -112,7 +131,10 @@ export default function transformer(
isStaticProperty(prop) &&
prop.key &&
prop.key.type === 'Identifier' &&
prop.key.name === 'turbo'
// Drop the `turbo` object (moved above) and a pre-existing
// `turbopackMemoryLimit` (no longer supported).
(prop.key.name === 'turbo' ||
prop.key.name === REMOVED_EXPERIMENTAL_PROPERTY)
)
)
......@@ -193,7 +215,14 @@ export default function transformer(
return
}
// For special properties like memoryLimit, minify, etc.
// `memoryLimit` is no longer supported: remove the assignment entirely.
if (propName === REMOVED_TURBO_PROPERTY) {
j(path).remove()
hasChanges = true
return
}
// For special properties like minify, treeShaking, etc.
if (propName && RENAMED_EXPERIMENTAL_PROPERTIES[propName]) {
const newAssignment = j.assignmentExpression(
'=',
......@@ -298,6 +327,27 @@ export default function transformer(
}
})
// Remove `config.experimental.turbopackMemoryLimit = value` assignments left
// behind by the previous version of this codemod (no longer supported).
root
.find(j.AssignmentExpression, {
left: {
type: 'MemberExpression',
object: {
type: 'MemberExpression',
property: { type: 'Identifier', name: 'experimental' },
},
property: {
type: 'Identifier',
name: REMOVED_EXPERIMENTAL_PROPERTY,
},
},
})
.forEach((path) => {
j(path).remove()
hasChanges = true
})
// Only return a string if we changed the AST, otherwise return the original source
return hasChanges ? root.toSource(options) : file.source
}
......
......@@ -309,8 +309,6 @@ export interface NapiDefineEnv {
nodejs: Array<NapiOptionEnvVar>
}
export interface NapiTurboEngineOptions {
/** An upper bound of memory that turbopack will attempt to stay under. */
memoryLimit?: number
/** Track dependencies between tasks. If false, any change during build will error. */
dependencyTracking?: boolean
/** Whether the project is running in a CI environment. */
......
......@@ -364,7 +364,6 @@ export const experimentalSchema = {
typedRoutes: z.boolean().optional(),
webpackBuildWorker: z.boolean().optional(),
webpackMemoryOptimizations: z.boolean().optional(),
turbopackMemoryLimit: z.number().optional(),
turbopackMemoryEviction: z
.union([z.literal(false), z.literal('full')])
.optional(),
......
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