next 16.0.2-canary.10 → 16.0.2-canary.12

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 (114) hide show
  1. package/dist/bin/next +1 -1
  2. package/dist/build/babel/loader/get-config.js +5 -0
  3. package/dist/build/babel/loader/get-config.js.map +1 -1
  4. package/dist/build/index.js +7 -4
  5. package/dist/build/index.js.map +1 -1
  6. package/dist/build/jest/jest.js +2 -1
  7. package/dist/build/jest/jest.js.map +1 -1
  8. package/dist/build/load-entrypoint.js +1 -2
  9. package/dist/build/load-entrypoint.js.map +1 -1
  10. package/dist/build/lockfile.d.ts +1 -1
  11. package/dist/build/lockfile.js +5 -9
  12. package/dist/build/lockfile.js.map +1 -1
  13. package/dist/build/next-config-ts/transpile-config.js +13 -3
  14. package/dist/build/next-config-ts/transpile-config.js.map +1 -1
  15. package/dist/build/swc/index.d.ts +4 -2
  16. package/dist/build/swc/index.js +54 -51
  17. package/dist/build/swc/index.js.map +1 -1
  18. package/dist/build/swc/install-bindings.d.ts +15 -0
  19. package/dist/build/swc/install-bindings.js +30 -0
  20. package/dist/build/swc/install-bindings.js.map +1 -0
  21. package/dist/build/templates/app-page.js +7 -1
  22. package/dist/build/templates/app-page.js.map +1 -1
  23. package/dist/build/turbopack-build/impl.js +9 -4
  24. package/dist/build/turbopack-build/impl.js.map +1 -1
  25. package/dist/build/webpack/loaders/lightningcss-loader/src/loader.js +7 -2
  26. package/dist/build/webpack/loaders/lightningcss-loader/src/loader.js.map +1 -1
  27. package/dist/build/webpack/loaders/lightningcss-loader/src/minify.js +2 -2
  28. package/dist/build/webpack/loaders/lightningcss-loader/src/minify.js.map +1 -1
  29. package/dist/build/webpack/loaders/next-app-loader/index.js +6 -0
  30. package/dist/build/webpack/loaders/next-app-loader/index.js.map +1 -1
  31. package/dist/build/webpack/loaders/next-barrel-loader.js +5 -0
  32. package/dist/build/webpack/loaders/next-barrel-loader.js.map +1 -1
  33. package/dist/build/webpack/loaders/next-metadata-image-loader.js +5 -0
  34. package/dist/build/webpack/loaders/next-metadata-image-loader.js.map +1 -1
  35. package/dist/build/webpack/loaders/next-metadata-route-loader.js +5 -0
  36. package/dist/build/webpack/loaders/next-metadata-route-loader.js.map +1 -1
  37. package/dist/build/webpack/loaders/next-swc-loader.js +10 -6
  38. package/dist/build/webpack/loaders/next-swc-loader.js.map +1 -1
  39. package/dist/build/webpack-build/impl.js +4 -1
  40. package/dist/build/webpack-build/impl.js.map +1 -1
  41. package/dist/build/webpack-config.js +2 -7
  42. package/dist/build/webpack-config.js.map +1 -1
  43. package/dist/cli/next-typegen.js +3 -0
  44. package/dist/cli/next-typegen.js.map +1 -1
  45. package/dist/client/app-bootstrap.js +1 -1
  46. package/dist/client/index.js +1 -1
  47. package/dist/compiled/@next/font/dist/google/font-data.json +63 -0
  48. package/dist/compiled/@next/font/dist/google/index.d.ts +40 -0
  49. package/dist/esm/build/babel/loader/get-config.js +5 -0
  50. package/dist/esm/build/babel/loader/get-config.js.map +1 -1
  51. package/dist/esm/build/index.js +7 -4
  52. package/dist/esm/build/index.js.map +1 -1
  53. package/dist/esm/build/load-entrypoint.js +2 -3
  54. package/dist/esm/build/load-entrypoint.js.map +1 -1
  55. package/dist/esm/build/lockfile.js +5 -9
  56. package/dist/esm/build/lockfile.js.map +1 -1
  57. package/dist/esm/build/next-config-ts/transpile-config.js +13 -3
  58. package/dist/esm/build/next-config-ts/transpile-config.js.map +1 -1
  59. package/dist/esm/build/swc/index.js +52 -49
  60. package/dist/esm/build/swc/index.js.map +1 -1
  61. package/dist/esm/build/swc/install-bindings.js +20 -0
  62. package/dist/esm/build/swc/install-bindings.js.map +1 -0
  63. package/dist/esm/build/templates/app-page.js +7 -1
  64. package/dist/esm/build/templates/app-page.js.map +1 -1
  65. package/dist/esm/build/turbopack-build/impl.js +10 -5
  66. package/dist/esm/build/turbopack-build/impl.js.map +1 -1
  67. package/dist/esm/build/webpack/loaders/lightningcss-loader/src/loader.js +7 -2
  68. package/dist/esm/build/webpack/loaders/lightningcss-loader/src/loader.js.map +1 -1
  69. package/dist/esm/build/webpack/loaders/lightningcss-loader/src/minify.js +2 -2
  70. package/dist/esm/build/webpack/loaders/lightningcss-loader/src/minify.js.map +1 -1
  71. package/dist/esm/build/webpack/loaders/next-app-loader/index.js +6 -0
  72. package/dist/esm/build/webpack/loaders/next-app-loader/index.js.map +1 -1
  73. package/dist/esm/build/webpack/loaders/next-barrel-loader.js +5 -0
  74. package/dist/esm/build/webpack/loaders/next-barrel-loader.js.map +1 -1
  75. package/dist/esm/build/webpack/loaders/next-metadata-image-loader.js +5 -0
  76. package/dist/esm/build/webpack/loaders/next-metadata-image-loader.js.map +1 -1
  77. package/dist/esm/build/webpack/loaders/next-metadata-route-loader.js +5 -0
  78. package/dist/esm/build/webpack/loaders/next-metadata-route-loader.js.map +1 -1
  79. package/dist/esm/build/webpack/loaders/next-swc-loader.js +11 -7
  80. package/dist/esm/build/webpack/loaders/next-swc-loader.js.map +1 -1
  81. package/dist/esm/build/webpack-build/impl.js +4 -1
  82. package/dist/esm/build/webpack-build/impl.js.map +1 -1
  83. package/dist/esm/build/webpack-config.js +2 -7
  84. package/dist/esm/build/webpack-config.js.map +1 -1
  85. package/dist/esm/client/app-bootstrap.js +1 -1
  86. package/dist/esm/client/index.js +1 -1
  87. package/dist/esm/server/config.js +2 -2
  88. package/dist/esm/server/config.js.map +1 -1
  89. package/dist/esm/server/dev/hot-reloader-turbopack.js +3 -4
  90. package/dist/esm/server/dev/hot-reloader-turbopack.js.map +1 -1
  91. package/dist/esm/server/dev/hot-reloader-webpack.js +1 -1
  92. package/dist/esm/server/lib/app-info-log.js +1 -1
  93. package/dist/esm/server/lib/router-utils/setup-dev-bundler.js +3 -0
  94. package/dist/esm/server/lib/router-utils/setup-dev-bundler.js.map +1 -1
  95. package/dist/esm/server/lib/start-server.js +1 -1
  96. package/dist/esm/server/lib/trace/tracer.js +6 -5
  97. package/dist/esm/server/lib/trace/tracer.js.map +1 -1
  98. package/dist/esm/shared/lib/errors/canary-only-config-error.js +1 -1
  99. package/dist/server/config.js +2 -2
  100. package/dist/server/config.js.map +1 -1
  101. package/dist/server/dev/hot-reloader-turbopack.js +2 -3
  102. package/dist/server/dev/hot-reloader-turbopack.js.map +1 -1
  103. package/dist/server/dev/hot-reloader-webpack.js +1 -1
  104. package/dist/server/lib/app-info-log.js +1 -1
  105. package/dist/server/lib/router-utils/setup-dev-bundler.js +3 -0
  106. package/dist/server/lib/router-utils/setup-dev-bundler.js.map +1 -1
  107. package/dist/server/lib/start-server.js +1 -1
  108. package/dist/server/lib/trace/tracer.js +6 -5
  109. package/dist/server/lib/trace/tracer.js.map +1 -1
  110. package/dist/shared/lib/errors/canary-only-config-error.js +1 -1
  111. package/dist/telemetry/anonymous-meta.js +1 -1
  112. package/dist/telemetry/events/session-stopped.js +2 -2
  113. package/dist/telemetry/events/version.js +2 -2
  114. package/package.json +15 -15
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../src/build/webpack/loaders/lightningcss-loader/src/loader.ts"],"sourcesContent":["import type { LoaderContext } from 'webpack'\nimport { getTargets } from './utils'\nimport {\n getImportCode,\n type ApiParam,\n type ApiReplacement,\n type CssExport,\n type CssImport,\n getModuleCode,\n getExportCode,\n} from './codegen'\nimport {\n getFilter,\n getPreRequester,\n isDataUrl,\n isUrlRequestable,\n requestify,\n resolveRequests,\n} from '../../css-loader/src/utils'\nimport { stringifyRequest } from '../../../stringify-request'\nimport { ECacheKey } from './interface'\n\nconst encoder = new TextEncoder()\n\nfunction createUrlAndImportVisitor(\n visitorOptions: any,\n apis: ApiParam[],\n imports: CssImport[],\n replacements: ApiReplacement[],\n replacedUrls: Map<number, string>,\n replacedImportUrls: Map<number, string>\n) {\n const importUrlToNameMap = new Map<string, string>()\n\n let hasUrlImportHelper = false\n const urlToNameMap = new Map()\n const urlToReplacementMap = new Map()\n let urlIndex = -1\n let importUrlIndex = -1\n\n function handleUrl(u: { url: string; loc: unknown }): unknown {\n let url = u.url\n const needKeep = visitorOptions.urlFilter(url)\n\n if (!needKeep) {\n return u\n }\n\n if (isDataUrl(url)) {\n return u\n }\n\n urlIndex++\n\n replacedUrls.set(urlIndex, url)\n url = `__NEXT_LIGHTNINGCSS_LOADER_URL_REPLACE_${urlIndex}__`\n\n const [, query, hashOrQuery] = url.split(/(\\?)?#/, 3)\n\n const queryParts = url.split('!')\n let prefix: string | undefined\n\n if (queryParts.length > 1) {\n url = queryParts.pop()!\n prefix = queryParts.join('!')\n }\n\n let hash = query ? '?' : ''\n hash += hashOrQuery ? `#${hashOrQuery}` : ''\n\n if (!hasUrlImportHelper) {\n imports.push({\n type: 'get_url_import',\n importName: '___CSS_LOADER_GET_URL_IMPORT___',\n url: JSON.stringify(\n require.resolve('../../css-loader/src/runtime/getUrl.js')\n ),\n index: -1,\n })\n\n hasUrlImportHelper = true\n }\n\n const newUrl = prefix ? `${prefix}!${url}` : url\n let importName = urlToNameMap.get(newUrl)\n\n if (!importName) {\n importName = `___CSS_LOADER_URL_IMPORT_${urlToNameMap.size}___`\n urlToNameMap.set(newUrl, importName)\n\n imports.push({\n type: 'url',\n importName,\n url: JSON.stringify(newUrl),\n index: urlIndex,\n })\n }\n // This should be true for string-urls in image-set\n const needQuotes = false\n\n const replacementKey = JSON.stringify({ newUrl, hash, needQuotes })\n let replacementName = urlToReplacementMap.get(replacementKey)\n\n if (!replacementName) {\n replacementName = `___CSS_LOADER_URL_REPLACEMENT_${urlToReplacementMap.size}___`\n urlToReplacementMap.set(replacementKey, replacementName)\n\n replacements.push({\n replacementName,\n importName,\n hash,\n needQuotes,\n })\n }\n\n return {\n loc: u.loc,\n url: replacementName,\n }\n }\n\n return {\n Rule: {\n import(node: any) {\n if (visitorOptions.importFilter) {\n const needKeep = visitorOptions.importFilter(\n node.value.url,\n node.value.media\n )\n\n if (!needKeep) {\n return node\n }\n }\n let url = node.value.url\n\n importUrlIndex++\n\n replacedImportUrls.set(importUrlIndex, url)\n url = `__NEXT_LIGHTNINGCSS_LOADER_IMPORT_URL_REPLACE_${importUrlIndex}__`\n\n // TODO: Use identical logic as valueParser.stringify()\n const media = node.value.media.mediaQueries.length\n ? JSON.stringify(node.value.media.mediaQueries)\n : undefined\n const isRequestable = isUrlRequestable(url)\n let prefix: string | undefined\n if (isRequestable) {\n const queryParts = url.split('!')\n if (queryParts.length > 1) {\n url = queryParts.pop()!\n prefix = queryParts.join('!')\n }\n }\n if (!isRequestable) {\n apis.push({ url, media })\n // Bug of lightningcss\n return { type: 'ignored', value: '' }\n }\n const newUrl = prefix ? `${prefix}!${url}` : url\n let importName = importUrlToNameMap.get(newUrl)\n if (!importName) {\n importName = `___CSS_LOADER_AT_RULE_IMPORT_${importUrlToNameMap.size}___`\n importUrlToNameMap.set(newUrl, importName)\n\n const importUrl = visitorOptions.urlHandler(newUrl)\n imports.push({\n type: 'rule_import',\n importName,\n url: importUrl,\n })\n }\n apis.push({ importName, media })\n // Bug of lightningcss\n return { type: 'ignored', value: '' }\n },\n },\n Url(node: any) {\n return handleUrl(node)\n },\n }\n}\n\nfunction createIcssVisitor({\n apis,\n imports,\n replacements,\n replacedUrls,\n urlHandler,\n}: {\n apis: ApiParam[]\n imports: CssImport[]\n replacements: ApiReplacement[]\n replacedUrls: Map<number, string>\n urlHandler: (url: any) => string\n}) {\n let index = -1\n let replacementIndex = -1\n\n return {\n Declaration: {\n composes(node: any) {\n if (node.property === 'unparsed') {\n return\n }\n\n const specifier = node.value.from\n\n if (specifier?.type !== 'file') {\n return\n }\n\n let url = specifier.value\n if (!url) {\n return\n }\n\n index++\n\n replacedUrls.set(index, url)\n url = `__NEXT_LIGHTNINGCSS_LOADER_ICSS_URL_REPLACE_${index}__`\n\n const importName = `___CSS_LOADER_ICSS_IMPORT_${imports.length}___`\n imports.push({\n type: 'icss_import',\n importName,\n icss: true,\n url: urlHandler(url),\n index,\n })\n\n apis.push({ importName, dedupe: true, index })\n\n const newNames: string[] = []\n\n for (const localName of node.value.names) {\n replacementIndex++\n const replacementName = `___CSS_LOADER_ICSS_IMPORT_${index}_REPLACEMENT_${replacementIndex}___`\n\n replacements.push({\n replacementName,\n importName,\n localName,\n })\n newNames.push(replacementName)\n }\n\n return {\n property: 'composes',\n value: {\n loc: node.value.loc,\n names: newNames,\n from: specifier,\n },\n }\n },\n },\n }\n}\n\nconst LOADER_NAME = `lightningcss-loader`\nexport async function LightningCssLoader(\n this: LoaderContext<any>,\n source: string,\n prevMap?: Record<string, any>\n): Promise<void> {\n const done = this.async()\n const options = this.getOptions()\n const { implementation, targets: userTargets, ...opts } = options\n\n options.modules ??= {}\n\n if (implementation && typeof implementation.transformCss !== 'function') {\n done(\n new TypeError(\n `[${LOADER_NAME}]: options.implementation.transformCss must be an 'lightningcss' transform function. Received ${typeof implementation.transformCss}`\n )\n )\n return\n }\n\n if (options.postcss) {\n const { postcssWithPlugins } = await options.postcss()\n\n if (postcssWithPlugins?.plugins?.length > 0) {\n throw new Error(\n `[${LOADER_NAME}]: experimental.useLightningcss does not work with postcss plugins. Please remove 'useLightningcss: true' from your configuration.`\n )\n }\n }\n\n const exports: CssExport[] = []\n const imports: CssImport[] = []\n const icssImports: CssImport[] = []\n const apis: ApiParam[] = []\n const replacements: ApiReplacement[] = []\n\n if (options.modules?.exportOnlyLocals !== true) {\n imports.unshift({\n type: 'api_import',\n importName: '___CSS_LOADER_API_IMPORT___',\n url: stringifyRequest(\n this,\n require.resolve('../../css-loader/src/runtime/api')\n ),\n })\n }\n const { loadBindings } =\n require('../../../../../build/swc') as typeof import('../../../../../build/swc')\n\n const transform =\n implementation?.transformCss ??\n (await loadBindings()).css.lightning.transform\n\n const replacedUrls = new Map<number, string>()\n const icssReplacedUrls = new Map<number, string>()\n const replacedImportUrls = new Map<number, string>()\n\n const urlImportVisitor = createUrlAndImportVisitor(\n {\n urlHandler: (url: any) =>\n stringifyRequest(\n this,\n getPreRequester(this)(options.importLoaders ?? 0) + url\n ),\n urlFilter: getFilter(options.url, this.resourcePath),\n importFilter: getFilter(options.import, this.resourcePath),\n\n context: this.context,\n },\n apis,\n imports,\n replacements,\n replacedUrls,\n replacedImportUrls\n )\n\n const icssVisitor = createIcssVisitor({\n apis,\n imports: icssImports,\n replacements,\n replacedUrls: icssReplacedUrls,\n urlHandler: (url: string) =>\n stringifyRequest(\n this,\n getPreRequester(this)(options.importLoaders) + url\n ),\n })\n\n // This works by returned visitors are not conflicting.\n // naive workaround for composeVisitors, as we do not directly depends on lightningcss's npm pkg\n // but next-swc provides bindings\n const visitor = {\n ...urlImportVisitor,\n ...icssVisitor,\n }\n\n try {\n const {\n code,\n map,\n exports: moduleExports,\n } = transform({\n ...opts,\n visitor,\n cssModules: options.modules\n ? {\n pattern: process.env.__NEXT_TEST_MODE\n ? '[name]__[local]'\n : '[name]__[hash]__[local]',\n }\n : undefined,\n filename: this.resourcePath,\n code: encoder.encode(source),\n sourceMap: this.sourceMap,\n targets: getTargets({ targets: userTargets, key: ECacheKey.loader }),\n inputSourceMap:\n this.sourceMap && prevMap ? JSON.stringify(prevMap) : undefined,\n include: 1, // Features.Nesting\n })\n let cssCodeAsString = code.toString()\n\n if (moduleExports) {\n for (const name in moduleExports) {\n if (Object.prototype.hasOwnProperty.call(moduleExports, name)) {\n const v = moduleExports[name]\n let value = v.name\n for (const compose of v.composes) {\n value += ` ${compose.name}`\n }\n\n exports.push({\n name,\n value,\n })\n }\n }\n }\n\n if (replacedUrls.size !== 0) {\n const urlResolver = this.getResolve({\n conditionNames: ['asset'],\n mainFields: ['asset'],\n mainFiles: [],\n extensions: [],\n })\n\n for (const [index, url] of replacedUrls.entries()) {\n const [pathname, ,] = url.split(/(\\?)?#/, 3)\n\n const request = requestify(pathname, this.rootContext)\n const resolvedUrl = await resolveRequests(urlResolver, this.context, [\n ...new Set([request, url]),\n ])\n\n for (const importItem of imports) {\n importItem.url = importItem.url.replace(\n `__NEXT_LIGHTNINGCSS_LOADER_URL_REPLACE_${index}__`,\n resolvedUrl ?? url\n )\n }\n }\n }\n\n if (replacedImportUrls.size !== 0) {\n const importResolver = this.getResolve({\n conditionNames: ['style'],\n extensions: ['.css'],\n mainFields: ['css', 'style', 'main', '...'],\n mainFiles: ['index', '...'],\n restrictions: [/\\.css$/i],\n })\n\n for (const [index, url] of replacedImportUrls.entries()) {\n const [pathname, ,] = url.split(/(\\?)?#/, 3)\n\n const request = requestify(pathname, this.rootContext)\n const resolvedUrl = await resolveRequests(\n importResolver,\n this.context,\n [...new Set([request, url])]\n )\n\n for (const importItem of imports) {\n importItem.url = importItem.url.replace(\n `__NEXT_LIGHTNINGCSS_LOADER_IMPORT_URL_REPLACE_${index}__`,\n resolvedUrl ?? url\n )\n }\n }\n }\n if (icssReplacedUrls.size !== 0) {\n const icssResolver = this.getResolve({\n conditionNames: ['style'],\n extensions: [],\n mainFields: ['css', 'style', 'main', '...'],\n mainFiles: ['index', '...'],\n })\n\n for (const [index, url] of icssReplacedUrls.entries()) {\n const [pathname, ,] = url.split(/(\\?)?#/, 3)\n\n const request = requestify(pathname, this.rootContext)\n const resolvedUrl = await resolveRequests(icssResolver, this.context, [\n ...new Set([url, request]),\n ])\n\n for (const importItem of icssImports) {\n importItem.url = importItem.url.replace(\n `__NEXT_LIGHTNINGCSS_LOADER_ICSS_URL_REPLACE_${index}__`,\n resolvedUrl ?? url\n )\n }\n }\n }\n\n imports.push(...icssImports)\n\n const importCode = getImportCode(imports, options)\n const moduleCode = getModuleCode(\n { css: cssCodeAsString, map },\n apis,\n replacements,\n options,\n this\n )\n const exportCode = getExportCode(exports, replacements, options)\n\n const esCode = `${importCode}${moduleCode}${exportCode}`\n\n done(null, esCode, map && JSON.parse(map.toString()))\n } catch (error: unknown) {\n console.error('lightningcss-loader error', error)\n done(error as Error)\n }\n}\n\nexport const raw = true\n"],"names":["getTargets","getImportCode","getModuleCode","getExportCode","getFilter","getPreRequester","isDataUrl","isUrlRequestable","requestify","resolveRequests","stringifyRequest","ECacheKey","encoder","TextEncoder","createUrlAndImportVisitor","visitorOptions","apis","imports","replacements","replacedUrls","replacedImportUrls","importUrlToNameMap","Map","hasUrlImportHelper","urlToNameMap","urlToReplacementMap","urlIndex","importUrlIndex","handleUrl","u","url","needKeep","urlFilter","set","query","hashOrQuery","split","queryParts","prefix","length","pop","join","hash","push","type","importName","JSON","stringify","require","resolve","index","newUrl","get","size","needQuotes","replacementKey","replacementName","loc","Rule","import","node","importFilter","value","media","mediaQueries","undefined","isRequestable","importUrl","urlHandler","Url","createIcssVisitor","replacementIndex","Declaration","composes","property","specifier","from","icss","dedupe","newNames","localName","names","LOADER_NAME","LightningCssLoader","source","prevMap","options","done","async","getOptions","implementation","targets","userTargets","opts","modules","transformCss","TypeError","postcss","postcssWithPlugins","plugins","Error","exports","icssImports","exportOnlyLocals","unshift","loadBindings","transform","css","lightning","icssReplacedUrls","urlImportVisitor","importLoaders","resourcePath","context","icssVisitor","visitor","code","map","moduleExports","cssModules","pattern","process","env","__NEXT_TEST_MODE","filename","encode","sourceMap","key","loader","inputSourceMap","include","cssCodeAsString","toString","name","Object","prototype","hasOwnProperty","call","v","compose","urlResolver","getResolve","conditionNames","mainFields","mainFiles","extensions","entries","pathname","request","rootContext","resolvedUrl","Set","importItem","replace","importResolver","restrictions","icssResolver","importCode","moduleCode","exportCode","esCode","parse","error","console","raw"],"mappings":"AACA,SAASA,UAAU,QAAQ,UAAS;AACpC,SACEC,aAAa,EAKbC,aAAa,EACbC,aAAa,QACR,YAAW;AAClB,SACEC,SAAS,EACTC,eAAe,EACfC,SAAS,EACTC,gBAAgB,EAChBC,UAAU,EACVC,eAAe,QACV,6BAA4B;AACnC,SAASC,gBAAgB,QAAQ,6BAA4B;AAC7D,SAASC,SAAS,QAAQ,cAAa;AAEvC,MAAMC,UAAU,IAAIC;AAEpB,SAASC,0BACPC,cAAmB,EACnBC,IAAgB,EAChBC,OAAoB,EACpBC,YAA8B,EAC9BC,YAAiC,EACjCC,kBAAuC;IAEvC,MAAMC,qBAAqB,IAAIC;IAE/B,IAAIC,qBAAqB;IACzB,MA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AAE,OAAO8B,OAAgB;QACvBC,QAAQD,KAAK,CAAC,6BAA6BA;QAC3C3E,KAAK2E;IACP;AACF;AAEA,OAAO,MAAME,MAAM,KAAI","ignoreList":[0]}
1
+ {"version":3,"sources":["../../../../../../../src/build/webpack/loaders/lightningcss-loader/src/loader.ts"],"sourcesContent":["import type { LoaderContext } from 'webpack'\nimport { getTargets } from './utils'\nimport {\n getImportCode,\n type ApiParam,\n type ApiReplacement,\n type CssExport,\n type CssImport,\n getModuleCode,\n getExportCode,\n} from './codegen'\nimport {\n getFilter,\n getPreRequester,\n isDataUrl,\n isUrlRequestable,\n requestify,\n resolveRequests,\n} from '../../css-loader/src/utils'\nimport { stringifyRequest } from '../../../stringify-request'\nimport { ECacheKey } from './interface'\nimport { getBindingsSync } from '../../../../../build/swc'\nimport { installBindings } from '../../../../../build/swc/install-bindings'\n\nconst encoder = new TextEncoder()\n\nfunction createUrlAndImportVisitor(\n visitorOptions: any,\n apis: ApiParam[],\n imports: CssImport[],\n replacements: ApiReplacement[],\n replacedUrls: Map<number, string>,\n replacedImportUrls: Map<number, string>\n) {\n const importUrlToNameMap = new Map<string, string>()\n\n let hasUrlImportHelper = false\n const urlToNameMap = new Map()\n const urlToReplacementMap = new Map()\n let urlIndex = -1\n let importUrlIndex = -1\n\n function handleUrl(u: { url: string; loc: unknown }): unknown {\n let url = u.url\n const needKeep = visitorOptions.urlFilter(url)\n\n if (!needKeep) {\n return u\n }\n\n if (isDataUrl(url)) {\n return u\n }\n\n urlIndex++\n\n replacedUrls.set(urlIndex, url)\n url = `__NEXT_LIGHTNINGCSS_LOADER_URL_REPLACE_${urlIndex}__`\n\n const [, query, hashOrQuery] = url.split(/(\\?)?#/, 3)\n\n const queryParts = url.split('!')\n let prefix: string | undefined\n\n if (queryParts.length > 1) {\n url = queryParts.pop()!\n prefix = queryParts.join('!')\n }\n\n let hash = query ? '?' : ''\n hash += hashOrQuery ? `#${hashOrQuery}` : ''\n\n if (!hasUrlImportHelper) {\n imports.push({\n type: 'get_url_import',\n importName: '___CSS_LOADER_GET_URL_IMPORT___',\n url: JSON.stringify(\n require.resolve('../../css-loader/src/runtime/getUrl.js')\n ),\n index: -1,\n })\n\n hasUrlImportHelper = true\n }\n\n const newUrl = prefix ? `${prefix}!${url}` : url\n let importName = urlToNameMap.get(newUrl)\n\n if (!importName) {\n importName = `___CSS_LOADER_URL_IMPORT_${urlToNameMap.size}___`\n urlToNameMap.set(newUrl, importName)\n\n imports.push({\n type: 'url',\n importName,\n url: JSON.stringify(newUrl),\n index: urlIndex,\n })\n }\n // This should be true for string-urls in image-set\n const needQuotes = false\n\n const replacementKey = JSON.stringify({ newUrl, hash, needQuotes })\n let replacementName = urlToReplacementMap.get(replacementKey)\n\n if (!replacementName) {\n replacementName = `___CSS_LOADER_URL_REPLACEMENT_${urlToReplacementMap.size}___`\n urlToReplacementMap.set(replacementKey, replacementName)\n\n replacements.push({\n replacementName,\n importName,\n hash,\n needQuotes,\n })\n }\n\n return {\n loc: u.loc,\n url: replacementName,\n }\n }\n\n return {\n Rule: {\n import(node: any) {\n if (visitorOptions.importFilter) {\n const needKeep = visitorOptions.importFilter(\n node.value.url,\n node.value.media\n )\n\n if (!needKeep) {\n return node\n }\n }\n let url = node.value.url\n\n importUrlIndex++\n\n replacedImportUrls.set(importUrlIndex, url)\n url = `__NEXT_LIGHTNINGCSS_LOADER_IMPORT_URL_REPLACE_${importUrlIndex}__`\n\n // TODO: Use identical logic as valueParser.stringify()\n const media = node.value.media.mediaQueries.length\n ? JSON.stringify(node.value.media.mediaQueries)\n : undefined\n const isRequestable = isUrlRequestable(url)\n let prefix: string | undefined\n if (isRequestable) {\n const queryParts = url.split('!')\n if (queryParts.length > 1) {\n url = queryParts.pop()!\n prefix = queryParts.join('!')\n }\n }\n if (!isRequestable) {\n apis.push({ url, media })\n // Bug of lightningcss\n return { type: 'ignored', value: '' }\n }\n const newUrl = prefix ? `${prefix}!${url}` : url\n let importName = importUrlToNameMap.get(newUrl)\n if (!importName) {\n importName = `___CSS_LOADER_AT_RULE_IMPORT_${importUrlToNameMap.size}___`\n importUrlToNameMap.set(newUrl, importName)\n\n const importUrl = visitorOptions.urlHandler(newUrl)\n imports.push({\n type: 'rule_import',\n importName,\n url: importUrl,\n })\n }\n apis.push({ importName, media })\n // Bug of lightningcss\n return { type: 'ignored', value: '' }\n },\n },\n Url(node: any) {\n return handleUrl(node)\n },\n }\n}\n\nfunction createIcssVisitor({\n apis,\n imports,\n replacements,\n replacedUrls,\n urlHandler,\n}: {\n apis: ApiParam[]\n imports: CssImport[]\n replacements: ApiReplacement[]\n replacedUrls: Map<number, string>\n urlHandler: (url: any) => string\n}) {\n let index = -1\n let replacementIndex = -1\n\n return {\n Declaration: {\n composes(node: any) {\n if (node.property === 'unparsed') {\n return\n }\n\n const specifier = node.value.from\n\n if (specifier?.type !== 'file') {\n return\n }\n\n let url = specifier.value\n if (!url) {\n return\n }\n\n index++\n\n replacedUrls.set(index, url)\n url = `__NEXT_LIGHTNINGCSS_LOADER_ICSS_URL_REPLACE_${index}__`\n\n const importName = `___CSS_LOADER_ICSS_IMPORT_${imports.length}___`\n imports.push({\n type: 'icss_import',\n importName,\n icss: true,\n url: urlHandler(url),\n index,\n })\n\n apis.push({ importName, dedupe: true, index })\n\n const newNames: string[] = []\n\n for (const localName of node.value.names) {\n replacementIndex++\n const replacementName = `___CSS_LOADER_ICSS_IMPORT_${index}_REPLACEMENT_${replacementIndex}___`\n\n replacements.push({\n replacementName,\n importName,\n localName,\n })\n newNames.push(replacementName)\n }\n\n return {\n property: 'composes',\n value: {\n loc: node.value.loc,\n names: newNames,\n from: specifier,\n },\n }\n },\n },\n }\n}\n\nconst LOADER_NAME = `lightningcss-loader`\nexport async function LightningCssLoader(\n this: LoaderContext<any>,\n source: string,\n prevMap?: Record<string, any>\n): Promise<void> {\n const done = this.async()\n const options = this.getOptions()\n // Install bindings early so they are definitely available to the loader.\n // When run by webpack in next this is already done with correct configuration so this is a no-op.\n // In turbopack loaders are run in a subprocess so it may or may not be done.\n await installBindings()\n const { implementation, targets: userTargets, ...opts } = options\n\n options.modules ??= {}\n\n if (implementation && typeof implementation.transformCss !== 'function') {\n done(\n new TypeError(\n `[${LOADER_NAME}]: options.implementation.transformCss must be an 'lightningcss' transform function. Received ${typeof implementation.transformCss}`\n )\n )\n return\n }\n\n if (options.postcss) {\n const { postcssWithPlugins } = await options.postcss()\n\n if (postcssWithPlugins?.plugins?.length > 0) {\n throw new Error(\n `[${LOADER_NAME}]: experimental.useLightningcss does not work with postcss plugins. Please remove 'useLightningcss: true' from your configuration.`\n )\n }\n }\n\n const exports: CssExport[] = []\n const imports: CssImport[] = []\n const icssImports: CssImport[] = []\n const apis: ApiParam[] = []\n const replacements: ApiReplacement[] = []\n\n if (options.modules?.exportOnlyLocals !== true) {\n imports.unshift({\n type: 'api_import',\n importName: '___CSS_LOADER_API_IMPORT___',\n url: stringifyRequest(\n this,\n require.resolve('../../css-loader/src/runtime/api')\n ),\n })\n }\n const transform =\n implementation?.transformCss ?? getBindingsSync().css.lightning.transform\n\n const replacedUrls = new Map<number, string>()\n const icssReplacedUrls = new Map<number, string>()\n const replacedImportUrls = new Map<number, string>()\n\n const urlImportVisitor = createUrlAndImportVisitor(\n {\n urlHandler: (url: any) =>\n stringifyRequest(\n this,\n getPreRequester(this)(options.importLoaders ?? 0) + url\n ),\n urlFilter: getFilter(options.url, this.resourcePath),\n importFilter: getFilter(options.import, this.resourcePath),\n\n context: this.context,\n },\n apis,\n imports,\n replacements,\n replacedUrls,\n replacedImportUrls\n )\n\n const icssVisitor = createIcssVisitor({\n apis,\n imports: icssImports,\n replacements,\n replacedUrls: icssReplacedUrls,\n urlHandler: (url: string) =>\n stringifyRequest(\n this,\n getPreRequester(this)(options.importLoaders) + url\n ),\n })\n\n // This works by returned visitors are not conflicting.\n // naive workaround for composeVisitors, as we do not directly depends on lightningcss's npm pkg\n // but next-swc provides bindings\n const visitor = {\n ...urlImportVisitor,\n ...icssVisitor,\n }\n\n try {\n const {\n code,\n map,\n exports: moduleExports,\n } = transform({\n ...opts,\n visitor,\n cssModules: options.modules\n ? {\n pattern: process.env.__NEXT_TEST_MODE\n ? '[name]__[local]'\n : '[name]__[hash]__[local]',\n }\n : undefined,\n filename: this.resourcePath,\n code: encoder.encode(source),\n sourceMap: this.sourceMap,\n targets: getTargets({ targets: userTargets, key: ECacheKey.loader }),\n inputSourceMap:\n this.sourceMap && prevMap ? JSON.stringify(prevMap) : undefined,\n include: 1, // Features.Nesting\n })\n let cssCodeAsString = code.toString()\n\n if (moduleExports) {\n for (const name in moduleExports) {\n if (Object.prototype.hasOwnProperty.call(moduleExports, name)) {\n const v = moduleExports[name]\n let value = v.name\n for (const compose of v.composes) {\n value += ` ${compose.name}`\n }\n\n exports.push({\n name,\n value,\n })\n }\n }\n }\n\n if (replacedUrls.size !== 0) {\n const urlResolver = this.getResolve({\n conditionNames: ['asset'],\n mainFields: ['asset'],\n mainFiles: [],\n extensions: [],\n })\n\n for (const [index, url] of replacedUrls.entries()) {\n const [pathname, ,] = url.split(/(\\?)?#/, 3)\n\n const request = requestify(pathname, this.rootContext)\n const resolvedUrl = await resolveRequests(urlResolver, this.context, [\n ...new Set([request, url]),\n ])\n\n for (const importItem of imports) {\n importItem.url = importItem.url.replace(\n `__NEXT_LIGHTNINGCSS_LOADER_URL_REPLACE_${index}__`,\n resolvedUrl ?? url\n )\n }\n }\n }\n\n if (replacedImportUrls.size !== 0) {\n const importResolver = this.getResolve({\n conditionNames: ['style'],\n extensions: ['.css'],\n mainFields: ['css', 'style', 'main', '...'],\n mainFiles: ['index', '...'],\n restrictions: [/\\.css$/i],\n })\n\n for (const [index, url] of replacedImportUrls.entries()) {\n const [pathname, ,] = url.split(/(\\?)?#/, 3)\n\n const request = requestify(pathname, this.rootContext)\n const resolvedUrl = await resolveRequests(\n importResolver,\n this.context,\n [...new Set([request, url])]\n )\n\n for (const importItem of imports) {\n importItem.url = importItem.url.replace(\n `__NEXT_LIGHTNINGCSS_LOADER_IMPORT_URL_REPLACE_${index}__`,\n resolvedUrl ?? url\n )\n }\n }\n }\n if (icssReplacedUrls.size !== 0) {\n const icssResolver = this.getResolve({\n conditionNames: ['style'],\n extensions: [],\n mainFields: ['css', 'style', 'main', '...'],\n mainFiles: ['index', '...'],\n })\n\n for (const [index, url] of icssReplacedUrls.entries()) {\n const [pathname, ,] = url.split(/(\\?)?#/, 3)\n\n const request = requestify(pathname, this.rootContext)\n const resolvedUrl = await resolveRequests(icssResolver, this.context, [\n ...new Set([url, request]),\n ])\n\n for (const importItem of icssImports) {\n importItem.url = importItem.url.replace(\n `__NEXT_LIGHTNINGCSS_LOADER_ICSS_URL_REPLACE_${index}__`,\n resolvedUrl ?? url\n )\n }\n }\n }\n\n imports.push(...icssImports)\n\n const importCode = getImportCode(imports, options)\n const moduleCode = getModuleCode(\n { css: cssCodeAsString, map },\n apis,\n replacements,\n options,\n this\n )\n const exportCode = getExportCode(exports, replacements, options)\n\n const esCode = `${importCode}${moduleCode}${exportCode}`\n\n done(null, esCode, map && JSON.parse(map.toString()))\n } catch (error: unknown) {\n console.error('lightningcss-loader error', error)\n done(error as Error)\n }\n}\n\nexport const raw = true\n"],"names":["getTargets","getImportCode","getModuleCode","getExportCode","getFilter","getPreRequester","isDataUrl","isUrlRequestable","requestify","resolveRequests","stringifyRequest","ECacheKey","getBindingsSync","installBindings","encoder","TextEncoder","createUrlAndImportVisitor","visitorOptions","apis","imports","replacements","replacedUrls","replacedImportUrls","importUrlToNameMap","Map","hasUrlImportHelper","urlToNameMap","urlToReplacementMap","urlIndex","importUrlIndex","handleUrl","u","url","needKeep","urlFilter","set","query","hashOrQuery","split","queryParts","prefix","length","pop","join","hash","push","type","importName","JSON","stringify","require","resolve","index","newUrl","get","size","needQuotes","replacementKey","replacementName","loc","Rule","import","node","importFilter","value","media","mediaQueries","undefined","isRequestable","importUrl","urlHandler","Url","createIcssVisitor","replacementIndex","Declaration","composes","property","specifier","from","icss","dedupe","newNames","localName","names","LOADER_NAME","LightningCssLoader","source","prevMap","options","done","async","getOptions","implementation","targets","userTargets","opts","modules","transformCss","TypeError","postcss","postcssWithPlugins","plugins","Error","exports","icssImports","exportOnlyLocals","unshift","transform","css","lightning","icssReplacedUrls","urlImportVisitor","importLoaders","resourcePath","context","icssVisitor","visitor","code","map","moduleExports","cssModules","pattern","process","env","__NEXT_TEST_MODE","filename","encode","sourceMap","key","loader","inputSourceMap","include","cssCodeAsString","toString","name","Object","prototype","hasOwnProperty","call","v","compose","urlResolver","getResolve","conditionNames","mainFields","mainFiles","extensions","entries","pathname","request","rootContext","resolvedUrl","Set","importItem","replace","importResolver","restrictions","icssResolver","importCode","moduleCode","exportCode","esCode","parse","error","console","raw"],"mappings":"AACA,SAASA,UAAU,QAAQ,UAAS;AACpC,SACEC,aAAa,EAKbC,aAAa,EACbC,aAAa,QACR,YAAW;AAClB,SACEC,SAAS,EACTC,eAAe,EACfC,SAAS,EACTC,gBAAgB,EAChBC,UAAU,EACVC,eAAe,QACV,6BAA4B;AACnC,SAASC,gBAAgB,QAAQ,6BAA4B;AAC7D,SAASC,SAAS,QAAQ,cAAa;AACvC,SAASC,eAAe,QAAQ,2BAA0B;AAC1D,SAASC,eAAe,QAAQ,4CAA2C;AAE3E,MAAMC,UAAU,IAAIC;AAEpB,SAASC,0BACPC,cAAmB,EACnBC,IAAgB,EAChBC,OAAoB,EACpBC,YAA8B,EAC9BC,YAAiC,EACjCC,kBAAuC;IAEvC,MAAMC,qBAAqB,IAAIC;IAE/B,IAAIC,qBAAqB;IACzB,MAAMC,eAAe,IAAIF;IACzB,MAAMG,sBAAsB,IAAIH;IAChC,IAAII,WAAW,CAAC;IAChB,IAAIC,iBAAiB,CAAC;IAEtB,SAASC,UAAUC,CAAgC;QACjD,IAAIC,MAAMD,EAAEC,GAAG;QACf,MAAMC,WAAWhB,eAAeiB,SAAS,CAACF;QAE1C,IAAI,CAACC,UAAU;YACb,OAAOF;QACT;QAEA,IAAIzB,UAAU0B,MAAM;YAClB,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;gBACdF,YAAY;oBAAC;oBAAO;oBAAS;oBAAQ;iBAAM;gBAC3CC,WAAW;oBAAC;oBAAS;iBAAM;YAC7B;YAEA,KAAK,MAAM,CAAC7F,OAAOpB,IAAI,IAAI8E,iBAAiBqC,OAAO,GAAI;gBACrD,MAAM,CAACC,aAAY,GAAGpH,IAAIM,KAAK,CAAC,UAAU;gBAE1C,MAAM+G,UAAU7I,WAAW4I,UAAU,IAAI,CAACE,WAAW;gBACrD,MAAMC,cAAc,MAAM9I,gBAAgBoJ,cAAc,IAAI,CAAC3C,OAAO,EAAE;uBACjE,IAAIsC,IAAI;wBAACxH;wBAAKqH;qBAAQ;iBAC1B;gBAED,KAAK,MAAMI,cAAcjD,YAAa;oBACpCiD,WAAWzH,GAAG,GAAGyH,WAAWzH,GAAG,CAAC0H,OAAO,CACrC,CAAC,4CAA4C,EAAEtG,MAAM,EAAE,CAAC,EACxDmG,eAAevH;gBAEnB;YACF;QACF;QAEAb,QAAQ0B,IAAI,IAAI2D;QAEhB,MAAMsD,aAAa7J,cAAckB,SAASqE;QAC1C,MAAMuE,aAAa7J,cACjB;YAAE0G,KAAKwB;YAAiBd;QAAI,GAC5BpG,MACAE,cACAoE,SACA,IAAI;QAEN,MAAMwE,aAAa7J,cAAcoG,SAASnF,cAAcoE;QAExD,MAAMyE,SAAS,GAAGH,aAAaC,aAAaC,YAAY;QAExDvE,KAAK,MAAMwE,QAAQ3C,OAAOtE,KAAKkH,KAAK,CAAC5C,IAAIe,QAAQ;IACnD,EAAE,OAAO8B,OAAgB;QACvBC,QAAQD,KAAK,CAAC,6BAA6BA;QAC3C1E,KAAK0E;IACP;AACF;AAEA,OAAO,MAAME,MAAM,KAAI","ignoreList":[0]}
@@ -6,6 +6,7 @@ import { RawSource, SourceMapSource } from 'next/dist/compiled/webpack-sources3'
6
6
  import { ECacheKey } from './interface';
7
7
  import { getTargets } from './utils';
8
8
  import { Buffer } from 'buffer';
9
+ import { getBindingsSync } from '../../../../../build/swc';
9
10
  const PLUGIN_NAME = 'lightning-css-minify';
10
11
  const CSS_FILE_REG = /\.css(?:\?.*)?$/i;
11
12
  export class LightningCssMinifyPlugin {
@@ -46,8 +47,7 @@ export class LightningCssMinifyPlugin {
46
47
  async transformAssets(compilation) {
47
48
  const { options: { devtool } } = compilation.compiler;
48
49
  if (!this.transform) {
49
- const { loadBindings } = require('../../../../../build/swc');
50
- this.transform = (await loadBindings()).css.lightning.transform;
50
+ this.transform = getBindingsSync().css.lightning.transform;
51
51
  }
52
52
  const sourcemap = this.options.sourceMap === undefined ? devtool && devtool.includes('source-map') : this.options.sourceMap;
53
53
  const { include, exclude, test: testRegExp, targets: userTargets, ...transformOptions } = this.options;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../src/build/webpack/loaders/lightningcss-loader/src/minify.ts"],"sourcesContent":["// @ts-ignore\nimport { ModuleFilenameHelpers } from 'next/dist/compiled/webpack/webpack'\nimport { webpack } from 'next/dist/compiled/webpack/webpack'\n// @ts-ignore\nimport { RawSource, SourceMapSource } from 'next/dist/compiled/webpack-sources3'\nimport { ECacheKey } from './interface'\nimport type { Compilation, Compiler } from 'webpack'\nimport { getTargets } from './utils'\nimport { Buffer } from 'buffer'\n\nconst PLUGIN_NAME = 'lightning-css-minify'\nconst CSS_FILE_REG = /\\.css(?:\\?.*)?$/i\n\nexport class LightningCssMinifyPlugin {\n private readonly options: any\n private transform: any | undefined\n\n constructor(opts: any = {}) {\n const { implementation, ...otherOpts } = opts\n if (implementation && typeof implementation.transformCss !== 'function') {\n throw new TypeError(\n `[LightningCssMinifyPlugin]: implementation.transformCss must be an 'lightningcss' transform function. Received ${typeof implementation.transformCss}`\n )\n }\n\n this.transform = implementation?.transformCss\n this.options = otherOpts\n }\n\n apply(compiler: Compiler) {\n const meta = JSON.stringify({\n name: '@next/lightningcss-loader',\n version: '0.0.0',\n options: this.options,\n })\n\n compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {\n compilation.hooks.chunkHash.tap(PLUGIN_NAME, (_, hash) =>\n hash.update(meta)\n )\n\n compilation.hooks.processAssets.tapPromise(\n {\n name: PLUGIN_NAME,\n stage: webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE,\n additionalAssets: true,\n },\n async () => await this.transformAssets(compilation)\n )\n\n compilation.hooks.statsPrinter.tap(PLUGIN_NAME, (statsPrinter) => {\n statsPrinter.hooks.print\n .for('asset.info.minimized')\n // @ts-ignore\n .tap(PLUGIN_NAME, (minimized, { green, formatFlag }) => {\n // @ts-ignore\n return minimized ? green(formatFlag('minimized')) : undefined\n })\n })\n })\n }\n\n private async transformAssets(compilation: Compilation): Promise<void> {\n const {\n options: { devtool },\n } = compilation.compiler\n\n if (!this.transform) {\n const { loadBindings } =\n require('../../../../../build/swc') as typeof import('../../../../../build/swc')\n this.transform = (await loadBindings()).css.lightning.transform\n }\n\n const sourcemap =\n this.options.sourceMap === undefined\n ? ((devtool && (devtool as string).includes('source-map')) as boolean)\n : this.options.sourceMap\n\n const {\n include,\n exclude,\n test: testRegExp,\n targets: userTargets,\n ...transformOptions\n } = this.options\n\n const assets = compilation.getAssets().filter(\n (asset) =>\n // Filter out already minimized\n !asset.info.minimized &&\n // Filter out by file type\n (testRegExp || CSS_FILE_REG).test(asset.name) &&\n ModuleFilenameHelpers.matchObject({ include, exclude }, asset.name)\n )\n\n await Promise.all(\n assets.map(async (asset) => {\n const { source, map } = asset.source.sourceAndMap()\n const sourceAsString = source.toString()\n const code = typeof source === 'string' ? Buffer.from(source) : source\n const targets = getTargets({\n targets: userTargets,\n key: ECacheKey.minify,\n })\n\n const result = await this.transform!({\n filename: asset.name,\n code,\n minify: true,\n sourceMap: sourcemap,\n targets,\n ...transformOptions,\n })\n const codeString = result.code.toString()\n\n compilation.updateAsset(\n asset.name,\n // @ts-ignore\n sourcemap\n ? new SourceMapSource(\n codeString,\n asset.name,\n JSON.parse(result.map!.toString()),\n sourceAsString,\n map as any,\n true\n )\n : new RawSource(codeString),\n {\n ...asset.info,\n minimized: true,\n }\n )\n })\n )\n }\n}\n"],"names":["ModuleFilenameHelpers","webpack","RawSource","SourceMapSource","ECacheKey","getTargets","Buffer","PLUGIN_NAME","CSS_FILE_REG","LightningCssMinifyPlugin","constructor","opts","implementation","otherOpts","transformCss","TypeError","transform","options","apply","compiler","meta","JSON","stringify","name","version","hooks","compilation","tap","chunkHash","_","hash","update","processAssets","tapPromise","stage","Compilation","PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE","additionalAssets","transformAssets","statsPrinter","print","for","minimized","green","formatFlag","undefined","devtool","loadBindings","require","css","lightning","sourcemap","sourceMap","includes","include","exclude","test","testRegExp","targets","userTargets","transformOptions","assets","getAssets","filter","asset","info","matchObject","Promise","all","map","source","sourceAndMap","sourceAsString","toString","code","from","key","minify","result","filename","codeString","updateAsset","parse"],"mappings":"AAAA,aAAa;AACb,SAASA,qBAAqB,QAAQ,qCAAoC;AAC1E,SAASC,OAAO,QAAQ,qCAAoC;AAC5D,aAAa;AACb,SAASC,SAAS,EAAEC,eAAe,QAAQ,sCAAqC;AAChF,SAASC,SAAS,QAAQ,cAAa;AAEvC,SAASC,UAAU,QAAQ,UAAS;AACpC,SAASC,MAAM,QAAQ,SAAQ;AAE/B,MAAMC,cAAc;AACpB,MAAMC,eAAe;AAErB,OAAO,MAAMC;IAIXC,YAAYC,OAAY,CAAC,CAAC,CAAE;QAC1B,MAAM,EAAEC,cAAc,EAAE,GAAGC,WAAW,GAAGF;QACzC,IAAIC,kBAAkB,OAAOA,eAAeE,YAAY,KAAK,YAAY;YACvE,MAAM,qBAEL,CAFK,IAAIC,UACR,CAAC,+GAA+G,EAAE,OAAOH,eAAeE,YAAY,EAAE,GADlJ,qBAAA;uBAAA;4BAAA;8BAAA;YAEN;QACF;QAEA,IAAI,CAACE,SAAS,GAAGJ,kCAAAA,eAAgBE,YAAY;QAC7C,IAAI,CAACG,OAAO,GAAGJ;IACjB;IAEAK,MAAMC,QAAkB,EAAE;QACxB,MAAMC,OA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,EACpB,GAAGC,kBACJ,GAAG,IAAI,CAAC3C,OAAO;QAEhB,MAAM4C,SAASnC,YAAYoC,SAAS,GAAGC,MAAM,CAC3C,CAACC,QACC,+BAA+B;YAC/B,CAACA,MAAMC,IAAI,CAACvB,SAAS,IAErB,AADA,0BAA0B;YACzBe,CAAAA,cAAcjD,YAAW,EAAGgD,IAAI,CAACQ,MAAMzC,IAAI,KAC5CvB,sBAAsBkE,WAAW,CAAC;gBAAEZ;gBAASC;YAAQ,GAAGS,MAAMzC,IAAI;QAGtE,MAAM4C,QAAQC,GAAG,CACfP,OAAOQ,GAAG,CAAC,OAAOL;YAChB,MAAM,EAAEM,MAAM,EAAED,GAAG,EAAE,GAAGL,MAAMM,MAAM,CAACC,YAAY;YACjD,MAAMC,iBAAiBF,OAAOG,QAAQ;YACtC,MAAMC,OAAO,OAAOJ,WAAW,WAAWhE,OAAOqE,IAAI,CAACL,UAAUA;YAChE,MAAMZ,UAAUrD,WAAW;gBACzBqD,SAASC;gBACTiB,KAAKxE,UAAUyE,MAAM;YACvB;YAEA,MAAMC,SAAS,MAAM,IAAI,CAAC9D,SAAS,CAAE;gBACnC+D,UAAUf,MAAMzC,IAAI;gBACpBmD;gBACAG,QAAQ;gBACRzB,WAAWD;gBACXO;gBACA,GAAGE,gBAAgB;YACrB;YACA,MAAMoB,aAAaF,OAAOJ,IAAI,CAACD,QAAQ;YAEvC/C,YAAYuD,WAAW,CACrBjB,MAAMzC,IAAI,EACV,aAAa;YACb4B,YACI,IAAIhD,gBACF6E,YACAhB,MAAMzC,IAAI,EACVF,KAAK6D,KAAK,CAACJ,OAAOT,GAAG,CAAEI,QAAQ,KAC/BD,gBACAH,KACA,QAEF,IAAInE,UAAU8E,aAClB;gBACE,GAAGhB,MAAMC,IAAI;gBACbvB,WAAW;YACb;QAEJ;IAEJ;AACF","ignoreList":[0]}
1
+ {"version":3,"sources":["../../../../../../../src/build/webpack/loaders/lightningcss-loader/src/minify.ts"],"sourcesContent":["// @ts-ignore\nimport { ModuleFilenameHelpers } from 'next/dist/compiled/webpack/webpack'\nimport { webpack } from 'next/dist/compiled/webpack/webpack'\n// @ts-ignore\nimport { RawSource, SourceMapSource } from 'next/dist/compiled/webpack-sources3'\nimport { ECacheKey } from './interface'\nimport type { Compilation, Compiler } from 'webpack'\nimport { getTargets } from './utils'\nimport { Buffer } from 'buffer'\nimport { getBindingsSync } from '../../../../../build/swc'\n\nconst PLUGIN_NAME = 'lightning-css-minify'\nconst CSS_FILE_REG = /\\.css(?:\\?.*)?$/i\n\nexport class LightningCssMinifyPlugin {\n private readonly options: any\n private transform: any | undefined\n\n constructor(opts: any = {}) {\n const { implementation, ...otherOpts } = opts\n if (implementation && typeof implementation.transformCss !== 'function') {\n throw new TypeError(\n `[LightningCssMinifyPlugin]: implementation.transformCss must be an 'lightningcss' transform function. Received ${typeof implementation.transformCss}`\n )\n }\n\n this.transform = implementation?.transformCss\n this.options = otherOpts\n }\n\n apply(compiler: Compiler) {\n const meta = JSON.stringify({\n name: '@next/lightningcss-loader',\n version: '0.0.0',\n options: this.options,\n })\n\n compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {\n compilation.hooks.chunkHash.tap(PLUGIN_NAME, (_, hash) =>\n hash.update(meta)\n )\n\n compilation.hooks.processAssets.tapPromise(\n {\n name: PLUGIN_NAME,\n stage: webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE,\n additionalAssets: true,\n },\n async () => await this.transformAssets(compilation)\n )\n\n compilation.hooks.statsPrinter.tap(PLUGIN_NAME, (statsPrinter) => {\n statsPrinter.hooks.print\n .for('asset.info.minimized')\n // @ts-ignore\n .tap(PLUGIN_NAME, (minimized, { green, formatFlag }) => {\n // @ts-ignore\n return minimized ? green(formatFlag('minimized')) : undefined\n })\n })\n })\n }\n\n private async transformAssets(compilation: Compilation): Promise<void> {\n const {\n options: { devtool },\n } = compilation.compiler\n\n if (!this.transform) {\n this.transform = getBindingsSync().css.lightning.transform\n }\n\n const sourcemap =\n this.options.sourceMap === undefined\n ? ((devtool && (devtool as string).includes('source-map')) as boolean)\n : this.options.sourceMap\n\n const {\n include,\n exclude,\n test: testRegExp,\n targets: userTargets,\n ...transformOptions\n } = this.options\n\n const assets = compilation.getAssets().filter(\n (asset) =>\n // Filter out already minimized\n !asset.info.minimized &&\n // Filter out by file type\n (testRegExp || CSS_FILE_REG).test(asset.name) &&\n ModuleFilenameHelpers.matchObject({ include, exclude }, asset.name)\n )\n\n await Promise.all(\n assets.map(async (asset) => {\n const { source, map } = asset.source.sourceAndMap()\n const sourceAsString = source.toString()\n const code = typeof source === 'string' ? Buffer.from(source) : source\n const targets = getTargets({\n targets: userTargets,\n key: ECacheKey.minify,\n })\n\n const result = await this.transform!({\n filename: asset.name,\n code,\n minify: true,\n sourceMap: sourcemap,\n targets,\n ...transformOptions,\n })\n const codeString = result.code.toString()\n\n compilation.updateAsset(\n asset.name,\n // @ts-ignore\n sourcemap\n ? new SourceMapSource(\n codeString,\n asset.name,\n JSON.parse(result.map!.toString()),\n sourceAsString,\n map as any,\n true\n )\n : new RawSource(codeString),\n {\n ...asset.info,\n minimized: true,\n }\n )\n })\n )\n }\n}\n"],"names":["ModuleFilenameHelpers","webpack","RawSource","SourceMapSource","ECacheKey","getTargets","Buffer","getBindingsSync","PLUGIN_NAME","CSS_FILE_REG","LightningCssMinifyPlugin","constructor","opts","implementation","otherOpts","transformCss","TypeError","transform","options","apply","compiler","meta","JSON","stringify","name","version","hooks","compilation","tap","chunkHash","_","hash","update","processAssets","tapPromise","stage","Compilation","PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE","additionalAssets","transformAssets","statsPrinter","print","for","minimized","green","formatFlag","undefined","devtool","css","lightning","sourcemap","sourceMap","includes","include","exclude","test","testRegExp","targets","userTargets","transformOptions","assets","getAssets","filter","asset","info","matchObject","Promise","all","map","source","sourceAndMap","sourceAsString","toString","code","from","key","minify","result","filename","codeString","updateAsset","parse"],"mappings":"AAAA,aAAa;AACb,SAASA,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MAAMZ,UAAUpD,WAAW;gBACzBoD,SAASC;gBACTiB,KAAKvE,UAAUwE,MAAM;YACvB;YAEA,MAAMC,SAAS,MAAM,IAAI,CAAC5D,SAAS,CAAE;gBACnC6D,UAAUf,MAAMvC,IAAI;gBACpBiD;gBACAG,QAAQ;gBACRzB,WAAWD;gBACXO;gBACA,GAAGE,gBAAgB;YACrB;YACA,MAAMoB,aAAaF,OAAOJ,IAAI,CAACD,QAAQ;YAEvC7C,YAAYqD,WAAW,CACrBjB,MAAMvC,IAAI,EACV,aAAa;YACb0B,YACI,IAAI/C,gBACF4E,YACAhB,MAAMvC,IAAI,EACVF,KAAK2D,KAAK,CAACJ,OAAOT,GAAG,CAAEI,QAAQ,KAC/BD,gBACAH,KACA,QAEF,IAAIlE,UAAU6E,aAClB;gBACE,GAAGhB,MAAMC,IAAI;gBACbrB,WAAW;YACb;QAEJ;IAEJ;AACF","ignoreList":[0]}
@@ -18,6 +18,7 @@ import { PARALLEL_ROUTE_DEFAULT_PATH } from '../../../../client/components/built
18
18
  import { createAppRouteCode } from './create-app-route-code';
19
19
  import { MissingDefaultParallelRouteError } from '../../../../shared/lib/errors/missing-default-parallel-route-error';
20
20
  import { normalizePathSep } from '../../../../shared/lib/page-path/normalize-path-sep';
21
+ import { installBindings } from '../../../swc/install-bindings';
21
22
  const HTTP_ACCESS_FALLBACKS = {
22
23
  'not-found': 'not-found',
23
24
  forbidden: 'forbidden',
@@ -419,6 +420,11 @@ function createAbsolutePath(appDir, pathToTurnAbsolute) {
419
420
  }
420
421
  const filesInDirMapMap = new WeakMap();
421
422
  const nextAppLoader = async function nextAppLoader() {
423
+ // install native bindings early so they are always available.
424
+ // When run by webpack, next will have already done this, so this will be fast,
425
+ // but if run by turbopack in a subprocess it is required. In that case we cannot pass the
426
+ // `useWasmBinary` flag, but that is ok since turbopack doesn't currently support wasm.
427
+ await installBindings();
422
428
  const loaderOptions = this.getOptions();
423
429
  const { name, appDir, appPaths, pagePath, pageExtensions, rootDir, tsconfigPath, isDev, nextConfigOutput, preferredRegion, basePath, middlewareConfig: middlewareConfigBase64 } = loaderOptions;
424
430
  const isGlobalNotFoundEnabled = !!loaderOptions.isGlobalNotFoundEnabled;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/build/webpack/loaders/next-app-loader/index.ts"],"sourcesContent":["import type webpack from 'next/dist/compiled/webpack/webpack'\nimport {\n UNDERSCORE_GLOBAL_ERROR_ROUTE,\n UNDERSCORE_NOT_FOUND_ROUTE,\n type ValueOf,\n} from '../../../../shared/lib/constants'\nimport {\n UNDERSCORE_GLOBAL_ERROR_ROUTE_ENTRY,\n UNDERSCORE_NOT_FOUND_ROUTE_ENTRY,\n} from '../../../../shared/lib/entry-constants'\nimport type { ModuleTuple, CollectedMetadata } from '../metadata/types'\n\nimport path from 'path'\nimport { bold } from '../../../../lib/picocolors'\nimport { getModuleBuildInfo } from '../get-module-build-info'\nimport { verifyRootLayout } from '../../../../lib/verify-root-layout'\nimport * as Log from '../../../output/log'\nimport { APP_DIR_ALIAS } from '../../../../lib/constants'\nimport {\n createMetadataExportsCode,\n createStaticMetadataFromRoute,\n} from '../metadata/discover'\nimport { promises as fs } from 'fs'\nimport { isAppRouteRoute } from '../../../../lib/is-app-route-route'\nimport type { NextConfig } from '../../../../server/config-shared'\nimport { AppPathnameNormalizer } from '../../../../server/normalizers/built/app/app-pathname-normalizer'\nimport type { ProxyConfig } from '../../../analysis/get-page-static-info'\nimport { isAppBuiltinPage } from '../../../utils'\nimport { loadEntrypoint } from '../../../load-entrypoint'\nimport {\n isGroupSegment,\n DEFAULT_SEGMENT_KEY,\n PAGE_SEGMENT_KEY,\n} from '../../../../shared/lib/segment'\nimport { getFilesInDir } from '../../../../lib/get-files-in-dir'\nimport type { PageExtensions } from '../../../page-extensions-type'\nimport { PARALLEL_ROUTE_DEFAULT_PATH } from '../../../../client/components/builtin/default'\nimport type { Compilation } from 'webpack'\nimport { createAppRouteCode } from './create-app-route-code'\nimport { MissingDefaultParallelRouteError } from '../../../../shared/lib/errors/missing-default-parallel-route-error'\nimport { normalizePathSep } from '../../../../shared/lib/page-path/normalize-path-sep'\n\nexport type AppLoaderOptions = {\n name: string\n page: string\n pagePath: string\n appDir: string\n appPaths: readonly string[] | null\n preferredRegion: string | string[] | undefined\n pageExtensions: PageExtensions\n assetPrefix: string\n rootDir?: string\n tsconfigPath?: string\n isDev?: true\n basePath: string\n nextConfigOutput?: NextConfig['output']\n middlewareConfig: string\n isGlobalNotFoundEnabled: true | undefined\n}\ntype AppLoader = webpack.LoaderDefinitionFunction<AppLoaderOptions>\n\nconst HTTP_ACCESS_FALLBACKS = {\n 'not-found': 'not-found',\n forbidden: 'forbidden',\n unauthorized: 'unauthorized',\n} as const\nconst defaultHTTPAccessFallbackPaths = {\n 'not-found': 'next/dist/client/components/builtin/not-found.js',\n forbidden: 'next/dist/client/components/builtin/forbidden.js',\n unauthorized: 'next/dist/client/components/builtin/unauthorized.js',\n} as const\n\nconst FILE_TYPES = {\n layout: 'layout',\n template: 'template',\n error: 'error',\n loading: 'loading',\n 'global-error': 'global-error',\n 'global-not-found': 'global-not-found',\n ...HTTP_ACCESS_FALLBACKS,\n} as const\n\nconst GLOBAL_ERROR_FILE_TYPE = 'global-error'\nconst GLOBAL_NOT_FOUND_FILE_TYPE = 'global-not-found'\nconst PAGE_SEGMENT = 'page$'\nconst PARALLEL_VIRTUAL_SEGMENT = 'slot$'\n\nconst defaultGlobalErrorPath =\n 'next/dist/client/components/builtin/global-error.js'\nconst defaultNotFoundPath = 'next/dist/client/components/builtin/not-found.js'\nconst defaultEmptyStubPath = 'next/dist/client/components/builtin/empty-stub.js'\nconst defaultLayoutPath = 'next/dist/client/components/builtin/layout.js'\nconst defaultGlobalNotFoundPath =\n 'next/dist/client/components/builtin/global-not-found.js'\nconst appErrorPath = 'next/dist/client/components/builtin/app-error.js'\n\ntype DirResolver = (pathToResolve: string) => string\ntype PathResolver = (\n pathname: string\n) => Promise<string | undefined> | string | undefined\nexport type MetadataResolver = (\n dir: string,\n filename: string,\n extensions: readonly string[]\n) => Promise<string | undefined>\n\nexport type AppDirModules = {\n readonly [moduleKey in ValueOf<typeof FILE_TYPES>]?: ModuleTuple\n} & {\n readonly page?: ModuleTuple\n} & {\n readonly metadata?: CollectedMetadata\n} & {\n readonly defaultPage?: ModuleTuple\n}\n\nconst normalizeParallelKey = (key: string) =>\n key.startsWith('@') ? key.slice(1) : key\n\nconst isCatchAllSegment = (segment: string) =>\n segment.startsWith('[...') || segment.startsWith('[[...')\n\nconst isDirectory = async (pathname: string) => {\n try {\n const stat = await fs.stat(pathname)\n return stat.isDirectory()\n } catch (err) {\n return false\n }\n}\n\nasync function createTreeCodeFromPath(\n pagePath: string,\n {\n page,\n resolveDir,\n resolver,\n resolveParallelSegments,\n hasChildRoutesForSegment,\n metadataResolver,\n pageExtensions,\n basePath,\n collectedDeclarations,\n isGlobalNotFoundEnabled,\n }: {\n page: string\n resolveDir: DirResolver\n resolver: PathResolver\n metadataResolver: MetadataResolver\n resolveParallelSegments: (\n pathname: string\n ) => [key: string, segment: string | string[]][]\n hasChildRoutesForSegment: (segmentPath: string) => boolean\n loaderContext: webpack.LoaderContext<AppLoaderOptions>\n pageExtensions: PageExtensions\n basePath: string\n collectedDeclarations: [string, string][]\n isGlobalNotFoundEnabled: boolean\n }\n): Promise<{\n treeCode: string\n rootLayout: string | undefined\n globalError: string\n globalNotFound: string\n}> {\n const splittedPath = pagePath.split(/[\\\\/]/, 1)\n const isNotFoundRoute = page === UNDERSCORE_NOT_FOUND_ROUTE_ENTRY\n const isAppErrorRoute = page === UNDERSCORE_GLOBAL_ERROR_ROUTE_ENTRY\n const isDefaultNotFound = isAppBuiltinPage(pagePath)\n\n const appDirPrefix = isDefaultNotFound ? APP_DIR_ALIAS : splittedPath[0]\n\n let rootLayout: string | undefined\n let globalError: string = defaultGlobalErrorPath\n let globalNotFound: string = defaultNotFoundPath\n\n async function resolveAdjacentParallelSegments(\n segmentPath: string\n ): Promise<string[]> {\n const absoluteSegmentPath = resolveDir(`${appDirPrefix}${segmentPath}`)\n\n if (!absoluteSegmentPath) {\n return []\n }\n\n const segmentIsDirectory = await isDirectory(absoluteSegmentPath)\n\n if (!segmentIsDirectory) {\n return []\n }\n\n // We need to resolve all parallel routes in this level.\n const files = await fs.opendir(absoluteSegmentPath)\n\n const parallelSegments: string[] = ['children']\n\n for await (const dirent of files) {\n // Make sure name starts with \"@\" and is a directory.\n if (dirent.isDirectory() && dirent.name.charCodeAt(0) === 64) {\n parallelSegments.push(dirent.name)\n }\n }\n\n return parallelSegments\n }\n\n async function createSubtreePropsFromSegmentPath(\n segments: string[],\n nestedCollectedDeclarations: [string, string][]\n ): Promise<{\n treeCode: string\n }> {\n const segmentPath = segments.join('/')\n\n // Existing tree are the children of the current segment\n const props: Record<string, string> = {}\n // Root layer could be 1st layer of normal routes\n const isRootLayer = segments.length === 0\n const isRootLayoutOrRootPage = segments.length <= 1\n\n // We need to resolve all parallel routes in this level.\n const parallelSegments: [key: string, segment: string | string[]][] = []\n if (isRootLayer) {\n parallelSegments.push(['children', ''])\n } else {\n parallelSegments.push(...resolveParallelSegments(segmentPath))\n }\n\n let metadata: Awaited<ReturnType<typeof createStaticMetadataFromRoute>> =\n null\n const routerDirPath = `${appDirPrefix}${segmentPath}`\n const resolvedRouteDir = resolveDir(routerDirPath)\n\n if (\n resolvedRouteDir &&\n // Do not collect metadata for app-error route as it's for generating pure static 500.html\n !normalizePathSep(pagePath).endsWith(appErrorPath)\n ) {\n metadata = await createStaticMetadataFromRoute(resolvedRouteDir, {\n basePath,\n segment: segmentPath,\n metadataResolver,\n isRootLayoutOrRootPage,\n pageExtensions,\n })\n }\n\n for (const [parallelKey, parallelSegment] of parallelSegments) {\n // if parallelSegment is the page segment (ie, `page$` and not ['page$']), it gets loaded into the __PAGE__ slot\n // as it's the page for the current route.\n if (parallelSegment === PAGE_SEGMENT) {\n const matchedPagePath = `${appDirPrefix}${segmentPath}${\n parallelKey === 'children' ? '' : `/${parallelKey}`\n }/page`\n\n const resolvedPagePath = await resolver(matchedPagePath)\n if (resolvedPagePath) {\n const varName = `page${nestedCollectedDeclarations.length}`\n nestedCollectedDeclarations.push([varName, resolvedPagePath])\n\n // Use '' for segment as it's the page. There can't be a segment called '' so this is the safest way to add it.\n props[normalizeParallelKey(parallelKey)] =\n `['${PAGE_SEGMENT_KEY}', {}, {\n page: [${varName}, ${JSON.stringify(resolvedPagePath)}],\n ${createMetadataExportsCode(metadata)}\n }]`\n continue\n } else {\n throw new Error(`Can't resolve ${matchedPagePath}`)\n }\n }\n\n // if the parallelSegment was not matched to the __PAGE__ slot, then it's a parallel route at this level.\n // the code below recursively traverses the parallel slots directory to match the corresponding __PAGE__ for each parallel slot\n // while also filling in layout/default/etc files into the loader tree at each segment level.\n\n const subSegmentPath = [...segments]\n if (parallelKey !== 'children') {\n // A `children` parallel key should have already been processed in the above segment\n // So we exclude it when constructing the subsegment path for the remaining segment levels\n subSegmentPath.push(parallelKey)\n }\n\n const normalizedParallelSegment = Array.isArray(parallelSegment)\n ? parallelSegment[0]\n : parallelSegment\n\n if (\n normalizedParallelSegment !== PAGE_SEGMENT &&\n normalizedParallelSegment !== PARALLEL_VIRTUAL_SEGMENT\n ) {\n // If we don't have a page segment, nor a special $children marker, it means we need to traverse the next directory\n // (ie, `normalizedParallelSegment` would correspond with the folder that contains the next level of pages/layout/etc)\n // we push it to the subSegmentPath so that we can fill in the loader tree for that segment.\n subSegmentPath.push(normalizedParallelSegment)\n }\n\n const parallelSegmentPath = subSegmentPath.join('/')\n\n // Fill in the loader tree for all of the special files types (layout, default, etc) at this level\n // `page` is not included here as it's added above.\n const filePathEntries = await Promise.all(\n Object.values(FILE_TYPES).map(async (file) => {\n return [\n file,\n await resolver(\n `${appDirPrefix}${\n // TODO-APP: parallelSegmentPath sometimes ends in `/` but sometimes it doesn't. This should be consistent.\n parallelSegmentPath.endsWith('/')\n ? parallelSegmentPath\n : parallelSegmentPath + '/'\n }${file}`\n ),\n ] as const\n })\n )\n const filePaths = new Map<ValueOf<typeof FILE_TYPES>, string | undefined>(\n filePathEntries\n )\n\n // Only resolve global-* convention files at the root layer\n if (isRootLayer) {\n const resolvedGlobalErrorPath = await resolver(\n `${appDirPrefix}/${GLOBAL_ERROR_FILE_TYPE}`\n )\n if (resolvedGlobalErrorPath) {\n globalError = resolvedGlobalErrorPath\n }\n // Add global-error to root layer's filePaths, so that it's always available,\n // by default it's the built-in global-error.js\n filePaths.set(GLOBAL_ERROR_FILE_TYPE, globalError)\n\n // TODO(global-not-found): remove this flag assertion condition\n // once global-not-found is stable\n if (isGlobalNotFoundEnabled) {\n const resolvedGlobalNotFoundPath = await resolver(\n `${appDirPrefix}/${GLOBAL_NOT_FOUND_FILE_TYPE}`\n )\n if (resolvedGlobalNotFoundPath) {\n globalNotFound = resolvedGlobalNotFoundPath\n }\n // Add global-not-found to root layer's filePaths, so that it's always available,\n // by default it's the built-in global-not-found.js\n filePaths.set(GLOBAL_NOT_FOUND_FILE_TYPE, globalNotFound)\n }\n }\n\n let definedFilePaths = Array.from(filePaths.entries()).filter(\n ([, filePath]) => filePath !== undefined\n ) as [ValueOf<typeof FILE_TYPES>, string][]\n\n // Add default access fallback as root fallback if not present\n const existedConventionNames = new Set(\n definedFilePaths.map(([type]) => type)\n )\n // If the first layer is a group route, we treat it as root layer\n const isFirstLayerGroupRoute =\n segments.length === 1 &&\n subSegmentPath.filter((seg) => isGroupSegment(seg)).length === 1\n\n if (isRootLayer || isFirstLayerGroupRoute) {\n const accessFallbackTypes = Object.keys(\n defaultHTTPAccessFallbackPaths\n ) as (keyof typeof defaultHTTPAccessFallbackPaths)[]\n for (const type of accessFallbackTypes) {\n const hasRootFallbackFile = await resolver(\n `${appDirPrefix}/${FILE_TYPES[type]}`\n )\n const hasLayerFallbackFile = existedConventionNames.has(type)\n\n // If you already have a root access error fallback, don't insert default access error boundary to group routes root\n if (\n // Is treated as root layout and without boundary\n !(hasRootFallbackFile && isFirstLayerGroupRoute) &&\n // Does not have a fallback boundary file\n !hasLayerFallbackFile\n ) {\n const defaultFallbackPath = defaultHTTPAccessFallbackPaths[type]\n if (!(isDefaultNotFound && type === 'not-found')) {\n definedFilePaths.push([type, defaultFallbackPath])\n }\n }\n }\n }\n\n if (!rootLayout) {\n const layoutPath = definedFilePaths.find(\n ([type]) => type === 'layout'\n )?.[1]\n rootLayout = layoutPath\n\n // When `global-not-found` is disabled, we insert a default layout if\n // root layout is presented. This logic and the default layout will be removed\n // once `global-not-found` is stabilized.\n if (\n !isGlobalNotFoundEnabled &&\n isDefaultNotFound &&\n !layoutPath &&\n !rootLayout\n ) {\n rootLayout = defaultLayoutPath\n definedFilePaths.push(['layout', rootLayout])\n }\n }\n\n let parallelSegmentKey = Array.isArray(parallelSegment)\n ? parallelSegment[0]\n : parallelSegment\n\n // normalize the parallel segment key to remove any special markers that we inserted in the\n // earlier logic (such as children$ and page$). These should never appear in the loader tree, and\n // should instead be the corresponding segment keys (ie `__PAGE__`) or the `children` parallel route.\n parallelSegmentKey =\n parallelSegmentKey === PARALLEL_VIRTUAL_SEGMENT\n ? '(slot)'\n : parallelSegmentKey === PAGE_SEGMENT\n ? PAGE_SEGMENT_KEY\n : parallelSegmentKey\n\n const normalizedParallelKey = normalizeParallelKey(parallelKey)\n let subtreeCode: string | undefined\n // If it's root not found page, set not-found boundary as children page\n if (isNotFoundRoute) {\n if (normalizedParallelKey === 'children') {\n const matchedGlobalNotFound = isGlobalNotFoundEnabled\n ? (definedFilePaths.find(\n ([type]) => type === GLOBAL_NOT_FOUND_FILE_TYPE\n )?.[1] ?? defaultGlobalNotFoundPath)\n : undefined\n\n // If custom global-not-found.js is defined, use global-not-found.js\n if (matchedGlobalNotFound) {\n const varName = `notFound${nestedCollectedDeclarations.length}`\n nestedCollectedDeclarations.push([varName, matchedGlobalNotFound])\n const layoutName = `layout${nestedCollectedDeclarations.length}`\n nestedCollectedDeclarations.push([layoutName, defaultEmptyStubPath])\n subtreeCode = `{\n children: [${JSON.stringify(UNDERSCORE_NOT_FOUND_ROUTE)}, {\n children: ['${PAGE_SEGMENT_KEY}', {}, {\n layout: [\n ${varName},\n ${JSON.stringify(matchedGlobalNotFound)}\n ],\n page: [\n ${layoutName},\n ${JSON.stringify(defaultEmptyStubPath)}\n ]\n }]\n }, {}]\n }`\n } else {\n // If custom not-found.js is found, use it and layout to compose the page,\n // and fallback to built-in not-found component if doesn't exist.\n const notFoundPath =\n definedFilePaths.find(([type]) => type === 'not-found')?.[1] ??\n defaultNotFoundPath\n const varName = `notFound${nestedCollectedDeclarations.length}`\n nestedCollectedDeclarations.push([varName, notFoundPath])\n subtreeCode = `{\n children: [${JSON.stringify(UNDERSCORE_NOT_FOUND_ROUTE.slice(1))}, {\n children: ['${PAGE_SEGMENT_KEY}', {}, {\n page: [\n ${varName},\n ${JSON.stringify(notFoundPath)}\n ]\n }]\n }, {}]\n }`\n }\n }\n }\n\n // If it's app-error route, set app-error as children page\n if (isAppErrorRoute) {\n const varName = `appError${nestedCollectedDeclarations.length}`\n nestedCollectedDeclarations.push([varName, appErrorPath])\n subtreeCode = `{\n children: [${JSON.stringify(UNDERSCORE_GLOBAL_ERROR_ROUTE.slice(1))}, {\n children: ['${PAGE_SEGMENT_KEY}', {}, {\n page: [\n ${varName},\n ${JSON.stringify(appErrorPath)}\n ]\n }]\n }, {}]\n }`\n }\n\n // For 404 route\n // if global-not-found is in definedFilePaths, remove root layout for /_not-found,\n // and change it to global-not-found route.\n // TODO: remove this once global-not-found is stable.\n if (isNotFoundRoute && isGlobalNotFoundEnabled) {\n definedFilePaths = definedFilePaths.filter(\n ([type]) => type !== 'layout'\n )\n\n // Replace the layout to global-not-found\n definedFilePaths.push([\n 'layout',\n definedFilePaths.find(\n ([type]) => type === GLOBAL_NOT_FOUND_FILE_TYPE\n )?.[1] ?? defaultGlobalNotFoundPath,\n ])\n }\n\n if (isAppErrorRoute) {\n definedFilePaths = definedFilePaths.filter(\n ([type]) => type !== 'layout'\n )\n }\n\n const modulesCode = `{\n ${definedFilePaths\n .map(([file, filePath]) => {\n const varName = `module${nestedCollectedDeclarations.length}`\n nestedCollectedDeclarations.push([varName, filePath])\n return `'${file}': [${varName}, ${JSON.stringify(filePath)}],`\n })\n .join('\\n')}\n ${createMetadataExportsCode(metadata)}\n }`\n\n if (!subtreeCode) {\n const { treeCode: pageSubtreeCode } =\n await createSubtreePropsFromSegmentPath(\n subSegmentPath,\n nestedCollectedDeclarations\n )\n\n subtreeCode = pageSubtreeCode\n }\n\n props[normalizedParallelKey] = `[\n '${parallelSegmentKey}',\n ${subtreeCode},\n ${modulesCode}\n ]`\n }\n\n const adjacentParallelSegments =\n await resolveAdjacentParallelSegments(segmentPath)\n\n for (const adjacentParallelSegment of adjacentParallelSegments) {\n if (!props[normalizeParallelKey(adjacentParallelSegment)]) {\n const actualSegment =\n adjacentParallelSegment === 'children'\n ? ''\n : `/${adjacentParallelSegment}`\n\n // Use the default path if it's found, otherwise if it's a children\n // slot, then use the fallback (which triggers a `notFound()`). If this\n // isn't a children slot, then throw an error, as it produces a silent\n // 404 if we'd used the fallback.\n const fullSegmentPath = `${appDirPrefix}${segmentPath}${actualSegment}`\n let defaultPath = await resolver(`${fullSegmentPath}/default`)\n if (!defaultPath) {\n if (adjacentParallelSegment === 'children') {\n defaultPath = PARALLEL_ROUTE_DEFAULT_PATH\n } else {\n // Check if we're inside a catch-all route (i.e., the parallel route is a child\n // of a catch-all segment). Only skip validation if the slot is UNDER a catch-all.\n // For example:\n // /[...catchAll]/@slot - isInsideCatchAll = true (skip validation) ✓\n // /@slot/[...catchAll] - isInsideCatchAll = false (require default) ✓\n // The catch-all provides fallback behavior, so default.js is not required.\n const isInsideCatchAll = segments.some(isCatchAllSegment)\n\n // Check if this is a leaf segment (no child routes).\n // Leaf segments don't need default.js because there are no child routes\n // that could cause the parallel slot to unmatch. For example:\n // /repo-overview/@slot/page with no child routes - isLeafSegment = true (skip validation) ✓\n // /repo-overview/@slot/page with /repo-overview/child/page - isLeafSegment = false (require default) ✓\n // This also handles route groups correctly by filtering them out.\n const isLeafSegment = !hasChildRoutesForSegment(segmentPath)\n\n if (!isInsideCatchAll && !isLeafSegment) {\n // Replace internal webpack alias with user-facing directory name\n const userFacingPath = fullSegmentPath.replace(\n APP_DIR_ALIAS,\n 'app'\n )\n throw new MissingDefaultParallelRouteError(\n userFacingPath,\n adjacentParallelSegment\n )\n }\n defaultPath = PARALLEL_ROUTE_DEFAULT_PATH\n }\n }\n\n const varName = `default${nestedCollectedDeclarations.length}`\n nestedCollectedDeclarations.push([varName, defaultPath])\n props[normalizeParallelKey(adjacentParallelSegment)] = `[\n '${DEFAULT_SEGMENT_KEY}',\n {},\n {\n defaultPage: [${varName}, ${JSON.stringify(defaultPath)}],\n }\n ]`\n }\n }\n return {\n treeCode: `{\n ${Object.entries(props)\n .map(([key, value]) => `${key}: ${value}`)\n .join(',\\n')}\n }`,\n }\n }\n\n const { treeCode } = await createSubtreePropsFromSegmentPath(\n [],\n collectedDeclarations\n )\n\n return {\n treeCode: `${treeCode}.children;`,\n rootLayout,\n globalError,\n globalNotFound,\n }\n}\n\nfunction createAbsolutePath(appDir: string, pathToTurnAbsolute: string) {\n return (\n pathToTurnAbsolute\n // Replace all POSIX path separators with the current OS path separator\n .replace(/\\//g, path.sep)\n .replace(/^private-next-app-dir/, appDir)\n )\n}\n\nconst filesInDirMapMap: WeakMap<\n Compilation,\n Map<string, Promise<Set<string>>>\n> = new WeakMap()\nconst nextAppLoader: AppLoader = async function nextAppLoader() {\n const loaderOptions = this.getOptions()\n const {\n name,\n appDir,\n appPaths,\n pagePath,\n pageExtensions,\n rootDir,\n tsconfigPath,\n isDev,\n nextConfigOutput,\n preferredRegion,\n basePath,\n middlewareConfig: middlewareConfigBase64,\n } = loaderOptions\n\n const isGlobalNotFoundEnabled = !!loaderOptions.isGlobalNotFoundEnabled\n\n // Update FILE_TYPES on the very top-level of the loader\n if (!isGlobalNotFoundEnabled) {\n // @ts-expect-error this delete is only necessary while experimental\n delete FILE_TYPES['global-not-found']\n }\n\n const buildInfo = getModuleBuildInfo((this as any)._module)\n const collectedDeclarations: [string, string][] = []\n const page = name.replace(/^app/, '')\n const middlewareConfig: ProxyConfig = JSON.parse(\n Buffer.from(middlewareConfigBase64, 'base64').toString()\n )\n buildInfo.route = {\n page,\n absolutePagePath: createAbsolutePath(appDir, pagePath),\n preferredRegion,\n middlewareConfig,\n relatedModules: [],\n }\n\n const extensions =\n typeof pageExtensions === 'string'\n ? [pageExtensions]\n : pageExtensions.map((extension) => `.${extension}`)\n\n const normalizedAppPaths =\n typeof appPaths === 'string' ? [appPaths] : appPaths || []\n\n const resolveParallelSegments = (\n pathname: string\n ): [string, string | string[]][] => {\n const matched: Record<string, string | string[]> = {}\n let existingChildrenPath: string | undefined\n for (const appPath of normalizedAppPaths) {\n if (appPath.startsWith(pathname + '/')) {\n const rest = appPath.slice(pathname.length + 1).split('/')\n\n // It is the actual page, mark it specially.\n if (rest.length === 1 && rest[0] === 'page') {\n existingChildrenPath = appPath\n matched.children = PAGE_SEGMENT\n continue\n }\n\n const isParallelRoute = rest[0].startsWith('@')\n if (isParallelRoute) {\n if (rest.length === 2 && rest[1] === 'page') {\n // We found a parallel route at this level. We don't want to mark it explicitly as the page segment,\n // as that should be matched to the `children` slot. Instead, we use an array, to signal to `createSubtreePropsFromSegmentPath`\n // that it needs to recursively fill in the loader tree code for the parallel route at the appropriate levels.\n matched[rest[0]] = [PAGE_SEGMENT]\n continue\n }\n // If it was a parallel route but we weren't able to find the page segment (ie, maybe the page is nested further)\n // we first insert a special marker to ensure that we still process layout/default/etc at the slot level prior to continuing\n // on to the page segment.\n matched[rest[0]] = [PARALLEL_VIRTUAL_SEGMENT, ...rest.slice(1)]\n continue\n }\n\n if (existingChildrenPath && matched.children !== rest[0]) {\n // If we get here, it means we already set a `page` segment earlier in the loop,\n // meaning we already matched a page to the `children` parallel segment.\n const isIncomingParallelPage = appPath.includes('@')\n const hasCurrentParallelPage = existingChildrenPath.includes('@')\n\n if (isIncomingParallelPage) {\n // The duplicate segment was for a parallel slot. In this case,\n // rather than throwing an error, we can ignore it since this can happen for valid reasons.\n // For example, when we attempt to normalize catch-all routes, we'll push potential slot matches so\n // that they are available in the loader tree when we go to render the page.\n // We only need to throw an error if the duplicate segment was for a regular page.\n // For example, /app/(groupa)/page & /app/(groupb)/page is an error since it corresponds\n // with the same path.\n continue\n } else if (!hasCurrentParallelPage && !isIncomingParallelPage) {\n // Both the current `children` and the incoming `children` are regular pages.\n throw new Error(\n `You cannot have two parallel pages that resolve to the same path. Please check ${existingChildrenPath} and ${appPath}. Refer to the route group docs for more information: https://nextjs.org/docs/app/building-your-application/routing/route-groups`\n )\n }\n }\n\n existingChildrenPath = appPath\n matched.children = rest[0]\n }\n }\n\n return Object.entries(matched)\n }\n\n const hasChildRoutesForSegment = (segmentPath: string): boolean => {\n const pathPrefix = segmentPath ? `${segmentPath}/` : ''\n\n for (const appPath of normalizedAppPaths) {\n if (appPath.startsWith(pathPrefix)) {\n const rest = appPath.slice(pathPrefix.length).split('/')\n\n // Filter out route groups to get the actual route segments\n // Route groups (e.g., \"(group)\") don't contribute to the URL path\n const routeSegments = rest.filter((segment) => !isGroupSegment(segment))\n\n // If it's just 'page' at this level, skip (not a child route)\n if (routeSegments.length === 1 && routeSegments[0] === 'page') {\n continue\n }\n\n // If the first segment (after filtering route groups) is a parallel route, skip\n if (routeSegments[0]?.startsWith('@')) {\n continue\n }\n\n // If we have more than just 'page', then there are child routes\n // Examples:\n // ['child', 'page'] -> true (has child route)\n // ['page'] -> false (already filtered above)\n // ['grandchild', 'deeper', 'page'] -> true (has nested child routes)\n if (\n routeSegments.length > 1 ||\n (routeSegments.length === 1 && routeSegments[0] !== 'page')\n ) {\n return true\n }\n }\n }\n\n return false\n }\n\n const resolveDir: DirResolver = (pathToResolve) => {\n return createAbsolutePath(appDir, pathToResolve)\n }\n\n const resolveAppRoute: PathResolver = (pathToResolve) => {\n return createAbsolutePath(appDir, pathToResolve)\n }\n\n // Cached checker to see if a file exists in a given directory.\n // This can be more efficient than checking them with `fs.stat` one by one\n // because all the thousands of files are likely in a few possible directories.\n // Note that it should only be cached for this compilation, not globally.\n const fileExistsInDirectory = async (dirname: string, fileName: string) => {\n // I don't think we should ever hit this code path, but if we do we should handle it gracefully.\n if (this._compilation === undefined) {\n try {\n return (await getFilesInDir(dirname).catch(() => new Set())).has(\n fileName\n )\n } catch (e) {\n return false\n }\n }\n const map =\n filesInDirMapMap.get(this._compilation) ||\n new Map<string, Promise<Set<string>>>()\n if (!filesInDirMapMap.has(this._compilation)) {\n filesInDirMapMap.set(this._compilation, map)\n }\n if (!map.has(dirname)) {\n map.set(\n dirname,\n getFilesInDir(dirname).catch(() => new Set())\n )\n }\n return ((await map.get(dirname)) || new Set()).has(fileName)\n }\n\n const resolver: PathResolver = async (pathname) => {\n const absolutePath = createAbsolutePath(appDir, pathname)\n\n const filenameIndex = absolutePath.lastIndexOf(path.sep)\n const dirname = absolutePath.slice(0, filenameIndex)\n const filename = absolutePath.slice(filenameIndex + 1)\n\n let result: string | undefined\n\n for (const ext of extensions) {\n const absolutePathWithExtension = `${absolutePath}${ext}`\n if (\n !result &&\n (await fileExistsInDirectory(dirname, `${filename}${ext}`))\n ) {\n result = absolutePathWithExtension\n }\n // Call `addMissingDependency` for all files even if they didn't match,\n // because they might be added or removed during development.\n this.addMissingDependency(absolutePathWithExtension)\n }\n\n return result\n }\n\n const metadataResolver: MetadataResolver = async (\n dirname,\n filename,\n exts\n ) => {\n const absoluteDir = createAbsolutePath(appDir, dirname)\n\n let result: string | undefined\n\n for (const ext of exts) {\n // Compared to `resolver` above the exts do not have the `.` included already, so it's added here.\n const filenameWithExt = `${filename}.${ext}`\n const absolutePathWithExtension = `${absoluteDir}${path.sep}${filenameWithExt}`\n if (!result && (await fileExistsInDirectory(dirname, filenameWithExt))) {\n result = absolutePathWithExtension\n }\n // Call `addMissingDependency` for all files even if they didn't match,\n // because they might be added or removed during development.\n this.addMissingDependency(absolutePathWithExtension)\n }\n\n return result\n }\n\n if (isAppRouteRoute(name)) {\n return createAppRouteCode({\n appDir,\n // TODO: investigate if the local `page` is the same as the loaderOptions.page\n page: loaderOptions.page,\n name,\n pagePath,\n resolveAppRoute,\n pageExtensions,\n nextConfigOutput,\n })\n }\n\n let treeCodeResult = await createTreeCodeFromPath(pagePath, {\n page,\n resolveDir,\n resolver,\n metadataResolver,\n resolveParallelSegments,\n hasChildRoutesForSegment,\n loaderContext: this,\n pageExtensions,\n basePath,\n collectedDeclarations,\n isGlobalNotFoundEnabled,\n })\n\n const isGlobalNotFoundPath =\n page === UNDERSCORE_NOT_FOUND_ROUTE_ENTRY &&\n !!treeCodeResult.globalNotFound &&\n isGlobalNotFoundEnabled\n\n const isAppErrorRoute = page === UNDERSCORE_GLOBAL_ERROR_ROUTE_ENTRY\n\n if (!treeCodeResult.rootLayout && !isGlobalNotFoundPath && !isAppErrorRoute) {\n if (!isDev) {\n // If we're building and missing a root layout, exit the build\n Log.error(\n `${bold(\n pagePath.replace(`${APP_DIR_ALIAS}/`, '')\n )} doesn't have a root layout. To fix this error, make sure every page has a root layout.`\n )\n process.exit(1)\n } else {\n // In dev we'll try to create a root layout\n const [createdRootLayout, rootLayoutPath] = await verifyRootLayout({\n appDir: appDir,\n dir: rootDir!,\n tsconfigPath: tsconfigPath,\n pagePath,\n pageExtensions,\n })\n if (!createdRootLayout) {\n let message = `${bold(\n pagePath.replace(`${APP_DIR_ALIAS}/`, '')\n )} doesn't have a root layout. `\n\n if (rootLayoutPath) {\n message += `We tried to create ${bold(\n path.relative(this._compiler?.context ?? '', rootLayoutPath)\n )} for you but something went wrong.`\n } else {\n message +=\n 'To fix this error, make sure every page has a root layout.'\n }\n\n throw new Error(message)\n }\n\n // Clear fs cache, get the new result with the created root layout.\n if (this._compilation) filesInDirMapMap.get(this._compilation)?.clear()\n treeCodeResult = await createTreeCodeFromPath(pagePath, {\n page,\n resolveDir,\n resolver,\n metadataResolver,\n resolveParallelSegments,\n hasChildRoutesForSegment,\n loaderContext: this,\n pageExtensions,\n basePath,\n collectedDeclarations,\n isGlobalNotFoundEnabled,\n })\n }\n }\n\n const pathname = new AppPathnameNormalizer().normalize(page)\n\n // Prefer to modify next/src/server/app-render/entry-base.ts since this is shared with Turbopack.\n // Any changes to this code should be reflected in Turbopack's app_source.rs and/or app-renderer.tsx as well.\n const code = await loadEntrypoint(\n 'app-page',\n {\n VAR_DEFINITION_PAGE: page,\n VAR_DEFINITION_PATHNAME: pathname,\n VAR_MODULE_GLOBAL_ERROR: treeCodeResult.globalError,\n },\n {\n tree: treeCodeResult.treeCode,\n __next_app_require__: '__webpack_require__',\n // all modules are in the entry chunk, so we never actually need to load chunks in webpack\n __next_app_load_chunk__: '() => Promise.resolve()',\n }\n )\n\n // Lazily evaluate the imported modules in the generated code\n const header = collectedDeclarations\n .map(([varName, modulePath]) => {\n return `const ${varName} = () => import(/* webpackMode: \"eager\" */ ${JSON.stringify(\n modulePath\n )});\\n`\n })\n .join('')\n\n return header + code\n}\n\nexport default nextAppLoader\n"],"names":["UNDERSCORE_GLOBAL_ERROR_ROUTE","UNDERSCORE_NOT_FOUND_ROUTE","UNDERSCORE_GLOBAL_ERROR_ROUTE_ENTRY","UNDERSCORE_NOT_FOUND_ROUTE_ENTRY","path","bold","getModuleBuildInfo","verifyRootLayout","Log","APP_DIR_ALIAS","createMetadataExportsCode","createStaticMetadataFromRoute","promises","fs","isAppRouteRoute","AppPathnameNormalizer","isAppBuiltinPage","loadEntrypoint","isGroupSegment","DEFAULT_SEGMENT_KEY","PAGE_SEGMENT_KEY","getFilesInDir","PARALLEL_ROUTE_DEFAULT_PATH","createAppRouteCode","MissingDefaultParallelRouteError","normalizePathSep","HTTP_ACCESS_FALLBACKS","forbidden","unauthorized","defaultHTTPAccessFallbackPaths","FILE_TYPES","layout","template","error","loading","GLOBAL_ERROR_FILE_TYPE","GLOBAL_NOT_FOUND_FILE_TYPE","PAGE_SEGMENT","PARALLEL_VIRTUAL_SEGMENT","defaultGlobalErrorPath","defaultNotFoundPath","defaultEmptyStubPath","defaultLayoutPath","defaultGlobalNotFoundPath","appErrorPath","normalizeParallelKey","key","startsWith","slice","isCatchAllSegment","segment","isDirectory","pathname","stat","err","createTreeCodeFromPath","pagePath","page","resolveDir","resolver","resolveParallelSegments","hasChildRoutesForSegment","metadataResolver","pageExtensions","basePath","collectedDeclarations","isGlobalNotFoundEnabled","splittedPath","split","isNotFoundRoute","isAppErrorRoute","isDefaultNotFound","appDirPrefix","rootLayout","globalError","globalNotFound","resolveAdjacentParallelSegments","segmentPath","absoluteSegmentPath","segmentIsDirectory","files","opendir","parallelSegments","dirent","name","charCodeAt","push","createSubtreePropsFromSegmentPath","segments","nestedCollectedDeclarations","join","props","isRootLayer","length","isRootLayoutOrRootPage","metadata","routerDirPath","resolvedRouteDir","endsWith","parallelKey","parallelSegment","matchedPagePath","resolvedPagePath","varName","JSON","stringify","Error","subSegmentPath","normalizedParallelSegment","Array","isArray","parallelSegmentPath","filePathEntries","Promise","all","Object","values","map","file","filePaths","Map","resolvedGlobalErrorPath","set","resolvedGlobalNotFoundPath","definedFilePaths","from","entries","filter","filePath","undefined","existedConventionNames","Set","type","isFirstLayerGroupRoute","seg","accessFallbackTypes","keys","hasRootFallbackFile","hasLayerFallbackFile","has","defaultFallbackPath","layoutPath","find","parallelSegmentKey","normalizedParallelKey","subtreeCode","matchedGlobalNotFound","layoutName","notFoundPath","modulesCode","treeCode","pageSubtreeCode","adjacentParallelSegments","adjacentParallelSegment","actualSegment","fullSegmentPath","defaultPath","isInsideCatchAll","some","isLeafSegment","userFacingPath","replace","value","createAbsolutePath","appDir","pathToTurnAbsolute","sep","filesInDirMapMap","WeakMap","nextAppLoader","loaderOptions","getOptions","appPaths","rootDir","tsconfigPath","isDev","nextConfigOutput","preferredRegion","middlewareConfig","middlewareConfigBase64","buildInfo","_module","parse","Buffer","toString","route","absolutePagePath","relatedModules","extensions","extension","normalizedAppPaths","matched","existingChildrenPath","appPath","rest","children","isParallelRoute","isIncomingParallelPage","includes","hasCurrentParallelPage","pathPrefix","routeSegments","pathToResolve","resolveAppRoute","fileExistsInDirectory","dirname","fileName","_compilation","catch","e","get","absolutePath","filenameIndex","lastIndexOf","filename","result","ext","absolutePathWithExtension","addMissingDependency","exts","absoluteDir","filenameWithExt","treeCodeResult","loaderContext","isGlobalNotFoundPath","process","exit","createdRootLayout","rootLayoutPath","dir","message","relative","_compiler","context","clear","normalize","code","VAR_DEFINITION_PAGE","VAR_DEFINITION_PATHNAME","VAR_MODULE_GLOBAL_ERROR","tree","__next_app_require__","__next_app_load_chunk__","header","modulePath"],"mappings":"AACA,SACEA,6BAA6B,EAC7BC,0BAA0B,QAErB,mCAAkC;AACzC,SACEC,mCAAmC,EACnCC,gCAAgC,QAC3B,yCAAwC;AAG/C,OAAOC,UAAU,OAAM;AACvB,SAASC,IAAI,QAAQ,6BAA4B;AACjD,SAASC,kBAAkB,QAAQ,2BAA0B;AAC7D,SAASC,gBAAgB,QAAQ,qCAAoC;AACrE,YAAYC,SAAS,sBAAqB;AAC1C,SAASC,aAAa,QAAQ,4BAA2B;AACzD,SACEC,yBAAyB,EACzBC,6BAA6B,QACxB,uBAAsB;AAC7B,SAASC,YAAYC,EAAE,QAAQ,KAAI;AACnC,SAASC,eAAe,QAAQ,qCAAoC;AAEpE,SAASC,qBAAqB,QAAQ,mEAAkE;AAExG,SAASC,gBAAgB,QAAQ,iBAAgB;AACjD,SAASC,cAAc,QAAQ,2BAA0B;AACzD,SACEC,cAAc,EACdC,mBAAmB,EACnBC,gBAAgB,QACX,iCAAgC;AACvC,SAASC,aAAa,QAAQ,mCAAkC;AAEhE,SAASC,2BAA2B,QAAQ,gDAA+C;AAE3F,SAASC,kBAAkB,QAAQ,0BAAyB;AAC5D,SAASC,gCAAgC,QAAQ,qEAAoE;AACrH,SAASC,gBAAgB,QAAQ,sDAAqD;AAqBtF,MAAMC,wBAAwB;IAC5B,aAAa;IACbC,WAAW;IACXC,cAAc;AAChB;A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AAC,CAAC,CAACd,SAAS6I,WAAW;QACzB,OAAO,CAAC,MAAM,EAAE7I,QAAQ,2CAA2C,EAAEC,KAAKC,SAAS,CACjF2I,YACA,IAAI,CAAC;IACT,GACC1J,IAAI,CAAC;IAER,OAAOyJ,SAASP;AAClB;AAEA,eAAenE,cAAa","ignoreList":[0]}
1
+ {"version":3,"sources":["../../../../../../src/build/webpack/loaders/next-app-loader/index.ts"],"sourcesContent":["import type webpack from 'next/dist/compiled/webpack/webpack'\nimport {\n UNDERSCORE_GLOBAL_ERROR_ROUTE,\n UNDERSCORE_NOT_FOUND_ROUTE,\n type ValueOf,\n} from '../../../../shared/lib/constants'\nimport {\n UNDERSCORE_GLOBAL_ERROR_ROUTE_ENTRY,\n UNDERSCORE_NOT_FOUND_ROUTE_ENTRY,\n} from '../../../../shared/lib/entry-constants'\nimport type { ModuleTuple, CollectedMetadata } from '../metadata/types'\n\nimport path from 'path'\nimport { bold } from '../../../../lib/picocolors'\nimport { getModuleBuildInfo } from '../get-module-build-info'\nimport { verifyRootLayout } from '../../../../lib/verify-root-layout'\nimport * as Log from '../../../output/log'\nimport { APP_DIR_ALIAS } from '../../../../lib/constants'\nimport {\n createMetadataExportsCode,\n createStaticMetadataFromRoute,\n} from '../metadata/discover'\nimport { promises as fs } from 'fs'\nimport { isAppRouteRoute } from '../../../../lib/is-app-route-route'\nimport type { NextConfig } from '../../../../server/config-shared'\nimport { AppPathnameNormalizer } from '../../../../server/normalizers/built/app/app-pathname-normalizer'\nimport type { ProxyConfig } from '../../../analysis/get-page-static-info'\nimport { isAppBuiltinPage } from '../../../utils'\nimport { loadEntrypoint } from '../../../load-entrypoint'\nimport {\n isGroupSegment,\n DEFAULT_SEGMENT_KEY,\n PAGE_SEGMENT_KEY,\n} from '../../../../shared/lib/segment'\nimport { getFilesInDir } from '../../../../lib/get-files-in-dir'\nimport type { PageExtensions } from '../../../page-extensions-type'\nimport { PARALLEL_ROUTE_DEFAULT_PATH } from '../../../../client/components/builtin/default'\nimport type { Compilation } from 'webpack'\nimport { createAppRouteCode } from './create-app-route-code'\nimport { MissingDefaultParallelRouteError } from '../../../../shared/lib/errors/missing-default-parallel-route-error'\n\nimport { normalizePathSep } from '../../../../shared/lib/page-path/normalize-path-sep'\nimport { installBindings } from '../../../swc/install-bindings'\n\nexport type AppLoaderOptions = {\n name: string\n page: string\n pagePath: string\n appDir: string\n appPaths: readonly string[] | null\n preferredRegion: string | string[] | undefined\n pageExtensions: PageExtensions\n assetPrefix: string\n rootDir?: string\n tsconfigPath?: string\n isDev?: true\n basePath: string\n nextConfigOutput?: NextConfig['output']\n middlewareConfig: string\n isGlobalNotFoundEnabled: true | undefined\n}\ntype AppLoader = webpack.LoaderDefinitionFunction<AppLoaderOptions>\n\nconst HTTP_ACCESS_FALLBACKS = {\n 'not-found': 'not-found',\n forbidden: 'forbidden',\n unauthorized: 'unauthorized',\n} as const\nconst defaultHTTPAccessFallbackPaths = {\n 'not-found': 'next/dist/client/components/builtin/not-found.js',\n forbidden: 'next/dist/client/components/builtin/forbidden.js',\n unauthorized: 'next/dist/client/components/builtin/unauthorized.js',\n} as const\n\nconst FILE_TYPES = {\n layout: 'layout',\n template: 'template',\n error: 'error',\n loading: 'loading',\n 'global-error': 'global-error',\n 'global-not-found': 'global-not-found',\n ...HTTP_ACCESS_FALLBACKS,\n} as const\n\nconst GLOBAL_ERROR_FILE_TYPE = 'global-error'\nconst GLOBAL_NOT_FOUND_FILE_TYPE = 'global-not-found'\nconst PAGE_SEGMENT = 'page$'\nconst PARALLEL_VIRTUAL_SEGMENT = 'slot$'\n\nconst defaultGlobalErrorPath =\n 'next/dist/client/components/builtin/global-error.js'\nconst defaultNotFoundPath = 'next/dist/client/components/builtin/not-found.js'\nconst defaultEmptyStubPath = 'next/dist/client/components/builtin/empty-stub.js'\nconst defaultLayoutPath = 'next/dist/client/components/builtin/layout.js'\nconst defaultGlobalNotFoundPath =\n 'next/dist/client/components/builtin/global-not-found.js'\nconst appErrorPath = 'next/dist/client/components/builtin/app-error.js'\n\ntype DirResolver = (pathToResolve: string) => string\ntype PathResolver = (\n pathname: string\n) => Promise<string | undefined> | string | undefined\nexport type MetadataResolver = (\n dir: string,\n filename: string,\n extensions: readonly string[]\n) => Promise<string | undefined>\n\nexport type AppDirModules = {\n readonly [moduleKey in ValueOf<typeof FILE_TYPES>]?: ModuleTuple\n} & {\n readonly page?: ModuleTuple\n} & {\n readonly metadata?: CollectedMetadata\n} & {\n readonly defaultPage?: ModuleTuple\n}\n\nconst normalizeParallelKey = (key: string) =>\n key.startsWith('@') ? key.slice(1) : key\n\nconst isCatchAllSegment = (segment: string) =>\n segment.startsWith('[...') || segment.startsWith('[[...')\n\nconst isDirectory = async (pathname: string) => {\n try {\n const stat = await fs.stat(pathname)\n return stat.isDirectory()\n } catch (err) {\n return false\n }\n}\n\nasync function createTreeCodeFromPath(\n pagePath: string,\n {\n page,\n resolveDir,\n resolver,\n resolveParallelSegments,\n hasChildRoutesForSegment,\n metadataResolver,\n pageExtensions,\n basePath,\n collectedDeclarations,\n isGlobalNotFoundEnabled,\n }: {\n page: string\n resolveDir: DirResolver\n resolver: PathResolver\n metadataResolver: MetadataResolver\n resolveParallelSegments: (\n pathname: string\n ) => [key: string, segment: string | string[]][]\n hasChildRoutesForSegment: (segmentPath: string) => boolean\n loaderContext: webpack.LoaderContext<AppLoaderOptions>\n pageExtensions: PageExtensions\n basePath: string\n collectedDeclarations: [string, string][]\n isGlobalNotFoundEnabled: boolean\n }\n): Promise<{\n treeCode: string\n rootLayout: string | undefined\n globalError: string\n globalNotFound: string\n}> {\n const splittedPath = pagePath.split(/[\\\\/]/, 1)\n const isNotFoundRoute = page === UNDERSCORE_NOT_FOUND_ROUTE_ENTRY\n const isAppErrorRoute = page === UNDERSCORE_GLOBAL_ERROR_ROUTE_ENTRY\n const isDefaultNotFound = isAppBuiltinPage(pagePath)\n\n const appDirPrefix = isDefaultNotFound ? APP_DIR_ALIAS : splittedPath[0]\n\n let rootLayout: string | undefined\n let globalError: string = defaultGlobalErrorPath\n let globalNotFound: string = defaultNotFoundPath\n\n async function resolveAdjacentParallelSegments(\n segmentPath: string\n ): Promise<string[]> {\n const absoluteSegmentPath = resolveDir(`${appDirPrefix}${segmentPath}`)\n\n if (!absoluteSegmentPath) {\n return []\n }\n\n const segmentIsDirectory = await isDirectory(absoluteSegmentPath)\n\n if (!segmentIsDirectory) {\n return []\n }\n\n // We need to resolve all parallel routes in this level.\n const files = await fs.opendir(absoluteSegmentPath)\n\n const parallelSegments: string[] = ['children']\n\n for await (const dirent of files) {\n // Make sure name starts with \"@\" and is a directory.\n if (dirent.isDirectory() && dirent.name.charCodeAt(0) === 64) {\n parallelSegments.push(dirent.name)\n }\n }\n\n return parallelSegments\n }\n\n async function createSubtreePropsFromSegmentPath(\n segments: string[],\n nestedCollectedDeclarations: [string, string][]\n ): Promise<{\n treeCode: string\n }> {\n const segmentPath = segments.join('/')\n\n // Existing tree are the children of the current segment\n const props: Record<string, string> = {}\n // Root layer could be 1st layer of normal routes\n const isRootLayer = segments.length === 0\n const isRootLayoutOrRootPage = segments.length <= 1\n\n // We need to resolve all parallel routes in this level.\n const parallelSegments: [key: string, segment: string | string[]][] = []\n if (isRootLayer) {\n parallelSegments.push(['children', ''])\n } else {\n parallelSegments.push(...resolveParallelSegments(segmentPath))\n }\n\n let metadata: Awaited<ReturnType<typeof createStaticMetadataFromRoute>> =\n null\n const routerDirPath = `${appDirPrefix}${segmentPath}`\n const resolvedRouteDir = resolveDir(routerDirPath)\n\n if (\n resolvedRouteDir &&\n // Do not collect metadata for app-error route as it's for generating pure static 500.html\n !normalizePathSep(pagePath).endsWith(appErrorPath)\n ) {\n metadata = await createStaticMetadataFromRoute(resolvedRouteDir, {\n basePath,\n segment: segmentPath,\n metadataResolver,\n isRootLayoutOrRootPage,\n pageExtensions,\n })\n }\n\n for (const [parallelKey, parallelSegment] of parallelSegments) {\n // if parallelSegment is the page segment (ie, `page$` and not ['page$']), it gets loaded into the __PAGE__ slot\n // as it's the page for the current route.\n if (parallelSegment === PAGE_SEGMENT) {\n const matchedPagePath = `${appDirPrefix}${segmentPath}${\n parallelKey === 'children' ? '' : `/${parallelKey}`\n }/page`\n\n const resolvedPagePath = await resolver(matchedPagePath)\n if (resolvedPagePath) {\n const varName = `page${nestedCollectedDeclarations.length}`\n nestedCollectedDeclarations.push([varName, resolvedPagePath])\n\n // Use '' for segment as it's the page. There can't be a segment called '' so this is the safest way to add it.\n props[normalizeParallelKey(parallelKey)] =\n `['${PAGE_SEGMENT_KEY}', {}, {\n page: [${varName}, ${JSON.stringify(resolvedPagePath)}],\n ${createMetadataExportsCode(metadata)}\n }]`\n continue\n } else {\n throw new Error(`Can't resolve ${matchedPagePath}`)\n }\n }\n\n // if the parallelSegment was not matched to the __PAGE__ slot, then it's a parallel route at this level.\n // the code below recursively traverses the parallel slots directory to match the corresponding __PAGE__ for each parallel slot\n // while also filling in layout/default/etc files into the loader tree at each segment level.\n\n const subSegmentPath = [...segments]\n if (parallelKey !== 'children') {\n // A `children` parallel key should have already been processed in the above segment\n // So we exclude it when constructing the subsegment path for the remaining segment levels\n subSegmentPath.push(parallelKey)\n }\n\n const normalizedParallelSegment = Array.isArray(parallelSegment)\n ? parallelSegment[0]\n : parallelSegment\n\n if (\n normalizedParallelSegment !== PAGE_SEGMENT &&\n normalizedParallelSegment !== PARALLEL_VIRTUAL_SEGMENT\n ) {\n // If we don't have a page segment, nor a special $children marker, it means we need to traverse the next directory\n // (ie, `normalizedParallelSegment` would correspond with the folder that contains the next level of pages/layout/etc)\n // we push it to the subSegmentPath so that we can fill in the loader tree for that segment.\n subSegmentPath.push(normalizedParallelSegment)\n }\n\n const parallelSegmentPath = subSegmentPath.join('/')\n\n // Fill in the loader tree for all of the special files types (layout, default, etc) at this level\n // `page` is not included here as it's added above.\n const filePathEntries = await Promise.all(\n Object.values(FILE_TYPES).map(async (file) => {\n return [\n file,\n await resolver(\n `${appDirPrefix}${\n // TODO-APP: parallelSegmentPath sometimes ends in `/` but sometimes it doesn't. This should be consistent.\n parallelSegmentPath.endsWith('/')\n ? parallelSegmentPath\n : parallelSegmentPath + '/'\n }${file}`\n ),\n ] as const\n })\n )\n const filePaths = new Map<ValueOf<typeof FILE_TYPES>, string | undefined>(\n filePathEntries\n )\n\n // Only resolve global-* convention files at the root layer\n if (isRootLayer) {\n const resolvedGlobalErrorPath = await resolver(\n `${appDirPrefix}/${GLOBAL_ERROR_FILE_TYPE}`\n )\n if (resolvedGlobalErrorPath) {\n globalError = resolvedGlobalErrorPath\n }\n // Add global-error to root layer's filePaths, so that it's always available,\n // by default it's the built-in global-error.js\n filePaths.set(GLOBAL_ERROR_FILE_TYPE, globalError)\n\n // TODO(global-not-found): remove this flag assertion condition\n // once global-not-found is stable\n if (isGlobalNotFoundEnabled) {\n const resolvedGlobalNotFoundPath = await resolver(\n `${appDirPrefix}/${GLOBAL_NOT_FOUND_FILE_TYPE}`\n )\n if (resolvedGlobalNotFoundPath) {\n globalNotFound = resolvedGlobalNotFoundPath\n }\n // Add global-not-found to root layer's filePaths, so that it's always available,\n // by default it's the built-in global-not-found.js\n filePaths.set(GLOBAL_NOT_FOUND_FILE_TYPE, globalNotFound)\n }\n }\n\n let definedFilePaths = Array.from(filePaths.entries()).filter(\n ([, filePath]) => filePath !== undefined\n ) as [ValueOf<typeof FILE_TYPES>, string][]\n\n // Add default access fallback as root fallback if not present\n const existedConventionNames = new Set(\n definedFilePaths.map(([type]) => type)\n )\n // If the first layer is a group route, we treat it as root layer\n const isFirstLayerGroupRoute =\n segments.length === 1 &&\n subSegmentPath.filter((seg) => isGroupSegment(seg)).length === 1\n\n if (isRootLayer || isFirstLayerGroupRoute) {\n const accessFallbackTypes = Object.keys(\n defaultHTTPAccessFallbackPaths\n ) as (keyof typeof defaultHTTPAccessFallbackPaths)[]\n for (const type of accessFallbackTypes) {\n const hasRootFallbackFile = await resolver(\n `${appDirPrefix}/${FILE_TYPES[type]}`\n )\n const hasLayerFallbackFile = existedConventionNames.has(type)\n\n // If you already have a root access error fallback, don't insert default access error boundary to group routes root\n if (\n // Is treated as root layout and without boundary\n !(hasRootFallbackFile && isFirstLayerGroupRoute) &&\n // Does not have a fallback boundary file\n !hasLayerFallbackFile\n ) {\n const defaultFallbackPath = defaultHTTPAccessFallbackPaths[type]\n if (!(isDefaultNotFound && type === 'not-found')) {\n definedFilePaths.push([type, defaultFallbackPath])\n }\n }\n }\n }\n\n if (!rootLayout) {\n const layoutPath = definedFilePaths.find(\n ([type]) => type === 'layout'\n )?.[1]\n rootLayout = layoutPath\n\n // When `global-not-found` is disabled, we insert a default layout if\n // root layout is presented. This logic and the default layout will be removed\n // once `global-not-found` is stabilized.\n if (\n !isGlobalNotFoundEnabled &&\n isDefaultNotFound &&\n !layoutPath &&\n !rootLayout\n ) {\n rootLayout = defaultLayoutPath\n definedFilePaths.push(['layout', rootLayout])\n }\n }\n\n let parallelSegmentKey = Array.isArray(parallelSegment)\n ? parallelSegment[0]\n : parallelSegment\n\n // normalize the parallel segment key to remove any special markers that we inserted in the\n // earlier logic (such as children$ and page$). These should never appear in the loader tree, and\n // should instead be the corresponding segment keys (ie `__PAGE__`) or the `children` parallel route.\n parallelSegmentKey =\n parallelSegmentKey === PARALLEL_VIRTUAL_SEGMENT\n ? '(slot)'\n : parallelSegmentKey === PAGE_SEGMENT\n ? PAGE_SEGMENT_KEY\n : parallelSegmentKey\n\n const normalizedParallelKey = normalizeParallelKey(parallelKey)\n let subtreeCode: string | undefined\n // If it's root not found page, set not-found boundary as children page\n if (isNotFoundRoute) {\n if (normalizedParallelKey === 'children') {\n const matchedGlobalNotFound = isGlobalNotFoundEnabled\n ? (definedFilePaths.find(\n ([type]) => type === GLOBAL_NOT_FOUND_FILE_TYPE\n )?.[1] ?? defaultGlobalNotFoundPath)\n : undefined\n\n // If custom global-not-found.js is defined, use global-not-found.js\n if (matchedGlobalNotFound) {\n const varName = `notFound${nestedCollectedDeclarations.length}`\n nestedCollectedDeclarations.push([varName, matchedGlobalNotFound])\n const layoutName = `layout${nestedCollectedDeclarations.length}`\n nestedCollectedDeclarations.push([layoutName, defaultEmptyStubPath])\n subtreeCode = `{\n children: [${JSON.stringify(UNDERSCORE_NOT_FOUND_ROUTE)}, {\n children: ['${PAGE_SEGMENT_KEY}', {}, {\n layout: [\n ${varName},\n ${JSON.stringify(matchedGlobalNotFound)}\n ],\n page: [\n ${layoutName},\n ${JSON.stringify(defaultEmptyStubPath)}\n ]\n }]\n }, {}]\n }`\n } else {\n // If custom not-found.js is found, use it and layout to compose the page,\n // and fallback to built-in not-found component if doesn't exist.\n const notFoundPath =\n definedFilePaths.find(([type]) => type === 'not-found')?.[1] ??\n defaultNotFoundPath\n const varName = `notFound${nestedCollectedDeclarations.length}`\n nestedCollectedDeclarations.push([varName, notFoundPath])\n subtreeCode = `{\n children: [${JSON.stringify(UNDERSCORE_NOT_FOUND_ROUTE.slice(1))}, {\n children: ['${PAGE_SEGMENT_KEY}', {}, {\n page: [\n ${varName},\n ${JSON.stringify(notFoundPath)}\n ]\n }]\n }, {}]\n }`\n }\n }\n }\n\n // If it's app-error route, set app-error as children page\n if (isAppErrorRoute) {\n const varName = `appError${nestedCollectedDeclarations.length}`\n nestedCollectedDeclarations.push([varName, appErrorPath])\n subtreeCode = `{\n children: [${JSON.stringify(UNDERSCORE_GLOBAL_ERROR_ROUTE.slice(1))}, {\n children: ['${PAGE_SEGMENT_KEY}', {}, {\n page: [\n ${varName},\n ${JSON.stringify(appErrorPath)}\n ]\n }]\n }, {}]\n }`\n }\n\n // For 404 route\n // if global-not-found is in definedFilePaths, remove root layout for /_not-found,\n // and change it to global-not-found route.\n // TODO: remove this once global-not-found is stable.\n if (isNotFoundRoute && isGlobalNotFoundEnabled) {\n definedFilePaths = definedFilePaths.filter(\n ([type]) => type !== 'layout'\n )\n\n // Replace the layout to global-not-found\n definedFilePaths.push([\n 'layout',\n definedFilePaths.find(\n ([type]) => type === GLOBAL_NOT_FOUND_FILE_TYPE\n )?.[1] ?? defaultGlobalNotFoundPath,\n ])\n }\n\n if (isAppErrorRoute) {\n definedFilePaths = definedFilePaths.filter(\n ([type]) => type !== 'layout'\n )\n }\n\n const modulesCode = `{\n ${definedFilePaths\n .map(([file, filePath]) => {\n const varName = `module${nestedCollectedDeclarations.length}`\n nestedCollectedDeclarations.push([varName, filePath])\n return `'${file}': [${varName}, ${JSON.stringify(filePath)}],`\n })\n .join('\\n')}\n ${createMetadataExportsCode(metadata)}\n }`\n\n if (!subtreeCode) {\n const { treeCode: pageSubtreeCode } =\n await createSubtreePropsFromSegmentPath(\n subSegmentPath,\n nestedCollectedDeclarations\n )\n\n subtreeCode = pageSubtreeCode\n }\n\n props[normalizedParallelKey] = `[\n '${parallelSegmentKey}',\n ${subtreeCode},\n ${modulesCode}\n ]`\n }\n\n const adjacentParallelSegments =\n await resolveAdjacentParallelSegments(segmentPath)\n\n for (const adjacentParallelSegment of adjacentParallelSegments) {\n if (!props[normalizeParallelKey(adjacentParallelSegment)]) {\n const actualSegment =\n adjacentParallelSegment === 'children'\n ? ''\n : `/${adjacentParallelSegment}`\n\n // Use the default path if it's found, otherwise if it's a children\n // slot, then use the fallback (which triggers a `notFound()`). If this\n // isn't a children slot, then throw an error, as it produces a silent\n // 404 if we'd used the fallback.\n const fullSegmentPath = `${appDirPrefix}${segmentPath}${actualSegment}`\n let defaultPath = await resolver(`${fullSegmentPath}/default`)\n if (!defaultPath) {\n if (adjacentParallelSegment === 'children') {\n defaultPath = PARALLEL_ROUTE_DEFAULT_PATH\n } else {\n // Check if we're inside a catch-all route (i.e., the parallel route is a child\n // of a catch-all segment). Only skip validation if the slot is UNDER a catch-all.\n // For example:\n // /[...catchAll]/@slot - isInsideCatchAll = true (skip validation) ✓\n // /@slot/[...catchAll] - isInsideCatchAll = false (require default) ✓\n // The catch-all provides fallback behavior, so default.js is not required.\n const isInsideCatchAll = segments.some(isCatchAllSegment)\n\n // Check if this is a leaf segment (no child routes).\n // Leaf segments don't need default.js because there are no child routes\n // that could cause the parallel slot to unmatch. For example:\n // /repo-overview/@slot/page with no child routes - isLeafSegment = true (skip validation) ✓\n // /repo-overview/@slot/page with /repo-overview/child/page - isLeafSegment = false (require default) ✓\n // This also handles route groups correctly by filtering them out.\n const isLeafSegment = !hasChildRoutesForSegment(segmentPath)\n\n if (!isInsideCatchAll && !isLeafSegment) {\n // Replace internal webpack alias with user-facing directory name\n const userFacingPath = fullSegmentPath.replace(\n APP_DIR_ALIAS,\n 'app'\n )\n throw new MissingDefaultParallelRouteError(\n userFacingPath,\n adjacentParallelSegment\n )\n }\n defaultPath = PARALLEL_ROUTE_DEFAULT_PATH\n }\n }\n\n const varName = `default${nestedCollectedDeclarations.length}`\n nestedCollectedDeclarations.push([varName, defaultPath])\n props[normalizeParallelKey(adjacentParallelSegment)] = `[\n '${DEFAULT_SEGMENT_KEY}',\n {},\n {\n defaultPage: [${varName}, ${JSON.stringify(defaultPath)}],\n }\n ]`\n }\n }\n return {\n treeCode: `{\n ${Object.entries(props)\n .map(([key, value]) => `${key}: ${value}`)\n .join(',\\n')}\n }`,\n }\n }\n\n const { treeCode } = await createSubtreePropsFromSegmentPath(\n [],\n collectedDeclarations\n )\n\n return {\n treeCode: `${treeCode}.children;`,\n rootLayout,\n globalError,\n globalNotFound,\n }\n}\n\nfunction createAbsolutePath(appDir: string, pathToTurnAbsolute: string) {\n return (\n pathToTurnAbsolute\n // Replace all POSIX path separators with the current OS path separator\n .replace(/\\//g, path.sep)\n .replace(/^private-next-app-dir/, appDir)\n )\n}\n\nconst filesInDirMapMap: WeakMap<\n Compilation,\n Map<string, Promise<Set<string>>>\n> = new WeakMap()\nconst nextAppLoader: AppLoader = async function nextAppLoader() {\n // install native bindings early so they are always available.\n // When run by webpack, next will have already done this, so this will be fast,\n // but if run by turbopack in a subprocess it is required. In that case we cannot pass the\n // `useWasmBinary` flag, but that is ok since turbopack doesn't currently support wasm.\n await installBindings()\n const loaderOptions = this.getOptions()\n const {\n name,\n appDir,\n appPaths,\n pagePath,\n pageExtensions,\n rootDir,\n tsconfigPath,\n isDev,\n nextConfigOutput,\n preferredRegion,\n basePath,\n middlewareConfig: middlewareConfigBase64,\n } = loaderOptions\n\n const isGlobalNotFoundEnabled = !!loaderOptions.isGlobalNotFoundEnabled\n\n // Update FILE_TYPES on the very top-level of the loader\n if (!isGlobalNotFoundEnabled) {\n // @ts-expect-error this delete is only necessary while experimental\n delete FILE_TYPES['global-not-found']\n }\n\n const buildInfo = getModuleBuildInfo((this as any)._module)\n const collectedDeclarations: [string, string][] = []\n const page = name.replace(/^app/, '')\n const middlewareConfig: ProxyConfig = JSON.parse(\n Buffer.from(middlewareConfigBase64, 'base64').toString()\n )\n buildInfo.route = {\n page,\n absolutePagePath: createAbsolutePath(appDir, pagePath),\n preferredRegion,\n middlewareConfig,\n relatedModules: [],\n }\n\n const extensions =\n typeof pageExtensions === 'string'\n ? [pageExtensions]\n : pageExtensions.map((extension) => `.${extension}`)\n\n const normalizedAppPaths =\n typeof appPaths === 'string' ? [appPaths] : appPaths || []\n\n const resolveParallelSegments = (\n pathname: string\n ): [string, string | string[]][] => {\n const matched: Record<string, string | string[]> = {}\n let existingChildrenPath: string | undefined\n for (const appPath of normalizedAppPaths) {\n if (appPath.startsWith(pathname + '/')) {\n const rest = appPath.slice(pathname.length + 1).split('/')\n\n // It is the actual page, mark it specially.\n if (rest.length === 1 && rest[0] === 'page') {\n existingChildrenPath = appPath\n matched.children = PAGE_SEGMENT\n continue\n }\n\n const isParallelRoute = rest[0].startsWith('@')\n if (isParallelRoute) {\n if (rest.length === 2 && rest[1] === 'page') {\n // We found a parallel route at this level. We don't want to mark it explicitly as the page segment,\n // as that should be matched to the `children` slot. Instead, we use an array, to signal to `createSubtreePropsFromSegmentPath`\n // that it needs to recursively fill in the loader tree code for the parallel route at the appropriate levels.\n matched[rest[0]] = [PAGE_SEGMENT]\n continue\n }\n // If it was a parallel route but we weren't able to find the page segment (ie, maybe the page is nested further)\n // we first insert a special marker to ensure that we still process layout/default/etc at the slot level prior to continuing\n // on to the page segment.\n matched[rest[0]] = [PARALLEL_VIRTUAL_SEGMENT, ...rest.slice(1)]\n continue\n }\n\n if (existingChildrenPath && matched.children !== rest[0]) {\n // If we get here, it means we already set a `page` segment earlier in the loop,\n // meaning we already matched a page to the `children` parallel segment.\n const isIncomingParallelPage = appPath.includes('@')\n const hasCurrentParallelPage = existingChildrenPath.includes('@')\n\n if (isIncomingParallelPage) {\n // The duplicate segment was for a parallel slot. In this case,\n // rather than throwing an error, we can ignore it since this can happen for valid reasons.\n // For example, when we attempt to normalize catch-all routes, we'll push potential slot matches so\n // that they are available in the loader tree when we go to render the page.\n // We only need to throw an error if the duplicate segment was for a regular page.\n // For example, /app/(groupa)/page & /app/(groupb)/page is an error since it corresponds\n // with the same path.\n continue\n } else if (!hasCurrentParallelPage && !isIncomingParallelPage) {\n // Both the current `children` and the incoming `children` are regular pages.\n throw new Error(\n `You cannot have two parallel pages that resolve to the same path. Please check ${existingChildrenPath} and ${appPath}. Refer to the route group docs for more information: https://nextjs.org/docs/app/building-your-application/routing/route-groups`\n )\n }\n }\n\n existingChildrenPath = appPath\n matched.children = rest[0]\n }\n }\n\n return Object.entries(matched)\n }\n\n const hasChildRoutesForSegment = (segmentPath: string): boolean => {\n const pathPrefix = segmentPath ? `${segmentPath}/` : ''\n\n for (const appPath of normalizedAppPaths) {\n if (appPath.startsWith(pathPrefix)) {\n const rest = appPath.slice(pathPrefix.length).split('/')\n\n // Filter out route groups to get the actual route segments\n // Route groups (e.g., \"(group)\") don't contribute to the URL path\n const routeSegments = rest.filter((segment) => !isGroupSegment(segment))\n\n // If it's just 'page' at this level, skip (not a child route)\n if (routeSegments.length === 1 && routeSegments[0] === 'page') {\n continue\n }\n\n // If the first segment (after filtering route groups) is a parallel route, skip\n if (routeSegments[0]?.startsWith('@')) {\n continue\n }\n\n // If we have more than just 'page', then there are child routes\n // Examples:\n // ['child', 'page'] -> true (has child route)\n // ['page'] -> false (already filtered above)\n // ['grandchild', 'deeper', 'page'] -> true (has nested child routes)\n if (\n routeSegments.length > 1 ||\n (routeSegments.length === 1 && routeSegments[0] !== 'page')\n ) {\n return true\n }\n }\n }\n\n return false\n }\n\n const resolveDir: DirResolver = (pathToResolve) => {\n return createAbsolutePath(appDir, pathToResolve)\n }\n\n const resolveAppRoute: PathResolver = (pathToResolve) => {\n return createAbsolutePath(appDir, pathToResolve)\n }\n\n // Cached checker to see if a file exists in a given directory.\n // This can be more efficient than checking them with `fs.stat` one by one\n // because all the thousands of files are likely in a few possible directories.\n // Note that it should only be cached for this compilation, not globally.\n const fileExistsInDirectory = async (dirname: string, fileName: string) => {\n // I don't think we should ever hit this code path, but if we do we should handle it gracefully.\n if (this._compilation === undefined) {\n try {\n return (await getFilesInDir(dirname).catch(() => new Set())).has(\n fileName\n )\n } catch (e) {\n return false\n }\n }\n const map =\n filesInDirMapMap.get(this._compilation) ||\n new Map<string, Promise<Set<string>>>()\n if (!filesInDirMapMap.has(this._compilation)) {\n filesInDirMapMap.set(this._compilation, map)\n }\n if (!map.has(dirname)) {\n map.set(\n dirname,\n getFilesInDir(dirname).catch(() => new Set())\n )\n }\n return ((await map.get(dirname)) || new Set()).has(fileName)\n }\n\n const resolver: PathResolver = async (pathname) => {\n const absolutePath = createAbsolutePath(appDir, pathname)\n\n const filenameIndex = absolutePath.lastIndexOf(path.sep)\n const dirname = absolutePath.slice(0, filenameIndex)\n const filename = absolutePath.slice(filenameIndex + 1)\n\n let result: string | undefined\n\n for (const ext of extensions) {\n const absolutePathWithExtension = `${absolutePath}${ext}`\n if (\n !result &&\n (await fileExistsInDirectory(dirname, `${filename}${ext}`))\n ) {\n result = absolutePathWithExtension\n }\n // Call `addMissingDependency` for all files even if they didn't match,\n // because they might be added or removed during development.\n this.addMissingDependency(absolutePathWithExtension)\n }\n\n return result\n }\n\n const metadataResolver: MetadataResolver = async (\n dirname,\n filename,\n exts\n ) => {\n const absoluteDir = createAbsolutePath(appDir, dirname)\n\n let result: string | undefined\n\n for (const ext of exts) {\n // Compared to `resolver` above the exts do not have the `.` included already, so it's added here.\n const filenameWithExt = `${filename}.${ext}`\n const absolutePathWithExtension = `${absoluteDir}${path.sep}${filenameWithExt}`\n if (!result && (await fileExistsInDirectory(dirname, filenameWithExt))) {\n result = absolutePathWithExtension\n }\n // Call `addMissingDependency` for all files even if they didn't match,\n // because they might be added or removed during development.\n this.addMissingDependency(absolutePathWithExtension)\n }\n\n return result\n }\n\n if (isAppRouteRoute(name)) {\n return createAppRouteCode({\n appDir,\n // TODO: investigate if the local `page` is the same as the loaderOptions.page\n page: loaderOptions.page,\n name,\n pagePath,\n resolveAppRoute,\n pageExtensions,\n nextConfigOutput,\n })\n }\n\n let treeCodeResult = await createTreeCodeFromPath(pagePath, {\n page,\n resolveDir,\n resolver,\n metadataResolver,\n resolveParallelSegments,\n hasChildRoutesForSegment,\n loaderContext: this,\n pageExtensions,\n basePath,\n collectedDeclarations,\n isGlobalNotFoundEnabled,\n })\n\n const isGlobalNotFoundPath =\n page === UNDERSCORE_NOT_FOUND_ROUTE_ENTRY &&\n !!treeCodeResult.globalNotFound &&\n isGlobalNotFoundEnabled\n\n const isAppErrorRoute = page === UNDERSCORE_GLOBAL_ERROR_ROUTE_ENTRY\n\n if (!treeCodeResult.rootLayout && !isGlobalNotFoundPath && !isAppErrorRoute) {\n if (!isDev) {\n // If we're building and missing a root layout, exit the build\n Log.error(\n `${bold(\n pagePath.replace(`${APP_DIR_ALIAS}/`, '')\n )} doesn't have a root layout. To fix this error, make sure every page has a root layout.`\n )\n process.exit(1)\n } else {\n // In dev we'll try to create a root layout\n const [createdRootLayout, rootLayoutPath] = await verifyRootLayout({\n appDir: appDir,\n dir: rootDir!,\n tsconfigPath: tsconfigPath,\n pagePath,\n pageExtensions,\n })\n if (!createdRootLayout) {\n let message = `${bold(\n pagePath.replace(`${APP_DIR_ALIAS}/`, '')\n )} doesn't have a root layout. `\n\n if (rootLayoutPath) {\n message += `We tried to create ${bold(\n path.relative(this._compiler?.context ?? '', rootLayoutPath)\n )} for you but something went wrong.`\n } else {\n message +=\n 'To fix this error, make sure every page has a root layout.'\n }\n\n throw new Error(message)\n }\n\n // Clear fs cache, get the new result with the created root layout.\n if (this._compilation) filesInDirMapMap.get(this._compilation)?.clear()\n treeCodeResult = await createTreeCodeFromPath(pagePath, {\n page,\n resolveDir,\n resolver,\n metadataResolver,\n resolveParallelSegments,\n hasChildRoutesForSegment,\n loaderContext: this,\n pageExtensions,\n basePath,\n collectedDeclarations,\n isGlobalNotFoundEnabled,\n })\n }\n }\n\n const pathname = new AppPathnameNormalizer().normalize(page)\n\n // Prefer to modify next/src/server/app-render/entry-base.ts since this is shared with Turbopack.\n // Any changes to this code should be reflected in Turbopack's app_source.rs and/or app-renderer.tsx as well.\n const code = await loadEntrypoint(\n 'app-page',\n {\n VAR_DEFINITION_PAGE: page,\n VAR_DEFINITION_PATHNAME: pathname,\n VAR_MODULE_GLOBAL_ERROR: treeCodeResult.globalError,\n },\n {\n tree: treeCodeResult.treeCode,\n __next_app_require__: '__webpack_require__',\n // all modules are in the entry chunk, so we never actually need to load chunks in webpack\n __next_app_load_chunk__: '() => Promise.resolve()',\n }\n )\n\n // Lazily evaluate the imported modules in the generated code\n const header = collectedDeclarations\n .map(([varName, modulePath]) => {\n return `const ${varName} = () => import(/* webpackMode: \"eager\" */ ${JSON.stringify(\n modulePath\n )});\\n`\n })\n .join('')\n\n return header + code\n}\n\nexport default nextAppLoader\n"],"names":["UNDERSCORE_GLOBAL_ERROR_ROUTE","UNDERSCORE_NOT_FOUND_ROUTE","UNDERSCORE_GLOBAL_ERROR_ROUTE_ENTRY","UNDERSCORE_NOT_FOUND_ROUTE_ENTRY","path","bold","getModuleBuildInfo","verifyRootLayout","Log","APP_DIR_ALIAS","createMetadataExportsCode","createStaticMetadataFromRoute","promises","fs","isAppRouteRoute","AppPathnameNormalizer","isAppBuiltinPage","loadEntrypoint","isGroupSegment","DEFAULT_SEGMENT_KEY","PAGE_SEGMENT_KEY","getFilesInDir","PARALLEL_ROUTE_DEFAULT_PATH","createAppRouteCode","MissingDefaultParallelRouteError","normalizePathSep","installBindings","HTTP_ACCESS_FALLBACKS","forbidden","unauthorized","defaultHTTPAccessFallbackPaths","FILE_TYPES","layout","template","error","loading","GLOBAL_ERROR_FILE_TYPE","GLOBAL_NOT_FOUND_FILE_TYPE","PAGE_SEGMENT","PARALLEL_VIRTUAL_SEGMENT","defaultGlobalErrorPath","defaultNotFoundPath","defaultEmptyStubPath","defaultLayoutPath","defaultGlobalNotFoundPath","appErrorPath","normalizeParallelKey","key","startsWith","slice","isCatchAllSegment","segment","isDirectory","pathname","stat","err","createTreeCodeFromPath","pagePath","page","resolveDir","resolver","resolveParallelSegments","hasChildRoutesForSegment","metadataResolver","pageExtensions","basePath","collectedDeclarations","isGlobalNotFoundEnabled","splittedPath","split","isNotFoundRoute","isAppErrorRoute","isDefaultNotFound","appDirPrefix","rootLayout","globalError","globalNotFound","resolveAdjacentParallelSegments","segmentPath","absoluteSegmentPath","segmentIsDirectory","files","opendir","parallelSegments","dirent","name","charCodeAt","push","createSubtreePropsFromSegmentPath","segments","nestedCollectedDeclarations","join","props","isRootLayer","length","isRootLayoutOrRootPage","metadata","routerDirPath","resolvedRouteDir","endsWith","parallelKey","parallelSegment","matchedPagePath","resolvedPagePath","varName","JSON","stringify","Error","subSegmentPath","normalizedParallelSegment","Array","isArray","parallelSegmentPath","filePathEntries","Promise","all","Object","values","map","file","filePaths","Map","resolvedGlobalErrorPath","set","resolvedGlobalNotFoundPath","definedFilePaths","from","entries","filter","filePath","undefined","existedConventionNames","Set","type","isFirstLayerGroupRoute","seg","accessFallbackTypes","keys","hasRootFallbackFile","hasLayerFallbackFile","has","defaultFallbackPath","layoutPath","find","parallelSegmentKey","normalizedParallelKey","subtreeCode","matchedGlobalNotFound","layoutName","notFoundPath","modulesCode","treeCode","pageSubtreeCode","adjacentParallelSegments","adjacentParallelSegment","actualSegment","fullSegmentPath","defaultPath","isInsideCatchAll","some","isLeafSegment","userFacingPath","replace","value","createAbsolutePath","appDir","pathToTurnAbsolute","sep","filesInDirMapMap","WeakMap","nextAppLoader","loaderOptions","getOptions","appPaths","rootDir","tsconfigPath","isDev","nextConfigOutput","preferredRegion","middlewareConfig","middlewareConfigBase64","buildInfo","_module","parse","Buffer","toString","route","absolutePagePath","relatedModules","extensions","extension","normalizedAppPaths","matched","existingChildrenPath","appPath","rest","children","isParallelRoute","isIncomingParallelPage","includes","hasCurrentParallelPage","pathPrefix","routeSegments","pathToResolve","resolveAppRoute","fileExistsInDirectory","dirname","fileName","_compilation","catch","e","get","absolutePath","filenameIndex","lastIndexOf","filename","result","ext","absolutePathWithExtension","addMissingDependency","exts","absoluteDir","filenameWithExt","treeCodeResult","loaderContext","isGlobalNotFoundPath","process","exit","createdRootLayout","rootLayoutPath","dir","message","relative","_compiler","context","clear","normalize","code","VAR_DEFINITION_PAGE","VAR_DEFINITION_PATHNAME","VAR_MODULE_GLOBAL_ERROR","tree","__next_app_require__","__next_app_load_chunk__","header","modulePath"],"mappings":"AACA,SACEA,6BAA6B,EAC7BC,0BAA0B,QAErB,mCAAkC;AACzC,SACEC,mCAAmC,EACnCC,gCAAgC,QAC3B,yCAAwC;AAG/C,OAAOC,UAAU,OAAM;AACvB,SAASC,IAAI,QAAQ,6BAA4B;AACjD,SAASC,kBAAkB,QAAQ,2BAA0B;AAC7D,SAASC,gBAAgB,QAAQ,qCAAoC;AACrE,YAAYC,SAAS,sBAAqB;AAC1C,SAASC,aAAa,QAAQ,4BAA2B;AACzD,SACEC,yBAAyB,EACzBC,6BAA6B,QACxB,uBAAsB;AAC7B,SAASC,YAAYC,EAAE,QAAQ,KAAI;AACnC,SAASC,eAAe,QAAQ,qCAAoC;AAEpE,SAASC,qBAAqB,QAAQ,mEAAkE;AAExG,SAASC,gBAAgB,QAAQ,iBAAgB;AACjD,SAASC,cAAc,QAAQ,2BAA0B;AACzD,SACEC,cAAc,EACdC,mBAAmB,EACnBC,gBAAgB,QACX,iCAAgC;AACvC,SAAS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F;QACF;IACF;IAEA,MAAMd,WAAW,IAAItC,wBAAwB6N,SAAS,CAAClL;IAEvD,iGAAiG;IACjG,6GAA6G;IAC7G,MAAMmL,OAAO,MAAM5N,eACjB,YACA;QACE6N,qBAAqBpL;QACrBqL,yBAAyB1L;QACzB2L,yBAAyBjB,eAAepJ,WAAW;IACrD,GACA;QACEsK,MAAMlB,eAAexE,QAAQ;QAC7B2F,sBAAsB;QACtB,0FAA0F;QAC1FC,yBAAyB;IAC3B;IAGF,6DAA6D;IAC7D,MAAMC,SAASlL,sBACZoD,GAAG,CAAC,CAAC,CAACd,SAAS6I,WAAW;QACzB,OAAO,CAAC,MAAM,EAAE7I,QAAQ,2CAA2C,EAAEC,KAAKC,SAAS,CACjF2I,YACA,IAAI,CAAC;IACT,GACC1J,IAAI,CAAC;IAER,OAAOyJ,SAASP;AAClB;AAEA,eAAenE,cAAa","ignoreList":[0]}
@@ -84,6 +84,7 @@
84
84
  * be accidentally created as different instances.
85
85
  */ import path from 'path';
86
86
  import { transform } from '../../swc';
87
+ import { installBindings } from '../../swc/install-bindings';
87
88
  // This is a in-memory cache for the mapping of barrel exports. This only applies
88
89
  // to the packages that we optimize. It will never change (e.g. upgrading packages)
89
90
  // during the lifetime of the server so we can safely cache it.
@@ -179,6 +180,10 @@ async function getBarrelMapping(resourcePath, swcCacheDir, resolve, fs) {
179
180
  const NextBarrelLoader = async function() {
180
181
  this.async();
181
182
  this.cacheable(true);
183
+ // Install bindings early so they are definitely available.
184
+ // When run by webpack in next this is already done with correct configuration so this is a no-op.
185
+ // In turbopack loaders are run in a subprocess so it may or may not be done.
186
+ await installBindings();
182
187
  const { names, swcCacheDir } = this.getOptions();
183
188
  // For barrel optimizations, we always prefer the "module" field over the
184
189
  // "main" field because ESM handling is more robust with better tree-shaking.