quickjs-emscripten
Advanced tools
Comparing version 0.1.1 to 0.1.2
{ | ||
"name": "quickjs-emscripten", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"main": "dist/quickjs.js", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
# quickjs-emscripten | ||
`quickjs-emscripten` wraps [QuickJS, a modern Javascript interpreter written in | ||
C](https://bellard.org/quickjs/) for usage from Javascript. This allows | ||
evaluating untrusted Javascript safely, or even building a plugin system for | ||
untrusted code. | ||
Javascript/Typescript bindings for [QuickJS, a modern Javascript interpreter written in | ||
C by Fabrice Bellard](https://bellard.org/quickjs/). | ||
* Safely evaluate untrusted Javascript (up to ES2020). | ||
* Create and manipulate values inside the QuickJS runtime. | ||
* Expose host functions to the QuickJS runtime. | ||
```typescript | ||
import { getInstance } from 'quickjs-emscripten' | ||
import { getQuickJS } from 'quickjs-emscripten' | ||
async function main() { | ||
const QuickJS = await getInstance() | ||
const QuickJS = await getQuickJS() | ||
const vm = QuickJS.createVm() | ||
@@ -34,4 +36,2 @@ | ||
[API Documentation](https://github.com/justjake/quickjs-emscripten/blob/master/doc/globals.md) | [Examples](https://github.com/justjake/quickjs-emscripten/blob/master/ts/quickjs.test.ts) | ||
## Usage | ||
@@ -80,2 +80,7 @@ | ||
### More Documentation | ||
* [API Documentation](https://github.com/justjake/quickjs-emscripten/blob/master/doc/globals.md) | ||
* [Examples](https://github.com/justjake/quickjs-emscripten/blob/master/ts/quickjs.test.ts) | ||
## Background | ||
@@ -87,10 +92,14 @@ | ||
- [How [Figma] built the Figma plugin system](https://www.figma.com/blog/how-we-built-the-figma-plugin-system/): Describes the LowLevelJavascriptVm interface. | ||
- [How Figma built the Figma plugin system](https://www.figma.com/blog/how-we-built-the-figma-plugin-system/): Describes the LowLevelJavascriptVm interface. | ||
- [An update on plugin security](https://www.figma.com/blog/an-update-on-plugin-security/): Figma switches to QuickJS. | ||
## Status | ||
## Status & TODOs | ||
**Beta**. There [are tests](https://github.com/justjake/quickjs-emscripten/blob/master/ts/quickjs.test.ts), but I haven't built anything | ||
on top of this. | ||
Both the original project quickjs and this project are still in the early stage | ||
of development. | ||
There [are tests](https://github.com/justjake/quickjs-emscripten/blob/master/ts/quickjs.test.ts), but I haven't built anything | ||
on top of this. Please use this project carefully in a production | ||
environment. | ||
Ideas for future work: | ||
@@ -103,3 +112,6 @@ | ||
- Pools, etc, should not pollute QuickJSVm interface. Composition! | ||
- Expose QuickJS interpreter execution hooks to protect against infinite loops. | ||
- quickjs-emscripten only exposes a small subset of the QuickJS APIs. Add more QuickJS bindings! | ||
- Expose the QuickJS interpreter execution hooks to protect against infinite loops. | ||
- Expose tools for object and array iteration and creation. | ||
- Stretch goals: class support, an event emitter bridge implementation | ||
- Higher-level abstractions for translating values into (and out of) QuickJS. | ||
@@ -111,2 +123,3 @@ These should be implemented in a way that works for any `LowLevelJavascriptVm` | ||
methods async - so they wait for the module instance to be ready. | ||
- Run quickjs-emscripten inside quickjs-emscripten. | ||
@@ -113,0 +126,0 @@ ## Related |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1119296
21
164