@danielx/civet 0.8.5 → 0.8.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,16 @@ This changelog is generated automatically by [`build/changelog.civet`](build/cha
4
4
  For each version of Civet, it lists and links to all incorporated PRs,
5
5
  as well as a full diff and commit list.
6
6
 
7
+ ## 0.8.7 (2024-10-22, [diff](https://github.com/DanielXMoore/Civet/compare/v0.8.6...v0.8.7), [commits](https://github.com/DanielXMoore/Civet/commits/v0.8.7))
8
+ * Fix one-line arrow functions with `@` arguments [[#1490](https://github.com/DanielXMoore/Civet/pull/1490)]
9
+ * Fix `Promise<void>` detection with implicit type arguments [[#1491](https://github.com/DanielXMoore/Civet/pull/1491)]
10
+ * Fix await with array member expression [[#1492](https://github.com/DanielXMoore/Civet/pull/1492)]
11
+
12
+ ## 0.8.6 (2024-10-21, [diff](https://github.com/DanielXMoore/Civet/compare/v0.8.5...v0.8.6), [commits](https://github.com/DanielXMoore/Civet/commits/v0.8.6))
13
+ * Fix CLI with complex `NODE_OPTIONS`, LSP cleanup [[#1482](https://github.com/DanielXMoore/Civet/pull/1482)]
14
+ * `if` conditions continued by binary op on next line [[#1483](https://github.com/DanielXMoore/Civet/pull/1483)]
15
+ * `from ... import/export` (reversed `import`/`export`) [[#1484](https://github.com/DanielXMoore/Civet/pull/1484)]
16
+
7
17
  ## 0.8.5 (2024-10-21, [diff](https://github.com/DanielXMoore/Civet/compare/v0.8.4...v0.8.5), [commits](https://github.com/DanielXMoore/Civet/commits/v0.8.5))
8
18
  * Reverse slices and inequality slices with implicit parts [[#1478](https://github.com/DanielXMoore/Civet/pull/1478)]
9
19
  * Indented types after binary type operators [[#1479](https://github.com/DanielXMoore/Civet/pull/1479)]
package/dist/browser.js CHANGED
@@ -547,6 +547,7 @@ ${body}`;
547
547
  hasImportDeclaration: () => hasImportDeclaration,
548
548
  hasYield: () => hasYield,
549
549
  insertTrimmingSpace: () => insertTrimmingSpace,
550
+ isComma: () => isComma,
550
551
  isEmptyBareBlock: () => isEmptyBareBlock,
551
552
  isFunction: () => isFunction,
552
553
  isWhitespaceOrEmpty: () => isWhitespaceOrEmpty,
@@ -2344,11 +2345,21 @@ ${js}`
2344
2345
  }
2345
2346
 
2346
2347
  // source/parser/function.civet
2348
+ function getTypeArguments(args) {
2349
+ while (typeof args === "object" && args != null && "args" in args) {
2350
+ args = args.args;
2351
+ }
2352
+ if (!Array.isArray(args)) {
2353
+ throw new Error("getTypeArguments could not find relevant array");
2354
+ }
2355
+ return args.filter((a) => typeof a === "object" && a != null && "type" in a && a.type === "TypeArgument");
2356
+ }
2347
2357
  function isVoidType(t) {
2348
- return t?.type === "TypeLiteral" && t.t.type === "VoidType";
2358
+ return typeof t === "object" && t != null && "type" in t && t.type === "TypeLiteral" && "t" in t && typeof t.t === "object" && t.t != null && "type" in t.t && t.t.type === "VoidType";
2349
2359
  }
2350
2360
  function isPromiseVoidType(t) {
2351
- return t?.type === "TypeIdentifier" && t.raw === "Promise" && t.args?.types?.length === 1 && isVoidType(t.args.types[0]);
2361
+ let args;
2362
+ return typeof t === "object" && t != null && "type" in t && t.type === "TypeIdentifier" && "raw" in t && t.raw === "Promise" && (args = getTypeArguments(t.args?.args)).length === 1 && isVoidType(args[0].t);
2352
2363
  }
2353
2364
  function implicitFunctionBlock(f) {
2354
2365
  if (f.abstract || f.block || f.signature?.optional)
@@ -2934,7 +2945,7 @@ ${js}`
2934
2945
  if (isConstructor) {
2935
2946
  const { ancestor } = findAncestor(f, ($5) => $5.type === "ClassExpression");
2936
2947
  if (ancestor != null) {
2937
- const fields = new Set(gatherRecursiveWithinFunction(ancestor, ($6) => $6.type === "FieldDefinition").map(($7) => $7.id).filter((a) => typeof a === "object" && a != null && "type" in a && a.type === "Identifier").map(($8) => $8.name));
2948
+ const fields = new Set(gatherRecursiveWithinFunction(ancestor, ($6) => $6.type === "FieldDefinition").map(($7) => $7.id).filter((a1) => typeof a1 === "object" && a1 != null && "type" in a1 && a1.type === "Identifier").map(($8) => $8.name));
2938
2949
  const classExpressions = ancestor.body.expressions;
2939
2950
  let index = findChildIndex(classExpressions, f);
2940
2951
  assert.notEqual(index, -1, "Could not find constructor in class");
@@ -2986,10 +2997,10 @@ ${js}`
2986
2997
  if (isConstructor) {
2987
2998
  const superCalls = gatherNodes(
2988
2999
  expressions,
2989
- (a1) => typeof a1 === "object" && a1 != null && "type" in a1 && a1.type === "CallExpression" && "children" in a1 && Array.isArray(a1.children) && a1.children.length >= 1 && typeof a1.children[0] === "object" && a1.children[0] != null && "token" in a1.children[0] && a1.children[0].token === "super"
3000
+ (a2) => typeof a2 === "object" && a2 != null && "type" in a2 && a2.type === "CallExpression" && "children" in a2 && Array.isArray(a2.children) && a2.children.length >= 1 && typeof a2.children[0] === "object" && a2.children[0] != null && "token" in a2.children[0] && a2.children[0].token === "super"
2990
3001
  );
2991
3002
  if (superCalls.length) {
2992
- const { child } = findAncestor(superCalls[0], (a2) => a2 === block);
3003
+ const { child } = findAncestor(superCalls[0], (a3) => a3 === block);
2993
3004
  const index = findChildIndex(expressions, child);
2994
3005
  if (index < 0) {
2995
3006
  throw new Error("Could not find super call within top-level expressions");
@@ -2999,6 +3010,7 @@ ${js}`
2999
3010
  }
3000
3011
  }
3001
3012
  expressions.unshift(...prefix);
3013
+ braceBlock(block);
3002
3014
  }
3003
3015
  function processSignature(f) {
3004
3016
  const { block, signature } = f;
@@ -3121,11 +3133,11 @@ ${js}`
3121
3133
  parameter = {
3122
3134
  ...parameter,
3123
3135
  initializer: void 0,
3124
- children: parameter.children.filter((a3) => a3 !== initializer)
3136
+ children: parameter.children.filter((a4) => a4 !== initializer)
3125
3137
  };
3126
3138
  } else {
3127
3139
  args.push(parameter.children.filter(
3128
- (a4) => a4 !== parameter.typeSuffix
3140
+ (a5) => a5 !== parameter.typeSuffix
3129
3141
  ));
3130
3142
  }
3131
3143
  }
@@ -3198,7 +3210,7 @@ ${js}`
3198
3210
  }
3199
3211
  if (gatherRecursiveWithinFunction(
3200
3212
  block,
3201
- (a5) => a5 === ref
3213
+ (a6) => a6 === ref
3202
3214
  ).length > 1) {
3203
3215
  fn.ampersandBlock = false;
3204
3216
  }
@@ -7757,6 +7769,8 @@ ${js}`
7757
7769
  NamedImports,
7758
7770
  OperatorNamedImports,
7759
7771
  FromClause,
7772
+ ImpliedFromClause,
7773
+ ImpliedFrom,
7760
7774
  ImportAssertion,
7761
7775
  TypeAndImportSpecifier,
7762
7776
  ImportSpecifier,
@@ -8093,6 +8107,7 @@ ${js}`
8093
8107
  NestedTypeArgumentList,
8094
8108
  NestedTypeArgument,
8095
8109
  SingleLineTypeArgumentList,
8110
+ WTypeArgument,
8096
8111
  TypeArgumentDelimited,
8097
8112
  TypeArgument,
8098
8113
  TypeArgumentDelimiter,
@@ -8441,7 +8456,7 @@ ${js}`
8441
8456
  var $R29 = (0, import_lib4.$R)(new RegExp("[:.]", "suy"));
8442
8457
  var $R30 = (0, import_lib4.$R)(new RegExp("(?=for|if|loop|unless|until|while)", "suy"));
8443
8458
  var $R31 = (0, import_lib4.$R)(new RegExp("(?=loop|comptime|do|for|until|while)", "suy"));
8444
- var $R32 = (0, import_lib4.$R)(new RegExp('[^;"\\s]+', "suy"));
8459
+ var $R32 = (0, import_lib4.$R)(new RegExp('[^;"\\s=>]+', "suy"));
8445
8460
  var $R33 = (0, import_lib4.$R)(new RegExp("(?=[0-9.])", "suy"));
8446
8461
  var $R34 = (0, import_lib4.$R)(new RegExp("(?:0|[1-9](?:_[0-9]|[0-9])*)n", "suy"));
8447
8462
  var $R35 = (0, import_lib4.$R)(new RegExp("(?:0|[1-9](?:_[0-9]|[0-9])*)(?=\\.(?:\\p{ID_Start}|[_$]))", "suy"));
@@ -8954,10 +8969,10 @@ ${js}`
8954
8969
  function RHS(ctx, state2) {
8955
8970
  return (0, import_lib4.$EVENT_C)(ctx, state2, "RHS", RHS$$);
8956
8971
  }
8957
- var UnaryExpression$0 = (0, import_lib4.$TS)((0, import_lib4.$S)(IndentedApplicationAllowed, (0, import_lib4.$P)(UnaryOp), (0, import_lib4.$C)(ArrayLiteral, NestedArgumentList), (0, import_lib4.$E)(UnaryPostfix)), function($skip, $loc, $0, $1, $2, $3, $4) {
8972
+ var UnaryExpression$0 = (0, import_lib4.$TS)((0, import_lib4.$S)(IndentedApplicationAllowed, (0, import_lib4.$P)(UnaryOp), (0, import_lib4.$C)(ArrayLiteral, NestedArgumentList), (0, import_lib4.$N)(CallExpressionRest), (0, import_lib4.$E)(UnaryPostfix)), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
8958
8973
  var pre = $2;
8959
8974
  var args = $3;
8960
- var post = $4;
8975
+ var post = $5;
8961
8976
  return processUnaryNestedExpression(pre, args, post) ?? $skip;
8962
8977
  });
8963
8978
  var UnaryExpression$1 = (0, import_lib4.$TS)((0, import_lib4.$S)((0, import_lib4.$Q)(UnaryOp), UnaryBody, (0, import_lib4.$E)(UnaryPostfix)), function($skip, $loc, $0, $1, $2, $3) {
@@ -9950,14 +9965,22 @@ ${js}`
9950
9965
  var CallExpression$1 = (0, import_lib4.$TS)((0, import_lib4.$S)(Import, _, NamedImports, __, FromClause), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
9951
9966
  return dynamizeImportDeclarationExpression($0);
9952
9967
  });
9953
- var CallExpression$2 = (0, import_lib4.$TS)((0, import_lib4.$S)((0, import_lib4.$EXPECT)($L15, 'CallExpression "import"'), ArgumentsWithTrailingMemberExpressions, (0, import_lib4.$Q)(CallExpressionRest)), function($skip, $loc, $0, $1, $2, $3) {
9968
+ var CallExpression$2 = (0, import_lib4.$TS)((0, import_lib4.$S)(FromClause, __, Import, _, NamedImports), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
9969
+ var from = $1;
9970
+ var fws = $2;
9971
+ var i = $3;
9972
+ var iws = $4;
9973
+ var imports = $5;
9974
+ return dynamizeImportDeclarationExpression([i, iws, imports, fws, from]);
9975
+ });
9976
+ var CallExpression$3 = (0, import_lib4.$TS)((0, import_lib4.$S)((0, import_lib4.$EXPECT)($L15, 'CallExpression "import"'), ArgumentsWithTrailingMemberExpressions, (0, import_lib4.$Q)(CallExpressionRest)), function($skip, $loc, $0, $1, $2, $3) {
9954
9977
  var rest = $3;
9955
9978
  return processCallMemberExpression({
9956
9979
  type: "CallExpression",
9957
9980
  children: [$1, ...$2, ...rest.flat()]
9958
9981
  });
9959
9982
  });
9960
- var CallExpression$3 = (0, import_lib4.$TS)((0, import_lib4.$S)(MemberExpression, AllowedTrailingMemberExpressions, (0, import_lib4.$Q)(CallExpressionRest)), function($skip, $loc, $0, $1, $2, $3) {
9983
+ var CallExpression$4 = (0, import_lib4.$TS)((0, import_lib4.$S)(MemberExpression, AllowedTrailingMemberExpressions, (0, import_lib4.$Q)(CallExpressionRest)), function($skip, $loc, $0, $1, $2, $3) {
9961
9984
  var member = $1;
9962
9985
  var trailing = $2;
9963
9986
  var rest = $3;
@@ -9970,7 +9993,7 @@ ${js}`
9970
9993
  }
9971
9994
  return member;
9972
9995
  });
9973
- var CallExpression$$ = [CallExpression$0, CallExpression$1, CallExpression$2, CallExpression$3];
9996
+ var CallExpression$$ = [CallExpression$0, CallExpression$1, CallExpression$2, CallExpression$3, CallExpression$4];
9974
9997
  function CallExpression(ctx, state2) {
9975
9998
  return (0, import_lib4.$EVENT_C)(ctx, state2, "CallExpression", CallExpression$$);
9976
9999
  }
@@ -14000,9 +14023,12 @@ ${js}`
14000
14023
  function ForBinding(ctx, state2) {
14001
14024
  return (0, import_lib4.$EVENT)(ctx, state2, "ForBinding", ForBinding$0);
14002
14025
  }
14003
- var SwitchStatement$0 = (0, import_lib4.$TS)((0, import_lib4.$S)(Switch, (0, import_lib4.$C)(EmptyCondition, Condition), CaseBlock), function($skip, $loc, $0, $1, $2, $3) {
14004
- var condition = $2;
14005
- var caseBlock = $3;
14026
+ var SwitchStatement$0 = (0, import_lib4.$TS)((0, import_lib4.$S)(Switch, ForbidNewlineBinaryOp, (0, import_lib4.$E)((0, import_lib4.$C)(EmptyCondition, Condition)), RestoreNewlineBinaryOp, CaseBlock), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
14027
+ var s = $1;
14028
+ var condition = $3;
14029
+ var caseBlock = $5;
14030
+ if (!condition)
14031
+ return $skip;
14006
14032
  if (condition.type === "EmptyCondition") {
14007
14033
  caseBlock.clauses.forEach(({ cases }) => {
14008
14034
  if (cases) {
@@ -14022,7 +14048,8 @@ ${js}`
14022
14048
  }
14023
14049
  return {
14024
14050
  type: "SwitchStatement",
14025
- children: $0,
14051
+ children: [s, condition, caseBlock],
14052
+ // omit NewlineBinaryOp control
14026
14053
  condition,
14027
14054
  caseBlock
14028
14055
  };
@@ -14390,8 +14417,8 @@ ${js}`
14390
14417
  function SingleLineExpressionWithIndentedApplicationForbidden(ctx, state2) {
14391
14418
  return (0, import_lib4.$EVENT)(ctx, state2, "SingleLineExpressionWithIndentedApplicationForbidden", SingleLineExpressionWithIndentedApplicationForbidden$0);
14392
14419
  }
14393
- var ExpressionWithObjectApplicationForbidden$0 = (0, import_lib4.$TS)((0, import_lib4.$S)(ForbidBracedApplication, ForbidIndentedApplication, ForbidNewlineBinaryOp, (0, import_lib4.$E)(Expression), RestoreNewlineBinaryOp, RestoreBracedApplication, RestoreIndentedApplication), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7) {
14394
- var exp = $4;
14420
+ var ExpressionWithObjectApplicationForbidden$0 = (0, import_lib4.$TS)((0, import_lib4.$S)(ForbidBracedApplication, ForbidIndentedApplication, (0, import_lib4.$E)(Expression), RestoreBracedApplication, RestoreIndentedApplication), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
14421
+ var exp = $3;
14395
14422
  if (exp)
14396
14423
  return exp;
14397
14424
  return $skip;
@@ -14780,36 +14807,41 @@ ${js}`
14780
14807
  children: [imp, $0.slice(1)]
14781
14808
  };
14782
14809
  });
14783
- var ImportDeclaration$1 = (0, import_lib4.$T)((0, import_lib4.$S)(Import, __, TypeKeyword, __, ImportClause, __, FromClause), function(value) {
14784
- var imports = value[4];
14785
- var from = value[6];
14786
- return { "type": "ImportDeclaration", "ts": true, "children": value, "imports": imports, "from": from };
14787
- });
14788
- var ImportDeclaration$2 = (0, import_lib4.$TS)((0, import_lib4.$S)(Import, __, Operator, (0, import_lib4.$E)(OperatorBehavior), __, OperatorNamedImports, __, FromClause), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8) {
14789
- var behavior = $4;
14790
- var imports = $6;
14791
- var from = $8;
14810
+ var ImportDeclaration$1 = (0, import_lib4.$TS)((0, import_lib4.$S)((0, import_lib4.$C)((0, import_lib4.$S)(Import, __), ImpliedImport), Operator, (0, import_lib4.$E)(OperatorBehavior), __, OperatorNamedImports, __, FromClause), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7) {
14811
+ var i = $1;
14812
+ var behavior = $3;
14813
+ var ws1 = $4;
14814
+ var imports = $5;
14815
+ var ws2 = $6;
14816
+ var from = $7;
14792
14817
  imports.specifiers.forEach((spec) => {
14793
14818
  state.operators.set(spec.binding.name, spec.behavior ?? behavior);
14794
14819
  });
14795
14820
  return {
14796
14821
  type: "ImportDeclaration",
14797
- children: [$1, $2, trimFirstSpace($5), imports, $7, from],
14798
- // omit $3 = Operator and $4 = OperatorBehavior
14822
+ children: [i, trimFirstSpace(ws1), imports, ws2, from],
14823
+ // omit $2 = Operator and $3 = OperatorBehavior
14799
14824
  imports,
14800
14825
  from
14801
14826
  };
14802
14827
  });
14803
- var ImportDeclaration$3 = (0, import_lib4.$T)((0, import_lib4.$S)(Import, __, ImportClause, __, FromClause), function(value) {
14804
- var imports = value[2];
14805
- var from = value[4];
14806
- return { "type": "ImportDeclaration", "children": value, "imports": imports, "from": from };
14828
+ var ImportDeclaration$2 = (0, import_lib4.$TS)((0, import_lib4.$S)(Import, __, (0, import_lib4.$E)((0, import_lib4.$S)(TypeKeyword, __)), ImportClause, __, FromClause), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
14829
+ var t = $3;
14830
+ var imports = $4;
14831
+ var from = $6;
14832
+ return {
14833
+ type: "ImportDeclaration",
14834
+ children: $0,
14835
+ imports,
14836
+ from,
14837
+ ts: !!t
14838
+ };
14807
14839
  });
14808
- var ImportDeclaration$4 = (0, import_lib4.$T)((0, import_lib4.$S)(Import, __, ModuleSpecifier), function(value) {
14840
+ var ImportDeclaration$3 = (0, import_lib4.$T)((0, import_lib4.$S)(Import, __, ModuleSpecifier), function(value) {
14809
14841
  var module = value[2];
14810
14842
  return { "type": "ImportDeclaration", "children": value, "module": module };
14811
14843
  });
14812
- var ImportDeclaration$5 = (0, import_lib4.$TS)((0, import_lib4.$S)(ImpliedImport, (0, import_lib4.$E)((0, import_lib4.$S)(TypeKeyword, __)), ImportClause, __, FromClause), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
14844
+ var ImportDeclaration$4 = (0, import_lib4.$TS)((0, import_lib4.$S)(ImpliedImport, (0, import_lib4.$E)((0, import_lib4.$S)(TypeKeyword, __)), ImportClause, __, FromClause), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
14813
14845
  var i = $1;
14814
14846
  var t = $2;
14815
14847
  var imports = $3;
@@ -14822,22 +14854,40 @@ ${js}`
14822
14854
  const children = [i, t, imports, w, from];
14823
14855
  return { type: "ImportDeclaration", ts: !!t, children, imports, from };
14824
14856
  });
14825
- var ImportDeclaration$6 = (0, import_lib4.$TS)((0, import_lib4.$S)(ImpliedImport, Operator, (0, import_lib4.$E)(OperatorBehavior), __, OperatorNamedImports, __, FromClause), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7) {
14826
- var i = $1;
14827
- var behavior = $3;
14828
- var imports = $5;
14829
- var from = $7;
14857
+ var ImportDeclaration$5 = (0, import_lib4.$TS)((0, import_lib4.$S)(ImpliedFromClause, __, Import, __, Operator, (0, import_lib4.$E)(OperatorBehavior), __, OperatorNamedImports), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8) {
14858
+ var from = $1;
14859
+ var fws = $2;
14860
+ var i = $3;
14861
+ var iws = $4;
14862
+ var behavior = $6;
14863
+ var ows = $7;
14864
+ var imports = $8;
14830
14865
  imports.specifiers.forEach((spec) => {
14831
14866
  state.operators.set(spec.binding.name, spec.behavior ?? behavior);
14832
14867
  });
14833
14868
  return {
14834
14869
  type: "ImportDeclaration",
14835
- children: [$1, trimFirstSpace($4), imports, $6, from],
14836
- // omit $2 = Operator and $3 = OperatorBehavior
14870
+ children: [i, iws, trimFirstSpace(ows), imports, fws, from],
14871
+ // omit Operator and OperatorBehavior
14837
14872
  imports,
14838
14873
  from
14839
14874
  };
14840
14875
  });
14876
+ var ImportDeclaration$6 = (0, import_lib4.$TS)((0, import_lib4.$S)(ImpliedFromClause, __, Import, __, (0, import_lib4.$E)((0, import_lib4.$S)(TypeKeyword, __)), ImportClause), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
14877
+ var from = $1;
14878
+ var fws = $2;
14879
+ var i = $3;
14880
+ var iws = $4;
14881
+ var t = $5;
14882
+ var imports = $6;
14883
+ return {
14884
+ type: "ImportDeclaration",
14885
+ children: [i, iws, t, imports, fws, from],
14886
+ imports,
14887
+ from,
14888
+ ts: !!t
14889
+ };
14890
+ });
14841
14891
  var ImportDeclaration$$ = [ImportDeclaration$0, ImportDeclaration$1, ImportDeclaration$2, ImportDeclaration$3, ImportDeclaration$4, ImportDeclaration$5, ImportDeclaration$6];
14842
14892
  function ImportDeclaration(ctx, state2) {
14843
14893
  return (0, import_lib4.$EVENT_C)(ctx, state2, "ImportDeclaration", ImportDeclaration$$);
@@ -14922,6 +14972,21 @@ ${js}`
14922
14972
  function FromClause(ctx, state2) {
14923
14973
  return (0, import_lib4.$EVENT)(ctx, state2, "FromClause", FromClause$0);
14924
14974
  }
14975
+ var ImpliedFromClause$0 = (0, import_lib4.$TS)((0, import_lib4.$S)((0, import_lib4.$C)((0, import_lib4.$S)(From, __), ImpliedFrom), ModuleSpecifier), function($skip, $loc, $0, $1, $2) {
14976
+ var module = $2;
14977
+ if (!Array.isArray(module))
14978
+ return $0;
14979
+ return [$1, ...module];
14980
+ });
14981
+ function ImpliedFromClause(ctx, state2) {
14982
+ return (0, import_lib4.$EVENT)(ctx, state2, "ImpliedFromClause", ImpliedFromClause$0);
14983
+ }
14984
+ var ImpliedFrom$0 = (0, import_lib4.$TV)((0, import_lib4.$EXPECT)($L0, 'ImpliedFrom ""'), function($skip, $loc, $0, $1) {
14985
+ return { $loc, token: "from " };
14986
+ });
14987
+ function ImpliedFrom(ctx, state2) {
14988
+ return (0, import_lib4.$EVENT)(ctx, state2, "ImpliedFrom", ImpliedFrom$0);
14989
+ }
14925
14990
  var ImportAssertion$0 = (0, import_lib4.$TS)((0, import_lib4.$S)((0, import_lib4.$E)(_), (0, import_lib4.$C)((0, import_lib4.$EXPECT)($L124, 'ImportAssertion "with"'), (0, import_lib4.$EXPECT)($L125, 'ImportAssertion "assert"')), NonIdContinue, (0, import_lib4.$E)(_), ObjectLiteral), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
14926
14991
  var keyword = $2;
14927
14992
  var object = $5;
@@ -15054,7 +15119,7 @@ ${js}`
15054
15119
  function UnprocessedModuleSpecifier(ctx, state2) {
15055
15120
  return (0, import_lib4.$EVENT_C)(ctx, state2, "UnprocessedModuleSpecifier", UnprocessedModuleSpecifier$$);
15056
15121
  }
15057
- var UnquotedSpecifier$0 = (0, import_lib4.$TV)((0, import_lib4.$EXPECT)($R32, 'UnquotedSpecifier /[^;"\\s]+/'), function($skip, $loc, $0, $1) {
15122
+ var UnquotedSpecifier$0 = (0, import_lib4.$TV)((0, import_lib4.$EXPECT)($R32, 'UnquotedSpecifier /[^;"\\s=>]+/'), function($skip, $loc, $0, $1) {
15058
15123
  var spec = $0;
15059
15124
  return { $loc, token: `"${spec}"` };
15060
15125
  });
@@ -15107,13 +15172,26 @@ ${js}`
15107
15172
  return { type: "ExportDeclaration", declaration, ts: declaration.ts, children: $0 };
15108
15173
  });
15109
15174
  var ExportDeclaration$3 = (0, import_lib4.$TS)((0, import_lib4.$S)(Export, __, ExportFromClause, __, FromClause), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
15110
- return { type: "ExportDeclaration", ts: $3.ts, children: $0 };
15175
+ var exports = $3;
15176
+ return { type: "ExportDeclaration", ts: exports.ts, children: $0 };
15177
+ });
15178
+ var ExportDeclaration$4 = (0, import_lib4.$TS)((0, import_lib4.$S)(ImpliedFromClause, __, Export, __, ExportFromClause), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
15179
+ var from = $1;
15180
+ var fws = $2;
15181
+ var e = $3;
15182
+ var ews = $4;
15183
+ var exports = $5;
15184
+ return {
15185
+ type: "ExportDeclaration",
15186
+ ts: exports.ts,
15187
+ children: [e, ews, exports, " ", from, trimFirstSpace(fws)]
15188
+ };
15111
15189
  });
15112
- var ExportDeclaration$4 = (0, import_lib4.$TS)((0, import_lib4.$S)((0, import_lib4.$E)(Decorators), Export, __, (0, import_lib4.$C)(Declaration, VariableStatement, TypeAndNamedExports, ExportVarDec)), function($skip, $loc, $0, $1, $2, $3, $4) {
15190
+ var ExportDeclaration$5 = (0, import_lib4.$TS)((0, import_lib4.$S)((0, import_lib4.$E)(Decorators), Export, __, (0, import_lib4.$C)(Declaration, VariableStatement, TypeAndNamedExports, ExportVarDec)), function($skip, $loc, $0, $1, $2, $3, $4) {
15113
15191
  var declaration = $4;
15114
15192
  return { type: "ExportDeclaration", declaration, ts: declaration.ts, children: $0 };
15115
15193
  });
15116
- var ExportDeclaration$$ = [ExportDeclaration$0, ExportDeclaration$1, ExportDeclaration$2, ExportDeclaration$3, ExportDeclaration$4];
15194
+ var ExportDeclaration$$ = [ExportDeclaration$0, ExportDeclaration$1, ExportDeclaration$2, ExportDeclaration$3, ExportDeclaration$4, ExportDeclaration$5];
15117
15195
  function ExportDeclaration(ctx, state2) {
15118
15196
  return (0, import_lib4.$EVENT_C)(ctx, state2, "ExportDeclaration", ExportDeclaration$$);
15119
15197
  }
@@ -18297,11 +18375,12 @@ ${js}`
18297
18375
  }
18298
18376
  var TypeArguments$0 = (0, import_lib4.$TS)((0, import_lib4.$S)(OpenAngleBracket, (0, import_lib4.$P)((0, import_lib4.$S)(__, TypeArgumentDelimited)), __, CloseAngleBracket), function($skip, $loc, $0, $1, $2, $3, $4) {
18299
18377
  var args = $2;
18300
- args = args.map(([ws, arg]) => [ws, ...arg]);
18378
+ args = args.flatMap(([ws, [arg, delim]]) => [prepend(ws, arg), delim]);
18379
+ args.pop();
18301
18380
  return {
18302
18381
  type: "TypeArguments",
18303
18382
  ts: true,
18304
- types: args.map(([, t]) => t),
18383
+ args,
18305
18384
  children: $0
18306
18385
  };
18307
18386
  });
@@ -18313,10 +18392,15 @@ ${js}`
18313
18392
  var ws = $3;
18314
18393
  var args = $4;
18315
18394
  var close = $5;
18316
- let last = args[args.length - 1];
18317
- if (last?.token === ",")
18395
+ const last = args[args.length - 1];
18396
+ if (isComma(last))
18318
18397
  args = args.slice(0, -1);
18319
- return [open, ws, args, close];
18398
+ return {
18399
+ type: "TypeArguments",
18400
+ ts: true,
18401
+ args,
18402
+ children: [open, ws, args, close]
18403
+ };
18320
18404
  });
18321
18405
  function ImplicitTypeArguments(ctx, state2) {
18322
18406
  return (0, import_lib4.$EVENT)(ctx, state2, "ImplicitTypeArguments", ImplicitTypeArguments$0);
@@ -18334,10 +18418,10 @@ ${js}`
18334
18418
  function ForbiddenImplicitTypeCalls(ctx, state2) {
18335
18419
  return (0, import_lib4.$EVENT_C)(ctx, state2, "ForbiddenImplicitTypeCalls", ForbiddenImplicitTypeCalls$$);
18336
18420
  }
18337
- var TypeArgumentList$0 = (0, import_lib4.$TS)((0, import_lib4.$S)((0, import_lib4.$N)(EOS), TypeArgument, (0, import_lib4.$Q)((0, import_lib4.$S)(CommaDelimiter, (0, import_lib4.$N)(EOS), (0, import_lib4.$E)(_), TypeArgument)), (0, import_lib4.$P)((0, import_lib4.$S)(CommaDelimiter, (0, import_lib4.$C)(NestedTypeBulletedTuple, NestedInterfaceBlock, NestedTypeArgumentList)))), function($skip, $loc, $0, $1, $2, $3, $4) {
18421
+ var TypeArgumentList$0 = (0, import_lib4.$TS)((0, import_lib4.$S)((0, import_lib4.$N)(EOS), TypeArgument, (0, import_lib4.$Q)((0, import_lib4.$S)(CommaDelimiter, (0, import_lib4.$N)(EOS), WTypeArgument)), (0, import_lib4.$P)((0, import_lib4.$S)(CommaDelimiter, (0, import_lib4.$C)(NestedTypeBulletedTuple, NestedInterfaceBlock, NestedTypeArgumentList)))), function($skip, $loc, $0, $1, $2, $3, $4) {
18338
18422
  return [
18339
18423
  $2,
18340
- ...$3.flatMap(([comma, eos, ws, arg]) => [comma, prepend(ws, arg)]),
18424
+ ...$3.flatMap(([comma, eos, arg]) => [comma, arg]),
18341
18425
  ...$4.flatMap(
18342
18426
  ([comma, args]) => Array.isArray(args) ? [comma, ...args] : [comma, args]
18343
18427
  )
@@ -18352,10 +18436,10 @@ ${js}`
18352
18436
  ];
18353
18437
  });
18354
18438
  var TypeArgumentList$2 = NestedTypeArgumentList;
18355
- var TypeArgumentList$3 = (0, import_lib4.$TS)((0, import_lib4.$S)(TypeArgument, (0, import_lib4.$Q)((0, import_lib4.$S)(CommaDelimiter, (0, import_lib4.$E)(_), TypeArgument))), function($skip, $loc, $0, $1, $2) {
18439
+ var TypeArgumentList$3 = (0, import_lib4.$TS)((0, import_lib4.$S)(TypeArgument, (0, import_lib4.$Q)((0, import_lib4.$S)(CommaDelimiter, WTypeArgument))), function($skip, $loc, $0, $1, $2) {
18356
18440
  return [
18357
18441
  $1,
18358
- ...$2.flatMap(([comma, ws, arg]) => [comma, prepend(ws, arg)])
18442
+ ...$2.flatMap(([comma, arg]) => [comma, arg])
18359
18443
  ];
18360
18444
  });
18361
18445
  var TypeArgumentList$$ = [TypeArgumentList$0, TypeArgumentList$1, TypeArgumentList$2, TypeArgumentList$3];
@@ -18382,17 +18466,25 @@ ${js}`
18382
18466
  function NestedTypeArgument(ctx, state2) {
18383
18467
  return (0, import_lib4.$EVENT)(ctx, state2, "NestedTypeArgument", NestedTypeArgument$0);
18384
18468
  }
18385
- var SingleLineTypeArgumentList$0 = (0, import_lib4.$TS)((0, import_lib4.$S)((0, import_lib4.$S)((0, import_lib4.$E)(_), TypeArgument), (0, import_lib4.$Q)((0, import_lib4.$S)((0, import_lib4.$S)((0, import_lib4.$E)(_), Comma), (0, import_lib4.$S)((0, import_lib4.$E)(_), TypeArgument)))), function($skip, $loc, $0, $1, $2) {
18386
- return [$1, ...$2.flat()];
18469
+ var SingleLineTypeArgumentList$0 = (0, import_lib4.$TS)((0, import_lib4.$S)(WTypeArgument, (0, import_lib4.$Q)((0, import_lib4.$S)((0, import_lib4.$S)((0, import_lib4.$E)(_), Comma), WTypeArgument))), function($skip, $loc, $0, $1, $2) {
18470
+ return [$1, ...$2];
18387
18471
  });
18388
18472
  function SingleLineTypeArgumentList(ctx, state2) {
18389
18473
  return (0, import_lib4.$EVENT)(ctx, state2, "SingleLineTypeArgumentList", SingleLineTypeArgumentList$0);
18390
18474
  }
18475
+ var WTypeArgument$0 = (0, import_lib4.$TS)((0, import_lib4.$S)((0, import_lib4.$E)(_), TypeArgument), function($skip, $loc, $0, $1, $2) {
18476
+ return prepend($1, $2);
18477
+ });
18478
+ function WTypeArgument(ctx, state2) {
18479
+ return (0, import_lib4.$EVENT)(ctx, state2, "WTypeArgument", WTypeArgument$0);
18480
+ }
18391
18481
  var TypeArgumentDelimited$0 = (0, import_lib4.$S)(TypeArgument, TypeArgumentDelimiter);
18392
18482
  function TypeArgumentDelimited(ctx, state2) {
18393
18483
  return (0, import_lib4.$EVENT)(ctx, state2, "TypeArgumentDelimited", TypeArgumentDelimited$0);
18394
18484
  }
18395
- var TypeArgument$0 = Type;
18485
+ var TypeArgument$0 = (0, import_lib4.$T)(Type, function(value) {
18486
+ return { "type": "TypeArgument", "ts": true, "t": value, "children": [value] };
18487
+ });
18396
18488
  function TypeArgument(ctx, state2) {
18397
18489
  return (0, import_lib4.$EVENT)(ctx, state2, "TypeArgument", TypeArgument$0);
18398
18490
  }
package/dist/civet CHANGED
@@ -90,7 +90,7 @@ async function parseArgs(args, isTTY = process.stdin.isTTY) {
90
90
  results.push(`-${char}`);
91
91
  }
92
92
  ;
93
- args.splice(i, 1 + i - i, ...results);
93
+ args.splice(i, i + 1 - i, ...results);
94
94
  continue;
95
95
  }
96
96
  switch (arg) {
@@ -305,9 +305,6 @@ async function repl(args, options) {
305
305
  };
306
306
  } else {
307
307
  const execArgv = ["--experimental-vm-modules"];
308
- if (process.env.NODE_OPTIONS) {
309
- execArgv.push(process.env.NODE_OPTIONS);
310
- }
311
308
  const { fork } = await import("node:child_process");
312
309
  fork(__filename, args, {
313
310
  execArgv,
@@ -650,9 +647,6 @@ You can override this behavior via: --civet rewriteCivetImports=.ext
650
647
  }
651
648
  const debugRe = /--debug|--inspect/;
652
649
  const isDebug = typeof v8debug === "object" || debugRe.test(process.execArgv.join(" ")) || debugRe.test(process.env.NODE_OPTIONS ?? "");
653
- if (process.env.NODE_OPTIONS) {
654
- execArgv.push(process.env.NODE_OPTIONS);
655
- }
656
650
  if (isDebug) {
657
651
  execArgv.push("--inspect=" + (process.debugPort + 1));
658
652
  }