Unverified Commit 221692b3 authored by LongYinan's avatar LongYinan Committed by GitHub
parent f2d95da7
...@@ -100,10 +100,12 @@ module.exports = { ...@@ -100,10 +100,12 @@ module.exports = {
contextDirectory?: string contextDirectory?: string
// if there is `process.cwd()` expression in your code, you can set this option to tell `turbotrace` the value of `process.cwd()` while tracing. // if there is `process.cwd()` expression in your code, you can set this option to tell `turbotrace` the value of `process.cwd()` while tracing.
// for example the require(process.cwd() + '/package.json') will be traced as require('/path/to/cwd/package.json') // for example the require(process.cwd() + '/package.json') will be traced as require('/path/to/cwd/package.json')
processCwd?: string, processCwd?: string
// control the maximum number of files that are passed to the `turbotrace` // control the maximum number of files that are passed to the `turbotrace`
// default is 128 // default is 128
maxFiles?: number; maxFiles?: number
// control the maximum memory usage of the `turbotrace`, in `MB`
memoryLimit?: number
}, },
}, },
} }
......
This diff is collapsed.
...@@ -19,7 +19,7 @@ serde = "1" ...@@ -19,7 +19,7 @@ serde = "1"
serde_json = "1" serde_json = "1"
tracing = { version = "0.1.37", features = ["release_max_level_info"] } tracing = { version = "0.1.37", features = ["release_max_level_info"] }
next-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230126.1", features = [ next-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230201.1", features = [
"__swc_core", "__swc_core",
"__swc_core_next_core", "__swc_core_next_core",
"__swc_transform_styled_jsx", "__swc_transform_styled_jsx",
...@@ -29,7 +29,7 @@ next-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-2 ...@@ -29,7 +29,7 @@ next-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-2
] } ] }
[dev-dependencies] [dev-dependencies]
next-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230126.1", features = [ next-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230201.1", features = [
"__swc_core_testing_transform", "__swc_core_testing_transform",
"__swc_testing", "__swc_testing",
] } ] }
......
...@@ -39,7 +39,7 @@ tracing = { version = "0.1.37", features = ["release_max_level_info"] } ...@@ -39,7 +39,7 @@ tracing = { version = "0.1.37", features = ["release_max_level_info"] }
tracing-futures = "0.2.5" tracing-futures = "0.2.5"
tracing-subscriber = "0.3.9" tracing-subscriber = "0.3.9"
tracing-chrome = "0.5.0" tracing-chrome = "0.5.0"
next-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230126.1", features = [ next-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230201.1", features = [
"__swc_core_binding_napi", "__swc_core_binding_napi",
"__turbo_next_dev_server", "__turbo_next_dev_server",
"__turbo_node_file_trace", "__turbo_node_file_trace",
......
...@@ -31,7 +31,7 @@ wasm-bindgen-futures = "0.4.8" ...@@ -31,7 +31,7 @@ wasm-bindgen-futures = "0.4.8"
getrandom = { version = "0.2.5", optional = true, default-features = false } getrandom = { version = "0.2.5", optional = true, default-features = false }
js-sys = "0.3.59" js-sys = "0.3.59"
serde-wasm-bindgen = "0.4.3" serde-wasm-bindgen = "0.4.3"
next-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230126.1", features = [ next-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230201.1", features = [
"__swc_core_binding_wasm", "__swc_core_binding_wasm",
"__feature_mdx_rs", "__feature_mdx_rs",
] } ] }
......
...@@ -60,6 +60,7 @@ import { ...@@ -60,6 +60,7 @@ import {
SUBRESOURCE_INTEGRITY_MANIFEST, SUBRESOURCE_INTEGRITY_MANIFEST,
MIDDLEWARE_BUILD_MANIFEST, MIDDLEWARE_BUILD_MANIFEST,
MIDDLEWARE_REACT_LOADABLE_MANIFEST, MIDDLEWARE_REACT_LOADABLE_MANIFEST,
TURBO_TRACE_DEFAULT_MEMORY_LIMIT,
} from '../shared/lib/constants' } from '../shared/lib/constants'
import { getSortedRoutes, isDynamicRoute } from '../shared/lib/router/utils' import { getSortedRoutes, isDynamicRoute } from '../shared/lib/router/utils'
import { __ApiPreviewProps } from '../server/api-utils' import { __ApiPreviewProps } from '../server/api-utils'
...@@ -1768,6 +1769,9 @@ export default async function build( ...@@ -1768,6 +1769,9 @@ export default async function build(
processCwd: config.experimental.turbotrace.processCwd, processCwd: config.experimental.turbotrace.processCwd,
logDetail: config.experimental.turbotrace.logDetail, logDetail: config.experimental.turbotrace.logDetail,
showAll: config.experimental.turbotrace.logAll, showAll: config.experimental.turbotrace.logAll,
memoryLimit:
config.experimental.turbotrace.memoryLimit ??
TURBO_TRACE_DEFAULT_MEMORY_LIMIT,
}) })
} else { } else {
const ignores = [ const ignores = [
......
...@@ -7,7 +7,10 @@ import { ...@@ -7,7 +7,10 @@ import {
nodeFileTrace, nodeFileTrace,
NodeFileTraceReasons, NodeFileTraceReasons,
} from 'next/dist/compiled/@vercel/nft' } from 'next/dist/compiled/@vercel/nft'
import { TRACE_OUTPUT_VERSION } from '../../../shared/lib/constants' import {
TRACE_OUTPUT_VERSION,
TURBO_TRACE_DEFAULT_MEMORY_LIMIT,
} from '../../../shared/lib/constants'
import { webpack, sources } from 'next/dist/compiled/webpack/webpack' import { webpack, sources } from 'next/dist/compiled/webpack/webpack'
import { import {
NODE_ESM_RESOLVE_OPTIONS, NODE_ESM_RESOLVE_OPTIONS,
...@@ -430,6 +433,9 @@ export class TraceEntryPointsPlugin implements webpack.WebpackPluginInstance { ...@@ -430,6 +433,9 @@ export class TraceEntryPointsPlugin implements webpack.WebpackPluginInstance {
this.turbotrace?.processCwd ?? this.appDir, this.turbotrace?.processCwd ?? this.appDir,
logLevel: this.turbotrace?.logLevel, logLevel: this.turbotrace?.logLevel,
showAll: this.turbotrace?.logAll, showAll: this.turbotrace?.logAll,
memoryLimit:
this.turbotrace?.memoryLimit ??
TURBO_TRACE_DEFAULT_MEMORY_LIMIT,
}) })
) )
chunks = restChunks chunks = restChunks
...@@ -831,6 +837,9 @@ export class TraceEntryPointsPlugin implements webpack.WebpackPluginInstance { ...@@ -831,6 +837,9 @@ export class TraceEntryPointsPlugin implements webpack.WebpackPluginInstance {
processCwd: this.turbotrace?.processCwd ?? this.appDir, processCwd: this.turbotrace?.processCwd ?? this.appDir,
showAll: this.turbotrace?.logAll, showAll: this.turbotrace?.logAll,
logLevel: this.turbotrace?.logLevel, logLevel: this.turbotrace?.logLevel,
memoryLimit:
this.turbotrace?.memoryLimit ??
TURBO_TRACE_DEFAULT_MEMORY_LIMIT,
}) })
chunks = restChunks chunks = restChunks
if (restChunks.length) { if (restChunks.length) {
...@@ -846,7 +855,7 @@ export class TraceEntryPointsPlugin implements webpack.WebpackPluginInstance { ...@@ -846,7 +855,7 @@ export class TraceEntryPointsPlugin implements webpack.WebpackPluginInstance {
version: TRACE_OUTPUT_VERSION, version: TRACE_OUTPUT_VERSION,
files: [], files: [],
})) }))
console.log(this.turbotraceOutputPath, this.turbotraceFiles)
existedNftFile.files.push(...this.turbotraceFiles) existedNftFile.files.push(...this.turbotraceFiles)
const filesSet = new Set(existedNftFile.files) const filesSet = new Set(existedNftFile.files)
existedNftFile.files = [...filesSet] existedNftFile.files = [...filesSet]
......
...@@ -472,6 +472,9 @@ const configSchema = { ...@@ -472,6 +472,9 @@ const configSchema = {
maxFiles: { maxFiles: {
type: 'integer', type: 'integer',
}, },
memoryLimit: {
type: 'integer',
},
}, },
}, },
}, },
......
...@@ -175,6 +175,7 @@ export interface ExperimentalConfig { ...@@ -175,6 +175,7 @@ export interface ExperimentalConfig {
contextDirectory?: string contextDirectory?: string
processCwd?: string processCwd?: string
maxFiles?: number maxFiles?: number
memoryLimit?: number
} }
mdxRs?: boolean mdxRs?: boolean
} }
......
...@@ -113,6 +113,8 @@ export const DEFAULT_SANS_SERIF_FONT = { ...@@ -113,6 +113,8 @@ export const DEFAULT_SANS_SERIF_FONT = {
} }
export const STATIC_STATUS_PAGES = ['/500'] export const STATIC_STATUS_PAGES = ['/500']
export const TRACE_OUTPUT_VERSION = 1 export const TRACE_OUTPUT_VERSION = 1
// in `MB`
export const TURBO_TRACE_DEFAULT_MEMORY_LIMIT = 6000
export const RSC_MODULE_TYPES = { export const RSC_MODULE_TYPES = {
client: 'client', client: 'client',
......
...@@ -22,6 +22,7 @@ module.exports = { ...@@ -22,6 +22,7 @@ module.exports = {
experimental: { experimental: {
turbotrace: { turbotrace: {
contextDirectory: path.join(__dirname, '..', '..', '..', '..'), contextDirectory: path.join(__dirname, '..', '..', '..', '..'),
memoryLimit: 4096,
}, },
}, },
} }
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