@ruan-cat/utils 1.3.5 → 1.4.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.
@@ -1658,9 +1658,9 @@
1658
1658
  }
1659
1659
  });
1660
1660
 
1661
- // ../../node_modules/.pnpm/@babel+parser@7.26.3/node_modules/@babel/parser/lib/index.js
1661
+ // ../../node_modules/.pnpm/@babel+parser@7.26.7/node_modules/@babel/parser/lib/index.js
1662
1662
  var require_lib = __commonJS({
1663
- "../../node_modules/.pnpm/@babel+parser@7.26.3/node_modules/@babel/parser/lib/index.js"(exports2) {
1663
+ "../../node_modules/.pnpm/@babel+parser@7.26.7/node_modules/@babel/parser/lib/index.js"(exports2) {
1664
1664
  "use strict";
1665
1665
  Object.defineProperty(exports2, "__esModule", {
1666
1666
  value: true
@@ -1971,7 +1971,7 @@
1971
1971
  StrictWith: "'with' in strict mode."
1972
1972
  };
1973
1973
  var UnparenthesizedPipeBodyDescriptions = /* @__PURE__ */ new Set(["ArrowFunctionExpression", "AssignmentExpression", "ConditionalExpression", "YieldExpression"]);
1974
- var PipelineOperatorErrors = {
1974
+ var PipelineOperatorErrors = Object.assign({
1975
1975
  PipeBodyIsTighter: "Unexpected yield after pipeline body; any yield expression acting as Hack-style pipe body must be parenthesized due to its loose operator precedence.",
1976
1976
  PipeTopicRequiresHackPipes: 'Topic reference is used, but the pipelineOperator plugin was not passed a "proposal": "hack" or "smart" option.',
1977
1977
  PipeTopicUnbound: "Topic reference is unbound; it must be inside a pipe body.",
@@ -1983,14 +1983,15 @@
1983
1983
  type
1984
1984
  }) => `Hack-style pipe body cannot be an unparenthesized ${toNodeDescription({
1985
1985
  type
1986
- })}; please wrap it in parentheses.`,
1986
+ })}; please wrap it in parentheses.`
1987
+ }, {
1987
1988
  PipelineBodyNoArrow: 'Unexpected arrow "=>" after pipeline body; arrow function in pipeline body must be parenthesized.',
1988
1989
  PipelineBodySequenceExpression: "Pipeline body may not be a comma-separated sequence expression.",
1989
1990
  PipelineHeadSequenceExpression: "Pipeline head should not be a comma-separated sequence expression.",
1990
1991
  PipelineTopicUnused: "Pipeline is in topic style but does not use topic reference.",
1991
1992
  PrimaryTopicNotAllowed: "Topic reference was used in a lexical context without topic binding.",
1992
1993
  PrimaryTopicRequiresSmartPipeline: 'Topic reference is used, but the pipelineOperator plugin was not passed a "proposal": "hack" or "smart" option.'
1993
- };
1994
+ });
1994
1995
  var _excluded = ["message"];
1995
1996
  function defineHidden(obj, key, value) {
1996
1997
  Object.defineProperty(obj, key, {
@@ -2082,6 +2083,54 @@
2082
2083
  return ParseErrorConstructors;
2083
2084
  }
2084
2085
  var Errors = Object.assign({}, ParseErrorEnum(ModuleErrors), ParseErrorEnum(StandardErrors), ParseErrorEnum(StrictModeErrors), ParseErrorEnum`pipelineOperator`(PipelineOperatorErrors));
2086
+ function createDefaultOptions() {
2087
+ return {
2088
+ sourceType: "script",
2089
+ sourceFilename: void 0,
2090
+ startIndex: 0,
2091
+ startColumn: 0,
2092
+ startLine: 1,
2093
+ allowAwaitOutsideFunction: false,
2094
+ allowReturnOutsideFunction: false,
2095
+ allowNewTargetOutsideFunction: false,
2096
+ allowImportExportEverywhere: false,
2097
+ allowSuperOutsideMethod: false,
2098
+ allowUndeclaredExports: false,
2099
+ plugins: [],
2100
+ strictMode: null,
2101
+ ranges: false,
2102
+ tokens: false,
2103
+ createImportExpressions: false,
2104
+ createParenthesizedExpressions: false,
2105
+ errorRecovery: false,
2106
+ attachComment: true,
2107
+ annexB: true
2108
+ };
2109
+ }
2110
+ function getOptions(opts) {
2111
+ const options = createDefaultOptions();
2112
+ if (opts == null) {
2113
+ return options;
2114
+ }
2115
+ if (opts.annexB != null && opts.annexB !== false) {
2116
+ throw new Error("The `annexB` option can only be set to `false`.");
2117
+ }
2118
+ for (const key of Object.keys(options)) {
2119
+ if (opts[key] != null) options[key] = opts[key];
2120
+ }
2121
+ if (options.startLine === 1) {
2122
+ if (opts.startIndex == null && options.startColumn > 0) {
2123
+ options.startIndex = options.startColumn;
2124
+ } else if (opts.startColumn == null && options.startIndex > 0) {
2125
+ options.startColumn = options.startIndex;
2126
+ }
2127
+ } else if (opts.startColumn == null || opts.startIndex == null) {
2128
+ if (opts.startIndex != null) {
2129
+ throw new Error("With a `startLine > 1` you must also specify `startIndex` and `startColumn`.");
2130
+ }
2131
+ }
2132
+ return options;
2133
+ }
2085
2134
  var {
2086
2135
  defineProperty
2087
2136
  } = Object;
@@ -2101,7 +2150,7 @@
2101
2150
  var estree = (superClass) => class ESTreeParserMixin extends superClass {
2102
2151
  parse() {
2103
2152
  const file = toESTreeLocation(super.parse());
2104
- if (this.options.tokens) {
2153
+ if (this.optionFlags & 128) {
2105
2154
  file.tokens = file.tokens.map(toESTreeLocation);
2106
2155
  }
2107
2156
  return file;
@@ -2191,14 +2240,6 @@
2191
2240
  node.body = directiveStatements.concat(node.body);
2192
2241
  delete node.directives;
2193
2242
  }
2194
- pushClassMethod(classBody, method, isGenerator, isAsync, isConstructor, allowsDirectSuper) {
2195
- this.parseMethod(method, isGenerator, isAsync, isConstructor, allowsDirectSuper, "ClassMethod", true);
2196
- if (method.typeParameters) {
2197
- method.value.typeParameters = method.typeParameters;
2198
- delete method.typeParameters;
2199
- }
2200
- classBody.body.push(method);
2201
- }
2202
2243
  parsePrivateName() {
2203
2244
  const node = super.parsePrivateName();
2204
2245
  {
@@ -2249,6 +2290,14 @@
2249
2290
  funcNode.type = "FunctionExpression";
2250
2291
  delete funcNode.kind;
2251
2292
  node.value = funcNode;
2293
+ const {
2294
+ typeParameters
2295
+ } = node;
2296
+ if (typeParameters) {
2297
+ delete node.typeParameters;
2298
+ funcNode.typeParameters = typeParameters;
2299
+ this.resetStartLocationFromNode(funcNode, typeParameters);
2300
+ }
2252
2301
  if (type === "ClassPrivateMethod") {
2253
2302
  node.computed = false;
2254
2303
  }
@@ -2265,7 +2314,9 @@
2265
2314
  return propertyNode;
2266
2315
  }
2267
2316
  }
2268
- propertyNode.type = "PropertyDefinition";
2317
+ {
2318
+ propertyNode.type = "PropertyDefinition";
2319
+ }
2269
2320
  return propertyNode;
2270
2321
  }
2271
2322
  parseClassPrivateProperty(...args) {
@@ -2275,7 +2326,9 @@
2275
2326
  return propertyNode;
2276
2327
  }
2277
2328
  }
2278
- propertyNode.type = "PropertyDefinition";
2329
+ {
2330
+ propertyNode.type = "PropertyDefinition";
2331
+ }
2279
2332
  propertyNode.computed = false;
2280
2333
  return propertyNode;
2281
2334
  }
@@ -3397,6 +3450,14 @@
3397
3450
  case "ImportDeclaration":
3398
3451
  adjustInnerComments(node, node.specifiers, commentWS);
3399
3452
  break;
3453
+ case "TSEnumDeclaration":
3454
+ {
3455
+ adjustInnerComments(node, node.members, commentWS);
3456
+ }
3457
+ break;
3458
+ case "TSEnumBody":
3459
+ adjustInnerComments(node, node.members, commentWS);
3460
+ break;
3400
3461
  default: {
3401
3462
  setInnerComments(node, comments);
3402
3463
  }
@@ -3986,7 +4047,7 @@
3986
4047
  this.tokens = [];
3987
4048
  this.errorHandlers_readInt = {
3988
4049
  invalidDigit: (pos, lineStart, curLine, radix) => {
3989
- if (!this.options.errorRecovery) return false;
4050
+ if (!(this.optionFlags & 1024)) return false;
3990
4051
  this.raise(Errors.InvalidDigit, buildPosition(pos, lineStart, curLine), {
3991
4052
  radix
3992
4053
  });
@@ -4027,7 +4088,7 @@
4027
4088
  }
4028
4089
  next() {
4029
4090
  this.checkKeywordEscapes();
4030
- if (this.options.tokens) {
4091
+ if (this.optionFlags & 128) {
4031
4092
  this.pushToken(new Token(this.state));
4032
4093
  }
4033
4094
  this.state.lastTokEndLoc = this.state.endLoc;
@@ -4143,7 +4204,7 @@
4143
4204
  end: this.sourceToOffsetPos(end + commentEnd.length),
4144
4205
  loc: new SourceLocation(startLoc, this.state.curPosition())
4145
4206
  };
4146
- if (this.options.tokens) this.pushToken(comment);
4207
+ if (this.optionFlags & 128) this.pushToken(comment);
4147
4208
  return comment;
4148
4209
  }
4149
4210
  skipLineComment(startSkip) {
@@ -4166,12 +4227,12 @@
4166
4227
  end: this.sourceToOffsetPos(end),
4167
4228
  loc: new SourceLocation(startLoc, this.state.curPosition())
4168
4229
  };
4169
- if (this.options.tokens) this.pushToken(comment);
4230
+ if (this.optionFlags & 128) this.pushToken(comment);
4170
4231
  return comment;
4171
4232
  }
4172
4233
  skipSpace() {
4173
4234
  const spaceStart = this.state.pos;
4174
- const comments = [];
4235
+ const comments = this.optionFlags & 2048 ? [] : null;
4175
4236
  loop: while (this.state.pos < this.length) {
4176
4237
  const ch = this.input.charCodeAt(this.state.pos);
4177
4238
  switch (ch) {
@@ -4197,7 +4258,7 @@
4197
4258
  const comment = this.skipBlockComment("*/");
4198
4259
  if (comment !== void 0) {
4199
4260
  this.addComment(comment);
4200
- if (this.options.attachComment) comments.push(comment);
4261
+ comments == null || comments.push(comment);
4201
4262
  }
4202
4263
  break;
4203
4264
  }
@@ -4205,7 +4266,7 @@
4205
4266
  const comment = this.skipLineComment(2);
4206
4267
  if (comment !== void 0) {
4207
4268
  this.addComment(comment);
4208
- if (this.options.attachComment) comments.push(comment);
4269
+ comments == null || comments.push(comment);
4209
4270
  }
4210
4271
  break;
4211
4272
  }
@@ -4216,24 +4277,24 @@
4216
4277
  default:
4217
4278
  if (isWhitespace(ch)) {
4218
4279
  ++this.state.pos;
4219
- } else if (ch === 45 && !this.inModule && this.options.annexB) {
4280
+ } else if (ch === 45 && !this.inModule && this.optionFlags & 4096) {
4220
4281
  const pos = this.state.pos;
4221
4282
  if (this.input.charCodeAt(pos + 1) === 45 && this.input.charCodeAt(pos + 2) === 62 && (spaceStart === 0 || this.state.lineStart > spaceStart)) {
4222
4283
  const comment = this.skipLineComment(3);
4223
4284
  if (comment !== void 0) {
4224
4285
  this.addComment(comment);
4225
- if (this.options.attachComment) comments.push(comment);
4286
+ comments == null || comments.push(comment);
4226
4287
  }
4227
4288
  } else {
4228
4289
  break loop;
4229
4290
  }
4230
- } else if (ch === 60 && !this.inModule && this.options.annexB) {
4291
+ } else if (ch === 60 && !this.inModule && this.optionFlags & 4096) {
4231
4292
  const pos = this.state.pos;
4232
4293
  if (this.input.charCodeAt(pos + 1) === 33 && this.input.charCodeAt(pos + 2) === 45 && this.input.charCodeAt(pos + 3) === 45) {
4233
4294
  const comment = this.skipLineComment(4);
4234
4295
  if (comment !== void 0) {
4235
4296
  this.addComment(comment);
4236
- if (this.options.attachComment) comments.push(comment);
4297
+ comments == null || comments.push(comment);
4237
4298
  }
4238
4299
  } else {
4239
4300
  break loop;
@@ -4243,7 +4304,7 @@
4243
4304
  }
4244
4305
  }
4245
4306
  }
4246
- if (comments.length > 0) {
4307
+ if ((comments == null ? void 0 : comments.length) > 0) {
4247
4308
  const end = this.state.pos;
4248
4309
  const commentWhitespace = {
4249
4310
  start: this.sourceToOffsetPos(spaceStart),
@@ -4934,7 +4995,7 @@
4934
4995
  raise(toParseError, at, details = {}) {
4935
4996
  const loc = at instanceof Position ? at : at.loc.start;
4936
4997
  const error = toParseError(loc, details);
4937
- if (!this.options.errorRecovery) throw error;
4998
+ if (!(this.optionFlags & 1024)) throw error;
4938
4999
  if (!this.isLookahead) this.state.errors.push(error);
4939
5000
  return error;
4940
5001
  }
@@ -5419,7 +5480,7 @@
5419
5480
  this.start = pos;
5420
5481
  this.end = 0;
5421
5482
  this.loc = new SourceLocation(loc);
5422
- if (parser != null && parser.options.ranges) this.range = [pos, 0];
5483
+ if ((parser == null ? void 0 : parser.optionFlags) & 64) this.range = [pos, 0];
5423
5484
  if (parser != null && parser.filename) this.loc.filename = parser.filename;
5424
5485
  }
5425
5486
  };
@@ -5507,19 +5568,21 @@
5507
5568
  node.type = type;
5508
5569
  node.end = endLoc.index;
5509
5570
  node.loc.end = endLoc;
5510
- if (this.options.ranges) node.range[1] = endLoc.index;
5511
- if (this.options.attachComment) this.processComment(node);
5571
+ if (this.optionFlags & 64) node.range[1] = endLoc.index;
5572
+ if (this.optionFlags & 2048) {
5573
+ this.processComment(node);
5574
+ }
5512
5575
  return node;
5513
5576
  }
5514
5577
  resetStartLocation(node, startLoc) {
5515
5578
  node.start = startLoc.index;
5516
5579
  node.loc.start = startLoc;
5517
- if (this.options.ranges) node.range[0] = startLoc.index;
5580
+ if (this.optionFlags & 64) node.range[0] = startLoc.index;
5518
5581
  }
5519
5582
  resetEndLocation(node, endLoc = this.state.lastTokEndLoc) {
5520
5583
  node.end = endLoc.index;
5521
5584
  node.loc.end = endLoc;
5522
- if (this.options.ranges) node.range[1] = endLoc.index;
5585
+ if (this.optionFlags & 64) node.range[1] = endLoc.index;
5523
5586
  }
5524
5587
  resetStartLocationFromNode(node, locationNode) {
5525
5588
  this.resetStartLocation(node, locationNode.loc.start);
@@ -6028,26 +6091,49 @@
6028
6091
  this.state.inType = oldInType;
6029
6092
  return this.finishNode(node, "TypeParameterDeclaration");
6030
6093
  }
6094
+ flowInTopLevelContext(cb) {
6095
+ if (this.curContext() !== types.brace) {
6096
+ const oldContext = this.state.context;
6097
+ this.state.context = [oldContext[0]];
6098
+ try {
6099
+ return cb();
6100
+ } finally {
6101
+ this.state.context = oldContext;
6102
+ }
6103
+ } else {
6104
+ return cb();
6105
+ }
6106
+ }
6107
+ flowParseTypeParameterInstantiationInExpression() {
6108
+ if (this.reScan_lt() !== 47) return;
6109
+ return this.flowParseTypeParameterInstantiation();
6110
+ }
6031
6111
  flowParseTypeParameterInstantiation() {
6032
6112
  const node = this.startNode();
6033
6113
  const oldInType = this.state.inType;
6034
- node.params = [];
6035
6114
  this.state.inType = true;
6036
- this.expect(47);
6037
- const oldNoAnonFunctionType = this.state.noAnonFunctionType;
6038
- this.state.noAnonFunctionType = false;
6039
- while (!this.match(48)) {
6040
- node.params.push(this.flowParseType());
6041
- if (!this.match(48)) {
6042
- this.expect(12);
6115
+ node.params = [];
6116
+ this.flowInTopLevelContext(() => {
6117
+ this.expect(47);
6118
+ const oldNoAnonFunctionType = this.state.noAnonFunctionType;
6119
+ this.state.noAnonFunctionType = false;
6120
+ while (!this.match(48)) {
6121
+ node.params.push(this.flowParseType());
6122
+ if (!this.match(48)) {
6123
+ this.expect(12);
6124
+ }
6043
6125
  }
6126
+ this.state.noAnonFunctionType = oldNoAnonFunctionType;
6127
+ });
6128
+ this.state.inType = oldInType;
6129
+ if (!this.state.inType && this.curContext() === types.brace) {
6130
+ this.reScan_lt_gt();
6044
6131
  }
6045
- this.state.noAnonFunctionType = oldNoAnonFunctionType;
6046
6132
  this.expect(48);
6047
- this.state.inType = oldInType;
6048
6133
  return this.finishNode(node, "TypeParameterInstantiation");
6049
6134
  }
6050
6135
  flowParseTypeParameterInstantiationCallOrNew() {
6136
+ if (this.reScan_lt() !== 47) return;
6051
6137
  const node = this.startNode();
6052
6138
  const oldInType = this.state.inType;
6053
6139
  node.params = [];
@@ -7099,8 +7185,10 @@
7099
7185
  }
7100
7186
  parseClassSuper(node) {
7101
7187
  super.parseClassSuper(node);
7102
- if (node.superClass && this.match(47)) {
7103
- node.superTypeParameters = this.flowParseTypeParameterInstantiation();
7188
+ if (node.superClass && (this.match(47) || this.match(51))) {
7189
+ {
7190
+ node.superTypeParameters = this.flowParseTypeParameterInstantiationInExpression();
7191
+ }
7104
7192
  }
7105
7193
  if (this.isContextual(113)) {
7106
7194
  this.next();
@@ -7431,12 +7519,12 @@
7431
7519
  this.next();
7432
7520
  const node = this.startNodeAt(startLoc);
7433
7521
  node.callee = base;
7434
- node.typeArguments = this.flowParseTypeParameterInstantiation();
7522
+ node.typeArguments = this.flowParseTypeParameterInstantiationInExpression();
7435
7523
  this.expect(10);
7436
7524
  node.arguments = this.parseCallExpressionArguments(11);
7437
7525
  node.optional = true;
7438
7526
  return this.finishCallExpression(node, true);
7439
- } else if (!noCalls && this.shouldParseTypes() && this.match(47)) {
7527
+ } else if (!noCalls && this.shouldParseTypes() && (this.match(47) || this.match(51))) {
7440
7528
  const node = this.startNodeAt(startLoc);
7441
7529
  node.callee = base;
7442
7530
  const result = this.tryParse(() => {
@@ -7856,6 +7944,14 @@
7856
7944
  node.body = this.flowEnumBody(this.startNode(), id);
7857
7945
  return this.finishNode(node, "EnumDeclaration");
7858
7946
  }
7947
+ jsxParseOpeningElementAfterName(node) {
7948
+ if (this.shouldParseTypes()) {
7949
+ if (this.match(47) || this.match(51)) {
7950
+ node.typeArguments = this.flowParseTypeParameterInstantiationInExpression();
7951
+ }
7952
+ }
7953
+ return super.jsxParseOpeningElementAfterName(node);
7954
+ }
7859
7955
  isLookaheadToken_lt() {
7860
7956
  const next = this.nextTokenStart();
7861
7957
  if (this.input.charCodeAt(next) === 60) {
@@ -7864,6 +7960,29 @@
7864
7960
  }
7865
7961
  return false;
7866
7962
  }
7963
+ reScan_lt_gt() {
7964
+ const {
7965
+ type
7966
+ } = this.state;
7967
+ if (type === 47) {
7968
+ this.state.pos -= 1;
7969
+ this.readToken_lt();
7970
+ } else if (type === 48) {
7971
+ this.state.pos -= 1;
7972
+ this.readToken_gt();
7973
+ }
7974
+ }
7975
+ reScan_lt() {
7976
+ const {
7977
+ type
7978
+ } = this.state;
7979
+ if (type === 51) {
7980
+ this.state.pos -= 2;
7981
+ this.finishOp(47, 1);
7982
+ return 47;
7983
+ }
7984
+ return type;
7985
+ }
7867
7986
  maybeUnwrapTypeCastExpression(node) {
7868
7987
  return node.type === "TypeCastExpression" ? node.expression : node;
7869
7988
  }
@@ -9370,8 +9489,14 @@
9370
9489
  this.expect(10);
9371
9490
  if (!this.match(134)) {
9372
9491
  this.raise(TSErrors.UnsupportedImportTypeArgument, this.state.startLoc);
9492
+ {
9493
+ node.argument = super.parseExprAtom();
9494
+ }
9495
+ } else {
9496
+ {
9497
+ node.argument = this.parseStringLiteral(this.state.value);
9498
+ }
9373
9499
  }
9374
- node.argument = super.parseExprAtom();
9375
9500
  if (this.eat(12) && !this.match(11)) {
9376
9501
  node.options = super.parseMaybeAssignAllowIn();
9377
9502
  this.eat(12);
@@ -9380,28 +9505,43 @@
9380
9505
  }
9381
9506
  this.expect(11);
9382
9507
  if (this.eat(16)) {
9383
- node.qualifier = this.tsParseEntityName();
9508
+ node.qualifier = this.tsParseEntityName(1 | 2);
9384
9509
  }
9385
9510
  if (this.match(47)) {
9386
- node.typeParameters = this.tsParseTypeArguments();
9511
+ {
9512
+ node.typeParameters = this.tsParseTypeArguments();
9513
+ }
9387
9514
  }
9388
9515
  return this.finishNode(node, "TSImportType");
9389
9516
  }
9390
- tsParseEntityName(allowReservedWords = true) {
9391
- let entity = this.parseIdentifier(allowReservedWords);
9517
+ tsParseEntityName(flags) {
9518
+ let entity;
9519
+ if (flags & 1 && this.match(78)) {
9520
+ if (flags & 2) {
9521
+ entity = this.parseIdentifier(true);
9522
+ } else {
9523
+ const node = this.startNode();
9524
+ this.next();
9525
+ entity = this.finishNode(node, "ThisExpression");
9526
+ }
9527
+ } else {
9528
+ entity = this.parseIdentifier(!!(flags & 1));
9529
+ }
9392
9530
  while (this.eat(16)) {
9393
9531
  const node = this.startNodeAtNode(entity);
9394
9532
  node.left = entity;
9395
- node.right = this.parseIdentifier(allowReservedWords);
9533
+ node.right = this.parseIdentifier(!!(flags & 1));
9396
9534
  entity = this.finishNode(node, "TSQualifiedName");
9397
9535
  }
9398
9536
  return entity;
9399
9537
  }
9400
9538
  tsParseTypeReference() {
9401
9539
  const node = this.startNode();
9402
- node.typeName = this.tsParseEntityName();
9540
+ node.typeName = this.tsParseEntityName(1);
9403
9541
  if (!this.hasPrecedingLineBreak() && this.match(47)) {
9404
- node.typeParameters = this.tsParseTypeArguments();
9542
+ {
9543
+ node.typeParameters = this.tsParseTypeArguments();
9544
+ }
9405
9545
  }
9406
9546
  return this.finishNode(node, "TSTypeReference");
9407
9547
  }
@@ -9424,10 +9564,14 @@
9424
9564
  if (this.match(83)) {
9425
9565
  node.exprName = this.tsParseImportType();
9426
9566
  } else {
9427
- node.exprName = this.tsParseEntityName();
9567
+ {
9568
+ node.exprName = this.tsParseEntityName(1 | 2);
9569
+ }
9428
9570
  }
9429
9571
  if (!this.hasPrecedingLineBreak() && this.match(47)) {
9430
- node.typeParameters = this.tsParseTypeArguments();
9572
+ {
9573
+ node.typeParameters = this.tsParseTypeArguments();
9574
+ }
9431
9575
  }
9432
9576
  return this.finishNode(node, "TSTypeQuery");
9433
9577
  }
@@ -10112,11 +10256,13 @@
10112
10256
  const originalStartLoc = this.state.startLoc;
10113
10257
  const delimitedList = this.tsParseDelimitedList("HeritageClauseElement", () => {
10114
10258
  const node = this.startNode();
10115
- node.expression = this.tsParseEntityName();
10116
- if (this.match(47)) {
10117
- node.typeParameters = this.tsParseTypeArguments();
10259
+ {
10260
+ node.expression = this.tsParseEntityName(1 | 2);
10261
+ if (this.match(47)) {
10262
+ node.typeParameters = this.tsParseTypeArguments();
10263
+ }
10264
+ return this.finishNode(node, "TSExpressionWithTypeArguments");
10118
10265
  }
10119
- return this.finishNode(node, "TSExpressionWithTypeArguments");
10120
10266
  });
10121
10267
  if (!delimitedList.length) {
10122
10268
  this.raise(TSErrors.EmptyHeritageClauseType, originalStartLoc, {
@@ -10161,13 +10307,17 @@
10161
10307
  this.semicolon();
10162
10308
  return this.finishNode(node, "TSTypeAliasDeclaration");
10163
10309
  }
10164
- tsInNoContext(cb) {
10165
- const oldContext = this.state.context;
10166
- this.state.context = [oldContext[0]];
10167
- try {
10310
+ tsInTopLevelContext(cb) {
10311
+ if (this.curContext() !== types.brace) {
10312
+ const oldContext = this.state.context;
10313
+ this.state.context = [oldContext[0]];
10314
+ try {
10315
+ return cb();
10316
+ } finally {
10317
+ this.state.context = oldContext;
10318
+ }
10319
+ } else {
10168
10320
  return cb();
10169
- } finally {
10170
- this.state.context = oldContext;
10171
10321
  }
10172
10322
  }
10173
10323
  tsInType(cb) {
@@ -10228,10 +10378,19 @@
10228
10378
  this.expectContextual(126);
10229
10379
  node.id = this.parseIdentifier();
10230
10380
  this.checkIdentifier(node.id, node.const ? 8971 : 8459);
10381
+ {
10382
+ this.expect(5);
10383
+ node.members = this.tsParseDelimitedList("EnumMembers", this.tsParseEnumMember.bind(this));
10384
+ this.expect(8);
10385
+ }
10386
+ return this.finishNode(node, "TSEnumDeclaration");
10387
+ }
10388
+ tsParseEnumBody() {
10389
+ const node = this.startNode();
10231
10390
  this.expect(5);
10232
10391
  node.members = this.tsParseDelimitedList("EnumMembers", this.tsParseEnumMember.bind(this));
10233
10392
  this.expect(8);
10234
- return this.finishNode(node, "TSEnumDeclaration");
10393
+ return this.finishNode(node, "TSEnumBody");
10235
10394
  }
10236
10395
  tsParseModuleBlock() {
10237
10396
  const node = this.startNode();
@@ -10300,7 +10459,7 @@
10300
10459
  return this.isContextual(119) && this.lookaheadCharCode() === 40;
10301
10460
  }
10302
10461
  tsParseModuleReference() {
10303
- return this.tsIsExternalModuleReference() ? this.tsParseExternalModuleReference() : this.tsParseEntityName(false);
10462
+ return this.tsIsExternalModuleReference() ? this.tsParseExternalModuleReference() : this.tsParseEntityName(0);
10304
10463
  }
10305
10464
  tsParseExternalModuleReference() {
10306
10465
  const node = this.startNode();
@@ -10474,7 +10633,7 @@
10474
10633
  }
10475
10634
  tsParseTypeArguments() {
10476
10635
  const node = this.startNode();
10477
- node.params = this.tsInType(() => this.tsInNoContext(() => {
10636
+ node.params = this.tsInType(() => this.tsInTopLevelContext(() => {
10478
10637
  this.expect(47);
10479
10638
  return this.tsParseDelimitedList("TypeParametersOrArguments", this.tsParseType.bind(this));
10480
10639
  }));
@@ -10619,7 +10778,9 @@
10619
10778
  }
10620
10779
  if (tokenIsTemplate(this.state.type)) {
10621
10780
  const result2 = super.parseTaggedTemplateExpression(base, startLoc, state);
10622
- result2.typeParameters = typeArguments;
10781
+ {
10782
+ result2.typeParameters = typeArguments;
10783
+ }
10623
10784
  return result2;
10624
10785
  }
10625
10786
  if (!noCalls && this.eat(10)) {
@@ -10627,7 +10788,9 @@
10627
10788
  node2.callee = base;
10628
10789
  node2.arguments = this.parseCallExpressionArguments(11);
10629
10790
  this.tsCheckForInvalidTypeCasts(node2.arguments);
10630
- node2.typeParameters = typeArguments;
10791
+ {
10792
+ node2.typeParameters = typeArguments;
10793
+ }
10631
10794
  if (state.optionalChainMember) {
10632
10795
  node2.optional = isOptionalCall;
10633
10796
  }
@@ -10639,7 +10802,9 @@
10639
10802
  }
10640
10803
  const node = this.startNodeAt(startLoc);
10641
10804
  node.expression = base;
10642
- node.typeParameters = typeArguments;
10805
+ {
10806
+ node.typeParameters = typeArguments;
10807
+ }
10643
10808
  return this.finishNode(node, "TSInstantiationExpression");
10644
10809
  });
10645
10810
  if (missingParenErrorLoc) {
@@ -10661,7 +10826,9 @@
10661
10826
  callee
10662
10827
  } = node;
10663
10828
  if (callee.type === "TSInstantiationExpression" && !((_callee$extra = callee.extra) != null && _callee$extra.parenthesized)) {
10664
- node.typeParameters = callee.typeParameters;
10829
+ {
10830
+ node.typeParameters = callee.typeParameters;
10831
+ }
10665
10832
  node.callee = callee.expression;
10666
10833
  }
10667
10834
  }
@@ -11042,7 +11209,9 @@
11042
11209
  parseClassSuper(node) {
11043
11210
  super.parseClassSuper(node);
11044
11211
  if (node.superClass && (this.match(47) || this.match(51))) {
11045
- node.superTypeParameters = this.tsParseTypeArgumentsInExpression();
11212
+ {
11213
+ node.superTypeParameters = this.tsParseTypeArgumentsInExpression();
11214
+ }
11046
11215
  }
11047
11216
  if (this.eatContextual(113)) {
11048
11217
  node.implements = this.tsParseHeritageClause("implements");
@@ -11252,17 +11421,19 @@
11252
11421
  }
11253
11422
  return super.parseBindingAtom();
11254
11423
  }
11255
- parseMaybeDecoratorArguments(expr) {
11424
+ parseMaybeDecoratorArguments(expr, startLoc) {
11256
11425
  if (this.match(47) || this.match(51)) {
11257
11426
  const typeArguments = this.tsParseTypeArgumentsInExpression();
11258
11427
  if (this.match(10)) {
11259
- const call = super.parseMaybeDecoratorArguments(expr);
11260
- call.typeParameters = typeArguments;
11428
+ const call = super.parseMaybeDecoratorArguments(expr, startLoc);
11429
+ {
11430
+ call.typeParameters = typeArguments;
11431
+ }
11261
11432
  return call;
11262
11433
  }
11263
11434
  this.unexpected(null, 10);
11264
11435
  }
11265
- return super.parseMaybeDecoratorArguments(expr);
11436
+ return super.parseMaybeDecoratorArguments(expr, startLoc);
11266
11437
  }
11267
11438
  checkCommaAfterRest(close) {
11268
11439
  if (this.state.isAmbientContext && this.match(12) && this.lookaheadCharCode() === close) {
@@ -11349,7 +11520,11 @@
11349
11520
  jsxParseOpeningElementAfterName(node) {
11350
11521
  if (this.match(47) || this.match(51)) {
11351
11522
  const typeArguments = this.tsTryParseAndCatch(() => this.tsParseTypeArgumentsInExpression());
11352
- if (typeArguments) node.typeParameters = typeArguments;
11523
+ if (typeArguments) {
11524
+ {
11525
+ node.typeParameters = typeArguments;
11526
+ }
11527
+ }
11353
11528
  }
11354
11529
  return super.jsxParseOpeningElementAfterName(node);
11355
11530
  }
@@ -11409,8 +11584,9 @@
11409
11584
  parseMethod(node, isGenerator, isAsync, isConstructor, allowDirectSuper, type, inClassScope) {
11410
11585
  const method = super.parseMethod(node, isGenerator, isAsync, isConstructor, allowDirectSuper, type, inClassScope);
11411
11586
  if (method.abstract) {
11412
- const hasBody = this.hasPlugin("estree") ? !!method.value.body : !!method.body;
11413
- if (hasBody) {
11587
+ const hasEstreePlugin = this.hasPlugin("estree");
11588
+ const methodFn = hasEstreePlugin ? method.value : method;
11589
+ if (methodFn.body) {
11414
11590
  const {
11415
11591
  key
11416
11592
  } = method;
@@ -11890,54 +12066,6 @@
11890
12066
  placeholders
11891
12067
  };
11892
12068
  var mixinPluginNames = Object.keys(mixinPlugins);
11893
- function createDefaultOptions() {
11894
- return {
11895
- sourceType: "script",
11896
- sourceFilename: void 0,
11897
- startIndex: 0,
11898
- startColumn: 0,
11899
- startLine: 1,
11900
- allowAwaitOutsideFunction: false,
11901
- allowReturnOutsideFunction: false,
11902
- allowNewTargetOutsideFunction: false,
11903
- allowImportExportEverywhere: false,
11904
- allowSuperOutsideMethod: false,
11905
- allowUndeclaredExports: false,
11906
- plugins: [],
11907
- strictMode: null,
11908
- ranges: false,
11909
- tokens: false,
11910
- createImportExpressions: false,
11911
- createParenthesizedExpressions: false,
11912
- errorRecovery: false,
11913
- attachComment: true,
11914
- annexB: true
11915
- };
11916
- }
11917
- function getOptions(opts) {
11918
- const options = createDefaultOptions();
11919
- if (opts == null) {
11920
- return options;
11921
- }
11922
- if (opts.annexB != null && opts.annexB !== false) {
11923
- throw new Error("The `annexB` option can only be set to `false`.");
11924
- }
11925
- for (const key of Object.keys(options)) {
11926
- if (opts[key] != null) options[key] = opts[key];
11927
- }
11928
- if (options.startLine === 1) {
11929
- if (opts.startIndex == null && options.startColumn > 0) {
11930
- options.startIndex = options.startColumn;
11931
- } else if (opts.startColumn == null && options.startIndex > 0) {
11932
- options.startColumn = options.startIndex;
11933
- }
11934
- } else if (opts.startColumn == null || opts.startIndex == null) {
11935
- if (opts.startIndex != null) {
11936
- throw new Error("With a `startLine > 1` you must also specify `startIndex` and `startColumn`.");
11937
- }
11938
- }
11939
- return options;
11940
- }
11941
12069
  var ExpressionParser = class extends LValParser {
11942
12070
  checkProto(prop, isRecord, protoRef, refExpressionErrors) {
11943
12071
  if (prop.type === "SpreadElement" || this.isObjectMethod(prop) || prop.computed || prop.shorthand) {
@@ -11975,7 +12103,7 @@
11975
12103
  this.finalizeRemainingComments();
11976
12104
  expr.comments = this.comments;
11977
12105
  expr.errors = this.state.errors;
11978
- if (this.options.tokens) {
12106
+ if (this.optionFlags & 128) {
11979
12107
  expr.tokens = this.tokens;
11980
12108
  }
11981
12109
  return expr;
@@ -12157,18 +12285,19 @@
12157
12285
  return this.withTopicBindingContext(() => {
12158
12286
  return this.parseHackPipeBody();
12159
12287
  });
12160
- case "smart":
12161
- return this.withTopicBindingContext(() => {
12162
- if (this.prodParam.hasYield && this.isContextual(108)) {
12163
- throw this.raise(Errors.PipeBodyIsTighter, this.state.startLoc);
12164
- }
12165
- return this.parseSmartPipelineBodyInStyle(this.parseExprOpBaseRightExpr(op, prec), startLoc);
12166
- });
12167
12288
  case "fsharp":
12168
12289
  return this.withSoloAwaitPermittingContext(() => {
12169
12290
  return this.parseFSharpPipelineBody(prec);
12170
12291
  });
12171
12292
  }
12293
+ if (this.getPluginOption("pipelineOperator", "proposal") === "smart") {
12294
+ return this.withTopicBindingContext(() => {
12295
+ if (this.prodParam.hasYield && this.isContextual(108)) {
12296
+ throw this.raise(Errors.PipeBodyIsTighter, this.state.startLoc);
12297
+ }
12298
+ return this.parseSmartPipelineBodyInStyle(this.parseExprOpBaseRightExpr(op, prec), startLoc);
12299
+ });
12300
+ }
12172
12301
  default:
12173
12302
  return this.parseExprOpBaseRightExpr(op, prec);
12174
12303
  }
@@ -12480,7 +12609,7 @@
12480
12609
  return this.parseImportMetaProperty(node);
12481
12610
  }
12482
12611
  if (this.match(10)) {
12483
- if (this.options.createImportExpressions) {
12612
+ if (this.optionFlags & 256) {
12484
12613
  return this.parseImportCall(node);
12485
12614
  } else {
12486
12615
  return this.finishNode(node, "Import");
@@ -12650,12 +12779,19 @@
12650
12779
  }
12651
12780
  finishTopicReference(node, startLoc, pipeProposal, tokenType) {
12652
12781
  if (this.testTopicReferenceConfiguration(pipeProposal, startLoc, tokenType)) {
12653
- const nodeType = pipeProposal === "smart" ? "PipelinePrimaryTopicReference" : "TopicReference";
12654
- if (!this.topicReferenceIsAllowedInCurrentContext()) {
12655
- this.raise(pipeProposal === "smart" ? Errors.PrimaryTopicNotAllowed : Errors.PipeTopicUnbound, startLoc);
12782
+ if (pipeProposal === "hack") {
12783
+ if (!this.topicReferenceIsAllowedInCurrentContext()) {
12784
+ this.raise(Errors.PipeTopicUnbound, startLoc);
12785
+ }
12786
+ this.registerTopicReference();
12787
+ return this.finishNode(node, "TopicReference");
12788
+ } else {
12789
+ if (!this.topicReferenceIsAllowedInCurrentContext()) {
12790
+ this.raise(Errors.PrimaryTopicNotAllowed, startLoc);
12791
+ }
12792
+ this.registerTopicReference();
12793
+ return this.finishNode(node, "PipelinePrimaryTopicReference");
12656
12794
  }
12657
- this.registerTopicReference();
12658
- return this.finishNode(node, nodeType);
12659
12795
  } else {
12660
12796
  throw this.raise(Errors.PipeTopicUnconfiguredToken, startLoc, {
12661
12797
  token: tokenLabelName(tokenType)
@@ -12707,9 +12843,9 @@
12707
12843
  parseSuper() {
12708
12844
  const node = this.startNode();
12709
12845
  this.next();
12710
- if (this.match(10) && !this.scope.allowDirectSuper && !this.options.allowSuperOutsideMethod) {
12846
+ if (this.match(10) && !this.scope.allowDirectSuper && !(this.optionFlags & 16)) {
12711
12847
  this.raise(Errors.SuperNotAllowed, node);
12712
- } else if (!this.scope.allowSuper && !this.options.allowSuperOutsideMethod) {
12848
+ } else if (!this.scope.allowSuper && !(this.optionFlags & 16)) {
12713
12849
  this.raise(Errors.UnexpectedSuper, node);
12714
12850
  }
12715
12851
  if (!this.match(10) && !this.match(0) && !this.match(16)) {
@@ -12762,9 +12898,8 @@
12762
12898
  this.sawUnambiguousESM = true;
12763
12899
  } else if (this.isContextual(105) || this.isContextual(97)) {
12764
12900
  const isSource = this.isContextual(105);
12765
- if (!isSource) this.unexpected();
12766
12901
  this.expectPlugin(isSource ? "sourcePhaseImports" : "deferredImportEvaluation");
12767
- if (!this.options.createImportExpressions) {
12902
+ if (!(this.optionFlags & 256)) {
12768
12903
  throw this.raise(Errors.DynamicImportPhaseRequiresImportExpressions, this.state.startLoc, {
12769
12904
  phase: this.state.value
12770
12905
  });
@@ -12884,7 +13019,7 @@
12884
13019
  return this.wrapParenthesis(startLoc, val);
12885
13020
  }
12886
13021
  wrapParenthesis(startLoc, expression) {
12887
- if (!this.options.createParenthesizedExpressions) {
13022
+ if (!(this.optionFlags & 512)) {
12888
13023
  this.addExtra(expression, "parenthesized", true);
12889
13024
  this.addExtra(expression, "parenStart", startLoc.index);
12890
13025
  this.takeSurroundingComments(expression, startLoc.index, this.state.lastTokEndLoc.index);
@@ -12912,7 +13047,7 @@
12912
13047
  const meta = this.createIdentifier(this.startNodeAtNode(node), "new");
12913
13048
  this.next();
12914
13049
  const metaProp = this.parseMetaProperty(node, meta, "target");
12915
- if (!this.scope.inNonArrowFunction && !this.scope.inClass && !this.options.allowNewTargetOutsideFunction) {
13050
+ if (!this.scope.inNonArrowFunction && !this.scope.inClass && !(this.optionFlags & 4)) {
12916
13051
  this.raise(Errors.UnexpectedNewTarget, metaProp);
12917
13052
  }
12918
13053
  return metaProp;
@@ -13426,7 +13561,7 @@
13426
13561
  }
13427
13562
  }
13428
13563
  recordAwaitIfAllowed() {
13429
- const isAwaitAllowed = this.prodParam.hasAwait || this.options.allowAwaitOutsideFunction && !this.scope.inFunction;
13564
+ const isAwaitAllowed = this.prodParam.hasAwait || this.optionFlags & 1 && !this.scope.inFunction;
13430
13565
  if (isAwaitAllowed && !this.scope.inFunction) {
13431
13566
  this.state.hasTopLevelAwait = true;
13432
13567
  }
@@ -13438,7 +13573,7 @@
13438
13573
  if (this.eat(55)) {
13439
13574
  this.raise(Errors.ObsoleteAwaitStar, node);
13440
13575
  }
13441
- if (!this.scope.inFunction && !this.options.allowAwaitOutsideFunction) {
13576
+ if (!this.scope.inFunction && !(this.optionFlags & 1)) {
13442
13577
  if (this.isAmbiguousAwait()) {
13443
13578
  this.ambiguousScriptDifferentAst = true;
13444
13579
  } else {
@@ -13763,7 +13898,7 @@
13763
13898
  parseTopLevel(file, program) {
13764
13899
  file.program = this.parseProgram(program);
13765
13900
  file.comments = this.comments;
13766
- if (this.options.tokens) {
13901
+ if (this.optionFlags & 128) {
13767
13902
  file.tokens = babel7CompatTokens(this.tokens, this.input, this.startIndex);
13768
13903
  }
13769
13904
  return this.finishNode(file, "File");
@@ -13773,7 +13908,7 @@
13773
13908
  program.interpreter = this.parseInterpreterDirective();
13774
13909
  this.parseBlockBody(program, true, true, end);
13775
13910
  if (this.inModule) {
13776
- if (!this.options.allowUndeclaredExports && this.scope.undefinedExports.size > 0) {
13911
+ if (!(this.optionFlags & 32) && this.scope.undefinedExports.size > 0) {
13777
13912
  for (const [localName, at] of Array.from(this.scope.undefinedExports)) {
13778
13913
  this.raise(Errors.ModuleExportUndefined, at, {
13779
13914
  localName
@@ -13994,7 +14129,7 @@
13994
14129
  }
13995
14130
  }
13996
14131
  case 82: {
13997
- if (!this.options.allowImportExportEverywhere && !topLevel) {
14132
+ if (!(this.optionFlags & 8) && !topLevel) {
13998
14133
  this.raise(Errors.UnexpectedImportExport, this.state.startLoc);
13999
14134
  }
14000
14135
  this.next();
@@ -14032,7 +14167,7 @@
14032
14167
  }
14033
14168
  }
14034
14169
  assertModuleNodeAllowed(node) {
14035
- if (!this.options.allowImportExportEverywhere && !this.inModule) {
14170
+ if (!(this.optionFlags & 8) && !this.inModule) {
14036
14171
  this.raise(Errors.ImportOutsideModule, node);
14037
14172
  }
14038
14173
  }
@@ -14042,7 +14177,8 @@
14042
14177
  }
14043
14178
  maybeTakeDecorators(maybeDecorators, classNode, exportNode) {
14044
14179
  if (maybeDecorators) {
14045
- if (classNode.decorators && classNode.decorators.length > 0) {
14180
+ var _classNode$decorators;
14181
+ if ((_classNode$decorators = classNode.decorators) != null && _classNode$decorators.length) {
14046
14182
  if (typeof this.getPluginOption("decorators", "decoratorsBeforeExport") !== "boolean") {
14047
14183
  this.raise(Errors.DecoratorsBeforeAfterExport, classNode.decorators[0]);
14048
14184
  }
@@ -14089,7 +14225,7 @@
14089
14225
  this.expect(11);
14090
14226
  expr = this.wrapParenthesis(startLoc2, expr);
14091
14227
  const paramsStartLoc = this.state.startLoc;
14092
- node.expression = this.parseMaybeDecoratorArguments(expr);
14228
+ node.expression = this.parseMaybeDecoratorArguments(expr, startLoc2);
14093
14229
  if (this.getPluginOption("decorators", "allowCallParenthesized") === false && node.expression !== expr) {
14094
14230
  this.raise(Errors.DecoratorArgumentsOutsideParentheses, paramsStartLoc);
14095
14231
  }
@@ -14107,16 +14243,16 @@
14107
14243
  node2.computed = false;
14108
14244
  expr = this.finishNode(node2, "MemberExpression");
14109
14245
  }
14110
- node.expression = this.parseMaybeDecoratorArguments(expr);
14246
+ node.expression = this.parseMaybeDecoratorArguments(expr, startLoc);
14111
14247
  }
14112
14248
  } else {
14113
14249
  node.expression = this.parseExprSubscripts();
14114
14250
  }
14115
14251
  return this.finishNode(node, "Decorator");
14116
14252
  }
14117
- parseMaybeDecoratorArguments(expr) {
14253
+ parseMaybeDecoratorArguments(expr, startLoc) {
14118
14254
  if (this.eat(10)) {
14119
- const node = this.startNodeAtNode(expr);
14255
+ const node = this.startNodeAt(startLoc);
14120
14256
  node.callee = expr;
14121
14257
  node.arguments = this.parseCallExpressionArguments(11);
14122
14258
  this.toReferencedList(node.arguments);
@@ -14263,7 +14399,7 @@
14263
14399
  return this.finishNode(node, "IfStatement");
14264
14400
  }
14265
14401
  parseReturnStatement(node) {
14266
- if (!this.prodParam.hasReturn && !this.options.allowReturnOutsideFunction) {
14402
+ if (!this.prodParam.hasReturn && !(this.optionFlags & 2)) {
14267
14403
  this.raise(Errors.IllegalReturn, this.state.startLoc);
14268
14404
  }
14269
14405
  this.next();
@@ -15554,6 +15690,47 @@
15554
15690
  this.plugins = pluginsMap;
15555
15691
  this.filename = options.sourceFilename;
15556
15692
  this.startIndex = options.startIndex;
15693
+ let optionFlags = 0;
15694
+ if (options.allowAwaitOutsideFunction) {
15695
+ optionFlags |= 1;
15696
+ }
15697
+ if (options.allowReturnOutsideFunction) {
15698
+ optionFlags |= 2;
15699
+ }
15700
+ if (options.allowImportExportEverywhere) {
15701
+ optionFlags |= 8;
15702
+ }
15703
+ if (options.allowSuperOutsideMethod) {
15704
+ optionFlags |= 16;
15705
+ }
15706
+ if (options.allowUndeclaredExports) {
15707
+ optionFlags |= 32;
15708
+ }
15709
+ if (options.allowNewTargetOutsideFunction) {
15710
+ optionFlags |= 4;
15711
+ }
15712
+ if (options.ranges) {
15713
+ optionFlags |= 64;
15714
+ }
15715
+ if (options.tokens) {
15716
+ optionFlags |= 128;
15717
+ }
15718
+ if (options.createImportExpressions) {
15719
+ optionFlags |= 256;
15720
+ }
15721
+ if (options.createParenthesizedExpressions) {
15722
+ optionFlags |= 512;
15723
+ }
15724
+ if (options.errorRecovery) {
15725
+ optionFlags |= 1024;
15726
+ }
15727
+ if (options.attachComment) {
15728
+ optionFlags |= 2048;
15729
+ }
15730
+ if (options.annexB) {
15731
+ optionFlags |= 4096;
15732
+ }
15733
+ this.optionFlags = optionFlags;
15557
15734
  }
15558
15735
  getScopeHandler() {
15559
15736
  return ScopeHandler;
@@ -55121,9 +55298,9 @@ Expected function or array of functions, received type ${typeof value}.`
55121
55298
  }
55122
55299
  });
55123
55300
 
55124
- // ../../node_modules/.pnpm/vue@3.5.13_typescript@5.7.2/node_modules/vue/dist/vue.cjs.prod.js
55301
+ // ../../node_modules/.pnpm/vue@3.5.13_typescript@5.7.3/node_modules/vue/dist/vue.cjs.prod.js
55125
55302
  var require_vue_cjs_prod = __commonJS({
55126
- "../../node_modules/.pnpm/vue@3.5.13_typescript@5.7.2/node_modules/vue/dist/vue.cjs.prod.js"(exports2) {
55303
+ "../../node_modules/.pnpm/vue@3.5.13_typescript@5.7.3/node_modules/vue/dist/vue.cjs.prod.js"(exports2) {
55127
55304
  "use strict";
55128
55305
  Object.defineProperty(exports2, "__esModule", { value: true });
55129
55306
  var compilerDom = require_compiler_dom();
@@ -55182,9 +55359,9 @@ Expected function or array of functions, received type ${typeof value}.`
55182
55359
  }
55183
55360
  });
55184
55361
 
55185
- // ../../node_modules/.pnpm/vue@3.5.13_typescript@5.7.2/node_modules/vue/dist/vue.cjs.js
55362
+ // ../../node_modules/.pnpm/vue@3.5.13_typescript@5.7.3/node_modules/vue/dist/vue.cjs.js
55186
55363
  var require_vue_cjs = __commonJS({
55187
- "../../node_modules/.pnpm/vue@3.5.13_typescript@5.7.2/node_modules/vue/dist/vue.cjs.js"(exports2) {
55364
+ "../../node_modules/.pnpm/vue@3.5.13_typescript@5.7.3/node_modules/vue/dist/vue.cjs.js"(exports2) {
55188
55365
  "use strict";
55189
55366
  Object.defineProperty(exports2, "__esModule", { value: true });
55190
55367
  var compilerDom = require_compiler_dom();
@@ -55257,9 +55434,9 @@ ${codeFrame}` : message);
55257
55434
  }
55258
55435
  });
55259
55436
 
55260
- // ../../node_modules/.pnpm/vue@3.5.13_typescript@5.7.2/node_modules/vue/index.js
55437
+ // ../../node_modules/.pnpm/vue@3.5.13_typescript@5.7.3/node_modules/vue/index.js
55261
55438
  var require_vue = __commonJS({
55262
- "../../node_modules/.pnpm/vue@3.5.13_typescript@5.7.2/node_modules/vue/index.js"(exports2, module2) {
55439
+ "../../node_modules/.pnpm/vue@3.5.13_typescript@5.7.3/node_modules/vue/index.js"(exports2, module2) {
55263
55440
  "use strict";
55264
55441
  if (process.env.NODE_ENV === "production") {
55265
55442
  module2.exports = require_vue_cjs_prod();
@@ -64888,9 +65065,9 @@ ${codeFrame}` : message);
64888
65065
  }
64889
65066
  });
64890
65067
 
64891
- // ../../node_modules/.pnpm/debug@4.4.0_supports-color@5.5.0/node_modules/debug/src/common.js
65068
+ // ../../node_modules/.pnpm/debug@4.4.0/node_modules/debug/src/common.js
64892
65069
  var require_common = __commonJS({
64893
- "../../node_modules/.pnpm/debug@4.4.0_supports-color@5.5.0/node_modules/debug/src/common.js"(exports2, module2) {
65070
+ "../../node_modules/.pnpm/debug@4.4.0/node_modules/debug/src/common.js"(exports2, module2) {
64894
65071
  "use strict";
64895
65072
  function setup(env) {
64896
65073
  createDebug.debug = createDebug;
@@ -65066,9 +65243,9 @@ ${codeFrame}` : message);
65066
65243
  }
65067
65244
  });
65068
65245
 
65069
- // ../../node_modules/.pnpm/debug@4.4.0_supports-color@5.5.0/node_modules/debug/src/browser.js
65246
+ // ../../node_modules/.pnpm/debug@4.4.0/node_modules/debug/src/browser.js
65070
65247
  var require_browser = __commonJS({
65071
- "../../node_modules/.pnpm/debug@4.4.0_supports-color@5.5.0/node_modules/debug/src/browser.js"(exports2, module2) {
65248
+ "../../node_modules/.pnpm/debug@4.4.0/node_modules/debug/src/browser.js"(exports2, module2) {
65072
65249
  "use strict";
65073
65250
  exports2.formatArgs = formatArgs;
65074
65251
  exports2.save = save;
@@ -65237,35 +65414,41 @@ ${codeFrame}` : message);
65237
65414
  }
65238
65415
  });
65239
65416
 
65240
- // ../../node_modules/.pnpm/has-flag@3.0.0/node_modules/has-flag/index.js
65417
+ // ../../node_modules/.pnpm/has-flag@4.0.0/node_modules/has-flag/index.js
65241
65418
  var require_has_flag = __commonJS({
65242
- "../../node_modules/.pnpm/has-flag@3.0.0/node_modules/has-flag/index.js"(exports2, module2) {
65419
+ "../../node_modules/.pnpm/has-flag@4.0.0/node_modules/has-flag/index.js"(exports2, module2) {
65243
65420
  "use strict";
65244
- module2.exports = (flag, argv) => {
65245
- argv = argv || process.argv;
65421
+ module2.exports = (flag, argv = process.argv) => {
65246
65422
  const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
65247
- const pos = argv.indexOf(prefix + flag);
65248
- const terminatorPos = argv.indexOf("--");
65249
- return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
65423
+ const position = argv.indexOf(prefix + flag);
65424
+ const terminatorPosition = argv.indexOf("--");
65425
+ return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
65250
65426
  };
65251
65427
  }
65252
65428
  });
65253
65429
 
65254
- // ../../node_modules/.pnpm/supports-color@5.5.0/node_modules/supports-color/index.js
65430
+ // ../../node_modules/.pnpm/supports-color@7.2.0/node_modules/supports-color/index.js
65255
65431
  var require_supports_color = __commonJS({
65256
- "../../node_modules/.pnpm/supports-color@5.5.0/node_modules/supports-color/index.js"(exports2, module2) {
65432
+ "../../node_modules/.pnpm/supports-color@7.2.0/node_modules/supports-color/index.js"(exports2, module2) {
65257
65433
  "use strict";
65258
65434
  var os = __require("os");
65435
+ var tty = __require("tty");
65259
65436
  var hasFlag = require_has_flag();
65260
- var env = process.env;
65437
+ var { env } = process;
65261
65438
  var forceColor;
65262
- if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false")) {
65263
- forceColor = false;
65439
+ if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
65440
+ forceColor = 0;
65264
65441
  } else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
65265
- forceColor = true;
65442
+ forceColor = 1;
65266
65443
  }
65267
65444
  if ("FORCE_COLOR" in env) {
65268
- forceColor = env.FORCE_COLOR.length === 0 || parseInt(env.FORCE_COLOR, 10) !== 0;
65445
+ if (env.FORCE_COLOR === "true") {
65446
+ forceColor = 1;
65447
+ } else if (env.FORCE_COLOR === "false") {
65448
+ forceColor = 0;
65449
+ } else {
65450
+ forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
65451
+ }
65269
65452
  }
65270
65453
  function translateLevel(level) {
65271
65454
  if (level === 0) {
@@ -65278,8 +65461,8 @@ ${codeFrame}` : message);
65278
65461
  has16m: level >= 3
65279
65462
  };
65280
65463
  }
65281
- function supportsColor(stream4) {
65282
- if (forceColor === false) {
65464
+ function supportsColor(haveStream, streamIsTTY) {
65465
+ if (forceColor === 0) {
65283
65466
  return 0;
65284
65467
  }
65285
65468
  if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
@@ -65288,19 +65471,22 @@ ${codeFrame}` : message);
65288
65471
  if (hasFlag("color=256")) {
65289
65472
  return 2;
65290
65473
  }
65291
- if (stream4 && !stream4.isTTY && forceColor !== true) {
65474
+ if (haveStream && !streamIsTTY && forceColor === void 0) {
65292
65475
  return 0;
65293
65476
  }
65294
- const min = forceColor ? 1 : 0;
65477
+ const min = forceColor || 0;
65478
+ if (env.TERM === "dumb") {
65479
+ return min;
65480
+ }
65295
65481
  if (process.platform === "win32") {
65296
65482
  const osRelease = os.release().split(".");
65297
- if (Number(process.versions.node.split(".")[0]) >= 8 && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
65483
+ if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
65298
65484
  return Number(osRelease[2]) >= 14931 ? 3 : 2;
65299
65485
  }
65300
65486
  return 1;
65301
65487
  }
65302
65488
  if ("CI" in env) {
65303
- if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
65489
+ if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "GITHUB_ACTIONS", "BUILDKITE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
65304
65490
  return 1;
65305
65491
  }
65306
65492
  return min;
@@ -65329,26 +65515,23 @@ ${codeFrame}` : message);
65329
65515
  if ("COLORTERM" in env) {
65330
65516
  return 1;
65331
65517
  }
65332
- if (env.TERM === "dumb") {
65333
- return min;
65334
- }
65335
65518
  return min;
65336
65519
  }
65337
65520
  function getSupportLevel(stream4) {
65338
- const level = supportsColor(stream4);
65521
+ const level = supportsColor(stream4, stream4 && stream4.isTTY);
65339
65522
  return translateLevel(level);
65340
65523
  }
65341
65524
  module2.exports = {
65342
65525
  supportsColor: getSupportLevel,
65343
- stdout: getSupportLevel(process.stdout),
65344
- stderr: getSupportLevel(process.stderr)
65526
+ stdout: translateLevel(supportsColor(true, tty.isatty(1))),
65527
+ stderr: translateLevel(supportsColor(true, tty.isatty(2)))
65345
65528
  };
65346
65529
  }
65347
65530
  });
65348
65531
 
65349
- // ../../node_modules/.pnpm/debug@4.4.0_supports-color@5.5.0/node_modules/debug/src/node.js
65532
+ // ../../node_modules/.pnpm/debug@4.4.0/node_modules/debug/src/node.js
65350
65533
  var require_node = __commonJS({
65351
- "../../node_modules/.pnpm/debug@4.4.0_supports-color@5.5.0/node_modules/debug/src/node.js"(exports2, module2) {
65534
+ "../../node_modules/.pnpm/debug@4.4.0/node_modules/debug/src/node.js"(exports2, module2) {
65352
65535
  "use strict";
65353
65536
  var tty = __require("tty");
65354
65537
  var util3 = __require("util");
@@ -65521,9 +65704,9 @@ ${codeFrame}` : message);
65521
65704
  }
65522
65705
  });
65523
65706
 
65524
- // ../../node_modules/.pnpm/debug@4.4.0_supports-color@5.5.0/node_modules/debug/src/index.js
65707
+ // ../../node_modules/.pnpm/debug@4.4.0/node_modules/debug/src/index.js
65525
65708
  var require_src = __commonJS({
65526
- "../../node_modules/.pnpm/debug@4.4.0_supports-color@5.5.0/node_modules/debug/src/index.js"(exports2, module2) {
65709
+ "../../node_modules/.pnpm/debug@4.4.0/node_modules/debug/src/index.js"(exports2, module2) {
65527
65710
  "use strict";
65528
65711
  if (typeof process === "undefined" || process.type === "renderer" || process.browser === true || process.__nwjs) {
65529
65712
  module2.exports = require_browser();
@@ -66974,11 +67157,11 @@ ${codeFrame}` : message);
66974
67157
  await Promise.all(promises.map((promise) => promise()));
66975
67158
  }
66976
67159
 
66977
- // ../../node_modules/.pnpm/vue@3.5.13_typescript@5.7.2/node_modules/vue/index.mjs
67160
+ // ../../node_modules/.pnpm/vue@3.5.13_typescript@5.7.3/node_modules/vue/index.mjs
66978
67161
  var vue_exports = {};
66979
67162
  __reExport(vue_exports, __toESM(require_vue(), 1));
66980
67163
 
66981
- // ../../node_modules/.pnpm/@vueuse+shared@12.3.0_typescript@5.7.2/node_modules/@vueuse/shared/index.mjs
67164
+ // ../../node_modules/.pnpm/@vueuse+shared@12.5.0_typescript@5.7.3/node_modules/@vueuse/shared/index.mjs
66982
67165
  var isWorker = typeof WorkerGlobalScope !== "undefined" && globalThis instanceof WorkerGlobalScope;
66983
67166
  var noop = () => {
66984
67167
  };
@@ -70414,7 +70597,7 @@ ${codeFrame}` : message);
70414
70597
  mergeConfig: mergeConfig2
70415
70598
  } = axios_default;
70416
70599
 
70417
- // ../../node_modules/.pnpm/@vueuse+integrations@12.3.0_axios@1.7.9_change-case@5.4.4_focus-trap@7.6.2_qrcode@1.5.4_typescript@5.7.2/node_modules/@vueuse/integrations/useAxios.mjs
70600
+ // ../../node_modules/.pnpm/@vueuse+integrations@12.5.0_axios@1.7.9_focus-trap@7.6.4_qrcode@1.5.4_typescript@5.7.3/node_modules/@vueuse/integrations/useAxios.mjs
70418
70601
  function useAxios(...args) {
70419
70602
  const url2 = typeof args[0] === "string" ? args[0] : void 0;
70420
70603
  const argsPlaceholder = typeof url2 === "string" ? 1 : 0;
@@ -70543,6 +70726,33 @@ ${codeFrame}` : message);
70543
70726
  } = params;
70544
70727
  return useAxios(url2, config, instance, options);
70545
70728
  }
70729
+
70730
+ // src/ruan-cat-pkg-info.ts
70731
+ var import_node_child_process = __require("node:child_process");
70732
+ async function getRuanCatPkgInfo() {
70733
+ return new Promise((resolve, reject) => {
70734
+ const result = (0, import_node_child_process.spawnSync)("pnpm", ["s", "@ruan-cat/", "--json"], { encoding: "utf-8" });
70735
+ if (result.error) {
70736
+ console.error(`Error executing command: ${result.error.message}`);
70737
+ reject(result.error);
70738
+ return;
70739
+ }
70740
+ if (result.stderr) {
70741
+ console.error(`Error in output: ${result.stderr}`);
70742
+ reject(new Error(result.stderr));
70743
+ return;
70744
+ }
70745
+ const packages = JSON.parse(result.stdout);
70746
+ const res = packages.map(
70747
+ (pkg) => ({
70748
+ name: pkg.name,
70749
+ description: pkg.description,
70750
+ url: `https://npm.im/${pkg.name}`
70751
+ })
70752
+ );
70753
+ resolve(res);
70754
+ });
70755
+ }
70546
70756
  })();
70547
70757
  /*! Bundled license information:
70548
70758