rip-lang 1.3.11 → 1.3.12

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
@@ -5,6 +5,18 @@ All notable changes to Rip will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.3.12] - 2025-11-07
9
+
10
+ ### Changed
11
+ - **Cleaner output in delimited contexts** (#44) - Removed redundant outer parens
12
+ - Function args: `fn((expr))` → `fn(expr)`
13
+ - Assignments: `x = (value)` → `x = value`
14
+ - Array indices: `arr[(index)]` → `arr[index]`
15
+ - Applied unwrap() in contexts that already provide delimiters
16
+ - Safety preserved: `arr[len - (x || 1)]` keeps inner parens ✅
17
+ - Object literals still protected
18
+ - Test count: 913 → 922 (+9 tests)
19
+
8
20
  ## [1.3.11] - 2025-11-07
9
21
 
10
22
  ### Fixed
package/README.md CHANGED
@@ -9,9 +9,9 @@
9
9
  </p>
10
10
 
11
11
  <p align="center">
12
- <a href="CHANGELOG.md"><img src="https://img.shields.io/badge/version-1.3.0-blue.svg" alt="Version"></a>
12
+ <a href="CHANGELOG.md"><img src="https://img.shields.io/badge/version-1.3.12-blue.svg" alt="Version"></a>
13
13
  <a href="#es2022-target"><img src="https://img.shields.io/badge/target-ES2022-blue.svg" alt="Target"></a>
14
- <a href="#current-status"><img src="https://img.shields.io/badge/tests-878%2F878-brightgreen.svg" alt="Tests"></a>
14
+ <a href="#current-status"><img src="https://img.shields.io/badge/tests-922%2F922-brightgreen.svg" alt="Tests"></a>
15
15
  <a href="#current-status"><img src="https://img.shields.io/badge/coverage-100%25-brightgreen.svg" alt="Coverage"></a>
16
16
  <a href="#zero-dependencies"><img src="https://img.shields.io/badge/dependencies-ZERO-brightgreen.svg" alt="Dependencies"></a>
17
17
  <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-green.svg" alt="License"></a>
@@ -3604,7 +3604,7 @@ class CodeGenerator {
3604
3604
  if (Array.isArray(call)) {
3605
3605
  const [constructor, ...args] = call;
3606
3606
  const constructorCode = this.generate(constructor, "value");
3607
- const argsCode = args.map((arg) => this.generate(arg, "value")).join(", ");
3607
+ const argsCode = args.map((arg) => this.unwrap(this.generate(arg, "value"))).join(", ");
3608
3608
  return `new ${constructorCode}(${argsCode})`;
3609
3609
  }
3610
3610
  return `new ${this.generate(call, "value")}()`;
@@ -3778,7 +3778,11 @@ class CodeGenerator {
3778
3778
  } else {
3779
3779
  targetCode = this.generate(target, "value");
3780
3780
  }
3781
- const valueCode = this.generate(value, "value");
3781
+ let valueCode = this.generate(value, "value");
3782
+ const isObjectLiteral = Array.isArray(value) && value[0] === "object";
3783
+ if (!isObjectLiteral) {
3784
+ valueCode = this.unwrap(valueCode);
3785
+ }
3782
3786
  const needsParensForValue = context === "value";
3783
3787
  const needsParensForObject = context === "statement" && Array.isArray(target) && target[0] === "object";
3784
3788
  if (needsParensForValue || needsParensForObject) {
@@ -3923,7 +3927,8 @@ class CodeGenerator {
3923
3927
  }
3924
3928
  }
3925
3929
  }
3926
- return `${this.generate(arr, "value")}[${this.generate(index, "value")}]`;
3930
+ const indexCode = this.unwrap(this.generate(index, "value"));
3931
+ return `${this.generate(arr, "value")}[${indexCode}]`;
3927
3932
  }
3928
3933
  case "?[]": {
3929
3934
  const [arr, index] = rest;
@@ -4979,7 +4984,7 @@ ${this.indent()}}`;
4979
4984
  }
4980
4985
  return "super";
4981
4986
  }
4982
- const argsCode = rest.map((arg) => this.generate(arg, "value")).join(", ");
4987
+ const argsCode = rest.map((arg) => this.unwrap(this.generate(arg, "value"))).join(", ");
4983
4988
  if (this.currentMethodName && this.currentMethodName !== "constructor") {
4984
4989
  return `super.${this.currentMethodName}(${argsCode})`;
4985
4990
  }
@@ -4992,7 +4997,7 @@ ${this.indent()}}`;
4992
4997
  return `(typeof ${fnCode} === 'function' ? ${fnCode}(${argsCode}) : undefined)`;
4993
4998
  }
4994
4999
  case "?super": {
4995
- const argsCode = rest.map((arg) => this.generate(arg, "value")).join(", ");
5000
+ const argsCode = rest.map((arg) => this.unwrap(this.generate(arg, "value"))).join(", ");
4996
5001
  if (this.currentMethodName && this.currentMethodName !== "constructor") {
4997
5002
  return `(typeof super.${this.currentMethodName} === 'function' ? super.${this.currentMethodName}(${argsCode}) : undefined)`;
4998
5003
  }
@@ -5160,7 +5165,7 @@ export default ${target}`;
5160
5165
  return head;
5161
5166
  }
5162
5167
  if (head === "super" && this.currentMethodName && this.currentMethodName !== "constructor") {
5163
- const args2 = rest.map((arg) => this.generate(arg, "value")).join(", ");
5168
+ const args2 = rest.map((arg) => this.unwrap(this.generate(arg, "value"))).join(", ");
5164
5169
  return `super.${this.currentMethodName}(${args2})`;
5165
5170
  }
5166
5171
  const findPostfixConditional = (expr) => {
@@ -5206,7 +5211,7 @@ export default ${target}`;
5206
5211
  }
5207
5212
  const needsAwait = headAwaitMetadata === true;
5208
5213
  const calleeName = this.generate(head, "value");
5209
- const args = rest.map((arg) => this.generate(arg, "value")).join(", ");
5214
+ const args = rest.map((arg) => this.unwrap(this.generate(arg, "value"))).join(", ");
5210
5215
  const callStr = `${calleeName}(${args})`;
5211
5216
  return needsAwait ? `await ${callStr}` : callStr;
5212
5217
  }
@@ -5294,7 +5299,7 @@ export default ${target}`;
5294
5299
  } else {
5295
5300
  calleeCode = this.generate(head, "value");
5296
5301
  }
5297
- const args = rest.map((arg) => this.generate(arg, "value")).join(", ");
5302
+ const args = rest.map((arg) => this.unwrap(this.generate(arg, "value"))).join(", ");
5298
5303
  const callStr = `${calleeCode}(${args})`;
5299
5304
  return needsAwait ? `await ${callStr}` : callStr;
5300
5305
  }
@@ -6876,8 +6881,8 @@ function compileToJS(source, options = {}) {
6876
6881
  return compiler.compileToJS(source);
6877
6882
  }
6878
6883
  // src/browser.js
6879
- var VERSION = "1.3.11";
6880
- var BUILD_DATE = "2025-11-07@00:29:40GMT";
6884
+ var VERSION = "1.3.12";
6885
+ var BUILD_DATE = "2025-11-07@03:05:08GMT";
6881
6886
  var dedent = (s) => {
6882
6887
  const m = s.match(/^[ \t]*(?=\S)/gm);
6883
6888
  const i = Math.min(...(m || []).map((x) => x.length));