gt 2.14.62 → 2.14.63

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 (34) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/cli/base.js +16 -0
  3. package/dist/cli/base.js.map +1 -1
  4. package/dist/console/index.d.ts +1 -0
  5. package/dist/console/index.js +7 -2
  6. package/dist/console/index.js.map +1 -1
  7. package/dist/generated/version.d.ts +1 -1
  8. package/dist/generated/version.js +1 -1
  9. package/dist/generated/version.js.map +1 -1
  10. package/dist/react/jsx/utils/jsxParsing/addGTIdentifierToSyntaxTree.js +1 -1
  11. package/dist/react/jsx/utils/jsxParsing/parseJsx.d.ts +2 -0
  12. package/dist/react/jsx/utils/jsxParsing/parseJsx.js +3 -2
  13. package/dist/react/jsx/utils/jsxParsing/parseJsx.js.map +1 -1
  14. package/dist/react/jsx/utils/jsxParsing/parseTProps.d.ts +3 -1
  15. package/dist/react/jsx/utils/jsxParsing/parseTProps.js +18 -2
  16. package/dist/react/jsx/utils/jsxParsing/parseTProps.js.map +1 -1
  17. package/dist/react/jsx/utils/parseString.js +1 -1
  18. package/dist/react/jsx/utils/stringParsing/derivation/index.js +1 -1
  19. package/dist/react/jsx/utils/stringParsing/processTaggedTemplateCall/index.js +5 -4
  20. package/dist/react/jsx/utils/stringParsing/processTaggedTemplateCall/index.js.map +1 -1
  21. package/dist/react/jsx/utils/stringParsing/processTranslationCall/routeTranslationCall.js +3 -3
  22. package/dist/react/jsx/utils/stringParsing/processTranslationCall/routeTranslationCall.js.map +1 -1
  23. package/dist/react/parse/createInlineUpdates.js +5 -1
  24. package/dist/react/parse/createInlineUpdates.js.map +1 -1
  25. package/dist/utils/reactPackageCompatibility.d.ts +1 -0
  26. package/dist/utils/reactPackageCompatibility.js +41 -0
  27. package/dist/utils/reactPackageCompatibility.js.map +1 -0
  28. package/package.json +6 -4
  29. package/dist/react/jsx/utils/stringParsing/processTaggedTemplateCall/handleTaggedTemplateTranslationCall.d.ts +0 -26
  30. package/dist/react/jsx/utils/stringParsing/processTaggedTemplateCall/handleTaggedTemplateTranslationCall.js +0 -31
  31. package/dist/react/jsx/utils/stringParsing/processTaggedTemplateCall/handleTaggedTemplateTranslationCall.js.map +0 -1
  32. package/dist/react/jsx/utils/stringParsing/processTranslationCall/handleDeriveTranslationCall.d.ts +0 -23
  33. package/dist/react/jsx/utils/stringParsing/processTranslationCall/handleDeriveTranslationCall.js +0 -26
  34. package/dist/react/jsx/utils/stringParsing/processTranslationCall/handleDeriveTranslationCall.js.map +0 -1
@@ -0,0 +1,41 @@
1
+ import { logger } from "../console/logger.js";
2
+ import { getPackageJson, getPackageVersion } from "./packageJson.js";
3
+ import { REACT_LIBRARIES } from "../types/libraries.js";
4
+ import { createDiagnosticMessage } from "generaltranslation/internal";
5
+ import { minVersion } from "semver";
6
+ //#region src/utils/reactPackageCompatibility.ts
7
+ const MINIMUM_REACT_PACKAGE_MAJOR = 11;
8
+ function permitsVersionBelowMinimum(version) {
9
+ try {
10
+ const minimumVersion = minVersion(version);
11
+ return minimumVersion !== null && minimumVersion.major < MINIMUM_REACT_PACKAGE_MAJOR;
12
+ } catch {
13
+ return false;
14
+ }
15
+ }
16
+ async function warnReactPackageCompatibility(suppressWarning = false, cwd = process.cwd()) {
17
+ if (suppressWarning) return;
18
+ try {
19
+ const packageJson = await getPackageJson(cwd);
20
+ if (!packageJson) return;
21
+ const incompatiblePackages = REACT_LIBRARIES.flatMap((packageName) => {
22
+ const version = getPackageVersion(packageName, packageJson);
23
+ if (!version) return [];
24
+ return permitsVersionBelowMinimum(version) ? [`${packageName}@${version}`] : [];
25
+ });
26
+ if (incompatiblePackages.length === 0) return;
27
+ logger.warn(createDiagnosticMessage({
28
+ source: "gt",
29
+ severity: "Warning",
30
+ whatHappened: "This GT CLI may be incompatible with the listed React packages",
31
+ why: "versions before 11 include the ID parameter in translation keys and may cause retranslation",
32
+ fix: "Upgrade the listed packages to version 11 or later or install gt@2.14.58",
33
+ wayOut: "rerun with --suppress-id-compatibility-warning to hide this warning",
34
+ details: incompatiblePackages
35
+ }));
36
+ } catch {}
37
+ }
38
+ //#endregion
39
+ export { warnReactPackageCompatibility };
40
+
41
+ //# sourceMappingURL=reactPackageCompatibility.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reactPackageCompatibility.js","names":[],"sources":["../../src/utils/reactPackageCompatibility.ts"],"sourcesContent":["import { createDiagnosticMessage } from 'generaltranslation/internal';\nimport { minVersion } from 'semver';\nimport { logger } from '../console/logger.js';\nimport { REACT_LIBRARIES } from '../types/libraries.js';\nimport { getPackageJson, getPackageVersion } from './packageJson.js';\n\nconst MINIMUM_REACT_PACKAGE_MAJOR = 11;\n\nfunction permitsVersionBelowMinimum(version: string): boolean {\n // A range is potentially incompatible if it permits any version below the\n // minimum; invalid ranges (workspace:*, tags, URLs) fail open\n try {\n const minimumVersion = minVersion(version);\n return (\n minimumVersion !== null &&\n minimumVersion.major < MINIMUM_REACT_PACKAGE_MAJOR\n );\n } catch {\n return false;\n }\n}\n\nexport async function warnReactPackageCompatibility(\n suppressWarning: boolean = false,\n cwd: string = process.cwd()\n): Promise<void> {\n if (suppressWarning) return;\n\n try {\n const packageJson = await getPackageJson(cwd);\n if (!packageJson) return;\n\n const incompatiblePackages = REACT_LIBRARIES.flatMap((packageName) => {\n const version = getPackageVersion(packageName, packageJson);\n if (!version) return [];\n\n return permitsVersionBelowMinimum(version)\n ? [`${packageName}@${version}`]\n : [];\n });\n if (incompatiblePackages.length === 0) return;\n\n logger.warn(\n createDiagnosticMessage({\n source: 'gt',\n severity: 'Warning',\n whatHappened:\n 'This GT CLI may be incompatible with the listed React packages',\n why: 'versions before 11 include the ID parameter in translation keys and may cause retranslation',\n fix: 'Upgrade the listed packages to version 11 or later or install gt@2.14.58',\n wayOut:\n 'rerun with --suppress-id-compatibility-warning to hide this warning',\n details: incompatiblePackages,\n })\n );\n } catch {\n // Compatibility detection is best-effort and must not block the CLI.\n }\n}\n"],"mappings":";;;;;;AAMA,MAAM,8BAA8B;AAEpC,SAAS,2BAA2B,SAA0B;AAG5D,KAAI;EACF,MAAM,iBAAiB,WAAW,QAAQ;AAC1C,SACE,mBAAmB,QACnB,eAAe,QAAQ;SAEnB;AACN,SAAO;;;AAIX,eAAsB,8BACpB,kBAA2B,OAC3B,MAAc,QAAQ,KAAK,EACZ;AACf,KAAI,gBAAiB;AAErB,KAAI;EACF,MAAM,cAAc,MAAM,eAAe,IAAI;AAC7C,MAAI,CAAC,YAAa;EAElB,MAAM,uBAAuB,gBAAgB,SAAS,gBAAgB;GACpE,MAAM,UAAU,kBAAkB,aAAa,YAAY;AAC3D,OAAI,CAAC,QAAS,QAAO,EAAE;AAEvB,UAAO,2BAA2B,QAAQ,GACtC,CAAC,GAAG,YAAY,GAAG,UAAU,GAC7B,EAAE;IACN;AACF,MAAI,qBAAqB,WAAW,EAAG;AAEvC,SAAO,KACL,wBAAwB;GACtB,QAAQ;GACR,UAAU;GACV,cACE;GACF,KAAK;GACL,KAAK;GACL,QACE;GACF,SAAS;GACV,CAAC,CACH;SACK"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gt",
3
- "version": "2.14.62",
3
+ "version": "2.14.63",
4
4
  "main": "dist/index.js",
5
5
  "bin": "bin/main.js",
6
6
  "files": [
@@ -109,15 +109,16 @@
109
109
  "remark-parse": "^11.0.0",
110
110
  "remark-stringify": "^11.0.0",
111
111
  "resolve": "^1.22.10",
112
+ "semver": "^7.8.5",
112
113
  "smol-toml": "^1.3.1",
113
114
  "tsconfig-paths": "^4.2.0",
114
115
  "unified": "^11.0.5",
115
116
  "unist-util-visit": "^5.0.0",
116
117
  "yaml": "^2.8.0",
117
118
  "@generaltranslation/format": "0.1.2",
118
- "@generaltranslation/python-extractor": "0.2.28",
119
- "@generaltranslation/supported-locales": "2.1.8",
120
- "generaltranslation": "9.0.1",
119
+ "@generaltranslation/python-extractor": "0.2.29",
120
+ "@generaltranslation/supported-locales": "2.1.9",
121
+ "generaltranslation": "9.0.2",
121
122
  "gt-remark": "1.0.11"
122
123
  },
123
124
  "devDependencies": {
@@ -130,6 +131,7 @@
130
131
  "@types/node": "^22.13.5",
131
132
  "@types/react": "^18.3.4",
132
133
  "@types/resolve": "^1.20.2",
134
+ "@types/semver": "^7.7.1",
133
135
  "eslint": "^9.20.0",
134
136
  "esm": "^3.2.25",
135
137
  "mdast-util-mdx-jsx": "^3.2.0",
@@ -1,26 +0,0 @@
1
- import * as t from '@babel/types';
2
- import { ParsingConfig, ParsingOutput } from '../types.js';
3
- import { InlineMetadata } from '../processTranslationCall/extractStringEntryMetadata.js';
4
- import { NodePath } from '@babel/traverse';
5
- /**
6
- * Extracts a translatable message from a TaggedTemplateExpression.
7
- *
8
- * Follows the same extraction pattern as `extractInterpolatableValues` in
9
- * `packages/react/src/i18n-context/functions/translation/t.ts`:
10
- * - Iterates through quasis and expressions interleaved
11
- * - Creates numeric placeholders ({0}, {1}, etc.) for each expression
12
- * - Joins all parts into the final source string
13
- *
14
- * @param tPath - The path to the tag identifier
15
- * @param quasi - The TemplateLiteral from the TaggedTemplateExpression
16
- * @param metadata - Extracted metadata (empty for tagged templates)
17
- * @param config - Parsing configuration
18
- * @param output - Parsing output collectors
19
- */
20
- export declare function handleTaggedTemplateTranslationCall({ tPath, quasi, metadata, config, output, }: {
21
- tPath: NodePath;
22
- quasi: t.TemplateLiteral;
23
- metadata: InlineMetadata;
24
- config: ParsingConfig;
25
- output: ParsingOutput;
26
- }): void;
@@ -1,31 +0,0 @@
1
- import { deriveExpression } from "../derivation/index.js";
2
- //#region src/react/jsx/utils/stringParsing/processTaggedTemplateCall/handleTaggedTemplateTranslationCall.ts
3
- /**
4
- * Extracts a translatable message from a TaggedTemplateExpression.
5
- *
6
- * Follows the same extraction pattern as `extractInterpolatableValues` in
7
- * `packages/react/src/i18n-context/functions/translation/t.ts`:
8
- * - Iterates through quasis and expressions interleaved
9
- * - Creates numeric placeholders ({0}, {1}, etc.) for each expression
10
- * - Joins all parts into the final source string
11
- *
12
- * @param tPath - The path to the tag identifier
13
- * @param quasi - The TemplateLiteral from the TaggedTemplateExpression
14
- * @param metadata - Extracted metadata (empty for tagged templates)
15
- * @param config - Parsing configuration
16
- * @param output - Parsing output collectors
17
- */
18
- function handleTaggedTemplateTranslationCall({ tPath, quasi, metadata, config, output }) {
19
- deriveExpression({
20
- tPath,
21
- expr: quasi,
22
- metadata,
23
- config,
24
- output,
25
- enableRuntimeInterpolation: true
26
- });
27
- }
28
- //#endregion
29
- export { handleTaggedTemplateTranslationCall };
30
-
31
- //# sourceMappingURL=handleTaggedTemplateTranslationCall.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"handleTaggedTemplateTranslationCall.js","names":[],"sources":["../../../../../../src/react/jsx/utils/stringParsing/processTaggedTemplateCall/handleTaggedTemplateTranslationCall.ts"],"sourcesContent":["import * as t from '@babel/types';\nimport { ParsingConfig, ParsingOutput } from '../types.js';\nimport { InlineMetadata } from '../processTranslationCall/extractStringEntryMetadata.js';\nimport { NodePath } from '@babel/traverse';\nimport { deriveExpression } from '../derivation/index.js';\n\n/**\n * Extracts a translatable message from a TaggedTemplateExpression.\n *\n * Follows the same extraction pattern as `extractInterpolatableValues` in\n * `packages/react/src/i18n-context/functions/translation/t.ts`:\n * - Iterates through quasis and expressions interleaved\n * - Creates numeric placeholders ({0}, {1}, etc.) for each expression\n * - Joins all parts into the final source string\n *\n * @param tPath - The path to the tag identifier\n * @param quasi - The TemplateLiteral from the TaggedTemplateExpression\n * @param metadata - Extracted metadata (empty for tagged templates)\n * @param config - Parsing configuration\n * @param output - Parsing output collectors\n */\nexport function handleTaggedTemplateTranslationCall({\n tPath,\n quasi,\n metadata,\n config,\n output,\n}: {\n tPath: NodePath;\n quasi: t.TemplateLiteral;\n metadata: InlineMetadata;\n config: ParsingConfig;\n output: ParsingOutput;\n}): void {\n deriveExpression({\n tPath,\n expr: quasi,\n metadata,\n config,\n output,\n enableRuntimeInterpolation: true,\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAqBA,SAAgB,oCAAoC,EAClD,OACA,OACA,UACA,QACA,UAOO;AACP,kBAAiB;EACf;EACA,MAAM;EACN;EACA;EACA;EACA,4BAA4B;EAC7B,CAAC"}
@@ -1,23 +0,0 @@
1
- import { NodePath } from '@babel/traverse';
2
- import * as t from '@babel/types';
3
- import { ParsingConfig } from '../types.js';
4
- import { ParsingOutput } from '../types.js';
5
- import { InlineMetadata } from './extractStringEntryMetadata.js';
6
- /**
7
- * For the processTranslationCall function, this function handles the case where a string with derive is used.
8
- * @param arg - The argument to parse
9
- * @param metadata - The metadata to use
10
- * @param tPath - The path to the argument
11
- * @param config - The configuration to use
12
- * @param output - The output to use
13
- * @param index - Current index in array of strings being extracted
14
- */
15
- export declare function handleDeriveTranslationCall({ arg, metadata, tPath, config, output, index, contextVariants, }: {
16
- arg: t.Expression;
17
- metadata: InlineMetadata;
18
- tPath: NodePath;
19
- config: ParsingConfig;
20
- output: ParsingOutput;
21
- index?: number;
22
- contextVariants?: string[];
23
- }): void;
@@ -1,26 +0,0 @@
1
- import { deriveExpression } from "../derivation/index.js";
2
- //#region src/react/jsx/utils/stringParsing/processTranslationCall/handleDeriveTranslationCall.ts
3
- /**
4
- * For the processTranslationCall function, this function handles the case where a string with derive is used.
5
- * @param arg - The argument to parse
6
- * @param metadata - The metadata to use
7
- * @param tPath - The path to the argument
8
- * @param config - The configuration to use
9
- * @param output - The output to use
10
- * @param index - Current index in array of strings being extracted
11
- */
12
- function handleDeriveTranslationCall({ arg, metadata, tPath, config, output, index, contextVariants }) {
13
- deriveExpression({
14
- tPath,
15
- expr: arg,
16
- metadata,
17
- config,
18
- output,
19
- index,
20
- contextVariants
21
- });
22
- }
23
- //#endregion
24
- export { handleDeriveTranslationCall };
25
-
26
- //# sourceMappingURL=handleDeriveTranslationCall.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"handleDeriveTranslationCall.js","names":[],"sources":["../../../../../../src/react/jsx/utils/stringParsing/processTranslationCall/handleDeriveTranslationCall.ts"],"sourcesContent":["import { NodePath } from '@babel/traverse';\nimport * as t from '@babel/types';\nimport { ParsingConfig } from '../types.js';\nimport { ParsingOutput } from '../types.js';\nimport { deriveExpression } from '../derivation/index.js';\nimport { InlineMetadata } from './extractStringEntryMetadata.js';\n\n/**\n * For the processTranslationCall function, this function handles the case where a string with derive is used.\n * @param arg - The argument to parse\n * @param metadata - The metadata to use\n * @param tPath - The path to the argument\n * @param config - The configuration to use\n * @param output - The output to use\n * @param index - Current index in array of strings being extracted\n */\nexport function handleDeriveTranslationCall({\n arg,\n metadata,\n tPath,\n config,\n output,\n index,\n contextVariants,\n}: {\n arg: t.Expression;\n metadata: InlineMetadata;\n tPath: NodePath;\n config: ParsingConfig;\n output: ParsingOutput;\n index?: number;\n contextVariants?: string[];\n}): void {\n deriveExpression({\n tPath,\n expr: arg,\n metadata,\n config,\n output,\n index,\n contextVariants,\n });\n}\n"],"mappings":";;;;;;;;;;;AAgBA,SAAgB,4BAA4B,EAC1C,KACA,UACA,OACA,QACA,QACA,OACA,mBASO;AACP,kBAAiB;EACf;EACA,MAAM;EACN;EACA;EACA;EACA;EACA;EACD,CAAC"}