@verbaly/compiler 0.75.0 → 0.77.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/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { RichLink, Routing } from "verbaly";
1
+ import { RichLink, Routing, TrailingSlash } from "verbaly";
2
2
  import MagicString from "magic-string";
3
- //#region src/catalog.d.ts
3
+ type Host = 'nuxt' | 'next' | 'sveltekit' | 'astro' | 'vite' | 'webpack' | 'rspack' | 'rollup' | 'esbuild';
4
4
  type Catalog = Record<string, string>;
5
5
  type Catalogs = Record<string, Catalog>;
6
6
  export declare function readCatalog(cfg: ResolvedConfig, locale: string): Catalog;
@@ -9,8 +9,6 @@ export declare function loadCatalogs(cfg: ResolvedConfig): Catalogs;
9
9
  export declare function writeCatalog(cfg: ResolvedConfig, locale: string, catalog: Catalog): string;
10
10
  export declare function needsIcu(catalogs: Catalogs): boolean;
11
11
  export declare function needsRelative(catalogs: Catalogs): boolean;
12
- //#endregion
13
- //#region src/analyze.d.ts
14
12
  interface TaggedParam {
15
13
  name: string;
16
14
  start: number;
@@ -59,8 +57,6 @@ interface Analysis {
59
57
  missed: MissedCall[];
60
58
  parseError?: string;
61
59
  }
62
- //#endregion
63
- //#region src/registry.d.ts
64
60
  interface Collision {
65
61
  key: string;
66
62
  kept: TaggedMessage;
@@ -82,8 +78,6 @@ export declare class MessageRegistry {
82
78
  origins(): Map<string, string[]>;
83
79
  private inOrder;
84
80
  }
85
- //#endregion
86
- //#region src/translate.d.ts
87
81
  interface TranslateRequest {
88
82
  sourceLocale: string;
89
83
  targetLocale: string;
@@ -140,8 +134,6 @@ interface WriteDraftsOptions {
140
134
  export declare function writeDrafts(cfg: ResolvedConfig, locale: string, entries: DraftEntry[], options?: WriteDraftsOptions): WriteDraftsResult;
141
135
  export declare function formatTranslateFailures(failed: TranslateFailure[]): string[];
142
136
  export declare function resolveProvider(cfg: ResolvedConfig, model?: string): Promise<TranslateProvider>;
143
- //#endregion
144
- //#region src/config.d.ts
145
137
  type GlossaryEntry = string | Record<string, string>;
146
138
  interface TranslateConfig {
147
139
  provider?: 'claude' | TranslateProvider;
@@ -186,6 +178,7 @@ interface VerbalyConfig {
186
178
  translate?: TranslateConfig;
187
179
  render?: RenderConfig;
188
180
  bundle?: BundleConfig;
181
+ trailingSlash?: TrailingSlash;
189
182
  }
190
183
  interface ResolvedConfig {
191
184
  root: string;
@@ -202,17 +195,15 @@ interface ResolvedConfig {
202
195
  translate: TranslateConfig;
203
196
  render: RenderConfig;
204
197
  bundle: BundleConfig;
198
+ host: Host | undefined;
199
+ trailingSlash: TrailingSlash | undefined;
205
200
  }
206
201
  export declare function resolveConfig(config?: VerbalyConfig): ResolvedConfig;
207
202
  export declare function targetLocales(cfg: ResolvedConfig, override?: string[]): string[];
208
203
  export declare function loadConfig(root: string, overrides?: VerbalyConfig, from?: {
209
204
  plugin?: boolean;
210
205
  }): Promise<ResolvedConfig>;
211
- //#endregion
212
- //#region src/bundle.d.ts
213
206
  export declare function clientCatalogs(cfg: ResolvedConfig, catalogs: Catalogs): Catalogs;
214
- //#endregion
215
- //#region src/extract.d.ts
216
207
  export declare function extractProject(cfg: ResolvedConfig, options?: {
217
208
  keepSource?: boolean;
218
209
  }): Promise<MessageRegistry>;
@@ -230,8 +221,6 @@ export declare function shippedCatalogs(cfg: ResolvedConfig, catalogs: Catalogs,
230
221
  newKeys?: boolean;
231
222
  }): Catalogs;
232
223
  export declare function pruneCatalogs(cfg: ResolvedConfig, catalogs: Catalogs, registry: MessageRegistry): Record<string, string[]>;
233
- //#endregion
234
- //#region src/state.d.ts
235
224
  export declare const STATE_FILE = "verbaly.lock";
236
225
  type Drafts = Record<string, string[]>;
237
226
  type Fingerprints = Record<string, Record<string, string>>;
@@ -272,8 +261,6 @@ export declare function effectiveDrafts(drafts: Drafts, catalogs: Catalogs): Dra
272
261
  export declare function markDrafts(drafts: Drafts, locale: string, keys: string[]): void;
273
262
  export declare function clearDrafts(drafts: Drafts, locale: string, keys?: string[]): void;
274
263
  export declare function outdatedTranslations(cfg: ResolvedConfig, catalogs: Catalogs, fingerprints: Fingerprints): OutdatedEntry[];
275
- //#endregion
276
- //#region src/findings.d.ts
277
264
  interface SourceSite {
278
265
  file: string;
279
266
  line?: number;
@@ -331,8 +318,6 @@ interface DevReporter {
331
318
  report(channel: string, findings: Finding[]): void;
332
319
  }
333
320
  export declare function createDevReporter(root: string, print?: (line: string) => void, cap?: number): DevReporter;
334
- //#endregion
335
- //#region src/project.d.ts
336
321
  interface SyncProjectOptions {
337
322
  prune?: boolean;
338
323
  dryRun?: boolean;
@@ -344,6 +329,8 @@ interface SyncProjectOptions {
344
329
  interface SyncProjectResult {
345
330
  registry: MessageRegistry;
346
331
  catalogs: Catalogs;
332
+ messages: number;
333
+ inCode: number;
347
334
  added: Record<string, string[]>;
348
335
  replaced: ReplacedText[];
349
336
  pruned: Record<string, string[]>;
@@ -354,11 +341,7 @@ interface SyncProjectResult {
354
341
  stateProblem?: string;
355
342
  }
356
343
  export declare function syncProject(cfg: ResolvedConfig, options?: SyncProjectOptions): Promise<SyncProjectResult>;
357
- //#endregion
358
- //#region src/key.d.ts
359
344
  export declare function stableKey(message: string): string;
360
- //#endregion
361
- //#region src/codegen.d.ts
362
345
  interface RuntimeModuleOptions {
363
346
  localeImport?: (locale: string) => string;
364
347
  extraExports?: string;
@@ -378,17 +361,14 @@ interface DtsWrite {
378
361
  changed: boolean;
379
362
  }
380
363
  export declare function writeDts(cfg: ResolvedConfig, catalog: Catalog, file?: string | false): DtsWrite | undefined;
381
- //#endregion
382
- //#region src/transform.d.ts
383
364
  interface TransformResult {
384
365
  code: string;
385
366
  map: ReturnType<MagicString['generateMap']>;
386
367
  }
387
368
  export declare function transformCode(code: string, file: string, analysis?: Analysis): TransformResult | null;
388
- //#endregion
389
- //#region src/plugin.d.ts
390
369
  interface PluginOptions extends VerbalyConfig {
391
370
  failOnMissing?: boolean;
371
+ liveExtraction?: boolean;
392
372
  }
393
373
  export declare const RESOLVED_VIRTUAL_ID: string;
394
374
  export declare const LOCALE_MODULE_PREFIX = "\0virtual:verbaly/locale/";
@@ -402,11 +382,7 @@ export declare function transformSource(code: string, id: string, registry: Mess
402
382
  result: TransformResult | null;
403
383
  };
404
384
  export declare function runBuildGate(cfg: ResolvedConfig, registry: MessageRegistry, failOnMissing?: boolean): void;
405
- //#endregion
406
- //#region src/scope.d.ts
407
385
  export declare function reportOutsideInclude(cfg: ResolvedConfig): Promise<void>;
408
- //#endregion
409
- //#region src/validate.d.ts
410
386
  type IssueSeverity = 'error' | 'warning';
411
387
  interface StructureIssue {
412
388
  severity: IssueSeverity;
@@ -414,8 +390,6 @@ interface StructureIssue {
414
390
  }
415
391
  export declare function validateMessage(message: string, locale?: string): StructureIssue[];
416
392
  export declare function validatePair(source: string, translated: string): StructureIssue[];
417
- //#endregion
418
- //#region src/check.d.ts
419
393
  interface MissingEntry {
420
394
  locale: string;
421
395
  key: string;
@@ -457,12 +431,8 @@ interface CheckReportOptions {
457
431
  outdatedFails?: boolean;
458
432
  }
459
433
  export declare function formatCheckWarnings(result: CheckResult, root?: string, options?: CheckReportOptions): string;
460
- //#endregion
461
- //#region src/drafts.d.ts
462
434
  export declare function loadDrafts(cfg: ResolvedConfig): Drafts;
463
435
  export declare function saveDrafts(cfg: ResolvedConfig, drafts: Drafts): void;
464
- //#endregion
465
- //#region src/status.d.ts
466
436
  interface LocaleStatus {
467
437
  locale: string;
468
438
  translated: number;
@@ -478,22 +448,14 @@ interface StatusResult {
478
448
  }
479
449
  export declare function status(cfg: ResolvedConfig, catalogs: Catalogs, registry: MessageRegistry, drafts?: Drafts, fingerprints?: Fingerprints): StatusResult;
480
450
  export declare function formatStatusResult(result: StatusResult): string;
481
- //#endregion
482
- //#region src/text.d.ts
483
451
  export declare function counted(count: number, noun: string, many?: string): string;
484
- //#endregion
485
- //#region src/run.d.ts
486
452
  export declare function formatCliError(error: unknown): string;
487
- //#endregion
488
- //#region src/watch.d.ts
489
453
  interface TreeOptions {
490
454
  keep?: string;
491
455
  native?: boolean;
492
456
  persistent?: boolean;
493
457
  }
494
458
  export declare function watchTree(root: string, options: TreeOptions, onFile: (file: string) => void): () => void;
495
- //#endregion
496
- //#region src/doctor.d.ts
497
459
  interface DoctorEntry {
498
460
  level: 'ok' | 'warn' | 'error';
499
461
  check: string;
@@ -507,11 +469,6 @@ interface DoctorResult {
507
469
  export declare function formatDoctorEntry(entry: DoctorEntry): string;
508
470
  export declare function formatDoctorHealth(result: DoctorResult): string;
509
471
  export declare function doctor(cfg: ResolvedConfig): Promise<DoctorResult>;
510
- //#endregion
511
- //#region src/host.d.ts
512
- type Host = 'nuxt' | 'next' | 'sveltekit' | 'astro' | 'vite' | 'webpack' | 'rspack' | 'rollup' | 'esbuild';
513
- //#endregion
514
- //#region src/init.d.ts
515
472
  interface InitOptions {
516
473
  root?: string;
517
474
  dir?: string;
@@ -532,8 +489,6 @@ interface InitResult {
532
489
  found?: string;
533
490
  }
534
491
  export declare function init(input?: InitOptions): Promise<InitResult>;
535
- //#endregion
536
- //#region src/wrap.d.ts
537
492
  interface WrapEntry {
538
493
  file: string;
539
494
  line: number;
@@ -563,8 +518,6 @@ interface WrapOptions {
563
518
  write?: boolean;
564
519
  }
565
520
  export declare function wrapProject(cfg: ResolvedConfig, options?: WrapOptions): Promise<WrapResult>;
566
- //#endregion
567
- //#region src/render.d.ts
568
521
  interface RenderSiteOptions {
569
522
  site?: string;
570
523
  locales?: string[];
@@ -587,6 +540,4 @@ interface RenderSiteResult {
587
540
  }
588
541
  export declare function renderSite(cfg: ResolvedConfig, options?: RenderSiteOptions): Promise<RenderSiteResult>;
589
542
  export declare function formatRenderWarnings(result: RenderSiteResult, sourceLocale: string): string[];
590
- //#endregion
591
- 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 };
592
- //# sourceMappingURL=index.d.ts.map
543
+ 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 };