next 15.2.2-canary.5 → 15.2.2-canary.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of next might be problematic. Click here for more details.
- package/dist/bin/next +1 -1
- package/dist/build/handle-entrypoints.d.ts +3 -23
- package/dist/build/handle-entrypoints.js +36 -149
- package/dist/build/handle-entrypoints.js.map +1 -1
- package/dist/build/index.js +2 -2
- package/dist/build/swc/generated-native.d.ts +4 -0
- package/dist/build/swc/index.js +77 -68
- package/dist/build/swc/index.js.map +1 -1
- package/dist/build/swc/types.d.ts +1 -0
- package/dist/build/turbopack-build/impl.js +33 -160
- package/dist/build/turbopack-build/impl.js.map +1 -1
- package/dist/build/webpack-config.js +2 -2
- package/dist/client/app-bootstrap.js +1 -1
- package/dist/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/next-logo.js +3 -5
- package/dist/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/next-logo.js.map +1 -1
- package/dist/client/components/react-dev-overlay/ui/components/errors/error-overlay-layout/error-overlay-layout.d.ts +1 -1
- package/dist/client/components/react-dev-overlay/ui/components/errors/error-overlay-nav/error-overlay-nav.d.ts +1 -1
- package/dist/client/components/react-dev-overlay/ui/components/errors/error-overlay-nav/error-overlay-nav.js +1 -1
- package/dist/client/components/react-dev-overlay/ui/components/errors/error-overlay-nav/error-overlay-nav.js.map +1 -1
- package/dist/client/components/react-dev-overlay/ui/styles/base.js +1 -1
- package/dist/client/components/react-dev-overlay/ui/styles/base.js.map +1 -1
- package/dist/client/index.js +1 -1
- package/dist/compiled/next-server/app-page-experimental.runtime.dev.js +2 -2
- package/dist/compiled/next-server/app-page-experimental.runtime.dev.js.map +1 -1
- package/dist/compiled/next-server/app-page.runtime.dev.js +2 -2
- package/dist/compiled/next-server/app-page.runtime.dev.js.map +1 -1
- package/dist/esm/build/handle-entrypoints.js +31 -140
- package/dist/esm/build/handle-entrypoints.js.map +1 -1
- package/dist/esm/build/index.js +2 -2
- package/dist/esm/build/swc/generated-native.d.ts +4 -0
- package/dist/esm/build/swc/index.js +77 -68
- package/dist/esm/build/swc/index.js.map +1 -1
- package/dist/esm/build/swc/types.js.map +1 -1
- package/dist/esm/build/turbopack-build/impl.js +34 -120
- package/dist/esm/build/turbopack-build/impl.js.map +1 -1
- package/dist/esm/build/webpack-config.js +2 -2
- package/dist/esm/client/app-bootstrap.js +1 -1
- package/dist/esm/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/next-logo.js +3 -5
- package/dist/esm/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/next-logo.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/ui/components/errors/error-overlay-nav/error-overlay-nav.js +1 -1
- package/dist/esm/client/components/react-dev-overlay/ui/components/errors/error-overlay-nav/error-overlay-nav.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/ui/styles/base.js +1 -1
- package/dist/esm/client/components/react-dev-overlay/ui/styles/base.js.map +1 -1
- package/dist/esm/client/index.js +1 -1
- package/dist/esm/server/dev/hot-reloader-turbopack.js +1 -1
- package/dist/esm/server/dev/hot-reloader-webpack.js +1 -1
- package/dist/esm/server/lib/app-info-log.js +1 -1
- package/dist/esm/server/lib/start-server.js +1 -1
- package/dist/esm/shared/lib/canary-only.js +1 -1
- package/dist/esm/shared/lib/get-img-props.js +11 -1
- package/dist/esm/shared/lib/get-img-props.js.map +1 -1
- package/dist/esm/shared/lib/turbopack/manifest-loader.js +24 -14
- package/dist/esm/shared/lib/turbopack/manifest-loader.js.map +1 -1
- package/dist/server/dev/hot-reloader-turbopack.js +1 -1
- package/dist/server/dev/hot-reloader-webpack.js +1 -1
- package/dist/server/lib/app-info-log.js +1 -1
- package/dist/server/lib/start-server.js +1 -1
- package/dist/shared/lib/canary-only.js +1 -1
- package/dist/shared/lib/get-img-props.d.ts +2 -1
- package/dist/shared/lib/get-img-props.js +11 -1
- package/dist/shared/lib/get-img-props.js.map +1 -1
- package/dist/shared/lib/turbopack/manifest-loader.d.ts +4 -1
- package/dist/shared/lib/turbopack/manifest-loader.js +24 -14
- package/dist/shared/lib/turbopack/manifest-loader.js.map +1 -1
- package/dist/telemetry/anonymous-meta.js +1 -1
- package/dist/telemetry/events/build.d.ts +2 -1
- package/dist/telemetry/events/build.js +2 -1
- package/dist/telemetry/events/build.js.map +1 -1
- package/dist/telemetry/events/session-stopped.d.ts +2 -1
- package/dist/telemetry/events/session-stopped.js +4 -3
- package/dist/telemetry/events/session-stopped.js.map +1 -1
- package/dist/telemetry/events/version.d.ts +2 -1
- package/dist/telemetry/events/version.js +3 -2
- package/dist/telemetry/events/version.js.map +1 -1
- package/package.json +15 -15
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/build/swc/index.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-use-before-define */\nimport path from 'path'\nimport { pathToFileURL } from 'url'\nimport { arch, platform } from 'os'\nimport { platformArchTriples } from 'next/dist/compiled/@napi-rs/triples'\nimport * as Log from '../output/log'\nimport { getParserOptions } from './options'\nimport { eventSwcLoadFailure } from '../../telemetry/events/swc-load-failure'\nimport { patchIncorrectLockfile } from '../../lib/patch-incorrect-lockfile'\nimport { downloadNativeNextSwc, downloadWasmSwc } from '../../lib/download-swc'\nimport type {\n NextConfigComplete,\n TurboLoaderItem,\n TurboRuleConfigItem,\n TurboRuleConfigItemOptions,\n TurboRuleConfigItemOrShortcut,\n} from '../../server/config-shared'\nimport { isDeepStrictEqual } from 'util'\nimport {\n type DefineEnvPluginOptions,\n getDefineEnv,\n} from '../webpack/plugins/define-env-plugin'\nimport { getReactCompilerLoader } from '../get-babel-loader-config'\nimport type {\n NapiPartialProjectOptions,\n NapiProjectOptions,\n} from './generated-native'\nimport type {\n Binding,\n DefineEnv,\n Endpoint,\n HmrIdentifiers,\n Project,\n ProjectOptions,\n Route,\n TurboEngineOptions,\n TurbopackResult,\n TurbopackStackFrame,\n Update,\n UpdateMessage,\n WrittenEndpoint,\n} from './types'\nimport { TurbopackInternalError } from '../../shared/lib/turbopack/utils'\n\ntype RawBindings = typeof import('./generated-native')\ntype RawWasmBindings = typeof import('./generated-wasm') & {\n default?(): Promise<typeof import('./generated-wasm')>\n}\n\nconst nextVersion = process.env.__NEXT_VERSION as string\n\nconst ArchName = arch()\nconst PlatformName = platform()\n\nfunction infoLog(...args: any[]) {\n if (process.env.NEXT_PRIVATE_BUILD_WORKER) {\n return\n }\n if (process.env.DEBUG) {\n Log.info(...args)\n }\n}\n\n/**\n * Based on napi-rs's target triples, returns triples that have corresponding next-swc binaries.\n */\nexport function getSupportedArchTriples(): Record<string, any> {\n const { darwin, win32, linux, freebsd, android } = platformArchTriples\n\n return {\n darwin,\n win32: {\n arm64: win32.arm64,\n ia32: win32.ia32.filter((triple) => triple.abi === 'msvc'),\n x64: win32.x64.filter((triple) => triple.abi === 'msvc'),\n },\n linux: {\n // linux[x64] includes `gnux32` abi, with x64 arch.\n x64: linux.x64.filter((triple) => triple.abi !== 'gnux32'),\n arm64: linux.arm64,\n // This target is being deprecated, however we keep it in `knownDefaultWasmFallbackTriples` for now\n arm: linux.arm,\n },\n // Below targets are being deprecated, however we keep it in `knownDefaultWasmFallbackTriples` for now\n freebsd: {\n x64: freebsd.x64,\n },\n android: {\n arm64: android.arm64,\n arm: android.arm,\n },\n }\n}\n\nconst triples = (() => {\n const supportedArchTriples = getSupportedArchTriples()\n const targetTriple = supportedArchTriples[PlatformName]?.[ArchName]\n\n // If we have supported triple, return it right away\n if (targetTriple) {\n return targetTriple\n }\n\n // If there isn't corresponding target triple in `supportedArchTriples`, check if it's excluded from original raw triples\n // Otherwise, it is completely unsupported platforms.\n let rawTargetTriple = platformArchTriples[PlatformName]?.[ArchName]\n\n if (rawTargetTriple) {\n Log.warn(\n `Trying to load next-swc for target triple ${rawTargetTriple}, but there next-swc does not have native bindings support`\n )\n } else {\n Log.warn(\n `Trying to load next-swc for unsupported platforms ${PlatformName}/${ArchName}`\n )\n }\n\n return []\n})()\n\n// Allow to specify an absolute path to the custom turbopack binary to load.\n// If one of env variables is set, `loadNative` will try to use specified\n// binary instead. This is thin, naive interface\n// - `loadBindings` will not validate neither path nor the binary.\n//\n// Note these are internal flag: there's no stability, feature guarantee.\nconst __INTERNAL_CUSTOM_TURBOPACK_BINDINGS =\n process.env.__INTERNAL_CUSTOM_TURBOPACK_BINDINGS\n\nfunction checkVersionMismatch(pkgData: any) {\n const version = pkgData.version\n\n if (version && version !== nextVersion) {\n Log.warn(\n `Mismatching @next/swc version, detected: ${version} while Next.js is on ${nextVersion}. Please ensure these match`\n )\n }\n}\n\n// These are the platforms we'll try to load wasm bindings first,\n// only try to load native bindings if loading wasm binding somehow fails.\n// Fallback to native binding is for migration period only,\n// once we can verify loading-wasm-first won't cause visible regressions,\n// we'll not include native bindings for these platform at all.\nconst knownDefaultWasmFallbackTriples = [\n 'x86_64-unknown-freebsd',\n 'aarch64-linux-android',\n 'arm-linux-androideabi',\n 'armv7-unknown-linux-gnueabihf',\n 'i686-pc-windows-msvc',\n // WOA targets are TBD, while current userbase is small we may support it in the future\n //'aarch64-pc-windows-msvc',\n]\n\n// The last attempt's error code returned when cjs require to native bindings fails.\n// If node.js throws an error without error code, this should be `unknown` instead of undefined.\n// For the wasm-first targets (`knownDefaultWasmFallbackTriples`) this will be `unsupported_target`.\nlet lastNativeBindingsLoadErrorCode:\n | 'unknown'\n | 'unsupported_target'\n | string\n | undefined = undefined\nlet nativeBindings: Binding\nlet wasmBindings: Binding\nlet downloadWasmPromise: any\nlet pendingBindings: any\nlet swcTraceFlushGuard: any\nlet downloadNativeBindingsPromise: Promise<void> | undefined = undefined\n\nexport const lockfilePatchPromise: { cur?: Promise<void> } = {}\n\nexport async function loadBindings(\n useWasmBinary: boolean = false\n): Promise<Binding> {\n // Increase Rust stack size as some npm packages being compiled need more than the default.\n if (!process.env.RUST_MIN_STACK) {\n process.env.RUST_MIN_STACK = '8388608'\n }\n\n if (pendingBindings) {\n return pendingBindings\n }\n\n // rust needs stdout to be blocking, otherwise it will throw an error (on macOS at least) when writing a lot of data (logs) to it\n // see https://github.com/napi-rs/napi-rs/issues/1630\n // and https://github.com/nodejs/node/blob/main/doc/api/process.md#a-note-on-process-io\n if (process.stdout._handle != null) {\n // @ts-ignore\n process.stdout._handle.setBlocking?.(true)\n }\n if (process.stderr._handle != null) {\n // @ts-ignore\n process.stderr._handle.setBlocking?.(true)\n }\n\n pendingBindings = new Promise(async (resolve, _reject) => {\n if (!lockfilePatchPromise.cur) {\n // always run lockfile check once so that it gets patched\n // even if it doesn't fail to load locally\n lockfilePatchPromise.cur = patchIncorrectLockfile(process.cwd()).catch(\n console.error\n )\n }\n\n let attempts: any[] = []\n const disableWasmFallback = process.env.NEXT_DISABLE_SWC_WASM\n const unsupportedPlatform = triples.some(\n (triple: any) =>\n !!triple?.raw && knownDefaultWasmFallbackTriples.includes(triple.raw)\n )\n const isWebContainer = process.versions.webcontainer\n // Normal execution relies on the param `useWasmBinary` flag to load, but\n // in certain cases where there isn't a native binary we always load wasm fallback first.\n const shouldLoadWasmFallbackFirst =\n (!disableWasmFallback && useWasmBinary) ||\n unsupportedPlatform ||\n isWebContainer\n\n if (!unsupportedPlatform && useWasmBinary) {\n Log.warn(\n `experimental.useWasmBinary is not an option for supported platform ${PlatformName}/${ArchName} and will be ignored.`\n )\n }\n\n if (shouldLoadWasmFallbackFirst) {\n lastNativeBindingsLoadErrorCode = 'unsupported_target'\n const fallbackBindings = await tryLoadWasmWithFallback(attempts)\n if (fallbackBindings) {\n return resolve(fallbackBindings)\n }\n }\n\n // Trickle down loading `fallback` bindings:\n //\n // - First, try to load native bindings installed in node_modules.\n // - If that fails with `ERR_MODULE_NOT_FOUND`, treat it as case of https://github.com/npm/cli/issues/4828\n // that host system where generated package lock is not matching to the guest system running on, try to manually\n // download corresponding target triple and load it. This won't be triggered if native bindings are failed to load\n // with other reasons than `ERR_MODULE_NOT_FOUND`.\n // - Lastly, falls back to wasm binding where possible.\n try {\n return resolve(loadNative())\n } catch (a) {\n if (\n Array.isArray(a) &&\n a.every((m) => m.includes('it was not installed'))\n ) {\n let fallbackBindings = await tryLoadNativeWithFallback(attempts)\n\n if (fallbackBindings) {\n return resolve(fallbackBindings)\n }\n }\n\n attempts = attempts.concat(a)\n }\n\n // For these platforms we already tried to load wasm and failed, skip reattempt\n if (!shouldLoadWasmFallbackFirst && !disableWasmFallback) {\n const fallbackBindings = await tryLoadWasmWithFallback(attempts)\n if (fallbackBindings) {\n return resolve(fallbackBindings)\n }\n }\n\n logLoadFailure(attempts, true)\n })\n return pendingBindings\n}\n\nasync function tryLoadNativeWithFallback(attempts: Array<string>) {\n const nativeBindingsDirectory = path.join(\n path.dirname(require.resolve('next/package.json')),\n 'next-swc-fallback'\n )\n\n if (!downloadNativeBindingsPromise) {\n downloadNativeBindingsPromise = downloadNativeNextSwc(\n nextVersion,\n nativeBindingsDirectory,\n triples.map((triple: any) => triple.platformArchABI)\n )\n }\n await downloadNativeBindingsPromise\n\n try {\n return loadNative(nativeBindingsDirectory)\n } catch (a: any) {\n attempts.push(...[].concat(a))\n }\n\n return undefined\n}\n\nasync function tryLoadWasmWithFallback(attempts: any[]) {\n try {\n let bindings = await loadWasm('')\n // @ts-expect-error TODO: this event has a wrong type.\n eventSwcLoadFailure({\n wasm: 'enabled',\n nativeBindingsErrorCode: lastNativeBindingsLoadErrorCode,\n })\n return bindings\n } catch (a: any) {\n attempts.push(...[].concat(a))\n }\n\n try {\n // if not installed already download wasm package on-demand\n // we download to a custom directory instead of to node_modules\n // as node_module import attempts are cached and can't be re-attempted\n // x-ref: https://github.com/nodejs/modules/issues/307\n const wasmDirectory = path.join(\n path.dirname(require.resolve('next/package.json')),\n 'wasm'\n )\n if (!downloadWasmPromise) {\n downloadWasmPromise = downloadWasmSwc(nextVersion, wasmDirectory)\n }\n await downloadWasmPromise\n let bindings = await loadWasm(wasmDirectory)\n // @ts-expect-error TODO: this event has a wrong type.\n eventSwcLoadFailure({\n wasm: 'fallback',\n nativeBindingsErrorCode: lastNativeBindingsLoadErrorCode,\n })\n\n // still log native load attempts so user is\n // aware it failed and should be fixed\n for (const attempt of attempts) {\n Log.warn(attempt)\n }\n return bindings\n } catch (a: any) {\n attempts.push(...[].concat(a))\n }\n}\n\nfunction loadBindingsSync() {\n let attempts: any[] = []\n try {\n return loadNative()\n } catch (a) {\n attempts = attempts.concat(a)\n }\n\n // we can leverage the wasm bindings if they are already\n // loaded\n if (wasmBindings) {\n return wasmBindings\n }\n\n logLoadFailure(attempts)\n throw new Error('Failed to load bindings', { cause: attempts })\n}\n\nlet loggingLoadFailure = false\n\nfunction logLoadFailure(attempts: any, triedWasm = false) {\n // make sure we only emit the event and log the failure once\n if (loggingLoadFailure) return\n loggingLoadFailure = true\n\n for (let attempt of attempts) {\n Log.warn(attempt)\n }\n\n // @ts-expect-error TODO: this event has a wrong type.\n eventSwcLoadFailure({\n wasm: triedWasm ? 'failed' : undefined,\n nativeBindingsErrorCode: lastNativeBindingsLoadErrorCode,\n })\n .then(() => lockfilePatchPromise.cur || Promise.resolve())\n .finally(() => {\n Log.error(\n `Failed to load SWC binary for ${PlatformName}/${ArchName}, see more info here: https://nextjs.org/docs/messages/failed-loading-swc`\n )\n process.exit(1)\n })\n}\n\ntype RustifiedEnv = { name: string; value: string }[]\n\nexport function createDefineEnv({\n isTurbopack,\n clientRouterFilters,\n config,\n dev,\n distDir,\n fetchCacheKeyPrefix,\n hasRewrites,\n middlewareMatchers,\n}: Omit<\n DefineEnvPluginOptions,\n 'isClient' | 'isNodeOrEdgeCompilation' | 'isEdgeServer' | 'isNodeServer'\n>): DefineEnv {\n let defineEnv: DefineEnv = {\n client: [],\n edge: [],\n nodejs: [],\n }\n\n for (const variant of Object.keys(defineEnv) as (keyof typeof defineEnv)[]) {\n defineEnv[variant] = rustifyEnv(\n getDefineEnv({\n isTurbopack,\n clientRouterFilters,\n config,\n dev,\n distDir,\n fetchCacheKeyPrefix,\n hasRewrites,\n isClient: variant === 'client',\n isEdgeServer: variant === 'edge',\n isNodeOrEdgeCompilation: variant === 'nodejs' || variant === 'edge',\n isNodeServer: variant === 'nodejs',\n middlewareMatchers,\n })\n )\n }\n\n return defineEnv\n}\n\nfunction rustifyEnv(env: Record<string, string>): RustifiedEnv {\n return Object.entries(env)\n .filter(([_, value]) => value != null)\n .map(([name, value]) => ({\n name,\n value,\n }))\n}\n\n// TODO(sokra) Support wasm option.\nfunction bindingToApi(\n binding: RawBindings,\n _wasm: boolean\n): Binding['turbo']['createProject'] {\n type NativeFunction<T> = (\n callback: (err: Error, value: T) => void\n ) => Promise<{ __napiType: 'RootTask' }>\n\n const cancel = new (class Cancel extends Error {})()\n\n /**\n * Utility function to ensure all variants of an enum are handled.\n */\n function invariant(\n never: never,\n computeMessage: (arg: any) => string\n ): never {\n throw new Error(`Invariant: ${computeMessage(never)}`)\n }\n\n async function withErrorCause<T>(fn: () => Promise<T>): Promise<T> {\n try {\n return await fn()\n } catch (nativeError: any) {\n throw new TurbopackInternalError(nativeError)\n }\n }\n\n /**\n * Calls a native function and streams the result.\n * If useBuffer is true, all values will be preserved, potentially buffered\n * if consumed slower than produced. Else, only the latest value will be\n * preserved.\n */\n function subscribe<T>(\n useBuffer: boolean,\n nativeFunction:\n | NativeFunction<T>\n | ((callback: (err: Error, value: T) => void) => Promise<void>)\n ): AsyncIterableIterator<T> {\n type BufferItem =\n | { err: Error; value: undefined }\n | { err: undefined; value: T }\n // A buffer of produced items. This will only contain values if the\n // consumer is slower than the producer.\n let buffer: BufferItem[] = []\n // A deferred value waiting for the next produced item. This will only\n // exist if the consumer is faster than the producer.\n let waiting:\n | {\n resolve: (value: T) => void\n reject: (error: Error) => void\n }\n | undefined\n let canceled = false\n\n // The native function will call this every time it emits a new result. We\n // either need to notify a waiting consumer, or buffer the new result until\n // the consumer catches up.\n function emitResult(err: Error | undefined, value: T | undefined) {\n if (waiting) {\n let { resolve, reject } = waiting\n waiting = undefined\n if (err) reject(err)\n else resolve(value!)\n } else {\n const item = { err, value } as BufferItem\n if (useBuffer) buffer.push(item)\n else buffer[0] = item\n }\n }\n\n async function* createIterator() {\n const task = await withErrorCause<{ __napiType: 'RootTask' } | void>(() =>\n nativeFunction(emitResult)\n )\n try {\n while (!canceled) {\n if (buffer.length > 0) {\n const item = buffer.shift()!\n if (item.err) throw item.err\n yield item.value\n } else {\n // eslint-disable-next-line no-loop-func\n yield new Promise<T>((resolve, reject) => {\n waiting = { resolve, reject }\n })\n }\n }\n } catch (e) {\n if (e === cancel) return\n if (e instanceof Error) {\n throw new TurbopackInternalError(e)\n }\n throw e\n } finally {\n if (task) {\n binding.rootTaskDispose(task)\n }\n }\n }\n\n const iterator = createIterator()\n iterator.return = async () => {\n canceled = true\n if (waiting) waiting.reject(cancel)\n return { value: undefined, done: true } as IteratorReturnResult<never>\n }\n return iterator\n }\n\n async function rustifyProjectOptions(\n options: ProjectOptions\n ): Promise<NapiProjectOptions> {\n return {\n ...options,\n nextConfig: await serializeNextConfig(\n options.nextConfig,\n options.projectPath!\n ),\n jsConfig: JSON.stringify(options.jsConfig),\n env: rustifyEnv(options.env),\n }\n }\n\n async function rustifyPartialProjectOptions(\n options: Partial<ProjectOptions>\n ): Promise<NapiPartialProjectOptions> {\n return {\n ...options,\n nextConfig:\n options.nextConfig &&\n (await serializeNextConfig(options.nextConfig, options.projectPath!)),\n jsConfig: options.jsConfig && JSON.stringify(options.jsConfig),\n env: options.env && rustifyEnv(options.env),\n }\n }\n\n class ProjectImpl implements Project {\n private readonly _nativeProject: { __napiType: 'Project' }\n\n constructor(nativeProject: { __napiType: 'Project' }) {\n this._nativeProject = nativeProject\n }\n\n async update(options: Partial<ProjectOptions>) {\n await withErrorCause(async () =>\n binding.projectUpdate(\n this._nativeProject,\n await rustifyPartialProjectOptions(options)\n )\n )\n }\n\n entrypointsSubscribe() {\n type NapiEndpoint = { __napiType: 'Endpoint' }\n\n type NapiEntrypoints = {\n routes: NapiRoute[]\n middleware?: NapiMiddleware\n instrumentation?: NapiInstrumentation\n pagesDocumentEndpoint: NapiEndpoint\n pagesAppEndpoint: NapiEndpoint\n pagesErrorEndpoint: NapiEndpoint\n }\n\n type NapiMiddleware = {\n endpoint: NapiEndpoint\n runtime: 'nodejs' | 'edge'\n matcher?: string[]\n }\n\n type NapiInstrumentation = {\n nodeJs: NapiEndpoint\n edge: NapiEndpoint\n }\n\n type NapiRoute = {\n pathname: string\n } & (\n | {\n type: 'page'\n htmlEndpoint: NapiEndpoint\n dataEndpoint: NapiEndpoint\n }\n | {\n type: 'page-api'\n endpoint: NapiEndpoint\n }\n | {\n type: 'app-page'\n pages: {\n originalName: string\n htmlEndpoint: NapiEndpoint\n rscEndpoint: NapiEndpoint\n }[]\n }\n | {\n type: 'app-route'\n originalName: string\n endpoint: NapiEndpoint\n }\n | {\n type: 'conflict'\n }\n )\n\n const subscription = subscribe<TurbopackResult<NapiEntrypoints>>(\n false,\n async (callback) =>\n binding.projectEntrypointsSubscribe(this._nativeProject, callback)\n )\n return (async function* () {\n for await (const entrypoints of subscription) {\n const routes = new Map()\n for (const { pathname, ...nativeRoute } of entrypoints.routes) {\n let route: Route\n const routeType = nativeRoute.type\n switch (routeType) {\n case 'page':\n route = {\n type: 'page',\n htmlEndpoint: new EndpointImpl(nativeRoute.htmlEndpoint),\n dataEndpoint: new EndpointImpl(nativeRoute.dataEndpoint),\n }\n break\n case 'page-api':\n route = {\n type: 'page-api',\n endpoint: new EndpointImpl(nativeRoute.endpoint),\n }\n break\n case 'app-page':\n route = {\n type: 'app-page',\n pages: nativeRoute.pages.map((page) => ({\n originalName: page.originalName,\n htmlEndpoint: new EndpointImpl(page.htmlEndpoint),\n rscEndpoint: new EndpointImpl(page.rscEndpoint),\n })),\n }\n break\n case 'app-route':\n route = {\n type: 'app-route',\n originalName: nativeRoute.originalName,\n endpoint: new EndpointImpl(nativeRoute.endpoint),\n }\n break\n case 'conflict':\n route = {\n type: 'conflict',\n }\n break\n default:\n const _exhaustiveCheck: never = routeType\n invariant(\n nativeRoute,\n () => `Unknown route type: ${_exhaustiveCheck}`\n )\n }\n routes.set(pathname, route)\n }\n const napiMiddlewareToMiddleware = (middleware: NapiMiddleware) => ({\n endpoint: new EndpointImpl(middleware.endpoint),\n runtime: middleware.runtime,\n matcher: middleware.matcher,\n })\n const middleware = entrypoints.middleware\n ? napiMiddlewareToMiddleware(entrypoints.middleware)\n : undefined\n const napiInstrumentationToInstrumentation = (\n instrumentation: NapiInstrumentation\n ) => ({\n nodeJs: new EndpointImpl(instrumentation.nodeJs),\n edge: new EndpointImpl(instrumentation.edge),\n })\n const instrumentation = entrypoints.instrumentation\n ? napiInstrumentationToInstrumentation(entrypoints.instrumentation)\n : undefined\n yield {\n routes,\n middleware,\n instrumentation,\n pagesDocumentEndpoint: new EndpointImpl(\n entrypoints.pagesDocumentEndpoint\n ),\n pagesAppEndpoint: new EndpointImpl(entrypoints.pagesAppEndpoint),\n pagesErrorEndpoint: new EndpointImpl(\n entrypoints.pagesErrorEndpoint\n ),\n issues: entrypoints.issues,\n diagnostics: entrypoints.diagnostics,\n }\n }\n })()\n }\n\n hmrEvents(identifier: string) {\n return subscribe<TurbopackResult<Update>>(true, async (callback) =>\n binding.projectHmrEvents(this._nativeProject, identifier, callback)\n )\n }\n\n hmrIdentifiersSubscribe() {\n return subscribe<TurbopackResult<HmrIdentifiers>>(\n false,\n async (callback) =>\n binding.projectHmrIdentifiersSubscribe(this._nativeProject, callback)\n )\n }\n\n traceSource(\n stackFrame: TurbopackStackFrame,\n currentDirectoryFileUrl: string\n ): Promise<TurbopackStackFrame | null> {\n return binding.projectTraceSource(\n this._nativeProject,\n stackFrame,\n currentDirectoryFileUrl\n )\n }\n\n getSourceForAsset(filePath: string): Promise<string | null> {\n return binding.projectGetSourceForAsset(this._nativeProject, filePath)\n }\n\n getSourceMap(filePath: string): Promise<string | null> {\n return binding.projectGetSourceMap(this._nativeProject, filePath)\n }\n\n getSourceMapSync(filePath: string): string | null {\n return binding.projectGetSourceMapSync(this._nativeProject, filePath)\n }\n\n updateInfoSubscribe(aggregationMs: number) {\n return subscribe<TurbopackResult<UpdateMessage>>(true, async (callback) =>\n binding.projectUpdateInfoSubscribe(\n this._nativeProject,\n aggregationMs,\n callback\n )\n )\n }\n\n shutdown(): Promise<void> {\n return binding.projectShutdown(this._nativeProject)\n }\n\n onExit(): Promise<void> {\n return binding.projectOnExit(this._nativeProject)\n }\n }\n\n class EndpointImpl implements Endpoint {\n private readonly _nativeEndpoint: { __napiType: 'Endpoint' }\n\n constructor(nativeEndpoint: { __napiType: 'Endpoint' }) {\n this._nativeEndpoint = nativeEndpoint\n }\n\n async writeToDisk(): Promise<TurbopackResult<WrittenEndpoint>> {\n return await withErrorCause(\n () =>\n binding.endpointWriteToDisk(this._nativeEndpoint) as Promise<\n TurbopackResult<WrittenEndpoint>\n >\n )\n }\n\n async clientChanged(): Promise<AsyncIterableIterator<TurbopackResult<{}>>> {\n const clientSubscription = subscribe<TurbopackResult>(\n false,\n async (callback) =>\n binding.endpointClientChangedSubscribe(\n await this._nativeEndpoint,\n callback\n )\n )\n await clientSubscription.next()\n return clientSubscription\n }\n\n async serverChanged(\n includeIssues: boolean\n ): Promise<AsyncIterableIterator<TurbopackResult<{}>>> {\n const serverSubscription = subscribe<TurbopackResult>(\n false,\n async (callback) =>\n binding.endpointServerChangedSubscribe(\n await this._nativeEndpoint,\n includeIssues,\n callback\n )\n )\n await serverSubscription.next()\n return serverSubscription\n }\n }\n\n /**\n * Returns a new copy of next.js config object to avoid mutating the original.\n *\n * Also it does some augmentation to the configuration as well, for example set the\n * turbopack's rules if `experimental.reactCompilerOptions` is set.\n */\n function augmentNextConfig(\n originalNextConfig: NextConfigComplete,\n projectPath: string\n ): Record<string, any> {\n let nextConfig = { ...(originalNextConfig as any) }\n\n const reactCompilerOptions = nextConfig.experimental?.reactCompiler\n\n // It is not easy to set the rules inside of rust as resolving, and passing the context identical to the webpack\n // config is bit hard, also we can reuse same codes between webpack config in here.\n if (reactCompilerOptions) {\n const ruleKeys = ['*.ts', '*.js', '*.jsx', '*.tsx']\n if (\n Object.keys(nextConfig?.experimental?.turbo?.rules ?? []).some((key) =>\n ruleKeys.includes(key)\n )\n ) {\n Log.warn(\n `The React Compiler cannot be enabled automatically because 'experimental.turbo' contains a rule for '*.ts', '*.js', '*.jsx', and '*.tsx'. Remove this rule, or add 'babel-loader' and 'babel-plugin-react-compiler' to the Turbopack configuration manually.`\n )\n } else {\n if (!nextConfig.experimental.turbo) {\n nextConfig.experimental.turbo = {}\n }\n\n if (!nextConfig.experimental.turbo.rules) {\n nextConfig.experimental.turbo.rules = {}\n }\n\n for (const key of ['*.ts', '*.js', '*.jsx', '*.tsx']) {\n nextConfig.experimental.turbo.rules[key] = {\n browser: {\n foreign: false,\n loaders: [\n getReactCompilerLoader(\n originalNextConfig.experimental.reactCompiler,\n projectPath,\n nextConfig.dev,\n false,\n undefined\n ),\n ],\n },\n }\n }\n }\n }\n\n return nextConfig\n }\n\n async function serializeNextConfig(\n nextConfig: NextConfigComplete,\n projectPath: string\n ): Promise<string> {\n // Avoid mutating the existing `nextConfig` object.\n let nextConfigSerializable = augmentNextConfig(nextConfig, projectPath)\n\n nextConfigSerializable.generateBuildId =\n await nextConfig.generateBuildId?.()\n\n // TODO: these functions takes arguments, have to be supported in a different way\n nextConfigSerializable.exportPathMap = {}\n nextConfigSerializable.webpack = nextConfig.webpack && {}\n\n if (nextConfigSerializable.experimental?.turbo?.rules) {\n ensureLoadersHaveSerializableOptions(\n nextConfigSerializable.experimental.turbo?.rules\n )\n }\n\n nextConfigSerializable.modularizeImports =\n nextConfigSerializable.modularizeImports\n ? Object.fromEntries(\n Object.entries<any>(nextConfigSerializable.modularizeImports).map(\n ([mod, config]) => [\n mod,\n {\n ...config,\n transform:\n typeof config.transform === 'string'\n ? config.transform\n : Object.entries(config.transform).map(([key, value]) => [\n key,\n value,\n ]),\n },\n ]\n )\n )\n : undefined\n\n // loaderFile is an absolute path, we need it to be relative for turbopack.\n if (nextConfigSerializable.images.loaderFile) {\n nextConfigSerializable.images = {\n ...nextConfig.images,\n loaderFile:\n './' + path.relative(projectPath, nextConfig.images.loaderFile),\n }\n }\n\n return JSON.stringify(nextConfigSerializable, null, 2)\n }\n\n function ensureLoadersHaveSerializableOptions(\n turbopackRules: Record<string, TurboRuleConfigItemOrShortcut>\n ) {\n for (const [glob, rule] of Object.entries(turbopackRules)) {\n if (Array.isArray(rule)) {\n checkLoaderItems(rule, glob)\n } else {\n checkConfigItem(rule, glob)\n }\n }\n\n function checkConfigItem(rule: TurboRuleConfigItem, glob: string) {\n if (!rule) return\n if ('loaders' in rule) {\n checkLoaderItems((rule as TurboRuleConfigItemOptions).loaders, glob)\n } else {\n for (const key in rule) {\n const inner = rule[key]\n if (typeof inner === 'object' && inner) {\n checkConfigItem(inner, glob)\n }\n }\n }\n }\n\n function checkLoaderItems(loaderItems: TurboLoaderItem[], glob: string) {\n for (const loaderItem of loaderItems) {\n if (\n typeof loaderItem !== 'string' &&\n !isDeepStrictEqual(loaderItem, JSON.parse(JSON.stringify(loaderItem)))\n ) {\n throw new Error(\n `loader ${loaderItem.loader} for match \"${glob}\" does not have serializable options. Ensure that options passed are plain JavaScript objects and values.`\n )\n }\n }\n }\n }\n\n return async function createProject(\n options: ProjectOptions,\n turboEngineOptions\n ) {\n return new ProjectImpl(\n await binding.projectNew(\n await rustifyProjectOptions(options),\n turboEngineOptions || {}\n )\n )\n }\n}\n\nasync function loadWasm(importPath = '') {\n if (wasmBindings) {\n return wasmBindings\n }\n\n let attempts = []\n for (let pkg of ['@next/swc-wasm-nodejs', '@next/swc-wasm-web']) {\n try {\n let pkgPath = pkg\n\n if (importPath) {\n // the import path must be exact when not in node_modules\n pkgPath = path.join(importPath, pkg, 'wasm.js')\n }\n let bindings: RawWasmBindings = await import(\n pathToFileURL(pkgPath).toString()\n )\n if (pkg === '@next/swc-wasm-web') {\n bindings = await bindings.default!()\n }\n infoLog('next-swc build: wasm build @next/swc-wasm-web')\n\n // Note wasm binary does not support async intefaces yet, all async\n // interface coereces to sync interfaces.\n wasmBindings = {\n css: {\n lightning: {\n transform: function (_options: any) {\n throw new Error(\n '`css.lightning.transform` is not supported by the wasm bindings.'\n )\n },\n transformStyleAttr: function (_options: any) {\n throw new Error(\n '`css.lightning.transformStyleAttr` is not supported by the wasm bindings.'\n )\n },\n },\n },\n isWasm: true,\n transform(src: string, options: any) {\n // TODO: we can remove fallback to sync interface once new stable version of next-swc gets published (current v12.2)\n return bindings?.transform\n ? bindings.transform(src.toString(), options)\n : Promise.resolve(bindings.transformSync(src.toString(), options))\n },\n transformSync(src: string, options: any) {\n return bindings.transformSync(src.toString(), options)\n },\n minify(src: string, options: any) {\n return bindings?.minify\n ? bindings.minify(src.toString(), options)\n : Promise.resolve(bindings.minifySync(src.toString(), options))\n },\n minifySync(src: string, options: any) {\n return bindings.minifySync(src.toString(), options)\n },\n parse(src: string, options: any) {\n return bindings?.parse\n ? bindings.parse(src.toString(), options)\n : Promise.resolve(bindings.parseSync(src.toString(), options))\n },\n getTargetTriple() {\n return undefined\n },\n turbo: {\n createProject: function (\n _options: ProjectOptions,\n _turboEngineOptions?: TurboEngineOptions | undefined\n ): Promise<Project> {\n throw new Error(\n '`turbo.createProject` is not supported by the wasm bindings.'\n )\n },\n startTurbopackTraceServer: function (_traceFilePath: string): void {\n throw new Error(\n '`turbo.startTurbopackTraceServer` is not supported by the wasm bindings.'\n )\n },\n },\n mdx: {\n compile(src: string, options: any) {\n return bindings.mdxCompile(src, getMdxOptions(options))\n },\n compileSync(src: string, options: any) {\n return bindings.mdxCompileSync(src, getMdxOptions(options))\n },\n },\n }\n return wasmBindings\n } catch (e: any) {\n // Only log attempts for loading wasm when loading as fallback\n if (importPath) {\n if (e?.code === 'ERR_MODULE_NOT_FOUND') {\n attempts.push(`Attempted to load ${pkg}, but it was not installed`)\n } else {\n attempts.push(\n `Attempted to load ${pkg}, but an error occurred: ${e.message ?? e}`\n )\n }\n }\n }\n }\n\n throw attempts\n}\n\nfunction loadNative(importPath?: string) {\n if (nativeBindings) {\n return nativeBindings\n }\n\n const customBindings: RawBindings = !!__INTERNAL_CUSTOM_TURBOPACK_BINDINGS\n ? require(__INTERNAL_CUSTOM_TURBOPACK_BINDINGS)\n : null\n let bindings: RawBindings = customBindings\n let attempts: any[] = []\n\n const NEXT_TEST_NATIVE_DIR = process.env.NEXT_TEST_NATIVE_DIR\n for (const triple of triples) {\n if (NEXT_TEST_NATIVE_DIR) {\n try {\n // Use the binary directly to skip `pnpm pack` for testing as it's slow because of the large native binary.\n bindings = require(\n `${NEXT_TEST_NATIVE_DIR}/next-swc.${triple.platformArchABI}.node`\n )\n infoLog(\n 'next-swc build: local built @next/swc from NEXT_TEST_NATIVE_DIR'\n )\n break\n } catch (e) {}\n } else {\n try {\n bindings = require(\n `@next/swc/native/next-swc.${triple.platformArchABI}.node`\n )\n infoLog('next-swc build: local built @next/swc')\n break\n } catch (e) {}\n }\n }\n\n if (!bindings) {\n for (const triple of triples) {\n let pkg = importPath\n ? path.join(\n importPath,\n `@next/swc-${triple.platformArchABI}`,\n `next-swc.${triple.platformArchABI}.node`\n )\n : `@next/swc-${triple.platformArchABI}`\n try {\n bindings = require(pkg)\n if (!importPath) {\n checkVersionMismatch(require(`${pkg}/package.json`))\n }\n break\n } catch (e: any) {\n if (e?.code === 'MODULE_NOT_FOUND') {\n attempts.push(`Attempted to load ${pkg}, but it was not installed`)\n } else {\n attempts.push(\n `Attempted to load ${pkg}, but an error occurred: ${e.message ?? e}`\n )\n }\n lastNativeBindingsLoadErrorCode = e?.code ?? 'unknown'\n }\n }\n }\n\n if (bindings) {\n nativeBindings = {\n isWasm: false,\n transform(src: string, options: any) {\n const isModule =\n typeof src !== 'undefined' &&\n typeof src !== 'string' &&\n !Buffer.isBuffer(src)\n options = options || {}\n\n if (options?.jsc?.parser) {\n options.jsc.parser.syntax = options.jsc.parser.syntax ?? 'ecmascript'\n }\n\n return bindings.transform(\n isModule ? JSON.stringify(src) : src,\n isModule,\n toBuffer(options)\n )\n },\n\n transformSync(src: string, options: any) {\n if (typeof src === 'undefined') {\n throw new Error(\n \"transformSync doesn't implement reading the file from filesystem\"\n )\n } else if (Buffer.isBuffer(src)) {\n throw new Error(\n \"transformSync doesn't implement taking the source code as Buffer\"\n )\n }\n const isModule = typeof src !== 'string'\n options = options || {}\n\n if (options?.jsc?.parser) {\n options.jsc.parser.syntax = options.jsc.parser.syntax ?? 'ecmascript'\n }\n\n return bindings.transformSync(\n isModule ? JSON.stringify(src) : src,\n isModule,\n toBuffer(options)\n )\n },\n\n minify(src: string, options: any) {\n return bindings.minify(toBuffer(src), toBuffer(options ?? {}))\n },\n\n minifySync(src: string, options: any) {\n return bindings.minifySync(toBuffer(src), toBuffer(options ?? {}))\n },\n\n parse(src: string, options: any) {\n return bindings.parse(src, toBuffer(options ?? {}))\n },\n\n getTargetTriple: bindings.getTargetTriple,\n initCustomTraceSubscriber: bindings.initCustomTraceSubscriber,\n teardownTraceSubscriber: bindings.teardownTraceSubscriber,\n turbo: {\n createProject: bindingToApi(customBindings ?? bindings, false),\n startTurbopackTraceServer(traceFilePath) {\n Log.warn(\n 'Turbopack trace server started. View trace at https://turbo-trace-viewer.vercel.app/'\n )\n ;(customBindings ?? bindings).startTurbopackTraceServer(traceFilePath)\n },\n },\n mdx: {\n compile(src: string, options: any) {\n return bindings.mdxCompile(src, toBuffer(getMdxOptions(options)))\n },\n compileSync(src: string, options: any) {\n bindings.mdxCompileSync(src, toBuffer(getMdxOptions(options)))\n },\n },\n css: {\n lightning: {\n transform(transformOptions: any) {\n return bindings.lightningCssTransform(transformOptions)\n },\n transformStyleAttr(transformAttrOptions: any) {\n return bindings.lightningCssTransformStyleAttribute(\n transformAttrOptions\n )\n },\n },\n },\n }\n return nativeBindings\n }\n\n throw attempts\n}\n\n/// Build a mdx options object contains default values that\n/// can be parsed with serde_wasm_bindgen.\nfunction getMdxOptions(options: any = {}) {\n return {\n ...options,\n development: options.development ?? false,\n jsx: options.jsx ?? false,\n mdxType: options.mdxType ?? 'commonMark',\n }\n}\n\nfunction toBuffer(t: any) {\n return Buffer.from(JSON.stringify(t))\n}\n\nexport async function isWasm(): Promise<boolean> {\n let bindings = await loadBindings()\n return bindings.isWasm\n}\n\nexport async function transform(src: string, options?: any): Promise<any> {\n let bindings = await loadBindings()\n return bindings.transform(src, options)\n}\n\nexport function transformSync(src: string, options?: any): any {\n let bindings = loadBindingsSync()\n return bindings.transformSync(src, options)\n}\n\nexport async function minify(\n src: string,\n options: any\n): Promise<{ code: string; map: any }> {\n let bindings = await loadBindings()\n return bindings.minify(src, options)\n}\n\nexport async function parse(src: string, options: any): Promise<any> {\n let bindings = await loadBindings()\n let parserOptions = getParserOptions(options)\n return bindings\n .parse(src, parserOptions)\n .then((astStr: any) => JSON.parse(astStr))\n}\n\nexport function getBinaryMetadata() {\n let bindings\n try {\n bindings = loadNative()\n } catch (e) {\n // Suppress exceptions, this fn allows to fail to load native bindings\n }\n\n return {\n target: bindings?.getTargetTriple?.(),\n }\n}\n\n/**\n * Initialize trace subscriber to emit traces.\n *\n */\nexport function initCustomTraceSubscriber(traceFileName?: string) {\n if (swcTraceFlushGuard) {\n // Wasm binary doesn't support trace emission\n let bindings = loadNative()\n swcTraceFlushGuard = bindings.initCustomTraceSubscriber?.(traceFileName)\n }\n}\n\nfunction once(fn: () => void): () => void {\n let executed = false\n\n return function (): void {\n if (!executed) {\n executed = true\n\n fn()\n }\n }\n}\n\n/**\n * Teardown swc's trace subscriber if there's an initialized flush guard exists.\n *\n * This is workaround to amend behavior with process.exit\n * (https://github.com/vercel/next.js/blob/4db8c49cc31e4fc182391fae6903fb5ef4e8c66e/packages/next/bin/next.ts#L134=)\n * seems preventing napi's cleanup hook execution (https://github.com/swc-project/swc/blob/main/crates/node/src/util.rs#L48-L51=),\n *\n * instead parent process manually drops guard when process gets signal to exit.\n */\nexport const teardownTraceSubscriber = once(() => {\n try {\n let bindings = loadNative()\n if (swcTraceFlushGuard) {\n bindings.teardownTraceSubscriber?.(swcTraceFlushGuard)\n }\n } catch (e) {\n // Suppress exceptions, this fn allows to fail to load native bindings\n }\n})\n"],"names":["createDefineEnv","getBinaryMetadata","getSupportedArchTriples","initCustomTraceSubscriber","isWasm","loadBindings","lockfilePatchPromise","minify","parse","teardownTraceSubscriber","transform","transformSync","nextVersion","process","env","__NEXT_VERSION","ArchName","arch","PlatformName","platform","infoLog","args","NEXT_PRIVATE_BUILD_WORKER","DEBUG","Log","info","darwin","win32","linux","freebsd","android","platformArchTriples","arm64","ia32","filter","triple","abi","x64","arm","triples","supportedArchTriples","targetTriple","rawTargetTriple","warn","__INTERNAL_CUSTOM_TURBOPACK_BINDINGS","checkVersionMismatch","pkgData","version","knownDefaultWasmFallbackTriples","lastNativeBindingsLoadErrorCode","undefined","nativeBindings","wasmBindings","downloadWasmPromise","pendingBindings","swcTraceFlushGuard","downloadNativeBindingsPromise","useWasmBinary","RUST_MIN_STACK","stdout","_handle","setBlocking","stderr","Promise","resolve","_reject","cur","patchIncorrectLockfile","cwd","catch","console","error","attempts","disableWasmFallback","NEXT_DISABLE_SWC_WASM","unsupportedPlatform","some","raw","includes","isWebContainer","versions","webcontainer","shouldLoadWasmFallbackFirst","fallbackBindings","tryLoadWasmWithFallback","loadNative","a","Array","isArray","every","m","tryLoadNativeWithFallback","concat","logLoadFailure","nativeBindingsDirectory","path","join","dirname","require","downloadNativeNextSwc","map","platformArchABI","push","bindings","loadWasm","eventSwcLoadFailure","wasm","nativeBindingsErrorCode","wasmDirectory","downloadWasmSwc","attempt","loadBindingsSync","Error","cause","loggingLoadFailure","triedWasm","then","finally","exit","isTurbopack","clientRouterFilters","config","dev","distDir","fetchCacheKeyPrefix","hasRewrites","middlewareMatchers","defineEnv","client","edge","nodejs","variant","Object","keys","rustifyEnv","getDefineEnv","isClient","isEdgeServer","isNodeOrEdgeCompilation","isNodeServer","entries","_","value","name","bindingToApi","binding","_wasm","cancel","Cancel","invariant","never","computeMessage","withErrorCause","fn","nativeError","TurbopackInternalError","subscribe","useBuffer","nativeFunction","buffer","waiting","canceled","emitResult","err","reject","item","createIterator","task","length","shift","e","rootTaskDispose","iterator","return","done","rustifyProjectOptions","options","nextConfig","serializeNextConfig","projectPath","jsConfig","JSON","stringify","rustifyPartialProjectOptions","ProjectImpl","constructor","nativeProject","_nativeProject","update","projectUpdate","entrypointsSubscribe","subscription","callback","projectEntrypointsSubscribe","entrypoints","routes","Map","pathname","nativeRoute","route","routeType","type","htmlEndpoint","EndpointImpl","dataEndpoint","endpoint","pages","page","originalName","rscEndpoint","_exhaustiveCheck","set","napiMiddlewareToMiddleware","middleware","runtime","matcher","napiInstrumentationToInstrumentation","instrumentation","nodeJs","pagesDocumentEndpoint","pagesAppEndpoint","pagesErrorEndpoint","issues","diagnostics","hmrEvents","identifier","projectHmrEvents","hmrIdentifiersSubscribe","projectHmrIdentifiersSubscribe","traceSource","stackFrame","currentDirectoryFileUrl","projectTraceSource","getSourceForAsset","filePath","projectGetSourceForAsset","getSourceMap","projectGetSourceMap","getSourceMapSync","projectGetSourceMapSync","updateInfoSubscribe","aggregationMs","projectUpdateInfoSubscribe","shutdown","projectShutdown","onExit","projectOnExit","nativeEndpoint","_nativeEndpoint","writeToDisk","endpointWriteToDisk","clientChanged","clientSubscription","endpointClientChangedSubscribe","next","serverChanged","includeIssues","serverSubscription","endpointServerChangedSubscribe","augmentNextConfig","originalNextConfig","reactCompilerOptions","experimental","reactCompiler","ruleKeys","turbo","rules","key","browser","foreign","loaders","getReactCompilerLoader","nextConfigSerializable","generateBuildId","exportPathMap","webpack","ensureLoadersHaveSerializableOptions","modularizeImports","fromEntries","mod","images","loaderFile","relative","turbopackRules","glob","rule","checkLoaderItems","checkConfigItem","inner","loaderItems","loaderItem","isDeepStrictEqual","loader","createProject","turboEngineOptions","projectNew","importPath","pkg","pkgPath","pathToFileURL","toString","default","css","lightning","_options","transformStyleAttr","src","minifySync","parseSync","getTargetTriple","_turboEngineOptions","startTurbopackTraceServer","_traceFilePath","mdx","compile","mdxCompile","getMdxOptions","compileSync","mdxCompileSync","code","message","customBindings","NEXT_TEST_NATIVE_DIR","isModule","Buffer","isBuffer","jsc","parser","syntax","toBuffer","traceFilePath","transformOptions","lightningCssTransform","transformAttrOptions","lightningCssTransformStyleAttribute","development","jsx","mdxType","t","from","parserOptions","getParserOptions","astStr","target","traceFileName","once","executed"],"mappings":"AAAA,0DAA0D;;;;;;;;;;;;;;;;;;;;;;;;;IA+X1CA,eAAe;eAAfA;;IA65BAC,iBAAiB;eAAjBA;;IA1tCAC,uBAAuB;eAAvBA;;IA2uCAC,yBAAyB;eAAzBA;;IAhDMC,MAAM;eAANA;;IAllCAC,YAAY;eAAZA;;IAFTC,oBAAoB;eAApBA;;IAmmCSC,MAAM;eAANA;;IAQAC,KAAK;eAALA;;IAsDTC,uBAAuB;eAAvBA;;IAxESC,SAAS;eAATA;;IAKNC,aAAa;eAAbA;;;6DAtwCC;qBACa;oBACC;yBACK;6DACf;yBACY;gCACG;wCACG;6BACgB;sBAQrB;iCAI3B;sCACgC;uBAoBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOvC,MAAMC,cAAcC,QAAQC,GAAG,CAACC,cAAc;AAE9C,MAAMC,WAAWC,IAAAA,QAAI;AACrB,MAAMC,eAAeC,IAAAA,YAAQ;AAE7B,SAASC,QAAQ,GAAGC,IAAW;IAC7B,IAAIR,QAAQC,GAAG,CAACQ,yBAAyB,EAAE;QACzC;IACF;IACA,IAAIT,QAAQC,GAAG,CAACS,KAAK,EAAE;QACrBC,KAAIC,IAAI,IAAIJ;IACd;AACF;AAKO,SAASnB;IACd,MAAM,EAAEwB,MAAM,EAAEC,KAAK,EAAEC,KAAK,EAAEC,OAAO,EAAEC,OAAO,EAAE,GAAGC,4BAAmB;IAEtE,OAAO;QACLL;QACAC,OAAO;YACLK,OAAOL,MAAMK,KAAK;YAClBC,MAAMN,MAAMM,IAAI,CAACC,MAAM,CAAC,CAACC,SAAWA,OAAOC,GAAG,KAAK;YACnDC,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AAO;QACL,IAAI,CAACA,UAAU;YACbA,WAAW;YAEXjM;QACF;IACF;AACF;AAWO,MAAMhJ,0BAA0BgV,KAAK;IAC1C,IAAI;QACF,IAAIlP,WAAWlB;QACf,IAAI9B,oBAAoB;YACtBgD,SAAS9F,uBAAuB,oBAAhC8F,SAAS9F,uBAAuB,MAAhC8F,UAAmChD;QACrC;IACF,EAAE,OAAOmH,GAAG;IACV,sEAAsE;IACxE;AACF"}
|
1
|
+
{"version":3,"sources":["../../../src/build/swc/index.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-use-before-define */\nimport path from 'path'\nimport { pathToFileURL } from 'url'\nimport { arch, platform } from 'os'\nimport { platformArchTriples } from 'next/dist/compiled/@napi-rs/triples'\nimport * as Log from '../output/log'\nimport { getParserOptions } from './options'\nimport { eventSwcLoadFailure } from '../../telemetry/events/swc-load-failure'\nimport { patchIncorrectLockfile } from '../../lib/patch-incorrect-lockfile'\nimport { downloadNativeNextSwc, downloadWasmSwc } from '../../lib/download-swc'\nimport type {\n NextConfigComplete,\n TurboLoaderItem,\n TurboRuleConfigItem,\n TurboRuleConfigItemOptions,\n TurboRuleConfigItemOrShortcut,\n} from '../../server/config-shared'\nimport { isDeepStrictEqual } from 'util'\nimport {\n type DefineEnvPluginOptions,\n getDefineEnv,\n} from '../webpack/plugins/define-env-plugin'\nimport { getReactCompilerLoader } from '../get-babel-loader-config'\nimport type {\n NapiPartialProjectOptions,\n NapiProjectOptions,\n} from './generated-native'\nimport type {\n Binding,\n DefineEnv,\n Endpoint,\n HmrIdentifiers,\n Project,\n ProjectOptions,\n RawEntrypoints,\n Route,\n TurboEngineOptions,\n TurbopackResult,\n TurbopackStackFrame,\n Update,\n UpdateMessage,\n WrittenEndpoint,\n} from './types'\nimport { TurbopackInternalError } from '../../shared/lib/turbopack/utils'\n\ntype RawBindings = typeof import('./generated-native')\ntype RawWasmBindings = typeof import('./generated-wasm') & {\n default?(): Promise<typeof import('./generated-wasm')>\n}\n\nconst nextVersion = process.env.__NEXT_VERSION as string\n\nconst ArchName = arch()\nconst PlatformName = platform()\n\nfunction infoLog(...args: any[]) {\n if (process.env.NEXT_PRIVATE_BUILD_WORKER) {\n return\n }\n if (process.env.DEBUG) {\n Log.info(...args)\n }\n}\n\n/**\n * Based on napi-rs's target triples, returns triples that have corresponding next-swc binaries.\n */\nexport function getSupportedArchTriples(): Record<string, any> {\n const { darwin, win32, linux, freebsd, android } = platformArchTriples\n\n return {\n darwin,\n win32: {\n arm64: win32.arm64,\n ia32: win32.ia32.filter((triple) => triple.abi === 'msvc'),\n x64: win32.x64.filter((triple) => triple.abi === 'msvc'),\n },\n linux: {\n // linux[x64] includes `gnux32` abi, with x64 arch.\n x64: linux.x64.filter((triple) => triple.abi !== 'gnux32'),\n arm64: linux.arm64,\n // This target is being deprecated, however we keep it in `knownDefaultWasmFallbackTriples` for now\n arm: linux.arm,\n },\n // Below targets are being deprecated, however we keep it in `knownDefaultWasmFallbackTriples` for now\n freebsd: {\n x64: freebsd.x64,\n },\n android: {\n arm64: android.arm64,\n arm: android.arm,\n },\n }\n}\n\nconst triples = (() => {\n const supportedArchTriples = getSupportedArchTriples()\n const targetTriple = supportedArchTriples[PlatformName]?.[ArchName]\n\n // If we have supported triple, return it right away\n if (targetTriple) {\n return targetTriple\n }\n\n // If there isn't corresponding target triple in `supportedArchTriples`, check if it's excluded from original raw triples\n // Otherwise, it is completely unsupported platforms.\n let rawTargetTriple = platformArchTriples[PlatformName]?.[ArchName]\n\n if (rawTargetTriple) {\n Log.warn(\n `Trying to load next-swc for target triple ${rawTargetTriple}, but there next-swc does not have native bindings support`\n )\n } else {\n Log.warn(\n `Trying to load next-swc for unsupported platforms ${PlatformName}/${ArchName}`\n )\n }\n\n return []\n})()\n\n// Allow to specify an absolute path to the custom turbopack binary to load.\n// If one of env variables is set, `loadNative` will try to use specified\n// binary instead. This is thin, naive interface\n// - `loadBindings` will not validate neither path nor the binary.\n//\n// Note these are internal flag: there's no stability, feature guarantee.\nconst __INTERNAL_CUSTOM_TURBOPACK_BINDINGS =\n process.env.__INTERNAL_CUSTOM_TURBOPACK_BINDINGS\n\nfunction checkVersionMismatch(pkgData: any) {\n const version = pkgData.version\n\n if (version && version !== nextVersion) {\n Log.warn(\n `Mismatching @next/swc version, detected: ${version} while Next.js is on ${nextVersion}. Please ensure these match`\n )\n }\n}\n\n// These are the platforms we'll try to load wasm bindings first,\n// only try to load native bindings if loading wasm binding somehow fails.\n// Fallback to native binding is for migration period only,\n// once we can verify loading-wasm-first won't cause visible regressions,\n// we'll not include native bindings for these platform at all.\nconst knownDefaultWasmFallbackTriples = [\n 'x86_64-unknown-freebsd',\n 'aarch64-linux-android',\n 'arm-linux-androideabi',\n 'armv7-unknown-linux-gnueabihf',\n 'i686-pc-windows-msvc',\n // WOA targets are TBD, while current userbase is small we may support it in the future\n //'aarch64-pc-windows-msvc',\n]\n\n// The last attempt's error code returned when cjs require to native bindings fails.\n// If node.js throws an error without error code, this should be `unknown` instead of undefined.\n// For the wasm-first targets (`knownDefaultWasmFallbackTriples`) this will be `unsupported_target`.\nlet lastNativeBindingsLoadErrorCode:\n | 'unknown'\n | 'unsupported_target'\n | string\n | undefined = undefined\nlet nativeBindings: Binding\nlet wasmBindings: Binding\nlet downloadWasmPromise: any\nlet pendingBindings: any\nlet swcTraceFlushGuard: any\nlet downloadNativeBindingsPromise: Promise<void> | undefined = undefined\n\nexport const lockfilePatchPromise: { cur?: Promise<void> } = {}\n\nexport async function loadBindings(\n useWasmBinary: boolean = false\n): Promise<Binding> {\n // Increase Rust stack size as some npm packages being compiled need more than the default.\n if (!process.env.RUST_MIN_STACK) {\n process.env.RUST_MIN_STACK = '8388608'\n }\n\n if (pendingBindings) {\n return pendingBindings\n }\n\n // rust needs stdout to be blocking, otherwise it will throw an error (on macOS at least) when writing a lot of data (logs) to it\n // see https://github.com/napi-rs/napi-rs/issues/1630\n // and https://github.com/nodejs/node/blob/main/doc/api/process.md#a-note-on-process-io\n if (process.stdout._handle != null) {\n // @ts-ignore\n process.stdout._handle.setBlocking?.(true)\n }\n if (process.stderr._handle != null) {\n // @ts-ignore\n process.stderr._handle.setBlocking?.(true)\n }\n\n pendingBindings = new Promise(async (resolve, _reject) => {\n if (!lockfilePatchPromise.cur) {\n // always run lockfile check once so that it gets patched\n // even if it doesn't fail to load locally\n lockfilePatchPromise.cur = patchIncorrectLockfile(process.cwd()).catch(\n console.error\n )\n }\n\n let attempts: any[] = []\n const disableWasmFallback = process.env.NEXT_DISABLE_SWC_WASM\n const unsupportedPlatform = triples.some(\n (triple: any) =>\n !!triple?.raw && knownDefaultWasmFallbackTriples.includes(triple.raw)\n )\n const isWebContainer = process.versions.webcontainer\n // Normal execution relies on the param `useWasmBinary` flag to load, but\n // in certain cases where there isn't a native binary we always load wasm fallback first.\n const shouldLoadWasmFallbackFirst =\n (!disableWasmFallback && useWasmBinary) ||\n unsupportedPlatform ||\n isWebContainer\n\n if (!unsupportedPlatform && useWasmBinary) {\n Log.warn(\n `experimental.useWasmBinary is not an option for supported platform ${PlatformName}/${ArchName} and will be ignored.`\n )\n }\n\n if (shouldLoadWasmFallbackFirst) {\n lastNativeBindingsLoadErrorCode = 'unsupported_target'\n const fallbackBindings = await tryLoadWasmWithFallback(attempts)\n if (fallbackBindings) {\n return resolve(fallbackBindings)\n }\n }\n\n // Trickle down loading `fallback` bindings:\n //\n // - First, try to load native bindings installed in node_modules.\n // - If that fails with `ERR_MODULE_NOT_FOUND`, treat it as case of https://github.com/npm/cli/issues/4828\n // that host system where generated package lock is not matching to the guest system running on, try to manually\n // download corresponding target triple and load it. This won't be triggered if native bindings are failed to load\n // with other reasons than `ERR_MODULE_NOT_FOUND`.\n // - Lastly, falls back to wasm binding where possible.\n try {\n return resolve(loadNative())\n } catch (a) {\n if (\n Array.isArray(a) &&\n a.every((m) => m.includes('it was not installed'))\n ) {\n let fallbackBindings = await tryLoadNativeWithFallback(attempts)\n\n if (fallbackBindings) {\n return resolve(fallbackBindings)\n }\n }\n\n attempts = attempts.concat(a)\n }\n\n // For these platforms we already tried to load wasm and failed, skip reattempt\n if (!shouldLoadWasmFallbackFirst && !disableWasmFallback) {\n const fallbackBindings = await tryLoadWasmWithFallback(attempts)\n if (fallbackBindings) {\n return resolve(fallbackBindings)\n }\n }\n\n logLoadFailure(attempts, true)\n })\n return pendingBindings\n}\n\nasync function tryLoadNativeWithFallback(attempts: Array<string>) {\n const nativeBindingsDirectory = path.join(\n path.dirname(require.resolve('next/package.json')),\n 'next-swc-fallback'\n )\n\n if (!downloadNativeBindingsPromise) {\n downloadNativeBindingsPromise = downloadNativeNextSwc(\n nextVersion,\n nativeBindingsDirectory,\n triples.map((triple: any) => triple.platformArchABI)\n )\n }\n await downloadNativeBindingsPromise\n\n try {\n return loadNative(nativeBindingsDirectory)\n } catch (a: any) {\n attempts.push(...[].concat(a))\n }\n\n return undefined\n}\n\nasync function tryLoadWasmWithFallback(attempts: any[]) {\n try {\n let bindings = await loadWasm('')\n // @ts-expect-error TODO: this event has a wrong type.\n eventSwcLoadFailure({\n wasm: 'enabled',\n nativeBindingsErrorCode: lastNativeBindingsLoadErrorCode,\n })\n return bindings\n } catch (a: any) {\n attempts.push(...[].concat(a))\n }\n\n try {\n // if not installed already download wasm package on-demand\n // we download to a custom directory instead of to node_modules\n // as node_module import attempts are cached and can't be re-attempted\n // x-ref: https://github.com/nodejs/modules/issues/307\n const wasmDirectory = path.join(\n path.dirname(require.resolve('next/package.json')),\n 'wasm'\n )\n if (!downloadWasmPromise) {\n downloadWasmPromise = downloadWasmSwc(nextVersion, wasmDirectory)\n }\n await downloadWasmPromise\n let bindings = await loadWasm(wasmDirectory)\n // @ts-expect-error TODO: this event has a wrong type.\n eventSwcLoadFailure({\n wasm: 'fallback',\n nativeBindingsErrorCode: lastNativeBindingsLoadErrorCode,\n })\n\n // still log native load attempts so user is\n // aware it failed and should be fixed\n for (const attempt of attempts) {\n Log.warn(attempt)\n }\n return bindings\n } catch (a: any) {\n attempts.push(...[].concat(a))\n }\n}\n\nfunction loadBindingsSync() {\n let attempts: any[] = []\n try {\n return loadNative()\n } catch (a) {\n attempts = attempts.concat(a)\n }\n\n // we can leverage the wasm bindings if they are already\n // loaded\n if (wasmBindings) {\n return wasmBindings\n }\n\n logLoadFailure(attempts)\n throw new Error('Failed to load bindings', { cause: attempts })\n}\n\nlet loggingLoadFailure = false\n\nfunction logLoadFailure(attempts: any, triedWasm = false) {\n // make sure we only emit the event and log the failure once\n if (loggingLoadFailure) return\n loggingLoadFailure = true\n\n for (let attempt of attempts) {\n Log.warn(attempt)\n }\n\n // @ts-expect-error TODO: this event has a wrong type.\n eventSwcLoadFailure({\n wasm: triedWasm ? 'failed' : undefined,\n nativeBindingsErrorCode: lastNativeBindingsLoadErrorCode,\n })\n .then(() => lockfilePatchPromise.cur || Promise.resolve())\n .finally(() => {\n Log.error(\n `Failed to load SWC binary for ${PlatformName}/${ArchName}, see more info here: https://nextjs.org/docs/messages/failed-loading-swc`\n )\n process.exit(1)\n })\n}\n\ntype RustifiedEnv = { name: string; value: string }[]\n\nexport function createDefineEnv({\n isTurbopack,\n clientRouterFilters,\n config,\n dev,\n distDir,\n fetchCacheKeyPrefix,\n hasRewrites,\n middlewareMatchers,\n}: Omit<\n DefineEnvPluginOptions,\n 'isClient' | 'isNodeOrEdgeCompilation' | 'isEdgeServer' | 'isNodeServer'\n>): DefineEnv {\n let defineEnv: DefineEnv = {\n client: [],\n edge: [],\n nodejs: [],\n }\n\n for (const variant of Object.keys(defineEnv) as (keyof typeof defineEnv)[]) {\n defineEnv[variant] = rustifyEnv(\n getDefineEnv({\n isTurbopack,\n clientRouterFilters,\n config,\n dev,\n distDir,\n fetchCacheKeyPrefix,\n hasRewrites,\n isClient: variant === 'client',\n isEdgeServer: variant === 'edge',\n isNodeOrEdgeCompilation: variant === 'nodejs' || variant === 'edge',\n isNodeServer: variant === 'nodejs',\n middlewareMatchers,\n })\n )\n }\n\n return defineEnv\n}\n\nfunction rustifyEnv(env: Record<string, string>): RustifiedEnv {\n return Object.entries(env)\n .filter(([_, value]) => value != null)\n .map(([name, value]) => ({\n name,\n value,\n }))\n}\n\n// TODO(sokra) Support wasm option.\nfunction bindingToApi(\n binding: RawBindings,\n _wasm: boolean\n): Binding['turbo']['createProject'] {\n type NativeFunction<T> = (\n callback: (err: Error, value: T) => void\n ) => Promise<{ __napiType: 'RootTask' }>\n\n type NapiEndpoint = { __napiType: 'Endpoint' }\n\n type NapiEntrypoints = {\n routes: NapiRoute[]\n middleware?: NapiMiddleware\n instrumentation?: NapiInstrumentation\n pagesDocumentEndpoint: NapiEndpoint\n pagesAppEndpoint: NapiEndpoint\n pagesErrorEndpoint: NapiEndpoint\n }\n\n type NapiMiddleware = {\n endpoint: NapiEndpoint\n runtime: 'nodejs' | 'edge'\n matcher?: string[]\n }\n\n type NapiInstrumentation = {\n nodeJs: NapiEndpoint\n edge: NapiEndpoint\n }\n\n type NapiRoute = {\n pathname: string\n } & (\n | {\n type: 'page'\n htmlEndpoint: NapiEndpoint\n dataEndpoint: NapiEndpoint\n }\n | {\n type: 'page-api'\n endpoint: NapiEndpoint\n }\n | {\n type: 'app-page'\n pages: {\n originalName: string\n htmlEndpoint: NapiEndpoint\n rscEndpoint: NapiEndpoint\n }[]\n }\n | {\n type: 'app-route'\n originalName: string\n endpoint: NapiEndpoint\n }\n | {\n type: 'conflict'\n }\n )\n\n const cancel = new (class Cancel extends Error {})()\n\n /**\n * Utility function to ensure all variants of an enum are handled.\n */\n function invariant(\n never: never,\n computeMessage: (arg: any) => string\n ): never {\n throw new Error(`Invariant: ${computeMessage(never)}`)\n }\n\n async function withErrorCause<T>(fn: () => Promise<T>): Promise<T> {\n try {\n return await fn()\n } catch (nativeError: any) {\n throw new TurbopackInternalError(nativeError)\n }\n }\n\n /**\n * Calls a native function and streams the result.\n * If useBuffer is true, all values will be preserved, potentially buffered\n * if consumed slower than produced. Else, only the latest value will be\n * preserved.\n */\n function subscribe<T>(\n useBuffer: boolean,\n nativeFunction:\n | NativeFunction<T>\n | ((callback: (err: Error, value: T) => void) => Promise<void>)\n ): AsyncIterableIterator<T> {\n type BufferItem =\n | { err: Error; value: undefined }\n | { err: undefined; value: T }\n // A buffer of produced items. This will only contain values if the\n // consumer is slower than the producer.\n let buffer: BufferItem[] = []\n // A deferred value waiting for the next produced item. This will only\n // exist if the consumer is faster than the producer.\n let waiting:\n | {\n resolve: (value: T) => void\n reject: (error: Error) => void\n }\n | undefined\n let canceled = false\n\n // The native function will call this every time it emits a new result. We\n // either need to notify a waiting consumer, or buffer the new result until\n // the consumer catches up.\n function emitResult(err: Error | undefined, value: T | undefined) {\n if (waiting) {\n let { resolve, reject } = waiting\n waiting = undefined\n if (err) reject(err)\n else resolve(value!)\n } else {\n const item = { err, value } as BufferItem\n if (useBuffer) buffer.push(item)\n else buffer[0] = item\n }\n }\n\n async function* createIterator() {\n const task = await withErrorCause<{ __napiType: 'RootTask' } | void>(() =>\n nativeFunction(emitResult)\n )\n try {\n while (!canceled) {\n if (buffer.length > 0) {\n const item = buffer.shift()!\n if (item.err) throw item.err\n yield item.value\n } else {\n // eslint-disable-next-line no-loop-func\n yield new Promise<T>((resolve, reject) => {\n waiting = { resolve, reject }\n })\n }\n }\n } catch (e) {\n if (e === cancel) return\n if (e instanceof Error) {\n throw new TurbopackInternalError(e)\n }\n throw e\n } finally {\n if (task) {\n binding.rootTaskDispose(task)\n }\n }\n }\n\n const iterator = createIterator()\n iterator.return = async () => {\n canceled = true\n if (waiting) waiting.reject(cancel)\n return { value: undefined, done: true } as IteratorReturnResult<never>\n }\n return iterator\n }\n\n async function rustifyProjectOptions(\n options: ProjectOptions\n ): Promise<NapiProjectOptions> {\n return {\n ...options,\n nextConfig: await serializeNextConfig(\n options.nextConfig,\n options.projectPath!\n ),\n jsConfig: JSON.stringify(options.jsConfig),\n env: rustifyEnv(options.env),\n }\n }\n\n async function rustifyPartialProjectOptions(\n options: Partial<ProjectOptions>\n ): Promise<NapiPartialProjectOptions> {\n return {\n ...options,\n nextConfig:\n options.nextConfig &&\n (await serializeNextConfig(options.nextConfig, options.projectPath!)),\n jsConfig: options.jsConfig && JSON.stringify(options.jsConfig),\n env: options.env && rustifyEnv(options.env),\n }\n }\n\n class ProjectImpl implements Project {\n private readonly _nativeProject: { __napiType: 'Project' }\n\n constructor(nativeProject: { __napiType: 'Project' }) {\n this._nativeProject = nativeProject\n }\n\n async update(options: Partial<ProjectOptions>) {\n await withErrorCause(async () =>\n binding.projectUpdate(\n this._nativeProject,\n await rustifyPartialProjectOptions(options)\n )\n )\n }\n\n async writeAllEntrypointsToDisk(\n appDirOnly: boolean\n ): Promise<TurbopackResult<RawEntrypoints>> {\n return await withErrorCause(async () => {\n const napiEndpoints = (await binding.projectWriteAllEntrypointsToDisk(\n this._nativeProject,\n appDirOnly\n )) as TurbopackResult<NapiEntrypoints>\n\n return napiEntrypointsToRawEntrypoints(napiEndpoints)\n })\n }\n\n entrypointsSubscribe() {\n const subscription = subscribe<TurbopackResult<NapiEntrypoints>>(\n false,\n async (callback) =>\n binding.projectEntrypointsSubscribe(this._nativeProject, callback)\n )\n return (async function* () {\n for await (const entrypoints of subscription) {\n yield napiEntrypointsToRawEntrypoints(entrypoints)\n }\n })()\n }\n\n hmrEvents(identifier: string) {\n return subscribe<TurbopackResult<Update>>(true, async (callback) =>\n binding.projectHmrEvents(this._nativeProject, identifier, callback)\n )\n }\n\n hmrIdentifiersSubscribe() {\n return subscribe<TurbopackResult<HmrIdentifiers>>(\n false,\n async (callback) =>\n binding.projectHmrIdentifiersSubscribe(this._nativeProject, callback)\n )\n }\n\n traceSource(\n stackFrame: TurbopackStackFrame,\n currentDirectoryFileUrl: string\n ): Promise<TurbopackStackFrame | null> {\n return binding.projectTraceSource(\n this._nativeProject,\n stackFrame,\n currentDirectoryFileUrl\n )\n }\n\n getSourceForAsset(filePath: string): Promise<string | null> {\n return binding.projectGetSourceForAsset(this._nativeProject, filePath)\n }\n\n getSourceMap(filePath: string): Promise<string | null> {\n return binding.projectGetSourceMap(this._nativeProject, filePath)\n }\n\n getSourceMapSync(filePath: string): string | null {\n return binding.projectGetSourceMapSync(this._nativeProject, filePath)\n }\n\n updateInfoSubscribe(aggregationMs: number) {\n return subscribe<TurbopackResult<UpdateMessage>>(true, async (callback) =>\n binding.projectUpdateInfoSubscribe(\n this._nativeProject,\n aggregationMs,\n callback\n )\n )\n }\n\n shutdown(): Promise<void> {\n return binding.projectShutdown(this._nativeProject)\n }\n\n onExit(): Promise<void> {\n return binding.projectOnExit(this._nativeProject)\n }\n }\n\n class EndpointImpl implements Endpoint {\n private readonly _nativeEndpoint: { __napiType: 'Endpoint' }\n\n constructor(nativeEndpoint: { __napiType: 'Endpoint' }) {\n this._nativeEndpoint = nativeEndpoint\n }\n\n async writeToDisk(): Promise<TurbopackResult<WrittenEndpoint>> {\n return await withErrorCause(\n () =>\n binding.endpointWriteToDisk(this._nativeEndpoint) as Promise<\n TurbopackResult<WrittenEndpoint>\n >\n )\n }\n\n async clientChanged(): Promise<AsyncIterableIterator<TurbopackResult<{}>>> {\n const clientSubscription = subscribe<TurbopackResult>(\n false,\n async (callback) =>\n binding.endpointClientChangedSubscribe(\n await this._nativeEndpoint,\n callback\n )\n )\n await clientSubscription.next()\n return clientSubscription\n }\n\n async serverChanged(\n includeIssues: boolean\n ): Promise<AsyncIterableIterator<TurbopackResult<{}>>> {\n const serverSubscription = subscribe<TurbopackResult>(\n false,\n async (callback) =>\n binding.endpointServerChangedSubscribe(\n await this._nativeEndpoint,\n includeIssues,\n callback\n )\n )\n await serverSubscription.next()\n return serverSubscription\n }\n }\n\n /**\n * Returns a new copy of next.js config object to avoid mutating the original.\n *\n * Also it does some augmentation to the configuration as well, for example set the\n * turbopack's rules if `experimental.reactCompilerOptions` is set.\n */\n function augmentNextConfig(\n originalNextConfig: NextConfigComplete,\n projectPath: string\n ): Record<string, any> {\n let nextConfig = { ...(originalNextConfig as any) }\n\n const reactCompilerOptions = nextConfig.experimental?.reactCompiler\n\n // It is not easy to set the rules inside of rust as resolving, and passing the context identical to the webpack\n // config is bit hard, also we can reuse same codes between webpack config in here.\n if (reactCompilerOptions) {\n const ruleKeys = ['*.ts', '*.js', '*.jsx', '*.tsx']\n if (\n Object.keys(nextConfig?.experimental?.turbo?.rules ?? []).some((key) =>\n ruleKeys.includes(key)\n )\n ) {\n Log.warn(\n `The React Compiler cannot be enabled automatically because 'experimental.turbo' contains a rule for '*.ts', '*.js', '*.jsx', and '*.tsx'. Remove this rule, or add 'babel-loader' and 'babel-plugin-react-compiler' to the Turbopack configuration manually.`\n )\n } else {\n if (!nextConfig.experimental.turbo) {\n nextConfig.experimental.turbo = {}\n }\n\n if (!nextConfig.experimental.turbo.rules) {\n nextConfig.experimental.turbo.rules = {}\n }\n\n for (const key of ['*.ts', '*.js', '*.jsx', '*.tsx']) {\n nextConfig.experimental.turbo.rules[key] = {\n browser: {\n foreign: false,\n loaders: [\n getReactCompilerLoader(\n originalNextConfig.experimental.reactCompiler,\n projectPath,\n nextConfig.dev,\n false,\n undefined\n ),\n ],\n },\n }\n }\n }\n }\n\n return nextConfig\n }\n\n async function serializeNextConfig(\n nextConfig: NextConfigComplete,\n projectPath: string\n ): Promise<string> {\n // Avoid mutating the existing `nextConfig` object.\n let nextConfigSerializable = augmentNextConfig(nextConfig, projectPath)\n\n nextConfigSerializable.generateBuildId =\n await nextConfig.generateBuildId?.()\n\n // TODO: these functions takes arguments, have to be supported in a different way\n nextConfigSerializable.exportPathMap = {}\n nextConfigSerializable.webpack = nextConfig.webpack && {}\n\n if (nextConfigSerializable.experimental?.turbo?.rules) {\n ensureLoadersHaveSerializableOptions(\n nextConfigSerializable.experimental.turbo?.rules\n )\n }\n\n nextConfigSerializable.modularizeImports =\n nextConfigSerializable.modularizeImports\n ? Object.fromEntries(\n Object.entries<any>(nextConfigSerializable.modularizeImports).map(\n ([mod, config]) => [\n mod,\n {\n ...config,\n transform:\n typeof config.transform === 'string'\n ? config.transform\n : Object.entries(config.transform).map(([key, value]) => [\n key,\n value,\n ]),\n },\n ]\n )\n )\n : undefined\n\n // loaderFile is an absolute path, we need it to be relative for turbopack.\n if (nextConfigSerializable.images.loaderFile) {\n nextConfigSerializable.images = {\n ...nextConfig.images,\n loaderFile:\n './' + path.relative(projectPath, nextConfig.images.loaderFile),\n }\n }\n\n return JSON.stringify(nextConfigSerializable, null, 2)\n }\n\n function ensureLoadersHaveSerializableOptions(\n turbopackRules: Record<string, TurboRuleConfigItemOrShortcut>\n ) {\n for (const [glob, rule] of Object.entries(turbopackRules)) {\n if (Array.isArray(rule)) {\n checkLoaderItems(rule, glob)\n } else {\n checkConfigItem(rule, glob)\n }\n }\n\n function checkConfigItem(rule: TurboRuleConfigItem, glob: string) {\n if (!rule) return\n if ('loaders' in rule) {\n checkLoaderItems((rule as TurboRuleConfigItemOptions).loaders, glob)\n } else {\n for (const key in rule) {\n const inner = rule[key]\n if (typeof inner === 'object' && inner) {\n checkConfigItem(inner, glob)\n }\n }\n }\n }\n\n function checkLoaderItems(loaderItems: TurboLoaderItem[], glob: string) {\n for (const loaderItem of loaderItems) {\n if (\n typeof loaderItem !== 'string' &&\n !isDeepStrictEqual(loaderItem, JSON.parse(JSON.stringify(loaderItem)))\n ) {\n throw new Error(\n `loader ${loaderItem.loader} for match \"${glob}\" does not have serializable options. Ensure that options passed are plain JavaScript objects and values.`\n )\n }\n }\n }\n }\n\n function napiEntrypointsToRawEntrypoints(\n entrypoints: TurbopackResult<NapiEntrypoints>\n ): TurbopackResult<RawEntrypoints> {\n const routes = new Map()\n for (const { pathname, ...nativeRoute } of entrypoints.routes) {\n let route: Route\n const routeType = nativeRoute.type\n switch (routeType) {\n case 'page':\n route = {\n type: 'page',\n htmlEndpoint: new EndpointImpl(nativeRoute.htmlEndpoint),\n dataEndpoint: new EndpointImpl(nativeRoute.dataEndpoint),\n }\n break\n case 'page-api':\n route = {\n type: 'page-api',\n endpoint: new EndpointImpl(nativeRoute.endpoint),\n }\n break\n case 'app-page':\n route = {\n type: 'app-page',\n pages: nativeRoute.pages.map((page) => ({\n originalName: page.originalName,\n htmlEndpoint: new EndpointImpl(page.htmlEndpoint),\n rscEndpoint: new EndpointImpl(page.rscEndpoint),\n })),\n }\n break\n case 'app-route':\n route = {\n type: 'app-route',\n originalName: nativeRoute.originalName,\n endpoint: new EndpointImpl(nativeRoute.endpoint),\n }\n break\n case 'conflict':\n route = {\n type: 'conflict',\n }\n break\n default:\n const _exhaustiveCheck: never = routeType\n invariant(\n nativeRoute,\n () => `Unknown route type: ${_exhaustiveCheck}`\n )\n }\n routes.set(pathname, route)\n }\n const napiMiddlewareToMiddleware = (middleware: NapiMiddleware) => ({\n endpoint: new EndpointImpl(middleware.endpoint),\n runtime: middleware.runtime,\n matcher: middleware.matcher,\n })\n const middleware = entrypoints.middleware\n ? napiMiddlewareToMiddleware(entrypoints.middleware)\n : undefined\n const napiInstrumentationToInstrumentation = (\n instrumentation: NapiInstrumentation\n ) => ({\n nodeJs: new EndpointImpl(instrumentation.nodeJs),\n edge: new EndpointImpl(instrumentation.edge),\n })\n const instrumentation = entrypoints.instrumentation\n ? napiInstrumentationToInstrumentation(entrypoints.instrumentation)\n : undefined\n\n return {\n routes,\n middleware,\n instrumentation,\n pagesDocumentEndpoint: new EndpointImpl(\n entrypoints.pagesDocumentEndpoint\n ),\n pagesAppEndpoint: new EndpointImpl(entrypoints.pagesAppEndpoint),\n pagesErrorEndpoint: new EndpointImpl(entrypoints.pagesErrorEndpoint),\n issues: entrypoints.issues,\n diagnostics: entrypoints.diagnostics,\n }\n }\n\n return async function createProject(\n options: ProjectOptions,\n turboEngineOptions\n ) {\n return new ProjectImpl(\n await binding.projectNew(\n await rustifyProjectOptions(options),\n turboEngineOptions || {}\n )\n )\n }\n}\n\nasync function loadWasm(importPath = '') {\n if (wasmBindings) {\n return wasmBindings\n }\n\n let attempts = []\n for (let pkg of ['@next/swc-wasm-nodejs', '@next/swc-wasm-web']) {\n try {\n let pkgPath = pkg\n\n if (importPath) {\n // the import path must be exact when not in node_modules\n pkgPath = path.join(importPath, pkg, 'wasm.js')\n }\n let bindings: RawWasmBindings = await import(\n pathToFileURL(pkgPath).toString()\n )\n if (pkg === '@next/swc-wasm-web') {\n bindings = await bindings.default!()\n }\n infoLog('next-swc build: wasm build @next/swc-wasm-web')\n\n // Note wasm binary does not support async intefaces yet, all async\n // interface coereces to sync interfaces.\n wasmBindings = {\n css: {\n lightning: {\n transform: function (_options: any) {\n throw new Error(\n '`css.lightning.transform` is not supported by the wasm bindings.'\n )\n },\n transformStyleAttr: function (_options: any) {\n throw new Error(\n '`css.lightning.transformStyleAttr` is not supported by the wasm bindings.'\n )\n },\n },\n },\n isWasm: true,\n transform(src: string, options: any) {\n // TODO: we can remove fallback to sync interface once new stable version of next-swc gets published (current v12.2)\n return bindings?.transform\n ? bindings.transform(src.toString(), options)\n : Promise.resolve(bindings.transformSync(src.toString(), options))\n },\n transformSync(src: string, options: any) {\n return bindings.transformSync(src.toString(), options)\n },\n minify(src: string, options: any) {\n return bindings?.minify\n ? bindings.minify(src.toString(), options)\n : Promise.resolve(bindings.minifySync(src.toString(), options))\n },\n minifySync(src: string, options: any) {\n return bindings.minifySync(src.toString(), options)\n },\n parse(src: string, options: any) {\n return bindings?.parse\n ? bindings.parse(src.toString(), options)\n : Promise.resolve(bindings.parseSync(src.toString(), options))\n },\n getTargetTriple() {\n return undefined\n },\n turbo: {\n createProject: function (\n _options: ProjectOptions,\n _turboEngineOptions?: TurboEngineOptions | undefined\n ): Promise<Project> {\n throw new Error(\n '`turbo.createProject` is not supported by the wasm bindings.'\n )\n },\n startTurbopackTraceServer: function (_traceFilePath: string): void {\n throw new Error(\n '`turbo.startTurbopackTraceServer` is not supported by the wasm bindings.'\n )\n },\n },\n mdx: {\n compile(src: string, options: any) {\n return bindings.mdxCompile(src, getMdxOptions(options))\n },\n compileSync(src: string, options: any) {\n return bindings.mdxCompileSync(src, getMdxOptions(options))\n },\n },\n }\n return wasmBindings\n } catch (e: any) {\n // Only log attempts for loading wasm when loading as fallback\n if (importPath) {\n if (e?.code === 'ERR_MODULE_NOT_FOUND') {\n attempts.push(`Attempted to load ${pkg}, but it was not installed`)\n } else {\n attempts.push(\n `Attempted to load ${pkg}, but an error occurred: ${e.message ?? e}`\n )\n }\n }\n }\n }\n\n throw attempts\n}\n\nfunction loadNative(importPath?: string) {\n if (nativeBindings) {\n return nativeBindings\n }\n\n const customBindings: RawBindings = !!__INTERNAL_CUSTOM_TURBOPACK_BINDINGS\n ? require(__INTERNAL_CUSTOM_TURBOPACK_BINDINGS)\n : null\n let bindings: RawBindings = customBindings\n let attempts: any[] = []\n\n const NEXT_TEST_NATIVE_DIR = process.env.NEXT_TEST_NATIVE_DIR\n for (const triple of triples) {\n if (NEXT_TEST_NATIVE_DIR) {\n try {\n // Use the binary directly to skip `pnpm pack` for testing as it's slow because of the large native binary.\n bindings = require(\n `${NEXT_TEST_NATIVE_DIR}/next-swc.${triple.platformArchABI}.node`\n )\n infoLog(\n 'next-swc build: local built @next/swc from NEXT_TEST_NATIVE_DIR'\n )\n break\n } catch (e) {}\n } else {\n try {\n bindings = require(\n `@next/swc/native/next-swc.${triple.platformArchABI}.node`\n )\n infoLog('next-swc build: local built @next/swc')\n break\n } catch (e) {}\n }\n }\n\n if (!bindings) {\n for (const triple of triples) {\n let pkg = importPath\n ? path.join(\n importPath,\n `@next/swc-${triple.platformArchABI}`,\n `next-swc.${triple.platformArchABI}.node`\n )\n : `@next/swc-${triple.platformArchABI}`\n try {\n bindings = require(pkg)\n if (!importPath) {\n checkVersionMismatch(require(`${pkg}/package.json`))\n }\n break\n } catch (e: any) {\n if (e?.code === 'MODULE_NOT_FOUND') {\n attempts.push(`Attempted to load ${pkg}, but it was not installed`)\n } else {\n attempts.push(\n `Attempted to load ${pkg}, but an error occurred: ${e.message ?? e}`\n )\n }\n lastNativeBindingsLoadErrorCode = e?.code ?? 'unknown'\n }\n }\n }\n\n if (bindings) {\n nativeBindings = {\n isWasm: false,\n transform(src: string, options: any) {\n const isModule =\n typeof src !== 'undefined' &&\n typeof src !== 'string' &&\n !Buffer.isBuffer(src)\n options = options || {}\n\n if (options?.jsc?.parser) {\n options.jsc.parser.syntax = options.jsc.parser.syntax ?? 'ecmascript'\n }\n\n return bindings.transform(\n isModule ? JSON.stringify(src) : src,\n isModule,\n toBuffer(options)\n )\n },\n\n transformSync(src: string, options: any) {\n if (typeof src === 'undefined') {\n throw new Error(\n \"transformSync doesn't implement reading the file from filesystem\"\n )\n } else if (Buffer.isBuffer(src)) {\n throw new Error(\n \"transformSync doesn't implement taking the source code as Buffer\"\n )\n }\n const isModule = typeof src !== 'string'\n options = options || {}\n\n if (options?.jsc?.parser) {\n options.jsc.parser.syntax = options.jsc.parser.syntax ?? 'ecmascript'\n }\n\n return bindings.transformSync(\n isModule ? JSON.stringify(src) : src,\n isModule,\n toBuffer(options)\n )\n },\n\n minify(src: string, options: any) {\n return bindings.minify(toBuffer(src), toBuffer(options ?? {}))\n },\n\n minifySync(src: string, options: any) {\n return bindings.minifySync(toBuffer(src), toBuffer(options ?? {}))\n },\n\n parse(src: string, options: any) {\n return bindings.parse(src, toBuffer(options ?? {}))\n },\n\n getTargetTriple: bindings.getTargetTriple,\n initCustomTraceSubscriber: bindings.initCustomTraceSubscriber,\n teardownTraceSubscriber: bindings.teardownTraceSubscriber,\n turbo: {\n createProject: bindingToApi(customBindings ?? bindings, false),\n startTurbopackTraceServer(traceFilePath) {\n Log.warn(\n 'Turbopack trace server started. View trace at https://turbo-trace-viewer.vercel.app/'\n )\n ;(customBindings ?? bindings).startTurbopackTraceServer(traceFilePath)\n },\n },\n mdx: {\n compile(src: string, options: any) {\n return bindings.mdxCompile(src, toBuffer(getMdxOptions(options)))\n },\n compileSync(src: string, options: any) {\n bindings.mdxCompileSync(src, toBuffer(getMdxOptions(options)))\n },\n },\n css: {\n lightning: {\n transform(transformOptions: any) {\n return bindings.lightningCssTransform(transformOptions)\n },\n transformStyleAttr(transformAttrOptions: any) {\n return bindings.lightningCssTransformStyleAttribute(\n transformAttrOptions\n )\n },\n },\n },\n }\n return nativeBindings\n }\n\n throw attempts\n}\n\n/// Build a mdx options object contains default values that\n/// can be parsed with serde_wasm_bindgen.\nfunction getMdxOptions(options: any = {}) {\n return {\n ...options,\n development: options.development ?? false,\n jsx: options.jsx ?? false,\n mdxType: options.mdxType ?? 'commonMark',\n }\n}\n\nfunction toBuffer(t: any) {\n return Buffer.from(JSON.stringify(t))\n}\n\nexport async function isWasm(): Promise<boolean> {\n let bindings = await loadBindings()\n return bindings.isWasm\n}\n\nexport async function transform(src: string, options?: any): Promise<any> {\n let bindings = await loadBindings()\n return bindings.transform(src, options)\n}\n\nexport function transformSync(src: string, options?: any): any {\n let bindings = loadBindingsSync()\n return bindings.transformSync(src, options)\n}\n\nexport async function minify(\n src: string,\n options: any\n): Promise<{ code: string; map: any }> {\n let bindings = await loadBindings()\n return bindings.minify(src, options)\n}\n\nexport async function parse(src: string, options: any): Promise<any> {\n let bindings = await loadBindings()\n let parserOptions = getParserOptions(options)\n return bindings\n .parse(src, parserOptions)\n .then((astStr: any) => JSON.parse(astStr))\n}\n\nexport function getBinaryMetadata() {\n let bindings\n try {\n bindings = loadNative()\n } catch (e) {\n // Suppress exceptions, this fn allows to fail to load native bindings\n }\n\n return {\n target: bindings?.getTargetTriple?.(),\n }\n}\n\n/**\n * Initialize trace subscriber to emit traces.\n *\n */\nexport function initCustomTraceSubscriber(traceFileName?: string) {\n if (swcTraceFlushGuard) {\n // Wasm binary doesn't support trace emission\n let bindings = loadNative()\n swcTraceFlushGuard = bindings.initCustomTraceSubscriber?.(traceFileName)\n }\n}\n\nfunction once(fn: () => void): () => void {\n let executed = false\n\n return function (): void {\n if (!executed) {\n executed = true\n\n fn()\n }\n }\n}\n\n/**\n * Teardown swc's trace subscriber if there's an initialized flush guard exists.\n *\n * This is workaround to amend behavior with process.exit\n * (https://github.com/vercel/next.js/blob/4db8c49cc31e4fc182391fae6903fb5ef4e8c66e/packages/next/bin/next.ts#L134=)\n * seems preventing napi's cleanup hook execution (https://github.com/swc-project/swc/blob/main/crates/node/src/util.rs#L48-L51=),\n *\n * instead parent process manually drops guard when process gets signal to exit.\n */\nexport const teardownTraceSubscriber = once(() => {\n try {\n let bindings = loadNative()\n if (swcTraceFlushGuard) {\n bindings.teardownTraceSubscriber?.(swcTraceFlushGuard)\n }\n } catch (e) {\n // Suppress exceptions, this fn allows to fail to load native bindings\n }\n})\n"],"names":["createDefineEnv","getBinaryMetadata","getSupportedArchTriples","initCustomTraceSubscriber","isWasm","loadBindings","lockfilePatchPromise","minify","parse","teardownTraceSubscriber","transform","transformSync","nextVersion","process","env","__NEXT_VERSION","ArchName","arch","PlatformName","platform","infoLog","args","NEXT_PRIVATE_BUILD_WORKER","DEBUG","Log","info","darwin","win32","linux","freebsd","android","platformArchTriples","arm64","ia32","filter","triple","abi","x64","arm","triples","supportedArchTriples","targetTriple","rawTargetTriple","warn","__INTERNAL_CUSTOM_TURBOPACK_BINDINGS","checkVersionMismatch","pkgData","version","knownDefaultWasmFallbackTriples","lastNativeBindingsLoadErrorCode","undefined","nativeBindings","wasmBindings","downloadWasmPromise","pendingBindings","swcTraceFlushGuard","downloadNativeBindingsPromise","useWasmBinary","RUST_MIN_STACK","stdout","_handle","setBlocking","stderr","Promise","resolve","_reject","cur","patchIncorrectLockfile","cwd","catch","console","error","attempts","disableWasmFallback","NEXT_DISABLE_SWC_WASM","unsupportedPlatform","some","raw","includes","isWebContainer","versions","webcontainer","shouldLoadWasmFallbackFirst","fallbackBindings","tryLoadWasmWithFallback","loadNative","a","Array","isArray","every","m","tryLoadNativeWithFallback","concat","logLoadFailure","nativeBindingsDirectory","path","join","dirname","require","downloadNativeNextSwc","map","platformArchABI","push","bindings","loadWasm","eventSwcLoadFailure","wasm","nativeBindingsErrorCode","wasmDirectory","downloadWasmSwc","attempt","loadBindingsSync","Error","cause","loggingLoadFailure","triedWasm","then","finally","exit","isTurbopack","clientRouterFilters","config","dev","distDir","fetchCacheKeyPrefix","hasRewrites","middlewareMatchers","defineEnv","client","edge","nodejs","variant","Object","keys","rustifyEnv","getDefineEnv","isClient","isEdgeServer","isNodeOrEdgeCompilation","isNodeServer","entries","_","value","name","bindingToApi","binding","_wasm","cancel","Cancel","invariant","never","computeMessage","withErrorCause","fn","nativeError","TurbopackInternalError","subscribe","useBuffer","nativeFunction","buffer","waiting","canceled","emitResult","err","reject","item","createIterator","task","length","shift","e","rootTaskDispose","iterator","return","done","rustifyProjectOptions","options","nextConfig","serializeNextConfig","projectPath","jsConfig","JSON","stringify","rustifyPartialProjectOptions","ProjectImpl","constructor","nativeProject","_nativeProject","update","projectUpdate","writeAllEntrypointsToDisk","appDirOnly","napiEndpoints","projectWriteAllEntrypointsToDisk","napiEntrypointsToRawEntrypoints","entrypointsSubscribe","subscription","callback","projectEntrypointsSubscribe","entrypoints","hmrEvents","identifier","projectHmrEvents","hmrIdentifiersSubscribe","projectHmrIdentifiersSubscribe","traceSource","stackFrame","currentDirectoryFileUrl","projectTraceSource","getSourceForAsset","filePath","projectGetSourceForAsset","getSourceMap","projectGetSourceMap","getSourceMapSync","projectGetSourceMapSync","updateInfoSubscribe","aggregationMs","projectUpdateInfoSubscribe","shutdown","projectShutdown","onExit","projectOnExit","EndpointImpl","nativeEndpoint","_nativeEndpoint","writeToDisk","endpointWriteToDisk","clientChanged","clientSubscription","endpointClientChangedSubscribe","next","serverChanged","includeIssues","serverSubscription","endpointServerChangedSubscribe","augmentNextConfig","originalNextConfig","reactCompilerOptions","experimental","reactCompiler","ruleKeys","turbo","rules","key","browser","foreign","loaders","getReactCompilerLoader","nextConfigSerializable","generateBuildId","exportPathMap","webpack","ensureLoadersHaveSerializableOptions","modularizeImports","fromEntries","mod","images","loaderFile","relative","turbopackRules","glob","rule","checkLoaderItems","checkConfigItem","inner","loaderItems","loaderItem","isDeepStrictEqual","loader","routes","Map","pathname","nativeRoute","route","routeType","type","htmlEndpoint","dataEndpoint","endpoint","pages","page","originalName","rscEndpoint","_exhaustiveCheck","set","napiMiddlewareToMiddleware","middleware","runtime","matcher","napiInstrumentationToInstrumentation","instrumentation","nodeJs","pagesDocumentEndpoint","pagesAppEndpoint","pagesErrorEndpoint","issues","diagnostics","createProject","turboEngineOptions","projectNew","importPath","pkg","pkgPath","pathToFileURL","toString","default","css","lightning","_options","transformStyleAttr","src","minifySync","parseSync","getTargetTriple","_turboEngineOptions","startTurbopackTraceServer","_traceFilePath","mdx","compile","mdxCompile","getMdxOptions","compileSync","mdxCompileSync","code","message","customBindings","NEXT_TEST_NATIVE_DIR","isModule","Buffer","isBuffer","jsc","parser","syntax","toBuffer","traceFilePath","transformOptions","lightningCssTransform","transformAttrOptions","lightningCssTransformStyleAttribute","development","jsx","mdxType","t","from","parserOptions","getParserOptions","astStr","target","traceFileName","once","executed"],"mappings":"AAAA,0DAA0D;;;;;;;;;;;;;;;;;;;;;;;;;IAgY1CA,eAAe;eAAfA;;IA+6BAC,iBAAiB;eAAjBA;;IA5uCAC,uBAAuB;eAAvBA;;IA6vCAC,yBAAyB;eAAzBA;;IAhDMC,MAAM;eAANA;;IApmCAC,YAAY;eAAZA;;IAFTC,oBAAoB;eAApBA;;IAqnCSC,MAAM;eAANA;;IAQAC,KAAK;eAALA;;IAsDTC,uBAAuB;eAAvBA;;IAxESC,SAAS;eAATA;;IAKNC,aAAa;eAAbA;;;6DAzxCC;qBACa;oBACC;yBACK;6DACf;yBACY;gCACG;wCACG;6BACgB;sBAQrB;iCAI3B;sCACgC;uBAqBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOvC,MAAMC,cAAcC,QAAQC,GAAG,CAACC,cAAc;AAE9C,MAAMC,WAAWC,IAAAA,QAAI;AACrB,MAAMC,eAAeC,IAAAA,YAAQ;AAE7B,SAASC,QAAQ,GAAGC,IAAW;IAC7B,IAAIR,QAAQC,GAAG,CAACQ,yBAAyB,EAAE;QACzC;IACF;IACA,IAAIT,QAAQC,GAAG,CAACS,KAAK,EAAE;QACrBC,KAAIC,IAAI,IAAI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XrO,IAAI,CAAC,CAACuO,SAAgBtK,KAAK7K,KAAK,CAACmV;AACtC;AAEO,SAAS1V;QASJsG;IARV,IAAIA;IACJ,IAAI;QACFA,WAAWlB;IACb,EAAE,OAAOqF,GAAG;IACV,sEAAsE;IACxE;IAEA,OAAO;QACLkL,MAAM,EAAErP,6BAAAA,4BAAAA,SAAUmN,eAAe,qBAAzBnN,+BAAAA;IACV;AACF;AAMO,SAASpG,0BAA0B0V,aAAsB;IAC9D,IAAItS,oBAAoB;QACtB,6CAA6C;QAC7C,IAAIgD,WAAWlB;QACf9B,qBAAqBgD,SAASpG,yBAAyB,oBAAlCoG,SAASpG,yBAAyB,MAAlCoG,UAAqCsP;IAC5D;AACF;AAEA,SAASC,KAAKrM,EAAc;IAC1B,IAAIsM,WAAW;IAEf,OAAO;QACL,IAAI,CAACA,UAAU;YACbA,WAAW;YAEXtM;QACF;IACF;AACF;AAWO,MAAMhJ,0BAA0BqV,KAAK;IAC1C,IAAI;QACF,IAAIvP,WAAWlB;QACf,IAAI9B,oBAAoB;YACtBgD,SAAS9F,uBAAuB,oBAAhC8F,SAAS9F,uBAAuB,MAAhC8F,UAAmChD;QACrC;IACF,EAAE,OAAOmH,GAAG;IACV,sEAAsE;IACxE;AACF"}
|
@@ -155,6 +155,7 @@ export interface UpdateInfo {
|
|
155
155
|
}
|
156
156
|
export interface Project {
|
157
157
|
update(options: Partial<ProjectOptions>): Promise<void>;
|
158
|
+
writeAllEntrypointsToDisk(appDirOnly: boolean): Promise<TurbopackResult<RawEntrypoints>>;
|
158
159
|
entrypointsSubscribe(): AsyncIterableIterator<TurbopackResult<RawEntrypoints>>;
|
159
160
|
hmrEvents(identifier: string): AsyncIterableIterator<TurbopackResult<Update>>;
|
160
161
|
hmrIdentifiersSubscribe(): AsyncIterableIterator<TurbopackResult<HmrIdentifiers>>;
|
@@ -29,11 +29,8 @@ const _turbopackwarning = require("../../lib/turbopack-warning");
|
|
29
29
|
const _utils = require("../../shared/lib/turbopack/utils");
|
30
30
|
const _buildcontext = require("../build-context");
|
31
31
|
const _swc = require("../swc");
|
32
|
-
const _asyncsema = require("next/dist/compiled/async-sema");
|
33
32
|
const _handleentrypoints = require("../handle-entrypoints");
|
34
33
|
const _manifestloader = require("../../shared/lib/turbopack/manifest-loader");
|
35
|
-
const _progress = require("../progress");
|
36
|
-
const _log = /*#__PURE__*/ _interop_require_wildcard(require("../output/log"));
|
37
34
|
const _fs = require("fs");
|
38
35
|
const _constants = require("../../shared/lib/constants");
|
39
36
|
const _config = /*#__PURE__*/ _interop_require_default(require("../../server/config"));
|
@@ -45,47 +42,6 @@ function _interop_require_default(obj) {
|
|
45
42
|
default: obj
|
46
43
|
};
|
47
44
|
}
|
48
|
-
function _getRequireWildcardCache(nodeInterop) {
|
49
|
-
if (typeof WeakMap !== "function") return null;
|
50
|
-
var cacheBabelInterop = new WeakMap();
|
51
|
-
var cacheNodeInterop = new WeakMap();
|
52
|
-
return (_getRequireWildcardCache = function(nodeInterop) {
|
53
|
-
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
54
|
-
})(nodeInterop);
|
55
|
-
}
|
56
|
-
function _interop_require_wildcard(obj, nodeInterop) {
|
57
|
-
if (!nodeInterop && obj && obj.__esModule) {
|
58
|
-
return obj;
|
59
|
-
}
|
60
|
-
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
61
|
-
return {
|
62
|
-
default: obj
|
63
|
-
};
|
64
|
-
}
|
65
|
-
var cache = _getRequireWildcardCache(nodeInterop);
|
66
|
-
if (cache && cache.has(obj)) {
|
67
|
-
return cache.get(obj);
|
68
|
-
}
|
69
|
-
var newObj = {
|
70
|
-
__proto__: null
|
71
|
-
};
|
72
|
-
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
73
|
-
for(var key in obj){
|
74
|
-
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
75
|
-
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
76
|
-
if (desc && (desc.get || desc.set)) {
|
77
|
-
Object.defineProperty(newObj, key, desc);
|
78
|
-
} else {
|
79
|
-
newObj[key] = obj[key];
|
80
|
-
}
|
81
|
-
}
|
82
|
-
}
|
83
|
-
newObj.default = obj;
|
84
|
-
if (cache) {
|
85
|
-
cache.set(obj, newObj);
|
86
|
-
}
|
87
|
-
return newObj;
|
88
|
-
}
|
89
45
|
const IS_TURBOPACK_BUILD = process.env.TURBOPACK && process.env.TURBOPACK_BUILD;
|
90
46
|
async function turbopackBuild() {
|
91
47
|
var _config_experimental, _config_experimental_turbo, _config_experimental1, _config_experimental_turbo1;
|
@@ -160,150 +116,67 @@ async function turbopackBuild() {
|
|
160
116
|
type: 'commonjs'
|
161
117
|
}, null, 2));
|
162
118
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
163
|
-
const
|
164
|
-
const currentEntrypoints = {
|
165
|
-
global: {
|
166
|
-
app: undefined,
|
167
|
-
document: undefined,
|
168
|
-
error: undefined,
|
169
|
-
middleware: undefined,
|
170
|
-
instrumentation: undefined
|
171
|
-
},
|
172
|
-
app: new Map(),
|
173
|
-
page: new Map()
|
174
|
-
};
|
175
|
-
const currentEntryIssues = new Map();
|
119
|
+
const entrypoints = await project.writeAllEntrypointsToDisk(appDirOnly);
|
176
120
|
const manifestLoader = new _manifestloader.TurbopackManifestLoader({
|
177
121
|
buildId,
|
178
122
|
distDir,
|
179
123
|
encryptionKey
|
180
124
|
});
|
181
|
-
const entrypointsResult = await entrypointsSubscription.next();
|
182
|
-
if (entrypointsResult.done) {
|
183
|
-
throw Object.defineProperty(new Error('Turbopack did not return any entrypoints'), "__NEXT_ERROR_CODE", {
|
184
|
-
value: "E275",
|
185
|
-
enumerable: false,
|
186
|
-
configurable: true
|
187
|
-
});
|
188
|
-
}
|
189
|
-
entrypointsSubscription.return == null ? void 0 : entrypointsSubscription.return.call(entrypointsSubscription).catch(()=>{});
|
190
|
-
const entrypoints = entrypointsResult.value;
|
191
125
|
const topLevelErrors = [];
|
126
|
+
const topLevelWarnings = [];
|
192
127
|
for (const issue of entrypoints.issues){
|
193
|
-
|
194
|
-
|
195
|
-
})
|
128
|
+
if (issue.severity === 'error' || issue.severity === 'fatal') {
|
129
|
+
topLevelErrors.push((0, _utils.formatIssue)(issue));
|
130
|
+
} else if ((0, _utils.isRelevantWarning)(issue)) {
|
131
|
+
topLevelWarnings.push((0, _utils.formatIssue)(issue));
|
132
|
+
}
|
133
|
+
}
|
134
|
+
if (topLevelWarnings.length > 0) {
|
135
|
+
console.warn(`Turbopack build encountered ${topLevelWarnings.length} warnings:\n${topLevelWarnings.join('\n')}`);
|
196
136
|
}
|
197
137
|
if (topLevelErrors.length > 0) {
|
198
|
-
throw Object.defineProperty(new Error(`Turbopack build failed with ${topLevelErrors.length}
|
199
|
-
value: "
|
138
|
+
throw Object.defineProperty(new Error(`Turbopack build failed with ${topLevelErrors.length} errors:\n${topLevelErrors.join('\n')}`), "__NEXT_ERROR_CODE", {
|
139
|
+
value: "E425",
|
200
140
|
enumerable: false,
|
201
141
|
configurable: true
|
202
142
|
});
|
203
143
|
}
|
204
|
-
await (0, _handleentrypoints.
|
205
|
-
entrypoints,
|
206
|
-
currentEntrypoints,
|
207
|
-
currentEntryIssues,
|
208
|
-
manifestLoader,
|
209
|
-
productionRewrites: rewrites,
|
210
|
-
logErrors: false
|
211
|
-
});
|
212
|
-
const progress = (0, _progress.createProgress)(currentEntrypoints.page.size + currentEntrypoints.app.size + 1, 'Building');
|
144
|
+
const currentEntrypoints = await (0, _handleentrypoints.rawEntrypointsToEntrypoints)(entrypoints);
|
213
145
|
const promises = [];
|
214
|
-
// Concurrency will start at INITIAL_CONCURRENCY and
|
215
|
-
// slowly ramp up to CONCURRENCY by increasing the
|
216
|
-
// concurrency by 1 every time a task is completed.
|
217
|
-
const INITIAL_CONCURRENCY = 5;
|
218
|
-
const CONCURRENCY = 10;
|
219
|
-
const sema = new _asyncsema.Sema(INITIAL_CONCURRENCY);
|
220
|
-
let remainingRampup = CONCURRENCY - INITIAL_CONCURRENCY;
|
221
|
-
const enqueue = (fn)=>{
|
222
|
-
promises.push((async ()=>{
|
223
|
-
await sema.acquire();
|
224
|
-
try {
|
225
|
-
await fn();
|
226
|
-
} finally{
|
227
|
-
sema.release();
|
228
|
-
if (remainingRampup > 0) {
|
229
|
-
remainingRampup--;
|
230
|
-
sema.release();
|
231
|
-
}
|
232
|
-
progress.run();
|
233
|
-
}
|
234
|
-
})());
|
235
|
-
};
|
236
146
|
if (!appDirOnly) {
|
237
147
|
for (const [page, route] of currentEntrypoints.page){
|
238
|
-
|
239
|
-
page,
|
240
|
-
route,
|
241
|
-
currentEntryIssues,
|
242
|
-
entrypoints: currentEntrypoints,
|
243
|
-
manifestLoader,
|
244
|
-
productionRewrites: rewrites,
|
245
|
-
logErrors: false
|
246
|
-
}));
|
247
|
-
}
|
248
|
-
}
|
249
|
-
for (const [page, route] of currentEntrypoints.app){
|
250
|
-
enqueue(()=>(0, _handleentrypoints.handleRouteType)({
|
148
|
+
promises.push((0, _handleentrypoints.handleRouteType)({
|
251
149
|
page,
|
252
150
|
route,
|
253
|
-
|
254
|
-
entrypoints: currentEntrypoints,
|
255
|
-
manifestLoader,
|
256
|
-
productionRewrites: rewrites,
|
257
|
-
logErrors: false
|
151
|
+
manifestLoader
|
258
152
|
}));
|
153
|
+
}
|
259
154
|
}
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
logErrors: false
|
155
|
+
for (const [page, route] of currentEntrypoints.app){
|
156
|
+
promises.push((0, _handleentrypoints.handleRouteType)({
|
157
|
+
page,
|
158
|
+
route,
|
159
|
+
manifestLoader
|
266
160
|
}));
|
161
|
+
}
|
267
162
|
await Promise.all(promises);
|
163
|
+
await Promise.all([
|
164
|
+
manifestLoader.loadBuildManifest('_app'),
|
165
|
+
manifestLoader.loadPagesManifest('_app'),
|
166
|
+
manifestLoader.loadFontManifest('_app'),
|
167
|
+
manifestLoader.loadPagesManifest('_document'),
|
168
|
+
manifestLoader.loadBuildManifest('_error'),
|
169
|
+
manifestLoader.loadPagesManifest('_error'),
|
170
|
+
manifestLoader.loadFontManifest('_error'),
|
171
|
+
entrypoints.instrumentation && manifestLoader.loadMiddlewareManifest('instrumentation', 'instrumentation'),
|
172
|
+
entrypoints.middleware && await manifestLoader.loadMiddlewareManifest('middleware', 'middleware')
|
173
|
+
]);
|
268
174
|
await manifestLoader.writeManifests({
|
269
175
|
devRewrites: undefined,
|
270
176
|
productionRewrites: rewrites,
|
271
177
|
entrypoints: currentEntrypoints
|
272
178
|
});
|
273
|
-
const errors = [];
|
274
|
-
const warnings = [];
|
275
|
-
for (const [page, entryIssues] of currentEntryIssues){
|
276
|
-
for (const issue of entryIssues.values()){
|
277
|
-
if (issue.severity !== 'warning') {
|
278
|
-
errors.push({
|
279
|
-
page,
|
280
|
-
message: (0, _utils.formatIssue)(issue)
|
281
|
-
});
|
282
|
-
} else {
|
283
|
-
if ((0, _utils.isRelevantWarning)(issue)) {
|
284
|
-
warnings.push({
|
285
|
-
page,
|
286
|
-
message: (0, _utils.formatIssue)(issue)
|
287
|
-
});
|
288
|
-
}
|
289
|
-
}
|
290
|
-
}
|
291
|
-
}
|
292
179
|
const shutdownPromise = project.shutdown();
|
293
|
-
if (warnings.length > 0) {
|
294
|
-
_log.warn(`Turbopack build collected ${warnings.length} warnings:\n${warnings.map((e)=>{
|
295
|
-
return 'Page: ' + e.page + '\n' + e.message;
|
296
|
-
}).join('\n')}`);
|
297
|
-
}
|
298
|
-
if (errors.length > 0) {
|
299
|
-
throw Object.defineProperty(new Error(`Turbopack build failed with ${errors.length} errors:\n${errors.map((e)=>{
|
300
|
-
return 'Page: ' + e.page + '\n' + e.message;
|
301
|
-
}).join('\n')}`), "__NEXT_ERROR_CODE", {
|
302
|
-
value: "E425",
|
303
|
-
enumerable: false,
|
304
|
-
configurable: true
|
305
|
-
});
|
306
|
-
}
|
307
180
|
const time = process.hrtime(startTime);
|
308
181
|
return {
|
309
182
|
duration: time[0] + time[1] / 1e9,
|