i18next-cli 1.5.11 → 1.6.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/CHANGELOG.md +21 -0
- package/README.md +6 -6
- package/dist/cjs/cli.js +1 -1
- package/dist/cjs/extractor/core/extractor.js +1 -1
- package/dist/cjs/extractor/core/key-finder.js +1 -1
- package/dist/cjs/extractor/parsers/ast-visitors.js +1 -1
- package/dist/cjs/extractor/parsers/comment-parser.js +1 -1
- package/dist/cjs/extractor/parsers/jsx-parser.js +1 -1
- package/dist/cjs/extractor/plugin-manager.js +1 -1
- package/dist/esm/cli.js +1 -1
- package/dist/esm/extractor/core/extractor.js +1 -1
- package/dist/esm/extractor/core/key-finder.js +1 -1
- package/dist/esm/extractor/parsers/ast-visitors.js +1 -1
- package/dist/esm/extractor/parsers/comment-parser.js +1 -1
- package/dist/esm/extractor/parsers/jsx-parser.js +1 -1
- package/dist/esm/extractor/plugin-manager.js +1 -1
- package/package.json +4 -1
- package/src/cli.ts +1 -1
- package/src/extractor/core/extractor.ts +21 -48
- package/src/extractor/core/key-finder.ts +32 -7
- package/src/extractor/parsers/ast-visitors.ts +124 -23
- package/src/extractor/parsers/comment-parser.ts +16 -3
- package/src/extractor/parsers/jsx-parser.ts +27 -0
- package/src/extractor/plugin-manager.ts +11 -2
- package/src/types.ts +25 -0
- package/types/extractor/core/extractor.d.ts +2 -2
- package/types/extractor/core/extractor.d.ts.map +1 -1
- package/types/extractor/core/key-finder.d.ts.map +1 -1
- package/types/extractor/parsers/ast-visitors.d.ts +22 -4
- package/types/extractor/parsers/ast-visitors.d.ts.map +1 -1
- package/types/extractor/parsers/comment-parser.d.ts +6 -3
- package/types/extractor/parsers/comment-parser.d.ts.map +1 -1
- package/types/extractor/parsers/jsx-parser.d.ts.map +1 -1
- package/types/extractor/plugin-manager.d.ts +2 -2
- package/types/extractor/plugin-manager.d.ts.map +1 -1
- package/types/types.d.ts +21 -0
- package/types/types.d.ts.map +1 -1
|
@@ -1,25 +1,19 @@
|
|
|
1
1
|
import type { Module, Node, CallExpression, VariableDeclarator, JSXElement, ArrowFunctionExpression, ObjectExpression, Expression, TemplateLiteral } from '@swc/core'
|
|
2
|
-
import type { PluginContext, I18nextToolkitConfig, Logger, ExtractedKey } from '../../types'
|
|
2
|
+
import type { PluginContext, I18nextToolkitConfig, Logger, ExtractedKey, ScopeInfo } from '../../types'
|
|
3
3
|
import { extractFromTransComponent } from './jsx-parser'
|
|
4
4
|
import { getObjectProperty, getObjectPropValue } from './ast-utils'
|
|
5
5
|
|
|
6
|
-
/**
|
|
7
|
-
* Represents variable scope information tracked during AST traversal.
|
|
8
|
-
* Used to maintain context about translation functions and their configuration.
|
|
9
|
-
*/
|
|
10
|
-
interface ScopeInfo {
|
|
11
|
-
/** Default namespace for translation calls in this scope */
|
|
12
|
-
defaultNs?: string;
|
|
13
|
-
/** Key prefix to prepend to all translation keys in this scope */
|
|
14
|
-
keyPrefix?: string;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
6
|
interface UseTranslationHookConfig {
|
|
18
7
|
name: string;
|
|
19
8
|
nsArg: number;
|
|
20
9
|
keyPrefixArg: number;
|
|
21
10
|
}
|
|
22
11
|
|
|
12
|
+
export interface ASTVisitorHooks {
|
|
13
|
+
onBeforeVisitNode?: (node: Node) => void
|
|
14
|
+
onAfterVisitNode?: (node: Node) => void
|
|
15
|
+
}
|
|
16
|
+
|
|
23
17
|
/**
|
|
24
18
|
* AST visitor class that traverses JavaScript/TypeScript syntax trees to extract translation keys.
|
|
25
19
|
*
|
|
@@ -44,12 +38,15 @@ interface UseTranslationHookConfig {
|
|
|
44
38
|
*/
|
|
45
39
|
export class ASTVisitors {
|
|
46
40
|
private readonly pluginContext: PluginContext
|
|
47
|
-
private readonly config: I18nextToolkitConfig
|
|
41
|
+
private readonly config: Omit<I18nextToolkitConfig, 'plugins'>
|
|
48
42
|
private readonly logger: Logger
|
|
49
43
|
private scopeStack: Array<Map<string, ScopeInfo>> = []
|
|
44
|
+
private hooks: ASTVisitorHooks
|
|
50
45
|
|
|
51
46
|
public objectKeys = new Set<string>()
|
|
52
47
|
|
|
48
|
+
private scope: Map<string, { defaultNs?: string; keyPrefix?: string }> = new Map()
|
|
49
|
+
|
|
53
50
|
/**
|
|
54
51
|
* Creates a new AST visitor instance.
|
|
55
52
|
*
|
|
@@ -58,13 +55,18 @@ export class ASTVisitors {
|
|
|
58
55
|
* @param logger - Logger for warnings and debug information
|
|
59
56
|
*/
|
|
60
57
|
constructor (
|
|
61
|
-
config: I18nextToolkitConfig,
|
|
58
|
+
config: Omit<I18nextToolkitConfig, 'plugins'>,
|
|
62
59
|
pluginContext: PluginContext,
|
|
63
|
-
logger: Logger
|
|
60
|
+
logger: Logger,
|
|
61
|
+
hooks?: ASTVisitorHooks
|
|
64
62
|
) {
|
|
65
63
|
this.pluginContext = pluginContext
|
|
66
64
|
this.config = config
|
|
67
65
|
this.logger = logger
|
|
66
|
+
this.hooks = {
|
|
67
|
+
onBeforeVisitNode: hooks?.onBeforeVisitNode,
|
|
68
|
+
onAfterVisitNode: hooks?.onAfterVisitNode
|
|
69
|
+
}
|
|
68
70
|
}
|
|
69
71
|
|
|
70
72
|
/**
|
|
@@ -102,6 +104,8 @@ export class ASTVisitors {
|
|
|
102
104
|
isNewScope = true
|
|
103
105
|
}
|
|
104
106
|
|
|
107
|
+
this.hooks.onBeforeVisitNode?.(node)
|
|
108
|
+
|
|
105
109
|
// --- VISIT LOGIC ---
|
|
106
110
|
// Handle specific node types
|
|
107
111
|
switch (node.type) {
|
|
@@ -115,6 +119,9 @@ export class ASTVisitors {
|
|
|
115
119
|
this.handleJSXElement(node)
|
|
116
120
|
break
|
|
117
121
|
}
|
|
122
|
+
|
|
123
|
+
this.hooks.onAfterVisitNode?.(node)
|
|
124
|
+
|
|
118
125
|
// --- END VISIT LOGIC ---
|
|
119
126
|
|
|
120
127
|
// --- RECURSION ---
|
|
@@ -190,12 +197,21 @@ export class ASTVisitors {
|
|
|
190
197
|
*
|
|
191
198
|
* @private
|
|
192
199
|
*/
|
|
193
|
-
|
|
200
|
+
public getVarFromScope (name: string): ScopeInfo | undefined {
|
|
201
|
+
// First check the proper scope stack (this is the primary source of truth)
|
|
194
202
|
for (let i = this.scopeStack.length - 1; i >= 0; i--) {
|
|
195
203
|
if (this.scopeStack[i].has(name)) {
|
|
196
|
-
|
|
204
|
+
const scopeInfo = this.scopeStack[i].get(name)
|
|
205
|
+
return scopeInfo
|
|
197
206
|
}
|
|
198
207
|
}
|
|
208
|
+
|
|
209
|
+
// Then check the legacy scope tracking for useTranslation calls (for comment parsing)
|
|
210
|
+
const legacyScope = this.scope.get(name)
|
|
211
|
+
if (legacyScope) {
|
|
212
|
+
return legacyScope
|
|
213
|
+
}
|
|
214
|
+
|
|
199
215
|
return undefined
|
|
200
216
|
}
|
|
201
217
|
|
|
@@ -233,6 +249,9 @@ export class ASTVisitors {
|
|
|
233
249
|
const hookConfig = this.getUseTranslationConfig(callee.value)
|
|
234
250
|
if (hookConfig) {
|
|
235
251
|
this.handleUseTranslationDeclarator(node, callExpr, hookConfig)
|
|
252
|
+
|
|
253
|
+
// ALSO store in the legacy scope for comment parsing compatibility
|
|
254
|
+
this.handleUseTranslationForComments(node, callExpr, hookConfig)
|
|
236
255
|
return
|
|
237
256
|
}
|
|
238
257
|
}
|
|
@@ -247,6 +266,84 @@ export class ASTVisitors {
|
|
|
247
266
|
}
|
|
248
267
|
}
|
|
249
268
|
|
|
269
|
+
/**
|
|
270
|
+
* Handles useTranslation calls for comment scope resolution.
|
|
271
|
+
* This is a separate method to store scope info in the legacy scope map
|
|
272
|
+
* that the comment parser can access.
|
|
273
|
+
*
|
|
274
|
+
* @param node - Variable declarator with useTranslation call
|
|
275
|
+
* @param callExpr - The CallExpression node representing the useTranslation invocation
|
|
276
|
+
* @param hookConfig - Configuration describing argument positions for namespace and keyPrefix
|
|
277
|
+
*
|
|
278
|
+
* @private
|
|
279
|
+
*/
|
|
280
|
+
private handleUseTranslationForComments (node: VariableDeclarator, callExpr: CallExpression, hookConfig: UseTranslationHookConfig): void {
|
|
281
|
+
let variableName: string | undefined
|
|
282
|
+
|
|
283
|
+
// Handle simple assignment: let t = useTranslation()
|
|
284
|
+
if (node.id.type === 'Identifier') {
|
|
285
|
+
variableName = node.id.value
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
// Handle array destructuring: const [t, i18n] = useTranslation()
|
|
289
|
+
if (node.id.type === 'ArrayPattern') {
|
|
290
|
+
const firstElement = node.id.elements[0]
|
|
291
|
+
if (firstElement?.type === 'Identifier') {
|
|
292
|
+
variableName = firstElement.value
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
// Handle object destructuring: const { t } or { t: t1 } = useTranslation()
|
|
297
|
+
if (node.id.type === 'ObjectPattern') {
|
|
298
|
+
for (const prop of node.id.properties) {
|
|
299
|
+
if (prop.type === 'AssignmentPatternProperty' && prop.key.type === 'Identifier' && prop.key.value === 't') {
|
|
300
|
+
// This handles { t = defaultT }
|
|
301
|
+
variableName = 't'
|
|
302
|
+
break
|
|
303
|
+
}
|
|
304
|
+
if (prop.type === 'KeyValuePatternProperty' && prop.key.type === 'Identifier' && prop.key.value === 't' && prop.value.type === 'Identifier') {
|
|
305
|
+
// This handles { t: myT }
|
|
306
|
+
variableName = prop.value.value
|
|
307
|
+
break
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
// If we couldn't find a `t` function being declared, exit
|
|
313
|
+
if (!variableName) return
|
|
314
|
+
|
|
315
|
+
// Extract namespace from useTranslation arguments
|
|
316
|
+
const nsArg = callExpr.arguments?.[hookConfig.nsArg]?.expression
|
|
317
|
+
const optionsArg = callExpr.arguments?.[hookConfig.keyPrefixArg]?.expression
|
|
318
|
+
|
|
319
|
+
let defaultNs: string | undefined
|
|
320
|
+
let keyPrefix: string | undefined
|
|
321
|
+
|
|
322
|
+
// Parse namespace argument
|
|
323
|
+
if (nsArg?.type === 'StringLiteral') {
|
|
324
|
+
defaultNs = nsArg.value
|
|
325
|
+
} else if (nsArg?.type === 'ArrayExpression' && nsArg.elements[0]?.expression.type === 'StringLiteral') {
|
|
326
|
+
defaultNs = nsArg.elements[0].expression.value
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
// Parse keyPrefix from options object
|
|
330
|
+
if (optionsArg?.type === 'ObjectExpression') {
|
|
331
|
+
const keyPrefixProp = optionsArg.properties.find(
|
|
332
|
+
prop => prop.type === 'KeyValueProperty' &&
|
|
333
|
+
prop.key.type === 'Identifier' &&
|
|
334
|
+
prop.key.value === 'keyPrefix'
|
|
335
|
+
)
|
|
336
|
+
if (keyPrefixProp?.type === 'KeyValueProperty' && keyPrefixProp.value.type === 'StringLiteral') {
|
|
337
|
+
keyPrefix = keyPrefixProp.value.value
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
// Store in the legacy scope map for comment parsing
|
|
342
|
+
if (defaultNs || keyPrefix) {
|
|
343
|
+
this.scope.set(variableName, { defaultNs, keyPrefix })
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
|
|
250
347
|
/**
|
|
251
348
|
* Processes useTranslation hook declarations to extract scope information.
|
|
252
349
|
*
|
|
@@ -467,7 +564,16 @@ export class ASTVisitors {
|
|
|
467
564
|
const keysWithContext: ExtractedKey[] = []
|
|
468
565
|
|
|
469
566
|
// 1. Handle Context
|
|
470
|
-
if (contextProp?.value?.type === '
|
|
567
|
+
if (contextProp?.value?.type === 'StringLiteral' || contextProp?.value.type === 'NumericLiteral' || contextProp?.value.type === 'BooleanLiteral') {
|
|
568
|
+
// If the context is static, we don't need to add the base key
|
|
569
|
+
const contextValue = `${contextProp.value.value}`
|
|
570
|
+
|
|
571
|
+
const contextSeparator = this.config.extract.contextSeparator ?? '_'
|
|
572
|
+
// Ignore context: ''
|
|
573
|
+
if (contextValue !== '') {
|
|
574
|
+
keysWithContext.push({ key: `${finalKey}${contextSeparator}${contextValue}`, ns, defaultValue: dv })
|
|
575
|
+
}
|
|
576
|
+
} else if (contextProp?.value) {
|
|
471
577
|
const contextValues = this.resolvePossibleStringValues(contextProp.value)
|
|
472
578
|
const contextSeparator = this.config.extract.contextSeparator ?? '_'
|
|
473
579
|
|
|
@@ -478,11 +584,6 @@ export class ASTVisitors {
|
|
|
478
584
|
// For dynamic context, also add the base key as a fallback
|
|
479
585
|
keysWithContext.push({ key: finalKey, ns, defaultValue: dv })
|
|
480
586
|
}
|
|
481
|
-
} else if (contextProp?.value?.type === 'StringLiteral') {
|
|
482
|
-
const contextValue = contextProp.value.value
|
|
483
|
-
|
|
484
|
-
const contextSeparator = this.config.extract.contextSeparator ?? '_'
|
|
485
|
-
keysWithContext.push({ key: `${finalKey}${contextSeparator}${contextValue}`, ns, defaultValue: dv })
|
|
486
587
|
}
|
|
487
588
|
|
|
488
589
|
// 2. Handle Plurals
|
|
@@ -5,9 +5,9 @@ import type { PluginContext, I18nextToolkitConfig } from '../../types'
|
|
|
5
5
|
* Supports extraction from single-line (//) and multi-line comments.
|
|
6
6
|
*
|
|
7
7
|
* @param code - The source code to analyze
|
|
8
|
-
* @param functionNames - Array of function names to look for (e.g., ['t', 'i18n.t'])
|
|
9
8
|
* @param pluginContext - Context object with helper methods to add found keys
|
|
10
9
|
* @param config - Configuration object containing extraction settings
|
|
10
|
+
* @param scopeResolver - Function to resolve scope information for variables (optional)
|
|
11
11
|
*
|
|
12
12
|
* @example
|
|
13
13
|
* ```typescript
|
|
@@ -17,14 +17,15 @@ import type { PluginContext, I18nextToolkitConfig } from '../../types'
|
|
|
17
17
|
* `
|
|
18
18
|
*
|
|
19
19
|
* const context = createPluginContext(allKeys)
|
|
20
|
-
* extractKeysFromComments(code,
|
|
20
|
+
* extractKeysFromComments(code, context, config, scopeResolver)
|
|
21
21
|
* // Extracts: user.name and app.title with their respective settings
|
|
22
22
|
* ```
|
|
23
23
|
*/
|
|
24
24
|
export function extractKeysFromComments (
|
|
25
25
|
code: string,
|
|
26
26
|
pluginContext: PluginContext,
|
|
27
|
-
config: I18nextToolkitConfig
|
|
27
|
+
config: I18nextToolkitConfig,
|
|
28
|
+
scopeResolver?: (varName: string) => { defaultNs?: string; keyPrefix?: string } | undefined
|
|
28
29
|
): void {
|
|
29
30
|
// Hardcode the function name to 't' to prevent parsing other functions like 'test()'.
|
|
30
31
|
const functionNameToFind = 't'
|
|
@@ -42,6 +43,7 @@ export function extractKeysFromComments (
|
|
|
42
43
|
const remainder = text.slice(match.index + match[0].length)
|
|
43
44
|
|
|
44
45
|
const defaultValue = parseDefaultValueFromComment(remainder)
|
|
46
|
+
|
|
45
47
|
// 1. Check for namespace in options object first (e.g., { ns: 'common' })
|
|
46
48
|
ns = parseNsFromComment(remainder)
|
|
47
49
|
|
|
@@ -52,6 +54,17 @@ export function extractKeysFromComments (
|
|
|
52
54
|
ns = parts.shift()
|
|
53
55
|
key = parts.join(nsSeparator)
|
|
54
56
|
}
|
|
57
|
+
|
|
58
|
+
// 3. If no explicit namespace found, try to resolve from scope
|
|
59
|
+
// This allows commented t() calls to inherit namespace from useTranslation scope
|
|
60
|
+
if (!ns && scopeResolver) {
|
|
61
|
+
const scopeInfo = scopeResolver('t')
|
|
62
|
+
if (scopeInfo?.defaultNs) {
|
|
63
|
+
ns = scopeInfo.defaultNs
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// 4. Final fallback to configured default namespace
|
|
55
68
|
if (!ns) ns = config.extract.defaultNS
|
|
56
69
|
|
|
57
70
|
pluginContext.addKey({ key, ns, defaultValue: defaultValue ?? key })
|
|
@@ -158,9 +158,28 @@ export function extractFromTransComponent (node: JSXElement, config: I18nextTool
|
|
|
158
158
|
}
|
|
159
159
|
|
|
160
160
|
let keyExpression: Expression | undefined
|
|
161
|
+
let processedKeyValue: string | undefined
|
|
162
|
+
|
|
161
163
|
if (i18nKeyAttr?.type === 'JSXAttribute') {
|
|
162
164
|
if (i18nKeyAttr.value?.type === 'StringLiteral') {
|
|
163
165
|
keyExpression = i18nKeyAttr.value
|
|
166
|
+
processedKeyValue = keyExpression.value
|
|
167
|
+
|
|
168
|
+
// Handle namespace prefix removal when both ns and i18nKey are provided
|
|
169
|
+
if (ns && keyExpression.type === 'StringLiteral') {
|
|
170
|
+
const nsSeparator = config.extract.nsSeparator ?? ':'
|
|
171
|
+
const keyValue = keyExpression.value
|
|
172
|
+
|
|
173
|
+
// If the key starts with the namespace followed by the separator, remove the prefix
|
|
174
|
+
if (nsSeparator && keyValue.startsWith(`${ns}${nsSeparator}`)) {
|
|
175
|
+
processedKeyValue = keyValue.slice(`${ns}${nsSeparator}`.length)
|
|
176
|
+
// Create a new StringLiteral with the namespace prefix removed
|
|
177
|
+
keyExpression = {
|
|
178
|
+
...keyExpression,
|
|
179
|
+
value: processedKeyValue
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
164
183
|
} else if (
|
|
165
184
|
i18nKeyAttr.value?.type === 'JSXExpressionContainer' &&
|
|
166
185
|
i18nKeyAttr.value.expression.type !== 'JSXEmptyExpression'
|
|
@@ -171,6 +190,14 @@ export function extractFromTransComponent (node: JSXElement, config: I18nextTool
|
|
|
171
190
|
if (!keyExpression) return null
|
|
172
191
|
}
|
|
173
192
|
|
|
193
|
+
// If no explicit defaults provided and we have a processed key, use it as default value
|
|
194
|
+
// This matches the behavior of other similar tests in the codebase
|
|
195
|
+
if (!defaultsAttr && processedKeyValue && !serialized.trim()) {
|
|
196
|
+
defaultValue = processedKeyValue
|
|
197
|
+
} else if (!defaultsAttr && serialized.trim()) {
|
|
198
|
+
defaultValue = serialized
|
|
199
|
+
}
|
|
200
|
+
|
|
174
201
|
return {
|
|
175
202
|
keyExpression,
|
|
176
203
|
serializedChildren: serialized,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ExtractedKey, PluginContext } from '../types'
|
|
1
|
+
import type { ExtractedKey, PluginContext, I18nextToolkitConfig, Logger, Plugin } from '../types'
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Initializes an array of plugins by calling their setup hooks.
|
|
@@ -39,7 +39,12 @@ export async function initializePlugins (plugins: any[]): Promise<void> {
|
|
|
39
39
|
* })
|
|
40
40
|
* ```
|
|
41
41
|
*/
|
|
42
|
-
export function createPluginContext (allKeys: Map<string, ExtractedKey
|
|
42
|
+
export function createPluginContext (allKeys: Map<string, ExtractedKey>, plugins: Plugin[], config: Omit<I18nextToolkitConfig, 'plugins'>, logger: Logger): PluginContext {
|
|
43
|
+
const pluginContextConfig = Object.freeze({
|
|
44
|
+
...config,
|
|
45
|
+
plugins: [...plugins],
|
|
46
|
+
})
|
|
47
|
+
|
|
43
48
|
return {
|
|
44
49
|
addKey: (keyInfo: ExtractedKey) => {
|
|
45
50
|
// Use namespace in the unique map key to avoid collisions across namespaces
|
|
@@ -50,5 +55,9 @@ export function createPluginContext (allKeys: Map<string, ExtractedKey>): Plugin
|
|
|
50
55
|
allKeys.set(uniqueKey, { ...keyInfo, defaultValue })
|
|
51
56
|
}
|
|
52
57
|
},
|
|
58
|
+
config: pluginContextConfig,
|
|
59
|
+
logger,
|
|
60
|
+
// This will be attached later, so we provide a placeholder
|
|
61
|
+
getVarFromScope: () => undefined,
|
|
53
62
|
}
|
|
54
63
|
}
|
package/src/types.ts
CHANGED
|
@@ -363,4 +363,29 @@ export interface PluginContext {
|
|
|
363
363
|
* @param keyInfo - The extracted key information
|
|
364
364
|
*/
|
|
365
365
|
addKey: (keyInfo: ExtractedKey) => void;
|
|
366
|
+
|
|
367
|
+
/** The fully resolved i18next-cli configuration. */
|
|
368
|
+
config: I18nextToolkitConfig;
|
|
369
|
+
|
|
370
|
+
/** The shared logger instance. */
|
|
371
|
+
logger: Logger;
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
|
+
* Retrieves variable information from the current scope chain.
|
|
375
|
+
* Searches from the innermost scope outwards.
|
|
376
|
+
* @param name - The variable name to look up (e.g., 't').
|
|
377
|
+
* @returns Scope information if found, otherwise undefined.
|
|
378
|
+
*/
|
|
379
|
+
getVarFromScope: (name: string) => ScopeInfo | undefined;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* Represents variable scope information tracked during AST traversal.
|
|
384
|
+
* Used to maintain context about translation functions and their configuration.
|
|
385
|
+
*/
|
|
386
|
+
export interface ScopeInfo {
|
|
387
|
+
/** Default namespace for translation calls in this scope */
|
|
388
|
+
defaultNs?: string;
|
|
389
|
+
/** Key prefix to prepend to all translation keys in this scope */
|
|
390
|
+
keyPrefix?: string;
|
|
366
391
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Logger,
|
|
1
|
+
import type { Logger, I18nextToolkitConfig, Plugin, PluginContext } from '../../types';
|
|
2
2
|
import { ASTVisitors } from '../parsers/ast-visitors';
|
|
3
3
|
/**
|
|
4
4
|
* Main extractor function that runs the complete key extraction and file generation process.
|
|
@@ -50,7 +50,7 @@ export declare function runExtractor(config: I18nextToolkitConfig, { isWatchMode
|
|
|
50
50
|
*
|
|
51
51
|
* @internal
|
|
52
52
|
*/
|
|
53
|
-
export declare function processFile(file: string,
|
|
53
|
+
export declare function processFile(file: string, plugins: Plugin[], astVisitors: ASTVisitors, pluginContext: PluginContext, config: Omit<I18nextToolkitConfig, 'plugins'>, logger?: Logger): Promise<void>;
|
|
54
54
|
/**
|
|
55
55
|
* Simplified extraction function that returns translation results without file writing.
|
|
56
56
|
* Used primarily for testing and programmatic access.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extractor.d.ts","sourceRoot":"","sources":["../../../src/extractor/core/extractor.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"extractor.d.ts","sourceRoot":"","sources":["../../../src/extractor/core/extractor.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,MAAM,EAAE,oBAAoB,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAKtF,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAKrD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAsB,YAAY,CAChC,MAAM,EAAE,oBAAoB,EAC5B,EACE,WAAmB,EACnB,QAAgB,EACjB,GAAE;IACD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACf,EACN,MAAM,GAAE,MAA4B,GACnC,OAAO,CAAC,OAAO,CAAC,CAuDlB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,WAAW,CAC/B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EAAE,EACjB,WAAW,EAAE,WAAW,EACxB,aAAa,EAAE,aAAa,EAC5B,MAAM,EAAE,IAAI,CAAC,oBAAoB,EAAE,SAAS,CAAC,EAC7C,MAAM,GAAE,MAA4B,GACnC,OAAO,CAAC,IAAI,CAAC,CAoCf;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,OAAO,CAAE,MAAM,EAAE,oBAAoB,sDAO1D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"key-finder.d.ts","sourceRoot":"","sources":["../../../src/extractor/core/key-finder.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAM7E;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAsB,QAAQ,CAC5B,MAAM,EAAE,oBAAoB,EAC5B,MAAM,GAAE,MAA4B,GACnC,OAAO,CAAC;IAAE,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IAAC,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;CAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"key-finder.d.ts","sourceRoot":"","sources":["../../../src/extractor/core/key-finder.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAM7E;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAsB,QAAQ,CAC5B,MAAM,EAAE,oBAAoB,EAC5B,MAAM,GAAE,MAA4B,GACnC,OAAO,CAAC;IAAE,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IAAC,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;CAAE,CAAC,CA4C1E"}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import type { Module } from '@swc/core';
|
|
2
|
-
import type { PluginContext, I18nextToolkitConfig, Logger } from '../../types';
|
|
1
|
+
import type { Module, Node } from '@swc/core';
|
|
2
|
+
import type { PluginContext, I18nextToolkitConfig, Logger, ScopeInfo } from '../../types';
|
|
3
|
+
export interface ASTVisitorHooks {
|
|
4
|
+
onBeforeVisitNode?: (node: Node) => void;
|
|
5
|
+
onAfterVisitNode?: (node: Node) => void;
|
|
6
|
+
}
|
|
3
7
|
/**
|
|
4
8
|
* AST visitor class that traverses JavaScript/TypeScript syntax trees to extract translation keys.
|
|
5
9
|
*
|
|
@@ -27,7 +31,9 @@ export declare class ASTVisitors {
|
|
|
27
31
|
private readonly config;
|
|
28
32
|
private readonly logger;
|
|
29
33
|
private scopeStack;
|
|
34
|
+
private hooks;
|
|
30
35
|
objectKeys: Set<string>;
|
|
36
|
+
private scope;
|
|
31
37
|
/**
|
|
32
38
|
* Creates a new AST visitor instance.
|
|
33
39
|
*
|
|
@@ -35,7 +41,7 @@ export declare class ASTVisitors {
|
|
|
35
41
|
* @param pluginContext - Context for adding discovered translation keys
|
|
36
42
|
* @param logger - Logger for warnings and debug information
|
|
37
43
|
*/
|
|
38
|
-
constructor(config: I18nextToolkitConfig, pluginContext: PluginContext, logger: Logger);
|
|
44
|
+
constructor(config: Omit<I18nextToolkitConfig, 'plugins'>, pluginContext: PluginContext, logger: Logger, hooks?: ASTVisitorHooks);
|
|
39
45
|
/**
|
|
40
46
|
* Main entry point for AST traversal.
|
|
41
47
|
* Creates a root scope and begins the recursive walk through the syntax tree.
|
|
@@ -90,7 +96,7 @@ export declare class ASTVisitors {
|
|
|
90
96
|
*
|
|
91
97
|
* @private
|
|
92
98
|
*/
|
|
93
|
-
|
|
99
|
+
getVarFromScope(name: string): ScopeInfo | undefined;
|
|
94
100
|
/**
|
|
95
101
|
* Handles variable declarations that might define translation functions.
|
|
96
102
|
*
|
|
@@ -105,6 +111,18 @@ export declare class ASTVisitors {
|
|
|
105
111
|
* @private
|
|
106
112
|
*/
|
|
107
113
|
private handleVariableDeclarator;
|
|
114
|
+
/**
|
|
115
|
+
* Handles useTranslation calls for comment scope resolution.
|
|
116
|
+
* This is a separate method to store scope info in the legacy scope map
|
|
117
|
+
* that the comment parser can access.
|
|
118
|
+
*
|
|
119
|
+
* @param node - Variable declarator with useTranslation call
|
|
120
|
+
* @param callExpr - The CallExpression node representing the useTranslation invocation
|
|
121
|
+
* @param hookConfig - Configuration describing argument positions for namespace and keyPrefix
|
|
122
|
+
*
|
|
123
|
+
* @private
|
|
124
|
+
*/
|
|
125
|
+
private handleUseTranslationForComments;
|
|
108
126
|
/**
|
|
109
127
|
* Processes useTranslation hook declarations to extract scope information.
|
|
110
128
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ast-visitors.d.ts","sourceRoot":"","sources":["../../../src/extractor/parsers/ast-visitors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"ast-visitors.d.ts","sourceRoot":"","sources":["../../../src/extractor/parsers/ast-visitors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,IAAI,EAA0H,MAAM,WAAW,CAAA;AACrK,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,EAAgB,SAAS,EAA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AAoB;IAoK5B;;;;;;OAMG;IACH,OAAO,CAAC,4BAA4B;IA8BpC;;;;;;;;;;;;;OAaG;IACH,OAAO,CAAC,gBAAgB;IA4DxB;;;;;;;;OAQG;IACH,OAAO,CAAC,sBAAsB;IAkB9B;;;;;;;;;OASG;IACH,OAAO,CAAC,gBAAgB;IA4IxB;;;;;;;;;;OAUG;IACH,OAAO,CAAC,0BAA0B;IA6DlC;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,cAAc;IAgBtB;;;;;;;;;;;;;;;OAeG;IACH,OAAO,CAAC,sBAAsB;IA2C9B;;;;;;;;;;;;;;;;OAgBG;IACH,OAAO,CAAC,2BAA2B;IA4BnC;;;;;;;OAOG;IACH,OAAO,CAAC,6CAA6C;IAyBrD;;;;;;OAMG;IACH,OAAO,CAAC,uBAAuB;IAoB/B;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACH,OAAO,CAAC,eAAe;CA2BxB"}
|
|
@@ -4,9 +4,9 @@ import type { PluginContext, I18nextToolkitConfig } from '../../types';
|
|
|
4
4
|
* Supports extraction from single-line (//) and multi-line comments.
|
|
5
5
|
*
|
|
6
6
|
* @param code - The source code to analyze
|
|
7
|
-
* @param functionNames - Array of function names to look for (e.g., ['t', 'i18n.t'])
|
|
8
7
|
* @param pluginContext - Context object with helper methods to add found keys
|
|
9
8
|
* @param config - Configuration object containing extraction settings
|
|
9
|
+
* @param scopeResolver - Function to resolve scope information for variables (optional)
|
|
10
10
|
*
|
|
11
11
|
* @example
|
|
12
12
|
* ```typescript
|
|
@@ -16,9 +16,12 @@ import type { PluginContext, I18nextToolkitConfig } from '../../types';
|
|
|
16
16
|
* `
|
|
17
17
|
*
|
|
18
18
|
* const context = createPluginContext(allKeys)
|
|
19
|
-
* extractKeysFromComments(code,
|
|
19
|
+
* extractKeysFromComments(code, context, config, scopeResolver)
|
|
20
20
|
* // Extracts: user.name and app.title with their respective settings
|
|
21
21
|
* ```
|
|
22
22
|
*/
|
|
23
|
-
export declare function extractKeysFromComments(code: string, pluginContext: PluginContext, config: I18nextToolkitConfig
|
|
23
|
+
export declare function extractKeysFromComments(code: string, pluginContext: PluginContext, config: I18nextToolkitConfig, scopeResolver?: (varName: string) => {
|
|
24
|
+
defaultNs?: string;
|
|
25
|
+
keyPrefix?: string;
|
|
26
|
+
} | undefined): void;
|
|
24
27
|
//# sourceMappingURL=comment-parser.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"comment-parser.d.ts","sourceRoot":"","sources":["../../../src/extractor/parsers/comment-parser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAEtE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,MAAM,EACZ,aAAa,EAAE,aAAa,EAC5B,MAAM,EAAE,oBAAoB,
|
|
1
|
+
{"version":3,"file":"comment-parser.d.ts","sourceRoot":"","sources":["../../../src/extractor/parsers/comment-parser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAEtE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,MAAM,EACZ,aAAa,EAAE,aAAa,EAC5B,MAAM,EAAE,oBAAoB,EAC5B,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,GAC1F,IAAI,CA4CN"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsx-parser.d.ts","sourceRoot":"","sources":["../../../src/extractor/parsers/jsx-parser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,gBAAgB,EAAY,MAAM,WAAW,C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IAEpB,8EAA8E;IAC9E,WAAW,CAAC,EAAE,gBAAgB,CAAC;IAE/B,mDAAmD;IACnD,iBAAiB,CAAC,EAAE,UAAU,CAAC;CAChC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,yBAAyB,CAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,oBAAoB,GAAG,sBAAsB,GAAG,IAAI,CAoJxH"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ExtractedKey, PluginContext } from '../types';
|
|
1
|
+
import type { ExtractedKey, PluginContext, I18nextToolkitConfig, Logger, Plugin } from '../types';
|
|
2
2
|
/**
|
|
3
3
|
* Initializes an array of plugins by calling their setup hooks.
|
|
4
4
|
* This function should be called before starting the extraction process.
|
|
@@ -33,5 +33,5 @@ export declare function initializePlugins(plugins: any[]): Promise<void>;
|
|
|
33
33
|
* })
|
|
34
34
|
* ```
|
|
35
35
|
*/
|
|
36
|
-
export declare function createPluginContext(allKeys: Map<string, ExtractedKey
|
|
36
|
+
export declare function createPluginContext(allKeys: Map<string, ExtractedKey>, plugins: Plugin[], config: Omit<I18nextToolkitConfig, 'plugins'>, logger: Logger): PluginContext;
|
|
37
37
|
//# sourceMappingURL=plugin-manager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-manager.d.ts","sourceRoot":"","sources":["../../src/extractor/plugin-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"plugin-manager.d.ts","sourceRoot":"","sources":["../../src/extractor/plugin-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAEjG;;;;;;;;;;;;GAYG;AACH,wBAAsB,iBAAiB,CAAE,OAAO,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAItE;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,mBAAmB,CAAE,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,oBAAoB,EAAE,SAAS,CAAC,EAAE,MAAM,EAAE,MAAM,GAAG,aAAa,CAqBxK"}
|
package/types/types.d.ts
CHANGED
|
@@ -309,5 +309,26 @@ export interface PluginContext {
|
|
|
309
309
|
* @param keyInfo - The extracted key information
|
|
310
310
|
*/
|
|
311
311
|
addKey: (keyInfo: ExtractedKey) => void;
|
|
312
|
+
/** The fully resolved i18next-cli configuration. */
|
|
313
|
+
config: I18nextToolkitConfig;
|
|
314
|
+
/** The shared logger instance. */
|
|
315
|
+
logger: Logger;
|
|
316
|
+
/**
|
|
317
|
+
* Retrieves variable information from the current scope chain.
|
|
318
|
+
* Searches from the innermost scope outwards.
|
|
319
|
+
* @param name - The variable name to look up (e.g., 't').
|
|
320
|
+
* @returns Scope information if found, otherwise undefined.
|
|
321
|
+
*/
|
|
322
|
+
getVarFromScope: (name: string) => ScopeInfo | undefined;
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Represents variable scope information tracked during AST traversal.
|
|
326
|
+
* Used to maintain context about translation functions and their configuration.
|
|
327
|
+
*/
|
|
328
|
+
export interface ScopeInfo {
|
|
329
|
+
/** Default namespace for translation calls in this scope */
|
|
330
|
+
defaultNs?: string;
|
|
331
|
+
/** Key prefix to prepend to all translation keys in this scope */
|
|
332
|
+
keyPrefix?: string;
|
|
312
333
|
}
|
|
313
334
|
//# sourceMappingURL=types.d.ts.map
|
package/types/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,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