{"version":3,"file":"validateCompiler.mjs","names":[],"sources":["../../../src/config-dir/utils/validateCompiler.ts"],"sourcesContent":["import { type BaseWithGTConfigProps } from '../props/withGTConfigProps';\nimport { babelPluginCompatible } from '../../plugin/getStableNextVersionInfo';\nimport {\n  autoJsxInjectionCompilerWarning,\n  babelCompilerTurbopackUnavailableWarning,\n  createGTCompilerUnavailableWarning,\n  disablingCompileTimeHashWarning,\n  swcPluginCompatibilityChangeWarning,\n} from '../../errors/createErrors';\nimport { swcPluginCompatible } from '../../plugin/getStableNextVersionInfo';\n\n/**\n * Validate the compiler options\n * @param mergedConfig - The merged config\n * @description If the compiler is not compatible, set the type to 'none'\n */\nexport function validateCompiler(mergedConfig: BaseWithGTConfigProps) {\n  const turboPackEnabled = !!process.env.TURBOPACK;\n  if (!mergedConfig.experimentalCompilerOptions) return;\n  const type = mergedConfig.experimentalCompilerOptions.type;\n  if (type === 'swc' && !swcPluginCompatible) {\n    console.warn(createGTCompilerUnavailableWarning('swc'));\n    console.warn(swcPluginCompatibilityChangeWarning);\n    mergedConfig.experimentalCompilerOptions.type = 'none';\n  } else if (type === 'babel') {\n    if (turboPackEnabled) {\n      console.warn(babelCompilerTurbopackUnavailableWarning);\n    }\n    if (!babelPluginCompatible) {\n      console.warn(createGTCompilerUnavailableWarning('babel'));\n    }\n    if (turboPackEnabled || !babelPluginCompatible) {\n      mergedConfig.experimentalCompilerOptions.type = 'none';\n    }\n  }\n  // Backwards compatibility, remove this condition in the future\n  if (mergedConfig.experimentalCompilerOptions.compileTimeHash === false) {\n    console.warn(disablingCompileTimeHashWarning);\n    mergedConfig.experimentalCompilerOptions.type = 'none';\n  }\n  if (\n    mergedConfig.experimentalCompilerOptions.enableAutoJsxInjection &&\n    mergedConfig.experimentalCompilerOptions.type !== 'babel'\n  ) {\n    console.warn(autoJsxInjectionCompilerWarning);\n  }\n}\n"],"mappings":";;;;;;;;AAgBA,SAAgB,iBAAiB,cAAqC;CACpE,MAAM,mBAAmB,CAAC,CAAC,QAAQ,IAAI;AACvC,KAAI,CAAC,aAAa,4BAA6B;CAC/C,MAAM,OAAO,aAAa,4BAA4B;AACtD,KAAI,SAAS,SAAS,CAAC,qBAAqB;AAC1C,UAAQ,KAAK,mCAAmC,MAAM,CAAC;AACvD,UAAQ,KAAK,oCAAoC;AACjD,eAAa,4BAA4B,OAAO;YACvC,SAAS,SAAS;AAC3B,MAAI,iBACF,SAAQ,KAAK,yCAAyC;AAExD,MAAI,CAAC,sBACH,SAAQ,KAAK,mCAAmC,QAAQ,CAAC;AAE3D,MAAI,oBAAoB,CAAC,sBACvB,cAAa,4BAA4B,OAAO;;AAIpD,KAAI,aAAa,4BAA4B,oBAAoB,OAAO;AACtE,UAAQ,KAAK,gCAAgC;AAC7C,eAAa,4BAA4B,OAAO;;AAElD,KACE,aAAa,4BAA4B,0BACzC,aAAa,4BAA4B,SAAS,QAElD,SAAQ,KAAK,gCAAgC"}