nuxt-intlayer 7.3.11 → 7.3.12

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,15 +1,13 @@
1
- import { resolve } from "node:path";
2
- import { prepareIntlayer, watch } from "@intlayer/chokidar";
3
- import { getAlias, getConfiguration } from "@intlayer/config";
1
+ import { getConfiguration } from "@intlayer/config";
2
+ import { getPrefix } from "@intlayer/core";
4
3
  import { addPlugin, createResolver, defineNuxtModule } from "@nuxt/kit";
5
- import { intlayerProxy, intlayerPrune } from "vite-intlayer";
4
+ import { intlayer, intlayerProxy } from "vite-intlayer";
6
5
 
7
6
  //#region src/module.ts
8
7
  const module = defineNuxtModule({
9
8
  meta: { name: "nuxt-intlayer" },
10
9
  setup(_options, nuxt) {
11
10
  const configuration = getConfiguration();
12
- const { optimize } = configuration.build;
13
11
  /**
14
12
  * -------------------------------------------------
15
13
  * RUNTIME PLUGIN REGISTRATION
@@ -29,25 +27,17 @@ const module = defineNuxtModule({
29
27
  });
30
28
  nuxt.hook("vite:extendConfig", (viteConfig, { isServer }) => {
31
29
  if (isServer) (viteConfig.plugins ?? []).push(intlayerProxy());
32
- if (optimize) viteConfig.plugins?.push(intlayerPrune(configuration));
30
+ viteConfig.plugins?.push(intlayer());
33
31
  });
34
- nuxt.hook("build:before", async () => prepareIntlayer(configuration));
35
- nuxt.hook("ready", async () => {
36
- if (configuration.content.watch && nuxt.options.dev) watch({ configuration });
37
- });
38
- nuxt.options.alias = {
39
- ...nuxt.options.alias,
40
- ...getAlias({
41
- configuration,
42
- formatter: (value) => resolve(value)
43
- })
44
- };
45
32
  nuxt.hook("pages:extend", (pages) => {
46
33
  const { internationalization: { locales, defaultLocale }, routing: { mode } } = configuration;
47
- const noPrefix = mode === "no-prefix" || mode === "search-params";
48
- const prefixDefault = mode === "prefix-all";
49
- if (noPrefix) return;
50
- const localeGroupRegex = (prefixDefault ? locales : locales.filter((locale) => locale !== defaultLocale)).map(String).join("|");
34
+ const localeGroupRegex = locales.filter((locale) => {
35
+ const { localePrefix } = getPrefix(locale, {
36
+ mode,
37
+ defaultLocale
38
+ });
39
+ return localePrefix !== void 0;
40
+ }).map(String).join("|");
51
41
  if (!localeGroupRegex) return;
52
42
  const originalPages = [...pages];
53
43
  for (const page of originalPages) {
@@ -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 { 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"}
1
+ {"version":3,"file":"module.mjs","names":["module: NuxtModule"],"sources":["../../src/module.ts"],"sourcesContent":["import { getConfiguration } from '@intlayer/config';\nimport { getPrefix } from '@intlayer/core';\nimport { addPlugin, createResolver, defineNuxtModule } from '@nuxt/kit';\nimport type { NuxtModule } from '@nuxt/schema';\nimport { intlayer, intlayerProxy } 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 /**\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\n viteConfig.plugins?.push(intlayer());\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 // Build a RegExp string with supported locales (e.g. \"en|fr|de\") to ensure the param only accepts known locales\n const filteredLocales = locales.filter((locale) => {\n const { localePrefix } = getPrefix(locale, {\n mode,\n defaultLocale,\n });\n return localePrefix !== undefined;\n });\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":";;;;;;AAOA,MAAaA,SAAqB,iBAAiB;CACjD,MAAM,EACJ,MAAM,iBACP;CACD,MAAM,UAAU,MAAM;EACpB,MAAM,gBAAgB,kBAAkB;;;;;;;;;EAUxC,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;AAGlD,cAAW,SAAS,KAAK,UAAU,CAAC;IACpC;AAGF,OAAK,KAAK,iBAAiB,UAAU;GACnC,MAAM,EACJ,sBAAsB,EAAE,SAAS,iBACjC,SAAS,EAAE,WACT;GAUJ,MAAM,mBAPkB,QAAQ,QAAQ,WAAW;IACjD,MAAM,EAAE,iBAAiB,UAAU,QAAQ;KACzC;KACA;KACD,CAAC;AACF,WAAO,iBAAiB;KACxB,CACuC,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 +1 @@
1
- {"version":3,"file":"module.d.ts","names":[],"sources":["../../src/module.ts"],"sourcesContent":[],"mappings":";;;cAQa,QAAQ"}
1
+ {"version":3,"file":"module.d.ts","names":[],"sources":["../../src/module.ts"],"sourcesContent":[],"mappings":";;;cAOa,QAAQ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-intlayer",
3
- "version": "7.3.11",
3
+ "version": "7.3.12",
4
4
  "private": false,
5
5
  "description": "Easily internationalize i18n your Nuxt applications with type-safe multilingual content management.",
6
6
  "keywords": [
@@ -36,17 +36,18 @@
36
36
  }
37
37
  ],
38
38
  "sideEffects": false,
39
+ "type": "module",
39
40
  "exports": {
40
41
  ".": {
41
42
  "types": "./dist/types/index.d.ts",
42
- "require": "./dist/cjs/index.cjs",
43
- "import": "./dist/esm/index.mjs"
43
+ "import": "./dist/esm/index.mjs",
44
+ "default": "./dist/esm/index.mjs"
44
45
  },
45
46
  "./package.json": "./package.json"
46
47
  },
47
- "main": "dist/cjs/index.cjs",
48
- "module": "dist/esm/index.mjs",
49
- "types": "dist/types/index.d.ts",
48
+ "main": "./dist/esm/index.mjs",
49
+ "module": "./dist/esm/index.mjs",
50
+ "types": "./dist/types/index.d.ts",
50
51
  "typesVersions": {
51
52
  "*": {
52
53
  "package.json": [
@@ -77,12 +78,11 @@
77
78
  "typecheck": "tsc --noEmit --project tsconfig.types.json"
78
79
  },
79
80
  "dependencies": {
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"
81
+ "@intlayer/config": "7.3.12",
82
+ "@intlayer/core": "7.3.12",
83
+ "@intlayer/types": "7.3.12",
84
+ "vite-intlayer": "7.3.12",
85
+ "vue-intlayer": "7.3.12"
86
86
  },
87
87
  "devDependencies": {
88
88
  "@types/node": "24.10.1",
@@ -1,8 +0,0 @@
1
- const require_module = require('./module.cjs');
2
-
3
- //#region src/index.ts
4
- var src_default = require_module.module;
5
-
6
- //#endregion
7
- module.exports = src_default;
8
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.cjs","names":["module"],"sources":["../../src/index.ts"],"sourcesContent":["import { module } from './module';\n\nexport default module;\n"],"mappings":";;;AAEA,kBAAeA"}
@@ -1,69 +0,0 @@
1
- let node_path = require("node:path");
2
- let __intlayer_chokidar = require("@intlayer/chokidar");
3
- let __intlayer_config = require("@intlayer/config");
4
- let __nuxt_kit = require("@nuxt/kit");
5
- let vite_intlayer = require("vite-intlayer");
6
-
7
- //#region src/module.ts
8
- const module$1 = (0, __nuxt_kit.defineNuxtModule)({
9
- meta: { name: "nuxt-intlayer" },
10
- setup(_options, nuxt) {
11
- const configuration = (0, __intlayer_config.getConfiguration)();
12
- const { optimize } = configuration.build;
13
- /**
14
- * -------------------------------------------------
15
- * RUNTIME PLUGIN REGISTRATION
16
- * -------------------------------------------------
17
- * Automatically install `vue-intlayer` on the client
18
- * so developers don't need to add the plugin manually
19
- * in every Nuxt project.
20
- */
21
- const resolver = (0, __nuxt_kit.createResolver)(require("url").pathToFileURL(__filename).href);
22
- (0, __nuxt_kit.addPlugin)({
23
- src: resolver.resolve("./runtime/intlayer-plugin"),
24
- mode: "all"
25
- });
26
- (0, __nuxt_kit.addPlugin)({
27
- src: resolver.resolve("./runtime/html-lang"),
28
- mode: "all"
29
- });
30
- nuxt.hook("vite:extendConfig", (viteConfig, { isServer }) => {
31
- if (isServer) (viteConfig.plugins ?? []).push((0, vite_intlayer.intlayerProxy)());
32
- if (optimize) viteConfig.plugins?.push((0, vite_intlayer.intlayerPrune)(configuration));
33
- });
34
- nuxt.hook("build:before", async () => (0, __intlayer_chokidar.prepareIntlayer)(configuration));
35
- nuxt.hook("ready", async () => {
36
- if (configuration.content.watch && nuxt.options.dev) (0, __intlayer_chokidar.watch)({ configuration });
37
- });
38
- nuxt.options.alias = {
39
- ...nuxt.options.alias,
40
- ...(0, __intlayer_config.getAlias)({
41
- configuration,
42
- formatter: (value) => (0, node_path.resolve)(value)
43
- })
44
- };
45
- nuxt.hook("pages:extend", (pages) => {
46
- const { internationalization: { locales, defaultLocale }, routing: { mode } } = configuration;
47
- const noPrefix = mode === "no-prefix" || mode === "search-params";
48
- const prefixDefault = mode === "prefix-all";
49
- if (noPrefix) return;
50
- const localeGroupRegex = (prefixDefault ? locales : locales.filter((locale) => locale !== defaultLocale)).map(String).join("|");
51
- if (!localeGroupRegex) return;
52
- const originalPages = [...pages];
53
- for (const page of originalPages) {
54
- if (page.path.startsWith("/:locale")) continue;
55
- const dynPathPrefix = `/:locale(${localeGroupRegex})`;
56
- const prefixedPath = page.path === "/" ? `${dynPathPrefix}` : `${dynPathPrefix}${page.path}`;
57
- pages.push({
58
- ...page,
59
- path: prefixedPath,
60
- name: page.name ? `${page.name}___i18n` : void 0
61
- });
62
- }
63
- });
64
- }
65
- });
66
-
67
- //#endregion
68
- exports.module = module$1;
69
- //# sourceMappingURL=module.cjs.map
@@ -1 +0,0 @@
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"}
@@ -1,16 +0,0 @@
1
- let __intlayer_core = require("@intlayer/core");
2
- let __app = require("#app");
3
- let __imports = require("#imports");
4
-
5
- //#region src/runtime/html-lang.ts
6
- var html_lang_default = (0, __app.defineNuxtPlugin)((nuxtApp) => {
7
- nuxtApp.hook("page:finish", () => {
8
- const locale = (0, __imports.useRoute)().params.locale;
9
- document.documentElement.lang = locale;
10
- document.documentElement.dir = (0, __intlayer_core.getHTMLTextDir)(locale);
11
- });
12
- });
13
-
14
- //#endregion
15
- module.exports = html_lang_default;
16
- //# sourceMappingURL=html-lang.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"html-lang.cjs","names":[],"sources":["../../../src/runtime/html-lang.ts"],"sourcesContent":["// @ts-nocheck -- Nuxt runtime types are provided at application level\n\nimport { getHTMLTextDir } from '@intlayer/core';\nimport type { Locale } from '@intlayer/types';\nimport { defineNuxtPlugin } from '#app';\nimport { useRoute } from '#imports';\n\nexport default defineNuxtPlugin((nuxtApp) => {\n nuxtApp.hook('page:finish', () => {\n const locale = useRoute().params.locale as Locale;\n document.documentElement.lang = locale;\n document.documentElement.dir = getHTMLTextDir(locale);\n });\n});\n"],"mappings":";;;;;AAOA,qDAAiC,YAAY;AAC3C,SAAQ,KAAK,qBAAqB;EAChC,MAAM,kCAAmB,CAAC,OAAO;AACjC,WAAS,gBAAgB,OAAO;AAChC,WAAS,gBAAgB,0CAAqB,OAAO;GACrD;EACF"}
@@ -1,33 +0,0 @@
1
- let __app = require("#app");
2
- let __imports = require("#imports");
3
- let vue_intlayer = require("vue-intlayer");
4
-
5
- //#region src/runtime/intlayer-plugin.ts
6
- /**
7
- * Nuxt client plugin injected by `nuxt-intlayer` module.
8
- * It installs the Intlayer Vue composables in the current Nuxt application and keeps
9
- * the active locale in sync with the current route (e.g. `/fr/about` → `fr`).
10
- */
11
- var intlayer_plugin_default = (0, __app.defineNuxtPlugin)((nuxtApp) => {
12
- /**
13
- * Register the Intlayer provider. We don't pass an explicit locale here so it
14
- * will fallback to the `defaultLocale` defined in the user configuration.
15
- * We will synchronise the active locale afterwards, once the current route
16
- * information is reliably available.
17
- */
18
- (0, vue_intlayer.installIntlayer)(nuxtApp.vueApp);
19
- const { setLocale } = (0, vue_intlayer.createIntlayerClient)();
20
- const route = (0, __imports.useRoute)();
21
- const syncLocale = () => {
22
- const localeParam = route.params.locale;
23
- if (localeParam) setLocale(localeParam);
24
- };
25
- syncLocale();
26
- nuxtApp.hook("page:start", () => {
27
- syncLocale();
28
- });
29
- });
30
-
31
- //#endregion
32
- module.exports = intlayer_plugin_default;
33
- //# sourceMappingURL=intlayer-plugin.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"intlayer-plugin.cjs","names":[],"sources":["../../../src/runtime/intlayer-plugin.ts"],"sourcesContent":["// @ts-nocheck -- Nuxt runtime types are provided at application level\n\nimport type { Locale } from '@intlayer/config';\nimport { createIntlayerClient, installIntlayer } from 'vue-intlayer';\nimport { defineNuxtPlugin } from '#app';\nimport { useRoute } from '#imports';\n\n/**\n * Nuxt client plugin injected by `nuxt-intlayer` module.\n * It installs the Intlayer Vue composables in the current Nuxt application and keeps\n * the active locale in sync with the current route (e.g. `/fr/about` → `fr`).\n */\nexport default defineNuxtPlugin((nuxtApp) => {\n /**\n * Register the Intlayer provider. We don't pass an explicit locale here so it\n * will fallback to the `defaultLocale` defined in the user configuration.\n * We will synchronise the active locale afterwards, once the current route\n * information is reliably available.\n */\n installIntlayer(nuxtApp.vueApp);\n\n // Obtain a reference to the singleton Intlayer client so we can update the\n // locale reactively whenever the route changes.\n const { setLocale } = createIntlayerClient();\n\n const route = useRoute();\n\n // Helper that applies the `:locale` route param (if any) to Intlayer.\n const syncLocale = () => {\n const localeParam = route.params.locale as Locale | undefined;\n if (localeParam) setLocale(localeParam);\n };\n\n // Initial sync (client & server) once the plugin is executed.\n syncLocale();\n\n // Keep Intlayer locale in sync on every navigation.\n nuxtApp.hook('page:start', () => {\n syncLocale();\n });\n});\n"],"mappings":";;;;;;;;;;AAYA,2DAAiC,YAAY;;;;;;;AAO3C,mCAAgB,QAAQ,OAAO;CAI/B,MAAM,EAAE,sDAAoC;CAE5C,MAAM,iCAAkB;CAGxB,MAAM,mBAAmB;EACvB,MAAM,cAAc,MAAM,OAAO;AACjC,MAAI,YAAa,WAAU,YAAY;;AAIzC,aAAY;AAGZ,SAAQ,KAAK,oBAAoB;AAC/B,cAAY;GACZ;EACF"}