@intlify/core-base 9.13.1 → 10.0.0-alpha.2
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/core-base.cjs +12 -29
- package/dist/core-base.d.ts +2 -2
- package/dist/core-base.esm-browser.js +65 -164
- package/dist/core-base.esm-browser.prod.js +2 -2
- package/dist/core-base.global.js +65 -164
- package/dist/core-base.global.prod.js +2 -2
- package/dist/core-base.mjs +13 -30
- package/dist/core-base.prod.cjs +12 -13
- package/package.json +5 -5
package/dist/core-base.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* core-base
|
|
2
|
+
* core-base v10.0.0-alpha.2
|
|
3
3
|
* (c) 2024 kazuya kawaguchi
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -428,17 +428,17 @@ function createDevToolsHook(hook) {
|
|
|
428
428
|
return (payloads) => devtools && devtools.emit(hook, payloads);
|
|
429
429
|
}
|
|
430
430
|
|
|
431
|
-
const code$1 =
|
|
431
|
+
const code$1 = 1;
|
|
432
432
|
const inc$1 = shared.incrementer(code$1);
|
|
433
433
|
const CoreWarnCodes = {
|
|
434
|
-
NOT_FOUND_KEY: code$1, //
|
|
435
|
-
FALLBACK_TO_TRANSLATE: inc$1(), //
|
|
436
|
-
CANNOT_FORMAT_NUMBER: inc$1(), //
|
|
437
|
-
FALLBACK_TO_NUMBER_FORMAT: inc$1(), //
|
|
438
|
-
CANNOT_FORMAT_DATE: inc$1(), //
|
|
439
|
-
FALLBACK_TO_DATE_FORMAT: inc$1(), //
|
|
440
|
-
EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER: inc$1(), //
|
|
441
|
-
__EXTEND_POINT__: inc$1() //
|
|
434
|
+
NOT_FOUND_KEY: code$1, // 1
|
|
435
|
+
FALLBACK_TO_TRANSLATE: inc$1(), // 2
|
|
436
|
+
CANNOT_FORMAT_NUMBER: inc$1(), // 3
|
|
437
|
+
FALLBACK_TO_NUMBER_FORMAT: inc$1(), // 4
|
|
438
|
+
CANNOT_FORMAT_DATE: inc$1(), // 5
|
|
439
|
+
FALLBACK_TO_DATE_FORMAT: inc$1(), // 6
|
|
440
|
+
EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER: inc$1(), // 7
|
|
441
|
+
__EXTEND_POINT__: inc$1() // 8
|
|
442
442
|
};
|
|
443
443
|
/** @internal */
|
|
444
444
|
const warnMessages = {
|
|
@@ -530,8 +530,7 @@ function resolveLocale(locale) {
|
|
|
530
530
|
*
|
|
531
531
|
* @VueI18nGeneral
|
|
532
532
|
*/
|
|
533
|
-
function fallbackWithSimple(ctx, fallback, start
|
|
534
|
-
) {
|
|
533
|
+
function fallbackWithSimple(ctx, fallback, start) {
|
|
535
534
|
// prettier-ignore
|
|
536
535
|
return [...new Set([
|
|
537
536
|
start,
|
|
@@ -635,7 +634,7 @@ function appendItemToChain(chain, target, blocks) {
|
|
|
635
634
|
* Intlify core-base version
|
|
636
635
|
* @internal
|
|
637
636
|
*/
|
|
638
|
-
const VERSION = '
|
|
637
|
+
const VERSION = '10.0.0-alpha.2';
|
|
639
638
|
const NOT_REOSLVED = -1;
|
|
640
639
|
const DEFAULT_LOCALE = 'en-US';
|
|
641
640
|
const MISSING_RESOLVE_VALUE = '';
|
|
@@ -959,14 +958,6 @@ function checkHtmlMessage(source, warnHtmlMessage) {
|
|
|
959
958
|
}
|
|
960
959
|
const defaultOnCacheKey = (message) => message;
|
|
961
960
|
let compileCache = Object.create(null);
|
|
962
|
-
function onCompileWarn(_warn) {
|
|
963
|
-
if (_warn.code === messageCompiler.CompileWarnCodes.USE_MODULO_SYNTAX) {
|
|
964
|
-
shared.warn(`The use of named interpolation with modulo syntax is deprecated. ` +
|
|
965
|
-
`It will be removed in v10.\n` +
|
|
966
|
-
`reference: https://vue-i18n.intlify.dev/guide/essentials/syntax#rails-i18n-format \n` +
|
|
967
|
-
`(message compiler warning message: ${_warn.message})`);
|
|
968
|
-
}
|
|
969
|
-
}
|
|
970
961
|
function clearCompileCache() {
|
|
971
962
|
compileCache = Object.create(null);
|
|
972
963
|
}
|
|
@@ -989,10 +980,6 @@ const compileToFunction = (message, context) => {
|
|
|
989
980
|
if (!shared.isString(message)) {
|
|
990
981
|
throw createCoreError(CoreErrorCodes.NOT_SUPPORT_NON_STRING_MESSAGE);
|
|
991
982
|
}
|
|
992
|
-
// set onWarn
|
|
993
|
-
{
|
|
994
|
-
context.onWarn = onCompileWarn;
|
|
995
|
-
}
|
|
996
983
|
{
|
|
997
984
|
// check HTML message
|
|
998
985
|
const warnHtmlMessage = shared.isBoolean(context.warnHtmlMessage)
|
|
@@ -1017,10 +1004,6 @@ const compileToFunction = (message, context) => {
|
|
|
1017
1004
|
}
|
|
1018
1005
|
};
|
|
1019
1006
|
function compile(message, context) {
|
|
1020
|
-
// set onWarn
|
|
1021
|
-
{
|
|
1022
|
-
context.onWarn = onCompileWarn;
|
|
1023
|
-
}
|
|
1024
1007
|
if (shared.isString(message)) {
|
|
1025
1008
|
// check HTML message
|
|
1026
1009
|
const warnHtmlMessage = shared.isBoolean(context.warnHtmlMessage)
|
package/dist/core-base.d.ts
CHANGED
|
@@ -167,7 +167,7 @@ export declare interface CoreTranslationContext<Messages = {}, Message = string>
|
|
|
167
167
|
}
|
|
168
168
|
|
|
169
169
|
export declare const CoreWarnCodes: {
|
|
170
|
-
readonly NOT_FOUND_KEY:
|
|
170
|
+
readonly NOT_FOUND_KEY: 1;
|
|
171
171
|
readonly FALLBACK_TO_TRANSLATE: number;
|
|
172
172
|
readonly CANNOT_FORMAT_NUMBER: number;
|
|
173
173
|
readonly FALLBACK_TO_NUMBER_FORMAT: number;
|
|
@@ -565,7 +565,7 @@ export declare type MessageCompiler<Message = string, MessageSource = string | R
|
|
|
565
565
|
*
|
|
566
566
|
* @VueI18nGeneral
|
|
567
567
|
*/
|
|
568
|
-
export declare type MessageCompilerContext = Pick<CompileOptions, 'onError' | 'onCacheKey'
|
|
568
|
+
export declare type MessageCompilerContext = Pick<CompileOptions, 'onError' | 'onCacheKey'> & {
|
|
569
569
|
/**
|
|
570
570
|
* Whether to allow the use locale messages of HTML formatting.
|
|
571
571
|
*/
|