@danielx/civet 0.5.63 → 0.5.65

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/browser.js CHANGED
@@ -501,6 +501,7 @@ ${input.slice(result.pos)}
501
501
  CallExpression,
502
502
  CallExpressionRest,
503
503
  OptionalShorthand,
504
+ OptionalDot,
504
505
  NonNullAssertion,
505
506
  MemberExpression,
506
507
  MemberExpressionRest,
@@ -748,6 +749,7 @@ ${input.slice(result.pos)}
748
749
  HeregexPart,
749
750
  HeregexComment,
750
751
  RegularExpressionBody,
752
+ RegExpPart,
751
753
  RegExpCharacter,
752
754
  RegularExpressionFlags,
753
755
  TemplateLiteral,
@@ -1205,9 +1207,9 @@ ${input.slice(result.pos)}
1205
1207
  var $R25 = $R(new RegExp("(?:\\\\.)", "suy"));
1206
1208
  var $R26 = $R(new RegExp("[\\s]+", "suy"));
1207
1209
  var $R27 = $R(new RegExp("\\/(?!\\/\\/)", "suy"));
1208
- var $R28 = $R(new RegExp("[^\\/\\s#\\\\]+", "suy"));
1210
+ var $R28 = $R(new RegExp("[^[\\/\\s#\\\\]+", "suy"));
1209
1211
  var $R29 = $R(new RegExp("[*\\/\\r\\n]", "suy"));
1210
- var $R30 = $R(new RegExp("(?:\\\\.|[^\\/\\r\\n])+", "suy"));
1212
+ var $R30 = $R(new RegExp("(?:\\\\.|[^[\\/\\r\\n])+", "suy"));
1211
1213
  var $R31 = $R(new RegExp("(?:\\p{ID_Continue}|[\\u200C\\u200D$])*", "suy"));
1212
1214
  var $R32 = $R(new RegExp("(?:\\$(?!\\{)|\\\\.|[^$`])+", "suy"));
1213
1215
  var $R33 = $R(new RegExp("(?:\\$(?!\\{)|`(?!``)|\\\\.|[^$`])+", "suy"));
@@ -3314,7 +3316,7 @@ ${input.slice(result.pos)}
3314
3316
  return result;
3315
3317
  }
3316
3318
  }
3317
- var OptionalShorthand$0 = $TS($S(QuestionMark, $C(Dot, InsertDot)), function($skip, $loc, $0, $1, $2) {
3319
+ var OptionalShorthand$0 = $TS($S(QuestionMark, OptionalDot), function($skip, $loc, $0, $1, $2) {
3318
3320
  return {
3319
3321
  type: "Optional",
3320
3322
  children: $0
@@ -3342,6 +3344,30 @@ ${input.slice(result.pos)}
3342
3344
  return result;
3343
3345
  }
3344
3346
  }
3347
+ var OptionalDot$0 = Dot;
3348
+ var OptionalDot$1 = InsertDot;
3349
+ function OptionalDot(state) {
3350
+ let eventData;
3351
+ if (state.events) {
3352
+ const result = state.events.enter?.("OptionalDot", state);
3353
+ if (result) {
3354
+ if (result.cache)
3355
+ return result.cache;
3356
+ eventData = result.data;
3357
+ }
3358
+ }
3359
+ if (state.tokenize) {
3360
+ const result = $TOKEN("OptionalDot", state, OptionalDot$0(state) || OptionalDot$1(state));
3361
+ if (state.events)
3362
+ state.events.exit?.("OptionalDot", state, result, eventData);
3363
+ return result;
3364
+ } else {
3365
+ const result = OptionalDot$0(state) || OptionalDot$1(state);
3366
+ if (state.events)
3367
+ state.events.exit?.("OptionalDot", state, result, eventData);
3368
+ return result;
3369
+ }
3370
+ }
3345
3371
  var NonNullAssertion$0 = $T($EXPECT($L14, fail, 'NonNullAssertion "!"'), function(value) {
3346
3372
  return { "type": "NonNullAssertion", "ts": true, "children": value };
3347
3373
  });
@@ -3622,11 +3648,11 @@ ${input.slice(result.pos)}
3622
3648
  return result;
3623
3649
  }
3624
3650
  }
3625
- var PropertyGlob$0 = $TS($S(Dot, ObjectBindingPattern), function($skip, $loc, $0, $1, $2) {
3626
- var pattern = $2;
3651
+ var PropertyGlob$0 = $TS($S(OptionalDot, BracedObjectLiteral), function($skip, $loc, $0, $1, $2) {
3652
+ var object = $2;
3627
3653
  return {
3628
3654
  type: "PropertyGlob",
3629
- pattern,
3655
+ object,
3630
3656
  children: $0
3631
3657
  };
3632
3658
  });
@@ -5168,7 +5194,7 @@ ${input.slice(result.pos)}
5168
5194
  block
5169
5195
  };
5170
5196
  });
5171
- var FunctionExpression$1 = $TS($S($E(AmpersandUnaryPrefix), Ampersand, $E(AmpersandBlockRHS)), function($skip, $loc, $0, $1, $2, $3) {
5197
+ var FunctionExpression$1 = $TS($S($E(AmpersandUnaryPrefix), $C(Ampersand, $S($N(NumericLiteral), $Y($S($E(QuestionMark), Dot)))), $E(AmpersandBlockRHS)), function($skip, $loc, $0, $1, $2, $3) {
5172
5198
  var prefix = $1;
5173
5199
  var rhs = $3;
5174
5200
  if (!prefix && !rhs)
@@ -6652,6 +6678,7 @@ ${input.slice(result.pos)}
6652
6678
  const children = [open, ...content, close];
6653
6679
  return {
6654
6680
  type: "ObjectExpression",
6681
+ content,
6655
6682
  children,
6656
6683
  names: children.flatMap((c) => {
6657
6684
  return c.names || [];
@@ -6981,7 +7008,7 @@ ${input.slice(result.pos)}
6981
7008
  const value = [{ ...at, token: "this." }, id];
6982
7009
  return {
6983
7010
  type: "Property",
6984
- children: [...ws, id, ": ", ...value],
7011
+ children: [ws, id, ": ", ...value],
6985
7012
  name: id,
6986
7013
  names: id.names,
6987
7014
  value
@@ -6992,7 +7019,7 @@ ${input.slice(result.pos)}
6992
7019
  var prop = $2;
6993
7020
  return {
6994
7021
  ...prop,
6995
- children: [...ws, ...prop.children]
7022
+ children: [ws, ...prop.children]
6996
7023
  };
6997
7024
  });
6998
7025
  var PropertyDefinition$2 = $TS($S(__, $TEXT($EXPECT($R5, fail, "PropertyDefinition /[!+-]/")), PropertyName), function($skip, $loc, $0, $1, $2, $3) {
@@ -7002,7 +7029,7 @@ ${input.slice(result.pos)}
7002
7029
  const value = toggle === "+" ? "true" : "false";
7003
7030
  return {
7004
7031
  type: "Property",
7005
- children: [...ws, id, ": ", value],
7032
+ children: [ws, id, ": ", value],
7006
7033
  name: id,
7007
7034
  names: id.names,
7008
7035
  value
@@ -7015,7 +7042,7 @@ ${input.slice(result.pos)}
7015
7042
  return $skip;
7016
7043
  return {
7017
7044
  ...def,
7018
- children: [...ws, ...def.children]
7045
+ children: [ws, ...def.children]
7019
7046
  };
7020
7047
  });
7021
7048
  var PropertyDefinition$4 = $TS($S(__, DotDotDot, ExtendedExpression), function($skip, $loc, $0, $1, $2, $3) {
@@ -7024,7 +7051,7 @@ ${input.slice(result.pos)}
7024
7051
  var exp = $3;
7025
7052
  return {
7026
7053
  type: "SpreadProperty",
7027
- children: [...ws, dots, exp],
7054
+ children: [ws, dots, exp],
7028
7055
  names: exp.names,
7029
7056
  value: [dots, exp]
7030
7057
  };
@@ -7033,7 +7060,7 @@ ${input.slice(result.pos)}
7033
7060
  var ws = $1;
7034
7061
  var value = $2;
7035
7062
  if (value.type === "Identifier") {
7036
- return { ...value, children: [...ws, ...value.children] };
7063
+ return { ...value, children: [ws, ...value.children] };
7037
7064
  }
7038
7065
  let exp = value, children, i;
7039
7066
  do {
@@ -7278,9 +7305,9 @@ ${input.slice(result.pos)}
7278
7305
  ts: true
7279
7306
  };
7280
7307
  });
7281
- var MethodDefinition$1 = $TS($S(MethodSignature, BracedOrEmptyBlock), function($skip, $loc, $0, $1, $2) {
7308
+ var MethodDefinition$1 = $TS($S(MethodSignature, $N(PropertyAccess), BracedOrEmptyBlock), function($skip, $loc, $0, $1, $2, $3) {
7282
7309
  var signature = $1;
7283
- var block = $2;
7310
+ var block = $3;
7284
7311
  return {
7285
7312
  type: "MethodDefinition",
7286
7313
  children: $0,
@@ -11667,7 +11694,7 @@ ${input.slice(result.pos)}
11667
11694
  var HeregexPart$6 = $TR($EXPECT($R27, fail, "HeregexPart /\\/(?!\\/\\/)/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
11668
11695
  return { $loc, token: "\\/" };
11669
11696
  });
11670
- var HeregexPart$7 = $TR($EXPECT($R28, fail, "HeregexPart /[^\\/\\s#\\\\]+/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
11697
+ var HeregexPart$7 = $TR($EXPECT($R28, fail, "HeregexPart /[^[\\/\\s#\\\\]+/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
11671
11698
  return { $loc, token: $0 };
11672
11699
  });
11673
11700
  function HeregexPart(state) {
@@ -11716,7 +11743,7 @@ ${input.slice(result.pos)}
11716
11743
  return result;
11717
11744
  }
11718
11745
  }
11719
- var RegularExpressionBody$0 = $S($N($R$0($EXPECT($R29, fail, "RegularExpressionBody /[*\\/\\r\\n]/"))), $Q(RegExpCharacter));
11746
+ var RegularExpressionBody$0 = $S($N($R$0($EXPECT($R29, fail, "RegularExpressionBody /[*\\/\\r\\n]/"))), $Q(RegExpPart));
11720
11747
  function RegularExpressionBody(state) {
11721
11748
  let eventData;
11722
11749
  if (state.events) {
@@ -11739,7 +11766,31 @@ ${input.slice(result.pos)}
11739
11766
  return result;
11740
11767
  }
11741
11768
  }
11742
- var RegExpCharacter$0 = $R$0($EXPECT($R30, fail, "RegExpCharacter /(?:\\\\.|[^\\/\\r\\n])+/"));
11769
+ var RegExpPart$0 = RegularExpressionClass;
11770
+ var RegExpPart$1 = RegExpCharacter;
11771
+ function RegExpPart(state) {
11772
+ let eventData;
11773
+ if (state.events) {
11774
+ const result = state.events.enter?.("RegExpPart", state);
11775
+ if (result) {
11776
+ if (result.cache)
11777
+ return result.cache;
11778
+ eventData = result.data;
11779
+ }
11780
+ }
11781
+ if (state.tokenize) {
11782
+ const result = $TOKEN("RegExpPart", state, RegExpPart$0(state) || RegExpPart$1(state));
11783
+ if (state.events)
11784
+ state.events.exit?.("RegExpPart", state, result, eventData);
11785
+ return result;
11786
+ } else {
11787
+ const result = RegExpPart$0(state) || RegExpPart$1(state);
11788
+ if (state.events)
11789
+ state.events.exit?.("RegExpPart", state, result, eventData);
11790
+ return result;
11791
+ }
11792
+ }
11793
+ var RegExpCharacter$0 = $R$0($EXPECT($R30, fail, "RegExpCharacter /(?:\\\\.|[^[\\/\\r\\n])+/"));
11743
11794
  function RegExpCharacter(state) {
11744
11795
  let eventData;
11745
11796
  if (state.events) {
@@ -18570,19 +18621,20 @@ ${input.slice(result.pos)}
18570
18621
  if (glob?.type === "PropertyGlob") {
18571
18622
  const prefix = children.slice(0, i).concat(glob.children[0]);
18572
18623
  const parts = [];
18573
- for (const part of glob.pattern.content) {
18574
- if (part.init) {
18575
- throw new Error("Glob pattern cannot have initializers");
18624
+ for (const part of glob.object.content) {
18625
+ if (part.type === "SpreadProperty") {
18626
+ throw new Error("Glob pattern cannot have ...spread property");
18576
18627
  }
18577
- if (part.type === "AtBindingProperty") {
18578
- throw new Error("Glob pattern cannot have @property");
18628
+ if (part.type === "MethodDefinition") {
18629
+ throw new Error("Glob pattern cannot have method definition");
18579
18630
  }
18580
- if (part.type === "BindingRestProperty") {
18581
- throw new Error("Glob pattern cannot have ...rest property");
18631
+ if (part.value && !["CallExpression", "MemberExpression", "Identifier"].includes(part.value.type)) {
18632
+ throw new Error("Glob pattern must have call or member expression value");
18582
18633
  }
18583
- const name = part.value ? module.insertTrimmingSpace(part.value, "") : part.name;
18584
- const value = prefix.concat(module.insertTrimmingSpace(part.name, ""));
18585
- const wValue = part.value && module.getTrimmingSpace(part.value);
18634
+ const { name } = part;
18635
+ let value = part.value ?? part.name;
18636
+ const wValue = module.getTrimmingSpace(part.value);
18637
+ value = prefix.concat(module.insertTrimmingSpace(value, ""));
18586
18638
  if (wValue)
18587
18639
  value.unshift(wValue);
18588
18640
  parts.push({
@@ -18603,10 +18655,9 @@ ${input.slice(result.pos)}
18603
18655
  const object = {
18604
18656
  type: "ObjectExpression",
18605
18657
  children: [
18606
- glob.pattern.children[0],
18658
+ glob.object.children[0],
18607
18659
  ...parts,
18608
- glob.pattern.children.at(-2),
18609
- glob.pattern.children.at(-1)
18660
+ glob.object.children.at(-1)
18610
18661
  ]
18611
18662
  };
18612
18663
  if (i === children.length - 1)
package/dist/main.js CHANGED
@@ -500,6 +500,7 @@ ${input.slice(result.pos)}
500
500
  CallExpression,
501
501
  CallExpressionRest,
502
502
  OptionalShorthand,
503
+ OptionalDot,
503
504
  NonNullAssertion,
504
505
  MemberExpression,
505
506
  MemberExpressionRest,
@@ -747,6 +748,7 @@ ${input.slice(result.pos)}
747
748
  HeregexPart,
748
749
  HeregexComment,
749
750
  RegularExpressionBody,
751
+ RegExpPart,
750
752
  RegExpCharacter,
751
753
  RegularExpressionFlags,
752
754
  TemplateLiteral,
@@ -1204,9 +1206,9 @@ ${input.slice(result.pos)}
1204
1206
  var $R25 = $R(new RegExp("(?:\\\\.)", "suy"));
1205
1207
  var $R26 = $R(new RegExp("[\\s]+", "suy"));
1206
1208
  var $R27 = $R(new RegExp("\\/(?!\\/\\/)", "suy"));
1207
- var $R28 = $R(new RegExp("[^\\/\\s#\\\\]+", "suy"));
1209
+ var $R28 = $R(new RegExp("[^[\\/\\s#\\\\]+", "suy"));
1208
1210
  var $R29 = $R(new RegExp("[*\\/\\r\\n]", "suy"));
1209
- var $R30 = $R(new RegExp("(?:\\\\.|[^\\/\\r\\n])+", "suy"));
1211
+ var $R30 = $R(new RegExp("(?:\\\\.|[^[\\/\\r\\n])+", "suy"));
1210
1212
  var $R31 = $R(new RegExp("(?:\\p{ID_Continue}|[\\u200C\\u200D$])*", "suy"));
1211
1213
  var $R32 = $R(new RegExp("(?:\\$(?!\\{)|\\\\.|[^$`])+", "suy"));
1212
1214
  var $R33 = $R(new RegExp("(?:\\$(?!\\{)|`(?!``)|\\\\.|[^$`])+", "suy"));
@@ -3313,7 +3315,7 @@ ${input.slice(result.pos)}
3313
3315
  return result;
3314
3316
  }
3315
3317
  }
3316
- var OptionalShorthand$0 = $TS($S(QuestionMark, $C(Dot, InsertDot)), function($skip, $loc, $0, $1, $2) {
3318
+ var OptionalShorthand$0 = $TS($S(QuestionMark, OptionalDot), function($skip, $loc, $0, $1, $2) {
3317
3319
  return {
3318
3320
  type: "Optional",
3319
3321
  children: $0
@@ -3341,6 +3343,30 @@ ${input.slice(result.pos)}
3341
3343
  return result;
3342
3344
  }
3343
3345
  }
3346
+ var OptionalDot$0 = Dot;
3347
+ var OptionalDot$1 = InsertDot;
3348
+ function OptionalDot(state) {
3349
+ let eventData;
3350
+ if (state.events) {
3351
+ const result = state.events.enter?.("OptionalDot", state);
3352
+ if (result) {
3353
+ if (result.cache)
3354
+ return result.cache;
3355
+ eventData = result.data;
3356
+ }
3357
+ }
3358
+ if (state.tokenize) {
3359
+ const result = $TOKEN("OptionalDot", state, OptionalDot$0(state) || OptionalDot$1(state));
3360
+ if (state.events)
3361
+ state.events.exit?.("OptionalDot", state, result, eventData);
3362
+ return result;
3363
+ } else {
3364
+ const result = OptionalDot$0(state) || OptionalDot$1(state);
3365
+ if (state.events)
3366
+ state.events.exit?.("OptionalDot", state, result, eventData);
3367
+ return result;
3368
+ }
3369
+ }
3344
3370
  var NonNullAssertion$0 = $T($EXPECT($L14, fail, 'NonNullAssertion "!"'), function(value) {
3345
3371
  return { "type": "NonNullAssertion", "ts": true, "children": value };
3346
3372
  });
@@ -3621,11 +3647,11 @@ ${input.slice(result.pos)}
3621
3647
  return result;
3622
3648
  }
3623
3649
  }
3624
- var PropertyGlob$0 = $TS($S(Dot, ObjectBindingPattern), function($skip, $loc, $0, $1, $2) {
3625
- var pattern = $2;
3650
+ var PropertyGlob$0 = $TS($S(OptionalDot, BracedObjectLiteral), function($skip, $loc, $0, $1, $2) {
3651
+ var object = $2;
3626
3652
  return {
3627
3653
  type: "PropertyGlob",
3628
- pattern,
3654
+ object,
3629
3655
  children: $0
3630
3656
  };
3631
3657
  });
@@ -5167,7 +5193,7 @@ ${input.slice(result.pos)}
5167
5193
  block
5168
5194
  };
5169
5195
  });
5170
- var FunctionExpression$1 = $TS($S($E(AmpersandUnaryPrefix), Ampersand, $E(AmpersandBlockRHS)), function($skip, $loc, $0, $1, $2, $3) {
5196
+ var FunctionExpression$1 = $TS($S($E(AmpersandUnaryPrefix), $C(Ampersand, $S($N(NumericLiteral), $Y($S($E(QuestionMark), Dot)))), $E(AmpersandBlockRHS)), function($skip, $loc, $0, $1, $2, $3) {
5171
5197
  var prefix = $1;
5172
5198
  var rhs = $3;
5173
5199
  if (!prefix && !rhs)
@@ -6651,6 +6677,7 @@ ${input.slice(result.pos)}
6651
6677
  const children = [open, ...content, close];
6652
6678
  return {
6653
6679
  type: "ObjectExpression",
6680
+ content,
6654
6681
  children,
6655
6682
  names: children.flatMap((c) => {
6656
6683
  return c.names || [];
@@ -6980,7 +7007,7 @@ ${input.slice(result.pos)}
6980
7007
  const value = [{ ...at, token: "this." }, id];
6981
7008
  return {
6982
7009
  type: "Property",
6983
- children: [...ws, id, ": ", ...value],
7010
+ children: [ws, id, ": ", ...value],
6984
7011
  name: id,
6985
7012
  names: id.names,
6986
7013
  value
@@ -6991,7 +7018,7 @@ ${input.slice(result.pos)}
6991
7018
  var prop = $2;
6992
7019
  return {
6993
7020
  ...prop,
6994
- children: [...ws, ...prop.children]
7021
+ children: [ws, ...prop.children]
6995
7022
  };
6996
7023
  });
6997
7024
  var PropertyDefinition$2 = $TS($S(__, $TEXT($EXPECT($R5, fail, "PropertyDefinition /[!+-]/")), PropertyName), function($skip, $loc, $0, $1, $2, $3) {
@@ -7001,7 +7028,7 @@ ${input.slice(result.pos)}
7001
7028
  const value = toggle === "+" ? "true" : "false";
7002
7029
  return {
7003
7030
  type: "Property",
7004
- children: [...ws, id, ": ", value],
7031
+ children: [ws, id, ": ", value],
7005
7032
  name: id,
7006
7033
  names: id.names,
7007
7034
  value
@@ -7014,7 +7041,7 @@ ${input.slice(result.pos)}
7014
7041
  return $skip;
7015
7042
  return {
7016
7043
  ...def,
7017
- children: [...ws, ...def.children]
7044
+ children: [ws, ...def.children]
7018
7045
  };
7019
7046
  });
7020
7047
  var PropertyDefinition$4 = $TS($S(__, DotDotDot, ExtendedExpression), function($skip, $loc, $0, $1, $2, $3) {
@@ -7023,7 +7050,7 @@ ${input.slice(result.pos)}
7023
7050
  var exp = $3;
7024
7051
  return {
7025
7052
  type: "SpreadProperty",
7026
- children: [...ws, dots, exp],
7053
+ children: [ws, dots, exp],
7027
7054
  names: exp.names,
7028
7055
  value: [dots, exp]
7029
7056
  };
@@ -7032,7 +7059,7 @@ ${input.slice(result.pos)}
7032
7059
  var ws = $1;
7033
7060
  var value = $2;
7034
7061
  if (value.type === "Identifier") {
7035
- return { ...value, children: [...ws, ...value.children] };
7062
+ return { ...value, children: [ws, ...value.children] };
7036
7063
  }
7037
7064
  let exp = value, children, i;
7038
7065
  do {
@@ -7277,9 +7304,9 @@ ${input.slice(result.pos)}
7277
7304
  ts: true
7278
7305
  };
7279
7306
  });
7280
- var MethodDefinition$1 = $TS($S(MethodSignature, BracedOrEmptyBlock), function($skip, $loc, $0, $1, $2) {
7307
+ var MethodDefinition$1 = $TS($S(MethodSignature, $N(PropertyAccess), BracedOrEmptyBlock), function($skip, $loc, $0, $1, $2, $3) {
7281
7308
  var signature = $1;
7282
- var block = $2;
7309
+ var block = $3;
7283
7310
  return {
7284
7311
  type: "MethodDefinition",
7285
7312
  children: $0,
@@ -11666,7 +11693,7 @@ ${input.slice(result.pos)}
11666
11693
  var HeregexPart$6 = $TR($EXPECT($R27, fail, "HeregexPart /\\/(?!\\/\\/)/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
11667
11694
  return { $loc, token: "\\/" };
11668
11695
  });
11669
- var HeregexPart$7 = $TR($EXPECT($R28, fail, "HeregexPart /[^\\/\\s#\\\\]+/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
11696
+ var HeregexPart$7 = $TR($EXPECT($R28, fail, "HeregexPart /[^[\\/\\s#\\\\]+/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
11670
11697
  return { $loc, token: $0 };
11671
11698
  });
11672
11699
  function HeregexPart(state) {
@@ -11715,7 +11742,7 @@ ${input.slice(result.pos)}
11715
11742
  return result;
11716
11743
  }
11717
11744
  }
11718
- var RegularExpressionBody$0 = $S($N($R$0($EXPECT($R29, fail, "RegularExpressionBody /[*\\/\\r\\n]/"))), $Q(RegExpCharacter));
11745
+ var RegularExpressionBody$0 = $S($N($R$0($EXPECT($R29, fail, "RegularExpressionBody /[*\\/\\r\\n]/"))), $Q(RegExpPart));
11719
11746
  function RegularExpressionBody(state) {
11720
11747
  let eventData;
11721
11748
  if (state.events) {
@@ -11738,7 +11765,31 @@ ${input.slice(result.pos)}
11738
11765
  return result;
11739
11766
  }
11740
11767
  }
11741
- var RegExpCharacter$0 = $R$0($EXPECT($R30, fail, "RegExpCharacter /(?:\\\\.|[^\\/\\r\\n])+/"));
11768
+ var RegExpPart$0 = RegularExpressionClass;
11769
+ var RegExpPart$1 = RegExpCharacter;
11770
+ function RegExpPart(state) {
11771
+ let eventData;
11772
+ if (state.events) {
11773
+ const result = state.events.enter?.("RegExpPart", state);
11774
+ if (result) {
11775
+ if (result.cache)
11776
+ return result.cache;
11777
+ eventData = result.data;
11778
+ }
11779
+ }
11780
+ if (state.tokenize) {
11781
+ const result = $TOKEN("RegExpPart", state, RegExpPart$0(state) || RegExpPart$1(state));
11782
+ if (state.events)
11783
+ state.events.exit?.("RegExpPart", state, result, eventData);
11784
+ return result;
11785
+ } else {
11786
+ const result = RegExpPart$0(state) || RegExpPart$1(state);
11787
+ if (state.events)
11788
+ state.events.exit?.("RegExpPart", state, result, eventData);
11789
+ return result;
11790
+ }
11791
+ }
11792
+ var RegExpCharacter$0 = $R$0($EXPECT($R30, fail, "RegExpCharacter /(?:\\\\.|[^[\\/\\r\\n])+/"));
11742
11793
  function RegExpCharacter(state) {
11743
11794
  let eventData;
11744
11795
  if (state.events) {
@@ -18569,19 +18620,20 @@ ${input.slice(result.pos)}
18569
18620
  if (glob?.type === "PropertyGlob") {
18570
18621
  const prefix = children.slice(0, i).concat(glob.children[0]);
18571
18622
  const parts = [];
18572
- for (const part of glob.pattern.content) {
18573
- if (part.init) {
18574
- throw new Error("Glob pattern cannot have initializers");
18623
+ for (const part of glob.object.content) {
18624
+ if (part.type === "SpreadProperty") {
18625
+ throw new Error("Glob pattern cannot have ...spread property");
18575
18626
  }
18576
- if (part.type === "AtBindingProperty") {
18577
- throw new Error("Glob pattern cannot have @property");
18627
+ if (part.type === "MethodDefinition") {
18628
+ throw new Error("Glob pattern cannot have method definition");
18578
18629
  }
18579
- if (part.type === "BindingRestProperty") {
18580
- throw new Error("Glob pattern cannot have ...rest property");
18630
+ if (part.value && !["CallExpression", "MemberExpression", "Identifier"].includes(part.value.type)) {
18631
+ throw new Error("Glob pattern must have call or member expression value");
18581
18632
  }
18582
- const name = part.value ? module2.insertTrimmingSpace(part.value, "") : part.name;
18583
- const value = prefix.concat(module2.insertTrimmingSpace(part.name, ""));
18584
- const wValue = part.value && module2.getTrimmingSpace(part.value);
18633
+ const { name } = part;
18634
+ let value = part.value ?? part.name;
18635
+ const wValue = module2.getTrimmingSpace(part.value);
18636
+ value = prefix.concat(module2.insertTrimmingSpace(value, ""));
18585
18637
  if (wValue)
18586
18638
  value.unshift(wValue);
18587
18639
  parts.push({
@@ -18602,10 +18654,9 @@ ${input.slice(result.pos)}
18602
18654
  const object = {
18603
18655
  type: "ObjectExpression",
18604
18656
  children: [
18605
- glob.pattern.children[0],
18657
+ glob.object.children[0],
18606
18658
  ...parts,
18607
- glob.pattern.children.at(-2),
18608
- glob.pattern.children.at(-1)
18659
+ glob.object.children.at(-1)
18609
18660
  ]
18610
18661
  };
18611
18662
  if (i === children.length - 1)
package/dist/main.mjs CHANGED
@@ -498,6 +498,7 @@ ${input.slice(result.pos)}
498
498
  CallExpression,
499
499
  CallExpressionRest,
500
500
  OptionalShorthand,
501
+ OptionalDot,
501
502
  NonNullAssertion,
502
503
  MemberExpression,
503
504
  MemberExpressionRest,
@@ -745,6 +746,7 @@ ${input.slice(result.pos)}
745
746
  HeregexPart,
746
747
  HeregexComment,
747
748
  RegularExpressionBody,
749
+ RegExpPart,
748
750
  RegExpCharacter,
749
751
  RegularExpressionFlags,
750
752
  TemplateLiteral,
@@ -1202,9 +1204,9 @@ ${input.slice(result.pos)}
1202
1204
  var $R25 = $R(new RegExp("(?:\\\\.)", "suy"));
1203
1205
  var $R26 = $R(new RegExp("[\\s]+", "suy"));
1204
1206
  var $R27 = $R(new RegExp("\\/(?!\\/\\/)", "suy"));
1205
- var $R28 = $R(new RegExp("[^\\/\\s#\\\\]+", "suy"));
1207
+ var $R28 = $R(new RegExp("[^[\\/\\s#\\\\]+", "suy"));
1206
1208
  var $R29 = $R(new RegExp("[*\\/\\r\\n]", "suy"));
1207
- var $R30 = $R(new RegExp("(?:\\\\.|[^\\/\\r\\n])+", "suy"));
1209
+ var $R30 = $R(new RegExp("(?:\\\\.|[^[\\/\\r\\n])+", "suy"));
1208
1210
  var $R31 = $R(new RegExp("(?:\\p{ID_Continue}|[\\u200C\\u200D$])*", "suy"));
1209
1211
  var $R32 = $R(new RegExp("(?:\\$(?!\\{)|\\\\.|[^$`])+", "suy"));
1210
1212
  var $R33 = $R(new RegExp("(?:\\$(?!\\{)|`(?!``)|\\\\.|[^$`])+", "suy"));
@@ -3311,7 +3313,7 @@ ${input.slice(result.pos)}
3311
3313
  return result;
3312
3314
  }
3313
3315
  }
3314
- var OptionalShorthand$0 = $TS($S(QuestionMark, $C(Dot, InsertDot)), function($skip, $loc, $0, $1, $2) {
3316
+ var OptionalShorthand$0 = $TS($S(QuestionMark, OptionalDot), function($skip, $loc, $0, $1, $2) {
3315
3317
  return {
3316
3318
  type: "Optional",
3317
3319
  children: $0
@@ -3339,6 +3341,30 @@ ${input.slice(result.pos)}
3339
3341
  return result;
3340
3342
  }
3341
3343
  }
3344
+ var OptionalDot$0 = Dot;
3345
+ var OptionalDot$1 = InsertDot;
3346
+ function OptionalDot(state) {
3347
+ let eventData;
3348
+ if (state.events) {
3349
+ const result = state.events.enter?.("OptionalDot", state);
3350
+ if (result) {
3351
+ if (result.cache)
3352
+ return result.cache;
3353
+ eventData = result.data;
3354
+ }
3355
+ }
3356
+ if (state.tokenize) {
3357
+ const result = $TOKEN("OptionalDot", state, OptionalDot$0(state) || OptionalDot$1(state));
3358
+ if (state.events)
3359
+ state.events.exit?.("OptionalDot", state, result, eventData);
3360
+ return result;
3361
+ } else {
3362
+ const result = OptionalDot$0(state) || OptionalDot$1(state);
3363
+ if (state.events)
3364
+ state.events.exit?.("OptionalDot", state, result, eventData);
3365
+ return result;
3366
+ }
3367
+ }
3342
3368
  var NonNullAssertion$0 = $T($EXPECT($L14, fail, 'NonNullAssertion "!"'), function(value) {
3343
3369
  return { "type": "NonNullAssertion", "ts": true, "children": value };
3344
3370
  });
@@ -3619,11 +3645,11 @@ ${input.slice(result.pos)}
3619
3645
  return result;
3620
3646
  }
3621
3647
  }
3622
- var PropertyGlob$0 = $TS($S(Dot, ObjectBindingPattern), function($skip, $loc, $0, $1, $2) {
3623
- var pattern = $2;
3648
+ var PropertyGlob$0 = $TS($S(OptionalDot, BracedObjectLiteral), function($skip, $loc, $0, $1, $2) {
3649
+ var object = $2;
3624
3650
  return {
3625
3651
  type: "PropertyGlob",
3626
- pattern,
3652
+ object,
3627
3653
  children: $0
3628
3654
  };
3629
3655
  });
@@ -5165,7 +5191,7 @@ ${input.slice(result.pos)}
5165
5191
  block
5166
5192
  };
5167
5193
  });
5168
- var FunctionExpression$1 = $TS($S($E(AmpersandUnaryPrefix), Ampersand, $E(AmpersandBlockRHS)), function($skip, $loc, $0, $1, $2, $3) {
5194
+ var FunctionExpression$1 = $TS($S($E(AmpersandUnaryPrefix), $C(Ampersand, $S($N(NumericLiteral), $Y($S($E(QuestionMark), Dot)))), $E(AmpersandBlockRHS)), function($skip, $loc, $0, $1, $2, $3) {
5169
5195
  var prefix = $1;
5170
5196
  var rhs = $3;
5171
5197
  if (!prefix && !rhs)
@@ -6649,6 +6675,7 @@ ${input.slice(result.pos)}
6649
6675
  const children = [open, ...content, close];
6650
6676
  return {
6651
6677
  type: "ObjectExpression",
6678
+ content,
6652
6679
  children,
6653
6680
  names: children.flatMap((c) => {
6654
6681
  return c.names || [];
@@ -6978,7 +7005,7 @@ ${input.slice(result.pos)}
6978
7005
  const value = [{ ...at, token: "this." }, id];
6979
7006
  return {
6980
7007
  type: "Property",
6981
- children: [...ws, id, ": ", ...value],
7008
+ children: [ws, id, ": ", ...value],
6982
7009
  name: id,
6983
7010
  names: id.names,
6984
7011
  value
@@ -6989,7 +7016,7 @@ ${input.slice(result.pos)}
6989
7016
  var prop = $2;
6990
7017
  return {
6991
7018
  ...prop,
6992
- children: [...ws, ...prop.children]
7019
+ children: [ws, ...prop.children]
6993
7020
  };
6994
7021
  });
6995
7022
  var PropertyDefinition$2 = $TS($S(__, $TEXT($EXPECT($R5, fail, "PropertyDefinition /[!+-]/")), PropertyName), function($skip, $loc, $0, $1, $2, $3) {
@@ -6999,7 +7026,7 @@ ${input.slice(result.pos)}
6999
7026
  const value = toggle === "+" ? "true" : "false";
7000
7027
  return {
7001
7028
  type: "Property",
7002
- children: [...ws, id, ": ", value],
7029
+ children: [ws, id, ": ", value],
7003
7030
  name: id,
7004
7031
  names: id.names,
7005
7032
  value
@@ -7012,7 +7039,7 @@ ${input.slice(result.pos)}
7012
7039
  return $skip;
7013
7040
  return {
7014
7041
  ...def,
7015
- children: [...ws, ...def.children]
7042
+ children: [ws, ...def.children]
7016
7043
  };
7017
7044
  });
7018
7045
  var PropertyDefinition$4 = $TS($S(__, DotDotDot, ExtendedExpression), function($skip, $loc, $0, $1, $2, $3) {
@@ -7021,7 +7048,7 @@ ${input.slice(result.pos)}
7021
7048
  var exp = $3;
7022
7049
  return {
7023
7050
  type: "SpreadProperty",
7024
- children: [...ws, dots, exp],
7051
+ children: [ws, dots, exp],
7025
7052
  names: exp.names,
7026
7053
  value: [dots, exp]
7027
7054
  };
@@ -7030,7 +7057,7 @@ ${input.slice(result.pos)}
7030
7057
  var ws = $1;
7031
7058
  var value = $2;
7032
7059
  if (value.type === "Identifier") {
7033
- return { ...value, children: [...ws, ...value.children] };
7060
+ return { ...value, children: [ws, ...value.children] };
7034
7061
  }
7035
7062
  let exp = value, children, i;
7036
7063
  do {
@@ -7275,9 +7302,9 @@ ${input.slice(result.pos)}
7275
7302
  ts: true
7276
7303
  };
7277
7304
  });
7278
- var MethodDefinition$1 = $TS($S(MethodSignature, BracedOrEmptyBlock), function($skip, $loc, $0, $1, $2) {
7305
+ var MethodDefinition$1 = $TS($S(MethodSignature, $N(PropertyAccess), BracedOrEmptyBlock), function($skip, $loc, $0, $1, $2, $3) {
7279
7306
  var signature = $1;
7280
- var block = $2;
7307
+ var block = $3;
7281
7308
  return {
7282
7309
  type: "MethodDefinition",
7283
7310
  children: $0,
@@ -11664,7 +11691,7 @@ ${input.slice(result.pos)}
11664
11691
  var HeregexPart$6 = $TR($EXPECT($R27, fail, "HeregexPart /\\/(?!\\/\\/)/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
11665
11692
  return { $loc, token: "\\/" };
11666
11693
  });
11667
- var HeregexPart$7 = $TR($EXPECT($R28, fail, "HeregexPart /[^\\/\\s#\\\\]+/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
11694
+ var HeregexPart$7 = $TR($EXPECT($R28, fail, "HeregexPart /[^[\\/\\s#\\\\]+/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
11668
11695
  return { $loc, token: $0 };
11669
11696
  });
11670
11697
  function HeregexPart(state) {
@@ -11713,7 +11740,7 @@ ${input.slice(result.pos)}
11713
11740
  return result;
11714
11741
  }
11715
11742
  }
11716
- var RegularExpressionBody$0 = $S($N($R$0($EXPECT($R29, fail, "RegularExpressionBody /[*\\/\\r\\n]/"))), $Q(RegExpCharacter));
11743
+ var RegularExpressionBody$0 = $S($N($R$0($EXPECT($R29, fail, "RegularExpressionBody /[*\\/\\r\\n]/"))), $Q(RegExpPart));
11717
11744
  function RegularExpressionBody(state) {
11718
11745
  let eventData;
11719
11746
  if (state.events) {
@@ -11736,7 +11763,31 @@ ${input.slice(result.pos)}
11736
11763
  return result;
11737
11764
  }
11738
11765
  }
11739
- var RegExpCharacter$0 = $R$0($EXPECT($R30, fail, "RegExpCharacter /(?:\\\\.|[^\\/\\r\\n])+/"));
11766
+ var RegExpPart$0 = RegularExpressionClass;
11767
+ var RegExpPart$1 = RegExpCharacter;
11768
+ function RegExpPart(state) {
11769
+ let eventData;
11770
+ if (state.events) {
11771
+ const result = state.events.enter?.("RegExpPart", state);
11772
+ if (result) {
11773
+ if (result.cache)
11774
+ return result.cache;
11775
+ eventData = result.data;
11776
+ }
11777
+ }
11778
+ if (state.tokenize) {
11779
+ const result = $TOKEN("RegExpPart", state, RegExpPart$0(state) || RegExpPart$1(state));
11780
+ if (state.events)
11781
+ state.events.exit?.("RegExpPart", state, result, eventData);
11782
+ return result;
11783
+ } else {
11784
+ const result = RegExpPart$0(state) || RegExpPart$1(state);
11785
+ if (state.events)
11786
+ state.events.exit?.("RegExpPart", state, result, eventData);
11787
+ return result;
11788
+ }
11789
+ }
11790
+ var RegExpCharacter$0 = $R$0($EXPECT($R30, fail, "RegExpCharacter /(?:\\\\.|[^[\\/\\r\\n])+/"));
11740
11791
  function RegExpCharacter(state) {
11741
11792
  let eventData;
11742
11793
  if (state.events) {
@@ -18567,19 +18618,20 @@ ${input.slice(result.pos)}
18567
18618
  if (glob?.type === "PropertyGlob") {
18568
18619
  const prefix = children.slice(0, i).concat(glob.children[0]);
18569
18620
  const parts = [];
18570
- for (const part of glob.pattern.content) {
18571
- if (part.init) {
18572
- throw new Error("Glob pattern cannot have initializers");
18621
+ for (const part of glob.object.content) {
18622
+ if (part.type === "SpreadProperty") {
18623
+ throw new Error("Glob pattern cannot have ...spread property");
18573
18624
  }
18574
- if (part.type === "AtBindingProperty") {
18575
- throw new Error("Glob pattern cannot have @property");
18625
+ if (part.type === "MethodDefinition") {
18626
+ throw new Error("Glob pattern cannot have method definition");
18576
18627
  }
18577
- if (part.type === "BindingRestProperty") {
18578
- throw new Error("Glob pattern cannot have ...rest property");
18628
+ if (part.value && !["CallExpression", "MemberExpression", "Identifier"].includes(part.value.type)) {
18629
+ throw new Error("Glob pattern must have call or member expression value");
18579
18630
  }
18580
- const name = part.value ? module.insertTrimmingSpace(part.value, "") : part.name;
18581
- const value = prefix.concat(module.insertTrimmingSpace(part.name, ""));
18582
- const wValue = part.value && module.getTrimmingSpace(part.value);
18631
+ const { name } = part;
18632
+ let value = part.value ?? part.name;
18633
+ const wValue = module.getTrimmingSpace(part.value);
18634
+ value = prefix.concat(module.insertTrimmingSpace(value, ""));
18583
18635
  if (wValue)
18584
18636
  value.unshift(wValue);
18585
18637
  parts.push({
@@ -18600,10 +18652,9 @@ ${input.slice(result.pos)}
18600
18652
  const object = {
18601
18653
  type: "ObjectExpression",
18602
18654
  children: [
18603
- glob.pattern.children[0],
18655
+ glob.object.children[0],
18604
18656
  ...parts,
18605
- glob.pattern.children.at(-2),
18606
- glob.pattern.children.at(-1)
18657
+ glob.object.children.at(-1)
18607
18658
  ]
18608
18659
  };
18609
18660
  if (i === children.length - 1)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danielx/civet",
3
- "version": "0.5.63",
3
+ "version": "0.5.65",
4
4
  "description": "CoffeeScript style syntax for TypeScript",
5
5
  "main": "dist/main.js",
6
6
  "module": "dist/main.mjs",