gt-next 11.0.13 → 11.1.1

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 (74) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/dist/config.d.ts.map +1 -1
  3. package/dist/config.js +28 -3
  4. package/dist/config.js.map +1 -1
  5. package/dist/config.mjs +28 -3
  6. package/dist/config.mjs.map +1 -1
  7. package/dist/errors/client.d.ts +2 -0
  8. package/dist/errors/client.d.ts.map +1 -0
  9. package/dist/errors/client.js +13 -0
  10. package/dist/errors/client.js.map +1 -0
  11. package/dist/errors/client.mjs +12 -0
  12. package/dist/errors/client.mjs.map +1 -0
  13. package/dist/errors/createErrors.d.ts +0 -6
  14. package/dist/errors/createErrors.d.ts.map +1 -1
  15. package/dist/errors/createErrors.js +0 -41
  16. package/dist/errors/createErrors.js.map +1 -1
  17. package/dist/errors/createErrors.mjs +2 -35
  18. package/dist/errors/createErrors.mjs.map +1 -1
  19. package/dist/errors/loaders.d.ts +3 -0
  20. package/dist/errors/loaders.d.ts.map +1 -0
  21. package/dist/errors/loaders.js +18 -0
  22. package/dist/errors/loaders.js.map +1 -0
  23. package/dist/errors/loaders.mjs +16 -0
  24. package/dist/errors/loaders.mjs.map +1 -0
  25. package/dist/errors/middleware.d.ts +2 -0
  26. package/dist/errors/middleware.d.ts.map +1 -0
  27. package/dist/errors/middleware.js +12 -0
  28. package/dist/errors/middleware.js.map +1 -0
  29. package/dist/errors/middleware.mjs +10 -0
  30. package/dist/errors/middleware.mjs.map +1 -0
  31. package/dist/errors/pathRegex.d.ts +2 -0
  32. package/dist/errors/pathRegex.d.ts.map +1 -0
  33. package/dist/errors/pathRegex.js +15 -0
  34. package/dist/errors/pathRegex.js.map +1 -0
  35. package/dist/errors/pathRegex.mjs +12 -0
  36. package/dist/errors/pathRegex.mjs.map +1 -0
  37. package/dist/errors/request.d.ts +2 -0
  38. package/dist/errors/request.d.ts.map +1 -0
  39. package/dist/errors/request.js +13 -0
  40. package/dist/errors/request.js.map +1 -0
  41. package/dist/errors/request.mjs +12 -0
  42. package/dist/errors/request.mjs.map +1 -0
  43. package/dist/index.client.js +2 -2
  44. package/dist/index.client.js.map +1 -1
  45. package/dist/index.client.mjs +2 -2
  46. package/dist/index.client.mjs.map +1 -1
  47. package/dist/middleware-dir/createNextMiddleware.js +2 -2
  48. package/dist/middleware-dir/createNextMiddleware.js.map +1 -1
  49. package/dist/middleware-dir/createNextMiddleware.mjs +1 -1
  50. package/dist/middleware-dir/createNextMiddleware.mjs.map +1 -1
  51. package/dist/request/localeValidation.js +2 -2
  52. package/dist/request/localeValidation.js.map +1 -1
  53. package/dist/request/localeValidation.mjs +1 -1
  54. package/dist/request/localeValidation.mjs.map +1 -1
  55. package/dist/resolvers/resolveDictionaryLoader.d.ts.map +1 -1
  56. package/dist/resolvers/resolveDictionaryLoader.js +4 -3
  57. package/dist/resolvers/resolveDictionaryLoader.js.map +1 -1
  58. package/dist/resolvers/resolveDictionaryLoader.mjs +2 -1
  59. package/dist/resolvers/resolveDictionaryLoader.mjs.map +1 -1
  60. package/dist/resolvers/resolveTranslationLoader.d.ts.map +1 -1
  61. package/dist/resolvers/resolveTranslationLoader.js +4 -3
  62. package/dist/resolvers/resolveTranslationLoader.js.map +1 -1
  63. package/dist/resolvers/resolveTranslationLoader.mjs +2 -1
  64. package/dist/resolvers/resolveTranslationLoader.mjs.map +1 -1
  65. package/dist/setup/shared.d.ts.map +1 -1
  66. package/dist/setup/shared.js +18 -19
  67. package/dist/setup/shared.js.map +1 -1
  68. package/dist/setup/shared.mjs +18 -19
  69. package/dist/setup/shared.mjs.map +1 -1
  70. package/dist/utils/pathRegex.js +2 -2
  71. package/dist/utils/pathRegex.js.map +1 -1
  72. package/dist/utils/pathRegex.mjs +1 -1
  73. package/dist/utils/pathRegex.mjs.map +1 -1
  74. package/package.json +8 -8
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.mjs","names":[],"sources":["../../src/errors/client.ts"],"sourcesContent":["import { createGtNextDiagnostic } from './diagnostics';\n\nexport const createWithGTStaticPropsClientError = () =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'withGTStaticProps() cannot run in the browser',\n why: 'Static props are generated on the server by the Pages Router',\n fix: 'Export withGTStaticProps() from a Pages Router page module',\n });\n"],"mappings":";;AAEA,MAAa,2CACX,uBAAuB;CACrB,UAAU;CACV,cAAc;CACd,KAAK;CACL,KAAK;CACN,CAAC"}
@@ -5,21 +5,15 @@ export declare const createUnresolvedNextVersionError: (error: Error) => string;
5
5
  export declare const createUnresolvedReactVersionError: (error: Error) => string;
6
6
  export declare const devApiKeyIncludedInProductionError: string;
7
7
  export declare const createDictionarySubsetError: (id: string, functionName: string) => string;
8
- export declare const unresolvedCustomLoadDictionaryError: string;
9
- export declare const unresolvedCustomLoadTranslationsError: string;
10
8
  export declare const unresolvedLoadDictionaryBuildError: (path: string) => string;
11
9
  export declare const unresolvedLoadTranslationsBuildError: (path: string) => string;
12
10
  export declare const conflictingConfigurationBuildError: (conflicts: string[]) => string;
13
11
  export declare const typesFileError: string;
14
12
  export declare const getTranslationsSnapshotRscError: string;
15
- export declare const withGTStaticPropsClientError: string;
16
13
  export declare const withGTStaticPropsRscError: string;
17
14
  export declare const invalidLocalesError: (locales: string[]) => string;
18
15
  export declare const invalidCanonicalLocalesError: (locales: string[]) => string;
19
- export declare const createInvalidRequestLocaleWarning: (locale: string, defaultLocale: string) => string;
20
- export declare const createInvalidPathRegexError: (pathRegex: string, error: unknown) => string;
21
16
  export declare const createBadFilepathWarning: (filename: string, dir: string[]) => string;
22
- export declare const createUnsupportedLocalesWarning: (locales: string[]) => string;
23
17
  export declare const projectIdMissingWarn: string;
24
18
  export declare const APIKeyMissingWarn: string;
25
19
  export declare const standardizedLocalesWarning: (locales: string[]) => string;
@@ -1 +1 @@
1
- {"version":3,"file":"createErrors.d.ts","sourceRoot":"","sources":["../../src/errors/createErrors.ts"],"names":[],"mappings":"AAUA,eAAO,MA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,MAAM,cAAc,QAIzB,CAAC;AAEH,eAAO,MAAM,+BAA+B,QAK1C,CAAC;AAEH,eAAO,MAAM,yBAAyB,QAMpC,CAAC;AAEH,eAAO,MAAM,mBAAmB,GAAI,SAAS,MAAM,EAAE,WAMjD,CAAC;AAEL,eAAO,MAAM,4BAA4B,GAAI,SAAS,MAAM,EAAE,WAM1D,CAAC;AAIL,eAAO,MAAM,wBAAwB,GAAI,UAAU,MAAM,EAAE,KAAK,MAAM,EAAE,WAIpE,CAAC;AAEL,eAAO,MAAM,oBAAoB,QAI/B,CAAC;AAEH,eAAO,MAAM,iBAAiB,QAG5B,CAAC;AAEH,eAAO,MAAM,0BAA0B,GAAI,SAAS,MAAM,EAAE,WACiF,CAAC;AAE9I,eAAO,MAAM,mCAAmC,GAAI,SAAS,MAAM,EAAE,WACkF,CAAC;AAExJ,eAAO,MAAM,iCAAiC,GAAI,MAAM,OAAO,GAAG,KAAK,WAOnE,CAAC;AAEL,eAAO,MAAM,+BAA+B,QAK1C,CAAC;AAEH,eAAO,MAAM,gCAAgC,QAI3C,CAAC;AAEH,eAAO,MAAM,gCAAgC,QAI3C,CAAC;AAEH,eAAO,MAAM,kCAAkC,GAAI,MAAM,OAAO,GAAG,KAAK,4NAGyD,CAAC;AAElI,eAAO,MAAM,wCAAwC,QAE8C,CAAC;AAEpG,eAAO,MAAM,+BAA+B,0FAA0F,CAAC;AAEvI,eAAO,MAAM,mCAAmC,0JAAyK,CAAC"}
@@ -1,9 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- require("../_virtual/_rolldown/runtime.js");
3
2
  const require_errors_diagnostics = require("./diagnostics.js");
4
3
  const require_plugin_constants = require("../plugin/constants.js");
5
- let _generaltranslation_format = require("@generaltranslation/format");
6
- let generaltranslation_internal = require("generaltranslation/internal");
7
4
  //#region src/errors/createErrors.ts
8
5
  const remoteTranslationsError = require_errors_diagnostics.createGtNextDiagnostic({
9
6
  severity: "Error",
@@ -43,16 +40,6 @@ const createDictionarySubsetError = (id, functionName) => require_errors_diagnos
43
40
  whatHappened: `${functionName} with id "${id}" could not read a valid dictionary subtree`,
44
41
  fix: "Make sure the id maps to the correct subroute of the dictionary"
45
42
  });
46
- const unresolvedCustomLoadDictionaryError = require_errors_diagnostics.createGtNextDiagnostic({
47
- severity: "Error",
48
- whatHappened: "loadDictionary() was found during the build but could not be resolved at runtime",
49
- fix: "Export a loadDictionary() function from the configured file"
50
- });
51
- const unresolvedCustomLoadTranslationsError = require_errors_diagnostics.createGtNextDiagnostic({
52
- severity: "Error",
53
- whatHappened: "loadTranslations() was found during the build but could not be resolved at runtime",
54
- fix: "Export a loadTranslations() function from the configured file"
55
- });
56
43
  const unresolvedLoadDictionaryBuildError = (path) => require_errors_diagnostics.createGtNextDiagnostic({
57
44
  severity: "Error",
58
45
  whatHappened: `The file defining loadDictionary() could not be resolved at ${path}`,
@@ -74,12 +61,6 @@ const getTranslationsSnapshotRscError = require_errors_diagnostics.createGtNextD
74
61
  whatHappened: "getTranslationsSnapshot() is not available for React Server Components",
75
62
  fix: "Use gt-next build-time translation helpers in the App Router, or call getTranslationsSnapshot() from a Pages Router entry point"
76
63
  });
77
- const withGTStaticPropsClientError = require_errors_diagnostics.createGtNextDiagnostic({
78
- severity: "Error",
79
- whatHappened: "withGTStaticProps() cannot run in the browser",
80
- why: "Static props are generated on the server by the Pages Router",
81
- fix: "Export withGTStaticProps() from a Pages Router page module"
82
- });
83
64
  const withGTStaticPropsRscError = require_errors_diagnostics.createGtNextDiagnostic({
84
65
  severity: "Error",
85
66
  whatHappened: "withGTStaticProps() is not available for React Server Components",
@@ -98,26 +79,10 @@ const invalidCanonicalLocalesError = (locales) => require_errors_diagnostics.cre
98
79
  fix: "Use valid BCP 47 locale codes before starting translation",
99
80
  details: locales
100
81
  });
101
- const createInvalidRequestLocaleWarning = (locale, defaultLocale) => require_errors_diagnostics.createGtNextDiagnostic({
102
- severity: "Warning",
103
- whatHappened: `Locale "${locale}" is not valid or is not supported by this app`,
104
- wayOut: `The default locale "${defaultLocale}" will be used for this request`,
105
- fix: "Use a valid BCP 47 locale code, add a custom mapping, or configure the locale in gt-next"
106
- });
107
- const createInvalidPathRegexError = (pathRegex, error) => require_errors_diagnostics.createGtNextDiagnostic({
108
- severity: "Error",
109
- whatHappened: `pathRegex "${pathRegex}" is not a valid regular expression`,
110
- fix: "Pass a valid JavaScript regular expression string to withGTConfig()",
111
- details: (0, generaltranslation_internal.formatDiagnosticErrorDetails)(error)
112
- });
113
82
  const createBadFilepathWarning = (filename, dir) => require_errors_diagnostics.createGtNextDiagnostic({
114
83
  whatHappened: `${filename} was found in ${dir.join(" or ")}, which is not supported`,
115
84
  fix: "Move it to your project root so gt-next can load it"
116
85
  });
117
- const createUnsupportedLocalesWarning = (locales) => `gt-next: The following locales are currently unsupported by our service: ${locales.map((locale) => {
118
- const { name } = (0, _generaltranslation_format.getLocaleProperties)(locale);
119
- return `${locale} (${name})`;
120
- }).join(", ")}`;
121
86
  const projectIdMissingWarn = require_errors_diagnostics.createGtNextDiagnostic({
122
87
  whatHappened: "Runtime translation needs a project ID",
123
88
  fix: "Set GT_PROJECT_ID in your environment or pass projectId to withGTConfig()",
@@ -163,11 +128,8 @@ exports.createBadFilepathWarning = createBadFilepathWarning;
163
128
  exports.createDictionarySubsetError = createDictionarySubsetError;
164
129
  exports.createGTCompilerUnavailableWarning = createGTCompilerUnavailableWarning;
165
130
  exports.createGTCompilerUnresolvedWarning = createGTCompilerUnresolvedWarning;
166
- exports.createInvalidPathRegexError = createInvalidPathRegexError;
167
- exports.createInvalidRequestLocaleWarning = createInvalidRequestLocaleWarning;
168
131
  exports.createUnresolvedNextVersionError = createUnresolvedNextVersionError;
169
132
  exports.createUnresolvedReactVersionError = createUnresolvedReactVersionError;
170
- exports.createUnsupportedLocalesWarning = createUnsupportedLocalesWarning;
171
133
  exports.customGetLocaleUnresolvedWarning = customGetLocaleUnresolvedWarning;
172
134
  exports.customGetRegionUnresolvedWarning = customGetRegionUnresolvedWarning;
173
135
  exports.customLoadDictionaryWarning = customLoadDictionaryWarning;
@@ -183,11 +145,8 @@ exports.standardizedCanonicalLocalesWarning = standardizedCanonicalLocalesWarnin
183
145
  exports.standardizedLocalesWarning = standardizedLocalesWarning;
184
146
  exports.swcPluginCompatibilityChangeWarning = swcPluginCompatibilityChangeWarning;
185
147
  exports.typesFileError = typesFileError;
186
- exports.unresolvedCustomLoadDictionaryError = unresolvedCustomLoadDictionaryError;
187
- exports.unresolvedCustomLoadTranslationsError = unresolvedCustomLoadTranslationsError;
188
148
  exports.unresolvedLoadDictionaryBuildError = unresolvedLoadDictionaryBuildError;
189
149
  exports.unresolvedLoadTranslationsBuildError = unresolvedLoadTranslationsBuildError;
190
- exports.withGTStaticPropsClientError = withGTStaticPropsClientError;
191
150
  exports.withGTStaticPropsRscError = withGTStaticPropsRscError;
192
151
 
193
152
  //# sourceMappingURL=createErrors.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"createErrors.js","names":["createGtNextDiagnostic","createGtNextPluginDiagnostic","SWC_PLUGIN_SUPPORT","BABEL_PLUGIN_SUPPORT"],"sources":["../../src/errors/createErrors.ts"],"sourcesContent":["// ---- ERRORS ---- //\n\nimport { getLocaleProperties } from '@generaltranslation/format';\nimport {\n createGtNextDiagnostic,\n createGtNextPluginDiagnostic,\n formatDiagnosticErrorDetails,\n} from './diagnostics';\nimport { BABEL_PLUGIN_SUPPORT, SWC_PLUGIN_SUPPORT } from '../plugin/constants';\n\nexport const remoteTranslationsError = createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'Remote translations could not be loaded',\n fix: 'Check your project ID, API key, and network connection, then try again',\n wayOut: 'Source content will render as a fallback',\n});\n\nexport const customLoadTranslationsError = (locale: string = '') =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: `Locally stored translations could not be loaded${locale ? ` for \"${locale}\"` : ''}`,\n fix: 'If you use loadTranslations(), make sure it returns translations for the requested locale',\n });\n\nexport const customLoadDictionaryWarning = (locale: string = '') =>\n createGtNextDiagnostic({\n severity: 'Warning',\n whatHappened: `The local dictionary could not be loaded${locale ? ` for \"${locale}\"` : ''}`,\n fix: 'If you use loadDictionary(), make sure it returns a dictionary for the requested locale',\n });\n\nexport const createUnresolvedNextVersionError = (error: Error) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'The installed Next.js version could not be resolved',\n fix: 'Check that next is installed in this project',\n details: error.message,\n });\n\nexport const createUnresolvedReactVersionError = (error: Error) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'The installed React version could not be resolved',\n fix: 'Check that react is installed in this project',\n details: error.message,\n });\n\nexport const devApiKeyIncludedInProductionError = createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'Production builds cannot use a development API key',\n fix: 'Replace it with a production API key',\n});\n\nexport const createDictionarySubsetError = (id: string, functionName: string) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: `${functionName} with id \"${id}\" could not read a valid dictionary subtree`,\n fix: 'Make sure the id maps to the correct subroute of the dictionary',\n });\n\nexport const unresolvedCustomLoadDictionaryError = createGtNextDiagnostic({\n severity: 'Error',\n whatHappened:\n 'loadDictionary() was found during the build but could not be resolved at runtime',\n fix: 'Export a loadDictionary() function from the configured file',\n});\n\nexport const unresolvedCustomLoadTranslationsError = createGtNextDiagnostic({\n severity: 'Error',\n whatHappened:\n 'loadTranslations() was found during the build but could not be resolved at runtime',\n fix: 'Export a loadTranslations() function from the configured file',\n});\n\nexport const unresolvedLoadDictionaryBuildError = (path: string) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: `The file defining loadDictionary() could not be resolved at ${path}`,\n fix: 'Check the configured path and try again',\n });\n\nexport const unresolvedLoadTranslationsBuildError = (path: string) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: `The file defining loadTranslations() could not be resolved at ${path}`,\n fix: 'Check the configured path and try again',\n });\n\nexport const conflictingConfigurationBuildError = (conflicts: string[]) =>\n `gt-next Error: Conflicting configuration${\n conflicts.length > 1 ? 's' : ''\n } detected. Resolve the following conflicts before building your app:\\n${conflicts.join(\n '\\n'\n )}`;\n\nexport const typesFileError = createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'A types-only entry point was executed at runtime',\n fix: 'Import from the appropriate gt-next runtime entry point instead',\n});\n\nexport const getTranslationsSnapshotRscError = createGtNextDiagnostic({\n severity: 'Error',\n whatHappened:\n 'getTranslationsSnapshot() is not available for React Server Components',\n fix: 'Use gt-next build-time translation helpers in the App Router, or call getTranslationsSnapshot() from a Pages Router entry point',\n});\n\nexport const withGTStaticPropsClientError = createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'withGTStaticProps() cannot run in the browser',\n why: 'Static props are generated on the server by the Pages Router',\n fix: 'Export withGTStaticProps() from a Pages Router page module',\n});\n\nexport const withGTStaticPropsRscError = createGtNextDiagnostic({\n severity: 'Error',\n whatHappened:\n 'withGTStaticProps() is not available for React Server Components',\n why: 'This helper supports the Pages Router, not the App Router',\n fix: 'Use gt-next build-time translation helpers in the App Router, or export withGTStaticProps() from a Pages Router page module',\n});\n\nexport const invalidLocalesError = (locales: string[]) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'Invalid locale codes in your configuration',\n fix: 'Specify a list of valid locales or use \"customMapping\" to define aliases for the invalid locales',\n details: locales,\n });\n\nexport const invalidCanonicalLocalesError = (locales: string[]) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'Invalid canonical locale codes in your configuration',\n fix: 'Use valid BCP 47 locale codes before starting translation',\n details: locales,\n });\n\nexport const createInvalidRequestLocaleWarning = (\n locale: string,\n defaultLocale: string\n) =>\n createGtNextDiagnostic({\n severity: 'Warning',\n whatHappened: `Locale \"${locale}\" is not valid or is not supported by this app`,\n wayOut: `The default locale \"${defaultLocale}\" will be used for this request`,\n fix: 'Use a valid BCP 47 locale code, add a custom mapping, or configure the locale in gt-next',\n });\n\nexport const createInvalidPathRegexError = (\n pathRegex: string,\n error: unknown\n) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: `pathRegex \"${pathRegex}\" is not a valid regular expression`,\n fix: 'Pass a valid JavaScript regular expression string to withGTConfig()',\n details: formatDiagnosticErrorDetails(error),\n });\n\n// ---- WARNINGS ---- //\n\nexport const createBadFilepathWarning = (filename: string, dir: string[]) =>\n createGtNextDiagnostic({\n whatHappened: `${filename} was found in ${dir.join(' or ')}, which is not supported`,\n fix: 'Move it to your project root so gt-next can load it',\n });\n\nexport const 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 projectIdMissingWarn = createGtNextDiagnostic({\n whatHappened: 'Runtime translation needs a project ID',\n fix: 'Set GT_PROJECT_ID in your environment or pass projectId to withGTConfig()',\n docsUrl: 'https://generaltranslation.com/dashboard',\n});\n\nexport const APIKeyMissingWarn = createGtNextPluginDiagnostic({\n whatHappened: 'Runtime translation needs a development API key',\n fix: 'Find your development API key at generaltranslation.com/dashboard, or set runtimeUrl to an empty string to disable runtime translation',\n});\n\nexport const standardizedLocalesWarning = (locales: string[]) =>\n `gt-next: The following locales were standardized: ${locales.join(', ')}. Use the standardized codes in your config to avoid this warning.`;\n\nexport const standardizedCanonicalLocalesWarning = (locales: string[]) =>\n `gt-next: The following canonical locales were standardized: ${locales.join(', ')}. Use the standardized codes in your config to avoid this warning.`;\n\nexport const createGTCompilerUnresolvedWarning = (type: 'babel' | 'swc') =>\n createGtNextPluginDiagnostic({\n whatHappened: `The GT ${type} compiler could not be resolved`,\n wayOut: 'Skipping compiler optimizations',\n ...(type === 'babel' && {\n fix: 'Install @generaltranslation/compiler to enable the experimental babel compiler',\n }),\n });\n\nexport const autoJsxInjectionCompilerWarning = createGtNextPluginDiagnostic({\n severity: 'Warning',\n whatHappened: 'Automatic JSX injection requires the GT webpack compiler',\n wayOut: 'Automatic JSX injection will be skipped',\n fix: \"Set experimentalCompilerOptions.type to 'babel' in withGTConfig() and build with webpack\",\n});\n\nexport const customGetLocaleUnresolvedWarning = createGtNextDiagnostic({\n whatHappened: 'Custom getLocale() could not be resolved',\n wayOut: 'gt-next will fall back to default locale detection',\n fix: 'Export a getLocale() function from the configured request file',\n});\n\nexport const customGetRegionUnresolvedWarning = createGtNextDiagnostic({\n whatHappened: 'Custom getRegion() could not be resolved',\n wayOut: 'gt-next will fall back to default region detection',\n fix: 'Export a getRegion() function from the configured request file',\n});\n\nexport const createGTCompilerUnavailableWarning = (type: 'babel' | 'swc') =>\n type === 'swc'\n ? `gt-next (plugin): The GT swc compiler is compatible with < next@${SWC_PLUGIN_SUPPORT}. Skipping compiler optimizations.`\n : `gt-next (plugin): The GT babel compiler requires react@${BABEL_PLUGIN_SUPPORT} or newer. Skipping compiler optimizations.`;\n\nexport const babelCompilerTurbopackUnavailableWarning =\n `gt-next (plugin): The GT babel compiler is not compatible with Turbopack. ` +\n `To use compiler optimizations with Turbopack, set experimentalCompilerOptions: { type: 'swc' }.`;\n\nexport const disablingCompileTimeHashWarning = `gt-next (plugin): Compile-time hash is disabled. Compiler optimizations are inactive.`;\n\nexport const swcPluginCompatibilityChangeWarning = `gt-next (plugin): As of gt-next@6.12.4, SWC plugin support is disabled for Next.js versions prior to ${SWC_PLUGIN_SUPPORT}. Update to the latest version of Next.js.`;\n"],"mappings":";;;;;;;AAUA,MAAa,0BAA0BA,2BAAAA,uBAAuB;CAC5D,UAAU;CACV,cAAc;CACd,KAAK;CACL,QAAQ;CACT,CAAC;AAEF,MAAa,+BAA+B,SAAiB,OAC3DA,2BAAAA,uBAAuB;CACrB,UAAU;CACV,cAAc,kDAAkD,SAAS,SAAS,OAAO,KAAK;CAC9F,KAAK;CACN,CAAC;AAEJ,MAAa,+BAA+B,SAAiB,OAC3DA,2BAAAA,uBAAuB;CACrB,UAAU;CACV,cAAc,2CAA2C,SAAS,SAAS,OAAO,KAAK;C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MAAa,kCAAkCA,2BAAAA,6BAA6B;CAC1E,UAAU;CACV,cAAc;CACd,QAAQ;CACR,KAAK;CACN,CAAC;AAEF,MAAa,mCAAmCD,2BAAAA,uBAAuB;CACrE,cAAc;CACd,QAAQ;CACR,KAAK;CACN,CAAC;AAEF,MAAa,mCAAmCA,2BAAAA,uBAAuB;CACrE,cAAc;CACd,QAAQ;CACR,KAAK;CACN,CAAC;AAEF,MAAa,sCAAsC,SACjD,SAAS,QACL,mEAAmEE,yBAAAA,mBAAmB,sCACtF,0DAA0DC,yBAAAA,qBAAqB;AAErF,MAAa,2CACX;AAGF,MAAa,kCAAkC;AAE/C,MAAa,sCAAsC,wGAAwGD,yBAAAA,mBAAmB"}
1
+ {"version":3,"file":"createErrors.js","names":["createGtNextDiagnostic","createGtNextPluginDiagnostic","SWC_PLUGIN_SUPPORT","BABEL_PLUGIN_SUPPORT"],"sources":["../../src/errors/createErrors.ts"],"sourcesContent":["// ---- ERRORS ---- //\n\nimport {\n createGtNextDiagnostic,\n createGtNextPluginDiagnostic,\n} from './diagnostics';\nimport { BABEL_PLUGIN_SUPPORT, SWC_PLUGIN_SUPPORT } from '../plugin/constants';\n\nexport const remoteTranslationsError = createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'Remote translations could not be loaded',\n fix: 'Check your project ID, API key, and network connection, then try again',\n wayOut: 'Source content will render as a fallback',\n});\n\nexport const customLoadTranslationsError = (locale: string = '') =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: `Locally stored translations could not be loaded${locale ? ` for \"${locale}\"` : ''}`,\n fix: 'If you use loadTranslations(), make sure it returns translations for the requested locale',\n });\n\nexport const customLoadDictionaryWarning = (locale: string = '') =>\n createGtNextDiagnostic({\n severity: 'Warning',\n whatHappened: `The local dictionary could not be loaded${locale ? ` for \"${locale}\"` : ''}`,\n fix: 'If you use loadDictionary(), make sure it returns a dictionary for the requested locale',\n });\n\nexport const createUnresolvedNextVersionError = (error: Error) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'The installed Next.js version could not be resolved',\n fix: 'Check that next is installed in this project',\n details: error.message,\n });\n\nexport const createUnresolvedReactVersionError = (error: Error) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'The installed React version could not be resolved',\n fix: 'Check that react is installed in this project',\n details: error.message,\n });\n\nexport const devApiKeyIncludedInProductionError = createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'Production builds cannot use a development API key',\n fix: 'Replace it with a production API key',\n});\n\nexport const createDictionarySubsetError = (id: string, functionName: string) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: `${functionName} with id \"${id}\" could not read a valid dictionary subtree`,\n fix: 'Make sure the id maps to the correct subroute of the dictionary',\n });\n\nexport const unresolvedLoadDictionaryBuildError = (path: string) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: `The file defining loadDictionary() could not be resolved at ${path}`,\n fix: 'Check the configured path and try again',\n });\n\nexport const unresolvedLoadTranslationsBuildError = (path: string) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: `The file defining loadTranslations() could not be resolved at ${path}`,\n fix: 'Check the configured path and try again',\n });\n\nexport const conflictingConfigurationBuildError = (conflicts: string[]) =>\n `gt-next Error: Conflicting configuration${\n conflicts.length > 1 ? 's' : ''\n } detected. Resolve the following conflicts before building your app:\\n${conflicts.join(\n '\\n'\n )}`;\n\nexport const typesFileError = createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'A types-only entry point was executed at runtime',\n fix: 'Import from the appropriate gt-next runtime entry point instead',\n});\n\nexport const getTranslationsSnapshotRscError = createGtNextDiagnostic({\n severity: 'Error',\n whatHappened:\n 'getTranslationsSnapshot() is not available for React Server Components',\n fix: 'Use gt-next build-time translation helpers in the App Router, or call getTranslationsSnapshot() from a Pages Router entry point',\n});\n\nexport const withGTStaticPropsRscError = createGtNextDiagnostic({\n severity: 'Error',\n whatHappened:\n 'withGTStaticProps() is not available for React Server Components',\n why: 'This helper supports the Pages Router, not the App Router',\n fix: 'Use gt-next build-time translation helpers in the App Router, or export withGTStaticProps() from a Pages Router page module',\n});\n\nexport const invalidLocalesError = (locales: string[]) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'Invalid locale codes in your configuration',\n fix: 'Specify a list of valid locales or use \"customMapping\" to define aliases for the invalid locales',\n details: locales,\n });\n\nexport const invalidCanonicalLocalesError = (locales: string[]) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'Invalid canonical locale codes in your configuration',\n fix: 'Use valid BCP 47 locale codes before starting translation',\n details: locales,\n });\n\n// ---- WARNINGS ---- //\n\nexport const createBadFilepathWarning = (filename: string, dir: string[]) =>\n createGtNextDiagnostic({\n whatHappened: `${filename} was found in ${dir.join(' or ')}, which is not supported`,\n fix: 'Move it to your project root so gt-next can load it',\n });\n\nexport const projectIdMissingWarn = createGtNextDiagnostic({\n whatHappened: 'Runtime translation needs a project ID',\n fix: 'Set GT_PROJECT_ID in your environment or pass projectId to withGTConfig()',\n docsUrl: 'https://generaltranslation.com/dashboard',\n});\n\nexport const APIKeyMissingWarn = createGtNextPluginDiagnostic({\n whatHappened: 'Runtime translation needs a development API key',\n fix: 'Find your development API key at generaltranslation.com/dashboard, or set runtimeUrl to an empty string to disable runtime translation',\n});\n\nexport const standardizedLocalesWarning = (locales: string[]) =>\n `gt-next: The following locales were standardized: ${locales.join(', ')}. Use the standardized codes in your config to avoid this warning.`;\n\nexport const standardizedCanonicalLocalesWarning = (locales: string[]) =>\n `gt-next: The following canonical locales were standardized: ${locales.join(', ')}. Use the standardized codes in your config to avoid this warning.`;\n\nexport const createGTCompilerUnresolvedWarning = (type: 'babel' | 'swc') =>\n createGtNextPluginDiagnostic({\n whatHappened: `The GT ${type} compiler could not be resolved`,\n wayOut: 'Skipping compiler optimizations',\n ...(type === 'babel' && {\n fix: 'Install @generaltranslation/compiler to enable the experimental babel compiler',\n }),\n });\n\nexport const autoJsxInjectionCompilerWarning = createGtNextPluginDiagnostic({\n severity: 'Warning',\n whatHappened: 'Automatic JSX injection requires the GT webpack compiler',\n wayOut: 'Automatic JSX injection will be skipped',\n fix: \"Set experimentalCompilerOptions.type to 'babel' in withGTConfig() and build with webpack\",\n});\n\nexport const customGetLocaleUnresolvedWarning = createGtNextDiagnostic({\n whatHappened: 'Custom getLocale() could not be resolved',\n wayOut: 'gt-next will fall back to default locale detection',\n fix: 'Export a getLocale() function from the configured request file',\n});\n\nexport const customGetRegionUnresolvedWarning = createGtNextDiagnostic({\n whatHappened: 'Custom getRegion() could not be resolved',\n wayOut: 'gt-next will fall back to default region detection',\n fix: 'Export a getRegion() function from the configured request file',\n});\n\nexport const createGTCompilerUnavailableWarning = (type: 'babel' | 'swc') =>\n type === 'swc'\n ? `gt-next (plugin): The GT swc compiler is compatible with < next@${SWC_PLUGIN_SUPPORT}. Skipping compiler optimizations.`\n : `gt-next (plugin): The GT babel compiler requires react@${BABEL_PLUGIN_SUPPORT} or newer. Skipping compiler optimizations.`;\n\nexport const babelCompilerTurbopackUnavailableWarning =\n `gt-next (plugin): The GT babel compiler is not compatible with Turbopack. ` +\n `To use compiler optimizations with Turbopack, set experimentalCompilerOptions: { type: 'swc' }.`;\n\nexport const disablingCompileTimeHashWarning = `gt-next (plugin): Compile-time hash is disabled. Compiler optimizations are inactive.`;\n\nexport const swcPluginCompatibilityChangeWarning = `gt-next (plugin): As of gt-next@6.12.4, SWC plugin support is disabled for Next.js versions prior to ${SWC_PLUGIN_SUPPORT}. Update to the latest version of Next.js.`;\n"],"mappings":";;;;AAQA,MAAa,0BAA0BA,2BAAAA,uBAAuB;CAC5D,UAAU;CACV,cAAc;CACd,KAAK;CACL,QAAQ;CACT,CAAC;AAEF,MAAa,+BAA+B,SAAiB,OAC3DA,2BAAAA,uBAAuB;CACrB,UAAU;CACV,cAAc,kDAAkD,SAAS,SAAS,OAAO,KAAK;CAC9F,KAAK;CACN,CAAC;AAEJ,MAAa,+BAA+B,SAAiB,OAC3DA,2BAA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Ac;CACd,KAAK;CACL,SAAS;CACV,CAAC;AAIJ,MAAa,4BAA4B,UAAkB,QACzDA,2BAAAA,uBAAuB;CACrB,cAAc,GAAG,SAAS,gBAAgB,IAAI,KAAK,OAAO,CAAC;CAC3D,KAAK;CACN,CAAC;AAEJ,MAAa,uBAAuBA,2BAAAA,uBAAuB;CACzD,cAAc;CACd,KAAK;CACL,SAAS;CACV,CAAC;AAEF,MAAa,oBAAoBC,2BAAAA,6BAA6B;CAC5D,cAAc;CACd,KAAK;CACN,CAAC;AAEF,MAAa,8BAA8B,YACzC,qDAAqD,QAAQ,KAAK,KAAK,CAAC;AAE1E,MAAa,uCAAuC,YAClD,+DAA+D,QAAQ,KAAK,KAAK,CAAC;AAEpF,MAAa,qCAAqC,SAChDA,2BAAAA,6BAA6B;CAC3B,cAAc,UAAU,KAAK;CAC7B,QAAQ;CACR,GAAI,SAAS,WAAW,EACtB,KAAK,kFACN;CACF,CAAC;AAEJ,MAAa,kCAAkCA,2BAAAA,6BAA6B;CAC1E,UAAU;CACV,cAAc;CACd,QAAQ;CACR,KAAK;CACN,CAAC;AAEF,MAAa,mCAAmCD,2BAAAA,uBAAuB;CACrE,cAAc;CACd,QAAQ;CACR,KAAK;CACN,CAAC;AAEF,MAAa,mCAAmCA,2BAAAA,uBAAuB;CACrE,cAAc;CACd,QAAQ;CACR,KAAK;CACN,CAAC;AAEF,MAAa,sCAAsC,SACjD,SAAS,QACL,mEAAmEE,yBAAAA,mBAAmB,sCACtF,0DAA0DC,yBAAAA,qBAAqB;AAErF,MAAa,2CACX;AAGF,MAAa,kCAAkC;AAE/C,MAAa,sCAAsC,wGAAwGD,yBAAAA,mBAAmB"}
@@ -1,6 +1,5 @@
1
- import { createGtNextDiagnostic, createGtNextPluginDiagnostic, formatDiagnosticErrorDetails } from "./diagnostics.mjs";
1
+ import { createGtNextDiagnostic, createGtNextPluginDiagnostic } from "./diagnostics.mjs";
2
2
  import { BABEL_PLUGIN_SUPPORT, SWC_PLUGIN_SUPPORT } from "../plugin/constants.mjs";
3
- import { getLocaleProperties } from "@generaltranslation/format";
4
3
  //#region src/errors/createErrors.ts
5
4
  const remoteTranslationsError = createGtNextDiagnostic({
6
5
  severity: "Error",
@@ -40,16 +39,6 @@ const createDictionarySubsetError = (id, functionName) => createGtNextDiagnostic
40
39
  whatHappened: `${functionName} with id "${id}" could not read a valid dictionary subtree`,
41
40
  fix: "Make sure the id maps to the correct subroute of the dictionary"
42
41
  });
43
- const unresolvedCustomLoadDictionaryError = createGtNextDiagnostic({
44
- severity: "Error",
45
- whatHappened: "loadDictionary() was found during the build but could not be resolved at runtime",
46
- fix: "Export a loadDictionary() function from the configured file"
47
- });
48
- const unresolvedCustomLoadTranslationsError = createGtNextDiagnostic({
49
- severity: "Error",
50
- whatHappened: "loadTranslations() was found during the build but could not be resolved at runtime",
51
- fix: "Export a loadTranslations() function from the configured file"
52
- });
53
42
  const unresolvedLoadDictionaryBuildError = (path) => createGtNextDiagnostic({
54
43
  severity: "Error",
55
44
  whatHappened: `The file defining loadDictionary() could not be resolved at ${path}`,
@@ -71,12 +60,6 @@ const getTranslationsSnapshotRscError = createGtNextDiagnostic({
71
60
  whatHappened: "getTranslationsSnapshot() is not available for React Server Components",
72
61
  fix: "Use gt-next build-time translation helpers in the App Router, or call getTranslationsSnapshot() from a Pages Router entry point"
73
62
  });
74
- const withGTStaticPropsClientError = createGtNextDiagnostic({
75
- severity: "Error",
76
- whatHappened: "withGTStaticProps() cannot run in the browser",
77
- why: "Static props are generated on the server by the Pages Router",
78
- fix: "Export withGTStaticProps() from a Pages Router page module"
79
- });
80
63
  const withGTStaticPropsRscError = createGtNextDiagnostic({
81
64
  severity: "Error",
82
65
  whatHappened: "withGTStaticProps() is not available for React Server Components",
@@ -95,26 +78,10 @@ const invalidCanonicalLocalesError = (locales) => createGtNextDiagnostic({
95
78
  fix: "Use valid BCP 47 locale codes before starting translation",
96
79
  details: locales
97
80
  });
98
- const createInvalidRequestLocaleWarning = (locale, defaultLocale) => createGtNextDiagnostic({
99
- severity: "Warning",
100
- whatHappened: `Locale "${locale}" is not valid or is not supported by this app`,
101
- wayOut: `The default locale "${defaultLocale}" will be used for this request`,
102
- fix: "Use a valid BCP 47 locale code, add a custom mapping, or configure the locale in gt-next"
103
- });
104
- const createInvalidPathRegexError = (pathRegex, error) => createGtNextDiagnostic({
105
- severity: "Error",
106
- whatHappened: `pathRegex "${pathRegex}" is not a valid regular expression`,
107
- fix: "Pass a valid JavaScript regular expression string to withGTConfig()",
108
- details: formatDiagnosticErrorDetails(error)
109
- });
110
81
  const createBadFilepathWarning = (filename, dir) => createGtNextDiagnostic({
111
82
  whatHappened: `${filename} was found in ${dir.join(" or ")}, which is not supported`,
112
83
  fix: "Move it to your project root so gt-next can load it"
113
84
  });
114
- const createUnsupportedLocalesWarning = (locales) => `gt-next: The following locales are currently unsupported by our service: ${locales.map((locale) => {
115
- const { name } = getLocaleProperties(locale);
116
- return `${locale} (${name})`;
117
- }).join(", ")}`;
118
85
  const projectIdMissingWarn = createGtNextDiagnostic({
119
86
  whatHappened: "Runtime translation needs a project ID",
120
87
  fix: "Set GT_PROJECT_ID in your environment or pass projectId to withGTConfig()",
@@ -152,6 +119,6 @@ const babelCompilerTurbopackUnavailableWarning = "gt-next (plugin): The GT babel
152
119
  const disablingCompileTimeHashWarning = `gt-next (plugin): Compile-time hash is disabled. Compiler optimizations are inactive.`;
153
120
  const swcPluginCompatibilityChangeWarning = `gt-next (plugin): As of gt-next@6.12.4, SWC plugin support is disabled for Next.js versions prior to ${SWC_PLUGIN_SUPPORT}. Update to the latest version of Next.js.`;
154
121
  //#endregion
155
- export { APIKeyMissingWarn, autoJsxInjectionCompilerWarning, babelCompilerTurbopackUnavailableWarning, conflictingConfigurationBuildError, createBadFilepathWarning, createDictionarySubsetError, createGTCompilerUnavailableWarning, createGTCompilerUnresolvedWarning, createInvalidPathRegexError, createInvalidRequestLocaleWarning, createUnresolvedNextVersionError, createUnresolvedReactVersionError, createUnsupportedLocalesWarning, customGetLocaleUnresolvedWarning, customGetRegionUnresolvedWarning, customLoadDictionaryWarning, customLoadTranslationsError, devApiKeyIncludedInProductionError, disablingCompileTimeHashWarning, getTranslationsSnapshotRscError, invalidCanonicalLocalesError, invalidLocalesError, projectIdMissingWarn, remoteTranslationsError, standardizedCanonicalLocalesWarning, standardizedLocalesWarning, swcPluginCompatibilityChangeWarning, typesFileError, unresolvedCustomLoadDictionaryError, unresolvedCustomLoadTranslationsError, unresolvedLoadDictionaryBuildError, unresolvedLoadTranslationsBuildError, withGTStaticPropsClientError, withGTStaticPropsRscError };
122
+ export { APIKeyMissingWarn, autoJsxInjectionCompilerWarning, babelCompilerTurbopackUnavailableWarning, conflictingConfigurationBuildError, createBadFilepathWarning, createDictionarySubsetError, createGTCompilerUnavailableWarning, createGTCompilerUnresolvedWarning, createUnresolvedNextVersionError, createUnresolvedReactVersionError, customGetLocaleUnresolvedWarning, customGetRegionUnresolvedWarning, customLoadDictionaryWarning, customLoadTranslationsError, devApiKeyIncludedInProductionError, disablingCompileTimeHashWarning, getTranslationsSnapshotRscError, invalidCanonicalLocalesError, invalidLocalesError, projectIdMissingWarn, remoteTranslationsError, standardizedCanonicalLocalesWarning, standardizedLocalesWarning, swcPluginCompatibilityChangeWarning, typesFileError, unresolvedLoadDictionaryBuildError, unresolvedLoadTranslationsBuildError, withGTStaticPropsRscError };
156
123
 
157
124
  //# sourceMappingURL=createErrors.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"createErrors.mjs","names":[],"sources":["../../src/errors/createErrors.ts"],"sourcesContent":["// ---- ERRORS ---- //\n\nimport { getLocaleProperties } from '@generaltranslation/format';\nimport {\n createGtNextDiagnostic,\n createGtNextPluginDiagnostic,\n formatDiagnosticErrorDetails,\n} from './diagnostics';\nimport { BABEL_PLUGIN_SUPPORT, SWC_PLUGIN_SUPPORT } from '../plugin/constants';\n\nexport const remoteTranslationsError = createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'Remote translations could not be loaded',\n fix: 'Check your project ID, API key, and network connection, then try again',\n wayOut: 'Source content will render as a fallback',\n});\n\nexport const customLoadTranslationsError = (locale: string = '') =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: `Locally stored translations could not be loaded${locale ? ` for \"${locale}\"` : ''}`,\n fix: 'If you use loadTranslations(), make sure it returns translations for the requested locale',\n });\n\nexport const customLoadDictionaryWarning = (locale: string = '') =>\n createGtNextDiagnostic({\n severity: 'Warning',\n whatHappened: `The local dictionary could not be loaded${locale ? ` for \"${locale}\"` : ''}`,\n fix: 'If you use loadDictionary(), make sure it returns a dictionary for the requested locale',\n });\n\nexport const createUnresolvedNextVersionError = (error: Error) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'The installed Next.js version could not be resolved',\n fix: 'Check that next is installed in this project',\n details: error.message,\n });\n\nexport const createUnresolvedReactVersionError = (error: Error) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'The installed React version could not be resolved',\n fix: 'Check that react is installed in this project',\n details: error.message,\n });\n\nexport const devApiKeyIncludedInProductionError = createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'Production builds cannot use a development API key',\n fix: 'Replace it with a production API key',\n});\n\nexport const createDictionarySubsetError = (id: string, functionName: string) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: `${functionName} with id \"${id}\" could not read a valid dictionary subtree`,\n fix: 'Make sure the id maps to the correct subroute of the dictionary',\n });\n\nexport const unresolvedCustomLoadDictionaryError = createGtNextDiagnostic({\n severity: 'Error',\n whatHappened:\n 'loadDictionary() was found during the build but could not be resolved at runtime',\n fix: 'Export a loadDictionary() function from the configured file',\n});\n\nexport const unresolvedCustomLoadTranslationsError = createGtNextDiagnostic({\n severity: 'Error',\n whatHappened:\n 'loadTranslations() was found during the build but could not be resolved at runtime',\n fix: 'Export a loadTranslations() function from the configured file',\n});\n\nexport const unresolvedLoadDictionaryBuildError = (path: string) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: `The file defining loadDictionary() could not be resolved at ${path}`,\n fix: 'Check the configured path and try again',\n });\n\nexport const unresolvedLoadTranslationsBuildError = (path: string) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: `The file defining loadTranslations() could not be resolved at ${path}`,\n fix: 'Check the configured path and try again',\n });\n\nexport const conflictingConfigurationBuildError = (conflicts: string[]) =>\n `gt-next Error: Conflicting configuration${\n conflicts.length > 1 ? 's' : ''\n } detected. Resolve the following conflicts before building your app:\\n${conflicts.join(\n '\\n'\n )}`;\n\nexport const typesFileError = createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'A types-only entry point was executed at runtime',\n fix: 'Import from the appropriate gt-next runtime entry point instead',\n});\n\nexport const getTranslationsSnapshotRscError = createGtNextDiagnostic({\n severity: 'Error',\n whatHappened:\n 'getTranslationsSnapshot() is not available for React Server Components',\n fix: 'Use gt-next build-time translation helpers in the App Router, or call getTranslationsSnapshot() from a Pages Router entry point',\n});\n\nexport const withGTStaticPropsClientError = createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'withGTStaticProps() cannot run in the browser',\n why: 'Static props are generated on the server by the Pages Router',\n fix: 'Export withGTStaticProps() from a Pages Router page module',\n});\n\nexport const withGTStaticPropsRscError = createGtNextDiagnostic({\n severity: 'Error',\n whatHappened:\n 'withGTStaticProps() is not available for React Server Components',\n why: 'This helper supports the Pages Router, not the App Router',\n fix: 'Use gt-next build-time translation helpers in the App Router, or export withGTStaticProps() from a Pages Router page module',\n});\n\nexport const invalidLocalesError = (locales: string[]) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'Invalid locale codes in your configuration',\n fix: 'Specify a list of valid locales or use \"customMapping\" to define aliases for the invalid locales',\n details: locales,\n });\n\nexport const invalidCanonicalLocalesError = (locales: string[]) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'Invalid canonical locale codes in your configuration',\n fix: 'Use valid BCP 47 locale codes before starting translation',\n details: locales,\n });\n\nexport const createInvalidRequestLocaleWarning = (\n locale: string,\n defaultLocale: string\n) =>\n createGtNextDiagnostic({\n severity: 'Warning',\n whatHappened: `Locale \"${locale}\" is not valid or is not supported by this app`,\n wayOut: `The default locale \"${defaultLocale}\" will be used for this request`,\n fix: 'Use a valid BCP 47 locale code, add a custom mapping, or configure the locale in gt-next',\n });\n\nexport const createInvalidPathRegexError = (\n pathRegex: string,\n error: unknown\n) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: `pathRegex \"${pathRegex}\" is not a valid regular expression`,\n fix: 'Pass a valid JavaScript regular expression string to withGTConfig()',\n details: formatDiagnosticErrorDetails(error),\n });\n\n// ---- WARNINGS ---- //\n\nexport const createBadFilepathWarning = (filename: string, dir: string[]) =>\n createGtNextDiagnostic({\n whatHappened: `${filename} was found in ${dir.join(' or ')}, which is not supported`,\n fix: 'Move it to your project root so gt-next can load it',\n });\n\nexport const 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 projectIdMissingWarn = createGtNextDiagnostic({\n whatHappened: 'Runtime translation needs a project ID',\n fix: 'Set GT_PROJECT_ID in your environment or pass projectId to withGTConfig()',\n docsUrl: 'https://generaltranslation.com/dashboard',\n});\n\nexport const APIKeyMissingWarn = createGtNextPluginDiagnostic({\n whatHappened: 'Runtime translation needs a development API key',\n fix: 'Find your development API key at generaltranslation.com/dashboard, or set runtimeUrl to an empty string to disable runtime translation',\n});\n\nexport const standardizedLocalesWarning = (locales: string[]) =>\n `gt-next: The following locales were standardized: ${locales.join(', ')}. Use the standardized codes in your config to avoid this warning.`;\n\nexport const standardizedCanonicalLocalesWarning = (locales: string[]) =>\n `gt-next: The following canonical locales were standardized: ${locales.join(', ')}. Use the standardized codes in your config to avoid this warning.`;\n\nexport const createGTCompilerUnresolvedWarning = (type: 'babel' | 'swc') =>\n createGtNextPluginDiagnostic({\n whatHappened: `The GT ${type} compiler could not be resolved`,\n wayOut: 'Skipping compiler optimizations',\n ...(type === 'babel' && {\n fix: 'Install @generaltranslation/compiler to enable the experimental babel compiler',\n }),\n });\n\nexport const autoJsxInjectionCompilerWarning = createGtNextPluginDiagnostic({\n severity: 'Warning',\n whatHappened: 'Automatic JSX injection requires the GT webpack compiler',\n wayOut: 'Automatic JSX injection will be skipped',\n fix: \"Set experimentalCompilerOptions.type to 'babel' in withGTConfig() and build with webpack\",\n});\n\nexport const customGetLocaleUnresolvedWarning = createGtNextDiagnostic({\n whatHappened: 'Custom getLocale() could not be resolved',\n wayOut: 'gt-next will fall back to default locale detection',\n fix: 'Export a getLocale() function from the configured request file',\n});\n\nexport const customGetRegionUnresolvedWarning = createGtNextDiagnostic({\n whatHappened: 'Custom getRegion() could not be resolved',\n wayOut: 'gt-next will fall back to default region detection',\n fix: 'Export a getRegion() function from the configured request file',\n});\n\nexport const createGTCompilerUnavailableWarning = (type: 'babel' | 'swc') =>\n type === 'swc'\n ? `gt-next (plugin): The GT swc compiler is compatible with < next@${SWC_PLUGIN_SUPPORT}. Skipping compiler optimizations.`\n : `gt-next (plugin): The GT babel compiler requires react@${BABEL_PLUGIN_SUPPORT} or newer. Skipping compiler optimizations.`;\n\nexport const babelCompilerTurbopackUnavailableWarning =\n `gt-next (plugin): The GT babel compiler is not compatible with Turbopack. ` +\n `To use compiler optimizations with Turbopack, set experimentalCompilerOptions: { type: 'swc' }.`;\n\nexport const disablingCompileTimeHashWarning = `gt-next (plugin): Compile-time hash is disabled. Compiler optimizations are inactive.`;\n\nexport const swcPluginCompatibilityChangeWarning = `gt-next (plugin): As of gt-next@6.12.4, SWC plugin support is disabled for Next.js versions prior to ${SWC_PLUGIN_SUPPORT}. Update to the latest version of Next.js.`;\n"],"mappings":";;;;AAUA,MAAa,0BAA0B,uBAAuB;CAC5D,UAAU;CACV,cAAc;CACd,KAAK;CACL,QAAQ;CACT,CAAC;AAEF,MAAa,+BAA+B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6BAA6B;CAC1E,UAAU;CACV,cAAc;CACd,QAAQ;CACR,KAAK;CACN,CAAC;AAEF,MAAa,mCAAmC,uBAAuB;CACrE,cAAc;CACd,QAAQ;CACR,KAAK;CACN,CAAC;AAEF,MAAa,mCAAmC,uBAAuB;CACrE,cAAc;CACd,QAAQ;CACR,KAAK;CACN,CAAC;AAEF,MAAa,sCAAsC,SACjD,SAAS,QACL,mEAAmE,mBAAmB,sCACtF,0DAA0D,qBAAqB;AAErF,MAAa,2CACX;AAGF,MAAa,kCAAkC;AAE/C,MAAa,sCAAsC,wGAAwG,mBAAmB"}
1
+ {"version":3,"file":"createErrors.mjs","names":[],"sources":["../../src/errors/createErrors.ts"],"sourcesContent":["// ---- ERRORS ---- //\n\nimport {\n createGtNextDiagnostic,\n createGtNextPluginDiagnostic,\n} from './diagnostics';\nimport { BABEL_PLUGIN_SUPPORT, SWC_PLUGIN_SUPPORT } from '../plugin/constants';\n\nexport const remoteTranslationsError = createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'Remote translations could not be loaded',\n fix: 'Check your project ID, API key, and network connection, then try again',\n wayOut: 'Source content will render as a fallback',\n});\n\nexport const customLoadTranslationsError = (locale: string = '') =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: `Locally stored translations could not be loaded${locale ? ` for \"${locale}\"` : ''}`,\n fix: 'If you use loadTranslations(), make sure it returns translations for the requested locale',\n });\n\nexport const customLoadDictionaryWarning = (locale: string = '') =>\n createGtNextDiagnostic({\n severity: 'Warning',\n whatHappened: `The local dictionary could not be loaded${locale ? ` for \"${locale}\"` : ''}`,\n fix: 'If you use loadDictionary(), make sure it returns a dictionary for the requested locale',\n });\n\nexport const createUnresolvedNextVersionError = (error: Error) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'The installed Next.js version could not be resolved',\n fix: 'Check that next is installed in this project',\n details: error.message,\n });\n\nexport const createUnresolvedReactVersionError = (error: Error) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'The installed React version could not be resolved',\n fix: 'Check that react is installed in this project',\n details: error.message,\n });\n\nexport const devApiKeyIncludedInProductionError = createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'Production builds cannot use a development API key',\n fix: 'Replace it with a production API key',\n});\n\nexport const createDictionarySubsetError = (id: string, functionName: string) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: `${functionName} with id \"${id}\" could not read a valid dictionary subtree`,\n fix: 'Make sure the id maps to the correct subroute of the dictionary',\n });\n\nexport const unresolvedLoadDictionaryBuildError = (path: string) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: `The file defining loadDictionary() could not be resolved at ${path}`,\n fix: 'Check the configured path and try again',\n });\n\nexport const unresolvedLoadTranslationsBuildError = (path: string) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: `The file defining loadTranslations() could not be resolved at ${path}`,\n fix: 'Check the configured path and try again',\n });\n\nexport const conflictingConfigurationBuildError = (conflicts: string[]) =>\n `gt-next Error: Conflicting configuration${\n conflicts.length > 1 ? 's' : ''\n } detected. Resolve the following conflicts before building your app:\\n${conflicts.join(\n '\\n'\n )}`;\n\nexport const typesFileError = createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'A types-only entry point was executed at runtime',\n fix: 'Import from the appropriate gt-next runtime entry point instead',\n});\n\nexport const getTranslationsSnapshotRscError = createGtNextDiagnostic({\n severity: 'Error',\n whatHappened:\n 'getTranslationsSnapshot() is not available for React Server Components',\n fix: 'Use gt-next build-time translation helpers in the App Router, or call getTranslationsSnapshot() from a Pages Router entry point',\n});\n\nexport const withGTStaticPropsRscError = createGtNextDiagnostic({\n severity: 'Error',\n whatHappened:\n 'withGTStaticProps() is not available for React Server Components',\n why: 'This helper supports the Pages Router, not the App Router',\n fix: 'Use gt-next build-time translation helpers in the App Router, or export withGTStaticProps() from a Pages Router page module',\n});\n\nexport const invalidLocalesError = (locales: string[]) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'Invalid locale codes in your configuration',\n fix: 'Specify a list of valid locales or use \"customMapping\" to define aliases for the invalid locales',\n details: locales,\n });\n\nexport const invalidCanonicalLocalesError = (locales: string[]) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'Invalid canonical locale codes in your configuration',\n fix: 'Use valid BCP 47 locale codes before starting translation',\n details: locales,\n });\n\n// ---- WARNINGS ---- //\n\nexport const createBadFilepathWarning = (filename: string, dir: string[]) =>\n createGtNextDiagnostic({\n whatHappened: `${filename} was found in ${dir.join(' or ')}, which is not supported`,\n fix: 'Move it to your project root so gt-next can load it',\n });\n\nexport const projectIdMissingWarn = createGtNextDiagnostic({\n whatHappened: 'Runtime translation needs a project ID',\n fix: 'Set GT_PROJECT_ID in your environment or pass projectId to withGTConfig()',\n docsUrl: 'https://generaltranslation.com/dashboard',\n});\n\nexport const APIKeyMissingWarn = createGtNextPluginDiagnostic({\n whatHappened: 'Runtime translation needs a development API key',\n fix: 'Find your development API key at generaltranslation.com/dashboard, or set runtimeUrl to an empty string to disable runtime translation',\n});\n\nexport const standardizedLocalesWarning = (locales: string[]) =>\n `gt-next: The following locales were standardized: ${locales.join(', ')}. Use the standardized codes in your config to avoid this warning.`;\n\nexport const standardizedCanonicalLocalesWarning = (locales: string[]) =>\n `gt-next: The following canonical locales were standardized: ${locales.join(', ')}. Use the standardized codes in your config to avoid this warning.`;\n\nexport const createGTCompilerUnresolvedWarning = (type: 'babel' | 'swc') =>\n createGtNextPluginDiagnostic({\n whatHappened: `The GT ${type} compiler could not be resolved`,\n wayOut: 'Skipping compiler optimizations',\n ...(type === 'babel' && {\n fix: 'Install @generaltranslation/compiler to enable the experimental babel compiler',\n }),\n });\n\nexport const autoJsxInjectionCompilerWarning = createGtNextPluginDiagnostic({\n severity: 'Warning',\n whatHappened: 'Automatic JSX injection requires the GT webpack compiler',\n wayOut: 'Automatic JSX injection will be skipped',\n fix: \"Set experimentalCompilerOptions.type to 'babel' in withGTConfig() and build with webpack\",\n});\n\nexport const customGetLocaleUnresolvedWarning = createGtNextDiagnostic({\n whatHappened: 'Custom getLocale() could not be resolved',\n wayOut: 'gt-next will fall back to default locale detection',\n fix: 'Export a getLocale() function from the configured request file',\n});\n\nexport const customGetRegionUnresolvedWarning = createGtNextDiagnostic({\n whatHappened: 'Custom getRegion() could not be resolved',\n wayOut: 'gt-next will fall back to default region detection',\n fix: 'Export a getRegion() function from the configured request file',\n});\n\nexport const createGTCompilerUnavailableWarning = (type: 'babel' | 'swc') =>\n type === 'swc'\n ? `gt-next (plugin): The GT swc compiler is compatible with < next@${SWC_PLUGIN_SUPPORT}. Skipping compiler optimizations.`\n : `gt-next (plugin): The GT babel compiler requires react@${BABEL_PLUGIN_SUPPORT} or newer. Skipping compiler optimizations.`;\n\nexport const babelCompilerTurbopackUnavailableWarning =\n `gt-next (plugin): The GT babel compiler is not compatible with Turbopack. ` +\n `To use compiler optimizations with Turbopack, set experimentalCompilerOptions: { type: 'swc' }.`;\n\nexport const disablingCompileTimeHashWarning = `gt-next (plugin): Compile-time hash is disabled. Compiler optimizations are inactive.`;\n\nexport const swcPluginCompatibilityChangeWarning = `gt-next (plugin): As of gt-next@6.12.4, SWC plugin support is disabled for Next.js versions prior to ${SWC_PLUGIN_SUPPORT}. Update to the latest version of Next.js.`;\n"],"mappings":";;;AAQA,MAAa,0BAA0B,uBAAuB;CAC5D,UAAU;CACV,cAAc;CACd,KAAK;CACL,QAAQ;CACT,CAAC;AAEF,MAAa,+BAA+B,SAAiB,OAC3D,uBAAuB;CACrB,UAAU;CACV,cAAc,kDAAkD,SAAS,SAAS,OAAO,KAAK;CAC9F,KAAK;CACN,CAAC;AAEJ,MAAa,+BAA+B,SAAiB,OAC3D,uBAAuB;CACrB,UAAU;CACV,cAAc,2CAA2C,SAAS,SAAS,OAAO,KAAK;CACvF,KAAK;CACN,CAAC;AAEJ,MAAa,oCAAoC,UAC/C,uBAAuB;CACrB,UAAU;CACV,cAAc;CACd,KAAK;CACL,SAAS,MAAM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AAK;CACN,CAAC;AAEF,MAAa,8BAA8B,YACzC,qDAAqD,QAAQ,KAAK,KAAK,CAAC;AAE1E,MAAa,uCAAuC,YAClD,+DAA+D,QAAQ,KAAK,KAAK,CAAC;AAEpF,MAAa,qCAAqC,SAChD,6BAA6B;CAC3B,cAAc,UAAU,KAAK;CAC7B,QAAQ;CACR,GAAI,SAAS,WAAW,EACtB,KAAK,kFACN;CACF,CAAC;AAEJ,MAAa,kCAAkC,6BAA6B;CAC1E,UAAU;CACV,cAAc;CACd,QAAQ;CACR,KAAK;CACN,CAAC;AAEF,MAAa,mCAAmC,uBAAuB;CACrE,cAAc;CACd,QAAQ;CACR,KAAK;CACN,CAAC;AAEF,MAAa,mCAAmC,uBAAuB;CACrE,cAAc;CACd,QAAQ;CACR,KAAK;CACN,CAAC;AAEF,MAAa,sCAAsC,SACjD,SAAS,QACL,mEAAmE,mBAAmB,sCACtF,0DAA0D,qBAAqB;AAErF,MAAa,2CACX;AAGF,MAAa,kCAAkC;AAE/C,MAAa,sCAAsC,wGAAwG,mBAAmB"}
@@ -0,0 +1,3 @@
1
+ export declare const createUnresolvedCustomLoadDictionaryError: () => string;
2
+ export declare const createUnresolvedCustomLoadTranslationsError: () => string;
3
+ //# sourceMappingURL=loaders.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loaders.d.ts","sourceRoot":"","sources":["../../src/errors/loaders.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,yCAAyC,cAMlD,CAAC;AAEL,eAAO,MAAM,2CAA2C,cAMpD,CAAC"}
@@ -0,0 +1,18 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_errors_diagnostics = require("./diagnostics.js");
3
+ //#region src/errors/loaders.ts
4
+ const createUnresolvedCustomLoadDictionaryError = () => require_errors_diagnostics.createGtNextDiagnostic({
5
+ severity: "Error",
6
+ whatHappened: "loadDictionary() was found during the build but could not be resolved at runtime",
7
+ fix: "Export a loadDictionary() function from the configured file"
8
+ });
9
+ const createUnresolvedCustomLoadTranslationsError = () => require_errors_diagnostics.createGtNextDiagnostic({
10
+ severity: "Error",
11
+ whatHappened: "loadTranslations() was found during the build but could not be resolved at runtime",
12
+ fix: "Export a loadTranslations() function from the configured file"
13
+ });
14
+ //#endregion
15
+ exports.createUnresolvedCustomLoadDictionaryError = createUnresolvedCustomLoadDictionaryError;
16
+ exports.createUnresolvedCustomLoadTranslationsError = createUnresolvedCustomLoadTranslationsError;
17
+
18
+ //# sourceMappingURL=loaders.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loaders.js","names":["createGtNextDiagnostic"],"sources":["../../src/errors/loaders.ts"],"sourcesContent":["import { createGtNextDiagnostic } from './diagnostics';\n\nexport const createUnresolvedCustomLoadDictionaryError = () =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened:\n 'loadDictionary() was found during the build but could not be resolved at runtime',\n fix: 'Export a loadDictionary() function from the configured file',\n });\n\nexport const createUnresolvedCustomLoadTranslationsError = () =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened:\n 'loadTranslations() was found during the build but could not be resolved at runtime',\n fix: 'Export a loadTranslations() function from the configured file',\n });\n"],"mappings":";;;AAEA,MAAa,kDACXA,2BAAAA,uBAAuB;CACrB,UAAU;CACV,cACE;CACF,KAAK;CACN,CAAC;AAEJ,MAAa,oDACXA,2BAAAA,uBAAuB;CACrB,UAAU;CACV,cACE;CACF,KAAK;CACN,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { createGtNextDiagnostic } from "./diagnostics.mjs";
2
+ //#region src/errors/loaders.ts
3
+ const createUnresolvedCustomLoadDictionaryError = () => createGtNextDiagnostic({
4
+ severity: "Error",
5
+ whatHappened: "loadDictionary() was found during the build but could not be resolved at runtime",
6
+ fix: "Export a loadDictionary() function from the configured file"
7
+ });
8
+ const createUnresolvedCustomLoadTranslationsError = () => createGtNextDiagnostic({
9
+ severity: "Error",
10
+ whatHappened: "loadTranslations() was found during the build but could not be resolved at runtime",
11
+ fix: "Export a loadTranslations() function from the configured file"
12
+ });
13
+ //#endregion
14
+ export { createUnresolvedCustomLoadDictionaryError, createUnresolvedCustomLoadTranslationsError };
15
+
16
+ //# sourceMappingURL=loaders.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loaders.mjs","names":[],"sources":["../../src/errors/loaders.ts"],"sourcesContent":["import { createGtNextDiagnostic } from './diagnostics';\n\nexport const createUnresolvedCustomLoadDictionaryError = () =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened:\n 'loadDictionary() was found during the build but could not be resolved at runtime',\n fix: 'Export a loadDictionary() function from the configured file',\n });\n\nexport const createUnresolvedCustomLoadTranslationsError = () =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened:\n 'loadTranslations() was found during the build but could not be resolved at runtime',\n fix: 'Export a loadTranslations() function from the configured file',\n });\n"],"mappings":";;AAEA,MAAa,kDACX,uBAAuB;CACrB,UAAU;CACV,cACE;CACF,KAAK;CACN,CAAC;AAEJ,MAAa,oDACX,uBAAuB;CACrB,UAAU;CACV,cACE;CACF,KAAK;CACN,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const createUnsupportedLocalesWarning: (locales: string[]) => string;
2
+ //# sourceMappingURL=middleware.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,12 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ require("../_virtual/_rolldown/runtime.js");
3
+ let _generaltranslation_format = require("@generaltranslation/format");
4
+ //#region src/errors/middleware.ts
5
+ const createUnsupportedLocalesWarning = (locales) => `gt-next: The following locales are currently unsupported by our service: ${locales.map((locale) => {
6
+ const { name } = (0, _generaltranslation_format.getLocaleProperties)(locale);
7
+ return `${locale} (${name})`;
8
+ }).join(", ")}`;
9
+ //#endregion
10
+ exports.createUnsupportedLocalesWarning = createUnsupportedLocalesWarning;
11
+
12
+ //# sourceMappingURL=middleware.js.map
@@ -0,0 +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"}
@@ -0,0 +1,10 @@
1
+ import { getLocaleProperties } from "@generaltranslation/format";
2
+ //#region src/errors/middleware.ts
3
+ const createUnsupportedLocalesWarning = (locales) => `gt-next: The following locales are currently unsupported by our service: ${locales.map((locale) => {
4
+ const { name } = getLocaleProperties(locale);
5
+ return `${locale} (${name})`;
6
+ }).join(", ")}`;
7
+ //#endregion
8
+ export { createUnsupportedLocalesWarning };
9
+
10
+ //# sourceMappingURL=middleware.mjs.map
@@ -0,0 +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"}
@@ -0,0 +1,2 @@
1
+ export declare const createInvalidPathRegexError: (pathRegex: string, error: unknown) => string;
2
+ //# sourceMappingURL=pathRegex.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pathRegex.d.ts","sourceRoot":"","sources":["../../src/errors/pathRegex.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,2BAA2B,GACtC,WAAW,MAAM,EACjB,OAAO,OAAO,WAOZ,CAAC"}
@@ -0,0 +1,15 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ require("../_virtual/_rolldown/runtime.js");
3
+ const require_errors_diagnostics = require("./diagnostics.js");
4
+ let generaltranslation_internal = require("generaltranslation/internal");
5
+ //#region src/errors/pathRegex.ts
6
+ const createInvalidPathRegexError = (pathRegex, error) => require_errors_diagnostics.createGtNextDiagnostic({
7
+ severity: "Error",
8
+ whatHappened: `pathRegex "${pathRegex}" is not a valid regular expression`,
9
+ fix: "Pass a valid JavaScript regular expression string to withGTConfig()",
10
+ details: (0, generaltranslation_internal.formatDiagnosticErrorDetails)(error)
11
+ });
12
+ //#endregion
13
+ exports.createInvalidPathRegexError = createInvalidPathRegexError;
14
+
15
+ //# sourceMappingURL=pathRegex.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pathRegex.js","names":["createGtNextDiagnostic"],"sources":["../../src/errors/pathRegex.ts"],"sourcesContent":["import {\n createGtNextDiagnostic,\n formatDiagnosticErrorDetails,\n} from './diagnostics';\n\nexport const createInvalidPathRegexError = (\n pathRegex: string,\n error: unknown\n) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: `pathRegex \"${pathRegex}\" is not a valid regular expression`,\n fix: 'Pass a valid JavaScript regular expression string to withGTConfig()',\n details: formatDiagnosticErrorDetails(error),\n });\n"],"mappings":";;;;;AAKA,MAAa,+BACX,WACA,UAEAA,2BAAAA,uBAAuB;CACrB,UAAU;CACV,cAAc,cAAc,UAAU;CACtC,KAAK;CACL,UAAA,GAAA,4BAAA,8BAAsC,MAAM;CAC7C,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { createGtNextDiagnostic, formatDiagnosticErrorDetails } from "./diagnostics.mjs";
2
+ //#region src/errors/pathRegex.ts
3
+ const createInvalidPathRegexError = (pathRegex, error) => createGtNextDiagnostic({
4
+ severity: "Error",
5
+ whatHappened: `pathRegex "${pathRegex}" is not a valid regular expression`,
6
+ fix: "Pass a valid JavaScript regular expression string to withGTConfig()",
7
+ details: formatDiagnosticErrorDetails(error)
8
+ });
9
+ //#endregion
10
+ export { createInvalidPathRegexError };
11
+
12
+ //# sourceMappingURL=pathRegex.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pathRegex.mjs","names":[],"sources":["../../src/errors/pathRegex.ts"],"sourcesContent":["import {\n createGtNextDiagnostic,\n formatDiagnosticErrorDetails,\n} from './diagnostics';\n\nexport const createInvalidPathRegexError = (\n pathRegex: string,\n error: unknown\n) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: `pathRegex \"${pathRegex}\" is not a valid regular expression`,\n fix: 'Pass a valid JavaScript regular expression string to withGTConfig()',\n details: formatDiagnosticErrorDetails(error),\n });\n"],"mappings":";;AAKA,MAAa,+BACX,WACA,UAEA,uBAAuB;CACrB,UAAU;CACV,cAAc,cAAc,UAAU;CACtC,KAAK;CACL,SAAS,6BAA6B,MAAM;CAC7C,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const createInvalidRequestLocaleWarning: (locale: string, defaultLocale: string) => string;
2
+ //# sourceMappingURL=request.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../src/errors/request.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,iCAAiC,GAC5C,QAAQ,MAAM,EACd,eAAe,MAAM,WAOnB,CAAC"}
@@ -0,0 +1,13 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_errors_diagnostics = require("./diagnostics.js");
3
+ //#region src/errors/request.ts
4
+ const createInvalidRequestLocaleWarning = (locale, defaultLocale) => require_errors_diagnostics.createGtNextDiagnostic({
5
+ severity: "Warning",
6
+ whatHappened: `Locale "${locale}" is not valid or is not supported by this app`,
7
+ wayOut: `The default locale "${defaultLocale}" will be used for this request`,
8
+ fix: "Use a valid BCP 47 locale code, add a custom mapping, or configure the locale in gt-next"
9
+ });
10
+ //#endregion
11
+ exports.createInvalidRequestLocaleWarning = createInvalidRequestLocaleWarning;
12
+
13
+ //# sourceMappingURL=request.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request.js","names":["createGtNextDiagnostic"],"sources":["../../src/errors/request.ts"],"sourcesContent":["import { createGtNextDiagnostic } from './diagnostics';\n\nexport const createInvalidRequestLocaleWarning = (\n locale: string,\n defaultLocale: string\n) =>\n createGtNextDiagnostic({\n severity: 'Warning',\n whatHappened: `Locale \"${locale}\" is not valid or is not supported by this app`,\n wayOut: `The default locale \"${defaultLocale}\" will be used for this request`,\n fix: 'Use a valid BCP 47 locale code, add a custom mapping, or configure the locale in gt-next',\n });\n"],"mappings":";;;AAEA,MAAa,qCACX,QACA,kBAEAA,2BAAAA,uBAAuB;CACrB,UAAU;CACV,cAAc,WAAW,OAAO;CAChC,QAAQ,uBAAuB,cAAc;CAC7C,KAAK;CACN,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { createGtNextDiagnostic } from "./diagnostics.mjs";
2
+ //#region src/errors/request.ts
3
+ const createInvalidRequestLocaleWarning = (locale, defaultLocale) => createGtNextDiagnostic({
4
+ severity: "Warning",
5
+ whatHappened: `Locale "${locale}" is not valid or is not supported by this app`,
6
+ wayOut: `The default locale "${defaultLocale}" will be used for this request`,
7
+ fix: "Use a valid BCP 47 locale code, add a custom mapping, or configure the locale in gt-next"
8
+ });
9
+ //#endregion
10
+ export { createInvalidRequestLocaleWarning };
11
+
12
+ //# sourceMappingURL=request.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request.mjs","names":[],"sources":["../../src/errors/request.ts"],"sourcesContent":["import { createGtNextDiagnostic } from './diagnostics';\n\nexport const createInvalidRequestLocaleWarning = (\n locale: string,\n defaultLocale: string\n) =>\n createGtNextDiagnostic({\n severity: 'Warning',\n whatHappened: `Locale \"${locale}\" is not valid or is not supported by this app`,\n wayOut: `The default locale \"${defaultLocale}\" will be used for this request`,\n fix: 'Use a valid BCP 47 locale code, add a custom mapping, or configure the locale in gt-next',\n });\n"],"mappings":";;AAEA,MAAa,qCACX,QACA,kBAEA,uBAAuB;CACrB,UAAU;CACV,cAAc,WAAW,OAAO;CAChC,QAAQ,uBAAuB,cAAc;CAC7C,KAAK;CACN,CAAC"}
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  require("./_virtual/_rolldown/runtime.js");
4
- const require_errors_createErrors = require("./errors/createErrors.js");
5
4
  const require_setup_initGT_client = require("./setup/initGT.client.js");
5
+ const require_errors_client = require("./errors/client.js");
6
6
  const require_request_localeValidation = require("./request/localeValidation.js");
7
7
  let gt_react = require("gt-react");
8
8
  //#region src/index.client.ts
@@ -14,7 +14,7 @@ function withGTServerSideProps(_) {
14
14
  throw new Error("withGTServerSideProps() is only available from gt-next on the server.");
15
15
  }
16
16
  const withGTStaticProps = () => {
17
- throw new Error(require_errors_createErrors.withGTStaticPropsClientError);
17
+ throw new Error(require_errors_client.createWithGTStaticPropsClientError());
18
18
  };
19
19
  //#endregion
20
20
  Object.defineProperty(exports, "Branch", {
@@ -1 +1 @@
1
- {"version":3,"file":"index.client.js","names":["initializeGTClient","withGTStaticPropsClientError"],"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 { withGTStaticPropsClientError } from './errors/createErrors';\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(withGTStaticPropsClientError);\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,4BAAAA,6BAA6B"}
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,6 +1,6 @@
1
1
  "use client";
2
- import { withGTStaticPropsClientError } from "./errors/createErrors.mjs";
3
2
  import { initializeGTClient } from "./setup/initGT.client.mjs";
3
+ import { createWithGTStaticPropsClientError } from "./errors/client.mjs";
4
4
  import { isLocaleSupported } from "./request/localeValidation.mjs";
5
5
  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
6
  //#region src/index.client.ts
@@ -12,7 +12,7 @@ function withGTServerSideProps(_) {
12
12
  throw new Error("withGTServerSideProps() is only available from gt-next on the server.");
13
13
  }
14
14
  const withGTStaticProps = () => {
15
- throw new Error(withGTStaticPropsClientError);
15
+ throw new Error(createWithGTStaticPropsClientError());
16
16
  };
17
17
  //#endregion
18
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 };
@@ -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 { withGTStaticPropsClientError } from './errors/createErrors';\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(withGTStaticPropsClientError);\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,6BAA6B"}
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"}