{"version":3,"file":"cacheComponentsChecks.mjs","names":[],"sources":["../../../src/plugin/checks/cacheComponentsChecks.ts"],"sourcesContent":["import { NextConfig } from 'next';\nimport {\n  createCacheComponentsMissingRequestFunctionsWarning,\n  type CacheComponentsRequestFunction,\n  cacheComponentsNonLocalTranslationsWarning,\n} from '../../errors/cacheComponents';\nimport { RequestFunctionPaths } from '../../config-dir/utils/resolveRequestFunctionPaths';\n\nexport function cacheComponentsChecks({\n  nextConfig,\n  requestFunctionPaths,\n  localTranslationsEnabled,\n  localDictionaryEnabled,\n}: {\n  nextConfig: NextConfig;\n  requestFunctionPaths: RequestFunctionPaths;\n  localTranslationsEnabled: boolean;\n  localDictionaryEnabled: boolean;\n}) {\n  // Check: if cacheComponents is enabled, but no local translations or dictionary are enabled, warn\n  // this is necessary because it prevents executing a fetch when no local translations or dictionary are enabled\n  if (\n    nextConfig.cacheComponents &&\n    !localTranslationsEnabled &&\n    !localDictionaryEnabled\n  ) {\n    console.warn(cacheComponentsNonLocalTranslationsWarning);\n  }\n\n  if (nextConfig.cacheComponents) {\n    const missingRequestFunctions: CacheComponentsRequestFunction[] = [];\n    if (!requestFunctionPaths.getLocale) {\n      missingRequestFunctions.push('getLocale');\n    }\n    if (!requestFunctionPaths.getRegion) {\n      missingRequestFunctions.push('getRegion');\n    }\n\n    if (missingRequestFunctions.length) {\n      console.warn(\n        createCacheComponentsMissingRequestFunctionsWarning(\n          missingRequestFunctions\n        )\n      );\n    }\n  }\n}\n"],"mappings":";;AAQA,SAAgB,sBAAsB,EACpC,YACA,sBACA,0BACA,0BAMC;AAGD,KACE,WAAW,mBACX,CAAC,4BACD,CAAC,uBAED,SAAQ,KAAK,2CAA2C;AAG1D,KAAI,WAAW,iBAAiB;EAC9B,MAAM,0BAA4D,EAAE;AACpE,MAAI,CAAC,qBAAqB,UACxB,yBAAwB,KAAK,YAAY;AAE3C,MAAI,CAAC,qBAAqB,UACxB,yBAAwB,KAAK,YAAY;AAG3C,MAAI,wBAAwB,OAC1B,SAAQ,KACN,oDACE,wBACD,CACF"}