@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.mjs CHANGED
@@ -28,9 +28,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
28
  mod
29
29
  ));
30
30
 
31
- // node_modules/.pnpm/@danielx+hera@0.8.19/node_modules/@danielx/hera/dist/machine.js
31
+ // node_modules/.pnpm/@danielx+hera@0.8.20/node_modules/@danielx/hera/dist/machine.js
32
32
  var require_machine = __commonJS({
33
- "node_modules/.pnpm/@danielx+hera@0.8.19/node_modules/@danielx/hera/dist/machine.js"(exports, module) {
33
+ "node_modules/.pnpm/@danielx+hera@0.8.20/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;
@@ -540,6 +540,7 @@ __export(lib_exports, {
540
540
  maybeRefAssignment: () => maybeRefAssignment,
541
541
  modifyString: () => modifyString,
542
542
  negateCondition: () => negateCondition,
543
+ parenthesizeExpression: () => parenthesizeExpression,
543
544
  precedenceCustomDefault: () => precedenceCustomDefault,
544
545
  precedenceStep: () => precedenceStep,
545
546
  prepend: () => prepend,
@@ -565,6 +566,7 @@ __export(lib_exports, {
565
566
  stripTrailingImplicitComma: () => stripTrailingImplicitComma,
566
567
  trimFirstSpace: () => trimFirstSpace,
567
568
  typeOfJSX: () => typeOfJSX,
569
+ typeSuffixForExpression: () => typeSuffixForExpression,
568
570
  wrapIIFE: () => wrapIIFE,
569
571
  wrapTypeInPromise: () => wrapTypeInPromise
570
572
  });
@@ -1824,7 +1826,14 @@ function populateRefs(statements) {
1824
1826
  name = `${base}${n}`;
1825
1827
  }
1826
1828
  names.add(name);
1827
- ref.children = ref.names = [name];
1829
+ if (ref.$loc) {
1830
+ const loc = ref.$loc;
1831
+ delete ref.$loc;
1832
+ ref.children = [{ $loc: loc, token: name }];
1833
+ ref.names = [name];
1834
+ } else {
1835
+ ref.children = ref.names = [name];
1836
+ }
1828
1837
  }
1829
1838
  }
1830
1839
 
@@ -1837,7 +1846,16 @@ function adjustAtBindings(statements, asThis = false) {
1837
1846
  const atBinding = binding.binding;
1838
1847
  atBinding.children.pop();
1839
1848
  atBinding.type = void 0;
1840
- binding.children.splice(1, 0, ref.id, ": this.", ref.base);
1849
+ const atLoc = atBinding.at?.$loc;
1850
+ let ref2;
1851
+ if (atLoc) {
1852
+ ref2 = { $loc: atLoc, token: "this." };
1853
+ } else {
1854
+ ref2 = "this.";
1855
+ }
1856
+ ;
1857
+ const thisNode = ref2;
1858
+ binding.children.splice(1, 0, ref.id, ": ", thisNode, ref.base);
1841
1859
  binding.type = "Property";
1842
1860
  binding.ref = void 0;
1843
1861
  } else {
@@ -1907,8 +1925,8 @@ function adjustBindingElements(elements) {
1907
1925
  };
1908
1926
  }
1909
1927
  function gatherSubbindings(node, subbindings = []) {
1910
- for (let ref2 = gatherRecursiveAll(node, ($) => $.subbinding != null), i3 = 0, len22 = ref2.length; i3 < len22; i3++) {
1911
- const p = ref2[i3];
1928
+ for (let ref3 = gatherRecursiveAll(node, ($) => $.subbinding != null), i3 = 0, len22 = ref3.length; i3 < len22; i3++) {
1929
+ const p = ref3[i3];
1912
1930
  const { subbinding } = p;
1913
1931
  subbindings.push(", ", subbinding);
1914
1932
  gatherSubbindings(subbinding, subbindings);
@@ -1917,8 +1935,8 @@ function gatherSubbindings(node, subbindings = []) {
1917
1935
  }
1918
1936
  function simplifyBindingProperties(node) {
1919
1937
  const results = [];
1920
- for (let ref3 = gatherRecursiveAll(node, ($3) => $3.type === "BindingProperty"), i4 = 0, len3 = ref3.length; i4 < len3; i4++) {
1921
- const p = ref3[i4];
1938
+ for (let ref4 = gatherRecursiveAll(node, ($3) => $3.type === "BindingProperty"), i4 = 0, len3 = ref4.length; i4 < len3; i4++) {
1939
+ const p = ref4[i4];
1922
1940
  const { name, value } = p;
1923
1941
  if (value?.type === "NamedBindingPattern" && value.binding === name) {
1924
1942
  const [ws] = p.children;
@@ -1935,15 +1953,26 @@ function gatherBindingCode(statements, opts) {
1935
1953
  const splices = [];
1936
1954
  function insertRestSplices(s, p, thisAssignments2) {
1937
1955
  let m;
1938
- for (let ref4 = gatherRecursiveAll(
1956
+ for (let ref5 = gatherRecursiveAll(
1939
1957
  s,
1940
1958
  (n) => n.blockPrefix || opts?.injectParamProps && n.accessModifier || n.type === "AtBinding" || opts?.assignPins && (m = n.type, m === "PinPattern" || m === "PinProperty")
1941
- ), i5 = 0, len4 = ref4.length; i5 < len4; i5++) {
1942
- let n = ref4[i5];
1959
+ ), i5 = 0, len4 = ref5.length; i5 < len4; i5++) {
1960
+ let n = ref5[i5];
1943
1961
  if (n.type === "AtBinding") {
1944
- const { ref } = n;
1962
+ const { ref, at } = n;
1945
1963
  const { id } = ref;
1946
- thisAssignments2.push([`this.${id} = `, ref]);
1964
+ const atLoc = at?.$loc;
1965
+ if (atLoc) {
1966
+ ref.$loc = { pos: atLoc.pos + 1, length: id.length };
1967
+ thisAssignments2.push([
1968
+ { $loc: atLoc, token: "this." },
1969
+ { $loc: ref.$loc, token: id },
1970
+ " = ",
1971
+ ref
1972
+ ]);
1973
+ } else {
1974
+ thisAssignments2.push([`this.${id} = `, ref]);
1975
+ }
1947
1976
  continue;
1948
1977
  }
1949
1978
  if (opts?.assignPins) {
@@ -1970,8 +1999,8 @@ function gatherBindingCode(statements, opts) {
1970
1999
  }
1971
2000
  }
1972
2001
  if (opts?.injectParamProps && n.type === "Parameter" && n.accessModifier) {
1973
- for (let ref5 = n.names, i6 = 0, len5 = ref5.length; i6 < len5; i6++) {
1974
- const id = ref5[i6];
2002
+ for (let ref6 = n.names, i6 = 0, len5 = ref6.length; i6 < len5; i6++) {
2003
+ const id = ref6[i6];
1975
2004
  thisAssignments2.push({
1976
2005
  type: "AssignmentExpression",
1977
2006
  children: [`this.${id} = `, id],
@@ -1989,8 +2018,8 @@ function gatherBindingCode(statements, opts) {
1989
2018
  return [splices, thisAssignments];
1990
2019
  }
1991
2020
  function arrayElementHasTrailingComma(elementNode) {
1992
- let ref6;
1993
- const lastChild = (ref6 = elementNode.children)[ref6.length - 1];
2021
+ let ref7;
2022
+ const lastChild = (ref7 = elementNode.children)[ref7.length - 1];
1994
2023
  return lastChild && lastChild[lastChild.length - 1]?.token === ",";
1995
2024
  }
1996
2025
  function gatherBindingPatternTypeSuffix(pattern) {
@@ -2002,8 +2031,8 @@ function gatherBindingPatternTypeSuffix(pattern) {
2002
2031
  case "ArrayBindingPattern": {
2003
2032
  {
2004
2033
  const results1 = [];
2005
- for (let ref7 = pattern.elements, i7 = 0, len6 = ref7.length; i7 < len6; i7++) {
2006
- const elem = ref7[i7];
2034
+ for (let ref8 = pattern.elements, i7 = 0, len6 = ref8.length; i7 < len6; i7++) {
2035
+ const elem = ref8[i7];
2007
2036
  let { typeSuffix, initializer } = elem;
2008
2037
  typeSuffix ??= elem.binding?.typeSuffix;
2009
2038
  if (typeSuffix) {
@@ -2044,8 +2073,8 @@ function gatherBindingPatternTypeSuffix(pattern) {
2044
2073
  {
2045
2074
  let restType;
2046
2075
  const results2 = [];
2047
- for (let ref8 = pattern.properties, i8 = 0, len7 = ref8.length; i8 < len7; i8++) {
2048
- const prop = ref8[i8];
2076
+ for (let ref9 = pattern.properties, i8 = 0, len7 = ref9.length; i8 < len7; i8++) {
2077
+ const prop = ref9[i8];
2049
2078
  let { typeSuffix, initializer } = prop;
2050
2079
  typeSuffix ??= prop.value?.typeSuffix;
2051
2080
  if (typeSuffix) {
@@ -2063,7 +2092,8 @@ function gatherBindingPatternTypeSuffix(pattern) {
2063
2092
  typeSuffix.children.unshift(typeSuffix.optional = "?");
2064
2093
  }
2065
2094
  switch (prop.type) {
2066
- case "BindingProperty": {
2095
+ case "BindingProperty":
2096
+ case "PinProperty": {
2067
2097
  const ws = prop.children.slice(0, prop.children.indexOf(prop.name));
2068
2098
  results2.push([...ws, prop.name, typeSuffix, prop.delim]);
2069
2099
  break;
@@ -2656,8 +2686,9 @@ function serialize(value, context) {
2656
2686
  if (typeof val === "string") {
2657
2687
  return JSON.stringify(val);
2658
2688
  } else if (typeof val === "number") {
2659
- if (Object.is(-0, val)) return "-0";
2660
- else return val.toString();
2689
+ if (Object.is(-0, val)) {
2690
+ return "-0";
2691
+ } else return val.toString();
2661
2692
  } else if (typeof val === "boolean" || val == null) {
2662
2693
  return String(val);
2663
2694
  } else if (typeof val === "bigint") {
@@ -2917,7 +2948,14 @@ function implicitFunctionBlock(f) {
2917
2948
  if (followingOverloads(f).length) {
2918
2949
  f.ts = true;
2919
2950
  } else {
2920
- const block = makeEmptyBlock();
2951
+ let ref1;
2952
+ const lastChild = (ref1 = f.parameters?.children)?.[ref1.length - 1];
2953
+ let ref2;
2954
+ if (Array.isArray(lastChild)) {
2955
+ ref2 = lastChild[lastChild.length - 1];
2956
+ } else ref2 = lastChild;
2957
+ const closeParen = ref2;
2958
+ const block = makeEmptyBlock(closeParen?.$loc);
2921
2959
  block.parent = f;
2922
2960
  f.block = block;
2923
2961
  f.children.push(block);
@@ -3083,10 +3121,10 @@ function processReturnValue(func) {
3083
3121
  r.expression = ref;
3084
3122
  return r.children.splice(-1, 1, " ", ref);
3085
3123
  });
3086
- let ref1;
3087
- if (!((ref1 = block.children)[ref1.length - 2]?.type === "ReturnStatement")) {
3088
- let ref2;
3089
- const indent = getIndent((ref2 = block.expressions)[ref2.length - 1]);
3124
+ let ref3;
3125
+ if (!((ref3 = block.children)[ref3.length - 2]?.type === "ReturnStatement")) {
3126
+ let ref4;
3127
+ const indent = getIndent((ref4 = block.expressions)[ref4.length - 1]);
3090
3128
  block.expressions.push([
3091
3129
  indent,
3092
3130
  wrapWithReturn(ref, block, !indent)
@@ -3163,16 +3201,16 @@ function patternBindings(pattern) {
3163
3201
  function recurse(pattern2) {
3164
3202
  switch (pattern2.type) {
3165
3203
  case "ArrayBindingPattern": {
3166
- for (let ref3 = pattern2.elements, i2 = 0, len12 = ref3.length; i2 < len12; i2++) {
3167
- const element = ref3[i2];
3204
+ for (let ref5 = pattern2.elements, i2 = 0, len12 = ref5.length; i2 < len12; i2++) {
3205
+ const element = ref5[i2];
3168
3206
  recurse(element);
3169
3207
  }
3170
3208
  ;
3171
3209
  break;
3172
3210
  }
3173
3211
  case "ObjectBindingPattern": {
3174
- for (let ref4 = pattern2.properties, i3 = 0, len22 = ref4.length; i3 < len22; i3++) {
3175
- const property = ref4[i3];
3212
+ for (let ref6 = pattern2.properties, i3 = 0, len22 = ref6.length; i3 < len22; i3++) {
3213
+ const property = ref6[i3];
3176
3214
  recurse(property);
3177
3215
  }
3178
3216
  ;
@@ -3203,8 +3241,8 @@ function assignResults(node, collect) {
3203
3241
  switch (node.type) {
3204
3242
  case "BlockStatement": {
3205
3243
  if (node.expressions.length) {
3206
- let ref5;
3207
- assignResults((ref5 = node.expressions)[ref5.length - 1], collect);
3244
+ let ref7;
3245
+ assignResults((ref7 = node.expressions)[ref7.length - 1], collect);
3208
3246
  } else {
3209
3247
  node.expressions.push(["", collect("void 0"), ";"]);
3210
3248
  updateParentPointers(node);
@@ -3212,8 +3250,8 @@ function assignResults(node, collect) {
3212
3250
  return;
3213
3251
  }
3214
3252
  case "CaseBlock": {
3215
- for (let ref6 = node.clauses, i4 = 0, len3 = ref6.length; i4 < len3; i4++) {
3216
- const clause = ref6[i4];
3253
+ for (let ref8 = node.clauses, i4 = 0, len3 = ref8.length; i4 < len3; i4++) {
3254
+ const clause = ref8[i4];
3217
3255
  assignResults(clause, collect);
3218
3256
  }
3219
3257
  return;
@@ -3243,8 +3281,7 @@ function assignResults(node, collect) {
3243
3281
  if (exp.type === "LabelledStatement") {
3244
3282
  exp = exp.statement;
3245
3283
  }
3246
- let ref7;
3247
- let ref8;
3284
+ let ref9;
3248
3285
  let m1;
3249
3286
  switch (exp.type) {
3250
3287
  case "BreakStatement":
@@ -3256,20 +3293,23 @@ function assignResults(node, collect) {
3256
3293
  return;
3257
3294
  }
3258
3295
  case "Declaration": {
3259
- let ref9;
3260
- if (exp.bindings?.length) {
3261
- ref9 = patternAsValue((ref7 = exp.bindings)[ref7.length - 1].pattern);
3262
- } else {
3263
- ref9 = "void 0";
3296
+ {
3297
+ let ref10;
3298
+ if (exp.bindings?.length) {
3299
+ let ref11;
3300
+ ref10 = patternAsValue((ref11 = exp.bindings)[ref11.length - 1].pattern);
3301
+ } else {
3302
+ ref10 = "void 0";
3303
+ }
3304
+ ;
3305
+ const value = ref10;
3306
+ exp.children.push([
3307
+ "",
3308
+ [";", collect(value)]
3309
+ ]);
3310
+ updateParentPointers(exp);
3311
+ return;
3264
3312
  }
3265
- ;
3266
- const value = ref9;
3267
- exp.children.push([
3268
- "",
3269
- [";", collect(value)]
3270
- ]);
3271
- updateParentPointers(exp);
3272
- return;
3273
3313
  }
3274
3314
  case "FunctionExpression": {
3275
3315
  if (exp.id) {
@@ -3293,7 +3333,7 @@ function assignResults(node, collect) {
3293
3333
  if (exp.expressions.some(isExit)) {
3294
3334
  return;
3295
3335
  }
3296
- assignResults((ref8 = exp.expressions)[ref8.length - 1], collect);
3336
+ assignResults((ref9 = exp.expressions)[ref9.length - 1], collect);
3297
3337
  return;
3298
3338
  }
3299
3339
  case "IfStatement": {
@@ -3312,15 +3352,15 @@ function assignResults(node, collect) {
3312
3352
  return;
3313
3353
  }
3314
3354
  case "SwitchStatement": {
3315
- for (let ref10 = exp.caseBlock.clauses, i5 = 0, len4 = ref10.length; i5 < len4; i5++) {
3316
- const clause = ref10[i5];
3355
+ for (let ref12 = exp.caseBlock.clauses, i5 = 0, len4 = ref12.length; i5 < len4; i5++) {
3356
+ const clause = ref12[i5];
3317
3357
  assignResults(clause, collect);
3318
3358
  }
3319
3359
  return;
3320
3360
  }
3321
3361
  case "TryStatement": {
3322
- for (let ref11 = exp.blocks, i6 = 0, len5 = ref11.length; i6 < len5; i6++) {
3323
- const block = ref11[i6];
3362
+ for (let ref13 = exp.blocks, i6 = 0, len5 = ref13.length; i6 < len5; i6++) {
3363
+ const block = ref13[i6];
3324
3364
  assignResults(block, collect);
3325
3365
  }
3326
3366
  return;
@@ -3377,9 +3417,9 @@ function insertReturn(node) {
3377
3417
  insertReturn(node.block);
3378
3418
  if (!isExit(node.block)) {
3379
3419
  const comment = hasTrailingComment(node.block.expressions);
3380
- let ref12;
3420
+ let ref14;
3381
3421
  node.block.expressions.push([
3382
- comment ? (ref12 = node.block.expressions)[ref12.length - 1][0] || "\n" : "",
3422
+ comment ? (ref14 = node.block.expressions)[ref14.length - 1][0] || "\n" : "",
3383
3423
  wrapWithReturn(void 0, node, !comment)
3384
3424
  ]);
3385
3425
  }
@@ -3405,7 +3445,6 @@ function insertReturn(node) {
3405
3445
  if (exp.type === "LabelledStatement") {
3406
3446
  exp = exp.statement;
3407
3447
  }
3408
- let ref13;
3409
3448
  let m3;
3410
3449
  switch (exp.type) {
3411
3450
  case "BreakStatement":
@@ -3417,32 +3456,35 @@ function insertReturn(node) {
3417
3456
  return;
3418
3457
  }
3419
3458
  case "Declaration": {
3420
- let ref14;
3421
- if (exp.bindings?.length) {
3422
- ref14 = [" ", patternAsValue((ref13 = exp.bindings)[ref13.length - 1].pattern)];
3423
- } else {
3424
- ref14 = [];
3425
- }
3426
- ;
3427
- const value = ref14;
3428
- const parent = outer.parent;
3429
- const index = findChildIndex(parent?.expressions, outer);
3430
- assert.notEqual(index, -1, "Could not find declaration in parent");
3431
- parent.expressions.splice(index + 1, 0, [
3432
- "",
3433
- {
3434
- type: "ReturnStatement",
3435
- expression: value,
3436
- children: [
3437
- !(parent.expressions[index][2] === ";") ? ";" : void 0,
3438
- "return",
3439
- value
3440
- ],
3441
- parent: exp
3459
+ {
3460
+ let ref15;
3461
+ if (exp.bindings?.length) {
3462
+ let ref16;
3463
+ ref15 = [" ", patternAsValue((ref16 = exp.bindings)[ref16.length - 1].pattern)];
3464
+ } else {
3465
+ ref15 = [];
3442
3466
  }
3443
- ]);
3444
- braceBlock(parent);
3445
- return;
3467
+ ;
3468
+ const value = ref15;
3469
+ const parent = outer.parent;
3470
+ const index = findChildIndex(parent?.expressions, outer);
3471
+ assert.notEqual(index, -1, "Could not find declaration in parent");
3472
+ parent.expressions.splice(index + 1, 0, [
3473
+ "",
3474
+ {
3475
+ type: "ReturnStatement",
3476
+ expression: value,
3477
+ children: [
3478
+ !(parent.expressions[index][2] === ";") ? ";" : void 0,
3479
+ "return",
3480
+ value
3481
+ ],
3482
+ parent: exp
3483
+ }
3484
+ ]);
3485
+ braceBlock(parent);
3486
+ return;
3487
+ }
3446
3488
  }
3447
3489
  case "FunctionExpression": {
3448
3490
  if (exp.id) {
@@ -3471,8 +3513,9 @@ function insertReturn(node) {
3471
3513
  }
3472
3514
  case "IfStatement": {
3473
3515
  insertReturn(exp.then);
3474
- if (exp.else) insertReturn(exp.else.block);
3475
- else exp.children.push([
3516
+ if (exp.else) {
3517
+ insertReturn(exp.else.block);
3518
+ } else exp.children.push([
3476
3519
  "",
3477
3520
  // NOTE: add a prefixed semicolon because the if block may not be braced
3478
3521
  wrapWithReturn(void 0, exp, true)
@@ -3484,15 +3527,15 @@ function insertReturn(node) {
3484
3527
  return;
3485
3528
  }
3486
3529
  case "SwitchStatement": {
3487
- for (let ref15 = exp.caseBlock.clauses, i7 = 0, len6 = ref15.length; i7 < len6; i7++) {
3488
- const clause = ref15[i7];
3530
+ for (let ref17 = exp.caseBlock.clauses, i7 = 0, len6 = ref17.length; i7 < len6; i7++) {
3531
+ const clause = ref17[i7];
3489
3532
  insertReturn(clause);
3490
3533
  }
3491
3534
  return;
3492
3535
  }
3493
3536
  case "TryStatement": {
3494
- for (let ref16 = exp.blocks, i8 = 0, len7 = ref16.length; i8 < len7; i8++) {
3495
- const block = ref16[i8];
3537
+ for (let ref18 = exp.blocks, i8 = 0, len7 = ref18.length; i8 < len7; i8++) {
3538
+ const block = ref18[i8];
3496
3539
  insertReturn(block);
3497
3540
  }
3498
3541
  return;
@@ -3744,9 +3787,9 @@ function iterationDefaultBody(statement) {
3744
3787
  }
3745
3788
  const reduction = statement.type === "ForStatement" && statement.reduction;
3746
3789
  function fillBlock(expression) {
3747
- let ref17;
3790
+ let ref19;
3748
3791
  let m5;
3749
- 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) {
3792
+ 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) {
3750
3793
  block.expressions.pop();
3751
3794
  }
3752
3795
  block.expressions.push(expression);
@@ -3816,8 +3859,8 @@ function processParams(f) {
3816
3859
  function append2(p) {
3817
3860
  (rest ? after : before).push(p);
3818
3861
  }
3819
- for (let ref18 = parameters.parameters, i9 = 0, len8 = ref18.length; i9 < len8; i9++) {
3820
- const param = ref18[i9];
3862
+ for (let ref20 = parameters.parameters, i9 = 0, len8 = ref20.length; i9 < len8; i9++) {
3863
+ const param = ref20[i9];
3821
3864
  switch (param.type) {
3822
3865
  case "ThisType": {
3823
3866
  if (tt) {
@@ -3829,8 +3872,8 @@ function processParams(f) {
3829
3872
  } else {
3830
3873
  tt = trimFirstSpace(param);
3831
3874
  if (before.length || rest) {
3832
- let ref19;
3833
- let delim = (ref19 = tt.children)[ref19.length - 1];
3875
+ let ref21;
3876
+ let delim = (ref21 = tt.children)[ref21.length - 1];
3834
3877
  if (Array.isArray(delim)) {
3835
3878
  delim = delim[delim.length - 1];
3836
3879
  }
@@ -4020,14 +4063,14 @@ function processParams(f) {
4020
4063
  assert.notEqual(index2, -1, "Could not find constructor in class");
4021
4064
  index2 -= precedingOverloads(f).length;
4022
4065
  const fStatement = classExpressions[index2];
4023
- for (let ref20 = gatherRecursive(parameters, ($14) => $14.type === "Parameter"), i10 = 0, len9 = ref20.length; i10 < len9; i10++) {
4024
- const parameter = ref20[i10];
4066
+ for (let ref22 = gatherRecursive(parameters, ($14) => $14.type === "Parameter"), i10 = 0, len9 = ref22.length; i10 < len9; i10++) {
4067
+ const parameter = ref22[i10];
4025
4068
  const { accessModifier } = parameter;
4026
4069
  if (!(accessModifier || parameter.typeSuffix)) {
4027
4070
  continue;
4028
4071
  }
4029
- for (let ref21 = gatherRecursive(parameter, ($15) => $15.type === "AtBinding"), i11 = 0, len10 = ref21.length; i11 < len10; i11++) {
4030
- const binding = ref21[i11];
4072
+ for (let ref23 = gatherRecursive(parameter, ($15) => $15.type === "AtBinding"), i11 = 0, len10 = ref23.length; i11 < len10; i11++) {
4073
+ const binding = ref23[i11];
4031
4074
  const typeSuffix = binding.parent?.typeSuffix;
4032
4075
  if (!(accessModifier || typeSuffix)) {
4033
4076
  continue;
@@ -4065,8 +4108,8 @@ function processParams(f) {
4065
4108
  decl: "const"
4066
4109
  }));
4067
4110
  }
4068
- for (let ref22 = splices, i12 = 0, len11 = ref22.length; i12 < len11; i12++) {
4069
- const binding = ref22[i12];
4111
+ for (let ref24 = splices, i12 = 0, len11 = ref24.length; i12 < len11; i12++) {
4112
+ const binding = ref24[i12];
4070
4113
  assert.equal(binding.type, "PostRestBindingElements", "splice should be of type Binding");
4071
4114
  prefix.push(makeNode({
4072
4115
  type: "Declaration",
@@ -4119,8 +4162,8 @@ function processSignature(f) {
4119
4162
  if (f.async != null) {
4120
4163
  addAsync = true;
4121
4164
  } else {
4122
- for (let ref23 = gatherRecursiveWithinFunction(block, ($17) => $17.type === "Await"), i13 = 0, len12 = ref23.length; i13 < len12; i13++) {
4123
- const a = ref23[i13];
4165
+ for (let ref25 = gatherRecursiveWithinFunction(block, ($17) => $17.type === "Await"), i13 = 0, len12 = ref25.length; i13 < len12; i13++) {
4166
+ const a = ref25[i13];
4124
4167
  const i = findChildIndex(a.parent, a);
4125
4168
  a.parent.children.splice(i + 1, 0, {
4126
4169
  type: "Error",
@@ -4133,8 +4176,8 @@ function processSignature(f) {
4133
4176
  if (f.generator != null) {
4134
4177
  addGenerator = true;
4135
4178
  } else {
4136
- for (let ref24 = gatherRecursiveWithinFunction(block, ($18) => $18.type === "YieldExpression"), i14 = 0, len13 = ref24.length; i14 < len13; i14++) {
4137
- const y = ref24[i14];
4179
+ for (let ref26 = gatherRecursiveWithinFunction(block, ($18) => $18.type === "YieldExpression"), i14 = 0, len13 = ref26.length; i14 < len13; i14++) {
4180
+ const y = ref26[i14];
4138
4181
  const i = y.children.findIndex(($19) => $19.type === "Yield");
4139
4182
  y.children.splice(i + 1, 0, {
4140
4183
  type: "Error",
@@ -4143,8 +4186,8 @@ function processSignature(f) {
4143
4186
  }
4144
4187
  }
4145
4188
  }
4146
- for (let ref25 = [f, ...precedingOverloads(f)], i15 = 0, len14 = ref25.length; i15 < len14; i15++) {
4147
- const overload = ref25[i15];
4189
+ for (let ref27 = [f, ...precedingOverloads(f)], i15 = 0, len14 = ref27.length; i15 < len14; i15++) {
4190
+ const overload = ref27[i15];
4148
4191
  if (addAsync && overload.async != null && !overload.async.length) {
4149
4192
  overload.async.push("async ");
4150
4193
  overload.signature.modifier.async = true;
@@ -4163,8 +4206,8 @@ function processSignature(f) {
4163
4206
  }
4164
4207
  }
4165
4208
  function processFunctions(statements, config2) {
4166
- for (let ref26 = gatherRecursiveAll(statements, ($20) => $20.type === "FunctionExpression" || $20.type === "ArrowFunction" || $20.type === "MethodDefinition"), i16 = 0, len15 = ref26.length; i16 < len15; i16++) {
4167
- const f = ref26[i16];
4209
+ for (let ref28 = gatherRecursiveAll(statements, ($20) => $20.type === "FunctionExpression" || $20.type === "ArrowFunction" || $20.type === "MethodDefinition"), i16 = 0, len15 = ref28.length; i16 < len15; i16++) {
4210
+ const f = ref28[i16];
4168
4211
  if (f.type === "FunctionExpression" || f.type === "MethodDefinition") {
4169
4212
  implicitFunctionBlock(f);
4170
4213
  }
@@ -4223,9 +4266,9 @@ function expressionizeIteration(exp) {
4223
4266
  }
4224
4267
  let done;
4225
4268
  if (!async) {
4226
- let ref27;
4227
- if ((ref27 = blockContainingStatement(exp)) && typeof ref27 === "object" && "block" in ref27 && "index" in ref27) {
4228
- const { block: parentBlock, index } = ref27;
4269
+ let ref29;
4270
+ if ((ref29 = blockContainingStatement(exp)) && typeof ref29 === "object" && "block" in ref29 && "index" in ref29) {
4271
+ const { block: parentBlock, index } = ref29;
4229
4272
  statements[0][0] = parentBlock.expressions[index][0];
4230
4273
  parentBlock.expressions.splice(index, index + 1 - index, ...statements);
4231
4274
  updateParentPointers(parentBlock);
@@ -4242,8 +4285,8 @@ function expressionizeIteration(exp) {
4242
4285
  }
4243
4286
  }
4244
4287
  function processIterationExpressions(statements) {
4245
- for (let ref28 = gatherRecursiveAll(statements, ($21) => $21.type === "IterationExpression"), i17 = 0, len16 = ref28.length; i17 < len16; i17++) {
4246
- const s = ref28[i17];
4288
+ for (let ref30 = gatherRecursiveAll(statements, ($21) => $21.type === "IterationExpression"), i17 = 0, len16 = ref30.length; i17 < len16; i17++) {
4289
+ const s = ref30[i17];
4247
4290
  expressionizeIteration(s);
4248
4291
  }
4249
4292
  }
@@ -4270,9 +4313,9 @@ function processCoffeeDo(ws, expression) {
4270
4313
  for (let i18 = 0, len17 = parameterList.length; i18 < len17; i18++) {
4271
4314
  let parameter = parameterList[i18];
4272
4315
  if (typeof parameter === "object" && parameter != null && "type" in parameter && parameter.type === "Parameter") {
4273
- let ref29;
4274
- if (ref29 = parameter.initializer) {
4275
- const initializer = ref29;
4316
+ let ref31;
4317
+ if (ref31 = parameter.initializer) {
4318
+ const initializer = ref31;
4276
4319
  args.push(initializer.expression, parameter.delim);
4277
4320
  parameter = {
4278
4321
  ...parameter,
@@ -4430,12 +4473,22 @@ function bracedBlock(block) {
4430
4473
  braceBlock(block);
4431
4474
  return block;
4432
4475
  }
4433
- function makeEmptyBlock() {
4476
+ function makeEmptyBlock(loc) {
4434
4477
  const expressions = [];
4478
+ let ref1;
4479
+ if (loc) {
4480
+ ref1 = { $loc: loc, token: "{" };
4481
+ } else ref1 = "{";
4482
+ const open = ref1;
4483
+ let ref2;
4484
+ if (loc) {
4485
+ ref2 = { $loc: { pos: loc.pos + loc.length, length: 0 }, token: "}" };
4486
+ } else ref2 = "}";
4487
+ const close = ref2;
4435
4488
  return {
4436
4489
  type: "BlockStatement",
4437
4490
  expressions,
4438
- children: ["{", expressions, "}"],
4491
+ children: [open, expressions, close],
4439
4492
  bare: false,
4440
4493
  empty: true
4441
4494
  };
@@ -4519,8 +4572,8 @@ function insertBlockStatements(block, index, ...statements) {
4519
4572
  }
4520
4573
  function processBlocks(statements) {
4521
4574
  insertSemicolon(statements);
4522
- for (let ref1 = gatherRecursive(statements, ($) => $.type === "BlockStatement"), i2 = 0, len12 = ref1.length; i2 < len12; i2++) {
4523
- const block = ref1[i2];
4575
+ for (let ref3 = gatherRecursive(statements, ($) => $.type === "BlockStatement"), i2 = 0, len12 = ref3.length; i2 < len12; i2++) {
4576
+ const block = ref3[i2];
4524
4577
  let m1;
4525
4578
  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")) {
4526
4579
  const object = block.expressions[0][1].expression;
@@ -4538,9 +4591,9 @@ function processBlocks(statements) {
4538
4591
  }
4539
4592
  block.expressions[0][1] = block.expressions[0][1].expression;
4540
4593
  unbraceBlock(block);
4541
- for (let ref2 = object.properties, i3 = 0, len22 = ref2.length; i3 < len22; i3++) {
4594
+ for (let ref4 = object.properties, i3 = 0, len22 = ref4.length; i3 < len22; i3++) {
4542
4595
  const i = i3;
4543
- const prop = ref2[i3];
4596
+ const prop = ref4[i3];
4544
4597
  let m2;
4545
4598
  if (m2 = prop.name, typeof m2 === "object" && m2 != null && "type" in m2 && m2.type === "ComputedPropertyName" && "implicit" in m2 && m2.implicit === true) {
4546
4599
  replaceNode(prop.name, prop.name.expression, prop);
@@ -5271,6 +5324,9 @@ function getPatternBlockPrefix(pattern, ref, decl = "const ", typeSuffix) {
5271
5324
  }
5272
5325
  let [splices, thisAssignments] = gatherBindingCode(pattern);
5273
5326
  const patternBindings2 = nonMatcherBindings(pattern);
5327
+ if ("typeSuffix" in patternBindings2) {
5328
+ typeSuffix = patternBindings2.typeSuffix;
5329
+ }
5274
5330
  const subbindings = gatherSubbindings(patternBindings2);
5275
5331
  simplifyBindingProperties(patternBindings2);
5276
5332
  simplifyBindingProperties(subbindings);
@@ -5416,24 +5472,33 @@ function nonMatcherBindings(pattern) {
5416
5472
  case "ArrayBindingPattern":
5417
5473
  case "PostRestBindingElements": {
5418
5474
  const elements = elideMatchersFromArrayBindings(pattern.elements);
5419
- return makeNode({
5475
+ const node = makeNode({
5420
5476
  ...pattern,
5421
5477
  elements,
5422
5478
  children: pattern.children.map(($9) => $9 === pattern.elements ? elements : $9)
5423
5479
  });
5480
+ const typePattern = {
5481
+ ...node,
5482
+ typeSuffix: void 0,
5483
+ elements: elements.filter((element) => element?.type != null)
5484
+ };
5485
+ node.typeSuffix = gatherBindingPatternTypeSuffix(typePattern).typeSuffix;
5486
+ return node;
5424
5487
  }
5425
5488
  case "ObjectBindingPattern": {
5426
5489
  const properties = elideMatchersFromPropertyBindings(pattern.properties);
5427
- return makeNode({
5490
+ return gatherBindingPatternTypeSuffix(makeNode({
5428
5491
  ...pattern,
5492
+ typeSuffix: void 0,
5429
5493
  properties,
5430
5494
  children: pattern.children.map(($10) => $10 === pattern.properties ? properties : $10)
5431
- });
5495
+ }));
5432
5496
  }
5433
5497
  case "NamedBindingPattern": {
5434
5498
  const bindings = nonMatcherBindings(pattern.pattern);
5435
5499
  return makeNode({
5436
5500
  ...pattern,
5501
+ typeSuffix: bindings?.typeSuffix,
5437
5502
  subbinding: (m2 = bindings?.type, m2 === "ArrayBindingPattern" || m2 === "ObjectBindingPattern" || m2 === "Identifier") ? [bindings, " = ", pattern.binding] : void 0
5438
5503
  });
5439
5504
  }
@@ -6638,8 +6703,9 @@ function forRange(open, forDeclaration, range2, stepExp, close) {
6638
6703
  asc = stepValue > 0;
6639
6704
  }
6640
6705
  let ref2;
6641
- if (stepRef) ref2 = start;
6642
- else ref2 = maybeRef(start, "start");
6706
+ if (stepRef) {
6707
+ ref2 = start;
6708
+ } else ref2 = maybeRef(start, "start");
6643
6709
  let startRef = ref2;
6644
6710
  let endRef = maybeRef(end, "end");
6645
6711
  const startRefDec = startRef !== start ? [startRef, " = ", start, ", "] : [];
@@ -8597,8 +8663,9 @@ function processTypes(node) {
8597
8663
  const space = getTrimmingSpace(unary);
8598
8664
  inplaceInsertTrimmingSpace(unary, "");
8599
8665
  let ref22;
8600
- if (unary.suffix.length) ref22 = unary;
8601
- else ref22 = unary.t;
8666
+ if (unary.suffix.length) {
8667
+ ref22 = unary;
8668
+ } else ref22 = unary.t;
8602
8669
  const t = ref22;
8603
8670
  const arg = makeNode({
8604
8671
  type: "TypeArgument",
@@ -9126,17 +9193,20 @@ function processPlaceholders(statements) {
9126
9193
  break;
9127
9194
  }
9128
9195
  case "PipelineExpression": {
9129
- const i = findChildIndex(parent, ancestor);
9130
- let ref33;
9131
- if (i === 1) {
9132
- ref33 = ancestor === parent.children[i];
9133
- } else if (i === 2) {
9134
- ref33 = ancestor === parent.children[i][findChildIndex(parent.children[i], ancestor)][3];
9135
- } else {
9136
- ref33 = void 0;
9196
+ {
9197
+ const i = findChildIndex(parent, ancestor);
9198
+ let ref33;
9199
+ if (i === 1) {
9200
+ ref33 = ancestor === parent.children[i];
9201
+ } else if (i === 2) {
9202
+ ref33 = ancestor === parent.children[i][findChildIndex(parent.children[i], ancestor)][3];
9203
+ } else {
9204
+ ref33 = void 0;
9205
+ }
9206
+ ;
9207
+ outer = ref33;
9137
9208
  }
9138
9209
  ;
9139
- outer = ref33;
9140
9210
  break;
9141
9211
  }
9142
9212
  case "AssignmentExpression":
@@ -9446,7 +9516,9 @@ var grammar = {
9446
9516
  AfterReturnShorthand,
9447
9517
  Parameters,
9448
9518
  ShortArrowParameters,
9519
+ ESArrowIdentifierParameters,
9449
9520
  ArrowParameters,
9521
+ ThinArrowParameters,
9450
9522
  NonEmptyParameters,
9451
9523
  ParameterList,
9452
9524
  NestedParameterList,
@@ -10130,6 +10202,7 @@ var grammar = {
10130
10202
  CoffeeNotEnabled,
10131
10203
  CoffeeOfEnabled,
10132
10204
  CoffeePrototypeEnabled,
10205
+ ESArrowFunctionEnabled,
10133
10206
  JSXCodeNestedEnabled,
10134
10207
  JSXCodeSameLineEnabled,
10135
10208
  ObjectIsEnabled,
@@ -11511,10 +11584,17 @@ function ConditionalExpression(ctx, state2) {
11511
11584
  return (0, import_lib2.$EVENT)(ctx, state2, "ConditionalExpression", ConditionalExpression$0);
11512
11585
  }
11513
11586
  var TernaryRest$0 = NestedTernaryRest;
11514
- 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) {
11587
+ 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) {
11588
+ var thenelse = $6;
11589
+ if (!thenelse) {
11590
+ return $skip;
11591
+ }
11592
+ return [$3, $4, ...thenelse];
11593
+ });
11594
+ 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) {
11515
11595
  return $0.slice(2);
11516
11596
  });
11517
- var TernaryRest$$ = [TernaryRest$0, TernaryRest$1];
11597
+ var TernaryRest$$ = [TernaryRest$0, TernaryRest$1, TernaryRest$2];
11518
11598
  function TernaryRest(ctx, state2) {
11519
11599
  return (0, import_lib2.$EVENT_C)(ctx, state2, "TernaryRest", TernaryRest$$);
11520
11600
  }
@@ -11533,27 +11613,37 @@ var ShortCircuitExpression$0 = BinaryOpExpression;
11533
11613
  function ShortCircuitExpression(ctx, state2) {
11534
11614
  return (0, import_lib2.$EVENT)(ctx, state2, "ShortCircuitExpression", ShortCircuitExpression$0);
11535
11615
  }
11536
- 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) {
11616
+ 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) {
11537
11617
  var ws = $2;
11538
11618
  var head = $3;
11539
11619
  var body = $4;
11620
+ var trailing = $5;
11621
+ let node;
11540
11622
  if (head.type === "ArrowFunction" && head.ampersandBlock) {
11541
11623
  const expressions = [{
11542
11624
  type: "PipelineExpression",
11543
11625
  children: [ws, head.block.expressions[0], body]
11544
11626
  }];
11545
11627
  const block = { ...head.block, expressions, children: [expressions] };
11546
- return {
11628
+ node = {
11547
11629
  ...head,
11548
11630
  block,
11549
11631
  body: expressions,
11550
11632
  children: [...head.children.slice(0, -1), block]
11551
11633
  };
11634
+ } else {
11635
+ node = {
11636
+ type: "PipelineExpression",
11637
+ children: [ws, head, body]
11638
+ };
11552
11639
  }
11553
- return {
11554
- type: "PipelineExpression",
11555
- children: [ws, head, body]
11556
- };
11640
+ if (trailing) {
11641
+ return processCallMemberExpression({
11642
+ type: "CallExpression",
11643
+ children: [node, ...trailing]
11644
+ });
11645
+ }
11646
+ return node;
11557
11647
  });
11558
11648
  function PipelineExpression(ctx, state2) {
11559
11649
  return (0, import_lib2.$EVENT)(ctx, state2, "PipelineExpression", PipelineExpression$0);
@@ -12848,29 +12938,56 @@ function Parameters(ctx, state2) {
12848
12938
  var ShortArrowParameters$0 = (0, import_lib2.$TV)((0, import_lib2.$C)(ObjectBindingPattern, ArrayBindingPattern), function($skip, $loc, $0, $1) {
12849
12939
  var binding = $0;
12850
12940
  const { typeSuffix } = binding;
12851
- return {
12941
+ const parameter = {
12852
12942
  type: "Parameter",
12853
12943
  children: [binding, typeSuffix],
12854
12944
  names: binding.names,
12855
12945
  typeSuffix
12856
12946
  };
12947
+ const parameters = [parameter];
12948
+ return {
12949
+ type: "Parameters",
12950
+ children: ["(", parameters, ")"],
12951
+ parameters
12952
+ };
12857
12953
  });
12858
12954
  function ShortArrowParameters(ctx, state2) {
12859
12955
  return (0, import_lib2.$EVENT)(ctx, state2, "ShortArrowParameters", ShortArrowParameters$0);
12860
12956
  }
12861
- var ArrowParameters$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(ShortArrowParameters), function($skip, $loc, $0, $1) {
12862
- const parameters = [$1];
12957
+ var ESArrowIdentifierParameters$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(ESArrowFunctionEnabled, Identifier), function($skip, $loc, $0, $1, $2) {
12958
+ var id = $2;
12959
+ const parameter = {
12960
+ type: "Parameter",
12961
+ children: [id],
12962
+ names: id.names,
12963
+ binding: id,
12964
+ typeSuffix: void 0,
12965
+ initializer: void 0,
12966
+ delim: void 0
12967
+ };
12968
+ const parameters = [parameter];
12863
12969
  return {
12864
12970
  type: "Parameters",
12865
12971
  children: ["(", parameters, ")"],
12866
12972
  parameters
12867
12973
  };
12868
12974
  });
12869
- var ArrowParameters$1 = Parameters;
12870
- var ArrowParameters$$ = [ArrowParameters$0, ArrowParameters$1];
12975
+ function ESArrowIdentifierParameters(ctx, state2) {
12976
+ return (0, import_lib2.$EVENT)(ctx, state2, "ESArrowIdentifierParameters", ESArrowIdentifierParameters$0);
12977
+ }
12978
+ var ArrowParameters$0 = ESArrowIdentifierParameters;
12979
+ var ArrowParameters$1 = ShortArrowParameters;
12980
+ var ArrowParameters$2 = Parameters;
12981
+ var ArrowParameters$$ = [ArrowParameters$0, ArrowParameters$1, ArrowParameters$2];
12871
12982
  function ArrowParameters(ctx, state2) {
12872
12983
  return (0, import_lib2.$EVENT_C)(ctx, state2, "ArrowParameters", ArrowParameters$$);
12873
12984
  }
12985
+ var ThinArrowParameters$0 = ShortArrowParameters;
12986
+ var ThinArrowParameters$1 = Parameters;
12987
+ var ThinArrowParameters$$ = [ThinArrowParameters$0, ThinArrowParameters$1];
12988
+ function ThinArrowParameters(ctx, state2) {
12989
+ return (0, import_lib2.$EVENT_C)(ctx, state2, "ThinArrowParameters", ThinArrowParameters$$);
12990
+ }
12874
12991
  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) {
12875
12992
  var tp = $1;
12876
12993
  var open = $2;
@@ -12980,11 +13097,13 @@ function BindingIdentifier(ctx, state2) {
12980
13097
  return (0, import_lib2.$EVENT)(ctx, state2, "BindingIdentifier", BindingIdentifier$0);
12981
13098
  }
12982
13099
  var NWBindingIdentifier$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(At, AtIdentifierRef), function($skip, $loc, $0, $1, $2) {
13100
+ var at = $1;
12983
13101
  var ref = $2;
12984
13102
  return {
12985
13103
  type: "AtBinding",
12986
13104
  children: [ref],
12987
13105
  ref,
13106
+ at,
12988
13107
  names: []
12989
13108
  };
12990
13109
  });
@@ -13023,7 +13142,8 @@ var PinPattern$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Caret, IdentifierNam
13023
13142
  return {
13024
13143
  type: "PinPattern",
13025
13144
  children: [expression],
13026
- expression
13145
+ expression,
13146
+ typeSuffix: typeSuffixForExpression(expression)
13027
13147
  };
13028
13148
  });
13029
13149
  var PinPattern$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(Caret, SingleLineExpressionWithIndentedApplicationForbidden), function($skip, $loc, $0, $1, $2) {
@@ -13031,7 +13151,8 @@ var PinPattern$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(Caret, SingleLineExp
13031
13151
  return {
13032
13152
  type: "PinPattern",
13033
13153
  children: [expression],
13034
- expression
13154
+ expression,
13155
+ typeSuffix: typeSuffixForExpression(expression)
13035
13156
  };
13036
13157
  });
13037
13158
  var PinPattern$2 = (0, import_lib2.$TV)(ActualMemberExpression, function($skip, $loc, $0, $1) {
@@ -13039,7 +13160,8 @@ var PinPattern$2 = (0, import_lib2.$TV)(ActualMemberExpression, function($skip,
13039
13160
  return {
13040
13161
  type: "PinPattern",
13041
13162
  children: [expression],
13042
- expression
13163
+ expression,
13164
+ typeSuffix: typeSuffixForExpression(expression)
13043
13165
  };
13044
13166
  });
13045
13167
  var PinPattern$3 = (0, import_lib2.$TV)((0, import_lib2.$S)((0, import_lib2.$EXPECT)($R15, "PinPattern /[+-]/"), NumericLiteral), function($skip, $loc, $0, $1) {
@@ -13047,7 +13169,8 @@ var PinPattern$3 = (0, import_lib2.$TV)((0, import_lib2.$S)((0, import_lib2.$EXP
13047
13169
  return {
13048
13170
  type: "PinPattern",
13049
13171
  children: [expression],
13050
- expression
13172
+ expression,
13173
+ typeSuffix: typeSuffixForExpression(expression)
13051
13174
  };
13052
13175
  });
13053
13176
  var PinPattern$4 = (0, import_lib2.$TV)(Undefined, function($skip, $loc, $0, $1) {
@@ -13055,7 +13178,8 @@ var PinPattern$4 = (0, import_lib2.$TV)(Undefined, function($skip, $loc, $0, $1)
13055
13178
  return {
13056
13179
  type: "PinPattern",
13057
13180
  children: [expression],
13058
- expression
13181
+ expression,
13182
+ typeSuffix: typeSuffixForExpression(expression)
13059
13183
  };
13060
13184
  });
13061
13185
  var PinPattern$$ = [PinPattern$0, PinPattern$1, PinPattern$2, PinPattern$3, PinPattern$4];
@@ -13283,7 +13407,8 @@ var BindingProperty$2 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2
13283
13407
  value: {
13284
13408
  type: "PinPattern",
13285
13409
  children: [binding],
13286
- expression: binding
13410
+ expression: binding,
13411
+ typeSuffix: typeSuffixForExpression(binding)
13287
13412
  }
13288
13413
  };
13289
13414
  });
@@ -13801,7 +13926,7 @@ var OperatorAssociativity$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, impor
13801
13926
  function OperatorAssociativity(ctx, state2) {
13802
13927
  return (0, import_lib2.$EVENT)(ctx, state2, "OperatorAssociativity", OperatorAssociativity$0);
13803
13928
  }
13804
- 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) {
13929
+ 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) {
13805
13930
  var async = $1;
13806
13931
  var parameters = $2;
13807
13932
  var returnType = $3;
@@ -15196,6 +15321,17 @@ var PropertyDefinition$5 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_l
15196
15321
  }
15197
15322
  }
15198
15323
  if (name[0] === "#") name = name.slice(1);
15324
+ if (!pre.length && post?.token === "?" && value.type === "Identifier") {
15325
+ const dots = { $loc, token: "..." };
15326
+ const paren = parenthesizeExpression({ children: ["(", value, " != null) && {", name, "}"] });
15327
+ return {
15328
+ type: "SpreadProperty",
15329
+ children: [ws, dots, paren],
15330
+ names: value.names,
15331
+ dots,
15332
+ value: paren
15333
+ };
15334
+ }
15199
15335
  return {
15200
15336
  type: "Property",
15201
15337
  children: [ws, name, ": ", processUnaryExpression(pre, value, post)],
@@ -15209,7 +15345,22 @@ var PropertyDefinition$$ = [PropertyDefinition$0, PropertyDefinition$1, Property
15209
15345
  function PropertyDefinition(ctx, state2) {
15210
15346
  return (0, import_lib2.$EVENT_C)(ctx, state2, "PropertyDefinition", PropertyDefinition$$);
15211
15347
  }
15212
- 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) {
15348
+ 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) {
15349
+ var name = $1;
15350
+ var exp = $6;
15351
+ const { ref, refAssignment } = maybeRefAssignment(exp);
15352
+ const checkExp = refAssignment ? parenthesizeExpression(refAssignment) : exp;
15353
+ const dots = { $loc, token: "..." };
15354
+ const paren = parenthesizeExpression({ children: [checkExp, " != null ? {", name, ": ", ref, "} : {}"] });
15355
+ return {
15356
+ type: "SpreadProperty",
15357
+ children: [dots, paren],
15358
+ names: exp.names || [],
15359
+ dots,
15360
+ value: paren
15361
+ };
15362
+ });
15363
+ 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) {
15213
15364
  var name = $1;
15214
15365
  var exp = $4;
15215
15366
  return {
@@ -15220,8 +15371,9 @@ var NamedProperty$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(PropertyName, (0,
15220
15371
  value: exp
15221
15372
  };
15222
15373
  });
15374
+ var NamedProperty$$ = [NamedProperty$0, NamedProperty$1];
15223
15375
  function NamedProperty(ctx, state2) {
15224
- return (0, import_lib2.$EVENT)(ctx, state2, "NamedProperty", NamedProperty$0);
15376
+ return (0, import_lib2.$EVENT_C)(ctx, state2, "NamedProperty", NamedProperty$$);
15225
15377
  }
15226
15378
  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) {
15227
15379
  var name = $1;
@@ -22045,6 +22197,13 @@ var CoffeePrototypeEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0
22045
22197
  function CoffeePrototypeEnabled(ctx, state2) {
22046
22198
  return (0, import_lib2.$EVENT)(ctx, state2, "CoffeePrototypeEnabled", CoffeePrototypeEnabled$0);
22047
22199
  }
22200
+ var ESArrowFunctionEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'ESArrowFunctionEnabled ""'), function($skip, $loc, $0, $1) {
22201
+ if (config.esArrowFunction) return;
22202
+ return $skip;
22203
+ });
22204
+ function ESArrowFunctionEnabled(ctx, state2) {
22205
+ return (0, import_lib2.$EVENT)(ctx, state2, "ESArrowFunctionEnabled", ESArrowFunctionEnabled$0);
22206
+ }
22048
22207
  var JSXCodeNestedEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'JSXCodeNestedEnabled ""'), function($skip, $loc, $0, $1) {
22049
22208
  if (config.jsxCodeNested) return;
22050
22209
  return $skip;
@@ -22117,6 +22276,7 @@ var Reset$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'Reset ""'), fu
22117
22276
  globals: [],
22118
22277
  iife: false,
22119
22278
  implicitReturns: true,
22279
+ esArrowFunction: false,
22120
22280
  jsxCode: false,
22121
22281
  objectIs: false,
22122
22282
  react: false,
@@ -22168,6 +22328,17 @@ var Reset$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'Reset ""'), fu
22168
22328
  return;
22169
22329
  }
22170
22330
  });
22331
+ Object.defineProperty(config, "esCompat", {
22332
+ set(b) {
22333
+ for (const option of [
22334
+ "esArrowFunction"
22335
+ ]) {
22336
+ config[option] = b;
22337
+ }
22338
+ config.implicitReturns = !b;
22339
+ return;
22340
+ }
22341
+ });
22171
22342
  Object.defineProperty(config, "jsxCode", {
22172
22343
  set(b) {
22173
22344
  for (const option of ["jsxCodeNested", "jsxCodeSameLine"]) {
@@ -22757,8 +22928,9 @@ var VLQ_VALUE_MASK = VLQ_CONTINUATION_BIT - 1;
22757
22928
  var encodeVlq = function(value) {
22758
22929
  let answer = "";
22759
22930
  let ref2;
22760
- if (value < 0) ref2 = 1;
22761
- else ref2 = 0;
22931
+ if (value < 0) {
22932
+ ref2 = 1;
22933
+ } else ref2 = 0;
22762
22934
  const signBit = ref2;
22763
22935
  let valueToEncode = (Math.abs(value) << 1) + signBit;
22764
22936
  while (valueToEncode || !answer) {
@@ -22866,6 +23038,9 @@ var remapPosition = (position, sourcemapLines) => {
22866
23038
  }
22867
23039
  };
22868
23040
 
23041
+ // source/main.civet
23042
+ import { dirname as dirname2, relative as relativePath } from "node:path";
23043
+
22869
23044
  // source/state-cache.civet
22870
23045
  var StateCache = class {
22871
23046
  cache = /* @__PURE__ */ new Map();
@@ -23198,8 +23373,11 @@ ${counts}`;
23198
23373
  }
23199
23374
  if (options.inlineMap) {
23200
23375
  const outputFilename = options.outputFilename ?? (options.js ? filename2 + ".jsx" : filename2 + ".tsx");
23376
+ const outDir = dirname2(outputFilename);
23377
+ options.sourceMap.sourceFileName = relativePath(outDir, options.sourceMap.sourceFileName) || options.sourceMap.sourceFileName;
23378
+ const relativeOut = relativePath(outDir, outputFilename) || outputFilename;
23201
23379
  return `${code}
23202
- ${options.sourceMap.comment(outputFilename)}`;
23380
+ ${options.sourceMap.comment(relativeOut)}`;
23203
23381
  } else {
23204
23382
  return { code, sourceMap: options.sourceMap };
23205
23383
  }