nuxt-i18n-micro 1.93.0 → 1.94.0
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 +8 -8
- package/dist/client/404.html +8 -8
- package/dist/client/_nuxt/{Bjm5k_ND.js → BghP2wsD.js} +3 -3
- package/dist/client/_nuxt/{BTINn22q.js → BhtDXNyb.js} +1 -1
- package/dist/client/_nuxt/{DvIeOzfB.js → BjB9nc_5.js} +1 -1
- package/dist/client/_nuxt/{DFBiwLO-.js → DpQNspb6.js} +1 -1
- package/dist/client/_nuxt/builds/latest.json +1 -1
- package/dist/client/_nuxt/builds/meta/bd644dea-2454-468d-ba61-8e09f211303a.json +1 -0
- package/dist/client/_nuxt/error-404.CdQyF-WE.css +1 -0
- package/dist/client/_nuxt/error-500.CDURyqPT.css +1 -0
- package/dist/client/index.html +8 -8
- package/dist/module.d.mts +2 -1
- package/dist/module.json +3 -3
- package/dist/module.mjs +88 -33
- package/dist/runtime/components/i18n-group.vue +7 -10
- package/dist/runtime/components/i18n-group.vue.d.ts +19 -0
- package/dist/runtime/components/i18n-link.vue +26 -43
- package/dist/runtime/components/i18n-link.vue.d.ts +19 -0
- package/dist/runtime/components/i18n-switcher.vue +93 -143
- package/dist/runtime/components/i18n-switcher.vue.d.ts +62 -0
- package/dist/runtime/components/i18n-t.vue.d.ts +1 -304
- package/dist/runtime/components/locale-redirect.vue +32 -50
- package/dist/runtime/components/locale-redirect.vue.d.ts +2 -0
- package/dist/runtime/composables/useLocaleHead.d.ts +2 -2
- package/dist/runtime/plugins/01.plugin.js +6 -2
- package/dist/runtime/plugins/04.auto-detect.js +4 -1
- package/dist/types.d.mts +8 -2
- package/package.json +24 -27
- package/dist/client/_nuxt/builds/meta/66d92d10-1ef4-46a8-88af-62abfdb758c6.json +0 -1
- package/dist/client/_nuxt/error-404.CbefIQ4Z.css +0 -1
- package/dist/client/_nuxt/error-500.Bpd-7vXd.css +0 -1
- package/dist/module.cjs +0 -5
- package/dist/module.d.ts +0 -31
- package/dist/types.d.ts +0 -7
- package/dist/utils.d.mts +0 -17
- package/dist/utils.d.ts +0 -17
- package/dist/utils.mjs +0 -64
- /package/{internals.d.ts → internals.d.mts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as a,f as s,h as u,i as r,g as o}from"./
|
|
1
|
+
import{u as a,f as s,h as u,i as r,g as o}from"./BghP2wsD.js";function i(e){const t=e||s();return t?.ssrContext?.head||t?.runWithContext(()=>{if(u())return r(o)})}function x(e,t={}){const n=i(t.nuxt);if(n)return a(e,{head:n,...t})}export{x as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as a,c as i,o as u,a as e,t as r,b as c,w as l,d,e as p}from"./
|
|
1
|
+
import{_ as a,c as i,o as u,a as e,t as r,b as c,w as l,d,e as p}from"./BghP2wsD.js";import{u as f}from"./BhtDXNyb.js";const m={class:"antialiased bg-white dark:bg-black dark:text-white font-sans grid min-h-screen overflow-hidden place-content-center text-black"},g={class:"max-w-520px text-center z-20"},b=["textContent"],h=["textContent"],x={class:"flex items-center justify-center w-full"},y={__name:"error-404",props:{appName:{type:String,default:"Nuxt"},version:{type:String,default:""},statusCode:{type:Number,default:404},statusMessage:{type:String,default:"Not Found"},description:{type:String,default:"Sorry, the page you are looking for could not be found."},backHome:{type:String,default:"Go back home"}},setup(t){const n=t;return f({title:`${n.statusCode} - ${n.statusMessage} | ${n.appName}`,script:[{innerHTML:`!function(){const e=document.createElement("link").relList;if(!(e&&e.supports&&e.supports("modulepreload"))){for(const e of document.querySelectorAll('link[rel="modulepreload"]'))r(e);new MutationObserver((e=>{for(const o of e)if("childList"===o.type)for(const e of o.addedNodes)"LINK"===e.tagName&&"modulepreload"===e.rel&&r(e)})).observe(document,{childList:!0,subtree:!0})}function r(e){if(e.ep)return;e.ep=!0;const r=function(e){const r={};return e.integrity&&(r.integrity=e.integrity),e.referrerPolicy&&(r.referrerPolicy=e.referrerPolicy),"use-credentials"===e.crossOrigin?r.credentials="include":"anonymous"===e.crossOrigin?r.credentials="omit":r.credentials="same-origin",r}(e);fetch(e.href,r)}}();`}],style:[{innerHTML:'*,:after,:before{border-color:var(--un-default-border-color,#e5e7eb);border-style:solid;border-width:0;box-sizing:border-box}:after,:before{--un-content:""}html{line-height:1.5;-webkit-text-size-adjust:100%;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal;-moz-tab-size:4;tab-size:4;-webkit-tap-highlight-color:transparent}body{line-height:inherit;margin:0}h1{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}h1,p{margin:0}*,:after,:before{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 transparent;--un-ring-shadow:0 0 transparent;--un-shadow-inset: ;--un-shadow:0 0 transparent;--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgba(147,197,253,.5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }'}]}),(k,o)=>{const s=p;return u(),i("div",m,[o[0]||(o[0]=e("div",{class:"fixed left-0 right-0 spotlight z-10"},null,-1)),e("div",g,[e("h1",{class:"font-medium mb-8 sm:text-10xl text-8xl",textContent:r(t.statusCode)},null,8,b),e("p",{class:"font-light leading-tight mb-16 px-8 sm:px-0 sm:text-4xl text-xl",textContent:r(t.description)},null,8,h),e("div",x,[c(s,{to:"/",class:"cursor-pointer gradient-border px-4 py-2 sm:px-6 sm:py-3 sm:text-xl text-md"},{default:l(()=>[d(r(t.backHome),1)]),_:1})])])])}}},v=a(y,[["__scopeId","data-v-9b825d7e"]]);export{v as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as s,c as a,o as i,a as e,t as o}from"./
|
|
1
|
+
import{_ as s,c as a,o as i,a as e,t as o}from"./BghP2wsD.js";import{u}from"./BhtDXNyb.js";const l={class:"antialiased bg-white dark:bg-black dark:text-white font-sans grid min-h-screen overflow-hidden place-content-center text-black"},c={class:"max-w-520px text-center"},d=["textContent"],p=["textContent"],f={__name:"error-500",props:{appName:{type:String,default:"Nuxt"},version:{type:String,default:""},statusCode:{type:Number,default:500},statusMessage:{type:String,default:"Server error"},description:{type:String,default:"This page is temporarily unavailable."}},setup(t){const r=t;return u({title:`${r.statusCode} - ${r.statusMessage} | ${r.appName}`,script:[{innerHTML:`!function(){const e=document.createElement("link").relList;if(!(e&&e.supports&&e.supports("modulepreload"))){for(const e of document.querySelectorAll('link[rel="modulepreload"]'))r(e);new MutationObserver((e=>{for(const o of e)if("childList"===o.type)for(const e of o.addedNodes)"LINK"===e.tagName&&"modulepreload"===e.rel&&r(e)})).observe(document,{childList:!0,subtree:!0})}function r(e){if(e.ep)return;e.ep=!0;const r=function(e){const r={};return e.integrity&&(r.integrity=e.integrity),e.referrerPolicy&&(r.referrerPolicy=e.referrerPolicy),"use-credentials"===e.crossOrigin?r.credentials="include":"anonymous"===e.crossOrigin?r.credentials="omit":r.credentials="same-origin",r}(e);fetch(e.href,r)}}();`}],style:[{innerHTML:'*,:after,:before{border-color:var(--un-default-border-color,#e5e7eb);border-style:solid;border-width:0;box-sizing:border-box}:after,:before{--un-content:""}html{line-height:1.5;-webkit-text-size-adjust:100%;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal;-moz-tab-size:4;tab-size:4;-webkit-tap-highlight-color:transparent}body{line-height:inherit;margin:0}h1{font-size:inherit;font-weight:inherit}h1,p{margin:0}*,:after,:before{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 transparent;--un-ring-shadow:0 0 transparent;--un-shadow-inset: ;--un-shadow:0 0 transparent;--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgba(147,197,253,.5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }'}]}),(g,n)=>(i(),a("div",l,[n[0]||(n[0]=e("div",{class:"-bottom-1/2 fixed h-1/2 left-0 right-0 spotlight"},null,-1)),e("div",c,[e("h1",{class:"font-medium mb-8 sm:text-10xl text-8xl",textContent:o(t.statusCode)},null,8,d),e("p",{class:"font-light leading-tight mb-16 px-8 sm:px-0 sm:text-4xl text-xl",textContent:o(t.description)},null,8,p)])]))}},b=s(f,[["__scopeId","data-v-8ccc93ed"]]);export{b as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"id":"
|
|
1
|
+
{"id":"bd644dea-2454-468d-ba61-8e09f211303a","timestamp":1756402804877}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"id":"bd644dea-2454-468d-ba61-8e09f211303a","timestamp":1756402804877,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.spotlight[data-v-9b825d7e]{background:linear-gradient(45deg,#00dc82,#36e4da 50%,#0047e1);bottom:-30vh;filter:blur(20vh);height:40vh}.gradient-border[data-v-9b825d7e]{-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);border-radius:.5rem;position:relative}@media (prefers-color-scheme:light){.gradient-border[data-v-9b825d7e]{background-color:#ffffff4d}.gradient-border[data-v-9b825d7e]:before{background:linear-gradient(90deg,#e2e2e2,#e2e2e2 25%,#00dc82,#36e4da 75%,#0047e1)}}@media (prefers-color-scheme:dark){.gradient-border[data-v-9b825d7e]{background-color:#1414144d}.gradient-border[data-v-9b825d7e]:before{background:linear-gradient(90deg,#303030,#303030 25%,#00dc82,#36e4da 75%,#0047e1)}}.gradient-border[data-v-9b825d7e]:before{background-size:400% auto;border-radius:.5rem;content:"";inset:0;-webkit-mask:linear-gradient(#fff 0 0) content-box,linear-gradient(#fff 0 0);mask:linear-gradient(#fff 0 0) content-box,linear-gradient(#fff 0 0);-webkit-mask-composite:xor;mask-composite:exclude;opacity:.5;padding:2px;position:absolute;transition:background-position .3s ease-in-out,opacity .2s ease-in-out;width:100%}.gradient-border[data-v-9b825d7e]:hover:before{background-position:-50% 0;opacity:1}.fixed[data-v-9b825d7e]{position:fixed}.left-0[data-v-9b825d7e]{left:0}.right-0[data-v-9b825d7e]{right:0}.z-10[data-v-9b825d7e]{z-index:10}.z-20[data-v-9b825d7e]{z-index:20}.grid[data-v-9b825d7e]{display:grid}.mb-16[data-v-9b825d7e]{margin-bottom:4rem}.mb-8[data-v-9b825d7e]{margin-bottom:2rem}.max-w-520px[data-v-9b825d7e]{max-width:520px}.min-h-screen[data-v-9b825d7e]{min-height:100vh}.w-full[data-v-9b825d7e]{width:100%}.flex[data-v-9b825d7e]{display:flex}.cursor-pointer[data-v-9b825d7e]{cursor:pointer}.place-content-center[data-v-9b825d7e]{place-content:center}.items-center[data-v-9b825d7e]{align-items:center}.justify-center[data-v-9b825d7e]{justify-content:center}.overflow-hidden[data-v-9b825d7e]{overflow:hidden}.bg-white[data-v-9b825d7e]{--un-bg-opacity:1;background-color:rgb(255 255 255/var(--un-bg-opacity))}.px-4[data-v-9b825d7e]{padding-left:1rem;padding-right:1rem}.px-8[data-v-9b825d7e]{padding-left:2rem;padding-right:2rem}.py-2[data-v-9b825d7e]{padding-bottom:.5rem;padding-top:.5rem}.text-center[data-v-9b825d7e]{text-align:center}.text-8xl[data-v-9b825d7e]{font-size:6rem;line-height:1}.text-xl[data-v-9b825d7e]{font-size:1.25rem;line-height:1.75rem}.text-black[data-v-9b825d7e]{--un-text-opacity:1;color:rgb(0 0 0/var(--un-text-opacity))}.font-light[data-v-9b825d7e]{font-weight:300}.font-medium[data-v-9b825d7e]{font-weight:500}.leading-tight[data-v-9b825d7e]{line-height:1.25}.font-sans[data-v-9b825d7e]{font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}.antialiased[data-v-9b825d7e]{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}@media (prefers-color-scheme:dark){.dark\:bg-black[data-v-9b825d7e]{--un-bg-opacity:1;background-color:rgb(0 0 0/var(--un-bg-opacity))}.dark\:text-white[data-v-9b825d7e]{--un-text-opacity:1;color:rgb(255 255 255/var(--un-text-opacity))}}@media (min-width:640px){.sm\:px-0[data-v-9b825d7e]{padding-left:0;padding-right:0}.sm\:px-6[data-v-9b825d7e]{padding-left:1.5rem;padding-right:1.5rem}.sm\:py-3[data-v-9b825d7e]{padding-bottom:.75rem;padding-top:.75rem}.sm\:text-4xl[data-v-9b825d7e]{font-size:2.25rem;line-height:2.5rem}.sm\:text-xl[data-v-9b825d7e]{font-size:1.25rem;line-height:1.75rem}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.spotlight[data-v-8ccc93ed]{background:linear-gradient(45deg,#00dc82,#36e4da 50%,#0047e1);filter:blur(20vh)}.fixed[data-v-8ccc93ed]{position:fixed}.-bottom-1\/2[data-v-8ccc93ed]{bottom:-50%}.left-0[data-v-8ccc93ed]{left:0}.right-0[data-v-8ccc93ed]{right:0}.grid[data-v-8ccc93ed]{display:grid}.mb-16[data-v-8ccc93ed]{margin-bottom:4rem}.mb-8[data-v-8ccc93ed]{margin-bottom:2rem}.h-1\/2[data-v-8ccc93ed]{height:50%}.max-w-520px[data-v-8ccc93ed]{max-width:520px}.min-h-screen[data-v-8ccc93ed]{min-height:100vh}.place-content-center[data-v-8ccc93ed]{place-content:center}.overflow-hidden[data-v-8ccc93ed]{overflow:hidden}.bg-white[data-v-8ccc93ed]{--un-bg-opacity:1;background-color:rgb(255 255 255/var(--un-bg-opacity))}.px-8[data-v-8ccc93ed]{padding-left:2rem;padding-right:2rem}.text-center[data-v-8ccc93ed]{text-align:center}.text-8xl[data-v-8ccc93ed]{font-size:6rem;line-height:1}.text-xl[data-v-8ccc93ed]{font-size:1.25rem;line-height:1.75rem}.text-black[data-v-8ccc93ed]{--un-text-opacity:1;color:rgb(0 0 0/var(--un-text-opacity))}.font-light[data-v-8ccc93ed]{font-weight:300}.font-medium[data-v-8ccc93ed]{font-weight:500}.leading-tight[data-v-8ccc93ed]{line-height:1.25}.font-sans[data-v-8ccc93ed]{font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}.antialiased[data-v-8ccc93ed]{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}@media (prefers-color-scheme:dark){.dark\:bg-black[data-v-8ccc93ed]{--un-bg-opacity:1;background-color:rgb(0 0 0/var(--un-bg-opacity))}.dark\:text-white[data-v-8ccc93ed]{--un-text-opacity:1;color:rgb(255 255 255/var(--un-text-opacity))}}@media (min-width:640px){.sm\:px-0[data-v-8ccc93ed]{padding-left:0;padding-right:0}.sm\:text-4xl[data-v-8ccc93ed]{font-size:2.25rem;line-height:2.5rem}}
|
package/dist/client/index.html
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<!DOCTYPE html><html><head><meta charset="utf-8">
|
|
2
2
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
3
3
|
<link rel="stylesheet" href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/entry.BVfqTszp.css" crossorigin>
|
|
4
|
-
<link rel="modulepreload" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/
|
|
4
|
+
<link rel="modulepreload" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/BghP2wsD.js">
|
|
5
5
|
<link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/l5rcX3cq.js">
|
|
6
|
-
<link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/error-404.
|
|
7
|
-
<link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/
|
|
8
|
-
<link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/
|
|
9
|
-
<link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/error-500.
|
|
10
|
-
<link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/
|
|
11
|
-
<script type="module" src="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/
|
|
12
|
-
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"
|
|
6
|
+
<link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/error-404.CdQyF-WE.css">
|
|
7
|
+
<link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/BjB9nc_5.js">
|
|
8
|
+
<link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/BhtDXNyb.js">
|
|
9
|
+
<link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/error-500.CDURyqPT.css">
|
|
10
|
+
<link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/DpQNspb6.js">
|
|
11
|
+
<script type="module" src="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/BghP2wsD.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},1756402812649,false]</script>
|
|
12
|
+
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"bd644dea-2454-468d-ba61-8e09f211303a",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
|
package/dist/module.d.mts
CHANGED
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -7,7 +7,6 @@ import { isPrefixAndDefaultStrategy, isPrefixStrategy, isNoPrefixStrategy, isPre
|
|
|
7
7
|
import { fileURLToPath } from 'node:url';
|
|
8
8
|
import { onDevToolsInitialized, extendServerRpc } from '@nuxt/devtools-kit';
|
|
9
9
|
import sirv from 'sirv';
|
|
10
|
-
import { isInternalPath, extractLocaleRoutes, normalizePath, isLocaleDefault, cloneArray, isPageRedirectOnly, removeLeadingSlash, shouldAddLocalePrefix, buildFullPath, buildRouteName, buildFullPathNoPrefix } from './utils.mjs';
|
|
11
10
|
|
|
12
11
|
const DEVTOOLS_UI_PORT = 3030;
|
|
13
12
|
const DEVTOOLS_UI_ROUTE = "/__nuxt-i18n-micro";
|
|
@@ -74,8 +73,7 @@ function setupDevToolsUI(options, resolve2) {
|
|
|
74
73
|
const localesDir = path.join(rootDir, options.translationDir || "locales");
|
|
75
74
|
const pagesDir = path.join(localesDir, "pages");
|
|
76
75
|
const processDirectory = (dir) => {
|
|
77
|
-
if (!fs.existsSync(dir))
|
|
78
|
-
return;
|
|
76
|
+
if (!fs.existsSync(dir)) return;
|
|
79
77
|
fs.readdirSync(dir).forEach((file) => {
|
|
80
78
|
const filePath = path.join(dir, file);
|
|
81
79
|
const stat = fs.lstatSync(filePath);
|
|
@@ -110,6 +108,64 @@ function setupDevToolsUI(options, resolve2) {
|
|
|
110
108
|
});
|
|
111
109
|
}
|
|
112
110
|
|
|
111
|
+
const isInternalPath = (p) => /(?:^|\/)__[^/]+/.test(p);
|
|
112
|
+
function extractLocaleRoutes(content, filePath) {
|
|
113
|
+
const defineMatch = content.match(/\$?\bdefineI18nRoute\s*\(\s*\{[\s\S]*?\}\s*\)/);
|
|
114
|
+
if (defineMatch) {
|
|
115
|
+
const localeRoutesMatch = defineMatch[0].match(/localeRoutes:\s*(\{[\s\S]*?\})/);
|
|
116
|
+
if (localeRoutesMatch && localeRoutesMatch[1]) {
|
|
117
|
+
try {
|
|
118
|
+
const parsedLocaleRoutes = Function('"use strict";return (' + localeRoutesMatch[1] + ")")();
|
|
119
|
+
if (typeof parsedLocaleRoutes === "object" && parsedLocaleRoutes !== null) {
|
|
120
|
+
if (validateDefineI18nRouteConfig(parsedLocaleRoutes)) {
|
|
121
|
+
return parsedLocaleRoutes;
|
|
122
|
+
}
|
|
123
|
+
} else {
|
|
124
|
+
console.error("localeRoutes found but it is not a valid object in file:", filePath);
|
|
125
|
+
}
|
|
126
|
+
} catch (error) {
|
|
127
|
+
console.error("Failed to parse localeRoutes:", error, "in file:", filePath);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return null;
|
|
132
|
+
}
|
|
133
|
+
function validateDefineI18nRouteConfig(obj) {
|
|
134
|
+
if (typeof obj !== "object") return false;
|
|
135
|
+
for (const routeKey in obj.localeRoutes) {
|
|
136
|
+
if (typeof obj.localeRoutes[routeKey] !== "string") return false;
|
|
137
|
+
}
|
|
138
|
+
return true;
|
|
139
|
+
}
|
|
140
|
+
const normalizePath = (routePath) => {
|
|
141
|
+
if (!routePath) {
|
|
142
|
+
return "";
|
|
143
|
+
}
|
|
144
|
+
const normalized = path.posix.normalize(routePath).replace(/\/+$/, "");
|
|
145
|
+
return normalized === "." ? "" : normalized;
|
|
146
|
+
};
|
|
147
|
+
const cloneArray = (array) => array.map((item) => ({ ...item }));
|
|
148
|
+
const isPageRedirectOnly = (page) => !!(page.redirect && !page.file);
|
|
149
|
+
const removeLeadingSlash = (routePath) => routePath.startsWith("/") ? routePath.slice(1) : routePath;
|
|
150
|
+
const buildRouteName = (baseName, localeCode, isCustom) => isCustom ? `localized-${baseName}-${localeCode}` : `localized-${baseName}`;
|
|
151
|
+
const shouldAddLocalePrefix = (locale, defaultLocale, addLocalePrefix, includeDefaultLocaleRoute) => addLocalePrefix && !(locale === defaultLocale.code && !includeDefaultLocaleRoute);
|
|
152
|
+
const isLocaleDefault = (locale, defaultLocale, includeDefaultLocaleRoute) => {
|
|
153
|
+
const localeCode = typeof locale === "string" ? locale : locale.code;
|
|
154
|
+
return localeCode === defaultLocale.code && !includeDefaultLocaleRoute;
|
|
155
|
+
};
|
|
156
|
+
const buildFullPath = (locale, basePath, customRegex) => {
|
|
157
|
+
const regexString = normalizeRegex(customRegex?.toString());
|
|
158
|
+
const localeParam = regexString ? regexString : Array.isArray(locale) ? locale.join("|") : locale;
|
|
159
|
+
return normalizePath(path.posix.join("/", `:locale(${localeParam})`, basePath));
|
|
160
|
+
};
|
|
161
|
+
const buildFullPathNoPrefix = (basePath) => {
|
|
162
|
+
return normalizePath(basePath);
|
|
163
|
+
};
|
|
164
|
+
const normalizeRegex = (toNorm) => {
|
|
165
|
+
if (typeof toNorm === "undefined") return void 0;
|
|
166
|
+
return toNorm.startsWith("/") && toNorm.endsWith("/") ? toNorm?.slice(1, -1) : toNorm;
|
|
167
|
+
};
|
|
168
|
+
|
|
113
169
|
const buildRouteNameFromRoute = (name, path2) => {
|
|
114
170
|
return name ?? (path2 ?? "").replace(/[^a-z0-9]/gi, "-").replace(/^-+|-+$/g, "");
|
|
115
171
|
};
|
|
@@ -163,12 +219,11 @@ class PageManager {
|
|
|
163
219
|
if (isPrefixStrategy(this.strategy) && !isCloudflarePages) {
|
|
164
220
|
for (let i = pages.length - 1; i >= 0; i--) {
|
|
165
221
|
const page = pages[i];
|
|
222
|
+
if (!page) continue;
|
|
166
223
|
const pagePath = page.path ?? "";
|
|
167
224
|
const pageName = page.name ?? "";
|
|
168
|
-
if (isInternalPath(pagePath))
|
|
169
|
-
|
|
170
|
-
if (this.globalLocaleRoutes[pageName] === false)
|
|
171
|
-
continue;
|
|
225
|
+
if (isInternalPath(pagePath)) continue;
|
|
226
|
+
if (this.globalLocaleRoutes[pageName] === false) continue;
|
|
172
227
|
if (!/^\/:locale/.test(pagePath) && pagePath !== "/") {
|
|
173
228
|
pages.splice(i, 1);
|
|
174
229
|
}
|
|
@@ -210,16 +265,14 @@ class PageManager {
|
|
|
210
265
|
const newRoute = this.createLocalizedRoute(page, [locale.code], page.children ?? [], true, customPath, customRegex, false, locale.code);
|
|
211
266
|
if (newRoute) {
|
|
212
267
|
additionalRoutes.push(newRoute);
|
|
213
|
-
if (this.noPrefixRedirect)
|
|
214
|
-
page.redirect = newRoute.path;
|
|
268
|
+
if (this.noPrefixRedirect) page.redirect = newRoute.path;
|
|
215
269
|
}
|
|
216
270
|
} else {
|
|
217
271
|
if (isDefaultLocale) {
|
|
218
272
|
page.path = normalizePath(customPath);
|
|
219
273
|
} else {
|
|
220
274
|
const newRoute = this.createLocalizedRoute(page, [locale.code], page.children ?? [], true, customPath, customRegex, false, locale.code);
|
|
221
|
-
if (newRoute)
|
|
222
|
-
additionalRoutes.push(newRoute);
|
|
275
|
+
if (newRoute) additionalRoutes.push(newRoute);
|
|
223
276
|
}
|
|
224
277
|
}
|
|
225
278
|
} else {
|
|
@@ -233,15 +286,13 @@ class PageManager {
|
|
|
233
286
|
});
|
|
234
287
|
}
|
|
235
288
|
localizePage(page, additionalRoutes, customRegex) {
|
|
236
|
-
if (isPageRedirectOnly(page))
|
|
237
|
-
return;
|
|
289
|
+
if (isPageRedirectOnly(page)) return;
|
|
238
290
|
const originalChildren = cloneArray(page.children ?? []);
|
|
239
291
|
const normalizedFullPath = normalizePath(page.path);
|
|
240
292
|
const localeCodesWithoutCustomPaths = this.filterLocaleCodesWithoutCustomPaths(normalizedFullPath);
|
|
241
293
|
if (localeCodesWithoutCustomPaths.length) {
|
|
242
294
|
const newRoute = this.createLocalizedRoute(page, localeCodesWithoutCustomPaths, originalChildren, false, "", customRegex, false, true);
|
|
243
|
-
if (newRoute)
|
|
244
|
-
additionalRoutes.push(newRoute);
|
|
295
|
+
if (newRoute) additionalRoutes.push(newRoute);
|
|
245
296
|
}
|
|
246
297
|
this.addCustomLocalizedRoutes(page, normalizedFullPath, originalChildren, additionalRoutes);
|
|
247
298
|
this.adjustRouteForDefaultLocale(page, originalChildren);
|
|
@@ -285,20 +336,17 @@ class PageManager {
|
|
|
285
336
|
addCustomLocalizedRoutes(page, fullPath, originalChildren, additionalRoutes, customRegex) {
|
|
286
337
|
this.locales.forEach((locale) => {
|
|
287
338
|
const customPath = this.localizedPaths[fullPath]?.[locale.code];
|
|
288
|
-
if (!customPath)
|
|
289
|
-
return;
|
|
339
|
+
if (!customPath) return;
|
|
290
340
|
const isDefaultLocale = isLocaleDefault(locale, this.defaultLocale, isPrefixStrategy(this.strategy) || isNoPrefixStrategy(this.strategy));
|
|
291
341
|
if (isDefaultLocale) {
|
|
292
342
|
page.children = this.createLocalizedChildren(originalChildren, "", [locale.code], false);
|
|
293
343
|
} else {
|
|
294
344
|
const newRoute = this.createLocalizedRoute(page, [locale.code], originalChildren, true, customPath, customRegex, false, locale.code);
|
|
295
|
-
if (newRoute)
|
|
296
|
-
additionalRoutes.push(newRoute);
|
|
345
|
+
if (newRoute) additionalRoutes.push(newRoute);
|
|
297
346
|
}
|
|
298
347
|
if (isPrefixAndDefaultStrategy(this.strategy) && locale === this.defaultLocale) {
|
|
299
348
|
const newRoute = this.createLocalizedRoute(page, [locale.code], originalChildren, true, customPath, customRegex, true, locale.code);
|
|
300
|
-
if (newRoute)
|
|
301
|
-
additionalRoutes.push(newRoute);
|
|
349
|
+
if (newRoute) additionalRoutes.push(newRoute);
|
|
302
350
|
}
|
|
303
351
|
});
|
|
304
352
|
}
|
|
@@ -393,9 +441,11 @@ class PageManager {
|
|
|
393
441
|
}
|
|
394
442
|
createLocalizedRoute(page, localeCodes, originalChildren, isCustom, customPath = "", customRegex, force = false, parentLocale = false) {
|
|
395
443
|
const routePath = this.buildRoutePath(localeCodes, page.path, encodeURI(customPath), isCustom, customRegex, force);
|
|
396
|
-
if (!routePath || routePath == page.path)
|
|
397
|
-
|
|
398
|
-
const
|
|
444
|
+
if (!routePath || routePath == page.path) return null;
|
|
445
|
+
if (localeCodes.length === 0) return null;
|
|
446
|
+
const firstLocale = localeCodes[0];
|
|
447
|
+
if (!firstLocale) return null;
|
|
448
|
+
const routeName = buildRouteName(buildRouteNameFromRoute(page.name ?? "", page.path ?? ""), firstLocale, isCustom);
|
|
399
449
|
return {
|
|
400
450
|
...page,
|
|
401
451
|
children: this.createLocalizedChildren(originalChildren, page.path, localeCodes, true, false, parentLocale),
|
|
@@ -404,8 +454,7 @@ class PageManager {
|
|
|
404
454
|
};
|
|
405
455
|
}
|
|
406
456
|
buildLocalizedRouteName(baseName, locale, modifyName, forceLocaleSuffixOrCustom = false) {
|
|
407
|
-
if (!modifyName)
|
|
408
|
-
return baseName;
|
|
457
|
+
if (!modifyName) return baseName;
|
|
409
458
|
if (forceLocaleSuffixOrCustom) {
|
|
410
459
|
return `localized-${baseName}-${locale}`;
|
|
411
460
|
}
|
|
@@ -524,7 +573,10 @@ const module = defineNuxtModule({
|
|
|
524
573
|
return null;
|
|
525
574
|
}
|
|
526
575
|
const forms = translation.toString().split("|");
|
|
527
|
-
|
|
576
|
+
if (forms.length === 0) return null;
|
|
577
|
+
const selectedForm = count < forms.length ? forms[count] : forms[forms.length - 1];
|
|
578
|
+
if (!selectedForm) return null;
|
|
579
|
+
return selectedForm.trim().replace("{count}", count.toString());
|
|
528
580
|
},
|
|
529
581
|
customRegexMatcher: void 0
|
|
530
582
|
},
|
|
@@ -678,11 +730,12 @@ const module = defineNuxtModule({
|
|
|
678
730
|
pages.push(fallbackRoute);
|
|
679
731
|
}
|
|
680
732
|
if (!isNoPrefixStrategy(options.strategy)) {
|
|
681
|
-
|
|
733
|
+
const nuxtOptions = nuxt.options;
|
|
734
|
+
nuxtOptions.generate = nuxtOptions.generate || {};
|
|
735
|
+
nuxtOptions.generate.routes = Array.isArray(nuxtOptions.generate.routes) ? nuxtOptions.generate.routes : [];
|
|
682
736
|
if (isCloudflarePages) {
|
|
683
737
|
const processPageWithChildren = (page, parentPath = "") => {
|
|
684
|
-
if (!page.path)
|
|
685
|
-
return;
|
|
738
|
+
if (!page.path) return;
|
|
686
739
|
const fullPath = path.posix.normalize(`${parentPath}/${page.path}`);
|
|
687
740
|
if (isInternalPath(fullPath)) {
|
|
688
741
|
return;
|
|
@@ -692,7 +745,7 @@ const module = defineNuxtModule({
|
|
|
692
745
|
return;
|
|
693
746
|
}
|
|
694
747
|
const localeSegmentMatch = fullPath.match(/:locale\(([^)]+)\)/);
|
|
695
|
-
if (localeSegmentMatch) {
|
|
748
|
+
if (localeSegmentMatch && localeSegmentMatch[1]) {
|
|
696
749
|
const availableLocales = localeSegmentMatch[1].split("|");
|
|
697
750
|
localeManager.locales.forEach((locale) => {
|
|
698
751
|
const localeCode = locale.code;
|
|
@@ -770,8 +823,10 @@ const module = defineNuxtModule({
|
|
|
770
823
|
return;
|
|
771
824
|
}
|
|
772
825
|
const routes = nitroConfig.prerender?.routes || [];
|
|
773
|
-
|
|
774
|
-
|
|
826
|
+
const nuxtOptions = nuxt.options;
|
|
827
|
+
nuxtOptions.generate = nuxtOptions.generate || {};
|
|
828
|
+
nuxtOptions.generate.routes = Array.isArray(nuxtOptions.generate.routes) ? nuxtOptions.generate.routes : [];
|
|
829
|
+
const pages = nuxtOptions.generate.routes || [];
|
|
775
830
|
localeManager.locales.forEach((locale) => {
|
|
776
831
|
const shouldGenerate = locale.code !== defaultLocale || withPrefixStrategy(options.strategy);
|
|
777
832
|
if (shouldGenerate) {
|
|
@@ -8,16 +8,13 @@
|
|
|
8
8
|
</template>
|
|
9
9
|
|
|
10
10
|
<script setup>
|
|
11
|
-
import { useNuxtApp, useRoute } from
|
|
12
|
-
|
|
11
|
+
import { useNuxtApp, useRoute } from "#imports";
|
|
13
12
|
const props = defineProps({
|
|
14
13
|
prefix: { type: String, required: true },
|
|
15
|
-
groupClass: { type: String, default:
|
|
16
|
-
})
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
const translate = (key, params = {}) => $t(`${props.prefix}.${key}`, params)
|
|
14
|
+
groupClass: { type: String, default: "" }
|
|
15
|
+
});
|
|
16
|
+
const { $_t } = useNuxtApp();
|
|
17
|
+
const route = useRoute();
|
|
18
|
+
const $t = $_t(route);
|
|
19
|
+
const translate = (key, params = {}) => $t(`${props.prefix}.${key}`, params);
|
|
23
20
|
</script>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
2
|
+
export default _default;
|
|
3
|
+
type __VLS_WithSlots<T, S> = T & (new () => {
|
|
4
|
+
$slots: S;
|
|
5
|
+
});
|
|
6
|
+
declare const __VLS_component: import("vue").DefineComponent<{}, {
|
|
7
|
+
prefix: string;
|
|
8
|
+
groupClass: string;
|
|
9
|
+
$props: {
|
|
10
|
+
readonly prefix?: string | undefined;
|
|
11
|
+
readonly groupClass?: string | undefined;
|
|
12
|
+
};
|
|
13
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
14
|
+
type __VLS_Slots = {
|
|
15
|
+
default?: ((props: {
|
|
16
|
+
prefix: string;
|
|
17
|
+
t: (key: any, params?: {}) => any;
|
|
18
|
+
}) => any) | undefined;
|
|
19
|
+
};
|
|
@@ -18,57 +18,40 @@
|
|
|
18
18
|
</NuxtLink>
|
|
19
19
|
</template>
|
|
20
20
|
|
|
21
|
-
<script
|
|
22
|
-
import
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
interface Props {
|
|
30
|
-
to: RouteLocationNamedRaw | RouteLocationResolvedGeneric | string
|
|
31
|
-
activeStyle?: Partial<CSSStyleValue>
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const props = defineProps<Props>()
|
|
35
|
-
const route = useRoute()
|
|
36
|
-
|
|
21
|
+
<script setup>
|
|
22
|
+
import { useNuxtApp, computed, useRoute, useRouter } from "#imports";
|
|
23
|
+
const { $localeRoute } = useNuxtApp();
|
|
24
|
+
const props = defineProps({
|
|
25
|
+
to: { type: [Object, String], required: true },
|
|
26
|
+
activeStyle: { type: Object, required: false }
|
|
27
|
+
});
|
|
28
|
+
const route = useRoute();
|
|
37
29
|
const isExternalLink = computed(() => {
|
|
38
|
-
if (typeof props.to ===
|
|
39
|
-
return /^(?:https?:\/\/|\/\/|[a-zA-Z0-9-]+\.[a-zA-Z]{2,})|tel:|mailto:/.test(props.to)
|
|
30
|
+
if (typeof props.to === "string") {
|
|
31
|
+
return /^(?:https?:\/\/|\/\/|[a-zA-Z0-9-]+\.[a-zA-Z]{2,})|tel:|mailto:/.test(props.to);
|
|
40
32
|
}
|
|
41
|
-
return false
|
|
42
|
-
})
|
|
43
|
-
|
|
33
|
+
return false;
|
|
34
|
+
});
|
|
44
35
|
const externalHref = computed(() => {
|
|
45
|
-
if (isExternalLink.value && typeof props.to ===
|
|
36
|
+
if (isExternalLink.value && typeof props.to === "string") {
|
|
46
37
|
if (!/^https?:\/\//.test(props.to)) {
|
|
47
|
-
return `https://${props.to}
|
|
38
|
+
return `https://${props.to}`;
|
|
48
39
|
}
|
|
49
|
-
return props.to
|
|
40
|
+
return props.to;
|
|
50
41
|
}
|
|
51
|
-
return
|
|
52
|
-
})
|
|
53
|
-
|
|
42
|
+
return void 0;
|
|
43
|
+
});
|
|
54
44
|
const isActive = computed(() => {
|
|
55
45
|
if (isExternalLink.value) {
|
|
56
|
-
return false
|
|
46
|
+
return false;
|
|
57
47
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
const newPath = $localeRoute(props.to)
|
|
62
|
-
if (typeof newPath === 'string') {
|
|
63
|
-
return route.path === useRouter().resolve(newPath).path
|
|
48
|
+
const newPath = $localeRoute(props.to);
|
|
49
|
+
if (typeof newPath === "string") {
|
|
50
|
+
return route.path === useRouter().resolve(newPath).path;
|
|
64
51
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
return isActive.value
|
|
71
|
-
? { ...props.activeStyle }
|
|
72
|
-
: {}
|
|
73
|
-
})
|
|
52
|
+
return route.path === newPath.path;
|
|
53
|
+
});
|
|
54
|
+
const computedStyle = computed(() => {
|
|
55
|
+
return isActive.value ? { ...props.activeStyle } : {};
|
|
56
|
+
});
|
|
74
57
|
</script>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { RouteLocationNamedRaw, RouteLocationResolvedGeneric } from 'vue-router';
|
|
2
|
+
interface Props {
|
|
3
|
+
to: RouteLocationNamedRaw | RouteLocationResolvedGeneric | string;
|
|
4
|
+
activeStyle?: Partial<CSSStyleValue>;
|
|
5
|
+
}
|
|
6
|
+
declare var __VLS_1: {}, __VLS_8: {};
|
|
7
|
+
type __VLS_Slots = {} & {
|
|
8
|
+
default?: (props: typeof __VLS_1) => any;
|
|
9
|
+
} & {
|
|
10
|
+
default?: (props: typeof __VLS_8) => any;
|
|
11
|
+
};
|
|
12
|
+
declare const __VLS_component: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
13
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
14
|
+
export default _default;
|
|
15
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
16
|
+
new (): {
|
|
17
|
+
$slots: S;
|
|
18
|
+
};
|
|
19
|
+
};
|