nuxt-i18n-micro 1.31.3 → 1.31.5
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/client/200.html +2 -2
- package/dist/client/404.html +2 -2
- package/dist/client/_nuxt/builds/latest.json +1 -1
- package/dist/client/_nuxt/builds/meta/3ea19687-ad69-4bdf-8d99-12da7b9d2dec.json +1 -0
- package/dist/client/index.html +2 -2
- package/dist/module.d.mts +0 -1
- package/dist/module.d.ts +0 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +10 -5
- package/dist/runtime/plugins/01.plugin.js +1 -1
- package/internals.d.ts +7 -0
- package/package.json +3 -2
- package/dist/client/_nuxt/builds/meta/ec606754-0969-4f29-95ad-bbb2db0af6ad.json +0 -1
package/dist/client/200.html
CHANGED
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
<link rel="prefetch" as="script" crossorigin href="/__nuxt-i18n-micro/_nuxt/C4eGGOXV.js">
|
|
9
9
|
<link rel="prefetch" as="style" crossorigin href="/__nuxt-i18n-micro/_nuxt/error-500.CBAEdpZV.css">
|
|
10
10
|
<link rel="prefetch" as="script" crossorigin href="/__nuxt-i18n-micro/_nuxt/BARbCa2g.js">
|
|
11
|
-
<script type="module" src="/__nuxt-i18n-micro/_nuxt/CTiMIQCz.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},
|
|
12
|
-
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-i18n-micro",buildId:"
|
|
11
|
+
<script type="module" src="/__nuxt-i18n-micro/_nuxt/CTiMIQCz.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1730749454366,false]</script>
|
|
12
|
+
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-i18n-micro",buildId:"3ea19687-ad69-4bdf-8d99-12da7b9d2dec",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
|
package/dist/client/404.html
CHANGED
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
<link rel="prefetch" as="script" crossorigin href="/__nuxt-i18n-micro/_nuxt/C4eGGOXV.js">
|
|
9
9
|
<link rel="prefetch" as="style" crossorigin href="/__nuxt-i18n-micro/_nuxt/error-500.CBAEdpZV.css">
|
|
10
10
|
<link rel="prefetch" as="script" crossorigin href="/__nuxt-i18n-micro/_nuxt/BARbCa2g.js">
|
|
11
|
-
<script type="module" src="/__nuxt-i18n-micro/_nuxt/CTiMIQCz.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},
|
|
12
|
-
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-i18n-micro",buildId:"
|
|
11
|
+
<script type="module" src="/__nuxt-i18n-micro/_nuxt/CTiMIQCz.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1730749454367,false]</script>
|
|
12
|
+
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-i18n-micro",buildId:"3ea19687-ad69-4bdf-8d99-12da7b9d2dec",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"id":"
|
|
1
|
+
{"id":"3ea19687-ad69-4bdf-8d99-12da7b9d2dec","timestamp":1730749443774}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"id":"3ea19687-ad69-4bdf-8d99-12da7b9d2dec","timestamp":1730749443774,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}
|
package/dist/client/index.html
CHANGED
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
<link rel="prefetch" as="script" crossorigin href="/__nuxt-i18n-micro/_nuxt/C4eGGOXV.js">
|
|
9
9
|
<link rel="prefetch" as="style" crossorigin href="/__nuxt-i18n-micro/_nuxt/error-500.CBAEdpZV.css">
|
|
10
10
|
<link rel="prefetch" as="script" crossorigin href="/__nuxt-i18n-micro/_nuxt/BARbCa2g.js">
|
|
11
|
-
<script type="module" src="/__nuxt-i18n-micro/_nuxt/CTiMIQCz.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},
|
|
12
|
-
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-i18n-micro",buildId:"
|
|
11
|
+
<script type="module" src="/__nuxt-i18n-micro/_nuxt/CTiMIQCz.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1730749454367,false]</script>
|
|
12
|
+
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-i18n-micro",buildId:"3ea19687-ad69-4bdf-8d99-12da7b9d2dec",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
|
package/dist/module.d.mts
CHANGED
package/dist/module.d.ts
CHANGED
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
import * as fs from 'node:fs';
|
|
3
3
|
import fs__default, { readFileSync, existsSync, mkdirSync, writeFileSync } from 'node:fs';
|
|
4
|
-
import { useNuxt, defineNuxtModule, useLogger, createResolver, addPlugin, addImportsDir, addServerHandler, addComponentsDir, addTypeTemplate, extendPages, addPrerenderRoutes } from '@nuxt/kit';
|
|
4
|
+
import { useNuxt, defineNuxtModule, useLogger, createResolver, addTemplate, addPlugin, addImportsDir, addServerHandler, addComponentsDir, addTypeTemplate, extendPages, addPrerenderRoutes } from '@nuxt/kit';
|
|
5
5
|
import { watch } from 'chokidar';
|
|
6
6
|
import { onDevToolsInitialized, extendServerRpc } from '@nuxt/devtools-kit';
|
|
7
7
|
|
|
@@ -439,17 +439,22 @@ const module = defineNuxtModule({
|
|
|
439
439
|
},
|
|
440
440
|
async setup(options, nuxt) {
|
|
441
441
|
const isCloudflarePages = nuxt.options.nitro.preset === "cloudflare_pages" || process.env.NITRO_PRESET === "cloudflare-pages";
|
|
442
|
+
if (isCloudflarePages && !options.includeDefaultLocaleRoute) {
|
|
443
|
+
throw new Error('Nuxt-i18n-micro: "includeDefaultLocaleRoute" must be set to true when using Cloudflare Pages.');
|
|
444
|
+
}
|
|
442
445
|
const logger = useLogger("nuxt-i18n-micro");
|
|
443
446
|
const resolver = createResolver(import.meta.url);
|
|
444
447
|
const rootDirs = nuxt.options._layers.map((layer) => layer.config.rootDir).reverse();
|
|
445
448
|
const localeManager = new LocaleManager(options, rootDirs);
|
|
446
449
|
const pageManager = new PageManager(localeManager.locales, options.defaultLocale, options.includeDefaultLocaleRoute, options.globalLocaleRoutes);
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
+
addTemplate({
|
|
451
|
+
filename: "i18n.plural.mjs",
|
|
452
|
+
write: true,
|
|
453
|
+
getContents: () => `export const plural = ${options.plural.toString()};`
|
|
454
|
+
});
|
|
450
455
|
const apiBaseUrl = (process.env.NUXT_I18N_APP_BASE_URL ?? options.apiBaseUrl ?? "_locales").replace(/^\/+|\/+$|\/{2,}/, "");
|
|
451
456
|
nuxt.options.runtimeConfig.public.i18nConfig = {
|
|
452
|
-
plural,
|
|
457
|
+
plural: void 0,
|
|
453
458
|
locales: localeManager.locales ?? [],
|
|
454
459
|
meta: options.meta ?? true,
|
|
455
460
|
metaBaseUrl: options.metaBaseUrl ?? void 0,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useTranslationHelper } from "../translationHelper.js";
|
|
2
2
|
import { defineNuxtPlugin, useRuntimeConfig } from "#app";
|
|
3
3
|
import { useRoute, useRouter, useCookie, useState } from "#imports";
|
|
4
|
+
import { plural } from "#build/i18n.plural.mjs";
|
|
4
5
|
const i18nHelper = useTranslationHelper();
|
|
5
6
|
const isDev = process.env.NODE_ENV !== "production";
|
|
6
7
|
function interpolate(template, params) {
|
|
@@ -163,7 +164,6 @@ export default defineNuxtPlugin(async (nuxtApp) => {
|
|
|
163
164
|
}
|
|
164
165
|
const config = useRuntimeConfig();
|
|
165
166
|
const i18nConfig = config.public.i18nConfig;
|
|
166
|
-
const plural = new Function("return " + i18nConfig.plural.toString())();
|
|
167
167
|
const apiBaseUrl = i18nConfig.apiBaseUrl ?? "_locales";
|
|
168
168
|
const runtimeConfig = useRuntimeConfig();
|
|
169
169
|
const loadTranslationsIfNeeded = async (locale, routeName, path) => {
|
package/internals.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
declare module '#build/i18n.plural.mjs' {
|
|
2
|
+
export function plural(key: string, count: number, locale: string, getter: Getter): string | null
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
declare module '#internal/i18n/options.mjs' {
|
|
6
|
+
export function plural(key: string, count: number, locale: string, getter: Getter): string | null
|
|
7
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-i18n-micro",
|
|
3
|
-
"version": "1.31.
|
|
3
|
+
"version": "1.31.5",
|
|
4
4
|
"description": "Nuxt I18n Micro is a lightweight, high-performance internationalization module for Nuxt, designed to handle multi-language support with minimal overhead, fast build times, and efficient runtime performance.",
|
|
5
5
|
"repository": "s00d/nuxt-i18n-micro",
|
|
6
6
|
"license": "MIT",
|
|
@@ -36,7 +36,8 @@
|
|
|
36
36
|
"main": "./dist/module.cjs",
|
|
37
37
|
"types": "./dist/types.d.ts",
|
|
38
38
|
"files": [
|
|
39
|
-
"dist"
|
|
39
|
+
"dist",
|
|
40
|
+
"internals.d.ts"
|
|
40
41
|
],
|
|
41
42
|
"scripts": {
|
|
42
43
|
"prepack": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxt-module-build build && npm run client:build",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"id":"ec606754-0969-4f29-95ad-bbb2db0af6ad","timestamp":1730746473747,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}
|