@putout/babel 2.10.0 → 3.0.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/bundle/index.js CHANGED
@@ -1377,6 +1377,9 @@ var require_jsesc = __commonJS({
1377
1377
  var isNumber2 = function(value1) {
1378
1378
  return typeof value1 == "number" || toString.call(value1) == "[object Number]";
1379
1379
  };
1380
+ var isBigInt = function(value1) {
1381
+ return (typeof value1 === "undefined" ? "undefined" : _type_of(value1)) == "bigint";
1382
+ };
1380
1383
  var isFunction5 = function(value1) {
1381
1384
  return typeof value1 == "function";
1382
1385
  };
@@ -1494,26 +1497,33 @@ var require_jsesc = __commonJS({
1494
1497
  return "[" + result.join(", ") + "]";
1495
1498
  }
1496
1499
  return "[" + newLine + result.join("," + newLine) + newLine + (compact ? "" : oldIndent) + "]";
1497
- } else if (isNumber2(argument)) {
1500
+ } else if (isNumber2(argument) || isBigInt(argument)) {
1498
1501
  if (json) {
1499
- return JSON.stringify(argument);
1502
+ return JSON.stringify(Number(argument));
1500
1503
  }
1504
+ var result2;
1501
1505
  if (useDecNumbers) {
1502
- return String(argument);
1503
- }
1504
- if (useHexNumbers) {
1506
+ result2 = String(argument);
1507
+ } else if (useHexNumbers) {
1505
1508
  var hexadecimal2 = argument.toString(16);
1506
1509
  if (!lowercaseHex) {
1507
1510
  hexadecimal2 = hexadecimal2.toUpperCase();
1508
1511
  }
1509
- return "0x" + hexadecimal2;
1512
+ result2 = "0x" + hexadecimal2;
1513
+ } else if (useBinNumbers) {
1514
+ result2 = "0b" + argument.toString(2);
1515
+ } else if (useOctNumbers) {
1516
+ result2 = "0o" + argument.toString(8);
1510
1517
  }
1511
- if (useBinNumbers) {
1512
- return "0b" + argument.toString(2);
1518
+ if (isBigInt(argument)) {
1519
+ return result2 + "n";
1513
1520
  }
1514
- if (useOctNumbers) {
1515
- return "0o" + argument.toString(8);
1521
+ return result2;
1522
+ } else if (isBigInt(argument)) {
1523
+ if (json) {
1524
+ return JSON.stringify(Number(argument));
1516
1525
  }
1526
+ return argument + "n";
1517
1527
  } else if (!isObject(argument)) {
1518
1528
  if (json) {
1519
1529
  return JSON.stringify(argument) || "null";
@@ -5058,6 +5068,24 @@ var require_globals = __commonJS({
5058
5068
  uniq: false,
5059
5069
  which: false
5060
5070
  },
5071
+ vitest: {
5072
+ afterAll: false,
5073
+ afterEach: false,
5074
+ assert: false,
5075
+ assertType: false,
5076
+ beforeAll: false,
5077
+ beforeEach: false,
5078
+ describe: false,
5079
+ expect: false,
5080
+ expectTypeOf: false,
5081
+ it: false,
5082
+ onTestFailed: false,
5083
+ onTestFinished: false,
5084
+ suite: false,
5085
+ test: false,
5086
+ vi: false,
5087
+ vitest: false
5088
+ },
5061
5089
  webextensions: {
5062
5090
  browser: false,
5063
5091
  chrome: false,
@@ -5390,8 +5418,8 @@ var require_globals2 = __commonJS({
5390
5418
  }
5391
5419
  });
5392
5420
  // lib/index.mjs
5393
- var lib_exports2 = {};
5394
- __export(lib_exports2, {
5421
+ var index_exports = {};
5422
+ __export(index_exports, {
5395
5423
  codeFrameColumns: function() {
5396
5424
  return codeFrameColumns;
5397
5425
  },
@@ -5417,7 +5445,7 @@ __export(lib_exports2, {
5417
5445
  return lib_exports;
5418
5446
  }
5419
5447
  });
5420
- module.exports = __toCommonJS(lib_exports2);
5448
+ module.exports = __toCommonJS(index_exports);
5421
5449
  // node_modules/@babel/types/lib/index.js
5422
5450
  var lib_exports = {};
5423
5451
  __export(lib_exports, {
@@ -6150,6 +6178,9 @@ __export(lib_exports, {
6150
6178
  TSENTITYNAME_TYPES: function() {
6151
6179
  return TSENTITYNAME_TYPES;
6152
6180
  },
6181
+ TSEnumBody: function() {
6182
+ return tsEnumBody;
6183
+ },
6153
6184
  TSEnumDeclaration: function() {
6154
6185
  return tsEnumDeclaration;
6155
6186
  },
@@ -7101,6 +7132,9 @@ __export(lib_exports, {
7101
7132
  assertTSEntityName: function() {
7102
7133
  return assertTSEntityName;
7103
7134
  },
7135
+ assertTSEnumBody: function() {
7136
+ return assertTSEnumBody;
7137
+ },
7104
7138
  assertTSEnumDeclaration: function() {
7105
7139
  return assertTSEnumDeclaration;
7106
7140
  },
@@ -8358,6 +8392,9 @@ __export(lib_exports, {
8358
8392
  isTSEntityName: function() {
8359
8393
  return isTSEntityName;
8360
8394
  },
8395
+ isTSEnumBody: function() {
8396
+ return isTSEnumBody;
8397
+ },
8361
8398
  isTSEnumDeclaration: function() {
8362
8399
  return isTSEnumDeclaration;
8363
8400
  },
@@ -8952,6 +8989,9 @@ __export(lib_exports, {
8952
8989
  tsDeclareMethod: function() {
8953
8990
  return tsDeclareMethod;
8954
8991
  },
8992
+ tsEnumBody: function() {
8993
+ return tsEnumBody;
8994
+ },
8955
8995
  tsEnumDeclaration: function() {
8956
8996
  return tsEnumDeclaration;
8957
8997
  },
@@ -11755,6 +11795,11 @@ function isTSTypeAssertion(node, opts) {
11755
11795
  if (node.type !== "TSTypeAssertion") return false;
11756
11796
  return opts == null || shallowEqual(node, opts);
11757
11797
  }
11798
+ function isTSEnumBody(node, opts) {
11799
+ if (!node) return false;
11800
+ if (node.type !== "TSEnumBody") return false;
11801
+ return opts == null || shallowEqual(node, opts);
11802
+ }
11758
11803
  function isTSEnumDeclaration(node, opts) {
11759
11804
  if (!node) return false;
11760
11805
  if (node.type !== "TSEnumDeclaration") return false;
@@ -12853,6 +12898,7 @@ function isTypeScript(node, opts) {
12853
12898
  case "TSAsExpression":
12854
12899
  case "TSSatisfiesExpression":
12855
12900
  case "TSTypeAssertion":
12901
+ case "TSEnumBody":
12856
12902
  case "TSEnumDeclaration":
12857
12903
  case "TSEnumMember":
12858
12904
  case "TSModuleDeclaration":
@@ -13832,7 +13878,6 @@ defineType$4("CallExpression", {
13832
13878
  visitor: [
13833
13879
  "callee",
13834
13880
  "arguments",
13835
- "typeParameters",
13836
13881
  "typeArguments"
13837
13882
  ],
13838
13883
  builder: [
@@ -13846,14 +13891,14 @@ defineType$4("CallExpression", {
13846
13891
  callee: {
13847
13892
  validate: assertNodeType("Expression", "Super", "V8IntrinsicIdentifier")
13848
13893
  },
13849
- arguments: validateArrayOfType("Expression", "SpreadElement", "ArgumentPlaceholder")
13850
- }, {}, {
13894
+ arguments: validateArrayOfType("Expression", "SpreadElement", "ArgumentPlaceholder"),
13851
13895
  typeArguments: {
13852
- validate: assertNodeType("TypeParameterInstantiation"),
13896
+ validate: assertNodeType("TypeParameterInstantiation", "TSTypeParameterInstantiation"),
13853
13897
  optional: true
13854
- },
13855
- typeParameters: {
13856
- validate: assertNodeType("TSTypeParameterInstantiation"),
13898
+ }
13899
+ }, {}, process.env.BABEL_TYPES_8_BREAKING ? {} : {
13900
+ optional: {
13901
+ validate: assertValueType("boolean"),
13857
13902
  optional: true
13858
13903
  }
13859
13904
  })
@@ -14094,6 +14139,7 @@ defineType$4("FunctionDeclaration", {
14094
14139
  "id",
14095
14140
  "typeParameters",
14096
14141
  "params",
14142
+ "predicate",
14097
14143
  "returnType",
14098
14144
  "body"
14099
14145
  ],
@@ -14951,6 +14997,7 @@ defineType$4("ArrowFunctionExpression", {
14951
14997
  visitor: [
14952
14998
  "typeParameters",
14953
14999
  "params",
15000
+ "predicate",
14954
15001
  "returnType",
14955
15002
  "body"
14956
15003
  ],
@@ -15546,7 +15593,7 @@ defineType$4("Super", void 0);
15546
15593
  defineType$4("TaggedTemplateExpression", {
15547
15594
  visitor: [
15548
15595
  "tag",
15549
- "typeParameters",
15596
+ "typeArguments",
15550
15597
  "quasi"
15551
15598
  ],
15552
15599
  builder: [
@@ -15556,18 +15603,17 @@ defineType$4("TaggedTemplateExpression", {
15556
15603
  aliases: [
15557
15604
  "Expression"
15558
15605
  ],
15559
- fields: {
15606
+ fields: _define_property({
15560
15607
  tag: {
15561
15608
  validate: assertNodeType("Expression")
15562
15609
  },
15563
15610
  quasi: {
15564
15611
  validate: assertNodeType("TemplateLiteral")
15565
- },
15566
- typeParameters: {
15567
- validate: assertNodeType("TypeParameterInstantiation", "TSTypeParameterInstantiation"),
15568
- optional: true
15569
15612
  }
15570
- }
15613
+ }, "typeArguments", {
15614
+ validate: assertNodeType("TypeParameterInstantiation", "TSTypeParameterInstantiation"),
15615
+ optional: true
15616
+ })
15571
15617
  });
15572
15618
  defineType$4("TemplateElement", {
15573
15619
  builder: [
@@ -15756,7 +15802,6 @@ defineType$4("OptionalCallExpression", {
15756
15802
  visitor: [
15757
15803
  "callee",
15758
15804
  "arguments",
15759
- "typeParameters",
15760
15805
  "typeArguments"
15761
15806
  ],
15762
15807
  builder: [
@@ -15767,7 +15812,7 @@ defineType$4("OptionalCallExpression", {
15767
15812
  aliases: [
15768
15813
  "Expression"
15769
15814
  ],
15770
- fields: {
15815
+ fields: Object.assign({
15771
15816
  callee: {
15772
15817
  validate: assertNodeType("Expression")
15773
15818
  },
@@ -15776,18 +15821,15 @@ defineType$4("OptionalCallExpression", {
15776
15821
  validate: chain(assertValueType("boolean"), assertOptionalChainStart())
15777
15822
  },
15778
15823
  typeArguments: {
15779
- validate: assertNodeType("TypeParameterInstantiation"),
15780
- optional: true
15781
- },
15782
- typeParameters: {
15783
- validate: assertNodeType("TSTypeParameterInstantiation"),
15824
+ validate: assertNodeType("TypeParameterInstantiation", "TSTypeParameterInstantiation"),
15784
15825
  optional: true
15785
15826
  }
15786
- }
15827
+ }, {})
15787
15828
  });
15788
15829
  defineType$4("ClassProperty", {
15789
15830
  visitor: [
15790
15831
  "decorators",
15832
+ "variance",
15791
15833
  "key",
15792
15834
  "typeAnnotation",
15793
15835
  "value"
@@ -15897,6 +15939,7 @@ defineType$4("ClassAccessorProperty", {
15897
15939
  defineType$4("ClassPrivateProperty", {
15898
15940
  visitor: [
15899
15941
  "decorators",
15942
+ "variance",
15900
15943
  "key",
15901
15944
  "typeAnnotation",
15902
15945
  "value"
@@ -16097,9 +16140,13 @@ defineType$3("ClassImplements", {
16097
16140
  });
16098
16141
  defineInterfaceishType("DeclareClass");
16099
16142
  defineType$3("DeclareFunction", {
16100
- visitor: [
16143
+ builder: [
16101
16144
  "id"
16102
16145
  ],
16146
+ visitor: [
16147
+ "id",
16148
+ "predicate"
16149
+ ],
16103
16150
  aliases: [
16104
16151
  "FlowDeclaration",
16105
16152
  "Statement",
@@ -16244,8 +16291,15 @@ defineType$3("ExistsTypeAnnotation", {
16244
16291
  ]
16245
16292
  });
16246
16293
  defineType$3("FunctionTypeAnnotation", {
16294
+ builder: [
16295
+ "typeParameters",
16296
+ "params",
16297
+ "rest",
16298
+ "returnType"
16299
+ ],
16247
16300
  visitor: [
16248
16301
  "typeParameters",
16302
+ "this",
16249
16303
  "params",
16250
16304
  "rest",
16251
16305
  "returnType"
@@ -16742,9 +16796,13 @@ defineType$3("EnumBooleanMember", {
16742
16796
  aliases: [
16743
16797
  "EnumMember"
16744
16798
  ],
16745
- visitor: [
16799
+ builder: [
16746
16800
  "id"
16747
16801
  ],
16802
+ visitor: [
16803
+ "id",
16804
+ "init"
16805
+ ],
16748
16806
  fields: {
16749
16807
  id: validateType("Identifier"),
16750
16808
  init: validateType("BooleanLiteral")
@@ -16945,12 +17003,13 @@ defineType$2("JSXOpeningElement", {
16945
17003
  ],
16946
17004
  visitor: [
16947
17005
  "name",
17006
+ "typeArguments",
16948
17007
  "attributes"
16949
17008
  ],
16950
17009
  aliases: [
16951
17010
  "Immutable"
16952
17011
  ],
16953
- fields: {
17012
+ fields: Object.assign({
16954
17013
  name: {
16955
17014
  validate: assertNodeType("JSXIdentifier", "JSXMemberExpression", "JSXNamespacedName")
16956
17015
  },
@@ -16958,11 +17017,11 @@ defineType$2("JSXOpeningElement", {
16958
17017
  default: false
16959
17018
  },
16960
17019
  attributes: validateArrayOfType("JSXAttribute", "JSXSpreadAttribute"),
16961
- typeParameters: {
17020
+ typeArguments: {
16962
17021
  validate: assertNodeType("TypeParameterInstantiation", "TSTypeParameterInstantiation"),
16963
17022
  optional: true
16964
17023
  }
16965
- }
17024
+ }, {})
16966
17025
  });
16967
17026
  defineType$2("JSXSpreadAttribute", {
16968
17027
  visitor: [
@@ -17512,12 +17571,11 @@ defineType("TSTypeQuery", {
17512
17571
  ],
17513
17572
  visitor: [
17514
17573
  "exprName",
17515
- "typeParameters"
17574
+ "typeArguments"
17516
17575
  ],
17517
- fields: {
17518
- exprName: validateType("TSEntityName", "TSImportType"),
17519
- typeParameters: validateOptionalType("TSTypeParameterInstantiation")
17520
- }
17576
+ fields: _define_property({
17577
+ exprName: validateType("TSEntityName", "TSImportType")
17578
+ }, "typeArguments", validateOptionalType("TSTypeParameterInstantiation"))
17521
17579
  });
17522
17580
  defineType("TSTypeLiteral", {
17523
17581
  aliases: [
@@ -17731,22 +17789,33 @@ defineType("TSLiteralType", {
17731
17789
  }
17732
17790
  }
17733
17791
  });
17734
- var expressionWithTypeArguments = {
17735
- aliases: [
17736
- "TSType"
17737
- ],
17738
- visitor: [
17739
- "expression",
17740
- "typeParameters"
17741
- ],
17742
- fields: {
17743
- expression: validateType("TSEntityName"),
17744
- typeParameters: validateOptionalType("TSTypeParameterInstantiation")
17745
- }
17746
- };
17747
17792
  {
17748
- defineType("TSClassImplements", expressionWithTypeArguments);
17749
- defineType("TSInterfaceHeritage", expressionWithTypeArguments);
17793
+ defineType("TSClassImplements", {
17794
+ aliases: [
17795
+ "TSType"
17796
+ ],
17797
+ visitor: [
17798
+ "expression",
17799
+ "typeArguments"
17800
+ ],
17801
+ fields: {
17802
+ expression: validateType("TSEntityName"),
17803
+ typeArguments: validateOptionalType("TSTypeParameterInstantiation")
17804
+ }
17805
+ });
17806
+ defineType("TSInterfaceHeritage", {
17807
+ aliases: [
17808
+ "TSType"
17809
+ ],
17810
+ visitor: [
17811
+ "expression",
17812
+ "typeArguments"
17813
+ ],
17814
+ fields: {
17815
+ expression: validateType("TSEntityName"),
17816
+ typeArguments: validateOptionalType("TSTypeParameterInstantiation")
17817
+ }
17818
+ });
17750
17819
  }defineType("TSInterfaceDeclaration", {
17751
17820
  aliases: [
17752
17821
  "Statement",
@@ -17797,12 +17866,11 @@ defineType("TSInstantiationExpression", {
17797
17866
  ],
17798
17867
  visitor: [
17799
17868
  "expression",
17800
- "typeParameters"
17869
+ "typeArguments"
17801
17870
  ],
17802
- fields: {
17803
- expression: validateType("Expression"),
17804
- typeParameters: validateOptionalType("TSTypeParameterInstantiation")
17805
- }
17871
+ fields: _define_property({
17872
+ expression: validateType("Expression")
17873
+ }, "typeArguments", validateOptionalType("TSTypeParameterInstantiation"))
17806
17874
  });
17807
17875
  var TSTypeExpression = {
17808
17876
  aliases: [
@@ -17836,24 +17904,32 @@ defineType("TSTypeAssertion", {
17836
17904
  expression: validateType("Expression")
17837
17905
  }
17838
17906
  });
17839
- defineType("TSEnumDeclaration", {
17840
- aliases: [
17841
- "Statement",
17842
- "Declaration"
17843
- ],
17907
+ defineType("TSEnumBody", {
17844
17908
  visitor: [
17845
- "id",
17846
17909
  "members"
17847
17910
  ],
17848
17911
  fields: {
17849
- declare: validateOptional(bool),
17850
- const: validateOptional(bool),
17851
- id: validateType("Identifier"),
17852
- members: validateArrayOfType("TSEnumMember"),
17853
- initializer: validateOptionalType("Expression")
17912
+ members: validateArrayOfType("TSEnumMember")
17854
17913
  }
17855
17914
  });
17856
- defineType("TSEnumMember", {
17915
+ {
17916
+ defineType("TSEnumDeclaration", {
17917
+ aliases: [
17918
+ "Statement",
17919
+ "Declaration"
17920
+ ],
17921
+ visitor: [
17922
+ "id",
17923
+ "body"
17924
+ ],
17925
+ fields: {
17926
+ declare: validateOptional(bool),
17927
+ const: validateOptional(bool),
17928
+ id: validateType("Identifier"),
17929
+ body: validateType("TSEnumBody")
17930
+ }
17931
+ });
17932
+ }defineType("TSEnumMember", {
17857
17933
  visitor: [
17858
17934
  "id",
17859
17935
  "initializer"
@@ -17896,24 +17972,29 @@ defineType("TSModuleBlock", {
17896
17972
  body: validateArrayOfType("Statement")
17897
17973
  }
17898
17974
  });
17975
+ var _obj2;
17899
17976
  defineType("TSImportType", {
17900
17977
  aliases: [
17901
17978
  "TSType"
17902
17979
  ],
17980
+ builder: [
17981
+ "argument",
17982
+ "qualifier",
17983
+ "typeArguments"
17984
+ ],
17903
17985
  visitor: [
17904
17986
  "argument",
17987
+ "options",
17905
17988
  "qualifier",
17906
- "typeParameters"
17989
+ "typeArguments"
17907
17990
  ],
17908
- fields: {
17909
- argument: validateType("StringLiteral"),
17910
- qualifier: validateOptionalType("TSEntityName"),
17911
- typeParameters: validateOptionalType("TSTypeParameterInstantiation"),
17912
- options: {
17913
- validate: assertNodeType("Expression"),
17914
- optional: true
17915
- }
17916
- }
17991
+ fields: (_obj2 = {
17992
+ argument: validateType("TSLiteralType"),
17993
+ qualifier: validateOptionalType("TSEntityName")
17994
+ }, _define_property(_obj2, "typeArguments", validateOptionalType("TSTypeParameterInstantiation")), _define_property(_obj2, "options", {
17995
+ validate: assertNodeType("Expression"),
17996
+ optional: true
17997
+ }), _obj2)
17917
17998
  });
17918
17999
  defineType("TSImportEqualsDeclaration", {
17919
18000
  aliases: [
@@ -18009,6 +18090,7 @@ defineType("TSTypeParameter", {
18009
18090
  "name"
18010
18091
  ],
18011
18092
  visitor: [
18093
+ "name",
18012
18094
  "constraint",
18013
18095
  "default"
18014
18096
  ],
@@ -20315,15 +20397,15 @@ function tsTypePredicate(parameterName) {
20315
20397
  return node;
20316
20398
  }
20317
20399
  function tsTypeQuery(exprName) {
20318
- var typeParameters = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null;
20400
+ var typeArguments = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null;
20319
20401
  var node = {
20320
20402
  type: "TSTypeQuery",
20321
20403
  exprName: exprName,
20322
- typeParameters: typeParameters
20404
+ typeArguments: typeArguments
20323
20405
  };
20324
20406
  var defs = NODE_FIELDS.TSTypeQuery;
20325
20407
  validate(defs.exprName, node, "exprName", exprName, 1);
20326
- validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
20408
+ validate(defs.typeArguments, node, "typeArguments", typeArguments, 1);
20327
20409
  return node;
20328
20410
  }
20329
20411
  function tsTypeLiteral(members) {
@@ -20483,27 +20565,27 @@ function tsLiteralType(literal) {
20483
20565
  return node;
20484
20566
  }
20485
20567
  function tsClassImplements(expression2) {
20486
- var typeParameters = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null;
20568
+ var typeArguments = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null;
20487
20569
  var node = {
20488
20570
  type: "TSClassImplements",
20489
20571
  expression: expression2,
20490
- typeParameters: typeParameters
20572
+ typeArguments: typeArguments
20491
20573
  };
20492
20574
  var defs = NODE_FIELDS.TSClassImplements;
20493
20575
  validate(defs.expression, node, "expression", expression2, 1);
20494
- validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
20576
+ validate(defs.typeArguments, node, "typeArguments", typeArguments, 1);
20495
20577
  return node;
20496
20578
  }
20497
20579
  function tsInterfaceHeritage(expression2) {
20498
- var typeParameters = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null;
20580
+ var typeArguments = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null;
20499
20581
  var node = {
20500
20582
  type: "TSInterfaceHeritage",
20501
20583
  expression: expression2,
20502
- typeParameters: typeParameters
20584
+ typeArguments: typeArguments
20503
20585
  };
20504
20586
  var defs = NODE_FIELDS.TSInterfaceHeritage;
20505
20587
  validate(defs.expression, node, "expression", expression2, 1);
20506
- validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
20588
+ validate(defs.typeArguments, node, "typeArguments", typeArguments, 1);
20507
20589
  return node;
20508
20590
  }
20509
20591
  function tsInterfaceDeclaration(id) {
@@ -20546,15 +20628,15 @@ function tsTypeAliasDeclaration(id) {
20546
20628
  return node;
20547
20629
  }
20548
20630
  function tsInstantiationExpression(expression2) {
20549
- var typeParameters = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null;
20631
+ var typeArguments = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null;
20550
20632
  var node = {
20551
20633
  type: "TSInstantiationExpression",
20552
20634
  expression: expression2,
20553
- typeParameters: typeParameters
20635
+ typeArguments: typeArguments
20554
20636
  };
20555
20637
  var defs = NODE_FIELDS.TSInstantiationExpression;
20556
20638
  validate(defs.expression, node, "expression", expression2, 1);
20557
- validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
20639
+ validate(defs.typeArguments, node, "typeArguments", typeArguments, 1);
20558
20640
  return node;
20559
20641
  }
20560
20642
  function tsAsExpression(expression2, typeAnnotation2) {
@@ -20590,15 +20672,24 @@ function tsTypeAssertion(typeAnnotation2, expression2) {
20590
20672
  validate(defs.expression, node, "expression", expression2, 1);
20591
20673
  return node;
20592
20674
  }
20593
- function tsEnumDeclaration(id, members) {
20675
+ function tsEnumBody(members) {
20676
+ var node = {
20677
+ type: "TSEnumBody",
20678
+ members: members
20679
+ };
20680
+ var defs = NODE_FIELDS.TSEnumBody;
20681
+ validate(defs.members, node, "members", members, 1);
20682
+ return node;
20683
+ }
20684
+ function tsEnumDeclaration(id, body) {
20594
20685
  var node = {
20595
20686
  type: "TSEnumDeclaration",
20596
20687
  id: id,
20597
- members: members
20688
+ body: body
20598
20689
  };
20599
20690
  var defs = NODE_FIELDS.TSEnumDeclaration;
20600
20691
  validate(defs.id, node, "id", id, 1);
20601
- validate(defs.members, node, "members", members, 1);
20692
+ validate(defs.body, node, "body", body, 1);
20602
20693
  return node;
20603
20694
  }
20604
20695
  function tsEnumMember(id) {
@@ -20635,17 +20726,17 @@ function tsModuleBlock(body) {
20635
20726
  return node;
20636
20727
  }
20637
20728
  function tsImportType(argument) {
20638
- var qualifier = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null, typeParameters = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : null;
20729
+ var qualifier = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null, typeArguments = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : null;
20639
20730
  var node = {
20640
20731
  type: "TSImportType",
20641
20732
  argument: argument,
20642
20733
  qualifier: qualifier,
20643
- typeParameters: typeParameters
20734
+ typeArguments: typeArguments
20644
20735
  };
20645
20736
  var defs = NODE_FIELDS.TSImportType;
20646
20737
  validate(defs.argument, node, "argument", argument, 1);
20647
20738
  validate(defs.qualifier, node, "qualifier", qualifier, 1);
20648
- validate(defs.typeParameters, node, "typeParameters", typeParameters, 1);
20739
+ validate(defs.typeArguments, node, "typeArguments", typeArguments, 1);
20649
20740
  return node;
20650
20741
  }
20651
20742
  function tsImportEqualsDeclaration(id, moduleReference) {
@@ -21518,6 +21609,9 @@ function assertTSSatisfiesExpression(node, opts) {
21518
21609
  function assertTSTypeAssertion(node, opts) {
21519
21610
  assert("TSTypeAssertion", node, opts);
21520
21611
  }
21612
+ function assertTSEnumBody(node, opts) {
21613
+ assert("TSEnumBody", node, opts);
21614
+ }
21521
21615
  function assertTSEnumDeclaration(node, opts) {
21522
21616
  assert("TSEnumDeclaration", node, opts);
21523
21617
  }
@@ -23659,6 +23753,71 @@ function ParseErrorEnum(argument, syntaxPlugin) {
23659
23753
  return ParseErrorConstructors;
23660
23754
  }
23661
23755
  var Errors = Object.assign({}, ParseErrorEnum(ModuleErrors), ParseErrorEnum(StandardErrors), ParseErrorEnum(StrictModeErrors), ParseErrorEnum(_templateObject())(PipelineOperatorErrors));
23756
+ function createDefaultOptions() {
23757
+ return {
23758
+ sourceType: "script",
23759
+ sourceFilename: void 0,
23760
+ startIndex: 0,
23761
+ startColumn: 0,
23762
+ startLine: 1,
23763
+ allowAwaitOutsideFunction: false,
23764
+ allowReturnOutsideFunction: false,
23765
+ allowNewTargetOutsideFunction: false,
23766
+ allowImportExportEverywhere: false,
23767
+ allowSuperOutsideMethod: false,
23768
+ allowUndeclaredExports: false,
23769
+ plugins: [],
23770
+ strictMode: null,
23771
+ ranges: false,
23772
+ tokens: false,
23773
+ createImportExpressions: true,
23774
+ createParenthesizedExpressions: false,
23775
+ errorRecovery: false,
23776
+ attachComment: true,
23777
+ annexB: true
23778
+ };
23779
+ }
23780
+ function getOptions(opts) {
23781
+ var options = createDefaultOptions();
23782
+ if (opts == null) {
23783
+ return options;
23784
+ }
23785
+ if (opts.annexB != null && opts.annexB !== false) {
23786
+ throw new Error("The `annexB` option can only be set to `false`.");
23787
+ }
23788
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
23789
+ try {
23790
+ for(var _iterator = Object.keys(options)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
23791
+ var key = _step.value;
23792
+ if (opts[key] != null) options[key] = opts[key];
23793
+ }
23794
+ } catch (err) {
23795
+ _didIteratorError = true;
23796
+ _iteratorError = err;
23797
+ } finally{
23798
+ try {
23799
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
23800
+ _iterator.return();
23801
+ }
23802
+ } finally{
23803
+ if (_didIteratorError) {
23804
+ throw _iteratorError;
23805
+ }
23806
+ }
23807
+ }
23808
+ if (options.startLine === 1) {
23809
+ if (opts.startIndex == null && options.startColumn > 0) {
23810
+ options.startIndex = options.startColumn;
23811
+ } else if (opts.startColumn == null && options.startIndex > 0) {
23812
+ options.startColumn = options.startIndex;
23813
+ }
23814
+ } else if (opts.startColumn == null || opts.startIndex == null) {
23815
+ {
23816
+ throw new Error("With a `startLine > 1` you must also specify `startIndex` and `startColumn`.");
23817
+ }
23818
+ }
23819
+ return options;
23820
+ }
23662
23821
  var defineProperty = Object.defineProperty;
23663
23822
  var toUnenumerable = function(object, key) {
23664
23823
  if (object) {
@@ -23686,7 +23845,7 @@ var estree = function(superClass) {
23686
23845
  key: "parse",
23687
23846
  value: function parse() {
23688
23847
  var file2 = toESTreeLocation(_get(_get_prototype_of(ESTreeParserMixin.prototype), "parse", this).call(this));
23689
- if (this.options.tokens) {
23848
+ if (this.optionFlags & 128) {
23690
23849
  file2.tokens = file2.tokens.map(toESTreeLocation);
23691
23850
  }
23692
23851
  return file2;
@@ -23819,21 +23978,6 @@ var estree = function(superClass) {
23819
23978
  delete node.directives;
23820
23979
  }
23821
23980
  },
23822
- {
23823
- key: "pushClassMethod",
23824
- value: function pushClassMethod(classBody2, method, isGenerator, isAsync, isConstructor, allowsDirectSuper) {
23825
- this.parseMethod(method, isGenerator, isAsync, isConstructor, allowsDirectSuper, "ClassMethod", true);
23826
- var typeParameters = method.typeParameters;
23827
- if (typeParameters) {
23828
- delete method.typeParameters;
23829
- var fn = method.value;
23830
- fn.typeParameters = typeParameters;
23831
- fn.start = typeParameters.start;
23832
- fn.loc.start = typeParameters.loc.start;
23833
- }
23834
- classBody2.body.push(method);
23835
- }
23836
- },
23837
23981
  {
23838
23982
  key: "parsePrivateName",
23839
23983
  value: function parsePrivateName() {
@@ -23891,9 +24035,22 @@ var estree = function(superClass) {
23891
24035
  funcNode.type = "FunctionExpression";
23892
24036
  delete funcNode.kind;
23893
24037
  node.value = funcNode;
24038
+ var typeParameters = node.typeParameters;
24039
+ if (typeParameters) {
24040
+ delete node.typeParameters;
24041
+ funcNode.typeParameters = typeParameters;
24042
+ funcNode.start = typeParameters.start;
24043
+ funcNode.loc.start = typeParameters.loc.start;
24044
+ }
23894
24045
  if (type === "ClassPrivateMethod") {
23895
24046
  node.computed = false;
23896
24047
  }
24048
+ if (node.abstract && this.hasPlugin("typescript")) {
24049
+ if (!funcNode.body) {
24050
+ funcNode.type = "TSEmptyBodyFunctionExpression";
24051
+ }
24052
+ return this.finishNode(node, "TSAbstractMethodDefinition");
24053
+ }
23897
24054
  return this.finishNode(node, "MethodDefinition");
23898
24055
  }
23899
24056
  },
@@ -23914,7 +24071,11 @@ var estree = function(superClass) {
23914
24071
  var propertyNode = (_$_get = _get(_get_prototype_of(ESTreeParserMixin.prototype), "parseClassProperty", this)).call.apply(_$_get, [
23915
24072
  this
23916
24073
  ].concat(_to_consumable_array(args)));
23917
- propertyNode.type = "PropertyDefinition";
24074
+ if (propertyNode.abstract && this.hasPlugin("typescript")) {
24075
+ propertyNode.type = "TSAbstractPropertyDefinition";
24076
+ } else {
24077
+ propertyNode.type = "PropertyDefinition";
24078
+ }
23918
24079
  return propertyNode;
23919
24080
  }
23920
24081
  },
@@ -23928,7 +24089,11 @@ var estree = function(superClass) {
23928
24089
  var propertyNode = (_$_get = _get(_get_prototype_of(ESTreeParserMixin.prototype), "parseClassPrivateProperty", this)).call.apply(_$_get, [
23929
24090
  this
23930
24091
  ].concat(_to_consumable_array(args)));
23931
- propertyNode.type = "PropertyDefinition";
24092
+ if (propertyNode.abstract && this.hasPlugin("typescript")) {
24093
+ propertyNode.type = "TSAbstractPropertyDefinition";
24094
+ } else {
24095
+ propertyNode.type = "PropertyDefinition";
24096
+ }
23932
24097
  propertyNode.computed = false;
23933
24098
  return propertyNode;
23934
24099
  }
@@ -26234,6 +26399,14 @@ var CommentsParser = /*#__PURE__*/ function(BaseParser) {
26234
26399
  case "ImportDeclaration":
26235
26400
  adjustInnerComments(node, node.specifiers, commentWS);
26236
26401
  break;
26402
+ case "TSEnumDeclaration":
26403
+ {
26404
+ setInnerComments(node, comments);
26405
+ }
26406
+ break;
26407
+ case "TSEnumBody":
26408
+ adjustInnerComments(node, node.members, commentWS);
26409
+ break;
26237
26410
  default:
26238
26411
  {
26239
26412
  setInnerComments(node, comments);
@@ -26900,7 +27073,7 @@ var Tokenizer = /*#__PURE__*/ function(CommentsParser) {
26900
27073
  __publicField(_this, "tokens", []);
26901
27074
  __publicField(_this, "errorHandlers_readInt", {
26902
27075
  invalidDigit: function(pos, lineStart, curLine, radix) {
26903
- if (!_this.options.errorRecovery) return false;
27076
+ if (!(_this.optionFlags & 1024)) return false;
26904
27077
  _this.raise(Errors.InvalidDigit, buildPosition(pos, lineStart, curLine), {
26905
27078
  radix: radix
26906
27079
  });
@@ -26948,7 +27121,7 @@ var Tokenizer = /*#__PURE__*/ function(CommentsParser) {
26948
27121
  key: "next",
26949
27122
  value: function next() {
26950
27123
  this.checkKeywordEscapes();
26951
- if (this.options.tokens) {
27124
+ if (this.optionFlags & 128) {
26952
27125
  this.pushToken(new Token(this.state));
26953
27126
  }
26954
27127
  this.state.lastTokEndLoc = this.state.endLoc;
@@ -27115,7 +27288,7 @@ var Tokenizer = /*#__PURE__*/ function(CommentsParser) {
27115
27288
  end: this.sourceToOffsetPos(end + commentEnd.length),
27116
27289
  loc: new SourceLocation(startLoc, this.state.curPosition())
27117
27290
  };
27118
- if (this.options.tokens) this.pushToken(comment);
27291
+ if (this.optionFlags & 128) this.pushToken(comment);
27119
27292
  return comment;
27120
27293
  }
27121
27294
  },
@@ -27141,7 +27314,7 @@ var Tokenizer = /*#__PURE__*/ function(CommentsParser) {
27141
27314
  end: this.sourceToOffsetPos(end),
27142
27315
  loc: new SourceLocation(startLoc, this.state.curPosition())
27143
27316
  };
27144
- if (this.options.tokens) this.pushToken(comment);
27317
+ if (this.optionFlags & 128) this.pushToken(comment);
27145
27318
  return comment;
27146
27319
  }
27147
27320
  },
@@ -27149,7 +27322,7 @@ var Tokenizer = /*#__PURE__*/ function(CommentsParser) {
27149
27322
  key: "skipSpace",
27150
27323
  value: function skipSpace() {
27151
27324
  var spaceStart = this.state.pos;
27152
- var comments = [];
27325
+ var comments = this.optionFlags & 2048 ? [] : null;
27153
27326
  loop: while(this.state.pos < this.length){
27154
27327
  var ch = this.input.charCodeAt(this.state.pos);
27155
27328
  switch(ch){
@@ -27176,7 +27349,7 @@ var Tokenizer = /*#__PURE__*/ function(CommentsParser) {
27176
27349
  var comment = this.skipBlockComment("*/");
27177
27350
  if (comment !== void 0) {
27178
27351
  this.addComment(comment);
27179
- if (this.options.attachComment) comments.push(comment);
27352
+ comments === null || comments === void 0 ? void 0 : comments.push(comment);
27180
27353
  }
27181
27354
  break;
27182
27355
  }
@@ -27185,7 +27358,7 @@ var Tokenizer = /*#__PURE__*/ function(CommentsParser) {
27185
27358
  var comment1 = this.skipLineComment(2);
27186
27359
  if (comment1 !== void 0) {
27187
27360
  this.addComment(comment1);
27188
- if (this.options.attachComment) comments.push(comment1);
27361
+ comments === null || comments === void 0 ? void 0 : comments.push(comment1);
27189
27362
  }
27190
27363
  break;
27191
27364
  }
@@ -27196,24 +27369,24 @@ var Tokenizer = /*#__PURE__*/ function(CommentsParser) {
27196
27369
  default:
27197
27370
  if (isWhitespace(ch)) {
27198
27371
  ++this.state.pos;
27199
- } else if (ch === 45 && !this.inModule && this.options.annexB) {
27372
+ } else if (ch === 45 && !this.inModule && this.optionFlags & 4096) {
27200
27373
  var pos = this.state.pos;
27201
27374
  if (this.input.charCodeAt(pos + 1) === 45 && this.input.charCodeAt(pos + 2) === 62 && (spaceStart === 0 || this.state.lineStart > spaceStart)) {
27202
27375
  var comment2 = this.skipLineComment(3);
27203
27376
  if (comment2 !== void 0) {
27204
27377
  this.addComment(comment2);
27205
- if (this.options.attachComment) comments.push(comment2);
27378
+ comments === null || comments === void 0 ? void 0 : comments.push(comment2);
27206
27379
  }
27207
27380
  } else {
27208
27381
  break loop;
27209
27382
  }
27210
- } else if (ch === 60 && !this.inModule && this.options.annexB) {
27383
+ } else if (ch === 60 && !this.inModule && this.optionFlags & 4096) {
27211
27384
  var pos1 = this.state.pos;
27212
27385
  if (this.input.charCodeAt(pos1 + 1) === 33 && this.input.charCodeAt(pos1 + 2) === 45 && this.input.charCodeAt(pos1 + 3) === 45) {
27213
27386
  var comment3 = this.skipLineComment(4);
27214
27387
  if (comment3 !== void 0) {
27215
27388
  this.addComment(comment3);
27216
- if (this.options.attachComment) comments.push(comment3);
27389
+ comments === null || comments === void 0 ? void 0 : comments.push(comment3);
27217
27390
  }
27218
27391
  } else {
27219
27392
  break loop;
@@ -27223,7 +27396,7 @@ var Tokenizer = /*#__PURE__*/ function(CommentsParser) {
27223
27396
  }
27224
27397
  }
27225
27398
  }
27226
- if (comments.length > 0) {
27399
+ if ((comments === null || comments === void 0 ? void 0 : comments.length) > 0) {
27227
27400
  var end = this.state.pos;
27228
27401
  var commentWhitespace = {
27229
27402
  start: this.sourceToOffsetPos(spaceStart),
@@ -27948,7 +28121,7 @@ var Tokenizer = /*#__PURE__*/ function(CommentsParser) {
27948
28121
  var details = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
27949
28122
  var loc = _instanceof(at, Position) ? at : at.loc.start;
27950
28123
  var error = toParseError(loc, details);
27951
- if (!this.options.errorRecovery) throw error;
28124
+ if (!(this.optionFlags & 1024)) throw error;
27952
28125
  if (!this.isLookahead) this.state.errors.push(error);
27953
28126
  return error;
27954
28127
  }
@@ -28665,7 +28838,7 @@ var Node = function Node(parser, pos, loc) {
28665
28838
  this.start = pos;
28666
28839
  this.end = 0;
28667
28840
  this.loc = new SourceLocation(loc);
28668
- if (parser === null || parser === void 0 ? void 0 : parser.options.ranges) this.range = [
28841
+ if ((parser === null || parser === void 0 ? void 0 : parser.optionFlags) & 64) this.range = [
28669
28842
  pos,
28670
28843
  0
28671
28844
  ];
@@ -28748,8 +28921,10 @@ var NodeUtils = /*#__PURE__*/ function(UtilParser) {
28748
28921
  node.type = type;
28749
28922
  node.end = endLoc.index;
28750
28923
  node.loc.end = endLoc;
28751
- if (this.options.ranges) node.range[1] = endLoc.index;
28752
- if (this.options.attachComment) this.processComment(node);
28924
+ if (this.optionFlags & 64) node.range[1] = endLoc.index;
28925
+ if (this.optionFlags & 2048) {
28926
+ this.processComment(node);
28927
+ }
28753
28928
  return node;
28754
28929
  }
28755
28930
  },
@@ -28758,7 +28933,7 @@ var NodeUtils = /*#__PURE__*/ function(UtilParser) {
28758
28933
  value: function resetStartLocation(node, startLoc) {
28759
28934
  node.start = startLoc.index;
28760
28935
  node.loc.start = startLoc;
28761
- if (this.options.ranges) node.range[0] = startLoc.index;
28936
+ if (this.optionFlags & 64) node.range[0] = startLoc.index;
28762
28937
  }
28763
28938
  },
28764
28939
  {
@@ -28767,7 +28942,7 @@ var NodeUtils = /*#__PURE__*/ function(UtilParser) {
28767
28942
  var endLoc = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : this.state.lastTokEndLoc;
28768
28943
  node.end = endLoc.index;
28769
28944
  node.loc.end = endLoc;
28770
- if (this.options.ranges) node.range[1] = endLoc.index;
28945
+ if (this.optionFlags & 64) node.range[1] = endLoc.index;
28771
28946
  }
28772
28947
  },
28773
28948
  {
@@ -29397,31 +29572,63 @@ var flow = function(superClass) {
29397
29572
  return this.finishNode(node, "TypeParameterDeclaration");
29398
29573
  }
29399
29574
  },
29575
+ {
29576
+ key: "flowInTopLevelContext",
29577
+ value: function flowInTopLevelContext(cb) {
29578
+ if (this.curContext() !== types.brace) {
29579
+ var oldContext = this.state.context;
29580
+ this.state.context = [
29581
+ oldContext[0]
29582
+ ];
29583
+ try {
29584
+ return cb();
29585
+ } finally{
29586
+ this.state.context = oldContext;
29587
+ }
29588
+ } else {
29589
+ return cb();
29590
+ }
29591
+ }
29592
+ },
29593
+ {
29594
+ key: "flowParseTypeParameterInstantiationInExpression",
29595
+ value: function flowParseTypeParameterInstantiationInExpression() {
29596
+ if (this.reScan_lt() !== 47) return;
29597
+ return this.flowParseTypeParameterInstantiation();
29598
+ }
29599
+ },
29400
29600
  {
29401
29601
  key: "flowParseTypeParameterInstantiation",
29402
29602
  value: function flowParseTypeParameterInstantiation() {
29603
+ var _this = this;
29403
29604
  var node = this.startNode();
29404
29605
  var oldInType = this.state.inType;
29405
- node.params = [];
29406
29606
  this.state.inType = true;
29407
- this.expect(47);
29408
- var oldNoAnonFunctionType = this.state.noAnonFunctionType;
29409
- this.state.noAnonFunctionType = false;
29410
- while(!this.match(48)){
29411
- node.params.push(this.flowParseType());
29412
- if (!this.match(48)) {
29413
- this.expect(12);
29607
+ node.params = [];
29608
+ this.flowInTopLevelContext(function() {
29609
+ _this.expect(47);
29610
+ var oldNoAnonFunctionType = _this.state.noAnonFunctionType;
29611
+ _this.state.noAnonFunctionType = false;
29612
+ while(!_this.match(48)){
29613
+ node.params.push(_this.flowParseType());
29614
+ if (!_this.match(48)) {
29615
+ _this.expect(12);
29616
+ }
29414
29617
  }
29618
+ _this.state.noAnonFunctionType = oldNoAnonFunctionType;
29619
+ });
29620
+ this.state.inType = oldInType;
29621
+ if (!this.state.inType && this.curContext() === types.brace) {
29622
+ this.reScan_lt_gt();
29415
29623
  }
29416
- this.state.noAnonFunctionType = oldNoAnonFunctionType;
29417
29624
  this.expect(48);
29418
- this.state.inType = oldInType;
29419
29625
  return this.finishNode(node, "TypeParameterInstantiation");
29420
29626
  }
29421
29627
  },
29422
29628
  {
29423
29629
  key: "flowParseTypeParameterInstantiationCallOrNew",
29424
29630
  value: function flowParseTypeParameterInstantiationCallOrNew() {
29631
+ if (this.reScan_lt() !== 47) return;
29425
29632
  var node = this.startNode();
29426
29633
  var oldInType = this.state.inType;
29427
29634
  node.params = [];
@@ -30684,9 +30891,9 @@ var flow = function(superClass) {
30684
30891
  key: "parseClassSuper",
30685
30892
  value: function parseClassSuper(node) {
30686
30893
  _get(_get_prototype_of(FlowParserMixin.prototype), "parseClassSuper", this).call(this, node);
30687
- if (node.superClass && this.match(47)) {
30894
+ if (node.superClass && (this.match(47) || this.match(51))) {
30688
30895
  {
30689
- node.superTypeArguments = this.flowParseTypeParameterInstantiation();
30896
+ node.superTypeArguments = this.flowParseTypeParameterInstantiationInExpression();
30690
30897
  }
30691
30898
  }
30692
30899
  if (this.isContextual(113)) {
@@ -31095,12 +31302,12 @@ var flow = function(superClass) {
31095
31302
  this.next();
31096
31303
  var node = this.startNodeAt(startLoc);
31097
31304
  node.callee = base;
31098
- node.typeArguments = this.flowParseTypeParameterInstantiation();
31305
+ node.typeArguments = this.flowParseTypeParameterInstantiationInExpression();
31099
31306
  this.expect(10);
31100
31307
  node.arguments = this.parseCallExpressionArguments(11);
31101
31308
  node.optional = true;
31102
31309
  return this.finishCallExpression(node, true);
31103
- } else if (!noCalls && this.shouldParseTypes() && this.match(47)) {
31310
+ } else if (!noCalls && this.shouldParseTypes() && (this.match(47) || this.match(51))) {
31104
31311
  var node1 = this.startNodeAt(startLoc);
31105
31312
  node1.callee = base;
31106
31313
  var result = this.tryParse(function() {
@@ -31650,6 +31857,17 @@ var flow = function(superClass) {
31650
31857
  return this.finishNode(node, "EnumDeclaration");
31651
31858
  }
31652
31859
  },
31860
+ {
31861
+ key: "jsxParseOpeningElementAfterName",
31862
+ value: function jsxParseOpeningElementAfterName(node) {
31863
+ if (this.shouldParseTypes()) {
31864
+ if (this.match(47) || this.match(51)) {
31865
+ node.typeArguments = this.flowParseTypeParameterInstantiationInExpression();
31866
+ }
31867
+ }
31868
+ return _get(_get_prototype_of(FlowParserMixin.prototype), "jsxParseOpeningElementAfterName", this).call(this, node);
31869
+ }
31870
+ },
31653
31871
  {
31654
31872
  key: "isLookaheadToken_lt",
31655
31873
  value: function isLookaheadToken_lt() {
@@ -31661,6 +31879,31 @@ var flow = function(superClass) {
31661
31879
  return false;
31662
31880
  }
31663
31881
  },
31882
+ {
31883
+ key: "reScan_lt_gt",
31884
+ value: function reScan_lt_gt() {
31885
+ var type = this.state.type;
31886
+ if (type === 47) {
31887
+ this.state.pos -= 1;
31888
+ this.readToken_lt();
31889
+ } else if (type === 48) {
31890
+ this.state.pos -= 1;
31891
+ this.readToken_gt();
31892
+ }
31893
+ }
31894
+ },
31895
+ {
31896
+ key: "reScan_lt",
31897
+ value: function reScan_lt() {
31898
+ var type = this.state.type;
31899
+ if (type === 51) {
31900
+ this.state.pos -= 2;
31901
+ this.finishOp(47, 1);
31902
+ return 47;
31903
+ }
31904
+ return type;
31905
+ }
31906
+ },
31664
31907
  {
31665
31908
  key: "maybeUnwrapTypeCastExpression",
31666
31909
  value: function maybeUnwrapTypeCastExpression(node) {
@@ -33499,8 +33742,14 @@ var typescript = function(superClass) {
33499
33742
  this.expect(10);
33500
33743
  if (!this.match(134)) {
33501
33744
  this.raise(TSErrors.UnsupportedImportTypeArgument, this.state.startLoc);
33745
+ {
33746
+ node.argument = this.tsParseNonConditionalType();
33747
+ }
33748
+ } else {
33749
+ {
33750
+ node.argument = this.tsParseLiteralTypeNode();
33751
+ }
33502
33752
  }
33503
- node.argument = _get(_get_prototype_of(TypeScriptParserMixin.prototype), "parseExprAtom", this).call(this);
33504
33753
  if (this.eat(12) && !this.match(11)) {
33505
33754
  node.options = _get(_get_prototype_of(TypeScriptParserMixin.prototype), "parseMaybeAssignAllowIn", this).call(this);
33506
33755
  this.eat(12);
@@ -33512,7 +33761,9 @@ var typescript = function(superClass) {
33512
33761
  node.qualifier = this.tsParseEntityName();
33513
33762
  }
33514
33763
  if (this.match(47)) {
33515
- node.typeParameters = this.tsParseTypeArguments();
33764
+ {
33765
+ node.typeArguments = this.tsParseTypeArguments();
33766
+ }
33516
33767
  }
33517
33768
  return this.finishNode(node, "TSImportType");
33518
33769
  }
@@ -33574,7 +33825,9 @@ var typescript = function(superClass) {
33574
33825
  node.exprName = this.tsParseEntityName();
33575
33826
  }
33576
33827
  if (!this.hasPrecedingLineBreak() && this.match(47)) {
33577
- node.typeParameters = this.tsParseTypeArguments();
33828
+ {
33829
+ node.typeArguments = this.tsParseTypeArguments();
33830
+ }
33578
33831
  }
33579
33832
  return this.finishNode(node, "TSTypeQuery");
33580
33833
  }
@@ -34074,7 +34327,7 @@ var typescript = function(superClass) {
34074
34327
  return this.tsParseTupleType();
34075
34328
  case 10:
34076
34329
  {
34077
- if (!this.options.createParenthesizedExpressions) {
34330
+ if (!(this.optionFlags & 512)) {
34078
34331
  var startLoc = this.state.startLoc;
34079
34332
  this.next();
34080
34333
  var type = this.tsParseType();
@@ -34456,10 +34709,12 @@ var typescript = function(superClass) {
34456
34709
  var delimitedList = this.tsParseDelimitedList("HeritageClauseElement", function() {
34457
34710
  var node = _this.startNode();
34458
34711
  node.expression = _this.tsParseEntityName();
34459
- if (_this.match(47)) {
34460
- node.typeParameters = _this.tsParseTypeArguments();
34712
+ {
34713
+ if (_this.match(47)) {
34714
+ node.typeArguments = _this.tsParseTypeArguments();
34715
+ }
34716
+ return _this.finishNode(node, token === "extends" ? "TSInterfaceHeritage" : "TSClassImplements");
34461
34717
  }
34462
- return _this.finishNode(node, token === "extends" ? "TSInterfaceHeritage" : "TSClassImplements");
34463
34718
  });
34464
34719
  if (!delimitedList.length) {
34465
34720
  this.raise(TSErrors.EmptyHeritageClauseType, originalStartLoc, {
@@ -34514,16 +34769,20 @@ var typescript = function(superClass) {
34514
34769
  }
34515
34770
  },
34516
34771
  {
34517
- key: "tsInNoContext",
34518
- value: function tsInNoContext(cb) {
34519
- var oldContext = this.state.context;
34520
- this.state.context = [
34521
- oldContext[0]
34522
- ];
34523
- try {
34772
+ key: "tsInTopLevelContext",
34773
+ value: function tsInTopLevelContext(cb) {
34774
+ if (this.curContext() !== types.brace) {
34775
+ var oldContext = this.state.context;
34776
+ this.state.context = [
34777
+ oldContext[0]
34778
+ ];
34779
+ try {
34780
+ return cb();
34781
+ } finally{
34782
+ this.state.context = oldContext;
34783
+ }
34784
+ } else {
34524
34785
  return cb();
34525
- } finally{
34526
- this.state.context = oldContext;
34527
34786
  }
34528
34787
  }
34529
34788
  },
@@ -34611,10 +34870,20 @@ var typescript = function(superClass) {
34611
34870
  this.expectContextual(126);
34612
34871
  node.id = this.parseIdentifier();
34613
34872
  this.checkIdentifier(node.id, node.const ? 8971 : 8459);
34873
+ {
34874
+ node.body = this.tsParseEnumBody();
34875
+ }
34876
+ return this.finishNode(node, "TSEnumDeclaration");
34877
+ }
34878
+ },
34879
+ {
34880
+ key: "tsParseEnumBody",
34881
+ value: function tsParseEnumBody() {
34882
+ var node = this.startNode();
34614
34883
  this.expect(5);
34615
34884
  node.members = this.tsParseDelimitedList("EnumMembers", this.tsParseEnumMember.bind(this));
34616
34885
  this.expect(8);
34617
- return this.finishNode(node, "TSEnumDeclaration");
34886
+ return this.finishNode(node, "TSEnumBody");
34618
34887
  }
34619
34888
  },
34620
34889
  {
@@ -34910,7 +35179,7 @@ var typescript = function(superClass) {
34910
35179
  var _this = this;
34911
35180
  var node = this.startNode();
34912
35181
  node.params = this.tsInType(function() {
34913
- return _this.tsInNoContext(function() {
35182
+ return _this.tsInTopLevelContext(function() {
34914
35183
  _this.expect(47);
34915
35184
  return _this.tsParseDelimitedList("TypeParametersOrArguments", _this.tsParseType.bind(_this));
34916
35185
  });
@@ -35118,7 +35387,9 @@ var typescript = function(superClass) {
35118
35387
  }
35119
35388
  if (tokenIsTemplate(_this.state.type)) {
35120
35389
  var result2 = _get(_get_prototype_of(TypeScriptParserMixin.prototype), "parseTaggedTemplateExpression", _this).call(_this, base, startLoc, state);
35121
- result2.typeParameters = typeArguments;
35390
+ {
35391
+ result2.typeArguments = typeArguments;
35392
+ }
35122
35393
  return result2;
35123
35394
  }
35124
35395
  if (!noCalls && _this.eat(10)) {
@@ -35126,7 +35397,9 @@ var typescript = function(superClass) {
35126
35397
  node2.callee = base;
35127
35398
  node2.arguments = _this.parseCallExpressionArguments(11);
35128
35399
  _this.tsCheckForInvalidTypeCasts(node2.arguments);
35129
- node2.typeParameters = typeArguments;
35400
+ {
35401
+ node2.typeArguments = typeArguments;
35402
+ }
35130
35403
  if (state.optionalChainMember) {
35131
35404
  node2.optional = isOptionalCall;
35132
35405
  }
@@ -35138,7 +35411,9 @@ var typescript = function(superClass) {
35138
35411
  }
35139
35412
  var node = _this.startNodeAt(startLoc);
35140
35413
  node.expression = base;
35141
- node.typeParameters = typeArguments;
35414
+ {
35415
+ node.typeArguments = typeArguments;
35416
+ }
35142
35417
  return _this.finishNode(node, "TSInstantiationExpression");
35143
35418
  });
35144
35419
  if (missingParenErrorLoc) {
@@ -35161,7 +35436,9 @@ var typescript = function(superClass) {
35161
35436
  _get(_get_prototype_of(TypeScriptParserMixin.prototype), "parseNewCallee", this).call(this, node);
35162
35437
  var callee = node.callee;
35163
35438
  if (callee.type === "TSInstantiationExpression" && !((_callee_extra = callee.extra) === null || _callee_extra === void 0 ? void 0 : _callee_extra.parenthesized)) {
35164
- node.typeParameters = callee.typeParameters;
35439
+ {
35440
+ node.typeArguments = callee.typeArguments;
35441
+ }
35165
35442
  node.callee = callee.expression;
35166
35443
  }
35167
35444
  }
@@ -35947,17 +36224,19 @@ var typescript = function(superClass) {
35947
36224
  },
35948
36225
  {
35949
36226
  key: "parseMaybeDecoratorArguments",
35950
- value: function parseMaybeDecoratorArguments(expr) {
36227
+ value: function parseMaybeDecoratorArguments(expr, startLoc) {
35951
36228
  if (this.match(47) || this.match(51)) {
35952
36229
  var typeArguments = this.tsParseTypeArgumentsInExpression();
35953
36230
  if (this.match(10)) {
35954
- var call2 = _get(_get_prototype_of(TypeScriptParserMixin.prototype), "parseMaybeDecoratorArguments", this).call(this, expr);
35955
- call2.typeParameters = typeArguments;
36231
+ var call2 = _get(_get_prototype_of(TypeScriptParserMixin.prototype), "parseMaybeDecoratorArguments", this).call(this, expr, startLoc);
36232
+ {
36233
+ call2.typeArguments = typeArguments;
36234
+ }
35956
36235
  return call2;
35957
36236
  }
35958
36237
  this.unexpected(null, 10);
35959
36238
  }
35960
- return _get(_get_prototype_of(TypeScriptParserMixin.prototype), "parseMaybeDecoratorArguments", this).call(this, expr);
36239
+ return _get(_get_prototype_of(TypeScriptParserMixin.prototype), "parseMaybeDecoratorArguments", this).call(this, expr, startLoc);
35961
36240
  }
35962
36241
  },
35963
36242
  {
@@ -36085,7 +36364,11 @@ var typescript = function(superClass) {
36085
36364
  var typeArguments = this.tsTryParseAndCatch(function() {
36086
36365
  return _this.tsParseTypeArgumentsInExpression();
36087
36366
  });
36088
- if (typeArguments) node.typeParameters = typeArguments;
36367
+ if (typeArguments) {
36368
+ {
36369
+ node.typeArguments = typeArguments;
36370
+ }
36371
+ }
36089
36372
  }
36090
36373
  return _get(_get_prototype_of(TypeScriptParserMixin.prototype), "jsxParseOpeningElementAfterName", this).call(this, node);
36091
36374
  }
@@ -36160,8 +36443,9 @@ var typescript = function(superClass) {
36160
36443
  value: function parseMethod(node, isGenerator, isAsync, isConstructor, allowDirectSuper, type, inClassScope) {
36161
36444
  var method = _get(_get_prototype_of(TypeScriptParserMixin.prototype), "parseMethod", this).call(this, node, isGenerator, isAsync, isConstructor, allowDirectSuper, type, inClassScope);
36162
36445
  if (method.abstract) {
36163
- var hasBody = this.hasPlugin("estree") ? !!method.value.body : !!method.body;
36164
- if (hasBody) {
36446
+ var hasEstreePlugin = this.hasPlugin("estree");
36447
+ var methodFn = hasEstreePlugin ? method.value : method;
36448
+ if (methodFn.body) {
36165
36449
  var key = method.key;
36166
36450
  this.raise(TSErrors.AbstractMethodHasImplementation, method, {
36167
36451
  methodName: key.type === "Identifier" && !method.computed ? key.name : "[".concat(this.input.slice(this.offsetToSourcePos(key.start), this.offsetToSourcePos(key.end)), "]")
@@ -36774,71 +37058,6 @@ var mixinPlugins = {
36774
37058
  placeholders: placeholders
36775
37059
  };
36776
37060
  var mixinPluginNames = Object.keys(mixinPlugins);
36777
- function createDefaultOptions() {
36778
- return {
36779
- sourceType: "script",
36780
- sourceFilename: void 0,
36781
- startIndex: 0,
36782
- startColumn: 0,
36783
- startLine: 1,
36784
- allowAwaitOutsideFunction: false,
36785
- allowReturnOutsideFunction: false,
36786
- allowNewTargetOutsideFunction: false,
36787
- allowImportExportEverywhere: false,
36788
- allowSuperOutsideMethod: false,
36789
- allowUndeclaredExports: false,
36790
- plugins: [],
36791
- strictMode: null,
36792
- ranges: false,
36793
- tokens: false,
36794
- createImportExpressions: true,
36795
- createParenthesizedExpressions: false,
36796
- errorRecovery: false,
36797
- attachComment: true,
36798
- annexB: true
36799
- };
36800
- }
36801
- function getOptions(opts) {
36802
- var options = createDefaultOptions();
36803
- if (opts == null) {
36804
- return options;
36805
- }
36806
- if (opts.annexB != null && opts.annexB !== false) {
36807
- throw new Error("The `annexB` option can only be set to `false`.");
36808
- }
36809
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
36810
- try {
36811
- for(var _iterator = Object.keys(options)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
36812
- var key = _step.value;
36813
- if (opts[key] != null) options[key] = opts[key];
36814
- }
36815
- } catch (err) {
36816
- _didIteratorError = true;
36817
- _iteratorError = err;
36818
- } finally{
36819
- try {
36820
- if (!_iteratorNormalCompletion && _iterator.return != null) {
36821
- _iterator.return();
36822
- }
36823
- } finally{
36824
- if (_didIteratorError) {
36825
- throw _iteratorError;
36826
- }
36827
- }
36828
- }
36829
- if (options.startLine === 1) {
36830
- if (opts.startIndex == null && options.startColumn > 0) {
36831
- options.startIndex = options.startColumn;
36832
- } else if (opts.startColumn == null && options.startIndex > 0) {
36833
- options.startColumn = options.startIndex;
36834
- }
36835
- } else if (opts.startColumn == null || opts.startIndex == null) {
36836
- {
36837
- throw new Error("With a `startLine > 1` you must also specify `startIndex` and `startColumn`.");
36838
- }
36839
- }
36840
- return options;
36841
- }
36842
37061
  var ExpressionParser = /*#__PURE__*/ function(LValParser) {
36843
37062
  "use strict";
36844
37063
  _inherits(ExpressionParser, LValParser);
@@ -36891,7 +37110,7 @@ var ExpressionParser = /*#__PURE__*/ function(LValParser) {
36891
37110
  this.finalizeRemainingComments();
36892
37111
  expr.comments = this.comments;
36893
37112
  expr.errors = this.state.errors;
36894
- if (this.options.tokens) {
37113
+ if (this.optionFlags & 128) {
36895
37114
  expr.tokens = this.tokens;
36896
37115
  }
36897
37116
  return expr;
@@ -37513,7 +37732,7 @@ var ExpressionParser = /*#__PURE__*/ function(LValParser) {
37513
37732
  return this.parseImportMetaProperty(node);
37514
37733
  }
37515
37734
  if (this.match(10)) {
37516
- if (this.options.createImportExpressions) {
37735
+ if (this.optionFlags & 256) {
37517
37736
  return this.parseImportCall(node);
37518
37737
  } else {
37519
37738
  return this.finishNode(node, "Import");
@@ -37782,9 +38001,9 @@ var ExpressionParser = /*#__PURE__*/ function(LValParser) {
37782
38001
  value: function parseSuper() {
37783
38002
  var node = this.startNode();
37784
38003
  this.next();
37785
- if (this.match(10) && !this.scope.allowDirectSuper && !this.options.allowSuperOutsideMethod) {
38004
+ if (this.match(10) && !this.scope.allowDirectSuper && !(this.optionFlags & 16)) {
37786
38005
  this.raise(Errors.SuperNotAllowed, node);
37787
- } else if (!this.scope.allowSuper && !this.options.allowSuperOutsideMethod) {
38006
+ } else if (!this.scope.allowSuper && !(this.optionFlags & 16)) {
37788
38007
  this.raise(Errors.UnexpectedSuper, node);
37789
38008
  }
37790
38009
  if (!this.match(10) && !this.match(0) && !this.match(16)) {
@@ -37850,7 +38069,7 @@ var ExpressionParser = /*#__PURE__*/ function(LValParser) {
37850
38069
  } else if (this.isContextual(105) || this.isContextual(97)) {
37851
38070
  var isSource = this.isContextual(105);
37852
38071
  this.expectPlugin(isSource ? "sourcePhaseImports" : "deferredImportEvaluation");
37853
- if (!this.options.createImportExpressions) {
38072
+ if (!(this.optionFlags & 256)) {
37854
38073
  throw this.raise(Errors.DynamicImportPhaseRequiresImportExpressions, this.state.startLoc, {
37855
38074
  phase: this.state.value
37856
38075
  });
@@ -38003,7 +38222,7 @@ var ExpressionParser = /*#__PURE__*/ function(LValParser) {
38003
38222
  {
38004
38223
  key: "wrapParenthesis",
38005
38224
  value: function wrapParenthesis(startLoc, expression2) {
38006
- if (!this.options.createParenthesizedExpressions) {
38225
+ if (!(this.optionFlags & 512)) {
38007
38226
  this.addExtra(expression2, "parenthesized", true);
38008
38227
  this.addExtra(expression2, "parenStart", startLoc.index);
38009
38228
  this.takeSurroundingComments(expression2, startLoc.index, this.state.lastTokEndLoc.index);
@@ -38043,7 +38262,7 @@ var ExpressionParser = /*#__PURE__*/ function(LValParser) {
38043
38262
  var meta = this.createIdentifier(this.startNodeAtNode(node), "new");
38044
38263
  this.next();
38045
38264
  var metaProp = this.parseMetaProperty(node, meta, "target");
38046
- if (!this.scope.inNonArrowFunction && !this.scope.inClass && !this.options.allowNewTargetOutsideFunction) {
38265
+ if (!this.scope.inNonArrowFunction && !this.scope.inClass && !(this.optionFlags & 4)) {
38047
38266
  this.raise(Errors.UnexpectedNewTarget, metaProp);
38048
38267
  }
38049
38268
  return metaProp;
@@ -38659,7 +38878,7 @@ var ExpressionParser = /*#__PURE__*/ function(LValParser) {
38659
38878
  {
38660
38879
  key: "recordAwaitIfAllowed",
38661
38880
  value: function recordAwaitIfAllowed() {
38662
- var isAwaitAllowed = this.prodParam.hasAwait || this.options.allowAwaitOutsideFunction && !this.scope.inFunction;
38881
+ var isAwaitAllowed = this.prodParam.hasAwait || this.optionFlags & 1 && !this.scope.inFunction;
38663
38882
  if (isAwaitAllowed && !this.scope.inFunction) {
38664
38883
  this.state.hasTopLevelAwait = true;
38665
38884
  }
@@ -38674,7 +38893,7 @@ var ExpressionParser = /*#__PURE__*/ function(LValParser) {
38674
38893
  if (this.eat(55)) {
38675
38894
  this.raise(Errors.ObsoleteAwaitStar, node);
38676
38895
  }
38677
- if (!this.scope.inFunction && !this.options.allowAwaitOutsideFunction) {
38896
+ if (!this.scope.inFunction && !(this.optionFlags & 1)) {
38678
38897
  if (this.isAmbiguousAwait()) {
38679
38898
  this.ambiguousScriptDifferentAst = true;
38680
38899
  } else {
@@ -38971,7 +39190,7 @@ var StatementParser = /*#__PURE__*/ function(ExpressionParser) {
38971
39190
  value: function parseTopLevel(file2, program3) {
38972
39191
  file2.program = this.parseProgram(program3);
38973
39192
  file2.comments = this.comments;
38974
- if (this.options.tokens) {
39193
+ if (this.optionFlags & 128) {
38975
39194
  file2.tokens = babel7CompatTokens(this.tokens, this.input, this.startIndex);
38976
39195
  }
38977
39196
  return this.finishNode(file2, "File");
@@ -38985,7 +39204,7 @@ var StatementParser = /*#__PURE__*/ function(ExpressionParser) {
38985
39204
  program3.interpreter = this.parseInterpreterDirective();
38986
39205
  this.parseBlockBody(program3, true, true, end);
38987
39206
  if (this.inModule) {
38988
- if (!this.options.allowUndeclaredExports && this.scope.undefinedExports.size > 0) {
39207
+ if (!(this.optionFlags & 32) && this.scope.undefinedExports.size > 0) {
38989
39208
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
38990
39209
  try {
38991
39210
  for(var _iterator = Array.from(this.scope.undefinedExports)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
@@ -39271,7 +39490,7 @@ var StatementParser = /*#__PURE__*/ function(ExpressionParser) {
39271
39490
  }
39272
39491
  case 82:
39273
39492
  {
39274
- if (!this.options.allowImportExportEverywhere && !topLevel) {
39493
+ if (!(this.optionFlags & 8) && !topLevel) {
39275
39494
  this.raise(Errors.UnexpectedImportExport, this.state.startLoc);
39276
39495
  }
39277
39496
  this.next();
@@ -39313,7 +39532,7 @@ var StatementParser = /*#__PURE__*/ function(ExpressionParser) {
39313
39532
  {
39314
39533
  key: "assertModuleNodeAllowed",
39315
39534
  value: function assertModuleNodeAllowed(node) {
39316
- if (!this.options.allowImportExportEverywhere && !this.inModule) {
39535
+ if (!(this.optionFlags & 8) && !this.inModule) {
39317
39536
  this.raise(Errors.ImportOutsideModule, node);
39318
39537
  }
39319
39538
  }
@@ -39329,12 +39548,13 @@ var StatementParser = /*#__PURE__*/ function(ExpressionParser) {
39329
39548
  key: "maybeTakeDecorators",
39330
39549
  value: function maybeTakeDecorators(maybeDecorators, classNode, exportNode) {
39331
39550
  if (maybeDecorators) {
39332
- if (classNode.decorators && classNode.decorators.length > 0) {
39333
- var _classNode_decorators;
39551
+ var _classNode_decorators;
39552
+ if ((_classNode_decorators = classNode.decorators) === null || _classNode_decorators === void 0 ? void 0 : _classNode_decorators.length) {
39553
+ var _classNode_decorators1;
39334
39554
  if (typeof this.getPluginOption("decorators", "decoratorsBeforeExport") !== "boolean") {
39335
39555
  this.raise(Errors.DecoratorsBeforeAfterExport, classNode.decorators[0]);
39336
39556
  }
39337
- (_classNode_decorators = classNode.decorators).unshift.apply(_classNode_decorators, _to_consumable_array(maybeDecorators));
39557
+ (_classNode_decorators1 = classNode.decorators).unshift.apply(_classNode_decorators1, _to_consumable_array(maybeDecorators));
39338
39558
  } else {
39339
39559
  classNode.decorators = maybeDecorators;
39340
39560
  }
@@ -39389,7 +39609,7 @@ var StatementParser = /*#__PURE__*/ function(ExpressionParser) {
39389
39609
  this.expect(11);
39390
39610
  expr = this.wrapParenthesis(startLoc2, expr);
39391
39611
  var paramsStartLoc = this.state.startLoc;
39392
- node.expression = this.parseMaybeDecoratorArguments(expr);
39612
+ node.expression = this.parseMaybeDecoratorArguments(expr, startLoc2);
39393
39613
  if (this.getPluginOption("decorators", "allowCallParenthesized") === false && node.expression !== expr) {
39394
39614
  this.raise(Errors.DecoratorArgumentsOutsideParentheses, paramsStartLoc);
39395
39615
  }
@@ -39407,7 +39627,7 @@ var StatementParser = /*#__PURE__*/ function(ExpressionParser) {
39407
39627
  node2.computed = false;
39408
39628
  expr = this.finishNode(node2, "MemberExpression");
39409
39629
  }
39410
- node.expression = this.parseMaybeDecoratorArguments(expr);
39630
+ node.expression = this.parseMaybeDecoratorArguments(expr, startLoc);
39411
39631
  }
39412
39632
  } else {
39413
39633
  node.expression = this.parseExprSubscripts();
@@ -39417,9 +39637,9 @@ var StatementParser = /*#__PURE__*/ function(ExpressionParser) {
39417
39637
  },
39418
39638
  {
39419
39639
  key: "parseMaybeDecoratorArguments",
39420
- value: function parseMaybeDecoratorArguments(expr) {
39640
+ value: function parseMaybeDecoratorArguments(expr, startLoc) {
39421
39641
  if (this.eat(10)) {
39422
- var node = this.startNodeAtNode(expr);
39642
+ var node = this.startNodeAt(startLoc);
39423
39643
  node.callee = expr;
39424
39644
  node.arguments = this.parseCallExpressionArguments(11);
39425
39645
  this.toReferencedList(node.arguments);
@@ -39596,7 +39816,7 @@ var StatementParser = /*#__PURE__*/ function(ExpressionParser) {
39596
39816
  {
39597
39817
  key: "parseReturnStatement",
39598
39818
  value: function parseReturnStatement(node) {
39599
- if (!this.prodParam.hasReturn && !this.options.allowReturnOutsideFunction) {
39819
+ if (!this.prodParam.hasReturn && !(this.optionFlags & 2)) {
39600
39820
  this.raise(Errors.IllegalReturn, this.state.startLoc);
39601
39821
  }
39602
39822
  this.next();
@@ -41225,6 +41445,47 @@ var Parser = /*#__PURE__*/ function(StatementParser) {
41225
41445
  _this.plugins = pluginsMap;
41226
41446
  _this.filename = options.sourceFilename;
41227
41447
  _this.startIndex = options.startIndex;
41448
+ var optionFlags = 0;
41449
+ if (options.allowAwaitOutsideFunction) {
41450
+ optionFlags |= 1;
41451
+ }
41452
+ if (options.allowReturnOutsideFunction) {
41453
+ optionFlags |= 2;
41454
+ }
41455
+ if (options.allowImportExportEverywhere) {
41456
+ optionFlags |= 8;
41457
+ }
41458
+ if (options.allowSuperOutsideMethod) {
41459
+ optionFlags |= 16;
41460
+ }
41461
+ if (options.allowUndeclaredExports) {
41462
+ optionFlags |= 32;
41463
+ }
41464
+ if (options.allowNewTargetOutsideFunction) {
41465
+ optionFlags |= 4;
41466
+ }
41467
+ if (options.ranges) {
41468
+ optionFlags |= 64;
41469
+ }
41470
+ if (options.tokens) {
41471
+ optionFlags |= 128;
41472
+ }
41473
+ if (options.createImportExpressions) {
41474
+ optionFlags |= 256;
41475
+ }
41476
+ if (options.createParenthesizedExpressions) {
41477
+ optionFlags |= 512;
41478
+ }
41479
+ if (options.errorRecovery) {
41480
+ optionFlags |= 1024;
41481
+ }
41482
+ if (options.attachComment) {
41483
+ optionFlags |= 2048;
41484
+ }
41485
+ if (options.annexB) {
41486
+ optionFlags |= 4096;
41487
+ }
41488
+ _this.optionFlags = optionFlags;
41228
41489
  return _this;
41229
41490
  }
41230
41491
  _create_class(Parser, [
@@ -43865,7 +44126,7 @@ function TSInferType$1(node, parent) {
43865
44126
  }
43866
44127
  function TSInstantiationExpression$1(node, parent) {
43867
44128
  var parentType = parent.type;
43868
- return (parentType === "CallExpression" || parentType === "OptionalCallExpression" || parentType === "NewExpression" || parentType === "TSInstantiationExpression") && !!parent.typeParameters;
44129
+ return (parentType === "CallExpression" || parentType === "OptionalCallExpression" || parentType === "NewExpression" || parentType === "TSInstantiationExpression") && !!parent.typeArguments;
43869
44130
  }
43870
44131
  function BinaryExpression(node, parent, tokenContext, inForStatementInit) {
43871
44132
  return node.operator === "in" && inForStatementInit;
@@ -44477,7 +44738,9 @@ function childrenIterator(node) {
44477
44738
  }
44478
44739
  function TaggedTemplateExpression(node) {
44479
44740
  this.print(node.tag);
44480
- this.print(node.typeParameters);
44741
+ {
44742
+ this.print(node.typeArguments);
44743
+ }
44481
44744
  this.print(node.quasi);
44482
44745
  }
44483
44746
  function TemplateElement() {
@@ -44553,7 +44816,6 @@ function NewExpression(node, parent) {
44553
44816
  return;
44554
44817
  }
44555
44818
  this.print(node.typeArguments);
44556
- this.print(node.typeParameters);
44557
44819
  if (node.optional) {
44558
44820
  this.token("?.");
44559
44821
  }
@@ -44612,7 +44874,6 @@ function OptionalMemberExpression(node) {
44612
44874
  }
44613
44875
  function OptionalCallExpression(node) {
44614
44876
  this.print(node.callee);
44615
- this.print(node.typeParameters);
44616
44877
  if (node.optional) {
44617
44878
  this.token("?.");
44618
44879
  }
@@ -44626,7 +44887,6 @@ function OptionalCallExpression(node) {
44626
44887
  function CallExpression(node) {
44627
44888
  this.print(node.callee);
44628
44889
  this.print(node.typeArguments);
44629
- this.print(node.typeParameters);
44630
44890
  this.tokenChar(40);
44631
44891
  var exit = this.enterDelimited();
44632
44892
  this.printList(node.arguments, this.shouldPrintTrailingComma(")"));
@@ -45769,14 +46029,6 @@ function BigIntLiteral(node) {
45769
46029
  }
45770
46030
  this.word(node.value + "n");
45771
46031
  }
45772
- function DecimalLiteral(node) {
45773
- var raw = this.getPossibleRaw(node);
45774
- if (!this.format.minified && raw !== void 0) {
45775
- this.word(raw);
45776
- return;
45777
- }
45778
- this.word(node.value + "m");
45779
- }
45780
46032
  var validTopicTokenSet = /* @__PURE__ */ new Set([
45781
46033
  "^^",
45782
46034
  "@@",
@@ -46532,7 +46784,9 @@ function spaceSeparator() {
46532
46784
  function JSXOpeningElement(node) {
46533
46785
  this.tokenChar(60);
46534
46786
  this.print(node.name);
46535
- this.print(node.typeParameters);
46787
+ {
46788
+ this.print(node.typeArguments);
46789
+ }
46536
46790
  if (node.attributes.length > 0) {
46537
46791
  this.space();
46538
46792
  this.printJoin(node.attributes, void 0, void 0, spaceSeparator);
@@ -46810,8 +47064,9 @@ function TSTypeQuery(node) {
46810
47064
  this.word("typeof");
46811
47065
  this.space();
46812
47066
  this.print(node.exprName);
46813
- if (node.typeParameters) {
46814
- this.print(node.typeParameters);
47067
+ var typeArguments = node.typeArguments;
47068
+ if (typeArguments) {
47069
+ this.print(typeArguments);
46815
47070
  }
46816
47071
  }
46817
47072
  function TSTypeLiteral(node) {
@@ -46949,7 +47204,7 @@ function TSLiteralType(node) {
46949
47204
  }
46950
47205
  function TSClassImplements(node) {
46951
47206
  this.print(node.expression);
46952
- this.print(node.typeParameters);
47207
+ this.print(node.typeArguments);
46953
47208
  }
46954
47209
  function TSInterfaceDeclaration(node) {
46955
47210
  var declare = node.declare, id = node.id, typeParameters = node.typeParameters, extendz = node.extends, body = node.body;
@@ -47010,11 +47265,12 @@ function TSTypeAssertion(node) {
47010
47265
  }
47011
47266
  function TSInstantiationExpression(node) {
47012
47267
  this.print(node.expression);
47013
- this.print(node.typeParameters);
47268
+ {
47269
+ this.print(node.typeArguments);
47270
+ }
47014
47271
  }
47015
47272
  function TSEnumDeclaration(node) {
47016
- var _this = this;
47017
- var declare = node.declare, isConst = node.const, id = node.id, members = node.members;
47273
+ var declare = node.declare, isConst = node.const, id = node.id;
47018
47274
  if (declare) {
47019
47275
  this.word("declare");
47020
47276
  this.space();
@@ -47027,9 +47283,15 @@ function TSEnumDeclaration(node) {
47027
47283
  this.space();
47028
47284
  this.print(id);
47029
47285
  this.space();
47286
+ {
47287
+ this.print(node.body);
47288
+ }
47289
+ }
47290
+ function TSEnumBody(node) {
47291
+ var _this = this;
47030
47292
  printBraced(this, node, function() {
47031
47293
  var _this_shouldPrintTrailingComma;
47032
- return _this.printList(members, (_this_shouldPrintTrailingComma = _this.shouldPrintTrailingComma("}")) !== null && _this_shouldPrintTrailingComma !== void 0 ? _this_shouldPrintTrailingComma : true, true, true);
47294
+ return _this.printList(node.members, (_this_shouldPrintTrailingComma = _this.shouldPrintTrailingComma("}")) !== null && _this_shouldPrintTrailingComma !== void 0 ? _this_shouldPrintTrailingComma : false, true, true);
47033
47295
  });
47034
47296
  }
47035
47297
  function TSEnumMember(node) {
@@ -47069,17 +47331,22 @@ function TSModuleBlock(node) {
47069
47331
  });
47070
47332
  }
47071
47333
  function TSImportType(node) {
47072
- var argument = node.argument, qualifier = node.qualifier, typeParameters = node.typeParameters;
47334
+ var argument = node.argument, qualifier = node.qualifier, options = node.options;
47073
47335
  this.word("import");
47074
47336
  this.tokenChar(40);
47075
47337
  this.print(argument);
47338
+ if (options) {
47339
+ this.tokenChar(44);
47340
+ this.print(options);
47341
+ }
47076
47342
  this.tokenChar(41);
47077
47343
  if (qualifier) {
47078
47344
  this.tokenChar(46);
47079
47345
  this.print(qualifier);
47080
47346
  }
47081
- if (typeParameters) {
47082
- this.print(typeParameters);
47347
+ var typeArguments = node.typeArguments;
47348
+ if (typeArguments) {
47349
+ this.print(typeArguments);
47083
47350
  }
47084
47351
  }
47085
47352
  function TSImportEqualsDeclaration(node) {
@@ -47242,7 +47509,6 @@ var generatorFunctions = /* @__PURE__ */ Object.freeze({
47242
47509
  ConditionalExpression: ConditionalExpression,
47243
47510
  ContinueStatement: ContinueStatement,
47244
47511
  DebuggerStatement: DebuggerStatement,
47245
- DecimalLiteral: DecimalLiteral,
47246
47512
  DeclareClass: DeclareClass,
47247
47513
  DeclareExportAllDeclaration: DeclareExportAllDeclaration,
47248
47514
  DeclareExportDeclaration: DeclareExportDeclaration,
@@ -47379,10 +47645,10 @@ var generatorFunctions = /* @__PURE__ */ Object.freeze({
47379
47645
  TSConstructorType: TSConstructorType,
47380
47646
  TSDeclareFunction: TSDeclareFunction,
47381
47647
  TSDeclareMethod: TSDeclareMethod,
47648
+ TSEnumBody: TSEnumBody,
47382
47649
  TSEnumDeclaration: TSEnumDeclaration,
47383
47650
  TSEnumMember: TSEnumMember,
47384
47651
  TSExportAssignment: TSExportAssignment,
47385
- TSExpressionWithTypeArguments: TSClassImplements,
47386
47652
  TSExternalModuleReference: TSExternalModuleReference,
47387
47653
  TSFunctionType: TSFunctionType,
47388
47654
  TSImportEqualsDeclaration: TSImportEqualsDeclaration,
@@ -47480,7 +47746,7 @@ var generatorFunctions = /* @__PURE__ */ Object.freeze({
47480
47746
  tsPrintPropertyOrMethodName: tsPrintPropertyOrMethodName,
47481
47747
  tsPrintSignatureDeclarationBase: tsPrintSignatureDeclarationBase
47482
47748
  });
47483
- var isExpression2 = lib_exports.isExpression, isFunction3 = lib_exports.isFunction, isStatement3 = lib_exports.isStatement, isClassBody2 = lib_exports.isClassBody, isTSInterfaceBody2 = lib_exports.isTSInterfaceBody, isTSEnumDeclaration2 = lib_exports.isTSEnumDeclaration;
47749
+ var isExpression2 = lib_exports.isExpression, isFunction3 = lib_exports.isFunction, isStatement3 = lib_exports.isStatement, isClassBody2 = lib_exports.isClassBody, isTSInterfaceBody2 = lib_exports.isTSInterfaceBody, isTSEnumMember2 = lib_exports.isTSEnumMember;
47484
47750
  var SCIENTIFIC_NOTATION = /e/i;
47485
47751
  var ZERO_DECIMAL_INTEGER = /\.0+$/;
47486
47752
  var HAS_NEWLINE = /[\n\r\u2028\u2029]/;
@@ -48366,7 +48632,7 @@ var Printer = /*#__PURE__*/ function() {
48366
48632
  }
48367
48633
  if (len === 1) {
48368
48634
  var singleLine = comment.loc ? comment.loc.start.line === comment.loc.end.line : !HAS_NEWLINE.test(comment.value);
48369
- var shouldSkipNewline = singleLine && !isStatement3(node) && !isClassBody2(parent) && !isTSInterfaceBody2(parent) && !isTSEnumDeclaration2(parent);
48635
+ var shouldSkipNewline = singleLine && !isStatement3(node) && !isClassBody2(parent) && !isTSInterfaceBody2(parent) && !isTSEnumMember2(node);
48370
48636
  if (type === 0) {
48371
48637
  this._printComment(comment, shouldSkipNewline && node.type !== "ObjectExpression" || singleLine && isFunction3(parent, {
48372
48638
  body: node
@@ -48887,7 +49153,7 @@ function verify$1(visitor) {
48887
49153
  }
48888
49154
  if (shouldIgnoreKey(nodeType)) continue;
48889
49155
  if (!TYPES2.includes(nodeType)) {
48890
- throw new Error("You gave us a visitor for the node type ".concat(nodeType, " but it's not a valid type in @babel/traverse ", "8.0.0-alpha.14"));
49156
+ throw new Error("You gave us a visitor for the node type ".concat(nodeType, " but it's not a valid type in @babel/traverse ", "8.0.0-alpha.15"));
48891
49157
  }
48892
49158
  var visitors2 = visitor[nodeType];
48893
49159
  if ((typeof visitors2 === "undefined" ? "undefined" : _type_of(visitors2)) === "object") {