@danielx/civet 0.11.6 → 0.11.7

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
@@ -30,9 +30,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
30
30
  ));
31
31
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
32
32
 
33
- // node_modules/.pnpm/@danielx+hera@0.8.19/node_modules/@danielx/hera/dist/machine.js
33
+ // node_modules/.pnpm/@danielx+hera@0.8.20/node_modules/@danielx/hera/dist/machine.js
34
34
  var require_machine = __commonJS({
35
- "node_modules/.pnpm/@danielx+hera@0.8.19/node_modules/@danielx/hera/dist/machine.js"(exports2, module2) {
35
+ "node_modules/.pnpm/@danielx+hera@0.8.20/node_modules/@danielx/hera/dist/machine.js"(exports2, module2) {
36
36
  "use strict";
37
37
  var __defProp2 = Object.defineProperty;
38
38
  var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
@@ -561,6 +561,7 @@ __export(lib_exports, {
561
561
  maybeRefAssignment: () => maybeRefAssignment,
562
562
  modifyString: () => modifyString,
563
563
  negateCondition: () => negateCondition,
564
+ parenthesizeExpression: () => parenthesizeExpression,
564
565
  precedenceCustomDefault: () => precedenceCustomDefault,
565
566
  precedenceStep: () => precedenceStep,
566
567
  prepend: () => prepend,
@@ -586,6 +587,7 @@ __export(lib_exports, {
586
587
  stripTrailingImplicitComma: () => stripTrailingImplicitComma,
587
588
  trimFirstSpace: () => trimFirstSpace,
588
589
  typeOfJSX: () => typeOfJSX,
590
+ typeSuffixForExpression: () => typeSuffixForExpression,
589
591
  wrapIIFE: () => wrapIIFE,
590
592
  wrapTypeInPromise: () => wrapTypeInPromise
591
593
  });
@@ -1845,7 +1847,14 @@ function populateRefs(statements) {
1845
1847
  name = `${base}${n}`;
1846
1848
  }
1847
1849
  names.add(name);
1848
- ref.children = ref.names = [name];
1850
+ if (ref.$loc) {
1851
+ const loc = ref.$loc;
1852
+ delete ref.$loc;
1853
+ ref.children = [{ $loc: loc, token: name }];
1854
+ ref.names = [name];
1855
+ } else {
1856
+ ref.children = ref.names = [name];
1857
+ }
1849
1858
  }
1850
1859
  }
1851
1860
 
@@ -1858,7 +1867,16 @@ function adjustAtBindings(statements, asThis = false) {
1858
1867
  const atBinding = binding.binding;
1859
1868
  atBinding.children.pop();
1860
1869
  atBinding.type = void 0;
1861
- binding.children.splice(1, 0, ref.id, ": this.", ref.base);
1870
+ const atLoc = atBinding.at?.$loc;
1871
+ let ref2;
1872
+ if (atLoc) {
1873
+ ref2 = { $loc: atLoc, token: "this." };
1874
+ } else {
1875
+ ref2 = "this.";
1876
+ }
1877
+ ;
1878
+ const thisNode = ref2;
1879
+ binding.children.splice(1, 0, ref.id, ": ", thisNode, ref.base);
1862
1880
  binding.type = "Property";
1863
1881
  binding.ref = void 0;
1864
1882
  } else {
@@ -1928,8 +1946,8 @@ function adjustBindingElements(elements) {
1928
1946
  };
1929
1947
  }
1930
1948
  function gatherSubbindings(node, subbindings = []) {
1931
- for (let ref2 = gatherRecursiveAll(node, ($) => $.subbinding != null), i3 = 0, len22 = ref2.length; i3 < len22; i3++) {
1932
- const p = ref2[i3];
1949
+ for (let ref3 = gatherRecursiveAll(node, ($) => $.subbinding != null), i3 = 0, len22 = ref3.length; i3 < len22; i3++) {
1950
+ const p = ref3[i3];
1933
1951
  const { subbinding } = p;
1934
1952
  subbindings.push(", ", subbinding);
1935
1953
  gatherSubbindings(subbinding, subbindings);
@@ -1938,8 +1956,8 @@ function gatherSubbindings(node, subbindings = []) {
1938
1956
  }
1939
1957
  function simplifyBindingProperties(node) {
1940
1958
  const results = [];
1941
- for (let ref3 = gatherRecursiveAll(node, ($3) => $3.type === "BindingProperty"), i4 = 0, len3 = ref3.length; i4 < len3; i4++) {
1942
- const p = ref3[i4];
1959
+ for (let ref4 = gatherRecursiveAll(node, ($3) => $3.type === "BindingProperty"), i4 = 0, len3 = ref4.length; i4 < len3; i4++) {
1960
+ const p = ref4[i4];
1943
1961
  const { name, value } = p;
1944
1962
  if (value?.type === "NamedBindingPattern" && value.binding === name) {
1945
1963
  const [ws] = p.children;
@@ -1956,15 +1974,26 @@ function gatherBindingCode(statements, opts) {
1956
1974
  const splices = [];
1957
1975
  function insertRestSplices(s, p, thisAssignments2) {
1958
1976
  let m;
1959
- for (let ref4 = gatherRecursiveAll(
1977
+ for (let ref5 = gatherRecursiveAll(
1960
1978
  s,
1961
1979
  (n) => n.blockPrefix || opts?.injectParamProps && n.accessModifier || n.type === "AtBinding" || opts?.assignPins && (m = n.type, m === "PinPattern" || m === "PinProperty")
1962
- ), i5 = 0, len4 = ref4.length; i5 < len4; i5++) {
1963
- let n = ref4[i5];
1980
+ ), i5 = 0, len4 = ref5.length; i5 < len4; i5++) {
1981
+ let n = ref5[i5];
1964
1982
  if (n.type === "AtBinding") {
1965
- const { ref } = n;
1983
+ const { ref, at } = n;
1966
1984
  const { id } = ref;
1967
- thisAssignments2.push([`this.${id} = `, ref]);
1985
+ const atLoc = at?.$loc;
1986
+ if (atLoc) {
1987
+ ref.$loc = { pos: atLoc.pos + 1, length: id.length };
1988
+ thisAssignments2.push([
1989
+ { $loc: atLoc, token: "this." },
1990
+ { $loc: ref.$loc, token: id },
1991
+ " = ",
1992
+ ref
1993
+ ]);
1994
+ } else {
1995
+ thisAssignments2.push([`this.${id} = `, ref]);
1996
+ }
1968
1997
  continue;
1969
1998
  }
1970
1999
  if (opts?.assignPins) {
@@ -1991,8 +2020,8 @@ function gatherBindingCode(statements, opts) {
1991
2020
  }
1992
2021
  }
1993
2022
  if (opts?.injectParamProps && n.type === "Parameter" && n.accessModifier) {
1994
- for (let ref5 = n.names, i6 = 0, len5 = ref5.length; i6 < len5; i6++) {
1995
- const id = ref5[i6];
2023
+ for (let ref6 = n.names, i6 = 0, len5 = ref6.length; i6 < len5; i6++) {
2024
+ const id = ref6[i6];
1996
2025
  thisAssignments2.push({
1997
2026
  type: "AssignmentExpression",
1998
2027
  children: [`this.${id} = `, id],
@@ -2010,8 +2039,8 @@ function gatherBindingCode(statements, opts) {
2010
2039
  return [splices, thisAssignments];
2011
2040
  }
2012
2041
  function arrayElementHasTrailingComma(elementNode) {
2013
- let ref6;
2014
- const lastChild = (ref6 = elementNode.children)[ref6.length - 1];
2042
+ let ref7;
2043
+ const lastChild = (ref7 = elementNode.children)[ref7.length - 1];
2015
2044
  return lastChild && lastChild[lastChild.length - 1]?.token === ",";
2016
2045
  }
2017
2046
  function gatherBindingPatternTypeSuffix(pattern) {
@@ -2023,8 +2052,8 @@ function gatherBindingPatternTypeSuffix(pattern) {
2023
2052
  case "ArrayBindingPattern": {
2024
2053
  {
2025
2054
  const results1 = [];
2026
- for (let ref7 = pattern.elements, i7 = 0, len6 = ref7.length; i7 < len6; i7++) {
2027
- const elem = ref7[i7];
2055
+ for (let ref8 = pattern.elements, i7 = 0, len6 = ref8.length; i7 < len6; i7++) {
2056
+ const elem = ref8[i7];
2028
2057
  let { typeSuffix, initializer } = elem;
2029
2058
  typeSuffix ??= elem.binding?.typeSuffix;
2030
2059
  if (typeSuffix) {
@@ -2065,8 +2094,8 @@ function gatherBindingPatternTypeSuffix(pattern) {
2065
2094
  {
2066
2095
  let restType;
2067
2096
  const results2 = [];
2068
- for (let ref8 = pattern.properties, i8 = 0, len7 = ref8.length; i8 < len7; i8++) {
2069
- const prop = ref8[i8];
2097
+ for (let ref9 = pattern.properties, i8 = 0, len7 = ref9.length; i8 < len7; i8++) {
2098
+ const prop = ref9[i8];
2070
2099
  let { typeSuffix, initializer } = prop;
2071
2100
  typeSuffix ??= prop.value?.typeSuffix;
2072
2101
  if (typeSuffix) {
@@ -2084,7 +2113,8 @@ function gatherBindingPatternTypeSuffix(pattern) {
2084
2113
  typeSuffix.children.unshift(typeSuffix.optional = "?");
2085
2114
  }
2086
2115
  switch (prop.type) {
2087
- case "BindingProperty": {
2116
+ case "BindingProperty":
2117
+ case "PinProperty": {
2088
2118
  const ws = prop.children.slice(0, prop.children.indexOf(prop.name));
2089
2119
  results2.push([...ws, prop.name, typeSuffix, prop.delim]);
2090
2120
  break;
@@ -2677,8 +2707,9 @@ function serialize(value, context) {
2677
2707
  if (typeof val === "string") {
2678
2708
  return JSON.stringify(val);
2679
2709
  } else if (typeof val === "number") {
2680
- if (Object.is(-0, val)) return "-0";
2681
- else return val.toString();
2710
+ if (Object.is(-0, val)) {
2711
+ return "-0";
2712
+ } else return val.toString();
2682
2713
  } else if (typeof val === "boolean" || val == null) {
2683
2714
  return String(val);
2684
2715
  } else if (typeof val === "bigint") {
@@ -2938,7 +2969,14 @@ function implicitFunctionBlock(f) {
2938
2969
  if (followingOverloads(f).length) {
2939
2970
  f.ts = true;
2940
2971
  } else {
2941
- const block = makeEmptyBlock();
2972
+ let ref1;
2973
+ const lastChild = (ref1 = f.parameters?.children)?.[ref1.length - 1];
2974
+ let ref2;
2975
+ if (Array.isArray(lastChild)) {
2976
+ ref2 = lastChild[lastChild.length - 1];
2977
+ } else ref2 = lastChild;
2978
+ const closeParen = ref2;
2979
+ const block = makeEmptyBlock(closeParen?.$loc);
2942
2980
  block.parent = f;
2943
2981
  f.block = block;
2944
2982
  f.children.push(block);
@@ -3104,10 +3142,10 @@ function processReturnValue(func) {
3104
3142
  r.expression = ref;
3105
3143
  return r.children.splice(-1, 1, " ", ref);
3106
3144
  });
3107
- let ref1;
3108
- if (!((ref1 = block.children)[ref1.length - 2]?.type === "ReturnStatement")) {
3109
- let ref2;
3110
- const indent = getIndent((ref2 = block.expressions)[ref2.length - 1]);
3145
+ let ref3;
3146
+ if (!((ref3 = block.children)[ref3.length - 2]?.type === "ReturnStatement")) {
3147
+ let ref4;
3148
+ const indent = getIndent((ref4 = block.expressions)[ref4.length - 1]);
3111
3149
  block.expressions.push([
3112
3150
  indent,
3113
3151
  wrapWithReturn(ref, block, !indent)
@@ -3184,16 +3222,16 @@ function patternBindings(pattern) {
3184
3222
  function recurse(pattern2) {
3185
3223
  switch (pattern2.type) {
3186
3224
  case "ArrayBindingPattern": {
3187
- for (let ref3 = pattern2.elements, i2 = 0, len12 = ref3.length; i2 < len12; i2++) {
3188
- const element = ref3[i2];
3225
+ for (let ref5 = pattern2.elements, i2 = 0, len12 = ref5.length; i2 < len12; i2++) {
3226
+ const element = ref5[i2];
3189
3227
  recurse(element);
3190
3228
  }
3191
3229
  ;
3192
3230
  break;
3193
3231
  }
3194
3232
  case "ObjectBindingPattern": {
3195
- for (let ref4 = pattern2.properties, i3 = 0, len22 = ref4.length; i3 < len22; i3++) {
3196
- const property = ref4[i3];
3233
+ for (let ref6 = pattern2.properties, i3 = 0, len22 = ref6.length; i3 < len22; i3++) {
3234
+ const property = ref6[i3];
3197
3235
  recurse(property);
3198
3236
  }
3199
3237
  ;
@@ -3224,8 +3262,8 @@ function assignResults(node, collect) {
3224
3262
  switch (node.type) {
3225
3263
  case "BlockStatement": {
3226
3264
  if (node.expressions.length) {
3227
- let ref5;
3228
- assignResults((ref5 = node.expressions)[ref5.length - 1], collect);
3265
+ let ref7;
3266
+ assignResults((ref7 = node.expressions)[ref7.length - 1], collect);
3229
3267
  } else {
3230
3268
  node.expressions.push(["", collect("void 0"), ";"]);
3231
3269
  updateParentPointers(node);
@@ -3233,8 +3271,8 @@ function assignResults(node, collect) {
3233
3271
  return;
3234
3272
  }
3235
3273
  case "CaseBlock": {
3236
- for (let ref6 = node.clauses, i4 = 0, len3 = ref6.length; i4 < len3; i4++) {
3237
- const clause = ref6[i4];
3274
+ for (let ref8 = node.clauses, i4 = 0, len3 = ref8.length; i4 < len3; i4++) {
3275
+ const clause = ref8[i4];
3238
3276
  assignResults(clause, collect);
3239
3277
  }
3240
3278
  return;
@@ -3264,8 +3302,7 @@ function assignResults(node, collect) {
3264
3302
  if (exp.type === "LabelledStatement") {
3265
3303
  exp = exp.statement;
3266
3304
  }
3267
- let ref7;
3268
- let ref8;
3305
+ let ref9;
3269
3306
  let m1;
3270
3307
  switch (exp.type) {
3271
3308
  case "BreakStatement":
@@ -3277,20 +3314,23 @@ function assignResults(node, collect) {
3277
3314
  return;
3278
3315
  }
3279
3316
  case "Declaration": {
3280
- let ref9;
3281
- if (exp.bindings?.length) {
3282
- ref9 = patternAsValue((ref7 = exp.bindings)[ref7.length - 1].pattern);
3283
- } else {
3284
- ref9 = "void 0";
3317
+ {
3318
+ let ref10;
3319
+ if (exp.bindings?.length) {
3320
+ let ref11;
3321
+ ref10 = patternAsValue((ref11 = exp.bindings)[ref11.length - 1].pattern);
3322
+ } else {
3323
+ ref10 = "void 0";
3324
+ }
3325
+ ;
3326
+ const value = ref10;
3327
+ exp.children.push([
3328
+ "",
3329
+ [";", collect(value)]
3330
+ ]);
3331
+ updateParentPointers(exp);
3332
+ return;
3285
3333
  }
3286
- ;
3287
- const value = ref9;
3288
- exp.children.push([
3289
- "",
3290
- [";", collect(value)]
3291
- ]);
3292
- updateParentPointers(exp);
3293
- return;
3294
3334
  }
3295
3335
  case "FunctionExpression": {
3296
3336
  if (exp.id) {
@@ -3314,7 +3354,7 @@ function assignResults(node, collect) {
3314
3354
  if (exp.expressions.some(isExit)) {
3315
3355
  return;
3316
3356
  }
3317
- assignResults((ref8 = exp.expressions)[ref8.length - 1], collect);
3357
+ assignResults((ref9 = exp.expressions)[ref9.length - 1], collect);
3318
3358
  return;
3319
3359
  }
3320
3360
  case "IfStatement": {
@@ -3333,15 +3373,15 @@ function assignResults(node, collect) {
3333
3373
  return;
3334
3374
  }
3335
3375
  case "SwitchStatement": {
3336
- for (let ref10 = exp.caseBlock.clauses, i5 = 0, len4 = ref10.length; i5 < len4; i5++) {
3337
- const clause = ref10[i5];
3376
+ for (let ref12 = exp.caseBlock.clauses, i5 = 0, len4 = ref12.length; i5 < len4; i5++) {
3377
+ const clause = ref12[i5];
3338
3378
  assignResults(clause, collect);
3339
3379
  }
3340
3380
  return;
3341
3381
  }
3342
3382
  case "TryStatement": {
3343
- for (let ref11 = exp.blocks, i6 = 0, len5 = ref11.length; i6 < len5; i6++) {
3344
- const block = ref11[i6];
3383
+ for (let ref13 = exp.blocks, i6 = 0, len5 = ref13.length; i6 < len5; i6++) {
3384
+ const block = ref13[i6];
3345
3385
  assignResults(block, collect);
3346
3386
  }
3347
3387
  return;
@@ -3398,9 +3438,9 @@ function insertReturn(node) {
3398
3438
  insertReturn(node.block);
3399
3439
  if (!isExit(node.block)) {
3400
3440
  const comment = hasTrailingComment(node.block.expressions);
3401
- let ref12;
3441
+ let ref14;
3402
3442
  node.block.expressions.push([
3403
- comment ? (ref12 = node.block.expressions)[ref12.length - 1][0] || "\n" : "",
3443
+ comment ? (ref14 = node.block.expressions)[ref14.length - 1][0] || "\n" : "",
3404
3444
  wrapWithReturn(void 0, node, !comment)
3405
3445
  ]);
3406
3446
  }
@@ -3426,7 +3466,6 @@ function insertReturn(node) {
3426
3466
  if (exp.type === "LabelledStatement") {
3427
3467
  exp = exp.statement;
3428
3468
  }
3429
- let ref13;
3430
3469
  let m3;
3431
3470
  switch (exp.type) {
3432
3471
  case "BreakStatement":
@@ -3438,32 +3477,35 @@ function insertReturn(node) {
3438
3477
  return;
3439
3478
  }
3440
3479
  case "Declaration": {
3441
- let ref14;
3442
- if (exp.bindings?.length) {
3443
- ref14 = [" ", patternAsValue((ref13 = exp.bindings)[ref13.length - 1].pattern)];
3444
- } else {
3445
- ref14 = [];
3446
- }
3447
- ;
3448
- const value = ref14;
3449
- const parent = outer.parent;
3450
- const index = findChildIndex(parent?.expressions, outer);
3451
- assert.notEqual(index, -1, "Could not find declaration in parent");
3452
- parent.expressions.splice(index + 1, 0, [
3453
- "",
3454
- {
3455
- type: "ReturnStatement",
3456
- expression: value,
3457
- children: [
3458
- !(parent.expressions[index][2] === ";") ? ";" : void 0,
3459
- "return",
3460
- value
3461
- ],
3462
- parent: exp
3480
+ {
3481
+ let ref15;
3482
+ if (exp.bindings?.length) {
3483
+ let ref16;
3484
+ ref15 = [" ", patternAsValue((ref16 = exp.bindings)[ref16.length - 1].pattern)];
3485
+ } else {
3486
+ ref15 = [];
3463
3487
  }
3464
- ]);
3465
- braceBlock(parent);
3466
- return;
3488
+ ;
3489
+ const value = ref15;
3490
+ const parent = outer.parent;
3491
+ const index = findChildIndex(parent?.expressions, outer);
3492
+ assert.notEqual(index, -1, "Could not find declaration in parent");
3493
+ parent.expressions.splice(index + 1, 0, [
3494
+ "",
3495
+ {
3496
+ type: "ReturnStatement",
3497
+ expression: value,
3498
+ children: [
3499
+ !(parent.expressions[index][2] === ";") ? ";" : void 0,
3500
+ "return",
3501
+ value
3502
+ ],
3503
+ parent: exp
3504
+ }
3505
+ ]);
3506
+ braceBlock(parent);
3507
+ return;
3508
+ }
3467
3509
  }
3468
3510
  case "FunctionExpression": {
3469
3511
  if (exp.id) {
@@ -3492,8 +3534,9 @@ function insertReturn(node) {
3492
3534
  }
3493
3535
  case "IfStatement": {
3494
3536
  insertReturn(exp.then);
3495
- if (exp.else) insertReturn(exp.else.block);
3496
- else exp.children.push([
3537
+ if (exp.else) {
3538
+ insertReturn(exp.else.block);
3539
+ } else exp.children.push([
3497
3540
  "",
3498
3541
  // NOTE: add a prefixed semicolon because the if block may not be braced
3499
3542
  wrapWithReturn(void 0, exp, true)
@@ -3505,15 +3548,15 @@ function insertReturn(node) {
3505
3548
  return;
3506
3549
  }
3507
3550
  case "SwitchStatement": {
3508
- for (let ref15 = exp.caseBlock.clauses, i7 = 0, len6 = ref15.length; i7 < len6; i7++) {
3509
- const clause = ref15[i7];
3551
+ for (let ref17 = exp.caseBlock.clauses, i7 = 0, len6 = ref17.length; i7 < len6; i7++) {
3552
+ const clause = ref17[i7];
3510
3553
  insertReturn(clause);
3511
3554
  }
3512
3555
  return;
3513
3556
  }
3514
3557
  case "TryStatement": {
3515
- for (let ref16 = exp.blocks, i8 = 0, len7 = ref16.length; i8 < len7; i8++) {
3516
- const block = ref16[i8];
3558
+ for (let ref18 = exp.blocks, i8 = 0, len7 = ref18.length; i8 < len7; i8++) {
3559
+ const block = ref18[i8];
3517
3560
  insertReturn(block);
3518
3561
  }
3519
3562
  return;
@@ -3765,9 +3808,9 @@ function iterationDefaultBody(statement) {
3765
3808
  }
3766
3809
  const reduction = statement.type === "ForStatement" && statement.reduction;
3767
3810
  function fillBlock(expression) {
3768
- let ref17;
3811
+ let ref19;
3769
3812
  let m5;
3770
- if (m5 = (ref17 = block.expressions)[ref17.length - 1], Array.isArray(m5) && m5.length >= 2 && typeof m5[1] === "object" && m5[1] != null && "type" in m5[1] && m5[1].type === "EmptyStatement" && "implicit" in m5[1] && m5[1].implicit === true) {
3813
+ if (m5 = (ref19 = block.expressions)[ref19.length - 1], Array.isArray(m5) && m5.length >= 2 && typeof m5[1] === "object" && m5[1] != null && "type" in m5[1] && m5[1].type === "EmptyStatement" && "implicit" in m5[1] && m5[1].implicit === true) {
3771
3814
  block.expressions.pop();
3772
3815
  }
3773
3816
  block.expressions.push(expression);
@@ -3837,8 +3880,8 @@ function processParams(f) {
3837
3880
  function append2(p) {
3838
3881
  (rest ? after : before).push(p);
3839
3882
  }
3840
- for (let ref18 = parameters.parameters, i9 = 0, len8 = ref18.length; i9 < len8; i9++) {
3841
- const param = ref18[i9];
3883
+ for (let ref20 = parameters.parameters, i9 = 0, len8 = ref20.length; i9 < len8; i9++) {
3884
+ const param = ref20[i9];
3842
3885
  switch (param.type) {
3843
3886
  case "ThisType": {
3844
3887
  if (tt) {
@@ -3850,8 +3893,8 @@ function processParams(f) {
3850
3893
  } else {
3851
3894
  tt = trimFirstSpace(param);
3852
3895
  if (before.length || rest) {
3853
- let ref19;
3854
- let delim = (ref19 = tt.children)[ref19.length - 1];
3896
+ let ref21;
3897
+ let delim = (ref21 = tt.children)[ref21.length - 1];
3855
3898
  if (Array.isArray(delim)) {
3856
3899
  delim = delim[delim.length - 1];
3857
3900
  }
@@ -4041,14 +4084,14 @@ function processParams(f) {
4041
4084
  assert.notEqual(index2, -1, "Could not find constructor in class");
4042
4085
  index2 -= precedingOverloads(f).length;
4043
4086
  const fStatement = classExpressions[index2];
4044
- for (let ref20 = gatherRecursive(parameters, ($14) => $14.type === "Parameter"), i10 = 0, len9 = ref20.length; i10 < len9; i10++) {
4045
- const parameter = ref20[i10];
4087
+ for (let ref22 = gatherRecursive(parameters, ($14) => $14.type === "Parameter"), i10 = 0, len9 = ref22.length; i10 < len9; i10++) {
4088
+ const parameter = ref22[i10];
4046
4089
  const { accessModifier } = parameter;
4047
4090
  if (!(accessModifier || parameter.typeSuffix)) {
4048
4091
  continue;
4049
4092
  }
4050
- for (let ref21 = gatherRecursive(parameter, ($15) => $15.type === "AtBinding"), i11 = 0, len10 = ref21.length; i11 < len10; i11++) {
4051
- const binding = ref21[i11];
4093
+ for (let ref23 = gatherRecursive(parameter, ($15) => $15.type === "AtBinding"), i11 = 0, len10 = ref23.length; i11 < len10; i11++) {
4094
+ const binding = ref23[i11];
4052
4095
  const typeSuffix = binding.parent?.typeSuffix;
4053
4096
  if (!(accessModifier || typeSuffix)) {
4054
4097
  continue;
@@ -4086,8 +4129,8 @@ function processParams(f) {
4086
4129
  decl: "const"
4087
4130
  }));
4088
4131
  }
4089
- for (let ref22 = splices, i12 = 0, len11 = ref22.length; i12 < len11; i12++) {
4090
- const binding = ref22[i12];
4132
+ for (let ref24 = splices, i12 = 0, len11 = ref24.length; i12 < len11; i12++) {
4133
+ const binding = ref24[i12];
4091
4134
  assert.equal(binding.type, "PostRestBindingElements", "splice should be of type Binding");
4092
4135
  prefix.push(makeNode({
4093
4136
  type: "Declaration",
@@ -4140,8 +4183,8 @@ function processSignature(f) {
4140
4183
  if (f.async != null) {
4141
4184
  addAsync = true;
4142
4185
  } else {
4143
- for (let ref23 = gatherRecursiveWithinFunction(block, ($17) => $17.type === "Await"), i13 = 0, len12 = ref23.length; i13 < len12; i13++) {
4144
- const a = ref23[i13];
4186
+ for (let ref25 = gatherRecursiveWithinFunction(block, ($17) => $17.type === "Await"), i13 = 0, len12 = ref25.length; i13 < len12; i13++) {
4187
+ const a = ref25[i13];
4145
4188
  const i = findChildIndex(a.parent, a);
4146
4189
  a.parent.children.splice(i + 1, 0, {
4147
4190
  type: "Error",
@@ -4154,8 +4197,8 @@ function processSignature(f) {
4154
4197
  if (f.generator != null) {
4155
4198
  addGenerator = true;
4156
4199
  } else {
4157
- for (let ref24 = gatherRecursiveWithinFunction(block, ($18) => $18.type === "YieldExpression"), i14 = 0, len13 = ref24.length; i14 < len13; i14++) {
4158
- const y = ref24[i14];
4200
+ for (let ref26 = gatherRecursiveWithinFunction(block, ($18) => $18.type === "YieldExpression"), i14 = 0, len13 = ref26.length; i14 < len13; i14++) {
4201
+ const y = ref26[i14];
4159
4202
  const i = y.children.findIndex(($19) => $19.type === "Yield");
4160
4203
  y.children.splice(i + 1, 0, {
4161
4204
  type: "Error",
@@ -4164,8 +4207,8 @@ function processSignature(f) {
4164
4207
  }
4165
4208
  }
4166
4209
  }
4167
- for (let ref25 = [f, ...precedingOverloads(f)], i15 = 0, len14 = ref25.length; i15 < len14; i15++) {
4168
- const overload = ref25[i15];
4210
+ for (let ref27 = [f, ...precedingOverloads(f)], i15 = 0, len14 = ref27.length; i15 < len14; i15++) {
4211
+ const overload = ref27[i15];
4169
4212
  if (addAsync && overload.async != null && !overload.async.length) {
4170
4213
  overload.async.push("async ");
4171
4214
  overload.signature.modifier.async = true;
@@ -4184,8 +4227,8 @@ function processSignature(f) {
4184
4227
  }
4185
4228
  }
4186
4229
  function processFunctions(statements, config2) {
4187
- for (let ref26 = gatherRecursiveAll(statements, ($20) => $20.type === "FunctionExpression" || $20.type === "ArrowFunction" || $20.type === "MethodDefinition"), i16 = 0, len15 = ref26.length; i16 < len15; i16++) {
4188
- const f = ref26[i16];
4230
+ for (let ref28 = gatherRecursiveAll(statements, ($20) => $20.type === "FunctionExpression" || $20.type === "ArrowFunction" || $20.type === "MethodDefinition"), i16 = 0, len15 = ref28.length; i16 < len15; i16++) {
4231
+ const f = ref28[i16];
4189
4232
  if (f.type === "FunctionExpression" || f.type === "MethodDefinition") {
4190
4233
  implicitFunctionBlock(f);
4191
4234
  }
@@ -4244,9 +4287,9 @@ function expressionizeIteration(exp) {
4244
4287
  }
4245
4288
  let done;
4246
4289
  if (!async) {
4247
- let ref27;
4248
- if ((ref27 = blockContainingStatement(exp)) && typeof ref27 === "object" && "block" in ref27 && "index" in ref27) {
4249
- const { block: parentBlock, index } = ref27;
4290
+ let ref29;
4291
+ if ((ref29 = blockContainingStatement(exp)) && typeof ref29 === "object" && "block" in ref29 && "index" in ref29) {
4292
+ const { block: parentBlock, index } = ref29;
4250
4293
  statements[0][0] = parentBlock.expressions[index][0];
4251
4294
  parentBlock.expressions.splice(index, index + 1 - index, ...statements);
4252
4295
  updateParentPointers(parentBlock);
@@ -4263,8 +4306,8 @@ function expressionizeIteration(exp) {
4263
4306
  }
4264
4307
  }
4265
4308
  function processIterationExpressions(statements) {
4266
- for (let ref28 = gatherRecursiveAll(statements, ($21) => $21.type === "IterationExpression"), i17 = 0, len16 = ref28.length; i17 < len16; i17++) {
4267
- const s = ref28[i17];
4309
+ for (let ref30 = gatherRecursiveAll(statements, ($21) => $21.type === "IterationExpression"), i17 = 0, len16 = ref30.length; i17 < len16; i17++) {
4310
+ const s = ref30[i17];
4268
4311
  expressionizeIteration(s);
4269
4312
  }
4270
4313
  }
@@ -4291,9 +4334,9 @@ function processCoffeeDo(ws, expression) {
4291
4334
  for (let i18 = 0, len17 = parameterList.length; i18 < len17; i18++) {
4292
4335
  let parameter = parameterList[i18];
4293
4336
  if (typeof parameter === "object" && parameter != null && "type" in parameter && parameter.type === "Parameter") {
4294
- let ref29;
4295
- if (ref29 = parameter.initializer) {
4296
- const initializer = ref29;
4337
+ let ref31;
4338
+ if (ref31 = parameter.initializer) {
4339
+ const initializer = ref31;
4297
4340
  args.push(initializer.expression, parameter.delim);
4298
4341
  parameter = {
4299
4342
  ...parameter,
@@ -4451,12 +4494,22 @@ function bracedBlock(block) {
4451
4494
  braceBlock(block);
4452
4495
  return block;
4453
4496
  }
4454
- function makeEmptyBlock() {
4497
+ function makeEmptyBlock(loc) {
4455
4498
  const expressions = [];
4499
+ let ref1;
4500
+ if (loc) {
4501
+ ref1 = { $loc: loc, token: "{" };
4502
+ } else ref1 = "{";
4503
+ const open = ref1;
4504
+ let ref2;
4505
+ if (loc) {
4506
+ ref2 = { $loc: { pos: loc.pos + loc.length, length: 0 }, token: "}" };
4507
+ } else ref2 = "}";
4508
+ const close = ref2;
4456
4509
  return {
4457
4510
  type: "BlockStatement",
4458
4511
  expressions,
4459
- children: ["{", expressions, "}"],
4512
+ children: [open, expressions, close],
4460
4513
  bare: false,
4461
4514
  empty: true
4462
4515
  };
@@ -4540,8 +4593,8 @@ function insertBlockStatements(block, index, ...statements) {
4540
4593
  }
4541
4594
  function processBlocks(statements) {
4542
4595
  insertSemicolon(statements);
4543
- for (let ref1 = gatherRecursive(statements, ($) => $.type === "BlockStatement"), i2 = 0, len12 = ref1.length; i2 < len12; i2++) {
4544
- const block = ref1[i2];
4596
+ for (let ref3 = gatherRecursive(statements, ($) => $.type === "BlockStatement"), i2 = 0, len12 = ref3.length; i2 < len12; i2++) {
4597
+ const block = ref3[i2];
4545
4598
  let m1;
4546
4599
  if (block.unwrapObject && block.expressions.length === 1 && (m1 = block.expressions[0][1], typeof m1 === "object" && m1 != null && "type" in m1 && m1.type === "ParenthesizedExpression" && "implicit" in m1 && m1.implicit === true && "expression" in m1 && typeof m1.expression === "object" && m1.expression != null && "type" in m1.expression && m1.expression.type === "ObjectExpression")) {
4547
4600
  const object = block.expressions[0][1].expression;
@@ -4559,9 +4612,9 @@ function processBlocks(statements) {
4559
4612
  }
4560
4613
  block.expressions[0][1] = block.expressions[0][1].expression;
4561
4614
  unbraceBlock(block);
4562
- for (let ref2 = object.properties, i3 = 0, len22 = ref2.length; i3 < len22; i3++) {
4615
+ for (let ref4 = object.properties, i3 = 0, len22 = ref4.length; i3 < len22; i3++) {
4563
4616
  const i = i3;
4564
- const prop = ref2[i3];
4617
+ const prop = ref4[i3];
4565
4618
  let m2;
4566
4619
  if (m2 = prop.name, typeof m2 === "object" && m2 != null && "type" in m2 && m2.type === "ComputedPropertyName" && "implicit" in m2 && m2.implicit === true) {
4567
4620
  replaceNode(prop.name, prop.name.expression, prop);
@@ -5292,6 +5345,9 @@ function getPatternBlockPrefix(pattern, ref, decl = "const ", typeSuffix) {
5292
5345
  }
5293
5346
  let [splices, thisAssignments] = gatherBindingCode(pattern);
5294
5347
  const patternBindings2 = nonMatcherBindings(pattern);
5348
+ if ("typeSuffix" in patternBindings2) {
5349
+ typeSuffix = patternBindings2.typeSuffix;
5350
+ }
5295
5351
  const subbindings = gatherSubbindings(patternBindings2);
5296
5352
  simplifyBindingProperties(patternBindings2);
5297
5353
  simplifyBindingProperties(subbindings);
@@ -5437,24 +5493,33 @@ function nonMatcherBindings(pattern) {
5437
5493
  case "ArrayBindingPattern":
5438
5494
  case "PostRestBindingElements": {
5439
5495
  const elements = elideMatchersFromArrayBindings(pattern.elements);
5440
- return makeNode({
5496
+ const node = makeNode({
5441
5497
  ...pattern,
5442
5498
  elements,
5443
5499
  children: pattern.children.map(($9) => $9 === pattern.elements ? elements : $9)
5444
5500
  });
5501
+ const typePattern = {
5502
+ ...node,
5503
+ typeSuffix: void 0,
5504
+ elements: elements.filter((element) => element?.type != null)
5505
+ };
5506
+ node.typeSuffix = gatherBindingPatternTypeSuffix(typePattern).typeSuffix;
5507
+ return node;
5445
5508
  }
5446
5509
  case "ObjectBindingPattern": {
5447
5510
  const properties = elideMatchersFromPropertyBindings(pattern.properties);
5448
- return makeNode({
5511
+ return gatherBindingPatternTypeSuffix(makeNode({
5449
5512
  ...pattern,
5513
+ typeSuffix: void 0,
5450
5514
  properties,
5451
5515
  children: pattern.children.map(($10) => $10 === pattern.properties ? properties : $10)
5452
- });
5516
+ }));
5453
5517
  }
5454
5518
  case "NamedBindingPattern": {
5455
5519
  const bindings = nonMatcherBindings(pattern.pattern);
5456
5520
  return makeNode({
5457
5521
  ...pattern,
5522
+ typeSuffix: bindings?.typeSuffix,
5458
5523
  subbinding: (m2 = bindings?.type, m2 === "ArrayBindingPattern" || m2 === "ObjectBindingPattern" || m2 === "Identifier") ? [bindings, " = ", pattern.binding] : void 0
5459
5524
  });
5460
5525
  }
@@ -6659,8 +6724,9 @@ function forRange(open, forDeclaration, range2, stepExp, close) {
6659
6724
  asc = stepValue > 0;
6660
6725
  }
6661
6726
  let ref2;
6662
- if (stepRef) ref2 = start;
6663
- else ref2 = maybeRef(start, "start");
6727
+ if (stepRef) {
6728
+ ref2 = start;
6729
+ } else ref2 = maybeRef(start, "start");
6664
6730
  let startRef = ref2;
6665
6731
  let endRef = maybeRef(end, "end");
6666
6732
  const startRefDec = startRef !== start ? [startRef, " = ", start, ", "] : [];
@@ -8618,8 +8684,9 @@ function processTypes(node) {
8618
8684
  const space = getTrimmingSpace(unary);
8619
8685
  inplaceInsertTrimmingSpace(unary, "");
8620
8686
  let ref22;
8621
- if (unary.suffix.length) ref22 = unary;
8622
- else ref22 = unary.t;
8687
+ if (unary.suffix.length) {
8688
+ ref22 = unary;
8689
+ } else ref22 = unary.t;
8623
8690
  const t = ref22;
8624
8691
  const arg = makeNode({
8625
8692
  type: "TypeArgument",
@@ -9147,17 +9214,20 @@ function processPlaceholders(statements) {
9147
9214
  break;
9148
9215
  }
9149
9216
  case "PipelineExpression": {
9150
- const i = findChildIndex(parent, ancestor);
9151
- let ref33;
9152
- if (i === 1) {
9153
- ref33 = ancestor === parent.children[i];
9154
- } else if (i === 2) {
9155
- ref33 = ancestor === parent.children[i][findChildIndex(parent.children[i], ancestor)][3];
9156
- } else {
9157
- ref33 = void 0;
9217
+ {
9218
+ const i = findChildIndex(parent, ancestor);
9219
+ let ref33;
9220
+ if (i === 1) {
9221
+ ref33 = ancestor === parent.children[i];
9222
+ } else if (i === 2) {
9223
+ ref33 = ancestor === parent.children[i][findChildIndex(parent.children[i], ancestor)][3];
9224
+ } else {
9225
+ ref33 = void 0;
9226
+ }
9227
+ ;
9228
+ outer = ref33;
9158
9229
  }
9159
9230
  ;
9160
- outer = ref33;
9161
9231
  break;
9162
9232
  }
9163
9233
  case "AssignmentExpression":
@@ -9467,7 +9537,9 @@ var grammar = {
9467
9537
  AfterReturnShorthand,
9468
9538
  Parameters,
9469
9539
  ShortArrowParameters,
9540
+ ESArrowIdentifierParameters,
9470
9541
  ArrowParameters,
9542
+ ThinArrowParameters,
9471
9543
  NonEmptyParameters,
9472
9544
  ParameterList,
9473
9545
  NestedParameterList,
@@ -10151,6 +10223,7 @@ var grammar = {
10151
10223
  CoffeeNotEnabled,
10152
10224
  CoffeeOfEnabled,
10153
10225
  CoffeePrototypeEnabled,
10226
+ ESArrowFunctionEnabled,
10154
10227
  JSXCodeNestedEnabled,
10155
10228
  JSXCodeSameLineEnabled,
10156
10229
  ObjectIsEnabled,
@@ -11532,10 +11605,17 @@ function ConditionalExpression(ctx, state2) {
11532
11605
  return (0, import_lib2.$EVENT)(ctx, state2, "ConditionalExpression", ConditionalExpression$0);
11533
11606
  }
11534
11607
  var TernaryRest$0 = NestedTernaryRest;
11535
- var TernaryRest$1 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$N)(CoffeeBinaryExistentialEnabled), (0, import_lib2.$Y)((0, import_lib2.$EXPECT)($R5, "TernaryRest /[ \\t]/")), _, QuestionMark, MaybeNestedExpression, __, Colon, MaybeNestedExpression), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8) {
11608
+ var TernaryRest$1 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$N)(CoffeeBinaryExistentialEnabled), (0, import_lib2.$Y)((0, import_lib2.$EXPECT)($R5, "TernaryRest /[ \\t]/")), _, QuestionMark, PushIndent, (0, import_lib2.$E)((0, import_lib2.$S)(Nested, Expression, _, Colon, Nested, Expression)), PopIndent), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7) {
11609
+ var thenelse = $6;
11610
+ if (!thenelse) {
11611
+ return $skip;
11612
+ }
11613
+ return [$3, $4, ...thenelse];
11614
+ });
11615
+ var TernaryRest$2 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$N)(CoffeeBinaryExistentialEnabled), (0, import_lib2.$Y)((0, import_lib2.$EXPECT)($R5, "TernaryRest /[ \\t]/")), _, QuestionMark, MaybeNestedExpression, __, Colon, MaybeNestedExpression), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8) {
11536
11616
  return $0.slice(2);
11537
11617
  });
11538
- var TernaryRest$$ = [TernaryRest$0, TernaryRest$1];
11618
+ var TernaryRest$$ = [TernaryRest$0, TernaryRest$1, TernaryRest$2];
11539
11619
  function TernaryRest(ctx, state2) {
11540
11620
  return (0, import_lib2.$EVENT_C)(ctx, state2, "TernaryRest", TernaryRest$$);
11541
11621
  }
@@ -11554,27 +11634,37 @@ var ShortCircuitExpression$0 = BinaryOpExpression;
11554
11634
  function ShortCircuitExpression(ctx, state2) {
11555
11635
  return (0, import_lib2.$EVENT)(ctx, state2, "ShortCircuitExpression", ShortCircuitExpression$0);
11556
11636
  }
11557
- var PipelineExpression$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(PipelineAllowed, (0, import_lib2.$E)(_), PipelineHeadItem, PipelineExpressionBody), function($skip, $loc, $0, $1, $2, $3, $4) {
11637
+ var PipelineExpression$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(PipelineAllowed, (0, import_lib2.$E)(_), PipelineHeadItem, PipelineExpressionBody, (0, import_lib2.$E)(AllowedTrailingCallExpressions)), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
11558
11638
  var ws = $2;
11559
11639
  var head = $3;
11560
11640
  var body = $4;
11641
+ var trailing = $5;
11642
+ let node;
11561
11643
  if (head.type === "ArrowFunction" && head.ampersandBlock) {
11562
11644
  const expressions = [{
11563
11645
  type: "PipelineExpression",
11564
11646
  children: [ws, head.block.expressions[0], body]
11565
11647
  }];
11566
11648
  const block = { ...head.block, expressions, children: [expressions] };
11567
- return {
11649
+ node = {
11568
11650
  ...head,
11569
11651
  block,
11570
11652
  body: expressions,
11571
11653
  children: [...head.children.slice(0, -1), block]
11572
11654
  };
11655
+ } else {
11656
+ node = {
11657
+ type: "PipelineExpression",
11658
+ children: [ws, head, body]
11659
+ };
11573
11660
  }
11574
- return {
11575
- type: "PipelineExpression",
11576
- children: [ws, head, body]
11577
- };
11661
+ if (trailing) {
11662
+ return processCallMemberExpression({
11663
+ type: "CallExpression",
11664
+ children: [node, ...trailing]
11665
+ });
11666
+ }
11667
+ return node;
11578
11668
  });
11579
11669
  function PipelineExpression(ctx, state2) {
11580
11670
  return (0, import_lib2.$EVENT)(ctx, state2, "PipelineExpression", PipelineExpression$0);
@@ -12869,29 +12959,56 @@ function Parameters(ctx, state2) {
12869
12959
  var ShortArrowParameters$0 = (0, import_lib2.$TV)((0, import_lib2.$C)(ObjectBindingPattern, ArrayBindingPattern), function($skip, $loc, $0, $1) {
12870
12960
  var binding = $0;
12871
12961
  const { typeSuffix } = binding;
12872
- return {
12962
+ const parameter = {
12873
12963
  type: "Parameter",
12874
12964
  children: [binding, typeSuffix],
12875
12965
  names: binding.names,
12876
12966
  typeSuffix
12877
12967
  };
12968
+ const parameters = [parameter];
12969
+ return {
12970
+ type: "Parameters",
12971
+ children: ["(", parameters, ")"],
12972
+ parameters
12973
+ };
12878
12974
  });
12879
12975
  function ShortArrowParameters(ctx, state2) {
12880
12976
  return (0, import_lib2.$EVENT)(ctx, state2, "ShortArrowParameters", ShortArrowParameters$0);
12881
12977
  }
12882
- var ArrowParameters$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(ShortArrowParameters), function($skip, $loc, $0, $1) {
12883
- const parameters = [$1];
12978
+ var ESArrowIdentifierParameters$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(ESArrowFunctionEnabled, Identifier), function($skip, $loc, $0, $1, $2) {
12979
+ var id = $2;
12980
+ const parameter = {
12981
+ type: "Parameter",
12982
+ children: [id],
12983
+ names: id.names,
12984
+ binding: id,
12985
+ typeSuffix: void 0,
12986
+ initializer: void 0,
12987
+ delim: void 0
12988
+ };
12989
+ const parameters = [parameter];
12884
12990
  return {
12885
12991
  type: "Parameters",
12886
12992
  children: ["(", parameters, ")"],
12887
12993
  parameters
12888
12994
  };
12889
12995
  });
12890
- var ArrowParameters$1 = Parameters;
12891
- var ArrowParameters$$ = [ArrowParameters$0, ArrowParameters$1];
12996
+ function ESArrowIdentifierParameters(ctx, state2) {
12997
+ return (0, import_lib2.$EVENT)(ctx, state2, "ESArrowIdentifierParameters", ESArrowIdentifierParameters$0);
12998
+ }
12999
+ var ArrowParameters$0 = ESArrowIdentifierParameters;
13000
+ var ArrowParameters$1 = ShortArrowParameters;
13001
+ var ArrowParameters$2 = Parameters;
13002
+ var ArrowParameters$$ = [ArrowParameters$0, ArrowParameters$1, ArrowParameters$2];
12892
13003
  function ArrowParameters(ctx, state2) {
12893
13004
  return (0, import_lib2.$EVENT_C)(ctx, state2, "ArrowParameters", ArrowParameters$$);
12894
13005
  }
13006
+ var ThinArrowParameters$0 = ShortArrowParameters;
13007
+ var ThinArrowParameters$1 = Parameters;
13008
+ var ThinArrowParameters$$ = [ThinArrowParameters$0, ThinArrowParameters$1];
13009
+ function ThinArrowParameters(ctx, state2) {
13010
+ return (0, import_lib2.$EVENT_C)(ctx, state2, "ThinArrowParameters", ThinArrowParameters$$);
13011
+ }
12895
13012
  var NonEmptyParameters$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(TypeParameters), OpenParen, ParameterList, (0, import_lib2.$S)(__, CloseParen)), function($skip, $loc, $0, $1, $2, $3, $4) {
12896
13013
  var tp = $1;
12897
13014
  var open = $2;
@@ -13001,11 +13118,13 @@ function BindingIdentifier(ctx, state2) {
13001
13118
  return (0, import_lib2.$EVENT)(ctx, state2, "BindingIdentifier", BindingIdentifier$0);
13002
13119
  }
13003
13120
  var NWBindingIdentifier$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(At, AtIdentifierRef), function($skip, $loc, $0, $1, $2) {
13121
+ var at = $1;
13004
13122
  var ref = $2;
13005
13123
  return {
13006
13124
  type: "AtBinding",
13007
13125
  children: [ref],
13008
13126
  ref,
13127
+ at,
13009
13128
  names: []
13010
13129
  };
13011
13130
  });
@@ -13044,7 +13163,8 @@ var PinPattern$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Caret, IdentifierNam
13044
13163
  return {
13045
13164
  type: "PinPattern",
13046
13165
  children: [expression],
13047
- expression
13166
+ expression,
13167
+ typeSuffix: typeSuffixForExpression(expression)
13048
13168
  };
13049
13169
  });
13050
13170
  var PinPattern$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(Caret, SingleLineExpressionWithIndentedApplicationForbidden), function($skip, $loc, $0, $1, $2) {
@@ -13052,7 +13172,8 @@ var PinPattern$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(Caret, SingleLineExp
13052
13172
  return {
13053
13173
  type: "PinPattern",
13054
13174
  children: [expression],
13055
- expression
13175
+ expression,
13176
+ typeSuffix: typeSuffixForExpression(expression)
13056
13177
  };
13057
13178
  });
13058
13179
  var PinPattern$2 = (0, import_lib2.$TV)(ActualMemberExpression, function($skip, $loc, $0, $1) {
@@ -13060,7 +13181,8 @@ var PinPattern$2 = (0, import_lib2.$TV)(ActualMemberExpression, function($skip,
13060
13181
  return {
13061
13182
  type: "PinPattern",
13062
13183
  children: [expression],
13063
- expression
13184
+ expression,
13185
+ typeSuffix: typeSuffixForExpression(expression)
13064
13186
  };
13065
13187
  });
13066
13188
  var PinPattern$3 = (0, import_lib2.$TV)((0, import_lib2.$S)((0, import_lib2.$EXPECT)($R15, "PinPattern /[+-]/"), NumericLiteral), function($skip, $loc, $0, $1) {
@@ -13068,7 +13190,8 @@ var PinPattern$3 = (0, import_lib2.$TV)((0, import_lib2.$S)((0, import_lib2.$EXP
13068
13190
  return {
13069
13191
  type: "PinPattern",
13070
13192
  children: [expression],
13071
- expression
13193
+ expression,
13194
+ typeSuffix: typeSuffixForExpression(expression)
13072
13195
  };
13073
13196
  });
13074
13197
  var PinPattern$4 = (0, import_lib2.$TV)(Undefined, function($skip, $loc, $0, $1) {
@@ -13076,7 +13199,8 @@ var PinPattern$4 = (0, import_lib2.$TV)(Undefined, function($skip, $loc, $0, $1)
13076
13199
  return {
13077
13200
  type: "PinPattern",
13078
13201
  children: [expression],
13079
- expression
13202
+ expression,
13203
+ typeSuffix: typeSuffixForExpression(expression)
13080
13204
  };
13081
13205
  });
13082
13206
  var PinPattern$$ = [PinPattern$0, PinPattern$1, PinPattern$2, PinPattern$3, PinPattern$4];
@@ -13304,7 +13428,8 @@ var BindingProperty$2 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2
13304
13428
  value: {
13305
13429
  type: "PinPattern",
13306
13430
  children: [binding],
13307
- expression: binding
13431
+ expression: binding,
13432
+ typeSuffix: typeSuffixForExpression(binding)
13308
13433
  }
13309
13434
  };
13310
13435
  });
@@ -13822,7 +13947,7 @@ var OperatorAssociativity$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, impor
13822
13947
  function OperatorAssociativity(ctx, state2) {
13823
13948
  return (0, import_lib2.$EVENT)(ctx, state2, "OperatorAssociativity", OperatorAssociativity$0);
13824
13949
  }
13825
- 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)(_), ThinArrow, (0, import_lib2.$C)(BracedObjectSingleLineStatements, NoCommaBracedOrEmptyBlock)), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
13950
+ var ThinArrowFunction$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)((0, import_lib2.$S)(Async, _)), ThinArrowParameters, (0, import_lib2.$E)(ReturnTypeSuffix), (0, import_lib2.$E)(_), ThinArrow, (0, import_lib2.$C)(BracedObjectSingleLineStatements, NoCommaBracedOrEmptyBlock)), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
13826
13951
  var async = $1;
13827
13952
  var parameters = $2;
13828
13953
  var returnType = $3;
@@ -15217,6 +15342,17 @@ var PropertyDefinition$5 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_l
15217
15342
  }
15218
15343
  }
15219
15344
  if (name[0] === "#") name = name.slice(1);
15345
+ if (!pre.length && post?.token === "?" && value.type === "Identifier") {
15346
+ const dots = { $loc, token: "..." };
15347
+ const paren = parenthesizeExpression({ children: ["(", value, " != null) && {", name, "}"] });
15348
+ return {
15349
+ type: "SpreadProperty",
15350
+ children: [ws, dots, paren],
15351
+ names: value.names,
15352
+ dots,
15353
+ value: paren
15354
+ };
15355
+ }
15220
15356
  return {
15221
15357
  type: "Property",
15222
15358
  children: [ws, name, ": ", processUnaryExpression(pre, value, post)],
@@ -15230,7 +15366,22 @@ var PropertyDefinition$$ = [PropertyDefinition$0, PropertyDefinition$1, Property
15230
15366
  function PropertyDefinition(ctx, state2) {
15231
15367
  return (0, import_lib2.$EVENT_C)(ctx, state2, "PropertyDefinition", PropertyDefinition$$);
15232
15368
  }
15233
- var NamedProperty$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(PropertyName, (0, import_lib2.$E)(_), Colon, PostfixedExpression), function($skip, $loc, $0, $1, $2, $3, $4) {
15369
+ var NamedProperty$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(PropertyName, (0, import_lib2.$EXPECT)($L6, 'NamedProperty "?"'), (0, import_lib2.$E)(_), Colon, (0, import_lib2.$E)(_), PostfixedExpression), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
15370
+ var name = $1;
15371
+ var exp = $6;
15372
+ const { ref, refAssignment } = maybeRefAssignment(exp);
15373
+ const checkExp = refAssignment ? parenthesizeExpression(refAssignment) : exp;
15374
+ const dots = { $loc, token: "..." };
15375
+ const paren = parenthesizeExpression({ children: [checkExp, " != null ? {", name, ": ", ref, "} : {}"] });
15376
+ return {
15377
+ type: "SpreadProperty",
15378
+ children: [dots, paren],
15379
+ names: exp.names || [],
15380
+ dots,
15381
+ value: paren
15382
+ };
15383
+ });
15384
+ var NamedProperty$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(PropertyName, (0, import_lib2.$E)(_), Colon, PostfixedExpression), function($skip, $loc, $0, $1, $2, $3, $4) {
15234
15385
  var name = $1;
15235
15386
  var exp = $4;
15236
15387
  return {
@@ -15241,8 +15392,9 @@ var NamedProperty$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(PropertyName, (0,
15241
15392
  value: exp
15242
15393
  };
15243
15394
  });
15395
+ var NamedProperty$$ = [NamedProperty$0, NamedProperty$1];
15244
15396
  function NamedProperty(ctx, state2) {
15245
- return (0, import_lib2.$EVENT)(ctx, state2, "NamedProperty", NamedProperty$0);
15397
+ return (0, import_lib2.$EVENT_C)(ctx, state2, "NamedProperty", NamedProperty$$);
15246
15398
  }
15247
15399
  var SnugNamedProperty$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(PropertyName, Colon, MaybeNestedExpression, (0, import_lib2.$E)((0, import_lib2.$S)((0, import_lib2.$S)((0, import_lib2.$E)(_), PostfixStatement), (0, import_lib2.$Y)((0, import_lib2.$S)(Nested, NamedProperty))))), function($skip, $loc, $0, $1, $2, $3, $4) {
15248
15400
  var name = $1;
@@ -22066,6 +22218,13 @@ var CoffeePrototypeEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0
22066
22218
  function CoffeePrototypeEnabled(ctx, state2) {
22067
22219
  return (0, import_lib2.$EVENT)(ctx, state2, "CoffeePrototypeEnabled", CoffeePrototypeEnabled$0);
22068
22220
  }
22221
+ var ESArrowFunctionEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'ESArrowFunctionEnabled ""'), function($skip, $loc, $0, $1) {
22222
+ if (config.esArrowFunction) return;
22223
+ return $skip;
22224
+ });
22225
+ function ESArrowFunctionEnabled(ctx, state2) {
22226
+ return (0, import_lib2.$EVENT)(ctx, state2, "ESArrowFunctionEnabled", ESArrowFunctionEnabled$0);
22227
+ }
22069
22228
  var JSXCodeNestedEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'JSXCodeNestedEnabled ""'), function($skip, $loc, $0, $1) {
22070
22229
  if (config.jsxCodeNested) return;
22071
22230
  return $skip;
@@ -22138,6 +22297,7 @@ var Reset$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'Reset ""'), fu
22138
22297
  globals: [],
22139
22298
  iife: false,
22140
22299
  implicitReturns: true,
22300
+ esArrowFunction: false,
22141
22301
  jsxCode: false,
22142
22302
  objectIs: false,
22143
22303
  react: false,
@@ -22189,6 +22349,17 @@ var Reset$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'Reset ""'), fu
22189
22349
  return;
22190
22350
  }
22191
22351
  });
22352
+ Object.defineProperty(config, "esCompat", {
22353
+ set(b) {
22354
+ for (const option of [
22355
+ "esArrowFunction"
22356
+ ]) {
22357
+ config[option] = b;
22358
+ }
22359
+ config.implicitReturns = !b;
22360
+ return;
22361
+ }
22362
+ });
22192
22363
  Object.defineProperty(config, "jsxCode", {
22193
22364
  set(b) {
22194
22365
  for (const option of ["jsxCodeNested", "jsxCodeSameLine"]) {
@@ -22778,8 +22949,9 @@ var VLQ_VALUE_MASK = VLQ_CONTINUATION_BIT - 1;
22778
22949
  var encodeVlq = function(value) {
22779
22950
  let answer = "";
22780
22951
  let ref2;
22781
- if (value < 0) ref2 = 1;
22782
- else ref2 = 0;
22952
+ if (value < 0) {
22953
+ ref2 = 1;
22954
+ } else ref2 = 0;
22783
22955
  const signBit = ref2;
22784
22956
  let valueToEncode = (Math.abs(value) << 1) + signBit;
22785
22957
  while (valueToEncode || !answer) {
@@ -22887,6 +23059,9 @@ var remapPosition = (position, sourcemapLines) => {
22887
23059
  }
22888
23060
  };
22889
23061
 
23062
+ // source/main.civet
23063
+ var import_node_path2 = require("node:path");
23064
+
22890
23065
  // source/state-cache.civet
22891
23066
  var StateCache = class {
22892
23067
  cache = /* @__PURE__ */ new Map();
@@ -23213,8 +23388,11 @@ ${counts}`;
23213
23388
  }
23214
23389
  if (options.inlineMap) {
23215
23390
  const outputFilename = options.outputFilename ?? (options.js ? filename2 + ".jsx" : filename2 + ".tsx");
23391
+ const outDir = (0, import_node_path2.dirname)(outputFilename);
23392
+ options.sourceMap.sourceFileName = (0, import_node_path2.relative)(outDir, options.sourceMap.sourceFileName) || options.sourceMap.sourceFileName;
23393
+ const relativeOut = (0, import_node_path2.relative)(outDir, outputFilename) || outputFilename;
23216
23394
  return `${code}
23217
- ${options.sourceMap.comment(outputFilename)}`;
23395
+ ${options.sourceMap.comment(relativeOut)}`;
23218
23396
  } else {
23219
23397
  return { code, sourceMap: options.sourceMap };
23220
23398
  }