nuxt-intlayer 5.5.10

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/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright
52
+ owner or by an individual or Legal Entity authorized to submit on
53
+ behalf of the copyright owner. For the purposes of this definition,
54
+ "submitted" means any form of electronic, verbal, or written
55
+ communication sent to the Licensor or its representatives, including
56
+ but not limited to communication on electronic mailing lists, source
57
+ code control systems, and issue tracking systems that are managed by,
58
+ or on behalf of, the Licensor for the purpose of discussing and improving
59
+ the Work, but excluding communication that is conspicuously marked or
60
+ otherwise designated in writing by the copyright owner as "Not a
61
+ Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2024 Aymeric PINEAU
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,128 @@
1
+ <div align="center">
2
+ <a href="https://intlayer.org">
3
+ <img src="https://raw.githubusercontent.com/aymericzip/intlayer/572ae9c9acafb74307b81530c1931a8e98990aef/docs/assets/logo.png" width="500" alt="intlayer" />
4
+ </a>
5
+ </div>
6
+
7
+ <div align="center">
8
+ <a href="https://www.npmjs.com/package/nuxt-intlayer" target="blank"><img
9
+ align="center"
10
+ alt="npm"
11
+ src="https://img.shields.io/npm/v/nuxt-intlayer.svg?labelColor=49516F&color=8994BC&style=for-the-badge"
12
+ height="30" /></a>
13
+ <a href="https://npmjs.org/package/nuxt-intlayer" target="blank"><img
14
+ align="center"
15
+ src="https://img.shields.io/npm/dm/nuxt-intlayer?labelColor=49516F&color=8994BC&style=for-the-badge"
16
+ alt="monthly downloads"
17
+ height="30"
18
+ /></a>
19
+ <a href="https://npmjs.org/package/nuxt-intlayer" target="blank"><img
20
+ align="center"
21
+ src="https://img.shields.io/npm/types/nuxt-intlayer?label=types%20included&labelColor=49516F&color=8994BC&style=for-the-badge"
22
+ alt="types included"
23
+ height="30"
24
+ /></a>
25
+ </div>
26
+
27
+ <div>
28
+ <br/>
29
+ <p align="center">
30
+ <a href="https://www.linkedin.com/company/intlayerorg" target="blank"><img align="center"
31
+ src="https://img.shields.io/badge/linkedin-%231DA1F2.svg?style=for-the-badge&logo=linkedin&logoColor=white"
32
+ alt="Intlayer LinkedIn" height="30"/></a>
33
+ <a href="https://www.facebook.com/intlayer" target="blank"><img align="center"
34
+ src="https://img.shields.io/badge/facebook-4267B2.svg?style=for-the-badge&logo=facebook&logoColor=white"
35
+ alt="Intlayer Facebook" height="30"/></a>
36
+ <a href="https://www.instagram.com/intlayer_org/" target="blank"><img align="center"
37
+ src="https://img.shields.io/badge/instagram-%23E4405F.svg?style=for-the-badge&logo=Instagram&logoColor=white"
38
+ alt="Intlayer Instagram" height="30"/></a>
39
+ <a href="https://x.com/Intlayer183096" target="blank"><img align="center"
40
+ src="https://img.shields.io/badge/x-1DA1F2.svg?style=for-the-badge&logo=x&logoColor=white"
41
+ alt="Intlayer X" height="30"/></a>
42
+ <a href="https://www.youtube.com/@intlayer" target="blank"><img align="center"
43
+ src="https://img.shields.io/badge/youtube-FF0000.svg?style=for-the-badge&logo=youtube&logoColor=white"
44
+ alt="Intlayer YouTube" height="30"/></a>
45
+ <a href="https://www.tiktok.com/@intlayer" target="blank"><img align="center"
46
+ src="https://img.shields.io/badge/tiktok-000000.svg?style=for-the-badge&logo=tiktok&logoColor=white"
47
+ alt="Intlayer TikTok" height="30"/></a>
48
+ <br>
49
+ </p>
50
+ </div>
51
+
52
+ > This package is in development.
53
+
54
+ # nuxt-intlayer: Internationalize (i18n) an Nuxt application
55
+
56
+ **Intlayer** is a suite of packages designed specifically for JavaScript developers. It is compatible with frameworks like Vue, Svelte, and Express.js.
57
+
58
+ **The `nuxt-intlayer` package** allows you to internationalize your Nuxt application. It provides context providers and hooks for Nuxt internationalization.
59
+
60
+ ## Why Internationalize Your Nuxt Application?
61
+
62
+ Internationalizing your Vue application is essential for serving a global audience effectively. It allows your application to deliver content and messages in the preferred language of each user. This capability enhances user experience and broadens your application's reach by making it more accessible and relevant to people from different linguistic backgrounds.
63
+
64
+ ## Why to integrate Intlayer?
65
+
66
+ - **JavaScript-Powered Content Management**: Harness the flexibility of JavaScript to define and manage your content efficiently.
67
+ - **Type-Safe Environment**: Leverage TypeScript to ensure all your content definitions are precise and error-free.
68
+ - **Integrated Content Files**: Keep your translations close to their respective components, enhancing maintainability and clarity.
69
+
70
+ ## Installation
71
+
72
+ Install the necessary package using your preferred package manager:
73
+
74
+ ```bash packageManager="npm"
75
+ npm install nuxt-intlayer
76
+ ```
77
+
78
+ ```bash packageManager="yarn"
79
+ yarn add nuxt-intlayer
80
+ ```
81
+
82
+ ```bash packageManager="pnpm"
83
+ pnpm add nuxt-intlayer
84
+ ```
85
+
86
+ ## What does `nuxt-intlayer` do as a Nuxt module?
87
+
88
+ `nuxt-intlayer` is a Nuxt module that seamlessly integrates internationalization (i18n) into your Nuxt application. As a module, it:
89
+
90
+ - Automatically sets up i18n support for your app with minimal configuration.
91
+ - Provides composables and helpers for translation, locale switching, and dictionary management.
92
+ - Loads and manages translation dictionaries efficiently.
93
+ - Integrates with Nuxt SSR and routing for locale-aware navigation and static generation.
94
+ - Keeps your translations type-safe and close to your components.
95
+
96
+ ### Quickstart: Add to your Nuxt config
97
+
98
+ Add `nuxt-intlayer` to your `modules` in `nuxt.config.ts`:
99
+
100
+ ```ts
101
+ export default defineNuxtConfig({
102
+ modules: ["nuxt-intlayer"],
103
+ });
104
+ ```
105
+
106
+ Once added, you can use composables like `useIntlayer()` or helpers provided by the module in your components and pages to translate content and manage locales.
107
+
108
+ ## Example of usage
109
+
110
+ to fill
111
+
112
+ ## Mastering the internationalization of your Vue application
113
+
114
+ Intlayer provides a lot of features to help you internationalize your Vue application.
115
+
116
+ **To learn more about these features, refer to the [Vue Internationalization (i18n) with Intlayer and Vite and Vue](https://github.com/aymericzip/intlayer/blob/main/docs/en/intlayer_with_vite+react.md) guide for Vite and Vue Application, or the [Vue Internationalization (i18n) with Intlayer and Vue (CRA)](https://intlayer.org/doc/environment/create-react-app) guide for Vue Create App.**
117
+
118
+ ## Functions provided by `nuxt-intlayer` package
119
+
120
+ The `nuxt-intlayer` package also provides some functions to help you to internationalize your application.
121
+
122
+ ## Read about Intlayer
123
+
124
+ - [Intlayer Website](https://intlayer.org)
125
+ - [Intlayer Documentation](https://intlayer.org/doc)
126
+ - [Intlayer GitHub](https://github.com/aymericzip/intlayer)
127
+
128
+ - [Ask your questions to our smart documentation](https://intlayer.org/docchat)
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var index_exports = {};
20
+ __export(index_exports, {
21
+ default: () => index_default
22
+ });
23
+ module.exports = __toCommonJS(index_exports);
24
+ var import_module = require('./module.cjs');
25
+ var index_default = import_module.module;
26
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["import { module } from './module';\n\nexport default module;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAuB;AAEvB,IAAO,gBAAQ;","names":[]}
@@ -0,0 +1,106 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var module_exports = {};
20
+ __export(module_exports, {
21
+ module: () => module2
22
+ });
23
+ module.exports = __toCommonJS(module_exports);
24
+ var import_chokidar = require("@intlayer/chokidar");
25
+ var import_config = require("@intlayer/config");
26
+ var import_kit = require("@nuxt/kit");
27
+ var import_path = require("path");
28
+ var import_vite_intlayer = require("vite-intlayer");
29
+ const import_meta = {};
30
+ const module2 = (0, import_kit.defineNuxtModule)({
31
+ meta: {
32
+ name: "nuxt-intlayer"
33
+ },
34
+ setup({}, nuxt) {
35
+ const configuration = (0, import_config.getConfiguration)();
36
+ const { mainDir, baseDir, configDir } = configuration.content;
37
+ const { optimize } = configuration.build;
38
+ const resolver = (0, import_kit.createResolver)(import_meta.url);
39
+ (0, import_kit.addPlugin)({
40
+ src: resolver.resolve("./runtime/intlayer-plugin"),
41
+ mode: "all"
42
+ });
43
+ (0, import_kit.addPlugin)({
44
+ src: resolver.resolve("./runtime/html-lang"),
45
+ mode: "all"
46
+ });
47
+ nuxt.hook("vite:extendConfig", (viteConfig, { isServer }) => {
48
+ if (isServer) {
49
+ (viteConfig.plugins ?? []).push((0, import_vite_intlayer.intLayerMiddlewarePlugin)());
50
+ }
51
+ if (optimize) {
52
+ viteConfig.plugins?.push((0, import_vite_intlayer.IntlayerPrunePlugin)());
53
+ }
54
+ });
55
+ nuxt.hook("build:before", async () => (0, import_chokidar.prepareIntlayer)(configuration));
56
+ nuxt.hook("ready", async () => {
57
+ if (configuration.content.watch) {
58
+ (0, import_chokidar.watch)({ configuration });
59
+ }
60
+ });
61
+ const dictionariesPath = (0, import_path.join)(mainDir, "dictionaries.mjs");
62
+ const relativeDictionariesPath = (0, import_path.relative)(baseDir, dictionariesPath);
63
+ const unmergedDictionariesPath = (0, import_path.join)(mainDir, "unmerged_dictionaries.mjs");
64
+ const relativeUnmergedDictionariesPath = (0, import_path.relative)(
65
+ baseDir,
66
+ unmergedDictionariesPath
67
+ );
68
+ const configurationPath = (0, import_path.join)(configDir, "configuration.json");
69
+ const relativeConfigurationPath = (0, import_path.relative)(baseDir, configurationPath);
70
+ nuxt.options.alias = {
71
+ ...nuxt.options.alias,
72
+ "@intlayer/dictionaries-entry": (0, import_path.resolve)(relativeDictionariesPath),
73
+ "@intlayer/unmerged-dictionaries-entry": (0, import_path.resolve)(
74
+ relativeUnmergedDictionariesPath
75
+ ),
76
+ "@intlayer/config/built": (0, import_path.resolve)(relativeConfigurationPath)
77
+ };
78
+ nuxt.hook("pages:extend", (pages) => {
79
+ const {
80
+ internationalization: { locales, defaultLocale },
81
+ middleware: { prefixDefault, noPrefix }
82
+ } = configuration;
83
+ if (noPrefix) return;
84
+ const filteredLocales = prefixDefault ? locales : locales.filter((locale) => locale !== defaultLocale);
85
+ const localeGroupRegex = filteredLocales.map(String).join("|");
86
+ if (!localeGroupRegex) return;
87
+ const originalPages = [...pages];
88
+ for (const page of originalPages) {
89
+ if (page.path.startsWith("/:locale")) continue;
90
+ const dynPathPrefix = `/:locale(${localeGroupRegex})`;
91
+ const isIndex = page.path === "/";
92
+ const prefixedPath = isIndex ? `${dynPathPrefix}` : `${dynPathPrefix}${page.path}`;
93
+ pages.push({
94
+ ...page,
95
+ path: prefixedPath,
96
+ name: page.name ? `${page.name}___i18n` : void 0
97
+ });
98
+ }
99
+ });
100
+ }
101
+ });
102
+ // Annotate the CommonJS export names for ESM import in node:
103
+ 0 && (module.exports = {
104
+ module
105
+ });
106
+ //# sourceMappingURL=module.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/module.ts"],"sourcesContent":["import { prepareIntlayer, watch } from '@intlayer/chokidar';\nimport { getConfiguration } from '@intlayer/config';\nimport { addPlugin, createResolver, defineNuxtModule } from '@nuxt/kit';\nimport type { NuxtModule } from '@nuxt/schema';\nimport { join, relative, resolve } from 'path';\nimport { intLayerMiddlewarePlugin, IntlayerPrunePlugin } 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({}, nuxt) {\n const configuration = getConfiguration();\n\n const { mainDir, baseDir, configDir } = configuration.content;\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(intLayerMiddlewarePlugin());\n }\n if (optimize) {\n // viteConfig.plugins can be undefined at this stage\n viteConfig.plugins?.push(IntlayerPrunePlugin());\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 const dictionariesPath = join(mainDir, 'dictionaries.mjs');\n const relativeDictionariesPath = relative(baseDir, dictionariesPath);\n\n const unmergedDictionariesPath = join(mainDir, 'unmerged_dictionaries.mjs');\n const relativeUnmergedDictionariesPath = relative(\n baseDir,\n unmergedDictionariesPath\n );\n\n const configurationPath = join(configDir, 'configuration.json');\n const relativeConfigurationPath = relative(baseDir, configurationPath);\n\n nuxt.options.alias = {\n ...nuxt.options.alias,\n '@intlayer/dictionaries-entry': resolve(relativeDictionariesPath),\n '@intlayer/unmerged-dictionaries-entry': resolve(\n relativeUnmergedDictionariesPath\n ),\n '@intlayer/config/built': resolve(relativeConfigurationPath),\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 middleware: { prefixDefault, noPrefix },\n } = configuration;\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":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,gBAAAA;AAAA;AAAA;AAAA,sBAAuC;AACvC,oBAAiC;AACjC,iBAA4D;AAE5D,kBAAwC;AACxC,2BAA8D;AAL9D;AAQO,MAAMA,cAAqB,6BAAiB;AAAA,EACjD,MAAM;AAAA,IACJ,MAAM;AAAA,EACR;AAAA,EACA,MAAM,CAAC,GAAG,MAAM;AACd,UAAM,oBAAgB,gCAAiB;AAEvC,UAAM,EAAE,SAAS,SAAS,UAAU,IAAI,cAAc;AACtD,UAAM,EAAE,SAAS,IAAI,cAAc;AASnC,UAAM,eAAW,2BAAe,YAAY,GAAG;AAE/C,8BAAU;AAAA,MACR,KAAK,SAAS,QAAQ,2BAA2B;AAAA,MACjD,MAAM;AAAA,IACR,CAAC;AAED,8BAAU;AAAA,MACR,KAAK,SAAS,QAAQ,qBAAqB;AAAA,MAC3C,MAAM;AAAA,IACR,CAAC;AAGD,SAAK,KAAK,qBAAqB,CAAC,YAAY,EAAE,SAAS,MAAM;AAC3D,UAAI,UAAU;AAGZ,SAAC,WAAW,WAAW,CAAC,GAAG,SAAK,+CAAyB,CAAC;AAAA,MAC5D;AACA,UAAI,UAAU;AAEZ,mBAAW,SAAS,SAAK,0CAAoB,CAAC;AAAA,MAChD;AAAA,IACF,CAAC;AAGD,SAAK,KAAK,gBAAgB,gBAAY,iCAAgB,aAAa,CAAC;AAGpE,SAAK,KAAK,SAAS,YAAY;AAC7B,UAAI,cAAc,QAAQ,OAAO;AAE/B,mCAAM,EAAE,cAAc,CAAC;AAAA,MACzB;AAAA,IACF,CAAC;AAED,UAAM,uBAAmB,kBAAK,SAAS,kBAAkB;AACzD,UAAM,+BAA2B,sBAAS,SAAS,gBAAgB;AAEnE,UAAM,+BAA2B,kBAAK,SAAS,2BAA2B;AAC1E,UAAM,uCAAmC;AAAA,MACvC;AAAA,MACA;AAAA,IACF;AAEA,UAAM,wBAAoB,kBAAK,WAAW,oBAAoB;AAC9D,UAAM,gCAA4B,sBAAS,SAAS,iBAAiB;AAErE,SAAK,QAAQ,QAAQ;AAAA,MACnB,GAAG,KAAK,QAAQ;AAAA,MAChB,oCAAgC,qBAAQ,wBAAwB;AAAA,MAChE,6CAAyC;AAAA,QACvC;AAAA,MACF;AAAA,MACA,8BAA0B,qBAAQ,yBAAyB;AAAA,IAC7D;AAGA,SAAK,KAAK,gBAAgB,CAAC,UAAU;AACnC,YAAM;AAAA,QACJ,sBAAsB,EAAE,SAAS,cAAc;AAAA,QAC/C,YAAY,EAAE,eAAe,SAAS;AAAA,MACxC,IAAI;AAGJ,UAAI,SAAU;AAGd,YAAM,kBAAkB,gBACpB,UACA,QAAQ,OAAO,CAAC,WAAW,WAAW,aAAa;AACvD,YAAM,mBAAmB,gBAAgB,IAAI,MAAM,EAAE,KAAK,GAAG;AAG7D,UAAI,CAAC,iBAAkB;AAGvB,YAAM,gBAAgB,CAAC,GAAG,KAAK;AAE/B,iBAAW,QAAQ,eAAe;AAEhC,YAAI,KAAK,KAAK,WAAW,UAAU,EAAG;AAItC,cAAM,gBAAgB,YAAY,gBAAgB;AAClD,cAAM,UAAU,KAAK,SAAS;AAC9B,cAAM,eAAe,UACjB,GAAG,aAAa,KAChB,GAAG,aAAa,GAAG,KAAK,IAAI;AAQhC,cAAM,KAAK;AAAA,UACT,GAAG;AAAA,UACH,MAAM;AAAA,UACN,MAAM,KAAK,OAAO,GAAG,KAAK,IAAI,YAAY;AAAA,QAC5C,CAAC;AAAA,MACH;AAAA,IACF,CAAC;AAAA,EACH;AACF,CAAC;","names":["module"]}
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var html_lang_exports = {};
20
+ __export(html_lang_exports, {
21
+ default: () => html_lang_default
22
+ });
23
+ module.exports = __toCommonJS(html_lang_exports);
24
+ var import_app = require("#app");
25
+ var import_imports = require("#imports");
26
+ var import_intlayer = require("intlayer");
27
+ var html_lang_default = (0, import_app.defineNuxtPlugin)((nuxtApp) => {
28
+ nuxtApp.hook("page:finish", () => {
29
+ const locale = (0, import_imports.useRoute)().params.locale;
30
+ document.documentElement.lang = locale;
31
+ document.documentElement.dir = (0, import_intlayer.getHTMLTextDir)(locale);
32
+ });
33
+ });
34
+ //# sourceMappingURL=html-lang.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/runtime/html-lang.ts"],"sourcesContent":["// @ts-nocheck -- Nuxt runtime types are provided at application level\nimport { defineNuxtPlugin } from '#app';\nimport { useRoute } from '#imports';\nimport { getHTMLTextDir, type Locales } from 'intlayer';\n\nexport default defineNuxtPlugin((nuxtApp) => {\n nuxtApp.hook('page:finish', () => {\n const locale = useRoute().params.locale as Locales;\n document.documentElement.lang = locale;\n document.documentElement.dir = getHTMLTextDir(locale);\n });\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,iBAAiC;AACjC,qBAAyB;AACzB,sBAA6C;AAE7C,IAAO,wBAAQ,6BAAiB,CAAC,YAAY;AAC3C,UAAQ,KAAK,eAAe,MAAM;AAChC,UAAM,aAAS,yBAAS,EAAE,OAAO;AACjC,aAAS,gBAAgB,OAAO;AAChC,aAAS,gBAAgB,UAAM,gCAAe,MAAM;AAAA,EACtD,CAAC;AACH,CAAC;","names":[]}
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var intlayer_plugin_exports = {};
20
+ __export(intlayer_plugin_exports, {
21
+ default: () => intlayer_plugin_default
22
+ });
23
+ module.exports = __toCommonJS(intlayer_plugin_exports);
24
+ var import_app = require("#app");
25
+ var import_imports = require("#imports");
26
+ var import_vue_intlayer = require("vue-intlayer");
27
+ var intlayer_plugin_default = (0, import_app.defineNuxtPlugin)((nuxtApp) => {
28
+ (0, import_vue_intlayer.installIntlayer)(nuxtApp.vueApp);
29
+ const { setLocale } = (0, import_vue_intlayer.createIntlayerClient)();
30
+ const route = (0, import_imports.useRoute)();
31
+ const syncLocale = () => {
32
+ const localeParam = route.params.locale;
33
+ if (localeParam) setLocale(localeParam);
34
+ };
35
+ syncLocale();
36
+ nuxtApp.hook("page:start", () => {
37
+ syncLocale();
38
+ });
39
+ });
40
+ //# sourceMappingURL=intlayer-plugin.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/runtime/intlayer-plugin.ts"],"sourcesContent":["// @ts-nocheck -- Nuxt runtime types are provided at application level\nimport { defineNuxtPlugin } from '#app';\nimport { useRoute } from '#imports';\nimport { Locales } from '@intlayer/config';\nimport { createIntlayerClient, installIntlayer } from 'vue-intlayer';\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 Locales | 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":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,iBAAiC;AACjC,qBAAyB;AAEzB,0BAAsD;AAOtD,IAAO,8BAAQ,6BAAiB,CAAC,YAAY;AAO3C,2CAAgB,QAAQ,MAAM;AAI9B,QAAM,EAAE,UAAU,QAAI,0CAAqB;AAE3C,QAAM,YAAQ,yBAAS;AAGvB,QAAM,aAAa,MAAM;AACvB,UAAM,cAAc,MAAM,OAAO;AACjC,QAAI,YAAa,WAAU,WAAW;AAAA,EACxC;AAGA,aAAW;AAGX,UAAQ,KAAK,cAAc,MAAM;AAC/B,eAAW;AAAA,EACb,CAAC;AACH,CAAC;","names":[]}
@@ -0,0 +1,6 @@
1
+ import { module } from "./module.mjs";
2
+ var index_default = module;
3
+ export {
4
+ index_default as default
5
+ };
6
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["import { module } from './module';\n\nexport default module;\n"],"mappings":"AAAA,SAAS,cAAc;AAEvB,IAAO,gBAAQ;","names":[]}
@@ -0,0 +1,81 @@
1
+ import { prepareIntlayer, watch } from "@intlayer/chokidar";
2
+ import { getConfiguration } from "@intlayer/config";
3
+ import { addPlugin, createResolver, defineNuxtModule } from "@nuxt/kit";
4
+ import { join, relative, resolve } from "path";
5
+ import { intLayerMiddlewarePlugin, IntlayerPrunePlugin } from "vite-intlayer";
6
+ const module = defineNuxtModule({
7
+ meta: {
8
+ name: "nuxt-intlayer"
9
+ },
10
+ setup({}, nuxt) {
11
+ const configuration = getConfiguration();
12
+ const { mainDir, baseDir, configDir } = configuration.content;
13
+ const { optimize } = configuration.build;
14
+ const resolver = createResolver(import.meta.url);
15
+ addPlugin({
16
+ src: resolver.resolve("./runtime/intlayer-plugin"),
17
+ mode: "all"
18
+ });
19
+ addPlugin({
20
+ src: resolver.resolve("./runtime/html-lang"),
21
+ mode: "all"
22
+ });
23
+ nuxt.hook("vite:extendConfig", (viteConfig, { isServer }) => {
24
+ if (isServer) {
25
+ (viteConfig.plugins ?? []).push(intLayerMiddlewarePlugin());
26
+ }
27
+ if (optimize) {
28
+ viteConfig.plugins?.push(IntlayerPrunePlugin());
29
+ }
30
+ });
31
+ nuxt.hook("build:before", async () => prepareIntlayer(configuration));
32
+ nuxt.hook("ready", async () => {
33
+ if (configuration.content.watch) {
34
+ watch({ configuration });
35
+ }
36
+ });
37
+ const dictionariesPath = join(mainDir, "dictionaries.mjs");
38
+ const relativeDictionariesPath = relative(baseDir, dictionariesPath);
39
+ const unmergedDictionariesPath = join(mainDir, "unmerged_dictionaries.mjs");
40
+ const relativeUnmergedDictionariesPath = relative(
41
+ baseDir,
42
+ unmergedDictionariesPath
43
+ );
44
+ const configurationPath = join(configDir, "configuration.json");
45
+ const relativeConfigurationPath = relative(baseDir, configurationPath);
46
+ nuxt.options.alias = {
47
+ ...nuxt.options.alias,
48
+ "@intlayer/dictionaries-entry": resolve(relativeDictionariesPath),
49
+ "@intlayer/unmerged-dictionaries-entry": resolve(
50
+ relativeUnmergedDictionariesPath
51
+ ),
52
+ "@intlayer/config/built": resolve(relativeConfigurationPath)
53
+ };
54
+ nuxt.hook("pages:extend", (pages) => {
55
+ const {
56
+ internationalization: { locales, defaultLocale },
57
+ middleware: { prefixDefault, noPrefix }
58
+ } = configuration;
59
+ if (noPrefix) return;
60
+ const filteredLocales = prefixDefault ? locales : locales.filter((locale) => locale !== defaultLocale);
61
+ const localeGroupRegex = filteredLocales.map(String).join("|");
62
+ if (!localeGroupRegex) return;
63
+ const originalPages = [...pages];
64
+ for (const page of originalPages) {
65
+ if (page.path.startsWith("/:locale")) continue;
66
+ const dynPathPrefix = `/:locale(${localeGroupRegex})`;
67
+ const isIndex = page.path === "/";
68
+ const prefixedPath = isIndex ? `${dynPathPrefix}` : `${dynPathPrefix}${page.path}`;
69
+ pages.push({
70
+ ...page,
71
+ path: prefixedPath,
72
+ name: page.name ? `${page.name}___i18n` : void 0
73
+ });
74
+ }
75
+ });
76
+ }
77
+ });
78
+ export {
79
+ module
80
+ };
81
+ //# sourceMappingURL=module.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/module.ts"],"sourcesContent":["import { prepareIntlayer, watch } from '@intlayer/chokidar';\nimport { getConfiguration } from '@intlayer/config';\nimport { addPlugin, createResolver, defineNuxtModule } from '@nuxt/kit';\nimport type { NuxtModule } from '@nuxt/schema';\nimport { join, relative, resolve } from 'path';\nimport { intLayerMiddlewarePlugin, IntlayerPrunePlugin } 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({}, nuxt) {\n const configuration = getConfiguration();\n\n const { mainDir, baseDir, configDir } = configuration.content;\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(intLayerMiddlewarePlugin());\n }\n if (optimize) {\n // viteConfig.plugins can be undefined at this stage\n viteConfig.plugins?.push(IntlayerPrunePlugin());\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 const dictionariesPath = join(mainDir, 'dictionaries.mjs');\n const relativeDictionariesPath = relative(baseDir, dictionariesPath);\n\n const unmergedDictionariesPath = join(mainDir, 'unmerged_dictionaries.mjs');\n const relativeUnmergedDictionariesPath = relative(\n baseDir,\n unmergedDictionariesPath\n );\n\n const configurationPath = join(configDir, 'configuration.json');\n const relativeConfigurationPath = relative(baseDir, configurationPath);\n\n nuxt.options.alias = {\n ...nuxt.options.alias,\n '@intlayer/dictionaries-entry': resolve(relativeDictionariesPath),\n '@intlayer/unmerged-dictionaries-entry': resolve(\n relativeUnmergedDictionariesPath\n ),\n '@intlayer/config/built': resolve(relativeConfigurationPath),\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 middleware: { prefixDefault, noPrefix },\n } = configuration;\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":"AAAA,SAAS,iBAAiB,aAAa;AACvC,SAAS,wBAAwB;AACjC,SAAS,WAAW,gBAAgB,wBAAwB;AAE5D,SAAS,MAAM,UAAU,eAAe;AACxC,SAAS,0BAA0B,2BAA2B;AAGvD,MAAM,SAAqB,iBAAiB;AAAA,EACjD,MAAM;AAAA,IACJ,MAAM;AAAA,EACR;AAAA,EACA,MAAM,CAAC,GAAG,MAAM;AACd,UAAM,gBAAgB,iBAAiB;AAEvC,UAAM,EAAE,SAAS,SAAS,UAAU,IAAI,cAAc;AACtD,UAAM,EAAE,SAAS,IAAI,cAAc;AASnC,UAAM,WAAW,eAAe,YAAY,GAAG;AAE/C,cAAU;AAAA,MACR,KAAK,SAAS,QAAQ,2BAA2B;AAAA,MACjD,MAAM;AAAA,IACR,CAAC;AAED,cAAU;AAAA,MACR,KAAK,SAAS,QAAQ,qBAAqB;AAAA,MAC3C,MAAM;AAAA,IACR,CAAC;AAGD,SAAK,KAAK,qBAAqB,CAAC,YAAY,EAAE,SAAS,MAAM;AAC3D,UAAI,UAAU;AAGZ,SAAC,WAAW,WAAW,CAAC,GAAG,KAAK,yBAAyB,CAAC;AAAA,MAC5D;AACA,UAAI,UAAU;AAEZ,mBAAW,SAAS,KAAK,oBAAoB,CAAC;AAAA,MAChD;AAAA,IACF,CAAC;AAGD,SAAK,KAAK,gBAAgB,YAAY,gBAAgB,aAAa,CAAC;AAGpE,SAAK,KAAK,SAAS,YAAY;AAC7B,UAAI,cAAc,QAAQ,OAAO;AAE/B,cAAM,EAAE,cAAc,CAAC;AAAA,MACzB;AAAA,IACF,CAAC;AAED,UAAM,mBAAmB,KAAK,SAAS,kBAAkB;AACzD,UAAM,2BAA2B,SAAS,SAAS,gBAAgB;AAEnE,UAAM,2BAA2B,KAAK,SAAS,2BAA2B;AAC1E,UAAM,mCAAmC;AAAA,MACvC;AAAA,MACA;AAAA,IACF;AAEA,UAAM,oBAAoB,KAAK,WAAW,oBAAoB;AAC9D,UAAM,4BAA4B,SAAS,SAAS,iBAAiB;AAErE,SAAK,QAAQ,QAAQ;AAAA,MACnB,GAAG,KAAK,QAAQ;AAAA,MAChB,gCAAgC,QAAQ,wBAAwB;AAAA,MAChE,yCAAyC;AAAA,QACvC;AAAA,MACF;AAAA,MACA,0BAA0B,QAAQ,yBAAyB;AAAA,IAC7D;AAGA,SAAK,KAAK,gBAAgB,CAAC,UAAU;AACnC,YAAM;AAAA,QACJ,sBAAsB,EAAE,SAAS,cAAc;AAAA,QAC/C,YAAY,EAAE,eAAe,SAAS;AAAA,MACxC,IAAI;AAGJ,UAAI,SAAU;AAGd,YAAM,kBAAkB,gBACpB,UACA,QAAQ,OAAO,CAAC,WAAW,WAAW,aAAa;AACvD,YAAM,mBAAmB,gBAAgB,IAAI,MAAM,EAAE,KAAK,GAAG;AAG7D,UAAI,CAAC,iBAAkB;AAGvB,YAAM,gBAAgB,CAAC,GAAG,KAAK;AAE/B,iBAAW,QAAQ,eAAe;AAEhC,YAAI,KAAK,KAAK,WAAW,UAAU,EAAG;AAItC,cAAM,gBAAgB,YAAY,gBAAgB;AAClD,cAAM,UAAU,KAAK,SAAS;AAC9B,cAAM,eAAe,UACjB,GAAG,aAAa,KAChB,GAAG,aAAa,GAAG,KAAK,IAAI;AAQhC,cAAM,KAAK;AAAA,UACT,GAAG;AAAA,UACH,MAAM;AAAA,UACN,MAAM,KAAK,OAAO,GAAG,KAAK,IAAI,YAAY;AAAA,QAC5C,CAAC;AAAA,MACH;AAAA,IACF,CAAC;AAAA,EACH;AACF,CAAC;","names":[]}
@@ -0,0 +1,14 @@
1
+ import { defineNuxtPlugin } from "#app";
2
+ import { useRoute } from "#imports";
3
+ import { getHTMLTextDir } from "intlayer";
4
+ var html_lang_default = defineNuxtPlugin((nuxtApp) => {
5
+ nuxtApp.hook("page:finish", () => {
6
+ const locale = useRoute().params.locale;
7
+ document.documentElement.lang = locale;
8
+ document.documentElement.dir = getHTMLTextDir(locale);
9
+ });
10
+ });
11
+ export {
12
+ html_lang_default as default
13
+ };
14
+ //# sourceMappingURL=html-lang.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/runtime/html-lang.ts"],"sourcesContent":["// @ts-nocheck -- Nuxt runtime types are provided at application level\nimport { defineNuxtPlugin } from '#app';\nimport { useRoute } from '#imports';\nimport { getHTMLTextDir, type Locales } from 'intlayer';\n\nexport default defineNuxtPlugin((nuxtApp) => {\n nuxtApp.hook('page:finish', () => {\n const locale = useRoute().params.locale as Locales;\n document.documentElement.lang = locale;\n document.documentElement.dir = getHTMLTextDir(locale);\n });\n});\n"],"mappings":"AACA,SAAS,wBAAwB;AACjC,SAAS,gBAAgB;AACzB,SAAS,sBAAoC;AAE7C,IAAO,oBAAQ,iBAAiB,CAAC,YAAY;AAC3C,UAAQ,KAAK,eAAe,MAAM;AAChC,UAAM,SAAS,SAAS,EAAE,OAAO;AACjC,aAAS,gBAAgB,OAAO;AAChC,aAAS,gBAAgB,MAAM,eAAe,MAAM;AAAA,EACtD,CAAC;AACH,CAAC;","names":[]}
@@ -0,0 +1,20 @@
1
+ import { defineNuxtPlugin } from "#app";
2
+ import { useRoute } from "#imports";
3
+ import { createIntlayerClient, installIntlayer } from "vue-intlayer";
4
+ var intlayer_plugin_default = defineNuxtPlugin((nuxtApp) => {
5
+ installIntlayer(nuxtApp.vueApp);
6
+ const { setLocale } = createIntlayerClient();
7
+ const route = useRoute();
8
+ const syncLocale = () => {
9
+ const localeParam = route.params.locale;
10
+ if (localeParam) setLocale(localeParam);
11
+ };
12
+ syncLocale();
13
+ nuxtApp.hook("page:start", () => {
14
+ syncLocale();
15
+ });
16
+ });
17
+ export {
18
+ intlayer_plugin_default as default
19
+ };
20
+ //# sourceMappingURL=intlayer-plugin.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/runtime/intlayer-plugin.ts"],"sourcesContent":["// @ts-nocheck -- Nuxt runtime types are provided at application level\nimport { defineNuxtPlugin } from '#app';\nimport { useRoute } from '#imports';\nimport { Locales } from '@intlayer/config';\nimport { createIntlayerClient, installIntlayer } from 'vue-intlayer';\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 Locales | 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":"AACA,SAAS,wBAAwB;AACjC,SAAS,gBAAgB;AAEzB,SAAS,sBAAsB,uBAAuB;AAOtD,IAAO,0BAAQ,iBAAiB,CAAC,YAAY;AAO3C,kBAAgB,QAAQ,MAAM;AAI9B,QAAM,EAAE,UAAU,IAAI,qBAAqB;AAE3C,QAAM,QAAQ,SAAS;AAGvB,QAAM,aAAa,MAAM;AACvB,UAAM,cAAc,MAAM,OAAO;AACjC,QAAI,YAAa,WAAU,WAAW;AAAA,EACxC;AAGA,aAAW;AAGX,UAAQ,KAAK,cAAc,MAAM;AAC/B,eAAW;AAAA,EACb,CAAC;AACH,CAAC;","names":[]}
@@ -0,0 +1,3 @@
1
+ import { module } from './module';
2
+ export default module;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,eAAe,MAAM,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { NuxtModule } from '@nuxt/schema';
2
+ export declare const module: NuxtModule;
3
+ //# sourceMappingURL=module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../src/module.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAK/C,eAAO,MAAM,MAAM,EAAE,UA0HnB,CAAC"}
@@ -0,0 +1,3 @@
1
+ declare const _default: any;
2
+ export default _default;
3
+ //# sourceMappingURL=html-lang.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"html-lang.d.ts","sourceRoot":"","sources":["../../../src/runtime/html-lang.ts"],"names":[],"mappings":";AAKA,wBAMG"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Nuxt client plugin injected by `nuxt-intlayer` module.
3
+ * It installs the Intlayer Vue composables in the current Nuxt application and keeps
4
+ * the active locale in sync with the current route (e.g. `/fr/about` → `fr`).
5
+ */
6
+ declare const _default: any;
7
+ export default _default;
8
+ //# sourceMappingURL=intlayer-plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"intlayer-plugin.d.ts","sourceRoot":"","sources":["../../../src/runtime/intlayer-plugin.ts"],"names":[],"mappings":"AAMA;;;;GAIG;;AACH,wBA4BG"}
package/package.json ADDED
@@ -0,0 +1,111 @@
1
+ {
2
+ "name": "nuxt-intlayer",
3
+ "version": "5.5.10",
4
+ "private": false,
5
+ "description": "Easily internationalize i18n your Nuxt applications with type-safe multilingual content management.",
6
+ "keywords": [
7
+ "intlayer",
8
+ "data",
9
+ "internationalization",
10
+ "multilingual",
11
+ "i18n",
12
+ "typescript",
13
+ "nuxt",
14
+ "vue",
15
+ "vite",
16
+ "json"
17
+ ],
18
+ "homepage": "https://intlayer.org",
19
+ "bugs": {
20
+ "url": "https://github.com/aymericzip/intlayer/issues"
21
+ },
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "git+https://github.com/aymericzip/intlayer.git"
25
+ },
26
+ "license": "Apache-2.0",
27
+ "author": {
28
+ "name": "Aymeric PINEAU",
29
+ "url": "https://github.com/aymericzip"
30
+ },
31
+ "contributors": [
32
+ {
33
+ "name": "Aymeric Pineau",
34
+ "email": "ay.pineau@gmail.com",
35
+ "url": "https://github.com/aymericzip"
36
+ }
37
+ ],
38
+ "sideEffects": false,
39
+ "exports": {
40
+ ".": {
41
+ "types": "./dist/types/index.d.ts",
42
+ "require": "./dist/cjs/index.cjs",
43
+ "import": "./dist/esm/index.mjs"
44
+ },
45
+ "./package.json": "./package.json"
46
+ },
47
+ "main": "dist/cjs/index.cjs",
48
+ "module": "dist/esm/index.mjs",
49
+ "types": "dist/types/index.d.ts",
50
+ "typesVersions": {
51
+ "*": {
52
+ "package.json": [
53
+ "./package.json"
54
+ ]
55
+ }
56
+ },
57
+ "files": [
58
+ "./dist",
59
+ "./package.json"
60
+ ],
61
+ "dependencies": {
62
+ "@nuxt/kit": "^3.17.5",
63
+ "@nuxt/schema": "^3.17.5",
64
+ "tsc-alias": "^1.8.16",
65
+ "tsup": "^8.5.0",
66
+ "@intlayer/chokidar": "5.5.10",
67
+ "@intlayer/core": "5.5.10",
68
+ "@intlayer/config": "5.5.10",
69
+ "vite-intlayer": "5.5.10"
70
+ },
71
+ "devDependencies": {
72
+ "@types/node": "^22.15.30",
73
+ "@typescript-eslint/parser": "^8.33.1",
74
+ "concurrently": "^9.1.2",
75
+ "eslint": "^9.28.0",
76
+ "fast-glob": "^3.3.3",
77
+ "prettier": "^3.5.3",
78
+ "rimraf": "^6.0.1",
79
+ "typescript": "^5.8.3",
80
+ "@utils/eslint-config": "1.0.4",
81
+ "@utils/ts-config": "1.0.4",
82
+ "@utils/ts-config-types": "1.0.4",
83
+ "@utils/tsup-config": "1.0.4"
84
+ },
85
+ "peerDependencies": {
86
+ "@intlayer/chokidar": "5.5.10",
87
+ "@intlayer/config": "5.5.10",
88
+ "vite-intlayer": "5.5.10",
89
+ "@intlayer/core": "5.5.10"
90
+ },
91
+ "engines": {
92
+ "node": ">=14.18"
93
+ },
94
+ "bug": {
95
+ "url": "https://github.com/aymericzip/intlayer/issues"
96
+ },
97
+ "scripts": {
98
+ "build": "pnpm build:package & pnpm build:types",
99
+ "build:package": "tsup",
100
+ "build:types": "tsc --project ./tsconfig.types.json && tsc-alias --project ./tsconfig.types.json",
101
+ "clean": "rimraf ./dist",
102
+ "dev": "concurrently --prefix none \"tsup --watch\" \"tsc --project ./tsconfig.types.json --watch\" \"tsc-alias --project ./tsconfig.types.json --watch\"",
103
+ "lint": "eslint . --cache",
104
+ "lint:fix": "eslint . --cache --fix",
105
+ "prettier": "prettier . --check",
106
+ "prettier:fix": "prettier . --write",
107
+ "reset": "pnpm clean & pnpm build",
108
+ "test": "",
109
+ "typecheck": "tsup --project ./tsconfig.json --noEmit"
110
+ }
111
+ }