Socket
Socket
Sign inDemoInstall

quickjs-emscripten

Package Overview
Dependencies
Maintainers
1
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

quickjs-emscripten - npm Package Versions

1
6

0.21.0

Diff

Changelog

Source

v0.21.0

  • #61 (thanks to @torywheelwright):
    • Add QuickJSRuntime.setMaxStackSize(stackSizeBytes) to protect against stack overflows.
    • Add option maxStackSizeBytes when creating runtimes.
  • Change default branch master to main.
  • Add option memoryLimitBytes when creating runtimes.
jitl
published 0.20.0 •

Changelog

Source

v0.20.0

This is a large release! The summary is:

  • There are several breaking API changes to align our abstractions with the underlying QuickJS library.
  • There's a new build variant build with Emscripten's ASYNCIFY that allows synchronous code inside QuickJS to use asynchronous code running on the host.
  • Both build variants have basic support for loading and evaluating EcmaScript modules, but only the ASYNCIFY variant can asynchronously load EcmaScript code.

New features

This release introduces class QuickJSRuntime. This class wraps QuickJS's JSRuntime* type:

JSRuntime represents a Javascript runtime corresponding to an object heap. Several runtimes can exist at the same time but they cannot exchange objects. Inside a given runtime, no multi-threading is supported.

  • QuickJSRuntime.newContext creates a new context inside an existing runtime.
  • QuickJSRuntime.setModuleLoader enables EcmaScript module loading.

This release renames QuickJSVm to class QuickJSContext, and removes some methods. The new class wraps QuickJS's JSContext* type:

JSContext represents a Javascript context (or Realm). Each JSContext has its own global objects and system objects. There can be several JSContexts per JSRuntime [...], similar to frames of the same origin sharing Javascript objects in a web browser.

QuickJSContext replaces QuickJSVm as the main way to interact with the environment inside the QuickJS virtual machine.

  • QuickJSContext.runtime provides access to a context's parent runtime.
  • QuickJSContext.evalCode now takes an options argument to set eval mode to 'module'.

There are also Asyncified versions of both QuickJSRuntime (QuickJSRuntimeAsync) and QuickJSContext (QuickJSContextAsync). These variants trade some runtime performance for additional features.

  • QuickJSRuntimeAsync.setModuleLoader accepts module loaders that return Promise<string>.
  • QuickJSContextAsync.newAsyncifiedFunction allows creating async functions that act like sync functions inside the VM.

Breaking changes

class QuickJSVm is removed. Most functionality is available on QuickJSContext, with identical function signatures. Functionality related to runtime limits, memory limits, and pending jobs moved to QuickJSRuntime.

Migration guide:

  1. Replace usages with QuickJSContext.
  2. Replace the following methods:
    • vm.hasPendingJob -> context.runtime.hasPendingJob
    • vm.setInterruptHandler -> context.runtime.setInterruptHandler
    • vm.removeInterruptHandler -> context.runtime.removeInterruptHandler
    • vm.executePendingJobs -> context.runtime.executePendingJobs
    • vm.setMemoryLimit -> context.runtime.setMemoryLimit
    • vm.computeMemoryUsage -> context.runtime.computeMemoryUsage

QuickJS.createVm() is removed.

Migration guide: use QuickJS.newContext() instead.

jitl
published 0.20.0-beta.0 •

jitl
published 0.15.0 •

Changelog

Source

v0.15.0

This is the last version containing class QuickJSVm and constructor QuickJS.createVm().

jitl
published 0.14.0 •

jitl
published 0.13.0 •

jitl
published 0.12.0 •

jitl
published 0.11.1 •

jitl
published 0.11.0 •

jitl
published 0.10.0 •

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc