@sepveneto/free-dom 0.12.7 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/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.1/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.1/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
  }
@@ -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;
@@ -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,13 @@ 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
+ const index = this.startIndex + this.pos;
4464
+ return new Position(this.curLine, index - this.lineStart, index);
4460
4465
  }
4461
4466
  clone() {
4462
4467
  const state2 = new State();
4463
4468
  state2.flags = this.flags;
4469
+ state2.startIndex = this.startIndex;
4464
4470
  state2.curLine = this.curLine;
4465
4471
  state2.lineStart = this.lineStart;
4466
4472
  state2.startLoc = this.startLoc;
@@ -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,
@@ -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,7 +5568,7 @@ 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, "");
5571
+ const str = this.input.slice(start, this.state.pos).replace(/[_n]/g, "");
5565
5572
  this.finishToken(135, str);
5566
5573
  return;
5567
5574
  }
@@ -6077,7 +6084,7 @@ var require_lib = __commonJS({
6077
6084
  return this.match(139) || 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());
@@ -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();
@@ -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
  }
@@ -10244,18 +10251,12 @@ var require_lib = __commonJS({
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();
@@ -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
11157
  } else if (this.match(133)) {
11158
+ node.kind = "module";
11156
11159
  node.id = super.parseStringLiteral(this.state.value);
11157
11160
  } else {
11158
11161
  this.unexpected();
@@ -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();
@@ -11311,12 +11315,14 @@ var require_lib = __commonJS({
11311
11315
  if (this.match(133)) {
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) {
@@ -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);
@@ -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
  }
@@ -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,7 +12894,7 @@ 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();
@@ -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
  }
@@ -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();
@@ -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);
@@ -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);
@@ -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();
@@ -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;
@@ -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);
@@ -58140,12 +58146,12 @@ var freeDom = defineComponent5({
58140
58146
  const isValid = sceneContext.check?.({ x: _x, y: _y, width: w, height: h7 });
58141
58147
  if (!isValid)
58142
58148
  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));
58149
+ width.value = Math.round(w);
58150
+ height.value = Math.round(h7);
58151
+ x.value = Math.round(_x);
58152
+ y.value = Math.round(_y);
58147
58153
  props.resizeFn(evt, { node, width: w, height: h7, handle: axis });
58148
- sceneContext?.emit("move");
58154
+ sceneContext.emit("move", sceneContext.manualDiff.value ? !evt.shiftKey : evt.shiftKey);
58149
58155
  };
58150
58156
  const onResizeStop = (evt, data) => {
58151
58157
  const isValid = sceneContext.check?.({ x: x.value, y: y.value, width: width.value, height: height.value });
@@ -58161,6 +58167,7 @@ var freeDom = defineComponent5({
58161
58167
  sceneContext.history?.push({ type: "resize-end" });
58162
58168
  };
58163
58169
  const onResizeStart = (evt, data) => {
58170
+ sceneContext.clearSelectState?.();
58164
58171
  selected.value = true;
58165
58172
  props.resizeStartFn(evt, data);
58166
58173
  };
@@ -58293,6 +58300,7 @@ var freeDomWrapProps = {
58293
58300
  type: Number,
58294
58301
  default: 2
58295
58302
  },
58303
+ autoExpand: [Boolean, Object],
58296
58304
  manualDiff: Boolean,
58297
58305
  showLine: {
58298
58306
  type: Boolean,
@@ -58328,27 +58336,56 @@ var FreeDomWrap = defineComponent6({
58328
58336
  const eventBus = useEventBus();
58329
58337
  const nodes = ref13([]);
58330
58338
  const history = useOperateHistory(nodes);
58331
- const width = ref13(0);
58332
- const height = ref13(0);
58339
+ const width = ref13();
58340
+ const height = ref13();
58333
58341
  const rectRef = shallowRef6();
58334
58342
  const wrapRect = useElementBounding(rectRef);
58343
+ const wrapStyle = computed11(() => ({
58344
+ height: height.value + "px",
58345
+ width: width.value + "px"
58346
+ }));
58335
58347
  watch6([
58336
58348
  wrapRect.width,
58337
58349
  wrapRect.height,
58338
58350
  () => nodes.value.length
58339
58351
  ], ([w, h7]) => {
58340
58352
  debug2("update size");
58341
- width.value = w;
58342
- height.value = h7;
58343
58353
  if (!w || !h7)
58344
58354
  return;
58355
+ width.value = w;
58356
+ height.value = h7;
58345
58357
  runCorrect();
58346
- });
58358
+ }, { immediate: true });
58347
58359
  const selectedNodes = computed11(() => nodes.value.filter((node) => node.node.selected));
58360
+ const expandSize = (node) => {
58361
+ let expandWidth = props.autoExpand === true;
58362
+ let expandHeight = props.autoExpand === true;
58363
+ if (typeof props.autoExpand === "object") {
58364
+ expandWidth = !!props.autoExpand.width;
58365
+ expandHeight = !!props.autoExpand.height;
58366
+ }
58367
+ if (!expandWidth && !expandHeight)
58368
+ return;
58369
+ const {
58370
+ x = 0,
58371
+ width: nw = 0,
58372
+ y = 0,
58373
+ height: nh = 0
58374
+ } = node.node._rect;
58375
+ if (expandWidth && width.value && x + nw >= width.value) {
58376
+ width.value += 1;
58377
+ }
58378
+ if (expandHeight && height.value && y + nh >= height.value) {
58379
+ height.value += 1;
58380
+ }
58381
+ };
58348
58382
  eventBus.on("move", (nodeId) => {
58349
58383
  const mainNode = selectedNodes.value.find((node) => node.uuid === nodeId);
58350
58384
  if (!mainNode)
58351
58385
  return;
58386
+ if (props.autoExpand) {
58387
+ expandSize(mainNode);
58388
+ }
58352
58389
  const { deltaX, deltaY } = mainNode.node._rect;
58353
58390
  selectedNodes.value.forEach((node) => {
58354
58391
  if (node.uuid === nodeId)
@@ -58391,6 +58428,8 @@ var FreeDomWrap = defineComponent6({
58391
58428
  nodes.value.splice(index, 1);
58392
58429
  }
58393
58430
  function checkValid(pos) {
58431
+ if (!width.value || !height.value)
58432
+ return false;
58394
58433
  const { x, y, width: w, height: h7 } = pos;
58395
58434
  return x >= 0 && x + w <= width.value && y >= 0 && y + h7 <= height.value;
58396
58435
  }
@@ -58399,17 +58438,19 @@ var FreeDomWrap = defineComponent6({
58399
58438
  let y = Math.max(pos.y, 0);
58400
58439
  let w = pos.width;
58401
58440
  let h7 = pos.height;
58402
- if (pos.x + pos.width > width.value) {
58403
- x = width.value - pos.width;
58441
+ const containerWidth = width.value || 0;
58442
+ const containerHeight = height.value || 0;
58443
+ if (pos.x + pos.width > containerWidth) {
58444
+ x = containerWidth - pos.width;
58404
58445
  if (x < 0) {
58405
- w = Math.max(width.value, minWidth);
58446
+ w = Math.max(containerWidth, minWidth);
58406
58447
  x = 0;
58407
58448
  }
58408
58449
  }
58409
- if (pos.y + pos.height > height.value) {
58410
- y = height.value - pos.height;
58450
+ if (pos.y + pos.height > containerHeight) {
58451
+ y = containerHeight - pos.height;
58411
58452
  if (y < 0) {
58412
- h7 = Math.max(height.value, minHeight);
58453
+ h7 = Math.max(containerHeight, minHeight);
58413
58454
  y = 0;
58414
58455
  }
58415
58456
  }
@@ -58447,7 +58488,8 @@ var FreeDomWrap = defineComponent6({
58447
58488
  rectRef,
58448
58489
  selecting,
58449
58490
  mask,
58450
- history
58491
+ history,
58492
+ wrapStyle
58451
58493
  };
58452
58494
  },
58453
58495
  render() {
@@ -58458,24 +58500,30 @@ var FreeDomWrap = defineComponent6({
58458
58500
  slots,
58459
58501
  marklineComp
58460
58502
  ];
58461
- return createRender(
58503
+ const main = createRender(
58462
58504
  "section",
58463
58505
  {
58464
58506
  ref: "rectRef",
58465
- class: "vv-free-dom--scene"
58466
- },
58507
+ class: "vv-free-dom--scene",
58508
+ style: this.wrapStyle
58509
+ }
58510
+ )(slotList);
58511
+ const wrap = (comp) => createRender(
58512
+ "section",
58513
+ {},
58467
58514
  {},
58468
58515
  {
58516
+ onMousedown: this.mask.handleMousedown,
58517
+ onMousemove: this.mask.handleMousemove,
58469
58518
  ondrop: (evt) => {
58470
58519
  this.$emit("drop", evt);
58471
58520
  },
58472
58521
  ondragover: (evt) => {
58473
58522
  evt.preventDefault();
58474
- },
58475
- onMousedown: this.mask.handleMousedown,
58476
- onMousemove: this.mask.handleMousemove
58523
+ }
58477
58524
  }
58478
- )(slotList);
58525
+ )(comp);
58526
+ return wrap(main);
58479
58527
  }
58480
58528
  });
58481
58529