@verbaly/compiler 0.67.0 → 0.68.0
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/README.md +14 -10
- package/dist/{claude-D-j-ZiYH.js → claude-BFIWiu_4.js} +2 -2
- package/dist/{claude-BmD8W9uW.js.map → claude-BFIWiu_4.js.map} +1 -1
- package/dist/{claude-BmD8W9uW.js → claude-DmnZ1cvR.js} +2 -2
- package/dist/{claude-D-j-ZiYH.js.map → claude-DmnZ1cvR.js.map} +1 -1
- package/dist/cli.js +1949 -1626
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +200 -100
- package/dist/index.js +688 -358
- package/dist/index.js.map +1 -1
- package/dist/{text-M4XbWU6N.js → text-SqXoYAIB.js} +5 -2
- package/dist/{text-M4XbWU6N.js.map → text-SqXoYAIB.js.map} +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -10,6 +10,79 @@ export declare function writeCatalog(cfg: ResolvedConfig, locale: string, catalo
|
|
|
10
10
|
export declare function needsIcu(catalogs: Catalogs): boolean;
|
|
11
11
|
export declare function needsRelative(catalogs: Catalogs): boolean;
|
|
12
12
|
//#endregion
|
|
13
|
+
//#region src/analyze.d.ts
|
|
14
|
+
interface TaggedParam {
|
|
15
|
+
name: string;
|
|
16
|
+
start: number;
|
|
17
|
+
end: number;
|
|
18
|
+
}
|
|
19
|
+
interface TransComponent {
|
|
20
|
+
name: string;
|
|
21
|
+
source: string;
|
|
22
|
+
}
|
|
23
|
+
interface TaggedMessage {
|
|
24
|
+
key: string;
|
|
25
|
+
message: string;
|
|
26
|
+
params: TaggedParam[];
|
|
27
|
+
start: number;
|
|
28
|
+
end: number;
|
|
29
|
+
line: number;
|
|
30
|
+
tagStart: number;
|
|
31
|
+
tagEnd: number;
|
|
32
|
+
file: string;
|
|
33
|
+
jsx?: {
|
|
34
|
+
name: string;
|
|
35
|
+
components: TransComponent[];
|
|
36
|
+
};
|
|
37
|
+
singleQuote?: boolean;
|
|
38
|
+
}
|
|
39
|
+
interface UsedKey {
|
|
40
|
+
key: string;
|
|
41
|
+
file: string;
|
|
42
|
+
loose?: true;
|
|
43
|
+
}
|
|
44
|
+
interface StrayImport {
|
|
45
|
+
name: string;
|
|
46
|
+
source: string;
|
|
47
|
+
file: string;
|
|
48
|
+
}
|
|
49
|
+
interface MissedCall {
|
|
50
|
+
name: string;
|
|
51
|
+
file: string;
|
|
52
|
+
start: number;
|
|
53
|
+
line: number;
|
|
54
|
+
}
|
|
55
|
+
interface Analysis {
|
|
56
|
+
tagged: TaggedMessage[];
|
|
57
|
+
usedKeys: UsedKey[];
|
|
58
|
+
strayImports: StrayImport[];
|
|
59
|
+
missed: MissedCall[];
|
|
60
|
+
parseError?: string;
|
|
61
|
+
}
|
|
62
|
+
//#endregion
|
|
63
|
+
//#region src/registry.d.ts
|
|
64
|
+
interface Collision {
|
|
65
|
+
key: string;
|
|
66
|
+
kept: TaggedMessage;
|
|
67
|
+
dropped: TaggedMessage[];
|
|
68
|
+
}
|
|
69
|
+
export declare class MessageRegistry {
|
|
70
|
+
private files;
|
|
71
|
+
update(file: string, analysis: Analysis): void;
|
|
72
|
+
remove(file: string): void;
|
|
73
|
+
messages(): Map<string, TaggedMessage>;
|
|
74
|
+
collisions(): Collision[];
|
|
75
|
+
usedKeys(strict?: boolean): Map<string, string[]>;
|
|
76
|
+
strayImports(): StrayImport[];
|
|
77
|
+
missed(): MissedCall[];
|
|
78
|
+
parseErrors(): {
|
|
79
|
+
file: string;
|
|
80
|
+
message: string;
|
|
81
|
+
}[];
|
|
82
|
+
origins(): Map<string, string[]>;
|
|
83
|
+
private inOrder;
|
|
84
|
+
}
|
|
85
|
+
//#endregion
|
|
13
86
|
//#region src/translate.d.ts
|
|
14
87
|
interface TranslateRequest {
|
|
15
88
|
sourceLocale: string;
|
|
@@ -60,9 +133,11 @@ interface WriteDraftsResult {
|
|
|
60
133
|
invalid: string[];
|
|
61
134
|
unknown: string[];
|
|
62
135
|
}
|
|
63
|
-
|
|
136
|
+
interface WriteDraftsOptions {
|
|
64
137
|
overwrite?: boolean;
|
|
65
|
-
|
|
138
|
+
registry?: MessageRegistry;
|
|
139
|
+
}
|
|
140
|
+
export declare function writeDrafts(cfg: ResolvedConfig, locale: string, entries: DraftEntry[], options?: WriteDraftsOptions): WriteDraftsResult;
|
|
66
141
|
export declare function formatTranslateFailures(failed: TranslateFailure[]): string[];
|
|
67
142
|
export declare function resolveProvider(cfg: ResolvedConfig, model?: string): Promise<TranslateProvider>;
|
|
68
143
|
//#endregion
|
|
@@ -132,88 +207,140 @@ export declare function resolveConfig(config?: VerbalyConfig): ResolvedConfig;
|
|
|
132
207
|
export declare function targetLocales(cfg: ResolvedConfig, override?: string[]): string[];
|
|
133
208
|
export declare function loadConfig(root: string, overrides?: VerbalyConfig): Promise<ResolvedConfig>;
|
|
134
209
|
//#endregion
|
|
135
|
-
//#region src/
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
210
|
+
//#region src/bundle.d.ts
|
|
211
|
+
export declare function clientCatalogs(cfg: ResolvedConfig, catalogs: Catalogs): Catalogs;
|
|
212
|
+
//#endregion
|
|
213
|
+
//#region src/extract.d.ts
|
|
214
|
+
export declare function extractProject(cfg: ResolvedConfig): Promise<MessageRegistry>;
|
|
215
|
+
export declare function collectOrigins(cfg: ResolvedConfig, reuse?: MessageRegistry): Promise<Record<string, string[]>>;
|
|
216
|
+
interface ReplacedText {
|
|
217
|
+
key: string;
|
|
218
|
+
before: string;
|
|
140
219
|
}
|
|
141
|
-
interface
|
|
142
|
-
|
|
143
|
-
|
|
220
|
+
interface SyncResult {
|
|
221
|
+
added: Record<string, string[]>;
|
|
222
|
+
replaced: ReplacedText[];
|
|
144
223
|
}
|
|
145
|
-
|
|
224
|
+
export declare function syncCatalogs(cfg: ResolvedConfig, catalogs: Catalogs, registry: MessageRegistry): SyncResult;
|
|
225
|
+
export declare function shippedCatalogs(cfg: ResolvedConfig, catalogs: Catalogs, registry: MessageRegistry, options?: {
|
|
226
|
+
newKeys?: boolean;
|
|
227
|
+
}): Catalogs;
|
|
228
|
+
export declare function pruneCatalogs(cfg: ResolvedConfig, catalogs: Catalogs, registry: MessageRegistry): Record<string, string[]>;
|
|
229
|
+
//#endregion
|
|
230
|
+
//#region src/state.d.ts
|
|
231
|
+
export declare const STATE_FILE = ".verbaly-state.json";
|
|
232
|
+
type Drafts = Record<string, string[]>;
|
|
233
|
+
type Fingerprints = Record<string, Record<string, string>>;
|
|
234
|
+
interface State {
|
|
235
|
+
drafts: Drafts;
|
|
236
|
+
fingerprints: Fingerprints;
|
|
237
|
+
}
|
|
238
|
+
interface OutdatedEntry {
|
|
239
|
+
locale: string;
|
|
146
240
|
key: string;
|
|
147
|
-
message: string;
|
|
148
|
-
params: TaggedParam[];
|
|
149
|
-
start: number;
|
|
150
|
-
end: number;
|
|
151
|
-
tagStart: number;
|
|
152
|
-
tagEnd: number;
|
|
153
|
-
file: string;
|
|
154
|
-
jsx?: {
|
|
155
|
-
name: string;
|
|
156
|
-
components: TransComponent[];
|
|
157
|
-
};
|
|
158
|
-
singleQuote?: boolean;
|
|
159
241
|
}
|
|
160
|
-
interface
|
|
242
|
+
interface StateRead {
|
|
243
|
+
state: State;
|
|
244
|
+
problem?: string;
|
|
245
|
+
}
|
|
246
|
+
interface WrittenTranslation {
|
|
161
247
|
key: string;
|
|
162
|
-
|
|
163
|
-
|
|
248
|
+
text: string;
|
|
249
|
+
source?: string;
|
|
164
250
|
}
|
|
165
|
-
interface
|
|
166
|
-
|
|
167
|
-
|
|
251
|
+
interface TranslationWrite {
|
|
252
|
+
locale: string;
|
|
253
|
+
entries: WrittenTranslation[];
|
|
254
|
+
draft?: boolean;
|
|
255
|
+
}
|
|
256
|
+
export declare function loadState(cfg: ResolvedConfig): State;
|
|
257
|
+
export declare function readState(cfg: ResolvedConfig): StateRead;
|
|
258
|
+
export declare function updateState(cfg: ResolvedConfig, catalogs: Catalogs): State;
|
|
259
|
+
export declare function recordTranslations(cfg: ResolvedConfig, source: Catalog, writes: TranslationWrite[]): State;
|
|
260
|
+
export declare function effectiveDrafts(drafts: Drafts, catalogs: Catalogs): Drafts;
|
|
261
|
+
export declare function markDrafts(drafts: Drafts, locale: string, keys: string[]): void;
|
|
262
|
+
export declare function clearDrafts(drafts: Drafts, locale: string, keys?: string[]): void;
|
|
263
|
+
export declare function outdatedTranslations(cfg: ResolvedConfig, catalogs: Catalogs, fingerprints: Fingerprints): OutdatedEntry[];
|
|
264
|
+
//#endregion
|
|
265
|
+
//#region src/findings.d.ts
|
|
266
|
+
interface SourceSite {
|
|
168
267
|
file: string;
|
|
268
|
+
line?: number;
|
|
269
|
+
message: string;
|
|
169
270
|
}
|
|
170
|
-
interface
|
|
271
|
+
interface CollisionEntry {
|
|
272
|
+
key: string;
|
|
273
|
+
sites: SourceSite[];
|
|
274
|
+
}
|
|
275
|
+
interface ReplacedEntry {
|
|
276
|
+
locale: string;
|
|
277
|
+
key: string;
|
|
278
|
+
before: string;
|
|
279
|
+
site: SourceSite;
|
|
280
|
+
edited?: boolean;
|
|
281
|
+
}
|
|
282
|
+
interface RenamedEntry {
|
|
171
283
|
name: string;
|
|
172
284
|
file: string;
|
|
173
|
-
|
|
285
|
+
line?: number;
|
|
174
286
|
}
|
|
175
|
-
interface
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
strayImports: StrayImport[];
|
|
179
|
-
missed?: MissedCall[];
|
|
180
|
-
parseError?: string;
|
|
287
|
+
interface PositionalEntry {
|
|
288
|
+
params: string[];
|
|
289
|
+
site: SourceSite;
|
|
181
290
|
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
key: string;
|
|
186
|
-
kept: TaggedMessage;
|
|
187
|
-
dropped: TaggedMessage[];
|
|
291
|
+
interface EscapedEntry {
|
|
292
|
+
slice: string;
|
|
293
|
+
site: SourceSite;
|
|
188
294
|
}
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
remove(file: string): void;
|
|
193
|
-
messages(): Map<string, TaggedMessage>;
|
|
194
|
-
collisions(): Collision[];
|
|
195
|
-
usedKeys(strict?: boolean): Map<string, string[]>;
|
|
196
|
-
strayImports(): StrayImport[];
|
|
197
|
-
missed(): MissedCall[];
|
|
198
|
-
parseErrors(): {
|
|
199
|
-
file: string;
|
|
200
|
-
message: string;
|
|
201
|
-
}[];
|
|
202
|
-
origins(): Map<string, string[]>;
|
|
295
|
+
interface UnparsedEntry {
|
|
296
|
+
file: string;
|
|
297
|
+
message: string;
|
|
203
298
|
}
|
|
299
|
+
type Finding = ({
|
|
300
|
+
kind: 'replaced';
|
|
301
|
+
} & ReplacedEntry) | ({
|
|
302
|
+
kind: 'collision';
|
|
303
|
+
} & CollisionEntry) | ({
|
|
304
|
+
kind: 'renamed';
|
|
305
|
+
} & RenamedEntry) | ({
|
|
306
|
+
kind: 'positional';
|
|
307
|
+
} & PositionalEntry) | ({
|
|
308
|
+
kind: 'escaped';
|
|
309
|
+
} & EscapedEntry) | ({
|
|
310
|
+
kind: 'unparsed';
|
|
311
|
+
} & UnparsedEntry) | ({
|
|
312
|
+
kind: 'outdated';
|
|
313
|
+
} & OutdatedEntry);
|
|
314
|
+
export declare function collisionEntries(registry: MessageRegistry): CollisionEntry[];
|
|
315
|
+
export declare function formatCollision({ key, sites }: CollisionEntry, root?: string): string;
|
|
316
|
+
export declare function formatFinding(finding: Finding, root?: string): string;
|
|
317
|
+
interface DevReporter {
|
|
318
|
+
report(channel: string, findings: Finding[]): void;
|
|
319
|
+
}
|
|
320
|
+
export declare function createDevReporter(root: string, print?: (line: string) => void, cap?: number): DevReporter;
|
|
204
321
|
//#endregion
|
|
205
|
-
//#region src/
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
322
|
+
//#region src/project.d.ts
|
|
323
|
+
interface SyncProjectOptions {
|
|
324
|
+
prune?: boolean;
|
|
325
|
+
dryRun?: boolean;
|
|
326
|
+
registry?: MessageRegistry;
|
|
327
|
+
catalogs?: Catalogs;
|
|
328
|
+
confirm?: boolean;
|
|
329
|
+
write?: 'all' | 'changed';
|
|
330
|
+
}
|
|
331
|
+
interface SyncProjectResult {
|
|
332
|
+
registry: MessageRegistry;
|
|
333
|
+
catalogs: Catalogs;
|
|
212
334
|
added: Record<string, string[]>;
|
|
213
|
-
replaced:
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
335
|
+
replaced: ReplacedText[];
|
|
336
|
+
pruned: Record<string, string[]>;
|
|
337
|
+
pruneBlocked: boolean;
|
|
338
|
+
findings: Finding[];
|
|
339
|
+
written: Record<string, string>;
|
|
340
|
+
state?: State;
|
|
341
|
+
stateProblem?: string;
|
|
342
|
+
}
|
|
343
|
+
export declare function syncProject(cfg: ResolvedConfig, options?: SyncProjectOptions): Promise<SyncProjectResult>;
|
|
217
344
|
//#endregion
|
|
218
345
|
//#region src/key.d.ts
|
|
219
346
|
export declare function stableKey(message: string): string;
|
|
@@ -258,23 +385,6 @@ export declare function transformSource(code: string, id: string, registry: Mess
|
|
|
258
385
|
};
|
|
259
386
|
export declare function runBuildGate(cfg: ResolvedConfig, registry: MessageRegistry, failOnMissing?: boolean): void;
|
|
260
387
|
//#endregion
|
|
261
|
-
//#region src/state.d.ts
|
|
262
|
-
export declare const STATE_FILE = ".verbaly-state.json";
|
|
263
|
-
type Drafts = Record<string, string[]>;
|
|
264
|
-
type Fingerprints = Record<string, Record<string, string>>;
|
|
265
|
-
interface State {
|
|
266
|
-
drafts: Drafts;
|
|
267
|
-
fingerprints: Fingerprints;
|
|
268
|
-
}
|
|
269
|
-
interface OutdatedEntry {
|
|
270
|
-
locale: string;
|
|
271
|
-
key: string;
|
|
272
|
-
}
|
|
273
|
-
export declare function loadState(cfg: ResolvedConfig): State;
|
|
274
|
-
export declare function updateState(cfg: ResolvedConfig, catalogs: Catalogs): State;
|
|
275
|
-
export declare function effectiveDrafts(drafts: Drafts, catalogs: Catalogs): Drafts;
|
|
276
|
-
export declare function outdatedTranslations(cfg: ResolvedConfig, catalogs: Catalogs, fingerprints: Fingerprints): OutdatedEntry[];
|
|
277
|
-
//#endregion
|
|
278
388
|
//#region src/validate.d.ts
|
|
279
389
|
type IssueSeverity = 'error' | 'warning';
|
|
280
390
|
interface StructureIssue {
|
|
@@ -305,15 +415,6 @@ interface ExtraEntry {
|
|
|
305
415
|
key: string;
|
|
306
416
|
files: string[];
|
|
307
417
|
}
|
|
308
|
-
interface SourceSite {
|
|
309
|
-
file: string;
|
|
310
|
-
line?: number;
|
|
311
|
-
message: string;
|
|
312
|
-
}
|
|
313
|
-
interface CollisionEntry {
|
|
314
|
-
key: string;
|
|
315
|
-
sites: SourceSite[];
|
|
316
|
-
}
|
|
317
418
|
interface DivergentEntry {
|
|
318
419
|
key: string;
|
|
319
420
|
catalog: string;
|
|
@@ -331,15 +432,14 @@ interface CheckResult {
|
|
|
331
432
|
}
|
|
332
433
|
export declare function check(cfg: ResolvedConfig, catalogs: Catalogs, registry: MessageRegistry, fingerprints?: Fingerprints): CheckResult;
|
|
333
434
|
export declare function formatCheckResult(result: CheckResult, root?: string): string;
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
435
|
+
interface CheckReportOptions {
|
|
436
|
+
outdatedFails?: boolean;
|
|
437
|
+
}
|
|
438
|
+
export declare function formatCheckWarnings(result: CheckResult, root?: string, options?: CheckReportOptions): string;
|
|
337
439
|
//#endregion
|
|
338
440
|
//#region src/drafts.d.ts
|
|
339
441
|
export declare function loadDrafts(cfg: ResolvedConfig): Drafts;
|
|
340
442
|
export declare function saveDrafts(cfg: ResolvedConfig, drafts: Drafts): void;
|
|
341
|
-
export declare function markDrafts(drafts: Drafts, locale: string, keys: string[]): void;
|
|
342
|
-
export declare function clearDrafts(drafts: Drafts, locale: string, keys?: string[]): void;
|
|
343
443
|
//#endregion
|
|
344
444
|
//#region src/status.d.ts
|
|
345
445
|
interface LocaleStatus {
|
|
@@ -463,5 +563,5 @@ interface RenderSiteResult {
|
|
|
463
563
|
export declare function renderSite(cfg: ResolvedConfig, options?: RenderSiteOptions): Promise<RenderSiteResult>;
|
|
464
564
|
export declare function formatRenderWarnings(result: RenderSiteResult, sourceLocale: string): string[];
|
|
465
565
|
//#endregion
|
|
466
|
-
export type { BrokenEntry, BundleConfig, Catalog, Catalogs, CheckResult, CollisionEntry, DivergentEntry, DoctorEntry, DoctorResult, DraftEntry, Drafts, DtsOptions, ExtraEntry, Fingerprints, GlossaryEntry, Host, InitOptions, InitResult, IssueSeverity, LocaleStatus, MissingEntry, OutdatedEntry, PluginOptions, RedirectConfig, RenderConfig, RenderSiteOptions, RenderSiteResult, ResolvedConfig, RuntimeModuleOptions, SourceSite, State, StatusResult, StructureIssue, SyncResult, TransformResult, TranslateConfig, TranslateFailure, TranslateOptions, TranslateProgress, TranslateProvider, TranslateRequest, TranslateResult, TreeOptions, UnknownEntry, VerbalyConfig, WrapBlocked, WrapEntry, WrapOptions, WrapResult, WrapSkip, WriteDraftsResult };
|
|
566
|
+
export type { BrokenEntry, BundleConfig, Catalog, Catalogs, CheckResult, CollisionEntry, DevReporter, DivergentEntry, DoctorEntry, DoctorResult, DraftEntry, Drafts, DtsOptions, ExtraEntry, Finding, Fingerprints, GlossaryEntry, Host, InitOptions, InitResult, IssueSeverity, LocaleStatus, MissingEntry, OutdatedEntry, PluginOptions, RedirectConfig, RenderConfig, RenderSiteOptions, RenderSiteResult, ResolvedConfig, RuntimeModuleOptions, SourceSite, State, StatusResult, StructureIssue, SyncProjectResult, SyncResult, TransformResult, TranslateConfig, TranslateFailure, TranslateOptions, TranslateProgress, TranslateProvider, TranslateRequest, TranslateResult, TranslationWrite, TreeOptions, UnknownEntry, VerbalyConfig, WrapBlocked, WrapEntry, WrapOptions, WrapResult, WrapSkip, WriteDraftsResult };
|
|
467
567
|
//# sourceMappingURL=index.d.ts.map
|