i18next-cli 1.24.13 → 1.24.14
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/esm/cli.js +1 -1
- package/package.json +6 -6
- package/types/cli.d.ts +3 -1
- package/types/cli.d.ts.map +1 -1
- package/CHANGELOG.md +0 -599
- package/src/cli.ts +0 -283
- package/src/config.ts +0 -215
- package/src/extractor/core/ast-visitors.ts +0 -259
- package/src/extractor/core/extractor.ts +0 -250
- package/src/extractor/core/key-finder.ts +0 -142
- package/src/extractor/core/translation-manager.ts +0 -750
- package/src/extractor/index.ts +0 -7
- package/src/extractor/parsers/ast-utils.ts +0 -87
- package/src/extractor/parsers/call-expression-handler.ts +0 -793
- package/src/extractor/parsers/comment-parser.ts +0 -424
- package/src/extractor/parsers/expression-resolver.ts +0 -391
- package/src/extractor/parsers/jsx-handler.ts +0 -488
- package/src/extractor/parsers/jsx-parser.ts +0 -1463
- package/src/extractor/parsers/scope-manager.ts +0 -445
- package/src/extractor/plugin-manager.ts +0 -116
- package/src/extractor.ts +0 -15
- package/src/heuristic-config.ts +0 -92
- package/src/index.ts +0 -22
- package/src/init.ts +0 -175
- package/src/linter.ts +0 -345
- package/src/locize.ts +0 -263
- package/src/migrator.ts +0 -208
- package/src/rename-key.ts +0 -398
- package/src/status.ts +0 -380
- package/src/syncer.ts +0 -133
- package/src/types-generator.ts +0 -139
- package/src/types.ts +0 -577
- package/src/utils/default-value.ts +0 -45
- package/src/utils/file-utils.ts +0 -167
- package/src/utils/funnel-msg-tracker.ts +0 -84
- package/src/utils/logger.ts +0 -36
- package/src/utils/nested-object.ts +0 -135
- package/src/utils/validation.ts +0 -72
package/src/extractor/index.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export * from './core/extractor'
|
|
2
|
-
export * from './core/key-finder'
|
|
3
|
-
export * from './core/translation-manager'
|
|
4
|
-
export * from './core/ast-visitors'
|
|
5
|
-
export * from './parsers/comment-parser'
|
|
6
|
-
export * from './parsers/jsx-parser'
|
|
7
|
-
export * from './plugin-manager'
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import type { Expression, Identifier, ObjectExpression, TemplateLiteral } from '@swc/core'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Finds and returns the full property node (KeyValueProperty) for the given
|
|
5
|
-
* property name from an ObjectExpression.
|
|
6
|
-
*
|
|
7
|
-
* Matches both identifier keys (e.g., { ns: 'value' }) and string literal keys
|
|
8
|
-
* (e.g., { 'ns': 'value' }).
|
|
9
|
-
*
|
|
10
|
-
* This helper returns the full property node rather than just its primitive
|
|
11
|
-
* value so callers can inspect expression types (ConditionalExpression, etc.).
|
|
12
|
-
*
|
|
13
|
-
* @private
|
|
14
|
-
* @param object - The SWC ObjectExpression to search
|
|
15
|
-
* @param propName - The property name to locate
|
|
16
|
-
* @returns The matching KeyValueProperty node if found, otherwise undefined.
|
|
17
|
-
*/
|
|
18
|
-
export function getObjectProperty (object: ObjectExpression, propName: string) {
|
|
19
|
-
return (object.properties).filter(
|
|
20
|
-
(p) => p.type === 'KeyValueProperty')
|
|
21
|
-
.find(
|
|
22
|
-
(p) =>
|
|
23
|
-
(
|
|
24
|
-
(p.key?.type === 'Identifier' && p.key.value === propName) ||
|
|
25
|
-
(p.key?.type === 'StringLiteral' && p.key.value === propName)
|
|
26
|
-
)
|
|
27
|
-
)
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Finds and returns the value node for the given property name from an ObjectExpression.
|
|
32
|
-
*
|
|
33
|
-
* Matches both identifier keys (e.g., { ns: 'value' }), string literal keys
|
|
34
|
-
* (e.g., { 'ns': 'value' }) and shorthand properties (e.g., { ns }).
|
|
35
|
-
*
|
|
36
|
-
* This helper returns the full value node rather than just its primitive
|
|
37
|
-
* value so callers can inspect expression types (ConditionalExpression, etc.).
|
|
38
|
-
*
|
|
39
|
-
* @private
|
|
40
|
-
* @param object - The SWC ObjectExpression to search
|
|
41
|
-
* @param propName - The property name to locate
|
|
42
|
-
* @returns The matching value node if found, otherwise undefined.
|
|
43
|
-
*/
|
|
44
|
-
export function getObjectPropValueExpression (object: ObjectExpression, propName: string): Expression | undefined {
|
|
45
|
-
return getObjectProperty(object, propName)?.value ?? (object.properties).find(
|
|
46
|
-
// For shorthand properties like { ns }.
|
|
47
|
-
(p): p is Identifier => p.type === 'Identifier' && p.value === propName
|
|
48
|
-
)
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Checks if the given template literal has no interpolation expressions
|
|
53
|
-
*
|
|
54
|
-
* @param literal - Template literal to check
|
|
55
|
-
* @returns Boolean true if the literal has no expressions and can be parsed (no invalid escapes), false otherwise
|
|
56
|
-
*
|
|
57
|
-
* @private
|
|
58
|
-
*/
|
|
59
|
-
export function isSimpleTemplateLiteral (literal: TemplateLiteral): boolean {
|
|
60
|
-
return literal.quasis.length === 1 && literal.expressions.length === 0 && literal.quasis[0].cooked != null
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Extracts string value from object property.
|
|
65
|
-
*
|
|
66
|
-
* Looks for properties by name and returns their string values.
|
|
67
|
-
* Used for extracting options like 'ns', 'defaultValue', 'context', etc.
|
|
68
|
-
*
|
|
69
|
-
* @param object - Object expression to search
|
|
70
|
-
* @param propName - Property name to find
|
|
71
|
-
* @returns String value if found, empty string if property exists but isn't a string, undefined if not found
|
|
72
|
-
*
|
|
73
|
-
* @private
|
|
74
|
-
*/
|
|
75
|
-
export function getObjectPropValue (object: ObjectExpression, propName: string): string | boolean | number | undefined {
|
|
76
|
-
const prop = getObjectProperty(object, propName)
|
|
77
|
-
|
|
78
|
-
if (prop?.type === 'KeyValueProperty') {
|
|
79
|
-
const val = prop.value
|
|
80
|
-
if (val.type === 'StringLiteral') return val.value
|
|
81
|
-
if (val.type === 'TemplateLiteral' && isSimpleTemplateLiteral(val)) return val.quasis[0].cooked
|
|
82
|
-
if (val.type === 'BooleanLiteral') return val.value
|
|
83
|
-
if (val.type === 'NumericLiteral') return val.value
|
|
84
|
-
return '' // Indicate presence for other types
|
|
85
|
-
}
|
|
86
|
-
return undefined
|
|
87
|
-
}
|