next 15.5.1-canary.26 → 15.5.1-canary.27

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 (89) hide show
  1. package/dist/bin/next +3 -3
  2. package/dist/build/index.js +4 -3
  3. package/dist/build/index.js.map +1 -1
  4. package/dist/build/load-jsconfig.js +4 -3
  5. package/dist/build/load-jsconfig.js.map +1 -1
  6. package/dist/build/swc/generated-native.d.ts +0 -4
  7. package/dist/build/swc/index.js +1 -3
  8. package/dist/build/swc/index.js.map +1 -1
  9. package/dist/build/swc/types.d.ts +0 -10
  10. package/dist/build/turbopack-build/impl.js +0 -1
  11. package/dist/build/turbopack-build/impl.js.map +1 -1
  12. package/dist/build/type-check.js.map +1 -1
  13. package/dist/build/webpack/loaders/next-app-loader/index.js.map +1 -1
  14. package/dist/build/webpack-config.js +2 -2
  15. package/dist/client/app-bootstrap.js +1 -1
  16. package/dist/client/index.js +1 -1
  17. package/dist/compiled/next-server/pages-api-turbo.runtime.dev.js +1 -1
  18. package/dist/compiled/next-server/pages-api-turbo.runtime.dev.js.map +1 -1
  19. package/dist/compiled/next-server/pages-api.runtime.dev.js +1 -1
  20. package/dist/compiled/next-server/pages-api.runtime.dev.js.map +1 -1
  21. package/dist/compiled/next-server/pages-api.runtime.prod.js +1 -1
  22. package/dist/compiled/next-server/pages-api.runtime.prod.js.map +1 -1
  23. package/dist/compiled/next-server/pages-turbo.runtime.dev.js +1 -1
  24. package/dist/compiled/next-server/pages-turbo.runtime.dev.js.map +1 -1
  25. package/dist/compiled/next-server/pages.runtime.dev.js +1 -1
  26. package/dist/compiled/next-server/pages.runtime.dev.js.map +1 -1
  27. package/dist/compiled/next-server/pages.runtime.prod.js +1 -1
  28. package/dist/compiled/next-server/pages.runtime.prod.js.map +1 -1
  29. package/dist/compiled/next-server/server.runtime.prod.js.map +1 -1
  30. package/dist/esm/build/index.js +4 -3
  31. package/dist/esm/build/index.js.map +1 -1
  32. package/dist/esm/build/load-jsconfig.js +4 -3
  33. package/dist/esm/build/load-jsconfig.js.map +1 -1
  34. package/dist/esm/build/swc/generated-native.d.ts +0 -4
  35. package/dist/esm/build/swc/index.js +1 -3
  36. package/dist/esm/build/swc/index.js.map +1 -1
  37. package/dist/esm/build/swc/types.js.map +1 -1
  38. package/dist/esm/build/turbopack-build/impl.js +1 -2
  39. package/dist/esm/build/turbopack-build/impl.js.map +1 -1
  40. package/dist/esm/build/type-check.js.map +1 -1
  41. package/dist/esm/build/webpack/loaders/next-app-loader/index.js.map +1 -1
  42. package/dist/esm/build/webpack-config.js +2 -2
  43. package/dist/esm/client/app-bootstrap.js +1 -1
  44. package/dist/esm/client/index.js +1 -1
  45. package/dist/esm/lib/find-pages-dir.js +11 -0
  46. package/dist/esm/lib/find-pages-dir.js.map +1 -1
  47. package/dist/esm/lib/verify-root-layout.js +2 -1
  48. package/dist/esm/lib/verify-root-layout.js.map +1 -1
  49. package/dist/esm/lib/verify-typescript-setup.js +3 -2
  50. package/dist/esm/lib/verify-typescript-setup.js.map +1 -1
  51. package/dist/esm/server/config-shared.js +1 -1
  52. package/dist/esm/server/config-shared.js.map +1 -1
  53. package/dist/esm/server/dev/hot-reloader-turbopack.js +2 -3
  54. package/dist/esm/server/dev/hot-reloader-turbopack.js.map +1 -1
  55. package/dist/esm/server/dev/hot-reloader-webpack.js +1 -1
  56. package/dist/esm/server/lib/app-info-log.js +11 -9
  57. package/dist/esm/server/lib/app-info-log.js.map +1 -1
  58. package/dist/esm/server/lib/start-server.js +3 -2
  59. package/dist/esm/server/lib/start-server.js.map +1 -1
  60. package/dist/esm/shared/lib/canary-only.js +1 -1
  61. package/dist/esm/shared/lib/turbopack/utils.js +0 -7
  62. package/dist/esm/shared/lib/turbopack/utils.js.map +1 -1
  63. package/dist/lib/find-pages-dir.js +11 -0
  64. package/dist/lib/find-pages-dir.js.map +1 -1
  65. package/dist/lib/verify-root-layout.d.ts +1 -1
  66. package/dist/lib/verify-root-layout.js +2 -1
  67. package/dist/lib/verify-root-layout.js.map +1 -1
  68. package/dist/lib/verify-typescript-setup.d.ts +1 -1
  69. package/dist/lib/verify-typescript-setup.js +3 -2
  70. package/dist/lib/verify-typescript-setup.js.map +1 -1
  71. package/dist/server/config-shared.d.ts +2 -2
  72. package/dist/server/config-shared.js +1 -1
  73. package/dist/server/config-shared.js.map +1 -1
  74. package/dist/server/dev/hot-reloader-turbopack.js +1 -2
  75. package/dist/server/dev/hot-reloader-turbopack.js.map +1 -1
  76. package/dist/server/dev/hot-reloader-webpack.js +1 -1
  77. package/dist/server/lib/app-info-log.d.ts +2 -1
  78. package/dist/server/lib/app-info-log.js +11 -9
  79. package/dist/server/lib/app-info-log.js.map +1 -1
  80. package/dist/server/lib/start-server.js +3 -2
  81. package/dist/server/lib/start-server.js.map +1 -1
  82. package/dist/shared/lib/canary-only.js +1 -1
  83. package/dist/shared/lib/turbopack/utils.d.ts +0 -3
  84. package/dist/shared/lib/turbopack/utils.js +0 -11
  85. package/dist/shared/lib/turbopack/utils.js.map +1 -1
  86. package/dist/telemetry/anonymous-meta.js +1 -1
  87. package/dist/telemetry/events/session-stopped.js +2 -2
  88. package/dist/telemetry/events/version.js +2 -2
  89. package/package.json +16 -16
@@ -114,15 +114,16 @@ async function loadJsConfig(dir, config) {
114
114
  ]);
115
115
  typeScriptPath = deps.resolved.get('typescript');
116
116
  } catch {}
117
- const tsConfigPath = _path.default.join(dir, config.typescript.tsconfigPath);
117
+ const tsConfigFileName = config.typescript.tsconfigPath || 'tsconfig.json';
118
+ const tsConfigPath = _path.default.join(dir, tsConfigFileName);
118
119
  const useTypeScript = Boolean(typeScriptPath && _fs.default.existsSync(tsConfigPath));
119
120
  let implicitBaseurl;
120
121
  let jsConfig;
121
122
  // jsconfig is a subset of tsconfig
122
123
  if (useTypeScript) {
123
- if (config.typescript.tsconfigPath !== 'tsconfig.json' && TSCONFIG_WARNED === false) {
124
+ if (tsConfigFileName !== 'tsconfig.json' && TSCONFIG_WARNED === false) {
124
125
  TSCONFIG_WARNED = true;
125
- _log.info(`Using tsconfig file: ${config.typescript.tsconfigPath}`);
126
+ _log.info(`Using tsconfig file: ${tsConfigFileName}`);
126
127
  }
127
128
  const ts = await Promise.resolve(require(typeScriptPath));
128
129
  const tsConfig = await (0, _getTypeScriptConfiguration.getTypeScriptConfiguration)(ts, tsConfigPath, true);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/build/load-jsconfig.ts"],"sourcesContent":["import path from 'path'\nimport fs from 'fs'\nimport type { NextConfigComplete } from '../server/config-shared'\nimport * as Log from './output/log'\nimport { getTypeScriptConfiguration } from '../lib/typescript/getTypeScriptConfiguration'\nimport { readFileSync } from 'fs'\nimport isError from '../lib/is-error'\nimport { hasNecessaryDependencies } from '../lib/has-necessary-dependencies'\n\nlet TSCONFIG_WARNED = false\n\nexport function parseJsonFile(filePath: string) {\n const JSON5 =\n require('next/dist/compiled/json5') as typeof import('next/dist/compiled/json5')\n const contents = readFileSync(filePath, 'utf8')\n\n // Special case an empty file\n if (contents.trim() === '') {\n return {}\n }\n\n try {\n return JSON5.parse(contents)\n } catch (err) {\n if (!isError(err)) throw err\n const { codeFrameColumns } =\n require('next/dist/compiled/babel/code-frame') as typeof import('next/dist/compiled/babel/code-frame')\n const codeFrame = codeFrameColumns(\n String(contents),\n {\n start: {\n line: (err as Error & { lineNumber?: number }).lineNumber || 0,\n column: (err as Error & { columnNumber?: number }).columnNumber || 0,\n },\n },\n { message: err.message, highlightCode: true }\n )\n throw new Error(`Failed to parse \"${filePath}\":\\n${codeFrame}`)\n }\n}\n\nexport type ResolvedBaseUrl =\n | { baseUrl: string; isImplicit: boolean }\n | undefined\n\nexport type JsConfig = { compilerOptions: Record<string, any> } | undefined\n\nexport default async function loadJsConfig(\n dir: string,\n config: NextConfigComplete\n): Promise<{\n useTypeScript: boolean\n jsConfig: JsConfig\n jsConfigPath?: string\n resolvedBaseUrl: ResolvedBaseUrl\n}> {\n let typeScriptPath: string | undefined\n try {\n const deps = await hasNecessaryDependencies(dir, [\n {\n pkg: 'typescript',\n file: 'typescript/lib/typescript.js',\n exportsRestrict: true,\n },\n ])\n typeScriptPath = deps.resolved.get('typescript')\n } catch {}\n const tsConfigPath = path.join(dir, config.typescript.tsconfigPath)\n const useTypeScript = Boolean(typeScriptPath && fs.existsSync(tsConfigPath))\n\n let implicitBaseurl\n let jsConfig: { compilerOptions: Record<string, any> } | undefined\n // jsconfig is a subset of tsconfig\n if (useTypeScript) {\n if (\n config.typescript.tsconfigPath !== 'tsconfig.json' &&\n TSCONFIG_WARNED === false\n ) {\n TSCONFIG_WARNED = true\n Log.info(`Using tsconfig file: ${config.typescript.tsconfigPath}`)\n }\n\n const ts = (await Promise.resolve(\n require(typeScriptPath!)\n )) as typeof import('typescript')\n const tsConfig = await getTypeScriptConfiguration(ts, tsConfigPath, true)\n jsConfig = { compilerOptions: tsConfig.options }\n implicitBaseurl = path.dirname(tsConfigPath)\n }\n\n const jsConfigPath = path.join(dir, 'jsconfig.json')\n if (!useTypeScript && fs.existsSync(jsConfigPath)) {\n jsConfig = parseJsonFile(jsConfigPath)\n implicitBaseurl = path.dirname(jsConfigPath)\n }\n\n let resolvedBaseUrl: ResolvedBaseUrl\n if (jsConfig?.compilerOptions?.baseUrl) {\n resolvedBaseUrl = {\n baseUrl: path.resolve(dir, jsConfig.compilerOptions.baseUrl),\n isImplicit: false,\n }\n } else {\n if (implicitBaseurl) {\n resolvedBaseUrl = {\n baseUrl: implicitBaseurl,\n isImplicit: true,\n }\n }\n }\n\n return {\n useTypeScript,\n jsConfig,\n resolvedBaseUrl,\n jsConfigPath: useTypeScript\n ? tsConfigPath\n : fs.existsSync(jsConfigPath)\n ? jsConfigPath\n : undefined,\n }\n}\n"],"names":["loadJsConfig","parseJsonFile","TSCONFIG_WARNED","filePath","JSON5","require","contents","readFileSync","trim","parse","err","isError","codeFrameColumns","codeFrame","String","start","line","lineNumber","column","columnNumber","message","highlightCode","Error","dir","config","jsConfig","typeScriptPath","deps","hasNecessaryDependencies","pkg","file","exportsRestrict","resolved","get","tsConfigPath","path","join","typescript","tsconfigPath","useTypeScript","Boolean","fs","existsSync","implicitBaseurl","Log","info","ts","Promise","resolve","tsConfig","getTypeScriptConfiguration","compilerOptions","options","dirname","jsConfigPath","resolvedBaseUrl","baseUrl","isImplicit","undefined"],"mappings":";;;;;;;;;;;;;;;IA+CA,OA0EC;eA1E6BA;;IApCdC,aAAa;eAAbA;;;6DAXC;4DACF;6DAEM;4CACsB;gEAEvB;0CACqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEzC,IAAIC,kBAAkB;AAEf,SAASD,cAAcE,QAAgB;IAC5C,MAAMC,QACJC,QAAQ;IACV,MAAMC,WAAWC,IAAAA,gBAAY,EAACJ,UAAU;IAExC,6BAA6B;IAC7B,IAAIG,SAASE,IAAI,OAAO,IAAI;QAC1B,OAAO,CAAC;IACV;IAEA,IAAI;QACF,OAAOJ,MAAMK,KAAK,CAACH;IACrB,EAAE,OAAOI,KAAK;QACZ,IAAI,CAACC,IAAAA,gBAAO,EAACD,MAAM,MAAMA;QACzB,MAAM,EAAEE,gBAAgB,EAAE,GACxBP,QAAQ;QACV,MAAMQ,YAAYD,iBAChBE,OAAOR,WACP;YACES,OAAO;gBACLC,MAAM,AAACN,IAAwCO,UAAU,IAAI;gBAC7DC,QAAQ,AAACR,IAA0CS,YAAY,IAAI;YACrE;QACF,GACA;YAAEC,SAASV,IAAIU,OAAO;YAAEC,eAAe;QAAK;QAE9C,MAAM,qBAAyD,CAAzD,IAAIC,MAAM,CAAC,iBAAiB,EAAEnB,SAAS,IAAI,EAAEU,WAAW,GAAxD,qBAAA;mBAAA;wBAAA;0BAAA;QAAwD;IAChE;AACF;AAQe,eAAeb,aAC5BuB,GAAW,EACXC,MAA0B;QAgDtBC;IAzCJ,IAAIC;IACJ,IAAI;QACF,MAAMC,OAAO,MAAMC,IAAAA,kDAAwB,EAACL,KAAK;YAC/C;gBACEM,KAAK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eACAO,WAAE,CAACC,UAAU,CAACY,gBACZA,eACAI;IACR;AACF","ignoreList":[0]}
1
+ {"version":3,"sources":["../../src/build/load-jsconfig.ts"],"sourcesContent":["import path from 'path'\nimport fs from 'fs'\nimport type { NextConfigComplete } from '../server/config-shared'\nimport * as Log from './output/log'\nimport { getTypeScriptConfiguration } from '../lib/typescript/getTypeScriptConfiguration'\nimport { readFileSync } from 'fs'\nimport isError from '../lib/is-error'\nimport { hasNecessaryDependencies } from '../lib/has-necessary-dependencies'\n\nlet TSCONFIG_WARNED = false\n\nexport function parseJsonFile(filePath: string) {\n const JSON5 =\n require('next/dist/compiled/json5') as typeof import('next/dist/compiled/json5')\n const contents = readFileSync(filePath, 'utf8')\n\n // Special case an empty file\n if (contents.trim() === '') {\n return {}\n }\n\n try {\n return JSON5.parse(contents)\n } catch (err) {\n if (!isError(err)) throw err\n const { codeFrameColumns } =\n require('next/dist/compiled/babel/code-frame') as typeof import('next/dist/compiled/babel/code-frame')\n const codeFrame = codeFrameColumns(\n String(contents),\n {\n start: {\n line: (err as Error & { lineNumber?: number }).lineNumber || 0,\n column: (err as Error & { columnNumber?: number }).columnNumber || 0,\n },\n },\n { message: err.message, highlightCode: true }\n )\n throw new Error(`Failed to parse \"${filePath}\":\\n${codeFrame}`)\n }\n}\n\nexport type ResolvedBaseUrl =\n | { baseUrl: string; isImplicit: boolean }\n | undefined\n\nexport type JsConfig = { compilerOptions: Record<string, any> } | undefined\n\nexport default async function loadJsConfig(\n dir: string,\n config: NextConfigComplete\n): Promise<{\n useTypeScript: boolean\n jsConfig: JsConfig\n jsConfigPath?: string\n resolvedBaseUrl: ResolvedBaseUrl\n}> {\n let typeScriptPath: string | undefined\n try {\n const deps = await hasNecessaryDependencies(dir, [\n {\n pkg: 'typescript',\n file: 'typescript/lib/typescript.js',\n exportsRestrict: true,\n },\n ])\n typeScriptPath = deps.resolved.get('typescript')\n } catch {}\n const tsConfigFileName = config.typescript.tsconfigPath || 'tsconfig.json'\n const tsConfigPath = path.join(dir, tsConfigFileName)\n const useTypeScript = Boolean(typeScriptPath && fs.existsSync(tsConfigPath))\n\n let implicitBaseurl\n let jsConfig: { compilerOptions: Record<string, any> } | undefined\n // jsconfig is a subset of tsconfig\n if (useTypeScript) {\n if (tsConfigFileName !== 'tsconfig.json' && TSCONFIG_WARNED === false) {\n TSCONFIG_WARNED = true\n Log.info(`Using tsconfig file: ${tsConfigFileName}`)\n }\n\n const ts = (await Promise.resolve(\n require(typeScriptPath!)\n )) as typeof import('typescript')\n const tsConfig = await getTypeScriptConfiguration(ts, tsConfigPath, true)\n jsConfig = { compilerOptions: tsConfig.options }\n implicitBaseurl = path.dirname(tsConfigPath)\n }\n\n const jsConfigPath = path.join(dir, 'jsconfig.json')\n if (!useTypeScript && fs.existsSync(jsConfigPath)) {\n jsConfig = parseJsonFile(jsConfigPath)\n implicitBaseurl = path.dirname(jsConfigPath)\n }\n\n let resolvedBaseUrl: ResolvedBaseUrl\n if (jsConfig?.compilerOptions?.baseUrl) {\n resolvedBaseUrl = {\n baseUrl: path.resolve(dir, jsConfig.compilerOptions.baseUrl),\n isImplicit: false,\n }\n } else {\n if (implicitBaseurl) {\n resolvedBaseUrl = {\n baseUrl: implicitBaseurl,\n isImplicit: true,\n }\n }\n }\n\n return {\n useTypeScript,\n jsConfig,\n resolvedBaseUrl,\n jsConfigPath: useTypeScript\n ? tsConfigPath\n : fs.existsSync(jsConfigPath)\n ? jsConfigPath\n : undefined,\n }\n}\n"],"names":["loadJsConfig","parseJsonFile","TSCONFIG_WARNED","filePath","JSON5","require","contents","readFileSync","trim","parse","err","isError","codeFrameColumns","codeFrame","String","start","line","lineNumber","column","columnNumber","message","highlightCode","Error","dir","config","jsConfig","typeScriptPath","deps","hasNecessaryDependencies","pkg","file","exportsRestrict","resolved","get","tsConfigFileName","typescript","tsconfigPath","tsConfigPath","path","join","useTypeScript","Boolean","fs","existsSync","implicitBaseurl","Log","info","ts","Promise","resolve","tsConfig","getTypeScriptConfiguration","comp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,UAAU,CAACC,YAAY,IAAI;IAC3D,MAAMC,eAAeC,aAAI,CAACC,IAAI,CAAChB,KAAKW;IACpC,MAAMM,gBAAgBC,QAAQf,kBAAkBgB,WAAE,CAACC,UAAU,CAACN;IAE9D,IAAIO;IACJ,IAAInB;IACJ,mCAAmC;IACnC,IAAIe,eAAe;QACjB,IAAIN,qBAAqB,mBAAmBhC,oBAAoB,OAAO;YACrEA,kBAAkB;YAClB2C,KAAIC,IAAI,CAAC,CAAC,qBAAqB,EAAEZ,kBAAkB;QACrD;QAEA,MAAMa,KAAM,MAAMC,QAAQC,OAAO,CAC/B5C,QAAQqB;QAEV,MAAMwB,WAAW,MAAMC,IAAAA,sDAA0B,EAACJ,IAAIV,cAAc;QACpEZ,WAAW;YAAE2B,iBAAiBF,SAASG,OAAO;QAAC;QAC/CT,kBAAkBN,aAAI,CAACgB,OAAO,CAACjB;IACjC;IAEA,MAAMkB,eAAejB,aAAI,CAACC,IAAI,CAAChB,KAAK;IACpC,IAAI,CAACiB,iBAAiBE,WAAE,CAACC,UAAU,CAACY,eAAe;QACjD9B,WAAWxB,cAAcsD;QACzBX,kBAAkBN,aAAI,CAACgB,OAAO,CAACC;IACjC;IAEA,IAAIC;IACJ,IAAI/B,6BAAAA,4BAAAA,SAAU2B,eAAe,qBAAzB3B,0BAA2BgC,OAAO,EAAE;QACtCD,kBAAkB;YAChBC,SAASnB,aAAI,CAACW,OAAO,CAAC1B,KAAKE,SAAS2B,eAAe,CAACK,OAAO;YAC3DC,YAAY;QACd;IACF,OAAO;QACL,IAAId,iBAAiB;YACnBY,kBAAkB;gBAChBC,SAASb;gBACTc,YAAY;YACd;QACF;IACF;IAEA,OAAO;QACLlB;QACAf;QACA+B;QACAD,cAAcf,gBACVH,eACAK,WAAE,CAACC,UAAU,CAACY,gBACZA,eACAI;IACR;AACF","ignoreList":[0]}
@@ -120,8 +120,6 @@ export interface NapiProjectOptions {
120
120
  watch: NapiWatchOptions
121
121
  /** The contents of next.config.js, serialized to JSON. */
122
122
  nextConfig: RcStr
123
- /** The contents of ts/config read by load-jsconfig, serialized to JSON. */
124
- jsConfig: RcStr
125
123
  /** A map of environment variables to use when compiling code. */
126
124
  env: Array<NapiEnvVar>
127
125
  /**
@@ -172,8 +170,6 @@ export interface NapiPartialProjectOptions {
172
170
  watch?: NapiWatchOptions
173
171
  /** The contents of next.config.js, serialized to JSON. */
174
172
  nextConfig?: RcStr
175
- /** The contents of ts/config read by load-jsconfig, serialized to JSON. */
176
- jsConfig?: RcStr
177
173
  /** A map of environment variables to use when compiling code. */
178
174
  env?: Array<NapiEnvVar>
179
175
  /**
@@ -131,7 +131,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
131
131
  }
132
132
  return newObj;
133
133
  }
134
- const nextVersion = "15.5.1-canary.26";
134
+ const nextVersion = "15.5.1-canary.27";
135
135
  const ArchName = (0, _os.arch)();
136
136
  const PlatformName = (0, _os.platform)();
137
137
  function infoLog(...args) {
@@ -514,7 +514,6 @@ function bindingToApi(binding, _wasm) {
514
514
  return {
515
515
  ...options,
516
516
  nextConfig: await serializeNextConfig(options.nextConfig, _path.default.join(options.rootPath, options.projectPath)),
517
- jsConfig: JSON.stringify(options.jsConfig),
518
517
  env: rustifyEnv(options.env)
519
518
  };
520
519
  }
@@ -522,7 +521,6 @@ function bindingToApi(binding, _wasm) {
522
521
  return {
523
522
  ...options,
524
523
  nextConfig: options.nextConfig && await serializeNextConfig(options.nextConfig, _path.default.join(options.rootPath, options.projectPath)),
525
- jsConfig: options.jsConfig && JSON.stringify(options.jsConfig),
526
524
  env: options.env && rustifyEnv(options.env)
527
525
  };
528
526
  }
@@ -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 ReactCompilerOptions,\n TurbopackLoaderBuiltinCondition,\n TurbopackLoaderItem,\n TurbopackRuleCondition,\n TurbopackRuleConfigCollection,\n TurbopackRuleConfigItem,\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 }\n\n const reactCompilerOptions = nextConfig.experimental?.reactCompiler\n\n // TODO: Merge this with `crates/next-core/src/next_shared/webpack_rules/babel.rs` so that we're\n // not configuring babel in two different places (potentially causing it to run twice)\n if (reactCompilerOptions) {\n const options: ReactCompilerOptions =\n typeof reactCompilerOptions === 'object' ? reactCompilerOptions : {}\n nextConfig.turbopack = {\n ...originalNextConfig.turbopack,\n rules: {\n ...originalNextConfig.turbopack.rules,\n // assumption: there is no collision with this glob key\n '{*.{js,jsx,ts,tsx,cjs,mjs,mts,cts},react-compiler-builtin-rule}': {\n loaders: [\n getReactCompilerLoader(\n reactCompilerOptions,\n projectPath,\n nextConfig.dev,\n /* isServer */ false,\n /* reactCompilerExclude */ undefined\n ),\n ],\n condition: {\n all: [\n 'browser',\n { not: 'foreign' },\n {\n content:\n options.compilationMode === 'annotation'\n ? /['\"]use memo['\"]/\n : !options.compilationMode ||\n options.compilationMode === 'infer'\n ? // Matches declaration or useXXX or </ (closing jsx) or /> (self closing jsx)\n /['\"]use memo['\"]|\\Wuse[A-Z]|<\\/|\\/>/\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. NOTE: This does a shallow clone.\n let nextConfigSerializable = augmentNextConfig(nextConfig, projectPath)\n\n nextConfigSerializable.generateBuildId =\n await nextConfigSerializable.generateBuildId?.()\n\n // TODO: these functions takes arguments, have to be supported in a different way\n nextConfigSerializable.exportPathMap = {}\n nextConfigSerializable.webpack = nextConfigSerializable.webpack && {}\n\n if (nextConfigSerializable.modularizeImports) {\n nextConfigSerializable.modularizeImports = 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),\n },\n ]\n )\n )\n }\n\n // loaderFile is an absolute path, we need it to be relative for turbopack.\n if (nextConfigSerializable.images.loaderFile) {\n nextConfigSerializable.images = {\n ...nextConfigSerializable.images,\n loaderFile:\n './' +\n path.relative(projectPath, nextConfigSerializable.images.loaderFile),\n }\n }\n\n // cacheHandler can be an absolute path, we need it to be relative for turbopack.\n if (nextConfigSerializable.cacheHandler) {\n nextConfigSerializable.cacheHandler =\n './' +\n (path.isAbsolute(nextConfigSerializable.cacheHandler)\n ? path.relative(projectPath, nextConfigSerializable.cacheHandler)\n : nextConfigSerializable.cacheHandler)\n }\n if (nextConfigSerializable.experimental?.cacheHandlers) {\n nextConfigSerializable.experimental = {\n ...nextConfigSerializable.experimental,\n cacheHandlers: Object.fromEntries(\n Object.entries(\n nextConfigSerializable.experimental.cacheHandlers as Record<\n string,\n string\n >\n )\n .filter(([_, value]) => value != null)\n .map(([key, value]) => [\n key,\n './' +\n (path.isAbsolute(value)\n ? path.relative(projectPath, value)\n : value),\n ])\n ),\n }\n }\n\n if (nextConfigSerializable.turbopack != null) {\n // clone to allow in-place mutations\n const turbopack = { ...nextConfigSerializable.turbopack }\n\n if (turbopack.rules) {\n turbopack.rules = serializeTurbopackRules(turbopack.rules)\n }\n\n nextConfigSerializable.turbopack = turbopack\n }\n\n return JSON.stringify(nextConfigSerializable, null, 2)\n }\n\n type SerializedRuleCondition =\n | { all: SerializedRuleCondition[] }\n | { any: SerializedRuleCondition[] }\n | { not: SerializedRuleCondition }\n | TurbopackLoaderBuiltinCondition\n | {\n path?:\n | { type: 'regex'; value: { source: string; flags: string } }\n | { type: 'glob'; value: string }\n content?: { source: string; flags: string }\n }\n\n // converts regexes to a `RegexComponents` object so that it can be JSON-serialized when passed to\n // Turbopack\n function serializeRuleCondition(\n cond: TurbopackRuleCondition\n ): SerializedRuleCondition {\n function regexComponents(regex: RegExp) {\n return {\n source: regex.source,\n flags: regex.flags,\n }\n }\n\n if (typeof cond === 'string') {\n return cond\n } else if ('all' in cond) {\n return { ...cond, all: cond.all.map(serializeRuleCondition) }\n } else if ('any' in cond) {\n return { ...cond, any: cond.any.map(serializeRuleCondition) }\n } else if ('not' in cond) {\n return { ...cond, not: serializeRuleCondition(cond.not) }\n } else {\n return {\n ...cond,\n path:\n cond.path == null\n ? undefined\n : cond.path instanceof RegExp\n ? {\n type: 'regex',\n value: regexComponents(cond.path),\n }\n : { type: 'glob', value: cond.path },\n content: cond.content && regexComponents(cond.content),\n }\n }\n }\n\n // Note: Returns an updated `turbopackRules` with serialized conditions. Does not mutate in-place.\n function serializeTurbopackRules(\n turbopackRules: Record<string, TurbopackRuleConfigCollection>\n ): Record<string, any> {\n const serializedRules: Record<string, any> = {}\n for (const [glob, rule] of Object.entries(turbopackRules)) {\n if (Array.isArray(rule)) {\n serializedRules[glob] = rule.map((item) => {\n if (typeof item !== 'string' && 'loaders' in item) {\n return serializeConfigItem(item, glob)\n } else {\n checkLoaderItem(item, glob)\n return item\n }\n })\n } else {\n serializedRules[glob] = serializeConfigItem(rule, glob)\n }\n }\n\n return serializedRules\n\n function serializeConfigItem(\n rule: TurbopackRuleConfigItem,\n glob: string\n ): any {\n if (!rule) return rule\n for (const item of rule.loaders) {\n checkLoaderItem(item, glob)\n }\n let serializedRule: any = rule\n if (rule.condition != null) {\n serializedRule = {\n ...rule,\n condition: serializeRuleCondition(rule.condition),\n }\n }\n return serializedRule\n }\n\n function checkLoaderItem(loaderItem: TurbopackLoaderItem, glob: string) {\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. ` +\n 'Ensure that options passed are plain JavaScript objects and values.'\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 expandNextJsTemplate(\n content: Buffer,\n templatePath: string,\n nextPackageDirPath: string,\n replacements: Record<`VAR_${string}`, string>,\n injections: Record<string, string>,\n imports: Record<string, string | null>\n ): string {\n return rawBindings.expandNextJsTemplate(\n content,\n templatePath,\n nextPackageDirPath,\n replacements,\n injections,\n imports\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 expandNextJsTemplate(\n content: Buffer,\n templatePath: string,\n nextPackageDirPath: string,\n replacements: Record<`VAR_${string}`, string>,\n injections: Record<string, string>,\n imports: Record<string, string | null>\n ): string {\n return bindings.expandNextJsTemplate(\n content,\n templatePath,\n nextPackageDirPath,\n replacements,\n injections,\n imports\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":["createDefineEnv","getBinaryMetadata","getModuleNamedExports","getSupportedArchTriples","initCustomTraceSubscriber","isReactCompilerRequired","isWasm","loadBindings","lockfilePatchPromise","minify","parse","teardownTraceSubscriber","transform","transformSync","warnForEdgeRuntime","nextVersion","process","env","__NEXT_VERSION","ArchName","arch","PlatformName","platform","infoLog","args","NEXT_PRIVATE_BUILD_WORKER","DEBUG","Log","info","darwin","win32","linux","freebsd","android","platformArchTriples","arm64","ia32","filter","triple","abi","x64","arm","triples","supportedArchTriples","targetTriple","rawTargetTriple","warn","__INTERNAL_CUSTOM_TURBOPACK_BINDINGS","checkVersionMismatch","pkgData","version","knownDefaultWasmFallbackTriples","lastNativeBindingsLoadErrorCode","undefined","pendingBindings","nativeBindings","wasmBindings","downloadWasmPromise","swcTraceFlushGuard","downloadNativeBindingsPromise","useWasmBinary","RUST_MIN_STACK","NEXT_TEST_WASM","stdout","_handle","setBlocking","stderr","Promise","resolve","_reject","cur","patchIncorrectLockfile","cwd","catch","console","error","attempts","disableWasmFallback","NEXT_DISABLE_SWC_WASM","unsupportedPlatform","some","raw","includes","isWebContainer","versions","webcontainer","shouldLoadWasmFallbackFirst","fallbackBindings","tryLoadWasmWithFallback","loadNative","a","Array","isArray","every","m","tryLoadNativeWithFallback","concat","logLoadFailure","nativeBindingsDirectory","path","join","dirname","require","downloadNativeNextSwc","map","platformArchABI","push","bindings","loadWasm","eventSwcLoadFailure","wasm","nativeBindingsErrorCode","wasmDirectory","downloadWasmSwc","attempt","loadBindingsSync","Error","cause","loggingLoadFailure","triedWasm","then","finally","exit","isTurbopack","clientRouterFilters","config","dev","distDir","projectPath","fetchCacheKeyPrefix","hasRewrites","middlewareMatchers","rewrites","defineEnv","client","edge","nodejs","variant","Object","keys","rustifyOptionEnv","getDefineEnv","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","turbopack","rules","loaders","getReactCompilerLoader","condition","all","not","content","compilationMode","nextConfigSerializable","generateBuildId","exportPathMap","webpack","modularizeImports","fromEntries","mod","images","loaderFile","relative","cacheHandler","isAbsolute","cacheHandlers","key","serializeTurbopackRules","serializeRuleCondition","cond","regexComponents","regex","source","flags","any","RegExp","type","turbopackRules","serializedRules","glob","rule","serializeConfigItem","checkLoaderItem","serializedRule","loaderItem","isDeepStrictEqual","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","throwTurbopackInternalError","loadWasmRawBindings","importPath","testWasmDir","NEXT_TEST_WASM_DIR","rawBindings","pathToFileURL","toString","pkg","pkgPath","importedRawBindings","default","code","message","removeUndefined","obj","newObj","k","v","css","lightning","_options","transformStyleAttr","src","minifySync","getTargetTriple","turbo","_turboEngineOptions","startTurbopackTraceServer","_traceFilePath","mdx","compile","mdxCompile","getMdxOptions","compileSync","mdxCompileSync","_filename","rspack","_resourcePath","_source","_isProduction","expandNextJsTemplate","templatePath","nextPackageDirPath","replacements","injections","imports","customBindings","NEXT_TEST_NATIVE_DIR","isModule","Buffer","isBuffer","jsc","parser","syntax","toBuffer","from","traceFilePath","transformOptions","lightningCssTransform","transformAttrOptions","lightningCssTransformStyleAttribute","filename","resourcePath","isProduction","development","jsx","mdxType","t","parserOptions","getParserOptions","astStr","target","traceFileName","once","fn","executed"],"mappings":"AAAA,0DAA0D;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAqZ1CA,eAAe;eAAfA;;IA2pCAC,iBAAiB;eAAjBA;;IAyDMC,qBAAqB;eAArBA;;IAriDNC,uBAAuB;eAAvBA;;IA6/CAC,yBAAyB;eAAzBA;;IAhCMC,uBAAuB;eAAvBA;;IAvBAC,MAAM;eAANA;;IAj1CAC,YAAY;eAAZA;;IAVTC,oBAAoB;eAApBA;;IA02CSC,MAAM;eAANA;;IAeAC,KAAK;eAALA;;IAsDTC,uBAAuB;eAAvBA;;IA/ESC,SAAS;eAATA;;IAKNC,aAAa;eAAbA;;IA4FMC,kBAAkB;eAAlBA;;;6DA/mDL;qBACa;oBACC;yBACK;6DACf;yBACY;gCACG;wCACG;6BACgB;sBAUrB;2BACkB;sCACb;+BAuBK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAO5C,MAAMC,cAAcC,QAAQC,GAAG,CAACC,cAAc;AAE9C,MAAM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AAMtR,WAAW,MAAMpG;IACvB,OAAOoG,SAAS2P,MAAM,CAACxV,kBAAkB,CAACsQ,QAAQ6G;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 ReactCompilerOptions,\n TurbopackLoaderBuiltinCondition,\n TurbopackLoaderItem,\n TurbopackRuleCondition,\n TurbopackRuleConfigCollection,\n TurbopackRuleConfigItem,\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 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 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 }\n\n const reactCompilerOptions = nextConfig.experimental?.reactCompiler\n\n // TODO: Merge this with `crates/next-core/src/next_shared/webpack_rules/babel.rs` so that we're\n // not configuring babel in two different places (potentially causing it to run twice)\n if (reactCompilerOptions) {\n const options: ReactCompilerOptions =\n typeof reactCompilerOptions === 'object' ? reactCompilerOptions : {}\n nextConfig.turbopack = {\n ...originalNextConfig.turbopack,\n rules: {\n ...originalNextConfig.turbopack.rules,\n // assumption: there is no collision with this glob key\n '{*.{js,jsx,ts,tsx,cjs,mjs,mts,cts},react-compiler-builtin-rule}': {\n loaders: [\n getReactCompilerLoader(\n reactCompilerOptions,\n projectPath,\n nextConfig.dev,\n /* isServer */ false,\n /* reactCompilerExclude */ undefined\n ),\n ],\n condition: {\n all: [\n 'browser',\n { not: 'foreign' },\n {\n content:\n options.compilationMode === 'annotation'\n ? /['\"]use memo['\"]/\n : !options.compilationMode ||\n options.compilationMode === 'infer'\n ? // Matches declaration or useXXX or </ (closing jsx) or /> (self closing jsx)\n /['\"]use memo['\"]|\\Wuse[A-Z]|<\\/|\\/>/\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. NOTE: This does a shallow clone.\n let nextConfigSerializable = augmentNextConfig(nextConfig, projectPath)\n\n nextConfigSerializable.generateBuildId =\n await nextConfigSerializable.generateBuildId?.()\n\n // TODO: these functions takes arguments, have to be supported in a different way\n nextConfigSerializable.exportPathMap = {}\n nextConfigSerializable.webpack = nextConfigSerializable.webpack && {}\n\n if (nextConfigSerializable.modularizeImports) {\n nextConfigSerializable.modularizeImports = 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),\n },\n ]\n )\n )\n }\n\n // loaderFile is an absolute path, we need it to be relative for turbopack.\n if (nextConfigSerializable.images.loaderFile) {\n nextConfigSerializable.images = {\n ...nextConfigSerializable.images,\n loaderFile:\n './' +\n path.relative(projectPath, nextConfigSerializable.images.loaderFile),\n }\n }\n\n // cacheHandler can be an absolute path, we need it to be relative for turbopack.\n if (nextConfigSerializable.cacheHandler) {\n nextConfigSerializable.cacheHandler =\n './' +\n (path.isAbsolute(nextConfigSerializable.cacheHandler)\n ? path.relative(projectPath, nextConfigSerializable.cacheHandler)\n : nextConfigSerializable.cacheHandler)\n }\n if (nextConfigSerializable.experimental?.cacheHandlers) {\n nextConfigSerializable.experimental = {\n ...nextConfigSerializable.experimental,\n cacheHandlers: Object.fromEntries(\n Object.entries(\n nextConfigSerializable.experimental.cacheHandlers as Record<\n string,\n string\n >\n )\n .filter(([_, value]) => value != null)\n .map(([key, value]) => [\n key,\n './' +\n (path.isAbsolute(value)\n ? path.relative(projectPath, value)\n : value),\n ])\n ),\n }\n }\n\n if (nextConfigSerializable.turbopack != null) {\n // clone to allow in-place mutations\n const turbopack = { ...nextConfigSerializable.turbopack }\n\n if (turbopack.rules) {\n turbopack.rules = serializeTurbopackRules(turbopack.rules)\n }\n\n nextConfigSerializable.turbopack = turbopack\n }\n\n return JSON.stringify(nextConfigSerializable, null, 2)\n }\n\n type SerializedRuleCondition =\n | { all: SerializedRuleCondition[] }\n | { any: SerializedRuleCondition[] }\n | { not: SerializedRuleCondition }\n | TurbopackLoaderBuiltinCondition\n | {\n path?:\n | { type: 'regex'; value: { source: string; flags: string } }\n | { type: 'glob'; value: string }\n content?: { source: string; flags: string }\n }\n\n // converts regexes to a `RegexComponents` object so that it can be JSON-serialized when passed to\n // Turbopack\n function serializeRuleCondition(\n cond: TurbopackRuleCondition\n ): SerializedRuleCondition {\n function regexComponents(regex: RegExp) {\n return {\n source: regex.source,\n flags: regex.flags,\n }\n }\n\n if (typeof cond === 'string') {\n return cond\n } else if ('all' in cond) {\n return { ...cond, all: cond.all.map(serializeRuleCondition) }\n } else if ('any' in cond) {\n return { ...cond, any: cond.any.map(serializeRuleCondition) }\n } else if ('not' in cond) {\n return { ...cond, not: serializeRuleCondition(cond.not) }\n } else {\n return {\n ...cond,\n path:\n cond.path == null\n ? undefined\n : cond.path instanceof RegExp\n ? {\n type: 'regex',\n value: regexComponents(cond.path),\n }\n : { type: 'glob', value: cond.path },\n content: cond.content && regexComponents(cond.content),\n }\n }\n }\n\n // Note: Returns an updated `turbopackRules` with serialized conditions. Does not mutate in-place.\n function serializeTurbopackRules(\n turbopackRules: Record<string, TurbopackRuleConfigCollection>\n ): Record<string, any> {\n const serializedRules: Record<string, any> = {}\n for (const [glob, rule] of Object.entries(turbopackRules)) {\n if (Array.isArray(rule)) {\n serializedRules[glob] = rule.map((item) => {\n if (typeof item !== 'string' && 'loaders' in item) {\n return serializeConfigItem(item, glob)\n } else {\n checkLoaderItem(item, glob)\n return item\n }\n })\n } else {\n serializedRules[glob] = serializeConfigItem(rule, glob)\n }\n }\n\n return serializedRules\n\n function serializeConfigItem(\n rule: TurbopackRuleConfigItem,\n glob: string\n ): any {\n if (!rule) return rule\n for (const item of rule.loaders) {\n checkLoaderItem(item, glob)\n }\n let serializedRule: any = rule\n if (rule.condition != null) {\n serializedRule = {\n ...rule,\n condition: serializeRuleCondition(rule.condition),\n }\n }\n return serializedRule\n }\n\n function checkLoaderItem(loaderItem: TurbopackLoaderItem, glob: string) {\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. ` +\n 'Ensure that options passed are plain JavaScript objects and values.'\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 expandNextJsTemplate(\n content: Buffer,\n templatePath: string,\n nextPackageDirPath: string,\n replacements: Record<`VAR_${string}`, string>,\n injections: Record<string, string>,\n imports: Record<string, string | null>\n ): string {\n return rawBindings.expandNextJsTemplate(\n content,\n templatePath,\n nextPackageDirPath,\n replacements,\n injections,\n imports\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 expandNextJsTemplate(\n content: Buffer,\n templatePath: string,\n nextPackageDirPath: string,\n replacements: Record<`VAR_${string}`, string>,\n injections: Record<string, string>,\n imports: Record<string, string | null>\n ): string {\n return bindings.expandNextJsTemplate(\n content,\n templatePath,\n nextPackageDirPath,\n replacements,\n injections,\n imports\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":["createDefineEnv","getBinaryMetadata","getModuleNamedExports","getSupportedArchTriples","initCustomTraceSubscriber","isReactCompilerRequired","isWasm","loadBindings","lockfilePatchPromise","minify","parse","teardownTraceSubscriber","transform","transformSync","warnForEdgeRuntime","nextVersion","process","env","__NEXT_VERSION","ArchName","arch","PlatformName","platform","infoLog","args","NEXT_PRIVATE_BUILD_WORKER","DEBUG","Log","info","darwin","win32","linux","freebsd","android","platformArchTriples","arm64","ia32","filter","triple","abi","x64","arm","triples","supportedArchTriples","targetTriple","rawTargetTriple","warn","__INTERNAL_CUSTOM_TURBOPACK_BINDINGS","checkVersionMismatch","pkgData","version","knownDefaultWasmFallbackTriples","lastNativeBindingsLoadErrorCode","undefined","pendingBindings","nativeBindings","wasmBindings","downloadWasmPromise","swcTraceFlushGuard","downloadNativeBindingsPromise","useWasmBinary","RUST_MIN_STACK","NEXT_TEST_WASM","stdout","_handle","setBlocking","stderr","Promise","resolve","_reject","cur","patchIncorrectLockfile","cwd","catch","console","error","attempts","disableWasmFallback","NEXT_DISABLE_SWC_WASM","unsupportedPlatform","some","raw","includes","isWebContainer","versions","webcontainer","shouldLoadWasmFallbackFirst","fallbackBindings","tryLoadWasmWithFallback","loadNative","a","Array","isArray","every","m","tryLoadNativeWithFallback","concat","logLoadFailure","nativeBindingsDirectory","path","join","dirname","require","downloadNativeNextSwc","map","platformArchABI","push","bindings","loadWasm","eventSwcLoadFailure","wasm","nativeBindingsErrorCode","wasmDirectory","downloadWasmSwc","attempt","loadBindingsSync","Error","cause","loggingLoadFailure","triedWasm","then","finally","exit","isTurbopack","clientRouterFilters","config","dev","distDir","projectPath","fetchCacheKeyPrefix","hasRewrites","middlewareMatchers","rewrites","defineEnv","client","edge","nodejs","variant","Object","keys","rustifyOptionEnv","getDefineEnv","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","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","turbopack","rules","loaders","getReactCompilerLoader","condition","all","not","content","compilationMode","nextConfigSerializable","generateBuildId","exportPathMap","webpack","modularizeImports","fromEntries","mod","images","loaderFile","relative","cacheHandler","isAbsolute","cacheHandlers","key","serializeTurbopackRules","JSON","stringify","serializeRuleCondition","cond","regexComponents","regex","source","flags","any","RegExp","type","turbopackRules","serializedRules","glob","rule","serializeConfigItem","checkLoaderItem","serializedRule","loaderItem","isDeepStrictEqual","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","throwTurbopackInternalError","loadWasmRawBindings","importPath","testWasmDir","NEXT_TEST_WASM_DIR","rawBindings","pathToFileURL","toString","pkg","pkgPath","importedRawBindings","default","code","message","removeUndefined","obj","newObj","k","v","css","lightning","_options","transformStyleAttr","src","minifySync","getTargetTriple","turbo","_turboEngineOptions","startTurbopackTraceServer","_traceFilePath","mdx","compile","mdxCompile","getMdxOptions","compileSync","mdxCompileSync","_filename","rspack","_resourcePath","_source","_isProduction","expandNextJsTemplate","templatePath","nextPackageDirPath","replacements","injections","imports","customBindings","NEXT_TEST_NATIVE_DIR","isModule","Buffer","isBuffer","jsc","parser","syntax","toBuffer","from","traceFilePath","transformOptions","lightningCssTransform","transformAttrOptions","lightningCssTransformStyleAttribute","filename","resourcePath","isProduction","development","jsx","mdxType","t","parserOptions","getParserOptions","astStr","target","traceFileName","once","fn","executed"],"mappings":"AAAA,0DAA0D;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAqZ1CA,eAAe;eAAfA;;IAypCAC,iBAAiB;eAAjBA;;IAyDMC,qBAAqB;eAArBA;;IAniDNC,uBAAuB;eAAvBA;;IA2/CAC,yBAAyB;eAAzBA;;IAhCMC,uBAAuB;eAAvBA;;IAvBAC,MAAM;eAANA;;IA/0CAC,YAAY;eAAZA;;IAVTC,oBAAoB;eAApBA;;IAw2CSC,MAAM;eAANA;;IAeAC,KAAK;eAALA;;IAsDTC,uBAAuB;eAAvBA;;IA/ESC,SAAS;eAATA;;IAKNC,aAAa;eA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AOoG,SAAS0P,MAAM,CAACnW,qBAAqB,CAAC6X;AAC/C;AAEO,eAAejX,mBACpBqQ,MAAc,EACd6G,YAAqB;IAErB,MAAMrR,WAAW,MAAMpG;IACvB,OAAOoG,SAAS0P,MAAM,CAACvV,kBAAkB,CAACqQ,QAAQ6G;AACpD","ignoreList":[0]}
@@ -282,16 +282,6 @@ export interface ProjectOptions {
282
282
  * The next.config.js contents.
283
283
  */
284
284
  nextConfig: NextConfigComplete;
285
- /**
286
- * Jsconfig, or tsconfig contents.
287
- *
288
- * Next.js implicitly requires to read it to support few options
289
- * https://nextjs.org/docs/architecture/nextjs-compiler#legacy-decorators
290
- * https://nextjs.org/docs/architecture/nextjs-compiler#importsource
291
- */
292
- jsConfig: {
293
- compilerOptions: object;
294
- };
295
285
  /**
296
286
  * A map of environment variables to use when compiling code.
297
287
  */
@@ -74,7 +74,6 @@ async function turbopackBuild() {
74
74
  projectPath: (0, _normalizepath.normalizePath)(_path.default.relative(rootPath, dir) || '.'),
75
75
  distDir,
76
76
  nextConfig: config,
77
- jsConfig: await (0, _utils.getTurbopackJsConfig)(dir, config),
78
77
  watch: {
79
78
  enable: false
80
79
  },