@danielx/civet 0.10.7 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.mjs CHANGED
@@ -28,9 +28,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
28
  mod
29
29
  ));
30
30
 
31
- // ../Hera/dist/machine.js
31
+ // node_modules/@danielx/hera/dist/machine.js
32
32
  var require_machine = __commonJS({
33
- "../Hera/dist/machine.js"(exports, module) {
33
+ "node_modules/@danielx/hera/dist/machine.js"(exports, module) {
34
34
  "use strict";
35
35
  var __defProp2 = Object.defineProperty;
36
36
  var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
@@ -604,7 +604,7 @@ function addParentPointers(node, parent) {
604
604
  node.parent = parent;
605
605
  }
606
606
  if (node.children) {
607
- for (let ref = node.children, i1 = 0, len1 = ref.length; i1 < len1; i1++) {
607
+ for (let ref = node.children, i1 = 0, len12 = ref.length; i1 < len12; i1++) {
608
608
  const child = ref[i1];
609
609
  addParentPointers(child, node);
610
610
  }
@@ -1588,7 +1588,7 @@ function findChildIndex(parent, child) {
1588
1588
  }
1589
1589
  }
1590
1590
  function arrayRecurse(array) {
1591
- for (let i2 = 0, len1 = array.length; i2 < len1; i2++) {
1591
+ for (let i2 = 0, len12 = array.length; i2 < len12; i2++) {
1592
1592
  const c = array[i2];
1593
1593
  if (c === child || Array.isArray(c) && arrayRecurse(c)) {
1594
1594
  return true;
@@ -1795,7 +1795,7 @@ function adjustBindingElements(elements) {
1795
1795
  const names = elements.flatMap(($2) => $2.names || []);
1796
1796
  const { length } = elements;
1797
1797
  let blockPrefix, restIndex = -1, restCount = 0;
1798
- for (let i2 = 0, len1 = elements.length; i2 < len1; i2++) {
1798
+ for (let i2 = 0, len12 = elements.length; i2 < len12; i2++) {
1799
1799
  const i = i2;
1800
1800
  const { type } = elements[i2];
1801
1801
  if (type === "BindingRestElement") {
@@ -3054,7 +3054,7 @@ function patternBindings(pattern) {
3054
3054
  function recurse(pattern2) {
3055
3055
  switch (pattern2.type) {
3056
3056
  case "ArrayBindingPattern": {
3057
- for (let ref3 = pattern2.elements, i2 = 0, len1 = ref3.length; i2 < len1; i2++) {
3057
+ for (let ref3 = pattern2.elements, i2 = 0, len12 = ref3.length; i2 < len12; i2++) {
3058
3058
  const element = ref3[i2];
3059
3059
  recurse(element);
3060
3060
  }
@@ -4057,14 +4057,23 @@ function expressionizeIteration(exp) {
4057
4057
  if (generator) {
4058
4058
  iterationDefaultBody(statement);
4059
4059
  assignResults(block, (node) => {
4060
+ let star;
4061
+ if (node && typeof node === "object" && "type" in node && node.type === "SpreadElement" && "expression" in node) {
4062
+ const { expression } = node;
4063
+ star = "*";
4064
+ node = expression;
4065
+ }
4060
4066
  return {
4061
4067
  type: "YieldExpression",
4062
4068
  expression: node,
4069
+ star,
4063
4070
  children: [
4064
4071
  {
4065
4072
  type: "Yield",
4066
- token: "yield "
4073
+ children: ["yield"]
4067
4074
  },
4075
+ star,
4076
+ " ",
4068
4077
  node
4069
4078
  ]
4070
4079
  };
@@ -4258,6 +4267,17 @@ function braceBlock(block) {
4258
4267
  }
4259
4268
  }
4260
4269
  }
4270
+ function unbraceBlock(block) {
4271
+ if (block.bare) {
4272
+ return;
4273
+ }
4274
+ let ref;
4275
+ if (block.children[0] === " {" && (ref = block.children)[ref.length - 1] === "}") {
4276
+ block.children.shift();
4277
+ block.children.pop();
4278
+ block.bare = true;
4279
+ }
4280
+ }
4261
4281
  function duplicateBlock(block) {
4262
4282
  const expressions = [...block.expressions];
4263
4283
  let children;
@@ -4356,16 +4376,58 @@ function insertHoistDec(block, node, dec) {
4356
4376
  }
4357
4377
  function processBlocks(statements) {
4358
4378
  insertSemicolon(statements);
4359
- for (let ref = gatherRecursive(statements, ($) => $.type === "BlockStatement"), i2 = 0, len1 = ref.length; i2 < len1; i2++) {
4360
- const { expressions } = ref[i2];
4361
- processBlocks(expressions);
4379
+ for (let ref1 = gatherRecursive(statements, ($) => $.type === "BlockStatement"), i2 = 0, len12 = ref1.length; i2 < len12; i2++) {
4380
+ const block = ref1[i2];
4381
+ let m;
4382
+ if (block.unwrapObject && block.expressions.length === 1 && (m = block.expressions[0][1], typeof m === "object" && m != null && "type" in m && m.type === "ParenthesizedExpression" && "implicit" in m && m.implicit === true && "expression" in m && typeof m.expression === "object" && m.expression != null && "type" in m.expression && m.expression.type === "ObjectExpression")) {
4383
+ const object = block.expressions[0][1].expression;
4384
+ if (!(() => {
4385
+ let results = true;
4386
+ for (const prop of object.properties) {
4387
+ if (!(prop.type === "Property" && prop.implicitName)) {
4388
+ results = false;
4389
+ break;
4390
+ }
4391
+ }
4392
+ return results;
4393
+ })()) {
4394
+ continue;
4395
+ }
4396
+ block.expressions[0][1] = block.expressions[0][1].expression;
4397
+ unbraceBlock(block);
4398
+ for (let ref2 = object.properties, i3 = 0, len22 = ref2.length; i3 < len22; i3++) {
4399
+ const i = i3;
4400
+ const prop = ref2[i3];
4401
+ let m1;
4402
+ if (m1 = prop.name, typeof m1 === "object" && m1 != null && "type" in m1 && m1.type === "ComputedPropertyName" && "implicit" in m1 && m1.implicit === true) {
4403
+ replaceNode(prop.name, prop.name.expression, prop);
4404
+ }
4405
+ if (prop.delim?.implicit) {
4406
+ if (needsPrecedingSemicolon(object.properties[i + 1])) {
4407
+ prop.delim.token = ";";
4408
+ } else {
4409
+ replaceNode(prop.delim, void 0, prop);
4410
+ prop.delim = void 0;
4411
+ }
4412
+ }
4413
+ const colon = prop.children.indexOf(": ");
4414
+ if (colon < 0) {
4415
+ continue;
4416
+ }
4417
+ if (!(prop.children[colon - 1] === prop.name)) {
4418
+ continue;
4419
+ }
4420
+ prop.children.splice(colon - 1, 2);
4421
+ }
4422
+ }
4423
+ processBlocks(block.expressions);
4362
4424
  }
4363
4425
  }
4364
4426
  function insertSemicolon(statements) {
4365
4427
  const l = statements.length;
4366
- for (let i3 = 0, len22 = statements.length; i3 < len22; i3++) {
4367
- const i = i3;
4368
- const s = statements[i3];
4428
+ for (let i4 = 0, len3 = statements.length; i4 < len3; i4++) {
4429
+ const i = i4;
4430
+ const s = statements[i4];
4369
4431
  if (i < l - 1) {
4370
4432
  if (needsPrecedingSemicolon(statements[i + 1][1])) {
4371
4433
  const delim = s[2];
@@ -4383,8 +4445,8 @@ function needsPrecedingSemicolon(exp) {
4383
4445
  return false;
4384
4446
  }
4385
4447
  if (Array.isArray(exp)) {
4386
- for (let i4 = 0, len3 = exp.length; i4 < len3; i4++) {
4387
- const child = exp[i4];
4448
+ for (let i5 = 0, len4 = exp.length; i5 < len4; i5++) {
4449
+ const child = exp[i5];
4388
4450
  if (!(child != null)) {
4389
4451
  continue;
4390
4452
  }
@@ -4430,8 +4492,8 @@ function needsPrecedingSemicolon(exp) {
4430
4492
  function blockContainingStatement(exp) {
4431
4493
  let child = exp;
4432
4494
  let parent = exp.parent;
4433
- let m;
4434
- while (parent != null && (m = parent.type, m === "StatementExpression" || m === "PipelineExpression" || m === "UnwrappedExpression")) {
4495
+ let m2;
4496
+ while (parent != null && (m2 = parent.type, m2 === "StatementExpression" || m2 === "PipelineExpression" || m2 === "UnwrappedExpression")) {
4435
4497
  child = parent;
4436
4498
  parent = parent.parent;
4437
4499
  }
@@ -4484,7 +4546,7 @@ var precedenceMap = /* @__PURE__ */ new Map();
4484
4546
  for (let i1 = 0, len3 = precedenceOrder.length; i1 < len3; i1++) {
4485
4547
  const prec = i1;
4486
4548
  const ops = precedenceOrder[i1];
4487
- for (let i2 = 0, len1 = ops.length; i2 < len1; i2++) {
4549
+ for (let i2 = 0, len12 = ops.length; i2 < len12; i2++) {
4488
4550
  const op = ops[i2];
4489
4551
  precedenceMap.set(op, prec);
4490
4552
  }
@@ -4815,7 +4877,7 @@ function processPatternMatching(statements) {
4815
4877
  let isPattern = false;
4816
4878
  if (clauses.some(($4) => $4.type === "PatternClause")) {
4817
4879
  isPattern = true;
4818
- for (let i2 = 0, len1 = clauses.length; i2 < len1; i2++) {
4880
+ for (let i2 = 0, len12 = clauses.length; i2 < len12; i2++) {
4819
4881
  const c = clauses[i2];
4820
4882
  if (!(c.type === "PatternClause" || c.type === "DefaultClause")) {
4821
4883
  errors = true;
@@ -5349,7 +5411,7 @@ function processAssignmentDeclaration(decl, pattern, typeSuffix, ws, assign, e)
5349
5411
  });
5350
5412
  }
5351
5413
  function processDeclarations(statements) {
5352
- for (let ref1 = gatherRecursiveAll(statements, ($) => $.type === "Declaration"), i1 = 0, len1 = ref1.length; i1 < len1; i1++) {
5414
+ for (let ref1 = gatherRecursiveAll(statements, ($) => $.type === "Declaration"), i1 = 0, len12 = ref1.length; i1 < len12; i1++) {
5353
5415
  const declaration = ref1[i1];
5354
5416
  const { bindings } = declaration;
5355
5417
  if (!(bindings != null)) {
@@ -5436,7 +5498,7 @@ function prependStatementExpressionBlock(initializer, statement) {
5436
5498
  }
5437
5499
  const pre = [];
5438
5500
  const statementExp = exp.statement;
5439
- const blockStatement = ["", statementExp];
5501
+ const blockStatement = [ws || "", statementExp, ";"];
5440
5502
  let ref;
5441
5503
  if (statementExp.type === "IterationExpression") {
5442
5504
  if (statementExp.async || statementExp.generator) {
@@ -5458,9 +5520,9 @@ function prependStatementExpressionBlock(initializer, statement) {
5458
5520
  });
5459
5521
  const refDec = {
5460
5522
  type: "Declaration",
5461
- children: ["let ", ref, ";"]
5523
+ children: ["let ", ref]
5462
5524
  };
5463
- pre.unshift(refDec);
5525
+ pre.unshift(["", refDec, ";"]);
5464
5526
  } else {
5465
5527
  wrapIterationReturningResults(statement2, () => void 0);
5466
5528
  ref = initializer.expression = initializer.children[2] = statement2.resultsRef;
@@ -5476,14 +5538,11 @@ function prependStatementExpressionBlock(initializer, statement) {
5476
5538
  });
5477
5539
  const refDec = {
5478
5540
  type: "Declaration",
5479
- children: ["let ", ref, ";"]
5541
+ children: ["let ", ref]
5480
5542
  };
5481
- pre.unshift(refDec);
5482
- if (ws) {
5483
- pre.push(ws);
5484
- }
5543
+ pre.unshift(["", refDec, ";"]);
5485
5544
  }
5486
- statement.children.unshift(pre, blockStatement, ";");
5545
+ statement.children.unshift(...pre, blockStatement);
5487
5546
  updateParentPointers(blockStatement, statement);
5488
5547
  return ref;
5489
5548
  }
@@ -5804,26 +5863,60 @@ function dynamizeImportDeclaration(decl) {
5804
5863
  };
5805
5864
  }
5806
5865
  function dynamizeImportDeclarationExpression($0) {
5807
- const [imp, ws1, named, ws2, from] = $0;
5808
- const object = convertNamedImportsToObject(named);
5809
- const dot = ".";
5810
- return processCallMemberExpression({
5811
- type: "CallExpression",
5866
+ const [imp, ws1, imports, ws2, from] = $0;
5867
+ const awaitExpression = {
5868
+ type: "AwaitExpression",
5812
5869
  children: [
5813
- { type: "Await", children: "await" },
5870
+ { type: "Await", children: ["await"] },
5814
5871
  " ",
5815
5872
  imp,
5816
5873
  trimFirstSpace(ws2),
5817
- dynamizeFromClause(from),
5818
- {
5819
- type: "PropertyGlob",
5820
- dot,
5821
- object,
5822
- children: [ws1, dot, object],
5823
- reversed: true
5824
- }
5874
+ dynamizeFromClause(from)
5825
5875
  ]
5826
- });
5876
+ };
5877
+ const dot = {
5878
+ type: "AccessStart",
5879
+ children: ["."],
5880
+ optional: false
5881
+ };
5882
+ switch (imports?.type) {
5883
+ case "Identifier": {
5884
+ return processCallMemberExpression({
5885
+ type: "CallExpression",
5886
+ children: [
5887
+ parenthesizeExpression(awaitExpression),
5888
+ {
5889
+ type: "PropertyAccess",
5890
+ dot,
5891
+ name: "default",
5892
+ children: [ws1, dot, "default"]
5893
+ }
5894
+ ]
5895
+ });
5896
+ }
5897
+ case "Star": {
5898
+ return parenthesizeExpression(awaitExpression);
5899
+ }
5900
+ case "Declaration": {
5901
+ const object = convertNamedImportsToObject(imports);
5902
+ return processCallMemberExpression({
5903
+ type: "CallExpression",
5904
+ children: [
5905
+ parenthesizeExpression(awaitExpression),
5906
+ {
5907
+ type: "PropertyGlob",
5908
+ dot,
5909
+ object,
5910
+ children: [ws1, dot, object],
5911
+ reversed: true
5912
+ }
5913
+ ]
5914
+ });
5915
+ }
5916
+ default: {
5917
+ throw new Error("Unsupported dynamic import");
5918
+ }
5919
+ }
5827
5920
  }
5828
5921
  function convertWithClause(withClause, extendsClause) {
5829
5922
  let extendsToken, extendsTarget, ws;
@@ -6123,7 +6216,7 @@ function processPipelineExpressions(statements) {
6123
6216
  const children = [ws];
6124
6217
  const comma = blockContainingStatement(s) ? ";" : ",";
6125
6218
  let usingRef = null;
6126
- for (let i2 = 0, len1 = body.length; i2 < len1; i2++) {
6219
+ for (let i2 = 0, len12 = body.length; i2 < len12; i2++) {
6127
6220
  const i = i2;
6128
6221
  const step = body[i2];
6129
6222
  const [leadingComment, pipe, trailingComment, expr] = step;
@@ -6915,7 +7008,7 @@ function dedentBlockSubstitutions($0, tab) {
6915
7008
  }
6916
7009
  const stringPart = (() => {
6917
7010
  const results1 = [];
6918
- for (let i2 = 0, len1 = strWithSubstitutions.length; i2 < len1; i2++) {
7011
+ for (let i2 = 0, len12 = strWithSubstitutions.length; i2 < len12; i2++) {
6919
7012
  const part = strWithSubstitutions[i2];
6920
7013
  results1.push(part.token ?? "s");
6921
7014
  }
@@ -7005,6 +7098,9 @@ function quoteString(str) {
7005
7098
 
7006
7099
  // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\lib.civet.jsx
7007
7100
  var xor = (a, b) => a ? !b && a : b;
7101
+ function len1(arr, length) {
7102
+ return arr.length === length;
7103
+ }
7008
7104
  function addPostfixStatement(statement, ws, post) {
7009
7105
  const expressions = [
7010
7106
  ...post.blockPrefix || [],
@@ -7382,7 +7478,7 @@ function processCallMemberExpression(node) {
7382
7478
  isComma(args[args.length - 1]).token = "";
7383
7479
  }
7384
7480
  let commaCount = 0;
7385
- for (let i2 = 0, len1 = args.length; i2 < len1; i2++) {
7481
+ for (let i2 = 0, len22 = args.length; i2 < len22; i2++) {
7386
7482
  const i = i2;
7387
7483
  let arg = args[i2];
7388
7484
  if (isComma(arg)) {
@@ -7412,19 +7508,22 @@ function processCallMemberExpression(node) {
7412
7508
  }
7413
7509
  }
7414
7510
  }
7415
- for (let i3 = 0, len22 = children.length; i3 < len22; i3++) {
7511
+ for (let i3 = 0, len3 = children.length; i3 < len3; i3++) {
7416
7512
  const i = i3;
7417
7513
  const glob = children[i3];
7418
7514
  if (glob?.type === "PropertyGlob") {
7419
7515
  let prefix = children.slice(0, i);
7420
7516
  const parts = [];
7421
7517
  let ref;
7422
- if (prefix.length > 1 && glob.object.properties.length > 1) {
7518
+ if (needsRef(prefix) && glob.object.properties.length > 1) {
7519
+ if (Array.isArray(prefix) && len1(prefix, 1) && typeof prefix[0] === "object" && prefix[0] != null && "type" in prefix[0] && prefix[0].type === "ParenthesizedExpression" && "implicit" in prefix[0] && prefix[0].implicit === true) {
7520
+ prefix = [prefix[0].expression];
7521
+ }
7423
7522
  ref = makeRef();
7424
7523
  const { refAssignment } = makeRefAssignment(ref, prefix);
7425
7524
  prefix = [makeLeftHandSideExpression(refAssignment)];
7426
7525
  }
7427
- prefix = prefix.concat(glob.dot);
7526
+ let prefixDot = [...prefix, glob.dot];
7428
7527
  for (const part of glob.object.properties) {
7429
7528
  if (part.type === "Error") {
7430
7529
  parts.push(part);
@@ -7437,7 +7536,7 @@ function processCallMemberExpression(node) {
7437
7536
  });
7438
7537
  continue;
7439
7538
  }
7440
- if (part.value && !["CallExpression", "MemberExpression", "Identifier"].includes(part.value.type)) {
7539
+ if (part.value && !["CallExpression", "MemberExpression", "Identifier", "StringLiteral", "ComputedPropertyName"].includes(part.value.type)) {
7441
7540
  parts.push({
7442
7541
  type: "Error",
7443
7542
  message: `Glob pattern must have call or member expression value, found ${JSON.stringify(part.value)}`
@@ -7453,9 +7552,28 @@ function processCallMemberExpression(node) {
7453
7552
  [name, value] = [value, name];
7454
7553
  }
7455
7554
  if (!suppressPrefix) {
7456
- value = prefix.concat(trimFirstSpace(value));
7555
+ if (value.type === "StringLiteral") {
7556
+ value = [
7557
+ ...prefix,
7558
+ {
7559
+ type: "Index",
7560
+ children: ["[", trimFirstSpace(value), "]"]
7561
+ }
7562
+ ];
7563
+ } else if (value.type === "ComputedPropertyName") {
7564
+ value = [
7565
+ ...prefix,
7566
+ {
7567
+ type: "Index",
7568
+ children: [trimFirstSpace(value)]
7569
+ }
7570
+ ];
7571
+ } else {
7572
+ value = [...prefixDot, trimFirstSpace(value)];
7573
+ }
7457
7574
  if (ref != null) {
7458
- prefix = [ref].concat(glob.dot);
7575
+ prefix = [ref];
7576
+ prefixDot = [...prefix, glob.dot];
7459
7577
  }
7460
7578
  }
7461
7579
  if (wValue) value.unshift(wValue);
@@ -7858,7 +7976,7 @@ function processBindingPatternLHS(lhs, tail) {
7858
7976
  );
7859
7977
  }
7860
7978
  function processAssignments(statements) {
7861
- for (let ref8 = gatherRecursiveAll(statements, ($4) => $4.type === "AssignmentExpression" || $4.type === "UpdateExpression"), i5 = 0, len3 = ref8.length; i5 < len3; i5++) {
7979
+ for (let ref8 = gatherRecursiveAll(statements, ($4) => $4.type === "AssignmentExpression" || $4.type === "UpdateExpression"), i5 = 0, len4 = ref8.length; i5 < len4; i5++) {
7862
7980
  let extractAssignment = function(lhs) {
7863
7981
  let expr = lhs;
7864
7982
  while (expr.type === "ParenthesizedExpression") {
@@ -7887,7 +8005,7 @@ function processAssignments(statements) {
7887
8005
  if (!exp.lhs) {
7888
8006
  continue;
7889
8007
  }
7890
- for (let ref10 = exp.lhs, i6 = 0, len4 = ref10.length; i6 < len4; i6++) {
8008
+ for (let ref10 = exp.lhs, i6 = 0, len5 = ref10.length; i6 < len5; i6++) {
7891
8009
  const lhsPart = ref10[i6];
7892
8010
  let ref11;
7893
8011
  if (ref11 = extractAssignment(lhsPart[1])) {
@@ -7932,7 +8050,7 @@ function processAssignments(statements) {
7932
8050
  }
7933
8051
  }
7934
8052
  }
7935
- for (let ref12 = gatherRecursiveAll(statements, ($6) => $6.type === "AssignmentExpression"), i7 = 0, len5 = ref12.length; i7 < len5; i7++) {
8053
+ for (let ref12 = gatherRecursiveAll(statements, ($6) => $6.type === "AssignmentExpression"), i7 = 0, len6 = ref12.length; i7 < len6; i7++) {
7936
8054
  const exp = ref12[i7];
7937
8055
  if (!(exp.names === null)) {
7938
8056
  continue;
@@ -8003,7 +8121,7 @@ function processAssignments(statements) {
8003
8121
  c[1] = start;
8004
8122
  c[2] = ", ";
8005
8123
  if (end) {
8006
- c[3] = [end, " - ", start];
8124
+ c[3] = [makeLeftHandSideExpression(end), " - ", makeLeftHandSideExpression(start)];
8007
8125
  } else {
8008
8126
  c[3] = ["1/0"];
8009
8127
  }
@@ -8166,7 +8284,7 @@ function attachPostfixStatementAsExpression(exp, post) {
8166
8284
  }
8167
8285
  function processTypes(node) {
8168
8286
  const results1 = [];
8169
- for (let ref16 = gatherRecursiveAll(node, ($11) => $11.type === "TypeUnary"), i8 = 0, len6 = ref16.length; i8 < len6; i8++) {
8287
+ for (let ref16 = gatherRecursiveAll(node, ($11) => $11.type === "TypeUnary"), i8 = 0, len7 = ref16.length; i8 < len7; i8++) {
8170
8288
  const unary = ref16[i8];
8171
8289
  let suffixIndex = unary.suffix.length - 1;
8172
8290
  const results2 = [];
@@ -8294,7 +8412,7 @@ function processTypes(node) {
8294
8412
  return results1;
8295
8413
  }
8296
8414
  function processStatementExpressions(statements) {
8297
- for (let ref18 = gatherRecursiveAll(statements, ($12) => $12.type === "StatementExpression"), i9 = 0, len7 = ref18.length; i9 < len7; i9++) {
8415
+ for (let ref18 = gatherRecursiveAll(statements, ($12) => $12.type === "StatementExpression"), i9 = 0, len8 = ref18.length; i9 < len8; i9++) {
8298
8416
  const exp = ref18[i9];
8299
8417
  const { maybe, statement } = exp;
8300
8418
  if ((maybe || statement.type === "ThrowStatement") && blockContainingStatement(exp)) {
@@ -8364,7 +8482,7 @@ function processNegativeIndexAccess(statements) {
8364
8482
  });
8365
8483
  }
8366
8484
  function processFinallyClauses(statements) {
8367
- for (let ref20 = gatherRecursiveAll(statements, ($) => $.type === "FinallyClause" && $.parent?.type !== "TryStatement"), i10 = 0, len8 = ref20.length; i10 < len8; i10++) {
8485
+ for (let ref20 = gatherRecursiveAll(statements, ($) => $.type === "FinallyClause" && $.parent?.type !== "TryStatement"), i10 = 0, len9 = ref20.length; i10 < len9; i10++) {
8368
8486
  let f = ref20[i10];
8369
8487
  let ref21;
8370
8488
  if (!((ref21 = blockContainingStatement(f)) && typeof ref21 === "object" && "block" in ref21 && "index" in ref21)) {
@@ -8442,7 +8560,7 @@ function processBreaksContinues(statements) {
8442
8560
  }
8443
8561
  }
8444
8562
  function processCoffeeClasses(statements) {
8445
- for (let ref22 = gatherRecursiveAll(statements, ($13) => $13.type === "ClassExpression"), i11 = 0, len9 = ref22.length; i11 < len9; i11++) {
8563
+ for (let ref22 = gatherRecursiveAll(statements, ($13) => $13.type === "ClassExpression"), i11 = 0, len10 = ref22.length; i11 < len10; i11++) {
8446
8564
  const ce = ref22[i11];
8447
8565
  const { expressions } = ce.body;
8448
8566
  const indent = expressions[0]?.[0] ?? "\n";
@@ -8487,7 +8605,7 @@ function processCoffeeClasses(statements) {
8487
8605
  0,
8488
8606
  ...(() => {
8489
8607
  const results3 = [];
8490
- for (let i12 = 0, len10 = autoBinds.length; i12 < len10; i12++) {
8608
+ for (let i12 = 0, len11 = autoBinds.length; i12 < len11; i12++) {
8491
8609
  const [, a] = autoBinds[i12];
8492
8610
  results3.push([indent, ["this.", a.name, " = this.", a.name, ".bind(this)"], ";"]);
8493
8611
  }
@@ -8603,7 +8721,7 @@ async function processProgramAsync(root) {
8603
8721
  function processRepl(root, rootIIFE) {
8604
8722
  const topBlock = gatherRecursive(rootIIFE, ($21) => $21.type === "BlockStatement")[0];
8605
8723
  let i = 0;
8606
- for (let ref23 = gatherRecursiveWithinFunction(topBlock, ($22) => $22.type === "Declaration"), i14 = 0, len11 = ref23.length; i14 < len11; i14++) {
8724
+ for (let ref23 = gatherRecursiveWithinFunction(topBlock, ($22) => $22.type === "Declaration"), i14 = 0, len12 = ref23.length; i14 < len12; i14++) {
8607
8725
  const decl = ref23[i14];
8608
8726
  if (!decl.names?.length) {
8609
8727
  continue;
@@ -8617,7 +8735,7 @@ function processRepl(root, rootIIFE) {
8617
8735
  root.expressions.splice(i++, 0, ["", `var ${decl.names.join(",")}`, ";"]);
8618
8736
  }
8619
8737
  }
8620
- for (let ref24 = gatherRecursive(topBlock, ($23) => $23.type === "FunctionExpression"), i15 = 0, len12 = ref24.length; i15 < len12; i15++) {
8738
+ for (let ref24 = gatherRecursive(topBlock, ($23) => $23.type === "FunctionExpression"), i15 = 0, len13 = ref24.length; i15 < len13; i15++) {
8621
8739
  const func = ref24[i15];
8622
8740
  if (func.name && func.parent?.type === "BlockStatement") {
8623
8741
  if (func.parent === topBlock) {
@@ -8630,7 +8748,7 @@ function processRepl(root, rootIIFE) {
8630
8748
  }
8631
8749
  }
8632
8750
  }
8633
- for (let ref25 = gatherRecursiveWithinFunction(topBlock, ($24) => $24.type === "ClassExpression"), i16 = 0, len13 = ref25.length; i16 < len13; i16++) {
8751
+ for (let ref25 = gatherRecursiveWithinFunction(topBlock, ($24) => $24.type === "ClassExpression"), i16 = 0, len14 = ref25.length; i16 < len14; i16++) {
8634
8752
  const classExp = ref25[i16];
8635
8753
  let m8;
8636
8754
  if (classExp.name && classExp.parent === topBlock || (m8 = classExp.parent, typeof m8 === "object" && m8 != null && "type" in m8 && m8.type === "ReturnStatement" && "parent" in m8 && m8.parent === topBlock)) {
@@ -8642,7 +8760,7 @@ function processRepl(root, rootIIFE) {
8642
8760
  function processPlaceholders(statements) {
8643
8761
  const placeholderMap = /* @__PURE__ */ new Map();
8644
8762
  const liftedIfs = /* @__PURE__ */ new Set();
8645
- for (let ref26 = gatherRecursiveAll(statements, ($25) => $25.type === "Placeholder"), i17 = 0, len14 = ref26.length; i17 < len14; i17++) {
8763
+ for (let ref26 = gatherRecursiveAll(statements, ($25) => $25.type === "Placeholder"), i17 = 0, len15 = ref26.length; i17 < len15; i17++) {
8646
8764
  const exp = ref26[i17];
8647
8765
  let ancestor;
8648
8766
  if (exp.subtype === ".") {
@@ -8752,7 +8870,7 @@ function processPlaceholders(statements) {
8752
8870
  for (const [ancestor, placeholders] of placeholderMap) {
8753
8871
  let ref = makeRef("$");
8754
8872
  let typeSuffix;
8755
- for (let i18 = 0, len15 = placeholders.length; i18 < len15; i18++) {
8873
+ for (let i18 = 0, len16 = placeholders.length; i18 < len16; i18++) {
8756
8874
  const placeholder = placeholders[i18];
8757
8875
  typeSuffix ??= placeholder.typeSuffix;
8758
8876
  let ref27;
@@ -8866,10 +8984,12 @@ function reorderBindingRestProperty(props) {
8866
8984
  }
8867
8985
  function typeOfJSX(node, config2) {
8868
8986
  switch (node.type) {
8869
- case "JSXElement":
8987
+ case "JSXElement": {
8870
8988
  return typeOfJSXElement(node, config2);
8871
- case "JSXFragment":
8989
+ }
8990
+ case "JSXFragment": {
8872
8991
  return typeOfJSXFragment(node, config2);
8992
+ }
8873
8993
  }
8874
8994
  }
8875
8995
  function typeOfJSXElement(node, config2) {
@@ -8877,7 +8997,7 @@ function typeOfJSXElement(node, config2) {
8877
8997
  if (config2.server && !config2.client) {
8878
8998
  return ["string"];
8879
8999
  }
8880
- let { tag } = node;
9000
+ const { tag } = node;
8881
9001
  const clientType = tag[0] === tag[0].toLowerCase() ? [getHelperRef("IntrinsicElements"), '<"', tag, '">'] : ["ReturnType<typeof ", tag, ">"];
8882
9002
  if (config2.server) {
8883
9003
  return ["string", " | ", clientType];
@@ -8892,33 +9012,40 @@ function typeOfJSXFragment(node, config2) {
8892
9012
  if (config2.solid) {
8893
9013
  let type = [];
8894
9014
  let lastType;
8895
- for (let child of node.jsxChildren) {
9015
+ for (const child of node.jsxChildren) {
8896
9016
  switch (child.type) {
8897
- case "JSXText":
8898
- if (lastType !== "JSXText") {
9017
+ case "JSXText": {
9018
+ if (!(lastType === "JSXText")) {
8899
9019
  type.push("string");
8900
9020
  }
9021
+ ;
8901
9022
  break;
8902
- case "JSXElement":
9023
+ }
9024
+ case "JSXElement": {
8903
9025
  type.push(typeOfJSXElement(child, config2));
8904
9026
  break;
8905
- case "JSXFragment":
9027
+ }
9028
+ case "JSXFragment": {
8906
9029
  type.push(...typeOfJSXFragment(child, config2));
8907
9030
  break;
8908
- case "JSXChildExpression":
9031
+ }
9032
+ case "JSXChildExpression": {
8909
9033
  if (child.expression) {
8910
9034
  type.push(["typeof ", child.expression]);
8911
9035
  }
9036
+ ;
8912
9037
  break;
8913
- default:
9038
+ }
9039
+ default: {
8914
9040
  throw new Error(`unknown child in JSXFragment: ${JSON.stringify(child)}`);
9041
+ }
8915
9042
  }
8916
9043
  lastType = child.type;
8917
9044
  }
8918
9045
  if (type.length === 1) {
8919
9046
  return type[0];
8920
9047
  } else {
8921
- type = type.flatMap((t) => [t, ", "]);
9048
+ type = type.flatMap(($26) => [$26, ", "]);
8922
9049
  type.pop();
8923
9050
  return ["[", type, "]"];
8924
9051
  }
@@ -9143,6 +9270,8 @@ var grammar = {
9143
9270
  NonSingleBracedBlock,
9144
9271
  DeclarationOrStatement,
9145
9272
  SingleLineStatements,
9273
+ ObjectSingleLineStatements,
9274
+ BracedObjectSingleLineStatements,
9146
9275
  PostfixedSingleLineStatements,
9147
9276
  PostfixedSingleLineNoCommaStatements,
9148
9277
  NestedBlockStatements,
@@ -9323,6 +9452,10 @@ var grammar = {
9323
9452
  ForbidNewlineBinaryOp,
9324
9453
  RestoreNewlineBinaryOp,
9325
9454
  NewlineBinaryOpAllowed,
9455
+ AllowImplicitFragment,
9456
+ ForbidImplicitFragment,
9457
+ RestoreImplicitFragment,
9458
+ ImplicitFragmentAllowed,
9326
9459
  AllowPipeline,
9327
9460
  ForbidPipeline,
9328
9461
  RestorePipeline,
@@ -9348,11 +9481,15 @@ var grammar = {
9348
9481
  NameSpaceImport,
9349
9482
  NamedImports,
9350
9483
  OperatorNamedImports,
9484
+ DynamicNamedImports,
9485
+ DynamicImportContents,
9351
9486
  FromClause,
9352
9487
  ImportAssertion,
9353
9488
  TypeAndImportSpecifier,
9354
9489
  ImportSpecifier,
9355
9490
  OperatorImportSpecifier,
9491
+ DynamicImportSpecifier,
9492
+ DynamicModuleExportName,
9356
9493
  ImportAsToken,
9357
9494
  ModuleExportName,
9358
9495
  ModuleSpecifier,
@@ -10630,7 +10767,11 @@ function SingleLineBinaryOpRHS(ctx, state2) {
10630
10767
  return (0, import_lib2.$EVENT)(ctx, state2, "SingleLineBinaryOpRHS", SingleLineBinaryOpRHS$0);
10631
10768
  }
10632
10769
  var RHS$0 = ExpressionizedStatementWithTrailingCallExpressions;
10633
- var RHS$1 = UnaryExpression;
10770
+ var RHS$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(ForbidImplicitFragment, (0, import_lib2.$E)(UnaryExpression), RestoreImplicitFragment), function($skip, $loc, $0, $1, $2, $3) {
10771
+ var exp = $2;
10772
+ if (!exp) return $skip;
10773
+ return exp;
10774
+ });
10634
10775
  var RHS$$ = [RHS$0, RHS$1];
10635
10776
  function RHS(ctx, state2) {
10636
10777
  return (0, import_lib2.$EVENT_C)(ctx, state2, "RHS", RHS$$);
@@ -10964,8 +11105,9 @@ var FatArrowBody$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$N
10964
11105
  implicitlyReturned: true
10965
11106
  };
10966
11107
  });
10967
- var FatArrowBody$1 = NoCommaBracedOrEmptyBlock;
10968
- var FatArrowBody$$ = [FatArrowBody$0, FatArrowBody$1];
11108
+ var FatArrowBody$1 = BracedObjectSingleLineStatements;
11109
+ var FatArrowBody$2 = NoCommaBracedOrEmptyBlock;
11110
+ var FatArrowBody$$ = [FatArrowBody$0, FatArrowBody$1, FatArrowBody$2];
10969
11111
  function FatArrowBody(ctx, state2) {
10970
11112
  return (0, import_lib2.$EVENT_C)(ctx, state2, "FatArrowBody", FatArrowBody$$);
10971
11113
  }
@@ -11676,10 +11818,10 @@ var CallExpression$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Super, Arguments
11676
11818
  children: [$1, ...$2, ...rest.flat()]
11677
11819
  });
11678
11820
  });
11679
- var CallExpression$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(Import, _, NamedImports, __, FromClause), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
11821
+ var CallExpression$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(Import, _, DynamicImportContents, __, FromClause), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
11680
11822
  return dynamizeImportDeclarationExpression($0);
11681
11823
  });
11682
- var CallExpression$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(FromClause, __, Import, _, NamedImports), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
11824
+ var CallExpression$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(FromClause, __, Import, _, DynamicImportContents), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
11683
11825
  var from = $1;
11684
11826
  var fws = $2;
11685
11827
  var i = $3;
@@ -13120,7 +13262,7 @@ var OperatorAssociativity$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, impor
13120
13262
  function OperatorAssociativity(ctx, state2) {
13121
13263
  return (0, import_lib2.$EVENT)(ctx, state2, "OperatorAssociativity", OperatorAssociativity$0);
13122
13264
  }
13123
- var ThinArrowFunction$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)((0, import_lib2.$S)(Async, _)), ArrowParameters, (0, import_lib2.$E)(ReturnTypeSuffix), (0, import_lib2.$E)(_), Arrow, NoCommaBracedOrEmptyBlock), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
13265
+ var ThinArrowFunction$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)((0, import_lib2.$S)(Async, _)), ArrowParameters, (0, import_lib2.$E)(ReturnTypeSuffix), (0, import_lib2.$E)(_), Arrow, (0, import_lib2.$C)(BracedObjectSingleLineStatements, NoCommaBracedOrEmptyBlock)), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
13124
13266
  var async = $1;
13125
13267
  var parameters = $2;
13126
13268
  var returnType = $3;
@@ -13274,8 +13416,9 @@ var ThenBlock$0 = (0, import_lib2.$T)((0, import_lib2.$S)(NoBlock, EmptyBlock),
13274
13416
  return value[1];
13275
13417
  });
13276
13418
  var ThenBlock$1 = ImplicitNestedBlock;
13277
- var ThenBlock$2 = SingleLineStatements;
13278
- var ThenBlock$$ = [ThenBlock$0, ThenBlock$1, ThenBlock$2];
13419
+ var ThenBlock$2 = ObjectSingleLineStatements;
13420
+ var ThenBlock$3 = SingleLineStatements;
13421
+ var ThenBlock$$ = [ThenBlock$0, ThenBlock$1, ThenBlock$2, ThenBlock$3];
13279
13422
  function ThenBlock(ctx, state2) {
13280
13423
  return (0, import_lib2.$EVENT_C)(ctx, state2, "ThenBlock", ThenBlock$$);
13281
13424
  }
@@ -13334,11 +13477,12 @@ var BlockOrEmptyStatement$$ = [BlockOrEmptyStatement$0, BlockOrEmptyStatement$1]
13334
13477
  function BlockOrEmptyStatement(ctx, state2) {
13335
13478
  return (0, import_lib2.$EVENT_C)(ctx, state2, "BlockOrEmptyStatement", BlockOrEmptyStatement$$);
13336
13479
  }
13337
- var BlockOrEmpty$0 = Block;
13338
- var BlockOrEmpty$1 = (0, import_lib2.$T)((0, import_lib2.$S)(NoBlock, EmptyBlock), function(value) {
13480
+ var BlockOrEmpty$0 = ObjectSingleLineStatements;
13481
+ var BlockOrEmpty$1 = Block;
13482
+ var BlockOrEmpty$2 = (0, import_lib2.$T)((0, import_lib2.$S)(NoBlock, EmptyBlock), function(value) {
13339
13483
  return value[1];
13340
13484
  });
13341
- var BlockOrEmpty$$ = [BlockOrEmpty$0, BlockOrEmpty$1];
13485
+ var BlockOrEmpty$$ = [BlockOrEmpty$0, BlockOrEmpty$1, BlockOrEmpty$2];
13342
13486
  function BlockOrEmpty(ctx, state2) {
13343
13487
  return (0, import_lib2.$EVENT_C)(ctx, state2, "BlockOrEmpty", BlockOrEmpty$$);
13344
13488
  }
@@ -13474,6 +13618,26 @@ var SingleLineStatements$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(ForbidNewl
13474
13618
  function SingleLineStatements(ctx, state2) {
13475
13619
  return (0, import_lib2.$EVENT)(ctx, state2, "SingleLineStatements", SingleLineStatements$0);
13476
13620
  }
13621
+ var ObjectSingleLineStatements$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$Y)((0, import_lib2.$S)((0, import_lib2.$E)(_), BracedObjectLiteral)), SingleLineStatements), function($skip, $loc, $0, $1, $2) {
13622
+ var block = $2;
13623
+ if (block.bare && block.expressions.length === 1) {
13624
+ const expression = block.expressions[0][1];
13625
+ if (expression.type === "ParenthesizedExpression" && expression.implicit && expression.expression.type === "ObjectExpression") {
13626
+ block = { ...block, unwrapObject: true };
13627
+ }
13628
+ }
13629
+ return block;
13630
+ });
13631
+ function ObjectSingleLineStatements(ctx, state2) {
13632
+ return (0, import_lib2.$EVENT)(ctx, state2, "ObjectSingleLineStatements", ObjectSingleLineStatements$0);
13633
+ }
13634
+ var BracedObjectSingleLineStatements$0 = (0, import_lib2.$TV)(ObjectSingleLineStatements, function($skip, $loc, $0, $1) {
13635
+ var block = $0;
13636
+ return bracedBlock(block);
13637
+ });
13638
+ function BracedObjectSingleLineStatements(ctx, state2) {
13639
+ return (0, import_lib2.$EVENT)(ctx, state2, "BracedObjectSingleLineStatements", BracedObjectSingleLineStatements$0);
13640
+ }
13477
13641
  var PostfixedSingleLineStatements$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$Q)((0, import_lib2.$S)((0, import_lib2.$S)((0, import_lib2.$E)(_), (0, import_lib2.$N)(EOS)), StatementListItem, SemicolonDelimiter)), (0, import_lib2.$E)((0, import_lib2.$S)((0, import_lib2.$S)((0, import_lib2.$E)(_), (0, import_lib2.$N)(EOS)), StatementListItem, (0, import_lib2.$E)(SemicolonDelimiter)))), function($skip, $loc, $0, $1, $2) {
13478
13642
  var stmts = $1;
13479
13643
  var last = $2;
@@ -14324,7 +14488,8 @@ var PropertyDefinition$2 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_l
14324
14488
  children: [ws, id],
14325
14489
  name: id,
14326
14490
  names: id.names,
14327
- value: id
14491
+ value: id,
14492
+ implicitName: true
14328
14493
  };
14329
14494
  });
14330
14495
  var PropertyDefinition$3 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(_), MethodDefinition), function($skip, $loc, $0, $1, $2) {
@@ -14383,7 +14548,8 @@ var PropertyDefinition$5 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_l
14383
14548
  if (refAssignment) {
14384
14549
  name = {
14385
14550
  type: "ComputedPropertyName",
14386
- children: [last.children[0], "(", refAssignment, ",", ref, ")", ...last.children.slice(-2)]
14551
+ children: [last.children[0], "(", refAssignment, ",", ref, ")", ...last.children.slice(-2)],
14552
+ implicit: true
14387
14553
  };
14388
14554
  value = {
14389
14555
  ...value,
@@ -14398,7 +14564,8 @@ var PropertyDefinition$5 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_l
14398
14564
  } else {
14399
14565
  name = {
14400
14566
  type: "ComputedPropertyName",
14401
- children: last.children
14567
+ children: last.children,
14568
+ implicit: true
14402
14569
  };
14403
14570
  }
14404
14571
  } else {
@@ -14411,7 +14578,8 @@ var PropertyDefinition$5 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_l
14411
14578
  children: [ws, name, ": ", processUnaryExpression(pre, value, post)],
14412
14579
  name,
14413
14580
  names: [],
14414
- value
14581
+ value,
14582
+ implicitName: true
14415
14583
  };
14416
14584
  });
14417
14585
  var PropertyDefinition$$ = [PropertyDefinition$0, PropertyDefinition$1, PropertyDefinition$2, PropertyDefinition$3, PropertyDefinition$4, PropertyDefinition$5];
@@ -14614,6 +14782,7 @@ function MethodDefinition(ctx, state2) {
14614
14782
  var MethodModifier$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(GetOrSet, (0, import_lib2.$E)(_), (0, import_lib2.$Y)(ClassElementName)), function($skip, $loc, $0, $1, $2, $3) {
14615
14783
  var kind = $1;
14616
14784
  var ws = $2;
14785
+ if (!ws) ws = " ";
14617
14786
  return {
14618
14787
  // no async or generator, because getters and setters can't be
14619
14788
  modifier: {
@@ -15331,7 +15500,7 @@ function ShouldExpressionize(ctx, state2) {
15331
15500
  var NoCommaStatement$0 = KeywordStatement;
15332
15501
  var NoCommaStatement$1 = VariableStatement;
15333
15502
  var NoCommaStatement$2 = IfStatement;
15334
- var NoCommaStatement$3 = IterationStatement;
15503
+ var NoCommaStatement$3 = IterationActualStatement;
15335
15504
  var NoCommaStatement$4 = SwitchStatement;
15336
15505
  var NoCommaStatement$5 = TryStatement;
15337
15506
  var NoCommaStatement$6 = EmptyStatement;
@@ -16363,8 +16532,8 @@ var SingleLineExpressionWithIndentedApplicationForbidden$0 = (0, import_lib2.$TS
16363
16532
  function SingleLineExpressionWithIndentedApplicationForbidden(ctx, state2) {
16364
16533
  return (0, import_lib2.$EVENT)(ctx, state2, "SingleLineExpressionWithIndentedApplicationForbidden", SingleLineExpressionWithIndentedApplicationForbidden$0);
16365
16534
  }
16366
- var ExpressionWithObjectApplicationForbidden$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(ForbidBracedApplication, ForbidIndentedApplication, (0, import_lib2.$E)(Expression), RestoreBracedApplication, RestoreIndentedApplication), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
16367
- var exp = $3;
16535
+ var ExpressionWithObjectApplicationForbidden$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(ForbidBracedApplication, ForbidIndentedApplication, ForbidImplicitFragment, (0, import_lib2.$E)(Expression), RestoreBracedApplication, RestoreIndentedApplication, RestoreImplicitFragment), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7) {
16536
+ var exp = $4;
16368
16537
  if (exp) return exp;
16369
16538
  return $skip;
16370
16539
  });
@@ -16541,6 +16710,33 @@ var NewlineBinaryOpAllowed$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0
16541
16710
  function NewlineBinaryOpAllowed(ctx, state2) {
16542
16711
  return (0, import_lib2.$EVENT)(ctx, state2, "NewlineBinaryOpAllowed", NewlineBinaryOpAllowed$0);
16543
16712
  }
16713
+ var AllowImplicitFragment$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'AllowImplicitFragment ""'), function($skip, $loc, $0, $1) {
16714
+ state.forbidImplicitFragment.push(false);
16715
+ });
16716
+ function AllowImplicitFragment(ctx, state2) {
16717
+ return (0, import_lib2.$EVENT)(ctx, state2, "AllowImplicitFragment", AllowImplicitFragment$0);
16718
+ }
16719
+ var ForbidImplicitFragment$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'ForbidImplicitFragment ""'), function($skip, $loc, $0, $1) {
16720
+ state.forbidImplicitFragment.push(true);
16721
+ });
16722
+ function ForbidImplicitFragment(ctx, state2) {
16723
+ return (0, import_lib2.$EVENT)(ctx, state2, "ForbidImplicitFragment", ForbidImplicitFragment$0);
16724
+ }
16725
+ var RestoreImplicitFragment$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'RestoreImplicitFragment ""'), function($skip, $loc, $0, $1) {
16726
+ state.forbidImplicitFragment.pop();
16727
+ });
16728
+ function RestoreImplicitFragment(ctx, state2) {
16729
+ return (0, import_lib2.$EVENT)(ctx, state2, "RestoreImplicitFragment", RestoreImplicitFragment$0);
16730
+ }
16731
+ var ImplicitFragmentAllowed$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'ImplicitFragmentAllowed ""'), function($skip, $loc, $0, $1) {
16732
+ if (config.verbose) {
16733
+ console.log("forbidImplicitFragment:", state.forbidImplicitFragment);
16734
+ }
16735
+ if (state.implicitFragmentForbidden) return $skip;
16736
+ });
16737
+ function ImplicitFragmentAllowed(ctx, state2) {
16738
+ return (0, import_lib2.$EVENT)(ctx, state2, "ImplicitFragmentAllowed", ImplicitFragmentAllowed$0);
16739
+ }
16544
16740
  var AllowPipeline$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'AllowPipeline ""'), function($skip, $loc, $0, $1) {
16545
16741
  state.forbidPipeline.push(false);
16546
16742
  });
@@ -16568,11 +16764,11 @@ var PipelineAllowed$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'Pipe
16568
16764
  function PipelineAllowed(ctx, state2) {
16569
16765
  return (0, import_lib2.$EVENT)(ctx, state2, "PipelineAllowed", PipelineAllowed$0);
16570
16766
  }
16571
- var AllowAll$0 = (0, import_lib2.$S)(AllowTrailingMemberProperty, AllowBracedApplication, AllowIndentedApplication, AllowClassImplicitCall, AllowNestedBinaryOp, AllowNewlineBinaryOp, AllowPipeline);
16767
+ var AllowAll$0 = (0, import_lib2.$S)(AllowTrailingMemberProperty, AllowBracedApplication, AllowIndentedApplication, AllowClassImplicitCall, AllowNestedBinaryOp, AllowNewlineBinaryOp, AllowImplicitFragment, AllowPipeline);
16572
16768
  function AllowAll(ctx, state2) {
16573
16769
  return (0, import_lib2.$EVENT)(ctx, state2, "AllowAll", AllowAll$0);
16574
16770
  }
16575
- var RestoreAll$0 = (0, import_lib2.$S)(RestoreTrailingMemberProperty, RestoreBracedApplication, RestoreIndentedApplication, RestoreClassImplicitCall, RestoreNestedBinaryOp, RestoreNewlineBinaryOp, RestorePipeline);
16771
+ var RestoreAll$0 = (0, import_lib2.$S)(RestoreTrailingMemberProperty, RestoreBracedApplication, RestoreIndentedApplication, RestoreClassImplicitCall, RestoreNestedBinaryOp, RestoreNewlineBinaryOp, RestoreImplicitFragment, RestorePipeline);
16576
16772
  function RestoreAll(ctx, state2) {
16577
16773
  return (0, import_lib2.$EVENT)(ctx, state2, "RestoreAll", RestoreAll$0);
16578
16774
  }
@@ -16675,7 +16871,11 @@ var MaybeNestedNonPipelineExpression$0 = (0, import_lib2.$TS)((0, import_lib2.$S
16675
16871
  if (!trailing) return expression;
16676
16872
  return [expression, trailing];
16677
16873
  });
16678
- var MaybeNestedNonPipelineExpression$1 = NonPipelineExpression;
16874
+ var MaybeNestedNonPipelineExpression$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(ForbidImplicitFragment, (0, import_lib2.$E)(NonPipelineExpression), RestoreImplicitFragment), function($skip, $loc, $0, $1, $2, $3) {
16875
+ var expression = $2;
16876
+ if (!expression) return $skip;
16877
+ return expression;
16878
+ });
16679
16879
  var MaybeNestedNonPipelineExpression$$ = [MaybeNestedNonPipelineExpression$0, MaybeNestedNonPipelineExpression$1];
16680
16880
  function MaybeNestedNonPipelineExpression(ctx, state2) {
16681
16881
  return (0, import_lib2.$EVENT_C)(ctx, state2, "MaybeNestedNonPipelineExpression", MaybeNestedNonPipelineExpression$$);
@@ -16687,7 +16887,11 @@ var MaybeNestedPostfixedExpression$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(
16687
16887
  if (!trailing) return expression;
16688
16888
  return [expression, trailing];
16689
16889
  });
16690
- var MaybeNestedPostfixedExpression$1 = PostfixedExpression;
16890
+ var MaybeNestedPostfixedExpression$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(ForbidImplicitFragment, (0, import_lib2.$E)(PostfixedExpression), RestoreImplicitFragment), function($skip, $loc, $0, $1, $2, $3) {
16891
+ var expression = $2;
16892
+ if (!expression) return $skip;
16893
+ return expression;
16894
+ });
16691
16895
  var MaybeNestedPostfixedExpression$$ = [MaybeNestedPostfixedExpression$0, MaybeNestedPostfixedExpression$1];
16692
16896
  function MaybeNestedPostfixedExpression(ctx, state2) {
16693
16897
  return (0, import_lib2.$EVENT_C)(ctx, state2, "MaybeNestedPostfixedExpression", MaybeNestedPostfixedExpression$$);
@@ -16710,7 +16914,11 @@ var MaybeNestedExpression$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, impor
16710
16914
  if (!trailing) return expression;
16711
16915
  return [expression, trailing];
16712
16916
  });
16713
- var MaybeNestedExpression$1 = Expression;
16917
+ var MaybeNestedExpression$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(ForbidImplicitFragment, (0, import_lib2.$E)(Expression), RestoreImplicitFragment), function($skip, $loc, $0, $1, $2, $3) {
16918
+ var expression = $2;
16919
+ if (!expression) return $skip;
16920
+ return expression;
16921
+ });
16714
16922
  var MaybeNestedExpression$$ = [MaybeNestedExpression$0, MaybeNestedExpression$1];
16715
16923
  function MaybeNestedExpression(ctx, state2) {
16716
16924
  return (0, import_lib2.$EVENT_C)(ctx, state2, "MaybeNestedExpression", MaybeNestedExpression$$);
@@ -16905,6 +17113,24 @@ var OperatorNamedImports$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(OpenBrace,
16905
17113
  function OperatorNamedImports(ctx, state2) {
16906
17114
  return (0, import_lib2.$EVENT)(ctx, state2, "OperatorNamedImports", OperatorNamedImports$0);
16907
17115
  }
17116
+ var DynamicNamedImports$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(OpenBrace, (0, import_lib2.$Q)(DynamicImportSpecifier), (0, import_lib2.$E)((0, import_lib2.$S)(__, Comma)), __, CloseBrace), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
17117
+ var specifiers = $2;
17118
+ return {
17119
+ type: "Declaration",
17120
+ children: $0,
17121
+ specifiers
17122
+ };
17123
+ });
17124
+ function DynamicNamedImports(ctx, state2) {
17125
+ return (0, import_lib2.$EVENT)(ctx, state2, "DynamicNamedImports", DynamicNamedImports$0);
17126
+ }
17127
+ var DynamicImportContents$0 = DynamicNamedImports;
17128
+ var DynamicImportContents$1 = IdentifierName;
17129
+ var DynamicImportContents$2 = Star;
17130
+ var DynamicImportContents$$ = [DynamicImportContents$0, DynamicImportContents$1, DynamicImportContents$2];
17131
+ function DynamicImportContents(ctx, state2) {
17132
+ return (0, import_lib2.$EVENT_C)(ctx, state2, "DynamicImportContents", DynamicImportContents$$);
17133
+ }
16908
17134
  var FromClause$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(From, __, ModuleSpecifier), function($skip, $loc, $0, $1, $2, $3) {
16909
17135
  var module = $3;
16910
17136
  if (!Array.isArray(module)) return $0;
@@ -16926,11 +17152,11 @@ var ImportAssertion$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2
16926
17152
  function ImportAssertion(ctx, state2) {
16927
17153
  return (0, import_lib2.$EVENT)(ctx, state2, "ImportAssertion", ImportAssertion$0);
16928
17154
  }
16929
- var TypeAndImportSpecifier$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)((0, import_lib2.$S)(__, TypeKeyword)), ImportSpecifier), function($skip, $loc, $0, $1, $2) {
16930
- if (!$1) return $2;
16931
- return { ts: true, children: $0, binding: $2.binding };
17155
+ var TypeAndImportSpecifier$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(__, TypeKeyword, ImportSpecifier), function($skip, $loc, $0, $1, $2, $3) {
17156
+ return { ts: true, children: $0, binding: $3.binding };
16932
17157
  });
16933
- var TypeAndImportSpecifier$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(__, Operator, OperatorImportSpecifier), function($skip, $loc, $0, $1, $2, $3) {
17158
+ var TypeAndImportSpecifier$1 = ImportSpecifier;
17159
+ var TypeAndImportSpecifier$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(__, Operator, OperatorImportSpecifier), function($skip, $loc, $0, $1, $2, $3) {
16934
17160
  var ws = $1;
16935
17161
  var spec = $3;
16936
17162
  if (spec.binding.type !== "Identifier") {
@@ -16946,7 +17172,7 @@ var TypeAndImportSpecifier$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(__, Oper
16946
17172
  ]
16947
17173
  };
16948
17174
  });
16949
- var TypeAndImportSpecifier$$ = [TypeAndImportSpecifier$0, TypeAndImportSpecifier$1];
17175
+ var TypeAndImportSpecifier$$ = [TypeAndImportSpecifier$0, TypeAndImportSpecifier$1, TypeAndImportSpecifier$2];
16950
17176
  function TypeAndImportSpecifier(ctx, state2) {
16951
17177
  return (0, import_lib2.$EVENT_C)(ctx, state2, "TypeAndImportSpecifier", TypeAndImportSpecifier$$);
16952
17178
  }
@@ -16993,6 +17219,27 @@ var OperatorImportSpecifier$$ = [OperatorImportSpecifier$0, OperatorImportSpecif
16993
17219
  function OperatorImportSpecifier(ctx, state2) {
16994
17220
  return (0, import_lib2.$EVENT_C)(ctx, state2, "OperatorImportSpecifier", OperatorImportSpecifier$$);
16995
17221
  }
17222
+ var DynamicImportSpecifier$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(__, (0, import_lib2.$E)((0, import_lib2.$S)(TypeKeyword, __, (0, import_lib2.$Y)(DynamicModuleExportName))), DynamicModuleExportName, (0, import_lib2.$E)((0, import_lib2.$S)(ImportAsToken, __, DynamicModuleExportName)), ObjectPropertyDelimiter), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
17223
+ var ts2 = $2;
17224
+ var source = $3;
17225
+ var binding = $4;
17226
+ return {
17227
+ source,
17228
+ binding: binding?.[2],
17229
+ ts: !!ts2,
17230
+ // true causes an error later
17231
+ children: $0
17232
+ };
17233
+ });
17234
+ function DynamicImportSpecifier(ctx, state2) {
17235
+ return (0, import_lib2.$EVENT)(ctx, state2, "DynamicImportSpecifier", DynamicImportSpecifier$0);
17236
+ }
17237
+ var DynamicModuleExportName$0 = ModuleExportName;
17238
+ var DynamicModuleExportName$1 = ComputedPropertyName;
17239
+ var DynamicModuleExportName$$ = [DynamicModuleExportName$0, DynamicModuleExportName$1];
17240
+ function DynamicModuleExportName(ctx, state2) {
17241
+ return (0, import_lib2.$EVENT_C)(ctx, state2, "DynamicModuleExportName", DynamicModuleExportName$$);
17242
+ }
16996
17243
  var ImportAsToken$0 = (0, import_lib2.$S)(__, As);
16997
17244
  var ImportAsToken$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(Loc, __, Colon, (0, import_lib2.$E)((0, import_lib2.$EXPECT)($L17, 'ImportAsToken " "'))), function($skip, $loc, $0, $1, $2, $3, $4) {
16998
17245
  var l = $1;
@@ -18284,7 +18531,7 @@ function SingleQuote(ctx, state2) {
18284
18531
  return (0, import_lib2.$EVENT)(ctx, state2, "SingleQuote", SingleQuote$0);
18285
18532
  }
18286
18533
  var Star$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L75, 'Star "*"'), function($skip, $loc, $0, $1) {
18287
- return { $loc, token: $1 };
18534
+ return { $loc, token: $1, type: "Star" };
18288
18535
  });
18289
18536
  function Star(ctx, state2) {
18290
18537
  return (0, import_lib2.$EVENT)(ctx, state2, "Star", Star$0);
@@ -18437,18 +18684,22 @@ var Yield$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$EXPECT)(
18437
18684
  function Yield(ctx, state2) {
18438
18685
  return (0, import_lib2.$EVENT)(ctx, state2, "Yield", Yield$0);
18439
18686
  }
18440
- var JSXImplicitFragment$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(JSXTag, (0, import_lib2.$Q)((0, import_lib2.$S)(Nested, (0, import_lib2.$C)(JSXTag, JSXAngleChild)))), function($skip, $loc, $0, $1, $2) {
18441
- const jsx = $2.length === 0 ? $1 : {
18687
+ var JSXImplicitFragment$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(JSXTag, (0, import_lib2.$E)((0, import_lib2.$S)(ImplicitFragmentAllowed, NestedBinaryOpAllowed, NewlineBinaryOpAllowed, (0, import_lib2.$Q)((0, import_lib2.$S)(Nested, (0, import_lib2.$C)(JSXTag, JSXAngleChild)))))), function($skip, $loc, $0, $1, $2) {
18688
+ var first = $1;
18689
+ var rest = $2;
18690
+ rest = rest ? rest[3] : [];
18691
+ const jsx = rest.length === 0 ? first : {
18442
18692
  type: "JSXFragment",
18443
18693
  children: [
18444
18694
  "<>\n",
18445
18695
  state.currentIndent.token,
18446
- ...$0,
18696
+ first,
18697
+ ...rest,
18447
18698
  "\n",
18448
18699
  state.currentIndent.token,
18449
18700
  "</>"
18450
18701
  ],
18451
- jsxChildren: [$1].concat($2.map(([, tag]) => tag))
18702
+ jsxChildren: [first, ...rest.map(([, tag]) => tag)]
18452
18703
  };
18453
18704
  const type = typeOfJSX(jsx, config);
18454
18705
  return type ? [
@@ -19183,13 +19434,7 @@ var JSXAngleChild$0 = (0, import_lib2.$T)((0, import_lib2.$S)(CloseAngleBracket,
19183
19434
  function JSXAngleChild(ctx, state2) {
19184
19435
  return (0, import_lib2.$EVENT)(ctx, state2, "JSXAngleChild", JSXAngleChild$0);
19185
19436
  }
19186
- var JSXCodeChild$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(InsertInlineOpenBrace, JSXCodeChildExpression, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3) {
19187
- var open = $1;
19188
- var expression = $2;
19189
- var close = $3;
19190
- if (!expression) return $skip;
19191
- return [open, expression, close];
19192
- });
19437
+ var JSXCodeChild$0 = (0, import_lib2.$S)(InsertInlineOpenBrace, JSXCodeChildExpression, InsertCloseBrace);
19193
19438
  function JSXCodeChild(ctx, state2) {
19194
19439
  return (0, import_lib2.$EVENT)(ctx, state2, "JSXCodeChild", JSXCodeChild$0);
19195
19440
  }
@@ -20853,6 +21098,7 @@ var Reset$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'Reset ""'), fu
20853
21098
  state.forbidTrailingMemberProperty = [false];
20854
21099
  state.forbidNestedBinaryOp = [false];
20855
21100
  state.forbidNewlineBinaryOp = [false];
21101
+ state.forbidImplicitFragment = [false];
20856
21102
  state.forbidPipeline = [false];
20857
21103
  state.JSXTagStack = [void 0];
20858
21104
  state.operators = /* @__PURE__ */ new Map();
@@ -21134,6 +21380,7 @@ var state = {
21134
21380
  forbidTrailingMemberProperty: [false],
21135
21381
  forbidNestedBinaryOp: [false],
21136
21382
  forbidNewlineBinaryOp: [false],
21383
+ forbidImplicitFragment: [false],
21137
21384
  forbidPipeline: [false],
21138
21385
  JSXTagStack: [void 0]
21139
21386
  };
@@ -21185,6 +21432,12 @@ Object.defineProperties(state, {
21185
21432
  return s[s.length - 1];
21186
21433
  }
21187
21434
  },
21435
+ implicitFragmentForbidden: {
21436
+ get() {
21437
+ const { forbidImplicitFragment: s } = state;
21438
+ return s[s.length - 1];
21439
+ }
21440
+ },
21188
21441
  pipelineForbidden: {
21189
21442
  get() {
21190
21443
  const { forbidPipeline: s } = state;
@@ -21207,7 +21460,7 @@ function setOperatorBehavior(name, behavior) {
21207
21460
  }
21208
21461
  }
21209
21462
  function getStateKey() {
21210
- const stateInt = state.currentIndent.level % 256 << 8 | state.classImplicitCallForbidden << 7 | state.indentedApplicationForbidden << 6 | state.bracedApplicationForbidden << 5 | state.trailingMemberPropertyForbidden << 4 | state.nestedBinaryOpForbidden << 3 | state.newlineBinaryOpForbidden << 2 | state.pipelineForbidden << 1 | // This is slightly different than the rest of the state,
21463
+ const stateInt = state.currentIndent.level % 256 << 9 | state.classImplicitCallForbidden << 8 | state.indentedApplicationForbidden << 7 | state.bracedApplicationForbidden << 6 | state.trailingMemberPropertyForbidden << 5 | state.nestedBinaryOpForbidden << 4 | state.newlineBinaryOpForbidden << 3 | state.implicitFragmentForbidden << 2 | state.pipelineForbidden << 1 | // This is slightly different than the rest of the state,
21211
21464
  // since it is affected by the directive prologue and may be hit
21212
21465
  // by the EOL rule early in the parse. Later if we wanted to
21213
21466
  // allow block scoping of the compat directives we would need to
@@ -21307,7 +21560,7 @@ var SourceMap = class {
21307
21560
  const line = ref1[i1];
21308
21561
  results.push((() => {
21309
21562
  const results1 = [];
21310
- for (let i2 = 0, len1 = line.length; i2 < len1; i2++) {
21563
+ for (let i2 = 0, len12 = line.length; i2 < len12; i2++) {
21311
21564
  const entry = line[i2];
21312
21565
  if (entry.length === 4) {
21313
21566
  let [colDelta, sourceFileIndex, srcLine, srcCol] = entry;
@@ -21653,10 +21906,11 @@ var WorkerPool = class {
21653
21906
  }
21654
21907
  })();
21655
21908
  const worker = new Worker(path.join(__dirname, "node-worker.mjs"));
21656
- worker.on("message", (response) => {
21909
+ worker.on("message", async (response) => {
21657
21910
  const callback = this.callbacks.get(response.id);
21658
21911
  this.callbacks.delete(response.id);
21659
21912
  if (response.error) {
21913
+ await new Promise((done) => setTimeout(done, 0));
21660
21914
  const message = `${response.error.name}: ${response.error.message}`;
21661
21915
  let ref;
21662
21916
  if (response.error.type in globalThis) {