@sepveneto/free-dom 0.12.8 → 0.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -2418,9 +2418,9 @@ var require_decode = __commonJS({
2418
2418
  }
2419
2419
  });
2420
2420
 
2421
- // ../../node_modules/.pnpm/@babel+parser@7.25.8/node_modules/@babel/parser/lib/index.js
2421
+ // ../../node_modules/.pnpm/@babel+parser@7.26.2/node_modules/@babel/parser/lib/index.js
2422
2422
  var require_lib = __commonJS({
2423
- "../../node_modules/.pnpm/@babel+parser@7.25.8/node_modules/@babel/parser/lib/index.js"(exports) {
2423
+ "../../node_modules/.pnpm/@babel+parser@7.26.2/node_modules/@babel/parser/lib/index.js"(exports) {
2424
2424
  "use strict";
2425
2425
  Object.defineProperty(exports, "__esModule", {
2426
2426
  value: true
@@ -2565,15 +2565,12 @@ var require_lib = __commonJS({
2565
2565
  }) => `Unsyntactic ${type === "BreakStatement" ? "break" : "continue"}.`,
2566
2566
  IllegalLanguageModeDirective: "Illegal 'use strict' directive in function with non-simple parameter list.",
2567
2567
  IllegalReturn: "'return' outside of function.",
2568
- ImportAttributesUseAssert: "The `assert` keyword in import attributes is deprecated and it has been replaced by the `with` keyword. You can enable the `deprecatedAssertSyntax: true` option in the import attributes plugin to suppress this error.",
2568
+ ImportAttributesUseAssert: "The `assert` keyword in import attributes is deprecated and it has been replaced by the `with` keyword. You can enable the `deprecatedImportAssert` parser plugin to suppress this error.",
2569
2569
  ImportBindingIsString: ({
2570
2570
  importName
2571
2571
  }) => `A string literal cannot be used as an imported binding.
2572
2572
  - Did you mean \`import { "${importName}" as foo }\`?`,
2573
- ImportCallArgumentTrailingComma: "Trailing comma is disallowed inside import(...) arguments.",
2574
- ImportCallArity: ({
2575
- maxArgumentCount
2576
- }) => `\`import()\` requires exactly ${maxArgumentCount === 1 ? "one argument" : "one or two arguments"}.`,
2573
+ ImportCallArity: `\`import()\` requires exactly one or two arguments.`,
2577
2574
  ImportCallNotNewExpression: "Cannot use new with import(...).",
2578
2575
  ImportCallSpreadArgument: "`...` is not allowed in `import()`.",
2579
2576
  ImportJSONBindingNotDefault: "A JSON module can only be imported with `default`.",
@@ -3100,13 +3097,11 @@ var require_lib = __commonJS({
3100
3097
  finishCallExpression(unfinished, optional) {
3101
3098
  const node = super.finishCallExpression(unfinished, optional);
3102
3099
  if (node.callee.type === "Import") {
3100
+ var _ref, _ref2;
3103
3101
  node.type = "ImportExpression";
3104
3102
  node.source = node.arguments[0];
3105
- if (this.hasPlugin("importAttributes") || this.hasPlugin("importAssertions")) {
3106
- var _ref, _ref2;
3107
- node.options = (_ref = node.arguments[1]) != null ? _ref : null;
3108
- node.attributes = (_ref2 = node.arguments[1]) != null ? _ref2 : null;
3109
- }
3103
+ node.options = (_ref = node.arguments[1]) != null ? _ref : null;
3104
+ node.attributes = (_ref2 = node.arguments[1]) != null ? _ref2 : null;
3110
3105
  delete node.arguments;
3111
3106
  delete node.callee;
3112
3107
  }
@@ -3648,6 +3643,9 @@ var require_lib = __commonJS({
3648
3643
  name: createToken("name", {
3649
3644
  startsExpr
3650
3645
  }),
3646
+ placeholder: createToken("%%", {
3647
+ startsExpr: true
3648
+ }),
3651
3649
  string: createToken("string", {
3652
3650
  startsExpr
3653
3651
  }),
@@ -3674,22 +3672,19 @@ var require_lib = __commonJS({
3674
3672
  jsxTagStart: createToken("jsxTagStart", {
3675
3673
  startsExpr: true
3676
3674
  }),
3677
- jsxTagEnd: createToken("jsxTagEnd"),
3678
- placeholder: createToken("%%", {
3679
- startsExpr: true
3680
- })
3675
+ jsxTagEnd: createToken("jsxTagEnd")
3681
3676
  };
3682
3677
  function tokenIsIdentifier(token) {
3683
- return token >= 93 && token <= 132;
3678
+ return token >= 93 && token <= 133;
3684
3679
  }
3685
3680
  function tokenKeywordOrIdentifierIsKeyword(token) {
3686
3681
  return token <= 92;
3687
3682
  }
3688
3683
  function tokenIsKeywordOrIdentifier(token) {
3689
- return token >= 58 && token <= 132;
3684
+ return token >= 58 && token <= 133;
3690
3685
  }
3691
3686
  function tokenIsLiteralPropertyName(token) {
3692
- return token >= 58 && token <= 136;
3687
+ return token >= 58 && token <= 137;
3693
3688
  }
3694
3689
  function tokenComesBeforeExpression(token) {
3695
3690
  return tokenBeforeExprs[token];
@@ -3753,7 +3748,7 @@ var require_lib = __commonJS({
3753
3748
  context.push(types.template);
3754
3749
  }
3755
3750
  };
3756
- tokenTypes[142].updateContext = (context) => {
3751
+ tokenTypes[143].updateContext = (context) => {
3757
3752
  context.push(types.j_expr, types.j_oTag);
3758
3753
  };
3759
3754
  }
@@ -4034,6 +4029,12 @@ var require_lib = __commonJS({
4034
4029
  this.sawUnambiguousESM = false;
4035
4030
  this.ambiguousScriptDifferentAst = false;
4036
4031
  }
4032
+ sourceToOffsetPos(sourcePos) {
4033
+ return sourcePos + this.startIndex;
4034
+ }
4035
+ offsetToSourcePos(offsetPos) {
4036
+ return offsetPos - this.startIndex;
4037
+ }
4037
4038
  hasPlugin(pluginConfig) {
4038
4039
  if (typeof pluginConfig === "string") {
4039
4040
  return this.plugins.has(pluginConfig);
@@ -4149,7 +4150,7 @@ var require_lib = __commonJS({
4149
4150
  containingNode: node,
4150
4151
  start: commentStart
4151
4152
  } = commentWS;
4152
- if (this.input.charCodeAt(commentStart - 1) === 44) {
4153
+ if (this.input.charCodeAt(this.offsetToSourcePos(commentStart) - 1) === 44) {
4153
4154
  switch (node.type) {
4154
4155
  case "ObjectExpression":
4155
4156
  case "ObjectPattern":
@@ -4300,6 +4301,7 @@ var require_lib = __commonJS({
4300
4301
  var State = class {
4301
4302
  constructor() {
4302
4303
  this.flags = 1024;
4304
+ this.startIndex = void 0;
4303
4305
  this.curLine = void 0;
4304
4306
  this.lineStart = void 0;
4305
4307
  this.startLoc = void 0;
@@ -4316,7 +4318,7 @@ var require_lib = __commonJS({
4316
4318
  this.commentsLen = 0;
4317
4319
  this.commentStack = [];
4318
4320
  this.pos = 0;
4319
- this.type = 139;
4321
+ this.type = 140;
4320
4322
  this.value = null;
4321
4323
  this.start = 0;
4322
4324
  this.end = 0;
@@ -4339,13 +4341,15 @@ var require_lib = __commonJS({
4339
4341
  init({
4340
4342
  strictMode,
4341
4343
  sourceType,
4344
+ startIndex,
4342
4345
  startLine,
4343
4346
  startColumn
4344
4347
  }) {
4345
4348
  this.strict = strictMode === false ? false : strictMode === true ? true : sourceType === "module";
4349
+ this.startIndex = startIndex;
4346
4350
  this.curLine = startLine;
4347
4351
  this.lineStart = -startColumn;
4348
- this.startLoc = this.endLoc = new Position(startLine, startColumn, 0);
4352
+ this.startLoc = this.endLoc = new Position(startLine, startColumn, startIndex);
4349
4353
  }
4350
4354
  get maybeInArrowParameters() {
4351
4355
  return (this.flags & 2) > 0;
@@ -4456,11 +4460,12 @@ var require_lib = __commonJS({
4456
4460
  this.flags &= -4097;
4457
4461
  }
4458
4462
  curPosition() {
4459
- return new Position(this.curLine, this.pos - this.lineStart, this.pos);
4463
+ return new Position(this.curLine, this.pos - this.lineStart, this.pos + this.startIndex);
4460
4464
  }
4461
4465
  clone() {
4462
4466
  const state2 = new State();
4463
4467
  state2.flags = this.flags;
4468
+ state2.startIndex = this.startIndex;
4464
4469
  state2.curLine = this.curLine;
4465
4470
  state2.lineStart = this.lineStart;
4466
4471
  state2.startLoc = this.startLoc;
@@ -4778,10 +4783,11 @@ var require_lib = __commonJS({
4778
4783
  var VALID_REGEX_FLAGS = /* @__PURE__ */ new Set([103, 109, 115, 105, 121, 117, 100, 118]);
4779
4784
  var Token = class {
4780
4785
  constructor(state2) {
4786
+ const startIndex = state2.startIndex || 0;
4781
4787
  this.type = state2.type;
4782
4788
  this.value = state2.value;
4783
- this.start = state2.start;
4784
- this.end = state2.end;
4789
+ this.start = startIndex + state2.start;
4790
+ this.end = startIndex + state2.end;
4785
4791
  this.loc = new SourceLocation(state2.startLoc, state2.endLoc);
4786
4792
  }
4787
4793
  };
@@ -4924,7 +4930,7 @@ var require_lib = __commonJS({
4924
4930
  if (!this.isLookahead)
4925
4931
  this.state.startLoc = this.state.curPosition();
4926
4932
  if (this.state.pos >= this.length) {
4927
- this.finishToken(139);
4933
+ this.finishToken(140);
4928
4934
  return;
4929
4935
  }
4930
4936
  this.getTokenFromCode(this.codePointAtPos(this.state.pos));
@@ -4949,8 +4955,8 @@ var require_lib = __commonJS({
4949
4955
  const comment = {
4950
4956
  type: "CommentBlock",
4951
4957
  value: this.input.slice(start + 2, end),
4952
- start,
4953
- end: end + commentEnd.length,
4958
+ start: this.sourceToOffsetPos(start),
4959
+ end: this.sourceToOffsetPos(end + commentEnd.length),
4954
4960
  loc: new SourceLocation(startLoc, this.state.curPosition())
4955
4961
  };
4956
4962
  if (this.options.tokens)
@@ -4975,8 +4981,8 @@ var require_lib = __commonJS({
4975
4981
  const comment = {
4976
4982
  type: "CommentLine",
4977
4983
  value,
4978
- start,
4979
- end,
4984
+ start: this.sourceToOffsetPos(start),
4985
+ end: this.sourceToOffsetPos(end),
4980
4986
  loc: new SourceLocation(startLoc, this.state.curPosition())
4981
4987
  };
4982
4988
  if (this.options.tokens)
@@ -5065,8 +5071,8 @@ var require_lib = __commonJS({
5065
5071
  if (comments.length > 0) {
5066
5072
  const end = this.state.pos;
5067
5073
  const commentWhitespace = {
5068
- start: spaceStart,
5069
- end,
5074
+ start: this.sourceToOffsetPos(spaceStart),
5075
+ end: this.sourceToOffsetPos(end),
5070
5076
  comments,
5071
5077
  leadingNode: null,
5072
5078
  trailingNode: null,
@@ -5111,10 +5117,10 @@ var require_lib = __commonJS({
5111
5117
  }
5112
5118
  } else if (isIdentifierStart(next)) {
5113
5119
  ++this.state.pos;
5114
- this.finishToken(138, this.readWord1(next));
5120
+ this.finishToken(139, this.readWord1(next));
5115
5121
  } else if (next === 92) {
5116
5122
  ++this.state.pos;
5117
- this.finishToken(138, this.readWord1());
5123
+ this.finishToken(139, this.readWord1());
5118
5124
  } else {
5119
5125
  this.finishOp(27, 1);
5120
5126
  }
@@ -5527,7 +5533,7 @@ var require_lib = __commonJS({
5527
5533
  mods += char;
5528
5534
  }
5529
5535
  this.state.pos = pos;
5530
- this.finishToken(137, {
5536
+ this.finishToken(138, {
5531
5537
  pattern: content,
5532
5538
  flags: mods
5533
5539
  });
@@ -5541,6 +5547,7 @@ var require_lib = __commonJS({
5541
5547
  return n;
5542
5548
  }
5543
5549
  readRadixNumber(radix) {
5550
+ const start = this.state.pos;
5544
5551
  const startLoc = this.state.curPosition();
5545
5552
  let isBigInt = false;
5546
5553
  this.state.pos += 2;
@@ -5561,11 +5568,11 @@ var require_lib = __commonJS({
5561
5568
  throw this.raise(Errors.NumberIdentifier, this.state.curPosition());
5562
5569
  }
5563
5570
  if (isBigInt) {
5564
- const str = this.input.slice(startLoc.index, this.state.pos).replace(/[_n]/g, "");
5565
- this.finishToken(135, str);
5571
+ const str = this.input.slice(start, this.state.pos).replace(/[_n]/g, "");
5572
+ this.finishToken(136, str);
5566
5573
  return;
5567
5574
  }
5568
- this.finishToken(134, val);
5575
+ this.finishToken(135, val);
5569
5576
  }
5570
5577
  readNumber(startsWithDot) {
5571
5578
  const start = this.state.pos;
@@ -5628,15 +5635,15 @@ var require_lib = __commonJS({
5628
5635
  }
5629
5636
  const str = this.input.slice(start, this.state.pos).replace(/[_mn]/g, "");
5630
5637
  if (isBigInt) {
5631
- this.finishToken(135, str);
5638
+ this.finishToken(136, str);
5632
5639
  return;
5633
5640
  }
5634
5641
  if (isDecimal) {
5635
- this.finishToken(136, str);
5642
+ this.finishToken(137, str);
5636
5643
  return;
5637
5644
  }
5638
5645
  const val = isOctal ? parseInt(str, 8) : parseFloat(str);
5639
- this.finishToken(134, val);
5646
+ this.finishToken(135, val);
5640
5647
  }
5641
5648
  readCodePoint(throwOnInvalid) {
5642
5649
  const {
@@ -5656,7 +5663,7 @@ var require_lib = __commonJS({
5656
5663
  this.state.pos = pos + 1;
5657
5664
  this.state.lineStart = lineStart;
5658
5665
  this.state.curLine = curLine;
5659
- this.finishToken(133, str);
5666
+ this.finishToken(134, str);
5660
5667
  }
5661
5668
  readTemplateContinuation() {
5662
5669
  if (!this.match(8)) {
@@ -5678,7 +5685,7 @@ var require_lib = __commonJS({
5678
5685
  this.state.lineStart = lineStart;
5679
5686
  this.state.curLine = curLine;
5680
5687
  if (firstInvalidLoc) {
5681
- this.state.firstInvalidTemplateEscapePos = new Position(firstInvalidLoc.curLine, firstInvalidLoc.pos - firstInvalidLoc.lineStart, firstInvalidLoc.pos);
5688
+ this.state.firstInvalidTemplateEscapePos = new Position(firstInvalidLoc.curLine, firstInvalidLoc.pos - firstInvalidLoc.lineStart, this.sourceToOffsetPos(firstInvalidLoc.pos));
5682
5689
  }
5683
5690
  if (this.input.codePointAt(pos) === 96) {
5684
5691
  this.finishToken(24, firstInvalidLoc ? null : opening + str + "`");
@@ -6074,10 +6081,10 @@ var require_lib = __commonJS({
6074
6081
  }
6075
6082
  }
6076
6083
  canInsertSemicolon() {
6077
- return this.match(139) || this.match(8) || this.hasPrecedingLineBreak();
6084
+ return this.match(140) || this.match(8) || this.hasPrecedingLineBreak();
6078
6085
  }
6079
6086
  hasPrecedingLineBreak() {
6080
- return hasNewLine(this.input, this.state.lastTokEndLoc.index, this.state.start);
6087
+ return hasNewLine(this.input, this.offsetToSourcePos(this.state.lastTokEndLoc.index), this.state.start);
6081
6088
  }
6082
6089
  hasFollowingLineBreak() {
6083
6090
  return hasNewLine(this.input, this.state.end, this.nextTokenStart());
@@ -6487,7 +6494,7 @@ var require_lib = __commonJS({
6487
6494
  return this.getPluginOption("flow", "all") || this.flowPragma === "flow";
6488
6495
  }
6489
6496
  finishToken(type, val) {
6490
- if (type !== 133 && type !== 13 && type !== 28) {
6497
+ if (type !== 134 && type !== 13 && type !== 28) {
6491
6498
  if (this.flowPragma === void 0) {
6492
6499
  this.flowPragma = null;
6493
6500
  }
@@ -6617,7 +6624,7 @@ var require_lib = __commonJS({
6617
6624
  }
6618
6625
  flowParseDeclareModule(node) {
6619
6626
  this.scope.enter(0);
6620
- if (this.match(133)) {
6627
+ if (this.match(134)) {
6621
6628
  node.id = super.parseExprAtom();
6622
6629
  } else {
6623
6630
  node.id = this.parseIdentifier();
@@ -6845,7 +6852,7 @@ var require_lib = __commonJS({
6845
6852
  const node = this.startNode();
6846
6853
  node.params = [];
6847
6854
  this.state.inType = true;
6848
- if (this.match(47) || this.match(142)) {
6855
+ if (this.match(47) || this.match(143)) {
6849
6856
  this.next();
6850
6857
  } else {
6851
6858
  this.unexpected();
@@ -6919,7 +6926,7 @@ var require_lib = __commonJS({
6919
6926
  return this.finishNode(node, "InterfaceTypeAnnotation");
6920
6927
  }
6921
6928
  flowParseObjectPropertyKey() {
6922
- return this.match(134) || this.match(133) ? super.parseExprAtom() : this.parseIdentifier(true);
6929
+ return this.match(135) || this.match(134) ? super.parseExprAtom() : this.parseIdentifier(true);
6923
6930
  }
6924
6931
  flowParseObjectTypeIndexer(node, isStatic, variance) {
6925
6932
  node.static = isStatic;
@@ -7363,7 +7370,7 @@ var require_lib = __commonJS({
7363
7370
  node2.typeParameters = null;
7364
7371
  return this.finishNode(node2, "FunctionTypeAnnotation");
7365
7372
  }
7366
- case 133:
7373
+ case 134:
7367
7374
  return this.parseLiteral(this.state.value, "StringLiteralTypeAnnotation");
7368
7375
  case 85:
7369
7376
  case 86:
@@ -7373,19 +7380,19 @@ var require_lib = __commonJS({
7373
7380
  case 53:
7374
7381
  if (this.state.value === "-") {
7375
7382
  this.next();
7376
- if (this.match(134)) {
7383
+ if (this.match(135)) {
7377
7384
  return this.parseLiteralAtNode(-this.state.value, "NumberLiteralTypeAnnotation", node);
7378
7385
  }
7379
- if (this.match(135)) {
7386
+ if (this.match(136)) {
7380
7387
  return this.parseLiteralAtNode(-this.state.value, "BigIntLiteralTypeAnnotation", node);
7381
7388
  }
7382
7389
  throw this.raise(FlowErrors.UnexpectedSubtractionOperand, this.state.startLoc);
7383
7390
  }
7384
7391
  this.unexpected();
7385
7392
  return;
7386
- case 134:
7387
- return this.parseLiteral(this.state.value, "NumberLiteralTypeAnnotation");
7388
7393
  case 135:
7394
+ return this.parseLiteral(this.state.value, "NumberLiteralTypeAnnotation");
7395
+ case 136:
7389
7396
  return this.parseLiteral(this.state.value, "BigIntLiteralTypeAnnotation");
7390
7397
  case 88:
7391
7398
  this.next();
@@ -7555,7 +7562,7 @@ var require_lib = __commonJS({
7555
7562
  this.next();
7556
7563
  return this.flowParseInterface(node);
7557
7564
  }
7558
- } else if (this.plugins.get("flow").enums && this.isContextual(126)) {
7565
+ } else if (this.isContextual(126)) {
7559
7566
  const node = this.startNode();
7560
7567
  this.next();
7561
7568
  return this.flowParseEnumDeclaration(node);
@@ -7588,7 +7595,7 @@ var require_lib = __commonJS({
7588
7595
  const {
7589
7596
  type
7590
7597
  } = this.state;
7591
- if (tokenIsFlowInterfaceOrTypeOrOpaque(type) || this.plugins.get("flow").enums && type === 126) {
7598
+ if (type === 126 || tokenIsFlowInterfaceOrTypeOrOpaque(type)) {
7592
7599
  return !this.state.containsEsc;
7593
7600
  }
7594
7601
  return super.shouldParseExportDeclaration();
@@ -7597,13 +7604,13 @@ var require_lib = __commonJS({
7597
7604
  const {
7598
7605
  type
7599
7606
  } = this.state;
7600
- if (tokenIsFlowInterfaceOrTypeOrOpaque(type) || this.plugins.get("flow").enums && type === 126) {
7607
+ if (type === 126 || tokenIsFlowInterfaceOrTypeOrOpaque(type)) {
7601
7608
  return this.state.containsEsc;
7602
7609
  }
7603
7610
  return super.isExportDefaultSpecifier();
7604
7611
  }
7605
7612
  parseExportDefaultExpression() {
7606
- if (this.plugins.get("flow").enums && this.isContextual(126)) {
7613
+ if (this.isContextual(126)) {
7607
7614
  const node = this.startNode();
7608
7615
  this.next();
7609
7616
  return this.flowParseEnumDeclaration(node);
@@ -7706,7 +7713,7 @@ var require_lib = __commonJS({
7706
7713
  }
7707
7714
  forwardNoArrowParamsConversionAt(node, parse2) {
7708
7715
  let result;
7709
- if (this.state.noArrowParamsConversionAt.includes(node.start)) {
7716
+ if (this.state.noArrowParamsConversionAt.includes(this.offsetToSourcePos(node.start))) {
7710
7717
  this.state.noArrowParamsConversionAt.push(this.state.start);
7711
7718
  result = parse2();
7712
7719
  this.state.noArrowParamsConversionAt.pop();
@@ -7757,7 +7764,7 @@ var require_lib = __commonJS({
7757
7764
  const declarationNode = this.startNode();
7758
7765
  this.next();
7759
7766
  return this.flowParseInterface(declarationNode);
7760
- } else if (this.plugins.get("flow").enums && this.isContextual(126)) {
7767
+ } else if (this.isContextual(126)) {
7761
7768
  node.exportKind = "value";
7762
7769
  const declarationNode = this.startNode();
7763
7770
  this.next();
@@ -8144,7 +8151,7 @@ var require_lib = __commonJS({
8144
8151
  var _jsx;
8145
8152
  let state2 = null;
8146
8153
  let jsx2;
8147
- if (this.hasPlugin("jsx") && (this.match(142) || this.match(47))) {
8154
+ if (this.hasPlugin("jsx") && (this.match(143) || this.match(47))) {
8148
8155
  state2 = this.state.clone();
8149
8156
  jsx2 = this.tryParse(() => super.parseMaybeAssign(refExpressionErrors, afterLeftParse), state2);
8150
8157
  if (!jsx2.error)
@@ -8230,14 +8237,14 @@ var require_lib = __commonJS({
8230
8237
  return this.match(14) || super.shouldParseArrow(params);
8231
8238
  }
8232
8239
  setArrowFunctionParameters(node, params) {
8233
- if (this.state.noArrowParamsConversionAt.includes(node.start)) {
8240
+ if (this.state.noArrowParamsConversionAt.includes(this.offsetToSourcePos(node.start))) {
8234
8241
  node.params = params;
8235
8242
  } else {
8236
8243
  super.setArrowFunctionParameters(node, params);
8237
8244
  }
8238
8245
  }
8239
8246
  checkParams(node, allowDuplicates, isArrowFunction, strictModeChanged = true) {
8240
- if (isArrowFunction && this.state.noArrowParamsConversionAt.includes(node.start)) {
8247
+ if (isArrowFunction && this.state.noArrowParamsConversionAt.includes(this.offsetToSourcePos(node.start))) {
8241
8248
  return;
8242
8249
  }
8243
8250
  for (let i = 0; i < node.params.length; i++) {
@@ -8248,14 +8255,14 @@ var require_lib = __commonJS({
8248
8255
  super.checkParams(node, allowDuplicates, isArrowFunction, strictModeChanged);
8249
8256
  }
8250
8257
  parseParenAndDistinguishExpression(canBeArrow) {
8251
- return super.parseParenAndDistinguishExpression(canBeArrow && !this.state.noArrowAt.includes(this.state.start));
8258
+ return super.parseParenAndDistinguishExpression(canBeArrow && !this.state.noArrowAt.includes(this.sourceToOffsetPos(this.state.start)));
8252
8259
  }
8253
8260
  parseSubscripts(base, startLoc, noCalls) {
8254
8261
  if (base.type === "Identifier" && base.name === "async" && this.state.noArrowAt.includes(startLoc.index)) {
8255
8262
  this.next();
8256
8263
  const node = this.startNodeAt(startLoc);
8257
8264
  node.callee = base;
8258
- node.arguments = super.parseCallExpressionArguments(11, false);
8265
+ node.arguments = super.parseCallExpressionArguments(11);
8259
8266
  base = this.finishNode(node, "CallExpression");
8260
8267
  } else if (base.type === "Identifier" && base.name === "async" && this.match(47)) {
8261
8268
  const state2 = this.state.clone();
@@ -8289,7 +8296,7 @@ var require_lib = __commonJS({
8289
8296
  node.callee = base;
8290
8297
  node.typeArguments = this.flowParseTypeParameterInstantiation();
8291
8298
  this.expect(10);
8292
- node.arguments = this.parseCallExpressionArguments(11, false);
8299
+ node.arguments = this.parseCallExpressionArguments(11);
8293
8300
  node.optional = true;
8294
8301
  return this.finishCallExpression(node, true);
8295
8302
  } else if (!noCalls && this.shouldParseTypes() && this.match(47)) {
@@ -8298,7 +8305,7 @@ var require_lib = __commonJS({
8298
8305
  const result = this.tryParse(() => {
8299
8306
  node.typeArguments = this.flowParseTypeParameterInstantiationCallOrNew();
8300
8307
  this.expect(10);
8301
- node.arguments = super.parseCallExpressionArguments(11, false);
8308
+ node.arguments = super.parseCallExpressionArguments(11);
8302
8309
  if (subscriptState.optionalChainMember) {
8303
8310
  node.optional = false;
8304
8311
  }
@@ -8416,7 +8423,7 @@ var require_lib = __commonJS({
8416
8423
  const startLoc = this.state.startLoc;
8417
8424
  const endOfInit = () => this.match(12) || this.match(8);
8418
8425
  switch (this.state.type) {
8419
- case 134: {
8426
+ case 135: {
8420
8427
  const literal = this.parseNumericLiteral(this.state.value);
8421
8428
  if (endOfInit()) {
8422
8429
  return {
@@ -8430,7 +8437,7 @@ var require_lib = __commonJS({
8430
8437
  loc: startLoc
8431
8438
  };
8432
8439
  }
8433
- case 133: {
8440
+ case 134: {
8434
8441
  const literal = this.parseStringLiteral(this.state.value);
8435
8442
  if (endOfInit()) {
8436
8443
  return {
@@ -9028,14 +9035,14 @@ var require_lib = __commonJS({
9028
9035
  if (this.state.pos === this.state.start) {
9029
9036
  if (ch === 60 && this.state.canStartJSXElement) {
9030
9037
  ++this.state.pos;
9031
- this.finishToken(142);
9038
+ this.finishToken(143);
9032
9039
  } else {
9033
9040
  super.getTokenFromCode(ch);
9034
9041
  }
9035
9042
  return;
9036
9043
  }
9037
9044
  out += this.input.slice(chunkStart, this.state.pos);
9038
- this.finishToken(141, out);
9045
+ this.finishToken(142, out);
9039
9046
  return;
9040
9047
  case 38:
9041
9048
  out += this.input.slice(chunkStart, this.state.pos);
@@ -9092,7 +9099,7 @@ var require_lib = __commonJS({
9092
9099
  }
9093
9100
  }
9094
9101
  out += this.input.slice(chunkStart, this.state.pos++);
9095
- this.finishToken(133, out);
9102
+ this.finishToken(134, out);
9096
9103
  }
9097
9104
  jsxReadEntity() {
9098
9105
  const startPos = ++this.state.pos;
@@ -9132,11 +9139,11 @@ var require_lib = __commonJS({
9132
9139
  do {
9133
9140
  ch = this.input.charCodeAt(++this.state.pos);
9134
9141
  } while (isIdentifierChar(ch) || ch === 45);
9135
- this.finishToken(140, this.input.slice(start, this.state.pos));
9142
+ this.finishToken(141, this.input.slice(start, this.state.pos));
9136
9143
  }
9137
9144
  jsxParseIdentifier() {
9138
9145
  const node = this.startNode();
9139
- if (this.match(140)) {
9146
+ if (this.match(141)) {
9140
9147
  node.name = this.state.value;
9141
9148
  } else if (tokenIsKeyword(this.state.type)) {
9142
9149
  node.name = tokenLabelName(this.state.type);
@@ -9182,8 +9189,8 @@ var require_lib = __commonJS({
9182
9189
  this.raise(JsxErrors.AttributeIsEmpty, node);
9183
9190
  }
9184
9191
  return node;
9185
- case 142:
9186
- case 133:
9192
+ case 143:
9193
+ case 134:
9187
9194
  return this.parseExprAtom();
9188
9195
  default:
9189
9196
  throw this.raise(JsxErrors.UnsupportedJsxValue, this.state.startLoc);
@@ -9231,7 +9238,7 @@ var require_lib = __commonJS({
9231
9238
  }
9232
9239
  jsxParseOpeningElementAt(startLoc) {
9233
9240
  const node = this.startNodeAt(startLoc);
9234
- if (this.eat(143)) {
9241
+ if (this.eat(144)) {
9235
9242
  return this.finishNode(node, "JSXOpeningFragment");
9236
9243
  }
9237
9244
  node.name = this.jsxParseElementName();
@@ -9239,21 +9246,21 @@ var require_lib = __commonJS({
9239
9246
  }
9240
9247
  jsxParseOpeningElementAfterName(node) {
9241
9248
  const attributes = [];
9242
- while (!this.match(56) && !this.match(143)) {
9249
+ while (!this.match(56) && !this.match(144)) {
9243
9250
  attributes.push(this.jsxParseAttribute());
9244
9251
  }
9245
9252
  node.attributes = attributes;
9246
9253
  node.selfClosing = this.eat(56);
9247
- this.expect(143);
9254
+ this.expect(144);
9248
9255
  return this.finishNode(node, "JSXOpeningElement");
9249
9256
  }
9250
9257
  jsxParseClosingElementAt(startLoc) {
9251
9258
  const node = this.startNodeAt(startLoc);
9252
- if (this.eat(143)) {
9259
+ if (this.eat(144)) {
9253
9260
  return this.finishNode(node, "JSXClosingFragment");
9254
9261
  }
9255
9262
  node.name = this.jsxParseElementName();
9256
- this.expect(143);
9263
+ this.expect(144);
9257
9264
  return this.finishNode(node, "JSXClosingElement");
9258
9265
  }
9259
9266
  jsxParseElementAt(startLoc) {
@@ -9265,7 +9272,7 @@ var require_lib = __commonJS({
9265
9272
  contents:
9266
9273
  for (; ; ) {
9267
9274
  switch (this.state.type) {
9268
- case 142:
9275
+ case 143:
9269
9276
  startLoc = this.state.startLoc;
9270
9277
  this.next();
9271
9278
  if (this.eat(56)) {
@@ -9274,7 +9281,7 @@ var require_lib = __commonJS({
9274
9281
  }
9275
9282
  children.push(this.jsxParseElementAt(startLoc));
9276
9283
  break;
9277
- case 141:
9284
+ case 142:
9278
9285
  children.push(this.parseLiteral(this.state.value, "JSXText"));
9279
9286
  break;
9280
9287
  case 5: {
@@ -9331,10 +9338,10 @@ var require_lib = __commonJS({
9331
9338
  context[context.length - 1] = newContext;
9332
9339
  }
9333
9340
  parseExprAtom(refExpressionErrors) {
9334
- if (this.match(142)) {
9341
+ if (this.match(143)) {
9335
9342
  return this.jsxParseElement();
9336
9343
  } else if (this.match(47) && this.input.charCodeAt(this.state.pos) !== 33) {
9337
- this.replaceToken(142);
9344
+ this.replaceToken(143);
9338
9345
  return this.jsxParseElement();
9339
9346
  } else {
9340
9347
  return super.parseExprAtom(refExpressionErrors);
@@ -9358,7 +9365,7 @@ var require_lib = __commonJS({
9358
9365
  }
9359
9366
  if (code2 === 62) {
9360
9367
  ++this.state.pos;
9361
- this.finishToken(143);
9368
+ this.finishToken(144);
9362
9369
  return;
9363
9370
  }
9364
9371
  if ((code2 === 34 || code2 === 39) && context === types.j_oTag) {
@@ -9368,7 +9375,7 @@ var require_lib = __commonJS({
9368
9375
  }
9369
9376
  if (code2 === 60 && this.state.canStartJSXElement && this.input.charCodeAt(this.state.pos + 1) !== 33) {
9370
9377
  ++this.state.pos;
9371
- this.finishToken(142);
9378
+ this.finishToken(143);
9372
9379
  return;
9373
9380
  }
9374
9381
  super.getTokenFromCode(code2);
@@ -9378,12 +9385,12 @@ var require_lib = __commonJS({
9378
9385
  context,
9379
9386
  type
9380
9387
  } = this.state;
9381
- if (type === 56 && prevType === 142) {
9388
+ if (type === 56 && prevType === 143) {
9382
9389
  context.splice(-2, 2, types.j_cTag);
9383
9390
  this.state.canStartJSXElement = false;
9384
- } else if (type === 142) {
9385
- context.push(types.j_oTag);
9386
9391
  } else if (type === 143) {
9392
+ context.push(types.j_oTag);
9393
+ } else if (type === 144) {
9387
9394
  const out = context[context.length - 1];
9388
9395
  if (out === types.j_oTag && prevType === 56 || out === types.j_cTag) {
9389
9396
  context.pop();
@@ -9740,7 +9747,7 @@ var require_lib = __commonJS({
9740
9747
  return this.parseBindingRestProperty(this.startNode());
9741
9748
  }
9742
9749
  const prop = this.startNode();
9743
- if (type === 138) {
9750
+ if (type === 139) {
9744
9751
  this.expectPlugin("destructuringPrivate", startLoc);
9745
9752
  this.classScope.usePrivateName(this.state.value, startLoc);
9746
9753
  prop.key = this.parsePrivateName();
@@ -10068,7 +10075,7 @@ var require_lib = __commonJS({
10068
10075
  return tokenIsIdentifier(this.state.type);
10069
10076
  }
10070
10077
  tsTokenCanFollowModifier() {
10071
- return this.match(0) || this.match(5) || this.match(55) || this.match(21) || this.match(138) || this.isLiteralPropertyName();
10078
+ return this.match(0) || this.match(5) || this.match(55) || this.match(21) || this.match(139) || this.isLiteralPropertyName();
10072
10079
  }
10073
10080
  tsNextTokenOnSameLineAndCanFollowModifier() {
10074
10081
  this.next();
@@ -10240,22 +10247,16 @@ var require_lib = __commonJS({
10240
10247
  const node = this.startNode();
10241
10248
  this.expect(83);
10242
10249
  this.expect(10);
10243
- if (!this.match(133)) {
10250
+ if (!this.match(134)) {
10244
10251
  this.raise(TSErrors.UnsupportedImportTypeArgument, this.state.startLoc);
10245
10252
  }
10246
10253
  node.argument = super.parseExprAtom();
10247
- if (this.hasPlugin("importAttributes") || this.hasPlugin("importAssertions")) {
10254
+ if (this.eat(12) && !this.match(11)) {
10255
+ node.options = super.parseMaybeAssignAllowIn();
10256
+ this.eat(12);
10257
+ } else {
10248
10258
  node.options = null;
10249
10259
  }
10250
- if (this.eat(12)) {
10251
- if (!this.hasPlugin("importAssertions")) {
10252
- this.expectPlugin("importAttributes");
10253
- }
10254
- if (!this.match(11)) {
10255
- node.options = super.parseMaybeAssignAllowIn();
10256
- this.eat(12);
10257
- }
10258
- }
10259
10260
  this.expect(11);
10260
10261
  if (this.eat(16)) {
10261
10262
  node.qualifier = this.tsParseEntityName();
@@ -10324,7 +10325,7 @@ var require_lib = __commonJS({
10324
10325
  }
10325
10326
  tsParseTypeParameters(parseModifiers) {
10326
10327
  const node = this.startNode();
10327
- if (this.match(47) || this.match(142)) {
10328
+ if (this.match(47) || this.match(143)) {
10328
10329
  this.next();
10329
10330
  } else {
10330
10331
  this.unexpected();
@@ -10653,9 +10654,9 @@ var require_lib = __commonJS({
10653
10654
  tsParseLiteralTypeNode() {
10654
10655
  const node = this.startNode();
10655
10656
  switch (this.state.type) {
10656
- case 134:
10657
10657
  case 135:
10658
- case 133:
10658
+ case 136:
10659
+ case 134:
10659
10660
  case 85:
10660
10661
  case 86:
10661
10662
  node.literal = super.parseExprAtom();
@@ -10685,9 +10686,9 @@ var require_lib = __commonJS({
10685
10686
  }
10686
10687
  tsParseNonArrayType() {
10687
10688
  switch (this.state.type) {
10688
- case 133:
10689
10689
  case 134:
10690
10690
  case 135:
10691
+ case 136:
10691
10692
  case 85:
10692
10693
  case 86:
10693
10694
  return this.tsParseLiteralTypeNode();
@@ -10695,7 +10696,7 @@ var require_lib = __commonJS({
10695
10696
  if (this.state.value === "-") {
10696
10697
  const node = this.startNode();
10697
10698
  const nextToken = this.lookahead();
10698
- if (nextToken.type !== 134 && nextToken.type !== 135) {
10699
+ if (nextToken.type !== 135 && nextToken.type !== 136) {
10699
10700
  this.unexpected();
10700
10701
  }
10701
10702
  node.literal = this.parseMaybeUnary();
@@ -11103,7 +11104,7 @@ var require_lib = __commonJS({
11103
11104
  }
11104
11105
  tsParseEnumMember() {
11105
11106
  const node = this.startNode();
11106
- node.id = this.match(133) ? super.parseStringLiteral(this.state.value) : this.parseIdentifier(true);
11107
+ node.id = this.match(134) ? super.parseStringLiteral(this.state.value) : this.parseIdentifier(true);
11107
11108
  if (this.eat(29)) {
11108
11109
  node.initializer = super.parseMaybeAssignAllowIn();
11109
11110
  }
@@ -11150,9 +11151,11 @@ var require_lib = __commonJS({
11150
11151
  }
11151
11152
  tsParseAmbientExternalModuleDeclaration(node) {
11152
11153
  if (this.isContextual(112)) {
11154
+ node.kind = "global";
11153
11155
  node.global = true;
11154
11156
  node.id = this.parseIdentifier();
11155
- } else if (this.match(133)) {
11157
+ } else if (this.match(134)) {
11158
+ node.kind = "module";
11156
11159
  node.id = super.parseStringLiteral(this.state.value);
11157
11160
  } else {
11158
11161
  this.unexpected();
@@ -11191,7 +11194,7 @@ var require_lib = __commonJS({
11191
11194
  const node = this.startNode();
11192
11195
  this.expectContextual(119);
11193
11196
  this.expect(10);
11194
- if (!this.match(133)) {
11197
+ if (!this.match(134)) {
11195
11198
  this.unexpected();
11196
11199
  }
11197
11200
  node.expression = super.parseExprAtom();
@@ -11287,6 +11290,7 @@ var require_lib = __commonJS({
11287
11290
  this.scope.enter(256);
11288
11291
  this.prodParam.enter(0);
11289
11292
  const mod = node;
11293
+ mod.kind = "global";
11290
11294
  mod.global = true;
11291
11295
  mod.id = expr;
11292
11296
  mod.body = this.tsParseModuleBlock();
@@ -11308,15 +11312,17 @@ var require_lib = __commonJS({
11308
11312
  break;
11309
11313
  case "module":
11310
11314
  if (this.tsCheckLineTerminator(next)) {
11311
- if (this.match(133)) {
11315
+ if (this.match(134)) {
11312
11316
  return this.tsParseAmbientExternalModuleDeclaration(node);
11313
11317
  } else if (tokenIsIdentifier(this.state.type)) {
11318
+ node.kind = "module";
11314
11319
  return this.tsParseModuleOrNamespaceDeclaration(node);
11315
11320
  }
11316
11321
  }
11317
11322
  break;
11318
11323
  case "namespace":
11319
11324
  if (this.tsCheckLineTerminator(next) && tokenIsIdentifier(this.state.type)) {
11325
+ node.kind = "namespace";
11320
11326
  return this.tsParseModuleOrNamespaceDeclaration(node);
11321
11327
  }
11322
11328
  break;
@@ -11517,7 +11523,7 @@ var require_lib = __commonJS({
11517
11523
  if (!noCalls && this.eat(10)) {
11518
11524
  const node2 = this.startNodeAt(startLoc);
11519
11525
  node2.callee = base;
11520
- node2.arguments = this.parseCallExpressionArguments(11, false);
11526
+ node2.arguments = this.parseCallExpressionArguments(11);
11521
11527
  this.tsCheckForInvalidTypeCasts(node2.arguments);
11522
11528
  node2.typeParameters = typeArguments;
11523
11529
  if (state2.optionalChainMember) {
@@ -11611,7 +11617,7 @@ var require_lib = __commonJS({
11611
11617
  }
11612
11618
  }
11613
11619
  parseImport(node) {
11614
- if (this.match(133)) {
11620
+ if (this.match(134)) {
11615
11621
  node.importKind = "value";
11616
11622
  return super.parseImport(node);
11617
11623
  }
@@ -11889,7 +11895,7 @@ var require_lib = __commonJS({
11889
11895
  key
11890
11896
  } = node;
11891
11897
  this.raise(TSErrors.AbstractPropertyHasInitializer, this.state.startLoc, {
11892
- propertyName: key.type === "Identifier" && !node.computed ? key.name : `[${this.input.slice(key.start, key.end)}]`
11898
+ propertyName: key.type === "Identifier" && !node.computed ? key.name : `[${this.input.slice(this.offsetToSourcePos(key.start), this.offsetToSourcePos(key.end))}]`
11893
11899
  });
11894
11900
  }
11895
11901
  return super.parseClassProperty(node);
@@ -11988,7 +11994,7 @@ var require_lib = __commonJS({
11988
11994
  let state2;
11989
11995
  let jsx2;
11990
11996
  let typeCast;
11991
- if (this.hasPlugin("jsx") && (this.match(142) || this.match(47))) {
11997
+ if (this.hasPlugin("jsx") && (this.match(143) || this.match(47))) {
11992
11998
  state2 = this.state.clone();
11993
11999
  jsx2 = this.tryParse(() => super.parseMaybeAssign(refExpressionErrors, afterLeftParse), state2);
11994
12000
  if (!jsx2.error)
@@ -12333,7 +12339,7 @@ var require_lib = __commonJS({
12333
12339
  key
12334
12340
  } = method;
12335
12341
  this.raise(TSErrors.AbstractMethodHasImplementation, method, {
12336
- methodName: key.type === "Identifier" && !method.computed ? key.name : `[${this.input.slice(key.start, key.end)}]`
12342
+ methodName: key.type === "Identifier" && !method.computed ? key.name : `[${this.input.slice(this.offsetToSourcePos(key.start), this.offsetToSourcePos(key.end))}]`
12337
12343
  });
12338
12344
  }
12339
12345
  }
@@ -12508,13 +12514,13 @@ var require_lib = __commonJS({
12508
12514
  });
12509
12515
  var placeholders = (superClass) => class PlaceholdersParserMixin extends superClass {
12510
12516
  parsePlaceholder(expectedNode) {
12511
- if (this.match(144)) {
12517
+ if (this.match(133)) {
12512
12518
  const node = this.startNode();
12513
12519
  this.next();
12514
12520
  this.assertNoSpace();
12515
12521
  node.name = super.parseIdentifier(true);
12516
12522
  this.assertNoSpace();
12517
- this.expect(144);
12523
+ this.expect(133);
12518
12524
  return this.finishPlaceholder(node, expectedNode);
12519
12525
  }
12520
12526
  }
@@ -12528,7 +12534,7 @@ var require_lib = __commonJS({
12528
12534
  }
12529
12535
  getTokenFromCode(code2) {
12530
12536
  if (code2 === 37 && this.input.charCodeAt(this.state.pos + 1) === 37) {
12531
- this.finishOp(144, 2);
12537
+ this.finishOp(133, 2);
12532
12538
  } else {
12533
12539
  super.getTokenFromCode(code2);
12534
12540
  }
@@ -12562,7 +12568,7 @@ var require_lib = __commonJS({
12562
12568
  return true;
12563
12569
  }
12564
12570
  const nextToken = this.lookahead();
12565
- if (nextToken.type === 144) {
12571
+ if (nextToken.type === 133) {
12566
12572
  return true;
12567
12573
  }
12568
12574
  return false;
@@ -12601,7 +12607,7 @@ var require_lib = __commonJS({
12601
12607
  const oldStrict = this.state.strict;
12602
12608
  const placeholder = this.parsePlaceholder("Identifier");
12603
12609
  if (placeholder) {
12604
- if (this.match(81) || this.match(144) || this.match(5)) {
12610
+ if (this.match(81) || this.match(133) || this.match(5)) {
12605
12611
  node.id = placeholder;
12606
12612
  } else if (optionalId || !isStatement) {
12607
12613
  node.id = null;
@@ -12638,7 +12644,7 @@ var require_lib = __commonJS({
12638
12644
  if (this.match(65)) {
12639
12645
  const next = this.nextTokenStart();
12640
12646
  if (this.isUnparsedContextual(next, "from")) {
12641
- if (this.input.startsWith(tokenLabelName(144), this.nextTokenStartSince(next + 4))) {
12647
+ if (this.input.startsWith(tokenLabelName(133), this.nextTokenStartSince(next + 4))) {
12642
12648
  return true;
12643
12649
  }
12644
12650
  }
@@ -12689,7 +12695,7 @@ var require_lib = __commonJS({
12689
12695
  return this.parsePlaceholder("StringLiteral") || super.parseImportSource();
12690
12696
  }
12691
12697
  assertNoSpace() {
12692
- if (this.state.start > this.state.lastTokEndLoc.index) {
12698
+ if (this.state.start > this.offsetToSourcePos(this.state.lastTokEndLoc.index)) {
12693
12699
  this.raise(PlaceholderErrors.UnexpectedSpace, this.state.lastTokEndLoc);
12694
12700
  }
12695
12701
  }
@@ -12766,8 +12772,8 @@ var require_lib = __commonJS({
12766
12772
  }
12767
12773
  if (pluginsMap.has("moduleAttributes")) {
12768
12774
  {
12769
- if (pluginsMap.has("importAttributes") || pluginsMap.has("importAssertions")) {
12770
- throw new Error("Cannot combine importAssertions, importAttributes and moduleAttributes plugins.");
12775
+ if (pluginsMap.has("deprecatedImportAssert") || pluginsMap.has("importAssertions")) {
12776
+ throw new Error("Cannot combine importAssertions, deprecatedImportAssert and moduleAttributes plugins.");
12771
12777
  }
12772
12778
  const moduleAttributesVersionPluginOption = pluginsMap.get("moduleAttributes").version;
12773
12779
  if (moduleAttributesVersionPluginOption !== "may-2020") {
@@ -12776,8 +12782,13 @@ var require_lib = __commonJS({
12776
12782
  }
12777
12783
  }
12778
12784
  if (pluginsMap.has("importAssertions")) {
12779
- if (pluginsMap.has("importAttributes")) {
12780
- throw new Error("Cannot combine importAssertions and importAttributes plugins.");
12785
+ if (pluginsMap.has("deprecatedImportAssert")) {
12786
+ throw new Error("Cannot combine importAssertions and deprecatedImportAssert plugins.");
12787
+ }
12788
+ }
12789
+ if (!pluginsMap.has("deprecatedImportAssert") && pluginsMap.has("importAttributes") && pluginsMap.get("importAttributes").deprecatedAssertSyntax) {
12790
+ {
12791
+ pluginsMap.set("deprecatedImportAssert", {});
12781
12792
  }
12782
12793
  }
12783
12794
  if (pluginsMap.has("recordAndTuple")) {
@@ -12809,38 +12820,52 @@ var require_lib = __commonJS({
12809
12820
  placeholders
12810
12821
  };
12811
12822
  var mixinPluginNames = Object.keys(mixinPlugins);
12812
- var defaultOptions = {
12813
- sourceType: "script",
12814
- sourceFilename: void 0,
12815
- startColumn: 0,
12816
- startLine: 1,
12817
- allowAwaitOutsideFunction: false,
12818
- allowReturnOutsideFunction: false,
12819
- allowNewTargetOutsideFunction: false,
12820
- allowImportExportEverywhere: false,
12821
- allowSuperOutsideMethod: false,
12822
- allowUndeclaredExports: false,
12823
- plugins: [],
12824
- strictMode: null,
12825
- ranges: false,
12826
- tokens: false,
12827
- createImportExpressions: false,
12828
- createParenthesizedExpressions: false,
12829
- errorRecovery: false,
12830
- attachComment: true,
12831
- annexB: true
12832
- };
12823
+ function createDefaultOptions() {
12824
+ return {
12825
+ sourceType: "script",
12826
+ sourceFilename: void 0,
12827
+ startIndex: 0,
12828
+ startColumn: 0,
12829
+ startLine: 1,
12830
+ allowAwaitOutsideFunction: false,
12831
+ allowReturnOutsideFunction: false,
12832
+ allowNewTargetOutsideFunction: false,
12833
+ allowImportExportEverywhere: false,
12834
+ allowSuperOutsideMethod: false,
12835
+ allowUndeclaredExports: false,
12836
+ plugins: [],
12837
+ strictMode: null,
12838
+ ranges: false,
12839
+ tokens: false,
12840
+ createImportExpressions: false,
12841
+ createParenthesizedExpressions: false,
12842
+ errorRecovery: false,
12843
+ attachComment: true,
12844
+ annexB: true
12845
+ };
12846
+ }
12833
12847
  function getOptions(opts) {
12848
+ const options = createDefaultOptions();
12834
12849
  if (opts == null) {
12835
- return Object.assign({}, defaultOptions);
12850
+ return options;
12836
12851
  }
12837
12852
  if (opts.annexB != null && opts.annexB !== false) {
12838
12853
  throw new Error("The `annexB` option can only be set to `false`.");
12839
12854
  }
12840
- const options = {};
12841
- for (const key of Object.keys(defaultOptions)) {
12842
- var _opts$key;
12843
- options[key] = (_opts$key = opts[key]) != null ? _opts$key : defaultOptions[key];
12855
+ for (const key of Object.keys(options)) {
12856
+ if (opts[key] != null)
12857
+ options[key] = opts[key];
12858
+ }
12859
+ if (options.startLine === 1) {
12860
+ if (opts.startIndex == null && options.startColumn > 0) {
12861
+ options.startIndex = options.startColumn;
12862
+ } else if (opts.startColumn == null && options.startIndex > 0) {
12863
+ options.startColumn = options.startIndex;
12864
+ }
12865
+ } else if (opts.startColumn == null || opts.startIndex == null) {
12866
+ if (opts.startIndex != null) {
12867
+ throw new Error("With a `startLine > 1` you must also specify `startIndex` and `startColumn`.");
12868
+ }
12844
12869
  }
12845
12870
  return options;
12846
12871
  }
@@ -12869,13 +12894,13 @@ var require_lib = __commonJS({
12869
12894
  }
12870
12895
  }
12871
12896
  shouldExitDescending(expr, potentialArrowAt) {
12872
- return expr.type === "ArrowFunctionExpression" && expr.start === potentialArrowAt;
12897
+ return expr.type === "ArrowFunctionExpression" && this.offsetToSourcePos(expr.start) === potentialArrowAt;
12873
12898
  }
12874
12899
  getExpression() {
12875
12900
  this.enterInitialScopes();
12876
12901
  this.nextToken();
12877
12902
  const expr = this.parseExpression();
12878
- if (!this.match(139)) {
12903
+ if (!this.match(140)) {
12879
12904
  this.unexpected();
12880
12905
  }
12881
12906
  this.finalizeRemainingComments();
@@ -12995,7 +13020,7 @@ var require_lib = __commonJS({
12995
13020
  return expr;
12996
13021
  }
12997
13022
  parseMaybeUnaryOrPrivate(refExpressionErrors) {
12998
- return this.match(138) ? this.parsePrivateName() : this.parseMaybeUnary(refExpressionErrors);
13023
+ return this.match(139) ? this.parsePrivateName() : this.parseMaybeUnary(refExpressionErrors);
12999
13024
  }
13000
13025
  parseExprOps(refExpressionErrors) {
13001
13026
  const startLoc = this.state.startLoc;
@@ -13236,7 +13261,7 @@ var require_lib = __commonJS({
13236
13261
  if (computed12) {
13237
13262
  node.property = this.parseExpression();
13238
13263
  this.expect(3);
13239
- } else if (this.match(138)) {
13264
+ } else if (this.match(139)) {
13240
13265
  if (base.type === "Super") {
13241
13266
  this.raise(Errors.SuperPrivateField, startLoc);
13242
13267
  }
@@ -13281,7 +13306,7 @@ var require_lib = __commonJS({
13281
13306
  if (optional) {
13282
13307
  node.arguments = this.parseCallExpressionArguments(11);
13283
13308
  } else {
13284
- node.arguments = this.parseCallExpressionArguments(11, base.type === "Import", base.type !== "Super", node, refExpressionErrors);
13309
+ node.arguments = this.parseCallExpressionArguments(11, base.type !== "Super", node, refExpressionErrors);
13285
13310
  }
13286
13311
  let finishedNode = this.finishCallExpression(node, optionalChainMember);
13287
13312
  if (maybeAsyncArrow && this.shouldParseAsyncArrow() && !optional) {
@@ -13313,19 +13338,12 @@ var require_lib = __commonJS({
13313
13338
  return this.finishNode(node, "TaggedTemplateExpression");
13314
13339
  }
13315
13340
  atPossibleAsyncArrow(base) {
13316
- return base.type === "Identifier" && base.name === "async" && this.state.lastTokEndLoc.index === base.end && !this.canInsertSemicolon() && base.end - base.start === 5 && base.start === this.state.potentialArrowAt;
13341
+ return base.type === "Identifier" && base.name === "async" && this.state.lastTokEndLoc.index === base.end && !this.canInsertSemicolon() && base.end - base.start === 5 && this.offsetToSourcePos(base.start) === this.state.potentialArrowAt;
13317
13342
  }
13318
13343
  finishCallExpression(node, optional) {
13319
13344
  if (node.callee.type === "Import") {
13320
- if (node.arguments.length === 2) {
13321
- if (!(this.hasPlugin("moduleAttributes") || this.hasPlugin("importAssertions"))) {
13322
- this.expectPlugin("importAttributes");
13323
- }
13324
- }
13325
13345
  if (node.arguments.length === 0 || node.arguments.length > 2) {
13326
- this.raise(Errors.ImportCallArity, node, {
13327
- maxArgumentCount: this.hasPlugin("importAttributes") || this.hasPlugin("importAssertions") || this.hasPlugin("moduleAttributes") ? 2 : 1
13328
- });
13346
+ this.raise(Errors.ImportCallArity, node);
13329
13347
  } else {
13330
13348
  for (const arg of node.arguments) {
13331
13349
  if (arg.type === "SpreadElement") {
@@ -13336,7 +13354,7 @@ var require_lib = __commonJS({
13336
13354
  }
13337
13355
  return this.finishNode(node, optional ? "OptionalCallExpression" : "CallExpression");
13338
13356
  }
13339
- parseCallExpressionArguments(close, dynamicImport, allowPlaceholder, nodeForExtra, refExpressionErrors) {
13357
+ parseCallExpressionArguments(close, allowPlaceholder, nodeForExtra, refExpressionErrors) {
13340
13358
  const elts = [];
13341
13359
  let first = true;
13342
13360
  const oldInFSharpPipelineDirectBody = this.state.inFSharpPipelineDirectBody;
@@ -13347,9 +13365,6 @@ var require_lib = __commonJS({
13347
13365
  } else {
13348
13366
  this.expect(12);
13349
13367
  if (this.match(close)) {
13350
- if (dynamicImport && !this.hasPlugin("importAttributes") && !this.hasPlugin("importAssertions") && !this.hasPlugin("moduleAttributes")) {
13351
- this.raise(Errors.ImportCallArgumentTrailingComma, this.state.lastTokStartLoc);
13352
- }
13353
13368
  if (nodeForExtra) {
13354
13369
  this.addTrailingCommaExtraToNode(nodeForExtra);
13355
13370
  }
@@ -13419,11 +13434,11 @@ var require_lib = __commonJS({
13419
13434
  this.readRegexp();
13420
13435
  return this.parseRegExpLiteral(this.state.value);
13421
13436
  }
13422
- case 134:
13423
- return this.parseNumericLiteral(this.state.value);
13424
13437
  case 135:
13438
+ return this.parseNumericLiteral(this.state.value);
13439
+ case 136:
13425
13440
  return this.parseBigIntLiteral(this.state.value);
13426
- case 133:
13441
+ case 134:
13427
13442
  return this.parseStringLiteral(this.state.value);
13428
13443
  case 84:
13429
13444
  return this.parseNullLiteral();
@@ -13471,7 +13486,7 @@ var require_lib = __commonJS({
13471
13486
  throw this.raise(Errors.UnsupportedBind, callee);
13472
13487
  }
13473
13488
  }
13474
- case 138: {
13489
+ case 139: {
13475
13490
  this.raise(Errors.PrivateInExpectedIn, this.state.startLoc, {
13476
13491
  identifierName: this.state.value
13477
13492
  });
@@ -13507,7 +13522,7 @@ var require_lib = __commonJS({
13507
13522
  break;
13508
13523
  }
13509
13524
  default:
13510
- if (type === 136) {
13525
+ if (type === 137) {
13511
13526
  return this.parseDecimalLiteral(this.state.value);
13512
13527
  }
13513
13528
  if (tokenIsIdentifier(type)) {
@@ -13696,7 +13711,7 @@ var require_lib = __commonJS({
13696
13711
  }
13697
13712
  parseLiteralAtNode(value, type, node) {
13698
13713
  this.addExtra(node, "rawValue", value);
13699
- this.addExtra(node, "raw", this.input.slice(node.start, this.state.end));
13714
+ this.addExtra(node, "raw", this.input.slice(this.offsetToSourcePos(node.start), this.state.end));
13700
13715
  node.value = value;
13701
13716
  this.next();
13702
13717
  return this.finishNode(node, type);
@@ -13719,7 +13734,7 @@ var require_lib = __commonJS({
13719
13734
  }
13720
13735
  parseRegExpLiteral(value) {
13721
13736
  const node = this.startNode();
13722
- this.addExtra(node, "raw", this.input.slice(node.start, this.state.end));
13737
+ this.addExtra(node, "raw", this.input.slice(this.offsetToSourcePos(node.start), this.state.end));
13723
13738
  node.pattern = value.pattern;
13724
13739
  node.flags = value.flags;
13725
13740
  this.next();
@@ -14095,16 +14110,16 @@ var require_lib = __commonJS({
14095
14110
  key = this.parseIdentifier(true);
14096
14111
  } else {
14097
14112
  switch (type) {
14098
- case 134:
14113
+ case 135:
14099
14114
  key = this.parseNumericLiteral(value);
14100
14115
  break;
14101
- case 133:
14116
+ case 134:
14102
14117
  key = this.parseStringLiteral(value);
14103
14118
  break;
14104
- case 135:
14119
+ case 136:
14105
14120
  key = this.parseBigIntLiteral(value);
14106
14121
  break;
14107
- case 138: {
14122
+ case 139: {
14108
14123
  const privateKeyLoc = this.state.startLoc;
14109
14124
  if (refExpressionErrors != null) {
14110
14125
  if (refExpressionErrors.privateKeyLoc === null) {
@@ -14117,7 +14132,7 @@ var require_lib = __commonJS({
14117
14132
  break;
14118
14133
  }
14119
14134
  default:
14120
- if (type === 136) {
14135
+ if (type === 137) {
14121
14136
  key = this.parseDecimalLiteral(value);
14122
14137
  break;
14123
14138
  }
@@ -14125,7 +14140,7 @@ var require_lib = __commonJS({
14125
14140
  }
14126
14141
  }
14127
14142
  prop.key = key;
14128
- if (type !== 138) {
14143
+ if (type !== 139) {
14129
14144
  prop.computed = false;
14130
14145
  }
14131
14146
  }
@@ -14381,7 +14396,7 @@ var require_lib = __commonJS({
14381
14396
  const {
14382
14397
  type
14383
14398
  } = this.state;
14384
- return type === 53 || type === 10 || type === 0 || tokenIsTemplate(type) || type === 102 && !this.state.containsEsc || type === 137 || type === 56 || this.hasPlugin("v8intrinsic") && type === 54;
14399
+ return type === 53 || type === 10 || type === 0 || tokenIsTemplate(type) || type === 102 && !this.state.containsEsc || type === 138 || type === 56 || this.hasPlugin("v8intrinsic") && type === 54;
14385
14400
  }
14386
14401
  parseYield() {
14387
14402
  const node = this.startNode();
@@ -14393,7 +14408,7 @@ var require_lib = __commonJS({
14393
14408
  delegating = this.eat(55);
14394
14409
  switch (this.state.type) {
14395
14410
  case 13:
14396
- case 139:
14411
+ case 140:
14397
14412
  case 8:
14398
14413
  case 11:
14399
14414
  case 3:
@@ -14413,16 +14428,16 @@ var require_lib = __commonJS({
14413
14428
  parseImportCall(node) {
14414
14429
  this.next();
14415
14430
  node.source = this.parseMaybeAssignAllowIn();
14416
- if (this.hasPlugin("importAttributes") || this.hasPlugin("importAssertions")) {
14417
- node.options = null;
14418
- }
14431
+ node.options = null;
14419
14432
  if (this.eat(12)) {
14420
- if (!(this.hasPlugin("moduleAttributes") || this.hasPlugin("importAssertions"))) {
14421
- this.expectPlugin("importAttributes");
14422
- }
14423
14433
  if (!this.match(11)) {
14424
14434
  node.options = this.parseMaybeAssignAllowIn();
14425
- this.eat(12);
14435
+ if (this.eat(12) && !this.match(11)) {
14436
+ do {
14437
+ this.parseMaybeAssignAllowIn();
14438
+ } while (this.eat(12) && !this.match(11));
14439
+ this.raise(Errors.ImportCallArity, node);
14440
+ }
14426
14441
  }
14427
14442
  }
14428
14443
  this.expect(11);
@@ -14579,7 +14594,7 @@ var require_lib = __commonJS({
14579
14594
  };
14580
14595
  var loneSurrogate = /[\uD800-\uDFFF]/u;
14581
14596
  var keywordRelationalOperator = /in(?:stanceof)?/y;
14582
- function babel7CompatTokens(tokens, input) {
14597
+ function babel7CompatTokens(tokens, input, startIndex) {
14583
14598
  for (let i = 0; i < tokens.length; i++) {
14584
14599
  const token = tokens[i];
14585
14600
  const {
@@ -14587,7 +14602,7 @@ var require_lib = __commonJS({
14587
14602
  } = token;
14588
14603
  if (typeof type === "number") {
14589
14604
  {
14590
- if (type === 138) {
14605
+ if (type === 139) {
14591
14606
  const {
14592
14607
  loc,
14593
14608
  start,
@@ -14624,7 +14639,7 @@ var require_lib = __commonJS({
14624
14639
  const backquoteEnd = start + 1;
14625
14640
  const backquoteEndLoc = createPositionWithColumnOffset(loc.start, 1);
14626
14641
  let startToken;
14627
- if (input.charCodeAt(start) === 96) {
14642
+ if (input.charCodeAt(start - startIndex) === 96) {
14628
14643
  startToken = new Token({
14629
14644
  type: getExportedToken(22),
14630
14645
  value: "`",
@@ -14691,11 +14706,11 @@ var require_lib = __commonJS({
14691
14706
  file.program = this.parseProgram(program);
14692
14707
  file.comments = this.comments;
14693
14708
  if (this.options.tokens) {
14694
- file.tokens = babel7CompatTokens(this.tokens, this.input);
14709
+ file.tokens = babel7CompatTokens(this.tokens, this.input, this.startIndex);
14695
14710
  }
14696
14711
  return this.finishNode(file, "File");
14697
14712
  }
14698
- parseProgram(program, end = 139, sourceType = this.options.sourceType) {
14713
+ parseProgram(program, end = 140, sourceType = this.options.sourceType) {
14699
14714
  program.sourceType = sourceType;
14700
14715
  program.interpreter = this.parseInterpreterDirective();
14701
14716
  this.parseBlockBody(program, true, true, end);
@@ -14710,7 +14725,7 @@ var require_lib = __commonJS({
14710
14725
  this.addExtra(program, "topLevelAwait", this.state.hasTopLevelAwait);
14711
14726
  }
14712
14727
  let finishedProgram;
14713
- if (end === 139) {
14728
+ if (end === 140) {
14714
14729
  finishedProgram = this.finishNode(program, "Program");
14715
14730
  } else {
14716
14731
  finishedProgram = this.finishNodeAt(program, "Program", createPositionWithColumnOffset(this.state.startLoc, -1));
@@ -14724,7 +14739,7 @@ var require_lib = __commonJS({
14724
14739
  delete directive.expression;
14725
14740
  const directiveLiteral = directive.value;
14726
14741
  const expressionValue = directiveLiteral.value;
14727
- const raw = this.input.slice(directiveLiteral.start, directiveLiteral.end);
14742
+ const raw = this.input.slice(this.offsetToSourcePos(directiveLiteral.start), this.offsetToSourcePos(directiveLiteral.end));
14728
14743
  const val = directiveLiteral.value = raw.slice(1, -1);
14729
14744
  this.addExtra(directiveLiteral, "raw", raw);
14730
14745
  this.addExtra(directiveLiteral, "rawValue", val);
@@ -15030,7 +15045,7 @@ var require_lib = __commonJS({
15030
15045
  while (this.eat(16)) {
15031
15046
  const node2 = this.startNodeAt(startLoc);
15032
15047
  node2.object = expr;
15033
- if (this.match(138)) {
15048
+ if (this.match(139)) {
15034
15049
  this.classScope.usePrivateName(this.state.value, this.state.startLoc);
15035
15050
  node2.property = this.parsePrivateName();
15036
15051
  } else {
@@ -15050,7 +15065,7 @@ var require_lib = __commonJS({
15050
15065
  if (this.eat(10)) {
15051
15066
  const node = this.startNodeAtNode(expr);
15052
15067
  node.callee = expr;
15053
- node.arguments = this.parseCallExpressionArguments(11, false);
15068
+ node.arguments = this.parseCallExpressionArguments(11);
15054
15069
  this.toReferencedList(node.arguments);
15055
15070
  return this.finishNode(node, "CallExpression");
15056
15071
  }
@@ -15330,7 +15345,7 @@ var require_lib = __commonJS({
15330
15345
  for (let i = this.state.labels.length - 1; i >= 0; i--) {
15331
15346
  const label = this.state.labels[i];
15332
15347
  if (label.statementStart === node.start) {
15333
- label.statementStart = this.state.start;
15348
+ label.statementStart = this.sourceToOffsetPos(this.state.start);
15334
15349
  label.kind = kind;
15335
15350
  } else {
15336
15351
  break;
@@ -15339,7 +15354,7 @@ var require_lib = __commonJS({
15339
15354
  this.state.labels.push({
15340
15355
  name: maybeName,
15341
15356
  kind,
15342
- statementStart: this.state.start
15357
+ statementStart: this.sourceToOffsetPos(this.state.start)
15343
15358
  });
15344
15359
  node.body = flags & 8 ? this.parseStatementOrSloppyAnnexBFunctionDeclaration(true) : this.parseStatement();
15345
15360
  this.state.labels.pop();
@@ -15639,7 +15654,7 @@ var require_lib = __commonJS({
15639
15654
  this.parsePropertyNamePrefixOperator(member);
15640
15655
  if (this.eat(55)) {
15641
15656
  method.kind = "method";
15642
- const isPrivateName = this.match(138);
15657
+ const isPrivateName = this.match(139);
15643
15658
  this.parseClassElementName(method);
15644
15659
  if (isPrivateName) {
15645
15660
  this.pushClassPrivateMethod(classBody, privateMethod, true, false);
@@ -15690,7 +15705,7 @@ var require_lib = __commonJS({
15690
15705
  this.unexpected(maybeQuestionTokenStartLoc);
15691
15706
  }
15692
15707
  method.kind = "method";
15693
- const isPrivate2 = this.match(138);
15708
+ const isPrivate2 = this.match(139);
15694
15709
  this.parseClassElementName(method);
15695
15710
  this.parsePostMemberNameModifiers(publicMember);
15696
15711
  if (isPrivate2) {
@@ -15704,7 +15719,7 @@ var require_lib = __commonJS({
15704
15719
  } else if ((maybeContextualKw === "get" || maybeContextualKw === "set") && !(this.match(55) && this.isLineTerminator())) {
15705
15720
  this.resetPreviousNodeTrailingComments(key);
15706
15721
  method.kind = maybeContextualKw;
15707
- const isPrivate2 = this.match(138);
15722
+ const isPrivate2 = this.match(139);
15708
15723
  this.parseClassElementName(publicMethod);
15709
15724
  if (isPrivate2) {
15710
15725
  this.pushClassPrivateMethod(classBody, privateMethod, false, false);
@@ -15718,7 +15733,7 @@ var require_lib = __commonJS({
15718
15733
  } else if (maybeContextualKw === "accessor" && !this.isLineTerminator()) {
15719
15734
  this.expectPlugin("decoratorAutoAccessors");
15720
15735
  this.resetPreviousNodeTrailingComments(key);
15721
- const isPrivate2 = this.match(138);
15736
+ const isPrivate2 = this.match(139);
15722
15737
  this.parseClassElementName(publicProp);
15723
15738
  this.pushClassAccessorProperty(classBody, accessorProp, isPrivate2);
15724
15739
  } else if (this.isLineTerminator()) {
@@ -15736,10 +15751,10 @@ var require_lib = __commonJS({
15736
15751
  type,
15737
15752
  value
15738
15753
  } = this.state;
15739
- if ((type === 132 || type === 133) && member.static && value === "prototype") {
15754
+ if ((type === 132 || type === 134) && member.static && value === "prototype") {
15740
15755
  this.raise(Errors.StaticPrototype, this.state.startLoc);
15741
15756
  }
15742
- if (type === 138) {
15757
+ if (type === 139) {
15743
15758
  if (value === "constructor") {
15744
15759
  this.raise(Errors.ConstructorClassPrivateField, this.state.startLoc);
15745
15760
  }
@@ -16156,7 +16171,7 @@ var require_lib = __commonJS({
16156
16171
  break;
16157
16172
  }
16158
16173
  const isMaybeTypeOnly = this.isContextual(130);
16159
- const isString = this.match(133);
16174
+ const isString = this.match(134);
16160
16175
  const node = this.startNode();
16161
16176
  node.local = this.parseModuleExportName();
16162
16177
  nodes.push(this.parseExportSpecifier(node, isString, isInTypeExport, isMaybeTypeOnly));
@@ -16174,7 +16189,7 @@ var require_lib = __commonJS({
16174
16189
  return this.finishNode(node, "ExportSpecifier");
16175
16190
  }
16176
16191
  parseModuleExportName() {
16177
- if (this.match(133)) {
16192
+ if (this.match(134)) {
16178
16193
  const result = this.parseStringLiteral(this.state.value);
16179
16194
  const surrogate = loneSurrogate.exec(result.value);
16180
16195
  if (surrogate) {
@@ -16294,7 +16309,7 @@ var require_lib = __commonJS({
16294
16309
  return tokenIsIdentifier(type) ? type !== 98 || this.lookaheadCharCode() === 102 : type !== 12;
16295
16310
  }
16296
16311
  parseImport(node) {
16297
- if (this.match(133)) {
16312
+ if (this.match(134)) {
16298
16313
  return this.parseImportSourceAndAttributes(node);
16299
16314
  }
16300
16315
  return this.parseImportSpecifiersAndAfter(node, this.parseMaybeImportPhase(node, false));
@@ -16320,7 +16335,7 @@ var require_lib = __commonJS({
16320
16335
  return this.finishNode(node, "ImportDeclaration");
16321
16336
  }
16322
16337
  parseImportSource() {
16323
- if (!this.match(133))
16338
+ if (!this.match(134))
16324
16339
  this.unexpected();
16325
16340
  return this.parseExprAtom();
16326
16341
  }
@@ -16350,13 +16365,13 @@ var require_lib = __commonJS({
16350
16365
  });
16351
16366
  }
16352
16367
  attrNames.add(keyName);
16353
- if (this.match(133)) {
16368
+ if (this.match(134)) {
16354
16369
  node.key = this.parseStringLiteral(keyName);
16355
16370
  } else {
16356
16371
  node.key = this.parseIdentifier(true);
16357
16372
  }
16358
16373
  this.expect(14);
16359
- if (!this.match(133)) {
16374
+ if (!this.match(134)) {
16360
16375
  throw this.raise(Errors.ModuleAttributeInvalidValue, this.state.startLoc);
16361
16376
  }
16362
16377
  node.value = this.parseStringLiteral(this.state.value);
@@ -16381,7 +16396,7 @@ var require_lib = __commonJS({
16381
16396
  }
16382
16397
  attributes.add(node.key.name);
16383
16398
  this.expect(14);
16384
- if (!this.match(133)) {
16399
+ if (!this.match(134)) {
16385
16400
  throw this.raise(Errors.ModuleAttributeInvalidValue, this.state.startLoc);
16386
16401
  }
16387
16402
  node.value = this.parseStringLiteral(this.state.value);
@@ -16402,32 +16417,22 @@ var require_lib = __commonJS({
16402
16417
  if (this.hasPlugin("moduleAttributes")) {
16403
16418
  attributes = this.parseModuleAttributes();
16404
16419
  } else {
16405
- if (!this.hasPlugin("importAssertions")) {
16406
- this.expectPlugin("importAttributes");
16407
- }
16408
16420
  attributes = this.parseImportAttributes();
16409
16421
  }
16410
16422
  {
16411
16423
  useWith = true;
16412
16424
  }
16413
16425
  } else if (this.isContextual(94) && !this.hasPrecedingLineBreak()) {
16414
- if (this.hasPlugin("importAttributes")) {
16415
- if (this.getPluginOption("importAttributes", "deprecatedAssertSyntax") !== true) {
16416
- this.raise(Errors.ImportAttributesUseAssert, this.state.startLoc);
16417
- }
16426
+ if (!this.hasPlugin("deprecatedImportAssert") && !this.hasPlugin("importAssertions")) {
16427
+ this.raise(Errors.ImportAttributesUseAssert, this.state.startLoc);
16428
+ }
16429
+ if (!this.hasPlugin("importAssertions")) {
16418
16430
  this.addExtra(node, "deprecatedAssertSyntax", true);
16419
- } else {
16420
- this.expectOnePlugin(["importAttributes", "importAssertions"]);
16421
16431
  }
16422
16432
  this.next();
16423
16433
  attributes = this.parseImportAttributes();
16424
- } else if (this.hasPlugin("importAttributes") || this.hasPlugin("importAssertions")) {
16425
- attributes = [];
16426
16434
  } else {
16427
- if (this.hasPlugin("moduleAttributes")) {
16428
- attributes = [];
16429
- } else
16430
- return;
16435
+ attributes = [];
16431
16436
  }
16432
16437
  if (!useWith && this.hasPlugin("importAssertions")) {
16433
16438
  node.assertions = attributes;
@@ -16472,7 +16477,7 @@ var require_lib = __commonJS({
16472
16477
  break;
16473
16478
  }
16474
16479
  const specifier = this.startNode();
16475
- const importedIsString = this.match(133);
16480
+ const importedIsString = this.match(134);
16476
16481
  const isMaybeTypeOnly = this.isContextual(130);
16477
16482
  specifier.imported = this.parseModuleExportName();
16478
16483
  const importSpecifier = this.parseImportSpecifier(specifier, importedIsString, node.importKind === "type" || node.importKind === "typeof", isMaybeTypeOnly, void 0);
@@ -16510,6 +16515,7 @@ var require_lib = __commonJS({
16510
16515
  this.initializeScopes();
16511
16516
  this.plugins = pluginsMap;
16512
16517
  this.filename = options.sourceFilename;
16518
+ this.startIndex = options.startIndex;
16513
16519
  }
16514
16520
  getScopeHandler() {
16515
16521
  return ScopeHandler;
@@ -56591,8 +56597,8 @@ function useDraggableData(props) {
56591
56597
  props.dragStartFn(evt, data);
56592
56598
  };
56593
56599
  const handleDrag = (evt, data) => {
56594
- x.value = Number(data.x.toFixed(2));
56595
- y.value = Number(data.y.toFixed(2));
56600
+ x.value = Math.round(data.x);
56601
+ y.value = Math.round(data.y);
56596
56602
  deltaX.value = data.deltaX;
56597
56603
  deltaY.value = data.deltaY;
56598
56604
  props.dragFn(evt, data);
@@ -57932,22 +57938,6 @@ var freeDomProps = {
57932
57938
  default: void 0
57933
57939
  },
57934
57940
  keyboard: Boolean,
57935
- x: {
57936
- type: Number,
57937
- default: 0
57938
- },
57939
- y: {
57940
- type: Number,
57941
- default: 0
57942
- },
57943
- width: {
57944
- type: Number,
57945
- default: void 0
57946
- },
57947
- height: {
57948
- type: Number,
57949
- default: void 0
57950
- },
57951
57941
  handle: {
57952
57942
  type: String,
57953
57943
  default: void 0
@@ -58140,10 +58130,10 @@ var freeDom = defineComponent5({
58140
58130
  const isValid = sceneContext.check?.({ x: _x, y: _y, width: w, height: h7 });
58141
58131
  if (!isValid)
58142
58132
  return;
58143
- width.value = Number(w.toFixed(2));
58144
- height.value = Number(h7.toFixed(2));
58145
- x.value = Number(_x.toFixed(2));
58146
- y.value = Number(_y.toFixed(2));
58133
+ width.value = Math.round(w);
58134
+ height.value = Math.round(h7);
58135
+ x.value = Math.round(_x);
58136
+ y.value = Math.round(_y);
58147
58137
  props.resizeFn(evt, { node, width: w, height: h7, handle: axis });
58148
58138
  sceneContext.emit("move", sceneContext.manualDiff.value ? !evt.shiftKey : evt.shiftKey);
58149
58139
  };
@@ -58294,6 +58284,7 @@ var freeDomWrapProps = {
58294
58284
  type: Number,
58295
58285
  default: 2
58296
58286
  },
58287
+ autoExpand: [Boolean, Object],
58297
58288
  manualDiff: Boolean,
58298
58289
  showLine: {
58299
58290
  type: Boolean,
@@ -58306,6 +58297,14 @@ var freeDomWrapProps = {
58306
58297
  keyboard: Boolean,
58307
58298
  disabledBatch: Boolean,
58308
58299
  handle: freeDomProps.handle,
58300
+ width: {
58301
+ type: Number,
58302
+ default: void 0
58303
+ },
58304
+ height: {
58305
+ type: Number,
58306
+ default: void 0
58307
+ },
58309
58308
  minWidth: {
58310
58309
  type: Number,
58311
58310
  default: void 0
@@ -58324,32 +58323,63 @@ var freeDomWrapProps = {
58324
58323
  var FreeDomWrap = defineComponent6({
58325
58324
  name: "FreeDomWrap",
58326
58325
  props: freeDomWrapProps,
58327
- emits: ["batch-select", "drop"],
58326
+ emits: ["batch-select", "drop", "update:width", "update:height"],
58328
58327
  setup(props, { emit }) {
58329
58328
  const eventBus = useEventBus();
58330
58329
  const nodes = ref13([]);
58331
58330
  const history = useOperateHistory(nodes);
58332
- const width = ref13(0);
58333
- const height = ref13(0);
58331
+ const width = ref13(props.width);
58332
+ const height = ref13(props.height);
58334
58333
  const rectRef = shallowRef6();
58335
58334
  const wrapRect = useElementBounding(rectRef);
58335
+ const wrapStyle = computed11(() => ({
58336
+ height: height.value + "px",
58337
+ width: width.value + "px"
58338
+ }));
58336
58339
  watch6([
58337
58340
  wrapRect.width,
58338
58341
  wrapRect.height,
58339
58342
  () => nodes.value.length
58340
58343
  ], ([w, h7]) => {
58341
58344
  debug2("update size");
58342
- width.value = w;
58343
- height.value = h7;
58344
58345
  if (!w || !h7)
58345
58346
  return;
58347
+ width.value = w;
58348
+ height.value = h7;
58349
+ emit("update:width", w);
58350
+ emit("update:height", h7);
58346
58351
  runCorrect();
58347
- });
58352
+ }, { immediate: true });
58348
58353
  const selectedNodes = computed11(() => nodes.value.filter((node) => node.node.selected));
58354
+ const expandSize = (node) => {
58355
+ let expandWidth = props.autoExpand === true;
58356
+ let expandHeight = props.autoExpand === true;
58357
+ if (typeof props.autoExpand === "object") {
58358
+ expandWidth = !!props.autoExpand.width;
58359
+ expandHeight = !!props.autoExpand.height;
58360
+ }
58361
+ if (!expandWidth && !expandHeight)
58362
+ return;
58363
+ const {
58364
+ x = 0,
58365
+ width: nw = 0,
58366
+ y = 0,
58367
+ height: nh = 0
58368
+ } = node.node._rect;
58369
+ if (expandWidth && width.value && x + nw >= width.value) {
58370
+ width.value += 1;
58371
+ }
58372
+ if (expandHeight && height.value && y + nh >= height.value) {
58373
+ height.value += 1;
58374
+ }
58375
+ };
58349
58376
  eventBus.on("move", (nodeId) => {
58350
58377
  const mainNode = selectedNodes.value.find((node) => node.uuid === nodeId);
58351
58378
  if (!mainNode)
58352
58379
  return;
58380
+ if (props.autoExpand) {
58381
+ expandSize(mainNode);
58382
+ }
58353
58383
  const { deltaX, deltaY } = mainNode.node._rect;
58354
58384
  selectedNodes.value.forEach((node) => {
58355
58385
  if (node.uuid === nodeId)
@@ -58392,6 +58422,8 @@ var FreeDomWrap = defineComponent6({
58392
58422
  nodes.value.splice(index, 1);
58393
58423
  }
58394
58424
  function checkValid(pos) {
58425
+ if (!width.value || !height.value)
58426
+ return false;
58395
58427
  const { x, y, width: w, height: h7 } = pos;
58396
58428
  return x >= 0 && x + w <= width.value && y >= 0 && y + h7 <= height.value;
58397
58429
  }
@@ -58400,17 +58432,19 @@ var FreeDomWrap = defineComponent6({
58400
58432
  let y = Math.max(pos.y, 0);
58401
58433
  let w = pos.width;
58402
58434
  let h7 = pos.height;
58403
- if (pos.x + pos.width > width.value) {
58404
- x = width.value - pos.width;
58435
+ const containerWidth = width.value || 0;
58436
+ const containerHeight = height.value || 0;
58437
+ if (pos.x + pos.width > containerWidth) {
58438
+ x = containerWidth - pos.width;
58405
58439
  if (x < 0) {
58406
- w = Math.max(width.value, minWidth);
58440
+ w = Math.max(containerWidth, minWidth);
58407
58441
  x = 0;
58408
58442
  }
58409
58443
  }
58410
- if (pos.y + pos.height > height.value) {
58411
- y = height.value - pos.height;
58444
+ if (pos.y + pos.height > containerHeight) {
58445
+ y = containerHeight - pos.height;
58412
58446
  if (y < 0) {
58413
- h7 = Math.max(height.value, minHeight);
58447
+ h7 = Math.max(containerHeight, minHeight);
58414
58448
  y = 0;
58415
58449
  }
58416
58450
  }
@@ -58448,7 +58482,8 @@ var FreeDomWrap = defineComponent6({
58448
58482
  rectRef,
58449
58483
  selecting,
58450
58484
  mask,
58451
- history
58485
+ history,
58486
+ wrapStyle
58452
58487
  };
58453
58488
  },
58454
58489
  render() {
@@ -58459,24 +58494,30 @@ var FreeDomWrap = defineComponent6({
58459
58494
  slots,
58460
58495
  marklineComp
58461
58496
  ];
58462
- return createRender(
58497
+ const main = createRender(
58463
58498
  "section",
58464
58499
  {
58465
58500
  ref: "rectRef",
58466
- class: "vv-free-dom--scene"
58467
- },
58501
+ class: "vv-free-dom--scene",
58502
+ style: this.wrapStyle
58503
+ }
58504
+ )(slotList);
58505
+ const wrap = (comp) => createRender(
58506
+ "section",
58507
+ {},
58468
58508
  {},
58469
58509
  {
58510
+ onMousedown: this.mask.handleMousedown,
58511
+ onMousemove: this.mask.handleMousemove,
58470
58512
  ondrop: (evt) => {
58471
58513
  this.$emit("drop", evt);
58472
58514
  },
58473
58515
  ondragover: (evt) => {
58474
58516
  evt.preventDefault();
58475
- },
58476
- onMousedown: this.mask.handleMousedown,
58477
- onMousemove: this.mask.handleMousemove
58517
+ }
58478
58518
  }
58479
- )(slotList);
58519
+ )(comp);
58520
+ return wrap(main);
58480
58521
  }
58481
58522
  });
58482
58523