@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.js CHANGED
@@ -892,6 +892,28 @@ var require_lib = __commonJS({
892
892
  }
893
893
  return expandedOps;
894
894
  }
895
+ function handleThisPrivateShorthands(value) {
896
+ if (value.privateShorthand) {
897
+ value = value.children[1].children[1];
898
+ return [value, false];
899
+ }
900
+ if (value.type === "MemberExpression" || value.type === "CallExpression") {
901
+ let suppressPrefix = value.thisShorthand;
902
+ value = {
903
+ ...value,
904
+ children: value.children.map((c, i) => {
905
+ if (i === 0) {
906
+ let s;
907
+ [c, s] = handleThisPrivateShorthands(c);
908
+ suppressPrefix || (suppressPrefix = s);
909
+ }
910
+ return c;
911
+ })
912
+ };
913
+ return [value, suppressPrefix];
914
+ }
915
+ return [value, value.thisShorthand];
916
+ }
895
917
  function processCallMemberExpression(node) {
896
918
  const { children } = node;
897
919
  for (let i = 0; i < children.length; i++) {
@@ -919,11 +941,15 @@ var require_lib = __commonJS({
919
941
  throw new Error("Glob pattern cannot have method definition");
920
942
  }
921
943
  if (part.value && !["CallExpression", "MemberExpression", "Identifier"].includes(part.value.type)) {
922
- throw new Error("Glob pattern must have call or member expression value");
944
+ throw new Error(`Glob pattern must have call or member expression value, found ${JSON.stringify(part.value)}`);
923
945
  }
946
+ let suppressPrefix = false;
924
947
  let value = part.value ?? part.name;
925
948
  const wValue = getTrimmingSpace(part.value);
926
- value = prefix.concat(insertTrimmingSpace(value, ""));
949
+ [value, suppressPrefix] = handleThisPrivateShorthands(value);
950
+ if (!suppressPrefix) {
951
+ value = prefix.concat(insertTrimmingSpace(value, ""));
952
+ }
927
953
  if (wValue)
928
954
  value.unshift(wValue);
929
955
  if (part.type === "SpreadProperty") {
@@ -1137,14 +1163,14 @@ var require_lib = __commonJS({
1137
1163
  chains.push(i);
1138
1164
  } else if (lowerPrecedenceOps.includes(op.token)) {
1139
1165
  processChains(op);
1140
- first = [];
1166
+ first = void 0;
1141
1167
  }
1142
1168
  i++;
1143
1169
  }
1144
1170
  processChains(op);
1145
1171
  return results;
1146
1172
  function processChains(op2) {
1147
- if (isRelationalOp(op2)) {
1173
+ if (first && isRelationalOp(op2)) {
1148
1174
  first = expandExistence(first);
1149
1175
  }
1150
1176
  if (chains.length > 1) {
@@ -1153,7 +1179,7 @@ var require_lib = __commonJS({
1153
1179
  results.push(" ", "&&", " ");
1154
1180
  }
1155
1181
  const binop = binops[index];
1156
- let [pre, op3, post, exp] = binop;
1182
+ let [, , , exp] = binop;
1157
1183
  exp = binop[3] = expandExistence(exp);
1158
1184
  let endIndex;
1159
1185
  if (k < chains.length - 1) {
@@ -1166,10 +1192,13 @@ var require_lib = __commonJS({
1166
1192
  return start = endIndex;
1167
1193
  });
1168
1194
  } else {
1169
- results.push(first, ...binops.slice(start, i + 1).flat());
1195
+ if (first) {
1196
+ results.push(first);
1197
+ }
1198
+ results.push(...binops.slice(start, i + 1).flat());
1170
1199
  start = i + 1;
1171
1200
  }
1172
- return chains.length = 0;
1201
+ chains.length = 0;
1173
1202
  }
1174
1203
  function expandExistence(exp) {
1175
1204
  const existence = isExistence(exp);
@@ -1251,6 +1280,23 @@ var require_lib = __commonJS({
1251
1280
  }
1252
1281
  }
1253
1282
  }
1283
+ function replaceBlockExpression(node, child, replacement) {
1284
+ let found = false;
1285
+ const { expressions } = node;
1286
+ for (let i = 0, l = expressions.length; i < l; i++) {
1287
+ const statement = expressions[i];
1288
+ const [, s] = statement;
1289
+ if (s === child) {
1290
+ statement[1] = replacement;
1291
+ replacement.parent = node;
1292
+ found = true;
1293
+ break;
1294
+ }
1295
+ }
1296
+ if (!found) {
1297
+ throw new Error("Could not find child to replace");
1298
+ }
1299
+ }
1254
1300
  function findChildIndex(parent, child) {
1255
1301
  const children = Array.isArray(parent) ? parent : parent.children;
1256
1302
  const len = children.length;
@@ -2137,12 +2183,12 @@ var require_lib = __commonJS({
2137
2183
  }
2138
2184
  function processDeclarationConditions(node) {
2139
2185
  gatherRecursiveAll(node, (n) => {
2140
- return n.type === "IfStatement" || n.type === "IterationStatement";
2186
+ return n.type === "IfStatement" || n.type === "IterationStatement" || n.type === "SwitchStatement";
2141
2187
  }).forEach(processDeclarationConditionStatement);
2142
2188
  }
2143
2189
  function processDeclarationConditionStatement(s) {
2144
2190
  const { condition } = s;
2145
- if (!condition) {
2191
+ if (!condition?.expression) {
2146
2192
  return;
2147
2193
  }
2148
2194
  processDeclarationCondition(condition.expression);
@@ -2183,6 +2229,27 @@ var require_lib = __commonJS({
2183
2229
  updateParentPointers(newBlock, s);
2184
2230
  break;
2185
2231
  }
2232
+ case "SwitchStatement": {
2233
+ const { blockPrefix, ref: ref2 } = condition.expression;
2234
+ if (!blockPrefix) {
2235
+ return;
2236
+ }
2237
+ s.condition = {
2238
+ type: "ParenthesizedExpression",
2239
+ children: ["(", ref2, ")"],
2240
+ expression: ref2,
2241
+ parent: s
2242
+ };
2243
+ s.children[1] = s.condition;
2244
+ const block = blockWithPrefix([["", [{
2245
+ type: "Declaration",
2246
+ children: ["let ", ...condition.expression.children]
2247
+ }], ";"], ...blockPrefix], makeEmptyBlock());
2248
+ replaceBlockExpression(s.parent, s, block);
2249
+ block.expressions.push(["", s]);
2250
+ s.parent = block;
2251
+ break;
2252
+ }
2186
2253
  }
2187
2254
  }
2188
2255
  function implicitFunctionBlock(f) {
@@ -2631,12 +2698,12 @@ var require_lib = __commonJS({
2631
2698
  }
2632
2699
  if (errors || !isPattern)
2633
2700
  return;
2634
- let { expression } = s;
2635
- if (expression.type === "ParenthesizedExpression") {
2636
- expression = expression.expression;
2701
+ let { condition } = s;
2702
+ if (condition.type === "ParenthesizedExpression") {
2703
+ condition = condition.expression;
2637
2704
  }
2638
- let hoistDec, refAssignment = [], ref = maybeRef(expression, "m");
2639
- if (ref !== expression) {
2705
+ let hoistDec, refAssignment = [], ref = maybeRef(condition, "m");
2706
+ if (ref !== condition) {
2640
2707
  hoistDec = {
2641
2708
  type: "Declaration",
2642
2709
  children: ["let ", ref],
@@ -2644,7 +2711,7 @@ var require_lib = __commonJS({
2644
2711
  };
2645
2712
  refAssignment = [{
2646
2713
  type: "AssignmentExpression",
2647
- children: [ref, " = ", expression]
2714
+ children: [ref, " = ", condition]
2648
2715
  }, ","];
2649
2716
  }
2650
2717
  let prev = [], root = prev;
@@ -2672,7 +2739,7 @@ var require_lib = __commonJS({
2672
2739
  return conditionArray;
2673
2740
  return [" || ", ...conditionArray];
2674
2741
  });
2675
- const condition = {
2742
+ const condition2 = {
2676
2743
  type: "ParenthesizedExpression",
2677
2744
  children: ["(", ...refAssignment, conditionExpression, ")"],
2678
2745
  expression: conditionExpression
@@ -2707,7 +2774,7 @@ var require_lib = __commonJS({
2707
2774
  next.push("\n", "else ");
2708
2775
  prev.push(["", {
2709
2776
  type: "IfStatement",
2710
- children: ["if", condition, block, next],
2777
+ children: ["if", condition2, block, next],
2711
2778
  then: block,
2712
2779
  else: next,
2713
2780
  hoistDec
@@ -3961,6 +4028,7 @@ var require_parser = __commonJS({
3961
4028
  Typeof,
3962
4029
  Unless,
3963
4030
  Until,
4031
+ Using,
3964
4032
  Var,
3965
4033
  Void,
3966
4034
  When,
@@ -4011,6 +4079,9 @@ var require_parser = __commonJS({
4011
4079
  JSXChildExpression,
4012
4080
  IndentedJSXChildExpression,
4013
4081
  NestedJSXChildExpression,
4082
+ UsingDeclaration,
4083
+ UsingBinding,
4084
+ UsingJSModeError,
4014
4085
  TypeDeclaration,
4015
4086
  TypeDeclarationRest,
4016
4087
  OptionalEquals,
@@ -4328,29 +4399,30 @@ var require_parser = __commonJS({
4328
4399
  var $L184 = $L("typeof");
4329
4400
  var $L185 = $L("unless");
4330
4401
  var $L186 = $L("until");
4331
- var $L187 = $L("var");
4332
- var $L188 = $L("void");
4333
- var $L189 = $L("when");
4334
- var $L190 = $L("while");
4335
- var $L191 = $L("yield");
4336
- var $L192 = $L("/>");
4337
- var $L193 = $L("</");
4338
- var $L194 = $L("<>");
4339
- var $L195 = $L("</>");
4340
- var $L196 = $L("<!--");
4341
- var $L197 = $L("-->");
4342
- var $L198 = $L("type");
4343
- var $L199 = $L("enum");
4344
- var $L200 = $L("interface");
4345
- var $L201 = $L("global");
4346
- var $L202 = $L("module");
4347
- var $L203 = $L("namespace");
4348
- var $L204 = $L("asserts");
4349
- var $L205 = $L("keyof");
4350
- var $L206 = $L("infer");
4351
- var $L207 = $L("???");
4352
- var $L208 = $L("[]");
4353
- var $L209 = $L("civet");
4402
+ var $L187 = $L("using");
4403
+ var $L188 = $L("var");
4404
+ var $L189 = $L("void");
4405
+ var $L190 = $L("when");
4406
+ var $L191 = $L("while");
4407
+ var $L192 = $L("yield");
4408
+ var $L193 = $L("/>");
4409
+ var $L194 = $L("</");
4410
+ var $L195 = $L("<>");
4411
+ var $L196 = $L("</>");
4412
+ var $L197 = $L("<!--");
4413
+ var $L198 = $L("-->");
4414
+ var $L199 = $L("type");
4415
+ var $L200 = $L("enum");
4416
+ var $L201 = $L("interface");
4417
+ var $L202 = $L("global");
4418
+ var $L203 = $L("module");
4419
+ var $L204 = $L("namespace");
4420
+ var $L205 = $L("asserts");
4421
+ var $L206 = $L("keyof");
4422
+ var $L207 = $L("infer");
4423
+ var $L208 = $L("???");
4424
+ var $L209 = $L("[]");
4425
+ var $L210 = $L("civet");
4354
4426
  var $R0 = $R(new RegExp("(as|of|satisfies|then|when|implements|xor|xnor)(?!\\p{ID_Continue}|[\\u200C\\u200D$])", "suy"));
4355
4427
  var $R1 = $R(new RegExp("[0-9]", "suy"));
4356
4428
  var $R2 = $R(new RegExp("[)}]", "suy"));
@@ -5355,7 +5427,8 @@ var require_parser = __commonJS({
5355
5427
  type: "PropertyAccess",
5356
5428
  name: id,
5357
5429
  children: [".", id]
5358
- }]
5430
+ }],
5431
+ thisShorthand: true
5359
5432
  };
5360
5433
  });
5361
5434
  var ThisLiteral$2 = AtThis;
@@ -5376,7 +5449,8 @@ var require_parser = __commonJS({
5376
5449
  type: "PropertyAccess",
5377
5450
  name: id.name,
5378
5451
  children: [".", id]
5379
- }]
5452
+ }],
5453
+ privateShorthand: true
5380
5454
  };
5381
5455
  });
5382
5456
  var PrivateThis$$ = [PrivateThis$0, PrivateThis$1];
@@ -7228,20 +7302,7 @@ var require_parser = __commonJS({
7228
7302
  function ObjectPropertyDelimiter(ctx, state) {
7229
7303
  return $EVENT_C(ctx, state, "ObjectPropertyDelimiter", ObjectPropertyDelimiter$$);
7230
7304
  }
7231
- var PropertyDefinition$0 = $TS($S($E(_), AtThis, IdentifierReference), function($skip, $loc, $0, $1, $2, $3) {
7232
- var ws = $1;
7233
- var at = $2;
7234
- var id = $3;
7235
- const value = [at, ".", id];
7236
- return {
7237
- type: "Property",
7238
- children: [ws, id, ": ", ...value],
7239
- name: id,
7240
- names: id.names,
7241
- value
7242
- };
7243
- });
7244
- var PropertyDefinition$1 = $TS($S($E(_), NamedProperty), function($skip, $loc, $0, $1, $2) {
7305
+ var PropertyDefinition$0 = $TS($S($E(_), NamedProperty), function($skip, $loc, $0, $1, $2) {
7245
7306
  var ws = $1;
7246
7307
  var prop = $2;
7247
7308
  return {
@@ -7249,7 +7310,7 @@ var require_parser = __commonJS({
7249
7310
  children: [ws, ...prop.children]
7250
7311
  };
7251
7312
  });
7252
- var PropertyDefinition$2 = $TS($S($E(_), $TEXT($EXPECT($R6, "PropertyDefinition /[!+-]/")), PropertyName), function($skip, $loc, $0, $1, $2, $3) {
7313
+ var PropertyDefinition$1 = $TS($S($E(_), $TEXT($EXPECT($R6, "PropertyDefinition /[!+-]/")), PropertyName), function($skip, $loc, $0, $1, $2, $3) {
7253
7314
  var ws = $1;
7254
7315
  var toggle = $2;
7255
7316
  var id = $3;
@@ -7262,7 +7323,7 @@ var require_parser = __commonJS({
7262
7323
  value
7263
7324
  };
7264
7325
  });
7265
- var PropertyDefinition$3 = $TS($S($E(_), MethodDefinition), function($skip, $loc, $0, $1, $2) {
7326
+ var PropertyDefinition$2 = $TS($S($E(_), MethodDefinition), function($skip, $loc, $0, $1, $2) {
7266
7327
  var ws = $1;
7267
7328
  var def = $2;
7268
7329
  if (!def.block || def.block.empty)
@@ -7272,7 +7333,7 @@ var require_parser = __commonJS({
7272
7333
  children: [ws, ...def.children]
7273
7334
  };
7274
7335
  });
7275
- var PropertyDefinition$4 = $TS($S($E(_), DotDotDot, ExtendedExpression), function($skip, $loc, $0, $1, $2, $3) {
7336
+ var PropertyDefinition$3 = $TS($S($E(_), DotDotDot, ExtendedExpression), function($skip, $loc, $0, $1, $2, $3) {
7276
7337
  var ws = $1;
7277
7338
  var dots = $2;
7278
7339
  var exp = $3;
@@ -7284,7 +7345,7 @@ var require_parser = __commonJS({
7284
7345
  value: exp
7285
7346
  };
7286
7347
  });
7287
- var PropertyDefinition$5 = $TS($S($E(_), $N(EOS), CallExpression), function($skip, $loc, $0, $1, $2, $3) {
7348
+ var PropertyDefinition$4 = $TS($S($E(_), $N(EOS), CallExpression), function($skip, $loc, $0, $1, $2, $3) {
7288
7349
  var ws = $1;
7289
7350
  var value = $3;
7290
7351
  switch (value.type) {
@@ -7343,16 +7404,18 @@ var require_parser = __commonJS({
7343
7404
  if (!name)
7344
7405
  return $skip;
7345
7406
  }
7407
+ if (name[0] === "#")
7408
+ name = name.slice(1);
7346
7409
  return {
7347
7410
  type: "Property",
7348
7411
  children: [ws, name, ": ", value],
7349
7412
  name,
7350
- value,
7351
7413
  names: [],
7414
+ value,
7352
7415
  hoistDec
7353
7416
  };
7354
7417
  });
7355
- var PropertyDefinition$$ = [PropertyDefinition$0, PropertyDefinition$1, PropertyDefinition$2, PropertyDefinition$3, PropertyDefinition$4, PropertyDefinition$5];
7418
+ var PropertyDefinition$$ = [PropertyDefinition$0, PropertyDefinition$1, PropertyDefinition$2, PropertyDefinition$3, PropertyDefinition$4];
7356
7419
  function PropertyDefinition(ctx, state) {
7357
7420
  return $EVENT_C(ctx, state, "PropertyDefinition", PropertyDefinition$$);
7358
7421
  }
@@ -8716,7 +8779,7 @@ var require_parser = __commonJS({
8716
8779
  return {
8717
8780
  type: "SwitchStatement",
8718
8781
  children: $0,
8719
- expression: condition,
8782
+ condition,
8720
8783
  caseBlock
8721
8784
  };
8722
8785
  });
@@ -9540,7 +9603,8 @@ var require_parser = __commonJS({
9540
9603
  var Declaration$3 = TypeDeclaration;
9541
9604
  var Declaration$4 = EnumDeclaration;
9542
9605
  var Declaration$5 = OperatorDeclaration;
9543
- var Declaration$$ = [Declaration$0, Declaration$1, Declaration$2, Declaration$3, Declaration$4, Declaration$5];
9606
+ var Declaration$6 = UsingDeclaration;
9607
+ var Declaration$$ = [Declaration$0, Declaration$1, Declaration$2, Declaration$3, Declaration$4, Declaration$5, Declaration$6];
9544
9608
  function Declaration(ctx, state) {
9545
9609
  return $EVENT_C(ctx, state, "Declaration", Declaration$$);
9546
9610
  }
@@ -10613,31 +10677,37 @@ var require_parser = __commonJS({
10613
10677
  function Until(ctx, state) {
10614
10678
  return $EVENT(ctx, state, "Until", Until$0);
10615
10679
  }
10616
- var Var$0 = $TS($S($EXPECT($L187, 'Var "var"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
10680
+ var Using$0 = $TS($S($EXPECT($L187, 'Using "using"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
10681
+ return { $loc, token: $1 };
10682
+ });
10683
+ function Using(ctx, state) {
10684
+ return $EVENT(ctx, state, "Using", Using$0);
10685
+ }
10686
+ var Var$0 = $TS($S($EXPECT($L188, 'Var "var"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
10617
10687
  return { $loc, token: $1 };
10618
10688
  });
10619
10689
  function Var(ctx, state) {
10620
10690
  return $EVENT(ctx, state, "Var", Var$0);
10621
10691
  }
10622
- var Void$0 = $TS($S($EXPECT($L188, 'Void "void"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
10692
+ var Void$0 = $TS($S($EXPECT($L189, 'Void "void"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
10623
10693
  return { $loc, token: $1 };
10624
10694
  });
10625
10695
  function Void(ctx, state) {
10626
10696
  return $EVENT(ctx, state, "Void", Void$0);
10627
10697
  }
10628
- var When$0 = $TS($S($EXPECT($L189, 'When "when"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
10698
+ var When$0 = $TS($S($EXPECT($L190, 'When "when"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
10629
10699
  return { $loc, token: "case" };
10630
10700
  });
10631
10701
  function When(ctx, state) {
10632
10702
  return $EVENT(ctx, state, "When", When$0);
10633
10703
  }
10634
- var While$0 = $TS($S($EXPECT($L190, 'While "while"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
10704
+ var While$0 = $TS($S($EXPECT($L191, 'While "while"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
10635
10705
  return { $loc, token: $1 };
10636
10706
  });
10637
10707
  function While(ctx, state) {
10638
10708
  return $EVENT(ctx, state, "While", While$0);
10639
10709
  }
10640
- var Yield$0 = $TS($S($EXPECT($L191, 'Yield "yield"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
10710
+ var Yield$0 = $TS($S($EXPECT($L192, 'Yield "yield"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
10641
10711
  return { $loc, token: $1, type: "Yield" };
10642
10712
  });
10643
10713
  function Yield(ctx, state) {
@@ -10710,7 +10780,7 @@ var require_parser = __commonJS({
10710
10780
  function JSXElement(ctx, state) {
10711
10781
  return $EVENT_C(ctx, state, "JSXElement", JSXElement$$);
10712
10782
  }
10713
- 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) {
10783
+ 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) {
10714
10784
  return { type: "JSXElement", children: $0, tag: $2 };
10715
10785
  });
10716
10786
  function JSXSelfClosingElement(ctx, state) {
@@ -10744,7 +10814,7 @@ var require_parser = __commonJS({
10744
10814
  function JSXOptionalClosingElement(ctx, state) {
10745
10815
  return $EVENT_C(ctx, state, "JSXOptionalClosingElement", JSXOptionalClosingElement$$);
10746
10816
  }
10747
- var JSXClosingElement$0 = $S($EXPECT($L193, 'JSXClosingElement "</"'), $E(Whitespace), JSXElementName, $E(Whitespace), $EXPECT($L33, 'JSXClosingElement ">"'));
10817
+ var JSXClosingElement$0 = $S($EXPECT($L194, 'JSXClosingElement "</"'), $E(Whitespace), JSXElementName, $E(Whitespace), $EXPECT($L33, 'JSXClosingElement ">"'));
10748
10818
  function JSXClosingElement(ctx, state) {
10749
10819
  return $EVENT(ctx, state, "JSXClosingElement", JSXClosingElement$0);
10750
10820
  }
@@ -10765,7 +10835,7 @@ var require_parser = __commonJS({
10765
10835
  ];
10766
10836
  return { type: "JSXFragment", children: parts, jsxChildren: children.jsxChildren };
10767
10837
  });
10768
- var JSXFragment$1 = $TS($S(CoffeeJSXEnabled, $EXPECT($L194, 'JSXFragment "<>"'), $E(JSXChildren), $E(Whitespace), JSXClosingFragment), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
10838
+ var JSXFragment$1 = $TS($S(CoffeeJSXEnabled, $EXPECT($L195, 'JSXFragment "<>"'), $E(JSXChildren), $E(Whitespace), JSXClosingFragment), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
10769
10839
  var children = $3;
10770
10840
  $0 = $0.slice(1);
10771
10841
  return {
@@ -10778,7 +10848,7 @@ var require_parser = __commonJS({
10778
10848
  function JSXFragment(ctx, state) {
10779
10849
  return $EVENT_C(ctx, state, "JSXFragment", JSXFragment$$);
10780
10850
  }
10781
- var PushJSXOpeningFragment$0 = $TV($EXPECT($L194, 'PushJSXOpeningFragment "<>"'), function($skip, $loc, $0, $1) {
10851
+ var PushJSXOpeningFragment$0 = $TV($EXPECT($L195, 'PushJSXOpeningFragment "<>"'), function($skip, $loc, $0, $1) {
10782
10852
  module2.JSXTagStack.push("");
10783
10853
  return $1;
10784
10854
  });
@@ -10795,7 +10865,7 @@ var require_parser = __commonJS({
10795
10865
  function JSXOptionalClosingFragment(ctx, state) {
10796
10866
  return $EVENT_C(ctx, state, "JSXOptionalClosingFragment", JSXOptionalClosingFragment$$);
10797
10867
  }
10798
- var JSXClosingFragment$0 = $EXPECT($L195, 'JSXClosingFragment "</>"');
10868
+ var JSXClosingFragment$0 = $EXPECT($L196, 'JSXClosingFragment "</>"');
10799
10869
  function JSXClosingFragment(ctx, state) {
10800
10870
  return $EVENT(ctx, state, "JSXClosingFragment", JSXClosingFragment$0);
10801
10871
  }
@@ -11264,7 +11334,7 @@ var require_parser = __commonJS({
11264
11334
  function JSXChild(ctx, state) {
11265
11335
  return $EVENT_C(ctx, state, "JSXChild", JSXChild$$);
11266
11336
  }
11267
- var JSXComment$0 = $TS($S($EXPECT($L196, 'JSXComment "<!--"'), JSXCommentContent, $EXPECT($L197, 'JSXComment "-->"')), function($skip, $loc, $0, $1, $2, $3) {
11337
+ var JSXComment$0 = $TS($S($EXPECT($L197, 'JSXComment "<!--"'), JSXCommentContent, $EXPECT($L198, 'JSXComment "-->"')), function($skip, $loc, $0, $1, $2, $3) {
11268
11338
  return ["{/*", $2, "*/}"];
11269
11339
  });
11270
11340
  function JSXComment(ctx, state) {
@@ -11302,6 +11372,52 @@ var require_parser = __commonJS({
11302
11372
  function NestedJSXChildExpression(ctx, state) {
11303
11373
  return $EVENT(ctx, state, "NestedJSXChildExpression", NestedJSXChildExpression$0);
11304
11374
  }
11375
+ var UsingDeclaration$0 = $TS($S(Using, $E(_), UsingBinding, $Q($S(__, Comma, __, UsingBinding)), UsingJSModeError), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
11376
+ var decl = $1;
11377
+ var binding = $3;
11378
+ var tail = $4;
11379
+ const bindings = [binding].concat(tail.map(([, , , b]) => b));
11380
+ return {
11381
+ type: "Declaration",
11382
+ children: $0,
11383
+ names: bindings.flatMap((b) => b.names),
11384
+ bindings,
11385
+ decl,
11386
+ splices: bindings.flatMap((b) => b.splices),
11387
+ thisAssignments: bindings.flatMap((b) => b.thisAssignments)
11388
+ };
11389
+ });
11390
+ function UsingDeclaration(ctx, state) {
11391
+ return $EVENT(ctx, state, "UsingDeclaration", UsingDeclaration$0);
11392
+ }
11393
+ var UsingBinding$0 = $TS($S(BindingIdentifier, $E(TypeSuffix), Initializer), function($skip, $loc, $0, $1, $2, $3) {
11394
+ var pattern = $1;
11395
+ var suffix = $2;
11396
+ var initializer = $3;
11397
+ return {
11398
+ type: "Binding",
11399
+ children: $0,
11400
+ names: pattern.names,
11401
+ pattern,
11402
+ suffix,
11403
+ initializer,
11404
+ splices: [],
11405
+ thisAssignments: []
11406
+ };
11407
+ });
11408
+ function UsingBinding(ctx, state) {
11409
+ return $EVENT(ctx, state, "UsingBinding", UsingBinding$0);
11410
+ }
11411
+ var UsingJSModeError$0 = $TV($EXPECT($L0, 'UsingJSModeError ""'), function($skip, $loc, $0, $1) {
11412
+ return {
11413
+ type: "Error",
11414
+ js: true,
11415
+ message: "`using` is not currently transpiled in JS mode."
11416
+ };
11417
+ });
11418
+ function UsingJSModeError(ctx, state) {
11419
+ return $EVENT(ctx, state, "UsingJSModeError", UsingJSModeError$0);
11420
+ }
11305
11421
  var TypeDeclaration$0 = $T($S($E($S(Export, $E(_))), $S(Declare, $E(_)), TypeLexicalDeclaration), function(value) {
11306
11422
  return { "ts": true, "children": value };
11307
11423
  });
@@ -11350,37 +11466,37 @@ var require_parser = __commonJS({
11350
11466
  function InterfaceExtendsTarget(ctx, state) {
11351
11467
  return $EVENT(ctx, state, "InterfaceExtendsTarget", InterfaceExtendsTarget$0);
11352
11468
  }
11353
- var TypeKeyword$0 = $TS($S($EXPECT($L198, 'TypeKeyword "type"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
11469
+ var TypeKeyword$0 = $TS($S($EXPECT($L199, 'TypeKeyword "type"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
11354
11470
  return { $loc, token: $1 };
11355
11471
  });
11356
11472
  function TypeKeyword(ctx, state) {
11357
11473
  return $EVENT(ctx, state, "TypeKeyword", TypeKeyword$0);
11358
11474
  }
11359
- var Enum$0 = $TS($S($EXPECT($L199, 'Enum "enum"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
11475
+ var Enum$0 = $TS($S($EXPECT($L200, 'Enum "enum"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
11360
11476
  return { $loc, token: $1 };
11361
11477
  });
11362
11478
  function Enum(ctx, state) {
11363
11479
  return $EVENT(ctx, state, "Enum", Enum$0);
11364
11480
  }
11365
- var Interface$0 = $TS($S($EXPECT($L200, 'Interface "interface"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
11481
+ var Interface$0 = $TS($S($EXPECT($L201, 'Interface "interface"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
11366
11482
  return { $loc, token: $1 };
11367
11483
  });
11368
11484
  function Interface(ctx, state) {
11369
11485
  return $EVENT(ctx, state, "Interface", Interface$0);
11370
11486
  }
11371
- var Global$0 = $TS($S($EXPECT($L201, 'Global "global"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
11487
+ var Global$0 = $TS($S($EXPECT($L202, 'Global "global"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
11372
11488
  return { $loc, token: $1 };
11373
11489
  });
11374
11490
  function Global(ctx, state) {
11375
11491
  return $EVENT(ctx, state, "Global", Global$0);
11376
11492
  }
11377
- var Module$0 = $TS($S($EXPECT($L202, 'Module "module"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
11493
+ var Module$0 = $TS($S($EXPECT($L203, 'Module "module"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
11378
11494
  return { $loc, token: $1 };
11379
11495
  });
11380
11496
  function Module(ctx, state) {
11381
11497
  return $EVENT(ctx, state, "Module", Module$0);
11382
11498
  }
11383
- var Namespace$0 = $TS($S($EXPECT($L203, 'Namespace "namespace"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
11499
+ var Namespace$0 = $TS($S($EXPECT($L204, 'Namespace "namespace"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
11384
11500
  return { $loc, token: $1 };
11385
11501
  });
11386
11502
  function Namespace(ctx, state) {
@@ -11625,7 +11741,7 @@ var require_parser = __commonJS({
11625
11741
  function ReturnTypeSuffix(ctx, state) {
11626
11742
  return $EVENT(ctx, state, "ReturnTypeSuffix", ReturnTypeSuffix$0);
11627
11743
  }
11628
- var ReturnType$0 = $TS($S($E($S(__, $EXPECT($L204, 'ReturnType "asserts"'), NonIdContinue)), TypePredicate), function($skip, $loc, $0, $1, $2) {
11744
+ var ReturnType$0 = $TS($S($E($S(__, $EXPECT($L205, 'ReturnType "asserts"'), NonIdContinue)), TypePredicate), function($skip, $loc, $0, $1, $2) {
11629
11745
  var asserts = $1;
11630
11746
  var t = $2;
11631
11747
  if (asserts) {
@@ -11694,9 +11810,9 @@ var require_parser = __commonJS({
11694
11810
  function TypeUnarySuffix(ctx, state) {
11695
11811
  return $EVENT_C(ctx, state, "TypeUnarySuffix", TypeUnarySuffix$$);
11696
11812
  }
11697
- var TypeUnaryOp$0 = $S($EXPECT($L205, 'TypeUnaryOp "keyof"'), NonIdContinue);
11813
+ var TypeUnaryOp$0 = $S($EXPECT($L206, 'TypeUnaryOp "keyof"'), NonIdContinue);
11698
11814
  var TypeUnaryOp$1 = $S($EXPECT($L184, 'TypeUnaryOp "typeof"'), NonIdContinue);
11699
- var TypeUnaryOp$2 = $S($EXPECT($L206, 'TypeUnaryOp "infer"'), NonIdContinue);
11815
+ var TypeUnaryOp$2 = $S($EXPECT($L207, 'TypeUnaryOp "infer"'), NonIdContinue);
11700
11816
  var TypeUnaryOp$3 = $S($EXPECT($L167, 'TypeUnaryOp "readonly"'), NonIdContinue);
11701
11817
  var TypeUnaryOp$$ = [TypeUnaryOp$0, TypeUnaryOp$1, TypeUnaryOp$2, TypeUnaryOp$3];
11702
11818
  function TypeUnaryOp(ctx, state) {
@@ -11706,7 +11822,7 @@ var require_parser = __commonJS({
11706
11822
  function TypeIndexedAccess(ctx, state) {
11707
11823
  return $EVENT(ctx, state, "TypeIndexedAccess", TypeIndexedAccess$0);
11708
11824
  }
11709
- var UnknownAlias$0 = $TV($EXPECT($L207, 'UnknownAlias "???"'), function($skip, $loc, $0, $1) {
11825
+ var UnknownAlias$0 = $TV($EXPECT($L208, 'UnknownAlias "???"'), function($skip, $loc, $0, $1) {
11710
11826
  return { $loc, token: "unknown" };
11711
11827
  });
11712
11828
  function UnknownAlias(ctx, state) {
@@ -11846,10 +11962,10 @@ var require_parser = __commonJS({
11846
11962
  }
11847
11963
  var TypeLiteral$0 = TypeTemplateLiteral;
11848
11964
  var TypeLiteral$1 = Literal;
11849
- var TypeLiteral$2 = $TS($S($EXPECT($L188, 'TypeLiteral "void"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
11965
+ var TypeLiteral$2 = $TS($S($EXPECT($L189, 'TypeLiteral "void"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
11850
11966
  return { type: "VoidType", $loc, token: $1 };
11851
11967
  });
11852
- var TypeLiteral$3 = $TV($EXPECT($L208, 'TypeLiteral "[]"'), function($skip, $loc, $0, $1) {
11968
+ var TypeLiteral$3 = $TV($EXPECT($L209, 'TypeLiteral "[]"'), function($skip, $loc, $0, $1) {
11853
11969
  return { $loc, token: "[]" };
11854
11970
  });
11855
11971
  var TypeLiteral$$ = [TypeLiteral$0, TypeLiteral$1, TypeLiteral$2, TypeLiteral$3];
@@ -11970,7 +12086,7 @@ var require_parser = __commonJS({
11970
12086
  function CivetPrologue(ctx, state) {
11971
12087
  return $EVENT_C(ctx, state, "CivetPrologue", CivetPrologue$$);
11972
12088
  }
11973
- var CivetPrologueContent$0 = $TS($S($EXPECT($L209, 'CivetPrologueContent "civet"'), NonIdContinue, $Q(CivetOption), $EXPECT($R63, "CivetPrologueContent /[\\s]*/")), function($skip, $loc, $0, $1, $2, $3, $4) {
12089
+ var CivetPrologueContent$0 = $TS($S($EXPECT($L210, 'CivetPrologueContent "civet"'), NonIdContinue, $Q(CivetOption), $EXPECT($R63, "CivetPrologueContent /[\\s]*/")), function($skip, $loc, $0, $1, $2, $3, $4) {
11974
12090
  var options = $3;
11975
12091
  return {
11976
12092
  type: "CivetPrologue",
@@ -13126,6 +13242,7 @@ var require_parser = __commonJS({
13126
13242
  exports.Typeof = Typeof;
13127
13243
  exports.Unless = Unless;
13128
13244
  exports.Until = Until;
13245
+ exports.Using = Using;
13129
13246
  exports.Var = Var;
13130
13247
  exports.Void = Void;
13131
13248
  exports.When = When;
@@ -13176,6 +13293,9 @@ var require_parser = __commonJS({
13176
13293
  exports.JSXChildExpression = JSXChildExpression;
13177
13294
  exports.IndentedJSXChildExpression = IndentedJSXChildExpression;
13178
13295
  exports.NestedJSXChildExpression = NestedJSXChildExpression;
13296
+ exports.UsingDeclaration = UsingDeclaration;
13297
+ exports.UsingBinding = UsingBinding;
13298
+ exports.UsingJSModeError = UsingJSModeError;
13179
13299
  exports.TypeDeclaration = TypeDeclaration;
13180
13300
  exports.TypeDeclarationRest = TypeDeclarationRest;
13181
13301
  exports.OptionalEquals = OptionalEquals;
@@ -13355,6 +13475,7 @@ __export(main_exports, {
13355
13475
  generate: () => generate_default,
13356
13476
  isCompileError: () => isCompileError,
13357
13477
  parse: () => parse,
13478
+ prune: () => prune,
13358
13479
  util: () => util_exports
13359
13480
  });
13360
13481
  module.exports = __toCommonJS(main_exports);
@@ -13375,17 +13496,17 @@ function gen(node, options) {
13375
13496
  }).join("");
13376
13497
  }
13377
13498
  if (typeof node === "object") {
13378
- if (node.type === "Error") {
13379
- options.errors ?? (options.errors = []);
13380
- options.errors.push(node);
13381
- return "";
13382
- }
13383
13499
  if (options.js && node.ts) {
13384
13500
  return "";
13385
13501
  }
13386
13502
  if (!options.js && node.js) {
13387
13503
  return "";
13388
13504
  }
13505
+ if (node.type === "Error") {
13506
+ options.errors ?? (options.errors = []);
13507
+ options.errors.push(node);
13508
+ return "";
13509
+ }
13389
13510
  if (node.$loc != null) {
13390
13511
  const { token, $loc } = node;
13391
13512
  options?.updateSourceMap?.(token, $loc.pos);
@@ -13523,7 +13644,10 @@ var SourceMap = function(sourceString) {
13523
13644
  sources: [srcFileName],
13524
13645
  mappings: this.renderMappings(),
13525
13646
  names: [],
13526
- sourcesContent: [sourceString]
13647
+ sourcesContent: [sourceString],
13648
+ toString: function() {
13649
+ return JSON.stringify(this);
13650
+ }
13527
13651
  };
13528
13652
  },
13529
13653
  updateSourceMap: function(outputStr, inputPos) {
@@ -13947,5 +14071,6 @@ var main_default = { parse, generate: generate_default, util: util_exports, comp
13947
14071
  generate,
13948
14072
  isCompileError,
13949
14073
  parse,
14074
+ prune,
13950
14075
  util
13951
14076
  });