@danielx/civet 0.5.18 → 0.5.20

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
@@ -193,6 +193,9 @@ Things Added that CoffeeScript didn't
193
193
  - Private identifiers `#id`
194
194
  - Convenience for ES6+ Features
195
195
  - Const assignment shorthand: `a := b` → `const a = b`, `{a, b} := c` → `const {a, b} = c`
196
+ - Let assignment shorthand (experimental): `a .= b` or `a ::= b` → `let a = b`
197
+ - Typed versions of above: `a: number .= 5` → `let a: number = 5`
198
+ (but note that `a: number = 5` is the object literal `{a: (number = 5)}`).
196
199
  - `@#id` → `this.#id` shorthand for private identifiers
197
200
  - `import` shorthand: `x from ./x` → `import x from "./x"`
198
201
  - Dynamic `import` shorthand: `import './x'` not at top level
@@ -209,6 +212,13 @@ Things Added that CoffeeScript didn't
209
212
  - Function call: `x.map &.callback a, b` → `x.map($ => $.callback(a, b))`
210
213
  - Unary operators: `x.map !!&` → `x.map($ => !!$)`
211
214
  - Binary operators: `x.map &+1` → `x.map($ => $+1)`
215
+ - Pipe operator (based on [F# pipes](https://learn.microsoft.com/en-us/dotnet/fsharp/language-reference/symbol-and-operator-reference/#function-symbols-and-operators), [Hack pipes](https://docs.hhvm.com/hack/expressions-and-operators/pipe) and the [TC39 proposal](https://github.com/tc39/proposal-pipeline-operator))
216
+ - `data |> Object.keys |> console.log` equivalent to
217
+ `console.log(Object.keys(data))`
218
+ - Use single-argument arrow functions or `&` shorthand
219
+ to specify how to use left-hand side
220
+ - `|> await`, `|> yield`, and `|> return` (at end)
221
+ for wrapping left-hand side with that operation
212
222
  - Flagging shorthand [from LiveScript](https://livescript.net/#literals) `{+debug, -live}` → `{debug: true, live: false}`
213
223
  - JSX enhancements (inspired by [solid-dsl discussions](https://github.com/solidjs-community/solid-dsl/discussions)):
214
224
  - Indentation: instead of explicitly closing `<tag>`s or `<>`s,
@@ -239,6 +249,7 @@ Things Added that CoffeeScript didn't
239
249
  `"civet solid server"` for server-only code (SSR only), or
240
250
  `"civet solid client server"` for isomorphic code that runs on
241
251
  client and server (SSR + hydration).
252
+ - XML comments: `<!-- ... -->` → `{/* ... */}`
242
253
  - CoffeeScript improvements
243
254
  - Postfix loop `run() loop` → `while(true) run()`
244
255
  - Character range literals `["a".."z"]`, `['f'..'a']`, `['0'..'9']`
@@ -251,7 +262,9 @@ Things Added that CoffeeScript didn't
251
262
  Things Changed from ES6
252
263
  ---
253
264
 
254
- - Implicit returns
265
+ - Implicit returns, even for multi-statement functions
266
+ (avoid by adding a trailing `;`, an explicit `return`, or
267
+ via the directive `"civet -implicitReturns"`)
255
268
  - Disallow no parens on single argument arrow function. `x => ...` must become `(x) => ...`
256
269
  The reasoning is `x -> ...` => `x(function() ...)` in CoffeeScript and having `->` and `=>`
257
270
  behave more differently than they already do is bad. Passing an anonymous function to an
package/dist/browser.js CHANGED
@@ -692,6 +692,7 @@ ${input.slice(result.pos)}
692
692
  Whitespace,
693
693
  ExpressionDelimiter,
694
694
  StatementDelimiter,
695
+ SemicolonDelimiter,
695
696
  NonIdContinue,
696
697
  Loc,
697
698
  Abstract,
@@ -799,6 +800,8 @@ ${input.slice(result.pos)}
799
800
  JSXChildren,
800
801
  JSXNestedChildren,
801
802
  JSXChild,
803
+ JSXComment,
804
+ JSXCommentContent,
802
805
  JSXText,
803
806
  JSXChildExpression,
804
807
  TypeDeclaration,
@@ -1045,15 +1048,17 @@ ${input.slice(result.pos)}
1045
1048
  var $L154 = $L("</");
1046
1049
  var $L155 = $L("<>");
1047
1050
  var $L156 = $L("</>");
1048
- var $L157 = $L("declare");
1049
- var $L158 = $L("type");
1050
- var $L159 = $L("interface");
1051
- var $L160 = $L("namespace");
1052
- var $L161 = $L("asserts");
1053
- var $L162 = $L("keyof");
1054
- var $L163 = $L("infer");
1055
- var $L164 = $L("[]");
1056
- var $L165 = $L("civet");
1051
+ var $L157 = $L("<!--");
1052
+ var $L158 = $L("-->");
1053
+ var $L159 = $L("declare");
1054
+ var $L160 = $L("type");
1055
+ var $L161 = $L("interface");
1056
+ var $L162 = $L("namespace");
1057
+ var $L163 = $L("asserts");
1058
+ var $L164 = $L("keyof");
1059
+ var $L165 = $L("infer");
1060
+ var $L166 = $L("[]");
1061
+ var $L167 = $L("civet");
1057
1062
  var $R0 = $R(new RegExp("(for|of|then|when)(?!\\p{ID_Continue}|[\\u200C\\u200D$])", "suy"));
1058
1063
  var $R1 = $R(new RegExp("[&]", "suy"));
1059
1064
  var $R2 = $R(new RegExp("[!~+-]+", "suy"));
@@ -1101,14 +1106,15 @@ ${input.slice(result.pos)}
1101
1106
  var $R44 = $R(new RegExp("\\s", "suy"));
1102
1107
  var $R45 = $R(new RegExp("(?:\\p{ID_Start}|[_$])(?:\\p{ID_Continue}|[\\u200C\\u200D$-])*", "suy"));
1103
1108
  var $R46 = $R(new RegExp("(?:[\\w\\-:]+|\\([^()]*\\)|\\[[^\\[\\]]*\\])+", "suy"));
1104
- var $R47 = $R(new RegExp("[^{}<>\\r\\n]+", "suy"));
1105
- var $R48 = $R(new RegExp("[+-]?", "suy"));
1106
- var $R49 = $R(new RegExp("#![^\\r\\n]*", "suy"));
1107
- var $R50 = $R(new RegExp("[\\t ]*", "suy"));
1108
- var $R51 = $R(new RegExp("[\\s]*", "suy"));
1109
- var $R52 = $R(new RegExp("\\s+([+-]?)([a-zA-Z0-9-]+)(\\s*=\\s*([a-zA-Z0-9.+-]*))?", "suy"));
1110
- var $R53 = $R(new RegExp("\\r\\n|\\n|\\r|$", "suy"));
1111
- var $R54 = $R(new RegExp("[ \\t]*", "suy"));
1109
+ var $R47 = $R(new RegExp("(?:-[^-]|[^-]*)*", "suy"));
1110
+ var $R48 = $R(new RegExp("[^{}<>\\r\\n]+", "suy"));
1111
+ var $R49 = $R(new RegExp("[+-]?", "suy"));
1112
+ var $R50 = $R(new RegExp("#![^\\r\\n]*", "suy"));
1113
+ var $R51 = $R(new RegExp("[\\t ]*", "suy"));
1114
+ var $R52 = $R(new RegExp("[\\s]*", "suy"));
1115
+ var $R53 = $R(new RegExp("\\s+([+-]?)([a-zA-Z0-9-]+)(\\s*=\\s*([a-zA-Z0-9.+-]*))?", "suy"));
1116
+ var $R54 = $R(new RegExp("\\r\\n|\\n|\\r|$", "suy"));
1117
+ var $R55 = $R(new RegExp("[ \\t]*", "suy"));
1112
1118
  var Program$0 = $TS($S(Reset, Init, __, $Q(TopLevelStatement), __), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
1113
1119
  var statements = $4;
1114
1120
  module.processProgram(statements);
@@ -2099,7 +2105,8 @@ ${input.slice(result.pos)}
2099
2105
  }
2100
2106
  var PipelineTailItem$0 = Await;
2101
2107
  var PipelineTailItem$1 = Yield;
2102
- var PipelineTailItem$2 = PipelineHeadItem;
2108
+ var PipelineTailItem$2 = Return;
2109
+ var PipelineTailItem$3 = PipelineHeadItem;
2103
2110
  function PipelineTailItem(state) {
2104
2111
  if (state.events) {
2105
2112
  const result = state.events.enter?.("PipelineTailItem", state);
@@ -2107,12 +2114,12 @@ ${input.slice(result.pos)}
2107
2114
  return result.cache;
2108
2115
  }
2109
2116
  if (state.tokenize) {
2110
- const result = $TOKEN("PipelineTailItem", state, PipelineTailItem$0(state) || PipelineTailItem$1(state) || PipelineTailItem$2(state));
2117
+ const result = $TOKEN("PipelineTailItem", state, PipelineTailItem$0(state) || PipelineTailItem$1(state) || PipelineTailItem$2(state) || PipelineTailItem$3(state));
2111
2118
  if (state.events)
2112
2119
  state.events.exit?.("PipelineTailItem", state, result);
2113
2120
  return result;
2114
2121
  } else {
2115
- const result = PipelineTailItem$0(state) || PipelineTailItem$1(state) || PipelineTailItem$2(state);
2122
+ const result = PipelineTailItem$0(state) || PipelineTailItem$1(state) || PipelineTailItem$2(state) || PipelineTailItem$3(state);
2116
2123
  if (state.events)
2117
2124
  state.events.exit?.("PipelineTailItem", state, result);
2118
2125
  return result;
@@ -4060,7 +4067,7 @@ ${input.slice(result.pos)}
4060
4067
  return result;
4061
4068
  }
4062
4069
  }
4063
- var SingleLineStatements$0 = $TS($S($S($Q(TrailingComment), Statement), $Q($S($S($Q(TrailingComment), Semicolon, $Q(TrailingComment)), Statement))), function($skip, $loc, $0, $1, $2) {
4070
+ var SingleLineStatements$0 = $TS($S($S($Q(TrailingComment), Statement), $Q($S(SemicolonDelimiter, $E(Statement)))), function($skip, $loc, $0, $1, $2) {
4064
4071
  var first = $1;
4065
4072
  var rest = $2;
4066
4073
  if (rest.length) {
@@ -9251,7 +9258,7 @@ ${input.slice(result.pos)}
9251
9258
  return result;
9252
9259
  }
9253
9260
  }
9254
- var StatementDelimiter$0 = $S($Q(TrailingComment), Semicolon, $Q(TrailingComment));
9261
+ var StatementDelimiter$0 = SemicolonDelimiter;
9255
9262
  var StatementDelimiter$1 = $Y(EOS);
9256
9263
  function StatementDelimiter(state) {
9257
9264
  if (state.events) {
@@ -9271,6 +9278,30 @@ ${input.slice(result.pos)}
9271
9278
  return result;
9272
9279
  }
9273
9280
  }
9281
+ var SemicolonDelimiter$0 = $TS($S($Q(TrailingComment), Semicolon, $Q(TrailingComment)), function($skip, $loc, $0, $1, $2, $3) {
9282
+ return {
9283
+ type: "SemicolonDelimiter",
9284
+ children: $0
9285
+ };
9286
+ });
9287
+ function SemicolonDelimiter(state) {
9288
+ if (state.events) {
9289
+ const result = state.events.enter?.("SemicolonDelimiter", state);
9290
+ if (result)
9291
+ return result.cache;
9292
+ }
9293
+ if (state.tokenize) {
9294
+ const result = $TOKEN("SemicolonDelimiter", state, SemicolonDelimiter$0(state));
9295
+ if (state.events)
9296
+ state.events.exit?.("SemicolonDelimiter", state, result);
9297
+ return result;
9298
+ } else {
9299
+ const result = SemicolonDelimiter$0(state);
9300
+ if (state.events)
9301
+ state.events.exit?.("SemicolonDelimiter", state, result);
9302
+ return result;
9303
+ }
9304
+ }
9274
9305
  var NonIdContinue$0 = $R$0($EXPECT($R43, fail, "NonIdContinue /(?!\\p{ID_Continue})/"));
9275
9306
  function NonIdContinue(state) {
9276
9307
  if (state.events) {
@@ -11150,7 +11181,23 @@ ${input.slice(result.pos)}
11150
11181
  if (stringPart) {
11151
11182
  exprs.unshift(JSON.stringify(stringPart), ", ");
11152
11183
  }
11153
- classValue = ["{[", ...exprs, '].filter(Boolean).join(" ")}'];
11184
+ if (exprs.length === 1) {
11185
+ let root = exprs[0];
11186
+ while (root.length && module.isWhitespaceOrEmpty(root[root.length - 1])) {
11187
+ root = root.slice(0, -1);
11188
+ }
11189
+ while (root?.length === 1)
11190
+ root = root[0];
11191
+ if (root?.children)
11192
+ root = root.children;
11193
+ if (root?.[0]?.token === "`") {
11194
+ classValue = ["{", ...exprs, "}"];
11195
+ } else {
11196
+ classValue = ["{(", ...exprs, ') || ""}'];
11197
+ }
11198
+ } else {
11199
+ classValue = ["{[", ...exprs, '].filter(Boolean).join(" ")}'];
11200
+ }
11154
11201
  } else {
11155
11202
  classValue = JSON.stringify(stringPart);
11156
11203
  }
@@ -11706,7 +11753,8 @@ ${input.slice(result.pos)}
11706
11753
  }
11707
11754
  var JSXChild$0 = JSXElement;
11708
11755
  var JSXChild$1 = JSXFragment;
11709
- var JSXChild$2 = $TS($S(OpenBrace, $E(JSXChildExpression), __, CloseBrace), function($skip, $loc, $0, $1, $2, $3, $4) {
11756
+ var JSXChild$2 = JSXComment;
11757
+ var JSXChild$3 = $TS($S(OpenBrace, $E(JSXChildExpression), __, CloseBrace), function($skip, $loc, $0, $1, $2, $3, $4) {
11710
11758
  var expression = $2;
11711
11759
  return {
11712
11760
  type: "JSXChildExpression",
@@ -11714,7 +11762,7 @@ ${input.slice(result.pos)}
11714
11762
  expression
11715
11763
  };
11716
11764
  });
11717
- var JSXChild$3 = $TS($S(InsertInlineOpenBrace, ArrowFunction, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3) {
11765
+ var JSXChild$4 = $TS($S(InsertInlineOpenBrace, ArrowFunction, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3) {
11718
11766
  var expression = $2;
11719
11767
  return {
11720
11768
  type: "JSXChildExpression",
@@ -11722,7 +11770,7 @@ ${input.slice(result.pos)}
11722
11770
  expression
11723
11771
  };
11724
11772
  });
11725
- var JSXChild$4 = JSXText;
11773
+ var JSXChild$5 = JSXText;
11726
11774
  function JSXChild(state) {
11727
11775
  if (state.events) {
11728
11776
  const result = state.events.enter?.("JSXChild", state);
@@ -11730,18 +11778,60 @@ ${input.slice(result.pos)}
11730
11778
  return result.cache;
11731
11779
  }
11732
11780
  if (state.tokenize) {
11733
- const result = $TOKEN("JSXChild", state, JSXChild$0(state) || JSXChild$1(state) || JSXChild$2(state) || JSXChild$3(state) || JSXChild$4(state));
11781
+ const result = $TOKEN("JSXChild", state, JSXChild$0(state) || JSXChild$1(state) || JSXChild$2(state) || JSXChild$3(state) || JSXChild$4(state) || JSXChild$5(state));
11734
11782
  if (state.events)
11735
11783
  state.events.exit?.("JSXChild", state, result);
11736
11784
  return result;
11737
11785
  } else {
11738
- const result = JSXChild$0(state) || JSXChild$1(state) || JSXChild$2(state) || JSXChild$3(state) || JSXChild$4(state);
11786
+ const result = JSXChild$0(state) || JSXChild$1(state) || JSXChild$2(state) || JSXChild$3(state) || JSXChild$4(state) || JSXChild$5(state);
11739
11787
  if (state.events)
11740
11788
  state.events.exit?.("JSXChild", state, result);
11741
11789
  return result;
11742
11790
  }
11743
11791
  }
11744
- var JSXText$0 = $TR($EXPECT($R47, fail, "JSXText /[^{}<>\\r\\n]+/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
11792
+ var JSXComment$0 = $TS($S($EXPECT($L157, fail, 'JSXComment "<!--"'), JSXCommentContent, $EXPECT($L158, fail, 'JSXComment "-->"')), function($skip, $loc, $0, $1, $2, $3) {
11793
+ return ["{/*", $2, "*/}"];
11794
+ });
11795
+ function JSXComment(state) {
11796
+ if (state.events) {
11797
+ const result = state.events.enter?.("JSXComment", state);
11798
+ if (result)
11799
+ return result.cache;
11800
+ }
11801
+ if (state.tokenize) {
11802
+ const result = $TOKEN("JSXComment", state, JSXComment$0(state));
11803
+ if (state.events)
11804
+ state.events.exit?.("JSXComment", state, result);
11805
+ return result;
11806
+ } else {
11807
+ const result = JSXComment$0(state);
11808
+ if (state.events)
11809
+ state.events.exit?.("JSXComment", state, result);
11810
+ return result;
11811
+ }
11812
+ }
11813
+ var JSXCommentContent$0 = $TR($EXPECT($R47, fail, "JSXCommentContent /(?:-[^-]|[^-]*)*/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
11814
+ return { $loc, token: $0.replace(/\*\//g, "* /") };
11815
+ });
11816
+ function JSXCommentContent(state) {
11817
+ if (state.events) {
11818
+ const result = state.events.enter?.("JSXCommentContent", state);
11819
+ if (result)
11820
+ return result.cache;
11821
+ }
11822
+ if (state.tokenize) {
11823
+ const result = $TOKEN("JSXCommentContent", state, JSXCommentContent$0(state));
11824
+ if (state.events)
11825
+ state.events.exit?.("JSXCommentContent", state, result);
11826
+ return result;
11827
+ } else {
11828
+ const result = JSXCommentContent$0(state);
11829
+ if (state.events)
11830
+ state.events.exit?.("JSXCommentContent", state, result);
11831
+ return result;
11832
+ }
11833
+ }
11834
+ var JSXText$0 = $TR($EXPECT($R48, fail, "JSXText /[^{}<>\\r\\n]+/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
11745
11835
  return {
11746
11836
  type: "JSXText",
11747
11837
  token: $0,
@@ -11806,7 +11896,7 @@ ${input.slice(result.pos)}
11806
11896
  return result;
11807
11897
  }
11808
11898
  }
11809
- var TypeDeclarationModifier$0 = $S($EXPECT($L157, fail, 'TypeDeclarationModifier "declare"'), NonIdContinue);
11899
+ var TypeDeclarationModifier$0 = $S($EXPECT($L159, fail, 'TypeDeclarationModifier "declare"'), NonIdContinue);
11810
11900
  var TypeDeclarationModifier$1 = Export;
11811
11901
  function TypeDeclarationModifier(state) {
11812
11902
  if (state.events) {
@@ -11848,7 +11938,7 @@ ${input.slice(result.pos)}
11848
11938
  return result;
11849
11939
  }
11850
11940
  }
11851
- var TypeKeyword$0 = $S($EXPECT($L158, fail, 'TypeKeyword "type"'), NonIdContinue);
11941
+ var TypeKeyword$0 = $S($EXPECT($L160, fail, 'TypeKeyword "type"'), NonIdContinue);
11852
11942
  function TypeKeyword(state) {
11853
11943
  if (state.events) {
11854
11944
  const result = state.events.enter?.("TypeKeyword", state);
@@ -11867,7 +11957,7 @@ ${input.slice(result.pos)}
11867
11957
  return result;
11868
11958
  }
11869
11959
  }
11870
- var Interface$0 = $S($EXPECT($L159, fail, 'Interface "interface"'), NonIdContinue);
11960
+ var Interface$0 = $S($EXPECT($L161, fail, 'Interface "interface"'), NonIdContinue);
11871
11961
  function Interface(state) {
11872
11962
  if (state.events) {
11873
11963
  const result = state.events.enter?.("Interface", state);
@@ -11886,7 +11976,7 @@ ${input.slice(result.pos)}
11886
11976
  return result;
11887
11977
  }
11888
11978
  }
11889
- var Namespace$0 = $S($EXPECT($L160, fail, 'Namespace "namespace"'), NonIdContinue);
11979
+ var Namespace$0 = $S($EXPECT($L162, fail, 'Namespace "namespace"'), NonIdContinue);
11890
11980
  function Namespace(state) {
11891
11981
  if (state.events) {
11892
11982
  const result = state.events.enter?.("Namespace", state);
@@ -12075,7 +12165,7 @@ ${input.slice(result.pos)}
12075
12165
  return result;
12076
12166
  }
12077
12167
  }
12078
- var TypeIndexSignature$0 = $S($E($S($R$0($EXPECT($R48, fail, "TypeIndexSignature /[+-]?/")), $EXPECT($L129, fail, 'TypeIndexSignature "readonly"'), __)), OpenBracket, TypeIndex, CloseBracket, $E($S(__, $R$0($EXPECT($R4, fail, "TypeIndexSignature /[+-]/")), QuestionMark)));
12168
+ var TypeIndexSignature$0 = $S($E($S($R$0($EXPECT($R49, fail, "TypeIndexSignature /[+-]?/")), $EXPECT($L129, fail, 'TypeIndexSignature "readonly"'), __)), OpenBracket, TypeIndex, CloseBracket, $E($S(__, $R$0($EXPECT($R4, fail, "TypeIndexSignature /[+-]/")), QuestionMark)));
12079
12169
  function TypeIndexSignature(state) {
12080
12170
  if (state.events) {
12081
12171
  const result = state.events.enter?.("TypeIndexSignature", state);
@@ -12135,7 +12225,7 @@ ${input.slice(result.pos)}
12135
12225
  return result;
12136
12226
  }
12137
12227
  }
12138
- var ReturnTypeSuffix$0 = $TS($S(__, Colon, $E($S(__, $EXPECT($L161, fail, 'ReturnTypeSuffix "asserts"'), NonIdContinue)), TypePredicate), function($skip, $loc, $0, $1, $2, $3, $4) {
12228
+ var ReturnTypeSuffix$0 = $TS($S(__, Colon, $E($S(__, $EXPECT($L163, fail, 'ReturnTypeSuffix "asserts"'), NonIdContinue)), TypePredicate), function($skip, $loc, $0, $1, $2, $3, $4) {
12139
12229
  const children = [...$1, $2];
12140
12230
  if ($3)
12141
12231
  children.push($3);
@@ -12270,9 +12360,9 @@ ${input.slice(result.pos)}
12270
12360
  return result;
12271
12361
  }
12272
12362
  }
12273
- var TypeUnaryOp$0 = $EXPECT($L162, fail, 'TypeUnaryOp "keyof"');
12363
+ var TypeUnaryOp$0 = $EXPECT($L164, fail, 'TypeUnaryOp "keyof"');
12274
12364
  var TypeUnaryOp$1 = $EXPECT($L145, fail, 'TypeUnaryOp "typeof"');
12275
- var TypeUnaryOp$2 = $EXPECT($L163, fail, 'TypeUnaryOp "infer"');
12365
+ var TypeUnaryOp$2 = $EXPECT($L165, fail, 'TypeUnaryOp "infer"');
12276
12366
  var TypeUnaryOp$3 = $EXPECT($L129, fail, 'TypeUnaryOp "readonly"');
12277
12367
  function TypeUnaryOp(state) {
12278
12368
  if (state.events) {
@@ -12445,7 +12535,7 @@ ${input.slice(result.pos)}
12445
12535
  var TypeLiteral$2 = $TV($EXPECT($L149, fail, 'TypeLiteral "void"'), function($skip, $loc, $0, $1) {
12446
12536
  return { $loc, token: "void" };
12447
12537
  });
12448
- var TypeLiteral$3 = $TV($EXPECT($L164, fail, 'TypeLiteral "[]"'), function($skip, $loc, $0, $1) {
12538
+ var TypeLiteral$3 = $TV($EXPECT($L166, fail, 'TypeLiteral "[]"'), function($skip, $loc, $0, $1) {
12449
12539
  return { $loc, token: "[]" };
12450
12540
  });
12451
12541
  function TypeLiteral(state) {
@@ -12677,7 +12767,7 @@ ${input.slice(result.pos)}
12677
12767
  return result;
12678
12768
  }
12679
12769
  }
12680
- var Shebang$0 = $S($R$0($EXPECT($R49, fail, "Shebang /#![^\\r\\n]*/")), EOL);
12770
+ var Shebang$0 = $S($R$0($EXPECT($R50, fail, "Shebang /#![^\\r\\n]*/")), EOL);
12681
12771
  function Shebang(state) {
12682
12772
  if (state.events) {
12683
12773
  const result = state.events.enter?.("Shebang", state);
@@ -12696,11 +12786,11 @@ ${input.slice(result.pos)}
12696
12786
  return result;
12697
12787
  }
12698
12788
  }
12699
- var CivetPrologue$0 = $T($S($EXPECT($R50, fail, "CivetPrologue /[\\t ]*/"), DoubleQuote, CivetPrologueContent, DoubleQuote, $TEXT(StatementDelimiter), $E(EOS)), function(value) {
12789
+ var CivetPrologue$0 = $T($S($EXPECT($R51, fail, "CivetPrologue /[\\t ]*/"), DoubleQuote, CivetPrologueContent, DoubleQuote, $TEXT(StatementDelimiter), $E(EOS)), function(value) {
12700
12790
  var content = value[2];
12701
12791
  return content;
12702
12792
  });
12703
- var CivetPrologue$1 = $T($S($EXPECT($R50, fail, "CivetPrologue /[\\t ]*/"), SingleQuote, CivetPrologueContent, SingleQuote, $TEXT(StatementDelimiter), $E(EOS)), function(value) {
12793
+ var CivetPrologue$1 = $T($S($EXPECT($R51, fail, "CivetPrologue /[\\t ]*/"), SingleQuote, CivetPrologueContent, SingleQuote, $TEXT(StatementDelimiter), $E(EOS)), function(value) {
12704
12794
  var content = value[2];
12705
12795
  return content;
12706
12796
  });
@@ -12722,7 +12812,7 @@ ${input.slice(result.pos)}
12722
12812
  return result;
12723
12813
  }
12724
12814
  }
12725
- var CivetPrologueContent$0 = $TS($S($EXPECT($L165, fail, 'CivetPrologueContent "civet"'), $Q(CivetOption), $EXPECT($R51, fail, "CivetPrologueContent /[\\s]*/")), function($skip, $loc, $0, $1, $2, $3) {
12815
+ var CivetPrologueContent$0 = $TS($S($EXPECT($L167, fail, 'CivetPrologueContent "civet"'), $Q(CivetOption), $EXPECT($R52, fail, "CivetPrologueContent /[\\s]*/")), function($skip, $loc, $0, $1, $2, $3) {
12726
12816
  var options = $2;
12727
12817
  return {
12728
12818
  type: "CivetPrologue",
@@ -12748,7 +12838,7 @@ ${input.slice(result.pos)}
12748
12838
  return result;
12749
12839
  }
12750
12840
  }
12751
- var CivetOption$0 = $TR($EXPECT($R52, fail, "CivetOption /\\s+([+-]?)([a-zA-Z0-9-]+)(\\s*=\\s*([a-zA-Z0-9.+-]*))?/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
12841
+ var CivetOption$0 = $TR($EXPECT($R53, fail, "CivetOption /\\s+([+-]?)([a-zA-Z0-9-]+)(\\s*=\\s*([a-zA-Z0-9.+-]*))?/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
12752
12842
  const optionName = $2.replace(/-+([a-z]?)/g, (_2, l) => {
12753
12843
  if (l)
12754
12844
  return l.toUpperCase();
@@ -12780,7 +12870,7 @@ ${input.slice(result.pos)}
12780
12870
  return result;
12781
12871
  }
12782
12872
  }
12783
- var UnknownPrologue$0 = $S($R$0($EXPECT($R50, fail, "UnknownPrologue /[\\t ]*/")), BasicStringLiteral, $TEXT(StatementDelimiter), EOS);
12873
+ var UnknownPrologue$0 = $S($R$0($EXPECT($R51, fail, "UnknownPrologue /[\\t ]*/")), BasicStringLiteral, $TEXT(StatementDelimiter), EOS);
12784
12874
  function UnknownPrologue(state) {
12785
12875
  if (state.events) {
12786
12876
  const result = state.events.enter?.("UnknownPrologue", state);
@@ -12838,7 +12928,7 @@ ${input.slice(result.pos)}
12838
12928
  return result;
12839
12929
  }
12840
12930
  }
12841
- var EOL$0 = $TR($EXPECT($R53, fail, "EOL /\\r\\n|\\n|\\r|$/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
12931
+ var EOL$0 = $TR($EXPECT($R54, fail, "EOL /\\r\\n|\\n|\\r|$/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
12842
12932
  return { $loc, token: $0 };
12843
12933
  });
12844
12934
  function EOL(state) {
@@ -13939,6 +14029,8 @@ ${input.slice(result.pos)}
13939
14029
  insertReturn(exp.children[2][3]);
13940
14030
  return;
13941
14031
  }
14032
+ if (node[node.length - 1]?.type === "SemicolonDelimiter")
14033
+ return;
13942
14034
  node.splice(1, 0, "return ");
13943
14035
  }
13944
14036
  module.isWhitespaceOrEmpty = function(node) {
@@ -13946,6 +14038,8 @@ ${input.slice(result.pos)}
13946
14038
  return true;
13947
14039
  if (node.token)
13948
14040
  return node.token.match(/^\s*$/);
14041
+ if (node.children)
14042
+ node = node.children;
13949
14043
  if (!node.length)
13950
14044
  return true;
13951
14045
  if (typeof node === "string")
@@ -14598,7 +14692,7 @@ ${input.slice(result.pos)}
14598
14692
  }
14599
14693
  };
14600
14694
  module.constructPipeStep = function(caller, callee) {
14601
- if (caller.expr.token === "yield" || caller.expr.token === "await") {
14695
+ if (caller.expr.token === "yield" || caller.expr.token === "await" || caller.expr.token === "return") {
14602
14696
  return [caller.leadingComment, caller.expr, caller.trailingComment, " ", callee.leadingComment, callee.expr, callee.trailingComment];
14603
14697
  }
14604
14698
  return module.constructInvocation(caller, callee);
@@ -14623,7 +14717,7 @@ ${input.slice(result.pos)}
14623
14717
  return result;
14624
14718
  }
14625
14719
  }
14626
- var Indent$0 = $TR($EXPECT($R54, fail, "Indent /[ \\t]*/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
14720
+ var Indent$0 = $TR($EXPECT($R55, fail, "Indent /[ \\t]*/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
14627
14721
  let level;
14628
14722
  if (module.config.tab) {
14629
14723
  const tabs = $0.match(/\t/g);
package/dist/main.js CHANGED
@@ -691,6 +691,7 @@ ${input.slice(result.pos)}
691
691
  Whitespace,
692
692
  ExpressionDelimiter,
693
693
  StatementDelimiter,
694
+ SemicolonDelimiter,
694
695
  NonIdContinue,
695
696
  Loc,
696
697
  Abstract,
@@ -798,6 +799,8 @@ ${input.slice(result.pos)}
798
799
  JSXChildren,
799
800
  JSXNestedChildren,
800
801
  JSXChild,
802
+ JSXComment,
803
+ JSXCommentContent,
801
804
  JSXText,
802
805
  JSXChildExpression,
803
806
  TypeDeclaration,
@@ -1044,15 +1047,17 @@ ${input.slice(result.pos)}
1044
1047
  var $L154 = $L("</");
1045
1048
  var $L155 = $L("<>");
1046
1049
  var $L156 = $L("</>");
1047
- var $L157 = $L("declare");
1048
- var $L158 = $L("type");
1049
- var $L159 = $L("interface");
1050
- var $L160 = $L("namespace");
1051
- var $L161 = $L("asserts");
1052
- var $L162 = $L("keyof");
1053
- var $L163 = $L("infer");
1054
- var $L164 = $L("[]");
1055
- var $L165 = $L("civet");
1050
+ var $L157 = $L("<!--");
1051
+ var $L158 = $L("-->");
1052
+ var $L159 = $L("declare");
1053
+ var $L160 = $L("type");
1054
+ var $L161 = $L("interface");
1055
+ var $L162 = $L("namespace");
1056
+ var $L163 = $L("asserts");
1057
+ var $L164 = $L("keyof");
1058
+ var $L165 = $L("infer");
1059
+ var $L166 = $L("[]");
1060
+ var $L167 = $L("civet");
1056
1061
  var $R0 = $R(new RegExp("(for|of|then|when)(?!\\p{ID_Continue}|[\\u200C\\u200D$])", "suy"));
1057
1062
  var $R1 = $R(new RegExp("[&]", "suy"));
1058
1063
  var $R2 = $R(new RegExp("[!~+-]+", "suy"));
@@ -1100,14 +1105,15 @@ ${input.slice(result.pos)}
1100
1105
  var $R44 = $R(new RegExp("\\s", "suy"));
1101
1106
  var $R45 = $R(new RegExp("(?:\\p{ID_Start}|[_$])(?:\\p{ID_Continue}|[\\u200C\\u200D$-])*", "suy"));
1102
1107
  var $R46 = $R(new RegExp("(?:[\\w\\-:]+|\\([^()]*\\)|\\[[^\\[\\]]*\\])+", "suy"));
1103
- var $R47 = $R(new RegExp("[^{}<>\\r\\n]+", "suy"));
1104
- var $R48 = $R(new RegExp("[+-]?", "suy"));
1105
- var $R49 = $R(new RegExp("#![^\\r\\n]*", "suy"));
1106
- var $R50 = $R(new RegExp("[\\t ]*", "suy"));
1107
- var $R51 = $R(new RegExp("[\\s]*", "suy"));
1108
- var $R52 = $R(new RegExp("\\s+([+-]?)([a-zA-Z0-9-]+)(\\s*=\\s*([a-zA-Z0-9.+-]*))?", "suy"));
1109
- var $R53 = $R(new RegExp("\\r\\n|\\n|\\r|$", "suy"));
1110
- var $R54 = $R(new RegExp("[ \\t]*", "suy"));
1108
+ var $R47 = $R(new RegExp("(?:-[^-]|[^-]*)*", "suy"));
1109
+ var $R48 = $R(new RegExp("[^{}<>\\r\\n]+", "suy"));
1110
+ var $R49 = $R(new RegExp("[+-]?", "suy"));
1111
+ var $R50 = $R(new RegExp("#![^\\r\\n]*", "suy"));
1112
+ var $R51 = $R(new RegExp("[\\t ]*", "suy"));
1113
+ var $R52 = $R(new RegExp("[\\s]*", "suy"));
1114
+ var $R53 = $R(new RegExp("\\s+([+-]?)([a-zA-Z0-9-]+)(\\s*=\\s*([a-zA-Z0-9.+-]*))?", "suy"));
1115
+ var $R54 = $R(new RegExp("\\r\\n|\\n|\\r|$", "suy"));
1116
+ var $R55 = $R(new RegExp("[ \\t]*", "suy"));
1111
1117
  var Program$0 = $TS($S(Reset, Init, __, $Q(TopLevelStatement), __), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
1112
1118
  var statements = $4;
1113
1119
  module2.processProgram(statements);
@@ -2098,7 +2104,8 @@ ${input.slice(result.pos)}
2098
2104
  }
2099
2105
  var PipelineTailItem$0 = Await;
2100
2106
  var PipelineTailItem$1 = Yield;
2101
- var PipelineTailItem$2 = PipelineHeadItem;
2107
+ var PipelineTailItem$2 = Return;
2108
+ var PipelineTailItem$3 = PipelineHeadItem;
2102
2109
  function PipelineTailItem(state) {
2103
2110
  if (state.events) {
2104
2111
  const result = state.events.enter?.("PipelineTailItem", state);
@@ -2106,12 +2113,12 @@ ${input.slice(result.pos)}
2106
2113
  return result.cache;
2107
2114
  }
2108
2115
  if (state.tokenize) {
2109
- const result = $TOKEN("PipelineTailItem", state, PipelineTailItem$0(state) || PipelineTailItem$1(state) || PipelineTailItem$2(state));
2116
+ const result = $TOKEN("PipelineTailItem", state, PipelineTailItem$0(state) || PipelineTailItem$1(state) || PipelineTailItem$2(state) || PipelineTailItem$3(state));
2110
2117
  if (state.events)
2111
2118
  state.events.exit?.("PipelineTailItem", state, result);
2112
2119
  return result;
2113
2120
  } else {
2114
- const result = PipelineTailItem$0(state) || PipelineTailItem$1(state) || PipelineTailItem$2(state);
2121
+ const result = PipelineTailItem$0(state) || PipelineTailItem$1(state) || PipelineTailItem$2(state) || PipelineTailItem$3(state);
2115
2122
  if (state.events)
2116
2123
  state.events.exit?.("PipelineTailItem", state, result);
2117
2124
  return result;
@@ -4059,7 +4066,7 @@ ${input.slice(result.pos)}
4059
4066
  return result;
4060
4067
  }
4061
4068
  }
4062
- var SingleLineStatements$0 = $TS($S($S($Q(TrailingComment), Statement), $Q($S($S($Q(TrailingComment), Semicolon, $Q(TrailingComment)), Statement))), function($skip, $loc, $0, $1, $2) {
4069
+ var SingleLineStatements$0 = $TS($S($S($Q(TrailingComment), Statement), $Q($S(SemicolonDelimiter, $E(Statement)))), function($skip, $loc, $0, $1, $2) {
4063
4070
  var first = $1;
4064
4071
  var rest = $2;
4065
4072
  if (rest.length) {
@@ -9250,7 +9257,7 @@ ${input.slice(result.pos)}
9250
9257
  return result;
9251
9258
  }
9252
9259
  }
9253
- var StatementDelimiter$0 = $S($Q(TrailingComment), Semicolon, $Q(TrailingComment));
9260
+ var StatementDelimiter$0 = SemicolonDelimiter;
9254
9261
  var StatementDelimiter$1 = $Y(EOS);
9255
9262
  function StatementDelimiter(state) {
9256
9263
  if (state.events) {
@@ -9270,6 +9277,30 @@ ${input.slice(result.pos)}
9270
9277
  return result;
9271
9278
  }
9272
9279
  }
9280
+ var SemicolonDelimiter$0 = $TS($S($Q(TrailingComment), Semicolon, $Q(TrailingComment)), function($skip, $loc, $0, $1, $2, $3) {
9281
+ return {
9282
+ type: "SemicolonDelimiter",
9283
+ children: $0
9284
+ };
9285
+ });
9286
+ function SemicolonDelimiter(state) {
9287
+ if (state.events) {
9288
+ const result = state.events.enter?.("SemicolonDelimiter", state);
9289
+ if (result)
9290
+ return result.cache;
9291
+ }
9292
+ if (state.tokenize) {
9293
+ const result = $TOKEN("SemicolonDelimiter", state, SemicolonDelimiter$0(state));
9294
+ if (state.events)
9295
+ state.events.exit?.("SemicolonDelimiter", state, result);
9296
+ return result;
9297
+ } else {
9298
+ const result = SemicolonDelimiter$0(state);
9299
+ if (state.events)
9300
+ state.events.exit?.("SemicolonDelimiter", state, result);
9301
+ return result;
9302
+ }
9303
+ }
9273
9304
  var NonIdContinue$0 = $R$0($EXPECT($R43, fail, "NonIdContinue /(?!\\p{ID_Continue})/"));
9274
9305
  function NonIdContinue(state) {
9275
9306
  if (state.events) {
@@ -11149,7 +11180,23 @@ ${input.slice(result.pos)}
11149
11180
  if (stringPart) {
11150
11181
  exprs.unshift(JSON.stringify(stringPart), ", ");
11151
11182
  }
11152
- classValue = ["{[", ...exprs, '].filter(Boolean).join(" ")}'];
11183
+ if (exprs.length === 1) {
11184
+ let root = exprs[0];
11185
+ while (root.length && module2.isWhitespaceOrEmpty(root[root.length - 1])) {
11186
+ root = root.slice(0, -1);
11187
+ }
11188
+ while (root?.length === 1)
11189
+ root = root[0];
11190
+ if (root?.children)
11191
+ root = root.children;
11192
+ if (root?.[0]?.token === "`") {
11193
+ classValue = ["{", ...exprs, "}"];
11194
+ } else {
11195
+ classValue = ["{(", ...exprs, ') || ""}'];
11196
+ }
11197
+ } else {
11198
+ classValue = ["{[", ...exprs, '].filter(Boolean).join(" ")}'];
11199
+ }
11153
11200
  } else {
11154
11201
  classValue = JSON.stringify(stringPart);
11155
11202
  }
@@ -11705,7 +11752,8 @@ ${input.slice(result.pos)}
11705
11752
  }
11706
11753
  var JSXChild$0 = JSXElement;
11707
11754
  var JSXChild$1 = JSXFragment;
11708
- var JSXChild$2 = $TS($S(OpenBrace, $E(JSXChildExpression), __, CloseBrace), function($skip, $loc, $0, $1, $2, $3, $4) {
11755
+ var JSXChild$2 = JSXComment;
11756
+ var JSXChild$3 = $TS($S(OpenBrace, $E(JSXChildExpression), __, CloseBrace), function($skip, $loc, $0, $1, $2, $3, $4) {
11709
11757
  var expression = $2;
11710
11758
  return {
11711
11759
  type: "JSXChildExpression",
@@ -11713,7 +11761,7 @@ ${input.slice(result.pos)}
11713
11761
  expression
11714
11762
  };
11715
11763
  });
11716
- var JSXChild$3 = $TS($S(InsertInlineOpenBrace, ArrowFunction, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3) {
11764
+ var JSXChild$4 = $TS($S(InsertInlineOpenBrace, ArrowFunction, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3) {
11717
11765
  var expression = $2;
11718
11766
  return {
11719
11767
  type: "JSXChildExpression",
@@ -11721,7 +11769,7 @@ ${input.slice(result.pos)}
11721
11769
  expression
11722
11770
  };
11723
11771
  });
11724
- var JSXChild$4 = JSXText;
11772
+ var JSXChild$5 = JSXText;
11725
11773
  function JSXChild(state) {
11726
11774
  if (state.events) {
11727
11775
  const result = state.events.enter?.("JSXChild", state);
@@ -11729,18 +11777,60 @@ ${input.slice(result.pos)}
11729
11777
  return result.cache;
11730
11778
  }
11731
11779
  if (state.tokenize) {
11732
- const result = $TOKEN("JSXChild", state, JSXChild$0(state) || JSXChild$1(state) || JSXChild$2(state) || JSXChild$3(state) || JSXChild$4(state));
11780
+ const result = $TOKEN("JSXChild", state, JSXChild$0(state) || JSXChild$1(state) || JSXChild$2(state) || JSXChild$3(state) || JSXChild$4(state) || JSXChild$5(state));
11733
11781
  if (state.events)
11734
11782
  state.events.exit?.("JSXChild", state, result);
11735
11783
  return result;
11736
11784
  } else {
11737
- const result = JSXChild$0(state) || JSXChild$1(state) || JSXChild$2(state) || JSXChild$3(state) || JSXChild$4(state);
11785
+ const result = JSXChild$0(state) || JSXChild$1(state) || JSXChild$2(state) || JSXChild$3(state) || JSXChild$4(state) || JSXChild$5(state);
11738
11786
  if (state.events)
11739
11787
  state.events.exit?.("JSXChild", state, result);
11740
11788
  return result;
11741
11789
  }
11742
11790
  }
11743
- var JSXText$0 = $TR($EXPECT($R47, fail, "JSXText /[^{}<>\\r\\n]+/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
11791
+ var JSXComment$0 = $TS($S($EXPECT($L157, fail, 'JSXComment "<!--"'), JSXCommentContent, $EXPECT($L158, fail, 'JSXComment "-->"')), function($skip, $loc, $0, $1, $2, $3) {
11792
+ return ["{/*", $2, "*/}"];
11793
+ });
11794
+ function JSXComment(state) {
11795
+ if (state.events) {
11796
+ const result = state.events.enter?.("JSXComment", state);
11797
+ if (result)
11798
+ return result.cache;
11799
+ }
11800
+ if (state.tokenize) {
11801
+ const result = $TOKEN("JSXComment", state, JSXComment$0(state));
11802
+ if (state.events)
11803
+ state.events.exit?.("JSXComment", state, result);
11804
+ return result;
11805
+ } else {
11806
+ const result = JSXComment$0(state);
11807
+ if (state.events)
11808
+ state.events.exit?.("JSXComment", state, result);
11809
+ return result;
11810
+ }
11811
+ }
11812
+ var JSXCommentContent$0 = $TR($EXPECT($R47, fail, "JSXCommentContent /(?:-[^-]|[^-]*)*/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
11813
+ return { $loc, token: $0.replace(/\*\//g, "* /") };
11814
+ });
11815
+ function JSXCommentContent(state) {
11816
+ if (state.events) {
11817
+ const result = state.events.enter?.("JSXCommentContent", state);
11818
+ if (result)
11819
+ return result.cache;
11820
+ }
11821
+ if (state.tokenize) {
11822
+ const result = $TOKEN("JSXCommentContent", state, JSXCommentContent$0(state));
11823
+ if (state.events)
11824
+ state.events.exit?.("JSXCommentContent", state, result);
11825
+ return result;
11826
+ } else {
11827
+ const result = JSXCommentContent$0(state);
11828
+ if (state.events)
11829
+ state.events.exit?.("JSXCommentContent", state, result);
11830
+ return result;
11831
+ }
11832
+ }
11833
+ var JSXText$0 = $TR($EXPECT($R48, fail, "JSXText /[^{}<>\\r\\n]+/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
11744
11834
  return {
11745
11835
  type: "JSXText",
11746
11836
  token: $0,
@@ -11805,7 +11895,7 @@ ${input.slice(result.pos)}
11805
11895
  return result;
11806
11896
  }
11807
11897
  }
11808
- var TypeDeclarationModifier$0 = $S($EXPECT($L157, fail, 'TypeDeclarationModifier "declare"'), NonIdContinue);
11898
+ var TypeDeclarationModifier$0 = $S($EXPECT($L159, fail, 'TypeDeclarationModifier "declare"'), NonIdContinue);
11809
11899
  var TypeDeclarationModifier$1 = Export;
11810
11900
  function TypeDeclarationModifier(state) {
11811
11901
  if (state.events) {
@@ -11847,7 +11937,7 @@ ${input.slice(result.pos)}
11847
11937
  return result;
11848
11938
  }
11849
11939
  }
11850
- var TypeKeyword$0 = $S($EXPECT($L158, fail, 'TypeKeyword "type"'), NonIdContinue);
11940
+ var TypeKeyword$0 = $S($EXPECT($L160, fail, 'TypeKeyword "type"'), NonIdContinue);
11851
11941
  function TypeKeyword(state) {
11852
11942
  if (state.events) {
11853
11943
  const result = state.events.enter?.("TypeKeyword", state);
@@ -11866,7 +11956,7 @@ ${input.slice(result.pos)}
11866
11956
  return result;
11867
11957
  }
11868
11958
  }
11869
- var Interface$0 = $S($EXPECT($L159, fail, 'Interface "interface"'), NonIdContinue);
11959
+ var Interface$0 = $S($EXPECT($L161, fail, 'Interface "interface"'), NonIdContinue);
11870
11960
  function Interface(state) {
11871
11961
  if (state.events) {
11872
11962
  const result = state.events.enter?.("Interface", state);
@@ -11885,7 +11975,7 @@ ${input.slice(result.pos)}
11885
11975
  return result;
11886
11976
  }
11887
11977
  }
11888
- var Namespace$0 = $S($EXPECT($L160, fail, 'Namespace "namespace"'), NonIdContinue);
11978
+ var Namespace$0 = $S($EXPECT($L162, fail, 'Namespace "namespace"'), NonIdContinue);
11889
11979
  function Namespace(state) {
11890
11980
  if (state.events) {
11891
11981
  const result = state.events.enter?.("Namespace", state);
@@ -12074,7 +12164,7 @@ ${input.slice(result.pos)}
12074
12164
  return result;
12075
12165
  }
12076
12166
  }
12077
- var TypeIndexSignature$0 = $S($E($S($R$0($EXPECT($R48, fail, "TypeIndexSignature /[+-]?/")), $EXPECT($L129, fail, 'TypeIndexSignature "readonly"'), __)), OpenBracket, TypeIndex, CloseBracket, $E($S(__, $R$0($EXPECT($R4, fail, "TypeIndexSignature /[+-]/")), QuestionMark)));
12167
+ var TypeIndexSignature$0 = $S($E($S($R$0($EXPECT($R49, fail, "TypeIndexSignature /[+-]?/")), $EXPECT($L129, fail, 'TypeIndexSignature "readonly"'), __)), OpenBracket, TypeIndex, CloseBracket, $E($S(__, $R$0($EXPECT($R4, fail, "TypeIndexSignature /[+-]/")), QuestionMark)));
12078
12168
  function TypeIndexSignature(state) {
12079
12169
  if (state.events) {
12080
12170
  const result = state.events.enter?.("TypeIndexSignature", state);
@@ -12134,7 +12224,7 @@ ${input.slice(result.pos)}
12134
12224
  return result;
12135
12225
  }
12136
12226
  }
12137
- var ReturnTypeSuffix$0 = $TS($S(__, Colon, $E($S(__, $EXPECT($L161, fail, 'ReturnTypeSuffix "asserts"'), NonIdContinue)), TypePredicate), function($skip, $loc, $0, $1, $2, $3, $4) {
12227
+ var ReturnTypeSuffix$0 = $TS($S(__, Colon, $E($S(__, $EXPECT($L163, fail, 'ReturnTypeSuffix "asserts"'), NonIdContinue)), TypePredicate), function($skip, $loc, $0, $1, $2, $3, $4) {
12138
12228
  const children = [...$1, $2];
12139
12229
  if ($3)
12140
12230
  children.push($3);
@@ -12269,9 +12359,9 @@ ${input.slice(result.pos)}
12269
12359
  return result;
12270
12360
  }
12271
12361
  }
12272
- var TypeUnaryOp$0 = $EXPECT($L162, fail, 'TypeUnaryOp "keyof"');
12362
+ var TypeUnaryOp$0 = $EXPECT($L164, fail, 'TypeUnaryOp "keyof"');
12273
12363
  var TypeUnaryOp$1 = $EXPECT($L145, fail, 'TypeUnaryOp "typeof"');
12274
- var TypeUnaryOp$2 = $EXPECT($L163, fail, 'TypeUnaryOp "infer"');
12364
+ var TypeUnaryOp$2 = $EXPECT($L165, fail, 'TypeUnaryOp "infer"');
12275
12365
  var TypeUnaryOp$3 = $EXPECT($L129, fail, 'TypeUnaryOp "readonly"');
12276
12366
  function TypeUnaryOp(state) {
12277
12367
  if (state.events) {
@@ -12444,7 +12534,7 @@ ${input.slice(result.pos)}
12444
12534
  var TypeLiteral$2 = $TV($EXPECT($L149, fail, 'TypeLiteral "void"'), function($skip, $loc, $0, $1) {
12445
12535
  return { $loc, token: "void" };
12446
12536
  });
12447
- var TypeLiteral$3 = $TV($EXPECT($L164, fail, 'TypeLiteral "[]"'), function($skip, $loc, $0, $1) {
12537
+ var TypeLiteral$3 = $TV($EXPECT($L166, fail, 'TypeLiteral "[]"'), function($skip, $loc, $0, $1) {
12448
12538
  return { $loc, token: "[]" };
12449
12539
  });
12450
12540
  function TypeLiteral(state) {
@@ -12676,7 +12766,7 @@ ${input.slice(result.pos)}
12676
12766
  return result;
12677
12767
  }
12678
12768
  }
12679
- var Shebang$0 = $S($R$0($EXPECT($R49, fail, "Shebang /#![^\\r\\n]*/")), EOL);
12769
+ var Shebang$0 = $S($R$0($EXPECT($R50, fail, "Shebang /#![^\\r\\n]*/")), EOL);
12680
12770
  function Shebang(state) {
12681
12771
  if (state.events) {
12682
12772
  const result = state.events.enter?.("Shebang", state);
@@ -12695,11 +12785,11 @@ ${input.slice(result.pos)}
12695
12785
  return result;
12696
12786
  }
12697
12787
  }
12698
- var CivetPrologue$0 = $T($S($EXPECT($R50, fail, "CivetPrologue /[\\t ]*/"), DoubleQuote, CivetPrologueContent, DoubleQuote, $TEXT(StatementDelimiter), $E(EOS)), function(value) {
12788
+ var CivetPrologue$0 = $T($S($EXPECT($R51, fail, "CivetPrologue /[\\t ]*/"), DoubleQuote, CivetPrologueContent, DoubleQuote, $TEXT(StatementDelimiter), $E(EOS)), function(value) {
12699
12789
  var content = value[2];
12700
12790
  return content;
12701
12791
  });
12702
- var CivetPrologue$1 = $T($S($EXPECT($R50, fail, "CivetPrologue /[\\t ]*/"), SingleQuote, CivetPrologueContent, SingleQuote, $TEXT(StatementDelimiter), $E(EOS)), function(value) {
12792
+ var CivetPrologue$1 = $T($S($EXPECT($R51, fail, "CivetPrologue /[\\t ]*/"), SingleQuote, CivetPrologueContent, SingleQuote, $TEXT(StatementDelimiter), $E(EOS)), function(value) {
12703
12793
  var content = value[2];
12704
12794
  return content;
12705
12795
  });
@@ -12721,7 +12811,7 @@ ${input.slice(result.pos)}
12721
12811
  return result;
12722
12812
  }
12723
12813
  }
12724
- var CivetPrologueContent$0 = $TS($S($EXPECT($L165, fail, 'CivetPrologueContent "civet"'), $Q(CivetOption), $EXPECT($R51, fail, "CivetPrologueContent /[\\s]*/")), function($skip, $loc, $0, $1, $2, $3) {
12814
+ var CivetPrologueContent$0 = $TS($S($EXPECT($L167, fail, 'CivetPrologueContent "civet"'), $Q(CivetOption), $EXPECT($R52, fail, "CivetPrologueContent /[\\s]*/")), function($skip, $loc, $0, $1, $2, $3) {
12725
12815
  var options = $2;
12726
12816
  return {
12727
12817
  type: "CivetPrologue",
@@ -12747,7 +12837,7 @@ ${input.slice(result.pos)}
12747
12837
  return result;
12748
12838
  }
12749
12839
  }
12750
- var CivetOption$0 = $TR($EXPECT($R52, fail, "CivetOption /\\s+([+-]?)([a-zA-Z0-9-]+)(\\s*=\\s*([a-zA-Z0-9.+-]*))?/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
12840
+ var CivetOption$0 = $TR($EXPECT($R53, fail, "CivetOption /\\s+([+-]?)([a-zA-Z0-9-]+)(\\s*=\\s*([a-zA-Z0-9.+-]*))?/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
12751
12841
  const optionName = $2.replace(/-+([a-z]?)/g, (_2, l) => {
12752
12842
  if (l)
12753
12843
  return l.toUpperCase();
@@ -12779,7 +12869,7 @@ ${input.slice(result.pos)}
12779
12869
  return result;
12780
12870
  }
12781
12871
  }
12782
- var UnknownPrologue$0 = $S($R$0($EXPECT($R50, fail, "UnknownPrologue /[\\t ]*/")), BasicStringLiteral, $TEXT(StatementDelimiter), EOS);
12872
+ var UnknownPrologue$0 = $S($R$0($EXPECT($R51, fail, "UnknownPrologue /[\\t ]*/")), BasicStringLiteral, $TEXT(StatementDelimiter), EOS);
12783
12873
  function UnknownPrologue(state) {
12784
12874
  if (state.events) {
12785
12875
  const result = state.events.enter?.("UnknownPrologue", state);
@@ -12837,7 +12927,7 @@ ${input.slice(result.pos)}
12837
12927
  return result;
12838
12928
  }
12839
12929
  }
12840
- var EOL$0 = $TR($EXPECT($R53, fail, "EOL /\\r\\n|\\n|\\r|$/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
12930
+ var EOL$0 = $TR($EXPECT($R54, fail, "EOL /\\r\\n|\\n|\\r|$/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
12841
12931
  return { $loc, token: $0 };
12842
12932
  });
12843
12933
  function EOL(state) {
@@ -13938,6 +14028,8 @@ ${input.slice(result.pos)}
13938
14028
  insertReturn(exp.children[2][3]);
13939
14029
  return;
13940
14030
  }
14031
+ if (node[node.length - 1]?.type === "SemicolonDelimiter")
14032
+ return;
13941
14033
  node.splice(1, 0, "return ");
13942
14034
  }
13943
14035
  module2.isWhitespaceOrEmpty = function(node) {
@@ -13945,6 +14037,8 @@ ${input.slice(result.pos)}
13945
14037
  return true;
13946
14038
  if (node.token)
13947
14039
  return node.token.match(/^\s*$/);
14040
+ if (node.children)
14041
+ node = node.children;
13948
14042
  if (!node.length)
13949
14043
  return true;
13950
14044
  if (typeof node === "string")
@@ -14597,7 +14691,7 @@ ${input.slice(result.pos)}
14597
14691
  }
14598
14692
  };
14599
14693
  module2.constructPipeStep = function(caller, callee) {
14600
- if (caller.expr.token === "yield" || caller.expr.token === "await") {
14694
+ if (caller.expr.token === "yield" || caller.expr.token === "await" || caller.expr.token === "return") {
14601
14695
  return [caller.leadingComment, caller.expr, caller.trailingComment, " ", callee.leadingComment, callee.expr, callee.trailingComment];
14602
14696
  }
14603
14697
  return module2.constructInvocation(caller, callee);
@@ -14622,7 +14716,7 @@ ${input.slice(result.pos)}
14622
14716
  return result;
14623
14717
  }
14624
14718
  }
14625
- var Indent$0 = $TR($EXPECT($R54, fail, "Indent /[ \\t]*/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
14719
+ var Indent$0 = $TR($EXPECT($R55, fail, "Indent /[ \\t]*/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
14626
14720
  let level;
14627
14721
  if (module2.config.tab) {
14628
14722
  const tabs = $0.match(/\t/g);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danielx/civet",
3
- "version": "0.5.18",
3
+ "version": "0.5.20",
4
4
  "description": "CoffeeScript style syntax for TypeScript",
5
5
  "main": "dist/main.js",
6
6
  "exports": {