i18next-cli 1.74.2 → 1.74.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.
@@ -14,11 +14,34 @@ export declare class ExpressionResolver {
14
14
  private temporaryObjectVariables;
15
15
  private arrayElementMembers;
16
16
  private sharedImportAliases;
17
+ private objectTypeParams;
18
+ private typeParamBindings;
19
+ private sharedFunctionReturnMembers;
20
+ private objectVariables;
21
+ recording: boolean;
22
+ private replays;
23
+ private replaying;
24
+ private grew;
17
25
  constructor(hooks: ASTVisitorHooks);
18
26
  /**
19
27
  * Clear per-file captured variables. Enums / shared maps are kept.
20
28
  */
21
29
  resetFileSymbols(): void;
30
+ /**
31
+ * Call once every file has been pre-scanned. Captures ran in file order, so one
32
+ * that refers to a declaration in a later file (`type Kind = Base | 'extra'`
33
+ * with `Base` declared further down the list) came out short. They are replayed
34
+ * against the complete tables until nothing grows, then renaming imports are
35
+ * mirrored.
36
+ */
37
+ finishPreScan(): void;
38
+ /**
39
+ * Write an entry of a cross-file table. While replaying, an entry only grows:
40
+ * a replayed declaration has lost its file's local bindings and must not shrink
41
+ * what the pre-scan resolved, and two same-named declarations in different files
42
+ * must not keep overwriting each other.
43
+ */
44
+ private setShared;
22
45
  /**
23
46
  * Capture a VariableDeclarator node to record simple statically analyzable
24
47
  * initializers (string literals, object expressions of string literals,
@@ -64,6 +87,19 @@ export declare class ExpressionResolver {
64
87
  * SWC node shape: `TsInterfaceDeclaration` with `body.body` members.
65
88
  */
66
89
  captureInterfaceDeclaration(node: any): void;
90
+ private setObjectTypeRaw;
91
+ /**
92
+ * Run `fn` with the parameters of a generic type bound to the values of their
93
+ * arguments, falling back to each one's default and then its constraint, so
94
+ * that `type Base<T extends Kind> = { type: T }` used bare has `type: Kind`.
95
+ */
96
+ private withTypeParams;
97
+ /**
98
+ * The member map of an object held by `expr`: a parameter typed by an interface
99
+ * (`props`), a variable holding an object type (`animal`) or a call of a
100
+ * function returning one (`getAnimal()`).
101
+ */
102
+ private objectMembersOf;
67
103
  /**
68
104
  * Build `{ memberName: possibleStringValues }` for an object-shaped type
69
105
  * (interface body or object type-literal members). Only members whose type
@@ -107,15 +143,20 @@ export declare class ExpressionResolver {
107
143
  */
108
144
  captureFunctionDeclaration(node: any): void;
109
145
  /**
110
- * Walk a function body's ReturnStatements and union the statically-resolvable
111
- * string values of their argument expressions. Does NOT descend into nested
112
- * function declarations (their returns belong to the inner function, not us).
146
+ * Record what a function returns: string values for `t(fn())`, and the members
147
+ * of an object return type for `fn().type` / `const x = fn(); x.type`.
148
+ */
149
+ private captureFunctionReturn;
150
+ /**
151
+ * Collect a function's return expressions (the expression body of an arrow
152
+ * function, or the arguments of its ReturnStatements). Does NOT descend into
153
+ * nested function declarations (their returns belong to the inner function, not us).
113
154
  *
114
155
  * This is how we mirror TypeScript's implicit return-type inference for the
115
156
  * purpose of extracting translation keys — we don't need exhaustiveness, just
116
157
  * the set of string values any return statement could produce.
117
158
  */
118
- private inferReturnValuesFromFunctionBody;
159
+ private returnExpressions;
119
160
  /**
120
161
  * Extract a raw TsType node from an identifier's type annotation.
121
162
  * SWC may wrap it in a `TsTypeAnnotation` node — this unwraps it.
@@ -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;AAC3F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAGrD,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,KAAK,CAAiB;IAK9B,OAAO,CAAC,aAAa,CAA4D;IAGjF,OAAO,CAAC,eAAe,CAAiD;IAIxE,OAAO,CAAC,cAAc,CAAmC;IAIzD,OAAO,CAAC,mBAAmB,CAAmC;IAI9D,OAAO,CAAC,oBAAoB,CAAmC;IAM/D,OAAO,CAAC,yBAAyB,CAAmC;IAIpE,OAAO,CAAC,kBA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