gt 2.16.4 → 2.16.5

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/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # gtx-cli
2
2
 
3
+ ## 2.16.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [#2074](https://github.com/generaltranslation/gt/pull/2074) [`240a65e`](https://github.com/generaltranslation/gt/commit/240a65e9305a74cdfd4df07537fb4cfae8a2eac8) Thanks [@eoinest](https://github.com/eoinest)! - Migrate the package license from FSL-1.1-ALv2 to MIT.
8
+
9
+ - Updated dependencies [[`240a65e`](https://github.com/generaltranslation/gt/commit/240a65e9305a74cdfd4df07537fb4cfae8a2eac8)]:
10
+ - @generaltranslation/format@0.1.5
11
+ - @generaltranslation/icu@0.1.2
12
+ - @generaltranslation/python-extractor@0.2.36
13
+ - @generaltranslation/supported-locales@2.1.16
14
+ - generaltranslation@9.1.3
15
+ - gt-remark@1.0.12
16
+
3
17
  ## 2.16.4
4
18
 
5
19
  ### Patch Changes
package/LICENSE.md CHANGED
@@ -1,105 +1,21 @@
1
- # Functional Source License, Version 1.1, ALv2 Future License
2
-
3
- ## Abbreviation
4
-
5
- FSL-1.1-ALv2
6
-
7
- ## Notice
1
+ MIT License
8
2
 
9
3
  Copyright 2025 General Translation, Inc.
10
4
 
11
- ## Terms and Conditions
12
-
13
- ### Licensor ("We")
14
-
15
- The party offering the Software under these Terms and Conditions.
16
-
17
- ### The Software
18
-
19
- The "Software" is each version of the software that we make available under
20
- these Terms and Conditions, as indicated by our inclusion of these Terms and
21
- Conditions with the Software.
22
-
23
- ### License Grant
24
-
25
- Subject to your compliance with this License Grant and the Patents,
26
- Redistribution and Trademark clauses below, we hereby grant you the right to
27
- use, copy, modify, create derivative works, publicly perform, publicly display
28
- and redistribute the Software for any Permitted Purpose identified below.
29
-
30
- ### Permitted Purpose
31
-
32
- A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
33
- means making the Software available to others in a commercial product or
34
- service that:
35
-
36
- 1. substitutes for the Software;
37
-
38
- 2. substitutes for any other product or service we offer using the Software
39
- that exists as of the date we make the Software available; or
40
-
41
- 3. offers the same or substantially similar functionality as the Software.
42
-
43
- Permitted Purposes specifically include using the Software:
44
-
45
- 1. for your internal use and access;
46
-
47
- 2. for non-commercial education;
48
-
49
- 3. for non-commercial research; and
50
-
51
- 4. in connection with professional services that you provide to a licensee
52
- using the Software in accordance with these Terms and Conditions.
53
-
54
- ### Patents
55
-
56
- To the extent your use for a Permitted Purpose would necessarily infringe our
57
- patents, the license grant above includes a license under our patents. If you
58
- make a claim against any party that the Software infringes or contributes to
59
- the infringement of any patent, then your patent license to the Software ends
60
- immediately.
61
-
62
- ### Redistribution
63
-
64
- The Terms and Conditions apply to all copies, modifications and derivatives of
65
- the Software.
66
-
67
- If you redistribute any copies, modifications or derivatives of the Software,
68
- you must include a copy of or a link to these Terms and Conditions and not
69
- remove any copyright notices provided in or with the Software.
70
-
71
- ### Disclaimer
72
-
73
- THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
74
- IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
75
- PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
76
-
77
- IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
78
- SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
79
- EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
80
-
81
- ### Trademarks
82
-
83
- Except for displaying the License Details and identifying us as the origin of
84
- the Software, you have no right under these Terms and Conditions to use our
85
- trademarks, trade names, service marks or product names.
86
-
87
- ## Grant of Future License
88
-
89
- We hereby irrevocably grant you an additional license to use the Software under
90
- the Apache License, Version 2.0 that is effective on the second anniversary of
91
- the date we make the Software available. On or after that date, you may use the
92
- Software under the Apache License, Version 2.0, in which case the following
93
- will apply:
94
-
95
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use
96
- this file except in compliance with the License.
97
-
98
- You may obtain a copy of the License at
99
-
100
- http://www.apache.org/licenses/LICENSE-2.0
101
-
102
- Unless required by applicable law or agreed to in writing, software distributed
103
- under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
104
- CONDITIONS OF ANY KIND, either express or implied. See the License for the
105
- specific language governing permissions and limitations under the License.
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -1 +1 @@
1
- export declare const PACKAGE_VERSION = "2.16.4";
1
+ export declare const PACKAGE_VERSION = "2.16.5";
@@ -1,5 +1,5 @@
1
1
  //#region src/generated/version.ts
2
- const PACKAGE_VERSION = "2.16.4";
2
+ const PACKAGE_VERSION = "2.16.5";
3
3
  //#endregion
4
4
  export { PACKAGE_VERSION };
5
5
 
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","names":[],"sources":["../../src/generated/version.ts"],"sourcesContent":["// This file is auto-generated. Do not edit manually.\nexport const PACKAGE_VERSION = '2.16.4';\n"],"mappings":";AACA,MAAa,kBAAkB"}
1
+ {"version":3,"file":"version.js","names":[],"sources":["../../src/generated/version.ts"],"sourcesContent":["// This file is auto-generated. Do not edit manually.\nexport const PACKAGE_VERSION = '2.16.5';\n"],"mappings":";AACA,MAAa,kBAAkB"}
@@ -2,7 +2,6 @@ import * as t from '@babel/types';
2
2
  import { NodePath } from '@babel/traverse';
3
3
  import { ParsingConfigOptions } from '../../../../../types/parsing.js';
4
4
  import { StringNode } from '../../types.js';
5
- export type StringTree = (string | StringTree)[];
6
5
  /**
7
6
  * Extracts content if an expression is derivable (statically analyzable) or uses derive()
8
7
  * Returns a Node representing the parsed expression
@@ -1 +1 @@
1
- {"version":3,"file":"handleDerivation.js","names":[],"sources":["../../../../../../src/react/jsx/utils/stringParsing/derivation/handleDerivation.ts"],"sourcesContent":["import * as t from '@babel/types';\nimport { NodePath } from '@babel/traverse';\nimport { ParsingConfigOptions } from '../../../../../types/parsing.js';\nimport { parseStringExpression, nodeToStrings } from '../../parseString.js';\nimport { StringNode } from '../../types.js';\nimport { buildImportMap } from '../../buildImportMap.js';\nimport { resolveImportPath } from '../../resolveImportPath.js';\nimport { parse } from '@babel/parser';\nimport fs from 'node:fs';\nimport {\n warnFunctionNotFoundSync,\n warnDeriveFunctionNoResultsSync,\n warnDeriveFunctionNotWrappedSync,\n warnAutoderiveNoResultsSync,\n} from '../../../../../console/index.js';\n\nimport traverseModule from '@babel/traverse';\nimport generateModule from '@babel/generator';\nimport { isDeriveCall } from './isDeriveCall.js';\n// Handle CommonJS/ESM interop\nconst traverse = traverseModule.default || traverseModule;\nconst generate = generateModule.default || generateModule;\n\n// Nested arrays of strings (deprecated - kept for backwards compatibility)\nexport type StringTree = (string | StringTree)[];\n\n/**\n * Cache for resolved import paths to avoid redundant I/O operations.\n * Key: `${currentFile}::${importPath}`\n * Value: resolved absolute path or null\n */\nconst resolveImportPathCache = new Map<string, string | null>();\n\n/**\n * Cache for processed functions to avoid re-parsing the same files.\n * Key: `${filePath}::${functionName}`\n * Value: Node result or null\n */\nconst processFunctionCache = new Map<string, StringNode | null>();\n\n/**\n * Extracts content if an expression is derivable (statically analyzable) or uses derive()\n * Returns a Node representing the parsed expression\n * @param expr - The expression to check\n * @param tPath - NodePath for scope resolution\n * @param file - Current file path\n * @param parsingOptions - Parsing configuration\n * @param errors - Errors to add to\n * @param runtimeInterpolationState - When provided, non-derive dynamic expressions become {n} placeholders instead of errors. Pass { index: 0 } at the entry point for template macros.\n * @param skipDeriveInvocation - If true, skip derive invocation check\n * @returns Node | null - The parsed node, or null if invalid\n *\n * @note runtimeInterpolationState\n * - Only provide at entry for template macros, otherwise omit\n * - t`Hello {nonDerivableValue}` -> t`Hello {0}`\n *\n */\nexport function handleDerivation({\n expr,\n tPath,\n file,\n parsingOptions,\n errors,\n warnings,\n runtimeInterpolationState,\n skipDeriveInvocation,\n}: {\n expr: t.Expression;\n tPath: NodePath;\n file: string;\n parsingOptions: ParsingConfigOptions;\n errors: string[];\n warnings: Set<string>;\n runtimeInterpolationState?: { index: number };\n skipDeriveInvocation?: boolean;\n}): StringNode | null {\n if (!expr) {\n return null;\n }\n\n // Handle expressions\n if (t.isCallExpression(expr)) {\n if (isDeriveCall({ expr, tPath })) {\n const variants = getDeriveVariants({\n call: expr,\n tPath,\n file,\n parsingOptions,\n errors,\n warnings,\n });\n if (variants) {\n return {\n type: 'choice',\n nodes: variants.map((v) => ({ type: 'text', text: v })),\n };\n }\n // derive() had no resolvable results\n const code =\n expr.arguments.length > 0\n ? generate(expr.arguments[0]).code\n : 'no arguments';\n errors.push(\n warnDeriveFunctionNoResultsSync(\n file,\n code,\n `${expr.loc?.start?.line}:${expr.loc?.start?.column}`\n )\n );\n return null;\n }\n // Non-derive call\n if (runtimeInterpolationState) {\n return { type: 'text', text: `{${runtimeInterpolationState.index++}}` };\n }\n const calleeName = t.isIdentifier(expr.callee)\n ? expr.callee.name\n : generate(expr.callee).code;\n errors.push(\n warnDeriveFunctionNotWrappedSync(\n file,\n calleeName,\n `${expr.callee.loc?.start?.line}:${expr.callee.loc?.start?.column}`\n )\n );\n return null;\n }\n\n // Handle direct string literals\n if (t.isStringLiteral(expr)) {\n return { type: 'text', text: expr.value };\n }\n\n // Handle template literals\n if (t.isTemplateLiteral(expr)) {\n const parts: StringNode[] = [];\n for (let index = 0; index < expr.quasis.length; index++) {\n const quasi = expr.quasis[index];\n const text = quasi.value.cooked ?? quasi.value.raw ?? '';\n if (text) {\n parts.push({ type: 'text', text });\n }\n const exprNode = expr.expressions[index];\n if (exprNode && t.isExpression(exprNode)) {\n if (isDeriveCall({ expr: exprNode, tPath })) {\n // Derive — resolve fully (no runtime interpolation forwarding)\n const result = handleDerivation({\n expr: exprNode,\n tPath,\n file,\n parsingOptions,\n errors,\n warnings,\n });\n if (result === null) return null;\n parts.push(result);\n } else {\n // Non-derive — recurse with runtime interpolation forwarded\n const result = handleDerivation({\n expr: exprNode,\n tPath,\n file,\n parsingOptions,\n errors,\n warnings,\n runtimeInterpolationState,\n skipDeriveInvocation,\n });\n if (result === null) return null;\n parts.push(result);\n }\n }\n }\n\n if (parts.length === 0) {\n return { type: 'text', text: '' };\n }\n if (parts.length === 1) {\n return parts[0];\n }\n return { type: 'sequence', nodes: parts };\n }\n\n // Handle binary expressions\n if (t.isBinaryExpression(expr) && expr.operator === '+') {\n if (!t.isExpression(expr.left) || !t.isExpression(expr.right)) {\n return null;\n }\n const leftResult = handleDerivation({\n expr: expr.left,\n tPath,\n file,\n parsingOptions,\n errors,\n warnings,\n runtimeInterpolationState,\n skipDeriveInvocation,\n });\n const rightResult = handleDerivation({\n expr: expr.right,\n tPath,\n file,\n parsingOptions,\n errors,\n warnings,\n runtimeInterpolationState,\n skipDeriveInvocation,\n });\n\n if (leftResult === null || rightResult === null) {\n return null;\n }\n\n return { type: 'sequence', nodes: [leftResult, rightResult] };\n }\n\n // Handle parenthesized expressions\n if (t.isParenthesizedExpression(expr)) {\n return handleDerivation({\n expr: expr.expression,\n tPath,\n file,\n parsingOptions,\n errors,\n warnings,\n runtimeInterpolationState,\n skipDeriveInvocation,\n });\n }\n\n // Handle numeric literals by converting them to strings\n if (t.isNumericLiteral(expr)) {\n return { type: 'text', text: String(expr.value) };\n }\n\n // Handle unary expressions by converting them to strings\n if (t.isUnaryExpression(expr)) {\n let operator = '';\n if (expr.operator === '-') {\n operator = expr.operator;\n }\n if (t.isNumericLiteral(expr.argument)) {\n if (expr.argument.value === 0) {\n return { type: 'text', text: '0' };\n } else {\n return {\n type: 'text',\n text: operator + expr.argument.value.toString(),\n };\n }\n } else {\n // invalid\n return null;\n }\n }\n\n // Handle boolean literals by converting them to strings\n if (t.isBooleanLiteral(expr)) {\n return { type: 'text', text: String(expr.value) };\n }\n\n // Handle null literal\n if (t.isNullLiteral(expr)) {\n return { type: 'text', text: 'null' };\n }\n\n // Non-static expression\n if (skipDeriveInvocation) {\n // Skip pass a `derive()` invocation to do derivation\n const variants = resolveCallStringVariants(\n expr,\n tPath,\n file,\n parsingOptions,\n errors,\n warnings\n );\n if (variants) {\n return {\n type: 'choice',\n nodes: variants.map((v) => ({ type: 'text', text: v })),\n };\n }\n // Autoderive had no resolvable results\n const code = generate(expr).code;\n errors.push(\n warnAutoderiveNoResultsSync(\n file,\n code,\n `${expr.loc?.start?.line}:${expr.loc?.start?.column}`\n )\n );\n return null;\n }\n\n // Not a derivable expression\n if (runtimeInterpolationState) {\n return { type: 'text', text: `{${runtimeInterpolationState.index++}}` };\n }\n return null;\n}\n\n/**\n * Given a CallExpression, if it is derive(<call>) or derive(await <call>),\n * return all possible string outcomes of that argument call as an array of strings.\n *\n * Examples:\n * derive(time()) -> [\"day\", \"night\"]\n * derive(await time()) -> [\"day\", \"night\"]\n *\n * Returns null if it can't be resolved.\n */\nfunction getDeriveVariants<T extends t.CallExpression = t.CallExpression>({\n call,\n tPath,\n file,\n parsingOptions,\n errors,\n warnings,\n}: {\n call: T;\n tPath: NodePath;\n file: string;\n parsingOptions: ParsingConfigOptions;\n errors: string[];\n warnings: Set<string>;\n}): string[] | null {\n // --- Validate Callee --- //\n\n // Must be a derive(...) call or an alias of it\n if (!isDeriveCall({ expr: call, tPath })) {\n const calleeName = t.isIdentifier(call.callee)\n ? call.callee.name\n : generate(call.callee).code;\n errors.push(\n warnDeriveFunctionNotWrappedSync(\n file,\n calleeName,\n `${call.callee.loc?.start?.line}:${call.callee.loc?.start?.column}`\n )\n );\n return null;\n }\n\n // --- Validate Arguments --- //\n\n if (call.arguments.length !== 1) return null;\n\n const arg = call.arguments[0];\n if (!t.isExpression(arg)) return null;\n\n // Handle await expression: derive(await time())\n if (t.isAwaitExpression(arg)) {\n // Resolve the inner call's possible string outcomes\n return resolveCallStringVariants(\n arg.argument,\n tPath,\n file,\n parsingOptions,\n errors,\n warnings\n );\n }\n // Handle call expression: derive(time())\n if (t.isCallExpression(arg)) {\n return resolveCallStringVariants(\n arg,\n tPath,\n file,\n parsingOptions,\n errors,\n warnings\n );\n }\n // Handle other expressions (ternary, string literal, etc.) by recursing into handleDerivation\n const node = handleDerivation({\n expr: arg,\n tPath,\n file,\n parsingOptions,\n errors,\n warnings,\n skipDeriveInvocation: true,\n });\n if (node) {\n return nodeToStrings(node);\n }\n return null;\n}\n\nfunction resolveCallStringVariants(\n expression: t.Expression,\n tPath: NodePath,\n file: string,\n parsingOptions: ParsingConfigOptions,\n errors: string[],\n warnings: Set<string>\n): string[] | null {\n // Handle function identifier calls: derive(time())\n if (t.isCallExpression(expression) && t.isIdentifier(expression.callee)) {\n const functionName = expression.callee.name;\n\n // Use Binding to resolve the function\n const calleeBinding = tPath.scope.getBinding(functionName);\n\n if (calleeBinding) {\n // Check if the binding itself is an import (not just if the name exists in imports)\n const isImportBinding =\n calleeBinding.path.isImportSpecifier() ||\n calleeBinding.path.isImportDefaultSpecifier() ||\n calleeBinding.path.isImportNamespaceSpecifier();\n\n if (isImportBinding) {\n // Function is imported - resolve cross-file\n const importedFunctionsMap = buildImportMap(\n tPath.scope.getProgramParent().path\n );\n\n let originalName: string | undefined;\n if (calleeBinding.path.isImportSpecifier()) {\n originalName = t.isIdentifier(calleeBinding.path.node.imported)\n ? calleeBinding.path.node.imported.name\n : calleeBinding.path.node.imported.value;\n } else if (calleeBinding.path.isImportDefaultSpecifier()) {\n originalName = calleeBinding.path.node.local.name;\n } else if (calleeBinding.path.isImportNamespaceSpecifier()) {\n originalName = calleeBinding.path.node.local.name;\n }\n\n const importPath = importedFunctionsMap.get(functionName);\n if (importPath) {\n const filePath = resolveImportPath(\n file,\n importPath,\n parsingOptions,\n resolveImportPathCache\n );\n\n if (filePath && originalName) {\n const node = resolveFunctionInFile(\n filePath,\n originalName,\n parsingOptions,\n errors,\n warnings\n );\n if (node) {\n return nodeToStrings(node);\n }\n }\n }\n } else {\n // Function is local - use parseStringExpression with resolveFunctionCall\n const node = resolveFunctionCallFromBinding(\n calleeBinding,\n tPath,\n file,\n parsingOptions,\n warnings,\n errors\n );\n if (node) {\n return nodeToStrings(node);\n }\n }\n } else {\n // Function not found in scope\n errors.push(\n warnFunctionNotFoundSync(\n file,\n functionName,\n `${expression.callee.loc?.start?.line}:${expression.callee.loc?.start?.column}`\n )\n );\n return null;\n }\n }\n\n // If we get here: analyze this call as derivable (statically analyzable)\n const node = parseStringExpression(\n expression,\n tPath,\n file,\n parsingOptions,\n warnings,\n errors\n );\n if (node) {\n return nodeToStrings(node);\n }\n return null;\n}\n\n/**\n * Resolves a function from a binding (local function) using parseStringExpression logic\n */\nfunction resolveFunctionCallFromBinding(\n calleeBinding: ReturnType<NodePath['scope']['getBinding']>,\n tPath: NodePath,\n file: string,\n parsingOptions: ParsingConfigOptions,\n warnings: Set<string>,\n errors: string[]\n): StringNode | null {\n if (!calleeBinding) {\n return null;\n }\n\n const bindingPath = calleeBinding.path;\n const branches: StringNode[] = [];\n\n // Handle function declarations: function time() { return \"day\"; }\n if (bindingPath.isFunctionDeclaration()) {\n bindingPath.traverse({\n ReturnStatement(returnPath) {\n // Only process return statements that are direct children of this function\n const parentFunction = returnPath.getFunctionParent();\n if (parentFunction?.node !== bindingPath.node) {\n return;\n }\n\n const returnArg = returnPath.node.argument;\n if (!returnArg || !t.isExpression(returnArg)) {\n return;\n }\n const returnResult = parseStringExpression(\n returnArg,\n returnPath,\n file,\n parsingOptions,\n warnings,\n errors\n );\n if (returnResult !== null) {\n branches.push(returnResult);\n }\n },\n });\n }\n // Handle arrow functions: const time = () => \"day\"\n else if (bindingPath.isVariableDeclarator()) {\n const init = bindingPath.get('init');\n if (!init.isArrowFunctionExpression()) {\n return null;\n }\n\n const body = init.get('body');\n\n // Handle expression body: () => \"day\"\n if (body.isExpression()) {\n const bodyResult = parseStringExpression(\n body.node,\n body,\n file,\n parsingOptions,\n warnings,\n errors\n );\n if (bodyResult !== null) {\n branches.push(bodyResult);\n }\n }\n // Handle block body: () => { return \"day\"; }\n else if (body.isBlockStatement()) {\n const arrowFunction = init.node;\n body.traverse({\n ReturnStatement(returnPath) {\n // Only process return statements that are direct children of this function\n const parentFunction = returnPath.getFunctionParent();\n if (parentFunction?.node !== arrowFunction) {\n return;\n }\n\n const returnArg = returnPath.node.argument;\n if (!returnArg || !t.isExpression(returnArg)) {\n return;\n }\n const returnResult = parseStringExpression(\n returnArg,\n returnPath,\n file,\n parsingOptions,\n warnings,\n errors\n );\n if (returnResult !== null) {\n branches.push(returnResult);\n }\n },\n });\n }\n }\n\n if (branches.length === 0) {\n return null;\n }\n\n if (branches.length === 1) {\n return branches[0];\n }\n\n return { type: 'choice', nodes: branches };\n}\n\n/**\n * Resolves a function definition in an external file\n */\nfunction resolveFunctionInFile(\n filePath: string,\n functionName: string,\n parsingOptions: ParsingConfigOptions,\n errors: string[],\n warnings: Set<string>\n): StringNode | null {\n // Check cache first\n const cacheKey = `${filePath}::${functionName}`;\n if (processFunctionCache.has(cacheKey)) {\n return processFunctionCache.get(cacheKey) ?? null;\n }\n\n let result: StringNode | null = null;\n\n try {\n const code = fs.readFileSync(filePath, 'utf8');\n const ast = parse(code, {\n sourceType: 'module',\n plugins: ['jsx', 'typescript'],\n });\n\n traverse(ast, {\n // Handle re-exports: export * from './utils'\n ExportAllDeclaration(path) {\n // Only follow re-exports if we haven't found the function yet\n if (result !== null) return;\n\n if (t.isStringLiteral(path.node.source)) {\n const reexportPath = path.node.source.value;\n const resolvedPath = resolveImportPath(\n filePath,\n reexportPath,\n parsingOptions,\n resolveImportPathCache\n );\n\n if (resolvedPath) {\n // Recursively resolve in the re-exported file\n const reexportResult = resolveFunctionInFile(\n resolvedPath,\n functionName,\n parsingOptions,\n errors,\n warnings\n );\n if (reexportResult) {\n result = reexportResult;\n }\n }\n }\n },\n // Handle named re-exports: export { fn1 } from './utils'\n ExportNamedDeclaration(path) {\n // Only follow re-exports if we haven't found the function yet\n if (result !== null) return;\n\n // Check if this is a re-export with a source\n if (path.node.source && t.isStringLiteral(path.node.source)) {\n // Check if any of the exported specifiers match our function name\n const hasMatchingExport = path.node.specifiers.some((spec) => {\n if (t.isExportSpecifier(spec)) {\n const exportedName = t.isIdentifier(spec.exported)\n ? spec.exported.name\n : spec.exported.value;\n return exportedName === functionName;\n }\n return false;\n });\n\n if (hasMatchingExport) {\n const reexportPath = path.node.source.value;\n const resolvedPath = resolveImportPath(\n filePath,\n reexportPath,\n parsingOptions,\n resolveImportPathCache\n );\n\n if (resolvedPath) {\n // Find the original name in case it was renamed\n const specifier = path.node.specifiers.find((spec) => {\n if (t.isExportSpecifier(spec)) {\n const exportedName = t.isIdentifier(spec.exported)\n ? spec.exported.name\n : spec.exported.value;\n return exportedName === functionName;\n }\n return false;\n });\n\n let originalName = functionName;\n if (\n specifier &&\n t.isExportSpecifier(specifier) &&\n t.isIdentifier(specifier.local)\n ) {\n originalName = specifier.local.name;\n }\n\n // Recursively resolve in the re-exported file\n const reexportResult = resolveFunctionInFile(\n resolvedPath,\n originalName,\n parsingOptions,\n errors,\n warnings\n );\n if (reexportResult) {\n result = reexportResult;\n }\n }\n }\n }\n },\n // Handle function declarations: function woah() { ... }\n FunctionDeclaration(path) {\n if (path.node.id?.name === functionName && result === null) {\n const branches: StringNode[] = [];\n path.traverse({\n Function(innerPath) {\n // Skip nested functions\n innerPath.skip();\n },\n ReturnStatement(returnPath: NodePath) {\n if (!t.isReturnStatement(returnPath.node)) {\n return;\n }\n const returnArg = returnPath.node.argument;\n if (!returnArg || !t.isExpression(returnArg)) {\n return;\n }\n const returnResult = parseStringExpression(\n returnArg,\n returnPath,\n filePath,\n parsingOptions,\n warnings,\n errors\n );\n if (returnResult !== null) {\n branches.push(returnResult);\n }\n },\n });\n\n if (branches.length === 1) {\n result = branches[0];\n } else if (branches.length > 1) {\n result = { type: 'choice', nodes: branches };\n }\n }\n },\n // Handle variable declarations: const woah = () => { ... }\n VariableDeclarator(path) {\n if (\n t.isIdentifier(path.node.id) &&\n path.node.id.name === functionName &&\n path.node.init &&\n (t.isArrowFunctionExpression(path.node.init) ||\n t.isFunctionExpression(path.node.init)) &&\n result === null\n ) {\n const init = path.get('init');\n if (\n !init.isArrowFunctionExpression() &&\n !init.isFunctionExpression()\n ) {\n return;\n }\n\n const bodyPath = init.get('body');\n const branches: StringNode[] = [];\n\n // Handle expression body: () => \"day\"\n if (!Array.isArray(bodyPath) && t.isExpression(bodyPath.node)) {\n const bodyResult = parseStringExpression(\n bodyPath.node,\n bodyPath,\n filePath,\n parsingOptions,\n warnings,\n errors\n );\n if (bodyResult !== null) {\n branches.push(bodyResult);\n }\n }\n // Handle block body: () => { return \"day\"; }\n else if (\n !Array.isArray(bodyPath) &&\n t.isBlockStatement(bodyPath.node)\n ) {\n const arrowFunction = init.node;\n bodyPath.traverse({\n Function(innerPath: NodePath) {\n // Skip nested functions\n innerPath.skip();\n },\n ReturnStatement(returnPath: NodePath) {\n // Only process return statements that are direct children of this function\n const parentFunction = returnPath.getFunctionParent();\n if (parentFunction?.node !== arrowFunction) {\n return;\n }\n\n if (!t.isReturnStatement(returnPath.node)) {\n return;\n }\n const returnArg = returnPath.node.argument;\n if (!returnArg || !t.isExpression(returnArg)) {\n return;\n }\n const returnResult = parseStringExpression(\n returnArg,\n returnPath,\n filePath,\n parsingOptions,\n warnings,\n errors\n );\n if (returnResult !== null) {\n branches.push(returnResult);\n }\n },\n });\n }\n\n if (branches.length === 1) {\n result = branches[0];\n } else if (branches.length > 1) {\n result = { type: 'choice', nodes: branches };\n }\n }\n },\n });\n } catch (error) {\n // File read or parse error - return null\n errors.push(\n warnDeriveFunctionNoResultsSync(\n filePath,\n functionName,\n 'file read/parse error: ' + error\n )\n );\n result = null;\n }\n\n // Cache the result\n processFunctionCache.set(cacheKey, result);\n return result;\n}\n"],"mappings":";;;;;;;;;;;AAoBA,MAAM,WAAW,eAAe,WAAW;AAC3C,MAAM,WAAW,eAAe,WAAW;;;;;;AAU3C,MAAM,yCAAyB,IAAI,KAA4B;;;;;;AAO/D,MAAM,uCAAuB,IAAI,KAAgC;;;;;;;;;;;;;;;;;;AAmBjE,SAAgB,iBAAiB,EAC/B,MACA,OACA,MACA,gBACA,QACA,UACA,2BACA,wBAUoB;AACpB,KAAI,CAAC,KACH,QAAO;AAIT,KAAI,EAAE,iBAAiB,KAAK,EAAE;AAC5B,MAAI,aAAa;GAAE;GAAM;GAAO,CAAC,EAAE;GACjC,MAAM,WAAW,kBAAkB;IACjC,MAAM;IACN;IACA;IACA;IACA;IACA;IACD,CAAC;AACF,OAAI,SACF,QAAO;IACL,MAAM;IACN,OAAO,SAAS,KAAK,OAAO;KAAE,MAAM;KAAQ,MAAM;KAAG,EAAE;IACxD;GAGH,MAAM,OACJ,KAAK,UAAU,SAAS,IACpB,SAAS,KAAK,UAAU,GAAG,CAAC,OAC5B;AACN,UAAO,KACL,gCACE,MACA,MACA,GAAG,KAAK,KAAK,OAAO,KAAK,GAAG,KAAK,KAAK,OAAO,SAC9C,CACF;AACD,UAAO;;AAGT,MAAI,0BACF,QAAO;GA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AU,CAC1C;QAEF,MAAM,eAAe,sBACnB,WACA,YACA,UACA,gBACA,UACA,OACD;AACD,YAAI,iBAAiB,KACnB,UAAS,KAAK,aAAa;;OAGhC,CAAC;;AAGJ,SAAI,SAAS,WAAW,EACtB,UAAS,SAAS;cACT,SAAS,SAAS,EAC3B,UAAS;MAAE,MAAM;MAAU,OAAO;MAAU;;;GAInD,CAAC;UACK,OAAO;AAEd,SAAO,KACL,gCACE,UACA,cACA,4BAA4B,MAC7B,CACF;AACD,WAAS;;AAIX,sBAAqB,IAAI,UAAU,OAAO;AAC1C,QAAO"}
1
+ {"version":3,"file":"handleDerivation.js","names":[],"sources":["../../../../../../src/react/jsx/utils/stringParsing/derivation/handleDerivation.ts"],"sourcesContent":["import * as t from '@babel/types';\nimport { NodePath } from '@babel/traverse';\nimport { ParsingConfigOptions } from '../../../../../types/parsing.js';\nimport { parseStringExpression, nodeToStrings } from '../../parseString.js';\nimport { StringNode } from '../../types.js';\nimport { buildImportMap } from '../../buildImportMap.js';\nimport { resolveImportPath } from '../../resolveImportPath.js';\nimport { parse } from '@babel/parser';\nimport fs from 'node:fs';\nimport {\n warnFunctionNotFoundSync,\n warnDeriveFunctionNoResultsSync,\n warnDeriveFunctionNotWrappedSync,\n warnAutoderiveNoResultsSync,\n} from '../../../../../console/index.js';\n\nimport traverseModule from '@babel/traverse';\nimport generateModule from '@babel/generator';\nimport { isDeriveCall } from './isDeriveCall.js';\n// Handle CommonJS/ESM interop\nconst traverse = traverseModule.default || traverseModule;\nconst generate = generateModule.default || generateModule;\n\n/**\n * Cache for resolved import paths to avoid redundant I/O operations.\n * Key: `${currentFile}::${importPath}`\n * Value: resolved absolute path or null\n */\nconst resolveImportPathCache = new Map<string, string | null>();\n\n/**\n * Cache for processed functions to avoid re-parsing the same files.\n * Key: `${filePath}::${functionName}`\n * Value: Node result or null\n */\nconst processFunctionCache = new Map<string, StringNode | null>();\n\n/**\n * Extracts content if an expression is derivable (statically analyzable) or uses derive()\n * Returns a Node representing the parsed expression\n * @param expr - The expression to check\n * @param tPath - NodePath for scope resolution\n * @param file - Current file path\n * @param parsingOptions - Parsing configuration\n * @param errors - Errors to add to\n * @param runtimeInterpolationState - When provided, non-derive dynamic expressions become {n} placeholders instead of errors. Pass { index: 0 } at the entry point for template macros.\n * @param skipDeriveInvocation - If true, skip derive invocation check\n * @returns Node | null - The parsed node, or null if invalid\n *\n * @note runtimeInterpolationState\n * - Only provide at entry for template macros, otherwise omit\n * - t`Hello {nonDerivableValue}` -> t`Hello {0}`\n *\n */\nexport function handleDerivation({\n expr,\n tPath,\n file,\n parsingOptions,\n errors,\n warnings,\n runtimeInterpolationState,\n skipDeriveInvocation,\n}: {\n expr: t.Expression;\n tPath: NodePath;\n file: string;\n parsingOptions: ParsingConfigOptions;\n errors: string[];\n warnings: Set<string>;\n runtimeInterpolationState?: { index: number };\n skipDeriveInvocation?: boolean;\n}): StringNode | null {\n if (!expr) {\n return null;\n }\n\n // Handle expressions\n if (t.isCallExpression(expr)) {\n if (isDeriveCall({ expr, tPath })) {\n const variants = getDeriveVariants({\n call: expr,\n tPath,\n file,\n parsingOptions,\n errors,\n warnings,\n });\n if (variants) {\n return {\n type: 'choice',\n nodes: variants.map((v) => ({ type: 'text', text: v })),\n };\n }\n // derive() had no resolvable results\n const code =\n expr.arguments.length > 0\n ? generate(expr.arguments[0]).code\n : 'no arguments';\n errors.push(\n warnDeriveFunctionNoResultsSync(\n file,\n code,\n `${expr.loc?.start?.line}:${expr.loc?.start?.column}`\n )\n );\n return null;\n }\n // Non-derive call\n if (runtimeInterpolationState) {\n return { type: 'text', text: `{${runtimeInterpolationState.index++}}` };\n }\n const calleeName = t.isIdentifier(expr.callee)\n ? expr.callee.name\n : generate(expr.callee).code;\n errors.push(\n warnDeriveFunctionNotWrappedSync(\n file,\n calleeName,\n `${expr.callee.loc?.start?.line}:${expr.callee.loc?.start?.column}`\n )\n );\n return null;\n }\n\n // Handle direct string literals\n if (t.isStringLiteral(expr)) {\n return { type: 'text', text: expr.value };\n }\n\n // Handle template literals\n if (t.isTemplateLiteral(expr)) {\n const parts: StringNode[] = [];\n for (let index = 0; index < expr.quasis.length; index++) {\n const quasi = expr.quasis[index];\n const text = quasi.value.cooked ?? quasi.value.raw ?? '';\n if (text) {\n parts.push({ type: 'text', text });\n }\n const exprNode = expr.expressions[index];\n if (exprNode && t.isExpression(exprNode)) {\n if (isDeriveCall({ expr: exprNode, tPath })) {\n // Derive — resolve fully (no runtime interpolation forwarding)\n const result = handleDerivation({\n expr: exprNode,\n tPath,\n file,\n parsingOptions,\n errors,\n warnings,\n });\n if (result === null) return null;\n parts.push(result);\n } else {\n // Non-derive — recurse with runtime interpolation forwarded\n const result = handleDerivation({\n expr: exprNode,\n tPath,\n file,\n parsingOptions,\n errors,\n warnings,\n runtimeInterpolationState,\n skipDeriveInvocation,\n });\n if (result === null) return null;\n parts.push(result);\n }\n }\n }\n\n if (parts.length === 0) {\n return { type: 'text', text: '' };\n }\n if (parts.length === 1) {\n return parts[0];\n }\n return { type: 'sequence', nodes: parts };\n }\n\n // Handle binary expressions\n if (t.isBinaryExpression(expr) && expr.operator === '+') {\n if (!t.isExpression(expr.left) || !t.isExpression(expr.right)) {\n return null;\n }\n const leftResult = handleDerivation({\n expr: expr.left,\n tPath,\n file,\n parsingOptions,\n errors,\n warnings,\n runtimeInterpolationState,\n skipDeriveInvocation,\n });\n const rightResult = handleDerivation({\n expr: expr.right,\n tPath,\n file,\n parsingOptions,\n errors,\n warnings,\n runtimeInterpolationState,\n skipDeriveInvocation,\n });\n\n if (leftResult === null || rightResult === null) {\n return null;\n }\n\n return { type: 'sequence', nodes: [leftResult, rightResult] };\n }\n\n // Handle parenthesized expressions\n if (t.isParenthesizedExpression(expr)) {\n return handleDerivation({\n expr: expr.expression,\n tPath,\n file,\n parsingOptions,\n errors,\n warnings,\n runtimeInterpolationState,\n skipDeriveInvocation,\n });\n }\n\n // Handle numeric literals by converting them to strings\n if (t.isNumericLiteral(expr)) {\n return { type: 'text', text: String(expr.value) };\n }\n\n // Handle unary expressions by converting them to strings\n if (t.isUnaryExpression(expr)) {\n let operator = '';\n if (expr.operator === '-') {\n operator = expr.operator;\n }\n if (t.isNumericLiteral(expr.argument)) {\n if (expr.argument.value === 0) {\n return { type: 'text', text: '0' };\n } else {\n return {\n type: 'text',\n text: operator + expr.argument.value.toString(),\n };\n }\n } else {\n // invalid\n return null;\n }\n }\n\n // Handle boolean literals by converting them to strings\n if (t.isBooleanLiteral(expr)) {\n return { type: 'text', text: String(expr.value) };\n }\n\n // Handle null literal\n if (t.isNullLiteral(expr)) {\n return { type: 'text', text: 'null' };\n }\n\n // Non-static expression\n if (skipDeriveInvocation) {\n // Skip pass a `derive()` invocation to do derivation\n const variants = resolveCallStringVariants(\n expr,\n tPath,\n file,\n parsingOptions,\n errors,\n warnings\n );\n if (variants) {\n return {\n type: 'choice',\n nodes: variants.map((v) => ({ type: 'text', text: v })),\n };\n }\n // Autoderive had no resolvable results\n const code = generate(expr).code;\n errors.push(\n warnAutoderiveNoResultsSync(\n file,\n code,\n `${expr.loc?.start?.line}:${expr.loc?.start?.column}`\n )\n );\n return null;\n }\n\n // Not a derivable expression\n if (runtimeInterpolationState) {\n return { type: 'text', text: `{${runtimeInterpolationState.index++}}` };\n }\n return null;\n}\n\n/**\n * Given a CallExpression, if it is derive(<call>) or derive(await <call>),\n * return all possible string outcomes of that argument call as an array of strings.\n *\n * Examples:\n * derive(time()) -> [\"day\", \"night\"]\n * derive(await time()) -> [\"day\", \"night\"]\n *\n * Returns null if it can't be resolved.\n */\nfunction getDeriveVariants<T extends t.CallExpression = t.CallExpression>({\n call,\n tPath,\n file,\n parsingOptions,\n errors,\n warnings,\n}: {\n call: T;\n tPath: NodePath;\n file: string;\n parsingOptions: ParsingConfigOptions;\n errors: string[];\n warnings: Set<string>;\n}): string[] | null {\n // --- Validate Callee --- //\n\n // Must be a derive(...) call or an alias of it\n if (!isDeriveCall({ expr: call, tPath })) {\n const calleeName = t.isIdentifier(call.callee)\n ? call.callee.name\n : generate(call.callee).code;\n errors.push(\n warnDeriveFunctionNotWrappedSync(\n file,\n calleeName,\n `${call.callee.loc?.start?.line}:${call.callee.loc?.start?.column}`\n )\n );\n return null;\n }\n\n // --- Validate Arguments --- //\n\n if (call.arguments.length !== 1) return null;\n\n const arg = call.arguments[0];\n if (!t.isExpression(arg)) return null;\n\n // Handle await expression: derive(await time())\n if (t.isAwaitExpression(arg)) {\n // Resolve the inner call's possible string outcomes\n return resolveCallStringVariants(\n arg.argument,\n tPath,\n file,\n parsingOptions,\n errors,\n warnings\n );\n }\n // Handle call expression: derive(time())\n if (t.isCallExpression(arg)) {\n return resolveCallStringVariants(\n arg,\n tPath,\n file,\n parsingOptions,\n errors,\n warnings\n );\n }\n // Handle other expressions (ternary, string literal, etc.) by recursing into handleDerivation\n const node = handleDerivation({\n expr: arg,\n tPath,\n file,\n parsingOptions,\n errors,\n warnings,\n skipDeriveInvocation: true,\n });\n if (node) {\n return nodeToStrings(node);\n }\n return null;\n}\n\nfunction resolveCallStringVariants(\n expression: t.Expression,\n tPath: NodePath,\n file: string,\n parsingOptions: ParsingConfigOptions,\n errors: string[],\n warnings: Set<string>\n): string[] | null {\n // Handle function identifier calls: derive(time())\n if (t.isCallExpression(expression) && t.isIdentifier(expression.callee)) {\n const functionName = expression.callee.name;\n\n // Use Binding to resolve the function\n const calleeBinding = tPath.scope.getBinding(functionName);\n\n if (calleeBinding) {\n // Check if the binding itself is an import (not just if the name exists in imports)\n const isImportBinding =\n calleeBinding.path.isImportSpecifier() ||\n calleeBinding.path.isImportDefaultSpecifier() ||\n calleeBinding.path.isImportNamespaceSpecifier();\n\n if (isImportBinding) {\n // Function is imported - resolve cross-file\n const importedFunctionsMap = buildImportMap(\n tPath.scope.getProgramParent().path\n );\n\n let originalName: string | undefined;\n if (calleeBinding.path.isImportSpecifier()) {\n originalName = t.isIdentifier(calleeBinding.path.node.imported)\n ? calleeBinding.path.node.imported.name\n : calleeBinding.path.node.imported.value;\n } else if (calleeBinding.path.isImportDefaultSpecifier()) {\n originalName = calleeBinding.path.node.local.name;\n } else if (calleeBinding.path.isImportNamespaceSpecifier()) {\n originalName = calleeBinding.path.node.local.name;\n }\n\n const importPath = importedFunctionsMap.get(functionName);\n if (importPath) {\n const filePath = resolveImportPath(\n file,\n importPath,\n parsingOptions,\n resolveImportPathCache\n );\n\n if (filePath && originalName) {\n const node = resolveFunctionInFile(\n filePath,\n originalName,\n parsingOptions,\n errors,\n warnings\n );\n if (node) {\n return nodeToStrings(node);\n }\n }\n }\n } else {\n // Function is local - use parseStringExpression with resolveFunctionCall\n const node = resolveFunctionCallFromBinding(\n calleeBinding,\n tPath,\n file,\n parsingOptions,\n warnings,\n errors\n );\n if (node) {\n return nodeToStrings(node);\n }\n }\n } else {\n // Function not found in scope\n errors.push(\n warnFunctionNotFoundSync(\n file,\n functionName,\n `${expression.callee.loc?.start?.line}:${expression.callee.loc?.start?.column}`\n )\n );\n return null;\n }\n }\n\n // If we get here: analyze this call as derivable (statically analyzable)\n const node = parseStringExpression(\n expression,\n tPath,\n file,\n parsingOptions,\n warnings,\n errors\n );\n if (node) {\n return nodeToStrings(node);\n }\n return null;\n}\n\n/**\n * Resolves a function from a binding (local function) using parseStringExpression logic\n */\nfunction resolveFunctionCallFromBinding(\n calleeBinding: ReturnType<NodePath['scope']['getBinding']>,\n tPath: NodePath,\n file: string,\n parsingOptions: ParsingConfigOptions,\n warnings: Set<string>,\n errors: string[]\n): StringNode | null {\n if (!calleeBinding) {\n return null;\n }\n\n const bindingPath = calleeBinding.path;\n const branches: StringNode[] = [];\n\n // Handle function declarations: function time() { return \"day\"; }\n if (bindingPath.isFunctionDeclaration()) {\n bindingPath.traverse({\n ReturnStatement(returnPath) {\n // Only process return statements that are direct children of this function\n const parentFunction = returnPath.getFunctionParent();\n if (parentFunction?.node !== bindingPath.node) {\n return;\n }\n\n const returnArg = returnPath.node.argument;\n if (!returnArg || !t.isExpression(returnArg)) {\n return;\n }\n const returnResult = parseStringExpression(\n returnArg,\n returnPath,\n file,\n parsingOptions,\n warnings,\n errors\n );\n if (returnResult !== null) {\n branches.push(returnResult);\n }\n },\n });\n }\n // Handle arrow functions: const time = () => \"day\"\n else if (bindingPath.isVariableDeclarator()) {\n const init = bindingPath.get('init');\n if (!init.isArrowFunctionExpression()) {\n return null;\n }\n\n const body = init.get('body');\n\n // Handle expression body: () => \"day\"\n if (body.isExpression()) {\n const bodyResult = parseStringExpression(\n body.node,\n body,\n file,\n parsingOptions,\n warnings,\n errors\n );\n if (bodyResult !== null) {\n branches.push(bodyResult);\n }\n }\n // Handle block body: () => { return \"day\"; }\n else if (body.isBlockStatement()) {\n const arrowFunction = init.node;\n body.traverse({\n ReturnStatement(returnPath) {\n // Only process return statements that are direct children of this function\n const parentFunction = returnPath.getFunctionParent();\n if (parentFunction?.node !== arrowFunction) {\n return;\n }\n\n const returnArg = returnPath.node.argument;\n if (!returnArg || !t.isExpression(returnArg)) {\n return;\n }\n const returnResult = parseStringExpression(\n returnArg,\n returnPath,\n file,\n parsingOptions,\n warnings,\n errors\n );\n if (returnResult !== null) {\n branches.push(returnResult);\n }\n },\n });\n }\n }\n\n if (branches.length === 0) {\n return null;\n }\n\n if (branches.length === 1) {\n return branches[0];\n }\n\n return { type: 'choice', nodes: branches };\n}\n\n/**\n * Resolves a function definition in an external file\n */\nfunction resolveFunctionInFile(\n filePath: string,\n functionName: string,\n parsingOptions: ParsingConfigOptions,\n errors: string[],\n warnings: Set<string>\n): StringNode | null {\n // Check cache first\n const cacheKey = `${filePath}::${functionName}`;\n if (processFunctionCache.has(cacheKey)) {\n return processFunctionCache.get(cacheKey) ?? null;\n }\n\n let result: StringNode | null = null;\n\n try {\n const code = fs.readFileSync(filePath, 'utf8');\n const ast = parse(code, {\n sourceType: 'module',\n plugins: ['jsx', 'typescript'],\n });\n\n traverse(ast, {\n // Handle re-exports: export * from './utils'\n ExportAllDeclaration(path) {\n // Only follow re-exports if we haven't found the function yet\n if (result !== null) return;\n\n if (t.isStringLiteral(path.node.source)) {\n const reexportPath = path.node.source.value;\n const resolvedPath = resolveImportPath(\n filePath,\n reexportPath,\n parsingOptions,\n resolveImportPathCache\n );\n\n if (resolvedPath) {\n // Recursively resolve in the re-exported file\n const reexportResult = resolveFunctionInFile(\n resolvedPath,\n functionName,\n parsingOptions,\n errors,\n warnings\n );\n if (reexportResult) {\n result = reexportResult;\n }\n }\n }\n },\n // Handle named re-exports: export { fn1 } from './utils'\n ExportNamedDeclaration(path) {\n // Only follow re-exports if we haven't found the function yet\n if (result !== null) return;\n\n // Check if this is a re-export with a source\n if (path.node.source && t.isStringLiteral(path.node.source)) {\n // Check if any of the exported specifiers match our function name\n const hasMatchingExport = path.node.specifiers.some((spec) => {\n if (t.isExportSpecifier(spec)) {\n const exportedName = t.isIdentifier(spec.exported)\n ? spec.exported.name\n : spec.exported.value;\n return exportedName === functionName;\n }\n return false;\n });\n\n if (hasMatchingExport) {\n const reexportPath = path.node.source.value;\n const resolvedPath = resolveImportPath(\n filePath,\n reexportPath,\n parsingOptions,\n resolveImportPathCache\n );\n\n if (resolvedPath) {\n // Find the original name in case it was renamed\n const specifier = path.node.specifiers.find((spec) => {\n if (t.isExportSpecifier(spec)) {\n const exportedName = t.isIdentifier(spec.exported)\n ? spec.exported.name\n : spec.exported.value;\n return exportedName === functionName;\n }\n return false;\n });\n\n let originalName = functionName;\n if (\n specifier &&\n t.isExportSpecifier(specifier) &&\n t.isIdentifier(specifier.local)\n ) {\n originalName = specifier.local.name;\n }\n\n // Recursively resolve in the re-exported file\n const reexportResult = resolveFunctionInFile(\n resolvedPath,\n originalName,\n parsingOptions,\n errors,\n warnings\n );\n if (reexportResult) {\n result = reexportResult;\n }\n }\n }\n }\n },\n // Handle function declarations: function woah() { ... }\n FunctionDeclaration(path) {\n if (path.node.id?.name === functionName && result === null) {\n const branches: StringNode[] = [];\n path.traverse({\n Function(innerPath) {\n // Skip nested functions\n innerPath.skip();\n },\n ReturnStatement(returnPath: NodePath) {\n if (!t.isReturnStatement(returnPath.node)) {\n return;\n }\n const returnArg = returnPath.node.argument;\n if (!returnArg || !t.isExpression(returnArg)) {\n return;\n }\n const returnResult = parseStringExpression(\n returnArg,\n returnPath,\n filePath,\n parsingOptions,\n warnings,\n errors\n );\n if (returnResult !== null) {\n branches.push(returnResult);\n }\n },\n });\n\n if (branches.length === 1) {\n result = branches[0];\n } else if (branches.length > 1) {\n result = { type: 'choice', nodes: branches };\n }\n }\n },\n // Handle variable declarations: const woah = () => { ... }\n VariableDeclarator(path) {\n if (\n t.isIdentifier(path.node.id) &&\n path.node.id.name === functionName &&\n path.node.init &&\n (t.isArrowFunctionExpression(path.node.init) ||\n t.isFunctionExpression(path.node.init)) &&\n result === null\n ) {\n const init = path.get('init');\n if (\n !init.isArrowFunctionExpression() &&\n !init.isFunctionExpression()\n ) {\n return;\n }\n\n const bodyPath = init.get('body');\n const branches: StringNode[] = [];\n\n // Handle expression body: () => \"day\"\n if (!Array.isArray(bodyPath) && t.isExpression(bodyPath.node)) {\n const bodyResult = parseStringExpression(\n bodyPath.node,\n bodyPath,\n filePath,\n parsingOptions,\n warnings,\n errors\n );\n if (bodyResult !== null) {\n branches.push(bodyResult);\n }\n }\n // Handle block body: () => { return \"day\"; }\n else if (\n !Array.isArray(bodyPath) &&\n t.isBlockStatement(bodyPath.node)\n ) {\n const arrowFunction = init.node;\n bodyPath.traverse({\n Function(innerPath: NodePath) {\n // Skip nested functions\n innerPath.skip();\n },\n ReturnStatement(returnPath: NodePath) {\n // Only process return statements that are direct children of this function\n const parentFunction = returnPath.getFunctionParent();\n if (parentFunction?.node !== arrowFunction) {\n return;\n }\n\n if (!t.isReturnStatement(returnPath.node)) {\n return;\n }\n const returnArg = returnPath.node.argument;\n if (!returnArg || !t.isExpression(returnArg)) {\n return;\n }\n const returnResult = parseStringExpression(\n returnArg,\n returnPath,\n filePath,\n parsingOptions,\n warnings,\n errors\n );\n if (returnResult !== null) {\n branches.push(returnResult);\n }\n },\n });\n }\n\n if (branches.length === 1) {\n result = branches[0];\n } else if (branches.length > 1) {\n result = { type: 'choice', nodes: branches };\n }\n }\n },\n });\n } catch (error) {\n // File read or parse error - return null\n errors.push(\n warnDeriveFunctionNoResultsSync(\n filePath,\n functionName,\n 'file read/parse error: ' + error\n )\n );\n result = null;\n }\n\n // Cache the result\n processFunctionCache.set(cacheKey, result);\n return result;\n}\n"],"mappings":";;;;;;;;;;;AAoBA,MAAM,WAAW,eAAe,WAAW;AAC3C,MAAM,WAAW,eAAe,WAAW;;;;;;AAO3C,MAAM,yCAAyB,IAAI,KAA4B;;;;;;AAO/D,MAAM,uCAAuB,IAAI,KAAgC;;;;;;;;;;;;;;;;;;AAmBjE,SAAgB,iBAAiB,EAC/B,MACA,OACA,MACA,gBACA,QACA,UACA,2BACA,wBAUoB;AACpB,KAAI,CAAC,KACH,QAAO;AAIT,KAAI,EAAE,iBAAiB,KAAK,EAAE;AAC5B,MAAI,aAAa;GAAE;GAAM;GAAO,CAAC,EAAE;GACjC,MAAM,WAAW,kBAAkB;IACjC,MAAM;IACN;IACA;IACA;IACA;IACA;IACD,CAAC;AACF,OAAI,SACF,QAAO;IACL,MAAM;IACN,OAAO,SAAS,KAAK,OAAO;KAAE,MAAM;KAAQ,MAAM;KAAG,EAAE;IACxD;GAGH,MAAM,OACJ,KAAK,UAAU,SAAS,IACpB,SAAS,KAAK,UAAU,GAAG,CAAC,OAC5B;AACN,UAAO,KACL,gCACE,MACA,MACA,GAAG,KAAK,KAAK,OAAO,KAAK,GAAG,KAAK,KAAK,OAAO,SAC9C,CACF;AACD,UAAO;;AAGT,MAAI,0BACF,QAAO;GAAE,MAAM;GAAQ,MAAM,IAAI,0BAA0B,QAAQ;GAAI;EAEzE,MAAM,aAAa,EAAE,aAAa,KAAK,OAAO,GAC1C,KAAK,OAAO,OACZ,SAAS,KAAK,OAAO,CAAC;AAC1B,SAAO,KACL,iCACE,MACA,YACA,GAAG,KAAK,OAAO,KAAK,OAAO,KAAK,GAA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OAAO;MAAU;;;GAInD,CAAC;UACK,OAAO;AAEd,SAAO,KACL,gCACE,UACA,cACA,4BAA4B,MAC7B,CACF;AACD,WAAS;;AAIX,sBAAqB,IAAI,UAAU,OAAO;AAC1C,QAAO"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gt",
3
- "version": "2.16.4",
3
+ "version": "2.16.5",
4
4
  "main": "dist/index.js",
5
5
  "bin": "bin/main.js",
6
6
  "files": [
@@ -73,7 +73,7 @@
73
73
  "cli"
74
74
  ],
75
75
  "author": "General Translation, Inc.",
76
- "license": "FSL-1.1-ALv2",
76
+ "license": "MIT",
77
77
  "bugs": {
78
78
  "url": "https://github.com/generaltranslation/gt/issues"
79
79
  },
@@ -115,12 +115,12 @@
115
115
  "unified": "^11.0.5",
116
116
  "unist-util-visit": "^5.0.0",
117
117
  "yaml": "^2.8.0",
118
- "@generaltranslation/icu": "0.1.1",
119
- "@generaltranslation/format": "0.1.4",
120
- "@generaltranslation/python-extractor": "0.2.35",
121
- "@generaltranslation/supported-locales": "2.1.15",
122
- "generaltranslation": "9.1.2",
123
- "gt-remark": "1.0.11"
118
+ "@generaltranslation/icu": "0.1.2",
119
+ "@generaltranslation/format": "0.1.5",
120
+ "@generaltranslation/python-extractor": "0.2.36",
121
+ "@generaltranslation/supported-locales": "2.1.16",
122
+ "generaltranslation": "9.1.3",
123
+ "gt-remark": "1.0.12"
124
124
  },
125
125
  "devDependencies": {
126
126
  "@types/babel__generator": "^7.27.0",