gt-next 11.4.12 → 11.4.13

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.
Files changed (103) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/config-dir/props/withGTConfigProps.d.ts +2 -1
  3. package/dist/config-dir/props/withGTConfigProps.d.ts.map +1 -1
  4. package/dist/config-dir/props/withGTConfigProps.js.map +1 -1
  5. package/dist/config-dir/props/withGTConfigProps.mjs.map +1 -1
  6. package/dist/config.d.ts +7 -0
  7. package/dist/config.d.ts.map +1 -1
  8. package/dist/config.js +11 -1
  9. package/dist/config.js.map +1 -1
  10. package/dist/config.mjs +11 -1
  11. package/dist/config.mjs.map +1 -1
  12. package/dist/errors/middleware.d.ts +2 -0
  13. package/dist/errors/middleware.d.ts.map +1 -1
  14. package/dist/errors/middleware.js +17 -0
  15. package/dist/errors/middleware.js.map +1 -1
  16. package/dist/errors/middleware.mjs +15 -1
  17. package/dist/errors/middleware.mjs.map +1 -1
  18. package/dist/gt_swc_plugin.wasm +0 -0
  19. package/dist/index.client.d.ts +1 -0
  20. package/dist/index.client.d.ts.map +1 -1
  21. package/dist/index.client.js +2 -0
  22. package/dist/index.client.js.map +1 -1
  23. package/dist/index.client.mjs +2 -1
  24. package/dist/index.client.mjs.map +1 -1
  25. package/dist/index.rsc.d.ts +1 -0
  26. package/dist/index.rsc.d.ts.map +1 -1
  27. package/dist/index.rsc.js +2 -0
  28. package/dist/index.rsc.js.map +1 -1
  29. package/dist/index.rsc.mjs +2 -1
  30. package/dist/index.rsc.mjs.map +1 -1
  31. package/dist/index.server.d.ts +1 -0
  32. package/dist/index.server.d.ts.map +1 -1
  33. package/dist/index.server.js +2 -0
  34. package/dist/index.server.js.map +1 -1
  35. package/dist/index.server.mjs +2 -1
  36. package/dist/index.server.mjs.map +1 -1
  37. package/dist/index.types.d.ts +11 -0
  38. package/dist/index.types.d.ts.map +1 -1
  39. package/dist/link/Link.d.ts +7 -4
  40. package/dist/link/Link.d.ts.map +1 -1
  41. package/dist/link/Link.js +19 -41
  42. package/dist/link/Link.js.map +1 -1
  43. package/dist/link/Link.mjs +19 -41
  44. package/dist/link/Link.mjs.map +1 -1
  45. package/dist/link/getLocalizeHref.d.ts +43 -0
  46. package/dist/link/getLocalizeHref.d.ts.map +1 -0
  47. package/dist/link/getLocalizeHref.js +59 -0
  48. package/dist/link/getLocalizeHref.js.map +1 -0
  49. package/dist/link/getLocalizeHref.mjs +56 -0
  50. package/dist/link/getLocalizeHref.mjs.map +1 -0
  51. package/dist/link/localize-utils.d.ts +15 -0
  52. package/dist/link/localize-utils.d.ts.map +1 -0
  53. package/dist/link/localize-utils.js +49 -0
  54. package/dist/link/localize-utils.js.map +1 -0
  55. package/dist/link/localize-utils.mjs +48 -0
  56. package/dist/link/localize-utils.mjs.map +1 -0
  57. package/dist/link/useLocalizeHref.d.ts +34 -0
  58. package/dist/link/useLocalizeHref.d.ts.map +1 -0
  59. package/dist/link/useLocalizeHref.js +46 -0
  60. package/dist/link/useLocalizeHref.js.map +1 -0
  61. package/dist/link/useLocalizeHref.mjs +44 -0
  62. package/dist/link/useLocalizeHref.mjs.map +1 -0
  63. package/dist/link.d.ts +2 -0
  64. package/dist/link.d.ts.map +1 -1
  65. package/dist/link.js +2 -0
  66. package/dist/link.mjs +2 -1
  67. package/dist/middleware-dir/createMiddlewareRouting.d.ts +7 -0
  68. package/dist/middleware-dir/createMiddlewareRouting.d.ts.map +1 -0
  69. package/dist/middleware-dir/createMiddlewareRouting.js +79 -0
  70. package/dist/middleware-dir/createMiddlewareRouting.js.map +1 -0
  71. package/dist/middleware-dir/createMiddlewareRouting.mjs +77 -0
  72. package/dist/middleware-dir/createMiddlewareRouting.mjs.map +1 -0
  73. package/dist/middleware-dir/createNextMiddleware.d.ts +5 -12
  74. package/dist/middleware-dir/createNextMiddleware.d.ts.map +1 -1
  75. package/dist/middleware-dir/createNextMiddleware.js +14 -55
  76. package/dist/middleware-dir/createNextMiddleware.js.map +1 -1
  77. package/dist/middleware-dir/createNextMiddleware.mjs +15 -56
  78. package/dist/middleware-dir/createNextMiddleware.mjs.map +1 -1
  79. package/dist/middleware-dir/defaultMiddlewareConfig.d.ts +11 -0
  80. package/dist/middleware-dir/defaultMiddlewareConfig.d.ts.map +1 -0
  81. package/dist/middleware-dir/defaultMiddlewareConfig.js +33 -0
  82. package/dist/middleware-dir/defaultMiddlewareConfig.js.map +1 -0
  83. package/dist/middleware-dir/defaultMiddlewareConfig.mjs +31 -0
  84. package/dist/middleware-dir/defaultMiddlewareConfig.mjs.map +1 -0
  85. package/dist/middleware-dir/resolveMiddlewareConfig.d.ts +9 -0
  86. package/dist/middleware-dir/resolveMiddlewareConfig.d.ts.map +1 -0
  87. package/dist/middleware-dir/resolveMiddlewareConfig.js +32 -0
  88. package/dist/middleware-dir/resolveMiddlewareConfig.js.map +1 -0
  89. package/dist/middleware-dir/resolveMiddlewareConfig.mjs +30 -0
  90. package/dist/middleware-dir/resolveMiddlewareConfig.mjs.map +1 -0
  91. package/dist/middleware-dir/types.d.ts +56 -0
  92. package/dist/middleware-dir/types.d.ts.map +1 -0
  93. package/dist/middleware-dir/types.js +1 -0
  94. package/dist/middleware-dir/types.mjs +1 -0
  95. package/dist/server.d.ts +1 -0
  96. package/dist/server.d.ts.map +1 -1
  97. package/dist/server.js +2 -0
  98. package/dist/server.js.map +1 -1
  99. package/dist/server.mjs +2 -1
  100. package/dist/server.mjs.map +1 -1
  101. package/dist/utils/client-boundary.js +1 -1
  102. package/dist/utils/client-boundary.mjs +1 -1
  103. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"config.mjs","names":[],"sources":["../src/config.ts"],"sourcesContent":["import path from 'path';\nimport fs from 'fs';\nimport type { NextConfig } from 'next';\nimport {\n defaultWithGTConfigProps,\n defaultCacheExpiryTime,\n} from './config-dir/props/defaultWithGTConfigProps';\nimport {\n type BaseWithGTConfigProps,\n type withGTConfigProps,\n} from './config-dir/props/withGTConfigProps';\nimport {\n APIKeyMissingWarn,\n conflictingConfigurationBuildError,\n createBadFilepathWarning,\n createGTCompilerUnresolvedWarning,\n createNextI18nConfigMismatchWarning,\n devApiKeyIncludedInProductionError,\n invalidCanonicalLocalesError,\n invalidLocalesError,\n projectIdMissingWarn,\n standardizedCanonicalLocalesWarning,\n unresolvedLoadDictionaryBuildError,\n unresolvedLoadTranslationsBuildError,\n} from './errors/createErrors';\nimport { compilePathRegex } from './utils/pathRegex';\nimport {\n getLocaleProperties,\n isValidLocale,\n standardizeLocale,\n} from '@generaltranslation/format';\nimport type { CustomMapping } from '@generaltranslation/format/types';\nimport {\n localeRefreshSupported,\n rootParamStability,\n turboConfigStable,\n} from './plugin/getStableNextVersionInfo';\nimport { validateCompiler } from './config-dir/utils/validateCompiler';\nimport {\n REQUEST_FUNCTION_ALIASES,\n resolveRequestFunctionPaths,\n} from './config-dir/utils/resolveRequestFunctionPaths';\nimport { resolveConfigFilepath } from './config-dir/utils/resolveConfigFilepath';\nimport { cacheComponentsChecks } from './plugin/checks/cacheComponentsChecks';\nimport {\n cacheComponentsDevHotReloadDisabledWarning,\n cacheComponentsMissingLoadTranslationsError,\n} from './errors/cacheComponents';\nimport { getRuntimeCredentials } from './setup/runtimeCredentials';\nimport { nextLocaleCookieName } from './utils/cookies';\n\ntype AutoderiveConfig = boolean | { jsx?: boolean; strings?: boolean };\n\ntype ConfigFileShape = {\n customMapping?: CustomMapping;\n files?: {\n gt?: {\n parsingFlags?: {\n autoderive?: AutoderiveConfig;\n };\n };\n };\n};\n\ntype RuntimeCredentialProps = {\n apiKey?: string;\n devApiKey?: string;\n projectId?: string;\n};\n\ntype InternalGTConfigProps = BaseWithGTConfigProps &\n RuntimeCredentialProps &\n ConfigFileShape & {\n loadDictionaryEnabled?: boolean;\n loadTranslationsType?: 'remote' | 'custom' | 'disabled';\n _dictionaryFileType?: string;\n _cacheComponentsEnabled?: boolean;\n _disableDevHotReload?: boolean;\n // _tagIds is declared on BaseWithGTConfigProps (the public props).\n };\n\ntype WithGTConfigValue<T> =\n T extends Promise<infer U>\n ? Promise<U & NextConfig>\n : T extends PromiseLike<infer U>\n ? PromiseLike<U & NextConfig>\n : T & NextConfig;\n\ntype WithGTConfigResult<TNextConfig extends object> = TNextConfig extends (\n ...args: infer A\n) => infer R\n ? (...args: A) => WithGTConfigValue<R>\n : TNextConfig & NextConfig;\n\nfunction isThenable(value: unknown): value is PromiseLike<NextConfig> {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'then' in value &&\n typeof value.then === 'function'\n );\n}\n\nfunction getNextI18nConfigMismatches(\n gtConfig: Partial<InternalGTConfigProps>,\n nextI18n: NonNullable<NextConfig['i18n']>\n): string[] {\n const mismatches: string[] = [];\n\n if (\n gtConfig.defaultLocale !== undefined &&\n gtConfig.defaultLocale !== nextI18n.defaultLocale\n ) {\n mismatches.push(\n `defaultLocale: GT has ${JSON.stringify(gtConfig.defaultLocale)}; Next.js has ${JSON.stringify(nextI18n.defaultLocale)}`\n );\n }\n\n if (\n gtConfig.locales !== undefined &&\n !haveSameLocales(\n gtConfig.defaultLocale === undefined\n ? gtConfig.locales\n : [gtConfig.defaultLocale, ...gtConfig.locales],\n nextI18n.locales\n )\n ) {\n mismatches.push(\n `locales: GT has ${JSON.stringify(gtConfig.locales)}; Next.js has ${JSON.stringify(nextI18n.locales)}`\n );\n }\n\n return mismatches;\n}\n\nfunction haveSameLocales(\n gtLocales: readonly string[],\n nextLocales: readonly string[]\n): boolean {\n const gtLocaleSet = new Set(gtLocales);\n const nextLocaleSet = new Set(nextLocales);\n return (\n gtLocaleSet.size === nextLocaleSet.size &&\n Array.from(gtLocaleSet).every((locale) => nextLocaleSet.has(locale))\n );\n}\n\n/**\n * Initializes General Translation settings for a Next.js application.\n *\n * Use it in `next.config.js` to enable GT translation functionality as a plugin.\n *\n * @example\n * // In next.config.ts\n * import { withGTConfig } from 'gt-next/config';\n * import type { NextConfig } from 'next';\n *\n * const nextConfig = {\n * reactStrictMode: true,\n * } satisfies NextConfig;\n *\n * export default withGTConfig(nextConfig, {\n * locales: ['en', 'es', 'fr'],\n * defaultLocale: 'en'\n * })\n *\n * @param {string|undefined} config - Optional config filepath (defaults to './gt.config.json'). If a file is found, it will be parsed for GT config variables.\n * @param {string|undefined} dictionary - Optional dictionary configuration file path. If a string is provided, it will be used as a path.\n * @param {string|null} [runtimeUrl=defaultInitGTProps.runtimeUrl] - The base URL for the GT API. Set to an empty string to disable automatic translations. Set to null to disable.\n * @param {string|null} [cacheUrl=defaultInitGTProps.cacheUrl] - The URL for cached translations. Set to null to disable.\n * @param {string[]|undefined} - Whether to use local translations.\n * @param {string[]} [locales=defaultInitGTProps.locales] - List of supported locales for the application.\n * @param {string} [defaultLocale=defaultInitGTProps.defaultLocale] - The default locale to use if none is specified.\n * @param {string|undefined} [getLocalePath=\"getLocale\"] - The path to the custom getLocale function.\n * @param {string|undefined} [getRegionPath=\"getRegion\"] - The path to the custom getRegion function.\n * @param {object} [renderSettings=defaultInitGTProps.renderSettings] - Render settings for how translations should be handled.\n * @param {number} [cacheExpiryTime] - The time in milliseconds for how long translations should be cached.\n * @param {number} [maxConcurrentRequests=defaultInitGTProps.maxConcurrentRequests] - Maximum number of concurrent requests allowed.\n * @param {number} [maxBatchSize=defaultInitGTProps.maxBatchSize] - Maximum translation requests in the same batch.\n * @param {number} [batchInterval=defaultInitGTProps.batchInterval] - The interval in milliseconds between batched translation requests.\n * @param {boolean} [ignoreBrowserLocales=defaultWithGTConfigProps.ignoreBrowserLocales] - Whether to ignore browser's preferred locales.\n * @param {boolean} [disableInvalidLocaleWarning=defaultWithGTConfigProps.disableInvalidLocaleWarning] - Whether to disable invalid request locale warnings.\n * @param {string|undefined} [pathRegex] - Regular expression that request pathnames must match for i18n middleware to be applied.\n * @param {object} headersAndCookies - Additional headers and cookies that can be passed for extended configuration.\n * @param {object} metadata - Additional metadata that can be passed for extended configuration.\n *\n * @param {object} nextConfig - The Next.js configuration object to extend\n * @param {withGTConfigProps} props - General Translation configuration properties\n * @returns {NextConfig} - An updated Next.js config with GT settings applied\n *\n * @throws {Error} If the project ID is missing and default URLs are used, or if the API key is required and missing from the environment.\n */\nexport function withGTConfig<TNextConfig extends object = NextConfig>(\n nextConfig?: TNextConfig,\n props: withGTConfigProps = {}\n): WithGTConfigResult<TNextConfig> {\n // Next also accepts the `(phase, context) => config` function form. When given\n // one, call it and wrap the resolved config so `withGTConfig` composes with\n // other Next config plugins that return a config function — matching\n // `@sentry/nextjs`'s `withSentryConfig`. Without this, a function config would\n // be spread as a plain object below, silently dropping the user's config.\n if (typeof nextConfig === 'function') {\n const configFn = nextConfig as (\n phase: string,\n context: { defaultConfig: NextConfig }\n ) => NextConfig | Promise<NextConfig>;\n return ((phase: string, context: { defaultConfig: NextConfig }) => {\n const resolved = configFn(phase, context);\n return isThenable(resolved)\n ? resolved.then((resolvedConfig) => withGTConfig(resolvedConfig, props))\n : withGTConfig(resolved, props);\n }) as unknown as WithGTConfigResult<TNextConfig>;\n }\n\n const internalNextConfig = (nextConfig ?? {}) as unknown as NextConfig;\n\n // ---------- LOAD GT CONFIG FILE ---------- //\n\n let loadedConfig: Partial<InternalGTConfigProps> = {};\n try {\n let configPath: string | undefined;\n if (props.config) {\n configPath = props.config;\n } else if (fs.existsSync(defaultWithGTConfigProps.config)) {\n configPath = defaultWithGTConfigProps.config;\n } else if (fs.existsSync('./.gt/gt.config.json')) {\n // Support config under .gt for parity with .locadex\n configPath = './.gt/gt.config.json';\n } else if (fs.existsSync('./.locadex/gt.config.json')) {\n // Backward compatibility: support legacy .locadex directory\n configPath = './.locadex/gt.config.json';\n }\n if (typeof configPath === 'string' && fs.existsSync(configPath)) {\n const fileContent = fs.readFileSync(configPath, 'utf-8');\n loadedConfig = JSON.parse(fileContent);\n }\n } catch (error) {\n console.error('Error reading GT config file:', error);\n }\n\n // This warning intentionally compares Next.js i18n against explicit values\n // from the GT config file. Inline props use the conflict and merge paths below.\n const nextI18nConfigMismatches = internalNextConfig.i18n\n ? getNextI18nConfigMismatches(loadedConfig, internalNextConfig.i18n)\n : [];\n if (nextI18nConfigMismatches.length > 0) {\n console.warn(createNextI18nConfigMismatchWarning(nextI18nConfigMismatches));\n }\n\n // ---------- LOAD ENVIRONMENT VARIABLES ---------- //\n\n const { projectId, apiKey, devApiKey } = getRuntimeCredentials();\n\n // conditionally add environment variables to config\n const envConfig: Partial<InternalGTConfigProps> = {\n ...(projectId ? { projectId } : {}),\n ...(apiKey ? { apiKey } : {}),\n ...(devApiKey ? { devApiKey } : {}),\n };\n\n // ---------- CHECK FOR CONFIG CONFLICTS ---------- //\n\n // Check for conflicts between config and params\n const propsRecord = props as Record<string, unknown>;\n const conflicts = Object.entries(loadedConfig)\n .filter(([key, value]) => {\n // Skip if key doesn't exist in props\n if (!(key in props)) return false;\n\n const propValue = propsRecord[key];\n\n // Handle null/undefined values\n if (value == null || propValue == null) {\n return value !== propValue;\n }\n\n // Handle primitive types (string, number, boolean)\n if (typeof value !== 'object') {\n return value !== propValue;\n }\n\n // Handle arrays (no need for deep equality check)\n if (Array.isArray(value)) {\n if (!Array.isArray(propValue)) return true;\n if (value.length !== propValue.length) return true;\n return value.some((v, i) => v !== propValue[i]);\n }\n\n // Handle objects\n if (typeof value === 'object' && typeof propValue === 'object') {\n const valueRecord = value as Record<string, unknown>;\n const propRecord = propValue as Record<string, unknown>;\n const valueKeys = Object.keys(valueRecord);\n const propKeys = Object.keys(propRecord);\n const keys = new Set([...valueKeys, ...propKeys]);\n\n // Objects must match exactly (no need to go deeper)\n if (valueKeys.length !== propKeys.length) return true;\n return !Array.from(keys).every((k) => valueRecord[k] === propRecord[k]);\n }\n\n return false;\n })\n .map(\n ([key, value]) =>\n `- Key: ${key} Next Config: ${JSON.stringify(propsRecord[key])} does not match GT Config: ${JSON.stringify(value)}`\n );\n\n if (conflicts.length) {\n throw new Error(conflictingConfigurationBuildError(conflicts));\n }\n\n // ---------- MERGE CONFIGS ---------- //\n\n // Merge cookie and header names\n const nextLocaleDetectionEnabled =\n internalNextConfig.i18n !== null &&\n internalNextConfig.i18n !== undefined &&\n internalNextConfig.i18n.localeDetection !== false;\n const mergedHeadersAndCookies = {\n ...defaultWithGTConfigProps.headersAndCookies,\n ...props.headersAndCookies,\n // Next.js internationalized routing only reads its standard preference\n // cookie. Keep the user's i18n config untouched while aligning GT's\n // client-side locale persistence with the router.\n ...(nextLocaleDetectionEnabled && {\n localeCookieName: nextLocaleCookieName,\n }),\n };\n\n // Merge compiler options\n const mergedExperimentalCompilerOptions = {\n ...defaultWithGTConfigProps.experimentalCompilerOptions,\n ...props.experimentalCompilerOptions,\n };\n\n // precedence: input > env > config file > defaults\n const mergedConfig: InternalGTConfigProps = {\n ...defaultWithGTConfigProps,\n ...loadedConfig,\n ...envConfig,\n ...props,\n headersAndCookies: mergedHeadersAndCookies,\n experimentalCompilerOptions: mergedExperimentalCompilerOptions,\n _usingPlugin: true, // flag to indicate plugin usage\n };\n\n compilePathRegex(mergedConfig.pathRegex);\n\n // clear up any issues with the compiler options\n validateCompiler(mergedConfig);\n\n // ----------- RESOLVE ANY EXTERNAL FILES ----------- //\n\n // Resolve wasm filepath\n const turboPackEnabled = !!process.env.TURBOPACK;\n let resolvedWasmFilePath = '';\n if (mergedConfig.experimentalCompilerOptions?.type === 'swc') {\n try {\n if (turboPackEnabled) {\n const absolutePath = path.resolve(__dirname, './gt_swc_plugin.wasm');\n resolvedWasmFilePath =\n './' + path.relative(process.cwd(), absolutePath).replace(/\\\\/g, '/');\n } else {\n resolvedWasmFilePath = path.resolve(__dirname, './gt_swc_plugin.wasm');\n }\n } catch (error) {\n console.error(\n createGTCompilerUnresolvedWarning('swc'),\n 'Error message:',\n error\n );\n resolvedWasmFilePath = '';\n mergedConfig.experimentalCompilerOptions.type = 'none';\n }\n }\n\n // Resolve dictionary filepath\n let resolvedDictionaryFilePath =\n typeof mergedConfig.dictionary === 'string'\n ? mergedConfig.dictionary\n : resolveConfigFilepath('dictionary', ['.ts', '.js', '.json']); // fallback to dictionary\n\n // Check [defaultLocale].json file\n if (!resolvedDictionaryFilePath && mergedConfig.defaultLocale) {\n resolvedDictionaryFilePath = resolveConfigFilepath(\n mergedConfig.defaultLocale,\n ['.json']\n );\n\n // Check [defaultLanguageCode].json file\n if (!resolvedDictionaryFilePath) {\n const defaultLanguage = getLocaleProperties(\n mergedConfig.defaultLocale\n )?.languageCode;\n\n if (defaultLanguage && defaultLanguage !== mergedConfig.defaultLocale) {\n resolvedDictionaryFilePath = resolveConfigFilepath(defaultLanguage, [\n '.json',\n ]);\n }\n }\n }\n\n // Get the type of dictionary file\n const resolvedDictionaryFilePathType = resolvedDictionaryFilePath\n ? path.extname(resolvedDictionaryFilePath)\n : undefined;\n if (resolvedDictionaryFilePathType) {\n mergedConfig._dictionaryFileType = resolvedDictionaryFilePathType;\n }\n\n // Resolve custom dictionary loader path\n const customLoadDictionaryPath =\n typeof mergedConfig.loadDictionaryPath === 'string'\n ? mergedConfig.loadDictionaryPath\n : resolveConfigFilepath('loadDictionary');\n\n // Resolve custom translation loader path\n const customLoadTranslationsPath =\n typeof mergedConfig.loadTranslationsPath === 'string'\n ? mergedConfig.loadTranslationsPath\n : resolveConfigFilepath('loadTranslations');\n\n // Resolve request function paths\n const requestFunctionPaths = resolveRequestFunctionPaths(mergedConfig);\n\n // Warn if found in /app directory\n if (\n !resolvedDictionaryFilePath &&\n resolveConfigFilepath('dictionary', ['.ts', '.js', '.json'], undefined, [\n './app',\n './src/app',\n ])\n ) {\n console.warn(\n createBadFilepathWarning('dictionary', ['./app', './src/app'])\n );\n }\n\n if (\n !customLoadDictionaryPath &&\n resolveConfigFilepath(\n 'loadDictionary',\n ['.ts', '.js', '.json'],\n undefined,\n ['./app', './src/app']\n )\n ) {\n console.warn(\n createBadFilepathWarning('loadDictionary', ['./app', './src/app'])\n );\n }\n\n if (\n !customLoadTranslationsPath &&\n resolveConfigFilepath(\n 'loadTranslations',\n ['.ts', '.js', '.json'],\n undefined,\n ['./app', './src/app']\n )\n ) {\n console.warn(\n createBadFilepathWarning('loadTranslations', ['./app', './src/app'])\n );\n }\n\n // ----------- LOCALE STANDARDIZATION ----------- //\n\n // Check if using Services\n const gtRuntimeTranslationEnabled = !!(\n mergedConfig.runtimeUrl === defaultWithGTConfigProps.runtimeUrl &&\n ((process.env.NODE_ENV === 'production' && mergedConfig.apiKey) ||\n (process.env.NODE_ENV === 'development' && mergedConfig.devApiKey))\n );\n const gtRemoteCacheEnabled = !!(\n mergedConfig.cacheUrl === defaultWithGTConfigProps.cacheUrl &&\n mergedConfig.loadTranslationsType === 'remote'\n );\n const gtServicesEnabled = !!(\n (gtRuntimeTranslationEnabled || gtRemoteCacheEnabled) &&\n mergedConfig.projectId\n );\n\n // Standardize locales\n if (mergedConfig.locales && mergedConfig.defaultLocale) {\n mergedConfig.locales.unshift(mergedConfig.defaultLocale);\n }\n mergedConfig.locales = Array.from(new Set(mergedConfig.locales));\n\n // Standardize canonical locales\n const updatedCanonicalLocales: string[] = [];\n if (mergedConfig.customMapping) {\n mergedConfig.customMapping = Object.fromEntries(\n Object.entries(mergedConfig.customMapping).map(([key, value]) => {\n if (typeof value !== 'object' || !('code' in value)) {\n return [key, value];\n }\n const updatedLocale = gtServicesEnabled\n ? standardizeLocale((value as { code: string }).code)\n : (value as { code: string }).code;\n if (updatedLocale !== (value as { code: string }).code) {\n updatedCanonicalLocales.push(`${key} -> ${updatedLocale}`);\n }\n return [\n key,\n {\n ...value,\n code: updatedLocale,\n },\n ];\n })\n );\n }\n\n // Run cache component checks\n cacheComponentsChecks({\n nextConfig: internalNextConfig,\n requestFunctionPaths,\n localTranslationsEnabled: !!customLoadTranslationsPath,\n localDictionaryEnabled: !!customLoadDictionaryPath,\n });\n\n // ---------- DERIVED CONFIG ATTRIBUTES ---------- //\n\n // Local dictionary flag\n if (customLoadDictionaryPath) {\n // Check: file exists if provided\n if (!fs.existsSync(path.resolve(customLoadDictionaryPath))) {\n throw new Error(\n unresolvedLoadDictionaryBuildError(customLoadDictionaryPath)\n );\n } else {\n mergedConfig.loadDictionaryEnabled = true;\n }\n } else {\n mergedConfig.loadDictionaryEnabled = false;\n }\n\n // Local translations flag\n if (customLoadTranslationsPath) {\n // Check: file exists if provided\n if (!fs.existsSync(path.resolve(customLoadTranslationsPath))) {\n throw new Error(\n unresolvedLoadTranslationsBuildError(customLoadTranslationsPath)\n );\n } else {\n mergedConfig.loadTranslationsType = 'custom';\n }\n } else {\n mergedConfig.loadTranslationsType = 'remote';\n }\n\n if (internalNextConfig.cacheComponents) {\n if (mergedConfig.loadTranslationsType !== 'custom') {\n throw new Error(cacheComponentsMissingLoadTranslationsError);\n }\n if (isDevHotReloadEnabled(mergedConfig)) {\n console.warn(cacheComponentsDevHotReloadDisabledWarning);\n }\n mergedConfig._cacheComponentsEnabled = true;\n mergedConfig._disableDevHotReload = true;\n mergedConfig.cacheExpiryTime = 0;\n }\n\n // Set default cache expiry if and only if no dev key\n if (\n mergedConfig.loadTranslationsType == 'remote' &&\n !mergedConfig.devApiKey &&\n typeof mergedConfig.cacheExpiryTime === 'undefined'\n ) {\n mergedConfig.cacheExpiryTime = defaultCacheExpiryTime;\n }\n\n // ---------- ERROR CHECKS ---------- //\n\n // Check: invalid locale\n if (!mergedConfig.customMapping && gtServicesEnabled) {\n const invalidLocales: string[] = [];\n mergedConfig.locales.forEach((locale) => {\n if (!isValidLocale(locale)) {\n invalidLocales.push(locale);\n }\n });\n if (invalidLocales.length) {\n throw new Error(invalidLocalesError(invalidLocales));\n }\n }\n\n // Check: invalid canonical locale\n if (mergedConfig.customMapping && gtServicesEnabled) {\n const invalidCanonicalLocales: string[] = [];\n mergedConfig.locales.forEach((locale) => {\n if (!isValidLocale(locale, mergedConfig.customMapping)) {\n invalidCanonicalLocales.push(locale);\n }\n });\n if (invalidCanonicalLocales.length) {\n throw new Error(invalidCanonicalLocalesError(invalidCanonicalLocales));\n }\n }\n\n // Check: projectId is not required for remote infrastructure, but warn if missing for dev, nothing for prod\n if (\n (mergedConfig.cacheUrl || mergedConfig.runtimeUrl) &&\n !mergedConfig.projectId &&\n process.env.NODE_ENV === 'development' &&\n mergedConfig.loadTranslationsType === 'remote' &&\n !mergedConfig.loadDictionaryEnabled // skip warn if using local dictionary\n ) {\n console.warn(projectIdMissingWarn);\n }\n\n // Check: dev API key should not be included in production\n if (process.env.NODE_ENV === 'production' && mergedConfig.devApiKey) {\n throw new Error(devApiKeyIncludedInProductionError);\n }\n\n // Check: An API key is required for runtime translation\n if (\n mergedConfig.projectId && // must have projectId for this check to matter anyways\n mergedConfig.runtimeUrl &&\n !(mergedConfig.apiKey || mergedConfig.devApiKey) &&\n process.env.NODE_ENV === 'development'\n ) {\n console.warn(APIKeyMissingWarn);\n }\n\n // Check: if using GT infrastructure, warn about unsupported locales\n if (gtServicesEnabled) {\n // Warn about standardized canonical locales\n if (updatedCanonicalLocales.length) {\n console.warn(\n standardizedCanonicalLocalesWarning(updatedCanonicalLocales)\n );\n }\n }\n\n // ---------- STORE CONFIGURATIONS ---------- //\n const {\n projectId: _projectId,\n apiKey: _apiKey,\n devApiKey: _devApiKey,\n ...privateConfigParams\n } = mergedConfig;\n const I18NConfigParams = JSON.stringify(privateConfigParams);\n const clientI18NConfigParams = {\n defaultLocale: mergedConfig.defaultLocale,\n locales: mergedConfig.locales,\n customMapping: mergedConfig.customMapping,\n runtimeUrl: mergedConfig.runtimeUrl,\n cacheUrl: mergedConfig.cacheUrl,\n cacheExpiryTime: mergedConfig.cacheExpiryTime,\n maxConcurrentRequests: mergedConfig.maxConcurrentRequests,\n maxBatchSize: mergedConfig.maxBatchSize,\n batchInterval: mergedConfig.batchInterval,\n renderSettings: {\n timeout: mergedConfig.renderSettings?.timeout,\n },\n headersAndCookies: {\n localeCookieName: mergedConfig.headersAndCookies?.localeCookieName,\n enableI18nCookieName:\n mergedConfig.headersAndCookies?.enableI18nCookieName,\n },\n _versionId: mergedConfig._versionId,\n _disableDevHotReload: mergedConfig._disableDevHotReload,\n _tagIds: mergedConfig._tagIds,\n };\n\n const { type: _type, ...compilerOptions } =\n mergedConfig.experimentalCompilerOptions || {};\n\n // Read autoderive from parsingFlags (single source of truth shared with CLI)\n const rawAutoderive: boolean | { jsx?: boolean; strings?: boolean } =\n loadedConfig?.files?.gt?.parsingFlags?.autoderive ?? false;\n const autoderiveJsx =\n typeof rawAutoderive === 'boolean'\n ? rawAutoderive\n : (rawAutoderive.jsx ?? false);\n const autoderiveStrings =\n typeof rawAutoderive === 'boolean'\n ? rawAutoderive\n : (rawAutoderive.strings ?? false);\n\n const swcPluginOptions: Record<string, unknown> = {\n ...compilerOptions,\n autoderiveJsx,\n autoderiveStrings,\n };\n\n const swcPluginEntry: [string, Record<string, unknown>] | null =\n mergedConfig.experimentalCompilerOptions?.type === 'swc'\n ? [resolvedWasmFilePath, swcPluginOptions]\n : null;\n\n const turboAliases = {\n 'gt-next/internal/_dictionary': resolvedDictionaryFilePath || '',\n 'gt-next/internal/_load-translations': customLoadTranslationsPath || '',\n 'gt-next/internal/_load-dictionary': customLoadDictionaryPath || '',\n ...Object.fromEntries(\n Object.entries(requestFunctionPaths).map(([functionName, path]) => {\n return [\n REQUEST_FUNCTION_ALIASES[\n functionName as keyof typeof REQUEST_FUNCTION_ALIASES\n ],\n path,\n ];\n })\n ),\n };\n\n // experimental.turbo is deprecated in next@15.3.0.\n // Check for experimental.turbo. If we write to turbopack field, experimental fields will be ignored.\n // Yet, if there are other resolveAlias fields, we don't want to be ignored either.\n const experimentalTurbopack = !(\n turboConfigStable &&\n (!internalNextConfig.experimental?.turbo ||\n internalNextConfig.turbopack?.resolveAlias)\n );\n\n const config: NextConfig = {\n ...internalNextConfig,\n transpilePackages: Array.from(\n new Set([...(internalNextConfig.transpilePackages || []), 'gt-next'])\n ),\n env: {\n ...internalNextConfig.env,\n _GENERALTRANSLATION_LOCALE_REFRESH_SUPPORTED:\n localeRefreshSupported.toString(),\n _GENERALTRANSLATION_I18N_CONFIG_PARAMS: I18NConfigParams,\n NEXT_PUBLIC_GENERALTRANSLATION_I18N_CONFIG_PARAMS: JSON.stringify(\n clientI18NConfigParams\n ),\n ...(resolvedDictionaryFilePathType && {\n _GENERALTRANSLATION_DICTIONARY_FILE_TYPE:\n resolvedDictionaryFilePathType,\n }),\n _GENERALTRANSLATION_LOCAL_DICTIONARY_ENABLED:\n mergedConfig.loadDictionaryEnabled.toString(),\n _GENERALTRANSLATION_LOCAL_TRANSLATION_ENABLED: (\n mergedConfig.loadTranslationsType === 'custom'\n ).toString(),\n _GENERALTRANSLATION_DEFAULT_LOCALE: (\n mergedConfig.defaultLocale ||\n defaultWithGTConfigProps.defaultLocale ||\n ''\n ).toString(),\n _GENERALTRANSLATION_GT_SERVICES_ENABLED: gtServicesEnabled.toString(),\n _GENERALTRANSLATION_IGNORE_BROWSER_LOCALES:\n mergedConfig.ignoreBrowserLocales?.toString() ||\n defaultWithGTConfigProps.ignoreBrowserLocales?.toString() ||\n 'false',\n _GENERALTRANSLATION_CUSTOM_GET_LOCALE_ENABLED:\n requestFunctionPaths.getLocale ? 'true' : 'false',\n _GENERALTRANSLATION_CUSTOM_GET_REGION_ENABLED:\n requestFunctionPaths.getRegion ? 'true' : 'false',\n _GENERALTRANSLATION_DISABLE_INVALID_LOCALE_WARNING:\n mergedConfig.disableInvalidLocaleWarning?.toString() || 'false',\n // nextConfig.env intentionally makes this available to client-boundary.tsx.\n ...(mergedConfig.pathRegex !== undefined && {\n _GENERALTRANSLATION_PATH_REGEX: mergedConfig.pathRegex,\n }),\n },\n ...(turboPackEnabled &&\n !experimentalTurbopack && {\n turbopack: {\n ...internalNextConfig.turbopack,\n resolveAlias: {\n ...internalNextConfig.turbopack?.resolveAlias,\n ...turboAliases,\n },\n },\n }),\n experimental: {\n ...internalNextConfig.experimental,\n ...(rootParamStability === 'experimental' && {\n rootParams: true,\n }),\n swcPlugins: [\n ...(internalNextConfig.experimental?.swcPlugins || []),\n ...(swcPluginEntry ? [swcPluginEntry] : []),\n ],\n ...(turboPackEnabled &&\n experimentalTurbopack && {\n turbo: {\n ...internalNextConfig.experimental?.turbo,\n resolveAlias: {\n ...internalNextConfig.experimental?.turbo?.resolveAlias,\n ...turboAliases,\n },\n },\n }),\n },\n webpack: function webpack(\n ...[webpackConfig, options]: Parameters<\n NonNullable<NextConfig['webpack']>\n >\n ) {\n // Only apply webpack aliases if we're using webpack (not Turbopack)\n if (!turboPackEnabled) {\n // Try to load GT compiler if available\n if (mergedConfig.experimentalCompilerOptions?.type === 'babel') {\n try {\n const {\n webpack: gtUnplugin,\n } = require('@generaltranslation/compiler');\n webpackConfig.plugins.unshift(\n gtUnplugin({\n ...mergedConfig.experimentalCompilerOptions,\n autoJsxImportSource: 'gt-next',\n })\n );\n } catch (e) {\n mergedConfig.experimentalCompilerOptions.type = 'none';\n console.warn(\n createGTCompilerUnresolvedWarning('babel'),\n 'Error message:',\n e\n );\n }\n }\n\n // Disable cache in dev bc people might move around loadTranslations() and loadDictionary() files\n if (process.env.NODE_ENV === 'development') {\n webpackConfig.cache = false;\n }\n if (resolvedDictionaryFilePath) {\n webpackConfig.resolve.alias['gt-next/internal/_dictionary'] =\n path.resolve(webpackConfig.context, resolvedDictionaryFilePath);\n }\n if (customLoadTranslationsPath) {\n webpackConfig.resolve.alias[`gt-next/internal/_load-translations`] =\n path.resolve(webpackConfig.context, customLoadTranslationsPath);\n }\n if (customLoadDictionaryPath) {\n webpackConfig.resolve.alias[`gt-next/internal/_load-dictionary`] =\n path.resolve(webpackConfig.context, customLoadDictionaryPath);\n }\n for (const [functionName, pathString] of Object.entries(\n requestFunctionPaths\n )) {\n const key =\n REQUEST_FUNCTION_ALIASES[\n functionName as keyof typeof REQUEST_FUNCTION_ALIASES\n ];\n webpackConfig.resolve.alias[key] = path.resolve(\n webpackConfig.context,\n pathString\n );\n }\n // Webpack parses .mjs as strict ESM and does not treat require()\n // calls as dependencies, so the require()-backed internal aliases\n // above would never apply and their runtime errors are swallowed\n // (loaders silently no-op). Parse gt-next's ESM dist as\n // javascript/auto so webpack picks up those require() calls.\n // Server compilation only: the call sites are server-only, and this\n // keeps the rule from ever pulling a user's loader file into the\n // client bundle. Turbopack resolves them through resolveAlias and\n // needs no rule.\n // The guard mirrors the alias block above: any configured alias\n // enables the rule. The request-function aliases are static-imported\n // (initGT.server), and resolve.alias applies at resolution regardless\n // of parser mode, so they work without the rule; they gate it anyway\n // for symmetry and for any future require()-backed consumer.\n if (\n options.isServer &&\n (resolvedDictionaryFilePath ||\n customLoadTranslationsPath ||\n customLoadDictionaryPath ||\n Object.keys(requestFunctionPaths).length > 0)\n ) {\n // gt-next normally resolves inside a node_modules dir (app-local,\n // hoisted monorepo root, or the pnpm store), but symlinked installs\n // (workspace:*, file:) resolve to a real path with no node_modules\n // segment — so also match this package's dist dir, where this\n // compiled file lives.\n const gtNextDistDirs: (string | RegExp)[] = [\n /node_modules[\\\\/]gt-next[\\\\/]dist[\\\\/]/,\n ];\n try {\n // Trust __dirname only when it verifiably is gt-next's dist: a\n // bundler that inlines this file elsewhere would otherwise widen\n // the rule to every .mjs under its output dir. The compiled\n // config always sits beside its ESM twin and the internal\n // modules these aliases target.\n if (\n fs.existsSync(path.join(__dirname, 'config.mjs')) &&\n fs.existsSync(path.join(__dirname, 'internal', '_dictionary.mjs'))\n ) {\n gtNextDistDirs.push(__dirname + path.sep);\n }\n } catch {\n // __dirname is undefined when the ESM dist of this module is\n // loaded natively; the node_modules pattern still applies.\n }\n webpackConfig.module ??= {};\n webpackConfig.module.rules ??= [];\n webpackConfig.module.rules.push({\n test: /\\.mjs$/,\n include: gtNextDistDirs,\n type: 'javascript/auto',\n });\n }\n }\n if (typeof internalNextConfig?.webpack === 'function') {\n return internalNextConfig.webpack(webpackConfig, options);\n }\n return webpackConfig;\n },\n };\n return config as WithGTConfigResult<TNextConfig>;\n}\n\nfunction isDevHotReloadEnabled(config: InternalGTConfigProps): boolean {\n return (\n !!config.devApiKey &&\n !!config.projectId &&\n config.runtimeUrl !== null &&\n config.runtimeUrl !== '' &&\n process.env.NODE_ENV === 'development'\n );\n}\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c,SAAS,2BAA2B;AAEnE,QAAI,2BACF,eAAc,QAAQ,MAAM,yCAC1B,KAAK,QAAQ,cAAc,SAAS,2BAA2B;AAEnE,QAAI,yBACF,eAAc,QAAQ,MAAM,uCAC1B,KAAK,QAAQ,cAAc,SAAS,yBAAyB;AAEjE,SAAK,MAAM,CAAC,cAAc,eAAe,OAAO,QAC9C,qBACD,EAAE;KACD,MAAM,MACJ,yBACE;AAEJ,mBAAc,QAAQ,MAAM,OAAO,KAAK,QACtC,cAAc,SACd,WACD;;AAgBH,QACE,QAAQ,aACP,8BACC,8BACA,4BACA,OAAO,KAAK,qBAAqB,CAAC,SAAS,IAC7C;KAMA,MAAM,iBAAsC,CAC1C,yCACD;AACD,SAAI;AAMF,UACE,GAAG,WAAW,KAAK,KAAK,WAAW,aAAa,CAAC,IACjD,GAAG,WAAW,KAAK,KAAK,WAAW,YAAY,kBAAkB,CAAC,CAElE,gBAAe,KAAK,YAAY,KAAK,IAAI;aAErC;AAIR,mBAAc,WAAW,EAAE;AAC3B,mBAAc,OAAO,UAAU,EAAE;AACjC,mBAAc,OAAO,MAAM,KAAK;MAC9B,MAAM;MACN,SAAS;MACT,MAAM;MACP,CAAC;;;AAGN,OAAI,OAAO,oBAAoB,YAAY,WACzC,QAAO,mBAAmB,QAAQ,eAAe,QAAQ;AAE3D,UAAO;;EAGE;;AAGf,SAAS,sBAAsB,QAAwC;AACrE,QACE,CAAC,CAAC,OAAO,aACT,CAAC,CAAC,OAAO,aACT,OAAO,eAAe,QACtB,OAAO,eAAe,MACtB,QAAQ,IAAI,aAAa"}
1
+ {"version":3,"file":"config.mjs","names":[],"sources":["../src/config.ts"],"sourcesContent":["import path from 'path';\nimport fs from 'fs';\nimport type { NextConfig } from 'next';\nimport {\n defaultWithGTConfigProps,\n defaultCacheExpiryTime,\n} from './config-dir/props/defaultWithGTConfigProps';\nimport {\n type BaseWithGTConfigProps,\n type withGTConfigProps,\n} from './config-dir/props/withGTConfigProps';\nimport {\n APIKeyMissingWarn,\n conflictingConfigurationBuildError,\n createBadFilepathWarning,\n createGTCompilerUnresolvedWarning,\n createNextI18nConfigMismatchWarning,\n devApiKeyIncludedInProductionError,\n invalidCanonicalLocalesError,\n invalidLocalesError,\n projectIdMissingWarn,\n standardizedCanonicalLocalesWarning,\n unresolvedLoadDictionaryBuildError,\n unresolvedLoadTranslationsBuildError,\n} from './errors/createErrors';\nimport { compilePathRegex } from './utils/pathRegex';\nimport {\n getLocaleProperties,\n isValidLocale,\n standardizeLocale,\n} from '@generaltranslation/format';\nimport type { CustomMapping } from '@generaltranslation/format/types';\nimport {\n localeRefreshSupported,\n rootParamStability,\n turboConfigStable,\n} from './plugin/getStableNextVersionInfo';\nimport { validateCompiler } from './config-dir/utils/validateCompiler';\nimport {\n REQUEST_FUNCTION_ALIASES,\n resolveRequestFunctionPaths,\n} from './config-dir/utils/resolveRequestFunctionPaths';\nimport { resolveConfigFilepath } from './config-dir/utils/resolveConfigFilepath';\nimport { cacheComponentsChecks } from './plugin/checks/cacheComponentsChecks';\nimport {\n cacheComponentsDevHotReloadDisabledWarning,\n cacheComponentsMissingLoadTranslationsError,\n} from './errors/cacheComponents';\nimport { getRuntimeCredentials } from './setup/runtimeCredentials';\nimport { nextLocaleCookieName } from './utils/cookies';\nimport { splitMiddlewareConfig } from './middleware-dir/defaultMiddlewareConfig';\n\ntype AutoderiveConfig = boolean | { jsx?: boolean; strings?: boolean };\n\ntype ConfigFileShape = {\n customMapping?: CustomMapping;\n files?: {\n gt?: {\n parsingFlags?: {\n autoderive?: AutoderiveConfig;\n };\n };\n };\n};\n\ntype RuntimeCredentialProps = {\n apiKey?: string;\n devApiKey?: string;\n projectId?: string;\n};\n\ntype InternalGTConfigProps = BaseWithGTConfigProps &\n RuntimeCredentialProps &\n ConfigFileShape & {\n loadDictionaryEnabled?: boolean;\n loadTranslationsType?: 'remote' | 'custom' | 'disabled';\n _dictionaryFileType?: string;\n _cacheComponentsEnabled?: boolean;\n _disableDevHotReload?: boolean;\n // _tagIds is declared on BaseWithGTConfigProps (the public props).\n };\n\ntype WithGTConfigValue<T> =\n T extends Promise<infer U>\n ? Promise<U & NextConfig>\n : T extends PromiseLike<infer U>\n ? PromiseLike<U & NextConfig>\n : T & NextConfig;\n\ntype WithGTConfigResult<TNextConfig extends object> = TNextConfig extends (\n ...args: infer A\n) => infer R\n ? (...args: A) => WithGTConfigValue<R>\n : TNextConfig & NextConfig;\n\nfunction isThenable(value: unknown): value is PromiseLike<NextConfig> {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'then' in value &&\n typeof value.then === 'function'\n );\n}\n\nfunction getNextI18nConfigMismatches(\n gtConfig: Partial<InternalGTConfigProps>,\n nextI18n: NonNullable<NextConfig['i18n']>\n): string[] {\n const mismatches: string[] = [];\n\n if (\n gtConfig.defaultLocale !== undefined &&\n gtConfig.defaultLocale !== nextI18n.defaultLocale\n ) {\n mismatches.push(\n `defaultLocale: GT has ${JSON.stringify(gtConfig.defaultLocale)}; Next.js has ${JSON.stringify(nextI18n.defaultLocale)}`\n );\n }\n\n if (\n gtConfig.locales !== undefined &&\n !haveSameLocales(\n gtConfig.defaultLocale === undefined\n ? gtConfig.locales\n : [gtConfig.defaultLocale, ...gtConfig.locales],\n nextI18n.locales\n )\n ) {\n mismatches.push(\n `locales: GT has ${JSON.stringify(gtConfig.locales)}; Next.js has ${JSON.stringify(nextI18n.locales)}`\n );\n }\n\n return mismatches;\n}\n\nfunction haveSameLocales(\n gtLocales: readonly string[],\n nextLocales: readonly string[]\n): boolean {\n const gtLocaleSet = new Set(gtLocales);\n const nextLocaleSet = new Set(nextLocales);\n return (\n gtLocaleSet.size === nextLocaleSet.size &&\n Array.from(gtLocaleSet).every((locale) => nextLocaleSet.has(locale))\n );\n}\n\n/**\n * Initializes General Translation settings for a Next.js application.\n *\n * Use it in `next.config.js` to enable GT translation functionality as a plugin.\n *\n * @example\n * // In next.config.ts\n * import { withGTConfig } from 'gt-next/config';\n * import type { NextConfig } from 'next';\n *\n * const nextConfig = {\n * reactStrictMode: true,\n * } satisfies NextConfig;\n *\n * export default withGTConfig(nextConfig, {\n * locales: ['en', 'es', 'fr'],\n * defaultLocale: 'en'\n * })\n *\n * @param {string|undefined} config - Optional config filepath (defaults to './gt.config.json'). If a file is found, it will be parsed for GT config variables.\n * @param {string|undefined} dictionary - Optional dictionary configuration file path. If a string is provided, it will be used as a path.\n * @param {string|null} [runtimeUrl=defaultInitGTProps.runtimeUrl] - The base URL for the GT API. Set to an empty string to disable automatic translations. Set to null to disable.\n * @param {string|null} [cacheUrl=defaultInitGTProps.cacheUrl] - The URL for cached translations. Set to null to disable.\n * @param {string[]|undefined} - Whether to use local translations.\n * @param {string[]} [locales=defaultInitGTProps.locales] - List of supported locales for the application.\n * @param {string} [defaultLocale=defaultInitGTProps.defaultLocale] - The default locale to use if none is specified.\n * @param {string|undefined} [getLocalePath=\"getLocale\"] - The path to the custom getLocale function.\n * @param {string|undefined} [getRegionPath=\"getRegion\"] - The path to the custom getRegion function.\n * @param {object} [renderSettings=defaultInitGTProps.renderSettings] - Render settings for how translations should be handled.\n * @param {number} [cacheExpiryTime] - The time in milliseconds for how long translations should be cached.\n * @param {number} [maxConcurrentRequests=defaultInitGTProps.maxConcurrentRequests] - Maximum number of concurrent requests allowed.\n * @param {number} [maxBatchSize=defaultInitGTProps.maxBatchSize] - Maximum translation requests in the same batch.\n * @param {number} [batchInterval=defaultInitGTProps.batchInterval] - The interval in milliseconds between batched translation requests.\n * @param {boolean} [ignoreBrowserLocales=defaultWithGTConfigProps.ignoreBrowserLocales] - Whether to ignore browser's preferred locales.\n * @param {boolean} [disableInvalidLocaleWarning=defaultWithGTConfigProps.disableInvalidLocaleWarning] - Whether to disable invalid request locale warnings.\n * @param {string|undefined} [pathRegex] - Regular expression that request pathnames must match for i18n middleware to be applied.\n * @param {object} headersAndCookies - Additional headers and cookies that can be passed for extended configuration.\n * @param {boolean} [localeRouting] - Default for createNextMiddleware's `localeRouting` option.\n * @param {boolean} [prefixDefaultLocale] - Default for createNextMiddleware's `prefixDefaultLocale` option.\n * @param {boolean} [enableSmartRouting] - Default for createNextMiddleware's `enableSmartRouting` option.\n * @param {boolean} [ignoreSourceMaps] - Default for createNextMiddleware's `ignoreSourceMaps` option.\n * @param {object} [pathConfig] - Default for createNextMiddleware's `pathConfig` option.\n * @param {object} [routeOverrides] - Default for createNextMiddleware's `routeOverrides` option.\n * @param {object} [localeRoutes] - Default for createNextMiddleware's `localeRoutes` option.\n * @param {object} metadata - Additional metadata that can be passed for extended configuration.\n *\n * @param {object} nextConfig - The Next.js configuration object to extend\n * @param {withGTConfigProps} props - General Translation configuration properties\n * @returns {NextConfig} - An updated Next.js config with GT settings applied\n *\n * @throws {Error} If the project ID is missing and default URLs are used, or if the API key is required and missing from the environment.\n */\nexport function withGTConfig<TNextConfig extends object = NextConfig>(\n nextConfig?: TNextConfig,\n props: withGTConfigProps = {}\n): WithGTConfigResult<TNextConfig> {\n // Next also accepts the `(phase, context) => config` function form. When given\n // one, call it and wrap the resolved config so `withGTConfig` composes with\n // other Next config plugins that return a config function — matching\n // `@sentry/nextjs`'s `withSentryConfig`. Without this, a function config would\n // be spread as a plain object below, silently dropping the user's config.\n if (typeof nextConfig === 'function') {\n const configFn = nextConfig as (\n phase: string,\n context: { defaultConfig: NextConfig }\n ) => NextConfig | Promise<NextConfig>;\n return ((phase: string, context: { defaultConfig: NextConfig }) => {\n const resolved = configFn(phase, context);\n return isThenable(resolved)\n ? resolved.then((resolvedConfig) => withGTConfig(resolvedConfig, props))\n : withGTConfig(resolved, props);\n }) as unknown as WithGTConfigResult<TNextConfig>;\n }\n\n const internalNextConfig = (nextConfig ?? {}) as unknown as NextConfig;\n\n // ---------- LOAD GT CONFIG FILE ---------- //\n\n let loadedConfig: Partial<InternalGTConfigProps> = {};\n try {\n let configPath: string | undefined;\n if (props.config) {\n configPath = props.config;\n } else if (fs.existsSync(defaultWithGTConfigProps.config)) {\n configPath = defaultWithGTConfigProps.config;\n } else if (fs.existsSync('./.gt/gt.config.json')) {\n // Support config under .gt for parity with .locadex\n configPath = './.gt/gt.config.json';\n } else if (fs.existsSync('./.locadex/gt.config.json')) {\n // Backward compatibility: support legacy .locadex directory\n configPath = './.locadex/gt.config.json';\n }\n if (typeof configPath === 'string' && fs.existsSync(configPath)) {\n const fileContent = fs.readFileSync(configPath, 'utf-8');\n loadedConfig = JSON.parse(fileContent);\n }\n } catch (error) {\n console.error('Error reading GT config file:', error);\n }\n\n // This warning intentionally compares Next.js i18n against explicit values\n // from the GT config file. Inline props use the conflict and merge paths below.\n const nextI18nConfigMismatches = internalNextConfig.i18n\n ? getNextI18nConfigMismatches(loadedConfig, internalNextConfig.i18n)\n : [];\n if (nextI18nConfigMismatches.length > 0) {\n console.warn(createNextI18nConfigMismatchWarning(nextI18nConfigMismatches));\n }\n\n // ---------- LOAD ENVIRONMENT VARIABLES ---------- //\n\n const { projectId, apiKey, devApiKey } = getRuntimeCredentials();\n\n // conditionally add environment variables to config\n const envConfig: Partial<InternalGTConfigProps> = {\n ...(projectId ? { projectId } : {}),\n ...(apiKey ? { apiKey } : {}),\n ...(devApiKey ? { devApiKey } : {}),\n };\n\n // ---------- CHECK FOR CONFIG CONFLICTS ---------- //\n\n // Check for conflicts between config and params\n const propsRecord = props as Record<string, unknown>;\n const conflicts = Object.entries(loadedConfig)\n .filter(([key, value]) => {\n // Skip if key doesn't exist in props\n if (!(key in props)) return false;\n\n const propValue = propsRecord[key];\n\n // Handle null/undefined values\n if (value == null || propValue == null) {\n return value !== propValue;\n }\n\n // Handle primitive types (string, number, boolean)\n if (typeof value !== 'object') {\n return value !== propValue;\n }\n\n // Handle arrays (no need for deep equality check)\n if (Array.isArray(value)) {\n if (!Array.isArray(propValue)) return true;\n if (value.length !== propValue.length) return true;\n return value.some((v, i) => v !== propValue[i]);\n }\n\n // Handle objects\n if (typeof value === 'object' && typeof propValue === 'object') {\n const valueRecord = value as Record<string, unknown>;\n const propRecord = propValue as Record<string, unknown>;\n const valueKeys = Object.keys(valueRecord);\n const propKeys = Object.keys(propRecord);\n const keys = new Set([...valueKeys, ...propKeys]);\n\n // Objects must match exactly (no need to go deeper)\n if (valueKeys.length !== propKeys.length) return true;\n return !Array.from(keys).every((k) => valueRecord[k] === propRecord[k]);\n }\n\n return false;\n })\n .map(\n ([key, value]) =>\n `- Key: ${key} Next Config: ${JSON.stringify(propsRecord[key])} does not match GT Config: ${JSON.stringify(value)}`\n );\n\n if (conflicts.length) {\n throw new Error(conflictingConfigurationBuildError(conflicts));\n }\n\n // ---------- MERGE CONFIGS ---------- //\n\n // Merge cookie and header names\n const nextLocaleDetectionEnabled =\n internalNextConfig.i18n !== null &&\n internalNextConfig.i18n !== undefined &&\n internalNextConfig.i18n.localeDetection !== false;\n const mergedHeadersAndCookies = {\n ...defaultWithGTConfigProps.headersAndCookies,\n ...props.headersAndCookies,\n // Next.js internationalized routing only reads its standard preference\n // cookie. Keep the user's i18n config untouched while aligning GT's\n // client-side locale persistence with the router.\n ...(nextLocaleDetectionEnabled && {\n localeCookieName: nextLocaleCookieName,\n }),\n };\n\n // Merge compiler options\n const mergedExperimentalCompilerOptions = {\n ...defaultWithGTConfigProps.experimentalCompilerOptions,\n ...props.experimentalCompilerOptions,\n };\n\n // precedence: input > env > config file > defaults\n const mergedConfig: InternalGTConfigProps = {\n ...defaultWithGTConfigProps,\n ...loadedConfig,\n ...envConfig,\n ...props,\n headersAndCookies: mergedHeadersAndCookies,\n experimentalCompilerOptions: mergedExperimentalCompilerOptions,\n _usingPlugin: true, // flag to indicate plugin usage\n };\n\n compilePathRegex(mergedConfig.pathRegex);\n\n // clear up any issues with the compiler options\n validateCompiler(mergedConfig);\n\n // ----------- RESOLVE ANY EXTERNAL FILES ----------- //\n\n // Resolve wasm filepath\n const turboPackEnabled = !!process.env.TURBOPACK;\n let resolvedWasmFilePath = '';\n if (mergedConfig.experimentalCompilerOptions?.type === 'swc') {\n try {\n if (turboPackEnabled) {\n const absolutePath = path.resolve(__dirname, './gt_swc_plugin.wasm');\n resolvedWasmFilePath =\n './' + path.relative(process.cwd(), absolutePath).replace(/\\\\/g, '/');\n } else {\n resolvedWasmFilePath = path.resolve(__dirname, './gt_swc_plugin.wasm');\n }\n } catch (error) {\n console.error(\n createGTCompilerUnresolvedWarning('swc'),\n 'Error message:',\n error\n );\n resolvedWasmFilePath = '';\n mergedConfig.experimentalCompilerOptions.type = 'none';\n }\n }\n\n // Resolve dictionary filepath\n let resolvedDictionaryFilePath =\n typeof mergedConfig.dictionary === 'string'\n ? mergedConfig.dictionary\n : resolveConfigFilepath('dictionary', ['.ts', '.js', '.json']); // fallback to dictionary\n\n // Check [defaultLocale].json file\n if (!resolvedDictionaryFilePath && mergedConfig.defaultLocale) {\n resolvedDictionaryFilePath = resolveConfigFilepath(\n mergedConfig.defaultLocale,\n ['.json']\n );\n\n // Check [defaultLanguageCode].json file\n if (!resolvedDictionaryFilePath) {\n const defaultLanguage = getLocaleProperties(\n mergedConfig.defaultLocale\n )?.languageCode;\n\n if (defaultLanguage && defaultLanguage !== mergedConfig.defaultLocale) {\n resolvedDictionaryFilePath = resolveConfigFilepath(defaultLanguage, [\n '.json',\n ]);\n }\n }\n }\n\n // Get the type of dictionary file\n const resolvedDictionaryFilePathType = resolvedDictionaryFilePath\n ? path.extname(resolvedDictionaryFilePath)\n : undefined;\n if (resolvedDictionaryFilePathType) {\n mergedConfig._dictionaryFileType = resolvedDictionaryFilePathType;\n }\n\n // Resolve custom dictionary loader path\n const customLoadDictionaryPath =\n typeof mergedConfig.loadDictionaryPath === 'string'\n ? mergedConfig.loadDictionaryPath\n : resolveConfigFilepath('loadDictionary');\n\n // Resolve custom translation loader path\n const customLoadTranslationsPath =\n typeof mergedConfig.loadTranslationsPath === 'string'\n ? mergedConfig.loadTranslationsPath\n : resolveConfigFilepath('loadTranslations');\n\n // Resolve request function paths\n const requestFunctionPaths = resolveRequestFunctionPaths(mergedConfig);\n\n // Warn if found in /app directory\n if (\n !resolvedDictionaryFilePath &&\n resolveConfigFilepath('dictionary', ['.ts', '.js', '.json'], undefined, [\n './app',\n './src/app',\n ])\n ) {\n console.warn(\n createBadFilepathWarning('dictionary', ['./app', './src/app'])\n );\n }\n\n if (\n !customLoadDictionaryPath &&\n resolveConfigFilepath(\n 'loadDictionary',\n ['.ts', '.js', '.json'],\n undefined,\n ['./app', './src/app']\n )\n ) {\n console.warn(\n createBadFilepathWarning('loadDictionary', ['./app', './src/app'])\n );\n }\n\n if (\n !customLoadTranslationsPath &&\n resolveConfigFilepath(\n 'loadTranslations',\n ['.ts', '.js', '.json'],\n undefined,\n ['./app', './src/app']\n )\n ) {\n console.warn(\n createBadFilepathWarning('loadTranslations', ['./app', './src/app'])\n );\n }\n\n // ----------- LOCALE STANDARDIZATION ----------- //\n\n // Check if using Services\n const gtRuntimeTranslationEnabled = !!(\n mergedConfig.runtimeUrl === defaultWithGTConfigProps.runtimeUrl &&\n ((process.env.NODE_ENV === 'production' && mergedConfig.apiKey) ||\n (process.env.NODE_ENV === 'development' && mergedConfig.devApiKey))\n );\n const gtRemoteCacheEnabled = !!(\n mergedConfig.cacheUrl === defaultWithGTConfigProps.cacheUrl &&\n mergedConfig.loadTranslationsType === 'remote'\n );\n const gtServicesEnabled = !!(\n (gtRuntimeTranslationEnabled || gtRemoteCacheEnabled) &&\n mergedConfig.projectId\n );\n\n // Standardize locales\n if (mergedConfig.locales && mergedConfig.defaultLocale) {\n mergedConfig.locales.unshift(mergedConfig.defaultLocale);\n }\n mergedConfig.locales = Array.from(new Set(mergedConfig.locales));\n\n // Standardize canonical locales\n const updatedCanonicalLocales: string[] = [];\n if (mergedConfig.customMapping) {\n mergedConfig.customMapping = Object.fromEntries(\n Object.entries(mergedConfig.customMapping).map(([key, value]) => {\n if (typeof value !== 'object' || !('code' in value)) {\n return [key, value];\n }\n const updatedLocale = gtServicesEnabled\n ? standardizeLocale((value as { code: string }).code)\n : (value as { code: string }).code;\n if (updatedLocale !== (value as { code: string }).code) {\n updatedCanonicalLocales.push(`${key} -> ${updatedLocale}`);\n }\n return [\n key,\n {\n ...value,\n code: updatedLocale,\n },\n ];\n })\n );\n }\n\n // Run cache component checks\n cacheComponentsChecks({\n nextConfig: internalNextConfig,\n requestFunctionPaths,\n localTranslationsEnabled: !!customLoadTranslationsPath,\n localDictionaryEnabled: !!customLoadDictionaryPath,\n });\n\n // ---------- DERIVED CONFIG ATTRIBUTES ---------- //\n\n // Local dictionary flag\n if (customLoadDictionaryPath) {\n // Check: file exists if provided\n if (!fs.existsSync(path.resolve(customLoadDictionaryPath))) {\n throw new Error(\n unresolvedLoadDictionaryBuildError(customLoadDictionaryPath)\n );\n } else {\n mergedConfig.loadDictionaryEnabled = true;\n }\n } else {\n mergedConfig.loadDictionaryEnabled = false;\n }\n\n // Local translations flag\n if (customLoadTranslationsPath) {\n // Check: file exists if provided\n if (!fs.existsSync(path.resolve(customLoadTranslationsPath))) {\n throw new Error(\n unresolvedLoadTranslationsBuildError(customLoadTranslationsPath)\n );\n } else {\n mergedConfig.loadTranslationsType = 'custom';\n }\n } else {\n mergedConfig.loadTranslationsType = 'remote';\n }\n\n if (internalNextConfig.cacheComponents) {\n if (mergedConfig.loadTranslationsType !== 'custom') {\n throw new Error(cacheComponentsMissingLoadTranslationsError);\n }\n if (isDevHotReloadEnabled(mergedConfig)) {\n console.warn(cacheComponentsDevHotReloadDisabledWarning);\n }\n mergedConfig._cacheComponentsEnabled = true;\n mergedConfig._disableDevHotReload = true;\n mergedConfig.cacheExpiryTime = 0;\n }\n\n // Set default cache expiry if and only if no dev key\n if (\n mergedConfig.loadTranslationsType == 'remote' &&\n !mergedConfig.devApiKey &&\n typeof mergedConfig.cacheExpiryTime === 'undefined'\n ) {\n mergedConfig.cacheExpiryTime = defaultCacheExpiryTime;\n }\n\n // ---------- ERROR CHECKS ---------- //\n\n // Check: invalid locale\n if (!mergedConfig.customMapping && gtServicesEnabled) {\n const invalidLocales: string[] = [];\n mergedConfig.locales.forEach((locale) => {\n if (!isValidLocale(locale)) {\n invalidLocales.push(locale);\n }\n });\n if (invalidLocales.length) {\n throw new Error(invalidLocalesError(invalidLocales));\n }\n }\n\n // Check: invalid canonical locale\n if (mergedConfig.customMapping && gtServicesEnabled) {\n const invalidCanonicalLocales: string[] = [];\n mergedConfig.locales.forEach((locale) => {\n if (!isValidLocale(locale, mergedConfig.customMapping)) {\n invalidCanonicalLocales.push(locale);\n }\n });\n if (invalidCanonicalLocales.length) {\n throw new Error(invalidCanonicalLocalesError(invalidCanonicalLocales));\n }\n }\n\n // Check: projectId is not required for remote infrastructure, but warn if missing for dev, nothing for prod\n if (\n (mergedConfig.cacheUrl || mergedConfig.runtimeUrl) &&\n !mergedConfig.projectId &&\n process.env.NODE_ENV === 'development' &&\n mergedConfig.loadTranslationsType === 'remote' &&\n !mergedConfig.loadDictionaryEnabled // skip warn if using local dictionary\n ) {\n console.warn(projectIdMissingWarn);\n }\n\n // Check: dev API key should not be included in production\n if (process.env.NODE_ENV === 'production' && mergedConfig.devApiKey) {\n throw new Error(devApiKeyIncludedInProductionError);\n }\n\n // Check: An API key is required for runtime translation\n if (\n mergedConfig.projectId && // must have projectId for this check to matter anyways\n mergedConfig.runtimeUrl &&\n !(mergedConfig.apiKey || mergedConfig.devApiKey) &&\n process.env.NODE_ENV === 'development'\n ) {\n console.warn(APIKeyMissingWarn);\n }\n\n // Check: if using GT infrastructure, warn about unsupported locales\n if (gtServicesEnabled) {\n // Warn about standardized canonical locales\n if (updatedCanonicalLocales.length) {\n console.warn(\n standardizedCanonicalLocalesWarning(updatedCanonicalLocales)\n );\n }\n }\n\n // ---------- STORE CONFIGURATIONS ---------- //\n const {\n projectId: _projectId,\n apiKey: _apiKey,\n devApiKey: _devApiKey,\n ...privateConfigParams\n } = mergedConfig;\n // Middleware options get their own env var instead of the i18n config params.\n const { middlewareConfig, otherConfig } =\n splitMiddlewareConfig(privateConfigParams);\n const I18NConfigParams = JSON.stringify(otherConfig);\n const clientI18NConfigParams = {\n defaultLocale: mergedConfig.defaultLocale,\n locales: mergedConfig.locales,\n customMapping: mergedConfig.customMapping,\n runtimeUrl: mergedConfig.runtimeUrl,\n cacheUrl: mergedConfig.cacheUrl,\n cacheExpiryTime: mergedConfig.cacheExpiryTime,\n maxConcurrentRequests: mergedConfig.maxConcurrentRequests,\n maxBatchSize: mergedConfig.maxBatchSize,\n batchInterval: mergedConfig.batchInterval,\n renderSettings: {\n timeout: mergedConfig.renderSettings?.timeout,\n },\n headersAndCookies: {\n localeCookieName: mergedConfig.headersAndCookies?.localeCookieName,\n enableI18nCookieName:\n mergedConfig.headersAndCookies?.enableI18nCookieName,\n },\n _versionId: mergedConfig._versionId,\n _disableDevHotReload: mergedConfig._disableDevHotReload,\n _tagIds: mergedConfig._tagIds,\n };\n\n const { type: _type, ...compilerOptions } =\n mergedConfig.experimentalCompilerOptions || {};\n\n // Read autoderive from parsingFlags (single source of truth shared with CLI)\n const rawAutoderive: boolean | { jsx?: boolean; strings?: boolean } =\n loadedConfig?.files?.gt?.parsingFlags?.autoderive ?? false;\n const autoderiveJsx =\n typeof rawAutoderive === 'boolean'\n ? rawAutoderive\n : (rawAutoderive.jsx ?? false);\n const autoderiveStrings =\n typeof rawAutoderive === 'boolean'\n ? rawAutoderive\n : (rawAutoderive.strings ?? false);\n\n const swcPluginOptions: Record<string, unknown> = {\n ...compilerOptions,\n autoderiveJsx,\n autoderiveStrings,\n };\n\n const swcPluginEntry: [string, Record<string, unknown>] | null =\n mergedConfig.experimentalCompilerOptions?.type === 'swc'\n ? [resolvedWasmFilePath, swcPluginOptions]\n : null;\n\n const turboAliases = {\n 'gt-next/internal/_dictionary': resolvedDictionaryFilePath || '',\n 'gt-next/internal/_load-translations': customLoadTranslationsPath || '',\n 'gt-next/internal/_load-dictionary': customLoadDictionaryPath || '',\n ...Object.fromEntries(\n Object.entries(requestFunctionPaths).map(([functionName, path]) => {\n return [\n REQUEST_FUNCTION_ALIASES[\n functionName as keyof typeof REQUEST_FUNCTION_ALIASES\n ],\n path,\n ];\n })\n ),\n };\n\n // experimental.turbo is deprecated in next@15.3.0.\n // Check for experimental.turbo. If we write to turbopack field, experimental fields will be ignored.\n // Yet, if there are other resolveAlias fields, we don't want to be ignored either.\n const experimentalTurbopack = !(\n turboConfigStable &&\n (!internalNextConfig.experimental?.turbo ||\n internalNextConfig.turbopack?.resolveAlias)\n );\n\n const config: NextConfig = {\n ...internalNextConfig,\n transpilePackages: Array.from(\n new Set([...(internalNextConfig.transpilePackages || []), 'gt-next'])\n ),\n env: {\n ...internalNextConfig.env,\n _GENERALTRANSLATION_LOCALE_REFRESH_SUPPORTED:\n localeRefreshSupported.toString(),\n _GENERALTRANSLATION_I18N_CONFIG_PARAMS: I18NConfigParams,\n _GENERALTRANSLATION_MIDDLEWARE_CONFIG: JSON.stringify(middlewareConfig),\n NEXT_PUBLIC_GENERALTRANSLATION_I18N_CONFIG_PARAMS: JSON.stringify(\n clientI18NConfigParams\n ),\n ...(resolvedDictionaryFilePathType && {\n _GENERALTRANSLATION_DICTIONARY_FILE_TYPE:\n resolvedDictionaryFilePathType,\n }),\n _GENERALTRANSLATION_LOCAL_DICTIONARY_ENABLED:\n mergedConfig.loadDictionaryEnabled.toString(),\n _GENERALTRANSLATION_LOCAL_TRANSLATION_ENABLED: (\n mergedConfig.loadTranslationsType === 'custom'\n ).toString(),\n _GENERALTRANSLATION_DEFAULT_LOCALE: (\n mergedConfig.defaultLocale ||\n defaultWithGTConfigProps.defaultLocale ||\n ''\n ).toString(),\n _GENERALTRANSLATION_GT_SERVICES_ENABLED: gtServicesEnabled.toString(),\n _GENERALTRANSLATION_IGNORE_BROWSER_LOCALES:\n mergedConfig.ignoreBrowserLocales?.toString() ||\n defaultWithGTConfigProps.ignoreBrowserLocales?.toString() ||\n 'false',\n _GENERALTRANSLATION_CUSTOM_GET_LOCALE_ENABLED:\n requestFunctionPaths.getLocale ? 'true' : 'false',\n _GENERALTRANSLATION_CUSTOM_GET_REGION_ENABLED:\n requestFunctionPaths.getRegion ? 'true' : 'false',\n _GENERALTRANSLATION_DISABLE_INVALID_LOCALE_WARNING:\n mergedConfig.disableInvalidLocaleWarning?.toString() || 'false',\n // nextConfig.env intentionally makes this available to client-boundary.tsx.\n ...(mergedConfig.pathRegex !== undefined && {\n _GENERALTRANSLATION_PATH_REGEX: mergedConfig.pathRegex,\n }),\n },\n ...(turboPackEnabled &&\n !experimentalTurbopack && {\n turbopack: {\n ...internalNextConfig.turbopack,\n resolveAlias: {\n ...internalNextConfig.turbopack?.resolveAlias,\n ...turboAliases,\n },\n },\n }),\n experimental: {\n ...internalNextConfig.experimental,\n ...(rootParamStability === 'experimental' && {\n rootParams: true,\n }),\n swcPlugins: [\n ...(internalNextConfig.experimental?.swcPlugins || []),\n ...(swcPluginEntry ? [swcPluginEntry] : []),\n ],\n ...(turboPackEnabled &&\n experimentalTurbopack && {\n turbo: {\n ...internalNextConfig.experimental?.turbo,\n resolveAlias: {\n ...internalNextConfig.experimental?.turbo?.resolveAlias,\n ...turboAliases,\n },\n },\n }),\n },\n webpack: function webpack(\n ...[webpackConfig, options]: Parameters<\n NonNullable<NextConfig['webpack']>\n >\n ) {\n // Only apply webpack aliases if we're using webpack (not Turbopack)\n if (!turboPackEnabled) {\n // Try to load GT compiler if available\n if (mergedConfig.experimentalCompilerOptions?.type === 'babel') {\n try {\n const {\n webpack: gtUnplugin,\n } = require('@generaltranslation/compiler');\n webpackConfig.plugins.unshift(\n gtUnplugin({\n ...mergedConfig.experimentalCompilerOptions,\n autoJsxImportSource: 'gt-next',\n })\n );\n } catch (e) {\n mergedConfig.experimentalCompilerOptions.type = 'none';\n console.warn(\n createGTCompilerUnresolvedWarning('babel'),\n 'Error message:',\n e\n );\n }\n }\n\n // Disable cache in dev bc people might move around loadTranslations() and loadDictionary() files\n if (process.env.NODE_ENV === 'development') {\n webpackConfig.cache = false;\n }\n if (resolvedDictionaryFilePath) {\n webpackConfig.resolve.alias['gt-next/internal/_dictionary'] =\n path.resolve(webpackConfig.context, resolvedDictionaryFilePath);\n }\n if (customLoadTranslationsPath) {\n webpackConfig.resolve.alias[`gt-next/internal/_load-translations`] =\n path.resolve(webpackConfig.context, customLoadTranslationsPath);\n }\n if (customLoadDictionaryPath) {\n webpackConfig.resolve.alias[`gt-next/internal/_load-dictionary`] =\n path.resolve(webpackConfig.context, customLoadDictionaryPath);\n }\n for (const [functionName, pathString] of Object.entries(\n requestFunctionPaths\n )) {\n const key =\n REQUEST_FUNCTION_ALIASES[\n functionName as keyof typeof REQUEST_FUNCTION_ALIASES\n ];\n webpackConfig.resolve.alias[key] = path.resolve(\n webpackConfig.context,\n pathString\n );\n }\n // Webpack parses .mjs as strict ESM and does not treat require()\n // calls as dependencies, so the require()-backed internal aliases\n // above would never apply and their runtime errors are swallowed\n // (loaders silently no-op). Parse gt-next's ESM dist as\n // javascript/auto so webpack picks up those require() calls.\n // Server compilation only: the call sites are server-only, and this\n // keeps the rule from ever pulling a user's loader file into the\n // client bundle. Turbopack resolves them through resolveAlias and\n // needs no rule.\n // The guard mirrors the alias block above: any configured alias\n // enables the rule. The request-function aliases are static-imported\n // (initGT.server), and resolve.alias applies at resolution regardless\n // of parser mode, so they work without the rule; they gate it anyway\n // for symmetry and for any future require()-backed consumer.\n if (\n options.isServer &&\n (resolvedDictionaryFilePath ||\n customLoadTranslationsPath ||\n customLoadDictionaryPath ||\n Object.keys(requestFunctionPaths).length > 0)\n ) {\n // gt-next normally resolves inside a node_modules dir (app-local,\n // hoisted monorepo root, or the pnpm store), but symlinked installs\n // (workspace:*, file:) resolve to a real path with no node_modules\n // segment — so also match this package's dist dir, where this\n // compiled file lives.\n const gtNextDistDirs: (string | RegExp)[] = [\n /node_modules[\\\\/]gt-next[\\\\/]dist[\\\\/]/,\n ];\n try {\n // Trust __dirname only when it verifiably is gt-next's dist: a\n // bundler that inlines this file elsewhere would otherwise widen\n // the rule to every .mjs under its output dir. The compiled\n // config always sits beside its ESM twin and the internal\n // modules these aliases target.\n if (\n fs.existsSync(path.join(__dirname, 'config.mjs')) &&\n fs.existsSync(path.join(__dirname, 'internal', '_dictionary.mjs'))\n ) {\n gtNextDistDirs.push(__dirname + path.sep);\n }\n } catch {\n // __dirname is undefined when the ESM dist of this module is\n // loaded natively; the node_modules pattern still applies.\n }\n webpackConfig.module ??= {};\n webpackConfig.module.rules ??= [];\n webpackConfig.module.rules.push({\n test: /\\.mjs$/,\n include: gtNextDistDirs,\n type: 'javascript/auto',\n });\n }\n }\n if (typeof internalNextConfig?.webpack === 'function') {\n return internalNextConfig.webpack(webpackConfig, options);\n }\n return webpackConfig;\n },\n };\n return config as WithGTConfigResult<TNextConfig>;\n}\n\nfunction isDevHotReloadEnabled(config: InternalGTConfigProps): boolean {\n return (\n !!config.devApiKey &&\n !!config.projectId &&\n config.runtimeUrl !== null &&\n config.runtimeUrl !== '' &&\n process.env.NODE_ENV === 'development'\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;AA+FA,SAAS,WAAW,OAAkD;AACpE,QACE,OAAO,UAAU,YACjB,UAAU,QACV,UAAU,SACV,OAAO,MAAM,SAAS;;AAI1B,SAAS,4BACP,UACA,UACU;CACV,MAAM,aAAuB,EAAE;AAE/B,KACE,SAAS,kBAAkB,KAAA,KAC3B,SAAS,kBAAkB,SAAS,cAEpC,YAAW,KACT,yBAAyB,KAAK,UAAU,SAAS,cAAc,CAAC,gBAAgB,KAAK,UAAU,SAAS,cAAc,GACvH;AAGH,KACE,SAAS,YAAY,KAAA,KACrB,CAAC,gBACC,SAAS,kBAAkB,KAAA,IACvB,SAAS,UACT,CAAC,SAAS,eAAe,GAAG,SAAS,QAAQ,EACjD,SAAS,QACV,CAED,YAAW,KACT,mBAAmB,KAAK,UAAU,SAAS,QAAQ,CAAC,gBAAgB,KAAK,UAAU,SAAS,QAAQ,GACrG;AAGH,QAAO;;AAGT,SAAS,gBACP,WACA,aACS;CACT,MAAM,cAAc,IAAI,IAAI,UAAU;CACtC,MAAM,gBAAgB,IAAI,IAAI,YAAY;AAC1C,QACE,YAAY,SAAS,cAAc,QACn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AW,EAAE;AAC3B,mBAAc,OAAO,UAAU,EAAE;AACjC,mBAAc,OAAO,MAAM,KAAK;MAC9B,MAAM;MACN,SAAS;MACT,MAAM;MACP,CAAC;;;AAGN,OAAI,OAAO,oBAAoB,YAAY,WACzC,QAAO,mBAAmB,QAAQ,eAAe,QAAQ;AAE3D,UAAO;;EAGE;;AAGf,SAAS,sBAAsB,QAAwC;AACrE,QACE,CAAC,CAAC,OAAO,aACT,CAAC,CAAC,OAAO,aACT,OAAO,eAAe,QACtB,OAAO,eAAe,MACtB,QAAQ,IAAI,aAAa"}
@@ -1,2 +1,4 @@
1
1
  export declare const createUnsupportedLocalesWarning: (locales: string[]) => string;
2
+ export declare const createInvalidMiddlewareEnvConfigError: (envName: string, error: unknown) => string;
3
+ export declare const createLinkRoutingConfigMismatchWarning: (options: string[]) => string;
2
4
  //# sourceMappingURL=middleware.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../../src/errors/middleware.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,+BAA+B,GAAI,SAAS,MAAM,EAAE,WAMhD,CAAC"}
1
+ {"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../../src/errors/middleware.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,+BAA+B,GAAI,SAAS,MAAM,EAAE,WAMhD,CAAC;AAElB,eAAO,MAAM,qCAAqC,GAChD,SAAS,MAAM,EACf,OAAO,OAAO,WASZ,CAAC;AAEL,eAAO,MAAM,sCAAsC,GAAI,SAAS,MAAM,EAAE,WAMpE,CAAC"}
@@ -1,12 +1,29 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  require("../_virtual/_rolldown/runtime.js");
3
+ const require_errors_diagnostics = require("./diagnostics.js");
3
4
  let _generaltranslation_format = require("@generaltranslation/format");
5
+ let generaltranslation_internal = require("generaltranslation/internal");
4
6
  //#region src/errors/middleware.ts
5
7
  const createUnsupportedLocalesWarning = (locales) => `gt-next: The following locales are currently unsupported by our service: ${locales.map((locale) => {
6
8
  const { name } = (0, _generaltranslation_format.getLocaleProperties)(locale);
7
9
  return `${locale} (${name})`;
8
10
  }).join(", ")}`;
11
+ const createInvalidMiddlewareEnvConfigError = (envName, error) => require_errors_diagnostics.createGtNextDiagnostic({
12
+ severity: "Error",
13
+ whatHappened: `${envName} is not valid JSON`,
14
+ reassurance: "gt-next ignores this variable; options passed to createNextMiddleware() still apply",
15
+ fix: "Configure gt-next through withGTConfig() instead of setting this variable manually",
16
+ details: (0, generaltranslation_internal.formatDiagnosticErrorDetails)(error)
17
+ });
18
+ const createLinkRoutingConfigMismatchWarning = (options) => require_errors_diagnostics.createGtNextDiagnostic({
19
+ severity: "Warning",
20
+ whatHappened: `createNextMiddleware() and withGTConfig() set different values for ${options.join(", ")}`,
21
+ why: "gt-next/link reads these options from withGTConfig(), so its links may redirect",
22
+ fix: "Set these options in withGTConfig() instead of createNextMiddleware()"
23
+ });
9
24
  //#endregion
25
+ exports.createInvalidMiddlewareEnvConfigError = createInvalidMiddlewareEnvConfigError;
26
+ exports.createLinkRoutingConfigMismatchWarning = createLinkRoutingConfigMismatchWarning;
10
27
  exports.createUnsupportedLocalesWarning = createUnsupportedLocalesWarning;
11
28
 
12
29
  //# sourceMappingURL=middleware.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"middleware.js","names":[],"sources":["../../src/errors/middleware.ts"],"sourcesContent":["import { getLocaleProperties } from '@generaltranslation/format';\n\nexport const createUnsupportedLocalesWarning = (locales: string[]) =>\n `gt-next: The following locales are currently unsupported by our service: ${locales\n .map((locale) => {\n const { name } = getLocaleProperties(locale);\n return `${locale} (${name})`;\n })\n .join(', ')}`;\n"],"mappings":";;;;AAEA,MAAa,mCAAmC,YAC9C,4EAA4E,QACzE,KAAK,WAAW;CACf,MAAM,EAAE,UAAA,GAAA,2BAAA,qBAA6B,OAAO;AAC5C,QAAO,GAAG,OAAO,IAAI,KAAK;EAC1B,CACD,KAAK,KAAK"}
1
+ {"version":3,"file":"middleware.js","names":["createGtNextDiagnostic"],"sources":["../../src/errors/middleware.ts"],"sourcesContent":["import { getLocaleProperties } from '@generaltranslation/format';\nimport {\n createGtNextDiagnostic,\n formatDiagnosticErrorDetails,\n} from './diagnostics';\n\nexport const createUnsupportedLocalesWarning = (locales: string[]) =>\n `gt-next: The following locales are currently unsupported by our service: ${locales\n .map((locale) => {\n const { name } = getLocaleProperties(locale);\n return `${locale} (${name})`;\n })\n .join(', ')}`;\n\nexport const createInvalidMiddlewareEnvConfigError = (\n envName: string,\n error: unknown\n) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: `${envName} is not valid JSON`,\n reassurance:\n 'gt-next ignores this variable; options passed to createNextMiddleware() still apply',\n fix: 'Configure gt-next through withGTConfig() instead of setting this variable manually',\n details: formatDiagnosticErrorDetails(error),\n });\n\nexport const createLinkRoutingConfigMismatchWarning = (options: string[]) =>\n createGtNextDiagnostic({\n severity: 'Warning',\n whatHappened: `createNextMiddleware() and withGTConfig() set different values for ${options.join(', ')}`,\n why: 'gt-next/link reads these options from withGTConfig(), so its links may redirect',\n fix: 'Set these options in withGTConfig() instead of createNextMiddleware()',\n });\n"],"mappings":";;;;;;AAMA,MAAa,mCAAmC,YAC9C,4EAA4E,QACzE,KAAK,WAAW;CACf,MAAM,EAAE,UAAA,GAAA,2BAAA,qBAA6B,OAAO;AAC5C,QAAO,GAAG,OAAO,IAAI,KAAK;EAC1B,CACD,KAAK,KAAK;AAEf,MAAa,yCACX,SACA,UAEAA,2BAAAA,uBAAuB;CACrB,UAAU;CACV,cAAc,GAAG,QAAQ;CACzB,aACE;CACF,KAAK;CACL,UAAA,GAAA,4BAAA,8BAAsC,MAAM;CAC7C,CAAC;AAEJ,MAAa,0CAA0C,YACrDA,2BAAAA,uBAAuB;CACrB,UAAU;CACV,cAAc,sEAAsE,QAAQ,KAAK,KAAK;CACtG,KAAK;CACL,KAAK;CACN,CAAC"}
@@ -1,10 +1,24 @@
1
+ import { createGtNextDiagnostic, formatDiagnosticErrorDetails } from "./diagnostics.mjs";
1
2
  import { getLocaleProperties } from "@generaltranslation/format";
2
3
  //#region src/errors/middleware.ts
3
4
  const createUnsupportedLocalesWarning = (locales) => `gt-next: The following locales are currently unsupported by our service: ${locales.map((locale) => {
4
5
  const { name } = getLocaleProperties(locale);
5
6
  return `${locale} (${name})`;
6
7
  }).join(", ")}`;
8
+ const createInvalidMiddlewareEnvConfigError = (envName, error) => createGtNextDiagnostic({
9
+ severity: "Error",
10
+ whatHappened: `${envName} is not valid JSON`,
11
+ reassurance: "gt-next ignores this variable; options passed to createNextMiddleware() still apply",
12
+ fix: "Configure gt-next through withGTConfig() instead of setting this variable manually",
13
+ details: formatDiagnosticErrorDetails(error)
14
+ });
15
+ const createLinkRoutingConfigMismatchWarning = (options) => createGtNextDiagnostic({
16
+ severity: "Warning",
17
+ whatHappened: `createNextMiddleware() and withGTConfig() set different values for ${options.join(", ")}`,
18
+ why: "gt-next/link reads these options from withGTConfig(), so its links may redirect",
19
+ fix: "Set these options in withGTConfig() instead of createNextMiddleware()"
20
+ });
7
21
  //#endregion
8
- export { createUnsupportedLocalesWarning };
22
+ export { createInvalidMiddlewareEnvConfigError, createLinkRoutingConfigMismatchWarning, createUnsupportedLocalesWarning };
9
23
 
10
24
  //# sourceMappingURL=middleware.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"middleware.mjs","names":[],"sources":["../../src/errors/middleware.ts"],"sourcesContent":["import { getLocaleProperties } from '@generaltranslation/format';\n\nexport const createUnsupportedLocalesWarning = (locales: string[]) =>\n `gt-next: The following locales are currently unsupported by our service: ${locales\n .map((locale) => {\n const { name } = getLocaleProperties(locale);\n return `${locale} (${name})`;\n })\n .join(', ')}`;\n"],"mappings":";;AAEA,MAAa,mCAAmC,YAC9C,4EAA4E,QACzE,KAAK,WAAW;CACf,MAAM,EAAE,SAAS,oBAAoB,OAAO;AAC5C,QAAO,GAAG,OAAO,IAAI,KAAK;EAC1B,CACD,KAAK,KAAK"}
1
+ {"version":3,"file":"middleware.mjs","names":[],"sources":["../../src/errors/middleware.ts"],"sourcesContent":["import { getLocaleProperties } from '@generaltranslation/format';\nimport {\n createGtNextDiagnostic,\n formatDiagnosticErrorDetails,\n} from './diagnostics';\n\nexport const createUnsupportedLocalesWarning = (locales: string[]) =>\n `gt-next: The following locales are currently unsupported by our service: ${locales\n .map((locale) => {\n const { name } = getLocaleProperties(locale);\n return `${locale} (${name})`;\n })\n .join(', ')}`;\n\nexport const createInvalidMiddlewareEnvConfigError = (\n envName: string,\n error: unknown\n) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: `${envName} is not valid JSON`,\n reassurance:\n 'gt-next ignores this variable; options passed to createNextMiddleware() still apply',\n fix: 'Configure gt-next through withGTConfig() instead of setting this variable manually',\n details: formatDiagnosticErrorDetails(error),\n });\n\nexport const createLinkRoutingConfigMismatchWarning = (options: string[]) =>\n createGtNextDiagnostic({\n severity: 'Warning',\n whatHappened: `createNextMiddleware() and withGTConfig() set different values for ${options.join(', ')}`,\n why: 'gt-next/link reads these options from withGTConfig(), so its links may redirect',\n fix: 'Set these options in withGTConfig() instead of createNextMiddleware()',\n });\n"],"mappings":";;;AAMA,MAAa,mCAAmC,YAC9C,4EAA4E,QACzE,KAAK,WAAW;CACf,MAAM,EAAE,SAAS,oBAAoB,OAAO;AAC5C,QAAO,GAAG,OAAO,IAAI,KAAK;EAC1B,CACD,KAAK,KAAK;AAEf,MAAa,yCACX,SACA,UAEA,uBAAuB;CACrB,UAAU;CACV,cAAc,GAAG,QAAQ;CACzB,aACE;CACF,KAAK;CACL,SAAS,6BAA6B,MAAM;CAC7C,CAAC;AAEJ,MAAa,0CAA0C,YACrD,uBAAuB;CACrB,UAAU;CACV,cAAc,sEAAsE,QAAQ,KAAK,KAAK;CACtG,KAAK;CACL,KAAK;CACN,CAAC"}
Binary file
@@ -8,6 +8,7 @@ export declare const withGTStaticProps: WithGTStaticPropsFunction;
8
8
  export { Branch, Currency, DateTime, Derive, GTProvider, GtInternalTranslateJsx, GtInternalVar, LocaleSelector, Num, Plural, RegionSelector, RelativeTime, T, Var, } from 'gt-react';
9
9
  export { useDefaultLocale, useGT, useLocale, useLocaleDirection, useLocaleProperties, useLocales, useLocaleSelector, useMessages, useRegion, useSetLocale, useTranslations, } from 'gt-react';
10
10
  export { decodeMsg, decodeOptions, decodeVars, declareVar, derive, getDefaultLocale, getLocaleProperties, getLocales, resolveCanonicalLocale, getTranslationsSnapshot, getVersionId, gtFallback, mFallback, msg, } from 'gt-react';
11
+ export { useLocalizeHref } from './link/useLocalizeHref';
11
12
  export { isLocaleSupported } from './request/localeValidation';
12
13
  export type { GTTranslationOptions, RuntimeTranslationOptions } from 'gt-react';
13
14
  export type { WithGTServerSideProps, WithGTStaticProps };
@@ -1 +1 @@
1
- {"version":3,"file":"index.client.d.ts","sourceRoot":"","sources":["../src/index.client.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,kBAAkB,EAClB,yBAAyB,EACzB,WAAW,EACZ,MAAM,MAAM,CAAC;AACd,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC/E,OAAO,KAAK,EACV,iBAAiB,EACjB,yBAAyB,EAC1B,MAAM,+BAA+B,CAAC;AAIvC,wBAAgB,WAAW,CACzB,MAAM,SAAS,cAAc,GAAG,cAAc,EAC9C,OAAO,SAAS,WAAW,GAAG,WAAW,EACzC,CAAC,EAAE,yBAAyB,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAIvD;AAED,wBAAgB,qBAAqB,CACnC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/D,MAAM,SAAS,cAAc,GAAG,cAAc,EAC9C,OAAO,SAAS,WAAW,GAAG,WAAW,EAEzC,CAAC,CAAC,EAAE,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,GAC7C,kBAAkB,CAAC,qBAAqB,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,CAInE;AAED,eAAO,MAAM,iBAAiB,EAAE,yBAE/B,CAAC;AAGF,OAAO,EACL,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,UAAU,EACV,sBAAsB,EACtB,aAAa,EACb,cAAc,EACd,GAAG,EACH,MAAM,EACN,cAAc,EACd,YAAY,EACZ,CAAC,EACD,GAAG,GACJ,MAAM,UAAU,CAAC;AAGlB,OAAO,EACL,gBAAgB,EAChB,KAAK,EACL,SAAS,EACT,kBAAkB,EAClB,mBAAmB,EACnB,UAAU,EACV,iBAAiB,EACjB,WAAW,EACX,SAAS,EACT,YAAY,EACZ,eAAe,GAChB,MAAM,UAAU,CAAC;AAGlB,OAAO,EACL,SAAS,EACT,aAAa,EACb,UAAU,EACV,UAAU,EACV,MAAM,EACN,gBAAgB,EAChB,mBAAmB,EACnB,UAAU,EACV,sBAAsB,EACtB,uBAAuB,EACvB,YAAY,EACZ,UAAU,EACV,SAAS,EACT,GAAG,GACJ,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAG/D,YAAY,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAChF,YAAY,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,CAAC"}
1
+ {"version":3,"file":"index.client.d.ts","sourceRoot":"","sources":["../src/index.client.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,kBAAkB,EAClB,yBAAyB,EACzB,WAAW,EACZ,MAAM,MAAM,CAAC;AACd,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC/E,OAAO,KAAK,EACV,iBAAiB,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;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAG/D,YAAY,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAChF,YAAY,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,CAAC"}
@@ -3,6 +3,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  require("./_virtual/_rolldown/runtime.js");
4
4
  const require_setup_initGT_client = require("./setup/initGT.client.js");
5
5
  const require_errors_client = require("./errors/client.js");
6
+ const require_link_useLocalizeHref = require("./link/useLocalizeHref.js");
6
7
  const require_request_localeValidation = require("./request/localeValidation.js");
7
8
  let gt_react = require("gt-react");
8
9
  //#region src/index.client.ts
@@ -229,6 +230,7 @@ Object.defineProperty(exports, "useLocales", {
229
230
  return gt_react.useLocales;
230
231
  }
231
232
  });
233
+ exports.useLocalizeHref = require_link_useLocalizeHref.useLocalizeHref;
232
234
  Object.defineProperty(exports, "useMessages", {
233
235
  enumerable: true,
234
236
  get: function() {
@@ -1 +1 @@
1
- {"version":3,"file":"index.client.js","names":["initializeGTClient","createWithGTStaticPropsClientError"],"sources":["../src/index.client.ts"],"sourcesContent":["'use client';\n\nimport { initializeGTClient } from './setup/initGT.client';\ninitializeGTClient();\n\nimport type {\n GetServerSideProps,\n GetServerSidePropsContext,\n PreviewData,\n} from 'next';\nimport type { ParsedUrlQuery } from 'querystring';\nimport type { WithGTServerSideProps } from './pages-dir/withGTServerSideProps';\nimport type {\n WithGTStaticProps,\n WithGTStaticPropsFunction,\n} from './pages-dir/withGTStaticProps';\nimport { createWithGTStaticPropsClientError } from './errors/client';\n\n// ===== Unsupported Server APIs ===== //\nexport function parseLocale<\n Params extends ParsedUrlQuery = ParsedUrlQuery,\n Preview extends PreviewData = PreviewData,\n>(_: GetServerSidePropsContext<Params, Preview>): string {\n throw new Error(\n 'parseLocale() is only available from gt-next on the server.'\n );\n}\n\nexport function withGTServerSideProps<\n Props extends Record<string, unknown> = Record<string, unknown>,\n Params extends ParsedUrlQuery = ParsedUrlQuery,\n Preview extends PreviewData = PreviewData,\n>(\n _?: GetServerSideProps<Props, Params, Preview>\n): GetServerSideProps<WithGTServerSideProps<Props>, Params, Preview> {\n throw new Error(\n 'withGTServerSideProps() is only available from gt-next on the server.'\n );\n}\n\nexport const withGTStaticProps: WithGTStaticPropsFunction = () => {\n throw new Error(createWithGTStaticPropsClientError());\n};\n\n// ===== Components ===== //\nexport {\n Branch,\n Currency,\n DateTime,\n Derive,\n GTProvider,\n GtInternalTranslateJsx,\n GtInternalVar,\n LocaleSelector,\n Num,\n Plural,\n RegionSelector,\n RelativeTime,\n T,\n Var,\n} from 'gt-react';\n\n// ===== Hooks ===== //\nexport {\n useDefaultLocale,\n useGT,\n useLocale,\n useLocaleDirection,\n useLocaleProperties,\n useLocales,\n useLocaleSelector,\n useMessages,\n useRegion,\n useSetLocale,\n useTranslations,\n} from 'gt-react';\n\n// ===== Functions ===== //\nexport {\n decodeMsg,\n decodeOptions,\n decodeVars,\n declareVar,\n derive,\n getDefaultLocale,\n getLocaleProperties,\n getLocales,\n resolveCanonicalLocale,\n getTranslationsSnapshot,\n getVersionId,\n gtFallback,\n mFallback,\n msg,\n} from 'gt-react';\nexport { isLocaleSupported } from './request/localeValidation';\n\n// ===== Types ===== //\nexport type { GTTranslationOptions, RuntimeTranslationOptions } from 'gt-react';\nexport type { WithGTServerSideProps, WithGTStaticProps };\n"],"mappings":";;;;;;;;AAGAA,4BAAAA,oBAAoB;AAgBpB,SAAgB,YAGd,GAAuD;AACvD,OAAM,IAAI,MACR,8DACD;;AAGH,SAAgB,sBAKd,GACmE;AACnE,OAAM,IAAI,MACR,wEACD;;AAGH,MAAa,0BAAqD;AAChE,OAAM,IAAI,MAAMC,sBAAAA,oCAAoC,CAAC"}
1
+ {"version":3,"file":"index.client.js","names":["initializeGTClient","createWithGTStaticPropsClientError"],"sources":["../src/index.client.ts"],"sourcesContent":["'use client';\n\nimport { initializeGTClient } from './setup/initGT.client';\ninitializeGTClient();\n\nimport type {\n GetServerSideProps,\n GetServerSidePropsContext,\n PreviewData,\n} from 'next';\nimport type { ParsedUrlQuery } from 'querystring';\nimport type { WithGTServerSideProps } from './pages-dir/withGTServerSideProps';\nimport type {\n WithGTStaticProps,\n WithGTStaticPropsFunction,\n} from './pages-dir/withGTStaticProps';\nimport { createWithGTStaticPropsClientError } from './errors/client';\n\n// ===== Unsupported Server APIs ===== //\nexport function parseLocale<\n Params extends ParsedUrlQuery = ParsedUrlQuery,\n Preview extends PreviewData = PreviewData,\n>(_: GetServerSidePropsContext<Params, Preview>): string {\n throw new Error(\n 'parseLocale() is only available from gt-next on the server.'\n );\n}\n\nexport function withGTServerSideProps<\n Props extends Record<string, unknown> = Record<string, unknown>,\n Params extends ParsedUrlQuery = ParsedUrlQuery,\n Preview extends PreviewData = PreviewData,\n>(\n _?: GetServerSideProps<Props, Params, Preview>\n): GetServerSideProps<WithGTServerSideProps<Props>, Params, Preview> {\n throw new Error(\n 'withGTServerSideProps() is only available from gt-next on the server.'\n );\n}\n\nexport const withGTStaticProps: WithGTStaticPropsFunction = () => {\n throw new Error(createWithGTStaticPropsClientError());\n};\n\n// ===== Components ===== //\nexport {\n Branch,\n Currency,\n DateTime,\n Derive,\n GTProvider,\n GtInternalTranslateJsx,\n GtInternalVar,\n LocaleSelector,\n Num,\n Plural,\n RegionSelector,\n RelativeTime,\n T,\n Var,\n} from 'gt-react';\n\n// ===== Hooks ===== //\nexport {\n useDefaultLocale,\n useGT,\n useLocale,\n useLocaleDirection,\n useLocaleProperties,\n useLocales,\n useLocaleSelector,\n useMessages,\n useRegion,\n useSetLocale,\n useTranslations,\n} from 'gt-react';\n\n// ===== Functions ===== //\nexport {\n decodeMsg,\n decodeOptions,\n decodeVars,\n declareVar,\n derive,\n getDefaultLocale,\n getLocaleProperties,\n getLocales,\n resolveCanonicalLocale,\n getTranslationsSnapshot,\n getVersionId,\n gtFallback,\n mFallback,\n msg,\n} from 'gt-react';\nexport { useLocalizeHref } from './link/useLocalizeHref';\nexport { isLocaleSupported } from './request/localeValidation';\n\n// ===== Types ===== //\nexport type { GTTranslationOptions, RuntimeTranslationOptions } from 'gt-react';\nexport type { WithGTServerSideProps, WithGTStaticProps };\n"],"mappings":";;;;;;;;;AAGAA,4BAAAA,oBAAoB;AAgBpB,SAAgB,YAGd,GAAuD;AACvD,OAAM,IAAI,MACR,8DACD;;AAGH,SAAgB,sBAKd,GACmE;AACnE,OAAM,IAAI,MACR,wEACD;;AAGH,MAAa,0BAAqD;AAChE,OAAM,IAAI,MAAMC,sBAAAA,oCAAoC,CAAC"}
@@ -1,6 +1,7 @@
1
1
  "use client";
2
2
  import { initializeGTClient } from "./setup/initGT.client.mjs";
3
3
  import { createWithGTStaticPropsClientError } from "./errors/client.mjs";
4
+ import { useLocalizeHref } from "./link/useLocalizeHref.mjs";
4
5
  import { isLocaleSupported } from "./request/localeValidation.mjs";
5
6
  import { Branch, Currency, DateTime, Derive, GTProvider, GtInternalTranslateJsx, GtInternalVar, LocaleSelector, Num, Plural, RegionSelector, RelativeTime, T, Var, declareVar, decodeMsg, decodeOptions, decodeVars, derive, getDefaultLocale, getLocaleProperties, getLocales, getTranslationsSnapshot, getVersionId, gtFallback, mFallback, msg, resolveCanonicalLocale, useDefaultLocale, useGT, useLocale, useLocaleDirection, useLocaleProperties, useLocaleSelector, useLocales, useMessages, useRegion, useSetLocale, useTranslations } from "gt-react";
6
7
  //#region src/index.client.ts
@@ -15,6 +16,6 @@ const withGTStaticProps = () => {
15
16
  throw new Error(createWithGTStaticPropsClientError());
16
17
  };
17
18
  //#endregion
18
- export { Branch, Currency, DateTime, Derive, GTProvider, GtInternalTranslateJsx, GtInternalVar, LocaleSelector, Num, Plural, RegionSelector, RelativeTime, T, Var, declareVar, decodeMsg, decodeOptions, decodeVars, derive, getDefaultLocale, getLocaleProperties, getLocales, getTranslationsSnapshot, getVersionId, gtFallback, isLocaleSupported, mFallback, msg, parseLocale, resolveCanonicalLocale, useDefaultLocale, useGT, useLocale, useLocaleDirection, useLocaleProperties, useLocaleSelector, useLocales, useMessages, useRegion, useSetLocale, useTranslations, withGTServerSideProps, withGTStaticProps };
19
+ export { Branch, Currency, DateTime, Derive, GTProvider, GtInternalTranslateJsx, GtInternalVar, LocaleSelector, Num, Plural, RegionSelector, RelativeTime, T, Var, declareVar, decodeMsg, decodeOptions, decodeVars, derive, getDefaultLocale, getLocaleProperties, getLocales, getTranslationsSnapshot, getVersionId, gtFallback, isLocaleSupported, mFallback, msg, parseLocale, resolveCanonicalLocale, useDefaultLocale, useGT, useLocale, useLocaleDirection, useLocaleProperties, useLocaleSelector, useLocales, useLocalizeHref, useMessages, useRegion, useSetLocale, useTranslations, withGTServerSideProps, withGTStaticProps };
19
20
 
20
21
  //# sourceMappingURL=index.client.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.client.mjs","names":[],"sources":["../src/index.client.ts"],"sourcesContent":["'use client';\n\nimport { initializeGTClient } from './setup/initGT.client';\ninitializeGTClient();\n\nimport type {\n GetServerSideProps,\n GetServerSidePropsContext,\n PreviewData,\n} from 'next';\nimport type { ParsedUrlQuery } from 'querystring';\nimport type { WithGTServerSideProps } from './pages-dir/withGTServerSideProps';\nimport type {\n WithGTStaticProps,\n WithGTStaticPropsFunction,\n} from './pages-dir/withGTStaticProps';\nimport { createWithGTStaticPropsClientError } from './errors/client';\n\n// ===== Unsupported Server APIs ===== //\nexport function parseLocale<\n Params extends ParsedUrlQuery = ParsedUrlQuery,\n Preview extends PreviewData = PreviewData,\n>(_: GetServerSidePropsContext<Params, Preview>): string {\n throw new Error(\n 'parseLocale() is only available from gt-next on the server.'\n );\n}\n\nexport function withGTServerSideProps<\n Props extends Record<string, unknown> = Record<string, unknown>,\n Params extends ParsedUrlQuery = ParsedUrlQuery,\n Preview extends PreviewData = PreviewData,\n>(\n _?: GetServerSideProps<Props, Params, Preview>\n): GetServerSideProps<WithGTServerSideProps<Props>, Params, Preview> {\n throw new Error(\n 'withGTServerSideProps() is only available from gt-next on the server.'\n );\n}\n\nexport const withGTStaticProps: WithGTStaticPropsFunction = () => {\n throw new Error(createWithGTStaticPropsClientError());\n};\n\n// ===== Components ===== //\nexport {\n Branch,\n Currency,\n DateTime,\n Derive,\n GTProvider,\n GtInternalTranslateJsx,\n GtInternalVar,\n LocaleSelector,\n Num,\n Plural,\n RegionSelector,\n RelativeTime,\n T,\n Var,\n} from 'gt-react';\n\n// ===== Hooks ===== //\nexport {\n useDefaultLocale,\n useGT,\n useLocale,\n useLocaleDirection,\n useLocaleProperties,\n useLocales,\n useLocaleSelector,\n useMessages,\n useRegion,\n useSetLocale,\n useTranslations,\n} from 'gt-react';\n\n// ===== Functions ===== //\nexport {\n decodeMsg,\n decodeOptions,\n decodeVars,\n declareVar,\n derive,\n getDefaultLocale,\n getLocaleProperties,\n getLocales,\n resolveCanonicalLocale,\n getTranslationsSnapshot,\n getVersionId,\n gtFallback,\n mFallback,\n msg,\n} from 'gt-react';\nexport { isLocaleSupported } from './request/localeValidation';\n\n// ===== Types ===== //\nexport type { GTTranslationOptions, RuntimeTranslationOptions } from 'gt-react';\nexport type { WithGTServerSideProps, WithGTStaticProps };\n"],"mappings":";;;;;;AAGA,oBAAoB;AAgBpB,SAAgB,YAGd,GAAuD;AACvD,OAAM,IAAI,MACR,8DACD;;AAGH,SAAgB,sBAKd,GACmE;AACnE,OAAM,IAAI,MACR,wEACD;;AAGH,MAAa,0BAAqD;AAChE,OAAM,IAAI,MAAM,oCAAoC,CAAC"}
1
+ {"version":3,"file":"index.client.mjs","names":[],"sources":["../src/index.client.ts"],"sourcesContent":["'use client';\n\nimport { initializeGTClient } from './setup/initGT.client';\ninitializeGTClient();\n\nimport type {\n GetServerSideProps,\n GetServerSidePropsContext,\n PreviewData,\n} from 'next';\nimport type { ParsedUrlQuery } from 'querystring';\nimport type { WithGTServerSideProps } from './pages-dir/withGTServerSideProps';\nimport type {\n WithGTStaticProps,\n WithGTStaticPropsFunction,\n} from './pages-dir/withGTStaticProps';\nimport { createWithGTStaticPropsClientError } from './errors/client';\n\n// ===== Unsupported Server APIs ===== //\nexport function parseLocale<\n Params extends ParsedUrlQuery = ParsedUrlQuery,\n Preview extends PreviewData = PreviewData,\n>(_: GetServerSidePropsContext<Params, Preview>): string {\n throw new Error(\n 'parseLocale() is only available from gt-next on the server.'\n );\n}\n\nexport function withGTServerSideProps<\n Props extends Record<string, unknown> = Record<string, unknown>,\n Params extends ParsedUrlQuery = ParsedUrlQuery,\n Preview extends PreviewData = PreviewData,\n>(\n _?: GetServerSideProps<Props, Params, Preview>\n): GetServerSideProps<WithGTServerSideProps<Props>, Params, Preview> {\n throw new Error(\n 'withGTServerSideProps() is only available from gt-next on the server.'\n );\n}\n\nexport const withGTStaticProps: WithGTStaticPropsFunction = () => {\n throw new Error(createWithGTStaticPropsClientError());\n};\n\n// ===== Components ===== //\nexport {\n Branch,\n Currency,\n DateTime,\n Derive,\n GTProvider,\n GtInternalTranslateJsx,\n GtInternalVar,\n LocaleSelector,\n Num,\n Plural,\n RegionSelector,\n RelativeTime,\n T,\n Var,\n} from 'gt-react';\n\n// ===== Hooks ===== //\nexport {\n useDefaultLocale,\n useGT,\n useLocale,\n useLocaleDirection,\n useLocaleProperties,\n useLocales,\n useLocaleSelector,\n useMessages,\n useRegion,\n useSetLocale,\n useTranslations,\n} from 'gt-react';\n\n// ===== Functions ===== //\nexport {\n decodeMsg,\n decodeOptions,\n decodeVars,\n declareVar,\n derive,\n getDefaultLocale,\n getLocaleProperties,\n getLocales,\n resolveCanonicalLocale,\n getTranslationsSnapshot,\n getVersionId,\n gtFallback,\n mFallback,\n msg,\n} from 'gt-react';\nexport { useLocalizeHref } from './link/useLocalizeHref';\nexport { isLocaleSupported } from './request/localeValidation';\n\n// ===== Types ===== //\nexport type { GTTranslationOptions, RuntimeTranslationOptions } from 'gt-react';\nexport type { WithGTServerSideProps, WithGTStaticProps };\n"],"mappings":";;;;;;;AAGA,oBAAoB;AAgBpB,SAAgB,YAGd,GAAuD;AACvD,OAAM,IAAI,MACR,8DACD;;AAGH,SAAgB,sBAKd,GACmE;AACnE,OAAM,IAAI,MACR,wEACD;;AAGH,MAAa,0BAAqD;AAChE,OAAM,IAAI,MAAM,oCAAoC,CAAC"}
@@ -15,6 +15,7 @@ export { GtInternalVar, Var } from './variables/Var';
15
15
  export { useLocale } from './request/getLocale';
16
16
  export { useRegion } from './request/getRegion';
17
17
  export { useLocaleDirection } from './request/getLocaleDirection';
18
+ export { useLocalizeHref } from './link/getLocalizeHref';
18
19
  export { useTranslations, useMessages, useGT, } from './server-dir/buildtime/strings';
19
20
  export { Client_LocaleSelector as LocaleSelector } from './utils/client-boundary';
20
21
  export { Client_RegionSelector as RegionSelector } from './utils/client-boundary';
@@ -1 +1 @@
1
- {"version":3,"file":"index.rsc.d.ts","sourceRoot":"","sources":["../src/index.rsc.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAC;AAGrB,OAAO,KAAK,EACV,kBAAkB,EAClB,yBAAyB,EACzB,WAAW,EACZ,MAAM,MAAM,CAAC;AACd,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAKlD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC/E,OAAO,KAAK,EACV,iBAAiB,EACjB,yBAAyB,EAC1B,MAAM,+BAA+B,CAAC;AAIvC,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,sBAA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E,OAAO,EACL,SAAS,EACT,aAAa,EACb,UAAU,EACV,UAAU,EACV,MAAM,EACN,gBAAgB,EAChB,mBAAmB,EACnB,UAAU,EACV,sBAAsB,EACtB,YAAY,EACZ,UAAU,EACV,SAAS,EACT,GAAG,GACJ,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAG/D,YAAY,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAChF,YAAY,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,CAAC"}
package/dist/index.rsc.js CHANGED
@@ -15,6 +15,7 @@ const require_variables_RelativeTime = require("./variables/RelativeTime.js");
15
15
  const require_variables_Var = require("./variables/Var.js");
16
16
  const require_server_dir_buildtime_T = require("./server-dir/buildtime/T.js");
17
17
  const require_request_getLocaleDirection = require("./request/getLocaleDirection.js");
18
+ const require_link_getLocalizeHref = require("./link/getLocalizeHref.js");
18
19
  const require_server_dir_buildtime_strings = require("./server-dir/buildtime/strings.js");
19
20
  let gt_react = require("gt-react");
20
21
  require("server-only");
@@ -181,6 +182,7 @@ Object.defineProperty(exports, "useLocales", {
181
182
  return gt_react.useLocales;
182
183
  }
183
184
  });
185
+ exports.useLocalizeHref = require_link_getLocalizeHref.useLocalizeHref;
184
186
  exports.useMessages = require_server_dir_buildtime_strings.useMessages;
185
187
  exports.useRegion = require_request_getRegion.useRegion;
186
188
  exports.useTranslations = require_server_dir_buildtime_strings.useTranslations;
@@ -1 +1 @@
1
- {"version":3,"file":"index.rsc.js","names":["initializeGTServer","getTranslationsSnapshotRscError","withGTStaticPropsRscError"],"sources":["../src/index.rsc.ts"],"sourcesContent":["import 'server-only';\n\nimport { initializeGTServer } from './setup/initGT.server';\nimport type {\n GetServerSideProps,\n GetServerSidePropsContext,\n PreviewData,\n} from 'next';\nimport type { ParsedUrlQuery } from 'querystring';\nimport {\n getTranslationsSnapshotRscError,\n withGTStaticPropsRscError,\n} from './errors/createErrors';\nimport type { WithGTServerSideProps } from './pages-dir/withGTServerSideProps';\nimport type {\n WithGTStaticProps,\n WithGTStaticPropsFunction,\n} from './pages-dir/withGTStaticProps';\ninitializeGTServer();\n\n// ===== Components ===== //\nexport { Branch } from './branches/Branch';\nexport { Currency } from './variables/Currency';\nexport { DateTime } from './variables/DateTime';\nexport { GTProvider } from './provider/GTProvider';\nexport { Num } from './variables/Num';\nexport { Plural } from './branches/Plural';\nexport { RelativeTime } from './variables/RelativeTime';\nexport { GtInternalTranslateJsx, T } from './server-dir/buildtime/T';\nexport { GtInternalVar, Var } from './variables/Var';\n\n// ===== Hooks ===== //\nexport { useLocale } from './request/getLocale';\nexport { useRegion } from './request/getRegion';\nexport { useLocaleDirection } from './request/getLocaleDirection';\nexport {\n useTranslations,\n useMessages,\n useGT,\n} from './server-dir/buildtime/strings';\n\n// ===== Client Boundary ===== //\n\nexport { Client_LocaleSelector as LocaleSelector } from './utils/client-boundary';\nexport { Client_RegionSelector as RegionSelector } from './utils/client-boundary';\n\n// ===== other ===== //\n\n/**\n * Placeholder for getTranslationsSnapshot()\n * This function is for next-pages use, not next-app use\n */\nexport function getTranslationsSnapshot(_: string) {\n throw new Error(getTranslationsSnapshotRscError);\n}\n\n/**\n * Placeholder for parseLocale()\n * This function is for next-pages use, not next-app use\n */\nexport function parseLocale<\n Params extends ParsedUrlQuery = ParsedUrlQuery,\n Preview extends PreviewData = PreviewData,\n>(_: GetServerSidePropsContext<Params, Preview>): string {\n throw new Error('parseLocale() is only available for the Pages Router.');\n}\n\n/**\n * Placeholder for withGTServerSideProps()\n * This function is for next-pages use, not next-app use\n */\nexport function withGTServerSideProps<\n Props extends Record<string, unknown> = Record<string, unknown>,\n Params extends ParsedUrlQuery = ParsedUrlQuery,\n Preview extends PreviewData = PreviewData,\n>(\n _?: GetServerSideProps<Props, Params, Preview>\n): GetServerSideProps<WithGTServerSideProps<Props>, Params, Preview> {\n throw new Error(\n 'withGTServerSideProps() is only available for the Pages Router.'\n );\n}\n\n/**\n * Placeholder for withGTStaticProps()\n * This function is for next-pages use, not next-app use\n */\nexport const withGTStaticProps: WithGTStaticPropsFunction = () => {\n throw new Error(withGTStaticPropsRscError);\n};\n\n// ===== gt-react Components ===== //\nexport { Derive } from 'gt-react';\n\n// ===== gt-react Hooks ===== //\nexport { useDefaultLocale, useLocaleProperties, useLocales } from 'gt-react';\n\n// ===== gt-react Functions ===== //\nexport {\n decodeMsg,\n decodeOptions,\n decodeVars,\n declareVar,\n derive,\n getDefaultLocale,\n getLocaleProperties,\n getLocales,\n resolveCanonicalLocale,\n getVersionId,\n gtFallback,\n mFallback,\n msg,\n} from 'gt-react';\nexport { isLocaleSupported } from './request/localeValidation';\n\n// ===== Types ===== //\nexport type { GTTranslationOptions, RuntimeTranslationOptions } from 'gt-react';\nexport type { WithGTServerSideProps, WithGTStaticProps };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAkBAA,4BAAAA,oBAAoB;;;;;AAkCpB,SAAgB,wBAAwB,GAAW;AACjD,OAAM,IAAI,MAAMC,4BAAAA,gCAAgC;;;;;;AAOlD,SAAgB,YAGd,GAAuD;AACvD,OAAM,IAAI,MAAM,wDAAwD;;;;;;AAO1E,SAAgB,sBAKd,GACmE;AACnE,OAAM,IAAI,MACR,kEACD;;;;;;AAOH,MAAa,0BAAqD;AAChE,OAAM,IAAI,MAAMC,4BAAAA,0BAA0B"}
1
+ {"version":3,"file":"index.rsc.js","names":["initializeGTServer","getTranslationsSnapshotRscError","withGTStaticPropsRscError"],"sources":["../src/index.rsc.ts"],"sourcesContent":["import 'server-only';\n\nimport { initializeGTServer } from './setup/initGT.server';\nimport type {\n GetServerSideProps,\n GetServerSidePropsContext,\n PreviewData,\n} from 'next';\nimport type { ParsedUrlQuery } from 'querystring';\nimport {\n getTranslationsSnapshotRscError,\n withGTStaticPropsRscError,\n} from './errors/createErrors';\nimport type { WithGTServerSideProps } from './pages-dir/withGTServerSideProps';\nimport type {\n WithGTStaticProps,\n WithGTStaticPropsFunction,\n} from './pages-dir/withGTStaticProps';\ninitializeGTServer();\n\n// ===== Components ===== //\nexport { Branch } from './branches/Branch';\nexport { Currency } from './variables/Currency';\nexport { DateTime } from './variables/DateTime';\nexport { GTProvider } from './provider/GTProvider';\nexport { Num } from './variables/Num';\nexport { Plural } from './branches/Plural';\nexport { RelativeTime } from './variables/RelativeTime';\nexport { GtInternalTranslateJsx, T } from './server-dir/buildtime/T';\nexport { GtInternalVar, Var } from './variables/Var';\n\n// ===== Hooks ===== //\nexport { useLocale } from './request/getLocale';\nexport { useRegion } from './request/getRegion';\nexport { useLocaleDirection } from './request/getLocaleDirection';\nexport { useLocalizeHref } from './link/getLocalizeHref';\nexport {\n useTranslations,\n useMessages,\n useGT,\n} from './server-dir/buildtime/strings';\n\n// ===== Client Boundary ===== //\n\nexport { Client_LocaleSelector as LocaleSelector } from './utils/client-boundary';\nexport { Client_RegionSelector as RegionSelector } from './utils/client-boundary';\n\n// ===== other ===== //\n\n/**\n * Placeholder for getTranslationsSnapshot()\n * This function is for next-pages use, not next-app use\n */\nexport function getTranslationsSnapshot(_: string) {\n throw new Error(getTranslationsSnapshotRscError);\n}\n\n/**\n * Placeholder for parseLocale()\n * This function is for next-pages use, not next-app use\n */\nexport function parseLocale<\n Params extends ParsedUrlQuery = ParsedUrlQuery,\n Preview extends PreviewData = PreviewData,\n>(_: GetServerSidePropsContext<Params, Preview>): string {\n throw new Error('parseLocale() is only available for the Pages Router.');\n}\n\n/**\n * Placeholder for withGTServerSideProps()\n * This function is for next-pages use, not next-app use\n */\nexport function withGTServerSideProps<\n Props extends Record<string, unknown> = Record<string, unknown>,\n Params extends ParsedUrlQuery = ParsedUrlQuery,\n Preview extends PreviewData = PreviewData,\n>(\n _?: GetServerSideProps<Props, Params, Preview>\n): GetServerSideProps<WithGTServerSideProps<Props>, Params, Preview> {\n throw new Error(\n 'withGTServerSideProps() is only available for the Pages Router.'\n );\n}\n\n/**\n * Placeholder for withGTStaticProps()\n * This function is for next-pages use, not next-app use\n */\nexport const withGTStaticProps: WithGTStaticPropsFunction = () => {\n throw new Error(withGTStaticPropsRscError);\n};\n\n// ===== gt-react Components ===== //\nexport { Derive } from 'gt-react';\n\n// ===== gt-react Hooks ===== //\nexport { useDefaultLocale, useLocaleProperties, useLocales } from 'gt-react';\n\n// ===== gt-react Functions ===== //\nexport {\n decodeMsg,\n decodeOptions,\n decodeVars,\n declareVar,\n derive,\n getDefaultLocale,\n getLocaleProperties,\n getLocales,\n resolveCanonicalLocale,\n getVersionId,\n gtFallback,\n mFallback,\n msg,\n} from 'gt-react';\nexport { isLocaleSupported } from './request/localeValidation';\n\n// ===== Types ===== //\nexport type { GTTranslationOptions, RuntimeTranslationOptions } from 'gt-react';\nexport type { WithGTServerSideProps, WithGTStaticProps };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAkBAA,4BAAAA,oBAAoB;;;;;AAmCpB,SAAgB,wBAAwB,GAAW;AACjD,OAAM,IAAI,MAAMC,4BAAAA,gCAAgC;;;;;;AAOlD,SAAgB,YAGd,GAAuD;AACvD,OAAM,IAAI,MAAM,wDAAwD;;;;;;AAO1E,SAAgB,sBAKd,GACmE;AACnE,OAAM,IAAI,MACR,kEACD;;;;;;AAOH,MAAa,0BAAqD;AAChE,OAAM,IAAI,MAAMC,4BAAAA,0BAA0B"}
@@ -13,6 +13,7 @@ import { RelativeTime } from "./variables/RelativeTime.mjs";
13
13
  import { GtInternalVar, Var } from "./variables/Var.mjs";
14
14
  import { GtInternalTranslateJsx, T } from "./server-dir/buildtime/T.mjs";
15
15
  import { useLocaleDirection } from "./request/getLocaleDirection.mjs";
16
+ import { useLocalizeHref } from "./link/getLocalizeHref.mjs";
16
17
  import { useGT, useMessages, useTranslations } from "./server-dir/buildtime/strings.mjs";
17
18
  import { Derive, declareVar, decodeMsg, decodeOptions, decodeVars, derive, getDefaultLocale, getLocaleProperties, getLocales, getVersionId, gtFallback, mFallback, msg, resolveCanonicalLocale, useDefaultLocale, useLocaleProperties, useLocales } from "gt-react";
18
19
  import "server-only";
@@ -48,6 +49,6 @@ const withGTStaticProps = () => {
48
49
  throw new Error(withGTStaticPropsRscError);
49
50
  };
50
51
  //#endregion
51
- export { Branch, Currency, DateTime, Derive, GTProvider, GtInternalTranslateJsx, GtInternalVar, LocaleSelector, Num, Plural, RegionSelector, RelativeTime, T, Var, declareVar, decodeMsg, decodeOptions, decodeVars, derive, getDefaultLocale, getLocaleProperties, getLocales, getTranslationsSnapshot, getVersionId, gtFallback, isLocaleSupported, mFallback, msg, parseLocale, resolveCanonicalLocale, useDefaultLocale, useGT, useLocale, useLocaleDirection, useLocaleProperties, useLocales, useMessages, useRegion, useTranslations, withGTServerSideProps, withGTStaticProps };
52
+ export { Branch, Currency, DateTime, Derive, GTProvider, GtInternalTranslateJsx, GtInternalVar, LocaleSelector, Num, Plural, RegionSelector, RelativeTime, T, Var, declareVar, decodeMsg, decodeOptions, decodeVars, derive, getDefaultLocale, getLocaleProperties, getLocales, getTranslationsSnapshot, getVersionId, gtFallback, isLocaleSupported, mFallback, msg, parseLocale, resolveCanonicalLocale, useDefaultLocale, useGT, useLocale, useLocaleDirection, useLocaleProperties, useLocales, useLocalizeHref, useMessages, useRegion, useTranslations, withGTServerSideProps, withGTStaticProps };
52
53
 
53
54
  //# sourceMappingURL=index.rsc.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.rsc.mjs","names":[],"sources":["../src/index.rsc.ts"],"sourcesContent":["import 'server-only';\n\nimport { initializeGTServer } from './setup/initGT.server';\nimport type {\n GetServerSideProps,\n GetServerSidePropsContext,\n PreviewData,\n} from 'next';\nimport type { ParsedUrlQuery } from 'querystring';\nimport {\n getTranslationsSnapshotRscError,\n withGTStaticPropsRscError,\n} from './errors/createErrors';\nimport type { WithGTServerSideProps } from './pages-dir/withGTServerSideProps';\nimport type {\n WithGTStaticProps,\n WithGTStaticPropsFunction,\n} from './pages-dir/withGTStaticProps';\ninitializeGTServer();\n\n// ===== Components ===== //\nexport { Branch } from './branches/Branch';\nexport { Currency } from './variables/Currency';\nexport { DateTime } from './variables/DateTime';\nexport { GTProvider } from './provider/GTProvider';\nexport { Num } from './variables/Num';\nexport { Plural } from './branches/Plural';\nexport { RelativeTime } from './variables/RelativeTime';\nexport { GtInternalTranslateJsx, T } from './server-dir/buildtime/T';\nexport { GtInternalVar, Var } from './variables/Var';\n\n// ===== Hooks ===== //\nexport { useLocale } from './request/getLocale';\nexport { useRegion } from './request/getRegion';\nexport { useLocaleDirection } from './request/getLocaleDirection';\nexport {\n useTranslations,\n useMessages,\n useGT,\n} from './server-dir/buildtime/strings';\n\n// ===== Client Boundary ===== //\n\nexport { Client_LocaleSelector as LocaleSelector } from './utils/client-boundary';\nexport { Client_RegionSelector as RegionSelector } from './utils/client-boundary';\n\n// ===== other ===== //\n\n/**\n * Placeholder for getTranslationsSnapshot()\n * This function is for next-pages use, not next-app use\n */\nexport function getTranslationsSnapshot(_: string) {\n throw new Error(getTranslationsSnapshotRscError);\n}\n\n/**\n * Placeholder for parseLocale()\n * This function is for next-pages use, not next-app use\n */\nexport function parseLocale<\n Params extends ParsedUrlQuery = ParsedUrlQuery,\n Preview extends PreviewData = PreviewData,\n>(_: GetServerSidePropsContext<Params, Preview>): string {\n throw new Error('parseLocale() is only available for the Pages Router.');\n}\n\n/**\n * Placeholder for withGTServerSideProps()\n * This function is for next-pages use, not next-app use\n */\nexport function withGTServerSideProps<\n Props extends Record<string, unknown> = Record<string, unknown>,\n Params extends ParsedUrlQuery = ParsedUrlQuery,\n Preview extends PreviewData = PreviewData,\n>(\n _?: GetServerSideProps<Props, Params, Preview>\n): GetServerSideProps<WithGTServerSideProps<Props>, Params, Preview> {\n throw new Error(\n 'withGTServerSideProps() is only available for the Pages Router.'\n );\n}\n\n/**\n * Placeholder for withGTStaticProps()\n * This function is for next-pages use, not next-app use\n */\nexport const withGTStaticProps: WithGTStaticPropsFunction = () => {\n throw new Error(withGTStaticPropsRscError);\n};\n\n// ===== gt-react Components ===== //\nexport { Derive } from 'gt-react';\n\n// ===== gt-react Hooks ===== //\nexport { useDefaultLocale, useLocaleProperties, useLocales } from 'gt-react';\n\n// ===== gt-react Functions ===== //\nexport {\n decodeMsg,\n decodeOptions,\n decodeVars,\n declareVar,\n derive,\n getDefaultLocale,\n getLocaleProperties,\n getLocales,\n resolveCanonicalLocale,\n getVersionId,\n gtFallback,\n mFallback,\n msg,\n} from 'gt-react';\nexport { isLocaleSupported } from './request/localeValidation';\n\n// ===== Types ===== //\nexport type { GTTranslationOptions, RuntimeTranslationOptions } from 'gt-react';\nexport type { WithGTServerSideProps, WithGTStaticProps };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAkBA,oBAAoB;;;;;AAkCpB,SAAgB,wBAAwB,GAAW;AACjD,OAAM,IAAI,MAAM,gCAAgC;;;;;;AAOlD,SAAgB,YAGd,GAAuD;AACvD,OAAM,IAAI,MAAM,wDAAwD;;;;;;AAO1E,SAAgB,sBAKd,GACmE;AACnE,OAAM,IAAI,MACR,kEACD;;;;;;AAOH,MAAa,0BAAqD;AAChE,OAAM,IAAI,MAAM,0BAA0B"}
1
+ {"version":3,"file":"index.rsc.mjs","names":[],"sources":["../src/index.rsc.ts"],"sourcesContent":["import 'server-only';\n\nimport { initializeGTServer } from './setup/initGT.server';\nimport type {\n GetServerSideProps,\n GetServerSidePropsContext,\n PreviewData,\n} from 'next';\nimport type { ParsedUrlQuery } from 'querystring';\nimport {\n getTranslationsSnapshotRscError,\n withGTStaticPropsRscError,\n} from './errors/createErrors';\nimport type { WithGTServerSideProps } from './pages-dir/withGTServerSideProps';\nimport type {\n WithGTStaticProps,\n WithGTStaticPropsFunction,\n} from './pages-dir/withGTStaticProps';\ninitializeGTServer();\n\n// ===== Components ===== //\nexport { Branch } from './branches/Branch';\nexport { Currency } from './variables/Currency';\nexport { DateTime } from './variables/DateTime';\nexport { GTProvider } from './provider/GTProvider';\nexport { Num } from './variables/Num';\nexport { Plural } from './branches/Plural';\nexport { RelativeTime } from './variables/RelativeTime';\nexport { GtInternalTranslateJsx, T } from './server-dir/buildtime/T';\nexport { GtInternalVar, Var } from './variables/Var';\n\n// ===== Hooks ===== //\nexport { useLocale } from './request/getLocale';\nexport { useRegion } from './request/getRegion';\nexport { useLocaleDirection } from './request/getLocaleDirection';\nexport { useLocalizeHref } from './link/getLocalizeHref';\nexport {\n useTranslations,\n useMessages,\n useGT,\n} from './server-dir/buildtime/strings';\n\n// ===== Client Boundary ===== //\n\nexport { Client_LocaleSelector as LocaleSelector } from './utils/client-boundary';\nexport { Client_RegionSelector as RegionSelector } from './utils/client-boundary';\n\n// ===== other ===== //\n\n/**\n * Placeholder for getTranslationsSnapshot()\n * This function is for next-pages use, not next-app use\n */\nexport function getTranslationsSnapshot(_: string) {\n throw new Error(getTranslationsSnapshotRscError);\n}\n\n/**\n * Placeholder for parseLocale()\n * This function is for next-pages use, not next-app use\n */\nexport function parseLocale<\n Params extends ParsedUrlQuery = ParsedUrlQuery,\n Preview extends PreviewData = PreviewData,\n>(_: GetServerSidePropsContext<Params, Preview>): string {\n throw new Error('parseLocale() is only available for the Pages Router.');\n}\n\n/**\n * Placeholder for withGTServerSideProps()\n * This function is for next-pages use, not next-app use\n */\nexport function withGTServerSideProps<\n Props extends Record<string, unknown> = Record<string, unknown>,\n Params extends ParsedUrlQuery = ParsedUrlQuery,\n Preview extends PreviewData = PreviewData,\n>(\n _?: GetServerSideProps<Props, Params, Preview>\n): GetServerSideProps<WithGTServerSideProps<Props>, Params, Preview> {\n throw new Error(\n 'withGTServerSideProps() is only available for the Pages Router.'\n );\n}\n\n/**\n * Placeholder for withGTStaticProps()\n * This function is for next-pages use, not next-app use\n */\nexport const withGTStaticProps: WithGTStaticPropsFunction = () => {\n throw new Error(withGTStaticPropsRscError);\n};\n\n// ===== gt-react Components ===== //\nexport { Derive } from 'gt-react';\n\n// ===== gt-react Hooks ===== //\nexport { useDefaultLocale, useLocaleProperties, useLocales } from 'gt-react';\n\n// ===== gt-react Functions ===== //\nexport {\n decodeMsg,\n decodeOptions,\n decodeVars,\n declareVar,\n derive,\n getDefaultLocale,\n getLocaleProperties,\n getLocales,\n resolveCanonicalLocale,\n getVersionId,\n gtFallback,\n mFallback,\n msg,\n} from 'gt-react';\nexport { isLocaleSupported } from './request/localeValidation';\n\n// ===== Types ===== //\nexport type { GTTranslationOptions, RuntimeTranslationOptions } from 'gt-react';\nexport type { WithGTServerSideProps, WithGTStaticProps };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAkBA,oBAAoB;;;;;AAmCpB,SAAgB,wBAAwB,GAAW;AACjD,OAAM,IAAI,MAAM,gCAAgC;;;;;;AAOlD,SAAgB,YAGd,GAAuD;AACvD,OAAM,IAAI,MAAM,wDAAwD;;;;;;AAO1E,SAAgB,sBAKd,GACmE;AACnE,OAAM,IAAI,MACR,kEACD;;;;;;AAOH,MAAa,0BAAqD;AAChE,OAAM,IAAI,MAAM,0BAA0B"}
@@ -6,6 +6,7 @@ export type { WithGTStaticProps } from './pages-dir/withGTStaticProps';
6
6
  export { Branch, Currency, DateTime, Derive, GTProvider, GtInternalTranslateJsx, GtInternalVar, T, LocaleSelector, Num, Plural, RegionSelector, RelativeTime, Var, } from 'gt-react';
7
7
  export { useDefaultLocale, useGT, useLocaleDirection, useLocales, useLocaleProperties, useLocaleSelector, useLocale, useMessages, useRegion, useSetLocale, useTranslations, } from 'gt-react';
8
8
  export { decodeMsg, decodeOptions, decodeVars, declareVar, derive, getDefaultLocale, getLocaleProperties, getLocales, resolveCanonicalLocale, getTranslationsSnapshot, getVersionId, gtFallback, mFallback, msg, } from 'gt-react';
9
+ export { useLocalizeHref } from './link/useLocalizeHref';
9
10
  export { isLocaleSupported } from './request/localeValidation';
10
11
  export type { GTTranslationOptions, RuntimeTranslationOptions } from 'gt-react';
11
12
  //# sourceMappingURL=index.server.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.server.d.ts","sourceRoot":"","sources":["../src/index.server.ts"],"names":[],"mappings":"AAaA,OA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AAClE,YAAY,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAGvE,OAAO,EACL,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,UAAU,EACV,sBAAsB,EACtB,aAAa,EACb,CAAC,EACD,cAAc,EACd,GAAG,EACH,MAAM,EACN,cAAc,EACd,YAAY,EACZ,GAAG,GACJ,MAAM,UAAU,CAAC;AAGlB,OAAO,EACL,gBAAgB,EAChB,KAAK,EACL,kBAAkB,EAClB,UAAU,EACV,mBAAmB,EACnB,iBAAiB,EACjB,SAAS,EACT,WAAW,EACX,SAAS,EACT,YAAY,EACZ,eAAe,GAChB,MAAM,UAAU,CAAC;AAGlB,OAAO,EACL,SAAS,EACT,aAAa,EACb,UAAU,EACV,UAAU,EACV,MAAM,EACN,gBAAgB,EAChB,mBAAmB,EACnB,UAAU,EACV,sBAAsB,EACtB,uBAAuB,EACvB,YAAY,EACZ,UAAU,EACV,SAAS,EACT,GAAG,GACJ,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAG/D,YAAY,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC"}
@@ -1,6 +1,7 @@
1
1
  "use client";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  require("./_virtual/_rolldown/runtime.js");
4
+ const require_link_useLocalizeHref = require("./link/useLocalizeHref.js");
4
5
  const require_request_localeValidation = require("./request/localeValidation.js");
5
6
  const require_setup_initGT = require("./setup/initGT.js");
6
7
  const require_pages_dir_parseLocale = require("./pages-dir/parseLocale.js");
@@ -229,6 +230,7 @@ Object.defineProperty(exports, "useLocales", {
229
230
  return gt_react.useLocales;
230
231
  }
231
232
  });
233
+ exports.useLocalizeHref = require_link_useLocalizeHref.useLocalizeHref;
232
234
  Object.defineProperty(exports, "useMessages", {
233
235
  enumerable: true,
234
236
  get: function() {
@@ -1 +1 @@
1
- {"version":3,"file":"index.server.js","names":["initializeGT"],"sources":["../src/index.server.ts"],"sourcesContent":["'use client';\n\nimport { initializeGT } from './setup/initGT';\n/**\n * No initializeGTServer() here because we do not want to\n * initialize the AsyncConditionStore on the server side.\n *\n * No initializeGTClient() here because we do want to enforce\n * expiry times here.\n */\ninitializeGT();\n\n// ===== Pages Router ===== //\nexport { parseLocale } from './pages-dir/parseLocale';\nexport { withGTServerSideProps } from './pages-dir/withGTServerSideProps';\nexport type { WithGTServerSideProps } from './pages-dir/withGTServerSideProps';\nexport { withGTStaticProps } from './pages-dir/withGTStaticProps';\nexport type { WithGTStaticProps } from './pages-dir/withGTStaticProps';\n\n// ===== Components ===== //\nexport {\n Branch,\n Currency,\n DateTime,\n Derive,\n GTProvider,\n GtInternalTranslateJsx,\n GtInternalVar,\n T,\n LocaleSelector,\n Num,\n Plural,\n RegionSelector,\n RelativeTime,\n Var,\n} from 'gt-react';\n\n// ===== Hooks ===== //\nexport {\n useDefaultLocale,\n useGT,\n useLocaleDirection,\n useLocales,\n useLocaleProperties,\n useLocaleSelector,\n useLocale,\n useMessages,\n useRegion,\n useSetLocale,\n useTranslations,\n} from 'gt-react';\n\n// ===== Functions ===== //\nexport {\n decodeMsg,\n decodeOptions,\n decodeVars,\n declareVar,\n derive,\n getDefaultLocale,\n getLocaleProperties,\n getLocales,\n resolveCanonicalLocale,\n getTranslationsSnapshot,\n getVersionId,\n gtFallback,\n mFallback,\n msg,\n} from 'gt-react';\nexport { isLocaleSupported } from './request/localeValidation';\n\n// ===== Types ===== //\nexport type { GTTranslationOptions, RuntimeTranslationOptions } from 'gt-react';\n"],"mappings":";;;;;;;;;;;;;;;;;AAUAA,qBAAAA,cAAc"}
1
+ {"version":3,"file":"index.server.js","names":["initializeGT"],"sources":["../src/index.server.ts"],"sourcesContent":["'use client';\n\nimport { initializeGT } from './setup/initGT';\n/**\n * No initializeGTServer() here because we do not want to\n * initialize the AsyncConditionStore on the server side.\n *\n * No initializeGTClient() here because we do want to enforce\n * expiry times here.\n */\ninitializeGT();\n\n// ===== Pages Router ===== //\nexport { parseLocale } from './pages-dir/parseLocale';\nexport { withGTServerSideProps } from './pages-dir/withGTServerSideProps';\nexport type { WithGTServerSideProps } from './pages-dir/withGTServerSideProps';\nexport { withGTStaticProps } from './pages-dir/withGTStaticProps';\nexport type { WithGTStaticProps } from './pages-dir/withGTStaticProps';\n\n// ===== Components ===== //\nexport {\n Branch,\n Currency,\n DateTime,\n Derive,\n GTProvider,\n GtInternalTranslateJsx,\n GtInternalVar,\n T,\n LocaleSelector,\n Num,\n Plural,\n RegionSelector,\n RelativeTime,\n Var,\n} from 'gt-react';\n\n// ===== Hooks ===== //\nexport {\n useDefaultLocale,\n useGT,\n useLocaleDirection,\n useLocales,\n useLocaleProperties,\n useLocaleSelector,\n useLocale,\n useMessages,\n useRegion,\n useSetLocale,\n useTranslations,\n} from 'gt-react';\n\n// ===== Functions ===== //\nexport {\n decodeMsg,\n decodeOptions,\n decodeVars,\n declareVar,\n derive,\n getDefaultLocale,\n getLocaleProperties,\n getLocales,\n resolveCanonicalLocale,\n getTranslationsSnapshot,\n getVersionId,\n gtFallback,\n mFallback,\n msg,\n} from 'gt-react';\nexport { useLocalizeHref } from './link/useLocalizeHref';\nexport { isLocaleSupported } from './request/localeValidation';\n\n// ===== Types ===== //\nexport type { GTTranslationOptions, RuntimeTranslationOptions } from 'gt-react';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAUAA,qBAAAA,cAAc"}
@@ -1,4 +1,5 @@
1
1
  "use client";
2
+ import { useLocalizeHref } from "./link/useLocalizeHref.mjs";
2
3
  import { isLocaleSupported } from "./request/localeValidation.mjs";
3
4
  import { initializeGT } from "./setup/initGT.mjs";
4
5
  import { parseLocale } from "./pages-dir/parseLocale.mjs";
@@ -15,6 +16,6 @@ import { Branch, Currency, DateTime, Derive, GTProvider, GtInternalTranslateJsx,
15
16
  */
16
17
  initializeGT();
17
18
  //#endregion
18
- export { Branch, Currency, DateTime, Derive, GTProvider, GtInternalTranslateJsx, GtInternalVar, LocaleSelector, Num, Plural, RegionSelector, RelativeTime, T, Var, declareVar, decodeMsg, decodeOptions, decodeVars, derive, getDefaultLocale, getLocaleProperties, getLocales, getTranslationsSnapshot, getVersionId, gtFallback, isLocaleSupported, mFallback, msg, parseLocale, resolveCanonicalLocale, useDefaultLocale, useGT, useLocale, useLocaleDirection, useLocaleProperties, useLocaleSelector, useLocales, useMessages, useRegion, useSetLocale, useTranslations, withGTServerSideProps, withGTStaticProps };
19
+ export { Branch, Currency, DateTime, Derive, GTProvider, GtInternalTranslateJsx, GtInternalVar, LocaleSelector, Num, Plural, RegionSelector, RelativeTime, T, Var, declareVar, decodeMsg, decodeOptions, decodeVars, derive, getDefaultLocale, getLocaleProperties, getLocales, getTranslationsSnapshot, getVersionId, gtFallback, isLocaleSupported, mFallback, msg, parseLocale, resolveCanonicalLocale, useDefaultLocale, useGT, useLocale, useLocaleDirection, useLocaleProperties, useLocaleSelector, useLocales, useLocalizeHref, useMessages, useRegion, useSetLocale, useTranslations, withGTServerSideProps, withGTStaticProps };
19
20
 
20
21
  //# sourceMappingURL=index.server.mjs.map