Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
b2a40693
Commit
b2a40693
authored
Sep 02, 2025
by
Tim Neutkens
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Development: Speed up ready in time
parent
1b5f518a
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
107 additions
and
173 deletions
+107
-173
project.rs
crates/napi/src/next_api/project.rs
+0
-8
hmr.rs
crates/next-api/benches/hmr.rs
+0
-1
project.rs
crates/next-api/src/project.rs
+1
-37
main.rs
crates/next-build-test/src/main.rs
+0
-1
transform_options.rs
crates/next-core/src/transform_options.rs
+14
-2
generated-native.d.ts
packages/next/src/build/swc/generated-native.d.ts
+0
-10
index.ts
packages/next/src/build/swc/index.ts
+0
-2
types.ts
packages/next/src/build/swc/types.ts
+0
-11
impl.ts
packages/next/src/build/turbopack-build/impl.ts
+0
-2
config.ts
packages/next/src/server/config.ts
+1
-1
hot-reloader-shared-utils.ts
packages/next/src/server/dev/hot-reloader-shared-utils.ts
+31
-0
hot-reloader-turbopack.ts
packages/next/src/server/dev/hot-reloader-turbopack.ts
+1
-3
hot-reloader-webpack.ts
packages/next/src/server/dev/hot-reloader-webpack.ts
+4
-32
setup-dev-bundler.ts
...ges/next/src/server/lib/router-utils/setup-dev-bundler.ts
+51
-31
start-server.ts
packages/next/src/server/lib/start-server.ts
+2
-0
utils.ts
packages/next/src/shared/lib/turbopack/utils.ts
+0
-9
version.ts
packages/next/src/telemetry/events/version.ts
+2
-23
No files found.
crates/napi/src/next_api/project.rs
View file @
b2a40693
...
...
@@ -147,9 +147,6 @@ pub struct NapiProjectOptions {
/// The contents of next.config.js, serialized to JSON.
pub
next_config
:
RcStr
,
/// The contents of ts/config read by load-jsconfig, serialized to JSON.
pub
js_config
:
RcStr
,
/// A map of environment variables to use when compiling code.
pub
env
:
Vec
<
NapiEnvVar
>
,
...
...
@@ -205,9 +202,6 @@ pub struct NapiPartialProjectOptions {
/// The contents of next.config.js, serialized to JSON.
pub
next_config
:
Option
<
RcStr
>
,
/// The contents of ts/config read by load-jsconfig, serialized to JSON.
pub
js_config
:
Option
<
RcStr
>
,
/// A map of environment variables to use when compiling code.
pub
env
:
Option
<
Vec
<
NapiEnvVar
>>
,
...
...
@@ -277,7 +271,6 @@ impl From<NapiProjectOptions> for ProjectOptions {
project_path
:
val
.project_path
,
watch
:
val
.watch
.into
(),
next_config
:
val
.next_config
,
js_config
:
val
.js_config
,
env
:
val
.env
.into_iter
()
...
...
@@ -302,7 +295,6 @@ impl From<NapiPartialProjectOptions> for PartialProjectOptions {
project_path
:
val
.project_path
,
watch
:
val
.watch
.map
(
From
::
from
),
next_config
:
val
.next_config
,
js_config
:
val
.js_config
,
env
:
val
.env
.map
(|
env
|
env
.into_iter
()
.map
(|
var
|
(
var
.name
,
var
.value
))
.collect
()),
...
...
crates/next-api/benches/hmr.rs
View file @
b2a40693
...
...
@@ -193,7 +193,6 @@ impl HmrBenchmark {
root_path
:
RcStr
::
from
(
root_path
),
project_path
:
RcStr
::
from
(
project_path
.clone
()),
next_config
:
load_next_config
(),
js_config
:
rcstr!
(
"{}"
),
env
:
vec!
[],
define_env
:
DefineEnv
{
client
:
vec!
[],
...
...
crates/next-api/src/project.rs
View file @
b2a40693
...
...
@@ -13,7 +13,7 @@ use next_core::{
next_client
::{
ClientChunkingContextOptions
,
get_client_chunking_context
,
get_client_compile_time_info
,
},
next_config
::{
JsConfig
,
ModuleIds
as
ModuleIdStrategyConfig
,
NextConfig
},
next_config
::{
ModuleIds
as
ModuleIdStrategyConfig
,
NextConfig
},
next_edge
::
context
::
EdgeChunkingContextOptions
,
next_server
::{
ServerChunkingContextOptions
,
ServerContextType
,
get_server_chunking_context
,
...
...
@@ -159,9 +159,6 @@ pub struct ProjectOptions {
/// The contents of next.config.js, serialized to JSON.
pub
next_config
:
RcStr
,
/// The contents of ts/config read by load-jsconfig, serialized to JSON.
pub
js_config
:
RcStr
,
/// A map of environment variables to use when compiling code.
pub
env
:
Vec
<
(
RcStr
,
RcStr
)
>
,
...
...
@@ -211,9 +208,6 @@ pub struct PartialProjectOptions {
/// The contents of next.config.js, serialized to JSON.
pub
next_config
:
Option
<
RcStr
>
,
/// The contents of ts/config read by load-jsconfig, serialized to JSON.
pub
js_config
:
Option
<
RcStr
>
,
/// A map of environment variables to use when compiling code.
pub
env
:
Option
<
Vec
<
(
RcStr
,
RcStr
)
>>
,
...
...
@@ -340,7 +334,6 @@ impl ProjectContainer {
root_path
,
project_path
,
next_config
,
js_config
,
env
,
define_env
,
watch
,
...
...
@@ -367,9 +360,6 @@ impl ProjectContainer {
if
let
Some
(
next_config
)
=
next_config
{
new_options
.next_config
=
next_config
;
}
if
let
Some
(
js_config
)
=
js_config
{
new_options
.js_config
=
js_config
;
}
if
let
Some
(
env
)
=
env
{
new_options
.env
=
env
;
}
...
...
@@ -442,7 +432,6 @@ impl ProjectContainer {
let
env_map
:
Vc
<
EnvMap
>
;
let
next_config
;
let
define_env
;
let
js_config
;
let
root_path
;
let
project_path
;
let
watch
;
...
...
@@ -466,7 +455,6 @@ impl ProjectContainer {
}
.cell
();
next_config
=
NextConfig
::
from_string
(
Vc
::
cell
(
options
.next_config
.clone
()));
js_config
=
JsConfig
::
from_string
(
Vc
::
cell
(
options
.js_config
.clone
()));
root_path
=
options
.root_path
.clone
();
project_path
=
options
.project_path
.clone
();
watch
=
options
.watch
;
...
...
@@ -490,7 +478,6 @@ impl ProjectContainer {
project_path
,
watch
,
next_config
:
next_config
.to_resolved
()
.await
?
,
js_config
:
js_config
.to_resolved
()
.await
?
,
dist_dir
,
env
:
ResolvedVc
::
upcast
(
env_map
.to_resolved
()
.await
?
),
define_env
:
define_env
.to_resolved
()
.await
?
,
...
...
@@ -561,9 +548,6 @@ pub struct Project {
/// Next config.
next_config
:
ResolvedVc
<
NextConfig
>
,
/// Js/Tsconfig read by load-jsconfig
js_config
:
ResolvedVc
<
JsConfig
>
,
/// A map of environment variables to use when compiling code.
env
:
ResolvedVc
<
Box
<
dyn
ProcessEnv
>>
,
...
...
@@ -788,11 +772,6 @@ impl Project {
Ok
(
Vc
::
cell
(
*
self
.mode.await
?
==
NextMode
::
Development
))
}
#[turbo_tasks
::
function]
pub
(
super
)
fn
js_config
(
&
self
)
->
Vc
<
JsConfig
>
{
*
self
.js_config
}
#[turbo_tasks
::
function]
pub
(
super
)
fn
encryption_key
(
&
self
)
->
Vc
<
RcStr
>
{
Vc
::
cell
(
self
.encryption_key
.clone
())
...
...
@@ -1128,21 +1107,6 @@ impl Project {
// it is always using SWC so we don't check swc here.
emit_event
(
env!
(
"VERGEN_CARGO_TARGET_TRIPLE"
),
true
);
// Go over jsconfig and report enabled features.
let
compiler_options
=
self
.js_config
()
.compiler_options
()
.await
?
;
let
compiler_options
=
compiler_options
.as_object
();
let
experimental_decorators_enabled
=
compiler_options
.as_ref
()
.and_then
(|
compiler_options
|
compiler_options
.get
(
"experimentalDecorators"
))
.is_some
();
let
jsx_import_source_enabled
=
compiler_options
.as_ref
()
.and_then
(|
compiler_options
|
compiler_options
.get
(
"jsxImportSource"
))
.is_some
();
emit_event
(
"swcExperimentalDecorators"
,
experimental_decorators_enabled
);
emit_event
(
"swcImportSource"
,
jsx_import_source_enabled
);
// Go over config and report enabled features.
// [TODO]: useSwcLoader is not being reported as it is not directly corresponds (it checks babel config existence)
// need to confirm what we'll do with turbopack.
...
...
crates/next-build-test/src/main.rs
View file @
b2a40693
...
...
@@ -169,7 +169,6 @@ fn main() {
dev
:
true
,
encryption_key
:
rcstr!
(
"deadbeef"
),
env
:
vec!
[],
js_config
:
include_str!
(
"../jsConfig.json"
)
.into
(),
next_config
:
include_str!
(
"../nextConfig.json"
)
.into
(),
preview_props
:
next_api
::
project
::
DraftModeOptions
{
preview_mode_encryption_key
:
rcstr!
(
"deadbeef"
),
...
...
crates/next-core/src/transform_options.rs
View file @
b2a40693
...
...
@@ -10,13 +10,14 @@ use turbopack::{
};
use
turbopack_browser
::
react_refresh
::
assert_can_resolve_react_refresh
;
use
turbopack_core
::{
diagnostics
::
DiagnosticExt
,
file_source
::
FileSource
,
resolve
::{
FindContextFileResult
,
find_context_file
,
node
::
node_cjs_resolve_options
},
source
::
Source
,
};
use
turbopack_ecmascript
::
typescript
::
resolve
::{
read_from_tsconfigs
,
read_tsconfigs
,
tsconfig
};
use
crate
::{
mode
::
NextMode
,
next_config
::
NextConfig
};
use
crate
::{
mode
::
NextMode
,
next_config
::
NextConfig
,
next_telemetry
::
NextFeatureTelemetry
};
async
fn
get_typescript_options
(
project_path
:
FileSystemPath
,
...
...
@@ -52,6 +53,13 @@ pub async fn get_typescript_transform_options(
false
};
NextFeatureTelemetry
::
new
(
"swcExperimentalDecorators"
.into
(),
use_define_for_class_fields
,
)
.resolved_cell
()
.emit
();
let
ts_transform_options
=
TypescriptTransformOptions
{
use_define_for_class_fields
,
};
...
...
@@ -60,7 +68,7 @@ pub async fn get_typescript_transform_options(
}
/// Build the transform options for the decorators.
/// **TODO** Curr
n
ently only typescript's legacy decorators are supported
/// **TODO** Currently only typescript's legacy decorators are supported
#[turbo_tasks
::
function]
pub
async
fn
get_decorators_transform_options
(
project_path
:
FileSystemPath
,
...
...
@@ -176,6 +184,10 @@ pub async fn get_jsx_transform_options(
.as_str
()
.map
(|
s
|
s
.into
());
NextFeatureTelemetry
::
new
(
"swcImportSource"
.into
(),
jsx_import_source
.is_some
())
.resolved_cell
()
.emit
();
Some
(
JsxTransformOptions
{
import_source
:
if
jsx_import_source
.is_some
()
{
jsx_import_source
...
...
packages/next/src/build/swc/generated-native.d.ts
View file @
b2a40693
...
...
@@ -34,12 +34,6 @@ export declare class ExternalObject<T> {
[
K
:
symbol
]:
T
}
}
export
interface
TransformOutput
{
code
:
string
map
?:
string
output
?:
string
diagnostics
:
Array
<
string
>
}
export
declare
function
mdxCompile
(
value
:
string
,
option
:
Buffer
,
...
...
@@ -120,8 +114,6 @@ export interface NapiProjectOptions {
watch
:
NapiWatchOptions
/** The contents of next.config.js, serialized to JSON. */
nextConfig
:
RcStr
/** The contents of ts/config read by load-jsconfig, serialized to JSON. */
jsConfig
:
RcStr
/** A map of environment variables to use when compiling code. */
env
:
Array
<
NapiEnvVar
>
/**
...
...
@@ -172,8 +164,6 @@ export interface NapiPartialProjectOptions {
watch
?:
NapiWatchOptions
/** The contents of next.config.js, serialized to JSON. */
nextConfig
?:
RcStr
/** The contents of ts/config read by load-jsconfig, serialized to JSON. */
jsConfig
?:
RcStr
/** A map of environment variables to use when compiling code. */
env
?:
Array
<
NapiEnvVar
>
/**
...
...
packages/next/src/build/swc/index.ts
View file @
b2a40693
...
...
@@ -625,7 +625,6 @@ function bindingToApi(
options
.
nextConfig
,
path
.
join
(
options
.
rootPath
,
options
.
projectPath
)
),
jsConfig
:
JSON
.
stringify
(
options
.
jsConfig
),
env
:
rustifyEnv
(
options
.
env
),
}
}
...
...
@@ -641,7 +640,6 @@ function bindingToApi(
options
.
nextConfig
,
path
.
join
(
options
.
rootPath
!
,
options
.
projectPath
!
)
)),
jsConfig
:
options
.
jsConfig
&&
JSON
.
stringify
(
options
.
jsConfig
),
env
:
options
.
env
&&
rustifyEnv
(
options
.
env
),
}
}
...
...
packages/next/src/build/swc/types.ts
View file @
b2a40693
...
...
@@ -378,17 +378,6 @@ export interface ProjectOptions {
*/
nextConfig
:
NextConfigComplete
/**
* Jsconfig, or tsconfig contents.
*
* Next.js implicitly requires to read it to support few options
* https://nextjs.org/docs/architecture/nextjs-compiler#legacy-decorators
* https://nextjs.org/docs/architecture/nextjs-compiler#importsource
*/
jsConfig
:
{
compilerOptions
:
object
}
/**
* A map of environment variables to use when compiling code.
*/
...
...
packages/next/src/build/turbopack-build/impl.ts
View file @
b2a40693
...
...
@@ -2,7 +2,6 @@ import path from 'path'
import
{
validateTurboNextConfig
}
from
'../../lib/turbopack-warning'
import
{
formatIssue
,
getTurbopackJsConfig
,
isPersistentCachingEnabled
,
isRelevantWarning
,
}
from
'../../shared/lib/turbopack/utils'
...
...
@@ -60,7 +59,6 @@ export async function turbopackBuild(): Promise<{
projectPath
:
normalizePath
(
path
.
relative
(
rootPath
,
dir
)
||
'.'
),
distDir
,
nextConfig
:
config
,
jsConfig
:
await
getTurbopackJsConfig
(
dir
,
config
),
watch
:
{
enable
:
false
,
},
...
...
packages/next/src/server/config.ts
View file @
b2a40693
...
...
@@ -1307,7 +1307,7 @@ export default async function loadConfig(
}
// Original implementation continues below...
if
(
!
process
.
env
.
__NEXT_PRIVATE_RENDER_WORKER
)
{
if
(
!
process
.
env
.
__NEXT_PRIVATE_RENDER_WORKER
&&
!
process
.
env
.
TURBOPACK
)
{
try
{
loadWebpackHook
()
}
catch
(
err
)
{
...
...
packages/next/src/server/dev/hot-reloader-shared-utils.ts
0 → 100644
View file @
b2a40693
import
{
getPathMatch
}
from
'../../shared/lib/router/utils/path-match'
import
{
parseVersionInfo
,
type
VersionInfo
}
from
'./parse-version-info'
export
const
matchNextPageBundleRequest
=
getPathMatch
(
'/_next/static/chunks/pages/:path*.js(
\\
.map|)'
)
export
async
function
getVersionInfo
():
Promise
<
VersionInfo
>
{
let
installed
=
'0.0.0'
try
{
installed
=
require
(
'next/package.json'
).
version
let
res
try
{
// use NPM registry regardless user using Yarn
res
=
await
fetch
(
'https://registry.npmjs.org/-/package/next/dist-tags'
)
}
catch
{
// ignore fetch errors
}
if
(
!
res
||
!
res
.
ok
)
return
{
installed
,
staleness
:
'unknown'
}
const
{
latest
,
canary
}
=
await
res
.
json
()
return
parseVersionInfo
({
installed
,
latest
,
canary
})
}
catch
(
e
:
any
)
{
console
.
error
(
e
)
return
{
installed
,
staleness
:
'unknown'
}
}
}
packages/next/src/server/dev/hot-reloader-turbopack.ts
View file @
b2a40693
...
...
@@ -29,7 +29,7 @@ import * as Log from '../../build/output/log'
import
{
getVersionInfo
,
matchNextPageBundleRequest
,
}
from
'./hot-reloader-
webpack
'
}
from
'./hot-reloader-
shared-utils
'
import
{
BLOCKED_PAGES
}
from
'../../shared/lib/constants'
import
{
getOverlayMiddleware
,
...
...
@@ -84,7 +84,6 @@ import { setBundlerFindSourceMapImplementation } from '../patch-error-inspect'
import
{
getNextErrorFeedbackMiddleware
}
from
'../../next-devtools/server/get-next-error-feedback-middleware'
import
{
formatIssue
,
getTurbopackJsConfig
,
isPersistentCachingEnabled
,
isWellKnownError
,
processIssues
,
...
...
@@ -224,7 +223,6 @@ export async function createHotReloaderTurbopack(
projectPath
:
normalizePath
(
relative
(
rootPath
,
projectPath
)
||
'.'
),
distDir
,
nextConfig
:
opts
.
nextConfig
,
jsConfig
:
await
getTurbopackJsConfig
(
projectPath
,
nextConfig
),
watch
:
{
enable
:
dev
,
pollIntervalMs
:
nextConfig
.
watchOptions
?.
pollIntervalMs
,
...
...
packages/next/src/server/dev/hot-reloader-webpack.ts
View file @
b2a40693
...
...
@@ -42,7 +42,6 @@ import {
RSC_MODULE_TYPES
,
}
from
'../../shared/lib/constants'
import
type
{
__ApiPreviewProps
}
from
'../api-utils'
import
{
getPathMatch
}
from
'../../shared/lib/router/utils/path-match'
import
{
findPageFile
}
from
'../lib/find-page-file'
import
{
BUILDING
,
...
...
@@ -66,7 +65,6 @@ import { getProperError } from '../../lib/is-error'
import
ws
from
'next/dist/compiled/ws'
import
{
existsSync
,
promises
as
fs
}
from
'fs'
import
type
{
UnwrapPromise
}
from
'../../lib/coalesced-function'
import
{
parseVersionInfo
}
from
'./parse-version-info'
import
type
{
VersionInfo
}
from
'./parse-version-info'
import
{
isAPIRoute
}
from
'../../lib/is-api-route'
import
{
getRouteLoaderEntry
}
from
'../../build/webpack/loaders/next-route-loader'
...
...
@@ -95,6 +93,10 @@ import {
devToolsConfigMiddleware
,
getDevToolsConfig
,
}
from
'../../next-devtools/server/devtools-config-middleware'
import
{
matchNextPageBundleRequest
,
getVersionInfo
,
}
from
'./hot-reloader-shared-utils'
const
MILLISECONDS_IN_NANOSECOND
=
BigInt
(
1
_000_000
)
...
...
@@ -156,10 +158,6 @@ function addCorsSupport(req: IncomingMessage, res: ServerResponse) {
return
{
preflight
:
false
}
}
export
const
matchNextPageBundleRequest
=
getPathMatch
(
'/_next/static/chunks/pages/:path*.js(
\\
.map|)'
)
// Iteratively look up the issuer till it ends up at the root
function
findEntryModule
(
module
:
webpack
.
Module
,
...
...
@@ -202,32 +200,6 @@ function erroredPages(compilation: webpack.Compilation) {
return
failedPages
}
export
async
function
getVersionInfo
():
Promise
<
VersionInfo
>
{
let
installed
=
'0.0.0'
try
{
installed
=
require
(
'next/package.json'
).
version
let
res
try
{
// use NPM registry regardless user using Yarn
res
=
await
fetch
(
'https://registry.npmjs.org/-/package/next/dist-tags'
)
}
catch
{
// ignore fetch errors
}
if
(
!
res
||
!
res
.
ok
)
return
{
installed
,
staleness
:
'unknown'
}
const
{
latest
,
canary
}
=
await
res
.
json
()
return
parseVersionInfo
({
installed
,
latest
,
canary
})
}
catch
(
e
:
any
)
{
console
.
error
(
e
)
return
{
installed
,
staleness
:
'unknown'
}
}
}
export
default
class
HotReloaderWebpack
implements
NextJsHotReloaderInterface
{
private
hasAmpEntrypoints
:
boolean
private
hasAppRouterEntrypoints
:
boolean
...
...
packages/next/src/server/lib/router-utils/setup-dev-bundler.ts
View file @
b2a40693
import
type
{
NextConfigComplete
}
from
'../../config-shared'
import
type
{
FilesystemDynamicRoute
}
from
'./filesystem'
import
type
{
UnwrapPromise
}
from
'../../../lib/coalesced-function'
import
{
getPageStaticInfo
,
type
MiddlewareMatcher
,
}
from
'../../../build/analysis/get-page-static-info'
import
type
{
RoutesManifest
}
from
'../../../build'
import
type
{
MiddlewareRouteMatch
}
from
'../../../shared/lib/router/utils/middleware-route-matcher'
import
type
{
PropagateToWorkersField
}
from
'./types'
import
type
{
NextJsHotReloaderInterface
}
from
'../../dev/hot-reloader-types'
import
type
{
Telemetry
}
from
'../../../telemetry/storage'
import
type
{
IncomingMessage
,
ServerResponse
}
from
'http'
import
type
{
MiddlewareMatcher
}
from
'../../../build/analysis/get-page-static-info'
import
{
createDefineEnv
}
from
'../../../build/swc'
import
fs
from
'fs'
...
...
@@ -20,11 +19,7 @@ import { loadEnvConfig } from '@next/env'
import
findUp
from
'next/dist/compiled/find-up'
import
{
buildCustomRoute
}
from
'./filesystem'
import
*
as
Log
from
'../../../build/output/log'
import
HotReloaderWebpack
from
'../../dev/hot-reloader-webpack'
import
{
setGlobal
}
from
'../../../trace/shared'
import
type
{
Telemetry
}
from
'../../../telemetry/storage'
import
type
{
IncomingMessage
,
ServerResponse
}
from
'http'
import
loadJsConfig
from
'../../../build/load-jsconfig'
import
{
createValidFileMatcher
}
from
'../find-page-file'
import
{
EVENT_BUILD_FEATURE_USAGE
,
...
...
@@ -69,7 +64,6 @@ import { devPageFiles } from '../../../build/webpack/plugins/next-types-plugin/s
import
type
{
LazyRenderServerInstance
}
from
'../router-server'
import
{
HMR_ACTIONS_SENT_TO_BROWSER
}
from
'../../dev/hot-reloader-types'
import
{
PAGE_TYPES
}
from
'../../../lib/page-types'
import
{
createHotReloaderTurbopack
}
from
'../../dev/hot-reloader-turbopack'
import
{
generateEncryptionKeyBase64
}
from
'../../app-render/encryption-utils-server'
import
{
isMetadataRouteFile
}
from
'../../../lib/metadata/is-metadata-route'
import
{
normalizeMetadataPageToRoute
}
from
'../../../lib/metadata/get-metadata-route'
...
...
@@ -192,23 +186,39 @@ async function startWatcher(
})
const
hotReloader
:
NextJsHotReloaderInterface
=
opts
.
turbo
?
await
createHotReloaderTurbopack
(
opts
,
serverFields
,
distDir
,
resetFetch
)
:
new
HotReloaderWebpack
(
opts
.
dir
,
{
isSrcDir
:
opts
.
isSrcDir
,
appDir
,
pagesDir
,
distDir
,
config
:
opts
.
nextConfig
,
buildId
:
'development'
,
encryptionKey
:
await
generateEncryptionKeyBase64
({
isBuild
:
false
,
?
await
(()
=>
{
// Only require Turbopack when it is used.
const
{
createHotReloaderTurbopack
}
=
require
(
'../../dev/hot-reloader-turbopack'
)
as
typeof
import
(
'../../dev/hot-reloader-turbopack'
)
return
createHotReloaderTurbopack
(
opts
,
serverFields
,
distDir
,
}),
telemetry
:
opts
.
telemetry
,
rewrites
:
opts
.
fsChecker
.
rewrites
,
previewProps
:
opts
.
fsChecker
.
prerenderManifest
.
preview
,
resetFetch
,
})
resetFetch
)
})()
:
await
(
async
()
=>
{
// Only require webpack when it is used.
const
HotReloaderWebpack
=
(
require
(
'../../dev/hot-reloader-webpack'
)
as
typeof
import
(
'../../dev/hot-reloader-webpack'
)
).
default
return
new
HotReloaderWebpack
(
opts
.
dir
,
{
isSrcDir
:
opts
.
isSrcDir
,
appDir
,
pagesDir
,
distDir
,
config
:
opts
.
nextConfig
,
buildId
:
'development'
,
encryptionKey
:
await
generateEncryptionKeyBase64
({
isBuild
:
false
,
distDir
,
}),
telemetry
:
opts
.
telemetry
,
rewrites
:
opts
.
fsChecker
.
rewrites
,
previewProps
:
opts
.
fsChecker
.
prerenderManifest
.
preview
,
resetFetch
,
})
})()
await
hotReloader
.
start
()
...
...
@@ -501,6 +511,9 @@ async function startWatcher(
true
)
)
{
const
getPageStaticInfo
=
(
require
(
'../../../build/analysis/get-page-static-info'
)
as
typeof
import
(
'../../../build/analysis/get-page-static-info'
)
).
getPageStaticInfo
const
staticInfo
=
await
getPageStaticInfo
({
pageFilePath
:
fileName
,
nextConfig
:
{},
...
...
@@ -748,14 +761,21 @@ async function startWatcher(
])
}
let
tsconfigResult
:
|
UnwrapPromise
<
ReturnType
<
typeof
loadJsConfig
>>
|
UnwrapPromise
<
ReturnType
<
typeof
import
(
'../../../build/load-jsconfig'
).
default
>
>
|
undefined
if
(
tsconfigChange
)
{
try
{
tsconfigResult
=
await
loadJsConfig
(
dir
,
nextConfig
)
}
catch
(
_
)
{
/* do we want to log if there are syntax errors in tsconfig while editing? */
if
(
!
hotReloader
.
turbopackProject
)
{
if
(
tsconfigChange
)
{
try
{
const
loadJsConfig
=
(
require
(
'../../../build/load-jsconfig'
)
as
typeof
import
(
'../../../build/load-jsconfig'
)
).
default
tsconfigResult
=
await
loadJsConfig
(
dir
,
nextConfig
)
}
catch
(
_
)
{
/* do we want to log if there are syntax errors in tsconfig while editing? */
}
}
}
...
...
packages/next/src/server/lib/start-server.ts
View file @
b2a40693
...
...
@@ -2,6 +2,8 @@
import
'./cpu-profile'
import
{
getNetworkHost
}
from
'../../lib/get-network-host'
debugger
if
(
performance
.
getEntriesByName
(
'next-start'
).
length
===
0
)
{
performance
.
mark
(
'next-start'
)
}
...
...
packages/next/src/shared/lib/turbopack/utils.ts
View file @
b2a40693
...
...
@@ -14,7 +14,6 @@ import {
import
type
{
EntryKey
}
from
'./entry-key'
import
*
as
Log
from
'../../../build/output/log'
import
type
{
NextConfigComplete
}
from
'../../../server/config-shared'
import
loadJsConfig
from
'../../../build/load-jsconfig'
type
IssueKey
=
`
${
Issue
[
'severity'
]}
-
${
Issue
[
'filePath'
]}
-
${
string
}
-
${
string
}
`
export
type
IssuesMap
=
Map
<
IssueKey
,
Issue
>
...
...
@@ -53,14 +52,6 @@ export function getIssueKey(issue: Issue): IssueKey {
)}
-
${
JSON
.
stringify
(
issue
.
description
)}
`
}
export
async
function
getTurbopackJsConfig
(
dir
:
string
,
nextConfig
:
NextConfigComplete
)
{
const
{
jsConfig
}
=
await
loadJsConfig
(
dir
,
nextConfig
)
return
jsConfig
??
{
compilerOptions
:
{}
}
}
export
function
processIssues
(
currentEntryIssues
:
EntryIssuesMap
,
key
:
EntryKey
,
...
...
packages/next/src/telemetry/events/version.ts
View file @
b2a40693
import
type
{
NextConfigComplete
}
from
'../../server/config-shared'
import
path
from
'path'
const
EVENT_VERSION
=
'NEXT_CLI_SESSION_STARTED'
...
...
@@ -43,28 +42,8 @@ type EventCliSessionStarted = {
reactCompilerPanicThreshold
:
string
|
null
}
function
hasBabelConfig
(
dir
:
string
):
boolean
{
try
{
const
noopFile
=
path
.
join
(
dir
,
'noop.js'
)
const
res
=
(
require
(
'next/dist/compiled/babel/core'
)
as
typeof
import
(
'next/dist/compiled/babel/core'
)
).
loadPartialConfig
({
cwd
:
dir
,
filename
:
noopFile
,
sourceFileName
:
noopFile
,
})
as
any
const
isForTooling
=
res
.
options
?.
presets
?.
every
(
(
e
:
any
)
=>
e
?.
file
?.
request
===
'next/babel'
)
&&
res
.
options
?.
plugins
?.
length
===
0
return
res
.
hasFilesystemConfig
()
&&
!
isForTooling
}
catch
{
return
false
}
}
export
function
eventCliSession
(
dir
:
string
,
_
dir
:
string
,
nextConfig
:
NextConfigComplete
,
event
:
Omit
<
EventCliSessionStarted
,
...
...
@@ -116,7 +95,7 @@ export function eventCliSession(
hasNextConfig
:
nextConfig
.
configOrigin
!==
'default'
,
buildTarget
:
'default'
,
hasWebpackConfig
:
typeof
nextConfig
?.
webpack
===
'function'
,
hasBabelConfig
:
hasBabelConfig
(
dir
)
,
hasBabelConfig
:
false
,
imageEnabled
:
!!
images
,
imageFutureEnabled
:
!!
images
,
basePathEnabled
:
!!
nextConfig
?.
basePath
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment