next 15.2.0-canary.54 → 15.2.0-canary.55

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 (47) hide show
  1. package/dist/bin/next +1 -1
  2. package/dist/build/index.js +2 -2
  3. package/dist/build/swc/generated-native.d.ts +12 -0
  4. package/dist/build/swc/index.d.ts +4 -1
  5. package/dist/build/swc/index.js +1 -1
  6. package/dist/build/swc/index.js.map +1 -1
  7. package/dist/build/swc/types.d.ts +6 -0
  8. package/dist/build/turbopack-build/impl.js +3 -1
  9. package/dist/build/turbopack-build/impl.js.map +1 -1
  10. package/dist/build/webpack/plugins/css-minimizer-plugin.d.ts +2 -2
  11. package/dist/build/webpack/plugins/minify-webpack-plugin/src/index.d.ts +9 -1
  12. package/dist/build/webpack/plugins/minify-webpack-plugin/src/index.js +27 -33
  13. package/dist/build/webpack/plugins/minify-webpack-plugin/src/index.js.map +1 -1
  14. package/dist/build/webpack-config.d.ts +1 -1
  15. package/dist/build/webpack-config.js +6 -4
  16. package/dist/build/webpack-config.js.map +1 -1
  17. package/dist/client/app-bootstrap.js +1 -1
  18. package/dist/client/index.js +1 -1
  19. package/dist/esm/build/index.js +2 -2
  20. package/dist/esm/build/swc/generated-native.d.ts +12 -0
  21. package/dist/esm/build/swc/index.js +1 -1
  22. package/dist/esm/build/swc/index.js.map +1 -1
  23. package/dist/esm/build/swc/types.js.map +1 -1
  24. package/dist/esm/build/turbopack-build/impl.js +3 -1
  25. package/dist/esm/build/turbopack-build/impl.js.map +1 -1
  26. package/dist/esm/build/webpack/plugins/minify-webpack-plugin/src/index.js +28 -34
  27. package/dist/esm/build/webpack/plugins/minify-webpack-plugin/src/index.js.map +1 -1
  28. package/dist/esm/build/webpack-config.js +6 -4
  29. package/dist/esm/build/webpack-config.js.map +1 -1
  30. package/dist/esm/client/app-bootstrap.js +1 -1
  31. package/dist/esm/client/index.js +1 -1
  32. package/dist/esm/server/config.js +1 -1
  33. package/dist/esm/server/dev/hot-reloader-turbopack.js +3 -2
  34. package/dist/esm/server/dev/hot-reloader-turbopack.js.map +1 -1
  35. package/dist/esm/server/dev/hot-reloader-webpack.js +1 -1
  36. package/dist/esm/server/lib/app-info-log.js +1 -1
  37. package/dist/esm/server/lib/start-server.js +1 -1
  38. package/dist/server/config.js +1 -1
  39. package/dist/server/dev/hot-reloader-turbopack.js +3 -2
  40. package/dist/server/dev/hot-reloader-turbopack.js.map +1 -1
  41. package/dist/server/dev/hot-reloader-webpack.js +1 -1
  42. package/dist/server/lib/app-info-log.js +1 -1
  43. package/dist/server/lib/start-server.js +1 -1
  44. package/dist/telemetry/anonymous-meta.js +1 -1
  45. package/dist/telemetry/events/session-stopped.js +2 -2
  46. package/dist/telemetry/events/version.js +2 -2
  47. package/package.json +15 -15
package/dist/bin/next CHANGED
@@ -75,7 +75,7 @@ const program = new NextRootCommand();
75
75
  program.name('next').description('The Next.js CLI allows you to develop, build, start your application, and more.').configureHelp({
76
76
  formatHelp: (cmd, helper)=>(0, _formatclihelpoutput.formatCliHelpOutput)(cmd, helper),
77
77
  subcommandTerm: (cmd)=>`${cmd.name()} ${cmd.usage()}`
78
- }).helpCommand(false).helpOption('-h, --help', 'Displays this message.').version(`Next.js v${"15.2.0-canary.54"}`, '-v, --version', 'Outputs the Next.js version.');
78
+ }).helpCommand(false).helpOption('-h, --help', 'Displays this message.').version(`Next.js v${"15.2.0-canary.55"}`, '-v, --version', 'Outputs the Next.js version.');
79
79
  program.command('build').description('Creates an optimized production build of your application. The output displays information about each route.').argument('[directory]', `A directory on which to build the application. ${(0, _picocolors.italic)('If no directory is provided, the current directory will be used.')}`).option('-d, --debug', 'Enables a more verbose build output.').option('--no-lint', 'Disables linting.').option('--no-mangling', 'Disables mangling.').option('--profile', 'Enables production profiling for React.').option('--experimental-app-only', 'Builds only App Router routes.').addOption(new _commander.Option('--experimental-turbo').hideHelp()).addOption(new _commander.Option('--experimental-build-mode [mode]', 'Uses an experimental build mode.').choices([
80
80
  'compile',
81
81
  'generate'
@@ -364,7 +364,7 @@ async function build(dir, reactProductionProfiling = false, debugOutput = false,
364
364
  const nextBuildSpan = (0, _trace.trace)('next-build', undefined, {
365
365
  buildMode: experimentalBuildMode,
366
366
  isTurboBuild: String(turboNextBuild),
367
- version: "15.2.0-canary.54"
367
+ version: "15.2.0-canary.55"
368
368
  });
369
369
  _buildcontext.NextBuildContext.nextBuildSpan = nextBuildSpan;
370
370
  _buildcontext.NextBuildContext.dir = dir;
@@ -732,7 +732,7 @@ async function build(dir, reactProductionProfiling = false, debugOutput = false,
732
732
  // Files outside of the distDir can be "type": "module"
733
733
  await writeFileUtf8(_path.default.join(distDir, 'package.json'), '{"type": "commonjs"}');
734
734
  // These are written to distDir, so they need to come after creating and cleaning distDr.
735
- await (0, _builddiagnostics.recordFrameworkVersion)("15.2.0-canary.54");
735
+ await (0, _builddiagnostics.recordFrameworkVersion)("15.2.0-canary.55");
736
736
  await (0, _builddiagnostics.updateBuildDiagnostics)({
737
737
  buildStage: 'start'
738
738
  });
@@ -128,6 +128,12 @@ export interface NapiProjectOptions {
128
128
  previewProps: NapiDraftModeOptions
129
129
  /** The browserslist query to use for targeting browsers. */
130
130
  browserslistQuery: string
131
+ /**
132
+ * When the code is minified, this opts out of the default mangling of
133
+ * local names for variables, functions etc., which can be useful for
134
+ * debugging/profiling purposes.
135
+ */
136
+ noMangling: boolean
131
137
  }
132
138
  /** [NapiProjectOptions] with all fields optional. */
133
139
  export interface NapiPartialProjectOptions {
@@ -166,6 +172,12 @@ export interface NapiPartialProjectOptions {
166
172
  previewProps?: NapiDraftModeOptions
167
173
  /** The browserslist query to use for targeting browsers. */
168
174
  browserslistQuery?: string
175
+ /**
176
+ * When the code is minified, this opts out of the default mangling of
177
+ * local names for variables, functions etc., which can be useful for
178
+ * debugging/profiling purposes.
179
+ */
180
+ noMangling?: boolean
169
181
  }
170
182
  export interface NapiDefineEnv {
171
183
  client: Array<NapiEnvVar>
@@ -12,7 +12,10 @@ export declare function createDefineEnv({ isTurbopack, clientRouterFilters, conf
12
12
  export declare function isWasm(): Promise<boolean>;
13
13
  export declare function transform(src: string, options?: any): Promise<any>;
14
14
  export declare function transformSync(src: string, options?: any): any;
15
- export declare function minify(src: string, options: any): Promise<string>;
15
+ export declare function minify(src: string, options: any): Promise<{
16
+ code: string;
17
+ map: any;
18
+ }>;
16
19
  export declare function parse(src: string, options: any): Promise<any>;
17
20
  export declare function getBinaryMetadata(): {
18
21
  target: string | undefined;
@@ -119,7 +119,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
119
119
  }
120
120
  return newObj;
121
121
  }
122
- const nextVersion = "15.2.0-canary.54";
122
+ const nextVersion = "15.2.0-canary.55";
123
123
  const ArchName = (0, _os.arch)();
124
124
  const PlatformName = (0, _os.platform)();
125
125
  function infoLog(...args) {
@@ -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(src: string, options: any): Promise<string> {\n let bindings = await loadBindings()\n return bindings.minify(src, options)\n}\n\nexport async function parse(src: string, options: any): Promise<any> {\n let bindings = await loadBindings()\n let parserOptions = getParserOptions(options)\n return bindings\n .parse(src, parserOptions)\n .then((astStr: any) => JSON.parse(astStr))\n}\n\nexport function getBinaryMetadata() {\n let bindings\n try {\n bindings = loadNative()\n } catch (e) {\n // Suppress exceptions, this fn allows to fail to load native bindings\n }\n\n return {\n target: bindings?.getTargetTriple?.(),\n }\n}\n\n/**\n * Initialize trace subscriber to emit traces.\n *\n */\nexport function initCustomTraceSubscriber(traceFileName?: string) {\n if (swcTraceFlushGuard) {\n // Wasm binary doesn't support trace emission\n let bindings = loadNative()\n swcTraceFlushGuard = bindings.initCustomTraceSubscriber?.(traceFileName)\n }\n}\n\nfunction once(fn: () => void): () => void {\n let executed = false\n\n return function (): void {\n if (!executed) {\n executed = true\n\n fn()\n }\n }\n}\n\n/**\n * Teardown swc's trace subscriber if there's an initialized flush guard exists.\n *\n * This is workaround to amend behavior with process.exit\n * (https://github.com/vercel/next.js/blob/4db8c49cc31e4fc182391fae6903fb5ef4e8c66e/packages/next/bin/next.ts#L134=)\n * seems preventing napi's cleanup hook execution (https://github.com/swc-project/swc/blob/main/crates/node/src/util.rs#L48-L51=),\n *\n * instead parent process manually drops guard when process gets signal to exit.\n */\nexport const teardownTraceSubscriber = once(() => {\n try {\n let bindings = loadNative()\n if (swcTraceFlushGuard) {\n bindings.teardownTraceSubscriber?.(swcTraceFlushGuard)\n }\n } catch (e) {\n // Suppress exceptions, this fn allows to fail to load native bindings\n }\n})\n"],"names":["createDefineEnv","getBinaryMetadata","getSupportedArchTriples","initCustomTraceSubscriber","isWasm","loadBindings","lockfilePatchPromise","minify","parse","teardownTraceSubscriber","transform","transformSync","nextVersion","process","env","__NEXT_VERSION","ArchName","arch","PlatformName","platform","infoLog","args","NEXT_PRIVATE_BUILD_WORKER","DEBUG","Log","info","darwin","win32","linux","freebsd","android","platformArchTriples","arm64","ia32","filter","triple","abi","x64","arm","triples","supportedArchTriples","targetTriple","rawTargetTriple","warn","__INTERNAL_CUSTOM_TURBOPACK_BINDINGS","checkVersionMismatch","pkgData","version","knownDefaultWasmFallbackTriples","lastNativeBindingsLoadErrorCode","undefined","nativeBindings","wasmBindings","downloadWasmPromise","pendingBindings","swcTraceFlushGuard","downloadNativeBindingsPromise","useWasmBinary","RUST_MIN_STACK","stdout","_handle","setBlocking","stderr","Promise","resolve","_reject","cur","patchIncorrectLockfile","cwd","catch","console","error","attempts","disableWasmFallback","NEXT_DISABLE_SWC_WASM","unsupportedPlatform","some","raw","includes","isWebContainer","versions","webcontainer","shouldLoadWasmFallbackFirst","fallbackBindings","tryLoadWasmWithFallback","loadNative","a","Array","isArray","every","m","tryLoadNativeWithFallback","concat","logLoadFailure","nativeBindingsDirectory","path","join","dirname","require","downloadNativeNextSwc","map","platformArchABI","push","bindings","loadWasm","eventSwcLoadFailure","wasm","nativeBindingsErrorCode","wasmDirectory","downloadWasmSwc","attempt","loadBindingsSync","Error","cause","loggingLoadFailure","triedWasm","then","finally","exit","isTurbopack","clientRouterFilters","config","dev","distDir","fetchCacheKeyPrefix","hasRewrites","middlewareMatchers","defineEnv","client","edge","nodejs","variant","Object","keys","rustifyEnv","getDefineEnv","isClient","isEdgeServer","isNodeOrEdgeCompilation","isNodeServer","entries","_","value","name","bindingToApi","binding","_wasm","cancel","Cancel","invariant","never","computeMessage","withErrorCause","fn","nativeError","TurbopackInternalError","subscribe","useBuffer","nativeFunction","buffer","waiting","canceled","emitResult","err","reject","item","createIterator","task","length","shift","e","rootTaskDispose","iterator","return","done","rustifyProjectOptions","options","nextConfig","serializeNextConfig","projectPath","jsConfig","JSON","stringify","rustifyPartialProjectOptions","ProjectImpl","constructor","nativeProject","_nativeProject","update","projectUpdate","entrypointsSubscribe","subscription","callback","projectEntrypointsSubscribe","entrypoints","routes","Map","pathname","nativeRoute","route","routeType","type","htmlEndpoint","EndpointImpl","dataEndpoint","endpoint","pages","page","originalName","rscEndpoint","_exhaustiveCheck","set","napiMiddlewareToMiddleware","middleware","runtime","matcher","napiInstrumentationToInstrumentation","instrumentation","nodeJs","pagesDocumentEndpoint","pagesAppEndpoint","pagesErrorEndpoint","issues","diagnostics","hmrEvents","identifier","projectHmrEvents","hmrIdentifiersSubscribe","projectHmrIdentifiersSubscribe","traceSource","stackFrame","currentDirectoryFileUrl","projectTraceSource","getSourceForAsset","filePath","projectGetSourceForAsset","getSourceMap","projectGetSourceMap","getSourceMapSync","projectGetSourceMapSync","updateInfoSubscribe","aggregationMs","projectUpdateInfoSubscribe","shutdown","projectShutdown","onExit","projectOnExit","nativeEndpoint","_nativeEndpoint","writeToDisk","endpointWriteToDisk","clientChanged","clientSubscription","endpointClientChangedSubscribe","next","serverChanged","includeIssues","serverSubscription","endpointServerChangedSubscribe","augmentNextConfig","originalNextConfig","reactCompilerOptions","experimental","reactCompiler","ruleKeys","turbo","rules","key","browser","foreign","loaders","getReactCompilerLoader","nextConfigSerializable","generateBuildId","exportPathMap","webpack","ensureLoadersHaveSerializableOptions","modularizeImports","fromEntries","mod","images","loaderFile","relative","turbopackRules","glob","rule","checkLoaderItems","checkConfigItem","inner","loaderItems","loaderItem","isDeepStrictEqual","loader","createProject","turboEngineOptions","projectNew","importPath","pkg","pkgPath","pathToFileURL","toString","default","css","lightning","_options","transformStyleAttr","src","minifySync","parseSync","getTargetTriple","_turboEngineOptions","startTurbopackTraceServer","_traceFilePath","mdx","compile","mdxCompile","getMdxOptions","compileSync","mdxCompileSync","code","message","customBindings","NEXT_TEST_NATIVE_DIR","isModule","Buffer","isBuffer","jsc","parser","syntax","toBuffer","traceFilePath","transformOptions","lightningCssTransform","transformAttrOptions","lightningCssTransformStyleAttribute","development","jsx","mdxType","t","from","parserOptions","getParserOptions","astStr","target","traceFileName","once","executed"],"mappings":"AAAA,0DAA0D;;;;;;;;;;;;;;;;;;;;;;;;;IA+X1CA,eAAe;eAAfA;;IA05BAC,iBAAiB;eAAjBA;;IAvtCAC,uBAAuB;eAAvBA;;IAwuCAC,yBAAyB;eAAzBA;;IA7CMC,MAAM;eAANA;;IAllCAC,YAAY;eAAZA;;IAFTC,oBAAoB;eAApBA;;IAmmCSC,MAAM;eAANA;;IAKAC,KAAK;eAALA;;IAsDTC,uBAAuB;eAAvBA;;IArESC,SAAS;eAATA;;IAKNC,aAAa;eAAbA;;;6DAtwCC;qBACa;oBACC;yBACK;6DACf;yBACY;gCACG;wCACG;6BACgB;sBAQrB;iCAI3B;sCACgC;uBAoBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOvC,MAAMC,cAAcC,QAAQC,GAAG,CAACC,cAAc;AAE9C,MAAMC,WAAWC,IAAAA,QAAI;AACrB,MAAMC,eAAeC,IAAAA,YAAQ;AAE7B,SAASC,QAAQ,GAAGC,IAAW;IAC7B,IAAIR,QAAQC,GAAG,CAACQ,yBAAyB,EAAE;QACzC;IACF;IACA,IAAIT,QAAQC,GAAG,CAACS,KAAK,EAAE;QACrBC,KAAIC,IAAI,IAAIJ;IACd;AACF;AAKO,SAASnB;IACd,MAAM,EAAEwB,MAAM,EAAEC,KAAK,EAAEC,KAAK,EAAEC,OAAO,EAAEC,OAAO,EAAE,GAAGC,4BAAmB;IAEtE,OAAO;QACLL;QACAC,OAAO;YACLK,OAAOL,MAAMK,KAAK;Y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lCoG,UAAqCiP;IAC5D;AACF;AAEA,SAASC,KAAKhM,EAAc;IAC1B,IAAIiM,WAAW;IAEf,OAAO;QACL,IAAI,CAACA,UAAU;YACbA,WAAW;YAEXjM;QACF;IACF;AACF;AAWO,MAAMhJ,0BAA0BgV,KAAK;IAC1C,IAAI;QACF,IAAIlP,WAAWlB;QACf,IAAI9B,oBAAoB;YACtBgD,SAAS9F,uBAAuB,oBAAhC8F,SAAS9F,uBAAuB,MAAhC8F,UAAmChD;QACrC;IACF,EAAE,OAAOmH,GAAG;IACV,sEAAsE;IACxE;AACF"}
1
+ {"version":3,"sources":["../../../src/build/swc/index.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-use-before-define */\nimport path from 'path'\nimport { pathToFileURL } from 'url'\nimport { arch, platform } from 'os'\nimport { platformArchTriples } from 'next/dist/compiled/@napi-rs/triples'\nimport * as Log from '../output/log'\nimport { getParserOptions } from './options'\nimport { eventSwcLoadFailure } from '../../telemetry/events/swc-load-failure'\nimport { patchIncorrectLockfile } from '../../lib/patch-incorrect-lockfile'\nimport { downloadNativeNextSwc, downloadWasmSwc } from '../../lib/download-swc'\nimport type {\n NextConfigComplete,\n TurboLoaderItem,\n TurboRuleConfigItem,\n TurboRuleConfigItemOptions,\n TurboRuleConfigItemOrShortcut,\n} from '../../server/config-shared'\nimport { isDeepStrictEqual } from 'util'\nimport {\n type DefineEnvPluginOptions,\n getDefineEnv,\n} from '../webpack/plugins/define-env-plugin'\nimport { getReactCompilerLoader } from '../get-babel-loader-config'\nimport type {\n NapiPartialProjectOptions,\n NapiProjectOptions,\n} from './generated-native'\nimport type {\n Binding,\n DefineEnv,\n Endpoint,\n HmrIdentifiers,\n Project,\n ProjectOptions,\n Route,\n TurboEngineOptions,\n TurbopackResult,\n TurbopackStackFrame,\n Update,\n UpdateMessage,\n WrittenEndpoint,\n} from './types'\nimport { TurbopackInternalError } from '../../shared/lib/turbopack/utils'\n\ntype RawBindings = typeof import('./generated-native')\ntype RawWasmBindings = typeof import('./generated-wasm') & {\n default?(): Promise<typeof import('./generated-wasm')>\n}\n\nconst nextVersion = process.env.__NEXT_VERSION as string\n\nconst ArchName = arch()\nconst PlatformName = platform()\n\nfunction infoLog(...args: any[]) {\n if (process.env.NEXT_PRIVATE_BUILD_WORKER) {\n return\n }\n if (process.env.DEBUG) {\n Log.info(...args)\n }\n}\n\n/**\n * Based on napi-rs's target triples, returns triples that have corresponding next-swc binaries.\n */\nexport function getSupportedArchTriples(): Record<string, any> {\n const { darwin, win32, linux, freebsd, android } = platformArchTriples\n\n return {\n darwin,\n win32: {\n arm64: win32.arm64,\n ia32: win32.ia32.filter((triple) => triple.abi === 'msvc'),\n x64: win32.x64.filter((triple) => triple.abi === 'msvc'),\n },\n linux: {\n // linux[x64] includes `gnux32` abi, with x64 arch.\n x64: linux.x64.filter((triple) => triple.abi !== 'gnux32'),\n arm64: linux.arm64,\n // This target is being deprecated, however we keep it in `knownDefaultWasmFallbackTriples` for now\n arm: linux.arm,\n },\n // Below targets are being deprecated, however we keep it in `knownDefaultWasmFallbackTriples` for now\n freebsd: {\n x64: freebsd.x64,\n },\n android: {\n arm64: android.arm64,\n arm: android.arm,\n },\n }\n}\n\nconst triples = (() => {\n const supportedArchTriples = getSupportedArchTriples()\n const targetTriple = supportedArchTriples[PlatformName]?.[ArchName]\n\n // If we have supported triple, return it right away\n if (targetTriple) {\n return targetTriple\n }\n\n // If there isn't corresponding target triple in `supportedArchTriples`, check if it's excluded from original raw triples\n // Otherwise, it is completely unsupported platforms.\n let rawTargetTriple = platformArchTriples[PlatformName]?.[ArchName]\n\n if (rawTargetTriple) {\n Log.warn(\n `Trying to load next-swc for target triple ${rawTargetTriple}, but there next-swc does not have native bindings support`\n )\n } else {\n Log.warn(\n `Trying to load next-swc for unsupported platforms ${PlatformName}/${ArchName}`\n )\n }\n\n return []\n})()\n\n// Allow to specify an absolute path to the custom turbopack binary to load.\n// If one of env variables is set, `loadNative` will try to use specified\n// binary instead. This is thin, naive interface\n// - `loadBindings` will not validate neither path nor the binary.\n//\n// Note these are internal flag: there's no stability, feature guarantee.\nconst __INTERNAL_CUSTOM_TURBOPACK_BINDINGS =\n process.env.__INTERNAL_CUSTOM_TURBOPACK_BINDINGS\n\nfunction checkVersionMismatch(pkgData: any) {\n const version = pkgData.version\n\n if (version && version !== nextVersion) {\n Log.warn(\n `Mismatching @next/swc version, detected: ${version} while Next.js is on ${nextVersion}. Please ensure these match`\n )\n }\n}\n\n// These are the platforms we'll try to load wasm bindings first,\n// only try to load native bindings if loading wasm binding somehow fails.\n// Fallback to native binding is for migration period only,\n// once we can verify loading-wasm-first won't cause visible regressions,\n// we'll not include native bindings for these platform at all.\nconst knownDefaultWasmFallbackTriples = [\n 'x86_64-unknown-freebsd',\n 'aarch64-linux-android',\n 'arm-linux-androideabi',\n 'armv7-unknown-linux-gnueabihf',\n 'i686-pc-windows-msvc',\n // WOA targets are TBD, while current userbase is small we may support it in the future\n //'aarch64-pc-windows-msvc',\n]\n\n// The last attempt's error code returned when cjs require to native bindings fails.\n// If node.js throws an error without error code, this should be `unknown` instead of undefined.\n// For the wasm-first targets (`knownDefaultWasmFallbackTriples`) this will be `unsupported_target`.\nlet lastNativeBindingsLoadErrorCode:\n | 'unknown'\n | 'unsupported_target'\n | string\n | undefined = undefined\nlet nativeBindings: Binding\nlet wasmBindings: Binding\nlet downloadWasmPromise: any\nlet pendingBindings: any\nlet swcTraceFlushGuard: any\nlet downloadNativeBindingsPromise: Promise<void> | undefined = undefined\n\nexport const lockfilePatchPromise: { cur?: Promise<void> } = {}\n\nexport async function loadBindings(\n useWasmBinary: boolean = false\n): Promise<Binding> {\n // Increase Rust stack size as some npm packages being compiled need more than the default.\n if (!process.env.RUST_MIN_STACK) {\n process.env.RUST_MIN_STACK = '8388608'\n }\n\n if (pendingBindings) {\n return pendingBindings\n }\n\n // rust needs stdout to be blocking, otherwise it will throw an error (on macOS at least) when writing a lot of data (logs) to it\n // see https://github.com/napi-rs/napi-rs/issues/1630\n // and https://github.com/nodejs/node/blob/main/doc/api/process.md#a-note-on-process-io\n if (process.stdout._handle != null) {\n // @ts-ignore\n process.stdout._handle.setBlocking?.(true)\n }\n if (process.stderr._handle != null) {\n // @ts-ignore\n process.stderr._handle.setBlocking?.(true)\n }\n\n pendingBindings = new Promise(async (resolve, _reject) => {\n if (!lockfilePatchPromise.cur) {\n // always run lockfile check once so that it gets patched\n // even if it doesn't fail to load locally\n lockfilePatchPromise.cur = patchIncorrectLockfile(process.cwd()).catch(\n console.error\n )\n }\n\n let attempts: any[] = []\n const disableWasmFallback = process.env.NEXT_DISABLE_SWC_WASM\n const unsupportedPlatform = triples.some(\n (triple: any) =>\n !!triple?.raw && knownDefaultWasmFallbackTriples.includes(triple.raw)\n )\n const isWebContainer = process.versions.webcontainer\n // Normal execution relies on the param `useWasmBinary` flag to load, but\n // in certain cases where there isn't a native binary we always load wasm fallback first.\n const shouldLoadWasmFallbackFirst =\n (!disableWasmFallback && useWasmBinary) ||\n unsupportedPlatform ||\n isWebContainer\n\n if (!unsupportedPlatform && useWasmBinary) {\n Log.warn(\n `experimental.useWasmBinary is not an option for supported platform ${PlatformName}/${ArchName} and will be ignored.`\n )\n }\n\n if (shouldLoadWasmFallbackFirst) {\n lastNativeBindingsLoadErrorCode = 'unsupported_target'\n const fallbackBindings = await tryLoadWasmWithFallback(attempts)\n if (fallbackBindings) {\n return resolve(fallbackBindings)\n }\n }\n\n // Trickle down loading `fallback` bindings:\n //\n // - First, try to load native bindings installed in node_modules.\n // - If that fails with `ERR_MODULE_NOT_FOUND`, treat it as case of https://github.com/npm/cli/issues/4828\n // that host system where generated package lock is not matching to the guest system running on, try to manually\n // download corresponding target triple and load it. This won't be triggered if native bindings are failed to load\n // with other reasons than `ERR_MODULE_NOT_FOUND`.\n // - Lastly, falls back to wasm binding where possible.\n try {\n return resolve(loadNative())\n } catch (a) {\n if (\n Array.isArray(a) &&\n a.every((m) => m.includes('it was not installed'))\n ) {\n let fallbackBindings = await tryLoadNativeWithFallback(attempts)\n\n if (fallbackBindings) {\n return resolve(fallbackBindings)\n }\n }\n\n attempts = attempts.concat(a)\n }\n\n // For these platforms we already tried to load wasm and failed, skip reattempt\n if (!shouldLoadWasmFallbackFirst && !disableWasmFallback) {\n const fallbackBindings = await tryLoadWasmWithFallback(attempts)\n if (fallbackBindings) {\n return resolve(fallbackBindings)\n }\n }\n\n logLoadFailure(attempts, true)\n })\n return pendingBindings\n}\n\nasync function tryLoadNativeWithFallback(attempts: Array<string>) {\n const nativeBindingsDirectory = path.join(\n path.dirname(require.resolve('next/package.json')),\n 'next-swc-fallback'\n )\n\n if (!downloadNativeBindingsPromise) {\n downloadNativeBindingsPromise = downloadNativeNextSwc(\n nextVersion,\n nativeBindingsDirectory,\n triples.map((triple: any) => triple.platformArchABI)\n )\n }\n await downloadNativeBindingsPromise\n\n try {\n return loadNative(nativeBindingsDirectory)\n } catch (a: any) {\n attempts.push(...[].concat(a))\n }\n\n return undefined\n}\n\nasync function tryLoadWasmWithFallback(attempts: any[]) {\n try {\n let bindings = await loadWasm('')\n // @ts-expect-error TODO: this event has a wrong type.\n eventSwcLoadFailure({\n wasm: 'enabled',\n nativeBindingsErrorCode: lastNativeBindingsLoadErrorCode,\n })\n return bindings\n } catch (a: any) {\n attempts.push(...[].concat(a))\n }\n\n try {\n // if not installed already download wasm package on-demand\n // we download to a custom directory instead of to node_modules\n // as node_module import attempts are cached and can't be re-attempted\n // x-ref: https://github.com/nodejs/modules/issues/307\n const wasmDirectory = path.join(\n path.dirname(require.resolve('next/package.json')),\n 'wasm'\n )\n if (!downloadWasmPromise) {\n downloadWasmPromise = downloadWasmSwc(nextVersion, wasmDirectory)\n }\n await downloadWasmPromise\n let bindings = await loadWasm(wasmDirectory)\n // @ts-expect-error TODO: this event has a wrong type.\n eventSwcLoadFailure({\n wasm: 'fallback',\n nativeBindingsErrorCode: lastNativeBindingsLoadErrorCode,\n })\n\n // still log native load attempts so user is\n // aware it failed and should be fixed\n for (const attempt of attempts) {\n Log.warn(attempt)\n }\n return bindings\n } catch (a: any) {\n attempts.push(...[].concat(a))\n }\n}\n\nfunction loadBindingsSync() {\n let attempts: any[] = []\n try {\n return loadNative()\n } catch (a) {\n attempts = attempts.concat(a)\n }\n\n // we can leverage the wasm bindings if they are already\n // loaded\n if (wasmBindings) {\n return wasmBindings\n }\n\n logLoadFailure(attempts)\n throw new Error('Failed to load bindings', { cause: attempts })\n}\n\nlet loggingLoadFailure = false\n\nfunction logLoadFailure(attempts: any, triedWasm = false) {\n // make sure we only emit the event and log the failure once\n if (loggingLoadFailure) return\n loggingLoadFailure = true\n\n for (let attempt of attempts) {\n Log.warn(attempt)\n }\n\n // @ts-expect-error TODO: this event has a wrong type.\n eventSwcLoadFailure({\n wasm: triedWasm ? 'failed' : undefined,\n nativeBindingsErrorCode: lastNativeBindingsLoadErrorCode,\n })\n .then(() => lockfilePatchPromise.cur || Promise.resolve())\n .finally(() => {\n Log.error(\n `Failed to load SWC binary for ${PlatformName}/${ArchName}, see more info here: https://nextjs.org/docs/messages/failed-loading-swc`\n )\n process.exit(1)\n })\n}\n\ntype RustifiedEnv = { name: string; value: string }[]\n\nexport function createDefineEnv({\n isTurbopack,\n clientRouterFilters,\n config,\n dev,\n distDir,\n fetchCacheKeyPrefix,\n hasRewrites,\n middlewareMatchers,\n}: Omit<\n DefineEnvPluginOptions,\n 'isClient' | 'isNodeOrEdgeCompilation' | 'isEdgeServer' | 'isNodeServer'\n>): DefineEnv {\n let defineEnv: DefineEnv = {\n client: [],\n edge: [],\n nodejs: [],\n }\n\n for (const variant of Object.keys(defineEnv) as (keyof typeof defineEnv)[]) {\n defineEnv[variant] = rustifyEnv(\n getDefineEnv({\n isTurbopack,\n clientRouterFilters,\n config,\n dev,\n distDir,\n fetchCacheKeyPrefix,\n hasRewrites,\n isClient: variant === 'client',\n isEdgeServer: variant === 'edge',\n isNodeOrEdgeCompilation: variant === 'nodejs' || variant === 'edge',\n isNodeServer: variant === 'nodejs',\n middlewareMatchers,\n })\n )\n }\n\n return defineEnv\n}\n\nfunction rustifyEnv(env: Record<string, string>): RustifiedEnv {\n return Object.entries(env)\n .filter(([_, value]) => value != null)\n .map(([name, value]) => ({\n name,\n value,\n }))\n}\n\n// TODO(sokra) Support wasm option.\nfunction bindingToApi(\n binding: RawBindings,\n _wasm: boolean\n): Binding['turbo']['createProject'] {\n type NativeFunction<T> = (\n callback: (err: Error, value: T) => void\n ) => Promise<{ __napiType: 'RootTask' }>\n\n const cancel = new (class Cancel extends Error {})()\n\n /**\n * Utility function to ensure all variants of an enum are handled.\n */\n function invariant(\n never: never,\n computeMessage: (arg: any) => string\n ): never {\n throw new Error(`Invariant: ${computeMessage(never)}`)\n }\n\n async function withErrorCause<T>(fn: () => Promise<T>): Promise<T> {\n try {\n return await fn()\n } catch (nativeError: any) {\n throw new TurbopackInternalError(nativeError)\n }\n }\n\n /**\n * Calls a native function and streams the result.\n * If useBuffer is true, all values will be preserved, potentially buffered\n * if consumed slower than produced. Else, only the latest value will be\n * preserved.\n */\n function subscribe<T>(\n useBuffer: boolean,\n nativeFunction:\n | NativeFunction<T>\n | ((callback: (err: Error, value: T) => void) => Promise<void>)\n ): AsyncIterableIterator<T> {\n type BufferItem =\n | { err: Error; value: undefined }\n | { err: undefined; value: T }\n // A buffer of produced items. This will only contain values if the\n // consumer is slower than the producer.\n let buffer: BufferItem[] = []\n // A deferred value waiting for the next produced item. This will only\n // exist if the consumer is faster than the producer.\n let waiting:\n | {\n resolve: (value: T) => void\n reject: (error: Error) => void\n }\n | undefined\n let canceled = false\n\n // The native function will call this every time it emits a new result. We\n // either need to notify a waiting consumer, or buffer the new result until\n // the consumer catches up.\n function emitResult(err: Error | undefined, value: T | undefined) {\n if (waiting) {\n let { resolve, reject } = waiting\n waiting = undefined\n if (err) reject(err)\n else resolve(value!)\n } else {\n const item = { err, value } as BufferItem\n if (useBuffer) buffer.push(item)\n else buffer[0] = item\n }\n }\n\n async function* createIterator() {\n const task = await withErrorCause<{ __napiType: 'RootTask' } | void>(() =>\n nativeFunction(emitResult)\n )\n try {\n while (!canceled) {\n if (buffer.length > 0) {\n const item = buffer.shift()!\n if (item.err) throw item.err\n yield item.value\n } else {\n // eslint-disable-next-line no-loop-func\n yield new Promise<T>((resolve, reject) => {\n waiting = { resolve, reject }\n })\n }\n }\n } catch (e) {\n if (e === cancel) return\n if (e instanceof Error) {\n throw new TurbopackInternalError(e)\n }\n throw e\n } finally {\n if (task) {\n binding.rootTaskDispose(task)\n }\n }\n }\n\n const iterator = createIterator()\n iterator.return = async () => {\n canceled = true\n if (waiting) waiting.reject(cancel)\n return { value: undefined, done: true } as IteratorReturnResult<never>\n }\n return iterator\n }\n\n async function rustifyProjectOptions(\n options: ProjectOptions\n ): Promise<NapiProjectOptions> {\n return {\n ...options,\n nextConfig: await serializeNextConfig(\n options.nextConfig,\n options.projectPath!\n ),\n jsConfig: JSON.stringify(options.jsConfig),\n env: rustifyEnv(options.env),\n }\n }\n\n async function rustifyPartialProjectOptions(\n options: Partial<ProjectOptions>\n ): Promise<NapiPartialProjectOptions> {\n return {\n ...options,\n nextConfig:\n options.nextConfig &&\n (await serializeNextConfig(options.nextConfig, options.projectPath!)),\n jsConfig: options.jsConfig && JSON.stringify(options.jsConfig),\n env: options.env && rustifyEnv(options.env),\n }\n }\n\n class ProjectImpl implements Project {\n private readonly _nativeProject: { __napiType: 'Project' }\n\n constructor(nativeProject: { __napiType: 'Project' }) {\n this._nativeProject = nativeProject\n }\n\n async update(options: Partial<ProjectOptions>) {\n await withErrorCause(async () =>\n binding.projectUpdate(\n this._nativeProject,\n await rustifyPartialProjectOptions(options)\n )\n )\n }\n\n entrypointsSubscribe() {\n type NapiEndpoint = { __napiType: 'Endpoint' }\n\n type NapiEntrypoints = {\n routes: NapiRoute[]\n middleware?: NapiMiddleware\n instrumentation?: NapiInstrumentation\n pagesDocumentEndpoint: NapiEndpoint\n pagesAppEndpoint: NapiEndpoint\n pagesErrorEndpoint: NapiEndpoint\n }\n\n type NapiMiddleware = {\n endpoint: NapiEndpoint\n runtime: 'nodejs' | 'edge'\n matcher?: string[]\n }\n\n type NapiInstrumentation = {\n nodeJs: NapiEndpoint\n edge: NapiEndpoint\n }\n\n type NapiRoute = {\n pathname: string\n } & (\n | {\n type: 'page'\n htmlEndpoint: NapiEndpoint\n dataEndpoint: NapiEndpoint\n }\n | {\n type: 'page-api'\n endpoint: NapiEndpoint\n }\n | {\n type: 'app-page'\n pages: {\n originalName: string\n htmlEndpoint: NapiEndpoint\n rscEndpoint: NapiEndpoint\n }[]\n }\n | {\n type: 'app-route'\n originalName: string\n endpoint: NapiEndpoint\n }\n | {\n type: 'conflict'\n }\n )\n\n const subscription = subscribe<TurbopackResult<NapiEntrypoints>>(\n false,\n async (callback) =>\n binding.projectEntrypointsSubscribe(this._nativeProject, callback)\n )\n return (async function* () {\n for await (const entrypoints of subscription) {\n const routes = new Map()\n for (const { pathname, ...nativeRoute } of entrypoints.routes) {\n let route: Route\n const routeType = nativeRoute.type\n switch (routeType) {\n case 'page':\n route = {\n type: 'page',\n htmlEndpoint: new EndpointImpl(nativeRoute.htmlEndpoint),\n dataEndpoint: new EndpointImpl(nativeRoute.dataEndpoint),\n }\n break\n case 'page-api':\n route = {\n type: 'page-api',\n endpoint: new EndpointImpl(nativeRoute.endpoint),\n }\n break\n case 'app-page':\n route = {\n type: 'app-page',\n pages: nativeRoute.pages.map((page) => ({\n originalName: page.originalName,\n htmlEndpoint: new EndpointImpl(page.htmlEndpoint),\n rscEndpoint: new EndpointImpl(page.rscEndpoint),\n })),\n }\n break\n case 'app-route':\n route = {\n type: 'app-route',\n originalName: nativeRoute.originalName,\n endpoint: new EndpointImpl(nativeRoute.endpoint),\n }\n break\n case 'conflict':\n route = {\n type: 'conflict',\n }\n break\n default:\n const _exhaustiveCheck: never = routeType\n invariant(\n nativeRoute,\n () => `Unknown route type: ${_exhaustiveCheck}`\n )\n }\n routes.set(pathname, route)\n }\n const napiMiddlewareToMiddleware = (middleware: NapiMiddleware) => ({\n endpoint: new EndpointImpl(middleware.endpoint),\n runtime: middleware.runtime,\n matcher: middleware.matcher,\n })\n const middleware = entrypoints.middleware\n ? napiMiddlewareToMiddleware(entrypoints.middleware)\n : undefined\n const napiInstrumentationToInstrumentation = (\n instrumentation: NapiInstrumentation\n ) => ({\n nodeJs: new EndpointImpl(instrumentation.nodeJs),\n edge: new EndpointImpl(instrumentation.edge),\n })\n const instrumentation = entrypoints.instrumentation\n ? napiInstrumentationToInstrumentation(entrypoints.instrumentation)\n : undefined\n yield {\n routes,\n middleware,\n instrumentation,\n pagesDocumentEndpoint: new EndpointImpl(\n entrypoints.pagesDocumentEndpoint\n ),\n pagesAppEndpoint: new EndpointImpl(entrypoints.pagesAppEndpoint),\n pagesErrorEndpoint: new EndpointImpl(\n entrypoints.pagesErrorEndpoint\n ),\n issues: entrypoints.issues,\n diagnostics: entrypoints.diagnostics,\n }\n }\n })()\n }\n\n hmrEvents(identifier: string) {\n return subscribe<TurbopackResult<Update>>(true, async (callback) =>\n binding.projectHmrEvents(this._nativeProject, identifier, callback)\n )\n }\n\n hmrIdentifiersSubscribe() {\n return subscribe<TurbopackResult<HmrIdentifiers>>(\n false,\n async (callback) =>\n binding.projectHmrIdentifiersSubscribe(this._nativeProject, callback)\n )\n }\n\n traceSource(\n stackFrame: TurbopackStackFrame,\n currentDirectoryFileUrl: string\n ): Promise<TurbopackStackFrame | null> {\n return binding.projectTraceSource(\n this._nativeProject,\n stackFrame,\n currentDirectoryFileUrl\n )\n }\n\n getSourceForAsset(filePath: string): Promise<string | null> {\n return binding.projectGetSourceForAsset(this._nativeProject, filePath)\n }\n\n getSourceMap(filePath: string): Promise<string | null> {\n return binding.projectGetSourceMap(this._nativeProject, filePath)\n }\n\n getSourceMapSync(filePath: string): string | null {\n return binding.projectGetSourceMapSync(this._nativeProject, filePath)\n }\n\n updateInfoSubscribe(aggregationMs: number) {\n return subscribe<TurbopackResult<UpdateMessage>>(true, async (callback) =>\n binding.projectUpdateInfoSubscribe(\n this._nativeProject,\n aggregationMs,\n callback\n )\n )\n }\n\n shutdown(): Promise<void> {\n return binding.projectShutdown(this._nativeProject)\n }\n\n onExit(): Promise<void> {\n return binding.projectOnExit(this._nativeProject)\n }\n }\n\n class EndpointImpl implements Endpoint {\n private readonly _nativeEndpoint: { __napiType: 'Endpoint' }\n\n constructor(nativeEndpoint: { __napiType: 'Endpoint' }) {\n this._nativeEndpoint = nativeEndpoint\n }\n\n async writeToDisk(): Promise<TurbopackResult<WrittenEndpoint>> {\n return await withErrorCause(\n () =>\n binding.endpointWriteToDisk(this._nativeEndpoint) as Promise<\n TurbopackResult<WrittenEndpoint>\n >\n )\n }\n\n async clientChanged(): Promise<AsyncIterableIterator<TurbopackResult<{}>>> {\n const clientSubscription = subscribe<TurbopackResult>(\n false,\n async (callback) =>\n binding.endpointClientChangedSubscribe(\n await this._nativeEndpoint,\n callback\n )\n )\n await clientSubscription.next()\n return clientSubscription\n }\n\n async serverChanged(\n includeIssues: boolean\n ): Promise<AsyncIterableIterator<TurbopackResult<{}>>> {\n const serverSubscription = subscribe<TurbopackResult>(\n false,\n async (callback) =>\n binding.endpointServerChangedSubscribe(\n await this._nativeEndpoint,\n includeIssues,\n callback\n )\n )\n await serverSubscription.next()\n return serverSubscription\n }\n }\n\n /**\n * Returns a new copy of next.js config object to avoid mutating the original.\n *\n * Also it does some augmentation to the configuration as well, for example set the\n * turbopack's rules if `experimental.reactCompilerOptions` is set.\n */\n function augmentNextConfig(\n originalNextConfig: NextConfigComplete,\n projectPath: string\n ): Record<string, any> {\n let nextConfig = { ...(originalNextConfig as any) }\n\n const reactCompilerOptions = nextConfig.experimental?.reactCompiler\n\n // It is not easy to set the rules inside of rust as resolving, and passing the context identical to the webpack\n // config is bit hard, also we can reuse same codes between webpack config in here.\n if (reactCompilerOptions) {\n const ruleKeys = ['*.ts', '*.js', '*.jsx', '*.tsx']\n if (\n Object.keys(nextConfig?.experimental?.turbo?.rules ?? []).some((key) =>\n ruleKeys.includes(key)\n )\n ) {\n Log.warn(\n `The React Compiler cannot be enabled automatically because 'experimental.turbo' contains a rule for '*.ts', '*.js', '*.jsx', and '*.tsx'. Remove this rule, or add 'babel-loader' and 'babel-plugin-react-compiler' to the Turbopack configuration manually.`\n )\n } else {\n if (!nextConfig.experimental.turbo) {\n nextConfig.experimental.turbo = {}\n }\n\n if (!nextConfig.experimental.turbo.rules) {\n nextConfig.experimental.turbo.rules = {}\n }\n\n for (const key of ['*.ts', '*.js', '*.jsx', '*.tsx']) {\n nextConfig.experimental.turbo.rules[key] = {\n browser: {\n foreign: false,\n loaders: [\n getReactCompilerLoader(\n originalNextConfig.experimental.reactCompiler,\n projectPath,\n nextConfig.dev,\n false,\n undefined\n ),\n ],\n },\n }\n }\n }\n }\n\n return nextConfig\n }\n\n async function serializeNextConfig(\n nextConfig: NextConfigComplete,\n projectPath: string\n ): Promise<string> {\n // Avoid mutating the existing `nextConfig` object.\n let nextConfigSerializable = augmentNextConfig(nextConfig, projectPath)\n\n nextConfigSerializable.generateBuildId =\n await nextConfig.generateBuildId?.()\n\n // TODO: these functions takes arguments, have to be supported in a different way\n nextConfigSerializable.exportPathMap = {}\n nextConfigSerializable.webpack = nextConfig.webpack && {}\n\n if (nextConfigSerializable.experimental?.turbo?.rules) {\n ensureLoadersHaveSerializableOptions(\n nextConfigSerializable.experimental.turbo?.rules\n )\n }\n\n nextConfigSerializable.modularizeImports =\n nextConfigSerializable.modularizeImports\n ? Object.fromEntries(\n Object.entries<any>(nextConfigSerializable.modularizeImports).map(\n ([mod, config]) => [\n mod,\n {\n ...config,\n transform:\n typeof config.transform === 'string'\n ? config.transform\n : Object.entries(config.transform).map(([key, value]) => [\n key,\n value,\n ]),\n },\n ]\n )\n )\n : undefined\n\n // loaderFile is an absolute path, we need it to be relative for turbopack.\n if (nextConfigSerializable.images.loaderFile) {\n nextConfigSerializable.images = {\n ...nextConfig.images,\n loaderFile:\n './' + path.relative(projectPath, nextConfig.images.loaderFile),\n }\n }\n\n return JSON.stringify(nextConfigSerializable, null, 2)\n }\n\n function ensureLoadersHaveSerializableOptions(\n turbopackRules: Record<string, TurboRuleConfigItemOrShortcut>\n ) {\n for (const [glob, rule] of Object.entries(turbopackRules)) {\n if (Array.isArray(rule)) {\n checkLoaderItems(rule, glob)\n } else {\n checkConfigItem(rule, glob)\n }\n }\n\n function checkConfigItem(rule: TurboRuleConfigItem, glob: string) {\n if (!rule) return\n if ('loaders' in rule) {\n checkLoaderItems((rule as TurboRuleConfigItemOptions).loaders, glob)\n } else {\n for (const key in rule) {\n const inner = rule[key]\n if (typeof inner === 'object' && inner) {\n checkConfigItem(inner, glob)\n }\n }\n }\n }\n\n function checkLoaderItems(loaderItems: TurboLoaderItem[], glob: string) {\n for (const loaderItem of loaderItems) {\n if (\n typeof loaderItem !== 'string' &&\n !isDeepStrictEqual(loaderItem, JSON.parse(JSON.stringify(loaderItem)))\n ) {\n throw new Error(\n `loader ${loaderItem.loader} for match \"${glob}\" does not have serializable options. Ensure that options passed are plain JavaScript objects and values.`\n )\n }\n }\n }\n }\n\n return async function createProject(\n options: ProjectOptions,\n turboEngineOptions\n ) {\n return new ProjectImpl(\n await binding.projectNew(\n await rustifyProjectOptions(options),\n turboEngineOptions || {}\n )\n )\n }\n}\n\nasync function loadWasm(importPath = '') {\n if (wasmBindings) {\n return wasmBindings\n }\n\n let attempts = []\n for (let pkg of ['@next/swc-wasm-nodejs', '@next/swc-wasm-web']) {\n try {\n let pkgPath = pkg\n\n if (importPath) {\n // the import path must be exact when not in node_modules\n pkgPath = path.join(importPath, pkg, 'wasm.js')\n }\n let bindings: RawWasmBindings = await import(\n pathToFileURL(pkgPath).toString()\n )\n if (pkg === '@next/swc-wasm-web') {\n bindings = await bindings.default!()\n }\n infoLog('next-swc build: wasm build @next/swc-wasm-web')\n\n // Note wasm binary does not support async intefaces yet, all async\n // interface coereces to sync interfaces.\n wasmBindings = {\n css: {\n lightning: {\n transform: function (_options: any) {\n throw new Error(\n '`css.lightning.transform` is not supported by the wasm bindings.'\n )\n },\n transformStyleAttr: function (_options: any) {\n throw new Error(\n '`css.lightning.transformStyleAttr` is not supported by the wasm bindings.'\n )\n },\n },\n },\n isWasm: true,\n transform(src: string, options: any) {\n // TODO: we can remove fallback to sync interface once new stable version of next-swc gets published (current v12.2)\n return bindings?.transform\n ? bindings.transform(src.toString(), options)\n : Promise.resolve(bindings.transformSync(src.toString(), options))\n },\n transformSync(src: string, options: any) {\n return bindings.transformSync(src.toString(), options)\n },\n minify(src: string, options: any) {\n return bindings?.minify\n ? bindings.minify(src.toString(), options)\n : Promise.resolve(bindings.minifySync(src.toString(), options))\n },\n minifySync(src: string, options: any) {\n return bindings.minifySync(src.toString(), options)\n },\n parse(src: string, options: any) {\n return bindings?.parse\n ? bindings.parse(src.toString(), options)\n : Promise.resolve(bindings.parseSync(src.toString(), options))\n },\n getTargetTriple() {\n return undefined\n },\n turbo: {\n createProject: function (\n _options: ProjectOptions,\n _turboEngineOptions?: TurboEngineOptions | undefined\n ): Promise<Project> {\n throw new Error(\n '`turbo.createProject` is not supported by the wasm bindings.'\n )\n },\n startTurbopackTraceServer: function (_traceFilePath: string): void {\n throw new Error(\n '`turbo.startTurbopackTraceServer` is not supported by the wasm bindings.'\n )\n },\n },\n mdx: {\n compile(src: string, options: any) {\n return bindings.mdxCompile(src, getMdxOptions(options))\n },\n compileSync(src: string, options: any) {\n return bindings.mdxCompileSync(src, getMdxOptions(options))\n },\n },\n }\n return wasmBindings\n } catch (e: any) {\n // Only log attempts for loading wasm when loading as fallback\n if (importPath) {\n if (e?.code === 'ERR_MODULE_NOT_FOUND') {\n attempts.push(`Attempted to load ${pkg}, but it was not installed`)\n } else {\n attempts.push(\n `Attempted to load ${pkg}, but an error occurred: ${e.message ?? e}`\n )\n }\n }\n }\n }\n\n throw attempts\n}\n\nfunction loadNative(importPath?: string) {\n if (nativeBindings) {\n return nativeBindings\n }\n\n const customBindings: RawBindings = !!__INTERNAL_CUSTOM_TURBOPACK_BINDINGS\n ? require(__INTERNAL_CUSTOM_TURBOPACK_BINDINGS)\n : null\n let bindings: RawBindings = customBindings\n let attempts: any[] = []\n\n const NEXT_TEST_NATIVE_DIR = process.env.NEXT_TEST_NATIVE_DIR\n for (const triple of triples) {\n if (NEXT_TEST_NATIVE_DIR) {\n try {\n // Use the binary directly to skip `pnpm pack` for testing as it's slow because of the large native binary.\n bindings = require(\n `${NEXT_TEST_NATIVE_DIR}/next-swc.${triple.platformArchABI}.node`\n )\n infoLog(\n 'next-swc build: local built @next/swc from NEXT_TEST_NATIVE_DIR'\n )\n break\n } catch (e) {}\n } else {\n try {\n bindings = require(\n `@next/swc/native/next-swc.${triple.platformArchABI}.node`\n )\n infoLog('next-swc build: local built @next/swc')\n break\n } catch (e) {}\n }\n }\n\n if (!bindings) {\n for (const triple of triples) {\n let pkg = importPath\n ? path.join(\n importPath,\n `@next/swc-${triple.platformArchABI}`,\n `next-swc.${triple.platformArchABI}.node`\n )\n : `@next/swc-${triple.platformArchABI}`\n try {\n bindings = require(pkg)\n if (!importPath) {\n checkVersionMismatch(require(`${pkg}/package.json`))\n }\n break\n } catch (e: any) {\n if (e?.code === 'MODULE_NOT_FOUND') {\n attempts.push(`Attempted to load ${pkg}, but it was not installed`)\n } else {\n attempts.push(\n `Attempted to load ${pkg}, but an error occurred: ${e.message ?? e}`\n )\n }\n lastNativeBindingsLoadErrorCode = e?.code ?? 'unknown'\n }\n }\n }\n\n if (bindings) {\n nativeBindings = {\n isWasm: false,\n transform(src: string, options: any) {\n const isModule =\n typeof src !== 'undefined' &&\n typeof src !== 'string' &&\n !Buffer.isBuffer(src)\n options = options || {}\n\n if (options?.jsc?.parser) {\n options.jsc.parser.syntax = options.jsc.parser.syntax ?? 'ecmascript'\n }\n\n return bindings.transform(\n isModule ? JSON.stringify(src) : src,\n isModule,\n toBuffer(options)\n )\n },\n\n transformSync(src: string, options: any) {\n if (typeof src === 'undefined') {\n throw new Error(\n \"transformSync doesn't implement reading the file from filesystem\"\n )\n } else if (Buffer.isBuffer(src)) {\n throw new Error(\n \"transformSync doesn't implement taking the source code as Buffer\"\n )\n }\n const isModule = typeof src !== 'string'\n options = options || {}\n\n if (options?.jsc?.parser) {\n options.jsc.parser.syntax = options.jsc.parser.syntax ?? 'ecmascript'\n }\n\n return bindings.transformSync(\n isModule ? JSON.stringify(src) : src,\n isModule,\n toBuffer(options)\n )\n },\n\n minify(src: string, options: any) {\n return bindings.minify(toBuffer(src), toBuffer(options ?? {}))\n },\n\n minifySync(src: string, options: any) {\n return bindings.minifySync(toBuffer(src), toBuffer(options ?? {}))\n },\n\n parse(src: string, options: any) {\n return bindings.parse(src, toBuffer(options ?? {}))\n },\n\n getTargetTriple: bindings.getTargetTriple,\n initCustomTraceSubscriber: bindings.initCustomTraceSubscriber,\n teardownTraceSubscriber: bindings.teardownTraceSubscriber,\n turbo: {\n createProject: bindingToApi(customBindings ?? bindings, false),\n startTurbopackTraceServer(traceFilePath) {\n Log.warn(\n 'Turbopack trace server started. View trace at https://turbo-trace-viewer.vercel.app/'\n )\n ;(customBindings ?? bindings).startTurbopackTraceServer(traceFilePath)\n },\n },\n mdx: {\n compile(src: string, options: any) {\n return bindings.mdxCompile(src, toBuffer(getMdxOptions(options)))\n },\n compileSync(src: string, options: any) {\n bindings.mdxCompileSync(src, toBuffer(getMdxOptions(options)))\n },\n },\n css: {\n lightning: {\n transform(transformOptions: any) {\n return bindings.lightningCssTransform(transformOptions)\n },\n transformStyleAttr(transformAttrOptions: any) {\n return bindings.lightningCssTransformStyleAttribute(\n transformAttrOptions\n )\n },\n },\n },\n }\n return nativeBindings\n }\n\n throw attempts\n}\n\n/// Build a mdx options object contains default values that\n/// can be parsed with serde_wasm_bindgen.\nfunction getMdxOptions(options: any = {}) {\n return {\n ...options,\n development: options.development ?? false,\n jsx: options.jsx ?? false,\n mdxType: options.mdxType ?? 'commonMark',\n }\n}\n\nfunction toBuffer(t: any) {\n return Buffer.from(JSON.stringify(t))\n}\n\nexport async function isWasm(): Promise<boolean> {\n let bindings = await loadBindings()\n return bindings.isWasm\n}\n\nexport async function transform(src: string, options?: any): Promise<any> {\n let bindings = await loadBindings()\n return bindings.transform(src, options)\n}\n\nexport function transformSync(src: string, options?: any): any {\n let bindings = loadBindingsSync()\n return bindings.transformSync(src, options)\n}\n\nexport async function minify(\n src: string,\n options: any\n): Promise<{ code: string; map: any }> {\n let bindings = await loadBindings()\n return bindings.minify(src, options)\n}\n\nexport async function parse(src: string, options: any): Promise<any> {\n let bindings = await loadBindings()\n let parserOptions = getParserOptions(options)\n return bindings\n .parse(src, parserOptions)\n .then((astStr: any) => JSON.parse(astStr))\n}\n\nexport function getBinaryMetadata() {\n let bindings\n try {\n bindings = loadNative()\n } catch (e) {\n // Suppress exceptions, this fn allows to fail to load native bindings\n }\n\n return {\n target: bindings?.getTargetTriple?.(),\n }\n}\n\n/**\n * Initialize trace subscriber to emit traces.\n *\n */\nexport function initCustomTraceSubscriber(traceFileName?: string) {\n if (swcTraceFlushGuard) {\n // Wasm binary doesn't support trace emission\n let bindings = loadNative()\n swcTraceFlushGuard = bindings.initCustomTraceSubscriber?.(traceFileName)\n }\n}\n\nfunction once(fn: () => void): () => void {\n let executed = false\n\n return function (): void {\n if (!executed) {\n executed = true\n\n fn()\n }\n }\n}\n\n/**\n * Teardown swc's trace subscriber if there's an initialized flush guard exists.\n *\n * This is workaround to amend behavior with process.exit\n * (https://github.com/vercel/next.js/blob/4db8c49cc31e4fc182391fae6903fb5ef4e8c66e/packages/next/bin/next.ts#L134=)\n * seems preventing napi's cleanup hook execution (https://github.com/swc-project/swc/blob/main/crates/node/src/util.rs#L48-L51=),\n *\n * instead parent process manually drops guard when process gets signal to exit.\n */\nexport const teardownTraceSubscriber = once(() => {\n try {\n let bindings = loadNative()\n if (swcTraceFlushGuard) {\n bindings.teardownTraceSubscriber?.(swcTraceFlushGuard)\n }\n } catch (e) {\n // Suppress exceptions, this fn allows to fail to load native bindings\n }\n})\n"],"names":["createDefineEnv","getBinaryMetadata","getSupportedArchTriples","initCustomTraceSubscriber","isWasm","loadBindings","lockfilePatchPromise","minify","parse","teardownTraceSubscriber","transform","transformSync","nextVersion","process","env","__NEXT_VERSION","ArchName","arch","PlatformName","platform","infoLog","args","NEXT_PRIVATE_BUILD_WORKER","DEBUG","Log","info","darwin","win32","linux","freebsd","android","platformArchTriples","arm64","ia32","filter","triple","abi","x64","arm","triples","supportedArchTriples","targetTriple","rawTargetTriple","warn","__INTERNAL_CUSTOM_TURBOPACK_BINDINGS","checkVersionMismatch","pkgData","version","knownDefaultWasmFallbackTriples","lastNativeBindingsLoadErrorCode","undefined","nativeBindings","wasmBindings","downloadWasmPromise","pendingBindings","swcTraceFlushGuard","downloadNativeBindingsPromise","useWasmBinary","RUST_MIN_STACK","stdout","_handle","setBlocking","stderr","Promise","resolve","_reject","cur","patchIncorrectLockfile","cwd","catch","console","error","attempts","disableWasmFallback","NEXT_DISABLE_SWC_WASM","unsupportedPlatform","some","raw","includes","isWebContainer","versions","webcontainer","shouldLoadWasmFallbackFirst","fallbackBindings","tryLoadWasmWithFallback","loadNative","a","Array","isArray","every","m","tryLoadNativeWithFallback","concat","logLoadFailure","nativeBindingsDirectory","path","join","dirname","require","downloadNativeNextSwc","map","platformArchABI","push","bindings","loadWasm","eventSwcLoadFailure","wasm","nativeBindingsErrorCode","wasmDirectory","downloadWasmSwc","attempt","loadBindingsSync","Error","cause","loggingLoadFailure","triedWasm","then","finally","exit","isTurbopack","clientRouterFilters","config","dev","distDir","fetchCacheKeyPrefix","hasRewrites","middlewareMatchers","defineEnv","client","edge","nodejs","variant","Object","keys","rustifyEnv","getDefineEnv","isClient","isEdgeServer","isNodeOrEdgeCompilation","isNodeServer","entries","_","value","name","bindingToApi","binding","_wasm","cancel","Cancel","invariant","never","computeMessage","withErrorCause","fn","nativeError","TurbopackInternalError","subscribe","useBuffer","nativeFunction","buffer","waiting","canceled","emitResult","err","reject","item","createIterator","task","length","shift","e","rootTaskDispose","iterator","return","done","rustifyProjectOptions","options","nextConfig","serializeNextConfig","projectPath","jsConfig","JSON","stringify","rustifyPartialProjectOptions","ProjectImpl","constructor","nativeProject","_nativeProject","update","projectUpdate","entrypointsSubscribe","subscription","callback","projectEntrypointsSubscribe","entrypoints","routes","Map","pathname","nativeRoute","route","routeType","type","htmlEndpoint","EndpointImpl","dataEndpoint","endpoint","pages","page","originalName","rscEndpoint","_exhaustiveCheck","set","napiMiddlewareToMiddleware","middleware","runtime","matcher","napiInstrumentationToInstrumentation","instrumentation","nodeJs","pagesDocumentEndpoint","pagesAppEndpoint","pagesErrorEndpoint","issues","diagnostics","hmrEvents","identifier","projectHmrEvents","hmrIdentifiersSubscribe","projectHmrIdentifiersSubscribe","traceSource","stackFrame","currentDirectoryFileUrl","projectTraceSource","getSourceForAsset","filePath","projectGetSourceForAsset","getSourceMap","projectGetSourceMap","getSourceMapSync","projectGetSourceMapSync","updateInfoSubscribe","aggregationMs","projectUpdateInfoSubscribe","shutdown","projectShutdown","onExit","projectOnExit","nativeEndpoint","_nativeEndpoint","writeToDisk","endpointWriteToDisk","clientChanged","clientSubscription","endpointClientChangedSubscribe","next","serverChanged","includeIssues","serverSubscription","endpointServerChangedSubscribe","augmentNextConfig","originalNextConfig","reactCompilerOptions","experimental","reactCompiler","ruleKeys","turbo","rules","key","browser","foreign","loaders","getReactCompilerLoader","nextConfigSerializable","generateBuildId","exportPathMap","webpack","ensureLoadersHaveSerializableOptions","modularizeImports","fromEntries","mod","images","loaderFile","relative","turbopackRules","glob","rule","checkLoaderItems","checkConfigItem","inner","loaderItems","loaderItem","isDeepStrictEqual","loader","createProject","turboEngineOptions","projectNew","importPath","pkg","pkgPath","pathToFileURL","toString","default","css","lightning","_options","transformStyleAttr","src","minifySync","parseSync","getTargetTriple","_turboEngineOptions","startTurbopackTraceServer","_traceFilePath","mdx","compile","mdxCompile","getMdxOptions","compileSync","mdxCompileSync","code","message","customBindings","NEXT_TEST_NATIVE_DIR","isModule","Buffer","isBuffer","jsc","parser","syntax","toBuffer","traceFilePath","transformOptions","lightningCssTransform","transformAttrOptions","lightningCssTransformStyleAttribute","development","jsx","mdxType","t","from","parserOptions","getParserOptions","astStr","target","traceFileName","once","executed"],"mappings":"AAAA,0DAA0D;;;;;;;;;;;;;;;;;;;;;;;;;IA+X1CA,eAAe;eAAfA;;IA65BAC,iBAAiB;eAAjBA;;IA1tCAC,uBAAuB;eAAvBA;;IA2uCAC,yBAAyB;eAAzBA;;IAhDMC,MAAM;eAANA;;IAllCAC,YAAY;eAAZA;;IAFTC,oBAAoB;eAApBA;;IAmmCSC,MAAM;eAANA;;IAQAC,KAAK;eAALA;;IAsDTC,uBAAuB;eAAvBA;;IAxESC,SAAS;eAATA;;IAKNC,aAAa;eAAbA;;;6DAtwCC;qBACa;oBACC;yBACK;6DACf;yBACY;gCACG;wCACG;6BACgB;sBAQrB;iCAI3B;sCACgC;uBAoBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOvC,MAAMC,cAAcC,QAAQC,GAAG,CAACC,cAAc;AAE9C,MAAMC,WAAWC,IAAAA,QAAI;AACrB,MAAMC,eAAeC,IAAAA,YAAQ;AAE7B,SAASC,QAAQ,GAAGC,IAAW;IAC7B,IAAIR,QAAQC,GAAG,CAACQ,yBAAyB,EAAE;QACzC;IACF;IACA,IAAIT,QAAQC,GAAG,CAACS,KAAK,EAAE;QACrBC,KAAIC,IAAI,IAAIJ;IACd;AACF;AAKO,SAASnB;IACd,MAAM,EAAEwB,MAAM,EAAEC,KAAK,EAAEC,KAAK,EAAEC,OAAO,EAAEC,OAAO,EAAE,GAAGC,4BAAmB;IAEtE,OAAO;QACLL;QACAC,OAAO;YACLK,OAAOL,MAAMK,KAAK;YAClBC,MAAMN,MAAMM,IAAI,CAACC,MAAM,CAAC,CAACC,SAAWA,OAAOC,GAAG,KAAK;YACnDC,KAAKV,MAAMU,GAAG,CAACH,MAAM,CAAC,CAACC,SAAWA,OAAOC,GAAG,KAAK;QACnD;QACAR,OAAO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,KAAK;IAC1C,IAAI;QACF,IAAIlP,WAAWlB;QACf,IAAI9B,oBAAoB;YACtBgD,SAAS9F,uBAAuB,oBAAhC8F,SAAS9F,uBAAuB,MAAhC8F,UAAmChD;QACrC;IACF,EAAE,OAAOmH,GAAG;IACV,sEAAsE;IACxE;AACF"}
@@ -297,6 +297,12 @@ export interface ProjectOptions {
297
297
  * The browserslist query to use for targeting browsers.
298
298
  */
299
299
  browserslistQuery: string;
300
+ /**
301
+ * When the code is minified, this opts out of the default mangling of local
302
+ * names for variables, functions etc., which can be useful for
303
+ * debugging/profiling purposes.
304
+ */
305
+ noMangling: boolean;
300
306
  }
301
307
  export interface DefineEnv {
302
308
  client: RustifiedEnv;
@@ -109,6 +109,7 @@ async function turbopackBuild() {
109
109
  const hasRewrites = _buildcontext.NextBuildContext.hasRewrites;
110
110
  const rewrites = _buildcontext.NextBuildContext.rewrites;
111
111
  const appDirOnly = _buildcontext.NextBuildContext.appDirOnly;
112
+ const noMangling = _buildcontext.NextBuildContext.noMangling;
112
113
  const startTime = process.hrtime();
113
114
  const bindings = await (0, _swc.loadBindings)(config == null ? void 0 : (_config_experimental = config.experimental) == null ? void 0 : _config_experimental.useWasmBinary);
114
115
  const dev = false;
@@ -142,7 +143,8 @@ async function turbopackBuild() {
142
143
  buildId,
143
144
  encryptionKey,
144
145
  previewProps,
145
- browserslistQuery: supportedBrowsers.join(', ')
146
+ browserslistQuery: supportedBrowsers.join(', '),
147
+ noMangling
146
148
  }, {
147
149
  persistentCaching,
148
150
  memoryLimit: (_config_experimental_turbo1 = config.experimental.turbo) == null ? void 0 : _config_experimental_turbo1.memoryLimit,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/build/turbopack-build/impl.ts"],"sourcesContent":["import path from 'path'\nimport { validateTurboNextConfig } from '../../lib/turbopack-warning'\nimport {\n formatIssue,\n getTurbopackJsConfig,\n isPersistentCachingEnabled,\n isRelevantWarning,\n type EntryIssuesMap,\n} from '../../shared/lib/turbopack/utils'\nimport { NextBuildContext } from '../build-context'\nimport { createDefineEnv, loadBindings } from '../swc'\nimport { Sema } from 'next/dist/compiled/async-sema'\nimport {\n handleEntrypoints,\n handlePagesErrorRoute,\n handleRouteType,\n} from '../handle-entrypoints'\nimport type { Entrypoints } from '../swc/types'\nimport { TurbopackManifestLoader } from '../../shared/lib/turbopack/manifest-loader'\nimport { createProgress } from '../progress'\nimport * as Log from '../output/log'\nimport { promises as fs } from 'fs'\nimport { PHASE_PRODUCTION_BUILD } from '../../shared/lib/constants'\nimport loadConfig from '../../server/config'\nimport { hasCustomExportOutput } from '../../export/utils'\nimport { Telemetry } from '../../telemetry/storage'\nimport { setGlobal } from '../../trace'\n\nconst IS_TURBOPACK_BUILD = process.env.TURBOPACK && process.env.TURBOPACK_BUILD\n\nexport async function turbopackBuild(): Promise<{\n duration: number\n buildTraceContext: undefined\n shutdownPromise: Promise<void>\n}> {\n if (!IS_TURBOPACK_BUILD) {\n throw new Error(\"next build doesn't support turbopack yet\")\n }\n\n await validateTurboNextConfig({\n dir: NextBuildContext.dir!,\n isDev: false,\n })\n\n const config = NextBuildContext.config!\n const dir = NextBuildContext.dir!\n const distDir = NextBuildContext.distDir!\n const buildId = NextBuildContext.buildId!\n const encryptionKey = NextBuildContext.encryptionKey!\n const previewProps = NextBuildContext.previewProps!\n const hasRewrites = NextBuildContext.hasRewrites!\n const rewrites = NextBuildContext.rewrites!\n const appDirOnly = NextBuildContext.appDirOnly!\n\n const startTime = process.hrtime()\n const bindings = await loadBindings(config?.experimental?.useWasmBinary)\n const dev = false\n\n // const supportedBrowsers = await getSupportedBrowsers(dir, dev)\n const supportedBrowsers = [\n 'last 1 Chrome versions, last 1 Firefox versions, last 1 Safari versions, last 1 Edge versions',\n ]\n\n const persistentCaching = isPersistentCachingEnabled(config)\n const project = await bindings.turbo.createProject(\n {\n projectPath: dir,\n rootPath:\n config.experimental?.turbo?.root || config.outputFileTracingRoot || dir,\n distDir,\n nextConfig: config,\n jsConfig: await getTurbopackJsConfig(dir, config),\n watch: {\n enable: false,\n },\n dev,\n env: process.env as Record<string, string>,\n defineEnv: createDefineEnv({\n isTurbopack: true,\n clientRouterFilters: NextBuildContext.clientRouterFilters!,\n config,\n dev,\n distDir,\n fetchCacheKeyPrefix: config.experimental.fetchCacheKeyPrefix,\n hasRewrites,\n // Implemented separately in Turbopack, doesn't have to be passed here.\n middlewareMatchers: undefined,\n }),\n buildId,\n encryptionKey,\n previewProps,\n browserslistQuery: supportedBrowsers.join(', '),\n },\n {\n persistentCaching,\n memoryLimit: config.experimental.turbo?.memoryLimit,\n dependencyTracking: persistentCaching,\n }\n )\n\n await fs.mkdir(path.join(distDir, 'server'), { recursive: true })\n await fs.mkdir(path.join(distDir, 'static', buildId), {\n recursive: true,\n })\n await fs.writeFile(\n path.join(distDir, 'package.json'),\n JSON.stringify(\n {\n type: 'commonjs',\n },\n null,\n 2\n )\n )\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const entrypointsSubscription = project.entrypointsSubscribe()\n const currentEntrypoints: Entrypoints = {\n global: {\n app: undefined,\n document: undefined,\n error: undefined,\n\n middleware: undefined,\n instrumentation: undefined,\n },\n\n app: new Map(),\n page: new Map(),\n }\n\n const currentEntryIssues: EntryIssuesMap = new Map()\n\n const manifestLoader = new TurbopackManifestLoader({\n buildId,\n distDir,\n encryptionKey,\n })\n\n const entrypointsResult = await entrypointsSubscription.next()\n if (entrypointsResult.done) {\n throw new Error('Turbopack did not return any entrypoints')\n }\n entrypointsSubscription.return?.().catch(() => {})\n\n const entrypoints = entrypointsResult.value\n\n const topLevelErrors: {\n message: string\n }[] = []\n for (const issue of entrypoints.issues) {\n topLevelErrors.push({\n message: formatIssue(issue),\n })\n }\n\n if (topLevelErrors.length > 0) {\n throw new Error(\n `Turbopack build failed with ${\n topLevelErrors.length\n } issues:\\n${topLevelErrors.map((e) => e.message).join('\\n')}`\n )\n }\n\n await handleEntrypoints({\n entrypoints,\n currentEntrypoints,\n currentEntryIssues,\n manifestLoader,\n productionRewrites: rewrites,\n logErrors: false,\n })\n\n const progress = createProgress(\n currentEntrypoints.page.size + currentEntrypoints.app.size + 1,\n 'Building'\n )\n const promises: Promise<any>[] = []\n\n // Concurrency will start at INITIAL_CONCURRENCY and\n // slowly ramp up to CONCURRENCY by increasing the\n // concurrency by 1 every time a task is completed.\n const INITIAL_CONCURRENCY = 5\n const CONCURRENCY = 10\n\n const sema = new Sema(INITIAL_CONCURRENCY)\n let remainingRampup = CONCURRENCY - INITIAL_CONCURRENCY\n const enqueue = (fn: () => Promise<void>) => {\n promises.push(\n (async () => {\n await sema.acquire()\n try {\n await fn()\n } finally {\n sema.release()\n if (remainingRampup > 0) {\n remainingRampup--\n sema.release()\n }\n progress.run()\n }\n })()\n )\n }\n\n if (!appDirOnly) {\n for (const [page, route] of currentEntrypoints.page) {\n enqueue(() =>\n handleRouteType({\n page,\n route,\n currentEntryIssues,\n entrypoints: currentEntrypoints,\n manifestLoader,\n productionRewrites: rewrites,\n logErrors: false,\n })\n )\n }\n }\n\n for (const [page, route] of currentEntrypoints.app) {\n enqueue(() =>\n handleRouteType({\n page,\n route,\n currentEntryIssues,\n entrypoints: currentEntrypoints,\n manifestLoader,\n productionRewrites: rewrites,\n logErrors: false,\n })\n )\n }\n\n enqueue(() =>\n handlePagesErrorRoute({\n currentEntryIssues,\n entrypoints: currentEntrypoints,\n manifestLoader,\n productionRewrites: rewrites,\n logErrors: false,\n })\n )\n await Promise.all(promises)\n\n await manifestLoader.writeManifests({\n devRewrites: undefined,\n productionRewrites: rewrites,\n entrypoints: currentEntrypoints,\n })\n\n const errors: {\n page: string\n message: string\n }[] = []\n const warnings: {\n page: string\n message: string\n }[] = []\n for (const [page, entryIssues] of currentEntryIssues) {\n for (const issue of entryIssues.values()) {\n if (issue.severity !== 'warning') {\n errors.push({\n page,\n message: formatIssue(issue),\n })\n } else {\n if (isRelevantWarning(issue)) {\n warnings.push({\n page,\n message: formatIssue(issue),\n })\n }\n }\n }\n }\n\n const shutdownPromise = project.shutdown()\n\n if (warnings.length > 0) {\n Log.warn(\n `Turbopack build collected ${warnings.length} warnings:\\n${warnings\n .map((e) => {\n return 'Page: ' + e.page + '\\n' + e.message\n })\n .join('\\n')}`\n )\n }\n\n if (errors.length > 0) {\n throw new Error(\n `Turbopack build failed with ${errors.length} errors:\\n${errors\n .map((e) => {\n return 'Page: ' + e.page + '\\n' + e.message\n })\n .join('\\n')}`\n )\n }\n\n const time = process.hrtime(startTime)\n return {\n duration: time[0] + time[1] / 1e9,\n buildTraceContext: undefined,\n shutdownPromise,\n }\n}\n\nlet shutdownPromise: Promise<void> | undefined\nexport async function workerMain(workerData: {\n buildContext: typeof NextBuildContext\n}): Promise<Awaited<ReturnType<typeof turbopackBuild>>> {\n // setup new build context from the serialized data passed from the parent\n Object.assign(NextBuildContext, workerData.buildContext)\n\n /// load the config because it's not serializable\n NextBuildContext.config = await loadConfig(\n PHASE_PRODUCTION_BUILD,\n NextBuildContext.dir!\n )\n\n // Matches handling in build/index.ts\n // https://github.com/vercel/next.js/blob/84f347fc86f4efc4ec9f13615c215e4b9fb6f8f0/packages/next/src/build/index.ts#L815-L818\n // Ensures the `config.distDir` option is matched.\n if (hasCustomExportOutput(NextBuildContext.config)) {\n NextBuildContext.config.distDir = '.next'\n }\n\n // Clone the telemetry for worker\n const telemetry = new Telemetry({\n distDir: NextBuildContext.config.distDir,\n })\n setGlobal('telemetry', telemetry)\n\n const result = await turbopackBuild()\n shutdownPromise = result.shutdownPromise\n return result\n}\n\nexport async function waitForShutdown(): Promise<void> {\n if (shutdownPromise) {\n await shutdownPromise\n }\n}\n"],"names":["turbopackBuild","waitForShutdown","workerMain","IS_TURBOPACK_BUILD","process","env","TURBOPACK","TURBOPACK_BUILD","config","Error","validateTurboNextConfig","dir","NextBuildContext","isDev","distDir","buildId","encryptionKey","previewProps","hasRewrites","rewrites","appDirOnly","startTime","hrtime","bindings","loadBindings","experimental","useWasmBinary","dev","supportedBrowsers","persistentCaching","isPersistentCachingEnabled","project","turbo","createProject","projectPath","rootPath","root","outputFileTracingRoot","nextConfig","jsConfig","getTurbopackJsConfig","watch","enable","defineEnv","createDefineEnv","isTurbopack","clientRouterFilters","fetchCacheKeyPrefix","middlewareMatchers","undefined","browserslistQuery","join","memoryLimit","dependencyTracking","fs","mkdir","path","recursive","writeFile","JSON","stringify","type","entrypointsSubscription","entrypointsSubscribe","currentEntrypoints","global","app","document","error","middleware","instrumentation","Map","page","currentEntryIssues","manifestLoader","TurbopackManifestLoader","entrypointsResult","next","done","return","catch","entrypoints","value","topLevelErrors","issue","issues","push","message","formatIssue","length","map","e","handleEntrypoints","productionRewrites","logErrors","progress","createProgress","size","promises","INITIAL_CONCURRENCY","CONCURRENCY","sema","Sema","remainingRampup","enqueue","fn","acquire","release","run","route","handleRouteType","handlePagesErrorRoute","Promise","all","writeManifests","devRewrites","errors","warnings","entryIssues","values","severity","isRelevantWarning","shutdownPromise","shutdown","Log","warn","time","duration","buildTraceContext","workerData","Object","assign","buildContext","loadConfig","PHASE_PRODUCTION_BUILD","hasCustomExportOutput","telemetry","Telemetry","setGlobal","result"],"mappings":";;;;;;;;;;;;;;;;IA8BsBA,cAAc;eAAdA;;IAqTAC,eAAe;eAAfA;;IA9BAC,UAAU;eAAVA;;;6DArTL;kCACuB;uBAOjC;8BAC0B;qBACa;2BACzB;mCAKd;gCAEiC;0BACT;6DACV;oBACU;2BACQ;+DAChB;wBACe;yBACZ;uBACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE1B,MAAMC,qBAAqBC,QAAQC,GAAG,CAACC,SAAS,IAAIF,QAAQC,GAAG,CAACE,eAAe;AAExE,eAAeP;QAyBgBQ,sBAa9BA,4BAAAA,uBA2BWA;IA5DjB,IAAI,CAACL,oBAAoB;QACvB,MAAM,qBAAqD,CAArD,IAAIM,MAAM,6CAAV,qBAAA;mBAAA;wBAAA;0BAAA;QAAoD;IAC5D;IAEA,MAAMC,IAAAA,yCAAuB,E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,EAAE2G,OAAO3B,MAAM,CAAC,UAAU,EAAE2B,OACtD1B,GAAG,CAAC,CAACC;YACJ,OAAO,WAAWA,EAAEnB,IAAI,GAAG,OAAOmB,EAAEJ,OAAO;QAC7C,GACCpC,IAAI,CAAC,OAAO,GALX,qBAAA;mBAAA;wBAAA;0BAAA;QAMN;IACF;IAEA,MAAM2E,OAAO1H,QAAQkB,MAAM,CAACD;IAC5B,OAAO;QACL0G,UAAUD,IAAI,CAAC,EAAE,GAAGA,IAAI,CAAC,EAAE,GAAG;QAC9BE,mBAAmB/E;QACnByE;IACF;AACF;AAEA,IAAIA;AACG,eAAexH,WAAW+H,UAEhC;IACC,0EAA0E;IAC1EC,OAAOC,MAAM,CAACvH,8BAAgB,EAAEqH,WAAWG,YAAY;IAEvD,iDAAiD;IACjDxH,8BAAgB,CAACJ,MAAM,GAAG,MAAM6H,IAAAA,eAAU,EACxCC,iCAAsB,EACtB1H,8BAAgB,CAACD,GAAG;IAGtB,qCAAqC;IACrC,6HAA6H;IAC7H,kDAAkD;IAClD,IAAI4H,IAAAA,6BAAqB,EAAC3H,8BAAgB,CAACJ,MAAM,GAAG;QAClDI,8BAAgB,CAACJ,MAAM,CAACM,OAAO,GAAG;IACpC;IAEA,iCAAiC;IACjC,MAAM0H,YAAY,IAAIC,kBAAS,CAAC;QAC9B3H,SAASF,8BAAgB,CAACJ,MAAM,CAACM,OAAO;IAC1C;IACA4H,IAAAA,gBAAS,EAAC,aAAaF;IAEvB,MAAMG,SAAS,MAAM3I;IACrB0H,kBAAkBiB,OAAOjB,eAAe;IACxC,OAAOiB;AACT;AAEO,eAAe1I;IACpB,IAAIyH,iBAAiB;QACnB,MAAMA;IACR;AACF"}
1
+ {"version":3,"sources":["../../../src/build/turbopack-build/impl.ts"],"sourcesContent":["import path from 'path'\nimport { validateTurboNextConfig } from '../../lib/turbopack-warning'\nimport {\n formatIssue,\n getTurbopackJsConfig,\n isPersistentCachingEnabled,\n isRelevantWarning,\n type EntryIssuesMap,\n} from '../../shared/lib/turbopack/utils'\nimport { NextBuildContext } from '../build-context'\nimport { createDefineEnv, loadBindings } from '../swc'\nimport { Sema } from 'next/dist/compiled/async-sema'\nimport {\n handleEntrypoints,\n handlePagesErrorRoute,\n handleRouteType,\n} from '../handle-entrypoints'\nimport type { Entrypoints } from '../swc/types'\nimport { TurbopackManifestLoader } from '../../shared/lib/turbopack/manifest-loader'\nimport { createProgress } from '../progress'\nimport * as Log from '../output/log'\nimport { promises as fs } from 'fs'\nimport { PHASE_PRODUCTION_BUILD } from '../../shared/lib/constants'\nimport loadConfig from '../../server/config'\nimport { hasCustomExportOutput } from '../../export/utils'\nimport { Telemetry } from '../../telemetry/storage'\nimport { setGlobal } from '../../trace'\n\nconst IS_TURBOPACK_BUILD = process.env.TURBOPACK && process.env.TURBOPACK_BUILD\n\nexport async function turbopackBuild(): Promise<{\n duration: number\n buildTraceContext: undefined\n shutdownPromise: Promise<void>\n}> {\n if (!IS_TURBOPACK_BUILD) {\n throw new Error(\"next build doesn't support turbopack yet\")\n }\n\n await validateTurboNextConfig({\n dir: NextBuildContext.dir!,\n isDev: false,\n })\n\n const config = NextBuildContext.config!\n const dir = NextBuildContext.dir!\n const distDir = NextBuildContext.distDir!\n const buildId = NextBuildContext.buildId!\n const encryptionKey = NextBuildContext.encryptionKey!\n const previewProps = NextBuildContext.previewProps!\n const hasRewrites = NextBuildContext.hasRewrites!\n const rewrites = NextBuildContext.rewrites!\n const appDirOnly = NextBuildContext.appDirOnly!\n const noMangling = NextBuildContext.noMangling!\n\n const startTime = process.hrtime()\n const bindings = await loadBindings(config?.experimental?.useWasmBinary)\n const dev = false\n\n // const supportedBrowsers = await getSupportedBrowsers(dir, dev)\n const supportedBrowsers = [\n 'last 1 Chrome versions, last 1 Firefox versions, last 1 Safari versions, last 1 Edge versions',\n ]\n\n const persistentCaching = isPersistentCachingEnabled(config)\n const project = await bindings.turbo.createProject(\n {\n projectPath: dir,\n rootPath:\n config.experimental?.turbo?.root || config.outputFileTracingRoot || dir,\n distDir,\n nextConfig: config,\n jsConfig: await getTurbopackJsConfig(dir, config),\n watch: {\n enable: false,\n },\n dev,\n env: process.env as Record<string, string>,\n defineEnv: createDefineEnv({\n isTurbopack: true,\n clientRouterFilters: NextBuildContext.clientRouterFilters!,\n config,\n dev,\n distDir,\n fetchCacheKeyPrefix: config.experimental.fetchCacheKeyPrefix,\n hasRewrites,\n // Implemented separately in Turbopack, doesn't have to be passed here.\n middlewareMatchers: undefined,\n }),\n buildId,\n encryptionKey,\n previewProps,\n browserslistQuery: supportedBrowsers.join(', '),\n noMangling,\n },\n {\n persistentCaching,\n memoryLimit: config.experimental.turbo?.memoryLimit,\n dependencyTracking: persistentCaching,\n }\n )\n\n await fs.mkdir(path.join(distDir, 'server'), { recursive: true })\n await fs.mkdir(path.join(distDir, 'static', buildId), {\n recursive: true,\n })\n await fs.writeFile(\n path.join(distDir, 'package.json'),\n JSON.stringify(\n {\n type: 'commonjs',\n },\n null,\n 2\n )\n )\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const entrypointsSubscription = project.entrypointsSubscribe()\n const currentEntrypoints: Entrypoints = {\n global: {\n app: undefined,\n document: undefined,\n error: undefined,\n\n middleware: undefined,\n instrumentation: undefined,\n },\n\n app: new Map(),\n page: new Map(),\n }\n\n const currentEntryIssues: EntryIssuesMap = new Map()\n\n const manifestLoader = new TurbopackManifestLoader({\n buildId,\n distDir,\n encryptionKey,\n })\n\n const entrypointsResult = await entrypointsSubscription.next()\n if (entrypointsResult.done) {\n throw new Error('Turbopack did not return any entrypoints')\n }\n entrypointsSubscription.return?.().catch(() => {})\n\n const entrypoints = entrypointsResult.value\n\n const topLevelErrors: {\n message: string\n }[] = []\n for (const issue of entrypoints.issues) {\n topLevelErrors.push({\n message: formatIssue(issue),\n })\n }\n\n if (topLevelErrors.length > 0) {\n throw new Error(\n `Turbopack build failed with ${\n topLevelErrors.length\n } issues:\\n${topLevelErrors.map((e) => e.message).join('\\n')}`\n )\n }\n\n await handleEntrypoints({\n entrypoints,\n currentEntrypoints,\n currentEntryIssues,\n manifestLoader,\n productionRewrites: rewrites,\n logErrors: false,\n })\n\n const progress = createProgress(\n currentEntrypoints.page.size + currentEntrypoints.app.size + 1,\n 'Building'\n )\n const promises: Promise<any>[] = []\n\n // Concurrency will start at INITIAL_CONCURRENCY and\n // slowly ramp up to CONCURRENCY by increasing the\n // concurrency by 1 every time a task is completed.\n const INITIAL_CONCURRENCY = 5\n const CONCURRENCY = 10\n\n const sema = new Sema(INITIAL_CONCURRENCY)\n let remainingRampup = CONCURRENCY - INITIAL_CONCURRENCY\n const enqueue = (fn: () => Promise<void>) => {\n promises.push(\n (async () => {\n await sema.acquire()\n try {\n await fn()\n } finally {\n sema.release()\n if (remainingRampup > 0) {\n remainingRampup--\n sema.release()\n }\n progress.run()\n }\n })()\n )\n }\n\n if (!appDirOnly) {\n for (const [page, route] of currentEntrypoints.page) {\n enqueue(() =>\n handleRouteType({\n page,\n route,\n currentEntryIssues,\n entrypoints: currentEntrypoints,\n manifestLoader,\n productionRewrites: rewrites,\n logErrors: false,\n })\n )\n }\n }\n\n for (const [page, route] of currentEntrypoints.app) {\n enqueue(() =>\n handleRouteType({\n page,\n route,\n currentEntryIssues,\n entrypoints: currentEntrypoints,\n manifestLoader,\n productionRewrites: rewrites,\n logErrors: false,\n })\n )\n }\n\n enqueue(() =>\n handlePagesErrorRoute({\n currentEntryIssues,\n entrypoints: currentEntrypoints,\n manifestLoader,\n productionRewrites: rewrites,\n logErrors: false,\n })\n )\n await Promise.all(promises)\n\n await manifestLoader.writeManifests({\n devRewrites: undefined,\n productionRewrites: rewrites,\n entrypoints: currentEntrypoints,\n })\n\n const errors: {\n page: string\n message: string\n }[] = []\n const warnings: {\n page: string\n message: string\n }[] = []\n for (const [page, entryIssues] of currentEntryIssues) {\n for (const issue of entryIssues.values()) {\n if (issue.severity !== 'warning') {\n errors.push({\n page,\n message: formatIssue(issue),\n })\n } else {\n if (isRelevantWarning(issue)) {\n warnings.push({\n page,\n message: formatIssue(issue),\n })\n }\n }\n }\n }\n\n const shutdownPromise = project.shutdown()\n\n if (warnings.length > 0) {\n Log.warn(\n `Turbopack build collected ${warnings.length} warnings:\\n${warnings\n .map((e) => {\n return 'Page: ' + e.page + '\\n' + e.message\n })\n .join('\\n')}`\n )\n }\n\n if (errors.length > 0) {\n throw new Error(\n `Turbopack build failed with ${errors.length} errors:\\n${errors\n .map((e) => {\n return 'Page: ' + e.page + '\\n' + e.message\n })\n .join('\\n')}`\n )\n }\n\n const time = process.hrtime(startTime)\n return {\n duration: time[0] + time[1] / 1e9,\n buildTraceContext: undefined,\n shutdownPromise,\n }\n}\n\nlet shutdownPromise: Promise<void> | undefined\nexport async function workerMain(workerData: {\n buildContext: typeof NextBuildContext\n}): Promise<Awaited<ReturnType<typeof turbopackBuild>>> {\n // setup new build context from the serialized data passed from the parent\n Object.assign(NextBuildContext, workerData.buildContext)\n\n /// load the config because it's not serializable\n NextBuildContext.config = await loadConfig(\n PHASE_PRODUCTION_BUILD,\n NextBuildContext.dir!\n )\n\n // Matches handling in build/index.ts\n // https://github.com/vercel/next.js/blob/84f347fc86f4efc4ec9f13615c215e4b9fb6f8f0/packages/next/src/build/index.ts#L815-L818\n // Ensures the `config.distDir` option is matched.\n if (hasCustomExportOutput(NextBuildContext.config)) {\n NextBuildContext.config.distDir = '.next'\n }\n\n // Clone the telemetry for worker\n const telemetry = new Telemetry({\n distDir: NextBuildContext.config.distDir,\n })\n setGlobal('telemetry', telemetry)\n\n const result = await turbopackBuild()\n shutdownPromise = result.shutdownPromise\n return result\n}\n\nexport async function waitForShutdown(): Promise<void> {\n if (shutdownPromise) {\n await shutdownPromise\n }\n}\n"],"names":["turbopackBuild","waitForShutdown","workerMain","IS_TURBOPACK_BUILD","process","env","TURBOPACK","TURBOPACK_BUILD","config","Error","validateTurboNextConfig","dir","NextBuildContext","isDev","distDir","buildId","encryptionKey","previewProps","hasRewrites","rewrites","appDirOnly","noMangling","startTime","hrtime","bindings","loadBindings","experimental","useWasmBinary","dev","supportedBrowsers","persistentCaching","isPersistentCachingEnabled","project","turbo","createProject","projectPath","rootPath","root","outputFileTracingRoot","nextConfig","jsConfig","getTurbopackJsConfig","watch","enable","defineEnv","createDefineEnv","isTurbopack","clientRouterFilters","fetchCacheKeyPrefix","middlewareMatchers","undefined","browserslistQuery","join","memoryLimit","dependencyTracking","fs","mkdir","path","recursive","writeFile","JSON","stringify","type","entrypointsSubscription","entrypointsSubscribe","currentEntrypoints","global","app","document","error","middleware","instrumentation","Map","page","currentEntryIssues","manifestLoader","TurbopackManifestLoader","entrypointsResult","next","done","return","catch","entrypoints","value","topLevelErrors","issue","issues","push","message","formatIssue","length","map","e","handleEntrypoints","productionRewrites","logErrors","progress","createProgress","size","promises","INITIAL_CONCURRENCY","CONCURRENCY","sema","Sema","remainingRampup","enqueue","fn","acquire","release","run","route","handleRouteType","handlePagesErrorRoute","Promise","all","writeManifests","devRewrites","errors","warnings","entryIssues","values","severity","isRelevantWarning","shutdownPromise","shutdown","Log","warn","time","duration","buildTraceContext","workerData","Object","assign","buildContext","loadConfig","PHASE_PRODUCTION_BUILD","hasCustomExportOutput","telemetry","Telemetry","setGlobal","result"],"mappings":";;;;;;;;;;;;;;;;IA8BsBA,cAAc;eAAdA;;IAuTAC,eAAe;eAAfA;;IA9BAC,UAAU;eAAVA;;;6DAvTL;kCACuB;uBAOjC;8BAC0B;qBACa;2BACzB;mCAKd;gCAEiC;0BACT;6DACV;oBACU;2BACQ;+DAChB;wBACe;yBACZ;uBACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE1B,MAAMC,qBAAqBC,QAAQC,GAAG,CAACC,SAAS,IAAIF,QAAQC,GAAG,CAACE,eAAe;AAExE,eAAeP;QA0BgBQ,sBAa9BA,4BAAAA,uBA4BWA;IA9DjB,IAAI,CAACL,oBAAoB;QACvB,MAAM,qBAAqD,CAArD,IAAIM,MAAM,6CAAV,qBAAA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, sources } from 'next/dist/compiled/webpack/webpack';
2
2
  type CssMinimizerPluginOptions = {
3
3
  postcssOptions: {
4
4
  map: false | {
@@ -12,7 +12,7 @@ export declare class CssMinimizerPlugin {
12
12
  __next_css_remove: boolean;
13
13
  private options;
14
14
  constructor(options: CssMinimizerPluginOptions);
15
- optimizeAsset(file: string, asset: any): Promise<import("webpack-sources1").RawSource | import("webpack-sources1").SourceMapSource>;
15
+ optimizeAsset(file: string, asset: any): Promise<sources.RawSource | sources.SourceMapSource>;
16
16
  apply(compiler: webpack.Compiler): void;
17
17
  }
18
18
  export {};
@@ -1,4 +1,12 @@
1
+ import { sources, type CacheFacade, type Compilation } from 'next/dist/compiled/webpack/webpack';
1
2
  export declare class MinifyPlugin {
2
- optimize(compiler: any, compilation: any, assets: any, cache: any, { SourceMapSource, RawSource }: any): Promise<void>;
3
+ private options;
4
+ constructor(options: {
5
+ noMangling?: boolean;
6
+ });
7
+ optimize(compiler: any, compilation: Compilation, assets: any, cache: CacheFacade, { SourceMapSource, RawSource, }: {
8
+ SourceMapSource: typeof sources.SourceMapSource;
9
+ RawSource: typeof sources.RawSource;
10
+ }): Promise<void>;
3
11
  apply(compiler: any): void;
4
12
  }