@verbaly/compiler 0.66.0 → 0.67.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 +45 -6
- package/dist/cli.js +554 -152
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +68 -7
- package/dist/index.js +439 -77
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -50,6 +50,19 @@ interface TranslateResult {
|
|
|
50
50
|
}
|
|
51
51
|
export declare function translateCatalogs(cfg: ResolvedConfig, catalogs: Catalogs, provider: TranslateProvider, options?: TranslateOptions): Promise<TranslateResult>;
|
|
52
52
|
export declare function mergeTranslations(cfg: ResolvedConfig, locale: string, translated: Catalog, keys: string[]): string[];
|
|
53
|
+
interface DraftEntry {
|
|
54
|
+
key: string;
|
|
55
|
+
text: string;
|
|
56
|
+
}
|
|
57
|
+
interface WriteDraftsResult {
|
|
58
|
+
written: string[];
|
|
59
|
+
kept: string[];
|
|
60
|
+
invalid: string[];
|
|
61
|
+
unknown: string[];
|
|
62
|
+
}
|
|
63
|
+
export declare function writeDrafts(cfg: ResolvedConfig, locale: string, entries: DraftEntry[], options?: {
|
|
64
|
+
overwrite?: boolean;
|
|
65
|
+
}): WriteDraftsResult;
|
|
53
66
|
export declare function formatTranslateFailures(failed: TranslateFailure[]): string[];
|
|
54
67
|
export declare function resolveProvider(cfg: ResolvedConfig, model?: string): Promise<TranslateProvider>;
|
|
55
68
|
//#endregion
|
|
@@ -154,21 +167,34 @@ interface StrayImport {
|
|
|
154
167
|
source: string;
|
|
155
168
|
file: string;
|
|
156
169
|
}
|
|
170
|
+
interface MissedCall {
|
|
171
|
+
name: string;
|
|
172
|
+
file: string;
|
|
173
|
+
start: number;
|
|
174
|
+
}
|
|
157
175
|
interface Analysis {
|
|
158
176
|
tagged: TaggedMessage[];
|
|
159
177
|
usedKeys: UsedKey[];
|
|
160
178
|
strayImports: StrayImport[];
|
|
179
|
+
missed?: MissedCall[];
|
|
161
180
|
parseError?: string;
|
|
162
181
|
}
|
|
163
182
|
//#endregion
|
|
164
183
|
//#region src/registry.d.ts
|
|
184
|
+
interface Collision {
|
|
185
|
+
key: string;
|
|
186
|
+
kept: TaggedMessage;
|
|
187
|
+
dropped: TaggedMessage[];
|
|
188
|
+
}
|
|
165
189
|
export declare class MessageRegistry {
|
|
166
190
|
private files;
|
|
167
191
|
update(file: string, analysis: Analysis): void;
|
|
168
192
|
remove(file: string): void;
|
|
169
193
|
messages(): Map<string, TaggedMessage>;
|
|
194
|
+
collisions(): Collision[];
|
|
170
195
|
usedKeys(strict?: boolean): Map<string, string[]>;
|
|
171
196
|
strayImports(): StrayImport[];
|
|
197
|
+
missed(): MissedCall[];
|
|
172
198
|
parseErrors(): {
|
|
173
199
|
file: string;
|
|
174
200
|
message: string;
|
|
@@ -184,6 +210,7 @@ export declare function extractProject(cfg: ResolvedConfig): Promise<MessageRegi
|
|
|
184
210
|
export declare function collectOrigins(cfg: ResolvedConfig, reuse?: MessageRegistry): Promise<Record<string, string[]>>;
|
|
185
211
|
interface SyncResult {
|
|
186
212
|
added: Record<string, string[]>;
|
|
213
|
+
replaced: string[];
|
|
187
214
|
}
|
|
188
215
|
export declare function syncCatalogs(cfg: ResolvedConfig, catalogs: Catalogs, registry: MessageRegistry): SyncResult;
|
|
189
216
|
export declare function pruneCatalogs(cfg: ResolvedConfig, catalogs: Catalogs, registry: MessageRegistry): Record<string, string[]>;
|
|
@@ -231,6 +258,23 @@ export declare function transformSource(code: string, id: string, registry: Mess
|
|
|
231
258
|
};
|
|
232
259
|
export declare function runBuildGate(cfg: ResolvedConfig, registry: MessageRegistry, failOnMissing?: boolean): void;
|
|
233
260
|
//#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
|
|
234
278
|
//#region src/validate.d.ts
|
|
235
279
|
type IssueSeverity = 'error' | 'warning';
|
|
236
280
|
interface StructureIssue {
|
|
@@ -261,25 +305,41 @@ interface ExtraEntry {
|
|
|
261
305
|
key: string;
|
|
262
306
|
files: string[];
|
|
263
307
|
}
|
|
308
|
+
interface SourceSite {
|
|
309
|
+
file: string;
|
|
310
|
+
line?: number;
|
|
311
|
+
message: string;
|
|
312
|
+
}
|
|
313
|
+
interface CollisionEntry {
|
|
314
|
+
key: string;
|
|
315
|
+
sites: SourceSite[];
|
|
316
|
+
}
|
|
317
|
+
interface DivergentEntry {
|
|
318
|
+
key: string;
|
|
319
|
+
catalog: string;
|
|
320
|
+
code: SourceSite;
|
|
321
|
+
}
|
|
264
322
|
interface CheckResult {
|
|
265
323
|
ok: boolean;
|
|
266
324
|
missing: MissingEntry[];
|
|
267
325
|
unknown: UnknownEntry[];
|
|
268
326
|
broken: BrokenEntry[];
|
|
269
327
|
extra: ExtraEntry[];
|
|
328
|
+
collisions: CollisionEntry[];
|
|
329
|
+
divergent: DivergentEntry[];
|
|
330
|
+
outdated: OutdatedEntry[];
|
|
270
331
|
}
|
|
271
|
-
export declare function check(cfg: ResolvedConfig, catalogs: Catalogs, registry: MessageRegistry): CheckResult;
|
|
332
|
+
export declare function check(cfg: ResolvedConfig, catalogs: Catalogs, registry: MessageRegistry, fingerprints?: Fingerprints): CheckResult;
|
|
272
333
|
export declare function formatCheckResult(result: CheckResult, root?: string): string;
|
|
273
|
-
export declare function
|
|
334
|
+
export declare function collisionEntries(registry: MessageRegistry, locate?: (file: string, offset: number) => number | undefined): CollisionEntry[];
|
|
335
|
+
export declare function formatCollision({ key, sites }: CollisionEntry, root?: string): string;
|
|
336
|
+
export declare function formatCheckWarnings(result: CheckResult, root?: string): string;
|
|
274
337
|
//#endregion
|
|
275
338
|
//#region src/drafts.d.ts
|
|
276
|
-
export declare const DRAFTS_FILE = ".verbaly-drafts.json";
|
|
277
|
-
type Drafts = Record<string, string[]>;
|
|
278
339
|
export declare function loadDrafts(cfg: ResolvedConfig): Drafts;
|
|
279
340
|
export declare function saveDrafts(cfg: ResolvedConfig, drafts: Drafts): void;
|
|
280
341
|
export declare function markDrafts(drafts: Drafts, locale: string, keys: string[]): void;
|
|
281
342
|
export declare function clearDrafts(drafts: Drafts, locale: string, keys?: string[]): void;
|
|
282
|
-
export declare function effectiveDrafts(drafts: Drafts, catalogs: Catalogs): Drafts;
|
|
283
343
|
//#endregion
|
|
284
344
|
//#region src/status.d.ts
|
|
285
345
|
interface LocaleStatus {
|
|
@@ -288,13 +348,14 @@ interface LocaleStatus {
|
|
|
288
348
|
total: number;
|
|
289
349
|
drafts: number;
|
|
290
350
|
broken: number;
|
|
351
|
+
outdated: number;
|
|
291
352
|
}
|
|
292
353
|
interface StatusResult {
|
|
293
354
|
messages: number;
|
|
294
355
|
source: string;
|
|
295
356
|
locales: LocaleStatus[];
|
|
296
357
|
}
|
|
297
|
-
export declare function status(cfg: ResolvedConfig, catalogs: Catalogs, registry: MessageRegistry, drafts?: Drafts): StatusResult;
|
|
358
|
+
export declare function status(cfg: ResolvedConfig, catalogs: Catalogs, registry: MessageRegistry, drafts?: Drafts, fingerprints?: Fingerprints): StatusResult;
|
|
298
359
|
export declare function formatStatusResult(result: StatusResult): string;
|
|
299
360
|
//#endregion
|
|
300
361
|
//#region src/text.d.ts
|
|
@@ -402,5 +463,5 @@ interface RenderSiteResult {
|
|
|
402
463
|
export declare function renderSite(cfg: ResolvedConfig, options?: RenderSiteOptions): Promise<RenderSiteResult>;
|
|
403
464
|
export declare function formatRenderWarnings(result: RenderSiteResult, sourceLocale: string): string[];
|
|
404
465
|
//#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 };
|
|
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 };
|
|
406
467
|
//# sourceMappingURL=index.d.ts.map
|