vue-i18n 9.14.2 → 9.14.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/vue-i18n.cjs +27 -7
- package/dist/vue-i18n.esm-browser.js +118 -78
- package/dist/vue-i18n.esm-browser.prod.js +3 -3
- package/dist/vue-i18n.global.js +118 -78
- package/dist/vue-i18n.global.prod.js +3 -3
- package/dist/vue-i18n.mjs +28 -8
- package/dist/vue-i18n.prod.cjs +27 -7
- package/dist/vue-i18n.runtime.esm-browser.js +76 -31
- package/dist/vue-i18n.runtime.esm-browser.prod.js +3 -3
- package/dist/vue-i18n.runtime.global.js +76 -31
- package/dist/vue-i18n.runtime.global.prod.js +3 -3
- package/dist/vue-i18n.runtime.mjs +28 -8
- package/package.json +8 -8
package/dist/vue-i18n.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* vue-i18n v9.14.
|
|
3
|
-
* (c)
|
|
2
|
+
* vue-i18n v9.14.4
|
|
3
|
+
* (c) 2025 kazuya kawaguchi
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
'use strict';
|
|
@@ -17,7 +17,7 @@ var vue = require('vue');
|
|
|
17
17
|
*
|
|
18
18
|
* @VueI18nGeneral
|
|
19
19
|
*/
|
|
20
|
-
const VERSION = '9.14.
|
|
20
|
+
const VERSION = '9.14.4';
|
|
21
21
|
|
|
22
22
|
const code$1 = coreBase.CoreWarnCodes.__EXTEND_POINT__;
|
|
23
23
|
const inc$1 = shared.incrementer(code$1);
|
|
@@ -121,6 +121,9 @@ function handleFlatJson(obj) {
|
|
|
121
121
|
if (!shared.isObject(obj)) {
|
|
122
122
|
return obj;
|
|
123
123
|
}
|
|
124
|
+
if (coreBase.isMessageAST(obj)) {
|
|
125
|
+
return obj;
|
|
126
|
+
}
|
|
124
127
|
for (const key in obj) {
|
|
125
128
|
// check key
|
|
126
129
|
if (!shared.hasOwn(obj, key)) {
|
|
@@ -141,6 +144,9 @@ function handleFlatJson(obj) {
|
|
|
141
144
|
let currentObj = obj;
|
|
142
145
|
let hasStringValue = false;
|
|
143
146
|
for (let i = 0; i < lastIndex; i++) {
|
|
147
|
+
if (subKeys[i] === '__proto__') {
|
|
148
|
+
throw new Error(`unsafe key: ${subKeys[i]}`);
|
|
149
|
+
}
|
|
144
150
|
if (!(subKeys[i] in currentObj)) {
|
|
145
151
|
currentObj[subKeys[i]] = shared.create();
|
|
146
152
|
}
|
|
@@ -155,12 +161,26 @@ function handleFlatJson(obj) {
|
|
|
155
161
|
}
|
|
156
162
|
// update last object value, delete old property
|
|
157
163
|
if (!hasStringValue) {
|
|
158
|
-
currentObj
|
|
159
|
-
|
|
164
|
+
if (!coreBase.isMessageAST(currentObj)) {
|
|
165
|
+
currentObj[subKeys[lastIndex]] = obj[key];
|
|
166
|
+
delete obj[key];
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
/**
|
|
170
|
+
* NOTE:
|
|
171
|
+
* if the last object is a message AST and subKeys[lastIndex] has message AST prop key, ignore to copy and key deletion
|
|
172
|
+
*/
|
|
173
|
+
if (!coreBase.AST_NODE_PROPS_KEYS.includes(subKeys[lastIndex])) {
|
|
174
|
+
delete obj[key];
|
|
175
|
+
}
|
|
176
|
+
}
|
|
160
177
|
}
|
|
161
178
|
// recursive process value if value is also a object
|
|
162
|
-
if (
|
|
163
|
-
|
|
179
|
+
if (!coreBase.isMessageAST(currentObj)) {
|
|
180
|
+
const target = currentObj[subKeys[lastIndex]];
|
|
181
|
+
if (shared.isObject(target)) {
|
|
182
|
+
handleFlatJson(target);
|
|
183
|
+
}
|
|
164
184
|
}
|
|
165
185
|
}
|
|
166
186
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* vue-i18n v9.14.
|
|
3
|
-
* (c)
|
|
2
|
+
* vue-i18n v9.14.4
|
|
3
|
+
* (c) 2025 kazuya kawaguchi
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
import { createVNode, Text, computed, watch, getCurrentInstance, ref, shallowRef, Fragment, defineComponent, h, effectScope, inject, onMounted, onUnmounted, onBeforeMount, isRef } from 'vue';
|
|
@@ -1839,6 +1839,80 @@ function baseCompile$1(source, options = {}) {
|
|
|
1839
1839
|
}
|
|
1840
1840
|
}
|
|
1841
1841
|
|
|
1842
|
+
function isMessageAST(val) {
|
|
1843
|
+
return (isObject(val) &&
|
|
1844
|
+
resolveType(val) === 0 &&
|
|
1845
|
+
(hasOwn(val, 'b') || hasOwn(val, 'body')));
|
|
1846
|
+
}
|
|
1847
|
+
const PROPS_BODY = ['b', 'body'];
|
|
1848
|
+
function resolveBody(node) {
|
|
1849
|
+
return resolveProps(node, PROPS_BODY);
|
|
1850
|
+
}
|
|
1851
|
+
const PROPS_CASES = ['c', 'cases'];
|
|
1852
|
+
function resolveCases(node) {
|
|
1853
|
+
return resolveProps(node, PROPS_CASES, []);
|
|
1854
|
+
}
|
|
1855
|
+
const PROPS_STATIC = ['s', 'static'];
|
|
1856
|
+
function resolveStatic(node) {
|
|
1857
|
+
return resolveProps(node, PROPS_STATIC);
|
|
1858
|
+
}
|
|
1859
|
+
const PROPS_ITEMS = ['i', 'items'];
|
|
1860
|
+
function resolveItems(node) {
|
|
1861
|
+
return resolveProps(node, PROPS_ITEMS, []);
|
|
1862
|
+
}
|
|
1863
|
+
const PROPS_TYPE = ['t', 'type'];
|
|
1864
|
+
function resolveType(node) {
|
|
1865
|
+
return resolveProps(node, PROPS_TYPE);
|
|
1866
|
+
}
|
|
1867
|
+
const PROPS_VALUE = ['v', 'value'];
|
|
1868
|
+
function resolveValue$1(node, type) {
|
|
1869
|
+
const resolved = resolveProps(node, PROPS_VALUE);
|
|
1870
|
+
if (resolved != null) {
|
|
1871
|
+
return resolved;
|
|
1872
|
+
}
|
|
1873
|
+
else {
|
|
1874
|
+
throw createUnhandleNodeError(type);
|
|
1875
|
+
}
|
|
1876
|
+
}
|
|
1877
|
+
const PROPS_MODIFIER = ['m', 'modifier'];
|
|
1878
|
+
function resolveLinkedModifier(node) {
|
|
1879
|
+
return resolveProps(node, PROPS_MODIFIER);
|
|
1880
|
+
}
|
|
1881
|
+
const PROPS_KEY = ['k', 'key'];
|
|
1882
|
+
function resolveLinkedKey(node) {
|
|
1883
|
+
const resolved = resolveProps(node, PROPS_KEY);
|
|
1884
|
+
if (resolved) {
|
|
1885
|
+
return resolved;
|
|
1886
|
+
}
|
|
1887
|
+
else {
|
|
1888
|
+
throw createUnhandleNodeError(6 /* NodeTypes.Linked */);
|
|
1889
|
+
}
|
|
1890
|
+
}
|
|
1891
|
+
function resolveProps(node, props, defaultValue) {
|
|
1892
|
+
for (let i = 0; i < props.length; i++) {
|
|
1893
|
+
const prop = props[i];
|
|
1894
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1895
|
+
if (hasOwn(node, prop) && node[prop] != null) {
|
|
1896
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1897
|
+
return node[prop];
|
|
1898
|
+
}
|
|
1899
|
+
}
|
|
1900
|
+
return defaultValue;
|
|
1901
|
+
}
|
|
1902
|
+
const AST_NODE_PROPS_KEYS = [
|
|
1903
|
+
...PROPS_BODY,
|
|
1904
|
+
...PROPS_CASES,
|
|
1905
|
+
...PROPS_STATIC,
|
|
1906
|
+
...PROPS_ITEMS,
|
|
1907
|
+
...PROPS_KEY,
|
|
1908
|
+
...PROPS_MODIFIER,
|
|
1909
|
+
...PROPS_VALUE,
|
|
1910
|
+
...PROPS_TYPE
|
|
1911
|
+
];
|
|
1912
|
+
function createUnhandleNodeError(type) {
|
|
1913
|
+
return new Error(`unhandled node type: ${type}`);
|
|
1914
|
+
}
|
|
1915
|
+
|
|
1842
1916
|
const pathStateMachine = [];
|
|
1843
1917
|
pathStateMachine[0 /* States.BEFORE_PATH */] = {
|
|
1844
1918
|
["w" /* PathCharTypes.WORKSPACE */]: [0 /* States.BEFORE_PATH */],
|
|
@@ -2072,7 +2146,7 @@ function resolveWithKeyValue(obj, path) {
|
|
|
2072
2146
|
*
|
|
2073
2147
|
* @VueI18nGeneral
|
|
2074
2148
|
*/
|
|
2075
|
-
function resolveValue
|
|
2149
|
+
function resolveValue(obj, path) {
|
|
2076
2150
|
// check object
|
|
2077
2151
|
if (!isObject(obj)) {
|
|
2078
2152
|
return null;
|
|
@@ -2094,7 +2168,16 @@ function resolveValue$1(obj, path) {
|
|
|
2094
2168
|
let last = obj;
|
|
2095
2169
|
let i = 0;
|
|
2096
2170
|
while (i < len) {
|
|
2097
|
-
const
|
|
2171
|
+
const key = hit[i];
|
|
2172
|
+
/**
|
|
2173
|
+
* NOTE:
|
|
2174
|
+
* if `key` is intlify message format AST node key and `last` is intlify message format AST, skip it.
|
|
2175
|
+
* because the AST node is not a key-value structure.
|
|
2176
|
+
*/
|
|
2177
|
+
if (AST_NODE_PROPS_KEYS.includes(key) && isMessageAST(last)) {
|
|
2178
|
+
return null;
|
|
2179
|
+
}
|
|
2180
|
+
const val = last[key];
|
|
2098
2181
|
if (val === undefined) {
|
|
2099
2182
|
return null;
|
|
2100
2183
|
}
|
|
@@ -2463,7 +2546,7 @@ function appendItemToChain(chain, target, blocks) {
|
|
|
2463
2546
|
* Intlify core-base version
|
|
2464
2547
|
* @internal
|
|
2465
2548
|
*/
|
|
2466
|
-
const VERSION$1 = '9.14.
|
|
2549
|
+
const VERSION$1 = '9.14.4';
|
|
2467
2550
|
const NOT_REOSLVED = -1;
|
|
2468
2551
|
const DEFAULT_LOCALE = 'en-US';
|
|
2469
2552
|
const MISSING_RESOLVE_VALUE = '';
|
|
@@ -2735,14 +2818,6 @@ function formatParts(ctx, ast) {
|
|
|
2735
2818
|
return formatMessageParts(ctx, body);
|
|
2736
2819
|
}
|
|
2737
2820
|
}
|
|
2738
|
-
const PROPS_BODY = ['b', 'body'];
|
|
2739
|
-
function resolveBody(node) {
|
|
2740
|
-
return resolveProps(node, PROPS_BODY);
|
|
2741
|
-
}
|
|
2742
|
-
const PROPS_CASES = ['c', 'cases'];
|
|
2743
|
-
function resolveCases(node) {
|
|
2744
|
-
return resolveProps(node, PROPS_CASES, []);
|
|
2745
|
-
}
|
|
2746
2821
|
function formatMessageParts(ctx, node) {
|
|
2747
2822
|
const static_ = resolveStatic(node);
|
|
2748
2823
|
if (static_ != null) {
|
|
@@ -2755,22 +2830,14 @@ function formatMessageParts(ctx, node) {
|
|
|
2755
2830
|
return ctx.normalize(messages);
|
|
2756
2831
|
}
|
|
2757
2832
|
}
|
|
2758
|
-
const PROPS_STATIC = ['s', 'static'];
|
|
2759
|
-
function resolveStatic(node) {
|
|
2760
|
-
return resolveProps(node, PROPS_STATIC);
|
|
2761
|
-
}
|
|
2762
|
-
const PROPS_ITEMS = ['i', 'items'];
|
|
2763
|
-
function resolveItems(node) {
|
|
2764
|
-
return resolveProps(node, PROPS_ITEMS, []);
|
|
2765
|
-
}
|
|
2766
2833
|
function formatMessagePart(ctx, node) {
|
|
2767
2834
|
const type = resolveType(node);
|
|
2768
2835
|
switch (type) {
|
|
2769
2836
|
case 3 /* NodeTypes.Text */: {
|
|
2770
|
-
return resolveValue(node, type);
|
|
2837
|
+
return resolveValue$1(node, type);
|
|
2771
2838
|
}
|
|
2772
2839
|
case 9 /* NodeTypes.Literal */: {
|
|
2773
|
-
return resolveValue(node, type);
|
|
2840
|
+
return resolveValue$1(node, type);
|
|
2774
2841
|
}
|
|
2775
2842
|
case 4 /* NodeTypes.Named */: {
|
|
2776
2843
|
const named = node;
|
|
@@ -2799,57 +2866,15 @@ function formatMessagePart(ctx, node) {
|
|
|
2799
2866
|
return ctx.linked(formatMessagePart(ctx, key), modifier ? formatMessagePart(ctx, modifier) : undefined, ctx.type);
|
|
2800
2867
|
}
|
|
2801
2868
|
case 7 /* NodeTypes.LinkedKey */: {
|
|
2802
|
-
return resolveValue(node, type);
|
|
2869
|
+
return resolveValue$1(node, type);
|
|
2803
2870
|
}
|
|
2804
2871
|
case 8 /* NodeTypes.LinkedModifier */: {
|
|
2805
|
-
return resolveValue(node, type);
|
|
2872
|
+
return resolveValue$1(node, type);
|
|
2806
2873
|
}
|
|
2807
2874
|
default:
|
|
2808
2875
|
throw new Error(`unhandled node on format message part: ${type}`);
|
|
2809
2876
|
}
|
|
2810
2877
|
}
|
|
2811
|
-
const PROPS_TYPE = ['t', 'type'];
|
|
2812
|
-
function resolveType(node) {
|
|
2813
|
-
return resolveProps(node, PROPS_TYPE);
|
|
2814
|
-
}
|
|
2815
|
-
const PROPS_VALUE = ['v', 'value'];
|
|
2816
|
-
function resolveValue(node, type) {
|
|
2817
|
-
const resolved = resolveProps(node, PROPS_VALUE);
|
|
2818
|
-
if (resolved) {
|
|
2819
|
-
return resolved;
|
|
2820
|
-
}
|
|
2821
|
-
else {
|
|
2822
|
-
throw createUnhandleNodeError(type);
|
|
2823
|
-
}
|
|
2824
|
-
}
|
|
2825
|
-
const PROPS_MODIFIER = ['m', 'modifier'];
|
|
2826
|
-
function resolveLinkedModifier(node) {
|
|
2827
|
-
return resolveProps(node, PROPS_MODIFIER);
|
|
2828
|
-
}
|
|
2829
|
-
const PROPS_KEY = ['k', 'key'];
|
|
2830
|
-
function resolveLinkedKey(node) {
|
|
2831
|
-
const resolved = resolveProps(node, PROPS_KEY);
|
|
2832
|
-
if (resolved) {
|
|
2833
|
-
return resolved;
|
|
2834
|
-
}
|
|
2835
|
-
else {
|
|
2836
|
-
throw createUnhandleNodeError(6 /* NodeTypes.Linked */);
|
|
2837
|
-
}
|
|
2838
|
-
}
|
|
2839
|
-
function resolveProps(node, props, defaultValue) {
|
|
2840
|
-
for (let i = 0; i < props.length; i++) {
|
|
2841
|
-
const prop = props[i];
|
|
2842
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2843
|
-
if (hasOwn(node, prop) && node[prop] != null) {
|
|
2844
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2845
|
-
return node[prop];
|
|
2846
|
-
}
|
|
2847
|
-
}
|
|
2848
|
-
return defaultValue;
|
|
2849
|
-
}
|
|
2850
|
-
function createUnhandleNodeError(type) {
|
|
2851
|
-
return new Error(`unhandled node type: ${type}`);
|
|
2852
|
-
}
|
|
2853
2878
|
|
|
2854
2879
|
const WARN_MESSAGE = `Detected HTML in '{source}' message. Recommend not using HTML messages to avoid XSS.`;
|
|
2855
2880
|
function checkHtmlMessage(source, warnHtmlMessage) {
|
|
@@ -2867,11 +2892,6 @@ function onCompileWarn(_warn) {
|
|
|
2867
2892
|
`(message compiler warning message: ${_warn.message})`);
|
|
2868
2893
|
}
|
|
2869
2894
|
}
|
|
2870
|
-
function isMessageAST(val) {
|
|
2871
|
-
return (isObject(val) &&
|
|
2872
|
-
resolveType(val) === 0 &&
|
|
2873
|
-
(hasOwn(val, 'b') || hasOwn(val, 'body')));
|
|
2874
|
-
}
|
|
2875
2895
|
function baseCompile(message, options = {}) {
|
|
2876
2896
|
// error detecting on compile
|
|
2877
2897
|
let detectError = false;
|
|
@@ -3678,7 +3698,7 @@ function clearNumberFormat(ctx, locale, format) {
|
|
|
3678
3698
|
*
|
|
3679
3699
|
* @VueI18nGeneral
|
|
3680
3700
|
*/
|
|
3681
|
-
const VERSION = '9.14.
|
|
3701
|
+
const VERSION = '9.14.4';
|
|
3682
3702
|
/**
|
|
3683
3703
|
* This is only called development env
|
|
3684
3704
|
* istanbul-ignore-next
|
|
@@ -3793,6 +3813,9 @@ function handleFlatJson(obj) {
|
|
|
3793
3813
|
if (!isObject(obj)) {
|
|
3794
3814
|
return obj;
|
|
3795
3815
|
}
|
|
3816
|
+
if (isMessageAST(obj)) {
|
|
3817
|
+
return obj;
|
|
3818
|
+
}
|
|
3796
3819
|
for (const key in obj) {
|
|
3797
3820
|
// check key
|
|
3798
3821
|
if (!hasOwn(obj, key)) {
|
|
@@ -3813,6 +3836,9 @@ function handleFlatJson(obj) {
|
|
|
3813
3836
|
let currentObj = obj;
|
|
3814
3837
|
let hasStringValue = false;
|
|
3815
3838
|
for (let i = 0; i < lastIndex; i++) {
|
|
3839
|
+
if (subKeys[i] === '__proto__') {
|
|
3840
|
+
throw new Error(`unsafe key: ${subKeys[i]}`);
|
|
3841
|
+
}
|
|
3816
3842
|
if (!(subKeys[i] in currentObj)) {
|
|
3817
3843
|
currentObj[subKeys[i]] = create();
|
|
3818
3844
|
}
|
|
@@ -3827,12 +3853,26 @@ function handleFlatJson(obj) {
|
|
|
3827
3853
|
}
|
|
3828
3854
|
// update last object value, delete old property
|
|
3829
3855
|
if (!hasStringValue) {
|
|
3830
|
-
currentObj
|
|
3831
|
-
|
|
3856
|
+
if (!isMessageAST(currentObj)) {
|
|
3857
|
+
currentObj[subKeys[lastIndex]] = obj[key];
|
|
3858
|
+
delete obj[key];
|
|
3859
|
+
}
|
|
3860
|
+
else {
|
|
3861
|
+
/**
|
|
3862
|
+
* NOTE:
|
|
3863
|
+
* if the last object is a message AST and subKeys[lastIndex] has message AST prop key, ignore to copy and key deletion
|
|
3864
|
+
*/
|
|
3865
|
+
if (!AST_NODE_PROPS_KEYS.includes(subKeys[lastIndex])) {
|
|
3866
|
+
delete obj[key];
|
|
3867
|
+
}
|
|
3868
|
+
}
|
|
3832
3869
|
}
|
|
3833
3870
|
// recursive process value if value is also a object
|
|
3834
|
-
if (
|
|
3835
|
-
|
|
3871
|
+
if (!isMessageAST(currentObj)) {
|
|
3872
|
+
const target = currentObj[subKeys[lastIndex]];
|
|
3873
|
+
if (isObject(target)) {
|
|
3874
|
+
handleFlatJson(target);
|
|
3875
|
+
}
|
|
3836
3876
|
}
|
|
3837
3877
|
}
|
|
3838
3878
|
}
|
|
@@ -6748,7 +6788,7 @@ function injectGlobalFields(app, composer) {
|
|
|
6748
6788
|
registerMessageCompiler(compile);
|
|
6749
6789
|
}
|
|
6750
6790
|
// register message resolver at vue-i18n
|
|
6751
|
-
registerMessageResolver(resolveValue
|
|
6791
|
+
registerMessageResolver(resolveValue);
|
|
6752
6792
|
// register fallback locale at vue-i18n
|
|
6753
6793
|
registerLocaleFallbacker(fallbackWithLocaleChain);
|
|
6754
6794
|
// NOTE: experimental !!
|