vue-i18n 9.10.0 → 9.10.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/vue-i18n.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * vue-i18n v9.10.0
2
+ * vue-i18n v9.10.2
3
3
  * (c) 2024 kazuya kawaguchi
4
4
  * Released under the MIT License.
5
5
  */
@@ -17,7 +17,7 @@ var vue = require('vue');
17
17
  *
18
18
  * @VueI18nGeneral
19
19
  */
20
- const VERSION = '9.10.0';
20
+ const VERSION = '9.10.2';
21
21
 
22
22
  const code$1 = coreBase.CoreWarnCodes.__EXTEND_POINT__;
23
23
  const inc$1 = shared.incrementer(code$1);
@@ -300,7 +300,7 @@ export declare interface Composer<Messages extends Record<string, any> = {}, Dat
300
300
  * @param key - A target locale message key
301
301
  * @param locale - A locale, it will be used over than global scope or local scope
302
302
  *
303
- * @returns If found locale message, `true`, else `false`, Note that `false` is returned even if the value present in the key is not translatable, yet if `translateExistCompatible` is set to `true`, it will return `true` if the key is available, even if the value is translatable.
303
+ * @returns If found locale message, `true`, else `false`, Note that `false` is returned even if the value present in the key is not translatable, yet if `translateExistCompatible` is set to `true`, it will return `true` if the key is available, even if the value is not translatable.
304
304
  */
305
305
  te<Str extends string, Key extends PickupKeys<Messages> = PickupKeys<Messages>>(key: Str | Key, locale?: Locales): boolean;
306
306
  /**
@@ -3958,7 +3958,7 @@ declare module '@vue/runtime-core' {
3958
3958
  * @param key - A target locale message key
3959
3959
  * @param locale - A locale, optional, override locale that global scope or local scope
3960
3960
  *
3961
- * @returns If found locale message, `true`, else `false`, Note that `false` is returned even if the value present in the key is not translatable, yet if `translateExistCompatible` is set to `true`, it will return `true` if the key is available, even if the value is translatable.
3961
+ * @returns If found locale message, `true`, else `false`, Note that `false` is returned even if the value present in the key is not translatable, yet if `translateExistCompatible` is set to `true`, it will return `true` if the key is available, even if the value is not translatable.
3962
3962
  */
3963
3963
  $te<
3964
3964
  Key extends string,
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * vue-i18n v9.10.0
2
+ * vue-i18n v9.10.2
3
3
  * (c) 2024 kazuya kawaguchi
4
4
  * Released under the MIT License.
5
5
  */
@@ -315,6 +315,7 @@ function defaultOnError(error) {
315
315
  throw error;
316
316
  }
317
317
 
318
+ // eslint-disable-next-line no-useless-escape
318
319
  const RE_HTML_TAG = /<\/?[\w\s="/.':;#-\/]+>/;
319
320
  const detectHtmlTag = (source) => RE_HTML_TAG.test(source);
320
321
 
@@ -688,6 +689,7 @@ function createTokenizer(source, options = {}) {
688
689
  }
689
690
  function readText(scnr) {
690
691
  let buf = '';
692
+ // eslint-disable-next-line no-constant-condition
691
693
  while (true) {
692
694
  const ch = scnr.currentChar();
693
695
  if (ch === "{" /* TokenChars.BraceLeft */ ||
@@ -755,6 +757,7 @@ function createTokenizer(source, options = {}) {
755
757
  }
756
758
  function readLiteral(scnr) {
757
759
  skipSpaces(scnr);
760
+ // eslint-disable-next-line no-useless-escape
758
761
  eat(scnr, `\'`);
759
762
  let ch = '';
760
763
  let literal = '';
@@ -773,10 +776,12 @@ function createTokenizer(source, options = {}) {
773
776
  // TODO: Is it correct really?
774
777
  if (current === CHAR_LF) {
775
778
  scnr.next();
779
+ // eslint-disable-next-line no-useless-escape
776
780
  eat(scnr, `\'`);
777
781
  }
778
782
  return literal;
779
783
  }
784
+ // eslint-disable-next-line no-useless-escape
780
785
  eat(scnr, `\'`);
781
786
  return literal;
782
787
  }
@@ -784,7 +789,7 @@ function createTokenizer(source, options = {}) {
784
789
  const ch = scnr.currentChar();
785
790
  switch (ch) {
786
791
  case '\\':
787
- case `\'`:
792
+ case `\'`: // eslint-disable-line no-useless-escape
788
793
  scnr.next();
789
794
  return `\\${ch}`;
790
795
  case 'u':
@@ -898,7 +903,7 @@ function createTokenizer(source, options = {}) {
898
903
  token = readTokenInLinked(scnr, context) || getEndToken(context);
899
904
  context.braceNest = 0;
900
905
  return token;
901
- default:
906
+ default: {
902
907
  let validNamedIdentifier = true;
903
908
  let validListIdentifier = true;
904
909
  let validLiteral = true;
@@ -943,6 +948,7 @@ function createTokenizer(source, options = {}) {
943
948
  return token;
944
949
  }
945
950
  break;
951
+ }
946
952
  }
947
953
  return token;
948
954
  }
@@ -1026,7 +1032,7 @@ function createTokenizer(source, options = {}) {
1026
1032
  return getToken(context, 3 /* TokenTypes.BraceRight */, "}" /* TokenChars.BraceRight */);
1027
1033
  case "@" /* TokenChars.LinkedAlias */:
1028
1034
  return readTokenInLinked(scnr, context) || getEndToken(context);
1029
- default:
1035
+ default: {
1030
1036
  if (isPluralStart(scnr)) {
1031
1037
  token = getToken(context, 1 /* TokenTypes.Pipe */, readPlural(scnr));
1032
1038
  // reset
@@ -1044,6 +1050,7 @@ function createTokenizer(source, options = {}) {
1044
1050
  return getToken(context, 0 /* TokenTypes.Text */, readText(scnr));
1045
1051
  }
1046
1052
  break;
1053
+ }
1047
1054
  }
1048
1055
  return token;
1049
1056
  }
@@ -1075,7 +1082,9 @@ function fromEscapeSequence(match, codePoint4, codePoint6) {
1075
1082
  switch (match) {
1076
1083
  case `\\\\`:
1077
1084
  return `\\`;
1085
+ // eslint-disable-next-line no-useless-escape
1078
1086
  case `\\\'`:
1087
+ // eslint-disable-next-line no-useless-escape
1079
1088
  return `\'`;
1080
1089
  default: {
1081
1090
  const codePoint = parseInt(codePoint4 || codePoint6, 16);
@@ -1233,7 +1242,7 @@ function createParser(options = {}) {
1233
1242
  }
1234
1243
  linkedNode.key = parseLiteral(tokenizer, token.value || '');
1235
1244
  break;
1236
- default:
1245
+ default: {
1237
1246
  // empty key
1238
1247
  emitError(tokenizer, CompileErrorCodes.UNEXPECTED_EMPTY_LINKED_KEY, context.lastStartLoc, 0);
1239
1248
  const nextContext = tokenizer.context();
@@ -1246,6 +1255,7 @@ function createParser(options = {}) {
1246
1255
  nextConsumeToken: token,
1247
1256
  node: linkedNode
1248
1257
  };
1258
+ }
1249
1259
  }
1250
1260
  endNode(linkedNode, tokenizer.currentOffset(), tokenizer.currentPosition());
1251
1261
  return {
@@ -1291,11 +1301,12 @@ function createParser(options = {}) {
1291
1301
  }
1292
1302
  node.items.push(parseLiteral(tokenizer, token.value || ''));
1293
1303
  break;
1294
- case 8 /* TokenTypes.LinkedAlias */:
1304
+ case 8 /* TokenTypes.LinkedAlias */: {
1295
1305
  const parsed = parseLinked(tokenizer);
1296
1306
  node.items.push(parsed.node);
1297
1307
  nextToken = parsed.nextConsumeToken || null;
1298
1308
  break;
1309
+ }
1299
1310
  }
1300
1311
  } while (context.currentType !== 14 /* TokenTypes.EOF */ &&
1301
1312
  context.currentType !== 1 /* TokenTypes.Pipe */);
@@ -1395,12 +1406,13 @@ function traverseNode(node, transformer) {
1395
1406
  case 2 /* NodeTypes.Message */:
1396
1407
  traverseNodes(node.items, transformer);
1397
1408
  break;
1398
- case 6 /* NodeTypes.Linked */:
1409
+ case 6 /* NodeTypes.Linked */: {
1399
1410
  const linked = node;
1400
1411
  traverseNode(linked.key, transformer);
1401
1412
  transformer.helper("linked" /* HelperNameMap.LINKED */);
1402
1413
  transformer.helper("type" /* HelperNameMap.TYPE */);
1403
1414
  break;
1415
+ }
1404
1416
  case 5 /* NodeTypes.List */:
1405
1417
  transformer.helper("interpolate" /* HelperNameMap.INTERPOLATE */);
1406
1418
  transformer.helper("list" /* HelperNameMap.LIST */);
@@ -1471,13 +1483,14 @@ const ERROR_DOMAIN$1 = 'minifier';
1471
1483
  function minify(node) {
1472
1484
  node.t = node.type;
1473
1485
  switch (node.type) {
1474
- case 0 /* NodeTypes.Resource */:
1486
+ case 0 /* NodeTypes.Resource */: {
1475
1487
  const resource = node;
1476
1488
  minify(resource.body);
1477
1489
  resource.b = resource.body;
1478
1490
  delete resource.body;
1479
1491
  break;
1480
- case 1 /* NodeTypes.Plural */:
1492
+ }
1493
+ case 1 /* NodeTypes.Plural */: {
1481
1494
  const plural = node;
1482
1495
  const cases = plural.cases;
1483
1496
  for (let i = 0; i < cases.length; i++) {
@@ -1486,7 +1499,8 @@ function minify(node) {
1486
1499
  plural.c = cases;
1487
1500
  delete plural.cases;
1488
1501
  break;
1489
- case 2 /* NodeTypes.Message */:
1502
+ }
1503
+ case 2 /* NodeTypes.Message */: {
1490
1504
  const message = node;
1491
1505
  const items = message.items;
1492
1506
  for (let i = 0; i < items.length; i++) {
@@ -1499,17 +1513,19 @@ function minify(node) {
1499
1513
  delete message.static;
1500
1514
  }
1501
1515
  break;
1516
+ }
1502
1517
  case 3 /* NodeTypes.Text */:
1503
1518
  case 9 /* NodeTypes.Literal */:
1504
1519
  case 8 /* NodeTypes.LinkedModifier */:
1505
- case 7 /* NodeTypes.LinkedKey */:
1520
+ case 7 /* NodeTypes.LinkedKey */: {
1506
1521
  const valueNode = node;
1507
1522
  if (valueNode.value) {
1508
1523
  valueNode.v = valueNode.value;
1509
1524
  delete valueNode.value;
1510
1525
  }
1511
1526
  break;
1512
- case 6 /* NodeTypes.Linked */:
1527
+ }
1528
+ case 6 /* NodeTypes.Linked */: {
1513
1529
  const linked = node;
1514
1530
  minify(linked.key);
1515
1531
  linked.k = linked.key;
@@ -1520,16 +1536,19 @@ function minify(node) {
1520
1536
  delete linked.modifier;
1521
1537
  }
1522
1538
  break;
1523
- case 5 /* NodeTypes.List */:
1539
+ }
1540
+ case 5 /* NodeTypes.List */: {
1524
1541
  const list = node;
1525
1542
  list.i = list.index;
1526
1543
  delete list.index;
1527
1544
  break;
1528
- case 4 /* NodeTypes.Named */:
1545
+ }
1546
+ case 4 /* NodeTypes.Named */: {
1529
1547
  const named = node;
1530
1548
  named.k = named.key;
1531
1549
  delete named.key;
1532
1550
  break;
1551
+ }
1533
1552
  default:
1534
1553
  {
1535
1554
  throw createCompileError(CompileErrorCodes.UNHANDLED_MINIFIER_NODE_TYPE, null, {
@@ -1542,6 +1561,8 @@ function minify(node) {
1542
1561
  }
1543
1562
  /* eslint-enable @typescript-eslint/no-explicit-any */
1544
1563
 
1564
+ // eslint-disable-next-line @typescript-eslint/triple-slash-reference
1565
+ /// <reference types="source-map-js" />
1545
1566
  const ERROR_DOMAIN = 'parser';
1546
1567
  function createCodeGenerator(ast, options) {
1547
1568
  const { sourceMap, filename, breakLineCode, needIndent: _needIndent } = options;
@@ -2375,7 +2396,7 @@ function appendItemToChain(chain, target, blocks) {
2375
2396
  * Intlify core-base version
2376
2397
  * @internal
2377
2398
  */
2378
- const VERSION$1 = '9.10.0';
2399
+ const VERSION$1 = '9.10.2';
2379
2400
  const NOT_REOSLVED = -1;
2380
2401
  const DEFAULT_LOCALE = 'en-US';
2381
2402
  const MISSING_RESOLVE_VALUE = '';
@@ -2638,28 +2659,35 @@ function formatMessageParts(ctx, node) {
2638
2659
  function formatMessagePart(ctx, node) {
2639
2660
  const type = node.t || node.type;
2640
2661
  switch (type) {
2641
- case 3 /* NodeTypes.Text */:
2662
+ case 3 /* NodeTypes.Text */: {
2642
2663
  const text = node;
2643
2664
  return (text.v || text.value);
2644
- case 9 /* NodeTypes.Literal */:
2665
+ }
2666
+ case 9 /* NodeTypes.Literal */: {
2645
2667
  const literal = node;
2646
2668
  return (literal.v || literal.value);
2647
- case 4 /* NodeTypes.Named */:
2669
+ }
2670
+ case 4 /* NodeTypes.Named */: {
2648
2671
  const named = node;
2649
2672
  return ctx.interpolate(ctx.named(named.k || named.key));
2650
- case 5 /* NodeTypes.List */:
2673
+ }
2674
+ case 5 /* NodeTypes.List */: {
2651
2675
  const list = node;
2652
2676
  return ctx.interpolate(ctx.list(list.i != null ? list.i : list.index));
2653
- case 6 /* NodeTypes.Linked */:
2677
+ }
2678
+ case 6 /* NodeTypes.Linked */: {
2654
2679
  const linked = node;
2655
2680
  const modifier = linked.m || linked.modifier;
2656
2681
  return ctx.linked(formatMessagePart(ctx, linked.k || linked.key), modifier ? formatMessagePart(ctx, modifier) : undefined, ctx.type);
2657
- case 7 /* NodeTypes.LinkedKey */:
2682
+ }
2683
+ case 7 /* NodeTypes.LinkedKey */: {
2658
2684
  const linkedKey = node;
2659
2685
  return (linkedKey.v || linkedKey.value);
2660
- case 8 /* NodeTypes.LinkedModifier */:
2686
+ }
2687
+ case 8 /* NodeTypes.LinkedModifier */: {
2661
2688
  const linkedModifier = node;
2662
2689
  return (linkedModifier.v || linkedModifier.value);
2690
+ }
2663
2691
  default:
2664
2692
  throw new Error(`unhandled node type on format message part: ${type}`);
2665
2693
  }
@@ -3475,7 +3503,7 @@ function clearNumberFormat(ctx, locale, format) {
3475
3503
  *
3476
3504
  * @VueI18nGeneral
3477
3505
  */
3478
- const VERSION = '9.10.0';
3506
+ const VERSION = '9.10.2';
3479
3507
  /**
3480
3508
  * This is only called development env
3481
3509
  * istanbul-ignore-next