@verbaly/nuxt 0.67.0 → 0.69.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 +2 -0
- package/dist/module.js +2 -3
- package/dist/module.js.map +1 -1
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -51,6 +51,8 @@ const t = useT();
|
|
|
51
51
|
</template>
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
+
`useT()` is typed by your catalog: the types go to `.nuxt/verbaly.d.ts`, where Nuxt links them, and `npx verbaly extract` writes that same file. A key no catalog has fails `nuxi typecheck`.
|
|
55
|
+
|
|
54
56
|
**3. Switching languages** (client): persists the cookie the server reads:
|
|
55
57
|
|
|
56
58
|
```vue
|
package/dist/module.js
CHANGED
|
@@ -23,9 +23,8 @@ function verbalyModule(inlineOptions, nuxt) {
|
|
|
23
23
|
nuxt.hook("prepare:types", async ({ references }) => {
|
|
24
24
|
const cfg = await loadConfig(nuxt.options.rootDir, vite);
|
|
25
25
|
if (cfg.dts === false) return;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
references.push({ path: file });
|
|
26
|
+
writeDts(cfg, loadCatalogs(cfg)[cfg.sourceLocale] ?? {});
|
|
27
|
+
references.push({ path: cfg.dts });
|
|
29
28
|
});
|
|
30
29
|
nuxt.options.build.transpile.push(runtimeDir);
|
|
31
30
|
nuxt.options.plugins.unshift(join(runtimeDir, "plugin.js"));
|
package/dist/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","names":[],"sources":["../src/module.ts"],"sourcesContent":["import { loadCatalogs, loadConfig, writeDts } from '@verbaly/compiler';\nimport verbalyVite, { type ViteVerbalyOptions } from '@verbaly/vite';\nimport { dirname, join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nexport type { ViteVerbalyOptions } from '@verbaly/vite';\n\nexport interface VerbalyNuxtOptions extends ViteVerbalyOptions {\n cookie?: string | false;\n fallback?: string;\n}\n\n// structural subset of Nuxt: no runtime or type dependency on nuxt/@nuxt/kit\ninterface ViteConfigLike {\n plugins?: unknown[];\n}\ninterface PrepareTypesLike {\n references: Array<{ path: string } | { types: string }>;\n}\nexport interface NuxtLike {\n options: {\n rootDir: string;\n buildDir: string;\n plugins: unknown[];\n build: { transpile: unknown[] };\n runtimeConfig: { public: Record<string, unknown> };\n verbaly?: VerbalyNuxtOptions;\n };\n hook(name: 'vite:extendConfig', fn: (config: ViteConfigLike) => void): void;\n hook(name: 'prepare:types', fn: (options: PrepareTypesLike) => Promise<void>): void;\n}\n\nconst runtimeDir = join(dirname(fileURLToPath(import.meta.url)), 'runtime');\n\n// plain-function Nuxt module: configKey `verbaly`, inline options win\nfunction verbalyModule(inlineOptions: VerbalyNuxtOptions | undefined, nuxt: NuxtLike): void {\n const { cookie, fallback, ...vite } = { ...nuxt.options.verbaly, ...inlineOptions };\n\n // negotiation options ride runtimeConfig to the runtime plugin\n nuxt.options.runtimeConfig.public.verbaly = {\n ...(cookie !== undefined && { cookie }),\n ...(fallback !== undefined && { fallback }),\n };\n\n // types go to Nuxt's own slot (.nuxt/), set before the hooks fire so dev keeps it fresh\n vite.dts ??= join(nuxt.options.buildDir, 'verbaly.d.ts');\n\n // fresh plugin per Vite build (client and server must not share state), root pinned to rootDir\n nuxt.hook('vite:extendConfig', (config) => {\n (config.plugins ??= []).push(verbalyVite({ root: nuxt.options.rootDir, ...vite }));\n });\n\n // the file must exist when the reference lands in .nuxt/nuxt.d.ts or TS reports it missing\n nuxt.hook('prepare:types', async ({ references }) => {\n const cfg = await loadConfig(nuxt.options.rootDir, vite);\n if (cfg.dts === false) return;\n
|
|
1
|
+
{"version":3,"file":"module.js","names":[],"sources":["../src/module.ts"],"sourcesContent":["import { loadCatalogs, loadConfig, writeDts } from '@verbaly/compiler';\nimport verbalyVite, { type ViteVerbalyOptions } from '@verbaly/vite';\nimport { dirname, join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nexport type { ViteVerbalyOptions } from '@verbaly/vite';\n\nexport interface VerbalyNuxtOptions extends ViteVerbalyOptions {\n cookie?: string | false;\n fallback?: string;\n}\n\n// structural subset of Nuxt: no runtime or type dependency on nuxt/@nuxt/kit\ninterface ViteConfigLike {\n plugins?: unknown[];\n}\ninterface PrepareTypesLike {\n references: Array<{ path: string } | { types: string }>;\n}\nexport interface NuxtLike {\n options: {\n rootDir: string;\n buildDir: string;\n plugins: unknown[];\n build: { transpile: unknown[] };\n runtimeConfig: { public: Record<string, unknown> };\n verbaly?: VerbalyNuxtOptions;\n };\n hook(name: 'vite:extendConfig', fn: (config: ViteConfigLike) => void): void;\n hook(name: 'prepare:types', fn: (options: PrepareTypesLike) => Promise<void>): void;\n}\n\nconst runtimeDir = join(dirname(fileURLToPath(import.meta.url)), 'runtime');\n\n// plain-function Nuxt module: configKey `verbaly`, inline options win\nfunction verbalyModule(inlineOptions: VerbalyNuxtOptions | undefined, nuxt: NuxtLike): void {\n const { cookie, fallback, ...vite } = { ...nuxt.options.verbaly, ...inlineOptions };\n\n // negotiation options ride runtimeConfig to the runtime plugin\n nuxt.options.runtimeConfig.public.verbaly = {\n ...(cookie !== undefined && { cookie }),\n ...(fallback !== undefined && { fallback }),\n };\n\n // types go to Nuxt's own slot (.nuxt/), set before the hooks fire so dev keeps it fresh\n vite.dts ??= join(nuxt.options.buildDir, 'verbaly.d.ts');\n\n // fresh plugin per Vite build (client and server must not share state), root pinned to rootDir\n nuxt.hook('vite:extendConfig', (config) => {\n (config.plugins ??= []).push(verbalyVite({ root: nuxt.options.rootDir, ...vite }));\n });\n\n // the file must exist when the reference lands in .nuxt/nuxt.d.ts or TS reports it missing\n nuxt.hook('prepare:types', async ({ references }) => {\n const cfg = await loadConfig(nuxt.options.rootDir, vite);\n if (cfg.dts === false) return;\n writeDts(cfg, loadCatalogs(cfg)[cfg.sourceLocale] ?? {});\n references.push({ path: cfg.dts });\n });\n\n nuxt.options.build.transpile.push(runtimeDir);\n // prepend: the instance must exist before app plugins and components run\n nuxt.options.plugins.unshift(join(runtimeDir, 'plugin.js'));\n}\n\nverbalyModule.meta = { name: '@verbaly/nuxt', configKey: 'verbaly' };\n\n// getOptions is the anchor Nuxt's config typing infers from: the call signature alone degrades it\nverbalyModule.getOptions = async (\n inlineOptions?: Partial<VerbalyNuxtOptions>,\n nuxt?: NuxtLike,\n): Promise<VerbalyNuxtOptions> => ({ ...nuxt?.options.verbaly, ...inlineOptions });\n\nexport default verbalyModule;\n"],"mappings":";;;;;AAgCA,MAAM,aAAa,KAAK,QAAQ,cAAc,YAAY,GAAG,CAAC,GAAG,SAAS;AAG1E,SAAS,cAAc,eAA+C,MAAsB;CAC1F,MAAM,EAAE,QAAQ,UAAU,GAAG,SAAS;EAAE,GAAG,KAAK,QAAQ;EAAS,GAAG;CAAc;CAGlF,KAAK,QAAQ,cAAc,OAAO,UAAU;EAC1C,GAAI,WAAW,KAAA,KAAa,EAAE,OAAO;EACrC,GAAI,aAAa,KAAA,KAAa,EAAE,SAAS;CAC3C;CAGA,KAAK,QAAQ,KAAK,KAAK,QAAQ,UAAU,cAAc;CAGvD,KAAK,KAAK,sBAAsB,WAAW;EACzC,CAAC,OAAO,YAAY,CAAC,EAAA,CAAG,KAAK,YAAY;GAAE,MAAM,KAAK,QAAQ;GAAS,GAAG;EAAK,CAAC,CAAC;CACnF,CAAC;CAGD,KAAK,KAAK,iBAAiB,OAAO,EAAE,iBAAiB;EACnD,MAAM,MAAM,MAAM,WAAW,KAAK,QAAQ,SAAS,IAAI;EACvD,IAAI,IAAI,QAAQ,OAAO;EACvB,SAAS,KAAK,aAAa,GAAG,CAAC,CAAC,IAAI,iBAAiB,CAAC,CAAC;EACvD,WAAW,KAAK,EAAE,MAAM,IAAI,IAAI,CAAC;CACnC,CAAC;CAED,KAAK,QAAQ,MAAM,UAAU,KAAK,UAAU;CAE5C,KAAK,QAAQ,QAAQ,QAAQ,KAAK,YAAY,WAAW,CAAC;AAC5D;AAEA,cAAc,OAAO;CAAE,MAAM;CAAiB,WAAW;AAAU;AAGnE,cAAc,aAAa,OACzB,eACA,UACiC;CAAE,GAAG,MAAM,QAAQ;CAAS,GAAG;AAAc"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@verbaly/nuxt",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.69.0",
|
|
4
4
|
"description": "Nuxt integration for Verbaly: zero-config module with per-request locale negotiation and flash-free hydration.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"i18n",
|
|
@@ -41,19 +41,19 @@
|
|
|
41
41
|
"access": "public"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@verbaly/compiler": "^0.
|
|
45
|
-
"@verbaly/vite": "^0.
|
|
44
|
+
"@verbaly/compiler": "^0.69.0",
|
|
45
|
+
"@verbaly/vite": "^0.69.0"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"@verbaly/vue": "^0.
|
|
49
|
-
"verbaly": "^0.
|
|
48
|
+
"@verbaly/vue": "^0.69.0",
|
|
49
|
+
"verbaly": "^0.69.0",
|
|
50
50
|
"vue": "^3.4.0"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@nuxt/schema": "^4.6.0",
|
|
54
|
-
"@verbaly/vue": "^0.
|
|
54
|
+
"@verbaly/vue": "^0.69.0",
|
|
55
55
|
"happy-dom": "^20.14.5",
|
|
56
|
-
"verbaly": "^0.
|
|
56
|
+
"verbaly": "^0.69.0",
|
|
57
57
|
"vue": "^3.5.43"
|
|
58
58
|
},
|
|
59
59
|
"scripts": {
|