i18next-cli 1.75.2 → 1.75.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/dist/cjs/cli.js +1 -1
- package/dist/cjs/extractor/parsers/call-expression-handler.js +4 -7
- package/dist/cjs/extractor/parsers/expression-resolver.js +26 -5
- package/dist/esm/cli.js +1 -1
- package/dist/esm/extractor/parsers/call-expression-handler.js +4 -7
- package/dist/esm/extractor/parsers/expression-resolver.js +26 -5
- package/package.json +1 -1
- package/types/extractor/parsers/call-expression-handler.d.ts.map +1 -1
- package/types/extractor/parsers/expression-resolver.d.ts +5 -1
- package/types/extractor/parsers/expression-resolver.d.ts.map +1 -1
package/dist/cjs/cli.js
CHANGED
|
@@ -37,7 +37,7 @@ const program = new commander.Command();
|
|
|
37
37
|
program
|
|
38
38
|
.name('i18next-cli')
|
|
39
39
|
.description('A unified, high-performance i18next CLI.')
|
|
40
|
-
.version('1.75.
|
|
40
|
+
.version('1.75.3') // This string is replaced with the actual version at build time by rollup
|
|
41
41
|
.addHelpText('after', '\nUsing an AI coding agent? Install the i18next-localization skill: npx skills add i18next/i18next-cli\n');
|
|
42
42
|
// new: global config override option
|
|
43
43
|
program.option('-c, --config <path>', 'Path to i18next-cli config file (overrides detection)');
|
|
@@ -184,11 +184,11 @@ class CallExpressionHandler {
|
|
|
184
184
|
}
|
|
185
185
|
let defaultValue;
|
|
186
186
|
let options;
|
|
187
|
+
// Options inline or in a variable: `t('key', { count })`, `t('key', params)` (#307)
|
|
187
188
|
if (node.arguments.length > 1) {
|
|
188
189
|
const arg2 = astUtils.unwrapParens(node.arguments[1].expression);
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
}
|
|
190
|
+
options = this.expressionResolver.objectLiteralOf(arg2);
|
|
191
|
+
if (options) ;
|
|
192
192
|
else if (arg2.type === 'StringLiteral') {
|
|
193
193
|
defaultValue = arg2.value;
|
|
194
194
|
}
|
|
@@ -200,10 +200,7 @@ class CallExpressionHandler {
|
|
|
200
200
|
}
|
|
201
201
|
}
|
|
202
202
|
if (node.arguments.length > 2) {
|
|
203
|
-
|
|
204
|
-
if (arg3.type === 'ObjectExpression') {
|
|
205
|
-
options = arg3;
|
|
206
|
-
}
|
|
203
|
+
options = this.expressionResolver.objectLiteralOf(node.arguments[2].expression) ?? options;
|
|
207
204
|
}
|
|
208
205
|
const defaultValueFromOptions = options ? this.getDefaultValueProp(options, 'defaultValue') : undefined;
|
|
209
206
|
const finalDefaultValue = (typeof defaultValueFromOptions === 'string' ? defaultValueFromOptions : defaultValue);
|
|
@@ -83,10 +83,10 @@ class ModuleTable extends Map {
|
|
|
83
83
|
if (value !== undefined)
|
|
84
84
|
return value;
|
|
85
85
|
}
|
|
86
|
-
return
|
|
86
|
+
return undefined;
|
|
87
87
|
}
|
|
88
88
|
has(name) {
|
|
89
|
-
return this.scope.keysOf(name).some(key => super.has(key))
|
|
89
|
+
return this.scope.keysOf(name).some(key => super.has(key));
|
|
90
90
|
}
|
|
91
91
|
set(name, value) {
|
|
92
92
|
const key = this.scope.declaringKey(name);
|
|
@@ -185,6 +185,9 @@ class ExpressionResolver {
|
|
|
185
185
|
// Per-file identifiers holding an object type, from their annotation or from the
|
|
186
186
|
// function they were initialised by: `const animal = getAnimal()` -> { animal: { type: [...] } }
|
|
187
187
|
objectVariables = new Map();
|
|
188
|
+
// Per-file object literals by variable, so `const params = { count }; t('key', params)`
|
|
189
|
+
// reads its options like an inline object (#307)
|
|
190
|
+
objectLiterals = new Map();
|
|
188
191
|
// Set while the pre-scan runs. Captures that read other declarations queue a
|
|
189
192
|
// replay here, because what they read may be declared in a file scanned later.
|
|
190
193
|
recording = false;
|
|
@@ -204,6 +207,8 @@ class ExpressionResolver {
|
|
|
204
207
|
fileImports = new Map();
|
|
205
208
|
// module -> namespace import's local name -> the import's resolved path
|
|
206
209
|
fileNamespaces = new Map();
|
|
210
|
+
// module -> the variables it declares, which shadow the same names declared in other files
|
|
211
|
+
fileVariables = new Map();
|
|
207
212
|
// tsconfig `paths`, `@api` -> `/abs/src/api`
|
|
208
213
|
pathAliases = {};
|
|
209
214
|
constructor(hooks) {
|
|
@@ -232,16 +237,18 @@ class ExpressionResolver {
|
|
|
232
237
|
}
|
|
233
238
|
// ModuleTable: the keys `name` read in the current file may be stored under, most specific first
|
|
234
239
|
keysOf(name) {
|
|
235
|
-
if (name.includes('#'))
|
|
240
|
+
if (name.includes('#') || !this.currentModule)
|
|
236
241
|
return [name];
|
|
237
|
-
if (!this.currentModule)
|
|
238
|
-
return [];
|
|
239
242
|
const keys = [];
|
|
240
243
|
const imported = this.fileImports.get(this.currentModule)?.get(name);
|
|
241
244
|
const module = imported && this.moduleOf(imported.from);
|
|
242
245
|
if (module)
|
|
243
246
|
keys.push(`${module}#${imported.name}`);
|
|
244
247
|
keys.push(`${this.currentModule}#${name}`);
|
|
248
|
+
// A variable of this file never means another file's same-named one, even when its own
|
|
249
|
+
// value isn't captured (`const params = { count }` vs another file's `params` array) (#307)
|
|
250
|
+
if (!this.fileVariables.get(this.currentModule)?.has(name))
|
|
251
|
+
keys.push(name);
|
|
245
252
|
return keys;
|
|
246
253
|
}
|
|
247
254
|
// ModuleTable: the key a declaration made in the current file is also stored under
|
|
@@ -287,6 +294,7 @@ class ExpressionResolver {
|
|
|
287
294
|
this.temporaryVariables.clear();
|
|
288
295
|
this.arrayElementMembers.clear();
|
|
289
296
|
this.objectVariables.clear();
|
|
297
|
+
this.objectLiterals.clear();
|
|
290
298
|
}
|
|
291
299
|
/**
|
|
292
300
|
* Call once every file has been pre-scanned. Captures ran in file order, so one
|
|
@@ -402,6 +410,11 @@ class ExpressionResolver {
|
|
|
402
410
|
if (node.id.type !== 'Identifier')
|
|
403
411
|
return;
|
|
404
412
|
const name = node.id.value;
|
|
413
|
+
if (this.currentModule) {
|
|
414
|
+
if (!this.fileVariables.has(this.currentModule))
|
|
415
|
+
this.fileVariables.set(this.currentModule, new Set());
|
|
416
|
+
this.fileVariables.get(this.currentModule).add(name);
|
|
417
|
+
}
|
|
405
418
|
// `const items: IProps[] = …` → remember the element's member map so
|
|
406
419
|
// `items.map(({ size }) => …)` can bind the callback parameter.
|
|
407
420
|
const idTypeAnnotation = this.extractTypeAnnotation(node.id);
|
|
@@ -436,6 +449,7 @@ class ExpressionResolver {
|
|
|
436
449
|
const unwrappedInit = unwrapExpr(init);
|
|
437
450
|
// ObjectExpression -> map of string props
|
|
438
451
|
if (unwrappedInit.type === 'ObjectExpression' && Array.isArray(unwrappedInit.properties)) {
|
|
452
|
+
this.objectLiterals.set(name, unwrappedInit);
|
|
439
453
|
const map = {};
|
|
440
454
|
for (const p of unwrappedInit.properties) {
|
|
441
455
|
if (!p || p.type !== 'KeyValueProperty')
|
|
@@ -1105,6 +1119,13 @@ class ExpressionResolver {
|
|
|
1105
1119
|
return v;
|
|
1106
1120
|
return this.sharedVariableTable.get(name);
|
|
1107
1121
|
}
|
|
1122
|
+
/** The object literal `expr` is, inline or through a variable of this file, or undefined. */
|
|
1123
|
+
objectLiteralOf(expr) {
|
|
1124
|
+
expr = unwrapExpr(expr);
|
|
1125
|
+
if (expr?.type === 'ObjectExpression')
|
|
1126
|
+
return expr;
|
|
1127
|
+
return expr?.type === 'Identifier' ? this.objectLiterals.get(expr.value) : undefined;
|
|
1128
|
+
}
|
|
1108
1129
|
/**
|
|
1109
1130
|
* Return the as-const object map stored for a variable name.
|
|
1110
1131
|
* Returns undefined if the name is not a known object map.
|
package/dist/esm/cli.js
CHANGED
|
@@ -31,7 +31,7 @@ const program = new Command();
|
|
|
31
31
|
program
|
|
32
32
|
.name('i18next-cli')
|
|
33
33
|
.description('A unified, high-performance i18next CLI.')
|
|
34
|
-
.version('1.75.
|
|
34
|
+
.version('1.75.3') // This string is replaced with the actual version at build time by rollup
|
|
35
35
|
.addHelpText('after', '\nUsing an AI coding agent? Install the i18next-localization skill: npx skills add i18next/i18next-cli\n');
|
|
36
36
|
// new: global config override option
|
|
37
37
|
program.option('-c, --config <path>', 'Path to i18next-cli config file (overrides detection)');
|
|
@@ -182,11 +182,11 @@ class CallExpressionHandler {
|
|
|
182
182
|
}
|
|
183
183
|
let defaultValue;
|
|
184
184
|
let options;
|
|
185
|
+
// Options inline or in a variable: `t('key', { count })`, `t('key', params)` (#307)
|
|
185
186
|
if (node.arguments.length > 1) {
|
|
186
187
|
const arg2 = unwrapParens(node.arguments[1].expression);
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
}
|
|
188
|
+
options = this.expressionResolver.objectLiteralOf(arg2);
|
|
189
|
+
if (options) ;
|
|
190
190
|
else if (arg2.type === 'StringLiteral') {
|
|
191
191
|
defaultValue = arg2.value;
|
|
192
192
|
}
|
|
@@ -198,10 +198,7 @@ class CallExpressionHandler {
|
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
200
|
if (node.arguments.length > 2) {
|
|
201
|
-
|
|
202
|
-
if (arg3.type === 'ObjectExpression') {
|
|
203
|
-
options = arg3;
|
|
204
|
-
}
|
|
201
|
+
options = this.expressionResolver.objectLiteralOf(node.arguments[2].expression) ?? options;
|
|
205
202
|
}
|
|
206
203
|
const defaultValueFromOptions = options ? this.getDefaultValueProp(options, 'defaultValue') : undefined;
|
|
207
204
|
const finalDefaultValue = (typeof defaultValueFromOptions === 'string' ? defaultValueFromOptions : defaultValue);
|
|
@@ -81,10 +81,10 @@ class ModuleTable extends Map {
|
|
|
81
81
|
if (value !== undefined)
|
|
82
82
|
return value;
|
|
83
83
|
}
|
|
84
|
-
return
|
|
84
|
+
return undefined;
|
|
85
85
|
}
|
|
86
86
|
has(name) {
|
|
87
|
-
return this.scope.keysOf(name).some(key => super.has(key))
|
|
87
|
+
return this.scope.keysOf(name).some(key => super.has(key));
|
|
88
88
|
}
|
|
89
89
|
set(name, value) {
|
|
90
90
|
const key = this.scope.declaringKey(name);
|
|
@@ -183,6 +183,9 @@ class ExpressionResolver {
|
|
|
183
183
|
// Per-file identifiers holding an object type, from their annotation or from the
|
|
184
184
|
// function they were initialised by: `const animal = getAnimal()` -> { animal: { type: [...] } }
|
|
185
185
|
objectVariables = new Map();
|
|
186
|
+
// Per-file object literals by variable, so `const params = { count }; t('key', params)`
|
|
187
|
+
// reads its options like an inline object (#307)
|
|
188
|
+
objectLiterals = new Map();
|
|
186
189
|
// Set while the pre-scan runs. Captures that read other declarations queue a
|
|
187
190
|
// replay here, because what they read may be declared in a file scanned later.
|
|
188
191
|
recording = false;
|
|
@@ -202,6 +205,8 @@ class ExpressionResolver {
|
|
|
202
205
|
fileImports = new Map();
|
|
203
206
|
// module -> namespace import's local name -> the import's resolved path
|
|
204
207
|
fileNamespaces = new Map();
|
|
208
|
+
// module -> the variables it declares, which shadow the same names declared in other files
|
|
209
|
+
fileVariables = new Map();
|
|
205
210
|
// tsconfig `paths`, `@api` -> `/abs/src/api`
|
|
206
211
|
pathAliases = {};
|
|
207
212
|
constructor(hooks) {
|
|
@@ -230,16 +235,18 @@ class ExpressionResolver {
|
|
|
230
235
|
}
|
|
231
236
|
// ModuleTable: the keys `name` read in the current file may be stored under, most specific first
|
|
232
237
|
keysOf(name) {
|
|
233
|
-
if (name.includes('#'))
|
|
238
|
+
if (name.includes('#') || !this.currentModule)
|
|
234
239
|
return [name];
|
|
235
|
-
if (!this.currentModule)
|
|
236
|
-
return [];
|
|
237
240
|
const keys = [];
|
|
238
241
|
const imported = this.fileImports.get(this.currentModule)?.get(name);
|
|
239
242
|
const module = imported && this.moduleOf(imported.from);
|
|
240
243
|
if (module)
|
|
241
244
|
keys.push(`${module}#${imported.name}`);
|
|
242
245
|
keys.push(`${this.currentModule}#${name}`);
|
|
246
|
+
// A variable of this file never means another file's same-named one, even when its own
|
|
247
|
+
// value isn't captured (`const params = { count }` vs another file's `params` array) (#307)
|
|
248
|
+
if (!this.fileVariables.get(this.currentModule)?.has(name))
|
|
249
|
+
keys.push(name);
|
|
243
250
|
return keys;
|
|
244
251
|
}
|
|
245
252
|
// ModuleTable: the key a declaration made in the current file is also stored under
|
|
@@ -285,6 +292,7 @@ class ExpressionResolver {
|
|
|
285
292
|
this.temporaryVariables.clear();
|
|
286
293
|
this.arrayElementMembers.clear();
|
|
287
294
|
this.objectVariables.clear();
|
|
295
|
+
this.objectLiterals.clear();
|
|
288
296
|
}
|
|
289
297
|
/**
|
|
290
298
|
* Call once every file has been pre-scanned. Captures ran in file order, so one
|
|
@@ -400,6 +408,11 @@ class ExpressionResolver {
|
|
|
400
408
|
if (node.id.type !== 'Identifier')
|
|
401
409
|
return;
|
|
402
410
|
const name = node.id.value;
|
|
411
|
+
if (this.currentModule) {
|
|
412
|
+
if (!this.fileVariables.has(this.currentModule))
|
|
413
|
+
this.fileVariables.set(this.currentModule, new Set());
|
|
414
|
+
this.fileVariables.get(this.currentModule).add(name);
|
|
415
|
+
}
|
|
403
416
|
// `const items: IProps[] = …` → remember the element's member map so
|
|
404
417
|
// `items.map(({ size }) => …)` can bind the callback parameter.
|
|
405
418
|
const idTypeAnnotation = this.extractTypeAnnotation(node.id);
|
|
@@ -434,6 +447,7 @@ class ExpressionResolver {
|
|
|
434
447
|
const unwrappedInit = unwrapExpr(init);
|
|
435
448
|
// ObjectExpression -> map of string props
|
|
436
449
|
if (unwrappedInit.type === 'ObjectExpression' && Array.isArray(unwrappedInit.properties)) {
|
|
450
|
+
this.objectLiterals.set(name, unwrappedInit);
|
|
437
451
|
const map = {};
|
|
438
452
|
for (const p of unwrappedInit.properties) {
|
|
439
453
|
if (!p || p.type !== 'KeyValueProperty')
|
|
@@ -1103,6 +1117,13 @@ class ExpressionResolver {
|
|
|
1103
1117
|
return v;
|
|
1104
1118
|
return this.sharedVariableTable.get(name);
|
|
1105
1119
|
}
|
|
1120
|
+
/** The object literal `expr` is, inline or through a variable of this file, or undefined. */
|
|
1121
|
+
objectLiteralOf(expr) {
|
|
1122
|
+
expr = unwrapExpr(expr);
|
|
1123
|
+
if (expr?.type === 'ObjectExpression')
|
|
1124
|
+
return expr;
|
|
1125
|
+
return expr?.type === 'Identifier' ? this.objectLiterals.get(expr.value) : undefined;
|
|
1126
|
+
}
|
|
1106
1127
|
/**
|
|
1107
1128
|
* Return the as-const object map stored for a variable name.
|
|
1108
1129
|
* Returns undefined if the name is not a known object map.
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"call-expression-handler.d.ts","sourceRoot":"","sources":["../../../src/extractor/parsers/call-expression-handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAyD,MAAM,WAAW,CAAA;AACtG,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,EAAgB,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1G,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAc7D;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,sBAAsB,CAAE,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,GAAG,SAAS,EAAE,MAAM,EAAE,IAAI,CAAC,oBAAoB,EAAE,SAAS,GAAG,OAAO,CAAC,GAAG,MAAM,CAyBtJ;AAED,qBAAa,qBAAqB;IAChC,OAAO,CAAC,aAAa,CAAe;IACpC,OAAO,CAAC,MAAM,CAAuC;IACrD,OAAO,CAAC,MAAM,CAAQ;IACtB,OAAO,CAAC,kBAAkB,CAAoB;IACvC,UAAU,cAAoB;IACrC,OAAO,CAAC,cAAc,CAAc;IACpC,OAAO,CAAC,cAAc,CAAc;IACpC,OAAO,CAAC,iBAAiB,CAAsC;gBAG7D,MAAM,EAAE,IAAI,CAAC,oBAAoB,EAAE,SAAS,CAAC,EAC7C,aAAa,EAAE,aAAa,EAC5B,MAAM,EAAE,MAAM,EACd,kBAAkB,EAAE,kBAAkB,EACtC,cAAc,EAAE,MAAM,MAAM,EAC5B,cAAc,EAAE,MAAM,MAAM,EAC5B,iBAAiB,GAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,SAA2B;IAW3E;;;OAGG;IACH,OAAO,CAAC,mBAAmB,CAG1B;IAED,uGAAuG;IACvG,OAAO,CAAC,mBAAmB;IAI3B;;;;;OAKG;IACH,OAAO,CAAC,mBAAmB;IAiB3B;;;;;;;;;;;;;;OAcG;IACH,oBAAoB,CAAE,IAAI,EAAE,cAAc,EAAE,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,SAAS,GAAG,SAAS,GAAG,IAAI;IA8CxG,OAAO,CAAC,eAAe;
|
|
1
|
+
{"version":3,"file":"call-expression-handler.d.ts","sourceRoot":"","sources":["../../../src/extractor/parsers/call-expression-handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAyD,MAAM,WAAW,CAAA;AACtG,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,EAAgB,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1G,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAc7D;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,sBAAsB,CAAE,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,GAAG,SAAS,EAAE,MAAM,EAAE,IAAI,CAAC,oBAAoB,EAAE,SAAS,GAAG,OAAO,CAAC,GAAG,MAAM,CAyBtJ;AAED,qBAAa,qBAAqB;IAChC,OAAO,CAAC,aAAa,CAAe;IACpC,OAAO,CAAC,MAAM,CAAuC;IACrD,OAAO,CAAC,MAAM,CAAQ;IACtB,OAAO,CAAC,kBAAkB,CAAoB;IACvC,UAAU,cAAoB;IACrC,OAAO,CAAC,cAAc,CAAc;IACpC,OAAO,CAAC,cAAc,CAAc;IACpC,OAAO,CAAC,iBAAiB,CAAsC;gBAG7D,MAAM,EAAE,IAAI,CAAC,oBAAoB,EAAE,SAAS,CAAC,EAC7C,aAAa,EAAE,aAAa,EAC5B,MAAM,EAAE,MAAM,EACd,kBAAkB,EAAE,kBAAkB,EACtC,cAAc,EAAE,MAAM,MAAM,EAC5B,cAAc,EAAE,MAAM,MAAM,EAC5B,iBAAiB,GAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,SAA2B;IAW3E;;;OAGG;IACH,OAAO,CAAC,mBAAmB,CAG1B;IAED,uGAAuG;IACvG,OAAO,CAAC,mBAAmB;IAI3B;;;;;OAKG;IACH,OAAO,CAAC,mBAAmB;IAiB3B;;;;;;;;;;;;;;OAcG;IACH,oBAAoB,CAAE,IAAI,EAAE,cAAc,EAAE,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,SAAS,GAAG,SAAS,GAAG,IAAI;IA8CxG,OAAO,CAAC,eAAe;IAyXvB;;;;OAIG;IACH,OAAO,CAAC,iBAAiB;IAmBzB,OAAO,CAAC,wBAAwB;IAyEhC;;;;;;OAMG;IACH,OAAO,CAAC,4BAA4B;IAsDpC;;;;;;;;;;;;;;;;OAgBG;IACH,OAAO,CAAC,uBAAuB;IAiB/B;;;;;;;;OAQG;IACH,OAAO,CAAC,iCAAiC;IAwFzC;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,gBAAgB;IAyMxB;;;;;;;;;OASG;IACH,OAAO,CAAC,eAAe;CA2BxB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Expression } from '@swc/core';
|
|
1
|
+
import type { Expression, ObjectExpression } from '@swc/core';
|
|
2
2
|
import type { ASTVisitorHooks } from '../../types.js';
|
|
3
3
|
export declare const nestedMembers: (members: Record<string, string[]> | undefined, name: string) => Record<string, string[]> | undefined;
|
|
4
4
|
export declare class ExpressionResolver {
|
|
@@ -21,6 +21,7 @@ export declare class ExpressionResolver {
|
|
|
21
21
|
private typeParamBindings;
|
|
22
22
|
private sharedFunctionReturnMembers;
|
|
23
23
|
private objectVariables;
|
|
24
|
+
private objectLiterals;
|
|
24
25
|
recording: boolean;
|
|
25
26
|
private replays;
|
|
26
27
|
private replaying;
|
|
@@ -31,6 +32,7 @@ export declare class ExpressionResolver {
|
|
|
31
32
|
private knownModules;
|
|
32
33
|
private fileImports;
|
|
33
34
|
private fileNamespaces;
|
|
35
|
+
private fileVariables;
|
|
34
36
|
pathAliases: Record<string, string>;
|
|
35
37
|
constructor(hooks: ASTVisitorHooks);
|
|
36
38
|
setCurrentFile(file: string): void;
|
|
@@ -230,6 +232,8 @@ export declare class ExpressionResolver {
|
|
|
230
232
|
* Returns undefined if the name is not a known string array.
|
|
231
233
|
*/
|
|
232
234
|
getVariableValues(name: string): string[] | undefined;
|
|
235
|
+
/** The object literal `expr` is, inline or through a variable of this file, or undefined. */
|
|
236
|
+
objectLiteralOf(expr: any): ObjectExpression | undefined;
|
|
233
237
|
/**
|
|
234
238
|
* Return the as-const object map stored for a variable name.
|
|
235
239
|
* Returns undefined if the name is not a known object map.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expression-resolver.d.ts","sourceRoot":"","sources":["../../../src/extractor/parsers/expression-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAkD,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"expression-resolver.d.ts","sourceRoot":"","sources":["../../../src/extractor/parsers/expression-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAkD,MAAM,WAAW,CAAA;AAC7G,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AA2BrD,eAAO,MAAM,aAAa,GAAI,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,SAAS,EAAE,MAAM,MAAM,KAAG,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,SAetH,CAAA;AAyFD,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,KAAK,CAAiB;IAK9B,OAAO,CAAC,aAAa,CAA4D;IAGjF,OAAO,CAAC,eAAe,CAA6D;IAIpF,OAAO,CAAC,cAAc,CAAmC;IAIzD,OAAO,CAAC,mBAAmB,CAA+C;IAI1E,OAAO,CA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