Skip to content

Release history

JSLike, a CSP-Safe Interpreter for JS, TS, JSX, TSX in JS releases

All releases

10 shown

v1.8.5 Bug fix

Fixed support for super.method() calls in arrow-function class fields on derived classes.

Full changelog

Fixed

  • Support super.method() inside arrow-function class fields on derived classes.
  • Bind super for prototype methods and class field initializers to parent prototype members with the derived instance as receiver.
  • Cover computed super[...]() calls, async parent methods, multi-level inheritance chains, and constructor super(...) compatibility.

Verification

  • npm run build passed. Existing wang-prism CommonJS warning remains unchanged.
  • npm test: 54 passed, 1359 passed | 4 skipped.
  • Issue #13 repro returns base.
  • npm pack --dry-run produced jslike-1.8.5.tgz.
  • Published to npm as [email protected] with latest dist-tag.

Fixes #13.

v1.8.4 Bug fix

Fixed binding of identifiers from defaulted object and array destructuring parameters.

Full changelog

Fixed

  • Bind identifiers from defaulted object and array destructuring parameters in functions, async callbacks, methods, and constructors.
  • Preserve nested destructuring defaults and rest parameter behavior through shared parameter binding logic.

Verification

  • npm run build passed. Existing wang-prism CommonJS warning remains unchanged.
  • npm test: 54 passed, 1351 passed | 4 skipped.
  • Issue #12 repro shape returns HiHi!.
  • npm pack --dry-run produced jslike-1.8.4.tgz.
  • Published to npm as [email protected] with latest dist-tag.

Fixes #12.

v1.8.3 Bug fix

Fixed JavaScript class instance field initialization across inheritance hierarchies.

Full changelog

Fixed

  • Initialize JavaScript class instance fields, including arrow function fields that capture this.
  • Apply inherited base class field initializers during super(...) and implicit subclass construction.
  • Preserve native class-field initialization order across base constructors, derived fields, computed fields, and multi-level inheritance.

Verification

  • npm run build passed. Existing wang-prism CommonJS warning remains unchanged.
  • npm test: 53 passed, 1344 passed | 4 skipped.
  • Issue #11 repro returns {"type":"function","value":42,"keys":["visit","v"]}.
  • npm pack --dry-run produced jslike-1.8.3.tgz.
  • Published to npm as [email protected] with latest dist-tag.

Fixes #11.

v1.8.2 Bug fix

Fixed missing-method errors when reflection traps throw during method suggestion collection.

Full changelog

Fixed

  • Prevent enhanced method suggestions from invoking strict function caller / arguments accessors or other throwing accessor properties while constructing missing-method errors.
  • Keep missing-method errors best-effort when reflection traps throw during method suggestion collection.

Verification

  • npm run build passed. Existing wang-prism CommonJS warning remains unchanged.
  • npm test: 52 passed, 1336 passed | 4 skipped.
  • npm pack --dry-run produced jslike-1.8.2.tgz.
  • Published to npm as [email protected] with latest dist-tag.

Fixes #10.

v1.8.1 Bug fix

Fixed handling of mixed import bindings preserving runtime values.

Full changelog

Fixed

  • Elide regular TypeScript imports whose local bindings are used only in type positions, matching TypeScript transpilation behavior.
  • Preserve runtime binding for mixed imports, default imports, namespace imports, and TSX component imports when they are referenced in value positions.

Verification

  • npm run build passed. Existing wang-prism CommonJS warning remains unchanged.
  • npm test: 52 passed, 1332 passed | 4 skipped.
  • Corrected issue #9 repro against dist/index.cjs returns 7.
  • Published to npm as [email protected] with latest dist-tag.

Fixes #9.

v1.8.0 New feature
Notable features
  • Added TypeScript and TSX parsing for entry code and imported modules via bundled @sveltejs/acorn-typescript.
  • Runtime support for TypeScript erasure semantics (type aliases, interfaces, annotations, etc.).
  • Runtime support for TypeScript enums and constructor parameter properties.
Full changelog

Added

  • TypeScript and TSX parsing for entry code and imported modules via bundled @sveltejs/acorn-typescript.
  • Runtime support for TypeScript erasure semantics: type aliases, interfaces, declare, annotations, type-only imports/exports, type assertions, as, satisfies, non-null assertions, and generic call syntax.
  • Runtime support for TypeScript enums and constructor parameter properties.
  • sourcePath, typescript, and tsx execution options for parser selection and import context.

Fixed

  • Static imports now pass importer context to moduleResolver.resolve(modulePath, fromPath).
  • Nested imports use the resolved module path as their fromPath.
  • Module caching now uses resolved paths to avoid relative import collisions while preserving repeated bare-import caching.

Verification

  • npm test: 52 passed, 1324 passed | 4 skipped.
  • Verified the original .ts import repro against dist/index.cjs.
  • Published to npm as [email protected] with latest dist-tag.

Fixes #8.

v1.7.3 Bug fix

Fixed Promise instance method chaining and receiver preservation bugs.

Full changelog

Fixes

  • Fix Promise instance method chaining inside WangInterpreter async evaluation.
  • Preserve Promise receivers for direct chains, stored variables, assignments, object properties, conditionals, logical expressions, and sequence expressions.
  • Add deeper regression coverage for Playwright-style patterns such as await page.locator(selector).isVisible().catch(() => false).

Verification

  • npx vitest run: 48 files passed, 1261 tests passed, 4 skipped.
v1.7.2 Bug fix

Fixed optional chaining on method calls so nullish callee returns undefined instead of throwing TypeError.

Full changelog

Bug Fix

  • fix: Optional chaining in CallExpression callee (#6) — el.innerText?.trim() where innerText is null/undefined now correctly returns undefined instead of throwing a native TypeError. Fixed in both sync and async evaluation paths.

Details

When optional chaining (?.) was used on a method call like obj?.method(), the interpreter attempted to access thisContext[prop] before checking if thisContext was nullish, causing a native TypeError to bypass the optional chaining guard.

The fix adds a node.callee.optional guard before property access in both evaluateCallExpression and the async CallExpression handler in evaluateAsync.

Full Changelog: https://github.com/artpar/jslike/compare/v1.7.1...v1.7.2

v1.7.1 Bug fix

Fixed arrow functions now correctly capture lexical `this` instead of using the call‑site `this`.

Full changelog

Bug Fixes

Arrow Function Lexical this Binding (#3, #2)

Arrow functions now correctly capture this from their lexical enclosing scope at definition time, rather than receiving this from the call site.

Before (broken):

const obj = {
  name: 'Test',
  method() {
    setTimeout(() => {
      console.log(this.name);  // undefined - this was lost!
    }, 100);
  }
};

After (fixed):

const obj = {
  name: 'Test', 
  method() {
    setTimeout(() => {
      console.log(this.name);  // 'Test' - this is captured correctly!
    }, 100);
  }
};

Changes

  • Add isArrow flag to function metadata to distinguish arrow functions
  • Capture this from enclosing scope when arrow function is created
  • Use captured this for arrow functions, ignoring call-site this
  • Add comprehensive test suite for arrow function this binding (6 tests)

Issues Closed

  • #3 - this binding lost in arrow function inside setTimeout callback
  • #2 - setTimeout callback loses closure references to event objects

Full Changelog: https://github.com/artpar/jslike/compare/v1.7.0...v1.7.1

v1.6.3 Bug fix

Fixed a critical bug where `evaluateAsync` failed to handle SpreadElement nodes in async contexts.

Full changelog

Bug Fix

Fixed a critical bug where the evaluateAsync function was missing a handler for SpreadElement AST nodes, causing workflow failures when LLM-generated code used spread syntax (...) in async contexts.

Error Fixed

Error: Unhandled node type in evaluateAsync: SpreadElement

What's Fixed

Spread syntax now works correctly in all async contexts:

// Function calls with spread
const nums = await fetchNumbers();
const sum = await asyncSum(...nums);

// Method calls with spread
await obj.process(...args);

// Constructor calls with spread
const instance = new MyClass(...await getConfig());

// Array/object literals with await
const combined = [...existingData, ...newData];
const merged = { ...defaults, ...await getOverrides() };

Changes

  • Added SpreadElement handler to evaluateAsync() that returns spread markers
  • Updated CallExpression argument handling to use flattenSpreadArgs()
  • Added abortSignal passthrough in WangInterpreter for cancellation support
  • Added comprehensive async spread test suite (53 tests)

Test Coverage

  • 53 new async-specific spread tests
  • All 1086 existing tests pass
  • Zero regressions

Full Changelog: https://github.com/artpar/jslike/compare/v1.6.2...v1.6.3

Beta — feedback welcome: [email protected]