@verbaly/compiler 0.13.0 → 0.13.1

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.
Files changed (2) hide show
  1. package/README.md +7 -7
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -15,9 +15,9 @@ The compiler behind [Verbaly](https://github.com/AronSoto/verbaly): AST extracti
15
15
 
16
16
  > Most projects don't install this directly — [`@verbaly/vite`](https://www.npmjs.com/package/@verbaly/vite) wraps it with zero config. Reach for it when scripting extraction/checks yourself.
17
17
 
18
- ## CLI
18
+ ## 🧰 CLI
19
19
 
20
- ```bash
20
+ ```
21
21
  npx verbaly init # scaffold config + locale catalogs (detects your bundler)
22
22
  npx verbaly doctor # diagnose the setup (config, catalogs, plugin, types, keys)
23
23
  npx verbaly extract # sync catalogs + types
@@ -30,30 +30,30 @@ npx verbaly render # pre-fill data-verbaly HTML per locale (SSG — kill
30
30
 
31
31
  Reads `verbaly.config.{js,mjs,ts,mts,json}` (TS configs need `esbuild` installed). Generates `locales/<locale>.json` (flat, portable — no proprietary format) and `verbaly.d.ts` with params typed per key.
32
32
 
33
- ## Machine translation
33
+ ## 🤖 Machine translation
34
34
 
35
35
  `verbaly translate` fills the `""` holes `check` reports. The default provider uses Claude via the official SDK — install it as a dev dependency (translation is a build-time step, not an app runtime dependency): `pnpm add -D @anthropic-ai/sdk` (or `npm i -D`), plus `ANTHROPIC_API_KEY`. Default model is `claude-sonnet-5` (balanced quality/cost); override with `translate.model` in config or `--model <id>`. Placeholders, variants and tags are validated after translation — anything not preserved verbatim stays `""` so `check` keeps failing. Plug your own provider in `verbaly.config.ts`:
36
36
 
37
- ```ts
37
+ ```
38
38
  translate: {
39
39
  provider: async ({ sourceLocale, targetLocale, messages }) => ({ ...translated });
40
40
  }
41
41
  ```
42
42
 
43
- ## Static rendering (SSG)
43
+ ## 📄 Static rendering (SSG)
44
44
 
45
45
  `verbaly render` walks your built site (`dist/` by default, `--site <path>` to change) and pre-fills every `data-verbaly` element **per locale** using the real runtime — plurals, `Intl` formatting, `data-verbaly-args`, attribute translation and `data-verbaly-rich` (same whitelist, XSS-safe). The source locale is filled in place; every other locale is mirrored to `dist/<locale>/…` with `<html lang>` set. Static HTML ships already translated — **no flash of untranslated content** — and the runtime attributes stay put, so client-side locale switching keeps working.
46
46
 
47
47
  Named links in rich messages render as real `<a>` elements — hrefs come from config or markup, never from messages (`javascript:` blocked):
48
48
 
49
- ```ts
49
+ ```
50
50
  // verbaly.config.ts
51
51
  render: { links: { docs: { href: '/docs', target: '_blank', rel: 'noopener' } } }
52
52
  ```
53
53
 
54
54
  Per-element `data-verbaly-links='{"repo":"https://…"}'` merges over the config map.
55
55
 
56
- ## Pseudo-localization
56
+ ## 🔍 Pseudo-localization
57
57
 
58
58
  `verbaly pseudo` fills a QA catalog (`en-XA` by default, `--locale <id>` to change) from the source: accented letters, `⟦…⟧` markers and ~33% length padding reveal hardcoded strings, clipped layouts and concatenation bugs. Params, variant blocks and tags survive verbatim — the same structural validation as `translate`.
59
59
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@verbaly/compiler",
3
- "version": "0.13.0",
3
+ "version": "0.13.1",
4
4
  "description": "Message extraction and type-safe codegen for Verbaly.",
5
5
  "keywords": [
6
6
  "i18n",
@@ -46,7 +46,7 @@
46
46
  "bundle-require": "^5.1.0",
47
47
  "magic-string": "^0.30.21",
48
48
  "tinyglobby": "^0.2.17",
49
- "verbaly": "0.13.0"
49
+ "verbaly": "0.13.1"
50
50
  },
51
51
  "peerDependencies": {
52
52
  "@anthropic-ai/sdk": ">=0.110.0",