@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.js CHANGED
@@ -2417,9 +2417,9 @@ var require_decode = __commonJS({
2417
2417
  }
2418
2418
  });
2419
2419
 
2420
- // ../../node_modules/.pnpm/@babel+parser@7.25.8/node_modules/@babel/parser/lib/index.js
2420
+ // ../../node_modules/.pnpm/@babel+parser@7.26.1/node_modules/@babel/parser/lib/index.js
2421
2421
  var require_lib = __commonJS({
2422
- "../../node_modules/.pnpm/@babel+parser@7.25.8/node_modules/@babel/parser/lib/index.js"(exports) {
2422
+ "../../node_modules/.pnpm/@babel+parser@7.26.1/node_modules/@babel/parser/lib/index.js"(exports) {
2423
2423
  "use strict";
2424
2424
  Object.defineProperty(exports, "__esModule", {
2425
2425
  value: true
@@ -2564,15 +2564,12 @@ var require_lib = __commonJS({
2564
2564
  }) => `Unsyntactic ${type === "BreakStatement" ? "break" : "continue"}.`,
2565
2565
  IllegalLanguageModeDirective: "Illegal 'use strict' directive in function with non-simple parameter list.",
2566
2566
  IllegalReturn: "'return' outside of function.",
2567
- 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.",
2567
+ 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.",
2568
2568
  ImportBindingIsString: ({
2569
2569
  importName
2570
2570
  }) => `A string literal cannot be used as an imported binding.
2571
2571
  - Did you mean \`import { "${importName}" as foo }\`?`,
2572
- ImportCallArgumentTrailingComma: "Trailing comma is disallowed inside import(...) arguments.",
2573
- ImportCallArity: ({
2574
- maxArgumentCount
2575
- }) => `\`import()\` requires exactly ${maxArgumentCount === 1 ? "one argument" : "one or two arguments"}.`,
2572
+ ImportCallArity: `\`import()\` requires exactly one or two arguments.`,
2576
2573
  ImportCallNotNewExpression: "Cannot use new with import(...).",
2577
2574
  ImportCallSpreadArgument: "`...` is not allowed in `import()`.",
2578
2575
  ImportJSONBindingNotDefault: "A JSON module can only be imported with `default`.",
@@ -3099,13 +3096,11 @@ var require_lib = __commonJS({
3099
3096
  finishCallExpression(unfinished, optional) {
3100
3097
  const node = super.finishCallExpression(unfinished, optional);
3101
3098
  if (node.callee.type === "Import") {
3099
+ var _ref, _ref2;
3102
3100
  node.type = "ImportExpression";
3103
3101
  node.source = node.arguments[0];
3104
- if (this.hasPlugin("importAttributes") || this.hasPlugin("importAssertions")) {
3105
- var _ref, _ref2;
3106
- node.options = (_ref = node.arguments[1]) != null ? _ref : null;
3107
- node.attributes = (_ref2 = node.arguments[1]) != null ? _ref2 : null;
3108
- }
3102
+ node.options = (_ref = node.arguments[1]) != null ? _ref : null;
3103
+ node.attributes = (_ref2 = node.arguments[1]) != null ? _ref2 : null;
3109
3104
  delete node.arguments;
3110
3105
  delete node.callee;
3111
3106
  }
@@ -4033,6 +4028,12 @@ var require_lib = __commonJS({
4033
4028
  this.sawUnambiguousESM = false;
4034
4029
  this.ambiguousScriptDifferentAst = false;
4035
4030
  }
4031
+ sourceToOffsetPos(sourcePos) {
4032
+ return sourcePos + this.startIndex;
4033
+ }
4034
+ offsetToSourcePos(offsetPos) {
4035
+ return offsetPos - this.startIndex;
4036
+ }
4036
4037
  hasPlugin(pluginConfig) {
4037
4038
  if (typeof pluginConfig === "string") {
4038
4039
  return this.plugins.has(pluginConfig);
@@ -4148,7 +4149,7 @@ var require_lib = __commonJS({
4148
4149
  containingNode: node,
4149
4150
  start: commentStart
4150
4151
  } = commentWS;
4151
- if (this.input.charCodeAt(commentStart - 1) === 44) {
4152
+ if (this.input.charCodeAt(this.offsetToSourcePos(commentStart) - 1) === 44) {
4152
4153
  switch (node.type) {
4153
4154
  case "ObjectExpression":
4154
4155
  case "ObjectPattern":
@@ -4299,6 +4300,7 @@ var require_lib = __commonJS({
4299
4300
  var State = class {
4300
4301
  constructor() {
4301
4302
  this.flags = 1024;
4303
+ this.startIndex = void 0;
4302
4304
  this.curLine = void 0;
4303
4305
  this.lineStart = void 0;
4304
4306
  this.startLoc = void 0;
@@ -4338,13 +4340,15 @@ var require_lib = __commonJS({
4338
4340
  init({
4339
4341
  strictMode,
4340
4342
  sourceType,
4343
+ startIndex,
4341
4344
  startLine,
4342
4345
  startColumn
4343
4346
  }) {
4344
4347
  this.strict = strictMode === false ? false : strictMode === true ? true : sourceType === "module";
4348
+ this.startIndex = startIndex;
4345
4349
  this.curLine = startLine;
4346
4350
  this.lineStart = -startColumn;
4347
- this.startLoc = this.endLoc = new Position(startLine, startColumn, 0);
4351
+ this.startLoc = this.endLoc = new Position(startLine, startColumn, startIndex);
4348
4352
  }
4349
4353
  get maybeInArrowParameters() {
4350
4354
  return (this.flags & 2) > 0;
@@ -4455,11 +4459,13 @@ var require_lib = __commonJS({
4455
4459
  this.flags &= -4097;
4456
4460
  }
4457
4461
  curPosition() {
4458
- return new Position(this.curLine, this.pos - this.lineStart, this.pos);
4462
+ const index = this.startIndex + this.pos;
4463
+ return new Position(this.curLine, index - this.lineStart, index);
4459
4464
  }
4460
4465
  clone() {
4461
4466
  const state2 = new State();
4462
4467
  state2.flags = this.flags;
4468
+ state2.startIndex = this.startIndex;
4463
4469
  state2.curLine = this.curLine;
4464
4470
  state2.lineStart = this.lineStart;
4465
4471
  state2.startLoc = this.startLoc;
@@ -5064,8 +5070,8 @@ var require_lib = __commonJS({
5064
5070
  if (comments.length > 0) {
5065
5071
  const end = this.state.pos;
5066
5072
  const commentWhitespace = {
5067
- start: spaceStart,
5068
- end,
5073
+ start: this.sourceToOffsetPos(spaceStart),
5074
+ end: this.sourceToOffsetPos(end),
5069
5075
  comments,
5070
5076
  leadingNode: null,
5071
5077
  trailingNode: null,
@@ -5540,6 +5546,7 @@ var require_lib = __commonJS({
5540
5546
  return n;
5541
5547
  }
5542
5548
  readRadixNumber(radix) {
5549
+ const start = this.state.pos;
5543
5550
  const startLoc = this.state.curPosition();
5544
5551
  let isBigInt = false;
5545
5552
  this.state.pos += 2;
@@ -5560,7 +5567,7 @@ var require_lib = __commonJS({
5560
5567
  throw this.raise(Errors.NumberIdentifier, this.state.curPosition());
5561
5568
  }
5562
5569
  if (isBigInt) {
5563
- const str = this.input.slice(startLoc.index, this.state.pos).replace(/[_n]/g, "");
5570
+ const str = this.input.slice(start, this.state.pos).replace(/[_n]/g, "");
5564
5571
  this.finishToken(135, str);
5565
5572
  return;
5566
5573
  }
@@ -6076,7 +6083,7 @@ var require_lib = __commonJS({
6076
6083
  return this.match(139) || this.match(8) || this.hasPrecedingLineBreak();
6077
6084
  }
6078
6085
  hasPrecedingLineBreak() {
6079
- return hasNewLine(this.input, this.state.lastTokEndLoc.index, this.state.start);
6086
+ return hasNewLine(this.input, this.offsetToSourcePos(this.state.lastTokEndLoc.index), this.state.start);
6080
6087
  }
6081
6088
  hasFollowingLineBreak() {
6082
6089
  return hasNewLine(this.input, this.state.end, this.nextTokenStart());
@@ -7554,7 +7561,7 @@ var require_lib = __commonJS({
7554
7561
  this.next();
7555
7562
  return this.flowParseInterface(node);
7556
7563
  }
7557
- } else if (this.plugins.get("flow").enums && this.isContextual(126)) {
7564
+ } else if (this.isContextual(126)) {
7558
7565
  const node = this.startNode();
7559
7566
  this.next();
7560
7567
  return this.flowParseEnumDeclaration(node);
@@ -7587,7 +7594,7 @@ var require_lib = __commonJS({
7587
7594
  const {
7588
7595
  type
7589
7596
  } = this.state;
7590
- if (tokenIsFlowInterfaceOrTypeOrOpaque(type) || this.plugins.get("flow").enums && type === 126) {
7597
+ if (type === 126 || tokenIsFlowInterfaceOrTypeOrOpaque(type)) {
7591
7598
  return !this.state.containsEsc;
7592
7599
  }
7593
7600
  return super.shouldParseExportDeclaration();
@@ -7596,13 +7603,13 @@ var require_lib = __commonJS({
7596
7603
  const {
7597
7604
  type
7598
7605
  } = this.state;
7599
- if (tokenIsFlowInterfaceOrTypeOrOpaque(type) || this.plugins.get("flow").enums && type === 126) {
7606
+ if (type === 126 || tokenIsFlowInterfaceOrTypeOrOpaque(type)) {
7600
7607
  return this.state.containsEsc;
7601
7608
  }
7602
7609
  return super.isExportDefaultSpecifier();
7603
7610
  }
7604
7611
  parseExportDefaultExpression() {
7605
- if (this.plugins.get("flow").enums && this.isContextual(126)) {
7612
+ if (this.isContextual(126)) {
7606
7613
  const node = this.startNode();
7607
7614
  this.next();
7608
7615
  return this.flowParseEnumDeclaration(node);
@@ -7705,7 +7712,7 @@ var require_lib = __commonJS({
7705
7712
  }
7706
7713
  forwardNoArrowParamsConversionAt(node, parse2) {
7707
7714
  let result;
7708
- if (this.state.noArrowParamsConversionAt.includes(node.start)) {
7715
+ if (this.state.noArrowParamsConversionAt.includes(this.offsetToSourcePos(node.start))) {
7709
7716
  this.state.noArrowParamsConversionAt.push(this.state.start);
7710
7717
  result = parse2();
7711
7718
  this.state.noArrowParamsConversionAt.pop();
@@ -7756,7 +7763,7 @@ var require_lib = __commonJS({
7756
7763
  const declarationNode = this.startNode();
7757
7764
  this.next();
7758
7765
  return this.flowParseInterface(declarationNode);
7759
- } else if (this.plugins.get("flow").enums && this.isContextual(126)) {
7766
+ } else if (this.isContextual(126)) {
7760
7767
  node.exportKind = "value";
7761
7768
  const declarationNode = this.startNode();
7762
7769
  this.next();
@@ -8229,14 +8236,14 @@ var require_lib = __commonJS({
8229
8236
  return this.match(14) || super.shouldParseArrow(params);
8230
8237
  }
8231
8238
  setArrowFunctionParameters(node, params) {
8232
- if (this.state.noArrowParamsConversionAt.includes(node.start)) {
8239
+ if (this.state.noArrowParamsConversionAt.includes(this.offsetToSourcePos(node.start))) {
8233
8240
  node.params = params;
8234
8241
  } else {
8235
8242
  super.setArrowFunctionParameters(node, params);
8236
8243
  }
8237
8244
  }
8238
8245
  checkParams(node, allowDuplicates, isArrowFunction, strictModeChanged = true) {
8239
- if (isArrowFunction && this.state.noArrowParamsConversionAt.includes(node.start)) {
8246
+ if (isArrowFunction && this.state.noArrowParamsConversionAt.includes(this.offsetToSourcePos(node.start))) {
8240
8247
  return;
8241
8248
  }
8242
8249
  for (let i = 0; i < node.params.length; i++) {
@@ -8247,14 +8254,14 @@ var require_lib = __commonJS({
8247
8254
  super.checkParams(node, allowDuplicates, isArrowFunction, strictModeChanged);
8248
8255
  }
8249
8256
  parseParenAndDistinguishExpression(canBeArrow) {
8250
- return super.parseParenAndDistinguishExpression(canBeArrow && !this.state.noArrowAt.includes(this.state.start));
8257
+ return super.parseParenAndDistinguishExpression(canBeArrow && !this.state.noArrowAt.includes(this.sourceToOffsetPos(this.state.start)));
8251
8258
  }
8252
8259
  parseSubscripts(base, startLoc, noCalls) {
8253
8260
  if (base.type === "Identifier" && base.name === "async" && this.state.noArrowAt.includes(startLoc.index)) {
8254
8261
  this.next();
8255
8262
  const node = this.startNodeAt(startLoc);
8256
8263
  node.callee = base;
8257
- node.arguments = super.parseCallExpressionArguments(11, false);
8264
+ node.arguments = super.parseCallExpressionArguments(11);
8258
8265
  base = this.finishNode(node, "CallExpression");
8259
8266
  } else if (base.type === "Identifier" && base.name === "async" && this.match(47)) {
8260
8267
  const state2 = this.state.clone();
@@ -8288,7 +8295,7 @@ var require_lib = __commonJS({
8288
8295
  node.callee = base;
8289
8296
  node.typeArguments = this.flowParseTypeParameterInstantiation();
8290
8297
  this.expect(10);
8291
- node.arguments = this.parseCallExpressionArguments(11, false);
8298
+ node.arguments = this.parseCallExpressionArguments(11);
8292
8299
  node.optional = true;
8293
8300
  return this.finishCallExpression(node, true);
8294
8301
  } else if (!noCalls && this.shouldParseTypes() && this.match(47)) {
@@ -8297,7 +8304,7 @@ var require_lib = __commonJS({
8297
8304
  const result = this.tryParse(() => {
8298
8305
  node.typeArguments = this.flowParseTypeParameterInstantiationCallOrNew();
8299
8306
  this.expect(10);
8300
- node.arguments = super.parseCallExpressionArguments(11, false);
8307
+ node.arguments = super.parseCallExpressionArguments(11);
8301
8308
  if (subscriptState.optionalChainMember) {
8302
8309
  node.optional = false;
8303
8310
  }
@@ -10243,18 +10250,12 @@ var require_lib = __commonJS({
10243
10250
  this.raise(TSErrors.UnsupportedImportTypeArgument, this.state.startLoc);
10244
10251
  }
10245
10252
  node.argument = super.parseExprAtom();
10246
- if (this.hasPlugin("importAttributes") || this.hasPlugin("importAssertions")) {
10253
+ if (this.eat(12) && !this.match(11)) {
10254
+ node.options = super.parseMaybeAssignAllowIn();
10255
+ this.eat(12);
10256
+ } else {
10247
10257
  node.options = null;
10248
10258
  }
10249
- if (this.eat(12)) {
10250
- if (!this.hasPlugin("importAssertions")) {
10251
- this.expectPlugin("importAttributes");
10252
- }
10253
- if (!this.match(11)) {
10254
- node.options = super.parseMaybeAssignAllowIn();
10255
- this.eat(12);
10256
- }
10257
- }
10258
10259
  this.expect(11);
10259
10260
  if (this.eat(16)) {
10260
10261
  node.qualifier = this.tsParseEntityName();
@@ -11149,9 +11150,11 @@ var require_lib = __commonJS({
11149
11150
  }
11150
11151
  tsParseAmbientExternalModuleDeclaration(node) {
11151
11152
  if (this.isContextual(112)) {
11153
+ node.kind = "global";
11152
11154
  node.global = true;
11153
11155
  node.id = this.parseIdentifier();
11154
11156
  } else if (this.match(133)) {
11157
+ node.kind = "module";
11155
11158
  node.id = super.parseStringLiteral(this.state.value);
11156
11159
  } else {
11157
11160
  this.unexpected();
@@ -11286,6 +11289,7 @@ var require_lib = __commonJS({
11286
11289
  this.scope.enter(256);
11287
11290
  this.prodParam.enter(0);
11288
11291
  const mod = node;
11292
+ mod.kind = "global";
11289
11293
  mod.global = true;
11290
11294
  mod.id = expr;
11291
11295
  mod.body = this.tsParseModuleBlock();
@@ -11310,12 +11314,14 @@ var require_lib = __commonJS({
11310
11314
  if (this.match(133)) {
11311
11315
  return this.tsParseAmbientExternalModuleDeclaration(node);
11312
11316
  } else if (tokenIsIdentifier(this.state.type)) {
11317
+ node.kind = "module";
11313
11318
  return this.tsParseModuleOrNamespaceDeclaration(node);
11314
11319
  }
11315
11320
  }
11316
11321
  break;
11317
11322
  case "namespace":
11318
11323
  if (this.tsCheckLineTerminator(next) && tokenIsIdentifier(this.state.type)) {
11324
+ node.kind = "namespace";
11319
11325
  return this.tsParseModuleOrNamespaceDeclaration(node);
11320
11326
  }
11321
11327
  break;
@@ -11516,7 +11522,7 @@ var require_lib = __commonJS({
11516
11522
  if (!noCalls && this.eat(10)) {
11517
11523
  const node2 = this.startNodeAt(startLoc);
11518
11524
  node2.callee = base;
11519
- node2.arguments = this.parseCallExpressionArguments(11, false);
11525
+ node2.arguments = this.parseCallExpressionArguments(11);
11520
11526
  this.tsCheckForInvalidTypeCasts(node2.arguments);
11521
11527
  node2.typeParameters = typeArguments;
11522
11528
  if (state2.optionalChainMember) {
@@ -11888,7 +11894,7 @@ var require_lib = __commonJS({
11888
11894
  key
11889
11895
  } = node;
11890
11896
  this.raise(TSErrors.AbstractPropertyHasInitializer, this.state.startLoc, {
11891
- propertyName: key.type === "Identifier" && !node.computed ? key.name : `[${this.input.slice(key.start, key.end)}]`
11897
+ propertyName: key.type === "Identifier" && !node.computed ? key.name : `[${this.input.slice(this.offsetToSourcePos(key.start), this.offsetToSourcePos(key.end))}]`
11892
11898
  });
11893
11899
  }
11894
11900
  return super.parseClassProperty(node);
@@ -12332,7 +12338,7 @@ var require_lib = __commonJS({
12332
12338
  key
12333
12339
  } = method;
12334
12340
  this.raise(TSErrors.AbstractMethodHasImplementation, method, {
12335
- methodName: key.type === "Identifier" && !method.computed ? key.name : `[${this.input.slice(key.start, key.end)}]`
12341
+ methodName: key.type === "Identifier" && !method.computed ? key.name : `[${this.input.slice(this.offsetToSourcePos(key.start), this.offsetToSourcePos(key.end))}]`
12336
12342
  });
12337
12343
  }
12338
12344
  }
@@ -12688,7 +12694,7 @@ var require_lib = __commonJS({
12688
12694
  return this.parsePlaceholder("StringLiteral") || super.parseImportSource();
12689
12695
  }
12690
12696
  assertNoSpace() {
12691
- if (this.state.start > this.state.lastTokEndLoc.index) {
12697
+ if (this.state.start > this.offsetToSourcePos(this.state.lastTokEndLoc.index)) {
12692
12698
  this.raise(PlaceholderErrors.UnexpectedSpace, this.state.lastTokEndLoc);
12693
12699
  }
12694
12700
  }
@@ -12765,8 +12771,8 @@ var require_lib = __commonJS({
12765
12771
  }
12766
12772
  if (pluginsMap.has("moduleAttributes")) {
12767
12773
  {
12768
- if (pluginsMap.has("importAttributes") || pluginsMap.has("importAssertions")) {
12769
- throw new Error("Cannot combine importAssertions, importAttributes and moduleAttributes plugins.");
12774
+ if (pluginsMap.has("deprecatedImportAssert") || pluginsMap.has("importAssertions")) {
12775
+ throw new Error("Cannot combine importAssertions, deprecatedImportAssert and moduleAttributes plugins.");
12770
12776
  }
12771
12777
  const moduleAttributesVersionPluginOption = pluginsMap.get("moduleAttributes").version;
12772
12778
  if (moduleAttributesVersionPluginOption !== "may-2020") {
@@ -12775,8 +12781,13 @@ var require_lib = __commonJS({
12775
12781
  }
12776
12782
  }
12777
12783
  if (pluginsMap.has("importAssertions")) {
12778
- if (pluginsMap.has("importAttributes")) {
12779
- throw new Error("Cannot combine importAssertions and importAttributes plugins.");
12784
+ if (pluginsMap.has("deprecatedImportAssert")) {
12785
+ throw new Error("Cannot combine importAssertions and deprecatedImportAssert plugins.");
12786
+ }
12787
+ }
12788
+ if (!pluginsMap.has("deprecatedImportAssert") && pluginsMap.has("importAttributes") && pluginsMap.get("importAttributes").deprecatedAssertSyntax) {
12789
+ {
12790
+ pluginsMap.set("deprecatedImportAssert", {});
12780
12791
  }
12781
12792
  }
12782
12793
  if (pluginsMap.has("recordAndTuple")) {
@@ -12808,38 +12819,52 @@ var require_lib = __commonJS({
12808
12819
  placeholders
12809
12820
  };
12810
12821
  var mixinPluginNames = Object.keys(mixinPlugins);
12811
- var defaultOptions = {
12812
- sourceType: "script",
12813
- sourceFilename: void 0,
12814
- startColumn: 0,
12815
- startLine: 1,
12816
- allowAwaitOutsideFunction: false,
12817
- allowReturnOutsideFunction: false,
12818
- allowNewTargetOutsideFunction: false,
12819
- allowImportExportEverywhere: false,
12820
- allowSuperOutsideMethod: false,
12821
- allowUndeclaredExports: false,
12822
- plugins: [],
12823
- strictMode: null,
12824
- ranges: false,
12825
- tokens: false,
12826
- createImportExpressions: false,
12827
- createParenthesizedExpressions: false,
12828
- errorRecovery: false,
12829
- attachComment: true,
12830
- annexB: true
12831
- };
12822
+ function createDefaultOptions() {
12823
+ return {
12824
+ sourceType: "script",
12825
+ sourceFilename: void 0,
12826
+ startIndex: 0,
12827
+ startColumn: 0,
12828
+ startLine: 1,
12829
+ allowAwaitOutsideFunction: false,
12830
+ allowReturnOutsideFunction: false,
12831
+ allowNewTargetOutsideFunction: false,
12832
+ allowImportExportEverywhere: false,
12833
+ allowSuperOutsideMethod: false,
12834
+ allowUndeclaredExports: false,
12835
+ plugins: [],
12836
+ strictMode: null,
12837
+ ranges: false,
12838
+ tokens: false,
12839
+ createImportExpressions: false,
12840
+ createParenthesizedExpressions: false,
12841
+ errorRecovery: false,
12842
+ attachComment: true,
12843
+ annexB: true
12844
+ };
12845
+ }
12832
12846
  function getOptions(opts) {
12847
+ const options = createDefaultOptions();
12833
12848
  if (opts == null) {
12834
- return Object.assign({}, defaultOptions);
12849
+ return options;
12835
12850
  }
12836
12851
  if (opts.annexB != null && opts.annexB !== false) {
12837
12852
  throw new Error("The `annexB` option can only be set to `false`.");
12838
12853
  }
12839
- const options = {};
12840
- for (const key of Object.keys(defaultOptions)) {
12841
- var _opts$key;
12842
- options[key] = (_opts$key = opts[key]) != null ? _opts$key : defaultOptions[key];
12854
+ for (const key of Object.keys(options)) {
12855
+ if (opts[key] != null)
12856
+ options[key] = opts[key];
12857
+ }
12858
+ if (options.startLine === 1) {
12859
+ if (opts.startIndex == null && options.startColumn > 0) {
12860
+ options.startIndex = options.startColumn;
12861
+ } else if (opts.startColumn == null && options.startIndex > 0) {
12862
+ options.startColumn = options.startIndex;
12863
+ }
12864
+ } else if (opts.startColumn == null || opts.startIndex == null) {
12865
+ if (opts.startIndex != null) {
12866
+ throw new Error("With a `startLine > 1` you must also specify `startIndex` and `startColumn`.");
12867
+ }
12843
12868
  }
12844
12869
  return options;
12845
12870
  }
@@ -12868,7 +12893,7 @@ var require_lib = __commonJS({
12868
12893
  }
12869
12894
  }
12870
12895
  shouldExitDescending(expr, potentialArrowAt) {
12871
- return expr.type === "ArrowFunctionExpression" && expr.start === potentialArrowAt;
12896
+ return expr.type === "ArrowFunctionExpression" && this.offsetToSourcePos(expr.start) === potentialArrowAt;
12872
12897
  }
12873
12898
  getExpression() {
12874
12899
  this.enterInitialScopes();
@@ -13280,7 +13305,7 @@ var require_lib = __commonJS({
13280
13305
  if (optional) {
13281
13306
  node.arguments = this.parseCallExpressionArguments(11);
13282
13307
  } else {
13283
- node.arguments = this.parseCallExpressionArguments(11, base.type === "Import", base.type !== "Super", node, refExpressionErrors);
13308
+ node.arguments = this.parseCallExpressionArguments(11, base.type !== "Super", node, refExpressionErrors);
13284
13309
  }
13285
13310
  let finishedNode = this.finishCallExpression(node, optionalChainMember);
13286
13311
  if (maybeAsyncArrow && this.shouldParseAsyncArrow() && !optional) {
@@ -13312,19 +13337,12 @@ var require_lib = __commonJS({
13312
13337
  return this.finishNode(node, "TaggedTemplateExpression");
13313
13338
  }
13314
13339
  atPossibleAsyncArrow(base) {
13315
- 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;
13340
+ 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;
13316
13341
  }
13317
13342
  finishCallExpression(node, optional) {
13318
13343
  if (node.callee.type === "Import") {
13319
- if (node.arguments.length === 2) {
13320
- if (!(this.hasPlugin("moduleAttributes") || this.hasPlugin("importAssertions"))) {
13321
- this.expectPlugin("importAttributes");
13322
- }
13323
- }
13324
13344
  if (node.arguments.length === 0 || node.arguments.length > 2) {
13325
- this.raise(Errors.ImportCallArity, node, {
13326
- maxArgumentCount: this.hasPlugin("importAttributes") || this.hasPlugin("importAssertions") || this.hasPlugin("moduleAttributes") ? 2 : 1
13327
- });
13345
+ this.raise(Errors.ImportCallArity, node);
13328
13346
  } else {
13329
13347
  for (const arg of node.arguments) {
13330
13348
  if (arg.type === "SpreadElement") {
@@ -13335,7 +13353,7 @@ var require_lib = __commonJS({
13335
13353
  }
13336
13354
  return this.finishNode(node, optional ? "OptionalCallExpression" : "CallExpression");
13337
13355
  }
13338
- parseCallExpressionArguments(close, dynamicImport, allowPlaceholder, nodeForExtra, refExpressionErrors) {
13356
+ parseCallExpressionArguments(close, allowPlaceholder, nodeForExtra, refExpressionErrors) {
13339
13357
  const elts = [];
13340
13358
  let first = true;
13341
13359
  const oldInFSharpPipelineDirectBody = this.state.inFSharpPipelineDirectBody;
@@ -13346,9 +13364,6 @@ var require_lib = __commonJS({
13346
13364
  } else {
13347
13365
  this.expect(12);
13348
13366
  if (this.match(close)) {
13349
- if (dynamicImport && !this.hasPlugin("importAttributes") && !this.hasPlugin("importAssertions") && !this.hasPlugin("moduleAttributes")) {
13350
- this.raise(Errors.ImportCallArgumentTrailingComma, this.state.lastTokStartLoc);
13351
- }
13352
13367
  if (nodeForExtra) {
13353
13368
  this.addTrailingCommaExtraToNode(nodeForExtra);
13354
13369
  }
@@ -13695,7 +13710,7 @@ var require_lib = __commonJS({
13695
13710
  }
13696
13711
  parseLiteralAtNode(value, type, node) {
13697
13712
  this.addExtra(node, "rawValue", value);
13698
- this.addExtra(node, "raw", this.input.slice(node.start, this.state.end));
13713
+ this.addExtra(node, "raw", this.input.slice(this.offsetToSourcePos(node.start), this.state.end));
13699
13714
  node.value = value;
13700
13715
  this.next();
13701
13716
  return this.finishNode(node, type);
@@ -13718,7 +13733,7 @@ var require_lib = __commonJS({
13718
13733
  }
13719
13734
  parseRegExpLiteral(value) {
13720
13735
  const node = this.startNode();
13721
- this.addExtra(node, "raw", this.input.slice(node.start, this.state.end));
13736
+ this.addExtra(node, "raw", this.input.slice(this.offsetToSourcePos(node.start), this.state.end));
13722
13737
  node.pattern = value.pattern;
13723
13738
  node.flags = value.flags;
13724
13739
  this.next();
@@ -14412,16 +14427,16 @@ var require_lib = __commonJS({
14412
14427
  parseImportCall(node) {
14413
14428
  this.next();
14414
14429
  node.source = this.parseMaybeAssignAllowIn();
14415
- if (this.hasPlugin("importAttributes") || this.hasPlugin("importAssertions")) {
14416
- node.options = null;
14417
- }
14430
+ node.options = null;
14418
14431
  if (this.eat(12)) {
14419
- if (!(this.hasPlugin("moduleAttributes") || this.hasPlugin("importAssertions"))) {
14420
- this.expectPlugin("importAttributes");
14421
- }
14422
14432
  if (!this.match(11)) {
14423
14433
  node.options = this.parseMaybeAssignAllowIn();
14424
- this.eat(12);
14434
+ if (this.eat(12) && !this.match(11)) {
14435
+ do {
14436
+ this.parseMaybeAssignAllowIn();
14437
+ } while (this.eat(12) && !this.match(11));
14438
+ this.raise(Errors.ImportCallArity, node);
14439
+ }
14425
14440
  }
14426
14441
  }
14427
14442
  this.expect(11);
@@ -14723,7 +14738,7 @@ var require_lib = __commonJS({
14723
14738
  delete directive.expression;
14724
14739
  const directiveLiteral = directive.value;
14725
14740
  const expressionValue = directiveLiteral.value;
14726
- const raw = this.input.slice(directiveLiteral.start, directiveLiteral.end);
14741
+ const raw = this.input.slice(this.offsetToSourcePos(directiveLiteral.start), this.offsetToSourcePos(directiveLiteral.end));
14727
14742
  const val = directiveLiteral.value = raw.slice(1, -1);
14728
14743
  this.addExtra(directiveLiteral, "raw", raw);
14729
14744
  this.addExtra(directiveLiteral, "rawValue", val);
@@ -15049,7 +15064,7 @@ var require_lib = __commonJS({
15049
15064
  if (this.eat(10)) {
15050
15065
  const node = this.startNodeAtNode(expr);
15051
15066
  node.callee = expr;
15052
- node.arguments = this.parseCallExpressionArguments(11, false);
15067
+ node.arguments = this.parseCallExpressionArguments(11);
15053
15068
  this.toReferencedList(node.arguments);
15054
15069
  return this.finishNode(node, "CallExpression");
15055
15070
  }
@@ -15329,7 +15344,7 @@ var require_lib = __commonJS({
15329
15344
  for (let i = this.state.labels.length - 1; i >= 0; i--) {
15330
15345
  const label = this.state.labels[i];
15331
15346
  if (label.statementStart === node.start) {
15332
- label.statementStart = this.state.start;
15347
+ label.statementStart = this.sourceToOffsetPos(this.state.start);
15333
15348
  label.kind = kind;
15334
15349
  } else {
15335
15350
  break;
@@ -15338,7 +15353,7 @@ var require_lib = __commonJS({
15338
15353
  this.state.labels.push({
15339
15354
  name: maybeName,
15340
15355
  kind,
15341
- statementStart: this.state.start
15356
+ statementStart: this.sourceToOffsetPos(this.state.start)
15342
15357
  });
15343
15358
  node.body = flags & 8 ? this.parseStatementOrSloppyAnnexBFunctionDeclaration(true) : this.parseStatement();
15344
15359
  this.state.labels.pop();
@@ -16401,32 +16416,22 @@ var require_lib = __commonJS({
16401
16416
  if (this.hasPlugin("moduleAttributes")) {
16402
16417
  attributes = this.parseModuleAttributes();
16403
16418
  } else {
16404
- if (!this.hasPlugin("importAssertions")) {
16405
- this.expectPlugin("importAttributes");
16406
- }
16407
16419
  attributes = this.parseImportAttributes();
16408
16420
  }
16409
16421
  {
16410
16422
  useWith = true;
16411
16423
  }
16412
16424
  } else if (this.isContextual(94) && !this.hasPrecedingLineBreak()) {
16413
- if (this.hasPlugin("importAttributes")) {
16414
- if (this.getPluginOption("importAttributes", "deprecatedAssertSyntax") !== true) {
16415
- this.raise(Errors.ImportAttributesUseAssert, this.state.startLoc);
16416
- }
16425
+ if (!this.hasPlugin("deprecatedImportAssert") && !this.hasPlugin("importAssertions")) {
16426
+ this.raise(Errors.ImportAttributesUseAssert, this.state.startLoc);
16427
+ }
16428
+ if (!this.hasPlugin("importAssertions")) {
16417
16429
  this.addExtra(node, "deprecatedAssertSyntax", true);
16418
- } else {
16419
- this.expectOnePlugin(["importAttributes", "importAssertions"]);
16420
16430
  }
16421
16431
  this.next();
16422
16432
  attributes = this.parseImportAttributes();
16423
- } else if (this.hasPlugin("importAttributes") || this.hasPlugin("importAssertions")) {
16424
- attributes = [];
16425
16433
  } else {
16426
- if (this.hasPlugin("moduleAttributes")) {
16427
- attributes = [];
16428
- } else
16429
- return;
16434
+ attributes = [];
16430
16435
  }
16431
16436
  if (!useWith && this.hasPlugin("importAssertions")) {
16432
16437
  node.assertions = attributes;
@@ -16509,6 +16514,7 @@ var require_lib = __commonJS({
16509
16514
  this.initializeScopes();
16510
16515
  this.plugins = pluginsMap;
16511
16516
  this.filename = options.sourceFilename;
16517
+ this.startIndex = options.startIndex;
16512
16518
  }
16513
16519
  getScopeHandler() {
16514
16520
  return ScopeHandler;
@@ -56592,8 +56598,8 @@ function useDraggableData(props) {
56592
56598
  props.dragStartFn(evt, data);
56593
56599
  };
56594
56600
  const handleDrag = (evt, data) => {
56595
- x.value = Number(data.x.toFixed(2));
56596
- y.value = Number(data.y.toFixed(2));
56601
+ x.value = Math.round(data.x);
56602
+ y.value = Math.round(data.y);
56597
56603
  deltaX.value = data.deltaX;
56598
56604
  deltaY.value = data.deltaY;
56599
56605
  props.dragFn(evt, data);
@@ -58141,12 +58147,12 @@ var freeDom = (0, import_vue_demi17.defineComponent)({
58141
58147
  const isValid = sceneContext.check?.({ x: _x, y: _y, width: w, height: h7 });
58142
58148
  if (!isValid)
58143
58149
  return;
58144
- width.value = Number(w.toFixed(2));
58145
- height.value = Number(h7.toFixed(2));
58146
- x.value = Number(_x.toFixed(2));
58147
- y.value = Number(_y.toFixed(2));
58150
+ width.value = Math.round(w);
58151
+ height.value = Math.round(h7);
58152
+ x.value = Math.round(_x);
58153
+ y.value = Math.round(_y);
58148
58154
  props.resizeFn(evt, { node, width: w, height: h7, handle: axis });
58149
- sceneContext?.emit("move");
58155
+ sceneContext.emit("move", sceneContext.manualDiff.value ? !evt.shiftKey : evt.shiftKey);
58150
58156
  };
58151
58157
  const onResizeStop = (evt, data) => {
58152
58158
  const isValid = sceneContext.check?.({ x: x.value, y: y.value, width: width.value, height: height.value });
@@ -58162,6 +58168,7 @@ var freeDom = (0, import_vue_demi17.defineComponent)({
58162
58168
  sceneContext.history?.push({ type: "resize-end" });
58163
58169
  };
58164
58170
  const onResizeStart = (evt, data) => {
58171
+ sceneContext.clearSelectState?.();
58165
58172
  selected.value = true;
58166
58173
  props.resizeStartFn(evt, data);
58167
58174
  };
@@ -58294,6 +58301,7 @@ var freeDomWrapProps = {
58294
58301
  type: Number,
58295
58302
  default: 2
58296
58303
  },
58304
+ autoExpand: [Boolean, Object],
58297
58305
  manualDiff: Boolean,
58298
58306
  showLine: {
58299
58307
  type: Boolean,
@@ -58329,27 +58337,56 @@ var FreeDomWrap = (0, import_vue_demi18.defineComponent)({
58329
58337
  const eventBus = useEventBus();
58330
58338
  const nodes = (0, import_vue_demi18.ref)([]);
58331
58339
  const history = useOperateHistory(nodes);
58332
- const width = (0, import_vue_demi18.ref)(0);
58333
- const height = (0, import_vue_demi18.ref)(0);
58340
+ const width = (0, import_vue_demi18.ref)();
58341
+ const height = (0, import_vue_demi18.ref)();
58334
58342
  const rectRef = (0, import_vue_demi18.shallowRef)();
58335
58343
  const wrapRect = useElementBounding(rectRef);
58344
+ const wrapStyle = (0, import_vue_demi18.computed)(() => ({
58345
+ height: height.value + "px",
58346
+ width: width.value + "px"
58347
+ }));
58336
58348
  (0, import_vue_demi18.watch)([
58337
58349
  wrapRect.width,
58338
58350
  wrapRect.height,
58339
58351
  () => nodes.value.length
58340
58352
  ], ([w, h7]) => {
58341
58353
  debug2("update size");
58342
- width.value = w;
58343
- height.value = h7;
58344
58354
  if (!w || !h7)
58345
58355
  return;
58356
+ width.value = w;
58357
+ height.value = h7;
58346
58358
  runCorrect();
58347
- });
58359
+ }, { immediate: true });
58348
58360
  const selectedNodes = (0, import_vue_demi18.computed)(() => nodes.value.filter((node) => node.node.selected));
58361
+ const expandSize = (node) => {
58362
+ let expandWidth = props.autoExpand === true;
58363
+ let expandHeight = props.autoExpand === true;
58364
+ if (typeof props.autoExpand === "object") {
58365
+ expandWidth = !!props.autoExpand.width;
58366
+ expandHeight = !!props.autoExpand.height;
58367
+ }
58368
+ if (!expandWidth && !expandHeight)
58369
+ return;
58370
+ const {
58371
+ x = 0,
58372
+ width: nw = 0,
58373
+ y = 0,
58374
+ height: nh = 0
58375
+ } = node.node._rect;
58376
+ if (expandWidth && width.value && x + nw >= width.value) {
58377
+ width.value += 1;
58378
+ }
58379
+ if (expandHeight && height.value && y + nh >= height.value) {
58380
+ height.value += 1;
58381
+ }
58382
+ };
58349
58383
  eventBus.on("move", (nodeId) => {
58350
58384
  const mainNode = selectedNodes.value.find((node) => node.uuid === nodeId);
58351
58385
  if (!mainNode)
58352
58386
  return;
58387
+ if (props.autoExpand) {
58388
+ expandSize(mainNode);
58389
+ }
58353
58390
  const { deltaX, deltaY } = mainNode.node._rect;
58354
58391
  selectedNodes.value.forEach((node) => {
58355
58392
  if (node.uuid === nodeId)
@@ -58392,6 +58429,8 @@ var FreeDomWrap = (0, import_vue_demi18.defineComponent)({
58392
58429
  nodes.value.splice(index, 1);
58393
58430
  }
58394
58431
  function checkValid(pos) {
58432
+ if (!width.value || !height.value)
58433
+ return false;
58395
58434
  const { x, y, width: w, height: h7 } = pos;
58396
58435
  return x >= 0 && x + w <= width.value && y >= 0 && y + h7 <= height.value;
58397
58436
  }
@@ -58400,17 +58439,19 @@ var FreeDomWrap = (0, import_vue_demi18.defineComponent)({
58400
58439
  let y = Math.max(pos.y, 0);
58401
58440
  let w = pos.width;
58402
58441
  let h7 = pos.height;
58403
- if (pos.x + pos.width > width.value) {
58404
- x = width.value - pos.width;
58442
+ const containerWidth = width.value || 0;
58443
+ const containerHeight = height.value || 0;
58444
+ if (pos.x + pos.width > containerWidth) {
58445
+ x = containerWidth - pos.width;
58405
58446
  if (x < 0) {
58406
- w = Math.max(width.value, minWidth);
58447
+ w = Math.max(containerWidth, minWidth);
58407
58448
  x = 0;
58408
58449
  }
58409
58450
  }
58410
- if (pos.y + pos.height > height.value) {
58411
- y = height.value - pos.height;
58451
+ if (pos.y + pos.height > containerHeight) {
58452
+ y = containerHeight - pos.height;
58412
58453
  if (y < 0) {
58413
- h7 = Math.max(height.value, minHeight);
58454
+ h7 = Math.max(containerHeight, minHeight);
58414
58455
  y = 0;
58415
58456
  }
58416
58457
  }
@@ -58448,7 +58489,8 @@ var FreeDomWrap = (0, import_vue_demi18.defineComponent)({
58448
58489
  rectRef,
58449
58490
  selecting,
58450
58491
  mask,
58451
- history
58492
+ history,
58493
+ wrapStyle
58452
58494
  };
58453
58495
  },
58454
58496
  render() {
@@ -58459,24 +58501,30 @@ var FreeDomWrap = (0, import_vue_demi18.defineComponent)({
58459
58501
  slots,
58460
58502
  marklineComp
58461
58503
  ];
58462
- return createRender(
58504
+ const main = createRender(
58463
58505
  "section",
58464
58506
  {
58465
58507
  ref: "rectRef",
58466
- class: "vv-free-dom--scene"
58467
- },
58508
+ class: "vv-free-dom--scene",
58509
+ style: this.wrapStyle
58510
+ }
58511
+ )(slotList);
58512
+ const wrap = (comp) => createRender(
58513
+ "section",
58514
+ {},
58468
58515
  {},
58469
58516
  {
58517
+ onMousedown: this.mask.handleMousedown,
58518
+ onMousemove: this.mask.handleMousemove,
58470
58519
  ondrop: (evt) => {
58471
58520
  this.$emit("drop", evt);
58472
58521
  },
58473
58522
  ondragover: (evt) => {
58474
58523
  evt.preventDefault();
58475
- },
58476
- onMousedown: this.mask.handleMousedown,
58477
- onMousemove: this.mask.handleMousemove
58524
+ }
58478
58525
  }
58479
- )(slotList);
58526
+ )(comp);
58527
+ return wrap(main);
58480
58528
  }
58481
58529
  });
58482
58530