Release history
JSLike, a CSP-Safe Interpreter for JS, TS, JSX, TSX in JS releases
All releases
11 shown
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
superfor 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 constructorsuper(...)compatibility.
Verification
npm run buildpassed. Existingwang-prismCommonJS warning remains unchanged.npm test:54 passed,1359 passed | 4 skipped.- Issue #13 repro returns
base. npm pack --dry-runproducedjslike-1.8.5.tgz.- Published to npm as
[email protected]withlatestdist-tag.
Fixes #13.
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 buildpassed. Existingwang-prismCommonJS warning remains unchanged.npm test:54 passed,1351 passed | 4 skipped.- Issue #12 repro shape returns
HiHi!. npm pack --dry-runproducedjslike-1.8.4.tgz.- Published to npm as
[email protected]withlatestdist-tag.
Fixes #12.
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 buildpassed. Existingwang-prismCommonJS 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-runproducedjslike-1.8.3.tgz.- Published to npm as
[email protected]withlatestdist-tag.
Fixes #11.
Fixed missing-method errors when reflection traps throw during method suggestion collection.
Full changelog
Fixed
- Prevent enhanced method suggestions from invoking strict function
caller/argumentsaccessors 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 buildpassed. Existingwang-prismCommonJS warning remains unchanged.npm test:52 passed,1336 passed | 4 skipped.npm pack --dry-runproducedjslike-1.8.2.tgz.- Published to npm as
[email protected]withlatestdist-tag.
Fixes #10.
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 buildpassed. Existingwang-prismCommonJS warning remains unchanged.npm test:52 passed,1332 passed | 4 skipped.- Corrected issue #9 repro against
dist/index.cjsreturns7. - Published to npm as
[email protected]withlatestdist-tag.
Fixes #9.
- 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, andtsxexecution 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
pathas theirfromPath. - 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
.tsimport repro againstdist/index.cjs. - Published to npm as
[email protected]withlatestdist-tag.
Fixes #8.
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.
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()whereinnerTextisnull/undefinednow correctly returnsundefinedinstead of throwing a nativeTypeError. 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
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
isArrowflag to function metadata to distinguish arrow functions - Capture
thisfrom enclosing scope when arrow function is created - Use captured
thisfor arrow functions, ignoring call-sitethis - Add comprehensive test suite for arrow function
thisbinding (6 tests)
Issues Closed
- #3 -
thisbinding 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
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
SpreadElementhandler toevaluateAsync()that returns spread markers - Updated
CallExpressionargument handling to useflattenSpreadArgs() - Added
abortSignalpassthrough inWangInterpreterfor 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