@intlify/core-base 9.13.0 → 10.0.0-alpha.1

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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * core-base v9.13.0
2
+ * core-base v10.0.0-alpha.1
3
3
  * (c) 2024 kazuya kawaguchi
4
4
  * Released under the MIT License.
5
5
  */
@@ -161,23 +161,6 @@ function createLocation(start, end, source) {
161
161
  return loc;
162
162
  }
163
163
 
164
- const CompileWarnCodes = {
165
- USE_MODULO_SYNTAX: 1,
166
- __EXTEND_POINT__: 2
167
- };
168
- /** @internal */
169
- const warnMessages$1 = {
170
- [CompileWarnCodes.USE_MODULO_SYNTAX]: `Use modulo before '{{0}}'.`
171
- };
172
- function createCompileWarn(code, loc, ...args) {
173
- const msg = format$1(warnMessages$1[code] || '', ...(args || [])) ;
174
- const message = { message: String(msg), code };
175
- if (loc) {
176
- message.location = loc;
177
- }
178
- return message;
179
- }
180
-
181
164
  const CompileErrorCodes = {
182
165
  // tokenizer error codes
183
166
  EXPECTED_TOKEN: 1,
@@ -302,7 +285,6 @@ function createScanner(str) {
302
285
  }
303
286
  function skipToPeek() {
304
287
  const target = _index + _peekOffset;
305
- // eslint-disable-next-line no-unmodified-loop-condition
306
288
  while (target !== _index) {
307
289
  next();
308
290
  }
@@ -336,11 +318,11 @@ function createTokenizer(source, options = {}) {
336
318
  const _initLoc = currentPosition();
337
319
  const _initOffset = currentOffset();
338
320
  const _context = {
339
- currentType: 14 /* TokenTypes.EOF */,
321
+ currentType: 13 /* TokenTypes.EOF */,
340
322
  offset: _initOffset,
341
323
  startLoc: _initLoc,
342
324
  endLoc: _initLoc,
343
- lastType: 14 /* TokenTypes.EOF */,
325
+ lastType: 13 /* TokenTypes.EOF */,
344
326
  lastOffset: _initOffset,
345
327
  lastStartLoc: _initLoc,
346
328
  lastEndLoc: _initLoc,
@@ -375,7 +357,7 @@ function createTokenizer(source, options = {}) {
375
357
  }
376
358
  return token;
377
359
  }
378
- const getEndToken = (context) => getToken(context, 14 /* TokenTypes.EOF */);
360
+ const getEndToken = (context) => getToken(context, 13 /* TokenTypes.EOF */);
379
361
  function eat(scnr, ch) {
380
362
  if (scnr.currentChar() === ch) {
381
363
  scnr.next();
@@ -449,7 +431,7 @@ function createTokenizer(source, options = {}) {
449
431
  }
450
432
  function isLinkedDotStart(scnr, context) {
451
433
  const { currentType } = context;
452
- if (currentType !== 8 /* TokenTypes.LinkedAlias */) {
434
+ if (currentType !== 7 /* TokenTypes.LinkedAlias */) {
453
435
  return false;
454
436
  }
455
437
  peekSpaces(scnr);
@@ -459,7 +441,7 @@ function createTokenizer(source, options = {}) {
459
441
  }
460
442
  function isLinkedModifierStart(scnr, context) {
461
443
  const { currentType } = context;
462
- if (currentType !== 9 /* TokenTypes.LinkedDot */) {
444
+ if (currentType !== 8 /* TokenTypes.LinkedDot */) {
463
445
  return false;
464
446
  }
465
447
  peekSpaces(scnr);
@@ -469,8 +451,8 @@ function createTokenizer(source, options = {}) {
469
451
  }
470
452
  function isLinkedDelimiterStart(scnr, context) {
471
453
  const { currentType } = context;
472
- if (!(currentType === 8 /* TokenTypes.LinkedAlias */ ||
473
- currentType === 12 /* TokenTypes.LinkedModifier */)) {
454
+ if (!(currentType === 7 /* TokenTypes.LinkedAlias */ ||
455
+ currentType === 11 /* TokenTypes.LinkedModifier */)) {
474
456
  return false;
475
457
  }
476
458
  peekSpaces(scnr);
@@ -480,7 +462,7 @@ function createTokenizer(source, options = {}) {
480
462
  }
481
463
  function isLinkedReferStart(scnr, context) {
482
464
  const { currentType } = context;
483
- if (currentType !== 10 /* TokenTypes.LinkedDelimiter */) {
465
+ if (currentType !== 9 /* TokenTypes.LinkedDelimiter */) {
484
466
  return false;
485
467
  }
486
468
  const fn = () => {
@@ -489,7 +471,6 @@ function createTokenizer(source, options = {}) {
489
471
  return isIdentifierStart(scnr.peek());
490
472
  }
491
473
  else if (ch === "@" /* TokenChars.LinkedAlias */ ||
492
- ch === "%" /* TokenChars.Modulo */ ||
493
474
  ch === "|" /* TokenChars.Pipe */ ||
494
475
  ch === ":" /* TokenChars.LinkedDelimiter */ ||
495
476
  ch === "." /* TokenChars.LinkedDot */ ||
@@ -503,7 +484,7 @@ function createTokenizer(source, options = {}) {
503
484
  }
504
485
  else {
505
486
  // other characters
506
- return isIdentifierStart(ch);
487
+ return isTextStart(scnr, false);
507
488
  }
508
489
  };
509
490
  const ret = fn();
@@ -516,41 +497,25 @@ function createTokenizer(source, options = {}) {
516
497
  scnr.resetPeek();
517
498
  return ret;
518
499
  }
519
- function detectModuloStart(scnr) {
520
- const spaces = peekSpaces(scnr);
521
- const ret = scnr.currentPeek() === "%" /* TokenChars.Modulo */ &&
522
- scnr.peek() === "{" /* TokenChars.BraceLeft */;
523
- scnr.resetPeek();
524
- return {
525
- isModulo: ret,
526
- hasSpace: spaces.length > 0
527
- };
528
- }
529
500
  function isTextStart(scnr, reset = true) {
530
- const fn = (hasSpace = false, prev = '', detectModulo = false) => {
501
+ const fn = (hasSpace = false, prev = '') => {
531
502
  const ch = scnr.currentPeek();
532
503
  if (ch === "{" /* TokenChars.BraceLeft */) {
533
- return prev === "%" /* TokenChars.Modulo */ ? false : hasSpace;
504
+ return hasSpace;
534
505
  }
535
506
  else if (ch === "@" /* TokenChars.LinkedAlias */ || !ch) {
536
- return prev === "%" /* TokenChars.Modulo */ ? true : hasSpace;
537
- }
538
- else if (ch === "%" /* TokenChars.Modulo */) {
539
- scnr.peek();
540
- return fn(hasSpace, "%" /* TokenChars.Modulo */, true);
507
+ return hasSpace;
541
508
  }
542
509
  else if (ch === "|" /* TokenChars.Pipe */) {
543
- return prev === "%" /* TokenChars.Modulo */ || detectModulo
544
- ? true
545
- : !(prev === CHAR_SP || prev === CHAR_LF);
510
+ return !(prev === CHAR_SP || prev === CHAR_LF);
546
511
  }
547
512
  else if (ch === CHAR_SP) {
548
513
  scnr.peek();
549
- return fn(true, CHAR_SP, detectModulo);
514
+ return fn(true, CHAR_SP);
550
515
  }
551
516
  else if (ch === CHAR_LF) {
552
517
  scnr.peek();
553
- return fn(true, CHAR_LF, detectModulo);
518
+ return fn(true, CHAR_LF);
554
519
  }
555
520
  else {
556
521
  return true;
@@ -620,18 +585,8 @@ function createTokenizer(source, options = {}) {
620
585
  }
621
586
  return num;
622
587
  }
623
- function readModulo(scnr) {
624
- skipSpaces(scnr);
625
- const ch = scnr.currentChar();
626
- if (ch !== "%" /* TokenChars.Modulo */) {
627
- emitError(CompileErrorCodes.EXPECTED_TOKEN, currentPosition(), 0, ch);
628
- }
629
- scnr.next();
630
- return "%" /* TokenChars.Modulo */;
631
- }
632
588
  function readText(scnr) {
633
589
  let buf = '';
634
- // eslint-disable-next-line no-constant-condition
635
590
  while (true) {
636
591
  const ch = scnr.currentChar();
637
592
  if (ch === "{" /* TokenChars.BraceLeft */ ||
@@ -641,15 +596,6 @@ function createTokenizer(source, options = {}) {
641
596
  !ch) {
642
597
  break;
643
598
  }
644
- else if (ch === "%" /* TokenChars.Modulo */) {
645
- if (isTextStart(scnr)) {
646
- buf += ch;
647
- scnr.next();
648
- }
649
- else {
650
- break;
651
- }
652
- }
653
599
  else if (ch === CHAR_SP || ch === CHAR_LF) {
654
600
  if (isTextStart(scnr)) {
655
601
  buf += ch;
@@ -782,10 +728,9 @@ function createTokenizer(source, options = {}) {
782
728
  return name;
783
729
  }
784
730
  function readLinkedRefer(scnr) {
785
- const fn = (detect = false, buf) => {
731
+ const fn = (buf) => {
786
732
  const ch = scnr.currentChar();
787
733
  if (ch === "{" /* TokenChars.BraceLeft */ ||
788
- ch === "%" /* TokenChars.Modulo */ ||
789
734
  ch === "@" /* TokenChars.LinkedAlias */ ||
790
735
  ch === "|" /* TokenChars.Pipe */ ||
791
736
  ch === "(" /* TokenChars.ParenLeft */ ||
@@ -799,15 +744,15 @@ function createTokenizer(source, options = {}) {
799
744
  else if (ch === CHAR_LF || ch === DOT) {
800
745
  buf += ch;
801
746
  scnr.next();
802
- return fn(detect, buf);
747
+ return fn(buf);
803
748
  }
804
749
  else {
805
750
  buf += ch;
806
751
  scnr.next();
807
- return fn(true, buf);
752
+ return fn(buf);
808
753
  }
809
754
  };
810
- return fn(false, '');
755
+ return fn('');
811
756
  }
812
757
  function readPlural(scnr) {
813
758
  skipSpaces(scnr);
@@ -864,31 +809,31 @@ function createTokenizer(source, options = {}) {
864
809
  return token;
865
810
  }
866
811
  if (context.braceNest > 0 &&
867
- (context.currentType === 5 /* TokenTypes.Named */ ||
868
- context.currentType === 6 /* TokenTypes.List */ ||
869
- context.currentType === 7 /* TokenTypes.Literal */)) {
812
+ (context.currentType === 4 /* TokenTypes.Named */ ||
813
+ context.currentType === 5 /* TokenTypes.List */ ||
814
+ context.currentType === 6 /* TokenTypes.Literal */)) {
870
815
  emitError(CompileErrorCodes.UNTERMINATED_CLOSING_BRACE, currentPosition(), 0);
871
816
  context.braceNest = 0;
872
817
  return readToken(scnr, context);
873
818
  }
874
819
  if ((validNamedIdentifier = isNamedIdentifierStart(scnr, context))) {
875
- token = getToken(context, 5 /* TokenTypes.Named */, readNamedIdentifier(scnr));
820
+ token = getToken(context, 4 /* TokenTypes.Named */, readNamedIdentifier(scnr));
876
821
  skipSpaces(scnr);
877
822
  return token;
878
823
  }
879
824
  if ((validListIdentifier = isListIdentifierStart(scnr, context))) {
880
- token = getToken(context, 6 /* TokenTypes.List */, readListIdentifier(scnr));
825
+ token = getToken(context, 5 /* TokenTypes.List */, readListIdentifier(scnr));
881
826
  skipSpaces(scnr);
882
827
  return token;
883
828
  }
884
829
  if ((validLiteral = isLiteralStart(scnr, context))) {
885
- token = getToken(context, 7 /* TokenTypes.Literal */, readLiteral(scnr));
830
+ token = getToken(context, 6 /* TokenTypes.Literal */, readLiteral(scnr));
886
831
  skipSpaces(scnr);
887
832
  return token;
888
833
  }
889
834
  if (!validNamedIdentifier && !validListIdentifier && !validLiteral) {
890
835
  // TODO: we should be re-designed invalid cases, when we will extend message syntax near the future ...
891
- token = getToken(context, 13 /* TokenTypes.InvalidPlace */, readInvalidIdentifier(scnr));
836
+ token = getToken(context, 12 /* TokenTypes.InvalidPlace */, readInvalidIdentifier(scnr));
892
837
  emitError(CompileErrorCodes.INVALID_TOKEN_IN_PLACEHOLDER, currentPosition(), 0, token.value);
893
838
  skipSpaces(scnr);
894
839
  return token;
@@ -903,27 +848,27 @@ function createTokenizer(source, options = {}) {
903
848
  const { currentType } = context;
904
849
  let token = null;
905
850
  const ch = scnr.currentChar();
906
- if ((currentType === 8 /* TokenTypes.LinkedAlias */ ||
907
- currentType === 9 /* TokenTypes.LinkedDot */ ||
908
- currentType === 12 /* TokenTypes.LinkedModifier */ ||
909
- currentType === 10 /* TokenTypes.LinkedDelimiter */) &&
851
+ if ((currentType === 7 /* TokenTypes.LinkedAlias */ ||
852
+ currentType === 8 /* TokenTypes.LinkedDot */ ||
853
+ currentType === 11 /* TokenTypes.LinkedModifier */ ||
854
+ currentType === 9 /* TokenTypes.LinkedDelimiter */) &&
910
855
  (ch === CHAR_LF || ch === CHAR_SP)) {
911
856
  emitError(CompileErrorCodes.INVALID_LINKED_FORMAT, currentPosition(), 0);
912
857
  }
913
858
  switch (ch) {
914
859
  case "@" /* TokenChars.LinkedAlias */:
915
860
  scnr.next();
916
- token = getToken(context, 8 /* TokenTypes.LinkedAlias */, "@" /* TokenChars.LinkedAlias */);
861
+ token = getToken(context, 7 /* TokenTypes.LinkedAlias */, "@" /* TokenChars.LinkedAlias */);
917
862
  context.inLinked = true;
918
863
  return token;
919
864
  case "." /* TokenChars.LinkedDot */:
920
865
  skipSpaces(scnr);
921
866
  scnr.next();
922
- return getToken(context, 9 /* TokenTypes.LinkedDot */, "." /* TokenChars.LinkedDot */);
867
+ return getToken(context, 8 /* TokenTypes.LinkedDot */, "." /* TokenChars.LinkedDot */);
923
868
  case ":" /* TokenChars.LinkedDelimiter */:
924
869
  skipSpaces(scnr);
925
870
  scnr.next();
926
- return getToken(context, 10 /* TokenTypes.LinkedDelimiter */, ":" /* TokenChars.LinkedDelimiter */);
871
+ return getToken(context, 9 /* TokenTypes.LinkedDelimiter */, ":" /* TokenChars.LinkedDelimiter */);
927
872
  default:
928
873
  if (isPluralStart(scnr)) {
929
874
  token = getToken(context, 1 /* TokenTypes.Pipe */, readPlural(scnr));
@@ -939,7 +884,7 @@ function createTokenizer(source, options = {}) {
939
884
  }
940
885
  if (isLinkedModifierStart(scnr, context)) {
941
886
  skipSpaces(scnr);
942
- return getToken(context, 12 /* TokenTypes.LinkedModifier */, readLinkedModifier(scnr));
887
+ return getToken(context, 11 /* TokenTypes.LinkedModifier */, readLinkedModifier(scnr));
943
888
  }
944
889
  if (isLinkedReferStart(scnr, context)) {
945
890
  skipSpaces(scnr);
@@ -948,10 +893,10 @@ function createTokenizer(source, options = {}) {
948
893
  return readTokenInPlaceholder(scnr, context) || token;
949
894
  }
950
895
  else {
951
- return getToken(context, 11 /* TokenTypes.LinkedKey */, readLinkedRefer(scnr));
896
+ return getToken(context, 10 /* TokenTypes.LinkedKey */, readLinkedRefer(scnr));
952
897
  }
953
898
  }
954
- if (currentType === 8 /* TokenTypes.LinkedAlias */) {
899
+ if (currentType === 7 /* TokenTypes.LinkedAlias */) {
955
900
  emitError(CompileErrorCodes.INVALID_LINKED_FORMAT, currentPosition(), 0);
956
901
  }
957
902
  context.braceNest = 0;
@@ -961,7 +906,7 @@ function createTokenizer(source, options = {}) {
961
906
  }
962
907
  // TODO: We need refactoring of token parsing ...
963
908
  function readToken(scnr, context) {
964
- let token = { type: 14 /* TokenTypes.EOF */ };
909
+ let token = { type: 13 /* TokenTypes.EOF */ };
965
910
  if (context.braceNest > 0) {
966
911
  return readTokenInPlaceholder(scnr, context) || getEndToken(context);
967
912
  }
@@ -986,12 +931,6 @@ function createTokenizer(source, options = {}) {
986
931
  context.inLinked = false;
987
932
  return token;
988
933
  }
989
- const { isModulo, hasSpace } = detectModuloStart(scnr);
990
- if (isModulo) {
991
- return hasSpace
992
- ? getToken(context, 0 /* TokenTypes.Text */, readText(scnr))
993
- : getToken(context, 4 /* TokenTypes.Modulo */, readModulo(scnr));
994
- }
995
934
  if (isTextStart(scnr)) {
996
935
  return getToken(context, 0 /* TokenTypes.Text */, readText(scnr));
997
936
  }
@@ -1009,7 +948,7 @@ function createTokenizer(source, options = {}) {
1009
948
  _context.offset = currentOffset();
1010
949
  _context.startLoc = currentPosition();
1011
950
  if (_scnr.currentChar() === EOF) {
1012
- return getToken(_context, 14 /* TokenTypes.EOF */);
951
+ return getToken(_context, 13 /* TokenTypes.EOF */);
1013
952
  }
1014
953
  return readToken(_scnr, _context);
1015
954
  }
@@ -1045,7 +984,7 @@ function fromEscapeSequence(match, codePoint4, codePoint6) {
1045
984
  }
1046
985
  function createParser(options = {}) {
1047
986
  const location = options.location !== false;
1048
- const { onError, onWarn } = options;
987
+ const { onError } = options;
1049
988
  function emitError(tokenzer, code, start, offset, ...args) {
1050
989
  const end = tokenzer.currentPosition();
1051
990
  end.offset += offset;
@@ -1059,15 +998,6 @@ function createParser(options = {}) {
1059
998
  onError(err);
1060
999
  }
1061
1000
  }
1062
- function emitWarn(tokenzer, code, start, offset, ...args) {
1063
- const end = tokenzer.currentPosition();
1064
- end.offset += offset;
1065
- end.column += offset;
1066
- if (onWarn) {
1067
- const loc = location ? createLocation(start, end) : null;
1068
- onWarn(createCompileWarn(code, loc, args));
1069
- }
1070
- }
1071
1001
  function startNode(type, offset, loc) {
1072
1002
  const node = { type };
1073
1003
  if (location) {
@@ -1104,14 +1034,11 @@ function createParser(options = {}) {
1104
1034
  endNode(node, tokenizer.currentOffset(), tokenizer.currentPosition());
1105
1035
  return node;
1106
1036
  }
1107
- function parseNamed(tokenizer, key, modulo) {
1037
+ function parseNamed(tokenizer, key) {
1108
1038
  const context = tokenizer.context();
1109
1039
  const { lastOffset: offset, lastStartLoc: loc } = context; // get brace left loc
1110
1040
  const node = startNode(4 /* NodeTypes.Named */, offset, loc);
1111
1041
  node.key = key;
1112
- if (modulo === true) {
1113
- node.modulo = true;
1114
- }
1115
1042
  tokenizer.nextToken(); // skip brach right
1116
1043
  endNode(node, tokenizer.currentOffset(), tokenizer.currentPosition());
1117
1044
  return node;
@@ -1130,7 +1057,7 @@ function createParser(options = {}) {
1130
1057
  const context = tokenizer.context();
1131
1058
  const { lastOffset: offset, lastStartLoc: loc } = context; // get linked dot loc
1132
1059
  const node = startNode(8 /* NodeTypes.LinkedModifier */, offset, loc);
1133
- if (token.type !== 12 /* TokenTypes.LinkedModifier */) {
1060
+ if (token.type !== 11 /* TokenTypes.LinkedModifier */) {
1134
1061
  // empty modifier
1135
1062
  emitError(tokenizer, CompileErrorCodes.UNEXPECTED_EMPTY_LINKED_MODIFIER, context.lastStartLoc, 0);
1136
1063
  node.value = '';
@@ -1161,13 +1088,13 @@ function createParser(options = {}) {
1161
1088
  const context = tokenizer.context();
1162
1089
  const linkedNode = startNode(6 /* NodeTypes.Linked */, context.offset, context.startLoc);
1163
1090
  let token = tokenizer.nextToken();
1164
- if (token.type === 9 /* TokenTypes.LinkedDot */) {
1091
+ if (token.type === 8 /* TokenTypes.LinkedDot */) {
1165
1092
  const parsed = parseLinkedModifier(tokenizer);
1166
1093
  linkedNode.modifier = parsed.node;
1167
1094
  token = parsed.nextConsumeToken || tokenizer.nextToken();
1168
1095
  }
1169
1096
  // asset check token
1170
- if (token.type !== 10 /* TokenTypes.LinkedDelimiter */) {
1097
+ if (token.type !== 9 /* TokenTypes.LinkedDelimiter */) {
1171
1098
  emitError(tokenizer, CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS, context.lastStartLoc, 0, getTokenCaption(token));
1172
1099
  }
1173
1100
  token = tokenizer.nextToken();
@@ -1176,25 +1103,25 @@ function createParser(options = {}) {
1176
1103
  token = tokenizer.nextToken();
1177
1104
  }
1178
1105
  switch (token.type) {
1179
- case 11 /* TokenTypes.LinkedKey */:
1106
+ case 10 /* TokenTypes.LinkedKey */:
1180
1107
  if (token.value == null) {
1181
1108
  emitError(tokenizer, CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS, context.lastStartLoc, 0, getTokenCaption(token));
1182
1109
  }
1183
1110
  linkedNode.key = parseLinkedKey(tokenizer, token.value || '');
1184
1111
  break;
1185
- case 5 /* TokenTypes.Named */:
1112
+ case 4 /* TokenTypes.Named */:
1186
1113
  if (token.value == null) {
1187
1114
  emitError(tokenizer, CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS, context.lastStartLoc, 0, getTokenCaption(token));
1188
1115
  }
1189
1116
  linkedNode.key = parseNamed(tokenizer, token.value || '');
1190
1117
  break;
1191
- case 6 /* TokenTypes.List */:
1118
+ case 5 /* TokenTypes.List */:
1192
1119
  if (token.value == null) {
1193
1120
  emitError(tokenizer, CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS, context.lastStartLoc, 0, getTokenCaption(token));
1194
1121
  }
1195
1122
  linkedNode.key = parseList(tokenizer, token.value || '');
1196
1123
  break;
1197
- case 7 /* TokenTypes.Literal */:
1124
+ case 6 /* TokenTypes.Literal */:
1198
1125
  if (token.value == null) {
1199
1126
  emitError(tokenizer, CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS, context.lastStartLoc, 0, getTokenCaption(token));
1200
1127
  }
@@ -1231,7 +1158,6 @@ function createParser(options = {}) {
1231
1158
  const node = startNode(2 /* NodeTypes.Message */, startOffset, startLoc);
1232
1159
  node.items = [];
1233
1160
  let nextToken = null;
1234
- let modulo = null;
1235
1161
  do {
1236
1162
  const token = nextToken || tokenizer.nextToken();
1237
1163
  nextToken = null;
@@ -1242,39 +1168,32 @@ function createParser(options = {}) {
1242
1168
  }
1243
1169
  node.items.push(parseText(tokenizer, token.value || ''));
1244
1170
  break;
1245
- case 6 /* TokenTypes.List */:
1171
+ case 5 /* TokenTypes.List */:
1246
1172
  if (token.value == null) {
1247
1173
  emitError(tokenizer, CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS, context.lastStartLoc, 0, getTokenCaption(token));
1248
1174
  }
1249
1175
  node.items.push(parseList(tokenizer, token.value || ''));
1250
1176
  break;
1251
- case 4 /* TokenTypes.Modulo */:
1252
- modulo = true;
1253
- break;
1254
- case 5 /* TokenTypes.Named */:
1177
+ case 4 /* TokenTypes.Named */:
1255
1178
  if (token.value == null) {
1256
1179
  emitError(tokenizer, CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS, context.lastStartLoc, 0, getTokenCaption(token));
1257
1180
  }
1258
- node.items.push(parseNamed(tokenizer, token.value || '', !!modulo));
1259
- if (modulo) {
1260
- emitWarn(tokenizer, CompileWarnCodes.USE_MODULO_SYNTAX, context.lastStartLoc, 0, getTokenCaption(token));
1261
- modulo = null;
1262
- }
1181
+ node.items.push(parseNamed(tokenizer, token.value || ''));
1263
1182
  break;
1264
- case 7 /* TokenTypes.Literal */:
1183
+ case 6 /* TokenTypes.Literal */:
1265
1184
  if (token.value == null) {
1266
1185
  emitError(tokenizer, CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS, context.lastStartLoc, 0, getTokenCaption(token));
1267
1186
  }
1268
1187
  node.items.push(parseLiteral(tokenizer, token.value || ''));
1269
1188
  break;
1270
- case 8 /* TokenTypes.LinkedAlias */: {
1189
+ case 7 /* TokenTypes.LinkedAlias */: {
1271
1190
  const parsed = parseLinked(tokenizer);
1272
1191
  node.items.push(parsed.node);
1273
1192
  nextToken = parsed.nextConsumeToken || null;
1274
1193
  break;
1275
1194
  }
1276
1195
  }
1277
- } while (context.currentType !== 14 /* TokenTypes.EOF */ &&
1196
+ } while (context.currentType !== 13 /* TokenTypes.EOF */ &&
1278
1197
  context.currentType !== 1 /* TokenTypes.Pipe */);
1279
1198
  // adjust message node loc
1280
1199
  const endOffset = context.currentType === 1 /* TokenTypes.Pipe */
@@ -1298,7 +1217,7 @@ function createParser(options = {}) {
1298
1217
  hasEmptyMessage = msg.items.length === 0;
1299
1218
  }
1300
1219
  node.cases.push(msg);
1301
- } while (context.currentType !== 14 /* TokenTypes.EOF */);
1220
+ } while (context.currentType !== 13 /* TokenTypes.EOF */);
1302
1221
  if (hasEmptyMessage) {
1303
1222
  emitError(tokenizer, CompileErrorCodes.MUST_HAVE_MESSAGES_IN_PLURAL, loc, 0);
1304
1223
  }
@@ -1309,7 +1228,7 @@ function createParser(options = {}) {
1309
1228
  const context = tokenizer.context();
1310
1229
  const { offset, startLoc } = context;
1311
1230
  const msgNode = parseMessage(tokenizer);
1312
- if (context.currentType === 14 /* TokenTypes.EOF */) {
1231
+ if (context.currentType === 13 /* TokenTypes.EOF */) {
1313
1232
  return msgNode;
1314
1233
  }
1315
1234
  else {
@@ -1328,7 +1247,7 @@ function createParser(options = {}) {
1328
1247
  node.cacheKey = options.onCacheKey(source);
1329
1248
  }
1330
1249
  // assert whether achieved to EOF
1331
- if (context.currentType !== 14 /* TokenTypes.EOF */) {
1250
+ if (context.currentType !== 13 /* TokenTypes.EOF */) {
1332
1251
  emitError(tokenizer, CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS, context.lastStartLoc, 0, source[context.offset] || '');
1333
1252
  }
1334
1253
  endNode(node, tokenizer.currentOffset(), tokenizer.currentPosition());
@@ -1337,7 +1256,7 @@ function createParser(options = {}) {
1337
1256
  return { parse };
1338
1257
  }
1339
1258
  function getTokenCaption(token) {
1340
- if (token.type === 14 /* TokenTypes.EOF */) {
1259
+ if (token.type === 13 /* TokenTypes.EOF */) {
1341
1260
  return 'EOF';
1342
1261
  }
1343
1262
  const name = (token.value || '').replace(/\r?\n/gu, '\\n');
@@ -1675,8 +1594,7 @@ function generateNode(generator, node) {
1675
1594
  }
1676
1595
  }
1677
1596
  // generate code from AST
1678
- const generate = (ast, options = {} // eslint-disable-line
1679
- ) => {
1597
+ const generate = (ast, options = {}) => {
1680
1598
  const mode = isString(options.mode) ? options.mode : 'normal';
1681
1599
  const filename = isString(options.filename)
1682
1600
  ? options.filename
@@ -2160,17 +2078,17 @@ function createDevToolsHook(hook) {
2160
2078
  return (payloads) => devtools && devtools.emit(hook, payloads);
2161
2079
  }
2162
2080
 
2163
- const code$1 = CompileWarnCodes.__EXTEND_POINT__;
2081
+ const code$1 = 1;
2164
2082
  const inc$1 = incrementer(code$1);
2165
2083
  const CoreWarnCodes = {
2166
- NOT_FOUND_KEY: code$1, // 2
2167
- FALLBACK_TO_TRANSLATE: inc$1(), // 3
2168
- CANNOT_FORMAT_NUMBER: inc$1(), // 4
2169
- FALLBACK_TO_NUMBER_FORMAT: inc$1(), // 5
2170
- CANNOT_FORMAT_DATE: inc$1(), // 6
2171
- FALLBACK_TO_DATE_FORMAT: inc$1(), // 7
2172
- EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER: inc$1(), // 8
2173
- __EXTEND_POINT__: inc$1() // 9
2084
+ NOT_FOUND_KEY: code$1, // 1
2085
+ FALLBACK_TO_TRANSLATE: inc$1(), // 2
2086
+ CANNOT_FORMAT_NUMBER: inc$1(), // 3
2087
+ FALLBACK_TO_NUMBER_FORMAT: inc$1(), // 4
2088
+ CANNOT_FORMAT_DATE: inc$1(), // 5
2089
+ FALLBACK_TO_DATE_FORMAT: inc$1(), // 6
2090
+ EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER: inc$1(), // 7
2091
+ __EXTEND_POINT__: inc$1() // 8
2174
2092
  };
2175
2093
  /** @internal */
2176
2094
  const warnMessages = {
@@ -2262,8 +2180,7 @@ function resolveLocale(locale) {
2262
2180
  *
2263
2181
  * @VueI18nGeneral
2264
2182
  */
2265
- function fallbackWithSimple(ctx, fallback, start // eslint-disable-line @typescript-eslint/no-unused-vars
2266
- ) {
2183
+ function fallbackWithSimple(ctx, fallback, start) {
2267
2184
  // prettier-ignore
2268
2185
  return [...new Set([
2269
2186
  start,
@@ -2367,7 +2284,7 @@ function appendItemToChain(chain, target, blocks) {
2367
2284
  * Intlify core-base version
2368
2285
  * @internal
2369
2286
  */
2370
- const VERSION = '9.13.0';
2287
+ const VERSION = '10.0.0-alpha.1';
2371
2288
  const NOT_REOSLVED = -1;
2372
2289
  const DEFAULT_LOCALE = 'en-US';
2373
2290
  const MISSING_RESOLVE_VALUE = '';
@@ -2691,14 +2608,6 @@ function checkHtmlMessage(source, warnHtmlMessage) {
2691
2608
  }
2692
2609
  const defaultOnCacheKey = (message) => message;
2693
2610
  let compileCache = Object.create(null);
2694
- function onCompileWarn(_warn) {
2695
- if (_warn.code === CompileWarnCodes.USE_MODULO_SYNTAX) {
2696
- warn(`The use of named interpolation with modulo syntax is deprecated. ` +
2697
- `It will be removed in v10.\n` +
2698
- `reference: https://vue-i18n.intlify.dev/guide/essentials/syntax#rails-i18n-format \n` +
2699
- `(message compiler warning message: ${_warn.message})`);
2700
- }
2701
- }
2702
2611
  function clearCompileCache() {
2703
2612
  compileCache = Object.create(null);
2704
2613
  }
@@ -2721,10 +2630,6 @@ const compileToFunction = (message, context) => {
2721
2630
  if (!isString(message)) {
2722
2631
  throw createCoreError(CoreErrorCodes.NOT_SUPPORT_NON_STRING_MESSAGE);
2723
2632
  }
2724
- // set onWarn
2725
- {
2726
- context.onWarn = onCompileWarn;
2727
- }
2728
2633
  {
2729
2634
  // check HTML message
2730
2635
  const warnHtmlMessage = isBoolean(context.warnHtmlMessage)
@@ -2749,10 +2654,6 @@ const compileToFunction = (message, context) => {
2749
2654
  }
2750
2655
  };
2751
2656
  function compile(message, context) {
2752
- // set onWarn
2753
- {
2754
- context.onWarn = onCompileWarn;
2755
- }
2756
2657
  if (isString(message)) {
2757
2658
  // check HTML message
2758
2659
  const warnHtmlMessage = isBoolean(context.warnHtmlMessage)