@generaltranslation/compiler 1.3.25-odysseus.0 → 1.3.25-odysseus.1
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/passes/basePass.d.ts.map +1 -1
- package/dist/passes/basePass.js +9 -10
- package/dist/passes/basePass.js.map +1 -1
- package/dist/processing/processFunctionDeclaration.js +1 -1
- package/dist/processing/processFunctionExpression.js +1 -1
- package/dist/state/utils/initializeState.js +1 -1
- package/dist/transform/validation/validateTranslationComponentArgs.js +0 -1
- package/dist/transform/validation/validateTranslationComponentArgs.js.map +1 -1
- package/package.json +2 -2
- package/dist/processing/index.d.ts +0 -15
- package/dist/processing/index.d.ts.map +0 -1
- package/dist/processing/index.js +0 -29
- package/dist/transform/jsx-children/index.d.ts +0 -2
- package/dist/transform/jsx-children/index.d.ts.map +0 -1
- package/dist/transform/jsx-children/index.js +0 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"basePass.d.ts","sourceRoot":"","sources":["../../src/passes/basePass.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"basePass.d.ts","sourceRoot":"","sources":["../../src/passes/basePass.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAgBlD,wBAAgB,QAAQ,CAAC,KAAK,EAAE,cAAc,GAAG,eAAe,CAoD/D"}
|
package/dist/passes/basePass.js
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_processing_processProgram = require("../processing/processProgram.js");
|
|
3
|
+
const require_processing_processScopeChange = require("../processing/processScopeChange.js");
|
|
4
|
+
const require_processing_processFunctionDeclaration = require("../processing/processFunctionDeclaration.js");
|
|
5
|
+
const require_processing_processFunctionExpression = require("../processing/processFunctionExpression.js");
|
|
2
6
|
const require_processing_processArrowFunctionExpression = require("../processing/processArrowFunctionExpression.js");
|
|
3
|
-
const
|
|
4
|
-
const require_processing_processCatchClause = require("../processing/processCatchClause.js");
|
|
5
|
-
const require_processing_processClassDeclaration = require("../processing/processClassDeclaration.js");
|
|
7
|
+
const require_processing_processObjectMethod = require("../processing/processObjectMethod.js");
|
|
6
8
|
const require_processing_processClassMethod = require("../processing/processClassMethod.js");
|
|
7
9
|
const require_processing_processClassPrivateMethod = require("../processing/processClassPrivateMethod.js");
|
|
10
|
+
const require_processing_processImportDeclaration = require("../processing/processImportDeclaration.js");
|
|
11
|
+
const require_processing_processAssignmentExpression = require("../processing/processAssignmentExpression.js");
|
|
12
|
+
const require_processing_processClassDeclaration = require("../processing/processClassDeclaration.js");
|
|
8
13
|
const require_processing_processForInStatement = require("../processing/processForInStatement.js");
|
|
9
14
|
const require_processing_processForOfStatement = require("../processing/processForOfStatement.js");
|
|
10
|
-
const
|
|
11
|
-
const require_processing_processFunctionExpression = require("../processing/processFunctionExpression.js");
|
|
12
|
-
const require_processing_processImportDeclaration = require("../processing/processImportDeclaration.js");
|
|
13
|
-
const require_processing_processObjectMethod = require("../processing/processObjectMethod.js");
|
|
14
|
-
const require_processing_processProgram = require("../processing/processProgram.js");
|
|
15
|
-
const require_processing_processScopeChange = require("../processing/processScopeChange.js");
|
|
16
|
-
require("../processing/index.js");
|
|
15
|
+
const require_processing_processCatchClause = require("../processing/processCatchClause.js");
|
|
17
16
|
//#region src/passes/basePass.ts
|
|
18
17
|
function basePass(state) {
|
|
19
18
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"basePass.js","names":[],"sources":["../../src/passes/basePass.ts"],"sourcesContent":["import { TransformState } from '../state/types';\nimport { TraverseOptions } from '@babel/traverse';\nimport
|
|
1
|
+
{"version":3,"file":"basePass.js","names":["processProgram","processScopeChange","processFunctionDeclaration","processFunctionExpression","processArrowFunctionExpression","processObjectMethod","processClassMethod","processClassPrivateMethod","processImportDeclaration","processAssignmentExpression","processClassDeclaration","processForInStatement","processForOfStatement","processCatchClause"],"sources":["../../src/passes/basePass.ts"],"sourcesContent":["import { TransformState } from '../state/types';\nimport { TraverseOptions } from '@babel/traverse';\nimport { processProgram } from '../processing/processProgram';\nimport { processScopeChange } from '../processing/processScopeChange';\nimport { processFunctionDeclaration } from '../processing/processFunctionDeclaration';\nimport { processFunctionExpression } from '../processing/processFunctionExpression';\nimport { processArrowFunctionExpression } from '../processing/processArrowFunctionExpression';\nimport { processObjectMethod } from '../processing/processObjectMethod';\nimport { processClassMethod } from '../processing/processClassMethod';\nimport { processClassPrivateMethod } from '../processing/processClassPrivateMethod';\nimport { processImportDeclaration } from '../processing/processImportDeclaration';\nimport { processAssignmentExpression } from '../processing/processAssignmentExpression';\nimport { processClassDeclaration } from '../processing/processClassDeclaration';\nimport { processForInStatement } from '../processing/processForInStatement';\nimport { processForOfStatement } from '../processing/processForOfStatement';\nimport { processCatchClause } from '../processing/processCatchClause';\n\nexport function basePass(state: TransformState): TraverseOptions {\n return {\n // Initialize trackers for this program\n Program: processProgram(state),\n\n /* ----------------------------- */\n /* Scope management */\n /* ----------------------------- */\n\n // for(let T in obj) { ... }\n ForStatement: processScopeChange(state),\n // while(T) { ... }\n WhileStatement: processScopeChange(state),\n // switch(T) { ... }\n SwitchStatement: processScopeChange(state),\n // { ... }\n BlockStatement: processScopeChange(state),\n // static { ... }\n StaticBlock: processScopeChange(state),\n\n /* ----------------------------- */\n /* Shadowing tracking */\n /* ----------------------------- */\n\n // --- Function Processing --- //\n // function T() { ... }\n FunctionDeclaration: processFunctionDeclaration(state),\n // const a = function T() {...}\n FunctionExpression: processFunctionExpression(state),\n // () => {...}\n ArrowFunctionExpression: processArrowFunctionExpression(state),\n // { T() {} } in objects\n ObjectMethod: processObjectMethod(state),\n // Class GT { T() { ... } } in classes\n ClassMethod: processClassMethod(state),\n // Class GT { #T() {...} }\n ClassPrivateMethod: processClassPrivateMethod(state),\n\n // --- Other Processing --- //\n // import T from '...'\n ImportDeclaration: processImportDeclaration(state),\n // let t = useGT(); t = undefined;\n AssignmentExpression: processAssignmentExpression(state),\n // class T { ... }\n ClassDeclaration: processClassDeclaration(state),\n // for(let T in obj) { ... }\n ForInStatement: processForInStatement(state),\n // for(let T of items) { ... }\n ForOfStatement: processForOfStatement(state),\n // try { ... } catch(T) { ... }\n CatchClause: processCatchClause(state),\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAiBA,SAAgB,SAAS,OAAwC;AAC/D,QAAO;EAEL,SAASA,kCAAAA,eAAe,MAAM;EAO9B,cAAcC,sCAAAA,mBAAmB,MAAM;EAEvC,gBAAgBA,sCAAAA,mBAAmB,MAAM;EAEzC,iBAAiBA,sCAAAA,mBAAmB,MAAM;EAE1C,gBAAgBA,sCAAAA,mBAAmB,MAAM;EAEzC,aAAaA,sCAAAA,mBAAmB,MAAM;EAQtC,qBAAqBC,8CAAAA,2BAA2B,MAAM;EAEtD,oBAAoBC,6CAAAA,0BAA0B,MAAM;EAEpD,yBAAyBC,kDAAAA,+BAA+B,MAAM;EAE9D,cAAcC,uCAAAA,oBAAoB,MAAM;EAExC,aAAaC,sCAAAA,mBAAmB,MAAM;EAEtC,oBAAoBC,6CAAAA,0BAA0B,MAAM;EAIpD,mBAAmBC,4CAAAA,yBAAyB,MAAM;EAElD,sBAAsBC,+CAAAA,4BAA4B,MAAM;EAExD,kBAAkBC,2CAAAA,wBAAwB,MAAM;EAEhD,gBAAgBC,yCAAAA,sBAAsB,MAAM;EAE5C,gBAAgBC,yCAAAA,sBAAsB,MAAM;EAE5C,aAAaC,sCAAAA,mBAAmB,MAAM;EACvC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_transform_tracking_trackFunctionParams = require("../transform/tracking/trackFunctionParams.js");
|
|
3
2
|
const require_transform_tracking_trackFunctionName = require("../transform/tracking/trackFunctionName.js");
|
|
3
|
+
const require_transform_tracking_trackFunctionParams = require("../transform/tracking/trackFunctionParams.js");
|
|
4
4
|
//#region src/processing/processFunctionDeclaration.ts
|
|
5
5
|
/**
|
|
6
6
|
* Process function declaration:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_transform_tracking_trackFunctionParams = require("../transform/tracking/trackFunctionParams.js");
|
|
3
2
|
const require_transform_tracking_trackFunctionName = require("../transform/tracking/trackFunctionName.js");
|
|
3
|
+
const require_transform_tracking_trackFunctionParams = require("../transform/tracking/trackFunctionParams.js");
|
|
4
4
|
//#region src/processing/processFunctionExpression.ts
|
|
5
5
|
/**
|
|
6
6
|
* Process function expression:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_config = require("../../config.js");
|
|
3
|
-
require("../../utils/constants/gt/constants.js");
|
|
4
3
|
const require_state_ScopeTracker = require("../ScopeTracker.js");
|
|
4
|
+
require("../../utils/constants/gt/constants.js");
|
|
5
5
|
const require_state_StringCollector = require("../StringCollector.js");
|
|
6
6
|
const require_state_Logger = require("../Logger.js");
|
|
7
7
|
const require_state_ErrorTracker = require("../ErrorTracker.js");
|
|
@@ -6,7 +6,6 @@ const require_utils_parsing_getObjectPropertyFromObjectExpression = require("../
|
|
|
6
6
|
const require_utils_validation_validateExpressionIsStringLiteral = require("../../utils/validation/validateExpressionIsStringLiteral.js");
|
|
7
7
|
const require_utils_validation_validateChildrenFromObjectExpression = require("../../utils/validation/validateChildrenFromObjectExpression.js");
|
|
8
8
|
const require_transform_jsx_children_constructJsxChildren = require("../jsx-children/constructJsxChildren.js");
|
|
9
|
-
require("../jsx-children/index.js");
|
|
10
9
|
const require_utils_validation_validateExpressionIsNumericLiteral = require("../../utils/validation/validateExpressionIsNumericLiteral.js");
|
|
11
10
|
let _babel_types = require("@babel/types");
|
|
12
11
|
_babel_types = require_runtime.__toESM(_babel_types);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validateTranslationComponentArgs.js","names":["t","validateChildrenPropertyFromObjectExpression","constructJsxChildren","getObjectPropertyFromObjectExpression","validateExpressionIsStringLiteral","validateExpressionIsNumericLiteral"],"sources":["../../../src/transform/validation/validateTranslationComponentArgs.ts"],"sourcesContent":["import { TransformState } from '../../state/types';\nimport { GT_COMPONENT_TYPES } from '../../utils/constants/gt/constants';\nimport * as t from '@babel/types';\nimport type { NodePath } from '@babel/traverse';\nimport { getObjectPropertyFromObjectExpression } from '../../utils/parsing/getObjectPropertyFromObjectExpression';\nimport { validateExpressionIsStringLiteral } from '../../utils/validation/validateExpressionIsStringLiteral';\nimport type { JsxChildren } from '@generaltranslation/format/types';\nimport { constructJsxChildren } from '../jsx-children';\nimport { validateChildrenPropertyFromObjectExpression } from '../../utils/validation/validateChildrenFromObjectExpression';\nimport { validateExpressionIsNumericLiteral } from '../../utils/validation/validateExpressionIsNumericLiteral';\nimport { validateDerive } from './validateTranslationFunction';\nimport { JsxValidationError } from '../jsx-children/errors';\n/**\n * Given a translation component, validate the arguments\n */\nexport function validateTranslationComponentArgs(\n callExprPath: NodePath<t.CallExpression>,\n canonicalName: string,\n state: TransformState\n): {\n errors: string[];\n _hash?: string;\n id?: string;\n context?: string;\n maxChars?: number;\n children?: JsxChildren;\n hasDeriveContext?: boolean;\n} {\n const callExpr = callExprPath.node;\n // Check that there are at least 2 arguments (identifier, args)\n if (callExpr.arguments.length < 2) {\n const errors = [\n 'Translation component must have at least 2 arguments (identifier, args)',\n ];\n return { errors };\n }\n\n // Get the component args\n const args = callExpr.arguments[1];\n if (!t.isObjectExpression(args)) {\n const errors = [\n 'Translation component must have an object expression as the second argument',\n ];\n return { errors };\n }\n const argsPath = callExprPath.get('arguments')[1];\n if (!argsPath?.isObjectExpression()) {\n const errors = [\n 'Translation component must have an object expression as the second argument',\n ];\n return { errors };\n }\n\n // Map to appropriate validation function\n switch (canonicalName) {\n case GT_COMPONENT_TYPES.T:\n case GT_COMPONENT_TYPES.GtInternalTranslateJsx:\n return validateTComponentArgs(\n argsPath as NodePath<t.ObjectExpression>,\n state\n );\n default:\n const errors = [\n `Invalid translation component: ${canonicalName}. You likely passed a non-translation component to validateTranslationComponentArgs`,\n ];\n return { errors };\n }\n}\n\n/* =============================== */\n/* Helper Functions */\n/* =============================== */\n\nfunction validateTComponentArgs(\n argsPath: NodePath<t.ObjectExpression>,\n state: TransformState\n): {\n errors: string[];\n _hash?: string;\n id?: string;\n context?: string;\n maxChars?: number;\n children?: JsxChildren;\n hasDeriveContext?: boolean;\n} {\n const errors: string[] = [];\n const args = argsPath.node;\n\n // Validate id\n const idValidation = validateStringProperty(args, 'id');\n errors.push(...idValidation.errors);\n const id = idValidation.value;\n\n // Validate context (with derive fallback)\n const contextValidation = validateStringProperty(args, 'context', state);\n errors.push(...contextValidation.errors);\n const context = contextValidation.value;\n // Validate maxChars\n const maxCharsValidation = validateNumberProperty(args, 'maxChars');\n errors.push(...maxCharsValidation.errors);\n const maxChars = maxCharsValidation.value;\n\n // Validate hash\n const hashValidation = validateStringProperty(args, '_hash');\n errors.push(...hashValidation.errors);\n const _hash = hashValidation.value;\n\n // Validate children\n const childrenValidation = validateChildrenProperty(argsPath, state);\n errors.push(...childrenValidation.errors);\n const children = childrenValidation.value;\n\n const hasDeriveContext =\n contextValidation.hasDeriveExpression || childrenValidation.hasAutoderive;\n\n return { errors, id, context, _hash, maxChars, children, hasDeriveContext };\n}\n\n/**\n * Validate that the children property is a string literal\n */\nexport function validateChildrenProperty(\n argsPath: NodePath<t.ObjectExpression>,\n state: TransformState\n): {\n errors: string[];\n value?: JsxChildren;\n hasAutoderive?: boolean;\n} {\n const errors: string[] = [];\n\n // Get the children property\n const childrenValidation =\n validateChildrenPropertyFromObjectExpression(argsPath);\n if (childrenValidation.errors.length > 0) {\n errors.push(...childrenValidation.errors);\n return { errors };\n }\n const children = childrenValidation.value;\n if (children === undefined) {\n errors.push(`The <${GT_COMPONENT_TYPES.T}> component must have children`);\n return { errors };\n }\n\n // constructJsxChildren now returns JsxValidationError[]\n const validation = constructJsxChildren(children, state);\n\n // Autoderive: filter out dynamic-content errors\n let hasAutoderive = false;\n let filteredErrors: JsxValidationError[] = validation.errors;\n if (state.settings.autoderive.jsx) {\n filteredErrors = validation.errors.filter(\n (e) => e.type !== 'dynamic-content'\n );\n hasAutoderive = filteredErrors.length < validation.errors.length;\n }\n\n // Convert structured errors back to strings\n errors.push(...filteredErrors.map((e) => e.message));\n const value = validation.value;\n\n return { errors, value, hasAutoderive };\n}\n\n// String Literal Functions\n\n/**\n * Will validate and retrieve property from object expression and also try prefixing with a $\n *\n */\nfunction validateStringProperty(\n args: t.ObjectExpression,\n name: string,\n state?: TransformState\n): {\n errors: string[];\n value?: string;\n hasDeriveExpression?: boolean;\n} {\n const errors: string[] = [];\n\n // Get the property\n const property =\n getObjectPropertyFromObjectExpression(args, name) ||\n getObjectPropertyFromObjectExpression(args, '$' + name);\n if (!property) {\n return { errors };\n }\n\n // Validate property\n const validation = validateObjectPropertyIsStringLiteral(property, name);\n if (validation.errors.length === 0) {\n return { errors, value: validation.value };\n }\n\n // String validation failed — check if it's a valid derive() expression\n if (state && t.isObjectProperty(property) && t.isExpression(property.value)) {\n const deriveErrors: string[] = [];\n validateDerive(property.value, state, deriveErrors);\n if (deriveErrors.length === 0) {\n return { errors, hasDeriveExpression: true };\n }\n }\n\n // Neither string nor derive — return original errors\n errors.push(...validation.errors);\n return { errors };\n}\n\n/**\n * Validate that an object property is a string literal\n */\nfunction validateObjectPropertyIsStringLiteral(\n arg: t.SpreadElement | t.ObjectMethod | t.ObjectProperty,\n name: string\n): {\n errors: string[];\n value?: string;\n} {\n const errors: string[] = [];\n\n // Validate the property is a string literal from an expression\n if (\n !t.isObjectProperty(arg) ||\n !t.isExpression(arg.value) ||\n !validateExpressionIsStringLiteral(arg.value)\n ) {\n errors.push(\n `The <${GT_COMPONENT_TYPES.T}> component must have a string literal in its ${name} field`\n );\n return { errors };\n }\n\n // Get the string literal\n const value = getStringLiteralFromExpression(arg.value);\n return { errors, value };\n}\n\n/**\n * Given an expression, return the string literal (throws an error if not a string literal)\n */\nfunction getStringLiteralFromExpression(\n expr: t.Expression\n): string | undefined {\n if (t.isStringLiteral(expr)) {\n return expr.value;\n }\n if (t.isTemplateLiteral(expr)) {\n if (expr.expressions.length === 0) {\n return expr.quasis[0]?.value.cooked || '';\n }\n }\n}\n\n// Number Literal Functions\n\n/**\n * Will validate and retrieve property from object expression and also try prefixing with a $\n */\nfunction validateNumberProperty(\n args: t.ObjectExpression,\n name: string\n): {\n errors: string[];\n value?: number;\n} {\n const errors: string[] = [];\n\n // Get the property\n const property =\n getObjectPropertyFromObjectExpression(args, name) ||\n getObjectPropertyFromObjectExpression(args, '$' + name);\n if (!property) {\n return { errors };\n }\n\n // Validate property\n const validation = validateObjectPropertyIsNumberLiteral(property, name);\n errors.push(...validation.errors);\n const value = validation.value;\n\n return { errors, value };\n}\n\n/**\n * Validate that an object property is a number literal\n */\nfunction validateObjectPropertyIsNumberLiteral(\n arg: t.SpreadElement | t.ObjectMethod | t.ObjectProperty,\n name: string\n): {\n errors: string[];\n value?: number;\n} {\n const errors: string[] = [];\n\n // Validate the property is a string literal from an expression\n if (\n !t.isObjectProperty(arg) ||\n !t.isExpression(arg.value) ||\n !validateExpressionIsNumericLiteral(arg.value)\n ) {\n errors.push(\n `The <${GT_COMPONENT_TYPES.T}> component must have a number literal in its ${name} field`\n );\n return { errors };\n }\n\n // Get the number literal\n const value = getNumberLiteralFromExpression(arg.value);\n\n // Validate it is an integer\n if (value !== undefined && !validateNumberLiteralIsInteger(value)) {\n errors.push(\n `The <${GT_COMPONENT_TYPES.T}> component must have an integer in its ${name} field`\n );\n return { errors };\n }\n\n return { errors, value };\n}\n\n/**\n * Given an expression, return the number literal (throws an error if not a number literal)\n */\nfunction getNumberLiteralFromExpression(\n expr: t.Expression\n): number | undefined {\n if (t.isNumericLiteral(expr)) {\n return expr.value;\n }\n // handle numbers with unary operators\n if (t.isUnaryExpression(expr) && t.isNumericLiteral(expr.argument)) {\n // On purpose, we are taking the absolute value of the number literal\n return expr.argument.value;\n }\n}\n\n/**\n * Validate that a number literal is an integer\n */\nfunction validateNumberLiteralIsInteger(value: number): boolean {\n return Number.isInteger(value);\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAeA,SAAgB,iCACd,cACA,eACA,OASA;CACA,MAAM,WAAW,aAAa;AAE9B,KAAI,SAAS,UAAU,SAAS,EAI9B,QAAO,EAAE,QAAA,CAFP,0EAEa,EAAE;CAInB,MAAM,OAAO,SAAS,UAAU;AAChC,KAAI,CAACA,aAAE,mBAAmB,KAAK,CAI7B,QAAO,EAAE,QAAA,CAFP,8EAEa,EAAE;CAEnB,MAAM,WAAW,aAAa,IAAI,YAAY,CAAC;AAC/C,KAAI,EAAA,aAAA,QAAA,aAAA,KAAA,IAAA,KAAA,IAAC,SAAU,oBAAoB,EAIjC,QAAO,EAAE,QAAA,CAFP,8EAEa,EAAE;AAInB,SAAQ,eAAR;EACE,KAAA;EACA,KAAA,yBACE,QAAO,uBACL,UACA,MACD;EACH,QAIE,QAAO,EAAE,QAAA,CAFP,kCAAkC,cAAc,qFAEnC,EAAE;;;AAQvB,SAAS,uBACP,UACA,OASA;CACA,MAAM,SAAmB,EAAE;CAC3B,MAAM,OAAO,SAAS;CAGtB,MAAM,eAAe,uBAAuB,MAAM,KAAK;AACvD,QAAO,KAAK,GAAG,aAAa,OAAO;CACnC,MAAM,KAAK,aAAa;CAGxB,MAAM,oBAAoB,uBAAuB,MAAM,WAAW,MAAM;AACxE,QAAO,KAAK,GAAG,kBAAkB,OAAO;CACxC,MAAM,UAAU,kBAAkB;CAElC,MAAM,qBAAqB,uBAAuB,MAAM,WAAW;AACnE,QA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1B,SAAS,sCACP,KACA,MAIA;CACA,MAAM,SAAmB,EAAE;AAG3B,KACE,CAACH,aAAE,iBAAiB,IAAI,IACxB,CAACA,aAAE,aAAa,IAAI,MAAM,IAC1B,CAACK,4DAAAA,mCAAmC,IAAI,MAAM,EAC9C;AACA,SAAO,KACL,uDAA6E,KAAK,QACnF;AACD,SAAO,EAAE,QAAQ;;CAInB,MAAM,QAAQ,+BAA+B,IAAI,MAAM;AAGvD,KAAI,UAAU,KAAA,KAAa,CAAC,+BAA+B,MAAM,EAAE;AACjE,SAAO,KACL,iDAAuE,KAAK,QAC7E;AACD,SAAO,EAAE,QAAQ;;AAGnB,QAAO;EAAE;EAAQ;EAAO;;;;;AAM1B,SAAS,+BACP,MACoB;AACpB,KAAIL,aAAE,iBAAiB,KAAK,CAC1B,QAAO,KAAK;AAGd,KAAIA,aAAE,kBAAkB,KAAK,IAAIA,aAAE,iBAAiB,KAAK,SAAS,CAEhE,QAAO,KAAK,SAAS;;;;;AAOzB,SAAS,+BAA+B,OAAwB;AAC9D,QAAO,OAAO,UAAU,MAAM"}
|
|
1
|
+
{"version":3,"file":"validateTranslationComponentArgs.js","names":["t","validateChildrenPropertyFromObjectExpression","constructJsxChildren","getObjectPropertyFromObjectExpression","validateExpressionIsStringLiteral","validateExpressionIsNumericLiteral"],"sources":["../../../src/transform/validation/validateTranslationComponentArgs.ts"],"sourcesContent":["import { TransformState } from '../../state/types';\nimport { GT_COMPONENT_TYPES } from '../../utils/constants/gt/constants';\nimport * as t from '@babel/types';\nimport type { NodePath } from '@babel/traverse';\nimport { getObjectPropertyFromObjectExpression } from '../../utils/parsing/getObjectPropertyFromObjectExpression';\nimport { validateExpressionIsStringLiteral } from '../../utils/validation/validateExpressionIsStringLiteral';\nimport type { JsxChildren } from '@generaltranslation/format/types';\nimport { constructJsxChildren } from '../jsx-children/constructJsxChildren';\nimport { validateChildrenPropertyFromObjectExpression } from '../../utils/validation/validateChildrenFromObjectExpression';\nimport { validateExpressionIsNumericLiteral } from '../../utils/validation/validateExpressionIsNumericLiteral';\nimport { validateDerive } from './validateTranslationFunction';\nimport { JsxValidationError } from '../jsx-children/errors';\n/**\n * Given a translation component, validate the arguments\n */\nexport function validateTranslationComponentArgs(\n callExprPath: NodePath<t.CallExpression>,\n canonicalName: string,\n state: TransformState\n): {\n errors: string[];\n _hash?: string;\n id?: string;\n context?: string;\n maxChars?: number;\n children?: JsxChildren;\n hasDeriveContext?: boolean;\n} {\n const callExpr = callExprPath.node;\n // Check that there are at least 2 arguments (identifier, args)\n if (callExpr.arguments.length < 2) {\n const errors = [\n 'Translation component must have at least 2 arguments (identifier, args)',\n ];\n return { errors };\n }\n\n // Get the component args\n const args = callExpr.arguments[1];\n if (!t.isObjectExpression(args)) {\n const errors = [\n 'Translation component must have an object expression as the second argument',\n ];\n return { errors };\n }\n const argsPath = callExprPath.get('arguments')[1];\n if (!argsPath?.isObjectExpression()) {\n const errors = [\n 'Translation component must have an object expression as the second argument',\n ];\n return { errors };\n }\n\n // Map to appropriate validation function\n switch (canonicalName) {\n case GT_COMPONENT_TYPES.T:\n case GT_COMPONENT_TYPES.GtInternalTranslateJsx:\n return validateTComponentArgs(\n argsPath as NodePath<t.ObjectExpression>,\n state\n );\n default:\n const errors = [\n `Invalid translation component: ${canonicalName}. You likely passed a non-translation component to validateTranslationComponentArgs`,\n ];\n return { errors };\n }\n}\n\n/* =============================== */\n/* Helper Functions */\n/* =============================== */\n\nfunction validateTComponentArgs(\n argsPath: NodePath<t.ObjectExpression>,\n state: TransformState\n): {\n errors: string[];\n _hash?: string;\n id?: string;\n context?: string;\n maxChars?: number;\n children?: JsxChildren;\n hasDeriveContext?: boolean;\n} {\n const errors: string[] = [];\n const args = argsPath.node;\n\n // Validate id\n const idValidation = validateStringProperty(args, 'id');\n errors.push(...idValidation.errors);\n const id = idValidation.value;\n\n // Validate context (with derive fallback)\n const contextValidation = validateStringProperty(args, 'context', state);\n errors.push(...contextValidation.errors);\n const context = contextValidation.value;\n // Validate maxChars\n const maxCharsValidation = validateNumberProperty(args, 'maxChars');\n errors.push(...maxCharsValidation.errors);\n const maxChars = maxCharsValidation.value;\n\n // Validate hash\n const hashValidation = validateStringProperty(args, '_hash');\n errors.push(...hashValidation.errors);\n const _hash = hashValidation.value;\n\n // Validate children\n const childrenValidation = validateChildrenProperty(argsPath, state);\n errors.push(...childrenValidation.errors);\n const children = childrenValidation.value;\n\n const hasDeriveContext =\n contextValidation.hasDeriveExpression || childrenValidation.hasAutoderive;\n\n return { errors, id, context, _hash, maxChars, children, hasDeriveContext };\n}\n\n/**\n * Validate that the children property is a string literal\n */\nexport function validateChildrenProperty(\n argsPath: NodePath<t.ObjectExpression>,\n state: TransformState\n): {\n errors: string[];\n value?: JsxChildren;\n hasAutoderive?: boolean;\n} {\n const errors: string[] = [];\n\n // Get the children property\n const childrenValidation =\n validateChildrenPropertyFromObjectExpression(argsPath);\n if (childrenValidation.errors.length > 0) {\n errors.push(...childrenValidation.errors);\n return { errors };\n }\n const children = childrenValidation.value;\n if (children === undefined) {\n errors.push(`The <${GT_COMPONENT_TYPES.T}> component must have children`);\n return { errors };\n }\n\n // constructJsxChildren now returns JsxValidationError[]\n const validation = constructJsxChildren(children, state);\n\n // Autoderive: filter out dynamic-content errors\n let hasAutoderive = false;\n let filteredErrors: JsxValidationError[] = validation.errors;\n if (state.settings.autoderive.jsx) {\n filteredErrors = validation.errors.filter(\n (e) => e.type !== 'dynamic-content'\n );\n hasAutoderive = filteredErrors.length < validation.errors.length;\n }\n\n // Convert structured errors back to strings\n errors.push(...filteredErrors.map((e) => e.message));\n const value = validation.value;\n\n return { errors, value, hasAutoderive };\n}\n\n// String Literal Functions\n\n/**\n * Will validate and retrieve property from object expression and also try prefixing with a $\n *\n */\nfunction validateStringProperty(\n args: t.ObjectExpression,\n name: string,\n state?: TransformState\n): {\n errors: string[];\n value?: string;\n hasDeriveExpression?: boolean;\n} {\n const errors: string[] = [];\n\n // Get the property\n const property =\n getObjectPropertyFromObjectExpression(args, name) ||\n getObjectPropertyFromObjectExpression(args, '$' + name);\n if (!property) {\n return { errors };\n }\n\n // Validate property\n const validation = validateObjectPropertyIsStringLiteral(property, name);\n if (validation.errors.length === 0) {\n return { errors, value: validation.value };\n }\n\n // String validation failed — check if it's a valid derive() expression\n if (state && t.isObjectProperty(property) && t.isExpression(property.value)) {\n const deriveErrors: string[] = [];\n validateDerive(property.value, state, deriveErrors);\n if (deriveErrors.length === 0) {\n return { errors, hasDeriveExpression: true };\n }\n }\n\n // Neither string nor derive — return original errors\n errors.push(...validation.errors);\n return { errors };\n}\n\n/**\n * Validate that an object property is a string literal\n */\nfunction validateObjectPropertyIsStringLiteral(\n arg: t.SpreadElement | t.ObjectMethod | t.ObjectProperty,\n name: string\n): {\n errors: string[];\n value?: string;\n} {\n const errors: string[] = [];\n\n // Validate the property is a string literal from an expression\n if (\n !t.isObjectProperty(arg) ||\n !t.isExpression(arg.value) ||\n !validateExpressionIsStringLiteral(arg.value)\n ) {\n errors.push(\n `The <${GT_COMPONENT_TYPES.T}> component must have a string literal in its ${name} field`\n );\n return { errors };\n }\n\n // Get the string literal\n const value = getStringLiteralFromExpression(arg.value);\n return { errors, value };\n}\n\n/**\n * Given an expression, return the string literal (throws an error if not a string literal)\n */\nfunction getStringLiteralFromExpression(\n expr: t.Expression\n): string | undefined {\n if (t.isStringLiteral(expr)) {\n return expr.value;\n }\n if (t.isTemplateLiteral(expr)) {\n if (expr.expressions.length === 0) {\n return expr.quasis[0]?.value.cooked || '';\n }\n }\n}\n\n// Number Literal Functions\n\n/**\n * Will validate and retrieve property from object expression and also try prefixing with a $\n */\nfunction validateNumberProperty(\n args: t.ObjectExpression,\n name: string\n): {\n errors: string[];\n value?: number;\n} {\n const errors: string[] = [];\n\n // Get the property\n const property =\n getObjectPropertyFromObjectExpression(args, name) ||\n getObjectPropertyFromObjectExpression(args, '$' + name);\n if (!property) {\n return { errors };\n }\n\n // Validate property\n const validation = validateObjectPropertyIsNumberLiteral(property, name);\n errors.push(...validation.errors);\n const value = validation.value;\n\n return { errors, value };\n}\n\n/**\n * Validate that an object property is a number literal\n */\nfunction validateObjectPropertyIsNumberLiteral(\n arg: t.SpreadElement | t.ObjectMethod | t.ObjectProperty,\n name: string\n): {\n errors: string[];\n value?: number;\n} {\n const errors: string[] = [];\n\n // Validate the property is a string literal from an expression\n if (\n !t.isObjectProperty(arg) ||\n !t.isExpression(arg.value) ||\n !validateExpressionIsNumericLiteral(arg.value)\n ) {\n errors.push(\n `The <${GT_COMPONENT_TYPES.T}> component must have a number literal in its ${name} field`\n );\n return { errors };\n }\n\n // Get the number literal\n const value = getNumberLiteralFromExpression(arg.value);\n\n // Validate it is an integer\n if (value !== undefined && !validateNumberLiteralIsInteger(value)) {\n errors.push(\n `The <${GT_COMPONENT_TYPES.T}> component must have an integer in its ${name} field`\n );\n return { errors };\n }\n\n return { errors, value };\n}\n\n/**\n * Given an expression, return the number literal (throws an error if not a number literal)\n */\nfunction getNumberLiteralFromExpression(\n expr: t.Expression\n): number | undefined {\n if (t.isNumericLiteral(expr)) {\n return expr.value;\n }\n // handle numbers with unary operators\n if (t.isUnaryExpression(expr) && t.isNumericLiteral(expr.argument)) {\n // On purpose, we are taking the absolute value of the number literal\n return expr.argument.value;\n }\n}\n\n/**\n * Validate that a number literal is an integer\n */\nfunction validateNumberLiteralIsInteger(value: number): boolean {\n return Number.isInteger(value);\n}\n"],"mappings":";;;;;;;;;;;;;;;AAeA,SAAgB,iCACd,cACA,eACA,OASA;CACA,MAAM,WAAW,aAAa;AAE9B,KAAI,SAAS,UAAU,SAAS,EAI9B,QAAO,EAAE,QAAA,CAFP,0EAEa,EAAE;CAInB,MAAM,OAAO,SAAS,UAAU;AAChC,KAAI,CAACA,aAAE,mBAAmB,KAAK,CAI7B,QAAO,EAAE,QAAA,CAFP,8EAEa,EAAE;CAEnB,MAAM,WAAW,aAAa,IAAI,YAAY,CAAC;AAC/C,KAAI,EAAA,aAAA,QAAA,aAAA,KAAA,IAAA,KAAA,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@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@generaltranslation/compiler",
|
|
3
|
-
"version": "1.3.25-odysseus.
|
|
3
|
+
"version": "1.3.25-odysseus.1",
|
|
4
4
|
"description": "Universal plugin for compile-time optimization of GT translation components",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"@babel/types": "^7.23.0",
|
|
26
26
|
"unplugin": "^2.3.10",
|
|
27
27
|
"@generaltranslation/format": "0.1.2-odysseus.0",
|
|
28
|
-
"generaltranslation": "9.0.0-odysseus.
|
|
28
|
+
"generaltranslation": "9.0.0-odysseus.1"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/babel__core": "^7.20.0",
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export * from './processArrowFunctionExpression';
|
|
2
|
-
export * from './processAssignmentExpression';
|
|
3
|
-
export * from './processCatchClause';
|
|
4
|
-
export * from './processClassDeclaration';
|
|
5
|
-
export * from './processClassMethod';
|
|
6
|
-
export * from './processClassPrivateMethod';
|
|
7
|
-
export * from './processForInStatement';
|
|
8
|
-
export * from './processForOfStatement';
|
|
9
|
-
export * from './processFunctionDeclaration';
|
|
10
|
-
export * from './processFunctionExpression';
|
|
11
|
-
export * from './processImportDeclaration';
|
|
12
|
-
export * from './processObjectMethod';
|
|
13
|
-
export * from './processProgram';
|
|
14
|
-
export * from './processScopeChange';
|
|
15
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/processing/index.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC;AACjD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC"}
|
package/dist/processing/index.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_processing_processArrowFunctionExpression = require("./processArrowFunctionExpression.js");
|
|
3
|
-
const require_processing_processAssignmentExpression = require("./processAssignmentExpression.js");
|
|
4
|
-
const require_processing_processCatchClause = require("./processCatchClause.js");
|
|
5
|
-
const require_processing_processClassDeclaration = require("./processClassDeclaration.js");
|
|
6
|
-
const require_processing_processClassMethod = require("./processClassMethod.js");
|
|
7
|
-
const require_processing_processClassPrivateMethod = require("./processClassPrivateMethod.js");
|
|
8
|
-
const require_processing_processForInStatement = require("./processForInStatement.js");
|
|
9
|
-
const require_processing_processForOfStatement = require("./processForOfStatement.js");
|
|
10
|
-
const require_processing_processFunctionDeclaration = require("./processFunctionDeclaration.js");
|
|
11
|
-
const require_processing_processFunctionExpression = require("./processFunctionExpression.js");
|
|
12
|
-
const require_processing_processImportDeclaration = require("./processImportDeclaration.js");
|
|
13
|
-
const require_processing_processObjectMethod = require("./processObjectMethod.js");
|
|
14
|
-
const require_processing_processProgram = require("./processProgram.js");
|
|
15
|
-
const require_processing_processScopeChange = require("./processScopeChange.js");
|
|
16
|
-
exports.processArrowFunctionExpression = require_processing_processArrowFunctionExpression.processArrowFunctionExpression;
|
|
17
|
-
exports.processAssignmentExpression = require_processing_processAssignmentExpression.processAssignmentExpression;
|
|
18
|
-
exports.processCatchClause = require_processing_processCatchClause.processCatchClause;
|
|
19
|
-
exports.processClassDeclaration = require_processing_processClassDeclaration.processClassDeclaration;
|
|
20
|
-
exports.processClassMethod = require_processing_processClassMethod.processClassMethod;
|
|
21
|
-
exports.processClassPrivateMethod = require_processing_processClassPrivateMethod.processClassPrivateMethod;
|
|
22
|
-
exports.processForInStatement = require_processing_processForInStatement.processForInStatement;
|
|
23
|
-
exports.processForOfStatement = require_processing_processForOfStatement.processForOfStatement;
|
|
24
|
-
exports.processFunctionDeclaration = require_processing_processFunctionDeclaration.processFunctionDeclaration;
|
|
25
|
-
exports.processFunctionExpression = require_processing_processFunctionExpression.processFunctionExpression;
|
|
26
|
-
exports.processImportDeclaration = require_processing_processImportDeclaration.processImportDeclaration;
|
|
27
|
-
exports.processObjectMethod = require_processing_processObjectMethod.processObjectMethod;
|
|
28
|
-
exports.processProgram = require_processing_processProgram.processProgram;
|
|
29
|
-
exports.processScopeChange = require_processing_processScopeChange.processScopeChange;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/transform/jsx-children/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_transform_jsx_children_constructJsxChildren = require("./constructJsxChildren.js");
|
|
3
|
-
exports.constructJsxChildren = require_transform_jsx_children_constructJsxChildren.constructJsxChildren;
|