@verbaly/astro 0.29.0 → 0.30.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/dist/index.js.map +1 -1
- package/package.json +6 -6
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import {\n generateDts,\n loadCatalogs,\n loadConfig,\n renderSite,\n type RenderConfig,\n} from '@verbaly/compiler';\nimport verbalyVite, { type ViteVerbalyOptions } from '@verbaly/vite';\nimport { relative } from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nexport type { RenderConfig, VerbalyConfig } from '@verbaly/compiler';\nexport type { ViteVerbalyOptions } from '@verbaly/vite';\n\nexport interface VerbalyAstroOptions extends Omit<ViteVerbalyOptions, 'render'> {\n render?: boolean | RenderConfig;\n}\n\ninterface AstroConfigLike {\n root: URL;\n}\ninterface ConfigSetupLike {\n config: AstroConfigLike;\n updateConfig(config: { vite?: { plugins?: unknown } }): unknown;\n}\ninterface ConfigDoneLike {\n buildOutput?: 'static' | 'server';\n injectTypes(injectedType: { filename: string; content: string }): URL;\n}\ninterface BuildDoneLike {\n dir: URL;\n}\nexport interface VerbalyAstroIntegration {\n name: string;\n hooks: {\n 'astro:config:setup'(options: ConfigSetupLike): void;\n 'astro:config:done'(options: ConfigDoneLike): Promise<void>;\n 'astro:build:done'(options: BuildDoneLike): Promise<void>;\n };\n}\n\nexport default function verbaly(options: VerbalyAstroOptions = {}): VerbalyAstroIntegration {\n const { render, ...rest } = options;\n // one shared, mutable options object: config:done fills `dts` after the plugin\n // was created in config:setup, and the plugin reads it lazily at write time\n const vite: ViteVerbalyOptions = typeof render === 'object' ? { ...rest, render } : rest;\n let root = '';\n let buildOutput: 'static' | 'server' | undefined;\n\n return {\n name: '@verbaly/astro',\n hooks: {\n 'astro:config:setup'({ config, updateConfig }) {\n // root pinned to the project dir: Astro's Vite root can differ and config/catalog discovery would find nothing\n root = vite.root ??= fileURLToPath(config.root);\n updateConfig({ vite: { plugins: [verbalyVite(vite)] } });\n },\n async 'astro:config:done'(options) {\n buildOutput = options.buildOutput;\n // the generated types live in Astro's own slot (.astro/), no file in the project;\n // the vite plugin keeps that same file fresh as messages change in dev\n const cfg = await loadConfig(root, vite);\n const url = options.injectTypes({\n filename: 'verbaly.d.ts',\n content: generateDts(loadCatalogs(cfg)[cfg.sourceLocale] ?? {}),\n });\n vite.dts = fileURLToPath(url);\n },\n async 'astro:build:done'({ dir }) {\n const cfg = await loadConfig(root, vite);\n // mirror mode is opt-in: a `render` section in the config (or render: true) turns it on;\n // path-based i18n routing sites must never get their pages mirrored on top\n const wanted
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import {\n generateDts,\n loadCatalogs,\n loadConfig,\n renderSite,\n type RenderConfig,\n} from '@verbaly/compiler';\nimport verbalyVite, { type ViteVerbalyOptions } from '@verbaly/vite';\nimport { relative } from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nexport type { RenderConfig, VerbalyConfig } from '@verbaly/compiler';\nexport type { ViteVerbalyOptions } from '@verbaly/vite';\n\nexport interface VerbalyAstroOptions extends Omit<ViteVerbalyOptions, 'render'> {\n render?: boolean | RenderConfig;\n}\n\ninterface AstroConfigLike {\n root: URL;\n}\ninterface ConfigSetupLike {\n config: AstroConfigLike;\n updateConfig(config: { vite?: { plugins?: unknown } }): unknown;\n}\ninterface ConfigDoneLike {\n buildOutput?: 'static' | 'server';\n injectTypes(injectedType: { filename: string; content: string }): URL;\n}\ninterface BuildDoneLike {\n dir: URL;\n}\nexport interface VerbalyAstroIntegration {\n name: string;\n hooks: {\n 'astro:config:setup'(options: ConfigSetupLike): void;\n 'astro:config:done'(options: ConfigDoneLike): Promise<void>;\n 'astro:build:done'(options: BuildDoneLike): Promise<void>;\n };\n}\n\nexport default function verbaly(options: VerbalyAstroOptions = {}): VerbalyAstroIntegration {\n const { render, ...rest } = options;\n // one shared, mutable options object: config:done fills `dts` after the plugin\n // was created in config:setup, and the plugin reads it lazily at write time\n const vite: ViteVerbalyOptions = typeof render === 'object' ? { ...rest, render } : rest;\n let root = '';\n let buildOutput: 'static' | 'server' | undefined;\n\n return {\n name: '@verbaly/astro',\n hooks: {\n 'astro:config:setup'({ config, updateConfig }) {\n // root pinned to the project dir: Astro's Vite root can differ and config/catalog discovery would find nothing\n root = vite.root ??= fileURLToPath(config.root);\n updateConfig({ vite: { plugins: [verbalyVite(vite)] } });\n },\n async 'astro:config:done'(options) {\n buildOutput = options.buildOutput;\n // the generated types live in Astro's own slot (.astro/), no file in the project;\n // the vite plugin keeps that same file fresh as messages change in dev\n const cfg = await loadConfig(root, vite);\n const url = options.injectTypes({\n filename: 'verbaly.d.ts',\n content: generateDts(loadCatalogs(cfg)[cfg.sourceLocale] ?? {}),\n });\n vite.dts = fileURLToPath(url);\n },\n async 'astro:build:done'({ dir }) {\n const cfg = await loadConfig(root, vite);\n // mirror mode is opt-in: a `render` section in the config (or render: true) turns it on;\n // path-based i18n routing sites must never get their pages mirrored on top\n const wanted = render === undefined ? Object.keys(cfg.render).length > 0 : Boolean(render);\n if (!wanted) return;\n if (buildOutput === 'server') {\n console.warn(\n '[verbaly] render skipped: only static output can be mirrored per locale (server-rendered pages already pick their locale per request)',\n );\n return;\n }\n const site = relative(cfg.root, fileURLToPath(dir)) || '.';\n const result = await renderSite(cfg, { site });\n console.log(\n `[verbaly] render: ${result.files} pages × ${result.locales.length} locales (${result.locales.join(', ')})`,\n );\n for (const [locale, keys] of Object.entries(result.missing)) {\n console.warn(` ${locale}: ${keys.length} keys not pre-filled: ${keys.join(', ')}`);\n }\n },\n },\n };\n}\n"],"mappings":";;;;;AAyCA,SAAwB,QAAQ,UAA+B,CAAC,GAA4B;CAC1F,MAAM,EAAE,QAAQ,GAAG,SAAS;CAG5B,MAAM,OAA2B,OAAO,WAAW,WAAW;EAAE,GAAG;EAAM;CAAO,IAAI;CAC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"description": "Astro integration for Verbaly: write-in-source extraction for .astro files plus automatic per-locale static rendering.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"i18n",
|
|
@@ -41,15 +41,15 @@
|
|
|
41
41
|
"access": "public"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@verbaly/
|
|
45
|
-
"@verbaly/
|
|
44
|
+
"@verbaly/vite": "^0.30.0",
|
|
45
|
+
"@verbaly/compiler": "^0.30.0"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"verbaly": "^0.
|
|
48
|
+
"verbaly": "^0.30.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"astro": "^7.1.
|
|
52
|
-
"verbaly": "0.
|
|
51
|
+
"astro": "^7.1.4",
|
|
52
|
+
"verbaly": "^0.30.0"
|
|
53
53
|
},
|
|
54
54
|
"scripts": {
|
|
55
55
|
"build": "tsdown",
|