@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.
- package/dist/_virtual/_rolldown/runtime.js +23 -0
- package/dist/config.js +32 -27
- package/dist/config.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +120 -187
- package/dist/index.js.map +1 -1
- package/dist/passes/basePass.js +40 -83
- package/dist/passes/basePass.js.map +1 -1
- package/dist/passes/collectionPass.js +18 -11
- package/dist/passes/collectionPass.js.map +1 -1
- package/dist/passes/handleErrors.js +21 -30
- package/dist/passes/handleErrors.js.map +1 -1
- package/dist/passes/injectionPass.js +15 -9
- package/dist/passes/injectionPass.js.map +1 -1
- package/dist/passes/jsxInsertionPass.js +33 -31
- package/dist/passes/jsxInsertionPass.js.map +1 -1
- package/dist/passes/macroExpansionPass.js +28 -26
- package/dist/passes/macroExpansionPass.js.map +1 -1
- package/dist/passes/runtimeTranslatePass.js +37 -35
- package/dist/passes/runtimeTranslatePass.js.map +1 -1
- package/dist/processing/collection/processCallExpression.js +144 -249
- package/dist/processing/collection/processCallExpression.js.map +1 -1
- package/dist/processing/collection/processTaggedTemplateExpression.js +38 -75
- package/dist/processing/collection/processTaggedTemplateExpression.js.map +1 -1
- package/dist/processing/collection/processVariableDeclarator.js +20 -18
- package/dist/processing/collection/processVariableDeclarator.js.map +1 -1
- package/dist/processing/index.js +29 -31
- package/dist/processing/injection/processCallExpression.js +69 -142
- package/dist/processing/injection/processCallExpression.js.map +1 -1
- package/dist/processing/injection/processVariableDeclarator.js +22 -20
- package/dist/processing/injection/processVariableDeclarator.js.map +1 -1
- package/dist/processing/jsx-insertion/processCallExpression.js +284 -393
- package/dist/processing/jsx-insertion/processCallExpression.js.map +1 -1
- package/dist/processing/jsx-insertion/processImportDeclaration.js +37 -83
- package/dist/processing/jsx-insertion/processImportDeclaration.js.map +1 -1
- package/dist/processing/jsx-insertion/processProgram.js +26 -66
- package/dist/processing/jsx-insertion/processProgram.js.map +1 -1
- package/dist/processing/macro-expansion/processImportDeclaration.js +21 -55
- package/dist/processing/macro-expansion/processImportDeclaration.js.map +1 -1
- package/dist/processing/macro-expansion/processProgram.js +20 -26
- package/dist/processing/macro-expansion/processProgram.js.map +1 -1
- package/dist/processing/macro-expansion/processTaggedTemplateExpression.js +33 -69
- package/dist/processing/macro-expansion/processTaggedTemplateExpression.js.map +1 -1
- package/dist/processing/processArrowFunctionExpression.js +18 -16
- package/dist/processing/processArrowFunctionExpression.js.map +1 -1
- package/dist/processing/processAssignmentExpression.js +12 -10
- package/dist/processing/processAssignmentExpression.js.map +1 -1
- package/dist/processing/processCatchClause.js +18 -16
- package/dist/processing/processCatchClause.js.map +1 -1
- package/dist/processing/processClassDeclaration.js +18 -16
- package/dist/processing/processClassDeclaration.js.map +1 -1
- package/dist/processing/processClassMethod.js +18 -17
- package/dist/processing/processClassMethod.js.map +1 -1
- package/dist/processing/processClassPrivateMethod.js +18 -17
- package/dist/processing/processClassPrivateMethod.js.map +1 -1
- package/dist/processing/processForInStatement.js +18 -16
- package/dist/processing/processForInStatement.js.map +1 -1
- package/dist/processing/processForOfStatement.js +18 -16
- package/dist/processing/processForOfStatement.js.map +1 -1
- package/dist/processing/processFunctionDeclaration.js +20 -18
- package/dist/processing/processFunctionDeclaration.js.map +1 -1
- package/dist/processing/processFunctionExpression.js +26 -24
- package/dist/processing/processFunctionExpression.js.map +1 -1
- package/dist/processing/processImportDeclaration.js +11 -9
- package/dist/processing/processImportDeclaration.js.map +1 -1
- package/dist/processing/processObjectMethod.js +19 -18
- package/dist/processing/processObjectMethod.js.map +1 -1
- package/dist/processing/processProgram.js +13 -13
- package/dist/processing/processProgram.js.map +1 -1
- package/dist/processing/processScopeChange.js +15 -13
- package/dist/processing/processScopeChange.js.map +1 -1
- package/dist/processing/runtime-translate/processImportDeclaration.js +30 -63
- package/dist/processing/runtime-translate/processImportDeclaration.js.map +1 -1
- package/dist/processing/runtime-translate/processProgram.js +34 -57
- package/dist/processing/runtime-translate/processProgram.js.map +1 -1
- package/dist/state/ErrorTracker.js +18 -17
- package/dist/state/ErrorTracker.js.map +1 -1
- package/dist/state/Logger.js +42 -52
- package/dist/state/Logger.js.map +1 -1
- package/dist/state/ScopeTracker.d.ts +11 -2
- package/dist/state/ScopeTracker.d.ts.map +1 -1
- package/dist/state/ScopeTracker.js +154 -209
- package/dist/state/ScopeTracker.js.map +1 -1
- package/dist/state/StringCollector.d.ts +9 -2
- package/dist/state/StringCollector.d.ts.map +1 -1
- package/dist/state/StringCollector.js +165 -184
- package/dist/state/StringCollector.js.map +1 -1
- package/dist/state/types.js +1 -3
- package/dist/state/utils/initializeState.js +62 -67
- package/dist/state/utils/initializeState.js.map +1 -1
- package/dist/transform/getTrackedVariable.js +33 -38
- package/dist/transform/getTrackedVariable.js.map +1 -1
- package/dist/transform/injection/callbacks/injectUseGTCallbackParameters.js +19 -27
- package/dist/transform/injection/callbacks/injectUseGTCallbackParameters.js.map +1 -1
- package/dist/transform/injection/callbacks/injectUseMessagesCallbackParameters.js +8 -6
- package/dist/transform/injection/callbacks/injectUseMessagesCallbackParameters.js.map +1 -1
- package/dist/transform/injection/callbacks/injectUseTranslationsCallbackParameters.js +8 -6
- package/dist/transform/injection/callbacks/injectUseTranslationsCallbackParameters.js.map +1 -1
- package/dist/transform/injection/injectCallbackDeclaratorFunctionParameters.js +74 -155
- package/dist/transform/injection/injectCallbackDeclaratorFunctionParameters.js.map +1 -1
- package/dist/transform/injection/injectHashIntoTranslationOptions.js +21 -61
- package/dist/transform/injection/injectHashIntoTranslationOptions.js.map +1 -1
- package/dist/transform/injection/injectStandaloneTFunctionParameters.js +21 -27
- package/dist/transform/injection/injectStandaloneTFunctionParameters.js.map +1 -1
- package/dist/transform/injection/injectTComponentParameters.js +25 -65
- package/dist/transform/injection/injectTComponentParameters.js.map +1 -1
- package/dist/transform/jsx-children/constructJsxChildren.d.ts +1 -1
- package/dist/transform/jsx-children/constructJsxChildren.d.ts.map +1 -1
- package/dist/transform/jsx-children/constructJsxChildren.js +273 -392
- package/dist/transform/jsx-children/constructJsxChildren.js.map +1 -1
- package/dist/transform/jsx-children/errors.js +16 -6
- package/dist/transform/jsx-children/errors.js.map +1 -1
- package/dist/transform/jsx-children/index.js +3 -6
- package/dist/transform/jsx-children/utils/getBranchComponentParameters.js +26 -85
- package/dist/transform/jsx-children/utils/getBranchComponentParameters.js.map +1 -1
- package/dist/transform/jsx-children/utils/getCalleeNameFromJsxExpressionParam.js +33 -66
- package/dist/transform/jsx-children/utils/getCalleeNameFromJsxExpressionParam.js.map +1 -1
- package/dist/transform/jsx-children/utils/id.js +18 -17
- package/dist/transform/jsx-children/utils/id.js.map +1 -1
- package/dist/transform/jsx-children/validation/validateChildrenElement.js +13 -47
- package/dist/transform/jsx-children/validation/validateChildrenElement.js.map +1 -1
- package/dist/transform/jsx-children/validation/validateChildrenFromArgs.js +25 -63
- package/dist/transform/jsx-children/validation/validateChildrenFromArgs.js.map +1 -1
- package/dist/transform/jsx-children/validation/validateIdentifier.js +38 -41
- package/dist/transform/jsx-children/validation/validateIdentifier.js.map +1 -1
- package/dist/transform/jsx-children/validation/validateJsxCall.js +15 -26
- package/dist/transform/jsx-children/validation/validateJsxCall.js.map +1 -1
- package/dist/transform/jsx-children/validation/validateNameFieldForVarComponent.js +33 -61
- package/dist/transform/jsx-children/validation/validateNameFieldForVarComponent.js.map +1 -1
- package/dist/transform/jsx-children/validation/validateStringLiteralPropertyFromArg.js +38 -66
- package/dist/transform/jsx-children/validation/validateStringLiteralPropertyFromArg.js.map +1 -1
- package/dist/transform/jsx-children/validation/validateTemplateLiteral.js +17 -13
- package/dist/transform/jsx-children/validation/validateTemplateLiteral.js.map +1 -1
- package/dist/transform/jsx-children/validation/validateUnaryExpression.js +26 -61
- package/dist/transform/jsx-children/validation/validateUnaryExpression.js.map +1 -1
- package/dist/transform/jsx-insertion/injectJsxInsertionImport.js +16 -48
- package/dist/transform/jsx-insertion/injectJsxInsertionImport.js.map +1 -1
- package/dist/transform/macro-expansion/injectMacroImport.js +14 -43
- package/dist/transform/macro-expansion/injectMacroImport.js.map +1 -1
- package/dist/transform/macro-expansion/transformTemplateLiteral.js +23 -22
- package/dist/transform/macro-expansion/transformTemplateLiteral.js.map +1 -1
- package/dist/transform/registration/callbacks/registerUseGTCallback.js +27 -34
- package/dist/transform/registration/callbacks/registerUseGTCallback.js.map +1 -1
- package/dist/transform/registration/callbacks/registerUseMessagesCallback.js +9 -9
- package/dist/transform/registration/callbacks/registerUseMessagesCallback.js.map +1 -1
- package/dist/transform/registration/callbacks/registerUseTranslationsCallback.js +9 -9
- package/dist/transform/registration/callbacks/registerUseTranslationsCallback.js.map +1 -1
- package/dist/transform/registration/registerStandaloneTranslation.js +27 -28
- package/dist/transform/registration/registerStandaloneTranslation.js.map +1 -1
- package/dist/transform/registration/registerTranslationComponent.js +15 -15
- package/dist/transform/registration/registerTranslationComponent.js.map +1 -1
- package/dist/transform/runtime-translate/buildRuntimeTranslateCalls.js +34 -85
- package/dist/transform/runtime-translate/buildRuntimeTranslateCalls.js.map +1 -1
- package/dist/transform/runtime-translate/injectRuntimeTranslateImport.js +25 -55
- package/dist/transform/runtime-translate/injectRuntimeTranslateImport.js.map +1 -1
- package/dist/transform/tracking/trackAssignmentExpression.js +26 -63
- package/dist/transform/tracking/trackAssignmentExpression.js.map +1 -1
- package/dist/transform/tracking/trackCatchClause.js +17 -48
- package/dist/transform/tracking/trackCatchClause.js.map +1 -1
- package/dist/transform/tracking/trackClassDeclaration.js +13 -13
- package/dist/transform/tracking/trackClassDeclaration.js.map +1 -1
- package/dist/transform/tracking/trackForDeclaration.js +17 -53
- package/dist/transform/tracking/trackForDeclaration.js.map +1 -1
- package/dist/transform/tracking/trackFunctionName.js +10 -10
- package/dist/transform/tracking/trackFunctionName.js.map +1 -1
- package/dist/transform/tracking/trackFunctionParams.js +19 -54
- package/dist/transform/tracking/trackFunctionParams.js.map +1 -1
- package/dist/transform/tracking/trackImportDeclaration.js +36 -89
- package/dist/transform/tracking/trackImportDeclaration.js.map +1 -1
- package/dist/transform/tracking/trackOverridingVariable.js +9 -11
- package/dist/transform/tracking/trackOverridingVariable.js.map +1 -1
- package/dist/transform/tracking/trackVariableDeclarator.js +51 -102
- package/dist/transform/tracking/trackVariableDeclarator.js.map +1 -1
- package/dist/transform/validation/validateTranslationComponentArgs.d.ts +1 -1
- package/dist/transform/validation/validateTranslationComponentArgs.d.ts.map +1 -1
- package/dist/transform/validation/validateTranslationComponentArgs.js +156 -232
- package/dist/transform/validation/validateTranslationComponentArgs.js.map +1 -1
- package/dist/transform/validation/validateTranslationFunction.js +218 -329
- package/dist/transform/validation/validateTranslationFunction.js.map +1 -1
- package/dist/utils/calculateHash.d.ts +1 -1
- package/dist/utils/calculateHash.d.ts.map +1 -1
- package/dist/utils/calculateHash.js +55 -70
- package/dist/utils/calculateHash.js.map +1 -1
- package/dist/utils/constants/gt/constants.js +142 -132
- package/dist/utils/constants/gt/constants.js.map +1 -1
- package/dist/utils/constants/gt/helpers.d.ts +1 -1
- package/dist/utils/constants/gt/helpers.d.ts.map +1 -1
- package/dist/utils/constants/gt/helpers.js +147 -149
- package/dist/utils/constants/gt/helpers.js.map +1 -1
- package/dist/utils/constants/other/constants.js +45 -41
- package/dist/utils/constants/other/constants.js.map +1 -1
- package/dist/utils/constants/other/helpers.js +13 -11
- package/dist/utils/constants/other/helpers.js.map +1 -1
- package/dist/utils/constants/react/constants.js +47 -41
- package/dist/utils/constants/react/constants.js.map +1 -1
- package/dist/utils/constants/react/helpers.js +17 -16
- package/dist/utils/constants/react/helpers.js.map +1 -1
- package/dist/utils/constants/resolveIdentifier/isGTComponent.js +41 -76
- package/dist/utils/constants/resolveIdentifier/isGTComponent.js.map +1 -1
- package/dist/utils/constants/resolveIdentifier/isReactJsxFunction.js +33 -83
- package/dist/utils/constants/resolveIdentifier/isReactJsxFunction.js.map +1 -1
- package/dist/utils/errors.js +18 -20
- package/dist/utils/errors.js.map +1 -1
- package/dist/utils/multiplication/multiply.js +31 -35
- package/dist/utils/multiplication/multiply.js.map +1 -1
- package/dist/utils/multiplication/types.js +1 -3
- package/dist/utils/parsing/extractIdentifiersFromLVal.js +30 -96
- package/dist/utils/parsing/extractIdentifiersFromLVal.js.map +1 -1
- package/dist/utils/parsing/getCalleeNameFromExpression.js +31 -65
- package/dist/utils/parsing/getCalleeNameFromExpression.js.map +1 -1
- package/dist/utils/parsing/getCalleeNameFromExpressionWrapper.js +13 -10
- package/dist/utils/parsing/getCalleeNameFromExpressionWrapper.js.map +1 -1
- package/dist/utils/parsing/getObjectPropertyFromObjectExpression.js +19 -56
- package/dist/utils/parsing/getObjectPropertyFromObjectExpression.js.map +1 -1
- package/dist/utils/parsing/getStringLiteralFromExpression.js +18 -49
- package/dist/utils/parsing/getStringLiteralFromExpression.js.map +1 -1
- package/dist/utils/parsing/isDeriveInvocation.js +25 -61
- package/dist/utils/parsing/isDeriveInvocation.js.map +1 -1
- package/dist/utils/parsing/isStringTranslationTaggedTemplate.js +23 -59
- package/dist/utils/parsing/isStringTranslationTaggedTemplate.js.map +1 -1
- package/dist/utils/string-expressions/buildTransformationResult.js +57 -96
- package/dist/utils/string-expressions/buildTransformationResult.js.map +1 -1
- package/dist/utils/string-expressions/flattenExpressionToParts.js +131 -142
- package/dist/utils/string-expressions/flattenExpressionToParts.js.map +1 -1
- package/dist/utils/string-expressions/resolveStaticExpression.js +36 -34
- package/dist/utils/string-expressions/resolveStaticExpression.js.map +1 -1
- package/dist/utils/validation/validateChildrenFromObjectExpression.js +29 -24
- package/dist/utils/validation/validateChildrenFromObjectExpression.js.map +1 -1
- package/dist/utils/validation/validateExpressionIsNumericLiteral.js +13 -47
- package/dist/utils/validation/validateExpressionIsNumericLiteral.js.map +1 -1
- package/dist/utils/validation/validateExpressionIsStringLiteral.js +15 -48
- package/dist/utils/validation/validateExpressionIsStringLiteral.js.map +1 -1
- package/package.json +8 -4
- package/dist/processing/index.js.map +0 -1
- package/dist/state/types.js.map +0 -1
- package/dist/transform/jsx-children/index.js.map +0 -1
- package/dist/utils/multiplication/types.js.map +0 -1
|
@@ -1,410 +1,291 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
function constructJsxChildren(childrenPath, state, id = new
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
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
|
-
|
|
119
|
-
|
|
120
|
-
|
|
74
|
+
* Given an Expression path, constructs a JsxChild.
|
|
75
|
+
* @returns { errors: string[]; value?: JsxChild }
|
|
76
|
+
*/
|
|
121
77
|
function constructJsxChild(childPath, state, id) {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
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
|
-
|
|
180
|
-
|
|
181
|
-
|
|
115
|
+
* Given a CallExpression path, constructs a JsxChild.
|
|
116
|
+
* Handles: Jsx(T, ...children)
|
|
117
|
+
*/
|
|
182
118
|
function constructJsxElement(callExprPath, state, id) {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
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
|
-
|
|
290
|
-
|
|
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
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
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
|
-
|
|
310
|
-
|
|
209
|
+
* Given a canonical name, constructs a GTProp
|
|
210
|
+
*/
|
|
311
211
|
function constructGTProp(callExprPath, id, state, canonicalName, type) {
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
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
|
-
|
|
380
|
-
|
|
262
|
+
* Construct Variable
|
|
263
|
+
*/
|
|
381
264
|
function constructVariable(canonicalName, args, id) {
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
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
|