nuxt-intlayer 7.0.7 → 7.0.8
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/cjs/module.cjs +0 -6
- package/dist/cjs/module.cjs.map +1 -1
- package/dist/cjs/runtime/html-lang.cjs +0 -4
- package/dist/cjs/runtime/html-lang.cjs.map +1 -1
- package/dist/cjs/runtime/intlayer-plugin.cjs +0 -4
- package/dist/cjs/runtime/intlayer-plugin.cjs.map +1 -1
- package/package.json +20 -20
package/dist/cjs/module.cjs
CHANGED
|
@@ -1,14 +1,8 @@
|
|
|
1
|
-
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
2
1
|
let node_path = require("node:path");
|
|
3
|
-
node_path = require_rolldown_runtime.__toESM(node_path);
|
|
4
2
|
let __intlayer_chokidar = require("@intlayer/chokidar");
|
|
5
|
-
__intlayer_chokidar = require_rolldown_runtime.__toESM(__intlayer_chokidar);
|
|
6
3
|
let __intlayer_config = require("@intlayer/config");
|
|
7
|
-
__intlayer_config = require_rolldown_runtime.__toESM(__intlayer_config);
|
|
8
4
|
let __nuxt_kit = require("@nuxt/kit");
|
|
9
|
-
__nuxt_kit = require_rolldown_runtime.__toESM(__nuxt_kit);
|
|
10
5
|
let vite_intlayer = require("vite-intlayer");
|
|
11
|
-
vite_intlayer = require_rolldown_runtime.__toESM(vite_intlayer);
|
|
12
6
|
|
|
13
7
|
//#region src/module.ts
|
|
14
8
|
const module$1 = (0, __nuxt_kit.defineNuxtModule)({
|
package/dist/cjs/module.cjs.map
CHANGED
|
@@ -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":"
|
|
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,10 +1,6 @@
|
|
|
1
|
-
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
1
|
let __intlayer_core = require("@intlayer/core");
|
|
3
|
-
__intlayer_core = require_rolldown_runtime.__toESM(__intlayer_core);
|
|
4
2
|
let __app = require("#app");
|
|
5
|
-
__app = require_rolldown_runtime.__toESM(__app);
|
|
6
3
|
let __imports = require("#imports");
|
|
7
|
-
__imports = require_rolldown_runtime.__toESM(__imports);
|
|
8
4
|
|
|
9
5
|
//#region src/runtime/html-lang.ts
|
|
10
6
|
var html_lang_default = (0, __app.defineNuxtPlugin)((nuxtApp) => {
|
|
@@ -1 +1 @@
|
|
|
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":"
|
|
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,10 +1,6 @@
|
|
|
1
|
-
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
1
|
let __app = require("#app");
|
|
3
|
-
__app = require_rolldown_runtime.__toESM(__app);
|
|
4
2
|
let __imports = require("#imports");
|
|
5
|
-
__imports = require_rolldown_runtime.__toESM(__imports);
|
|
6
3
|
let vue_intlayer = require("vue-intlayer");
|
|
7
|
-
vue_intlayer = require_rolldown_runtime.__toESM(vue_intlayer);
|
|
8
4
|
|
|
9
5
|
//#region src/runtime/intlayer-plugin.ts
|
|
10
6
|
/**
|
|
@@ -1 +1 @@
|
|
|
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":"
|
|
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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-intlayer",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.8",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Easily internationalize i18n your Nuxt applications with type-safe multilingual content management.",
|
|
6
6
|
"keywords": [
|
|
@@ -73,33 +73,33 @@
|
|
|
73
73
|
"typecheck": "tsc --noEmit --project tsconfig.types.json"
|
|
74
74
|
},
|
|
75
75
|
"dependencies": {
|
|
76
|
-
"@intlayer/chokidar": "7.0.
|
|
77
|
-
"@intlayer/config": "7.0.
|
|
78
|
-
"@intlayer/core": "7.0.
|
|
79
|
-
"@intlayer/types": "7.0.
|
|
80
|
-
"vite-intlayer": "7.0.
|
|
81
|
-
"vue-intlayer": "7.0.
|
|
76
|
+
"@intlayer/chokidar": "7.0.8",
|
|
77
|
+
"@intlayer/config": "7.0.8",
|
|
78
|
+
"@intlayer/core": "7.0.8",
|
|
79
|
+
"@intlayer/types": "7.0.8",
|
|
80
|
+
"vite-intlayer": "7.0.8",
|
|
81
|
+
"vue-intlayer": "7.0.8"
|
|
82
82
|
},
|
|
83
83
|
"devDependencies": {
|
|
84
|
-
"@types/node": "24.
|
|
85
|
-
"@utils/ts-config": "7.0.
|
|
86
|
-
"@utils/ts-config-types": "7.0.
|
|
87
|
-
"@utils/tsdown-config": "7.0.
|
|
84
|
+
"@types/node": "24.10.0",
|
|
85
|
+
"@utils/ts-config": "7.0.8",
|
|
86
|
+
"@utils/ts-config-types": "7.0.8",
|
|
87
|
+
"@utils/tsdown-config": "7.0.8",
|
|
88
88
|
"fast-glob": "3.3.3",
|
|
89
|
-
"rimraf": "6.0
|
|
90
|
-
"tsdown": "0.
|
|
89
|
+
"rimraf": "6.1.0",
|
|
90
|
+
"tsdown": "0.16.0",
|
|
91
91
|
"typescript": "5.9.3",
|
|
92
|
-
"vitest": "4.0.
|
|
92
|
+
"vitest": "4.0.7"
|
|
93
93
|
},
|
|
94
94
|
"peerDependencies": {
|
|
95
|
-
"@intlayer/chokidar": "7.0.
|
|
96
|
-
"@intlayer/config": "7.0.
|
|
97
|
-
"@intlayer/core": "7.0.
|
|
98
|
-
"@intlayer/types": "7.0.
|
|
95
|
+
"@intlayer/chokidar": "7.0.8",
|
|
96
|
+
"@intlayer/config": "7.0.8",
|
|
97
|
+
"@intlayer/core": "7.0.8",
|
|
98
|
+
"@intlayer/types": "7.0.8",
|
|
99
99
|
"@nuxt/kit": ">=3.0.0",
|
|
100
100
|
"@nuxt/schema": ">=3.0.0",
|
|
101
|
-
"vite-intlayer": "7.0.
|
|
102
|
-
"vue-intlayer": "7.0.
|
|
101
|
+
"vite-intlayer": "7.0.8",
|
|
102
|
+
"vue-intlayer": "7.0.8"
|
|
103
103
|
},
|
|
104
104
|
"engines": {
|
|
105
105
|
"node": ">=14.18"
|