Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vue-i18n-routing

Package Overview
Dependencies
Maintainers
1
Versions
239
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-i18n-routing - npm Package Compare versions

Comparing version 0.0.0-5165052 to 0.0.0-05a99fc

6

dist/vue-i18n-routing.cjs.js

@@ -1,5 +0,5 @@

"use strict";var Q=Object.defineProperty,Z=Object.defineProperties;var ee=Object.getOwnPropertyDescriptors;var y=Object.getOwnPropertySymbols;var w=Object.prototype.hasOwnProperty,z=Object.prototype.propertyIsEnumerable;var C=(e,t,a)=>t in e?Q(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,P=(e,t)=>{for(var a in t||(t={}))w.call(t,a)&&C(e,a,t[a]);if(y)for(var a of y(t))z.call(t,a)&&C(e,a,t[a]);return e},O=(e,t)=>Z(e,ee(t));var X=(e,t)=>{var a={};for(var o in e)w.call(e,o)&&t.indexOf(o)<0&&(a[o]=e[o]);if(e!=null&&y)for(var o of y(e))t.indexOf(o)<0&&z.call(e,o)&&(a[o]=e[o]);return a};Object.defineProperty(exports,"__esModule",{value:!0});exports[Symbol.toStringTag]="Module";var h=require("vue-demi"),D=require("@intlify/vue-router-bridge"),te=require("@intlify/vue-i18n-bridge");function ae(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var oe=ae(D);/*!
* shared v9.2.0-beta.28
"use strict";var ce=Object.defineProperty,se=Object.defineProperties;var ue=Object.getOwnPropertyDescriptors;var F=Object.getOwnPropertySymbols;var G=Object.prototype.hasOwnProperty,H=Object.prototype.propertyIsEnumerable;var B=(e,t,a)=>t in e?ce(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,I=(e,t)=>{for(var a in t||(t={}))G.call(t,a)&&B(e,a,t[a]);if(F)for(var a of F(t))H.call(t,a)&&B(e,a,t[a]);return e},N=(e,t)=>se(e,ue(t));var W=(e,t)=>{var a={};for(var n in e)G.call(e,n)&&t.indexOf(n)<0&&(a[n]=e[n]);if(e!=null&&F)for(var n of F(e))t.indexOf(n)<0&&H.call(e,n)&&(a[n]=e[n]);return a};Object.defineProperty(exports,"__esModule",{value:!0});exports[Symbol.toStringTag]="Module";var R=require("vue-demi"),A=require("@intlify/vue-router-bridge"),Y=require("@intlify/vue-i18n-bridge");function ie(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var fe=ie(A);/*!
* shared v9.2.0-beta.30
* (c) 2022 kazuya kawaguchi
* Released under the MIT License.
*/const M=Object.assign,I=e=>typeof e=="string",le=e=>typeof e=="symbol";function ne(e){e=e||[];const t=[];for(const a of e)I(a)?t.push({code:a}):t.push(a);return t}function V(e,t){return h.isRef(e.locale)&&t==="composition"}function j(e){return"global"in e&&"mode"in e}function q(e){return j(e)?V(e.global,e.mode)?e.global.locale.value:e.global.locale:e.locale.value}function re(e,t){j(e)?V(e.global,e.mode)?e.global.locale.value=t:e.global.locale=t:h.isRef(e.locale)&&(e.locale.value=t)}function ce(e,t,a){return e.replace(/\/+$/,"")+(t?"/":"")||(a?"":"/")}function G(e){return I(e)?e:le(e)?e.toString():"(null)"}function B(e,t,{defaultLocale:a,strategy:o,routesNameSeparator:u,defaultLocaleRouteNameSuffix:i}){let s=G(e)+(o==="no_prefix"?"":u+t);return t===a&&o==="prefix_and_default"&&(s+=u+i),s}function ue(e={}){var d,L,E,p,m,_,A;const t=(d=e.i18n)!=null?d:te.useI18n(),a=(L=e.router)!=null?L:D.useRouter(),o=(E=e.route)!=null?E:D.useRoute(),u=(p=e.defaultLocaleRouteNameSuffix)!=null?p:a.__defaultLocaleRouteNameSuffix,i=(m=e.defaultLocale)!=null?m:a.__defaultLocale,s=(_=e.routesNameSeparator)!=null?_:a.__routesNameSeparator,g=(A=e.strategy)!=null?A:a.__strategy;function c(r){const f=r!=null?r:h.isRef(o)?o.value:o;return f.name?G(f.name).split(s)[0]:null}function R(r,f){const n=f||q(t);let x=r;I(r)&&(r[0]==="/"?x={path:r}:x={name:r});let S=M({},x);if(S.path&&!S.name){const v=a.resolve(S),T=h.isVue2?v.route:v,U=c(T);I(U)&&(S={name:B(U,n,{defaultLocale:i,strategy:g,routesNameSeparator:s,defaultLocaleRouteNameSuffix:u}),params:T.params,query:T.query,hash:T.hash})}else{S.name=B(S.name,n,{defaultLocale:i,strategy:g,routesNameSeparator:s,defaultLocaleRouteNameSuffix:u});const{params:v}=S;v&&v["0"]===void 0&&v.pathMatch&&(v["0"]=v.pathMatch)}const N=a.resolve(S);return(h.isVue2?N.route.name:N.name)?N:a.resolve(r)}function l(r,f){const n=R(r,f);return n==null?"":h.isVue2?n.route.redirectedFrom||n.route.fullPath:n.redirectedFrom||n.fullPath}function $(r,f){const n=R(r,f);return n==null?void 0:h.isVue2?n.route:n}function F(r,f){const n=R(r,f);return n==null?void 0:h.isVue2?n.location:n}function b(r){const f=c();if(!f)return"";const T=h.isVue2&&h.isRef(o)?o.value:o,{params:n}=T,x=X(T,["params"]),S={},N=M({},x,{name:f,params:O(P(P({},n),S),{0:n.pathMatch})}),v=l(N,r);return console.log("switchLocalePath",t.locale.value,r,v),v}return{getRouteBaseName:c,localePath:l,localeRoute:$,localeLocation:F,switchLocalePath:b}}const se={PREFIX:"prefix",PREFIX_EXCEPT_DEFAULT:"prefix_except_default",PREFIX_AND_DEFAULT:"prefix_and_default",NO_PREFIX:"no_prefix"},W="",k=se.PREFIX_EXCEPT_DEFAULT,H=!1,Y="___",J="default";function K(e,{defaultLocale:t=W,strategy:a=k,trailingSlash:o=H,routesNameSeparator:u=Y,defaultLocaleRouteNameSuffix:i=J,includeUprefixedFallback:s=!1,locales:g=[]}={}){if(a==="no_prefix")return e;const c=g.map(l=>I(l)?l:l.code);function R(l,$,F=!1,b=!1){return l.redirect&&(!l.component||!l.file)?[l]:$.reduce((L,E)=>{const{name:p}=l;let{path:m}=l;const _=P({},l);p&&(_.name=`${p}${u}${E}`),l.children&&(_.children=l.children.reduce((n,x)=>[...n,...R(x,[E],!0,b)],[]));const A=E===t;if(A&&a==="prefix_and_default")if(F)F&&b&&p&&(_.name+=`${u}${i}`);else{const n=O(P({},_),{path:m});if(p&&(n.name=`${_.name}${u}${i}`),l.children){n.children=[];for(const x of l.children)n.children=n.children.concat(R(x,[E],!0,!0))}L.push(n)}const r=F&&!m.startsWith("/"),f=!r&&!(A&&a==="prefix_except_default");return f&&(m=`/${E}${m}`),m&&(m=ce(m,o,r)),f&&A&&a==="prefix"&&s&&L.push(P({},l)),_.path=m,L.push(_),L},[])}return e.reduce((l,$)=>[...l,...R($,c||[])],[])}function fe(e,{locales:t=[]}={}){if(!V(e.global,e.mode))throw new Error("TODO:");const a=h.ref(t);e.global.locales=h.computed(()=>a.value),console.log("... extends i18n done")}function ie(e){return new RegExp(`^/(${e.join("|")})(?:/|$)`,"i")}function de(e,t,a){const o=`(${e.join("|")})`,u=`(?:${t}${a})?`,i=new RegExp(`${t}${o}${u}$`,"i"),s=ie(e);return c=>{if(c.name){const l=(I(c.name)?c.name:c.name.toString()).match(i);if(l&&l.length>1)return l[1]}else if(c.path){const R=c.path.match(s);if(R&&R.length>1)return R[1]}return""}}function me(e){var t,a,o,u,i,s,g,c;return e.version=(t=e.version)!=null?t:4,e.defaultLocale=(a=e.defaultLocale)!=null?a:W,e.strategy=(o=e.strategy)!=null?o:k,e.trailingSlash=(u=e.trailingSlash)!=null?u:H,e.routesNameSeparator=(i=e.routesNameSeparator)!=null?i:Y,e.defaultLocaleRouteNameSuffix=(s=e.defaultLocaleRouteNameSuffix)!=null?s:J,e.locales=(g=e.locales)!=null?g:[],e.routes=(c=e.routes)!=null?c:[],e}function Re(e,t={}){const{version:a,defaultLocale:o,locales:u,strategy:i,trailingSlash:s,routesNameSeparator:g,defaultLocaleRouteNameSuffix:c,routes:R}=me(t),l=ne(u),$=l.map(L=>L.code),F=de($,g,c);fe(e,{locales:l});const b=K(R,{locales:u,defaultLocale:o,strategy:i,trailingSlash:s,routesNameSeparator:g,defaultLocaleRouteNameSuffix:c});t.routes=b;let d=null;if(h.isVue3&&a===4)d=D.createRouter(t);else if(h.isVue2&&a===3)d=new oe.default(t);else throw new Error("TODO:");return d.__defaultLocale=o,d.__localeCodes=$,d.__strategy=i,d.__trailingSlash=s,d.__routesNameSeparator=g,d.__defaultLocaleRouteNameSuffix=c,d.beforeEach((L,E,p)=>{console.log("beforeEach",L,E);const m=q(e),_=F(L)||m||o||"";console.log("currentLocale",m,"finalLocale",_),m!==_&&re(e,_),p()}),console.log("create router",d),d}const _e="0.0.0";exports.VERSION=_e;exports.createRouter=Re;exports.localizeRoutes=K;exports.useI18nRouting=ue;
*/const J=Object.assign,de=Array.isArray,he=e=>typeof e=="function",P=e=>typeof e=="string",_e=e=>typeof e=="boolean",me=e=>typeof e=="symbol",Re=/\/$|\/\?/;function w(e="",t=!1){return t?Re.test(e):e.endsWith("/")}function ge(e="",t=!1){if(!t)return(w(e)?e.slice(0,-1):e)||"/";if(!w(e,!0))return e||"/";const[a,...n]=e.split("?");return(a.slice(0,-1)||"/")+(n.length?`?${n.join("?")}`:"")}function Le(e="",t=!1){if(!t)return e.endsWith("/")?e:e+"/";if(w(e,!0))return e||"/";const[a,...n]=e.split("?");return a+"/"+(n.length?`?${n.join("?")}`:"")}function Ee(e,t){typeof console!="undefined"&&(console.warn("[vue-i18n-routing] "+e),t&&console.warn(t.stack))}function K(e){e=e||[];const t=[];for(const a of e)P(a)?t.push({code:a}):t.push(a);return t}function X(e,t){return R.isRef(e.locale)&&t==="composition"}function Z(e){return"global"in e&&"mode"in e}function M(e){return Z(e)?X(e.global,e.mode)?e.global.locale.value:e.global.locale:e.locale.value}function pe(e,t){Z(e)?X(e.global,e.mode)?e.global.locale.value=t:e.global.locale=t:R.isRef(e.locale)&&(e.locale.value=t)}function ve(e,t,a){return e.replace(/\/+$/,"")+(t?"/":"")||(a?"":"/")}function ee(e){return P(e)?e:me(e)?e.toString():"(null)"}function Q(e,t,{defaultLocale:a,strategy:n,routesNameSeparator:o,defaultLocaleRouteNameSuffix:l}){let r=ee(e)+(n==="no_prefix"?"":o+t);return t===a&&n==="prefix_and_default"&&(r+=o+l),r}function Se(e,t){return he(e)?e(t):e}const D={PREFIX:"prefix",PREFIX_EXCEPT_DEFAULT:"prefix_except_default",PREFIX_AND_DEFAULT:"prefix_and_default",NO_PREFIX:"no_prefix"},x="",$=D.PREFIX_EXCEPT_DEFAULT,te=!1,b="___",q="default",Ae="ltr",ae="",ye=new Set([D.PREFIX_AND_DEFAULT,D.PREFIX_EXCEPT_DEFAULT]);function O(e=A.useRoute(),{router:t=A.useRouter(),routesNameSeparator:a=b}={}){const n=a||t.__routesNameSeparator,o=R.unref(e);return o.name?ee(o.name).split(n)[0]:null}function ne(e,t,a){const n=z(e,t,a);return n==null?"":R.isVue3?n.redirectedFrom||n.fullPath:n.route.redirectedFrom||n.route.fullPath}function le(e,t,a){const n=z(e,t,a);return n==null?void 0:R.isVue3?n:n.route}function Ie(e,t,a){const n=z(e,t,a);return n==null?void 0:R.isVue3?n:n.location}function z(e,t,{router:a=A.useRouter(),i18n:n=Y.useI18n(),defaultLocale:o=x,defaultLocaleRouteNameSuffix:l=q,routesNameSeparator:r=b,strategy:i=$,trailingSlash:f=!1}={}){const s=a.__defaultLocaleRouteNameSuffix||l,h=a.__defaultLocale||o,c=a.__routesNameSeparator||r,_=a.__strategy||i,m=t||M(n);let g=e;P(e)&&(g[0]==="/"?g={path:e}:g={name:e});let d=J({},g);if(d.path&&!d.name){const u=a.resolve(d),L=R.isVue3?u:u.route,S=O(L);P(S)?d={name:Q(S,m,{defaultLocale:h,strategy:_,routesNameSeparator:c,defaultLocaleRouteNameSuffix:s}),params:L.params,query:L.query,hash:L.hash}:(!(m===o&&ye.has(_))&&_!==D.NO_PREFIX&&(d.path=`/${m}${d.path}`),d.path=f?Le(d.path,!0):ge(d.path,!0))}else{d.name=Q(d.name,m,{defaultLocale:h,strategy:_,routesNameSeparator:c,defaultLocaleRouteNameSuffix:s});const{params:u}=d;u&&u["0"]===void 0&&u.pathMatch&&(u["0"]=u.pathMatch)}const v=a.resolve(d);return(R.isVue3?v.name:v.route.name)?v:a.resolve(e)}function C(e,t){const a=t&&t.route||A.useRoute(),n=O(a,t);if(!n)return"";const s=!R.isVue3&&R.isRef(a)?a.value:a,{params:o}=s,l=W(s,["params"]),r={},i=J({},l,{name:n,params:N(I(I({},o),r),{0:o.pathMatch})});return ne(i,e,t)}function Te({addDirAttribute:e=!1,addSeoAttributes:t=!1,strategy:a=$,defaultLocale:n=x,route:o=A.useRoute(),router:l=A.useRouter(),i18n:r=Y.useI18n()}={}){const i=n||l.__defaultLocale,f=a||l.__strategy,s=R.ref({htmlAttrs:{},link:[],meta:[]});function h(){s.value={htmlAttrs:{},link:[],meta:[]}}function c(_){const m=M(r),g=K(r.locales.value).find(u=>u.code===m)||{code:m},d=g.iso,v=g.dir||l.__defaultDirection;if(e&&(s.value.htmlAttrs.dir=v),t&&m&&r.locales){d&&(s.value.htmlAttrs.lang=d);const u=r.locales.value;Pe(u,r.__baseUrl,s.value.link,{defaultLocale:i,strategy:f,route:o,router:l,i18n:r}),De(r.__baseUrl,s.value.link,t,{route:_,router:l,i18n:r}),Fe(g,d,s.value.meta),Ne(u,d,s.value.meta)}}return R.watch(l.currentRoute,_=>{h(),c(_)}),c(o),s}function Pe(e,t,a,n){if(n.strategy===D.NO_PREFIX)return;const o=new Map;for(const l of e){const r=l.iso;if(!r){Ee("Locale ISO code is required to generate alternate link");continue}const[i,f]=r.split("-");i&&f&&(l.isCatchallLocale||!o.has(i))&&o.set(i,l),o.set(r,l)}for(const[l,r]of o.entries()){const i=C(r.code,n);i&&a.push({hid:`i18n-alt-${l}`,rel:"alternate",href:V(i,t),hreflang:l})}if(n.defaultLocale){const l=C(n.defaultLocale,n);l&&a.push({hid:"i18n-xd",rel:"alternate",href:V(l,t),hreflang:"x-default"})}}function De(e,t,a,n){const{route:o}=n,l=le(N(I({},o),{name:O(o,n)}),void 0,n);if(l){let r=V(l.path,e);const i=!_e(a)&&a.canonicalQueries||[];if(i.length){const f=l.query,s=new URLSearchParams;for(const c of i)if(c in f){const _=f[c];de(_)?_.forEach(m=>s.append(c,m||"")):s.append(c,_||"")}const h=s.toString();h&&(r=`${r}?${h}`)}t.push({hid:"i18n-can",rel:"canonical",href:r})}}function Fe(e,t,a){!(e&&t)||a.push({hid:"i18n-og",property:"og:locale",content:oe(t)})}function Ne(e,t,a){const n=e.filter(o=>{const l=o.iso;return l&&l!==t});if(n.length){const o=n.map(l=>({hid:`i18n-og-alt-${l.iso}`,property:"og:locale:alternate",content:oe(l.iso)}));a.push(...o)}}function oe(e){return(e||"").replace(/-/g,"_")}function V(e,t){return e.match(/^https?:\/\//)?e:t+e}function re(e,{defaultLocale:t=x,strategy:a=$,trailingSlash:n=te,routesNameSeparator:o=b,defaultLocaleRouteNameSuffix:l=q,includeUprefixedFallback:r=!1,optionsResolver:i=void 0,locales:f=[]}={}){if(a==="no_prefix")return e;const s=f.map(c=>P(c)?c:c.code);function h(c,_,m=!1,g=!1){if(c.redirect&&(!c.component||!c.file))return[c];let d=null;return i!=null&&(d=i(c,_),d==null)?[c]:_.reduce((u,L)=>{const{name:S}=c;let{path:E}=c;const p=I({},c);S&&(p.name=`${S}${o}${L}`),c.children&&(p.children=c.children.reduce((y,U)=>[...y,...h(U,[L],!0,g)],[]));const T=L===t;if(T&&a==="prefix_and_default")if(m)m&&g&&S&&(p.name+=`${o}${l}`);else{const y=N(I({},p),{path:E});if(S&&(y.name=`${p.name}${o}${l}`),c.children){y.children=[];for(const U of c.children)y.children=y.children.concat(h(U,[L],!0,!0))}u.push(y)}const j=m&&!E.startsWith("/"),k=!j&&!(T&&a==="prefix_except_default");return k&&(E=`/${L}${E}`),E&&(E=ve(E,n,j)),k&&T&&a==="prefix"&&r&&u.push(I({},c)),p.path=E,u.push(p),u},[])}return e.reduce((c,_)=>[...c,...h(_,s||[])],[])}function xe(e,{locales:t=[],baseUrl:a=ae}={}){if(!X(e.global,e.mode))throw new Error("TODO:");const n=R.ref(t);e.global.locales=R.computed(()=>n.value),e.global.__baseUrl=Se(a,{})}function $e(e){return new RegExp(`^/(${e.join("|")})(?:/|$)`,"i")}function be(e,t,a){const n=`(${e.join("|")})`,o=`(?:${t}${a})?`,l=new RegExp(`${t}${n}${o}$`,"i"),r=$e(e);return f=>{if(f.name){const h=(P(f.name)?f.name:f.name.toString()).match(l);if(h&&h.length>1)return h[1]}else if(f.path){const s=f.path.match(r);if(s&&s.length>1)return s[1]}return""}}function Oe(e){var t,a,n,o,l,r,i,f,s,h;return e.version=(t=e.version)!=null?t:4,e.defaultLocale=(a=e.defaultLocale)!=null?a:x,e.strategy=(n=e.strategy)!=null?n:$,e.trailingSlash=(o=e.trailingSlash)!=null?o:te,e.routesNameSeparator=(l=e.routesNameSeparator)!=null?l:b,e.defaultLocaleRouteNameSuffix=(r=e.defaultLocaleRouteNameSuffix)!=null?r:q,e.locales=(i=e.locales)!=null?i:[],e.defaultDirection=(f=e.defaultDirection)!=null?f:Ae,e.baseUrl=(s=e.baseUrl)!=null?s:ae,e.routes=(h=e.routes)!=null?h:[],e}function Ue(e,t={}){const{version:a,defaultLocale:n,locales:o,strategy:l,trailingSlash:r,routesNameSeparator:i,defaultLocaleRouteNameSuffix:f,defaultDirection:s,baseUrl:h,routes:c,routeOptionsResolver:_}=Oe(t),m=K(o),g=m.map(L=>L.code),d=be(g,i,f);xe(e,{locales:m,baseUrl:h});const v=re(c,{locales:o,defaultLocale:n,strategy:l,trailingSlash:r,routesNameSeparator:i,defaultLocaleRouteNameSuffix:f,optionsResolver:_});t.routes=v;let u=null;if(R.isVue3&&a===4)u=A.createRouter(t);else if(R.isVue2&&a===3)u=new fe.default(t);else throw new Error("TODO:");return u.__defaultLocale=n,u.__localeCodes=g,u.__strategy=l,u.__trailingSlash=r,u.__routesNameSeparator=i,u.__defaultLocaleRouteNameSuffix=f,u.__defaultDirection=s,u.beforeEach((L,S,E)=>{const p=M(e),T=d(L)||p||n||"";p!==T&&pe(e,T),E()}),u}const we="0.0.0";exports.VERSION=we;exports.createRouter=Ue;exports.getRouteBaseName=O;exports.localeLocation=Ie;exports.localePath=ne;exports.localeRoute=le;exports.localizeRoutes=re;exports.switchLocalePath=C;exports.useI18nHead=Te;

@@ -0,5 +1,6 @@

import { Composer } from '@intlify/vue-i18n-bridge';
import type { I18n } from '@intlify/vue-i18n-bridge';
import { Locale } from '@intlify/vue-i18n-bridge';
import type { Location as Location_2 } from '@intlify/vue-router-bridge';
import type { Locale } from '@intlify/vue-i18n-bridge';
import type { RawLocation } from '@intlify/vue-router-bridge';
import type { Ref } from 'vue-demi';
import type { Route as Route_2 } from '@intlify/vue-router-bridge';

@@ -12,3 +13,2 @@ import type { RouteConfig } from '@intlify/vue-router-bridge';

import type { RouterOptions } from '@intlify/vue-router-bridge';
import { useI18n } from '@intlify/vue-i18n-bridge';
import { useRoute } from '@intlify/vue-router-bridge';

@@ -18,3 +18,22 @@ import { useRouter } from '@intlify/vue-router-bridge';

export declare type BaseUrlResolveHandler = (context: unknown) => string;
export declare type ComposableOptions = {
route?: ReturnType<typeof useRoute>;
router?: ReturnType<typeof useRouter>;
i18n?: Composer;
};
/**
* Options to compute route localizing
*
* @remarks
* The route options that is compute the route to be localized on {@link localizeRoutes}
*/
export declare type ComputedRouteOptions = {
locales?: readonly string[];
paths?: Record<string, string>;
};
/**
* Create a Vue Router instance

@@ -33,2 +52,4 @@ *

* At the Vue 2 will return a [Vue Router v3 instance](https://router.vuejs.org/api/#router-construction-options), and at the Vue 3 will return a [Vue Router v4 instance](https://next.router.vuejs.org/api/#createrouter).
*
* @public
*/

@@ -42,17 +63,57 @@ export declare function createRouter<Options extends VueI18nRoutingOptions = VueI18nRoutingOptions>(i18n: I18n, options?: Options): Options['version'] extends 4 ? Router : VueRouter;

export declare interface I18nRouting {
getRouteBaseName(givenRoute?: Route_2 | RouteLocationNormalizedLoaded): string | null;
localePath(route: RawLocation | RouteLocationRaw, locale?: Locale): string;
localeRoute(route: RawLocation | RouteLocationRaw, locale?: Locale): Route_2 | ReturnType<Router['resolve']>;
localeLocation(route: RawLocation | RouteLocationRaw, locale?: Locale): Location_2 | RouteLocation;
switchLocalePath(locale: Locale): void;
/**
* Get route base name
*
* @param givenRoute - A route object, if not provided, the route is returned with `useRoute` will be used
* @param options - An options, see about details {@link I18nRoutingOptions}
*
* @returns The route base name, if route name is not defined, return null
*/
export declare function getRouteBaseName(givenRoute?: Route_2 | RouteLocationNormalizedLoaded, { router, routesNameSeparator }?: I18nRoutingOptions): string | null;
/**
* I18n header meta info
*/
export declare interface I18nHeadMetaInfo {
htmlAttrs?: MetaAttrs;
meta?: MetaAttrs[];
link?: MetaAttrs[];
}
export declare type I18nRoutingOptions = Pick<VueI18nRoutingOptions, 'defaultLocale' | 'strategy' | 'defaultLocaleRouteNameSuffix' | 'trailingSlash' | 'locales' | 'routesNameSeparator'> & {
route?: ReturnType<typeof useRoute>;
router?: ReturnType<typeof useRouter>;
i18n?: ReturnType<typeof useI18n>;
};
/**
* Options for {@link useI18nHead} function
*/
export declare interface I18nHeadOptions {
/**
* Adds a `dir` attribute to the HTML element.
*
* @defaultValue false
*/
addDirAttribute?: boolean;
/**
* Adds various SEO attributes.
*
* @defaultValue false
*/
addSeoAttributes?: boolean | SeoAttributesOptions;
}
/**
* Options for vue-i18n-routing common
*/
export declare type I18nRoutingOptions = Pick<VueI18nRoutingOptions, 'defaultLocale' | 'strategy' | 'defaultLocaleRouteNameSuffix' | 'trailingSlash' | 'locales' | 'routesNameSeparator'> & ComposableOptions;
/**
* Resolve locale location
*
* @param route - A route location. The path or name of the route or an object for more complex routes
* @param locale - A locale code, if not specified, uses the current locale
* @param options - An options, see about details {@link I18nRoutingOptions}
*
* @returns Returns the location object for a given route, the location object is resolved by vue-router rather than just a full route path.
*/
export declare function localeLocation(route: RawLocation | RouteLocationRaw, locale?: Locale, // TODO: locale should be more type inference (completion)
options?: I18nRoutingOptions): Location | RouteLocation | undefined;
/**
* Locale object

@@ -70,6 +131,43 @@ */

export declare function localizeRoutes(routes: VueI18nRoute[], { defaultLocale, strategy, trailingSlash, routesNameSeparator, defaultLocaleRouteNameSuffix, includeUprefixedFallback, locales }?: Pick<VueI18nRoutingOptions, 'defaultLocale' | 'strategy' | 'locales' | 'routesNameSeparator' | 'trailingSlash' | 'defaultLocaleRouteNameSuffix'> & {
/**
* Resolve locale path
*
* @param route - A route location. The path or name of the route or an object for more complex routes
* @param locale - A locale code, if not specified, uses the current locale
* @param options - An options, see about details {@link I18nRoutingOptions}
*
* @returns Returns the localized URL for a given route
*/
export declare function localePath(route: RawLocation | RouteLocationRaw, locale?: Locale, // TODO: locale should be more type inference (completion)
options?: I18nRoutingOptions): string;
/**
* Resolve locale route
*
* @param route - A route location. The path or name of the route or an object for more complex routes
* @param locale - A locale code, if not specified, uses the current locale
* @param options - An options, see about details {@link I18nRoutingOptions}
*
* @returns Returns the route object for a given route, the route object is resolved by vue-router rather than just a full route path.
*/
export declare function localeRoute(route: RawLocation | RouteLocationRaw, locale?: Locale, // TODO: locale should be more type inference (completion)
options?: I18nRoutingOptions): Route_2 | ReturnType<Router['resolve']> | undefined;
/**
* Localize routes
*
* @param routes - Some routes
* @param options - An options
*
* @returns Localized routes
*
* @public
*/
export declare function localizeRoutes(routes: VueI18nRoute[], { defaultLocale, strategy, trailingSlash, routesNameSeparator, defaultLocaleRouteNameSuffix, includeUprefixedFallback, optionsResolver, locales }?: Pick<VueI18nRoutingOptions, 'defaultLocale' | 'strategy' | 'locales' | 'routesNameSeparator' | 'trailingSlash' | 'defaultLocaleRouteNameSuffix'> & {
includeUprefixedFallback?: boolean;
optionsResolver?: RouteOptionsResolver;
}): VueI18nRoute[];
export declare type MetaAttrs = Record<string, any>;
/**

@@ -97,2 +195,19 @@ * Route config for vue-router v4

/**
* Resolver for route localizing options
*/
export declare type RouteOptionsResolver = (route: VueI18nRoute, allowedLocaleCodes: string[]) => ComputedRouteOptions | null;
/**
* SEO Attribute options
*/
export declare interface SeoAttributesOptions {
/**
* An array of strings corresponding to query params you would like to include in your canonical URL.
*
* @defaultValue []
*/
canonicalQueries?: string[];
}
declare const STRATEGIES: {

@@ -110,5 +225,22 @@ readonly PREFIX: "prefix";

/**
* Switch locale path
*
* @param locale - A locale code, if not specified, uses the current locale
* @param options - An options, see about details {@link I18nRoutingOptions}
*
* @returns Returns a link to the current route in another language
*/
export declare function switchLocalePath(locale: Locale, options?: I18nRoutingOptions): string;
declare type UnionToIntersection<T> = (T extends any ? (k: T) => void : never) extends (k: infer U) => void ? U : never;
export declare function useI18nRouting(options?: I18nRoutingOptions): I18nRouting;
/**
* Generate SEO head meta information
*
* @param options - An options, see about details {@link I18nHeadOptions}
*
* @returns Genereated SEO head meta information
*/
export declare function useI18nHead({ addDirAttribute, addSeoAttributes, strategy, defaultLocale, route, router, i18n }?: Pick<I18nRoutingOptions, 'strategy' | 'defaultLocale'> & ComposableOptions & I18nHeadOptions): Ref<I18nHeadMetaInfo>;

@@ -136,3 +268,3 @@ /**

*/
export declare type VueI18nRoutingOptions = {
export declare type VueI18nRoutingOptions<BaseUrl extends BaseUrlResolveHandler = BaseUrlResolveHandler> = {
/**

@@ -203,2 +335,27 @@ * Vue Router version

defaultLocaleRouteNameSuffix?: string;
/**
* Default direction direction
*
* @defaultValue 'ltr'
*/
defaultDirection?: Directions;
/**
* The fallback base URL to use as a prefix for alternate URLs in hreflang tags.
*
* @remarks
* By default VueRouter's base URL will be used and only if that is not available, fallback URL will be used.
*
* Can also be a function (will be passed a Nuxt Context as a parameter) that returns a string.
*
* Useful to make base URL dynamic based on request headers.
*
* @defaultValue ''
*/
baseUrl?: string | BaseUrl;
/**
* Route options resolver
*
* @defaultValue undefined
*/
routeOptionsResolver?: RouteOptionsResolver;
} & RouterOptions;

@@ -210,3 +367,4 @@

export interface ComposerCustom {
locales: ComputedRef<LocaleObject[]>
locales: ComputedRef<string[] | LocaleObject[]>
__baseUrl: string
}

@@ -216,4 +374,5 @@ }

export interface ComposerCustom {
locales: ComputedRef<LocaleObject[]>
locales: ComputedRef<string[] | LocaleObject[]>
__baseUrl: string
}
}

@@ -32,7 +32,7 @@ var __defProp = Object.defineProperty;

};
import { isRef, isVue2, ref, computed, isVue3 } from "vue-demi";
import VueRouter3, { useRouter, useRoute, createRouter as createRouter$1 } from "@intlify/vue-router-bridge";
import { isRef, unref, isVue3, ref, watch, computed, isVue2 } from "vue-demi";
import VueRouter3, { useRoute, useRouter, createRouter as createRouter$1 } from "@intlify/vue-router-bridge";
import { useI18n } from "@intlify/vue-i18n-bridge";
/*!
* shared v9.2.0-beta.28
* shared v9.2.0-beta.30
* (c) 2022 kazuya kawaguchi

@@ -42,4 +42,42 @@ * Released under the MIT License.

const assign = Object.assign;
const isArray = Array.isArray;
const isFunction = (val) => typeof val === "function";
const isString = (val) => typeof val === "string";
const isBoolean = (val) => typeof val === "boolean";
const isSymbol = (val) => typeof val === "symbol";
const TRAILING_SLASH_RE = /\/$|\/\?/;
function hasTrailingSlash(input = "", queryParams = false) {
if (!queryParams) {
return input.endsWith("/");
}
return TRAILING_SLASH_RE.test(input);
}
function withoutTrailingSlash(input = "", queryParams = false) {
if (!queryParams) {
return (hasTrailingSlash(input) ? input.slice(0, -1) : input) || "/";
}
if (!hasTrailingSlash(input, true)) {
return input || "/";
}
const [s0, ...s] = input.split("?");
return (s0.slice(0, -1) || "/") + (s.length ? `?${s.join("?")}` : "");
}
function withTrailingSlash(input = "", queryParams = false) {
if (!queryParams) {
return input.endsWith("/") ? input : input + "/";
}
if (hasTrailingSlash(input, true)) {
return input || "/";
}
const [s0, ...s] = input.split("?");
return s0 + "/" + (s.length ? `?${s.join("?")}` : "");
}
function warn(msg, err) {
if (typeof console !== "undefined") {
console.warn(`[vue-i18n-routing] ` + msg);
if (err) {
console.warn(err.stack);
}
}
}
function getNormalizedLocales(locales) {

@@ -95,113 +133,289 @@ locales = locales || [];

}
function useI18nRouting(options = {}) {
var _a, _b, _c, _d, _e, _f, _g;
const $i18n = (_a = options.i18n) != null ? _a : useI18n();
const $router = (_b = options.router) != null ? _b : useRouter();
const $route = (_c = options.route) != null ? _c : useRoute();
const defaultLocaleRouteNameSuffix = (_d = options.defaultLocaleRouteNameSuffix) != null ? _d : $router.__defaultLocaleRouteNameSuffix;
const defaultLocale = (_e = options.defaultLocale) != null ? _e : $router.__defaultLocale;
const routesNameSeparator = (_f = options.routesNameSeparator) != null ? _f : $router.__routesNameSeparator;
const strategy = (_g = options.strategy) != null ? _g : $router.__strategy;
function getRouteBaseName(givenRoute) {
const route = givenRoute != null ? givenRoute : isRef($route) ? $route.value : $route;
if (!route.name) {
return null;
function resolveBaseUrl(baseUrl, context) {
if (isFunction(baseUrl)) {
return baseUrl(context);
}
return baseUrl;
}
const STRATEGIES = {
PREFIX: "prefix",
PREFIX_EXCEPT_DEFAULT: "prefix_except_default",
PREFIX_AND_DEFAULT: "prefix_and_default",
NO_PREFIX: "no_prefix"
};
const DEFAULT_LOCALE = "";
const DEFAULT_STRATEGY = STRATEGIES.PREFIX_EXCEPT_DEFAULT;
const DEFAULT_TRAILING_SLASH = false;
const DEFAULT_ROUTES_NAME_SEPARATOR = "___";
const DEFAULT_LOCALE_ROUTE_NAME_SUFFIX = "default";
const DEFAULT_DETECTION_DIRECTION = "ltr";
const DEFAULT_BASE_URL = "";
const RESOLVED_PREFIXED = /* @__PURE__ */ new Set([STRATEGIES.PREFIX_AND_DEFAULT, STRATEGIES.PREFIX_EXCEPT_DEFAULT]);
function getRouteBaseName(givenRoute = useRoute(), { router = useRouter(), routesNameSeparator = DEFAULT_ROUTES_NAME_SEPARATOR } = {}) {
const _routesNameSeparator = routesNameSeparator || router.__routesNameSeparator;
const _route = unref(givenRoute);
if (!_route.name) {
return null;
}
const name = getRouteName(_route.name);
return name.split(_routesNameSeparator)[0];
}
function localePath(route, locale, options) {
const localizedRoute = resolveRoute(route, locale, options);
return localizedRoute == null ? "" : isVue3 ? localizedRoute.redirectedFrom || localizedRoute.fullPath : localizedRoute.route.redirectedFrom || localizedRoute.route.fullPath;
}
function localeRoute(route, locale, options) {
const resolved = resolveRoute(route, locale, options);
return resolved == null ? void 0 : isVue3 ? resolved : resolved.route;
}
function localeLocation(route, locale, options) {
const resolved = resolveRoute(route, locale, options);
return resolved == null ? void 0 : isVue3 ? resolved : resolved.location;
}
function resolveRoute(route, locale, {
router = useRouter(),
i18n = useI18n(),
defaultLocale = DEFAULT_LOCALE,
defaultLocaleRouteNameSuffix = DEFAULT_LOCALE_ROUTE_NAME_SUFFIX,
routesNameSeparator = DEFAULT_ROUTES_NAME_SEPARATOR,
strategy = DEFAULT_STRATEGY,
trailingSlash = false
} = {}) {
const _defaultLocaleRouteNameSuffix = router.__defaultLocaleRouteNameSuffix || defaultLocaleRouteNameSuffix;
const _defaultLocale = router.__defaultLocale || defaultLocale;
const _routesNameSeparator = router.__routesNameSeparator || routesNameSeparator;
const _strategy = router.__strategy || strategy;
const _locale = locale || getLocale(i18n);
let _route = route;
if (isString(route)) {
if (_route[0] === "/") {
_route = { path: route };
} else {
_route = { name: route };
}
const name = getRouteName(route.name);
return name.split(routesNameSeparator)[0];
}
function resolveRoute(route, locale) {
const _locale = locale || getLocale($i18n);
let _route = route;
if (isString(route)) {
if (route[0] === "/") {
_route = { path: route };
} else {
_route = { name: route };
let localizedRoute = assign({}, _route);
if (localizedRoute.path && !localizedRoute.name) {
const _resolvedRoute = router.resolve(localizedRoute);
const resolvedRoute2 = isVue3 ? _resolvedRoute : _resolvedRoute.route;
const resolvedRouteName = getRouteBaseName(resolvedRoute2);
if (isString(resolvedRouteName)) {
localizedRoute = {
name: getLocaleRouteName(resolvedRouteName, _locale, {
defaultLocale: _defaultLocale,
strategy: _strategy,
routesNameSeparator: _routesNameSeparator,
defaultLocaleRouteNameSuffix: _defaultLocaleRouteNameSuffix
}),
params: resolvedRoute2.params,
query: resolvedRoute2.query,
hash: resolvedRoute2.hash
};
} else {
const isDefaultLocale = _locale === defaultLocale;
const isPrefixed = !(isDefaultLocale && RESOLVED_PREFIXED.has(_strategy)) && !(_strategy === STRATEGIES.NO_PREFIX);
if (isPrefixed) {
localizedRoute.path = `/${_locale}${localizedRoute.path}`;
}
localizedRoute.path = trailingSlash ? withTrailingSlash(localizedRoute.path, true) : withoutTrailingSlash(localizedRoute.path, true);
}
let localizedRoute = assign({}, _route);
if (localizedRoute.path && !localizedRoute.name) {
const _resolvedRoute = $router.resolve(localizedRoute);
const resolvedRoute2 = !isVue2 ? _resolvedRoute : _resolvedRoute.route;
const resolvedRouteName = getRouteBaseName(resolvedRoute2);
if (isString(resolvedRouteName)) {
localizedRoute = {
name: getLocaleRouteName(resolvedRouteName, _locale, {
defaultLocale,
strategy,
routesNameSeparator,
defaultLocaleRouteNameSuffix
}),
params: resolvedRoute2.params,
query: resolvedRoute2.query,
hash: resolvedRoute2.hash
};
} else {
localizedRoute.name = getLocaleRouteName(localizedRoute.name, _locale, {
defaultLocale: _defaultLocale,
strategy: _strategy,
routesNameSeparator: _routesNameSeparator,
defaultLocaleRouteNameSuffix: _defaultLocaleRouteNameSuffix
});
const { params } = localizedRoute;
if (params && params["0"] === void 0 && params.pathMatch) {
params["0"] = params.pathMatch;
}
}
const resolvedRoute = router.resolve(localizedRoute);
if (isVue3 ? resolvedRoute.name : resolvedRoute.route.name) {
return resolvedRoute;
}
return router.resolve(route);
}
function switchLocalePath(locale, options) {
const route = options && options.route || useRoute();
const name = getRouteBaseName(route, options);
if (!name) {
return "";
}
const _a = !isVue3 && isRef(route) ? route.value : route, { params } = _a, routeCopy = __objRest(_a, ["params"]);
const langSwitchParams = {};
const baseRoute = assign({}, routeCopy, {
name,
params: __spreadProps(__spreadValues(__spreadValues({}, params), langSwitchParams), {
0: params.pathMatch
})
});
const path = localePath(baseRoute, locale, options);
return path;
}
function useI18nHead({
addDirAttribute = false,
addSeoAttributes = false,
strategy = DEFAULT_STRATEGY,
defaultLocale = DEFAULT_LOCALE,
route = useRoute(),
router = useRouter(),
i18n = useI18n()
} = {}) {
const _defaultLocale = defaultLocale || router.__defaultLocale;
const _strategy = strategy || router.__strategy;
const metaObject = ref({
htmlAttrs: {},
link: [],
meta: []
});
function cleanMeta() {
metaObject.value = {
htmlAttrs: {},
link: [],
meta: []
};
}
function updateMeta(_route) {
const locale = getLocale(i18n);
const currentLocale = getNormalizedLocales(i18n.locales.value).find((l) => l.code === locale) || {
code: locale
};
const currentLocaleIso = currentLocale.iso;
const currentLocaleDir = currentLocale.dir || router.__defaultDirection;
if (addDirAttribute) {
metaObject.value.htmlAttrs.dir = currentLocaleDir;
}
if (addSeoAttributes && locale && i18n.locales) {
if (currentLocaleIso) {
metaObject.value.htmlAttrs.lang = currentLocaleIso;
}
} else {
localizedRoute.name = getLocaleRouteName(localizedRoute.name, _locale, {
defaultLocale,
strategy,
routesNameSeparator,
defaultLocaleRouteNameSuffix
const locales = i18n.locales.value;
addHreflangLinks(locales, i18n.__baseUrl, metaObject.value.link, {
defaultLocale: _defaultLocale,
strategy: _strategy,
route,
router,
i18n
});
const { params } = localizedRoute;
if (params && params["0"] === void 0 && params.pathMatch) {
params["0"] = params.pathMatch;
}
addCanonicalLinks(i18n.__baseUrl, metaObject.value.link, addSeoAttributes, { route: _route, router, i18n });
addCurrentOgLocale(currentLocale, currentLocaleIso, metaObject.value.meta);
addAlternateOgLocales(locales, currentLocaleIso, metaObject.value.meta);
}
const resolvedRoute = $router.resolve(localizedRoute);
if (isVue2 ? resolvedRoute.route.name : resolvedRoute.name) {
return resolvedRoute;
}
return $router.resolve(route);
}
function localePath(route, locale) {
const localizedRoute = resolveRoute(route, locale);
return localizedRoute == null ? "" : isVue2 ? localizedRoute.route.redirectedFrom || localizedRoute.route.fullPath : localizedRoute.redirectedFrom || localizedRoute.fullPath;
watch(router.currentRoute, (val) => {
cleanMeta();
updateMeta(val);
});
updateMeta(route);
return metaObject;
}
function addHreflangLinks(locales, baseUrl, link, options) {
if (options.strategy === STRATEGIES.NO_PREFIX) {
return;
}
function localeRoute(route, locale) {
const resolved = resolveRoute(route, locale);
return resolved == null ? void 0 : isVue2 ? resolved.route : resolved;
const localeMap = /* @__PURE__ */ new Map();
for (const locale of locales) {
const localeIso = locale.iso;
if (!localeIso) {
warn("Locale ISO code is required to generate alternate link");
continue;
}
const [language, region] = localeIso.split("-");
if (language && region && (locale.isCatchallLocale || !localeMap.has(language))) {
localeMap.set(language, locale);
}
localeMap.set(localeIso, locale);
}
function localeLocation(route, locale) {
const resolved = resolveRoute(route, locale);
return resolved == null ? void 0 : isVue2 ? resolved.location : resolved;
for (const [iso, mapLocale] of localeMap.entries()) {
const localePath2 = switchLocalePath(mapLocale.code, options);
if (localePath2) {
link.push({
hid: `i18n-alt-${iso}`,
rel: "alternate",
href: toAbsoluteUrl(localePath2, baseUrl),
hreflang: iso
});
}
}
function switchLocalePath(locale) {
const name = getRouteBaseName();
if (!name) {
return "";
if (options.defaultLocale) {
const localePath2 = switchLocalePath(options.defaultLocale, options);
if (localePath2) {
link.push({
hid: "i18n-xd",
rel: "alternate",
href: toAbsoluteUrl(localePath2, baseUrl),
hreflang: "x-default"
});
}
const _a2 = isVue2 && isRef($route) ? $route.value : $route, { params } = _a2, routeCopy = __objRest(_a2, ["params"]);
const langSwitchParams = {};
const baseRoute = assign({}, routeCopy, {
name,
params: __spreadProps(__spreadValues(__spreadValues({}, params), langSwitchParams), {
0: params.pathMatch
})
}
}
function addCanonicalLinks(baseUrl, link, seoAttributesOptions, options) {
const { route } = options;
const currentRoute = localeRoute(__spreadProps(__spreadValues({}, route), {
name: getRouteBaseName(route, options)
}), void 0, options);
if (currentRoute) {
let href = toAbsoluteUrl(currentRoute.path, baseUrl);
const canonicalQueries = !isBoolean(seoAttributesOptions) && seoAttributesOptions.canonicalQueries || [];
if (canonicalQueries.length) {
const currentRouteQueryParams = currentRoute.query;
const params = new URLSearchParams();
for (const queryParamName of canonicalQueries) {
if (queryParamName in currentRouteQueryParams) {
const queryParamValue = currentRouteQueryParams[queryParamName];
if (isArray(queryParamValue)) {
queryParamValue.forEach((v) => params.append(queryParamName, v || ""));
} else {
params.append(queryParamName, queryParamValue || "");
}
}
}
const queryString = params.toString();
if (queryString) {
href = `${href}?${queryString}`;
}
}
link.push({
hid: "i18n-can",
rel: "canonical",
href
});
const path = localePath(baseRoute, locale);
console.log("switchLocalePath", $i18n.locale.value, locale, path);
return path;
}
return {
getRouteBaseName,
localePath,
localeRoute,
localeLocation,
switchLocalePath
};
}
const STRATEGIES = {
PREFIX: "prefix",
PREFIX_EXCEPT_DEFAULT: "prefix_except_default",
PREFIX_AND_DEFAULT: "prefix_and_default",
NO_PREFIX: "no_prefix"
};
const DEFAULT_LOCALE = "";
const DEFAULT_STRATEGY = STRATEGIES.PREFIX_EXCEPT_DEFAULT;
const DEFAULT_TRAILING_SLASH = false;
const DEFAULT_ROUTES_NAME_SEPARATOR = "___";
const DEFAULT_LOCALE_ROUTE_NAME_SUFFIX = "default";
function addCurrentOgLocale(currentLocale, currentLocaleIso, meta) {
const hasCurrentLocaleAndIso = currentLocale && currentLocaleIso;
if (!hasCurrentLocaleAndIso) {
return;
}
meta.push({
hid: "i18n-og",
property: "og:locale",
content: hypenToUnderscore(currentLocaleIso)
});
}
function addAlternateOgLocales(locales, currentLocaleIso, meta) {
const localesWithoutCurrent = locales.filter((locale) => {
const localeIso = locale.iso;
return localeIso && localeIso !== currentLocaleIso;
});
if (localesWithoutCurrent.length) {
const alternateLocales = localesWithoutCurrent.map((locale) => ({
hid: `i18n-og-alt-${locale.iso}`,
property: "og:locale:alternate",
content: hypenToUnderscore(locale.iso)
}));
meta.push(...alternateLocales);
}
}
function hypenToUnderscore(str) {
return (str || "").replace(/-/g, "_");
}
function toAbsoluteUrl(urlOrPath, baseUrl) {
if (urlOrPath.match(/^https?:\/\//)) {
return urlOrPath;
}
return baseUrl + urlOrPath;
}
function localizeRoutes(routes, {

@@ -214,2 +428,3 @@ defaultLocale = DEFAULT_LOCALE,

includeUprefixedFallback = false,
optionsResolver = void 0,
locales = []

@@ -225,2 +440,9 @@ } = {}) {

}
let routeOptions = null;
if (optionsResolver != null) {
routeOptions = optionsResolver(route, allowedLocaleCodes);
if (routeOptions == null) {
return [route];
}
}
const targetLocales = allowedLocaleCodes;

@@ -273,3 +495,3 @@ return targetLocales.reduce((_routes, locale) => {

}
function extendI18n(i18n, { locales = [] } = {}) {
function extendI18n(i18n, { locales = [], baseUrl = DEFAULT_BASE_URL } = {}) {
if (!isComposer(i18n.global, i18n.mode)) {

@@ -280,3 +502,3 @@ throw new Error("TODO:");

i18n.global.locales = computed(() => _locales.value);
console.log("... extends i18n done");
i18n.global.__baseUrl = resolveBaseUrl(baseUrl, {});
}

@@ -309,3 +531,3 @@ function getLocalesRegex(localeCodes) {

function asDefaultVueI18nRouterOptions(options) {
var _a, _b, _c, _d, _e, _f, _g, _h;
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
options.version = (_a = options.version) != null ? _a : 4;

@@ -318,3 +540,5 @@ options.defaultLocale = (_b = options.defaultLocale) != null ? _b : DEFAULT_LOCALE;

options.locales = (_g = options.locales) != null ? _g : [];
options.routes = (_h = options.routes) != null ? _h : [];
options.defaultDirection = (_h = options.defaultDirection) != null ? _h : DEFAULT_DETECTION_DIRECTION;
options.baseUrl = (_i = options.baseUrl) != null ? _i : DEFAULT_BASE_URL;
options.routes = (_j = options.routes) != null ? _j : [];
return options;

@@ -331,3 +555,6 @@ }

defaultLocaleRouteNameSuffix,
routes
defaultDirection,
baseUrl,
routes,
routeOptionsResolver: optionsResolver
} = asDefaultVueI18nRouterOptions(options);

@@ -337,3 +564,3 @@ const normalizedLocaleCodes = getNormalizedLocales(locales);

const getLocaleFromRoute = createLocaleFromRouteGetter(localeCodes, routesNameSeparator, defaultLocaleRouteNameSuffix);
extendI18n(i18n, { locales: normalizedLocaleCodes });
extendI18n(i18n, { locales: normalizedLocaleCodes, baseUrl });
const localizedRoutes = localizeRoutes(routes, {

@@ -345,3 +572,4 @@ locales,

routesNameSeparator,
defaultLocaleRouteNameSuffix
defaultLocaleRouteNameSuffix,
optionsResolver
});

@@ -363,7 +591,6 @@ options.routes = localizedRoutes;

router.__defaultLocaleRouteNameSuffix = defaultLocaleRouteNameSuffix;
router.__defaultDirection = defaultDirection;
router.beforeEach((to, from, next) => {
console.log("beforeEach", to, from);
const currentLocale = getLocale(i18n);
const finalLocale = getLocaleFromRoute(to) || currentLocale || defaultLocale || "";
console.log("currentLocale", currentLocale, "finalLocale", finalLocale);
if (currentLocale !== finalLocale) {

@@ -374,6 +601,5 @@ setLocale(i18n, finalLocale);

});
console.log("create router", router);
return router;
}
const VERSION = "0.0.0";
export { VERSION, createRouter, localizeRoutes, useI18nRouting };
export { VERSION, createRouter, getRouteBaseName, localeLocation, localePath, localeRoute, localizeRoutes, switchLocalePath, useI18nHead };

@@ -1,5 +0,5 @@

var he=Object.defineProperty,Re=Object.defineProperties;var me=Object.getOwnPropertyDescriptors;var U=Object.getOwnPropertySymbols;var J=Object.prototype.hasOwnProperty,K=Object.prototype.propertyIsEnumerable;var Q=(c,a,s)=>a in c?he(c,a,{enumerable:!0,configurable:!0,writable:!0,value:s}):c[a]=s,y=(c,a)=>{for(var s in a||(a={}))J.call(a,s)&&Q(c,s,a[s]);if(U)for(var s of U(a))K.call(a,s)&&Q(c,s,a[s]);return c},z=(c,a)=>Re(c,me(a));var Z=(c,a)=>{var s={};for(var p in c)J.call(c,p)&&a.indexOf(p)<0&&(s[p]=c[p]);if(c!=null&&U)for(var p of U(c))a.indexOf(p)<0&&K.call(c,p)&&(s[p]=c[p]);return s};var VueI18nRouting=function(c,a,s,p){"use strict";function ee(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var te=ee(s);/*!
* shared v9.2.0-beta.28
var we=Object.defineProperty,De=Object.defineProperties;var Ce=Object.getOwnPropertyDescriptors;var w=Object.getOwnPropertySymbols;var oe=Object.prototype.hasOwnProperty,ce=Object.prototype.propertyIsEnumerable;var le=(u,s,_)=>s in u?we(u,s,{enumerable:!0,configurable:!0,writable:!0,value:_}):u[s]=_,F=(u,s)=>{for(var _ in s||(s={}))oe.call(s,_)&&le(u,_,s[_]);if(w)for(var _ of w(s))ce.call(s,_)&&le(u,_,s[_]);return u},D=(u,s)=>De(u,Ce(s));var re=(u,s)=>{var _={};for(var p in u)oe.call(u,p)&&s.indexOf(p)<0&&(_[p]=u[p]);if(u!=null&&w)for(var p of w(u))s.indexOf(p)<0&&ce.call(u,p)&&(_[p]=u[p]);return _};var VueI18nRouting=function(u,s,_,p){"use strict";function se(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var ue=se(_);/*!
* shared v9.2.0-beta.30
* (c) 2022 kazuya kawaguchi
* Released under the MIT License.
*/const C=Object.assign,b=e=>typeof e=="string",ae=e=>typeof e=="symbol";function oe(e){e=e||[];const t=[];for(const o of e)b(o)?t.push({code:o}):t.push(o);return t}function w(e,t){return a.isRef(e.locale)&&t==="composition"}function X(e){return"global"in e&&"mode"in e}function M(e){return X(e)?w(e.global,e.mode)?e.global.locale.value:e.global.locale:e.locale.value}function le(e,t){X(e)?w(e.global,e.mode)?e.global.locale.value=t:e.global.locale=t:a.isRef(e.locale)&&(e.locale.value=t)}function ne(e,t,o){return e.replace(/\/+$/,"")+(t?"/":"")||(o?"":"/")}function j(e){return b(e)?e:ae(e)?e.toString():"(null)"}function G(e,t,{defaultLocale:o,strategy:u,routesNameSeparator:i,defaultLocaleRouteNameSuffix:h}){let d=j(e)+(u==="no_prefix"?"":i+t);return t===o&&u==="prefix_and_default"&&(d+=i+h),d}function ce(e={}){var R,S,F,x,m,L,v;const t=(R=e.i18n)!=null?R:p.useI18n(),o=(S=e.router)!=null?S:s.useRouter(),u=(F=e.route)!=null?F:s.useRoute(),i=(x=e.defaultLocaleRouteNameSuffix)!=null?x:o.__defaultLocaleRouteNameSuffix,h=(m=e.defaultLocale)!=null?m:o.__defaultLocale,d=(L=e.routesNameSeparator)!=null?L:o.__routesNameSeparator,E=(v=e.strategy)!=null?v:o.__strategy;function f(r){const _=r!=null?r:a.isRef(u)?u.value:u;return _.name?j(_.name).split(d)[0]:null}function g(r,_){const n=_||M(t);let A=r;b(r)&&(r[0]==="/"?A={path:r}:A={name:r});let T=C({},A);if(T.path&&!T.name){const $=o.resolve(T),N=a.isVue2?$.route:$,Y=f(N);b(Y)&&(T={name:G(Y,n,{defaultLocale:h,strategy:E,routesNameSeparator:d,defaultLocaleRouteNameSuffix:i}),params:N.params,query:N.query,hash:N.hash})}else{T.name=G(T.name,n,{defaultLocale:h,strategy:E,routesNameSeparator:d,defaultLocaleRouteNameSuffix:i});const{params:$}=T;$&&$["0"]===void 0&&$.pathMatch&&($["0"]=$.pathMatch)}const V=o.resolve(T);return(a.isVue2?V.route.name:V.name)?V:o.resolve(r)}function l(r,_){const n=g(r,_);return n==null?"":a.isVue2?n.route.redirectedFrom||n.route.fullPath:n.redirectedFrom||n.fullPath}function I(r,_){const n=g(r,_);return n==null?void 0:a.isVue2?n.route:n}function P(r,_){const n=g(r,_);return n==null?void 0:a.isVue2?n.location:n}function O(r){const _=f();if(!_)return"";const N=a.isVue2&&a.isRef(u)?u.value:u,{params:n}=N,A=Z(N,["params"]),T={},V=C({},A,{name:_,params:z(y(y({},n),T),{0:n.pathMatch})}),$=l(V,r);return console.log("switchLocalePath",t.locale.value,r,$),$}return{getRouteBaseName:f,localePath:l,localeRoute:I,localeLocation:P,switchLocalePath:O}}const re={PREFIX:"prefix",PREFIX_EXCEPT_DEFAULT:"prefix_except_default",PREFIX_AND_DEFAULT:"prefix_and_default",NO_PREFIX:"no_prefix"},q="",D=re.PREFIX_EXCEPT_DEFAULT,W=!1,k="___",B="default";function H(e,{defaultLocale:t=q,strategy:o=D,trailingSlash:u=W,routesNameSeparator:i=k,defaultLocaleRouteNameSuffix:h=B,includeUprefixedFallback:d=!1,locales:E=[]}={}){if(o==="no_prefix")return e;const f=E.map(l=>b(l)?l:l.code);function g(l,I,P=!1,O=!1){return l.redirect&&(!l.component||!l.file)?[l]:I.reduce((S,F)=>{const{name:x}=l;let{path:m}=l;const L=y({},l);x&&(L.name=`${x}${i}${F}`),l.children&&(L.children=l.children.reduce((n,A)=>[...n,...g(A,[F],!0,O)],[]));const v=F===t;if(v&&o==="prefix_and_default")if(P)P&&O&&x&&(L.name+=`${i}${h}`);else{const n=z(y({},L),{path:m});if(x&&(n.name=`${L.name}${i}${h}`),l.children){n.children=[];for(const A of l.children)n.children=n.children.concat(g(A,[F],!0,!0))}S.push(n)}const r=P&&!m.startsWith("/"),_=!r&&!(v&&o==="prefix_except_default");return _&&(m=`/${F}${m}`),m&&(m=ne(m,u,r)),_&&v&&o==="prefix"&&d&&S.push(y({},l)),L.path=m,S.push(L),S},[])}return e.reduce((l,I)=>[...l,...g(I,f||[])],[])}function ue(e,{locales:t=[]}={}){if(!w(e.global,e.mode))throw new Error("TODO:");const o=a.ref(t);e.global.locales=a.computed(()=>o.value),console.log("... extends i18n done")}function se(e){return new RegExp(`^/(${e.join("|")})(?:/|$)`,"i")}function fe(e,t,o){const u=`(${e.join("|")})`,i=`(?:${t}${o})?`,h=new RegExp(`${t}${u}${i}$`,"i"),d=se(e);return f=>{if(f.name){const l=(b(f.name)?f.name:f.name.toString()).match(h);if(l&&l.length>1)return l[1]}else if(f.path){const g=f.path.match(d);if(g&&g.length>1)return g[1]}return""}}function ie(e){var t,o,u,i,h,d,E,f;return e.version=(t=e.version)!=null?t:4,e.defaultLocale=(o=e.defaultLocale)!=null?o:q,e.strategy=(u=e.strategy)!=null?u:D,e.trailingSlash=(i=e.trailingSlash)!=null?i:W,e.routesNameSeparator=(h=e.routesNameSeparator)!=null?h:k,e.defaultLocaleRouteNameSuffix=(d=e.defaultLocaleRouteNameSuffix)!=null?d:B,e.locales=(E=e.locales)!=null?E:[],e.routes=(f=e.routes)!=null?f:[],e}function de(e,t={}){const{version:o,defaultLocale:u,locales:i,strategy:h,trailingSlash:d,routesNameSeparator:E,defaultLocaleRouteNameSuffix:f,routes:g}=ie(t),l=oe(i),I=l.map(S=>S.code),P=fe(I,E,f);ue(e,{locales:l});const O=H(g,{locales:i,defaultLocale:u,strategy:h,trailingSlash:d,routesNameSeparator:E,defaultLocaleRouteNameSuffix:f});t.routes=O;let R=null;if(a.isVue3&&o===4)R=s.createRouter(t);else if(a.isVue2&&o===3)R=new te.default(t);else throw new Error("TODO:");return R.__defaultLocale=u,R.__localeCodes=I,R.__strategy=h,R.__trailingSlash=d,R.__routesNameSeparator=E,R.__defaultLocaleRouteNameSuffix=f,R.beforeEach((S,F,x)=>{console.log("beforeEach",S,F);const m=M(e),L=P(S)||m||u||"";console.log("currentLocale",m,"finalLocale",L),m!==L&&le(e,L),x()}),console.log("create router",R),R}const _e="0.0.0";return c.VERSION=_e,c.createRouter=de,c.localizeRoutes=H,c.useI18nRouting=ce,Object.defineProperty(c,"__esModule",{value:!0}),c[Symbol.toStringTag]="Module",c}({},VueDemi,VueRouter,VueI18n);
*/const G=Object.assign,fe=Array.isArray,ie=e=>typeof e=="function",N=e=>typeof e=="string",de=e=>typeof e=="boolean",he=e=>typeof e=="symbol",_e=/\/$|\/\?/;function C(e="",t=!1){return t?_e.test(e):e.endsWith("/")}function me(e="",t=!1){if(!t)return(C(e)?e.slice(0,-1):e)||"/";if(!C(e,!0))return e||"/";const[a,...n]=e.split("?");return(a.slice(0,-1)||"/")+(n.length?`?${n.join("?")}`:"")}function ge(e="",t=!1){if(!t)return e.endsWith("/")?e:e+"/";if(C(e,!0))return e||"/";const[a,...n]=e.split("?");return a+"/"+(n.length?`?${n.join("?")}`:"")}function Le(e,t){typeof console!="undefined"&&(console.warn("[vue-i18n-routing] "+e),t&&console.warn(t.stack))}function H(e){e=e||[];const t=[];for(const a of e)N(a)?t.push({code:a}):t.push(a);return t}function X(e,t){return s.isRef(e.locale)&&t==="composition"}function W(e){return"global"in e&&"mode"in e}function M(e){return W(e)?X(e.global,e.mode)?e.global.locale.value:e.global.locale:e.locale.value}function Re(e,t){W(e)?X(e.global,e.mode)?e.global.locale.value=t:e.global.locale=t:s.isRef(e.locale)&&(e.locale.value=t)}function Ee(e,t,a){return e.replace(/\/+$/,"")+(t?"/":"")||(a?"":"/")}function B(e){return N(e)?e:he(e)?e.toString():"(null)"}function Q(e,t,{defaultLocale:a,strategy:n,routesNameSeparator:o,defaultLocaleRouteNameSuffix:l}){let c=B(e)+(n==="no_prefix"?"":o+t);return t===a&&n==="prefix_and_default"&&(c+=o+l),c}function Se(e,t){return ie(e)?e(t):e}const v={PREFIX:"prefix",PREFIX_EXCEPT_DEFAULT:"prefix_except_default",PREFIX_AND_DEFAULT:"prefix_and_default",NO_PREFIX:"no_prefix"},O="",U=v.PREFIX_EXCEPT_DEFAULT,Y=!1,b="___",V="default",pe="ltr",J="",Ae=new Set([v.PREFIX_AND_DEFAULT,v.PREFIX_EXCEPT_DEFAULT]);function x(e=_.useRoute(),{router:t=_.useRouter(),routesNameSeparator:a=b}={}){const n=a||t.__routesNameSeparator,o=s.unref(e);return o.name?B(o.name).split(n)[0]:null}function K(e,t,a){const n=z(e,t,a);return n==null?"":s.isVue3?n.redirectedFrom||n.fullPath:n.route.redirectedFrom||n.route.fullPath}function Z(e,t,a){const n=z(e,t,a);return n==null?void 0:s.isVue3?n:n.route}function Ie(e,t,a){const n=z(e,t,a);return n==null?void 0:s.isVue3?n:n.location}function z(e,t,{router:a=_.useRouter(),i18n:n=p.useI18n(),defaultLocale:o=O,defaultLocaleRouteNameSuffix:l=V,routesNameSeparator:c=b,strategy:d=U,trailingSlash:h=!1}={}){const f=a.__defaultLocaleRouteNameSuffix||l,g=a.__defaultLocale||o,r=a.__routesNameSeparator||c,L=a.__strategy||d,R=t||M(n);let E=e;N(e)&&(E[0]==="/"?E={path:e}:E={name:e});let m=G({},E);if(m.path&&!m.name){const i=a.resolve(m),S=s.isVue3?i:i.route,y=x(S);N(y)?m={name:Q(y,R,{defaultLocale:g,strategy:L,routesNameSeparator:r,defaultLocaleRouteNameSuffix:f}),params:S.params,query:S.query,hash:S.hash}:(!(R===o&&Ae.has(L))&&L!==v.NO_PREFIX&&(m.path=`/${R}${m.path}`),m.path=h?ge(m.path,!0):me(m.path,!0))}else{m.name=Q(m.name,R,{defaultLocale:g,strategy:L,routesNameSeparator:r,defaultLocaleRouteNameSuffix:f});const{params:i}=m;i&&i["0"]===void 0&&i.pathMatch&&(i["0"]=i.pathMatch)}const T=a.resolve(m);return(s.isVue3?T.name:T.route.name)?T:a.resolve(e)}function j(e,t){const a=t&&t.route||_.useRoute(),n=x(a,t);if(!n)return"";const f=!s.isVue3&&s.isRef(a)?a.value:a,{params:o}=f,l=re(f,["params"]),c={},d=G({},l,{name:n,params:D(F(F({},o),c),{0:o.pathMatch})});return K(d,e,t)}function Te({addDirAttribute:e=!1,addSeoAttributes:t=!1,strategy:a=U,defaultLocale:n=O,route:o=_.useRoute(),router:l=_.useRouter(),i18n:c=p.useI18n()}={}){const d=n||l.__defaultLocale,h=a||l.__strategy,f=s.ref({htmlAttrs:{},link:[],meta:[]});function g(){f.value={htmlAttrs:{},link:[],meta:[]}}function r(L){const R=M(c),E=H(c.locales.value).find(i=>i.code===R)||{code:R},m=E.iso,T=E.dir||l.__defaultDirection;if(e&&(f.value.htmlAttrs.dir=T),t&&R&&c.locales){m&&(f.value.htmlAttrs.lang=m);const i=c.locales.value;ye(i,c.__baseUrl,f.value.link,{defaultLocale:d,strategy:h,route:o,router:l,i18n:c}),Pe(c.__baseUrl,f.value.link,t,{route:L,router:l,i18n:c}),Fe(E,m,f.value.meta),Ne(i,m,f.value.meta)}}return s.watch(l.currentRoute,L=>{g(),r(L)}),r(o),f}function ye(e,t,a,n){if(n.strategy===v.NO_PREFIX)return;const o=new Map;for(const l of e){const c=l.iso;if(!c){Le("Locale ISO code is required to generate alternate link");continue}const[d,h]=c.split("-");d&&h&&(l.isCatchallLocale||!o.has(d))&&o.set(d,l),o.set(c,l)}for(const[l,c]of o.entries()){const d=j(c.code,n);d&&a.push({hid:`i18n-alt-${l}`,rel:"alternate",href:k(d,t),hreflang:l})}if(n.defaultLocale){const l=j(n.defaultLocale,n);l&&a.push({hid:"i18n-xd",rel:"alternate",href:k(l,t),hreflang:"x-default"})}}function Pe(e,t,a,n){const{route:o}=n,l=Z(D(F({},o),{name:x(o,n)}),void 0,n);if(l){let c=k(l.path,e);const d=!de(a)&&a.canonicalQueries||[];if(d.length){const h=l.query,f=new URLSearchParams;for(const r of d)if(r in h){const L=h[r];fe(L)?L.forEach(R=>f.append(r,R||"")):f.append(r,L||"")}const g=f.toString();g&&(c=`${c}?${g}`)}t.push({hid:"i18n-can",rel:"canonical",href:c})}}function Fe(e,t,a){!(e&&t)||a.push({hid:"i18n-og",property:"og:locale",content:ee(t)})}function Ne(e,t,a){const n=e.filter(o=>{const l=o.iso;return l&&l!==t});if(n.length){const o=n.map(l=>({hid:`i18n-og-alt-${l.iso}`,property:"og:locale:alternate",content:ee(l.iso)}));a.push(...o)}}function ee(e){return(e||"").replace(/-/g,"_")}function k(e,t){return e.match(/^https?:\/\//)?e:t+e}function te(e,{defaultLocale:t=O,strategy:a=U,trailingSlash:n=Y,routesNameSeparator:o=b,defaultLocaleRouteNameSuffix:l=V,includeUprefixedFallback:c=!1,optionsResolver:d=void 0,locales:h=[]}={}){if(a==="no_prefix")return e;const f=h.map(r=>N(r)?r:r.code);function g(r,L,R=!1,E=!1){if(r.redirect&&(!r.component||!r.file))return[r];let m=null;return d!=null&&(m=d(r,L),m==null)?[r]:L.reduce((i,S)=>{const{name:y}=r;let{path:A}=r;const I=F({},r);y&&(I.name=`${y}${o}${S}`),r.children&&(I.children=r.children.reduce((P,q)=>[...P,...g(q,[S],!0,E)],[]));const $=S===t;if($&&a==="prefix_and_default")if(R)R&&E&&y&&(I.name+=`${o}${l}`);else{const P=D(F({},I),{path:A});if(y&&(P.name=`${I.name}${o}${l}`),r.children){P.children=[];for(const q of r.children)P.children=P.children.concat(g(q,[S],!0,!0))}i.push(P)}const ae=R&&!A.startsWith("/"),ne=!ae&&!($&&a==="prefix_except_default");return ne&&(A=`/${S}${A}`),A&&(A=Ee(A,n,ae)),ne&&$&&a==="prefix"&&c&&i.push(F({},r)),I.path=A,i.push(I),i},[])}return e.reduce((r,L)=>[...r,...g(L,f||[])],[])}function $e(e,{locales:t=[],baseUrl:a=J}={}){if(!X(e.global,e.mode))throw new Error("TODO:");const n=s.ref(t);e.global.locales=s.computed(()=>n.value),e.global.__baseUrl=Se(a,{})}function ve(e){return new RegExp(`^/(${e.join("|")})(?:/|$)`,"i")}function Oe(e,t,a){const n=`(${e.join("|")})`,o=`(?:${t}${a})?`,l=new RegExp(`${t}${n}${o}$`,"i"),c=ve(e);return h=>{if(h.name){const g=(N(h.name)?h.name:h.name.toString()).match(l);if(g&&g.length>1)return g[1]}else if(h.path){const f=h.path.match(c);if(f&&f.length>1)return f[1]}return""}}function Ue(e){var t,a,n,o,l,c,d,h,f,g;return e.version=(t=e.version)!=null?t:4,e.defaultLocale=(a=e.defaultLocale)!=null?a:O,e.strategy=(n=e.strategy)!=null?n:U,e.trailingSlash=(o=e.trailingSlash)!=null?o:Y,e.routesNameSeparator=(l=e.routesNameSeparator)!=null?l:b,e.defaultLocaleRouteNameSuffix=(c=e.defaultLocaleRouteNameSuffix)!=null?c:V,e.locales=(d=e.locales)!=null?d:[],e.defaultDirection=(h=e.defaultDirection)!=null?h:pe,e.baseUrl=(f=e.baseUrl)!=null?f:J,e.routes=(g=e.routes)!=null?g:[],e}function be(e,t={}){const{version:a,defaultLocale:n,locales:o,strategy:l,trailingSlash:c,routesNameSeparator:d,defaultLocaleRouteNameSuffix:h,defaultDirection:f,baseUrl:g,routes:r,routeOptionsResolver:L}=Ue(t),R=H(o),E=R.map(S=>S.code),m=Oe(E,d,h);$e(e,{locales:R,baseUrl:g});const T=te(r,{locales:o,defaultLocale:n,strategy:l,trailingSlash:c,routesNameSeparator:d,defaultLocaleRouteNameSuffix:h,optionsResolver:L});t.routes=T;let i=null;if(s.isVue3&&a===4)i=_.createRouter(t);else if(s.isVue2&&a===3)i=new ue.default(t);else throw new Error("TODO:");return i.__defaultLocale=n,i.__localeCodes=E,i.__strategy=l,i.__trailingSlash=c,i.__routesNameSeparator=d,i.__defaultLocaleRouteNameSuffix=h,i.__defaultDirection=f,i.beforeEach((S,y,A)=>{const I=M(e),$=m(S)||I||n||"";I!==$&&Re(e,$),A()}),i}const xe="0.0.0";return u.VERSION=xe,u.createRouter=be,u.getRouteBaseName=x,u.localeLocation=Ie,u.localePath=K,u.localeRoute=Z,u.localizeRoutes=te,u.switchLocalePath=j,u.useI18nHead=Te,Object.defineProperty(u,"__esModule",{value:!0}),u[Symbol.toStringTag]="Module",u}({},VueDemi,VueRouter,VueI18n);
{
"name": "vue-i18n-routing",
"description": "The i18n routing with using vue-i18n",
"version": "0.0.0-5165052",
"version": "0.0.0-05a99fc",
"dependencies": {

@@ -9,2 +9,3 @@ "@intlify/shared": "beta",

"@intlify/vue-router-bridge": "^0.3.4",
"ufo": "^0.7.9",
"vue-demi": "^0.12.1"

@@ -19,2 +20,3 @@ },

"vite": "^2.7.4",
"vitest": "^0.2.8",
"vite-plugin-dts": "^0.9.6",

@@ -24,6 +26,6 @@ "vue": "^3.2.23",

"vue-i18n-bridge": "beta",
"vue-i18n-legacy": "npm:vue-i18n@latest",
"vue-i18n-legacy": "npm:vue-i18n@8",
"vue-router": "^4.0.12",
"vue-router3": "npm:vue-router@3",
"vue-template-compiler": "^2.6.14",
"vue-router": "^4.0.12",
"vue-router3": "npm:vue-router@latest",
"vue2": "npm:vue@2"

@@ -34,4 +36,4 @@ },

"vue": "^2.6.14 || ^3.2.0",
"vue-i18n": "^8.26.1 || ^9.2.0-beta.25",
"vue-i18n-bridge": "^9.2.0-beta.25",
"vue-i18n": "^8.26.1 || ^9.2.0-beta.30",
"vue-i18n-bridge": "^9.2.0-beta.30",
"vue-router": "^3.5.3 || ^4.0.0"

@@ -67,4 +69,7 @@ },

},
"require": "./dist/vue-i18n-routing.cjs.js"
}
"require": "./dist/vue-i18n-routing.cjs.js",
"types": "./dist/vue-i18n-routing.d.ts"
},
"./dist/*": "./dist/*",
"./package.json": "./package.json"
},

@@ -96,4 +101,7 @@ "license": "MIT",

"typecheck": "tsc -p . --noEmit",
"test": "vitest run",
"test:watch": "vitest",
"test:cover": "vitest --coverage",
"build:docs": "api-docs-gen ./temp/vue-i18n-routing.api.json -c ./docsgen.config.js -o ./ -g noprefix"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc