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