next 15.0.4-canary.13 → 15.0.4-canary.15

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 (34) 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/swc/options.d.ts +3 -1
  5. package/dist/build/swc/options.js +6 -4
  6. package/dist/build/swc/options.js.map +1 -1
  7. package/dist/build/webpack/loaders/next-swc-loader.js +3 -2
  8. package/dist/build/webpack/loaders/next-swc-loader.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/esm/build/index.js +2 -2
  13. package/dist/esm/build/swc/index.js +1 -1
  14. package/dist/esm/build/swc/options.js +6 -4
  15. package/dist/esm/build/swc/options.js.map +1 -1
  16. package/dist/esm/build/webpack/loaders/next-swc-loader.js +3 -2
  17. package/dist/esm/build/webpack/loaders/next-swc-loader.js.map +1 -1
  18. package/dist/esm/build/webpack-config.js +2 -2
  19. package/dist/esm/client/app-bootstrap.js +1 -1
  20. package/dist/esm/client/index.js +1 -1
  21. package/dist/esm/server/config.js +1 -1
  22. package/dist/esm/server/dev/hot-reloader-turbopack.js +1 -1
  23. package/dist/esm/server/dev/hot-reloader-webpack.js +1 -1
  24. package/dist/esm/server/lib/app-info-log.js +1 -1
  25. package/dist/esm/server/lib/start-server.js +1 -1
  26. package/dist/server/config.js +1 -1
  27. package/dist/server/dev/hot-reloader-turbopack.js +1 -1
  28. package/dist/server/dev/hot-reloader-webpack.js +1 -1
  29. package/dist/server/lib/app-info-log.js +1 -1
  30. package/dist/server/lib/start-server.js +1 -1
  31. package/dist/telemetry/anonymous-meta.js +1 -1
  32. package/dist/telemetry/events/session-stopped.js +2 -2
  33. package/dist/telemetry/events/version.js +2 -2
  34. package/package.json +15 -15
package/dist/bin/next CHANGED
@@ -74,7 +74,7 @@ const program = new NextRootCommand();
74
74
  program.name('next').description('The Next.js CLI allows you to develop, build, start your application, and more.').configureHelp({
75
75
  formatHelp: (cmd, helper)=>(0, _formatclihelpoutput.formatCliHelpOutput)(cmd, helper),
76
76
  subcommandTerm: (cmd)=>`${cmd.name()} ${cmd.usage()}`
77
- }).helpCommand(false).helpOption('-h, --help', 'Displays this message.').version(`Next.js v${"15.0.4-canary.13"}`, '-v, --version', 'Outputs the Next.js version.');
77
+ }).helpCommand(false).helpOption('-h, --help', 'Displays this message.').version(`Next.js v${"15.0.4-canary.15"}`, '-v, --version', 'Outputs the Next.js version.');
78
78
  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('--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.').addOption(new _commander.Option('--experimental-turbo').hideHelp()).addOption(new _commander.Option('--experimental-build-mode [mode]', 'Uses an experimental build mode.').choices([
79
79
  'compile',
80
80
  'generate'
@@ -351,7 +351,7 @@ async function build(dir, reactProductionProfiling = false, debugOutput = false,
351
351
  const nextBuildSpan = (0, _trace.trace)('next-build', undefined, {
352
352
  buildMode: experimentalBuildMode,
353
353
  isTurboBuild: String(turboNextBuild),
354
- version: "15.0.4-canary.13"
354
+ version: "15.0.4-canary.15"
355
355
  });
356
356
  _buildcontext.NextBuildContext.nextBuildSpan = nextBuildSpan;
357
357
  _buildcontext.NextBuildContext.dir = dir;
@@ -752,7 +752,7 @@ async function build(dir, reactProductionProfiling = false, debugOutput = false,
752
752
  // Files outside of the distDir can be "type": "module"
753
753
  await writeFileUtf8(_path.default.join(distDir, 'package.json'), '{"type": "commonjs"}');
754
754
  // These are written to distDir, so they need to come after creating and cleaning distDr.
755
- await (0, _builddiagnostics.recordFrameworkVersion)("15.0.4-canary.13");
755
+ await (0, _builddiagnostics.recordFrameworkVersion)("15.0.4-canary.15");
756
756
  await (0, _builddiagnostics.updateBuildDiagnostics)({
757
757
  buildStage: 'start'
758
758
  });
@@ -127,7 +127,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
127
127
  }
128
128
  return newObj;
129
129
  }
130
- const nextVersion = "15.0.4-canary.13";
130
+ const nextVersion = "15.0.4-canary.15";
131
131
  const ArchName = (0, _os.arch)();
132
132
  const PlatformName = (0, _os.platform)();
133
133
  function infoLog(...args) {
@@ -34,6 +34,7 @@ export declare function getJestSWCOptions({ isServer, filename, esm, modularizeI
34
34
  isReactServerLayer: boolean;
35
35
  dynamicIoEnabled: boolean | undefined;
36
36
  hashSalt: string;
37
+ cacheKinds: string[];
37
38
  } | undefined;
38
39
  preferEsm: boolean;
39
40
  lintCodemodComments: boolean;
@@ -129,7 +130,7 @@ export declare function getJestSWCOptions({ isServer, filename, esm, modularizeI
129
130
  } | undefined;
130
131
  styledJsx: {};
131
132
  };
132
- export declare function getLoaderSWCOptions({ filename, development, isServer, pagesDir, appDir, isPageFile, isDynamicIo, hasReactRefresh, modularizeImports, optimizeServerReact, optimizePackageImports, swcPlugins, compilerOptions, jsConfig, supportedBrowsers, swcCacheDir, relativeFilePathFromRoot, serverComponents, serverReferenceHashSalt, bundleLayer, esm, }: {
133
+ export declare function getLoaderSWCOptions({ filename, development, isServer, pagesDir, appDir, isPageFile, isDynamicIo, hasReactRefresh, modularizeImports, optimizeServerReact, optimizePackageImports, swcPlugins, compilerOptions, jsConfig, supportedBrowsers, swcCacheDir, relativeFilePathFromRoot, serverComponents, serverReferenceHashSalt, bundleLayer, esm, cacheHandlers, }: {
133
134
  filename: string;
134
135
  development: boolean;
135
136
  isServer: boolean;
@@ -151,4 +152,5 @@ export declare function getLoaderSWCOptions({ filename, development, isServer, p
151
152
  serverComponents?: boolean;
152
153
  serverReferenceHashSalt: string;
153
154
  bundleLayer?: WebpackLayerName;
155
+ cacheHandlers: ExperimentalConfig['cacheHandlers'];
154
156
  }): any;
@@ -55,7 +55,7 @@ function getParserOptions({ filename, jsConfig, ...rest }) {
55
55
  importAssertions: true
56
56
  };
57
57
  }
58
- function getBaseSWCOptions({ filename, jest, development, hasReactRefresh, globalWindow, esm, modularizeImports, swcPlugins, compilerOptions, resolvedBaseUrl, jsConfig, swcCacheDir, serverComponents, serverReferenceHashSalt, bundleLayer, isDynamicIo }) {
58
+ function getBaseSWCOptions({ filename, jest, development, hasReactRefresh, globalWindow, esm, modularizeImports, swcPlugins, compilerOptions, resolvedBaseUrl, jsConfig, swcCacheDir, serverComponents, serverReferenceHashSalt, bundleLayer, isDynamicIo, cacheHandlers }) {
59
59
  var _jsConfig_compilerOptions, _jsConfig_compilerOptions1, _jsConfig_compilerOptions2, _jsConfig_compilerOptions3, _jsConfig_compilerOptions4;
60
60
  const isReactServerLayer = (0, _utils.isWebpackServerOnlyLayer)(bundleLayer);
61
61
  const isAppRouterPagesLayer = (0, _utils.isWebpackAppPagesLayer)(bundleLayer);
@@ -153,7 +153,8 @@ function getBaseSWCOptions({ filename, jest, development, hasReactRefresh, globa
153
153
  serverActions: isAppRouterPagesLayer && !jest ? {
154
154
  isReactServerLayer,
155
155
  dynamicIoEnabled: isDynamicIo,
156
- hashSalt: serverReferenceHashSalt
156
+ hashSalt: serverReferenceHashSalt,
157
+ cacheKinds: cacheHandlers ? Object.keys(cacheHandlers) : []
157
158
  } : undefined,
158
159
  // For app router we prefer to bundle ESM,
159
160
  // On server side of pages router we prefer CJS.
@@ -241,7 +242,7 @@ function getJestSWCOptions({ isServer, filename, esm, modularizeImports, swcPlug
241
242
  }
242
243
  function getLoaderSWCOptions({ // This is not passed yet as "paths" resolving is handled by webpack currently.
243
244
  // resolvedBaseUrl,
244
- filename, development, isServer, pagesDir, appDir, isPageFile, isDynamicIo, hasReactRefresh, modularizeImports, optimizeServerReact, optimizePackageImports, swcPlugins, compilerOptions, jsConfig, supportedBrowsers, swcCacheDir, relativeFilePathFromRoot, serverComponents, serverReferenceHashSalt, bundleLayer, esm }) {
245
+ filename, development, isServer, pagesDir, appDir, isPageFile, isDynamicIo, hasReactRefresh, modularizeImports, optimizeServerReact, optimizePackageImports, swcPlugins, compilerOptions, jsConfig, supportedBrowsers, swcCacheDir, relativeFilePathFromRoot, serverComponents, serverReferenceHashSalt, bundleLayer, esm, cacheHandlers }) {
245
246
  let baseOptions = getBaseSWCOptions({
246
247
  filename,
247
248
  development,
@@ -257,7 +258,8 @@ filename, development, isServer, pagesDir, appDir, isPageFile, isDynamicIo, hasR
257
258
  serverComponents,
258
259
  serverReferenceHashSalt,
259
260
  esm: !!esm,
260
- isDynamicIo
261
+ isDynamicIo,
262
+ cacheHandlers
261
263
  });
262
264
  baseOptions.fontLoaders = {
263
265
  fontLoaders: [
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/build/swc/options.ts"],"sourcesContent":["import { WEBPACK_LAYERS, type WebpackLayerName } from '../../lib/constants'\nimport type {\n NextConfig,\n ExperimentalConfig,\n EmotionConfig,\n StyledComponentsConfig,\n} from '../../server/config-shared'\nimport type { ResolvedBaseUrl } from '../load-jsconfig'\nimport { isWebpackServerOnlyLayer, isWebpackAppPagesLayer } from '../utils'\n\nconst nextDistPath =\n /(next[\\\\/]dist[\\\\/]shared[\\\\/]lib)|(next[\\\\/]dist[\\\\/]client)|(next[\\\\/]dist[\\\\/]pages)/\n\nconst nodeModulesPath = /[\\\\/]node_modules[\\\\/]/\n\nconst regeneratorRuntimePath = require.resolve(\n 'next/dist/compiled/regenerator-runtime'\n)\n\nfunction isTypeScriptFile(filename: string) {\n return filename.endsWith('.ts') || filename.endsWith('.tsx')\n}\n\nfunction isCommonJSFile(filename: string) {\n return filename.endsWith('.cjs')\n}\n\n// Ensure Next.js internals and .cjs files are output as CJS modules,\n// By default all modules are output as ESM or will treated as CJS if next-swc/auto-cjs plugin detects file is CJS.\nfunction shouldOutputCommonJs(filename: string) {\n return isCommonJSFile(filename) || nextDistPath.test(filename)\n}\n\nexport function getParserOptions({ filename, jsConfig, ...rest }: any) {\n const isTSFile = filename.endsWith('.ts')\n const hasTsSyntax = isTypeScriptFile(filename)\n const enableDecorators = Boolean(\n jsConfig?.compilerOptions?.experimentalDecorators\n )\n return {\n ...rest,\n syntax: hasTsSyntax ? 'typescript' : 'ecmascript',\n dynamicImport: true,\n decorators: enableDecorators,\n // Exclude regular TypeScript files from React transformation to prevent e.g. generic parameters and angle-bracket type assertion from being interpreted as JSX tags.\n [hasTsSyntax ? 'tsx' : 'jsx']: !isTSFile,\n importAssertions: true,\n }\n}\n\nfunction getBaseSWCOptions({\n filename,\n jest,\n development,\n hasReactRefresh,\n globalWindow,\n esm,\n modularizeImports,\n swcPlugins,\n compilerOptions,\n resolvedBaseUrl,\n jsConfig,\n swcCacheDir,\n serverComponents,\n serverReferenceHashSalt,\n bundleLayer,\n isDynamicIo,\n}: {\n filename: string\n jest?: boolean\n development: boolean\n hasReactRefresh: boolean\n globalWindow: boolean\n esm: boolean\n modularizeImports?: NextConfig['modularizeImports']\n compilerOptions: NextConfig['compiler']\n swcPlugins: ExperimentalConfig['swcPlugins']\n resolvedBaseUrl?: ResolvedBaseUrl\n jsConfig: any\n swcCacheDir?: string\n serverComponents?: boolean\n serverReferenceHashSalt: string\n bundleLayer?: WebpackLayerName\n isDynamicIo?: boolean\n}) {\n const isReactServerLayer = isWebpackServerOnlyLayer(bundleLayer)\n const isAppRouterPagesLayer = isWebpackAppPagesLayer(bundleLayer)\n const parserConfig = getParserOptions({ filename, jsConfig })\n const paths = jsConfig?.compilerOptions?.paths\n const enableDecorators = Boolean(\n jsConfig?.compilerOptions?.experimentalDecorators\n )\n const emitDecoratorMetadata = Boolean(\n jsConfig?.compilerOptions?.emitDecoratorMetadata\n )\n const useDefineForClassFields = Boolean(\n jsConfig?.compilerOptions?.useDefineForClassFields\n )\n const plugins = (swcPlugins ?? [])\n .filter(Array.isArray)\n .map(([name, options]: any) => [require.resolve(name), options])\n\n return {\n jsc: {\n ...(resolvedBaseUrl && paths\n ? {\n baseUrl: resolvedBaseUrl.baseUrl,\n paths,\n }\n : {}),\n externalHelpers: !process.versions.pnp && !jest,\n parser: parserConfig,\n experimental: {\n keepImportAttributes: true,\n emitAssertForImportAttributes: true,\n plugins,\n cacheRoot: swcCacheDir,\n },\n transform: {\n // Enables https://github.com/swc-project/swc/blob/0359deb4841be743d73db4536d4a22ac797d7f65/crates/swc_ecma_ext_transforms/src/jest.rs\n ...(jest\n ? {\n hidden: {\n jest: true,\n },\n }\n : {}),\n legacyDecorator: enableDecorators,\n decoratorMetadata: emitDecoratorMetadata,\n useDefineForClassFields: useDefineForClassFields,\n react: {\n importSource:\n jsConfig?.compilerOptions?.jsxImportSource ??\n (compilerOptions?.emotion && !isReactServerLayer\n ? '@emotion/react'\n : 'react'),\n runtime: 'automatic',\n pragmaFrag: 'React.Fragment',\n throwIfNamespace: true,\n development: !!development,\n useBuiltins: true,\n refresh: !!hasReactRefresh,\n },\n optimizer: {\n simplify: false,\n globals: jest\n ? null\n : {\n typeofs: {\n window: globalWindow ? 'object' : 'undefined',\n },\n envs: {\n NODE_ENV: development ? '\"development\"' : '\"production\"',\n },\n // TODO: handle process.browser to match babel replacing as well\n },\n },\n regenerator: {\n importPath: regeneratorRuntimePath,\n },\n },\n },\n sourceMaps: jest ? 'inline' : undefined,\n removeConsole: compilerOptions?.removeConsole,\n // disable \"reactRemoveProperties\" when \"jest\" is true\n // otherwise the setting from next.config.js will be used\n reactRemoveProperties: jest\n ? false\n : compilerOptions?.reactRemoveProperties,\n // Map the k-v map to an array of pairs.\n modularizeImports: modularizeImports\n ? Object.fromEntries(\n Object.entries(modularizeImports).map(([mod, config]) => [\n mod,\n {\n ...config,\n transform:\n typeof config.transform === 'string'\n ? config.transform\n : Object.entries(config.transform).map(([key, value]) => [\n key,\n value,\n ]),\n },\n ])\n )\n : undefined,\n relay: compilerOptions?.relay,\n // Always transform styled-jsx and error when `client-only` condition is triggered\n styledJsx: {},\n // Disable css-in-js libs (without client-only integration) transform on server layer for server components\n ...(!isReactServerLayer && {\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n emotion: getEmotionOptions(compilerOptions?.emotion, development),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n styledComponents: getStyledComponentsOptions(\n compilerOptions?.styledComponents,\n development\n ),\n }),\n serverComponents:\n serverComponents && !jest\n ? {\n isReactServerLayer,\n dynamicIoEnabled: isDynamicIo,\n }\n : undefined,\n serverActions:\n isAppRouterPagesLayer && !jest\n ? {\n isReactServerLayer,\n dynamicIoEnabled: isDynamicIo,\n hashSalt: serverReferenceHashSalt,\n }\n : undefined,\n // For app router we prefer to bundle ESM,\n // On server side of pages router we prefer CJS.\n preferEsm: esm,\n lintCodemodComments: true,\n debugFunctionName: development,\n }\n}\n\nfunction getStyledComponentsOptions(\n styledComponentsConfig: undefined | boolean | StyledComponentsConfig,\n development: any\n) {\n if (!styledComponentsConfig) {\n return null\n } else if (typeof styledComponentsConfig === 'object') {\n return {\n ...styledComponentsConfig,\n displayName: styledComponentsConfig.displayName ?? Boolean(development),\n }\n } else {\n return {\n displayName: Boolean(development),\n }\n }\n}\n\nfunction getEmotionOptions(\n emotionConfig: undefined | boolean | EmotionConfig,\n development: boolean\n) {\n if (!emotionConfig) {\n return null\n }\n let autoLabel = !!development\n switch (typeof emotionConfig === 'object' && emotionConfig.autoLabel) {\n case 'never':\n autoLabel = false\n break\n case 'always':\n autoLabel = true\n break\n case 'dev-only':\n default:\n break\n }\n return {\n enabled: true,\n autoLabel,\n sourcemap: development,\n ...(typeof emotionConfig === 'object' && {\n importMap: emotionConfig.importMap,\n labelFormat: emotionConfig.labelFormat,\n sourcemap: development && emotionConfig.sourceMap,\n }),\n }\n}\n\nexport function getJestSWCOptions({\n isServer,\n filename,\n esm,\n modularizeImports,\n swcPlugins,\n compilerOptions,\n jsConfig,\n resolvedBaseUrl,\n pagesDir,\n serverReferenceHashSalt,\n}: {\n isServer: boolean\n filename: string\n esm: boolean\n modularizeImports?: NextConfig['modularizeImports']\n swcPlugins: ExperimentalConfig['swcPlugins']\n compilerOptions: NextConfig['compiler']\n jsConfig: any\n resolvedBaseUrl?: ResolvedBaseUrl\n pagesDir?: string\n serverComponents?: boolean\n serverReferenceHashSalt: string\n}) {\n let baseOptions = getBaseSWCOptions({\n filename,\n jest: true,\n development: false,\n hasReactRefresh: false,\n globalWindow: !isServer,\n modularizeImports,\n swcPlugins,\n compilerOptions,\n jsConfig,\n resolvedBaseUrl,\n esm,\n // Don't apply server layer transformations for Jest\n // Disable server / client graph assertions for Jest\n bundleLayer: undefined,\n serverComponents: false,\n serverReferenceHashSalt,\n })\n\n const useCjsModules = shouldOutputCommonJs(filename)\n return {\n ...baseOptions,\n env: {\n targets: {\n // Targets the current version of Node.js\n node: process.versions.node,\n },\n },\n module: {\n type: esm && !useCjsModules ? 'es6' : 'commonjs',\n },\n disableNextSsg: true,\n disablePageConfig: true,\n pagesDir,\n }\n}\n\nexport function getLoaderSWCOptions({\n // This is not passed yet as \"paths\" resolving is handled by webpack currently.\n // resolvedBaseUrl,\n filename,\n development,\n isServer,\n pagesDir,\n appDir,\n isPageFile,\n isDynamicIo,\n hasReactRefresh,\n modularizeImports,\n optimizeServerReact,\n optimizePackageImports,\n swcPlugins,\n compilerOptions,\n jsConfig,\n supportedBrowsers,\n swcCacheDir,\n relativeFilePathFromRoot,\n serverComponents,\n serverReferenceHashSalt,\n bundleLayer,\n esm,\n}: {\n filename: string\n development: boolean\n isServer: boolean\n pagesDir?: string\n appDir?: string\n isPageFile: boolean\n hasReactRefresh: boolean\n optimizeServerReact?: boolean\n modularizeImports: NextConfig['modularizeImports']\n isDynamicIo?: boolean\n optimizePackageImports?: NonNullable<\n NextConfig['experimental']\n >['optimizePackageImports']\n swcPlugins: ExperimentalConfig['swcPlugins']\n compilerOptions: NextConfig['compiler']\n jsConfig: any\n supportedBrowsers: string[] | undefined\n swcCacheDir: string\n relativeFilePathFromRoot: string\n esm?: boolean\n serverComponents?: boolean\n serverReferenceHashSalt: string\n bundleLayer?: WebpackLayerName\n}) {\n let baseOptions: any = getBaseSWCOptions({\n filename,\n development,\n globalWindow: !isServer,\n hasReactRefresh,\n modularizeImports,\n swcPlugins,\n compilerOptions,\n jsConfig,\n // resolvedBaseUrl,\n swcCacheDir,\n bundleLayer,\n serverComponents,\n serverReferenceHashSalt,\n esm: !!esm,\n isDynamicIo,\n })\n baseOptions.fontLoaders = {\n fontLoaders: ['next/font/local', 'next/font/google'],\n relativeFilePathFromRoot,\n }\n baseOptions.cjsRequireOptimizer = {\n packages: {\n 'next/server': {\n transforms: {\n NextRequest: 'next/dist/server/web/spec-extension/request',\n NextResponse: 'next/dist/server/web/spec-extension/response',\n ImageResponse: 'next/dist/server/web/spec-extension/image-response',\n userAgentFromString: 'next/dist/server/web/spec-extension/user-agent',\n userAgent: 'next/dist/server/web/spec-extension/user-agent',\n },\n },\n },\n }\n\n if (optimizeServerReact && isServer && !development) {\n baseOptions.optimizeServerReact = {\n optimize_use_state: false,\n }\n }\n\n // Modularize import optimization for barrel files\n if (optimizePackageImports) {\n baseOptions.autoModularizeImports = {\n packages: optimizePackageImports,\n }\n }\n\n const isNodeModules = nodeModulesPath.test(filename)\n const isAppBrowserLayer = bundleLayer === WEBPACK_LAYERS.appPagesBrowser\n const moduleResolutionConfig = shouldOutputCommonJs(filename)\n ? {\n module: {\n type: 'commonjs',\n },\n }\n : {}\n\n let options: any\n if (isServer) {\n options = {\n ...baseOptions,\n ...moduleResolutionConfig,\n // Disables getStaticProps/getServerSideProps tree shaking on the server compilation for pages\n disableNextSsg: true,\n disablePageConfig: true,\n isDevelopment: development,\n isServerCompiler: isServer,\n pagesDir,\n appDir,\n preferEsm: !!esm,\n isPageFile,\n env: {\n targets: {\n // Targets the current version of Node.js\n node: process.versions.node,\n },\n },\n }\n } else {\n options = {\n ...baseOptions,\n ...moduleResolutionConfig,\n disableNextSsg: !isPageFile,\n isDevelopment: development,\n isServerCompiler: isServer,\n pagesDir,\n appDir,\n isPageFile,\n ...(supportedBrowsers && supportedBrowsers.length > 0\n ? {\n env: {\n targets: supportedBrowsers,\n },\n }\n : {}),\n }\n if (!options.env) {\n // Matches default @babel/preset-env behavior\n options.jsc.target = 'es5'\n }\n }\n\n // For node_modules in app browser layer, we don't need to do any server side transformation.\n // Only keep server actions transform to discover server actions from client components.\n if (isAppBrowserLayer && isNodeModules) {\n options.disableNextSsg = true\n options.disablePageConfig = true\n options.isPageFile = false\n options.optimizeServerReact = undefined\n options.cjsRequireOptimizer = undefined\n // Disable optimizer for node_modules in app browser layer, to avoid unnecessary replacement.\n // e.g. typeof window could result differently in js worker or browser.\n if (options.jsc.transform.optimizer.globals?.typeofs) {\n delete options.jsc.transform.optimizer.globals.typeofs.window\n }\n }\n\n return options\n}\n"],"names":["getJestSWCOptions","getLoaderSWCOptions","getParserOptions","nextDistPath","nodeModulesPath","regeneratorRuntimePath","require","resolve","isTypeScriptFile","filename","endsWith","isCommonJSFile","shouldOutputCommonJs","test","jsConfig","rest","isTSFile","hasTsSyntax","enableDecorators","Boolean","compilerOptions","experimentalDecorators","syntax","dynamicImport","decorators","importAssertions","getBaseSWCOptions","jest","development","hasReactRefresh","globalWindow","esm","modularizeImports","swcPlugins","resolvedBaseUrl","swcCacheDir","serverComponents","serverReferenceHashSalt","bundleLayer","isDynamicIo","isReactServerLayer","isWebpackServerOnlyLayer","isAppRouterPagesLayer","isWebpackAppPagesLayer","parserConfig","paths","emitDecoratorMetadata","useDefineForClassFields","plugins","filter","Array","isArray","map","name","options","jsc","baseUrl","externalHelpers","process","versions","pnp","parser","experimental","keepImportAttributes","emitAssertForImportAttributes","cacheRoot","transform","hidden","legacyDecorator","decoratorMetadata","react","importSource","jsxImportSource","emotion","runtime","pragmaFrag","throwIfNamespace","useBuiltins","refresh","optimizer","simplify","globals","typeofs","window","envs","NODE_ENV","regenerator","importPath","sourceMaps","undefined","removeConsole","reactRemoveProperties","Object","fromEntries","entries","mod","config","key","value","relay","styledJsx","getEmotionOptions","styledComponents","getStyledComponentsOptions","dynamicIoEnabled","serverActions","hashSalt","preferEsm","lintCodemodComments","debugFunctionName","styledComponentsConfig","displayName","emotionConfig","autoLabel","enabled","sourcemap","importMap","labelFormat","sourceMap","isServer","pagesDir","baseOptions","useCjsModules","env","targets","node","module","type","disableNextSsg","disablePageConfig","appDir","isPageFile","optimizeServerReact","optimizePackageImports","supportedBrowsers","relativeFilePathFromRoot","fontLoaders","cjsRequireOptimizer","packages","transforms","NextRequest","NextResponse","ImageResponse","userAgentFromString","userAgent","optimize_use_state","autoModularizeImports","isNodeModules","isAppBrowserLayer","WEBPACK_LAYERS","appPagesBrowser","moduleResolutionConfig","isDevelopment","isServerCompiler","length","target"],"mappings":";;;;;;;;;;;;;;;;IAgRgBA,iBAAiB;eAAjBA;;IA6DAC,mBAAmB;eAAnBA;;IA5SAC,gBAAgB;eAAhBA;;;2BAjCsC;uBAQW;AAEjE,MAAMC,eACJ;AAEF,MAAMC,kBAAkB;AAExB,MAAMC,yBAAyBC,QAAQC,OAAO,CAC5C;AAGF,SAASC,iBAAiBC,QAAgB;IACxC,OAAOA,SAASC,QAAQ,CAAC,UAAUD,SAASC,QAAQ,CAAC;AACvD;AAEA,SAASC,eAAeF,QAAgB;IACtC,OAAOA,SAASC,QAAQ,CAAC;AAC3B;AAEA,qEAAqE;AACrE,mHAAmH;AACnH,SAASE,qBAAqBH,QAAgB;IAC5C,OAAOE,eAAeF,aAAaN,aAAaU,IAAI,CAACJ;AACvD;AAEO,SAASP,iBAAiB,EAAEO,QAAQ,EAAEK,QAAQ,EAAE,GAAGC,MAAW;QAIjED;IAHF,MAAME,WAAWP,SAASC,QAAQ,CAAC;IACnC,MAAMO,cAAcT,iBAAiBC;IACrC,MAAMS,mBAAmBC,QACvBL,6BAAAA,4BAAAA,SAAUM,eAAe,qBAAzBN,0BAA2BO,sBAAsB;IAEnD,OAAO;QACL,GAAGN,IAAI;QACPO,QAAQL,cAAc,eAAe;Q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,IACA,CAAC,CAAC;QACR;QACA,IAAI,CAAChF,QAAQqE,GAAG,EAAE;YAChB,6CAA6C;YAC7CrE,QAAQC,GAAG,CAACoG,MAAM,GAAG;QACvB;IACF;IAEA,6FAA6F;IAC7F,wFAAwF;IACxF,IAAIP,qBAAqBD,eAAe;YAQlC7F;QAPJA,QAAQ0E,cAAc,GAAG;QACzB1E,QAAQ2E,iBAAiB,GAAG;QAC5B3E,QAAQ6E,UAAU,GAAG;QACrB7E,QAAQ8E,mBAAmB,GAAG3C;QAC9BnC,QAAQmF,mBAAmB,GAAGhD;QAC9B,6FAA6F;QAC7F,uEAAuE;QACvE,KAAInC,2CAAAA,QAAQC,GAAG,CAACW,SAAS,CAACa,SAAS,CAACE,OAAO,qBAAvC3B,yCAAyC4B,OAAO,EAAE;YACpD,OAAO5B,QAAQC,GAAG,CAACW,SAAS,CAACa,SAAS,CAACE,OAAO,CAACC,OAAO,CAACC,MAAM;QAC/D;IACF;IAEA,OAAO7B;AACT"}
1
+ {"version":3,"sources":["../../../src/build/swc/options.ts"],"sourcesContent":["import { WEBPACK_LAYERS, type WebpackLayerName } from '../../lib/constants'\nimport type {\n NextConfig,\n ExperimentalConfig,\n EmotionConfig,\n StyledComponentsConfig,\n} from '../../server/config-shared'\nimport type { ResolvedBaseUrl } from '../load-jsconfig'\nimport { isWebpackServerOnlyLayer, isWebpackAppPagesLayer } from '../utils'\n\nconst nextDistPath =\n /(next[\\\\/]dist[\\\\/]shared[\\\\/]lib)|(next[\\\\/]dist[\\\\/]client)|(next[\\\\/]dist[\\\\/]pages)/\n\nconst nodeModulesPath = /[\\\\/]node_modules[\\\\/]/\n\nconst regeneratorRuntimePath = require.resolve(\n 'next/dist/compiled/regenerator-runtime'\n)\n\nfunction isTypeScriptFile(filename: string) {\n return filename.endsWith('.ts') || filename.endsWith('.tsx')\n}\n\nfunction isCommonJSFile(filename: string) {\n return filename.endsWith('.cjs')\n}\n\n// Ensure Next.js internals and .cjs files are output as CJS modules,\n// By default all modules are output as ESM or will treated as CJS if next-swc/auto-cjs plugin detects file is CJS.\nfunction shouldOutputCommonJs(filename: string) {\n return isCommonJSFile(filename) || nextDistPath.test(filename)\n}\n\nexport function getParserOptions({ filename, jsConfig, ...rest }: any) {\n const isTSFile = filename.endsWith('.ts')\n const hasTsSyntax = isTypeScriptFile(filename)\n const enableDecorators = Boolean(\n jsConfig?.compilerOptions?.experimentalDecorators\n )\n return {\n ...rest,\n syntax: hasTsSyntax ? 'typescript' : 'ecmascript',\n dynamicImport: true,\n decorators: enableDecorators,\n // Exclude regular TypeScript files from React transformation to prevent e.g. generic parameters and angle-bracket type assertion from being interpreted as JSX tags.\n [hasTsSyntax ? 'tsx' : 'jsx']: !isTSFile,\n importAssertions: true,\n }\n}\n\nfunction getBaseSWCOptions({\n filename,\n jest,\n development,\n hasReactRefresh,\n globalWindow,\n esm,\n modularizeImports,\n swcPlugins,\n compilerOptions,\n resolvedBaseUrl,\n jsConfig,\n swcCacheDir,\n serverComponents,\n serverReferenceHashSalt,\n bundleLayer,\n isDynamicIo,\n cacheHandlers,\n}: {\n filename: string\n jest?: boolean\n development: boolean\n hasReactRefresh: boolean\n globalWindow: boolean\n esm: boolean\n modularizeImports?: NextConfig['modularizeImports']\n compilerOptions: NextConfig['compiler']\n swcPlugins: ExperimentalConfig['swcPlugins']\n resolvedBaseUrl?: ResolvedBaseUrl\n jsConfig: any\n swcCacheDir?: string\n serverComponents?: boolean\n serverReferenceHashSalt: string\n bundleLayer?: WebpackLayerName\n isDynamicIo?: boolean\n cacheHandlers?: ExperimentalConfig['cacheHandlers']\n}) {\n const isReactServerLayer = isWebpackServerOnlyLayer(bundleLayer)\n const isAppRouterPagesLayer = isWebpackAppPagesLayer(bundleLayer)\n const parserConfig = getParserOptions({ filename, jsConfig })\n const paths = jsConfig?.compilerOptions?.paths\n const enableDecorators = Boolean(\n jsConfig?.compilerOptions?.experimentalDecorators\n )\n const emitDecoratorMetadata = Boolean(\n jsConfig?.compilerOptions?.emitDecoratorMetadata\n )\n const useDefineForClassFields = Boolean(\n jsConfig?.compilerOptions?.useDefineForClassFields\n )\n const plugins = (swcPlugins ?? [])\n .filter(Array.isArray)\n .map(([name, options]: any) => [require.resolve(name), options])\n\n return {\n jsc: {\n ...(resolvedBaseUrl && paths\n ? {\n baseUrl: resolvedBaseUrl.baseUrl,\n paths,\n }\n : {}),\n externalHelpers: !process.versions.pnp && !jest,\n parser: parserConfig,\n experimental: {\n keepImportAttributes: true,\n emitAssertForImportAttributes: true,\n plugins,\n cacheRoot: swcCacheDir,\n },\n transform: {\n // Enables https://github.com/swc-project/swc/blob/0359deb4841be743d73db4536d4a22ac797d7f65/crates/swc_ecma_ext_transforms/src/jest.rs\n ...(jest\n ? {\n hidden: {\n jest: true,\n },\n }\n : {}),\n legacyDecorator: enableDecorators,\n decoratorMetadata: emitDecoratorMetadata,\n useDefineForClassFields: useDefineForClassFields,\n react: {\n importSource:\n jsConfig?.compilerOptions?.jsxImportSource ??\n (compilerOptions?.emotion && !isReactServerLayer\n ? '@emotion/react'\n : 'react'),\n runtime: 'automatic',\n pragmaFrag: 'React.Fragment',\n throwIfNamespace: true,\n development: !!development,\n useBuiltins: true,\n refresh: !!hasReactRefresh,\n },\n optimizer: {\n simplify: false,\n globals: jest\n ? null\n : {\n typeofs: {\n window: globalWindow ? 'object' : 'undefined',\n },\n envs: {\n NODE_ENV: development ? '\"development\"' : '\"production\"',\n },\n // TODO: handle process.browser to match babel replacing as well\n },\n },\n regenerator: {\n importPath: regeneratorRuntimePath,\n },\n },\n },\n sourceMaps: jest ? 'inline' : undefined,\n removeConsole: compilerOptions?.removeConsole,\n // disable \"reactRemoveProperties\" when \"jest\" is true\n // otherwise the setting from next.config.js will be used\n reactRemoveProperties: jest\n ? false\n : compilerOptions?.reactRemoveProperties,\n // Map the k-v map to an array of pairs.\n modularizeImports: modularizeImports\n ? Object.fromEntries(\n Object.entries(modularizeImports).map(([mod, config]) => [\n mod,\n {\n ...config,\n transform:\n typeof config.transform === 'string'\n ? config.transform\n : Object.entries(config.transform).map(([key, value]) => [\n key,\n value,\n ]),\n },\n ])\n )\n : undefined,\n relay: compilerOptions?.relay,\n // Always transform styled-jsx and error when `client-only` condition is triggered\n styledJsx: {},\n // Disable css-in-js libs (without client-only integration) transform on server layer for server components\n ...(!isReactServerLayer && {\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n emotion: getEmotionOptions(compilerOptions?.emotion, development),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n styledComponents: getStyledComponentsOptions(\n compilerOptions?.styledComponents,\n development\n ),\n }),\n serverComponents:\n serverComponents && !jest\n ? {\n isReactServerLayer,\n dynamicIoEnabled: isDynamicIo,\n }\n : undefined,\n serverActions:\n isAppRouterPagesLayer && !jest\n ? {\n isReactServerLayer,\n dynamicIoEnabled: isDynamicIo,\n hashSalt: serverReferenceHashSalt,\n cacheKinds: cacheHandlers ? Object.keys(cacheHandlers) : [],\n }\n : undefined,\n // For app router we prefer to bundle ESM,\n // On server side of pages router we prefer CJS.\n preferEsm: esm,\n lintCodemodComments: true,\n debugFunctionName: development,\n }\n}\n\nfunction getStyledComponentsOptions(\n styledComponentsConfig: undefined | boolean | StyledComponentsConfig,\n development: any\n) {\n if (!styledComponentsConfig) {\n return null\n } else if (typeof styledComponentsConfig === 'object') {\n return {\n ...styledComponentsConfig,\n displayName: styledComponentsConfig.displayName ?? Boolean(development),\n }\n } else {\n return {\n displayName: Boolean(development),\n }\n }\n}\n\nfunction getEmotionOptions(\n emotionConfig: undefined | boolean | EmotionConfig,\n development: boolean\n) {\n if (!emotionConfig) {\n return null\n }\n let autoLabel = !!development\n switch (typeof emotionConfig === 'object' && emotionConfig.autoLabel) {\n case 'never':\n autoLabel = false\n break\n case 'always':\n autoLabel = true\n break\n case 'dev-only':\n default:\n break\n }\n return {\n enabled: true,\n autoLabel,\n sourcemap: development,\n ...(typeof emotionConfig === 'object' && {\n importMap: emotionConfig.importMap,\n labelFormat: emotionConfig.labelFormat,\n sourcemap: development && emotionConfig.sourceMap,\n }),\n }\n}\n\nexport function getJestSWCOptions({\n isServer,\n filename,\n esm,\n modularizeImports,\n swcPlugins,\n compilerOptions,\n jsConfig,\n resolvedBaseUrl,\n pagesDir,\n serverReferenceHashSalt,\n}: {\n isServer: boolean\n filename: string\n esm: boolean\n modularizeImports?: NextConfig['modularizeImports']\n swcPlugins: ExperimentalConfig['swcPlugins']\n compilerOptions: NextConfig['compiler']\n jsConfig: any\n resolvedBaseUrl?: ResolvedBaseUrl\n pagesDir?: string\n serverComponents?: boolean\n serverReferenceHashSalt: string\n}) {\n let baseOptions = getBaseSWCOptions({\n filename,\n jest: true,\n development: false,\n hasReactRefresh: false,\n globalWindow: !isServer,\n modularizeImports,\n swcPlugins,\n compilerOptions,\n jsConfig,\n resolvedBaseUrl,\n esm,\n // Don't apply server layer transformations for Jest\n // Disable server / client graph assertions for Jest\n bundleLayer: undefined,\n serverComponents: false,\n serverReferenceHashSalt,\n })\n\n const useCjsModules = shouldOutputCommonJs(filename)\n return {\n ...baseOptions,\n env: {\n targets: {\n // Targets the current version of Node.js\n node: process.versions.node,\n },\n },\n module: {\n type: esm && !useCjsModules ? 'es6' : 'commonjs',\n },\n disableNextSsg: true,\n disablePageConfig: true,\n pagesDir,\n }\n}\n\nexport function getLoaderSWCOptions({\n // This is not passed yet as \"paths\" resolving is handled by webpack currently.\n // resolvedBaseUrl,\n filename,\n development,\n isServer,\n pagesDir,\n appDir,\n isPageFile,\n isDynamicIo,\n hasReactRefresh,\n modularizeImports,\n optimizeServerReact,\n optimizePackageImports,\n swcPlugins,\n compilerOptions,\n jsConfig,\n supportedBrowsers,\n swcCacheDir,\n relativeFilePathFromRoot,\n serverComponents,\n serverReferenceHashSalt,\n bundleLayer,\n esm,\n cacheHandlers,\n}: {\n filename: string\n development: boolean\n isServer: boolean\n pagesDir?: string\n appDir?: string\n isPageFile: boolean\n hasReactRefresh: boolean\n optimizeServerReact?: boolean\n modularizeImports: NextConfig['modularizeImports']\n isDynamicIo?: boolean\n optimizePackageImports?: NonNullable<\n NextConfig['experimental']\n >['optimizePackageImports']\n swcPlugins: ExperimentalConfig['swcPlugins']\n compilerOptions: NextConfig['compiler']\n jsConfig: any\n supportedBrowsers: string[] | undefined\n swcCacheDir: string\n relativeFilePathFromRoot: string\n esm?: boolean\n serverComponents?: boolean\n serverReferenceHashSalt: string\n bundleLayer?: WebpackLayerName\n cacheHandlers: ExperimentalConfig['cacheHandlers']\n}) {\n let baseOptions: any = getBaseSWCOptions({\n filename,\n development,\n globalWindow: !isServer,\n hasReactRefresh,\n modularizeImports,\n swcPlugins,\n compilerOptions,\n jsConfig,\n // resolvedBaseUrl,\n swcCacheDir,\n bundleLayer,\n serverComponents,\n serverReferenceHashSalt,\n esm: !!esm,\n isDynamicIo,\n cacheHandlers,\n })\n baseOptions.fontLoaders = {\n fontLoaders: ['next/font/local', 'next/font/google'],\n relativeFilePathFromRoot,\n }\n baseOptions.cjsRequireOptimizer = {\n packages: {\n 'next/server': {\n transforms: {\n NextRequest: 'next/dist/server/web/spec-extension/request',\n NextResponse: 'next/dist/server/web/spec-extension/response',\n ImageResponse: 'next/dist/server/web/spec-extension/image-response',\n userAgentFromString: 'next/dist/server/web/spec-extension/user-agent',\n userAgent: 'next/dist/server/web/spec-extension/user-agent',\n },\n },\n },\n }\n\n if (optimizeServerReact && isServer && !development) {\n baseOptions.optimizeServerReact = {\n optimize_use_state: false,\n }\n }\n\n // Modularize import optimization for barrel files\n if (optimizePackageImports) {\n baseOptions.autoModularizeImports = {\n packages: optimizePackageImports,\n }\n }\n\n const isNodeModules = nodeModulesPath.test(filename)\n const isAppBrowserLayer = bundleLayer === WEBPACK_LAYERS.appPagesBrowser\n const moduleResolutionConfig = shouldOutputCommonJs(filename)\n ? {\n module: {\n type: 'commonjs',\n },\n }\n : {}\n\n let options: any\n if (isServer) {\n options = {\n ...baseOptions,\n ...moduleResolutionConfig,\n // Disables getStaticProps/getServerSideProps tree shaking on the server compilation for pages\n disableNextSsg: true,\n disablePageConfig: true,\n isDevelopment: development,\n isServerCompiler: isServer,\n pagesDir,\n appDir,\n preferEsm: !!esm,\n isPageFile,\n env: {\n targets: {\n // Targets the current version of Node.js\n node: process.versions.node,\n },\n },\n }\n } else {\n options = {\n ...baseOptions,\n ...moduleResolutionConfig,\n disableNextSsg: !isPageFile,\n isDevelopment: development,\n isServerCompiler: isServer,\n pagesDir,\n appDir,\n isPageFile,\n ...(supportedBrowsers && supportedBrowsers.length > 0\n ? {\n env: {\n targets: supportedBrowsers,\n },\n }\n : {}),\n }\n if (!options.env) {\n // Matches default @babel/preset-env behavior\n options.jsc.target = 'es5'\n }\n }\n\n // For node_modules in app browser layer, we don't need to do any server side transformation.\n // Only keep server actions transform to discover server actions from client components.\n if (isAppBrowserLayer && isNodeModules) {\n options.disableNextSsg = true\n options.disablePageConfig = true\n options.isPageFile = false\n options.optimizeServerReact = undefined\n options.cjsRequireOptimizer = undefined\n // Disable optimizer for node_modules in app browser layer, to avoid unnecessary replacement.\n // e.g. typeof window could result differently in js worker or browser.\n if (options.jsc.transform.optimizer.globals?.typeofs) {\n delete options.jsc.transform.optimizer.globals.typeofs.window\n }\n }\n\n return options\n}\n"],"names":["getJestSWCOptions","getLoaderSWCOptions","getParserOptions","nextDistPath","nodeModulesPath","regeneratorRuntimePath","require","resolve","isTypeScriptFile","filename","endsWith","isCommonJSFile","shouldOutputCommonJs","test","jsConfig","rest","isTSFile","hasTsSyntax","enableDecorators","Boolean","compilerOptions","experimentalDecorators","syntax","dynamicImport","decorators","importAssertions","getBaseSWCOptions","jest","development","hasReactRefresh","globalWindow","esm","modularizeImports","swcPlugins","resolvedBaseUrl","swcCacheDir","serverComponents","serverReferenceHashSalt","bundleLayer","isDynamicIo","cacheHandlers","isReactServerLayer","isWebpackServerOnlyLayer","isAppRouterPagesLayer","isWebpackAppPagesLayer","parserConfig","paths","emitDecoratorMetadata","useDefineForClassFields","plugins","filter","Array","isArray","map","name","options","jsc","baseUrl","externalHelpers","process","versions","pnp","parser","experimental","keepImportAttributes","emitAssertForImportAttributes","cacheRoot","transform","hidden","legacyDecorator","decoratorMetadata","react","importSource","jsxImportSource","emotion","runtime","pragmaFrag","throwIfNamespace","useBuiltins","refresh","optimizer","simplify","globals","typeofs","window","envs","NODE_ENV","regenerator","importPath","sourceMaps","undefined","removeConsole","reactRemoveProperties","Object","fromEntries","entries","mod","config","key","value","relay","styledJsx","getEmotionOptions","styledComponents","getStyledComponentsOptions","dynamicIoEnabled","serverActions","hashSalt","cacheKinds","keys","preferEsm","lintCodemodComments","debugFunctionName","styledComponentsConfig","displayName","emotionConfig","autoLabel","enabled","sourcemap","importMap","labelFormat","sourceMap","isServer","pagesDir","baseOptions","useCjsModules","env","targets","node","module","type","disableNextSsg","disablePageConfig","appDir","isPageFile","optimizeServerReact","optimizePackageImports","supportedBrowsers","relativeFilePathFromRoot","fontLoaders","cjsRequireOptimizer","packages","transforms","NextRequest","NextResponse","ImageResponse","userAgentFromString","userAgent","optimize_use_state","autoModularizeImports","isNodeModules","isAppBrowserLayer","WEBPACK_LAYERS","appPagesBrowser","moduleResolutionConfig","isDevelopment","isServerCompiler","length","target"],"mappings":";;;;;;;;;;;;;;;;IAmRgBA,iBAAiB;eAAjBA;;IA6DAC,mBAAmB;eAAnBA;;IA/SAC,gBAAgB;eAAhBA;;;2BAjCsC;uBAQW;AAEjE,MAAMC,eACJ;AAEF,MAAMC,kBAAkB;AAExB,MAAMC,yBAAyBC,QAAQC,OAAO,CAC5C;AAGF,SAASC,iBAAiBC,QAAgB;IACxC,OAAOA,SAASC,QAAQ,CAAC,UAAUD,SAASC,QAAQ,CAAC;AACvD;AAEA,SAASC,eAAeF,QAAgB;IACtC,OAAOA,SAASC,QAAQ,CAAC;AAC3B;AAEA,qEAAqE;AACrE,mHAAmH;AACnH,SAASE,qBAAqBH,QAAgB;IAC5C,OAAOE,eAAeF,aAAaN,aAAaU,IAAI,CAACJ;AACvD;AAEO,SAASP,iBAAiB,EAAEO,QA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,WAAW,CAAC,CAAC/E;YACbuG;YACAR,KAAK;gBACHC,SAAS;oBACP,yCAAyC;oBACzCC,MAAMrE,QAAQC,QAAQ,CAACoE,IAAI;gBAC7B;YACF;QACF;IACF,OAAO;QACLzE,UAAU;YACR,GAAGqE,WAAW;YACd,GAAG8B,sBAAsB;YACzBvB,gBAAgB,CAACG;YACjBqB,eAAe/H;YACfgI,kBAAkBlC;YAClBC;YACAU;YACAC;YACA,GAAIG,qBAAqBA,kBAAkBoB,MAAM,GAAG,IAChD;gBACE/B,KAAK;oBACHC,SAASU;gBACX;YACF,IACA,CAAC,CAAC;QACR;QACA,IAAI,CAAClF,QAAQuE,GAAG,EAAE;YAChB,6CAA6C;YAC7CvE,QAAQC,GAAG,CAACsG,MAAM,GAAG;QACvB;IACF;IAEA,6FAA6F;IAC7F,wFAAwF;IACxF,IAAIP,qBAAqBD,eAAe;YAQlC/F;QAPJA,QAAQ4E,cAAc,GAAG;QACzB5E,QAAQ6E,iBAAiB,GAAG;QAC5B7E,QAAQ+E,UAAU,GAAG;QACrB/E,QAAQgF,mBAAmB,GAAG7C;QAC9BnC,QAAQqF,mBAAmB,GAAGlD;QAC9B,6FAA6F;QAC7F,uEAAuE;QACvE,KAAInC,2CAAAA,QAAQC,GAAG,CAACW,SAAS,CAACa,SAAS,CAACE,OAAO,qBAAvC3B,yCAAyC4B,OAAO,EAAE;YACpD,OAAO5B,QAAQC,GAAG,CAACW,SAAS,CAACa,SAAS,CAACE,OAAO,CAACC,OAAO,CAACC,MAAM;QAC/D;IACF;IAEA,OAAO7B;AACT"}
@@ -108,7 +108,7 @@ const maybeExclude = (excludePath, transpilePackages)=>{
108
108
  // for to force transpiling a `node_module`
109
109
  const FORCE_TRANSPILE_CONDITIONS = /(next\/font|next\/dynamic|use server|use client)/;
110
110
  async function loaderTransform(source, inputSourceMap) {
111
- var _nextConfig_experimental, _nextConfig_experimental1, _nextConfig_experimental2, _nextConfig_experimental3, _nextConfig_experimental4;
111
+ var _nextConfig_experimental, _nextConfig_experimental1, _nextConfig_experimental2, _nextConfig_experimental3, _nextConfig_experimental4, _nextConfig_experimental5;
112
112
  // Make the loader async
113
113
  const filename = this.resourcePath;
114
114
  // Ensure `.d.ts` are not processed.
@@ -155,7 +155,8 @@ async function loaderTransform(source, inputSourceMap) {
155
155
  serverComponents,
156
156
  serverReferenceHashSalt,
157
157
  bundleLayer,
158
- esm
158
+ esm,
159
+ cacheHandlers: (_nextConfig_experimental5 = nextConfig.experimental) == null ? void 0 : _nextConfig_experimental5.cacheHandlers
159
160
  });
160
161
  const programmaticOptions = {
161
162
  ...swcOptions,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/build/webpack/loaders/next-swc-loader.ts"],"sourcesContent":["/*\nCopyright (c) 2017 The swc Project Developers\n\nPermission is hereby granted, free of charge, to any\nperson obtaining a copy of this software and associated\ndocumentation files (the \"Software\"), to deal in the\nSoftware without restriction, including without\nlimitation the rights to use, copy, modify, merge,\npublish, distribute, sublicense, and/or sell copies of\nthe Software, and to permit persons to whom the Software\nis furnished to do so, subject to the following\nconditions:\n\nThe above copyright notice and this permission notice\nshall be included in all copies or substantial portions\nof the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF\nANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED\nTO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\nPARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT\nSHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\nOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR\nIN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\nDEALINGS IN THE SOFTWARE.\n*/\n\nimport type { NextConfig } from '../../../types'\nimport type { WebpackLayerName } from '../../../lib/constants'\nimport { isWasm, transform } from '../../swc'\nimport { getLoaderSWCOptions } from '../../swc/options'\nimport path, { isAbsolute } from 'path'\nimport { babelIncludeRegexes } from '../../webpack-config'\nimport { isResourceInPackages } from '../../handle-externals'\n\nconst maybeExclude = (\n excludePath: string,\n transpilePackages: string[]\n): boolean => {\n if (babelIncludeRegexes.some((r) => r.test(excludePath))) {\n return false\n }\n\n const shouldBeBundled = isResourceInPackages(excludePath, transpilePackages)\n if (shouldBeBundled) return false\n\n return excludePath.includes('node_modules')\n}\n\nexport interface SWCLoaderOptions {\n rootDir: string\n isServer: boolean\n pagesDir?: string\n appDir?: string\n hasReactRefresh: boolean\n optimizeServerReact?: boolean\n nextConfig: NextConfig\n jsConfig: any\n supportedBrowsers: string[] | undefined\n swcCacheDir: string\n serverComponents?: boolean\n serverReferenceHashSalt: string\n bundleLayer?: WebpackLayerName\n esm?: boolean\n transpilePackages?: string[]\n}\n\n// these are exact code conditions checked\n// for to force transpiling a `node_module`\nconst FORCE_TRANSPILE_CONDITIONS =\n /(next\\/font|next\\/dynamic|use server|use client)/\n\nasync function loaderTransform(\n this: any,\n source?: string,\n inputSourceMap?: any\n) {\n // Make the loader async\n const filename = this.resourcePath\n\n // Ensure `.d.ts` are not processed.\n if (filename.endsWith('.d.ts')) {\n return [source, inputSourceMap]\n }\n\n let loaderOptions: SWCLoaderOptions = this.getOptions() || {}\n const shouldMaybeExclude = maybeExclude(\n filename,\n loaderOptions.transpilePackages || []\n )\n\n if (shouldMaybeExclude) {\n if (!source) {\n throw new Error(`Invariant might be excluded but missing source`)\n }\n\n if (!FORCE_TRANSPILE_CONDITIONS.test(source)) {\n return [source, inputSourceMap]\n }\n }\n\n const {\n isServer,\n rootDir,\n pagesDir,\n appDir,\n hasReactRefresh,\n nextConfig,\n jsConfig,\n supportedBrowsers,\n swcCacheDir,\n serverComponents,\n serverReferenceHashSalt,\n bundleLayer,\n esm,\n } = loaderOptions\n const isPageFile = filename.startsWith(pagesDir)\n const relativeFilePathFromRoot = path.relative(rootDir, filename)\n\n const swcOptions = getLoaderSWCOptions({\n pagesDir,\n appDir,\n filename,\n isServer,\n isPageFile,\n development:\n this.mode === 'development' ||\n !!nextConfig.experimental?.allowDevelopmentBuild,\n isDynamicIo: nextConfig.experimental?.dynamicIO,\n hasReactRefresh,\n modularizeImports: nextConfig?.modularizeImports,\n optimizePackageImports: nextConfig?.experimental?.optimizePackageImports,\n swcPlugins: nextConfig?.experimental?.swcPlugins,\n compilerOptions: nextConfig?.compiler,\n optimizeServerReact: nextConfig?.experimental?.optimizeServerReact,\n jsConfig,\n supportedBrowsers,\n swcCacheDir,\n relativeFilePathFromRoot,\n serverComponents,\n serverReferenceHashSalt,\n bundleLayer,\n esm,\n })\n\n const programmaticOptions = {\n ...swcOptions,\n filename,\n inputSourceMap: inputSourceMap ? JSON.stringify(inputSourceMap) : undefined,\n\n // Set the default sourcemap behavior based on Webpack's mapping flag,\n sourceMaps: this.sourceMap,\n inlineSourcesContent: this.sourceMap,\n\n // Ensure that Webpack will get a full absolute path in the sourcemap\n // so that it can properly map the module back to its internal cached\n // modules.\n sourceFileName: filename,\n }\n\n if (!programmaticOptions.inputSourceMap) {\n delete programmaticOptions.inputSourceMap\n }\n\n // auto detect development mode\n if (\n this.mode &&\n programmaticOptions.jsc &&\n programmaticOptions.jsc.transform &&\n programmaticOptions.jsc.transform.react &&\n !Object.prototype.hasOwnProperty.call(\n programmaticOptions.jsc.transform.react,\n 'development'\n )\n ) {\n programmaticOptions.jsc.transform.react.development =\n this.mode === 'development'\n }\n\n return transform(source as any, programmaticOptions).then((output) => {\n if (output.eliminatedPackages && this.eliminatedPackages) {\n for (const pkg of JSON.parse(output.eliminatedPackages)) {\n this.eliminatedPackages.add(pkg)\n }\n }\n return [output.code, output.map ? JSON.parse(output.map) : undefined]\n })\n}\n\nconst EXCLUDED_PATHS =\n /[\\\\/](cache[\\\\/][^\\\\/]+\\.zip[\\\\/]node_modules|__virtual__)[\\\\/]/g\n\nexport function pitch(this: any) {\n const callback = this.async()\n let loaderOptions: SWCLoaderOptions = this.getOptions() || {}\n\n const shouldMaybeExclude = maybeExclude(\n this.resourcePath,\n loaderOptions.transpilePackages || []\n )\n\n ;(async () => {\n if (\n // if it might be excluded/no-op we can't use pitch loader\n !shouldMaybeExclude &&\n // TODO: investigate swc file reading in PnP mode?\n !process.versions.pnp &&\n !EXCLUDED_PATHS.test(this.resourcePath) &&\n this.loaders.length - 1 === this.loaderIndex &&\n isAbsolute(this.resourcePath) &&\n !(await isWasm())\n ) {\n this.addDependency(this.resourcePath)\n return loaderTransform.call(this)\n }\n })().then((r) => {\n if (r) return callback(null, ...r)\n callback()\n }, callback)\n}\n\nexport default function swcLoader(\n this: any,\n inputSource: string,\n inputSourceMap: any\n) {\n const callback = this.async()\n loaderTransform.call(this, inputSource, inputSourceMap).then(\n ([transformedSource, outputSourceMap]: any) => {\n callback(null, transformedSource, outputSourceMap || inputSourceMap)\n },\n (err: Error) => {\n callback(err)\n }\n )\n}\n\n// accept Buffers instead of strings\nexport const raw = true\n"],"names":["swcLoader","pitch","raw","maybeExclude","excludePath","transpilePackages","babelIncludeRegexes","some","r","test","shouldBeBundled","isResourceInPackages","includes","FORCE_TRANSPILE_CONDITIONS","loaderTransform","source","inputSourceMap","nextConfig","filename","resourcePath","endsWith","loaderOptions","getOptions","shouldMaybeExclude","Error","isServer","rootDir","pagesDir","appDir","hasReactRefresh","jsConfig","supportedBrowsers","swcCacheDir","serverComponents","serverReferenceHashSalt","bundleLayer","esm","isPageFile","startsWith","relativeFilePathFromRoot","path","relative","swcOptions","getLoaderSWCOptions","development","mode","experimental","allowDevelopmentBuild","isDynamicIo","dynamicIO","modularizeImports","optimizePackageImports","swcPlugins","compilerOptions","compiler","optimizeServerReact","programmaticOptions","JSON","stringify","undefined","sourceMaps","sourceMap","inlineSourcesContent","sourceFileName","jsc","transform","react","Object","prototype","hasOwnProperty","call","then","output","eliminatedPackages","pkg","parse","add","code","map","EXCLUDED_PATHS","callback","async","process","versions","pnp","loaders","length","loaderIndex","isAbsolute","isWasm","addDependency","inputSource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D,IAAI,CAAC,IAAI;QAClC;IACF,CAAA,IAAKC,IAAI,CAAC,CAAC/D;QACT,IAAIA,GAAG,OAAOwE,SAAS,SAASxE;QAChCwE;IACF,GAAGA;AACL;AAEe,SAAShF,UAEtB2F,WAAmB,EACnB3E,cAAmB;IAEnB,MAAMgE,WAAW,IAAI,CAACC,KAAK;IAC3BnE,gBAAgBwD,IAAI,CAAC,IAAI,EAAEqB,aAAa3E,gBAAgBuD,IAAI,CAC1D,CAAC,CAACqB,mBAAmBC,gBAAqB;QACxCb,SAAS,MAAMY,mBAAmBC,mBAAmB7E;IACvD,GACA,CAAC8E;QACCd,SAASc;IACX;AAEJ;AAGO,MAAM5F,MAAM"}
1
+ {"version":3,"sources":["../../../../src/build/webpack/loaders/next-swc-loader.ts"],"sourcesContent":["/*\nCopyright (c) 2017 The swc Project Developers\n\nPermission is hereby granted, free of charge, to any\nperson obtaining a copy of this software and associated\ndocumentation files (the \"Software\"), to deal in the\nSoftware without restriction, including without\nlimitation the rights to use, copy, modify, merge,\npublish, distribute, sublicense, and/or sell copies of\nthe Software, and to permit persons to whom the Software\nis furnished to do so, subject to the following\nconditions:\n\nThe above copyright notice and this permission notice\nshall be included in all copies or substantial portions\nof the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF\nANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED\nTO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\nPARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT\nSHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\nOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR\nIN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\nDEALINGS IN THE SOFTWARE.\n*/\n\nimport type { NextConfig } from '../../../types'\nimport type { WebpackLayerName } from '../../../lib/constants'\nimport { isWasm, transform } from '../../swc'\nimport { getLoaderSWCOptions } from '../../swc/options'\nimport path, { isAbsolute } from 'path'\nimport { babelIncludeRegexes } from '../../webpack-config'\nimport { isResourceInPackages } from '../../handle-externals'\n\nconst maybeExclude = (\n excludePath: string,\n transpilePackages: string[]\n): boolean => {\n if (babelIncludeRegexes.some((r) => r.test(excludePath))) {\n return false\n }\n\n const shouldBeBundled = isResourceInPackages(excludePath, transpilePackages)\n if (shouldBeBundled) return false\n\n return excludePath.includes('node_modules')\n}\n\nexport interface SWCLoaderOptions {\n rootDir: string\n isServer: boolean\n pagesDir?: string\n appDir?: string\n hasReactRefresh: boolean\n optimizeServerReact?: boolean\n nextConfig: NextConfig\n jsConfig: any\n supportedBrowsers: string[] | undefined\n swcCacheDir: string\n serverComponents?: boolean\n serverReferenceHashSalt: string\n bundleLayer?: WebpackLayerName\n esm?: boolean\n transpilePackages?: string[]\n}\n\n// these are exact code conditions checked\n// for to force transpiling a `node_module`\nconst FORCE_TRANSPILE_CONDITIONS =\n /(next\\/font|next\\/dynamic|use server|use client)/\n\nasync function loaderTransform(\n this: any,\n source?: string,\n inputSourceMap?: any\n) {\n // Make the loader async\n const filename = this.resourcePath\n\n // Ensure `.d.ts` are not processed.\n if (filename.endsWith('.d.ts')) {\n return [source, inputSourceMap]\n }\n\n let loaderOptions: SWCLoaderOptions = this.getOptions() || {}\n const shouldMaybeExclude = maybeExclude(\n filename,\n loaderOptions.transpilePackages || []\n )\n\n if (shouldMaybeExclude) {\n if (!source) {\n throw new Error(`Invariant might be excluded but missing source`)\n }\n\n if (!FORCE_TRANSPILE_CONDITIONS.test(source)) {\n return [source, inputSourceMap]\n }\n }\n\n const {\n isServer,\n rootDir,\n pagesDir,\n appDir,\n hasReactRefresh,\n nextConfig,\n jsConfig,\n supportedBrowsers,\n swcCacheDir,\n serverComponents,\n serverReferenceHashSalt,\n bundleLayer,\n esm,\n } = loaderOptions\n const isPageFile = filename.startsWith(pagesDir)\n const relativeFilePathFromRoot = path.relative(rootDir, filename)\n\n const swcOptions = getLoaderSWCOptions({\n pagesDir,\n appDir,\n filename,\n isServer,\n isPageFile,\n development:\n this.mode === 'development' ||\n !!nextConfig.experimental?.allowDevelopmentBuild,\n isDynamicIo: nextConfig.experimental?.dynamicIO,\n hasReactRefresh,\n modularizeImports: nextConfig?.modularizeImports,\n optimizePackageImports: nextConfig?.experimental?.optimizePackageImports,\n swcPlugins: nextConfig?.experimental?.swcPlugins,\n compilerOptions: nextConfig?.compiler,\n optimizeServerReact: nextConfig?.experimental?.optimizeServerReact,\n jsConfig,\n supportedBrowsers,\n swcCacheDir,\n relativeFilePathFromRoot,\n serverComponents,\n serverReferenceHashSalt,\n bundleLayer,\n esm,\n cacheHandlers: nextConfig.experimental?.cacheHandlers,\n })\n\n const programmaticOptions = {\n ...swcOptions,\n filename,\n inputSourceMap: inputSourceMap ? JSON.stringify(inputSourceMap) : undefined,\n\n // Set the default sourcemap behavior based on Webpack's mapping flag,\n sourceMaps: this.sourceMap,\n inlineSourcesContent: this.sourceMap,\n\n // Ensure that Webpack will get a full absolute path in the sourcemap\n // so that it can properly map the module back to its internal cached\n // modules.\n sourceFileName: filename,\n }\n\n if (!programmaticOptions.inputSourceMap) {\n delete programmaticOptions.inputSourceMap\n }\n\n // auto detect development mode\n if (\n this.mode &&\n programmaticOptions.jsc &&\n programmaticOptions.jsc.transform &&\n programmaticOptions.jsc.transform.react &&\n !Object.prototype.hasOwnProperty.call(\n programmaticOptions.jsc.transform.react,\n 'development'\n )\n ) {\n programmaticOptions.jsc.transform.react.development =\n this.mode === 'development'\n }\n\n return transform(source as any, programmaticOptions).then((output) => {\n if (output.eliminatedPackages && this.eliminatedPackages) {\n for (const pkg of JSON.parse(output.eliminatedPackages)) {\n this.eliminatedPackages.add(pkg)\n }\n }\n return [output.code, output.map ? JSON.parse(output.map) : undefined]\n })\n}\n\nconst EXCLUDED_PATHS =\n /[\\\\/](cache[\\\\/][^\\\\/]+\\.zip[\\\\/]node_modules|__virtual__)[\\\\/]/g\n\nexport function pitch(this: any) {\n const callback = this.async()\n let loaderOptions: SWCLoaderOptions = this.getOptions() || {}\n\n const shouldMaybeExclude = maybeExclude(\n this.resourcePath,\n loaderOptions.transpilePackages || []\n )\n\n ;(async () => {\n if (\n // if it might be excluded/no-op we can't use pitch loader\n !shouldMaybeExclude &&\n // TODO: investigate swc file reading in PnP mode?\n !process.versions.pnp &&\n !EXCLUDED_PATHS.test(this.resourcePath) &&\n this.loaders.length - 1 === this.loaderIndex &&\n isAbsolute(this.resourcePath) &&\n !(await isWasm())\n ) {\n this.addDependency(this.resourcePath)\n return loaderTransform.call(this)\n }\n })().then((r) => {\n if (r) return callback(null, ...r)\n callback()\n }, callback)\n}\n\nexport default function swcLoader(\n this: any,\n inputSource: string,\n inputSourceMap: any\n) {\n const callback = this.async()\n loaderTransform.call(this, inputSource, inputSourceMap).then(\n ([transformedSource, outputSourceMap]: any) => {\n callback(null, transformedSource, outputSourceMap || inputSourceMap)\n },\n (err: Error) => {\n callback(err)\n }\n )\n}\n\n// accept Buffers instead of strings\nexport const raw = true\n"],"names":["swcLoader","pitch","raw","maybeExclude","excludePath","transpilePackages","babelIncludeRegexes","some","r","test","shouldBeBundled","isResourceInPackages","includes","FORCE_TRANSPILE_CONDITIONS","loaderTransform","source","inputSourceMap","nextConfig","filename","resourcePath","endsWith","loaderOptions","getOptions","shouldMaybeExclude","Error","isServer","rootDir","pagesDir","appDir","hasReactRefresh","jsConfig","supportedBrowsers","swcCacheDir","serverComponents","serverReferenceHashSalt","bundleLayer","esm","isPageFile","startsWith","relativeFilePathFromRoot","path","relative","swcOptions","getLoaderSWCOptions","development","mode","experimental","allowDevelopmentBuild","isDynamicIo","dynamicIO","modularizeImports","optimizePackageImports","swcPlugins","compilerOptions","compiler","optimizeServerReact","cacheHandlers","programmaticOptions","JSON","stringify","undefined","sourceMaps","sourceMap","inlineSourcesContent","sourceFileName","jsc","transform","react","Object","prototype","hasOwnProperty","call","then","output","eliminatedPackages","pkg","parse","add","code","map","EXCLUDED_PATHS","callback","async","process","versions","pnp","loaders","length","loaderIndex","isAbsolute","isWasm","addDependency","inputSource","transformedSource","outputSourceMap","err"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA;;;;;;;;;;;;;;;;IAqMA,OAcC;eAduBA;;IA7BRC,KAAK;eAALA;;IA8CHC,GAAG;eAAHA;;;qBAlNqB;yBACE;8DACH;+BACG;iCACC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAErC,MAAMC,eAAe,CACnBC,aACAC;IAEA,IAAIC,kCAAmB,CAACC,IAAI,CAAC,CAACC,IAAMA,EAAEC,IAAI,CAACL,eAAe;QACxD,OAAO;IACT;IAEA,MAAMM,kBAAkBC,IAAAA,qCAAoB,EAACP,aAAaC;IAC1D,IAAIK,iBAAiB,OAAO;IAE5B,OAAON,YAAYQ,QAAQ,CAAC;AAC9B;AAoBA,0CAA0C;AAC1C,2CAA2C;AAC3C,MAAMC,6BACJ;AAEF,eAAeC,gBAEbC,MAAe,EACfC,cAAoB;QAoDdC,0BACSA,2BAGWA,2BACZA,2BAESA,2BASNA;IAlEjB,wBAAwB;IACxB,MAAMC,WAAW,IAAI,CAACC,YAAY;IAElC,oCAAoC;IACpC,IAAID,SAASE,QAAQ,CAAC,UAAU;QAC9B,OAAO;YAACL;YAAQC;SAAe;IACjC;IAEA,IAAIK,gBAAkC,IAAI,CAACC,UAAU,MAAM,CAAC;IAC5D,MAAMC,qBAAqBpB,aACzBe,UACAG,cAAchB,iBAAiB,IAAI,EAAE;IAGvC,IAAIkB,oBAAoB;QACtB,IAAI,CAACR,QAAQ;YACX,MAAM,IAAIS,MAAM,CAAC,8CAA8C,CAAC;QAClE;QAEA,IAAI,CAACX,2BAA2BJ,IAAI,CAACM,SAAS;YAC5C,OAAO;gBAACA;gBAAQC;aAAe;QACjC;IACF;IAEA,MAAM,EACJS,QAAQ,EACRC,OAAO,EACPC,QAAQ,EACRC,MAAM,E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WAAW,IAC5CC,IAAAA,gBAAU,EAAC,IAAI,CAACtE,YAAY,KAC5B,CAAE,MAAMuE,IAAAA,WAAM,KACd;YACA,IAAI,CAACC,aAAa,CAAC,IAAI,CAACxE,YAAY;YACpC,OAAOL,gBAAgByD,IAAI,CAAC,IAAI;QAClC;IACF,CAAA,IAAKC,IAAI,CAAC,CAAChE;QACT,IAAIA,GAAG,OAAOyE,SAAS,SAASzE;QAChCyE;IACF,GAAGA;AACL;AAEe,SAASjF,UAEtB4F,WAAmB,EACnB5E,cAAmB;IAEnB,MAAMiE,WAAW,IAAI,CAACC,KAAK;IAC3BpE,gBAAgByD,IAAI,CAAC,IAAI,EAAEqB,aAAa5E,gBAAgBwD,IAAI,CAC1D,CAAC,CAACqB,mBAAmBC,gBAAqB;QACxCb,SAAS,MAAMY,mBAAmBC,mBAAmB9E;IACvD,GACA,CAAC+E;QACCd,SAASc;IACX;AAEJ;AAGO,MAAM7F,MAAM"}
@@ -1508,7 +1508,7 @@ async function getBaseWebpackConfig(dir, { buildId, encryptionKey, config, compi
1508
1508
  isClient && new _copyfileplugin.CopyFilePlugin({
1509
1509
  // file path to build output of `@next/polyfill-nomodule`
1510
1510
  filePath: require.resolve('./polyfills/polyfill-nomodule'),
1511
- cacheKey: "15.0.4-canary.13",
1511
+ cacheKey: "15.0.4-canary.15",
1512
1512
  name: `static/chunks/polyfills${dev ? '' : '-[hash]'}.js`,
1513
1513
  minimize: false,
1514
1514
  info: {
@@ -1736,7 +1736,7 @@ async function getBaseWebpackConfig(dir, { buildId, encryptionKey, config, compi
1736
1736
  // - Next.js location on disk (some loaders use absolute paths and some resolve options depend on absolute paths)
1737
1737
  // - Next.js version
1738
1738
  // - next.config.js keys that affect compilation
1739
- version: `${__dirname}|${"15.0.4-canary.13"}|${configVars}`,
1739
+ version: `${__dirname}|${"15.0.4-canary.15"}|${configVars}`,
1740
1740
  cacheDirectory: _path.default.join(distDir, 'cache', 'webpack'),
1741
1741
  // For production builds, it's more efficient to compress all cache files together instead of compression each one individually.
1742
1742
  // So we disable compression here and allow the build runner to take care of compressing the cache as a whole.
@@ -13,7 +13,7 @@ Object.defineProperty(exports, "appBootstrap", {
13
13
  return appBootstrap;
14
14
  }
15
15
  });
16
- const version = "15.0.4-canary.13";
16
+ const version = "15.0.4-canary.15";
17
17
  window.next = {
18
18
  version,
19
19
  appDir: true
@@ -61,7 +61,7 @@ const _hooksclientcontextsharedruntime = require("../shared/lib/hooks-client-con
61
61
  const _shared = require("./react-client-callbacks/shared");
62
62
  const _tracer = /*#__PURE__*/ _interop_require_default._(require("./tracing/tracer"));
63
63
  const _reporttosocket = /*#__PURE__*/ _interop_require_default._(require("./tracing/report-to-socket"));
64
- const version = "15.0.4-canary.13";
64
+ const version = "15.0.4-canary.15";
65
65
  let router;
66
66
  const emitter = (0, _mitt.default)();
67
67
  const looseToArray = (input)=>[].slice.call(input);
@@ -283,7 +283,7 @@ export default async function build(dir, reactProductionProfiling = false, debug
283
283
  const nextBuildSpan = trace('next-build', undefined, {
284
284
  buildMode: experimentalBuildMode,
285
285
  isTurboBuild: String(turboNextBuild),
286
- version: "15.0.4-canary.13"
286
+ version: "15.0.4-canary.15"
287
287
  });
288
288
  NextBuildContext.nextBuildSpan = nextBuildSpan;
289
289
  NextBuildContext.dir = dir;
@@ -684,7 +684,7 @@ export default async function build(dir, reactProductionProfiling = false, debug
684
684
  // Files outside of the distDir can be "type": "module"
685
685
  await writeFileUtf8(path.join(distDir, 'package.json'), '{"type": "commonjs"}');
686
686
  // These are written to distDir, so they need to come after creating and cleaning distDr.
687
- await recordFrameworkVersion("15.0.4-canary.13");
687
+ await recordFrameworkVersion("15.0.4-canary.15");
688
688
  await updateBuildDiagnostics({
689
689
  buildStage: 'start'
690
690
  });
@@ -11,7 +11,7 @@ import { isDeepStrictEqual } from 'util';
11
11
  import { getDefineEnv } from '../webpack/plugins/define-env-plugin';
12
12
  import { getReactCompilerLoader } from '../get-babel-loader-config';
13
13
  import { TurbopackInternalError } from '../../server/dev/turbopack-utils';
14
- const nextVersion = "15.0.4-canary.13";
14
+ const nextVersion = "15.0.4-canary.15";
15
15
  const ArchName = arch();
16
16
  const PlatformName = platform();
17
17
  function infoLog(...args) {
@@ -29,7 +29,7 @@ export function getParserOptions({ filename, jsConfig, ...rest }) {
29
29
  importAssertions: true
30
30
  };
31
31
  }
32
- function getBaseSWCOptions({ filename, jest, development, hasReactRefresh, globalWindow, esm, modularizeImports, swcPlugins, compilerOptions, resolvedBaseUrl, jsConfig, swcCacheDir, serverComponents, serverReferenceHashSalt, bundleLayer, isDynamicIo }) {
32
+ function getBaseSWCOptions({ filename, jest, development, hasReactRefresh, globalWindow, esm, modularizeImports, swcPlugins, compilerOptions, resolvedBaseUrl, jsConfig, swcCacheDir, serverComponents, serverReferenceHashSalt, bundleLayer, isDynamicIo, cacheHandlers }) {
33
33
  var _jsConfig_compilerOptions, _jsConfig_compilerOptions1, _jsConfig_compilerOptions2, _jsConfig_compilerOptions3, _jsConfig_compilerOptions4;
34
34
  const isReactServerLayer = isWebpackServerOnlyLayer(bundleLayer);
35
35
  const isAppRouterPagesLayer = isWebpackAppPagesLayer(bundleLayer);
@@ -127,7 +127,8 @@ function getBaseSWCOptions({ filename, jest, development, hasReactRefresh, globa
127
127
  serverActions: isAppRouterPagesLayer && !jest ? {
128
128
  isReactServerLayer,
129
129
  dynamicIoEnabled: isDynamicIo,
130
- hashSalt: serverReferenceHashSalt
130
+ hashSalt: serverReferenceHashSalt,
131
+ cacheKinds: cacheHandlers ? Object.keys(cacheHandlers) : []
131
132
  } : undefined,
132
133
  // For app router we prefer to bundle ESM,
133
134
  // On server side of pages router we prefer CJS.
@@ -215,7 +216,7 @@ export function getJestSWCOptions({ isServer, filename, esm, modularizeImports,
215
216
  }
216
217
  export function getLoaderSWCOptions({ // This is not passed yet as "paths" resolving is handled by webpack currently.
217
218
  // resolvedBaseUrl,
218
- filename, development, isServer, pagesDir, appDir, isPageFile, isDynamicIo, hasReactRefresh, modularizeImports, optimizeServerReact, optimizePackageImports, swcPlugins, compilerOptions, jsConfig, supportedBrowsers, swcCacheDir, relativeFilePathFromRoot, serverComponents, serverReferenceHashSalt, bundleLayer, esm }) {
219
+ filename, development, isServer, pagesDir, appDir, isPageFile, isDynamicIo, hasReactRefresh, modularizeImports, optimizeServerReact, optimizePackageImports, swcPlugins, compilerOptions, jsConfig, supportedBrowsers, swcCacheDir, relativeFilePathFromRoot, serverComponents, serverReferenceHashSalt, bundleLayer, esm, cacheHandlers }) {
219
220
  let baseOptions = getBaseSWCOptions({
220
221
  filename,
221
222
  development,
@@ -231,7 +232,8 @@ filename, development, isServer, pagesDir, appDir, isPageFile, isDynamicIo, hasR
231
232
  serverComponents,
232
233
  serverReferenceHashSalt,
233
234
  esm: !!esm,
234
- isDynamicIo
235
+ isDynamicIo,
236
+ cacheHandlers
235
237
  });
236
238
  baseOptions.fontLoaders = {
237
239
  fontLoaders: [
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/build/swc/options.ts"],"sourcesContent":["import { WEBPACK_LAYERS, type WebpackLayerName } from '../../lib/constants'\nimport type {\n NextConfig,\n ExperimentalConfig,\n EmotionConfig,\n StyledComponentsConfig,\n} from '../../server/config-shared'\nimport type { ResolvedBaseUrl } from '../load-jsconfig'\nimport { isWebpackServerOnlyLayer, isWebpackAppPagesLayer } from '../utils'\n\nconst nextDistPath =\n /(next[\\\\/]dist[\\\\/]shared[\\\\/]lib)|(next[\\\\/]dist[\\\\/]client)|(next[\\\\/]dist[\\\\/]pages)/\n\nconst nodeModulesPath = /[\\\\/]node_modules[\\\\/]/\n\nconst regeneratorRuntimePath = require.resolve(\n 'next/dist/compiled/regenerator-runtime'\n)\n\nfunction isTypeScriptFile(filename: string) {\n return filename.endsWith('.ts') || filename.endsWith('.tsx')\n}\n\nfunction isCommonJSFile(filename: string) {\n return filename.endsWith('.cjs')\n}\n\n// Ensure Next.js internals and .cjs files are output as CJS modules,\n// By default all modules are output as ESM or will treated as CJS if next-swc/auto-cjs plugin detects file is CJS.\nfunction shouldOutputCommonJs(filename: string) {\n return isCommonJSFile(filename) || nextDistPath.test(filename)\n}\n\nexport function getParserOptions({ filename, jsConfig, ...rest }: any) {\n const isTSFile = filename.endsWith('.ts')\n const hasTsSyntax = isTypeScriptFile(filename)\n const enableDecorators = Boolean(\n jsConfig?.compilerOptions?.experimentalDecorators\n )\n return {\n ...rest,\n syntax: hasTsSyntax ? 'typescript' : 'ecmascript',\n dynamicImport: true,\n decorators: enableDecorators,\n // Exclude regular TypeScript files from React transformation to prevent e.g. generic parameters and angle-bracket type assertion from being interpreted as JSX tags.\n [hasTsSyntax ? 'tsx' : 'jsx']: !isTSFile,\n importAssertions: true,\n }\n}\n\nfunction getBaseSWCOptions({\n filename,\n jest,\n development,\n hasReactRefresh,\n globalWindow,\n esm,\n modularizeImports,\n swcPlugins,\n compilerOptions,\n resolvedBaseUrl,\n jsConfig,\n swcCacheDir,\n serverComponents,\n serverReferenceHashSalt,\n bundleLayer,\n isDynamicIo,\n}: {\n filename: string\n jest?: boolean\n development: boolean\n hasReactRefresh: boolean\n globalWindow: boolean\n esm: boolean\n modularizeImports?: NextConfig['modularizeImports']\n compilerOptions: NextConfig['compiler']\n swcPlugins: ExperimentalConfig['swcPlugins']\n resolvedBaseUrl?: ResolvedBaseUrl\n jsConfig: any\n swcCacheDir?: string\n serverComponents?: boolean\n serverReferenceHashSalt: string\n bundleLayer?: WebpackLayerName\n isDynamicIo?: boolean\n}) {\n const isReactServerLayer = isWebpackServerOnlyLayer(bundleLayer)\n const isAppRouterPagesLayer = isWebpackAppPagesLayer(bundleLayer)\n const parserConfig = getParserOptions({ filename, jsConfig })\n const paths = jsConfig?.compilerOptions?.paths\n const enableDecorators = Boolean(\n jsConfig?.compilerOptions?.experimentalDecorators\n )\n const emitDecoratorMetadata = Boolean(\n jsConfig?.compilerOptions?.emitDecoratorMetadata\n )\n const useDefineForClassFields = Boolean(\n jsConfig?.compilerOptions?.useDefineForClassFields\n )\n const plugins = (swcPlugins ?? [])\n .filter(Array.isArray)\n .map(([name, options]: any) => [require.resolve(name), options])\n\n return {\n jsc: {\n ...(resolvedBaseUrl && paths\n ? {\n baseUrl: resolvedBaseUrl.baseUrl,\n paths,\n }\n : {}),\n externalHelpers: !process.versions.pnp && !jest,\n parser: parserConfig,\n experimental: {\n keepImportAttributes: true,\n emitAssertForImportAttributes: true,\n plugins,\n cacheRoot: swcCacheDir,\n },\n transform: {\n // Enables https://github.com/swc-project/swc/blob/0359deb4841be743d73db4536d4a22ac797d7f65/crates/swc_ecma_ext_transforms/src/jest.rs\n ...(jest\n ? {\n hidden: {\n jest: true,\n },\n }\n : {}),\n legacyDecorator: enableDecorators,\n decoratorMetadata: emitDecoratorMetadata,\n useDefineForClassFields: useDefineForClassFields,\n react: {\n importSource:\n jsConfig?.compilerOptions?.jsxImportSource ??\n (compilerOptions?.emotion && !isReactServerLayer\n ? '@emotion/react'\n : 'react'),\n runtime: 'automatic',\n pragmaFrag: 'React.Fragment',\n throwIfNamespace: true,\n development: !!development,\n useBuiltins: true,\n refresh: !!hasReactRefresh,\n },\n optimizer: {\n simplify: false,\n globals: jest\n ? null\n : {\n typeofs: {\n window: globalWindow ? 'object' : 'undefined',\n },\n envs: {\n NODE_ENV: development ? '\"development\"' : '\"production\"',\n },\n // TODO: handle process.browser to match babel replacing as well\n },\n },\n regenerator: {\n importPath: regeneratorRuntimePath,\n },\n },\n },\n sourceMaps: jest ? 'inline' : undefined,\n removeConsole: compilerOptions?.removeConsole,\n // disable \"reactRemoveProperties\" when \"jest\" is true\n // otherwise the setting from next.config.js will be used\n reactRemoveProperties: jest\n ? false\n : compilerOptions?.reactRemoveProperties,\n // Map the k-v map to an array of pairs.\n modularizeImports: modularizeImports\n ? Object.fromEntries(\n Object.entries(modularizeImports).map(([mod, config]) => [\n mod,\n {\n ...config,\n transform:\n typeof config.transform === 'string'\n ? config.transform\n : Object.entries(config.transform).map(([key, value]) => [\n key,\n value,\n ]),\n },\n ])\n )\n : undefined,\n relay: compilerOptions?.relay,\n // Always transform styled-jsx and error when `client-only` condition is triggered\n styledJsx: {},\n // Disable css-in-js libs (without client-only integration) transform on server layer for server components\n ...(!isReactServerLayer && {\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n emotion: getEmotionOptions(compilerOptions?.emotion, development),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n styledComponents: getStyledComponentsOptions(\n compilerOptions?.styledComponents,\n development\n ),\n }),\n serverComponents:\n serverComponents && !jest\n ? {\n isReactServerLayer,\n dynamicIoEnabled: isDynamicIo,\n }\n : undefined,\n serverActions:\n isAppRouterPagesLayer && !jest\n ? {\n isReactServerLayer,\n dynamicIoEnabled: isDynamicIo,\n hashSalt: serverReferenceHashSalt,\n }\n : undefined,\n // For app router we prefer to bundle ESM,\n // On server side of pages router we prefer CJS.\n preferEsm: esm,\n lintCodemodComments: true,\n debugFunctionName: development,\n }\n}\n\nfunction getStyledComponentsOptions(\n styledComponentsConfig: undefined | boolean | StyledComponentsConfig,\n development: any\n) {\n if (!styledComponentsConfig) {\n return null\n } else if (typeof styledComponentsConfig === 'object') {\n return {\n ...styledComponentsConfig,\n displayName: styledComponentsConfig.displayName ?? Boolean(development),\n }\n } else {\n return {\n displayName: Boolean(development),\n }\n }\n}\n\nfunction getEmotionOptions(\n emotionConfig: undefined | boolean | EmotionConfig,\n development: boolean\n) {\n if (!emotionConfig) {\n return null\n }\n let autoLabel = !!development\n switch (typeof emotionConfig === 'object' && emotionConfig.autoLabel) {\n case 'never':\n autoLabel = false\n break\n case 'always':\n autoLabel = true\n break\n case 'dev-only':\n default:\n break\n }\n return {\n enabled: true,\n autoLabel,\n sourcemap: development,\n ...(typeof emotionConfig === 'object' && {\n importMap: emotionConfig.importMap,\n labelFormat: emotionConfig.labelFormat,\n sourcemap: development && emotionConfig.sourceMap,\n }),\n }\n}\n\nexport function getJestSWCOptions({\n isServer,\n filename,\n esm,\n modularizeImports,\n swcPlugins,\n compilerOptions,\n jsConfig,\n resolvedBaseUrl,\n pagesDir,\n serverReferenceHashSalt,\n}: {\n isServer: boolean\n filename: string\n esm: boolean\n modularizeImports?: NextConfig['modularizeImports']\n swcPlugins: ExperimentalConfig['swcPlugins']\n compilerOptions: NextConfig['compiler']\n jsConfig: any\n resolvedBaseUrl?: ResolvedBaseUrl\n pagesDir?: string\n serverComponents?: boolean\n serverReferenceHashSalt: string\n}) {\n let baseOptions = getBaseSWCOptions({\n filename,\n jest: true,\n development: false,\n hasReactRefresh: false,\n globalWindow: !isServer,\n modularizeImports,\n swcPlugins,\n compilerOptions,\n jsConfig,\n resolvedBaseUrl,\n esm,\n // Don't apply server layer transformations for Jest\n // Disable server / client graph assertions for Jest\n bundleLayer: undefined,\n serverComponents: false,\n serverReferenceHashSalt,\n })\n\n const useCjsModules = shouldOutputCommonJs(filename)\n return {\n ...baseOptions,\n env: {\n targets: {\n // Targets the current version of Node.js\n node: process.versions.node,\n },\n },\n module: {\n type: esm && !useCjsModules ? 'es6' : 'commonjs',\n },\n disableNextSsg: true,\n disablePageConfig: true,\n pagesDir,\n }\n}\n\nexport function getLoaderSWCOptions({\n // This is not passed yet as \"paths\" resolving is handled by webpack currently.\n // resolvedBaseUrl,\n filename,\n development,\n isServer,\n pagesDir,\n appDir,\n isPageFile,\n isDynamicIo,\n hasReactRefresh,\n modularizeImports,\n optimizeServerReact,\n optimizePackageImports,\n swcPlugins,\n compilerOptions,\n jsConfig,\n supportedBrowsers,\n swcCacheDir,\n relativeFilePathFromRoot,\n serverComponents,\n serverReferenceHashSalt,\n bundleLayer,\n esm,\n}: {\n filename: string\n development: boolean\n isServer: boolean\n pagesDir?: string\n appDir?: string\n isPageFile: boolean\n hasReactRefresh: boolean\n optimizeServerReact?: boolean\n modularizeImports: NextConfig['modularizeImports']\n isDynamicIo?: boolean\n optimizePackageImports?: NonNullable<\n NextConfig['experimental']\n >['optimizePackageImports']\n swcPlugins: ExperimentalConfig['swcPlugins']\n compilerOptions: NextConfig['compiler']\n jsConfig: any\n supportedBrowsers: string[] | undefined\n swcCacheDir: string\n relativeFilePathFromRoot: string\n esm?: boolean\n serverComponents?: boolean\n serverReferenceHashSalt: string\n bundleLayer?: WebpackLayerName\n}) {\n let baseOptions: any = getBaseSWCOptions({\n filename,\n development,\n globalWindow: !isServer,\n hasReactRefresh,\n modularizeImports,\n swcPlugins,\n compilerOptions,\n jsConfig,\n // resolvedBaseUrl,\n swcCacheDir,\n bundleLayer,\n serverComponents,\n serverReferenceHashSalt,\n esm: !!esm,\n isDynamicIo,\n })\n baseOptions.fontLoaders = {\n fontLoaders: ['next/font/local', 'next/font/google'],\n relativeFilePathFromRoot,\n }\n baseOptions.cjsRequireOptimizer = {\n packages: {\n 'next/server': {\n transforms: {\n NextRequest: 'next/dist/server/web/spec-extension/request',\n NextResponse: 'next/dist/server/web/spec-extension/response',\n ImageResponse: 'next/dist/server/web/spec-extension/image-response',\n userAgentFromString: 'next/dist/server/web/spec-extension/user-agent',\n userAgent: 'next/dist/server/web/spec-extension/user-agent',\n },\n },\n },\n }\n\n if (optimizeServerReact && isServer && !development) {\n baseOptions.optimizeServerReact = {\n optimize_use_state: false,\n }\n }\n\n // Modularize import optimization for barrel files\n if (optimizePackageImports) {\n baseOptions.autoModularizeImports = {\n packages: optimizePackageImports,\n }\n }\n\n const isNodeModules = nodeModulesPath.test(filename)\n const isAppBrowserLayer = bundleLayer === WEBPACK_LAYERS.appPagesBrowser\n const moduleResolutionConfig = shouldOutputCommonJs(filename)\n ? {\n module: {\n type: 'commonjs',\n },\n }\n : {}\n\n let options: any\n if (isServer) {\n options = {\n ...baseOptions,\n ...moduleResolutionConfig,\n // Disables getStaticProps/getServerSideProps tree shaking on the server compilation for pages\n disableNextSsg: true,\n disablePageConfig: true,\n isDevelopment: development,\n isServerCompiler: isServer,\n pagesDir,\n appDir,\n preferEsm: !!esm,\n isPageFile,\n env: {\n targets: {\n // Targets the current version of Node.js\n node: process.versions.node,\n },\n },\n }\n } else {\n options = {\n ...baseOptions,\n ...moduleResolutionConfig,\n disableNextSsg: !isPageFile,\n isDevelopment: development,\n isServerCompiler: isServer,\n pagesDir,\n appDir,\n isPageFile,\n ...(supportedBrowsers && supportedBrowsers.length > 0\n ? {\n env: {\n targets: supportedBrowsers,\n },\n }\n : {}),\n }\n if (!options.env) {\n // Matches default @babel/preset-env behavior\n options.jsc.target = 'es5'\n }\n }\n\n // For node_modules in app browser layer, we don't need to do any server side transformation.\n // Only keep server actions transform to discover server actions from client components.\n if (isAppBrowserLayer && isNodeModules) {\n options.disableNextSsg = true\n options.disablePageConfig = true\n options.isPageFile = false\n options.optimizeServerReact = undefined\n options.cjsRequireOptimizer = undefined\n // Disable optimizer for node_modules in app browser layer, to avoid unnecessary replacement.\n // e.g. typeof window could result differently in js worker or browser.\n if (options.jsc.transform.optimizer.globals?.typeofs) {\n delete options.jsc.transform.optimizer.globals.typeofs.window\n }\n }\n\n return options\n}\n"],"names":["WEBPACK_LAYERS","isWebpackServerOnlyLayer","isWebpackAppPagesLayer","nextDistPath","nodeModulesPath","regeneratorRuntimePath","require","resolve","isTypeScriptFile","filename","endsWith","isCommonJSFile","shouldOutputCommonJs","test","getParserOptions","jsConfig","rest","isTSFile","hasTsSyntax","enableDecorators","Boolean","compilerOptions","experimentalDecorators","syntax","dynamicImport","decorators","importAssertions","getBaseSWCOptions","jest","development","hasReactRefresh","globalWindow","esm","modularizeImports","swcPlugins","resolvedBaseUrl","swcCacheDir","serverComponents","serverReferenceHashSalt","bundleLayer","isDynamicIo","isReactServerLayer","isAppRouterPagesLayer","parserConfig","paths","emitDecoratorMetadata","useDefineForClassFields","plugins","filter","Array","isArray","map","name","options","jsc","baseUrl","externalHelpers","process","versions","pnp","parser","experimental","keepImportAttributes","emitAssertForImportAttributes","cacheRoot","transform","hidden","legacyDecorator","decoratorMetadata","react","importSource","jsxImportSource","emotion","runtime","pragmaFrag","throwIfNamespace","useBuiltins","refresh","optimizer","simplify","globals","typeofs","window","envs","NODE_ENV","regenerator","importPath","sourceMaps","undefined","removeConsole","reactRemoveProperties","Object","fromEntries","entries","mod","config","key","value","relay","styledJsx","getEmotionOptions","styledComponents","getStyledComponentsOptions","dynamicIoEnabled","serverActions","hashSalt","preferEsm","lintCodemodComments","debugFunctionName","styledComponentsConfig","displayName","emotionConfig","autoLabel","enabled","sourcemap","importMap","labelFormat","sourceMap","getJestSWCOptions","isServer","pagesDir","baseOptions","useCjsModules","env","targets","node","module","type","disableNextSsg","disablePageConfig","getLoaderSWCOptions","appDir","isPageFile","optimizeServerReact","optimizePackageImports","supportedBrowsers","relativeFilePathFromRoot","fontLoaders","cjsRequireOptimizer","packages","transforms","NextRequest","NextResponse","ImageResponse","userAgentFromString","userAgent","optimize_use_state","autoModularizeImports","isNodeModules","isAppBrowserLayer","appPagesBrowser","moduleResolutionConfig","isDevelopment","isServerCompiler","length","target"],"mappings":"AAAA,SAASA,cAAc,QAA+B,sBAAqB;AAQ3E,SAASC,wBAAwB,EAAEC,sBAAsB,QAAQ,WAAU;AAE3E,MAAMC,eACJ;AAEF,MAAMC,kBAAkB;AAExB,MAAMC,yBAAyBC,QAAQC,OAAO,CAC5C;AAGF,SAASC,iBAAiBC,QAAgB;IACxC,OAAOA,SAASC,QAAQ,CAAC,UAAUD,SAASC,QAAQ,CAAC;AACvD;AAEA,SAASC,eAAeF,QAAgB;IACtC,OAAOA,SAASC,QAAQ,CAAC;AAC3B;AAEA,qEAAqE;AACrE,mHAAmH;AACnH,SAASE,qBAAqBH,QAAgB;IAC5C,OAAOE,eAAeF,aAAaN,aAAaU,IAAI,CAACJ;AACvD;AAEA,OAAO,SAASK,iBAAiB,EAAEL,QAAQ,EAAEM,QAAQ,EAAE,GAAGC,MAAW;QAIjED;IAHF,MAAME,WAAWR,SAASC,QAAQ,CAAC;IACnC,MAAMQ,cAAcV,iBAAiBC;IACrC,MAAMU,mBAAmBC,QACvBL,6BAAAA,4BAAAA,SAAUM,eAAe,qBAAzBN,0BAA2BO,sBAAsB;IAEnD,OAAO;QACL,GAAGN,I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SAASW;gBACX;YACF,IACA,CAAC,CAAC;QACR;QACA,IAAI,CAAClF,QAAQsE,GAAG,EAAE;YAChB,6CAA6C;YAC7CtE,QAAQC,GAAG,CAACqG,MAAM,GAAG;QACvB;IACF;IAEA,6FAA6F;IAC7F,wFAAwF;IACxF,IAAIN,qBAAqBD,eAAe;YAQlC/F;QAPJA,QAAQ2E,cAAc,GAAG;QACzB3E,QAAQ4E,iBAAiB,GAAG;QAC5B5E,QAAQ+E,UAAU,GAAG;QACrB/E,QAAQgF,mBAAmB,GAAG7C;QAC9BnC,QAAQqF,mBAAmB,GAAGlD;QAC9B,6FAA6F;QAC7F,uEAAuE;QACvE,KAAInC,2CAAAA,QAAQC,GAAG,CAACW,SAAS,CAACa,SAAS,CAACE,OAAO,qBAAvC3B,yCAAyC4B,OAAO,EAAE;YACpD,OAAO5B,QAAQC,GAAG,CAACW,SAAS,CAACa,SAAS,CAACE,OAAO,CAACC,OAAO,CAACC,MAAM;QAC/D;IACF;IAEA,OAAO7B;AACT"}
1
+ {"version":3,"sources":["../../../src/build/swc/options.ts"],"sourcesContent":["import { WEBPACK_LAYERS, type WebpackLayerName } from '../../lib/constants'\nimport type {\n NextConfig,\n ExperimentalConfig,\n EmotionConfig,\n StyledComponentsConfig,\n} from '../../server/config-shared'\nimport type { ResolvedBaseUrl } from '../load-jsconfig'\nimport { isWebpackServerOnlyLayer, isWebpackAppPagesLayer } from '../utils'\n\nconst nextDistPath =\n /(next[\\\\/]dist[\\\\/]shared[\\\\/]lib)|(next[\\\\/]dist[\\\\/]client)|(next[\\\\/]dist[\\\\/]pages)/\n\nconst nodeModulesPath = /[\\\\/]node_modules[\\\\/]/\n\nconst regeneratorRuntimePath = require.resolve(\n 'next/dist/compiled/regenerator-runtime'\n)\n\nfunction isTypeScriptFile(filename: string) {\n return filename.endsWith('.ts') || filename.endsWith('.tsx')\n}\n\nfunction isCommonJSFile(filename: string) {\n return filename.endsWith('.cjs')\n}\n\n// Ensure Next.js internals and .cjs files are output as CJS modules,\n// By default all modules are output as ESM or will treated as CJS if next-swc/auto-cjs plugin detects file is CJS.\nfunction shouldOutputCommonJs(filename: string) {\n return isCommonJSFile(filename) || nextDistPath.test(filename)\n}\n\nexport function getParserOptions({ filename, jsConfig, ...rest }: any) {\n const isTSFile = filename.endsWith('.ts')\n const hasTsSyntax = isTypeScriptFile(filename)\n const enableDecorators = Boolean(\n jsConfig?.compilerOptions?.experimentalDecorators\n )\n return {\n ...rest,\n syntax: hasTsSyntax ? 'typescript' : 'ecmascript',\n dynamicImport: true,\n decorators: enableDecorators,\n // Exclude regular TypeScript files from React transformation to prevent e.g. generic parameters and angle-bracket type assertion from being interpreted as JSX tags.\n [hasTsSyntax ? 'tsx' : 'jsx']: !isTSFile,\n importAssertions: true,\n }\n}\n\nfunction getBaseSWCOptions({\n filename,\n jest,\n development,\n hasReactRefresh,\n globalWindow,\n esm,\n modularizeImports,\n swcPlugins,\n compilerOptions,\n resolvedBaseUrl,\n jsConfig,\n swcCacheDir,\n serverComponents,\n serverReferenceHashSalt,\n bundleLayer,\n isDynamicIo,\n cacheHandlers,\n}: {\n filename: string\n jest?: boolean\n development: boolean\n hasReactRefresh: boolean\n globalWindow: boolean\n esm: boolean\n modularizeImports?: NextConfig['modularizeImports']\n compilerOptions: NextConfig['compiler']\n swcPlugins: ExperimentalConfig['swcPlugins']\n resolvedBaseUrl?: ResolvedBaseUrl\n jsConfig: any\n swcCacheDir?: string\n serverComponents?: boolean\n serverReferenceHashSalt: string\n bundleLayer?: WebpackLayerName\n isDynamicIo?: boolean\n cacheHandlers?: ExperimentalConfig['cacheHandlers']\n}) {\n const isReactServerLayer = isWebpackServerOnlyLayer(bundleLayer)\n const isAppRouterPagesLayer = isWebpackAppPagesLayer(bundleLayer)\n const parserConfig = getParserOptions({ filename, jsConfig })\n const paths = jsConfig?.compilerOptions?.paths\n const enableDecorators = Boolean(\n jsConfig?.compilerOptions?.experimentalDecorators\n )\n const emitDecoratorMetadata = Boolean(\n jsConfig?.compilerOptions?.emitDecoratorMetadata\n )\n const useDefineForClassFields = Boolean(\n jsConfig?.compilerOptions?.useDefineForClassFields\n )\n const plugins = (swcPlugins ?? [])\n .filter(Array.isArray)\n .map(([name, options]: any) => [require.resolve(name), options])\n\n return {\n jsc: {\n ...(resolvedBaseUrl && paths\n ? {\n baseUrl: resolvedBaseUrl.baseUrl,\n paths,\n }\n : {}),\n externalHelpers: !process.versions.pnp && !jest,\n parser: parserConfig,\n experimental: {\n keepImportAttributes: true,\n emitAssertForImportAttributes: true,\n plugins,\n cacheRoot: swcCacheDir,\n },\n transform: {\n // Enables https://github.com/swc-project/swc/blob/0359deb4841be743d73db4536d4a22ac797d7f65/crates/swc_ecma_ext_transforms/src/jest.rs\n ...(jest\n ? {\n hidden: {\n jest: true,\n },\n }\n : {}),\n legacyDecorator: enableDecorators,\n decoratorMetadata: emitDecoratorMetadata,\n useDefineForClassFields: useDefineForClassFields,\n react: {\n importSource:\n jsConfig?.compilerOptions?.jsxImportSource ??\n (compilerOptions?.emotion && !isReactServerLayer\n ? '@emotion/react'\n : 'react'),\n runtime: 'automatic',\n pragmaFrag: 'React.Fragment',\n throwIfNamespace: true,\n development: !!development,\n useBuiltins: true,\n refresh: !!hasReactRefresh,\n },\n optimizer: {\n simplify: false,\n globals: jest\n ? null\n : {\n typeofs: {\n window: globalWindow ? 'object' : 'undefined',\n },\n envs: {\n NODE_ENV: development ? '\"development\"' : '\"production\"',\n },\n // TODO: handle process.browser to match babel replacing as well\n },\n },\n regenerator: {\n importPath: regeneratorRuntimePath,\n },\n },\n },\n sourceMaps: jest ? 'inline' : undefined,\n removeConsole: compilerOptions?.removeConsole,\n // disable \"reactRemoveProperties\" when \"jest\" is true\n // otherwise the setting from next.config.js will be used\n reactRemoveProperties: jest\n ? false\n : compilerOptions?.reactRemoveProperties,\n // Map the k-v map to an array of pairs.\n modularizeImports: modularizeImports\n ? Object.fromEntries(\n Object.entries(modularizeImports).map(([mod, config]) => [\n mod,\n {\n ...config,\n transform:\n typeof config.transform === 'string'\n ? config.transform\n : Object.entries(config.transform).map(([key, value]) => [\n key,\n value,\n ]),\n },\n ])\n )\n : undefined,\n relay: compilerOptions?.relay,\n // Always transform styled-jsx and error when `client-only` condition is triggered\n styledJsx: {},\n // Disable css-in-js libs (without client-only integration) transform on server layer for server components\n ...(!isReactServerLayer && {\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n emotion: getEmotionOptions(compilerOptions?.emotion, development),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n styledComponents: getStyledComponentsOptions(\n compilerOptions?.styledComponents,\n development\n ),\n }),\n serverComponents:\n serverComponents && !jest\n ? {\n isReactServerLayer,\n dynamicIoEnabled: isDynamicIo,\n }\n : undefined,\n serverActions:\n isAppRouterPagesLayer && !jest\n ? {\n isReactServerLayer,\n dynamicIoEnabled: isDynamicIo,\n hashSalt: serverReferenceHashSalt,\n cacheKinds: cacheHandlers ? Object.keys(cacheHandlers) : [],\n }\n : undefined,\n // For app router we prefer to bundle ESM,\n // On server side of pages router we prefer CJS.\n preferEsm: esm,\n lintCodemodComments: true,\n debugFunctionName: development,\n }\n}\n\nfunction getStyledComponentsOptions(\n styledComponentsConfig: undefined | boolean | StyledComponentsConfig,\n development: any\n) {\n if (!styledComponentsConfig) {\n return null\n } else if (typeof styledComponentsConfig === 'object') {\n return {\n ...styledComponentsConfig,\n displayName: styledComponentsConfig.displayName ?? Boolean(development),\n }\n } else {\n return {\n displayName: Boolean(development),\n }\n }\n}\n\nfunction getEmotionOptions(\n emotionConfig: undefined | boolean | EmotionConfig,\n development: boolean\n) {\n if (!emotionConfig) {\n return null\n }\n let autoLabel = !!development\n switch (typeof emotionConfig === 'object' && emotionConfig.autoLabel) {\n case 'never':\n autoLabel = false\n break\n case 'always':\n autoLabel = true\n break\n case 'dev-only':\n default:\n break\n }\n return {\n enabled: true,\n autoLabel,\n sourcemap: development,\n ...(typeof emotionConfig === 'object' && {\n importMap: emotionConfig.importMap,\n labelFormat: emotionConfig.labelFormat,\n sourcemap: development && emotionConfig.sourceMap,\n }),\n }\n}\n\nexport function getJestSWCOptions({\n isServer,\n filename,\n esm,\n modularizeImports,\n swcPlugins,\n compilerOptions,\n jsConfig,\n resolvedBaseUrl,\n pagesDir,\n serverReferenceHashSalt,\n}: {\n isServer: boolean\n filename: string\n esm: boolean\n modularizeImports?: NextConfig['modularizeImports']\n swcPlugins: ExperimentalConfig['swcPlugins']\n compilerOptions: NextConfig['compiler']\n jsConfig: any\n resolvedBaseUrl?: ResolvedBaseUrl\n pagesDir?: string\n serverComponents?: boolean\n serverReferenceHashSalt: string\n}) {\n let baseOptions = getBaseSWCOptions({\n filename,\n jest: true,\n development: false,\n hasReactRefresh: false,\n globalWindow: !isServer,\n modularizeImports,\n swcPlugins,\n compilerOptions,\n jsConfig,\n resolvedBaseUrl,\n esm,\n // Don't apply server layer transformations for Jest\n // Disable server / client graph assertions for Jest\n bundleLayer: undefined,\n serverComponents: false,\n serverReferenceHashSalt,\n })\n\n const useCjsModules = shouldOutputCommonJs(filename)\n return {\n ...baseOptions,\n env: {\n targets: {\n // Targets the current version of Node.js\n node: process.versions.node,\n },\n },\n module: {\n type: esm && !useCjsModules ? 'es6' : 'commonjs',\n },\n disableNextSsg: true,\n disablePageConfig: true,\n pagesDir,\n }\n}\n\nexport function getLoaderSWCOptions({\n // This is not passed yet as \"paths\" resolving is handled by webpack currently.\n // resolvedBaseUrl,\n filename,\n development,\n isServer,\n pagesDir,\n appDir,\n isPageFile,\n isDynamicIo,\n hasReactRefresh,\n modularizeImports,\n optimizeServerReact,\n optimizePackageImports,\n swcPlugins,\n compilerOptions,\n jsConfig,\n supportedBrowsers,\n swcCacheDir,\n relativeFilePathFromRoot,\n serverComponents,\n serverReferenceHashSalt,\n bundleLayer,\n esm,\n cacheHandlers,\n}: {\n filename: string\n development: boolean\n isServer: boolean\n pagesDir?: string\n appDir?: string\n isPageFile: boolean\n hasReactRefresh: boolean\n optimizeServerReact?: boolean\n modularizeImports: NextConfig['modularizeImports']\n isDynamicIo?: boolean\n optimizePackageImports?: NonNullable<\n NextConfig['experimental']\n >['optimizePackageImports']\n swcPlugins: ExperimentalConfig['swcPlugins']\n compilerOptions: NextConfig['compiler']\n jsConfig: any\n supportedBrowsers: string[] | undefined\n swcCacheDir: string\n relativeFilePathFromRoot: string\n esm?: boolean\n serverComponents?: boolean\n serverReferenceHashSalt: string\n bundleLayer?: WebpackLayerName\n cacheHandlers: ExperimentalConfig['cacheHandlers']\n}) {\n let baseOptions: any = getBaseSWCOptions({\n filename,\n development,\n globalWindow: !isServer,\n hasReactRefresh,\n modularizeImports,\n swcPlugins,\n compilerOptions,\n jsConfig,\n // resolvedBaseUrl,\n swcCacheDir,\n bundleLayer,\n serverComponents,\n serverReferenceHashSalt,\n esm: !!esm,\n isDynamicIo,\n cacheHandlers,\n })\n baseOptions.fontLoaders = {\n fontLoaders: ['next/font/local', 'next/font/google'],\n relativeFilePathFromRoot,\n }\n baseOptions.cjsRequireOptimizer = {\n packages: {\n 'next/server': {\n transforms: {\n NextRequest: 'next/dist/server/web/spec-extension/request',\n NextResponse: 'next/dist/server/web/spec-extension/response',\n ImageResponse: 'next/dist/server/web/spec-extension/image-response',\n userAgentFromString: 'next/dist/server/web/spec-extension/user-agent',\n userAgent: 'next/dist/server/web/spec-extension/user-agent',\n },\n },\n },\n }\n\n if (optimizeServerReact && isServer && !development) {\n baseOptions.optimizeServerReact = {\n optimize_use_state: false,\n }\n }\n\n // Modularize import optimization for barrel files\n if (optimizePackageImports) {\n baseOptions.autoModularizeImports = {\n packages: optimizePackageImports,\n }\n }\n\n const isNodeModules = nodeModulesPath.test(filename)\n const isAppBrowserLayer = bundleLayer === WEBPACK_LAYERS.appPagesBrowser\n const moduleResolutionConfig = shouldOutputCommonJs(filename)\n ? {\n module: {\n type: 'commonjs',\n },\n }\n : {}\n\n let options: any\n if (isServer) {\n options = {\n ...baseOptions,\n ...moduleResolutionConfig,\n // Disables getStaticProps/getServerSideProps tree shaking on the server compilation for pages\n disableNextSsg: true,\n disablePageConfig: true,\n isDevelopment: development,\n isServerCompiler: isServer,\n pagesDir,\n appDir,\n preferEsm: !!esm,\n isPageFile,\n env: {\n targets: {\n // Targets the current version of Node.js\n node: process.versions.node,\n },\n },\n }\n } else {\n options = {\n ...baseOptions,\n ...moduleResolutionConfig,\n disableNextSsg: !isPageFile,\n isDevelopment: development,\n isServerCompiler: isServer,\n pagesDir,\n appDir,\n isPageFile,\n ...(supportedBrowsers && supportedBrowsers.length > 0\n ? {\n env: {\n targets: supportedBrowsers,\n },\n }\n : {}),\n }\n if (!options.env) {\n // Matches default @babel/preset-env behavior\n options.jsc.target = 'es5'\n }\n }\n\n // For node_modules in app browser layer, we don't need to do any server side transformation.\n // Only keep server actions transform to discover server actions from client components.\n if (isAppBrowserLayer && isNodeModules) {\n options.disableNextSsg = true\n options.disablePageConfig = true\n options.isPageFile = false\n options.optimizeServerReact = undefined\n options.cjsRequireOptimizer = undefined\n // Disable optimizer for node_modules in app browser layer, to avoid unnecessary replacement.\n // e.g. typeof window could result differently in js worker or browser.\n if (options.jsc.transform.optimizer.globals?.typeofs) {\n delete options.jsc.transform.optimizer.globals.typeofs.window\n }\n }\n\n return options\n}\n"],"names":["WEBPACK_LAYERS","isWebpackServerOnlyLayer","isWebpackAppPagesLayer","nextDistPath","nodeModulesPath","regeneratorRuntimePath","require","resolve","isTypeScriptFile","filename","endsWith","isCommonJSFile","shouldOutputCommonJs","test","getParserOptions","jsConfig","rest","isTSFile","hasTsSyntax","enableDecorators","Boolean","compilerOptions","experimentalDecorators","syntax","dynamicImport","decorators","importAssertions","getBaseSWCOptions","jest","development","hasReactRefresh","globalWindow","esm","modularizeImports","swcPlugins","resolvedBaseUrl","swcCacheDir","serverComponents","serverReferenceHashSalt","bundleLayer","isDynamicIo","cacheHandlers","isReactServerLayer","isAppRouterPagesLayer","parserConfig","paths","emitDecoratorMetadata","useDefineForClassFields","plugins","filter","Array","isArray","map","name","options","jsc","baseUrl","externalHelpers","process","versions","pnp","parser","experimental","keepImportAttributes","emitAssertForImportAttributes","cacheRoot","transform","hidden","legacyDecorator","decoratorMetadata","react","importSource","jsxImportSource","emotion","runtime","pragmaFrag","throwIfNamespace","useBuiltins","refresh","optimizer","simplify","globals","typeofs","window","envs","NODE_ENV","regenerator","importPath","sourceMaps","undefined","removeConsole","reactRemoveProperties","Object","fromEntries","entries","mod","config","key","value","relay","styledJsx","getEmotionOptions","styledComponents","getStyledComponentsOptions","dynamicIoEnabled","serverActions","hashSalt","cacheKinds","keys","preferEsm","lintCodemodComments","debugFunctionName","styledComponentsConfig","displayName","emotionConfig","autoLabel","enabled","sourcemap","importMap","labelFormat","sourceMap","getJestSWCOptions","isServer","pagesDir","baseOptions","useCjsModules","env","targets","node","module","type","disableNextSsg","disablePageConfig","getLoaderSWCOptions","appDir","isPageFile","optimizeServerReact","optimizePackageImports","supportedBrowsers","relativeFilePathFromRoot","fontLoaders","cjsRequireOptimizer","packages","transforms","NextRequest","NextResponse","ImageResponse","userAgentFromString","userAgent","optimize_use_state","autoModularizeImports","isNodeModules","isAppBrowserLayer","appPagesBrowser","moduleResolutionConfig","isDevelopment","isServerCompiler","length","target"],"mappings":"AAAA,SAASA,cAAc,QAA+B,sBAAqB;AAQ3E,SAASC,wBAAwB,EAAEC,sBAAsB,QAAQ,WAAU;AAE3E,MAAMC,eACJ;AAEF,MAAMC,kBAAkB;AAExB,MAAMC,yBAAyBC,QAAQC,OAAO,CAC5C;AAGF,SAASC,iBAAiBC,QAAgB;IACxC,OAAOA,SAASC,QAAQ,CAAC,UAAUD,SAASC,QAAQ,CAAC;AACvD;AAEA,SAASC,eAAeF,QAAgB;IACtC,OAAOA,SAASC,QAAQ,CAAC;AAC3B;AAEA,qEAAqE;AACrE,mHAAmH;AACnH,SAASE,qBAAqBH,QAAgB;IAC5C,OAAOE,eAAeF,aAAaN,aAAaU,IAAI,CAACJ;AACvD;AAEA,OAAO,SAASK,iBAAiB,EAAEL,QAAQ,EAAEM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AT,KAAK;gBACHC,SAAS;oBACP,yCAAyC;oBACzCC,MAAMtE,QAAQC,QAAQ,CAACqE,IAAI;gBAC7B;YACF;QACF;IACF,OAAO;QACL1E,UAAU;YACR,GAAGsE,WAAW;YACd,GAAG8B,sBAAsB;YACzBvB,gBAAgB,CAACI;YACjBoB,eAAe9H;YACf+H,kBAAkBlC;YAClBC;YACAW;YACAC;YACA,GAAIG,qBAAqBA,kBAAkBmB,MAAM,GAAG,IAChD;gBACE/B,KAAK;oBACHC,SAASW;gBACX;YACF,IACA,CAAC,CAAC;QACR;QACA,IAAI,CAACpF,QAAQwE,GAAG,EAAE;YAChB,6CAA6C;YAC7CxE,QAAQC,GAAG,CAACuG,MAAM,GAAG;QACvB;IACF;IAEA,6FAA6F;IAC7F,wFAAwF;IACxF,IAAIN,qBAAqBD,eAAe;YAQlCjG;QAPJA,QAAQ6E,cAAc,GAAG;QACzB7E,QAAQ8E,iBAAiB,GAAG;QAC5B9E,QAAQiF,UAAU,GAAG;QACrBjF,QAAQkF,mBAAmB,GAAG/C;QAC9BnC,QAAQuF,mBAAmB,GAAGpD;QAC9B,6FAA6F;QAC7F,uEAAuE;QACvE,KAAInC,2CAAAA,QAAQC,GAAG,CAACW,SAAS,CAACa,SAAS,CAACE,OAAO,qBAAvC3B,yCAAyC4B,OAAO,EAAE;YACpD,OAAO5B,QAAQC,GAAG,CAACW,SAAS,CAACa,SAAS,CAACE,OAAO,CAACC,OAAO,CAACC,MAAM;QAC/D;IACF;IAEA,OAAO7B;AACT"}
@@ -41,7 +41,7 @@ const maybeExclude = (excludePath, transpilePackages)=>{
41
41
  // for to force transpiling a `node_module`
42
42
  const FORCE_TRANSPILE_CONDITIONS = /(next\/font|next\/dynamic|use server|use client)/;
43
43
  async function loaderTransform(source, inputSourceMap) {
44
- var _nextConfig_experimental, _nextConfig_experimental1, _nextConfig_experimental2, _nextConfig_experimental3, _nextConfig_experimental4;
44
+ var _nextConfig_experimental, _nextConfig_experimental1, _nextConfig_experimental2, _nextConfig_experimental3, _nextConfig_experimental4, _nextConfig_experimental5;
45
45
  // Make the loader async
46
46
  const filename = this.resourcePath;
47
47
  // Ensure `.d.ts` are not processed.
@@ -88,7 +88,8 @@ async function loaderTransform(source, inputSourceMap) {
88
88
  serverComponents,
89
89
  serverReferenceHashSalt,
90
90
  bundleLayer,
91
- esm
91
+ esm,
92
+ cacheHandlers: (_nextConfig_experimental5 = nextConfig.experimental) == null ? void 0 : _nextConfig_experimental5.cacheHandlers
92
93
  });
93
94
  const programmaticOptions = {
94
95
  ...swcOptions,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/build/webpack/loaders/next-swc-loader.ts"],"sourcesContent":["/*\nCopyright (c) 2017 The swc Project Developers\n\nPermission is hereby granted, free of charge, to any\nperson obtaining a copy of this software and associated\ndocumentation files (the \"Software\"), to deal in the\nSoftware without restriction, including without\nlimitation the rights to use, copy, modify, merge,\npublish, distribute, sublicense, and/or sell copies of\nthe Software, and to permit persons to whom the Software\nis furnished to do so, subject to the following\nconditions:\n\nThe above copyright notice and this permission notice\nshall be included in all copies or substantial portions\nof the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF\nANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED\nTO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\nPARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT\nSHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\nOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR\nIN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\nDEALINGS IN THE SOFTWARE.\n*/\n\nimport type { NextConfig } from '../../../types'\nimport type { WebpackLayerName } from '../../../lib/constants'\nimport { isWasm, transform } from '../../swc'\nimport { getLoaderSWCOptions } from '../../swc/options'\nimport path, { isAbsolute } from 'path'\nimport { babelIncludeRegexes } from '../../webpack-config'\nimport { isResourceInPackages } from '../../handle-externals'\n\nconst maybeExclude = (\n excludePath: string,\n transpilePackages: string[]\n): boolean => {\n if (babelIncludeRegexes.some((r) => r.test(excludePath))) {\n return false\n }\n\n const shouldBeBundled = isResourceInPackages(excludePath, transpilePackages)\n if (shouldBeBundled) return false\n\n return excludePath.includes('node_modules')\n}\n\nexport interface SWCLoaderOptions {\n rootDir: string\n isServer: boolean\n pagesDir?: string\n appDir?: string\n hasReactRefresh: boolean\n optimizeServerReact?: boolean\n nextConfig: NextConfig\n jsConfig: any\n supportedBrowsers: string[] | undefined\n swcCacheDir: string\n serverComponents?: boolean\n serverReferenceHashSalt: string\n bundleLayer?: WebpackLayerName\n esm?: boolean\n transpilePackages?: string[]\n}\n\n// these are exact code conditions checked\n// for to force transpiling a `node_module`\nconst FORCE_TRANSPILE_CONDITIONS =\n /(next\\/font|next\\/dynamic|use server|use client)/\n\nasync function loaderTransform(\n this: any,\n source?: string,\n inputSourceMap?: any\n) {\n // Make the loader async\n const filename = this.resourcePath\n\n // Ensure `.d.ts` are not processed.\n if (filename.endsWith('.d.ts')) {\n return [source, inputSourceMap]\n }\n\n let loaderOptions: SWCLoaderOptions = this.getOptions() || {}\n const shouldMaybeExclude = maybeExclude(\n filename,\n loaderOptions.transpilePackages || []\n )\n\n if (shouldMaybeExclude) {\n if (!source) {\n throw new Error(`Invariant might be excluded but missing source`)\n }\n\n if (!FORCE_TRANSPILE_CONDITIONS.test(source)) {\n return [source, inputSourceMap]\n }\n }\n\n const {\n isServer,\n rootDir,\n pagesDir,\n appDir,\n hasReactRefresh,\n nextConfig,\n jsConfig,\n supportedBrowsers,\n swcCacheDir,\n serverComponents,\n serverReferenceHashSalt,\n bundleLayer,\n esm,\n } = loaderOptions\n const isPageFile = filename.startsWith(pagesDir)\n const relativeFilePathFromRoot = path.relative(rootDir, filename)\n\n const swcOptions = getLoaderSWCOptions({\n pagesDir,\n appDir,\n filename,\n isServer,\n isPageFile,\n development:\n this.mode === 'development' ||\n !!nextConfig.experimental?.allowDevelopmentBuild,\n isDynamicIo: nextConfig.experimental?.dynamicIO,\n hasReactRefresh,\n modularizeImports: nextConfig?.modularizeImports,\n optimizePackageImports: nextConfig?.experimental?.optimizePackageImports,\n swcPlugins: nextConfig?.experimental?.swcPlugins,\n compilerOptions: nextConfig?.compiler,\n optimizeServerReact: nextConfig?.experimental?.optimizeServerReact,\n jsConfig,\n supportedBrowsers,\n swcCacheDir,\n relativeFilePathFromRoot,\n serverComponents,\n serverReferenceHashSalt,\n bundleLayer,\n esm,\n })\n\n const programmaticOptions = {\n ...swcOptions,\n filename,\n inputSourceMap: inputSourceMap ? JSON.stringify(inputSourceMap) : undefined,\n\n // Set the default sourcemap behavior based on Webpack's mapping flag,\n sourceMaps: this.sourceMap,\n inlineSourcesContent: this.sourceMap,\n\n // Ensure that Webpack will get a full absolute path in the sourcemap\n // so that it can properly map the module back to its internal cached\n // modules.\n sourceFileName: filename,\n }\n\n if (!programmaticOptions.inputSourceMap) {\n delete programmaticOptions.inputSourceMap\n }\n\n // auto detect development mode\n if (\n this.mode &&\n programmaticOptions.jsc &&\n programmaticOptions.jsc.transform &&\n programmaticOptions.jsc.transform.react &&\n !Object.prototype.hasOwnProperty.call(\n programmaticOptions.jsc.transform.react,\n 'development'\n )\n ) {\n programmaticOptions.jsc.transform.react.development =\n this.mode === 'development'\n }\n\n return transform(source as any, programmaticOptions).then((output) => {\n if (output.eliminatedPackages && this.eliminatedPackages) {\n for (const pkg of JSON.parse(output.eliminatedPackages)) {\n this.eliminatedPackages.add(pkg)\n }\n }\n return [output.code, output.map ? JSON.parse(output.map) : undefined]\n })\n}\n\nconst EXCLUDED_PATHS =\n /[\\\\/](cache[\\\\/][^\\\\/]+\\.zip[\\\\/]node_modules|__virtual__)[\\\\/]/g\n\nexport function pitch(this: any) {\n const callback = this.async()\n let loaderOptions: SWCLoaderOptions = this.getOptions() || {}\n\n const shouldMaybeExclude = maybeExclude(\n this.resourcePath,\n loaderOptions.transpilePackages || []\n )\n\n ;(async () => {\n if (\n // if it might be excluded/no-op we can't use pitch loader\n !shouldMaybeExclude &&\n // TODO: investigate swc file reading in PnP mode?\n !process.versions.pnp &&\n !EXCLUDED_PATHS.test(this.resourcePath) &&\n this.loaders.length - 1 === this.loaderIndex &&\n isAbsolute(this.resourcePath) &&\n !(await isWasm())\n ) {\n this.addDependency(this.resourcePath)\n return loaderTransform.call(this)\n }\n })().then((r) => {\n if (r) return callback(null, ...r)\n callback()\n }, callback)\n}\n\nexport default function swcLoader(\n this: any,\n inputSource: string,\n inputSourceMap: any\n) {\n const callback = this.async()\n loaderTransform.call(this, inputSource, inputSourceMap).then(\n ([transformedSource, outputSourceMap]: any) => {\n callback(null, transformedSource, outputSourceMap || inputSourceMap)\n },\n (err: Error) => {\n callback(err)\n }\n )\n}\n\n// accept Buffers instead of strings\nexport const raw = true\n"],"names":["isWasm","transform","getLoaderSWCOptions","path","isAbsolute","babelIncludeRegexes","isResourceInPackages","maybeExclude","excludePath","transpilePackages","some","r","test","shouldBeBundled","includes","FORCE_TRANSPILE_CONDITIONS","loaderTransform","source","inputSourceMap","nextConfig","filename","resourcePath","endsWith","loaderOptions","getOptions","shouldMaybeExclude","Error","isServer","rootDir","pagesDir","appDir","hasReactRefresh","jsConfig","supportedBrowsers","swcCacheDir","serverComponents","serverReferenceHashSalt","bundleLayer","esm","isPageFile","startsWith","relativeFilePathFromRoot","relative","swcOptions","development","mode","experimental","allowDevelopmentBuild","isDynamicIo","dynamicIO","modularizeImports","optimizePackageImports","swcPlugins","compilerOptions","compiler","optimizeServerReact","programmaticOptions","JSON","stringify","undefined","sourceMaps","sourceMap","inlineSourcesContent","sourceFileName","jsc","react","Object","prototype","hasOwnProperty","call","then","output","eliminatedPackages","pkg","parse","add","code","map","EXCLUDED_PATHS","pitch","callback","async","process","versions","pnp","loaders","length","loaderIndex","addDependency","swcLoader","inputSource","transformedSource","outputSourceMap","err","raw"],"mappings":"AAA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AC3D;QACT,IAAIA,GAAG,OAAOqE,SAAS,SAASrE;QAChCqE;IACF,GAAGA;AACL;AAEA,eAAe,SAASS,UAEtBC,WAAmB,EACnBxE,cAAmB;IAEnB,MAAM8D,WAAW,IAAI,CAACC,KAAK;IAC3BjE,gBAAgBqD,IAAI,CAAC,IAAI,EAAEqB,aAAaxE,gBAAgBoD,IAAI,CAC1D,CAAC,CAACqB,mBAAmBC,gBAAqB;QACxCZ,SAAS,MAAMW,mBAAmBC,mBAAmB1E;IACvD,GACA,CAAC2E;QACCb,SAASa;IACX;AAEJ;AAEA,oCAAoC;AACpC,OAAO,MAAMC,MAAM,KAAI"}
1
+ {"version":3,"sources":["../../../../src/build/webpack/loaders/next-swc-loader.ts"],"sourcesContent":["/*\nCopyright (c) 2017 The swc Project Developers\n\nPermission is hereby granted, free of charge, to any\nperson obtaining a copy of this software and associated\ndocumentation files (the \"Software\"), to deal in the\nSoftware without restriction, including without\nlimitation the rights to use, copy, modify, merge,\npublish, distribute, sublicense, and/or sell copies of\nthe Software, and to permit persons to whom the Software\nis furnished to do so, subject to the following\nconditions:\n\nThe above copyright notice and this permission notice\nshall be included in all copies or substantial portions\nof the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF\nANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED\nTO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\nPARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT\nSHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\nOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR\nIN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\nDEALINGS IN THE SOFTWARE.\n*/\n\nimport type { NextConfig } from '../../../types'\nimport type { WebpackLayerName } from '../../../lib/constants'\nimport { isWasm, transform } from '../../swc'\nimport { getLoaderSWCOptions } from '../../swc/options'\nimport path, { isAbsolute } from 'path'\nimport { babelIncludeRegexes } from '../../webpack-config'\nimport { isResourceInPackages } from '../../handle-externals'\n\nconst maybeExclude = (\n excludePath: string,\n transpilePackages: string[]\n): boolean => {\n if (babelIncludeRegexes.some((r) => r.test(excludePath))) {\n return false\n }\n\n const shouldBeBundled = isResourceInPackages(excludePath, transpilePackages)\n if (shouldBeBundled) return false\n\n return excludePath.includes('node_modules')\n}\n\nexport interface SWCLoaderOptions {\n rootDir: string\n isServer: boolean\n pagesDir?: string\n appDir?: string\n hasReactRefresh: boolean\n optimizeServerReact?: boolean\n nextConfig: NextConfig\n jsConfig: any\n supportedBrowsers: string[] | undefined\n swcCacheDir: string\n serverComponents?: boolean\n serverReferenceHashSalt: string\n bundleLayer?: WebpackLayerName\n esm?: boolean\n transpilePackages?: string[]\n}\n\n// these are exact code conditions checked\n// for to force transpiling a `node_module`\nconst FORCE_TRANSPILE_CONDITIONS =\n /(next\\/font|next\\/dynamic|use server|use client)/\n\nasync function loaderTransform(\n this: any,\n source?: string,\n inputSourceMap?: any\n) {\n // Make the loader async\n const filename = this.resourcePath\n\n // Ensure `.d.ts` are not processed.\n if (filename.endsWith('.d.ts')) {\n return [source, inputSourceMap]\n }\n\n let loaderOptions: SWCLoaderOptions = this.getOptions() || {}\n const shouldMaybeExclude = maybeExclude(\n filename,\n loaderOptions.transpilePackages || []\n )\n\n if (shouldMaybeExclude) {\n if (!source) {\n throw new Error(`Invariant might be excluded but missing source`)\n }\n\n if (!FORCE_TRANSPILE_CONDITIONS.test(source)) {\n return [source, inputSourceMap]\n }\n }\n\n const {\n isServer,\n rootDir,\n pagesDir,\n appDir,\n hasReactRefresh,\n nextConfig,\n jsConfig,\n supportedBrowsers,\n swcCacheDir,\n serverComponents,\n serverReferenceHashSalt,\n bundleLayer,\n esm,\n } = loaderOptions\n const isPageFile = filename.startsWith(pagesDir)\n const relativeFilePathFromRoot = path.relative(rootDir, filename)\n\n const swcOptions = getLoaderSWCOptions({\n pagesDir,\n appDir,\n filename,\n isServer,\n isPageFile,\n development:\n this.mode === 'development' ||\n !!nextConfig.experimental?.allowDevelopmentBuild,\n isDynamicIo: nextConfig.experimental?.dynamicIO,\n hasReactRefresh,\n modularizeImports: nextConfig?.modularizeImports,\n optimizePackageImports: nextConfig?.experimental?.optimizePackageImports,\n swcPlugins: nextConfig?.experimental?.swcPlugins,\n compilerOptions: nextConfig?.compiler,\n optimizeServerReact: nextConfig?.experimental?.optimizeServerReact,\n jsConfig,\n supportedBrowsers,\n swcCacheDir,\n relativeFilePathFromRoot,\n serverComponents,\n serverReferenceHashSalt,\n bundleLayer,\n esm,\n cacheHandlers: nextConfig.experimental?.cacheHandlers,\n })\n\n const programmaticOptions = {\n ...swcOptions,\n filename,\n inputSourceMap: inputSourceMap ? JSON.stringify(inputSourceMap) : undefined,\n\n // Set the default sourcemap behavior based on Webpack's mapping flag,\n sourceMaps: this.sourceMap,\n inlineSourcesContent: this.sourceMap,\n\n // Ensure that Webpack will get a full absolute path in the sourcemap\n // so that it can properly map the module back to its internal cached\n // modules.\n sourceFileName: filename,\n }\n\n if (!programmaticOptions.inputSourceMap) {\n delete programmaticOptions.inputSourceMap\n }\n\n // auto detect development mode\n if (\n this.mode &&\n programmaticOptions.jsc &&\n programmaticOptions.jsc.transform &&\n programmaticOptions.jsc.transform.react &&\n !Object.prototype.hasOwnProperty.call(\n programmaticOptions.jsc.transform.react,\n 'development'\n )\n ) {\n programmaticOptions.jsc.transform.react.development =\n this.mode === 'development'\n }\n\n return transform(source as any, programmaticOptions).then((output) => {\n if (output.eliminatedPackages && this.eliminatedPackages) {\n for (const pkg of JSON.parse(output.eliminatedPackages)) {\n this.eliminatedPackages.add(pkg)\n }\n }\n return [output.code, output.map ? JSON.parse(output.map) : undefined]\n })\n}\n\nconst EXCLUDED_PATHS =\n /[\\\\/](cache[\\\\/][^\\\\/]+\\.zip[\\\\/]node_modules|__virtual__)[\\\\/]/g\n\nexport function pitch(this: any) {\n const callback = this.async()\n let loaderOptions: SWCLoaderOptions = this.getOptions() || {}\n\n const shouldMaybeExclude = maybeExclude(\n this.resourcePath,\n loaderOptions.transpilePackages || []\n )\n\n ;(async () => {\n if (\n // if it might be excluded/no-op we can't use pitch loader\n !shouldMaybeExclude &&\n // TODO: investigate swc file reading in PnP mode?\n !process.versions.pnp &&\n !EXCLUDED_PATHS.test(this.resourcePath) &&\n this.loaders.length - 1 === this.loaderIndex &&\n isAbsolute(this.resourcePath) &&\n !(await isWasm())\n ) {\n this.addDependency(this.resourcePath)\n return loaderTransform.call(this)\n }\n })().then((r) => {\n if (r) return callback(null, ...r)\n callback()\n }, callback)\n}\n\nexport default function swcLoader(\n this: any,\n inputSource: string,\n inputSourceMap: any\n) {\n const callback = this.async()\n loaderTransform.call(this, inputSource, inputSourceMap).then(\n ([transformedSource, outputSourceMap]: any) => {\n callback(null, transformedSource, outputSourceMap || inputSourceMap)\n },\n (err: Error) => {\n callback(err)\n }\n )\n}\n\n// accept Buffers instead of strings\nexport const raw = true\n"],"names":["isWasm","transform","getLoaderSWCOptions","path","isAbsolute","babelIncludeRegexes","isResourceInPackages","maybeExclude","excludePath","transpilePackages","some","r","test","shouldBeBundled","includes","FORCE_TRANSPILE_CONDITIONS","loaderTransform","source","inputSourceMap","nextConfig","filename","resourcePath","endsWith","loaderOptions","getOptions","shouldMaybeExclude","Error","isServer","rootDir","pagesDir","appDir","hasReactRefresh","jsConfig","supportedBrowsers","swcCacheDir","serverComponents","serverReferenceHashSalt","bundleLayer","esm","isPageFile","startsWith","relativeFilePathFromRoot","relative","swcOptions","development","mode","experimental","allowDevelopmentBuild","isDynamicIo","dynamicIO","modularizeImports","optimizePackageImports","swcPlugins","compilerOptions","compiler","optimizeServerReact","cacheHandlers","programmaticOptions","JSON","stringify","undefined","sourceMaps","sourceMap","inlineSourcesContent","sourceFileName","jsc","react","Object","prototype","hasOwnProperty","call","then","output","eliminatedPackages","pkg","parse","add","code","map","EXCLUDED_PATHS","pitch","callback","async","process","versions","pnp","loaders","length","loaderIndex","addDependency","swcLoader","inputSource","transformedSource","outputSourceMap","err","raw"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,GAIA,SAASA,MAAM,EAAEC,SAAS,QAAQ,YAAW;AAC7C,SAASC,mBAAmB,QAAQ,oBAAmB;AACvD,OAAOC,QAAQC,UAAU,QAAQ,OAAM;AACvC,SAASC,mBAAmB,QAAQ,uBAAsB;AAC1D,SAASC,oBAAoB,QAAQ,yBAAwB;AAE7D,MAAMC,eAAe,CACnBC,aACAC;IAEA,IAAIJ,oBAAoBK,IAAI,CAAC,CAACC,IAAMA,EAAEC,IAAI,CAACJ,eAAe;QACxD,OAAO;IACT;IAEA,MAAMK,kBAAkBP,qBAAqBE,aAAaC;IAC1D,IAAII,iBAAiB,OAAO;IAE5B,OAAOL,YAAYM,QAAQ,CAAC;AAC9B;AAoBA,0CAA0C;AAC1C,2CAA2C;AAC3C,MAAMC,6BACJ;AAEF,eAAeC,gBAEbC,MAAe,EACfC,cAAoB;QAoDdC,0BACSA,2BAGWA,2BACZA,2BAESA,2BASNA;IAlEjB,wBAAwB;IACxB,MAAMC,WAAW,IAAI,CAACC,YAAY;IAElC,oCAAoC;IACpC,IAAID,SAASE,QAAQ,CAAC,UAAU;QAC9B,OAAO;YAACL;YAAQC;SAAe;IACjC;IAEA,IAAIK,gBAAkC,IAAI,CAACC,UAAU,MAAM,CAAC;IAC5D,MAAMC,qBAAqBlB,aACzBa,UACAG,cAAcd,iBAAiB,IAAI,EAAE;IAGvC,IAAIgB,oBAAoB;QACtB,IAAI,CAACR,QAAQ;YACX,MAAM,IAAIS,MAAM,CAAC,8CAA8C,CAAC;QAClE;QAEA,IAAI,CAACX,2BAA2BH,IAAI,CAACK,SAAS;YAC5C,OAAO;gBAACA;gBAAQC;aAAe;QACjC;IACF;IAEA,MAAM,EACJS,QAAQ,EACRC,OAAO,EACPC,QAAQ,EACRC,MAAM,EACNC,eAAe,EACfZ,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AAY,KAC5B,CAAE,MAAMrB,UACR;YACA,IAAI,CAACyF,aAAa,CAAC,IAAI,CAACpE,YAAY;YACpC,OAAOL,gBAAgBsD,IAAI,CAAC,IAAI;QAClC;IACF,CAAA,IAAKC,IAAI,CAAC,CAAC5D;QACT,IAAIA,GAAG,OAAOsE,SAAS,SAAStE;QAChCsE;IACF,GAAGA;AACL;AAEA,eAAe,SAASS,UAEtBC,WAAmB,EACnBzE,cAAmB;IAEnB,MAAM+D,WAAW,IAAI,CAACC,KAAK;IAC3BlE,gBAAgBsD,IAAI,CAAC,IAAI,EAAEqB,aAAazE,gBAAgBqD,IAAI,CAC1D,CAAC,CAACqB,mBAAmBC,gBAAqB;QACxCZ,SAAS,MAAMW,mBAAmBC,mBAAmB3E;IACvD,GACA,CAAC4E;QACCb,SAASa;IACX;AAEJ;AAEA,oCAAoC;AACpC,OAAO,MAAMC,MAAM,KAAI"}
@@ -1409,7 +1409,7 @@ export default async function getBaseWebpackConfig(dir, { buildId, encryptionKey
1409
1409
  isClient && new CopyFilePlugin({
1410
1410
  // file path to build output of `@next/polyfill-nomodule`
1411
1411
  filePath: require.resolve('./polyfills/polyfill-nomodule'),
1412
- cacheKey: "15.0.4-canary.13",
1412
+ cacheKey: "15.0.4-canary.15",
1413
1413
  name: `static/chunks/polyfills${dev ? '' : '-[hash]'}.js`,
1414
1414
  minimize: false,
1415
1415
  info: {
@@ -1637,7 +1637,7 @@ export default async function getBaseWebpackConfig(dir, { buildId, encryptionKey
1637
1637
  // - Next.js location on disk (some loaders use absolute paths and some resolve options depend on absolute paths)
1638
1638
  // - Next.js version
1639
1639
  // - next.config.js keys that affect compilation
1640
- version: `${__dirname}|${"15.0.4-canary.13"}|${configVars}`,
1640
+ version: `${__dirname}|${"15.0.4-canary.15"}|${configVars}`,
1641
1641
  cacheDirectory: path.join(distDir, 'cache', 'webpack'),
1642
1642
  // For production builds, it's more efficient to compress all cache files together instead of compression each one individually.
1643
1643
  // So we disable compression here and allow the build runner to take care of compressing the cache as a whole.
@@ -3,7 +3,7 @@
3
3
  * sure the following scripts are executed in the correct order:
4
4
  * - Polyfills
5
5
  * - next/script with `beforeInteractive` strategy
6
- */ const version = "15.0.4-canary.13";
6
+ */ const version = "15.0.4-canary.15";
7
7
  window.next = {
8
8
  version,
9
9
  appDir: true
@@ -26,7 +26,7 @@ import { SearchParamsContext, PathParamsContext } from '../shared/lib/hooks-clie
26
26
  import { onRecoverableError } from './react-client-callbacks/shared';
27
27
  import tracer from './tracing/tracer';
28
28
  import reportToSocket from './tracing/report-to-socket';
29
- export const version = "15.0.4-canary.13";
29
+ export const version = "15.0.4-canary.15";
30
30
  export let router;
31
31
  export const emitter = mitt();
32
32
  const looseToArray = (input)=>[].slice.call(input);
@@ -155,7 +155,7 @@ function assignDefaults(dir, userConfig, silent) {
155
155
  if (((_result_experimental = result.experimental) == null ? void 0 : _result_experimental.allowDevelopmentBuild) && process.env.NODE_ENV !== 'development') {
156
156
  throw new Error(`The experimental.allowDevelopmentBuild option requires NODE_ENV to be explicitly set to 'development'.`);
157
157
  }
158
- if (!((_process_env___NEXT_VERSION = "15.0.4-canary.13") == null ? void 0 : _process_env___NEXT_VERSION.includes('canary')) && !process.env.__NEXT_TEST_MODE && !process.env.NEXT_PRIVATE_SKIP_CANARY_CHECK) {
158
+ if (!((_process_env___NEXT_VERSION = "15.0.4-canary.15") == null ? void 0 : _process_env___NEXT_VERSION.includes('canary')) && !process.env.__NEXT_TEST_MODE && !process.env.NEXT_PRIVATE_SKIP_CANARY_CHECK) {
159
159
  var _result_experimental7, _result_experimental8, _result_experimental_turbo3, _result_experimental9;
160
160
  // Prevents usage of certain experimental features outside of canary
161
161
  if ((_result_experimental7 = result.experimental) == null ? void 0 : _result_experimental7.ppr) {
@@ -48,7 +48,7 @@ export async function createHotReloaderTurbopack(opts, serverFields, distDir, re
48
48
  }
49
49
  const hasRewrites = opts.fsChecker.rewrites.afterFiles.length > 0 || opts.fsChecker.rewrites.beforeFiles.length > 0 || opts.fsChecker.rewrites.fallback.length > 0;
50
50
  const hotReloaderSpan = trace('hot-reloader', undefined, {
51
- version: "15.0.4-canary.13"
51
+ version: "15.0.4-canary.15"
52
52
  });
53
53
  // Ensure the hotReloaderSpan is flushed immediately as it's the parentSpan for all processing
54
54
  // of the current `next dev` invocation.
@@ -184,7 +184,7 @@ export default class HotReloaderWebpack {
184
184
  this.previewProps = previewProps;
185
185
  this.rewrites = rewrites;
186
186
  this.hotReloaderSpan = trace('hot-reloader', undefined, {
187
- version: "15.0.4-canary.13"
187
+ version: "15.0.4-canary.15"
188
188
  });
189
189
  // Ensure the hotReloaderSpan is flushed immediately as it's the parentSpan for all processing
190
190
  // of the current `next dev` invocation.
@@ -4,7 +4,7 @@ import { bold, purple } from '../../lib/picocolors';
4
4
  import { PHASE_DEVELOPMENT_SERVER, PHASE_PRODUCTION_BUILD } from '../../shared/lib/constants';
5
5
  import loadConfig, { getEnabledExperimentalFeatures } from '../config';
6
6
  export function logStartInfo({ networkUrl, appUrl, envInfo, expFeatureInfo, maxExperimentalFeatures = Infinity }) {
7
- Log.bootstrap(`${bold(purple(`${Log.prefixes.ready} Next.js ${"15.0.4-canary.13"}`))}${process.env.TURBOPACK ? ' (Turbopack)' : ''}`);
7
+ Log.bootstrap(`${bold(purple(`${Log.prefixes.ready} Next.js ${"15.0.4-canary.15"}`))}${process.env.TURBOPACK ? ' (Turbopack)' : ''}`);
8
8
  if (appUrl) {
9
9
  Log.bootstrap(`- Local: ${appUrl}`);
10
10
  }
@@ -42,7 +42,7 @@ export async function getRequestHandlers({ dir, port, isDev, onCleanup, server,
42
42
  export async function startServer(serverOptions) {
43
43
  const { dir, isDev, hostname, minimalMode, allowRetry, keepAliveTimeout, selfSignedCertificate } = serverOptions;
44
44
  let { port } = serverOptions;
45
- process.title = `next-server (v${"15.0.4-canary.13"})`;
45
+ process.title = `next-server (v${"15.0.4-canary.15"})`;
46
46
  let handlersReady = ()=>{};
47
47
  let handlersError = ()=>{};
48
48
  let handlersPromise = new Promise((resolve, reject)=>{
@@ -234,7 +234,7 @@ function assignDefaults(dir, userConfig, silent) {
234
234
  if (((_result_experimental = result.experimental) == null ? void 0 : _result_experimental.allowDevelopmentBuild) && process.env.NODE_ENV !== 'development') {
235
235
  throw new Error(`The experimental.allowDevelopmentBuild option requires NODE_ENV to be explicitly set to 'development'.`);
236
236
  }
237
- if (!((_process_env___NEXT_VERSION = "15.0.4-canary.13") == null ? void 0 : _process_env___NEXT_VERSION.includes('canary')) && !process.env.__NEXT_TEST_MODE && !process.env.NEXT_PRIVATE_SKIP_CANARY_CHECK) {
237
+ if (!((_process_env___NEXT_VERSION = "15.0.4-canary.15") == null ? void 0 : _process_env___NEXT_VERSION.includes('canary')) && !process.env.__NEXT_TEST_MODE && !process.env.NEXT_PRIVATE_SKIP_CANARY_CHECK) {
238
238
  var _result_experimental7, _result_experimental8, _result_experimental_turbo3, _result_experimental9;
239
239
  // Prevents usage of certain experimental features outside of canary
240
240
  if ((_result_experimental7 = result.experimental) == null ? void 0 : _result_experimental7.ppr) {
@@ -104,7 +104,7 @@ async function createHotReloaderTurbopack(opts, serverFields, distDir, resetFetc
104
104
  }
105
105
  const hasRewrites = opts.fsChecker.rewrites.afterFiles.length > 0 || opts.fsChecker.rewrites.beforeFiles.length > 0 || opts.fsChecker.rewrites.fallback.length > 0;
106
106
  const hotReloaderSpan = (0, _trace.trace)('hot-reloader', undefined, {
107
- version: "15.0.4-canary.13"
107
+ version: "15.0.4-canary.15"
108
108
  });
109
109
  // Ensure the hotReloaderSpan is flushed immediately as it's the parentSpan for all processing
110
110
  // of the current `next dev` invocation.
@@ -260,7 +260,7 @@ class HotReloaderWebpack {
260
260
  this.previewProps = previewProps;
261
261
  this.rewrites = rewrites;
262
262
  this.hotReloaderSpan = (0, _trace.trace)('hot-reloader', undefined, {
263
- version: "15.0.4-canary.13"
263
+ version: "15.0.4-canary.15"
264
264
  });
265
265
  // Ensure the hotReloaderSpan is flushed immediately as it's the parentSpan for all processing
266
266
  // of the current `next dev` invocation.
@@ -67,7 +67,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
67
67
  return newObj;
68
68
  }
69
69
  function logStartInfo({ networkUrl, appUrl, envInfo, expFeatureInfo, maxExperimentalFeatures = Infinity }) {
70
- _log.bootstrap(`${(0, _picocolors.bold)((0, _picocolors.purple)(`${_log.prefixes.ready} Next.js ${"15.0.4-canary.13"}`))}${process.env.TURBOPACK ? ' (Turbopack)' : ''}`);
70
+ _log.bootstrap(`${(0, _picocolors.bold)((0, _picocolors.purple)(`${_log.prefixes.ready} Next.js ${"15.0.4-canary.15"}`))}${process.env.TURBOPACK ? ' (Turbopack)' : ''}`);
71
71
  if (appUrl) {
72
72
  _log.bootstrap(`- Local: ${appUrl}`);
73
73
  }
@@ -110,7 +110,7 @@ async function getRequestHandlers({ dir, port, isDev, onCleanup, server, hostnam
110
110
  async function startServer(serverOptions) {
111
111
  const { dir, isDev, hostname, minimalMode, allowRetry, keepAliveTimeout, selfSignedCertificate } = serverOptions;
112
112
  let { port } = serverOptions;
113
- process.title = `next-server (v${"15.0.4-canary.13"})`;
113
+ process.title = `next-server (v${"15.0.4-canary.15"})`;
114
114
  let handlersReady = ()=>{};
115
115
  let handlersError = ()=>{};
116
116
  let handlersPromise = new Promise((resolve, reject)=>{
@@ -81,7 +81,7 @@ function getAnonymousMeta() {
81
81
  isWsl: _iswsl.default,
82
82
  isCI: _ciinfo.isCI,
83
83
  ciName: _ciinfo.isCI && _ciinfo.name || null,
84
- nextVersion: "15.0.4-canary.13"
84
+ nextVersion: "15.0.4-canary.15"
85
85
  };
86
86
  return traits;
87
87
  }
@@ -11,11 +11,11 @@ Object.defineProperty(exports, "eventCliSessionStopped", {
11
11
  const EVENT_VERSION = 'NEXT_CLI_SESSION_STOPPED';
12
12
  function eventCliSessionStopped(event) {
13
13
  // This should be an invariant, if it fails our build tooling is broken.
14
- if (typeof "15.0.4-canary.13" !== 'string') {
14
+ if (typeof "15.0.4-canary.15" !== 'string') {
15
15
  return [];
16
16
  }
17
17
  const payload = {
18
- nextVersion: "15.0.4-canary.13",
18
+ nextVersion: "15.0.4-canary.15",
19
19
  nodeVersion: process.version,
20
20
  cliCommand: event.cliCommand,
21
21
  durationMilliseconds: event.durationMilliseconds,
@@ -36,12 +36,12 @@ function hasBabelConfig(dir) {
36
36
  function eventCliSession(dir, nextConfig, event) {
37
37
  var _nextConfig_experimental_staleTimes, _nextConfig_experimental_staleTimes1, _nextConfig_experimental_reactCompiler, _nextConfig_experimental_reactCompiler1;
38
38
  // This should be an invariant, if it fails our build tooling is broken.
39
- if (typeof "15.0.4-canary.13" !== 'string') {
39
+ if (typeof "15.0.4-canary.15" !== 'string') {
40
40
  return [];
41
41
  }
42
42
  const { images, i18n } = nextConfig || {};
43
43
  const payload = {
44
- nextVersion: "15.0.4-canary.13",
44
+ nextVersion: "15.0.4-canary.15",
45
45
  nodeVersion: process.version,
46
46
  cliCommand: event.cliCommand,
47
47
  isSrcDir: event.isSrcDir,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next",
3
- "version": "15.0.4-canary.13",
3
+ "version": "15.0.4-canary.15",
4
4
  "description": "The React Framework",
5
5
  "main": "./dist/server/next.js",
6
6
  "license": "MIT",
@@ -97,7 +97,7 @@
97
97
  ]
98
98
  },
99
99
  "dependencies": {
100
- "@next/env": "15.0.4-canary.13",
100
+ "@next/env": "15.0.4-canary.15",
101
101
  "@swc/counter": "0.1.3",
102
102
  "@swc/helpers": "0.5.13",
103
103
  "busboy": "1.6.0",
@@ -129,14 +129,14 @@
129
129
  },
130
130
  "optionalDependencies": {
131
131
  "sharp": "^0.33.5",
132
- "@next/swc-darwin-arm64": "15.0.4-canary.13",
133
- "@next/swc-darwin-x64": "15.0.4-canary.13",
134
- "@next/swc-linux-arm64-gnu": "15.0.4-canary.13",
135
- "@next/swc-linux-arm64-musl": "15.0.4-canary.13",
136
- "@next/swc-linux-x64-gnu": "15.0.4-canary.13",
137
- "@next/swc-linux-x64-musl": "15.0.4-canary.13",
138
- "@next/swc-win32-arm64-msvc": "15.0.4-canary.13",
139
- "@next/swc-win32-x64-msvc": "15.0.4-canary.13"
132
+ "@next/swc-darwin-arm64": "15.0.4-canary.15",
133
+ "@next/swc-darwin-x64": "15.0.4-canary.15",
134
+ "@next/swc-linux-arm64-gnu": "15.0.4-canary.15",
135
+ "@next/swc-linux-arm64-musl": "15.0.4-canary.15",
136
+ "@next/swc-linux-x64-gnu": "15.0.4-canary.15",
137
+ "@next/swc-linux-x64-musl": "15.0.4-canary.15",
138
+ "@next/swc-win32-arm64-msvc": "15.0.4-canary.15",
139
+ "@next/swc-win32-x64-msvc": "15.0.4-canary.15"
140
140
  },
141
141
  "devDependencies": {
142
142
  "@ampproject/toolbox-optimizer": "2.8.3",
@@ -169,11 +169,11 @@
169
169
  "@jest/types": "29.5.0",
170
170
  "@mswjs/interceptors": "0.23.0",
171
171
  "@napi-rs/triples": "1.2.0",
172
- "@next/font": "15.0.4-canary.13",
173
- "@next/polyfill-module": "15.0.4-canary.13",
174
- "@next/polyfill-nomodule": "15.0.4-canary.13",
175
- "@next/react-refresh-utils": "15.0.4-canary.13",
176
- "@next/swc": "15.0.4-canary.13",
172
+ "@next/font": "15.0.4-canary.15",
173
+ "@next/polyfill-module": "15.0.4-canary.15",
174
+ "@next/polyfill-nomodule": "15.0.4-canary.15",
175
+ "@next/react-refresh-utils": "15.0.4-canary.15",
176
+ "@next/swc": "15.0.4-canary.15",
177
177
  "@opentelemetry/api": "1.6.0",
178
178
  "@playwright/test": "1.41.2",
179
179
  "@swc/core": "1.7.0-nightly-20240714.1",