next 16.0.0-canary.5 → 16.0.0-canary.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/dist/bin/next +1 -1
  2. package/dist/build/index.js +4 -4
  3. package/dist/build/index.js.map +1 -1
  4. package/dist/build/swc/generated-native.d.ts +6 -6
  5. package/dist/build/swc/index.js +1 -1
  6. package/dist/build/templates/app-page.js +5 -6
  7. package/dist/build/templates/app-page.js.map +1 -1
  8. package/dist/build/webpack-config-rules/resolve.d.ts +1 -1
  9. package/dist/build/webpack-config-rules/resolve.js +8 -9
  10. package/dist/build/webpack-config-rules/resolve.js.map +1 -1
  11. package/dist/build/webpack-config.js +23 -16
  12. package/dist/build/webpack-config.js.map +1 -1
  13. package/dist/client/app-bootstrap.js +1 -1
  14. package/dist/client/index.js +1 -1
  15. package/dist/esm/build/index.js +4 -4
  16. package/dist/esm/build/index.js.map +1 -1
  17. package/dist/esm/build/swc/generated-native.d.ts +6 -6
  18. package/dist/esm/build/swc/index.js +1 -1
  19. package/dist/esm/build/templates/app-page.js +5 -6
  20. package/dist/esm/build/templates/app-page.js.map +1 -1
  21. package/dist/esm/build/webpack-config-rules/resolve.js +5 -7
  22. package/dist/esm/build/webpack-config-rules/resolve.js.map +1 -1
  23. package/dist/esm/build/webpack-config.js +24 -17
  24. package/dist/esm/build/webpack-config.js.map +1 -1
  25. package/dist/esm/client/app-bootstrap.js +1 -1
  26. package/dist/esm/client/index.js +1 -1
  27. package/dist/esm/server/config-schema.js +0 -1
  28. package/dist/esm/server/config-schema.js.map +1 -1
  29. package/dist/esm/server/config-shared.js +0 -1
  30. package/dist/esm/server/config-shared.js.map +1 -1
  31. package/dist/esm/server/config.js +5 -29
  32. package/dist/esm/server/config.js.map +1 -1
  33. package/dist/esm/server/dev/hot-reloader-turbopack.js +1 -1
  34. package/dist/esm/server/dev/hot-reloader-webpack.js +1 -1
  35. package/dist/esm/server/lib/app-info-log.js +1 -1
  36. package/dist/esm/server/lib/start-server.js +1 -1
  37. package/dist/esm/shared/lib/errors/canary-only-config-error.js +1 -1
  38. package/dist/server/config-schema.d.ts +0 -1
  39. package/dist/server/config-schema.js +0 -1
  40. package/dist/server/config-schema.js.map +1 -1
  41. package/dist/server/config-shared.d.ts +0 -7
  42. package/dist/server/config-shared.js +0 -1
  43. package/dist/server/config-shared.js.map +1 -1
  44. package/dist/server/config.js +5 -29
  45. package/dist/server/config.js.map +1 -1
  46. package/dist/server/dev/hot-reloader-turbopack.js +1 -1
  47. package/dist/server/dev/hot-reloader-webpack.js +1 -1
  48. package/dist/server/lib/app-info-log.js +1 -1
  49. package/dist/server/lib/start-server.js +1 -1
  50. package/dist/shared/lib/errors/canary-only-config-error.js +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
@@ -35,7 +35,7 @@ import { MemoryWithGcCachePlugin } from './webpack/plugins/memory-with-gc-cache-
35
35
  import { getBabelConfigFile } from './get-babel-config-file';
36
36
  import { needsExperimentalReact } from '../lib/needs-experimental-react';
37
37
  import { isResourceInPackages, makeExternalHandler } from './handle-externals';
38
- import { getMainField, edgeConditionNames } from './webpack-config-rules/resolve';
38
+ import { getMainField, edgeConditionName } from './webpack-config-rules/resolve';
39
39
  import { OptionalPeerDependencyResolverPlugin } from './webpack/plugins/optional-peer-dependency-resolve-plugin';
40
40
  import { createWebpackAliases, createServerOnlyClientOnlyAliases, createVendoredReactAliases, createNextApiEsmAliases, createAppRouterApiAliases } from './create-compiler-aliases';
41
41
  import { hasCustomExportOutput } from '../export/utils';
@@ -204,9 +204,9 @@ export function getCacheDirectories(configs) {
204
204
  }).filter((dir)=>dir != null));
205
205
  }
206
206
  export default async function getBaseWebpackConfig(dir, { buildId, encryptionKey, config, compilerType, dev = false, entrypoints, isDevFallback = false, pagesDir, reactProductionProfiling = false, rewrites, originalRewrites, originalRedirects, runWebpackSpan, appDir, middlewareMatchers, noMangling, jsConfig, jsConfigPath, resolvedBaseUrl, supportedBrowsers, clientRouterFilters, fetchCacheKeyPrefix, isCompileMode, previewProps }) {
207
- var _config_compiler, _config_compiler1, _config_compiler2, _jsConfig_compilerOptions, _config_compiler3, _jsConfig_compilerOptions1, _config_compiler4, _config_experimental, _config_watchOptions, _config_experimental_sri, _config_experimental_sri1, _jsConfig_compilerOptions2, // always add JsConfigPathsPlugin to allow hot-reloading
207
+ var _config_experimental, _config_compiler, _config_compiler1, _config_compiler2, _jsConfig_compilerOptions, _config_compiler3, _jsConfig_compilerOptions1, _config_compiler4, _config_experimental1, _config_watchOptions, _config_experimental_sri, _config_experimental_sri1, _jsConfig_compilerOptions2, // always add JsConfigPathsPlugin to allow hot-reloading
208
208
  // if the config is added/removed
209
- _webpackConfig_resolve_plugins, _webpackConfig_resolve, _config_experimental1, _config_compiler5, _config_compiler6, _config_compiler7, _config_compiler8, _config_compiler9, _webpack5Config_plugins, _webpackConfig_module, _webpackConfig_module1, _webpackConfig_module_rules, _webpackConfig_module2;
209
+ _webpackConfig_resolve_plugins, _webpackConfig_resolve, _config_experimental2, _config_compiler5, _config_compiler6, _config_compiler7, _config_compiler8, _config_compiler9, _webpack5Config_plugins, _webpackConfig_module, _webpackConfig_module1, _webpackConfig_module_rules, _webpackConfig_module2;
210
210
  const bundler = getWebpackBundler();
211
211
  const isClient = compilerType === COMPILER_NAMES.client;
212
212
  const isEdgeServer = compilerType === COMPILER_NAMES.edgeServer;
@@ -433,12 +433,21 @@ export default async function getBaseWebpackConfig(dir, { buildId, encryptionKey
433
433
  }) : defaultLoaders.babel;
434
434
  const pageExtensions = config.pageExtensions;
435
435
  const outputPath = isNodeOrEdgeCompilation ? path.join(distDir, SERVER_DIRECTORY) : distDir;
436
- const reactServerCondition = [
437
- 'react-server',
438
- ...isEdgeServer ? edgeConditionNames : [],
439
- // inherits the default conditions
436
+ const conditionNames = [
437
+ ...((_config_experimental = config.experimental) == null ? void 0 : _config_experimental.cacheComponents) === true ? [
438
+ 'next-js'
439
+ ] : [],
440
+ ...isEdgeServer ? [
441
+ edgeConditionName
442
+ ] : [],
443
+ // inherits Webpack's default conditions
440
444
  '...'
441
445
  ];
446
+ const reactServerConditionNames = [
447
+ 'react-server',
448
+ // We could just use `'...'`. Explicit spread makes it more obvious.
449
+ ...conditionNames
450
+ ];
442
451
  const reactRefreshEntry = isRspack ? require.resolve(`next/dist/compiled/@next/react-refresh-utils/dist/rspack-runtime`) : require.resolve(`next/dist/compiled/@next/react-refresh-utils/dist/runtime`);
443
452
  const clientEntries = isClient ? {
444
453
  // Backwards compatibility
@@ -457,6 +466,7 @@ export default async function getBaseWebpackConfig(dir, { buildId, encryptionKey
457
466
  } : {}
458
467
  } : undefined;
459
468
  const resolveConfig = {
469
+ conditionNames,
460
470
  // Disable .mjs for node_modules bundling
461
471
  extensions: [
462
472
  '.js',
@@ -490,9 +500,6 @@ export default async function getBaseWebpackConfig(dir, { buildId, encryptionKey
490
500
  } : undefined,
491
501
  // default main fields use pages dir ones, and customize app router ones in loaders.
492
502
  mainFields: getMainField(compilerType, false),
493
- ...isEdgeServer && {
494
- conditionNames: edgeConditionNames
495
- },
496
503
  plugins: [
497
504
  isNodeServer ? new OptionalPeerDependencyResolverPlugin() : undefined
498
505
  ].filter(Boolean),
@@ -875,7 +882,7 @@ export default async function getBaseWebpackConfig(dir, { buildId, encryptionKey
875
882
  // Minify CSS
876
883
  // By default, Rspack uses LightningCSS for CSS minification.
877
884
  // Rspack uses css-minimizer-plugin by default for compatibility.
878
- isRspack && (process.env.__NEXT_TEST_MODE ? config.experimental.useLightningcss : ((_config_experimental = config.experimental) == null ? void 0 : _config_experimental.useLightningcss) === undefined || config.experimental.useLightningcss) ? new (getRspackCore()).LightningCssMinimizerRspackPlugin({
885
+ isRspack && (process.env.__NEXT_TEST_MODE ? config.experimental.useLightningcss : ((_config_experimental1 = config.experimental) == null ? void 0 : _config_experimental1.useLightningcss) === undefined || config.experimental.useLightningcss) ? new (getRspackCore()).LightningCssMinimizerRspackPlugin({
879
886
  // CSS minimizer configuration
880
887
  minimizerOptions: {
881
888
  targets: supportedBrowsers
@@ -1119,7 +1126,7 @@ export default async function getBaseWebpackConfig(dir, { buildId, encryptionKey
1119
1126
  },
1120
1127
  resolve: {
1121
1128
  mainFields: getMainField(compilerType, true),
1122
- conditionNames: reactServerCondition,
1129
+ conditionNames: reactServerConditionNames,
1123
1130
  // If missing the alias override here, the default alias will be used which aliases
1124
1131
  // react to the direct file path, not the package name. In that case the condition
1125
1132
  // will be ignored completely.
@@ -1258,7 +1265,7 @@ export default async function getBaseWebpackConfig(dir, { buildId, encryptionKey
1258
1265
  use: middlewareLayerLoaders,
1259
1266
  resolve: {
1260
1267
  mainFields: getMainField(compilerType, true),
1261
- conditionNames: reactServerCondition,
1268
+ conditionNames: reactServerConditionNames,
1262
1269
  alias: createVendoredReactAliases(bundledReactChannel, {
1263
1270
  reactProductionProfiling,
1264
1271
  layer: WEBPACK_LAYERS.middleware,
@@ -1273,7 +1280,7 @@ export default async function getBaseWebpackConfig(dir, { buildId, encryptionKey
1273
1280
  use: instrumentLayerLoaders,
1274
1281
  resolve: {
1275
1282
  mainFields: getMainField(compilerType, true),
1276
- conditionNames: reactServerCondition,
1283
+ conditionNames: reactServerConditionNames,
1277
1284
  alias: createVendoredReactAliases(bundledReactChannel, {
1278
1285
  reactProductionProfiling,
1279
1286
  layer: WEBPACK_LAYERS.instrument,
@@ -1600,7 +1607,7 @@ export default async function getBaseWebpackConfig(dir, { buildId, encryptionKey
1600
1607
  isClient && new CopyFilePlugin({
1601
1608
  // file path to build output of `@next/polyfill-nomodule`
1602
1609
  filePath: require.resolve('./polyfills/polyfill-nomodule'),
1603
- cacheKey: "16.0.0-canary.5",
1610
+ cacheKey: "16.0.0-canary.6",
1604
1611
  name: `static/chunks/polyfills${dev ? '' : '-[hash]'}.js`,
1605
1612
  minimize: false,
1606
1613
  info: {
@@ -1753,7 +1760,7 @@ export default async function getBaseWebpackConfig(dir, { buildId, encryptionKey
1753
1760
  webpack5Config.optimization.usedExports = false;
1754
1761
  }
1755
1762
  const configVars = JSON.stringify({
1756
- optimizePackageImports: config == null ? void 0 : (_config_experimental1 = config.experimental) == null ? void 0 : _config_experimental1.optimizePackageImports,
1763
+ optimizePackageImports: config == null ? void 0 : (_config_experimental2 = config.experimental) == null ? void 0 : _config_experimental2.optimizePackageImports,
1757
1764
  crossOrigin: config.crossOrigin,
1758
1765
  pageExtensions: pageExtensions,
1759
1766
  trailingSlash: config.trailingSlash,
@@ -1791,7 +1798,7 @@ export default async function getBaseWebpackConfig(dir, { buildId, encryptionKey
1791
1798
  // - Next.js location on disk (some loaders use absolute paths and some resolve options depend on absolute paths)
1792
1799
  // - Next.js version
1793
1800
  // - next.config.js keys that affect compilation
1794
- version: `${__dirname}|${"16.0.0-canary.5"}|${configVars}`,
1801
+ version: `${__dirname}|${"16.0.0-canary.6"}|${configVars}`,
1795
1802
  cacheDirectory: path.join(distDir, 'cache', 'webpack'),
1796
1803
  // For production builds, it's more efficient to compress all cache files together instead of compression each one individually.
1797
1804
  // So we disable compression here and allow the build runner to take care of compressing the cache as a whole.