|
| 1 | +# Changelog |
| 2 | + |
| 3 | +## v0.20.0 |
| 4 | + |
| 5 | +This is a large release! The summary is: |
| 6 | + |
| 7 | +- There are several breaking API changes to align our abstractions with the |
| 8 | + underlying QuickJS library. |
| 9 | +- There's a new build variant build with [Emscripten's |
| 10 | + ASYNCIFY](https://emscripten.org/docs/porting/asyncify.html) that allows |
| 11 | + _synchronous_ code _inside_ QuickJS to use _asynchronous_ code running on the |
| 12 | + host. |
| 13 | +- Both build variants have basic support for loading and evaluating EcmaScript |
| 14 | + modules, but only the ASYNCIFY variant can asynchronously load EcmaScript code. |
| 15 | + |
| 16 | +### New features |
| 17 | + |
| 18 | +This release introduces `class QuickJSRuntime`. This class wraps QuickJS's `JSRuntime*` type: |
| 19 | + |
| 20 | +> `JSRuntime` represents a Javascript runtime corresponding to an object heap. |
| 21 | +> Several runtimes can exist at the same time but they cannot exchange objects. |
| 22 | +> Inside a given runtime, no multi-threading is supported. |
| 23 | +
|
| 24 | +- `QuickJSRuntime.newContext` creates a new context inside an existing runtime. |
| 25 | +- `QuickJSRuntime.setModuleLoader` enables EcmaScript module loading. |
| 26 | + |
| 27 | +This release renames `QuickJSVm` to `class QuickJSContext`, and removes some methods. |
| 28 | +The new class wraps QuickJS's `JSContext*` type: |
| 29 | + |
| 30 | +> `JSContext` represents a Javascript context (or Realm). Each JSContext has its |
| 31 | +> own global objects and system objects. There can be several JSContexts per |
| 32 | +> JSRuntime \[...], similar to frames of the same origin |
| 33 | +> sharing Javascript objects in a web browser. |
| 34 | +
|
| 35 | +`QuickJSContext` replaces `QuickJSVm` as the main way to interact with the |
| 36 | +environment inside the QuickJS virtual machine. |
| 37 | + |
| 38 | +- `QuickJSContext.runtime` provides access to a context's parent runtime. |
| 39 | +- `QuickJSContext.evalCode` now takes an options argument to set eval mode |
| 40 | + to `'module'`. |
| 41 | + |
| 42 | +There are also **Asyncified** versions of both `QuickJSRuntime` (`QuickJSRuntimeAsync`) and `QuickJSContext` (`QuickJSContextAsync`). These variants trade some runtime performance for additional features. |
| 43 | + |
| 44 | +- `QuickJSRuntimeAsync.setModuleLoader` accepts module loaders that return |
| 45 | + `Promise<string>`. |
| 46 | +- `QuickJSContextAsync.newAsyncifiedFunction` allows creating async functions that |
| 47 | + act like sync functions inside the VM. |
| 48 | + |
| 49 | +### Breaking changes |
| 50 | + |
| 51 | +**`class QuickJSVm` is removed**. Most functionality is available on |
| 52 | +`QuickJSContext`, with identical function signatures. Functionality related to |
| 53 | +runtime limits, memory limits, and pending jobs moved to `QuickJSRuntime`. |
| 54 | + |
| 55 | +**Migration guide**: |
| 56 | + |
| 57 | +1. Replace usages with QuickJSContext. |
| 58 | +2. Replace the following methods: |
| 59 | + - `vm.hasPendingJob` -> `context.runtime.hasPendingJob` |
| 60 | + - `vm.setInterruptHandler` -> `context.runtime.setInterruptHandler` |
| 61 | + - `vm.removeInterruptHandler` -> `context.runtime.removeInterruptHandler` |
| 62 | + - `vm.executePendingJobs` -> `context.runtime.executePendingJobs` |
| 63 | + - `vm.setMemoryLimit` -> `context.runtime.setMemoryLimit` |
| 64 | + - `vm.computeMemoryUsage` -> `context.runtime.computeMemoryUsage` |
| 65 | + |
| 66 | +**`QuickJS.createVm()` is removed.** |
| 67 | + |
| 68 | +**Migration guide**: use `QuickJS.newContext()` instead. |
| 69 | + |
| 70 | +## v0.15.0 |
| 71 | + |
| 72 | +This is the last version containing `class QuickJSVm` and constructor |
| 73 | +`QuickJS.createVm()`. |
0 commit comments