@verbaly/unplugin 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/README.md +10 -4
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
```bash
|
|
19
19
|
pnpm add verbaly @verbaly/unplugin
|
|
20
|
+
pnpm add -D @verbaly/compiler # the verbaly command: init, extract, check
|
|
20
21
|
```
|
|
21
22
|
|
|
22
23
|
```js
|
|
@@ -24,19 +25,24 @@ pnpm add verbaly @verbaly/unplugin
|
|
|
24
25
|
import { verbaly } from '@verbaly/unplugin';
|
|
25
26
|
|
|
26
27
|
export default {
|
|
27
|
-
plugins: [verbaly.webpack(
|
|
28
|
+
plugins: [verbaly.webpack()],
|
|
28
29
|
};
|
|
29
30
|
```
|
|
30
31
|
|
|
32
|
+
```ts
|
|
33
|
+
// verbaly.config.ts, created by npx verbaly init: list your languages, the build and `verbaly check` read them
|
|
34
|
+
export default { sourceLocale: 'en', locales: ['en', 'es', 'pt'] };
|
|
35
|
+
```
|
|
36
|
+
|
|
31
37
|
```js
|
|
32
38
|
// rollup.config.mjs
|
|
33
39
|
import { verbaly } from '@verbaly/unplugin';
|
|
34
|
-
export default { plugins: [verbaly.rollup(
|
|
40
|
+
export default { plugins: [verbaly.rollup()] };
|
|
35
41
|
|
|
36
42
|
// esbuild
|
|
37
|
-
verbaly.esbuild(
|
|
43
|
+
verbaly.esbuild();
|
|
38
44
|
// rspack
|
|
39
|
-
verbaly.rspack(
|
|
45
|
+
verbaly.rspack();
|
|
40
46
|
```
|
|
41
47
|
|
|
42
48
|
Extraction runs via the CLI: add it to your dev loop or CI:
|
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ const factory = (options = {}) => {
|
|
|
8
8
|
let scan;
|
|
9
9
|
const registry = new MessageRegistry();
|
|
10
10
|
const ready = (async () => {
|
|
11
|
-
cfg = await loadConfig(options.root ?? process.cwd(), options);
|
|
11
|
+
cfg = await loadConfig(options.root ?? process.cwd(), options, { plugin: true });
|
|
12
12
|
catalogs = loadCatalogs(cfg);
|
|
13
13
|
included = createSourceFilter(cfg);
|
|
14
14
|
scan = await extractProject(cfg, { keepSource: true });
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import {\n MessageRegistry,\n RESOLVED_VIRTUAL_ID,\n createSourceFilter,\n extractProject,\n isTransformTarget,\n loadCatalogs,\n loadConfig,\n loadVirtualModule,\n reportOutsideInclude,\n resolveVirtualId,\n runBuildGate,\n syncCatalogs,\n transformSource,\n type Catalogs,\n type PluginOptions,\n type ResolvedConfig,\n} from '@verbaly/compiler';\nimport { createUnplugin, type UnpluginFactory, type UnpluginInstance } from 'unplugin';\n\n// the shared bundler-plugin options (config + failOnMissing), named for this plugin\nexport type UnpluginVerbalyOptions = PluginOptions;\n\n// build-focused: virtual modules + transform + gate.\nconst factory: UnpluginFactory<UnpluginVerbalyOptions | undefined> = (options = {}) => {\n let cfg: ResolvedConfig;\n let catalogs: Catalogs;\n let included: (id: string) => boolean;\n // the first build's scan: each file it read unchanged reaches transform already parsed\n let scan: MessageRegistry | undefined;\n const registry = new MessageRegistry();\n const ready = (async () => {\n cfg = await loadConfig(options.root ?? process.cwd(), options);\n catalogs = loadCatalogs(cfg);\n included = createSourceFilter(cfg);\n scan = await extractProject(cfg, { keepSource: true });\n // the code's text ships: a text it owns that was edited in the catalog never reaches the bundle\n syncCatalogs(cfg, catalogs, scan);\n })();\n // buildStart awaits it and reports the failure; unwatched till then, a rejection ends the process\n ready.catch(() => {});\n\n return {\n name: 'verbaly',\n enforce: 'pre',\n\n async buildStart() {\n await ready;\n // a file outside include writes a t`…` that no build translates: said once, at the start\n await reportOutsideInclude(cfg);\n },\n\n resolveId(id) {\n return resolveVirtualId(id) ?? null;\n },\n\n loadInclude(id) {\n return id.startsWith(RESOLVED_VIRTUAL_ID);\n },\n\n load(id) {\n return loadVirtualModule(id, cfg, catalogs) ?? null;\n },\n\n transformInclude(id) {\n return isTransformTarget(id);\n },\n\n transform(code, id) {\n if (!included(id)) return null;\n return transformSource(code, id, registry, scan).result;\n },\n\n buildEnd() {\n // a watch rebuild parses what changed: the scan only ever describes the first build\n scan = undefined;\n runBuildGate(cfg, registry, options.failOnMissing);\n },\n };\n};\n\nexport const verbaly: UnpluginInstance<UnpluginVerbalyOptions | undefined> =\n createUnplugin(factory);\n\nexport default verbaly;\n\nexport type { VerbalyConfig } from '@verbaly/compiler';\n"],"mappings":";;;AAwBA,MAAM,WAAgE,UAAU,CAAC,MAAM;CACrF,IAAI;CACJ,IAAI;CACJ,IAAI;CAEJ,IAAI;CACJ,MAAM,WAAW,IAAI,gBAAgB;CACrC,MAAM,SAAS,YAAY;EACzB,MAAM,MAAM,WAAW,QAAQ,QAAQ,QAAQ,IAAI,GAAG,
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import {\n MessageRegistry,\n RESOLVED_VIRTUAL_ID,\n createSourceFilter,\n extractProject,\n isTransformTarget,\n loadCatalogs,\n loadConfig,\n loadVirtualModule,\n reportOutsideInclude,\n resolveVirtualId,\n runBuildGate,\n syncCatalogs,\n transformSource,\n type Catalogs,\n type PluginOptions,\n type ResolvedConfig,\n} from '@verbaly/compiler';\nimport { createUnplugin, type UnpluginFactory, type UnpluginInstance } from 'unplugin';\n\n// the shared bundler-plugin options (config + failOnMissing), named for this plugin\nexport type UnpluginVerbalyOptions = PluginOptions;\n\n// build-focused: virtual modules + transform + gate.\nconst factory: UnpluginFactory<UnpluginVerbalyOptions | undefined> = (options = {}) => {\n let cfg: ResolvedConfig;\n let catalogs: Catalogs;\n let included: (id: string) => boolean;\n // the first build's scan: each file it read unchanged reaches transform already parsed\n let scan: MessageRegistry | undefined;\n const registry = new MessageRegistry();\n const ready = (async () => {\n cfg = await loadConfig(options.root ?? process.cwd(), options, { plugin: true });\n catalogs = loadCatalogs(cfg);\n included = createSourceFilter(cfg);\n scan = await extractProject(cfg, { keepSource: true });\n // the code's text ships: a text it owns that was edited in the catalog never reaches the bundle\n syncCatalogs(cfg, catalogs, scan);\n })();\n // buildStart awaits it and reports the failure; unwatched till then, a rejection ends the process\n ready.catch(() => {});\n\n return {\n name: 'verbaly',\n enforce: 'pre',\n\n async buildStart() {\n await ready;\n // a file outside include writes a t`…` that no build translates: said once, at the start\n await reportOutsideInclude(cfg);\n },\n\n resolveId(id) {\n return resolveVirtualId(id) ?? null;\n },\n\n loadInclude(id) {\n return id.startsWith(RESOLVED_VIRTUAL_ID);\n },\n\n load(id) {\n return loadVirtualModule(id, cfg, catalogs) ?? null;\n },\n\n transformInclude(id) {\n return isTransformTarget(id);\n },\n\n transform(code, id) {\n if (!included(id)) return null;\n return transformSource(code, id, registry, scan).result;\n },\n\n buildEnd() {\n // a watch rebuild parses what changed: the scan only ever describes the first build\n scan = undefined;\n runBuildGate(cfg, registry, options.failOnMissing);\n },\n };\n};\n\nexport const verbaly: UnpluginInstance<UnpluginVerbalyOptions | undefined> =\n createUnplugin(factory);\n\nexport default verbaly;\n\nexport type { VerbalyConfig } from '@verbaly/compiler';\n"],"mappings":";;;AAwBA,MAAM,WAAgE,UAAU,CAAC,MAAM;CACrF,IAAI;CACJ,IAAI;CACJ,IAAI;CAEJ,IAAI;CACJ,MAAM,WAAW,IAAI,gBAAgB;CACrC,MAAM,SAAS,YAAY;EACzB,MAAM,MAAM,WAAW,QAAQ,QAAQ,QAAQ,IAAI,GAAG,SAAS,EAAE,QAAQ,KAAK,CAAC;EAC/E,WAAW,aAAa,GAAG;EAC3B,WAAW,mBAAmB,GAAG;EACjC,OAAO,MAAM,eAAe,KAAK,EAAE,YAAY,KAAK,CAAC;EAErD,aAAa,KAAK,UAAU,IAAI;CAClC,EAAA,CAAG;CAEH,MAAM,YAAY,CAAC,CAAC;CAEpB,OAAO;EACL,MAAM;EACN,SAAS;EAET,MAAM,aAAa;GACjB,MAAM;GAEN,MAAM,qBAAqB,GAAG;EAChC;EAEA,UAAU,IAAI;GACZ,OAAO,iBAAiB,EAAE,KAAK;EACjC;EAEA,YAAY,IAAI;GACd,OAAO,GAAG,WAAW,mBAAmB;EAC1C;EAEA,KAAK,IAAI;GACP,OAAO,kBAAkB,IAAI,KAAK,QAAQ,KAAK;EACjD;EAEA,iBAAiB,IAAI;GACnB,OAAO,kBAAkB,EAAE;EAC7B;EAEA,UAAU,MAAM,IAAI;GAClB,IAAI,CAAC,SAAS,EAAE,GAAG,OAAO;GAC1B,OAAO,gBAAgB,MAAM,IAAI,UAAU,IAAI,CAAC,CAAC;EACnD;EAEA,WAAW;GAET,OAAO,KAAA;GACP,aAAa,KAAK,UAAU,QAAQ,aAAa;EACnD;CACF;AACF;AAEA,MAAa,UACX,eAAe,OAAO"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@verbaly/unplugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.75.0",
|
|
4
4
|
"description": "Verbaly for webpack, Rollup, esbuild and Rspack: extraction, virtual modules and build gate via unplugin.",
|
|
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.75.0",
|
|
46
46
|
"unplugin": "^3.4.0"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
|
-
"verbaly": "^0.
|
|
49
|
+
"verbaly": "^0.75.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"verbaly": "^0.
|
|
52
|
+
"verbaly": "^0.75.0"
|
|
53
53
|
},
|
|
54
54
|
"scripts": {
|
|
55
55
|
"build": "tsdown",
|