@componentor/quickjs-singlefile-cjs-debug-asyncify 0.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +47 -0
- package/README.md +82 -0
- package/dist/emscripten-module.cjs +2479 -0
- package/dist/emscripten-module.d.ts +18 -0
- package/dist/ffi.d.ts +96 -0
- package/dist/ffi.js +2 -0
- package/dist/ffi.js.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/package.json +57 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
quickjs-emscripten:
|
|
2
|
+
The MIT License
|
|
3
|
+
|
|
4
|
+
quickjs-emscripten copyright (c) 2019-2024 Jake Teton-Landis
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
quickjs:
|
|
26
|
+
QuickJS Javascript Engine
|
|
27
|
+
|
|
28
|
+
Copyright (c) 2017-2021 Fabrice Bellard
|
|
29
|
+
Copyright (c) 2017-2021 Charlie Gordon
|
|
30
|
+
|
|
31
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
32
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
33
|
+
in the Software without restriction, including without limitation the rights
|
|
34
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
35
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
36
|
+
furnished to do so, subject to the following conditions:
|
|
37
|
+
|
|
38
|
+
The above copyright notice and this permission notice shall be included in
|
|
39
|
+
all copies or substantial portions of the Software.
|
|
40
|
+
|
|
41
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
42
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
43
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
44
|
+
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
45
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
46
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
47
|
+
THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# @componentor/quickjs-singlefile-cjs-debug-asyncify
|
|
2
|
+
|
|
3
|
+
Variant with the WASM data embedded into a universal (Node and Browser compatible) CommonJS module.
|
|
4
|
+
|
|
5
|
+
This generated package is part of [quickjs-emscripten](https://github.com/componentor/quickjs-emscripten).
|
|
6
|
+
It contains a variant of the quickjs WASM library, and can be used with @componentor/quickjs-emscripten-core.
|
|
7
|
+
|
|
8
|
+
```typescript
|
|
9
|
+
import variant from "@componentor/quickjs-singlefile-cjs-debug-asyncify"
|
|
10
|
+
import { newQuickJSAsyncWASMModuleFromVariant } from "@componentor/quickjs-emscripten-core"
|
|
11
|
+
const QuickJS = await newQuickJSAsyncWASMModuleFromVariant(variant)
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
This variant was built with the following settings:
|
|
15
|
+
|
|
16
|
+
## Library: quickjs
|
|
17
|
+
|
|
18
|
+
The original [bellard/quickjs](https://github.com/bellard/quickjs) library.
|
|
19
|
+
|
|
20
|
+
Version [2024-02-14+36911f0d](https://github.com/bellard/quickjs/commit/36911f0d3ab1a4c190a4d5cbe7c2db225a455389) vendored to quickjs-emscripten on 2024-06-15.
|
|
21
|
+
|
|
22
|
+
## Release mode: debug
|
|
23
|
+
|
|
24
|
+
Enables assertions and memory sanitizers. Try to run your tests against debug variants, in addition to your preferred production variant, to catch more bugs.
|
|
25
|
+
|
|
26
|
+
## Exports: require
|
|
27
|
+
|
|
28
|
+
Exports the following in package.json for the package entrypoint:
|
|
29
|
+
|
|
30
|
+
- Exports a NodeJS-compatible CommonJS module, which is faster to load and run compared to an ESModule.
|
|
31
|
+
|
|
32
|
+
## Extra async magic? Yes
|
|
33
|
+
|
|
34
|
+
Build run through the ASYNCIFY WebAssembly transform. This imposes substantial size (2x the size of sync) and speed penalties (40% the speed of sync). In return, allows synchronous calls from the QuickJS WASM runtime to async functions on the host. The extra magic makes this variant slower than sync variants. Note that both variants support regular async functions. Only adopt ASYNCIFY if you need to! The [QuickJSAsyncRuntime](https://github.com/componentor/quickjs-emscripten/blob/main/doc/quickjs-emscripten/classes/QuickJSAsyncRuntime.md) and [QuickJSAsyncContext](https://github.com/componentor/quickjs-emscripten/blob/main/doc/quickjs-emscripten/classes/QuickJSAsyncContext.md) classes expose the ASYNCIFY-specific APIs.
|
|
35
|
+
|
|
36
|
+
## Single-file, or separate .wasm file? singlefile
|
|
37
|
+
|
|
38
|
+
The WASM runtime is included directly in the JS file. Use if you run into issues with missing .wasm files when building or deploying your app.
|
|
39
|
+
|
|
40
|
+
## More details
|
|
41
|
+
|
|
42
|
+
Full variant JSON description:
|
|
43
|
+
|
|
44
|
+
```json
|
|
45
|
+
{
|
|
46
|
+
"library": "quickjs",
|
|
47
|
+
"releaseMode": "debug",
|
|
48
|
+
"syncMode": "asyncify",
|
|
49
|
+
"description": "Variant with the WASM data embedded into a universal (Node and Browser compatible) CommonJS module.",
|
|
50
|
+
"emscriptenInclusion": "singlefile",
|
|
51
|
+
"exports": {
|
|
52
|
+
"require": {
|
|
53
|
+
"emscriptenEnvironment": ["web", "worker", "node"]
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Variant-specific Emscripten build flags:
|
|
60
|
+
|
|
61
|
+
```json
|
|
62
|
+
[
|
|
63
|
+
"-s ASYNCIFY=1",
|
|
64
|
+
"-DQTS_ASYNCIFY=1",
|
|
65
|
+
"-DQTS_ASYNCIFY_DEFAULT_STACK_SIZE=81920",
|
|
66
|
+
"-s ASYNCIFY_STACK_SIZE=81920",
|
|
67
|
+
"-s ASYNCIFY_REMOVE=@$(BUILD_WRAPPER)/asyncify-remove.json",
|
|
68
|
+
"-s ASYNCIFY_IMPORTS=@$(BUILD_WRAPPER)/asyncify-imports.json",
|
|
69
|
+
"-lasync.js",
|
|
70
|
+
"-O0",
|
|
71
|
+
"-DQTS_DEBUG_MODE",
|
|
72
|
+
"-DDUMP_LEAKS=1",
|
|
73
|
+
"-gsource-map",
|
|
74
|
+
"-s ASSERTIONS=1",
|
|
75
|
+
"--pre-js $(TEMPLATES)/pre-extension.js",
|
|
76
|
+
"--pre-js $(TEMPLATES)/pre-sourceMapJson.js",
|
|
77
|
+
"--pre-js $(TEMPLATES)/pre-wasmOffsetConverter.js",
|
|
78
|
+
"--pre-js $(TEMPLATES)/pre-wasmMemory.js",
|
|
79
|
+
"-s SINGLE_FILE=1",
|
|
80
|
+
"-O3"
|
|
81
|
+
]
|
|
82
|
+
```
|