@danielx/civet 0.6.37 → 0.6.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.js CHANGED
@@ -892,6 +892,28 @@ var require_lib = __commonJS({
892
892
  }
893
893
  return expandedOps;
894
894
  }
895
+ function handleThisPrivateShorthands(value) {
896
+ if (value.privateShorthand) {
897
+ value = value.children[1].children[1];
898
+ return [value, false];
899
+ }
900
+ if (value.type === "MemberExpression" || value.type === "CallExpression") {
901
+ let suppressPrefix = value.thisShorthand;
902
+ value = {
903
+ ...value,
904
+ children: value.children.map((c, i) => {
905
+ if (i === 0) {
906
+ let s;
907
+ [c, s] = handleThisPrivateShorthands(c);
908
+ suppressPrefix || (suppressPrefix = s);
909
+ }
910
+ return c;
911
+ })
912
+ };
913
+ return [value, suppressPrefix];
914
+ }
915
+ return [value, value.thisShorthand];
916
+ }
895
917
  function processCallMemberExpression(node) {
896
918
  const { children } = node;
897
919
  for (let i = 0; i < children.length; i++) {
@@ -919,11 +941,15 @@ var require_lib = __commonJS({
919
941
  throw new Error("Glob pattern cannot have method definition");
920
942
  }
921
943
  if (part.value && !["CallExpression", "MemberExpression", "Identifier"].includes(part.value.type)) {
922
- throw new Error("Glob pattern must have call or member expression value");
944
+ throw new Error(`Glob pattern must have call or member expression value, found ${JSON.stringify(part.value)}`);
923
945
  }
946
+ let suppressPrefix = false;
924
947
  let value = part.value ?? part.name;
925
948
  const wValue = getTrimmingSpace(part.value);
926
- value = prefix.concat(insertTrimmingSpace(value, ""));
949
+ [value, suppressPrefix] = handleThisPrivateShorthands(value);
950
+ if (!suppressPrefix) {
951
+ value = prefix.concat(insertTrimmingSpace(value, ""));
952
+ }
927
953
  if (wValue)
928
954
  value.unshift(wValue);
929
955
  if (part.type === "SpreadProperty") {
@@ -1137,14 +1163,14 @@ var require_lib = __commonJS({
1137
1163
  chains.push(i);
1138
1164
  } else if (lowerPrecedenceOps.includes(op.token)) {
1139
1165
  processChains(op);
1140
- first = [];
1166
+ first = void 0;
1141
1167
  }
1142
1168
  i++;
1143
1169
  }
1144
1170
  processChains(op);
1145
1171
  return results;
1146
1172
  function processChains(op2) {
1147
- if (isRelationalOp(op2)) {
1173
+ if (first && isRelationalOp(op2)) {
1148
1174
  first = expandExistence(first);
1149
1175
  }
1150
1176
  if (chains.length > 1) {
@@ -1153,7 +1179,7 @@ var require_lib = __commonJS({
1153
1179
  results.push(" ", "&&", " ");
1154
1180
  }
1155
1181
  const binop = binops[index];
1156
- let [pre, op3, post, exp] = binop;
1182
+ let [, , , exp] = binop;
1157
1183
  exp = binop[3] = expandExistence(exp);
1158
1184
  let endIndex;
1159
1185
  if (k < chains.length - 1) {
@@ -1166,10 +1192,13 @@ var require_lib = __commonJS({
1166
1192
  return start = endIndex;
1167
1193
  });
1168
1194
  } else {
1169
- results.push(first, ...binops.slice(start, i + 1).flat());
1195
+ if (first) {
1196
+ results.push(first);
1197
+ }
1198
+ results.push(...binops.slice(start, i + 1).flat());
1170
1199
  start = i + 1;
1171
1200
  }
1172
- return chains.length = 0;
1201
+ chains.length = 0;
1173
1202
  }
1174
1203
  function expandExistence(exp) {
1175
1204
  const existence = isExistence(exp);
@@ -1251,6 +1280,23 @@ var require_lib = __commonJS({
1251
1280
  }
1252
1281
  }
1253
1282
  }
1283
+ function replaceBlockExpression(node, child, replacement) {
1284
+ let found = false;
1285
+ const { expressions } = node;
1286
+ for (let i = 0, l = expressions.length; i < l; i++) {
1287
+ const statement = expressions[i];
1288
+ const [, s] = statement;
1289
+ if (s === child) {
1290
+ statement[1] = replacement;
1291
+ replacement.parent = node;
1292
+ found = true;
1293
+ break;
1294
+ }
1295
+ }
1296
+ if (!found) {
1297
+ throw new Error("Could not find child to replace");
1298
+ }
1299
+ }
1254
1300
  function findChildIndex(parent, child) {
1255
1301
  const children = Array.isArray(parent) ? parent : parent.children;
1256
1302
  const len = children.length;
@@ -2137,12 +2183,12 @@ var require_lib = __commonJS({
2137
2183
  }
2138
2184
  function processDeclarationConditions(node) {
2139
2185
  gatherRecursiveAll(node, (n) => {
2140
- return n.type === "IfStatement" || n.type === "IterationStatement";
2186
+ return n.type === "IfStatement" || n.type === "IterationStatement" || n.type === "SwitchStatement";
2141
2187
  }).forEach(processDeclarationConditionStatement);
2142
2188
  }
2143
2189
  function processDeclarationConditionStatement(s) {
2144
2190
  const { condition } = s;
2145
- if (!condition) {
2191
+ if (!condition?.expression) {
2146
2192
  return;
2147
2193
  }
2148
2194
  processDeclarationCondition(condition.expression);
@@ -2183,6 +2229,27 @@ var require_lib = __commonJS({
2183
2229
  updateParentPointers(newBlock, s);
2184
2230
  break;
2185
2231
  }
2232
+ case "SwitchStatement": {
2233
+ const { blockPrefix, ref: ref2 } = condition.expression;
2234
+ if (!blockPrefix) {
2235
+ return;
2236
+ }
2237
+ s.condition = {
2238
+ type: "ParenthesizedExpression",
2239
+ children: ["(", ref2, ")"],
2240
+ expression: ref2,
2241
+ parent: s
2242
+ };
2243
+ s.children[1] = s.condition;
2244
+ const block = blockWithPrefix([["", [{
2245
+ type: "Declaration",
2246
+ children: ["let ", ...condition.expression.children]
2247
+ }], ";"], ...blockPrefix], makeEmptyBlock());
2248
+ replaceBlockExpression(s.parent, s, block);
2249
+ block.expressions.push(["", s]);
2250
+ s.parent = block;
2251
+ break;
2252
+ }
2186
2253
  }
2187
2254
  }
2188
2255
  function implicitFunctionBlock(f) {
@@ -2631,12 +2698,12 @@ var require_lib = __commonJS({
2631
2698
  }
2632
2699
  if (errors || !isPattern)
2633
2700
  return;
2634
- let { expression } = s;
2635
- if (expression.type === "ParenthesizedExpression") {
2636
- expression = expression.expression;
2701
+ let { condition } = s;
2702
+ if (condition.type === "ParenthesizedExpression") {
2703
+ condition = condition.expression;
2637
2704
  }
2638
- let hoistDec, refAssignment = [], ref = maybeRef(expression, "m");
2639
- if (ref !== expression) {
2705
+ let hoistDec, refAssignment = [], ref = maybeRef(condition, "m");
2706
+ if (ref !== condition) {
2640
2707
  hoistDec = {
2641
2708
  type: "Declaration",
2642
2709
  children: ["let ", ref],
@@ -2644,7 +2711,7 @@ var require_lib = __commonJS({
2644
2711
  };
2645
2712
  refAssignment = [{
2646
2713
  type: "AssignmentExpression",
2647
- children: [ref, " = ", expression]
2714
+ children: [ref, " = ", condition]
2648
2715
  }, ","];
2649
2716
  }
2650
2717
  let prev = [], root = prev;
@@ -2672,7 +2739,7 @@ var require_lib = __commonJS({
2672
2739
  return conditionArray;
2673
2740
  return [" || ", ...conditionArray];
2674
2741
  });
2675
- const condition = {
2742
+ const condition2 = {
2676
2743
  type: "ParenthesizedExpression",
2677
2744
  children: ["(", ...refAssignment, conditionExpression, ")"],
2678
2745
  expression: conditionExpression
@@ -2707,7 +2774,7 @@ var require_lib = __commonJS({
2707
2774
  next.push("\n", "else ");
2708
2775
  prev.push(["", {
2709
2776
  type: "IfStatement",
2710
- children: ["if", condition, block, next],
2777
+ children: ["if", condition2, block, next],
2711
2778
  then: block,
2712
2779
  else: next,
2713
2780
  hoistDec
@@ -5360,7 +5427,8 @@ var require_parser = __commonJS({
5360
5427
  type: "PropertyAccess",
5361
5428
  name: id,
5362
5429
  children: [".", id]
5363
- }]
5430
+ }],
5431
+ thisShorthand: true
5364
5432
  };
5365
5433
  });
5366
5434
  var ThisLiteral$2 = AtThis;
@@ -5381,7 +5449,8 @@ var require_parser = __commonJS({
5381
5449
  type: "PropertyAccess",
5382
5450
  name: id.name,
5383
5451
  children: [".", id]
5384
- }]
5452
+ }],
5453
+ privateShorthand: true
5385
5454
  };
5386
5455
  });
5387
5456
  var PrivateThis$$ = [PrivateThis$0, PrivateThis$1];
@@ -7233,20 +7302,7 @@ var require_parser = __commonJS({
7233
7302
  function ObjectPropertyDelimiter(ctx, state) {
7234
7303
  return $EVENT_C(ctx, state, "ObjectPropertyDelimiter", ObjectPropertyDelimiter$$);
7235
7304
  }
7236
- var PropertyDefinition$0 = $TS($S($E(_), AtThis, IdentifierReference), function($skip, $loc, $0, $1, $2, $3) {
7237
- var ws = $1;
7238
- var at = $2;
7239
- var id = $3;
7240
- const value = [at, ".", id];
7241
- return {
7242
- type: "Property",
7243
- children: [ws, id, ": ", ...value],
7244
- name: id,
7245
- names: id.names,
7246
- value
7247
- };
7248
- });
7249
- var PropertyDefinition$1 = $TS($S($E(_), NamedProperty), function($skip, $loc, $0, $1, $2) {
7305
+ var PropertyDefinition$0 = $TS($S($E(_), NamedProperty), function($skip, $loc, $0, $1, $2) {
7250
7306
  var ws = $1;
7251
7307
  var prop = $2;
7252
7308
  return {
@@ -7254,7 +7310,7 @@ var require_parser = __commonJS({
7254
7310
  children: [ws, ...prop.children]
7255
7311
  };
7256
7312
  });
7257
- var PropertyDefinition$2 = $TS($S($E(_), $TEXT($EXPECT($R6, "PropertyDefinition /[!+-]/")), PropertyName), function($skip, $loc, $0, $1, $2, $3) {
7313
+ var PropertyDefinition$1 = $TS($S($E(_), $TEXT($EXPECT($R6, "PropertyDefinition /[!+-]/")), PropertyName), function($skip, $loc, $0, $1, $2, $3) {
7258
7314
  var ws = $1;
7259
7315
  var toggle = $2;
7260
7316
  var id = $3;
@@ -7267,7 +7323,7 @@ var require_parser = __commonJS({
7267
7323
  value
7268
7324
  };
7269
7325
  });
7270
- var PropertyDefinition$3 = $TS($S($E(_), MethodDefinition), function($skip, $loc, $0, $1, $2) {
7326
+ var PropertyDefinition$2 = $TS($S($E(_), MethodDefinition), function($skip, $loc, $0, $1, $2) {
7271
7327
  var ws = $1;
7272
7328
  var def = $2;
7273
7329
  if (!def.block || def.block.empty)
@@ -7277,7 +7333,7 @@ var require_parser = __commonJS({
7277
7333
  children: [ws, ...def.children]
7278
7334
  };
7279
7335
  });
7280
- var PropertyDefinition$4 = $TS($S($E(_), DotDotDot, ExtendedExpression), function($skip, $loc, $0, $1, $2, $3) {
7336
+ var PropertyDefinition$3 = $TS($S($E(_), DotDotDot, ExtendedExpression), function($skip, $loc, $0, $1, $2, $3) {
7281
7337
  var ws = $1;
7282
7338
  var dots = $2;
7283
7339
  var exp = $3;
@@ -7289,7 +7345,7 @@ var require_parser = __commonJS({
7289
7345
  value: exp
7290
7346
  };
7291
7347
  });
7292
- var PropertyDefinition$5 = $TS($S($E(_), $N(EOS), CallExpression), function($skip, $loc, $0, $1, $2, $3) {
7348
+ var PropertyDefinition$4 = $TS($S($E(_), $N(EOS), CallExpression), function($skip, $loc, $0, $1, $2, $3) {
7293
7349
  var ws = $1;
7294
7350
  var value = $3;
7295
7351
  switch (value.type) {
@@ -7348,16 +7404,18 @@ var require_parser = __commonJS({
7348
7404
  if (!name)
7349
7405
  return $skip;
7350
7406
  }
7407
+ if (name[0] === "#")
7408
+ name = name.slice(1);
7351
7409
  return {
7352
7410
  type: "Property",
7353
7411
  children: [ws, name, ": ", value],
7354
7412
  name,
7355
- value,
7356
7413
  names: [],
7414
+ value,
7357
7415
  hoistDec
7358
7416
  };
7359
7417
  });
7360
- var PropertyDefinition$$ = [PropertyDefinition$0, PropertyDefinition$1, PropertyDefinition$2, PropertyDefinition$3, PropertyDefinition$4, PropertyDefinition$5];
7418
+ var PropertyDefinition$$ = [PropertyDefinition$0, PropertyDefinition$1, PropertyDefinition$2, PropertyDefinition$3, PropertyDefinition$4];
7361
7419
  function PropertyDefinition(ctx, state) {
7362
7420
  return $EVENT_C(ctx, state, "PropertyDefinition", PropertyDefinition$$);
7363
7421
  }
@@ -8721,7 +8779,7 @@ var require_parser = __commonJS({
8721
8779
  return {
8722
8780
  type: "SwitchStatement",
8723
8781
  children: $0,
8724
- expression: condition,
8782
+ condition,
8725
8783
  caseBlock
8726
8784
  };
8727
8785
  });
@@ -13417,6 +13475,7 @@ __export(main_exports, {
13417
13475
  generate: () => generate_default,
13418
13476
  isCompileError: () => isCompileError,
13419
13477
  parse: () => parse,
13478
+ prune: () => prune,
13420
13479
  util: () => util_exports
13421
13480
  });
13422
13481
  module.exports = __toCommonJS(main_exports);
@@ -13585,7 +13644,10 @@ var SourceMap = function(sourceString) {
13585
13644
  sources: [srcFileName],
13586
13645
  mappings: this.renderMappings(),
13587
13646
  names: [],
13588
- sourcesContent: [sourceString]
13647
+ sourcesContent: [sourceString],
13648
+ toString: function() {
13649
+ return JSON.stringify(this);
13650
+ }
13589
13651
  };
13590
13652
  },
13591
13653
  updateSourceMap: function(outputStr, inputPos) {
@@ -14009,5 +14071,6 @@ var main_default = { parse, generate: generate_default, util: util_exports, comp
14009
14071
  generate,
14010
14072
  isCompileError,
14011
14073
  parse,
14074
+ prune,
14012
14075
  util
14013
14076
  });
package/dist/main.mjs CHANGED
@@ -890,6 +890,28 @@ var require_lib = __commonJS({
890
890
  }
891
891
  return expandedOps;
892
892
  }
893
+ function handleThisPrivateShorthands(value) {
894
+ if (value.privateShorthand) {
895
+ value = value.children[1].children[1];
896
+ return [value, false];
897
+ }
898
+ if (value.type === "MemberExpression" || value.type === "CallExpression") {
899
+ let suppressPrefix = value.thisShorthand;
900
+ value = {
901
+ ...value,
902
+ children: value.children.map((c, i) => {
903
+ if (i === 0) {
904
+ let s;
905
+ [c, s] = handleThisPrivateShorthands(c);
906
+ suppressPrefix || (suppressPrefix = s);
907
+ }
908
+ return c;
909
+ })
910
+ };
911
+ return [value, suppressPrefix];
912
+ }
913
+ return [value, value.thisShorthand];
914
+ }
893
915
  function processCallMemberExpression(node) {
894
916
  const { children } = node;
895
917
  for (let i = 0; i < children.length; i++) {
@@ -917,11 +939,15 @@ var require_lib = __commonJS({
917
939
  throw new Error("Glob pattern cannot have method definition");
918
940
  }
919
941
  if (part.value && !["CallExpression", "MemberExpression", "Identifier"].includes(part.value.type)) {
920
- throw new Error("Glob pattern must have call or member expression value");
942
+ throw new Error(`Glob pattern must have call or member expression value, found ${JSON.stringify(part.value)}`);
921
943
  }
944
+ let suppressPrefix = false;
922
945
  let value = part.value ?? part.name;
923
946
  const wValue = getTrimmingSpace(part.value);
924
- value = prefix.concat(insertTrimmingSpace(value, ""));
947
+ [value, suppressPrefix] = handleThisPrivateShorthands(value);
948
+ if (!suppressPrefix) {
949
+ value = prefix.concat(insertTrimmingSpace(value, ""));
950
+ }
925
951
  if (wValue)
926
952
  value.unshift(wValue);
927
953
  if (part.type === "SpreadProperty") {
@@ -1135,14 +1161,14 @@ var require_lib = __commonJS({
1135
1161
  chains.push(i);
1136
1162
  } else if (lowerPrecedenceOps.includes(op.token)) {
1137
1163
  processChains(op);
1138
- first = [];
1164
+ first = void 0;
1139
1165
  }
1140
1166
  i++;
1141
1167
  }
1142
1168
  processChains(op);
1143
1169
  return results;
1144
1170
  function processChains(op2) {
1145
- if (isRelationalOp(op2)) {
1171
+ if (first && isRelationalOp(op2)) {
1146
1172
  first = expandExistence(first);
1147
1173
  }
1148
1174
  if (chains.length > 1) {
@@ -1151,7 +1177,7 @@ var require_lib = __commonJS({
1151
1177
  results.push(" ", "&&", " ");
1152
1178
  }
1153
1179
  const binop = binops[index];
1154
- let [pre, op3, post, exp] = binop;
1180
+ let [, , , exp] = binop;
1155
1181
  exp = binop[3] = expandExistence(exp);
1156
1182
  let endIndex;
1157
1183
  if (k < chains.length - 1) {
@@ -1164,10 +1190,13 @@ var require_lib = __commonJS({
1164
1190
  return start = endIndex;
1165
1191
  });
1166
1192
  } else {
1167
- results.push(first, ...binops.slice(start, i + 1).flat());
1193
+ if (first) {
1194
+ results.push(first);
1195
+ }
1196
+ results.push(...binops.slice(start, i + 1).flat());
1168
1197
  start = i + 1;
1169
1198
  }
1170
- return chains.length = 0;
1199
+ chains.length = 0;
1171
1200
  }
1172
1201
  function expandExistence(exp) {
1173
1202
  const existence = isExistence(exp);
@@ -1249,6 +1278,23 @@ var require_lib = __commonJS({
1249
1278
  }
1250
1279
  }
1251
1280
  }
1281
+ function replaceBlockExpression(node, child, replacement) {
1282
+ let found = false;
1283
+ const { expressions } = node;
1284
+ for (let i = 0, l = expressions.length; i < l; i++) {
1285
+ const statement = expressions[i];
1286
+ const [, s] = statement;
1287
+ if (s === child) {
1288
+ statement[1] = replacement;
1289
+ replacement.parent = node;
1290
+ found = true;
1291
+ break;
1292
+ }
1293
+ }
1294
+ if (!found) {
1295
+ throw new Error("Could not find child to replace");
1296
+ }
1297
+ }
1252
1298
  function findChildIndex(parent, child) {
1253
1299
  const children = Array.isArray(parent) ? parent : parent.children;
1254
1300
  const len = children.length;
@@ -2135,12 +2181,12 @@ var require_lib = __commonJS({
2135
2181
  }
2136
2182
  function processDeclarationConditions(node) {
2137
2183
  gatherRecursiveAll(node, (n) => {
2138
- return n.type === "IfStatement" || n.type === "IterationStatement";
2184
+ return n.type === "IfStatement" || n.type === "IterationStatement" || n.type === "SwitchStatement";
2139
2185
  }).forEach(processDeclarationConditionStatement);
2140
2186
  }
2141
2187
  function processDeclarationConditionStatement(s) {
2142
2188
  const { condition } = s;
2143
- if (!condition) {
2189
+ if (!condition?.expression) {
2144
2190
  return;
2145
2191
  }
2146
2192
  processDeclarationCondition(condition.expression);
@@ -2181,6 +2227,27 @@ var require_lib = __commonJS({
2181
2227
  updateParentPointers(newBlock, s);
2182
2228
  break;
2183
2229
  }
2230
+ case "SwitchStatement": {
2231
+ const { blockPrefix, ref: ref2 } = condition.expression;
2232
+ if (!blockPrefix) {
2233
+ return;
2234
+ }
2235
+ s.condition = {
2236
+ type: "ParenthesizedExpression",
2237
+ children: ["(", ref2, ")"],
2238
+ expression: ref2,
2239
+ parent: s
2240
+ };
2241
+ s.children[1] = s.condition;
2242
+ const block = blockWithPrefix([["", [{
2243
+ type: "Declaration",
2244
+ children: ["let ", ...condition.expression.children]
2245
+ }], ";"], ...blockPrefix], makeEmptyBlock());
2246
+ replaceBlockExpression(s.parent, s, block);
2247
+ block.expressions.push(["", s]);
2248
+ s.parent = block;
2249
+ break;
2250
+ }
2184
2251
  }
2185
2252
  }
2186
2253
  function implicitFunctionBlock(f) {
@@ -2629,12 +2696,12 @@ var require_lib = __commonJS({
2629
2696
  }
2630
2697
  if (errors || !isPattern)
2631
2698
  return;
2632
- let { expression } = s;
2633
- if (expression.type === "ParenthesizedExpression") {
2634
- expression = expression.expression;
2699
+ let { condition } = s;
2700
+ if (condition.type === "ParenthesizedExpression") {
2701
+ condition = condition.expression;
2635
2702
  }
2636
- let hoistDec, refAssignment = [], ref = maybeRef(expression, "m");
2637
- if (ref !== expression) {
2703
+ let hoistDec, refAssignment = [], ref = maybeRef(condition, "m");
2704
+ if (ref !== condition) {
2638
2705
  hoistDec = {
2639
2706
  type: "Declaration",
2640
2707
  children: ["let ", ref],
@@ -2642,7 +2709,7 @@ var require_lib = __commonJS({
2642
2709
  };
2643
2710
  refAssignment = [{
2644
2711
  type: "AssignmentExpression",
2645
- children: [ref, " = ", expression]
2712
+ children: [ref, " = ", condition]
2646
2713
  }, ","];
2647
2714
  }
2648
2715
  let prev = [], root = prev;
@@ -2670,7 +2737,7 @@ var require_lib = __commonJS({
2670
2737
  return conditionArray;
2671
2738
  return [" || ", ...conditionArray];
2672
2739
  });
2673
- const condition = {
2740
+ const condition2 = {
2674
2741
  type: "ParenthesizedExpression",
2675
2742
  children: ["(", ...refAssignment, conditionExpression, ")"],
2676
2743
  expression: conditionExpression
@@ -2705,7 +2772,7 @@ var require_lib = __commonJS({
2705
2772
  next.push("\n", "else ");
2706
2773
  prev.push(["", {
2707
2774
  type: "IfStatement",
2708
- children: ["if", condition, block, next],
2775
+ children: ["if", condition2, block, next],
2709
2776
  then: block,
2710
2777
  else: next,
2711
2778
  hoistDec
@@ -5358,7 +5425,8 @@ var require_parser = __commonJS({
5358
5425
  type: "PropertyAccess",
5359
5426
  name: id,
5360
5427
  children: [".", id]
5361
- }]
5428
+ }],
5429
+ thisShorthand: true
5362
5430
  };
5363
5431
  });
5364
5432
  var ThisLiteral$2 = AtThis;
@@ -5379,7 +5447,8 @@ var require_parser = __commonJS({
5379
5447
  type: "PropertyAccess",
5380
5448
  name: id.name,
5381
5449
  children: [".", id]
5382
- }]
5450
+ }],
5451
+ privateShorthand: true
5383
5452
  };
5384
5453
  });
5385
5454
  var PrivateThis$$ = [PrivateThis$0, PrivateThis$1];
@@ -7231,20 +7300,7 @@ var require_parser = __commonJS({
7231
7300
  function ObjectPropertyDelimiter(ctx, state) {
7232
7301
  return $EVENT_C(ctx, state, "ObjectPropertyDelimiter", ObjectPropertyDelimiter$$);
7233
7302
  }
7234
- var PropertyDefinition$0 = $TS($S($E(_), AtThis, IdentifierReference), function($skip, $loc, $0, $1, $2, $3) {
7235
- var ws = $1;
7236
- var at = $2;
7237
- var id = $3;
7238
- const value = [at, ".", id];
7239
- return {
7240
- type: "Property",
7241
- children: [ws, id, ": ", ...value],
7242
- name: id,
7243
- names: id.names,
7244
- value
7245
- };
7246
- });
7247
- var PropertyDefinition$1 = $TS($S($E(_), NamedProperty), function($skip, $loc, $0, $1, $2) {
7303
+ var PropertyDefinition$0 = $TS($S($E(_), NamedProperty), function($skip, $loc, $0, $1, $2) {
7248
7304
  var ws = $1;
7249
7305
  var prop = $2;
7250
7306
  return {
@@ -7252,7 +7308,7 @@ var require_parser = __commonJS({
7252
7308
  children: [ws, ...prop.children]
7253
7309
  };
7254
7310
  });
7255
- var PropertyDefinition$2 = $TS($S($E(_), $TEXT($EXPECT($R6, "PropertyDefinition /[!+-]/")), PropertyName), function($skip, $loc, $0, $1, $2, $3) {
7311
+ var PropertyDefinition$1 = $TS($S($E(_), $TEXT($EXPECT($R6, "PropertyDefinition /[!+-]/")), PropertyName), function($skip, $loc, $0, $1, $2, $3) {
7256
7312
  var ws = $1;
7257
7313
  var toggle = $2;
7258
7314
  var id = $3;
@@ -7265,7 +7321,7 @@ var require_parser = __commonJS({
7265
7321
  value
7266
7322
  };
7267
7323
  });
7268
- var PropertyDefinition$3 = $TS($S($E(_), MethodDefinition), function($skip, $loc, $0, $1, $2) {
7324
+ var PropertyDefinition$2 = $TS($S($E(_), MethodDefinition), function($skip, $loc, $0, $1, $2) {
7269
7325
  var ws = $1;
7270
7326
  var def = $2;
7271
7327
  if (!def.block || def.block.empty)
@@ -7275,7 +7331,7 @@ var require_parser = __commonJS({
7275
7331
  children: [ws, ...def.children]
7276
7332
  };
7277
7333
  });
7278
- var PropertyDefinition$4 = $TS($S($E(_), DotDotDot, ExtendedExpression), function($skip, $loc, $0, $1, $2, $3) {
7334
+ var PropertyDefinition$3 = $TS($S($E(_), DotDotDot, ExtendedExpression), function($skip, $loc, $0, $1, $2, $3) {
7279
7335
  var ws = $1;
7280
7336
  var dots = $2;
7281
7337
  var exp = $3;
@@ -7287,7 +7343,7 @@ var require_parser = __commonJS({
7287
7343
  value: exp
7288
7344
  };
7289
7345
  });
7290
- var PropertyDefinition$5 = $TS($S($E(_), $N(EOS), CallExpression), function($skip, $loc, $0, $1, $2, $3) {
7346
+ var PropertyDefinition$4 = $TS($S($E(_), $N(EOS), CallExpression), function($skip, $loc, $0, $1, $2, $3) {
7291
7347
  var ws = $1;
7292
7348
  var value = $3;
7293
7349
  switch (value.type) {
@@ -7346,16 +7402,18 @@ var require_parser = __commonJS({
7346
7402
  if (!name)
7347
7403
  return $skip;
7348
7404
  }
7405
+ if (name[0] === "#")
7406
+ name = name.slice(1);
7349
7407
  return {
7350
7408
  type: "Property",
7351
7409
  children: [ws, name, ": ", value],
7352
7410
  name,
7353
- value,
7354
7411
  names: [],
7412
+ value,
7355
7413
  hoistDec
7356
7414
  };
7357
7415
  });
7358
- var PropertyDefinition$$ = [PropertyDefinition$0, PropertyDefinition$1, PropertyDefinition$2, PropertyDefinition$3, PropertyDefinition$4, PropertyDefinition$5];
7416
+ var PropertyDefinition$$ = [PropertyDefinition$0, PropertyDefinition$1, PropertyDefinition$2, PropertyDefinition$3, PropertyDefinition$4];
7359
7417
  function PropertyDefinition(ctx, state) {
7360
7418
  return $EVENT_C(ctx, state, "PropertyDefinition", PropertyDefinition$$);
7361
7419
  }
@@ -8719,7 +8777,7 @@ var require_parser = __commonJS({
8719
8777
  return {
8720
8778
  type: "SwitchStatement",
8721
8779
  children: $0,
8722
- expression: condition,
8780
+ condition,
8723
8781
  caseBlock
8724
8782
  };
8725
8783
  });
@@ -13573,7 +13631,10 @@ var SourceMap = function(sourceString) {
13573
13631
  sources: [srcFileName],
13574
13632
  mappings: this.renderMappings(),
13575
13633
  names: [],
13576
- sourcesContent: [sourceString]
13634
+ sourcesContent: [sourceString],
13635
+ toString: function() {
13636
+ return JSON.stringify(this);
13637
+ }
13577
13638
  };
13578
13639
  },
13579
13640
  updateSourceMap: function(outputStr, inputPos) {
@@ -13997,5 +14058,6 @@ export {
13997
14058
  generate_default as generate,
13998
14059
  isCompileError,
13999
14060
  parse,
14061
+ prune,
14000
14062
  util_exports as util
14001
14063
  };