requirejs-esm 4.0.0 → 4.2.0

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/api.js CHANGED
@@ -81,7 +81,7 @@
81
81
  const result = new Uint32Array(69632);
82
82
  let index = 0;
83
83
  let subIndex = 0;
84
- while (index < 2571) {
84
+ while (index < 2597) {
85
85
  const inst = compressed[index++];
86
86
  if (inst < 0) {
87
87
  subIndex -= inst;
@@ -99,78 +99,10 @@
99
99
  }
100
100
  }
101
101
  return result;
102
- })([-1, 2, 26, 2, 27, 2, 5, -1, 0, 77595648, 3, 44, 2, 3, 0, 14, 2, 63, 2, 64, 3, 0, 3, 0, 3168796671, 0, 4294956992, 2, 1, 2, 0, 2, 41, 3, 0, 4, 0, 4294966523, 3, 0, 4, 2, 16, 2, 65, 2, 0, 0, 4294836735, 0, 3221225471, 0, 4294901942, 2, 66, 0, 134152192, 3, 0, 2, 0, 4294951935, 3, 0, 2, 0, 2683305983, 0, 2684354047, 2, 18, 2, 0, 0, 4294961151, 3, 0, 2, 2, 19, 2, 0, 0, 608174079, 2, 0, 2, 60, 2, 7, 2, 6, 0, 4286611199, 3, 0, 2, 2, 1, 3, 0, 3, 0, 4294901711, 2, 40, 0, 4089839103, 0, 2961209759, 0, 1342439375, 0, 4294543342, 0, 3547201023, 0, 1577204103, 0, 4194240, 0, 4294688750, 2, 2, 0, 80831, 0, 4261478351, 0, 4294549486, 2, 2, 0, 2967484831, 0, 196559, 0, 3594373100, 0, 3288319768, 0, 8469959, 0, 65472, 2, 3, 0, 4093640191, 0, 660618719, 0, 65487, 0, 4294828015, 0, 4092591615, 0, 1616920031, 0, 982991, 2, 3, 2, 0, 0, 2163244511, 0, 4227923919, 0, 4236247022, 2, 71, 0, 4284449919, 0, 851904, 2, 4, 2, 12, 0, 67076095, -1, 2, 72, 0, 1073741743, 0, 4093607775, -1, 0, 50331649, 0, 3265266687, 2, 33, 0, 4294844415, 0, 4278190047, 2, 20, 2, 137, -1, 3, 0, 2, 2, 23, 2, 0, 2, 10, 2, 0, 2, 15, 2, 22, 3, 0, 10, 2, 74, 2, 0, 2, 75, 2, 76, 2, 77, 2, 0, 2, 78, 2, 0, 2, 11, 0, 261632, 2, 25, 3, 0, 2, 2, 13, 2, 4, 3, 0, 18, 2, 79, 2, 5, 3, 0, 2, 2, 80, 0, 2151677951, 2, 29, 2, 9, 0, 909311, 3, 0, 2, 0, 814743551, 2, 49, 0, 67090432, 3, 0, 2, 2, 42, 2, 0, 2, 6, 2, 0, 2, 30, 2, 8, 0, 268374015, 2, 110, 2, 51, 2, 0, 2, 81, 0, 134153215, -1, 2, 7, 2, 0, 2, 8, 0, 2684354559, 0, 67044351, 0, 3221160064, 2, 17, -1, 3, 0, 2, 2, 53, 0, 1046528, 3, 0, 3, 2, 9, 2, 0, 2, 54, 0, 4294960127, 2, 10, 2, 6, 2, 11, 0, 4294377472, 2, 12, 3, 0, 16, 2, 13, 2, 0, 2, 82, 2, 10, 2, 0, 2, 83, 2, 84, 2, 85, 0, 12288, 2, 55, 0, 1048577, 2, 86, 2, 14, -1, 2, 14, 0, 131042, 2, 87, 2, 88, 2, 89, 2, 0, 2, 34, -83, 3, 0, 7, 0, 1046559, 2, 0, 2, 15, 2, 0, 0, 2147516671, 2, 21, 3, 90, 2, 2, 0, -16, 2, 91, 0, 524222462, 2, 4, 2, 0, 0, 4269801471, 2, 4, 3, 0, 2, 2, 28, 2, 16, 3, 0, 2, 2, 17, 2, 0, -1, 2, 18, -16, 3, 0, 206, -2, 3, 0, 692, 2, 73, -1, 2, 18, 2, 10, 3, 0, 8, 2, 93, 2, 133, 2, 0, 0, 3220242431, 3, 0, 3, 2, 19, 2, 94, 2, 95, 3, 0, 2, 2, 96, 2, 0, 2, 97, 2, 46, 2, 0, 0, 4351, 2, 0, 2, 9, 3, 0, 2, 0, 67043391, 0, 3909091327, 2, 0, 2, 24, 2, 9, 2, 20, 3, 0, 2, 0, 67076097, 2, 8, 2, 0, 2, 21, 0, 67059711, 0, 4236247039, 3, 0, 2, 0, 939524103, 0, 8191999, 2, 101, 2, 102, 2, 22, 2, 23, 3, 0, 3, 0, 67057663, 3, 0, 349, 2, 103, 2, 104, 2, 7, -264, 3, 0, 11, 2, 24, 3, 0, 2, 2, 32, -1, 0, 3774349439, 2, 105, 2, 106, 3, 0, 2, 2, 19, 2, 107, 3, 0, 10, 2, 10, 2, 18, 2, 0, 2, 47, 2, 0, 2, 31, 2, 108, 2, 25, 0, 1638399, 0, 57344, 2, 109, 3, 0, 3, 2, 20, 2, 26, 2, 27, 2, 5, 2, 28, 2, 0, 2, 8, 2, 111, -1, 2, 112, 2, 113, 2, 114, -1, 3, 0, 3, 2, 12, -2, 2, 0, 2, 29, -3, 0, 536870912, -4, 2, 20, 2, 0, 2, 36, 0, 1, 2, 0, 2, 67, 2, 6, 2, 12, 2, 10, 2, 0, 2, 115, -1, 3, 0, 4, 2, 10, 2, 23, 2, 116, 2, 7, 2, 0, 2, 117, 2, 0, 2, 118, 2, 119, 2, 120, 2, 0, 2, 9, 3, 0, 9, 2, 21, 2, 30, 2, 31, 2, 121, 2, 122, -2, 2, 123, 2, 124, 2, 30, 2, 21, 2, 8, -2, 2, 125, 2, 30, 2, 32, -2, 2, 0, 2, 39, -2, 0, 4277137519, 0, 2269118463, -1, 3, 20, 2, -1, 2, 33, 2, 38, 2, 0, 3, 30, 2, 2, 35, 2, 19, -3, 3, 0, 2, 2, 34, -1, 2, 0, 2, 35, 2, 0, 2, 35, 2, 0, 2, 48, 2, 0, 0, 4294950463, 2, 37, -7, 2, 0, 0, 203775, 2, 57, 0, 4026531840, 2, 20, 2, 43, 2, 36, 2, 18, 2, 37, 2, 18, 2, 126, 2, 21, 3, 0, 2, 2, 38, 0, 2151677888, 2, 0, 2, 12, 0, 4294901764, 2, 144, 2, 0, 2, 58, 2, 56, 0, 5242879, 3, 0, 2, 0, 402644511, -1, 2, 128, 2, 39, 0, 3, -1, 2, 129, 2, 130, 2, 0, 0, 67045375, 2, 40, 0, 4226678271, 0, 3766565279, 0, 2039759, 2, 132, 2, 41, 0, 1046437, 0, 6, 3, 0, 2, 0, 3288270847, 0, 3, 3, 0, 2, 0, 67043519, -5, 2, 0, 0, 4282384383, 0, 1056964609, -1, 3, 0, 2, 0, 67043345, -1, 2, 0, 2, 42, 2, 23, 2, 50, 2, 11, 2, 61, 2, 38, -5, 2, 0, 2, 12, -3, 3, 0, 2, 0, 2147484671, 2, 134, 0, 4190109695, 2, 52, -2, 2, 135, 0, 4244635647, 0, 27, 2, 0, 2, 8, 2, 43, 2, 0, 2, 68, 2, 18, 2, 0, 2, 42, -6, 2, 0, 2, 45, 2, 59, 2, 44, 2, 45, 2, 46, 2, 47, 0, 8388351, -2, 2, 136, 0, 3028287487, 2, 48, 2, 138, 0, 33259519, 2, 49, -9, 2, 21, 0, 4294836223, 0, 3355443199, 0, 134152199, -2, 2, 69, -2, 3, 0, 28, 2, 32, -3, 3, 0, 3, 2, 17, 3, 0, 6, 2, 50, -81, 2, 18, 3, 0, 2, 2, 36, 3, 0, 33, 2, 25, 2, 30, 3, 0, 124, 2, 12, 3, 0, 18, 2, 38, -213, 2, 0, 2, 32, -54, 3, 0, 17, 2, 42, 2, 8, 2, 23, 2, 0, 2, 8, 2, 23, 2, 51, 2, 0, 2, 21, 2, 52, 2, 139, 2, 25, -13, 2, 0, 2, 53, -6, 3, 0, 2, -4, 3, 0, 2, 0, 4294936575, 2, 0, 0, 4294934783, -2, 0, 196635, 3, 0, 191, 2, 54, 3, 0, 38, 2, 30, 2, 55, 2, 34, -278, 2, 140, 3, 0, 9, 2, 141, 2, 142, 2, 56, 3, 0, 11, 2, 7, -72, 3, 0, 3, 2, 143, 0, 1677656575, -130, 2, 26, -16, 2, 0, 2, 24, 2, 38, -16, 0, 4161266656, 0, 4071, 0, 15360, -4, 2, 57, -13, 3, 0, 2, 2, 58, 2, 0, 2, 145, 2, 146, 2, 62, 2, 0, 2, 147, 2, 148, 2, 149, 3, 0, 10, 2, 150, 2, 151, 2, 22, 3, 58, 2, 3, 152, 2, 3, 59, 2, 0, 4294954999, 2, 0, -16, 2, 0, 2, 92, 2, 0, 0, 2105343, 0, 4160749584, 0, 65534, -34, 2, 8, 2, 154, -6, 0, 4194303871, 0, 4294903771, 2, 0, 2, 60, 2, 100, -3, 2, 0, 0, 1073684479, 0, 17407, -9, 2, 18, 2, 17, 2, 0, 2, 32, -14, 2, 18, 2, 32, -6, 2, 18, 2, 12, -15, 2, 155, 3, 0, 6, 0, 8323103, -1, 3, 0, 2, 2, 61, -37, 2, 62, 2, 156, 2, 157, 2, 158, 2, 159, 2, 160, -105, 2, 26, -32, 3, 0, 1335, -1, 3, 0, 129, 2, 32, 3, 0, 6, 2, 10, 3, 0, 180, 2, 161, 3, 0, 233, 2, 162, 3, 0, 18, 2, 10, -77, 3, 0, 16, 2, 10, -47, 3, 0, 154, 2, 6, 3, 0, 130, 2, 25, -22250, 3, 0, 7, 2, 25, -6130, 3, 5, 2, -1, 0, 69207040, 3, 44, 2, 3, 0, 14, 2, 63, 2, 64, -3, 0, 3168731136, 0, 4294956864, 2, 1, 2, 0, 2, 41, 3, 0, 4, 0, 4294966275, 3, 0, 4, 2, 16, 2, 65, 2, 0, 2, 34, -1, 2, 18, 2, 66, -1, 2, 0, 0, 2047, 0, 4294885376, 3, 0, 2, 0, 3145727, 0, 2617294944, 0, 4294770688, 2, 25, 2, 67, 3, 0, 2, 0, 131135, 2, 98, 0, 70256639, 0, 71303167, 0, 272, 2, 42, 2, 6, 0, 32511, 2, 0, 2, 49, -1, 2, 99, 2, 68, 0, 4278255616, 0, 4294836227, 0, 4294549473, 0, 600178175, 0, 2952806400, 0, 268632067, 0, 4294543328, 0, 57540095, 0, 1577058304, 0, 1835008, 0, 4294688736, 2, 70, 2, 69, 0, 33554435, 2, 131, 2, 70, 0, 2952790016, 0, 131075, 0, 3594373096, 0, 67094296, 2, 69, -1, 0, 4294828000, 0, 603979263, 0, 654311424, 0, 3, 0, 4294828001, 0, 602930687, 0, 1610612736, 0, 393219, 0, 4294828016, 0, 671088639, 0, 2154840064, 0, 4227858435, 0, 4236247008, 2, 71, 2, 38, -1, 2, 4, 0, 917503, 2, 38, -1, 2, 72, 0, 537788335, 0, 4026531935, -1, 0, 1, -1, 2, 33, 2, 73, 0, 7936, -3, 2, 0, 0, 2147485695, 0, 1010761728, 0, 4292984930, 0, 16387, 2, 0, 2, 15, 2, 22, 3, 0, 10, 2, 74, 2, 0, 2, 75, 2, 76, 2, 77, 2, 0, 2, 78, 2, 0, 2, 12, -1, 2, 25, 3, 0, 2, 2, 13, 2, 4, 3, 0, 18, 2, 79, 2, 5, 3, 0, 2, 2, 80, 0, 2147745791, 3, 19, 2, 0, 122879, 2, 0, 2, 9, 0, 276824064, -2, 3, 0, 2, 2, 42, 2, 0, 0, 4294903295, 2, 0, 2, 30, 2, 8, -1, 2, 18, 2, 51, 2, 0, 2, 81, 2, 49, -1, 2, 21, 2, 0, 2, 29, -2, 0, 128, -2, 2, 28, 2, 9, 0, 8160, -1, 2, 127, 0, 4227907585, 2, 0, 2, 37, 2, 0, 2, 50, 0, 4227915776, 2, 10, 2, 6, 2, 11, -1, 0, 74440192, 3, 0, 6, -2, 3, 0, 8, 2, 13, 2, 0, 2, 82, 2, 10, 2, 0, 2, 83, 2, 84, 2, 85, -3, 2, 86, 2, 14, -3, 2, 87, 2, 88, 2, 89, 2, 0, 2, 34, -83, 3, 0, 7, 0, 817183, 2, 0, 2, 15, 2, 0, 0, 33023, 2, 21, 3, 90, 2, -17, 2, 91, 0, 524157950, 2, 4, 2, 0, 2, 92, 2, 4, 2, 0, 2, 22, 2, 28, 2, 16, 3, 0, 2, 2, 17, 2, 0, -1, 2, 18, -16, 3, 0, 206, -2, 3, 0, 692, 2, 73, -1, 2, 18, 2, 10, 3, 0, 8, 2, 93, 0, 3072, 2, 0, 0, 2147516415, 2, 10, 3, 0, 2, 2, 25, 2, 94, 2, 95, 3, 0, 2, 2, 96, 2, 0, 2, 97, 2, 46, 0, 4294965179, 0, 7, 2, 0, 2, 9, 2, 95, 2, 9, -1, 0, 1761345536, 2, 98, 0, 4294901823, 2, 38, 2, 20, 2, 99, 2, 35, 2, 100, 0, 2080440287, 2, 0, 2, 34, 2, 153, 0, 3296722943, 2, 0, 0, 1046675455, 0, 939524101, 0, 1837055, 2, 101, 2, 102, 2, 22, 2, 23, 3, 0, 3, 0, 7, 3, 0, 349, 2, 103, 2, 104, 2, 7, -264, 3, 0, 11, 2, 24, 3, 0, 2, 2, 32, -1, 0, 2700607615, 2, 105, 2, 106, 3, 0, 2, 2, 19, 2, 107, 3, 0, 10, 2, 10, 2, 18, 2, 0, 2, 47, 2, 0, 2, 31, 2, 108, -3, 2, 109, 3, 0, 3, 2, 20, -1, 3, 5, 2, 2, 110, 2, 0, 2, 8, 2, 111, -1, 2, 112, 2, 113, 2, 114, -1, 3, 0, 3, 2, 12, -2, 2, 0, 2, 29, -8, 2, 20, 2, 0, 2, 36, -1, 2, 0, 2, 67, 2, 6, 2, 30, 2, 10, 2, 0, 2, 115, -1, 3, 0, 4, 2, 10, 2, 18, 2, 116, 2, 7, 2, 0, 2, 117, 2, 0, 2, 118, 2, 119, 2, 120, 2, 0, 2, 9, 3, 0, 9, 2, 21, 2, 30, 2, 31, 2, 121, 2, 122, -2, 2, 123, 2, 124, 2, 30, 2, 21, 2, 8, -2, 2, 125, 2, 30, 2, 32, -2, 2, 0, 2, 39, -2, 0, 4277075969, 2, 30, -1, 3, 20, 2, -1, 2, 33, 2, 126, 2, 0, 3, 30, 2, 2, 35, 2, 19, -3, 3, 0, 2, 2, 34, -1, 2, 0, 2, 35, 2, 0, 2, 35, 2, 0, 2, 50, 2, 98, 0, 4294934591, 2, 37, -7, 2, 0, 0, 197631, 2, 57, -1, 2, 20, 2, 43, 2, 37, 2, 18, 0, 3, 2, 18, 2, 126, 2, 21, 2, 127, 2, 54, -1, 0, 2490368, 2, 127, 2, 25, 2, 18, 2, 34, 2, 127, 2, 38, 0, 4294901904, 0, 4718591, 2, 127, 2, 35, 0, 335544350, -1, 2, 128, 0, 2147487743, 0, 1, -1, 2, 129, 2, 130, 2, 8, -1, 2, 131, 2, 70, 0, 3758161920, 0, 3, 2, 132, 0, 12582911, 0, 655360, -1, 2, 0, 2, 29, 0, 2147485568, 0, 3, 2, 0, 2, 25, 0, 176, -5, 2, 0, 2, 17, 0, 251658240, -1, 2, 0, 2, 25, 0, 16, -1, 2, 0, 0, 16779263, -2, 2, 12, -1, 2, 38, -5, 2, 0, 2, 133, -3, 3, 0, 2, 2, 55, 2, 134, 0, 2147549183, 0, 2, -2, 2, 135, 2, 36, 0, 10, 0, 4294965249, 0, 67633151, 0, 4026597376, 2, 0, 0, 536871935, 2, 18, 2, 0, 2, 42, -6, 2, 0, 0, 1, 2, 59, 2, 17, 0, 1, 2, 46, 2, 25, -3, 2, 136, 2, 36, 2, 137, 2, 138, 0, 16778239, -10, 2, 35, 0, 4294836212, 2, 9, -3, 2, 69, -2, 3, 0, 28, 2, 32, -3, 3, 0, 3, 2, 17, 3, 0, 6, 2, 50, -81, 2, 18, 3, 0, 2, 2, 36, 3, 0, 33, 2, 25, 0, 126, 3, 0, 124, 2, 12, 3, 0, 18, 2, 38, -213, 2, 10, -55, 3, 0, 17, 2, 42, 2, 8, 2, 18, 2, 0, 2, 8, 2, 18, 2, 60, 2, 0, 2, 25, 2, 50, 2, 139, 2, 25, -13, 2, 0, 2, 73, -6, 3, 0, 2, -4, 3, 0, 2, 0, 67583, -1, 2, 107, -2, 0, 11, 3, 0, 191, 2, 54, 3, 0, 38, 2, 30, 2, 55, 2, 34, -278, 2, 140, 3, 0, 9, 2, 141, 2, 142, 2, 56, 3, 0, 11, 2, 7, -72, 3, 0, 3, 2, 143, 2, 144, -187, 3, 0, 2, 2, 58, 2, 0, 2, 145, 2, 146, 2, 62, 2, 0, 2, 147, 2, 148, 2, 149, 3, 0, 10, 2, 150, 2, 151, 2, 22, 3, 58, 2, 3, 152, 2, 3, 59, 2, 2, 153, -57, 2, 8, 2, 154, -7, 2, 18, 2, 0, 2, 60, -4, 2, 0, 0, 1065361407, 0, 16384, -9, 2, 18, 2, 60, 2, 0, 2, 133, -14, 2, 18, 2, 133, -6, 2, 18, 0, 81919, -15, 2, 155, 3, 0, 6, 2, 126, -1, 3, 0, 2, 0, 2063, -37, 2, 62, 2, 156, 2, 157, 2, 158, 2, 159, 2, 160, -138, 3, 0, 1335, -1, 3, 0, 129, 2, 32, 3, 0, 6, 2, 10, 3, 0, 180, 2, 161, 3, 0, 233, 2, 162, 3, 0, 18, 2, 10, -77, 3, 0, 16, 2, 10, -47, 3, 0, 154, 2, 6, 3, 0, 130, 2, 25, -28386], [4294967295, 4294967291, 4092460543, 4294828031, 4294967294, 134217726, 4294903807, 268435455, 2147483647, 1048575, 1073741823, 3892314111, 134217727, 1061158911, 536805376, 4294910143, 4294901759, 32767, 4294901760, 262143, 536870911, 8388607, 4160749567, 4294902783, 4294918143, 65535, 67043328, 2281701374, 4294967264, 2097151, 4194303, 255, 67108863, 4294967039, 511, 524287, 131071, 63, 127, 3238002687, 4294549487, 4290772991, 33554431, 4294901888, 4286578687, 67043329, 4294705152, 4294770687, 67043583, 1023, 15, 2047999, 67043343, 67051519, 16777215, 2147483648, 4294902000, 28, 4292870143, 4294966783, 16383, 67047423, 4294967279, 262083, 20511, 41943039, 493567, 4294959104, 603979775, 65536, 602799615, 805044223, 4294965206, 8191, 1031749119, 4294917631, 2134769663, 4286578493, 4282253311, 4294942719, 33540095, 4294905855, 2868854591, 1608515583, 265232348, 534519807, 2147614720, 1060109444, 4093640016, 17376, 2139062143, 224, 4169138175, 4294909951, 4286578688, 4294967292, 4294965759, 535511039, 4294966272, 4294967280, 32768, 8289918, 4294934399, 4294901775, 4294965375, 1602223615, 4294967259, 4294443008, 268369920, 4292804608, 4294967232, 486341884, 4294963199, 3087007615, 1073692671, 4128527, 4279238655, 4294902015, 4160684047, 4290246655, 469499899, 4294967231, 134086655, 4294966591, 2445279231, 3670015, 31, 4294967288, 4294705151, 3221208447, 4294902271, 4294549472, 4294921215, 4095, 4285526655, 4294966527, 4294966143, 64, 4294966719, 3774873592, 1877934080, 262151, 2555904, 536807423, 67043839, 3758096383, 3959414372, 3755993023, 2080374783, 4294835295, 4294967103, 4160749565, 4294934527, 4087, 2016, 2147446655, 184024726, 2862017156, 1593309078, 268434431, 268434414, 4294901763, 4294901761]);
102
+ })([-1, 2, 26, 2, 27, 2, 5, -1, 0, 77595648, 3, 44, 2, 3, 0, 14, 2, 61, 2, 62, 3, 0, 3, 0, 3168796671, 0, 4294956992, 2, 1, 2, 0, 2, 41, 3, 0, 4, 0, 4294966523, 3, 0, 4, 2, 16, 2, 63, 2, 0, 0, 4294836735, 0, 3221225471, 0, 4294901942, 2, 64, 0, 134152192, 3, 0, 2, 0, 4294951935, 3, 0, 2, 0, 2683305983, 0, 2684354047, 2, 17, 2, 0, 0, 4294961151, 3, 0, 2, 2, 19, 2, 0, 0, 608174079, 2, 0, 2, 58, 2, 7, 2, 6, 0, 4286643967, 3, 0, 2, 2, 1, 3, 0, 3, 0, 4294901711, 2, 40, 0, 4089839103, 0, 2961209759, 0, 1342439375, 0, 4294543342, 0, 3547201023, 0, 1577204103, 0, 4194240, 0, 4294688750, 2, 2, 0, 80831, 0, 4261478351, 0, 4294549486, 2, 2, 0, 2967484831, 0, 196559, 0, 3594373100, 0, 3288319768, 0, 8469959, 0, 65472, 2, 3, 0, 4093640191, 0, 929054175, 0, 65487, 0, 4294828015, 0, 4092591615, 0, 1885355487, 0, 982991, 2, 3, 2, 0, 0, 2163244511, 0, 4227923919, 0, 4236247022, 2, 69, 0, 4284449919, 0, 851904, 2, 4, 2, 12, 0, 67076095, -1, 2, 70, 0, 1073741743, 0, 4093607775, -1, 0, 50331649, 0, 3265266687, 2, 33, 0, 4294844415, 0, 4278190047, 2, 20, 2, 137, -1, 3, 0, 2, 2, 23, 2, 0, 2, 9, 2, 0, 2, 15, 2, 22, 3, 0, 10, 2, 72, 2, 0, 2, 73, 2, 74, 2, 75, 2, 0, 2, 76, 2, 0, 2, 11, 0, 261632, 2, 25, 3, 0, 2, 2, 13, 2, 4, 3, 0, 18, 2, 77, 2, 5, 3, 0, 2, 2, 78, 0, 2151677951, 2, 29, 2, 10, 0, 909311, 3, 0, 2, 0, 814743551, 2, 48, 0, 67090432, 3, 0, 2, 2, 42, 2, 0, 2, 6, 2, 0, 2, 30, 2, 8, 0, 268374015, 2, 108, 2, 51, 2, 0, 2, 79, 0, 134153215, -1, 2, 7, 2, 0, 2, 8, 0, 2684354559, 0, 67044351, 0, 3221160064, 2, 9, 2, 18, 3, 0, 2, 2, 53, 0, 1046528, 3, 0, 3, 2, 10, 2, 0, 2, 127, 0, 4294960127, 2, 9, 2, 6, 2, 11, 0, 4294377472, 2, 12, 3, 0, 16, 2, 13, 2, 0, 2, 80, 2, 9, 2, 0, 2, 81, 2, 82, 2, 83, 0, 12288, 2, 54, 0, 1048577, 2, 84, 2, 14, -1, 2, 14, 0, 131042, 2, 85, 2, 86, 2, 87, 2, 0, 2, 34, -83, 3, 0, 7, 0, 1046559, 2, 0, 2, 15, 2, 0, 0, 2147516671, 2, 21, 3, 88, 2, 2, 0, -16, 2, 89, 0, 524222462, 2, 4, 2, 0, 0, 4269801471, 2, 4, 3, 0, 2, 2, 28, 2, 16, 3, 0, 2, 2, 49, 2, 0, -1, 2, 17, -16, 3, 0, 206, -2, 3, 0, 692, 2, 71, -1, 2, 17, 2, 9, 3, 0, 8, 2, 91, 2, 18, 2, 0, 0, 3220242431, 3, 0, 3, 2, 19, 2, 92, 2, 93, 3, 0, 2, 2, 94, 2, 0, 2, 20, 2, 95, 2, 0, 0, 4351, 2, 0, 2, 10, 3, 0, 2, 0, 67043391, 0, 3909091327, 2, 0, 2, 24, 2, 10, 2, 20, 3, 0, 2, 0, 67076097, 2, 8, 2, 0, 2, 21, 0, 67059711, 0, 4236247039, 3, 0, 2, 0, 939524103, 0, 8191999, 2, 99, 2, 100, 2, 22, 2, 23, 3, 0, 3, 0, 67057663, 3, 0, 349, 2, 101, 2, 102, 2, 7, -264, 3, 0, 11, 2, 24, 3, 0, 2, 2, 32, -1, 0, 3774349439, 2, 103, 2, 104, 3, 0, 2, 2, 19, 2, 105, 3, 0, 10, 2, 9, 2, 17, 2, 0, 2, 46, 2, 0, 2, 31, 2, 106, 2, 25, 0, 1638399, 0, 57344, 2, 107, 3, 0, 3, 2, 20, 2, 26, 2, 27, 2, 5, 2, 28, 2, 0, 2, 8, 2, 109, -1, 2, 110, 2, 111, 2, 112, -1, 3, 0, 3, 2, 12, -2, 2, 0, 2, 29, -3, 0, 536870912, -4, 2, 20, 2, 0, 2, 36, 0, 1, 2, 0, 2, 65, 2, 6, 2, 12, 2, 9, 2, 0, 2, 113, -1, 3, 0, 4, 2, 9, 2, 23, 2, 114, 2, 7, 2, 0, 2, 115, 2, 0, 2, 116, 2, 117, 2, 118, 2, 0, 2, 10, 3, 0, 9, 2, 21, 2, 30, 2, 31, 2, 119, 2, 120, -2, 2, 121, 2, 122, 2, 30, 2, 21, 2, 8, -2, 2, 123, 2, 30, 3, 32, 2, -1, 2, 0, 2, 39, -2, 0, 4277137519, 0, 2269118463, -1, 3, 20, 2, -1, 2, 33, 2, 38, 2, 0, 3, 30, 2, 2, 35, 2, 19, -3, 3, 0, 2, 2, 34, -1, 2, 0, 2, 35, 2, 0, 2, 35, 2, 0, 2, 47, 2, 0, 0, 4294950463, 2, 37, -7, 2, 0, 0, 203775, 2, 125, 0, 4227858432, 2, 20, 2, 43, 2, 36, 2, 17, 2, 37, 2, 17, 2, 124, 2, 21, 3, 0, 2, 2, 38, 0, 2151677888, 2, 0, 2, 12, 0, 4294901764, 2, 145, 2, 0, 2, 56, 2, 55, 0, 5242879, 3, 0, 2, 0, 402644511, -1, 2, 128, 2, 39, 0, 3, -1, 2, 129, 2, 130, 2, 0, 0, 67045375, 2, 40, 0, 4226678271, 0, 3766565279, 0, 2039759, 2, 132, 2, 41, 0, 1046437, 0, 6, 3, 0, 2, 0, 3288270847, 0, 3, 3, 0, 2, 0, 67043519, -5, 2, 0, 0, 4282384383, 0, 1056964609, -1, 3, 0, 2, 0, 67043345, -1, 2, 0, 2, 42, 2, 23, 2, 50, 2, 11, 2, 59, 2, 38, -5, 2, 0, 2, 12, -3, 3, 0, 2, 0, 2147484671, 2, 133, 0, 4190109695, 2, 52, -2, 2, 134, 0, 4244635647, 0, 27, 2, 0, 2, 8, 2, 43, 2, 0, 2, 66, 2, 17, 2, 0, 2, 42, -3, 2, 31, -2, 2, 0, 2, 45, 2, 57, 2, 44, 2, 45, 2, 135, 2, 46, 0, 8388351, -2, 2, 136, 0, 3028287487, 2, 47, 2, 138, 0, 33259519, 2, 23, 2, 7, 2, 48, -7, 2, 21, 0, 4294836223, 0, 3355443199, 0, 134152199, -2, 2, 67, -2, 3, 0, 28, 2, 32, -3, 3, 0, 3, 2, 49, 3, 0, 6, 2, 50, -81, 2, 17, 3, 0, 2, 2, 36, 3, 0, 33, 2, 25, 2, 30, 3, 0, 124, 2, 12, 3, 0, 18, 2, 38, -213, 2, 0, 2, 32, -54, 3, 0, 17, 2, 42, 2, 8, 2, 23, 2, 0, 2, 8, 2, 23, 2, 51, 2, 0, 2, 21, 2, 52, 2, 139, 2, 25, -13, 2, 0, 2, 53, -6, 3, 0, 2, -1, 2, 140, 2, 10, -1, 3, 0, 2, 0, 4294936575, 2, 0, 0, 4294934783, -2, 0, 8323099, 3, 0, 230, 2, 30, 2, 54, 2, 8, -3, 3, 0, 3, 2, 35, -271, 2, 141, 3, 0, 9, 2, 142, 2, 143, 2, 55, 3, 0, 11, 2, 7, -72, 3, 0, 3, 2, 144, 0, 1677656575, -130, 2, 26, -16, 2, 0, 2, 24, 2, 38, -16, 0, 4161266656, 0, 4071, 0, 15360, -4, 0, 28, -13, 3, 0, 2, 2, 56, 2, 0, 2, 146, 2, 147, 2, 60, 2, 0, 2, 148, 2, 149, 2, 150, 3, 0, 10, 2, 151, 2, 152, 2, 22, 3, 56, 2, 3, 153, 2, 3, 57, 2, 0, 4294954999, 2, 0, -16, 2, 0, 2, 90, 2, 0, 0, 2105343, 0, 4160749584, 0, 65534, -34, 2, 8, 2, 155, -6, 0, 4194303871, 0, 4294903771, 2, 0, 2, 58, 2, 98, -3, 2, 0, 0, 1073684479, 0, 17407, -9, 2, 17, 2, 49, 2, 0, 2, 32, -14, 2, 17, 2, 32, -6, 2, 17, 2, 12, -6, 2, 8, 0, 3225419775, -7, 2, 156, 3, 0, 6, 0, 8323103, -1, 3, 0, 2, 2, 59, -37, 2, 60, 2, 157, 2, 158, 2, 159, 2, 160, 2, 161, -105, 2, 26, -32, 3, 0, 1335, -1, 3, 0, 136, 2, 9, 3, 0, 180, 2, 24, 3, 0, 233, 2, 162, 3, 0, 18, 2, 9, -77, 3, 0, 16, 2, 9, -47, 3, 0, 154, 2, 6, 3, 0, 264, 2, 32, -22116, 3, 0, 7, 2, 25, -6130, 3, 5, 2, -1, 0, 69207040, 3, 44, 2, 3, 0, 14, 2, 61, 2, 62, -3, 0, 3168731136, 0, 4294956864, 2, 1, 2, 0, 2, 41, 3, 0, 4, 0, 4294966275, 3, 0, 4, 2, 16, 2, 63, 2, 0, 2, 34, -1, 2, 17, 2, 64, -1, 2, 0, 0, 2047, 0, 4294885376, 3, 0, 2, 0, 3145727, 0, 2617294944, 0, 4294770688, 2, 25, 2, 65, 3, 0, 2, 0, 131135, 2, 96, 0, 70256639, 0, 71303167, 0, 272, 2, 42, 2, 6, 0, 65279, 2, 0, 2, 48, -1, 2, 97, 2, 66, 0, 4278255616, 0, 4294836227, 0, 4294549473, 0, 600178175, 0, 2952806400, 0, 268632067, 0, 4294543328, 0, 57540095, 0, 1577058304, 0, 1835008, 0, 4294688736, 2, 68, 2, 67, 0, 33554435, 2, 131, 2, 68, 0, 2952790016, 0, 131075, 0, 3594373096, 0, 67094296, 2, 67, -1, 0, 4294828000, 0, 603979263, 0, 922746880, 0, 3, 0, 4294828001, 0, 602930687, 0, 1879048192, 0, 393219, 0, 4294828016, 0, 671088639, 0, 2154840064, 0, 4227858435, 0, 4236247008, 2, 69, 2, 38, -1, 2, 4, 0, 917503, 2, 38, -1, 2, 70, 0, 537788335, 0, 4026531935, -1, 0, 1, -1, 2, 33, 2, 71, 0, 7936, -3, 2, 0, 0, 2147485695, 0, 1010761728, 0, 4292984930, 0, 16387, 2, 0, 2, 15, 2, 22, 3, 0, 10, 2, 72, 2, 0, 2, 73, 2, 74, 2, 75, 2, 0, 2, 76, 2, 0, 2, 12, -1, 2, 25, 3, 0, 2, 2, 13, 2, 4, 3, 0, 18, 2, 77, 2, 5, 3, 0, 2, 2, 78, 0, 2147745791, 3, 19, 2, 0, 122879, 2, 0, 2, 10, 0, 276824064, -2, 3, 0, 2, 2, 42, 2, 0, 0, 4294903295, 2, 0, 2, 30, 2, 8, -1, 2, 17, 2, 51, 2, 0, 2, 79, 2, 48, -1, 2, 21, 2, 0, 2, 29, -2, 0, 128, -2, 2, 28, 2, 10, 0, 8160, -1, 2, 126, 0, 4227907585, 2, 0, 2, 37, 2, 0, 2, 50, 0, 4227915776, 2, 9, 2, 6, 2, 11, -1, 0, 74440192, 3, 0, 6, -2, 3, 0, 8, 2, 13, 2, 0, 2, 80, 2, 9, 2, 0, 2, 81, 2, 82, 2, 83, -3, 2, 84, 2, 14, -3, 2, 85, 2, 86, 2, 87, 2, 0, 2, 34, -83, 3, 0, 7, 0, 817183, 2, 0, 2, 15, 2, 0, 0, 33023, 2, 21, 3, 88, 2, -17, 2, 89, 0, 524157950, 2, 4, 2, 0, 2, 90, 2, 4, 2, 0, 2, 22, 2, 28, 2, 16, 3, 0, 2, 2, 49, 2, 0, -1, 2, 17, -16, 3, 0, 206, -2, 3, 0, 692, 2, 71, -1, 2, 17, 2, 9, 3, 0, 8, 2, 91, 0, 3072, 2, 0, 0, 2147516415, 2, 9, 3, 0, 2, 2, 25, 2, 92, 2, 93, 3, 0, 2, 2, 94, 2, 0, 2, 20, 2, 95, 0, 4294965179, 0, 7, 2, 0, 2, 10, 2, 93, 2, 10, -1, 0, 1761345536, 2, 96, 0, 4294901823, 2, 38, 2, 20, 2, 97, 2, 35, 2, 98, 0, 2080440287, 2, 0, 2, 34, 2, 154, 0, 3296722943, 2, 0, 0, 1046675455, 0, 939524101, 0, 1837055, 2, 99, 2, 100, 2, 22, 2, 23, 3, 0, 3, 0, 7, 3, 0, 349, 2, 101, 2, 102, 2, 7, -264, 3, 0, 11, 2, 24, 3, 0, 2, 2, 32, -1, 0, 2700607615, 2, 103, 2, 104, 3, 0, 2, 2, 19, 2, 105, 3, 0, 10, 2, 9, 2, 17, 2, 0, 2, 46, 2, 0, 2, 31, 2, 106, -3, 2, 107, 3, 0, 3, 2, 20, -1, 3, 5, 2, 2, 108, 2, 0, 2, 8, 2, 109, -1, 2, 110, 2, 111, 2, 112, -1, 3, 0, 3, 2, 12, -2, 2, 0, 2, 29, -8, 2, 20, 2, 0, 2, 36, -1, 2, 0, 2, 65, 2, 6, 2, 30, 2, 9, 2, 0, 2, 113, -1, 3, 0, 4, 2, 9, 2, 17, 2, 114, 2, 7, 2, 0, 2, 115, 2, 0, 2, 116, 2, 117, 2, 118, 2, 0, 2, 10, 3, 0, 9, 2, 21, 2, 30, 2, 31, 2, 119, 2, 120, -2, 2, 121, 2, 122, 2, 30, 2, 21, 2, 8, -2, 2, 123, 2, 30, 3, 32, 2, -1, 2, 0, 2, 39, -2, 0, 4277075969, 2, 30, -1, 3, 20, 2, -1, 2, 33, 2, 124, 2, 0, 3, 30, 2, 2, 35, 2, 19, -3, 3, 0, 2, 2, 34, -1, 2, 0, 2, 35, 2, 0, 2, 35, 2, 0, 2, 50, 2, 96, 0, 4294934591, 2, 37, -7, 2, 0, 0, 197631, 2, 125, -1, 2, 20, 2, 43, 2, 37, 2, 17, 0, 3, 2, 17, 2, 124, 2, 21, 2, 126, 2, 127, -1, 0, 2490368, 2, 126, 2, 25, 2, 17, 2, 34, 2, 126, 2, 38, 0, 4294901904, 0, 4718591, 2, 126, 2, 35, 0, 335544350, -1, 2, 128, 0, 2147487743, 0, 1, -1, 2, 129, 2, 130, 2, 8, -1, 2, 131, 2, 68, 0, 3758161920, 0, 3, 2, 132, 0, 12582911, 0, 655360, -1, 2, 0, 2, 29, 0, 2147485568, 0, 3, 2, 0, 2, 25, 0, 176, -5, 2, 0, 2, 49, 0, 251658240, -1, 2, 0, 2, 25, 0, 16, -1, 2, 0, 0, 16779263, -2, 2, 12, -1, 2, 38, -5, 2, 0, 2, 18, -3, 3, 0, 2, 2, 54, 2, 133, 0, 2147549183, 0, 2, -2, 2, 134, 2, 36, 0, 10, 0, 4294965249, 0, 67633151, 0, 4026597376, 2, 0, 0, 536871935, 2, 17, 2, 0, 2, 42, -6, 2, 0, 0, 1, 2, 57, 2, 49, 0, 1, 2, 135, 2, 25, -3, 2, 136, 2, 36, 2, 137, 2, 138, 0, 16778239, 2, 17, 2, 7, -8, 2, 35, 0, 4294836212, 2, 10, -3, 2, 67, -2, 3, 0, 28, 2, 32, -3, 3, 0, 3, 2, 49, 3, 0, 6, 2, 50, -81, 2, 17, 3, 0, 2, 2, 36, 3, 0, 33, 2, 25, 0, 126, 3, 0, 124, 2, 12, 3, 0, 18, 2, 38, -213, 2, 9, -55, 3, 0, 17, 2, 42, 2, 8, 2, 17, 2, 0, 2, 8, 2, 17, 2, 58, 2, 0, 2, 25, 2, 50, 2, 139, 2, 25, -13, 2, 0, 2, 71, -6, 3, 0, 2, -1, 2, 140, 2, 10, -1, 3, 0, 2, 0, 67583, -1, 2, 105, -2, 0, 8126475, 3, 0, 230, 2, 30, 2, 54, 2, 8, -3, 3, 0, 3, 2, 35, -271, 2, 141, 3, 0, 9, 2, 142, 2, 143, 2, 55, 3, 0, 11, 2, 7, -72, 3, 0, 3, 2, 144, 2, 145, -187, 3, 0, 2, 2, 56, 2, 0, 2, 146, 2, 147, 2, 60, 2, 0, 2, 148, 2, 149, 2, 150, 3, 0, 10, 2, 151, 2, 152, 2, 22, 3, 56, 2, 3, 153, 2, 3, 57, 2, 2, 154, -57, 2, 8, 2, 155, -7, 2, 17, 2, 0, 2, 58, -4, 2, 0, 0, 1065361407, 0, 16384, -9, 2, 17, 2, 58, 2, 0, 2, 18, -14, 2, 17, 2, 18, -6, 2, 17, 0, 81919, -6, 2, 8, 0, 3223273399, -7, 2, 156, 3, 0, 6, 2, 124, -1, 3, 0, 2, 0, 2063, -37, 2, 60, 2, 157, 2, 158, 2, 159, 2, 160, 2, 161, -138, 3, 0, 1335, -1, 3, 0, 136, 2, 9, 3, 0, 180, 2, 24, 3, 0, 233, 2, 162, 3, 0, 18, 2, 9, -77, 3, 0, 16, 2, 9, -47, 3, 0, 154, 2, 6, 3, 0, 264, 2, 32, -28252], [4294967295, 4294967291, 4092460543, 4294828031, 4294967294, 134217726, 4294903807, 268435455, 2147483647, 1073741823, 1048575, 3892314111, 134217727, 1061158911, 536805376, 4294910143, 4294901759, 4294901760, 4095, 262143, 536870911, 8388607, 4160749567, 4294902783, 4294918143, 65535, 67043328, 2281701374, 4294967264, 2097151, 4194303, 255, 67108863, 4294967039, 511, 524287, 131071, 63, 127, 3238002687, 4294549487, 4290772991, 33554431, 4294901888, 4286578687, 67043329, 4294770687, 67043583, 1023, 32767, 15, 2047999, 67043343, 67051519, 2147483648, 4294902000, 4292870143, 4294966783, 16383, 67047423, 4294967279, 262083, 20511, 41943039, 493567, 4294959104, 603979775, 65536, 602799615, 805044223, 4294965206, 8191, 1031749119, 4294917631, 2134769663, 4286578493, 4282253311, 4294942719, 33540095, 4294905855, 2868854591, 1608515583, 265232348, 534519807, 2147614720, 1060109444, 4093640016, 17376, 2139062143, 224, 4169138175, 4294909951, 4286578688, 4294967292, 4294965759, 4294836224, 4294966272, 4294967280, 32768, 8289918, 4294934399, 4294901775, 4294965375, 1602223615, 4294967259, 4294443008, 268369920, 4292804608, 4294967232, 486341884, 4294963199, 3087007615, 1073692671, 4128527, 4279238655, 4294902015, 4160684047, 4290246655, 469499899, 4294967231, 134086655, 4294966591, 2445279231, 3670015, 31, 252, 4294967288, 16777215, 4294705151, 3221208447, 4294902271, 4294549472, 4294921215, 4285526655, 4294966527, 4294705152, 4294966143, 64, 4294966719, 3774873592, 4194303999, 1877934080, 262151, 2555904, 536807423, 67043839, 3758096383, 3959414372, 3755993023, 2080374783, 4294835295, 4294967103, 4160749565, 4294934527, 4087, 2016, 2147446655, 184024726, 2862017156, 1593309078, 268434431, 268434414, 4294901761]);
103
103
  const isIDContinue = (code) => (unicodeLookup[(code >>> 5) + 0] >>> code & 31 & 1) !== 0;
104
104
  const isIDStart = (code) => (unicodeLookup[(code >>> 5) + 34816] >>> code & 31 & 1) !== 0;
105
105
 
106
- function advanceChar(parser) {
107
- parser.column++;
108
- return (parser.currentChar = parser.source.charCodeAt(++parser.index));
109
- }
110
- function consumePossibleSurrogatePair(parser) {
111
- const hi = parser.currentChar;
112
- if ((hi & 0xfc00) !== 55296)
113
- return 0;
114
- const lo = parser.source.charCodeAt(parser.index + 1);
115
- if ((lo & 0xfc00) !== 56320)
116
- return 0;
117
- return 65536 + ((hi & 0x3ff) << 10) + (lo & 0x3ff);
118
- }
119
- function consumeLineFeed(parser, state) {
120
- parser.currentChar = parser.source.charCodeAt(++parser.index);
121
- parser.flags |= 1;
122
- if ((state & 4) === 0) {
123
- parser.column = 0;
124
- parser.line++;
125
- }
126
- }
127
- function scanNewLine(parser) {
128
- parser.flags |= 1;
129
- parser.currentChar = parser.source.charCodeAt(++parser.index);
130
- parser.column = 0;
131
- parser.line++;
132
- }
133
- function isExoticECMAScriptWhitespace(ch) {
134
- return (ch === 160 ||
135
- ch === 65279 ||
136
- ch === 133 ||
137
- ch === 5760 ||
138
- (ch >= 8192 && ch <= 8203) ||
139
- ch === 8239 ||
140
- ch === 8287 ||
141
- ch === 12288 ||
142
- ch === 8201 ||
143
- ch === 65519);
144
- }
145
- function toHex(code) {
146
- return code < 65 ? code - 48 : (code - 65 + 10) & 0xf;
147
- }
148
- function convertTokenType(t) {
149
- switch (t) {
150
- case 134283266:
151
- return 'NumericLiteral';
152
- case 134283267:
153
- return 'StringLiteral';
154
- case 86021:
155
- case 86022:
156
- return 'BooleanLiteral';
157
- case 86023:
158
- return 'NullLiteral';
159
- case 65540:
160
- return 'RegularExpression';
161
- case 67174408:
162
- case 67174409:
163
- case 131:
164
- return 'TemplateLiteral';
165
- default:
166
- if ((t & 143360) === 143360)
167
- return 'Identifier';
168
- if ((t & 4096) === 4096)
169
- return 'Keyword';
170
- return 'Punctuator';
171
- }
172
- }
173
-
174
106
  const CharTypes = [
175
107
  0,
176
108
  0,
@@ -572,6 +504,74 @@
572
504
  : isIDContinue(code) || (code === 8204 || code === 8205);
573
505
  }
574
506
 
507
+ function advanceChar(parser) {
508
+ parser.column++;
509
+ return (parser.currentChar = parser.source.charCodeAt(++parser.index));
510
+ }
511
+ function consumePossibleSurrogatePair(parser) {
512
+ const hi = parser.currentChar;
513
+ if ((hi & 0xfc00) !== 55296)
514
+ return 0;
515
+ const lo = parser.source.charCodeAt(parser.index + 1);
516
+ if ((lo & 0xfc00) !== 56320)
517
+ return 0;
518
+ return 65536 + ((hi & 0x3ff) << 10) + (lo & 0x3ff);
519
+ }
520
+ function consumeLineFeed(parser, state) {
521
+ parser.currentChar = parser.source.charCodeAt(++parser.index);
522
+ parser.flags |= 1;
523
+ if ((state & 4) === 0) {
524
+ parser.column = 0;
525
+ parser.line++;
526
+ }
527
+ }
528
+ function scanNewLine(parser) {
529
+ parser.flags |= 1;
530
+ parser.currentChar = parser.source.charCodeAt(++parser.index);
531
+ parser.column = 0;
532
+ parser.line++;
533
+ }
534
+ function isExoticECMAScriptWhitespace(ch) {
535
+ return (ch === 160 ||
536
+ ch === 65279 ||
537
+ ch === 133 ||
538
+ ch === 5760 ||
539
+ (ch >= 8192 && ch <= 8203) ||
540
+ ch === 8239 ||
541
+ ch === 8287 ||
542
+ ch === 12288 ||
543
+ ch === 8201 ||
544
+ ch === 65519);
545
+ }
546
+ function toHex(code) {
547
+ return code < 65 ? code - 48 : (code - 65 + 10) & 0xf;
548
+ }
549
+ function convertTokenType(t) {
550
+ switch (t) {
551
+ case 134283266:
552
+ return 'NumericLiteral';
553
+ case 134283267:
554
+ return 'StringLiteral';
555
+ case 86021:
556
+ case 86022:
557
+ return 'BooleanLiteral';
558
+ case 86023:
559
+ return 'NullLiteral';
560
+ case 65540:
561
+ return 'RegularExpression';
562
+ case 67174408:
563
+ case 67174409:
564
+ case 131:
565
+ return 'TemplateLiteral';
566
+ default:
567
+ if ((t & 143360) === 143360)
568
+ return 'Identifier';
569
+ if ((t & 4096) === 4096)
570
+ return 'Keyword';
571
+ return 'Punctuator';
572
+ }
573
+ }
574
+
575
575
  const CommentTypes = ['SingleLine', 'MultiLine', 'HTMLOpen', 'HTMLClose', 'HashbangComment'];
576
576
  function skipHashBang(parser) {
577
577
  const { source } = parser;
@@ -683,63 +683,700 @@
683
683
  parser.report(18);
684
684
  }
685
685
 
686
- var RegexState;
687
- (function (RegexState) {
688
- RegexState[RegexState["Empty"] = 0] = "Empty";
689
- RegexState[RegexState["Escape"] = 1] = "Escape";
690
- RegexState[RegexState["Class"] = 2] = "Class";
691
- })(RegexState || (RegexState = {}));
692
- var RegexFlags;
693
- (function (RegexFlags) {
694
- RegexFlags[RegexFlags["Empty"] = 0] = "Empty";
695
- RegexFlags[RegexFlags["IgnoreCase"] = 1] = "IgnoreCase";
696
- RegexFlags[RegexFlags["Global"] = 2] = "Global";
697
- RegexFlags[RegexFlags["Multiline"] = 4] = "Multiline";
698
- RegexFlags[RegexFlags["Unicode"] = 16] = "Unicode";
699
- RegexFlags[RegexFlags["Sticky"] = 8] = "Sticky";
700
- RegexFlags[RegexFlags["DotAll"] = 32] = "DotAll";
701
- RegexFlags[RegexFlags["Indices"] = 64] = "Indices";
702
- RegexFlags[RegexFlags["UnicodeSets"] = 128] = "UnicodeSets";
703
- })(RegexFlags || (RegexFlags = {}));
704
- function scanRegularExpression(parser) {
705
- const bodyStart = parser.index;
706
- let preparseState = RegexState.Empty;
707
- loop: while (true) {
708
- const ch = parser.currentChar;
709
- advanceChar(parser);
710
- if (preparseState & RegexState.Escape) {
711
- preparseState &= ~RegexState.Escape;
686
+ const errorMessages = {
687
+ [0]: 'Unexpected token',
688
+ [30]: "Unexpected token: '%0'",
689
+ [1]: 'Octal escape sequences are not allowed in strict mode',
690
+ [2]: 'Octal escape sequences are not allowed in template strings',
691
+ [3]: '\\8 and \\9 are not allowed in template strings',
692
+ [4]: 'Private identifier #%0 is not defined',
693
+ [5]: 'Illegal Unicode escape sequence',
694
+ [6]: 'Invalid code point %0',
695
+ [7]: 'Invalid hexadecimal escape sequence',
696
+ [9]: 'Octal literals are not allowed in strict mode',
697
+ [8]: 'Decimal integer literals with a leading zero are forbidden in strict mode',
698
+ [10]: 'Expected number in radix %0',
699
+ [151]: 'Invalid left-hand side assignment to a destructible right-hand side',
700
+ [11]: 'Non-number found after exponent indicator',
701
+ [12]: 'Invalid BigIntLiteral',
702
+ [13]: 'No identifiers allowed directly after numeric literal',
703
+ [14]: 'Escapes \\8 or \\9 are not syntactically valid escapes',
704
+ [15]: 'Escapes \\8 or \\9 are not allowed in strict mode',
705
+ [16]: 'Unterminated string literal',
706
+ [17]: 'Unterminated template literal',
707
+ [18]: 'Multiline comment was not closed properly',
708
+ [19]: 'The identifier contained dynamic unicode escape that was not closed',
709
+ [20]: "Illegal character '%0'",
710
+ [21]: 'Missing hexadecimal digits',
711
+ [22]: 'Invalid implicit octal',
712
+ [23]: 'Invalid line break in string literal',
713
+ [24]: 'Only unicode escapes are legal in identifier names',
714
+ [25]: "Expected '%0'",
715
+ [26]: 'Invalid left-hand side in assignment',
716
+ [27]: 'Invalid left-hand side in async arrow',
717
+ [28]: 'Calls to super must be in the "constructor" method of a class expression or class declaration that has a superclass',
718
+ [29]: 'Member access on super must be in a method',
719
+ [31]: 'Await expression not allowed in formal parameter',
720
+ [32]: 'Yield expression not allowed in formal parameter',
721
+ [95]: "Unexpected token: 'escaped keyword'",
722
+ [33]: 'Unary expressions as the left operand of an exponentiation expression must be disambiguated with parentheses',
723
+ [123]: 'Async functions can only be declared at the top level or inside a block',
724
+ [34]: 'Unterminated regular expression',
725
+ [35]: 'Unexpected regular expression flag',
726
+ [36]: "Duplicate regular expression flag '%0'",
727
+ [37]: '%0 functions must have exactly %1 argument%2',
728
+ [38]: 'Setter function argument must not be a rest parameter',
729
+ [39]: '%0 declaration must have a name in this context',
730
+ [40]: 'Function name may not contain any reserved words or be eval or arguments in strict mode',
731
+ [41]: 'The rest operator is missing an argument',
732
+ [42]: 'A getter cannot be a generator',
733
+ [43]: 'A setter cannot be a generator',
734
+ [44]: 'A computed property name must be followed by a colon or paren',
735
+ [134]: 'Object literal keys that are strings or numbers must be a method or have a colon',
736
+ [46]: 'Found `* async x(){}` but this should be `async * x(){}`',
737
+ [45]: 'Getters and setters can not be generators',
738
+ [47]: "'%0' can not be generator method",
739
+ [48]: "No line break is allowed after '=>'",
740
+ [49]: 'The left-hand side of the arrow can only be destructed through assignment',
741
+ [50]: 'The binding declaration is not destructible',
742
+ [51]: 'Async arrow can not be followed by new expression',
743
+ [52]: "Classes may not have a static property named 'prototype'",
744
+ [53]: 'Class constructor may not be a %0',
745
+ [54]: 'Duplicate constructor method in class',
746
+ [55]: 'Invalid increment/decrement operand',
747
+ [56]: 'Invalid use of `new` keyword on an increment/decrement expression',
748
+ [57]: '`=>` is an invalid assignment target',
749
+ [58]: 'Rest element may not have a trailing comma',
750
+ [59]: 'Missing initializer in %0 declaration',
751
+ [60]: "'for-%0' loop head declarations can not have an initializer",
752
+ [61]: 'Invalid left-hand side in for-%0 loop: Must have a single binding',
753
+ [62]: 'Invalid shorthand property initializer',
754
+ [63]: 'Property name __proto__ appears more than once in object literal',
755
+ [64]: 'Let is disallowed as a lexically bound name',
756
+ [65]: "Invalid use of '%0' inside new expression",
757
+ [66]: "Illegal 'use strict' directive in function with non-simple parameter list",
758
+ [67]: 'Identifier "let" disallowed as left-hand side expression in strict mode',
759
+ [68]: 'Illegal continue statement',
760
+ [69]: 'Illegal break statement',
761
+ [70]: 'Cannot have `let[...]` as a var name in strict mode',
762
+ [71]: 'Invalid destructuring assignment target',
763
+ [72]: 'Rest parameter may not have a default initializer',
764
+ [73]: 'The rest argument must the be last parameter',
765
+ [74]: 'Invalid rest argument',
766
+ [76]: 'In strict mode code, functions can only be declared at top level or inside a block',
767
+ [77]: 'In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement',
768
+ [78]: 'Without web compatibility enabled functions can not be declared at top level, inside a block, or as the body of an if statement',
769
+ [79]: "Class declaration can't appear in single-statement context",
770
+ [80]: 'Invalid left-hand side in for-%0',
771
+ [81]: 'Invalid assignment in for-%0',
772
+ [82]: 'for await (... of ...) is only valid in async functions and async generators',
773
+ [83]: 'The first token after the template expression should be a continuation of the template',
774
+ [85]: '`let` declaration not allowed here and `let` cannot be a regular var name in strict mode',
775
+ [84]: '`let \n [` is a restricted production at the start of a statement',
776
+ [86]: 'Catch clause requires exactly one parameter, not more (and no trailing comma)',
777
+ [87]: 'Catch clause parameter does not support default values',
778
+ [88]: 'Missing catch or finally after try',
779
+ [89]: 'More than one default clause in switch statement',
780
+ [90]: 'Illegal newline after throw',
781
+ [91]: 'Strict mode code may not include a with statement',
782
+ [92]: 'Illegal return statement',
783
+ [93]: 'The left hand side of the for-header binding declaration is not destructible',
784
+ [94]: 'new.target only allowed within functions or static blocks',
785
+ [96]: "'#' not followed by identifier",
786
+ [102]: 'Invalid keyword',
787
+ [101]: "Can not use 'let' as a class name",
788
+ [100]: "'A lexical declaration can't define a 'let' binding",
789
+ [99]: 'Can not use `let` as variable name in strict mode',
790
+ [97]: "'%0' may not be used as an identifier in this context",
791
+ [98]: 'Await is only valid in async functions',
792
+ [103]: 'The %0 keyword can only be used with the module goal',
793
+ [104]: 'Unicode codepoint must not be greater than 0x10FFFF',
794
+ [105]: '%0 source must be string',
795
+ [106]: 'Only a identifier or string can be used to indicate alias',
796
+ [107]: "Only '*' or '{...}' can be imported after default",
797
+ [108]: 'Trailing decorator may be followed by method',
798
+ [109]: "Decorators can't be used with a constructor",
799
+ [110]: 'Can not use `await` as identifier in module or async func',
800
+ [111]: 'Can not use `await` as identifier in module',
801
+ [112]: 'HTML comments are only allowed with web compatibility (Annex B)',
802
+ [113]: "The identifier 'let' must not be in expression position in strict mode",
803
+ [114]: 'Cannot assign to `eval` and `arguments` in strict mode',
804
+ [115]: "The left-hand side of a for-of loop may not start with 'let'",
805
+ [116]: 'Block body arrows can not be immediately invoked without a group',
806
+ [117]: 'Block body arrows can not be immediately accessed without a group',
807
+ [118]: 'Unexpected strict mode reserved word',
808
+ [119]: 'Unexpected eval or arguments in strict mode',
809
+ [120]: 'Decorators must not be followed by a semicolon',
810
+ [121]: 'Calling delete on expression not allowed in strict mode',
811
+ [122]: 'Pattern can not have a tail',
812
+ [124]: 'Can not have a `yield` expression on the left side of a ternary',
813
+ [125]: 'An arrow function can not have a postfix update operator',
814
+ [126]: 'Invalid object literal key character after generator star',
815
+ [127]: 'Private fields can not be deleted',
816
+ [129]: 'Classes may not have a field called constructor',
817
+ [128]: 'Classes may not have a private element named constructor',
818
+ [130]: 'A class field initializer or static block may not contain arguments',
819
+ [131]: 'Generators can only be declared at the top level or inside a block',
820
+ [132]: 'Async methods are a restricted production and cannot have a newline following it',
821
+ [133]: 'Unexpected character after object literal property name',
822
+ [135]: 'Invalid key token',
823
+ [136]: "Label '%0' has already been declared",
824
+ [137]: 'continue statement must be nested within an iteration statement',
825
+ [138]: "Undefined label '%0'",
826
+ [139]: 'Trailing comma is disallowed inside import(...) arguments',
827
+ [140]: 'Invalid binding in JSON import',
828
+ [141]: 'import() requires exactly one argument',
829
+ [142]: 'Cannot use new with import(...)',
830
+ [143]: '... is not allowed in import()',
831
+ [144]: "Expected '=>'",
832
+ [145]: "Duplicate binding '%0'",
833
+ [146]: 'Duplicate private identifier #%0',
834
+ [147]: "Cannot export a duplicate name '%0'",
835
+ [150]: 'Duplicate %0 for-binding',
836
+ [148]: "Exported binding '%0' needs to refer to a top-level declared variable",
837
+ [149]: 'Unexpected private field',
838
+ [153]: 'Numeric separators are not allowed at the end of numeric literals',
839
+ [152]: 'Only one underscore is allowed as numeric separator',
840
+ [154]: 'JSX value should be either an expression or a quoted JSX text',
841
+ [155]: 'Expected corresponding JSX closing tag for %0',
842
+ [156]: 'Adjacent JSX elements must be wrapped in an enclosing tag',
843
+ [157]: "JSX attributes must only be assigned a non-empty 'expression'",
844
+ [158]: "'%0' has already been declared",
845
+ [159]: "'%0' shadowed a catch clause binding",
846
+ [160]: 'Dot property must be an identifier',
847
+ [161]: 'Encountered invalid input after spread/rest argument',
848
+ [162]: 'Catch without try',
849
+ [163]: 'Finally without try',
850
+ [164]: 'Expected corresponding closing tag for JSX fragment',
851
+ [165]: 'Coalescing and logical operators used together in the same expression must be disambiguated with parentheses',
852
+ [166]: 'Invalid tagged template on optional chain',
853
+ [167]: 'Invalid optional chain from super property',
854
+ [168]: 'Invalid optional chain from new expression',
855
+ [169]: 'Cannot use "import.meta" outside a module',
856
+ [170]: 'Leading decorators must be attached to a class declaration',
857
+ [171]: 'An export name cannot include a lone surrogate',
858
+ [172]: 'A string literal cannot be used as an exported binding without `from`',
859
+ [173]: "Private fields can't be accessed on super",
860
+ [174]: "The only valid meta property for import is 'import.meta'",
861
+ [175]: "'import.meta' must not contain escaped characters",
862
+ [176]: 'cannot use "await" as identifier inside an async function',
863
+ [177]: 'cannot use "await" in static blocks',
864
+ };
865
+ class ParseError extends SyntaxError {
866
+ start;
867
+ end;
868
+ range;
869
+ loc;
870
+ description;
871
+ constructor(start, end, type, ...params) {
872
+ const description = errorMessages[type].replace(/%(\d+)/g, (_, i) => params[i]);
873
+ const message = '[' + start.line + ':' + start.column + '-' + end.line + ':' + end.column + ']: ' + description;
874
+ super(message);
875
+ this.start = start.index;
876
+ this.end = end.index;
877
+ this.range = [start.index, end.index];
878
+ this.loc = {
879
+ start: { line: start.line, column: start.column },
880
+ end: { line: end.line, column: end.column },
881
+ };
882
+ this.description = description;
883
+ }
884
+ }
885
+
886
+ function getOwnProperty(object, key) {
887
+ return Object.hasOwn(object, key) ? object[key] : undefined;
888
+ }
889
+
890
+ const KeywordDescTable = [
891
+ 'end of source',
892
+ 'identifier', 'number', 'string', 'regular expression',
893
+ 'false', 'true', 'null',
894
+ 'template continuation', 'template tail',
895
+ '=>', '(', '{', '.', '...', '}', ')', ';', ',', '[', ']', ':', '?', '\'', '"',
896
+ '++', '--',
897
+ '=', '<<=', '>>=', '>>>=', '**=', '+=', '-=', '*=', '/=', '%=', '^=', '|=',
898
+ '&=', '||=', '&&=', '??=',
899
+ 'typeof', 'delete', 'void', '!', '~', '+', '-', 'in', 'instanceof', '*', '%', '/', '**', '&&',
900
+ '||', '===', '!==', '==', '!=', '<=', '>=', '<', '>', '<<', '>>', '>>>', '&', '|', '^',
901
+ 'var', 'let', 'const',
902
+ 'break', 'case', 'catch', 'class', 'continue', 'debugger', 'default', 'do', 'else', 'export',
903
+ 'extends', 'finally', 'for', 'function', 'if', 'import', 'new', 'return', 'super', 'switch',
904
+ 'this', 'throw', 'try', 'while', 'with',
905
+ 'implements', 'interface', 'package', 'private', 'protected', 'public', 'static', 'yield',
906
+ 'as', 'async', 'await', 'constructor', 'get', 'set', 'accessor', 'from', 'of',
907
+ 'enum', 'eval', 'arguments', 'escaped keyword', 'escaped future reserved keyword', 'reserved if strict', '#',
908
+ 'BigIntLiteral', '??', '?.', 'WhiteSpace', 'Illegal', 'LineTerminator', 'PrivateField',
909
+ 'Template', '@', 'target', 'meta', 'LineFeed', 'Escaped', 'JSXText'
910
+ ];
911
+ const descKeywordTable = {
912
+ this: 86111,
913
+ function: 86104,
914
+ if: 20569,
915
+ return: 20572,
916
+ var: 86088,
917
+ else: 20563,
918
+ for: 20567,
919
+ new: 86107,
920
+ in: 8673330,
921
+ typeof: 16863275,
922
+ while: 20578,
923
+ case: 20556,
924
+ break: 20555,
925
+ try: 20577,
926
+ catch: 20557,
927
+ delete: 16863276,
928
+ throw: 86112,
929
+ switch: 86110,
930
+ continue: 20559,
931
+ default: 20561,
932
+ instanceof: 8411187,
933
+ do: 20562,
934
+ void: 16863277,
935
+ finally: 20566,
936
+ async: 209005,
937
+ await: 209006,
938
+ class: 86094,
939
+ const: 86090,
940
+ constructor: 12399,
941
+ debugger: 20560,
942
+ export: 20564,
943
+ extends: 20565,
944
+ false: 86021,
945
+ from: 209011,
946
+ get: 209008,
947
+ implements: 36964,
948
+ import: 86106,
949
+ interface: 36965,
950
+ let: 241737,
951
+ null: 86023,
952
+ of: 471156,
953
+ package: 36966,
954
+ private: 36967,
955
+ protected: 36968,
956
+ public: 36969,
957
+ set: 209009,
958
+ static: 36970,
959
+ super: 86109,
960
+ true: 86022,
961
+ with: 20579,
962
+ yield: 241771,
963
+ enum: 86133,
964
+ eval: 537079926,
965
+ as: 77932,
966
+ arguments: 537079927,
967
+ target: 209029,
968
+ meta: 209030,
969
+ accessor: 12402,
970
+ };
971
+
972
+ function scanIdentifier(parser, context, isValidAsKeyword) {
973
+ while (isIdPart[advanceChar(parser)])
974
+ ;
975
+ parser.tokenValue = parser.source.slice(parser.tokenIndex, parser.index);
976
+ return parser.currentChar !== 92 && parser.currentChar <= 0x7e
977
+ ? (getOwnProperty(descKeywordTable, parser.tokenValue) ?? 208897)
978
+ : scanIdentifierSlowCase(parser, context, 0, isValidAsKeyword);
979
+ }
980
+ function scanUnicodeIdentifier(parser, context) {
981
+ const cookedChar = scanIdentifierUnicodeEscape(parser);
982
+ if (!isIdentifierStart$1(cookedChar))
983
+ parser.report(5);
984
+ parser.tokenValue = String.fromCodePoint(cookedChar);
985
+ return scanIdentifierSlowCase(parser, context, 1, CharTypes[cookedChar] & 4);
986
+ }
987
+ function scanIdentifierSlowCase(parser, context, hasEscape, isValidAsKeyword) {
988
+ let start = parser.index;
989
+ while (parser.index < parser.end) {
990
+ if (parser.currentChar === 92) {
991
+ parser.tokenValue += parser.source.slice(start, parser.index);
992
+ hasEscape = 1;
993
+ const code = scanIdentifierUnicodeEscape(parser);
994
+ if (!isIdentifierPart(code))
995
+ parser.report(5);
996
+ isValidAsKeyword = isValidAsKeyword && CharTypes[code] & 4;
997
+ parser.tokenValue += String.fromCodePoint(code);
998
+ start = parser.index;
712
999
  }
713
1000
  else {
714
- switch (ch) {
715
- case 47:
716
- if (!preparseState)
717
- break loop;
718
- else
719
- break;
720
- case 92:
721
- preparseState |= RegexState.Escape;
722
- break;
723
- case 91:
724
- preparseState |= RegexState.Class;
725
- break;
726
- case 93:
727
- preparseState &= RegexState.Escape;
728
- break;
1001
+ const merged = consumePossibleSurrogatePair(parser);
1002
+ if (merged > 0) {
1003
+ if (!isIdentifierPart(merged)) {
1004
+ parser.report(20, String.fromCodePoint(merged));
1005
+ }
1006
+ parser.currentChar = merged;
1007
+ parser.index++;
1008
+ parser.column++;
729
1009
  }
730
- }
731
- if (ch === 13 ||
732
- ch === 10 ||
733
- ch === 8232 ||
734
- ch === 8233) {
735
- parser.report(34);
736
- }
737
- if (parser.index >= parser.source.length) {
738
- return parser.report(34);
1010
+ else if (!isIdentifierPart(parser.currentChar)) {
1011
+ break;
1012
+ }
1013
+ advanceChar(parser);
739
1014
  }
740
1015
  }
741
- const bodyEnd = parser.index - 1;
742
- let mask = RegexFlags.Empty;
1016
+ if (parser.index <= parser.end) {
1017
+ parser.tokenValue += parser.source.slice(start, parser.index);
1018
+ }
1019
+ const { length } = parser.tokenValue;
1020
+ if (isValidAsKeyword && length >= 2 && length <= 11) {
1021
+ const token = getOwnProperty(descKeywordTable, parser.tokenValue);
1022
+ if (token === void 0)
1023
+ return 208897 | (hasEscape ? -2147483648 : 0);
1024
+ if (!hasEscape)
1025
+ return token;
1026
+ if (token === 209006) {
1027
+ if ((context & (2 | 2048)) === 0) {
1028
+ return token | -2147483648;
1029
+ }
1030
+ return -2147483528;
1031
+ }
1032
+ if (context & 1) {
1033
+ if (token === 36970) {
1034
+ return -2147483527;
1035
+ }
1036
+ if ((token & 36864) === 36864) {
1037
+ return -2147483527;
1038
+ }
1039
+ if ((token & 20480) === 20480) {
1040
+ if (context & 262144 && (context & 8) === 0) {
1041
+ return token | -2147483648;
1042
+ }
1043
+ else {
1044
+ return -2147483528;
1045
+ }
1046
+ }
1047
+ return 209018 | -2147483648;
1048
+ }
1049
+ if (context & 262144 &&
1050
+ (context & 8) === 0 &&
1051
+ (token & 20480) === 20480) {
1052
+ return token | -2147483648;
1053
+ }
1054
+ if (token === 241771) {
1055
+ return context & 262144
1056
+ ? 209018 | -2147483648
1057
+ : context & 1024
1058
+ ? -2147483528
1059
+ : token | -2147483648;
1060
+ }
1061
+ if (token === 209005) {
1062
+ return 209018 | -2147483648;
1063
+ }
1064
+ if ((token & 36864) === 36864) {
1065
+ return token | 12288 | -2147483648;
1066
+ }
1067
+ return -2147483528;
1068
+ }
1069
+ return 208897 | (hasEscape ? -2147483648 : 0);
1070
+ }
1071
+ function scanPrivateIdentifier(parser) {
1072
+ let char = advanceChar(parser);
1073
+ if (char === 92)
1074
+ return 130;
1075
+ const merged = consumePossibleSurrogatePair(parser);
1076
+ if (merged)
1077
+ char = merged;
1078
+ if (!isIdentifierStart$1(char))
1079
+ parser.report(96);
1080
+ return 130;
1081
+ }
1082
+ function scanIdentifierUnicodeEscape(parser) {
1083
+ if (parser.source.charCodeAt(parser.index + 1) !== 117) {
1084
+ parser.report(5);
1085
+ }
1086
+ parser.currentChar = parser.source.charCodeAt((parser.index += 2));
1087
+ parser.column += 2;
1088
+ return scanUnicodeEscape(parser);
1089
+ }
1090
+ function scanUnicodeEscape(parser) {
1091
+ let codePoint = 0;
1092
+ const char = parser.currentChar;
1093
+ if (char === 123) {
1094
+ const begin = parser.index - 2;
1095
+ while (CharTypes[advanceChar(parser)] & 64) {
1096
+ codePoint = (codePoint << 4) | toHex(parser.currentChar);
1097
+ if (codePoint > 1114111)
1098
+ throw new ParseError({ index: begin, line: parser.line, column: parser.column }, parser.currentLocation, 104);
1099
+ }
1100
+ if (parser.currentChar !== 125) {
1101
+ throw new ParseError({ index: begin, line: parser.line, column: parser.column }, parser.currentLocation, 7);
1102
+ }
1103
+ advanceChar(parser);
1104
+ return codePoint;
1105
+ }
1106
+ if ((CharTypes[char] & 64) === 0)
1107
+ parser.report(7);
1108
+ const char2 = parser.source.charCodeAt(parser.index + 1);
1109
+ if ((CharTypes[char2] & 64) === 0)
1110
+ parser.report(7);
1111
+ const char3 = parser.source.charCodeAt(parser.index + 2);
1112
+ if ((CharTypes[char3] & 64) === 0)
1113
+ parser.report(7);
1114
+ const char4 = parser.source.charCodeAt(parser.index + 3);
1115
+ if ((CharTypes[char4] & 64) === 0)
1116
+ parser.report(7);
1117
+ codePoint = (toHex(char) << 12) | (toHex(char2) << 8) | (toHex(char3) << 4) | toHex(char4);
1118
+ parser.currentChar = parser.source.charCodeAt((parser.index += 4));
1119
+ parser.column += 4;
1120
+ return codePoint;
1121
+ }
1122
+
1123
+ function scanNumber(parser, context, kind) {
1124
+ let char = parser.currentChar;
1125
+ let value = 0;
1126
+ let digit = 9;
1127
+ let atStart = kind & 64 ? 0 : 1;
1128
+ let digits = 0;
1129
+ let allowSeparator = 0;
1130
+ if (kind & 64) {
1131
+ value = '.' + scanDecimalDigitsOrSeparator(parser, char);
1132
+ char = parser.currentChar;
1133
+ if (char === 110)
1134
+ parser.report(12);
1135
+ }
1136
+ else {
1137
+ if (char === 48) {
1138
+ char = advanceChar(parser);
1139
+ if ((char | 32) === 120) {
1140
+ kind = 8 | 128;
1141
+ char = advanceChar(parser);
1142
+ while (CharTypes[char] & (64 | 4096)) {
1143
+ if (char === 95) {
1144
+ if (!allowSeparator)
1145
+ parser.report(152);
1146
+ allowSeparator = 0;
1147
+ char = advanceChar(parser);
1148
+ continue;
1149
+ }
1150
+ allowSeparator = 1;
1151
+ value = value * 0x10 + toHex(char);
1152
+ digits++;
1153
+ char = advanceChar(parser);
1154
+ }
1155
+ if (digits === 0 || !allowSeparator) {
1156
+ parser.report(digits === 0 ? 21 : 153);
1157
+ }
1158
+ }
1159
+ else if ((char | 32) === 111) {
1160
+ kind = 4 | 128;
1161
+ char = advanceChar(parser);
1162
+ while (CharTypes[char] & (32 | 4096)) {
1163
+ if (char === 95) {
1164
+ if (!allowSeparator) {
1165
+ parser.report(152);
1166
+ }
1167
+ allowSeparator = 0;
1168
+ char = advanceChar(parser);
1169
+ continue;
1170
+ }
1171
+ allowSeparator = 1;
1172
+ value = value * 8 + (char - 48);
1173
+ digits++;
1174
+ char = advanceChar(parser);
1175
+ }
1176
+ if (digits === 0 || !allowSeparator) {
1177
+ parser.report(digits === 0 ? 0 : 153);
1178
+ }
1179
+ }
1180
+ else if ((char | 32) === 98) {
1181
+ kind = 2 | 128;
1182
+ char = advanceChar(parser);
1183
+ while (CharTypes[char] & (128 | 4096)) {
1184
+ if (char === 95) {
1185
+ if (!allowSeparator) {
1186
+ parser.report(152);
1187
+ }
1188
+ allowSeparator = 0;
1189
+ char = advanceChar(parser);
1190
+ continue;
1191
+ }
1192
+ allowSeparator = 1;
1193
+ value = value * 2 + (char - 48);
1194
+ digits++;
1195
+ char = advanceChar(parser);
1196
+ }
1197
+ if (digits === 0 || !allowSeparator) {
1198
+ parser.report(digits === 0 ? 0 : 153);
1199
+ }
1200
+ }
1201
+ else if (CharTypes[char] & 32) {
1202
+ if (context & 1)
1203
+ parser.report(1);
1204
+ kind = 1;
1205
+ while (CharTypes[char] & 16) {
1206
+ if (CharTypes[char] & 512) {
1207
+ kind = 32;
1208
+ atStart = 0;
1209
+ break;
1210
+ }
1211
+ value = value * 8 + (char - 48);
1212
+ char = advanceChar(parser);
1213
+ }
1214
+ }
1215
+ else if (CharTypes[char] & 512) {
1216
+ if (context & 1)
1217
+ parser.report(1);
1218
+ parser.flags |= 64;
1219
+ kind = 32;
1220
+ }
1221
+ else if (char === 95) {
1222
+ parser.report(0);
1223
+ }
1224
+ }
1225
+ if (kind & 48) {
1226
+ if (atStart) {
1227
+ while (digit >= 0 && CharTypes[char] & (16 | 4096)) {
1228
+ if (char === 95) {
1229
+ char = advanceChar(parser);
1230
+ if (char === 95 || kind & 32) {
1231
+ throw new ParseError(parser.currentLocation, { index: parser.index + 1, line: parser.line, column: parser.column }, 152);
1232
+ }
1233
+ allowSeparator = 1;
1234
+ continue;
1235
+ }
1236
+ allowSeparator = 0;
1237
+ value = 10 * value + (char - 48);
1238
+ char = advanceChar(parser);
1239
+ --digit;
1240
+ }
1241
+ if (allowSeparator) {
1242
+ throw new ParseError(parser.currentLocation, { index: parser.index + 1, line: parser.line, column: parser.column }, 153);
1243
+ }
1244
+ if (digit >= 0 && !isIdentifierStart$1(char) && char !== 46) {
1245
+ parser.tokenValue = value;
1246
+ if (parser.options.raw)
1247
+ parser.tokenRaw = parser.source.slice(parser.tokenIndex, parser.index);
1248
+ return 134283266;
1249
+ }
1250
+ }
1251
+ value += scanDecimalDigitsOrSeparator(parser, char);
1252
+ char = parser.currentChar;
1253
+ if (char === 46) {
1254
+ if (advanceChar(parser) === 95)
1255
+ parser.report(0);
1256
+ kind = 64;
1257
+ value += '.' + scanDecimalDigitsOrSeparator(parser, parser.currentChar);
1258
+ char = parser.currentChar;
1259
+ }
1260
+ }
1261
+ }
1262
+ const end = parser.index;
1263
+ let isBigInt = 0;
1264
+ if (char === 110 && kind & 128) {
1265
+ isBigInt = 1;
1266
+ char = advanceChar(parser);
1267
+ }
1268
+ else {
1269
+ if ((char | 32) === 101) {
1270
+ char = advanceChar(parser);
1271
+ if (CharTypes[char] & 256)
1272
+ char = advanceChar(parser);
1273
+ const { index } = parser;
1274
+ if ((CharTypes[char] & 16) === 0)
1275
+ parser.report(11);
1276
+ value += parser.source.substring(end, index) + scanDecimalDigitsOrSeparator(parser, char);
1277
+ char = parser.currentChar;
1278
+ }
1279
+ }
1280
+ if ((parser.index < parser.end && CharTypes[char] & 16) || isIdentifierStart$1(char)) {
1281
+ parser.report(13);
1282
+ }
1283
+ if (isBigInt) {
1284
+ parser.tokenRaw = parser.source.slice(parser.tokenIndex, parser.index);
1285
+ parser.tokenValue = BigInt(parser.tokenRaw.slice(0, -1).replaceAll('_', ''));
1286
+ return 134283388;
1287
+ }
1288
+ parser.tokenValue =
1289
+ kind & (1 | 2 | 8 | 4)
1290
+ ? value
1291
+ : kind & 32
1292
+ ? parseFloat(parser.source.substring(parser.tokenIndex, parser.index))
1293
+ : +value;
1294
+ if (parser.options.raw)
1295
+ parser.tokenRaw = parser.source.slice(parser.tokenIndex, parser.index);
1296
+ return 134283266;
1297
+ }
1298
+ function scanDecimalDigitsOrSeparator(parser, char) {
1299
+ let allowSeparator = 0;
1300
+ let start = parser.index;
1301
+ let ret = '';
1302
+ while (CharTypes[char] & (16 | 4096)) {
1303
+ if (char === 95) {
1304
+ const { index } = parser;
1305
+ char = advanceChar(parser);
1306
+ if (char === 95) {
1307
+ throw new ParseError(parser.currentLocation, { index: parser.index + 1, line: parser.line, column: parser.column }, 152);
1308
+ }
1309
+ allowSeparator = 1;
1310
+ ret += parser.source.substring(start, index);
1311
+ start = parser.index;
1312
+ continue;
1313
+ }
1314
+ allowSeparator = 0;
1315
+ char = advanceChar(parser);
1316
+ }
1317
+ if (allowSeparator) {
1318
+ throw new ParseError(parser.currentLocation, { index: parser.index + 1, line: parser.line, column: parser.column }, 153);
1319
+ }
1320
+ return ret + parser.source.substring(start, parser.index);
1321
+ }
1322
+
1323
+ var RegexState;
1324
+ (function (RegexState) {
1325
+ RegexState[RegexState["Empty"] = 0] = "Empty";
1326
+ RegexState[RegexState["Escape"] = 1] = "Escape";
1327
+ RegexState[RegexState["Class"] = 2] = "Class";
1328
+ })(RegexState || (RegexState = {}));
1329
+ var RegexFlags;
1330
+ (function (RegexFlags) {
1331
+ RegexFlags[RegexFlags["Empty"] = 0] = "Empty";
1332
+ RegexFlags[RegexFlags["IgnoreCase"] = 1] = "IgnoreCase";
1333
+ RegexFlags[RegexFlags["Global"] = 2] = "Global";
1334
+ RegexFlags[RegexFlags["Multiline"] = 4] = "Multiline";
1335
+ RegexFlags[RegexFlags["Unicode"] = 16] = "Unicode";
1336
+ RegexFlags[RegexFlags["Sticky"] = 8] = "Sticky";
1337
+ RegexFlags[RegexFlags["DotAll"] = 32] = "DotAll";
1338
+ RegexFlags[RegexFlags["Indices"] = 64] = "Indices";
1339
+ RegexFlags[RegexFlags["UnicodeSets"] = 128] = "UnicodeSets";
1340
+ })(RegexFlags || (RegexFlags = {}));
1341
+ function scanRegularExpression(parser) {
1342
+ const bodyStart = parser.index;
1343
+ let preparseState = RegexState.Empty;
1344
+ loop: while (true) {
1345
+ const ch = parser.currentChar;
1346
+ advanceChar(parser);
1347
+ if (preparseState & RegexState.Escape) {
1348
+ preparseState &= ~RegexState.Escape;
1349
+ }
1350
+ else {
1351
+ switch (ch) {
1352
+ case 47:
1353
+ if (!preparseState)
1354
+ break loop;
1355
+ else
1356
+ break;
1357
+ case 92:
1358
+ preparseState |= RegexState.Escape;
1359
+ break;
1360
+ case 91:
1361
+ preparseState |= RegexState.Class;
1362
+ break;
1363
+ case 93:
1364
+ preparseState &= RegexState.Escape;
1365
+ break;
1366
+ }
1367
+ }
1368
+ if (ch === 13 ||
1369
+ ch === 10 ||
1370
+ ch === 8232 ||
1371
+ ch === 8233) {
1372
+ parser.report(34);
1373
+ }
1374
+ if (parser.index >= parser.source.length) {
1375
+ return parser.report(34);
1376
+ }
1377
+ }
1378
+ const bodyEnd = parser.index - 1;
1379
+ let mask = RegexFlags.Empty;
743
1380
  let char = parser.currentChar;
744
1381
  const { index: flagStart } = parser;
745
1382
  while (isIdentifierPart(char)) {
@@ -806,13 +1443,10 @@
806
1443
  return new RegExp(pattern, flags);
807
1444
  }
808
1445
  catch {
809
- try {
810
- new RegExp(pattern, flags);
1446
+ if (!parser.options.validateRegex) {
811
1447
  return null;
812
1448
  }
813
- catch {
814
- parser.report(34);
815
- }
1449
+ parser.report(34);
816
1450
  }
817
1451
  }
818
1452
 
@@ -1101,824 +1735,6 @@
1101
1735
  return scanTemplate(parser, context);
1102
1736
  }
1103
1737
 
1104
- const errorMessages = {
1105
- [0]: 'Unexpected token',
1106
- [30]: "Unexpected token: '%0'",
1107
- [1]: 'Octal escape sequences are not allowed in strict mode',
1108
- [2]: 'Octal escape sequences are not allowed in template strings',
1109
- [3]: '\\8 and \\9 are not allowed in template strings',
1110
- [4]: 'Private identifier #%0 is not defined',
1111
- [5]: 'Illegal Unicode escape sequence',
1112
- [6]: 'Invalid code point %0',
1113
- [7]: 'Invalid hexadecimal escape sequence',
1114
- [9]: 'Octal literals are not allowed in strict mode',
1115
- [8]: 'Decimal integer literals with a leading zero are forbidden in strict mode',
1116
- [10]: 'Expected number in radix %0',
1117
- [151]: 'Invalid left-hand side assignment to a destructible right-hand side',
1118
- [11]: 'Non-number found after exponent indicator',
1119
- [12]: 'Invalid BigIntLiteral',
1120
- [13]: 'No identifiers allowed directly after numeric literal',
1121
- [14]: 'Escapes \\8 or \\9 are not syntactically valid escapes',
1122
- [15]: 'Escapes \\8 or \\9 are not allowed in strict mode',
1123
- [16]: 'Unterminated string literal',
1124
- [17]: 'Unterminated template literal',
1125
- [18]: 'Multiline comment was not closed properly',
1126
- [19]: 'The identifier contained dynamic unicode escape that was not closed',
1127
- [20]: "Illegal character '%0'",
1128
- [21]: 'Missing hexadecimal digits',
1129
- [22]: 'Invalid implicit octal',
1130
- [23]: 'Invalid line break in string literal',
1131
- [24]: 'Only unicode escapes are legal in identifier names',
1132
- [25]: "Expected '%0'",
1133
- [26]: 'Invalid left-hand side in assignment',
1134
- [27]: 'Invalid left-hand side in async arrow',
1135
- [28]: 'Calls to super must be in the "constructor" method of a class expression or class declaration that has a superclass',
1136
- [29]: 'Member access on super must be in a method',
1137
- [31]: 'Await expression not allowed in formal parameter',
1138
- [32]: 'Yield expression not allowed in formal parameter',
1139
- [95]: "Unexpected token: 'escaped keyword'",
1140
- [33]: 'Unary expressions as the left operand of an exponentiation expression must be disambiguated with parentheses',
1141
- [123]: 'Async functions can only be declared at the top level or inside a block',
1142
- [34]: 'Unterminated regular expression',
1143
- [35]: 'Unexpected regular expression flag',
1144
- [36]: "Duplicate regular expression flag '%0'",
1145
- [37]: '%0 functions must have exactly %1 argument%2',
1146
- [38]: 'Setter function argument must not be a rest parameter',
1147
- [39]: '%0 declaration must have a name in this context',
1148
- [40]: 'Function name may not contain any reserved words or be eval or arguments in strict mode',
1149
- [41]: 'The rest operator is missing an argument',
1150
- [42]: 'A getter cannot be a generator',
1151
- [43]: 'A setter cannot be a generator',
1152
- [44]: 'A computed property name must be followed by a colon or paren',
1153
- [134]: 'Object literal keys that are strings or numbers must be a method or have a colon',
1154
- [46]: 'Found `* async x(){}` but this should be `async * x(){}`',
1155
- [45]: 'Getters and setters can not be generators',
1156
- [47]: "'%0' can not be generator method",
1157
- [48]: "No line break is allowed after '=>'",
1158
- [49]: 'The left-hand side of the arrow can only be destructed through assignment',
1159
- [50]: 'The binding declaration is not destructible',
1160
- [51]: 'Async arrow can not be followed by new expression',
1161
- [52]: "Classes may not have a static property named 'prototype'",
1162
- [53]: 'Class constructor may not be a %0',
1163
- [54]: 'Duplicate constructor method in class',
1164
- [55]: 'Invalid increment/decrement operand',
1165
- [56]: 'Invalid use of `new` keyword on an increment/decrement expression',
1166
- [57]: '`=>` is an invalid assignment target',
1167
- [58]: 'Rest element may not have a trailing comma',
1168
- [59]: 'Missing initializer in %0 declaration',
1169
- [60]: "'for-%0' loop head declarations can not have an initializer",
1170
- [61]: 'Invalid left-hand side in for-%0 loop: Must have a single binding',
1171
- [62]: 'Invalid shorthand property initializer',
1172
- [63]: 'Property name __proto__ appears more than once in object literal',
1173
- [64]: 'Let is disallowed as a lexically bound name',
1174
- [65]: "Invalid use of '%0' inside new expression",
1175
- [66]: "Illegal 'use strict' directive in function with non-simple parameter list",
1176
- [67]: 'Identifier "let" disallowed as left-hand side expression in strict mode',
1177
- [68]: 'Illegal continue statement',
1178
- [69]: 'Illegal break statement',
1179
- [70]: 'Cannot have `let[...]` as a var name in strict mode',
1180
- [71]: 'Invalid destructuring assignment target',
1181
- [72]: 'Rest parameter may not have a default initializer',
1182
- [73]: 'The rest argument must the be last parameter',
1183
- [74]: 'Invalid rest argument',
1184
- [76]: 'In strict mode code, functions can only be declared at top level or inside a block',
1185
- [77]: 'In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement',
1186
- [78]: 'Without web compatibility enabled functions can not be declared at top level, inside a block, or as the body of an if statement',
1187
- [79]: "Class declaration can't appear in single-statement context",
1188
- [80]: 'Invalid left-hand side in for-%0',
1189
- [81]: 'Invalid assignment in for-%0',
1190
- [82]: 'for await (... of ...) is only valid in async functions and async generators',
1191
- [83]: 'The first token after the template expression should be a continuation of the template',
1192
- [85]: '`let` declaration not allowed here and `let` cannot be a regular var name in strict mode',
1193
- [84]: '`let \n [` is a restricted production at the start of a statement',
1194
- [86]: 'Catch clause requires exactly one parameter, not more (and no trailing comma)',
1195
- [87]: 'Catch clause parameter does not support default values',
1196
- [88]: 'Missing catch or finally after try',
1197
- [89]: 'More than one default clause in switch statement',
1198
- [90]: 'Illegal newline after throw',
1199
- [91]: 'Strict mode code may not include a with statement',
1200
- [92]: 'Illegal return statement',
1201
- [93]: 'The left hand side of the for-header binding declaration is not destructible',
1202
- [94]: 'new.target only allowed within functions or static blocks',
1203
- [96]: "'#' not followed by identifier",
1204
- [102]: 'Invalid keyword',
1205
- [101]: "Can not use 'let' as a class name",
1206
- [100]: "'A lexical declaration can't define a 'let' binding",
1207
- [99]: 'Can not use `let` as variable name in strict mode',
1208
- [97]: "'%0' may not be used as an identifier in this context",
1209
- [98]: 'Await is only valid in async functions',
1210
- [103]: 'The %0 keyword can only be used with the module goal',
1211
- [104]: 'Unicode codepoint must not be greater than 0x10FFFF',
1212
- [105]: '%0 source must be string',
1213
- [106]: 'Only a identifier or string can be used to indicate alias',
1214
- [107]: "Only '*' or '{...}' can be imported after default",
1215
- [108]: 'Trailing decorator may be followed by method',
1216
- [109]: "Decorators can't be used with a constructor",
1217
- [110]: 'Can not use `await` as identifier in module or async func',
1218
- [111]: 'Can not use `await` as identifier in module',
1219
- [112]: 'HTML comments are only allowed with web compatibility (Annex B)',
1220
- [113]: "The identifier 'let' must not be in expression position in strict mode",
1221
- [114]: 'Cannot assign to `eval` and `arguments` in strict mode',
1222
- [115]: "The left-hand side of a for-of loop may not start with 'let'",
1223
- [116]: 'Block body arrows can not be immediately invoked without a group',
1224
- [117]: 'Block body arrows can not be immediately accessed without a group',
1225
- [118]: 'Unexpected strict mode reserved word',
1226
- [119]: 'Unexpected eval or arguments in strict mode',
1227
- [120]: 'Decorators must not be followed by a semicolon',
1228
- [121]: 'Calling delete on expression not allowed in strict mode',
1229
- [122]: 'Pattern can not have a tail',
1230
- [124]: 'Can not have a `yield` expression on the left side of a ternary',
1231
- [125]: 'An arrow function can not have a postfix update operator',
1232
- [126]: 'Invalid object literal key character after generator star',
1233
- [127]: 'Private fields can not be deleted',
1234
- [129]: 'Classes may not have a field called constructor',
1235
- [128]: 'Classes may not have a private element named constructor',
1236
- [130]: 'A class field initializer or static block may not contain arguments',
1237
- [131]: 'Generators can only be declared at the top level or inside a block',
1238
- [132]: 'Async methods are a restricted production and cannot have a newline following it',
1239
- [133]: 'Unexpected character after object literal property name',
1240
- [135]: 'Invalid key token',
1241
- [136]: "Label '%0' has already been declared",
1242
- [137]: 'continue statement must be nested within an iteration statement',
1243
- [138]: "Undefined label '%0'",
1244
- [139]: 'Trailing comma is disallowed inside import(...) arguments',
1245
- [140]: 'Invalid binding in JSON import',
1246
- [141]: 'import() requires exactly one argument',
1247
- [142]: 'Cannot use new with import(...)',
1248
- [143]: '... is not allowed in import()',
1249
- [144]: "Expected '=>'",
1250
- [145]: "Duplicate binding '%0'",
1251
- [146]: 'Duplicate private identifier #%0',
1252
- [147]: "Cannot export a duplicate name '%0'",
1253
- [150]: 'Duplicate %0 for-binding',
1254
- [148]: "Exported binding '%0' needs to refer to a top-level declared variable",
1255
- [149]: 'Unexpected private field',
1256
- [153]: 'Numeric separators are not allowed at the end of numeric literals',
1257
- [152]: 'Only one underscore is allowed as numeric separator',
1258
- [154]: 'JSX value should be either an expression or a quoted JSX text',
1259
- [155]: 'Expected corresponding JSX closing tag for %0',
1260
- [156]: 'Adjacent JSX elements must be wrapped in an enclosing tag',
1261
- [157]: "JSX attributes must only be assigned a non-empty 'expression'",
1262
- [158]: "'%0' has already been declared",
1263
- [159]: "'%0' shadowed a catch clause binding",
1264
- [160]: 'Dot property must be an identifier',
1265
- [161]: 'Encountered invalid input after spread/rest argument',
1266
- [162]: 'Catch without try',
1267
- [163]: 'Finally without try',
1268
- [164]: 'Expected corresponding closing tag for JSX fragment',
1269
- [165]: 'Coalescing and logical operators used together in the same expression must be disambiguated with parentheses',
1270
- [166]: 'Invalid tagged template on optional chain',
1271
- [167]: 'Invalid optional chain from super property',
1272
- [168]: 'Invalid optional chain from new expression',
1273
- [169]: 'Cannot use "import.meta" outside a module',
1274
- [170]: 'Leading decorators must be attached to a class declaration',
1275
- [171]: 'An export name cannot include a lone surrogate, found %0',
1276
- [172]: 'A string literal cannot be used as an exported binding without `from`',
1277
- [173]: "Private fields can't be accessed on super",
1278
- [174]: "The only valid meta property for import is 'import.meta'",
1279
- [175]: "'import.meta' must not contain escaped characters",
1280
- [176]: 'cannot use "await" as identifier inside an async function',
1281
- [177]: 'cannot use "await" in static blocks',
1282
- };
1283
- class ParseError extends SyntaxError {
1284
- start;
1285
- end;
1286
- range;
1287
- loc;
1288
- description;
1289
- constructor(start, end, type, ...params) {
1290
- const description = errorMessages[type].replace(/%(\d+)/g, (_, i) => params[i]);
1291
- const message = '[' + start.line + ':' + start.column + '-' + end.line + ':' + end.column + ']: ' + description;
1292
- super(message);
1293
- this.start = start.index;
1294
- this.end = end.index;
1295
- this.range = [start.index, end.index];
1296
- this.loc = {
1297
- start: { line: start.line, column: start.column },
1298
- end: { line: end.line, column: end.column },
1299
- };
1300
- this.description = description;
1301
- }
1302
- }
1303
-
1304
- function scanNumber(parser, context, kind) {
1305
- let char = parser.currentChar;
1306
- let value = 0;
1307
- let digit = 9;
1308
- let atStart = kind & 64 ? 0 : 1;
1309
- let digits = 0;
1310
- let allowSeparator = 0;
1311
- if (kind & 64) {
1312
- value = '.' + scanDecimalDigitsOrSeparator(parser, char);
1313
- char = parser.currentChar;
1314
- if (char === 110)
1315
- parser.report(12);
1316
- }
1317
- else {
1318
- if (char === 48) {
1319
- char = advanceChar(parser);
1320
- if ((char | 32) === 120) {
1321
- kind = 8 | 128;
1322
- char = advanceChar(parser);
1323
- while (CharTypes[char] & (64 | 4096)) {
1324
- if (char === 95) {
1325
- if (!allowSeparator)
1326
- parser.report(152);
1327
- allowSeparator = 0;
1328
- char = advanceChar(parser);
1329
- continue;
1330
- }
1331
- allowSeparator = 1;
1332
- value = value * 0x10 + toHex(char);
1333
- digits++;
1334
- char = advanceChar(parser);
1335
- }
1336
- if (digits === 0 || !allowSeparator) {
1337
- parser.report(digits === 0 ? 21 : 153);
1338
- }
1339
- }
1340
- else if ((char | 32) === 111) {
1341
- kind = 4 | 128;
1342
- char = advanceChar(parser);
1343
- while (CharTypes[char] & (32 | 4096)) {
1344
- if (char === 95) {
1345
- if (!allowSeparator) {
1346
- parser.report(152);
1347
- }
1348
- allowSeparator = 0;
1349
- char = advanceChar(parser);
1350
- continue;
1351
- }
1352
- allowSeparator = 1;
1353
- value = value * 8 + (char - 48);
1354
- digits++;
1355
- char = advanceChar(parser);
1356
- }
1357
- if (digits === 0 || !allowSeparator) {
1358
- parser.report(digits === 0 ? 0 : 153);
1359
- }
1360
- }
1361
- else if ((char | 32) === 98) {
1362
- kind = 2 | 128;
1363
- char = advanceChar(parser);
1364
- while (CharTypes[char] & (128 | 4096)) {
1365
- if (char === 95) {
1366
- if (!allowSeparator) {
1367
- parser.report(152);
1368
- }
1369
- allowSeparator = 0;
1370
- char = advanceChar(parser);
1371
- continue;
1372
- }
1373
- allowSeparator = 1;
1374
- value = value * 2 + (char - 48);
1375
- digits++;
1376
- char = advanceChar(parser);
1377
- }
1378
- if (digits === 0 || !allowSeparator) {
1379
- parser.report(digits === 0 ? 0 : 153);
1380
- }
1381
- }
1382
- else if (CharTypes[char] & 32) {
1383
- if (context & 1)
1384
- parser.report(1);
1385
- kind = 1;
1386
- while (CharTypes[char] & 16) {
1387
- if (CharTypes[char] & 512) {
1388
- kind = 32;
1389
- atStart = 0;
1390
- break;
1391
- }
1392
- value = value * 8 + (char - 48);
1393
- char = advanceChar(parser);
1394
- }
1395
- }
1396
- else if (CharTypes[char] & 512) {
1397
- if (context & 1)
1398
- parser.report(1);
1399
- parser.flags |= 64;
1400
- kind = 32;
1401
- }
1402
- else if (char === 95) {
1403
- parser.report(0);
1404
- }
1405
- }
1406
- if (kind & 48) {
1407
- if (atStart) {
1408
- while (digit >= 0 && CharTypes[char] & (16 | 4096)) {
1409
- if (char === 95) {
1410
- char = advanceChar(parser);
1411
- if (char === 95 || kind & 32) {
1412
- throw new ParseError(parser.currentLocation, { index: parser.index + 1, line: parser.line, column: parser.column }, 152);
1413
- }
1414
- allowSeparator = 1;
1415
- continue;
1416
- }
1417
- allowSeparator = 0;
1418
- value = 10 * value + (char - 48);
1419
- char = advanceChar(parser);
1420
- --digit;
1421
- }
1422
- if (allowSeparator) {
1423
- throw new ParseError(parser.currentLocation, { index: parser.index + 1, line: parser.line, column: parser.column }, 153);
1424
- }
1425
- if (digit >= 0 && !isIdentifierStart$1(char) && char !== 46) {
1426
- parser.tokenValue = value;
1427
- if (parser.options.raw)
1428
- parser.tokenRaw = parser.source.slice(parser.tokenIndex, parser.index);
1429
- return 134283266;
1430
- }
1431
- }
1432
- value += scanDecimalDigitsOrSeparator(parser, char);
1433
- char = parser.currentChar;
1434
- if (char === 46) {
1435
- if (advanceChar(parser) === 95)
1436
- parser.report(0);
1437
- kind = 64;
1438
- value += '.' + scanDecimalDigitsOrSeparator(parser, parser.currentChar);
1439
- char = parser.currentChar;
1440
- }
1441
- }
1442
- }
1443
- const end = parser.index;
1444
- let isBigInt = 0;
1445
- if (char === 110 && kind & 128) {
1446
- isBigInt = 1;
1447
- char = advanceChar(parser);
1448
- }
1449
- else {
1450
- if ((char | 32) === 101) {
1451
- char = advanceChar(parser);
1452
- if (CharTypes[char] & 256)
1453
- char = advanceChar(parser);
1454
- const { index } = parser;
1455
- if ((CharTypes[char] & 16) === 0)
1456
- parser.report(11);
1457
- value += parser.source.substring(end, index) + scanDecimalDigitsOrSeparator(parser, char);
1458
- char = parser.currentChar;
1459
- }
1460
- }
1461
- if ((parser.index < parser.end && CharTypes[char] & 16) || isIdentifierStart$1(char)) {
1462
- parser.report(13);
1463
- }
1464
- if (isBigInt) {
1465
- parser.tokenRaw = parser.source.slice(parser.tokenIndex, parser.index);
1466
- parser.tokenValue = BigInt(parser.tokenRaw.slice(0, -1).replaceAll('_', ''));
1467
- return 134283388;
1468
- }
1469
- parser.tokenValue =
1470
- kind & (1 | 2 | 8 | 4)
1471
- ? value
1472
- : kind & 32
1473
- ? parseFloat(parser.source.substring(parser.tokenIndex, parser.index))
1474
- : +value;
1475
- if (parser.options.raw)
1476
- parser.tokenRaw = parser.source.slice(parser.tokenIndex, parser.index);
1477
- return 134283266;
1478
- }
1479
- function scanDecimalDigitsOrSeparator(parser, char) {
1480
- let allowSeparator = 0;
1481
- let start = parser.index;
1482
- let ret = '';
1483
- while (CharTypes[char] & (16 | 4096)) {
1484
- if (char === 95) {
1485
- const { index } = parser;
1486
- char = advanceChar(parser);
1487
- if (char === 95) {
1488
- throw new ParseError(parser.currentLocation, { index: parser.index + 1, line: parser.line, column: parser.column }, 152);
1489
- }
1490
- allowSeparator = 1;
1491
- ret += parser.source.substring(start, index);
1492
- start = parser.index;
1493
- continue;
1494
- }
1495
- allowSeparator = 0;
1496
- char = advanceChar(parser);
1497
- }
1498
- if (allowSeparator) {
1499
- throw new ParseError(parser.currentLocation, { index: parser.index + 1, line: parser.line, column: parser.column }, 153);
1500
- }
1501
- return ret + parser.source.substring(start, parser.index);
1502
- }
1503
-
1504
- const KeywordDescTable = [
1505
- 'end of source',
1506
- 'identifier', 'number', 'string', 'regular expression',
1507
- 'false', 'true', 'null',
1508
- 'template continuation', 'template tail',
1509
- '=>', '(', '{', '.', '...', '}', ')', ';', ',', '[', ']', ':', '?', '\'', '"',
1510
- '++', '--',
1511
- '=', '<<=', '>>=', '>>>=', '**=', '+=', '-=', '*=', '/=', '%=', '^=', '|=',
1512
- '&=', '||=', '&&=', '??=',
1513
- 'typeof', 'delete', 'void', '!', '~', '+', '-', 'in', 'instanceof', '*', '%', '/', '**', '&&',
1514
- '||', '===', '!==', '==', '!=', '<=', '>=', '<', '>', '<<', '>>', '>>>', '&', '|', '^',
1515
- 'var', 'let', 'const',
1516
- 'break', 'case', 'catch', 'class', 'continue', 'debugger', 'default', 'do', 'else', 'export',
1517
- 'extends', 'finally', 'for', 'function', 'if', 'import', 'new', 'return', 'super', 'switch',
1518
- 'this', 'throw', 'try', 'while', 'with',
1519
- 'implements', 'interface', 'package', 'private', 'protected', 'public', 'static', 'yield',
1520
- 'as', 'async', 'await', 'constructor', 'get', 'set', 'accessor', 'from', 'of',
1521
- 'enum', 'eval', 'arguments', 'escaped keyword', 'escaped future reserved keyword', 'reserved if strict', '#',
1522
- 'BigIntLiteral', '??', '?.', 'WhiteSpace', 'Illegal', 'LineTerminator', 'PrivateField',
1523
- 'Template', '@', 'target', 'meta', 'LineFeed', 'Escaped', 'JSXText'
1524
- ];
1525
- const descKeywordTable = {
1526
- this: 86111,
1527
- function: 86104,
1528
- if: 20569,
1529
- return: 20572,
1530
- var: 86088,
1531
- else: 20563,
1532
- for: 20567,
1533
- new: 86107,
1534
- in: 8673330,
1535
- typeof: 16863275,
1536
- while: 20578,
1537
- case: 20556,
1538
- break: 20555,
1539
- try: 20577,
1540
- catch: 20557,
1541
- delete: 16863276,
1542
- throw: 86112,
1543
- switch: 86110,
1544
- continue: 20559,
1545
- default: 20561,
1546
- instanceof: 8411187,
1547
- do: 20562,
1548
- void: 16863277,
1549
- finally: 20566,
1550
- async: 209005,
1551
- await: 209006,
1552
- class: 86094,
1553
- const: 86090,
1554
- constructor: 12399,
1555
- debugger: 20560,
1556
- export: 20564,
1557
- extends: 20565,
1558
- false: 86021,
1559
- from: 209011,
1560
- get: 209008,
1561
- implements: 36964,
1562
- import: 86106,
1563
- interface: 36965,
1564
- let: 241737,
1565
- null: 86023,
1566
- of: 471156,
1567
- package: 36966,
1568
- private: 36967,
1569
- protected: 36968,
1570
- public: 36969,
1571
- set: 209009,
1572
- static: 36970,
1573
- super: 86109,
1574
- true: 86022,
1575
- with: 20579,
1576
- yield: 241771,
1577
- enum: 86133,
1578
- eval: 537079926,
1579
- as: 77932,
1580
- arguments: 537079927,
1581
- target: 209029,
1582
- meta: 209030,
1583
- accessor: 12402,
1584
- };
1585
-
1586
- function matchOrInsertSemicolon(parser, context) {
1587
- if ((parser.flags & 1) === 0 && (parser.getToken() & 1048576) !== 1048576) {
1588
- parser.report(30, KeywordDescTable[parser.getToken() & 255]);
1589
- }
1590
- if (!consumeOpt(parser, context, 1074790417)) {
1591
- parser.options.onInsertedSemicolon?.(parser.startIndex);
1592
- }
1593
- }
1594
- function isValidStrictMode(parser, index, tokenIndex, tokenValue) {
1595
- if (index - tokenIndex < 13 && tokenValue === 'use strict') {
1596
- if ((parser.getToken() & 1048576) === 1048576 || parser.flags & 1) {
1597
- return 1;
1598
- }
1599
- }
1600
- return 0;
1601
- }
1602
- function optionalBit(parser, context, t) {
1603
- if (parser.getToken() !== t)
1604
- return 0;
1605
- nextToken(parser, context);
1606
- return 1;
1607
- }
1608
- function consumeOpt(parser, context, t) {
1609
- if (parser.getToken() !== t)
1610
- return false;
1611
- nextToken(parser, context);
1612
- return true;
1613
- }
1614
- function consume(parser, context, t) {
1615
- if (parser.getToken() !== t)
1616
- parser.report(25, KeywordDescTable[t & 255]);
1617
- nextToken(parser, context);
1618
- }
1619
- function reinterpretToPattern(parser, node) {
1620
- switch (node.type) {
1621
- case 'ArrayExpression': {
1622
- node.type = 'ArrayPattern';
1623
- const { elements } = node;
1624
- for (let i = 0, n = elements.length; i < n; ++i) {
1625
- const element = elements[i];
1626
- if (element)
1627
- reinterpretToPattern(parser, element);
1628
- }
1629
- return;
1630
- }
1631
- case 'ObjectExpression': {
1632
- node.type = 'ObjectPattern';
1633
- const { properties } = node;
1634
- for (let i = 0, n = properties.length; i < n; ++i) {
1635
- reinterpretToPattern(parser, properties[i]);
1636
- }
1637
- return;
1638
- }
1639
- case 'AssignmentExpression':
1640
- node.type = 'AssignmentPattern';
1641
- if (node.operator !== '=')
1642
- parser.report(71);
1643
- delete node.operator;
1644
- reinterpretToPattern(parser, node.left);
1645
- return;
1646
- case 'Property':
1647
- reinterpretToPattern(parser, node.value);
1648
- return;
1649
- case 'SpreadElement':
1650
- node.type = 'RestElement';
1651
- reinterpretToPattern(parser, node.argument);
1652
- }
1653
- }
1654
- function validateBindingIdentifier(parser, context, kind, t, skipEvalArgCheck) {
1655
- if (context & 1) {
1656
- if ((t & 36864) === 36864) {
1657
- parser.report(118);
1658
- }
1659
- if (!skipEvalArgCheck && (t & 537079808) === 537079808) {
1660
- parser.report(119);
1661
- }
1662
- }
1663
- if ((t & 20480) === 20480 || t === -2147483528) {
1664
- parser.report(102);
1665
- }
1666
- if (kind & (8 | 16) && (t & 255) === (241737 & 255)) {
1667
- parser.report(100);
1668
- }
1669
- if (context & (2048 | 2) && t === 209006) {
1670
- parser.report(110);
1671
- }
1672
- if (context & (1024 | 1) && t === 241771) {
1673
- parser.report(97, 'yield');
1674
- }
1675
- }
1676
- function validateFunctionName(parser, context, t) {
1677
- if (context & 1) {
1678
- if ((t & 36864) === 36864) {
1679
- parser.report(118);
1680
- }
1681
- if ((t & 537079808) === 537079808) {
1682
- parser.report(119);
1683
- }
1684
- if (t === -2147483527) {
1685
- parser.report(95);
1686
- }
1687
- if (t === -2147483528) {
1688
- parser.report(95);
1689
- }
1690
- }
1691
- if ((t & 20480) === 20480) {
1692
- parser.report(102);
1693
- }
1694
- if (context & (2048 | 2) && t === 209006) {
1695
- parser.report(110);
1696
- }
1697
- if (context & (1024 | 1) && t === 241771) {
1698
- parser.report(97, 'yield');
1699
- }
1700
- }
1701
- function isStrictReservedWord$1(parser, context, t) {
1702
- if (t === 209006) {
1703
- if (context & (2048 | 2))
1704
- parser.report(110);
1705
- parser.destructible |= 128;
1706
- }
1707
- if (t === 241771 && context & 1024)
1708
- parser.report(97, 'yield');
1709
- return ((t & 20480) === 20480 ||
1710
- (t & 36864) === 36864 ||
1711
- t == -2147483527);
1712
- }
1713
- function isPropertyWithPrivateFieldKey(expr) {
1714
- return !expr.property ? false : expr.property.type === 'PrivateIdentifier';
1715
- }
1716
- function isValidLabel(parser, labels, name, isIterationStatement) {
1717
- while (labels) {
1718
- if (labels['$' + name]) {
1719
- if (isIterationStatement)
1720
- parser.report(137);
1721
- return 1;
1722
- }
1723
- if (isIterationStatement && labels.loop)
1724
- isIterationStatement = 0;
1725
- labels = labels['$'];
1726
- }
1727
- return 0;
1728
- }
1729
- function validateAndDeclareLabel(parser, labels, name) {
1730
- let set = labels;
1731
- while (set) {
1732
- if (set['$' + name])
1733
- parser.report(136, name);
1734
- set = set['$'];
1735
- }
1736
- labels['$' + name] = 1;
1737
- }
1738
- function isEqualTagName(elementName) {
1739
- switch (elementName.type) {
1740
- case 'JSXIdentifier':
1741
- return elementName.name;
1742
- case 'JSXNamespacedName':
1743
- return elementName.namespace + ':' + elementName.name;
1744
- case 'JSXMemberExpression':
1745
- return isEqualTagName(elementName.object) + '.' + isEqualTagName(elementName.property);
1746
- }
1747
- }
1748
- function isValidIdentifier$1(context, t) {
1749
- if (context & (1 | 1024)) {
1750
- if (context & 2 && t === 209006)
1751
- return false;
1752
- if (context & 1024 && t === 241771)
1753
- return false;
1754
- return (t & 12288) === 12288;
1755
- }
1756
- return (t & 12288) === 12288 || (t & 36864) === 36864;
1757
- }
1758
- function classifyIdentifier(parser, context, t) {
1759
- if ((t & 537079808) === 537079808) {
1760
- if (context & 1)
1761
- parser.report(119);
1762
- parser.flags |= 512;
1763
- }
1764
- if (!isValidIdentifier$1(context, t))
1765
- parser.report(0);
1766
- }
1767
- function getOwnProperty(object, key) {
1768
- return Object.hasOwn(object, key) ? object[key] : undefined;
1769
- }
1770
-
1771
- function scanIdentifier(parser, context, isValidAsKeyword) {
1772
- while (isIdPart[advanceChar(parser)])
1773
- ;
1774
- parser.tokenValue = parser.source.slice(parser.tokenIndex, parser.index);
1775
- return parser.currentChar !== 92 && parser.currentChar <= 0x7e
1776
- ? (getOwnProperty(descKeywordTable, parser.tokenValue) ?? 208897)
1777
- : scanIdentifierSlowCase(parser, context, 0, isValidAsKeyword);
1778
- }
1779
- function scanUnicodeIdentifier(parser, context) {
1780
- const cookedChar = scanIdentifierUnicodeEscape(parser);
1781
- if (!isIdentifierStart$1(cookedChar))
1782
- parser.report(5);
1783
- parser.tokenValue = String.fromCodePoint(cookedChar);
1784
- return scanIdentifierSlowCase(parser, context, 1, CharTypes[cookedChar] & 4);
1785
- }
1786
- function scanIdentifierSlowCase(parser, context, hasEscape, isValidAsKeyword) {
1787
- let start = parser.index;
1788
- while (parser.index < parser.end) {
1789
- if (parser.currentChar === 92) {
1790
- parser.tokenValue += parser.source.slice(start, parser.index);
1791
- hasEscape = 1;
1792
- const code = scanIdentifierUnicodeEscape(parser);
1793
- if (!isIdentifierPart(code))
1794
- parser.report(5);
1795
- isValidAsKeyword = isValidAsKeyword && CharTypes[code] & 4;
1796
- parser.tokenValue += String.fromCodePoint(code);
1797
- start = parser.index;
1798
- }
1799
- else {
1800
- const merged = consumePossibleSurrogatePair(parser);
1801
- if (merged > 0) {
1802
- if (!isIdentifierPart(merged)) {
1803
- parser.report(20, String.fromCodePoint(merged));
1804
- }
1805
- parser.currentChar = merged;
1806
- parser.index++;
1807
- parser.column++;
1808
- }
1809
- else if (!isIdentifierPart(parser.currentChar)) {
1810
- break;
1811
- }
1812
- advanceChar(parser);
1813
- }
1814
- }
1815
- if (parser.index <= parser.end) {
1816
- parser.tokenValue += parser.source.slice(start, parser.index);
1817
- }
1818
- const { length } = parser.tokenValue;
1819
- if (isValidAsKeyword && length >= 2 && length <= 11) {
1820
- const token = getOwnProperty(descKeywordTable, parser.tokenValue);
1821
- if (token === void 0)
1822
- return 208897 | (hasEscape ? -2147483648 : 0);
1823
- if (!hasEscape)
1824
- return token;
1825
- if (token === 209006) {
1826
- if ((context & (2 | 2048)) === 0) {
1827
- return token | -2147483648;
1828
- }
1829
- return -2147483528;
1830
- }
1831
- if (context & 1) {
1832
- if (token === 36970) {
1833
- return -2147483527;
1834
- }
1835
- if ((token & 36864) === 36864) {
1836
- return -2147483527;
1837
- }
1838
- if ((token & 20480) === 20480) {
1839
- if (context & 262144 && (context & 8) === 0) {
1840
- return token | -2147483648;
1841
- }
1842
- else {
1843
- return -2147483528;
1844
- }
1845
- }
1846
- return 209018 | -2147483648;
1847
- }
1848
- if (context & 262144 &&
1849
- (context & 8) === 0 &&
1850
- (token & 20480) === 20480) {
1851
- return token | -2147483648;
1852
- }
1853
- if (token === 241771) {
1854
- return context & 262144
1855
- ? 209018 | -2147483648
1856
- : context & 1024
1857
- ? -2147483528
1858
- : token | -2147483648;
1859
- }
1860
- if (token === 209005) {
1861
- return 209018 | -2147483648;
1862
- }
1863
- if ((token & 36864) === 36864) {
1864
- return token | 12288 | -2147483648;
1865
- }
1866
- return -2147483528;
1867
- }
1868
- return 208897 | (hasEscape ? -2147483648 : 0);
1869
- }
1870
- function scanPrivateIdentifier(parser) {
1871
- let char = advanceChar(parser);
1872
- if (char === 92)
1873
- return 130;
1874
- const merged = consumePossibleSurrogatePair(parser);
1875
- if (merged)
1876
- char = merged;
1877
- if (!isIdentifierStart$1(char))
1878
- parser.report(96);
1879
- return 130;
1880
- }
1881
- function scanIdentifierUnicodeEscape(parser) {
1882
- if (parser.source.charCodeAt(parser.index + 1) !== 117) {
1883
- parser.report(5);
1884
- }
1885
- parser.currentChar = parser.source.charCodeAt((parser.index += 2));
1886
- parser.column += 2;
1887
- return scanUnicodeEscape(parser);
1888
- }
1889
- function scanUnicodeEscape(parser) {
1890
- let codePoint = 0;
1891
- const char = parser.currentChar;
1892
- if (char === 123) {
1893
- const begin = parser.index - 2;
1894
- while (CharTypes[advanceChar(parser)] & 64) {
1895
- codePoint = (codePoint << 4) | toHex(parser.currentChar);
1896
- if (codePoint > 1114111)
1897
- throw new ParseError({ index: begin, line: parser.line, column: parser.column }, parser.currentLocation, 104);
1898
- }
1899
- if (parser.currentChar !== 125) {
1900
- throw new ParseError({ index: begin, line: parser.line, column: parser.column }, parser.currentLocation, 7);
1901
- }
1902
- advanceChar(parser);
1903
- return codePoint;
1904
- }
1905
- if ((CharTypes[char] & 64) === 0)
1906
- parser.report(7);
1907
- const char2 = parser.source.charCodeAt(parser.index + 1);
1908
- if ((CharTypes[char2] & 64) === 0)
1909
- parser.report(7);
1910
- const char3 = parser.source.charCodeAt(parser.index + 2);
1911
- if ((CharTypes[char3] & 64) === 0)
1912
- parser.report(7);
1913
- const char4 = parser.source.charCodeAt(parser.index + 3);
1914
- if ((CharTypes[char4] & 64) === 0)
1915
- parser.report(7);
1916
- codePoint = (toHex(char) << 12) | (toHex(char2) << 8) | (toHex(char3) << 4) | toHex(char4);
1917
- parser.currentChar = parser.source.charCodeAt((parser.index += 4));
1918
- parser.column += 4;
1919
- return codePoint;
1920
- }
1921
-
1922
1738
  const TokenLookup = [
1923
1739
  128,
1924
1740
  128,
@@ -2059,7 +1875,6 @@
2059
1875
  function scanSingleToken(parser, context, state) {
2060
1876
  const isStartOfLine = parser.index === 0;
2061
1877
  const { source } = parser;
2062
- let start = parser.currentLocation;
2063
1878
  while (parser.index < parser.end) {
2064
1879
  parser.tokenIndex = parser.index;
2065
1880
  parser.tokenColumn = parser.column;
@@ -2129,7 +1944,6 @@
2129
1944
  parser.column += 3;
2130
1945
  parser.currentChar = source.charCodeAt((parser.index += 3));
2131
1946
  state = skipSingleHTMLComment(parser, source, state, context, 2, parser.tokenStart);
2132
- start = parser.tokenStart;
2133
1947
  continue;
2134
1948
  }
2135
1949
  return 8456256;
@@ -2210,8 +2024,7 @@
2210
2024
  if (!parser.options.webcompat)
2211
2025
  parser.report(112);
2212
2026
  advanceChar(parser);
2213
- state = skipSingleHTMLComment(parser, source, state, context, 3, start);
2214
- start = parser.tokenStart;
2027
+ state = skipSingleHTMLComment(parser, source, state, context, 3, parser.tokenStart);
2215
2028
  continue;
2216
2029
  }
2217
2030
  return 33619994;
@@ -2229,13 +2042,11 @@
2229
2042
  if (ch === 47) {
2230
2043
  advanceChar(parser);
2231
2044
  state = skipSingleLineComment(parser, source, state, 0, parser.tokenStart);
2232
- start = parser.tokenStart;
2233
2045
  continue;
2234
2046
  }
2235
2047
  if (ch === 42) {
2236
2048
  advanceChar(parser);
2237
2049
  state = skipMultiLineComment(parser, source, state);
2238
- start = parser.tokenStart;
2239
2050
  continue;
2240
2051
  }
2241
2052
  if (context & 32) {
@@ -2369,6 +2180,188 @@
2369
2180
  return 1048576;
2370
2181
  }
2371
2182
 
2183
+ function matchOrInsertSemicolon(parser, context) {
2184
+ if ((parser.flags & 1) === 0 && (parser.getToken() & 1048576) !== 1048576) {
2185
+ parser.report(30, KeywordDescTable[parser.getToken() & 255]);
2186
+ }
2187
+ if (!consumeOpt(parser, context, 1074790417)) {
2188
+ parser.options.onInsertedSemicolon?.(parser.startIndex);
2189
+ }
2190
+ }
2191
+ function isValidStrictMode(parser, index, tokenIndex, tokenValue) {
2192
+ if (index - tokenIndex < 13 && tokenValue === 'use strict') {
2193
+ if ((parser.getToken() & 1048576) === 1048576 || parser.flags & 1) {
2194
+ return 1;
2195
+ }
2196
+ }
2197
+ return 0;
2198
+ }
2199
+ function optionalBit(parser, context, t) {
2200
+ if (parser.getToken() !== t)
2201
+ return 0;
2202
+ nextToken(parser, context);
2203
+ return 1;
2204
+ }
2205
+ function consumeOpt(parser, context, t) {
2206
+ if (parser.getToken() !== t)
2207
+ return false;
2208
+ nextToken(parser, context);
2209
+ return true;
2210
+ }
2211
+ function consume(parser, context, t) {
2212
+ if (parser.getToken() !== t)
2213
+ parser.report(25, KeywordDescTable[t & 255]);
2214
+ nextToken(parser, context);
2215
+ }
2216
+ function reinterpretToPattern(parser, node) {
2217
+ switch (node.type) {
2218
+ case 'ArrayExpression': {
2219
+ node.type = 'ArrayPattern';
2220
+ const { elements } = node;
2221
+ for (let i = 0, n = elements.length; i < n; ++i) {
2222
+ const element = elements[i];
2223
+ if (element)
2224
+ reinterpretToPattern(parser, element);
2225
+ }
2226
+ return;
2227
+ }
2228
+ case 'ObjectExpression': {
2229
+ node.type = 'ObjectPattern';
2230
+ const { properties } = node;
2231
+ for (let i = 0, n = properties.length; i < n; ++i) {
2232
+ reinterpretToPattern(parser, properties[i]);
2233
+ }
2234
+ return;
2235
+ }
2236
+ case 'AssignmentExpression':
2237
+ node.type = 'AssignmentPattern';
2238
+ if (node.operator !== '=')
2239
+ parser.report(71);
2240
+ delete node.operator;
2241
+ reinterpretToPattern(parser, node.left);
2242
+ return;
2243
+ case 'Property':
2244
+ reinterpretToPattern(parser, node.value);
2245
+ return;
2246
+ case 'SpreadElement':
2247
+ node.type = 'RestElement';
2248
+ reinterpretToPattern(parser, node.argument);
2249
+ }
2250
+ }
2251
+ function validateBindingIdentifier(parser, context, kind, t, skipEvalArgCheck) {
2252
+ if (context & 1) {
2253
+ if ((t & 36864) === 36864) {
2254
+ parser.report(118);
2255
+ }
2256
+ if (!skipEvalArgCheck && (t & 537079808) === 537079808) {
2257
+ parser.report(119);
2258
+ }
2259
+ }
2260
+ if ((t & 20480) === 20480 || t === -2147483528) {
2261
+ parser.report(102);
2262
+ }
2263
+ if (kind & (8 | 16) && (t & 255) === (241737 & 255)) {
2264
+ parser.report(100);
2265
+ }
2266
+ if (context & (2048 | 2) && t === 209006) {
2267
+ parser.report(110);
2268
+ }
2269
+ if (context & (1024 | 1) && t === 241771) {
2270
+ parser.report(97, 'yield');
2271
+ }
2272
+ }
2273
+ function validateFunctionName(parser, context, t) {
2274
+ if (context & 1) {
2275
+ if ((t & 36864) === 36864) {
2276
+ parser.report(118);
2277
+ }
2278
+ if ((t & 537079808) === 537079808) {
2279
+ parser.report(119);
2280
+ }
2281
+ if (t === -2147483527) {
2282
+ parser.report(95);
2283
+ }
2284
+ if (t === -2147483528) {
2285
+ parser.report(95);
2286
+ }
2287
+ }
2288
+ if ((t & 20480) === 20480) {
2289
+ parser.report(102);
2290
+ }
2291
+ if (context & (2048 | 2) && t === 209006) {
2292
+ parser.report(110);
2293
+ }
2294
+ if (context & (1024 | 1) && t === 241771) {
2295
+ parser.report(97, 'yield');
2296
+ }
2297
+ }
2298
+ function isStrictReservedWord$1(parser, context, t) {
2299
+ if (t === 209006) {
2300
+ if (context & (2048 | 2))
2301
+ parser.report(110);
2302
+ parser.destructible |= 128;
2303
+ }
2304
+ if (t === 241771 && context & 1024)
2305
+ parser.report(97, 'yield');
2306
+ return ((t & 20480) === 20480 ||
2307
+ (t & 36864) === 36864 ||
2308
+ t == -2147483527);
2309
+ }
2310
+ function isPropertyWithPrivateFieldKey(expr) {
2311
+ return !expr.property ? false : expr.property.type === 'PrivateIdentifier';
2312
+ }
2313
+ function isValidLabel(parser, labels, name, isIterationStatement) {
2314
+ while (labels) {
2315
+ if (labels['$' + name]) {
2316
+ if (isIterationStatement)
2317
+ parser.report(137);
2318
+ return 1;
2319
+ }
2320
+ if (isIterationStatement && labels.loop)
2321
+ isIterationStatement = 0;
2322
+ labels = labels['$'];
2323
+ }
2324
+ return 0;
2325
+ }
2326
+ function validateAndDeclareLabel(parser, labels, name) {
2327
+ let set = labels;
2328
+ while (set) {
2329
+ if (set['$' + name])
2330
+ parser.report(136, name);
2331
+ set = set['$'];
2332
+ }
2333
+ labels['$' + name] = 1;
2334
+ }
2335
+ function isEqualTagName(elementName) {
2336
+ switch (elementName.type) {
2337
+ case 'JSXIdentifier':
2338
+ return elementName.name;
2339
+ case 'JSXNamespacedName':
2340
+ return elementName.namespace + ':' + elementName.name;
2341
+ case 'JSXMemberExpression':
2342
+ return isEqualTagName(elementName.object) + '.' + isEqualTagName(elementName.property);
2343
+ }
2344
+ }
2345
+ function isValidIdentifier$1(context, t) {
2346
+ if (context & (1 | 1024)) {
2347
+ if (context & 2 && t === 209006)
2348
+ return false;
2349
+ if (context & 1024 && t === 241771)
2350
+ return false;
2351
+ return (t & 12288) === 12288;
2352
+ }
2353
+ return (t & 12288) === 12288 || (t & 36864) === 36864;
2354
+ }
2355
+ function classifyIdentifier(parser, context, t) {
2356
+ if ((t & 537079808) === 537079808) {
2357
+ if (context & 1)
2358
+ parser.report(119);
2359
+ parser.flags |= 512;
2360
+ }
2361
+ if (!isValidIdentifier$1(context, t))
2362
+ parser.report(0);
2363
+ }
2364
+
2372
2365
  const entities = {
2373
2366
  AElig: '\u00C6',
2374
2367
  AMP: '\u0026',
@@ -4625,6 +4618,61 @@
4625
4618
  return parser.getToken();
4626
4619
  }
4627
4620
 
4621
+ function normalizeOptions(rawOptions) {
4622
+ const options = {
4623
+ validateRegex: true,
4624
+ ...rawOptions,
4625
+ };
4626
+ if (options.module && !options.sourceType) {
4627
+ options.sourceType = 'module';
4628
+ }
4629
+ if (options.globalReturn && (!options.sourceType || options.sourceType === 'script')) {
4630
+ options.sourceType = 'commonjs';
4631
+ }
4632
+ return options;
4633
+ }
4634
+
4635
+ class PrivateScope {
4636
+ parser;
4637
+ parent;
4638
+ refs = Object.create(null);
4639
+ privateIdentifiers = new Map();
4640
+ constructor(parser, parent) {
4641
+ this.parser = parser;
4642
+ this.parent = parent;
4643
+ }
4644
+ addPrivateIdentifier(name, kind) {
4645
+ const { privateIdentifiers } = this;
4646
+ let focusKind = kind & (32 | 768);
4647
+ if (!(focusKind & 768))
4648
+ focusKind |= 768;
4649
+ const value = privateIdentifiers.get(name);
4650
+ if (this.hasPrivateIdentifier(name) &&
4651
+ ((value & 32) !== (focusKind & 32) || value & focusKind & 768)) {
4652
+ this.parser.report(146, name);
4653
+ }
4654
+ privateIdentifiers.set(name, this.hasPrivateIdentifier(name) ? value | focusKind : focusKind);
4655
+ }
4656
+ addPrivateIdentifierRef(name) {
4657
+ this.refs[name] ??= [];
4658
+ this.refs[name].push(this.parser.tokenStart);
4659
+ }
4660
+ isPrivateIdentifierDefined(name) {
4661
+ return this.hasPrivateIdentifier(name) || Boolean(this.parent?.isPrivateIdentifierDefined(name));
4662
+ }
4663
+ validatePrivateIdentifierRefs() {
4664
+ for (const name in this.refs) {
4665
+ if (!this.isPrivateIdentifierDefined(name)) {
4666
+ const { index, line, column } = this.refs[name][0];
4667
+ throw new ParseError({ index, line, column }, { index: index + name.length, line, column: column + name.length }, 4, name);
4668
+ }
4669
+ }
4670
+ }
4671
+ hasPrivateIdentifier(name) {
4672
+ return this.privateIdentifiers.has(name);
4673
+ }
4674
+ }
4675
+
4628
4676
  class Scope {
4629
4677
  parser;
4630
4678
  type;
@@ -4735,51 +4783,10 @@
4735
4783
  return scope;
4736
4784
  }
4737
4785
 
4738
- class PrivateScope {
4739
- parser;
4740
- parent;
4741
- refs = Object.create(null);
4742
- privateIdentifiers = new Map();
4743
- constructor(parser, parent) {
4744
- this.parser = parser;
4745
- this.parent = parent;
4746
- }
4747
- addPrivateIdentifier(name, kind) {
4748
- const { privateIdentifiers } = this;
4749
- let focusKind = kind & (32 | 768);
4750
- if (!(focusKind & 768))
4751
- focusKind |= 768;
4752
- const value = privateIdentifiers.get(name);
4753
- if (this.hasPrivateIdentifier(name) &&
4754
- ((value & 32) !== (focusKind & 32) || value & focusKind & 768)) {
4755
- this.parser.report(146, name);
4756
- }
4757
- privateIdentifiers.set(name, this.hasPrivateIdentifier(name) ? value | focusKind : focusKind);
4758
- }
4759
- addPrivateIdentifierRef(name) {
4760
- this.refs[name] ??= [];
4761
- this.refs[name].push(this.parser.tokenStart);
4762
- }
4763
- isPrivateIdentifierDefined(name) {
4764
- return this.hasPrivateIdentifier(name) || Boolean(this.parent?.isPrivateIdentifierDefined(name));
4765
- }
4766
- validatePrivateIdentifierRefs() {
4767
- for (const name in this.refs) {
4768
- if (!this.isPrivateIdentifierDefined(name)) {
4769
- const { index, line, column } = this.refs[name][0];
4770
- throw new ParseError({ index, line, column }, { index: index + name.length, line, column: column + name.length }, 4, name);
4771
- }
4772
- }
4773
- }
4774
- hasPrivateIdentifier(name) {
4775
- return this.privateIdentifiers.has(name);
4776
- }
4777
- }
4778
-
4779
4786
  class Parser {
4780
4787
  source;
4781
- options;
4782
4788
  lastOnToken = null;
4789
+ options;
4783
4790
  token = 1048576;
4784
4791
  flags = 0;
4785
4792
  index = 0;
@@ -4801,11 +4808,17 @@
4801
4808
  assignable = 1;
4802
4809
  destructible = 0;
4803
4810
  leadingDecorators = { decorators: [] };
4804
- constructor(source, options = {}) {
4811
+ constructor(source, rawOptions = {}) {
4805
4812
  this.source = source;
4806
- this.options = options;
4807
4813
  this.end = source.length;
4808
4814
  this.currentChar = source.charCodeAt(0);
4815
+ this.options = normalizeOptions(rawOptions);
4816
+ if (Array.isArray(this.options.onComment)) {
4817
+ this.options.onComment = pushComment(this.options.onComment, this.options);
4818
+ }
4819
+ if (Array.isArray(this.options.onToken)) {
4820
+ this.options.onToken = pushToken(this.options.onToken, this.options);
4821
+ }
4809
4822
  }
4810
4823
  getToken() {
4811
4824
  return this.token;
@@ -4898,6 +4911,25 @@
4898
4911
  }
4899
4912
  return undefined;
4900
4913
  }
4914
+ cloneIdentifier(original) {
4915
+ return this.cloneLocationInformation({ ...original }, original);
4916
+ }
4917
+ cloneStringLiteral(original) {
4918
+ return this.cloneLocationInformation({ ...original }, original);
4919
+ }
4920
+ cloneLocationInformation(node, original) {
4921
+ if (this.options.ranges) {
4922
+ node.range = [...original.range];
4923
+ }
4924
+ if (this.options.loc) {
4925
+ node.loc = {
4926
+ ...original.loc,
4927
+ start: { ...original.loc.start },
4928
+ end: { ...original.loc.end },
4929
+ };
4930
+ }
4931
+ return node;
4932
+ }
4901
4933
  }
4902
4934
  function pushComment(comments, options) {
4903
4935
  return function (type, value, start, end, loc) {
@@ -4933,26 +4965,14 @@
4933
4965
  };
4934
4966
  }
4935
4967
 
4936
- function normalizeOptions(rawOptions) {
4937
- const options = { ...rawOptions };
4938
- if (options.onComment) {
4939
- options.onComment = Array.isArray(options.onComment) ? pushComment(options.onComment, options) : options.onComment;
4940
- }
4941
- if (options.onToken) {
4942
- options.onToken = Array.isArray(options.onToken) ? pushToken(options.onToken, options) : options.onToken;
4943
- }
4944
- return options;
4945
- }
4946
-
4947
4968
  function parseSource(source, rawOptions = {}, context = 0) {
4948
- const options = normalizeOptions(rawOptions);
4949
- if (options.module)
4969
+ const parser = new Parser(source, rawOptions);
4970
+ if (parser.options.sourceType === 'module')
4950
4971
  context |= 2 | 1;
4951
- if (options.globalReturn)
4952
- context |= 4096;
4953
- if (options.impliedStrict)
4972
+ if (parser.options.sourceType === 'commonjs')
4973
+ context |= 4096 | 65536;
4974
+ if (parser.options.impliedStrict)
4954
4975
  context |= 1;
4955
- const parser = new Parser(source, options);
4956
4976
  skipHashBang(parser);
4957
4977
  const scope = parser.createScopeIfLexical();
4958
4978
  let body = [];
@@ -5839,7 +5859,7 @@
5839
5859
  }
5840
5860
  else if (imported.type === 'Identifier') {
5841
5861
  validateBindingIdentifier(parser, context, 16, token, 0);
5842
- local = imported;
5862
+ local = parser.cloneIdentifier(imported);
5843
5863
  }
5844
5864
  else {
5845
5865
  parser.report(25, KeywordDescTable[77932 & 255]);
@@ -5980,7 +6000,7 @@
5980
6000
  tmpExportedNames.push(parser.tokenValue);
5981
6001
  tmpExportedBindings.push(parser.tokenValue);
5982
6002
  }
5983
- exported = local;
6003
+ exported = local.type === 'Literal' ? parser.cloneStringLiteral(local) : parser.cloneIdentifier(local);
5984
6004
  }
5985
6005
  specifiers.push(parser.finishNode({
5986
6006
  type: 'ExportSpecifier',
@@ -6755,20 +6775,12 @@
6755
6775
  parser.report(30, KeywordDescTable[parser.getToken() & 255]);
6756
6776
  }
6757
6777
  }
6758
- function validateStringWellFormed(parser, str) {
6759
- const len = str.length;
6760
- for (let i = 0; i < len; i++) {
6761
- const code = str.charCodeAt(i);
6762
- if ((code & 0xfc00) !== 55296)
6763
- continue;
6764
- if (code > 56319 || ++i >= len || (str.charCodeAt(i) & 0xfc00) !== 56320) {
6765
- parser.report(171, JSON.stringify(str.charAt(i--)));
6766
- }
6767
- }
6768
- }
6769
6778
  function parseModuleExportName(parser, context) {
6770
6779
  if (parser.getToken() === 134283267) {
6771
- validateStringWellFormed(parser, parser.tokenValue);
6780
+ const value = parser.tokenValue;
6781
+ if (!value.isWellFormed()) {
6782
+ parser.report(171);
6783
+ }
6772
6784
  return parseLiteral(parser, context);
6773
6785
  }
6774
6786
  else if (parser.getToken() & 143360) {
@@ -6902,35 +6914,31 @@
6902
6914
  if (parser.getToken() === 134283388) {
6903
6915
  return parseBigIntLiteral(parser, context);
6904
6916
  }
6917
+ const node = {
6918
+ type: 'Literal',
6919
+ value: tokenValue,
6920
+ };
6921
+ if (parser.options.raw) {
6922
+ node.raw = tokenRaw;
6923
+ }
6905
6924
  nextToken(parser, context);
6906
6925
  parser.assignable = 2;
6907
- return parser.finishNode(parser.options.raw
6908
- ? {
6909
- type: 'Literal',
6910
- value: tokenValue,
6911
- raw: tokenRaw,
6912
- }
6913
- : {
6914
- type: 'Literal',
6915
- value: tokenValue,
6916
- }, tokenStart);
6926
+ return parser.finishNode(node, tokenStart);
6917
6927
  }
6918
6928
  function parseNullOrTrueOrFalseLiteral(parser, context) {
6919
6929
  const start = parser.tokenStart;
6920
6930
  const raw = KeywordDescTable[parser.getToken() & 255];
6921
6931
  const value = parser.getToken() === 86023 ? null : raw === 'true';
6932
+ const node = {
6933
+ type: 'Literal',
6934
+ value,
6935
+ };
6936
+ if (parser.options.raw) {
6937
+ node.raw = raw;
6938
+ }
6922
6939
  nextToken(parser, context);
6923
6940
  parser.assignable = 2;
6924
- return parser.finishNode(parser.options.raw
6925
- ? {
6926
- type: 'Literal',
6927
- value,
6928
- raw,
6929
- }
6930
- : {
6931
- type: 'Literal',
6932
- value,
6933
- }, start);
6941
+ return parser.finishNode(node, start);
6934
6942
  }
6935
6943
  function parseThisExpression(parser, context) {
6936
6944
  const { tokenStart } = parser;
@@ -7445,7 +7453,7 @@
7445
7453
  : 0;
7446
7454
  value = parser.finishNode({
7447
7455
  type: 'AssignmentPattern',
7448
- left: parser.options.uniqueKeyInPattern ? Object.assign({}, key) : key,
7456
+ left: parser.cloneIdentifier(key),
7449
7457
  right,
7450
7458
  }, tokenStart);
7451
7459
  }
@@ -7453,7 +7461,7 @@
7453
7461
  destructible |=
7454
7462
  (token === 209006 ? 128 : 0) |
7455
7463
  (token === -2147483528 ? 16 : 0);
7456
- value = parser.options.uniqueKeyInPattern ? Object.assign({}, key) : key;
7464
+ value = parser.cloneIdentifier(key);
7457
7465
  }
7458
7466
  }
7459
7467
  else if (consumeOpt(parser, context | 32, 21)) {
@@ -8674,8 +8682,9 @@
8674
8682
  function parseDecoratorList(parser, context, privateScope) {
8675
8683
  const start = parser.tokenStart;
8676
8684
  nextToken(parser, context | 32);
8685
+ const expressionStart = parser.tokenStart;
8677
8686
  let expression = parsePrimaryExpression(parser, context, privateScope, 2, 0, 1, 0, 1, start);
8678
- expression = parseMemberOrUpdateExpression(parser, context, privateScope, expression, 0, 0, parser.tokenStart);
8687
+ expression = parseMemberOrUpdateExpression(parser, context, privateScope, expression, 0, 0, expressionStart);
8679
8688
  return parser.finishNode({
8680
8689
  type: 'Decorator',
8681
8690
  expression,
@@ -9262,7 +9271,7 @@
9262
9271
  }, start);
9263
9272
  }
9264
9273
  function parseModule(source, options) {
9265
- return parseSource(source, options, 1 | 2);
9274
+ return parseSource(source, { ...options, sourceType: 'module' });
9266
9275
  }
9267
9276
 
9268
9277
  // Astring is a tiny and fast JavaScript code generator from an ESTree-compliant AST.
@@ -86328,15 +86337,25 @@
86328
86337
 
86329
86338
  // Updates dependency paths to be prefixed by `esm!` or otherwise updated.
86330
86339
  function updateAmdDeps(amd, options) {
86340
+ let updated = options.onBeforeUpdate?.({
86341
+ ...options,
86342
+ amd
86343
+ });
86344
+
86331
86345
  const { deps } = amd;
86332
- if (!deps) return
86346
+ if (!deps) {
86347
+ afterUpdate();
86348
+ return updated
86349
+ }
86333
86350
 
86334
86351
  const { sourceFileName: parentName } = options;
86335
86352
  const { elements } = deps;
86336
- if (!elements.length) return
86353
+ if (!elements.length) {
86354
+ afterUpdate();
86355
+ return updated
86356
+ }
86337
86357
 
86338
86358
  const { resolvePath } = options;
86339
- let updated;
86340
86359
  for (const element of elements) {
86341
86360
  if (element.type === 'Literal') {
86342
86361
  const moduleName = element.value;
@@ -86347,7 +86366,28 @@
86347
86366
  }
86348
86367
  }
86349
86368
  }
86369
+
86370
+ afterUpdate();
86371
+
86350
86372
  return updated
86373
+
86374
+ function afterUpdate() {
86375
+ const updatedNow = options.onAfterUpdate?.({
86376
+ ...options,
86377
+ amd
86378
+ });
86379
+ updated ||= updatedNow;
86380
+ }
86381
+ }
86382
+
86383
+ function callAmdUpdateHooks(amd, options) {
86384
+ options = {
86385
+ ...options,
86386
+ amd
86387
+ };
86388
+ const updatedBefore = options.onBeforeUpdate?.(options);
86389
+ const updatedAfter = options.onAfterUpdate?.(options);
86390
+ return updatedBefore || updatedAfter
86351
86391
  }
86352
86392
 
86353
86393
  function _generateUid(name, i) {
@@ -86517,6 +86557,11 @@
86517
86557
 
86518
86558
  // Transforms the module format from ESM to AMD.
86519
86559
  function transformEsmToAmd(program, options) {
86560
+ options.onBeforeTransform?.({
86561
+ ...options,
86562
+ program
86563
+ });
86564
+
86520
86565
  const { body } = program;
86521
86566
  let { length } = body;
86522
86567
 
@@ -86777,6 +86822,12 @@
86777
86822
 
86778
86823
  buildAmdModule(program, options, importPaths, importVars, namedImports);
86779
86824
 
86825
+ options.onAfterTransform?.({
86826
+ ...options,
86827
+ program,
86828
+ callbackBody: body
86829
+ });
86830
+
86780
86831
  function addExportStatement({ exported, local }) {
86781
86832
  const asName = exported.name;
86782
86833
  if (asName !== 'default') {
@@ -86864,10 +86915,11 @@
86864
86915
  const result = {};
86865
86916
  if (length) {
86866
86917
  result.amd = true;
86867
- if (options.resolvePath) {
86868
- for (const amd of amds) {
86869
- result.updated |= updateAmdDeps(amd, options);
86870
- }
86918
+ for (const amd of amds) {
86919
+ const updated = options.resolvePath
86920
+ ? updateAmdDeps(amd, options)
86921
+ : callAmdUpdateHooks(amd, options);
86922
+ result.updated ||= updated;
86871
86923
  }
86872
86924
  } else {
86873
86925
  transformEsmToAmd(program, options);
@@ -86888,12 +86940,28 @@
86888
86940
  useStrict,
86889
86941
  // Enable source maps, can be an object with booleans { inline, content }.
86890
86942
  // If set to true, the object will be set to { inline: true, content: true }.
86891
- sourceMap
86943
+ sourceMap,
86944
+ // ESM transformation callbacks.
86945
+ onBeforeTransform,
86946
+ onAfterTransform,
86947
+ // AMD update callbacks.
86948
+ onBeforeUpdate,
86949
+ onAfterUpdate
86892
86950
  } = {}) {
86893
86951
  // const ast = parse(text, { ecmaVersion, sourceType: 'module', locations: true })
86894
86952
  let ast = parseModule(text, { next: true, loc: true });
86895
86953
 
86896
- const options = { sourceFileName: file, pluginName, resolvePath: resolvePath$1, originalResolvePath: resolvePath, useStrict };
86954
+ const options = {
86955
+ sourceFileName: file,
86956
+ pluginName,
86957
+ resolvePath: resolvePath$1,
86958
+ originalResolvePath: resolvePath,
86959
+ useStrict,
86960
+ onBeforeTransform,
86961
+ onAfterTransform,
86962
+ onBeforeUpdate,
86963
+ onAfterUpdate
86964
+ };
86897
86965
  const { updated } = transformAst(ast, options);
86898
86966
 
86899
86967
  let code, map;