@verbaly/compiler 0.74.0 → 0.75.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
@@ -205,7 +205,9 @@ interface ResolvedConfig {
205
205
  }
206
206
  export declare function resolveConfig(config?: VerbalyConfig): ResolvedConfig;
207
207
  export declare function targetLocales(cfg: ResolvedConfig, override?: string[]): string[];
208
- export declare function loadConfig(root: string, overrides?: VerbalyConfig): Promise<ResolvedConfig>;
208
+ export declare function loadConfig(root: string, overrides?: VerbalyConfig, from?: {
209
+ plugin?: boolean;
210
+ }): Promise<ResolvedConfig>;
209
211
  //#endregion
210
212
  //#region src/bundle.d.ts
211
213
  export declare function clientCatalogs(cfg: ResolvedConfig, catalogs: Catalogs): Catalogs;
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as findConfigFile, c as loadConfigFile, d as WIRING_PACKAGES, f as detectHost, i as SOURCE_EXTENSIONS, l as resolveConfig, m as readDependencies, n as counted, p as installCommand, r as truncate, s as loadConfig, t as byCodeUnit, u as targetLocales } from "./text-BMBWE8tL.js";
1
+ import { a as findConfigFile, c as loadConfigFile, d as warnOnce, f as warnParseError, g as readDependencies, h as installCommand, i as SOURCE_EXTENSIONS, l as resolveConfig, m as detectHost, n as counted, p as WIRING_PACKAGES, r as truncate, s as loadConfig, t as byCodeUnit, u as targetLocales } from "./text-BtTS6qL7.js";
2
2
  import { existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, rmSync, watch, writeFileSync } from "node:fs";
3
3
  import { dirname, join, relative, resolve, sep } from "node:path";
4
4
  import { CATALOG_SCRIPT, LOCALE_STORAGE_KEY, RICH_TAGS, VOID_TAGS, alternateLinks, createVerbaly, flatten, localeDirection, normalizeLink, parse, parseIcu, parseTags, safeAttribute } from "verbaly";
@@ -752,11 +752,14 @@ function tokenText(token) {
752
752
  }
753
753
  function blockEnd(tokens, start, pairs) {
754
754
  let depth = 0;
755
+ let head = true;
755
756
  for (let k = start; k < tokens.length; k++) {
756
757
  const token = tokens[k];
757
758
  if (typeof token !== "string") {
758
759
  if (token.head) depth += 1;
759
- } else if (token === "{" || token === "}") {
760
+ } else if (token === "|" && depth === 1) head = false;
761
+ else if (token === "}" && head && depth === 1) return k;
762
+ else if (token === "{" || token === "}") {
760
763
  if (tokens[k + 1] === token && (token === "{" || !(pairs && depth > 1))) k += 1;
761
764
  else {
762
765
  depth += token === "{" ? 1 : -1;
@@ -1396,17 +1399,6 @@ function includeTypes(root, file) {
1396
1399
  writeFileSync(read.path, applyEdits(read.text, edits));
1397
1400
  return "added";
1398
1401
  }
1399
- //#endregion
1400
- //#region src/warn.ts
1401
- const warned = /* @__PURE__ */ new Set();
1402
- function warnOnce(message, dedupeKey = message) {
1403
- if (warned.has(dedupeKey)) return;
1404
- warned.add(dedupeKey);
1405
- console.warn(`[verbaly] ${message}`);
1406
- }
1407
- function warnParseError(file, message) {
1408
- warnOnce(`${file}: could not be parsed (${message}), its messages were not extracted`);
1409
- }
1410
1402
  const DTS_HEADER = "// generated by verbaly: do not edit";
1411
1403
  const SLICE_HELPERS = `function readSlice(root, path) {
1412
1404
  const locale = readPath({ supported: locales, path });
@@ -1657,7 +1649,8 @@ function removeRootDts(cfg, target) {
1657
1649
  }
1658
1650
  if (head !== "// generated by verbaly: do not edit") return;
1659
1651
  rmSync(old);
1660
- warnOnce(`the types live in ${relative(cfg.root, target).replaceAll("\\", "/")} now, so the verbaly.d.ts Verbaly wrote at the root was removed`);
1652
+ const moved = relative(cfg.root, target).replaceAll("\\", "/");
1653
+ warnOnce(`the types live in ${moved} now, so the verbaly.d.ts Verbaly wrote at the root was removed`);
1661
1654
  }
1662
1655
  //#endregion
1663
1656
  //#region src/findings.ts
@@ -3153,7 +3146,7 @@ function formatTranslateFailures(failed) {
3153
3146
  async function resolveProvider(cfg, model) {
3154
3147
  const configured = cfg.translate.provider;
3155
3148
  if (typeof configured === "function") return configured;
3156
- const { claudeProvider } = await import("./claude-Baoc6pYL.js");
3149
+ const { claudeProvider } = await import("./claude-DcV4YBbO.js");
3157
3150
  return claudeProvider({ model: model ?? cfg.translate.model });
3158
3151
  }
3159
3152
  function structureMatches(source, translated) {