gtx-cli 2.6.18 → 2.6.19

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 (43) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/cli/base.js +3 -6
  3. package/dist/cli/inline.d.ts +2 -1
  4. package/dist/cli/inline.js +7 -2
  5. package/dist/cli/next.d.ts +2 -1
  6. package/dist/cli/next.js +2 -1
  7. package/dist/cli/node.d.ts +2 -1
  8. package/dist/cli/react.d.ts +2 -2
  9. package/dist/cli/react.js +2 -1
  10. package/dist/formats/files/collectFiles.js +2 -3
  11. package/dist/fs/determineFramework.js +10 -6
  12. package/dist/generated/version.d.ts +1 -1
  13. package/dist/generated/version.js +1 -1
  14. package/dist/index.js +5 -3
  15. package/dist/next/parse/wrapContent.d.ts +2 -1
  16. package/dist/next/parse/wrapContent.js +8 -7
  17. package/dist/react/jsx/utils/constants.d.ts +0 -11
  18. package/dist/react/jsx/utils/constants.js +0 -46
  19. package/dist/react/jsx/utils/getPathsAndAliases.d.ts +1 -1
  20. package/dist/react/jsx/utils/jsxParsing/parseJsx.d.ts +1 -1
  21. package/dist/react/jsx/utils/jsxParsing/parseTProps.js +2 -1
  22. package/dist/react/jsx/utils/mapAttributeName.d.ts +6 -0
  23. package/dist/react/jsx/utils/mapAttributeName.js +14 -0
  24. package/dist/react/jsx/utils/parseAst.d.ts +1 -1
  25. package/dist/react/jsx/utils/parseString.js +2 -1
  26. package/dist/react/jsx/utils/parseStringFunction.js +2 -1
  27. package/dist/react/parse/createInlineUpdates.d.ts +1 -1
  28. package/dist/react/parse/createInlineUpdates.js +2 -2
  29. package/dist/react/parse/wrapContent.d.ts +2 -1
  30. package/dist/react/parse/wrapContent.js +6 -6
  31. package/dist/setup/agentInstructions.js +5 -2
  32. package/dist/setup/frameworkUtils.js +4 -1
  33. package/dist/setup/instructions/base.md +6 -6
  34. package/dist/setup/instructions/gt-next.md +12 -12
  35. package/dist/setup/instructions/gt-react.md +12 -12
  36. package/dist/setup/wizard.js +10 -9
  37. package/dist/translation/parse.d.ts +2 -1
  38. package/dist/translation/stage.d.ts +2 -1
  39. package/dist/translation/validate.d.ts +4 -3
  40. package/dist/types/index.d.ts +3 -2
  41. package/dist/types/libraries.d.ts +31 -0
  42. package/dist/types/libraries.js +72 -0
  43. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # gtx-cli
2
2
 
3
+ ## 2.6.19
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1014](https://github.com/generaltranslation/gt/pull/1014) [`e421292`](https://github.com/generaltranslation/gt/commit/e421292739807db8696d7912da8b92731fb34b2b) Thanks [@ErnestM1234](https://github.com/ErnestM1234)! - refactor: library names
8
+
9
+ - [#1018](https://github.com/generaltranslation/gt/pull/1018) [`3ac2e30`](https://github.com/generaltranslation/gt/commit/3ac2e30dcd76bf5819f1a385397eb59bcc158732) Thanks [@ErnestM1234](https://github.com/ErnestM1234)! - fix: gt-react-native inline tx
10
+
3
11
  ## 2.6.18
4
12
 
5
13
  ### Patch Changes
package/dist/cli/base.js CHANGED
@@ -31,6 +31,7 @@ import { detectFramework } from '../setup/detectFramework.js';
31
31
  import { getFrameworkDisplayName, getReactFrameworkLibrary, } from '../setup/frameworkUtils.js';
32
32
  import { findAgentFiles, findAgentFilesWithInstructions, hasCursorRulesDir, CURSOR_GT_RULES_FILE, getAgentInstructions, appendAgentInstructions, } from '../setup/agentInstructions.js';
33
33
  import { determineLibrary } from '../fs/determineFramework.js';
34
+ import { INLINE_LIBRARIES } from '../types/libraries.js';
34
35
  export class BaseCLI {
35
36
  library;
36
37
  additionalModules;
@@ -162,9 +163,7 @@ export class BaseCLI {
162
163
  if (!options.keyType) {
163
164
  const packageJson = await searchForPackageJson();
164
165
  if (packageJson &&
165
- (isPackageInstalled('gt-next', packageJson) ||
166
- isPackageInstalled('gt-react', packageJson) ||
167
- isPackageInstalled('gt-node', packageJson))) {
166
+ INLINE_LIBRARIES.some((lib) => isPackageInstalled(lib, packageJson))) {
168
167
  options.keyType = 'development';
169
168
  }
170
169
  else {
@@ -298,9 +297,7 @@ export class BaseCLI {
298
297
  const packageJson = await searchForPackageJson();
299
298
  // Ask if using another i18n library
300
299
  const gtInstalled = !!packageJson &&
301
- (isPackageInstalled('gt-next', packageJson) ||
302
- isPackageInstalled('gt-react', packageJson) ||
303
- isPackageInstalled('gt-node', packageJson));
300
+ INLINE_LIBRARIES.some((lib) => isPackageInstalled(lib, packageJson));
304
301
  const isUsingGT = ranReactSetup || gtInstalled;
305
302
  // Ask where the translations are stored
306
303
  const usingCDN = await (async () => {
@@ -1,11 +1,12 @@
1
1
  import { Command } from 'commander';
2
2
  import { BaseCLI } from './base.js';
3
3
  import { SupportedLibraries, TranslateFlags, Options } from '../types/index.js';
4
+ import { InlineLibrary } from '../types/libraries.js';
4
5
  /**
5
6
  * Stand in for a CLI tool that does any sort of inline content translations
6
7
  */
7
8
  export declare class InlineCLI extends BaseCLI {
8
- constructor(command: Command, library: 'gt-react' | 'gt-next' | 'gt-node', additionalModules?: SupportedLibraries[]);
9
+ constructor(command: Command, library: InlineLibrary, additionalModules?: SupportedLibraries[]);
9
10
  init(): void;
10
11
  protected setupStageCommand(): void;
11
12
  protected setupTranslateCommand(): void;
@@ -12,6 +12,7 @@ import { generateSettings } from '../config/generateSettings.js';
12
12
  import { aggregateInlineTranslations } from '../translation/stage.js';
13
13
  import { validateConfigExists } from '../config/validateSettings.js';
14
14
  import { validateProject } from '../translation/validate.js';
15
+ import { Libraries } from '../types/libraries.js';
15
16
  /**
16
17
  * Stand in for a CLI tool that does any sort of inline content translations
17
18
  */
@@ -122,7 +123,11 @@ export class InlineCLI extends BaseCLI {
122
123
  }
123
124
  }
124
125
  function fallbackToGtReact(library) {
125
- return ['gt-next', 'gt-node'].includes(library)
126
+ return [
127
+ Libraries.GT_NEXT,
128
+ Libraries.GT_NODE,
129
+ Libraries.GT_REACT_NATIVE,
130
+ ].includes(library)
126
131
  ? library
127
- : 'gt-react';
132
+ : Libraries.GT_REACT;
128
133
  }
@@ -1,8 +1,9 @@
1
1
  import { WrapOptions, SupportedFrameworks, SupportedLibraries } from '../types/index.js';
2
2
  import { ReactCLI } from './react.js';
3
3
  import { Command } from 'commander';
4
+ import { Libraries } from '../types/libraries.js';
4
5
  export declare class NextCLI extends ReactCLI {
5
- constructor(command: Command, library: 'gt-next', additionalModules?: SupportedLibraries[]);
6
+ constructor(command: Command, library: typeof Libraries.GT_NEXT, additionalModules?: SupportedLibraries[]);
6
7
  protected wrapContent(options: WrapOptions, framework: SupportedFrameworks, errors: string[], warnings: string[]): Promise<{
7
8
  filesUpdated: string[];
8
9
  }>;
package/dist/cli/next.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { ReactCLI } from './react.js';
2
2
  import { wrapContentNext } from '../next/parse/wrapContent.js';
3
- const pkg = 'gt-next';
3
+ import { Libraries } from '../types/libraries.js';
4
+ const pkg = Libraries.GT_NEXT;
4
5
  export class NextCLI extends ReactCLI {
5
6
  constructor(command, library, additionalModules) {
6
7
  super(command, library, additionalModules);
@@ -1,9 +1,10 @@
1
1
  import { Command } from 'commander';
2
2
  import { SupportedLibraries } from '../types/index.js';
3
3
  import { InlineCLI } from './inline.js';
4
+ import { Libraries } from '../types/libraries.js';
4
5
  /**
5
6
  * CLI tool for managing translations with gt-node
6
7
  */
7
8
  export declare class NodeCLI extends InlineCLI {
8
- constructor(command: Command, library: 'gt-node', additionalModules?: SupportedLibraries[]);
9
+ constructor(command: Command, library: typeof Libraries.GT_NODE, additionalModules?: SupportedLibraries[]);
9
10
  }
@@ -1,8 +1,8 @@
1
1
  import { Command } from 'commander';
2
- import { SupportedFrameworks, WrapOptions, SupportedLibraries } from '../types/index.js';
2
+ import { Framework, SupportedFrameworks, WrapOptions, SupportedLibraries } from '../types/index.js';
3
3
  import { InlineCLI } from './inline.js';
4
4
  export declare class ReactCLI extends InlineCLI {
5
- constructor(command: Command, library: 'gt-react' | 'gt-next', additionalModules?: SupportedLibraries[]);
5
+ constructor(command: Command, library: Framework, additionalModules?: SupportedLibraries[]);
6
6
  init(): void;
7
7
  protected wrapContent(options: WrapOptions, framework: SupportedFrameworks, errors: string[], warnings: string[]): Promise<{
8
8
  filesUpdated: string[];
package/dist/cli/react.js CHANGED
@@ -6,7 +6,8 @@ import { wrapContentReact } from '../react/parse/wrapContent.js';
6
6
  import { generateSettings } from '../config/generateSettings.js';
7
7
  import { attachInlineTranslateFlags, attachTranslateFlags } from './flags.js';
8
8
  import { InlineCLI } from './inline.js';
9
- const pkg = 'gt-react';
9
+ import { Libraries } from '../types/libraries.js';
10
+ const pkg = Libraries.GT_REACT;
10
11
  export class ReactCLI extends InlineCLI {
11
12
  constructor(command, library, additionalModules) {
12
13
  super(command, library, additionalModules);
@@ -4,14 +4,13 @@ import { aggregateFiles } from '../../formats/files/translate.js';
4
4
  import { aggregateInlineTranslations } from '../../translation/stage.js';
5
5
  import { hashStringSync } from '../../utils/hash.js';
6
6
  import { TEMPLATE_FILE_NAME, TEMPLATE_FILE_ID } from '../../utils/constants.js';
7
+ import { isInlineLibrary } from '../../types/libraries.js';
7
8
  export async function collectFiles(options, settings, library) {
8
9
  // Aggregate files
9
10
  const allFiles = await aggregateFiles(settings);
10
11
  // Parse for React components
11
12
  let reactComponents = 0;
12
- if (library === 'gt-react' ||
13
- library === 'gt-next' ||
14
- library === 'gt-node') {
13
+ if (isInlineLibrary(library)) {
15
14
  const updates = await aggregateInlineTranslations(options, settings, library);
16
15
  if (updates.length > 0) {
17
16
  if (!settings.publish && !settings.files?.placeholderPaths.gt) {
@@ -2,6 +2,7 @@ import chalk from 'chalk';
2
2
  import path from 'node:path';
3
3
  import fs from 'node:fs';
4
4
  import { logger } from '../console/logger.js';
5
+ import { Libraries } from '../types/libraries.js';
5
6
  export function determineLibrary() {
6
7
  let library = 'base';
7
8
  const additionalModules = [];
@@ -21,14 +22,17 @@ export function determineLibrary() {
21
22
  ...packageJson.devDependencies,
22
23
  };
23
24
  // Check for gt-next or gt-react in dependencies
24
- if (dependencies['gt-next']) {
25
- library = 'gt-next';
25
+ if (dependencies[Libraries.GT_NEXT]) {
26
+ library = Libraries.GT_NEXT;
26
27
  }
27
- else if (dependencies['gt-react']) {
28
- library = 'gt-react';
28
+ else if (dependencies[Libraries.GT_REACT]) {
29
+ library = Libraries.GT_REACT;
29
30
  }
30
- else if (dependencies['gt-node']) {
31
- library = 'gt-node';
31
+ else if (dependencies[Libraries.GT_REACT_NATIVE]) {
32
+ library = Libraries.GT_REACT_NATIVE;
33
+ }
34
+ else if (dependencies[Libraries.GT_NODE]) {
35
+ library = Libraries.GT_NODE;
32
36
  }
33
37
  else if (dependencies['next-intl']) {
34
38
  library = 'next-intl';
@@ -1 +1 @@
1
- export declare const PACKAGE_VERSION = "2.6.18";
1
+ export declare const PACKAGE_VERSION = "2.6.19";
@@ -1,2 +1,2 @@
1
1
  // This file is auto-generated. Do not edit manually.
2
- export const PACKAGE_VERSION = '2.6.18';
2
+ export const PACKAGE_VERSION = '2.6.19';
package/dist/index.js CHANGED
@@ -3,17 +3,19 @@ import { NextCLI } from './cli/next.js';
3
3
  import { ReactCLI } from './cli/react.js';
4
4
  import { determineLibrary } from './fs/determineFramework.js';
5
5
  import { NodeCLI } from './cli/node.js';
6
+ import { Libraries } from './types/libraries.js';
6
7
  export function main(program) {
7
8
  program.name('gtx-cli');
8
9
  const { library, additionalModules } = determineLibrary();
9
10
  let cli;
10
- if (library === 'gt-next') {
11
+ if (library === Libraries.GT_NEXT) {
11
12
  cli = new NextCLI(program, library, additionalModules);
12
13
  }
13
- else if (library === 'gt-react') {
14
+ else if (library === Libraries.GT_REACT ||
15
+ library === Libraries.GT_REACT_NATIVE) {
14
16
  cli = new ReactCLI(program, library, additionalModules);
15
17
  }
16
- else if (library === 'gt-node') {
18
+ else if (library === Libraries.GT_NODE) {
17
19
  cli = new NodeCLI(program, library, additionalModules);
18
20
  }
19
21
  else {
@@ -1,4 +1,5 @@
1
1
  import { WrapOptions } from '../../types/index.js';
2
+ import { Libraries } from '../../types/libraries.js';
2
3
  /**
3
4
  * Wraps all JSX elements in the src directory with a <T> tag, with unique ids.
4
5
  * - Ignores pure strings
@@ -6,6 +7,6 @@ import { WrapOptions } from '../../types/index.js';
6
7
  * @param options - The options object
7
8
  * @returns An object containing the updates and errors
8
9
  */
9
- export declare function wrapContentNext(options: WrapOptions, pkg: 'gt-next', errors: string[], warnings: string[]): Promise<{
10
+ export declare function wrapContentNext(options: WrapOptions, pkg: typeof Libraries.GT_NEXT, errors: string[], warnings: string[]): Promise<{
10
11
  filesUpdated: string[];
11
12
  }>;
@@ -13,13 +13,14 @@ import { isHtmlElement, isBodyElement, hasGTProviderChild, addDynamicLangAttribu
13
13
  import { generateImportMap, createImports, } from '../../react/jsx/utils/parseAst.js';
14
14
  import { matchFiles } from '../../fs/matchFiles.js';
15
15
  import { DEFAULT_SRC_PATTERNS } from '../../config/generateSettings.js';
16
+ import { Libraries } from '../../types/libraries.js';
16
17
  const IMPORT_MAP = {
17
- T: { name: 'T', source: 'gt-next' },
18
- Var: { name: 'Var', source: 'gt-next' },
19
- GTT: { name: 'T', source: 'gt-next' },
20
- GTVar: { name: 'Var', source: 'gt-next' },
21
- GTProvider: { name: 'GTProvider', source: 'gt-next' },
22
- getLocale: { name: 'getLocale', source: 'gt-next/server' },
18
+ T: { name: 'T', source: Libraries.GT_NEXT },
19
+ Var: { name: 'Var', source: Libraries.GT_NEXT },
20
+ GTT: { name: 'T', source: Libraries.GT_NEXT },
21
+ GTVar: { name: 'Var', source: Libraries.GT_NEXT },
22
+ GTProvider: { name: 'GTProvider', source: Libraries.GT_NEXT },
23
+ getLocale: { name: 'getLocale', source: Libraries.GT_NEXT + '/server' },
23
24
  };
24
25
  /**
25
26
  * Wraps all JSX elements in the src directory with a <T> tag, with unique ids.
@@ -58,7 +59,7 @@ export async function wrapContentNext(options, pkg, errors, warnings) {
58
59
  let globalId = 0;
59
60
  traverse(ast, {
60
61
  JSXElement(path) {
61
- if (pkg === 'gt-next' &&
62
+ if (pkg === Libraries.GT_NEXT &&
62
63
  options.addGTProvider &&
63
64
  isHtmlElement(path.node.openingElement)) {
64
65
  // Find the body element recursively in the HTML tree
@@ -11,14 +11,3 @@ export declare const GT_TRANSLATION_FUNCS: string[];
11
11
  export declare const VARIABLE_COMPONENTS: string[];
12
12
  export declare const GT_ATTRIBUTES_WITH_SUGAR: readonly ["$id", "$context", "$maxChars"];
13
13
  export declare const GT_ATTRIBUTES: readonly ["id", "context", "maxChars", "$id", "$context", "$maxChars"];
14
- export declare function mapAttributeName(attrName: string): string;
15
- export declare const GT_LIBRARIES: readonly ["gt-react", "gt-next", "gt-react-native", "gt-node", "gt-i18n", "@generaltranslation/react-core"];
16
- export type GTLibrary = (typeof GT_LIBRARIES)[number];
17
- /**
18
- * GT Libraries that use react translations
19
- */
20
- export type GTReactLibrary = 'gt-react' | 'gt-react-native' | 'gt-next' | '@generaltranslation/react-core';
21
- /**
22
- * A mapping of each library to their upstream dependencies for filtering imports
23
- */
24
- export declare const GT_LIBRARIES_UPSTREAM: Record<GTLibrary, GTLibrary[]>;
@@ -44,49 +44,3 @@ export const GT_ATTRIBUTES = [
44
44
  'maxChars',
45
45
  ...GT_ATTRIBUTES_WITH_SUGAR,
46
46
  ];
47
- export function mapAttributeName(attrName) {
48
- if (attrName === '$id')
49
- return 'id';
50
- if (attrName === '$context')
51
- return 'context';
52
- if (attrName === '$maxChars')
53
- return 'maxChars';
54
- return attrName;
55
- }
56
- export const GT_LIBRARIES = [
57
- 'gt-react',
58
- 'gt-next',
59
- 'gt-react-native',
60
- 'gt-node',
61
- 'gt-i18n',
62
- '@generaltranslation/react-core',
63
- ];
64
- /**
65
- * A mapping of each library to their upstream dependencies for filtering imports
66
- */
67
- export const GT_LIBRARIES_UPSTREAM = {
68
- 'gt-next': [
69
- 'gt-i18n',
70
- '@generaltranslation/react-core',
71
- 'gt-react',
72
- 'gt-next',
73
- ],
74
- 'gt-react': [
75
- 'gt-i18n',
76
- '@generaltranslation/react-core',
77
- 'gt-react',
78
- 'gt-react-native', // allow for cross-library compatibility (gt-react/gt-react-native only)
79
- ],
80
- 'gt-react-native': [
81
- 'gt-i18n',
82
- '@generaltranslation/react-core',
83
- 'gt-react-native',
84
- 'gt-react', // allow for cross-library compatibility (gt-react/gt-react-native only)
85
- ],
86
- 'gt-node': ['gt-i18n', '@generaltranslation/react-core', 'gt-node'],
87
- '@generaltranslation/react-core': [
88
- 'gt-i18n',
89
- '@generaltranslation/react-core',
90
- ],
91
- 'gt-i18n': ['gt-i18n'],
92
- };
@@ -1,5 +1,5 @@
1
1
  import { NodePath } from '@babel/traverse';
2
- import { GTLibrary } from '../../jsx/utils/constants.js';
2
+ import { GTLibrary } from '../../../types/libraries.js';
3
3
  /**
4
4
  * Constructs tracking for gt related variables of interest
5
5
  * inlineTranslationPaths: these are string-related translation functions
@@ -1,7 +1,7 @@
1
1
  import { Updates } from '../../../../types/index.js';
2
2
  import { ParsingConfigOptions } from '../../../../types/parsing.js';
3
3
  import traverseModule from '@babel/traverse';
4
- import { GTLibrary } from '../constants.js';
4
+ import { GTLibrary } from '../../../../types/libraries.js';
5
5
  /**
6
6
  * Immutable configuration options for parsing.
7
7
  */
@@ -2,7 +2,8 @@ import * as t from '@babel/types';
2
2
  import generateModule from '@babel/generator';
3
3
  // Handle CommonJS/ESM interop
4
4
  const generate = generateModule.default || generateModule;
5
- import { GT_ATTRIBUTES, mapAttributeName } from '../constants.js';
5
+ import { GT_ATTRIBUTES } from '../constants.js';
6
+ import { mapAttributeName } from '../mapAttributeName.js';
6
7
  import { isStaticExpression } from '../../evaluateJsx.js';
7
8
  import { warnInvalidMaxCharsSync, warnVariablePropSync, } from '../../../../console/index.js';
8
9
  import { isNumberLiteral } from '../isNumberLiteral.js';
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Map the attribute name to the corresponding attribute name in the metadata
3
+ * @param attrName - The attribute name to map
4
+ * @returns The mapped attribute name
5
+ */
6
+ export declare function mapAttributeName(attrName: string): string;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Map the attribute name to the corresponding attribute name in the metadata
3
+ * @param attrName - The attribute name to map
4
+ * @returns The mapped attribute name
5
+ */
6
+ export function mapAttributeName(attrName) {
7
+ if (attrName === '$id')
8
+ return 'id';
9
+ if (attrName === '$context')
10
+ return 'context';
11
+ if (attrName === '$maxChars')
12
+ return 'maxChars';
13
+ return attrName;
14
+ }
@@ -1,7 +1,7 @@
1
1
  import * as t from '@babel/types';
2
2
  import { ParseResult } from '@babel/parser';
3
3
  import { ImportDeclaration, VariableDeclaration } from '@babel/types';
4
- import { GTLibrary } from './constants.js';
4
+ import { GTLibrary } from '../../../types/libraries.js';
5
5
  export declare function determineModuleType(ast: ParseResult<t.File>): boolean;
6
6
  export type ImportItem = string | {
7
7
  local: string;
@@ -5,7 +5,8 @@ import { parse } from '@babel/parser';
5
5
  import fs from 'node:fs';
6
6
  import { warnDeclareStaticNoResultsSync, warnFunctionNotFoundSync, warnInvalidDeclareVarNameSync, } from '../../../console/index.js';
7
7
  import traverseModule from '@babel/traverse';
8
- import { DECLARE_VAR_FUNCTION, GT_LIBRARIES } from './constants.js';
8
+ import { DECLARE_VAR_FUNCTION } from '../../jsx/utils/constants.js';
9
+ import { GT_LIBRARIES } from '../../../types/libraries.js';
9
10
  import { declareVar } from 'generaltranslation/internal';
10
11
  import { isStaticExpression } from '../evaluateJsx.js';
11
12
  import generateModule from '@babel/generator';
@@ -1,6 +1,7 @@
1
1
  import * as t from '@babel/types';
2
2
  import { isStaticExpression, isValidIcu } from '../evaluateJsx.js';
3
- import { GT_ATTRIBUTES_WITH_SUGAR, MSG_REGISTRATION_FUNCTION, INLINE_TRANSLATION_HOOK, INLINE_TRANSLATION_HOOK_ASYNC, mapAttributeName, INLINE_MESSAGE_HOOK, INLINE_MESSAGE_HOOK_ASYNC, } from './constants.js';
3
+ import { GT_ATTRIBUTES_WITH_SUGAR, MSG_REGISTRATION_FUNCTION, INLINE_TRANSLATION_HOOK, INLINE_TRANSLATION_HOOK_ASYNC, INLINE_MESSAGE_HOOK, INLINE_MESSAGE_HOOK_ASYNC, } from './constants.js';
4
+ import { mapAttributeName } from './mapAttributeName.js';
4
5
  import { warnNonStaticExpressionSync, warnNonStringSync, warnTemplateLiteralSync, warnAsyncUseGT, warnSyncGetGT, warnInvalidIcuSync, warnInvalidMaxCharsSync, } from '../../../console/index.js';
5
6
  import generateModule from '@babel/generator';
6
7
  import traverseModule from '@babel/traverse';
@@ -1,6 +1,6 @@
1
1
  import { Updates } from '../../types/index.js';
2
2
  import type { ParsingConfigOptions } from '../../types/parsing.js';
3
- import { GTLibrary } from '../jsx/utils/constants.js';
3
+ import { GTLibrary } from '../../types/libraries.js';
4
4
  export declare function createInlineUpdates(pkg: GTLibrary, validate: boolean, filePatterns: string[] | undefined, parsingOptions: ParsingConfigOptions): Promise<{
5
5
  updates: Updates;
6
6
  errors: string[];
@@ -7,7 +7,7 @@ import { logger } from '../../console/logger.js';
7
7
  import { matchFiles } from '../../fs/matchFiles.js';
8
8
  import { DEFAULT_SRC_PATTERNS } from '../../config/generateSettings.js';
9
9
  import { getPathsAndAliases } from '../jsx/utils/getPathsAndAliases.js';
10
- import { GT_LIBRARIES_UPSTREAM } from '../jsx/utils/constants.js';
10
+ import { GT_LIBRARIES_UPSTREAM, REACT_LIBRARIES, } from '../../types/libraries.js';
11
11
  export async function createInlineUpdates(pkg, validate, filePatterns, parsingOptions) {
12
12
  const updates = [];
13
13
  const errors = [];
@@ -41,7 +41,7 @@ export async function createInlineUpdates(pkg, validate, filePatterns, parsingOp
41
41
  }, { updates, errors, warnings });
42
42
  }
43
43
  // Parse <T> components
44
- if (pkg !== 'gt-node') {
44
+ if (REACT_LIBRARIES.includes(pkg)) {
45
45
  for (const { localName, path } of translationComponentPaths) {
46
46
  parseTranslationComponent({
47
47
  originalName: localName,
@@ -1,4 +1,5 @@
1
1
  import { SupportedFrameworks, WrapOptions } from '../../types/index.js';
2
+ import { Libraries } from '../../types/libraries.js';
2
3
  /**
3
4
  * Wraps all JSX elements in the src directory with a <T> tag, with unique ids.
4
5
  * - Ignores pure strings
@@ -6,6 +7,6 @@ import { SupportedFrameworks, WrapOptions } from '../../types/index.js';
6
7
  * @param options - The options object
7
8
  * @returns An object containing the updates and errors
8
9
  */
9
- export declare function wrapContentReact(options: WrapOptions, pkg: 'gt-react', framework: SupportedFrameworks, errors: string[], warnings: string[]): Promise<{
10
+ export declare function wrapContentReact(options: WrapOptions, pkg: typeof Libraries.GT_REACT, framework: SupportedFrameworks, errors: string[], warnings: string[]): Promise<{
10
11
  filesUpdated: string[];
11
12
  }>;
@@ -13,13 +13,13 @@ import { getRelativePath } from '../../fs/findFilepath.js';
13
13
  import { generateImportMap, createImports, } from '../jsx/utils/parseAst.js';
14
14
  import { DEFAULT_SRC_PATTERNS } from '../../config/generateSettings.js';
15
15
  import { matchFiles } from '../../fs/matchFiles.js';
16
+ import { Libraries } from '../../types/libraries.js';
16
17
  const IMPORT_MAP = {
17
- T: { name: 'T', source: 'gt-react' },
18
- Var: { name: 'Var', source: 'gt-react' },
19
- GTT: { name: 'T', source: 'gt-react' },
20
- GTVar: { name: 'Var', source: 'gt-react' },
21
- GTProvider: { name: 'GTProvider', source: 'gt-react' },
22
- // getLocale: { name: 'getLocale', source: 'gt-react/server' },
18
+ T: { name: 'T', source: Libraries.GT_REACT },
19
+ Var: { name: 'Var', source: Libraries.GT_REACT },
20
+ GTT: { name: 'T', source: Libraries.GT_REACT },
21
+ GTVar: { name: 'Var', source: Libraries.GT_REACT },
22
+ GTProvider: { name: 'GTProvider', source: Libraries.GT_REACT },
23
23
  };
24
24
  /**
25
25
  * Wraps all JSX elements in the src directory with a <T> tag, with unique ids.
@@ -2,6 +2,7 @@ import fs from 'node:fs';
2
2
  import path from 'node:path';
3
3
  import { fileURLToPath } from 'node:url';
4
4
  import { getCLIVersion, getPackageVersion } from '../utils/packageJson.js';
5
+ import { Libraries } from '../types/libraries.js';
5
6
  const INSTRUCTIONS_DIR = path.resolve(path.dirname(fileURLToPath(import.meta.url)), 'instructions');
6
7
  const AGENT_FILE_PATHS = [
7
8
  'CLAUDE.md',
@@ -75,8 +76,10 @@ export function getAgentInstructions(library) {
75
76
  const base = fs.readFileSync(path.join(INSTRUCTIONS_DIR, 'base.md'), 'utf8');
76
77
  let body = '';
77
78
  const libToFile = {
78
- 'gt-next': 'gt-next.md',
79
- 'gt-react': 'gt-react.md',
79
+ [Libraries.GT_NEXT]: 'gt-next.md',
80
+ [Libraries.GT_REACT]: 'gt-react.md',
81
+ // TODO: add gt-react-native.md
82
+ [Libraries.GT_REACT_NATIVE]: 'gt-react.md',
80
83
  };
81
84
  const instructionFile = libToFile[library];
82
85
  if (instructionFile) {
@@ -1,3 +1,4 @@
1
+ import { Libraries } from '../types/libraries.js';
1
2
  export function getFrameworkDisplayName(frameworkObject) {
2
3
  if (frameworkObject.name === 'mintlify') {
3
4
  return 'Mintlify';
@@ -23,5 +24,7 @@ export function getFrameworkDisplayName(frameworkObject) {
23
24
  return 'another framework';
24
25
  }
25
26
  export function getReactFrameworkLibrary(frameworkObject) {
26
- return frameworkObject.name === 'next-app' ? 'gt-next' : 'gt-react';
27
+ return frameworkObject.name === 'next-app'
28
+ ? Libraries.GT_NEXT
29
+ : Libraries.GT_REACT;
27
30
  }
@@ -1,8 +1,8 @@
1
- ## General Translation (GT) Internationalization Rules
1
+ # General Translation (GT) Internationalization Rules
2
2
 
3
3
  This project is using [General Translation](https://generaltranslation.com/docs/overview.md) for internationalization (i18n) and translations. General Translation is a developer-first localization stack, built for the world's best engineering teams to ship apps in every language with ease.
4
4
 
5
- ### Configuration
5
+ ## Configuration
6
6
 
7
7
  The General Translation configuration file is called `gt.config.json`. It is usually located in the root or src directory of a project.
8
8
 
@@ -18,12 +18,12 @@ The General Translation configuration file is called `gt.config.json`. It is usu
18
18
  }
19
19
  ```
20
20
 
21
- The API reference for the config file can be found at https://generaltranslation.com/docs/cli/reference/config.md.
21
+ The API reference for the config file can be found at <https://generaltranslation.com/docs/cli/reference/config.md>.
22
22
 
23
- ### Translation
23
+ ## Translation
24
24
 
25
25
  Run `npx gtx-cli translate` to create translation files for your project. You must have an API key to do this.
26
26
 
27
- ### Documentation
27
+ ## Documentation
28
28
 
29
- https://generaltranslation.com/llms.txt
29
+ <https://generaltranslation.com/llms.txt>
@@ -1,14 +1,14 @@
1
- ### gt-next
1
+ # gt-next
2
2
 
3
3
  This project is using the `gt-next` internationalization library for Next.js App Router.
4
4
 
5
- ### gt-next setup
5
+ ## gt-next setup
6
6
 
7
7
  - `GTProvider` must wrap the app in the root layout to provide translation context.
8
8
  - The `withGTConfig()` plugin wraps `next.config` in the Next.js config file.
9
9
  - (optional) `createNextMiddleware()` is used in `proxy.ts` for automatic locale routing.
10
10
 
11
- ### Translating JSX
11
+ ## Translating JSX
12
12
 
13
13
  `gt-next` uses the `<T>` component for translation.
14
14
 
@@ -26,7 +26,7 @@ import { T } from 'gt-next';
26
26
  </T>;
27
27
  ```
28
28
 
29
- You can also add a `context` prop to `<T>` to give context to the translator. For example:
29
+ You can also add a `context` prop to `<T>` to give context to the translator. For example:
30
30
 
31
31
  ```jsx
32
32
  import { T } from 'gt-next';
@@ -36,7 +36,7 @@ import { T } from 'gt-next';
36
36
  </T>;
37
37
  ```
38
38
 
39
- ### Translating simple strings
39
+ ## Translating simple strings
40
40
 
41
41
  Use the `gt` function returned by the `useGT()` hook to translate strings directly. Invoke `useGT()` in synchronous components or `await getGT()` in async components only.
42
42
 
@@ -54,9 +54,9 @@ gt('Hello, world!');
54
54
 
55
55
  - Just like with the children of the `<T>` component, all strings passed to `gt()` must be static string literals. No variables or template literals.
56
56
 
57
- ### Translating shared or out-of-scope strings
57
+ ## Translating shared or out-of-scope strings
58
58
 
59
- Use `msg()` to register strings for translation, and `useMessages()` to translate them. `const m = useMessages()` should be used equivalently to `const gt = useGT()`.
59
+ Use `msg()` to register strings for translation, and `useMessages()` to translate them. `const m = useMessages()` should be used equivalently to `const gt = useGT()`.
60
60
 
61
61
  ```js
62
62
  import { msg, useMessages } from 'gt-next';
@@ -73,7 +73,7 @@ export default function Greeting() {
73
73
  - Use the equivalent `await getMessages()` for async components.
74
74
  - `useMessages()` / `getMessages()` take no arguments.
75
75
 
76
- ### Dynamic content inside `<T>`
76
+ ## Dynamic content inside `<T>`
77
77
 
78
78
  Use variable components for dynamic values inside `<T>`:
79
79
 
@@ -90,9 +90,9 @@ import { T, Var, Num } from 'gt-next';
90
90
  </T>;
91
91
  ```
92
92
 
93
- ### Utility hooks
93
+ ## Utility hooks
94
94
 
95
- #### `useLocale()`
95
+ ### `useLocale()`
96
96
 
97
97
  `useLocale` returns the user's current language, as a BCP 47 locale tag.
98
98
 
@@ -102,6 +102,6 @@ import { useLocale } from 'gt-next'
102
102
  const locale = useLocale(); // "en-US"
103
103
  ```
104
104
 
105
- ### Quickstart
105
+ ## Quickstart
106
106
 
107
- See https://generaltranslation.com/docs/next.md
107
+ See <https://generaltranslation.com/docs/next.md>
@@ -1,12 +1,12 @@
1
- ### gt-react
1
+ # gt-react
2
2
 
3
3
  This project is using the `gt-react` internationalization library.
4
4
 
5
- ### gt-react setup
5
+ ## gt-react setup
6
6
 
7
7
  - `GTProvider` must wrap the app in the root layout to provide translation context.
8
8
 
9
- ### Translating JSX
9
+ ## Translating JSX
10
10
 
11
11
  `gt-react` uses the `<T>` component for translation.
12
12
 
@@ -24,7 +24,7 @@ import { T } from 'gt-react';
24
24
  </T>;
25
25
  ```
26
26
 
27
- You can also add a `context` prop to `<T>` to give context to the translator. For example:
27
+ You can also add a `context` prop to `<T>` to give context to the translator. For example:
28
28
 
29
29
  ```jsx
30
30
  import { T } from 'gt-react';
@@ -34,7 +34,7 @@ import { T } from 'gt-react';
34
34
  </T>;
35
35
  ```
36
36
 
37
- ### Translating simple strings
37
+ ## Translating simple strings
38
38
 
39
39
  Use the `gt` function returned by the `useGT()` hook to translate strings directly.
40
40
 
@@ -46,9 +46,9 @@ gt('Hello, world!'); // returns "Hola, mundo"
46
46
 
47
47
  - Just like with the children of the `<T>` component, all strings passed to `gt()` must be static string literals. No variables or template literals.
48
48
 
49
- ### Translating shared or out-of-scope strings
49
+ ## Translating shared or out-of-scope strings
50
50
 
51
- Use `msg()` to register strings for translation, and `useMessages()` to translate them. `const m = useMessages()` should be used equivalently to `const gt = useGT()`.
51
+ Use `msg()` to register strings for translation, and `useMessages()` to translate them. `const m = useMessages()` should be used equivalently to `const gt = useGT()`.
52
52
 
53
53
  ```js
54
54
  import { msg, useMessages } from 'gt-react';
@@ -64,7 +64,7 @@ export default function Greeting() {
64
64
  - All strings passed to `msg()` must be static string literals. No variables or template literals.
65
65
  - `useMessages()` / `getMessages()` take no arguments.
66
66
 
67
- ### Dynamic content inside `<T>`
67
+ ## Dynamic content inside `<T>`
68
68
 
69
69
  Use variable components for dynamic values inside `<T>`:
70
70
 
@@ -81,9 +81,9 @@ import { T, Var, Num } from 'gt-react';
81
81
  </T>;
82
82
  ```
83
83
 
84
- ### Utility hooks
84
+ ## Utility hooks
85
85
 
86
- #### `useLocale()`
86
+ ### `useLocale()`
87
87
 
88
88
  `useLocale` returns the user's current language, as a BCP 47 locale tag.
89
89
 
@@ -93,6 +93,6 @@ import { useLocale } from 'gt-react'
93
93
  const locale = useLocale(); // "en-US"
94
94
  ```
95
95
 
96
- ### Quickstart
96
+ ## Quickstart
97
97
 
98
- See https://generaltranslation.com/docs/react.md
98
+ See <https://generaltranslation.com/docs/react.md>
@@ -15,6 +15,7 @@ import { loadConfig } from '../fs/config/loadConfig.js';
15
15
  import { addVitePlugin } from '../react/parse/addVitePlugin/index.js';
16
16
  import { exitSync } from '../console/logging.js';
17
17
  import { getFrameworkDisplayName } from './frameworkUtils.js';
18
+ import { Libraries } from '../types/libraries.js';
18
19
  export async function handleSetupReactCommand(options, frameworkObject, useDefaults = false) {
19
20
  const frameworkDisplayName = getFrameworkDisplayName(frameworkObject);
20
21
  // Ask user for confirmation using inquirer
@@ -62,20 +63,20 @@ Please let us know what you would like to see added at https://github.com/genera
62
63
  }
63
64
  // Check if gt-next or gt-react is installed
64
65
  if (frameworkType === 'next-app' &&
65
- !isPackageInstalled('gt-next', packageJson)) {
66
+ !isPackageInstalled(Libraries.GT_NEXT, packageJson)) {
66
67
  const packageManager = await getPackageManager();
67
68
  const spinner = logger.createSpinner('timer');
68
- spinner.start(`Installing gt-next with ${packageManager.name}...`);
69
- await installPackage('gt-next', packageManager);
70
- spinner.stop(chalk.green('Automatically installed gt-next.'));
69
+ spinner.start(`Installing ${Libraries.GT_NEXT} with ${packageManager.name}...`);
70
+ await installPackage(Libraries.GT_NEXT, packageManager);
71
+ spinner.stop(chalk.green(`Automatically installed ${Libraries.GT_NEXT}.`));
71
72
  }
72
73
  else if (['next-pages', 'react', 'redwood', 'vite', 'gatsby'].includes(frameworkType) &&
73
- !isPackageInstalled('gt-react', packageJson)) {
74
+ !isPackageInstalled(Libraries.GT_REACT, packageJson)) {
74
75
  const packageManager = await getPackageManager();
75
76
  const spinner = logger.createSpinner('timer');
76
- spinner.start(`Installing gt-react with ${packageManager.name}...`);
77
- await installPackage('gt-react', packageManager);
78
- spinner.stop(chalk.green('Automatically installed gt-react.'));
77
+ spinner.start(`Installing ${Libraries.GT_REACT} with ${packageManager.name}...`);
78
+ await installPackage(Libraries.GT_REACT, packageManager);
79
+ spinner.stop(chalk.green(`Automatically installed ${Libraries.GT_REACT}.`));
79
80
  }
80
81
  const errors = [];
81
82
  const warnings = [];
@@ -105,7 +106,7 @@ Please let us know what you would like to see added at https://github.com/genera
105
106
  const spinner = logger.createSpinner();
106
107
  spinner.start('Wrapping JSX content with <T> tags...');
107
108
  // Wrap all JSX elements in the src directory with a <T> tag, with unique ids
108
- const { filesUpdated: filesUpdatedNext } = await wrapContentNext(mergeOptions, 'gt-next', errors, warnings);
109
+ const { filesUpdated: filesUpdatedNext } = await wrapContentNext(mergeOptions, Libraries.GT_NEXT, errors, warnings);
109
110
  filesUpdated = [...filesUpdated, ...filesUpdatedNext];
110
111
  spinner.stop(chalk.green(`Success! Updated ${chalk.bold.cyan(filesUpdated.length)} files:\n`) + filesUpdated.map((file) => `${chalk.green('-')} ${file}`).join('\n'));
111
112
  // Add the withGTConfig() function to the next.config.js file
@@ -1,5 +1,6 @@
1
1
  import { Updates, TranslateFlags } from '../types/index.js';
2
2
  import type { ParsingConfigOptions } from '../types/parsing.js';
3
+ import { InlineLibrary } from '../types/libraries.js';
3
4
  /**
4
5
  * Searches for gt-react or gt-next dictionary files and creates updates for them,
5
6
  * as well as inline updates for <T> tags and useGT()/getGT() calls
@@ -9,7 +10,7 @@ import type { ParsingConfigOptions } from '../types/parsing.js';
9
10
  * @param pkg - The package name
10
11
  * @returns An object containing the updates and errors
11
12
  */
12
- export declare function createUpdates(options: TranslateFlags, src: string[] | undefined, sourceDictionary: string | undefined, pkg: 'gt-react' | 'gt-next' | 'gt-node', validate: boolean, parsingOptions: ParsingConfigOptions): Promise<{
13
+ export declare function createUpdates(options: TranslateFlags, src: string[] | undefined, sourceDictionary: string | undefined, pkg: InlineLibrary, validate: boolean, parsingOptions: ParsingConfigOptions): Promise<{
13
14
  updates: Updates;
14
15
  errors: string[];
15
16
  warnings: string[];
@@ -1,2 +1,3 @@
1
1
  import { Settings, TranslateFlags, Updates } from '../types/index.js';
2
- export declare function aggregateInlineTranslations(options: TranslateFlags, settings: Settings, library: 'gt-react' | 'gt-next' | 'gt-node'): Promise<Updates>;
2
+ import { InlineLibrary } from '../types/libraries.js';
3
+ export declare function aggregateInlineTranslations(options: TranslateFlags, settings: Settings, library: InlineLibrary): Promise<Updates>;
@@ -1,4 +1,5 @@
1
- import { Options, Settings } from '../types/index.js';
1
+ import { Framework, Options, Settings } from '../types/index.js';
2
+ import { InlineLibrary } from '../types/libraries.js';
2
3
  export type ValidationLevel = 'error' | 'warning';
3
4
  export type ValidationMessage = {
4
5
  level: ValidationLevel;
@@ -9,5 +10,5 @@ export type ValidationResult = Record<string, ValidationMessage[]>;
9
10
  * Programmatic API for validation - returns structured results instead of logging/exiting.
10
11
  * Equivalent to running `gtx-cli validate` but returns data.
11
12
  */
12
- export declare function getValidateJson(settings: Options & Settings, pkg: 'gt-react' | 'gt-next', files?: string[]): Promise<ValidationResult>;
13
- export declare function validateProject(settings: Options & Settings, pkg: 'gt-react' | 'gt-next' | 'gt-node', files?: string[]): Promise<void>;
13
+ export declare function getValidateJson(settings: Options & Settings, pkg: Framework, files?: string[]): Promise<ValidationResult>;
14
+ export declare function validateProject(settings: Options & Settings, pkg: InlineLibrary, files?: string[]): Promise<void>;
@@ -1,6 +1,7 @@
1
1
  import { CustomMapping } from 'generaltranslation/types';
2
2
  import { SUPPORTED_FILE_EXTENSIONS } from '../formats/files/supportedFiles.js';
3
3
  import { ParsingConfigOptions } from './parsing.js';
4
+ import { Libraries, InlineLibrary } from './libraries.js';
4
5
  export type { Updates } from 'generaltranslation/types';
5
6
  export type Options = {
6
7
  config: string;
@@ -95,7 +96,7 @@ export type GenerateSourceOptions = {
95
96
  ignoreErrors: boolean;
96
97
  suppressWarnings: boolean;
97
98
  };
98
- export type Framework = 'gt-next' | 'gt-react';
99
+ export type Framework = typeof Libraries.GT_NEXT | typeof Libraries.GT_REACT | typeof Libraries.GT_REACT_NATIVE;
99
100
  export type FrameworkObject = {
100
101
  name: 'mintlify';
101
102
  type?: undefined;
@@ -111,7 +112,7 @@ export type SupportedFrameworks = FrameworkObject['name'];
111
112
  export type SupportedReactFrameworks = Extract<FrameworkObject, {
112
113
  type: 'react';
113
114
  }>['name'];
114
- export type SupportedLibraries = 'gt-next' | 'gt-react' | 'next-intl' | 'react-i18next' | 'next-i18next' | 'i18next' | 'i18next-icu' | 'gt-node' | 'base';
115
+ export type SupportedLibraries = InlineLibrary | 'next-intl' | 'react-i18next' | 'next-i18next' | 'i18next' | 'i18next-icu' | 'base';
115
116
  export interface ContentScanner {
116
117
  scanForContent(options: WrapOptions, framework: Framework): Promise<{
117
118
  errors: string[];
@@ -0,0 +1,31 @@
1
+ /**
2
+ * A list of all the libraries names supported by the CLI
3
+ */
4
+ export declare enum Libraries {
5
+ GT_REACT = "gt-react",
6
+ GT_NEXT = "gt-next",
7
+ GT_REACT_NATIVE = "gt-react-native",
8
+ GT_NODE = "gt-node",
9
+ GT_I18N = "gt-i18n",
10
+ GT_REACT_CORE = "@generaltranslation/react-core"
11
+ }
12
+ /**
13
+ * A list of all the libraries that support the CLI
14
+ */
15
+ export declare const GT_LIBRARIES: readonly [Libraries.GT_REACT, Libraries.GT_NEXT, Libraries.GT_REACT_NATIVE, Libraries.GT_NODE, Libraries.GT_I18N, Libraries.GT_REACT_CORE];
16
+ export type GTLibrary = (typeof GT_LIBRARIES)[number];
17
+ /**
18
+ * Libraries that support inline translation
19
+ */
20
+ export declare const INLINE_LIBRARIES: readonly [Libraries.GT_REACT, Libraries.GT_NEXT, Libraries.GT_NODE, Libraries.GT_REACT_NATIVE, Libraries.GT_REACT_CORE, Libraries.GT_I18N];
21
+ export type InlineLibrary = (typeof INLINE_LIBRARIES)[number];
22
+ export declare function isInlineLibrary(lib: string): lib is InlineLibrary;
23
+ /**
24
+ * Libraries that support react primitives
25
+ */
26
+ export declare const REACT_LIBRARIES: readonly [Libraries.GT_NEXT, Libraries.GT_REACT, Libraries.GT_REACT_NATIVE, Libraries.GT_REACT_CORE];
27
+ export type ReactLibrary = (typeof REACT_LIBRARIES)[number];
28
+ /**
29
+ * A mapping of each library to their upstream dependencies for filtering imports
30
+ */
31
+ export declare const GT_LIBRARIES_UPSTREAM: Record<GTLibrary, GTLibrary[]>;
@@ -0,0 +1,72 @@
1
+ /**
2
+ * A list of all the libraries names supported by the CLI
3
+ */
4
+ export var Libraries;
5
+ (function (Libraries) {
6
+ Libraries["GT_REACT"] = "gt-react";
7
+ Libraries["GT_NEXT"] = "gt-next";
8
+ Libraries["GT_REACT_NATIVE"] = "gt-react-native";
9
+ Libraries["GT_NODE"] = "gt-node";
10
+ Libraries["GT_I18N"] = "gt-i18n";
11
+ Libraries["GT_REACT_CORE"] = "@generaltranslation/react-core";
12
+ })(Libraries || (Libraries = {}));
13
+ /**
14
+ * A list of all the libraries that support the CLI
15
+ */
16
+ export const GT_LIBRARIES = [
17
+ Libraries.GT_REACT,
18
+ Libraries.GT_NEXT,
19
+ Libraries.GT_REACT_NATIVE,
20
+ Libraries.GT_NODE,
21
+ Libraries.GT_I18N,
22
+ Libraries.GT_REACT_CORE,
23
+ ];
24
+ /**
25
+ * Libraries that support inline translation
26
+ */
27
+ export const INLINE_LIBRARIES = [
28
+ Libraries.GT_REACT,
29
+ Libraries.GT_NEXT,
30
+ Libraries.GT_NODE,
31
+ Libraries.GT_REACT_NATIVE,
32
+ Libraries.GT_REACT_CORE,
33
+ Libraries.GT_I18N,
34
+ ];
35
+ export function isInlineLibrary(lib) {
36
+ return INLINE_LIBRARIES.includes(lib);
37
+ }
38
+ /**
39
+ * Libraries that support react primitives
40
+ */
41
+ export const REACT_LIBRARIES = [
42
+ Libraries.GT_NEXT,
43
+ Libraries.GT_REACT,
44
+ Libraries.GT_REACT_NATIVE,
45
+ Libraries.GT_REACT_CORE,
46
+ ];
47
+ /**
48
+ * A mapping of each library to their upstream dependencies for filtering imports
49
+ */
50
+ export const GT_LIBRARIES_UPSTREAM = {
51
+ [Libraries.GT_NEXT]: [
52
+ Libraries.GT_I18N,
53
+ Libraries.GT_REACT_CORE,
54
+ Libraries.GT_REACT,
55
+ Libraries.GT_NEXT,
56
+ ],
57
+ [Libraries.GT_REACT]: [
58
+ Libraries.GT_I18N,
59
+ Libraries.GT_REACT_CORE,
60
+ Libraries.GT_REACT,
61
+ Libraries.GT_REACT_NATIVE, // allow for cross-library compatibility (gt-react/gt-react-native only)
62
+ ],
63
+ [Libraries.GT_REACT_NATIVE]: [
64
+ Libraries.GT_I18N,
65
+ Libraries.GT_REACT_CORE,
66
+ Libraries.GT_REACT_NATIVE,
67
+ Libraries.GT_REACT, // allow for cross-library compatibility (gt-react/gt-react-native only)
68
+ ],
69
+ [Libraries.GT_NODE]: [Libraries.GT_I18N, Libraries.GT_NODE],
70
+ [Libraries.GT_REACT_CORE]: [Libraries.GT_I18N, Libraries.GT_REACT_CORE],
71
+ [Libraries.GT_I18N]: [Libraries.GT_I18N],
72
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gtx-cli",
3
- "version": "2.6.18",
3
+ "version": "2.6.19",
4
4
  "main": "dist/index.js",
5
5
  "bin": "dist/main.js",
6
6
  "files": [