next 15.4.2-canary.22 → 15.4.2-canary.23

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.
Files changed (59) 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 +0 -33
  4. package/dist/build/swc/index.js +1 -11
  5. package/dist/build/swc/index.js.map +1 -1
  6. package/dist/build/swc/types.d.ts +1 -7
  7. package/dist/build/webpack-config.js +2 -2
  8. package/dist/client/app-bootstrap.js +1 -1
  9. package/dist/client/index.js +1 -1
  10. package/dist/compiled/@vercel/og/emoji/index.d.ts +15 -0
  11. package/dist/compiled/@vercel/og/figma/index.d.ts +7 -0
  12. package/dist/compiled/@vercel/og/index.edge.d.ts +5 -9
  13. package/dist/compiled/@vercel/og/index.edge.js +2587 -3024
  14. package/dist/compiled/@vercel/og/index.node.d.ts +7 -10
  15. package/dist/compiled/@vercel/og/index.node.js +2585 -3022
  16. package/dist/compiled/@vercel/og/language/index.d.ts +28 -0
  17. package/dist/compiled/@vercel/og/og.d.ts +1 -0
  18. package/dist/compiled/@vercel/og/package.json +1 -1
  19. package/dist/compiled/@vercel/og/satori/index.d.ts +4 -1
  20. package/dist/compiled/@vercel/og/types.d.ts +118 -0
  21. package/dist/compiled/@vercel/og/yoga.wasm +0 -0
  22. package/dist/esm/build/index.js +2 -2
  23. package/dist/esm/build/swc/generated-native.d.ts +0 -33
  24. package/dist/esm/build/swc/index.js +1 -11
  25. package/dist/esm/build/swc/index.js.map +1 -1
  26. package/dist/esm/build/swc/types.js.map +1 -1
  27. package/dist/esm/build/webpack-config.js +2 -2
  28. package/dist/esm/client/app-bootstrap.js +1 -1
  29. package/dist/esm/client/index.js +1 -1
  30. package/dist/esm/server/dev/hot-reloader-turbopack.js +1 -1
  31. package/dist/esm/server/dev/hot-reloader-webpack.js +1 -1
  32. package/dist/esm/server/lib/app-info-log.js +1 -1
  33. package/dist/esm/server/lib/router-utils/setup-dev-bundler.js +3 -84
  34. package/dist/esm/server/lib/router-utils/setup-dev-bundler.js.map +1 -1
  35. package/dist/esm/server/lib/start-server.js +1 -1
  36. package/dist/esm/shared/lib/canary-only.js +1 -1
  37. package/dist/esm/shared/lib/turbopack/utils.js +28 -32
  38. package/dist/esm/shared/lib/turbopack/utils.js.map +1 -1
  39. package/dist/server/dev/hot-reloader-turbopack.js +1 -1
  40. package/dist/server/dev/hot-reloader-webpack.js +1 -1
  41. package/dist/server/lib/app-info-log.js +1 -1
  42. package/dist/server/lib/router-utils/setup-dev-bundler.js +3 -84
  43. package/dist/server/lib/router-utils/setup-dev-bundler.js.map +1 -1
  44. package/dist/server/lib/start-server.js +1 -1
  45. package/dist/shared/lib/canary-only.js +1 -1
  46. package/dist/shared/lib/turbopack/utils.d.ts +1 -2
  47. package/dist/shared/lib/turbopack/utils.js +28 -36
  48. package/dist/shared/lib/turbopack/utils.js.map +1 -1
  49. package/dist/telemetry/anonymous-meta.js +1 -1
  50. package/dist/telemetry/events/session-stopped.js +2 -2
  51. package/dist/telemetry/events/version.js +2 -2
  52. package/package.json +15 -20
  53. package/server.d.ts +1 -1
  54. package/dist/compiled/@vercel/og/types-d38469ff.d.ts +0 -74
  55. package/dist/esm/server/lib/router-utils/mcp.js +0 -471
  56. package/dist/esm/server/lib/router-utils/mcp.js.map +0 -1
  57. package/dist/server/lib/router-utils/mcp.d.ts +0 -4
  58. package/dist/server/lib/router-utils/mcp.js +0 -534
  59. package/dist/server/lib/router-utils/mcp.js.map +0 -1
@@ -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 TurbopackLoaderItem,\n TurbopackRuleConfigItem,\n TurbopackRuleConfigItemOptions,\n TurbopackRuleConfigItemOrShortcut,\n} from '../../server/config-shared'\nimport { isDeepStrictEqual } from 'util'\nimport { type DefineEnvOptions, getDefineEnv } from '../define-env'\nimport { getReactCompilerLoader } from '../get-babel-loader-config'\nimport type {\n NapiModuleGraphSnapshot,\n NapiModuleGraphSnapshots,\n NapiPartialProjectOptions,\n NapiProjectOptions,\n NapiSourceDiagnostic,\n} from './generated-native'\nimport type {\n Binding,\n CompilationEvent,\n DefineEnv,\n Endpoint,\n HmrIdentifiers,\n Project,\n ProjectOptions,\n RawEntrypoints,\n Route,\n TurboEngineOptions,\n TurbopackResult,\n TurbopackStackFrame,\n Update,\n UpdateMessage,\n WrittenEndpoint,\n} from './types'\nimport { throwTurbopackInternalError } from '../../shared/lib/turbopack/internal-error'\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\n// Used to cache calls to `loadBindings`\nlet pendingBindings: Promise<Binding>\n// some things call `loadNative` directly instead of `loadBindings`... Cache calls to that\n// separately.\nlet nativeBindings: Binding\n// can allow hacky sync access to bindings for loadBindingsSync\nlet wasmBindings: Binding\nlet downloadWasmPromise: any\nlet swcTraceFlushGuard: any\nlet downloadNativeBindingsPromise: Promise<void> | undefined = undefined\n\nexport const lockfilePatchPromise: { cur?: Promise<void> } = {}\n\n/**\n * Attempts to load a native or wasm binding.\n *\n * By default, this first tries to use a native binding, falling back to a wasm binding if that\n * fails.\n *\n * This function is `async` as wasm requires an asynchronous import in browsers.\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 if (process.env.NEXT_TEST_WASM) {\n useWasmBinary = true\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\n// helper for loadBindings\nasync function tryLoadWasmWithFallback(\n attempts: any[]\n): Promise<Binding | undefined> {\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 // HACK: we can leverage the wasm bindings if they are already loaded\n // this may introduce race conditions\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 }[]\ntype RustifiedOptionEnv = { name: string; value: string | undefined }[]\n\nexport function createDefineEnv({\n isTurbopack,\n clientRouterFilters,\n config,\n dev,\n distDir,\n projectPath,\n fetchCacheKeyPrefix,\n hasRewrites,\n middlewareMatchers,\n rewrites,\n}: Omit<\n DefineEnvOptions,\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] = rustifyOptionEnv(\n getDefineEnv({\n isTurbopack,\n clientRouterFilters,\n config,\n dev,\n distDir,\n projectPath,\n fetchCacheKeyPrefix,\n hasRewrites,\n isClient: variant === 'client',\n isEdgeServer: variant === 'edge',\n isNodeServer: variant === 'nodejs',\n middlewareMatchers,\n rewrites,\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\nfunction rustifyOptionEnv(\n env: Record<string, string | undefined>\n): RustifiedOptionEnv {\n return Object.entries(env).map(([name, value]) => ({\n name,\n value,\n }))\n}\n\n// TODO(sokra) Support wasm option.\nfunction bindingToApi(\n binding: RawBindings,\n _wasm: boolean\n): Binding['turbo']['createProject'] {\n type NativeFunction<T> = (\n callback: (err: Error, value: T) => void\n ) => Promise<{ __napiType: 'RootTask' }>\n\n type NapiEndpoint = { __napiType: 'Endpoint' }\n\n type NapiEntrypoints = {\n routes: NapiRoute[]\n middleware?: NapiMiddleware\n instrumentation?: NapiInstrumentation\n pagesDocumentEndpoint: NapiEndpoint\n pagesAppEndpoint: NapiEndpoint\n pagesErrorEndpoint: NapiEndpoint\n }\n\n type NapiMiddleware = {\n endpoint: NapiEndpoint\n runtime: 'nodejs' | 'edge'\n matcher?: string[]\n }\n\n type NapiInstrumentation = {\n nodeJs: NapiEndpoint\n edge: NapiEndpoint\n }\n\n type NapiRoute = {\n pathname: string\n } & (\n | {\n type: 'page'\n htmlEndpoint: NapiEndpoint\n dataEndpoint: NapiEndpoint\n }\n | {\n type: 'page-api'\n endpoint: NapiEndpoint\n }\n | {\n type: 'app-page'\n pages: {\n originalName: string\n htmlEndpoint: NapiEndpoint\n rscEndpoint: NapiEndpoint\n }[]\n }\n | {\n type: 'app-route'\n originalName: string\n endpoint: NapiEndpoint\n }\n | {\n type: 'conflict'\n }\n )\n\n const cancel = new (class Cancel extends Error {})()\n\n /**\n * Utility function to ensure all variants of an enum are handled.\n */\n function invariant(\n never: never,\n computeMessage: (arg: any) => string\n ): never {\n throw new Error(`Invariant: ${computeMessage(never)}`)\n }\n\n /**\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 nativeFunction(emitResult)\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 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 path.join(options.rootPath, 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(\n options.nextConfig,\n path.join(options.rootPath!, options.projectPath!)\n )),\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 binding.projectUpdate(\n this._nativeProject,\n await rustifyPartialProjectOptions(options)\n )\n }\n\n async writeAllEntrypointsToDisk(\n appDirOnly: boolean\n ): Promise<TurbopackResult<RawEntrypoints>> {\n const napiEndpoints = (await binding.projectWriteAllEntrypointsToDisk(\n this._nativeProject,\n appDirOnly\n )) as TurbopackResult<NapiEntrypoints>\n\n return napiEntrypointsToRawEntrypoints(napiEndpoints)\n }\n\n async getEntrypoints() {\n const napiEndpoints = (await binding.projectEntrypoints(\n this._nativeProject\n )) as TurbopackResult<NapiEntrypoints>\n\n return napiEntrypointsToRawEntrypoints(napiEndpoints)\n }\n\n entrypointsSubscribe() {\n const subscription = subscribe<TurbopackResult<NapiEntrypoints>>(\n false,\n async (callback) =>\n binding.projectEntrypointsSubscribe(this._nativeProject, callback)\n )\n return (async function* () {\n for await (const entrypoints of subscription) {\n yield napiEntrypointsToRawEntrypoints(entrypoints)\n }\n })()\n }\n\n hmrEvents(identifier: string) {\n return subscribe<TurbopackResult<Update>>(true, async (callback) =>\n binding.projectHmrEvents(this._nativeProject, identifier, callback)\n )\n }\n\n hmrIdentifiersSubscribe() {\n return subscribe<TurbopackResult<HmrIdentifiers>>(\n false,\n async (callback) =>\n binding.projectHmrIdentifiersSubscribe(this._nativeProject, callback)\n )\n }\n\n traceSource(\n stackFrame: TurbopackStackFrame,\n currentDirectoryFileUrl: string\n ): Promise<TurbopackStackFrame | null> {\n return binding.projectTraceSource(\n this._nativeProject,\n stackFrame,\n currentDirectoryFileUrl\n )\n }\n\n getSourceForAsset(filePath: string): Promise<string | null> {\n return binding.projectGetSourceForAsset(this._nativeProject, filePath)\n }\n\n getSourceMap(filePath: string): Promise<string | null> {\n return binding.projectGetSourceMap(this._nativeProject, filePath)\n }\n\n getSourceMapSync(filePath: string): string | null {\n return binding.projectGetSourceMapSync(this._nativeProject, filePath)\n }\n\n updateInfoSubscribe(aggregationMs: number) {\n return subscribe<TurbopackResult<UpdateMessage>>(true, async (callback) =>\n binding.projectUpdateInfoSubscribe(\n this._nativeProject,\n aggregationMs,\n callback\n )\n )\n }\n\n compilationEventsSubscribe(eventTypes?: string[]) {\n return subscribe<TurbopackResult<CompilationEvent>>(\n true,\n async (callback) => {\n binding.projectCompilationEventsSubscribe(\n this._nativeProject,\n callback,\n eventTypes\n )\n }\n )\n }\n\n moduleGraph(): Promise<TurbopackResult<NapiModuleGraphSnapshot>> {\n return binding.projectModuleGraph(this._nativeProject) as Promise<\n TurbopackResult<NapiModuleGraphSnapshot>\n >\n }\n\n invalidatePersistentCache(): Promise<void> {\n return binding.projectInvalidatePersistentCache(this._nativeProject)\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 binding.endpointWriteToDisk(\n this._nativeEndpoint\n )) as TurbopackResult<WrittenEndpoint>\n }\n\n async clientChanged(): Promise<AsyncIterableIterator<TurbopackResult<{}>>> {\n const clientSubscription = subscribe<TurbopackResult>(\n false,\n async (callback) =>\n binding.endpointClientChangedSubscribe(this._nativeEndpoint, callback)\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 this._nativeEndpoint,\n includeIssues,\n callback\n )\n )\n await serverSubscription.next()\n return serverSubscription\n }\n\n async moduleGraphs(): Promise<TurbopackResult<NapiModuleGraphSnapshots>> {\n return binding.endpointModuleGraphs(this._nativeEndpoint) as Promise<\n TurbopackResult<NapiModuleGraphSnapshots>\n >\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?.turbopack?.rules ?? []).some((key) =>\n ruleKeys.includes(key)\n )\n ) {\n Log.warn(\n `The React Compiler cannot be enabled automatically because 'turbopack.rules' 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.turbopack) {\n nextConfig.turbopack = {}\n }\n\n if (!nextConfig.turbopack.rules) {\n nextConfig.turbopack.rules = {}\n }\n\n for (const key of ['*.ts', '*.js', '*.jsx', '*.tsx']) {\n nextConfig.turbopack.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.turbopack?.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 const conditions: (typeof nextConfig)['turbopack']['conditions'] =\n nextConfigSerializable.turbopack?.conditions\n if (conditions) {\n type SerializedConditions = {\n [key: string]: {\n path:\n | { type: 'regex'; value: { source: string; flags: string } }\n | { type: 'glob'; value: string }\n }\n }\n\n const serializedConditions: SerializedConditions = {}\n for (const [key, value] of Object.entries(conditions)) {\n serializedConditions[key] = {\n ...value,\n path:\n value.path instanceof RegExp\n ? {\n type: 'regex',\n value: { source: value.path.source, flags: value.path.flags },\n }\n : { type: 'glob', value: value.path },\n }\n }\n nextConfigSerializable.turbopack.conditions = serializedConditions\n }\n\n return JSON.stringify(nextConfigSerializable, null, 2)\n }\n\n function ensureLoadersHaveSerializableOptions(\n turbopackRules: Record<string, TurbopackRuleConfigItemOrShortcut>\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: TurbopackRuleConfigItem, glob: string) {\n if (!rule) return\n if ('loaders' in rule) {\n checkLoaderItems((rule as TurbopackRuleConfigItemOptions).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(\n loaderItems: TurbopackLoaderItem[],\n glob: string\n ) {\n for (const loaderItem of loaderItems) {\n if (\n typeof loaderItem !== 'string' &&\n !isDeepStrictEqual(loaderItem, JSON.parse(JSON.stringify(loaderItem)))\n ) {\n throw new Error(\n `loader ${loaderItem.loader} for match \"${glob}\" does not have serializable options. Ensure that options passed are plain JavaScript objects and values.`\n )\n }\n }\n }\n }\n\n function napiEntrypointsToRawEntrypoints(\n entrypoints: TurbopackResult<NapiEntrypoints>\n ): TurbopackResult<RawEntrypoints> {\n const routes = new Map()\n for (const { pathname, ...nativeRoute } of entrypoints.routes) {\n let route: Route\n const routeType = nativeRoute.type\n switch (routeType) {\n case 'page':\n route = {\n type: 'page',\n htmlEndpoint: new EndpointImpl(nativeRoute.htmlEndpoint),\n dataEndpoint: new EndpointImpl(nativeRoute.dataEndpoint),\n }\n break\n case 'page-api':\n route = {\n type: 'page-api',\n endpoint: new EndpointImpl(nativeRoute.endpoint),\n }\n break\n case 'app-page':\n route = {\n type: 'app-page',\n pages: nativeRoute.pages.map((page) => ({\n originalName: page.originalName,\n htmlEndpoint: new EndpointImpl(page.htmlEndpoint),\n rscEndpoint: new EndpointImpl(page.rscEndpoint),\n })),\n }\n break\n case 'app-route':\n route = {\n type: 'app-route',\n originalName: nativeRoute.originalName,\n endpoint: new EndpointImpl(nativeRoute.endpoint),\n }\n break\n case 'conflict':\n route = {\n type: 'conflict',\n }\n break\n default:\n const _exhaustiveCheck: never = routeType\n invariant(\n nativeRoute,\n () => `Unknown route type: ${_exhaustiveCheck}`\n )\n }\n routes.set(pathname, route)\n }\n const napiMiddlewareToMiddleware = (middleware: NapiMiddleware) => ({\n endpoint: new EndpointImpl(middleware.endpoint),\n runtime: middleware.runtime,\n matcher: middleware.matcher,\n })\n const middleware = entrypoints.middleware\n ? napiMiddlewareToMiddleware(entrypoints.middleware)\n : undefined\n const napiInstrumentationToInstrumentation = (\n instrumentation: NapiInstrumentation\n ) => ({\n nodeJs: new EndpointImpl(instrumentation.nodeJs),\n edge: new EndpointImpl(instrumentation.edge),\n })\n const instrumentation = entrypoints.instrumentation\n ? napiInstrumentationToInstrumentation(entrypoints.instrumentation)\n : undefined\n\n return {\n routes,\n middleware,\n instrumentation,\n pagesDocumentEndpoint: new EndpointImpl(\n entrypoints.pagesDocumentEndpoint\n ),\n pagesAppEndpoint: new EndpointImpl(entrypoints.pagesAppEndpoint),\n pagesErrorEndpoint: new EndpointImpl(entrypoints.pagesErrorEndpoint),\n issues: entrypoints.issues,\n diagnostics: entrypoints.diagnostics,\n }\n }\n\n return async function createProject(\n options: ProjectOptions,\n turboEngineOptions\n ) {\n return new ProjectImpl(\n await binding.projectNew(\n await rustifyProjectOptions(options),\n turboEngineOptions || {},\n {\n throwTurbopackInternalError,\n }\n )\n )\n }\n}\n\n// helper for loadWasm\nasync function loadWasmRawBindings(importPath = ''): Promise<RawWasmBindings> {\n let attempts = []\n\n // Used by `run-tests` to force use of a locally-built wasm binary. This environment variable is\n // unstable and subject to change.\n const testWasmDir = process.env.NEXT_TEST_WASM_DIR\n\n if (testWasmDir) {\n // assume these are node.js bindings and don't need a call to `.default()`\n const rawBindings = await import(\n pathToFileURL(path.join(testWasmDir, 'wasm.js')).toString()\n )\n infoLog(`next-swc build: wasm build ${testWasmDir}`)\n return rawBindings\n } else {\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 const importedRawBindings = await import(\n pathToFileURL(pkgPath).toString()\n )\n let rawBindings\n if (pkg === '@next/swc-wasm-web') {\n // https://rustwasm.github.io/docs/wasm-bindgen/examples/without-a-bundler.html\n // `default` must be called to initialize the module\n rawBindings = await importedRawBindings.default!()\n } else {\n rawBindings = importedRawBindings\n }\n infoLog(`next-swc build: wasm build ${pkg}`)\n return rawBindings\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\n throw attempts\n}\n\n// helper for tryLoadWasmWithFallback / loadBindings.\nasync function loadWasm(importPath = '') {\n const rawBindings = await loadWasmRawBindings(importPath)\n\n function removeUndefined(obj: any): any {\n // serde-wasm-bindgen expect that `undefined` values map to `()` in rust, but we want to treat\n // those fields as non-existent, so remove them before passing them to rust.\n //\n // The native (non-wasm) bindings use `JSON.stringify`, which strips undefined values.\n if (typeof obj !== 'object' || obj === null) {\n return obj\n }\n if (Array.isArray(obj)) {\n return obj.map(removeUndefined)\n }\n const newObj: { [key: string]: any } = {}\n for (const [k, v] of Object.entries(obj)) {\n if (typeof v !== 'undefined') {\n newObj[k] = removeUndefined(v)\n }\n }\n return newObj\n }\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): Promise<any> {\n return rawBindings.transform(src.toString(), removeUndefined(options))\n },\n transformSync(src: string, options: any) {\n return rawBindings.transformSync(src.toString(), removeUndefined(options))\n },\n minify(src: string, options: any): Promise<any> {\n return rawBindings.minify(src.toString(), removeUndefined(options))\n },\n minifySync(src: string, options: any) {\n return rawBindings.minifySync(src.toString(), removeUndefined(options))\n },\n parse(src: string, options: any): Promise<any> {\n return rawBindings.parse(src.toString(), removeUndefined(options))\n },\n getTargetTriple() {\n return undefined\n },\n turbo: {\n createProject(\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(_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 rawBindings.mdxCompile(\n src,\n removeUndefined(getMdxOptions(options))\n )\n },\n compileSync(src: string, options: any) {\n return rawBindings.mdxCompileSync(\n src,\n removeUndefined(getMdxOptions(options))\n )\n },\n },\n reactCompiler: {\n isReactCompilerRequired(_filename: string) {\n return Promise.resolve(true)\n },\n },\n rspack: {\n getModuleNamedExports(_resourcePath: string): Promise<string[]> {\n throw new Error(\n '`rspack.getModuleNamedExports` is not supported by the wasm bindings.'\n )\n },\n warnForEdgeRuntime(\n _source: string,\n _isProduction: boolean\n ): Promise<NapiSourceDiagnostic[]> {\n throw new Error(\n '`rspack.warnForEdgeRuntime` is not supported by the wasm bindings.'\n )\n },\n },\n }\n return wasmBindings\n}\n\n/**\n * Loads the native (non-wasm) bindings. Prefer `loadBindings` over this API, as that includes a\n * wasm fallback.\n */\nfunction loadNative(importPath?: string) {\n if (nativeBindings) {\n return nativeBindings\n }\n\n if (process.env.NEXT_TEST_WASM) {\n throw new Error('cannot run loadNative when `NEXT_TEST_WASM` is set')\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(Buffer.from(src), toBuffer(options ?? {}))\n },\n\n minifySync(src: string, options: any) {\n return bindings.minifySync(Buffer.from(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://trace.nextjs.org'\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 reactCompiler: {\n isReactCompilerRequired: (filename: string) => {\n return bindings.isReactCompilerRequired(filename)\n },\n },\n rspack: {\n getModuleNamedExports: function (\n resourcePath: string\n ): Promise<string[]> {\n return bindings.getModuleNamedExports(resourcePath)\n },\n warnForEdgeRuntime: function (\n source: string,\n isProduction: boolean\n ): Promise<NapiSourceDiagnostic[]> {\n return bindings.warnForEdgeRuntime(source, isProduction)\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 isReactCompilerRequired(\n filename: string\n): Promise<boolean> {\n let bindings = await loadBindings()\n return bindings.reactCompiler.isReactCompilerRequired(filename)\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\nexport async function getModuleNamedExports(\n resourcePath: string\n): Promise<string[]> {\n const bindings = await loadBindings()\n return bindings.rspack.getModuleNamedExports(resourcePath)\n}\n\nexport async function warnForEdgeRuntime(\n source: string,\n isProduction: boolean\n): Promise<NapiSourceDiagnostic[]> {\n const bindings = await loadBindings()\n return bindings.rspack.warnForEdgeRuntime(source, isProduction)\n}\n"],"names":["path","pathToFileURL","arch","platform","platformArchTriples","Log","getParserOptions","eventSwcLoadFailure","patchIncorrectLockfile","downloadNativeNextSwc","downloadWasmSwc","isDeepStrictEqual","getDefineEnv","getReactCompilerLoader","throwTurbopackInternalError","nextVersion","process","env","__NEXT_VERSION","ArchName","PlatformName","infoLog","args","NEXT_PRIVATE_BUILD_WORKER","DEBUG","info","getSupportedArchTriples","darwin","win32","linux","freebsd","android","arm64","ia32","filter","triple","abi","x64","arm","triples","supportedArchTriples","targetTriple","rawTargetTriple","warn","__INTERNAL_CUSTOM_TURBOPACK_BINDINGS","checkVersionMismatch","pkgData","version","knownDefaultWasmFallbackTriples","lastNativeBindingsLoadErrorCode","undefined","pendingBindings","nativeBindings","wasmBindings","downloadWasmPromise","swcTraceFlushGuard","downloadNativeBindingsPromise","lockfilePatchPromise","loadBindings","useWasmBinary","RUST_MIN_STACK","NEXT_TEST_WASM","stdout","_handle","setBlocking","stderr","Promise","resolve","_reject","cur","cwd","catch","console","error","attempts","disableWasmFallback","NEXT_DISABLE_SWC_WASM","unsupportedPlatform","some","raw","includes","isWebContainer","versions","webcontainer","shouldLoadWasmFallbackFirst","fallbackBindings","tryLoadWasmWithFallback","loadNative","a","Array","isArray","every","m","tryLoadNativeWithFallback","concat","logLoadFailure","nativeBindingsDirectory","join","dirname","require","map","platformArchABI","push","bindings","loadWasm","wasm","nativeBindingsErrorCode","wasmDirectory","attempt","loadBindingsSync","Error","cause","loggingLoadFailure","triedWasm","then","finally","exit","createDefineEnv","isTurbopack","clientRouterFilters","config","dev","distDir","projectPath","fetchCacheKeyPrefix","hasRewrites","middlewareMatchers","rewrites","defineEnv","client","edge","nodejs","variant","Object","keys","rustifyOptionEnv","isClient","isEdgeServer","isNodeServer","rustifyEnv","entries","_","value","name","bindingToApi","binding","_wasm","cancel","Cancel","invariant","never","computeMessage","subscribe","useBuffer","nativeFunction","buffer","waiting","canceled","emitResult","err","reject","item","createIterator","task","length","shift","e","rootTaskDispose","iterator","return","done","rustifyProjectOptions","options","nextConfig","serializeNextConfig","rootPath","jsConfig","JSON","stringify","rustifyPartialProjectOptions","ProjectImpl","constructor","nativeProject","_nativeProject","update","projectUpdate","writeAllEntrypointsToDisk","appDirOnly","napiEndpoints","projectWriteAllEntrypointsToDisk","napiEntrypointsToRawEntrypoints","getEntrypoints","projectEntrypoints","entrypointsSubscribe","subscription","callback","projectEntrypointsSubscribe","entrypoints","hmrEvents","identifier","projectHmrEvents","hmrIdentifiersSubscribe","projectHmrIdentifiersSubscribe","traceSource","stackFrame","currentDirectoryFileUrl","projectTraceSource","getSourceForAsset","filePath","projectGetSourceForAsset","getSourceMap","projectGetSourceMap","getSourceMapSync","projectGetSourceMapSync","updateInfoSubscribe","aggregationMs","projectUpdateInfoSubscribe","compilationEventsSubscribe","eventTypes","projectCompilationEventsSubscribe","moduleGraph","projectModuleGraph","invalidatePersistentCache","projectInvalidatePersistentCache","shutdown","projectShutdown","onExit","projectOnExit","EndpointImpl","nativeEndpoint","_nativeEndpoint","writeToDisk","endpointWriteToDisk","clientChanged","clientSubscription","endpointClientChangedSubscribe","next","serverChanged","includeIssues","serverSubscription","endpointServerChangedSubscribe","moduleGraphs","endpointModuleGraphs","augmentNextConfig","originalNextConfig","reactCompilerOptions","experimental","reactCompiler","ruleKeys","turbopack","rules","key","browser","foreign","loaders","nextConfigSerializable","generateBuildId","exportPathMap","webpack","turbo","ensureLoadersHaveSerializableOptions","modularizeImports","fromEntries","mod","transform","images","loaderFile","relative","conditions","serializedConditions","RegExp","type","source","flags","turbopackRules","glob","rule","checkLoaderItems","checkConfigItem","inner","loaderItems","loaderItem","parse","loader","routes","Map","pathname","nativeRoute","route","routeType","htmlEndpoint","dataEndpoint","endpoint","pages","page","originalName","rscEndpoint","_exhaustiveCheck","set","napiMiddlewareToMiddleware","middleware","runtime","matcher","napiInstrumentationToInstrumentation","instrumentation","nodeJs","pagesDocumentEndpoint","pagesAppEndpoint","pagesErrorEndpoint","issues","diagnostics","createProject","turboEngineOptions","projectNew","loadWasmRawBindings","importPath","testWasmDir","NEXT_TEST_WASM_DIR","rawBindings","toString","pkg","pkgPath","importedRawBindings","default","code","message","removeUndefined","obj","newObj","k","v","css","lightning","_options","transformStyleAttr","isWasm","src","transformSync","minify","minifySync","getTargetTriple","_turboEngineOptions","startTurbopackTraceServer","_traceFilePath","mdx","compile","mdxCompile","getMdxOptions","compileSync","mdxCompileSync","isReactCompilerRequired","_filename","rspack","getModuleNamedExports","_resourcePath","warnForEdgeRuntime","_source","_isProduction","customBindings","NEXT_TEST_NATIVE_DIR","isModule","Buffer","isBuffer","jsc","parser","syntax","toBuffer","from","initCustomTraceSubscriber","teardownTraceSubscriber","traceFilePath","transformOptions","lightningCssTransform","transformAttrOptions","lightningCssTransformStyleAttribute","filename","resourcePath","isProduction","development","jsx","mdxType","t","parserOptions","astStr","getBinaryMetadata","target","traceFileName","once","fn","executed"],"mappings":"AAAA,0DAA0D,GAC1D,OAAOA,UAAU,OAAM;AACvB,SAASC,aAAa,QAAQ,MAAK;AACnC,SAASC,IAAI,EAAEC,QAAQ,QAAQ,KAAI;AACnC,SAASC,mBAAmB,QAAQ,sCAAqC;AACzE,YAAYC,SAAS,gBAAe;AACpC,SAASC,gBAAgB,QAAQ,YAAW;AAC5C,SAASC,mBAAmB,QAAQ,0CAAyC;AAC7E,SAASC,sBAAsB,QAAQ,qCAAoC;AAC3E,SAASC,qBAAqB,EAAEC,eAAe,QAAQ,yBAAwB;AAQ/E,SAASC,iBAAiB,QAAQ,OAAM;AACxC,SAAgCC,YAAY,QAAQ,gBAAe;AACnE,SAASC,sBAAsB,QAAQ,6BAA4B;AAyBnE,SAASC,2BAA2B,QAAQ,4CAA2C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2L,sBACpBuB,YAAoB;IAEpB,MAAMjR,WAAW,MAAM7C;IACvB,OAAO6C,SAASyP,MAAM,CAACC,qBAAqB,CAACuB;AAC/C;AAEA,OAAO,eAAerB,mBACpBnF,MAAc,EACdyG,YAAqB;IAErB,MAAMlR,WAAW,MAAM7C;IACvB,OAAO6C,SAASyP,MAAM,CAACG,kBAAkB,CAACnF,QAAQyG;AACpD","ignoreList":[0]}
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 TurbopackLoaderItem,\n TurbopackRuleConfigItem,\n TurbopackRuleConfigItemOptions,\n TurbopackRuleConfigItemOrShortcut,\n} from '../../server/config-shared'\nimport { isDeepStrictEqual } from 'util'\nimport { type DefineEnvOptions, getDefineEnv } from '../define-env'\nimport { getReactCompilerLoader } from '../get-babel-loader-config'\nimport type {\n NapiPartialProjectOptions,\n NapiProjectOptions,\n NapiSourceDiagnostic,\n} from './generated-native'\nimport type {\n Binding,\n CompilationEvent,\n DefineEnv,\n Endpoint,\n HmrIdentifiers,\n Project,\n ProjectOptions,\n RawEntrypoints,\n Route,\n TurboEngineOptions,\n TurbopackResult,\n TurbopackStackFrame,\n Update,\n UpdateMessage,\n WrittenEndpoint,\n} from './types'\nimport { throwTurbopackInternalError } from '../../shared/lib/turbopack/internal-error'\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\n// Used to cache calls to `loadBindings`\nlet pendingBindings: Promise<Binding>\n// some things call `loadNative` directly instead of `loadBindings`... Cache calls to that\n// separately.\nlet nativeBindings: Binding\n// can allow hacky sync access to bindings for loadBindingsSync\nlet wasmBindings: Binding\nlet downloadWasmPromise: any\nlet swcTraceFlushGuard: any\nlet downloadNativeBindingsPromise: Promise<void> | undefined = undefined\n\nexport const lockfilePatchPromise: { cur?: Promise<void> } = {}\n\n/**\n * Attempts to load a native or wasm binding.\n *\n * By default, this first tries to use a native binding, falling back to a wasm binding if that\n * fails.\n *\n * This function is `async` as wasm requires an asynchronous import in browsers.\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 if (process.env.NEXT_TEST_WASM) {\n useWasmBinary = true\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\n// helper for loadBindings\nasync function tryLoadWasmWithFallback(\n attempts: any[]\n): Promise<Binding | undefined> {\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 // HACK: we can leverage the wasm bindings if they are already loaded\n // this may introduce race conditions\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 }[]\ntype RustifiedOptionEnv = { name: string; value: string | undefined }[]\n\nexport function createDefineEnv({\n isTurbopack,\n clientRouterFilters,\n config,\n dev,\n distDir,\n projectPath,\n fetchCacheKeyPrefix,\n hasRewrites,\n middlewareMatchers,\n rewrites,\n}: Omit<\n DefineEnvOptions,\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] = rustifyOptionEnv(\n getDefineEnv({\n isTurbopack,\n clientRouterFilters,\n config,\n dev,\n distDir,\n projectPath,\n fetchCacheKeyPrefix,\n hasRewrites,\n isClient: variant === 'client',\n isEdgeServer: variant === 'edge',\n isNodeServer: variant === 'nodejs',\n middlewareMatchers,\n rewrites,\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\nfunction rustifyOptionEnv(\n env: Record<string, string | undefined>\n): RustifiedOptionEnv {\n return Object.entries(env).map(([name, value]) => ({\n name,\n value,\n }))\n}\n\n// TODO(sokra) Support wasm option.\nfunction bindingToApi(\n binding: RawBindings,\n _wasm: boolean\n): Binding['turbo']['createProject'] {\n type NativeFunction<T> = (\n callback: (err: Error, value: T) => void\n ) => Promise<{ __napiType: 'RootTask' }>\n\n type NapiEndpoint = { __napiType: 'Endpoint' }\n\n type NapiEntrypoints = {\n routes: NapiRoute[]\n middleware?: NapiMiddleware\n instrumentation?: NapiInstrumentation\n pagesDocumentEndpoint: NapiEndpoint\n pagesAppEndpoint: NapiEndpoint\n pagesErrorEndpoint: NapiEndpoint\n }\n\n type NapiMiddleware = {\n endpoint: NapiEndpoint\n runtime: 'nodejs' | 'edge'\n matcher?: string[]\n }\n\n type NapiInstrumentation = {\n nodeJs: NapiEndpoint\n edge: NapiEndpoint\n }\n\n type NapiRoute = {\n pathname: string\n } & (\n | {\n type: 'page'\n htmlEndpoint: NapiEndpoint\n dataEndpoint: NapiEndpoint\n }\n | {\n type: 'page-api'\n endpoint: NapiEndpoint\n }\n | {\n type: 'app-page'\n pages: {\n originalName: string\n htmlEndpoint: NapiEndpoint\n rscEndpoint: NapiEndpoint\n }[]\n }\n | {\n type: 'app-route'\n originalName: string\n endpoint: NapiEndpoint\n }\n | {\n type: 'conflict'\n }\n )\n\n const cancel = new (class Cancel extends Error {})()\n\n /**\n * Utility function to ensure all variants of an enum are handled.\n */\n function invariant(\n never: never,\n computeMessage: (arg: any) => string\n ): never {\n throw new Error(`Invariant: ${computeMessage(never)}`)\n }\n\n /**\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 nativeFunction(emitResult)\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 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 path.join(options.rootPath, 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(\n options.nextConfig,\n path.join(options.rootPath!, options.projectPath!)\n )),\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 binding.projectUpdate(\n this._nativeProject,\n await rustifyPartialProjectOptions(options)\n )\n }\n\n async writeAllEntrypointsToDisk(\n appDirOnly: boolean\n ): Promise<TurbopackResult<RawEntrypoints>> {\n const napiEndpoints = (await binding.projectWriteAllEntrypointsToDisk(\n this._nativeProject,\n appDirOnly\n )) as TurbopackResult<NapiEntrypoints>\n\n return napiEntrypointsToRawEntrypoints(napiEndpoints)\n }\n\n entrypointsSubscribe() {\n const subscription = subscribe<TurbopackResult<NapiEntrypoints>>(\n false,\n async (callback) =>\n binding.projectEntrypointsSubscribe(this._nativeProject, callback)\n )\n return (async function* () {\n for await (const entrypoints of subscription) {\n yield napiEntrypointsToRawEntrypoints(entrypoints)\n }\n })()\n }\n\n hmrEvents(identifier: string) {\n return subscribe<TurbopackResult<Update>>(true, async (callback) =>\n binding.projectHmrEvents(this._nativeProject, identifier, callback)\n )\n }\n\n hmrIdentifiersSubscribe() {\n return subscribe<TurbopackResult<HmrIdentifiers>>(\n false,\n async (callback) =>\n binding.projectHmrIdentifiersSubscribe(this._nativeProject, callback)\n )\n }\n\n traceSource(\n stackFrame: TurbopackStackFrame,\n currentDirectoryFileUrl: string\n ): Promise<TurbopackStackFrame | null> {\n return binding.projectTraceSource(\n this._nativeProject,\n stackFrame,\n currentDirectoryFileUrl\n )\n }\n\n getSourceForAsset(filePath: string): Promise<string | null> {\n return binding.projectGetSourceForAsset(this._nativeProject, filePath)\n }\n\n getSourceMap(filePath: string): Promise<string | null> {\n return binding.projectGetSourceMap(this._nativeProject, filePath)\n }\n\n getSourceMapSync(filePath: string): string | null {\n return binding.projectGetSourceMapSync(this._nativeProject, filePath)\n }\n\n updateInfoSubscribe(aggregationMs: number) {\n return subscribe<TurbopackResult<UpdateMessage>>(true, async (callback) =>\n binding.projectUpdateInfoSubscribe(\n this._nativeProject,\n aggregationMs,\n callback\n )\n )\n }\n\n compilationEventsSubscribe(eventTypes?: string[]) {\n return subscribe<TurbopackResult<CompilationEvent>>(\n true,\n async (callback) => {\n binding.projectCompilationEventsSubscribe(\n this._nativeProject,\n callback,\n eventTypes\n )\n }\n )\n }\n\n invalidatePersistentCache(): Promise<void> {\n return binding.projectInvalidatePersistentCache(this._nativeProject)\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 binding.endpointWriteToDisk(\n this._nativeEndpoint\n )) as TurbopackResult<WrittenEndpoint>\n }\n\n async clientChanged(): Promise<AsyncIterableIterator<TurbopackResult<{}>>> {\n const clientSubscription = subscribe<TurbopackResult>(\n false,\n async (callback) =>\n binding.endpointClientChangedSubscribe(this._nativeEndpoint, callback)\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 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?.turbopack?.rules ?? []).some((key) =>\n ruleKeys.includes(key)\n )\n ) {\n Log.warn(\n `The React Compiler cannot be enabled automatically because 'turbopack.rules' 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.turbopack) {\n nextConfig.turbopack = {}\n }\n\n if (!nextConfig.turbopack.rules) {\n nextConfig.turbopack.rules = {}\n }\n\n for (const key of ['*.ts', '*.js', '*.jsx', '*.tsx']) {\n nextConfig.turbopack.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.turbopack?.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 const conditions: (typeof nextConfig)['turbopack']['conditions'] =\n nextConfigSerializable.turbopack?.conditions\n if (conditions) {\n type SerializedConditions = {\n [key: string]: {\n path:\n | { type: 'regex'; value: { source: string; flags: string } }\n | { type: 'glob'; value: string }\n }\n }\n\n const serializedConditions: SerializedConditions = {}\n for (const [key, value] of Object.entries(conditions)) {\n serializedConditions[key] = {\n ...value,\n path:\n value.path instanceof RegExp\n ? {\n type: 'regex',\n value: { source: value.path.source, flags: value.path.flags },\n }\n : { type: 'glob', value: value.path },\n }\n }\n nextConfigSerializable.turbopack.conditions = serializedConditions\n }\n\n return JSON.stringify(nextConfigSerializable, null, 2)\n }\n\n function ensureLoadersHaveSerializableOptions(\n turbopackRules: Record<string, TurbopackRuleConfigItemOrShortcut>\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: TurbopackRuleConfigItem, glob: string) {\n if (!rule) return\n if ('loaders' in rule) {\n checkLoaderItems((rule as TurbopackRuleConfigItemOptions).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(\n loaderItems: TurbopackLoaderItem[],\n glob: string\n ) {\n for (const loaderItem of loaderItems) {\n if (\n typeof loaderItem !== 'string' &&\n !isDeepStrictEqual(loaderItem, JSON.parse(JSON.stringify(loaderItem)))\n ) {\n throw new Error(\n `loader ${loaderItem.loader} for match \"${glob}\" does not have serializable options. Ensure that options passed are plain JavaScript objects and values.`\n )\n }\n }\n }\n }\n\n function napiEntrypointsToRawEntrypoints(\n entrypoints: TurbopackResult<NapiEntrypoints>\n ): TurbopackResult<RawEntrypoints> {\n const routes = new Map()\n for (const { pathname, ...nativeRoute } of entrypoints.routes) {\n let route: Route\n const routeType = nativeRoute.type\n switch (routeType) {\n case 'page':\n route = {\n type: 'page',\n htmlEndpoint: new EndpointImpl(nativeRoute.htmlEndpoint),\n dataEndpoint: new EndpointImpl(nativeRoute.dataEndpoint),\n }\n break\n case 'page-api':\n route = {\n type: 'page-api',\n endpoint: new EndpointImpl(nativeRoute.endpoint),\n }\n break\n case 'app-page':\n route = {\n type: 'app-page',\n pages: nativeRoute.pages.map((page) => ({\n originalName: page.originalName,\n htmlEndpoint: new EndpointImpl(page.htmlEndpoint),\n rscEndpoint: new EndpointImpl(page.rscEndpoint),\n })),\n }\n break\n case 'app-route':\n route = {\n type: 'app-route',\n originalName: nativeRoute.originalName,\n endpoint: new EndpointImpl(nativeRoute.endpoint),\n }\n break\n case 'conflict':\n route = {\n type: 'conflict',\n }\n break\n default:\n const _exhaustiveCheck: never = routeType\n invariant(\n nativeRoute,\n () => `Unknown route type: ${_exhaustiveCheck}`\n )\n }\n routes.set(pathname, route)\n }\n const napiMiddlewareToMiddleware = (middleware: NapiMiddleware) => ({\n endpoint: new EndpointImpl(middleware.endpoint),\n runtime: middleware.runtime,\n matcher: middleware.matcher,\n })\n const middleware = entrypoints.middleware\n ? napiMiddlewareToMiddleware(entrypoints.middleware)\n : undefined\n const napiInstrumentationToInstrumentation = (\n instrumentation: NapiInstrumentation\n ) => ({\n nodeJs: new EndpointImpl(instrumentation.nodeJs),\n edge: new EndpointImpl(instrumentation.edge),\n })\n const instrumentation = entrypoints.instrumentation\n ? napiInstrumentationToInstrumentation(entrypoints.instrumentation)\n : undefined\n\n return {\n routes,\n middleware,\n instrumentation,\n pagesDocumentEndpoint: new EndpointImpl(\n entrypoints.pagesDocumentEndpoint\n ),\n pagesAppEndpoint: new EndpointImpl(entrypoints.pagesAppEndpoint),\n pagesErrorEndpoint: new EndpointImpl(entrypoints.pagesErrorEndpoint),\n issues: entrypoints.issues,\n diagnostics: entrypoints.diagnostics,\n }\n }\n\n return async function createProject(\n options: ProjectOptions,\n turboEngineOptions\n ) {\n return new ProjectImpl(\n await binding.projectNew(\n await rustifyProjectOptions(options),\n turboEngineOptions || {},\n {\n throwTurbopackInternalError,\n }\n )\n )\n }\n}\n\n// helper for loadWasm\nasync function loadWasmRawBindings(importPath = ''): Promise<RawWasmBindings> {\n let attempts = []\n\n // Used by `run-tests` to force use of a locally-built wasm binary. This environment variable is\n // unstable and subject to change.\n const testWasmDir = process.env.NEXT_TEST_WASM_DIR\n\n if (testWasmDir) {\n // assume these are node.js bindings and don't need a call to `.default()`\n const rawBindings = await import(\n pathToFileURL(path.join(testWasmDir, 'wasm.js')).toString()\n )\n infoLog(`next-swc build: wasm build ${testWasmDir}`)\n return rawBindings\n } else {\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 const importedRawBindings = await import(\n pathToFileURL(pkgPath).toString()\n )\n let rawBindings\n if (pkg === '@next/swc-wasm-web') {\n // https://rustwasm.github.io/docs/wasm-bindgen/examples/without-a-bundler.html\n // `default` must be called to initialize the module\n rawBindings = await importedRawBindings.default!()\n } else {\n rawBindings = importedRawBindings\n }\n infoLog(`next-swc build: wasm build ${pkg}`)\n return rawBindings\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\n throw attempts\n}\n\n// helper for tryLoadWasmWithFallback / loadBindings.\nasync function loadWasm(importPath = '') {\n const rawBindings = await loadWasmRawBindings(importPath)\n\n function removeUndefined(obj: any): any {\n // serde-wasm-bindgen expect that `undefined` values map to `()` in rust, but we want to treat\n // those fields as non-existent, so remove them before passing them to rust.\n //\n // The native (non-wasm) bindings use `JSON.stringify`, which strips undefined values.\n if (typeof obj !== 'object' || obj === null) {\n return obj\n }\n if (Array.isArray(obj)) {\n return obj.map(removeUndefined)\n }\n const newObj: { [key: string]: any } = {}\n for (const [k, v] of Object.entries(obj)) {\n if (typeof v !== 'undefined') {\n newObj[k] = removeUndefined(v)\n }\n }\n return newObj\n }\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): Promise<any> {\n return rawBindings.transform(src.toString(), removeUndefined(options))\n },\n transformSync(src: string, options: any) {\n return rawBindings.transformSync(src.toString(), removeUndefined(options))\n },\n minify(src: string, options: any): Promise<any> {\n return rawBindings.minify(src.toString(), removeUndefined(options))\n },\n minifySync(src: string, options: any) {\n return rawBindings.minifySync(src.toString(), removeUndefined(options))\n },\n parse(src: string, options: any): Promise<any> {\n return rawBindings.parse(src.toString(), removeUndefined(options))\n },\n getTargetTriple() {\n return undefined\n },\n turbo: {\n createProject(\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(_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 rawBindings.mdxCompile(\n src,\n removeUndefined(getMdxOptions(options))\n )\n },\n compileSync(src: string, options: any) {\n return rawBindings.mdxCompileSync(\n src,\n removeUndefined(getMdxOptions(options))\n )\n },\n },\n reactCompiler: {\n isReactCompilerRequired(_filename: string) {\n return Promise.resolve(true)\n },\n },\n rspack: {\n getModuleNamedExports(_resourcePath: string): Promise<string[]> {\n throw new Error(\n '`rspack.getModuleNamedExports` is not supported by the wasm bindings.'\n )\n },\n warnForEdgeRuntime(\n _source: string,\n _isProduction: boolean\n ): Promise<NapiSourceDiagnostic[]> {\n throw new Error(\n '`rspack.warnForEdgeRuntime` is not supported by the wasm bindings.'\n )\n },\n },\n }\n return wasmBindings\n}\n\n/**\n * Loads the native (non-wasm) bindings. Prefer `loadBindings` over this API, as that includes a\n * wasm fallback.\n */\nfunction loadNative(importPath?: string) {\n if (nativeBindings) {\n return nativeBindings\n }\n\n if (process.env.NEXT_TEST_WASM) {\n throw new Error('cannot run loadNative when `NEXT_TEST_WASM` is set')\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(Buffer.from(src), toBuffer(options ?? {}))\n },\n\n minifySync(src: string, options: any) {\n return bindings.minifySync(Buffer.from(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://trace.nextjs.org'\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 reactCompiler: {\n isReactCompilerRequired: (filename: string) => {\n return bindings.isReactCompilerRequired(filename)\n },\n },\n rspack: {\n getModuleNamedExports: function (\n resourcePath: string\n ): Promise<string[]> {\n return bindings.getModuleNamedExports(resourcePath)\n },\n warnForEdgeRuntime: function (\n source: string,\n isProduction: boolean\n ): Promise<NapiSourceDiagnostic[]> {\n return bindings.warnForEdgeRuntime(source, isProduction)\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 isReactCompilerRequired(\n filename: string\n): Promise<boolean> {\n let bindings = await loadBindings()\n return bindings.reactCompiler.isReactCompilerRequired(filename)\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\nexport async function getModuleNamedExports(\n resourcePath: string\n): Promise<string[]> {\n const bindings = await loadBindings()\n return bindings.rspack.getModuleNamedExports(resourcePath)\n}\n\nexport async function warnForEdgeRuntime(\n source: string,\n isProduction: boolean\n): Promise<NapiSourceDiagnostic[]> {\n const bindings = await loadBindings()\n return bindings.rspack.warnForEdgeRuntime(source, isProduction)\n}\n"],"names":["path","pathToFileURL","arch","platform","platformArchTriples","Log","getParserOptions","eventSwcLoadFailure","patchIncorrectLockfile","downloadNativeNextSwc","downloadWasmSwc","isDeepStrictEqual","getDefineEnv","getReactCompilerLoader","throwTurbopackInternalError","nextVersion","process","env","__NEXT_VERSION","ArchName","PlatformName","infoLog","args","NEXT_PRIVATE_BUILD_WORKER","DEBUG","info","getSupportedArchTriples","darwin","win32","linux","freebsd","android","arm64","ia32","filter","triple","abi","x64","arm","triples","supportedArchTriples","targetTriple","rawTargetTriple","warn","__INTERNAL_CUSTOM_TURBOPACK_BINDINGS","checkVersionMismatch","pkgData","version","knownDefaultWasmFallbackTriples","lastNativeBindingsLoadErrorCode","undefined","pendingBindings","nativeBindings","wasmBindings","downloadWasmPromise","swcTraceFlushGuard","downloadNativeBindingsPromise","lockfilePatchPromise","loadBindings","useWasmBinary","RUST_MIN_STACK","NEXT_TEST_WASM","stdout","_handle","setBlocking","stderr","Promise","resolve","_reject","cur","cwd","catch","console","error","attempts","disableWasmFallback","NEXT_DISABLE_SWC_WASM","unsupportedPlatform","some","raw","includes","isWebContainer","versions","webcontainer","shouldLoadWasmFallbackFirst","fallbackBindings","tryLoadWasmWithFallback","loadNative","a","Array","isArray","every","m","tryLoadNativeWithFallback","concat","logLoadFailure","nativeBindingsDirectory","join","dirname","require","map","platformArchABI","push","bindings","loadWasm","wasm","nativeBindingsErrorCode","wasmDirectory","attempt","loadBindingsSync","Error","cause","loggingLoadFailure","triedWasm","then","finally","exit","createDefineEnv","isTurbopack","clientRouterFilters","config","dev","distDir","projectPath","fetchCacheKeyPrefix","hasRewrites","middlewareMatchers","rewrites","defineEnv","client","edge","nodejs","variant","Object","keys","rustifyOptionEnv","isClient","isEdgeServer","isNodeServer","rustifyEnv","entries","_","value","name","bindingToApi","binding","_wasm","cancel","Cancel","invariant","never","computeMessage","subscribe","useBuffer","nativeFunction","buffer","waiting","canceled","emitResult","err","reject","item","createIterator","task","length","shift","e","rootTaskDispose","iterator","return","done","rustifyProjectOptions","options","nextConfig","serializeNextConfig","rootPath","jsConfig","JSON","stringify","rustifyPartialProjectOptions","ProjectImpl","constructor","nativeProject","_nativeProject","update","projectUpdate","writeAllEntrypointsToDisk","appDirOnly","napiEndpoints","projectWriteAllEntrypointsToDisk","napiEntrypointsToRawEntrypoints","entrypointsSubscribe","subscription","callback","projectEntrypointsSubscribe","entrypoints","hmrEvents","identifier","projectHmrEvents","hmrIdentifiersSubscribe","projectHmrIdentifiersSubscribe","traceSource","stackFrame","currentDirectoryFileUrl","projectTraceSource","getSourceForAsset","filePath","projectGetSourceForAsset","getSourceMap","projectGetSourceMap","getSourceMapSync","projectGetSourceMapSync","updateInfoSubscribe","aggregationMs","projectUpdateInfoSubscribe","compilationEventsSubscribe","eventTypes","projectCompilationEventsSubscribe","invalidatePersistentCache","projectInvalidatePersistentCache","shutdown","projectShutdown","onExit","projectOnExit","EndpointImpl","nativeEndpoint","_nativeEndpoint","writeToDisk","endpointWriteToDisk","clientChanged","clientSubscription","endpointClientChangedSubscribe","next","serverChanged","includeIssues","serverSubscription","endpointServerChangedSubscribe","augmentNextConfig","originalNextConfig","reactCompilerOptions","experimental","reactCompiler","ruleKeys","turbopack","rules","key","browser","foreign","loaders","nextConfigSerializable","generateBuildId","exportPathMap","webpack","turbo","ensureLoadersHaveSerializableOptions","modularizeImports","fromEntries","mod","transform","images","loaderFile","relative","conditions","serializedConditions","RegExp","type","source","flags","turbopackRules","glob","rule","checkLoaderItems","checkConfigItem","inner","loaderItems","loaderItem","parse","loader","routes","Map","pathname","nativeRoute","route","routeType","htmlEndpoint","dataEndpoint","endpoint","pages","page","originalName","rscEndpoint","_exhaustiveCheck","set","napiMiddlewareToMiddleware","middleware","runtime","matcher","napiInstrumentationToInstrumentation","instrumentation","nodeJs","pagesDocumentEndpoint","pagesAppEndpoint","pagesErrorEndpoint","issues","diagnostics","createProject","turboEngineOptions","projectNew","loadWasmRawBindings","importPath","testWasmDir","NEXT_TEST_WASM_DIR","rawBindings","toString","pkg","pkgPath","importedRawBindings","default","code","message","removeUndefined","obj","newObj","k","v","css","lightning","_options","transformStyleAttr","isWasm","src","transformSync","minify","minifySync","getTargetTriple","_turboEngineOptions","startTurbopackTraceServer","_traceFilePath","mdx","compile","mdxCompile","getMdxOptions","compileSync","mdxCompileSync","isReactCompilerRequired","_filename","rspack","getModuleNamedExports","_resourcePath","warnForEdgeRuntime","_source","_isProduction","customBindings","NEXT_TEST_NATIVE_DIR","isModule","Buffer","isBuffer","jsc","parser","syntax","toBuffer","from","initCustomTraceSubscriber","teardownTraceSubscriber","traceFilePath","transformOptions","lightningCssTransform","transformAttrOptions","lightningCssTransformStyleAttribute","filename","resourcePath","isProduction","development","jsx","mdxType","t","parserOptions","astStr","getBinaryMetadata","target","traceFileName","once","fn","executed"],"mappings":"AAAA,0DAA0D,GAC1D,OAAOA,UAAU,OAAM;AACvB,SAASC,aAAa,QAAQ,MAAK;AACnC,SAASC,IAAI,EAAEC,QAAQ,QAAQ,KAAI;AACnC,SAASC,mBAAmB,QAAQ,sCAAqC;AACzE,YAAYC,SAAS,gBAAe;AACpC,SAASC,gBAAgB,QAAQ,YAAW;AAC5C,SAASC,mBAAmB,QAAQ,0CAAyC;AAC7E,SAASC,sBAAsB,QAAQ,qCAAoC;AAC3E,SAASC,qBAAqB,EAAEC,eAAe,QAAQ,yBAAwB;AAQ/E,SAASC,iBAAiB,QAAQ,OAAM;AACxC,SAAgCC,YAAY,QAAQ,gBAAe;AACnE,SAASC,sBAAsB,Q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 +1 @@
1
- {"version":3,"sources":["../../../src/build/swc/types.ts"],"sourcesContent":["import type { NextConfigComplete } from '../../server/config-shared'\nimport type { __ApiPreviewProps } from '../../server/api-utils'\nimport type {\n ExternalObject,\n RefCell,\n NapiTurboEngineOptions,\n NapiSourceDiagnostic,\n NapiModuleGraphSnapshots,\n NapiModuleGraphSnapshot,\n} from './generated-native'\n\nexport type { NapiTurboEngineOptions as TurboEngineOptions }\n\nexport interface Binding {\n isWasm: boolean\n turbo: {\n createProject(\n options: ProjectOptions,\n turboEngineOptions?: NapiTurboEngineOptions\n ): Promise<Project>\n startTurbopackTraceServer(traceFilePath: string): void\n\n nextBuild?: any\n }\n mdx: {\n compile(src: string, options: any): any\n compileSync(src: string, options: any): any\n }\n minify(src: string, options: any): Promise<any>\n minifySync(src: string, options: any): any\n transform(src: string, options: any): Promise<any>\n transformSync(src: string, options: any): any\n parse(src: string, options: any): Promise<string>\n\n getTargetTriple(): string | undefined\n\n initCustomTraceSubscriber?(traceOutFilePath?: string): ExternalObject<RefCell>\n teardownTraceSubscriber?(guardExternal: ExternalObject<RefCell>): void\n css: {\n lightning: {\n transform(transformOptions: any): Promise<any>\n transformStyleAttr(transformAttrOptions: any): Promise<any>\n }\n }\n\n reactCompiler: {\n isReactCompilerRequired(filename: string): Promise<boolean>\n }\n\n rspack: {\n getModuleNamedExports(resourcePath: string): Promise<string[]>\n warnForEdgeRuntime(\n source: string,\n isProduction: boolean\n ): Promise<NapiSourceDiagnostic[]>\n }\n}\n\nexport type StyledString =\n | {\n type: 'text'\n value: string\n }\n | {\n type: 'code'\n value: string\n }\n | {\n type: 'strong'\n value: string\n }\n | {\n type: 'stack'\n value: StyledString[]\n }\n | {\n type: 'line'\n value: StyledString[]\n }\n\nexport interface Issue {\n severity: string\n stage: string\n filePath: string\n title: StyledString\n description?: StyledString\n detail?: StyledString\n source?: {\n source: {\n ident: string\n content?: string\n }\n range?: {\n start: {\n // 0-indexed\n line: number\n // 0-indexed\n column: number\n }\n end: {\n // 0-indexed\n line: number\n // 0-indexed\n column: number\n }\n }\n }\n documentationLink: string\n importTraces?: PlainTraceItem[][]\n}\nexport interface PlainTraceItem {\n fsName: string\n path: string\n rootPath: string\n layer?: string\n}\n\nexport interface Diagnostics {\n category: string\n name: string\n payload: unknown\n}\n\nexport type TurbopackResult<T = {}> = T & {\n issues: Issue[]\n diagnostics: Diagnostics[]\n}\n\nexport interface Middleware {\n endpoint: Endpoint\n}\n\nexport interface Instrumentation {\n nodeJs: Endpoint\n edge: Endpoint\n}\n\nexport interface RawEntrypoints {\n routes: Map<string, Route>\n middleware?: Middleware\n instrumentation?: Instrumentation\n pagesDocumentEndpoint: Endpoint\n pagesAppEndpoint: Endpoint\n pagesErrorEndpoint: Endpoint\n}\n\ninterface BaseUpdate {\n resource: {\n headers: unknown\n path: string\n }\n diagnostics: unknown[]\n issues: Issue[]\n}\n\ninterface IssuesUpdate extends BaseUpdate {\n type: 'issues'\n}\n\ninterface EcmascriptMergedUpdate {\n type: 'EcmascriptMergedUpdate'\n chunks: { [moduleName: string]: { type: 'partial' } }\n entries: { [moduleName: string]: { code: string; map: string; url: string } }\n}\n\ninterface PartialUpdate extends BaseUpdate {\n type: 'partial'\n instruction: {\n type: 'ChunkListUpdate'\n merged: EcmascriptMergedUpdate[] | undefined\n }\n}\n\nexport type Update = IssuesUpdate | PartialUpdate\n\nexport interface HmrIdentifiers {\n identifiers: string[]\n}\n\n/** @see https://github.com/vercel/next.js/blob/415cd74b9a220b6f50da64da68c13043e9b02995/packages/next-swc/crates/napi/src/next_api/project.rs#L824-L833 */\nexport interface TurbopackStackFrame {\n isServer: boolean\n isInternal?: boolean\n file: string\n originalFile?: string\n /** 1-indexed, unlike source map tokens */\n line?: number\n /** 1-indexed, unlike source map tokens */\n column?: number\n methodName?: string\n}\n\nexport type UpdateMessage =\n | {\n updateType: 'start'\n }\n | {\n updateType: 'end'\n value: UpdateInfo\n }\n\nexport type CompilationEvent = {\n typeName: string\n message: string\n severity: string\n eventData: any\n}\n\nexport interface UpdateInfo {\n duration: number\n tasks: number\n}\n\nexport interface Project {\n update(options: Partial<ProjectOptions>): Promise<void>\n\n writeAllEntrypointsToDisk(\n appDirOnly: boolean\n ): Promise<TurbopackResult<RawEntrypoints>>\n\n getEntrypoints(): Promise<TurbopackResult<RawEntrypoints>>\n entrypointsSubscribe(): AsyncIterableIterator<TurbopackResult<RawEntrypoints>>\n\n hmrEvents(identifier: string): AsyncIterableIterator<TurbopackResult<Update>>\n\n hmrIdentifiersSubscribe(): AsyncIterableIterator<\n TurbopackResult<HmrIdentifiers>\n >\n\n getSourceForAsset(filePath: string): Promise<string | null>\n\n getSourceMap(filePath: string): Promise<string | null>\n getSourceMapSync(filePath: string): string | null\n\n traceSource(\n stackFrame: TurbopackStackFrame,\n currentDirectoryFileUrl: string\n ): Promise<TurbopackStackFrame | null>\n\n updateInfoSubscribe(\n aggregationMs: number\n ): AsyncIterableIterator<TurbopackResult<UpdateMessage>>\n\n compilationEventsSubscribe(\n eventTypes?: string[]\n ): AsyncIterableIterator<TurbopackResult<CompilationEvent>>\n\n invalidatePersistentCache(): Promise<void>\n\n moduleGraph(): Promise<TurbopackResult<NapiModuleGraphSnapshot>>\n\n shutdown(): Promise<void>\n\n onExit(): Promise<void>\n}\n\nexport type Route =\n | {\n type: 'conflict'\n }\n | {\n type: 'app-page'\n pages: {\n originalName: string\n htmlEndpoint: Endpoint\n rscEndpoint: Endpoint\n }[]\n }\n | {\n type: 'app-route'\n originalName: string\n endpoint: Endpoint\n }\n | {\n type: 'page'\n htmlEndpoint: Endpoint\n dataEndpoint: Endpoint\n }\n | {\n type: 'page-api'\n endpoint: Endpoint\n }\n\nexport interface Endpoint {\n /** Write files for the endpoint to disk. */\n writeToDisk(): Promise<TurbopackResult<WrittenEndpoint>>\n\n /**\n * Listen to client-side changes to the endpoint.\n * After clientChanged() has been awaited it will listen to changes.\n * The async iterator will yield for each change.\n */\n clientChanged(): Promise<AsyncIterableIterator<TurbopackResult>>\n\n /**\n * Listen to server-side changes to the endpoint.\n * After serverChanged() has been awaited it will listen to changes.\n * The async iterator will yield for each change.\n */\n serverChanged(\n includeIssues: boolean\n ): Promise<AsyncIterableIterator<TurbopackResult>>\n\n /**\n * Gets a snapshot of the module graphs for the endpoint.\n */\n moduleGraphs(): Promise<TurbopackResult<NapiModuleGraphSnapshots>>\n}\n\ninterface EndpointConfig {\n dynamic?: 'auto' | 'force-dynamic' | 'error' | 'force-static'\n dynamicParams?: boolean\n revalidate?: 'never' | 'force-cache' | number\n fetchCache?:\n | 'auto'\n | 'default-cache'\n | 'only-cache'\n | 'force-cache'\n | 'default-no-store'\n | 'only-no-store'\n | 'force-no-store'\n runtime?: 'nodejs' | 'edge'\n preferredRegion?: string\n}\n\nexport type ServerPath = {\n path: string\n contentHash: string\n}\n\nexport type WrittenEndpoint =\n | {\n type: 'nodejs'\n /** The entry path for the endpoint. */\n entryPath: string\n /** All client paths that have been written for the endpoint. */\n clientPaths: string[]\n /** All server paths that have been written for the endpoint. */\n serverPaths: ServerPath[]\n config: EndpointConfig\n }\n | {\n type: 'edge'\n /** All client paths that have been written for the endpoint. */\n clientPaths: string[]\n /** All server paths that have been written for the endpoint. */\n serverPaths: ServerPath[]\n config: EndpointConfig\n }\n | {\n type: 'none'\n clientPaths: []\n serverPaths: []\n config: EndpointConfig\n }\n\nexport interface ProjectOptions {\n /**\n * An absolute root path (Unix or Windows path) from which all files must be nested under. Trying\n * to access a file outside this root will fail, so think of this as a chroot.\n * E.g. `/home/user/projects/my-repo`.\n */\n rootPath: string\n\n /**\n * A path which contains the app/pages directories, relative to `root_path`, always a Unix path.\n * E.g. `apps/my-app`\n */\n projectPath: string\n\n /**\n * A path where to emit the build outputs, relative to [`Project::project_path`], always a Unix\n * path. Corresponds to next.config.js's `distDir`.\n * E.g. `.next`\n */\n distDir: string\n\n /**\n * The next.config.js contents.\n */\n nextConfig: NextConfigComplete\n\n /**\n * Jsconfig, or tsconfig contents.\n *\n * Next.js implicitly requires to read it to support few options\n * https://nextjs.org/docs/architecture/nextjs-compiler#legacy-decorators\n * https://nextjs.org/docs/architecture/nextjs-compiler#importsource\n */\n jsConfig: {\n compilerOptions: object\n }\n\n /**\n * A map of environment variables to use when compiling code.\n */\n env: Record<string, string>\n\n defineEnv: DefineEnv\n\n /**\n * Whether to watch the filesystem for file changes.\n */\n watch: {\n enable: boolean\n pollIntervalMs?: number\n }\n\n /**\n * The mode in which Next.js is running.\n */\n dev: boolean\n\n /**\n * The server actions encryption key.\n */\n encryptionKey: string\n\n /**\n * The build id.\n */\n buildId: string\n\n /**\n * Options for draft mode.\n */\n previewProps: __ApiPreviewProps\n\n /**\n * The browserslist query to use for targeting browsers.\n */\n browserslistQuery: string\n\n /**\n * When the code is minified, this opts out of the default mangling of local\n * names for variables, functions etc., which can be useful for\n * debugging/profiling purposes.\n */\n noMangling: boolean\n\n /**\n * The version of Node.js that is available/currently running.\n */\n currentNodeJsVersion: string\n}\n\nexport interface DefineEnv {\n client: RustifiedOptionalEnv\n edge: RustifiedOptionalEnv\n nodejs: RustifiedOptionalEnv\n}\n\nexport type RustifiedEnv = { name: string; value: string }[]\nexport type RustifiedOptionalEnv = { name: string; value: string | undefined }[]\n\nexport interface GlobalEntrypoints {\n app: Endpoint | undefined\n document: Endpoint | undefined\n error: Endpoint | undefined\n middleware: Middleware | undefined\n instrumentation: Instrumentation | undefined\n}\n\nexport type PageRoute =\n | {\n type: 'page'\n htmlEndpoint: Endpoint\n dataEndpoint: Endpoint\n }\n | {\n type: 'page-api'\n endpoint: Endpoint\n }\n\nexport type AppRoute =\n | {\n type: 'app-page'\n htmlEndpoint: Endpoint\n rscEndpoint: Endpoint\n }\n | {\n type: 'app-route'\n endpoint: Endpoint\n }\n\n// pathname -> route\nexport type PageEntrypoints = Map<string, PageRoute>\n\n// originalName / page -> route\nexport type AppEntrypoints = Map<string, AppRoute>\n\nexport type Entrypoints = {\n global: GlobalEntrypoints\n page: PageEntrypoints\n app: AppEntrypoints\n}\n"],"names":[],"mappings":"AA2eA,WAIC","ignoreList":[0]}
1
+ {"version":3,"sources":["../../../src/build/swc/types.ts"],"sourcesContent":["import type { NextConfigComplete } from '../../server/config-shared'\nimport type { __ApiPreviewProps } from '../../server/api-utils'\nimport type {\n ExternalObject,\n RefCell,\n NapiTurboEngineOptions,\n NapiSourceDiagnostic,\n} from './generated-native'\n\nexport type { NapiTurboEngineOptions as TurboEngineOptions }\n\nexport interface Binding {\n isWasm: boolean\n turbo: {\n createProject(\n options: ProjectOptions,\n turboEngineOptions?: NapiTurboEngineOptions\n ): Promise<Project>\n startTurbopackTraceServer(traceFilePath: string): void\n\n nextBuild?: any\n }\n mdx: {\n compile(src: string, options: any): any\n compileSync(src: string, options: any): any\n }\n minify(src: string, options: any): Promise<any>\n minifySync(src: string, options: any): any\n transform(src: string, options: any): Promise<any>\n transformSync(src: string, options: any): any\n parse(src: string, options: any): Promise<string>\n\n getTargetTriple(): string | undefined\n\n initCustomTraceSubscriber?(traceOutFilePath?: string): ExternalObject<RefCell>\n teardownTraceSubscriber?(guardExternal: ExternalObject<RefCell>): void\n css: {\n lightning: {\n transform(transformOptions: any): Promise<any>\n transformStyleAttr(transformAttrOptions: any): Promise<any>\n }\n }\n\n reactCompiler: {\n isReactCompilerRequired(filename: string): Promise<boolean>\n }\n\n rspack: {\n getModuleNamedExports(resourcePath: string): Promise<string[]>\n warnForEdgeRuntime(\n source: string,\n isProduction: boolean\n ): Promise<NapiSourceDiagnostic[]>\n }\n}\n\nexport type StyledString =\n | {\n type: 'text'\n value: string\n }\n | {\n type: 'code'\n value: string\n }\n | {\n type: 'strong'\n value: string\n }\n | {\n type: 'stack'\n value: StyledString[]\n }\n | {\n type: 'line'\n value: StyledString[]\n }\n\nexport interface Issue {\n severity: string\n stage: string\n filePath: string\n title: StyledString\n description?: StyledString\n detail?: StyledString\n source?: {\n source: {\n ident: string\n content?: string\n }\n range?: {\n start: {\n // 0-indexed\n line: number\n // 0-indexed\n column: number\n }\n end: {\n // 0-indexed\n line: number\n // 0-indexed\n column: number\n }\n }\n }\n documentationLink: string\n importTraces?: PlainTraceItem[][]\n}\nexport interface PlainTraceItem {\n fsName: string\n path: string\n rootPath: string\n layer?: string\n}\n\nexport interface Diagnostics {\n category: string\n name: string\n payload: unknown\n}\n\nexport type TurbopackResult<T = {}> = T & {\n issues: Issue[]\n diagnostics: Diagnostics[]\n}\n\nexport interface Middleware {\n endpoint: Endpoint\n}\n\nexport interface Instrumentation {\n nodeJs: Endpoint\n edge: Endpoint\n}\n\nexport interface RawEntrypoints {\n routes: Map<string, Route>\n middleware?: Middleware\n instrumentation?: Instrumentation\n pagesDocumentEndpoint: Endpoint\n pagesAppEndpoint: Endpoint\n pagesErrorEndpoint: Endpoint\n}\n\ninterface BaseUpdate {\n resource: {\n headers: unknown\n path: string\n }\n diagnostics: unknown[]\n issues: Issue[]\n}\n\ninterface IssuesUpdate extends BaseUpdate {\n type: 'issues'\n}\n\ninterface EcmascriptMergedUpdate {\n type: 'EcmascriptMergedUpdate'\n chunks: { [moduleName: string]: { type: 'partial' } }\n entries: { [moduleName: string]: { code: string; map: string; url: string } }\n}\n\ninterface PartialUpdate extends BaseUpdate {\n type: 'partial'\n instruction: {\n type: 'ChunkListUpdate'\n merged: EcmascriptMergedUpdate[] | undefined\n }\n}\n\nexport type Update = IssuesUpdate | PartialUpdate\n\nexport interface HmrIdentifiers {\n identifiers: string[]\n}\n\n/** @see https://github.com/vercel/next.js/blob/415cd74b9a220b6f50da64da68c13043e9b02995/packages/next-swc/crates/napi/src/next_api/project.rs#L824-L833 */\nexport interface TurbopackStackFrame {\n isServer: boolean\n isInternal?: boolean\n file: string\n originalFile?: string\n /** 1-indexed, unlike source map tokens */\n line?: number\n /** 1-indexed, unlike source map tokens */\n column?: number\n methodName?: string\n}\n\nexport type UpdateMessage =\n | {\n updateType: 'start'\n }\n | {\n updateType: 'end'\n value: UpdateInfo\n }\n\nexport type CompilationEvent = {\n typeName: string\n message: string\n severity: string\n eventData: any\n}\n\nexport interface UpdateInfo {\n duration: number\n tasks: number\n}\n\nexport interface Project {\n update(options: Partial<ProjectOptions>): Promise<void>\n\n writeAllEntrypointsToDisk(\n appDirOnly: boolean\n ): Promise<TurbopackResult<RawEntrypoints>>\n\n entrypointsSubscribe(): AsyncIterableIterator<TurbopackResult<RawEntrypoints>>\n\n hmrEvents(identifier: string): AsyncIterableIterator<TurbopackResult<Update>>\n\n hmrIdentifiersSubscribe(): AsyncIterableIterator<\n TurbopackResult<HmrIdentifiers>\n >\n\n getSourceForAsset(filePath: string): Promise<string | null>\n\n getSourceMap(filePath: string): Promise<string | null>\n getSourceMapSync(filePath: string): string | null\n\n traceSource(\n stackFrame: TurbopackStackFrame,\n currentDirectoryFileUrl: string\n ): Promise<TurbopackStackFrame | null>\n\n updateInfoSubscribe(\n aggregationMs: number\n ): AsyncIterableIterator<TurbopackResult<UpdateMessage>>\n\n compilationEventsSubscribe(\n eventTypes?: string[]\n ): AsyncIterableIterator<TurbopackResult<CompilationEvent>>\n\n invalidatePersistentCache(): Promise<void>\n\n shutdown(): Promise<void>\n\n onExit(): Promise<void>\n}\n\nexport type Route =\n | {\n type: 'conflict'\n }\n | {\n type: 'app-page'\n pages: {\n originalName: string\n htmlEndpoint: Endpoint\n rscEndpoint: Endpoint\n }[]\n }\n | {\n type: 'app-route'\n originalName: string\n endpoint: Endpoint\n }\n | {\n type: 'page'\n htmlEndpoint: Endpoint\n dataEndpoint: Endpoint\n }\n | {\n type: 'page-api'\n endpoint: Endpoint\n }\n\nexport interface Endpoint {\n /** Write files for the endpoint to disk. */\n writeToDisk(): Promise<TurbopackResult<WrittenEndpoint>>\n\n /**\n * Listen to client-side changes to the endpoint.\n * After clientChanged() has been awaited it will listen to changes.\n * The async iterator will yield for each change.\n */\n clientChanged(): Promise<AsyncIterableIterator<TurbopackResult>>\n\n /**\n * Listen to server-side changes to the endpoint.\n * After serverChanged() has been awaited it will listen to changes.\n * The async iterator will yield for each change.\n */\n serverChanged(\n includeIssues: boolean\n ): Promise<AsyncIterableIterator<TurbopackResult>>\n}\n\ninterface EndpointConfig {\n dynamic?: 'auto' | 'force-dynamic' | 'error' | 'force-static'\n dynamicParams?: boolean\n revalidate?: 'never' | 'force-cache' | number\n fetchCache?:\n | 'auto'\n | 'default-cache'\n | 'only-cache'\n | 'force-cache'\n | 'default-no-store'\n | 'only-no-store'\n | 'force-no-store'\n runtime?: 'nodejs' | 'edge'\n preferredRegion?: string\n}\n\nexport type ServerPath = {\n path: string\n contentHash: string\n}\n\nexport type WrittenEndpoint =\n | {\n type: 'nodejs'\n /** The entry path for the endpoint. */\n entryPath: string\n /** All client paths that have been written for the endpoint. */\n clientPaths: string[]\n /** All server paths that have been written for the endpoint. */\n serverPaths: ServerPath[]\n config: EndpointConfig\n }\n | {\n type: 'edge'\n /** All client paths that have been written for the endpoint. */\n clientPaths: string[]\n /** All server paths that have been written for the endpoint. */\n serverPaths: ServerPath[]\n config: EndpointConfig\n }\n | {\n type: 'none'\n clientPaths: []\n serverPaths: []\n config: EndpointConfig\n }\n\nexport interface ProjectOptions {\n /**\n * An absolute root path (Unix or Windows path) from which all files must be nested under. Trying\n * to access a file outside this root will fail, so think of this as a chroot.\n * E.g. `/home/user/projects/my-repo`.\n */\n rootPath: string\n\n /**\n * A path which contains the app/pages directories, relative to `root_path`, always a Unix path.\n * E.g. `apps/my-app`\n */\n projectPath: string\n\n /**\n * A path where to emit the build outputs, relative to [`Project::project_path`], always a Unix\n * path. Corresponds to next.config.js's `distDir`.\n * E.g. `.next`\n */\n distDir: string\n\n /**\n * The next.config.js contents.\n */\n nextConfig: NextConfigComplete\n\n /**\n * Jsconfig, or tsconfig contents.\n *\n * Next.js implicitly requires to read it to support few options\n * https://nextjs.org/docs/architecture/nextjs-compiler#legacy-decorators\n * https://nextjs.org/docs/architecture/nextjs-compiler#importsource\n */\n jsConfig: {\n compilerOptions: object\n }\n\n /**\n * A map of environment variables to use when compiling code.\n */\n env: Record<string, string>\n\n defineEnv: DefineEnv\n\n /**\n * Whether to watch the filesystem for file changes.\n */\n watch: {\n enable: boolean\n pollIntervalMs?: number\n }\n\n /**\n * The mode in which Next.js is running.\n */\n dev: boolean\n\n /**\n * The server actions encryption key.\n */\n encryptionKey: string\n\n /**\n * The build id.\n */\n buildId: string\n\n /**\n * Options for draft mode.\n */\n previewProps: __ApiPreviewProps\n\n /**\n * The browserslist query to use for targeting browsers.\n */\n browserslistQuery: string\n\n /**\n * When the code is minified, this opts out of the default mangling of local\n * names for variables, functions etc., which can be useful for\n * debugging/profiling purposes.\n */\n noMangling: boolean\n\n /**\n * The version of Node.js that is available/currently running.\n */\n currentNodeJsVersion: string\n}\n\nexport interface DefineEnv {\n client: RustifiedOptionalEnv\n edge: RustifiedOptionalEnv\n nodejs: RustifiedOptionalEnv\n}\n\nexport type RustifiedEnv = { name: string; value: string }[]\nexport type RustifiedOptionalEnv = { name: string; value: string | undefined }[]\n\nexport interface GlobalEntrypoints {\n app: Endpoint | undefined\n document: Endpoint | undefined\n error: Endpoint | undefined\n middleware: Middleware | undefined\n instrumentation: Instrumentation | undefined\n}\n\nexport type PageRoute =\n | {\n type: 'page'\n htmlEndpoint: Endpoint\n dataEndpoint: Endpoint\n }\n | {\n type: 'page-api'\n endpoint: Endpoint\n }\n\nexport type AppRoute =\n | {\n type: 'app-page'\n htmlEndpoint: Endpoint\n rscEndpoint: Endpoint\n }\n | {\n type: 'app-route'\n endpoint: Endpoint\n }\n\n// pathname -> route\nexport type PageEntrypoints = Map<string, PageRoute>\n\n// originalName / page -> route\nexport type AppEntrypoints = Map<string, AppRoute>\n\nexport type Entrypoints = {\n global: GlobalEntrypoints\n page: PageEntrypoints\n app: AppEntrypoints\n}\n"],"names":[],"mappings":"AAieA,WAIC","ignoreList":[0]}
@@ -1600,7 +1600,7 @@ export default async function getBaseWebpackConfig(dir, { buildId, encryptionKey
1600
1600
  isClient && new CopyFilePlugin({
1601
1601
  // file path to build output of `@next/polyfill-nomodule`
1602
1602
  filePath: require.resolve('./polyfills/polyfill-nomodule'),
1603
- cacheKey: "15.4.2-canary.22",
1603
+ cacheKey: "15.4.2-canary.23",
1604
1604
  name: `static/chunks/polyfills${dev ? '' : '-[hash]'}.js`,
1605
1605
  minimize: false,
1606
1606
  info: {
@@ -1780,7 +1780,7 @@ export default async function getBaseWebpackConfig(dir, { buildId, encryptionKey
1780
1780
  // - Next.js location on disk (some loaders use absolute paths and some resolve options depend on absolute paths)
1781
1781
  // - Next.js version
1782
1782
  // - next.config.js keys that affect compilation
1783
- version: `${__dirname}|${"15.4.2-canary.22"}|${configVars}`,
1783
+ version: `${__dirname}|${"15.4.2-canary.23"}|${configVars}`,
1784
1784
  cacheDirectory: path.join(distDir, 'cache', 'webpack'),
1785
1785
  // For production builds, it's more efficient to compress all cache files together instead of compression each one individually.
1786
1786
  // So we disable compression here and allow the build runner to take care of compressing the cache as a whole.
@@ -4,7 +4,7 @@
4
4
  * - Polyfills
5
5
  * - next/script with `beforeInteractive` strategy
6
6
  */ import { setAttributesFromProps } from './set-attributes-from-props';
7
- const version = "15.4.2-canary.22";
7
+ const version = "15.4.2-canary.23";
8
8
  window.next = {
9
9
  version,
10
10
  appDir: true
@@ -26,7 +26,7 @@ import { SearchParamsContext, PathParamsContext } from '../shared/lib/hooks-clie
26
26
  import { onRecoverableError } from './react-client-callbacks/on-recoverable-error';
27
27
  import tracer from './tracing/tracer';
28
28
  import { isNextRouterError } from './components/is-next-router-error';
29
- export const version = "15.4.2-canary.22";
29
+ export const version = "15.4.2-canary.23";
30
30
  export let router;
31
31
  export const emitter = mitt();
32
32
  const looseToArray = (input)=>[].slice.call(input);
@@ -89,7 +89,7 @@ export async function createHotReloaderTurbopack(opts, serverFields, distDir, re
89
89
  }
90
90
  const hasRewrites = opts.fsChecker.rewrites.afterFiles.length > 0 || opts.fsChecker.rewrites.beforeFiles.length > 0 || opts.fsChecker.rewrites.fallback.length > 0;
91
91
  const hotReloaderSpan = trace('hot-reloader', undefined, {
92
- version: "15.4.2-canary.22"
92
+ version: "15.4.2-canary.23"
93
93
  });
94
94
  // Ensure the hotReloaderSpan is flushed immediately as it's the parentSpan for all processing
95
95
  // of the current `next dev` invocation.
@@ -186,7 +186,7 @@ export default class HotReloaderWebpack {
186
186
  this.previewProps = previewProps;
187
187
  this.rewrites = rewrites;
188
188
  this.hotReloaderSpan = trace('hot-reloader', undefined, {
189
- version: "15.4.2-canary.22"
189
+ version: "15.4.2-canary.23"
190
190
  });
191
191
  // Ensure the hotReloaderSpan is flushed immediately as it's the parentSpan for all processing
192
192
  // of the current `next dev` invocation.
@@ -12,7 +12,7 @@ export function logStartInfo({ networkUrl, appUrl, envInfo, experimentalFeatures
12
12
  } else {
13
13
  bundlerSuffix = '';
14
14
  }
15
- Log.bootstrap(`${bold(purple(`${Log.prefixes.ready} Next.js ${"15.4.2-canary.22"}`))}${bundlerSuffix}`);
15
+ Log.bootstrap(`${bold(purple(`${Log.prefixes.ready} Next.js ${"15.4.2-canary.23"}`))}${bundlerSuffix}`);
16
16
  if (appUrl) {
17
17
  Log.bootstrap(`- Local: ${appUrl}`);
18
18
  }