vue-i18n-routing
Advanced tools
Comparing version 0.13.2-0a114ea to 0.13.2-53b2272
@@ -21,3 +21,3 @@ "use strict"; | ||
/*! | ||
* shared v9.3.0-beta.25 | ||
* shared v9.3.0-beta.26 | ||
* (c) 2023 kazuya kawaguchi | ||
@@ -342,18 +342,26 @@ * Released under the MIT License. | ||
const orgComposerExtend = pluginOptions.__composerExtend; | ||
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); | ||
pluginOptions.__composerExtend = (localComposer) => { | ||
const globalComposer2 = getComposer(i18n); | ||
localComposer.locales = vueDemi.computed(() => globalComposer2.locales.value); | ||
localComposer.localeCodes = vueDemi.computed(() => globalComposer2.localeCodes.value); | ||
localComposer.baseUrl = vueDemi.computed(() => globalComposer2.baseUrl.value); | ||
let orgComposerDispose; | ||
if (isFunction(orgComposerExtend)) { | ||
Reflect.apply(orgComposerExtend, pluginOptions, [c]); | ||
orgComposerDispose = Reflect.apply(orgComposerExtend, pluginOptions, [globalComposer2]); | ||
} | ||
return () => { | ||
orgComposerDispose && orgComposerDispose(); | ||
}; | ||
}; | ||
if (isVueI18n(i18n.global)) { | ||
if (i18n.mode === "legacy") { | ||
const orgVueI18nExtend = pluginOptions.__vueI18nExtend; | ||
pluginOptions.__vueI18nExtend = (vueI18n) => { | ||
extendVueI18n(vueI18n, hooks.onExtendVueI18n); | ||
let orgVueI18nDispose; | ||
if (isFunction(orgVueI18nExtend)) { | ||
Reflect.apply(orgVueI18nExtend, pluginOptions, [vueI18n]); | ||
orgVueI18nDispose = Reflect.apply(orgVueI18nExtend, pluginOptions, [vueI18n]); | ||
} | ||
return () => { | ||
orgVueI18nDispose && orgVueI18nDispose(); | ||
}; | ||
}; | ||
@@ -363,11 +371,13 @@ } | ||
Reflect.apply(orgInstall, i18n, [vue, ...options]); | ||
const composer = getComposer(i18n); | ||
scope.run(() => extendComposer(composer, { locales, localeCodes, baseUrl, hooks, context })); | ||
if (isVueI18n(i18n.global)) { | ||
extendVueI18n(i18n.global, hooks.onExtendVueI18n); | ||
} | ||
const globalComposer = getComposer(i18n); | ||
scope.run(() => { | ||
extendComposer(globalComposer, { locales, localeCodes, baseUrl, hooks, context }); | ||
if (i18n.mode === "legacy" && isVueI18n(i18n.global)) { | ||
extendVueI18n(i18n.global, hooks.onExtendVueI18n); | ||
} | ||
}); | ||
const app = vue; | ||
const exported = i18n.mode === "composition" ? vueDemi.isVue3 ? app.config.globalProperties.$i18n : i18n : vueDemi.isVue2 ? i18n : null; | ||
if (exported) { | ||
extendExportedGlobal(exported, composer, hooks.onExtendExportedGlobal); | ||
extendExportedGlobal(exported, globalComposer, hooks.onExtendExportedGlobal); | ||
} | ||
@@ -420,3 +430,3 @@ if (pluginOptions.inject) { | ||
} | ||
function extendExportedGlobal(exported, g, hook) { | ||
function extendProperyDescripters(composer, exported, hook) { | ||
const properties = [ | ||
@@ -426,30 +436,2 @@ { | ||
get() { | ||
return g.locales.value; | ||
} | ||
}, | ||
localeCodes: { | ||
get() { | ||
return g.localeCodes.value; | ||
} | ||
}, | ||
baseUrl: { | ||
get() { | ||
return g.baseUrl.value; | ||
} | ||
} | ||
} | ||
]; | ||
hook && properties.push(hook(g)); | ||
for (const property of properties) { | ||
for (const [key, descriptor] of Object.entries(property)) { | ||
Object.defineProperty(exported, key, descriptor); | ||
} | ||
} | ||
} | ||
function extendVueI18n(vueI18n, hook) { | ||
const composer = getComposer(vueI18n); | ||
const properties = [ | ||
{ | ||
locales: { | ||
get() { | ||
return composer.locales.value; | ||
@@ -473,6 +455,13 @@ } | ||
for (const [key, descriptor] of Object.entries(property)) { | ||
Object.defineProperty(vueI18n, key, descriptor); | ||
Object.defineProperty(exported, key, descriptor); | ||
} | ||
} | ||
} | ||
function extendExportedGlobal(exported, g, hook) { | ||
extendProperyDescripters(g, exported, hook); | ||
} | ||
function extendVueI18n(vueI18n, hook) { | ||
const c = getComposer(vueI18n); | ||
extendProperyDescripters(c, vueI18n, hook); | ||
} | ||
function isPluginOptions(options) { | ||
@@ -479,0 +468,0 @@ return isObject(options) && ("inject" in options || "__composerExtend" in options || "__vueI18nExtend" in options); |
import type { Composer } from '@intlify/vue-i18n-bridge'; | ||
import type { ComposerExtender } from '@intlify/vue-i18n-bridge'; | ||
import { EffectScope } from 'vue-demi'; | ||
@@ -19,2 +20,3 @@ import type { ExportedGlobalComposer } from '@intlify/vue-i18n-bridge'; | ||
import type { VueI18n } from '@intlify/vue-i18n-bridge'; | ||
import type { VueI18nExtender } from '@intlify/vue-i18n-bridge'; | ||
import type { VueRouter } from '@intlify/vue-router-bridge'; | ||
@@ -915,7 +917,7 @@ | ||
*/ | ||
__composerExtend?: (composer: Composer) => void; | ||
__composerExtend?: ComposerExtender; | ||
/** | ||
* @internal | ||
*/ | ||
__vueI18nExtend?: (vueI18n: VueI18n) => void; | ||
__vueI18nExtend?: VueI18nExtender; | ||
} | ||
@@ -922,0 +924,0 @@ |
@@ -18,3 +18,3 @@ var VueI18nRouting = function(exports, VueRouter3, vueDemi, vueI18nBridge) { | ||
/*! | ||
* shared v9.3.0-beta.25 | ||
* shared v9.3.0-beta.26 | ||
* (c) 2023 kazuya kawaguchi | ||
@@ -339,18 +339,26 @@ * Released under the MIT License. | ||
const orgComposerExtend = pluginOptions.__composerExtend; | ||
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); | ||
pluginOptions.__composerExtend = (localComposer) => { | ||
const globalComposer2 = getComposer(i18n); | ||
localComposer.locales = vueDemi.computed(() => globalComposer2.locales.value); | ||
localComposer.localeCodes = vueDemi.computed(() => globalComposer2.localeCodes.value); | ||
localComposer.baseUrl = vueDemi.computed(() => globalComposer2.baseUrl.value); | ||
let orgComposerDispose; | ||
if (isFunction(orgComposerExtend)) { | ||
Reflect.apply(orgComposerExtend, pluginOptions, [c]); | ||
orgComposerDispose = Reflect.apply(orgComposerExtend, pluginOptions, [globalComposer2]); | ||
} | ||
return () => { | ||
orgComposerDispose && orgComposerDispose(); | ||
}; | ||
}; | ||
if (isVueI18n(i18n.global)) { | ||
if (i18n.mode === "legacy") { | ||
const orgVueI18nExtend = pluginOptions.__vueI18nExtend; | ||
pluginOptions.__vueI18nExtend = (vueI18n) => { | ||
extendVueI18n(vueI18n, hooks.onExtendVueI18n); | ||
let orgVueI18nDispose; | ||
if (isFunction(orgVueI18nExtend)) { | ||
Reflect.apply(orgVueI18nExtend, pluginOptions, [vueI18n]); | ||
orgVueI18nDispose = Reflect.apply(orgVueI18nExtend, pluginOptions, [vueI18n]); | ||
} | ||
return () => { | ||
orgVueI18nDispose && orgVueI18nDispose(); | ||
}; | ||
}; | ||
@@ -360,11 +368,13 @@ } | ||
Reflect.apply(orgInstall, i18n, [vue, ...options]); | ||
const composer = getComposer(i18n); | ||
scope.run(() => extendComposer(composer, { locales, localeCodes, baseUrl, hooks, context })); | ||
if (isVueI18n(i18n.global)) { | ||
extendVueI18n(i18n.global, hooks.onExtendVueI18n); | ||
} | ||
const globalComposer = getComposer(i18n); | ||
scope.run(() => { | ||
extendComposer(globalComposer, { locales, localeCodes, baseUrl, hooks, context }); | ||
if (i18n.mode === "legacy" && isVueI18n(i18n.global)) { | ||
extendVueI18n(i18n.global, hooks.onExtendVueI18n); | ||
} | ||
}); | ||
const app = vue; | ||
const exported = i18n.mode === "composition" ? vueDemi.isVue3 ? app.config.globalProperties.$i18n : i18n : vueDemi.isVue2 ? i18n : null; | ||
if (exported) { | ||
extendExportedGlobal(exported, composer, hooks.onExtendExportedGlobal); | ||
extendExportedGlobal(exported, globalComposer, hooks.onExtendExportedGlobal); | ||
} | ||
@@ -417,3 +427,3 @@ if (pluginOptions.inject) { | ||
} | ||
function extendExportedGlobal(exported, g, hook) { | ||
function extendProperyDescripters(composer, exported, hook) { | ||
const properties = [ | ||
@@ -423,30 +433,2 @@ { | ||
get() { | ||
return g.locales.value; | ||
} | ||
}, | ||
localeCodes: { | ||
get() { | ||
return g.localeCodes.value; | ||
} | ||
}, | ||
baseUrl: { | ||
get() { | ||
return g.baseUrl.value; | ||
} | ||
} | ||
} | ||
]; | ||
hook && properties.push(hook(g)); | ||
for (const property of properties) { | ||
for (const [key, descriptor] of Object.entries(property)) { | ||
Object.defineProperty(exported, key, descriptor); | ||
} | ||
} | ||
} | ||
function extendVueI18n(vueI18n, hook) { | ||
const composer = getComposer(vueI18n); | ||
const properties = [ | ||
{ | ||
locales: { | ||
get() { | ||
return composer.locales.value; | ||
@@ -470,6 +452,13 @@ } | ||
for (const [key, descriptor] of Object.entries(property)) { | ||
Object.defineProperty(vueI18n, key, descriptor); | ||
Object.defineProperty(exported, key, descriptor); | ||
} | ||
} | ||
} | ||
function extendExportedGlobal(exported, g, hook) { | ||
extendProperyDescripters(g, exported, hook); | ||
} | ||
function extendVueI18n(vueI18n, hook) { | ||
const c = getComposer(vueI18n); | ||
extendProperyDescripters(c, vueI18n, hook); | ||
} | ||
function isPluginOptions(options) { | ||
@@ -476,0 +465,0 @@ return isObject(options) && ("inject" in options || "__composerExtend" in options || "__vueI18nExtend" in options); |
@@ -21,3 +21,3 @@ "use strict"; | ||
/*! | ||
* shared v9.3.0-beta.25 | ||
* shared v9.3.0-beta.26 | ||
* (c) 2023 kazuya kawaguchi | ||
@@ -342,18 +342,26 @@ * Released under the MIT License. | ||
const orgComposerExtend = pluginOptions.__composerExtend; | ||
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); | ||
pluginOptions.__composerExtend = (localComposer) => { | ||
const globalComposer2 = getComposer(i18n); | ||
localComposer.locales = vueDemi.computed(() => globalComposer2.locales.value); | ||
localComposer.localeCodes = vueDemi.computed(() => globalComposer2.localeCodes.value); | ||
localComposer.baseUrl = vueDemi.computed(() => globalComposer2.baseUrl.value); | ||
let orgComposerDispose; | ||
if (isFunction(orgComposerExtend)) { | ||
Reflect.apply(orgComposerExtend, pluginOptions, [c]); | ||
orgComposerDispose = Reflect.apply(orgComposerExtend, pluginOptions, [globalComposer2]); | ||
} | ||
return () => { | ||
orgComposerDispose && orgComposerDispose(); | ||
}; | ||
}; | ||
if (isVueI18n(i18n.global)) { | ||
if (i18n.mode === "legacy") { | ||
const orgVueI18nExtend = pluginOptions.__vueI18nExtend; | ||
pluginOptions.__vueI18nExtend = (vueI18n) => { | ||
extendVueI18n(vueI18n, hooks.onExtendVueI18n); | ||
let orgVueI18nDispose; | ||
if (isFunction(orgVueI18nExtend)) { | ||
Reflect.apply(orgVueI18nExtend, pluginOptions, [vueI18n]); | ||
orgVueI18nDispose = Reflect.apply(orgVueI18nExtend, pluginOptions, [vueI18n]); | ||
} | ||
return () => { | ||
orgVueI18nDispose && orgVueI18nDispose(); | ||
}; | ||
}; | ||
@@ -363,11 +371,13 @@ } | ||
Reflect.apply(orgInstall, i18n, [vue, ...options]); | ||
const composer = getComposer(i18n); | ||
scope.run(() => extendComposer(composer, { locales, localeCodes, baseUrl, hooks, context })); | ||
if (isVueI18n(i18n.global)) { | ||
extendVueI18n(i18n.global, hooks.onExtendVueI18n); | ||
} | ||
const globalComposer = getComposer(i18n); | ||
scope.run(() => { | ||
extendComposer(globalComposer, { locales, localeCodes, baseUrl, hooks, context }); | ||
if (i18n.mode === "legacy" && isVueI18n(i18n.global)) { | ||
extendVueI18n(i18n.global, hooks.onExtendVueI18n); | ||
} | ||
}); | ||
const app = vue; | ||
const exported = i18n.mode === "composition" ? vueDemi.isVue3 ? app.config.globalProperties.$i18n : i18n : vueDemi.isVue2 ? i18n : null; | ||
if (exported) { | ||
extendExportedGlobal(exported, composer, hooks.onExtendExportedGlobal); | ||
extendExportedGlobal(exported, globalComposer, hooks.onExtendExportedGlobal); | ||
} | ||
@@ -420,3 +430,3 @@ if (pluginOptions.inject) { | ||
} | ||
function extendExportedGlobal(exported, g, hook) { | ||
function extendProperyDescripters(composer, exported, hook) { | ||
const properties = [ | ||
@@ -426,30 +436,2 @@ { | ||
get() { | ||
return g.locales.value; | ||
} | ||
}, | ||
localeCodes: { | ||
get() { | ||
return g.localeCodes.value; | ||
} | ||
}, | ||
baseUrl: { | ||
get() { | ||
return g.baseUrl.value; | ||
} | ||
} | ||
} | ||
]; | ||
hook && properties.push(hook(g)); | ||
for (const property of properties) { | ||
for (const [key, descriptor] of Object.entries(property)) { | ||
Object.defineProperty(exported, key, descriptor); | ||
} | ||
} | ||
} | ||
function extendVueI18n(vueI18n, hook) { | ||
const composer = getComposer(vueI18n); | ||
const properties = [ | ||
{ | ||
locales: { | ||
get() { | ||
return composer.locales.value; | ||
@@ -473,6 +455,13 @@ } | ||
for (const [key, descriptor] of Object.entries(property)) { | ||
Object.defineProperty(vueI18n, key, descriptor); | ||
Object.defineProperty(exported, key, descriptor); | ||
} | ||
} | ||
} | ||
function extendExportedGlobal(exported, g, hook) { | ||
extendProperyDescripters(g, exported, hook); | ||
} | ||
function extendVueI18n(vueI18n, hook) { | ||
const c = getComposer(vueI18n); | ||
extendProperyDescripters(c, vueI18n, hook); | ||
} | ||
function isPluginOptions(options) { | ||
@@ -479,0 +468,0 @@ return isObject(options) && ("inject" in options || "__composerExtend" in options || "__vueI18nExtend" in options); |
{ | ||
"name": "vue-i18n-routing", | ||
"description": "The i18n routing with using vue-i18n", | ||
"version": "0.13.2-0a114ea", | ||
"version": "0.13.2-53b2272", | ||
"dependencies": { | ||
@@ -20,3 +20,3 @@ "@intlify/shared": "next", | ||
"vue": "^3.2.27", | ||
"vue-i18n": "npm:vue-i18n@next", | ||
"vue-i18n": "npm:vue-i18n@9.3.0-beta.26", | ||
"vue-i18n-bridge": "next", | ||
@@ -23,0 +23,0 @@ "vue-i18n-legacy": "npm:vue-i18n@8", |
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
206159
5681