@verbaly/compiler 0.66.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 +50 -7
- 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 +2097 -1372
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +224 -63
- package/dist/index.js +817 -125
- 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 +3 -3
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;
|
|
@@ -50,6 +123,21 @@ interface TranslateResult {
|
|
|
50
123
|
}
|
|
51
124
|
export declare function translateCatalogs(cfg: ResolvedConfig, catalogs: Catalogs, provider: TranslateProvider, options?: TranslateOptions): Promise<TranslateResult>;
|
|
52
125
|
export declare function mergeTranslations(cfg: ResolvedConfig, locale: string, translated: Catalog, keys: string[]): string[];
|
|
126
|
+
interface DraftEntry {
|
|
127
|
+
key: string;
|
|
128
|
+
text: string;
|
|
129
|
+
}
|
|
130
|
+
interface WriteDraftsResult {
|
|
131
|
+
written: string[];
|
|
132
|
+
kept: string[];
|
|
133
|
+
invalid: string[];
|
|
134
|
+
unknown: string[];
|
|
135
|
+
}
|
|
136
|
+
interface WriteDraftsOptions {
|
|
137
|
+
overwrite?: boolean;
|
|
138
|
+
registry?: MessageRegistry;
|
|
139
|
+
}
|
|
140
|
+
export declare function writeDrafts(cfg: ResolvedConfig, locale: string, entries: DraftEntry[], options?: WriteDraftsOptions): WriteDraftsResult;
|
|
53
141
|
export declare function formatTranslateFailures(failed: TranslateFailure[]): string[];
|
|
54
142
|
export declare function resolveProvider(cfg: ResolvedConfig, model?: string): Promise<TranslateProvider>;
|
|
55
143
|
//#endregion
|
|
@@ -119,74 +207,140 @@ export declare function resolveConfig(config?: VerbalyConfig): ResolvedConfig;
|
|
|
119
207
|
export declare function targetLocales(cfg: ResolvedConfig, override?: string[]): string[];
|
|
120
208
|
export declare function loadConfig(root: string, overrides?: VerbalyConfig): Promise<ResolvedConfig>;
|
|
121
209
|
//#endregion
|
|
122
|
-
//#region src/
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
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;
|
|
127
219
|
}
|
|
128
|
-
interface
|
|
129
|
-
|
|
130
|
-
|
|
220
|
+
interface SyncResult {
|
|
221
|
+
added: Record<string, string[]>;
|
|
222
|
+
replaced: ReplacedText[];
|
|
131
223
|
}
|
|
132
|
-
|
|
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;
|
|
133
240
|
key: string;
|
|
134
|
-
message: string;
|
|
135
|
-
params: TaggedParam[];
|
|
136
|
-
start: number;
|
|
137
|
-
end: number;
|
|
138
|
-
tagStart: number;
|
|
139
|
-
tagEnd: number;
|
|
140
|
-
file: string;
|
|
141
|
-
jsx?: {
|
|
142
|
-
name: string;
|
|
143
|
-
components: TransComponent[];
|
|
144
|
-
};
|
|
145
|
-
singleQuote?: boolean;
|
|
146
241
|
}
|
|
147
|
-
interface
|
|
242
|
+
interface StateRead {
|
|
243
|
+
state: State;
|
|
244
|
+
problem?: string;
|
|
245
|
+
}
|
|
246
|
+
interface WrittenTranslation {
|
|
148
247
|
key: string;
|
|
248
|
+
text: string;
|
|
249
|
+
source?: string;
|
|
250
|
+
}
|
|
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 {
|
|
149
267
|
file: string;
|
|
150
|
-
|
|
268
|
+
line?: number;
|
|
269
|
+
message: string;
|
|
151
270
|
}
|
|
152
|
-
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 {
|
|
153
283
|
name: string;
|
|
154
|
-
source: string;
|
|
155
284
|
file: string;
|
|
285
|
+
line?: number;
|
|
156
286
|
}
|
|
157
|
-
interface
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
strayImports: StrayImport[];
|
|
161
|
-
parseError?: string;
|
|
287
|
+
interface PositionalEntry {
|
|
288
|
+
params: string[];
|
|
289
|
+
site: SourceSite;
|
|
162
290
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
private files;
|
|
167
|
-
update(file: string, analysis: Analysis): void;
|
|
168
|
-
remove(file: string): void;
|
|
169
|
-
messages(): Map<string, TaggedMessage>;
|
|
170
|
-
usedKeys(strict?: boolean): Map<string, string[]>;
|
|
171
|
-
strayImports(): StrayImport[];
|
|
172
|
-
parseErrors(): {
|
|
173
|
-
file: string;
|
|
174
|
-
message: string;
|
|
175
|
-
}[];
|
|
176
|
-
origins(): Map<string, string[]>;
|
|
291
|
+
interface EscapedEntry {
|
|
292
|
+
slice: string;
|
|
293
|
+
site: SourceSite;
|
|
177
294
|
}
|
|
295
|
+
interface UnparsedEntry {
|
|
296
|
+
file: string;
|
|
297
|
+
message: string;
|
|
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;
|
|
178
321
|
//#endregion
|
|
179
|
-
//#region src/
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
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;
|
|
186
334
|
added: Record<string, string[]>;
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
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>;
|
|
190
344
|
//#endregion
|
|
191
345
|
//#region src/key.d.ts
|
|
192
346
|
export declare function stableKey(message: string): string;
|
|
@@ -261,25 +415,31 @@ interface ExtraEntry {
|
|
|
261
415
|
key: string;
|
|
262
416
|
files: string[];
|
|
263
417
|
}
|
|
418
|
+
interface DivergentEntry {
|
|
419
|
+
key: string;
|
|
420
|
+
catalog: string;
|
|
421
|
+
code: SourceSite;
|
|
422
|
+
}
|
|
264
423
|
interface CheckResult {
|
|
265
424
|
ok: boolean;
|
|
266
425
|
missing: MissingEntry[];
|
|
267
426
|
unknown: UnknownEntry[];
|
|
268
427
|
broken: BrokenEntry[];
|
|
269
428
|
extra: ExtraEntry[];
|
|
429
|
+
collisions: CollisionEntry[];
|
|
430
|
+
divergent: DivergentEntry[];
|
|
431
|
+
outdated: OutdatedEntry[];
|
|
270
432
|
}
|
|
271
|
-
export declare function check(cfg: ResolvedConfig, catalogs: Catalogs, registry: MessageRegistry): CheckResult;
|
|
433
|
+
export declare function check(cfg: ResolvedConfig, catalogs: Catalogs, registry: MessageRegistry, fingerprints?: Fingerprints): CheckResult;
|
|
272
434
|
export declare function formatCheckResult(result: CheckResult, root?: string): string;
|
|
273
|
-
|
|
435
|
+
interface CheckReportOptions {
|
|
436
|
+
outdatedFails?: boolean;
|
|
437
|
+
}
|
|
438
|
+
export declare function formatCheckWarnings(result: CheckResult, root?: string, options?: CheckReportOptions): string;
|
|
274
439
|
//#endregion
|
|
275
440
|
//#region src/drafts.d.ts
|
|
276
|
-
export declare const DRAFTS_FILE = ".verbaly-drafts.json";
|
|
277
|
-
type Drafts = Record<string, string[]>;
|
|
278
441
|
export declare function loadDrafts(cfg: ResolvedConfig): Drafts;
|
|
279
442
|
export declare function saveDrafts(cfg: ResolvedConfig, drafts: Drafts): void;
|
|
280
|
-
export declare function markDrafts(drafts: Drafts, locale: string, keys: string[]): void;
|
|
281
|
-
export declare function clearDrafts(drafts: Drafts, locale: string, keys?: string[]): void;
|
|
282
|
-
export declare function effectiveDrafts(drafts: Drafts, catalogs: Catalogs): Drafts;
|
|
283
443
|
//#endregion
|
|
284
444
|
//#region src/status.d.ts
|
|
285
445
|
interface LocaleStatus {
|
|
@@ -288,13 +448,14 @@ interface LocaleStatus {
|
|
|
288
448
|
total: number;
|
|
289
449
|
drafts: number;
|
|
290
450
|
broken: number;
|
|
451
|
+
outdated: number;
|
|
291
452
|
}
|
|
292
453
|
interface StatusResult {
|
|
293
454
|
messages: number;
|
|
294
455
|
source: string;
|
|
295
456
|
locales: LocaleStatus[];
|
|
296
457
|
}
|
|
297
|
-
export declare function status(cfg: ResolvedConfig, catalogs: Catalogs, registry: MessageRegistry, drafts?: Drafts): StatusResult;
|
|
458
|
+
export declare function status(cfg: ResolvedConfig, catalogs: Catalogs, registry: MessageRegistry, drafts?: Drafts, fingerprints?: Fingerprints): StatusResult;
|
|
298
459
|
export declare function formatStatusResult(result: StatusResult): string;
|
|
299
460
|
//#endregion
|
|
300
461
|
//#region src/text.d.ts
|
|
@@ -402,5 +563,5 @@ interface RenderSiteResult {
|
|
|
402
563
|
export declare function renderSite(cfg: ResolvedConfig, options?: RenderSiteOptions): Promise<RenderSiteResult>;
|
|
403
564
|
export declare function formatRenderWarnings(result: RenderSiteResult, sourceLocale: string): string[];
|
|
404
565
|
//#endregion
|
|
405
|
-
export type { BrokenEntry, BundleConfig, Catalog, Catalogs, CheckResult, DoctorEntry, DoctorResult, Drafts, DtsOptions, ExtraEntry, GlossaryEntry, Host, InitOptions, InitResult, IssueSeverity, LocaleStatus, MissingEntry, PluginOptions, RedirectConfig, RenderConfig, RenderSiteOptions, RenderSiteResult, ResolvedConfig, RuntimeModuleOptions, StatusResult, StructureIssue, SyncResult, TransformResult, TranslateConfig, TranslateFailure, TranslateOptions, TranslateProgress, TranslateProvider, TranslateRequest, TranslateResult, TreeOptions, UnknownEntry, VerbalyConfig, WrapBlocked, WrapEntry, WrapOptions, WrapResult, WrapSkip };
|
|
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 };
|
|
406
567
|
//# sourceMappingURL=index.d.ts.map
|