gt-next 11.1.3 → 11.1.4
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.
- package/CHANGELOG.md +13 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +13 -0
- package/dist/config.js.map +1 -1
- package/dist/config.mjs +14 -1
- package/dist/config.mjs.map +1 -1
- package/dist/errors/createErrors.d.ts +1 -0
- package/dist/errors/createErrors.d.ts.map +1 -1
- package/dist/errors/createErrors.js +8 -0
- package/dist/errors/createErrors.js.map +1 -1
- package/dist/errors/createErrors.mjs +8 -1
- package/dist/errors/createErrors.mjs.map +1 -1
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# gt-next
|
|
2
2
|
|
|
3
|
+
## 11.1.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#2005](https://github.com/generaltranslation/gt/pull/2005) [`6264532`](https://github.com/generaltranslation/gt/commit/62645327e27a6b55cf55c58201dd43a63bf31f53) Thanks [@eoinest](https://github.com/eoinest)! - Warn when locale settings in the GT config file differ from Next.js internationalized routing configuration.
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`bd961d1`](https://github.com/generaltranslation/gt/commit/bd961d1474547f7c6d470583c1b1190dce0112ca)]:
|
|
10
|
+
- generaltranslation@9.1.0
|
|
11
|
+
- @generaltranslation/compiler@1.3.35
|
|
12
|
+
- gt-i18n@1.0.10
|
|
13
|
+
- gt-react@11.1.4
|
|
14
|
+
- @generaltranslation/react-core@11.1.4
|
|
15
|
+
|
|
3
16
|
## 11.1.3
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAKvC,OAAO,EAEL,KAAK,iBAAiB,EACvB,MAAM,sCAAsC,CAAC;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAKvC,OAAO,EAEL,KAAK,iBAAiB,EACvB,MAAM,sCAAsC,CAAC;AAsE9C,KAAK,iBAAiB,CAAC,CAAC,IACtB,CAAC,SAAS,OAAO,CAAC,MAAM,CAAC,CAAC,GACtB,OAAO,CAAC,CAAC,GAAG,UAAU,CAAC,GACvB,CAAC,SAAS,WAAW,CAAC,MAAM,CAAC,CAAC,GAC5B,WAAW,CAAC,CAAC,GAAG,UAAU,CAAC,GAC3B,CAAC,GAAG,UAAU,CAAC;AAEvB,KAAK,kBAAkB,CAAC,WAAW,SAAS,MAAM,IAAI,WAAW,SAAS,CACxE,GAAG,IAAI,EAAE,MAAM,CAAC,KACb,MAAM,CAAC,GACR,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,iBAAiB,CAAC,CAAC,CAAC,GACpC,WAAW,GAAG,UAAU,CAAC;AAuD7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,wBAAgB,YAAY,CAAC,WAAW,SAAS,MAAM,GAAG,UAAU,EAClE,UAAU,CAAC,EAAE,WAAW,EACxB,KAAK,GAAE,iBAAsB,GAC5B,kBAAkB,CAAC,WAAW,CAAC,CA0tBjC"}
|
package/dist/config.js
CHANGED
|
@@ -20,6 +20,17 @@ let _generaltranslation_format = require("@generaltranslation/format");
|
|
|
20
20
|
function isThenable(value) {
|
|
21
21
|
return typeof value === "object" && value !== null && "then" in value && typeof value.then === "function";
|
|
22
22
|
}
|
|
23
|
+
function getNextI18nConfigMismatches(gtConfig, nextI18n) {
|
|
24
|
+
const mismatches = [];
|
|
25
|
+
if (gtConfig.defaultLocale !== void 0 && gtConfig.defaultLocale !== nextI18n.defaultLocale) mismatches.push(`defaultLocale: GT has ${JSON.stringify(gtConfig.defaultLocale)}; Next.js has ${JSON.stringify(nextI18n.defaultLocale)}`);
|
|
26
|
+
if (gtConfig.locales !== void 0 && !haveSameLocales(gtConfig.defaultLocale === void 0 ? gtConfig.locales : [gtConfig.defaultLocale, ...gtConfig.locales], nextI18n.locales)) mismatches.push(`locales: GT has ${JSON.stringify(gtConfig.locales)}; Next.js has ${JSON.stringify(nextI18n.locales)}`);
|
|
27
|
+
return mismatches;
|
|
28
|
+
}
|
|
29
|
+
function haveSameLocales(gtLocales, nextLocales) {
|
|
30
|
+
const gtLocaleSet = new Set(gtLocales);
|
|
31
|
+
const nextLocaleSet = new Set(nextLocales);
|
|
32
|
+
return gtLocaleSet.size === nextLocaleSet.size && Array.from(gtLocaleSet).every((locale) => nextLocaleSet.has(locale));
|
|
33
|
+
}
|
|
23
34
|
/**
|
|
24
35
|
* Initializes General Translation settings for a Next.js application.
|
|
25
36
|
*
|
|
@@ -88,6 +99,8 @@ function withGTConfig(nextConfig, props = {}) {
|
|
|
88
99
|
} catch (error) {
|
|
89
100
|
console.error("Error reading GT config file:", error);
|
|
90
101
|
}
|
|
102
|
+
const nextI18nConfigMismatches = internalNextConfig.i18n ? getNextI18nConfigMismatches(loadedConfig, internalNextConfig.i18n) : [];
|
|
103
|
+
if (nextI18nConfigMismatches.length > 0) console.warn(require_errors_createErrors.createNextI18nConfigMismatchWarning(nextI18nConfigMismatches));
|
|
91
104
|
const { projectId, apiKey, devApiKey } = require_setup_runtimeCredentials.getRuntimeCredentials();
|
|
92
105
|
const envConfig = {
|
|
93
106
|
...projectId ? { projectId } : {},
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","names":["defaultWithGTConfigProps","getRuntimeCredentials","conflictingConfigurationBuildError","createGTCompilerUnresolvedWarning","resolveConfigFilepath","resolveRequestFunctionPaths","createBadFilepathWarning","unresolvedLoadDictionaryBuildError","unresolvedLoadTranslationsBuildError","cacheComponentsMissingLoadTranslationsError","cacheComponentsDevHotReloadDisabledWarning","defaultCacheExpiryTime","invalidLocalesError","invalidCanonicalLocalesError","projectIdMissingWarn","devApiKeyIncludedInProductionError","APIKeyMissingWarn","standardizedLocalesWarning","standardizedCanonicalLocalesWarning","path","REQUEST_FUNCTION_ALIASES","turboConfigStable","rootParamStability"],"sources":["../src/config.ts"],"sourcesContent":["import path from 'path';\nimport fs from 'fs';\nimport type { NextConfig } from 'next';\nimport {\n defaultWithGTConfigProps,\n defaultCacheExpiryTime,\n} from './config-dir/props/defaultWithGTConfigProps';\nimport {\n type BaseWithGTConfigProps,\n type withGTConfigProps,\n} from './config-dir/props/withGTConfigProps';\nimport {\n APIKeyMissingWarn,\n conflictingConfigurationBuildError,\n createBadFilepathWarning,\n createGTCompilerUnresolvedWarning,\n devApiKeyIncludedInProductionError,\n invalidCanonicalLocalesError,\n invalidLocalesError,\n projectIdMissingWarn,\n standardizedCanonicalLocalesWarning,\n standardizedLocalesWarning,\n unresolvedLoadDictionaryBuildError,\n unresolvedLoadTranslationsBuildError,\n} from './errors/createErrors';\nimport { compilePathRegex } from './utils/pathRegex';\nimport {\n getLocaleProperties,\n isValidLocale,\n standardizeLocale,\n} from '@generaltranslation/format';\nimport type { CustomMapping } from '@generaltranslation/format/types';\nimport {\n rootParamStability,\n turboConfigStable,\n} from './plugin/getStableNextVersionInfo';\nimport { validateCompiler } from './config-dir/utils/validateCompiler';\nimport {\n REQUEST_FUNCTION_ALIASES,\n resolveRequestFunctionPaths,\n} from './config-dir/utils/resolveRequestFunctionPaths';\nimport { resolveConfigFilepath } from './config-dir/utils/resolveConfigFilepath';\nimport { cacheComponentsChecks } from './plugin/checks/cacheComponentsChecks';\nimport {\n cacheComponentsDevHotReloadDisabledWarning,\n cacheComponentsMissingLoadTranslationsError,\n} from './errors/cacheComponents';\nimport { getRuntimeCredentials } from './setup/runtimeCredentials';\nimport { nextLocaleCookieName } from './utils/cookies';\n\ntype AutoderiveConfig = boolean | { jsx?: boolean; strings?: boolean };\n\ntype ConfigFileShape = {\n customMapping?: CustomMapping;\n files?: {\n gt?: {\n parsingFlags?: {\n autoderive?: AutoderiveConfig;\n };\n };\n };\n};\n\ntype RuntimeCredentialProps = {\n apiKey?: string;\n devApiKey?: string;\n projectId?: string;\n};\n\ntype InternalGTConfigProps = BaseWithGTConfigProps &\n RuntimeCredentialProps &\n ConfigFileShape & {\n loadDictionaryEnabled?: boolean;\n loadTranslationsType?: 'remote' | 'custom' | 'disabled';\n _dictionaryFileType?: string;\n _cacheComponentsEnabled?: boolean;\n _disableDevHotReload?: boolean;\n };\n\ntype WithGTConfigValue<T> =\n T extends Promise<infer U>\n ? Promise<U & NextConfig>\n : T extends PromiseLike<infer U>\n ? PromiseLike<U & NextConfig>\n : T & NextConfig;\n\ntype WithGTConfigResult<TNextConfig extends object> = TNextConfig extends (\n ...args: infer A\n) => infer R\n ? (...args: A) => WithGTConfigValue<R>\n : TNextConfig & NextConfig;\n\nfunction isThenable(value: unknown): value is PromiseLike<NextConfig> {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'then' in value &&\n typeof value.then === 'function'\n );\n}\n\n/**\n * Initializes General Translation settings for a Next.js application.\n *\n * Use it in `next.config.js` to enable GT translation functionality as a plugin.\n *\n * @example\n * // In next.config.ts\n * import { withGTConfig } from 'gt-next/config';\n * import type { NextConfig } from 'next';\n *\n * const nextConfig = {\n * reactStrictMode: true,\n * } satisfies NextConfig;\n *\n * export default withGTConfig(nextConfig, {\n * locales: ['en', 'es', 'fr'],\n * defaultLocale: 'en'\n * })\n *\n * @param {string|undefined} config - Optional config filepath (defaults to './gt.config.json'). If a file is found, it will be parsed for GT config variables.\n * @param {string|undefined} dictionary - Optional dictionary configuration file path. If a string is provided, it will be used as a path.\n * @param {string|null} [runtimeUrl=defaultInitGTProps.runtimeUrl] - The base URL for the GT API. Set to an empty string to disable automatic translations. Set to null to disable.\n * @param {string|null} [cacheUrl=defaultInitGTProps.cacheUrl] - The URL for cached translations. Set to null to disable.\n * @param {string[]|undefined} - Whether to use local translations.\n * @param {string[]} [locales=defaultInitGTProps.locales] - List of supported locales for the application.\n * @param {string} [defaultLocale=defaultInitGTProps.defaultLocale] - The default locale to use if none is specified.\n * @param {string|undefined} [getLocalePath=\"getLocale\"] - The path to the custom getLocale function.\n * @param {string|undefined} [getRegionPath=\"getRegion\"] - The path to the custom getRegion function.\n * @param {object} [renderSettings=defaultInitGTProps.renderSettings] - Render settings for how translations should be handled.\n * @param {number} [cacheExpiryTime] - The time in milliseconds for how long translations should be cached.\n * @param {number} [maxConcurrentRequests=defaultInitGTProps.maxConcurrentRequests] - Maximum number of concurrent requests allowed.\n * @param {number} [maxBatchSize=defaultInitGTProps.maxBatchSize] - Maximum translation requests in the same batch.\n * @param {number} [batchInterval=defaultInitGTProps.batchInterval] - The interval in milliseconds between batched translation requests.\n * @param {boolean} [ignoreBrowserLocales=defaultWithGTConfigProps.ignoreBrowserLocales] - Whether to ignore browser's preferred locales.\n * @param {boolean} [disableInvalidLocaleWarning=defaultWithGTConfigProps.disableInvalidLocaleWarning] - Whether to disable invalid request locale warnings.\n * @param {string|undefined} [pathRegex] - Regular expression that request pathnames must match for i18n middleware to be applied.\n * @param {object} headersAndCookies - Additional headers and cookies that can be passed for extended configuration.\n * @param {object} metadata - Additional metadata that can be passed for extended configuration.\n *\n * @param {object} nextConfig - The Next.js configuration object to extend\n * @param {withGTConfigProps} props - General Translation configuration properties\n * @returns {NextConfig} - An updated Next.js config with GT settings applied\n *\n * @throws {Error} If the project ID is missing and default URLs are used, or if the API key is required and missing from the environment.\n */\nexport function withGTConfig<TNextConfig extends object = NextConfig>(\n nextConfig?: TNextConfig,\n props: withGTConfigProps = {}\n): WithGTConfigResult<TNextConfig> {\n // Next also accepts the `(phase, context) => config` function form. When given\n // one, call it and wrap the resolved config so `withGTConfig` composes with\n // other Next config plugins that return a config function — matching\n // `@sentry/nextjs`'s `withSentryConfig`. Without this, a function config would\n // be spread as a plain object below, silently dropping the user's config.\n if (typeof nextConfig === 'function') {\n const configFn = nextConfig as (\n phase: string,\n context: { defaultConfig: NextConfig }\n ) => NextConfig | Promise<NextConfig>;\n return ((phase: string, context: { defaultConfig: NextConfig }) => {\n const resolved = configFn(phase, context);\n return isThenable(resolved)\n ? resolved.then((resolvedConfig) => withGTConfig(resolvedConfig, props))\n : withGTConfig(resolved, props);\n }) as unknown as WithGTConfigResult<TNextConfig>;\n }\n\n const internalNextConfig = (nextConfig ?? {}) as unknown as NextConfig;\n\n // ---------- LOAD GT CONFIG FILE ---------- //\n\n let loadedConfig: Partial<InternalGTConfigProps> = {};\n try {\n let configPath: string | undefined;\n if (props.config) {\n configPath = props.config;\n } else if (fs.existsSync(defaultWithGTConfigProps.config)) {\n configPath = defaultWithGTConfigProps.config;\n } else if (fs.existsSync('./.gt/gt.config.json')) {\n // Support config under .gt for parity with .locadex\n configPath = './.gt/gt.config.json';\n } else if (fs.existsSync('./.locadex/gt.config.json')) {\n // Backward compatibility: support legacy .locadex directory\n configPath = './.locadex/gt.config.json';\n }\n if (typeof configPath === 'string' && fs.existsSync(configPath)) {\n const fileContent = fs.readFileSync(configPath, 'utf-8');\n loadedConfig = JSON.parse(fileContent);\n }\n } catch (error) {\n console.error('Error reading GT config file:', error);\n }\n\n // ---------- LOAD ENVIRONMENT VARIABLES ---------- //\n\n const { projectId, apiKey, devApiKey } = getRuntimeCredentials();\n\n // conditionally add environment variables to config\n const envConfig: Partial<InternalGTConfigProps> = {\n ...(projectId ? { projectId } : {}),\n ...(apiKey ? { apiKey } : {}),\n ...(devApiKey ? { devApiKey } : {}),\n };\n\n // ---------- CHECK FOR CONFIG CONFLICTS ---------- //\n\n // Check for conflicts between config and params\n const propsRecord = props as Record<string, unknown>;\n const conflicts = Object.entries(loadedConfig)\n .filter(([key, value]) => {\n // Skip if key doesn't exist in props\n if (!(key in props)) return false;\n\n const propValue = propsRecord[key];\n\n // Handle null/undefined values\n if (value == null || propValue == null) {\n return value !== propValue;\n }\n\n // Handle primitive types (string, number, boolean)\n if (typeof value !== 'object') {\n return value !== propValue;\n }\n\n // Handle arrays (no need for deep equality check)\n if (Array.isArray(value)) {\n if (!Array.isArray(propValue)) return true;\n if (value.length !== propValue.length) return true;\n return value.some((v, i) => v !== propValue[i]);\n }\n\n // Handle objects\n if (typeof value === 'object' && typeof propValue === 'object') {\n const valueRecord = value as Record<string, unknown>;\n const propRecord = propValue as Record<string, unknown>;\n const valueKeys = Object.keys(valueRecord);\n const propKeys = Object.keys(propRecord);\n const keys = new Set([...valueKeys, ...propKeys]);\n\n // Objects must match exactly (no need to go deeper)\n if (valueKeys.length !== propKeys.length) return true;\n return !Array.from(keys).every((k) => valueRecord[k] === propRecord[k]);\n }\n\n return false;\n })\n .map(\n ([key, value]) =>\n `- Key: ${key} Next Config: ${JSON.stringify(propsRecord[key])} does not match GT Config: ${JSON.stringify(value)}`\n );\n\n if (conflicts.length) {\n throw new Error(conflictingConfigurationBuildError(conflicts));\n }\n\n // ---------- MERGE CONFIGS ---------- //\n\n // Merge cookie and header names\n const nextLocaleDetectionEnabled =\n internalNextConfig.i18n !== null &&\n internalNextConfig.i18n !== undefined &&\n internalNextConfig.i18n.localeDetection !== false;\n const mergedHeadersAndCookies = {\n ...defaultWithGTConfigProps.headersAndCookies,\n ...props.headersAndCookies,\n // Next.js internationalized routing only reads its standard preference\n // cookie. Keep the user's i18n config untouched while aligning GT's\n // client-side locale persistence with the router.\n ...(nextLocaleDetectionEnabled && {\n localeCookieName: nextLocaleCookieName,\n }),\n };\n\n // Merge compiler options\n const mergedExperimentalCompilerOptions = {\n ...defaultWithGTConfigProps.experimentalCompilerOptions,\n ...props.experimentalCompilerOptions,\n };\n\n // precedence: input > env > config file > defaults\n const mergedConfig: InternalGTConfigProps = {\n ...defaultWithGTConfigProps,\n ...loadedConfig,\n ...envConfig,\n ...props,\n headersAndCookies: mergedHeadersAndCookies,\n experimentalCompilerOptions: mergedExperimentalCompilerOptions,\n _usingPlugin: true, // flag to indicate plugin usage\n };\n\n compilePathRegex(mergedConfig.pathRegex);\n\n // clear up any issues with the compiler options\n validateCompiler(mergedConfig);\n\n // ----------- RESOLVE ANY EXTERNAL FILES ----------- //\n\n // Resolve wasm filepath\n const turboPackEnabled = !!process.env.TURBOPACK;\n let resolvedWasmFilePath = '';\n if (mergedConfig.experimentalCompilerOptions?.type === 'swc') {\n try {\n if (turboPackEnabled) {\n const absolutePath = path.resolve(__dirname, './gt_swc_plugin.wasm');\n resolvedWasmFilePath =\n './' + path.relative(process.cwd(), absolutePath).replace(/\\\\/g, '/');\n } else {\n resolvedWasmFilePath = path.resolve(__dirname, './gt_swc_plugin.wasm');\n }\n } catch (error) {\n console.error(\n createGTCompilerUnresolvedWarning('swc'),\n 'Error message:',\n error\n );\n resolvedWasmFilePath = '';\n mergedConfig.experimentalCompilerOptions.type = 'none';\n }\n }\n\n // Resolve dictionary filepath\n let resolvedDictionaryFilePath =\n typeof mergedConfig.dictionary === 'string'\n ? mergedConfig.dictionary\n : resolveConfigFilepath('dictionary', ['.ts', '.js', '.json']); // fallback to dictionary\n\n // Check [defaultLocale].json file\n if (!resolvedDictionaryFilePath && mergedConfig.defaultLocale) {\n resolvedDictionaryFilePath = resolveConfigFilepath(\n mergedConfig.defaultLocale,\n ['.json']\n );\n\n // Check [defaultLanguageCode].json file\n if (!resolvedDictionaryFilePath) {\n const defaultLanguage = getLocaleProperties(\n mergedConfig.defaultLocale\n )?.languageCode;\n\n if (defaultLanguage && defaultLanguage !== mergedConfig.defaultLocale) {\n resolvedDictionaryFilePath = resolveConfigFilepath(defaultLanguage, [\n '.json',\n ]);\n }\n }\n }\n\n // Get the type of dictionary file\n const resolvedDictionaryFilePathType = resolvedDictionaryFilePath\n ? path.extname(resolvedDictionaryFilePath)\n : undefined;\n if (resolvedDictionaryFilePathType) {\n mergedConfig._dictionaryFileType = resolvedDictionaryFilePathType;\n }\n\n // Resolve custom dictionary loader path\n const customLoadDictionaryPath =\n typeof mergedConfig.loadDictionaryPath === 'string'\n ? mergedConfig.loadDictionaryPath\n : resolveConfigFilepath('loadDictionary');\n\n // Resolve custom translation loader path\n const customLoadTranslationsPath =\n typeof mergedConfig.loadTranslationsPath === 'string'\n ? mergedConfig.loadTranslationsPath\n : resolveConfigFilepath('loadTranslations');\n\n // Resolve request function paths\n const requestFunctionPaths = resolveRequestFunctionPaths(mergedConfig);\n\n // Warn if found in /app directory\n if (\n !resolvedDictionaryFilePath &&\n resolveConfigFilepath('dictionary', ['.ts', '.js', '.json'], undefined, [\n './app',\n './src/app',\n ])\n ) {\n console.warn(\n createBadFilepathWarning('dictionary', ['./app', './src/app'])\n );\n }\n\n if (\n !customLoadDictionaryPath &&\n resolveConfigFilepath(\n 'loadDictionary',\n ['.ts', '.js', '.json'],\n undefined,\n ['./app', './src/app']\n )\n ) {\n console.warn(\n createBadFilepathWarning('loadDictionary', ['./app', './src/app'])\n );\n }\n\n if (\n !customLoadTranslationsPath &&\n resolveConfigFilepath(\n 'loadTranslations',\n ['.ts', '.js', '.json'],\n undefined,\n ['./app', './src/app']\n )\n ) {\n console.warn(\n createBadFilepathWarning('loadTranslations', ['./app', './src/app'])\n );\n }\n\n // ----------- LOCALE STANDARDIZATION ----------- //\n\n // Check if using Services\n const gtRuntimeTranslationEnabled = !!(\n mergedConfig.runtimeUrl === defaultWithGTConfigProps.runtimeUrl &&\n ((process.env.NODE_ENV === 'production' && mergedConfig.apiKey) ||\n (process.env.NODE_ENV === 'development' && mergedConfig.devApiKey))\n );\n const gtRemoteCacheEnabled = !!(\n mergedConfig.cacheUrl === defaultWithGTConfigProps.cacheUrl &&\n mergedConfig.loadTranslationsType === 'remote'\n );\n const gtServicesEnabled = !!(\n (gtRuntimeTranslationEnabled || gtRemoteCacheEnabled) &&\n mergedConfig.projectId\n );\n\n // Standardize locales\n if (mergedConfig.locales && mergedConfig.defaultLocale) {\n mergedConfig.locales.unshift(mergedConfig.defaultLocale);\n }\n const updatedLocales: string[] = [];\n mergedConfig.locales = Array.from(new Set(mergedConfig.locales)).map(\n (locale) => {\n const updatedLocale = gtServicesEnabled\n ? standardizeLocale(locale)\n : locale;\n if (updatedLocale !== locale) {\n updatedLocales.push(`${locale} -> ${updatedLocale}`);\n }\n return updatedLocale;\n }\n );\n\n // Standardize canonical locales\n const updatedCanonicalLocales: string[] = [];\n if (mergedConfig.customMapping) {\n mergedConfig.customMapping = Object.fromEntries(\n Object.entries(mergedConfig.customMapping).map(([key, value]) => {\n if (typeof value !== 'object' || !('code' in value)) {\n return [key, value];\n }\n const updatedLocale = gtServicesEnabled\n ? standardizeLocale((value as { code: string }).code)\n : (value as { code: string }).code;\n if (updatedLocale !== (value as { code: string }).code) {\n updatedCanonicalLocales.push(`${key} -> ${updatedLocale}`);\n }\n return [\n key,\n {\n ...value,\n code: updatedLocale,\n },\n ];\n })\n );\n }\n\n // Run cache component checks\n cacheComponentsChecks({\n nextConfig: internalNextConfig,\n requestFunctionPaths,\n localTranslationsEnabled: !!customLoadTranslationsPath,\n localDictionaryEnabled: !!customLoadDictionaryPath,\n });\n\n // ---------- DERIVED CONFIG ATTRIBUTES ---------- //\n\n // Local dictionary flag\n if (customLoadDictionaryPath) {\n // Check: file exists if provided\n if (!fs.existsSync(path.resolve(customLoadDictionaryPath))) {\n throw new Error(\n unresolvedLoadDictionaryBuildError(customLoadDictionaryPath)\n );\n } else {\n mergedConfig.loadDictionaryEnabled = true;\n }\n } else {\n mergedConfig.loadDictionaryEnabled = false;\n }\n\n // Local translations flag\n if (customLoadTranslationsPath) {\n // Check: file exists if provided\n if (!fs.existsSync(path.resolve(customLoadTranslationsPath))) {\n throw new Error(\n unresolvedLoadTranslationsBuildError(customLoadTranslationsPath)\n );\n } else {\n mergedConfig.loadTranslationsType = 'custom';\n }\n } else {\n mergedConfig.loadTranslationsType = 'remote';\n }\n\n if (internalNextConfig.cacheComponents) {\n if (mergedConfig.loadTranslationsType !== 'custom') {\n throw new Error(cacheComponentsMissingLoadTranslationsError);\n }\n if (isDevHotReloadEnabled(mergedConfig)) {\n console.warn(cacheComponentsDevHotReloadDisabledWarning);\n }\n mergedConfig._cacheComponentsEnabled = true;\n mergedConfig._disableDevHotReload = true;\n mergedConfig.cacheExpiryTime = 0;\n }\n\n // Set default cache expiry if and only if no dev key\n if (\n mergedConfig.loadTranslationsType == 'remote' &&\n !mergedConfig.devApiKey &&\n typeof mergedConfig.cacheExpiryTime === 'undefined'\n ) {\n mergedConfig.cacheExpiryTime = defaultCacheExpiryTime;\n }\n\n // ---------- ERROR CHECKS ---------- //\n\n // Check: invalid locale\n if (!mergedConfig.customMapping && gtServicesEnabled) {\n const invalidLocales: string[] = [];\n mergedConfig.locales.forEach((locale) => {\n if (!isValidLocale(locale)) {\n invalidLocales.push(locale);\n }\n });\n if (invalidLocales.length) {\n throw new Error(invalidLocalesError(invalidLocales));\n }\n }\n\n // Check: invalid canonical locale\n if (mergedConfig.customMapping && gtServicesEnabled) {\n const invalidCanonicalLocales: string[] = [];\n mergedConfig.locales.forEach((locale) => {\n if (!isValidLocale(locale, mergedConfig.customMapping)) {\n invalidCanonicalLocales.push(locale);\n }\n });\n if (invalidCanonicalLocales.length) {\n throw new Error(invalidCanonicalLocalesError(invalidCanonicalLocales));\n }\n }\n\n // Check: projectId is not required for remote infrastructure, but warn if missing for dev, nothing for prod\n if (\n (mergedConfig.cacheUrl || mergedConfig.runtimeUrl) &&\n !mergedConfig.projectId &&\n process.env.NODE_ENV === 'development' &&\n mergedConfig.loadTranslationsType === 'remote' &&\n !mergedConfig.loadDictionaryEnabled // skip warn if using local dictionary\n ) {\n console.warn(projectIdMissingWarn);\n }\n\n // Check: dev API key should not be included in production\n if (process.env.NODE_ENV === 'production' && mergedConfig.devApiKey) {\n throw new Error(devApiKeyIncludedInProductionError);\n }\n\n // Check: An API key is required for runtime translation\n if (\n mergedConfig.projectId && // must have projectId for this check to matter anyways\n mergedConfig.runtimeUrl &&\n !(mergedConfig.apiKey || mergedConfig.devApiKey) &&\n process.env.NODE_ENV === 'development'\n ) {\n console.warn(APIKeyMissingWarn);\n }\n\n // Check: if using GT infrastructure, warn about unsupported locales\n if (gtServicesEnabled) {\n // Warn about standardized locales\n if (updatedLocales.length) {\n console.warn(standardizedLocalesWarning(updatedLocales));\n }\n\n // Warn about standardized canonical locales\n if (updatedCanonicalLocales.length) {\n console.warn(\n standardizedCanonicalLocalesWarning(updatedCanonicalLocales)\n );\n }\n }\n\n // ---------- STORE CONFIGURATIONS ---------- //\n const {\n projectId: _projectId,\n apiKey: _apiKey,\n devApiKey: _devApiKey,\n ...privateConfigParams\n } = mergedConfig;\n const I18NConfigParams = JSON.stringify(privateConfigParams);\n const clientI18NConfigParams = {\n defaultLocale: mergedConfig.defaultLocale,\n locales: mergedConfig.locales,\n customMapping: mergedConfig.customMapping,\n runtimeUrl: mergedConfig.runtimeUrl,\n cacheUrl: mergedConfig.cacheUrl,\n cacheExpiryTime: mergedConfig.cacheExpiryTime,\n maxConcurrentRequests: mergedConfig.maxConcurrentRequests,\n maxBatchSize: mergedConfig.maxBatchSize,\n batchInterval: mergedConfig.batchInterval,\n renderSettings: {\n timeout: mergedConfig.renderSettings?.timeout,\n },\n headersAndCookies: {\n localeCookieName: mergedConfig.headersAndCookies?.localeCookieName,\n enableI18nCookieName:\n mergedConfig.headersAndCookies?.enableI18nCookieName,\n },\n _versionId: mergedConfig._versionId,\n _disableDevHotReload: mergedConfig._disableDevHotReload,\n };\n\n const { type: _type, ...compilerOptions } =\n mergedConfig.experimentalCompilerOptions || {};\n\n // Read autoderive from parsingFlags (single source of truth shared with CLI)\n const rawAutoderive: boolean | { jsx?: boolean; strings?: boolean } =\n loadedConfig?.files?.gt?.parsingFlags?.autoderive ?? false;\n const autoderiveJsx =\n typeof rawAutoderive === 'boolean'\n ? rawAutoderive\n : (rawAutoderive.jsx ?? false);\n const autoderiveStrings =\n typeof rawAutoderive === 'boolean'\n ? rawAutoderive\n : (rawAutoderive.strings ?? false);\n\n const swcPluginOptions: Record<string, unknown> = {\n ...compilerOptions,\n autoderiveJsx,\n autoderiveStrings,\n };\n\n const swcPluginEntry: [string, Record<string, unknown>] | null =\n mergedConfig.experimentalCompilerOptions?.type === 'swc'\n ? [resolvedWasmFilePath, swcPluginOptions]\n : null;\n\n const turboAliases = {\n 'gt-next/internal/_dictionary': resolvedDictionaryFilePath || '',\n 'gt-next/internal/_load-translations': customLoadTranslationsPath || '',\n 'gt-next/internal/_load-dictionary': customLoadDictionaryPath || '',\n ...Object.fromEntries(\n Object.entries(requestFunctionPaths).map(([functionName, path]) => {\n return [\n REQUEST_FUNCTION_ALIASES[\n functionName as keyof typeof REQUEST_FUNCTION_ALIASES\n ],\n path,\n ];\n })\n ),\n };\n\n // experimental.turbo is deprecated in next@15.3.0.\n // Check for experimental.turbo. If we write to turbopack field, experimental fields will be ignored.\n // Yet, if there are other resolveAlias fields, we don't want to be ignored either.\n const experimentalTurbopack = !(\n turboConfigStable &&\n (!internalNextConfig.experimental?.turbo ||\n internalNextConfig.turbopack?.resolveAlias)\n );\n\n const config: NextConfig = {\n ...internalNextConfig,\n transpilePackages: Array.from(\n new Set([...(internalNextConfig.transpilePackages || []), 'gt-next'])\n ),\n env: {\n ...internalNextConfig.env,\n _GENERALTRANSLATION_I18N_CONFIG_PARAMS: I18NConfigParams,\n NEXT_PUBLIC_GENERALTRANSLATION_I18N_CONFIG_PARAMS: JSON.stringify(\n clientI18NConfigParams\n ),\n ...(resolvedDictionaryFilePathType && {\n _GENERALTRANSLATION_DICTIONARY_FILE_TYPE:\n resolvedDictionaryFilePathType,\n }),\n _GENERALTRANSLATION_LOCAL_DICTIONARY_ENABLED:\n mergedConfig.loadDictionaryEnabled.toString(),\n _GENERALTRANSLATION_LOCAL_TRANSLATION_ENABLED: (\n mergedConfig.loadTranslationsType === 'custom'\n ).toString(),\n _GENERALTRANSLATION_DEFAULT_LOCALE: (\n mergedConfig.defaultLocale ||\n defaultWithGTConfigProps.defaultLocale ||\n ''\n ).toString(),\n _GENERALTRANSLATION_GT_SERVICES_ENABLED: gtServicesEnabled.toString(),\n _GENERALTRANSLATION_IGNORE_BROWSER_LOCALES:\n mergedConfig.ignoreBrowserLocales?.toString() ||\n defaultWithGTConfigProps.ignoreBrowserLocales?.toString() ||\n 'false',\n _GENERALTRANSLATION_CUSTOM_GET_LOCALE_ENABLED:\n requestFunctionPaths.getLocale ? 'true' : 'false',\n _GENERALTRANSLATION_CUSTOM_GET_REGION_ENABLED:\n requestFunctionPaths.getRegion ? 'true' : 'false',\n _GENERALTRANSLATION_DISABLE_INVALID_LOCALE_WARNING:\n mergedConfig.disableInvalidLocaleWarning?.toString() || 'false',\n // nextConfig.env intentionally makes this available to client-boundary.tsx.\n ...(mergedConfig.pathRegex !== undefined && {\n _GENERALTRANSLATION_PATH_REGEX: mergedConfig.pathRegex,\n }),\n },\n ...(turboPackEnabled &&\n !experimentalTurbopack && {\n turbopack: {\n ...internalNextConfig.turbopack,\n resolveAlias: {\n ...internalNextConfig.turbopack?.resolveAlias,\n ...turboAliases,\n },\n },\n }),\n experimental: {\n ...internalNextConfig.experimental,\n ...(rootParamStability === 'experimental' && {\n rootParams: true,\n }),\n swcPlugins: [\n ...(internalNextConfig.experimental?.swcPlugins || []),\n ...(swcPluginEntry ? [swcPluginEntry] : []),\n ],\n ...(turboPackEnabled &&\n experimentalTurbopack && {\n turbo: {\n ...internalNextConfig.experimental?.turbo,\n resolveAlias: {\n ...internalNextConfig.experimental?.turbo?.resolveAlias,\n ...turboAliases,\n },\n },\n }),\n },\n webpack: function webpack(\n ...[webpackConfig, options]: Parameters<\n NonNullable<NextConfig['webpack']>\n >\n ) {\n // Only apply webpack aliases if we're using webpack (not Turbopack)\n if (!turboPackEnabled) {\n // Try to load GT compiler if available\n if (mergedConfig.experimentalCompilerOptions?.type === 'babel') {\n try {\n const {\n webpack: gtUnplugin,\n } = require('@generaltranslation/compiler');\n webpackConfig.plugins.unshift(\n gtUnplugin({\n ...mergedConfig.experimentalCompilerOptions,\n autoJsxImportSource: 'gt-next',\n })\n );\n } catch (e) {\n mergedConfig.experimentalCompilerOptions.type = 'none';\n console.warn(\n createGTCompilerUnresolvedWarning('babel'),\n 'Error message:',\n e\n );\n }\n }\n\n // Disable cache in dev bc people might move around loadTranslations() and loadDictionary() files\n if (process.env.NODE_ENV === 'development') {\n webpackConfig.cache = false;\n }\n if (resolvedDictionaryFilePath) {\n webpackConfig.resolve.alias['gt-next/internal/_dictionary'] =\n path.resolve(webpackConfig.context, resolvedDictionaryFilePath);\n }\n if (customLoadTranslationsPath) {\n webpackConfig.resolve.alias[`gt-next/internal/_load-translations`] =\n path.resolve(webpackConfig.context, customLoadTranslationsPath);\n }\n if (customLoadDictionaryPath) {\n webpackConfig.resolve.alias[`gt-next/internal/_load-dictionary`] =\n path.resolve(webpackConfig.context, customLoadDictionaryPath);\n }\n for (const [functionName, pathString] of Object.entries(\n requestFunctionPaths\n )) {\n const key =\n REQUEST_FUNCTION_ALIASES[\n functionName as keyof typeof REQUEST_FUNCTION_ALIASES\n ];\n webpackConfig.resolve.alias[key] = path.resolve(\n webpackConfig.context,\n pathString\n );\n }\n // Webpack parses .mjs as strict ESM and does not treat require()\n // calls as dependencies, so the require()-backed internal aliases\n // above would never apply and their runtime errors are swallowed\n // (loaders silently no-op). Parse gt-next's ESM dist as\n // javascript/auto so webpack picks up those require() calls.\n // Server compilation only: the call sites are server-only, and this\n // keeps the rule from ever pulling a user's loader file into the\n // client bundle. Turbopack resolves them through resolveAlias and\n // needs no rule.\n // The guard mirrors the alias block above: any configured alias\n // enables the rule. The request-function aliases are static-imported\n // (initGT.server), and resolve.alias applies at resolution regardless\n // of parser mode, so they work without the rule; they gate it anyway\n // for symmetry and for any future require()-backed consumer.\n if (\n options.isServer &&\n (resolvedDictionaryFilePath ||\n customLoadTranslationsPath ||\n customLoadDictionaryPath ||\n Object.keys(requestFunctionPaths).length > 0)\n ) {\n // gt-next normally resolves inside a node_modules dir (app-local,\n // hoisted monorepo root, or the pnpm store), but symlinked installs\n // (workspace:*, file:) resolve to a real path with no node_modules\n // segment — so also match this package's dist dir, where this\n // compiled file lives.\n const gtNextDistDirs: (string | RegExp)[] = [\n /node_modules[\\\\/]gt-next[\\\\/]dist[\\\\/]/,\n ];\n try {\n // Trust __dirname only when it verifiably is gt-next's dist: a\n // bundler that inlines this file elsewhere would otherwise widen\n // the rule to every .mjs under its output dir. The compiled\n // config always sits beside its ESM twin and the internal\n // modules these aliases target.\n if (\n fs.existsSync(path.join(__dirname, 'config.mjs')) &&\n fs.existsSync(path.join(__dirname, 'internal', '_dictionary.mjs'))\n ) {\n gtNextDistDirs.push(__dirname + path.sep);\n }\n } catch {\n // __dirname is undefined when the ESM dist of this module is\n // loaded natively; the node_modules pattern still applies.\n }\n webpackConfig.module ??= {};\n webpackConfig.module.rules ??= [];\n webpackConfig.module.rules.push({\n test: /\\.mjs$/,\n include: gtNextDistDirs,\n type: 'javascript/auto',\n });\n }\n }\n if (typeof internalNextConfig?.webpack === 'function') {\n return internalNextConfig.webpack(webpackConfig, options);\n }\n return webpackConfig;\n },\n };\n return config as WithGTConfigResult<TNextConfig>;\n}\n\nfunction isDevHotReloadEnabled(config: InternalGTConfigProps): boolean {\n return (\n !!config.devApiKey &&\n !!config.projectId &&\n config.runtimeUrl !== null &&\n config.runtimeUrl !== '' &&\n process.env.NODE_ENV === 'development'\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA4FA,SAAS,WAAW,OAAkD;AACpE,QACE,OAAO,UAAU,YACjB,UAAU,QACV,UAAU,SACV,OAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiD1B,SAAgB,aACd,YACA,QAA2B,EAAE,EACI;AAMjC,KAAI,OAAO,eAAe,YAAY;EACpC,MAAM,WAAW;AAIjB,WAAS,OAAe,YAA2C;GACjE,MAAM,WAAW,SAAS,OAAO,QAAQ;AACzC,UAAO,WAAW,SAAS,GACvB,SAAS,MAAM,mBAAmB,aAAa,gBAAgB,M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KAMA,MAAM,iBAAsC,CAC1C,yCACD;AACD,SAAI;AAMF,UACE,GAAA,QAAG,WAAW,KAAA,QAAK,KAAK,WAAW,aAAa,CAAC,IACjD,GAAA,QAAG,WAAW,KAAA,QAAK,KAAK,WAAW,YAAY,kBAAkB,CAAC,CAElE,gBAAe,KAAK,YAAY,KAAA,QAAK,IAAI;aAErC;AAIR,mBAAc,WAAW,EAAE;AAC3B,mBAAc,OAAO,UAAU,EAAE;AACjC,mBAAc,OAAO,MAAM,KAAK;MAC9B,MAAM;MACN,SAAS;MACT,MAAM;MACP,CAAC;;;AAGN,OAAI,OAAO,oBAAoB,YAAY,WACzC,QAAO,mBAAmB,QAAQ,eAAe,QAAQ;AAE3D,UAAO;;EAGE;;AAGf,SAAS,sBAAsB,QAAwC;AACrE,QACE,CAAC,CAAC,OAAO,aACT,CAAC,CAAC,OAAO,aACT,OAAO,eAAe,QACtB,OAAO,eAAe,MACtB,QAAQ,IAAI,aAAa"}
|
|
1
|
+
{"version":3,"file":"config.js","names":["defaultWithGTConfigProps","createNextI18nConfigMismatchWarning","getRuntimeCredentials","conflictingConfigurationBuildError","createGTCompilerUnresolvedWarning","resolveConfigFilepath","resolveRequestFunctionPaths","createBadFilepathWarning","unresolvedLoadDictionaryBuildError","unresolvedLoadTranslationsBuildError","cacheComponentsMissingLoadTranslationsError","cacheComponentsDevHotReloadDisabledWarning","defaultCacheExpiryTime","invalidLocalesError","invalidCanonicalLocalesError","projectIdMissingWarn","devApiKeyIncludedInProductionError","APIKeyMissingWarn","standardizedLocalesWarning","standardizedCanonicalLocalesWarning","path","REQUEST_FUNCTION_ALIASES","turboConfigStable","rootParamStability"],"sources":["../src/config.ts"],"sourcesContent":["import path from 'path';\nimport fs from 'fs';\nimport type { NextConfig } from 'next';\nimport {\n defaultWithGTConfigProps,\n defaultCacheExpiryTime,\n} from './config-dir/props/defaultWithGTConfigProps';\nimport {\n type BaseWithGTConfigProps,\n type withGTConfigProps,\n} from './config-dir/props/withGTConfigProps';\nimport {\n APIKeyMissingWarn,\n conflictingConfigurationBuildError,\n createBadFilepathWarning,\n createGTCompilerUnresolvedWarning,\n createNextI18nConfigMismatchWarning,\n devApiKeyIncludedInProductionError,\n invalidCanonicalLocalesError,\n invalidLocalesError,\n projectIdMissingWarn,\n standardizedCanonicalLocalesWarning,\n standardizedLocalesWarning,\n unresolvedLoadDictionaryBuildError,\n unresolvedLoadTranslationsBuildError,\n} from './errors/createErrors';\nimport { compilePathRegex } from './utils/pathRegex';\nimport {\n getLocaleProperties,\n isValidLocale,\n standardizeLocale,\n} from '@generaltranslation/format';\nimport type { CustomMapping } from '@generaltranslation/format/types';\nimport {\n rootParamStability,\n turboConfigStable,\n} from './plugin/getStableNextVersionInfo';\nimport { validateCompiler } from './config-dir/utils/validateCompiler';\nimport {\n REQUEST_FUNCTION_ALIASES,\n resolveRequestFunctionPaths,\n} from './config-dir/utils/resolveRequestFunctionPaths';\nimport { resolveConfigFilepath } from './config-dir/utils/resolveConfigFilepath';\nimport { cacheComponentsChecks } from './plugin/checks/cacheComponentsChecks';\nimport {\n cacheComponentsDevHotReloadDisabledWarning,\n cacheComponentsMissingLoadTranslationsError,\n} from './errors/cacheComponents';\nimport { getRuntimeCredentials } from './setup/runtimeCredentials';\nimport { nextLocaleCookieName } from './utils/cookies';\n\ntype AutoderiveConfig = boolean | { jsx?: boolean; strings?: boolean };\n\ntype ConfigFileShape = {\n customMapping?: CustomMapping;\n files?: {\n gt?: {\n parsingFlags?: {\n autoderive?: AutoderiveConfig;\n };\n };\n };\n};\n\ntype RuntimeCredentialProps = {\n apiKey?: string;\n devApiKey?: string;\n projectId?: string;\n};\n\ntype InternalGTConfigProps = BaseWithGTConfigProps &\n RuntimeCredentialProps &\n ConfigFileShape & {\n loadDictionaryEnabled?: boolean;\n loadTranslationsType?: 'remote' | 'custom' | 'disabled';\n _dictionaryFileType?: string;\n _cacheComponentsEnabled?: boolean;\n _disableDevHotReload?: boolean;\n };\n\ntype WithGTConfigValue<T> =\n T extends Promise<infer U>\n ? Promise<U & NextConfig>\n : T extends PromiseLike<infer U>\n ? PromiseLike<U & NextConfig>\n : T & NextConfig;\n\ntype WithGTConfigResult<TNextConfig extends object> = TNextConfig extends (\n ...args: infer A\n) => infer R\n ? (...args: A) => WithGTConfigValue<R>\n : TNextConfig & NextConfig;\n\nfunction isThenable(value: unknown): value is PromiseLike<NextConfig> {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'then' in value &&\n typeof value.then === 'function'\n );\n}\n\nfunction getNextI18nConfigMismatches(\n gtConfig: Partial<InternalGTConfigProps>,\n nextI18n: NonNullable<NextConfig['i18n']>\n): string[] {\n const mismatches: string[] = [];\n\n if (\n gtConfig.defaultLocale !== undefined &&\n gtConfig.defaultLocale !== nextI18n.defaultLocale\n ) {\n mismatches.push(\n `defaultLocale: GT has ${JSON.stringify(gtConfig.defaultLocale)}; Next.js has ${JSON.stringify(nextI18n.defaultLocale)}`\n );\n }\n\n if (\n gtConfig.locales !== undefined &&\n !haveSameLocales(\n gtConfig.defaultLocale === undefined\n ? gtConfig.locales\n : [gtConfig.defaultLocale, ...gtConfig.locales],\n nextI18n.locales\n )\n ) {\n mismatches.push(\n `locales: GT has ${JSON.stringify(gtConfig.locales)}; Next.js has ${JSON.stringify(nextI18n.locales)}`\n );\n }\n\n return mismatches;\n}\n\nfunction haveSameLocales(\n gtLocales: readonly string[],\n nextLocales: readonly string[]\n): boolean {\n const gtLocaleSet = new Set(gtLocales);\n const nextLocaleSet = new Set(nextLocales);\n return (\n gtLocaleSet.size === nextLocaleSet.size &&\n Array.from(gtLocaleSet).every((locale) => nextLocaleSet.has(locale))\n );\n}\n\n/**\n * Initializes General Translation settings for a Next.js application.\n *\n * Use it in `next.config.js` to enable GT translation functionality as a plugin.\n *\n * @example\n * // In next.config.ts\n * import { withGTConfig } from 'gt-next/config';\n * import type { NextConfig } from 'next';\n *\n * const nextConfig = {\n * reactStrictMode: true,\n * } satisfies NextConfig;\n *\n * export default withGTConfig(nextConfig, {\n * locales: ['en', 'es', 'fr'],\n * defaultLocale: 'en'\n * })\n *\n * @param {string|undefined} config - Optional config filepath (defaults to './gt.config.json'). If a file is found, it will be parsed for GT config variables.\n * @param {string|undefined} dictionary - Optional dictionary configuration file path. If a string is provided, it will be used as a path.\n * @param {string|null} [runtimeUrl=defaultInitGTProps.runtimeUrl] - The base URL for the GT API. Set to an empty string to disable automatic translations. Set to null to disable.\n * @param {string|null} [cacheUrl=defaultInitGTProps.cacheUrl] - The URL for cached translations. Set to null to disable.\n * @param {string[]|undefined} - Whether to use local translations.\n * @param {string[]} [locales=defaultInitGTProps.locales] - List of supported locales for the application.\n * @param {string} [defaultLocale=defaultInitGTProps.defaultLocale] - The default locale to use if none is specified.\n * @param {string|undefined} [getLocalePath=\"getLocale\"] - The path to the custom getLocale function.\n * @param {string|undefined} [getRegionPath=\"getRegion\"] - The path to the custom getRegion function.\n * @param {object} [renderSettings=defaultInitGTProps.renderSettings] - Render settings for how translations should be handled.\n * @param {number} [cacheExpiryTime] - The time in milliseconds for how long translations should be cached.\n * @param {number} [maxConcurrentRequests=defaultInitGTProps.maxConcurrentRequests] - Maximum number of concurrent requests allowed.\n * @param {number} [maxBatchSize=defaultInitGTProps.maxBatchSize] - Maximum translation requests in the same batch.\n * @param {number} [batchInterval=defaultInitGTProps.batchInterval] - The interval in milliseconds between batched translation requests.\n * @param {boolean} [ignoreBrowserLocales=defaultWithGTConfigProps.ignoreBrowserLocales] - Whether to ignore browser's preferred locales.\n * @param {boolean} [disableInvalidLocaleWarning=defaultWithGTConfigProps.disableInvalidLocaleWarning] - Whether to disable invalid request locale warnings.\n * @param {string|undefined} [pathRegex] - Regular expression that request pathnames must match for i18n middleware to be applied.\n * @param {object} headersAndCookies - Additional headers and cookies that can be passed for extended configuration.\n * @param {object} metadata - Additional metadata that can be passed for extended configuration.\n *\n * @param {object} nextConfig - The Next.js configuration object to extend\n * @param {withGTConfigProps} props - General Translation configuration properties\n * @returns {NextConfig} - An updated Next.js config with GT settings applied\n *\n * @throws {Error} If the project ID is missing and default URLs are used, or if the API key is required and missing from the environment.\n */\nexport function withGTConfig<TNextConfig extends object = NextConfig>(\n nextConfig?: TNextConfig,\n props: withGTConfigProps = {}\n): WithGTConfigResult<TNextConfig> {\n // Next also accepts the `(phase, context) => config` function form. When given\n // one, call it and wrap the resolved config so `withGTConfig` composes with\n // other Next config plugins that return a config function — matching\n // `@sentry/nextjs`'s `withSentryConfig`. Without this, a function config would\n // be spread as a plain object below, silently dropping the user's config.\n if (typeof nextConfig === 'function') {\n const configFn = nextConfig as (\n phase: string,\n context: { defaultConfig: NextConfig }\n ) => NextConfig | Promise<NextConfig>;\n return ((phase: string, context: { defaultConfig: NextConfig }) => {\n const resolved = configFn(phase, context);\n return isThenable(resolved)\n ? resolved.then((resolvedConfig) => withGTConfig(resolvedConfig, props))\n : withGTConfig(resolved, props);\n }) as unknown as WithGTConfigResult<TNextConfig>;\n }\n\n const internalNextConfig = (nextConfig ?? {}) as unknown as NextConfig;\n\n // ---------- LOAD GT CONFIG FILE ---------- //\n\n let loadedConfig: Partial<InternalGTConfigProps> = {};\n try {\n let configPath: string | undefined;\n if (props.config) {\n configPath = props.config;\n } else if (fs.existsSync(defaultWithGTConfigProps.config)) {\n configPath = defaultWithGTConfigProps.config;\n } else if (fs.existsSync('./.gt/gt.config.json')) {\n // Support config under .gt for parity with .locadex\n configPath = './.gt/gt.config.json';\n } else if (fs.existsSync('./.locadex/gt.config.json')) {\n // Backward compatibility: support legacy .locadex directory\n configPath = './.locadex/gt.config.json';\n }\n if (typeof configPath === 'string' && fs.existsSync(configPath)) {\n const fileContent = fs.readFileSync(configPath, 'utf-8');\n loadedConfig = JSON.parse(fileContent);\n }\n } catch (error) {\n console.error('Error reading GT config file:', error);\n }\n\n // This warning intentionally compares Next.js i18n against explicit values\n // from the GT config file. Inline props use the conflict and merge paths below.\n const nextI18nConfigMismatches = internalNextConfig.i18n\n ? getNextI18nConfigMismatches(loadedConfig, internalNextConfig.i18n)\n : [];\n if (nextI18nConfigMismatches.length > 0) {\n console.warn(createNextI18nConfigMismatchWarning(nextI18nConfigMismatches));\n }\n\n // ---------- LOAD ENVIRONMENT VARIABLES ---------- //\n\n const { projectId, apiKey, devApiKey } = getRuntimeCredentials();\n\n // conditionally add environment variables to config\n const envConfig: Partial<InternalGTConfigProps> = {\n ...(projectId ? { projectId } : {}),\n ...(apiKey ? { apiKey } : {}),\n ...(devApiKey ? { devApiKey } : {}),\n };\n\n // ---------- CHECK FOR CONFIG CONFLICTS ---------- //\n\n // Check for conflicts between config and params\n const propsRecord = props as Record<string, unknown>;\n const conflicts = Object.entries(loadedConfig)\n .filter(([key, value]) => {\n // Skip if key doesn't exist in props\n if (!(key in props)) return false;\n\n const propValue = propsRecord[key];\n\n // Handle null/undefined values\n if (value == null || propValue == null) {\n return value !== propValue;\n }\n\n // Handle primitive types (string, number, boolean)\n if (typeof value !== 'object') {\n return value !== propValue;\n }\n\n // Handle arrays (no need for deep equality check)\n if (Array.isArray(value)) {\n if (!Array.isArray(propValue)) return true;\n if (value.length !== propValue.length) return true;\n return value.some((v, i) => v !== propValue[i]);\n }\n\n // Handle objects\n if (typeof value === 'object' && typeof propValue === 'object') {\n const valueRecord = value as Record<string, unknown>;\n const propRecord = propValue as Record<string, unknown>;\n const valueKeys = Object.keys(valueRecord);\n const propKeys = Object.keys(propRecord);\n const keys = new Set([...valueKeys, ...propKeys]);\n\n // Objects must match exactly (no need to go deeper)\n if (valueKeys.length !== propKeys.length) return true;\n return !Array.from(keys).every((k) => valueRecord[k] === propRecord[k]);\n }\n\n return false;\n })\n .map(\n ([key, value]) =>\n `- Key: ${key} Next Config: ${JSON.stringify(propsRecord[key])} does not match GT Config: ${JSON.stringify(value)}`\n );\n\n if (conflicts.length) {\n throw new Error(conflictingConfigurationBuildError(conflicts));\n }\n\n // ---------- MERGE CONFIGS ---------- //\n\n // Merge cookie and header names\n const nextLocaleDetectionEnabled =\n internalNextConfig.i18n !== null &&\n internalNextConfig.i18n !== undefined &&\n internalNextConfig.i18n.localeDetection !== false;\n const mergedHeadersAndCookies = {\n ...defaultWithGTConfigProps.headersAndCookies,\n ...props.headersAndCookies,\n // Next.js internationalized routing only reads its standard preference\n // cookie. Keep the user's i18n config untouched while aligning GT's\n // client-side locale persistence with the router.\n ...(nextLocaleDetectionEnabled && {\n localeCookieName: nextLocaleCookieName,\n }),\n };\n\n // Merge compiler options\n const mergedExperimentalCompilerOptions = {\n ...defaultWithGTConfigProps.experimentalCompilerOptions,\n ...props.experimentalCompilerOptions,\n };\n\n // precedence: input > env > config file > defaults\n const mergedConfig: InternalGTConfigProps = {\n ...defaultWithGTConfigProps,\n ...loadedConfig,\n ...envConfig,\n ...props,\n headersAndCookies: mergedHeadersAndCookies,\n experimentalCompilerOptions: mergedExperimentalCompilerOptions,\n _usingPlugin: true, // flag to indicate plugin usage\n };\n\n compilePathRegex(mergedConfig.pathRegex);\n\n // clear up any issues with the compiler options\n validateCompiler(mergedConfig);\n\n // ----------- RESOLVE ANY EXTERNAL FILES ----------- //\n\n // Resolve wasm filepath\n const turboPackEnabled = !!process.env.TURBOPACK;\n let resolvedWasmFilePath = '';\n if (mergedConfig.experimentalCompilerOptions?.type === 'swc') {\n try {\n if (turboPackEnabled) {\n const absolutePath = path.resolve(__dirname, './gt_swc_plugin.wasm');\n resolvedWasmFilePath =\n './' + path.relative(process.cwd(), absolutePath).replace(/\\\\/g, '/');\n } else {\n resolvedWasmFilePath = path.resolve(__dirname, './gt_swc_plugin.wasm');\n }\n } catch (error) {\n console.error(\n createGTCompilerUnresolvedWarning('swc'),\n 'Error message:',\n error\n );\n resolvedWasmFilePath = '';\n mergedConfig.experimentalCompilerOptions.type = 'none';\n }\n }\n\n // Resolve dictionary filepath\n let resolvedDictionaryFilePath =\n typeof mergedConfig.dictionary === 'string'\n ? mergedConfig.dictionary\n : resolveConfigFilepath('dictionary', ['.ts', '.js', '.json']); // fallback to dictionary\n\n // Check [defaultLocale].json file\n if (!resolvedDictionaryFilePath && mergedConfig.defaultLocale) {\n resolvedDictionaryFilePath = resolveConfigFilepath(\n mergedConfig.defaultLocale,\n ['.json']\n );\n\n // Check [defaultLanguageCode].json file\n if (!resolvedDictionaryFilePath) {\n const defaultLanguage = getLocaleProperties(\n mergedConfig.defaultLocale\n )?.languageCode;\n\n if (defaultLanguage && defaultLanguage !== mergedConfig.defaultLocale) {\n resolvedDictionaryFilePath = resolveConfigFilepath(defaultLanguage, [\n '.json',\n ]);\n }\n }\n }\n\n // Get the type of dictionary file\n const resolvedDictionaryFilePathType = resolvedDictionaryFilePath\n ? path.extname(resolvedDictionaryFilePath)\n : undefined;\n if (resolvedDictionaryFilePathType) {\n mergedConfig._dictionaryFileType = resolvedDictionaryFilePathType;\n }\n\n // Resolve custom dictionary loader path\n const customLoadDictionaryPath =\n typeof mergedConfig.loadDictionaryPath === 'string'\n ? mergedConfig.loadDictionaryPath\n : resolveConfigFilepath('loadDictionary');\n\n // Resolve custom translation loader path\n const customLoadTranslationsPath =\n typeof mergedConfig.loadTranslationsPath === 'string'\n ? mergedConfig.loadTranslationsPath\n : resolveConfigFilepath('loadTranslations');\n\n // Resolve request function paths\n const requestFunctionPaths = resolveRequestFunctionPaths(mergedConfig);\n\n // Warn if found in /app directory\n if (\n !resolvedDictionaryFilePath &&\n resolveConfigFilepath('dictionary', ['.ts', '.js', '.json'], undefined, [\n './app',\n './src/app',\n ])\n ) {\n console.warn(\n createBadFilepathWarning('dictionary', ['./app', './src/app'])\n );\n }\n\n if (\n !customLoadDictionaryPath &&\n resolveConfigFilepath(\n 'loadDictionary',\n ['.ts', '.js', '.json'],\n undefined,\n ['./app', './src/app']\n )\n ) {\n console.warn(\n createBadFilepathWarning('loadDictionary', ['./app', './src/app'])\n );\n }\n\n if (\n !customLoadTranslationsPath &&\n resolveConfigFilepath(\n 'loadTranslations',\n ['.ts', '.js', '.json'],\n undefined,\n ['./app', './src/app']\n )\n ) {\n console.warn(\n createBadFilepathWarning('loadTranslations', ['./app', './src/app'])\n );\n }\n\n // ----------- LOCALE STANDARDIZATION ----------- //\n\n // Check if using Services\n const gtRuntimeTranslationEnabled = !!(\n mergedConfig.runtimeUrl === defaultWithGTConfigProps.runtimeUrl &&\n ((process.env.NODE_ENV === 'production' && mergedConfig.apiKey) ||\n (process.env.NODE_ENV === 'development' && mergedConfig.devApiKey))\n );\n const gtRemoteCacheEnabled = !!(\n mergedConfig.cacheUrl === defaultWithGTConfigProps.cacheUrl &&\n mergedConfig.loadTranslationsType === 'remote'\n );\n const gtServicesEnabled = !!(\n (gtRuntimeTranslationEnabled || gtRemoteCacheEnabled) &&\n mergedConfig.projectId\n );\n\n // Standardize locales\n if (mergedConfig.locales && mergedConfig.defaultLocale) {\n mergedConfig.locales.unshift(mergedConfig.defaultLocale);\n }\n const updatedLocales: string[] = [];\n mergedConfig.locales = Array.from(new Set(mergedConfig.locales)).map(\n (locale) => {\n const updatedLocale = gtServicesEnabled\n ? standardizeLocale(locale)\n : locale;\n if (updatedLocale !== locale) {\n updatedLocales.push(`${locale} -> ${updatedLocale}`);\n }\n return updatedLocale;\n }\n );\n\n // Standardize canonical locales\n const updatedCanonicalLocales: string[] = [];\n if (mergedConfig.customMapping) {\n mergedConfig.customMapping = Object.fromEntries(\n Object.entries(mergedConfig.customMapping).map(([key, value]) => {\n if (typeof value !== 'object' || !('code' in value)) {\n return [key, value];\n }\n const updatedLocale = gtServicesEnabled\n ? standardizeLocale((value as { code: string }).code)\n : (value as { code: string }).code;\n if (updatedLocale !== (value as { code: string }).code) {\n updatedCanonicalLocales.push(`${key} -> ${updatedLocale}`);\n }\n return [\n key,\n {\n ...value,\n code: updatedLocale,\n },\n ];\n })\n );\n }\n\n // Run cache component checks\n cacheComponentsChecks({\n nextConfig: internalNextConfig,\n requestFunctionPaths,\n localTranslationsEnabled: !!customLoadTranslationsPath,\n localDictionaryEnabled: !!customLoadDictionaryPath,\n });\n\n // ---------- DERIVED CONFIG ATTRIBUTES ---------- //\n\n // Local dictionary flag\n if (customLoadDictionaryPath) {\n // Check: file exists if provided\n if (!fs.existsSync(path.resolve(customLoadDictionaryPath))) {\n throw new Error(\n unresolvedLoadDictionaryBuildError(customLoadDictionaryPath)\n );\n } else {\n mergedConfig.loadDictionaryEnabled = true;\n }\n } else {\n mergedConfig.loadDictionaryEnabled = false;\n }\n\n // Local translations flag\n if (customLoadTranslationsPath) {\n // Check: file exists if provided\n if (!fs.existsSync(path.resolve(customLoadTranslationsPath))) {\n throw new Error(\n unresolvedLoadTranslationsBuildError(customLoadTranslationsPath)\n );\n } else {\n mergedConfig.loadTranslationsType = 'custom';\n }\n } else {\n mergedConfig.loadTranslationsType = 'remote';\n }\n\n if (internalNextConfig.cacheComponents) {\n if (mergedConfig.loadTranslationsType !== 'custom') {\n throw new Error(cacheComponentsMissingLoadTranslationsError);\n }\n if (isDevHotReloadEnabled(mergedConfig)) {\n console.warn(cacheComponentsDevHotReloadDisabledWarning);\n }\n mergedConfig._cacheComponentsEnabled = true;\n mergedConfig._disableDevHotReload = true;\n mergedConfig.cacheExpiryTime = 0;\n }\n\n // Set default cache expiry if and only if no dev key\n if (\n mergedConfig.loadTranslationsType == 'remote' &&\n !mergedConfig.devApiKey &&\n typeof mergedConfig.cacheExpiryTime === 'undefined'\n ) {\n mergedConfig.cacheExpiryTime = defaultCacheExpiryTime;\n }\n\n // ---------- ERROR CHECKS ---------- //\n\n // Check: invalid locale\n if (!mergedConfig.customMapping && gtServicesEnabled) {\n const invalidLocales: string[] = [];\n mergedConfig.locales.forEach((locale) => {\n if (!isValidLocale(locale)) {\n invalidLocales.push(locale);\n }\n });\n if (invalidLocales.length) {\n throw new Error(invalidLocalesError(invalidLocales));\n }\n }\n\n // Check: invalid canonical locale\n if (mergedConfig.customMapping && gtServicesEnabled) {\n const invalidCanonicalLocales: string[] = [];\n mergedConfig.locales.forEach((locale) => {\n if (!isValidLocale(locale, mergedConfig.customMapping)) {\n invalidCanonicalLocales.push(locale);\n }\n });\n if (invalidCanonicalLocales.length) {\n throw new Error(invalidCanonicalLocalesError(invalidCanonicalLocales));\n }\n }\n\n // Check: projectId is not required for remote infrastructure, but warn if missing for dev, nothing for prod\n if (\n (mergedConfig.cacheUrl || mergedConfig.runtimeUrl) &&\n !mergedConfig.projectId &&\n process.env.NODE_ENV === 'development' &&\n mergedConfig.loadTranslationsType === 'remote' &&\n !mergedConfig.loadDictionaryEnabled // skip warn if using local dictionary\n ) {\n console.warn(projectIdMissingWarn);\n }\n\n // Check: dev API key should not be included in production\n if (process.env.NODE_ENV === 'production' && mergedConfig.devApiKey) {\n throw new Error(devApiKeyIncludedInProductionError);\n }\n\n // Check: An API key is required for runtime translation\n if (\n mergedConfig.projectId && // must have projectId for this check to matter anyways\n mergedConfig.runtimeUrl &&\n !(mergedConfig.apiKey || mergedConfig.devApiKey) &&\n process.env.NODE_ENV === 'development'\n ) {\n console.warn(APIKeyMissingWarn);\n }\n\n // Check: if using GT infrastructure, warn about unsupported locales\n if (gtServicesEnabled) {\n // Warn about standardized locales\n if (updatedLocales.length) {\n console.warn(standardizedLocalesWarning(updatedLocales));\n }\n\n // Warn about standardized canonical locales\n if (updatedCanonicalLocales.length) {\n console.warn(\n standardizedCanonicalLocalesWarning(updatedCanonicalLocales)\n );\n }\n }\n\n // ---------- STORE CONFIGURATIONS ---------- //\n const {\n projectId: _projectId,\n apiKey: _apiKey,\n devApiKey: _devApiKey,\n ...privateConfigParams\n } = mergedConfig;\n const I18NConfigParams = JSON.stringify(privateConfigParams);\n const clientI18NConfigParams = {\n defaultLocale: mergedConfig.defaultLocale,\n locales: mergedConfig.locales,\n customMapping: mergedConfig.customMapping,\n runtimeUrl: mergedConfig.runtimeUrl,\n cacheUrl: mergedConfig.cacheUrl,\n cacheExpiryTime: mergedConfig.cacheExpiryTime,\n maxConcurrentRequests: mergedConfig.maxConcurrentRequests,\n maxBatchSize: mergedConfig.maxBatchSize,\n batchInterval: mergedConfig.batchInterval,\n renderSettings: {\n timeout: mergedConfig.renderSettings?.timeout,\n },\n headersAndCookies: {\n localeCookieName: mergedConfig.headersAndCookies?.localeCookieName,\n enableI18nCookieName:\n mergedConfig.headersAndCookies?.enableI18nCookieName,\n },\n _versionId: mergedConfig._versionId,\n _disableDevHotReload: mergedConfig._disableDevHotReload,\n };\n\n const { type: _type, ...compilerOptions } =\n mergedConfig.experimentalCompilerOptions || {};\n\n // Read autoderive from parsingFlags (single source of truth shared with CLI)\n const rawAutoderive: boolean | { jsx?: boolean; strings?: boolean } =\n loadedConfig?.files?.gt?.parsingFlags?.autoderive ?? false;\n const autoderiveJsx =\n typeof rawAutoderive === 'boolean'\n ? rawAutoderive\n : (rawAutoderive.jsx ?? false);\n const autoderiveStrings =\n typeof rawAutoderive === 'boolean'\n ? rawAutoderive\n : (rawAutoderive.strings ?? false);\n\n const swcPluginOptions: Record<string, unknown> = {\n ...compilerOptions,\n autoderiveJsx,\n autoderiveStrings,\n };\n\n const swcPluginEntry: [string, Record<string, unknown>] | null =\n mergedConfig.experimentalCompilerOptions?.type === 'swc'\n ? [resolvedWasmFilePath, swcPluginOptions]\n : null;\n\n const turboAliases = {\n 'gt-next/internal/_dictionary': resolvedDictionaryFilePath || '',\n 'gt-next/internal/_load-translations': customLoadTranslationsPath || '',\n 'gt-next/internal/_load-dictionary': customLoadDictionaryPath || '',\n ...Object.fromEntries(\n Object.entries(requestFunctionPaths).map(([functionName, path]) => {\n return [\n REQUEST_FUNCTION_ALIASES[\n functionName as keyof typeof REQUEST_FUNCTION_ALIASES\n ],\n path,\n ];\n })\n ),\n };\n\n // experimental.turbo is deprecated in next@15.3.0.\n // Check for experimental.turbo. If we write to turbopack field, experimental fields will be ignored.\n // Yet, if there are other resolveAlias fields, we don't want to be ignored either.\n const experimentalTurbopack = !(\n turboConfigStable &&\n (!internalNextConfig.experimental?.turbo ||\n internalNextConfig.turbopack?.resolveAlias)\n );\n\n const config: NextConfig = {\n ...internalNextConfig,\n transpilePackages: Array.from(\n new Set([...(internalNextConfig.transpilePackages || []), 'gt-next'])\n ),\n env: {\n ...internalNextConfig.env,\n _GENERALTRANSLATION_I18N_CONFIG_PARAMS: I18NConfigParams,\n NEXT_PUBLIC_GENERALTRANSLATION_I18N_CONFIG_PARAMS: JSON.stringify(\n clientI18NConfigParams\n ),\n ...(resolvedDictionaryFilePathType && {\n _GENERALTRANSLATION_DICTIONARY_FILE_TYPE:\n resolvedDictionaryFilePathType,\n }),\n _GENERALTRANSLATION_LOCAL_DICTIONARY_ENABLED:\n mergedConfig.loadDictionaryEnabled.toString(),\n _GENERALTRANSLATION_LOCAL_TRANSLATION_ENABLED: (\n mergedConfig.loadTranslationsType === 'custom'\n ).toString(),\n _GENERALTRANSLATION_DEFAULT_LOCALE: (\n mergedConfig.defaultLocale ||\n defaultWithGTConfigProps.defaultLocale ||\n ''\n ).toString(),\n _GENERALTRANSLATION_GT_SERVICES_ENABLED: gtServicesEnabled.toString(),\n _GENERALTRANSLATION_IGNORE_BROWSER_LOCALES:\n mergedConfig.ignoreBrowserLocales?.toString() ||\n defaultWithGTConfigProps.ignoreBrowserLocales?.toString() ||\n 'false',\n _GENERALTRANSLATION_CUSTOM_GET_LOCALE_ENABLED:\n requestFunctionPaths.getLocale ? 'true' : 'false',\n _GENERALTRANSLATION_CUSTOM_GET_REGION_ENABLED:\n requestFunctionPaths.getRegion ? 'true' : 'false',\n _GENERALTRANSLATION_DISABLE_INVALID_LOCALE_WARNING:\n mergedConfig.disableInvalidLocaleWarning?.toString() || 'false',\n // nextConfig.env intentionally makes this available to client-boundary.tsx.\n ...(mergedConfig.pathRegex !== undefined && {\n _GENERALTRANSLATION_PATH_REGEX: mergedConfig.pathRegex,\n }),\n },\n ...(turboPackEnabled &&\n !experimentalTurbopack && {\n turbopack: {\n ...internalNextConfig.turbopack,\n resolveAlias: {\n ...internalNextConfig.turbopack?.resolveAlias,\n ...turboAliases,\n },\n },\n }),\n experimental: {\n ...internalNextConfig.experimental,\n ...(rootParamStability === 'experimental' && {\n rootParams: true,\n }),\n swcPlugins: [\n ...(internalNextConfig.experimental?.swcPlugins || []),\n ...(swcPluginEntry ? [swcPluginEntry] : []),\n ],\n ...(turboPackEnabled &&\n experimentalTurbopack && {\n turbo: {\n ...internalNextConfig.experimental?.turbo,\n resolveAlias: {\n ...internalNextConfig.experimental?.turbo?.resolveAlias,\n ...turboAliases,\n },\n },\n }),\n },\n webpack: function webpack(\n ...[webpackConfig, options]: Parameters<\n NonNullable<NextConfig['webpack']>\n >\n ) {\n // Only apply webpack aliases if we're using webpack (not Turbopack)\n if (!turboPackEnabled) {\n // Try to load GT compiler if available\n if (mergedConfig.experimentalCompilerOptions?.type === 'babel') {\n try {\n const {\n webpack: gtUnplugin,\n } = require('@generaltranslation/compiler');\n webpackConfig.plugins.unshift(\n gtUnplugin({\n ...mergedConfig.experimentalCompilerOptions,\n autoJsxImportSource: 'gt-next',\n })\n );\n } catch (e) {\n mergedConfig.experimentalCompilerOptions.type = 'none';\n console.warn(\n createGTCompilerUnresolvedWarning('babel'),\n 'Error message:',\n e\n );\n }\n }\n\n // Disable cache in dev bc people might move around loadTranslations() and loadDictionary() files\n if (process.env.NODE_ENV === 'development') {\n webpackConfig.cache = false;\n }\n if (resolvedDictionaryFilePath) {\n webpackConfig.resolve.alias['gt-next/internal/_dictionary'] =\n path.resolve(webpackConfig.context, resolvedDictionaryFilePath);\n }\n if (customLoadTranslationsPath) {\n webpackConfig.resolve.alias[`gt-next/internal/_load-translations`] =\n path.resolve(webpackConfig.context, customLoadTranslationsPath);\n }\n if (customLoadDictionaryPath) {\n webpackConfig.resolve.alias[`gt-next/internal/_load-dictionary`] =\n path.resolve(webpackConfig.context, customLoadDictionaryPath);\n }\n for (const [functionName, pathString] of Object.entries(\n requestFunctionPaths\n )) {\n const key =\n REQUEST_FUNCTION_ALIASES[\n functionName as keyof typeof REQUEST_FUNCTION_ALIASES\n ];\n webpackConfig.resolve.alias[key] = path.resolve(\n webpackConfig.context,\n pathString\n );\n }\n // Webpack parses .mjs as strict ESM and does not treat require()\n // calls as dependencies, so the require()-backed internal aliases\n // above would never apply and their runtime errors are swallowed\n // (loaders silently no-op). Parse gt-next's ESM dist as\n // javascript/auto so webpack picks up those require() calls.\n // Server compilation only: the call sites are server-only, and this\n // keeps the rule from ever pulling a user's loader file into the\n // client bundle. Turbopack resolves them through resolveAlias and\n // needs no rule.\n // The guard mirrors the alias block above: any configured alias\n // enables the rule. The request-function aliases are static-imported\n // (initGT.server), and resolve.alias applies at resolution regardless\n // of parser mode, so they work without the rule; they gate it anyway\n // for symmetry and for any future require()-backed consumer.\n if (\n options.isServer &&\n (resolvedDictionaryFilePath ||\n customLoadTranslationsPath ||\n customLoadDictionaryPath ||\n Object.keys(requestFunctionPaths).length > 0)\n ) {\n // gt-next normally resolves inside a node_modules dir (app-local,\n // hoisted monorepo root, or the pnpm store), but symlinked installs\n // (workspace:*, file:) resolve to a real path with no node_modules\n // segment — so also match this package's dist dir, where this\n // compiled file lives.\n const gtNextDistDirs: (string | RegExp)[] = [\n /node_modules[\\\\/]gt-next[\\\\/]dist[\\\\/]/,\n ];\n try {\n // Trust __dirname only when it verifiably is gt-next's dist: a\n // bundler that inlines this file elsewhere would otherwise widen\n // the rule to every .mjs under its output dir. The compiled\n // config always sits beside its ESM twin and the internal\n // modules these aliases target.\n if (\n fs.existsSync(path.join(__dirname, 'config.mjs')) &&\n fs.existsSync(path.join(__dirname, 'internal', '_dictionary.mjs'))\n ) {\n gtNextDistDirs.push(__dirname + path.sep);\n }\n } catch {\n // __dirname is undefined when the ESM dist of this module is\n // loaded natively; the node_modules pattern still applies.\n }\n webpackConfig.module ??= {};\n webpackConfig.module.rules ??= [];\n webpackConfig.module.rules.push({\n test: /\\.mjs$/,\n include: gtNextDistDirs,\n type: 'javascript/auto',\n });\n }\n }\n if (typeof internalNextConfig?.webpack === 'function') {\n return internalNextConfig.webpack(webpackConfig, options);\n }\n return webpackConfig;\n },\n };\n return config as WithGTConfigResult<TNextConfig>;\n}\n\nfunction isDevHotReloadEnabled(config: InternalGTConfigProps): boolean {\n return (\n !!config.devApiKey &&\n !!config.projectId &&\n config.runtimeUrl !== null &&\n config.runtimeUrl !== '' &&\n process.env.NODE_ENV === 'development'\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA6FA,SAAS,WAAW,OAAkD;AACpE,QACE,OAAO,UAAU,YACjB,UAAU,QACV,UAAU,SACV,OAAO,MAAM,SAAS;;AAI1B,SAAS,4BACP,UACA,UACU;CACV,MAAM,aAAuB,EAAE;AAE/B,KACE,SAAS,kBAAkB,KAAA,KAC3B,SAAS,kBAAkB,SAAS,cAEpC,YAAW,KACT,yBAAyB,KAAK,UAAU,SAAS,cAAc,CAAC,gBAAgB,KAAK,UAAU,SAAS,cAAc,GACvH;AAGH,KACE,SAAS,YAAY,KAAA,KACrB,CAAC,gBACC,SAAS,kBAAkB,KAAA,IACvB,SAAS,UACT,CAAC,SAAS,eAAe,GAAG,SAAS,QAAQ,EACjD,SAAS,QACV,CAED,YAAW,KACT,mBAAmB,KAAK,UAAU,SAAS,QAAQ,CAAC,gBAAgB,KAAK,UAAU,SAAS,QAAQ,GACrG;AAGH,QAAO;;AAGT,SAAS,gBACP,WACA,aACS;CACT,MAAM,cAAc,IAAI,IAAI,UAAU;CACtC,MAAM,gBAAgB,IAAI,IAAI,YAAY;AAC1C,QACE,YAAY,SAAS,cAAc,QACnC,MAAM,KAAK,YAAY,CAAC,OAAO,WAAW,cAAc,IAAI,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiDxE,SAAgB,aACd,YACA,QAA2B,EAAE,EACI;AAMjC,KAAI,OAAO,eAAe,YAAY;EACpC,MAAM,WAAW;AAIjB,WAAS,OAAe,YAA2C;GACjE,MAAM,WAAW,SAAS,OAAO,QAAQ;AACzC,UAAO,WAAW,SAAS,GACvB,SAAS,MAAM,mBAAmB,aAAa,gBAAgB,MAAM,CAAC,GACtE,aAAa,UAAU,MAAM;;;CAIrC,MAAM,qBAAsB,cAAc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ACd,WACD;;AAgBH,QACE,QAAQ,aACP,8BACC,8BACA,4BACA,OAAO,KAAK,qBAAqB,CAAC,SAAS,IAC7C;KAMA,MAAM,iBAAsC,CAC1C,yCACD;AACD,SAAI;AAMF,UACE,GAAA,QAAG,WAAW,KAAA,QAAK,KAAK,WAAW,aAAa,CAAC,IACjD,GAAA,QAAG,WAAW,KAAA,QAAK,KAAK,WAAW,YAAY,kBAAkB,CAAC,CAElE,gBAAe,KAAK,YAAY,KAAA,QAAK,IAAI;aAErC;AAIR,mBAAc,WAAW,EAAE;AAC3B,mBAAc,OAAO,UAAU,EAAE;AACjC,mBAAc,OAAO,MAAM,KAAK;MAC9B,MAAM;MACN,SAAS;MACT,MAAM;MACP,CAAC;;;AAGN,OAAI,OAAO,oBAAoB,YAAY,WACzC,QAAO,mBAAmB,QAAQ,eAAe,QAAQ;AAE3D,UAAO;;EAGE;;AAGf,SAAS,sBAAsB,QAAwC;AACrE,QACE,CAAC,CAAC,OAAO,aACT,CAAC,CAAC,OAAO,aACT,OAAO,eAAe,QACtB,OAAO,eAAe,MACtB,QAAQ,IAAI,aAAa"}
|
package/dist/config.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./utils/cookies.mjs";
|
|
2
2
|
import { defaultCacheExpiryTime, defaultWithGTConfigProps } from "./config-dir/props/defaultWithGTConfigProps.mjs";
|
|
3
|
-
import { APIKeyMissingWarn, conflictingConfigurationBuildError, createBadFilepathWarning, createGTCompilerUnresolvedWarning, devApiKeyIncludedInProductionError, invalidCanonicalLocalesError, invalidLocalesError, projectIdMissingWarn, standardizedCanonicalLocalesWarning, standardizedLocalesWarning, unresolvedLoadDictionaryBuildError, unresolvedLoadTranslationsBuildError } from "./errors/createErrors.mjs";
|
|
3
|
+
import { APIKeyMissingWarn, conflictingConfigurationBuildError, createBadFilepathWarning, createGTCompilerUnresolvedWarning, createNextI18nConfigMismatchWarning, devApiKeyIncludedInProductionError, invalidCanonicalLocalesError, invalidLocalesError, projectIdMissingWarn, standardizedCanonicalLocalesWarning, standardizedLocalesWarning, unresolvedLoadDictionaryBuildError, unresolvedLoadTranslationsBuildError } from "./errors/createErrors.mjs";
|
|
4
4
|
import { compilePathRegex } from "./utils/pathRegex.mjs";
|
|
5
5
|
import { rootParamStability, turboConfigStable } from "./plugin/getStableNextVersionInfo.mjs";
|
|
6
6
|
import { validateCompiler } from "./config-dir/utils/validateCompiler.mjs";
|
|
@@ -16,6 +16,17 @@ import { getLocaleProperties, isValidLocale, standardizeLocale } from "@generalt
|
|
|
16
16
|
function isThenable(value) {
|
|
17
17
|
return typeof value === "object" && value !== null && "then" in value && typeof value.then === "function";
|
|
18
18
|
}
|
|
19
|
+
function getNextI18nConfigMismatches(gtConfig, nextI18n) {
|
|
20
|
+
const mismatches = [];
|
|
21
|
+
if (gtConfig.defaultLocale !== void 0 && gtConfig.defaultLocale !== nextI18n.defaultLocale) mismatches.push(`defaultLocale: GT has ${JSON.stringify(gtConfig.defaultLocale)}; Next.js has ${JSON.stringify(nextI18n.defaultLocale)}`);
|
|
22
|
+
if (gtConfig.locales !== void 0 && !haveSameLocales(gtConfig.defaultLocale === void 0 ? gtConfig.locales : [gtConfig.defaultLocale, ...gtConfig.locales], nextI18n.locales)) mismatches.push(`locales: GT has ${JSON.stringify(gtConfig.locales)}; Next.js has ${JSON.stringify(nextI18n.locales)}`);
|
|
23
|
+
return mismatches;
|
|
24
|
+
}
|
|
25
|
+
function haveSameLocales(gtLocales, nextLocales) {
|
|
26
|
+
const gtLocaleSet = new Set(gtLocales);
|
|
27
|
+
const nextLocaleSet = new Set(nextLocales);
|
|
28
|
+
return gtLocaleSet.size === nextLocaleSet.size && Array.from(gtLocaleSet).every((locale) => nextLocaleSet.has(locale));
|
|
29
|
+
}
|
|
19
30
|
/**
|
|
20
31
|
* Initializes General Translation settings for a Next.js application.
|
|
21
32
|
*
|
|
@@ -84,6 +95,8 @@ function withGTConfig(nextConfig, props = {}) {
|
|
|
84
95
|
} catch (error) {
|
|
85
96
|
console.error("Error reading GT config file:", error);
|
|
86
97
|
}
|
|
98
|
+
const nextI18nConfigMismatches = internalNextConfig.i18n ? getNextI18nConfigMismatches(loadedConfig, internalNextConfig.i18n) : [];
|
|
99
|
+
if (nextI18nConfigMismatches.length > 0) console.warn(createNextI18nConfigMismatchWarning(nextI18nConfigMismatches));
|
|
87
100
|
const { projectId, apiKey, devApiKey } = getRuntimeCredentials();
|
|
88
101
|
const envConfig = {
|
|
89
102
|
...projectId ? { projectId } : {},
|
package/dist/config.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.mjs","names":[],"sources":["../src/config.ts"],"sourcesContent":["import path from 'path';\nimport fs from 'fs';\nimport type { NextConfig } from 'next';\nimport {\n defaultWithGTConfigProps,\n defaultCacheExpiryTime,\n} from './config-dir/props/defaultWithGTConfigProps';\nimport {\n type BaseWithGTConfigProps,\n type withGTConfigProps,\n} from './config-dir/props/withGTConfigProps';\nimport {\n APIKeyMissingWarn,\n conflictingConfigurationBuildError,\n createBadFilepathWarning,\n createGTCompilerUnresolvedWarning,\n devApiKeyIncludedInProductionError,\n invalidCanonicalLocalesError,\n invalidLocalesError,\n projectIdMissingWarn,\n standardizedCanonicalLocalesWarning,\n standardizedLocalesWarning,\n unresolvedLoadDictionaryBuildError,\n unresolvedLoadTranslationsBuildError,\n} from './errors/createErrors';\nimport { compilePathRegex } from './utils/pathRegex';\nimport {\n getLocaleProperties,\n isValidLocale,\n standardizeLocale,\n} from '@generaltranslation/format';\nimport type { CustomMapping } from '@generaltranslation/format/types';\nimport {\n rootParamStability,\n turboConfigStable,\n} from './plugin/getStableNextVersionInfo';\nimport { validateCompiler } from './config-dir/utils/validateCompiler';\nimport {\n REQUEST_FUNCTION_ALIASES,\n resolveRequestFunctionPaths,\n} from './config-dir/utils/resolveRequestFunctionPaths';\nimport { resolveConfigFilepath } from './config-dir/utils/resolveConfigFilepath';\nimport { cacheComponentsChecks } from './plugin/checks/cacheComponentsChecks';\nimport {\n cacheComponentsDevHotReloadDisabledWarning,\n cacheComponentsMissingLoadTranslationsError,\n} from './errors/cacheComponents';\nimport { getRuntimeCredentials } from './setup/runtimeCredentials';\nimport { nextLocaleCookieName } from './utils/cookies';\n\ntype AutoderiveConfig = boolean | { jsx?: boolean; strings?: boolean };\n\ntype ConfigFileShape = {\n customMapping?: CustomMapping;\n files?: {\n gt?: {\n parsingFlags?: {\n autoderive?: AutoderiveConfig;\n };\n };\n };\n};\n\ntype RuntimeCredentialProps = {\n apiKey?: string;\n devApiKey?: string;\n projectId?: string;\n};\n\ntype InternalGTConfigProps = BaseWithGTConfigProps &\n RuntimeCredentialProps &\n ConfigFileShape & {\n loadDictionaryEnabled?: boolean;\n loadTranslationsType?: 'remote' | 'custom' | 'disabled';\n _dictionaryFileType?: string;\n _cacheComponentsEnabled?: boolean;\n _disableDevHotReload?: boolean;\n };\n\ntype WithGTConfigValue<T> =\n T extends Promise<infer U>\n ? Promise<U & NextConfig>\n : T extends PromiseLike<infer U>\n ? PromiseLike<U & NextConfig>\n : T & NextConfig;\n\ntype WithGTConfigResult<TNextConfig extends object> = TNextConfig extends (\n ...args: infer A\n) => infer R\n ? (...args: A) => WithGTConfigValue<R>\n : TNextConfig & NextConfig;\n\nfunction isThenable(value: unknown): value is PromiseLike<NextConfig> {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'then' in value &&\n typeof value.then === 'function'\n );\n}\n\n/**\n * Initializes General Translation settings for a Next.js application.\n *\n * Use it in `next.config.js` to enable GT translation functionality as a plugin.\n *\n * @example\n * // In next.config.ts\n * import { withGTConfig } from 'gt-next/config';\n * import type { NextConfig } from 'next';\n *\n * const nextConfig = {\n * reactStrictMode: true,\n * } satisfies NextConfig;\n *\n * export default withGTConfig(nextConfig, {\n * locales: ['en', 'es', 'fr'],\n * defaultLocale: 'en'\n * })\n *\n * @param {string|undefined} config - Optional config filepath (defaults to './gt.config.json'). If a file is found, it will be parsed for GT config variables.\n * @param {string|undefined} dictionary - Optional dictionary configuration file path. If a string is provided, it will be used as a path.\n * @param {string|null} [runtimeUrl=defaultInitGTProps.runtimeUrl] - The base URL for the GT API. Set to an empty string to disable automatic translations. Set to null to disable.\n * @param {string|null} [cacheUrl=defaultInitGTProps.cacheUrl] - The URL for cached translations. Set to null to disable.\n * @param {string[]|undefined} - Whether to use local translations.\n * @param {string[]} [locales=defaultInitGTProps.locales] - List of supported locales for the application.\n * @param {string} [defaultLocale=defaultInitGTProps.defaultLocale] - The default locale to use if none is specified.\n * @param {string|undefined} [getLocalePath=\"getLocale\"] - The path to the custom getLocale function.\n * @param {string|undefined} [getRegionPath=\"getRegion\"] - The path to the custom getRegion function.\n * @param {object} [renderSettings=defaultInitGTProps.renderSettings] - Render settings for how translations should be handled.\n * @param {number} [cacheExpiryTime] - The time in milliseconds for how long translations should be cached.\n * @param {number} [maxConcurrentRequests=defaultInitGTProps.maxConcurrentRequests] - Maximum number of concurrent requests allowed.\n * @param {number} [maxBatchSize=defaultInitGTProps.maxBatchSize] - Maximum translation requests in the same batch.\n * @param {number} [batchInterval=defaultInitGTProps.batchInterval] - The interval in milliseconds between batched translation requests.\n * @param {boolean} [ignoreBrowserLocales=defaultWithGTConfigProps.ignoreBrowserLocales] - Whether to ignore browser's preferred locales.\n * @param {boolean} [disableInvalidLocaleWarning=defaultWithGTConfigProps.disableInvalidLocaleWarning] - Whether to disable invalid request locale warnings.\n * @param {string|undefined} [pathRegex] - Regular expression that request pathnames must match for i18n middleware to be applied.\n * @param {object} headersAndCookies - Additional headers and cookies that can be passed for extended configuration.\n * @param {object} metadata - Additional metadata that can be passed for extended configuration.\n *\n * @param {object} nextConfig - The Next.js configuration object to extend\n * @param {withGTConfigProps} props - General Translation configuration properties\n * @returns {NextConfig} - An updated Next.js config with GT settings applied\n *\n * @throws {Error} If the project ID is missing and default URLs are used, or if the API key is required and missing from the environment.\n */\nexport function withGTConfig<TNextConfig extends object = NextConfig>(\n nextConfig?: TNextConfig,\n props: withGTConfigProps = {}\n): WithGTConfigResult<TNextConfig> {\n // Next also accepts the `(phase, context) => config` function form. When given\n // one, call it and wrap the resolved config so `withGTConfig` composes with\n // other Next config plugins that return a config function — matching\n // `@sentry/nextjs`'s `withSentryConfig`. Without this, a function config would\n // be spread as a plain object below, silently dropping the user's config.\n if (typeof nextConfig === 'function') {\n const configFn = nextConfig as (\n phase: string,\n context: { defaultConfig: NextConfig }\n ) => NextConfig | Promise<NextConfig>;\n return ((phase: string, context: { defaultConfig: NextConfig }) => {\n const resolved = configFn(phase, context);\n return isThenable(resolved)\n ? resolved.then((resolvedConfig) => withGTConfig(resolvedConfig, props))\n : withGTConfig(resolved, props);\n }) as unknown as WithGTConfigResult<TNextConfig>;\n }\n\n const internalNextConfig = (nextConfig ?? {}) as unknown as NextConfig;\n\n // ---------- LOAD GT CONFIG FILE ---------- //\n\n let loadedConfig: Partial<InternalGTConfigProps> = {};\n try {\n let configPath: string | undefined;\n if (props.config) {\n configPath = props.config;\n } else if (fs.existsSync(defaultWithGTConfigProps.config)) {\n configPath = defaultWithGTConfigProps.config;\n } else if (fs.existsSync('./.gt/gt.config.json')) {\n // Support config under .gt for parity with .locadex\n configPath = './.gt/gt.config.json';\n } else if (fs.existsSync('./.locadex/gt.config.json')) {\n // Backward compatibility: support legacy .locadex directory\n configPath = './.locadex/gt.config.json';\n }\n if (typeof configPath === 'string' && fs.existsSync(configPath)) {\n const fileContent = fs.readFileSync(configPath, 'utf-8');\n loadedConfig = JSON.parse(fileContent);\n }\n } catch (error) {\n console.error('Error reading GT config file:', error);\n }\n\n // ---------- LOAD ENVIRONMENT VARIABLES ---------- //\n\n const { projectId, apiKey, devApiKey } = getRuntimeCredentials();\n\n // conditionally add environment variables to config\n const envConfig: Partial<InternalGTConfigProps> = {\n ...(projectId ? { projectId } : {}),\n ...(apiKey ? { apiKey } : {}),\n ...(devApiKey ? { devApiKey } : {}),\n };\n\n // ---------- CHECK FOR CONFIG CONFLICTS ---------- //\n\n // Check for conflicts between config and params\n const propsRecord = props as Record<string, unknown>;\n const conflicts = Object.entries(loadedConfig)\n .filter(([key, value]) => {\n // Skip if key doesn't exist in props\n if (!(key in props)) return false;\n\n const propValue = propsRecord[key];\n\n // Handle null/undefined values\n if (value == null || propValue == null) {\n return value !== propValue;\n }\n\n // Handle primitive types (string, number, boolean)\n if (typeof value !== 'object') {\n return value !== propValue;\n }\n\n // Handle arrays (no need for deep equality check)\n if (Array.isArray(value)) {\n if (!Array.isArray(propValue)) return true;\n if (value.length !== propValue.length) return true;\n return value.some((v, i) => v !== propValue[i]);\n }\n\n // Handle objects\n if (typeof value === 'object' && typeof propValue === 'object') {\n const valueRecord = value as Record<string, unknown>;\n const propRecord = propValue as Record<string, unknown>;\n const valueKeys = Object.keys(valueRecord);\n const propKeys = Object.keys(propRecord);\n const keys = new Set([...valueKeys, ...propKeys]);\n\n // Objects must match exactly (no need to go deeper)\n if (valueKeys.length !== propKeys.length) return true;\n return !Array.from(keys).every((k) => valueRecord[k] === propRecord[k]);\n }\n\n return false;\n })\n .map(\n ([key, value]) =>\n `- Key: ${key} Next Config: ${JSON.stringify(propsRecord[key])} does not match GT Config: ${JSON.stringify(value)}`\n );\n\n if (conflicts.length) {\n throw new Error(conflictingConfigurationBuildError(conflicts));\n }\n\n // ---------- MERGE CONFIGS ---------- //\n\n // Merge cookie and header names\n const nextLocaleDetectionEnabled =\n internalNextConfig.i18n !== null &&\n internalNextConfig.i18n !== undefined &&\n internalNextConfig.i18n.localeDetection !== false;\n const mergedHeadersAndCookies = {\n ...defaultWithGTConfigProps.headersAndCookies,\n ...props.headersAndCookies,\n // Next.js internationalized routing only reads its standard preference\n // cookie. Keep the user's i18n config untouched while aligning GT's\n // client-side locale persistence with the router.\n ...(nextLocaleDetectionEnabled && {\n localeCookieName: nextLocaleCookieName,\n }),\n };\n\n // Merge compiler options\n const mergedExperimentalCompilerOptions = {\n ...defaultWithGTConfigProps.experimentalCompilerOptions,\n ...props.experimentalCompilerOptions,\n };\n\n // precedence: input > env > config file > defaults\n const mergedConfig: InternalGTConfigProps = {\n ...defaultWithGTConfigProps,\n ...loadedConfig,\n ...envConfig,\n ...props,\n headersAndCookies: mergedHeadersAndCookies,\n experimentalCompilerOptions: mergedExperimentalCompilerOptions,\n _usingPlugin: true, // flag to indicate plugin usage\n };\n\n compilePathRegex(mergedConfig.pathRegex);\n\n // clear up any issues with the compiler options\n validateCompiler(mergedConfig);\n\n // ----------- RESOLVE ANY EXTERNAL FILES ----------- //\n\n // Resolve wasm filepath\n const turboPackEnabled = !!process.env.TURBOPACK;\n let resolvedWasmFilePath = '';\n if (mergedConfig.experimentalCompilerOptions?.type === 'swc') {\n try {\n if (turboPackEnabled) {\n const absolutePath = path.resolve(__dirname, './gt_swc_plugin.wasm');\n resolvedWasmFilePath =\n './' + path.relative(process.cwd(), absolutePath).replace(/\\\\/g, '/');\n } else {\n resolvedWasmFilePath = path.resolve(__dirname, './gt_swc_plugin.wasm');\n }\n } catch (error) {\n console.error(\n createGTCompilerUnresolvedWarning('swc'),\n 'Error message:',\n error\n );\n resolvedWasmFilePath = '';\n mergedConfig.experimentalCompilerOptions.type = 'none';\n }\n }\n\n // Resolve dictionary filepath\n let resolvedDictionaryFilePath =\n typeof mergedConfig.dictionary === 'string'\n ? mergedConfig.dictionary\n : resolveConfigFilepath('dictionary', ['.ts', '.js', '.json']); // fallback to dictionary\n\n // Check [defaultLocale].json file\n if (!resolvedDictionaryFilePath && mergedConfig.defaultLocale) {\n resolvedDictionaryFilePath = resolveConfigFilepath(\n mergedConfig.defaultLocale,\n ['.json']\n );\n\n // Check [defaultLanguageCode].json file\n if (!resolvedDictionaryFilePath) {\n const defaultLanguage = getLocaleProperties(\n mergedConfig.defaultLocale\n )?.languageCode;\n\n if (defaultLanguage && defaultLanguage !== mergedConfig.defaultLocale) {\n resolvedDictionaryFilePath = resolveConfigFilepath(defaultLanguage, [\n '.json',\n ]);\n }\n }\n }\n\n // Get the type of dictionary file\n const resolvedDictionaryFilePathType = resolvedDictionaryFilePath\n ? path.extname(resolvedDictionaryFilePath)\n : undefined;\n if (resolvedDictionaryFilePathType) {\n mergedConfig._dictionaryFileType = resolvedDictionaryFilePathType;\n }\n\n // Resolve custom dictionary loader path\n const customLoadDictionaryPath =\n typeof mergedConfig.loadDictionaryPath === 'string'\n ? mergedConfig.loadDictionaryPath\n : resolveConfigFilepath('loadDictionary');\n\n // Resolve custom translation loader path\n const customLoadTranslationsPath =\n typeof mergedConfig.loadTranslationsPath === 'string'\n ? mergedConfig.loadTranslationsPath\n : resolveConfigFilepath('loadTranslations');\n\n // Resolve request function paths\n const requestFunctionPaths = resolveRequestFunctionPaths(mergedConfig);\n\n // Warn if found in /app directory\n if (\n !resolvedDictionaryFilePath &&\n resolveConfigFilepath('dictionary', ['.ts', '.js', '.json'], undefined, [\n './app',\n './src/app',\n ])\n ) {\n console.warn(\n createBadFilepathWarning('dictionary', ['./app', './src/app'])\n );\n }\n\n if (\n !customLoadDictionaryPath &&\n resolveConfigFilepath(\n 'loadDictionary',\n ['.ts', '.js', '.json'],\n undefined,\n ['./app', './src/app']\n )\n ) {\n console.warn(\n createBadFilepathWarning('loadDictionary', ['./app', './src/app'])\n );\n }\n\n if (\n !customLoadTranslationsPath &&\n resolveConfigFilepath(\n 'loadTranslations',\n ['.ts', '.js', '.json'],\n undefined,\n ['./app', './src/app']\n )\n ) {\n console.warn(\n createBadFilepathWarning('loadTranslations', ['./app', './src/app'])\n );\n }\n\n // ----------- LOCALE STANDARDIZATION ----------- //\n\n // Check if using Services\n const gtRuntimeTranslationEnabled = !!(\n mergedConfig.runtimeUrl === defaultWithGTConfigProps.runtimeUrl &&\n ((process.env.NODE_ENV === 'production' && mergedConfig.apiKey) ||\n (process.env.NODE_ENV === 'development' && mergedConfig.devApiKey))\n );\n const gtRemoteCacheEnabled = !!(\n mergedConfig.cacheUrl === defaultWithGTConfigProps.cacheUrl &&\n mergedConfig.loadTranslationsType === 'remote'\n );\n const gtServicesEnabled = !!(\n (gtRuntimeTranslationEnabled || gtRemoteCacheEnabled) &&\n mergedConfig.projectId\n );\n\n // Standardize locales\n if (mergedConfig.locales && mergedConfig.defaultLocale) {\n mergedConfig.locales.unshift(mergedConfig.defaultLocale);\n }\n const updatedLocales: string[] = [];\n mergedConfig.locales = Array.from(new Set(mergedConfig.locales)).map(\n (locale) => {\n const updatedLocale = gtServicesEnabled\n ? standardizeLocale(locale)\n : locale;\n if (updatedLocale !== locale) {\n updatedLocales.push(`${locale} -> ${updatedLocale}`);\n }\n return updatedLocale;\n }\n );\n\n // Standardize canonical locales\n const updatedCanonicalLocales: string[] = [];\n if (mergedConfig.customMapping) {\n mergedConfig.customMapping = Object.fromEntries(\n Object.entries(mergedConfig.customMapping).map(([key, value]) => {\n if (typeof value !== 'object' || !('code' in value)) {\n return [key, value];\n }\n const updatedLocale = gtServicesEnabled\n ? standardizeLocale((value as { code: string }).code)\n : (value as { code: string }).code;\n if (updatedLocale !== (value as { code: string }).code) {\n updatedCanonicalLocales.push(`${key} -> ${updatedLocale}`);\n }\n return [\n key,\n {\n ...value,\n code: updatedLocale,\n },\n ];\n })\n );\n }\n\n // Run cache component checks\n cacheComponentsChecks({\n nextConfig: internalNextConfig,\n requestFunctionPaths,\n localTranslationsEnabled: !!customLoadTranslationsPath,\n localDictionaryEnabled: !!customLoadDictionaryPath,\n });\n\n // ---------- DERIVED CONFIG ATTRIBUTES ---------- //\n\n // Local dictionary flag\n if (customLoadDictionaryPath) {\n // Check: file exists if provided\n if (!fs.existsSync(path.resolve(customLoadDictionaryPath))) {\n throw new Error(\n unresolvedLoadDictionaryBuildError(customLoadDictionaryPath)\n );\n } else {\n mergedConfig.loadDictionaryEnabled = true;\n }\n } else {\n mergedConfig.loadDictionaryEnabled = false;\n }\n\n // Local translations flag\n if (customLoadTranslationsPath) {\n // Check: file exists if provided\n if (!fs.existsSync(path.resolve(customLoadTranslationsPath))) {\n throw new Error(\n unresolvedLoadTranslationsBuildError(customLoadTranslationsPath)\n );\n } else {\n mergedConfig.loadTranslationsType = 'custom';\n }\n } else {\n mergedConfig.loadTranslationsType = 'remote';\n }\n\n if (internalNextConfig.cacheComponents) {\n if (mergedConfig.loadTranslationsType !== 'custom') {\n throw new Error(cacheComponentsMissingLoadTranslationsError);\n }\n if (isDevHotReloadEnabled(mergedConfig)) {\n console.warn(cacheComponentsDevHotReloadDisabledWarning);\n }\n mergedConfig._cacheComponentsEnabled = true;\n mergedConfig._disableDevHotReload = true;\n mergedConfig.cacheExpiryTime = 0;\n }\n\n // Set default cache expiry if and only if no dev key\n if (\n mergedConfig.loadTranslationsType == 'remote' &&\n !mergedConfig.devApiKey &&\n typeof mergedConfig.cacheExpiryTime === 'undefined'\n ) {\n mergedConfig.cacheExpiryTime = defaultCacheExpiryTime;\n }\n\n // ---------- ERROR CHECKS ---------- //\n\n // Check: invalid locale\n if (!mergedConfig.customMapping && gtServicesEnabled) {\n const invalidLocales: string[] = [];\n mergedConfig.locales.forEach((locale) => {\n if (!isValidLocale(locale)) {\n invalidLocales.push(locale);\n }\n });\n if (invalidLocales.length) {\n throw new Error(invalidLocalesError(invalidLocales));\n }\n }\n\n // Check: invalid canonical locale\n if (mergedConfig.customMapping && gtServicesEnabled) {\n const invalidCanonicalLocales: string[] = [];\n mergedConfig.locales.forEach((locale) => {\n if (!isValidLocale(locale, mergedConfig.customMapping)) {\n invalidCanonicalLocales.push(locale);\n }\n });\n if (invalidCanonicalLocales.length) {\n throw new Error(invalidCanonicalLocalesError(invalidCanonicalLocales));\n }\n }\n\n // Check: projectId is not required for remote infrastructure, but warn if missing for dev, nothing for prod\n if (\n (mergedConfig.cacheUrl || mergedConfig.runtimeUrl) &&\n !mergedConfig.projectId &&\n process.env.NODE_ENV === 'development' &&\n mergedConfig.loadTranslationsType === 'remote' &&\n !mergedConfig.loadDictionaryEnabled // skip warn if using local dictionary\n ) {\n console.warn(projectIdMissingWarn);\n }\n\n // Check: dev API key should not be included in production\n if (process.env.NODE_ENV === 'production' && mergedConfig.devApiKey) {\n throw new Error(devApiKeyIncludedInProductionError);\n }\n\n // Check: An API key is required for runtime translation\n if (\n mergedConfig.projectId && // must have projectId for this check to matter anyways\n mergedConfig.runtimeUrl &&\n !(mergedConfig.apiKey || mergedConfig.devApiKey) &&\n process.env.NODE_ENV === 'development'\n ) {\n console.warn(APIKeyMissingWarn);\n }\n\n // Check: if using GT infrastructure, warn about unsupported locales\n if (gtServicesEnabled) {\n // Warn about standardized locales\n if (updatedLocales.length) {\n console.warn(standardizedLocalesWarning(updatedLocales));\n }\n\n // Warn about standardized canonical locales\n if (updatedCanonicalLocales.length) {\n console.warn(\n standardizedCanonicalLocalesWarning(updatedCanonicalLocales)\n );\n }\n }\n\n // ---------- STORE CONFIGURATIONS ---------- //\n const {\n projectId: _projectId,\n apiKey: _apiKey,\n devApiKey: _devApiKey,\n ...privateConfigParams\n } = mergedConfig;\n const I18NConfigParams = JSON.stringify(privateConfigParams);\n const clientI18NConfigParams = {\n defaultLocale: mergedConfig.defaultLocale,\n locales: mergedConfig.locales,\n customMapping: mergedConfig.customMapping,\n runtimeUrl: mergedConfig.runtimeUrl,\n cacheUrl: mergedConfig.cacheUrl,\n cacheExpiryTime: mergedConfig.cacheExpiryTime,\n maxConcurrentRequests: mergedConfig.maxConcurrentRequests,\n maxBatchSize: mergedConfig.maxBatchSize,\n batchInterval: mergedConfig.batchInterval,\n renderSettings: {\n timeout: mergedConfig.renderSettings?.timeout,\n },\n headersAndCookies: {\n localeCookieName: mergedConfig.headersAndCookies?.localeCookieName,\n enableI18nCookieName:\n mergedConfig.headersAndCookies?.enableI18nCookieName,\n },\n _versionId: mergedConfig._versionId,\n _disableDevHotReload: mergedConfig._disableDevHotReload,\n };\n\n const { type: _type, ...compilerOptions } =\n mergedConfig.experimentalCompilerOptions || {};\n\n // Read autoderive from parsingFlags (single source of truth shared with CLI)\n const rawAutoderive: boolean | { jsx?: boolean; strings?: boolean } =\n loadedConfig?.files?.gt?.parsingFlags?.autoderive ?? false;\n const autoderiveJsx =\n typeof rawAutoderive === 'boolean'\n ? rawAutoderive\n : (rawAutoderive.jsx ?? false);\n const autoderiveStrings =\n typeof rawAutoderive === 'boolean'\n ? rawAutoderive\n : (rawAutoderive.strings ?? false);\n\n const swcPluginOptions: Record<string, unknown> = {\n ...compilerOptions,\n autoderiveJsx,\n autoderiveStrings,\n };\n\n const swcPluginEntry: [string, Record<string, unknown>] | null =\n mergedConfig.experimentalCompilerOptions?.type === 'swc'\n ? [resolvedWasmFilePath, swcPluginOptions]\n : null;\n\n const turboAliases = {\n 'gt-next/internal/_dictionary': resolvedDictionaryFilePath || '',\n 'gt-next/internal/_load-translations': customLoadTranslationsPath || '',\n 'gt-next/internal/_load-dictionary': customLoadDictionaryPath || '',\n ...Object.fromEntries(\n Object.entries(requestFunctionPaths).map(([functionName, path]) => {\n return [\n REQUEST_FUNCTION_ALIASES[\n functionName as keyof typeof REQUEST_FUNCTION_ALIASES\n ],\n path,\n ];\n })\n ),\n };\n\n // experimental.turbo is deprecated in next@15.3.0.\n // Check for experimental.turbo. If we write to turbopack field, experimental fields will be ignored.\n // Yet, if there are other resolveAlias fields, we don't want to be ignored either.\n const experimentalTurbopack = !(\n turboConfigStable &&\n (!internalNextConfig.experimental?.turbo ||\n internalNextConfig.turbopack?.resolveAlias)\n );\n\n const config: NextConfig = {\n ...internalNextConfig,\n transpilePackages: Array.from(\n new Set([...(internalNextConfig.transpilePackages || []), 'gt-next'])\n ),\n env: {\n ...internalNextConfig.env,\n _GENERALTRANSLATION_I18N_CONFIG_PARAMS: I18NConfigParams,\n NEXT_PUBLIC_GENERALTRANSLATION_I18N_CONFIG_PARAMS: JSON.stringify(\n clientI18NConfigParams\n ),\n ...(resolvedDictionaryFilePathType && {\n _GENERALTRANSLATION_DICTIONARY_FILE_TYPE:\n resolvedDictionaryFilePathType,\n }),\n _GENERALTRANSLATION_LOCAL_DICTIONARY_ENABLED:\n mergedConfig.loadDictionaryEnabled.toString(),\n _GENERALTRANSLATION_LOCAL_TRANSLATION_ENABLED: (\n mergedConfig.loadTranslationsType === 'custom'\n ).toString(),\n _GENERALTRANSLATION_DEFAULT_LOCALE: (\n mergedConfig.defaultLocale ||\n defaultWithGTConfigProps.defaultLocale ||\n ''\n ).toString(),\n _GENERALTRANSLATION_GT_SERVICES_ENABLED: gtServicesEnabled.toString(),\n _GENERALTRANSLATION_IGNORE_BROWSER_LOCALES:\n mergedConfig.ignoreBrowserLocales?.toString() ||\n defaultWithGTConfigProps.ignoreBrowserLocales?.toString() ||\n 'false',\n _GENERALTRANSLATION_CUSTOM_GET_LOCALE_ENABLED:\n requestFunctionPaths.getLocale ? 'true' : 'false',\n _GENERALTRANSLATION_CUSTOM_GET_REGION_ENABLED:\n requestFunctionPaths.getRegion ? 'true' : 'false',\n _GENERALTRANSLATION_DISABLE_INVALID_LOCALE_WARNING:\n mergedConfig.disableInvalidLocaleWarning?.toString() || 'false',\n // nextConfig.env intentionally makes this available to client-boundary.tsx.\n ...(mergedConfig.pathRegex !== undefined && {\n _GENERALTRANSLATION_PATH_REGEX: mergedConfig.pathRegex,\n }),\n },\n ...(turboPackEnabled &&\n !experimentalTurbopack && {\n turbopack: {\n ...internalNextConfig.turbopack,\n resolveAlias: {\n ...internalNextConfig.turbopack?.resolveAlias,\n ...turboAliases,\n },\n },\n }),\n experimental: {\n ...internalNextConfig.experimental,\n ...(rootParamStability === 'experimental' && {\n rootParams: true,\n }),\n swcPlugins: [\n ...(internalNextConfig.experimental?.swcPlugins || []),\n ...(swcPluginEntry ? [swcPluginEntry] : []),\n ],\n ...(turboPackEnabled &&\n experimentalTurbopack && {\n turbo: {\n ...internalNextConfig.experimental?.turbo,\n resolveAlias: {\n ...internalNextConfig.experimental?.turbo?.resolveAlias,\n ...turboAliases,\n },\n },\n }),\n },\n webpack: function webpack(\n ...[webpackConfig, options]: Parameters<\n NonNullable<NextConfig['webpack']>\n >\n ) {\n // Only apply webpack aliases if we're using webpack (not Turbopack)\n if (!turboPackEnabled) {\n // Try to load GT compiler if available\n if (mergedConfig.experimentalCompilerOptions?.type === 'babel') {\n try {\n const {\n webpack: gtUnplugin,\n } = require('@generaltranslation/compiler');\n webpackConfig.plugins.unshift(\n gtUnplugin({\n ...mergedConfig.experimentalCompilerOptions,\n autoJsxImportSource: 'gt-next',\n })\n );\n } catch (e) {\n mergedConfig.experimentalCompilerOptions.type = 'none';\n console.warn(\n createGTCompilerUnresolvedWarning('babel'),\n 'Error message:',\n e\n );\n }\n }\n\n // Disable cache in dev bc people might move around loadTranslations() and loadDictionary() files\n if (process.env.NODE_ENV === 'development') {\n webpackConfig.cache = false;\n }\n if (resolvedDictionaryFilePath) {\n webpackConfig.resolve.alias['gt-next/internal/_dictionary'] =\n path.resolve(webpackConfig.context, resolvedDictionaryFilePath);\n }\n if (customLoadTranslationsPath) {\n webpackConfig.resolve.alias[`gt-next/internal/_load-translations`] =\n path.resolve(webpackConfig.context, customLoadTranslationsPath);\n }\n if (customLoadDictionaryPath) {\n webpackConfig.resolve.alias[`gt-next/internal/_load-dictionary`] =\n path.resolve(webpackConfig.context, customLoadDictionaryPath);\n }\n for (const [functionName, pathString] of Object.entries(\n requestFunctionPaths\n )) {\n const key =\n REQUEST_FUNCTION_ALIASES[\n functionName as keyof typeof REQUEST_FUNCTION_ALIASES\n ];\n webpackConfig.resolve.alias[key] = path.resolve(\n webpackConfig.context,\n pathString\n );\n }\n // Webpack parses .mjs as strict ESM and does not treat require()\n // calls as dependencies, so the require()-backed internal aliases\n // above would never apply and their runtime errors are swallowed\n // (loaders silently no-op). Parse gt-next's ESM dist as\n // javascript/auto so webpack picks up those require() calls.\n // Server compilation only: the call sites are server-only, and this\n // keeps the rule from ever pulling a user's loader file into the\n // client bundle. Turbopack resolves them through resolveAlias and\n // needs no rule.\n // The guard mirrors the alias block above: any configured alias\n // enables the rule. The request-function aliases are static-imported\n // (initGT.server), and resolve.alias applies at resolution regardless\n // of parser mode, so they work without the rule; they gate it anyway\n // for symmetry and for any future require()-backed consumer.\n if (\n options.isServer &&\n (resolvedDictionaryFilePath ||\n customLoadTranslationsPath ||\n customLoadDictionaryPath ||\n Object.keys(requestFunctionPaths).length > 0)\n ) {\n // gt-next normally resolves inside a node_modules dir (app-local,\n // hoisted monorepo root, or the pnpm store), but symlinked installs\n // (workspace:*, file:) resolve to a real path with no node_modules\n // segment — so also match this package's dist dir, where this\n // compiled file lives.\n const gtNextDistDirs: (string | RegExp)[] = [\n /node_modules[\\\\/]gt-next[\\\\/]dist[\\\\/]/,\n ];\n try {\n // Trust __dirname only when it verifiably is gt-next's dist: a\n // bundler that inlines this file elsewhere would otherwise widen\n // the rule to every .mjs under its output dir. The compiled\n // config always sits beside its ESM twin and the internal\n // modules these aliases target.\n if (\n fs.existsSync(path.join(__dirname, 'config.mjs')) &&\n fs.existsSync(path.join(__dirname, 'internal', '_dictionary.mjs'))\n ) {\n gtNextDistDirs.push(__dirname + path.sep);\n }\n } catch {\n // __dirname is undefined when the ESM dist of this module is\n // loaded natively; the node_modules pattern still applies.\n }\n webpackConfig.module ??= {};\n webpackConfig.module.rules ??= [];\n webpackConfig.module.rules.push({\n test: /\\.mjs$/,\n include: gtNextDistDirs,\n type: 'javascript/auto',\n });\n }\n }\n if (typeof internalNextConfig?.webpack === 'function') {\n return internalNextConfig.webpack(webpackConfig, options);\n }\n return webpackConfig;\n },\n };\n return config as WithGTConfigResult<TNextConfig>;\n}\n\nfunction isDevHotReloadEnabled(config: InternalGTConfigProps): boolean {\n return (\n !!config.devApiKey &&\n !!config.projectId &&\n config.runtimeUrl !== null &&\n config.runtimeUrl !== '' &&\n process.env.NODE_ENV === 'development'\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AA4FA,SAAS,WAAW,OAAkD;AACpE,QACE,OAAO,UAAU,YACjB,UAAU,QACV,UAAU,SACV,OAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiD1B,SAAgB,aACd,YACA,QAA2B,EAAE,EACI;AAMjC,KAAI,OAAO,eAAe,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AGf,SAAS,sBAAsB,QAAwC;AACrE,QACE,CAAC,CAAC,OAAO,aACT,CAAC,CAAC,OAAO,aACT,OAAO,eAAe,QACtB,OAAO,eAAe,MACtB,QAAQ,IAAI,aAAa"}
|
|
1
|
+
{"version":3,"file":"config.mjs","names":[],"sources":["../src/config.ts"],"sourcesContent":["import path from 'path';\nimport fs from 'fs';\nimport type { NextConfig } from 'next';\nimport {\n defaultWithGTConfigProps,\n defaultCacheExpiryTime,\n} from './config-dir/props/defaultWithGTConfigProps';\nimport {\n type BaseWithGTConfigProps,\n type withGTConfigProps,\n} from './config-dir/props/withGTConfigProps';\nimport {\n APIKeyMissingWarn,\n conflictingConfigurationBuildError,\n createBadFilepathWarning,\n createGTCompilerUnresolvedWarning,\n createNextI18nConfigMismatchWarning,\n devApiKeyIncludedInProductionError,\n invalidCanonicalLocalesError,\n invalidLocalesError,\n projectIdMissingWarn,\n standardizedCanonicalLocalesWarning,\n standardizedLocalesWarning,\n unresolvedLoadDictionaryBuildError,\n unresolvedLoadTranslationsBuildError,\n} from './errors/createErrors';\nimport { compilePathRegex } from './utils/pathRegex';\nimport {\n getLocaleProperties,\n isValidLocale,\n standardizeLocale,\n} from '@generaltranslation/format';\nimport type { CustomMapping } from '@generaltranslation/format/types';\nimport {\n rootParamStability,\n turboConfigStable,\n} from './plugin/getStableNextVersionInfo';\nimport { validateCompiler } from './config-dir/utils/validateCompiler';\nimport {\n REQUEST_FUNCTION_ALIASES,\n resolveRequestFunctionPaths,\n} from './config-dir/utils/resolveRequestFunctionPaths';\nimport { resolveConfigFilepath } from './config-dir/utils/resolveConfigFilepath';\nimport { cacheComponentsChecks } from './plugin/checks/cacheComponentsChecks';\nimport {\n cacheComponentsDevHotReloadDisabledWarning,\n cacheComponentsMissingLoadTranslationsError,\n} from './errors/cacheComponents';\nimport { getRuntimeCredentials } from './setup/runtimeCredentials';\nimport { nextLocaleCookieName } from './utils/cookies';\n\ntype AutoderiveConfig = boolean | { jsx?: boolean; strings?: boolean };\n\ntype ConfigFileShape = {\n customMapping?: CustomMapping;\n files?: {\n gt?: {\n parsingFlags?: {\n autoderive?: AutoderiveConfig;\n };\n };\n };\n};\n\ntype RuntimeCredentialProps = {\n apiKey?: string;\n devApiKey?: string;\n projectId?: string;\n};\n\ntype InternalGTConfigProps = BaseWithGTConfigProps &\n RuntimeCredentialProps &\n ConfigFileShape & {\n loadDictionaryEnabled?: boolean;\n loadTranslationsType?: 'remote' | 'custom' | 'disabled';\n _dictionaryFileType?: string;\n _cacheComponentsEnabled?: boolean;\n _disableDevHotReload?: boolean;\n };\n\ntype WithGTConfigValue<T> =\n T extends Promise<infer U>\n ? Promise<U & NextConfig>\n : T extends PromiseLike<infer U>\n ? PromiseLike<U & NextConfig>\n : T & NextConfig;\n\ntype WithGTConfigResult<TNextConfig extends object> = TNextConfig extends (\n ...args: infer A\n) => infer R\n ? (...args: A) => WithGTConfigValue<R>\n : TNextConfig & NextConfig;\n\nfunction isThenable(value: unknown): value is PromiseLike<NextConfig> {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'then' in value &&\n typeof value.then === 'function'\n );\n}\n\nfunction getNextI18nConfigMismatches(\n gtConfig: Partial<InternalGTConfigProps>,\n nextI18n: NonNullable<NextConfig['i18n']>\n): string[] {\n const mismatches: string[] = [];\n\n if (\n gtConfig.defaultLocale !== undefined &&\n gtConfig.defaultLocale !== nextI18n.defaultLocale\n ) {\n mismatches.push(\n `defaultLocale: GT has ${JSON.stringify(gtConfig.defaultLocale)}; Next.js has ${JSON.stringify(nextI18n.defaultLocale)}`\n );\n }\n\n if (\n gtConfig.locales !== undefined &&\n !haveSameLocales(\n gtConfig.defaultLocale === undefined\n ? gtConfig.locales\n : [gtConfig.defaultLocale, ...gtConfig.locales],\n nextI18n.locales\n )\n ) {\n mismatches.push(\n `locales: GT has ${JSON.stringify(gtConfig.locales)}; Next.js has ${JSON.stringify(nextI18n.locales)}`\n );\n }\n\n return mismatches;\n}\n\nfunction haveSameLocales(\n gtLocales: readonly string[],\n nextLocales: readonly string[]\n): boolean {\n const gtLocaleSet = new Set(gtLocales);\n const nextLocaleSet = new Set(nextLocales);\n return (\n gtLocaleSet.size === nextLocaleSet.size &&\n Array.from(gtLocaleSet).every((locale) => nextLocaleSet.has(locale))\n );\n}\n\n/**\n * Initializes General Translation settings for a Next.js application.\n *\n * Use it in `next.config.js` to enable GT translation functionality as a plugin.\n *\n * @example\n * // In next.config.ts\n * import { withGTConfig } from 'gt-next/config';\n * import type { NextConfig } from 'next';\n *\n * const nextConfig = {\n * reactStrictMode: true,\n * } satisfies NextConfig;\n *\n * export default withGTConfig(nextConfig, {\n * locales: ['en', 'es', 'fr'],\n * defaultLocale: 'en'\n * })\n *\n * @param {string|undefined} config - Optional config filepath (defaults to './gt.config.json'). If a file is found, it will be parsed for GT config variables.\n * @param {string|undefined} dictionary - Optional dictionary configuration file path. If a string is provided, it will be used as a path.\n * @param {string|null} [runtimeUrl=defaultInitGTProps.runtimeUrl] - The base URL for the GT API. Set to an empty string to disable automatic translations. Set to null to disable.\n * @param {string|null} [cacheUrl=defaultInitGTProps.cacheUrl] - The URL for cached translations. Set to null to disable.\n * @param {string[]|undefined} - Whether to use local translations.\n * @param {string[]} [locales=defaultInitGTProps.locales] - List of supported locales for the application.\n * @param {string} [defaultLocale=defaultInitGTProps.defaultLocale] - The default locale to use if none is specified.\n * @param {string|undefined} [getLocalePath=\"getLocale\"] - The path to the custom getLocale function.\n * @param {string|undefined} [getRegionPath=\"getRegion\"] - The path to the custom getRegion function.\n * @param {object} [renderSettings=defaultInitGTProps.renderSettings] - Render settings for how translations should be handled.\n * @param {number} [cacheExpiryTime] - The time in milliseconds for how long translations should be cached.\n * @param {number} [maxConcurrentRequests=defaultInitGTProps.maxConcurrentRequests] - Maximum number of concurrent requests allowed.\n * @param {number} [maxBatchSize=defaultInitGTProps.maxBatchSize] - Maximum translation requests in the same batch.\n * @param {number} [batchInterval=defaultInitGTProps.batchInterval] - The interval in milliseconds between batched translation requests.\n * @param {boolean} [ignoreBrowserLocales=defaultWithGTConfigProps.ignoreBrowserLocales] - Whether to ignore browser's preferred locales.\n * @param {boolean} [disableInvalidLocaleWarning=defaultWithGTConfigProps.disableInvalidLocaleWarning] - Whether to disable invalid request locale warnings.\n * @param {string|undefined} [pathRegex] - Regular expression that request pathnames must match for i18n middleware to be applied.\n * @param {object} headersAndCookies - Additional headers and cookies that can be passed for extended configuration.\n * @param {object} metadata - Additional metadata that can be passed for extended configuration.\n *\n * @param {object} nextConfig - The Next.js configuration object to extend\n * @param {withGTConfigProps} props - General Translation configuration properties\n * @returns {NextConfig} - An updated Next.js config with GT settings applied\n *\n * @throws {Error} If the project ID is missing and default URLs are used, or if the API key is required and missing from the environment.\n */\nexport function withGTConfig<TNextConfig extends object = NextConfig>(\n nextConfig?: TNextConfig,\n props: withGTConfigProps = {}\n): WithGTConfigResult<TNextConfig> {\n // Next also accepts the `(phase, context) => config` function form. When given\n // one, call it and wrap the resolved config so `withGTConfig` composes with\n // other Next config plugins that return a config function — matching\n // `@sentry/nextjs`'s `withSentryConfig`. Without this, a function config would\n // be spread as a plain object below, silently dropping the user's config.\n if (typeof nextConfig === 'function') {\n const configFn = nextConfig as (\n phase: string,\n context: { defaultConfig: NextConfig }\n ) => NextConfig | Promise<NextConfig>;\n return ((phase: string, context: { defaultConfig: NextConfig }) => {\n const resolved = configFn(phase, context);\n return isThenable(resolved)\n ? resolved.then((resolvedConfig) => withGTConfig(resolvedConfig, props))\n : withGTConfig(resolved, props);\n }) as unknown as WithGTConfigResult<TNextConfig>;\n }\n\n const internalNextConfig = (nextConfig ?? {}) as unknown as NextConfig;\n\n // ---------- LOAD GT CONFIG FILE ---------- //\n\n let loadedConfig: Partial<InternalGTConfigProps> = {};\n try {\n let configPath: string | undefined;\n if (props.config) {\n configPath = props.config;\n } else if (fs.existsSync(defaultWithGTConfigProps.config)) {\n configPath = defaultWithGTConfigProps.config;\n } else if (fs.existsSync('./.gt/gt.config.json')) {\n // Support config under .gt for parity with .locadex\n configPath = './.gt/gt.config.json';\n } else if (fs.existsSync('./.locadex/gt.config.json')) {\n // Backward compatibility: support legacy .locadex directory\n configPath = './.locadex/gt.config.json';\n }\n if (typeof configPath === 'string' && fs.existsSync(configPath)) {\n const fileContent = fs.readFileSync(configPath, 'utf-8');\n loadedConfig = JSON.parse(fileContent);\n }\n } catch (error) {\n console.error('Error reading GT config file:', error);\n }\n\n // This warning intentionally compares Next.js i18n against explicit values\n // from the GT config file. Inline props use the conflict and merge paths below.\n const nextI18nConfigMismatches = internalNextConfig.i18n\n ? getNextI18nConfigMismatches(loadedConfig, internalNextConfig.i18n)\n : [];\n if (nextI18nConfigMismatches.length > 0) {\n console.warn(createNextI18nConfigMismatchWarning(nextI18nConfigMismatches));\n }\n\n // ---------- LOAD ENVIRONMENT VARIABLES ---------- //\n\n const { projectId, apiKey, devApiKey } = getRuntimeCredentials();\n\n // conditionally add environment variables to config\n const envConfig: Partial<InternalGTConfigProps> = {\n ...(projectId ? { projectId } : {}),\n ...(apiKey ? { apiKey } : {}),\n ...(devApiKey ? { devApiKey } : {}),\n };\n\n // ---------- CHECK FOR CONFIG CONFLICTS ---------- //\n\n // Check for conflicts between config and params\n const propsRecord = props as Record<string, unknown>;\n const conflicts = Object.entries(loadedConfig)\n .filter(([key, value]) => {\n // Skip if key doesn't exist in props\n if (!(key in props)) return false;\n\n const propValue = propsRecord[key];\n\n // Handle null/undefined values\n if (value == null || propValue == null) {\n return value !== propValue;\n }\n\n // Handle primitive types (string, number, boolean)\n if (typeof value !== 'object') {\n return value !== propValue;\n }\n\n // Handle arrays (no need for deep equality check)\n if (Array.isArray(value)) {\n if (!Array.isArray(propValue)) return true;\n if (value.length !== propValue.length) return true;\n return value.some((v, i) => v !== propValue[i]);\n }\n\n // Handle objects\n if (typeof value === 'object' && typeof propValue === 'object') {\n const valueRecord = value as Record<string, unknown>;\n const propRecord = propValue as Record<string, unknown>;\n const valueKeys = Object.keys(valueRecord);\n const propKeys = Object.keys(propRecord);\n const keys = new Set([...valueKeys, ...propKeys]);\n\n // Objects must match exactly (no need to go deeper)\n if (valueKeys.length !== propKeys.length) return true;\n return !Array.from(keys).every((k) => valueRecord[k] === propRecord[k]);\n }\n\n return false;\n })\n .map(\n ([key, value]) =>\n `- Key: ${key} Next Config: ${JSON.stringify(propsRecord[key])} does not match GT Config: ${JSON.stringify(value)}`\n );\n\n if (conflicts.length) {\n throw new Error(conflictingConfigurationBuildError(conflicts));\n }\n\n // ---------- MERGE CONFIGS ---------- //\n\n // Merge cookie and header names\n const nextLocaleDetectionEnabled =\n internalNextConfig.i18n !== null &&\n internalNextConfig.i18n !== undefined &&\n internalNextConfig.i18n.localeDetection !== false;\n const mergedHeadersAndCookies = {\n ...defaultWithGTConfigProps.headersAndCookies,\n ...props.headersAndCookies,\n // Next.js internationalized routing only reads its standard preference\n // cookie. Keep the user's i18n config untouched while aligning GT's\n // client-side locale persistence with the router.\n ...(nextLocaleDetectionEnabled && {\n localeCookieName: nextLocaleCookieName,\n }),\n };\n\n // Merge compiler options\n const mergedExperimentalCompilerOptions = {\n ...defaultWithGTConfigProps.experimentalCompilerOptions,\n ...props.experimentalCompilerOptions,\n };\n\n // precedence: input > env > config file > defaults\n const mergedConfig: InternalGTConfigProps = {\n ...defaultWithGTConfigProps,\n ...loadedConfig,\n ...envConfig,\n ...props,\n headersAndCookies: mergedHeadersAndCookies,\n experimentalCompilerOptions: mergedExperimentalCompilerOptions,\n _usingPlugin: true, // flag to indicate plugin usage\n };\n\n compilePathRegex(mergedConfig.pathRegex);\n\n // clear up any issues with the compiler options\n validateCompiler(mergedConfig);\n\n // ----------- RESOLVE ANY EXTERNAL FILES ----------- //\n\n // Resolve wasm filepath\n const turboPackEnabled = !!process.env.TURBOPACK;\n let resolvedWasmFilePath = '';\n if (mergedConfig.experimentalCompilerOptions?.type === 'swc') {\n try {\n if (turboPackEnabled) {\n const absolutePath = path.resolve(__dirname, './gt_swc_plugin.wasm');\n resolvedWasmFilePath =\n './' + path.relative(process.cwd(), absolutePath).replace(/\\\\/g, '/');\n } else {\n resolvedWasmFilePath = path.resolve(__dirname, './gt_swc_plugin.wasm');\n }\n } catch (error) {\n console.error(\n createGTCompilerUnresolvedWarning('swc'),\n 'Error message:',\n error\n );\n resolvedWasmFilePath = '';\n mergedConfig.experimentalCompilerOptions.type = 'none';\n }\n }\n\n // Resolve dictionary filepath\n let resolvedDictionaryFilePath =\n typeof mergedConfig.dictionary === 'string'\n ? mergedConfig.dictionary\n : resolveConfigFilepath('dictionary', ['.ts', '.js', '.json']); // fallback to dictionary\n\n // Check [defaultLocale].json file\n if (!resolvedDictionaryFilePath && mergedConfig.defaultLocale) {\n resolvedDictionaryFilePath = resolveConfigFilepath(\n mergedConfig.defaultLocale,\n ['.json']\n );\n\n // Check [defaultLanguageCode].json file\n if (!resolvedDictionaryFilePath) {\n const defaultLanguage = getLocaleProperties(\n mergedConfig.defaultLocale\n )?.languageCode;\n\n if (defaultLanguage && defaultLanguage !== mergedConfig.defaultLocale) {\n resolvedDictionaryFilePath = resolveConfigFilepath(defaultLanguage, [\n '.json',\n ]);\n }\n }\n }\n\n // Get the type of dictionary file\n const resolvedDictionaryFilePathType = resolvedDictionaryFilePath\n ? path.extname(resolvedDictionaryFilePath)\n : undefined;\n if (resolvedDictionaryFilePathType) {\n mergedConfig._dictionaryFileType = resolvedDictionaryFilePathType;\n }\n\n // Resolve custom dictionary loader path\n const customLoadDictionaryPath =\n typeof mergedConfig.loadDictionaryPath === 'string'\n ? mergedConfig.loadDictionaryPath\n : resolveConfigFilepath('loadDictionary');\n\n // Resolve custom translation loader path\n const customLoadTranslationsPath =\n typeof mergedConfig.loadTranslationsPath === 'string'\n ? mergedConfig.loadTranslationsPath\n : resolveConfigFilepath('loadTranslations');\n\n // Resolve request function paths\n const requestFunctionPaths = resolveRequestFunctionPaths(mergedConfig);\n\n // Warn if found in /app directory\n if (\n !resolvedDictionaryFilePath &&\n resolveConfigFilepath('dictionary', ['.ts', '.js', '.json'], undefined, [\n './app',\n './src/app',\n ])\n ) {\n console.warn(\n createBadFilepathWarning('dictionary', ['./app', './src/app'])\n );\n }\n\n if (\n !customLoadDictionaryPath &&\n resolveConfigFilepath(\n 'loadDictionary',\n ['.ts', '.js', '.json'],\n undefined,\n ['./app', './src/app']\n )\n ) {\n console.warn(\n createBadFilepathWarning('loadDictionary', ['./app', './src/app'])\n );\n }\n\n if (\n !customLoadTranslationsPath &&\n resolveConfigFilepath(\n 'loadTranslations',\n ['.ts', '.js', '.json'],\n undefined,\n ['./app', './src/app']\n )\n ) {\n console.warn(\n createBadFilepathWarning('loadTranslations', ['./app', './src/app'])\n );\n }\n\n // ----------- LOCALE STANDARDIZATION ----------- //\n\n // Check if using Services\n const gtRuntimeTranslationEnabled = !!(\n mergedConfig.runtimeUrl === defaultWithGTConfigProps.runtimeUrl &&\n ((process.env.NODE_ENV === 'production' && mergedConfig.apiKey) ||\n (process.env.NODE_ENV === 'development' && mergedConfig.devApiKey))\n );\n const gtRemoteCacheEnabled = !!(\n mergedConfig.cacheUrl === defaultWithGTConfigProps.cacheUrl &&\n mergedConfig.loadTranslationsType === 'remote'\n );\n const gtServicesEnabled = !!(\n (gtRuntimeTranslationEnabled || gtRemoteCacheEnabled) &&\n mergedConfig.projectId\n );\n\n // Standardize locales\n if (mergedConfig.locales && mergedConfig.defaultLocale) {\n mergedConfig.locales.unshift(mergedConfig.defaultLocale);\n }\n const updatedLocales: string[] = [];\n mergedConfig.locales = Array.from(new Set(mergedConfig.locales)).map(\n (locale) => {\n const updatedLocale = gtServicesEnabled\n ? standardizeLocale(locale)\n : locale;\n if (updatedLocale !== locale) {\n updatedLocales.push(`${locale} -> ${updatedLocale}`);\n }\n return updatedLocale;\n }\n );\n\n // Standardize canonical locales\n const updatedCanonicalLocales: string[] = [];\n if (mergedConfig.customMapping) {\n mergedConfig.customMapping = Object.fromEntries(\n Object.entries(mergedConfig.customMapping).map(([key, value]) => {\n if (typeof value !== 'object' || !('code' in value)) {\n return [key, value];\n }\n const updatedLocale = gtServicesEnabled\n ? standardizeLocale((value as { code: string }).code)\n : (value as { code: string }).code;\n if (updatedLocale !== (value as { code: string }).code) {\n updatedCanonicalLocales.push(`${key} -> ${updatedLocale}`);\n }\n return [\n key,\n {\n ...value,\n code: updatedLocale,\n },\n ];\n })\n );\n }\n\n // Run cache component checks\n cacheComponentsChecks({\n nextConfig: internalNextConfig,\n requestFunctionPaths,\n localTranslationsEnabled: !!customLoadTranslationsPath,\n localDictionaryEnabled: !!customLoadDictionaryPath,\n });\n\n // ---------- DERIVED CONFIG ATTRIBUTES ---------- //\n\n // Local dictionary flag\n if (customLoadDictionaryPath) {\n // Check: file exists if provided\n if (!fs.existsSync(path.resolve(customLoadDictionaryPath))) {\n throw new Error(\n unresolvedLoadDictionaryBuildError(customLoadDictionaryPath)\n );\n } else {\n mergedConfig.loadDictionaryEnabled = true;\n }\n } else {\n mergedConfig.loadDictionaryEnabled = false;\n }\n\n // Local translations flag\n if (customLoadTranslationsPath) {\n // Check: file exists if provided\n if (!fs.existsSync(path.resolve(customLoadTranslationsPath))) {\n throw new Error(\n unresolvedLoadTranslationsBuildError(customLoadTranslationsPath)\n );\n } else {\n mergedConfig.loadTranslationsType = 'custom';\n }\n } else {\n mergedConfig.loadTranslationsType = 'remote';\n }\n\n if (internalNextConfig.cacheComponents) {\n if (mergedConfig.loadTranslationsType !== 'custom') {\n throw new Error(cacheComponentsMissingLoadTranslationsError);\n }\n if (isDevHotReloadEnabled(mergedConfig)) {\n console.warn(cacheComponentsDevHotReloadDisabledWarning);\n }\n mergedConfig._cacheComponentsEnabled = true;\n mergedConfig._disableDevHotReload = true;\n mergedConfig.cacheExpiryTime = 0;\n }\n\n // Set default cache expiry if and only if no dev key\n if (\n mergedConfig.loadTranslationsType == 'remote' &&\n !mergedConfig.devApiKey &&\n typeof mergedConfig.cacheExpiryTime === 'undefined'\n ) {\n mergedConfig.cacheExpiryTime = defaultCacheExpiryTime;\n }\n\n // ---------- ERROR CHECKS ---------- //\n\n // Check: invalid locale\n if (!mergedConfig.customMapping && gtServicesEnabled) {\n const invalidLocales: string[] = [];\n mergedConfig.locales.forEach((locale) => {\n if (!isValidLocale(locale)) {\n invalidLocales.push(locale);\n }\n });\n if (invalidLocales.length) {\n throw new Error(invalidLocalesError(invalidLocales));\n }\n }\n\n // Check: invalid canonical locale\n if (mergedConfig.customMapping && gtServicesEnabled) {\n const invalidCanonicalLocales: string[] = [];\n mergedConfig.locales.forEach((locale) => {\n if (!isValidLocale(locale, mergedConfig.customMapping)) {\n invalidCanonicalLocales.push(locale);\n }\n });\n if (invalidCanonicalLocales.length) {\n throw new Error(invalidCanonicalLocalesError(invalidCanonicalLocales));\n }\n }\n\n // Check: projectId is not required for remote infrastructure, but warn if missing for dev, nothing for prod\n if (\n (mergedConfig.cacheUrl || mergedConfig.runtimeUrl) &&\n !mergedConfig.projectId &&\n process.env.NODE_ENV === 'development' &&\n mergedConfig.loadTranslationsType === 'remote' &&\n !mergedConfig.loadDictionaryEnabled // skip warn if using local dictionary\n ) {\n console.warn(projectIdMissingWarn);\n }\n\n // Check: dev API key should not be included in production\n if (process.env.NODE_ENV === 'production' && mergedConfig.devApiKey) {\n throw new Error(devApiKeyIncludedInProductionError);\n }\n\n // Check: An API key is required for runtime translation\n if (\n mergedConfig.projectId && // must have projectId for this check to matter anyways\n mergedConfig.runtimeUrl &&\n !(mergedConfig.apiKey || mergedConfig.devApiKey) &&\n process.env.NODE_ENV === 'development'\n ) {\n console.warn(APIKeyMissingWarn);\n }\n\n // Check: if using GT infrastructure, warn about unsupported locales\n if (gtServicesEnabled) {\n // Warn about standardized locales\n if (updatedLocales.length) {\n console.warn(standardizedLocalesWarning(updatedLocales));\n }\n\n // Warn about standardized canonical locales\n if (updatedCanonicalLocales.length) {\n console.warn(\n standardizedCanonicalLocalesWarning(updatedCanonicalLocales)\n );\n }\n }\n\n // ---------- STORE CONFIGURATIONS ---------- //\n const {\n projectId: _projectId,\n apiKey: _apiKey,\n devApiKey: _devApiKey,\n ...privateConfigParams\n } = mergedConfig;\n const I18NConfigParams = JSON.stringify(privateConfigParams);\n const clientI18NConfigParams = {\n defaultLocale: mergedConfig.defaultLocale,\n locales: mergedConfig.locales,\n customMapping: mergedConfig.customMapping,\n runtimeUrl: mergedConfig.runtimeUrl,\n cacheUrl: mergedConfig.cacheUrl,\n cacheExpiryTime: mergedConfig.cacheExpiryTime,\n maxConcurrentRequests: mergedConfig.maxConcurrentRequests,\n maxBatchSize: mergedConfig.maxBatchSize,\n batchInterval: mergedConfig.batchInterval,\n renderSettings: {\n timeout: mergedConfig.renderSettings?.timeout,\n },\n headersAndCookies: {\n localeCookieName: mergedConfig.headersAndCookies?.localeCookieName,\n enableI18nCookieName:\n mergedConfig.headersAndCookies?.enableI18nCookieName,\n },\n _versionId: mergedConfig._versionId,\n _disableDevHotReload: mergedConfig._disableDevHotReload,\n };\n\n const { type: _type, ...compilerOptions } =\n mergedConfig.experimentalCompilerOptions || {};\n\n // Read autoderive from parsingFlags (single source of truth shared with CLI)\n const rawAutoderive: boolean | { jsx?: boolean; strings?: boolean } =\n loadedConfig?.files?.gt?.parsingFlags?.autoderive ?? false;\n const autoderiveJsx =\n typeof rawAutoderive === 'boolean'\n ? rawAutoderive\n : (rawAutoderive.jsx ?? false);\n const autoderiveStrings =\n typeof rawAutoderive === 'boolean'\n ? rawAutoderive\n : (rawAutoderive.strings ?? false);\n\n const swcPluginOptions: Record<string, unknown> = {\n ...compilerOptions,\n autoderiveJsx,\n autoderiveStrings,\n };\n\n const swcPluginEntry: [string, Record<string, unknown>] | null =\n mergedConfig.experimentalCompilerOptions?.type === 'swc'\n ? [resolvedWasmFilePath, swcPluginOptions]\n : null;\n\n const turboAliases = {\n 'gt-next/internal/_dictionary': resolvedDictionaryFilePath || '',\n 'gt-next/internal/_load-translations': customLoadTranslationsPath || '',\n 'gt-next/internal/_load-dictionary': customLoadDictionaryPath || '',\n ...Object.fromEntries(\n Object.entries(requestFunctionPaths).map(([functionName, path]) => {\n return [\n REQUEST_FUNCTION_ALIASES[\n functionName as keyof typeof REQUEST_FUNCTION_ALIASES\n ],\n path,\n ];\n })\n ),\n };\n\n // experimental.turbo is deprecated in next@15.3.0.\n // Check for experimental.turbo. If we write to turbopack field, experimental fields will be ignored.\n // Yet, if there are other resolveAlias fields, we don't want to be ignored either.\n const experimentalTurbopack = !(\n turboConfigStable &&\n (!internalNextConfig.experimental?.turbo ||\n internalNextConfig.turbopack?.resolveAlias)\n );\n\n const config: NextConfig = {\n ...internalNextConfig,\n transpilePackages: Array.from(\n new Set([...(internalNextConfig.transpilePackages || []), 'gt-next'])\n ),\n env: {\n ...internalNextConfig.env,\n _GENERALTRANSLATION_I18N_CONFIG_PARAMS: I18NConfigParams,\n NEXT_PUBLIC_GENERALTRANSLATION_I18N_CONFIG_PARAMS: JSON.stringify(\n clientI18NConfigParams\n ),\n ...(resolvedDictionaryFilePathType && {\n _GENERALTRANSLATION_DICTIONARY_FILE_TYPE:\n resolvedDictionaryFilePathType,\n }),\n _GENERALTRANSLATION_LOCAL_DICTIONARY_ENABLED:\n mergedConfig.loadDictionaryEnabled.toString(),\n _GENERALTRANSLATION_LOCAL_TRANSLATION_ENABLED: (\n mergedConfig.loadTranslationsType === 'custom'\n ).toString(),\n _GENERALTRANSLATION_DEFAULT_LOCALE: (\n mergedConfig.defaultLocale ||\n defaultWithGTConfigProps.defaultLocale ||\n ''\n ).toString(),\n _GENERALTRANSLATION_GT_SERVICES_ENABLED: gtServicesEnabled.toString(),\n _GENERALTRANSLATION_IGNORE_BROWSER_LOCALES:\n mergedConfig.ignoreBrowserLocales?.toString() ||\n defaultWithGTConfigProps.ignoreBrowserLocales?.toString() ||\n 'false',\n _GENERALTRANSLATION_CUSTOM_GET_LOCALE_ENABLED:\n requestFunctionPaths.getLocale ? 'true' : 'false',\n _GENERALTRANSLATION_CUSTOM_GET_REGION_ENABLED:\n requestFunctionPaths.getRegion ? 'true' : 'false',\n _GENERALTRANSLATION_DISABLE_INVALID_LOCALE_WARNING:\n mergedConfig.disableInvalidLocaleWarning?.toString() || 'false',\n // nextConfig.env intentionally makes this available to client-boundary.tsx.\n ...(mergedConfig.pathRegex !== undefined && {\n _GENERALTRANSLATION_PATH_REGEX: mergedConfig.pathRegex,\n }),\n },\n ...(turboPackEnabled &&\n !experimentalTurbopack && {\n turbopack: {\n ...internalNextConfig.turbopack,\n resolveAlias: {\n ...internalNextConfig.turbopack?.resolveAlias,\n ...turboAliases,\n },\n },\n }),\n experimental: {\n ...internalNextConfig.experimental,\n ...(rootParamStability === 'experimental' && {\n rootParams: true,\n }),\n swcPlugins: [\n ...(internalNextConfig.experimental?.swcPlugins || []),\n ...(swcPluginEntry ? [swcPluginEntry] : []),\n ],\n ...(turboPackEnabled &&\n experimentalTurbopack && {\n turbo: {\n ...internalNextConfig.experimental?.turbo,\n resolveAlias: {\n ...internalNextConfig.experimental?.turbo?.resolveAlias,\n ...turboAliases,\n },\n },\n }),\n },\n webpack: function webpack(\n ...[webpackConfig, options]: Parameters<\n NonNullable<NextConfig['webpack']>\n >\n ) {\n // Only apply webpack aliases if we're using webpack (not Turbopack)\n if (!turboPackEnabled) {\n // Try to load GT compiler if available\n if (mergedConfig.experimentalCompilerOptions?.type === 'babel') {\n try {\n const {\n webpack: gtUnplugin,\n } = require('@generaltranslation/compiler');\n webpackConfig.plugins.unshift(\n gtUnplugin({\n ...mergedConfig.experimentalCompilerOptions,\n autoJsxImportSource: 'gt-next',\n })\n );\n } catch (e) {\n mergedConfig.experimentalCompilerOptions.type = 'none';\n console.warn(\n createGTCompilerUnresolvedWarning('babel'),\n 'Error message:',\n e\n );\n }\n }\n\n // Disable cache in dev bc people might move around loadTranslations() and loadDictionary() files\n if (process.env.NODE_ENV === 'development') {\n webpackConfig.cache = false;\n }\n if (resolvedDictionaryFilePath) {\n webpackConfig.resolve.alias['gt-next/internal/_dictionary'] =\n path.resolve(webpackConfig.context, resolvedDictionaryFilePath);\n }\n if (customLoadTranslationsPath) {\n webpackConfig.resolve.alias[`gt-next/internal/_load-translations`] =\n path.resolve(webpackConfig.context, customLoadTranslationsPath);\n }\n if (customLoadDictionaryPath) {\n webpackConfig.resolve.alias[`gt-next/internal/_load-dictionary`] =\n path.resolve(webpackConfig.context, customLoadDictionaryPath);\n }\n for (const [functionName, pathString] of Object.entries(\n requestFunctionPaths\n )) {\n const key =\n REQUEST_FUNCTION_ALIASES[\n functionName as keyof typeof REQUEST_FUNCTION_ALIASES\n ];\n webpackConfig.resolve.alias[key] = path.resolve(\n webpackConfig.context,\n pathString\n );\n }\n // Webpack parses .mjs as strict ESM and does not treat require()\n // calls as dependencies, so the require()-backed internal aliases\n // above would never apply and their runtime errors are swallowed\n // (loaders silently no-op). Parse gt-next's ESM dist as\n // javascript/auto so webpack picks up those require() calls.\n // Server compilation only: the call sites are server-only, and this\n // keeps the rule from ever pulling a user's loader file into the\n // client bundle. Turbopack resolves them through resolveAlias and\n // needs no rule.\n // The guard mirrors the alias block above: any configured alias\n // enables the rule. The request-function aliases are static-imported\n // (initGT.server), and resolve.alias applies at resolution regardless\n // of parser mode, so they work without the rule; they gate it anyway\n // for symmetry and for any future require()-backed consumer.\n if (\n options.isServer &&\n (resolvedDictionaryFilePath ||\n customLoadTranslationsPath ||\n customLoadDictionaryPath ||\n Object.keys(requestFunctionPaths).length > 0)\n ) {\n // gt-next normally resolves inside a node_modules dir (app-local,\n // hoisted monorepo root, or the pnpm store), but symlinked installs\n // (workspace:*, file:) resolve to a real path with no node_modules\n // segment — so also match this package's dist dir, where this\n // compiled file lives.\n const gtNextDistDirs: (string | RegExp)[] = [\n /node_modules[\\\\/]gt-next[\\\\/]dist[\\\\/]/,\n ];\n try {\n // Trust __dirname only when it verifiably is gt-next's dist: a\n // bundler that inlines this file elsewhere would otherwise widen\n // the rule to every .mjs under its output dir. The compiled\n // config always sits beside its ESM twin and the internal\n // modules these aliases target.\n if (\n fs.existsSync(path.join(__dirname, 'config.mjs')) &&\n fs.existsSync(path.join(__dirname, 'internal', '_dictionary.mjs'))\n ) {\n gtNextDistDirs.push(__dirname + path.sep);\n }\n } catch {\n // __dirname is undefined when the ESM dist of this module is\n // loaded natively; the node_modules pattern still applies.\n }\n webpackConfig.module ??= {};\n webpackConfig.module.rules ??= [];\n webpackConfig.module.rules.push({\n test: /\\.mjs$/,\n include: gtNextDistDirs,\n type: 'javascript/auto',\n });\n }\n }\n if (typeof internalNextConfig?.webpack === 'function') {\n return internalNextConfig.webpack(webpackConfig, options);\n }\n return webpackConfig;\n },\n };\n return config as WithGTConfigResult<TNextConfig>;\n}\n\nfunction isDevHotReloadEnabled(config: InternalGTConfigProps): boolean {\n return (\n !!config.devApiKey &&\n !!config.projectId &&\n config.runtimeUrl !== null &&\n config.runtimeUrl !== '' &&\n process.env.NODE_ENV === 'development'\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AA6FA,SAAS,WAAW,OAAkD;AACpE,QACE,OAAO,UAAU,YACjB,UAAU,QACV,UAAU,SACV,OAAO,MAAM,SAAS;;AAI1B,SAAS,4BACP,UACA,UACU;CACV,MAAM,aAAuB,EAAE;AAE/B,KACE,SAAS,kBAAkB,KAAA,KAC3B,SAAS,kBAAkB,SAAS,cAEpC,YAAW,KACT,yBAAyB,KAAK,UAAU,SAAS,cAAc,CAAC,gBAAgB,KAAK,UAAU,SAAS,cAAc,GACvH;AAGH,KACE,SAAS,YAAY,KAAA,KACrB,CAAC,gBACC,SAAS,kBAAkB,KAAA,IACvB,SAAS,UACT,CAAC,SAAS,eAAe,GAAG,SAAS,QAAQ,EACjD,SAAS,QACV,CAED,YAAW,KACT,mBAAmB,KAAK,UAAU,SAAS,QAAQ,CAAC,gBAAgB,KAAK,UAAU,SAAS,QAAQ,GACrG;AAGH,QAAO;;AAGT,SAAS,gBACP,WACA,aACS;CACT,MAAM,cAAc,IAAI,IAAI,UAAU;CACtC,MAAM,gBAAgB,IAAI,IAAI,YAAY;AAC1C,QACE,YAAY,SAAS,cAAc,QACnC,MAAM,KAAK,YAAY,CAAC,O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WAAW,YAAY,kBAAkB,CAAC,CAElE,gBAAe,KAAK,YAAY,KAAK,IAAI;aAErC;AAIR,mBAAc,WAAW,EAAE;AAC3B,mBAAc,OAAO,UAAU,EAAE;AACjC,mBAAc,OAAO,MAAM,KAAK;MAC9B,MAAM;MACN,SAAS;MACT,MAAM;MACP,CAAC;;;AAGN,OAAI,OAAO,oBAAoB,YAAY,WACzC,QAAO,mBAAmB,QAAQ,eAAe,QAAQ;AAE3D,UAAO;;EAGE;;AAGf,SAAS,sBAAsB,QAAwC;AACrE,QACE,CAAC,CAAC,OAAO,aACT,CAAC,CAAC,OAAO,aACT,OAAO,eAAe,QACtB,OAAO,eAAe,MACtB,QAAQ,IAAI,aAAa"}
|
|
@@ -18,6 +18,7 @@ export declare const projectIdMissingWarn: string;
|
|
|
18
18
|
export declare const APIKeyMissingWarn: string;
|
|
19
19
|
export declare const standardizedLocalesWarning: (locales: string[]) => string;
|
|
20
20
|
export declare const standardizedCanonicalLocalesWarning: (locales: string[]) => string;
|
|
21
|
+
export declare const createNextI18nConfigMismatchWarning: (details: string[]) => string;
|
|
21
22
|
export declare const createGTCompilerUnresolvedWarning: (type: "babel" | "swc") => string;
|
|
22
23
|
export declare const autoJsxInjectionCompilerWarning: string;
|
|
23
24
|
export declare const customGetLocaleUnresolvedWarning: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createErrors.d.ts","sourceRoot":"","sources":["../../src/errors/createErrors.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,uBAAuB,QAKlC,CAAC;AAEH,eAAO,MAAM,2BAA2B,GAAI,SAAQ,MAAW,WAK3D,CAAC;AAEL,eAAO,MAAM,2BAA2B,GAAI,SAAQ,MAAW,WAK3D,CAAC;AAEL,eAAO,MAAM,gCAAgC,GAAI,OAAO,KAAK,WAMzD,CAAC;AAEL,eAAO,MAAM,iCAAiC,GAAI,OAAO,KAAK,WAM1D,CAAC;AAEL,eAAO,MAAM,kCAAkC,QAI7C,CAAC;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AO,GAAG,KAAK,WAOnE,CAAC;AAEL,eAAO,MAAM,+BAA+B,QAK1C,CAAC;AAEH,eAAO,MAAM,gCAAgC,QAI3C,CAAC;AAEH,eAAO,MAAM,gCAAgC,QAI3C,CAAC;AAEH,eAAO,MAAM,kCAAkC,GAAI,MAAM,OAAO,GAAG,KAAK,4NAGyD,CAAC;AAElI,eAAO,MAAM,wCAAwC,QAE8C,CAAC;AAEpG,eAAO,MAAM,+BAA+B,0FAA0F,CAAC;AAEvI,eAAO,MAAM,mCAAmC,0JAAyK,CAAC"}
|
|
@@ -94,6 +94,13 @@ const APIKeyMissingWarn = require_errors_diagnostics.createGtNextPluginDiagnosti
|
|
|
94
94
|
});
|
|
95
95
|
const standardizedLocalesWarning = (locales) => `gt-next: The following locales were standardized: ${locales.join(", ")}. Use the standardized codes in your config to avoid this warning.`;
|
|
96
96
|
const standardizedCanonicalLocalesWarning = (locales) => `gt-next: The following canonical locales were standardized: ${locales.join(", ")}. Use the standardized codes in your config to avoid this warning.`;
|
|
97
|
+
const createNextI18nConfigMismatchWarning = (details) => require_errors_diagnostics.createGtNextPluginDiagnostic({
|
|
98
|
+
severity: "Warning",
|
|
99
|
+
whatHappened: "Next.js internationalized routing does not match the GT config file",
|
|
100
|
+
why: "Next.js may select a locale that GT is not configured to translate",
|
|
101
|
+
fix: "Use the same defaultLocale and locales values in both configurations",
|
|
102
|
+
details
|
|
103
|
+
});
|
|
97
104
|
const createGTCompilerUnresolvedWarning = (type) => require_errors_diagnostics.createGtNextPluginDiagnostic({
|
|
98
105
|
whatHappened: `The GT ${type} compiler could not be resolved`,
|
|
99
106
|
wayOut: "Skipping compiler optimizations",
|
|
@@ -128,6 +135,7 @@ exports.createBadFilepathWarning = createBadFilepathWarning;
|
|
|
128
135
|
exports.createDictionarySubsetError = createDictionarySubsetError;
|
|
129
136
|
exports.createGTCompilerUnavailableWarning = createGTCompilerUnavailableWarning;
|
|
130
137
|
exports.createGTCompilerUnresolvedWarning = createGTCompilerUnresolvedWarning;
|
|
138
|
+
exports.createNextI18nConfigMismatchWarning = createNextI18nConfigMismatchWarning;
|
|
131
139
|
exports.createUnresolvedNextVersionError = createUnresolvedNextVersionError;
|
|
132
140
|
exports.createUnresolvedReactVersionError = createUnresolvedReactVersionError;
|
|
133
141
|
exports.customGetLocaleUnresolvedWarning = customGetLocaleUnresolvedWarning;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createErrors.js","names":["createGtNextDiagnostic","createGtNextPluginDiagnostic","SWC_PLUGIN_SUPPORT","BABEL_PLUGIN_SUPPORT"],"sources":["../../src/errors/createErrors.ts"],"sourcesContent":["// ---- ERRORS ---- //\n\nimport {\n createGtNextDiagnostic,\n createGtNextPluginDiagnostic,\n} from './diagnostics';\nimport { BABEL_PLUGIN_SUPPORT, SWC_PLUGIN_SUPPORT } from '../plugin/constants';\n\nexport const remoteTranslationsError = createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'Remote translations could not be loaded',\n fix: 'Check your project ID, API key, and network connection, then try again',\n wayOut: 'Source content will render as a fallback',\n});\n\nexport const customLoadTranslationsError = (locale: string = '') =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: `Locally stored translations could not be loaded${locale ? ` for \"${locale}\"` : ''}`,\n fix: 'If you use loadTranslations(), make sure it returns translations for the requested locale',\n });\n\nexport const customLoadDictionaryWarning = (locale: string = '') =>\n createGtNextDiagnostic({\n severity: 'Warning',\n whatHappened: `The local dictionary could not be loaded${locale ? ` for \"${locale}\"` : ''}`,\n fix: 'If you use loadDictionary(), make sure it returns a dictionary for the requested locale',\n });\n\nexport const createUnresolvedNextVersionError = (error: Error) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'The installed Next.js version could not be resolved',\n fix: 'Check that next is installed in this project',\n details: error.message,\n });\n\nexport const createUnresolvedReactVersionError = (error: Error) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'The installed React version could not be resolved',\n fix: 'Check that react is installed in this project',\n details: error.message,\n });\n\nexport const devApiKeyIncludedInProductionError = createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'Production builds cannot use a development API key',\n fix: 'Replace it with a production API key',\n});\n\nexport const createDictionarySubsetError = (id: string, functionName: string) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: `${functionName} with id \"${id}\" could not read a valid dictionary subtree`,\n fix: 'Make sure the id maps to the correct subroute of the dictionary',\n });\n\nexport const unresolvedLoadDictionaryBuildError = (path: string) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: `The file defining loadDictionary() could not be resolved at ${path}`,\n fix: 'Check the configured path and try again',\n });\n\nexport const unresolvedLoadTranslationsBuildError = (path: string) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: `The file defining loadTranslations() could not be resolved at ${path}`,\n fix: 'Check the configured path and try again',\n });\n\nexport const conflictingConfigurationBuildError = (conflicts: string[]) =>\n `gt-next Error: Conflicting configuration${\n conflicts.length > 1 ? 's' : ''\n } detected. Resolve the following conflicts before building your app:\\n${conflicts.join(\n '\\n'\n )}`;\n\nexport const typesFileError = createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'A types-only entry point was executed at runtime',\n fix: 'Import from the appropriate gt-next runtime entry point instead',\n});\n\nexport const getTranslationsSnapshotRscError = createGtNextDiagnostic({\n severity: 'Error',\n whatHappened:\n 'getTranslationsSnapshot() is not available for React Server Components',\n fix: 'Use gt-next build-time translation helpers in the App Router, or call getTranslationsSnapshot() from a Pages Router entry point',\n});\n\nexport const withGTStaticPropsRscError = createGtNextDiagnostic({\n severity: 'Error',\n whatHappened:\n 'withGTStaticProps() is not available for React Server Components',\n why: 'This helper supports the Pages Router, not the App Router',\n fix: 'Use gt-next build-time translation helpers in the App Router, or export withGTStaticProps() from a Pages Router page module',\n});\n\nexport const invalidLocalesError = (locales: string[]) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'Invalid locale codes in your configuration',\n fix: 'Specify a list of valid locales or use \"customMapping\" to define aliases for the invalid locales',\n details: locales,\n });\n\nexport const invalidCanonicalLocalesError = (locales: string[]) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'Invalid canonical locale codes in your configuration',\n fix: 'Use valid BCP 47 locale codes before starting translation',\n details: locales,\n });\n\n// ---- WARNINGS ---- //\n\nexport const createBadFilepathWarning = (filename: string, dir: string[]) =>\n createGtNextDiagnostic({\n whatHappened: `${filename} was found in ${dir.join(' or ')}, which is not supported`,\n fix: 'Move it to your project root so gt-next can load it',\n });\n\nexport const projectIdMissingWarn = createGtNextDiagnostic({\n whatHappened: 'Runtime translation needs a project ID',\n fix: 'Set GT_PROJECT_ID in your environment or pass projectId to withGTConfig()',\n docsUrl: 'https://generaltranslation.com/dashboard',\n});\n\nexport const APIKeyMissingWarn = createGtNextPluginDiagnostic({\n whatHappened: 'Runtime translation needs a development API key',\n fix: 'Find your development API key at generaltranslation.com/dashboard, or set runtimeUrl to an empty string to disable runtime translation',\n});\n\nexport const standardizedLocalesWarning = (locales: string[]) =>\n `gt-next: The following locales were standardized: ${locales.join(', ')}. Use the standardized codes in your config to avoid this warning.`;\n\nexport const standardizedCanonicalLocalesWarning = (locales: string[]) =>\n `gt-next: The following canonical locales were standardized: ${locales.join(', ')}. Use the standardized codes in your config to avoid this warning.`;\n\nexport const createGTCompilerUnresolvedWarning = (type: 'babel' | 'swc') =>\n createGtNextPluginDiagnostic({\n whatHappened: `The GT ${type} compiler could not be resolved`,\n wayOut: 'Skipping compiler optimizations',\n ...(type === 'babel' && {\n fix: 'Install @generaltranslation/compiler to enable the experimental babel compiler',\n }),\n });\n\nexport const autoJsxInjectionCompilerWarning = createGtNextPluginDiagnostic({\n severity: 'Warning',\n whatHappened: 'Automatic JSX injection requires the GT webpack compiler',\n wayOut: 'Automatic JSX injection will be skipped',\n fix: \"Set experimentalCompilerOptions.type to 'babel' in withGTConfig() and build with webpack\",\n});\n\nexport const customGetLocaleUnresolvedWarning = createGtNextDiagnostic({\n whatHappened: 'Custom getLocale() could not be resolved',\n wayOut: 'gt-next will fall back to default locale detection',\n fix: 'Export a getLocale() function from the configured request file',\n});\n\nexport const customGetRegionUnresolvedWarning = createGtNextDiagnostic({\n whatHappened: 'Custom getRegion() could not be resolved',\n wayOut: 'gt-next will fall back to default region detection',\n fix: 'Export a getRegion() function from the configured request file',\n});\n\nexport const createGTCompilerUnavailableWarning = (type: 'babel' | 'swc') =>\n type === 'swc'\n ? `gt-next (plugin): The GT swc compiler is compatible with < next@${SWC_PLUGIN_SUPPORT}. Skipping compiler optimizations.`\n : `gt-next (plugin): The GT babel compiler requires react@${BABEL_PLUGIN_SUPPORT} or newer. Skipping compiler optimizations.`;\n\nexport const babelCompilerTurbopackUnavailableWarning =\n `gt-next (plugin): The GT babel compiler is not compatible with Turbopack. ` +\n `To use compiler optimizations with Turbopack, set experimentalCompilerOptions: { type: 'swc' }.`;\n\nexport const disablingCompileTimeHashWarning = `gt-next (plugin): Compile-time hash is disabled. Compiler optimizations are inactive.`;\n\nexport const swcPluginCompatibilityChangeWarning = `gt-next (plugin): As of gt-next@6.12.4, SWC plugin support is disabled for Next.js versions prior to ${SWC_PLUGIN_SUPPORT}. Update to the latest version of Next.js.`;\n"],"mappings":";;;;AAQA,MAAa,0BAA0BA,2BAAAA,uBAAuB;CAC5D,UAAU;CACV,cAAc;CACd,KAAK;CACL,QAAQ;CACT,CAAC;AAEF,MAAa,+BAA+B,SAAiB,OAC3DA,2BAAAA,uBAAuB;CACrB,UAAU;CACV,cAAc,kDAAkD,SAAS,SAAS,OAAO,KAAK;CAC9F,KAAK;CACN,CAAC;AAEJ,MAAa,+BAA+B,SAAiB,OAC3DA,2BAAAA,uBAAuB;CACrB,UAAU;CACV,cAAc,2CAA2C,SAAS,SAAS,OAAO,KAAK;CACvF,KAAK;CACN,CAAC;AAEJ,MAAa,oCAAoC,UAC/CA,2BAAAA,uBAAuB;CACrB,UAAU;CACV,cAAc;CACd,KAAK;CACL,SAAS,MAAM;CA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A,2BAAAA,uBAAuB;CACzD,cAAc;CACd,KAAK;CACL,SAAS;CACV,CAAC;AAEF,MAAa,oBAAoBC,2BAAAA,6BAA6B;CAC5D,cAAc;CACd,KAAK;CACN,CAAC;AAEF,MAAa,8BAA8B,YACzC,qDAAqD,QAAQ,KAAK,KAAK,CAAC;AAE1E,MAAa,uCAAuC,YAClD,+DAA+D,QAAQ,KAAK,KAAK,CAAC;AAEpF,MAAa,qCAAqC,SAChDA,2BAAAA,6BAA6B;CAC3B,cAAc,UAAU,KAAK;CAC7B,QAAQ;CACR,GAAI,SAAS,WAAW,EACtB,KAAK,kFACN;CACF,CAAC;AAEJ,MAAa,kCAAkCA,2BAAAA,6BAA6B;CAC1E,UAAU;CACV,cAAc;CACd,QAAQ;CACR,KAAK;CACN,CAAC;AAEF,MAAa,mCAAmCD,2BAAAA,uBAAuB;CACrE,cAAc;CACd,QAAQ;CACR,KAAK;CACN,CAAC;AAEF,MAAa,mCAAmCA,2BAAAA,uBAAuB;CACrE,cAAc;CACd,QAAQ;CACR,KAAK;CACN,CAAC;AAEF,MAAa,sCAAsC,SACjD,SAAS,QACL,mEAAmEE,yBAAAA,mBAAmB,sCACtF,0DAA0DC,yBAAAA,qBAAqB;AAErF,MAAa,2CACX;AAGF,MAAa,kCAAkC;AAE/C,MAAa,sCAAsC,wGAAwGD,yBAAAA,mBAAmB"}
|
|
1
|
+
{"version":3,"file":"createErrors.js","names":["createGtNextDiagnostic","createGtNextPluginDiagnostic","SWC_PLUGIN_SUPPORT","BABEL_PLUGIN_SUPPORT"],"sources":["../../src/errors/createErrors.ts"],"sourcesContent":["// ---- ERRORS ---- //\n\nimport {\n createGtNextDiagnostic,\n createGtNextPluginDiagnostic,\n} from './diagnostics';\nimport { BABEL_PLUGIN_SUPPORT, SWC_PLUGIN_SUPPORT } from '../plugin/constants';\n\nexport const remoteTranslationsError = createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'Remote translations could not be loaded',\n fix: 'Check your project ID, API key, and network connection, then try again',\n wayOut: 'Source content will render as a fallback',\n});\n\nexport const customLoadTranslationsError = (locale: string = '') =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: `Locally stored translations could not be loaded${locale ? ` for \"${locale}\"` : ''}`,\n fix: 'If you use loadTranslations(), make sure it returns translations for the requested locale',\n });\n\nexport const customLoadDictionaryWarning = (locale: string = '') =>\n createGtNextDiagnostic({\n severity: 'Warning',\n whatHappened: `The local dictionary could not be loaded${locale ? ` for \"${locale}\"` : ''}`,\n fix: 'If you use loadDictionary(), make sure it returns a dictionary for the requested locale',\n });\n\nexport const createUnresolvedNextVersionError = (error: Error) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'The installed Next.js version could not be resolved',\n fix: 'Check that next is installed in this project',\n details: error.message,\n });\n\nexport const createUnresolvedReactVersionError = (error: Error) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'The installed React version could not be resolved',\n fix: 'Check that react is installed in this project',\n details: error.message,\n });\n\nexport const devApiKeyIncludedInProductionError = createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'Production builds cannot use a development API key',\n fix: 'Replace it with a production API key',\n});\n\nexport const createDictionarySubsetError = (id: string, functionName: string) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: `${functionName} with id \"${id}\" could not read a valid dictionary subtree`,\n fix: 'Make sure the id maps to the correct subroute of the dictionary',\n });\n\nexport const unresolvedLoadDictionaryBuildError = (path: string) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: `The file defining loadDictionary() could not be resolved at ${path}`,\n fix: 'Check the configured path and try again',\n });\n\nexport const unresolvedLoadTranslationsBuildError = (path: string) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: `The file defining loadTranslations() could not be resolved at ${path}`,\n fix: 'Check the configured path and try again',\n });\n\nexport const conflictingConfigurationBuildError = (conflicts: string[]) =>\n `gt-next Error: Conflicting configuration${\n conflicts.length > 1 ? 's' : ''\n } detected. Resolve the following conflicts before building your app:\\n${conflicts.join(\n '\\n'\n )}`;\n\nexport const typesFileError = createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'A types-only entry point was executed at runtime',\n fix: 'Import from the appropriate gt-next runtime entry point instead',\n});\n\nexport const getTranslationsSnapshotRscError = createGtNextDiagnostic({\n severity: 'Error',\n whatHappened:\n 'getTranslationsSnapshot() is not available for React Server Components',\n fix: 'Use gt-next build-time translation helpers in the App Router, or call getTranslationsSnapshot() from a Pages Router entry point',\n});\n\nexport const withGTStaticPropsRscError = createGtNextDiagnostic({\n severity: 'Error',\n whatHappened:\n 'withGTStaticProps() is not available for React Server Components',\n why: 'This helper supports the Pages Router, not the App Router',\n fix: 'Use gt-next build-time translation helpers in the App Router, or export withGTStaticProps() from a Pages Router page module',\n});\n\nexport const invalidLocalesError = (locales: string[]) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'Invalid locale codes in your configuration',\n fix: 'Specify a list of valid locales or use \"customMapping\" to define aliases for the invalid locales',\n details: locales,\n });\n\nexport const invalidCanonicalLocalesError = (locales: string[]) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'Invalid canonical locale codes in your configuration',\n fix: 'Use valid BCP 47 locale codes before starting translation',\n details: locales,\n });\n\n// ---- WARNINGS ---- //\n\nexport const createBadFilepathWarning = (filename: string, dir: string[]) =>\n createGtNextDiagnostic({\n whatHappened: `${filename} was found in ${dir.join(' or ')}, which is not supported`,\n fix: 'Move it to your project root so gt-next can load it',\n });\n\nexport const projectIdMissingWarn = createGtNextDiagnostic({\n whatHappened: 'Runtime translation needs a project ID',\n fix: 'Set GT_PROJECT_ID in your environment or pass projectId to withGTConfig()',\n docsUrl: 'https://generaltranslation.com/dashboard',\n});\n\nexport const APIKeyMissingWarn = createGtNextPluginDiagnostic({\n whatHappened: 'Runtime translation needs a development API key',\n fix: 'Find your development API key at generaltranslation.com/dashboard, or set runtimeUrl to an empty string to disable runtime translation',\n});\n\nexport const standardizedLocalesWarning = (locales: string[]) =>\n `gt-next: The following locales were standardized: ${locales.join(', ')}. Use the standardized codes in your config to avoid this warning.`;\n\nexport const standardizedCanonicalLocalesWarning = (locales: string[]) =>\n `gt-next: The following canonical locales were standardized: ${locales.join(', ')}. Use the standardized codes in your config to avoid this warning.`;\n\nexport const createNextI18nConfigMismatchWarning = (details: string[]) =>\n createGtNextPluginDiagnostic({\n severity: 'Warning',\n whatHappened:\n 'Next.js internationalized routing does not match the GT config file',\n why: 'Next.js may select a locale that GT is not configured to translate',\n fix: 'Use the same defaultLocale and locales values in both configurations',\n details,\n });\n\nexport const createGTCompilerUnresolvedWarning = (type: 'babel' | 'swc') =>\n createGtNextPluginDiagnostic({\n whatHappened: `The GT ${type} compiler could not be resolved`,\n wayOut: 'Skipping compiler optimizations',\n ...(type === 'babel' && {\n fix: 'Install @generaltranslation/compiler to enable the experimental babel compiler',\n }),\n });\n\nexport const autoJsxInjectionCompilerWarning = createGtNextPluginDiagnostic({\n severity: 'Warning',\n whatHappened: 'Automatic JSX injection requires the GT webpack compiler',\n wayOut: 'Automatic JSX injection will be skipped',\n fix: \"Set experimentalCompilerOptions.type to 'babel' in withGTConfig() and build with webpack\",\n});\n\nexport const customGetLocaleUnresolvedWarning = createGtNextDiagnostic({\n whatHappened: 'Custom getLocale() could not be resolved',\n wayOut: 'gt-next will fall back to default locale detection',\n fix: 'Export a getLocale() function from the configured request file',\n});\n\nexport const customGetRegionUnresolvedWarning = createGtNextDiagnostic({\n whatHappened: 'Custom getRegion() could not be resolved',\n wayOut: 'gt-next will fall back to default region detection',\n fix: 'Export a getRegion() function from the configured request file',\n});\n\nexport const createGTCompilerUnavailableWarning = (type: 'babel' | 'swc') =>\n type === 'swc'\n ? `gt-next (plugin): The GT swc compiler is compatible with < next@${SWC_PLUGIN_SUPPORT}. Skipping compiler optimizations.`\n : `gt-next (plugin): The GT babel compiler requires react@${BABEL_PLUGIN_SUPPORT} or newer. Skipping compiler optimizations.`;\n\nexport const babelCompilerTurbopackUnavailableWarning =\n `gt-next (plugin): The GT babel compiler is not compatible with Turbopack. ` +\n `To use compiler optimizations with Turbopack, set experimentalCompilerOptions: { type: 'swc' }.`;\n\nexport const disablingCompileTimeHashWarning = `gt-next (plugin): Compile-time hash is disabled. Compiler optimizations are inactive.`;\n\nexport const swcPluginCompatibilityChangeWarning = `gt-next (plugin): As of gt-next@6.12.4, SWC plugin support is disabled for Next.js versions prior to ${SWC_PLUGIN_SUPPORT}. Update to the latest version of Next.js.`;\n"],"mappings":";;;;AAQA,MAAa,0BAA0BA,2BAAAA,uBAAuB;CAC5D,UAAU;CACV,cAAc;CACd,KAAK;CACL,QAAQ;CACT,CAAC;AAEF,MAAa,+BAA+B,SAAiB,OAC3DA,2BAAAA,uBAAuB;CACrB,UAAU;CACV,cAAc,kDAAkD,SAAS,SAAS,OAAO,KAAK;CAC9F,KAAK;CACN,CAAC;AAEJ,MAAa,+BAA+B,SAAiB,OAC3DA,2BAAAA,uBAAuB;CACrB,UAAU;CACV,cAAc,2CAA2C,SAAS,SAAS,OAAO,KAAK;CACvF,KAAK;CACN,CAAC;AAEJ,MAAa,oCAAoC,UAC/CA,2BAAAA,uBAAuB;CACrB,UAAU;CACV,cAAc;CACd,KAAK;CACL,SAAS,MAAM;CAChB,CAAC;AAEJ,MAAa,qCAAqC,UAChDA,2BAAAA,uBAAuB;CACrB,UAAU;CACV,cAAc;CACd,KAAK;CACL,SAAS,MAAM;CAChB,CAAC;AAEJ,MAAa,qCAAqCA,2BAAAA,uBAAuB;CACvE,UAAU;CACV,cAAc;CACd,KAAK;CACN,CAAC;AAEF,MAAa,+BAA+B,IAAY,iBACtDA,2BAAAA,uBAAuB;CACrB,UAAU;CACV,cAAc,GAAG,aAAa,YAAY,GAAG;CAC7C,KAAK;CACN,CAAC;AAEJ,MAAa,sCAAsC,SACjDA,2BAAAA,uBAAuB;CACrB,UAAU;CACV,cAAc,+DAA+D;CAC7E,KAAK;CACN,CAAC;AAEJ,MAAa,wCAAwC,S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;CACR,GAAI,SAAS,WAAW,EACtB,KAAK,kFACN;CACF,CAAC;AAEJ,MAAa,kCAAkCA,2BAAAA,6BAA6B;CAC1E,UAAU;CACV,cAAc;CACd,QAAQ;CACR,KAAK;CACN,CAAC;AAEF,MAAa,mCAAmCD,2BAAAA,uBAAuB;CACrE,cAAc;CACd,QAAQ;CACR,KAAK;CACN,CAAC;AAEF,MAAa,mCAAmCA,2BAAAA,uBAAuB;CACrE,cAAc;CACd,QAAQ;CACR,KAAK;CACN,CAAC;AAEF,MAAa,sCAAsC,SACjD,SAAS,QACL,mEAAmEE,yBAAAA,mBAAmB,sCACtF,0DAA0DC,yBAAAA,qBAAqB;AAErF,MAAa,2CACX;AAGF,MAAa,kCAAkC;AAE/C,MAAa,sCAAsC,wGAAwGD,yBAAAA,mBAAmB"}
|
|
@@ -93,6 +93,13 @@ const APIKeyMissingWarn = createGtNextPluginDiagnostic({
|
|
|
93
93
|
});
|
|
94
94
|
const standardizedLocalesWarning = (locales) => `gt-next: The following locales were standardized: ${locales.join(", ")}. Use the standardized codes in your config to avoid this warning.`;
|
|
95
95
|
const standardizedCanonicalLocalesWarning = (locales) => `gt-next: The following canonical locales were standardized: ${locales.join(", ")}. Use the standardized codes in your config to avoid this warning.`;
|
|
96
|
+
const createNextI18nConfigMismatchWarning = (details) => createGtNextPluginDiagnostic({
|
|
97
|
+
severity: "Warning",
|
|
98
|
+
whatHappened: "Next.js internationalized routing does not match the GT config file",
|
|
99
|
+
why: "Next.js may select a locale that GT is not configured to translate",
|
|
100
|
+
fix: "Use the same defaultLocale and locales values in both configurations",
|
|
101
|
+
details
|
|
102
|
+
});
|
|
96
103
|
const createGTCompilerUnresolvedWarning = (type) => createGtNextPluginDiagnostic({
|
|
97
104
|
whatHappened: `The GT ${type} compiler could not be resolved`,
|
|
98
105
|
wayOut: "Skipping compiler optimizations",
|
|
@@ -119,6 +126,6 @@ const babelCompilerTurbopackUnavailableWarning = "gt-next (plugin): The GT babel
|
|
|
119
126
|
const disablingCompileTimeHashWarning = `gt-next (plugin): Compile-time hash is disabled. Compiler optimizations are inactive.`;
|
|
120
127
|
const swcPluginCompatibilityChangeWarning = `gt-next (plugin): As of gt-next@6.12.4, SWC plugin support is disabled for Next.js versions prior to ${SWC_PLUGIN_SUPPORT}. Update to the latest version of Next.js.`;
|
|
121
128
|
//#endregion
|
|
122
|
-
export { APIKeyMissingWarn, autoJsxInjectionCompilerWarning, babelCompilerTurbopackUnavailableWarning, conflictingConfigurationBuildError, createBadFilepathWarning, createDictionarySubsetError, createGTCompilerUnavailableWarning, createGTCompilerUnresolvedWarning, createUnresolvedNextVersionError, createUnresolvedReactVersionError, customGetLocaleUnresolvedWarning, customGetRegionUnresolvedWarning, customLoadDictionaryWarning, customLoadTranslationsError, devApiKeyIncludedInProductionError, disablingCompileTimeHashWarning, getTranslationsSnapshotRscError, invalidCanonicalLocalesError, invalidLocalesError, projectIdMissingWarn, remoteTranslationsError, standardizedCanonicalLocalesWarning, standardizedLocalesWarning, swcPluginCompatibilityChangeWarning, typesFileError, unresolvedLoadDictionaryBuildError, unresolvedLoadTranslationsBuildError, withGTStaticPropsRscError };
|
|
129
|
+
export { APIKeyMissingWarn, autoJsxInjectionCompilerWarning, babelCompilerTurbopackUnavailableWarning, conflictingConfigurationBuildError, createBadFilepathWarning, createDictionarySubsetError, createGTCompilerUnavailableWarning, createGTCompilerUnresolvedWarning, createNextI18nConfigMismatchWarning, createUnresolvedNextVersionError, createUnresolvedReactVersionError, customGetLocaleUnresolvedWarning, customGetRegionUnresolvedWarning, customLoadDictionaryWarning, customLoadTranslationsError, devApiKeyIncludedInProductionError, disablingCompileTimeHashWarning, getTranslationsSnapshotRscError, invalidCanonicalLocalesError, invalidLocalesError, projectIdMissingWarn, remoteTranslationsError, standardizedCanonicalLocalesWarning, standardizedLocalesWarning, swcPluginCompatibilityChangeWarning, typesFileError, unresolvedLoadDictionaryBuildError, unresolvedLoadTranslationsBuildError, withGTStaticPropsRscError };
|
|
123
130
|
|
|
124
131
|
//# sourceMappingURL=createErrors.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createErrors.mjs","names":[],"sources":["../../src/errors/createErrors.ts"],"sourcesContent":["// ---- ERRORS ---- //\n\nimport {\n createGtNextDiagnostic,\n createGtNextPluginDiagnostic,\n} from './diagnostics';\nimport { BABEL_PLUGIN_SUPPORT, SWC_PLUGIN_SUPPORT } from '../plugin/constants';\n\nexport const remoteTranslationsError = createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'Remote translations could not be loaded',\n fix: 'Check your project ID, API key, and network connection, then try again',\n wayOut: 'Source content will render as a fallback',\n});\n\nexport const customLoadTranslationsError = (locale: string = '') =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: `Locally stored translations could not be loaded${locale ? ` for \"${locale}\"` : ''}`,\n fix: 'If you use loadTranslations(), make sure it returns translations for the requested locale',\n });\n\nexport const customLoadDictionaryWarning = (locale: string = '') =>\n createGtNextDiagnostic({\n severity: 'Warning',\n whatHappened: `The local dictionary could not be loaded${locale ? ` for \"${locale}\"` : ''}`,\n fix: 'If you use loadDictionary(), make sure it returns a dictionary for the requested locale',\n });\n\nexport const createUnresolvedNextVersionError = (error: Error) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'The installed Next.js version could not be resolved',\n fix: 'Check that next is installed in this project',\n details: error.message,\n });\n\nexport const createUnresolvedReactVersionError = (error: Error) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'The installed React version could not be resolved',\n fix: 'Check that react is installed in this project',\n details: error.message,\n });\n\nexport const devApiKeyIncludedInProductionError = createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'Production builds cannot use a development API key',\n fix: 'Replace it with a production API key',\n});\n\nexport const createDictionarySubsetError = (id: string, functionName: string) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: `${functionName} with id \"${id}\" could not read a valid dictionary subtree`,\n fix: 'Make sure the id maps to the correct subroute of the dictionary',\n });\n\nexport const unresolvedLoadDictionaryBuildError = (path: string) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: `The file defining loadDictionary() could not be resolved at ${path}`,\n fix: 'Check the configured path and try again',\n });\n\nexport const unresolvedLoadTranslationsBuildError = (path: string) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: `The file defining loadTranslations() could not be resolved at ${path}`,\n fix: 'Check the configured path and try again',\n });\n\nexport const conflictingConfigurationBuildError = (conflicts: string[]) =>\n `gt-next Error: Conflicting configuration${\n conflicts.length > 1 ? 's' : ''\n } detected. Resolve the following conflicts before building your app:\\n${conflicts.join(\n '\\n'\n )}`;\n\nexport const typesFileError = createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'A types-only entry point was executed at runtime',\n fix: 'Import from the appropriate gt-next runtime entry point instead',\n});\n\nexport const getTranslationsSnapshotRscError = createGtNextDiagnostic({\n severity: 'Error',\n whatHappened:\n 'getTranslationsSnapshot() is not available for React Server Components',\n fix: 'Use gt-next build-time translation helpers in the App Router, or call getTranslationsSnapshot() from a Pages Router entry point',\n});\n\nexport const withGTStaticPropsRscError = createGtNextDiagnostic({\n severity: 'Error',\n whatHappened:\n 'withGTStaticProps() is not available for React Server Components',\n why: 'This helper supports the Pages Router, not the App Router',\n fix: 'Use gt-next build-time translation helpers in the App Router, or export withGTStaticProps() from a Pages Router page module',\n});\n\nexport const invalidLocalesError = (locales: string[]) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'Invalid locale codes in your configuration',\n fix: 'Specify a list of valid locales or use \"customMapping\" to define aliases for the invalid locales',\n details: locales,\n });\n\nexport const invalidCanonicalLocalesError = (locales: string[]) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'Invalid canonical locale codes in your configuration',\n fix: 'Use valid BCP 47 locale codes before starting translation',\n details: locales,\n });\n\n// ---- WARNINGS ---- //\n\nexport const createBadFilepathWarning = (filename: string, dir: string[]) =>\n createGtNextDiagnostic({\n whatHappened: `${filename} was found in ${dir.join(' or ')}, which is not supported`,\n fix: 'Move it to your project root so gt-next can load it',\n });\n\nexport const projectIdMissingWarn = createGtNextDiagnostic({\n whatHappened: 'Runtime translation needs a project ID',\n fix: 'Set GT_PROJECT_ID in your environment or pass projectId to withGTConfig()',\n docsUrl: 'https://generaltranslation.com/dashboard',\n});\n\nexport const APIKeyMissingWarn = createGtNextPluginDiagnostic({\n whatHappened: 'Runtime translation needs a development API key',\n fix: 'Find your development API key at generaltranslation.com/dashboard, or set runtimeUrl to an empty string to disable runtime translation',\n});\n\nexport const standardizedLocalesWarning = (locales: string[]) =>\n `gt-next: The following locales were standardized: ${locales.join(', ')}. Use the standardized codes in your config to avoid this warning.`;\n\nexport const standardizedCanonicalLocalesWarning = (locales: string[]) =>\n `gt-next: The following canonical locales were standardized: ${locales.join(', ')}. Use the standardized codes in your config to avoid this warning.`;\n\nexport const createGTCompilerUnresolvedWarning = (type: 'babel' | 'swc') =>\n createGtNextPluginDiagnostic({\n whatHappened: `The GT ${type} compiler could not be resolved`,\n wayOut: 'Skipping compiler optimizations',\n ...(type === 'babel' && {\n fix: 'Install @generaltranslation/compiler to enable the experimental babel compiler',\n }),\n });\n\nexport const autoJsxInjectionCompilerWarning = createGtNextPluginDiagnostic({\n severity: 'Warning',\n whatHappened: 'Automatic JSX injection requires the GT webpack compiler',\n wayOut: 'Automatic JSX injection will be skipped',\n fix: \"Set experimentalCompilerOptions.type to 'babel' in withGTConfig() and build with webpack\",\n});\n\nexport const customGetLocaleUnresolvedWarning = createGtNextDiagnostic({\n whatHappened: 'Custom getLocale() could not be resolved',\n wayOut: 'gt-next will fall back to default locale detection',\n fix: 'Export a getLocale() function from the configured request file',\n});\n\nexport const customGetRegionUnresolvedWarning = createGtNextDiagnostic({\n whatHappened: 'Custom getRegion() could not be resolved',\n wayOut: 'gt-next will fall back to default region detection',\n fix: 'Export a getRegion() function from the configured request file',\n});\n\nexport const createGTCompilerUnavailableWarning = (type: 'babel' | 'swc') =>\n type === 'swc'\n ? `gt-next (plugin): The GT swc compiler is compatible with < next@${SWC_PLUGIN_SUPPORT}. Skipping compiler optimizations.`\n : `gt-next (plugin): The GT babel compiler requires react@${BABEL_PLUGIN_SUPPORT} or newer. Skipping compiler optimizations.`;\n\nexport const babelCompilerTurbopackUnavailableWarning =\n `gt-next (plugin): The GT babel compiler is not compatible with Turbopack. ` +\n `To use compiler optimizations with Turbopack, set experimentalCompilerOptions: { type: 'swc' }.`;\n\nexport const disablingCompileTimeHashWarning = `gt-next (plugin): Compile-time hash is disabled. Compiler optimizations are inactive.`;\n\nexport const swcPluginCompatibilityChangeWarning = `gt-next (plugin): As of gt-next@6.12.4, SWC plugin support is disabled for Next.js versions prior to ${SWC_PLUGIN_SUPPORT}. Update to the latest version of Next.js.`;\n"],"mappings":";;;AAQA,MAAa,0BAA0B,uBAAuB;CAC5D,UAAU;CACV,cAAc;CACd,KAAK;CACL,QAAQ;CACT,CAAC;AAEF,MAAa,+BAA+B,SAAiB,OAC3D,uBAAuB;CACrB,UAAU;CACV,cAAc,kDAAkD,SAAS,SAAS,OAAO,KAAK;CAC9F,KAAK;CACN,CAAC;AAEJ,MAAa,+BAA+B,SAAiB,OAC3D,uBAAuB;CACrB,UAAU;CACV,cAAc,2CAA2C,SAAS,SAAS,OAAO,KAAK;CACvF,KAAK;CACN,CAAC;AAEJ,MAAa,oCAAoC,UAC/C,uBAAuB;CACrB,UAAU;CACV,cAAc;CACd,KAAK;CACL,SAAS,MAAM;CAChB,CAAC;AAEJ,MAAa,qCAAqC,UAChD,uBAAuB;CACrB,UAAU;CACV,cAAc;CACd,KAAK;CACL,SAAS,MAAM;CAChB,CAAC;AAEJ,MAAa,qCAAqC,uBAAuB;CACvE,UAAU;CACV,cAAc;CACd,KAAK;CACN,CAAC;AAEF,MAAa,+BAA+B,IAAY,iBACtD,uBAAuB;CACrB,UAAU;CACV,cAAc,GAAG,aAAa,YAAY,GAAG;CAC7C,KAAK;CACN,CAAC;AAEJ,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;CACV,cAAc;CACd,QAAQ;CACR,KAAK;CACN,CAAC;AAEF,MAAa,mCAAmC,uBAAuB;CACrE,cAAc;CACd,QAAQ;CACR,KAAK;CACN,CAAC;AAEF,MAAa,mCAAmC,uBAAuB;CACrE,cAAc;CACd,QAAQ;CACR,KAAK;CACN,CAAC;AAEF,MAAa,sCAAsC,SACjD,SAAS,QACL,mEAAmE,mBAAmB,sCACtF,0DAA0D,qBAAqB;AAErF,MAAa,2CACX;AAGF,MAAa,kCAAkC;AAE/C,MAAa,sCAAsC,wGAAwG,mBAAmB"}
|
|
1
|
+
{"version":3,"file":"createErrors.mjs","names":[],"sources":["../../src/errors/createErrors.ts"],"sourcesContent":["// ---- ERRORS ---- //\n\nimport {\n createGtNextDiagnostic,\n createGtNextPluginDiagnostic,\n} from './diagnostics';\nimport { BABEL_PLUGIN_SUPPORT, SWC_PLUGIN_SUPPORT } from '../plugin/constants';\n\nexport const remoteTranslationsError = createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'Remote translations could not be loaded',\n fix: 'Check your project ID, API key, and network connection, then try again',\n wayOut: 'Source content will render as a fallback',\n});\n\nexport const customLoadTranslationsError = (locale: string = '') =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: `Locally stored translations could not be loaded${locale ? ` for \"${locale}\"` : ''}`,\n fix: 'If you use loadTranslations(), make sure it returns translations for the requested locale',\n });\n\nexport const customLoadDictionaryWarning = (locale: string = '') =>\n createGtNextDiagnostic({\n severity: 'Warning',\n whatHappened: `The local dictionary could not be loaded${locale ? ` for \"${locale}\"` : ''}`,\n fix: 'If you use loadDictionary(), make sure it returns a dictionary for the requested locale',\n });\n\nexport const createUnresolvedNextVersionError = (error: Error) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'The installed Next.js version could not be resolved',\n fix: 'Check that next is installed in this project',\n details: error.message,\n });\n\nexport const createUnresolvedReactVersionError = (error: Error) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'The installed React version could not be resolved',\n fix: 'Check that react is installed in this project',\n details: error.message,\n });\n\nexport const devApiKeyIncludedInProductionError = createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'Production builds cannot use a development API key',\n fix: 'Replace it with a production API key',\n});\n\nexport const createDictionarySubsetError = (id: string, functionName: string) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: `${functionName} with id \"${id}\" could not read a valid dictionary subtree`,\n fix: 'Make sure the id maps to the correct subroute of the dictionary',\n });\n\nexport const unresolvedLoadDictionaryBuildError = (path: string) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: `The file defining loadDictionary() could not be resolved at ${path}`,\n fix: 'Check the configured path and try again',\n });\n\nexport const unresolvedLoadTranslationsBuildError = (path: string) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: `The file defining loadTranslations() could not be resolved at ${path}`,\n fix: 'Check the configured path and try again',\n });\n\nexport const conflictingConfigurationBuildError = (conflicts: string[]) =>\n `gt-next Error: Conflicting configuration${\n conflicts.length > 1 ? 's' : ''\n } detected. Resolve the following conflicts before building your app:\\n${conflicts.join(\n '\\n'\n )}`;\n\nexport const typesFileError = createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'A types-only entry point was executed at runtime',\n fix: 'Import from the appropriate gt-next runtime entry point instead',\n});\n\nexport const getTranslationsSnapshotRscError = createGtNextDiagnostic({\n severity: 'Error',\n whatHappened:\n 'getTranslationsSnapshot() is not available for React Server Components',\n fix: 'Use gt-next build-time translation helpers in the App Router, or call getTranslationsSnapshot() from a Pages Router entry point',\n});\n\nexport const withGTStaticPropsRscError = createGtNextDiagnostic({\n severity: 'Error',\n whatHappened:\n 'withGTStaticProps() is not available for React Server Components',\n why: 'This helper supports the Pages Router, not the App Router',\n fix: 'Use gt-next build-time translation helpers in the App Router, or export withGTStaticProps() from a Pages Router page module',\n});\n\nexport const invalidLocalesError = (locales: string[]) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'Invalid locale codes in your configuration',\n fix: 'Specify a list of valid locales or use \"customMapping\" to define aliases for the invalid locales',\n details: locales,\n });\n\nexport const invalidCanonicalLocalesError = (locales: string[]) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'Invalid canonical locale codes in your configuration',\n fix: 'Use valid BCP 47 locale codes before starting translation',\n details: locales,\n });\n\n// ---- WARNINGS ---- //\n\nexport const createBadFilepathWarning = (filename: string, dir: string[]) =>\n createGtNextDiagnostic({\n whatHappened: `${filename} was found in ${dir.join(' or ')}, which is not supported`,\n fix: 'Move it to your project root so gt-next can load it',\n });\n\nexport const projectIdMissingWarn = createGtNextDiagnostic({\n whatHappened: 'Runtime translation needs a project ID',\n fix: 'Set GT_PROJECT_ID in your environment or pass projectId to withGTConfig()',\n docsUrl: 'https://generaltranslation.com/dashboard',\n});\n\nexport const APIKeyMissingWarn = createGtNextPluginDiagnostic({\n whatHappened: 'Runtime translation needs a development API key',\n fix: 'Find your development API key at generaltranslation.com/dashboard, or set runtimeUrl to an empty string to disable runtime translation',\n});\n\nexport const standardizedLocalesWarning = (locales: string[]) =>\n `gt-next: The following locales were standardized: ${locales.join(', ')}. Use the standardized codes in your config to avoid this warning.`;\n\nexport const standardizedCanonicalLocalesWarning = (locales: string[]) =>\n `gt-next: The following canonical locales were standardized: ${locales.join(', ')}. Use the standardized codes in your config to avoid this warning.`;\n\nexport const createNextI18nConfigMismatchWarning = (details: string[]) =>\n createGtNextPluginDiagnostic({\n severity: 'Warning',\n whatHappened:\n 'Next.js internationalized routing does not match the GT config file',\n why: 'Next.js may select a locale that GT is not configured to translate',\n fix: 'Use the same defaultLocale and locales values in both configurations',\n details,\n });\n\nexport const createGTCompilerUnresolvedWarning = (type: 'babel' | 'swc') =>\n createGtNextPluginDiagnostic({\n whatHappened: `The GT ${type} compiler could not be resolved`,\n wayOut: 'Skipping compiler optimizations',\n ...(type === 'babel' && {\n fix: 'Install @generaltranslation/compiler to enable the experimental babel compiler',\n }),\n });\n\nexport const autoJsxInjectionCompilerWarning = createGtNextPluginDiagnostic({\n severity: 'Warning',\n whatHappened: 'Automatic JSX injection requires the GT webpack compiler',\n wayOut: 'Automatic JSX injection will be skipped',\n fix: \"Set experimentalCompilerOptions.type to 'babel' in withGTConfig() and build with webpack\",\n});\n\nexport const customGetLocaleUnresolvedWarning = createGtNextDiagnostic({\n whatHappened: 'Custom getLocale() could not be resolved',\n wayOut: 'gt-next will fall back to default locale detection',\n fix: 'Export a getLocale() function from the configured request file',\n});\n\nexport const customGetRegionUnresolvedWarning = createGtNextDiagnostic({\n whatHappened: 'Custom getRegion() could not be resolved',\n wayOut: 'gt-next will fall back to default region detection',\n fix: 'Export a getRegion() function from the configured request file',\n});\n\nexport const createGTCompilerUnavailableWarning = (type: 'babel' | 'swc') =>\n type === 'swc'\n ? `gt-next (plugin): The GT swc compiler is compatible with < next@${SWC_PLUGIN_SUPPORT}. Skipping compiler optimizations.`\n : `gt-next (plugin): The GT babel compiler requires react@${BABEL_PLUGIN_SUPPORT} or newer. Skipping compiler optimizations.`;\n\nexport const babelCompilerTurbopackUnavailableWarning =\n `gt-next (plugin): The GT babel compiler is not compatible with Turbopack. ` +\n `To use compiler optimizations with Turbopack, set experimentalCompilerOptions: { type: 'swc' }.`;\n\nexport const disablingCompileTimeHashWarning = `gt-next (plugin): Compile-time hash is disabled. Compiler optimizations are inactive.`;\n\nexport const swcPluginCompatibilityChangeWarning = `gt-next (plugin): As of gt-next@6.12.4, SWC plugin support is disabled for Next.js versions prior to ${SWC_PLUGIN_SUPPORT}. Update to the latest version of Next.js.`;\n"],"mappings":";;;AAQA,MAAa,0BAA0B,uBAAuB;CAC5D,UAAU;CACV,cAAc;CACd,KAAK;CACL,QAAQ;CACT,CAAC;AAEF,MAAa,+BAA+B,SAAiB,OAC3D,uBAAuB;CACrB,UAAU;CACV,cAAc,kDAAkD,SAAS,SAAS,OAAO,KAAK;CAC9F,KAAK;CACN,CAAC;AAEJ,MAAa,+BAA+B,SAAiB,OAC3D,uBA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AAI,KAAK,OAAO,CAAC;CAC3D,KAAK;CACN,CAAC;AAEJ,MAAa,uBAAuB,uBAAuB;CACzD,cAAc;CACd,KAAK;CACL,SAAS;CACV,CAAC;AAEF,MAAa,oBAAoB,6BAA6B;CAC5D,cAAc;CACd,KAAK;CACN,CAAC;AAEF,MAAa,8BAA8B,YACzC,qDAAqD,QAAQ,KAAK,KAAK,CAAC;AAE1E,MAAa,uCAAuC,YAClD,+DAA+D,QAAQ,KAAK,KAAK,CAAC;AAEpF,MAAa,uCAAuC,YAClD,6BAA6B;CAC3B,UAAU;CACV,cACE;CACF,KAAK;CACL,KAAK;CACL;CACD,CAAC;AAEJ,MAAa,qCAAqC,SAChD,6BAA6B;CAC3B,cAAc,UAAU,KAAK;CAC7B,QAAQ;CACR,GAAI,SAAS,WAAW,EACtB,KAAK,kFACN;CACF,CAAC;AAEJ,MAAa,kCAAkC,6BAA6B;CAC1E,UAAU;CACV,cAAc;CACd,QAAQ;CACR,KAAK;CACN,CAAC;AAEF,MAAa,mCAAmC,uBAAuB;CACrE,cAAc;CACd,QAAQ;CACR,KAAK;CACN,CAAC;AAEF,MAAa,mCAAmC,uBAAuB;CACrE,cAAc;CACd,QAAQ;CACR,KAAK;CACN,CAAC;AAEF,MAAa,sCAAsC,SACjD,SAAS,QACL,mEAAmE,mBAAmB,sCACtF,0DAA0D,qBAAqB;AAErF,MAAa,2CACX;AAGF,MAAa,kCAAkC;AAE/C,MAAa,sCAAsC,wGAAwG,mBAAmB"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gt-next",
|
|
3
|
-
"version": "11.1.
|
|
3
|
+
"version": "11.1.4",
|
|
4
4
|
"description": "A Next.js library for automatic internationalization.",
|
|
5
5
|
"main": "dist/index.server.js",
|
|
6
6
|
"peerDependencies": {
|
|
7
|
-
"@generaltranslation/compiler": "^1.3.
|
|
7
|
+
"@generaltranslation/compiler": "^1.3.35",
|
|
8
8
|
"next": ">=13.0.0 <15.2.1 || >15.2.2",
|
|
9
9
|
"react": ">=16.8.0 <20.0.0",
|
|
10
10
|
"react-dom": ">=16.8.0 <20.0.0"
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@generaltranslation/format": "0.1.4",
|
|
32
|
-
"generaltranslation": "
|
|
33
|
-
"
|
|
34
|
-
"gt-react": "11.1.
|
|
35
|
-
"gt-i18n": "1.0.
|
|
32
|
+
"@generaltranslation/react-core": "11.1.4",
|
|
33
|
+
"generaltranslation": "9.1.0",
|
|
34
|
+
"gt-react": "11.1.4",
|
|
35
|
+
"gt-i18n": "1.0.10"
|
|
36
36
|
},
|
|
37
37
|
"repository": {
|
|
38
38
|
"type": "git",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"next": "15.2.3",
|
|
53
53
|
"tsdown": "^0.21.10",
|
|
54
54
|
"typescript": "^5.9.2",
|
|
55
|
-
"@generaltranslation/compiler": "1.3.
|
|
55
|
+
"@generaltranslation/compiler": "1.3.35"
|
|
56
56
|
},
|
|
57
57
|
"exports": {
|
|
58
58
|
".": {
|