astro-intlayer 9.4.2 → 9.4.3

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,4 +1,4 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
2
2
  const require_emitRewrittenPages = require('./emitRewrittenPages.cjs');
3
3
  let node_path = require("node:path");
4
4
  let _intlayer_config_node = require("@intlayer/config/node");
@@ -58,5 +58,6 @@ const intlayer = () => ({
58
58
  });
59
59
 
60
60
  //#endregion
61
+ exports.default = intlayer;
61
62
  exports.intlayer = intlayer;
62
63
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["getConfiguration","prepareIntlayer","viteIntlayerPlugin","viteIntlayerProxyPlugin","getAlias","resolve","watch","emitRewrittenPages"],"sources":["../../src/index.ts"],"sourcesContent":["import { resolve } from 'node:path';\nimport { getConfiguration } from '@intlayer/config/node';\nimport { getAlias } from '@intlayer/config/utils';\nimport { prepareIntlayer } from '@intlayer/engine/build';\nimport { watch } from '@intlayer/engine/watcher';\nimport type { AstroIntegration } from 'astro';\nimport type { PluginOption } from 'vite';\nimport {\n intlayer as viteIntlayerPlugin,\n intlayerProxy as viteIntlayerProxyPlugin,\n} from 'vite-intlayer';\nimport { emitRewrittenPages } from './emitRewrittenPages';\n\n/**\n * Astro integration for Intlayer.\n *\n * It handles:\n * 1. Preparing Intlayer resources (dictionaries) at config setup.\n * 2. Injecting Vite plugins for aliases, locale-based routing (middleware), and build optimizations (prune).\n * 3. Configuring Vite aliases for dictionary access.\n * 4. Starting a file watcher for dictionary changes during development.\n * 5. Emitting the prerendered pages at their rewritten (localized) URLs.\n *\n * @returns An Astro integration object.\n *\n * @example\n * ```ts\n * // astro.config.mjs\n * import { defineConfig } from 'astro/config';\n * import { intlayer } from 'astro-intlayer';\n *\n * export default defineConfig({\n * integrations: [intlayer()],\n * });\n * ```\n */\nexport const intlayer = (): AstroIntegration =>\n ({\n name: 'astro-intlayer',\n hooks: {\n 'astro:config:setup': async ({ updateConfig }) => {\n const configuration = getConfiguration();\n\n // Prepare once per process start to ensure generated entries exist\n await prepareIntlayer(configuration);\n\n updateConfig({\n vite: {\n plugins: [\n // Aliases + watcher + buildStart prep\n // (also handles optimize/prune/minify internally)\n viteIntlayerPlugin(),\n // Dev-time middleware for locale routing\n viteIntlayerProxyPlugin(),\n ] as PluginOption[],\n resolve: {\n alias: {\n ...getAlias({\n configuration,\n formatter: (value) => resolve(value),\n }),\n },\n },\n },\n });\n },\n\n 'astro:server:setup': async () => {\n const configuration = getConfiguration();\n\n if (configuration.content.watch) {\n await watch({ configuration });\n }\n },\n\n // Astro renders each page from its canonical file-system route, so a\n // static build has no file for the localized paths declared in\n // `routing.rewrite`. Mirror them here, otherwise the URLs produced by\n // `getLocalizedUrl` (links, hreflang, sitemap) 404 once deployed.\n 'astro:build:done': async ({ dir, logger }) => {\n const configuration = getConfiguration();\n\n const emittedPages = await emitRewrittenPages(configuration, dir);\n\n if (emittedPages.length > 0) {\n logger.info(\n `Emitted ${emittedPages.length} rewritten page(s): ${emittedPages\n .map(([from, to]) => `${from} \\u2192 ${to}`)\n .join(', ')}`\n );\n }\n },\n },\n }) satisfies AstroIntegration;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,MAAa,kBACV;CACC,MAAM;CACN,OAAO;EACL,sBAAsB,OAAO,EAAE,mBAAmB;GAChD,MAAM,oBAAgBA,wCAAiB;GAGvC,UAAMC,wCAAgB,aAAa;GAEnC,aAAa,EACX,MAAM;IACJ,SAAS,KAGPC,wBAAmB,OAEnBC,6BAAwB,CAC1B;IACA,SAAS,EACP,OAAO,EACL,OAAGC,iCAAS;KACV;KACA,YAAY,cAAUC,mBAAQ,KAAK;IACrC,CAAC,EACH,EACF;GACF,EACF,CAAC;EACH;EAEA,sBAAsB,YAAY;GAChC,MAAM,oBAAgBL,wCAAiB;GAEvC,IAAI,cAAc,QAAQ,OACxB,UAAMM,gCAAM,EAAE,cAAc,CAAC;EAEjC;EAMA,oBAAoB,OAAO,EAAE,KAAK,aAAa;GAC7C,MAAM,oBAAgBN,wCAAiB;GAEvC,MAAM,eAAe,MAAMO,8CAAmB,eAAe,GAAG;GAEhE,IAAI,aAAa,SAAS,GACxB,OAAO,KACL,WAAW,aAAa,OAAO,sBAAsB,aAClD,KAAK,CAAC,MAAM,QAAQ,GAAG,KAAK,UAAU,IAAI,CAAC,CAC3C,KAAK,IAAI,GACd;EAEJ;CACF;AACF"}
1
+ {"version":3,"file":"index.cjs","names":["getConfiguration","prepareIntlayer","viteIntlayerPlugin","viteIntlayerProxyPlugin","getAlias","resolve","watch","emitRewrittenPages"],"sources":["../../src/index.ts"],"sourcesContent":["import { resolve } from 'node:path';\nimport { getConfiguration } from '@intlayer/config/node';\nimport { getAlias } from '@intlayer/config/utils';\nimport { prepareIntlayer } from '@intlayer/engine/build';\nimport { watch } from '@intlayer/engine/watcher';\nimport type { AstroIntegration } from 'astro';\nimport type { PluginOption } from 'vite';\nimport {\n intlayer as viteIntlayerPlugin,\n intlayerProxy as viteIntlayerProxyPlugin,\n} from 'vite-intlayer';\nimport { emitRewrittenPages } from './emitRewrittenPages';\n\n/**\n * Astro integration for Intlayer.\n *\n * It handles:\n * 1. Preparing Intlayer resources (dictionaries) at config setup.\n * 2. Injecting Vite plugins for aliases, locale-based routing (middleware), and build optimizations (prune).\n * 3. Configuring Vite aliases for dictionary access.\n * 4. Starting a file watcher for dictionary changes during development.\n * 5. Emitting the prerendered pages at their rewritten (localized) URLs.\n *\n * @returns An Astro integration object.\n *\n * @example\n * ```ts\n * // astro.config.mjs\n * import { defineConfig } from 'astro/config';\n * import { intlayer } from 'astro-intlayer';\n *\n * export default defineConfig({\n * integrations: [intlayer()],\n * });\n * ```\n */\nexport const intlayer = (): AstroIntegration =>\n ({\n name: 'astro-intlayer',\n hooks: {\n 'astro:config:setup': async ({ updateConfig }) => {\n const configuration = getConfiguration();\n\n // Prepare once per process start to ensure generated entries exist\n await prepareIntlayer(configuration);\n\n updateConfig({\n vite: {\n plugins: [\n // Aliases + watcher + buildStart prep\n // (also handles optimize/prune/minify internally)\n viteIntlayerPlugin(),\n // Dev-time middleware for locale routing\n viteIntlayerProxyPlugin(),\n ] as PluginOption[],\n resolve: {\n alias: {\n ...getAlias({\n configuration,\n formatter: (value) => resolve(value),\n }),\n },\n },\n },\n });\n },\n\n 'astro:server:setup': async () => {\n const configuration = getConfiguration();\n\n if (configuration.content.watch) {\n await watch({ configuration });\n }\n },\n\n // Astro renders each page from its canonical file-system route, so a\n // static build has no file for the localized paths declared in\n // `routing.rewrite`. Mirror them here, otherwise the URLs produced by\n // `getLocalizedUrl` (links, hreflang, sitemap) 404 once deployed.\n 'astro:build:done': async ({ dir, logger }) => {\n const configuration = getConfiguration();\n\n const emittedPages = await emitRewrittenPages(configuration, dir);\n\n if (emittedPages.length > 0) {\n logger.info(\n `Emitted ${emittedPages.length} rewritten page(s): ${emittedPages\n .map(([from, to]) => `${from} \\u2192 ${to}`)\n .join(', ')}`\n );\n }\n },\n },\n }) satisfies AstroIntegration;\n\n/**\n * Alias of {@link intlayer}, kept so `astro add astro-intlayer` works.\n *\n * Astro's CLI codemod always writes a default import\n * (`import intlayer from 'astro-intlayer'`) without checking what the package\n * exports, so the integration has to be reachable that way too. The named\n * export stays the documented one.\n */\nexport default intlayer;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,MAAa,kBACV;CACC,MAAM;CACN,OAAO;EACL,sBAAsB,OAAO,EAAE,mBAAmB;GAChD,MAAM,oBAAgBA,wCAAiB;GAGvC,UAAMC,wCAAgB,aAAa;GAEnC,aAAa,EACX,MAAM;IACJ,SAAS,KAGPC,wBAAmB,OAEnBC,6BAAwB,CAC1B;IACA,SAAS,EACP,OAAO,EACL,OAAGC,iCAAS;KACV;KACA,YAAY,cAAUC,mBAAQ,KAAK;IACrC,CAAC,EACH,EACF;GACF,EACF,CAAC;EACH;EAEA,sBAAsB,YAAY;GAChC,MAAM,oBAAgBL,wCAAiB;GAEvC,IAAI,cAAc,QAAQ,OACxB,UAAMM,gCAAM,EAAE,cAAc,CAAC;EAEjC;EAMA,oBAAoB,OAAO,EAAE,KAAK,aAAa;GAC7C,MAAM,oBAAgBN,wCAAiB;GAEvC,MAAM,eAAe,MAAMO,8CAAmB,eAAe,GAAG;GAEhE,IAAI,aAAa,SAAS,GACxB,OAAO,KACL,WAAW,aAAa,OAAO,sBAAsB,aAClD,KAAK,CAAC,MAAM,QAAQ,GAAG,KAAK,UAAU,IAAI,CAAC,CAC3C,KAAK,IAAI,GACd;EAEJ;CACF;AACF"}
@@ -57,5 +57,5 @@ const intlayer = () => ({
57
57
  });
58
58
 
59
59
  //#endregion
60
- export { intlayer };
60
+ export { intlayer as default, intlayer };
61
61
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["viteIntlayerPlugin","viteIntlayerProxyPlugin"],"sources":["../../src/index.ts"],"sourcesContent":["import { resolve } from 'node:path';\nimport { getConfiguration } from '@intlayer/config/node';\nimport { getAlias } from '@intlayer/config/utils';\nimport { prepareIntlayer } from '@intlayer/engine/build';\nimport { watch } from '@intlayer/engine/watcher';\nimport type { AstroIntegration } from 'astro';\nimport type { PluginOption } from 'vite';\nimport {\n intlayer as viteIntlayerPlugin,\n intlayerProxy as viteIntlayerProxyPlugin,\n} from 'vite-intlayer';\nimport { emitRewrittenPages } from './emitRewrittenPages';\n\n/**\n * Astro integration for Intlayer.\n *\n * It handles:\n * 1. Preparing Intlayer resources (dictionaries) at config setup.\n * 2. Injecting Vite plugins for aliases, locale-based routing (middleware), and build optimizations (prune).\n * 3. Configuring Vite aliases for dictionary access.\n * 4. Starting a file watcher for dictionary changes during development.\n * 5. Emitting the prerendered pages at their rewritten (localized) URLs.\n *\n * @returns An Astro integration object.\n *\n * @example\n * ```ts\n * // astro.config.mjs\n * import { defineConfig } from 'astro/config';\n * import { intlayer } from 'astro-intlayer';\n *\n * export default defineConfig({\n * integrations: [intlayer()],\n * });\n * ```\n */\nexport const intlayer = (): AstroIntegration =>\n ({\n name: 'astro-intlayer',\n hooks: {\n 'astro:config:setup': async ({ updateConfig }) => {\n const configuration = getConfiguration();\n\n // Prepare once per process start to ensure generated entries exist\n await prepareIntlayer(configuration);\n\n updateConfig({\n vite: {\n plugins: [\n // Aliases + watcher + buildStart prep\n // (also handles optimize/prune/minify internally)\n viteIntlayerPlugin(),\n // Dev-time middleware for locale routing\n viteIntlayerProxyPlugin(),\n ] as PluginOption[],\n resolve: {\n alias: {\n ...getAlias({\n configuration,\n formatter: (value) => resolve(value),\n }),\n },\n },\n },\n });\n },\n\n 'astro:server:setup': async () => {\n const configuration = getConfiguration();\n\n if (configuration.content.watch) {\n await watch({ configuration });\n }\n },\n\n // Astro renders each page from its canonical file-system route, so a\n // static build has no file for the localized paths declared in\n // `routing.rewrite`. Mirror them here, otherwise the URLs produced by\n // `getLocalizedUrl` (links, hreflang, sitemap) 404 once deployed.\n 'astro:build:done': async ({ dir, logger }) => {\n const configuration = getConfiguration();\n\n const emittedPages = await emitRewrittenPages(configuration, dir);\n\n if (emittedPages.length > 0) {\n logger.info(\n `Emitted ${emittedPages.length} rewritten page(s): ${emittedPages\n .map(([from, to]) => `${from} \\u2192 ${to}`)\n .join(', ')}`\n );\n }\n },\n },\n }) satisfies AstroIntegration;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,MAAa,kBACV;CACC,MAAM;CACN,OAAO;EACL,sBAAsB,OAAO,EAAE,mBAAmB;GAChD,MAAM,gBAAgB,iBAAiB;GAGvC,MAAM,gBAAgB,aAAa;GAEnC,aAAa,EACX,MAAM;IACJ,SAAS,CAGPA,WAAmB,GAEnBC,cAAwB,CAC1B;IACA,SAAS,EACP,OAAO,EACL,GAAG,SAAS;KACV;KACA,YAAY,UAAU,QAAQ,KAAK;IACrC,CAAC,EACH,EACF;GACF,EACF,CAAC;EACH;EAEA,sBAAsB,YAAY;GAChC,MAAM,gBAAgB,iBAAiB;GAEvC,IAAI,cAAc,QAAQ,OACxB,MAAM,MAAM,EAAE,cAAc,CAAC;EAEjC;EAMA,oBAAoB,OAAO,EAAE,KAAK,aAAa;GAC7C,MAAM,gBAAgB,iBAAiB;GAEvC,MAAM,eAAe,MAAM,mBAAmB,eAAe,GAAG;GAEhE,IAAI,aAAa,SAAS,GACxB,OAAO,KACL,WAAW,aAAa,OAAO,sBAAsB,aAClD,KAAK,CAAC,MAAM,QAAQ,GAAG,KAAK,UAAU,IAAI,CAAC,CAC3C,KAAK,IAAI,GACd;EAEJ;CACF;AACF"}
1
+ {"version":3,"file":"index.mjs","names":["viteIntlayerPlugin","viteIntlayerProxyPlugin"],"sources":["../../src/index.ts"],"sourcesContent":["import { resolve } from 'node:path';\nimport { getConfiguration } from '@intlayer/config/node';\nimport { getAlias } from '@intlayer/config/utils';\nimport { prepareIntlayer } from '@intlayer/engine/build';\nimport { watch } from '@intlayer/engine/watcher';\nimport type { AstroIntegration } from 'astro';\nimport type { PluginOption } from 'vite';\nimport {\n intlayer as viteIntlayerPlugin,\n intlayerProxy as viteIntlayerProxyPlugin,\n} from 'vite-intlayer';\nimport { emitRewrittenPages } from './emitRewrittenPages';\n\n/**\n * Astro integration for Intlayer.\n *\n * It handles:\n * 1. Preparing Intlayer resources (dictionaries) at config setup.\n * 2. Injecting Vite plugins for aliases, locale-based routing (middleware), and build optimizations (prune).\n * 3. Configuring Vite aliases for dictionary access.\n * 4. Starting a file watcher for dictionary changes during development.\n * 5. Emitting the prerendered pages at their rewritten (localized) URLs.\n *\n * @returns An Astro integration object.\n *\n * @example\n * ```ts\n * // astro.config.mjs\n * import { defineConfig } from 'astro/config';\n * import { intlayer } from 'astro-intlayer';\n *\n * export default defineConfig({\n * integrations: [intlayer()],\n * });\n * ```\n */\nexport const intlayer = (): AstroIntegration =>\n ({\n name: 'astro-intlayer',\n hooks: {\n 'astro:config:setup': async ({ updateConfig }) => {\n const configuration = getConfiguration();\n\n // Prepare once per process start to ensure generated entries exist\n await prepareIntlayer(configuration);\n\n updateConfig({\n vite: {\n plugins: [\n // Aliases + watcher + buildStart prep\n // (also handles optimize/prune/minify internally)\n viteIntlayerPlugin(),\n // Dev-time middleware for locale routing\n viteIntlayerProxyPlugin(),\n ] as PluginOption[],\n resolve: {\n alias: {\n ...getAlias({\n configuration,\n formatter: (value) => resolve(value),\n }),\n },\n },\n },\n });\n },\n\n 'astro:server:setup': async () => {\n const configuration = getConfiguration();\n\n if (configuration.content.watch) {\n await watch({ configuration });\n }\n },\n\n // Astro renders each page from its canonical file-system route, so a\n // static build has no file for the localized paths declared in\n // `routing.rewrite`. Mirror them here, otherwise the URLs produced by\n // `getLocalizedUrl` (links, hreflang, sitemap) 404 once deployed.\n 'astro:build:done': async ({ dir, logger }) => {\n const configuration = getConfiguration();\n\n const emittedPages = await emitRewrittenPages(configuration, dir);\n\n if (emittedPages.length > 0) {\n logger.info(\n `Emitted ${emittedPages.length} rewritten page(s): ${emittedPages\n .map(([from, to]) => `${from} \\u2192 ${to}`)\n .join(', ')}`\n );\n }\n },\n },\n }) satisfies AstroIntegration;\n\n/**\n * Alias of {@link intlayer}, kept so `astro add astro-intlayer` works.\n *\n * Astro's CLI codemod always writes a default import\n * (`import intlayer from 'astro-intlayer'`) without checking what the package\n * exports, so the integration has to be reachable that way too. The named\n * export stays the documented one.\n */\nexport default intlayer;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,MAAa,kBACV;CACC,MAAM;CACN,OAAO;EACL,sBAAsB,OAAO,EAAE,mBAAmB;GAChD,MAAM,gBAAgB,iBAAiB;GAGvC,MAAM,gBAAgB,aAAa;GAEnC,aAAa,EACX,MAAM;IACJ,SAAS,CAGPA,WAAmB,GAEnBC,cAAwB,CAC1B;IACA,SAAS,EACP,OAAO,EACL,GAAG,SAAS;KACV;KACA,YAAY,UAAU,QAAQ,KAAK;IACrC,CAAC,EACH,EACF;GACF,EACF,CAAC;EACH;EAEA,sBAAsB,YAAY;GAChC,MAAM,gBAAgB,iBAAiB;GAEvC,IAAI,cAAc,QAAQ,OACxB,MAAM,MAAM,EAAE,cAAc,CAAC;EAEjC;EAMA,oBAAoB,OAAO,EAAE,KAAK,aAAa;GAC7C,MAAM,gBAAgB,iBAAiB;GAEvC,MAAM,eAAe,MAAM,mBAAmB,eAAe,GAAG;GAEhE,IAAI,aAAa,SAAS,GACxB,OAAO,KACL,WAAW,aAAa,OAAO,sBAAsB,aAClD,KAAK,CAAC,MAAM,QAAQ,GAAG,KAAK,UAAU,IAAI,CAAC,CAC3C,KAAK,IAAI,GACd;EAEJ;CACF;AACF"}
@@ -25,5 +25,5 @@ import { AstroIntegration } from "astro";
25
25
  */
26
26
  declare const intlayer: () => AstroIntegration;
27
27
  //#endregion
28
- export { intlayer };
28
+ export { intlayer as default, intlayer };
29
29
  //# sourceMappingURL=index.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astro-intlayer",
3
- "version": "9.4.2",
3
+ "version": "9.4.3",
4
4
  "private": false,
5
5
  "description": "Easily internationalize i18n your Astro applications with type-safe multilingual content management.",
6
6
  "keywords": [
@@ -78,11 +78,11 @@
78
78
  "typecheck": "tsc --noEmit --project tsconfig.types.json"
79
79
  },
80
80
  "dependencies": {
81
- "@intlayer/config": "9.4.2",
82
- "@intlayer/core": "9.4.2",
83
- "@intlayer/engine": "9.4.2",
84
- "@intlayer/types": "9.4.2",
85
- "vite-intlayer": "9.4.2"
81
+ "@intlayer/config": "9.4.3",
82
+ "@intlayer/core": "9.4.3",
83
+ "@intlayer/engine": "9.4.3",
84
+ "@intlayer/types": "9.4.3",
85
+ "vite-intlayer": "9.4.3"
86
86
  },
87
87
  "devDependencies": {
88
88
  "@types/node": "26.4.1",