gt-next 6.16.28 → 6.16.29
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 +11 -0
- package/dist/config-dir/props/withGTConfigProps.d.ts +8 -0
- package/dist/config-dir/props/withGTConfigProps.d.ts.map +1 -1
- package/dist/config-dir/props/withGTConfigProps.js.map +1 -1
- package/dist/config.d.ts +2 -2
- package/dist/config.js +2 -2
- package/dist/config.js.map +1 -1
- package/dist/errors/cacheComponents.d.ts +4 -3
- package/dist/errors/cacheComponents.d.ts.map +1 -1
- package/dist/errors/cacheComponents.js +19 -7
- package/dist/errors/cacheComponents.js.map +1 -1
- package/dist/errors/ssg.js +1 -1
- package/dist/errors/ssg.js.map +1 -1
- package/dist/plugin/checks/cacheComponentsChecks.d.ts.map +1 -1
- package/dist/plugin/checks/cacheComponentsChecks.js +7 -4
- package/dist/plugin/checks/cacheComponentsChecks.js.map +1 -1
- package/dist/request/utils/getRequestFunction.js +1 -1
- package/dist/request/utils/getRequestFunction.js.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# gt-next
|
|
2
2
|
|
|
3
|
+
## 6.16.29
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#1437](https://github.com/generaltranslation/gt/pull/1437) [`fd61c44`](https://github.com/generaltranslation/gt/commit/fd61c4487a790e0802021478986b8c5b3dc0fb2b) Thanks [@bgub](https://github.com/bgub)! - Deprecate `experimentalLocaleResolution` and update cache components warnings to recommend explicit custom `getLocale.ts` and `getRegion.ts` request functions instead of automatic root parameter detection.
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`cc4edc1`](https://github.com/generaltranslation/gt/commit/cc4edc1e40d9977125bf6d053fb7f8cdbdd40b05)]:
|
|
10
|
+
- @generaltranslation/supported-locales@2.1.0
|
|
11
|
+
- gt-i18n@0.9.4
|
|
12
|
+
- gt-react@10.19.18
|
|
13
|
+
|
|
3
14
|
## 6.16.28
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
|
@@ -77,7 +77,15 @@ export type withGTConfigProps = {
|
|
|
77
77
|
headersAndCookies?: HeadersAndCookies;
|
|
78
78
|
_usingPlugin?: boolean;
|
|
79
79
|
experimentalEnableSSG?: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* @deprecated This option relies on unsupported Next.js internals. For
|
|
82
|
+
* cacheComponents support, define custom getLocale.ts and getRegion.ts files
|
|
83
|
+
* or configure getLocalePath and getRegionPath.
|
|
84
|
+
*/
|
|
80
85
|
experimentalLocaleResolution?: boolean;
|
|
86
|
+
/**
|
|
87
|
+
* @deprecated Only used by deprecated experimentalLocaleResolution.
|
|
88
|
+
*/
|
|
81
89
|
experimentalLocaleResolutionParam?: string;
|
|
82
90
|
/** @deprecated */
|
|
83
91
|
disableSSGWarnings?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withGTConfigProps.d.ts","sourceRoot":"","sources":["../../../src/config-dir/props/withGTConfigProps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,8BAA8B,CAAC,EAAE,MAAM,CAAC;IACxC,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B;;;OAGG;IACH,IAAI,EAAE,OAAO,GAAG,KAAK,GAAG,MAAM,CAAC;IAC/B;;;OAGG;IACH,QAAQ,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GA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aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,4CAA4C;IAC5C,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,4CAA4C;IAC5C,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,4CAA4C;IAC5C,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withGTConfigProps.js","names":[],"sources":["../../../src/config-dir/props/withGTConfigProps.ts"],"sourcesContent":["import type { CustomMapping } from '@generaltranslation/format/types';\nimport { RenderMethod } from 'gt-react/internal';\n\nexport type HeadersAndCookies = {\n localeHeaderName?: string;\n localeCookieName?: string;\n referrerLocaleCookieName?: string;\n localeRoutingEnabledCookieName?: string;\n resetLocaleCookieName?: string;\n};\n\nexport type CompilerOptions = {\n /**\n * Which compiler plugin to use: babel, swc, or none\n * @default 'babel'\n */\n type: 'babel' | 'swc' | 'none';\n /**\n * Log level for the compiler plugin.\n * @default 'warn'\n */\n logLevel?: 'silent' | 'error' | 'warn' | 'info' | 'debug';\n /**\n * Whether to compile the translations at build time.\n * @default true\n */\n compileTimeHash?: boolean;\n /**\n * Whether to disable build checks.\n * @default false\n */\n disableBuildChecks?: boolean;\n};\n\nexport const DEPRECATED_REQUEST_FUNCTION_TO_CONFIG_KEY = {\n getStaticLocale: 'getStaticLocalePath',\n getStaticRegion: 'getStaticRegionPath',\n getStaticDomain: 'getStaticDomainPath',\n} as const;\n\nexport const REQUEST_FUNCTION_TO_CONFIG_KEY = {\n getLocale: 'getLocalePath',\n getRegion: 'getRegionPath',\n getDomain: 'getDomainPath',\n ...DEPRECATED_REQUEST_FUNCTION_TO_CONFIG_KEY,\n} as const;\n\nexport type withGTConfigProps = {\n // Additional top-level keys are forwarded as runtime translation metadata.\n [key: string]: unknown;\n // Request scoped filepath\n dictionary?: string;\n config?: string;\n loadTranslationsPath?: string;\n loadDictionaryPath?: string;\n // Cloud integration\n apiKey?: string;\n projectId?: string;\n runtimeUrl?: string | null;\n cacheUrl?: string | null;\n cacheExpiryTime?: number;\n // Locale info\n locales?: string[];\n defaultLocale?: string;\n ignoreBrowserLocales?: boolean;\n // Custom mapping\n /**@deprecated Use customMapping in gt.config.json instead */\n customMapping?: CustomMapping;\n // Rendering\n renderSettings?: {\n method: RenderMethod;\n timeout?: number;\n };\n // Batching config\n maxConcurrentRequests?: number;\n maxBatchSize?: number;\n batchInterval?: number; // ms\n // Translation assistance\n description?: string;\n // ESLint integration\n eslint?: boolean; // Enable/disable ESLint config generation (default: true)\n eslintSeverity?: 'error' | 'warn'; // Severity level for ESLint rules (default: 'warn')\n overwriteESLintConfig?: boolean; // Allow overwriting existing eslint.config.mjs (default: false)\n // Other\n /**\n * @deprecated use experimentalCompilerOptions instead\n */\n experimentalSwcPluginOptions?: Omit<CompilerOptions, 'type'>;\n experimentalCompilerOptions?: CompilerOptions;\n headersAndCookies?: HeadersAndCookies;\n _usingPlugin?: boolean;\n // SSG\n experimentalEnableSSG?: boolean;\n
|
|
1
|
+
{"version":3,"file":"withGTConfigProps.js","names":[],"sources":["../../../src/config-dir/props/withGTConfigProps.ts"],"sourcesContent":["import type { CustomMapping } from '@generaltranslation/format/types';\nimport { RenderMethod } from 'gt-react/internal';\n\nexport type HeadersAndCookies = {\n localeHeaderName?: string;\n localeCookieName?: string;\n referrerLocaleCookieName?: string;\n localeRoutingEnabledCookieName?: string;\n resetLocaleCookieName?: string;\n};\n\nexport type CompilerOptions = {\n /**\n * Which compiler plugin to use: babel, swc, or none\n * @default 'babel'\n */\n type: 'babel' | 'swc' | 'none';\n /**\n * Log level for the compiler plugin.\n * @default 'warn'\n */\n logLevel?: 'silent' | 'error' | 'warn' | 'info' | 'debug';\n /**\n * Whether to compile the translations at build time.\n * @default true\n */\n compileTimeHash?: boolean;\n /**\n * Whether to disable build checks.\n * @default false\n */\n disableBuildChecks?: boolean;\n};\n\nexport const DEPRECATED_REQUEST_FUNCTION_TO_CONFIG_KEY = {\n getStaticLocale: 'getStaticLocalePath',\n getStaticRegion: 'getStaticRegionPath',\n getStaticDomain: 'getStaticDomainPath',\n} as const;\n\nexport const REQUEST_FUNCTION_TO_CONFIG_KEY = {\n getLocale: 'getLocalePath',\n getRegion: 'getRegionPath',\n getDomain: 'getDomainPath',\n ...DEPRECATED_REQUEST_FUNCTION_TO_CONFIG_KEY,\n} as const;\n\nexport type withGTConfigProps = {\n // Additional top-level keys are forwarded as runtime translation metadata.\n [key: string]: unknown;\n // Request scoped filepath\n dictionary?: string;\n config?: string;\n loadTranslationsPath?: string;\n loadDictionaryPath?: string;\n // Cloud integration\n apiKey?: string;\n projectId?: string;\n runtimeUrl?: string | null;\n cacheUrl?: string | null;\n cacheExpiryTime?: number;\n // Locale info\n locales?: string[];\n defaultLocale?: string;\n ignoreBrowserLocales?: boolean;\n // Custom mapping\n /**@deprecated Use customMapping in gt.config.json instead */\n customMapping?: CustomMapping;\n // Rendering\n renderSettings?: {\n method: RenderMethod;\n timeout?: number;\n };\n // Batching config\n maxConcurrentRequests?: number;\n maxBatchSize?: number;\n batchInterval?: number; // ms\n // Translation assistance\n description?: string;\n // ESLint integration\n eslint?: boolean; // Enable/disable ESLint config generation (default: true)\n eslintSeverity?: 'error' | 'warn'; // Severity level for ESLint rules (default: 'warn')\n overwriteESLintConfig?: boolean; // Allow overwriting existing eslint.config.mjs (default: false)\n // Other\n /**\n * @deprecated use experimentalCompilerOptions instead\n */\n experimentalSwcPluginOptions?: Omit<CompilerOptions, 'type'>;\n experimentalCompilerOptions?: CompilerOptions;\n headersAndCookies?: HeadersAndCookies;\n _usingPlugin?: boolean;\n // SSG\n experimentalEnableSSG?: boolean;\n /**\n * @deprecated This option relies on unsupported Next.js internals. For\n * cacheComponents support, define custom getLocale.ts and getRegion.ts files\n * or configure getLocalePath and getRegionPath.\n */\n experimentalLocaleResolution?: boolean;\n /**\n * @deprecated Only used by deprecated experimentalLocaleResolution.\n */\n experimentalLocaleResolutionParam?: string;\n /** @deprecated */\n disableSSGWarnings?: boolean;\n // Request function paths\n getLocalePath?: string;\n getRegionPath?: string;\n getDomainPath?: string;\n /** @deprecated use getLocalePath instead */\n getStaticLocalePath?: string;\n /** @deprecated use getRegionPath instead */\n getStaticRegionPath?: string;\n /** @deprecated use getDomainPath instead */\n getStaticDomainPath?: string;\n};\n"],"mappings":";;AAkCA,MAAa,4CAA4C;CACvD,iBAAiB;CACjB,iBAAiB;CACjB,iBAAiB;CAClB;AAED,MAAa,iCAAiC;CAC5C,WAAW;CACX,WAAW;CACX,WAAW;CACX,GAAG;CACJ"}
|
package/dist/config.d.ts
CHANGED
|
@@ -46,8 +46,8 @@ type WithGTConfigResult<TNextConfig extends object> = TNextConfig & NextConfig;
|
|
|
46
46
|
* @param {string|undefined} [getStaticLocalePath="getStaticLocale"] - The path to the static getLocale function. (deprecated)
|
|
47
47
|
* @param {string|undefined} [getStaticRegionPath="getStaticRegion"] - The path to the static getRegion function. (deprecated)
|
|
48
48
|
* @param {string|undefined} [getStaticDomainPath="getStaticDomain"] - The path to the static getDomain function. (deprecated)
|
|
49
|
-
* @param {boolean} [experimentalLocaleResolution=defaultWithGTConfigProps.experimentalLocaleResolution] -
|
|
50
|
-
* @param {string|undefined} [experimentalLocaleResolutionParam=defaultWithGTConfigProps.experimentalLocaleResolutionParam] -
|
|
49
|
+
* @param {boolean} [experimentalLocaleResolution=defaultWithGTConfigProps.experimentalLocaleResolution] - Deprecated. Uses unsupported Next.js internals to infer locale from root params.
|
|
50
|
+
* @param {string|undefined} [experimentalLocaleResolutionParam=defaultWithGTConfigProps.experimentalLocaleResolutionParam] - Deprecated. Only used by experimentalLocaleResolution.
|
|
51
51
|
* @param {object} metadata - Additional metadata that can be passed for extended configuration.
|
|
52
52
|
*
|
|
53
53
|
* @param {object} nextConfig - The Next.js configuration object to extend
|
package/dist/config.js
CHANGED
|
@@ -59,8 +59,8 @@ let _generaltranslation_format = require("@generaltranslation/format");
|
|
|
59
59
|
* @param {string|undefined} [getStaticLocalePath="getStaticLocale"] - The path to the static getLocale function. (deprecated)
|
|
60
60
|
* @param {string|undefined} [getStaticRegionPath="getStaticRegion"] - The path to the static getRegion function. (deprecated)
|
|
61
61
|
* @param {string|undefined} [getStaticDomainPath="getStaticDomain"] - The path to the static getDomain function. (deprecated)
|
|
62
|
-
* @param {boolean} [experimentalLocaleResolution=defaultWithGTConfigProps.experimentalLocaleResolution] -
|
|
63
|
-
* @param {string|undefined} [experimentalLocaleResolutionParam=defaultWithGTConfigProps.experimentalLocaleResolutionParam] -
|
|
62
|
+
* @param {boolean} [experimentalLocaleResolution=defaultWithGTConfigProps.experimentalLocaleResolution] - Deprecated. Uses unsupported Next.js internals to infer locale from root params.
|
|
63
|
+
* @param {string|undefined} [experimentalLocaleResolutionParam=defaultWithGTConfigProps.experimentalLocaleResolutionParam] - Deprecated. Only used by experimentalLocaleResolution.
|
|
64
64
|
* @param {object} metadata - Additional metadata that can be passed for extended configuration.
|
|
65
65
|
*
|
|
66
66
|
* @param {object} nextConfig - The Next.js configuration object to extend
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","names":["defaultWithGTConfigProps","conflictingConfigurationBuildError","createGTCompilerUnresolvedWarning","resolveConfigFilepath","resolveRequestFunctionPaths","createBadFilepathWarning","unresolvedLoadDictionaryBuildError","unresolvedLoadTranslationsBuildError","defaultCacheExpiryTime","deprecatedLocaleMappingWarning","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 { type withGTConfigProps } from './config-dir/props/withGTConfigProps';\nimport {\n APIKeyMissingWarn,\n conflictingConfigurationBuildError,\n createBadFilepathWarning,\n createGTCompilerUnresolvedWarning,\n deprecatedLocaleMappingWarning,\n devApiKeyIncludedInProductionError,\n invalidCanonicalLocalesError,\n invalidLocalesError,\n projectIdMissingWarn,\n standardizedCanonicalLocalesWarning,\n standardizedLocalesWarning,\n unresolvedLoadDictionaryBuildError,\n unresolvedLoadTranslationsBuildError,\n} from './errors/createErrors';\nimport {\n getLocaleProperties,\n isValidLocale,\n standardizeLocale,\n} from '@generaltranslation/format';\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 { ssgChecks } from './plugin/checks/ssgChecks';\nimport { cacheComponentsChecks } from './plugin/checks/cacheComponentsChecks';\n\ntype AutoderiveConfig = boolean | { jsx?: boolean; strings?: boolean };\n\ntype ConfigFileShape = {\n files?: {\n gt?: {\n parsingFlags?: {\n autoderive?: AutoderiveConfig;\n autoDerive?: AutoderiveConfig;\n };\n };\n };\n};\n\ntype InternalGTConfigProps = withGTConfigProps &\n ConfigFileShape & {\n devApiKey?: string;\n loadDictionaryEnabled?: boolean;\n loadTranslationsType?: 'remote' | 'custom' | 'disabled';\n _dictionaryFileType?: string;\n };\n\ntype WithGTConfigResult<TNextConfig extends object> = TNextConfig & NextConfig;\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 * projectId: 'abc-123',\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} [apiKey=defaultInitGTProps.apiKey] - API key for the GeneralTranslation service. Required if using the default GT base URL.\n * @param {string} [devApiKey=defaultInitGTProps.devApiKey] - API key for dev environment only.\n * @param {string} [projectId=defaultInitGTProps.projectId] - Project ID for the GeneralTranslation service. Required for most functionality.\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 {string|undefined} [getDomainPath=\"getDomain\"] - The path to the custom getDomain 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 {object} headersAndCookies - Additional headers and cookies that can be passed for extended configuration.\n * @param {boolean} [experimentalEnableSSG=false] - Whether to enable SSG.\n * @param {boolean} [disableSSGWarnings=defaultWithGTConfigProps.disableSSGWarnings] - Whether to disable SSG warnings. (deprecated)\n * @param {string|undefined} [getStaticLocalePath=\"getStaticLocale\"] - The path to the static getLocale function. (deprecated)\n * @param {string|undefined} [getStaticRegionPath=\"getStaticRegion\"] - The path to the static getRegion function. (deprecated)\n * @param {string|undefined} [getStaticDomainPath=\"getStaticDomain\"] - The path to the static getDomain function. (deprecated)\n * @param {boolean} [experimentalLocaleResolution=defaultWithGTConfigProps.experimentalLocaleResolution] - Whether to use special server side locale resolution logic (required for Cached Components).\n * @param {string|undefined} [experimentalLocaleResolutionParam=defaultWithGTConfigProps.experimentalLocaleResolutionParam] - The parameter to use for experimental locale resolution.\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.\n */\nexport function withGTConfig<TNextConfig extends object = NextConfig>(\n nextConfig?: TNextConfig,\n props: withGTConfigProps = {}\n): WithGTConfigResult<TNextConfig> {\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 // resolve project ID\n const projectId: string | undefined = process.env.GT_PROJECT_ID;\n\n // resolve API keys\n const envApiKey: string | undefined =\n process.env.NODE_ENV === 'production'\n ? process.env.GT_API_KEY\n : process.env.GT_DEV_API_KEY || process.env.GT_API_KEY;\n let apiKey, devApiKey;\n if (envApiKey) {\n const apiKeyType = envApiKey?.split('-')?.[1];\n if (apiKeyType === 'api') {\n apiKey = envApiKey;\n } else if (apiKeyType === 'dev') {\n devApiKey = envApiKey;\n }\n }\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 mergedHeadersAndCookies = {\n ...defaultWithGTConfigProps.headersAndCookies,\n ...props.headersAndCookies,\n };\n\n // Merge experimentalSwcPluginOptions\n const mergedExperimentalCompilerOptions = {\n ...defaultWithGTConfigProps.experimentalCompilerOptions,\n ...props.experimentalSwcPluginOptions,\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 // 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 SSG checks\n ssgChecks(mergedConfig, requestFunctionPaths);\n\n // Run cache component checks\n cacheComponentsChecks({\n mergedConfig,\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 // 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: using deprecated localeMapping\n if (props.customMapping) {\n console.warn(deprecatedLocaleMappingWarning);\n }\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 I18NConfigParams = JSON.stringify(mergedConfig);\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 ??\n loadedConfig?.files?.gt?.parsingFlags?.autoDerive ??\n 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/_dictionary': resolvedDictionaryFilePath || '',\n 'gt-next/_load-translations': customLoadTranslationsPath || '',\n 'gt-next/_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 env: {\n ...internalNextConfig.env,\n _GENERALTRANSLATION_I18N_CONFIG_PARAMS: I18NConfigParams,\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_CUSTOM_GET_DOMAIN_ENABLED:\n requestFunctionPaths.getDomain ? 'true' : 'false',\n _GENERALTRANSLATION_STATIC_GET_LOCALE_ENABLED:\n requestFunctionPaths.getStaticLocale ? 'true' : 'false',\n _GENERALTRANSLATION_STATIC_GET_REGION_ENABLED:\n requestFunctionPaths.getStaticRegion ? 'true' : 'false',\n _GENERALTRANSLATION_STATIC_GET_DOMAIN_ENABLED:\n requestFunctionPaths.getStaticDomain ? 'true' : 'false',\n _GENERALTRANSLATION_DISABLE_SSG_WARNINGS:\n mergedConfig.disableSSGWarnings?.toString() || 'false',\n _GENERALTRANSLATION_ENABLE_SSG:\n mergedConfig.experimentalEnableSSG?.toString() || 'false',\n _GENERALTRANSLATION_EXPERIMENTAL_LOCALE_RESOLUTION:\n mergedConfig.experimentalLocaleResolution?.toString() || 'false',\n _GENERALTRANSLATION_EXPERIMENTAL_LOCALE_RESOLUTION_PARAM:\n mergedConfig.experimentalLocaleResolutionParam,\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(mergedConfig.experimentalCompilerOptions || {})\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/_dictionary'] = path.resolve(\n webpackConfig.context,\n resolvedDictionaryFilePath\n );\n }\n if (customLoadTranslationsPath) {\n webpackConfig.resolve.alias[`gt-next/_load-translations`] =\n path.resolve(webpackConfig.context, customLoadTranslationsPath);\n }\n if (customLoadDictionaryPath) {\n webpackConfig.resolve.alias[`gt-next/_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 }\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\n// Keep initGT for backward compatibility\nexport const initGT =\n (props: withGTConfigProps) =>\n <TNextConfig extends object = NextConfig>(nextConfig?: TNextConfig) =>\n withGTConfig(nextConfig, props);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuHA,SAAgB,aACd,YACA,QAA2B,EAAE,EACI;CACjC,MAAM,qBAAsB,cAAc,EAAE;CAI5C,IAAI,eAA+C,EAAE;AACrD,KAAI;EACF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B,EAAE,CAAC,CAC3D;aACM,GAAG;AACV,kBAAa,4BAA4B,OAAO;AAChD,aAAQ,KACNlB,4BAAAA,kCAAkC,QAAQ,EAC1C,kBACA,EACD;;AAKL,QAAI,QAAQ,IAAI,aAAa,cAC3B,eAAc,QAAQ;AAExB,QAAI,2BACF,eAAc,QAAQ,MAAM,yBAAyB,KAAA,QAAK,QACxD,cAAc,SACd,2BACD;AAEH,QAAI,2BACF,eAAc,QAAQ,MAAM,gCAC1B,KAAA,QAAK,QAAQ,cAAc,SAAS,2BAA2B;AAEnE,QAAI,yBACF,eAAc,QAAQ,MAAM,8BAC1B,KAAA,QAAK,QAAQ,cAAc,SAAS,yBAAyB;AAEjE,SAAK,MAAM,CAAC,cAAc,eAAe,OAAO,QAC9C,qBACD,EAAE;KACD,MAAM,MACJgB,qDAAAA,yBACE;AAEJ,mBAAc,QAAQ,MAAM,OAAO,KAAA,QAAK,QACtC,cAAc,SACd,WACD;;;AAGL,OAAI,OAAO,oBAAoB,YAAY,WACzC,QAAO,mBAAmB,QAAQ,eAAe,QAAQ;AAE3D,UAAO;;EAGE;;AAIf,MAAa,UACV,WACyC,eACxC,aAAa,YAAY,MAAM"}
|
|
1
|
+
{"version":3,"file":"config.js","names":["defaultWithGTConfigProps","conflictingConfigurationBuildError","createGTCompilerUnresolvedWarning","resolveConfigFilepath","resolveRequestFunctionPaths","createBadFilepathWarning","unresolvedLoadDictionaryBuildError","unresolvedLoadTranslationsBuildError","defaultCacheExpiryTime","deprecatedLocaleMappingWarning","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 { type withGTConfigProps } from './config-dir/props/withGTConfigProps';\nimport {\n APIKeyMissingWarn,\n conflictingConfigurationBuildError,\n createBadFilepathWarning,\n createGTCompilerUnresolvedWarning,\n deprecatedLocaleMappingWarning,\n devApiKeyIncludedInProductionError,\n invalidCanonicalLocalesError,\n invalidLocalesError,\n projectIdMissingWarn,\n standardizedCanonicalLocalesWarning,\n standardizedLocalesWarning,\n unresolvedLoadDictionaryBuildError,\n unresolvedLoadTranslationsBuildError,\n} from './errors/createErrors';\nimport {\n getLocaleProperties,\n isValidLocale,\n standardizeLocale,\n} from '@generaltranslation/format';\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 { ssgChecks } from './plugin/checks/ssgChecks';\nimport { cacheComponentsChecks } from './plugin/checks/cacheComponentsChecks';\n\ntype AutoderiveConfig = boolean | { jsx?: boolean; strings?: boolean };\n\ntype ConfigFileShape = {\n files?: {\n gt?: {\n parsingFlags?: {\n autoderive?: AutoderiveConfig;\n autoDerive?: AutoderiveConfig;\n };\n };\n };\n};\n\ntype InternalGTConfigProps = withGTConfigProps &\n ConfigFileShape & {\n devApiKey?: string;\n loadDictionaryEnabled?: boolean;\n loadTranslationsType?: 'remote' | 'custom' | 'disabled';\n _dictionaryFileType?: string;\n };\n\ntype WithGTConfigResult<TNextConfig extends object> = TNextConfig & NextConfig;\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 * projectId: 'abc-123',\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} [apiKey=defaultInitGTProps.apiKey] - API key for the GeneralTranslation service. Required if using the default GT base URL.\n * @param {string} [devApiKey=defaultInitGTProps.devApiKey] - API key for dev environment only.\n * @param {string} [projectId=defaultInitGTProps.projectId] - Project ID for the GeneralTranslation service. Required for most functionality.\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 {string|undefined} [getDomainPath=\"getDomain\"] - The path to the custom getDomain 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 {object} headersAndCookies - Additional headers and cookies that can be passed for extended configuration.\n * @param {boolean} [experimentalEnableSSG=false] - Whether to enable SSG.\n * @param {boolean} [disableSSGWarnings=defaultWithGTConfigProps.disableSSGWarnings] - Whether to disable SSG warnings. (deprecated)\n * @param {string|undefined} [getStaticLocalePath=\"getStaticLocale\"] - The path to the static getLocale function. (deprecated)\n * @param {string|undefined} [getStaticRegionPath=\"getStaticRegion\"] - The path to the static getRegion function. (deprecated)\n * @param {string|undefined} [getStaticDomainPath=\"getStaticDomain\"] - The path to the static getDomain function. (deprecated)\n * @param {boolean} [experimentalLocaleResolution=defaultWithGTConfigProps.experimentalLocaleResolution] - Deprecated. Uses unsupported Next.js internals to infer locale from root params.\n * @param {string|undefined} [experimentalLocaleResolutionParam=defaultWithGTConfigProps.experimentalLocaleResolutionParam] - Deprecated. Only used by experimentalLocaleResolution.\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.\n */\nexport function withGTConfig<TNextConfig extends object = NextConfig>(\n nextConfig?: TNextConfig,\n props: withGTConfigProps = {}\n): WithGTConfigResult<TNextConfig> {\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 // resolve project ID\n const projectId: string | undefined = process.env.GT_PROJECT_ID;\n\n // resolve API keys\n const envApiKey: string | undefined =\n process.env.NODE_ENV === 'production'\n ? process.env.GT_API_KEY\n : process.env.GT_DEV_API_KEY || process.env.GT_API_KEY;\n let apiKey, devApiKey;\n if (envApiKey) {\n const apiKeyType = envApiKey?.split('-')?.[1];\n if (apiKeyType === 'api') {\n apiKey = envApiKey;\n } else if (apiKeyType === 'dev') {\n devApiKey = envApiKey;\n }\n }\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 mergedHeadersAndCookies = {\n ...defaultWithGTConfigProps.headersAndCookies,\n ...props.headersAndCookies,\n };\n\n // Merge experimentalSwcPluginOptions\n const mergedExperimentalCompilerOptions = {\n ...defaultWithGTConfigProps.experimentalCompilerOptions,\n ...props.experimentalSwcPluginOptions,\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 // 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 SSG checks\n ssgChecks(mergedConfig, requestFunctionPaths);\n\n // Run cache component checks\n cacheComponentsChecks({\n mergedConfig,\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 // 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: using deprecated localeMapping\n if (props.customMapping) {\n console.warn(deprecatedLocaleMappingWarning);\n }\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 I18NConfigParams = JSON.stringify(mergedConfig);\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 ??\n loadedConfig?.files?.gt?.parsingFlags?.autoDerive ??\n 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/_dictionary': resolvedDictionaryFilePath || '',\n 'gt-next/_load-translations': customLoadTranslationsPath || '',\n 'gt-next/_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 env: {\n ...internalNextConfig.env,\n _GENERALTRANSLATION_I18N_CONFIG_PARAMS: I18NConfigParams,\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_CUSTOM_GET_DOMAIN_ENABLED:\n requestFunctionPaths.getDomain ? 'true' : 'false',\n _GENERALTRANSLATION_STATIC_GET_LOCALE_ENABLED:\n requestFunctionPaths.getStaticLocale ? 'true' : 'false',\n _GENERALTRANSLATION_STATIC_GET_REGION_ENABLED:\n requestFunctionPaths.getStaticRegion ? 'true' : 'false',\n _GENERALTRANSLATION_STATIC_GET_DOMAIN_ENABLED:\n requestFunctionPaths.getStaticDomain ? 'true' : 'false',\n _GENERALTRANSLATION_DISABLE_SSG_WARNINGS:\n mergedConfig.disableSSGWarnings?.toString() || 'false',\n _GENERALTRANSLATION_ENABLE_SSG:\n mergedConfig.experimentalEnableSSG?.toString() || 'false',\n _GENERALTRANSLATION_EXPERIMENTAL_LOCALE_RESOLUTION:\n mergedConfig.experimentalLocaleResolution?.toString() || 'false',\n _GENERALTRANSLATION_EXPERIMENTAL_LOCALE_RESOLUTION_PARAM:\n mergedConfig.experimentalLocaleResolutionParam,\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(mergedConfig.experimentalCompilerOptions || {})\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/_dictionary'] = path.resolve(\n webpackConfig.context,\n resolvedDictionaryFilePath\n );\n }\n if (customLoadTranslationsPath) {\n webpackConfig.resolve.alias[`gt-next/_load-translations`] =\n path.resolve(webpackConfig.context, customLoadTranslationsPath);\n }\n if (customLoadDictionaryPath) {\n webpackConfig.resolve.alias[`gt-next/_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 }\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\n// Keep initGT for backward compatibility\nexport const initGT =\n (props: withGTConfigProps) =>\n <TNextConfig extends object = NextConfig>(nextConfig?: TNextConfig) =>\n withGTConfig(nextConfig, props);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuHA,SAAgB,aACd,YACA,QAA2B,EAAE,EACI;CACjC,MAAM,qBAAsB,cAAc,EAAE;CAI5C,IAAI,eAA+C,EAAE;AACrD,KAAI;EACF,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,EAAE,CAAC,CAC3D;aACM,GAAG;AACV,kBAAa,4BAA4B,OAAO;AAChD,aAAQ,KACNlB,4BAAAA,kCAAkC,QAAQ,EAC1C,kBACA,EACD;;AAKL,QAAI,QAAQ,IAAI,aAAa,cAC3B,eAAc,QAAQ;AAExB,QAAI,2BACF,eAAc,QAAQ,MAAM,yBAAyB,KAAA,QAAK,QACxD,cAAc,SACd,2BACD;AAEH,QAAI,2BACF,eAAc,QAAQ,MAAM,gCAC1B,KAAA,QAAK,QAAQ,cAAc,SAAS,2BAA2B;AAEnE,QAAI,yBACF,eAAc,QAAQ,MAAM,8BAC1B,KAAA,QAAK,QAAQ,cAAc,SAAS,yBAAyB;AAEjE,SAAK,MAAM,CAAC,cAAc,eAAe,OAAO,QAC9C,qBACD,EAAE;KACD,MAAM,MACJgB,qDAAAA,yBACE;AAEJ,mBAAc,QAAQ,MAAM,OAAO,KAAA,QAAK,QACtC,cAAc,SACd,WACD;;;AAGL,OAAI,OAAO,oBAAoB,YAAY,WACzC,QAAO,mBAAmB,QAAQ,eAAe,QAAQ;AAE3D,UAAO;;EAGE;;AAIf,MAAa,UACV,WACyC,eACxC,aAAa,YAAY,MAAM"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
export declare const cacheComponentsLegacySsgConflictError: string;
|
|
2
2
|
export declare const createExperimentalLocaleResolutionError: (error: unknown) => string;
|
|
3
|
-
export
|
|
4
|
-
export declare const
|
|
3
|
+
export type CacheComponentsRequestFunction = 'getLocale' | 'getRegion';
|
|
4
|
+
export declare const createCacheComponentsMissingRequestFunctionsWarning: (requestFunctions: CacheComponentsRequestFunction[]) => string;
|
|
5
|
+
export declare const experimentalLocaleResolutionDeprecatedWarning: string;
|
|
5
6
|
export declare const cacheComponentsExperimentalFeatureDisableGetRequestFunctionWarning = "gt-next: experimentalLocaleResolution is enabled. getRegion and getDomain are disabled.";
|
|
6
7
|
export declare const cacheComponentsExperimentalLocaleResolutionDisableCustomGetLocaleWarning = "gt-next: experimentalLocaleResolution is enabled. The provided getLocale function will be ignored.";
|
|
7
8
|
export declare const cacheComponentsNonLocalTranslationsWarning: string;
|
|
8
|
-
export declare const experimentalLocaleResolutionWithoutCacheComponentsWarning = "gt-next: experimentalLocaleResolution is enabled, but cacheComponents is disabled. experimentalLocaleResolution is
|
|
9
|
+
export declare const experimentalLocaleResolutionWithoutCacheComponentsWarning = "gt-next: experimentalLocaleResolution is enabled, but cacheComponents is disabled. experimentalLocaleResolution is deprecated and should be removed.";
|
|
9
10
|
//# sourceMappingURL=cacheComponents.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cacheComponents.d.ts","sourceRoot":"","sources":["../../src/errors/cacheComponents.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,qCAAqC,QAKhD,CAAC;AAEH,eAAO,MAAM,uCAAuC,GAAI,OAAO,OAAO,WAKlE,CAAC;AAGL,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"cacheComponents.d.ts","sourceRoot":"","sources":["../../src/errors/cacheComponents.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,qCAAqC,QAKhD,CAAC;AAEH,eAAO,MAAM,uCAAuC,GAAI,OAAO,OAAO,WAKlE,CAAC;AAGL,MAAM,MAAM,8BAA8B,GAAG,WAAW,GAAG,WAAW,CAAC;AAEvE,eAAO,MAAM,mDAAmD,GAC9D,kBAAkB,8BAA8B,EAAE,WAmBnD,CAAC;AAEF,eAAO,MAAM,6CAA6C,QAOtD,CAAC;AAEL,eAAO,MAAM,kEAAkE,4FACY,CAAC;AAE5F,eAAO,MAAM,wEAAwE,uGACiB,CAAC;AAEvG,eAAO,MAAM,0CAA0C,QAQnD,CAAC;AAEL,eAAO,MAAM,yDAAyD,yJACkF,CAAC"}
|
|
@@ -13,11 +13,23 @@ const createExperimentalLocaleResolutionError = (error) => require_errors_diagno
|
|
|
13
13
|
wayOut: "gt-next will fall back where possible",
|
|
14
14
|
details: (0, generaltranslation_internal.formatDiagnosticErrorDetails)(error)
|
|
15
15
|
});
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
const createCacheComponentsMissingRequestFunctionsWarning = (requestFunctions) => {
|
|
17
|
+
const isPlural = requestFunctions.length > 1;
|
|
18
|
+
const functionNames = requestFunctions.map((requestFunction) => `${requestFunction}()`).join(" and ");
|
|
19
|
+
const fileNames = requestFunctions.map((requestFunction) => `${requestFunction}.ts`).join(" and ");
|
|
20
|
+
const configKeys = requestFunctions.map((requestFunction) => `${requestFunction}Path`).join(" and ");
|
|
21
|
+
return require_errors_diagnostics.createGtNextDiagnostic({
|
|
22
|
+
whatHappened: `cacheComponents is enabled, but custom ${functionNames} ${isPlural ? "are" : "is"} not configured`,
|
|
23
|
+
wayOut: "Automatic root parameter detection is deprecated because it relies on unsupported Next.js internals",
|
|
24
|
+
fix: `Add ${fileNames} ${isPlural ? "files" : "file"}, or configure ${configKeys}`
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
const experimentalLocaleResolutionDeprecatedWarning = require_errors_diagnostics.createGtNextDiagnostic({
|
|
28
|
+
severity: "Warning",
|
|
29
|
+
whatHappened: "experimentalLocaleResolution is deprecated",
|
|
30
|
+
wayOut: "This option relies on unsupported Next.js internals and may break in future Next.js releases",
|
|
31
|
+
fix: "Remove experimentalLocaleResolution and define custom getLocale.ts and getRegion.ts files for cacheComponents support"
|
|
19
32
|
});
|
|
20
|
-
const cacheComponentsExperimentalFeatureWarning = "gt-next: experimentalLocaleResolution is an experimental feature.";
|
|
21
33
|
const cacheComponentsExperimentalFeatureDisableGetRequestFunctionWarning = "gt-next: experimentalLocaleResolution is enabled. getRegion and getDomain are disabled.";
|
|
22
34
|
const cacheComponentsExperimentalLocaleResolutionDisableCustomGetLocaleWarning = "gt-next: experimentalLocaleResolution is enabled. The provided getLocale function will be ignored.";
|
|
23
35
|
const cacheComponentsNonLocalTranslationsWarning = require_errors_diagnostics.createGtNextDiagnostic({
|
|
@@ -27,15 +39,15 @@ const cacheComponentsNonLocalTranslationsWarning = require_errors_diagnostics.cr
|
|
|
27
39
|
fix: "Store translations locally before building cached pages",
|
|
28
40
|
docsUrl: "https://generaltranslation.com/en-US/docs/next/guides/local-tx"
|
|
29
41
|
});
|
|
30
|
-
const experimentalLocaleResolutionWithoutCacheComponentsWarning = "gt-next: experimentalLocaleResolution is enabled, but cacheComponents is disabled. experimentalLocaleResolution is
|
|
42
|
+
const experimentalLocaleResolutionWithoutCacheComponentsWarning = "gt-next: experimentalLocaleResolution is enabled, but cacheComponents is disabled. experimentalLocaleResolution is deprecated and should be removed.";
|
|
31
43
|
//#endregion
|
|
32
44
|
exports.cacheComponentsExperimentalFeatureDisableGetRequestFunctionWarning = cacheComponentsExperimentalFeatureDisableGetRequestFunctionWarning;
|
|
33
|
-
exports.cacheComponentsExperimentalFeatureWarning = cacheComponentsExperimentalFeatureWarning;
|
|
34
45
|
exports.cacheComponentsExperimentalLocaleResolutionDisableCustomGetLocaleWarning = cacheComponentsExperimentalLocaleResolutionDisableCustomGetLocaleWarning;
|
|
35
46
|
exports.cacheComponentsLegacySsgConflictError = cacheComponentsLegacySsgConflictError;
|
|
36
|
-
exports.cacheComponentsMissingExperimentalLocaleResolutionWarning = cacheComponentsMissingExperimentalLocaleResolutionWarning;
|
|
37
47
|
exports.cacheComponentsNonLocalTranslationsWarning = cacheComponentsNonLocalTranslationsWarning;
|
|
48
|
+
exports.createCacheComponentsMissingRequestFunctionsWarning = createCacheComponentsMissingRequestFunctionsWarning;
|
|
38
49
|
exports.createExperimentalLocaleResolutionError = createExperimentalLocaleResolutionError;
|
|
50
|
+
exports.experimentalLocaleResolutionDeprecatedWarning = experimentalLocaleResolutionDeprecatedWarning;
|
|
39
51
|
exports.experimentalLocaleResolutionWithoutCacheComponentsWarning = experimentalLocaleResolutionWithoutCacheComponentsWarning;
|
|
40
52
|
|
|
41
53
|
//# sourceMappingURL=cacheComponents.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cacheComponents.js","names":["createGtNextDiagnostic"],"sources":["../../src/errors/cacheComponents.ts"],"sourcesContent":["import {\n createGtNextDiagnostic,\n formatDiagnosticErrorDetails,\n} from './diagnostics';\n\n// ---- ERRORS ---- //\nexport const cacheComponentsLegacySsgConflictError = createGtNextDiagnostic({\n severity: 'Error',\n whatHappened:\n 'experimentalLocaleResolution and deprecated experimentalEnableSSG are both enabled',\n fix: 'Disable one of them before building your app',\n});\n\nexport const createExperimentalLocaleResolutionError = (error: unknown) =>\n createGtNextDiagnostic({\n whatHappened: 'Locale resolution with experimentalLocaleResolution failed',\n wayOut: 'gt-next will fall back where possible',\n details: formatDiagnosticErrorDetails(error),\n });\n\n// ---- WARNINGS ---- //\nexport const
|
|
1
|
+
{"version":3,"file":"cacheComponents.js","names":["createGtNextDiagnostic"],"sources":["../../src/errors/cacheComponents.ts"],"sourcesContent":["import {\n createGtNextDiagnostic,\n formatDiagnosticErrorDetails,\n} from './diagnostics';\n\n// ---- ERRORS ---- //\nexport const cacheComponentsLegacySsgConflictError = createGtNextDiagnostic({\n severity: 'Error',\n whatHappened:\n 'experimentalLocaleResolution and deprecated experimentalEnableSSG are both enabled',\n fix: 'Disable one of them before building your app',\n});\n\nexport const createExperimentalLocaleResolutionError = (error: unknown) =>\n createGtNextDiagnostic({\n whatHappened: 'Locale resolution with experimentalLocaleResolution failed',\n wayOut: 'gt-next will fall back where possible',\n details: formatDiagnosticErrorDetails(error),\n });\n\n// ---- WARNINGS ---- //\nexport type CacheComponentsRequestFunction = 'getLocale' | 'getRegion';\n\nexport const createCacheComponentsMissingRequestFunctionsWarning = (\n requestFunctions: CacheComponentsRequestFunction[]\n) => {\n const isPlural = requestFunctions.length > 1;\n const functionNames = requestFunctions\n .map((requestFunction) => `${requestFunction}()`)\n .join(' and ');\n const fileNames = requestFunctions\n .map((requestFunction) => `${requestFunction}.ts`)\n .join(' and ');\n const configKeys = requestFunctions\n .map((requestFunction) => `${requestFunction}Path`)\n .join(' and ');\n\n return createGtNextDiagnostic({\n whatHappened: `cacheComponents is enabled, but custom ${functionNames} ${isPlural ? 'are' : 'is'} not configured`,\n wayOut:\n 'Automatic root parameter detection is deprecated because it relies on unsupported Next.js internals',\n fix: `Add ${fileNames} ${isPlural ? 'files' : 'file'}, or configure ${configKeys}`,\n });\n};\n\nexport const experimentalLocaleResolutionDeprecatedWarning =\n createGtNextDiagnostic({\n severity: 'Warning',\n whatHappened: 'experimentalLocaleResolution is deprecated',\n wayOut:\n 'This option relies on unsupported Next.js internals and may break in future Next.js releases',\n fix: 'Remove experimentalLocaleResolution and define custom getLocale.ts and getRegion.ts files for cacheComponents support',\n });\n\nexport const cacheComponentsExperimentalFeatureDisableGetRequestFunctionWarning =\n 'gt-next: experimentalLocaleResolution is enabled. getRegion and getDomain are disabled.';\n\nexport const cacheComponentsExperimentalLocaleResolutionDisableCustomGetLocaleWarning =\n 'gt-next: experimentalLocaleResolution is enabled. The provided getLocale function will be ignored.';\n\nexport const cacheComponentsNonLocalTranslationsWarning =\n createGtNextDiagnostic({\n severity: 'Warning',\n whatHappened:\n 'cacheComponents is enabled, but translations are not stored locally',\n wayOut: 'Prerendering may fail',\n fix: 'Store translations locally before building cached pages',\n docsUrl: 'https://generaltranslation.com/en-US/docs/next/guides/local-tx',\n });\n\nexport const experimentalLocaleResolutionWithoutCacheComponentsWarning =\n 'gt-next: experimentalLocaleResolution is enabled, but cacheComponents is disabled. experimentalLocaleResolution is deprecated and should be removed.';\n"],"mappings":";;;;;AAMA,MAAa,wCAAwCA,2BAAAA,uBAAuB;CAC1E,UAAU;CACV,cACE;CACF,KAAK;CACN,CAAC;AAEF,MAAa,2CAA2C,UACtDA,2BAAAA,uBAAuB;CACrB,cAAc;CACd,QAAQ;CACR,UAAA,GAAA,4BAAA,8BAAsC,MAAM;CAC7C,CAAC;AAKJ,MAAa,uDACX,qBACG;CACH,MAAM,WAAW,iBAAiB,SAAS;CAC3C,MAAM,gBAAgB,iBACnB,KAAK,oBAAoB,GAAG,gBAAgB,IAAI,CAChD,KAAK,QAAQ;CAChB,MAAM,YAAY,iBACf,KAAK,oBAAoB,GAAG,gBAAgB,KAAK,CACjD,KAAK,QAAQ;CAChB,MAAM,aAAa,iBAChB,KAAK,oBAAoB,GAAG,gBAAgB,MAAM,CAClD,KAAK,QAAQ;AAEhB,QAAOA,2BAAAA,uBAAuB;EAC5B,cAAc,0CAA0C,cAAc,GAAG,WAAW,QAAQ,KAAK;EACjG,QACE;EACF,KAAK,OAAO,UAAU,GAAG,WAAW,UAAU,OAAO,iBAAiB;EACvE,CAAC;;AAGJ,MAAa,gDACXA,2BAAAA,uBAAuB;CACrB,UAAU;CACV,cAAc;CACd,QACE;CACF,KAAK;CACN,CAAC;AAEJ,MAAa,qEACX;AAEF,MAAa,2EACX;AAEF,MAAa,6CACXA,2BAAAA,uBAAuB;CACrB,UAAU;CACV,cACE;CACF,QAAQ;CACR,KAAK;CACL,SAAS;CACV,CAAC;AAEJ,MAAa,4DACX"}
|
package/dist/errors/ssg.js
CHANGED
|
@@ -45,7 +45,7 @@ const createSsrDetectionFailedWarning = (error) => require_errors_diagnostics.cr
|
|
|
45
45
|
});
|
|
46
46
|
const deprecatedExperimentalEnableSSGWarning = require_errors_diagnostics.createGtNextDiagnostic({
|
|
47
47
|
whatHappened: "experimentalEnableSSG is deprecated and will be removed in a future version",
|
|
48
|
-
fix: "
|
|
48
|
+
fix: "Define custom getLocalePath and getRegionPath request functions instead"
|
|
49
49
|
});
|
|
50
50
|
const createDeprecatedGetStaticLocaleFunctionWarning = (functionName) => `gt-next: ${functionName} is deprecated. Use ${functionName.replace("Static", "")} instead.`;
|
|
51
51
|
//#endregion
|
package/dist/errors/ssg.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ssg.js","names":["createGtNextDiagnostic"],"sources":["../../src/errors/ssg.ts"],"sourcesContent":["import {\n createGtNextDiagnostic,\n formatDiagnosticErrorDetails,\n} from './diagnostics';\nimport { DEPRECATED_REQUEST_FUNCTION_TO_CONFIG_KEY } from '../config-dir/props/withGTConfigProps';\nimport { RequestFunctions, StaticRequestFunctions } from '../request/types';\n\n// ========== ERRORS ========== //\n\nexport const ssgMissingGetStaticLocaleFunctionError = createGtNextDiagnostic({\n whatHappened: 'SSG is enabled, but getStaticLocale() is not configured',\n fix: 'Define getStaticLocale() so gt-next can resolve locales during static generation',\n docsUrl: 'https://generaltranslation.com/en/docs/next/guides/ssg',\n});\n\n// ========== WARNINGS ========== //\n\n// This was (1) triggered by SSG without running middleware, or (2) triggered by a request with no locale headers (also no middleware).\nexport const noLocalesCouldBeDeterminedWarning = createGtNextDiagnostic({\n whatHappened: 'No locale could be determined for this request',\n wayOut: 'gt-next will fall back to the default locale',\n fix: 'If you use SSG, configure locale resolution',\n docsUrl:\n 'https://generaltranslation.com/en/docs/next/guides/ssg#ssg-custom-get-locale',\n});\n\nconst createCustomSSGFunctionSuffix = (functionName: StaticRequestFunctions) =>\n `To use ${functionName.replace('Static', '')} during SSG, define a custom ${functionName.replace('Static', '')}() function. For more information, visit https://generaltranslation.com/en/docs/next/guides/ssg. To disable this warning, set \"disableSSGWarnings\" to true.`;\n\nexport const createSsgMissingCustomFunctionWarning = (\n functionName: StaticRequestFunctions\n) =>\n process.env._GENERALTRANSLATION_DISABLE_SSG_WARNINGS === 'true'\n ? ''\n : `gt-next: ${functionName.replace('Static', '')}() was invoked during SSG. ${createCustomSSGFunctionSuffix(functionName)}`;\n\nexport const invalidSSGConfigurationWarning = createGtNextDiagnostic({\n whatHappened: 'SSG is in use, but withGTConfig() is not configured for SSG',\n fix: 'Add the SSG configuration before building static localized pages',\n docsUrl: 'https://generaltranslation.com/en/docs/next/guides/ssg',\n});\n\nexport const createGetRequestFunctionWarning = (\n functionName: RequestFunctions | StaticRequestFunctions,\n error?: unknown\n) =>\n createGtNextDiagnostic({\n whatHappened: `${functionName}() could not be resolved`,\n wayOut: 'gt-next will fall back where possible',\n fix: 'Check that the function is exported from the configured request file',\n details: formatDiagnosticErrorDetails(error),\n });\n\nexport const createCustomGetRequestFunctionWarning = (\n functionName: RequestFunctions | StaticRequestFunctions,\n error?: unknown\n) =>\n createGtNextDiagnostic({\n whatHappened: `Custom ${functionName}() could not be resolved`,\n wayOut: 'gt-next will fall back where possible',\n fix: 'Check that the function is exported from the configured request file',\n details: formatDiagnosticErrorDetails(error),\n });\n\nexport const createSsrFunctionDuringSsgWarning = (\n functionName: RequestFunctions\n) =>\n process.env._GENERALTRANSLATION_DISABLE_SSG_WARNINGS === 'true'\n ? ''\n : createGtNextDiagnostic({\n whatHappened: `${functionName}() was invoked during SSG`,\n wayOut: 'Rendering will likely fall back to SSR behavior',\n fix: 'Define a static locale function to avoid this fallback',\n });\n\nexport const createSsrDetectionFailedWarning = (error: unknown) =>\n createGtNextDiagnostic({\n whatHappened: 'The runtime mode could not be determined as SSR or SSG',\n wayOut: 'gt-next will fall back to SSR behavior',\n details: formatDiagnosticErrorDetails(error),\n });\n\nexport const deprecatedExperimentalEnableSSGWarning = createGtNextDiagnostic({\n whatHappened:\n 'experimentalEnableSSG is deprecated and will be removed in a future version',\n fix: '
|
|
1
|
+
{"version":3,"file":"ssg.js","names":["createGtNextDiagnostic"],"sources":["../../src/errors/ssg.ts"],"sourcesContent":["import {\n createGtNextDiagnostic,\n formatDiagnosticErrorDetails,\n} from './diagnostics';\nimport { DEPRECATED_REQUEST_FUNCTION_TO_CONFIG_KEY } from '../config-dir/props/withGTConfigProps';\nimport { RequestFunctions, StaticRequestFunctions } from '../request/types';\n\n// ========== ERRORS ========== //\n\nexport const ssgMissingGetStaticLocaleFunctionError = createGtNextDiagnostic({\n whatHappened: 'SSG is enabled, but getStaticLocale() is not configured',\n fix: 'Define getStaticLocale() so gt-next can resolve locales during static generation',\n docsUrl: 'https://generaltranslation.com/en/docs/next/guides/ssg',\n});\n\n// ========== WARNINGS ========== //\n\n// This was (1) triggered by SSG without running middleware, or (2) triggered by a request with no locale headers (also no middleware).\nexport const noLocalesCouldBeDeterminedWarning = createGtNextDiagnostic({\n whatHappened: 'No locale could be determined for this request',\n wayOut: 'gt-next will fall back to the default locale',\n fix: 'If you use SSG, configure locale resolution',\n docsUrl:\n 'https://generaltranslation.com/en/docs/next/guides/ssg#ssg-custom-get-locale',\n});\n\nconst createCustomSSGFunctionSuffix = (functionName: StaticRequestFunctions) =>\n `To use ${functionName.replace('Static', '')} during SSG, define a custom ${functionName.replace('Static', '')}() function. For more information, visit https://generaltranslation.com/en/docs/next/guides/ssg. To disable this warning, set \"disableSSGWarnings\" to true.`;\n\nexport const createSsgMissingCustomFunctionWarning = (\n functionName: StaticRequestFunctions\n) =>\n process.env._GENERALTRANSLATION_DISABLE_SSG_WARNINGS === 'true'\n ? ''\n : `gt-next: ${functionName.replace('Static', '')}() was invoked during SSG. ${createCustomSSGFunctionSuffix(functionName)}`;\n\nexport const invalidSSGConfigurationWarning = createGtNextDiagnostic({\n whatHappened: 'SSG is in use, but withGTConfig() is not configured for SSG',\n fix: 'Add the SSG configuration before building static localized pages',\n docsUrl: 'https://generaltranslation.com/en/docs/next/guides/ssg',\n});\n\nexport const createGetRequestFunctionWarning = (\n functionName: RequestFunctions | StaticRequestFunctions,\n error?: unknown\n) =>\n createGtNextDiagnostic({\n whatHappened: `${functionName}() could not be resolved`,\n wayOut: 'gt-next will fall back where possible',\n fix: 'Check that the function is exported from the configured request file',\n details: formatDiagnosticErrorDetails(error),\n });\n\nexport const createCustomGetRequestFunctionWarning = (\n functionName: RequestFunctions | StaticRequestFunctions,\n error?: unknown\n) =>\n createGtNextDiagnostic({\n whatHappened: `Custom ${functionName}() could not be resolved`,\n wayOut: 'gt-next will fall back where possible',\n fix: 'Check that the function is exported from the configured request file',\n details: formatDiagnosticErrorDetails(error),\n });\n\nexport const createSsrFunctionDuringSsgWarning = (\n functionName: RequestFunctions\n) =>\n process.env._GENERALTRANSLATION_DISABLE_SSG_WARNINGS === 'true'\n ? ''\n : createGtNextDiagnostic({\n whatHappened: `${functionName}() was invoked during SSG`,\n wayOut: 'Rendering will likely fall back to SSR behavior',\n fix: 'Define a static locale function to avoid this fallback',\n });\n\nexport const createSsrDetectionFailedWarning = (error: unknown) =>\n createGtNextDiagnostic({\n whatHappened: 'The runtime mode could not be determined as SSR or SSG',\n wayOut: 'gt-next will fall back to SSR behavior',\n details: formatDiagnosticErrorDetails(error),\n });\n\nexport const deprecatedExperimentalEnableSSGWarning = createGtNextDiagnostic({\n whatHappened:\n 'experimentalEnableSSG is deprecated and will be removed in a future version',\n fix: 'Define custom getLocalePath and getRegionPath request functions instead',\n});\n\nexport const createDeprecatedGetStaticLocaleFunctionWarning = (\n functionName: keyof typeof DEPRECATED_REQUEST_FUNCTION_TO_CONFIG_KEY\n) =>\n `gt-next: ${functionName} is deprecated. Use ${functionName.replace('Static', '')} instead.`;\n"],"mappings":";;;;;AASA,MAAa,yCAAyCA,2BAAAA,uBAAuB;CAC3E,cAAc;CACd,KAAK;CACL,SAAS;CACV,CAAC;AAKF,MAAa,oCAAoCA,2BAAAA,uBAAuB;CACtE,cAAc;CACd,QAAQ;CACR,KAAK;CACL,SACE;CACH,CAAC;AAEF,MAAM,iCAAiC,iBACrC,UAAU,aAAa,QAAQ,UAAU,GAAG,CAAC,+BAA+B,aAAa,QAAQ,UAAU,GAAG,CAAC;AAEjH,MAAa,yCACX,iBAEA,QAAQ,IAAI,6CAA6C,SACrD,KACA,YAAY,aAAa,QAAQ,UAAU,GAAG,CAAC,6BAA6B,8BAA8B,aAAa;AAE7H,MAAa,iCAAiCA,2BAAAA,uBAAuB;CACnE,cAAc;CACd,KAAK;CACL,SAAS;CACV,CAAC;AAEF,MAAa,mCACX,cACA,UAEAA,2BAAAA,uBAAuB;CACrB,cAAc,GAAG,aAAa;CAC9B,QAAQ;CACR,KAAK;CACL,UAAA,GAAA,4BAAA,8BAAsC,MAAM;CAC7C,CAAC;AAEJ,MAAa,yCACX,cACA,UAEAA,2BAAAA,uBAAuB;CACrB,cAAc,UAAU,aAAa;CACrC,QAAQ;CACR,KAAK;CACL,UAAA,GAAA,4BAAA,8BAAsC,MAAM;CAC7C,CAAC;AAEJ,MAAa,qCACX,iBAEA,QAAQ,IAAI,6CAA6C,SACrD,KACAA,2BAAAA,uBAAuB;CACrB,cAAc,GAAG,aAAa;CAC9B,QAAQ;CACR,KAAK;CACN,CAAC;AAER,MAAa,mCAAmC,UAC9CA,2BAAAA,uBAAuB;CACrB,cAAc;CACd,QAAQ;CACR,UAAA,GAAA,4BAAA,8BAAsC,MAAM;CAC7C,CAAC;AAEJ,MAAa,yCAAyCA,2BAAAA,uBAAuB;CAC3E,cACE;CACF,KAAK;CACN,CAAC;AAEF,MAAa,kDACX,iBAEA,YAAY,aAAa,sBAAsB,aAAa,QAAQ,UAAU,GAAG,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cacheComponentsChecks.d.ts","sourceRoot":"","sources":["../../../src/plugin/checks/cacheComponentsChecks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAClC,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;
|
|
1
|
+
{"version":3,"file":"cacheComponentsChecks.d.ts","sourceRoot":"","sources":["../../../src/plugin/checks/cacheComponentsChecks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAClC,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAWlF,OAAO,EAAE,oBAAoB,EAAE,MAAM,oDAAoD,CAAC;AAE1F,wBAAgB,qBAAqB,CAAC,EACpC,YAAY,EACZ,UAAU,EACV,oBAAoB,EACpB,wBAAwB,EACxB,sBAAsB,GACvB,EAAE;IACD,YAAY,EAAE,iBAAiB,CAAC;IAChC,UAAU,EAAE,UAAU,CAAC;IACvB,oBAAoB,EAAE,oBAAoB,CAAC;IAC3C,wBAAwB,EAAE,OAAO,CAAC;IAClC,sBAAsB,EAAE,OAAO,CAAC;CACjC,QAwDA"}
|
|
@@ -3,11 +3,14 @@ const require_errors_cacheComponents = require("../../errors/cacheComponents.js"
|
|
|
3
3
|
//#region src/plugin/checks/cacheComponentsChecks.ts
|
|
4
4
|
function cacheComponentsChecks({ mergedConfig, nextConfig, requestFunctionPaths, localTranslationsEnabled, localDictionaryEnabled }) {
|
|
5
5
|
if (nextConfig.cacheComponents && !localTranslationsEnabled && !localDictionaryEnabled) console.warn(require_errors_cacheComponents.cacheComponentsNonLocalTranslationsWarning);
|
|
6
|
-
if (
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
if (nextConfig.cacheComponents) {
|
|
7
|
+
const missingRequestFunctions = [];
|
|
8
|
+
if (!requestFunctionPaths.getLocale) missingRequestFunctions.push("getLocale");
|
|
9
|
+
if (!requestFunctionPaths.getRegion) missingRequestFunctions.push("getRegion");
|
|
10
|
+
if (missingRequestFunctions.length) console.warn(require_errors_cacheComponents.createCacheComponentsMissingRequestFunctionsWarning(missingRequestFunctions));
|
|
9
11
|
}
|
|
10
|
-
|
|
12
|
+
if (!mergedConfig.experimentalLocaleResolution) return;
|
|
13
|
+
console.warn(require_errors_cacheComponents.experimentalLocaleResolutionDeprecatedWarning);
|
|
11
14
|
console.warn(require_errors_cacheComponents.cacheComponentsExperimentalFeatureDisableGetRequestFunctionWarning);
|
|
12
15
|
if (mergedConfig.experimentalEnableSSG) throw new Error(require_errors_cacheComponents.cacheComponentsLegacySsgConflictError);
|
|
13
16
|
if (requestFunctionPaths.getLocale) console.warn(require_errors_cacheComponents.cacheComponentsExperimentalLocaleResolutionDisableCustomGetLocaleWarning);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cacheComponentsChecks.js","names":["cacheComponentsNonLocalTranslationsWarning","
|
|
1
|
+
{"version":3,"file":"cacheComponentsChecks.js","names":["cacheComponentsNonLocalTranslationsWarning","createCacheComponentsMissingRequestFunctionsWarning","experimentalLocaleResolutionDeprecatedWarning","cacheComponentsExperimentalFeatureDisableGetRequestFunctionWarning","cacheComponentsLegacySsgConflictError","cacheComponentsExperimentalLocaleResolutionDisableCustomGetLocaleWarning","experimentalLocaleResolutionWithoutCacheComponentsWarning"],"sources":["../../../src/plugin/checks/cacheComponentsChecks.ts"],"sourcesContent":["import { NextConfig } from 'next';\nimport { type withGTConfigProps } from '../../config-dir/props/withGTConfigProps';\nimport {\n experimentalLocaleResolutionDeprecatedWarning,\n createCacheComponentsMissingRequestFunctionsWarning,\n type CacheComponentsRequestFunction,\n cacheComponentsLegacySsgConflictError,\n cacheComponentsExperimentalLocaleResolutionDisableCustomGetLocaleWarning,\n cacheComponentsNonLocalTranslationsWarning,\n experimentalLocaleResolutionWithoutCacheComponentsWarning,\n cacheComponentsExperimentalFeatureDisableGetRequestFunctionWarning,\n} from '../../errors/cacheComponents';\nimport { RequestFunctionPaths } from '../../config-dir/utils/resolveRequestFunctionPaths';\n\nexport function cacheComponentsChecks({\n mergedConfig,\n nextConfig,\n requestFunctionPaths,\n localTranslationsEnabled,\n localDictionaryEnabled,\n}: {\n mergedConfig: withGTConfigProps;\n nextConfig: NextConfig;\n requestFunctionPaths: RequestFunctionPaths;\n localTranslationsEnabled: boolean;\n localDictionaryEnabled: boolean;\n}) {\n // Check: if cacheComponents is enabled, but no local translations or dictionary are enabled, warn\n // this is necessary because it prevents executing a fetch when no local translations or dictionary are enabled\n if (\n nextConfig.cacheComponents &&\n !localTranslationsEnabled &&\n !localDictionaryEnabled\n ) {\n console.warn(cacheComponentsNonLocalTranslationsWarning);\n }\n\n if (nextConfig.cacheComponents) {\n const missingRequestFunctions: CacheComponentsRequestFunction[] = [];\n if (!requestFunctionPaths.getLocale) {\n missingRequestFunctions.push('getLocale');\n }\n if (!requestFunctionPaths.getRegion) {\n missingRequestFunctions.push('getRegion');\n }\n\n if (missingRequestFunctions.length) {\n console.warn(\n createCacheComponentsMissingRequestFunctionsWarning(\n missingRequestFunctions\n )\n );\n }\n }\n\n if (!mergedConfig.experimentalLocaleResolution) {\n return;\n }\n\n console.warn(experimentalLocaleResolutionDeprecatedWarning);\n\n // Warn that getRegion and getDomain are disabled\n console.warn(\n cacheComponentsExperimentalFeatureDisableGetRequestFunctionWarning\n );\n\n if (mergedConfig.experimentalEnableSSG) {\n // Error if experimentalEnableSSG is enabled (conflicts, and we want to move people away from this legacy feature)\n throw new Error(cacheComponentsLegacySsgConflictError);\n }\n\n if (requestFunctionPaths.getLocale) {\n // Warn that the custom getLocale function will be ignored\n console.warn(\n cacheComponentsExperimentalLocaleResolutionDisableCustomGetLocaleWarning\n );\n }\n\n if (!nextConfig.cacheComponents) {\n // Warn that experimentalLocaleResolution is meant to be used with cacheComponents\n console.warn(experimentalLocaleResolutionWithoutCacheComponentsWarning);\n }\n}\n"],"mappings":";;;AAcA,SAAgB,sBAAsB,EACpC,cACA,YACA,sBACA,0BACA,0BAOC;AAGD,KACE,WAAW,mBACX,CAAC,4BACD,CAAC,uBAED,SAAQ,KAAKA,+BAAAA,2CAA2C;AAG1D,KAAI,WAAW,iBAAiB;EAC9B,MAAM,0BAA4D,EAAE;AACpE,MAAI,CAAC,qBAAqB,UACxB,yBAAwB,KAAK,YAAY;AAE3C,MAAI,CAAC,qBAAqB,UACxB,yBAAwB,KAAK,YAAY;AAG3C,MAAI,wBAAwB,OAC1B,SAAQ,KACNC,+BAAAA,oDACE,wBACD,CACF;;AAIL,KAAI,CAAC,aAAa,6BAChB;AAGF,SAAQ,KAAKC,+BAAAA,8CAA8C;AAG3D,SAAQ,KACNC,+BAAAA,mEACD;AAED,KAAI,aAAa,sBAEf,OAAM,IAAI,MAAMC,+BAAAA,sCAAsC;AAGxD,KAAI,qBAAqB,UAEvB,SAAQ,KACNC,+BAAAA,yEACD;AAGH,KAAI,CAAC,WAAW,gBAEd,SAAQ,KAAKC,+BAAAA,0DAA0D"}
|
|
@@ -21,7 +21,7 @@ function getRequestFunction(functionName) {
|
|
|
21
21
|
return extractDefaultFunction(module);
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
24
|
+
* Deprecated handler for when experimentalLocaleResolution is enabled.
|
|
25
25
|
*/
|
|
26
26
|
function handleExperimentalLocaleResolution(functionName) {
|
|
27
27
|
if (functionName === "getLocale") return async () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getRequestFunction.js","names":["getI18NConfig","createExperimentalLocaleResolutionError","createGetRequestFunctionWarning","createCustomGetRequestFunctionWarning"],"sources":["../../../src/request/utils/getRequestFunction.ts"],"sourcesContent":["import { RequestFunctionReturnType, RequestFunctions } from '../types';\nimport {\n createCustomGetRequestFunctionWarning,\n createGetRequestFunctionWarning,\n} from '../../errors/ssg';\nimport { getRootParam } from '@generaltranslation/next-internal';\nimport { defaultExperimentalLocaleResolutionParam } from '../../utils/constants';\nimport { createExperimentalLocaleResolutionError } from '../../errors/cacheComponents';\nimport { getI18NConfig } from '../../config-dir/getI18NConfig';\n\n/**\n * Given a function type, return the associated request function\n * @param functionName\n */\nexport function getRequestFunction(\n functionName: RequestFunctions\n): () => Promise<RequestFunctionReturnType> {\n if (\n process.env._GENERALTRANSLATION_EXPERIMENTAL_LOCALE_RESOLUTION === 'true'\n ) {\n return handleExperimentalLocaleResolution(functionName);\n }\n\n const { error: moduleError, module } = getModule(functionName);\n if (moduleError) {\n return async () => undefined;\n }\n\n // Is using custom getRequest function\n const usingCustom = getUsingCustom(functionName);\n\n if (usingCustom) {\n // Extract an unknown function\n const { error: extractError, value } = extractCustomFunction(\n module,\n functionName\n );\n if (!extractError) {\n return value;\n }\n }\n\n // Fallback to default function\n return extractDefaultFunction(\n module as { default: () => Promise<RequestFunctionReturnType> }\n );\n}\n\n/* ========== HELPERS ========== */\n/**\n *
|
|
1
|
+
{"version":3,"file":"getRequestFunction.js","names":["getI18NConfig","createExperimentalLocaleResolutionError","createGetRequestFunctionWarning","createCustomGetRequestFunctionWarning"],"sources":["../../../src/request/utils/getRequestFunction.ts"],"sourcesContent":["import { RequestFunctionReturnType, RequestFunctions } from '../types';\nimport {\n createCustomGetRequestFunctionWarning,\n createGetRequestFunctionWarning,\n} from '../../errors/ssg';\nimport { getRootParam } from '@generaltranslation/next-internal';\nimport { defaultExperimentalLocaleResolutionParam } from '../../utils/constants';\nimport { createExperimentalLocaleResolutionError } from '../../errors/cacheComponents';\nimport { getI18NConfig } from '../../config-dir/getI18NConfig';\n\n/**\n * Given a function type, return the associated request function\n * @param functionName\n */\nexport function getRequestFunction(\n functionName: RequestFunctions\n): () => Promise<RequestFunctionReturnType> {\n if (\n process.env._GENERALTRANSLATION_EXPERIMENTAL_LOCALE_RESOLUTION === 'true'\n ) {\n return handleExperimentalLocaleResolution(functionName);\n }\n\n const { error: moduleError, module } = getModule(functionName);\n if (moduleError) {\n return async () => undefined;\n }\n\n // Is using custom getRequest function\n const usingCustom = getUsingCustom(functionName);\n\n if (usingCustom) {\n // Extract an unknown function\n const { error: extractError, value } = extractCustomFunction(\n module,\n functionName\n );\n if (!extractError) {\n return value;\n }\n }\n\n // Fallback to default function\n return extractDefaultFunction(\n module as { default: () => Promise<RequestFunctionReturnType> }\n );\n}\n\n/* ========== HELPERS ========== */\n/**\n * Deprecated handler for when experimentalLocaleResolution is enabled.\n */\nfunction handleExperimentalLocaleResolution(\n functionName: RequestFunctions\n): () => Promise<RequestFunctionReturnType> {\n // handle getLocale\n if (functionName === 'getLocale') {\n return async () => {\n try {\n const unverifiedLocale = getRootParam(\n process.env\n ._GENERALTRANSLATION_EXPERIMENTAL_LOCALE_RESOLUTION_PARAM ??\n defaultExperimentalLocaleResolutionParam\n );\n const I18NConfig = getI18NConfig();\n const gt = I18NConfig.getGTClass();\n return unverifiedLocale && gt.isValidLocale(unverifiedLocale)\n ? unverifiedLocale\n : undefined;\n } catch (error) {\n console.warn(createExperimentalLocaleResolutionError(error));\n return undefined;\n }\n };\n }\n // disable other request functions\n return async () => undefined;\n}\n/**\n * Given a function name, returns the module for the function\n * @param functionName\n * @returns failed field is for type safety\n */\nfunction getModule(functionName: RequestFunctions):\n | {\n error: true;\n module: never;\n }\n | {\n error: false;\n module: unknown;\n } {\n try {\n let module: unknown;\n\n switch (functionName) {\n case 'getLocale':\n module = require('gt-next/internal/_getLocale');\n break;\n case 'getRegion':\n module = require('gt-next/internal/_getRegion');\n break;\n case 'getDomain':\n module = require('gt-next/internal/_getDomain');\n break;\n }\n return {\n error: false,\n module,\n };\n } catch (error) {\n console.warn(createGetRequestFunctionWarning(functionName, error));\n return {\n error: true,\n module: undefined as never,\n };\n }\n}\n\n/**\n * Returns true if using a custom getHeaders function.\n */\nfunction getUsingCustom(functionName: RequestFunctions): boolean {\n switch (functionName) {\n case 'getLocale':\n return (\n process.env._GENERALTRANSLATION_CUSTOM_GET_LOCALE_ENABLED === 'true'\n );\n case 'getRegion':\n return (\n process.env._GENERALTRANSLATION_CUSTOM_GET_REGION_ENABLED === 'true'\n );\n case 'getDomain':\n return (\n process.env._GENERALTRANSLATION_CUSTOM_GET_DOMAIN_ENABLED === 'true'\n );\n }\n}\n\n/**\n * Given a namespace and a function name, returns the custom request function.\n */\nfunction extractCustomFunction(\n module: unknown,\n functionName: RequestFunctions\n):\n | {\n error: true;\n value: never;\n }\n | {\n error: false;\n value: () => Promise<RequestFunctionReturnType>;\n } {\n try {\n const undefinedNamespaceError = `expected a custom ${functionName} function, but got ${module}.`;\n\n if (module == null) {\n throw new Error(undefinedNamespaceError);\n }\n\n if (typeof module === 'function') {\n return {\n error: false,\n value: module as () => Promise<RequestFunctionReturnType>,\n };\n } else if (typeof module === 'object') {\n if ('default' in module) {\n if (typeof module.default === 'function') {\n return {\n error: false,\n value: module.default as () => Promise<RequestFunctionReturnType>,\n };\n } else if (typeof module.default === 'object') {\n return {\n error: false,\n value: extractCustomFunctionHelper(module.default, functionName),\n };\n }\n } else {\n return {\n error: false,\n value: extractCustomFunctionHelper(module, functionName),\n };\n }\n }\n throw new Error(undefinedNamespaceError);\n } catch (error) {\n console.warn(createCustomGetRequestFunctionWarning(functionName, error));\n return {\n error: true,\n value: undefined as never,\n };\n }\n}\n\n/**\n * Helper function to extract the custom function from the namespace.\n */\nconst extractCustomFunctionHelper = (\n module: object | null,\n functionName: RequestFunctions\n): (() => Promise<RequestFunctionReturnType>) => {\n const undefinedNamespaceError = `gt-next Error: expected a custom ${functionName} function, but got ${module}.`;\n if (module == null) {\n throw new Error(undefinedNamespaceError);\n }\n let result: Function | undefined = undefined;\n switch (functionName) {\n case 'getLocale':\n if ('getLocale' in module && typeof module.getLocale === 'function') {\n result = module.getLocale;\n }\n break;\n case 'getRegion':\n if ('getRegion' in module && typeof module.getRegion === 'function') {\n result = module.getRegion;\n }\n break;\n case 'getDomain':\n if ('getDomain' in module && typeof module.getDomain === 'function') {\n result = module.getDomain;\n }\n break;\n }\n if (result == null) {\n throw new Error(undefinedNamespaceError);\n }\n return result as () => Promise<RequestFunctionReturnType>;\n};\n\n/**\n * Get the default function from the module. Because its default, we know the typing is correct.\n */\nfunction extractDefaultFunction(module: {\n default: () => Promise<RequestFunctionReturnType>;\n}): () => Promise<RequestFunctionReturnType> {\n return module.default;\n}\n"],"mappings":";;;;;;;;;;;;AAcA,SAAgB,mBACd,cAC0C;AAC1C,KACE,QAAQ,IAAI,uDAAuD,OAEnE,QAAO,mCAAmC,aAAa;CAGzD,MAAM,EAAE,OAAO,aAAa,WAAW,UAAU,aAAa;AAC9D,KAAI,YACF,QAAO,YAAY,KAAA;AAMrB,KAFoB,eAAe,aAEpB,EAAE;EAEf,MAAM,EAAE,OAAO,cAAc,UAAU,sBACrC,QACA,aACD;AACD,MAAI,CAAC,aACH,QAAO;;AAKX,QAAO,uBACL,OACD;;;;;AAOH,SAAS,mCACP,cAC0C;AAE1C,KAAI,iBAAiB,YACnB,QAAO,YAAY;AACjB,MAAI;GACF,MAAM,oBAAA,GAAA,kCAAA,cACJ,QAAQ,IACL,4DAAA,SAEJ;GAED,MAAM,KADaA,iCAAAA,eACE,CAAC,YAAY;AAClC,UAAO,oBAAoB,GAAG,cAAc,iBAAiB,GACzD,mBACA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AO,KAAA;GACR;;;;;;AAOL,MAAM,+BACJ,QACA,iBAC+C;CAC/C,MAAM,0BAA0B,oCAAoC,aAAa,qBAAqB,OAAO;AAC7G,KAAI,UAAU,KACZ,OAAM,IAAI,MAAM,wBAAwB;CAE1C,IAAI,SAA+B,KAAA;AACnC,SAAQ,cAAR;EACE,KAAK;AACH,OAAI,eAAe,UAAU,OAAO,OAAO,cAAc,WACvD,UAAS,OAAO;AAElB;EACF,KAAK;AACH,OAAI,eAAe,UAAU,OAAO,OAAO,cAAc,WACvD,UAAS,OAAO;AAElB;EACF,KAAK;AACH,OAAI,eAAe,UAAU,OAAO,OAAO,cAAc,WACvD,UAAS,OAAO;AAElB;;AAEJ,KAAI,UAAU,KACZ,OAAM,IAAI,MAAM,wBAAwB;AAE1C,QAAO;;;;;AAMT,SAAS,uBAAuB,QAEa;AAC3C,QAAO,OAAO"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gt-next",
|
|
3
|
-
"version": "6.16.
|
|
3
|
+
"version": "6.16.29",
|
|
4
4
|
"description": "A Next.js library for automatic internationalization.",
|
|
5
5
|
"main": "dist/index.server.js",
|
|
6
6
|
"peerDependencies": {
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
"@generaltranslation/compiler": "1.3.23",
|
|
21
21
|
"@generaltranslation/format": "0.1.1",
|
|
22
22
|
"@generaltranslation/next-internal": "0.1.2",
|
|
23
|
-
"@generaltranslation/supported-locales": "2.0
|
|
23
|
+
"@generaltranslation/supported-locales": "2.1.0",
|
|
24
24
|
"generaltranslation": "8.2.15",
|
|
25
|
-
"gt-react": "10.19.
|
|
26
|
-
"gt-i18n": "0.9.
|
|
25
|
+
"gt-react": "10.19.18",
|
|
26
|
+
"gt-i18n": "0.9.4"
|
|
27
27
|
},
|
|
28
28
|
"repository": {
|
|
29
29
|
"type": "git",
|