nuxt-intlayer 7.3.10 → 7.3.11

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.
@@ -28,12 +28,12 @@ const module$1 = (0, __nuxt_kit.defineNuxtModule)({
28
28
  mode: "all"
29
29
  });
30
30
  nuxt.hook("vite:extendConfig", (viteConfig, { isServer }) => {
31
- if (isServer) (viteConfig.plugins ?? []).push((0, vite_intlayer.intlayerMiddleware)());
31
+ if (isServer) (viteConfig.plugins ?? []).push((0, vite_intlayer.intlayerProxy)());
32
32
  if (optimize) viteConfig.plugins?.push((0, vite_intlayer.intlayerPrune)(configuration));
33
33
  });
34
34
  nuxt.hook("build:before", async () => (0, __intlayer_chokidar.prepareIntlayer)(configuration));
35
35
  nuxt.hook("ready", async () => {
36
- if (configuration.content.watch) (0, __intlayer_chokidar.watch)({ configuration });
36
+ if (configuration.content.watch && nuxt.options.dev) (0, __intlayer_chokidar.watch)({ configuration });
37
37
  });
38
38
  nuxt.options.alias = {
39
39
  ...nuxt.options.alias,
@@ -1 +1 @@
1
- {"version":3,"file":"module.cjs","names":["module: NuxtModule"],"sources":["../../src/module.ts"],"sourcesContent":["import { resolve } from 'node:path';\nimport { prepareIntlayer, watch } from '@intlayer/chokidar';\nimport { getAlias, getConfiguration } from '@intlayer/config';\nimport { addPlugin, createResolver, defineNuxtModule } from '@nuxt/kit';\nimport type { NuxtModule } from '@nuxt/schema';\nimport { intlayerMiddleware, intlayerPrune } from 'vite-intlayer';\n\n// @ts-ignore fix instantiation is excessively deep and possibly infinite\nexport const module: NuxtModule = defineNuxtModule({\n meta: {\n name: 'nuxt-intlayer',\n },\n setup(_options, nuxt) {\n const configuration = getConfiguration();\n\n const { optimize } = configuration.build;\n /**\n * -------------------------------------------------\n * RUNTIME PLUGIN REGISTRATION\n * -------------------------------------------------\n * Automatically install `vue-intlayer` on the client\n * so developers don't need to add the plugin manually\n * in every Nuxt project.\n */\n const resolver = createResolver(import.meta.url);\n\n addPlugin({\n src: resolver.resolve('./runtime/intlayer-plugin'),\n mode: 'all',\n });\n\n addPlugin({\n src: resolver.resolve('./runtime/html-lang'),\n mode: 'all',\n });\n\n // // Inject the intlayer middleware plugin into Nuxt's Vite config\n nuxt.hook('vite:extendConfig', (viteConfig, { isServer }) => {\n if (isServer) {\n // We only need the middleware on the server side during development\n // viteConfig.plugins can be undefined at this stage\n (viteConfig.plugins ?? []).push(intlayerMiddleware() as any);\n }\n if (optimize) {\n // viteConfig.plugins can be undefined at this stage\n viteConfig.plugins?.push(intlayerPrune(configuration) as any);\n }\n });\n\n // // Equivalent to buildStart in Vite plugin\n nuxt.hook('build:before', async () => prepareIntlayer(configuration));\n\n // // Equivalent to configureServer in Vite plugin\n nuxt.hook('ready', async () => {\n if (configuration.content.watch) {\n // Start watching when dev server is ready\n watch({ configuration });\n }\n });\n\n nuxt.options.alias = {\n ...nuxt.options.alias,\n ...getAlias({\n configuration,\n formatter: (value: string) => resolve(value),\n }),\n };\n\n // After setting up aliases, extend Nuxt pages with locale-aware routes\n nuxt.hook('pages:extend', (pages) => {\n const {\n internationalization: { locales, defaultLocale },\n routing: { mode },\n } = configuration;\n\n // Derived flags from routing.mode\n const noPrefix = mode === 'no-prefix' || mode === 'search-params';\n const prefixDefault = mode === 'prefix-all';\n\n // If noPrefix strategy is enabled we keep Nuxt original routing untouched\n if (noPrefix) return;\n\n // Build a RegExp string with supported locales (e.g. \"en|fr|de\") to ensure the param only accepts known locales\n const filteredLocales = prefixDefault\n ? locales\n : locales.filter((locale) => locale !== defaultLocale);\n const localeGroupRegex = filteredLocales.map(String).join('|');\n\n // If no locales remain to prefix (e.g., only default locale and prefixDefault is false) skip extension\n if (!localeGroupRegex) return;\n\n // Clone the original page list to avoid infinite loops when pushing\n const originalPages = [...pages];\n\n for (const page of originalPages) {\n // Skip already localised routes (prevent double processing)\n if (page.path.startsWith('/:locale')) continue;\n\n // Determine the paths we need to add depending on prefixDefault flag\n // We always add the dynamic \":locale\" prefixed variant so that `/fr/about` works\n const dynPathPrefix = `/:locale(${localeGroupRegex})`;\n const isIndex = page.path === '/';\n const prefixedPath = isIndex\n ? `${dynPathPrefix}`\n : `${dynPathPrefix}${page.path}`;\n\n // If prefixDefault is false and this is the default locale, we keep the original\n // route (already in pages) and add the dynamic variant which will match non default\n // locales. When prefixDefault is true, we still keep the original route for SSR\n // convenience (middleware will redirect anyway) but also expose locale variants.\n\n // Create a shallow copy of the page with the new path\n pages.push({\n ...page,\n path: prefixedPath,\n name: page.name ? `${page.name}___i18n` : undefined,\n });\n }\n });\n },\n});\n"],"mappings":";;;;;;;AAQA,MAAaA,4CAAsC;CACjD,MAAM,EACJ,MAAM,iBACP;CACD,MAAM,UAAU,MAAM;EACpB,MAAM,yDAAkC;EAExC,MAAM,EAAE,aAAa,cAAc;;;;;;;;;EASnC,MAAM,wFAA0C;AAEhD,4BAAU;GACR,KAAK,SAAS,QAAQ,4BAA4B;GAClD,MAAM;GACP,CAAC;AAEF,4BAAU;GACR,KAAK,SAAS,QAAQ,sBAAsB;GAC5C,MAAM;GACP,CAAC;AAGF,OAAK,KAAK,sBAAsB,YAAY,EAAE,eAAe;AAC3D,OAAI,SAGF,EAAC,WAAW,WAAW,EAAE,EAAE,4CAAyB,CAAQ;AAE9D,OAAI,SAEF,YAAW,SAAS,sCAAmB,cAAc,CAAQ;IAE/D;AAGF,OAAK,KAAK,gBAAgB,qDAA4B,cAAc,CAAC;AAGrE,OAAK,KAAK,SAAS,YAAY;AAC7B,OAAI,cAAc,QAAQ,MAExB,gCAAM,EAAE,eAAe,CAAC;IAE1B;AAEF,OAAK,QAAQ,QAAQ;GACnB,GAAG,KAAK,QAAQ;GAChB,mCAAY;IACV;IACA,YAAY,iCAA0B,MAAM;IAC7C,CAAC;GACH;AAGD,OAAK,KAAK,iBAAiB,UAAU;GACnC,MAAM,EACJ,sBAAsB,EAAE,SAAS,iBACjC,SAAS,EAAE,WACT;GAGJ,MAAM,WAAW,SAAS,eAAe,SAAS;GAClD,MAAM,gBAAgB,SAAS;AAG/B,OAAI,SAAU;GAMd,MAAM,oBAHkB,gBACpB,UACA,QAAQ,QAAQ,WAAW,WAAW,cAAc,EACf,IAAI,OAAO,CAAC,KAAK,IAAI;AAG9D,OAAI,CAAC,iBAAkB;GAGvB,MAAM,gBAAgB,CAAC,GAAG,MAAM;AAEhC,QAAK,MAAM,QAAQ,eAAe;AAEhC,QAAI,KAAK,KAAK,WAAW,WAAW,CAAE;IAItC,MAAM,gBAAgB,YAAY,iBAAiB;IAEnD,MAAM,eADU,KAAK,SAAS,MAE1B,GAAG,kBACH,GAAG,gBAAgB,KAAK;AAQ5B,UAAM,KAAK;KACT,GAAG;KACH,MAAM;KACN,MAAM,KAAK,OAAO,GAAG,KAAK,KAAK,WAAW;KAC3C,CAAC;;IAEJ;;CAEL,CAAC"}
1
+ {"version":3,"file":"module.cjs","names":["module: NuxtModule"],"sources":["../../src/module.ts"],"sourcesContent":["import { resolve } from 'node:path';\nimport { prepareIntlayer, watch } from '@intlayer/chokidar';\nimport { getAlias, getConfiguration } from '@intlayer/config';\nimport { addPlugin, createResolver, defineNuxtModule } from '@nuxt/kit';\nimport type { NuxtModule } from '@nuxt/schema';\nimport { intlayerProxy, intlayerPrune } from 'vite-intlayer';\n\n// @ts-ignore fix instantiation is excessively deep and possibly infinite\nexport const module: NuxtModule = defineNuxtModule({\n meta: {\n name: 'nuxt-intlayer',\n },\n setup(_options, nuxt) {\n const configuration = getConfiguration();\n\n const { optimize } = configuration.build;\n /**\n * -------------------------------------------------\n * RUNTIME PLUGIN REGISTRATION\n * -------------------------------------------------\n * Automatically install `vue-intlayer` on the client\n * so developers don't need to add the plugin manually\n * in every Nuxt project.\n */\n const resolver = createResolver(import.meta.url);\n\n addPlugin({\n src: resolver.resolve('./runtime/intlayer-plugin'),\n mode: 'all',\n });\n\n addPlugin({\n src: resolver.resolve('./runtime/html-lang'),\n mode: 'all',\n });\n\n // // Inject the intlayer middleware plugin into Nuxt's Vite config\n nuxt.hook('vite:extendConfig', (viteConfig, { isServer }) => {\n if (isServer) {\n // We only need the middleware on the server side during development\n // viteConfig.plugins can be undefined at this stage\n (viteConfig.plugins ?? []).push(intlayerProxy());\n }\n if (optimize) {\n // viteConfig.plugins can be undefined at this stage\n viteConfig.plugins?.push(intlayerPrune(configuration));\n }\n });\n\n // // Equivalent to buildStart in Vite plugin\n nuxt.hook('build:before', async () => prepareIntlayer(configuration));\n\n // // Equivalent to configureServer in Vite plugin\n nuxt.hook('ready', async () => {\n if (configuration.content.watch && nuxt.options.dev) {\n // Start watching when dev server is ready\n watch({ configuration });\n }\n });\n\n nuxt.options.alias = {\n ...nuxt.options.alias,\n ...getAlias({\n configuration,\n formatter: (value: string) => resolve(value),\n }),\n };\n\n // After setting up aliases, extend Nuxt pages with locale-aware routes\n nuxt.hook('pages:extend', (pages) => {\n const {\n internationalization: { locales, defaultLocale },\n routing: { mode },\n } = configuration;\n\n // Derived flags from routing.mode\n const noPrefix = mode === 'no-prefix' || mode === 'search-params';\n const prefixDefault = mode === 'prefix-all';\n\n // If noPrefix strategy is enabled we keep Nuxt original routing untouched\n if (noPrefix) return;\n\n // Build a RegExp string with supported locales (e.g. \"en|fr|de\") to ensure the param only accepts known locales\n const filteredLocales = prefixDefault\n ? locales\n : locales.filter((locale) => locale !== defaultLocale);\n const localeGroupRegex = filteredLocales.map(String).join('|');\n\n // If no locales remain to prefix (e.g., only default locale and prefixDefault is false) skip extension\n if (!localeGroupRegex) return;\n\n // Clone the original page list to avoid infinite loops when pushing\n const originalPages = [...pages];\n\n for (const page of originalPages) {\n // Skip already localised routes (prevent double processing)\n if (page.path.startsWith('/:locale')) continue;\n\n // Determine the paths we need to add depending on prefixDefault flag\n // We always add the dynamic \":locale\" prefixed variant so that `/fr/about` works\n const dynPathPrefix = `/:locale(${localeGroupRegex})`;\n const isIndex = page.path === '/';\n const prefixedPath = isIndex\n ? `${dynPathPrefix}`\n : `${dynPathPrefix}${page.path}`;\n\n // If prefixDefault is false and this is the default locale, we keep the original\n // route (already in pages) and add the dynamic variant which will match non default\n // locales. When prefixDefault is true, we still keep the original route for SSR\n // convenience (middleware will redirect anyway) but also expose locale variants.\n\n // Create a shallow copy of the page with the new path\n pages.push({\n ...page,\n path: prefixedPath,\n name: page.name ? `${page.name}___i18n` : undefined,\n });\n }\n });\n },\n});\n"],"mappings":";;;;;;;AAQA,MAAaA,4CAAsC;CACjD,MAAM,EACJ,MAAM,iBACP;CACD,MAAM,UAAU,MAAM;EACpB,MAAM,yDAAkC;EAExC,MAAM,EAAE,aAAa,cAAc;;;;;;;;;EASnC,MAAM,wFAA0C;AAEhD,4BAAU;GACR,KAAK,SAAS,QAAQ,4BAA4B;GAClD,MAAM;GACP,CAAC;AAEF,4BAAU;GACR,KAAK,SAAS,QAAQ,sBAAsB;GAC5C,MAAM;GACP,CAAC;AAGF,OAAK,KAAK,sBAAsB,YAAY,EAAE,eAAe;AAC3D,OAAI,SAGF,EAAC,WAAW,WAAW,EAAE,EAAE,uCAAoB,CAAC;AAElD,OAAI,SAEF,YAAW,SAAS,sCAAmB,cAAc,CAAC;IAExD;AAGF,OAAK,KAAK,gBAAgB,qDAA4B,cAAc,CAAC;AAGrE,OAAK,KAAK,SAAS,YAAY;AAC7B,OAAI,cAAc,QAAQ,SAAS,KAAK,QAAQ,IAE9C,gCAAM,EAAE,eAAe,CAAC;IAE1B;AAEF,OAAK,QAAQ,QAAQ;GACnB,GAAG,KAAK,QAAQ;GAChB,mCAAY;IACV;IACA,YAAY,iCAA0B,MAAM;IAC7C,CAAC;GACH;AAGD,OAAK,KAAK,iBAAiB,UAAU;GACnC,MAAM,EACJ,sBAAsB,EAAE,SAAS,iBACjC,SAAS,EAAE,WACT;GAGJ,MAAM,WAAW,SAAS,eAAe,SAAS;GAClD,MAAM,gBAAgB,SAAS;AAG/B,OAAI,SAAU;GAMd,MAAM,oBAHkB,gBACpB,UACA,QAAQ,QAAQ,WAAW,WAAW,cAAc,EACf,IAAI,OAAO,CAAC,KAAK,IAAI;AAG9D,OAAI,CAAC,iBAAkB;GAGvB,MAAM,gBAAgB,CAAC,GAAG,MAAM;AAEhC,QAAK,MAAM,QAAQ,eAAe;AAEhC,QAAI,KAAK,KAAK,WAAW,WAAW,CAAE;IAItC,MAAM,gBAAgB,YAAY,iBAAiB;IAEnD,MAAM,eADU,KAAK,SAAS,MAE1B,GAAG,kBACH,GAAG,gBAAgB,KAAK;AAQ5B,UAAM,KAAK;KACT,GAAG;KACH,MAAM;KACN,MAAM,KAAK,OAAO,GAAG,KAAK,KAAK,WAAW;KAC3C,CAAC;;IAEJ;;CAEL,CAAC"}
@@ -2,7 +2,7 @@ import { resolve } from "node:path";
2
2
  import { prepareIntlayer, watch } from "@intlayer/chokidar";
3
3
  import { getAlias, getConfiguration } from "@intlayer/config";
4
4
  import { addPlugin, createResolver, defineNuxtModule } from "@nuxt/kit";
5
- import { intlayerMiddleware, intlayerPrune } from "vite-intlayer";
5
+ import { intlayerProxy, intlayerPrune } from "vite-intlayer";
6
6
 
7
7
  //#region src/module.ts
8
8
  const module = defineNuxtModule({
@@ -28,12 +28,12 @@ const module = defineNuxtModule({
28
28
  mode: "all"
29
29
  });
30
30
  nuxt.hook("vite:extendConfig", (viteConfig, { isServer }) => {
31
- if (isServer) (viteConfig.plugins ?? []).push(intlayerMiddleware());
31
+ if (isServer) (viteConfig.plugins ?? []).push(intlayerProxy());
32
32
  if (optimize) viteConfig.plugins?.push(intlayerPrune(configuration));
33
33
  });
34
34
  nuxt.hook("build:before", async () => prepareIntlayer(configuration));
35
35
  nuxt.hook("ready", async () => {
36
- if (configuration.content.watch) watch({ configuration });
36
+ if (configuration.content.watch && nuxt.options.dev) watch({ configuration });
37
37
  });
38
38
  nuxt.options.alias = {
39
39
  ...nuxt.options.alias,
@@ -1 +1 @@
1
- {"version":3,"file":"module.mjs","names":["module: NuxtModule"],"sources":["../../src/module.ts"],"sourcesContent":["import { resolve } from 'node:path';\nimport { prepareIntlayer, watch } from '@intlayer/chokidar';\nimport { getAlias, getConfiguration } from '@intlayer/config';\nimport { addPlugin, createResolver, defineNuxtModule } from '@nuxt/kit';\nimport type { NuxtModule } from '@nuxt/schema';\nimport { intlayerMiddleware, intlayerPrune } from 'vite-intlayer';\n\n// @ts-ignore fix instantiation is excessively deep and possibly infinite\nexport const module: NuxtModule = defineNuxtModule({\n meta: {\n name: 'nuxt-intlayer',\n },\n setup(_options, nuxt) {\n const configuration = getConfiguration();\n\n const { optimize } = configuration.build;\n /**\n * -------------------------------------------------\n * RUNTIME PLUGIN REGISTRATION\n * -------------------------------------------------\n * Automatically install `vue-intlayer` on the client\n * so developers don't need to add the plugin manually\n * in every Nuxt project.\n */\n const resolver = createResolver(import.meta.url);\n\n addPlugin({\n src: resolver.resolve('./runtime/intlayer-plugin'),\n mode: 'all',\n });\n\n addPlugin({\n src: resolver.resolve('./runtime/html-lang'),\n mode: 'all',\n });\n\n // // Inject the intlayer middleware plugin into Nuxt's Vite config\n nuxt.hook('vite:extendConfig', (viteConfig, { isServer }) => {\n if (isServer) {\n // We only need the middleware on the server side during development\n // viteConfig.plugins can be undefined at this stage\n (viteConfig.plugins ?? []).push(intlayerMiddleware() as any);\n }\n if (optimize) {\n // viteConfig.plugins can be undefined at this stage\n viteConfig.plugins?.push(intlayerPrune(configuration) as any);\n }\n });\n\n // // Equivalent to buildStart in Vite plugin\n nuxt.hook('build:before', async () => prepareIntlayer(configuration));\n\n // // Equivalent to configureServer in Vite plugin\n nuxt.hook('ready', async () => {\n if (configuration.content.watch) {\n // Start watching when dev server is ready\n watch({ configuration });\n }\n });\n\n nuxt.options.alias = {\n ...nuxt.options.alias,\n ...getAlias({\n configuration,\n formatter: (value: string) => resolve(value),\n }),\n };\n\n // After setting up aliases, extend Nuxt pages with locale-aware routes\n nuxt.hook('pages:extend', (pages) => {\n const {\n internationalization: { locales, defaultLocale },\n routing: { mode },\n } = configuration;\n\n // Derived flags from routing.mode\n const noPrefix = mode === 'no-prefix' || mode === 'search-params';\n const prefixDefault = mode === 'prefix-all';\n\n // If noPrefix strategy is enabled we keep Nuxt original routing untouched\n if (noPrefix) return;\n\n // Build a RegExp string with supported locales (e.g. \"en|fr|de\") to ensure the param only accepts known locales\n const filteredLocales = prefixDefault\n ? locales\n : locales.filter((locale) => locale !== defaultLocale);\n const localeGroupRegex = filteredLocales.map(String).join('|');\n\n // If no locales remain to prefix (e.g., only default locale and prefixDefault is false) skip extension\n if (!localeGroupRegex) return;\n\n // Clone the original page list to avoid infinite loops when pushing\n const originalPages = [...pages];\n\n for (const page of originalPages) {\n // Skip already localised routes (prevent double processing)\n if (page.path.startsWith('/:locale')) continue;\n\n // Determine the paths we need to add depending on prefixDefault flag\n // We always add the dynamic \":locale\" prefixed variant so that `/fr/about` works\n const dynPathPrefix = `/:locale(${localeGroupRegex})`;\n const isIndex = page.path === '/';\n const prefixedPath = isIndex\n ? `${dynPathPrefix}`\n : `${dynPathPrefix}${page.path}`;\n\n // If prefixDefault is false and this is the default locale, we keep the original\n // route (already in pages) and add the dynamic variant which will match non default\n // locales. When prefixDefault is true, we still keep the original route for SSR\n // convenience (middleware will redirect anyway) but also expose locale variants.\n\n // Create a shallow copy of the page with the new path\n pages.push({\n ...page,\n path: prefixedPath,\n name: page.name ? `${page.name}___i18n` : undefined,\n });\n }\n });\n },\n});\n"],"mappings":";;;;;;;AAQA,MAAaA,SAAqB,iBAAiB;CACjD,MAAM,EACJ,MAAM,iBACP;CACD,MAAM,UAAU,MAAM;EACpB,MAAM,gBAAgB,kBAAkB;EAExC,MAAM,EAAE,aAAa,cAAc;;;;;;;;;EASnC,MAAM,WAAW,eAAe,OAAO,KAAK,IAAI;AAEhD,YAAU;GACR,KAAK,SAAS,QAAQ,4BAA4B;GAClD,MAAM;GACP,CAAC;AAEF,YAAU;GACR,KAAK,SAAS,QAAQ,sBAAsB;GAC5C,MAAM;GACP,CAAC;AAGF,OAAK,KAAK,sBAAsB,YAAY,EAAE,eAAe;AAC3D,OAAI,SAGF,EAAC,WAAW,WAAW,EAAE,EAAE,KAAK,oBAAoB,CAAQ;AAE9D,OAAI,SAEF,YAAW,SAAS,KAAK,cAAc,cAAc,CAAQ;IAE/D;AAGF,OAAK,KAAK,gBAAgB,YAAY,gBAAgB,cAAc,CAAC;AAGrE,OAAK,KAAK,SAAS,YAAY;AAC7B,OAAI,cAAc,QAAQ,MAExB,OAAM,EAAE,eAAe,CAAC;IAE1B;AAEF,OAAK,QAAQ,QAAQ;GACnB,GAAG,KAAK,QAAQ;GAChB,GAAG,SAAS;IACV;IACA,YAAY,UAAkB,QAAQ,MAAM;IAC7C,CAAC;GACH;AAGD,OAAK,KAAK,iBAAiB,UAAU;GACnC,MAAM,EACJ,sBAAsB,EAAE,SAAS,iBACjC,SAAS,EAAE,WACT;GAGJ,MAAM,WAAW,SAAS,eAAe,SAAS;GAClD,MAAM,gBAAgB,SAAS;AAG/B,OAAI,SAAU;GAMd,MAAM,oBAHkB,gBACpB,UACA,QAAQ,QAAQ,WAAW,WAAW,cAAc,EACf,IAAI,OAAO,CAAC,KAAK,IAAI;AAG9D,OAAI,CAAC,iBAAkB;GAGvB,MAAM,gBAAgB,CAAC,GAAG,MAAM;AAEhC,QAAK,MAAM,QAAQ,eAAe;AAEhC,QAAI,KAAK,KAAK,WAAW,WAAW,CAAE;IAItC,MAAM,gBAAgB,YAAY,iBAAiB;IAEnD,MAAM,eADU,KAAK,SAAS,MAE1B,GAAG,kBACH,GAAG,gBAAgB,KAAK;AAQ5B,UAAM,KAAK;KACT,GAAG;KACH,MAAM;KACN,MAAM,KAAK,OAAO,GAAG,KAAK,KAAK,WAAW;KAC3C,CAAC;;IAEJ;;CAEL,CAAC"}
1
+ {"version":3,"file":"module.mjs","names":["module: NuxtModule"],"sources":["../../src/module.ts"],"sourcesContent":["import { resolve } from 'node:path';\nimport { prepareIntlayer, watch } from '@intlayer/chokidar';\nimport { getAlias, getConfiguration } from '@intlayer/config';\nimport { addPlugin, createResolver, defineNuxtModule } from '@nuxt/kit';\nimport type { NuxtModule } from '@nuxt/schema';\nimport { intlayerProxy, intlayerPrune } from 'vite-intlayer';\n\n// @ts-ignore fix instantiation is excessively deep and possibly infinite\nexport const module: NuxtModule = defineNuxtModule({\n meta: {\n name: 'nuxt-intlayer',\n },\n setup(_options, nuxt) {\n const configuration = getConfiguration();\n\n const { optimize } = configuration.build;\n /**\n * -------------------------------------------------\n * RUNTIME PLUGIN REGISTRATION\n * -------------------------------------------------\n * Automatically install `vue-intlayer` on the client\n * so developers don't need to add the plugin manually\n * in every Nuxt project.\n */\n const resolver = createResolver(import.meta.url);\n\n addPlugin({\n src: resolver.resolve('./runtime/intlayer-plugin'),\n mode: 'all',\n });\n\n addPlugin({\n src: resolver.resolve('./runtime/html-lang'),\n mode: 'all',\n });\n\n // // Inject the intlayer middleware plugin into Nuxt's Vite config\n nuxt.hook('vite:extendConfig', (viteConfig, { isServer }) => {\n if (isServer) {\n // We only need the middleware on the server side during development\n // viteConfig.plugins can be undefined at this stage\n (viteConfig.plugins ?? []).push(intlayerProxy());\n }\n if (optimize) {\n // viteConfig.plugins can be undefined at this stage\n viteConfig.plugins?.push(intlayerPrune(configuration));\n }\n });\n\n // // Equivalent to buildStart in Vite plugin\n nuxt.hook('build:before', async () => prepareIntlayer(configuration));\n\n // // Equivalent to configureServer in Vite plugin\n nuxt.hook('ready', async () => {\n if (configuration.content.watch && nuxt.options.dev) {\n // Start watching when dev server is ready\n watch({ configuration });\n }\n });\n\n nuxt.options.alias = {\n ...nuxt.options.alias,\n ...getAlias({\n configuration,\n formatter: (value: string) => resolve(value),\n }),\n };\n\n // After setting up aliases, extend Nuxt pages with locale-aware routes\n nuxt.hook('pages:extend', (pages) => {\n const {\n internationalization: { locales, defaultLocale },\n routing: { mode },\n } = configuration;\n\n // Derived flags from routing.mode\n const noPrefix = mode === 'no-prefix' || mode === 'search-params';\n const prefixDefault = mode === 'prefix-all';\n\n // If noPrefix strategy is enabled we keep Nuxt original routing untouched\n if (noPrefix) return;\n\n // Build a RegExp string with supported locales (e.g. \"en|fr|de\") to ensure the param only accepts known locales\n const filteredLocales = prefixDefault\n ? locales\n : locales.filter((locale) => locale !== defaultLocale);\n const localeGroupRegex = filteredLocales.map(String).join('|');\n\n // If no locales remain to prefix (e.g., only default locale and prefixDefault is false) skip extension\n if (!localeGroupRegex) return;\n\n // Clone the original page list to avoid infinite loops when pushing\n const originalPages = [...pages];\n\n for (const page of originalPages) {\n // Skip already localised routes (prevent double processing)\n if (page.path.startsWith('/:locale')) continue;\n\n // Determine the paths we need to add depending on prefixDefault flag\n // We always add the dynamic \":locale\" prefixed variant so that `/fr/about` works\n const dynPathPrefix = `/:locale(${localeGroupRegex})`;\n const isIndex = page.path === '/';\n const prefixedPath = isIndex\n ? `${dynPathPrefix}`\n : `${dynPathPrefix}${page.path}`;\n\n // If prefixDefault is false and this is the default locale, we keep the original\n // route (already in pages) and add the dynamic variant which will match non default\n // locales. When prefixDefault is true, we still keep the original route for SSR\n // convenience (middleware will redirect anyway) but also expose locale variants.\n\n // Create a shallow copy of the page with the new path\n pages.push({\n ...page,\n path: prefixedPath,\n name: page.name ? `${page.name}___i18n` : undefined,\n });\n }\n });\n },\n});\n"],"mappings":";;;;;;;AAQA,MAAaA,SAAqB,iBAAiB;CACjD,MAAM,EACJ,MAAM,iBACP;CACD,MAAM,UAAU,MAAM;EACpB,MAAM,gBAAgB,kBAAkB;EAExC,MAAM,EAAE,aAAa,cAAc;;;;;;;;;EASnC,MAAM,WAAW,eAAe,OAAO,KAAK,IAAI;AAEhD,YAAU;GACR,KAAK,SAAS,QAAQ,4BAA4B;GAClD,MAAM;GACP,CAAC;AAEF,YAAU;GACR,KAAK,SAAS,QAAQ,sBAAsB;GAC5C,MAAM;GACP,CAAC;AAGF,OAAK,KAAK,sBAAsB,YAAY,EAAE,eAAe;AAC3D,OAAI,SAGF,EAAC,WAAW,WAAW,EAAE,EAAE,KAAK,eAAe,CAAC;AAElD,OAAI,SAEF,YAAW,SAAS,KAAK,cAAc,cAAc,CAAC;IAExD;AAGF,OAAK,KAAK,gBAAgB,YAAY,gBAAgB,cAAc,CAAC;AAGrE,OAAK,KAAK,SAAS,YAAY;AAC7B,OAAI,cAAc,QAAQ,SAAS,KAAK,QAAQ,IAE9C,OAAM,EAAE,eAAe,CAAC;IAE1B;AAEF,OAAK,QAAQ,QAAQ;GACnB,GAAG,KAAK,QAAQ;GAChB,GAAG,SAAS;IACV;IACA,YAAY,UAAkB,QAAQ,MAAM;IAC7C,CAAC;GACH;AAGD,OAAK,KAAK,iBAAiB,UAAU;GACnC,MAAM,EACJ,sBAAsB,EAAE,SAAS,iBACjC,SAAS,EAAE,WACT;GAGJ,MAAM,WAAW,SAAS,eAAe,SAAS;GAClD,MAAM,gBAAgB,SAAS;AAG/B,OAAI,SAAU;GAMd,MAAM,oBAHkB,gBACpB,UACA,QAAQ,QAAQ,WAAW,WAAW,cAAc,EACf,IAAI,OAAO,CAAC,KAAK,IAAI;AAG9D,OAAI,CAAC,iBAAkB;GAGvB,MAAM,gBAAgB,CAAC,GAAG,MAAM;AAEhC,QAAK,MAAM,QAAQ,eAAe;AAEhC,QAAI,KAAK,KAAK,WAAW,WAAW,CAAE;IAItC,MAAM,gBAAgB,YAAY,iBAAiB;IAEnD,MAAM,eADU,KAAK,SAAS,MAE1B,GAAG,kBACH,GAAG,gBAAgB,KAAK;AAQ5B,UAAM,KAAK;KACT,GAAG;KACH,MAAM;KACN,MAAM,KAAK,OAAO,GAAG,KAAK,KAAK,WAAW;KAC3C,CAAC;;IAEJ;;CAEL,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-intlayer",
3
- "version": "7.3.10",
3
+ "version": "7.3.11",
4
4
  "private": false,
5
5
  "description": "Easily internationalize i18n your Nuxt applications with type-safe multilingual content management.",
6
6
  "keywords": [
@@ -77,12 +77,12 @@
77
77
  "typecheck": "tsc --noEmit --project tsconfig.types.json"
78
78
  },
79
79
  "dependencies": {
80
- "@intlayer/chokidar": "7.3.10",
81
- "@intlayer/config": "7.3.10",
82
- "@intlayer/core": "7.3.10",
83
- "@intlayer/types": "7.3.10",
84
- "vite-intlayer": "7.3.10",
85
- "vue-intlayer": "7.3.10"
80
+ "@intlayer/chokidar": "7.3.11",
81
+ "@intlayer/config": "7.3.11",
82
+ "@intlayer/core": "7.3.11",
83
+ "@intlayer/types": "7.3.11",
84
+ "vite-intlayer": "7.3.11",
85
+ "vue-intlayer": "7.3.11"
86
86
  },
87
87
  "devDependencies": {
88
88
  "@types/node": "24.10.1",