gtx-cli 2.5.0-alpha.0 → 2.5.0-alpha.2

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 (93) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/api/collectUserEditDiffs.d.ts +2 -7
  3. package/dist/api/collectUserEditDiffs.js +33 -78
  4. package/dist/api/downloadFileBatch.d.ts +11 -10
  5. package/dist/api/downloadFileBatch.js +120 -127
  6. package/dist/api/saveLocalEdits.js +18 -15
  7. package/dist/cli/base.js +1 -1
  8. package/dist/cli/commands/stage.d.ts +8 -2
  9. package/dist/cli/commands/stage.js +25 -7
  10. package/dist/cli/commands/translate.d.ts +4 -2
  11. package/dist/cli/commands/translate.js +5 -6
  12. package/dist/cli/flags.js +4 -1
  13. package/dist/config/generateSettings.js +10 -0
  14. package/dist/console/colors.d.ts +0 -1
  15. package/dist/console/colors.js +0 -3
  16. package/dist/console/index.d.ts +0 -6
  17. package/dist/console/index.js +2 -13
  18. package/dist/console/logging.d.ts +1 -1
  19. package/dist/console/logging.js +3 -4
  20. package/dist/formats/files/translate.d.ts +2 -2
  21. package/dist/formats/files/translate.js +31 -5
  22. package/dist/fs/config/downloadedVersions.d.ts +10 -3
  23. package/dist/fs/config/downloadedVersions.js +8 -0
  24. package/dist/fs/config/updateVersions.d.ts +2 -1
  25. package/dist/git/branches.d.ts +7 -0
  26. package/dist/git/branches.js +88 -0
  27. package/dist/react/{jsx/utils/jsxParsing → data-_gt}/addGTIdentifierToSyntaxTree.d.ts +1 -2
  28. package/dist/react/{jsx/utils/jsxParsing → data-_gt}/addGTIdentifierToSyntaxTree.js +6 -30
  29. package/dist/react/jsx/evaluateJsx.d.ts +6 -5
  30. package/dist/react/jsx/evaluateJsx.js +4 -32
  31. package/dist/react/jsx/trimJsxStringChildren.d.ts +7 -0
  32. package/dist/react/jsx/trimJsxStringChildren.js +122 -0
  33. package/dist/react/jsx/utils/constants.d.ts +0 -2
  34. package/dist/react/jsx/utils/constants.js +2 -11
  35. package/dist/react/jsx/utils/parseJsx.d.ts +21 -0
  36. package/dist/react/jsx/utils/parseJsx.js +259 -0
  37. package/dist/react/jsx/utils/parseStringFunction.js +141 -4
  38. package/dist/react/parse/createInlineUpdates.js +70 -19
  39. package/dist/types/branch.d.ts +14 -0
  40. package/dist/types/branch.js +1 -0
  41. package/dist/types/data.d.ts +1 -1
  42. package/dist/types/files.d.ts +7 -0
  43. package/dist/types/index.d.ts +7 -0
  44. package/dist/utils/SpinnerManager.d.ts +30 -0
  45. package/dist/utils/SpinnerManager.js +73 -0
  46. package/dist/utils/gitDiff.js +18 -16
  47. package/dist/workflow/BranchStep.d.ts +13 -0
  48. package/dist/workflow/BranchStep.js +131 -0
  49. package/dist/workflow/DownloadStep.d.ts +19 -0
  50. package/dist/workflow/DownloadStep.js +127 -0
  51. package/dist/workflow/EnqueueStep.d.ts +15 -0
  52. package/dist/workflow/EnqueueStep.js +33 -0
  53. package/dist/workflow/PollJobsStep.d.ts +31 -0
  54. package/dist/workflow/PollJobsStep.js +286 -0
  55. package/dist/workflow/SetupStep.d.ts +16 -0
  56. package/dist/workflow/SetupStep.js +72 -0
  57. package/dist/workflow/UploadStep.d.ts +21 -0
  58. package/dist/workflow/UploadStep.js +72 -0
  59. package/dist/workflow/UserEditDiffsStep.d.ts +11 -0
  60. package/dist/workflow/UserEditDiffsStep.js +30 -0
  61. package/dist/workflow/Workflow.d.ts +4 -0
  62. package/dist/workflow/Workflow.js +2 -0
  63. package/dist/workflow/download.d.ts +22 -0
  64. package/dist/workflow/download.js +104 -0
  65. package/dist/workflow/stage.d.ts +14 -0
  66. package/dist/workflow/stage.js +76 -0
  67. package/package.json +3 -4
  68. package/dist/api/checkFileTranslations.d.ts +0 -23
  69. package/dist/api/checkFileTranslations.js +0 -281
  70. package/dist/api/sendFiles.d.ts +0 -17
  71. package/dist/api/sendFiles.js +0 -127
  72. package/dist/api/sendUserEdits.d.ts +0 -19
  73. package/dist/api/sendUserEdits.js +0 -15
  74. package/dist/cli/commands/edits.d.ts +0 -8
  75. package/dist/cli/commands/edits.js +0 -32
  76. package/dist/react/jsx/utils/buildImportMap.d.ts +0 -9
  77. package/dist/react/jsx/utils/buildImportMap.js +0 -30
  78. package/dist/react/jsx/utils/getPathsAndAliases.d.ts +0 -17
  79. package/dist/react/jsx/utils/getPathsAndAliases.js +0 -89
  80. package/dist/react/jsx/utils/jsxParsing/handleChildrenWhitespace.d.ts +0 -6
  81. package/dist/react/jsx/utils/jsxParsing/handleChildrenWhitespace.js +0 -199
  82. package/dist/react/jsx/utils/jsxParsing/multiplication/findMultiplicationNode.d.ts +0 -13
  83. package/dist/react/jsx/utils/jsxParsing/multiplication/findMultiplicationNode.js +0 -42
  84. package/dist/react/jsx/utils/jsxParsing/multiplication/multiplyJsxTree.d.ts +0 -5
  85. package/dist/react/jsx/utils/jsxParsing/multiplication/multiplyJsxTree.js +0 -69
  86. package/dist/react/jsx/utils/jsxParsing/parseJsx.d.ts +0 -60
  87. package/dist/react/jsx/utils/jsxParsing/parseJsx.js +0 -949
  88. package/dist/react/jsx/utils/jsxParsing/parseTProps.d.ts +0 -8
  89. package/dist/react/jsx/utils/jsxParsing/parseTProps.js +0 -47
  90. package/dist/react/jsx/utils/jsxParsing/types.d.ts +0 -48
  91. package/dist/react/jsx/utils/jsxParsing/types.js +0 -34
  92. package/dist/react/jsx/utils/resolveImportPath.d.ts +0 -11
  93. package/dist/react/jsx/utils/resolveImportPath.js +0 -111
@@ -1,69 +0,0 @@
1
- import { findMultiplicationNode } from './findMultiplicationNode.js';
2
- /**
3
- * Given a JSX tree, multiply the static function nodes
4
- */
5
- export function multiplyJsxTree(tree) {
6
- if (!Array.isArray(tree)) {
7
- return multiplyBranches([tree]);
8
- }
9
- else {
10
- // when tree is an array, this is just sibbling elements within the <T>, so we need to treat them as a single branch
11
- const wrapperElement = {
12
- nodeType: 'element',
13
- type: 'T',
14
- props: {
15
- children: tree,
16
- },
17
- };
18
- // Multiply the wrapper element
19
- const multipliedBranches = multiplyBranches([
20
- wrapperElement,
21
- ]);
22
- // Unwrap the branches
23
- return multipliedBranches.map((branch) => branch.props.children);
24
- }
25
- }
26
- /**
27
- * Given a list of branches, multiply recursively (DFS)
28
- * @param branches
29
- */
30
- function multiplyBranches(branches) {
31
- // Queue of branches to process
32
- const branchQueue = branches;
33
- // Finalized branches
34
- const newBranches = [];
35
- // Process branches until exhausted
36
- while (branchQueue.length) {
37
- // Pop the next branch
38
- const branch = branchQueue.shift();
39
- // Get closest multiplication node
40
- const currentNode = findMultiplicationNode(branch);
41
- // No multiplication nodes, just add the branch to the final list
42
- if (!currentNode) {
43
- newBranches.push(branch);
44
- continue;
45
- }
46
- const { node, parent, key } = currentNode;
47
- // Recursive call
48
- const subBranches = multiplyBranches(node.branches);
49
- // For every sub branch, create a new cloned branch
50
- for (const subBranch of subBranches) {
51
- // Placeholder for the new branch
52
- let newBranch = undefined;
53
- // Create a clone of the original with the sub branch swapped in
54
- if (parent === undefined || key === undefined) {
55
- // This means the subBranch directly replaces the branch itself
56
- newBranches.push(subBranch);
57
- }
58
- else {
59
- // Replace the multiplication node with the sub branch
60
- parent[key] = subBranch;
61
- // eslint-disable-next-line no-undef
62
- newBranch = structuredClone(branch);
63
- // Add the new branch to the list
64
- branchQueue.push(newBranch);
65
- }
66
- }
67
- }
68
- return newBranches;
69
- }
@@ -1,60 +0,0 @@
1
- import { Updates } from '../../../../types/index.js';
2
- import * as t from '@babel/types';
3
- import { NodePath } from '@babel/traverse';
4
- import { ParsingConfigOptions } from '../../../../types/parsing.js';
5
- import traverseModule from '@babel/traverse';
6
- import { JsxTree } from './types.js';
7
- /**
8
- * Entry point for JSX parsing
9
- */
10
- export declare function parseTranslationComponent({ originalName, importAliases, localName, path, updates, errors, warnings, file, parsingOptions, pkg, }: {
11
- ast: any;
12
- pkg: 'gt-react' | 'gt-next';
13
- originalName: string;
14
- importAliases: Record<string, string>;
15
- path: traverseModule.NodePath<traverseModule.Node>;
16
- localName: string;
17
- updates: Updates;
18
- errors: string[];
19
- warnings: Set<string>;
20
- file: string;
21
- parsingOptions: ParsingConfigOptions;
22
- }): void;
23
- /**
24
- * Builds a JSX tree from a given node, recursively handling children.
25
- * @param node - The node to build the tree from
26
- * @param unwrappedExpressions - An array to store unwrapped expressions
27
- * @param updates - The updates array
28
- * @param errors - The errors array
29
- * @param file - The file name
30
- * @param insideT - Whether the current node is inside a <T> component
31
- * @returns The built JSX tree
32
- */
33
- export declare function buildJSXTree({ importAliases, node, unwrappedExpressions, visited, updates, errors, warnings, file, insideT, parsingOptions, scopeNode, importedFunctionsMap, pkg, }: {
34
- importAliases: Record<string, string>;
35
- node: any;
36
- unwrappedExpressions: string[];
37
- visited: Set<string>;
38
- updates: Updates;
39
- errors: string[];
40
- warnings: Set<string>;
41
- file: string;
42
- insideT: boolean;
43
- parsingOptions: ParsingConfigOptions;
44
- scopeNode: NodePath;
45
- importedFunctionsMap: Map<string, string>;
46
- pkg: 'gt-react' | 'gt-next';
47
- }): JsxTree;
48
- export declare function parseJSXElement({ importAliases, node, originalName, pkg, updates, errors, warnings, file, parsingOptions, scopeNode, importedFunctionsMap, }: {
49
- importAliases: Record<string, string>;
50
- node: t.JSXElement;
51
- originalName: string;
52
- pkg: 'gt-react' | 'gt-next';
53
- updates: Updates;
54
- errors: string[];
55
- warnings: Set<string>;
56
- file: string;
57
- parsingOptions: ParsingConfigOptions;
58
- scopeNode: NodePath<t.JSXElement>;
59
- importedFunctionsMap: Map<string, string>;
60
- }): void;