{"version":3,"sources":["../../../src/build/swc/options.ts"],"sourcesContent":["import path from 'path'\nimport { 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 { shouldUseReactServerCondition, isWebpackAppPagesLayer } from '../utils'\nimport { escapeStringRegexp } from '../../shared/lib/escape-regexp'\n\nconst nextDirname = path.dirname(require.resolve('next/package.json'))\n\nconst nextDistPath = new RegExp(\n  `${escapeStringRegexp(nextDirname)}[\\\\/]dist[\\\\/](shared[\\\\/]lib|client|pages)`\n)\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  supportedBrowsers,\n  swcCacheDir,\n  serverComponents,\n  serverReferenceHashSalt,\n  bundleLayer,\n  isCacheComponents,\n  cacheHandlers,\n  useCacheEnabled,\n  trackDynamicImports,\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  supportedBrowsers: string[] | undefined\n  swcCacheDir?: string\n  serverComponents?: boolean\n  serverReferenceHashSalt: string\n  bundleLayer?: WebpackLayerName\n  isCacheComponents?: boolean\n  cacheHandlers?: ExperimentalConfig['cacheHandlers']\n  useCacheEnabled?: boolean\n  trackDynamicImports?: boolean\n}) {\n  const isReactServerLayer = shouldUseReactServerCondition(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: compilerOptions?.styledJsx ?? {\n      useLightningcss: jsConfig?.experimental?.useLightningcss ?? false,\n    },\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            cacheComponentsEnabled: isCacheComponents,\n            useCacheEnabled,\n          }\n        : undefined,\n    serverActions:\n      isAppRouterPagesLayer && !jest\n        ? {\n            isReactServerLayer,\n            isDevelopment: development,\n            useCacheEnabled,\n            hashSalt: serverReferenceHashSalt,\n            cacheKinds: ['default', 'remote', 'private'].concat(\n              cacheHandlers ? Object.keys(cacheHandlers) : []\n            ),\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    trackDynamicImports: trackDynamicImports,\n    debugFunctionName: development,\n\n    ...(supportedBrowsers && supportedBrowsers.length > 0\n      ? {\n          cssEnv: {\n            targets: supportedBrowsers,\n          },\n        }\n      : {}),\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  if (typeof emotionConfig === 'object' && emotionConfig.autoLabel) {\n    switch (emotionConfig.autoLabel) {\n      case 'never':\n        autoLabel = false\n        break\n      case 'always':\n        autoLabel = true\n        break\n      case 'dev-only':\n        break\n      default:\n        emotionConfig.autoLabel satisfies never\n    }\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    supportedBrowsers: undefined,\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  isCacheComponents,\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  useCacheEnabled,\n  trackDynamicImports,\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  isCacheComponents?: 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  useCacheEnabled?: boolean\n  trackDynamicImports?: boolean\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    supportedBrowsers,\n    swcCacheDir,\n    bundleLayer,\n    serverComponents,\n    serverReferenceHashSalt,\n    esm: !!esm,\n    isCacheComponents,\n    cacheHandlers,\n    useCacheEnabled,\n    trackDynamicImports,\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 (\n      options.jsc.transform.optimizer.globals?.typeofs &&\n      !filename.includes(nextDirname)\n    ) {\n      delete options.jsc.transform.optimizer.globals.typeofs.window\n    }\n  }\n\n  return options\n}\n"],"names":["path","WEBPACK_LAYERS","shouldUseReactServerCondition","isWebpackAppPagesLayer","escapeStringRegexp","nextDirname","dirname","require","resolve","nextDistPath","RegExp","nodeModulesPath","regeneratorRuntimePath","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","supportedBrowsers","swcCacheDir","serverComponents","serverReferenceHashSalt","bundleLayer","isCacheComponents","cacheHandlers","useCacheEnabled","trackDynamicImports","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","useLightningcss","getEmotionOptions","styledComponents","getStyledComponentsOptions","cacheComponentsEnabled","serverActions","isDevelopment","hashSalt","cacheKinds","concat","keys","preferEsm","lintCodemodComments","debugFunctionName","length","cssEnv","targets","styledComponentsConfig","displayName","emotionConfig","autoLabel","enabled","sourcemap","importMap","labelFormat","sourceMap","getJestSWCOptions","isServer","pagesDir","baseOptions","useCjsModules","env","node","module","type","disableNextSsg","disablePageConfig","getLoaderSWCOptions","appDir","isPageFile","optimizeServerReact","optimizePackageImports","relativeFilePathFromRoot","fontLoaders","cjsRequireOptimizer","packages","transforms","NextRequest","NextResponse","ImageResponse","userAgentFromString","userAgent","optimize_use_state","autoModularizeImports","isNodeModules","isAppBrowserLayer","appPagesBrowser","moduleResolutionConfig","isServerCompiler","target","includes"],"mappings":"AAAA,OAAOA,UAAU,OAAM;AACvB,SAASC,cAAc,QAA+B,sBAAqB;AAQ3E,SAASC,6BAA6B,EAAEC,sBAAsB,QAAQ,WAAU;AAChF,SAASC,kBAAkB,QAAQ,iCAAgC;AAEnE,MAAMC,cAAcL,KAAKM,OAAO,CAACC,QAAQC,OAAO,CAAC;AAEjD,MAAMC,eAAe,IAAIC,OACvB,GAAGN,mBAAmBC,aAAa,2CAA2C,CAAC;AAGjF,MAAMM,kBAAkB;AAExB,MAAMC,yBAAyBL,QAAQC,OAAO,CAC5C;AAGF,SAASK,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,aAAaL,aAAaS,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,IAAI;QACPO,QAAQL,cAAc,eAAe;QACrCM,eAAe;QACfC,YAAYN;QACZ,qKAAqK;QACrK,CAACD,cAAc,QAAQ,MAAM,EAAE,CAACD;QAChCS,kBAAkB;IACpB;AACF;AAEA,SAASC,kBAAkB,EACzBlB,QAAQ,EACRmB,IAAI,EACJC,WAAW,EACXC,eAAe,EACfC,YAAY,EACZC,GAAG,EACH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