i18next-cli 1.71.0 → 1.71.2
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/core/ast-visitors.js +27 -9
- package/dist/cjs/extractor/core/translation-manager.js +46 -7
- package/dist/esm/cli.js +1 -1
- package/dist/esm/extractor/core/ast-visitors.js +27 -9
- package/dist/esm/extractor/core/translation-manager.js +46 -7
- package/package.json +9 -9
- package/types/extractor/core/ast-visitors.d.ts +3 -2
- package/types/extractor/core/ast-visitors.d.ts.map +1 -1
- package/types/extractor/core/translation-manager.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.71.
|
|
40
|
+
.version('1.71.2'); // This string is replaced with the actual version at build time by rollup
|
|
41
41
|
// new: global config override option
|
|
42
42
|
program.option('-c, --config <path>', 'Path to i18next-cli config file (overrides detection)');
|
|
43
43
|
program
|
|
@@ -5,6 +5,21 @@ var expressionResolver = require('../parsers/expression-resolver.js');
|
|
|
5
5
|
var callExpressionHandler = require('../parsers/call-expression-handler.js');
|
|
6
6
|
var jsxHandler = require('../parsers/jsx-handler.js');
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Array iteration methods whose callback we can bind, mapped to the position of
|
|
10
|
+
* the *element* parameter: `map(el, i)` → 0, `reduce((acc, el) => …)` → 1.
|
|
11
|
+
*/
|
|
12
|
+
const ITERATION_METHODS = {
|
|
13
|
+
map: 0,
|
|
14
|
+
forEach: 0,
|
|
15
|
+
flatMap: 0,
|
|
16
|
+
filter: 0,
|
|
17
|
+
find: 0,
|
|
18
|
+
some: 0,
|
|
19
|
+
every: 0,
|
|
20
|
+
reduce: 1,
|
|
21
|
+
reduceRight: 1,
|
|
22
|
+
};
|
|
8
23
|
/**
|
|
9
24
|
* AST visitor class that traverses JavaScript/TypeScript syntax trees to extract translation keys.
|
|
10
25
|
*
|
|
@@ -777,7 +792,8 @@ class ASTVisitors {
|
|
|
777
792
|
const prop = callee.property;
|
|
778
793
|
if (prop?.type !== 'Identifier')
|
|
779
794
|
return undefined;
|
|
780
|
-
|
|
795
|
+
const elementParamIndex = ITERATION_METHODS[prop.value];
|
|
796
|
+
if (elementParamIndex === undefined)
|
|
781
797
|
return undefined;
|
|
782
798
|
// The object must be an identifier whose value is a known string array
|
|
783
799
|
const obj = callee.object;
|
|
@@ -785,7 +801,7 @@ class ASTVisitors {
|
|
|
785
801
|
if (obj?.type === 'Identifier') {
|
|
786
802
|
const values = this.expressionResolver.getVariableValues(obj.value);
|
|
787
803
|
if (values && values.length > 0) {
|
|
788
|
-
return this.extractCallbackParam(node, values);
|
|
804
|
+
return this.extractCallbackParam(node, values, elementParamIndex);
|
|
789
805
|
}
|
|
790
806
|
}
|
|
791
807
|
// ── Case 2: Object.keys(MAP).map(k => ...) ────────────────────────────
|
|
@@ -807,7 +823,7 @@ class ASTVisitors {
|
|
|
807
823
|
if (mapEntry) {
|
|
808
824
|
const values = isKeys ? Object.keys(mapEntry) : Object.values(mapEntry);
|
|
809
825
|
if (values.length > 0) {
|
|
810
|
-
return this.extractCallbackParam(node, values);
|
|
826
|
+
return this.extractCallbackParam(node, values, elementParamIndex);
|
|
811
827
|
}
|
|
812
828
|
}
|
|
813
829
|
}
|
|
@@ -837,7 +853,8 @@ class ASTVisitors {
|
|
|
837
853
|
const prop = callee.property;
|
|
838
854
|
if (prop?.type !== 'Identifier')
|
|
839
855
|
return undefined;
|
|
840
|
-
|
|
856
|
+
const elementParamIndex = ITERATION_METHODS[prop.value];
|
|
857
|
+
if (elementParamIndex === undefined)
|
|
841
858
|
return undefined;
|
|
842
859
|
if (callee.object?.type !== 'Identifier')
|
|
843
860
|
return undefined;
|
|
@@ -846,7 +863,7 @@ class ASTVisitors {
|
|
|
846
863
|
return undefined;
|
|
847
864
|
const callbackArg = node.arguments?.[0]?.expression;
|
|
848
865
|
const params = callbackArg?.params ?? callbackArg?.parameters ?? [];
|
|
849
|
-
const firstParam = params[
|
|
866
|
+
const firstParam = params[elementParamIndex];
|
|
850
867
|
if (!firstParam)
|
|
851
868
|
return undefined;
|
|
852
869
|
const pat = firstParam.pat ?? firstParam.pattern ?? firstParam;
|
|
@@ -880,15 +897,16 @@ class ASTVisitors {
|
|
|
880
897
|
}
|
|
881
898
|
}
|
|
882
899
|
/**
|
|
883
|
-
* Extracts the
|
|
884
|
-
* and pairs it with the provided values array.
|
|
900
|
+
* Extracts the element callback parameter identifier from an iteration call node
|
|
901
|
+
* and pairs it with the provided values array. `paramIndex` is the position of
|
|
902
|
+
* the element parameter (0 for map/forEach/…, 1 for reduce's `(acc, el)`).
|
|
885
903
|
*/
|
|
886
|
-
extractCallbackParam(node, values) {
|
|
904
|
+
extractCallbackParam(node, values, paramIndex = 0) {
|
|
887
905
|
const callbackArg = node.arguments?.[0]?.expression;
|
|
888
906
|
if (!callbackArg)
|
|
889
907
|
return undefined;
|
|
890
908
|
const params = callbackArg.params ?? callbackArg.parameters ?? [];
|
|
891
|
-
const firstParam = params[
|
|
909
|
+
const firstParam = params[paramIndex];
|
|
892
910
|
if (!firstParam)
|
|
893
911
|
return undefined;
|
|
894
912
|
const ident = firstParam.type === 'Identifier'
|
|
@@ -342,13 +342,31 @@ function buildNewTranslationsForNs(nsKeys, existingTranslations, config, locale,
|
|
|
342
342
|
: nsKeys;
|
|
343
343
|
// Prepare namespace pattern checking helpers
|
|
344
344
|
const rawPreserve = config.extract.preservePatterns || [];
|
|
345
|
+
// Fast equivalent of matching a `${objectKey}.*` glob per object key: instead of
|
|
346
|
+
// testing O(objectKeys) regexes per key, walk the key's '.' boundaries and look
|
|
347
|
+
// each ancestor prefix up in the Set — O(key depth). See issue #286.
|
|
348
|
+
const isUnderObjectKey = (key) => {
|
|
349
|
+
if (objectKeys.size === 0)
|
|
350
|
+
return false;
|
|
351
|
+
let i = key.indexOf('.');
|
|
352
|
+
while (i !== -1) {
|
|
353
|
+
if (objectKeys.has(key.slice(0, i)))
|
|
354
|
+
return true;
|
|
355
|
+
i = key.indexOf('.', i + 1);
|
|
356
|
+
}
|
|
357
|
+
return false;
|
|
358
|
+
};
|
|
345
359
|
// Helper to check if a key should be filtered out during extraction
|
|
346
360
|
const shouldFilterKey = (key) => {
|
|
347
|
-
// 1)
|
|
361
|
+
// 1) keys nested under a returnObjects / selector-API base key
|
|
362
|
+
if (isUnderObjectKey(key)) {
|
|
363
|
+
return true;
|
|
364
|
+
}
|
|
365
|
+
// 2) regex based patterns (existing behavior)
|
|
348
366
|
if (preservePatterns.some(re => re.test(key))) {
|
|
349
367
|
return true;
|
|
350
368
|
}
|
|
351
|
-
//
|
|
369
|
+
// 3) namespace:* style patterns (respect nsSeparator)
|
|
352
370
|
for (const rp of rawPreserve) {
|
|
353
371
|
if (typeof rp !== 'string')
|
|
354
372
|
continue;
|
|
@@ -365,11 +383,15 @@ function buildNewTranslationsForNs(nsKeys, existingTranslations, config, locale,
|
|
|
365
383
|
};
|
|
366
384
|
// Helper to check if an existing key should be preserved
|
|
367
385
|
const shouldPreserveExistingKey = (key) => {
|
|
368
|
-
// 1)
|
|
386
|
+
// 1) keys nested under a returnObjects / selector-API base key
|
|
387
|
+
if (isUnderObjectKey(key)) {
|
|
388
|
+
return true;
|
|
389
|
+
}
|
|
390
|
+
// 2) regex-style patterns
|
|
369
391
|
if (preservePatterns.some(re => re.test(key))) {
|
|
370
392
|
return true;
|
|
371
393
|
}
|
|
372
|
-
//
|
|
394
|
+
// 3) namespace:key patterns - check if pattern matches this namespace:key combination
|
|
373
395
|
for (const rp of rawPreserve) {
|
|
374
396
|
if (typeof rp !== 'string')
|
|
375
397
|
continue;
|
|
@@ -575,6 +597,19 @@ function buildNewTranslationsForNs(nsKeys, existingTranslations, config, locale,
|
|
|
575
597
|
}
|
|
576
598
|
}
|
|
577
599
|
}
|
|
600
|
+
// Precompute every proper ancestor prefix (up to each keySeparator boundary) of the
|
|
601
|
+
// extracted keys, so the per-key "is this a leaf?" check below is a single Set lookup
|
|
602
|
+
// instead of an O(keys) scan per key. See issue #286.
|
|
603
|
+
const parentPrefixesInNewKeys = new Set();
|
|
604
|
+
if (typeof keySeparator === 'string') {
|
|
605
|
+
for (const { key } of filteredKeys) {
|
|
606
|
+
let i = key.indexOf(keySeparator);
|
|
607
|
+
while (i !== -1 && i < key.length) {
|
|
608
|
+
parentPrefixesInNewKeys.add(key.slice(0, i));
|
|
609
|
+
i = key.indexOf(keySeparator, i + 1);
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
}
|
|
578
613
|
// 1. Build the object first, without any sorting.
|
|
579
614
|
for (const { key, defaultValue: defaultValue$1, explicitDefault, hasCount, isExpandedPlural, isOrdinal } of filteredKeys) {
|
|
580
615
|
// If this is a base plural key (hasCount true but not an already-expanded variant)
|
|
@@ -717,7 +752,7 @@ function buildNewTranslationsForNs(nsKeys, existingTranslations, config, locale,
|
|
|
717
752
|
// For flat keys there cannot be nested children, so treat them as leaves.
|
|
718
753
|
const isLeafInNewKeys = keySeparator === false
|
|
719
754
|
? true
|
|
720
|
-
: !
|
|
755
|
+
: !parentPrefixesInNewKeys.has(key);
|
|
721
756
|
const isDerivedDefault = isDerivedFromKey(key, defaultValue$1, explicitDefault);
|
|
722
757
|
// Determine if we should preserve an existing object
|
|
723
758
|
const shouldPreserveObject = typeof existingValue === 'object' && existingValue !== null && (objectKeys.has(key) || // Explicit returnObjects
|
|
@@ -1099,8 +1134,12 @@ async function getTranslations(keys, objectKeys, config, { syncPrimaryWithDefaul
|
|
|
1099
1134
|
const patternsToPreserve = [...(config.extract.preservePatterns || [])];
|
|
1100
1135
|
const indentation = config.extract.indentation ?? 2;
|
|
1101
1136
|
for (const key of objectKeys) {
|
|
1102
|
-
//
|
|
1103
|
-
|
|
1137
|
+
// Object keys are matched directly (and cheaply) against the objectKeys Set in
|
|
1138
|
+
// buildNewTranslationsForNs (see isUnderObjectKey). Only a key that itself
|
|
1139
|
+
// contains a wildcard still needs the glob-to-regex path.
|
|
1140
|
+
if (key.includes('*')) {
|
|
1141
|
+
patternsToPreserve.push(`${key}.*`);
|
|
1142
|
+
}
|
|
1104
1143
|
}
|
|
1105
1144
|
const preservePatterns = patternsToPreserve.map(globToRegex);
|
|
1106
1145
|
// Group keys by namespace. If the plugin recorded the namespace as implicit
|
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.71.
|
|
34
|
+
.version('1.71.2'); // This string is replaced with the actual version at build time by rollup
|
|
35
35
|
// new: global config override option
|
|
36
36
|
program.option('-c, --config <path>', 'Path to i18next-cli config file (overrides detection)');
|
|
37
37
|
program
|
|
@@ -3,6 +3,21 @@ import { ExpressionResolver } from '../parsers/expression-resolver.js';
|
|
|
3
3
|
import { CallExpressionHandler } from '../parsers/call-expression-handler.js';
|
|
4
4
|
import { JSXHandler } from '../parsers/jsx-handler.js';
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Array iteration methods whose callback we can bind, mapped to the position of
|
|
8
|
+
* the *element* parameter: `map(el, i)` → 0, `reduce((acc, el) => …)` → 1.
|
|
9
|
+
*/
|
|
10
|
+
const ITERATION_METHODS = {
|
|
11
|
+
map: 0,
|
|
12
|
+
forEach: 0,
|
|
13
|
+
flatMap: 0,
|
|
14
|
+
filter: 0,
|
|
15
|
+
find: 0,
|
|
16
|
+
some: 0,
|
|
17
|
+
every: 0,
|
|
18
|
+
reduce: 1,
|
|
19
|
+
reduceRight: 1,
|
|
20
|
+
};
|
|
6
21
|
/**
|
|
7
22
|
* AST visitor class that traverses JavaScript/TypeScript syntax trees to extract translation keys.
|
|
8
23
|
*
|
|
@@ -775,7 +790,8 @@ class ASTVisitors {
|
|
|
775
790
|
const prop = callee.property;
|
|
776
791
|
if (prop?.type !== 'Identifier')
|
|
777
792
|
return undefined;
|
|
778
|
-
|
|
793
|
+
const elementParamIndex = ITERATION_METHODS[prop.value];
|
|
794
|
+
if (elementParamIndex === undefined)
|
|
779
795
|
return undefined;
|
|
780
796
|
// The object must be an identifier whose value is a known string array
|
|
781
797
|
const obj = callee.object;
|
|
@@ -783,7 +799,7 @@ class ASTVisitors {
|
|
|
783
799
|
if (obj?.type === 'Identifier') {
|
|
784
800
|
const values = this.expressionResolver.getVariableValues(obj.value);
|
|
785
801
|
if (values && values.length > 0) {
|
|
786
|
-
return this.extractCallbackParam(node, values);
|
|
802
|
+
return this.extractCallbackParam(node, values, elementParamIndex);
|
|
787
803
|
}
|
|
788
804
|
}
|
|
789
805
|
// ── Case 2: Object.keys(MAP).map(k => ...) ────────────────────────────
|
|
@@ -805,7 +821,7 @@ class ASTVisitors {
|
|
|
805
821
|
if (mapEntry) {
|
|
806
822
|
const values = isKeys ? Object.keys(mapEntry) : Object.values(mapEntry);
|
|
807
823
|
if (values.length > 0) {
|
|
808
|
-
return this.extractCallbackParam(node, values);
|
|
824
|
+
return this.extractCallbackParam(node, values, elementParamIndex);
|
|
809
825
|
}
|
|
810
826
|
}
|
|
811
827
|
}
|
|
@@ -835,7 +851,8 @@ class ASTVisitors {
|
|
|
835
851
|
const prop = callee.property;
|
|
836
852
|
if (prop?.type !== 'Identifier')
|
|
837
853
|
return undefined;
|
|
838
|
-
|
|
854
|
+
const elementParamIndex = ITERATION_METHODS[prop.value];
|
|
855
|
+
if (elementParamIndex === undefined)
|
|
839
856
|
return undefined;
|
|
840
857
|
if (callee.object?.type !== 'Identifier')
|
|
841
858
|
return undefined;
|
|
@@ -844,7 +861,7 @@ class ASTVisitors {
|
|
|
844
861
|
return undefined;
|
|
845
862
|
const callbackArg = node.arguments?.[0]?.expression;
|
|
846
863
|
const params = callbackArg?.params ?? callbackArg?.parameters ?? [];
|
|
847
|
-
const firstParam = params[
|
|
864
|
+
const firstParam = params[elementParamIndex];
|
|
848
865
|
if (!firstParam)
|
|
849
866
|
return undefined;
|
|
850
867
|
const pat = firstParam.pat ?? firstParam.pattern ?? firstParam;
|
|
@@ -878,15 +895,16 @@ class ASTVisitors {
|
|
|
878
895
|
}
|
|
879
896
|
}
|
|
880
897
|
/**
|
|
881
|
-
* Extracts the
|
|
882
|
-
* and pairs it with the provided values array.
|
|
898
|
+
* Extracts the element callback parameter identifier from an iteration call node
|
|
899
|
+
* and pairs it with the provided values array. `paramIndex` is the position of
|
|
900
|
+
* the element parameter (0 for map/forEach/…, 1 for reduce's `(acc, el)`).
|
|
883
901
|
*/
|
|
884
|
-
extractCallbackParam(node, values) {
|
|
902
|
+
extractCallbackParam(node, values, paramIndex = 0) {
|
|
885
903
|
const callbackArg = node.arguments?.[0]?.expression;
|
|
886
904
|
if (!callbackArg)
|
|
887
905
|
return undefined;
|
|
888
906
|
const params = callbackArg.params ?? callbackArg.parameters ?? [];
|
|
889
|
-
const firstParam = params[
|
|
907
|
+
const firstParam = params[paramIndex];
|
|
890
908
|
if (!firstParam)
|
|
891
909
|
return undefined;
|
|
892
910
|
const ident = firstParam.type === 'Identifier'
|
|
@@ -340,13 +340,31 @@ function buildNewTranslationsForNs(nsKeys, existingTranslations, config, locale,
|
|
|
340
340
|
: nsKeys;
|
|
341
341
|
// Prepare namespace pattern checking helpers
|
|
342
342
|
const rawPreserve = config.extract.preservePatterns || [];
|
|
343
|
+
// Fast equivalent of matching a `${objectKey}.*` glob per object key: instead of
|
|
344
|
+
// testing O(objectKeys) regexes per key, walk the key's '.' boundaries and look
|
|
345
|
+
// each ancestor prefix up in the Set — O(key depth). See issue #286.
|
|
346
|
+
const isUnderObjectKey = (key) => {
|
|
347
|
+
if (objectKeys.size === 0)
|
|
348
|
+
return false;
|
|
349
|
+
let i = key.indexOf('.');
|
|
350
|
+
while (i !== -1) {
|
|
351
|
+
if (objectKeys.has(key.slice(0, i)))
|
|
352
|
+
return true;
|
|
353
|
+
i = key.indexOf('.', i + 1);
|
|
354
|
+
}
|
|
355
|
+
return false;
|
|
356
|
+
};
|
|
343
357
|
// Helper to check if a key should be filtered out during extraction
|
|
344
358
|
const shouldFilterKey = (key) => {
|
|
345
|
-
// 1)
|
|
359
|
+
// 1) keys nested under a returnObjects / selector-API base key
|
|
360
|
+
if (isUnderObjectKey(key)) {
|
|
361
|
+
return true;
|
|
362
|
+
}
|
|
363
|
+
// 2) regex based patterns (existing behavior)
|
|
346
364
|
if (preservePatterns.some(re => re.test(key))) {
|
|
347
365
|
return true;
|
|
348
366
|
}
|
|
349
|
-
//
|
|
367
|
+
// 3) namespace:* style patterns (respect nsSeparator)
|
|
350
368
|
for (const rp of rawPreserve) {
|
|
351
369
|
if (typeof rp !== 'string')
|
|
352
370
|
continue;
|
|
@@ -363,11 +381,15 @@ function buildNewTranslationsForNs(nsKeys, existingTranslations, config, locale,
|
|
|
363
381
|
};
|
|
364
382
|
// Helper to check if an existing key should be preserved
|
|
365
383
|
const shouldPreserveExistingKey = (key) => {
|
|
366
|
-
// 1)
|
|
384
|
+
// 1) keys nested under a returnObjects / selector-API base key
|
|
385
|
+
if (isUnderObjectKey(key)) {
|
|
386
|
+
return true;
|
|
387
|
+
}
|
|
388
|
+
// 2) regex-style patterns
|
|
367
389
|
if (preservePatterns.some(re => re.test(key))) {
|
|
368
390
|
return true;
|
|
369
391
|
}
|
|
370
|
-
//
|
|
392
|
+
// 3) namespace:key patterns - check if pattern matches this namespace:key combination
|
|
371
393
|
for (const rp of rawPreserve) {
|
|
372
394
|
if (typeof rp !== 'string')
|
|
373
395
|
continue;
|
|
@@ -573,6 +595,19 @@ function buildNewTranslationsForNs(nsKeys, existingTranslations, config, locale,
|
|
|
573
595
|
}
|
|
574
596
|
}
|
|
575
597
|
}
|
|
598
|
+
// Precompute every proper ancestor prefix (up to each keySeparator boundary) of the
|
|
599
|
+
// extracted keys, so the per-key "is this a leaf?" check below is a single Set lookup
|
|
600
|
+
// instead of an O(keys) scan per key. See issue #286.
|
|
601
|
+
const parentPrefixesInNewKeys = new Set();
|
|
602
|
+
if (typeof keySeparator === 'string') {
|
|
603
|
+
for (const { key } of filteredKeys) {
|
|
604
|
+
let i = key.indexOf(keySeparator);
|
|
605
|
+
while (i !== -1 && i < key.length) {
|
|
606
|
+
parentPrefixesInNewKeys.add(key.slice(0, i));
|
|
607
|
+
i = key.indexOf(keySeparator, i + 1);
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
}
|
|
576
611
|
// 1. Build the object first, without any sorting.
|
|
577
612
|
for (const { key, defaultValue, explicitDefault, hasCount, isExpandedPlural, isOrdinal } of filteredKeys) {
|
|
578
613
|
// If this is a base plural key (hasCount true but not an already-expanded variant)
|
|
@@ -715,7 +750,7 @@ function buildNewTranslationsForNs(nsKeys, existingTranslations, config, locale,
|
|
|
715
750
|
// For flat keys there cannot be nested children, so treat them as leaves.
|
|
716
751
|
const isLeafInNewKeys = keySeparator === false
|
|
717
752
|
? true
|
|
718
|
-
: !
|
|
753
|
+
: !parentPrefixesInNewKeys.has(key);
|
|
719
754
|
const isDerivedDefault = isDerivedFromKey(key, defaultValue, explicitDefault);
|
|
720
755
|
// Determine if we should preserve an existing object
|
|
721
756
|
const shouldPreserveObject = typeof existingValue === 'object' && existingValue !== null && (objectKeys.has(key) || // Explicit returnObjects
|
|
@@ -1097,8 +1132,12 @@ async function getTranslations(keys, objectKeys, config, { syncPrimaryWithDefaul
|
|
|
1097
1132
|
const patternsToPreserve = [...(config.extract.preservePatterns || [])];
|
|
1098
1133
|
const indentation = config.extract.indentation ?? 2;
|
|
1099
1134
|
for (const key of objectKeys) {
|
|
1100
|
-
//
|
|
1101
|
-
|
|
1135
|
+
// Object keys are matched directly (and cheaply) against the objectKeys Set in
|
|
1136
|
+
// buildNewTranslationsForNs (see isUnderObjectKey). Only a key that itself
|
|
1137
|
+
// contains a wildcard still needs the glob-to-regex path.
|
|
1138
|
+
if (key.includes('*')) {
|
|
1139
|
+
patternsToPreserve.push(`${key}.*`);
|
|
1140
|
+
}
|
|
1102
1141
|
}
|
|
1103
1142
|
const preservePatterns = patternsToPreserve.map(globToRegex);
|
|
1104
1143
|
// Group keys by namespace. If the plugin recorded the namespace as implicit
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "i18next-cli",
|
|
3
|
-
"version": "1.71.
|
|
3
|
+
"version": "1.71.2",
|
|
4
4
|
"description": "A unified, high-performance i18next CLI.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -59,8 +59,8 @@
|
|
|
59
59
|
"@types/node": "^26.2.0",
|
|
60
60
|
"@types/react": "^19.2.18",
|
|
61
61
|
"@typescript-eslint/parser": "^8.67.0",
|
|
62
|
-
"@vitest/coverage-v8": "^4.1.
|
|
63
|
-
"eslint": "^9.39.
|
|
62
|
+
"@vitest/coverage-v8": "^4.1.11",
|
|
63
|
+
"eslint": "^9.39.5",
|
|
64
64
|
"eslint-import-resolver-typescript": "^4.4.5",
|
|
65
65
|
"eslint-plugin-import": "^2.32.0",
|
|
66
66
|
"memfs": "^4.68.1",
|
|
@@ -68,25 +68,25 @@
|
|
|
68
68
|
"rollup": "^4.62.4",
|
|
69
69
|
"typescript": "^6.0.3",
|
|
70
70
|
"unplugin-swc": "^1.5.11",
|
|
71
|
-
"vitest": "^4.1.
|
|
71
|
+
"vitest": "^4.1.11"
|
|
72
72
|
},
|
|
73
73
|
"dependencies": {
|
|
74
74
|
"@croct/json5-parser": "^0.2.2",
|
|
75
|
-
"@swc/core": "^1.16.
|
|
75
|
+
"@swc/core": "^1.16.1",
|
|
76
76
|
"chokidar": "^5.0.0",
|
|
77
77
|
"commander": "^15.0.0",
|
|
78
78
|
"execa": "^10.0.1",
|
|
79
79
|
"glob": "^13.0.6",
|
|
80
|
-
"i18next": "^26.
|
|
80
|
+
"i18next": "^26.4.0",
|
|
81
81
|
"i18next-resources-for-ts": "^2.1.0",
|
|
82
|
-
"inquirer": "^14.0
|
|
82
|
+
"inquirer": "^14.1.0",
|
|
83
83
|
"jiti": "^2.7.0",
|
|
84
84
|
"jsonc-parser": "^3.3.1",
|
|
85
|
-
"magic-string": "^1.2.
|
|
85
|
+
"magic-string": "^1.2.2",
|
|
86
86
|
"minimatch": "^10.2.6",
|
|
87
87
|
"ora": "^9.4.1",
|
|
88
88
|
"react": "^19.2.8",
|
|
89
|
-
"react-i18next": "^17.0.
|
|
89
|
+
"react-i18next": "^17.0.12",
|
|
90
90
|
"yaml": "^2.9.0"
|
|
91
91
|
}
|
|
92
92
|
}
|
|
@@ -120,8 +120,9 @@ export declare class ASTVisitors {
|
|
|
120
120
|
*/
|
|
121
121
|
private tryBindObjectArrayCallback;
|
|
122
122
|
/**
|
|
123
|
-
* Extracts the
|
|
124
|
-
* and pairs it with the provided values array.
|
|
123
|
+
* Extracts the element callback parameter identifier from an iteration call node
|
|
124
|
+
* and pairs it with the provided values array. `paramIndex` is the position of
|
|
125
|
+
* the element parameter (0 for map/forEach/…, 1 for reduce's `(acc, el)`).
|
|
125
126
|
*/
|
|
126
127
|
private extractCallbackParam;
|
|
127
128
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ast-visitors.d.ts","sourceRoot":"","sources":["../../../src/extractor/core/ast-visitors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAQ,MAAM,WAAW,CAAA;AAC7C,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC7G,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAA;
|
|
1
|
+
{"version":3,"file":"ast-visitors.d.ts","sourceRoot":"","sources":["../../../src/extractor/core/ast-visitors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAQ,MAAM,WAAW,CAAA;AAC7C,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC7G,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAA;AAoBtE;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAe;IAC7C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAuC;IAC9D,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAQ;IAC/B,OAAO,CAAC,KAAK,CAAiB;IAE9B,IAAW,UAAU,gBAEpB;IAED,SAAgB,YAAY,EAAE,YAAY,CAAA;IAC1C,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAoB;IACvD,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAuB;IAC7D,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAY;IACvC,OAAO,CAAC,WAAW,CAAa;IAChC,OAAO,CAAC,WAAW,CAAa;IAEhC;;;;;;OAMG;gBAED,MAAM,EAAE,IAAI,CAAC,oBAAoB,EAAE,SAAS,CAAC,EAC7C,aAAa,EAAE,aAAa,EAC5B,MAAM,EAAE,MAAM,EACd,KAAK,CAAC,EAAE,eAAe,EACvB,kBAAkB,CAAC,EAAE,kBAAkB;IAoCzC;;;;;;;;;;;;;OAaG;IACI,mBAAmB,CAAE,IAAI,EAAE,MAAM,GAAG,IAAI;IAK/C;;;OAGG;IACH,OAAO,CAAC,iBAAiB;IAqDzB;;;;;OAKG;IACI,KAAK,CAAE,IAAI,EAAE,MAAM,GAAG,IAAI;IAUjC;;;;;;;;;;;;OAYG;IACH,OAAO,CAAC,IAAI;IAsaZ;;;OAGG;IACH,OAAO,CAAC,kBAAkB;IAiH1B;;;;OAIG;IACH,OAAO,CAAC,iBAAiB;IAIzB,mFAAmF;IACnF,OAAO,CAAC,oBAAoB;IAoB5B;;;;;;;;OAQG;IACH,OAAO,CAAC,gCAAgC;IAsDxC;;;;;;;;;OASG;IACH,OAAO,CAAC,0BAA0B;IAgDlC;;;;OAIG;IACH,OAAO,CAAC,oBAAoB;IAqB5B;;;;;;;;OAQG;IACI,eAAe,CAAE,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS;IAI5D;;OAEG;IACI,cAAc,CAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI;IAKxD;;;;;;OAMG;IACI,cAAc,IAAK,MAAM;IAIhC;;OAEG;IACI,cAAc,IAAK,MAAM;CAGjC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translation-manager.d.ts","sourceRoot":"","sources":["../../../src/extractor/core/translation-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"translation-manager.d.ts","sourceRoot":"","sources":["../../../src/extractor/core/translation-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AA8tC9F;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAsB,eAAe,CACnC,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,EAC/B,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,EACvB,MAAM,EAAE,oBAAoB,EAC5B,EACE,uBAA+B,EAC/B,OAAe,EACf,oBAA4B,EAC5B,MAA4B,EAC7B,GAAE;IACD,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAA;CACX,GACL,OAAO,CAAC,iBAAiB,EAAE,CAAC,CA6K9B"}
|