Commit dcfd6e51 authored by Tobias Koppers's avatar Tobias Koppers

Add Next.js version to "initialize project" trace span

Pass the Next.js version from the TypeScript side through NAPI bindings
into the Rust ProjectOptions, and record it as a `version` field on the
"initialize project" tracing span.
parent e2ef94e2
......@@ -360,6 +360,9 @@ pub struct ProjectOptions {
/// Whether to enable persistent caching
pub is_persistent_caching_enabled: bool,
/// The version of Next.js that is running.
pub next_version: RcStr,
}
#[derive(Default)]
......@@ -567,6 +570,7 @@ impl ProjectContainer {
let span = tracing::info_span!(
"initialize project",
project_name = %self.await?.name,
version = options.next_version.as_str(),
env_diff = Empty
);
let span_clone = span.clone();
......
......@@ -187,6 +187,7 @@ fn main() {
debug_build_paths: None,
deferred_entries: None,
is_persistent_caching_enabled: false,
next_version: rcstr!("0.0.0"),
};
let json = serde_json::to_string_pretty(&options).unwrap();
......
......@@ -201,6 +201,9 @@ pub struct NapiProjectOptions {
// Whether persistent caching is enabled
pub is_persistent_caching_enabled: bool,
/// The version of Next.js that is running.
pub next_version: RcStr,
}
/// [NapiProjectOptions] with all fields optional.
......@@ -307,6 +310,7 @@ impl From<NapiProjectOptions> for ProjectOptions {
debug_build_paths,
deferred_entries,
is_persistent_caching_enabled,
next_version,
} = val;
ProjectOptions {
root_path,
......@@ -329,6 +333,7 @@ impl From<NapiProjectOptions> for ProjectOptions {
}),
deferred_entries,
is_persistent_caching_enabled,
next_version,
}
}
}
......
......@@ -169,6 +169,8 @@ export interface NapiProjectOptions {
/** App-router page routes that should be built after non-deferred routes. */
deferredEntries?: Array<RcStr>
isPersistentCachingEnabled: boolean
/** The version of Next.js that is running. */
nextVersion: RcStr
}
/** [NapiProjectOptions] with all fields optional. */
export interface NapiPartialProjectOptions {
......
......@@ -89,6 +89,7 @@ export async function turbopackAnalyze(
writeRoutesHashesManifest: false,
currentNodeJsVersion,
isPersistentCachingEnabled: persistentCaching,
nextVersion: require('next/package.json').version,
},
{
memoryLimit: config.experimental?.turbopackMemoryLimit,
......
......@@ -105,6 +105,7 @@ export async function turbopackBuild(): Promise<{
currentNodeJsVersion,
isPersistentCachingEnabled: persistentCaching,
deferredEntries: config.experimental.deferredEntries,
nextVersion: require('next/package.json').version,
}
const sharedTurboOptions = {
......
......@@ -403,6 +403,7 @@ export async function createHotReloaderTurbopack(
isPersistentCachingEnabled: isFileSystemCacheEnabledForDev(
opts.nextConfig
),
nextVersion: require('next/package.json').version,
},
{
memoryLimit: opts.nextConfig.experimental?.turbopackMemoryLimit,
......
......@@ -232,6 +232,7 @@ async function main() {
writeRoutesHashesManifest: false,
currentNodeJsVersion: '18.0.0',
isPersistentCachingEnabled: false,
nextVersion: '0.0.0',
});
const entrypointsSubscription = project.entrypointsSubscribe();
......@@ -391,6 +392,7 @@ describe('next.rs api', () => {
writeRoutesHashesManifest: false,
currentNodeJsVersion: '18.0.0',
isPersistentCachingEnabled: false,
nextVersion: '0.0.0',
})
projectUpdateSubscription = filterMapAsyncIterator(
project.updateInfoSubscribe(1000),
......
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