vue-i18n-routing
Advanced tools
Comparing version 0.9.2 to 0.10.0-f645161
@@ -711,2 +711,10 @@ import type { Composer } from '@intlify/vue-i18n-bridge'; | ||
inject?: boolean; | ||
/** | ||
* @internal | ||
*/ | ||
__composerExtend?: (composer: Composer) => void; | ||
/** | ||
* @internal | ||
*/ | ||
__vueI18nExtend?: (vueI18n: VueI18n) => void; | ||
} | ||
@@ -713,0 +721,0 @@ |
@@ -20,3 +20,3 @@ var VueI18nRouting = function(exports, VueRouter3, vueDemi, vueI18nBridge) { | ||
/*! | ||
* shared v9.3.0-beta.6 | ||
* shared v9.3.0-beta.8 | ||
* (c) 2022 kazuya kawaguchi | ||
@@ -35,4 +35,4 @@ * Released under the MIT License. | ||
const TRAILING_SLASH_RE = /\/$|\/\?/; | ||
function hasTrailingSlash(input = "", queryParams = false) { | ||
if (!queryParams) { | ||
function hasTrailingSlash(input = "", queryParameters = false) { | ||
if (!queryParameters) { | ||
return input.endsWith("/"); | ||
@@ -42,4 +42,4 @@ } | ||
} | ||
function withoutTrailingSlash(input = "", queryParams = false) { | ||
if (!queryParams) { | ||
function withoutTrailingSlash(input = "", queryParameters = false) { | ||
if (!queryParameters) { | ||
return (hasTrailingSlash(input) ? input.slice(0, -1) : input) || "/"; | ||
@@ -51,6 +51,6 @@ } | ||
const [s0, ...s] = input.split("?"); | ||
return (s0.slice(0, -1) || "/") + (s.length ? `?${s.join("?")}` : ""); | ||
return (s0.slice(0, -1) || "/") + (s.length > 0 ? `?${s.join("?")}` : ""); | ||
} | ||
function withTrailingSlash(input = "", queryParams = false) { | ||
if (!queryParams) { | ||
function withTrailingSlash(input = "", queryParameters = false) { | ||
if (!queryParameters) { | ||
return input.endsWith("/") ? input : input + "/"; | ||
@@ -62,3 +62,3 @@ } | ||
const [s0, ...s] = input.split("?"); | ||
return s0 + "/" + (s.length ? `?${s.join("?")}` : ""); | ||
return s0 + "/" + (s.length > 0 ? `?${s.join("?")}` : ""); | ||
} | ||
@@ -340,2 +340,17 @@ const inBrowser = typeof window !== "undefined"; | ||
i18n.install = (vue, ...options) => { | ||
const pluginOptions = isPluginOptions(options[0]) ? options[0] : { inject: true }; | ||
if (pluginOptions.inject == null) { | ||
pluginOptions.inject = true; | ||
} | ||
pluginOptions.__composerExtend = (c) => { | ||
const g = getComposer(i18n); | ||
c.locales = vueDemi.computed(() => g.locales.value); | ||
c.localeCodes = vueDemi.computed(() => g.localeCodes.value); | ||
c.baseUrl = vueDemi.computed(() => g.baseUrl.value); | ||
}; | ||
if (isVueI18n(i18n.global)) { | ||
pluginOptions.__vueI18nExtend = (vueI18n) => { | ||
extendVueI18n(vueI18n, hooks.onExtendVueI18n); | ||
}; | ||
} | ||
Reflect.apply(orgInstall, i18n, [vue, ...options]); | ||
@@ -352,3 +367,2 @@ const composer = getComposer(i18n); | ||
} | ||
const pluginOptions = isPluginOptions(options[0]) ? options[0] : { inject: true }; | ||
if (pluginOptions.inject) { | ||
@@ -385,9 +399,13 @@ vue.mixin({ | ||
composer.baseUrl = vueDemi.computed(() => _baseUrl.value); | ||
vueDemi.watch( | ||
composer.locale, | ||
() => { | ||
_baseUrl.value = resolveBaseUrl(baseUrl, context); | ||
}, | ||
{ immediate: true } | ||
); | ||
if (inBrowser) { | ||
vueDemi.watch( | ||
composer.locale, | ||
() => { | ||
_baseUrl.value = resolveBaseUrl(baseUrl, context); | ||
}, | ||
{ immediate: true } | ||
); | ||
} else { | ||
_baseUrl.value = resolveBaseUrl(baseUrl, context); | ||
} | ||
if (options.hooks && options.hooks.onExtendComposer) { | ||
@@ -1096,3 +1114,3 @@ options.hooks.onExtendComposer(composer); | ||
} | ||
const VERSION = "0.9.2"; | ||
const VERSION = "0.10.0"; | ||
exports.DEFAULT_BASE_URL = DEFAULT_BASE_URL; | ||
@@ -1099,0 +1117,0 @@ exports.DEFAULT_DETECTION_DIRECTION = DEFAULT_DETECTION_DIRECTION; |
@@ -23,3 +23,3 @@ "use strict"; | ||
/*! | ||
* shared v9.3.0-beta.6 | ||
* shared v9.3.0-beta.8 | ||
* (c) 2022 kazuya kawaguchi | ||
@@ -38,4 +38,4 @@ * Released under the MIT License. | ||
const TRAILING_SLASH_RE = /\/$|\/\?/; | ||
function hasTrailingSlash(input = "", queryParams = false) { | ||
if (!queryParams) { | ||
function hasTrailingSlash(input = "", queryParameters = false) { | ||
if (!queryParameters) { | ||
return input.endsWith("/"); | ||
@@ -45,4 +45,4 @@ } | ||
} | ||
function withoutTrailingSlash(input = "", queryParams = false) { | ||
if (!queryParams) { | ||
function withoutTrailingSlash(input = "", queryParameters = false) { | ||
if (!queryParameters) { | ||
return (hasTrailingSlash(input) ? input.slice(0, -1) : input) || "/"; | ||
@@ -54,6 +54,6 @@ } | ||
const [s0, ...s] = input.split("?"); | ||
return (s0.slice(0, -1) || "/") + (s.length ? `?${s.join("?")}` : ""); | ||
return (s0.slice(0, -1) || "/") + (s.length > 0 ? `?${s.join("?")}` : ""); | ||
} | ||
function withTrailingSlash(input = "", queryParams = false) { | ||
if (!queryParams) { | ||
function withTrailingSlash(input = "", queryParameters = false) { | ||
if (!queryParameters) { | ||
return input.endsWith("/") ? input : input + "/"; | ||
@@ -65,3 +65,3 @@ } | ||
const [s0, ...s] = input.split("?"); | ||
return s0 + "/" + (s.length ? `?${s.join("?")}` : ""); | ||
return s0 + "/" + (s.length > 0 ? `?${s.join("?")}` : ""); | ||
} | ||
@@ -343,2 +343,17 @@ const inBrowser = typeof window !== "undefined"; | ||
i18n.install = (vue, ...options) => { | ||
const pluginOptions = isPluginOptions(options[0]) ? options[0] : { inject: true }; | ||
if (pluginOptions.inject == null) { | ||
pluginOptions.inject = true; | ||
} | ||
pluginOptions.__composerExtend = (c) => { | ||
const g = getComposer(i18n); | ||
c.locales = vueDemi.computed(() => g.locales.value); | ||
c.localeCodes = vueDemi.computed(() => g.localeCodes.value); | ||
c.baseUrl = vueDemi.computed(() => g.baseUrl.value); | ||
}; | ||
if (isVueI18n(i18n.global)) { | ||
pluginOptions.__vueI18nExtend = (vueI18n) => { | ||
extendVueI18n(vueI18n, hooks.onExtendVueI18n); | ||
}; | ||
} | ||
Reflect.apply(orgInstall, i18n, [vue, ...options]); | ||
@@ -355,3 +370,2 @@ const composer = getComposer(i18n); | ||
} | ||
const pluginOptions = isPluginOptions(options[0]) ? options[0] : { inject: true }; | ||
if (pluginOptions.inject) { | ||
@@ -388,9 +402,13 @@ vue.mixin({ | ||
composer.baseUrl = vueDemi.computed(() => _baseUrl.value); | ||
vueDemi.watch( | ||
composer.locale, | ||
() => { | ||
_baseUrl.value = resolveBaseUrl(baseUrl, context); | ||
}, | ||
{ immediate: true } | ||
); | ||
if (inBrowser) { | ||
vueDemi.watch( | ||
composer.locale, | ||
() => { | ||
_baseUrl.value = resolveBaseUrl(baseUrl, context); | ||
}, | ||
{ immediate: true } | ||
); | ||
} else { | ||
_baseUrl.value = resolveBaseUrl(baseUrl, context); | ||
} | ||
if (options.hooks && options.hooks.onExtendComposer) { | ||
@@ -1099,3 +1117,3 @@ options.hooks.onExtendComposer(composer); | ||
} | ||
const VERSION = "0.9.2"; | ||
const VERSION = "0.10.0"; | ||
exports.DEFAULT_BASE_URL = DEFAULT_BASE_URL; | ||
@@ -1102,0 +1120,0 @@ exports.DEFAULT_DETECTION_DIRECTION = DEFAULT_DETECTION_DIRECTION; |
{ | ||
"name": "vue-i18n-routing", | ||
"description": "The i18n routing with using vue-i18n", | ||
"version": "0.9.2", | ||
"scripts": { | ||
"dev": "vite", | ||
"build": "vite build", | ||
"typecheck": "tsc -p . --noEmit", | ||
"switch:2": "vue-demi-switch 2 vue2 && vue-router-switch 3 vue-router3 && vue-i18n-switch 8 vue-i18n-legacy", | ||
"switch:3": "vue-demi-switch 3 && vue-router-switch 4 && vue-i18n-switch 9", | ||
"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" | ||
}, | ||
"version": "0.10.0-f645161", | ||
"dependencies": { | ||
@@ -20,3 +9,3 @@ "@intlify/shared": "next", | ||
"@intlify/vue-router-bridge": "^0.8.0", | ||
"ufo": "^0.8.6", | ||
"ufo": "^1.0.0", | ||
"vue-demi": "^0.13.11" | ||
@@ -30,3 +19,3 @@ }, | ||
"vite-plugin-dts": "^0.9.6", | ||
"vitest": "^0.24.5", | ||
"vitest": "^0.25.2", | ||
"vue": "^3.2.27", | ||
@@ -43,3 +32,3 @@ "vue-i18n": "npm:vue-i18n@next", | ||
"vue": "^2.6.14 || ^2.7.0 || ^3.2.0", | ||
"vue-i18n": "^8.26.1 || ^9.2.0 || ^9.3.0-beta.6", | ||
"vue-i18n": "^8.26.1 || ^9.2.0 || ^9.3.0-beta.8", | ||
"vue-i18n-bridge": "^9.2.0 || ^9.3.0-beta.6", | ||
@@ -123,3 +112,14 @@ "vue-router": "^3.5.3 || ^3.6.0 || ^4.0.0", | ||
}, | ||
"sideEffects": false | ||
} | ||
"sideEffects": false, | ||
"scripts": { | ||
"dev": "vite", | ||
"build": "vite build", | ||
"typecheck": "tsc -p . --noEmit", | ||
"switch:2": "vue-demi-switch 2 vue2 && vue-router-switch 3 vue-router3 && vue-i18n-switch 8 vue-i18n-legacy", | ||
"switch:3": "vue-demi-switch 3 && vue-router-switch 4 && vue-i18n-switch 9", | ||
"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" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
156592
4234
+ Addedufo@1.5.4(transitive)
- Removedufo@0.8.6(transitive)
Updatedufo@^1.0.0