next 15.2.2-canary.6 → 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.

Files changed (75) hide show
  1. package/dist/bin/next +1 -1
  2. package/dist/build/handle-entrypoints.d.ts +3 -23
  3. package/dist/build/handle-entrypoints.js +36 -149
  4. package/dist/build/handle-entrypoints.js.map +1 -1
  5. package/dist/build/index.js +2 -2
  6. package/dist/build/swc/generated-native.d.ts +4 -0
  7. package/dist/build/swc/index.js +77 -68
  8. package/dist/build/swc/index.js.map +1 -1
  9. package/dist/build/swc/types.d.ts +1 -0
  10. package/dist/build/turbopack-build/impl.js +33 -160
  11. package/dist/build/turbopack-build/impl.js.map +1 -1
  12. package/dist/build/webpack-config.js +2 -2
  13. package/dist/client/app-bootstrap.js +1 -1
  14. package/dist/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/next-logo.js +3 -5
  15. package/dist/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/next-logo.js.map +1 -1
  16. package/dist/client/components/react-dev-overlay/ui/components/errors/error-overlay-layout/error-overlay-layout.d.ts +1 -1
  17. package/dist/client/components/react-dev-overlay/ui/components/errors/error-overlay-nav/error-overlay-nav.d.ts +1 -1
  18. package/dist/client/components/react-dev-overlay/ui/components/errors/error-overlay-nav/error-overlay-nav.js +1 -1
  19. package/dist/client/components/react-dev-overlay/ui/components/errors/error-overlay-nav/error-overlay-nav.js.map +1 -1
  20. package/dist/client/components/react-dev-overlay/ui/styles/base.js +1 -1
  21. package/dist/client/components/react-dev-overlay/ui/styles/base.js.map +1 -1
  22. package/dist/client/index.js +1 -1
  23. package/dist/compiled/next-server/app-page-experimental.runtime.dev.js +2 -2
  24. package/dist/compiled/next-server/app-page-experimental.runtime.dev.js.map +1 -1
  25. package/dist/compiled/next-server/app-page.runtime.dev.js +2 -2
  26. package/dist/compiled/next-server/app-page.runtime.dev.js.map +1 -1
  27. package/dist/esm/build/handle-entrypoints.js +31 -140
  28. package/dist/esm/build/handle-entrypoints.js.map +1 -1
  29. package/dist/esm/build/index.js +2 -2
  30. package/dist/esm/build/swc/generated-native.d.ts +4 -0
  31. package/dist/esm/build/swc/index.js +77 -68
  32. package/dist/esm/build/swc/index.js.map +1 -1
  33. package/dist/esm/build/swc/types.js.map +1 -1
  34. package/dist/esm/build/turbopack-build/impl.js +34 -120
  35. package/dist/esm/build/turbopack-build/impl.js.map +1 -1
  36. package/dist/esm/build/webpack-config.js +2 -2
  37. package/dist/esm/client/app-bootstrap.js +1 -1
  38. package/dist/esm/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/next-logo.js +3 -5
  39. package/dist/esm/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/next-logo.js.map +1 -1
  40. package/dist/esm/client/components/react-dev-overlay/ui/components/errors/error-overlay-nav/error-overlay-nav.js +1 -1
  41. package/dist/esm/client/components/react-dev-overlay/ui/components/errors/error-overlay-nav/error-overlay-nav.js.map +1 -1
  42. package/dist/esm/client/components/react-dev-overlay/ui/styles/base.js +1 -1
  43. package/dist/esm/client/components/react-dev-overlay/ui/styles/base.js.map +1 -1
  44. package/dist/esm/client/index.js +1 -1
  45. package/dist/esm/server/dev/hot-reloader-turbopack.js +1 -1
  46. package/dist/esm/server/dev/hot-reloader-webpack.js +1 -1
  47. package/dist/esm/server/lib/app-info-log.js +1 -1
  48. package/dist/esm/server/lib/start-server.js +1 -1
  49. package/dist/esm/shared/lib/canary-only.js +1 -1
  50. package/dist/esm/shared/lib/get-img-props.js +11 -1
  51. package/dist/esm/shared/lib/get-img-props.js.map +1 -1
  52. package/dist/esm/shared/lib/turbopack/manifest-loader.js +24 -14
  53. package/dist/esm/shared/lib/turbopack/manifest-loader.js.map +1 -1
  54. package/dist/server/dev/hot-reloader-turbopack.js +1 -1
  55. package/dist/server/dev/hot-reloader-webpack.js +1 -1
  56. package/dist/server/lib/app-info-log.js +1 -1
  57. package/dist/server/lib/start-server.js +1 -1
  58. package/dist/shared/lib/canary-only.js +1 -1
  59. package/dist/shared/lib/get-img-props.d.ts +2 -1
  60. package/dist/shared/lib/get-img-props.js +11 -1
  61. package/dist/shared/lib/get-img-props.js.map +1 -1
  62. package/dist/shared/lib/turbopack/manifest-loader.d.ts +4 -1
  63. package/dist/shared/lib/turbopack/manifest-loader.js +24 -14
  64. package/dist/shared/lib/turbopack/manifest-loader.js.map +1 -1
  65. package/dist/telemetry/anonymous-meta.js +1 -1
  66. package/dist/telemetry/events/build.d.ts +2 -1
  67. package/dist/telemetry/events/build.js +2 -1
  68. package/dist/telemetry/events/build.js.map +1 -1
  69. package/dist/telemetry/events/session-stopped.d.ts +2 -1
  70. package/dist/telemetry/events/session-stopped.js +4 -3
  71. package/dist/telemetry/events/session-stopped.js.map +1 -1
  72. package/dist/telemetry/events/version.d.ts +2 -1
  73. package/dist/telemetry/events/version.js +3 -2
  74. package/dist/telemetry/events/version.js.map +1 -1
  75. 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":["path","pathToFileURL","arch","platform","platformArchTriples","Log","getParserOptions","eventSwcLoadFailure","patchIncorrectLockfile","downloadNativeNextSwc","downloadWasmSwc","isDeepStrictEqual","getDefineEnv","getReactCompilerLoader","TurbopackInternalError","nextVersion","process","env","__NEXT_VERSION","ArchName","PlatformName","infoLog","args","NEXT_PRIVATE_BUILD_WORKER","DEBUG","info","getSupportedArchTriples","darwin","win32","linux","freebsd","android","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","lockfilePatchPromise","loadBindings","useWasmBinary","RUST_MIN_STACK","stdout","_handle","setBlocking","stderr","Promise","resolve","_reject","cur","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","join","dirname","require","map","platformArchABI","push","bindings","loadWasm","wasm","nativeBindingsErrorCode","wasmDirectory","attempt","loadBindingsSync","Error","cause","loggingLoadFailure","triedWasm","then","finally","exit","createDefineEnv","isTurbopack","clientRouterFilters","config","dev","distDir","fetchCacheKeyPrefix","hasRewrites","middlewareMatchers","defineEnv","client","edge","nodejs","variant","Object","keys","rustifyEnv","isClient","isEdgeServer","isNodeOrEdgeCompilation","isNodeServer","entries","_","value","name","bindingToApi","binding","_wasm","cancel","Cancel","invariant","never","computeMessage","withErrorCause","fn","nativeError","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","nextConfigSerializable","generateBuildId","exportPathMap","webpack","ensureLoadersHaveSerializableOptions","modularizeImports","fromEntries","mod","transform","images","loaderFile","relative","turbopackRules","glob","rule","checkLoaderItems","checkConfigItem","inner","loaderItems","loaderItem","parse","loader","createProject","turboEngineOptions","projectNew","importPath","pkg","pkgPath","toString","default","css","lightning","_options","transformStyleAttr","isWasm","src","transformSync","minify","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","initCustomTraceSubscriber","teardownTraceSubscriber","traceFilePath","transformOptions","lightningCssTransform","transformAttrOptions","lightningCssTransformStyleAttribute","development","jsx","mdxType","t","from","parserOptions","astStr","getBinaryMetadata","target","traceFileName","once","executed"],"mappings":"AAAA,0DAA0D,GAC1D,OAAOA,UAAU,OAAM;AACvB,SAASC,aAAa,QAAQ,MAAK;AACnC,SAASC,IAAI,EAAEC,QAAQ,QAAQ,KAAI;AACnC,SAASC,mBAAmB,QAAQ,sCAAqC;AACzE,YAAYC,SAAS,gBAAe;AACpC,SAASC,gBAAgB,QAAQ,YAAW;AAC5C,SAASC,mBAAmB,QAAQ,0CAAyC;AAC7E,SAASC,sBAAsB,QAAQ,qCAAoC;AAC3E,SAASC,qBAAqB,EAAEC,eAAe,QAAQ,yBAAwB;AAQ/E,SAASC,iBAAiB,QAAQ,OAAM;AACxC,SAEEC,YAAY,QACP,uCAAsC;AAC7C,SAASC,sBAAsB,QAAQ,6BAA4B;AAoBnE,SAASC,sBAAsB,QAAQ,mCAAkC;AAOzE,MAAMC,cAAcC,QAAQC,GAAG,CAACC,cAAc;AAE9C,MAAMC,WAAWjB;AACjB,MAAMkB,eAAejB;AAErB,SAASkB,QAAQ,GAAGC,IAAW;IAC7B,IAAIN,QAAQC,GAAG,CAACM,yBAAyB,EAAE;QACzC;IACF;IACA,IAAIP,QAAQC,GAAG,CAACO,KAAK,EAAE;QACrBnB,IAAIoB,IAAI,IAAIH;IACd;AACF;AAEA;;CAEC,GACD,OAAO,SAASI;IACd,MAAM,EAAEC,MAAM,EAAEC,KAAK,EAAEC,KAAK,EAAEC,OA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ASC,KAAKnM,EAAc;IAC1B,IAAIoM,WAAW;IAEf,OAAO;QACL,IAAI,CAACA,UAAU;YACbA,WAAW;YAEXpM;QACF;IACF;AACF;AAEA;;;;;;;;CAQC,GACD,OAAO,MAAMmL,0BAA0BgB,KAAK;IAC1C,IAAI;QACF,IAAInP,WAAWhB;QACf,IAAI/B,oBAAoB;YACtB+C,SAASmO,uBAAuB,oBAAhCnO,SAASmO,uBAAuB,MAAhCnO,UAAmC/C;QACrC;IACF,EAAE,OAAO+G,GAAG;IACV,sEAAsE;IACxE;AACF,GAAE"}
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":["path","pathToFileURL","arch","platform","platformArchTriples","Log","getParserOptions","eventSwcLoadFailure","patchIncorrectLockfile","downloadNativeNextSwc","downloadWasmSwc","isDeepStrictEqual","getDefineEnv","getReactCompilerLoader","TurbopackInternalError","nextVersion","process","env","__NEXT_VERSION","ArchName","PlatformName","infoLog","args","NEXT_PRIVATE_BUILD_WORKER","DEBUG","info","getSupportedArchTriples","darwin","win32","linux","freebsd","android","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","lockfilePatchPromise","loadBindings","useWasmBinary","RUST_MIN_STACK","stdout","_handle","setBlocking","stderr","Promise","resolve","_reject","cur","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","join","dirname","require","map","platformArchABI","push","bindings","loadWasm","wasm","nativeBindingsErrorCode","wasmDirectory","attempt","loadBindingsSync","Error","cause","loggingLoadFailure","triedWasm","then","finally","exit","createDefineEnv","isTurbopack","clientRouterFilters","config","dev","distDir","fetchCacheKeyPrefix","hasRewrites","middlewareMatchers","defineEnv","client","edge","nodejs","variant","Object","keys","rustifyEnv","isClient","isEdgeServer","isNodeOrEdgeCompilation","isNodeServer","entries","_","value","name","bindingToApi","binding","_wasm","cancel","Cancel","invariant","never","computeMessage","withErrorCause","fn","nativeError","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","nextConfigSerializable","generateBuildId","exportPathMap","webpack","ensureLoadersHaveSerializableOptions","modularizeImports","fromEntries","mod","transform","images","loaderFile","relative","turbopackRules","glob","rule","checkLoaderItems","checkConfigItem","inner","loaderItems","loaderItem","parse","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","toString","default","css","lightning","_options","transformStyleAttr","isWasm","src","transformSync","minify","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","initCustomTraceSubscriber","teardownTraceSubscriber","traceFilePath","transformOptions","lightningCssTransform","transformAttrOptions","lightningCssTransformStyleAttribute","development","jsx","mdxType","t","from","parserOptions","astStr","getBinaryMetadata","target","traceFileName","once","executed"],"mappings":"AAAA,0DAA0D,GAC1D,OAAOA,UAAU,OAAM;AACvB,SAASC,aAAa,QAAQ,MAAK;AACnC,SAASC,IAAI,EAAEC,QAAQ,QAAQ,KAAI;AACnC,SAASC,mBAAmB,QAAQ,sCAAqC;AACzE,YAAYC,SAAS,gBAAe;AACpC,SAASC,gBAAgB,QAAQ,YAAW;AAC5C,SAASC,mBAAmB,QAAQ,0CAAyC;AAC7E,SAASC,sBAAsB,QAAQ,qCAAoC;AAC3E,SAASC,qBAAqB,EAAEC,eAAe,QAAQ,yBAAwB;AAQ/E,SAASC,iBAAiB,QAAQ,OAAM;AACxC,SAEEC,YAAY,QACP,uCAAsC;AAC7C,SAASC,sBAAsB,QAAQ,6BAA4B;AAqBnE,SAASC,sBAAsB,QAAQ,mCAAkC;AAOzE,MAAMC,cAAcC,QAAQC,GAAG,CAACC,cAAc;AAE9C,MAAMC,WAAWjB;AACjB,MAAMkB,eAAejB;AAErB,SAASkB,QAAQ,GAAGC,IAAW;IAC7B,IAAIN,QAAQC,GAAG,CAACM,yBAAyB,EAAE;QACzC;IACF;IACA,IAAIP,QAAQC,G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IARV,IAAIA;IACJ,IAAI;QACFA,WAAWhB;IACb,EAAE,OAAOgF,GAAG;IACV,sEAAsE;IACxE;IAEA,OAAO;QACLsL,MAAM,EAAEtP,6BAAAA,4BAAAA,SAAUkN,eAAe,qBAAzBlN,+BAAAA;IACV;AACF;AAEA;;;CAGC,GACD,OAAO,SAASuO,0BAA0BgB,aAAsB;IAC9D,IAAItS,oBAAoB;QACtB,6CAA6C;QAC7C,IAAI+C,WAAWhB;QACf/B,qBAAqB+C,SAASuO,yBAAyB,oBAAlCvO,SAASuO,yBAAyB,MAAlCvO,UAAqCuP;IAC5D;AACF;AAEA,SAASC,KAAKxM,EAAc;IAC1B,IAAIyM,WAAW;IAEf,OAAO;QACL,IAAI,CAACA,UAAU;YACbA,WAAW;YAEXzM;QACF;IACF;AACF;AAEA;;;;;;;;CAQC,GACD,OAAO,MAAMwL,0BAA0BgB,KAAK;IAC1C,IAAI;QACF,IAAIxP,WAAWhB;QACf,IAAI/B,oBAAoB;YACtB+C,SAASwO,uBAAuB,oBAAhCxO,SAASwO,uBAAuB,MAAhCxO,UAAmC/C;QACrC;IACF,EAAE,OAAO+G,GAAG;IACV,sEAAsE;IACxE;AACF,GAAE"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/build/swc/types.ts"],"sourcesContent":["import type { NextConfigComplete } from '../../server/config-shared'\nimport type { __ApiPreviewProps } from '../../server/api-utils'\nimport type {\n ExternalObject,\n RefCell,\n NapiTurboEngineOptions,\n} from './generated-native'\n\nexport type { NapiTurboEngineOptions as TurboEngineOptions }\n\nexport interface Binding {\n isWasm: boolean\n turbo: {\n createProject(\n options: ProjectOptions,\n turboEngineOptions?: NapiTurboEngineOptions\n ): Promise<Project>\n startTurbopackTraceServer(traceFilePath: string): void\n\n nextBuild?: any\n }\n mdx: {\n compile(src: string, options: any): any\n compileSync(src: string, options: any): any\n }\n minify(src: string, options: any): Promise<any>\n minifySync(src: string, options: any): any\n transform(src: string, options: any): Promise<any>\n transformSync(src: string, options: any): any\n parse(src: string, options: any): Promise<string>\n\n getTargetTriple(): string | undefined\n\n initCustomTraceSubscriber?(traceOutFilePath?: string): ExternalObject<RefCell>\n teardownTraceSubscriber?(guardExternal: ExternalObject<RefCell>): void\n css: {\n lightning: {\n transform(transformOptions: any): Promise<any>\n transformStyleAttr(transformAttrOptions: any): Promise<any>\n }\n }\n}\n\nexport type StyledString =\n | {\n type: 'text'\n value: string\n }\n | {\n type: 'code'\n value: string\n }\n | {\n type: 'strong'\n value: string\n }\n | {\n type: 'stack'\n value: StyledString[]\n }\n | {\n type: 'line'\n value: StyledString[]\n }\n\nexport interface Issue {\n severity: string\n stage: string\n filePath: string\n title: StyledString\n description?: StyledString\n detail?: StyledString\n source?: {\n source: {\n ident: string\n content?: string\n }\n range?: {\n start: {\n // 0-indexed\n line: number\n // 0-indexed\n column: number\n }\n end: {\n // 0-indexed\n line: number\n // 0-indexed\n column: number\n }\n }\n }\n documentationLink: string\n subIssues: Issue[]\n}\n\nexport interface Diagnostics {\n category: string\n name: string\n payload: unknown\n}\n\nexport type TurbopackResult<T = {}> = T & {\n issues: Issue[]\n diagnostics: Diagnostics[]\n}\n\nexport interface Middleware {\n endpoint: Endpoint\n}\n\nexport interface Instrumentation {\n nodeJs: Endpoint\n edge: Endpoint\n}\n\nexport interface RawEntrypoints {\n routes: Map<string, Route>\n middleware?: Middleware\n instrumentation?: Instrumentation\n pagesDocumentEndpoint: Endpoint\n pagesAppEndpoint: Endpoint\n pagesErrorEndpoint: Endpoint\n}\n\ninterface BaseUpdate {\n resource: {\n headers: unknown\n path: string\n }\n diagnostics: unknown[]\n issues: Issue[]\n}\n\ninterface IssuesUpdate extends BaseUpdate {\n type: 'issues'\n}\n\ninterface EcmascriptMergedUpdate {\n type: 'EcmascriptMergedUpdate'\n chunks: { [moduleName: string]: { type: 'partial' } }\n entries: { [moduleName: string]: { code: string; map: string; url: string } }\n}\n\ninterface PartialUpdate extends BaseUpdate {\n type: 'partial'\n instruction: {\n type: 'ChunkListUpdate'\n merged: EcmascriptMergedUpdate[] | undefined\n }\n}\n\nexport type Update = IssuesUpdate | PartialUpdate\n\nexport interface HmrIdentifiers {\n identifiers: string[]\n}\n\n/** @see https://github.com/vercel/next.js/blob/415cd74b9a220b6f50da64da68c13043e9b02995/packages/next-swc/crates/napi/src/next_api/project.rs#L824-L833 */\nexport interface TurbopackStackFrame {\n isServer: boolean\n isInternal?: boolean\n file: string\n originalFile?: string\n /** 1-indexed, unlike source map tokens */\n line?: number\n /** 1-indexed, unlike source map tokens */\n column?: number\n methodName?: string\n}\n\nexport type UpdateMessage =\n | {\n updateType: 'start'\n }\n | {\n updateType: 'end'\n value: UpdateInfo\n }\n\nexport interface UpdateInfo {\n duration: number\n tasks: number\n}\n\nexport interface Project {\n update(options: Partial<ProjectOptions>): Promise<void>\n\n entrypointsSubscribe(): AsyncIterableIterator<TurbopackResult<RawEntrypoints>>\n\n hmrEvents(identifier: string): AsyncIterableIterator<TurbopackResult<Update>>\n\n hmrIdentifiersSubscribe(): AsyncIterableIterator<\n TurbopackResult<HmrIdentifiers>\n >\n\n getSourceForAsset(filePath: string): Promise<string | null>\n\n getSourceMap(filePath: string): Promise<string | null>\n getSourceMapSync(filePath: string): string | null\n\n traceSource(\n stackFrame: TurbopackStackFrame,\n currentDirectoryFileUrl: string\n ): Promise<TurbopackStackFrame | null>\n\n updateInfoSubscribe(\n aggregationMs: number\n ): AsyncIterableIterator<TurbopackResult<UpdateMessage>>\n\n shutdown(): Promise<void>\n\n onExit(): Promise<void>\n}\n\nexport type Route =\n | {\n type: 'conflict'\n }\n | {\n type: 'app-page'\n pages: {\n originalName: string\n htmlEndpoint: Endpoint\n rscEndpoint: Endpoint\n }[]\n }\n | {\n type: 'app-route'\n originalName: string\n endpoint: Endpoint\n }\n | {\n type: 'page'\n htmlEndpoint: Endpoint\n dataEndpoint: Endpoint\n }\n | {\n type: 'page-api'\n endpoint: Endpoint\n }\n\nexport interface Endpoint {\n /** Write files for the endpoint to disk. */\n writeToDisk(): Promise<TurbopackResult<WrittenEndpoint>>\n\n /**\n * Listen to client-side changes to the endpoint.\n * After clientChanged() has been awaited it will listen to changes.\n * The async iterator will yield for each change.\n */\n clientChanged(): Promise<AsyncIterableIterator<TurbopackResult>>\n\n /**\n * Listen to server-side changes to the endpoint.\n * After serverChanged() has been awaited it will listen to changes.\n * The async iterator will yield for each change.\n */\n serverChanged(\n includeIssues: boolean\n ): Promise<AsyncIterableIterator<TurbopackResult>>\n}\n\ninterface EndpointConfig {\n dynamic?: 'auto' | 'force-dynamic' | 'error' | 'force-static'\n dynamicParams?: boolean\n revalidate?: 'never' | 'force-cache' | number\n fetchCache?:\n | 'auto'\n | 'default-cache'\n | 'only-cache'\n | 'force-cache'\n | 'default-no-store'\n | 'only-no-store'\n | 'force-no-store'\n runtime?: 'nodejs' | 'edge'\n preferredRegion?: string\n}\n\nexport type ServerPath = {\n path: string\n contentHash: string\n}\n\nexport type WrittenEndpoint =\n | {\n type: 'nodejs'\n /** The entry path for the endpoint. */\n entryPath: string\n /** All client paths that have been written for the endpoint. */\n clientPaths: string[]\n /** All server paths that have been written for the endpoint. */\n serverPaths: ServerPath[]\n config: EndpointConfig\n }\n | {\n type: 'edge'\n /** All client paths that have been written for the endpoint. */\n clientPaths: string[]\n /** All server paths that have been written for the endpoint. */\n serverPaths: ServerPath[]\n config: EndpointConfig\n }\n | {\n type: 'none'\n clientPaths: []\n serverPaths: []\n config: EndpointConfig\n }\n\nexport interface ProjectOptions {\n /**\n * A root path from which all files must be nested under. Trying to access\n * a file outside this root will fail. Think of this as a chroot.\n */\n rootPath: string\n\n /**\n * A path inside the root_path which contains the app/pages directories.\n */\n projectPath: string\n\n /**\n * The path to the .next directory.\n */\n distDir: string\n\n /**\n * The next.config.js contents.\n */\n nextConfig: NextConfigComplete\n\n /**\n * Jsconfig, or tsconfig contents.\n *\n * Next.js implicitly requires to read it to support few options\n * https://nextjs.org/docs/architecture/nextjs-compiler#legacy-decorators\n * https://nextjs.org/docs/architecture/nextjs-compiler#importsource\n */\n jsConfig: {\n compilerOptions: object\n }\n\n /**\n * A map of environment variables to use when compiling code.\n */\n env: Record<string, string>\n\n defineEnv: DefineEnv\n\n /**\n * Whether to watch the filesystem for file changes.\n */\n watch: {\n enable: boolean\n pollIntervalMs?: number\n }\n\n /**\n * The mode in which Next.js is running.\n */\n dev: boolean\n\n /**\n * The server actions encryption key.\n */\n encryptionKey: string\n\n /**\n * The build id.\n */\n buildId: string\n\n /**\n * Options for draft mode.\n */\n previewProps: __ApiPreviewProps\n\n /**\n * The browserslist query to use for targeting browsers.\n */\n browserslistQuery: string\n\n /**\n * When the code is minified, this opts out of the default mangling of local\n * names for variables, functions etc., which can be useful for\n * debugging/profiling purposes.\n */\n noMangling: boolean\n}\n\nexport interface DefineEnv {\n client: RustifiedEnv\n edge: RustifiedEnv\n nodejs: RustifiedEnv\n}\n\nexport type RustifiedEnv = { name: string; value: string }[]\n\nexport interface GlobalEntrypoints {\n app: Endpoint | undefined\n document: Endpoint | undefined\n error: Endpoint | undefined\n middleware: Middleware | undefined\n instrumentation: Instrumentation | undefined\n}\n\nexport type PageRoute =\n | {\n type: 'page'\n htmlEndpoint: Endpoint\n dataEndpoint: Endpoint\n }\n | {\n type: 'page-api'\n endpoint: Endpoint\n }\n\nexport type AppRoute =\n | {\n type: 'app-page'\n htmlEndpoint: Endpoint\n rscEndpoint: Endpoint\n }\n | {\n type: 'app-route'\n endpoint: Endpoint\n }\n\n// pathname -> route\nexport type PageEntrypoints = Map<string, PageRoute>\n\n// originalName / page -> route\nexport type AppEntrypoints = Map<string, AppRoute>\n\nexport type Entrypoints = {\n global: GlobalEntrypoints\n page: PageEntrypoints\n app: AppEntrypoints\n}\n"],"names":[],"mappings":"AAmbA,WAIC"}
1
+ {"version":3,"sources":["../../../src/build/swc/types.ts"],"sourcesContent":["import type { NextConfigComplete } from '../../server/config-shared'\nimport type { __ApiPreviewProps } from '../../server/api-utils'\nimport type {\n ExternalObject,\n RefCell,\n NapiTurboEngineOptions,\n} from './generated-native'\n\nexport type { NapiTurboEngineOptions as TurboEngineOptions }\n\nexport interface Binding {\n isWasm: boolean\n turbo: {\n createProject(\n options: ProjectOptions,\n turboEngineOptions?: NapiTurboEngineOptions\n ): Promise<Project>\n startTurbopackTraceServer(traceFilePath: string): void\n\n nextBuild?: any\n }\n mdx: {\n compile(src: string, options: any): any\n compileSync(src: string, options: any): any\n }\n minify(src: string, options: any): Promise<any>\n minifySync(src: string, options: any): any\n transform(src: string, options: any): Promise<any>\n transformSync(src: string, options: any): any\n parse(src: string, options: any): Promise<string>\n\n getTargetTriple(): string | undefined\n\n initCustomTraceSubscriber?(traceOutFilePath?: string): ExternalObject<RefCell>\n teardownTraceSubscriber?(guardExternal: ExternalObject<RefCell>): void\n css: {\n lightning: {\n transform(transformOptions: any): Promise<any>\n transformStyleAttr(transformAttrOptions: any): Promise<any>\n }\n }\n}\n\nexport type StyledString =\n | {\n type: 'text'\n value: string\n }\n | {\n type: 'code'\n value: string\n }\n | {\n type: 'strong'\n value: string\n }\n | {\n type: 'stack'\n value: StyledString[]\n }\n | {\n type: 'line'\n value: StyledString[]\n }\n\nexport interface Issue {\n severity: string\n stage: string\n filePath: string\n title: StyledString\n description?: StyledString\n detail?: StyledString\n source?: {\n source: {\n ident: string\n content?: string\n }\n range?: {\n start: {\n // 0-indexed\n line: number\n // 0-indexed\n column: number\n }\n end: {\n // 0-indexed\n line: number\n // 0-indexed\n column: number\n }\n }\n }\n documentationLink: string\n subIssues: Issue[]\n}\n\nexport interface Diagnostics {\n category: string\n name: string\n payload: unknown\n}\n\nexport type TurbopackResult<T = {}> = T & {\n issues: Issue[]\n diagnostics: Diagnostics[]\n}\n\nexport interface Middleware {\n endpoint: Endpoint\n}\n\nexport interface Instrumentation {\n nodeJs: Endpoint\n edge: Endpoint\n}\n\nexport interface RawEntrypoints {\n routes: Map<string, Route>\n middleware?: Middleware\n instrumentation?: Instrumentation\n pagesDocumentEndpoint: Endpoint\n pagesAppEndpoint: Endpoint\n pagesErrorEndpoint: Endpoint\n}\n\ninterface BaseUpdate {\n resource: {\n headers: unknown\n path: string\n }\n diagnostics: unknown[]\n issues: Issue[]\n}\n\ninterface IssuesUpdate extends BaseUpdate {\n type: 'issues'\n}\n\ninterface EcmascriptMergedUpdate {\n type: 'EcmascriptMergedUpdate'\n chunks: { [moduleName: string]: { type: 'partial' } }\n entries: { [moduleName: string]: { code: string; map: string; url: string } }\n}\n\ninterface PartialUpdate extends BaseUpdate {\n type: 'partial'\n instruction: {\n type: 'ChunkListUpdate'\n merged: EcmascriptMergedUpdate[] | undefined\n }\n}\n\nexport type Update = IssuesUpdate | PartialUpdate\n\nexport interface HmrIdentifiers {\n identifiers: string[]\n}\n\n/** @see https://github.com/vercel/next.js/blob/415cd74b9a220b6f50da64da68c13043e9b02995/packages/next-swc/crates/napi/src/next_api/project.rs#L824-L833 */\nexport interface TurbopackStackFrame {\n isServer: boolean\n isInternal?: boolean\n file: string\n originalFile?: string\n /** 1-indexed, unlike source map tokens */\n line?: number\n /** 1-indexed, unlike source map tokens */\n column?: number\n methodName?: string\n}\n\nexport type UpdateMessage =\n | {\n updateType: 'start'\n }\n | {\n updateType: 'end'\n value: UpdateInfo\n }\n\nexport interface UpdateInfo {\n duration: number\n tasks: number\n}\n\nexport interface Project {\n update(options: Partial<ProjectOptions>): Promise<void>\n\n writeAllEntrypointsToDisk(\n appDirOnly: boolean\n ): Promise<TurbopackResult<RawEntrypoints>>\n\n entrypointsSubscribe(): AsyncIterableIterator<TurbopackResult<RawEntrypoints>>\n\n hmrEvents(identifier: string): AsyncIterableIterator<TurbopackResult<Update>>\n\n hmrIdentifiersSubscribe(): AsyncIterableIterator<\n TurbopackResult<HmrIdentifiers>\n >\n\n getSourceForAsset(filePath: string): Promise<string | null>\n\n getSourceMap(filePath: string): Promise<string | null>\n getSourceMapSync(filePath: string): string | null\n\n traceSource(\n stackFrame: TurbopackStackFrame,\n currentDirectoryFileUrl: string\n ): Promise<TurbopackStackFrame | null>\n\n updateInfoSubscribe(\n aggregationMs: number\n ): AsyncIterableIterator<TurbopackResult<UpdateMessage>>\n\n shutdown(): Promise<void>\n\n onExit(): Promise<void>\n}\n\nexport type Route =\n | {\n type: 'conflict'\n }\n | {\n type: 'app-page'\n pages: {\n originalName: string\n htmlEndpoint: Endpoint\n rscEndpoint: Endpoint\n }[]\n }\n | {\n type: 'app-route'\n originalName: string\n endpoint: Endpoint\n }\n | {\n type: 'page'\n htmlEndpoint: Endpoint\n dataEndpoint: Endpoint\n }\n | {\n type: 'page-api'\n endpoint: Endpoint\n }\n\nexport interface Endpoint {\n /** Write files for the endpoint to disk. */\n writeToDisk(): Promise<TurbopackResult<WrittenEndpoint>>\n\n /**\n * Listen to client-side changes to the endpoint.\n * After clientChanged() has been awaited it will listen to changes.\n * The async iterator will yield for each change.\n */\n clientChanged(): Promise<AsyncIterableIterator<TurbopackResult>>\n\n /**\n * Listen to server-side changes to the endpoint.\n * After serverChanged() has been awaited it will listen to changes.\n * The async iterator will yield for each change.\n */\n serverChanged(\n includeIssues: boolean\n ): Promise<AsyncIterableIterator<TurbopackResult>>\n}\n\ninterface EndpointConfig {\n dynamic?: 'auto' | 'force-dynamic' | 'error' | 'force-static'\n dynamicParams?: boolean\n revalidate?: 'never' | 'force-cache' | number\n fetchCache?:\n | 'auto'\n | 'default-cache'\n | 'only-cache'\n | 'force-cache'\n | 'default-no-store'\n | 'only-no-store'\n | 'force-no-store'\n runtime?: 'nodejs' | 'edge'\n preferredRegion?: string\n}\n\nexport type ServerPath = {\n path: string\n contentHash: string\n}\n\nexport type WrittenEndpoint =\n | {\n type: 'nodejs'\n /** The entry path for the endpoint. */\n entryPath: string\n /** All client paths that have been written for the endpoint. */\n clientPaths: string[]\n /** All server paths that have been written for the endpoint. */\n serverPaths: ServerPath[]\n config: EndpointConfig\n }\n | {\n type: 'edge'\n /** All client paths that have been written for the endpoint. */\n clientPaths: string[]\n /** All server paths that have been written for the endpoint. */\n serverPaths: ServerPath[]\n config: EndpointConfig\n }\n | {\n type: 'none'\n clientPaths: []\n serverPaths: []\n config: EndpointConfig\n }\n\nexport interface ProjectOptions {\n /**\n * A root path from which all files must be nested under. Trying to access\n * a file outside this root will fail. Think of this as a chroot.\n */\n rootPath: string\n\n /**\n * A path inside the root_path which contains the app/pages directories.\n */\n projectPath: string\n\n /**\n * The path to the .next directory.\n */\n distDir: string\n\n /**\n * The next.config.js contents.\n */\n nextConfig: NextConfigComplete\n\n /**\n * Jsconfig, or tsconfig contents.\n *\n * Next.js implicitly requires to read it to support few options\n * https://nextjs.org/docs/architecture/nextjs-compiler#legacy-decorators\n * https://nextjs.org/docs/architecture/nextjs-compiler#importsource\n */\n jsConfig: {\n compilerOptions: object\n }\n\n /**\n * A map of environment variables to use when compiling code.\n */\n env: Record<string, string>\n\n defineEnv: DefineEnv\n\n /**\n * Whether to watch the filesystem for file changes.\n */\n watch: {\n enable: boolean\n pollIntervalMs?: number\n }\n\n /**\n * The mode in which Next.js is running.\n */\n dev: boolean\n\n /**\n * The server actions encryption key.\n */\n encryptionKey: string\n\n /**\n * The build id.\n */\n buildId: string\n\n /**\n * Options for draft mode.\n */\n previewProps: __ApiPreviewProps\n\n /**\n * The browserslist query to use for targeting browsers.\n */\n browserslistQuery: string\n\n /**\n * When the code is minified, this opts out of the default mangling of local\n * names for variables, functions etc., which can be useful for\n * debugging/profiling purposes.\n */\n noMangling: boolean\n}\n\nexport interface DefineEnv {\n client: RustifiedEnv\n edge: RustifiedEnv\n nodejs: RustifiedEnv\n}\n\nexport type RustifiedEnv = { name: string; value: string }[]\n\nexport interface GlobalEntrypoints {\n app: Endpoint | undefined\n document: Endpoint | undefined\n error: Endpoint | undefined\n middleware: Middleware | undefined\n instrumentation: Instrumentation | undefined\n}\n\nexport type PageRoute =\n | {\n type: 'page'\n htmlEndpoint: Endpoint\n dataEndpoint: Endpoint\n }\n | {\n type: 'page-api'\n endpoint: Endpoint\n }\n\nexport type AppRoute =\n | {\n type: 'app-page'\n htmlEndpoint: Endpoint\n rscEndpoint: Endpoint\n }\n | {\n type: 'app-route'\n endpoint: Endpoint\n }\n\n// pathname -> route\nexport type PageEntrypoints = Map<string, PageRoute>\n\n// originalName / page -> route\nexport type AppEntrypoints = Map<string, AppRoute>\n\nexport type Entrypoints = {\n global: GlobalEntrypoints\n page: PageEntrypoints\n app: AppEntrypoints\n}\n"],"names":[],"mappings":"AAubA,WAIC"}
@@ -3,11 +3,8 @@ import { validateTurboNextConfig } from '../../lib/turbopack-warning';
3
3
  import { formatIssue, getTurbopackJsConfig, isPersistentCachingEnabled, isRelevantWarning } from '../../shared/lib/turbopack/utils';
4
4
  import { NextBuildContext } from '../build-context';
5
5
  import { createDefineEnv, loadBindings } from '../swc';
6
- import { Sema } from 'next/dist/compiled/async-sema';
7
- import { handleEntrypoints, handlePagesErrorRoute, handleRouteType } from '../handle-entrypoints';
6
+ import { rawEntrypointsToEntrypoints, handleRouteType } from '../handle-entrypoints';
8
7
  import { TurbopackManifestLoader } from '../../shared/lib/turbopack/manifest-loader';
9
- import { createProgress } from '../progress';
10
- import * as Log from '../output/log';
11
8
  import { promises as fs } from 'fs';
12
9
  import { PHASE_PRODUCTION_BUILD } from '../../shared/lib/constants';
13
10
  import loadConfig from '../../server/config';
@@ -88,150 +85,67 @@ export async function turbopackBuild() {
88
85
  type: 'commonjs'
89
86
  }, null, 2));
90
87
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
91
- const entrypointsSubscription = project.entrypointsSubscribe();
92
- const currentEntrypoints = {
93
- global: {
94
- app: undefined,
95
- document: undefined,
96
- error: undefined,
97
- middleware: undefined,
98
- instrumentation: undefined
99
- },
100
- app: new Map(),
101
- page: new Map()
102
- };
103
- const currentEntryIssues = new Map();
88
+ const entrypoints = await project.writeAllEntrypointsToDisk(appDirOnly);
104
89
  const manifestLoader = new TurbopackManifestLoader({
105
90
  buildId,
106
91
  distDir,
107
92
  encryptionKey
108
93
  });
109
- const entrypointsResult = await entrypointsSubscription.next();
110
- if (entrypointsResult.done) {
111
- throw Object.defineProperty(new Error('Turbopack did not return any entrypoints'), "__NEXT_ERROR_CODE", {
112
- value: "E275",
113
- enumerable: false,
114
- configurable: true
115
- });
116
- }
117
- entrypointsSubscription.return == null ? void 0 : entrypointsSubscription.return.call(entrypointsSubscription).catch(()=>{});
118
- const entrypoints = entrypointsResult.value;
119
94
  const topLevelErrors = [];
95
+ const topLevelWarnings = [];
120
96
  for (const issue of entrypoints.issues){
121
- topLevelErrors.push({
122
- message: formatIssue(issue)
123
- });
97
+ if (issue.severity === 'error' || issue.severity === 'fatal') {
98
+ topLevelErrors.push(formatIssue(issue));
99
+ } else if (isRelevantWarning(issue)) {
100
+ topLevelWarnings.push(formatIssue(issue));
101
+ }
102
+ }
103
+ if (topLevelWarnings.length > 0) {
104
+ console.warn(`Turbopack build encountered ${topLevelWarnings.length} warnings:\n${topLevelWarnings.join('\n')}`);
124
105
  }
125
106
  if (topLevelErrors.length > 0) {
126
- throw Object.defineProperty(new Error(`Turbopack build failed with ${topLevelErrors.length} issues:\n${topLevelErrors.map((e)=>e.message).join('\n')}`), "__NEXT_ERROR_CODE", {
127
- value: "E33",
107
+ throw Object.defineProperty(new Error(`Turbopack build failed with ${topLevelErrors.length} errors:\n${topLevelErrors.join('\n')}`), "__NEXT_ERROR_CODE", {
108
+ value: "E425",
128
109
  enumerable: false,
129
110
  configurable: true
130
111
  });
131
112
  }
132
- await handleEntrypoints({
133
- entrypoints,
134
- currentEntrypoints,
135
- currentEntryIssues,
136
- manifestLoader,
137
- productionRewrites: rewrites,
138
- logErrors: false
139
- });
140
- const progress = createProgress(currentEntrypoints.page.size + currentEntrypoints.app.size + 1, 'Building');
113
+ const currentEntrypoints = await rawEntrypointsToEntrypoints(entrypoints);
141
114
  const promises = [];
142
- // Concurrency will start at INITIAL_CONCURRENCY and
143
- // slowly ramp up to CONCURRENCY by increasing the
144
- // concurrency by 1 every time a task is completed.
145
- const INITIAL_CONCURRENCY = 5;
146
- const CONCURRENCY = 10;
147
- const sema = new Sema(INITIAL_CONCURRENCY);
148
- let remainingRampup = CONCURRENCY - INITIAL_CONCURRENCY;
149
- const enqueue = (fn)=>{
150
- promises.push((async ()=>{
151
- await sema.acquire();
152
- try {
153
- await fn();
154
- } finally{
155
- sema.release();
156
- if (remainingRampup > 0) {
157
- remainingRampup--;
158
- sema.release();
159
- }
160
- progress.run();
161
- }
162
- })());
163
- };
164
115
  if (!appDirOnly) {
165
116
  for (const [page, route] of currentEntrypoints.page){
166
- enqueue(()=>handleRouteType({
167
- page,
168
- route,
169
- currentEntryIssues,
170
- entrypoints: currentEntrypoints,
171
- manifestLoader,
172
- productionRewrites: rewrites,
173
- logErrors: false
174
- }));
175
- }
176
- }
177
- for (const [page, route] of currentEntrypoints.app){
178
- enqueue(()=>handleRouteType({
117
+ promises.push(handleRouteType({
179
118
  page,
180
119
  route,
181
- currentEntryIssues,
182
- entrypoints: currentEntrypoints,
183
- manifestLoader,
184
- productionRewrites: rewrites,
185
- logErrors: false
120
+ manifestLoader
186
121
  }));
122
+ }
187
123
  }
188
- enqueue(()=>handlePagesErrorRoute({
189
- currentEntryIssues,
190
- entrypoints: currentEntrypoints,
191
- manifestLoader,
192
- productionRewrites: rewrites,
193
- logErrors: false
124
+ for (const [page, route] of currentEntrypoints.app){
125
+ promises.push(handleRouteType({
126
+ page,
127
+ route,
128
+ manifestLoader
194
129
  }));
130
+ }
195
131
  await Promise.all(promises);
132
+ await Promise.all([
133
+ manifestLoader.loadBuildManifest('_app'),
134
+ manifestLoader.loadPagesManifest('_app'),
135
+ manifestLoader.loadFontManifest('_app'),
136
+ manifestLoader.loadPagesManifest('_document'),
137
+ manifestLoader.loadBuildManifest('_error'),
138
+ manifestLoader.loadPagesManifest('_error'),
139
+ manifestLoader.loadFontManifest('_error'),
140
+ entrypoints.instrumentation && manifestLoader.loadMiddlewareManifest('instrumentation', 'instrumentation'),
141
+ entrypoints.middleware && await manifestLoader.loadMiddlewareManifest('middleware', 'middleware')
142
+ ]);
196
143
  await manifestLoader.writeManifests({
197
144
  devRewrites: undefined,
198
145
  productionRewrites: rewrites,
199
146
  entrypoints: currentEntrypoints
200
147
  });
201
- const errors = [];
202
- const warnings = [];
203
- for (const [page, entryIssues] of currentEntryIssues){
204
- for (const issue of entryIssues.values()){
205
- if (issue.severity !== 'warning') {
206
- errors.push({
207
- page,
208
- message: formatIssue(issue)
209
- });
210
- } else {
211
- if (isRelevantWarning(issue)) {
212
- warnings.push({
213
- page,
214
- message: formatIssue(issue)
215
- });
216
- }
217
- }
218
- }
219
- }
220
148
  const shutdownPromise = project.shutdown();
221
- if (warnings.length > 0) {
222
- Log.warn(`Turbopack build collected ${warnings.length} warnings:\n${warnings.map((e)=>{
223
- return 'Page: ' + e.page + '\n' + e.message;
224
- }).join('\n')}`);
225
- }
226
- if (errors.length > 0) {
227
- throw Object.defineProperty(new Error(`Turbopack build failed with ${errors.length} errors:\n${errors.map((e)=>{
228
- return 'Page: ' + e.page + '\n' + e.message;
229
- }).join('\n')}`), "__NEXT_ERROR_CODE", {
230
- value: "E425",
231
- enumerable: false,
232
- configurable: true
233
- });
234
- }
235
149
  const time = process.hrtime(startTime);
236
150
  return {
237
151
  duration: time[0] + time[1] / 1e9,