@generaltranslation/compiler 1.3.23 → 1.3.25-odysseus.0
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/config.d.ts +5 -4
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js.map +1 -1
- package/dist/processing/collection/processTaggedTemplateExpression.d.ts +1 -1
- package/dist/processing/collection/processTaggedTemplateExpression.js +1 -1
- package/dist/processing/collection/processTaggedTemplateExpression.js.map +1 -1
- package/dist/processing/jsx-insertion/processCallExpression.js.map +1 -1
- package/dist/processing/jsx-insertion/processProgram.d.ts.map +1 -1
- package/dist/processing/jsx-insertion/processProgram.js +1 -1
- package/dist/processing/jsx-insertion/processProgram.js.map +1 -1
- package/dist/processing/macro-expansion/processProgram.js +1 -1
- package/dist/processing/macro-expansion/processProgram.js.map +1 -1
- package/dist/processing/macro-expansion/processTaggedTemplateExpression.d.ts +1 -1
- package/dist/processing/macro-expansion/processTaggedTemplateExpression.js +1 -1
- package/dist/processing/macro-expansion/processTaggedTemplateExpression.js.map +1 -1
- package/dist/processing/runtime-translate/processProgram.d.ts.map +1 -1
- package/dist/processing/runtime-translate/processProgram.js +2 -1
- package/dist/processing/runtime-translate/processProgram.js.map +1 -1
- package/dist/state/utils/initializeState.d.ts.map +1 -1
- package/dist/state/utils/initializeState.js +6 -3
- package/dist/state/utils/initializeState.js.map +1 -1
- package/dist/transform/jsx-children/constructJsxChildren.js.map +1 -1
- package/dist/transform/jsx-insertion/injectJsxInsertionImport.d.ts +2 -2
- package/dist/transform/jsx-insertion/injectJsxInsertionImport.d.ts.map +1 -1
- package/dist/transform/jsx-insertion/injectJsxInsertionImport.js +4 -3
- package/dist/transform/jsx-insertion/injectJsxInsertionImport.js.map +1 -1
- package/dist/transform/macro-expansion/injectMacroImport.d.ts +2 -2
- package/dist/transform/macro-expansion/injectMacroImport.d.ts.map +1 -1
- package/dist/transform/macro-expansion/injectMacroImport.js +4 -3
- package/dist/transform/macro-expansion/injectMacroImport.js.map +1 -1
- package/dist/transform/runtime-translate/injectRuntimeTranslateImport.d.ts +3 -2
- package/dist/transform/runtime-translate/injectRuntimeTranslateImport.d.ts.map +1 -1
- package/dist/transform/runtime-translate/injectRuntimeTranslateImport.js +4 -3
- package/dist/transform/runtime-translate/injectRuntimeTranslateImport.js.map +1 -1
- package/dist/transform/validation/validateTranslationFunction.d.ts.map +1 -1
- package/dist/transform/validation/validateTranslationFunction.js +3 -3
- package/dist/transform/validation/validateTranslationFunction.js.map +1 -1
- package/dist/utils/constants/gt/constants.d.ts +1 -5
- package/dist/utils/constants/gt/constants.d.ts.map +1 -1
- package/dist/utils/constants/gt/constants.js +1 -5
- package/dist/utils/constants/gt/constants.js.map +1 -1
- package/dist/utils/constants/gt/helpers.d.ts +2 -1
- package/dist/utils/constants/gt/helpers.d.ts.map +1 -1
- package/dist/utils/constants/gt/helpers.js +15 -5
- package/dist/utils/constants/gt/helpers.js.map +1 -1
- package/dist/utils/constants/resolveIdentifier/isGTComponent.d.ts +1 -1
- package/dist/utils/constants/resolveIdentifier/isGTComponent.d.ts.map +1 -1
- package/dist/utils/constants/resolveIdentifier/isGTComponent.js +2 -3
- package/dist/utils/constants/resolveIdentifier/isGTComponent.js.map +1 -1
- package/dist/utils/parsing/isStringTranslationTaggedTemplate.d.ts +1 -1
- package/dist/utils/parsing/isStringTranslationTaggedTemplate.js +3 -3
- package/dist/utils/parsing/isStringTranslationTaggedTemplate.js.map +1 -1
- package/package.json +3 -3
|
@@ -5,7 +5,7 @@ import * as t from '@babel/types';
|
|
|
5
5
|
* string translation macro.
|
|
6
6
|
*
|
|
7
7
|
* The macro is valid when it is an unbound bare identifier, or when it is
|
|
8
|
-
* imported from gt-react
|
|
8
|
+
* imported from gt-react. This covers global `t`, but not explicit
|
|
9
9
|
* member access such as `globalThis.t` or `window.t`. Other bindings are left
|
|
10
10
|
* alone so local/i18next t tags do not get transformed or extracted.
|
|
11
11
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_runtime = require("../../_virtual/_rolldown/runtime.js");
|
|
3
|
-
require("../constants/gt/
|
|
3
|
+
const require_utils_constants_gt_helpers = require("../constants/gt/helpers.js");
|
|
4
4
|
let _babel_types = require("@babel/types");
|
|
5
5
|
_babel_types = require_runtime.__toESM(_babel_types);
|
|
6
6
|
//#region src/utils/parsing/isStringTranslationTaggedTemplate.ts
|
|
@@ -9,7 +9,7 @@ _babel_types = require_runtime.__toESM(_babel_types);
|
|
|
9
9
|
* string translation macro.
|
|
10
10
|
*
|
|
11
11
|
* The macro is valid when it is an unbound bare identifier, or when it is
|
|
12
|
-
* imported from gt-react
|
|
12
|
+
* imported from gt-react. This covers global `t`, but not explicit
|
|
13
13
|
* member access such as `globalThis.t` or `window.t`. Other bindings are left
|
|
14
14
|
* alone so local/i18next t tags do not get transformed or extracted.
|
|
15
15
|
*/
|
|
@@ -19,7 +19,7 @@ function isStringTranslationTaggedTemplate(path, symbol) {
|
|
|
19
19
|
if (!binding) return true;
|
|
20
20
|
if (!binding.path.isImportSpecifier()) return false;
|
|
21
21
|
const importDecl = binding.path.parentPath;
|
|
22
|
-
return (importDecl === null || importDecl === void 0 ? void 0 : importDecl.isImportDeclaration()) === true && importDecl.node.source.value
|
|
22
|
+
return (importDecl === null || importDecl === void 0 ? void 0 : importDecl.isImportDeclaration()) === true && require_utils_constants_gt_helpers.isGTReactImportSource(importDecl.node.source.value);
|
|
23
23
|
}
|
|
24
24
|
//#endregion
|
|
25
25
|
exports.isStringTranslationTaggedTemplate = isStringTranslationTaggedTemplate;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isStringTranslationTaggedTemplate.js","names":["t"],"sources":["../../../src/utils/parsing/isStringTranslationTaggedTemplate.ts"],"sourcesContent":["import type { NodePath } from '@babel/traverse';\nimport * as t from '@babel/types';\nimport {
|
|
1
|
+
{"version":3,"file":"isStringTranslationTaggedTemplate.js","names":["t","isGTReactImportSource"],"sources":["../../../src/utils/parsing/isStringTranslationTaggedTemplate.ts"],"sourcesContent":["import type { NodePath } from '@babel/traverse';\nimport * as t from '@babel/types';\nimport { isGTReactImportSource } from '../constants/gt/helpers';\n\n/**\n * Checks whether a tagged template expression should be treated as the GT\n * string translation macro.\n *\n * The macro is valid when it is an unbound bare identifier, or when it is\n * imported from gt-react. This covers global `t`, but not explicit\n * member access such as `globalThis.t` or `window.t`. Other bindings are left\n * alone so local/i18next t tags do not get transformed or extracted.\n */\nexport function isStringTranslationTaggedTemplate(\n path: NodePath<t.TaggedTemplateExpression>,\n symbol: string\n): boolean {\n if (!t.isIdentifier(path.node.tag, { name: symbol })) {\n return false;\n }\n\n const binding = path.scope.getBinding(symbol);\n if (!binding) {\n return true;\n }\n\n if (!binding.path.isImportSpecifier()) {\n return false;\n }\n\n const importDecl = binding.path.parentPath;\n return (\n importDecl?.isImportDeclaration() === true &&\n isGTReactImportSource(importDecl.node.source.value)\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAaA,SAAgB,kCACd,MACA,QACS;AACT,KAAI,CAACA,aAAE,aAAa,KAAK,KAAK,KAAK,EAAE,MAAM,QAAQ,CAAC,CAClD,QAAO;CAGT,MAAM,UAAU,KAAK,MAAM,WAAW,OAAO;AAC7C,KAAI,CAAC,QACH,QAAO;AAGT,KAAI,CAAC,QAAQ,KAAK,mBAAmB,CACnC,QAAO;CAGT,MAAM,aAAa,QAAQ,KAAK;AAChC,SAAA,eAAA,QAAA,eAAA,KAAA,IAAA,KAAA,IACE,WAAY,qBAAqB,MAAK,QACtCC,mCAAAA,sBAAsB,WAAW,KAAK,OAAO,MAAM"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@generaltranslation/compiler",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.25-odysseus.0",
|
|
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",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"@babel/traverse": "^7.23.0",
|
|
25
25
|
"@babel/types": "^7.23.0",
|
|
26
26
|
"unplugin": "^2.3.10",
|
|
27
|
-
"@generaltranslation/format": "0.1.
|
|
28
|
-
"generaltranslation": "
|
|
27
|
+
"@generaltranslation/format": "0.1.2-odysseus.0",
|
|
28
|
+
"generaltranslation": "9.0.0-odysseus.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/babel__core": "^7.20.0",
|