gt 2.14.16 → 2.14.17
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.14.17
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#1220](https://github.com/generaltranslation/gt/pull/1220) [`d5bfe1d`](https://github.com/generaltranslation/gt/commit/d5bfe1d0768006eda5842a548651c6be73d69a55) Thanks [@ErnestM1234](https://github.com/ErnestM1234)! - fix: cross file resolution failure on relative imports
|
|
8
|
+
|
|
3
9
|
## 2.14.16
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/dist/console/index.d.ts
CHANGED
|
@@ -30,6 +30,7 @@ export declare const warnDeriveUnresolvableValueSync: (file: string, key: string
|
|
|
30
30
|
export declare const warnDeriveCircularSpreadSync: (file: string, varName: string, location?: string) => string;
|
|
31
31
|
export declare const warnDeriveDestructuringSync: (file: string, varName: string, location?: string) => string;
|
|
32
32
|
export declare const warnDeriveOptionalChainingSync: (file: string, code: string, location?: string) => string;
|
|
33
|
+
export declare const warnUnresolvedImportSync: (file: string, functionName: string, importPath: string, location?: string) => string;
|
|
33
34
|
export declare const noLocalesError = "No locales found! Provide a list of locales for translation, or specify them in your gt.config.json file.";
|
|
34
35
|
export declare const noDefaultLocaleError = "No default locale found! Provide a default locale, or specify it in your gt.config.json file.";
|
|
35
36
|
export declare const noFilesError = "Incorrect or missing files configuration! Make sure your files are configured correctly in your gt.config.json file.";
|
package/dist/console/index.js
CHANGED
|
@@ -41,6 +41,7 @@ export const warnDeriveUnresolvableValueSync = (file, key, location) => withLoca
|
|
|
41
41
|
export const warnDeriveCircularSpreadSync = (file, varName, location) => withLocation(file, withDeriveFunctionError(`Circular spread detected involving ${colorizeFunctionName(varName)}. Spread references that form a cycle cannot be resolved statically.`), location);
|
|
42
42
|
export const warnDeriveDestructuringSync = (file, varName, location) => withLocation(file, withDeriveFunctionError(`Variable ${colorizeFunctionName(varName)} uses destructuring syntax, which is not yet supported in derive(). Assign the value to a const variable directly instead.`), location);
|
|
43
43
|
export const warnDeriveOptionalChainingSync = (file, code, location) => withLocation(file, withDeriveFunctionError(`Optional chaining (${colorizeFunctionName(formatCodeClamp(code))}) is not supported in derive(). Optional chaining implies the value could be undefined, which cannot be resolved statically. Use a non-optional access instead.`), location);
|
|
44
|
+
export const warnUnresolvedImportSync = (file, functionName, importPath, location) => withLocation(file, `Could not resolve import ${colorizeFunctionName(importPath)} for function ${colorizeFunctionName(functionName)}. Translation strings inside this function will not be extracted.`, location);
|
|
44
45
|
// Re-export error messages
|
|
45
46
|
export const noLocalesError = `No locales found! Provide a list of locales for translation, or specify them in your gt.config.json file.`;
|
|
46
47
|
export const noDefaultLocaleError = `No default locale found! Provide a default locale, or specify it in your gt.config.json file.`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PACKAGE_VERSION = "2.14.
|
|
1
|
+
export declare const PACKAGE_VERSION = "2.14.17";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// This file is auto-generated. Do not edit manually.
|
|
2
|
-
export const PACKAGE_VERSION = '2.14.
|
|
2
|
+
export const PACKAGE_VERSION = '2.14.17';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as t from '@babel/types';
|
|
2
2
|
import { INLINE_TRANSLATION_HOOK, INLINE_TRANSLATION_HOOK_ASYNC, INLINE_MESSAGE_HOOK, INLINE_MESSAGE_HOOK_ASYNC, STRING_REGISTRATION_FUNCS, T_GLOBAL_REGISTRATION_FUNCTION_MARKER, } from './constants.js';
|
|
3
|
-
import { warnAsyncUseGT, warnSyncGetGT } from '../../../console/index.js';
|
|
3
|
+
import { warnAsyncUseGT, warnSyncGetGT, warnUnresolvedImportSync, } from '../../../console/index.js';
|
|
4
4
|
import traverseModule from '@babel/traverse';
|
|
5
5
|
// Handle CommonJS/ESM interop
|
|
6
6
|
const traverse = traverseModule.default || traverseModule;
|
|
@@ -123,6 +123,11 @@ function handleFunctionCall(tPath, config, state, output, visitedFunctions) {
|
|
|
123
123
|
if (resolvedPath) {
|
|
124
124
|
processFunctionInFile(resolvedPath, callee.name, argIndex, config, state, output);
|
|
125
125
|
}
|
|
126
|
+
else {
|
|
127
|
+
output.warnings.add(warnUnresolvedImportSync(config.file, callee.name, importPath, tPath.node.loc
|
|
128
|
+
? `${tPath.node.loc.start.line}:${tPath.node.loc.start.column}`
|
|
129
|
+
: undefined));
|
|
130
|
+
}
|
|
126
131
|
}
|
|
127
132
|
}
|
|
128
133
|
}
|
|
@@ -207,12 +212,14 @@ function processFunctionInFile(filePath, functionName, argIndex, config, state,
|
|
|
207
212
|
// Fresh set per cross-file parse — node identity is only stable within a single parse.
|
|
208
213
|
// Cross-file cycles are already guarded by processFunctionCache above.
|
|
209
214
|
const visitedFunctions = new Set();
|
|
215
|
+
// Update config.file so relative imports in the target file resolve correctly
|
|
216
|
+
const crossFileConfig = { ...config, file: filePath };
|
|
210
217
|
traverse(ast, {
|
|
211
218
|
// Handle function declarations: function getInfo(t) { ... }
|
|
212
219
|
FunctionDeclaration(path) {
|
|
213
220
|
if (path.node.id?.name === functionName) {
|
|
214
221
|
found = true;
|
|
215
|
-
processFunctionIfMatches(functionName, argIndex, path.node, path,
|
|
222
|
+
processFunctionIfMatches(functionName, argIndex, path.node, path, crossFileConfig, output, visitedFunctions);
|
|
216
223
|
}
|
|
217
224
|
},
|
|
218
225
|
// Handle variable declarations: const getInfo = (t) => { ... }
|
|
@@ -224,7 +231,7 @@ function processFunctionInFile(filePath, functionName, argIndex, config, state,
|
|
|
224
231
|
t.isFunctionExpression(path.node.init))) {
|
|
225
232
|
found = true;
|
|
226
233
|
const initPath = path.get('init');
|
|
227
|
-
processFunctionIfMatches(functionName, argIndex, path.node.init, initPath,
|
|
234
|
+
processFunctionIfMatches(functionName, argIndex, path.node.init, initPath, crossFileConfig, output, visitedFunctions);
|
|
228
235
|
}
|
|
229
236
|
},
|
|
230
237
|
// Collect re-exports: export * from './other'
|