@danielx/civet 0.6.36 → 0.6.38

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/main.mjs CHANGED
@@ -890,6 +890,28 @@ var require_lib = __commonJS({
890
890
  }
891
891
  return expandedOps;
892
892
  }
893
+ function handleThisPrivateShorthands(value) {
894
+ if (value.privateShorthand) {
895
+ value = value.children[1].children[1];
896
+ return [value, false];
897
+ }
898
+ if (value.type === "MemberExpression" || value.type === "CallExpression") {
899
+ let suppressPrefix = value.thisShorthand;
900
+ value = {
901
+ ...value,
902
+ children: value.children.map((c, i) => {
903
+ if (i === 0) {
904
+ let s;
905
+ [c, s] = handleThisPrivateShorthands(c);
906
+ suppressPrefix || (suppressPrefix = s);
907
+ }
908
+ return c;
909
+ })
910
+ };
911
+ return [value, suppressPrefix];
912
+ }
913
+ return [value, value.thisShorthand];
914
+ }
893
915
  function processCallMemberExpression(node) {
894
916
  const { children } = node;
895
917
  for (let i = 0; i < children.length; i++) {
@@ -917,11 +939,15 @@ var require_lib = __commonJS({
917
939
  throw new Error("Glob pattern cannot have method definition");
918
940
  }
919
941
  if (part.value && !["CallExpression", "MemberExpression", "Identifier"].includes(part.value.type)) {
920
- throw new Error("Glob pattern must have call or member expression value");
942
+ throw new Error(`Glob pattern must have call or member expression value, found ${JSON.stringify(part.value)}`);
921
943
  }
944
+ let suppressPrefix = false;
922
945
  let value = part.value ?? part.name;
923
946
  const wValue = getTrimmingSpace(part.value);
924
- value = prefix.concat(insertTrimmingSpace(value, ""));
947
+ [value, suppressPrefix] = handleThisPrivateShorthands(value);
948
+ if (!suppressPrefix) {
949
+ value = prefix.concat(insertTrimmingSpace(value, ""));
950
+ }
925
951
  if (wValue)
926
952
  value.unshift(wValue);
927
953
  if (part.type === "SpreadProperty") {
@@ -1135,14 +1161,14 @@ var require_lib = __commonJS({
1135
1161
  chains.push(i);
1136
1162
  } else if (lowerPrecedenceOps.includes(op.token)) {
1137
1163
  processChains(op);
1138
- first = [];
1164
+ first = void 0;
1139
1165
  }
1140
1166
  i++;
1141
1167
  }
1142
1168
  processChains(op);
1143
1169
  return results;
1144
1170
  function processChains(op2) {
1145
- if (isRelationalOp(op2)) {
1171
+ if (first && isRelationalOp(op2)) {
1146
1172
  first = expandExistence(first);
1147
1173
  }
1148
1174
  if (chains.length > 1) {
@@ -1151,7 +1177,7 @@ var require_lib = __commonJS({
1151
1177
  results.push(" ", "&&", " ");
1152
1178
  }
1153
1179
  const binop = binops[index];
1154
- let [pre, op3, post, exp] = binop;
1180
+ let [, , , exp] = binop;
1155
1181
  exp = binop[3] = expandExistence(exp);
1156
1182
  let endIndex;
1157
1183
  if (k < chains.length - 1) {
@@ -1164,10 +1190,13 @@ var require_lib = __commonJS({
1164
1190
  return start = endIndex;
1165
1191
  });
1166
1192
  } else {
1167
- results.push(first, ...binops.slice(start, i + 1).flat());
1193
+ if (first) {
1194
+ results.push(first);
1195
+ }
1196
+ results.push(...binops.slice(start, i + 1).flat());
1168
1197
  start = i + 1;
1169
1198
  }
1170
- return chains.length = 0;
1199
+ chains.length = 0;
1171
1200
  }
1172
1201
  function expandExistence(exp) {
1173
1202
  const existence = isExistence(exp);
@@ -1249,6 +1278,23 @@ var require_lib = __commonJS({
1249
1278
  }
1250
1279
  }
1251
1280
  }
1281
+ function replaceBlockExpression(node, child, replacement) {
1282
+ let found = false;
1283
+ const { expressions } = node;
1284
+ for (let i = 0, l = expressions.length; i < l; i++) {
1285
+ const statement = expressions[i];
1286
+ const [, s] = statement;
1287
+ if (s === child) {
1288
+ statement[1] = replacement;
1289
+ replacement.parent = node;
1290
+ found = true;
1291
+ break;
1292
+ }
1293
+ }
1294
+ if (!found) {
1295
+ throw new Error("Could not find child to replace");
1296
+ }
1297
+ }
1252
1298
  function findChildIndex(parent, child) {
1253
1299
  const children = Array.isArray(parent) ? parent : parent.children;
1254
1300
  const len = children.length;
@@ -2135,12 +2181,12 @@ var require_lib = __commonJS({
2135
2181
  }
2136
2182
  function processDeclarationConditions(node) {
2137
2183
  gatherRecursiveAll(node, (n) => {
2138
- return n.type === "IfStatement" || n.type === "IterationStatement";
2184
+ return n.type === "IfStatement" || n.type === "IterationStatement" || n.type === "SwitchStatement";
2139
2185
  }).forEach(processDeclarationConditionStatement);
2140
2186
  }
2141
2187
  function processDeclarationConditionStatement(s) {
2142
2188
  const { condition } = s;
2143
- if (!condition) {
2189
+ if (!condition?.expression) {
2144
2190
  return;
2145
2191
  }
2146
2192
  processDeclarationCondition(condition.expression);
@@ -2181,6 +2227,27 @@ var require_lib = __commonJS({
2181
2227
  updateParentPointers(newBlock, s);
2182
2228
  break;
2183
2229
  }
2230
+ case "SwitchStatement": {
2231
+ const { blockPrefix, ref: ref2 } = condition.expression;
2232
+ if (!blockPrefix) {
2233
+ return;
2234
+ }
2235
+ s.condition = {
2236
+ type: "ParenthesizedExpression",
2237
+ children: ["(", ref2, ")"],
2238
+ expression: ref2,
2239
+ parent: s
2240
+ };
2241
+ s.children[1] = s.condition;
2242
+ const block = blockWithPrefix([["", [{
2243
+ type: "Declaration",
2244
+ children: ["let ", ...condition.expression.children]
2245
+ }], ";"], ...blockPrefix], makeEmptyBlock());
2246
+ replaceBlockExpression(s.parent, s, block);
2247
+ block.expressions.push(["", s]);
2248
+ s.parent = block;
2249
+ break;
2250
+ }
2184
2251
  }
2185
2252
  }
2186
2253
  function implicitFunctionBlock(f) {
@@ -2629,12 +2696,12 @@ var require_lib = __commonJS({
2629
2696
  }
2630
2697
  if (errors || !isPattern)
2631
2698
  return;
2632
- let { expression } = s;
2633
- if (expression.type === "ParenthesizedExpression") {
2634
- expression = expression.expression;
2699
+ let { condition } = s;
2700
+ if (condition.type === "ParenthesizedExpression") {
2701
+ condition = condition.expression;
2635
2702
  }
2636
- let hoistDec, refAssignment = [], ref = maybeRef(expression, "m");
2637
- if (ref !== expression) {
2703
+ let hoistDec, refAssignment = [], ref = maybeRef(condition, "m");
2704
+ if (ref !== condition) {
2638
2705
  hoistDec = {
2639
2706
  type: "Declaration",
2640
2707
  children: ["let ", ref],
@@ -2642,7 +2709,7 @@ var require_lib = __commonJS({
2642
2709
  };
2643
2710
  refAssignment = [{
2644
2711
  type: "AssignmentExpression",
2645
- children: [ref, " = ", expression]
2712
+ children: [ref, " = ", condition]
2646
2713
  }, ","];
2647
2714
  }
2648
2715
  let prev = [], root = prev;
@@ -2670,7 +2737,7 @@ var require_lib = __commonJS({
2670
2737
  return conditionArray;
2671
2738
  return [" || ", ...conditionArray];
2672
2739
  });
2673
- const condition = {
2740
+ const condition2 = {
2674
2741
  type: "ParenthesizedExpression",
2675
2742
  children: ["(", ...refAssignment, conditionExpression, ")"],
2676
2743
  expression: conditionExpression
@@ -2705,7 +2772,7 @@ var require_lib = __commonJS({
2705
2772
  next.push("\n", "else ");
2706
2773
  prev.push(["", {
2707
2774
  type: "IfStatement",
2708
- children: ["if", condition, block, next],
2775
+ children: ["if", condition2, block, next],
2709
2776
  then: block,
2710
2777
  else: next,
2711
2778
  hoistDec
@@ -3959,6 +4026,7 @@ var require_parser = __commonJS({
3959
4026
  Typeof,
3960
4027
  Unless,
3961
4028
  Until,
4029
+ Using,
3962
4030
  Var,
3963
4031
  Void,
3964
4032
  When,
@@ -4009,6 +4077,9 @@ var require_parser = __commonJS({
4009
4077
  JSXChildExpression,
4010
4078
  IndentedJSXChildExpression,
4011
4079
  NestedJSXChildExpression,
4080
+ UsingDeclaration,
4081
+ UsingBinding,
4082
+ UsingJSModeError,
4012
4083
  TypeDeclaration,
4013
4084
  TypeDeclarationRest,
4014
4085
  OptionalEquals,
@@ -4326,29 +4397,30 @@ var require_parser = __commonJS({
4326
4397
  var $L184 = $L("typeof");
4327
4398
  var $L185 = $L("unless");
4328
4399
  var $L186 = $L("until");
4329
- var $L187 = $L("var");
4330
- var $L188 = $L("void");
4331
- var $L189 = $L("when");
4332
- var $L190 = $L("while");
4333
- var $L191 = $L("yield");
4334
- var $L192 = $L("/>");
4335
- var $L193 = $L("</");
4336
- var $L194 = $L("<>");
4337
- var $L195 = $L("</>");
4338
- var $L196 = $L("<!--");
4339
- var $L197 = $L("-->");
4340
- var $L198 = $L("type");
4341
- var $L199 = $L("enum");
4342
- var $L200 = $L("interface");
4343
- var $L201 = $L("global");
4344
- var $L202 = $L("module");
4345
- var $L203 = $L("namespace");
4346
- var $L204 = $L("asserts");
4347
- var $L205 = $L("keyof");
4348
- var $L206 = $L("infer");
4349
- var $L207 = $L("???");
4350
- var $L208 = $L("[]");
4351
- var $L209 = $L("civet");
4400
+ var $L187 = $L("using");
4401
+ var $L188 = $L("var");
4402
+ var $L189 = $L("void");
4403
+ var $L190 = $L("when");
4404
+ var $L191 = $L("while");
4405
+ var $L192 = $L("yield");
4406
+ var $L193 = $L("/>");
4407
+ var $L194 = $L("</");
4408
+ var $L195 = $L("<>");
4409
+ var $L196 = $L("</>");
4410
+ var $L197 = $L("<!--");
4411
+ var $L198 = $L("-->");
4412
+ var $L199 = $L("type");
4413
+ var $L200 = $L("enum");
4414
+ var $L201 = $L("interface");
4415
+ var $L202 = $L("global");
4416
+ var $L203 = $L("module");
4417
+ var $L204 = $L("namespace");
4418
+ var $L205 = $L("asserts");
4419
+ var $L206 = $L("keyof");
4420
+ var $L207 = $L("infer");
4421
+ var $L208 = $L("???");
4422
+ var $L209 = $L("[]");
4423
+ var $L210 = $L("civet");
4352
4424
  var $R0 = $R(new RegExp("(as|of|satisfies|then|when|implements|xor|xnor)(?!\\p{ID_Continue}|[\\u200C\\u200D$])", "suy"));
4353
4425
  var $R1 = $R(new RegExp("[0-9]", "suy"));
4354
4426
  var $R2 = $R(new RegExp("[)}]", "suy"));
@@ -5353,7 +5425,8 @@ var require_parser = __commonJS({
5353
5425
  type: "PropertyAccess",
5354
5426
  name: id,
5355
5427
  children: [".", id]
5356
- }]
5428
+ }],
5429
+ thisShorthand: true
5357
5430
  };
5358
5431
  });
5359
5432
  var ThisLiteral$2 = AtThis;
@@ -5374,7 +5447,8 @@ var require_parser = __commonJS({
5374
5447
  type: "PropertyAccess",
5375
5448
  name: id.name,
5376
5449
  children: [".", id]
5377
- }]
5450
+ }],
5451
+ privateShorthand: true
5378
5452
  };
5379
5453
  });
5380
5454
  var PrivateThis$$ = [PrivateThis$0, PrivateThis$1];
@@ -7226,20 +7300,7 @@ var require_parser = __commonJS({
7226
7300
  function ObjectPropertyDelimiter(ctx, state) {
7227
7301
  return $EVENT_C(ctx, state, "ObjectPropertyDelimiter", ObjectPropertyDelimiter$$);
7228
7302
  }
7229
- var PropertyDefinition$0 = $TS($S($E(_), AtThis, IdentifierReference), function($skip, $loc, $0, $1, $2, $3) {
7230
- var ws = $1;
7231
- var at = $2;
7232
- var id = $3;
7233
- const value = [at, ".", id];
7234
- return {
7235
- type: "Property",
7236
- children: [ws, id, ": ", ...value],
7237
- name: id,
7238
- names: id.names,
7239
- value
7240
- };
7241
- });
7242
- var PropertyDefinition$1 = $TS($S($E(_), NamedProperty), function($skip, $loc, $0, $1, $2) {
7303
+ var PropertyDefinition$0 = $TS($S($E(_), NamedProperty), function($skip, $loc, $0, $1, $2) {
7243
7304
  var ws = $1;
7244
7305
  var prop = $2;
7245
7306
  return {
@@ -7247,7 +7308,7 @@ var require_parser = __commonJS({
7247
7308
  children: [ws, ...prop.children]
7248
7309
  };
7249
7310
  });
7250
- var PropertyDefinition$2 = $TS($S($E(_), $TEXT($EXPECT($R6, "PropertyDefinition /[!+-]/")), PropertyName), function($skip, $loc, $0, $1, $2, $3) {
7311
+ var PropertyDefinition$1 = $TS($S($E(_), $TEXT($EXPECT($R6, "PropertyDefinition /[!+-]/")), PropertyName), function($skip, $loc, $0, $1, $2, $3) {
7251
7312
  var ws = $1;
7252
7313
  var toggle = $2;
7253
7314
  var id = $3;
@@ -7260,7 +7321,7 @@ var require_parser = __commonJS({
7260
7321
  value
7261
7322
  };
7262
7323
  });
7263
- var PropertyDefinition$3 = $TS($S($E(_), MethodDefinition), function($skip, $loc, $0, $1, $2) {
7324
+ var PropertyDefinition$2 = $TS($S($E(_), MethodDefinition), function($skip, $loc, $0, $1, $2) {
7264
7325
  var ws = $1;
7265
7326
  var def = $2;
7266
7327
  if (!def.block || def.block.empty)
@@ -7270,7 +7331,7 @@ var require_parser = __commonJS({
7270
7331
  children: [ws, ...def.children]
7271
7332
  };
7272
7333
  });
7273
- var PropertyDefinition$4 = $TS($S($E(_), DotDotDot, ExtendedExpression), function($skip, $loc, $0, $1, $2, $3) {
7334
+ var PropertyDefinition$3 = $TS($S($E(_), DotDotDot, ExtendedExpression), function($skip, $loc, $0, $1, $2, $3) {
7274
7335
  var ws = $1;
7275
7336
  var dots = $2;
7276
7337
  var exp = $3;
@@ -7282,7 +7343,7 @@ var require_parser = __commonJS({
7282
7343
  value: exp
7283
7344
  };
7284
7345
  });
7285
- var PropertyDefinition$5 = $TS($S($E(_), $N(EOS), CallExpression), function($skip, $loc, $0, $1, $2, $3) {
7346
+ var PropertyDefinition$4 = $TS($S($E(_), $N(EOS), CallExpression), function($skip, $loc, $0, $1, $2, $3) {
7286
7347
  var ws = $1;
7287
7348
  var value = $3;
7288
7349
  switch (value.type) {
@@ -7341,16 +7402,18 @@ var require_parser = __commonJS({
7341
7402
  if (!name)
7342
7403
  return $skip;
7343
7404
  }
7405
+ if (name[0] === "#")
7406
+ name = name.slice(1);
7344
7407
  return {
7345
7408
  type: "Property",
7346
7409
  children: [ws, name, ": ", value],
7347
7410
  name,
7348
- value,
7349
7411
  names: [],
7412
+ value,
7350
7413
  hoistDec
7351
7414
  };
7352
7415
  });
7353
- var PropertyDefinition$$ = [PropertyDefinition$0, PropertyDefinition$1, PropertyDefinition$2, PropertyDefinition$3, PropertyDefinition$4, PropertyDefinition$5];
7416
+ var PropertyDefinition$$ = [PropertyDefinition$0, PropertyDefinition$1, PropertyDefinition$2, PropertyDefinition$3, PropertyDefinition$4];
7354
7417
  function PropertyDefinition(ctx, state) {
7355
7418
  return $EVENT_C(ctx, state, "PropertyDefinition", PropertyDefinition$$);
7356
7419
  }
@@ -8714,7 +8777,7 @@ var require_parser = __commonJS({
8714
8777
  return {
8715
8778
  type: "SwitchStatement",
8716
8779
  children: $0,
8717
- expression: condition,
8780
+ condition,
8718
8781
  caseBlock
8719
8782
  };
8720
8783
  });
@@ -9538,7 +9601,8 @@ var require_parser = __commonJS({
9538
9601
  var Declaration$3 = TypeDeclaration;
9539
9602
  var Declaration$4 = EnumDeclaration;
9540
9603
  var Declaration$5 = OperatorDeclaration;
9541
- var Declaration$$ = [Declaration$0, Declaration$1, Declaration$2, Declaration$3, Declaration$4, Declaration$5];
9604
+ var Declaration$6 = UsingDeclaration;
9605
+ var Declaration$$ = [Declaration$0, Declaration$1, Declaration$2, Declaration$3, Declaration$4, Declaration$5, Declaration$6];
9542
9606
  function Declaration(ctx, state) {
9543
9607
  return $EVENT_C(ctx, state, "Declaration", Declaration$$);
9544
9608
  }
@@ -10611,31 +10675,37 @@ var require_parser = __commonJS({
10611
10675
  function Until(ctx, state) {
10612
10676
  return $EVENT(ctx, state, "Until", Until$0);
10613
10677
  }
10614
- var Var$0 = $TS($S($EXPECT($L187, 'Var "var"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
10678
+ var Using$0 = $TS($S($EXPECT($L187, 'Using "using"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
10679
+ return { $loc, token: $1 };
10680
+ });
10681
+ function Using(ctx, state) {
10682
+ return $EVENT(ctx, state, "Using", Using$0);
10683
+ }
10684
+ var Var$0 = $TS($S($EXPECT($L188, 'Var "var"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
10615
10685
  return { $loc, token: $1 };
10616
10686
  });
10617
10687
  function Var(ctx, state) {
10618
10688
  return $EVENT(ctx, state, "Var", Var$0);
10619
10689
  }
10620
- var Void$0 = $TS($S($EXPECT($L188, 'Void "void"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
10690
+ var Void$0 = $TS($S($EXPECT($L189, 'Void "void"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
10621
10691
  return { $loc, token: $1 };
10622
10692
  });
10623
10693
  function Void(ctx, state) {
10624
10694
  return $EVENT(ctx, state, "Void", Void$0);
10625
10695
  }
10626
- var When$0 = $TS($S($EXPECT($L189, 'When "when"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
10696
+ var When$0 = $TS($S($EXPECT($L190, 'When "when"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
10627
10697
  return { $loc, token: "case" };
10628
10698
  });
10629
10699
  function When(ctx, state) {
10630
10700
  return $EVENT(ctx, state, "When", When$0);
10631
10701
  }
10632
- var While$0 = $TS($S($EXPECT($L190, 'While "while"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
10702
+ var While$0 = $TS($S($EXPECT($L191, 'While "while"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
10633
10703
  return { $loc, token: $1 };
10634
10704
  });
10635
10705
  function While(ctx, state) {
10636
10706
  return $EVENT(ctx, state, "While", While$0);
10637
10707
  }
10638
- var Yield$0 = $TS($S($EXPECT($L191, 'Yield "yield"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
10708
+ var Yield$0 = $TS($S($EXPECT($L192, 'Yield "yield"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
10639
10709
  return { $loc, token: $1, type: "Yield" };
10640
10710
  });
10641
10711
  function Yield(ctx, state) {
@@ -10708,7 +10778,7 @@ var require_parser = __commonJS({
10708
10778
  function JSXElement(ctx, state) {
10709
10779
  return $EVENT_C(ctx, state, "JSXElement", JSXElement$$);
10710
10780
  }
10711
- var JSXSelfClosingElement$0 = $TS($S($EXPECT($L155, 'JSXSelfClosingElement "<"'), JSXElementName, $E(TypeArguments), $E(JSXAttributes), $E(Whitespace), $EXPECT($L192, 'JSXSelfClosingElement "/>"')), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
10781
+ var JSXSelfClosingElement$0 = $TS($S($EXPECT($L155, 'JSXSelfClosingElement "<"'), JSXElementName, $E(TypeArguments), $E(JSXAttributes), $E(Whitespace), $EXPECT($L193, 'JSXSelfClosingElement "/>"')), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
10712
10782
  return { type: "JSXElement", children: $0, tag: $2 };
10713
10783
  });
10714
10784
  function JSXSelfClosingElement(ctx, state) {
@@ -10742,7 +10812,7 @@ var require_parser = __commonJS({
10742
10812
  function JSXOptionalClosingElement(ctx, state) {
10743
10813
  return $EVENT_C(ctx, state, "JSXOptionalClosingElement", JSXOptionalClosingElement$$);
10744
10814
  }
10745
- var JSXClosingElement$0 = $S($EXPECT($L193, 'JSXClosingElement "</"'), $E(Whitespace), JSXElementName, $E(Whitespace), $EXPECT($L33, 'JSXClosingElement ">"'));
10815
+ var JSXClosingElement$0 = $S($EXPECT($L194, 'JSXClosingElement "</"'), $E(Whitespace), JSXElementName, $E(Whitespace), $EXPECT($L33, 'JSXClosingElement ">"'));
10746
10816
  function JSXClosingElement(ctx, state) {
10747
10817
  return $EVENT(ctx, state, "JSXClosingElement", JSXClosingElement$0);
10748
10818
  }
@@ -10763,7 +10833,7 @@ var require_parser = __commonJS({
10763
10833
  ];
10764
10834
  return { type: "JSXFragment", children: parts, jsxChildren: children.jsxChildren };
10765
10835
  });
10766
- var JSXFragment$1 = $TS($S(CoffeeJSXEnabled, $EXPECT($L194, 'JSXFragment "<>"'), $E(JSXChildren), $E(Whitespace), JSXClosingFragment), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
10836
+ var JSXFragment$1 = $TS($S(CoffeeJSXEnabled, $EXPECT($L195, 'JSXFragment "<>"'), $E(JSXChildren), $E(Whitespace), JSXClosingFragment), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
10767
10837
  var children = $3;
10768
10838
  $0 = $0.slice(1);
10769
10839
  return {
@@ -10776,7 +10846,7 @@ var require_parser = __commonJS({
10776
10846
  function JSXFragment(ctx, state) {
10777
10847
  return $EVENT_C(ctx, state, "JSXFragment", JSXFragment$$);
10778
10848
  }
10779
- var PushJSXOpeningFragment$0 = $TV($EXPECT($L194, 'PushJSXOpeningFragment "<>"'), function($skip, $loc, $0, $1) {
10849
+ var PushJSXOpeningFragment$0 = $TV($EXPECT($L195, 'PushJSXOpeningFragment "<>"'), function($skip, $loc, $0, $1) {
10780
10850
  module.JSXTagStack.push("");
10781
10851
  return $1;
10782
10852
  });
@@ -10793,7 +10863,7 @@ var require_parser = __commonJS({
10793
10863
  function JSXOptionalClosingFragment(ctx, state) {
10794
10864
  return $EVENT_C(ctx, state, "JSXOptionalClosingFragment", JSXOptionalClosingFragment$$);
10795
10865
  }
10796
- var JSXClosingFragment$0 = $EXPECT($L195, 'JSXClosingFragment "</>"');
10866
+ var JSXClosingFragment$0 = $EXPECT($L196, 'JSXClosingFragment "</>"');
10797
10867
  function JSXClosingFragment(ctx, state) {
10798
10868
  return $EVENT(ctx, state, "JSXClosingFragment", JSXClosingFragment$0);
10799
10869
  }
@@ -11262,7 +11332,7 @@ var require_parser = __commonJS({
11262
11332
  function JSXChild(ctx, state) {
11263
11333
  return $EVENT_C(ctx, state, "JSXChild", JSXChild$$);
11264
11334
  }
11265
- var JSXComment$0 = $TS($S($EXPECT($L196, 'JSXComment "<!--"'), JSXCommentContent, $EXPECT($L197, 'JSXComment "-->"')), function($skip, $loc, $0, $1, $2, $3) {
11335
+ var JSXComment$0 = $TS($S($EXPECT($L197, 'JSXComment "<!--"'), JSXCommentContent, $EXPECT($L198, 'JSXComment "-->"')), function($skip, $loc, $0, $1, $2, $3) {
11266
11336
  return ["{/*", $2, "*/}"];
11267
11337
  });
11268
11338
  function JSXComment(ctx, state) {
@@ -11300,6 +11370,52 @@ var require_parser = __commonJS({
11300
11370
  function NestedJSXChildExpression(ctx, state) {
11301
11371
  return $EVENT(ctx, state, "NestedJSXChildExpression", NestedJSXChildExpression$0);
11302
11372
  }
11373
+ var UsingDeclaration$0 = $TS($S(Using, $E(_), UsingBinding, $Q($S(__, Comma, __, UsingBinding)), UsingJSModeError), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
11374
+ var decl = $1;
11375
+ var binding = $3;
11376
+ var tail = $4;
11377
+ const bindings = [binding].concat(tail.map(([, , , b]) => b));
11378
+ return {
11379
+ type: "Declaration",
11380
+ children: $0,
11381
+ names: bindings.flatMap((b) => b.names),
11382
+ bindings,
11383
+ decl,
11384
+ splices: bindings.flatMap((b) => b.splices),
11385
+ thisAssignments: bindings.flatMap((b) => b.thisAssignments)
11386
+ };
11387
+ });
11388
+ function UsingDeclaration(ctx, state) {
11389
+ return $EVENT(ctx, state, "UsingDeclaration", UsingDeclaration$0);
11390
+ }
11391
+ var UsingBinding$0 = $TS($S(BindingIdentifier, $E(TypeSuffix), Initializer), function($skip, $loc, $0, $1, $2, $3) {
11392
+ var pattern = $1;
11393
+ var suffix = $2;
11394
+ var initializer = $3;
11395
+ return {
11396
+ type: "Binding",
11397
+ children: $0,
11398
+ names: pattern.names,
11399
+ pattern,
11400
+ suffix,
11401
+ initializer,
11402
+ splices: [],
11403
+ thisAssignments: []
11404
+ };
11405
+ });
11406
+ function UsingBinding(ctx, state) {
11407
+ return $EVENT(ctx, state, "UsingBinding", UsingBinding$0);
11408
+ }
11409
+ var UsingJSModeError$0 = $TV($EXPECT($L0, 'UsingJSModeError ""'), function($skip, $loc, $0, $1) {
11410
+ return {
11411
+ type: "Error",
11412
+ js: true,
11413
+ message: "`using` is not currently transpiled in JS mode."
11414
+ };
11415
+ });
11416
+ function UsingJSModeError(ctx, state) {
11417
+ return $EVENT(ctx, state, "UsingJSModeError", UsingJSModeError$0);
11418
+ }
11303
11419
  var TypeDeclaration$0 = $T($S($E($S(Export, $E(_))), $S(Declare, $E(_)), TypeLexicalDeclaration), function(value) {
11304
11420
  return { "ts": true, "children": value };
11305
11421
  });
@@ -11348,37 +11464,37 @@ var require_parser = __commonJS({
11348
11464
  function InterfaceExtendsTarget(ctx, state) {
11349
11465
  return $EVENT(ctx, state, "InterfaceExtendsTarget", InterfaceExtendsTarget$0);
11350
11466
  }
11351
- var TypeKeyword$0 = $TS($S($EXPECT($L198, 'TypeKeyword "type"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
11467
+ var TypeKeyword$0 = $TS($S($EXPECT($L199, 'TypeKeyword "type"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
11352
11468
  return { $loc, token: $1 };
11353
11469
  });
11354
11470
  function TypeKeyword(ctx, state) {
11355
11471
  return $EVENT(ctx, state, "TypeKeyword", TypeKeyword$0);
11356
11472
  }
11357
- var Enum$0 = $TS($S($EXPECT($L199, 'Enum "enum"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
11473
+ var Enum$0 = $TS($S($EXPECT($L200, 'Enum "enum"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
11358
11474
  return { $loc, token: $1 };
11359
11475
  });
11360
11476
  function Enum(ctx, state) {
11361
11477
  return $EVENT(ctx, state, "Enum", Enum$0);
11362
11478
  }
11363
- var Interface$0 = $TS($S($EXPECT($L200, 'Interface "interface"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
11479
+ var Interface$0 = $TS($S($EXPECT($L201, 'Interface "interface"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
11364
11480
  return { $loc, token: $1 };
11365
11481
  });
11366
11482
  function Interface(ctx, state) {
11367
11483
  return $EVENT(ctx, state, "Interface", Interface$0);
11368
11484
  }
11369
- var Global$0 = $TS($S($EXPECT($L201, 'Global "global"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
11485
+ var Global$0 = $TS($S($EXPECT($L202, 'Global "global"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
11370
11486
  return { $loc, token: $1 };
11371
11487
  });
11372
11488
  function Global(ctx, state) {
11373
11489
  return $EVENT(ctx, state, "Global", Global$0);
11374
11490
  }
11375
- var Module$0 = $TS($S($EXPECT($L202, 'Module "module"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
11491
+ var Module$0 = $TS($S($EXPECT($L203, 'Module "module"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
11376
11492
  return { $loc, token: $1 };
11377
11493
  });
11378
11494
  function Module(ctx, state) {
11379
11495
  return $EVENT(ctx, state, "Module", Module$0);
11380
11496
  }
11381
- var Namespace$0 = $TS($S($EXPECT($L203, 'Namespace "namespace"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
11497
+ var Namespace$0 = $TS($S($EXPECT($L204, 'Namespace "namespace"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
11382
11498
  return { $loc, token: $1 };
11383
11499
  });
11384
11500
  function Namespace(ctx, state) {
@@ -11623,7 +11739,7 @@ var require_parser = __commonJS({
11623
11739
  function ReturnTypeSuffix(ctx, state) {
11624
11740
  return $EVENT(ctx, state, "ReturnTypeSuffix", ReturnTypeSuffix$0);
11625
11741
  }
11626
- var ReturnType$0 = $TS($S($E($S(__, $EXPECT($L204, 'ReturnType "asserts"'), NonIdContinue)), TypePredicate), function($skip, $loc, $0, $1, $2) {
11742
+ var ReturnType$0 = $TS($S($E($S(__, $EXPECT($L205, 'ReturnType "asserts"'), NonIdContinue)), TypePredicate), function($skip, $loc, $0, $1, $2) {
11627
11743
  var asserts = $1;
11628
11744
  var t = $2;
11629
11745
  if (asserts) {
@@ -11692,9 +11808,9 @@ var require_parser = __commonJS({
11692
11808
  function TypeUnarySuffix(ctx, state) {
11693
11809
  return $EVENT_C(ctx, state, "TypeUnarySuffix", TypeUnarySuffix$$);
11694
11810
  }
11695
- var TypeUnaryOp$0 = $S($EXPECT($L205, 'TypeUnaryOp "keyof"'), NonIdContinue);
11811
+ var TypeUnaryOp$0 = $S($EXPECT($L206, 'TypeUnaryOp "keyof"'), NonIdContinue);
11696
11812
  var TypeUnaryOp$1 = $S($EXPECT($L184, 'TypeUnaryOp "typeof"'), NonIdContinue);
11697
- var TypeUnaryOp$2 = $S($EXPECT($L206, 'TypeUnaryOp "infer"'), NonIdContinue);
11813
+ var TypeUnaryOp$2 = $S($EXPECT($L207, 'TypeUnaryOp "infer"'), NonIdContinue);
11698
11814
  var TypeUnaryOp$3 = $S($EXPECT($L167, 'TypeUnaryOp "readonly"'), NonIdContinue);
11699
11815
  var TypeUnaryOp$$ = [TypeUnaryOp$0, TypeUnaryOp$1, TypeUnaryOp$2, TypeUnaryOp$3];
11700
11816
  function TypeUnaryOp(ctx, state) {
@@ -11704,7 +11820,7 @@ var require_parser = __commonJS({
11704
11820
  function TypeIndexedAccess(ctx, state) {
11705
11821
  return $EVENT(ctx, state, "TypeIndexedAccess", TypeIndexedAccess$0);
11706
11822
  }
11707
- var UnknownAlias$0 = $TV($EXPECT($L207, 'UnknownAlias "???"'), function($skip, $loc, $0, $1) {
11823
+ var UnknownAlias$0 = $TV($EXPECT($L208, 'UnknownAlias "???"'), function($skip, $loc, $0, $1) {
11708
11824
  return { $loc, token: "unknown" };
11709
11825
  });
11710
11826
  function UnknownAlias(ctx, state) {
@@ -11844,10 +11960,10 @@ var require_parser = __commonJS({
11844
11960
  }
11845
11961
  var TypeLiteral$0 = TypeTemplateLiteral;
11846
11962
  var TypeLiteral$1 = Literal;
11847
- var TypeLiteral$2 = $TS($S($EXPECT($L188, 'TypeLiteral "void"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
11963
+ var TypeLiteral$2 = $TS($S($EXPECT($L189, 'TypeLiteral "void"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
11848
11964
  return { type: "VoidType", $loc, token: $1 };
11849
11965
  });
11850
- var TypeLiteral$3 = $TV($EXPECT($L208, 'TypeLiteral "[]"'), function($skip, $loc, $0, $1) {
11966
+ var TypeLiteral$3 = $TV($EXPECT($L209, 'TypeLiteral "[]"'), function($skip, $loc, $0, $1) {
11851
11967
  return { $loc, token: "[]" };
11852
11968
  });
11853
11969
  var TypeLiteral$$ = [TypeLiteral$0, TypeLiteral$1, TypeLiteral$2, TypeLiteral$3];
@@ -11968,7 +12084,7 @@ var require_parser = __commonJS({
11968
12084
  function CivetPrologue(ctx, state) {
11969
12085
  return $EVENT_C(ctx, state, "CivetPrologue", CivetPrologue$$);
11970
12086
  }
11971
- var CivetPrologueContent$0 = $TS($S($EXPECT($L209, 'CivetPrologueContent "civet"'), NonIdContinue, $Q(CivetOption), $EXPECT($R63, "CivetPrologueContent /[\\s]*/")), function($skip, $loc, $0, $1, $2, $3, $4) {
12087
+ var CivetPrologueContent$0 = $TS($S($EXPECT($L210, 'CivetPrologueContent "civet"'), NonIdContinue, $Q(CivetOption), $EXPECT($R63, "CivetPrologueContent /[\\s]*/")), function($skip, $loc, $0, $1, $2, $3, $4) {
11972
12088
  var options = $3;
11973
12089
  return {
11974
12090
  type: "CivetPrologue",
@@ -13124,6 +13240,7 @@ var require_parser = __commonJS({
13124
13240
  exports.Typeof = Typeof;
13125
13241
  exports.Unless = Unless;
13126
13242
  exports.Until = Until;
13243
+ exports.Using = Using;
13127
13244
  exports.Var = Var;
13128
13245
  exports.Void = Void;
13129
13246
  exports.When = When;
@@ -13174,6 +13291,9 @@ var require_parser = __commonJS({
13174
13291
  exports.JSXChildExpression = JSXChildExpression;
13175
13292
  exports.IndentedJSXChildExpression = IndentedJSXChildExpression;
13176
13293
  exports.NestedJSXChildExpression = NestedJSXChildExpression;
13294
+ exports.UsingDeclaration = UsingDeclaration;
13295
+ exports.UsingBinding = UsingBinding;
13296
+ exports.UsingJSModeError = UsingJSModeError;
13177
13297
  exports.TypeDeclaration = TypeDeclaration;
13178
13298
  exports.TypeDeclarationRest = TypeDeclarationRest;
13179
13299
  exports.OptionalEquals = OptionalEquals;
@@ -13363,17 +13483,17 @@ function gen(node, options) {
13363
13483
  }).join("");
13364
13484
  }
13365
13485
  if (typeof node === "object") {
13366
- if (node.type === "Error") {
13367
- options.errors ?? (options.errors = []);
13368
- options.errors.push(node);
13369
- return "";
13370
- }
13371
13486
  if (options.js && node.ts) {
13372
13487
  return "";
13373
13488
  }
13374
13489
  if (!options.js && node.js) {
13375
13490
  return "";
13376
13491
  }
13492
+ if (node.type === "Error") {
13493
+ options.errors ?? (options.errors = []);
13494
+ options.errors.push(node);
13495
+ return "";
13496
+ }
13377
13497
  if (node.$loc != null) {
13378
13498
  const { token, $loc } = node;
13379
13499
  options?.updateSourceMap?.(token, $loc.pos);
@@ -13511,7 +13631,10 @@ var SourceMap = function(sourceString) {
13511
13631
  sources: [srcFileName],
13512
13632
  mappings: this.renderMappings(),
13513
13633
  names: [],
13514
- sourcesContent: [sourceString]
13634
+ sourcesContent: [sourceString],
13635
+ toString: function() {
13636
+ return JSON.stringify(this);
13637
+ }
13515
13638
  };
13516
13639
  },
13517
13640
  updateSourceMap: function(outputStr, inputPos) {
@@ -13935,5 +14058,6 @@ export {
13935
14058
  generate_default as generate,
13936
14059
  isCompileError,
13937
14060
  parse,
14061
+ prune,
13938
14062
  util_exports as util
13939
14063
  };