@verbaly/nuxt 0.31.0 → 0.33.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.
@@ -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 live in Nuxt's own slot (.nuxt/), no file in the project root; set before the\n // hooks fire so the vite plugin keeps that same file fresh as messages change in dev\n vite.dts ??= join(nuxt.options.buildDir, 'verbaly.d.ts');\n\n // fresh plugin instance per Vite build: client and server builds never share state.\n // root pinned to the project dir: Nuxt's Vite root is srcDir (app/), where no verbaly.config lives\n nuxt.hook('vite:extendConfig', (config) => {\n (config.plugins ??= []).push(verbalyVite({ root: nuxt.options.rootDir, ...vite }));\n });\n\n // prepare:types fires on prepare/dev/build, before anything compiles: the file must\n // 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 const file = cfg.dts ?? join(cfg.root, 'verbaly.d.ts');\n writeDts(cfg, loadCatalogs(cfg)[cfg.sourceLocale] ?? {}, file);\n references.push({ path: file });\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// same merge as the body; also the anchor Nuxt's generated nuxt.config typing infers the\n// options type from (the plain call signature alone degrades the inference to Record)\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,OAAO,KAAK,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;CAIA,KAAK,QAAQ,KAAK,KAAK,QAAQ,UAAU,cAAc;CAIvD,KAAK,KAAK,sBAAsB,WAAW;EACzC,CAAC,OAAO,YAAY,CAAC,EAAA,CAAG,KAAK,YAAY;GAAE,MAAM,KAAK,QAAQ;GAAS,GAAG;EAAK,CAAC,CAAC;CACnF,CAAC;CAID,KAAK,KAAK,iBAAiB,OAAO,EAAE,iBAAiB;EACnD,MAAM,MAAM,MAAM,WAAW,KAAK,QAAQ,SAAS,IAAI;EACvD,IAAI,IAAI,QAAQ,OAAO;EACvB,MAAM,OAAO,IAAI,OAAO,KAAK,IAAI,MAAM,cAAc;EACrD,SAAS,KAAK,aAAa,GAAG,CAAC,CAAC,IAAI,iBAAiB,CAAC,GAAG,IAAI;EAC7D,WAAW,KAAK,EAAE,MAAM,KAAK,CAAC;CAChC,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;AAInE,cAAc,aAAa,OACzB,eACA,UACiC;CAAE,GAAG,MAAM,QAAQ;CAAS,GAAG;AAAc"}
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 const file = cfg.dts ?? join(cfg.root, 'verbaly.d.ts');\n writeDts(cfg, loadCatalogs(cfg)[cfg.sourceLocale] ?? {}, file);\n references.push({ path: file });\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,OAAO,KAAK,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,MAAM,OAAO,IAAI,OAAO,KAAK,IAAI,MAAM,cAAc;EACrD,SAAS,KAAK,aAAa,GAAG,CAAC,CAAC,IAAI,iBAAiB,CAAC,GAAG,IAAI;EAC7D,WAAW,KAAK,EAAE,MAAM,KAAK,CAAC;CAChC,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.31.0",
3
+ "version": "0.33.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,20 +41,20 @@
41
41
  "access": "public"
42
42
  },
43
43
  "dependencies": {
44
- "@verbaly/compiler": "^0.31.0",
45
- "@verbaly/vite": "^0.31.0"
44
+ "@verbaly/compiler": "^0.33.0",
45
+ "@verbaly/vite": "^0.33.0"
46
46
  },
47
47
  "peerDependencies": {
48
48
  "vue": "^3.4.0",
49
- "@verbaly/vue": "^0.31.0",
50
- "verbaly": "^0.31.0"
49
+ "@verbaly/vue": "^0.33.0",
50
+ "verbaly": "^0.33.0"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@nuxt/schema": "^4.5.1",
54
54
  "happy-dom": "^20.11.1",
55
55
  "vue": "^3.5.40",
56
- "@verbaly/vue": "^0.31.0",
57
- "verbaly": "^0.31.0"
56
+ "@verbaly/vue": "^0.33.0",
57
+ "verbaly": "^0.33.0"
58
58
  },
59
59
  "scripts": {
60
60
  "build": "tsdown",