|
|
|
|
|
|
|
|
import type { TurbopackResult } from './types' |
|
|
|
|
|
export type TurboTasks = { readonly __tag: unique symbol } |
|
|
export type ExternalEndpoint = { readonly __tag: unique symbol } |
|
|
export type NextTurboTasks = { readonly __tag: unique symbol } |
|
|
export type RefCell = { readonly __tag: unique symbol } |
|
|
export type NapiRouteHas = { |
|
|
type: string |
|
|
key?: string |
|
|
value?: string |
|
|
readonly __tag: unique symbol |
|
|
} |
|
|
export type RcStr = string |
|
|
|
|
|
export function lightningCssTransform(args: object): Promise<unknown> |
|
|
export function lightningCssTransformStyleAttribute( |
|
|
args: object |
|
|
): Promise<unknown> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export declare class ExternalObject<T> { |
|
|
readonly '': { |
|
|
readonly '': unique symbol |
|
|
[K: symbol]: T |
|
|
} |
|
|
} |
|
|
export interface TransformOutput { |
|
|
code: string |
|
|
map?: string |
|
|
output?: string |
|
|
diagnostics: Array<string> |
|
|
} |
|
|
export declare function mdxCompile( |
|
|
value: string, |
|
|
option: Buffer, |
|
|
signal?: AbortSignal | undefined | null |
|
|
): Promise<unknown> |
|
|
export declare function mdxCompileSync(value: string, option: Buffer): string |
|
|
export declare function minify( |
|
|
input: Buffer, |
|
|
opts: Buffer, |
|
|
signal?: AbortSignal | undefined | null |
|
|
): Promise<TransformOutput> |
|
|
export declare function minifySync(input: Buffer, opts: Buffer): TransformOutput |
|
|
export interface NapiEndpointConfig {} |
|
|
export interface NapiServerPath { |
|
|
path: string |
|
|
contentHash: string |
|
|
} |
|
|
export interface NapiWrittenEndpoint { |
|
|
type: string |
|
|
entryPath?: string |
|
|
clientPaths: Array<string> |
|
|
serverPaths: Array<NapiServerPath> |
|
|
config: NapiEndpointConfig |
|
|
} |
|
|
export interface NapiModuleGraphSnapshots { |
|
|
moduleGraphs: Array<NapiModuleGraphSnapshot> |
|
|
} |
|
|
export declare function endpointWriteToDisk(endpoint: { |
|
|
__napiType: 'Endpoint' |
|
|
}): Promise<TurbopackResult> |
|
|
export declare function endpointModuleGraphs(endpoint: { |
|
|
__napiType: 'Endpoint' |
|
|
}): Promise<TurbopackResult> |
|
|
export declare function endpointServerChangedSubscribe( |
|
|
endpoint: { __napiType: 'Endpoint' }, |
|
|
issues: boolean, |
|
|
func: (...args: any[]) => any |
|
|
): { __napiType: 'RootTask' } |
|
|
export declare function endpointClientChangedSubscribe( |
|
|
endpoint: { __napiType: 'Endpoint' }, |
|
|
func: (...args: any[]) => any |
|
|
): { __napiType: 'RootTask' } |
|
|
export interface NapiModuleReference { |
|
|
|
|
|
index: number |
|
|
|
|
|
export: string |
|
|
|
|
|
chunkingType: string |
|
|
} |
|
|
export interface NapiModuleInfo { |
|
|
ident: RcStr |
|
|
path: RcStr |
|
|
depth: number |
|
|
size: number |
|
|
retainedSize: number |
|
|
references: Array<NapiModuleReference> |
|
|
incomingReferences: Array<NapiModuleReference> |
|
|
} |
|
|
export interface NapiModuleGraphSnapshot { |
|
|
modules: Array<NapiModuleInfo> |
|
|
entries: Array<number> |
|
|
} |
|
|
export interface NapiEnvVar { |
|
|
name: RcStr |
|
|
value: RcStr |
|
|
} |
|
|
export interface NapiOptionEnvVar { |
|
|
name: RcStr |
|
|
value?: RcStr |
|
|
} |
|
|
export interface NapiDraftModeOptions { |
|
|
previewModeId: RcStr |
|
|
previewModeEncryptionKey: RcStr |
|
|
previewModeSigningKey: RcStr |
|
|
} |
|
|
export interface NapiWatchOptions { |
|
|
|
|
|
enable: boolean |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pollIntervalMs?: number |
|
|
} |
|
|
export interface NapiProjectOptions { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rootPath: RcStr |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
projectPath: RcStr |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
distDir: RcStr |
|
|
|
|
|
watch: NapiWatchOptions |
|
|
|
|
|
nextConfig: RcStr |
|
|
|
|
|
jsConfig: RcStr |
|
|
|
|
|
env: Array<NapiEnvVar> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
defineEnv: NapiDefineEnv |
|
|
|
|
|
dev: boolean |
|
|
|
|
|
encryptionKey: RcStr |
|
|
|
|
|
buildId: RcStr |
|
|
|
|
|
previewProps: NapiDraftModeOptions |
|
|
|
|
|
browserslistQuery: RcStr |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
noMangling: boolean |
|
|
|
|
|
currentNodeJsVersion: RcStr |
|
|
} |
|
|
|
|
|
export interface NapiPartialProjectOptions { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rootPath?: RcStr |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
projectPath?: RcStr |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
distDir?: RcStr | undefined | null |
|
|
|
|
|
watch?: NapiWatchOptions |
|
|
|
|
|
nextConfig?: RcStr |
|
|
|
|
|
jsConfig?: RcStr |
|
|
|
|
|
env?: Array<NapiEnvVar> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
defineEnv?: NapiDefineEnv |
|
|
|
|
|
dev?: boolean |
|
|
|
|
|
encryptionKey?: RcStr |
|
|
|
|
|
buildId?: RcStr |
|
|
|
|
|
previewProps?: NapiDraftModeOptions |
|
|
|
|
|
browserslistQuery?: RcStr |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
noMangling?: boolean |
|
|
} |
|
|
export interface NapiDefineEnv { |
|
|
client: Array<NapiOptionEnvVar> |
|
|
edge: Array<NapiOptionEnvVar> |
|
|
nodejs: Array<NapiOptionEnvVar> |
|
|
} |
|
|
export interface NapiTurboEngineOptions { |
|
|
|
|
|
persistentCaching?: boolean |
|
|
|
|
|
memoryLimit?: number |
|
|
|
|
|
dependencyTracking?: boolean |
|
|
|
|
|
isCi?: boolean |
|
|
} |
|
|
export declare function projectNew( |
|
|
options: NapiProjectOptions, |
|
|
turboEngineOptions: NapiTurboEngineOptions, |
|
|
napiCallbacks: NapiNextTurbopackCallbacksJsObject |
|
|
): Promise<{ __napiType: 'Project' }> |
|
|
export declare function projectUpdate( |
|
|
project: { __napiType: 'Project' }, |
|
|
options: NapiPartialProjectOptions |
|
|
): Promise<void> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export declare function projectInvalidatePersistentCache(project: { |
|
|
__napiType: 'Project' |
|
|
}): Promise<void> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export declare function projectOnExit(project: { |
|
|
__napiType: 'Project' |
|
|
}): Promise<void> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export declare function projectShutdown(project: { |
|
|
__napiType: 'Project' |
|
|
}): Promise<void> |
|
|
export interface AppPageNapiRoute { |
|
|
|
|
|
originalName?: RcStr |
|
|
htmlEndpoint?: ExternalObject<ExternalEndpoint> |
|
|
rscEndpoint?: ExternalObject<ExternalEndpoint> |
|
|
} |
|
|
export interface NapiRoute { |
|
|
|
|
|
pathname: string |
|
|
|
|
|
originalName?: RcStr |
|
|
|
|
|
type: string |
|
|
pages?: Array<AppPageNapiRoute> |
|
|
endpoint?: ExternalObject<ExternalEndpoint> |
|
|
htmlEndpoint?: ExternalObject<ExternalEndpoint> |
|
|
rscEndpoint?: ExternalObject<ExternalEndpoint> |
|
|
dataEndpoint?: ExternalObject<ExternalEndpoint> |
|
|
} |
|
|
export interface NapiMiddleware { |
|
|
endpoint: ExternalObject<ExternalEndpoint> |
|
|
} |
|
|
export interface NapiInstrumentation { |
|
|
nodeJs: ExternalObject<ExternalEndpoint> |
|
|
edge: ExternalObject<ExternalEndpoint> |
|
|
} |
|
|
export interface NapiEntrypoints { |
|
|
routes: Array<NapiRoute> |
|
|
middleware?: NapiMiddleware |
|
|
instrumentation?: NapiInstrumentation |
|
|
pagesDocumentEndpoint: ExternalObject<ExternalEndpoint> |
|
|
pagesAppEndpoint: ExternalObject<ExternalEndpoint> |
|
|
pagesErrorEndpoint: ExternalObject<ExternalEndpoint> |
|
|
} |
|
|
export declare function projectWriteAllEntrypointsToDisk( |
|
|
project: { __napiType: 'Project' }, |
|
|
appDirOnly: boolean |
|
|
): Promise<TurbopackResult> |
|
|
export declare function projectEntrypoints(project: { |
|
|
__napiType: 'Project' |
|
|
}): Promise<TurbopackResult> |
|
|
export declare function projectEntrypointsSubscribe( |
|
|
project: { __napiType: 'Project' }, |
|
|
func: (...args: any[]) => any |
|
|
): { __napiType: 'RootTask' } |
|
|
export declare function projectHmrEvents( |
|
|
project: { __napiType: 'Project' }, |
|
|
identifier: RcStr, |
|
|
func: (...args: any[]) => any |
|
|
): { __napiType: 'RootTask' } |
|
|
export interface HmrIdentifiers { |
|
|
identifiers: Array<RcStr> |
|
|
} |
|
|
export declare function projectHmrIdentifiersSubscribe( |
|
|
project: { __napiType: 'Project' }, |
|
|
func: (...args: any[]) => any |
|
|
): { __napiType: 'RootTask' } |
|
|
export interface NapiUpdateMessage { |
|
|
updateType: string |
|
|
value?: NapiUpdateInfo |
|
|
} |
|
|
export interface NapiUpdateInfo { |
|
|
duration: number |
|
|
tasks: number |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export declare function projectUpdateInfoSubscribe( |
|
|
project: { __napiType: 'Project' }, |
|
|
aggregationMs: number, |
|
|
func: (...args: any[]) => any |
|
|
): void |
|
|
|
|
|
export declare function projectCompilationEventsSubscribe( |
|
|
project: { __napiType: 'Project' }, |
|
|
func: (...args: any[]) => any, |
|
|
eventTypes?: Array<string> | undefined | null |
|
|
): void |
|
|
export interface StackFrame { |
|
|
isServer: boolean |
|
|
isInternal?: boolean |
|
|
originalFile?: RcStr |
|
|
file: RcStr |
|
|
|
|
|
line?: number |
|
|
|
|
|
column?: number |
|
|
methodName?: RcStr |
|
|
} |
|
|
export declare function projectTraceSource( |
|
|
project: { __napiType: 'Project' }, |
|
|
frame: StackFrame, |
|
|
currentDirectoryFileUrl: string |
|
|
): Promise<StackFrame | null> |
|
|
export declare function projectGetSourceForAsset( |
|
|
project: { __napiType: 'Project' }, |
|
|
filePath: RcStr |
|
|
): Promise<string | null> |
|
|
export declare function projectGetSourceMap( |
|
|
project: { __napiType: 'Project' }, |
|
|
filePath: RcStr |
|
|
): Promise<string | null> |
|
|
export declare function projectGetSourceMapSync( |
|
|
project: { __napiType: 'Project' }, |
|
|
filePath: RcStr |
|
|
): string | null |
|
|
export declare function projectModuleGraph(project: { |
|
|
__napiType: 'Project' |
|
|
}): Promise<TurbopackResult> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export interface NapiNextTurbopackCallbacksJsObject { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
throwTurbopackInternalError: ( |
|
|
conversionError: Error | null, |
|
|
opts: TurbopackInternalErrorOpts |
|
|
) => never |
|
|
} |
|
|
|
|
|
export interface TurbopackInternalErrorOpts { |
|
|
message: string |
|
|
anonymizedLocation?: string |
|
|
} |
|
|
export declare function rootTaskDispose(rootTask: { |
|
|
__napiType: 'RootTask' |
|
|
}): void |
|
|
export interface NapiIssue { |
|
|
severity: string |
|
|
stage: string |
|
|
filePath: string |
|
|
title: any |
|
|
description?: any |
|
|
detail?: any |
|
|
source?: NapiIssueSource |
|
|
documentationLink: string |
|
|
importTraces: any |
|
|
} |
|
|
export interface NapiIssueSource { |
|
|
source: NapiSource |
|
|
range?: NapiIssueSourceRange |
|
|
} |
|
|
export interface NapiIssueSourceRange { |
|
|
start: NapiSourcePos |
|
|
end: NapiSourcePos |
|
|
} |
|
|
export interface NapiSource { |
|
|
ident: string |
|
|
content?: string |
|
|
} |
|
|
export interface NapiSourcePos { |
|
|
line: number |
|
|
column: number |
|
|
} |
|
|
export interface NapiDiagnostic { |
|
|
category: string |
|
|
name: string |
|
|
payload: Record<string, string> |
|
|
} |
|
|
export declare function parse( |
|
|
src: string, |
|
|
options: Buffer, |
|
|
filename?: string | undefined | null, |
|
|
signal?: AbortSignal | undefined | null |
|
|
): Promise<string> |
|
|
export declare function isReactCompilerRequired( |
|
|
filename: string, |
|
|
signal?: AbortSignal | undefined | null |
|
|
): Promise<boolean> |
|
|
export declare function getModuleNamedExports( |
|
|
resourcePath: string |
|
|
): Promise<string[]> |
|
|
export interface NapiSourceDiagnostic { |
|
|
severity: string |
|
|
message: string |
|
|
loc: NapiIssueSourceRange |
|
|
} |
|
|
export declare function warnForEdgeRuntime( |
|
|
source: string, |
|
|
isProduction: boolean |
|
|
): Promise<NapiSourceDiagnostic[]> |
|
|
export declare function transform( |
|
|
src: string | Buffer | undefined, |
|
|
isModule: boolean, |
|
|
options: Buffer, |
|
|
signal?: AbortSignal | undefined | null |
|
|
): Promise<unknown> |
|
|
export declare function transformSync( |
|
|
src: string | Buffer | undefined, |
|
|
isModule: boolean, |
|
|
options: Buffer |
|
|
): object |
|
|
export declare function startTurbopackTraceServer(path: string): void |
|
|
export interface NextBuildContext { |
|
|
|
|
|
root?: string |
|
|
|
|
|
dir?: string |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
distDir?: string |
|
|
|
|
|
buildId?: string |
|
|
|
|
|
rewrites?: NapiRewrites |
|
|
defineEnv: NapiDefineEnv |
|
|
} |
|
|
|
|
|
export interface NapiRewrites { |
|
|
fallback: Array<NapiRewrite> |
|
|
afterFiles: Array<NapiRewrite> |
|
|
beforeFiles: Array<NapiRewrite> |
|
|
} |
|
|
|
|
|
export interface NapiRewrite { |
|
|
source: string |
|
|
destination: string |
|
|
basePath?: boolean |
|
|
locale?: boolean |
|
|
has?: Array<NapiRouteHas> |
|
|
missing?: Array<NapiRouteHas> |
|
|
} |
|
|
export declare function getTargetTriple(): string |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export declare function initCustomTraceSubscriber( |
|
|
traceOutFilePath?: string | undefined | null |
|
|
): ExternalObject<RefCell> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export declare function teardownTraceSubscriber( |
|
|
guardExternal: ExternalObject<RefCell> |
|
|
): void |
|
|
|