@verbaly/vite 0.77.0 → 0.78.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 +3 -2
- package/dist/index.js +2 -2
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
---
|
|
13
13
|
|
|
14
|
-
The Vite plugin for [Verbaly](https://github.com/AronSoto/verbaly). Write natural text in your code; on save it extracts stable keys, syncs per-locale JSON catalogs, generates
|
|
14
|
+
The Vite plugin for [Verbaly](https://github.com/AronSoto/verbaly). Write natural text in your code; on save it extracts stable keys, syncs per-locale JSON catalogs, generates `verbaly/app` (your project's typed module), and tells you in every build what `verbaly check` would fail on.
|
|
15
15
|
|
|
16
16
|
## 🚀 Install
|
|
17
17
|
|
|
@@ -37,9 +37,10 @@ export default { sourceLocale: 'en', locales: ['en', 'es', 'pt'] };
|
|
|
37
37
|
|
|
38
38
|
```ts
|
|
39
39
|
// anywhere in your app, extracted + typed on save
|
|
40
|
-
import { t, setLocale } from '
|
|
40
|
+
import { t, setLocale } from 'verbaly/app';
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
+
- **`verbaly/app` is your project**: the plugin writes it from your config and catalogs, so `locales`, `routing` and a bound `switchLocale` are already there. Its old name, `virtual:verbaly`, still works and is the same module.
|
|
43
44
|
- **Live extraction** with debounced catalog writes + HMR, from `.js/.ts/.jsx/.tsx` and `.svelte`/`.vue` files (script and markup). Every write starts from the files on disk, so a checkout or an `extract` run in another terminal is never undone with an older text, and a catalog saved half-typed is reported in one line while the server keeps running. The terminal says what `next dev` says, once each: a hand edit of a text your code owns, a key with two texts, a `t` under another name, a translation older than its source. To keep the dev server from writing your translation files, pass `liveExtraction: false`: new texts still render from memory, as in a build, and `npx verbaly extract` writes them when you choose.
|
|
44
45
|
- **Typed keys**: the types go to `src/verbaly.d.ts` (the root when there is no `src/`), the folder the Vite and SvelteKit templates' `tsconfig` includes, so `tsc -b` sees them with nothing to configure. `npx verbaly typegen` writes them on a fresh clone.
|
|
45
46
|
- **Per-locale code-splitting**: `setLocale` lazy-loads only what's used.
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LOCALE_MODULE_PREFIX, MessageRegistry, RESOLVED_VIRTUAL_ID, SOURCE_FILE_RE, createDevReporter, createSourceFilter, extractProject, formatCliError, isTransformTarget, loadCatalogs, loadConfig, loadVirtualModule, outdatedTranslations, reportOutsideInclude, resolveVirtualId, runBuildGate, syncCatalogs, syncProject, transformSource, writeDts } from "@verbaly/compiler";
|
|
1
|
+
import { APP_ID, LOCALE_IMPORT, LOCALE_MODULE_PREFIX, MessageRegistry, RESOLVED_VIRTUAL_ID, SOURCE_FILE_RE, createDevReporter, createSourceFilter, extractProject, formatCliError, isTransformTarget, loadCatalogs, loadConfig, loadVirtualModule, outdatedTranslations, reportOutsideInclude, resolveVirtualId, runBuildGate, syncCatalogs, syncProject, transformSource, writeDts } from "@verbaly/compiler";
|
|
2
2
|
import { readFileSync } from "node:fs";
|
|
3
3
|
// src/index.ts
|
|
4
4
|
function safeRead(file) {
|
|
@@ -8,7 +8,7 @@ function safeRead(file) {
|
|
|
8
8
|
return;
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
-
const VIRTUAL_ID_FILTER = new RegExp(
|
|
11
|
+
const VIRTUAL_ID_FILTER = new RegExp(`^(?:${RESOLVED_VIRTUAL_ID.slice(1)}(?:/|$)|${APP_ID}$|${LOCALE_IMPORT})`);
|
|
12
12
|
const RESOLVED_ID_FILTER = new RegExp(`^${RESOLVED_VIRTUAL_ID}(?:/|$)`);
|
|
13
13
|
const ANY_RESOLVED_ID = new RegExp(`^${RESOLVED_VIRTUAL_ID.charAt(0)}`);
|
|
14
14
|
function verbaly(options = {}) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@verbaly/vite",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.78.0",
|
|
4
4
|
"description": "Zero-config Vite plugin for Verbaly: extraction, codegen and HMR.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"i18n",
|
|
@@ -42,14 +42,14 @@
|
|
|
42
42
|
"access": "public"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@verbaly/compiler": "0.
|
|
45
|
+
"@verbaly/compiler": "0.78.0"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"verbaly": "^0.
|
|
48
|
+
"verbaly": "^0.78.0",
|
|
49
49
|
"vite": "^7.0.0 || ^8.0.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"verbaly": "^0.
|
|
52
|
+
"verbaly": "^0.78.0",
|
|
53
53
|
"vite": "^8.3.5"
|
|
54
54
|
},
|
|
55
55
|
"scripts": {
|