@danielx/civet 0.6.77 → 0.6.78

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
@@ -1432,16 +1432,15 @@ var Civet = (() => {
1432
1432
  switch (node.type) {
1433
1433
  case "BlockStatement":
1434
1434
  if (node.expressions.length) {
1435
- const last = node.expressions[node.expressions.length - 1];
1436
- insertPush(last, ref);
1435
+ insertPush(node.expressions.at(-1), ref);
1437
1436
  } else {
1438
1437
  node.expressions.push([ref, ".push(void 0);"]);
1439
1438
  }
1440
1439
  return;
1441
1440
  case "CaseBlock":
1442
- node.clauses.forEach((clause) => ({
1443
- insertPush: insertPush(clause, ref)
1444
- }));
1441
+ node.clauses.forEach((clause) => {
1442
+ return insertPush(clause, ref);
1443
+ });
1445
1444
  return;
1446
1445
  case "WhenClause":
1447
1446
  insertPush(node.block, ref);
@@ -1490,8 +1489,8 @@ var Civet = (() => {
1490
1489
  return;
1491
1490
  case "IfStatement":
1492
1491
  insertPush(exp.then, ref);
1493
- if (exp.then.bare) {
1494
- exp.then.children.push(";");
1492
+ if (exp.then.bare && !exp.then.semicolon) {
1493
+ exp.then.children.push(exp.then.semicolon = ";");
1495
1494
  }
1496
1495
  if (exp.else)
1497
1496
  insertPush(exp.else[2], ref);
@@ -2468,11 +2467,10 @@ var Civet = (() => {
2468
2467
  const { else: e } = s;
2469
2468
  const block = blockWithPrefix(condition.expression.blockPrefix, s.then);
2470
2469
  s.then = block;
2471
- const toAdd = [block];
2472
- if (block.bare && e) {
2473
- toAdd.push(";");
2470
+ if (block.bare && e && !block.semicolon) {
2471
+ block.children.push(block.semicolon = ";");
2474
2472
  }
2475
- s.children.splice(2, 1, ...toAdd);
2473
+ s.children.splice(2, 1, block);
2476
2474
  updateParentPointers(block, s);
2477
2475
  break;
2478
2476
  }
package/dist/civet CHANGED
@@ -347,7 +347,7 @@ async function cli() {
347
347
  };
348
348
  (unpluginOptions.parseOptions ??= {}).rewriteCivetImports = ".civet.tsx";
349
349
  unplugin = (0, import_unplugin.rawPlugin)(unpluginOptions, { framework: "civet-cli" });
350
- unplugin.buildStart();
350
+ await unplugin.buildStart();
351
351
  }
352
352
  if (options.run) {
353
353
  options.js = true;
package/dist/main.js CHANGED
@@ -1424,16 +1424,15 @@ function insertPush(node, ref) {
1424
1424
  switch (node.type) {
1425
1425
  case "BlockStatement":
1426
1426
  if (node.expressions.length) {
1427
- const last = node.expressions[node.expressions.length - 1];
1428
- insertPush(last, ref);
1427
+ insertPush(node.expressions.at(-1), ref);
1429
1428
  } else {
1430
1429
  node.expressions.push([ref, ".push(void 0);"]);
1431
1430
  }
1432
1431
  return;
1433
1432
  case "CaseBlock":
1434
- node.clauses.forEach((clause) => ({
1435
- insertPush: insertPush(clause, ref)
1436
- }));
1433
+ node.clauses.forEach((clause) => {
1434
+ return insertPush(clause, ref);
1435
+ });
1437
1436
  return;
1438
1437
  case "WhenClause":
1439
1438
  insertPush(node.block, ref);
@@ -1482,8 +1481,8 @@ function insertPush(node, ref) {
1482
1481
  return;
1483
1482
  case "IfStatement":
1484
1483
  insertPush(exp.then, ref);
1485
- if (exp.then.bare) {
1486
- exp.then.children.push(";");
1484
+ if (exp.then.bare && !exp.then.semicolon) {
1485
+ exp.then.children.push(exp.then.semicolon = ";");
1487
1486
  }
1488
1487
  if (exp.else)
1489
1488
  insertPush(exp.else[2], ref);
@@ -2460,11 +2459,10 @@ function processDeclarationConditionStatement(s) {
2460
2459
  const { else: e } = s;
2461
2460
  const block = blockWithPrefix(condition.expression.blockPrefix, s.then);
2462
2461
  s.then = block;
2463
- const toAdd = [block];
2464
- if (block.bare && e) {
2465
- toAdd.push(";");
2462
+ if (block.bare && e && !block.semicolon) {
2463
+ block.children.push(block.semicolon = ";");
2466
2464
  }
2467
- s.children.splice(2, 1, ...toAdd);
2465
+ s.children.splice(2, 1, block);
2468
2466
  updateParentPointers(block, s);
2469
2467
  break;
2470
2468
  }
package/dist/main.mjs CHANGED
@@ -1422,16 +1422,15 @@ function insertPush(node, ref) {
1422
1422
  switch (node.type) {
1423
1423
  case "BlockStatement":
1424
1424
  if (node.expressions.length) {
1425
- const last = node.expressions[node.expressions.length - 1];
1426
- insertPush(last, ref);
1425
+ insertPush(node.expressions.at(-1), ref);
1427
1426
  } else {
1428
1427
  node.expressions.push([ref, ".push(void 0);"]);
1429
1428
  }
1430
1429
  return;
1431
1430
  case "CaseBlock":
1432
- node.clauses.forEach((clause) => ({
1433
- insertPush: insertPush(clause, ref)
1434
- }));
1431
+ node.clauses.forEach((clause) => {
1432
+ return insertPush(clause, ref);
1433
+ });
1435
1434
  return;
1436
1435
  case "WhenClause":
1437
1436
  insertPush(node.block, ref);
@@ -1480,8 +1479,8 @@ function insertPush(node, ref) {
1480
1479
  return;
1481
1480
  case "IfStatement":
1482
1481
  insertPush(exp.then, ref);
1483
- if (exp.then.bare) {
1484
- exp.then.children.push(";");
1482
+ if (exp.then.bare && !exp.then.semicolon) {
1483
+ exp.then.children.push(exp.then.semicolon = ";");
1485
1484
  }
1486
1485
  if (exp.else)
1487
1486
  insertPush(exp.else[2], ref);
@@ -2458,11 +2457,10 @@ function processDeclarationConditionStatement(s) {
2458
2457
  const { else: e } = s;
2459
2458
  const block = blockWithPrefix(condition.expression.blockPrefix, s.then);
2460
2459
  s.then = block;
2461
- const toAdd = [block];
2462
- if (block.bare && e) {
2463
- toAdd.push(";");
2460
+ if (block.bare && e && !block.semicolon) {
2461
+ block.children.push(block.semicolon = ";");
2464
2462
  }
2465
- s.children.splice(2, 1, ...toAdd);
2463
+ s.children.splice(2, 1, block);
2466
2464
  updateParentPointers(block, s);
2467
2465
  break;
2468
2466
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@danielx/civet",
3
3
  "type": "commonjs",
4
- "version": "0.6.77",
4
+ "version": "0.6.78",
5
5
  "description": "CoffeeScript style syntax for TypeScript",
6
6
  "main": "dist/main.js",
7
7
  "module": "dist/main.mjs",