next 15.4.2-canary.49 → 15.4.2-canary.50

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of next might be problematic. Click here for more details.

Files changed (54) hide show
  1. package/dist/bin/next +1 -1
  2. package/dist/build/index.js +2 -2
  3. package/dist/build/swc/index.js +1 -1
  4. package/dist/build/webpack/loaders/next-flight-action-entry-loader.d.ts +2 -1
  5. package/dist/build/webpack/loaders/next-flight-action-entry-loader.js.map +1 -1
  6. package/dist/build/webpack/plugins/flight-client-entry-plugin.d.ts +5 -1
  7. package/dist/build/webpack/plugins/flight-client-entry-plugin.js +9 -4
  8. package/dist/build/webpack/plugins/flight-client-entry-plugin.js.map +1 -1
  9. package/dist/build/webpack-config.js +2 -2
  10. package/dist/client/app-bootstrap.js +1 -1
  11. package/dist/client/index.js +1 -1
  12. package/dist/compiled/next-server/pages-api-turbo.runtime.prod.js +1 -1
  13. package/dist/compiled/next-server/pages-api-turbo.runtime.prod.js.map +1 -1
  14. package/dist/compiled/next-server/pages-api.runtime.dev.js +1 -1
  15. package/dist/compiled/next-server/pages-api.runtime.dev.js.map +1 -1
  16. package/dist/compiled/next-server/pages-turbo.runtime.prod.js +1 -1
  17. package/dist/compiled/next-server/pages-turbo.runtime.prod.js.map +1 -1
  18. package/dist/compiled/next-server/pages.runtime.dev.js +1 -1
  19. package/dist/compiled/next-server/pages.runtime.dev.js.map +1 -1
  20. package/dist/esm/build/index.js +2 -2
  21. package/dist/esm/build/swc/index.js +1 -1
  22. package/dist/esm/build/webpack/loaders/next-flight-action-entry-loader.js.map +1 -1
  23. package/dist/esm/build/webpack/plugins/flight-client-entry-plugin.js +9 -4
  24. package/dist/esm/build/webpack/plugins/flight-client-entry-plugin.js.map +1 -1
  25. package/dist/esm/build/webpack-config.js +2 -2
  26. package/dist/esm/client/app-bootstrap.js +1 -1
  27. package/dist/esm/client/index.js +1 -1
  28. package/dist/esm/lib/find-root.js +1 -1
  29. package/dist/esm/lib/find-root.js.map +1 -1
  30. package/dist/esm/server/config.js +19 -16
  31. package/dist/esm/server/config.js.map +1 -1
  32. package/dist/esm/server/dev/hot-reloader-turbopack.js +1 -1
  33. package/dist/esm/server/dev/hot-reloader-webpack.js +1 -1
  34. package/dist/esm/server/lib/app-info-log.js +1 -1
  35. package/dist/esm/server/lib/start-server.js +1 -1
  36. package/dist/esm/shared/lib/canary-only.js +1 -1
  37. package/dist/esm/shared/lib/turbopack/manifest-loader.js +2 -0
  38. package/dist/esm/shared/lib/turbopack/manifest-loader.js.map +1 -1
  39. package/dist/lib/find-root.d.ts +1 -1
  40. package/dist/lib/find-root.js +1 -1
  41. package/dist/lib/find-root.js.map +1 -1
  42. package/dist/server/config.js +19 -16
  43. package/dist/server/config.js.map +1 -1
  44. package/dist/server/dev/hot-reloader-turbopack.js +1 -1
  45. package/dist/server/dev/hot-reloader-webpack.js +1 -1
  46. package/dist/server/lib/app-info-log.js +1 -1
  47. package/dist/server/lib/start-server.js +1 -1
  48. package/dist/shared/lib/canary-only.js +1 -1
  49. package/dist/shared/lib/turbopack/manifest-loader.js +2 -0
  50. package/dist/shared/lib/turbopack/manifest-loader.js.map +1 -1
  51. package/dist/telemetry/anonymous-meta.js +1 -1
  52. package/dist/telemetry/events/session-stopped.js +2 -2
  53. package/dist/telemetry/events/version.js +2 -2
  54. package/package.json +15 -15
package/dist/bin/next CHANGED
@@ -79,7 +79,7 @@ const program = new NextRootCommand();
79
79
  program.name('next').description('The Next.js CLI allows you to develop, build, start your application, and more.').configureHelp({
80
80
  formatHelp: (cmd, helper)=>(0, _formatclihelpoutput.formatCliHelpOutput)(cmd, helper),
81
81
  subcommandTerm: (cmd)=>`${cmd.name()} ${cmd.usage()}`
82
- }).helpCommand(false).helpOption('-h, --help', 'Displays this message.').version(`Next.js v${"15.4.2-canary.49"}`, '-v, --version', 'Outputs the Next.js version.');
82
+ }).helpCommand(false).helpOption('-h, --help', 'Displays this message.').version(`Next.js v${"15.4.2-canary.50"}`, '-v, --version', 'Outputs the Next.js version.');
83
83
  program.command('build').description('Creates an optimized production build of your application. The output displays information about each route.').argument('[directory]', `A directory on which to build the application. ${(0, _picocolors.italic)('If no directory is provided, the current directory will be used.')}`).option('-d, --debug', 'Enables a more verbose build output.').option('--debug-prerender', 'Enables debug mode for prerendering. Not for production use!').option('--no-lint', 'Disables linting.').option('--no-mangling', 'Disables mangling.').option('--profile', 'Enables production profiling for React.').option('--experimental-app-only', 'Builds only App Router routes.').option('--turbo', 'Starts development mode using Turbopack.').option('--turbopack', 'Starts development mode using Turbopack.').addOption(new _commander.Option('--experimental-build-mode [mode]', 'Uses an experimental build mode.').choices([
84
84
  'compile',
85
85
  'generate',
@@ -367,7 +367,7 @@ async function build(dir, reactProductionProfiling = false, debugOutput = false,
367
367
  const nextBuildSpan = (0, _trace.trace)('next-build', undefined, {
368
368
  buildMode: experimentalBuildMode,
369
369
  isTurboBuild: String(isTurbopack),
370
- version: "15.4.2-canary.49"
370
+ version: "15.4.2-canary.50"
371
371
  });
372
372
  _buildcontext.NextBuildContext.nextBuildSpan = nextBuildSpan;
373
373
  _buildcontext.NextBuildContext.dir = dir;
@@ -822,7 +822,7 @@ async function build(dir, reactProductionProfiling = false, debugOutput = false,
822
822
  // Files outside of the distDir can be "type": "module"
823
823
  await writeFileUtf8(_path.default.join(distDir, 'package.json'), '{"type": "commonjs"}');
824
824
  // These are written to distDir, so they need to come after creating and cleaning distDr.
825
- await (0, _builddiagnostics.recordFrameworkVersion)("15.4.2-canary.49");
825
+ await (0, _builddiagnostics.recordFrameworkVersion)("15.4.2-canary.50");
826
826
  await (0, _builddiagnostics.updateBuildDiagnostics)({
827
827
  buildStage: 'start'
828
828
  });
@@ -131,7 +131,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
131
131
  }
132
132
  return newObj;
133
133
  }
134
- const nextVersion = "15.4.2-canary.49";
134
+ const nextVersion = "15.4.2-canary.50";
135
135
  const ArchName = (0, _os.arch)();
136
136
  const PlatformName = (0, _os.platform)();
137
137
  function infoLog(...args) {
@@ -6,7 +6,8 @@ export type FlightActionEntryLoaderActions = [
6
6
  path: string,
7
7
  actions: {
8
8
  id: string;
9
- exportedName: string;
9
+ exportedName?: string;
10
+ filename?: string;
10
11
  }[]
11
12
  ][];
12
13
  declare function nextFlightActionEntryLoader(this: webpack.LoaderContext<NextFlightActionEntryLoaderOptions>): string;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/build/webpack/loaders/next-flight-action-entry-loader.ts"],"sourcesContent":["import type { webpack } from 'next/dist/compiled/webpack/webpack'\n\nexport type NextFlightActionEntryLoaderOptions = {\n actions: string\n}\n\nexport type FlightActionEntryLoaderActions = [\n path: string,\n actions: { id: string; exportedName: string }[],\n][]\n\nfunction nextFlightActionEntryLoader(\n this: webpack.LoaderContext<NextFlightActionEntryLoaderOptions>\n) {\n const { actions }: NextFlightActionEntryLoaderOptions = this.getOptions()\n\n const actionList = JSON.parse(actions) as FlightActionEntryLoaderActions\n const individualActions = actionList\n .map(([path, actionsFromModule]) => {\n return actionsFromModule.map(({ id, exportedName }) => {\n return [id, path, exportedName] as const\n })\n })\n .flat()\n\n return `\n${individualActions\n .map(([id, path, exportedName]) => {\n // Re-export the same functions from the original module path as action IDs.\n return `export { ${exportedName} as \"${id}\" } from ${JSON.stringify(path)}`\n })\n .join('\\n')}\n`\n}\n\nexport default nextFlightActionEntryLoader\n"],"names":["nextFlightActionEntryLoader","actions","getOptions","actionList","JSON","parse","individualActions","map","path","actionsFromModule","id","exportedName","flat","stringify","join"],"mappings":";;;;+BAmCA;;;eAAA;;;AAxBA,SAASA;IAGP,MAAM,EAAEC,OAAO,EAAE,GAAuC,IAAI,CAACC,UAAU;IAEvE,MAAMC,aAAaC,KAAKC,KAAK,CAACJ;IAC9B,MAAMK,oBAAoBH,WACvBI,GAAG,CAAC,CAAC,CAACC,MAAMC,kBAAkB;QAC7B,OAAOA,kBAAkBF,GAAG,CAAC,CAAC,EAAEG,EAAE,EAAEC,YAAY,EAAE;YAChD,OAAO;gBAACD;gBAAIF;gBAAMG;aAAa;QACjC;IACF,GACCC,IAAI;IAEP,OAAO,CAAC;AACV,EAAEN,kBACCC,GAAG,CAAC,CAAC,CAACG,IAAIF,MAAMG,aAAa;QAC5B,4EAA4E;QAC5E,OAAO,CAAC,SAAS,EAAEA,aAAa,KAAK,EAAED,GAAG,SAAS,EAAEN,KAAKS,SAAS,CAACL,OAAO;IAC7E,GACCM,IAAI,CAAC,MAAM;AACd,CAAC;AACD;MAEA,WAAed","ignoreList":[0]}
1
+ {"version":3,"sources":["../../../../src/build/webpack/loaders/next-flight-action-entry-loader.ts"],"sourcesContent":["import type { webpack } from 'next/dist/compiled/webpack/webpack'\n\nexport type NextFlightActionEntryLoaderOptions = {\n actions: string\n}\n\nexport type FlightActionEntryLoaderActions = [\n path: string,\n actions: { id: string; exportedName?: string; filename?: string }[],\n][]\n\nfunction nextFlightActionEntryLoader(\n this: webpack.LoaderContext<NextFlightActionEntryLoaderOptions>\n) {\n const { actions }: NextFlightActionEntryLoaderOptions = this.getOptions()\n\n const actionList = JSON.parse(actions) as FlightActionEntryLoaderActions\n const individualActions = actionList\n .map(([path, actionsFromModule]) => {\n return actionsFromModule.map(({ id, exportedName }) => {\n return [id, path, exportedName] as const\n })\n })\n .flat()\n\n return `\n${individualActions\n .map(([id, path, exportedName]) => {\n // Re-export the same functions from the original module path as action IDs.\n return `export { ${exportedName} as \"${id}\" } from ${JSON.stringify(path)}`\n })\n .join('\\n')}\n`\n}\n\nexport default nextFlightActionEntryLoader\n"],"names":["nextFlightActionEntryLoader","actions","getOptions","actionList","JSON","parse","individualActions","map","path","actionsFromModule","id","exportedName","flat","stringify","join"],"mappings":";;;;+BAmCA;;;eAAA;;;AAxBA,SAASA;IAGP,MAAM,EAAEC,OAAO,EAAE,GAAuC,IAAI,CAACC,UAAU;IAEvE,MAAMC,aAAaC,KAAKC,KAAK,CAACJ;IAC9B,MAAMK,oBAAoBH,WACvBI,GAAG,CAAC,CAAC,CAACC,MAAMC,kBAAkB;QAC7B,OAAOA,kBAAkBF,GAAG,CAAC,CAAC,EAAEG,EAAE,EAAEC,YAAY,EAAE;YAChD,OAAO;gBAACD;gBAAIF;gBAAMG;aAAa;QACjC;IACF,GACCC,IAAI;IAEP,OAAO,CAAC;AACV,EAAEN,kBACCC,GAAG,CAAC,CAAC,CAACG,IAAIF,MAAMG,aAAa;QAC5B,4EAA4E;QAC5E,OAAO,CAAC,SAAS,EAAEA,aAAa,KAAK,EAAED,GAAG,SAAS,EAAEN,KAAKS,SAAS,CAACL,OAAO;IAC7E,GACCM,IAAI,CAAC,MAAM;AACd,CAAC;AACD;MAEA,WAAed","ignoreList":[0]}
@@ -8,6 +8,8 @@ interface Options {
8
8
  }
9
9
  type Actions = {
10
10
  [actionId: string]: {
11
+ exportedName?: string;
12
+ filename?: string;
11
13
  workers: {
12
14
  [name: string]: {
13
15
  moduleId: string | number;
@@ -21,7 +23,8 @@ type Actions = {
21
23
  };
22
24
  type ActionIdNamePair = {
23
25
  id: string;
24
- exportedName: string;
26
+ exportedName?: string;
27
+ filename?: string;
25
28
  };
26
29
  export type ActionManifest = {
27
30
  encryptionKey: string;
@@ -35,6 +38,7 @@ export interface ModuleInfo {
35
38
  export declare class FlightClientEntryPlugin {
36
39
  dev: boolean;
37
40
  appDir: string;
41
+ projectDir: string;
38
42
  encryptionKey: string;
39
43
  isEdgeServer: boolean;
40
44
  assetPrefix: string;
@@ -104,6 +104,7 @@ class FlightClientEntryPlugin {
104
104
  constructor(options){
105
105
  this.dev = options.dev;
106
106
  this.appDir = options.appDir;
107
+ this.projectDir = _path.default.join(options.appDir, '..');
107
108
  this.isEdgeServer = options.isEdgeServer;
108
109
  this.assetPrefix = !this.dev && !this.isEdgeServer ? '../' : '';
109
110
  this.encryptionKey = options.encryptionKey;
@@ -401,7 +402,8 @@ class FlightClientEntryPlugin {
401
402
  if (actionIds) {
402
403
  collectedActions.set(modResource, Object.entries(actionIds).map(([id, exportedName])=>({
403
404
  id,
404
- exportedName
405
+ exportedName,
406
+ filename: _path.default.posix.relative(this.projectDir, modResource)
405
407
  })));
406
408
  }
407
409
  // Collect used exported actions transversely.
@@ -457,7 +459,8 @@ class FlightClientEntryPlugin {
457
459
  modResource,
458
460
  Object.entries(actionIds).map(([id, exportedName])=>({
459
461
  id,
460
- exportedName
462
+ exportedName,
463
+ filename: _path.default.posix.relative(this.projectDir, modResource)
461
464
  }))
462
465
  ]);
463
466
  }
@@ -596,11 +599,13 @@ class FlightClientEntryPlugin {
596
599
  })}!`;
597
600
  const currentCompilerServerActions = this.isEdgeServer ? pluginState.edgeServerActions : pluginState.serverActions;
598
601
  for (const [, actionsFromModule] of actionsArray){
599
- for (const { id } of actionsFromModule){
602
+ for (const { id, exportedName, filename } of actionsFromModule){
600
603
  if (typeof currentCompilerServerActions[id] === 'undefined') {
601
604
  currentCompilerServerActions[id] = {
602
605
  workers: {},
603
- layer: {}
606
+ layer: {},
607
+ filename,
608
+ exportedName
604
609
  };
605
610
  }
606
611
  currentCompilerServerActions[id].workers[bundlePath] = {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/build/webpack/plugins/flight-client-entry-plugin.ts"],"sourcesContent":["import type {\n CssImports,\n ClientComponentImports,\n} from '../loaders/next-flight-client-entry-loader'\n\nimport { webpack } from 'next/dist/compiled/webpack/webpack'\nimport { parse, stringify } from 'querystring'\nimport path from 'path'\nimport { sources } from 'next/dist/compiled/webpack/webpack'\nimport {\n getInvalidator,\n getEntries,\n EntryTypes,\n getEntryKey,\n} from '../../../server/dev/on-demand-entry-handler'\nimport {\n WEBPACK_LAYERS,\n WEBPACK_RESOURCE_QUERIES,\n} from '../../../lib/constants'\nimport {\n APP_CLIENT_INTERNALS,\n BARREL_OPTIMIZATION_PREFIX,\n COMPILER_NAMES,\n DEFAULT_RUNTIME_WEBPACK,\n EDGE_RUNTIME_WEBPACK,\n SERVER_REFERENCE_MANIFEST,\n UNDERSCORE_NOT_FOUND_ROUTE_ENTRY,\n} from '../../../shared/lib/constants'\nimport {\n isClientComponentEntryModule,\n isCSSMod,\n regexCSS,\n} from '../loaders/utils'\nimport {\n traverseModules,\n forEachEntryModule,\n formatBarrelOptimizedResource,\n getModuleReferencesInOrder,\n} from '../utils'\nimport { normalizePathSep } from '../../../shared/lib/page-path/normalize-path-sep'\nimport { getProxiedPluginState } from '../../build-context'\nimport { PAGE_TYPES } from '../../../lib/page-types'\nimport { getModuleBuildInfo } from '../loaders/get-module-build-info'\nimport { getAssumedSourceType } from '../loaders/next-flight-loader'\nimport { isAppRouteRoute } from '../../../lib/is-app-route-route'\nimport {\n DEFAULT_METADATA_ROUTE_EXTENSIONS,\n isMetadataRouteFile,\n} from '../../../lib/metadata/is-metadata-route'\nimport type { MetadataRouteLoaderOptions } from '../loaders/next-metadata-route-loader'\nimport type { FlightActionEntryLoaderActions } from '../loaders/next-flight-action-entry-loader'\nimport getWebpackBundler from '../../../shared/lib/get-webpack-bundler'\n\ninterface Options {\n dev: boolean\n appDir: string\n isEdgeServer: boolean\n encryptionKey: string\n}\n\nconst PLUGIN_NAME = 'FlightClientEntryPlugin'\n\ntype Actions = {\n [actionId: string]: {\n workers: {\n [name: string]: { moduleId: string | number; async: boolean }\n }\n // Record which layer the action is in (rsc or sc_action), in the specific entry.\n layer: {\n [name: string]: string\n }\n }\n}\n\ntype ActionIdNamePair = { id: string; exportedName: string }\n\nexport type ActionManifest = {\n // Assign a unique encryption key during production build.\n encryptionKey: string\n node: Actions\n edge: Actions\n}\n\nexport interface ModuleInfo {\n moduleId: string | number\n async: boolean\n}\n\nconst pluginState = getProxiedPluginState({\n // A map to track \"action\" -> \"list of bundles\".\n serverActions: {} as ActionManifest['node'],\n edgeServerActions: {} as ActionManifest['edge'],\n\n serverActionModules: {} as {\n [workerName: string]: { server?: ModuleInfo; client?: ModuleInfo }\n },\n\n edgeServerActionModules: {} as {\n [workerName: string]: { server?: ModuleInfo; client?: ModuleInfo }\n },\n\n ssrModules: {} as { [ssrModuleId: string]: ModuleInfo },\n edgeSsrModules: {} as { [ssrModuleId: string]: ModuleInfo },\n\n rscModules: {} as { [rscModuleId: string]: ModuleInfo },\n edgeRscModules: {} as { [rscModuleId: string]: ModuleInfo },\n\n injectedClientEntries: {} as Record<string, string>,\n})\n\nconst POSSIBLE_SHARED_CONVENTIONS = ['template', 'layout']\nconst STANDALONE_BUNDLE_CONVENTION = 'global-not-found'\n\nfunction deduplicateCSSImportsForEntry(mergedCSSimports: CssImports) {\n // If multiple entry module connections are having the same CSS import,\n // we only need to have one module to keep track of that CSS import.\n // It is based on the fact that if a page or a layout is rendered in the\n // given entry, all its parent layouts are always rendered too.\n // This can avoid duplicate CSS imports in the generated CSS manifest,\n // for example, if a page and its parent layout are both using the same\n // CSS import, we only need to have the layout to keep track of that CSS\n // import.\n // To achieve this, we need to first collect all the CSS imports from\n // every connection, and deduplicate them in the order of layers from\n // top to bottom. The implementation can be generally described as:\n // - Sort by number of `/` in the request path (the more `/`, the deeper)\n // - When in the same depth, sort by the filename (template < layout < page and others)\n\n // Sort the connections as described above.\n const sortedCSSImports = Object.entries(mergedCSSimports).sort((a, b) => {\n const [aPath] = a\n const [bPath] = b\n\n const aDepth = aPath.split('/').length\n const bDepth = bPath.split('/').length\n\n if (aDepth !== bDepth) {\n return aDepth - bDepth\n }\n\n const aName = path.parse(aPath).name\n const bName = path.parse(bPath).name\n\n const indexA = POSSIBLE_SHARED_CONVENTIONS.indexOf(aName)\n const indexB = POSSIBLE_SHARED_CONVENTIONS.indexOf(bName)\n\n if (indexA === -1) return 1\n if (indexB === -1) return -1\n return indexA - indexB\n })\n\n const dedupedCSSImports: CssImports = {}\n const trackedCSSImports = new Set<string>()\n\n for (const [entryFilePath, cssImports] of sortedCSSImports) {\n const entryConventionName = path.parse(entryFilePath).name\n\n for (const cssImport of cssImports) {\n // If the CSS import is already tracked, we can skip it.\n // Or if it's any standalone entry such as `global-not-found`, it won't share any resources with other entry, skip it.\n if (\n trackedCSSImports.has(cssImport) &&\n STANDALONE_BUNDLE_CONVENTION !== entryConventionName\n ) {\n continue\n }\n\n // Only track CSS imports that are in files that can inherit CSS.\n if (POSSIBLE_SHARED_CONVENTIONS.includes(entryConventionName)) {\n trackedCSSImports.add(cssImport)\n }\n\n if (!dedupedCSSImports[entryFilePath]) {\n dedupedCSSImports[entryFilePath] = []\n }\n dedupedCSSImports[entryFilePath].push(cssImport)\n }\n }\n\n return dedupedCSSImports\n}\n\nexport class FlightClientEntryPlugin {\n dev: boolean\n appDir: string\n encryptionKey: string\n isEdgeServer: boolean\n assetPrefix: string\n webpackRuntime: string\n\n constructor(options: Options) {\n this.dev = options.dev\n this.appDir = options.appDir\n this.isEdgeServer = options.isEdgeServer\n this.assetPrefix = !this.dev && !this.isEdgeServer ? '../' : ''\n this.encryptionKey = options.encryptionKey\n this.webpackRuntime = this.isEdgeServer\n ? EDGE_RUNTIME_WEBPACK\n : DEFAULT_RUNTIME_WEBPACK\n }\n\n apply(compiler: webpack.Compiler) {\n compiler.hooks.finishMake.tapPromise(PLUGIN_NAME, (compilation) =>\n this.createClientEntries(compiler, compilation)\n )\n\n compiler.hooks.afterCompile.tap(PLUGIN_NAME, (compilation) => {\n const recordModule = (modId: string, mod: any) => {\n // Match Resource is undefined unless an import is using the inline match resource syntax\n // https://webpack.js.org/api/loaders/#inline-matchresource\n const modPath = mod.matchResource || mod.resourceResolveData?.path\n const modQuery = mod.resourceResolveData?.query || ''\n // query is already part of mod.resource\n // so it's only necessary to add it for matchResource or mod.resourceResolveData\n const modResource = modPath\n ? modPath.startsWith(BARREL_OPTIMIZATION_PREFIX)\n ? formatBarrelOptimizedResource(mod.resource, modPath)\n : modPath + modQuery\n : mod.resource\n\n if (typeof modId !== 'undefined' && modResource) {\n if (mod.layer === WEBPACK_LAYERS.reactServerComponents) {\n const key = path\n .relative(compiler.context, modResource)\n .replace(/\\/next\\/dist\\/esm\\//, '/next/dist/')\n\n const moduleInfo: ModuleInfo = {\n moduleId: modId,\n async: compilation.moduleGraph.isAsync(mod),\n }\n\n if (this.isEdgeServer) {\n pluginState.edgeRscModules[key] = moduleInfo\n } else {\n pluginState.rscModules[key] = moduleInfo\n }\n }\n }\n\n if (mod.layer !== WEBPACK_LAYERS.serverSideRendering) {\n return\n }\n\n // Check mod resource to exclude the empty resource module like virtual module created by next-flight-client-entry-loader\n if (typeof modId !== 'undefined' && modResource) {\n // Note that this isn't that reliable as webpack is still possible to assign\n // additional queries to make sure there's no conflict even using the `named`\n // module ID strategy.\n let ssrNamedModuleId = path.relative(compiler.context, modResource)\n\n if (!ssrNamedModuleId.startsWith('.')) {\n // TODO use getModuleId instead\n ssrNamedModuleId = `./${normalizePathSep(ssrNamedModuleId)}`\n }\n\n const moduleInfo: ModuleInfo = {\n moduleId: modId,\n async: compilation.moduleGraph.isAsync(mod),\n }\n\n if (this.isEdgeServer) {\n pluginState.edgeSsrModules[\n ssrNamedModuleId.replace(/\\/next\\/dist\\/esm\\//, '/next/dist/')\n ] = moduleInfo\n } else {\n pluginState.ssrModules[ssrNamedModuleId] = moduleInfo\n }\n }\n }\n\n traverseModules(compilation, (mod, _chunk, _chunkGroup, modId) => {\n if (modId) recordModule(modId, mod)\n })\n })\n\n compiler.hooks.make.tap(PLUGIN_NAME, (compilation) => {\n compilation.hooks.processAssets.tapPromise(\n {\n name: PLUGIN_NAME,\n stage: webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_HASH,\n },\n () => this.createActionAssets(compilation)\n )\n })\n }\n\n async createClientEntries(\n compiler: webpack.Compiler,\n compilation: webpack.Compilation\n ) {\n const addClientEntryAndSSRModulesList: Array<\n ReturnType<typeof this.injectClientEntryAndSSRModules>\n > = []\n const createdSSRDependenciesForEntry: Record<\n string,\n ReturnType<typeof this.injectClientEntryAndSSRModules>[3][]\n > = {}\n\n const addActionEntryList: Array<ReturnType<typeof this.injectActionEntry>> =\n []\n const actionMapsPerEntry: Record<\n string,\n Map<string, ActionIdNamePair[]>\n > = {}\n const createdActionIds = new Set<string>()\n\n // For each SC server compilation entry, we need to create its corresponding\n // client component entry.\n forEachEntryModule(compilation, ({ name, entryModule }) => {\n const internalClientComponentEntryImports: ClientComponentImports = {}\n const actionEntryImports = new Map<string, ActionIdNamePair[]>()\n const clientEntriesToInject = []\n const mergedCSSimports: CssImports = {}\n\n for (const connection of getModuleReferencesInOrder(\n entryModule,\n compilation.moduleGraph\n )) {\n // Entry can be any user defined entry files such as layout, page, error, loading, etc.\n let entryRequest = (\n connection.dependency as unknown as webpack.NormalModule\n ).request\n\n if (entryRequest.endsWith(WEBPACK_RESOURCE_QUERIES.metadataRoute)) {\n const { filePath, isDynamicRouteExtension } =\n getMetadataRouteResource(entryRequest)\n\n if (isDynamicRouteExtension === '1') {\n entryRequest = filePath\n }\n }\n\n const { clientComponentImports, actionImports, cssImports } =\n this.collectComponentInfoFromServerEntryDependency({\n entryRequest,\n compilation,\n resolvedModule: connection.resolvedModule,\n })\n\n actionImports.forEach(([dep, actions]) =>\n actionEntryImports.set(dep, actions)\n )\n\n const isAbsoluteRequest = path.isAbsolute(entryRequest)\n\n // Next.js internals are put into a separate entry.\n if (!isAbsoluteRequest) {\n Object.keys(clientComponentImports).forEach(\n (value) => (internalClientComponentEntryImports[value] = new Set())\n )\n continue\n }\n\n // TODO-APP: Enable these lines. This ensures no entrypoint is created for layout/page when there are no client components.\n // Currently disabled because it causes test failures in CI.\n // if (clientImports.length === 0 && actionImports.length === 0) {\n // continue\n // }\n\n const relativeRequest = isAbsoluteRequest\n ? path.relative(compilation.options.context!, entryRequest)\n : entryRequest\n\n // Replace file suffix as `.js` will be added.\n // bundlePath will have app/ prefix but not src/.\n // e.g. src/app/foo/page.js -> app/foo/page\n let bundlePath = normalizePathSep(\n relativeRequest.replace(/\\.[^.\\\\/]+$/, '').replace(/^src[\\\\/]/, '')\n )\n\n // For metadata routes, the entry name can be used as the bundle path,\n // as it has been normalized already.\n // e.g.\n // When `relativeRequest` is 'src/app/sitemap.js',\n // `appDirRelativeRequest` will be '/sitemap.js'\n // then `isMetadataEntryFile` will be `true`\n const appDirRelativeRequest = relativeRequest\n .replace(/^src[\\\\/]/, '')\n .replace(/^app[\\\\/]/, '/')\n const isMetadataEntryFile = isMetadataRouteFile(\n appDirRelativeRequest,\n DEFAULT_METADATA_ROUTE_EXTENSIONS,\n true\n )\n if (isMetadataEntryFile) {\n bundlePath = name\n }\n\n Object.assign(mergedCSSimports, cssImports)\n clientEntriesToInject.push({\n compiler,\n compilation,\n entryName: name,\n clientComponentImports,\n bundlePath,\n absolutePagePath: entryRequest,\n })\n\n // The webpack implementation of writing the client reference manifest relies on all entrypoints writing a page.js even when there is no client components in the page.\n // It needs the file in order to write the reference manifest for the path in the `.next/server` folder.\n // TODO-APP: This could be better handled, however Turbopack does not have the same problem as we resolve client components in a single graph.\n if (\n name === `app${UNDERSCORE_NOT_FOUND_ROUTE_ENTRY}` &&\n bundlePath === 'app/not-found'\n ) {\n clientEntriesToInject.push({\n compiler,\n compilation,\n entryName: name,\n clientComponentImports: {},\n bundlePath: `app${UNDERSCORE_NOT_FOUND_ROUTE_ENTRY}`,\n absolutePagePath: entryRequest,\n })\n }\n\n if (\n name === `app${UNDERSCORE_NOT_FOUND_ROUTE_ENTRY}` &&\n bundlePath === 'app/global-not-found'\n ) {\n clientEntriesToInject.push({\n compiler,\n compilation,\n entryName: name,\n clientComponentImports,\n bundlePath: `app${UNDERSCORE_NOT_FOUND_ROUTE_ENTRY}`,\n absolutePagePath: entryRequest,\n })\n }\n }\n\n // Make sure CSS imports are deduplicated before injecting the client entry\n // and SSR modules.\n const dedupedCSSImports = deduplicateCSSImportsForEntry(mergedCSSimports)\n for (const clientEntryToInject of clientEntriesToInject) {\n const injected = this.injectClientEntryAndSSRModules({\n ...clientEntryToInject,\n clientImports: {\n ...clientEntryToInject.clientComponentImports,\n ...(\n dedupedCSSImports[clientEntryToInject.absolutePagePath] || []\n ).reduce<ClientComponentImports>((res, curr) => {\n res[curr] = new Set()\n return res\n }, {}),\n },\n })\n\n // Track all created SSR dependencies for each entry from the server layer.\n if (!createdSSRDependenciesForEntry[clientEntryToInject.entryName]) {\n createdSSRDependenciesForEntry[clientEntryToInject.entryName] = []\n }\n createdSSRDependenciesForEntry[clientEntryToInject.entryName].push(\n injected[3]\n )\n\n addClientEntryAndSSRModulesList.push(injected)\n }\n\n if (!isAppRouteRoute(name)) {\n // Create internal app\n addClientEntryAndSSRModulesList.push(\n this.injectClientEntryAndSSRModules({\n compiler,\n compilation,\n entryName: name,\n clientImports: { ...internalClientComponentEntryImports },\n bundlePath: APP_CLIENT_INTERNALS,\n })\n )\n }\n\n if (actionEntryImports.size > 0) {\n if (!actionMapsPerEntry[name]) {\n actionMapsPerEntry[name] = new Map()\n }\n actionMapsPerEntry[name] = new Map([\n ...actionMapsPerEntry[name],\n ...actionEntryImports,\n ])\n }\n })\n\n for (const [name, actionEntryImports] of Object.entries(\n actionMapsPerEntry\n )) {\n addActionEntryList.push(\n this.injectActionEntry({\n compiler,\n compilation,\n actions: actionEntryImports,\n entryName: name,\n bundlePath: name,\n createdActionIds,\n })\n )\n }\n\n // Invalidate in development to trigger recompilation\n const invalidator = getInvalidator(compiler.outputPath)\n // Check if any of the entry injections need an invalidation\n if (\n invalidator &&\n addClientEntryAndSSRModulesList.some(\n ([shouldInvalidate]) => shouldInvalidate === true\n )\n ) {\n invalidator.invalidate([COMPILER_NAMES.client])\n }\n\n // Client compiler is invalidated before awaiting the compilation of the SSR\n // and RSC client component entries so that the client compiler is running\n // in parallel to the server compiler.\n await Promise.all(\n addClientEntryAndSSRModulesList.flatMap((addClientEntryAndSSRModules) => [\n addClientEntryAndSSRModules[1],\n addClientEntryAndSSRModules[2],\n ])\n )\n\n // Wait for action entries to be added.\n await Promise.all(addActionEntryList)\n\n const addedClientActionEntryList: Promise<any>[] = []\n const actionMapsPerClientEntry: Record<\n string,\n Map<string, ActionIdNamePair[]>\n > = {}\n\n // We need to create extra action entries that are created from the\n // client layer.\n // Start from each entry's created SSR dependency from our previous step.\n for (const [name, ssrEntryDependencies] of Object.entries(\n createdSSRDependenciesForEntry\n )) {\n // Collect from all entries, e.g. layout.js, page.js, loading.js, ...\n // add aggregate them.\n const actionEntryImports = this.collectClientActionsFromDependencies({\n compilation,\n dependencies: ssrEntryDependencies,\n })\n\n if (actionEntryImports.size > 0) {\n if (!actionMapsPerClientEntry[name]) {\n actionMapsPerClientEntry[name] = new Map()\n }\n actionMapsPerClientEntry[name] = new Map([\n ...actionMapsPerClientEntry[name],\n ...actionEntryImports,\n ])\n }\n }\n\n for (const [entryName, actionEntryImports] of Object.entries(\n actionMapsPerClientEntry\n )) {\n // If an action method is already created in the server layer, we don't\n // need to create it again in the action layer.\n // This is to avoid duplicate action instances and make sure the module\n // state is shared.\n let remainingClientImportedActions = false\n const remainingActionEntryImports = new Map<string, ActionIdNamePair[]>()\n for (const [dep, actions] of actionEntryImports) {\n const remainingActionNames = []\n for (const action of actions) {\n if (!createdActionIds.has(entryName + '@' + action.id)) {\n remainingActionNames.push(action)\n }\n }\n if (remainingActionNames.length > 0) {\n remainingActionEntryImports.set(dep, remainingActionNames)\n remainingClientImportedActions = true\n }\n }\n\n if (remainingClientImportedActions) {\n addedClientActionEntryList.push(\n this.injectActionEntry({\n compiler,\n compilation,\n actions: remainingActionEntryImports,\n entryName,\n bundlePath: entryName,\n fromClient: true,\n createdActionIds,\n })\n )\n }\n }\n\n await Promise.all(addedClientActionEntryList)\n }\n\n collectClientActionsFromDependencies({\n compilation,\n dependencies,\n }: {\n compilation: webpack.Compilation\n dependencies: ReturnType<typeof webpack.EntryPlugin.createDependency>[]\n }) {\n // action file path -> action names\n const collectedActions = new Map<string, ActionIdNamePair[]>()\n\n // Keep track of checked modules to avoid infinite loops with recursive imports.\n const visitedModule = new Set<string>()\n const visitedEntry = new Set<string>()\n\n const collectActions = ({\n entryRequest,\n resolvedModule,\n }: {\n entryRequest: string\n resolvedModule: any\n }) => {\n const collectActionsInDep = (mod: webpack.NormalModule): void => {\n if (!mod) return\n\n const modResource = getModuleResource(mod)\n\n if (!modResource) return\n\n if (visitedModule.has(modResource)) return\n visitedModule.add(modResource)\n\n const actionIds = getModuleBuildInfo(mod).rsc?.actionIds\n if (actionIds) {\n collectedActions.set(\n modResource,\n Object.entries(actionIds).map(([id, exportedName]) => ({\n id,\n exportedName,\n }))\n )\n }\n\n // Collect used exported actions transversely.\n getModuleReferencesInOrder(mod, compilation.moduleGraph).forEach(\n (connection: any) => {\n collectActionsInDep(\n connection.resolvedModule as webpack.NormalModule\n )\n }\n )\n }\n\n // Don't traverse the module graph anymore once hitting the action layer.\n if (\n entryRequest &&\n !entryRequest.includes('next-flight-action-entry-loader')\n ) {\n // Traverse the module graph to find all client components.\n collectActionsInDep(resolvedModule)\n }\n }\n\n for (const entryDependency of dependencies) {\n const ssrEntryModule =\n compilation.moduleGraph.getResolvedModule(entryDependency)!\n for (const connection of getModuleReferencesInOrder(\n ssrEntryModule,\n compilation.moduleGraph\n )) {\n const depModule = connection.dependency\n const request = (depModule as unknown as webpack.NormalModule).request\n\n // It is possible that the same entry is added multiple times in the\n // connection graph. We can just skip these to speed up the process.\n if (visitedEntry.has(request)) continue\n visitedEntry.add(request)\n\n collectActions({\n entryRequest: request,\n resolvedModule: connection.resolvedModule,\n })\n }\n }\n\n return collectedActions\n }\n\n collectComponentInfoFromServerEntryDependency({\n entryRequest,\n compilation,\n resolvedModule,\n }: {\n entryRequest: string\n compilation: webpack.Compilation\n resolvedModule: any /* Dependency */\n }): {\n cssImports: CssImports\n clientComponentImports: ClientComponentImports\n actionImports: [string, ActionIdNamePair[]][]\n } {\n // Keep track of checked modules to avoid infinite loops with recursive imports.\n const visitedOfClientComponentsTraverse = new Set()\n\n // Info to collect.\n const clientComponentImports: ClientComponentImports = {}\n const actionImports: [string, ActionIdNamePair[]][] = []\n const CSSImports = new Set<string>()\n\n const filterClientComponents = (\n mod: webpack.NormalModule,\n importedIdentifiers: string[]\n ): void => {\n if (!mod) return\n\n const modResource = getModuleResource(mod)\n\n if (!modResource) return\n if (visitedOfClientComponentsTraverse.has(modResource)) {\n if (clientComponentImports[modResource]) {\n addClientImport(\n mod,\n modResource,\n clientComponentImports,\n importedIdentifiers,\n false\n )\n }\n return\n }\n visitedOfClientComponentsTraverse.add(modResource)\n\n const actionIds = getModuleBuildInfo(mod).rsc?.actionIds\n if (actionIds) {\n actionImports.push([\n modResource,\n Object.entries(actionIds).map(([id, exportedName]) => ({\n id,\n exportedName,\n })),\n ])\n }\n\n if (isCSSMod(mod)) {\n const sideEffectFree =\n mod.factoryMeta && (mod.factoryMeta as any).sideEffectFree\n\n if (sideEffectFree) {\n const unused = !compilation.moduleGraph\n .getExportsInfo(mod)\n .isModuleUsed(this.webpackRuntime)\n\n if (unused) return\n }\n\n CSSImports.add(modResource)\n } else if (isClientComponentEntryModule(mod)) {\n if (!clientComponentImports[modResource]) {\n clientComponentImports[modResource] = new Set()\n }\n addClientImport(\n mod,\n modResource,\n clientComponentImports,\n importedIdentifiers,\n true\n )\n\n return\n }\n\n getModuleReferencesInOrder(mod, compilation.moduleGraph).forEach(\n (connection: any) => {\n let dependencyIds: string[] = []\n\n // `ids` are the identifiers that are imported from the dependency,\n // if it's present, it's an array of strings.\n if (connection.dependency?.ids) {\n dependencyIds.push(...connection.dependency.ids)\n } else {\n dependencyIds = ['*']\n }\n\n filterClientComponents(connection.resolvedModule, dependencyIds)\n }\n )\n }\n\n // Traverse the module graph to find all client components.\n filterClientComponents(resolvedModule, [])\n\n return {\n clientComponentImports,\n cssImports: CSSImports.size\n ? {\n [entryRequest]: Array.from(CSSImports),\n }\n : {},\n actionImports,\n }\n }\n\n injectClientEntryAndSSRModules({\n compiler,\n compilation,\n entryName,\n clientImports,\n bundlePath,\n absolutePagePath,\n }: {\n compiler: webpack.Compiler\n compilation: webpack.Compilation\n entryName: string\n clientImports: ClientComponentImports\n bundlePath: string\n absolutePagePath?: string\n }): [\n shouldInvalidate: boolean,\n addSSREntryPromise: Promise<void>,\n addRSCEntryPromise: Promise<void>,\n ssrDep: ReturnType<typeof webpack.EntryPlugin.createDependency>,\n ] {\n const bundler = getWebpackBundler()\n let shouldInvalidate = false\n\n const modules = Object.keys(clientImports)\n .sort((a, b) => (regexCSS.test(b) ? 1 : a.localeCompare(b)))\n .map((clientImportPath) => ({\n request: clientImportPath,\n ids: [...clientImports[clientImportPath]],\n }))\n\n // For the client entry, we always use the CJS build of Next.js. If the\n // server is using the ESM build (when using the Edge runtime), we need to\n // replace them.\n const clientBrowserLoader = `next-flight-client-entry-loader?${stringify({\n modules: (this.isEdgeServer\n ? modules.map(({ request, ids }) => ({\n request: request.replace(\n /[\\\\/]next[\\\\/]dist[\\\\/]esm[\\\\/]/,\n '/next/dist/'.replace(/\\//g, path.sep)\n ),\n ids,\n }))\n : modules\n ).map((x) => JSON.stringify(x)),\n server: false,\n })}!`\n\n const clientServerLoader = `next-flight-client-entry-loader?${stringify({\n modules: modules.map((x) => JSON.stringify(x)),\n server: true,\n })}!`\n\n // Add for the client compilation\n // Inject the entry to the client compiler.\n if (this.dev) {\n const entries = getEntries(compiler.outputPath)\n const pageKey = getEntryKey(\n COMPILER_NAMES.client,\n PAGE_TYPES.APP,\n bundlePath\n )\n\n if (!entries[pageKey]) {\n entries[pageKey] = {\n type: EntryTypes.CHILD_ENTRY,\n parentEntries: new Set([entryName]),\n absoluteEntryFilePath: absolutePagePath,\n bundlePath,\n request: clientBrowserLoader,\n dispose: false,\n lastActiveTime: Date.now(),\n }\n shouldInvalidate = true\n } else {\n const entryData = entries[pageKey]\n // New version of the client loader\n if (entryData.request !== clientBrowserLoader) {\n entryData.request = clientBrowserLoader\n shouldInvalidate = true\n }\n if (entryData.type === EntryTypes.CHILD_ENTRY) {\n entryData.parentEntries.add(entryName)\n }\n entryData.dispose = false\n entryData.lastActiveTime = Date.now()\n }\n } else {\n pluginState.injectedClientEntries[bundlePath] = clientBrowserLoader\n }\n\n const clientComponentSSREntryDep = bundler.EntryPlugin.createDependency(\n clientServerLoader,\n { name: bundlePath }\n )\n\n const clientComponentRSCEntryDep = bundler.EntryPlugin.createDependency(\n clientServerLoader,\n { name: bundlePath }\n )\n\n return [\n shouldInvalidate,\n // Add the entries to the server compiler for the SSR and RSC layers. The\n // promises are awaited later using `Promise.all` in order to parallelize\n // adding the entries.\n this.addEntry(compilation, compiler.context, clientComponentSSREntryDep, {\n name: entryName,\n layer: WEBPACK_LAYERS.serverSideRendering,\n }),\n this.addEntry(compilation, compiler.context, clientComponentRSCEntryDep, {\n name: entryName,\n layer: WEBPACK_LAYERS.reactServerComponents,\n }),\n clientComponentSSREntryDep,\n ]\n }\n\n injectActionEntry({\n compiler,\n compilation,\n actions,\n entryName,\n bundlePath,\n fromClient,\n createdActionIds,\n }: {\n compiler: webpack.Compiler\n compilation: webpack.Compilation\n actions: Map<string, ActionIdNamePair[]>\n entryName: string\n bundlePath: string\n createdActionIds: Set<string>\n fromClient?: boolean\n }) {\n const bundler = getWebpackBundler()\n const actionsArray = Array.from(actions.entries())\n for (const [, actionsFromModule] of actions) {\n for (const { id } of actionsFromModule) {\n createdActionIds.add(entryName + '@' + id)\n }\n }\n\n if (actionsArray.length === 0) {\n return Promise.resolve()\n }\n\n const actionLoader = `next-flight-action-entry-loader?${stringify({\n actions: JSON.stringify(\n actionsArray satisfies FlightActionEntryLoaderActions\n ),\n __client_imported__: fromClient,\n })}!`\n\n const currentCompilerServerActions = this.isEdgeServer\n ? pluginState.edgeServerActions\n : pluginState.serverActions\n\n for (const [, actionsFromModule] of actionsArray) {\n for (const { id } of actionsFromModule) {\n if (typeof currentCompilerServerActions[id] === 'undefined') {\n currentCompilerServerActions[id] = {\n workers: {},\n layer: {},\n }\n }\n currentCompilerServerActions[id].workers[bundlePath] = {\n moduleId: '', // TODO: What's the meaning of this?\n async: false,\n }\n\n currentCompilerServerActions[id].layer[bundlePath] = fromClient\n ? WEBPACK_LAYERS.actionBrowser\n : WEBPACK_LAYERS.reactServerComponents\n }\n }\n\n // Inject the entry to the server compiler\n const actionEntryDep = bundler.EntryPlugin.createDependency(actionLoader, {\n name: bundlePath,\n })\n\n return this.addEntry(\n compilation,\n // Reuse compilation context.\n compiler.context,\n actionEntryDep,\n {\n name: entryName,\n layer: fromClient\n ? WEBPACK_LAYERS.actionBrowser\n : WEBPACK_LAYERS.reactServerComponents,\n }\n )\n }\n\n addEntry(\n compilation: webpack.Compilation,\n context: string,\n dependency: webpack.Dependency,\n options: webpack.EntryOptions\n ): Promise<any> /* Promise<module> */ {\n return new Promise((resolve, reject) => {\n if ('rspack' in compilation.compiler) {\n compilation.addInclude(context, dependency, options, (err, module) => {\n if (err) {\n return reject(err)\n }\n\n compilation.moduleGraph\n .getExportsInfo(module!)\n .setUsedInUnknownWay(\n this.isEdgeServer ? EDGE_RUNTIME_WEBPACK : DEFAULT_RUNTIME_WEBPACK\n )\n return resolve(module)\n })\n } else {\n const entry = compilation.entries.get(options.name!)!\n entry.includeDependencies.push(dependency)\n compilation.hooks.addEntry.call(entry as any, options)\n compilation.addModuleTree(\n {\n context,\n dependency,\n contextInfo: { issuerLayer: options.layer },\n },\n (err: any, module: any) => {\n if (err) {\n compilation.hooks.failedEntry.call(dependency, options, err)\n return reject(err)\n }\n\n compilation.hooks.succeedEntry.call(dependency, options, module)\n\n compilation.moduleGraph\n .getExportsInfo(module)\n .setUsedInUnknownWay(\n this.isEdgeServer\n ? EDGE_RUNTIME_WEBPACK\n : DEFAULT_RUNTIME_WEBPACK\n )\n\n return resolve(module)\n }\n )\n }\n })\n }\n\n async createActionAssets(compilation: webpack.Compilation) {\n const serverActions: ActionManifest['node'] = {}\n const edgeServerActions: ActionManifest['edge'] = {}\n\n traverseModules(compilation, (mod, _chunk, chunkGroup, modId) => {\n // Go through all action entries and record the module ID for each entry.\n if (\n chunkGroup.name &&\n mod.request &&\n modId &&\n /next-flight-action-entry-loader/.test(mod.request)\n ) {\n const fromClient = /&__client_imported__=true/.test(mod.request)\n\n const mapping = this.isEdgeServer\n ? pluginState.edgeServerActionModules\n : pluginState.serverActionModules\n\n if (!mapping[chunkGroup.name]) {\n mapping[chunkGroup.name] = {}\n }\n mapping[chunkGroup.name][fromClient ? 'client' : 'server'] = {\n moduleId: modId,\n async: compilation.moduleGraph.isAsync(mod),\n }\n }\n })\n\n for (let id in pluginState.serverActions) {\n const action = pluginState.serverActions[id]\n for (let name in action.workers) {\n const modId =\n pluginState.serverActionModules[name][\n action.layer[name] === WEBPACK_LAYERS.actionBrowser\n ? 'client'\n : 'server'\n ]\n action.workers[name] = modId!\n }\n serverActions[id] = action\n }\n\n for (let id in pluginState.edgeServerActions) {\n const action = pluginState.edgeServerActions[id]\n for (let name in action.workers) {\n const modId =\n pluginState.edgeServerActionModules[name][\n action.layer[name] === WEBPACK_LAYERS.actionBrowser\n ? 'client'\n : 'server'\n ]\n action.workers[name] = modId!\n }\n edgeServerActions[id] = action\n }\n\n const serverManifest = {\n node: serverActions,\n edge: edgeServerActions,\n encryptionKey: this.encryptionKey,\n }\n const edgeServerManifest = {\n ...serverManifest,\n encryptionKey: 'process.env.NEXT_SERVER_ACTIONS_ENCRYPTION_KEY',\n }\n\n const json = JSON.stringify(serverManifest, null, this.dev ? 2 : undefined)\n const edgeJson = JSON.stringify(\n edgeServerManifest,\n null,\n this.dev ? 2 : undefined\n )\n\n compilation.emitAsset(\n `${this.assetPrefix}${SERVER_REFERENCE_MANIFEST}.js`,\n new sources.RawSource(\n `self.__RSC_SERVER_MANIFEST=${JSON.stringify(edgeJson)}`\n ) as unknown as webpack.sources.RawSource\n )\n compilation.emitAsset(\n `${this.assetPrefix}${SERVER_REFERENCE_MANIFEST}.json`,\n new sources.RawSource(json) as unknown as webpack.sources.RawSource\n )\n }\n}\n\nfunction addClientImport(\n mod: webpack.NormalModule,\n modRequest: string,\n clientComponentImports: ClientComponentImports,\n importedIdentifiers: string[],\n isFirstVisitModule: boolean\n) {\n const clientEntryType = getModuleBuildInfo(mod).rsc?.clientEntryType\n const isCjsModule = clientEntryType === 'cjs'\n const assumedSourceType = getAssumedSourceType(\n mod,\n isCjsModule ? 'commonjs' : 'auto'\n )\n\n const clientImportsSet = clientComponentImports[modRequest]\n\n if (importedIdentifiers[0] === '*') {\n // If there's collected import path with named import identifiers,\n // or there's nothing in collected imports are empty.\n // we should include the whole module.\n if (!isFirstVisitModule && [...clientImportsSet][0] !== '*') {\n clientComponentImports[modRequest] = new Set(['*'])\n }\n } else {\n const isAutoModuleSourceType = assumedSourceType === 'auto'\n if (isAutoModuleSourceType) {\n clientComponentImports[modRequest] = new Set(['*'])\n } else {\n // If it's not analyzed as named ESM exports, e.g. if it's mixing `export *` with named exports,\n // We'll include all modules since it's not able to do tree-shaking.\n for (const name of importedIdentifiers) {\n // For cjs module default import, we include the whole module since\n const isCjsDefaultImport = isCjsModule && name === 'default'\n\n // Always include __esModule along with cjs module default export,\n // to make sure it work with client module proxy from React.\n if (isCjsDefaultImport) {\n clientComponentImports[modRequest].add('__esModule')\n }\n\n clientComponentImports[modRequest].add(name)\n }\n }\n }\n}\n\nfunction getModuleResource(mod: webpack.NormalModule): string {\n const modPath: string = mod.resourceResolveData?.path || ''\n const modQuery = mod.resourceResolveData?.query || ''\n // We have to always use the resolved request here to make sure the\n // server and client are using the same module path (required by RSC), as\n // the server compiler and client compiler have different resolve configs.\n let modResource: string = modPath + modQuery\n\n // Context modules don't have a resource path, we use the identifier instead.\n if (mod.constructor.name === 'ContextModule') {\n modResource = mod.identifier()\n }\n\n // For the barrel optimization, we need to use the match resource instead\n // because there will be 2 modules for the same file (same resource path)\n // but they're different modules and can't be deduped via `visitedModule`.\n // The first module is a virtual re-export module created by the loader.\n if (mod.matchResource?.startsWith(BARREL_OPTIMIZATION_PREFIX)) {\n modResource = mod.matchResource + ':' + modResource\n }\n\n if (mod.resource === `?${WEBPACK_RESOURCE_QUERIES.metadataRoute}`) {\n return getMetadataRouteResource(mod.rawRequest).filePath\n }\n\n return modResource\n}\n\nfunction getMetadataRouteResource(request: string): MetadataRouteLoaderOptions {\n // e.g. next-metadata-route-loader?filePath=<some-url-encoded-path>&isDynamicRouteExtension=1!?__next_metadata_route__\n const query = request.split('!')[0].split('next-metadata-route-loader?')[1]\n\n return parse(query) as MetadataRouteLoaderOptions\n}\n"],"names":["FlightClientEntryPlugin","PLUGIN_NAME","pluginState","getProxiedPluginState","serverActions","edgeServerActions","serverActionModules","edgeServerActionModules","ssrModules","edgeSsrModules","rscModules","edgeRscModules","injectedClientEntries","POSSIBLE_SHARED_CONVENTIONS","STANDALONE_BUNDLE_CONVENTION","deduplicateCSSImportsForEntry","mergedCSSimports","sortedCSSImports","Object","entries","sort","a","b","aPath","bPath","aDepth","split","length","bDepth","aName","path","parse","name","bName","indexA","indexOf","indexB","dedupedCSSImports","trackedCSSImports","Set","entryFilePath","cssImports","entryConventionName","cssImport","has","includes","add","push","constructor","options","dev","appDir","isEdgeServer","assetPrefix","encryptionKey","webpackRuntime","EDGE_RUNTIME_WEBPACK","DEFAULT_RUNTIME_WEBPACK","apply","compiler","hooks","finishMake","tapPromise","compilation","createClientEntries","afterCompile","tap","recordModule","modId","mod","modPath","matchResource","resourceResolveData","modQuery","query","modResource","startsWith","BARREL_OPTIMIZATION_PREFIX","formatBarrelOptimizedResource","resource","layer","WEBPACK_LAYERS","reactServerComponents","key","relative","context","replace","moduleInfo","moduleId","async","moduleGraph","isAsync","serverSideRendering","ssrNamedModuleId","normalizePathSep","traverseModules","_chunk","_chunkGroup","make","processAssets","stage","webpack","Compilation","PROCESS_ASSETS_STAGE_OPTIMIZE_HASH","createActionAssets","addClientEntryAndSSRModulesList","createdSSRDependenciesForEntry","addActionEntryList","actionMapsPerEntry","createdActionIds","forEachEntryModule","entryModule","internalClientComponentEntryImports","actionEntryImports","Map","clientEntriesToInject","connection","getModuleReferencesInOrder","entryRequest","dependency","request","endsWith","WEBPACK_RESOURCE_QUERIES","metadataRoute","filePath","isDynamicRouteExtension","getMetadataRouteResource","clientComponentImports","actionImports","collectComponentInfoFromServerEntryDependency","resolvedModule","forEach","dep","actions","set","isAbsoluteRequest","isAbsolute","keys","value","relativeRequest","bundlePath","appDirRelativeRequest","isMetadataEntryFile","isMetadataRouteFile","DEFAULT_METADATA_ROUTE_EXTENSIONS","assign","entryName","absolutePagePath","UNDERSCORE_NOT_FOUND_ROUTE_ENTRY","clientEntryToInject","injected","injectClientEntryAndSSRModules","clientImports","reduce","res","curr","isAppRouteRoute","APP_CLIENT_INTERNALS","size","injectActionEntry","invalidator","getInvalidator","outputPath","some","shouldInvalidate","invalidate","COMPILER_NAMES","client","Promise","all","flatMap","addClientEntryAndSSRModules","addedClientActionEntryList","actionMapsPerClientEntry","ssrEntryDependencies","collectClientActionsFromDependencies","dependencies","remainingClientImportedActions","remainingActionEntryImports","remainingActionNames","action","id","fromClient","collectedActions","visitedModule","visitedEntry","collectActions","collectActionsInDep","getModuleBuildInfo","getModuleResource","actionIds","rsc","map","exportedName","entryDependency","ssrEntryModule","getResolvedModule","depModule","visitedOfClientComponentsTraverse","CSSImports","filterClientComponents","importedIdentifiers","addClientImport","isCSSMod","sideEffectFree","factoryMeta","unused","getExportsInfo","isModuleUsed","isClientComponentEntryModule","dependencyIds","ids","Array","from","bundler","getWebpackBundler","modules","regexCSS","test","localeCompare","clientImportPath","clientBrowserLoader","stringify","sep","x","JSON","server","clientServerLoader","getEntries","pageKey","getEntryKey","PAGE_TYPES","APP","type","EntryTypes","CHILD_ENTRY","parentEntries","absoluteEntryFilePath","dispose","lastActiveTime","Date","now","entryData","clientComponentSSREntryDep","EntryPlugin","createDependency","clientComponentRSCEntryDep","addEntry","actionsArray","actionsFromModule","resolve","actionLoader","__client_imported__","currentCompilerServerActions","workers","actionBrowser","actionEntryDep","reject","addInclude","err","module","setUsedInUnknownWay","entry","get","includeDependencies","call","addModuleTree","contextInfo","issuerLayer","failedEntry","succeedEntry","chunkGroup","mapping","serverManifest","node","edge","edgeServerManifest","json","undefined","edgeJson","emitAsset","SERVER_REFERENCE_MANIFEST","sources","RawSource","modRequest","isFirstVisitModule","clientEntryType","isCjsModule","assumedSourceType","getAssumedSourceType","clientImportsSet","isAutoModuleSourceType","isCjsDefaultImport","identifier","rawRequest"],"mappings":";;;;+BAsLaA;;;eAAAA;;;yBAjLW;6BACS;6DAChB;sCAOV;2BAIA;4BASA;uBAKA;wBAMA;kCAC0B;8BACK;2BACX;oCACQ;kCACE;iCACL;iCAIzB;0EAGuB;;;;;;AAS9B,MAAMC,cAAc;AA4BpB,MAAMC,cAAcC,IAAAA,mCAAqB,EAAC;IACxC,gDAAgD;IAChDC,eAAe,CAAC;IAChBC,mBAAmB,CAAC;IAEpBC,qBAAqB,CAAC;IAItBC,yBAAyB,CAAC;IAI1BC,YAAY,CAAC;IACbC,gBAAgB,CAAC;IAEjBC,YAAY,CAAC;IACbC,gBAAgB,CAAC;IAEjBC,uBAAuB,CAAC;AAC1B;AAEA,MAAMC,8BAA8B;IAAC;IAAY;CAAS;AAC1D,MAAMC,+BAA+B;AAErC,SAASC,8BAA8BC,gBAA4B;IACjE,uEAAuE;IACvE,oEAAoE;IACpE,wEAAwE;IACxE,+DAA+D;IAC/D,sEAAsE;IACtE,uEAAuE;IACvE,wEAAwE;IACxE,UAAU;IACV,qEAAqE;IACrE,qEAAqE;IACrE,mEAAmE;IACnE,yEAAyE;IACzE,uFAAuF;IAEvF,2CAA2C;IAC3C,MAAMC,mBAAmBC,OAAOC,OAAO,CAACH,kBAAkBI,IAAI,CAAC,CAACC,GAAGC;QACjE,MAAM,CAACC,MAAM,GAAGF;QAChB,MAAM,CAACG,MAAM,GAAGF;QAEhB,MAAMG,SAASF,MAAMG,KAAK,CAAC,KAAKC,MAAM;QACtC,MAAMC,SAASJ,MAAME,KAAK,CAAC,KAAKC,MAAM;QAEtC,IAAIF,WAAWG,QAAQ;YACrB,OAAOH,SAASG;QAClB;QAEA,MAAMC,QAAQC,aAAI,CAACC,KAAK,CAACR,OAAOS,IAAI;QACpC,MAAMC,QAAQH,aAAI,CAACC,KAAK,CAACP,OAAOQ,IAAI;QAEpC,MAAME,SAASrB,4BAA4BsB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cAAsBL,UAAUG;IAEpC,6EAA6E;IAC7E,IAAIJ,IAAIrB,WAAW,CAAChB,IAAI,KAAK,iBAAiB;QAC5C2C,cAAcN,IAAIgO,UAAU;IAC9B;IAEA,yEAAyE;IACzE,yEAAyE;IACzE,0EAA0E;IAC1E,wEAAwE;IACxE,KAAIhO,qBAAAA,IAAIE,aAAa,qBAAjBF,mBAAmBO,UAAU,CAACC,sCAA0B,GAAG;QAC7DF,cAAcN,IAAIE,aAAa,GAAG,MAAMI;IAC1C;IAEA,IAAIN,IAAIU,QAAQ,KAAK,CAAC,CAAC,EAAE2C,mCAAwB,CAACC,aAAa,EAAE,EAAE;QACjE,OAAOG,yBAAyBzD,IAAIiO,UAAU,EAAE1K,QAAQ;IAC1D;IAEA,OAAOjD;AACT;AAEA,SAASmD,yBAAyBN,OAAe;IAC/C,sHAAsH;IACtH,MAAM9C,QAAQ8C,QAAQ9F,KAAK,CAAC,IAAI,CAAC,EAAE,CAACA,KAAK,CAAC,8BAA8B,CAAC,EAAE;IAE3E,OAAOK,IAAAA,kBAAK,EAAC2C;AACf","ignoreList":[0]}
1
+ {"version":3,"sources":["../../../../src/build/webpack/plugins/flight-client-entry-plugin.ts"],"sourcesContent":["import type {\n CssImports,\n ClientComponentImports,\n} from '../loaders/next-flight-client-entry-loader'\n\nimport { webpack } from 'next/dist/compiled/webpack/webpack'\nimport { parse, stringify } from 'querystring'\nimport path from 'path'\nimport { sources } from 'next/dist/compiled/webpack/webpack'\nimport {\n getInvalidator,\n getEntries,\n EntryTypes,\n getEntryKey,\n} from '../../../server/dev/on-demand-entry-handler'\nimport {\n WEBPACK_LAYERS,\n WEBPACK_RESOURCE_QUERIES,\n} from '../../../lib/constants'\nimport {\n APP_CLIENT_INTERNALS,\n BARREL_OPTIMIZATION_PREFIX,\n COMPILER_NAMES,\n DEFAULT_RUNTIME_WEBPACK,\n EDGE_RUNTIME_WEBPACK,\n SERVER_REFERENCE_MANIFEST,\n UNDERSCORE_NOT_FOUND_ROUTE_ENTRY,\n} from '../../../shared/lib/constants'\nimport {\n isClientComponentEntryModule,\n isCSSMod,\n regexCSS,\n} from '../loaders/utils'\nimport {\n traverseModules,\n forEachEntryModule,\n formatBarrelOptimizedResource,\n getModuleReferencesInOrder,\n} from '../utils'\nimport { normalizePathSep } from '../../../shared/lib/page-path/normalize-path-sep'\nimport { getProxiedPluginState } from '../../build-context'\nimport { PAGE_TYPES } from '../../../lib/page-types'\nimport { getModuleBuildInfo } from '../loaders/get-module-build-info'\nimport { getAssumedSourceType } from '../loaders/next-flight-loader'\nimport { isAppRouteRoute } from '../../../lib/is-app-route-route'\nimport {\n DEFAULT_METADATA_ROUTE_EXTENSIONS,\n isMetadataRouteFile,\n} from '../../../lib/metadata/is-metadata-route'\nimport type { MetadataRouteLoaderOptions } from '../loaders/next-metadata-route-loader'\nimport type { FlightActionEntryLoaderActions } from '../loaders/next-flight-action-entry-loader'\nimport getWebpackBundler from '../../../shared/lib/get-webpack-bundler'\n\ninterface Options {\n dev: boolean\n appDir: string\n isEdgeServer: boolean\n encryptionKey: string\n}\n\nconst PLUGIN_NAME = 'FlightClientEntryPlugin'\n\ntype Actions = {\n [actionId: string]: {\n exportedName?: string\n filename?: string\n workers: {\n [name: string]: {\n moduleId: string | number\n async: boolean\n }\n }\n // Record which layer the action is in (rsc or sc_action), in the specific entry.\n layer: {\n [name: string]: string\n }\n }\n}\n\ntype ActionIdNamePair = { id: string; exportedName?: string; filename?: string }\n\nexport type ActionManifest = {\n // Assign a unique encryption key during production build.\n encryptionKey: string\n node: Actions\n edge: Actions\n}\n\nexport interface ModuleInfo {\n moduleId: string | number\n async: boolean\n}\n\nconst pluginState = getProxiedPluginState({\n // A map to track \"action\" -> \"list of bundles\".\n serverActions: {} as ActionManifest['node'],\n edgeServerActions: {} as ActionManifest['edge'],\n\n serverActionModules: {} as {\n [workerName: string]: {\n server?: ModuleInfo\n client?: ModuleInfo\n }\n },\n\n edgeServerActionModules: {} as {\n [workerName: string]: {\n server?: ModuleInfo\n client?: ModuleInfo\n }\n },\n\n ssrModules: {} as { [ssrModuleId: string]: ModuleInfo },\n edgeSsrModules: {} as { [ssrModuleId: string]: ModuleInfo },\n\n rscModules: {} as { [rscModuleId: string]: ModuleInfo },\n edgeRscModules: {} as { [rscModuleId: string]: ModuleInfo },\n\n injectedClientEntries: {} as Record<string, string>,\n})\n\nconst POSSIBLE_SHARED_CONVENTIONS = ['template', 'layout']\nconst STANDALONE_BUNDLE_CONVENTION = 'global-not-found'\n\nfunction deduplicateCSSImportsForEntry(mergedCSSimports: CssImports) {\n // If multiple entry module connections are having the same CSS import,\n // we only need to have one module to keep track of that CSS import.\n // It is based on the fact that if a page or a layout is rendered in the\n // given entry, all its parent layouts are always rendered too.\n // This can avoid duplicate CSS imports in the generated CSS manifest,\n // for example, if a page and its parent layout are both using the same\n // CSS import, we only need to have the layout to keep track of that CSS\n // import.\n // To achieve this, we need to first collect all the CSS imports from\n // every connection, and deduplicate them in the order of layers from\n // top to bottom. The implementation can be generally described as:\n // - Sort by number of `/` in the request path (the more `/`, the deeper)\n // - When in the same depth, sort by the filename (template < layout < page and others)\n\n // Sort the connections as described above.\n const sortedCSSImports = Object.entries(mergedCSSimports).sort((a, b) => {\n const [aPath] = a\n const [bPath] = b\n\n const aDepth = aPath.split('/').length\n const bDepth = bPath.split('/').length\n\n if (aDepth !== bDepth) {\n return aDepth - bDepth\n }\n\n const aName = path.parse(aPath).name\n const bName = path.parse(bPath).name\n\n const indexA = POSSIBLE_SHARED_CONVENTIONS.indexOf(aName)\n const indexB = POSSIBLE_SHARED_CONVENTIONS.indexOf(bName)\n\n if (indexA === -1) return 1\n if (indexB === -1) return -1\n return indexA - indexB\n })\n\n const dedupedCSSImports: CssImports = {}\n const trackedCSSImports = new Set<string>()\n\n for (const [entryFilePath, cssImports] of sortedCSSImports) {\n const entryConventionName = path.parse(entryFilePath).name\n\n for (const cssImport of cssImports) {\n // If the CSS import is already tracked, we can skip it.\n // Or if it's any standalone entry such as `global-not-found`, it won't share any resources with other entry, skip it.\n if (\n trackedCSSImports.has(cssImport) &&\n STANDALONE_BUNDLE_CONVENTION !== entryConventionName\n ) {\n continue\n }\n\n // Only track CSS imports that are in files that can inherit CSS.\n if (POSSIBLE_SHARED_CONVENTIONS.includes(entryConventionName)) {\n trackedCSSImports.add(cssImport)\n }\n\n if (!dedupedCSSImports[entryFilePath]) {\n dedupedCSSImports[entryFilePath] = []\n }\n dedupedCSSImports[entryFilePath].push(cssImport)\n }\n }\n\n return dedupedCSSImports\n}\n\nexport class FlightClientEntryPlugin {\n dev: boolean\n appDir: string\n projectDir: string\n encryptionKey: string\n isEdgeServer: boolean\n assetPrefix: string\n webpackRuntime: string\n\n constructor(options: Options) {\n this.dev = options.dev\n this.appDir = options.appDir\n this.projectDir = path.join(options.appDir, '..')\n this.isEdgeServer = options.isEdgeServer\n this.assetPrefix = !this.dev && !this.isEdgeServer ? '../' : ''\n this.encryptionKey = options.encryptionKey\n this.webpackRuntime = this.isEdgeServer\n ? EDGE_RUNTIME_WEBPACK\n : DEFAULT_RUNTIME_WEBPACK\n }\n\n apply(compiler: webpack.Compiler) {\n compiler.hooks.finishMake.tapPromise(PLUGIN_NAME, (compilation) =>\n this.createClientEntries(compiler, compilation)\n )\n\n compiler.hooks.afterCompile.tap(PLUGIN_NAME, (compilation) => {\n const recordModule = (modId: string, mod: any) => {\n // Match Resource is undefined unless an import is using the inline match resource syntax\n // https://webpack.js.org/api/loaders/#inline-matchresource\n const modPath = mod.matchResource || mod.resourceResolveData?.path\n const modQuery = mod.resourceResolveData?.query || ''\n // query is already part of mod.resource\n // so it's only necessary to add it for matchResource or mod.resourceResolveData\n const modResource = modPath\n ? modPath.startsWith(BARREL_OPTIMIZATION_PREFIX)\n ? formatBarrelOptimizedResource(mod.resource, modPath)\n : modPath + modQuery\n : mod.resource\n\n if (typeof modId !== 'undefined' && modResource) {\n if (mod.layer === WEBPACK_LAYERS.reactServerComponents) {\n const key = path\n .relative(compiler.context, modResource)\n .replace(/\\/next\\/dist\\/esm\\//, '/next/dist/')\n\n const moduleInfo: ModuleInfo = {\n moduleId: modId,\n async: compilation.moduleGraph.isAsync(mod),\n }\n\n if (this.isEdgeServer) {\n pluginState.edgeRscModules[key] = moduleInfo\n } else {\n pluginState.rscModules[key] = moduleInfo\n }\n }\n }\n\n if (mod.layer !== WEBPACK_LAYERS.serverSideRendering) {\n return\n }\n\n // Check mod resource to exclude the empty resource module like virtual module created by next-flight-client-entry-loader\n if (typeof modId !== 'undefined' && modResource) {\n // Note that this isn't that reliable as webpack is still possible to assign\n // additional queries to make sure there's no conflict even using the `named`\n // module ID strategy.\n let ssrNamedModuleId = path.relative(compiler.context, modResource)\n\n if (!ssrNamedModuleId.startsWith('.')) {\n // TODO use getModuleId instead\n ssrNamedModuleId = `./${normalizePathSep(ssrNamedModuleId)}`\n }\n\n const moduleInfo: ModuleInfo = {\n moduleId: modId,\n async: compilation.moduleGraph.isAsync(mod),\n }\n\n if (this.isEdgeServer) {\n pluginState.edgeSsrModules[\n ssrNamedModuleId.replace(/\\/next\\/dist\\/esm\\//, '/next/dist/')\n ] = moduleInfo\n } else {\n pluginState.ssrModules[ssrNamedModuleId] = moduleInfo\n }\n }\n }\n\n traverseModules(compilation, (mod, _chunk, _chunkGroup, modId) => {\n if (modId) recordModule(modId, mod)\n })\n })\n\n compiler.hooks.make.tap(PLUGIN_NAME, (compilation) => {\n compilation.hooks.processAssets.tapPromise(\n {\n name: PLUGIN_NAME,\n stage: webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_HASH,\n },\n () => this.createActionAssets(compilation)\n )\n })\n }\n\n async createClientEntries(\n compiler: webpack.Compiler,\n compilation: webpack.Compilation\n ) {\n const addClientEntryAndSSRModulesList: Array<\n ReturnType<typeof this.injectClientEntryAndSSRModules>\n > = []\n const createdSSRDependenciesForEntry: Record<\n string,\n ReturnType<typeof this.injectClientEntryAndSSRModules>[3][]\n > = {}\n\n const addActionEntryList: Array<ReturnType<typeof this.injectActionEntry>> =\n []\n const actionMapsPerEntry: Record<\n string,\n Map<string, ActionIdNamePair[]>\n > = {}\n const createdActionIds = new Set<string>()\n\n // For each SC server compilation entry, we need to create its corresponding\n // client component entry.\n forEachEntryModule(compilation, ({ name, entryModule }) => {\n const internalClientComponentEntryImports: ClientComponentImports = {}\n const actionEntryImports = new Map<string, ActionIdNamePair[]>()\n const clientEntriesToInject = []\n const mergedCSSimports: CssImports = {}\n\n for (const connection of getModuleReferencesInOrder(\n entryModule,\n compilation.moduleGraph\n )) {\n // Entry can be any user defined entry files such as layout, page, error, loading, etc.\n let entryRequest = (\n connection.dependency as unknown as webpack.NormalModule\n ).request\n\n if (entryRequest.endsWith(WEBPACK_RESOURCE_QUERIES.metadataRoute)) {\n const { filePath, isDynamicRouteExtension } =\n getMetadataRouteResource(entryRequest)\n\n if (isDynamicRouteExtension === '1') {\n entryRequest = filePath\n }\n }\n\n const { clientComponentImports, actionImports, cssImports } =\n this.collectComponentInfoFromServerEntryDependency({\n entryRequest,\n compilation,\n resolvedModule: connection.resolvedModule,\n })\n\n actionImports.forEach(([dep, actions]) =>\n actionEntryImports.set(dep, actions)\n )\n\n const isAbsoluteRequest = path.isAbsolute(entryRequest)\n\n // Next.js internals are put into a separate entry.\n if (!isAbsoluteRequest) {\n Object.keys(clientComponentImports).forEach(\n (value) => (internalClientComponentEntryImports[value] = new Set())\n )\n continue\n }\n\n // TODO-APP: Enable these lines. This ensures no entrypoint is created for layout/page when there are no client components.\n // Currently disabled because it causes test failures in CI.\n // if (clientImports.length === 0 && actionImports.length === 0) {\n // continue\n // }\n\n const relativeRequest = isAbsoluteRequest\n ? path.relative(compilation.options.context!, entryRequest)\n : entryRequest\n\n // Replace file suffix as `.js` will be added.\n // bundlePath will have app/ prefix but not src/.\n // e.g. src/app/foo/page.js -> app/foo/page\n let bundlePath = normalizePathSep(\n relativeRequest.replace(/\\.[^.\\\\/]+$/, '').replace(/^src[\\\\/]/, '')\n )\n\n // For metadata routes, the entry name can be used as the bundle path,\n // as it has been normalized already.\n // e.g.\n // When `relativeRequest` is 'src/app/sitemap.js',\n // `appDirRelativeRequest` will be '/sitemap.js'\n // then `isMetadataEntryFile` will be `true`\n const appDirRelativeRequest = relativeRequest\n .replace(/^src[\\\\/]/, '')\n .replace(/^app[\\\\/]/, '/')\n const isMetadataEntryFile = isMetadataRouteFile(\n appDirRelativeRequest,\n DEFAULT_METADATA_ROUTE_EXTENSIONS,\n true\n )\n if (isMetadataEntryFile) {\n bundlePath = name\n }\n\n Object.assign(mergedCSSimports, cssImports)\n clientEntriesToInject.push({\n compiler,\n compilation,\n entryName: name,\n clientComponentImports,\n bundlePath,\n absolutePagePath: entryRequest,\n })\n\n // The webpack implementation of writing the client reference manifest relies on all entrypoints writing a page.js even when there is no client components in the page.\n // It needs the file in order to write the reference manifest for the path in the `.next/server` folder.\n // TODO-APP: This could be better handled, however Turbopack does not have the same problem as we resolve client components in a single graph.\n if (\n name === `app${UNDERSCORE_NOT_FOUND_ROUTE_ENTRY}` &&\n bundlePath === 'app/not-found'\n ) {\n clientEntriesToInject.push({\n compiler,\n compilation,\n entryName: name,\n clientComponentImports: {},\n bundlePath: `app${UNDERSCORE_NOT_FOUND_ROUTE_ENTRY}`,\n absolutePagePath: entryRequest,\n })\n }\n\n if (\n name === `app${UNDERSCORE_NOT_FOUND_ROUTE_ENTRY}` &&\n bundlePath === 'app/global-not-found'\n ) {\n clientEntriesToInject.push({\n compiler,\n compilation,\n entryName: name,\n clientComponentImports,\n bundlePath: `app${UNDERSCORE_NOT_FOUND_ROUTE_ENTRY}`,\n absolutePagePath: entryRequest,\n })\n }\n }\n\n // Make sure CSS imports are deduplicated before injecting the client entry\n // and SSR modules.\n const dedupedCSSImports = deduplicateCSSImportsForEntry(mergedCSSimports)\n for (const clientEntryToInject of clientEntriesToInject) {\n const injected = this.injectClientEntryAndSSRModules({\n ...clientEntryToInject,\n clientImports: {\n ...clientEntryToInject.clientComponentImports,\n ...(\n dedupedCSSImports[clientEntryToInject.absolutePagePath] || []\n ).reduce<ClientComponentImports>((res, curr) => {\n res[curr] = new Set()\n return res\n }, {}),\n },\n })\n\n // Track all created SSR dependencies for each entry from the server layer.\n if (!createdSSRDependenciesForEntry[clientEntryToInject.entryName]) {\n createdSSRDependenciesForEntry[clientEntryToInject.entryName] = []\n }\n createdSSRDependenciesForEntry[clientEntryToInject.entryName].push(\n injected[3]\n )\n\n addClientEntryAndSSRModulesList.push(injected)\n }\n\n if (!isAppRouteRoute(name)) {\n // Create internal app\n addClientEntryAndSSRModulesList.push(\n this.injectClientEntryAndSSRModules({\n compiler,\n compilation,\n entryName: name,\n clientImports: { ...internalClientComponentEntryImports },\n bundlePath: APP_CLIENT_INTERNALS,\n })\n )\n }\n\n if (actionEntryImports.size > 0) {\n if (!actionMapsPerEntry[name]) {\n actionMapsPerEntry[name] = new Map()\n }\n actionMapsPerEntry[name] = new Map([\n ...actionMapsPerEntry[name],\n ...actionEntryImports,\n ])\n }\n })\n\n for (const [name, actionEntryImports] of Object.entries(\n actionMapsPerEntry\n )) {\n addActionEntryList.push(\n this.injectActionEntry({\n compiler,\n compilation,\n actions: actionEntryImports,\n entryName: name,\n bundlePath: name,\n createdActionIds,\n })\n )\n }\n\n // Invalidate in development to trigger recompilation\n const invalidator = getInvalidator(compiler.outputPath)\n // Check if any of the entry injections need an invalidation\n if (\n invalidator &&\n addClientEntryAndSSRModulesList.some(\n ([shouldInvalidate]) => shouldInvalidate === true\n )\n ) {\n invalidator.invalidate([COMPILER_NAMES.client])\n }\n\n // Client compiler is invalidated before awaiting the compilation of the SSR\n // and RSC client component entries so that the client compiler is running\n // in parallel to the server compiler.\n await Promise.all(\n addClientEntryAndSSRModulesList.flatMap((addClientEntryAndSSRModules) => [\n addClientEntryAndSSRModules[1],\n addClientEntryAndSSRModules[2],\n ])\n )\n\n // Wait for action entries to be added.\n await Promise.all(addActionEntryList)\n\n const addedClientActionEntryList: Promise<any>[] = []\n const actionMapsPerClientEntry: Record<\n string,\n Map<string, ActionIdNamePair[]>\n > = {}\n\n // We need to create extra action entries that are created from the\n // client layer.\n // Start from each entry's created SSR dependency from our previous step.\n for (const [name, ssrEntryDependencies] of Object.entries(\n createdSSRDependenciesForEntry\n )) {\n // Collect from all entries, e.g. layout.js, page.js, loading.js, ...\n // add aggregate them.\n const actionEntryImports = this.collectClientActionsFromDependencies({\n compilation,\n dependencies: ssrEntryDependencies,\n })\n\n if (actionEntryImports.size > 0) {\n if (!actionMapsPerClientEntry[name]) {\n actionMapsPerClientEntry[name] = new Map()\n }\n actionMapsPerClientEntry[name] = new Map([\n ...actionMapsPerClientEntry[name],\n ...actionEntryImports,\n ])\n }\n }\n\n for (const [entryName, actionEntryImports] of Object.entries(\n actionMapsPerClientEntry\n )) {\n // If an action method is already created in the server layer, we don't\n // need to create it again in the action layer.\n // This is to avoid duplicate action instances and make sure the module\n // state is shared.\n let remainingClientImportedActions = false\n const remainingActionEntryImports = new Map<string, ActionIdNamePair[]>()\n for (const [dep, actions] of actionEntryImports) {\n const remainingActionNames = []\n for (const action of actions) {\n if (!createdActionIds.has(entryName + '@' + action.id)) {\n remainingActionNames.push(action)\n }\n }\n if (remainingActionNames.length > 0) {\n remainingActionEntryImports.set(dep, remainingActionNames)\n remainingClientImportedActions = true\n }\n }\n\n if (remainingClientImportedActions) {\n addedClientActionEntryList.push(\n this.injectActionEntry({\n compiler,\n compilation,\n actions: remainingActionEntryImports,\n entryName,\n bundlePath: entryName,\n fromClient: true,\n createdActionIds,\n })\n )\n }\n }\n\n await Promise.all(addedClientActionEntryList)\n }\n\n collectClientActionsFromDependencies({\n compilation,\n dependencies,\n }: {\n compilation: webpack.Compilation\n dependencies: ReturnType<typeof webpack.EntryPlugin.createDependency>[]\n }) {\n // action file path -> action names\n const collectedActions = new Map<string, ActionIdNamePair[]>()\n\n // Keep track of checked modules to avoid infinite loops with recursive imports.\n const visitedModule = new Set<string>()\n const visitedEntry = new Set<string>()\n\n const collectActions = ({\n entryRequest,\n resolvedModule,\n }: {\n entryRequest: string\n resolvedModule: any\n }) => {\n const collectActionsInDep = (mod: webpack.NormalModule): void => {\n if (!mod) return\n\n const modResource = getModuleResource(mod)\n\n if (!modResource) return\n\n if (visitedModule.has(modResource)) return\n visitedModule.add(modResource)\n\n const actionIds = getModuleBuildInfo(mod).rsc?.actionIds\n if (actionIds) {\n collectedActions.set(\n modResource,\n Object.entries(actionIds).map(([id, exportedName]) => ({\n id,\n exportedName,\n filename: path.posix.relative(this.projectDir, modResource),\n }))\n )\n }\n\n // Collect used exported actions transversely.\n getModuleReferencesInOrder(mod, compilation.moduleGraph).forEach(\n (connection: any) => {\n collectActionsInDep(\n connection.resolvedModule as webpack.NormalModule\n )\n }\n )\n }\n\n // Don't traverse the module graph anymore once hitting the action layer.\n if (\n entryRequest &&\n !entryRequest.includes('next-flight-action-entry-loader')\n ) {\n // Traverse the module graph to find all client components.\n collectActionsInDep(resolvedModule)\n }\n }\n\n for (const entryDependency of dependencies) {\n const ssrEntryModule =\n compilation.moduleGraph.getResolvedModule(entryDependency)!\n for (const connection of getModuleReferencesInOrder(\n ssrEntryModule,\n compilation.moduleGraph\n )) {\n const depModule = connection.dependency\n const request = (depModule as unknown as webpack.NormalModule).request\n\n // It is possible that the same entry is added multiple times in the\n // connection graph. We can just skip these to speed up the process.\n if (visitedEntry.has(request)) continue\n visitedEntry.add(request)\n\n collectActions({\n entryRequest: request,\n resolvedModule: connection.resolvedModule,\n })\n }\n }\n\n return collectedActions\n }\n\n collectComponentInfoFromServerEntryDependency({\n entryRequest,\n compilation,\n resolvedModule,\n }: {\n entryRequest: string\n compilation: webpack.Compilation\n resolvedModule: any /* Dependency */\n }): {\n cssImports: CssImports\n clientComponentImports: ClientComponentImports\n actionImports: [string, ActionIdNamePair[]][]\n } {\n // Keep track of checked modules to avoid infinite loops with recursive imports.\n const visitedOfClientComponentsTraverse = new Set()\n\n // Info to collect.\n const clientComponentImports: ClientComponentImports = {}\n const actionImports: [string, ActionIdNamePair[]][] = []\n const CSSImports = new Set<string>()\n\n const filterClientComponents = (\n mod: webpack.NormalModule,\n importedIdentifiers: string[]\n ): void => {\n if (!mod) return\n\n const modResource = getModuleResource(mod)\n\n if (!modResource) return\n if (visitedOfClientComponentsTraverse.has(modResource)) {\n if (clientComponentImports[modResource]) {\n addClientImport(\n mod,\n modResource,\n clientComponentImports,\n importedIdentifiers,\n false\n )\n }\n return\n }\n visitedOfClientComponentsTraverse.add(modResource)\n\n const actionIds = getModuleBuildInfo(mod).rsc?.actionIds\n if (actionIds) {\n actionImports.push([\n modResource,\n Object.entries(actionIds).map(([id, exportedName]) => ({\n id,\n exportedName,\n filename: path.posix.relative(this.projectDir, modResource),\n })),\n ])\n }\n\n if (isCSSMod(mod)) {\n const sideEffectFree =\n mod.factoryMeta && (mod.factoryMeta as any).sideEffectFree\n\n if (sideEffectFree) {\n const unused = !compilation.moduleGraph\n .getExportsInfo(mod)\n .isModuleUsed(this.webpackRuntime)\n\n if (unused) return\n }\n\n CSSImports.add(modResource)\n } else if (isClientComponentEntryModule(mod)) {\n if (!clientComponentImports[modResource]) {\n clientComponentImports[modResource] = new Set()\n }\n addClientImport(\n mod,\n modResource,\n clientComponentImports,\n importedIdentifiers,\n true\n )\n\n return\n }\n\n getModuleReferencesInOrder(mod, compilation.moduleGraph).forEach(\n (connection: any) => {\n let dependencyIds: string[] = []\n\n // `ids` are the identifiers that are imported from the dependency,\n // if it's present, it's an array of strings.\n if (connection.dependency?.ids) {\n dependencyIds.push(...connection.dependency.ids)\n } else {\n dependencyIds = ['*']\n }\n\n filterClientComponents(connection.resolvedModule, dependencyIds)\n }\n )\n }\n\n // Traverse the module graph to find all client components.\n filterClientComponents(resolvedModule, [])\n\n return {\n clientComponentImports,\n cssImports: CSSImports.size\n ? {\n [entryRequest]: Array.from(CSSImports),\n }\n : {},\n actionImports,\n }\n }\n\n injectClientEntryAndSSRModules({\n compiler,\n compilation,\n entryName,\n clientImports,\n bundlePath,\n absolutePagePath,\n }: {\n compiler: webpack.Compiler\n compilation: webpack.Compilation\n entryName: string\n clientImports: ClientComponentImports\n bundlePath: string\n absolutePagePath?: string\n }): [\n shouldInvalidate: boolean,\n addSSREntryPromise: Promise<void>,\n addRSCEntryPromise: Promise<void>,\n ssrDep: ReturnType<typeof webpack.EntryPlugin.createDependency>,\n ] {\n const bundler = getWebpackBundler()\n let shouldInvalidate = false\n\n const modules = Object.keys(clientImports)\n .sort((a, b) => (regexCSS.test(b) ? 1 : a.localeCompare(b)))\n .map((clientImportPath) => ({\n request: clientImportPath,\n ids: [...clientImports[clientImportPath]],\n }))\n\n // For the client entry, we always use the CJS build of Next.js. If the\n // server is using the ESM build (when using the Edge runtime), we need to\n // replace them.\n const clientBrowserLoader = `next-flight-client-entry-loader?${stringify({\n modules: (this.isEdgeServer\n ? modules.map(({ request, ids }) => ({\n request: request.replace(\n /[\\\\/]next[\\\\/]dist[\\\\/]esm[\\\\/]/,\n '/next/dist/'.replace(/\\//g, path.sep)\n ),\n ids,\n }))\n : modules\n ).map((x) => JSON.stringify(x)),\n server: false,\n })}!`\n\n const clientServerLoader = `next-flight-client-entry-loader?${stringify({\n modules: modules.map((x) => JSON.stringify(x)),\n server: true,\n })}!`\n\n // Add for the client compilation\n // Inject the entry to the client compiler.\n if (this.dev) {\n const entries = getEntries(compiler.outputPath)\n const pageKey = getEntryKey(\n COMPILER_NAMES.client,\n PAGE_TYPES.APP,\n bundlePath\n )\n\n if (!entries[pageKey]) {\n entries[pageKey] = {\n type: EntryTypes.CHILD_ENTRY,\n parentEntries: new Set([entryName]),\n absoluteEntryFilePath: absolutePagePath,\n bundlePath,\n request: clientBrowserLoader,\n dispose: false,\n lastActiveTime: Date.now(),\n }\n shouldInvalidate = true\n } else {\n const entryData = entries[pageKey]\n // New version of the client loader\n if (entryData.request !== clientBrowserLoader) {\n entryData.request = clientBrowserLoader\n shouldInvalidate = true\n }\n if (entryData.type === EntryTypes.CHILD_ENTRY) {\n entryData.parentEntries.add(entryName)\n }\n entryData.dispose = false\n entryData.lastActiveTime = Date.now()\n }\n } else {\n pluginState.injectedClientEntries[bundlePath] = clientBrowserLoader\n }\n\n const clientComponentSSREntryDep = bundler.EntryPlugin.createDependency(\n clientServerLoader,\n { name: bundlePath }\n )\n\n const clientComponentRSCEntryDep = bundler.EntryPlugin.createDependency(\n clientServerLoader,\n { name: bundlePath }\n )\n\n return [\n shouldInvalidate,\n // Add the entries to the server compiler for the SSR and RSC layers. The\n // promises are awaited later using `Promise.all` in order to parallelize\n // adding the entries.\n this.addEntry(compilation, compiler.context, clientComponentSSREntryDep, {\n name: entryName,\n layer: WEBPACK_LAYERS.serverSideRendering,\n }),\n this.addEntry(compilation, compiler.context, clientComponentRSCEntryDep, {\n name: entryName,\n layer: WEBPACK_LAYERS.reactServerComponents,\n }),\n clientComponentSSREntryDep,\n ]\n }\n\n injectActionEntry({\n compiler,\n compilation,\n actions,\n entryName,\n bundlePath,\n fromClient,\n createdActionIds,\n }: {\n compiler: webpack.Compiler\n compilation: webpack.Compilation\n actions: Map<string, ActionIdNamePair[]>\n entryName: string\n bundlePath: string\n createdActionIds: Set<string>\n fromClient?: boolean\n }) {\n const bundler = getWebpackBundler()\n const actionsArray = Array.from(actions.entries())\n for (const [, actionsFromModule] of actions) {\n for (const { id } of actionsFromModule) {\n createdActionIds.add(entryName + '@' + id)\n }\n }\n\n if (actionsArray.length === 0) {\n return Promise.resolve()\n }\n\n const actionLoader = `next-flight-action-entry-loader?${stringify({\n actions: JSON.stringify(\n actionsArray satisfies FlightActionEntryLoaderActions\n ),\n __client_imported__: fromClient,\n })}!`\n\n const currentCompilerServerActions = this.isEdgeServer\n ? pluginState.edgeServerActions\n : pluginState.serverActions\n\n for (const [, actionsFromModule] of actionsArray) {\n for (const { id, exportedName, filename } of actionsFromModule) {\n if (typeof currentCompilerServerActions[id] === 'undefined') {\n currentCompilerServerActions[id] = {\n workers: {},\n layer: {},\n filename,\n exportedName,\n }\n }\n currentCompilerServerActions[id].workers[bundlePath] = {\n moduleId: '', // TODO: What's the meaning of this?\n async: false,\n }\n\n currentCompilerServerActions[id].layer[bundlePath] = fromClient\n ? WEBPACK_LAYERS.actionBrowser\n : WEBPACK_LAYERS.reactServerComponents\n }\n }\n\n // Inject the entry to the server compiler\n const actionEntryDep = bundler.EntryPlugin.createDependency(actionLoader, {\n name: bundlePath,\n })\n\n return this.addEntry(\n compilation,\n // Reuse compilation context.\n compiler.context,\n actionEntryDep,\n {\n name: entryName,\n layer: fromClient\n ? WEBPACK_LAYERS.actionBrowser\n : WEBPACK_LAYERS.reactServerComponents,\n }\n )\n }\n\n addEntry(\n compilation: webpack.Compilation,\n context: string,\n dependency: webpack.Dependency,\n options: webpack.EntryOptions\n ): Promise<any> /* Promise<module> */ {\n return new Promise((resolve, reject) => {\n if ('rspack' in compilation.compiler) {\n compilation.addInclude(context, dependency, options, (err, module) => {\n if (err) {\n return reject(err)\n }\n\n compilation.moduleGraph\n .getExportsInfo(module!)\n .setUsedInUnknownWay(\n this.isEdgeServer ? EDGE_RUNTIME_WEBPACK : DEFAULT_RUNTIME_WEBPACK\n )\n return resolve(module)\n })\n } else {\n const entry = compilation.entries.get(options.name!)!\n entry.includeDependencies.push(dependency)\n compilation.hooks.addEntry.call(entry as any, options)\n compilation.addModuleTree(\n {\n context,\n dependency,\n contextInfo: { issuerLayer: options.layer },\n },\n (err: any, module: any) => {\n if (err) {\n compilation.hooks.failedEntry.call(dependency, options, err)\n return reject(err)\n }\n\n compilation.hooks.succeedEntry.call(dependency, options, module)\n\n compilation.moduleGraph\n .getExportsInfo(module)\n .setUsedInUnknownWay(\n this.isEdgeServer\n ? EDGE_RUNTIME_WEBPACK\n : DEFAULT_RUNTIME_WEBPACK\n )\n\n return resolve(module)\n }\n )\n }\n })\n }\n\n async createActionAssets(compilation: webpack.Compilation) {\n const serverActions: ActionManifest['node'] = {}\n const edgeServerActions: ActionManifest['edge'] = {}\n\n traverseModules(compilation, (mod, _chunk, chunkGroup, modId) => {\n // Go through all action entries and record the module ID for each entry.\n if (\n chunkGroup.name &&\n mod.request &&\n modId &&\n /next-flight-action-entry-loader/.test(mod.request)\n ) {\n const fromClient = /&__client_imported__=true/.test(mod.request)\n\n const mapping = this.isEdgeServer\n ? pluginState.edgeServerActionModules\n : pluginState.serverActionModules\n\n if (!mapping[chunkGroup.name]) {\n mapping[chunkGroup.name] = {}\n }\n\n mapping[chunkGroup.name][fromClient ? 'client' : 'server'] = {\n moduleId: modId,\n async: compilation.moduleGraph.isAsync(mod),\n }\n }\n })\n\n for (let id in pluginState.serverActions) {\n const action = pluginState.serverActions[id]\n for (let name in action.workers) {\n const modId =\n pluginState.serverActionModules[name][\n action.layer[name] === WEBPACK_LAYERS.actionBrowser\n ? 'client'\n : 'server'\n ]\n action.workers[name] = modId!\n }\n serverActions[id] = action\n }\n\n for (let id in pluginState.edgeServerActions) {\n const action = pluginState.edgeServerActions[id]\n for (let name in action.workers) {\n const modId =\n pluginState.edgeServerActionModules[name][\n action.layer[name] === WEBPACK_LAYERS.actionBrowser\n ? 'client'\n : 'server'\n ]\n action.workers[name] = modId!\n }\n edgeServerActions[id] = action\n }\n\n const serverManifest = {\n node: serverActions,\n edge: edgeServerActions,\n encryptionKey: this.encryptionKey,\n }\n const edgeServerManifest = {\n ...serverManifest,\n encryptionKey: 'process.env.NEXT_SERVER_ACTIONS_ENCRYPTION_KEY',\n }\n\n const json = JSON.stringify(serverManifest, null, this.dev ? 2 : undefined)\n const edgeJson = JSON.stringify(\n edgeServerManifest,\n null,\n this.dev ? 2 : undefined\n )\n\n compilation.emitAsset(\n `${this.assetPrefix}${SERVER_REFERENCE_MANIFEST}.js`,\n new sources.RawSource(\n `self.__RSC_SERVER_MANIFEST=${JSON.stringify(edgeJson)}`\n ) as unknown as webpack.sources.RawSource\n )\n compilation.emitAsset(\n `${this.assetPrefix}${SERVER_REFERENCE_MANIFEST}.json`,\n new sources.RawSource(json) as unknown as webpack.sources.RawSource\n )\n }\n}\n\nfunction addClientImport(\n mod: webpack.NormalModule,\n modRequest: string,\n clientComponentImports: ClientComponentImports,\n importedIdentifiers: string[],\n isFirstVisitModule: boolean\n) {\n const clientEntryType = getModuleBuildInfo(mod).rsc?.clientEntryType\n const isCjsModule = clientEntryType === 'cjs'\n const assumedSourceType = getAssumedSourceType(\n mod,\n isCjsModule ? 'commonjs' : 'auto'\n )\n\n const clientImportsSet = clientComponentImports[modRequest]\n\n if (importedIdentifiers[0] === '*') {\n // If there's collected import path with named import identifiers,\n // or there's nothing in collected imports are empty.\n // we should include the whole module.\n if (!isFirstVisitModule && [...clientImportsSet][0] !== '*') {\n clientComponentImports[modRequest] = new Set(['*'])\n }\n } else {\n const isAutoModuleSourceType = assumedSourceType === 'auto'\n if (isAutoModuleSourceType) {\n clientComponentImports[modRequest] = new Set(['*'])\n } else {\n // If it's not analyzed as named ESM exports, e.g. if it's mixing `export *` with named exports,\n // We'll include all modules since it's not able to do tree-shaking.\n for (const name of importedIdentifiers) {\n // For cjs module default import, we include the whole module since\n const isCjsDefaultImport = isCjsModule && name === 'default'\n\n // Always include __esModule along with cjs module default export,\n // to make sure it work with client module proxy from React.\n if (isCjsDefaultImport) {\n clientComponentImports[modRequest].add('__esModule')\n }\n\n clientComponentImports[modRequest].add(name)\n }\n }\n }\n}\n\nfunction getModuleResource(mod: webpack.NormalModule): string {\n const modPath: string = mod.resourceResolveData?.path || ''\n const modQuery = mod.resourceResolveData?.query || ''\n // We have to always use the resolved request here to make sure the\n // server and client are using the same module path (required by RSC), as\n // the server compiler and client compiler have different resolve configs.\n let modResource: string = modPath + modQuery\n\n // Context modules don't have a resource path, we use the identifier instead.\n if (mod.constructor.name === 'ContextModule') {\n modResource = mod.identifier()\n }\n\n // For the barrel optimization, we need to use the match resource instead\n // because there will be 2 modules for the same file (same resource path)\n // but they're different modules and can't be deduped via `visitedModule`.\n // The first module is a virtual re-export module created by the loader.\n if (mod.matchResource?.startsWith(BARREL_OPTIMIZATION_PREFIX)) {\n modResource = mod.matchResource + ':' + modResource\n }\n\n if (mod.resource === `?${WEBPACK_RESOURCE_QUERIES.metadataRoute}`) {\n return getMetadataRouteResource(mod.rawRequest).filePath\n }\n\n return modResource\n}\n\nfunction getMetadataRouteResource(request: string): MetadataRouteLoaderOptions {\n // e.g. next-metadata-route-loader?filePath=<some-url-encoded-path>&isDynamicRouteExtension=1!?__next_metadata_route__\n const query = request.split('!')[0].split('next-metadata-route-loader?')[1]\n\n return parse(query) as MetadataRouteLoaderOptions\n}\n"],"names":["FlightClientEntryPlugin","PLUGIN_NAME","pluginState","getProxiedPluginState","serverActions","edgeServerActions","serverActionModules","edgeServerActionModules","ssrModules","edgeSsrModules","rscModules","edgeRscModules","injectedClientEntries","POSSIBLE_SHARED_CONVENTIONS","STANDALONE_BUNDLE_CONVENTION","deduplicateCSSImportsForEntry","mergedCSSimports","sortedCSSImports","Object","entries","sort","a","b","aPath","bPath","aDepth","split","length","bDepth","aName","path","parse","name","bName","indexA","indexOf","indexB","dedupedCSSImports","trackedCSSImports","Set","entryFilePath","cssImports","entryConventionName","cssImport","has","includes","add","push","constructor","options","dev","appDir","projectDir","join","isEdgeServer","assetPrefix","encryptionKey","webpackRuntime","EDGE_RUNTIME_WEBPACK","DEFAULT_RUNTIME_WEBPACK","apply","compiler","hooks","finishMake","tapPromise","compilation","createClientEntries","afterCompile","tap","recordModule","modId","mod","modPath","matchResource","resourceResolveData","modQuery","query","modResource","startsWith","BARREL_OPTIMIZATION_PREFIX","formatBarrelOptimizedResource","resource","layer","WEBPACK_LAYERS","reactServerComponents","key","relative","context","replace","moduleInfo","moduleId","async","moduleGraph","isAsync","serverSideRendering","ssrNamedModuleId","normalizePathSep","traverseModules","_chunk","_chunkGroup","make","processAssets","stage","webpack","Compilation","PROCESS_ASSETS_STAGE_OPTIMIZE_HASH","createActionAssets","addClientEntryAndSSRModulesList","createdSSRDependenciesForEntry","addActionEntryList","actionMapsPerEntry","createdActionIds","forEachEntryModule","entryModule","internalClientComponentEntryImports","actionEntryImports","Map","clientEntriesToInject","connection","getModuleReferencesInOrder","entryRequest","dependency","request","endsWith","WEBPACK_RESOURCE_QUERIES","metadataRoute","filePath","isDynamicRouteExtension","getMetadataRouteResource","clientComponentImports","actionImports","collectComponentInfoFromServerEntryDependency","resolvedModule","forEach","dep","actions","set","isAbsoluteRequest","isAbsolute","keys","value","relativeRequest","bundlePath","appDirRelativeRequest","isMetadataEntryFile","isMetadataRouteFile","DEFAULT_METADATA_ROUTE_EXTENSIONS","assign","entryName","absolutePagePath","UNDERSCORE_NOT_FOUND_ROUTE_ENTRY","clientEntryToInject","injected","injectClientEntryAndSSRModules","clientImports","reduce","res","curr","isAppRouteRoute","APP_CLIENT_INTERNALS","size","injectActionEntry","invalidator","getInvalidator","outputPath","some","shouldInvalidate","invalidate","COMPILER_NAMES","client","Promise","all","flatMap","addClientEntryAndSSRModules","addedClientActionEntryList","actionMapsPerClientEntry","ssrEntryDependencies","collectClientActionsFromDependencies","dependencies","remainingClientImportedActions","remainingActionEntryImports","remainingActionNames","action","id","fromClient","collectedActions","visitedModule","visitedEntry","collectActions","collectActionsInDep","getModuleBuildInfo","getModuleResource","actionIds","rsc","map","exportedName","filename","posix","entryDependency","ssrEntryModule","getResolvedModule","depModule","visitedOfClientComponentsTraverse","CSSImports","filterClientComponents","importedIdentifiers","addClientImport","isCSSMod","sideEffectFree","factoryMeta","unused","getExportsInfo","isModuleUsed","isClientComponentEntryModule","dependencyIds","ids","Array","from","bundler","getWebpackBundler","modules","regexCSS","test","localeCompare","clientImportPath","clientBrowserLoader","stringify","sep","x","JSON","server","clientServerLoader","getEntries","pageKey","getEntryKey","PAGE_TYPES","APP","type","EntryTypes","CHILD_ENTRY","parentEntries","absoluteEntryFilePath","dispose","lastActiveTime","Date","now","entryData","clientComponentSSREntryDep","EntryPlugin","createDependency","clientComponentRSCEntryDep","addEntry","actionsArray","actionsFromModule","resolve","actionLoader","__client_imported__","currentCompilerServerActions","workers","actionBrowser","actionEntryDep","reject","addInclude","err","module","setUsedInUnknownWay","entry","get","includeDependencies","call","addModuleTree","contextInfo","issuerLayer","failedEntry","succeedEntry","chunkGroup","mapping","serverManifest","node","edge","edgeServerManifest","json","undefined","edgeJson","emitAsset","SERVER_REFERENCE_MANIFEST","sources","RawSource","modRequest","isFirstVisitModule","clientEntryType","isCjsModule","assumedSourceType","getAssumedSourceType","clientImportsSet","isAutoModuleSourceType","isCjsDefaultImport","identifier","rawRequest"],"mappings":";;;;+BAiMaA;;;eAAAA;;;yBA5LW;6BACS;6DAChB;sCAOV;2BAIA;4BASA;uBAKA;wBAMA;kCAC0B;8BACK;2BACX;oCACQ;kCACE;iCACL;iCAIzB;0EAGuB;;;;;;AAS9B,MAAMC,cAAc;AAiCpB,MAAMC,cAAcC,IAAAA,mCAAqB,EAAC;IACxC,gDAAgD;IAChDC,eAAe,CAAC;IAChBC,mBAAmB,CAAC;IAEpBC,qBAAqB,CAAC;IAOtBC,yBAAyB,CAAC;IAO1BC,YAAY,CAAC;IACbC,gBAAgB,CAAC;IAEjBC,YAAY,CAAC;IACbC,gBAAgB,CAAC;IAEjBC,uBAAuB,CAAC;AAC1B;AAEA,MAAMC,8BAA8B;IAAC;IAAY;CAAS;AAC1D,MAAMC,+BAA+B;AAErC,SAASC,8BAA8BC,gBAA4B;IACjE,uEAAuE;IACvE,oEAAoE;IACpE,wEAAwE;IACxE,+DAA+D;IAC/D,sEAAsE;IACtE,uEAAuE;IACvE,wEAAwE;IACxE,UAAU;IACV,qEAAqE;IACrE,qEAAqE;IACrE,mEAAmE;IACnE,yEAAyE;IACzE,uFAAuF;IAEvF,2CAA2C;IAC3C,MAAMC,mBAAmBC,OAAOC,OAAO,CAACH,kBAAkBI,IAAI,CAAC,CAACC,GAAGC;QACjE,MAAM,CAACC,MAAM,GAAGF;QAChB,MAAM,CAACG,MAAM,GAAGF;QAEhB,MAAMG,SAASF,MAAMG,KAAK,CAAC,KAAKC,MAAM;QACtC,MAAMC,SAASJ,MAAME,KAAK,CAAC,KAAKC,MAAM;QAEtC,IAAIF,WAAWG,Q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711
  isClient && new _copyfileplugin.CopyFilePlugin({
1712
1712
  // file path to build output of `@next/polyfill-nomodule`
1713
1713
  filePath: require.resolve('./polyfills/polyfill-nomodule'),
1714
- cacheKey: "15.4.2-canary.49",
1714
+ cacheKey: "15.4.2-canary.50",
1715
1715
  name: `static/chunks/polyfills${dev ? '' : '-[hash]'}.js`,
1716
1716
  minimize: false,
1717
1717
  info: {
@@ -1890,7 +1890,7 @@ async function getBaseWebpackConfig(dir, { buildId, encryptionKey, config, compi
1890
1890
  // - Next.js location on disk (some loaders use absolute paths and some resolve options depend on absolute paths)
1891
1891
  // - Next.js version
1892
1892
  // - next.config.js keys that affect compilation
1893
- version: `${__dirname}|${"15.4.2-canary.49"}|${configVars}`,
1893
+ version: `${__dirname}|${"15.4.2-canary.50"}|${configVars}`,
1894
1894
  cacheDirectory: _path.default.join(distDir, 'cache', 'webpack'),
1895
1895
  // For production builds, it's more efficient to compress all cache files together instead of compression each one individually.
1896
1896
  // So we disable compression here and allow the build runner to take care of compressing the cache as a whole.
@@ -14,7 +14,7 @@ Object.defineProperty(exports, "appBootstrap", {
14
14
  }
15
15
  });
16
16
  const _setattributesfromprops = require("./set-attributes-from-props");
17
- const version = "15.4.2-canary.49";
17
+ const version = "15.4.2-canary.50";
18
18
  window.next = {
19
19
  version,
20
20
  appDir: true
@@ -61,7 +61,7 @@ const _hooksclientcontextsharedruntime = require("../shared/lib/hooks-client-con
61
61
  const _onrecoverableerror = require("./react-client-callbacks/on-recoverable-error");
62
62
  const _tracer = /*#__PURE__*/ _interop_require_default._(require("./tracing/tracer"));
63
63
  const _isnextroutererror = require("./components/is-next-router-error");
64
- const version = "15.4.2-canary.49";
64
+ const version = "15.4.2-canary.50";
65
65
  let router;
66
66
  const emitter = (0, _mitt.default)();
67
67
  const looseToArray = (input)=>[].slice.call(input);