@putout/babel 5.3.4 → 5.3.6

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
@@ -414,6 +414,7 @@ __export(lib_exports, {
414
414
  BOOLEAN_UNARY_OPERATORS: () => BOOLEAN_UNARY_OPERATORS,
415
415
  BUILDER_KEYS: () => BUILDER_KEYS,
416
416
  BigIntLiteral: () => BigIntLiteral,
417
+ BigIntLiteralTypeAnnotation: () => BigIntLiteralTypeAnnotation,
417
418
  BinaryExpression: () => BinaryExpression,
418
419
  BindExpression: () => BindExpression,
419
420
  BlockStatement: () => BlockStatement,
@@ -743,6 +744,7 @@ __export(lib_exports, {
743
744
  assertAssignmentPattern: () => assertAssignmentPattern,
744
745
  assertAwaitExpression: () => assertAwaitExpression,
745
746
  assertBigIntLiteral: () => assertBigIntLiteral,
747
+ assertBigIntLiteralTypeAnnotation: () => assertBigIntLiteralTypeAnnotation,
746
748
  assertBinary: () => assertBinary,
747
749
  assertBinaryExpression: () => assertBinaryExpression,
748
750
  assertBindExpression: () => assertBindExpression,
@@ -1039,6 +1041,7 @@ __export(lib_exports, {
1039
1041
  assignmentPattern: () => assignmentPattern,
1040
1042
  awaitExpression: () => awaitExpression,
1041
1043
  bigIntLiteral: () => bigIntLiteral,
1044
+ bigIntLiteralTypeAnnotation: () => bigIntLiteralTypeAnnotation,
1042
1045
  binaryExpression: () => binaryExpression,
1043
1046
  bindExpression: () => bindExpression,
1044
1047
  blockStatement: () => blockStatement,
@@ -1153,6 +1156,7 @@ __export(lib_exports, {
1153
1156
  isAssignmentPattern: () => isAssignmentPattern,
1154
1157
  isAwaitExpression: () => isAwaitExpression,
1155
1158
  isBigIntLiteral: () => isBigIntLiteral,
1159
+ isBigIntLiteralTypeAnnotation: () => isBigIntLiteralTypeAnnotation,
1156
1160
  isBinary: () => isBinary,
1157
1161
  isBinaryExpression: () => isBinaryExpression,
1158
1162
  isBindExpression: () => isBindExpression,
@@ -3832,16 +3836,6 @@ function isImportSpecifier(node, opts) {
3832
3836
  return opts == null || shallowEqual(node, opts);
3833
3837
  }
3834
3838
 
3835
- function isImportExpression(node, opts) {
3836
- if (!node)
3837
- return false;
3838
-
3839
- if (node.type !== 'ImportExpression')
3840
- return false;
3841
-
3842
- return opts == null || shallowEqual(node, opts);
3843
- }
3844
-
3845
3839
  function isMetaProperty(node, opts) {
3846
3840
  if (!node)
3847
3841
  return false;
@@ -3942,6 +3936,16 @@ function isAwaitExpression(node, opts) {
3942
3936
  return opts == null || shallowEqual(node, opts);
3943
3937
  }
3944
3938
 
3939
+ function isImportExpression(node, opts) {
3940
+ if (!node)
3941
+ return false;
3942
+
3943
+ if (node.type !== 'ImportExpression')
3944
+ return false;
3945
+
3946
+ return opts == null || shallowEqual(node, opts);
3947
+ }
3948
+
3945
3949
  function isImport(node, opts) {
3946
3950
  if (!node)
3947
3951
  return false;
@@ -4352,6 +4356,16 @@ function isNumberLiteralTypeAnnotation(node, opts) {
4352
4356
  return opts == null || shallowEqual(node, opts);
4353
4357
  }
4354
4358
 
4359
+ function isBigIntLiteralTypeAnnotation(node, opts) {
4360
+ if (!node)
4361
+ return false;
4362
+
4363
+ if (node.type !== 'BigIntLiteralTypeAnnotation')
4364
+ return false;
4365
+
4366
+ return opts == null || shallowEqual(node, opts);
4367
+ }
4368
+
4355
4369
  function isNumberTypeAnnotation(node, opts) {
4356
4370
  if (!node)
4357
4371
  return false;
@@ -5713,7 +5727,6 @@ function isStandardized(node, opts) {
5713
5727
  case 'ImportDefaultSpecifier':
5714
5728
  case 'ImportNamespaceSpecifier':
5715
5729
  case 'ImportSpecifier':
5716
- case 'ImportExpression':
5717
5730
  case 'MetaProperty':
5718
5731
  case 'ClassMethod':
5719
5732
  case 'ObjectPattern':
@@ -5724,6 +5737,7 @@ function isStandardized(node, opts) {
5724
5737
  case 'TemplateLiteral':
5725
5738
  case 'YieldExpression':
5726
5739
  case 'AwaitExpression':
5740
+ case 'ImportExpression':
5727
5741
  case 'Import':
5728
5742
  case 'BigIntLiteral':
5729
5743
  case 'ExportNamespaceSpecifier':
@@ -5787,13 +5801,12 @@ function isExpression(node, opts) {
5787
5801
  case 'UpdateExpression':
5788
5802
  case 'ArrowFunctionExpression':
5789
5803
  case 'ClassExpression':
5790
- case 'ImportExpression':
5791
5804
  case 'MetaProperty':
5792
5805
  case 'TaggedTemplateExpression':
5793
5806
  case 'TemplateLiteral':
5794
5807
  case 'YieldExpression':
5795
5808
  case 'AwaitExpression':
5796
- case 'Import':
5809
+ case 'ImportExpression':
5797
5810
  case 'BigIntLiteral':
5798
5811
  case 'OptionalMemberExpression':
5799
5812
  case 'OptionalCallExpression':
@@ -7646,6 +7659,29 @@ var classMethodOrPropertyUnionShapeCommon = (allowPrivateName = false) => ({
7646
7659
  },
7647
7660
  });
7648
7661
 
7662
+ var memberExpressionUnionShapeCommon = {
7663
+ unionShape: {
7664
+ discriminator: 'computed',
7665
+ shapes: [{
7666
+ name: 'computed',
7667
+ value: [true],
7668
+ properties: {
7669
+ property: {
7670
+ validate: assertNodeType('Expression'),
7671
+ },
7672
+ },
7673
+ }, {
7674
+ name: 'nonComputed',
7675
+ value: [false],
7676
+ properties: {
7677
+ property: {
7678
+ validate: assertNodeType('Identifier', 'PrivateName'),
7679
+ },
7680
+ },
7681
+ }],
7682
+ },
7683
+ };
7684
+
7649
7685
  var defineType$4 = defineAliasedType('Standardized');
7650
7686
 
7651
7687
  defineType$4('ArrayExpression', {
@@ -7716,6 +7752,26 @@ defineType$4('BinaryExpression', {
7716
7752
  validate: assertNodeType('Expression'),
7717
7753
  },
7718
7754
  },
7755
+ unionShape: {
7756
+ discriminator: 'operator',
7757
+ shapes: [{
7758
+ name: 'in',
7759
+ value: ['in'],
7760
+ properties: {
7761
+ left: {
7762
+ validate: assertNodeType('Expression', 'PrivateName'),
7763
+ },
7764
+ },
7765
+ }, {
7766
+ name: 'notIn',
7767
+ value: BINARY_OPERATORS.filter((op) => op !== 'in'),
7768
+ properties: {
7769
+ left: {
7770
+ validate: assertNodeType('Expression'),
7771
+ },
7772
+ },
7773
+ }],
7774
+ },
7719
7775
  visitor: ['left', 'right'],
7720
7776
  aliases: ['Binary', 'Expression'],
7721
7777
  });
@@ -7784,7 +7840,7 @@ defineType$4('CallExpression', {
7784
7840
  aliases: ['Expression'],
7785
7841
  fields: {
7786
7842
  callee: {
7787
- validate: assertNodeType('Expression', 'Super', 'V8IntrinsicIdentifier'),
7843
+ validate: assertNodeType('Expression', 'Super', 'Import', 'V8IntrinsicIdentifier'),
7788
7844
  },
7789
7845
  arguments: validateArrayOfType('Expression', 'SpreadElement', 'ArgumentPlaceholder'),
7790
7846
  typeArguments: {
@@ -8010,7 +8066,7 @@ defineType$4('FunctionDeclaration', {
8010
8066
  validate: assertNodeType('BlockStatement'),
8011
8067
  },
8012
8068
  predicate: {
8013
- validate: assertNodeType('DeclaredPredicate', 'InferredPredicate'),
8069
+ validate: assertNodeType('FlowPredicate'),
8014
8070
  optional: true,
8015
8071
  },
8016
8072
  },
@@ -8054,7 +8110,7 @@ defineType$4('FunctionExpression', {
8054
8110
  validate: assertNodeType('BlockStatement'),
8055
8111
  },
8056
8112
  predicate: {
8057
- validate: assertNodeType('DeclaredPredicate', 'InferredPredicate'),
8113
+ validate: assertNodeType('FlowPredicate'),
8058
8114
  optional: true,
8059
8115
  },
8060
8116
  },
@@ -8282,7 +8338,6 @@ defineType$4('MemberExpression', {
8282
8338
  'object',
8283
8339
  'property',
8284
8340
  'computed',
8285
- ...[],
8286
8341
  ],
8287
8342
  visitor: ['object', 'property'],
8288
8343
  aliases: [
@@ -8290,26 +8345,7 @@ defineType$4('MemberExpression', {
8290
8345
  'LVal',
8291
8346
  'PatternLike',
8292
8347
  ],
8293
- unionShape: {
8294
- discriminator: 'computed',
8295
- shapes: [{
8296
- name: 'computed',
8297
- value: [true],
8298
- properties: {
8299
- property: {
8300
- validate: assertNodeType('Expression'),
8301
- },
8302
- },
8303
- }, {
8304
- name: 'nonComputed',
8305
- value: [false],
8306
- properties: {
8307
- property: {
8308
- validate: assertNodeType('Identifier', 'PrivateName'),
8309
- },
8310
- },
8311
- }],
8312
- },
8348
+ ...memberExpressionUnionShapeCommon,
8313
8349
  fields: {
8314
8350
  object: {
8315
8351
  validate: assertNodeType('Expression', 'Super'),
@@ -8447,28 +8483,8 @@ defineType$4('ObjectProperty', {
8447
8483
  'value',
8448
8484
  'computed',
8449
8485
  'shorthand',
8450
- ...[],
8451
8486
  ],
8452
- unionShape: {
8453
- discriminator: 'computed',
8454
- shapes: [{
8455
- name: 'computed',
8456
- value: [true],
8457
- properties: {
8458
- key: {
8459
- validate: assertNodeType('Expression'),
8460
- },
8461
- },
8462
- }, {
8463
- name: 'nonComputed',
8464
- value: [false],
8465
- properties: {
8466
- key: {
8467
- validate: assertNodeType('Identifier', 'StringLiteral', 'NumericLiteral', 'BigIntLiteral', 'PrivateName'),
8468
- },
8469
- },
8470
- }],
8471
- },
8487
+ ...classMethodOrPropertyUnionShapeCommon(true),
8472
8488
  fields: {
8473
8489
  computed: {
8474
8490
  default: false,
@@ -8876,7 +8892,7 @@ defineType$4('ArrowFunctionExpression', {
8876
8892
  validate: assertNodeType('BlockStatement', 'Expression'),
8877
8893
  },
8878
8894
  predicate: {
8879
- validate: assertNodeType('DeclaredPredicate', 'InferredPredicate'),
8895
+ validate: assertNodeType('FlowPredicate'),
8880
8896
  optional: true,
8881
8897
  },
8882
8898
  },
@@ -9034,7 +9050,7 @@ defineType$4('ExportDefaultDeclaration', {
9034
9050
  'ExportDeclaration',
9035
9051
  ],
9036
9052
  fields: {
9037
- declaration: validateType('TSDeclareFunction', 'FunctionDeclaration', 'ClassDeclaration', 'Expression'),
9053
+ declaration: validateType('FunctionDeclaration', 'ClassDeclaration', 'Expression', 'TSDeclareFunction', 'TSInterfaceDeclaration', 'EnumDeclaration'),
9038
9054
  exportKind: validateOptional(assertOneOf('value')),
9039
9055
  },
9040
9056
  });
@@ -9069,7 +9085,21 @@ defineType$4('ExportNamedDeclaration', {
9069
9085
  throw new TypeError('Cannot export a declaration from a source');
9070
9086
  }
9071
9087
  }, {
9072
- oneOfNodeTypes: ['Declaration'],
9088
+ oneOfNodeTypes: [
9089
+ 'VariableDeclaration',
9090
+ 'FunctionDeclaration',
9091
+ 'ClassDeclaration',
9092
+ 'TSDeclareFunction',
9093
+ 'TSEnumDeclaration',
9094
+ 'TSImportEqualsDeclaration',
9095
+ 'TSInterfaceDeclaration',
9096
+ 'TSModuleDeclaration',
9097
+ 'TSTypeAliasDeclaration',
9098
+ 'EnumDeclaration',
9099
+ 'InterfaceDeclaration',
9100
+ 'OpaqueType',
9101
+ 'TypeAlias',
9102
+ ],
9073
9103
  })),
9074
9104
  },
9075
9105
  ...importAttributes,
@@ -9243,23 +9273,6 @@ defineType$4('ImportSpecifier', {
9243
9273
  },
9244
9274
  },
9245
9275
  });
9246
- defineType$4('ImportExpression', {
9247
- visitor: ['source', 'options'],
9248
- aliases: ['Expression'],
9249
- fields: {
9250
- phase: {
9251
- default: null,
9252
- validate: assertOneOf('source', 'defer'),
9253
- },
9254
- source: {
9255
- validate: assertNodeType('Expression'),
9256
- },
9257
- options: {
9258
- validate: assertNodeType('Expression'),
9259
- optional: true,
9260
- },
9261
- },
9262
- });
9263
9276
  defineType$4('MetaProperty', {
9264
9277
  visitor: ['meta', 'property'],
9265
9278
  aliases: ['Expression'],
@@ -9415,7 +9428,7 @@ defineType$4('SpreadElement', {
9415
9428
  },
9416
9429
  },
9417
9430
  });
9418
- defineType$4('Super', void 0);
9431
+ defineType$4('Super');
9419
9432
  defineType$4('TaggedTemplateExpression', {
9420
9433
  visitor: [
9421
9434
  'tag',
@@ -9528,9 +9541,24 @@ defineType$4('AwaitExpression', {
9528
9541
  },
9529
9542
  },
9530
9543
  });
9531
- defineType$4('Import', {
9544
+ defineType$4('ImportExpression', {
9545
+ visitor: ['source', 'options'],
9532
9546
  aliases: ['Expression'],
9547
+ fields: {
9548
+ phase: {
9549
+ default: null,
9550
+ validate: assertOneOf('source', 'defer'),
9551
+ },
9552
+ source: {
9553
+ validate: assertNodeType('Expression'),
9554
+ },
9555
+ options: {
9556
+ validate: assertNodeType('Expression'),
9557
+ optional: true,
9558
+ },
9559
+ },
9533
9560
  });
9561
+ defineType$4('Import');
9534
9562
  defineType$4('BigIntLiteral', {
9535
9563
  builder: ['value'],
9536
9564
  fields: {
@@ -9550,7 +9578,7 @@ defineType$4('ExportNamespaceSpecifier', {
9550
9578
  aliases: ['ModuleSpecifier'],
9551
9579
  fields: {
9552
9580
  exported: {
9553
- validate: assertNodeType('Identifier'),
9581
+ validate: assertNodeType('Identifier', 'StringLiteral'),
9554
9582
  },
9555
9583
  },
9556
9584
  });
@@ -9563,19 +9591,20 @@ defineType$4('OptionalMemberExpression', {
9563
9591
  ],
9564
9592
  visitor: ['object', 'property'],
9565
9593
  aliases: ['Expression'],
9594
+ ...memberExpressionUnionShapeCommon,
9566
9595
  fields: {
9567
9596
  object: {
9568
9597
  validate: assertNodeType('Expression'),
9569
9598
  },
9570
9599
  property: {
9571
9600
  validate: (function() {
9572
- const normal = assertNodeType('Identifier');
9601
+ const normal = assertNodeType('Identifier', 'PrivateName');
9573
9602
  const computed = assertNodeType('Expression');
9574
9603
  const validator = Object.assign(function(node, key, val) {
9575
9604
  const validator2 = node.computed ? computed : normal;
9576
9605
  validator2(node, key, val);
9577
9606
  }, {
9578
- oneOfNodeTypes: ['Expression', 'Identifier'],
9607
+ oneOfNodeTypes: ['Expression', 'PrivateName'],
9579
9608
  });
9580
9609
 
9581
9610
  return validator;
@@ -9869,7 +9898,7 @@ defineType$3('DeclareFunction', {
9869
9898
  ],
9870
9899
  fields: {
9871
9900
  id: validateType('Identifier'),
9872
- predicate: validateOptionalType('DeclaredPredicate'),
9901
+ predicate: validateOptionalType('FlowPredicate'),
9873
9902
  },
9874
9903
  });
9875
9904
  defineInterfaceishType('DeclareInterface');
@@ -9981,7 +10010,7 @@ defineType$3('DeclaredPredicate', {
9981
10010
  visitor: ['value'],
9982
10011
  aliases: ['FlowPredicate'],
9983
10012
  fields: {
9984
- value: validateType('Flow'),
10013
+ value: validateType('Expression'),
9985
10014
  },
9986
10015
  });
9987
10016
  defineType$3('ExistsTypeAnnotation', {
@@ -10072,6 +10101,13 @@ defineType$3('NumberLiteralTypeAnnotation', {
10072
10101
  value: validate$2(assertValueType('number')),
10073
10102
  },
10074
10103
  });
10104
+ defineType$3('BigIntLiteralTypeAnnotation', {
10105
+ builder: ['value'],
10106
+ aliases: ['FlowType'],
10107
+ fields: {
10108
+ value: validate$2(assertValueType('bigint')),
10109
+ },
10110
+ });
10075
10111
  defineType$3('NumberTypeAnnotation', {
10076
10112
  aliases: ['FlowType', 'FlowBaseAnnotation'],
10077
10113
  });
@@ -10170,7 +10206,7 @@ defineType$3('ObjectTypeProperty', {
10170
10206
  ],
10171
10207
  aliases: ['UserWhitespacable'],
10172
10208
  fields: {
10173
- key: validateType('Identifier', 'StringLiteral'),
10209
+ key: validateType('Identifier', 'StringLiteral', 'NumericLiteral'),
10174
10210
  value: validateType('FlowType'),
10175
10211
  kind: {
10176
10212
  validate: assertOneOf('init', 'get', 'set'),
@@ -10651,7 +10687,7 @@ defineType$5('BindExpression', {
10651
10687
  aliases: ['Expression'],
10652
10688
  fields: {
10653
10689
  object: {
10654
- validate: assertNodeType('Expression'),
10690
+ validate: assertNodeOrValueType('null', 'Expression'),
10655
10691
  },
10656
10692
  callee: {
10657
10693
  validate: assertNodeType('Expression'),
@@ -11195,7 +11231,7 @@ defineType('TSInterfaceDeclaration', {
11195
11231
  declare: validateOptional(bool),
11196
11232
  id: validateType('Identifier'),
11197
11233
  typeParameters: validateOptionalType('TSTypeParameterDeclaration'),
11198
- extends: validateOptional(arrayOfType('TSClassImplements')),
11234
+ extends: validateOptional(arrayOfType('TSInterfaceHeritage')),
11199
11235
  body: validateType('TSInterfaceBody'),
11200
11236
  },
11201
11237
  });
@@ -11282,7 +11318,7 @@ defineType('TSModuleDeclaration', {
11282
11318
  visitor: ['id', 'body'],
11283
11319
  fields: {
11284
11320
  kind: {
11285
- validate: assertOneOf('global', 'namespace'),
11321
+ validate: assertOneOf('global', 'namespace', 'module'),
11286
11322
  default: 'namespace',
11287
11323
  },
11288
11324
  declare: validateOptional(bool),
@@ -12383,19 +12419,6 @@ function importSpecifier(local, imported) {
12383
12419
  return node;
12384
12420
  }
12385
12421
 
12386
- function importExpression(source, options = null) {
12387
- const node = {
12388
- type: 'ImportExpression',
12389
- source,
12390
- options,
12391
- };
12392
-
12393
- const defs2 = NODE_FIELDS.ImportExpression;
12394
- validate(defs2.source, node, 'source', source, 1);
12395
- validate(defs2.options, node, 'options', options, 1);
12396
- return node;
12397
- }
12398
-
12399
12422
  function metaProperty(meta, property) {
12400
12423
  const node = {
12401
12424
  type: 'MetaProperty',
@@ -12525,6 +12548,19 @@ function awaitExpression(argument) {
12525
12548
  return node;
12526
12549
  }
12527
12550
 
12551
+ function importExpression(source, options = null) {
12552
+ const node = {
12553
+ type: 'ImportExpression',
12554
+ source,
12555
+ options,
12556
+ };
12557
+
12558
+ const defs2 = NODE_FIELDS.ImportExpression;
12559
+ validate(defs2.source, node, 'source', source, 1);
12560
+ validate(defs2.options, node, 'options', options, 1);
12561
+ return node;
12562
+ }
12563
+
12528
12564
  function _import() {
12529
12565
  return {
12530
12566
  type: 'Import',
@@ -13029,6 +13065,17 @@ function numberLiteralTypeAnnotation(value) {
13029
13065
  return node;
13030
13066
  }
13031
13067
 
13068
+ function bigIntLiteralTypeAnnotation(value) {
13069
+ const node = {
13070
+ type: 'BigIntLiteralTypeAnnotation',
13071
+ value,
13072
+ };
13073
+
13074
+ const defs2 = NODE_FIELDS.BigIntLiteralTypeAnnotation;
13075
+ validate(defs2.value, node, 'value', value);
13076
+ return node;
13077
+ }
13078
+
13032
13079
  function numberTypeAnnotation() {
13033
13080
  return {
13034
13081
  type: 'NumberTypeAnnotation',
@@ -14581,6 +14628,7 @@ var b = /* @__PURE__ */Object.freeze({
14581
14628
  assignmentPattern,
14582
14629
  awaitExpression,
14583
14630
  bigIntLiteral,
14631
+ bigIntLiteralTypeAnnotation,
14584
14632
  binaryExpression,
14585
14633
  bindExpression,
14586
14634
  blockStatement,
@@ -14897,7 +14945,6 @@ var ImportDeclaration = alias('importDeclaration');
14897
14945
  var ImportDefaultSpecifier = alias('importDefaultSpecifier');
14898
14946
  var ImportNamespaceSpecifier = alias('importNamespaceSpecifier');
14899
14947
  var ImportSpecifier = alias('importSpecifier');
14900
- var ImportExpression = alias('importExpression');
14901
14948
  var MetaProperty = alias('metaProperty');
14902
14949
  var ClassMethod = alias('classMethod');
14903
14950
  var ObjectPattern = alias('objectPattern');
@@ -14908,6 +14955,7 @@ var TemplateElement = alias('templateElement');
14908
14955
  var TemplateLiteral = alias('templateLiteral');
14909
14956
  var YieldExpression = alias('yieldExpression');
14910
14957
  var AwaitExpression = alias('awaitExpression');
14958
+ var ImportExpression = alias('importExpression');
14911
14959
  var Import = alias('import');
14912
14960
  var BigIntLiteral = alias('bigIntLiteral');
14913
14961
  var ExportNamespaceSpecifier = alias('exportNamespaceSpecifier');
@@ -14949,6 +14997,7 @@ var MixedTypeAnnotation = alias('mixedTypeAnnotation');
14949
14997
  var EmptyTypeAnnotation = alias('emptyTypeAnnotation');
14950
14998
  var NullableTypeAnnotation = alias('nullableTypeAnnotation');
14951
14999
  var NumberLiteralTypeAnnotation = alias('numberLiteralTypeAnnotation');
15000
+ var BigIntLiteralTypeAnnotation = alias('bigIntLiteralTypeAnnotation');
14952
15001
  var NumberTypeAnnotation = alias('numberTypeAnnotation');
14953
15002
  var ObjectTypeAnnotation = alias('objectTypeAnnotation');
14954
15003
  var ObjectTypeInternalSlot = alias('objectTypeInternalSlot');
@@ -15423,10 +15472,6 @@ function assertImportSpecifier(node, opts) {
15423
15472
  assert('ImportSpecifier', node, opts);
15424
15473
  }
15425
15474
 
15426
- function assertImportExpression(node, opts) {
15427
- assert('ImportExpression', node, opts);
15428
- }
15429
-
15430
15475
  function assertMetaProperty(node, opts) {
15431
15476
  assert('MetaProperty', node, opts);
15432
15477
  }
@@ -15467,6 +15512,10 @@ function assertAwaitExpression(node, opts) {
15467
15512
  assert('AwaitExpression', node, opts);
15468
15513
  }
15469
15514
 
15515
+ function assertImportExpression(node, opts) {
15516
+ assert('ImportExpression', node, opts);
15517
+ }
15518
+
15470
15519
  function assertImport(node, opts) {
15471
15520
  assert('Import', node, opts);
15472
15521
  }
@@ -15631,6 +15680,10 @@ function assertNumberLiteralTypeAnnotation(node, opts) {
15631
15680
  assert('NumberLiteralTypeAnnotation', node, opts);
15632
15681
  }
15633
15682
 
15683
+ function assertBigIntLiteralTypeAnnotation(node, opts) {
15684
+ assert('BigIntLiteralTypeAnnotation', node, opts);
15685
+ }
15686
+
15634
15687
  function assertNumberTypeAnnotation(node, opts) {
15635
15688
  assert('NumberTypeAnnotation', node, opts);
15636
15689
  }
@@ -17794,13 +17847,18 @@ var react = {
17794
17847
 
17795
17848
  // ../babel-babel/packages/babel-parser/lib/index.js
17796
17849
  var Position = class {
17797
- line;
17798
- column;
17799
- index;
17800
17850
  constructor(line, col, index3) {
17851
+ this.line = void 0;
17852
+ this.column = void 0;
17853
+
17854
+ if (index3 !== void 0)
17855
+ this.index = void 0;
17856
+
17801
17857
  this.line = line;
17802
17858
  this.column = col;
17803
- this.index = index3;
17859
+
17860
+ if (index3 !== void 0)
17861
+ this.index = index3;
17804
17862
  }
17805
17863
  };
17806
17864
 
@@ -18059,13 +18117,13 @@ function defineHidden(obj, key, value) {
18059
18117
  function toParseErrorConstructor({toMessage, code: code2, reasonCode, syntaxPlugin}) {
18060
18118
  const hasMissingPlugin = reasonCode === 'MissingPlugin' || reasonCode === 'MissingOneOfPlugins';
18061
18119
 
18062
- return function constructor(loc, details) {
18120
+ return function constructor(loc, pos, details) {
18063
18121
  const error = new SyntaxError();
18064
18122
 
18065
18123
  error.code = code2;
18066
18124
  error.reasonCode = reasonCode;
18067
18125
  error.loc = loc;
18068
- error.pos = loc.index;
18126
+ error.pos = pos;
18069
18127
  error.syntaxPlugin = syntaxPlugin;
18070
18128
 
18071
18129
  if (hasMissingPlugin) {
@@ -18076,10 +18134,10 @@ function toParseErrorConstructor({toMessage, code: code2, reasonCode, syntaxPlug
18076
18134
  const {
18077
18135
  line,
18078
18136
  column,
18079
- index: index3,
18137
+ index: index3 = pos,
18080
18138
  } = overrides.loc ?? loc;
18081
18139
 
18082
- return constructor(new Position(line, column, index3), {
18140
+ return constructor(new Position(line, column), index3, {
18083
18141
  ...details,
18084
18142
  ...overrides.details,
18085
18143
  });
@@ -18160,6 +18218,7 @@ function createDefaultOptions() {
18160
18218
  plugins: [],
18161
18219
  strictMode: void 0,
18162
18220
  ranges: false,
18221
+ locations: true,
18163
18222
  tokens: false,
18164
18223
  createImportExpressions: true,
18165
18224
  createParenthesizedExpressions: false,
@@ -18212,32 +18271,27 @@ function getOptions(opts) {
18212
18271
  return options;
18213
18272
  }
18214
18273
 
18215
- var {defineProperty} = Object;
18216
-
18217
- var toUnenumerable = (object, key) => {
18218
- if (object) {
18219
- defineProperty(object, key, {
18220
- enumerable: false,
18221
- value: object[key],
18222
- });
18223
- }
18224
- };
18225
-
18226
18274
  function toESTreeLocation(node) {
18227
- toUnenumerable(node.loc.start, 'index');
18228
- toUnenumerable(node.loc.end, 'index');
18275
+ const {start, end} = node.loc;
18276
+
18277
+ node.loc.start = new Position(start.line, start.column);
18278
+ node.loc.end = new Position(end.line, end.column);
18229
18279
  return node;
18230
18280
  }
18231
18281
 
18232
18282
  var estree = (superClass) => class ESTreeParserMixin extends superClass {
18283
+ createPosition(loc) {
18284
+ return new Position(loc.line, loc.column);
18285
+ }
18286
+
18233
18287
  parse() {
18234
- const file2 = toESTreeLocation(super.parse());
18288
+ const file2 = super.parse();
18235
18289
 
18236
- if (this.optionFlags & 256) {
18290
+ if (this.optionFlags & 512) {
18237
18291
  file2.tokens = file2.tokens.map(toESTreeLocation);
18238
18292
  }
18239
18293
 
18240
- return file2;
18294
+ return toESTreeLocation(file2);
18241
18295
  }
18242
18296
 
18243
18297
  parseRegExpLiteral({pattern, flags}) {
@@ -18291,11 +18345,11 @@ var estree = (superClass) => class ESTreeParserMixin extends superClass {
18291
18345
  return this.estreeParseLiteral(value);
18292
18346
  }
18293
18347
 
18294
- estreeParseChainExpression(node, endLoc) {
18348
+ estreeParseChainExpression(node, endNode) {
18295
18349
  const chain2 = this.startNodeAtNode(node);
18296
18350
 
18297
18351
  chain2.expression = node;
18298
- return this.finishNodeAt(chain2, 'ChainExpression', endLoc);
18352
+ return this.finishNodeAtNode(chain2, 'ChainExpression', endNode);
18299
18353
  }
18300
18354
 
18301
18355
  directiveToStmt(directive2) {
@@ -18521,7 +18575,7 @@ var estree = (superClass) => class ESTreeParserMixin extends superClass {
18521
18575
  const {key, value} = node;
18522
18576
 
18523
18577
  if (this.isPrivateName(key)) {
18524
- this.classScope.usePrivateName(this.getPrivateNameSV(key), key.loc.start);
18578
+ this.classScope.usePrivateName(this.getPrivateNameSV(key), key.start);
18525
18579
  }
18526
18580
 
18527
18581
  this.toAssignable(value, isLHS);
@@ -18592,7 +18646,7 @@ var estree = (superClass) => class ESTreeParserMixin extends superClass {
18592
18646
  const node = super.stopParseSubscript(base, state);
18593
18647
 
18594
18648
  if (state.optionalChainMember) {
18595
- return this.estreeParseChainExpression(node, base.loc.end);
18649
+ return this.estreeParseChainExpression(node, base);
18596
18650
  }
18597
18651
 
18598
18652
  return node;
@@ -18661,6 +18715,10 @@ var estree = (superClass) => class ESTreeParserMixin extends superClass {
18661
18715
  return toESTreeLocation(super.finishNodeAt(node, type, endLoc));
18662
18716
  }
18663
18717
 
18718
+ finishNodeAtNode(node, type, endNode) {
18719
+ return toESTreeLocation(super.finishNodeAtNode(node, type, endNode));
18720
+ }
18721
+
18664
18722
  finishNode(node, type) {
18665
18723
  const result = super.finishNode(node, type);
18666
18724
  this.fillOptionalPropertiesForTSESLint(result);
@@ -20550,7 +20608,7 @@ var ScopeHandler = class {
20550
20608
  const topLevelScope = this.scopeStack[0];
20551
20609
 
20552
20610
  if (!topLevelScope.names.has(name)) {
20553
- this.undefinedExports.set(name, id.loc.start);
20611
+ this.undefinedExports.set(name, id.start);
20554
20612
  }
20555
20613
  }
20556
20614
 
@@ -21189,31 +21247,33 @@ var jsx = (superClass) => class JSXParserMixin extends superClass {
21189
21247
  }
21190
21248
 
21191
21249
  jsxParseAttribute() {
21192
- const node = this.startNode();
21193
-
21194
21250
  if (this.match(2)) {
21251
+ const node2 = this.startNode();
21195
21252
  this.setContext(types.brace);
21196
21253
  this.next();
21197
21254
  this.expect(17);
21198
- node.argument = this.parseMaybeAssignAllowIn();
21255
+ node2.argument = this.parseMaybeAssignAllowIn();
21199
21256
  this.setContext(types.j_oTag);
21200
21257
  this.state.canStartJSXElement = true;
21201
21258
  this.expect(4);
21202
- return this.finishNode(node, 'JSXSpreadAttribute');
21259
+ return this.finishNode(node2, 'JSXSpreadAttribute');
21203
21260
  }
21204
21261
 
21262
+ const node = this.startNode();
21263
+
21205
21264
  node.name = this.jsxParseNamespacedName();
21206
21265
  node.value = this.eat(25) ? this.jsxParseAttributeValue() : null;
21207
21266
  return this.finishNode(node, 'JSXAttribute');
21208
21267
  }
21209
21268
 
21210
21269
  jsxParseOpeningElementAt(startLoc) {
21211
- const node = this.startNodeAt(startLoc);
21212
-
21213
21270
  if (this.eat(139)) {
21214
- return this.finishNode(node, 'JSXOpeningFragment');
21271
+ const node2 = this.startNodeAt(startLoc);
21272
+ return this.finishNode(node2, 'JSXOpeningFragment');
21215
21273
  }
21216
21274
 
21275
+ const node = this.startNodeAt(startLoc);
21276
+
21217
21277
  node.name = this.jsxParseElementName();
21218
21278
  return this.jsxParseOpeningElementAfterName(node);
21219
21279
  }
@@ -21232,12 +21292,13 @@ var jsx = (superClass) => class JSXParserMixin extends superClass {
21232
21292
  }
21233
21293
 
21234
21294
  jsxParseClosingElementAt(startLoc) {
21235
- const node = this.startNodeAt(startLoc);
21236
-
21237
21295
  if (this.eat(139)) {
21238
- return this.finishNode(node, 'JSXClosingFragment');
21296
+ const node2 = this.startNodeAt(startLoc);
21297
+ return this.finishNode(node2, 'JSXClosingFragment');
21239
21298
  }
21240
21299
 
21300
+ const node = this.startNodeAt(startLoc);
21301
+
21241
21302
  node.name = this.jsxParseElementName();
21242
21303
  this.expect(139);
21243
21304
  return this.finishNode(node, 'JSXClosingElement');
@@ -21257,6 +21318,7 @@ var jsx = (superClass) => class JSXParserMixin extends superClass {
21257
21318
  this.next();
21258
21319
 
21259
21320
  if (this.eat(52)) {
21321
+ this.setLoc(startLoc);
21260
21322
  closingElement = this.jsxParseClosingElementAt(startLoc);
21261
21323
  break contents;
21262
21324
  }
@@ -21701,7 +21763,7 @@ var CommentsParser = class extends BaseParser {
21701
21763
  i--;
21702
21764
  }
21703
21765
 
21704
- const {start: nodeStart} = node;
21766
+ const nodeStart = node.start;
21705
21767
 
21706
21768
  for (; i >= 0; i--) {
21707
21769
  const commentWS = commentStack[i];
@@ -22444,6 +22506,15 @@ var Token = class {
22444
22506
  }
22445
22507
  };
22446
22508
 
22509
+ var locDataCache;
22510
+
22511
+ function resetLocData() {
22512
+ const data = locDataCache;
22513
+
22514
+ locDataCache = void 0;
22515
+ return data;
22516
+ }
22517
+
22447
22518
  var Tokenizer = class extends CommentsParser {
22448
22519
  isLookahead;
22449
22520
  tokens = [];
@@ -22455,6 +22526,26 @@ var Tokenizer = class extends CommentsParser {
22455
22526
  this.length = input.length;
22456
22527
  this.comments = [];
22457
22528
  this.isLookahead = false;
22529
+
22530
+ if (!locDataCache || locDataCache.length < (this.length + 1) * 2 || options.locations === 'packed') {
22531
+ locDataCache = new Uint32Array((this.length + 1) * 2);
22532
+ }
22533
+
22534
+ this.locData = locDataCache;
22535
+ }
22536
+
22537
+ setLoc(loc) {
22538
+ const dataIndex = this.offsetToSourcePos(loc.index);
22539
+
22540
+ this.locData[dataIndex * 2] = loc.line;
22541
+ this.locData[dataIndex * 2 + 1] = loc.column;
22542
+ }
22543
+
22544
+ getLoc(locIndex) {
22545
+ const dataIndex = this.offsetToSourcePos(locIndex);
22546
+ const loc = new Position(this.locData[dataIndex * 2], this.locData[dataIndex * 2 + 1], locIndex);
22547
+
22548
+ return loc;
22458
22549
  }
22459
22550
 
22460
22551
  pushToken(token) {
@@ -22466,7 +22557,7 @@ var Tokenizer = class extends CommentsParser {
22466
22557
  next() {
22467
22558
  this.checkKeywordEscapes();
22468
22559
 
22469
- if (this.optionFlags & 256) {
22560
+ if (this.optionFlags & 512) {
22470
22561
  this.pushToken(new Token(this.state));
22471
22562
  }
22472
22563
 
@@ -22621,7 +22712,7 @@ var Tokenizer = class extends CommentsParser {
22621
22712
  loc: new SourceLocation(startLoc, this.state.curPosition()),
22622
22713
  };
22623
22714
 
22624
- if (this.optionFlags & 256)
22715
+ if (this.optionFlags & 512)
22625
22716
  this.pushToken(comment);
22626
22717
 
22627
22718
  return comment;
@@ -22656,7 +22747,7 @@ var Tokenizer = class extends CommentsParser {
22656
22747
  loc: new SourceLocation(startLoc, this.state.curPosition()),
22657
22748
  };
22658
22749
 
22659
- if (this.optionFlags & 256)
22750
+ if (this.optionFlags & 512)
22660
22751
  this.pushToken(comment);
22661
22752
 
22662
22753
  return comment;
@@ -22664,7 +22755,7 @@ var Tokenizer = class extends CommentsParser {
22664
22755
 
22665
22756
  skipSpace() {
22666
22757
  const spaceStart = this.state.pos;
22667
- const comments = this.optionFlags & 4096 ? [] : null;
22758
+ const comments = this.optionFlags & 8192 ? [] : null;
22668
22759
 
22669
22760
  loop: while (this.state.pos < this.length) {
22670
22761
  const ch = this.input.charCodeAt(this.state.pos);
@@ -22722,7 +22813,7 @@ var Tokenizer = class extends CommentsParser {
22722
22813
  default:
22723
22814
  if (isWhitespace(ch)) {
22724
22815
  ++this.state.pos;
22725
- } else if (ch === 45 && !this.inModule && this.optionFlags & 8192) {
22816
+ } else if (ch === 45 && !this.inModule && this.optionFlags & 16384) {
22726
22817
  const pos = this.state.pos;
22727
22818
 
22728
22819
  if (this.input.charCodeAt(pos + 1) === 45 && this.input.charCodeAt(pos + 2) === 62 && (spaceStart === 0 || this.state.lineStart > spaceStart)) {
@@ -22735,7 +22826,7 @@ var Tokenizer = class extends CommentsParser {
22735
22826
  } else {
22736
22827
  break loop;
22737
22828
  }
22738
- } else if (ch === 60 && !this.inModule && this.optionFlags & 8192) {
22829
+ } else if (ch === 60 && !this.inModule && this.optionFlags & 16384) {
22739
22830
  const pos = this.state.pos;
22740
22831
 
22741
22832
  if (this.input.charCodeAt(pos + 1) === 33 && this.input.charCodeAt(pos + 2) === 45 && this.input.charCodeAt(pos + 3) === 45) {
@@ -23540,10 +23631,11 @@ var Tokenizer = class extends CommentsParser {
23540
23631
  }
23541
23632
 
23542
23633
  raise(toParseError, at, details = {}) {
23543
- const loc = at instanceof Position ? at : at.loc.start;
23544
- const error = toParseError(loc, details);
23634
+ const loc = at instanceof Position ? at : typeof at === 'number' ? this.getLoc(at) : this.optionFlags & 256 ? at.loc.start : this.getLoc(at.start);
23635
+ const pos = at instanceof Position ? loc.index : typeof at === 'number' ? at : at.start;
23636
+ const error = toParseError(loc, pos, details);
23545
23637
 
23546
- if (!(this.optionFlags & 2048))
23638
+ if (!(this.optionFlags & 4096))
23547
23639
  throw error;
23548
23640
 
23549
23641
  if (!this.isLookahead)
@@ -23553,22 +23645,22 @@ var Tokenizer = class extends CommentsParser {
23553
23645
  }
23554
23646
 
23555
23647
  raiseOverwrite(toParseError, at, details = {}) {
23556
- const loc = at instanceof Position ? at : at.loc.start;
23557
- const pos = loc.index;
23648
+ const loc = at instanceof Position ? at : this.optionFlags & 256 ? at.loc.start : this.getLoc(at.start);
23649
+ const pos = at instanceof Position ? loc.index : at.start;
23558
23650
  const errors = this.state.errors;
23559
23651
 
23560
23652
  for (let i = errors.length - 1; i >= 0; i--) {
23561
23653
  const error = errors[i];
23562
23654
 
23563
- if (error.loc.index === pos) {
23564
- return errors[i] = toParseError(loc, details);
23655
+ if (error.pos === pos) {
23656
+ return errors[i] = toParseError(loc, pos, details);
23565
23657
  }
23566
23658
 
23567
- if (error.loc.index < pos)
23659
+ if (error.pos < pos)
23568
23660
  break;
23569
23661
  }
23570
23662
 
23571
- return this.raise(toParseError, at, details);
23663
+ return this.raise(toParseError, loc, details);
23572
23664
  }
23573
23665
 
23574
23666
  updateContext() {}
@@ -23605,7 +23697,7 @@ var Tokenizer = class extends CommentsParser {
23605
23697
 
23606
23698
  errorHandlers_readInt = {
23607
23699
  invalidDigit: (pos, lineStart, curLine, radix) => {
23608
- if (!(this.optionFlags & 2048))
23700
+ if (!(this.optionFlags & 4096))
23609
23701
  return false;
23610
23702
 
23611
23703
  this.raise(Errors.InvalidDigit, buildPosition(pos, lineStart, curLine), {
@@ -23648,7 +23740,6 @@ var ClassScope = class {
23648
23740
  var ClassScopeHandler = class {
23649
23741
  parser;
23650
23742
  stack = [];
23651
- undefinedPrivateNames = /* @__PURE__ */new Map();
23652
23743
  constructor(parser) {
23653
23744
  this.parser = parser;
23654
23745
  }
@@ -23753,9 +23844,8 @@ var ArrowHeadParsingScope = class extends ExpressionScope {
23753
23844
  super(type);
23754
23845
  }
23755
23846
 
23756
- recordDeclarationError(ParsingErrorClass, at) {
23757
- const index3 = at.index;
23758
- this.declarationErrors.set(index3, [ParsingErrorClass, at]);
23847
+ recordDeclarationError(ParsingErrorClass, index3) {
23848
+ this.declarationErrors.set(index3, ParsingErrorClass);
23759
23849
  }
23760
23850
 
23761
23851
  clearDeclarationError(index3) {
@@ -23784,8 +23874,7 @@ var ExpressionScopeHandler = class {
23784
23874
  this.stack.pop();
23785
23875
  }
23786
23876
 
23787
- recordParameterInitializerError(toParseError, node) {
23788
- const origin = node.loc.start;
23877
+ recordParameterInitializerError(toParseError, loc) {
23789
23878
  const {stack} = this;
23790
23879
 
23791
23880
  let i = stack.length - 1;
@@ -23793,7 +23882,7 @@ var ExpressionScopeHandler = class {
23793
23882
 
23794
23883
  while (!scope2.isCertainlyParameterDeclaration()) {
23795
23884
  if (scope2.canBeArrowParameterDeclaration()) {
23796
- scope2.recordDeclarationError(toParseError, origin);
23885
+ scope2.recordDeclarationError(toParseError, loc);
23797
23886
  } else {
23798
23887
  return;
23799
23888
  }
@@ -23801,14 +23890,14 @@ var ExpressionScopeHandler = class {
23801
23890
  scope2 = stack[--i];
23802
23891
  }
23803
23892
 
23804
- this.parser.raise(toParseError, origin);
23893
+ this.parser.raise(toParseError, loc);
23805
23894
  }
23806
23895
 
23807
23896
  recordArrowParameterBindingError(error, node) {
23808
23897
  const {stack} = this;
23809
23898
 
23810
23899
  const scope2 = stack[stack.length - 1];
23811
- const origin = node.loc.start;
23900
+ const origin = node.start;
23812
23901
 
23813
23902
  if (scope2.isCertainlyParameterDeclaration()) {
23814
23903
  this.parser.raise(error, origin);
@@ -23842,13 +23931,13 @@ var ExpressionScopeHandler = class {
23842
23931
  if (!currentScope.canBeArrowParameterDeclaration())
23843
23932
  return;
23844
23933
 
23845
- currentScope.iterateErrors(([toParseError, loc]) => {
23846
- this.parser.raise(toParseError, loc);
23934
+ currentScope.iterateErrors((toParseError, key) => {
23935
+ this.parser.raise(toParseError, key);
23847
23936
  let i = stack.length - 2;
23848
23937
  let scope2 = stack[i];
23849
23938
 
23850
23939
  while (scope2.canBeArrowParameterDeclaration()) {
23851
- scope2.clearDeclarationError(loc.index);
23940
+ scope2.clearDeclarationError(key);
23852
23941
  scope2 = stack[--i];
23853
23942
  }
23854
23943
  });
@@ -24170,17 +24259,18 @@ var ExpressionErrors = class {
24170
24259
  };
24171
24260
 
24172
24261
  var Node = class {
24173
- constructor(parser, pos, loc) {
24262
+ constructor(optionFlags, filename, pos, loc) {
24174
24263
  this.start = pos;
24175
24264
  this.end = 0;
24176
- this.loc = new SourceLocation(loc);
24177
24265
 
24178
- if (parser != null) {
24179
- if (parser.optionFlags & 128)
24180
- this.range = [pos, 0];
24181
-
24182
- if (parser.filename)
24183
- this.loc.filename = parser.filename;
24266
+ if (loc !== void 0)
24267
+ this.loc = new SourceLocation(loc);
24268
+
24269
+ if (optionFlags & 128)
24270
+ this.range = [pos, 0];
24271
+
24272
+ if (loc !== void 0 && filename) {
24273
+ this.loc.filename = filename;
24184
24274
  }
24185
24275
  }
24186
24276
 
@@ -24190,17 +24280,35 @@ var Node = class {
24190
24280
  var NodePrototype = Node.prototype;
24191
24281
 
24192
24282
  var NodeUtils = class extends UtilParser {
24283
+ createPosition(loc) {
24284
+ return loc;
24285
+ }
24286
+
24193
24287
  startNode() {
24194
- const loc = this.state.startLoc;
24195
- return new Node(this, loc.index, loc);
24288
+ const {startLoc} = this.state;
24289
+
24290
+ this.setLoc(startLoc);
24291
+ return this.startNodeAt(startLoc);
24196
24292
  }
24197
24293
 
24198
24294
  startNodeAt(loc) {
24199
- return new Node(this, loc.index, loc);
24295
+ const {optionFlags, filename} = this;
24296
+
24297
+ if (!(optionFlags & 256)) {
24298
+ return new Node(optionFlags, filename, loc.index);
24299
+ }
24300
+
24301
+ return new Node(optionFlags, filename, loc.index, this.createPosition(loc));
24200
24302
  }
24201
24303
 
24202
24304
  startNodeAtNode(type) {
24203
- return this.startNodeAt(type.loc.start);
24305
+ const {optionFlags, filename} = this;
24306
+
24307
+ if (!(optionFlags & 256)) {
24308
+ return new Node(optionFlags, filename, type.start);
24309
+ }
24310
+
24311
+ return new Node(optionFlags, filename, type.start, type.loc.start);
24204
24312
  }
24205
24313
 
24206
24314
  finishNode(node, type) {
@@ -24210,36 +24318,85 @@ var NodeUtils = class extends UtilParser {
24210
24318
  finishNodeAt(node, type, endLoc) {
24211
24319
  node.type = type;
24212
24320
  node.end = endLoc.index;
24213
- node.loc.end = endLoc;
24321
+ const {optionFlags} = this;
24214
24322
 
24215
- if (this.optionFlags & 128)
24323
+ if (optionFlags & 256) {
24324
+ node.loc.end = this.createPosition(endLoc);
24325
+ }
24326
+
24327
+ if (optionFlags & 128)
24216
24328
  node.range[1] = endLoc.index;
24217
24329
 
24218
- if (this.optionFlags & 4096) {
24330
+ if (optionFlags & 8192)
24219
24331
  this.processComment(node);
24332
+
24333
+ return node;
24334
+ }
24335
+
24336
+ finishNodeAtNode(node, type, endNode) {
24337
+ node.type = type;
24338
+ node.end = endNode.end;
24339
+ const {optionFlags} = this;
24340
+
24341
+ if (optionFlags & 256) {
24342
+ node.loc.end = endNode.loc.end;
24220
24343
  }
24221
24344
 
24345
+ if (optionFlags & 128)
24346
+ node.range[1] = node.end;
24347
+
24348
+ if (optionFlags & 8192)
24349
+ this.processComment(node);
24350
+
24222
24351
  return node;
24223
24352
  }
24224
24353
 
24225
24354
  resetStartLocation(node, startLoc) {
24226
24355
  node.start = startLoc.index;
24227
- node.loc.start = startLoc;
24356
+ const {optionFlags} = this;
24357
+
24358
+ if (optionFlags & 256) {
24359
+ node.loc.start = this.createPosition(startLoc);
24360
+ }
24228
24361
 
24229
- if (this.optionFlags & 128)
24362
+ if (optionFlags & 128)
24230
24363
  node.range[0] = startLoc.index;
24231
24364
  }
24232
24365
 
24233
24366
  resetEndLocation(node, endLoc = this.state.lastTokEndLoc) {
24234
24367
  node.end = endLoc.index;
24235
- node.loc.end = endLoc;
24368
+ const {optionFlags} = this;
24369
+
24370
+ if (optionFlags & 256) {
24371
+ node.loc.end = this.createPosition(endLoc);
24372
+ }
24236
24373
 
24237
- if (this.optionFlags & 128)
24374
+ if (optionFlags & 128)
24238
24375
  node.range[1] = endLoc.index;
24239
24376
  }
24240
24377
 
24241
24378
  resetStartLocationFromNode(node, locationNode) {
24242
- this.resetStartLocation(node, locationNode.loc.start);
24379
+ node.start = locationNode.start;
24380
+ const {optionFlags} = this;
24381
+
24382
+ if (optionFlags & 256) {
24383
+ node.loc.start = locationNode.loc.start;
24384
+ }
24385
+
24386
+ if (optionFlags & 128)
24387
+ node.range[0] = locationNode.start;
24388
+ }
24389
+
24390
+ resetEndLocationFromNode(node, locationNode) {
24391
+ node.end = locationNode.end;
24392
+ const {optionFlags} = this;
24393
+
24394
+ if (optionFlags & 256) {
24395
+ node.loc.end = locationNode.loc.end;
24396
+ }
24397
+
24398
+ if (optionFlags & 128)
24399
+ node.range[1] = locationNode.end;
24243
24400
  }
24244
24401
 
24245
24402
  castNodeTo(node, type) {
@@ -24344,7 +24501,7 @@ var LValParser = class extends NodeUtils {
24344
24501
  const {key, value} = node;
24345
24502
 
24346
24503
  if (this.isPrivateName(key)) {
24347
- this.classScope.usePrivateName(this.getPrivateNameSV(key), key.loc.start);
24504
+ this.classScope.usePrivateName(this.getPrivateNameSV(key), key.start);
24348
24505
  }
24349
24506
 
24350
24507
  this.toAssignable(value, isLHS);
@@ -24361,7 +24518,7 @@ var LValParser = class extends NodeUtils {
24361
24518
 
24362
24519
  case 'AssignmentExpression':
24363
24520
  if (node.operator !== '=') {
24364
- this.raise(Errors.MissingEqInAssignment, node.left.loc.end);
24521
+ this.raise(Errors.MissingEqInAssignment, this.optionFlags & 256 ? node.left.loc.end : node.left);
24365
24522
  }
24366
24523
 
24367
24524
  this.castNodeTo(node, 'AssignmentPattern');
@@ -24605,6 +24762,8 @@ var LValParser = class extends NodeUtils {
24605
24762
  }
24606
24763
 
24607
24764
  parseBindingElement(flags, decorators) {
24765
+ const {startLoc} = this.state;
24766
+
24608
24767
  const left = this.parseMaybeDefault();
24609
24768
 
24610
24769
  if (flags & 2) {
@@ -24616,7 +24775,7 @@ var LValParser = class extends NodeUtils {
24616
24775
  this.resetStartLocationFromNode(left, decorators[0]);
24617
24776
  }
24618
24777
 
24619
- const elt = this.parseMaybeDefault(left.loc.start, left);
24778
+ const elt = this.parseMaybeDefault(startLoc, left);
24620
24779
 
24621
24780
  return elt;
24622
24781
  }
@@ -24667,7 +24826,7 @@ var LValParser = class extends NodeUtils {
24667
24826
  return true;
24668
24827
 
24669
24828
  case 'CallExpression':
24670
- if (!disallowCallExpression && !this.state.strict && this.optionFlags & 8192) {
24829
+ if (!disallowCallExpression && !this.state.strict && this.optionFlags & 16384) {
24671
24830
  return true;
24672
24831
  }
24673
24832
  }
@@ -24689,7 +24848,7 @@ var LValParser = class extends NodeUtils {
24689
24848
 
24690
24849
  if (isOptionalMemberExpression3 || type === 'MemberExpression') {
24691
24850
  if (isOptionalMemberExpression3) {
24692
- this.expectPlugin('optionalChainingAssign', expression2.loc.start);
24851
+ this.expectPlugin('optionalChainingAssign', expression2.start);
24693
24852
 
24694
24853
  if (ancestor.type !== 'AssignmentExpression') {
24695
24854
  this.raise(Errors.InvalidLhsOptionalChaining, expression2, {
@@ -24788,7 +24947,7 @@ var LValParser = class extends NodeUtils {
24788
24947
  }
24789
24948
 
24790
24949
  declareNameFromIdentifier(identifier4, binding) {
24791
- this.scope.declareName(identifier4.name, binding, identifier4.loc.start);
24950
+ this.scope.declareName(identifier4.name, binding, identifier4.start);
24792
24951
  }
24793
24952
 
24794
24953
  checkToRestConversion(node, allowPattern) {
@@ -25923,7 +26082,7 @@ var typescript = (superClass) => class TypeScriptParserMixin extends superClass
25923
26082
  return this.tsParseTupleType();
25924
26083
 
25925
26084
  case 6:
25926
- if (!(this.optionFlags & 1024)) {
26085
+ if (!(this.optionFlags & 2048)) {
25927
26086
  const startLoc = this.state.startLoc;
25928
26087
  this.next();
25929
26088
  const type = this.tsParseType();
@@ -26290,7 +26449,7 @@ var typescript = (superClass) => class TypeScriptParserMixin extends superClass
26290
26449
  const expression2 = (this.state.canStartArrow = false, super.parseExprSubscripts());
26291
26450
 
26292
26451
  if (!tsIsEntityName(expression2)) {
26293
- this.raise(TSErrors.InvalidHeritageClauseType, expression2.loc.start, {
26452
+ this.raise(TSErrors.InvalidHeritageClauseType, expression2.start, {
26294
26453
  token,
26295
26454
  });
26296
26455
  }
@@ -26773,7 +26932,7 @@ var typescript = (superClass) => class TypeScriptParserMixin extends superClass
26773
26932
  }
26774
26933
 
26775
26934
  parseBindingElement(flags, decorators) {
26776
- const startLoc = decorators.length ? decorators[0].loc.start : this.state.startLoc;
26935
+ const startLoc = decorators.length ? null : this.state.startLoc;
26777
26936
  const modified = {};
26778
26937
 
26779
26938
  this.tsParseModifiers({
@@ -26790,19 +26949,20 @@ var typescript = (superClass) => class TypeScriptParserMixin extends superClass
26790
26949
  const readonly = modified.readonly;
26791
26950
 
26792
26951
  if (!(flags & 4) && (accessibility || readonly || override)) {
26793
- this.raise(TSErrors.UnexpectedParameterModifier, startLoc);
26952
+ this.raise(TSErrors.UnexpectedParameterModifier, startLoc || decorators[0]);
26794
26953
  }
26795
26954
 
26796
- const left = this.parseMaybeDefault();
26955
+ const startLoc2 = this.state.startLoc;
26956
+ const left = this.parseMaybeDefault(startLoc2);
26797
26957
 
26798
26958
  if (flags & 2) {
26799
26959
  this.parseFunctionParamType(left);
26800
26960
  }
26801
26961
 
26802
- const elt = this.parseMaybeDefault(left.loc.start, left);
26962
+ const elt = this.parseMaybeDefault(startLoc2, left);
26803
26963
 
26804
26964
  if (accessibility || readonly || override) {
26805
- const pp = this.startNodeAt(startLoc);
26965
+ const pp = startLoc ? this.startNodeAt(startLoc) : this.startNodeAtNode(decorators[0]);
26806
26966
 
26807
26967
  if (decorators.length) {
26808
26968
  pp.decorators = decorators;
@@ -26818,7 +26978,7 @@ var typescript = (superClass) => class TypeScriptParserMixin extends superClass
26818
26978
  pp.override = override;
26819
26979
 
26820
26980
  if (elt.type !== 'Identifier' && elt.type !== 'AssignmentPattern') {
26821
- this.raise(TSErrors.UnsupportedParameterPropertyKind, pp);
26981
+ this.raise(TSErrors.UnsupportedParameterPropertyKind, startLoc || decorators[0]);
26822
26982
  }
26823
26983
 
26824
26984
  pp.parameter = elt;
@@ -27222,7 +27382,7 @@ var typescript = (superClass) => class TypeScriptParserMixin extends superClass
27222
27382
 
27223
27383
  return declaration;
27224
27384
  } else {
27225
- node.expression = this.createIdentifier(this.startNodeAt(node.loc.start), token === 121 ? 'declare' : 'abstract');
27385
+ node.expression = this.createIdentifier(this.startNodeAtNode(node), token === 121 ? 'declare' : 'abstract');
27226
27386
  this.semicolon(false);
27227
27387
  return this.finishNode(node, 'ExpressionStatement');
27228
27388
  }
@@ -27708,7 +27868,7 @@ var typescript = (superClass) => class TypeScriptParserMixin extends superClass
27708
27868
  const parameter = expr.typeParameters.params[0];
27709
27869
 
27710
27870
  if (!parameter.constraint) {
27711
- this.raise(TSErrors.SingleTypeParameterWithoutTrailingComma, createPositionWithColumnOffset(parameter.loc.end, 1), {
27871
+ this.raise(TSErrors.SingleTypeParameterWithoutTrailingComma, this.optionFlags & 256 ? createPositionWithColumnOffset(parameter.loc.end, 1) : parameter, {
27712
27872
  typeParameterName: parameter.name.name,
27713
27873
  });
27714
27874
  }
@@ -28006,7 +28166,7 @@ var typescript = (superClass) => class TypeScriptParserMixin extends superClass
28006
28166
 
28007
28167
  typeCastToParameter(node) {
28008
28168
  node.expression.typeAnnotation = node.typeAnnotation;
28009
- this.resetEndLocation(node.expression, node.typeAnnotation.loc.end);
28169
+ this.resetEndLocationFromNode(node.expression, node.typeAnnotation);
28010
28170
  return node.expression;
28011
28171
  }
28012
28172
 
@@ -28190,7 +28350,7 @@ var typescript = (superClass) => class TypeScriptParserMixin extends superClass
28190
28350
  let rightOfAs;
28191
28351
  let hasTypeSpecifier = false;
28192
28352
  let canParseAsKeyword = true;
28193
- const loc = leftOfAs.loc.start;
28353
+ const loc = leftOfAs.start;
28194
28354
 
28195
28355
  if (this.isContextual(89)) {
28196
28356
  const firstAs = this.parseIdentifier();
@@ -28221,7 +28381,7 @@ var typescript = (superClass) => class TypeScriptParserMixin extends superClass
28221
28381
  leftOfAs = this.parseIdentifier(true);
28222
28382
 
28223
28383
  if (!this.isContextual(89)) {
28224
- this.checkReservedWord(leftOfAs.name, leftOfAs.loc.start, true, true);
28384
+ this.checkReservedWord(leftOfAs.name, leftOfAs.start, true, true);
28225
28385
  }
28226
28386
  } else {
28227
28387
  leftOfAs = this.parseModuleExportName();
@@ -28906,7 +29066,7 @@ var ExpressionParser = class extends LValParser {
28906
29066
  if (sawProto) {
28907
29067
  if (refExpressionErrors) {
28908
29068
  if (refExpressionErrors.doubleProtoLoc === null) {
28909
- refExpressionErrors.doubleProtoLoc = key.loc.start;
29069
+ refExpressionErrors.doubleProtoLoc = this.getLoc(key.start);
28910
29070
  }
28911
29071
  } else {
28912
29072
  this.raise(Errors.DuplicateProto, key);
@@ -28943,10 +29103,14 @@ var ExpressionParser = class extends LValParser {
28943
29103
  expr.comments = this.comments;
28944
29104
  expr.errors = this.state.errors;
28945
29105
 
28946
- if (this.optionFlags & 256) {
29106
+ if (this.optionFlags & 512) {
28947
29107
  expr.tokens = createExportedTokens(this.tokens);
28948
29108
  }
28949
29109
 
29110
+ if (this.options.locations === 'packed') {
29111
+ expr.locData = resetLocData();
29112
+ }
29113
+
28950
29114
  return expr;
28951
29115
  }
28952
29116
 
@@ -29121,12 +29285,12 @@ var ExpressionParser = class extends LValParser {
29121
29285
  const value = this.getPrivateNameSV(left);
29122
29286
 
29123
29287
  if (minPrec >= tokenOperatorPrecedence(54) || !this.prodParam.hasIn || !this.match(54)) {
29124
- this.raise(Errors.PrivateInExpectedIn, left, {
29288
+ this.raise(Errors.PrivateInExpectedIn, leftStartLoc, {
29125
29289
  identifierName: value,
29126
29290
  });
29127
29291
  }
29128
29292
 
29129
- this.classScope.usePrivateName(value, left.loc.start);
29293
+ this.classScope.usePrivateName(value, leftStartLoc);
29130
29294
  }
29131
29295
 
29132
29296
  const op = this.state.type;
@@ -29312,6 +29476,7 @@ var ExpressionParser = class extends LValParser {
29312
29476
 
29313
29477
  parseExprSubscripts(refExpressionErrors) {
29314
29478
  const startLoc = this.state.startLoc;
29479
+ this.setLoc(startLoc);
29315
29480
  const expr = this.parseExprAtom(refExpressionErrors);
29316
29481
 
29317
29482
  if (this.shouldExitDescending(expr)) {
@@ -29575,7 +29740,7 @@ var ExpressionParser = class extends LValParser {
29575
29740
  }
29576
29741
 
29577
29742
  if (this.match(6)) {
29578
- if (this.optionFlags & 512) {
29743
+ if (this.optionFlags & 1024) {
29579
29744
  return this.parseImportCall(node);
29580
29745
  } else {
29581
29746
  return this.finishNode(node, 'Import');
@@ -30055,7 +30220,7 @@ var ExpressionParser = class extends LValParser {
30055
30220
  }
30056
30221
 
30057
30222
  wrapParenthesis(startLoc, expression2) {
30058
- if (!(this.optionFlags & 1024)) {
30223
+ if (!(this.optionFlags & 2048)) {
30059
30224
  this.addExtra(expression2, 'parenthesized', true);
30060
30225
  this.addExtra(expression2, 'parenStart', startLoc.index);
30061
30226
  this.takeSurroundingComments(expression2, startLoc.index, this.state.lastTokEndLoc.index);
@@ -30350,7 +30515,7 @@ var ExpressionParser = class extends LValParser {
30350
30515
  }
30351
30516
 
30352
30517
  if (!prop.computed && prop.key.type === 'Identifier') {
30353
- this.checkReservedWord(prop.key.name, prop.key.loc.start, true, false);
30518
+ this.checkReservedWord(prop.key.name, prop.key.start, true, false);
30354
30519
 
30355
30520
  if (isPattern3) {
30356
30521
  prop.value = this.parseMaybeDefault(startLoc, this.cloneIdentifier(prop.key));
@@ -30515,7 +30680,7 @@ var ExpressionParser = class extends LValParser {
30515
30680
  const nonSimple = !this.isSimpleParamList(node.params);
30516
30681
 
30517
30682
  if (hasStrictModeDirective && nonSimple) {
30518
- this.raise(Errors.IllegalLanguageModeDirective, (node.kind === 'method' || node.kind === 'constructor') && !!node.key ? node.key.loc.end : node);
30683
+ this.raise(Errors.IllegalLanguageModeDirective, (node.kind === 'method' || node.kind === 'constructor') && !!node.key ? this.optionFlags & 256 ? node.key.loc.end : node.key : node);
30519
30684
  }
30520
30685
 
30521
30686
  const strictModeChanged = !oldStrict && this.state.strict;
@@ -30626,19 +30791,27 @@ var ExpressionParser = class extends LValParser {
30626
30791
 
30627
30792
  createIdentifier(node, name) {
30628
30793
  node.name = name;
30629
- node.loc.identifierName = name;
30794
+
30795
+ if (this.optionFlags & 256) {
30796
+ node.loc.identifierName = name;
30797
+ }
30798
+
30630
30799
  return this.finishNode(node, 'Identifier');
30631
30800
  }
30632
30801
 
30633
30802
  createIdentifierAt(node, name, endLoc) {
30634
30803
  node.name = name;
30635
- node.loc.identifierName = name;
30804
+
30805
+ if (this.optionFlags & 256) {
30806
+ node.loc.identifierName = name;
30807
+ }
30808
+
30636
30809
  return this.finishNodeAt(node, 'Identifier', endLoc);
30637
30810
  }
30638
30811
 
30639
30812
  parseIdentifierName(liberal) {
30640
30813
  let name;
30641
- const {startLoc, type} = this.state;
30814
+ const {start, type} = this.state;
30642
30815
 
30643
30816
  if (tokenIsKeywordOrIdentifier(type)) {
30644
30817
  name = this.state.value;
@@ -30653,7 +30826,7 @@ var ExpressionParser = class extends LValParser {
30653
30826
  this.replaceToken(128);
30654
30827
  }
30655
30828
  } else {
30656
- this.checkReservedWord(name, startLoc, tokenIsKeyword2, false);
30829
+ this.checkReservedWord(name, this.sourceToOffsetPos(start), tokenIsKeyword2, false);
30657
30830
  }
30658
30831
 
30659
30832
  this.next();
@@ -30721,11 +30894,13 @@ var ExpressionParser = class extends LValParser {
30721
30894
  }
30722
30895
 
30723
30896
  parseAwait(startLoc, soloAwait) {
30897
+ const startIndex = startLoc.index;
30898
+ this.setLoc(startLoc);
30724
30899
  const node = this.startNodeAt(startLoc);
30725
- this.expressionScope.recordParameterInitializerError(Errors.AwaitExpressionFormalParameter, node);
30900
+ this.expressionScope.recordParameterInitializerError(Errors.AwaitExpressionFormalParameter, startIndex);
30726
30901
 
30727
30902
  if (this.eat(51)) {
30728
- this.raise(Errors.ObsoleteAwaitStar, node);
30903
+ this.raise(Errors.ObsoleteAwaitStar, startLoc);
30729
30904
  }
30730
30905
 
30731
30906
  if (!this.scope.inFunction && !(this.optionFlags & 1)) {
@@ -30761,8 +30936,9 @@ var ExpressionParser = class extends LValParser {
30761
30936
  }
30762
30937
 
30763
30938
  parseYield(startLoc) {
30939
+ this.setLoc(startLoc);
30764
30940
  const node = this.startNodeAt(startLoc);
30765
- this.expressionScope.recordParameterInitializerError(Errors.YieldInParameter, node);
30941
+ this.expressionScope.recordParameterInitializerError(Errors.YieldInParameter, startLoc.index);
30766
30942
  let delegating = false;
30767
30943
  let argument = null;
30768
30944
 
@@ -30855,7 +31031,7 @@ var ExpressionParser = class extends LValParser {
30855
31031
  const prodParamToSet = 16 & ~flags;
30856
31032
 
30857
31033
  if (prodParamToClear || prodParamToSet) {
30858
- this.prodParam.enter(flags & ~8 | 16);
31034
+ this.prodParam.enter(flags & -9 | 16);
30859
31035
  try {
30860
31036
  return callback();
30861
31037
  } finally {
@@ -30880,7 +31056,7 @@ var ExpressionParser = class extends LValParser {
30880
31056
 
30881
31057
  parseFSharpPipelineBody(prec) {
30882
31058
  const startLoc = this.state.startLoc;
30883
- this.prodParam.enter(this.prodParam.currentFlags() & ~16);
31059
+ this.prodParam.enter(this.prodParam.currentFlags() & -17);
30884
31060
  let ret;
30885
31061
 
30886
31062
  if (this.isContextual(92) && this.recordAwaitIfAllowed()) {
@@ -30978,7 +31154,7 @@ var StatementParser = class extends ExpressionParser {
30978
31154
  file2.program = this.parseProgram(program3, 135, this.options.sourceType === 'module' ? 'module' : 'script');
30979
31155
  file2.comments = this.comments;
30980
31156
 
30981
- if (this.optionFlags & 256) {
31157
+ if (this.optionFlags & 512) {
30982
31158
  file2.tokens = createExportedTokens(this.tokens);
30983
31159
  }
30984
31160
 
@@ -31978,11 +32154,11 @@ var StatementParser = class extends ExpressionParser {
31978
32154
 
31979
32155
  if (kind === 'using' || kind === 'await using') {
31980
32156
  if (id.type === 'ArrayPattern' || id.type === 'ObjectPattern') {
31981
- this.raise(Errors.UsingDeclarationHasBindingPattern, id.loc.start);
32157
+ this.raise(Errors.UsingDeclarationHasBindingPattern, id);
31982
32158
  }
31983
32159
  } else {
31984
32160
  if (id.type === 'VoidPattern') {
31985
- this.raise(Errors.UnexpectedVoidPattern, id.loc.start);
32161
+ this.raise(Errors.UnexpectedVoidPattern, id);
31986
32162
  }
31987
32163
  }
31988
32164
 
@@ -32051,7 +32227,7 @@ var StatementParser = class extends ExpressionParser {
32051
32227
  if (!node.id)
32052
32228
  return;
32053
32229
 
32054
- this.scope.declareName(node.id.name, !this.options.annexB || this.state.strict || node.generator || node.async ? this.scope.treatFunctionsAsVar ? 5 : 8201 : 17, node.id.loc.start);
32230
+ this.scope.declareName(node.id.name, !this.options.annexB || this.state.strict || node.generator || node.async ? this.scope.treatFunctionsAsVar ? 5 : 8201 : 17, node.id.start);
32055
32231
  }
32056
32232
 
32057
32233
  parseClass(node, isStatement5, optionalId) {
@@ -32366,7 +32542,7 @@ var StatementParser = class extends ExpressionParser {
32366
32542
  pushClassPrivateProperty(classBody2, prop) {
32367
32543
  const node = this.parseClassPrivateProperty(prop);
32368
32544
  classBody2.body.push(node);
32369
- this.classScope.declarePrivateName(this.getPrivateNameSV(node.key), 0, node.key.loc.start);
32545
+ this.classScope.declarePrivateName(this.getPrivateNameSV(node.key), 0, node.key.start);
32370
32546
  }
32371
32547
 
32372
32548
  pushClassAccessorProperty(classBody2, prop, isPrivate2) {
@@ -32378,7 +32554,7 @@ var StatementParser = class extends ExpressionParser {
32378
32554
  classBody2.body.push(node);
32379
32555
 
32380
32556
  if (isPrivate2) {
32381
- this.classScope.declarePrivateName(this.getPrivateNameSV(node.key), 0, node.key.loc.start);
32557
+ this.classScope.declarePrivateName(this.getPrivateNameSV(node.key), 0, node.key.start);
32382
32558
  }
32383
32559
  }
32384
32560
 
@@ -32402,7 +32578,7 @@ var StatementParser = class extends ExpressionParser {
32402
32578
  }
32403
32579
 
32404
32580
  declareClassPrivateMethodInScope(node, kind) {
32405
- this.classScope.declarePrivateName(this.getPrivateNameSV(node.key), kind, node.key.loc.start);
32581
+ this.classScope.declarePrivateName(this.getPrivateNameSV(node.key), kind, node.key.start);
32406
32582
  }
32407
32583
 
32408
32584
  parsePostMemberNameModifiers() {}
@@ -32546,7 +32722,7 @@ var StatementParser = class extends ExpressionParser {
32546
32722
 
32547
32723
  maybeParseExportDefaultSpecifier(node, maybeDefaultIdentifier) {
32548
32724
  if (maybeDefaultIdentifier || this.isExportDefaultSpecifier()) {
32549
- this.expectPlugin('exportDefaultFrom', maybeDefaultIdentifier?.loc.start);
32725
+ this.expectPlugin('exportDefaultFrom', maybeDefaultIdentifier?.start);
32550
32726
  const id = maybeDefaultIdentifier || this.parseIdentifier(true);
32551
32727
  const specifier = this.startNodeAtNode(id);
32552
32728
 
@@ -32755,7 +32931,7 @@ var StatementParser = class extends ExpressionParser {
32755
32931
  exportName,
32756
32932
  });
32757
32933
  } else {
32758
- this.checkReservedWord(local.name, local.loc.start, true, false);
32934
+ this.checkReservedWord(local.name, local.start, true, false);
32759
32935
  this.scope.checkLocalExport(local);
32760
32936
  }
32761
32937
  }
@@ -32886,11 +33062,11 @@ var StatementParser = class extends ExpressionParser {
32886
33062
 
32887
33063
  if (node.phase === 'source') {
32888
33064
  if (singleBindingType !== 'ImportDefaultSpecifier') {
32889
- this.raise(Errors.SourcePhaseImportRequiresDefault, specifiers[0].loc.start);
33065
+ this.raise(Errors.SourcePhaseImportRequiresDefault, specifiers[0]);
32890
33066
  }
32891
33067
  } else if (node.phase === 'defer') {
32892
33068
  if (singleBindingType !== 'ImportNamespaceSpecifier') {
32893
- this.raise(Errors.DeferImportRequiresNamespace, specifiers[0].loc.start);
33069
+ this.raise(Errors.DeferImportRequiresNamespace, specifiers[0]);
32894
33070
  }
32895
33071
  }
32896
33072
  }
@@ -32933,7 +33109,7 @@ var StatementParser = class extends ExpressionParser {
32933
33109
  const isImportPhase = tokenIsKeywordOrIdentifier(type) ? type !== 94 || this.lookaheadCharCode() === 102 : type !== 8;
32934
33110
 
32935
33111
  if (isImportPhase) {
32936
- this.applyImportPhase(node, isExport, phaseIdentifierName, phaseIdentifier.loc.start);
33112
+ this.applyImportPhase(node, isExport, phaseIdentifierName, phaseIdentifier.start);
32937
33113
  return null;
32938
33114
  } else {
32939
33115
  this.applyImportPhase(node, isExport, null);
@@ -33120,7 +33296,7 @@ var StatementParser = class extends ExpressionParser {
33120
33296
  });
33121
33297
  }
33122
33298
 
33123
- this.checkReservedWord(imported.name, specifier.loc.start, true, true);
33299
+ this.checkReservedWord(imported.name, specifier.start, true, true);
33124
33300
 
33125
33301
  if (!specifier.local) {
33126
33302
  specifier.local = this.cloneIdentifier(imported);
@@ -33178,30 +33354,34 @@ var Parser = class extends StatementParser {
33178
33354
  optionFlags |= 128;
33179
33355
  }
33180
33356
 
33181
- if (normalizedOptions.tokens) {
33357
+ if (normalizedOptions.locations === true) {
33182
33358
  optionFlags |= 256;
33183
33359
  }
33184
33360
 
33185
- if (normalizedOptions.createImportExpressions) {
33361
+ if (normalizedOptions.tokens) {
33186
33362
  optionFlags |= 512;
33187
33363
  }
33188
33364
 
33189
- if (normalizedOptions.createParenthesizedExpressions) {
33365
+ if (normalizedOptions.createImportExpressions) {
33190
33366
  optionFlags |= 1024;
33191
33367
  }
33192
33368
 
33193
- if (normalizedOptions.errorRecovery) {
33369
+ if (normalizedOptions.createParenthesizedExpressions) {
33194
33370
  optionFlags |= 2048;
33195
33371
  }
33196
33372
 
33197
- if (normalizedOptions.attachComment) {
33373
+ if (normalizedOptions.errorRecovery) {
33198
33374
  optionFlags |= 4096;
33199
33375
  }
33200
33376
 
33201
- if (normalizedOptions.annexB) {
33377
+ if (normalizedOptions.attachComment) {
33202
33378
  optionFlags |= 8192;
33203
33379
  }
33204
33380
 
33381
+ if (normalizedOptions.annexB) {
33382
+ optionFlags |= 16384;
33383
+ }
33384
+
33205
33385
  this.optionFlags = optionFlags;
33206
33386
  }
33207
33387
 
@@ -33220,6 +33400,11 @@ var Parser = class extends StatementParser {
33220
33400
 
33221
33401
  result.errors = this.state.errors;
33222
33402
  result.comments.length = this.state.commentsLen;
33403
+
33404
+ if (this.options.locations === 'packed') {
33405
+ result.locData = resetLocData();
33406
+ }
33407
+
33223
33408
  return result;
33224
33409
  }
33225
33410
  };
@@ -33335,6 +33520,22 @@ function getParserClass(pluginsMap) {
33335
33520
  return cls;
33336
33521
  }
33337
33522
 
33523
+ function getLine(locData, pos) {
33524
+ if (pos < 0 || pos * 2 >= locData.length) {
33525
+ throw new Error(`Position ${pos} is out of bounds for location data.`);
33526
+ }
33527
+
33528
+ return locData[pos * 2];
33529
+ }
33530
+
33531
+ function getColumn(locData, pos) {
33532
+ if (pos < 0 || pos * 2 + 1 >= locData.length) {
33533
+ throw new Error(`Position ${pos} is out of bounds for location data.`);
33534
+ }
33535
+
33536
+ return locData[pos * 2 + 1];
33537
+ }
33538
+
33338
33539
  // ../babel-babel/packages/babel-code-frame/lib/common-BO7XIBW3.js
33339
33540
  var NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
33340
33541
 
@@ -36259,28 +36460,28 @@ var PRECEDENCE = /* @__PURE__ */new Map([
36259
36460
  ]);
36260
36461
 
36261
36462
  function isTSTypeExpression(nodeId) {
36262
- return nodeId === 153 || nodeId === 198 || nodeId === 206;
36463
+ return nodeId === 154 || nodeId === 199 || nodeId === 207;
36263
36464
  }
36264
36465
 
36265
36466
  var isClassExtendsClause = (node, parent, parentId) => {
36266
- return (parentId === 21 || parentId === 22) && parent.superClass === node;
36467
+ return (parentId === 22 || parentId === 23) && parent.superClass === node;
36267
36468
  };
36268
36469
 
36269
36470
  var hasPostfixPart = (node, parent, parentId) => {
36270
36471
  switch(parentId) {
36271
- case 108:
36272
- case 132:
36472
+ case 109:
36473
+ case 133:
36273
36474
  return parent.object === node;
36274
36475
 
36275
- case 17:
36276
- case 130:
36277
- case 112:
36476
+ case 18:
36477
+ case 131:
36478
+ case 113:
36278
36479
  return parent.callee === node;
36279
36480
 
36280
- case 219:
36481
+ case 220:
36281
36482
  return parent.tag === node;
36282
36483
 
36283
- case 188:
36484
+ case 189:
36284
36485
  return true;
36285
36486
  }
36286
36487
 
@@ -36292,8 +36493,8 @@ function NullableTypeAnnotation$1(node, parent, parentId) {
36292
36493
  }
36293
36494
 
36294
36495
  function FunctionTypeAnnotation$1(node, parent, parentId, tokenContext) {
36295
- return parentId === 236
36296
- || parentId === 90
36496
+ return parentId === 237
36497
+ || parentId === 91
36297
36498
  || parentId === 4
36298
36499
  || (tokenContext & 8) > 0;
36299
36500
  }
@@ -36319,20 +36520,20 @@ function BinaryLike(node, parent, parentId, nodeType) {
36319
36520
  return true;
36320
36521
  }
36321
36522
 
36322
- if (hasPostfixPart(node, parent, parentId) || parentId === 235 || parentId === 142 || parentId === 8) {
36523
+ if (hasPostfixPart(node, parent, parentId) || parentId === 236 || parentId === 143 || parentId === 8) {
36323
36524
  return true;
36324
36525
  }
36325
36526
 
36326
36527
  let parentPos;
36327
36528
 
36328
36529
  switch(parentId) {
36329
- case 10:
36330
- case 107:
36530
+ case 11:
36531
+ case 108:
36331
36532
  parentPos = PRECEDENCE.get(parent.operator);
36332
36533
  break;
36333
36534
 
36334
- case 153:
36335
- case 198:
36535
+ case 154:
36536
+ case 199:
36336
36537
  parentPos = 7;
36337
36538
  }
36338
36539
 
@@ -36342,11 +36543,11 @@ function BinaryLike(node, parent, parentId, nodeType) {
36342
36543
  if (parentPos > nodePos)
36343
36544
  return true;
36344
36545
 
36345
- if (parentPos === nodePos && parentId === 10 && (nodePos === 11 ? parent.left === node : parent.right === node)) {
36546
+ if (parentPos === nodePos && parentId === 11 && (nodePos === 11 ? parent.left === node : parent.right === node)) {
36346
36547
  return true;
36347
36548
  }
36348
36549
 
36349
- if (nodeType === 1 && parentId === 107 && (nodePos === 1 && parentPos !== 1 || parentPos === 1 && nodePos !== 1)) {
36550
+ if (nodeType === 1 && parentId === 108 && (nodePos === 1 && parentPos !== 1 || parentPos === 1 && nodePos !== 1)) {
36350
36551
  return true;
36351
36552
  }
36352
36553
  }
@@ -36357,9 +36558,9 @@ function BinaryLike(node, parent, parentId, nodeType) {
36357
36558
  function UnionTypeAnnotation$1(node, parent, parentId) {
36358
36559
  switch(parentId) {
36359
36560
  case 4:
36360
- case 115:
36361
- case 90:
36362
- case 236:
36561
+ case 116:
36562
+ case 91:
36563
+ case 237:
36363
36564
  return true;
36364
36565
  }
36365
36566
 
@@ -36367,7 +36568,7 @@ function UnionTypeAnnotation$1(node, parent, parentId) {
36367
36568
  }
36368
36569
 
36369
36570
  function OptionalIndexedAccessType$1(node, parent, parentId) {
36370
- return parentId === 84 && parent.objectType === node;
36571
+ return parentId === 85 && parent.objectType === node;
36371
36572
  }
36372
36573
 
36373
36574
  function TSAsExpression$1(node, parent, parentId) {
@@ -36375,7 +36576,7 @@ function TSAsExpression$1(node, parent, parentId) {
36375
36576
  return true;
36376
36577
  }
36377
36578
 
36378
- if (parentId === 10 && (parent.operator === '|' || parent.operator === '&') && node === parent.left) {
36579
+ if (parentId === 11 && (parent.operator === '|' || parent.operator === '&') && node === parent.left) {
36379
36580
  return true;
36380
36581
  }
36381
36582
 
@@ -36384,18 +36585,18 @@ function TSAsExpression$1(node, parent, parentId) {
36384
36585
 
36385
36586
  function TSConditionalType$1(node, parent, parentId) {
36386
36587
  switch(parentId) {
36387
- case 152:
36388
- case 192:
36389
- case 208:
36588
+ case 153:
36589
+ case 193:
36390
36590
  case 209:
36391
- case 178:
36392
- case 216:
36591
+ case 210:
36592
+ case 179:
36593
+ case 217:
36393
36594
  return true;
36394
36595
 
36395
- case 172:
36596
+ case 173:
36396
36597
  return parent.objectType === node;
36397
36598
 
36398
- case 158:
36599
+ case 159:
36399
36600
  return parent.checkType === node || parent.extendsType === node;
36400
36601
  }
36401
36602
 
@@ -36404,13 +36605,13 @@ function TSConditionalType$1(node, parent, parentId) {
36404
36605
 
36405
36606
  function TSUnionType$1(node, parent, parentId) {
36406
36607
  switch(parentId) {
36407
- case 178:
36408
- case 208:
36409
- case 152:
36410
- case 192:
36608
+ case 179:
36609
+ case 209:
36610
+ case 153:
36611
+ case 193:
36411
36612
  return true;
36412
36613
 
36413
- case 172:
36614
+ case 173:
36414
36615
  return parent.objectType === node;
36415
36616
  }
36416
36617
 
@@ -36418,7 +36619,7 @@ function TSUnionType$1(node, parent, parentId) {
36418
36619
  }
36419
36620
 
36420
36621
  function TSIntersectionType$1(node, parent, parentId) {
36421
- return parentId === 208 || TSTypeOperator$1(node, parent, parentId);
36622
+ return parentId === 209 || TSTypeOperator$1(node, parent, parentId);
36422
36623
  }
36423
36624
 
36424
36625
  function TSInferType$1(node, parent, parentId) {
@@ -36426,7 +36627,7 @@ function TSInferType$1(node, parent, parentId) {
36426
36627
  return true;
36427
36628
  }
36428
36629
 
36429
- if ((parentId === 178 || parentId === 216) && node.typeParameter.constraint != null) {
36630
+ if ((parentId === 179 || parentId === 217) && node.typeParameter.constraint != null) {
36430
36631
  return true;
36431
36632
  }
36432
36633
 
@@ -36435,11 +36636,11 @@ function TSInferType$1(node, parent, parentId) {
36435
36636
 
36436
36637
  function TSTypeOperator$1(node, parent, parentId) {
36437
36638
  switch(parentId) {
36438
- case 152:
36439
- case 192:
36639
+ case 153:
36640
+ case 193:
36440
36641
  return true;
36441
36642
 
36442
- case 172:
36643
+ case 173:
36443
36644
  if (parent.objectType === node) {
36444
36645
  return true;
36445
36646
  }
@@ -36450,10 +36651,10 @@ function TSTypeOperator$1(node, parent, parentId) {
36450
36651
 
36451
36652
  function TSInstantiationExpression$1(node, parent, parentId) {
36452
36653
  switch(parentId) {
36453
- case 17:
36454
- case 130:
36455
- case 112:
36456
- case 174:
36654
+ case 18:
36655
+ case 131:
36656
+ case 113:
36657
+ case 175:
36457
36658
  return parent.typeArguments != null;
36458
36659
  }
36459
36660
 
@@ -36464,8 +36665,8 @@ function TSFunctionType$1(node, parent, parentId) {
36464
36665
  if (TSUnionType$1(node, parent, parentId))
36465
36666
  return true;
36466
36667
 
36467
- return parentId === 216
36468
- || parentId === 158
36668
+ return parentId === 217
36669
+ || parentId === 159
36469
36670
  && (parent.checkType === node
36470
36671
  || parent.extendsType === node);
36471
36672
  }
@@ -36482,19 +36683,19 @@ function LogicalExpression2(node, parent, parentId) {
36482
36683
  }
36483
36684
 
36484
36685
  function SequenceExpression$1(node, parent, parentId) {
36485
- if (parentId === 141 || parentId === 133 || parentId === 108 && parent.property === node || parentId === 132 && parent.property === node || parentId === 221) {
36686
+ if (parentId === 142 || parentId === 134 || parentId === 109 && parent.property === node || parentId === 133 && parent.property === node || parentId === 222) {
36486
36687
  return false;
36487
36688
  }
36488
36689
 
36489
- if (parentId === 21) {
36690
+ if (parentId === 22) {
36490
36691
  return true;
36491
36692
  }
36492
36693
 
36493
- if (parentId === 68) {
36694
+ if (parentId === 69) {
36494
36695
  return parent.right === node;
36495
36696
  }
36496
36697
 
36497
- if (parentId === 60) {
36698
+ if (parentId === 61) {
36498
36699
  return true;
36499
36700
  }
36500
36701
 
@@ -36502,14 +36703,14 @@ function SequenceExpression$1(node, parent, parentId) {
36502
36703
  }
36503
36704
 
36504
36705
  function YieldExpression$1(node, parent, parentId) {
36505
- return parentId === 10
36506
- || parentId === 107
36507
- || parentId === 235
36508
- || parentId === 142
36706
+ return parentId === 11
36707
+ || parentId === 108
36708
+ || parentId === 236
36709
+ || parentId === 143
36509
36710
  || hasPostfixPart(node, parent, parentId)
36510
36711
  || parentId === 8
36511
36712
  && isYieldExpression2(node)
36512
- || parentId === 28
36713
+ || parentId === 29
36513
36714
  && node === parent.test
36514
36715
  || isClassExtendsClause(node, parent, parentId)
36515
36716
  || isTSTypeExpression(parentId);
@@ -36521,7 +36722,7 @@ function ClassExpression2(node, parent, parentId, tokenContext) {
36521
36722
 
36522
36723
  function UnaryLike(node, parent, parentId) {
36523
36724
  return hasPostfixPart(node, parent, parentId)
36524
- || parentId === 10
36725
+ || parentId === 11
36525
36726
  && parent.operator === '**'
36526
36727
  && parent.left === node
36527
36728
  || isClassExtendsClause(node, parent, parentId);
@@ -36533,14 +36734,14 @@ function FunctionExpression$1(node, parent, parentId, tokenContext) {
36533
36734
 
36534
36735
  function ConditionalExpression$1(node, parent, parentId) {
36535
36736
  switch(parentId) {
36536
- case 235:
36537
- case 142:
36538
- case 10:
36539
- case 107:
36737
+ case 236:
36738
+ case 143:
36739
+ case 11:
36740
+ case 108:
36540
36741
  case 8:
36541
36742
  return true;
36542
36743
 
36543
- case 28:
36744
+ case 29:
36544
36745
  if (parent.test === node) {
36545
36746
  return true;
36546
36747
  }
@@ -36555,10 +36756,10 @@ function ConditionalExpression$1(node, parent, parentId) {
36555
36756
 
36556
36757
  function OptionalMemberExpression$1(node, parent, parentId) {
36557
36758
  switch(parentId) {
36558
- case 17:
36759
+ case 18:
36559
36760
  return parent.callee === node;
36560
36761
 
36561
- case 108:
36762
+ case 109:
36562
36763
  return parent.object === node;
36563
36764
  }
36564
36765
 
@@ -36586,7 +36787,7 @@ function Identifier$1(node, parent, parentId, tokenContext, getRawIdentifier) {
36586
36787
  }
36587
36788
  }
36588
36789
 
36589
- if (tokenContext & 64 || (parentId === 108 || parentId === 132) && tokenContext & (1 | 16 | 32)) {
36790
+ if (tokenContext & 64 || (parentId === 109 || parentId === 133) && tokenContext & (1 | 16 | 32)) {
36590
36791
  if (node.name === 'let') {
36591
36792
  const isFollowedByBracket = isMemberExpression$1(parent, {
36592
36793
  object: node,
@@ -36605,7 +36806,7 @@ function Identifier$1(node, parent, parentId, tokenContext, getRawIdentifier) {
36605
36806
  }
36606
36807
  }
36607
36808
 
36608
- return parentId === 68
36809
+ return parentId === 69
36609
36810
  && parent.left === node
36610
36811
  && node.name === 'async'
36611
36812
  && !parent.await;
@@ -39934,6 +40135,7 @@ var generatorFunctions = /* @__PURE__ */Object.freeze({
39934
40135
  AssignmentPattern: AssignmentPattern2,
39935
40136
  AwaitExpression: AwaitExpression2,
39936
40137
  BigIntLiteral: BigIntLiteral2,
40138
+ BigIntLiteralTypeAnnotation: BigIntLiteral2,
39937
40139
  BinaryExpression: BinaryExpression2,
39938
40140
  BindExpression: BindExpression2,
39939
40141
  BlockStatement: BlockStatement2,
@@ -40224,7 +40426,7 @@ function isOrHasCallExpression(node) {
40224
40426
 
40225
40427
  function parentNeedsParens(node, parent, parentId) {
40226
40428
  switch(parentId) {
40227
- case 112:
40429
+ case 113:
40228
40430
  if (parent.callee === node) {
40229
40431
  if (isOrHasCallExpression(node))
40230
40432
  return true;
@@ -40232,7 +40434,7 @@ function parentNeedsParens(node, parent, parentId) {
40232
40434
 
40233
40435
  break;
40234
40436
 
40235
- case 42:
40437
+ case 43:
40236
40438
  return !isDecoratorMemberExpression(node) && !(node.type === 'CallExpression' && isDecoratorMemberExpression(node.callee)) && node.type !== 'ParenthesizedExpression';
40237
40439
  }
40238
40440
 
@@ -41036,7 +41238,7 @@ var Printer = class {
41036
41238
  && flags & 1
41037
41239
  || parenthesized
41038
41240
  && flags & 16
41039
- && nodeId === 71
41241
+ && nodeId === 72
41040
41242
  || parent
41041
41243
  && (parentNeedsParens(node, parent, parentId)
41042
41244
  || needsParens != null
@@ -41044,15 +41246,15 @@ var Printer = class {
41044
41246
 
41045
41247
  if (!shouldPrintParens && parenthesized && node.leadingComments?.length && node.leadingComments[0].type === 'CommentBlock') {
41046
41248
  switch(parentId) {
41047
- case 65:
41048
- case 240:
41249
+ case 66:
41250
+ case 241:
41049
41251
  case 6:
41050
- case 140:
41252
+ case 141:
41051
41253
  break;
41052
41254
 
41053
- case 17:
41054
- case 130:
41055
- case 112:
41255
+ case 18:
41256
+ case 131:
41257
+ case 113:
41056
41258
  if (parent.callee !== node)
41057
41259
  break;
41058
41260
 
@@ -41105,7 +41307,7 @@ var Printer = class {
41105
41307
  }
41106
41308
 
41107
41309
  this._printLeadingComments(node, parent);
41108
- this.exactSource(nodeId === 136 || nodeId === 66 ? null : loc, printMethod.bind(this, node, parent));
41310
+ this.exactSource(nodeId === 137 || nodeId === 67 ? null : loc, printMethod.bind(this, node, parent));
41109
41311
 
41110
41312
  if (shouldPrintParens) {
41111
41313
  this._printTrailingComments(node, parent);
@@ -41344,7 +41546,7 @@ var Printer = class {
41344
41546
  }
41345
41547
 
41346
41548
  noIndentInnerCommentsHere() {
41347
- this._innerCommentsState &= ~4;
41549
+ this._innerCommentsState &= -5;
41348
41550
  }
41349
41551
 
41350
41552
  printSequence(nodes, indent, resetTokenContext, trailingCommentsLineOffset) {
@@ -48340,6 +48542,8 @@ traverse3.cache = cache;
48340
48542
  export {
48341
48543
  codeFrameColumns,
48342
48544
  generate,
48545
+ getColumn,
48546
+ getLine,
48343
48547
  parse,
48344
48548
  parseExpression,
48345
48549
  index as template,