Unverified Commit 0ce9e53e authored by Will Binns-Smith's avatar Will Binns-Smith Committed by GitHub

Production builds: write endpoints all at once (#75304)

This implements a new napi binding, `project.writeAllEndpointsToDisk`
which writes chunks for all endpoints.

This avoids iterating over each endpoint and calling individual napi
bindings, each resulting in a call to `emit()`. While iterating entry
points now occurs in Rust, `OutputAssets` are collected in an `IndexSet`
to prevent unnecessary `emit()` calls. This also significantly reduces
unnecessary calls to the manifest loader from JS.

Test Plan: CI

Commit before removing merge commits:
https://github.com/vercel/next.js/pull/75304/commits/189743dd261a682c5cb0a46e69f27861c612e9c2

---------
Co-authored-by: 's avatarTobias Koppers <tobias.koppers@googlemail.com>
Co-authored-by: 's avatarTim Neutkens <tim@timneutkens.nl>
parent 9cf8caba
...@@ -10,16 +10,12 @@ use next_api::{ ...@@ -10,16 +10,12 @@ use next_api::{
}, },
}; };
use tracing::Instrument; use tracing::Instrument;
use turbo_tasks::{get_effects, Completion, Effects, OperationVc, ReadRef, Vc, VcValueType}; use turbo_tasks::{Completion, Effects, OperationVc, ReadRef, Vc};
use turbopack_core::{ use turbopack_core::{diagnostics::PlainDiagnostic, error::PrettyPrintError, issue::PlainIssue};
diagnostics::PlainDiagnostic,
error::PrettyPrintError,
issue::{IssueSeverity, PlainIssue},
};
use super::utils::{ use super::utils::{
get_diagnostics, get_issues, subscribe, NapiDiagnostic, NapiIssue, RootTask, TurbopackResult, strongly_consistent_catch_collectables, subscribe, NapiDiagnostic, NapiIssue, RootTask,
VcArc, TurbopackResult, VcArc,
}; };
#[napi(object)] #[napi(object)]
...@@ -99,30 +95,6 @@ impl Deref for ExternalEndpoint { ...@@ -99,30 +95,6 @@ impl Deref for ExternalEndpoint {
} }
} }
// Await the source and return fatal issues if there are any, otherwise
// propagate any actual error results.
async fn strongly_consistent_catch_collectables<R: VcValueType + Send>(
source_op: OperationVc<R>,
) -> Result<(
Option<ReadRef<R>>,
Arc<Vec<ReadRef<PlainIssue>>>,
Arc<Vec<ReadRef<PlainDiagnostic>>>,
Arc<Effects>,
)> {
let result = source_op.read_strongly_consistent().await;
let issues = get_issues(source_op).await?;
let diagnostics = get_diagnostics(source_op).await?;
let effects = Arc::new(get_effects(source_op).await?);
let result = if result.is_err() && issues.iter().any(|i| i.severity <= IssueSeverity::Error) {
None
} else {
Some(result?)
};
Ok((result, issues, diagnostics, effects))
}
#[turbo_tasks::value(serialization = "none")] #[turbo_tasks::value(serialization = "none")]
struct WrittenEndpointWithIssues { struct WrittenEndpointWithIssues {
written: Option<ReadRef<EndpointOutputPaths>>, written: Option<ReadRef<EndpointOutputPaths>>,
......
...@@ -28,8 +28,8 @@ use tracing::Instrument; ...@@ -28,8 +28,8 @@ use tracing::Instrument;
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt, Registry}; use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt, Registry};
use turbo_rcstr::RcStr; use turbo_rcstr::RcStr;
use turbo_tasks::{ use turbo_tasks::{
get_effects, Completion, Effects, OperationVc, ReadRef, ResolvedVc, TransientInstance, get_effects, Completion, Effects, FxIndexSet, OperationVc, ReadRef, ResolvedVc,
UpdateInfo, Vc, TransientInstance, TryJoinIterExt, UpdateInfo, Vc,
}; };
use turbo_tasks_fs::{ use turbo_tasks_fs::{
get_relative_path_to, util::uri_from_file, DiskFileSystem, FileContent, FileSystem, get_relative_path_to, util::uri_from_file, DiskFileSystem, FileContent, FileSystem,
...@@ -39,6 +39,7 @@ use turbopack_core::{ ...@@ -39,6 +39,7 @@ use turbopack_core::{
diagnostics::PlainDiagnostic, diagnostics::PlainDiagnostic,
error::PrettyPrintError, error::PrettyPrintError,
issue::PlainIssue, issue::PlainIssue,
output::{OutputAsset, OutputAssets},
source_map::{OptionSourceMap, OptionStringifiedSourceMap, SourceMap, Token}, source_map::{OptionSourceMap, OptionStringifiedSourceMap, SourceMap, Token},
version::{PartialUpdate, TotalUpdate, Update, VersionState}, version::{PartialUpdate, TotalUpdate, Update, VersionState},
PROJECT_FILESYSTEM_NAME, SOURCE_URL_PROTOCOL, PROJECT_FILESYSTEM_NAME, SOURCE_URL_PROTOCOL,
...@@ -549,7 +550,7 @@ pub async fn project_shutdown( ...@@ -549,7 +550,7 @@ pub async fn project_shutdown(
#[napi(object)] #[napi(object)]
#[derive(Default)] #[derive(Default)]
struct AppPageNapiRoute { pub struct AppPageNapiRoute {
/// The relative path from project_path to the route file /// The relative path from project_path to the route file
pub original_name: Option<String>, pub original_name: Option<String>,
...@@ -559,7 +560,7 @@ struct AppPageNapiRoute { ...@@ -559,7 +560,7 @@ struct AppPageNapiRoute {
#[napi(object)] #[napi(object)]
#[derive(Default)] #[derive(Default)]
struct NapiRoute { pub struct NapiRoute {
/// The router path /// The router path
pub pathname: String, pub pathname: String,
/// The relative path from project_path to the route file /// The relative path from project_path to the route file
...@@ -637,7 +638,7 @@ impl NapiRoute { ...@@ -637,7 +638,7 @@ impl NapiRoute {
} }
#[napi(object)] #[napi(object)]
struct NapiMiddleware { pub struct NapiMiddleware {
pub endpoint: External<ExternalEndpoint>, pub endpoint: External<ExternalEndpoint>,
} }
...@@ -653,7 +654,7 @@ impl NapiMiddleware { ...@@ -653,7 +654,7 @@ impl NapiMiddleware {
} }
#[napi(object)] #[napi(object)]
struct NapiInstrumentation { pub struct NapiInstrumentation {
pub node_js: External<ExternalEndpoint>, pub node_js: External<ExternalEndpoint>,
pub edge: External<ExternalEndpoint>, pub edge: External<ExternalEndpoint>,
} }
...@@ -677,7 +678,7 @@ impl NapiInstrumentation { ...@@ -677,7 +678,7 @@ impl NapiInstrumentation {
} }
#[napi(object)] #[napi(object)]
struct NapiEntrypoints { pub struct NapiEntrypoints {
pub routes: Vec<NapiRoute>, pub routes: Vec<NapiRoute>,
pub middleware: Option<NapiMiddleware>, pub middleware: Option<NapiMiddleware>,
pub instrumentation: Option<NapiInstrumentation>, pub instrumentation: Option<NapiInstrumentation>,
...@@ -686,6 +687,49 @@ struct NapiEntrypoints { ...@@ -686,6 +687,49 @@ struct NapiEntrypoints {
pub pages_error_endpoint: External<ExternalEndpoint>, pub pages_error_endpoint: External<ExternalEndpoint>,
} }
impl NapiEntrypoints {
fn from_entrypoints_op(
entrypoints: &EntrypointsOperation,
turbo_tasks: &NextTurboTasks,
) -> Result<Self> {
let routes = entrypoints
.routes
.iter()
.map(|(k, v)| NapiRoute::from_route(k.to_string(), v.clone(), turbo_tasks))
.collect();
let middleware = entrypoints
.middleware
.as_ref()
.map(|m| NapiMiddleware::from_middleware(m, turbo_tasks))
.transpose()?;
let instrumentation = entrypoints
.instrumentation
.as_ref()
.map(|i| NapiInstrumentation::from_instrumentation(i, turbo_tasks))
.transpose()?;
let pages_document_endpoint = External::new(ExternalEndpoint(VcArc::new(
turbo_tasks.clone(),
entrypoints.pages_document_endpoint,
)));
let pages_app_endpoint = External::new(ExternalEndpoint(VcArc::new(
turbo_tasks.clone(),
entrypoints.pages_app_endpoint,
)));
let pages_error_endpoint = External::new(ExternalEndpoint(VcArc::new(
turbo_tasks.clone(),
entrypoints.pages_error_endpoint,
)));
Ok(NapiEntrypoints {
routes,
middleware,
instrumentation,
pages_document_endpoint,
pages_app_endpoint,
pages_error_endpoint,
})
}
}
#[turbo_tasks::value(serialization = "none")] #[turbo_tasks::value(serialization = "none")]
struct EntrypointsWithIssues { struct EntrypointsWithIssues {
entrypoints: ReadRef<EntrypointsOperation>, entrypoints: ReadRef<EntrypointsOperation>,
...@@ -722,6 +766,107 @@ fn project_container_entrypoints_operation( ...@@ -722,6 +766,107 @@ fn project_container_entrypoints_operation(
container.entrypoints() container.entrypoints()
} }
#[turbo_tasks::value(serialization = "none")]
struct AllWrittenEntrypointsWithIssues {
entrypoints: Option<ReadRef<Entrypoints>>,
issues: Arc<Vec<ReadRef<PlainIssue>>>,
diagnostics: Arc<Vec<ReadRef<PlainDiagnostic>>>,
effects: Arc<Effects>,
}
#[napi]
pub async fn project_write_all_entrypoints_to_disk(
#[napi(ts_arg_type = "{ __napiType: \"Project\" }")] project: External<ProjectInstance>,
app_dir_only: bool,
) -> napi::Result<TurbopackResult<NapiEntrypoints>> {
let turbo_tasks = project.turbo_tasks.clone();
let (entrypoints, issues, diags) = turbo_tasks
.run_once(async move {
let entrypoints_with_issues_op = get_all_written_entrypoints_with_issues_operation(
project.container.to_resolved().await?,
app_dir_only,
);
let EntrypointsWithIssues {
entrypoints,
issues,
diagnostics,
effects,
} = &*entrypoints_with_issues_op
.read_strongly_consistent()
.await?;
effects.apply().await?;
Ok((entrypoints.clone(), issues.clone(), diagnostics.clone()))
})
.await
.map_err(|e| napi::Error::from_reason(PrettyPrintError(&e).to_string()))?;
Ok(TurbopackResult {
result: NapiEntrypoints::from_entrypoints_op(&entrypoints, &turbo_tasks)?,
issues: issues.iter().map(|i| NapiIssue::from(&**i)).collect(),
diagnostics: diags.iter().map(|d| NapiDiagnostic::from(d)).collect(),
})
}
#[turbo_tasks::function(operation)]
async fn get_all_written_entrypoints_with_issues_operation(
container: ResolvedVc<ProjectContainer>,
app_dir_only: bool,
) -> Result<Vc<EntrypointsWithIssues>> {
let entrypoints_operation = EntrypointsOperation::new(all_entrypoints_write_to_disk_operation(
container,
app_dir_only,
));
let entrypoints = entrypoints_operation.read_strongly_consistent().await?;
let issues = get_issues(entrypoints_operation).await?;
let diagnostics = get_diagnostics(entrypoints_operation).await?;
let effects = Arc::new(get_effects(entrypoints_operation).await?);
Ok(EntrypointsWithIssues {
entrypoints,
issues,
diagnostics,
effects,
}
.cell())
}
#[turbo_tasks::function(operation)]
pub async fn all_entrypoints_write_to_disk_operation(
project: ResolvedVc<ProjectContainer>,
app_dir_only: bool,
) -> Result<Vc<Entrypoints>> {
let _ = project
.project()
.emit_all_output_assets(output_assets_operation(project, app_dir_only))
.resolve()
.await?;
Ok(project.entrypoints())
}
#[turbo_tasks::function(operation)]
async fn output_assets_operation(
container: ResolvedVc<ProjectContainer>,
app_dir_only: bool,
) -> Result<Vc<OutputAssets>> {
let endpoint_assets = container
.project()
.get_all_endpoints(app_dir_only)
.await?
.iter()
.map(|endpoint| async move { endpoint.output().await?.output_assets.await })
.try_join()
.await?;
let mut output_assets: FxIndexSet<ResolvedVc<Box<dyn OutputAsset>>> = FxIndexSet::default();
for assets in endpoint_assets {
output_assets.extend(assets.iter());
}
Ok(Vc::cell(output_assets.into_iter().collect()))
}
#[napi(ts_return_type = "{ __napiType: \"RootTask\" }")] #[napi(ts_return_type = "{ __napiType: \"RootTask\" }")]
pub fn project_entrypoints_subscribe( pub fn project_entrypoints_subscribe(
#[napi(ts_arg_type = "{ __napiType: \"Project\" }")] project: External<ProjectInstance>, #[napi(ts_arg_type = "{ __napiType: \"Project\" }")] project: External<ProjectInstance>,
...@@ -753,41 +898,7 @@ pub fn project_entrypoints_subscribe( ...@@ -753,41 +898,7 @@ pub fn project_entrypoints_subscribe(
let (entrypoints, issues, diags) = ctx.value; let (entrypoints, issues, diags) = ctx.value;
Ok(vec![TurbopackResult { Ok(vec![TurbopackResult {
result: NapiEntrypoints { result: NapiEntrypoints::from_entrypoints_op(&entrypoints, &turbo_tasks)?,
routes: entrypoints
.routes
.iter()
.map(|(pathname, route)| {
NapiRoute::from_route(
pathname.clone().into(),
route.clone(),
&turbo_tasks,
)
})
.collect::<Vec<_>>(),
middleware: entrypoints
.middleware
.as_ref()
.map(|m| NapiMiddleware::from_middleware(m, &turbo_tasks))
.transpose()?,
instrumentation: entrypoints
.instrumentation
.as_ref()
.map(|m| NapiInstrumentation::from_instrumentation(m, &turbo_tasks))
.transpose()?,
pages_document_endpoint: External::new(ExternalEndpoint(VcArc::new(
turbo_tasks.clone(),
entrypoints.pages_document_endpoint,
))),
pages_app_endpoint: External::new(ExternalEndpoint(VcArc::new(
turbo_tasks.clone(),
entrypoints.pages_app_endpoint,
))),
pages_error_endpoint: External::new(ExternalEndpoint(VcArc::new(
turbo_tasks.clone(),
entrypoints.pages_error_endpoint,
))),
},
issues: issues issues: issues
.iter() .iter()
.map(|issue| NapiIssue::from(&**issue)) .map(|issue| NapiIssue::from(&**issue))
......
...@@ -9,8 +9,8 @@ use napi::{ ...@@ -9,8 +9,8 @@ use napi::{
use rustc_hash::FxHashMap; use rustc_hash::FxHashMap;
use serde::Serialize; use serde::Serialize;
use turbo_tasks::{ use turbo_tasks::{
task_statistics::TaskStatisticsApi, trace::TraceRawVcs, OperationVc, ReadRef, TaskId, get_effects, task_statistics::TaskStatisticsApi, trace::TraceRawVcs, Effects, OperationVc,
TryJoinIterExt, TurboTasks, TurboTasksApi, UpdateInfo, Vc, ReadRef, TaskId, TryJoinIterExt, TurboTasks, TurboTasksApi, UpdateInfo, Vc, VcValueType,
}; };
use turbo_tasks_backend::{ use turbo_tasks_backend::{
default_backing_storage, noop_backing_storage, DefaultBackingStorage, GitVersionInfo, default_backing_storage, noop_backing_storage, DefaultBackingStorage, GitVersionInfo,
...@@ -20,7 +20,9 @@ use turbo_tasks_fs::FileContent; ...@@ -20,7 +20,9 @@ use turbo_tasks_fs::FileContent;
use turbopack_core::{ use turbopack_core::{
diagnostics::{Diagnostic, DiagnosticContextExt, PlainDiagnostic}, diagnostics::{Diagnostic, DiagnosticContextExt, PlainDiagnostic},
error::PrettyPrintError, error::PrettyPrintError,
issue::{IssueDescriptionExt, PlainIssue, PlainIssueSource, PlainSource, StyledString}, issue::{
IssueDescriptionExt, IssueSeverity, PlainIssue, PlainIssueSource, PlainSource, StyledString,
},
source_pos::SourcePos, source_pos::SourcePos,
}; };
...@@ -481,3 +483,27 @@ pub fn subscribe<T: 'static + Send + Sync, F: Future<Output = Result<T>> + Send, ...@@ -481,3 +483,27 @@ pub fn subscribe<T: 'static + Send + Sync, F: Future<Output = Result<T>> + Send,
task_id: Some(task_id), task_id: Some(task_id),
})) }))
} }
// Await the source and return fatal issues if there are any, otherwise
// propagate any actual error results.
pub async fn strongly_consistent_catch_collectables<R: VcValueType + Send>(
source_op: OperationVc<R>,
) -> Result<(
Option<ReadRef<R>>,
Arc<Vec<ReadRef<PlainIssue>>>,
Arc<Vec<ReadRef<PlainDiagnostic>>>,
Arc<Effects>,
)> {
let result = source_op.read_strongly_consistent().await;
let issues = get_issues(source_op).await?;
let diagnostics = get_diagnostics(source_op).await?;
let effects = Arc::new(get_effects(source_op).await?);
let result = if result.is_err() && issues.iter().any(|i| i.severity <= IssueSeverity::Error) {
None
} else {
Some(result?)
};
Ok((result, issues, diagnostics, effects))
}
...@@ -30,19 +30,13 @@ pub struct EntrypointsOperation { ...@@ -30,19 +30,13 @@ pub struct EntrypointsOperation {
pub pages_error_endpoint: OperationVc<Box<dyn Endpoint>>, pub pages_error_endpoint: OperationVc<Box<dyn Endpoint>>,
} }
/// HACK: Wraps an `OperationVc<Entrypoints>` inside of a second `OperationVc`.
#[turbo_tasks::function(operation)]
fn entrypoints_wrapper(entrypoints: OperationVc<Entrypoints>) -> Vc<Entrypoints> {
entrypoints.connect()
}
/// Removes diagnostics, issues, and effects from the top-level `entrypoints` operation so that /// Removes diagnostics, issues, and effects from the top-level `entrypoints` operation so that
/// they're not duplicated across many different individual entrypoints or routes. /// they're not duplicated across many different individual entrypoints or routes.
#[turbo_tasks::function(operation)] #[turbo_tasks::function(operation)]
async fn entrypoints_without_collectibles_operation( async fn entrypoints_without_collectibles_operation(
entrypoints: OperationVc<Entrypoints>, entrypoints: OperationVc<Entrypoints>,
) -> Result<Vc<Entrypoints>> { ) -> Result<Vc<Entrypoints>> {
let entrypoints = entrypoints_wrapper(entrypoints); let _ = entrypoints.resolve_strongly_consistent().await?;
let _ = entrypoints.take_collectibles::<Box<dyn Diagnostic>>(); let _ = entrypoints.take_collectibles::<Box<dyn Diagnostic>>();
let _ = entrypoints.take_issues_with_path().await?; let _ = entrypoints.take_issues_with_path().await?;
let _ = get_effects(entrypoints).await?; let _ = get_effects(entrypoints).await?;
......
...@@ -791,11 +791,13 @@ impl Project { ...@@ -791,11 +791,13 @@ impl Project {
} }
#[turbo_tasks::function] #[turbo_tasks::function]
pub async fn get_all_endpoints(self: Vc<Self>) -> Result<Vc<Endpoints>> { pub async fn get_all_endpoints(self: Vc<Self>, app_dir_only: bool) -> Result<Vc<Endpoints>> {
let mut endpoints = Vec::new(); let mut endpoints = Vec::new();
let entrypoints = self.entrypoints().await?; let entrypoints = self.entrypoints().await?;
// Always include these basic pages endpoints regardless of `app_dir_only`. The user's
// page routes themselves are excluded below.
endpoints.push(entrypoints.pages_error_endpoint); endpoints.push(entrypoints.pages_error_endpoint);
endpoints.push(entrypoints.pages_app_endpoint); endpoints.push(entrypoints.pages_app_endpoint);
endpoints.push(entrypoints.pages_document_endpoint); endpoints.push(entrypoints.pages_document_endpoint);
...@@ -815,10 +817,14 @@ impl Project { ...@@ -815,10 +817,14 @@ impl Project {
html_endpoint, html_endpoint,
data_endpoint: _, data_endpoint: _,
} => { } => {
endpoints.push(*html_endpoint); if !app_dir_only {
endpoints.push(*html_endpoint);
}
} }
Route::PageApi { endpoint } => { Route::PageApi { endpoint } => {
endpoints.push(*endpoint); if !app_dir_only {
endpoints.push(*endpoint);
}
} }
Route::AppPage(page_routes) => { Route::AppPage(page_routes) => {
for AppPageRoute { for AppPageRoute {
...@@ -848,7 +854,7 @@ impl Project { ...@@ -848,7 +854,7 @@ impl Project {
#[turbo_tasks::function] #[turbo_tasks::function]
pub async fn get_all_entries(self: Vc<Self>) -> Result<Vc<GraphEntries>> { pub async fn get_all_entries(self: Vc<Self>) -> Result<Vc<GraphEntries>> {
let mut modules = self let mut modules = self
.get_all_endpoints() .get_all_endpoints(false)
.await? .await?
.iter() .iter()
.map(async |endpoint| Ok(endpoint.entries().owned().await?)) .map(async |endpoint| Ok(endpoint.entries().owned().await?))
...@@ -864,7 +870,7 @@ impl Project { ...@@ -864,7 +870,7 @@ impl Project {
graphs: Vc<ModuleGraph>, graphs: Vc<ModuleGraph>,
) -> Result<Vc<GraphEntries>> { ) -> Result<Vc<GraphEntries>> {
let modules = self let modules = self
.get_all_endpoints() .get_all_endpoints(false)
.await? .await?
.iter() .iter()
.map(async |endpoint| Ok(endpoint.additional_entries(graphs).owned().await?)) .map(async |endpoint| Ok(endpoint.additional_entries(graphs).owned().await?))
......
...@@ -254,6 +254,10 @@ export interface NapiEntrypoints { ...@@ -254,6 +254,10 @@ export interface NapiEntrypoints {
pagesAppEndpoint: ExternalObject<ExternalEndpoint> pagesAppEndpoint: ExternalObject<ExternalEndpoint>
pagesErrorEndpoint: ExternalObject<ExternalEndpoint> pagesErrorEndpoint: ExternalObject<ExternalEndpoint>
} }
export declare function projectWriteAllEntrypointsToDisk(
project: { __napiType: 'Project' },
appDirOnly: boolean
): Promise<TurbopackResult>
export declare function projectEntrypointsSubscribe( export declare function projectEntrypointsSubscribe(
project: { __napiType: 'Project' }, project: { __napiType: 'Project' },
func: (...args: any[]) => any func: (...args: any[]) => any
......
...@@ -32,6 +32,7 @@ import type { ...@@ -32,6 +32,7 @@ import type {
HmrIdentifiers, HmrIdentifiers,
Project, Project,
ProjectOptions, ProjectOptions,
RawEntrypoints,
Route, Route,
TurboEngineOptions, TurboEngineOptions,
TurbopackResult, TurbopackResult,
...@@ -440,6 +441,58 @@ function bindingToApi( ...@@ -440,6 +441,58 @@ function bindingToApi(
callback: (err: Error, value: T) => void callback: (err: Error, value: T) => void
) => Promise<{ __napiType: 'RootTask' }> ) => Promise<{ __napiType: 'RootTask' }>
type NapiEndpoint = { __napiType: 'Endpoint' }
type NapiEntrypoints = {
routes: NapiRoute[]
middleware?: NapiMiddleware
instrumentation?: NapiInstrumentation
pagesDocumentEndpoint: NapiEndpoint
pagesAppEndpoint: NapiEndpoint
pagesErrorEndpoint: NapiEndpoint
}
type NapiMiddleware = {
endpoint: NapiEndpoint
runtime: 'nodejs' | 'edge'
matcher?: string[]
}
type NapiInstrumentation = {
nodeJs: NapiEndpoint
edge: NapiEndpoint
}
type NapiRoute = {
pathname: string
} & (
| {
type: 'page'
htmlEndpoint: NapiEndpoint
dataEndpoint: NapiEndpoint
}
| {
type: 'page-api'
endpoint: NapiEndpoint
}
| {
type: 'app-page'
pages: {
originalName: string
htmlEndpoint: NapiEndpoint
rscEndpoint: NapiEndpoint
}[]
}
| {
type: 'app-route'
originalName: string
endpoint: NapiEndpoint
}
| {
type: 'conflict'
}
)
const cancel = new (class Cancel extends Error {})() const cancel = new (class Cancel extends Error {})()
/** /**
...@@ -586,59 +639,20 @@ function bindingToApi( ...@@ -586,59 +639,20 @@ function bindingToApi(
) )
} }
entrypointsSubscribe() { async writeAllEntrypointsToDisk(
type NapiEndpoint = { __napiType: 'Endpoint' } appDirOnly: boolean
): Promise<TurbopackResult<RawEntrypoints>> {
type NapiEntrypoints = { return await withErrorCause(async () => {
routes: NapiRoute[] const napiEndpoints = (await binding.projectWriteAllEntrypointsToDisk(
middleware?: NapiMiddleware this._nativeProject,
instrumentation?: NapiInstrumentation appDirOnly
pagesDocumentEndpoint: NapiEndpoint )) as TurbopackResult<NapiEntrypoints>
pagesAppEndpoint: NapiEndpoint
pagesErrorEndpoint: NapiEndpoint
}
type NapiMiddleware = {
endpoint: NapiEndpoint
runtime: 'nodejs' | 'edge'
matcher?: string[]
}
type NapiInstrumentation = {
nodeJs: NapiEndpoint
edge: NapiEndpoint
}
type NapiRoute = { return napiEntrypointsToRawEntrypoints(napiEndpoints)
pathname: string })
} & ( }
| {
type: 'page'
htmlEndpoint: NapiEndpoint
dataEndpoint: NapiEndpoint
}
| {
type: 'page-api'
endpoint: NapiEndpoint
}
| {
type: 'app-page'
pages: {
originalName: string
htmlEndpoint: NapiEndpoint
rscEndpoint: NapiEndpoint
}[]
}
| {
type: 'app-route'
originalName: string
endpoint: NapiEndpoint
}
| {
type: 'conflict'
}
)
entrypointsSubscribe() {
const subscription = subscribe<TurbopackResult<NapiEntrypoints>>( const subscription = subscribe<TurbopackResult<NapiEntrypoints>>(
false, false,
async (callback) => async (callback) =>
...@@ -646,86 +660,7 @@ function bindingToApi( ...@@ -646,86 +660,7 @@ function bindingToApi(
) )
return (async function* () { return (async function* () {
for await (const entrypoints of subscription) { for await (const entrypoints of subscription) {
const routes = new Map() yield napiEntrypointsToRawEntrypoints(entrypoints)
for (const { pathname, ...nativeRoute } of entrypoints.routes) {
let route: Route
const routeType = nativeRoute.type
switch (routeType) {
case 'page':
route = {
type: 'page',
htmlEndpoint: new EndpointImpl(nativeRoute.htmlEndpoint),
dataEndpoint: new EndpointImpl(nativeRoute.dataEndpoint),
}
break
case 'page-api':
route = {
type: 'page-api',
endpoint: new EndpointImpl(nativeRoute.endpoint),
}
break
case 'app-page':
route = {
type: 'app-page',
pages: nativeRoute.pages.map((page) => ({
originalName: page.originalName,
htmlEndpoint: new EndpointImpl(page.htmlEndpoint),
rscEndpoint: new EndpointImpl(page.rscEndpoint),
})),
}
break
case 'app-route':
route = {
type: 'app-route',
originalName: nativeRoute.originalName,
endpoint: new EndpointImpl(nativeRoute.endpoint),
}
break
case 'conflict':
route = {
type: 'conflict',
}
break
default:
const _exhaustiveCheck: never = routeType
invariant(
nativeRoute,
() => `Unknown route type: ${_exhaustiveCheck}`
)
}
routes.set(pathname, route)
}
const napiMiddlewareToMiddleware = (middleware: NapiMiddleware) => ({
endpoint: new EndpointImpl(middleware.endpoint),
runtime: middleware.runtime,
matcher: middleware.matcher,
})
const middleware = entrypoints.middleware
? napiMiddlewareToMiddleware(entrypoints.middleware)
: undefined
const napiInstrumentationToInstrumentation = (
instrumentation: NapiInstrumentation
) => ({
nodeJs: new EndpointImpl(instrumentation.nodeJs),
edge: new EndpointImpl(instrumentation.edge),
})
const instrumentation = entrypoints.instrumentation
? napiInstrumentationToInstrumentation(entrypoints.instrumentation)
: undefined
yield {
routes,
middleware,
instrumentation,
pagesDocumentEndpoint: new EndpointImpl(
entrypoints.pagesDocumentEndpoint
),
pagesAppEndpoint: new EndpointImpl(entrypoints.pagesAppEndpoint),
pagesErrorEndpoint: new EndpointImpl(
entrypoints.pagesErrorEndpoint
),
issues: entrypoints.issues,
diagnostics: entrypoints.diagnostics,
}
} }
})() })()
} }
...@@ -981,6 +916,90 @@ function bindingToApi( ...@@ -981,6 +916,90 @@ function bindingToApi(
} }
} }
function napiEntrypointsToRawEntrypoints(
entrypoints: TurbopackResult<NapiEntrypoints>
): TurbopackResult<RawEntrypoints> {
const routes = new Map()
for (const { pathname, ...nativeRoute } of entrypoints.routes) {
let route: Route
const routeType = nativeRoute.type
switch (routeType) {
case 'page':
route = {
type: 'page',
htmlEndpoint: new EndpointImpl(nativeRoute.htmlEndpoint),
dataEndpoint: new EndpointImpl(nativeRoute.dataEndpoint),
}
break
case 'page-api':
route = {
type: 'page-api',
endpoint: new EndpointImpl(nativeRoute.endpoint),
}
break
case 'app-page':
route = {
type: 'app-page',
pages: nativeRoute.pages.map((page) => ({
originalName: page.originalName,
htmlEndpoint: new EndpointImpl(page.htmlEndpoint),
rscEndpoint: new EndpointImpl(page.rscEndpoint),
})),
}
break
case 'app-route':
route = {
type: 'app-route',
originalName: nativeRoute.originalName,
endpoint: new EndpointImpl(nativeRoute.endpoint),
}
break
case 'conflict':
route = {
type: 'conflict',
}
break
default:
const _exhaustiveCheck: never = routeType
invariant(
nativeRoute,
() => `Unknown route type: ${_exhaustiveCheck}`
)
}
routes.set(pathname, route)
}
const napiMiddlewareToMiddleware = (middleware: NapiMiddleware) => ({
endpoint: new EndpointImpl(middleware.endpoint),
runtime: middleware.runtime,
matcher: middleware.matcher,
})
const middleware = entrypoints.middleware
? napiMiddlewareToMiddleware(entrypoints.middleware)
: undefined
const napiInstrumentationToInstrumentation = (
instrumentation: NapiInstrumentation
) => ({
nodeJs: new EndpointImpl(instrumentation.nodeJs),
edge: new EndpointImpl(instrumentation.edge),
})
const instrumentation = entrypoints.instrumentation
? napiInstrumentationToInstrumentation(entrypoints.instrumentation)
: undefined
return {
routes,
middleware,
instrumentation,
pagesDocumentEndpoint: new EndpointImpl(
entrypoints.pagesDocumentEndpoint
),
pagesAppEndpoint: new EndpointImpl(entrypoints.pagesAppEndpoint),
pagesErrorEndpoint: new EndpointImpl(entrypoints.pagesErrorEndpoint),
issues: entrypoints.issues,
diagnostics: entrypoints.diagnostics,
}
}
return async function createProject( return async function createProject(
options: ProjectOptions, options: ProjectOptions,
turboEngineOptions turboEngineOptions
......
...@@ -186,6 +186,10 @@ export interface UpdateInfo { ...@@ -186,6 +186,10 @@ export interface UpdateInfo {
export interface Project { export interface Project {
update(options: Partial<ProjectOptions>): Promise<void> update(options: Partial<ProjectOptions>): Promise<void>
writeAllEntrypointsToDisk(
appDirOnly: boolean
): Promise<TurbopackResult<RawEntrypoints>>
entrypointsSubscribe(): AsyncIterableIterator<TurbopackResult<RawEntrypoints>> entrypointsSubscribe(): AsyncIterableIterator<TurbopackResult<RawEntrypoints>>
hmrEvents(identifier: string): AsyncIterableIterator<TurbopackResult<Update>> hmrEvents(identifier: string): AsyncIterableIterator<TurbopackResult<Update>>
......
...@@ -5,20 +5,14 @@ import { ...@@ -5,20 +5,14 @@ import {
getTurbopackJsConfig, getTurbopackJsConfig,
isPersistentCachingEnabled, isPersistentCachingEnabled,
isRelevantWarning, isRelevantWarning,
type EntryIssuesMap,
} from '../../shared/lib/turbopack/utils' } from '../../shared/lib/turbopack/utils'
import { NextBuildContext } from '../build-context' import { NextBuildContext } from '../build-context'
import { createDefineEnv, loadBindings } from '../swc' import { createDefineEnv, loadBindings } from '../swc'
import { Sema } from 'next/dist/compiled/async-sema'
import { import {
handleEntrypoints, rawEntrypointsToEntrypoints,
handlePagesErrorRoute,
handleRouteType, handleRouteType,
} from '../handle-entrypoints' } from '../handle-entrypoints'
import type { Entrypoints } from '../swc/types'
import { TurbopackManifestLoader } from '../../shared/lib/turbopack/manifest-loader' import { TurbopackManifestLoader } from '../../shared/lib/turbopack/manifest-loader'
import { createProgress } from '../progress'
import * as Log from '../output/log'
import { promises as fs } from 'fs' import { promises as fs } from 'fs'
import { PHASE_PRODUCTION_BUILD } from '../../shared/lib/constants' import { PHASE_PRODUCTION_BUILD } from '../../shared/lib/constants'
import loadConfig from '../../server/config' import loadConfig from '../../server/config'
...@@ -116,22 +110,7 @@ export async function turbopackBuild(): Promise<{ ...@@ -116,22 +110,7 @@ export async function turbopackBuild(): Promise<{
) )
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
const entrypointsSubscription = project.entrypointsSubscribe() const entrypoints = await project.writeAllEntrypointsToDisk(appDirOnly)
const currentEntrypoints: Entrypoints = {
global: {
app: undefined,
document: undefined,
error: undefined,
middleware: undefined,
instrumentation: undefined,
},
app: new Map(),
page: new Map(),
}
const currentEntryIssues: EntryIssuesMap = new Map()
const manifestLoader = new TurbopackManifestLoader({ const manifestLoader = new TurbopackManifestLoader({
buildId, buildId,
...@@ -139,167 +118,85 @@ export async function turbopackBuild(): Promise<{ ...@@ -139,167 +118,85 @@ export async function turbopackBuild(): Promise<{
encryptionKey, encryptionKey,
}) })
const entrypointsResult = await entrypointsSubscription.next() const topLevelErrors = []
if (entrypointsResult.done) { const topLevelWarnings = []
throw new Error('Turbopack did not return any entrypoints') for (const issue of entrypoints.issues) {
if (issue.severity === 'error' || issue.severity === 'fatal') {
topLevelErrors.push(formatIssue(issue))
} else if (isRelevantWarning(issue)) {
topLevelWarnings.push(formatIssue(issue))
}
} }
entrypointsSubscription.return?.().catch(() => {})
const entrypoints = entrypointsResult.value if (topLevelWarnings.length > 0) {
console.warn(
const topLevelErrors: { `Turbopack build encountered ${
message: string topLevelWarnings.length
}[] = [] } warnings:\n${topLevelWarnings.join('\n')}`
for (const issue of entrypoints.issues) { )
topLevelErrors.push({
message: formatIssue(issue),
})
} }
if (topLevelErrors.length > 0) { if (topLevelErrors.length > 0) {
throw new Error( throw new Error(
`Turbopack build failed with ${ `Turbopack build failed with ${
topLevelErrors.length topLevelErrors.length
} issues:\n${topLevelErrors.map((e) => e.message).join('\n')}` } errors:\n${topLevelErrors.join('\n')}`
) )
} }
await handleEntrypoints({ const currentEntrypoints = await rawEntrypointsToEntrypoints(entrypoints)
entrypoints,
currentEntrypoints,
currentEntryIssues,
manifestLoader,
productionRewrites: rewrites,
logErrors: false,
})
const progress = createProgress(
currentEntrypoints.page.size + currentEntrypoints.app.size + 1,
'Building'
)
const promises: Promise<any>[] = [] const promises: Promise<any>[] = []
// Concurrency will start at INITIAL_CONCURRENCY and
// slowly ramp up to CONCURRENCY by increasing the
// concurrency by 1 every time a task is completed.
const INITIAL_CONCURRENCY = 5
const CONCURRENCY = 10
const sema = new Sema(INITIAL_CONCURRENCY)
let remainingRampup = CONCURRENCY - INITIAL_CONCURRENCY
const enqueue = (fn: () => Promise<void>) => {
promises.push(
(async () => {
await sema.acquire()
try {
await fn()
} finally {
sema.release()
if (remainingRampup > 0) {
remainingRampup--
sema.release()
}
progress.run()
}
})()
)
}
if (!appDirOnly) { if (!appDirOnly) {
for (const [page, route] of currentEntrypoints.page) { for (const [page, route] of currentEntrypoints.page) {
enqueue(() => promises.push(
handleRouteType({ handleRouteType({
page, page,
route, route,
currentEntryIssues,
entrypoints: currentEntrypoints,
manifestLoader, manifestLoader,
productionRewrites: rewrites,
logErrors: false,
}) })
) )
} }
} }
for (const [page, route] of currentEntrypoints.app) { for (const [page, route] of currentEntrypoints.app) {
enqueue(() => promises.push(
handleRouteType({ handleRouteType({
page, page,
route, route,
currentEntryIssues,
entrypoints: currentEntrypoints,
manifestLoader, manifestLoader,
productionRewrites: rewrites,
logErrors: false,
}) })
) )
} }
enqueue(() =>
handlePagesErrorRoute({
currentEntryIssues,
entrypoints: currentEntrypoints,
manifestLoader,
productionRewrites: rewrites,
logErrors: false,
})
)
await Promise.all(promises) await Promise.all(promises)
await Promise.all([
manifestLoader.loadBuildManifest('_app'),
manifestLoader.loadPagesManifest('_app'),
manifestLoader.loadFontManifest('_app'),
manifestLoader.loadPagesManifest('_document'),
manifestLoader.loadBuildManifest('_error'),
manifestLoader.loadPagesManifest('_error'),
manifestLoader.loadFontManifest('_error'),
entrypoints.instrumentation &&
manifestLoader.loadMiddlewareManifest(
'instrumentation',
'instrumentation'
),
entrypoints.middleware &&
(await manifestLoader.loadMiddlewareManifest('middleware', 'middleware')),
])
await manifestLoader.writeManifests({ await manifestLoader.writeManifests({
devRewrites: undefined, devRewrites: undefined,
productionRewrites: rewrites, productionRewrites: rewrites,
entrypoints: currentEntrypoints, entrypoints: currentEntrypoints,
}) })
const errors: {
page: string
message: string
}[] = []
const warnings: {
page: string
message: string
}[] = []
for (const [page, entryIssues] of currentEntryIssues) {
for (const issue of entryIssues.values()) {
if (issue.severity !== 'warning') {
errors.push({
page,
message: formatIssue(issue),
})
} else {
if (isRelevantWarning(issue)) {
warnings.push({
page,
message: formatIssue(issue),
})
}
}
}
}
const shutdownPromise = project.shutdown() const shutdownPromise = project.shutdown()
if (warnings.length > 0) {
Log.warn(
`Turbopack build collected ${warnings.length} warnings:\n${warnings
.map((e) => {
return 'Page: ' + e.page + '\n' + e.message
})
.join('\n')}`
)
}
if (errors.length > 0) {
throw new Error(
`Turbopack build failed with ${errors.length} errors:\n${errors
.map((e) => {
return 'Page: ' + e.page + '\n' + e.message
})
.join('\n')}`
)
}
const time = process.hrtime(startTime) const time = process.hrtime(startTime)
return { return {
duration: time[0] + time[1] / 1e9, duration: time[0] + time[1] / 1e9,
......
...@@ -63,11 +63,23 @@ type TurbopackMiddlewareManifest = MiddlewareManifest & { ...@@ -63,11 +63,23 @@ type TurbopackMiddlewareManifest = MiddlewareManifest & {
instrumentation?: InstrumentationDefinition instrumentation?: InstrumentationDefinition
} }
type ManifestName =
| typeof MIDDLEWARE_MANIFEST
| typeof BUILD_MANIFEST
| typeof APP_BUILD_MANIFEST
| typeof PAGES_MANIFEST
| typeof WEBPACK_STATS
| typeof APP_PATHS_MANIFEST
| `${typeof SERVER_REFERENCE_MANIFEST}.json`
| `${typeof NEXT_FONT_MANIFEST}.json`
| typeof REACT_LOADABLE_MANIFEST
const getManifestPath = ( const getManifestPath = (
page: string, page: string,
distDir: string, distDir: string,
name: string, name: ManifestName,
type: string type: string,
firstCall: boolean
) => { ) => {
let manifestPath = posix.join( let manifestPath = posix.join(
distDir, distDir,
...@@ -80,45 +92,40 @@ const getManifestPath = ( ...@@ -80,45 +92,40 @@ const getManifestPath = (
: getAssetPathFromRoute(page), : getAssetPathFromRoute(page),
name name
) )
if (firstCall) {
const isSitemapRoute = /[\\/]sitemap(.xml)?\/route$/.test(page)
// Check the ambiguity of /sitemap and /sitemap.xml
if (isSitemapRoute && !existsSync(manifestPath)) {
manifestPath = getManifestPath(
page.replace(/\/sitemap\/route$/, '/sitemap.xml/route'),
distDir,
name,
type,
false
)
}
// existsSync is faster than using the async version
if (!existsSync(manifestPath) && page.endsWith('/route')) {
// TODO: Improve implementation of metadata routes, currently it requires this extra check for the variants of the files that can be written.
let metadataPage = addRouteSuffix(
addMetadataIdToRoute(removeRouteSuffix(page))
)
manifestPath = getManifestPath(metadataPage, distDir, name, type, false)
}
}
return manifestPath return manifestPath
} }
async function readPartialManifest<T>( async function readPartialManifest<T>(
distDir: string, distDir: string,
name: name: ManifestName,
| typeof MIDDLEWARE_MANIFEST
| typeof BUILD_MANIFEST
| typeof APP_BUILD_MANIFEST
| typeof PAGES_MANIFEST
| typeof WEBPACK_STATS
| typeof APP_PATHS_MANIFEST
| `${typeof SERVER_REFERENCE_MANIFEST}.json`
| `${typeof NEXT_FONT_MANIFEST}.json`
| typeof REACT_LOADABLE_MANIFEST,
pageName: string, pageName: string,
type: 'pages' | 'app' | 'middleware' | 'instrumentation' = 'pages' type: 'pages' | 'app' | 'middleware' | 'instrumentation' = 'pages'
): Promise<T> { ): Promise<T> {
const page = pageName const page = pageName
const isSitemapRoute = /[\\/]sitemap(.xml)?\/route$/.test(page) const manifestPath = getManifestPath(page, distDir, name, type, true)
let manifestPath = getManifestPath(page, distDir, name, type)
// Check the ambiguity of /sitemap and /sitemap.xml
if (isSitemapRoute && !existsSync(manifestPath)) {
manifestPath = getManifestPath(
pageName.replace(/\/sitemap\/route$/, '/sitemap.xml/route'),
distDir,
name,
type
)
}
// existsSync is faster than using the async version
if (!existsSync(manifestPath) && page.endsWith('/route')) {
// TODO: Improve implementation of metadata routes, currently it requires this extra check for the variants of the files that can be written.
let metadataPage = addRouteSuffix(
addMetadataIdToRoute(removeRouteSuffix(page))
)
manifestPath = getManifestPath(metadataPage, distDir, name, type)
}
return JSON.parse(await readFile(posix.join(manifestPath), 'utf-8')) as T return JSON.parse(await readFile(posix.join(manifestPath), 'utf-8')) as T
} }
...@@ -590,10 +597,26 @@ export class TurbopackManifestLoader { ...@@ -590,10 +597,26 @@ export class TurbopackManifestLoader {
) )
} }
/**
* @returns If the manifest was written or not
*/
async loadMiddlewareManifest( async loadMiddlewareManifest(
pageName: string, pageName: string,
type: 'pages' | 'app' | 'middleware' | 'instrumentation' type: 'pages' | 'app' | 'middleware' | 'instrumentation'
): Promise<void> { ): Promise<boolean> {
const middlewareManifestPath = getManifestPath(
pageName,
this.distDir,
MIDDLEWARE_MANIFEST,
type,
true
)
// middlewareManifest is actually "edge manifest" and not all routes are edge runtime. If it is not written we skip it.
if (!existsSync(middlewareManifestPath)) {
return false
}
this.middlewareManifests.set( this.middlewareManifests.set(
getEntryKey( getEntryKey(
type === 'middleware' || type === 'instrumentation' ? 'root' : type, type === 'middleware' || type === 'instrumentation' ? 'root' : type,
...@@ -607,6 +630,8 @@ export class TurbopackManifestLoader { ...@@ -607,6 +630,8 @@ export class TurbopackManifestLoader {
type type
) )
) )
return true
} }
getMiddlewareManifest(key: EntryKey) { getMiddlewareManifest(key: EntryKey) {
......
...@@ -114,7 +114,6 @@ describe('dynamic-io-segment-configs', () => { ...@@ -114,7 +114,6 @@ describe('dynamic-io-segment-configs', () => {
// the stack trace is different between turbopack/webpack // the stack trace is different between turbopack/webpack
if (isTurbopack) { if (isTurbopack) {
expectLinesToAppearTogether(next.cliOutput, [ expectLinesToAppearTogether(next.cliOutput, [
`Page: {"type":"app","side":"server","page":"/fetch-cache/page"}`,
'./app/layout.tsx:2:24', './app/layout.tsx:2:24',
]) ])
} else { } else {
......
...@@ -56,7 +56,6 @@ describe('use-cache-segment-configs', () => { ...@@ -56,7 +56,6 @@ describe('use-cache-segment-configs', () => {
if (isTurbopack) { if (isTurbopack) {
expect(buildOutput).toMatchInlineSnapshot(` expect(buildOutput).toMatchInlineSnapshot(`
"Error: Turbopack build failed with 1 errors: "Error: Turbopack build failed with 1 errors:
Page: {"type":"app","side":"server","page":"/runtime/page"}
./app/runtime/page.tsx:1:14 ./app/runtime/page.tsx:1:14
Ecmascript file had an error Ecmascript file had an error
> 1 | export const runtime = 'edge' > 1 | export const runtime = 'edge'
......
...@@ -42,22 +42,21 @@ describe('use-cache-unknown-cache-kind', () => { ...@@ -42,22 +42,21 @@ describe('use-cache-unknown-cache-kind', () => {
if (isTurbopack) { if (isTurbopack) {
expect(buildOutput).toMatchInlineSnapshot(` expect(buildOutput).toMatchInlineSnapshot(`
"Error: Turbopack build failed with 1 errors: "Error: Turbopack build failed with 1 errors:
Page: {"type":"app","side":"server","page":"/page"} ./app/page.tsx:1:1
./app/page.tsx:1:1 Ecmascript file had an error
Ecmascript file had an error > 1 | 'use cache: custom'
> 1 | 'use cache: custom' | ^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^ 2 |
2 | 3 | export default async function Page() {
3 | export default async function Page() { 4 | return <p>hello world</p>
4 | return <p>hello world</p>
Unknown cache kind "custom". Please configure a cache handler for this kind in the "experimental.cacheHandlers" object in your Next.js config. Unknown cache kind "custom". Please configure a cache handler for this kind in the "experimental.cacheHandlers" object in your Next.js config.
at <unknown> (./app/page.tsx:1:1) at <unknown> (./app/page.tsx:1:1)
" "
`) `)
} else if (isRspack) { } else if (isRspack) {
expect(buildOutput).toMatchInlineSnapshot(` expect(buildOutput).toMatchInlineSnapshot(`
......
...@@ -32,7 +32,6 @@ describe('use-cache-without-experimental-flag', () => { ...@@ -32,7 +32,6 @@ describe('use-cache-without-experimental-flag', () => {
if (isTurbopack) { if (isTurbopack) {
expect(buildOutput).toMatchInlineSnapshot(` expect(buildOutput).toMatchInlineSnapshot(`
"Error: Turbopack build failed with 1 errors: "Error: Turbopack build failed with 1 errors:
Page: {"type":"app","side":"server","page":"/page"}
./app/page.tsx:1:1 ./app/page.tsx:1:1
Ecmascript file had an error Ecmascript file had an error
> 1 | 'use cache' > 1 | 'use cache'
......
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