@generaltranslation/compiler 1.3.21 → 1.3.23

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 (238) hide show
  1. package/dist/_virtual/_rolldown/runtime.js +23 -0
  2. package/dist/config.js +32 -27
  3. package/dist/config.js.map +1 -1
  4. package/dist/index.d.ts +1 -1
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +120 -187
  7. package/dist/index.js.map +1 -1
  8. package/dist/passes/basePass.js +40 -83
  9. package/dist/passes/basePass.js.map +1 -1
  10. package/dist/passes/collectionPass.js +18 -11
  11. package/dist/passes/collectionPass.js.map +1 -1
  12. package/dist/passes/handleErrors.js +21 -30
  13. package/dist/passes/handleErrors.js.map +1 -1
  14. package/dist/passes/injectionPass.js +15 -9
  15. package/dist/passes/injectionPass.js.map +1 -1
  16. package/dist/passes/jsxInsertionPass.js +33 -31
  17. package/dist/passes/jsxInsertionPass.js.map +1 -1
  18. package/dist/passes/macroExpansionPass.js +28 -26
  19. package/dist/passes/macroExpansionPass.js.map +1 -1
  20. package/dist/passes/runtimeTranslatePass.js +37 -35
  21. package/dist/passes/runtimeTranslatePass.js.map +1 -1
  22. package/dist/processing/collection/processCallExpression.js +144 -249
  23. package/dist/processing/collection/processCallExpression.js.map +1 -1
  24. package/dist/processing/collection/processTaggedTemplateExpression.js +38 -75
  25. package/dist/processing/collection/processTaggedTemplateExpression.js.map +1 -1
  26. package/dist/processing/collection/processVariableDeclarator.js +20 -18
  27. package/dist/processing/collection/processVariableDeclarator.js.map +1 -1
  28. package/dist/processing/index.js +29 -31
  29. package/dist/processing/injection/processCallExpression.js +69 -142
  30. package/dist/processing/injection/processCallExpression.js.map +1 -1
  31. package/dist/processing/injection/processVariableDeclarator.js +22 -20
  32. package/dist/processing/injection/processVariableDeclarator.js.map +1 -1
  33. package/dist/processing/jsx-insertion/processCallExpression.js +284 -393
  34. package/dist/processing/jsx-insertion/processCallExpression.js.map +1 -1
  35. package/dist/processing/jsx-insertion/processImportDeclaration.js +37 -83
  36. package/dist/processing/jsx-insertion/processImportDeclaration.js.map +1 -1
  37. package/dist/processing/jsx-insertion/processProgram.js +26 -66
  38. package/dist/processing/jsx-insertion/processProgram.js.map +1 -1
  39. package/dist/processing/macro-expansion/processImportDeclaration.js +21 -55
  40. package/dist/processing/macro-expansion/processImportDeclaration.js.map +1 -1
  41. package/dist/processing/macro-expansion/processProgram.js +20 -26
  42. package/dist/processing/macro-expansion/processProgram.js.map +1 -1
  43. package/dist/processing/macro-expansion/processTaggedTemplateExpression.js +33 -69
  44. package/dist/processing/macro-expansion/processTaggedTemplateExpression.js.map +1 -1
  45. package/dist/processing/processArrowFunctionExpression.js +18 -16
  46. package/dist/processing/processArrowFunctionExpression.js.map +1 -1
  47. package/dist/processing/processAssignmentExpression.js +12 -10
  48. package/dist/processing/processAssignmentExpression.js.map +1 -1
  49. package/dist/processing/processCatchClause.js +18 -16
  50. package/dist/processing/processCatchClause.js.map +1 -1
  51. package/dist/processing/processClassDeclaration.js +18 -16
  52. package/dist/processing/processClassDeclaration.js.map +1 -1
  53. package/dist/processing/processClassMethod.js +18 -17
  54. package/dist/processing/processClassMethod.js.map +1 -1
  55. package/dist/processing/processClassPrivateMethod.js +18 -17
  56. package/dist/processing/processClassPrivateMethod.js.map +1 -1
  57. package/dist/processing/processForInStatement.js +18 -16
  58. package/dist/processing/processForInStatement.js.map +1 -1
  59. package/dist/processing/processForOfStatement.js +18 -16
  60. package/dist/processing/processForOfStatement.js.map +1 -1
  61. package/dist/processing/processFunctionDeclaration.js +20 -18
  62. package/dist/processing/processFunctionDeclaration.js.map +1 -1
  63. package/dist/processing/processFunctionExpression.js +26 -24
  64. package/dist/processing/processFunctionExpression.js.map +1 -1
  65. package/dist/processing/processImportDeclaration.js +11 -9
  66. package/dist/processing/processImportDeclaration.js.map +1 -1
  67. package/dist/processing/processObjectMethod.js +19 -18
  68. package/dist/processing/processObjectMethod.js.map +1 -1
  69. package/dist/processing/processProgram.js +13 -13
  70. package/dist/processing/processProgram.js.map +1 -1
  71. package/dist/processing/processScopeChange.js +15 -13
  72. package/dist/processing/processScopeChange.js.map +1 -1
  73. package/dist/processing/runtime-translate/processImportDeclaration.js +30 -63
  74. package/dist/processing/runtime-translate/processImportDeclaration.js.map +1 -1
  75. package/dist/processing/runtime-translate/processProgram.js +34 -57
  76. package/dist/processing/runtime-translate/processProgram.js.map +1 -1
  77. package/dist/state/ErrorTracker.js +18 -17
  78. package/dist/state/ErrorTracker.js.map +1 -1
  79. package/dist/state/Logger.js +42 -52
  80. package/dist/state/Logger.js.map +1 -1
  81. package/dist/state/ScopeTracker.d.ts +11 -2
  82. package/dist/state/ScopeTracker.d.ts.map +1 -1
  83. package/dist/state/ScopeTracker.js +154 -209
  84. package/dist/state/ScopeTracker.js.map +1 -1
  85. package/dist/state/StringCollector.d.ts +9 -2
  86. package/dist/state/StringCollector.d.ts.map +1 -1
  87. package/dist/state/StringCollector.js +165 -184
  88. package/dist/state/StringCollector.js.map +1 -1
  89. package/dist/state/types.js +1 -3
  90. package/dist/state/utils/initializeState.js +62 -67
  91. package/dist/state/utils/initializeState.js.map +1 -1
  92. package/dist/transform/getTrackedVariable.js +33 -38
  93. package/dist/transform/getTrackedVariable.js.map +1 -1
  94. package/dist/transform/injection/callbacks/injectUseGTCallbackParameters.js +19 -27
  95. package/dist/transform/injection/callbacks/injectUseGTCallbackParameters.js.map +1 -1
  96. package/dist/transform/injection/callbacks/injectUseMessagesCallbackParameters.js +8 -6
  97. package/dist/transform/injection/callbacks/injectUseMessagesCallbackParameters.js.map +1 -1
  98. package/dist/transform/injection/callbacks/injectUseTranslationsCallbackParameters.js +8 -6
  99. package/dist/transform/injection/callbacks/injectUseTranslationsCallbackParameters.js.map +1 -1
  100. package/dist/transform/injection/injectCallbackDeclaratorFunctionParameters.js +74 -155
  101. package/dist/transform/injection/injectCallbackDeclaratorFunctionParameters.js.map +1 -1
  102. package/dist/transform/injection/injectHashIntoTranslationOptions.js +21 -61
  103. package/dist/transform/injection/injectHashIntoTranslationOptions.js.map +1 -1
  104. package/dist/transform/injection/injectStandaloneTFunctionParameters.js +21 -27
  105. package/dist/transform/injection/injectStandaloneTFunctionParameters.js.map +1 -1
  106. package/dist/transform/injection/injectTComponentParameters.js +25 -65
  107. package/dist/transform/injection/injectTComponentParameters.js.map +1 -1
  108. package/dist/transform/jsx-children/constructJsxChildren.d.ts +1 -1
  109. package/dist/transform/jsx-children/constructJsxChildren.d.ts.map +1 -1
  110. package/dist/transform/jsx-children/constructJsxChildren.js +273 -392
  111. package/dist/transform/jsx-children/constructJsxChildren.js.map +1 -1
  112. package/dist/transform/jsx-children/errors.js +16 -6
  113. package/dist/transform/jsx-children/errors.js.map +1 -1
  114. package/dist/transform/jsx-children/index.js +3 -6
  115. package/dist/transform/jsx-children/utils/getBranchComponentParameters.js +26 -85
  116. package/dist/transform/jsx-children/utils/getBranchComponentParameters.js.map +1 -1
  117. package/dist/transform/jsx-children/utils/getCalleeNameFromJsxExpressionParam.js +33 -66
  118. package/dist/transform/jsx-children/utils/getCalleeNameFromJsxExpressionParam.js.map +1 -1
  119. package/dist/transform/jsx-children/utils/id.js +18 -17
  120. package/dist/transform/jsx-children/utils/id.js.map +1 -1
  121. package/dist/transform/jsx-children/validation/validateChildrenElement.js +13 -47
  122. package/dist/transform/jsx-children/validation/validateChildrenElement.js.map +1 -1
  123. package/dist/transform/jsx-children/validation/validateChildrenFromArgs.js +25 -63
  124. package/dist/transform/jsx-children/validation/validateChildrenFromArgs.js.map +1 -1
  125. package/dist/transform/jsx-children/validation/validateIdentifier.js +38 -41
  126. package/dist/transform/jsx-children/validation/validateIdentifier.js.map +1 -1
  127. package/dist/transform/jsx-children/validation/validateJsxCall.js +15 -26
  128. package/dist/transform/jsx-children/validation/validateJsxCall.js.map +1 -1
  129. package/dist/transform/jsx-children/validation/validateNameFieldForVarComponent.js +33 -61
  130. package/dist/transform/jsx-children/validation/validateNameFieldForVarComponent.js.map +1 -1
  131. package/dist/transform/jsx-children/validation/validateStringLiteralPropertyFromArg.js +38 -66
  132. package/dist/transform/jsx-children/validation/validateStringLiteralPropertyFromArg.js.map +1 -1
  133. package/dist/transform/jsx-children/validation/validateTemplateLiteral.js +17 -13
  134. package/dist/transform/jsx-children/validation/validateTemplateLiteral.js.map +1 -1
  135. package/dist/transform/jsx-children/validation/validateUnaryExpression.js +26 -61
  136. package/dist/transform/jsx-children/validation/validateUnaryExpression.js.map +1 -1
  137. package/dist/transform/jsx-insertion/injectJsxInsertionImport.js +16 -48
  138. package/dist/transform/jsx-insertion/injectJsxInsertionImport.js.map +1 -1
  139. package/dist/transform/macro-expansion/injectMacroImport.js +14 -43
  140. package/dist/transform/macro-expansion/injectMacroImport.js.map +1 -1
  141. package/dist/transform/macro-expansion/transformTemplateLiteral.js +23 -22
  142. package/dist/transform/macro-expansion/transformTemplateLiteral.js.map +1 -1
  143. package/dist/transform/registration/callbacks/registerUseGTCallback.js +27 -34
  144. package/dist/transform/registration/callbacks/registerUseGTCallback.js.map +1 -1
  145. package/dist/transform/registration/callbacks/registerUseMessagesCallback.js +9 -9
  146. package/dist/transform/registration/callbacks/registerUseMessagesCallback.js.map +1 -1
  147. package/dist/transform/registration/callbacks/registerUseTranslationsCallback.js +9 -9
  148. package/dist/transform/registration/callbacks/registerUseTranslationsCallback.js.map +1 -1
  149. package/dist/transform/registration/registerStandaloneTranslation.js +27 -28
  150. package/dist/transform/registration/registerStandaloneTranslation.js.map +1 -1
  151. package/dist/transform/registration/registerTranslationComponent.js +15 -15
  152. package/dist/transform/registration/registerTranslationComponent.js.map +1 -1
  153. package/dist/transform/runtime-translate/buildRuntimeTranslateCalls.js +34 -85
  154. package/dist/transform/runtime-translate/buildRuntimeTranslateCalls.js.map +1 -1
  155. package/dist/transform/runtime-translate/injectRuntimeTranslateImport.js +25 -55
  156. package/dist/transform/runtime-translate/injectRuntimeTranslateImport.js.map +1 -1
  157. package/dist/transform/tracking/trackAssignmentExpression.js +26 -63
  158. package/dist/transform/tracking/trackAssignmentExpression.js.map +1 -1
  159. package/dist/transform/tracking/trackCatchClause.js +17 -48
  160. package/dist/transform/tracking/trackCatchClause.js.map +1 -1
  161. package/dist/transform/tracking/trackClassDeclaration.js +13 -13
  162. package/dist/transform/tracking/trackClassDeclaration.js.map +1 -1
  163. package/dist/transform/tracking/trackForDeclaration.js +17 -53
  164. package/dist/transform/tracking/trackForDeclaration.js.map +1 -1
  165. package/dist/transform/tracking/trackFunctionName.js +10 -10
  166. package/dist/transform/tracking/trackFunctionName.js.map +1 -1
  167. package/dist/transform/tracking/trackFunctionParams.js +19 -54
  168. package/dist/transform/tracking/trackFunctionParams.js.map +1 -1
  169. package/dist/transform/tracking/trackImportDeclaration.js +36 -89
  170. package/dist/transform/tracking/trackImportDeclaration.js.map +1 -1
  171. package/dist/transform/tracking/trackOverridingVariable.js +9 -11
  172. package/dist/transform/tracking/trackOverridingVariable.js.map +1 -1
  173. package/dist/transform/tracking/trackVariableDeclarator.js +51 -102
  174. package/dist/transform/tracking/trackVariableDeclarator.js.map +1 -1
  175. package/dist/transform/validation/validateTranslationComponentArgs.d.ts +1 -1
  176. package/dist/transform/validation/validateTranslationComponentArgs.d.ts.map +1 -1
  177. package/dist/transform/validation/validateTranslationComponentArgs.js +156 -232
  178. package/dist/transform/validation/validateTranslationComponentArgs.js.map +1 -1
  179. package/dist/transform/validation/validateTranslationFunction.js +218 -329
  180. package/dist/transform/validation/validateTranslationFunction.js.map +1 -1
  181. package/dist/utils/calculateHash.d.ts +1 -1
  182. package/dist/utils/calculateHash.d.ts.map +1 -1
  183. package/dist/utils/calculateHash.js +55 -70
  184. package/dist/utils/calculateHash.js.map +1 -1
  185. package/dist/utils/constants/gt/constants.js +142 -132
  186. package/dist/utils/constants/gt/constants.js.map +1 -1
  187. package/dist/utils/constants/gt/helpers.d.ts +1 -1
  188. package/dist/utils/constants/gt/helpers.d.ts.map +1 -1
  189. package/dist/utils/constants/gt/helpers.js +147 -149
  190. package/dist/utils/constants/gt/helpers.js.map +1 -1
  191. package/dist/utils/constants/other/constants.js +45 -41
  192. package/dist/utils/constants/other/constants.js.map +1 -1
  193. package/dist/utils/constants/other/helpers.js +13 -11
  194. package/dist/utils/constants/other/helpers.js.map +1 -1
  195. package/dist/utils/constants/react/constants.js +47 -41
  196. package/dist/utils/constants/react/constants.js.map +1 -1
  197. package/dist/utils/constants/react/helpers.js +17 -16
  198. package/dist/utils/constants/react/helpers.js.map +1 -1
  199. package/dist/utils/constants/resolveIdentifier/isGTComponent.js +41 -76
  200. package/dist/utils/constants/resolveIdentifier/isGTComponent.js.map +1 -1
  201. package/dist/utils/constants/resolveIdentifier/isReactJsxFunction.js +33 -83
  202. package/dist/utils/constants/resolveIdentifier/isReactJsxFunction.js.map +1 -1
  203. package/dist/utils/errors.js +18 -20
  204. package/dist/utils/errors.js.map +1 -1
  205. package/dist/utils/multiplication/multiply.js +31 -35
  206. package/dist/utils/multiplication/multiply.js.map +1 -1
  207. package/dist/utils/multiplication/types.js +1 -3
  208. package/dist/utils/parsing/extractIdentifiersFromLVal.js +30 -96
  209. package/dist/utils/parsing/extractIdentifiersFromLVal.js.map +1 -1
  210. package/dist/utils/parsing/getCalleeNameFromExpression.js +31 -65
  211. package/dist/utils/parsing/getCalleeNameFromExpression.js.map +1 -1
  212. package/dist/utils/parsing/getCalleeNameFromExpressionWrapper.js +13 -10
  213. package/dist/utils/parsing/getCalleeNameFromExpressionWrapper.js.map +1 -1
  214. package/dist/utils/parsing/getObjectPropertyFromObjectExpression.js +19 -56
  215. package/dist/utils/parsing/getObjectPropertyFromObjectExpression.js.map +1 -1
  216. package/dist/utils/parsing/getStringLiteralFromExpression.js +18 -49
  217. package/dist/utils/parsing/getStringLiteralFromExpression.js.map +1 -1
  218. package/dist/utils/parsing/isDeriveInvocation.js +25 -61
  219. package/dist/utils/parsing/isDeriveInvocation.js.map +1 -1
  220. package/dist/utils/parsing/isStringTranslationTaggedTemplate.js +23 -59
  221. package/dist/utils/parsing/isStringTranslationTaggedTemplate.js.map +1 -1
  222. package/dist/utils/string-expressions/buildTransformationResult.js +57 -96
  223. package/dist/utils/string-expressions/buildTransformationResult.js.map +1 -1
  224. package/dist/utils/string-expressions/flattenExpressionToParts.js +131 -142
  225. package/dist/utils/string-expressions/flattenExpressionToParts.js.map +1 -1
  226. package/dist/utils/string-expressions/resolveStaticExpression.js +36 -34
  227. package/dist/utils/string-expressions/resolveStaticExpression.js.map +1 -1
  228. package/dist/utils/validation/validateChildrenFromObjectExpression.js +29 -24
  229. package/dist/utils/validation/validateChildrenFromObjectExpression.js.map +1 -1
  230. package/dist/utils/validation/validateExpressionIsNumericLiteral.js +13 -47
  231. package/dist/utils/validation/validateExpressionIsNumericLiteral.js.map +1 -1
  232. package/dist/utils/validation/validateExpressionIsStringLiteral.js +15 -48
  233. package/dist/utils/validation/validateExpressionIsStringLiteral.js.map +1 -1
  234. package/package.json +8 -4
  235. package/dist/processing/index.js.map +0 -1
  236. package/dist/state/types.js.map +0 -1
  237. package/dist/transform/jsx-children/index.js.map +0 -1
  238. package/dist/utils/multiplication/types.js.map +0 -1
@@ -1,410 +1,291 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.constructJsxChildren = constructJsxChildren;
37
- const types_1 = require("generaltranslation/types");
38
- const t = __importStar(require("@babel/types"));
39
- const validateIdentifier_1 = require("./validation/validateIdentifier");
40
- const validateTemplateLiteral_1 = require("./validation/validateTemplateLiteral");
41
- const validateChildrenElement_1 = require("./validation/validateChildrenElement");
42
- const getCalleeNameFromJsxExpressionParam_1 = require("./utils/getCalleeNameFromJsxExpressionParam");
43
- const getTrackedVariable_1 = require("../getTrackedVariable");
44
- const helpers_1 = require("../../utils/constants/react/helpers");
45
- const constants_1 = require("../../utils/constants/react/constants");
46
- const validateChildrenFromArgs_1 = require("./validation/validateChildrenFromArgs");
47
- const id_1 = require("./utils/id");
48
- const helpers_2 = require("../../utils/constants/gt/helpers");
49
- const validateStringLiteralPropertyFromArg_1 = require("./validation/validateStringLiteralPropertyFromArg");
50
- const constants_2 = require("../../utils/constants/gt/constants");
51
- const getBranchComponentParameters_1 = require("./utils/getBranchComponentParameters");
52
- const validateNameFieldForVarComponent_1 = require("./validation/validateNameFieldForVarComponent");
53
- const validateUnaryExpression_1 = require("./validation/validateUnaryExpression");
54
- const errors_1 = require("../../utils/errors");
55
- const validateJsxCall_1 = require("./validation/validateJsxCall");
56
- const errors_2 = require("./errors");
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_runtime = require("../../_virtual/_rolldown/runtime.js");
3
+ require("../../utils/constants/gt/constants.js");
4
+ const require_utils_constants_gt_helpers = require("../../utils/constants/gt/helpers.js");
5
+ require("../../utils/constants/react/constants.js");
6
+ const require_utils_constants_react_helpers = require("../../utils/constants/react/helpers.js");
7
+ const require_transform_getTrackedVariable = require("../getTrackedVariable.js");
8
+ const require_utils_errors = require("../../utils/errors.js");
9
+ const require_transform_jsx_children_validation_validateIdentifier = require("./validation/validateIdentifier.js");
10
+ const require_transform_jsx_children_validation_validateTemplateLiteral = require("./validation/validateTemplateLiteral.js");
11
+ const require_transform_jsx_children_validation_validateChildrenElement = require("./validation/validateChildrenElement.js");
12
+ const require_transform_jsx_children_utils_getCalleeNameFromJsxExpressionParam = require("./utils/getCalleeNameFromJsxExpressionParam.js");
13
+ const require_transform_jsx_children_validation_validateChildrenFromArgs = require("./validation/validateChildrenFromArgs.js");
14
+ const require_transform_jsx_children_utils_id = require("./utils/id.js");
15
+ const require_transform_jsx_children_validation_validateStringLiteralPropertyFromArg = require("./validation/validateStringLiteralPropertyFromArg.js");
16
+ const require_transform_jsx_children_utils_getBranchComponentParameters = require("./utils/getBranchComponentParameters.js");
17
+ const require_transform_jsx_children_validation_validateNameFieldForVarComponent = require("./validation/validateNameFieldForVarComponent.js");
18
+ const require_transform_jsx_children_validation_validateUnaryExpression = require("./validation/validateUnaryExpression.js");
19
+ const require_transform_jsx_children_validation_validateJsxCall = require("./validation/validateJsxCall.js");
20
+ const require_transform_jsx_children_errors = require("./errors.js");
21
+ let _babel_types = require("@babel/types");
22
+ _babel_types = require_runtime.__toESM(_babel_types);
23
+ let _generaltranslation_format_types = require("@generaltranslation/format/types");
24
+ //#region src/transform/jsx-children/constructJsxChildren.ts
57
25
  /**
58
- * Given the children of a <T> component, constructs a JsxChildren object.
59
- * Takes an Expression path.
60
- *
61
- * ONLY does JsxChildren construction + validation, no further processing on any children.
62
- *
63
- * On invalid children, quit immediately.
64
- *
65
- * The node checks intentionally happen before navigating with .get(). This
66
- * keeps runtime validation behavior stable while preserving NodePath scope for
67
- * future derivation work.
68
- */
69
- function constructJsxChildren(childrenPath, state, id = new id_1.IdObject()) {
70
- const errors = [];
71
- // Skip if no children
72
- if (!childrenPath) {
73
- return { errors, value: childrenPath };
74
- }
75
- const children = childrenPath.node;
76
- let value;
77
- if (t.isArrayExpression(children)) {
78
- // Handle ArrayExpression
79
- value = [];
80
- const elementPaths = childrenPath.get('elements');
81
- for (let i = 0; i < children.elements.length; i++) {
82
- const child = children.elements[i];
83
- // Validate child
84
- if (!(0, validateChildrenElement_1.validateChildrenElement)(child)) {
85
- errors.push((0, errors_2.dynamicContentError)((0, errors_1.generateDynamicContentErrorMessage)() +
86
- (child && (0, errors_1.createErrorLocation)(child))));
87
- return { errors };
88
- }
89
- // Special children edge cases: nullLiteral, booleanLiteral
90
- if (t.isBooleanLiteral(child) || t.isNullLiteral(child)) {
91
- continue;
92
- }
93
- // Construct JsxChild
94
- const childPath = elementPaths[i];
95
- const validation = constructJsxChild(childPath, state, id);
96
- errors.push(...validation.errors);
97
- if (errors.length > 0) {
98
- return { errors };
99
- }
100
- // Skip if no value
101
- if (validation.value === undefined)
102
- continue;
103
- value.push(validation.value);
104
- }
105
- }
106
- else {
107
- // Handle single child
108
- const validation = constructJsxChild(childrenPath, state, id);
109
- errors.push(...validation.errors);
110
- if (errors.length > 0) {
111
- return { errors };
112
- }
113
- value = validation.value;
114
- }
115
- return { errors, value };
26
+ * Given the children of a <T> component, constructs a JsxChildren object.
27
+ * Takes an Expression path.
28
+ *
29
+ * ONLY does JsxChildren construction + validation, no further processing on any children.
30
+ *
31
+ * On invalid children, quit immediately.
32
+ *
33
+ * The node checks intentionally happen before navigating with .get(). This
34
+ * keeps runtime validation behavior stable while preserving NodePath scope for
35
+ * future derivation work.
36
+ */
37
+ function constructJsxChildren(childrenPath, state, id = new require_transform_jsx_children_utils_id.IdObject()) {
38
+ const errors = [];
39
+ if (!childrenPath) return {
40
+ errors,
41
+ value: childrenPath
42
+ };
43
+ const children = childrenPath.node;
44
+ let value;
45
+ if (_babel_types.isArrayExpression(children)) {
46
+ value = [];
47
+ const elementPaths = childrenPath.get("elements");
48
+ for (let i = 0; i < children.elements.length; i++) {
49
+ const child = children.elements[i];
50
+ if (!require_transform_jsx_children_validation_validateChildrenElement.validateChildrenElement(child)) {
51
+ errors.push(require_transform_jsx_children_errors.dynamicContentError(require_utils_errors.generateDynamicContentErrorMessage() + (child && require_utils_errors.createErrorLocation(child))));
52
+ return { errors };
53
+ }
54
+ if (_babel_types.isBooleanLiteral(child) || _babel_types.isNullLiteral(child)) continue;
55
+ const childPath = elementPaths[i];
56
+ const validation = constructJsxChild(childPath, state, id);
57
+ errors.push(...validation.errors);
58
+ if (errors.length > 0) return { errors };
59
+ if (validation.value === void 0) continue;
60
+ value.push(validation.value);
61
+ }
62
+ } else {
63
+ const validation = constructJsxChild(childrenPath, state, id);
64
+ errors.push(...validation.errors);
65
+ if (errors.length > 0) return { errors };
66
+ value = validation.value;
67
+ }
68
+ return {
69
+ errors,
70
+ value
71
+ };
116
72
  }
117
73
  /**
118
- * Given an Expression path, constructs a JsxChild.
119
- * @returns { errors: string[]; value?: JsxChild }
120
- */
74
+ * Given an Expression path, constructs a JsxChild.
75
+ * @returns { errors: string[]; value?: JsxChild }
76
+ */
121
77
  function constructJsxChild(childPath, state, id) {
122
- const errors = [];
123
- const child = childPath.node;
124
- let value;
125
- if (t.isCallExpression(child)) {
126
- // Construct JsxElement
127
- const validation = constructJsxElement(childPath, state, id);
128
- errors.push(...validation.errors);
129
- if (errors.length > 0) {
130
- return { errors };
131
- }
132
- value = validation.value;
133
- }
134
- else if (t.isStringLiteral(child)) {
135
- value = child.value;
136
- }
137
- else if (t.isTemplateLiteral(child)) {
138
- const validation = (0, validateTemplateLiteral_1.validateTemplateLiteral)(child);
139
- errors.push(...validation.errors.map((msg) => (0, errors_2.dynamicContentError)(msg)));
140
- if (errors.length > 0) {
141
- return { errors };
142
- }
143
- value = validation.value;
144
- }
145
- else if (t.isNumericLiteral(child)) {
146
- value = child.value.toString();
147
- }
148
- else if (t.isBooleanLiteral(child)) {
149
- value = child.value;
150
- }
151
- else if (t.isNullLiteral(child)) {
152
- value = null;
153
- }
154
- else if (t.isUnaryExpression(child)) {
155
- const validation = (0, validateUnaryExpression_1.validateUnaryExpression)(child);
156
- errors.push(...validation.errors.map((msg) => (0, errors_2.structuralError)(msg)));
157
- if (errors.length > 0) {
158
- return { errors };
159
- }
160
- value = validation.value;
161
- }
162
- else if (t.isIdentifier(child)) {
163
- // <T>{name}</T> or <T>{undefined}</T>
164
- const validation = (0, validateIdentifier_1.validateIdentifier)(child, state);
165
- errors.push(...validation.errors.map((msg) => (0, errors_2.dynamicContentError)(msg)));
166
- if (errors.length > 0) {
167
- return { errors };
168
- }
169
- value = validation.value;
170
- }
171
- else {
172
- // Other cases fail
173
- errors.push((0, errors_2.dynamicContentError)((0, errors_1.generateDynamicContentErrorMessage)() + (0, errors_1.createErrorLocation)(child)));
174
- return { errors };
175
- }
176
- return { errors, value };
78
+ const errors = [];
79
+ const child = childPath.node;
80
+ let value;
81
+ if (_babel_types.isCallExpression(child)) {
82
+ const validation = constructJsxElement(childPath, state, id);
83
+ errors.push(...validation.errors);
84
+ if (errors.length > 0) return { errors };
85
+ value = validation.value;
86
+ } else if (_babel_types.isStringLiteral(child)) value = child.value;
87
+ else if (_babel_types.isTemplateLiteral(child)) {
88
+ const validation = require_transform_jsx_children_validation_validateTemplateLiteral.validateTemplateLiteral(child);
89
+ errors.push(...validation.errors.map((msg) => require_transform_jsx_children_errors.dynamicContentError(msg)));
90
+ if (errors.length > 0) return { errors };
91
+ value = validation.value;
92
+ } else if (_babel_types.isNumericLiteral(child)) value = child.value.toString();
93
+ else if (_babel_types.isBooleanLiteral(child)) value = child.value;
94
+ else if (_babel_types.isNullLiteral(child)) value = null;
95
+ else if (_babel_types.isUnaryExpression(child)) {
96
+ const validation = require_transform_jsx_children_validation_validateUnaryExpression.validateUnaryExpression(child);
97
+ errors.push(...validation.errors.map((msg) => require_transform_jsx_children_errors.structuralError(msg)));
98
+ if (errors.length > 0) return { errors };
99
+ value = validation.value;
100
+ } else if (_babel_types.isIdentifier(child)) {
101
+ const validation = require_transform_jsx_children_validation_validateIdentifier.validateIdentifier(child, state);
102
+ errors.push(...validation.errors.map((msg) => require_transform_jsx_children_errors.dynamicContentError(msg)));
103
+ if (errors.length > 0) return { errors };
104
+ value = validation.value;
105
+ } else {
106
+ errors.push(require_transform_jsx_children_errors.dynamicContentError(require_utils_errors.generateDynamicContentErrorMessage() + require_utils_errors.createErrorLocation(child)));
107
+ return { errors };
108
+ }
109
+ return {
110
+ errors,
111
+ value
112
+ };
177
113
  }
178
114
  /**
179
- * Given a CallExpression path, constructs a JsxChild.
180
- * Handles: Jsx(T, ...children)
181
- */
115
+ * Given a CallExpression path, constructs a JsxChild.
116
+ * Handles: Jsx(T, ...children)
117
+ */
182
118
  function constructJsxElement(callExprPath, state, id) {
183
- const errors = [];
184
- const callExpr = callExprPath.node;
185
- // Validate that this is a jsx call
186
- const jsxValidation = (0, validateJsxCall_1.validateJsxCall)(callExpr, state);
187
- errors.push(...jsxValidation.map((msg) => (0, errors_2.dynamicContentError)(msg)));
188
- if (jsxValidation.length > 0) {
189
- return { errors };
190
- }
191
- // Increment id
192
- id.increment();
193
- // Get first argument
194
- if (callExpr.arguments.length === 0) {
195
- return { errors };
196
- }
197
- const firstArg = callExpr.arguments[0];
198
- if (!t.isExpression(firstArg)) {
199
- errors.push((0, errors_2.structuralError)(`Failed to construct JsxElement! First argument must be an expression` +
200
- (0, errors_1.createErrorLocation)(callExpr.arguments[0])));
201
- return { errors };
202
- }
203
- // Resolve canonical name
204
- const { namespaceName, functionName } = (0, getCalleeNameFromJsxExpressionParam_1.getCalleeNameFromJsxExpressionParam)(firstArg);
205
- if (!functionName) {
206
- errors.push((0, errors_2.structuralError)(`Failed to construct JsxElement! First argument must be a valid function` +
207
- (0, errors_1.createErrorLocation)(callExpr.arguments[0])));
208
- return { errors };
209
- }
210
- // Get the canonical function name
211
- const { canonicalName, type } = (0, getTrackedVariable_1.getTrackedVariable)(state.scopeTracker, namespaceName, functionName);
212
- // Handle variable components
213
- if (canonicalName &&
214
- type === 'generaltranslation' &&
215
- (0, helpers_2.isVariableComponent)(canonicalName)) {
216
- const variableValidation = constructVariable(canonicalName, callExpr.arguments, id);
217
- errors.push(...variableValidation.errors.map((msg) => (0, errors_2.structuralError)(msg)));
218
- if (variableValidation.errors.length > 0) {
219
- return { errors };
220
- }
221
- return { errors, value: variableValidation.value };
222
- }
223
- // Set the component name
224
- let componentName;
225
- const idNumber = id.get();
226
- if (canonicalName && type === 'generaltranslation') {
227
- // Handle GT components: <Var>, <Num>, <Currency>, etc.
228
- // Check that this is a gt component
229
- if (!(0, helpers_2.isGTComponent)(canonicalName)) {
230
- errors.push((0, errors_2.structuralError)(`Failed to construct JsxElement! ${canonicalName} is not a valid GT component` +
231
- (0, errors_1.createErrorLocation)(callExpr.arguments[0])));
232
- return { errors };
233
- }
234
- // Derive/Static - opaque element, skip children validation
235
- // The compiler doesn't resolve Derive functions; the CLI handles that.
236
- if ((0, helpers_2.isDeriveComponent)(canonicalName)) {
237
- return {
238
- errors,
239
- value: { t: canonicalName, i: idNumber },
240
- };
241
- }
242
- // Get the name of the component
243
- componentName = canonicalName;
244
- }
245
- else if (canonicalName && type === 'react') {
246
- // Handle fragment + special react components
247
- if (!(0, helpers_1.isReactComponent)(canonicalName)) {
248
- errors.push((0, errors_2.structuralError)(`Failed to construct JsxElement! ${canonicalName} is not a valid React component` +
249
- (0, errors_1.createErrorLocation)(callExpr.arguments[0])));
250
- return { errors };
251
- }
252
- // Get the name of the component
253
- componentName =
254
- canonicalName === constants_1.REACT_COMPONENTS.Fragment
255
- ? `C${id.get()}`
256
- : functionName;
257
- }
258
- else {
259
- // Handle all other components: div, etc.
260
- componentName = functionName;
261
- }
262
- // Get children from args
263
- const childrenValidation = (0, validateChildrenFromArgs_1.validateChildrenFromArgs)(callExprPath);
264
- if (childrenValidation.errors.length > 0) {
265
- errors.push(...childrenValidation.errors.map((msg) => (0, errors_2.structuralError)(msg)));
266
- return { errors };
267
- }
268
- // Construct JsxChildren
269
- // For branching components (Branch/Plural), use id.copy() so children and
270
- // branch props start counting from the same base independently.
271
- const jsxChildrenValidation = constructJsxChildrenForJsxElement(childrenValidation.value, state, (0, helpers_2.isBranchComponent)(canonicalName !== null && canonicalName !== void 0 ? canonicalName : '') ? id.copy() : id);
272
- errors.push(...jsxChildrenValidation.errors);
273
- if (jsxChildrenValidation.errors.length > 0) {
274
- return { errors };
275
- }
276
- const children = jsxChildrenValidation.value;
277
- // Construct GT Tag
278
- const tagValidation = constructGTProp(callExprPath, id, state, canonicalName, type);
279
- errors.push(...tagValidation.errors);
280
- if (tagValidation.errors.length > 0) {
281
- return { errors };
282
- }
283
- const tag = tagValidation.value;
284
- // Return result
285
- const value = Object.assign(Object.assign({ t: componentName, i: idNumber }, (tag !== undefined && { d: tag })), (children !== undefined && { c: children }));
286
- return { errors, value };
119
+ const errors = [];
120
+ const callExpr = callExprPath.node;
121
+ const jsxValidation = require_transform_jsx_children_validation_validateJsxCall.validateJsxCall(callExpr, state);
122
+ errors.push(...jsxValidation.map((msg) => require_transform_jsx_children_errors.dynamicContentError(msg)));
123
+ if (jsxValidation.length > 0) return { errors };
124
+ id.increment();
125
+ if (callExpr.arguments.length === 0) return { errors };
126
+ const firstArg = callExpr.arguments[0];
127
+ if (!_babel_types.isExpression(firstArg)) {
128
+ errors.push(require_transform_jsx_children_errors.structuralError(`Failed to construct JsxElement! First argument must be an expression` + require_utils_errors.createErrorLocation(callExpr.arguments[0])));
129
+ return { errors };
130
+ }
131
+ const { namespaceName, functionName } = require_transform_jsx_children_utils_getCalleeNameFromJsxExpressionParam.getCalleeNameFromJsxExpressionParam(firstArg);
132
+ if (!functionName) {
133
+ errors.push(require_transform_jsx_children_errors.structuralError(`Failed to construct JsxElement! First argument must be a valid function` + require_utils_errors.createErrorLocation(callExpr.arguments[0])));
134
+ return { errors };
135
+ }
136
+ const { canonicalName, type } = require_transform_getTrackedVariable.getTrackedVariable(state.scopeTracker, namespaceName, functionName);
137
+ if (canonicalName && type === "generaltranslation" && require_utils_constants_gt_helpers.isVariableComponent(canonicalName)) {
138
+ const variableValidation = constructVariable(canonicalName, callExpr.arguments, id);
139
+ errors.push(...variableValidation.errors.map((msg) => require_transform_jsx_children_errors.structuralError(msg)));
140
+ if (variableValidation.errors.length > 0) return { errors };
141
+ return {
142
+ errors,
143
+ value: variableValidation.value
144
+ };
145
+ }
146
+ let componentName;
147
+ const idNumber = id.get();
148
+ if (canonicalName && type === "generaltranslation") {
149
+ if (!require_utils_constants_gt_helpers.isGTComponent(canonicalName)) {
150
+ errors.push(require_transform_jsx_children_errors.structuralError(`Failed to construct JsxElement! ${canonicalName} is not a valid GT component` + require_utils_errors.createErrorLocation(callExpr.arguments[0])));
151
+ return { errors };
152
+ }
153
+ if (require_utils_constants_gt_helpers.isDeriveComponent(canonicalName)) return {
154
+ errors,
155
+ value: {
156
+ t: canonicalName,
157
+ i: idNumber
158
+ }
159
+ };
160
+ componentName = canonicalName;
161
+ } else if (canonicalName && type === "react") {
162
+ if (!require_utils_constants_react_helpers.isReactComponent(canonicalName)) {
163
+ errors.push(require_transform_jsx_children_errors.structuralError(`Failed to construct JsxElement! ${canonicalName} is not a valid React component` + require_utils_errors.createErrorLocation(callExpr.arguments[0])));
164
+ return { errors };
165
+ }
166
+ componentName = canonicalName === "Fragment" ? `C${id.get()}` : functionName;
167
+ } else componentName = functionName;
168
+ const childrenValidation = require_transform_jsx_children_validation_validateChildrenFromArgs.validateChildrenFromArgs(callExprPath);
169
+ if (childrenValidation.errors.length > 0) {
170
+ errors.push(...childrenValidation.errors.map((msg) => require_transform_jsx_children_errors.structuralError(msg)));
171
+ return { errors };
172
+ }
173
+ const jsxChildrenValidation = constructJsxChildrenForJsxElement(childrenValidation.value, state, require_utils_constants_gt_helpers.isBranchComponent(canonicalName ?? "") ? id.copy() : id);
174
+ errors.push(...jsxChildrenValidation.errors);
175
+ if (jsxChildrenValidation.errors.length > 0) return { errors };
176
+ const children = jsxChildrenValidation.value;
177
+ const tagValidation = constructGTProp(callExprPath, id, state, canonicalName, type);
178
+ errors.push(...tagValidation.errors);
179
+ if (tagValidation.errors.length > 0) return { errors };
180
+ const tag = tagValidation.value;
181
+ return {
182
+ errors,
183
+ value: {
184
+ t: componentName,
185
+ i: idNumber,
186
+ ...tag !== void 0 && { d: tag },
187
+ ...children !== void 0 && { c: children }
188
+ }
189
+ };
287
190
  }
288
191
  /**
289
- * Construct JsxChildren for a JsxElement
290
- * This is slightly different from constructJsxChildren in how it handles nullLiteral and booleanLiteral
291
- */
192
+ * Construct JsxChildren for a JsxElement
193
+ * This is slightly different from constructJsxChildren in how it handles nullLiteral and booleanLiteral
194
+ */
292
195
  function constructJsxChildrenForJsxElement(childrenPath, state, id) {
293
- const errors = [];
294
- const children = childrenPath === null || childrenPath === void 0 ? void 0 : childrenPath.node;
295
- // Special children edge cases: nullLiteral, booleanLiteral
296
- if (t.isNullLiteral(children)) {
297
- return { errors, value: undefined };
298
- }
299
- if (t.isBooleanLiteral(children)) {
300
- return {
301
- errors,
302
- value: (children.value || undefined),
303
- };
304
- }
305
- // Construct JsxChildren
306
- return constructJsxChildren(childrenPath, state, id);
196
+ const errors = [];
197
+ const children = childrenPath === null || childrenPath === void 0 ? void 0 : childrenPath.node;
198
+ if (_babel_types.isNullLiteral(children)) return {
199
+ errors,
200
+ value: void 0
201
+ };
202
+ if (_babel_types.isBooleanLiteral(children)) return {
203
+ errors,
204
+ value: children.value || void 0
205
+ };
206
+ return constructJsxChildren(childrenPath, state, id);
307
207
  }
308
208
  /**
309
- * Given a canonical name, constructs a GTProp
310
- */
209
+ * Given a canonical name, constructs a GTProp
210
+ */
311
211
  function constructGTProp(callExprPath, id, state, canonicalName, type) {
312
- const errors = [];
313
- const value = {};
314
- const args = callExprPath.node.arguments;
315
- // Validate Parameters
316
- if (args.length < 2) {
317
- errors.push((0, errors_2.structuralError)('Failed to construct GTProp! Missing parameters' +
318
- (0, errors_1.createErrorLocation)(args[0])));
319
- return { errors };
320
- }
321
- const parameters = args[1];
322
- if (!t.isObjectExpression(parameters)) {
323
- errors.push((0, errors_2.structuralError)('Failed to construct GTProp! Parameter field must be an object expression' +
324
- (0, errors_1.createErrorLocation)(args[1])));
325
- return { errors };
326
- }
327
- // For Branch and Plural, get the properties
328
- const parametersPath = callExprPath.get('arguments')[1];
329
- if (canonicalName &&
330
- type === 'generaltranslation' &&
331
- (0, helpers_2.isBranchComponent)(canonicalName)) {
332
- // Get the branching parameters
333
- const branchingParameters = (0, getBranchComponentParameters_1.getBranchComponentParameters)(parametersPath, canonicalName);
334
- // Add branch component branches
335
- const branches = {};
336
- for (const [name, parameterPath] of branchingParameters) {
337
- const parameter = parameterPath.node;
338
- // Special exceptions for branches:
339
- if (t.isNullLiteral(parameter)) {
340
- branches[name] = null;
341
- continue;
342
- }
343
- else if (t.isBooleanLiteral(parameter)) {
344
- branches[name] = parameter.value;
345
- continue;
346
- }
347
- // Otherwise, construct the JsxChildren
348
- const validation = constructJsxChildren(parameterPath, state, id.copy());
349
- errors.push(...validation.errors);
350
- if (validation.errors.length > 0) {
351
- return { errors };
352
- }
353
- if (validation.value === undefined)
354
- continue;
355
- branches[name] = validation.value;
356
- }
357
- if (Object.keys(branches).length > 0) {
358
- value['b'] = branches;
359
- value['t'] = canonicalName === constants_2.GT_COMPONENT_TYPES.Branch ? 'b' : 'p';
360
- }
361
- }
362
- else {
363
- // Get the html content props
364
- Object.entries(types_1.HTML_CONTENT_PROPS).forEach(([prop, name]) => {
365
- const validation = (0, validateStringLiteralPropertyFromArg_1.validateStringLiteralPropertyFromArg)(parameters, name);
366
- if (validation.errors.length > 0) {
367
- errors.push(...validation.errors.map((msg) => (0, errors_2.structuralError)(msg)));
368
- return { errors };
369
- }
370
- if (validation.value === undefined)
371
- return;
372
- value[prop] = validation.value;
373
- });
374
- }
375
- // Return result
376
- return { errors, value: Object.keys(value).length > 0 ? value : undefined };
212
+ const errors = [];
213
+ const value = {};
214
+ const args = callExprPath.node.arguments;
215
+ if (args.length < 2) {
216
+ errors.push(require_transform_jsx_children_errors.structuralError("Failed to construct GTProp! Missing parameters" + require_utils_errors.createErrorLocation(args[0])));
217
+ return { errors };
218
+ }
219
+ const parameters = args[1];
220
+ if (!_babel_types.isObjectExpression(parameters)) {
221
+ errors.push(require_transform_jsx_children_errors.structuralError("Failed to construct GTProp! Parameter field must be an object expression" + require_utils_errors.createErrorLocation(args[1])));
222
+ return { errors };
223
+ }
224
+ const parametersPath = callExprPath.get("arguments")[1];
225
+ if (canonicalName && type === "generaltranslation" && require_utils_constants_gt_helpers.isBranchComponent(canonicalName)) {
226
+ const branchingParameters = require_transform_jsx_children_utils_getBranchComponentParameters.getBranchComponentParameters(parametersPath, canonicalName);
227
+ const branches = {};
228
+ for (const [name, parameterPath] of branchingParameters) {
229
+ const parameter = parameterPath.node;
230
+ if (_babel_types.isNullLiteral(parameter)) {
231
+ branches[name] = null;
232
+ continue;
233
+ } else if (_babel_types.isBooleanLiteral(parameter)) {
234
+ branches[name] = parameter.value;
235
+ continue;
236
+ }
237
+ const validation = constructJsxChildren(parameterPath, state, id.copy());
238
+ errors.push(...validation.errors);
239
+ if (validation.errors.length > 0) return { errors };
240
+ if (validation.value === void 0) continue;
241
+ branches[name] = validation.value;
242
+ }
243
+ if (Object.keys(branches).length > 0) {
244
+ value["b"] = branches;
245
+ value["t"] = canonicalName === "Branch" ? "b" : "p";
246
+ }
247
+ } else Object.entries(_generaltranslation_format_types.HTML_CONTENT_PROPS).forEach(([prop, name]) => {
248
+ const validation = require_transform_jsx_children_validation_validateStringLiteralPropertyFromArg.validateStringLiteralPropertyFromArg(parameters, name);
249
+ if (validation.errors.length > 0) {
250
+ errors.push(...validation.errors.map((msg) => require_transform_jsx_children_errors.structuralError(msg)));
251
+ return { errors };
252
+ }
253
+ if (validation.value === void 0) return;
254
+ value[prop] = validation.value;
255
+ });
256
+ return {
257
+ errors,
258
+ value: Object.keys(value).length > 0 ? value : void 0
259
+ };
377
260
  }
378
261
  /**
379
- * Construct Variable
380
- */
262
+ * Construct Variable
263
+ */
381
264
  function constructVariable(canonicalName, args, id) {
382
- const errors = [];
383
- // Validate Parameters
384
- if (args.length < 2) {
385
- errors.push('Failed to construct GTProp! Missing parameters' +
386
- (0, errors_1.createErrorLocation)(args[0]));
387
- return { errors };
388
- }
389
- const parameters = args[1];
390
- if (!t.isObjectExpression(parameters)) {
391
- errors.push('Failed to construct GTProp! Parameter field must be an object expression' +
392
- (0, errors_1.createErrorLocation)(args[1]));
393
- return { errors };
394
- }
395
- // Validate Parameters
396
- const nameValidation = (0, validateNameFieldForVarComponent_1.validateNameFieldForVarComponent)(parameters);
397
- errors.push(...nameValidation.errors);
398
- if (nameValidation.errors.length > 0) {
399
- return { errors };
400
- }
401
- const name = nameValidation.value;
402
- // Check for name field
403
- const value = {
404
- i: id.get(),
405
- k: (0, helpers_2.getVariableName)(canonicalName, id.get(), name),
406
- v: (0, helpers_2.minifyCanonicalName)(canonicalName),
407
- };
408
- return { errors, value };
265
+ const errors = [];
266
+ if (args.length < 2) {
267
+ errors.push("Failed to construct GTProp! Missing parameters" + require_utils_errors.createErrorLocation(args[0]));
268
+ return { errors };
269
+ }
270
+ const parameters = args[1];
271
+ if (!_babel_types.isObjectExpression(parameters)) {
272
+ errors.push("Failed to construct GTProp! Parameter field must be an object expression" + require_utils_errors.createErrorLocation(args[1]));
273
+ return { errors };
274
+ }
275
+ const nameValidation = require_transform_jsx_children_validation_validateNameFieldForVarComponent.validateNameFieldForVarComponent(parameters);
276
+ errors.push(...nameValidation.errors);
277
+ if (nameValidation.errors.length > 0) return { errors };
278
+ const name = nameValidation.value;
279
+ return {
280
+ errors,
281
+ value: {
282
+ i: id.get(),
283
+ k: require_utils_constants_gt_helpers.getVariableName(canonicalName, id.get(), name),
284
+ v: require_utils_constants_gt_helpers.minifyCanonicalName(canonicalName)
285
+ }
286
+ };
409
287
  }
288
+ //#endregion
289
+ exports.constructJsxChildren = constructJsxChildren;
290
+
410
291
  //# sourceMappingURL=constructJsxChildren.js.map