rip-lang 3.13.124 → 3.13.125

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/README.md CHANGED
@@ -9,7 +9,7 @@
9
9
  </p>
10
10
 
11
11
  <p align="center">
12
- <a href="CHANGELOG.md"><img src="https://img.shields.io/badge/version-3.13.124-blue.svg" alt="Version"></a>
12
+ <a href="CHANGELOG.md"><img src="https://img.shields.io/badge/version-3.13.125-blue.svg" alt="Version"></a>
13
13
  <a href="#zero-dependencies"><img src="https://img.shields.io/badge/dependencies-ZERO-brightgreen.svg" alt="Dependencies"></a>
14
14
  <a href="#"><img src="https://img.shields.io/badge/tests-1%2C436%2F1%2C436-brightgreen.svg" alt="Tests"></a>
15
15
  <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-green.svg" alt="License"></a>
package/docs/dist/rip.js CHANGED
@@ -2565,7 +2565,10 @@
2565
2565
  if (tag === "THEN")
2566
2566
  indent.fromThen = true;
2567
2567
  tokens.splice(i + 1, 0, indent);
2568
- this.detectEnd(i + 2, condition, action);
2568
+ if (tag === "THEN" && this.singleLineOwner(i) === "LEADING_WHEN")
2569
+ this.detectWhenThenEnd(i + 2, condition, action);
2570
+ else
2571
+ this.detectEnd(i + 2, condition, action);
2569
2572
  if (tag === "THEN")
2570
2573
  tokens.splice(i, 1);
2571
2574
  return 1;
@@ -2573,6 +2576,41 @@
2573
2576
  return 1;
2574
2577
  });
2575
2578
  }
2579
+ singleLineOwner(i) {
2580
+ let starters = new Set(["LEADING_WHEN", "IF", "POST_IF", "UNLESS", "POST_UNLESS", "ELSE", "CATCH", "TRY", "FINALLY", "->", "=>"]);
2581
+ for (let j = i - 1;j >= 0; j--) {
2582
+ let token = this.tokens[j];
2583
+ let tag = token?.[0];
2584
+ if (starters.has(tag))
2585
+ return tag;
2586
+ if (LINE_BREAK.has(tag) || token?.newLine)
2587
+ return null;
2588
+ }
2589
+ return null;
2590
+ }
2591
+ detectWhenThenEnd(i, condition, action) {
2592
+ let levels = 0;
2593
+ let nestedInlineBranches = 0;
2594
+ while (i < this.tokens.length) {
2595
+ let token = this.tokens[i];
2596
+ let tag = token[0];
2597
+ if (levels === 0) {
2598
+ if (tag === "THEN" && this.singleLineOwner(i) !== "LEADING_WHEN")
2599
+ nestedInlineBranches++;
2600
+ else if (tag === "ELSE" && nestedInlineBranches > 0)
2601
+ nestedInlineBranches--;
2602
+ else if (condition.call(this, token, i))
2603
+ return action.call(this, token, i);
2604
+ }
2605
+ if (EXPRESSION_START.has(tag))
2606
+ levels++;
2607
+ if (EXPRESSION_END.has(tag))
2608
+ levels--;
2609
+ if (levels < 0)
2610
+ return action.call(this, token, i);
2611
+ i++;
2612
+ }
2613
+ }
2576
2614
  tagPostfixConditionals() {
2577
2615
  let original = null;
2578
2616
  let condition = (token, i) => {
@@ -9950,8 +9988,8 @@ globalThis.zip ??= (...a) => a[0].map((_, i) => a.map(b => b[i]));
9950
9988
  return new CodeGenerator({}).getComponentRuntime();
9951
9989
  }
9952
9990
  // src/browser.js
9953
- var VERSION = "3.13.124";
9954
- var BUILD_DATE = "2026-03-18@23:34:16GMT";
9991
+ var VERSION = "3.13.125";
9992
+ var BUILD_DATE = "2026-03-19@00:54:22GMT";
9955
9993
  if (typeof globalThis !== "undefined") {
9956
9994
  if (!globalThis.__rip)
9957
9995
  new Function(getReactiveRuntime())();