@danielx/civet 0.11.8 → 0.11.9

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,17 @@ 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.11.9 (2026-05-14, [diff](https://github.com/DanielXMoore/Civet/compare/v0.11.8...v0.11.9), [commits](https://github.com/DanielXMoore/Civet/commits/v0.11.9))
8
+ * Browser LSP: fix `console` types in non-DOM mode [[#2047](https://github.com/DanielXMoore/Civet/pull/2047)]
9
+ * LSP e2e: fix Linux test reliability (Wayland headless + flaky import-completion) [[#2050](https://github.com/DanielXMoore/Civet/pull/2050)]
10
+ * Tests: force v8 coverage flush before mocha worker exit [[#2056](https://github.com/DanielXMoore/Civet/pull/2056)]
11
+ * CI: rolling cache keys + prune stale entries [[#2057](https://github.com/DanielXMoore/Civet/pull/2057)]
12
+ * Fix unicode property names in `@`-bind, `::` prototype access, `:` symbol shortand [[#2055](https://github.com/DanielXMoore/Civet/pull/2055)]
13
+ * fix(coverage): eliminate flakiness from parallel mocha + dual-compile [[#2060](https://github.com/DanielXMoore/Civet/pull/2060)]
14
+ * Restore leaf-glom fallback in `prepend` (fixes #2058) [[#2059](https://github.com/DanielXMoore/Civet/pull/2059)]
15
+ * Upgrade Prettier, add `civet.dev` workspace [[#2063](https://github.com/DanielXMoore/Civet/pull/2063)]
16
+ * fix: unwrap if/then/else assignment to ternary without ref (#2051) [[#2054](https://github.com/DanielXMoore/Civet/pull/2054)]
17
+
7
18
  ## 0.11.8 (2026-05-13, [diff](https://github.com/DanielXMoore/Civet/compare/v0.11.7...v0.11.8), [commits](https://github.com/DanielXMoore/Civet/commits/v0.11.8))
8
19
  * Dev: Autopublish vsce and ovsx from GitHub CI [[#1963](https://github.com/DanielXMoore/Civet/pull/1963)]
9
20
  * dev: show-uncovered script at root [[#1966](https://github.com/DanielXMoore/Civet/pull/1966)]
package/dist/browser.js CHANGED
@@ -463,6 +463,7 @@ ${body}`), super(message), this.header = header, this.body = body, this.filename
463
463
  braceBlock: () => braceBlock,
464
464
  bracedBlock: () => bracedBlock,
465
465
  buildExportSplitClause: () => buildExportSplitClause,
466
+ canExpressionizeIfAsTernary: () => canExpressionizeIfAsTernary,
466
467
  convertArrowFunctionToMethod: () => convertArrowFunctionToMethod,
467
468
  convertFunctionToMethod: () => convertFunctionToMethod,
468
469
  convertNamedImportsToObject: () => convertNamedImportsToObject,
@@ -816,10 +817,10 @@ ${body}`), super(message), this.header = header, this.body = body, this.filename
816
817
  }
817
818
  }
818
819
  function prepend(prefix, node) {
819
- return !prefix || Array.isArray(prefix) && len(prefix, 0) ? node : Array.isArray(node) ? [prefix, ...node] : (assert(isParent(node), "prepend: can't glom into an AST leaf"), {
820
+ return !prefix || Array.isArray(prefix) && len(prefix, 0) ? node : Array.isArray(node) ? [prefix, ...node] : isParent(node) ? {
820
821
  ...node,
821
822
  children: [prefix, ...node.children]
822
- });
823
+ } : [prefix, node];
823
824
  }
824
825
  function append(node, suffix) {
825
826
  return !suffix || Array.isArray(suffix) && len(suffix, 0) ? node : Array.isArray(node) ? [...node, suffix] : isParent(node) ? {
@@ -4270,7 +4271,10 @@ ${js}`
4270
4271
  let { expression: exp } = initializer, ws;
4271
4272
  if (Array.isArray(exp) && exp.length === 2 && isWhitespaceOrEmpty(exp[0]) && (ws = exp[0], exp = exp[1]), !(typeof exp == "object" && exp != null && "type" in exp && exp.type === "StatementExpression"))
4272
4273
  return;
4273
- let statementExp = exp.statement, blockStatement = [ws || "", statementExp, ";"], pre = [blockStatement], ref;
4274
+ let statementExp = exp.statement;
4275
+ if (statementExp.type === "IfStatement" && canExpressionizeIfAsTernary(statementExp))
4276
+ return;
4277
+ let blockStatement = [ws || "", statementExp, ";"], pre = [blockStatement], ref;
4274
4278
  if (statementExp.type === "IterationExpression") {
4275
4279
  if (statementExp.async || statementExp.generator)
4276
4280
  return;
@@ -5524,6 +5528,21 @@ ${js}`
5524
5528
  } else
5525
5529
  return blockOrExpression;
5526
5530
  }
5531
+ function canExpressionizeIfAsTernary(statement) {
5532
+ let { then: b, else: e } = statement;
5533
+ return canExpressionizeBlock(b) && (e ? canExpressionizeBlock(e.block) : !0);
5534
+ }
5535
+ function canExpressionizeBlock(blockOrExpression) {
5536
+ if (blockOrExpression && typeof blockOrExpression == "object" && "expressions" in blockOrExpression) {
5537
+ let { expressions } = blockOrExpression, results1 = !0;
5538
+ for (let [, s] of expressions)
5539
+ if (!isExpression(s)) {
5540
+ results1 = !1;
5541
+ break;
5542
+ }
5543
+ return results1;
5544
+ }
5545
+ }
5527
5546
  function expressionizeIfStatement(statement) {
5528
5547
  let { condition, then: b, else: e } = statement, [...condRest] = condition.children, [closeParen] = condRest.splice(-1), expressionizedBlock = expressionizeBlock(b);
5529
5548
  if (!expressionizedBlock)
@@ -6344,9 +6363,9 @@ ${js}`
6344
6363
  }
6345
6364
  }
6346
6365
  function processTypes(node) {
6347
- let results1 = [];
6366
+ let results2 = [];
6348
6367
  for (let ref22 = gatherRecursiveAll(node, ($13) => $13.type === "TypeUnary"), i12 = 0, len11 = ref22.length; i12 < len11; i12++) {
6349
- let unary = ref22[i12], suffixIndex = unary.suffix.length - 1, results2 = [];
6368
+ let unary = ref22[i12], suffixIndex = unary.suffix.length - 1, results3 = [];
6350
6369
  for (; suffixIndex >= 0; ) {
6351
6370
  let suffix = unary.suffix[suffixIndex];
6352
6371
  if (typeof suffix == "object" && suffix != null && "token" in suffix && suffix.token === "?") {
@@ -6395,7 +6414,7 @@ ${js}`
6395
6414
  prefix,
6396
6415
  suffix: outer,
6397
6416
  children: [prefix, replace, outer]
6398
- })), results2.push(replaceNode(unary, replace, parent));
6417
+ })), results3.push(replaceNode(unary, replace, parent));
6399
6418
  } else if (typeof suffix == "object" && suffix != null && "type" in suffix && suffix.type === "NonNullAssertion") {
6400
6419
  let {} = suffix, m7;
6401
6420
  for (; m7 = unary.suffix[suffixIndex], typeof m7 == "object" && m7 != null && "type" in m7 && m7.type === "NonNullAssertion"; )
@@ -6436,13 +6455,13 @@ ${js}`
6436
6455
  prefix,
6437
6456
  suffix: outer,
6438
6457
  children: [prefix, replace, outer]
6439
- })), results2.push(replaceNode(unary, replace, parent));
6458
+ })), results3.push(replaceNode(unary, replace, parent));
6440
6459
  } else
6441
- results2.push(suffixIndex--);
6460
+ results3.push(suffixIndex--);
6442
6461
  }
6443
- results1.push(results2);
6462
+ results2.push(results3);
6444
6463
  }
6445
- return results1;
6464
+ return results2;
6446
6465
  }
6447
6466
  function processStatementExpressions(statements) {
6448
6467
  for (let ref24 = gatherRecursiveAll(statements, ($14) => $14.type === "StatementExpression"), i13 = 0, len12 = ref24.length; i13 < len12; i13++) {
@@ -6592,12 +6611,12 @@ ${js}`
6592
6611
  index + 1,
6593
6612
  0,
6594
6613
  ...(() => {
6595
- let results3 = [];
6614
+ let results4 = [];
6596
6615
  for (let i16 = 0, len15 = autoBinds.length; i16 < len15; i16++) {
6597
6616
  let [, a] = autoBinds[i16];
6598
- results3.push([indent, ["this.", a.name, " = this.", a.name, ".bind(this)"], ";"]);
6617
+ results4.push([indent, ["this.", a.name, " = this.", a.name, ".bind(this)"], ";"]);
6599
6618
  }
6600
- return results3;
6619
+ return results4;
6601
6620
  })()
6602
6621
  );
6603
6622
  }
@@ -12107,17 +12126,21 @@ ${js}`
12107
12126
  children: modifier ? [modifier, dot] : [dot],
12108
12127
  optional: modifier?.token === "?"
12109
12128
  };
12110
- return id ? {
12111
- type: "PropertyAccess",
12112
- name: id.name,
12113
- dot: start,
12114
- children: [start, "prototype.", id]
12115
- } : {
12116
- type: "PropertyAccess",
12117
- name: "prototype",
12118
- dot: start,
12119
- children: [start, "prototype"]
12120
- };
12129
+ if (id) {
12130
+ let access = id.unicode ? ["prototype[", propertyKey(id), "]"] : ["prototype.", id];
12131
+ return {
12132
+ type: "PropertyAccess",
12133
+ name: id.name,
12134
+ dot: start,
12135
+ children: [start, ...access]
12136
+ };
12137
+ } else
12138
+ return {
12139
+ type: "PropertyAccess",
12140
+ name: "prototype",
12141
+ dot: start,
12142
+ children: [start, "prototype"]
12143
+ };
12121
12144
  })(import_lib2.SKIP, $$loc, $$value, $$value[0], $$value[1], $$value[2], $$value[3]), $$final;
12122
12145
  return $$m !== import_lib2.SKIP && ($$r.value = $$m, $$final = $$r), $$final;
12123
12146
  }
@@ -12189,10 +12212,11 @@ ${js}`
12189
12212
  }
12190
12213
  let $$loc = $$r.loc, $$value = $$r.value, $$m = (function($skip, $loc, $0, $1, $2, $3, $4, $5) {
12191
12214
  var modifier = $1, dot = $3, id = $4, args = $5;
12215
+ let children = id.unicode ? [modifier, modifier?.token === "?" ? dot : null, "[", propertyKey(id), "]"] : [modifier, dot, id];
12192
12216
  return {
12193
12217
  type: "PropertyBind",
12194
12218
  name: id.name,
12195
- children: [modifier, dot, id],
12219
+ children,
12196
12220
  // omit `@` from children
12197
12221
  args: args?.children.slice(1, -1) ?? []
12198
12222
  // remove the parens from the arg list, or give an empty list
@@ -12215,10 +12239,11 @@ ${js}`
12215
12239
  }
12216
12240
  let $$loc = $$r.loc, $$value = $$r.value, $$m = (function($skip, $loc, $0, $1, $2, $3, $4, $5) {
12217
12241
  var modifier = $1, dot = $3, id = $4, args = $5;
12242
+ let children = id.unicode ? [modifier, modifier?.token === "?" ? dot : null, "[", propertyKey(id), "]"] : [modifier, dot, id];
12218
12243
  return {
12219
12244
  type: "PropertyBind",
12220
12245
  name: id.name,
12221
- children: [modifier, dot, id],
12246
+ children,
12222
12247
  // omit `@` from children
12223
12248
  args: args?.children.slice(1, -1) ?? []
12224
12249
  // remove the parens from the arg list, or give an empty list
@@ -14889,28 +14914,28 @@ ${js}`
14889
14914
  }
14890
14915
  let $$loc = $$r.loc, $$value = $$r.value, $$m = (function($skip, $loc, $0, $1, $2) {
14891
14916
  var colon = $1, id = $2;
14892
- let name, token;
14893
- return id.type === "Identifier" ? { name, children: [token] } = id : (name = literalValue({
14917
+ let name, token, quoted;
14918
+ return id.type === "Identifier" ? id.unicode ? (name = id.unicode, token = { $loc: id.children?.[0]?.$loc, token: `"${id.unicode}"` }, quoted = !0) : ({ name, children: [token] } = id, quoted = !1) : (name = literalValue({
14894
14919
  type: "Literal",
14895
14920
  subtype: "StringLiteral",
14896
14921
  raw: id.token,
14897
14922
  children: [id]
14898
- }), token = id), config.symbols.includes(name) ? {
14923
+ }), token = id, quoted = !0), config.symbols.includes(name) ? {
14899
14924
  type: "SymbolLiteral",
14900
- children: id.type === "Identifier" ? [
14901
- { ...colon, token: "Symbol." },
14902
- token
14903
- ] : [
14925
+ children: quoted ? [
14904
14926
  { ...colon, token: "Symbol[" },
14905
14927
  token,
14906
14928
  "]"
14929
+ ] : [
14930
+ { ...colon, token: "Symbol." },
14931
+ token
14907
14932
  ],
14908
14933
  name
14909
14934
  } : {
14910
14935
  type: "SymbolLiteral",
14911
14936
  children: [
14912
14937
  { ...colon, token: "Symbol.for(" },
14913
- id.type === "Identifier" ? ['"', token, '"'] : token,
14938
+ quoted ? token : ['"', token, '"'],
14914
14939
  ")"
14915
14940
  ],
14916
14941
  name