vue-i18n-routing
Advanced tools
Comparing version 0.8.1-4d399bf to 0.8.1-c51828f
@@ -1,2 +0,2 @@ | ||
var VueI18nRouting = function(exports, vueDemi, VueRouter3, vueI18nBridge) { | ||
var VueI18nRouting = function(exports, VueRouter3, vueDemi, vueI18nBridge) { | ||
"use strict"; | ||
@@ -601,2 +601,25 @@ const _interopDefaultLegacy = (e) => e && typeof e === "object" && "default" in e ? e : { default: e }; | ||
} | ||
function split(str, index) { | ||
const result = [str.slice(0, index), str.slice(index)]; | ||
return result; | ||
} | ||
function resolve(router, route, strategy, locale) { | ||
if (vueDemi.isVue3 && strategy === "prefix") { | ||
if (isArray(route.matched) && route.matched.length > 0) { | ||
return route.matched[0]; | ||
} | ||
const [rootSlash, restPath] = split(route.path, 1); | ||
const targetPath = `${rootSlash}${locale}${restPath === "" ? restPath : `/${restPath}`}`; | ||
const _route = router.options.routes.find((r) => r.path === targetPath); | ||
if (_route == null) { | ||
return route; | ||
} else { | ||
const _resolevableRoute = assign({}, _route); | ||
_resolevableRoute.path = targetPath; | ||
return router.resolve(_resolevableRoute); | ||
} | ||
} else { | ||
return router.resolve(route); | ||
} | ||
} | ||
const RESOLVED_PREFIXED = /* @__PURE__ */ new Set(["prefix_and_default", "prefix_except_default"]); | ||
@@ -648,3 +671,3 @@ function prefixable(optons) { | ||
try { | ||
_resolvedRoute = router.resolve(localizedRoute); | ||
_resolvedRoute = resolve(router, localizedRoute, strategy, _locale); | ||
} catch { | ||
@@ -1115,2 +1138,2 @@ } | ||
return exports; | ||
}({}, VueDemi, VueRouter, VueI18n); | ||
}({}, VueRouter, VueDemi, VueI18n); |
"use strict"; | ||
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } }); | ||
const VueRouter3 = require("@intlify/vue-router-bridge"); | ||
const vueDemi = require("vue-demi"); | ||
const VueRouter3 = require("@intlify/vue-router-bridge"); | ||
const vueI18nBridge = require("@intlify/vue-i18n-bridge"); | ||
@@ -604,2 +604,25 @@ const _interopDefaultLegacy = (e) => e && typeof e === "object" && "default" in e ? e : { default: e }; | ||
} | ||
function split(str, index) { | ||
const result = [str.slice(0, index), str.slice(index)]; | ||
return result; | ||
} | ||
function resolve(router, route, strategy, locale) { | ||
if (vueDemi.isVue3 && strategy === "prefix") { | ||
if (isArray(route.matched) && route.matched.length > 0) { | ||
return route.matched[0]; | ||
} | ||
const [rootSlash, restPath] = split(route.path, 1); | ||
const targetPath = `${rootSlash}${locale}${restPath === "" ? restPath : `/${restPath}`}`; | ||
const _route = router.options.routes.find((r) => r.path === targetPath); | ||
if (_route == null) { | ||
return route; | ||
} else { | ||
const _resolevableRoute = assign({}, _route); | ||
_resolevableRoute.path = targetPath; | ||
return router.resolve(_resolevableRoute); | ||
} | ||
} else { | ||
return router.resolve(route); | ||
} | ||
} | ||
const RESOLVED_PREFIXED = /* @__PURE__ */ new Set(["prefix_and_default", "prefix_except_default"]); | ||
@@ -651,3 +674,3 @@ function prefixable(optons) { | ||
try { | ||
_resolvedRoute = router.resolve(localizedRoute); | ||
_resolvedRoute = resolve(router, localizedRoute, strategy, _locale); | ||
} catch { | ||
@@ -654,0 +677,0 @@ } |
{ | ||
"name": "vue-i18n-routing", | ||
"description": "The i18n routing with using vue-i18n", | ||
"version": "0.8.1-4d399bf", | ||
"version": "0.8.1-c51828f", | ||
"dependencies": { | ||
@@ -9,4 +9,4 @@ "@intlify/shared": "next", | ||
"@intlify/vue-router-bridge": "^0.7.0", | ||
"ufo": "^0.8.5", | ||
"vue-demi": "^0.13.5" | ||
"ufo": "^0.8.6", | ||
"vue-demi": "^0.13.11" | ||
}, | ||
@@ -16,6 +16,6 @@ "devDependencies": { | ||
"api-docs-gen": "^0.4.0", | ||
"typescript": "^4.8.3", | ||
"vite": "^3.1.2", | ||
"typescript": "^4.8.4", | ||
"vite": "^3.2.2", | ||
"vite-plugin-dts": "^0.9.6", | ||
"vitest": "^0.23.4", | ||
"vitest": "^0.24.5", | ||
"vue": "^3.2.27", | ||
@@ -22,0 +22,0 @@ "vue-i18n": "npm:vue-i18n@next", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
154334
4168
Updatedufo@^0.8.6
Updatedvue-demi@^0.13.11