@ruan-cat/utils 1.4.2 → 1.5.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.7/node_modules/@babel/parser/lib/index.js
1661
+ // ../../node_modules/.pnpm/@babel+parser@7.26.8/node_modules/@babel/parser/lib/index.js
1662
1662
  var require_lib = __commonJS({
1663
- "../../node_modules/.pnpm/@babel+parser@7.26.7/node_modules/@babel/parser/lib/index.js"(exports2) {
1663
+ "../../node_modules/.pnpm/@babel+parser@7.26.8/node_modules/@babel/parser/lib/index.js"(exports2) {
1664
1664
  "use strict";
1665
1665
  Object.defineProperty(exports2, "__esModule", {
1666
1666
  value: true
@@ -9826,10 +9826,11 @@
9826
9826
  return this.finishNode(node, "TSTupleType");
9827
9827
  }
9828
9828
  tsParseTupleElementType() {
9829
+ const restStartLoc = this.state.startLoc;
9830
+ const rest = this.eat(21);
9829
9831
  const {
9830
9832
  startLoc
9831
9833
  } = this.state;
9832
- const rest = this.eat(21);
9833
9834
  let labeled;
9834
9835
  let label;
9835
9836
  let optional;
@@ -9844,12 +9845,11 @@
9844
9845
  type = this.tsParseType();
9845
9846
  } else if (chAfterWord === 63) {
9846
9847
  optional = true;
9847
- const startLoc2 = this.state.startLoc;
9848
9848
  const wordName = this.state.value;
9849
9849
  const typeOrLabel = this.tsParseNonArrayType();
9850
9850
  if (this.lookaheadCharCode() === 58) {
9851
9851
  labeled = true;
9852
- label = this.createIdentifier(this.startNodeAt(startLoc2), wordName);
9852
+ label = this.createIdentifier(this.startNodeAt(startLoc), wordName);
9853
9853
  this.expect(17);
9854
9854
  this.expect(14);
9855
9855
  type = this.tsParseType();
@@ -9866,7 +9866,7 @@
9866
9866
  if (labeled) {
9867
9867
  let labeledNode;
9868
9868
  if (label) {
9869
- labeledNode = this.startNodeAtNode(label);
9869
+ labeledNode = this.startNodeAt(startLoc);
9870
9870
  labeledNode.optional = optional;
9871
9871
  labeledNode.label = label;
9872
9872
  labeledNode.elementType = type;
@@ -9875,7 +9875,7 @@
9875
9875
  this.raise(TSErrors.TupleOptionalAfterType, this.state.lastTokStartLoc);
9876
9876
  }
9877
9877
  } else {
9878
- labeledNode = this.startNodeAtNode(type);
9878
+ labeledNode = this.startNodeAt(startLoc);
9879
9879
  labeledNode.optional = optional;
9880
9880
  this.raise(TSErrors.InvalidTupleMemberLabel, type);
9881
9881
  labeledNode.label = type;
@@ -9883,12 +9883,12 @@
9883
9883
  }
9884
9884
  type = this.finishNode(labeledNode, "TSNamedTupleMember");
9885
9885
  } else if (optional) {
9886
- const optionalTypeNode = this.startNodeAtNode(type);
9886
+ const optionalTypeNode = this.startNodeAt(startLoc);
9887
9887
  optionalTypeNode.typeAnnotation = type;
9888
9888
  type = this.finishNode(optionalTypeNode, "TSOptionalType");
9889
9889
  }
9890
9890
  if (rest) {
9891
- const restNode = this.startNodeAt(startLoc);
9891
+ const restNode = this.startNodeAt(restStartLoc);
9892
9892
  restNode.typeAnnotation = type;
9893
9893
  type = this.finishNode(restNode, "TSRestType");
9894
9894
  }
@@ -9927,9 +9927,11 @@
9927
9927
  return this.finishNode(node, "TSLiteralType");
9928
9928
  }
9929
9929
  tsParseTemplateLiteralType() {
9930
- const node = this.startNode();
9931
- node.literal = super.parseTemplate(false);
9932
- return this.finishNode(node, "TSLiteralType");
9930
+ {
9931
+ const node = this.startNode();
9932
+ node.literal = super.parseTemplate(false);
9933
+ return this.finishNode(node, "TSLiteralType");
9934
+ }
9933
9935
  }
9934
9936
  parseTemplateSubstitution() {
9935
9937
  if (this.state.inType) return this.tsParseType();
@@ -9995,15 +9997,18 @@
9995
9997
  this.unexpected();
9996
9998
  }
9997
9999
  tsParseArrayTypeOrHigher() {
10000
+ const {
10001
+ startLoc
10002
+ } = this.state;
9998
10003
  let type = this.tsParseNonArrayType();
9999
10004
  while (!this.hasPrecedingLineBreak() && this.eat(0)) {
10000
10005
  if (this.match(3)) {
10001
- const node = this.startNodeAtNode(type);
10006
+ const node = this.startNodeAt(startLoc);
10002
10007
  node.elementType = type;
10003
10008
  this.expect(3);
10004
10009
  type = this.finishNode(node, "TSArrayType");
10005
10010
  } else {
10006
- const node = this.startNodeAtNode(type);
10011
+ const node = this.startNodeAt(startLoc);
10007
10012
  node.objectType = type;
10008
10013
  node.indexType = this.tsParseType();
10009
10014
  this.expect(3);
@@ -10443,7 +10448,9 @@
10443
10448
  return this.finishNode(node, "TSModuleDeclaration");
10444
10449
  }
10445
10450
  tsParseImportEqualsDeclaration(node, maybeDefaultIdentifier, isExport) {
10446
- node.isExport = isExport || false;
10451
+ {
10452
+ node.isExport = isExport || false;
10453
+ }
10447
10454
  node.id = maybeDefaultIdentifier || this.parseIdentifier();
10448
10455
  this.checkIdentifier(node.id, 4096);
10449
10456
  this.expect(29);
@@ -10910,15 +10917,18 @@
10910
10917
  }
10911
10918
  parseExport(node, decorators) {
10912
10919
  if (this.match(83)) {
10913
- this.next();
10914
10920
  const nodeImportEquals = node;
10921
+ this.next();
10915
10922
  let maybeDefaultIdentifier = null;
10916
10923
  if (this.isContextual(130) && this.isPotentialImportPhase(false)) {
10917
10924
  maybeDefaultIdentifier = this.parseMaybeImportPhase(nodeImportEquals, false);
10918
10925
  } else {
10919
10926
  nodeImportEquals.importKind = "value";
10920
10927
  }
10921
- return this.tsParseImportEqualsDeclaration(nodeImportEquals, maybeDefaultIdentifier, true);
10928
+ const declaration = this.tsParseImportEqualsDeclaration(nodeImportEquals, maybeDefaultIdentifier, true);
10929
+ {
10930
+ return declaration;
10931
+ }
10922
10932
  } else if (this.eat(29)) {
10923
10933
  const assign = node;
10924
10934
  assign.expression = super.parseExpression();
@@ -11118,7 +11128,7 @@
11118
11128
  if (declaration.type === "TSInterfaceDeclaration" || declaration.type === "TSTypeAliasDeclaration" || isDeclare) {
11119
11129
  node.exportKind = "type";
11120
11130
  }
11121
- if (isDeclare) {
11131
+ if (isDeclare && declaration.type !== "TSImportEqualsDeclaration") {
11122
11132
  this.resetStartLocation(declaration, startLoc);
11123
11133
  declaration.declare = true;
11124
11134
  }
@@ -70767,6 +70777,11 @@ ${codeFrame}` : message);
70767
70777
  resolve(res);
70768
70778
  });
70769
70779
  }
70780
+
70781
+ // src/node.ts
70782
+ function pathChange(path) {
70783
+ return path.replace(/\\/g, "/");
70784
+ }
70770
70785
  })();
70771
70786
  /*! Bundled license information:
70772
70787