@danielx/civet 0.6.28 → 0.6.30

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/README.md CHANGED
@@ -23,7 +23,7 @@ The modern way to write TypeScript.
23
23
  [Vite](https://github.com/lorefnon/vite-plugin-civet),
24
24
  -->
25
25
  [Babel](source/babel-plugin.mjs),
26
- [Gulp](integrations/gulp),
26
+ [Gulp](integration/gulp),
27
27
  [ESM module resolution](source/esm.civet),
28
28
  [CJS](register.js),
29
29
  [Bun](source/bun-civet.coffee)
package/dist/browser.js CHANGED
@@ -629,7 +629,8 @@ ${input.slice(result.pos)}
629
629
  aliasBinding(p.value, ref);
630
630
  } else {
631
631
  p.value = ref;
632
- p.children.push(": ", ref);
632
+ const index = p.children.indexOf(p.name);
633
+ p.children.splice(index + 1, 0, ": ", ref);
633
634
  }
634
635
  }
635
636
  function arrayElementHasTrailingComma(elementNode) {
@@ -1912,7 +1913,7 @@ ${input.slice(result.pos)}
1912
1913
  } else if (modifier.async) {
1913
1914
  modifier = [modifier.children[0][0], " function ", ...modifier.children.slice(1)];
1914
1915
  } else {
1915
- modifier = ["function ", ...modifier.children];
1916
+ modifier = ["function ", ...modifier.children || []];
1916
1917
  }
1917
1918
  } else {
1918
1919
  modifier = "function ";
@@ -1920,6 +1921,7 @@ ${input.slice(result.pos)}
1920
1921
  return {
1921
1922
  ...signature,
1922
1923
  id: signature.name,
1924
+ signature,
1923
1925
  type: "FunctionExpression",
1924
1926
  children: [
1925
1927
  [modifier, ...signature.children.slice(1)],
@@ -2061,40 +2063,31 @@ ${input.slice(result.pos)}
2061
2063
  f.ts = false;
2062
2064
  }
2063
2065
  }
2066
+ function processReturn(f, implicitReturns) {
2067
+ if (!processReturnValue(f) && implicitReturns) {
2068
+ const { signature, block } = f;
2069
+ const { modifier, name, returnType } = signature;
2070
+ const { async, set } = modifier;
2071
+ const isMethod = f.type === "MethodDefinition";
2072
+ const isConstructor = isMethod && name === "constructor";
2073
+ const isVoid = isVoidType(returnType?.t) || async && isPromiseVoidType(returnType?.t);
2074
+ const isBlock = block?.type === "BlockStatement";
2075
+ if (!isVoid && !set && !isConstructor && isBlock) {
2076
+ insertReturn(block);
2077
+ }
2078
+ }
2079
+ }
2064
2080
  function processFunctions(statements, config) {
2065
2081
  gatherRecursiveAll(statements, ({ type }) => type === "FunctionExpression" || type === "ArrowFunction").forEach((f) => {
2066
2082
  if (f.type === "FunctionExpression")
2067
2083
  implicitFunctionBlock(f);
2068
2084
  processParams(f);
2069
- if (!processReturnValue(f) && config.implicitReturns) {
2070
- const { async, block, returnType } = f;
2071
- const isVoid = isVoidType(returnType?.t) || async && isPromiseVoidType(returnType?.t);
2072
- const isBlock = block?.type === "BlockStatement";
2073
- if (!isVoid && isBlock) {
2074
- return insertReturn(block);
2075
- }
2076
- ;
2077
- return;
2078
- }
2079
- ;
2080
- return;
2085
+ return processReturn(f, config.implicitReturns);
2081
2086
  });
2082
2087
  gatherRecursiveAll(statements, ({ type }) => type === "MethodDefinition").forEach((f) => {
2083
2088
  implicitFunctionBlock(f);
2084
2089
  processParams(f);
2085
- if (!processReturnValue(f) && config.implicitReturns) {
2086
- const { signature, block } = f;
2087
- const isConstructor = signature.name === "constructor";
2088
- const isVoid = isVoidType(signature.returnType?.t);
2089
- const isSet = signature.modifier?.set;
2090
- if (!isConstructor && !isSet && !isVoid) {
2091
- return insertReturn(block);
2092
- }
2093
- ;
2094
- return;
2095
- }
2096
- ;
2097
- return;
2090
+ return processReturn(f, config.implicitReturns);
2098
2091
  });
2099
2092
  }
2100
2093
  function processSwitchExpressions(statements) {
@@ -3419,6 +3412,8 @@ ${input.slice(result.pos)}
3419
3412
  ReturnValue,
3420
3413
  AfterReturnShorthand,
3421
3414
  Parameters,
3415
+ ShortArrowParameters,
3416
+ ArrowParameters,
3422
3417
  NonEmptyParameters,
3423
3418
  FunctionRestParameter,
3424
3419
  ParameterElement,
@@ -3926,7 +3921,9 @@ ${input.slice(result.pos)}
3926
3921
  CivetPrologueContent,
3927
3922
  CivetOption,
3928
3923
  UnknownPrologue,
3924
+ TripleSlashDirective,
3929
3925
  DirectivePrologue,
3926
+ PrologueString,
3930
3927
  EOS,
3931
3928
  EOL,
3932
3929
  DebugHere,
@@ -4251,8 +4248,9 @@ ${input.slice(result.pos)}
4251
4248
  var $R62 = $R(new RegExp("[\\t ]*", "suy"));
4252
4249
  var $R63 = $R(new RegExp("[\\s]*", "suy"));
4253
4250
  var $R64 = $R(new RegExp("\\s+([+-]?)([a-zA-Z0-9-]+)(\\s*=\\s*([a-zA-Z0-9.+-]*))?", "suy"));
4254
- var $R65 = $R(new RegExp("\\r\\n|\\n|\\r|$", "suy"));
4255
- var $R66 = $R(new RegExp("[ \\t]*", "suy"));
4251
+ var $R65 = $R(new RegExp("\\/\\/\\/[^\\r\\n]*", "suy"));
4252
+ var $R66 = $R(new RegExp("\\r\\n|\\n|\\r|$", "suy"));
4253
+ var $R67 = $R(new RegExp("[ \\t]*", "suy"));
4256
4254
  var Program$0 = $TS($S(Reset, Init, $E(EOS), TopLevelStatements, __), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
4257
4255
  var statements = $4;
4258
4256
  processProgram({
@@ -4731,7 +4729,7 @@ ${input.slice(result.pos)}
4731
4729
  return $EVENT_C(ctx, state, "YieldTail", YieldTail$$);
4732
4730
  }
4733
4731
  var ArrowFunction$0 = ThinArrowFunction;
4734
- var ArrowFunction$1 = $TS($S($E($S(Async, _)), Parameters, $E(ReturnTypeSuffix), FatArrow, FatArrowBody), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
4732
+ var ArrowFunction$1 = $TS($S($E($S(Async, _)), ArrowParameters, $E(ReturnTypeSuffix), FatArrow, FatArrowBody), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
4735
4733
  var async = $1;
4736
4734
  var parameters = $2;
4737
4735
  var suffix = $3;
@@ -4748,6 +4746,11 @@ ${input.slice(result.pos)}
4748
4746
  }
4749
4747
  return {
4750
4748
  type: "ArrowFunction",
4749
+ signature: {
4750
+ modifier: {
4751
+ async: !!async
4752
+ }
4753
+ },
4751
4754
  parameters,
4752
4755
  returnType: suffix,
4753
4756
  ts: false,
@@ -4823,6 +4826,11 @@ ${input.slice(result.pos)}
4823
4826
  };
4824
4827
  return {
4825
4828
  type: "ArrowFunction",
4829
+ signature: {
4830
+ modifier: {
4831
+ children: []
4832
+ }
4833
+ },
4826
4834
  children: [ref, " => ", arrowBody],
4827
4835
  ref,
4828
4836
  body: [arrowBody],
@@ -5522,6 +5530,24 @@ ${input.slice(result.pos)}
5522
5530
  function Parameters(ctx, state) {
5523
5531
  return $EVENT_C(ctx, state, "Parameters", Parameters$$);
5524
5532
  }
5533
+ var ShortArrowParameters$0 = ObjectBindingPattern;
5534
+ var ShortArrowParameters$1 = ArrayBindingPattern;
5535
+ var ShortArrowParameters$$ = [ShortArrowParameters$0, ShortArrowParameters$1];
5536
+ function ShortArrowParameters(ctx, state) {
5537
+ return $EVENT_C(ctx, state, "ShortArrowParameters", ShortArrowParameters$$);
5538
+ }
5539
+ var ArrowParameters$0 = $TS($S(ShortArrowParameters), function($skip, $loc, $0, $1) {
5540
+ return {
5541
+ type: "Parameters",
5542
+ children: ["(", $0, ")"],
5543
+ names: $0.names
5544
+ };
5545
+ });
5546
+ var ArrowParameters$1 = Parameters;
5547
+ var ArrowParameters$$ = [ArrowParameters$0, ArrowParameters$1];
5548
+ function ArrowParameters(ctx, state) {
5549
+ return $EVENT_C(ctx, state, "ArrowParameters", ArrowParameters$$);
5550
+ }
5525
5551
  var NonEmptyParameters$0 = $TS($S($E(TypeParameters), OpenParen, $E(ThisType), $Q(ParameterElement), $E(FunctionRestParameter), $Q(ParameterElement), $S(__, CloseParen)), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7) {
5526
5552
  var tp = $1;
5527
5553
  var open = $2;
@@ -5966,6 +5992,10 @@ ${input.slice(result.pos)}
5966
5992
  ts: false,
5967
5993
  async,
5968
5994
  generator,
5995
+ modifier: {
5996
+ async: !async.length,
5997
+ generator: !generator.length
5998
+ },
5969
5999
  block: null,
5970
6000
  children: !parameters.implicit ? [async, func, generator, wid, w, parameters, suffix] : [async, func, generator, wid, parameters, w, suffix]
5971
6001
  };
@@ -5980,6 +6010,7 @@ ${input.slice(result.pos)}
5980
6010
  return {
5981
6011
  ...signature,
5982
6012
  type: "FunctionExpression",
6013
+ signature,
5983
6014
  ts: true
5984
6015
  };
5985
6016
  }
@@ -5992,6 +6023,7 @@ ${input.slice(result.pos)}
5992
6023
  return {
5993
6024
  ...signature,
5994
6025
  type: "FunctionExpression",
6026
+ signature,
5995
6027
  children: [...signature.children, block],
5996
6028
  block
5997
6029
  };
@@ -6000,6 +6032,9 @@ ${input.slice(result.pos)}
6000
6032
  const ref = makeRef("$"), body = [ref];
6001
6033
  return {
6002
6034
  type: "ArrowFunction",
6035
+ signature: {
6036
+ modifier: {}
6037
+ },
6003
6038
  children: [ref, " => ", body],
6004
6039
  ref,
6005
6040
  body,
@@ -6011,7 +6046,6 @@ ${input.slice(result.pos)}
6011
6046
  var id = $1;
6012
6047
  var ws = $4;
6013
6048
  var fn = $5;
6014
- debugger;
6015
6049
  return {
6016
6050
  ...fn,
6017
6051
  id,
@@ -6048,11 +6082,17 @@ ${input.slice(result.pos)}
6048
6082
  };
6049
6083
  }
6050
6084
  const children = [ref, " => ", body];
6051
- if (hasAwait(body)) {
6085
+ const async = hasAwait(body);
6086
+ if (async) {
6052
6087
  children.unshift("async ");
6053
6088
  }
6054
6089
  return {
6055
6090
  type: "ArrowFunction",
6091
+ signature: {
6092
+ modifier: {
6093
+ async
6094
+ }
6095
+ },
6056
6096
  children,
6057
6097
  ref,
6058
6098
  body,
@@ -6076,6 +6116,7 @@ ${input.slice(result.pos)}
6076
6116
  return {
6077
6117
  ...signature,
6078
6118
  type: "FunctionExpression",
6119
+ signature,
6079
6120
  children: [...signature.children, block],
6080
6121
  block,
6081
6122
  operator: true
@@ -6110,6 +6151,7 @@ ${input.slice(result.pos)}
6110
6151
  return {
6111
6152
  type: "FunctionSignature",
6112
6153
  id,
6154
+ modifier: {},
6113
6155
  parameters,
6114
6156
  returnType: suffix,
6115
6157
  ts: false,
@@ -6162,7 +6204,7 @@ ${input.slice(result.pos)}
6162
6204
  function AmpersandUnaryPrefix(ctx, state) {
6163
6205
  return $EVENT(ctx, state, "AmpersandUnaryPrefix", AmpersandUnaryPrefix$0);
6164
6206
  }
6165
- var ThinArrowFunction$0 = $TS($S($E($S(Async, _)), Parameters, $E(ReturnTypeSuffix), $E(_), Arrow, BracedOrEmptyBlock), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
6207
+ var ThinArrowFunction$0 = $TS($S($E($S(Async, _)), ArrowParameters, $E(ReturnTypeSuffix), $E(_), Arrow, BracedOrEmptyBlock), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
6166
6208
  var async = $1;
6167
6209
  var parameters = $2;
6168
6210
  var suffix = $3;
@@ -6184,6 +6226,14 @@ ${input.slice(result.pos)}
6184
6226
  async,
6185
6227
  generator,
6186
6228
  block,
6229
+ signature: {
6230
+ name: void 0,
6231
+ modifier: {
6232
+ async: !!async,
6233
+ generator: !!generator
6234
+ },
6235
+ returnType: suffix
6236
+ },
6187
6237
  children: [
6188
6238
  async,
6189
6239
  { $loc: arrow.$loc, token: "function" },
@@ -7247,6 +7297,7 @@ ${input.slice(result.pos)}
7247
7297
  type: "MethodSignature",
7248
7298
  children: $0,
7249
7299
  name: $1.token,
7300
+ modifier: {},
7250
7301
  returnType: void 0,
7251
7302
  parameters
7252
7303
  };
@@ -7264,6 +7315,7 @@ ${input.slice(result.pos)}
7264
7315
  }
7265
7316
  if (optional)
7266
7317
  $0[3] = optional = { ...optional, ts: true };
7318
+ modifier = modifier || {};
7267
7319
  return {
7268
7320
  type: "MethodSignature",
7269
7321
  children: $0,
@@ -11595,11 +11647,11 @@ ${input.slice(result.pos)}
11595
11647
  function Shebang(ctx, state) {
11596
11648
  return $EVENT(ctx, state, "Shebang", Shebang$0);
11597
11649
  }
11598
- var CivetPrologue$0 = $T($S($EXPECT($R62, "CivetPrologue /[\\t ]*/"), DoubleQuote, CivetPrologueContent, DoubleQuote, $TEXT(SimpleStatementDelimiter), $E(EOS)), function(value) {
11650
+ var CivetPrologue$0 = $T($S($EXPECT($R62, "CivetPrologue /[\\t ]*/"), DoubleQuote, CivetPrologueContent, DoubleQuote, SimpleStatementDelimiter, $E(EOS)), function(value) {
11599
11651
  var content = value[2];
11600
11652
  return content;
11601
11653
  });
11602
- var CivetPrologue$1 = $T($S($EXPECT($R62, "CivetPrologue /[\\t ]*/"), SingleQuote, CivetPrologueContent, SingleQuote, $TEXT(SimpleStatementDelimiter), $E(EOS)), function(value) {
11654
+ var CivetPrologue$1 = $T($S($EXPECT($R62, "CivetPrologue /[\\t ]*/"), SingleQuote, CivetPrologueContent, SingleQuote, SimpleStatementDelimiter, $E(EOS)), function(value) {
11603
11655
  var content = value[2];
11604
11656
  return content;
11605
11657
  });
@@ -11639,17 +11691,25 @@ ${input.slice(result.pos)}
11639
11691
  function UnknownPrologue(ctx, state) {
11640
11692
  return $EVENT(ctx, state, "UnknownPrologue", UnknownPrologue$0);
11641
11693
  }
11642
- var DirectivePrologue$0 = CivetPrologue;
11643
- var DirectivePrologue$1 = UnknownPrologue;
11644
- var DirectivePrologue$$ = [DirectivePrologue$0, DirectivePrologue$1];
11694
+ var TripleSlashDirective$0 = $S($R$0($EXPECT($R65, "TripleSlashDirective /\\/\\/\\/[^\\r\\n]*/")), $E(EOS));
11695
+ function TripleSlashDirective(ctx, state) {
11696
+ return $EVENT(ctx, state, "TripleSlashDirective", TripleSlashDirective$0);
11697
+ }
11698
+ var DirectivePrologue$0 = PrologueString;
11645
11699
  function DirectivePrologue(ctx, state) {
11646
- return $EVENT_C(ctx, state, "DirectivePrologue", DirectivePrologue$$);
11700
+ return $EVENT(ctx, state, "DirectivePrologue", DirectivePrologue$0);
11701
+ }
11702
+ var PrologueString$0 = CivetPrologue;
11703
+ var PrologueString$1 = UnknownPrologue;
11704
+ var PrologueString$$ = [PrologueString$0, PrologueString$1];
11705
+ function PrologueString(ctx, state) {
11706
+ return $EVENT_C(ctx, state, "PrologueString", PrologueString$$);
11647
11707
  }
11648
11708
  var EOS$0 = $P(RestOfLine);
11649
11709
  function EOS(ctx, state) {
11650
11710
  return $EVENT(ctx, state, "EOS", EOS$0);
11651
11711
  }
11652
- var EOL$0 = $TR($EXPECT($R65, "EOL /\\r\\n|\\n|\\r|$/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
11712
+ var EOL$0 = $TR($EXPECT($R66, "EOL /\\r\\n|\\n|\\r|$/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
11653
11713
  return { $loc, token: $0 };
11654
11714
  });
11655
11715
  function EOL(ctx, state) {
@@ -12124,8 +12184,8 @@ ${input.slice(result.pos)}
12124
12184
  function Reset(ctx, state) {
12125
12185
  return $EVENT(ctx, state, "Reset", Reset$0);
12126
12186
  }
12127
- var Init$0 = $TS($S($E(Shebang), $Q(DirectivePrologue), $EXPECT($L0, 'Init ""')), function($skip, $loc, $0, $1, $2, $3) {
12128
- var directives = $2;
12187
+ var Init$0 = $TS($S($E(Shebang), $Q(TripleSlashDirective), $Q(DirectivePrologue)), function($skip, $loc, $0, $1, $2, $3) {
12188
+ var directives = $3;
12129
12189
  directives.forEach((directive) => {
12130
12190
  if (directive.type === "CivetPrologue") {
12131
12191
  Object.assign(module.config, directive.config);
@@ -12136,7 +12196,7 @@ ${input.slice(result.pos)}
12136
12196
  function Init(ctx, state) {
12137
12197
  return $EVENT(ctx, state, "Init", Init$0);
12138
12198
  }
12139
- var Indent$0 = $TR($EXPECT($R66, "Indent /[ \\t]*/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
12199
+ var Indent$0 = $TR($EXPECT($R67, "Indent /[ \\t]*/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
12140
12200
  let level;
12141
12201
  if (module.config.tab) {
12142
12202
  const tabs = $0.match(/\t/g);
@@ -12360,6 +12420,8 @@ ${input.slice(result.pos)}
12360
12420
  exports.ReturnValue = ReturnValue;
12361
12421
  exports.AfterReturnShorthand = AfterReturnShorthand;
12362
12422
  exports.Parameters = Parameters;
12423
+ exports.ShortArrowParameters = ShortArrowParameters;
12424
+ exports.ArrowParameters = ArrowParameters;
12363
12425
  exports.NonEmptyParameters = NonEmptyParameters;
12364
12426
  exports.FunctionRestParameter = FunctionRestParameter;
12365
12427
  exports.ParameterElement = ParameterElement;
@@ -12867,7 +12929,9 @@ ${input.slice(result.pos)}
12867
12929
  exports.CivetPrologueContent = CivetPrologueContent;
12868
12930
  exports.CivetOption = CivetOption;
12869
12931
  exports.UnknownPrologue = UnknownPrologue;
12932
+ exports.TripleSlashDirective = TripleSlashDirective;
12870
12933
  exports.DirectivePrologue = DirectivePrologue;
12934
+ exports.PrologueString = PrologueString;
12871
12935
  exports.EOS = EOS;
12872
12936
  exports.EOL = EOL;
12873
12937
  exports.DebugHere = DebugHere;
package/dist/main.js CHANGED
@@ -628,7 +628,8 @@ var require_lib = __commonJS({
628
628
  aliasBinding(p.value, ref);
629
629
  } else {
630
630
  p.value = ref;
631
- p.children.push(": ", ref);
631
+ const index = p.children.indexOf(p.name);
632
+ p.children.splice(index + 1, 0, ": ", ref);
632
633
  }
633
634
  }
634
635
  function arrayElementHasTrailingComma(elementNode) {
@@ -1911,7 +1912,7 @@ var require_lib = __commonJS({
1911
1912
  } else if (modifier.async) {
1912
1913
  modifier = [modifier.children[0][0], " function ", ...modifier.children.slice(1)];
1913
1914
  } else {
1914
- modifier = ["function ", ...modifier.children];
1915
+ modifier = ["function ", ...modifier.children || []];
1915
1916
  }
1916
1917
  } else {
1917
1918
  modifier = "function ";
@@ -1919,6 +1920,7 @@ var require_lib = __commonJS({
1919
1920
  return {
1920
1921
  ...signature,
1921
1922
  id: signature.name,
1923
+ signature,
1922
1924
  type: "FunctionExpression",
1923
1925
  children: [
1924
1926
  [modifier, ...signature.children.slice(1)],
@@ -2060,40 +2062,31 @@ var require_lib = __commonJS({
2060
2062
  f.ts = false;
2061
2063
  }
2062
2064
  }
2065
+ function processReturn(f, implicitReturns) {
2066
+ if (!processReturnValue(f) && implicitReturns) {
2067
+ const { signature, block } = f;
2068
+ const { modifier, name, returnType } = signature;
2069
+ const { async, set } = modifier;
2070
+ const isMethod = f.type === "MethodDefinition";
2071
+ const isConstructor = isMethod && name === "constructor";
2072
+ const isVoid = isVoidType(returnType?.t) || async && isPromiseVoidType(returnType?.t);
2073
+ const isBlock = block?.type === "BlockStatement";
2074
+ if (!isVoid && !set && !isConstructor && isBlock) {
2075
+ insertReturn(block);
2076
+ }
2077
+ }
2078
+ }
2063
2079
  function processFunctions(statements, config) {
2064
2080
  gatherRecursiveAll(statements, ({ type }) => type === "FunctionExpression" || type === "ArrowFunction").forEach((f) => {
2065
2081
  if (f.type === "FunctionExpression")
2066
2082
  implicitFunctionBlock(f);
2067
2083
  processParams(f);
2068
- if (!processReturnValue(f) && config.implicitReturns) {
2069
- const { async, block, returnType } = f;
2070
- const isVoid = isVoidType(returnType?.t) || async && isPromiseVoidType(returnType?.t);
2071
- const isBlock = block?.type === "BlockStatement";
2072
- if (!isVoid && isBlock) {
2073
- return insertReturn(block);
2074
- }
2075
- ;
2076
- return;
2077
- }
2078
- ;
2079
- return;
2084
+ return processReturn(f, config.implicitReturns);
2080
2085
  });
2081
2086
  gatherRecursiveAll(statements, ({ type }) => type === "MethodDefinition").forEach((f) => {
2082
2087
  implicitFunctionBlock(f);
2083
2088
  processParams(f);
2084
- if (!processReturnValue(f) && config.implicitReturns) {
2085
- const { signature, block } = f;
2086
- const isConstructor = signature.name === "constructor";
2087
- const isVoid = isVoidType(signature.returnType?.t);
2088
- const isSet = signature.modifier?.set;
2089
- if (!isConstructor && !isSet && !isVoid) {
2090
- return insertReturn(block);
2091
- }
2092
- ;
2093
- return;
2094
- }
2095
- ;
2096
- return;
2089
+ return processReturn(f, config.implicitReturns);
2097
2090
  });
2098
2091
  }
2099
2092
  function processSwitchExpressions(statements) {
@@ -3418,6 +3411,8 @@ var require_parser = __commonJS({
3418
3411
  ReturnValue,
3419
3412
  AfterReturnShorthand,
3420
3413
  Parameters,
3414
+ ShortArrowParameters,
3415
+ ArrowParameters,
3421
3416
  NonEmptyParameters,
3422
3417
  FunctionRestParameter,
3423
3418
  ParameterElement,
@@ -3925,7 +3920,9 @@ var require_parser = __commonJS({
3925
3920
  CivetPrologueContent,
3926
3921
  CivetOption,
3927
3922
  UnknownPrologue,
3923
+ TripleSlashDirective,
3928
3924
  DirectivePrologue,
3925
+ PrologueString,
3929
3926
  EOS,
3930
3927
  EOL,
3931
3928
  DebugHere,
@@ -4250,8 +4247,9 @@ var require_parser = __commonJS({
4250
4247
  var $R62 = $R(new RegExp("[\\t ]*", "suy"));
4251
4248
  var $R63 = $R(new RegExp("[\\s]*", "suy"));
4252
4249
  var $R64 = $R(new RegExp("\\s+([+-]?)([a-zA-Z0-9-]+)(\\s*=\\s*([a-zA-Z0-9.+-]*))?", "suy"));
4253
- var $R65 = $R(new RegExp("\\r\\n|\\n|\\r|$", "suy"));
4254
- var $R66 = $R(new RegExp("[ \\t]*", "suy"));
4250
+ var $R65 = $R(new RegExp("\\/\\/\\/[^\\r\\n]*", "suy"));
4251
+ var $R66 = $R(new RegExp("\\r\\n|\\n|\\r|$", "suy"));
4252
+ var $R67 = $R(new RegExp("[ \\t]*", "suy"));
4255
4253
  var Program$0 = $TS($S(Reset, Init, $E(EOS), TopLevelStatements, __), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
4256
4254
  var statements = $4;
4257
4255
  processProgram({
@@ -4730,7 +4728,7 @@ var require_parser = __commonJS({
4730
4728
  return $EVENT_C(ctx, state, "YieldTail", YieldTail$$);
4731
4729
  }
4732
4730
  var ArrowFunction$0 = ThinArrowFunction;
4733
- var ArrowFunction$1 = $TS($S($E($S(Async, _)), Parameters, $E(ReturnTypeSuffix), FatArrow, FatArrowBody), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
4731
+ var ArrowFunction$1 = $TS($S($E($S(Async, _)), ArrowParameters, $E(ReturnTypeSuffix), FatArrow, FatArrowBody), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
4734
4732
  var async = $1;
4735
4733
  var parameters = $2;
4736
4734
  var suffix = $3;
@@ -4747,6 +4745,11 @@ var require_parser = __commonJS({
4747
4745
  }
4748
4746
  return {
4749
4747
  type: "ArrowFunction",
4748
+ signature: {
4749
+ modifier: {
4750
+ async: !!async
4751
+ }
4752
+ },
4750
4753
  parameters,
4751
4754
  returnType: suffix,
4752
4755
  ts: false,
@@ -4822,6 +4825,11 @@ var require_parser = __commonJS({
4822
4825
  };
4823
4826
  return {
4824
4827
  type: "ArrowFunction",
4828
+ signature: {
4829
+ modifier: {
4830
+ children: []
4831
+ }
4832
+ },
4825
4833
  children: [ref, " => ", arrowBody],
4826
4834
  ref,
4827
4835
  body: [arrowBody],
@@ -5521,6 +5529,24 @@ var require_parser = __commonJS({
5521
5529
  function Parameters(ctx, state) {
5522
5530
  return $EVENT_C(ctx, state, "Parameters", Parameters$$);
5523
5531
  }
5532
+ var ShortArrowParameters$0 = ObjectBindingPattern;
5533
+ var ShortArrowParameters$1 = ArrayBindingPattern;
5534
+ var ShortArrowParameters$$ = [ShortArrowParameters$0, ShortArrowParameters$1];
5535
+ function ShortArrowParameters(ctx, state) {
5536
+ return $EVENT_C(ctx, state, "ShortArrowParameters", ShortArrowParameters$$);
5537
+ }
5538
+ var ArrowParameters$0 = $TS($S(ShortArrowParameters), function($skip, $loc, $0, $1) {
5539
+ return {
5540
+ type: "Parameters",
5541
+ children: ["(", $0, ")"],
5542
+ names: $0.names
5543
+ };
5544
+ });
5545
+ var ArrowParameters$1 = Parameters;
5546
+ var ArrowParameters$$ = [ArrowParameters$0, ArrowParameters$1];
5547
+ function ArrowParameters(ctx, state) {
5548
+ return $EVENT_C(ctx, state, "ArrowParameters", ArrowParameters$$);
5549
+ }
5524
5550
  var NonEmptyParameters$0 = $TS($S($E(TypeParameters), OpenParen, $E(ThisType), $Q(ParameterElement), $E(FunctionRestParameter), $Q(ParameterElement), $S(__, CloseParen)), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7) {
5525
5551
  var tp = $1;
5526
5552
  var open = $2;
@@ -5965,6 +5991,10 @@ var require_parser = __commonJS({
5965
5991
  ts: false,
5966
5992
  async,
5967
5993
  generator,
5994
+ modifier: {
5995
+ async: !async.length,
5996
+ generator: !generator.length
5997
+ },
5968
5998
  block: null,
5969
5999
  children: !parameters.implicit ? [async, func, generator, wid, w, parameters, suffix] : [async, func, generator, wid, parameters, w, suffix]
5970
6000
  };
@@ -5979,6 +6009,7 @@ var require_parser = __commonJS({
5979
6009
  return {
5980
6010
  ...signature,
5981
6011
  type: "FunctionExpression",
6012
+ signature,
5982
6013
  ts: true
5983
6014
  };
5984
6015
  }
@@ -5991,6 +6022,7 @@ var require_parser = __commonJS({
5991
6022
  return {
5992
6023
  ...signature,
5993
6024
  type: "FunctionExpression",
6025
+ signature,
5994
6026
  children: [...signature.children, block],
5995
6027
  block
5996
6028
  };
@@ -5999,6 +6031,9 @@ var require_parser = __commonJS({
5999
6031
  const ref = makeRef("$"), body = [ref];
6000
6032
  return {
6001
6033
  type: "ArrowFunction",
6034
+ signature: {
6035
+ modifier: {}
6036
+ },
6002
6037
  children: [ref, " => ", body],
6003
6038
  ref,
6004
6039
  body,
@@ -6010,7 +6045,6 @@ var require_parser = __commonJS({
6010
6045
  var id = $1;
6011
6046
  var ws = $4;
6012
6047
  var fn = $5;
6013
- debugger;
6014
6048
  return {
6015
6049
  ...fn,
6016
6050
  id,
@@ -6047,11 +6081,17 @@ var require_parser = __commonJS({
6047
6081
  };
6048
6082
  }
6049
6083
  const children = [ref, " => ", body];
6050
- if (hasAwait(body)) {
6084
+ const async = hasAwait(body);
6085
+ if (async) {
6051
6086
  children.unshift("async ");
6052
6087
  }
6053
6088
  return {
6054
6089
  type: "ArrowFunction",
6090
+ signature: {
6091
+ modifier: {
6092
+ async
6093
+ }
6094
+ },
6055
6095
  children,
6056
6096
  ref,
6057
6097
  body,
@@ -6075,6 +6115,7 @@ var require_parser = __commonJS({
6075
6115
  return {
6076
6116
  ...signature,
6077
6117
  type: "FunctionExpression",
6118
+ signature,
6078
6119
  children: [...signature.children, block],
6079
6120
  block,
6080
6121
  operator: true
@@ -6109,6 +6150,7 @@ var require_parser = __commonJS({
6109
6150
  return {
6110
6151
  type: "FunctionSignature",
6111
6152
  id,
6153
+ modifier: {},
6112
6154
  parameters,
6113
6155
  returnType: suffix,
6114
6156
  ts: false,
@@ -6161,7 +6203,7 @@ var require_parser = __commonJS({
6161
6203
  function AmpersandUnaryPrefix(ctx, state) {
6162
6204
  return $EVENT(ctx, state, "AmpersandUnaryPrefix", AmpersandUnaryPrefix$0);
6163
6205
  }
6164
- var ThinArrowFunction$0 = $TS($S($E($S(Async, _)), Parameters, $E(ReturnTypeSuffix), $E(_), Arrow, BracedOrEmptyBlock), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
6206
+ var ThinArrowFunction$0 = $TS($S($E($S(Async, _)), ArrowParameters, $E(ReturnTypeSuffix), $E(_), Arrow, BracedOrEmptyBlock), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
6165
6207
  var async = $1;
6166
6208
  var parameters = $2;
6167
6209
  var suffix = $3;
@@ -6183,6 +6225,14 @@ var require_parser = __commonJS({
6183
6225
  async,
6184
6226
  generator,
6185
6227
  block,
6228
+ signature: {
6229
+ name: void 0,
6230
+ modifier: {
6231
+ async: !!async,
6232
+ generator: !!generator
6233
+ },
6234
+ returnType: suffix
6235
+ },
6186
6236
  children: [
6187
6237
  async,
6188
6238
  { $loc: arrow.$loc, token: "function" },
@@ -7246,6 +7296,7 @@ var require_parser = __commonJS({
7246
7296
  type: "MethodSignature",
7247
7297
  children: $0,
7248
7298
  name: $1.token,
7299
+ modifier: {},
7249
7300
  returnType: void 0,
7250
7301
  parameters
7251
7302
  };
@@ -7263,6 +7314,7 @@ var require_parser = __commonJS({
7263
7314
  }
7264
7315
  if (optional)
7265
7316
  $0[3] = optional = { ...optional, ts: true };
7317
+ modifier = modifier || {};
7266
7318
  return {
7267
7319
  type: "MethodSignature",
7268
7320
  children: $0,
@@ -11594,11 +11646,11 @@ var require_parser = __commonJS({
11594
11646
  function Shebang(ctx, state) {
11595
11647
  return $EVENT(ctx, state, "Shebang", Shebang$0);
11596
11648
  }
11597
- var CivetPrologue$0 = $T($S($EXPECT($R62, "CivetPrologue /[\\t ]*/"), DoubleQuote, CivetPrologueContent, DoubleQuote, $TEXT(SimpleStatementDelimiter), $E(EOS)), function(value) {
11649
+ var CivetPrologue$0 = $T($S($EXPECT($R62, "CivetPrologue /[\\t ]*/"), DoubleQuote, CivetPrologueContent, DoubleQuote, SimpleStatementDelimiter, $E(EOS)), function(value) {
11598
11650
  var content = value[2];
11599
11651
  return content;
11600
11652
  });
11601
- var CivetPrologue$1 = $T($S($EXPECT($R62, "CivetPrologue /[\\t ]*/"), SingleQuote, CivetPrologueContent, SingleQuote, $TEXT(SimpleStatementDelimiter), $E(EOS)), function(value) {
11653
+ var CivetPrologue$1 = $T($S($EXPECT($R62, "CivetPrologue /[\\t ]*/"), SingleQuote, CivetPrologueContent, SingleQuote, SimpleStatementDelimiter, $E(EOS)), function(value) {
11602
11654
  var content = value[2];
11603
11655
  return content;
11604
11656
  });
@@ -11638,17 +11690,25 @@ var require_parser = __commonJS({
11638
11690
  function UnknownPrologue(ctx, state) {
11639
11691
  return $EVENT(ctx, state, "UnknownPrologue", UnknownPrologue$0);
11640
11692
  }
11641
- var DirectivePrologue$0 = CivetPrologue;
11642
- var DirectivePrologue$1 = UnknownPrologue;
11643
- var DirectivePrologue$$ = [DirectivePrologue$0, DirectivePrologue$1];
11693
+ var TripleSlashDirective$0 = $S($R$0($EXPECT($R65, "TripleSlashDirective /\\/\\/\\/[^\\r\\n]*/")), $E(EOS));
11694
+ function TripleSlashDirective(ctx, state) {
11695
+ return $EVENT(ctx, state, "TripleSlashDirective", TripleSlashDirective$0);
11696
+ }
11697
+ var DirectivePrologue$0 = PrologueString;
11644
11698
  function DirectivePrologue(ctx, state) {
11645
- return $EVENT_C(ctx, state, "DirectivePrologue", DirectivePrologue$$);
11699
+ return $EVENT(ctx, state, "DirectivePrologue", DirectivePrologue$0);
11700
+ }
11701
+ var PrologueString$0 = CivetPrologue;
11702
+ var PrologueString$1 = UnknownPrologue;
11703
+ var PrologueString$$ = [PrologueString$0, PrologueString$1];
11704
+ function PrologueString(ctx, state) {
11705
+ return $EVENT_C(ctx, state, "PrologueString", PrologueString$$);
11646
11706
  }
11647
11707
  var EOS$0 = $P(RestOfLine);
11648
11708
  function EOS(ctx, state) {
11649
11709
  return $EVENT(ctx, state, "EOS", EOS$0);
11650
11710
  }
11651
- var EOL$0 = $TR($EXPECT($R65, "EOL /\\r\\n|\\n|\\r|$/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
11711
+ var EOL$0 = $TR($EXPECT($R66, "EOL /\\r\\n|\\n|\\r|$/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
11652
11712
  return { $loc, token: $0 };
11653
11713
  });
11654
11714
  function EOL(ctx, state) {
@@ -12123,8 +12183,8 @@ var require_parser = __commonJS({
12123
12183
  function Reset(ctx, state) {
12124
12184
  return $EVENT(ctx, state, "Reset", Reset$0);
12125
12185
  }
12126
- var Init$0 = $TS($S($E(Shebang), $Q(DirectivePrologue), $EXPECT($L0, 'Init ""')), function($skip, $loc, $0, $1, $2, $3) {
12127
- var directives = $2;
12186
+ var Init$0 = $TS($S($E(Shebang), $Q(TripleSlashDirective), $Q(DirectivePrologue)), function($skip, $loc, $0, $1, $2, $3) {
12187
+ var directives = $3;
12128
12188
  directives.forEach((directive) => {
12129
12189
  if (directive.type === "CivetPrologue") {
12130
12190
  Object.assign(module2.config, directive.config);
@@ -12135,7 +12195,7 @@ var require_parser = __commonJS({
12135
12195
  function Init(ctx, state) {
12136
12196
  return $EVENT(ctx, state, "Init", Init$0);
12137
12197
  }
12138
- var Indent$0 = $TR($EXPECT($R66, "Indent /[ \\t]*/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
12198
+ var Indent$0 = $TR($EXPECT($R67, "Indent /[ \\t]*/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
12139
12199
  let level;
12140
12200
  if (module2.config.tab) {
12141
12201
  const tabs = $0.match(/\t/g);
@@ -12359,6 +12419,8 @@ var require_parser = __commonJS({
12359
12419
  exports.ReturnValue = ReturnValue;
12360
12420
  exports.AfterReturnShorthand = AfterReturnShorthand;
12361
12421
  exports.Parameters = Parameters;
12422
+ exports.ShortArrowParameters = ShortArrowParameters;
12423
+ exports.ArrowParameters = ArrowParameters;
12362
12424
  exports.NonEmptyParameters = NonEmptyParameters;
12363
12425
  exports.FunctionRestParameter = FunctionRestParameter;
12364
12426
  exports.ParameterElement = ParameterElement;
@@ -12866,7 +12928,9 @@ var require_parser = __commonJS({
12866
12928
  exports.CivetPrologueContent = CivetPrologueContent;
12867
12929
  exports.CivetOption = CivetOption;
12868
12930
  exports.UnknownPrologue = UnknownPrologue;
12931
+ exports.TripleSlashDirective = TripleSlashDirective;
12869
12932
  exports.DirectivePrologue = DirectivePrologue;
12933
+ exports.PrologueString = PrologueString;
12870
12934
  exports.EOS = EOS;
12871
12935
  exports.EOL = EOL;
12872
12936
  exports.DebugHere = DebugHere;
package/dist/main.mjs CHANGED
@@ -626,7 +626,8 @@ var require_lib = __commonJS({
626
626
  aliasBinding(p.value, ref);
627
627
  } else {
628
628
  p.value = ref;
629
- p.children.push(": ", ref);
629
+ const index = p.children.indexOf(p.name);
630
+ p.children.splice(index + 1, 0, ": ", ref);
630
631
  }
631
632
  }
632
633
  function arrayElementHasTrailingComma(elementNode) {
@@ -1909,7 +1910,7 @@ var require_lib = __commonJS({
1909
1910
  } else if (modifier.async) {
1910
1911
  modifier = [modifier.children[0][0], " function ", ...modifier.children.slice(1)];
1911
1912
  } else {
1912
- modifier = ["function ", ...modifier.children];
1913
+ modifier = ["function ", ...modifier.children || []];
1913
1914
  }
1914
1915
  } else {
1915
1916
  modifier = "function ";
@@ -1917,6 +1918,7 @@ var require_lib = __commonJS({
1917
1918
  return {
1918
1919
  ...signature,
1919
1920
  id: signature.name,
1921
+ signature,
1920
1922
  type: "FunctionExpression",
1921
1923
  children: [
1922
1924
  [modifier, ...signature.children.slice(1)],
@@ -2058,40 +2060,31 @@ var require_lib = __commonJS({
2058
2060
  f.ts = false;
2059
2061
  }
2060
2062
  }
2063
+ function processReturn(f, implicitReturns) {
2064
+ if (!processReturnValue(f) && implicitReturns) {
2065
+ const { signature, block } = f;
2066
+ const { modifier, name, returnType } = signature;
2067
+ const { async, set } = modifier;
2068
+ const isMethod = f.type === "MethodDefinition";
2069
+ const isConstructor = isMethod && name === "constructor";
2070
+ const isVoid = isVoidType(returnType?.t) || async && isPromiseVoidType(returnType?.t);
2071
+ const isBlock = block?.type === "BlockStatement";
2072
+ if (!isVoid && !set && !isConstructor && isBlock) {
2073
+ insertReturn(block);
2074
+ }
2075
+ }
2076
+ }
2061
2077
  function processFunctions(statements, config) {
2062
2078
  gatherRecursiveAll(statements, ({ type }) => type === "FunctionExpression" || type === "ArrowFunction").forEach((f) => {
2063
2079
  if (f.type === "FunctionExpression")
2064
2080
  implicitFunctionBlock(f);
2065
2081
  processParams(f);
2066
- if (!processReturnValue(f) && config.implicitReturns) {
2067
- const { async, block, returnType } = f;
2068
- const isVoid = isVoidType(returnType?.t) || async && isPromiseVoidType(returnType?.t);
2069
- const isBlock = block?.type === "BlockStatement";
2070
- if (!isVoid && isBlock) {
2071
- return insertReturn(block);
2072
- }
2073
- ;
2074
- return;
2075
- }
2076
- ;
2077
- return;
2082
+ return processReturn(f, config.implicitReturns);
2078
2083
  });
2079
2084
  gatherRecursiveAll(statements, ({ type }) => type === "MethodDefinition").forEach((f) => {
2080
2085
  implicitFunctionBlock(f);
2081
2086
  processParams(f);
2082
- if (!processReturnValue(f) && config.implicitReturns) {
2083
- const { signature, block } = f;
2084
- const isConstructor = signature.name === "constructor";
2085
- const isVoid = isVoidType(signature.returnType?.t);
2086
- const isSet = signature.modifier?.set;
2087
- if (!isConstructor && !isSet && !isVoid) {
2088
- return insertReturn(block);
2089
- }
2090
- ;
2091
- return;
2092
- }
2093
- ;
2094
- return;
2087
+ return processReturn(f, config.implicitReturns);
2095
2088
  });
2096
2089
  }
2097
2090
  function processSwitchExpressions(statements) {
@@ -3416,6 +3409,8 @@ var require_parser = __commonJS({
3416
3409
  ReturnValue,
3417
3410
  AfterReturnShorthand,
3418
3411
  Parameters,
3412
+ ShortArrowParameters,
3413
+ ArrowParameters,
3419
3414
  NonEmptyParameters,
3420
3415
  FunctionRestParameter,
3421
3416
  ParameterElement,
@@ -3923,7 +3918,9 @@ var require_parser = __commonJS({
3923
3918
  CivetPrologueContent,
3924
3919
  CivetOption,
3925
3920
  UnknownPrologue,
3921
+ TripleSlashDirective,
3926
3922
  DirectivePrologue,
3923
+ PrologueString,
3927
3924
  EOS,
3928
3925
  EOL,
3929
3926
  DebugHere,
@@ -4248,8 +4245,9 @@ var require_parser = __commonJS({
4248
4245
  var $R62 = $R(new RegExp("[\\t ]*", "suy"));
4249
4246
  var $R63 = $R(new RegExp("[\\s]*", "suy"));
4250
4247
  var $R64 = $R(new RegExp("\\s+([+-]?)([a-zA-Z0-9-]+)(\\s*=\\s*([a-zA-Z0-9.+-]*))?", "suy"));
4251
- var $R65 = $R(new RegExp("\\r\\n|\\n|\\r|$", "suy"));
4252
- var $R66 = $R(new RegExp("[ \\t]*", "suy"));
4248
+ var $R65 = $R(new RegExp("\\/\\/\\/[^\\r\\n]*", "suy"));
4249
+ var $R66 = $R(new RegExp("\\r\\n|\\n|\\r|$", "suy"));
4250
+ var $R67 = $R(new RegExp("[ \\t]*", "suy"));
4253
4251
  var Program$0 = $TS($S(Reset, Init, $E(EOS), TopLevelStatements, __), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
4254
4252
  var statements = $4;
4255
4253
  processProgram({
@@ -4728,7 +4726,7 @@ var require_parser = __commonJS({
4728
4726
  return $EVENT_C(ctx, state, "YieldTail", YieldTail$$);
4729
4727
  }
4730
4728
  var ArrowFunction$0 = ThinArrowFunction;
4731
- var ArrowFunction$1 = $TS($S($E($S(Async, _)), Parameters, $E(ReturnTypeSuffix), FatArrow, FatArrowBody), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
4729
+ var ArrowFunction$1 = $TS($S($E($S(Async, _)), ArrowParameters, $E(ReturnTypeSuffix), FatArrow, FatArrowBody), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
4732
4730
  var async = $1;
4733
4731
  var parameters = $2;
4734
4732
  var suffix = $3;
@@ -4745,6 +4743,11 @@ var require_parser = __commonJS({
4745
4743
  }
4746
4744
  return {
4747
4745
  type: "ArrowFunction",
4746
+ signature: {
4747
+ modifier: {
4748
+ async: !!async
4749
+ }
4750
+ },
4748
4751
  parameters,
4749
4752
  returnType: suffix,
4750
4753
  ts: false,
@@ -4820,6 +4823,11 @@ var require_parser = __commonJS({
4820
4823
  };
4821
4824
  return {
4822
4825
  type: "ArrowFunction",
4826
+ signature: {
4827
+ modifier: {
4828
+ children: []
4829
+ }
4830
+ },
4823
4831
  children: [ref, " => ", arrowBody],
4824
4832
  ref,
4825
4833
  body: [arrowBody],
@@ -5519,6 +5527,24 @@ var require_parser = __commonJS({
5519
5527
  function Parameters(ctx, state) {
5520
5528
  return $EVENT_C(ctx, state, "Parameters", Parameters$$);
5521
5529
  }
5530
+ var ShortArrowParameters$0 = ObjectBindingPattern;
5531
+ var ShortArrowParameters$1 = ArrayBindingPattern;
5532
+ var ShortArrowParameters$$ = [ShortArrowParameters$0, ShortArrowParameters$1];
5533
+ function ShortArrowParameters(ctx, state) {
5534
+ return $EVENT_C(ctx, state, "ShortArrowParameters", ShortArrowParameters$$);
5535
+ }
5536
+ var ArrowParameters$0 = $TS($S(ShortArrowParameters), function($skip, $loc, $0, $1) {
5537
+ return {
5538
+ type: "Parameters",
5539
+ children: ["(", $0, ")"],
5540
+ names: $0.names
5541
+ };
5542
+ });
5543
+ var ArrowParameters$1 = Parameters;
5544
+ var ArrowParameters$$ = [ArrowParameters$0, ArrowParameters$1];
5545
+ function ArrowParameters(ctx, state) {
5546
+ return $EVENT_C(ctx, state, "ArrowParameters", ArrowParameters$$);
5547
+ }
5522
5548
  var NonEmptyParameters$0 = $TS($S($E(TypeParameters), OpenParen, $E(ThisType), $Q(ParameterElement), $E(FunctionRestParameter), $Q(ParameterElement), $S(__, CloseParen)), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7) {
5523
5549
  var tp = $1;
5524
5550
  var open = $2;
@@ -5963,6 +5989,10 @@ var require_parser = __commonJS({
5963
5989
  ts: false,
5964
5990
  async,
5965
5991
  generator,
5992
+ modifier: {
5993
+ async: !async.length,
5994
+ generator: !generator.length
5995
+ },
5966
5996
  block: null,
5967
5997
  children: !parameters.implicit ? [async, func, generator, wid, w, parameters, suffix] : [async, func, generator, wid, parameters, w, suffix]
5968
5998
  };
@@ -5977,6 +6007,7 @@ var require_parser = __commonJS({
5977
6007
  return {
5978
6008
  ...signature,
5979
6009
  type: "FunctionExpression",
6010
+ signature,
5980
6011
  ts: true
5981
6012
  };
5982
6013
  }
@@ -5989,6 +6020,7 @@ var require_parser = __commonJS({
5989
6020
  return {
5990
6021
  ...signature,
5991
6022
  type: "FunctionExpression",
6023
+ signature,
5992
6024
  children: [...signature.children, block],
5993
6025
  block
5994
6026
  };
@@ -5997,6 +6029,9 @@ var require_parser = __commonJS({
5997
6029
  const ref = makeRef("$"), body = [ref];
5998
6030
  return {
5999
6031
  type: "ArrowFunction",
6032
+ signature: {
6033
+ modifier: {}
6034
+ },
6000
6035
  children: [ref, " => ", body],
6001
6036
  ref,
6002
6037
  body,
@@ -6008,7 +6043,6 @@ var require_parser = __commonJS({
6008
6043
  var id = $1;
6009
6044
  var ws = $4;
6010
6045
  var fn = $5;
6011
- debugger;
6012
6046
  return {
6013
6047
  ...fn,
6014
6048
  id,
@@ -6045,11 +6079,17 @@ var require_parser = __commonJS({
6045
6079
  };
6046
6080
  }
6047
6081
  const children = [ref, " => ", body];
6048
- if (hasAwait(body)) {
6082
+ const async = hasAwait(body);
6083
+ if (async) {
6049
6084
  children.unshift("async ");
6050
6085
  }
6051
6086
  return {
6052
6087
  type: "ArrowFunction",
6088
+ signature: {
6089
+ modifier: {
6090
+ async
6091
+ }
6092
+ },
6053
6093
  children,
6054
6094
  ref,
6055
6095
  body,
@@ -6073,6 +6113,7 @@ var require_parser = __commonJS({
6073
6113
  return {
6074
6114
  ...signature,
6075
6115
  type: "FunctionExpression",
6116
+ signature,
6076
6117
  children: [...signature.children, block],
6077
6118
  block,
6078
6119
  operator: true
@@ -6107,6 +6148,7 @@ var require_parser = __commonJS({
6107
6148
  return {
6108
6149
  type: "FunctionSignature",
6109
6150
  id,
6151
+ modifier: {},
6110
6152
  parameters,
6111
6153
  returnType: suffix,
6112
6154
  ts: false,
@@ -6159,7 +6201,7 @@ var require_parser = __commonJS({
6159
6201
  function AmpersandUnaryPrefix(ctx, state) {
6160
6202
  return $EVENT(ctx, state, "AmpersandUnaryPrefix", AmpersandUnaryPrefix$0);
6161
6203
  }
6162
- var ThinArrowFunction$0 = $TS($S($E($S(Async, _)), Parameters, $E(ReturnTypeSuffix), $E(_), Arrow, BracedOrEmptyBlock), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
6204
+ var ThinArrowFunction$0 = $TS($S($E($S(Async, _)), ArrowParameters, $E(ReturnTypeSuffix), $E(_), Arrow, BracedOrEmptyBlock), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
6163
6205
  var async = $1;
6164
6206
  var parameters = $2;
6165
6207
  var suffix = $3;
@@ -6181,6 +6223,14 @@ var require_parser = __commonJS({
6181
6223
  async,
6182
6224
  generator,
6183
6225
  block,
6226
+ signature: {
6227
+ name: void 0,
6228
+ modifier: {
6229
+ async: !!async,
6230
+ generator: !!generator
6231
+ },
6232
+ returnType: suffix
6233
+ },
6184
6234
  children: [
6185
6235
  async,
6186
6236
  { $loc: arrow.$loc, token: "function" },
@@ -7244,6 +7294,7 @@ var require_parser = __commonJS({
7244
7294
  type: "MethodSignature",
7245
7295
  children: $0,
7246
7296
  name: $1.token,
7297
+ modifier: {},
7247
7298
  returnType: void 0,
7248
7299
  parameters
7249
7300
  };
@@ -7261,6 +7312,7 @@ var require_parser = __commonJS({
7261
7312
  }
7262
7313
  if (optional)
7263
7314
  $0[3] = optional = { ...optional, ts: true };
7315
+ modifier = modifier || {};
7264
7316
  return {
7265
7317
  type: "MethodSignature",
7266
7318
  children: $0,
@@ -11592,11 +11644,11 @@ var require_parser = __commonJS({
11592
11644
  function Shebang(ctx, state) {
11593
11645
  return $EVENT(ctx, state, "Shebang", Shebang$0);
11594
11646
  }
11595
- var CivetPrologue$0 = $T($S($EXPECT($R62, "CivetPrologue /[\\t ]*/"), DoubleQuote, CivetPrologueContent, DoubleQuote, $TEXT(SimpleStatementDelimiter), $E(EOS)), function(value) {
11647
+ var CivetPrologue$0 = $T($S($EXPECT($R62, "CivetPrologue /[\\t ]*/"), DoubleQuote, CivetPrologueContent, DoubleQuote, SimpleStatementDelimiter, $E(EOS)), function(value) {
11596
11648
  var content = value[2];
11597
11649
  return content;
11598
11650
  });
11599
- var CivetPrologue$1 = $T($S($EXPECT($R62, "CivetPrologue /[\\t ]*/"), SingleQuote, CivetPrologueContent, SingleQuote, $TEXT(SimpleStatementDelimiter), $E(EOS)), function(value) {
11651
+ var CivetPrologue$1 = $T($S($EXPECT($R62, "CivetPrologue /[\\t ]*/"), SingleQuote, CivetPrologueContent, SingleQuote, SimpleStatementDelimiter, $E(EOS)), function(value) {
11600
11652
  var content = value[2];
11601
11653
  return content;
11602
11654
  });
@@ -11636,17 +11688,25 @@ var require_parser = __commonJS({
11636
11688
  function UnknownPrologue(ctx, state) {
11637
11689
  return $EVENT(ctx, state, "UnknownPrologue", UnknownPrologue$0);
11638
11690
  }
11639
- var DirectivePrologue$0 = CivetPrologue;
11640
- var DirectivePrologue$1 = UnknownPrologue;
11641
- var DirectivePrologue$$ = [DirectivePrologue$0, DirectivePrologue$1];
11691
+ var TripleSlashDirective$0 = $S($R$0($EXPECT($R65, "TripleSlashDirective /\\/\\/\\/[^\\r\\n]*/")), $E(EOS));
11692
+ function TripleSlashDirective(ctx, state) {
11693
+ return $EVENT(ctx, state, "TripleSlashDirective", TripleSlashDirective$0);
11694
+ }
11695
+ var DirectivePrologue$0 = PrologueString;
11642
11696
  function DirectivePrologue(ctx, state) {
11643
- return $EVENT_C(ctx, state, "DirectivePrologue", DirectivePrologue$$);
11697
+ return $EVENT(ctx, state, "DirectivePrologue", DirectivePrologue$0);
11698
+ }
11699
+ var PrologueString$0 = CivetPrologue;
11700
+ var PrologueString$1 = UnknownPrologue;
11701
+ var PrologueString$$ = [PrologueString$0, PrologueString$1];
11702
+ function PrologueString(ctx, state) {
11703
+ return $EVENT_C(ctx, state, "PrologueString", PrologueString$$);
11644
11704
  }
11645
11705
  var EOS$0 = $P(RestOfLine);
11646
11706
  function EOS(ctx, state) {
11647
11707
  return $EVENT(ctx, state, "EOS", EOS$0);
11648
11708
  }
11649
- var EOL$0 = $TR($EXPECT($R65, "EOL /\\r\\n|\\n|\\r|$/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
11709
+ var EOL$0 = $TR($EXPECT($R66, "EOL /\\r\\n|\\n|\\r|$/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
11650
11710
  return { $loc, token: $0 };
11651
11711
  });
11652
11712
  function EOL(ctx, state) {
@@ -12121,8 +12181,8 @@ var require_parser = __commonJS({
12121
12181
  function Reset(ctx, state) {
12122
12182
  return $EVENT(ctx, state, "Reset", Reset$0);
12123
12183
  }
12124
- var Init$0 = $TS($S($E(Shebang), $Q(DirectivePrologue), $EXPECT($L0, 'Init ""')), function($skip, $loc, $0, $1, $2, $3) {
12125
- var directives = $2;
12184
+ var Init$0 = $TS($S($E(Shebang), $Q(TripleSlashDirective), $Q(DirectivePrologue)), function($skip, $loc, $0, $1, $2, $3) {
12185
+ var directives = $3;
12126
12186
  directives.forEach((directive) => {
12127
12187
  if (directive.type === "CivetPrologue") {
12128
12188
  Object.assign(module.config, directive.config);
@@ -12133,7 +12193,7 @@ var require_parser = __commonJS({
12133
12193
  function Init(ctx, state) {
12134
12194
  return $EVENT(ctx, state, "Init", Init$0);
12135
12195
  }
12136
- var Indent$0 = $TR($EXPECT($R66, "Indent /[ \\t]*/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
12196
+ var Indent$0 = $TR($EXPECT($R67, "Indent /[ \\t]*/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
12137
12197
  let level;
12138
12198
  if (module.config.tab) {
12139
12199
  const tabs = $0.match(/\t/g);
@@ -12357,6 +12417,8 @@ var require_parser = __commonJS({
12357
12417
  exports.ReturnValue = ReturnValue;
12358
12418
  exports.AfterReturnShorthand = AfterReturnShorthand;
12359
12419
  exports.Parameters = Parameters;
12420
+ exports.ShortArrowParameters = ShortArrowParameters;
12421
+ exports.ArrowParameters = ArrowParameters;
12360
12422
  exports.NonEmptyParameters = NonEmptyParameters;
12361
12423
  exports.FunctionRestParameter = FunctionRestParameter;
12362
12424
  exports.ParameterElement = ParameterElement;
@@ -12864,7 +12926,9 @@ var require_parser = __commonJS({
12864
12926
  exports.CivetPrologueContent = CivetPrologueContent;
12865
12927
  exports.CivetOption = CivetOption;
12866
12928
  exports.UnknownPrologue = UnknownPrologue;
12929
+ exports.TripleSlashDirective = TripleSlashDirective;
12867
12930
  exports.DirectivePrologue = DirectivePrologue;
12931
+ exports.PrologueString = PrologueString;
12868
12932
  exports.EOS = EOS;
12869
12933
  exports.EOL = EOL;
12870
12934
  exports.DebugHere = DebugHere;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danielx/civet",
3
- "version": "0.6.28",
3
+ "version": "0.6.30",
4
4
  "description": "CoffeeScript style syntax for TypeScript",
5
5
  "main": "dist/main.js",
6
6
  "module": "dist/main.mjs",