vue-i18n-routing
Advanced tools
Comparing version 0.8.1 to 0.8.2
@@ -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 { | ||
@@ -1067,3 +1090,3 @@ } | ||
} | ||
const VERSION = "0.8.1"; | ||
const VERSION = "0.8.2"; | ||
exports.DEFAULT_BASE_URL = DEFAULT_BASE_URL; | ||
@@ -1116,2 +1139,2 @@ exports.DEFAULT_DETECTION_DIRECTION = DEFAULT_DETECTION_DIRECTION; | ||
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 { | ||
@@ -1070,3 +1093,3 @@ } | ||
} | ||
const VERSION = "0.8.1"; | ||
const VERSION = "0.8.2"; | ||
exports.DEFAULT_BASE_URL = DEFAULT_BASE_URL; | ||
@@ -1073,0 +1096,0 @@ exports.DEFAULT_DETECTION_DIRECTION = DEFAULT_DETECTION_DIRECTION; |
{ | ||
"name": "vue-i18n-routing", | ||
"description": "The i18n routing with using vue-i18n", | ||
"version": "0.8.1", | ||
"version": "0.8.2", | ||
"scripts": { | ||
@@ -20,4 +20,4 @@ "dev": "vite", | ||
"@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" | ||
}, | ||
@@ -27,6 +27,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", | ||
@@ -33,0 +33,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
154327
4168
Updatedufo@^0.8.6
Updatedvue-demi@^0.13.11