gtx-cli 2.1.2 → 2.1.3
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,11 @@
|
|
|
1
1
|
# gtx-cli
|
|
2
2
|
|
|
3
|
+
## 2.1.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#564](https://github.com/generaltranslation/gt/pull/564) [`7251fc5`](https://github.com/generaltranslation/gt/commit/7251fc5d2474ad71b2da9ae5b71e37aed8199bce) Thanks [@brian-lou](https://github.com/brian-lou)! - Fix CLI validation (used to error for {<JSX/>} inside <T>)
|
|
8
|
+
|
|
3
9
|
## 2.1.2
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import * as t from '@babel/types';
|
|
2
|
+
import generateModule from '@babel/generator';
|
|
3
|
+
// Handle CommonJS/ESM interop
|
|
4
|
+
const generate = generateModule.default || generateModule;
|
|
2
5
|
const MEANINGFUL_REGEX = /[\p{L}\p{N}]/u;
|
|
3
6
|
/**
|
|
4
7
|
* Checks if a node is meaningful. Does not recurse into children.
|
|
@@ -44,23 +47,10 @@ export function isStaticExpression(expr) {
|
|
|
44
47
|
if (t.isTemplateLiteral(expr) && expr.expressions.length === 0) {
|
|
45
48
|
return { isStatic: true, value: expr.quasis[0].value.raw };
|
|
46
49
|
}
|
|
47
|
-
//
|
|
50
|
+
// Binary expressions are not static
|
|
48
51
|
if (t.isBinaryExpression(expr)) {
|
|
49
|
-
//
|
|
50
|
-
|
|
51
|
-
return { isStatic: false };
|
|
52
|
-
}
|
|
53
|
-
// Type guard to ensure we only process Expression types
|
|
54
|
-
if (t.isExpression(expr.left) && t.isExpression(expr.right)) {
|
|
55
|
-
const left = isStaticExpression(expr.left);
|
|
56
|
-
const right = isStaticExpression(expr.right);
|
|
57
|
-
if (left.isStatic &&
|
|
58
|
-
right.isStatic &&
|
|
59
|
-
left.value !== undefined &&
|
|
60
|
-
right.value !== undefined) {
|
|
61
|
-
return { isStatic: true, value: left.value + right.value };
|
|
62
|
-
}
|
|
63
|
-
}
|
|
52
|
+
// Not a static expression
|
|
53
|
+
return { isStatic: false };
|
|
64
54
|
}
|
|
65
55
|
// Handle parenthesized expressions
|
|
66
56
|
if (t.isParenthesizedExpression(expr)) {
|
|
@@ -25,6 +25,9 @@ export function buildJSXTree(importAliases, node, unwrappedExpressions, updates,
|
|
|
25
25
|
return null;
|
|
26
26
|
}
|
|
27
27
|
const expr = node.expression;
|
|
28
|
+
if (t.isJSXElement(expr)) {
|
|
29
|
+
return buildJSXTree(importAliases, expr, unwrappedExpressions, updates, errors, warnings, file, insideT);
|
|
30
|
+
}
|
|
28
31
|
const staticAnalysis = isStaticExpression(expr);
|
|
29
32
|
if (staticAnalysis.isStatic && staticAnalysis.value !== undefined) {
|
|
30
33
|
// Preserve the exact whitespace for static string expressions
|