@componentor/quickjs-wasmfile-release-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 +89 -0
- package/dist/emscripten-module.browser.d.ts +18 -0
- package/dist/emscripten-module.browser.mjs +48 -0
- package/dist/emscripten-module.cjs +49 -0
- package/dist/emscripten-module.cloudflare.cjs +50 -0
- package/dist/emscripten-module.cloudflare.d.ts +18 -0
- package/dist/emscripten-module.d.ts +18 -0
- package/dist/emscripten-module.mjs +51 -0
- package/dist/emscripten-module.wasm +0 -0
- package/dist/ffi.d.mts +96 -0
- package/dist/ffi.d.ts +96 -0
- package/dist/ffi.js +2 -0
- package/dist/ffi.js.map +1 -0
- package/dist/ffi.mjs +2 -0
- package/dist/ffi.mjs.map +1 -0
- package/dist/index.d.mts +20 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +2 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +62 -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,89 @@
|
|
|
1
|
+
# @componentor/quickjs-wasmfile-release-asyncify
|
|
2
|
+
|
|
3
|
+
Variant with separate .WASM file. Supports browser ESM, NodeJS ESM, and NodeJS CommonJS.
|
|
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-wasmfile-release-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: release
|
|
23
|
+
|
|
24
|
+
Optimized for performance; use when building/deploying your application.
|
|
25
|
+
|
|
26
|
+
## Exports: require import browser workerd
|
|
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
|
+
- Exports a NodeJS-compatible ESModule. Cannot be imported synchronously from a NodeJS CommonJS module.
|
|
32
|
+
- Exports a browser-compatible ESModule, designed to work in browsers and browser-like environments.
|
|
33
|
+
- Targets Cloudflare Workers.
|
|
34
|
+
|
|
35
|
+
## Extra async magic? Yes
|
|
36
|
+
|
|
37
|
+
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.
|
|
38
|
+
|
|
39
|
+
## Single-file, or separate .wasm file? wasm
|
|
40
|
+
|
|
41
|
+
Has a separate .wasm file. May offer better caching in your browser, and reduces the size of your JS bundle. If you have issues, try a 'singlefile' variant.
|
|
42
|
+
|
|
43
|
+
## More details
|
|
44
|
+
|
|
45
|
+
Full variant JSON description:
|
|
46
|
+
|
|
47
|
+
```json
|
|
48
|
+
{
|
|
49
|
+
"library": "quickjs",
|
|
50
|
+
"releaseMode": "release",
|
|
51
|
+
"syncMode": "asyncify",
|
|
52
|
+
"description": "Variant with separate .WASM file. Supports browser ESM, NodeJS ESM, and NodeJS CommonJS.",
|
|
53
|
+
"emscriptenInclusion": "wasm",
|
|
54
|
+
"exports": {
|
|
55
|
+
"require": {
|
|
56
|
+
"emscriptenEnvironment": ["node"]
|
|
57
|
+
},
|
|
58
|
+
"import": {
|
|
59
|
+
"emscriptenEnvironment": ["node"]
|
|
60
|
+
},
|
|
61
|
+
"browser": {
|
|
62
|
+
"emscriptenEnvironment": ["web", "worker"]
|
|
63
|
+
},
|
|
64
|
+
"workerd": {
|
|
65
|
+
"emscriptenEnvironment": ["web"]
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Variant-specific Emscripten build flags:
|
|
72
|
+
|
|
73
|
+
```json
|
|
74
|
+
[
|
|
75
|
+
"-s ASYNCIFY=1",
|
|
76
|
+
"-DQTS_ASYNCIFY=1",
|
|
77
|
+
"-DQTS_ASYNCIFY_DEFAULT_STACK_SIZE=81920",
|
|
78
|
+
"-s ASYNCIFY_STACK_SIZE=81920",
|
|
79
|
+
"-s ASYNCIFY_REMOVE=@$(BUILD_WRAPPER)/asyncify-remove.json",
|
|
80
|
+
"-s ASYNCIFY_IMPORTS=@$(BUILD_WRAPPER)/asyncify-imports.json",
|
|
81
|
+
"-lasync.js",
|
|
82
|
+
"-Oz",
|
|
83
|
+
"-flto",
|
|
84
|
+
"--closure 1",
|
|
85
|
+
"-s FILESYSTEM=0",
|
|
86
|
+
"--pre-js $(TEMPLATES)/pre-extension.js",
|
|
87
|
+
"--pre-js $(TEMPLATES)/pre-wasmMemory.js"
|
|
88
|
+
]
|
|
89
|
+
```
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Generated from ../../templates/emscripten-module.ASYNCIFY.d.ts
|
|
2
|
+
import type {
|
|
3
|
+
EmscriptenModuleLoader,
|
|
4
|
+
QuickJSAsyncEmscriptenModule,
|
|
5
|
+
} from "@componentor/quickjs-ffi-types"
|
|
6
|
+
/**
|
|
7
|
+
* Emscripten module built from [`quickjs/quickjs.h`](../quickjs/quickjs.h) and
|
|
8
|
+
* our FFI support functions [c/interface.c](../c/interface.c), compiled with -s
|
|
9
|
+
* ASYNCIFY=1.
|
|
10
|
+
*
|
|
11
|
+
* Because this version is built with ASYNCIFY, the C code can call asynchronous
|
|
12
|
+
* Javascript functions as though they were synchronous.
|
|
13
|
+
*
|
|
14
|
+
* Note that emscripten modules returned by a `MODULARIZE=1` emscripten build
|
|
15
|
+
* (like this one) load asynchronously.
|
|
16
|
+
*/
|
|
17
|
+
declare const ModuleLoader: EmscriptenModuleLoader<QuickJSAsyncEmscriptenModule>
|
|
18
|
+
export default ModuleLoader
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
|
|
2
|
+
var QuickJSRaw = (() => {
|
|
3
|
+
var _scriptName = import.meta.url;
|
|
4
|
+
|
|
5
|
+
return (
|
|
6
|
+
function(moduleArg = {}) {
|
|
7
|
+
var moduleRtn;
|
|
8
|
+
|
|
9
|
+
var c=moduleArg,aa,f,ba=new Promise((a,b)=>{aa=a;f=b}),ca="object"==typeof window,m="function"==typeof importScripts;function p(a){a={log:a||function(){}};for(const b of p.Va)b(a);return c.quickJSEmscriptenExtensions=a}p.Va=[];c.quickjsEmscriptenInit=p;p.Va.push(a=>{a.getWasmMemory=function(){return r}});var da=Object.assign({},c),ea="./this.program",t="",fa,u;
|
|
10
|
+
if(ca||m)m?t=self.location.href:"undefined"!=typeof document&&document.currentScript&&(t=document.currentScript.src),_scriptName&&(t=_scriptName),t.startsWith("blob:")?t="":t=t.substr(0,t.replace(/[?#].*/,"").lastIndexOf("/")+1),m&&(u=a=>{var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";b.send(null);return new Uint8Array(b.response)}),fa=a=>fetch(a,{credentials:"same-origin"}).then(b=>b.ok?b.arrayBuffer():Promise.reject(Error(b.status+" : "+b.url)));
|
|
11
|
+
var ha=c.print||console.log.bind(console),w=c.printErr||console.error.bind(console);Object.assign(c,da);da=null;c.thisProgram&&(ea=c.thisProgram);var x=c.wasmBinary,r,z=!1,A,B,C,D,F;function ia(){var a=r.buffer;c.HEAP8=B=new Int8Array(a);c.HEAP16=new Int16Array(a);c.HEAPU8=C=new Uint8Array(a);c.HEAPU16=new Uint16Array(a);c.HEAP32=D=new Int32Array(a);c.HEAPU32=F=new Uint32Array(a);c.HEAPF32=new Float32Array(a);c.HEAPF64=new Float64Array(a)}
|
|
12
|
+
c.wasmMemory?r=c.wasmMemory:r=new WebAssembly.Memory({initial:(c.INITIAL_MEMORY||16777216)/65536,maximum:32768});ia();var ja=[],ka=[],la=[];function ma(){var a=c.preRun.shift();ja.unshift(a)}var G=0,H=null,I=null;function J(a){c.onAbort?.(a);a="Aborted("+a+")";w(a);z=!0;A=1;a=new WebAssembly.RuntimeError(a+". Build with -sASSERTIONS for more info.");f(a);throw a;}var na=a=>a.startsWith("data:application/octet-stream;base64,"),K;
|
|
13
|
+
function oa(a){if(a==K&&x)return new Uint8Array(x);if(u)return u(a);throw"both async and sync fetching of the wasm failed";}function pa(a){return x?Promise.resolve().then(()=>oa(a)):fa(a).then(b=>new Uint8Array(b),()=>oa(a))}function qa(a,b,d){return pa(a).then(e=>WebAssembly.instantiate(e,b)).then(d,e=>{w(`failed to asynchronously prepare wasm: ${e}`);J(e)})}
|
|
14
|
+
function ra(a,b){var d=K;return x||"function"!=typeof WebAssembly.instantiateStreaming||na(d)||"function"!=typeof fetch?qa(d,a,b):fetch(d,{credentials:"same-origin"}).then(e=>WebAssembly.instantiateStreaming(e,a).then(b,function(g){w(`wasm streaming compile failed: ${g}`);w("falling back to ArrayBuffer instantiation");return qa(d,a,b)}))}function sa(a){this.name="ExitStatus";this.message=`Program terminated with exit(${a})`;this.status=a}
|
|
15
|
+
var L=a=>{for(;0<a.length;)a.shift()(c)},M=c.noExitRuntime||!0,ta="undefined"!=typeof TextDecoder?new TextDecoder:void 0,N=(a,b,d)=>{var e=b+d;for(d=b;a[d]&&!(d>=e);)++d;if(16<d-b&&a.buffer&&ta)return ta.decode(a.subarray(b,d));for(e="";b<d;){var g=a[b++];if(g&128){var h=a[b++]&63;if(192==(g&224))e+=String.fromCharCode((g&31)<<6|h);else{var k=a[b++]&63;g=224==(g&240)?(g&15)<<12|h<<6|k:(g&7)<<18|h<<12|k<<6|a[b++]&63;65536>g?e+=String.fromCharCode(g):(g-=65536,e+=String.fromCharCode(55296|g>>10,56320|
|
|
16
|
+
g&1023))}}else e+=String.fromCharCode(g)}return e},ua=[0,31,60,91,121,152,182,213,244,274,305,335],va=[0,31,59,90,120,151,181,212,243,273,304,334],O={},wa=a=>{if(!(a instanceof sa||"unwind"==a))throw a;},P=0,xa=a=>{A=a;M||0<P||(c.onExit?.(a),z=!0);throw new sa(a);},ya=a=>{if(!z)try{if(a(),!(M||0<P))try{A=a=A,xa(a)}catch(b){wa(b)}}catch(b){wa(b)}},za;za=()=>performance.now();
|
|
17
|
+
var Q=(a,b,d)=>{var e=C;if(!(0<d))return 0;var g=b;d=b+d-1;for(var h=0;h<a.length;++h){var k=a.charCodeAt(h);if(55296<=k&&57343>=k){var l=a.charCodeAt(++h);k=65536+((k&1023)<<10)|l&1023}if(127>=k){if(b>=d)break;e[b++]=k}else{if(2047>=k){if(b+1>=d)break;e[b++]=192|k>>6}else{if(65535>=k){if(b+2>=d)break;e[b++]=224|k>>12}else{if(b+3>=d)break;e[b++]=240|k>>18;e[b++]=128|k>>12&63}e[b++]=128|k>>6&63}e[b++]=128|k&63}}e[b]=0;return b-g},R={},Aa=()=>{if(!S){var a={USER:"web_user",LOGNAME:"web_user",PATH:"/",
|
|
18
|
+
PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:ea||"./this.program"},b;for(b in R)void 0===R[b]?delete a[b]:a[b]=R[b];var d=[];for(b in a)d.push(`${b}=${a[b]}`);S=d}return S},S,Ba=[null,[],[]],T=a=>{try{a()}catch(b){J(b)}};
|
|
19
|
+
function Ca(){var a=U,b={};for(let [d,e]of Object.entries(a))b[d]="function"==typeof e?(...g)=>{V.push(d);try{return e(...g)}finally{z||(V.pop(),W&&1===X&&0===V.length&&(X=0,T(Da),"undefined"!=typeof Fibers&&Fibers.Ya()))}}:e;return b}var X=0,Y=81920,W=null,Ea=0,V=[],Fa={},Ga={},Ia=0,Ja=null,Ka=[];function La(){return new Promise((a,b)=>{Ja={resolve:a,reject:b}})}
|
|
20
|
+
function Ma(){var a=Na(12+Y),b=a+12,d=Y;F[a>>2]=b;F[a+4>>2]=b+d;b=V[0];d=Fa[b];void 0===d&&(d=Ia++,Fa[b]=d,Ga[d]=b);D[a+8>>2]=d;return a}
|
|
21
|
+
function Oa(a){if(!z){if(0===X){var b=!1,d=!1;a((e=0)=>{if(!z&&(Ea=e,b=!0,d)){X=2;T(()=>Pa(W));"undefined"!=typeof Browser&&Browser.Ma.Wa&&Browser.Ma.resume();e=!1;try{var g=(0,U[Ga[D[W+8>>2]]])()}catch(l){g=l,e=!0}var h=!1;if(!W){var k=Ja;k&&(Ja=null,(e?k.reject:k.resolve)(g),h=!0)}if(e&&!h)throw g;}});d=!0;b||(X=1,W=Ma(),"undefined"!=typeof Browser&&Browser.Ma.Wa&&Browser.Ma.pause(),T(()=>Qa(W)))}else 2===X?(X=0,T(Ra),Sa(W),W=null,Ka.forEach(ya)):J(`invalid state: ${X}`);return Ea}}
|
|
22
|
+
var Ta=a=>{for(var b=0,d=0;d<a.length;++d){var e=a.charCodeAt(d);127>=e?b++:2047>=e?b+=2:55296<=e&&57343>=e?(b+=4,++d):b+=3}return b},Xa=(a,b,d,e,g)=>{function h(n){--P;0!==v&&Ua(v);return"string"===b?n?N(C,n):"":"boolean"===b?!!n:n}var k={string:n=>{var y=0;if(null!==n&&void 0!==n&&0!==n){y=Ta(n)+1;var Ha=Va(y);Q(n,Ha,y);y=Ha}return y},array:n=>{var y=Va(n.length);B.set(n,y);return y}};a=c["_"+a];var l=[],v=0;if(e)for(var q=0;q<e.length;q++){var E=k[d[q]];E?(0===v&&(v=Wa()),l[q]=E(e[q])):l[q]=e[q]}d=
|
|
23
|
+
W;e=a(...l);g=g?.async;P+=1;if(W!=d)return La().then(h);e=h(e);return g?Promise.resolve(e):e},Za={b:(a,b,d,e)=>{J(`Assertion failed: ${a?N(C,a):""}, at: `+[b?b?N(C,b):"":"unknown filename",d,e?e?N(C,e):"":"unknown function"])},q:()=>{J("")},n:()=>{M=!1;P=0},j:function(a,b,d){a=new Date(1E3*(b+2097152>>>0<4194305-!!a?(a>>>0)+4294967296*b:NaN));D[d>>2]=a.getSeconds();D[d+4>>2]=a.getMinutes();D[d+8>>2]=a.getHours();D[d+12>>2]=a.getDate();D[d+16>>2]=a.getMonth();D[d+20>>2]=a.getFullYear()-1900;D[d+24>>
|
|
24
|
+
2]=a.getDay();b=a.getFullYear();D[d+28>>2]=(0!==b%4||0===b%100&&0!==b%400?va:ua)[a.getMonth()]+a.getDate()-1|0;D[d+36>>2]=-(60*a.getTimezoneOffset());b=(new Date(a.getFullYear(),6,1)).getTimezoneOffset();var e=(new Date(a.getFullYear(),0,1)).getTimezoneOffset();D[d+32>>2]=(b!=e&&a.getTimezoneOffset()==Math.min(e,b))|0},l:(a,b)=>{O[a]&&(clearTimeout(O[a].id),delete O[a]);if(!b)return 0;var d=setTimeout(()=>{delete O[a];ya(()=>Ya(a,za()))},b);O[a]={id:d,Xa:b};return 0},o:(a,b,d,e)=>{var g=(new Date).getFullYear(),
|
|
25
|
+
h=(new Date(g,0,1)).getTimezoneOffset();g=(new Date(g,6,1)).getTimezoneOffset();F[a>>2]=60*Math.max(h,g);D[b>>2]=Number(h!=g);b=k=>{var l=Math.abs(k);return`UTC${0<=k?"-":"+"}${String(Math.floor(l/60)).padStart(2,"0")}${String(l%60).padStart(2,"0")}`};a=b(h);b=b(g);g<h?(Q(a,d,17),Q(b,e,17)):(Q(a,e,17),Q(b,d,17))},p:()=>Date.now(),m:a=>{var b=C.length;a>>>=0;if(2147483648<a)return!1;for(var d=1;4>=d;d*=2){var e=b*(1+.2/d);e=Math.min(e,a+100663296);a:{e=(Math.min(2147483648,65536*Math.ceil(Math.max(a,
|
|
26
|
+
e)/65536))-r.buffer.byteLength+65535)/65536;try{r.grow(e);ia();var g=1;break a}catch(h){}g=void 0}if(g)return!0}return!1},e:(a,b)=>{var d=0;Aa().forEach((e,g)=>{var h=b+d;g=F[a+4*g>>2]=h;for(h=0;h<e.length;++h)B[g++]=e.charCodeAt(h);B[g]=0;d+=e.length+1});return 0},f:(a,b)=>{var d=Aa();F[a>>2]=d.length;var e=0;d.forEach(g=>e+=g.length+1);F[b>>2]=e;return 0},d:()=>52,k:function(){return 70},c:(a,b,d,e)=>{for(var g=0,h=0;h<d;h++){var k=F[b>>2],l=F[b+4>>2];b+=8;for(var v=0;v<l;v++){var q=C[k+v],E=Ba[a];
|
|
27
|
+
0===q||10===q?((1===a?ha:w)(N(E,0)),E.length=0):E.push(q)}g+=l}F[e>>2]=g;return 0},a:r,r:xa,s:function(a,b,d,e,g){return c.callbacks.callFunction({handleSleep:Oa},a,b,d,e,g)},i:function(a){return c.callbacks.shouldInterrupt(void 0,a)},h:function(a,b,d){const e={handleSleep:Oa};d=d?N(C,d):"";return c.callbacks.loadModuleSource(e,a,b,d)},g:function(a,b,d,e){const g={handleSleep:Oa};d=d?N(C,d):"";e=e?N(C,e):"";return c.callbacks.normalizeModule(g,a,b,d,e)},t:function(a,b){Y=a||b}},U=function(){function a(d){U=
|
|
28
|
+
d.exports;U=Ca();ka.unshift(U.u);G--;c.monitorRunDependencies?.(G);0==G&&(null!==H&&(clearInterval(H),H=null),I&&(d=I,I=null,d()));return U}var b={a:Za};G++;c.monitorRunDependencies?.(G);if(c.instantiateWasm)try{return c.instantiateWasm(b,a)}catch(d){w(`Module.instantiateWasm callback failed with error: ${d}`),f(d)}K||=c.locateFile?na("emscripten-module.wasm")?"emscripten-module.wasm":c.locateFile?c.locateFile("emscripten-module.wasm",t):t+"emscripten-module.wasm":(new URL("emscripten-module.wasm",
|
|
29
|
+
import.meta.url)).href;ra(b,function(d){a(d.instance)}).catch(f);return{}}(),Na=c._malloc=a=>(Na=c._malloc=U.v)(a);c._QTS_Throw=(a,b)=>(c._QTS_Throw=U.w)(a,b);c._QTS_NewError=a=>(c._QTS_NewError=U.x)(a);c._QTS_RuntimeSetMemoryLimit=(a,b)=>(c._QTS_RuntimeSetMemoryLimit=U.y)(a,b);c._QTS_RuntimeComputeMemoryUsage=(a,b)=>(c._QTS_RuntimeComputeMemoryUsage=U.z)(a,b);c._QTS_RuntimeDumpMemoryUsage=a=>(c._QTS_RuntimeDumpMemoryUsage=U.A)(a);
|
|
30
|
+
c._QTS_RecoverableLeakCheck=()=>(c._QTS_RecoverableLeakCheck=U.B)();c._QTS_BuildIsSanitizeLeak=()=>(c._QTS_BuildIsSanitizeLeak=U.C)();c._QTS_RuntimeSetMaxStackSize=(a,b)=>(c._QTS_RuntimeSetMaxStackSize=U.D)(a,b);c._QTS_GetUndefined=()=>(c._QTS_GetUndefined=U.E)();c._QTS_GetNull=()=>(c._QTS_GetNull=U.F)();c._QTS_GetFalse=()=>(c._QTS_GetFalse=U.G)();c._QTS_GetTrue=()=>(c._QTS_GetTrue=U.H)();c._QTS_NewRuntime=()=>(c._QTS_NewRuntime=U.I)();c._QTS_FreeRuntime=a=>(c._QTS_FreeRuntime=U.J)(a);
|
|
31
|
+
var Sa=c._free=a=>(Sa=c._free=U.K)(a);c._QTS_NewContext=(a,b)=>(c._QTS_NewContext=U.L)(a,b);c._QTS_FreeContext=a=>(c._QTS_FreeContext=U.M)(a);c._QTS_FreeValuePointer=(a,b)=>(c._QTS_FreeValuePointer=U.N)(a,b);c._QTS_FreeValuePointerRuntime=(a,b)=>(c._QTS_FreeValuePointerRuntime=U.O)(a,b);c._QTS_FreeVoidPointer=(a,b)=>(c._QTS_FreeVoidPointer=U.P)(a,b);c._QTS_FreeCString=(a,b)=>(c._QTS_FreeCString=U.Q)(a,b);c._QTS_DupValuePointer=(a,b)=>(c._QTS_DupValuePointer=U.R)(a,b);
|
|
32
|
+
c._QTS_NewObject=a=>(c._QTS_NewObject=U.S)(a);c._QTS_NewObjectProto=(a,b)=>(c._QTS_NewObjectProto=U.T)(a,b);c._QTS_NewArray=a=>(c._QTS_NewArray=U.U)(a);c._QTS_NewArrayBuffer=(a,b,d)=>(c._QTS_NewArrayBuffer=U.V)(a,b,d);c._QTS_NewFloat64=(a,b)=>(c._QTS_NewFloat64=U.W)(a,b);c._QTS_GetFloat64=(a,b)=>(c._QTS_GetFloat64=U.X)(a,b);c._QTS_NewString=(a,b)=>(c._QTS_NewString=U.Y)(a,b);c._QTS_GetString=(a,b)=>(c._QTS_GetString=U.Z)(a,b);c._QTS_GetArrayBuffer=(a,b)=>(c._QTS_GetArrayBuffer=U._)(a,b);
|
|
33
|
+
c._QTS_GetArrayBufferLength=(a,b)=>(c._QTS_GetArrayBufferLength=U.$)(a,b);c._QTS_NewSymbol=(a,b,d)=>(c._QTS_NewSymbol=U.aa)(a,b,d);c._QTS_GetSymbolDescriptionOrKey=(a,b)=>(c._QTS_GetSymbolDescriptionOrKey=U.ba)(a,b);c._QTS_IsGlobalSymbol=(a,b)=>(c._QTS_IsGlobalSymbol=U.ca)(a,b);c._QTS_IsJobPending=a=>(c._QTS_IsJobPending=U.da)(a);c._QTS_ExecutePendingJob=(a,b,d)=>(c._QTS_ExecutePendingJob=U.ea)(a,b,d);c._QTS_GetProp=(a,b,d)=>(c._QTS_GetProp=U.fa)(a,b,d);
|
|
34
|
+
c._QTS_GetPropNumber=(a,b,d)=>(c._QTS_GetPropNumber=U.ga)(a,b,d);c._QTS_SetProp=(a,b,d,e)=>(c._QTS_SetProp=U.ha)(a,b,d,e);c._QTS_DefineProp=(a,b,d,e,g,h,k,l,v)=>(c._QTS_DefineProp=U.ia)(a,b,d,e,g,h,k,l,v);c._QTS_GetOwnPropertyNames=(a,b,d,e,g)=>(c._QTS_GetOwnPropertyNames=U.ja)(a,b,d,e,g);c._QTS_Call=(a,b,d,e,g)=>(c._QTS_Call=U.ka)(a,b,d,e,g);c._QTS_ResolveException=(a,b)=>(c._QTS_ResolveException=U.la)(a,b);c._QTS_Dump=(a,b)=>(c._QTS_Dump=U.ma)(a,b);
|
|
35
|
+
c._QTS_Eval=(a,b,d,e,g,h)=>(c._QTS_Eval=U.na)(a,b,d,e,g,h);c._QTS_GetModuleNamespace=(a,b)=>(c._QTS_GetModuleNamespace=U.oa)(a,b);c._QTS_Typeof=(a,b)=>(c._QTS_Typeof=U.pa)(a,b);c._QTS_GetLength=(a,b,d)=>(c._QTS_GetLength=U.qa)(a,b,d);c._QTS_IsEqual=(a,b,d,e)=>(c._QTS_IsEqual=U.ra)(a,b,d,e);c._QTS_GetGlobalObject=a=>(c._QTS_GetGlobalObject=U.sa)(a);c._QTS_NewPromiseCapability=(a,b)=>(c._QTS_NewPromiseCapability=U.ta)(a,b);c._QTS_PromiseState=(a,b)=>(c._QTS_PromiseState=U.ua)(a,b);
|
|
36
|
+
c._QTS_PromiseResult=(a,b)=>(c._QTS_PromiseResult=U.va)(a,b);c._QTS_TestStringArg=a=>(c._QTS_TestStringArg=U.wa)(a);c._QTS_GetDebugLogEnabled=a=>(c._QTS_GetDebugLogEnabled=U.xa)(a);c._QTS_SetDebugLogEnabled=(a,b)=>(c._QTS_SetDebugLogEnabled=U.ya)(a,b);c._QTS_BuildIsDebug=()=>(c._QTS_BuildIsDebug=U.za)();c._QTS_BuildIsAsyncify=()=>(c._QTS_BuildIsAsyncify=U.Aa)();c._QTS_NewFunction=(a,b,d)=>(c._QTS_NewFunction=U.Ba)(a,b,d);
|
|
37
|
+
c._QTS_ArgvGetJSValueConstPointer=(a,b)=>(c._QTS_ArgvGetJSValueConstPointer=U.Ca)(a,b);c._QTS_RuntimeEnableInterruptHandler=a=>(c._QTS_RuntimeEnableInterruptHandler=U.Da)(a);c._QTS_RuntimeDisableInterruptHandler=a=>(c._QTS_RuntimeDisableInterruptHandler=U.Ea)(a);c._QTS_RuntimeEnableModuleLoader=(a,b)=>(c._QTS_RuntimeEnableModuleLoader=U.Fa)(a,b);c._QTS_RuntimeDisableModuleLoader=a=>(c._QTS_RuntimeDisableModuleLoader=U.Ga)(a);c._QTS_bjson_encode=(a,b)=>(c._QTS_bjson_encode=U.Ha)(a,b);
|
|
38
|
+
c._QTS_bjson_decode=(a,b)=>(c._QTS_bjson_decode=U.Ia)(a,b);c._QTS_EvalFunction=(a,b)=>(c._QTS_EvalFunction=U.Ja)(a,b);c._QTS_EncodeBytecode=(a,b)=>(c._QTS_EncodeBytecode=U.Ka)(a,b);c._QTS_DecodeBytecode=(a,b)=>(c._QTS_DecodeBytecode=U.La)(a,b);var Ya=(a,b)=>(Ya=U.Na)(a,b),Ua=a=>(Ua=U.Oa)(a),Va=a=>(Va=U.Pa)(a),Wa=()=>(Wa=U.Qa)(),Qa=a=>(Qa=U.Ra)(a),Da=()=>(Da=U.Sa)(),Pa=a=>(Pa=U.Ta)(a),Ra=()=>(Ra=U.Ua)();
|
|
39
|
+
c.cwrap=(a,b,d,e)=>{var g=!d||d.every(h=>"number"===h||"boolean"===h);return"string"!==b&&g&&!e?c["_"+a]:(...h)=>Xa(a,b,d,h,e)};c.UTF8ToString=(a,b)=>a?N(C,a,b):"";c.stringToUTF8=(a,b,d)=>Q(a,b,d);c.lengthBytesUTF8=Ta;var Z;I=function $a(){Z||ab();Z||(I=$a)};
|
|
40
|
+
function ab(){function a(){if(!Z&&(Z=!0,c.calledRun=!0,!z)){L(ka);aa(c);c.onRuntimeInitialized?.();if(c.postRun)for("function"==typeof c.postRun&&(c.postRun=[c.postRun]);c.postRun.length;){var b=c.postRun.shift();la.unshift(b)}L(la)}}if(!(0<G)){if(c.preRun)for("function"==typeof c.preRun&&(c.preRun=[c.preRun]);c.preRun.length;)ma();L(ja);0<G||(c.setStatus?(c.setStatus("Running..."),setTimeout(function(){setTimeout(function(){c.setStatus("")},1);a()},1)):a())}}
|
|
41
|
+
if(c.preInit)for("function"==typeof c.preInit&&(c.preInit=[c.preInit]);0<c.preInit.length;)c.preInit.pop()();ab();moduleRtn=ba;
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
return moduleRtn;
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
})();
|
|
48
|
+
export default QuickJSRaw;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
|
|
2
|
+
var QuickJSRaw = (() => {
|
|
3
|
+
var _scriptName = typeof document != 'undefined' ? document.currentScript?.src : undefined;
|
|
4
|
+
if (typeof __filename != 'undefined') _scriptName ||= __filename;
|
|
5
|
+
return (
|
|
6
|
+
function(moduleArg = {}) {
|
|
7
|
+
var moduleRtn;
|
|
8
|
+
|
|
9
|
+
var c=moduleArg,aa,f,ba=new Promise((a,b)=>{aa=a;f=b});function m(a){a={log:a||function(){}};for(const b of m.Va)b(a);return c.quickJSEmscriptenExtensions=a}m.Va=[];c.quickjsEmscriptenInit=m;m.Va.push(a=>{a.getWasmMemory=function(){return p}});var ca=Object.assign({},c),r="./this.program",t=(a,b)=>{throw b;},v="",da,w,fs=require("fs"),ea=require("path");v=__dirname+"/";w=a=>{a=fa(a)?new URL(a):ea.normalize(a);return fs.readFileSync(a)};
|
|
10
|
+
da=a=>{a=fa(a)?new URL(a):ea.normalize(a);return new Promise((b,d)=>{fs.readFile(a,void 0,(e,g)=>{e?d(e):b(g.buffer)})})};!c.thisProgram&&1<process.argv.length&&(r=process.argv[1].replace(/\\/g,"/"));process.argv.slice(2);t=(a,b)=>{process.exitCode=a;throw b;};var ha=c.print||console.log.bind(console),y=c.printErr||console.error.bind(console);Object.assign(c,ca);ca=null;c.thisProgram&&(r=c.thisProgram);var z=c.wasmBinary,p,A=!1,B,D,E,F,G;
|
|
11
|
+
function ia(){var a=p.buffer;c.HEAP8=D=new Int8Array(a);c.HEAP16=new Int16Array(a);c.HEAPU8=E=new Uint8Array(a);c.HEAPU16=new Uint16Array(a);c.HEAP32=F=new Int32Array(a);c.HEAPU32=G=new Uint32Array(a);c.HEAPF32=new Float32Array(a);c.HEAPF64=new Float64Array(a)}c.wasmMemory?p=c.wasmMemory:p=new WebAssembly.Memory({initial:(c.INITIAL_MEMORY||16777216)/65536,maximum:32768});ia();var ja=[],ka=[],la=[];function ma(){var a=c.preRun.shift();ja.unshift(a)}var H=0,I=null,J=null;
|
|
12
|
+
function K(a){c.onAbort?.(a);a="Aborted("+a+")";y(a);A=!0;B=1;a=new WebAssembly.RuntimeError(a+". Build with -sASSERTIONS for more info.");f(a);throw a;}var na=a=>a.startsWith("data:application/octet-stream;base64,"),fa=a=>a.startsWith("file://"),L;function oa(a){if(a==L&&z)return new Uint8Array(z);if(w)return w(a);throw"both async and sync fetching of the wasm failed";}function pa(){var a=L;return z?Promise.resolve().then(()=>oa(a)):da(a).then(b=>new Uint8Array(b),()=>oa(a))}
|
|
13
|
+
function qa(a,b){return pa().then(d=>WebAssembly.instantiate(d,a)).then(b,d=>{y(`failed to asynchronously prepare wasm: ${d}`);K(d)})}function ra(a,b){return qa(a,b)}function M(a){this.name="ExitStatus";this.message=`Program terminated with exit(${a})`;this.status=a}
|
|
14
|
+
var N=a=>{for(;0<a.length;)a.shift()(c)},O=c.noExitRuntime||!0,sa="undefined"!=typeof TextDecoder?new TextDecoder:void 0,P=(a,b,d)=>{var e=b+d;for(d=b;a[d]&&!(d>=e);)++d;if(16<d-b&&a.buffer&&sa)return sa.decode(a.subarray(b,d));for(e="";b<d;){var g=a[b++];if(g&128){var h=a[b++]&63;if(192==(g&224))e+=String.fromCharCode((g&31)<<6|h);else{var k=a[b++]&63;g=224==(g&240)?(g&15)<<12|h<<6|k:(g&7)<<18|h<<12|k<<6|a[b++]&63;65536>g?e+=String.fromCharCode(g):(g-=65536,e+=String.fromCharCode(55296|g>>10,56320|
|
|
15
|
+
g&1023))}}else e+=String.fromCharCode(g)}return e},ta=[0,31,60,91,121,152,182,213,244,274,305,335],ua=[0,31,59,90,120,151,181,212,243,273,304,334],Q={},R=0,va=a=>{B=a;O||0<R||(c.onExit?.(a),A=!0);t(a,new M(a))},wa=a=>{if(!A)try{if(a(),!(O||0<R))try{B=a=B,va(a)}catch(b){b instanceof M||"unwind"==b||t(1,b)}}catch(b){b instanceof M||"unwind"==b||t(1,b)}},xa;xa=()=>performance.now();
|
|
16
|
+
var S=(a,b,d)=>{var e=E;if(!(0<d))return 0;var g=b;d=b+d-1;for(var h=0;h<a.length;++h){var k=a.charCodeAt(h);if(55296<=k&&57343>=k){var l=a.charCodeAt(++h);k=65536+((k&1023)<<10)|l&1023}if(127>=k){if(b>=d)break;e[b++]=k}else{if(2047>=k){if(b+1>=d)break;e[b++]=192|k>>6}else{if(65535>=k){if(b+2>=d)break;e[b++]=224|k>>12}else{if(b+3>=d)break;e[b++]=240|k>>18;e[b++]=128|k>>12&63}e[b++]=128|k>>6&63}e[b++]=128|k&63}}e[b]=0;return b-g},T={},za=()=>{if(!ya){var a={USER:"web_user",LOGNAME:"web_user",PATH:"/",
|
|
17
|
+
PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:r||"./this.program"},b;for(b in T)void 0===T[b]?delete a[b]:a[b]=T[b];var d=[];for(b in a)d.push(`${b}=${a[b]}`);ya=d}return ya},ya,Aa=[null,[],[]],U=a=>{try{a()}catch(b){K(b)}};
|
|
18
|
+
function Ba(){var a=V,b={};for(let [d,e]of Object.entries(a))b[d]="function"==typeof e?(...g)=>{W.push(d);try{return e(...g)}finally{A||(W.pop(),X&&1===Y&&0===W.length&&(Y=0,U(Ca),"undefined"!=typeof Fibers&&Fibers.Ya()))}}:e;return b}var Y=0,Da=81920,X=null,Ea=0,W=[],Fa={},Ha={},Ia=0,Ja=null,Ka=[];function La(){return new Promise((a,b)=>{Ja={resolve:a,reject:b}})}
|
|
19
|
+
function Ma(){var a=Na(12+Da),b=a+12,d=Da;G[a>>2]=b;G[a+4>>2]=b+d;b=W[0];d=Fa[b];void 0===d&&(d=Ia++,Fa[b]=d,Ha[d]=b);F[a+8>>2]=d;return a}
|
|
20
|
+
function Oa(a){if(!A){if(0===Y){var b=!1,d=!1;a((e=0)=>{if(!A&&(Ea=e,b=!0,d)){Y=2;U(()=>Pa(X));"undefined"!=typeof Browser&&Browser.Ma.Wa&&Browser.Ma.resume();e=!1;try{var g=(0,V[Ha[F[X+8>>2]]])()}catch(l){g=l,e=!0}var h=!1;if(!X){var k=Ja;k&&(Ja=null,(e?k.reject:k.resolve)(g),h=!0)}if(e&&!h)throw g;}});d=!0;b||(Y=1,X=Ma(),"undefined"!=typeof Browser&&Browser.Ma.Wa&&Browser.Ma.pause(),U(()=>Qa(X)))}else 2===Y?(Y=0,U(Ra),Sa(X),X=null,Ka.forEach(wa)):K(`invalid state: ${Y}`);return Ea}}
|
|
21
|
+
var Ta=a=>{for(var b=0,d=0;d<a.length;++d){var e=a.charCodeAt(d);127>=e?b++:2047>=e?b+=2:55296<=e&&57343>=e?(b+=4,++d):b+=3}return b},Xa=(a,b,d,e,g)=>{function h(n){--R;0!==u&&Ua(u);return"string"===b?n?P(E,n):"":"boolean"===b?!!n:n}var k={string:n=>{var x=0;if(null!==n&&void 0!==n&&0!==n){x=Ta(n)+1;var Ga=Va(x);S(n,Ga,x);x=Ga}return x},array:n=>{var x=Va(n.length);D.set(n,x);return x}};a=c["_"+a];var l=[],u=0;if(e)for(var q=0;q<e.length;q++){var C=k[d[q]];C?(0===u&&(u=Wa()),l[q]=C(e[q])):l[q]=e[q]}d=
|
|
22
|
+
X;e=a(...l);g=g?.async;R+=1;if(X!=d)return La().then(h);e=h(e);return g?Promise.resolve(e):e},Za={b:(a,b,d,e)=>{K(`Assertion failed: ${a?P(E,a):""}, at: `+[b?b?P(E,b):"":"unknown filename",d,e?e?P(E,e):"":"unknown function"])},q:()=>{K("")},n:()=>{O=!1;R=0},j:function(a,b,d){a=new Date(1E3*(b+2097152>>>0<4194305-!!a?(a>>>0)+4294967296*b:NaN));F[d>>2]=a.getSeconds();F[d+4>>2]=a.getMinutes();F[d+8>>2]=a.getHours();F[d+12>>2]=a.getDate();F[d+16>>2]=a.getMonth();F[d+20>>2]=a.getFullYear()-1900;F[d+24>>
|
|
23
|
+
2]=a.getDay();b=a.getFullYear();F[d+28>>2]=(0!==b%4||0===b%100&&0!==b%400?ua:ta)[a.getMonth()]+a.getDate()-1|0;F[d+36>>2]=-(60*a.getTimezoneOffset());b=(new Date(a.getFullYear(),6,1)).getTimezoneOffset();var e=(new Date(a.getFullYear(),0,1)).getTimezoneOffset();F[d+32>>2]=(b!=e&&a.getTimezoneOffset()==Math.min(e,b))|0},l:(a,b)=>{Q[a]&&(clearTimeout(Q[a].id),delete Q[a]);if(!b)return 0;var d=setTimeout(()=>{delete Q[a];wa(()=>Ya(a,xa()))},b);Q[a]={id:d,Xa:b};return 0},o:(a,b,d,e)=>{var g=(new Date).getFullYear(),
|
|
24
|
+
h=(new Date(g,0,1)).getTimezoneOffset();g=(new Date(g,6,1)).getTimezoneOffset();G[a>>2]=60*Math.max(h,g);F[b>>2]=Number(h!=g);b=k=>{var l=Math.abs(k);return`UTC${0<=k?"-":"+"}${String(Math.floor(l/60)).padStart(2,"0")}${String(l%60).padStart(2,"0")}`};a=b(h);b=b(g);g<h?(S(a,d,17),S(b,e,17)):(S(a,e,17),S(b,d,17))},p:()=>Date.now(),m:a=>{var b=E.length;a>>>=0;if(2147483648<a)return!1;for(var d=1;4>=d;d*=2){var e=b*(1+.2/d);e=Math.min(e,a+100663296);a:{e=(Math.min(2147483648,65536*Math.ceil(Math.max(a,
|
|
25
|
+
e)/65536))-p.buffer.byteLength+65535)/65536;try{p.grow(e);ia();var g=1;break a}catch(h){}g=void 0}if(g)return!0}return!1},e:(a,b)=>{var d=0;za().forEach((e,g)=>{var h=b+d;g=G[a+4*g>>2]=h;for(h=0;h<e.length;++h)D[g++]=e.charCodeAt(h);D[g]=0;d+=e.length+1});return 0},f:(a,b)=>{var d=za();G[a>>2]=d.length;var e=0;d.forEach(g=>e+=g.length+1);G[b>>2]=e;return 0},d:()=>52,k:function(){return 70},c:(a,b,d,e)=>{for(var g=0,h=0;h<d;h++){var k=G[b>>2],l=G[b+4>>2];b+=8;for(var u=0;u<l;u++){var q=E[k+u],C=Aa[a];
|
|
26
|
+
0===q||10===q?((1===a?ha:y)(P(C,0)),C.length=0):C.push(q)}g+=l}G[e>>2]=g;return 0},a:p,r:va,s:function(a,b,d,e,g){return c.callbacks.callFunction({handleSleep:Oa},a,b,d,e,g)},i:function(a){return c.callbacks.shouldInterrupt(void 0,a)},h:function(a,b,d){const e={handleSleep:Oa};d=d?P(E,d):"";return c.callbacks.loadModuleSource(e,a,b,d)},g:function(a,b,d,e){const g={handleSleep:Oa};d=d?P(E,d):"";e=e?P(E,e):"";return c.callbacks.normalizeModule(g,a,b,d,e)},t:function(a,b){Da=a||b}},V=function(){function a(d){V=
|
|
27
|
+
d.exports;V=Ba();ka.unshift(V.u);H--;c.monitorRunDependencies?.(H);0==H&&(null!==I&&(clearInterval(I),I=null),J&&(d=J,J=null,d()));return V}var b={a:Za};H++;c.monitorRunDependencies?.(H);if(c.instantiateWasm)try{return c.instantiateWasm(b,a)}catch(d){y(`Module.instantiateWasm callback failed with error: ${d}`),f(d)}L||=na("emscripten-module.wasm")?"emscripten-module.wasm":c.locateFile?c.locateFile("emscripten-module.wasm",v):v+"emscripten-module.wasm";ra(b,function(d){a(d.instance)}).catch(f);return{}}(),
|
|
28
|
+
Na=c._malloc=a=>(Na=c._malloc=V.v)(a);c._QTS_Throw=(a,b)=>(c._QTS_Throw=V.w)(a,b);c._QTS_NewError=a=>(c._QTS_NewError=V.x)(a);c._QTS_RuntimeSetMemoryLimit=(a,b)=>(c._QTS_RuntimeSetMemoryLimit=V.y)(a,b);c._QTS_RuntimeComputeMemoryUsage=(a,b)=>(c._QTS_RuntimeComputeMemoryUsage=V.z)(a,b);c._QTS_RuntimeDumpMemoryUsage=a=>(c._QTS_RuntimeDumpMemoryUsage=V.A)(a);c._QTS_RecoverableLeakCheck=()=>(c._QTS_RecoverableLeakCheck=V.B)();c._QTS_BuildIsSanitizeLeak=()=>(c._QTS_BuildIsSanitizeLeak=V.C)();
|
|
29
|
+
c._QTS_RuntimeSetMaxStackSize=(a,b)=>(c._QTS_RuntimeSetMaxStackSize=V.D)(a,b);c._QTS_GetUndefined=()=>(c._QTS_GetUndefined=V.E)();c._QTS_GetNull=()=>(c._QTS_GetNull=V.F)();c._QTS_GetFalse=()=>(c._QTS_GetFalse=V.G)();c._QTS_GetTrue=()=>(c._QTS_GetTrue=V.H)();c._QTS_NewRuntime=()=>(c._QTS_NewRuntime=V.I)();c._QTS_FreeRuntime=a=>(c._QTS_FreeRuntime=V.J)(a);var Sa=c._free=a=>(Sa=c._free=V.K)(a);c._QTS_NewContext=(a,b)=>(c._QTS_NewContext=V.L)(a,b);c._QTS_FreeContext=a=>(c._QTS_FreeContext=V.M)(a);
|
|
30
|
+
c._QTS_FreeValuePointer=(a,b)=>(c._QTS_FreeValuePointer=V.N)(a,b);c._QTS_FreeValuePointerRuntime=(a,b)=>(c._QTS_FreeValuePointerRuntime=V.O)(a,b);c._QTS_FreeVoidPointer=(a,b)=>(c._QTS_FreeVoidPointer=V.P)(a,b);c._QTS_FreeCString=(a,b)=>(c._QTS_FreeCString=V.Q)(a,b);c._QTS_DupValuePointer=(a,b)=>(c._QTS_DupValuePointer=V.R)(a,b);c._QTS_NewObject=a=>(c._QTS_NewObject=V.S)(a);c._QTS_NewObjectProto=(a,b)=>(c._QTS_NewObjectProto=V.T)(a,b);c._QTS_NewArray=a=>(c._QTS_NewArray=V.U)(a);
|
|
31
|
+
c._QTS_NewArrayBuffer=(a,b,d)=>(c._QTS_NewArrayBuffer=V.V)(a,b,d);c._QTS_NewFloat64=(a,b)=>(c._QTS_NewFloat64=V.W)(a,b);c._QTS_GetFloat64=(a,b)=>(c._QTS_GetFloat64=V.X)(a,b);c._QTS_NewString=(a,b)=>(c._QTS_NewString=V.Y)(a,b);c._QTS_GetString=(a,b)=>(c._QTS_GetString=V.Z)(a,b);c._QTS_GetArrayBuffer=(a,b)=>(c._QTS_GetArrayBuffer=V._)(a,b);c._QTS_GetArrayBufferLength=(a,b)=>(c._QTS_GetArrayBufferLength=V.$)(a,b);c._QTS_NewSymbol=(a,b,d)=>(c._QTS_NewSymbol=V.aa)(a,b,d);
|
|
32
|
+
c._QTS_GetSymbolDescriptionOrKey=(a,b)=>(c._QTS_GetSymbolDescriptionOrKey=V.ba)(a,b);c._QTS_IsGlobalSymbol=(a,b)=>(c._QTS_IsGlobalSymbol=V.ca)(a,b);c._QTS_IsJobPending=a=>(c._QTS_IsJobPending=V.da)(a);c._QTS_ExecutePendingJob=(a,b,d)=>(c._QTS_ExecutePendingJob=V.ea)(a,b,d);c._QTS_GetProp=(a,b,d)=>(c._QTS_GetProp=V.fa)(a,b,d);c._QTS_GetPropNumber=(a,b,d)=>(c._QTS_GetPropNumber=V.ga)(a,b,d);c._QTS_SetProp=(a,b,d,e)=>(c._QTS_SetProp=V.ha)(a,b,d,e);
|
|
33
|
+
c._QTS_DefineProp=(a,b,d,e,g,h,k,l,u)=>(c._QTS_DefineProp=V.ia)(a,b,d,e,g,h,k,l,u);c._QTS_GetOwnPropertyNames=(a,b,d,e,g)=>(c._QTS_GetOwnPropertyNames=V.ja)(a,b,d,e,g);c._QTS_Call=(a,b,d,e,g)=>(c._QTS_Call=V.ka)(a,b,d,e,g);c._QTS_ResolveException=(a,b)=>(c._QTS_ResolveException=V.la)(a,b);c._QTS_Dump=(a,b)=>(c._QTS_Dump=V.ma)(a,b);c._QTS_Eval=(a,b,d,e,g,h)=>(c._QTS_Eval=V.na)(a,b,d,e,g,h);c._QTS_GetModuleNamespace=(a,b)=>(c._QTS_GetModuleNamespace=V.oa)(a,b);
|
|
34
|
+
c._QTS_Typeof=(a,b)=>(c._QTS_Typeof=V.pa)(a,b);c._QTS_GetLength=(a,b,d)=>(c._QTS_GetLength=V.qa)(a,b,d);c._QTS_IsEqual=(a,b,d,e)=>(c._QTS_IsEqual=V.ra)(a,b,d,e);c._QTS_GetGlobalObject=a=>(c._QTS_GetGlobalObject=V.sa)(a);c._QTS_NewPromiseCapability=(a,b)=>(c._QTS_NewPromiseCapability=V.ta)(a,b);c._QTS_PromiseState=(a,b)=>(c._QTS_PromiseState=V.ua)(a,b);c._QTS_PromiseResult=(a,b)=>(c._QTS_PromiseResult=V.va)(a,b);c._QTS_TestStringArg=a=>(c._QTS_TestStringArg=V.wa)(a);
|
|
35
|
+
c._QTS_GetDebugLogEnabled=a=>(c._QTS_GetDebugLogEnabled=V.xa)(a);c._QTS_SetDebugLogEnabled=(a,b)=>(c._QTS_SetDebugLogEnabled=V.ya)(a,b);c._QTS_BuildIsDebug=()=>(c._QTS_BuildIsDebug=V.za)();c._QTS_BuildIsAsyncify=()=>(c._QTS_BuildIsAsyncify=V.Aa)();c._QTS_NewFunction=(a,b,d)=>(c._QTS_NewFunction=V.Ba)(a,b,d);c._QTS_ArgvGetJSValueConstPointer=(a,b)=>(c._QTS_ArgvGetJSValueConstPointer=V.Ca)(a,b);c._QTS_RuntimeEnableInterruptHandler=a=>(c._QTS_RuntimeEnableInterruptHandler=V.Da)(a);
|
|
36
|
+
c._QTS_RuntimeDisableInterruptHandler=a=>(c._QTS_RuntimeDisableInterruptHandler=V.Ea)(a);c._QTS_RuntimeEnableModuleLoader=(a,b)=>(c._QTS_RuntimeEnableModuleLoader=V.Fa)(a,b);c._QTS_RuntimeDisableModuleLoader=a=>(c._QTS_RuntimeDisableModuleLoader=V.Ga)(a);c._QTS_bjson_encode=(a,b)=>(c._QTS_bjson_encode=V.Ha)(a,b);c._QTS_bjson_decode=(a,b)=>(c._QTS_bjson_decode=V.Ia)(a,b);c._QTS_EvalFunction=(a,b)=>(c._QTS_EvalFunction=V.Ja)(a,b);c._QTS_EncodeBytecode=(a,b)=>(c._QTS_EncodeBytecode=V.Ka)(a,b);
|
|
37
|
+
c._QTS_DecodeBytecode=(a,b)=>(c._QTS_DecodeBytecode=V.La)(a,b);var Ya=(a,b)=>(Ya=V.Na)(a,b),Ua=a=>(Ua=V.Oa)(a),Va=a=>(Va=V.Pa)(a),Wa=()=>(Wa=V.Qa)(),Qa=a=>(Qa=V.Ra)(a),Ca=()=>(Ca=V.Sa)(),Pa=a=>(Pa=V.Ta)(a),Ra=()=>(Ra=V.Ua)();c.cwrap=(a,b,d,e)=>{var g=!d||d.every(h=>"number"===h||"boolean"===h);return"string"!==b&&g&&!e?c["_"+a]:(...h)=>Xa(a,b,d,h,e)};c.UTF8ToString=(a,b)=>a?P(E,a,b):"";c.stringToUTF8=(a,b,d)=>S(a,b,d);c.lengthBytesUTF8=Ta;var Z;J=function $a(){Z||ab();Z||(J=$a)};
|
|
38
|
+
function ab(){function a(){if(!Z&&(Z=!0,c.calledRun=!0,!A)){N(ka);aa(c);c.onRuntimeInitialized?.();if(c.postRun)for("function"==typeof c.postRun&&(c.postRun=[c.postRun]);c.postRun.length;){var b=c.postRun.shift();la.unshift(b)}N(la)}}if(!(0<H)){if(c.preRun)for("function"==typeof c.preRun&&(c.preRun=[c.preRun]);c.preRun.length;)ma();N(ja);0<H||(c.setStatus?(c.setStatus("Running..."),setTimeout(function(){setTimeout(function(){c.setStatus("")},1);a()},1)):a())}}
|
|
39
|
+
if(c.preInit)for("function"==typeof c.preInit&&(c.preInit=[c.preInit]);0<c.preInit.length;)c.preInit.pop()();ab();moduleRtn=ba;
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
return moduleRtn;
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
})();
|
|
46
|
+
if (typeof exports === 'object' && typeof module === 'object')
|
|
47
|
+
module.exports = QuickJSRaw;
|
|
48
|
+
else if (typeof define === 'function' && define['amd'])
|
|
49
|
+
define([], () => QuickJSRaw);
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
|
|
2
|
+
var QuickJSRaw = (() => {
|
|
3
|
+
var _scriptName = typeof document != 'undefined' ? document.currentScript?.src : undefined;
|
|
4
|
+
|
|
5
|
+
return (
|
|
6
|
+
function(moduleArg = {}) {
|
|
7
|
+
var moduleRtn;
|
|
8
|
+
|
|
9
|
+
var c=moduleArg,aa,f,ba=new Promise((a,b)=>{aa=a;f=b});function m(a){a={log:a||function(){}};for(const b of m.Va)b(a);return c.quickJSEmscriptenExtensions=a}m.Va=[];c.quickjsEmscriptenInit=m;m.Va.push(a=>{a.getWasmMemory=function(){return p}});var ca=Object.assign({},c),da="./this.program",r="",ea;"undefined"!=typeof document&&document.currentScript&&(r=document.currentScript.src);_scriptName&&(r=_scriptName);r.startsWith("blob:")?r="":r=r.substr(0,r.replace(/[?#].*/,"").lastIndexOf("/")+1);
|
|
10
|
+
ea=a=>fetch(a,{credentials:"same-origin"}).then(b=>b.ok?b.arrayBuffer():Promise.reject(Error(b.status+" : "+b.url)));var fa=c.print||console.log.bind(console),t=c.printErr||console.error.bind(console);Object.assign(c,ca);ca=null;c.thisProgram&&(da=c.thisProgram);var v=c.wasmBinary,p,w=!1,x,z,A,B,C;
|
|
11
|
+
function ha(){var a=p.buffer;c.HEAP8=z=new Int8Array(a);c.HEAP16=new Int16Array(a);c.HEAPU8=A=new Uint8Array(a);c.HEAPU16=new Uint16Array(a);c.HEAP32=B=new Int32Array(a);c.HEAPU32=C=new Uint32Array(a);c.HEAPF32=new Float32Array(a);c.HEAPF64=new Float64Array(a)}c.wasmMemory?p=c.wasmMemory:p=new WebAssembly.Memory({initial:(c.INITIAL_MEMORY||16777216)/65536,maximum:32768});ha();var ia=[],ja=[],ka=[];function la(){var a=c.preRun.shift();ia.unshift(a)}var D=0,F=null,G=null;
|
|
12
|
+
function H(a){c.onAbort?.(a);a="Aborted("+a+")";t(a);w=!0;x=1;a=new WebAssembly.RuntimeError(a+". Build with -sASSERTIONS for more info.");f(a);throw a;}var ma=a=>a.startsWith("data:application/octet-stream;base64,"),I;function na(a){if(a==I&&v)return new Uint8Array(v);throw"both async and sync fetching of the wasm failed";}function oa(a){return v?Promise.resolve().then(()=>na(a)):ea(a).then(b=>new Uint8Array(b),()=>na(a))}
|
|
13
|
+
function pa(a,b,d){return oa(a).then(e=>WebAssembly.instantiate(e,b)).then(d,e=>{t(`failed to asynchronously prepare wasm: ${e}`);H(e)})}function qa(a,b){var d=I;return v||"function"!=typeof WebAssembly.instantiateStreaming||ma(d)||"function"!=typeof fetch?pa(d,a,b):fetch(d,{credentials:"same-origin"}).then(e=>WebAssembly.instantiateStreaming(e,a).then(b,function(g){t(`wasm streaming compile failed: ${g}`);t("falling back to ArrayBuffer instantiation");return pa(d,a,b)}))}
|
|
14
|
+
function ra(a){this.name="ExitStatus";this.message=`Program terminated with exit(${a})`;this.status=a}
|
|
15
|
+
var J=a=>{for(;0<a.length;)a.shift()(c)},K=c.noExitRuntime||!0,sa="undefined"!=typeof TextDecoder?new TextDecoder:void 0,L=(a,b,d)=>{var e=b+d;for(d=b;a[d]&&!(d>=e);)++d;if(16<d-b&&a.buffer&&sa)return sa.decode(a.subarray(b,d));for(e="";b<d;){var g=a[b++];if(g&128){var h=a[b++]&63;if(192==(g&224))e+=String.fromCharCode((g&31)<<6|h);else{var k=a[b++]&63;g=224==(g&240)?(g&15)<<12|h<<6|k:(g&7)<<18|h<<12|k<<6|a[b++]&63;65536>g?e+=String.fromCharCode(g):(g-=65536,e+=String.fromCharCode(55296|g>>10,56320|
|
|
16
|
+
g&1023))}}else e+=String.fromCharCode(g)}return e},ta=[0,31,60,91,121,152,182,213,244,274,305,335],ua=[0,31,59,90,120,151,181,212,243,273,304,334],M={},va=a=>{if(!(a instanceof ra||"unwind"==a))throw a;},N=0,wa=a=>{x=a;K||0<N||(c.onExit?.(a),w=!0);throw new ra(a);},xa=a=>{if(!w)try{if(a(),!(K||0<N))try{x=a=x,wa(a)}catch(b){va(b)}}catch(b){va(b)}},ya;ya=()=>performance.now();
|
|
17
|
+
var O=(a,b,d)=>{var e=A;if(!(0<d))return 0;var g=b;d=b+d-1;for(var h=0;h<a.length;++h){var k=a.charCodeAt(h);if(55296<=k&&57343>=k){var l=a.charCodeAt(++h);k=65536+((k&1023)<<10)|l&1023}if(127>=k){if(b>=d)break;e[b++]=k}else{if(2047>=k){if(b+1>=d)break;e[b++]=192|k>>6}else{if(65535>=k){if(b+2>=d)break;e[b++]=224|k>>12}else{if(b+3>=d)break;e[b++]=240|k>>18;e[b++]=128|k>>12&63}e[b++]=128|k>>6&63}e[b++]=128|k&63}}e[b]=0;return b-g},P={},za=()=>{if(!Q){var a={USER:"web_user",LOGNAME:"web_user",PATH:"/",
|
|
18
|
+
PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:da||"./this.program"},b;for(b in P)void 0===P[b]?delete a[b]:a[b]=P[b];var d=[];for(b in a)d.push(`${b}=${a[b]}`);Q=d}return Q},Q,Aa=[null,[],[]],R=a=>{try{a()}catch(b){H(b)}};
|
|
19
|
+
function Ba(){var a=S,b={};for(let [d,e]of Object.entries(a))b[d]="function"==typeof e?(...g)=>{T.push(d);try{return e(...g)}finally{w||(T.pop(),U&&1===V&&0===T.length&&(V=0,R(Ca),"undefined"!=typeof Fibers&&Fibers.Ya()))}}:e;return b}var V=0,W=81920,U=null,Da=0,T=[],Ea={},Ga={},Ha=0,X=null,Ia=[];function Ja(){return new Promise((a,b)=>{X={resolve:a,reject:b}})}
|
|
20
|
+
function Ka(){var a=La(12+W),b=a+12,d=W;C[a>>2]=b;C[a+4>>2]=b+d;b=T[0];d=Ea[b];void 0===d&&(d=Ha++,Ea[b]=d,Ga[d]=b);B[a+8>>2]=d;return a}
|
|
21
|
+
function Y(a){if(!w){if(0===V){var b=!1,d=!1;a((e=0)=>{if(!w&&(Da=e,b=!0,d)){V=2;R(()=>Ma(U));"undefined"!=typeof Browser&&Browser.Ma.Wa&&Browser.Ma.resume();e=!1;try{var g=(0,S[Ga[B[U+8>>2]]])()}catch(l){g=l,e=!0}var h=!1;if(!U){var k=X;k&&(X=null,(e?k.reject:k.resolve)(g),h=!0)}if(e&&!h)throw g;}});d=!0;b||(V=1,U=Ka(),"undefined"!=typeof Browser&&Browser.Ma.Wa&&Browser.Ma.pause(),R(()=>Na(U)))}else 2===V?(V=0,R(Oa),Pa(U),U=null,Ia.forEach(xa)):H(`invalid state: ${V}`);return Da}}
|
|
22
|
+
var Qa=a=>{for(var b=0,d=0;d<a.length;++d){var e=a.charCodeAt(d);127>=e?b++:2047>=e?b+=2:55296<=e&&57343>=e?(b+=4,++d):b+=3}return b},Ua=(a,b,d,e,g)=>{function h(n){--N;0!==u&&Ra(u);return"string"===b?n?L(A,n):"":"boolean"===b?!!n:n}var k={string:n=>{var y=0;if(null!==n&&void 0!==n&&0!==n){y=Qa(n)+1;var Fa=Sa(y);O(n,Fa,y);y=Fa}return y},array:n=>{var y=Sa(n.length);z.set(n,y);return y}};a=c["_"+a];var l=[],u=0;if(e)for(var q=0;q<e.length;q++){var E=k[d[q]];E?(0===u&&(u=Ta()),l[q]=E(e[q])):l[q]=e[q]}d=
|
|
23
|
+
U;e=a(...l);g=g?.async;N+=1;if(U!=d)return Ja().then(h);e=h(e);return g?Promise.resolve(e):e},Wa={b:(a,b,d,e)=>{H(`Assertion failed: ${a?L(A,a):""}, at: `+[b?b?L(A,b):"":"unknown filename",d,e?e?L(A,e):"":"unknown function"])},q:()=>{H("")},n:()=>{K=!1;N=0},j:function(a,b,d){a=new Date(1E3*(b+2097152>>>0<4194305-!!a?(a>>>0)+4294967296*b:NaN));B[d>>2]=a.getSeconds();B[d+4>>2]=a.getMinutes();B[d+8>>2]=a.getHours();B[d+12>>2]=a.getDate();B[d+16>>2]=a.getMonth();B[d+20>>2]=a.getFullYear()-1900;B[d+24>>
|
|
24
|
+
2]=a.getDay();b=a.getFullYear();B[d+28>>2]=(0!==b%4||0===b%100&&0!==b%400?ua:ta)[a.getMonth()]+a.getDate()-1|0;B[d+36>>2]=-(60*a.getTimezoneOffset());b=(new Date(a.getFullYear(),6,1)).getTimezoneOffset();var e=(new Date(a.getFullYear(),0,1)).getTimezoneOffset();B[d+32>>2]=(b!=e&&a.getTimezoneOffset()==Math.min(e,b))|0},l:(a,b)=>{M[a]&&(clearTimeout(M[a].id),delete M[a]);if(!b)return 0;var d=setTimeout(()=>{delete M[a];xa(()=>Va(a,ya()))},b);M[a]={id:d,Xa:b};return 0},o:(a,b,d,e)=>{var g=(new Date).getFullYear(),
|
|
25
|
+
h=(new Date(g,0,1)).getTimezoneOffset();g=(new Date(g,6,1)).getTimezoneOffset();C[a>>2]=60*Math.max(h,g);B[b>>2]=Number(h!=g);b=k=>{var l=Math.abs(k);return`UTC${0<=k?"-":"+"}${String(Math.floor(l/60)).padStart(2,"0")}${String(l%60).padStart(2,"0")}`};a=b(h);b=b(g);g<h?(O(a,d,17),O(b,e,17)):(O(a,e,17),O(b,d,17))},p:()=>Date.now(),m:a=>{var b=A.length;a>>>=0;if(2147483648<a)return!1;for(var d=1;4>=d;d*=2){var e=b*(1+.2/d);e=Math.min(e,a+100663296);a:{e=(Math.min(2147483648,65536*Math.ceil(Math.max(a,
|
|
26
|
+
e)/65536))-p.buffer.byteLength+65535)/65536;try{p.grow(e);ha();var g=1;break a}catch(h){}g=void 0}if(g)return!0}return!1},e:(a,b)=>{var d=0;za().forEach((e,g)=>{var h=b+d;g=C[a+4*g>>2]=h;for(h=0;h<e.length;++h)z[g++]=e.charCodeAt(h);z[g]=0;d+=e.length+1});return 0},f:(a,b)=>{var d=za();C[a>>2]=d.length;var e=0;d.forEach(g=>e+=g.length+1);C[b>>2]=e;return 0},d:()=>52,k:function(){return 70},c:(a,b,d,e)=>{for(var g=0,h=0;h<d;h++){var k=C[b>>2],l=C[b+4>>2];b+=8;for(var u=0;u<l;u++){var q=A[k+u],E=Aa[a];
|
|
27
|
+
0===q||10===q?((1===a?fa:t)(L(E,0)),E.length=0):E.push(q)}g+=l}C[e>>2]=g;return 0},a:p,r:wa,s:function(a,b,d,e,g){return c.callbacks.callFunction({handleSleep:Y},a,b,d,e,g)},i:function(a){return c.callbacks.shouldInterrupt(void 0,a)},h:function(a,b,d){const e={handleSleep:Y};d=d?L(A,d):"";return c.callbacks.loadModuleSource(e,a,b,d)},g:function(a,b,d,e){const g={handleSleep:Y};d=d?L(A,d):"";e=e?L(A,e):"";return c.callbacks.normalizeModule(g,a,b,d,e)},t:function(a,b){W=a||b}},S=function(){function a(d){S=
|
|
28
|
+
d.exports;S=Ba();ja.unshift(S.u);D--;c.monitorRunDependencies?.(D);0==D&&(null!==F&&(clearInterval(F),F=null),G&&(d=G,G=null,d()));return S}var b={a:Wa};D++;c.monitorRunDependencies?.(D);if(c.instantiateWasm)try{return c.instantiateWasm(b,a)}catch(d){t(`Module.instantiateWasm callback failed with error: ${d}`),f(d)}I||=ma("emscripten-module.wasm")?"emscripten-module.wasm":c.locateFile?c.locateFile("emscripten-module.wasm",r):r+"emscripten-module.wasm";qa(b,function(d){a(d.instance)}).catch(f);return{}}(),
|
|
29
|
+
La=c._malloc=a=>(La=c._malloc=S.v)(a);c._QTS_Throw=(a,b)=>(c._QTS_Throw=S.w)(a,b);c._QTS_NewError=a=>(c._QTS_NewError=S.x)(a);c._QTS_RuntimeSetMemoryLimit=(a,b)=>(c._QTS_RuntimeSetMemoryLimit=S.y)(a,b);c._QTS_RuntimeComputeMemoryUsage=(a,b)=>(c._QTS_RuntimeComputeMemoryUsage=S.z)(a,b);c._QTS_RuntimeDumpMemoryUsage=a=>(c._QTS_RuntimeDumpMemoryUsage=S.A)(a);c._QTS_RecoverableLeakCheck=()=>(c._QTS_RecoverableLeakCheck=S.B)();c._QTS_BuildIsSanitizeLeak=()=>(c._QTS_BuildIsSanitizeLeak=S.C)();
|
|
30
|
+
c._QTS_RuntimeSetMaxStackSize=(a,b)=>(c._QTS_RuntimeSetMaxStackSize=S.D)(a,b);c._QTS_GetUndefined=()=>(c._QTS_GetUndefined=S.E)();c._QTS_GetNull=()=>(c._QTS_GetNull=S.F)();c._QTS_GetFalse=()=>(c._QTS_GetFalse=S.G)();c._QTS_GetTrue=()=>(c._QTS_GetTrue=S.H)();c._QTS_NewRuntime=()=>(c._QTS_NewRuntime=S.I)();c._QTS_FreeRuntime=a=>(c._QTS_FreeRuntime=S.J)(a);var Pa=c._free=a=>(Pa=c._free=S.K)(a);c._QTS_NewContext=(a,b)=>(c._QTS_NewContext=S.L)(a,b);c._QTS_FreeContext=a=>(c._QTS_FreeContext=S.M)(a);
|
|
31
|
+
c._QTS_FreeValuePointer=(a,b)=>(c._QTS_FreeValuePointer=S.N)(a,b);c._QTS_FreeValuePointerRuntime=(a,b)=>(c._QTS_FreeValuePointerRuntime=S.O)(a,b);c._QTS_FreeVoidPointer=(a,b)=>(c._QTS_FreeVoidPointer=S.P)(a,b);c._QTS_FreeCString=(a,b)=>(c._QTS_FreeCString=S.Q)(a,b);c._QTS_DupValuePointer=(a,b)=>(c._QTS_DupValuePointer=S.R)(a,b);c._QTS_NewObject=a=>(c._QTS_NewObject=S.S)(a);c._QTS_NewObjectProto=(a,b)=>(c._QTS_NewObjectProto=S.T)(a,b);c._QTS_NewArray=a=>(c._QTS_NewArray=S.U)(a);
|
|
32
|
+
c._QTS_NewArrayBuffer=(a,b,d)=>(c._QTS_NewArrayBuffer=S.V)(a,b,d);c._QTS_NewFloat64=(a,b)=>(c._QTS_NewFloat64=S.W)(a,b);c._QTS_GetFloat64=(a,b)=>(c._QTS_GetFloat64=S.X)(a,b);c._QTS_NewString=(a,b)=>(c._QTS_NewString=S.Y)(a,b);c._QTS_GetString=(a,b)=>(c._QTS_GetString=S.Z)(a,b);c._QTS_GetArrayBuffer=(a,b)=>(c._QTS_GetArrayBuffer=S._)(a,b);c._QTS_GetArrayBufferLength=(a,b)=>(c._QTS_GetArrayBufferLength=S.$)(a,b);c._QTS_NewSymbol=(a,b,d)=>(c._QTS_NewSymbol=S.aa)(a,b,d);
|
|
33
|
+
c._QTS_GetSymbolDescriptionOrKey=(a,b)=>(c._QTS_GetSymbolDescriptionOrKey=S.ba)(a,b);c._QTS_IsGlobalSymbol=(a,b)=>(c._QTS_IsGlobalSymbol=S.ca)(a,b);c._QTS_IsJobPending=a=>(c._QTS_IsJobPending=S.da)(a);c._QTS_ExecutePendingJob=(a,b,d)=>(c._QTS_ExecutePendingJob=S.ea)(a,b,d);c._QTS_GetProp=(a,b,d)=>(c._QTS_GetProp=S.fa)(a,b,d);c._QTS_GetPropNumber=(a,b,d)=>(c._QTS_GetPropNumber=S.ga)(a,b,d);c._QTS_SetProp=(a,b,d,e)=>(c._QTS_SetProp=S.ha)(a,b,d,e);
|
|
34
|
+
c._QTS_DefineProp=(a,b,d,e,g,h,k,l,u)=>(c._QTS_DefineProp=S.ia)(a,b,d,e,g,h,k,l,u);c._QTS_GetOwnPropertyNames=(a,b,d,e,g)=>(c._QTS_GetOwnPropertyNames=S.ja)(a,b,d,e,g);c._QTS_Call=(a,b,d,e,g)=>(c._QTS_Call=S.ka)(a,b,d,e,g);c._QTS_ResolveException=(a,b)=>(c._QTS_ResolveException=S.la)(a,b);c._QTS_Dump=(a,b)=>(c._QTS_Dump=S.ma)(a,b);c._QTS_Eval=(a,b,d,e,g,h)=>(c._QTS_Eval=S.na)(a,b,d,e,g,h);c._QTS_GetModuleNamespace=(a,b)=>(c._QTS_GetModuleNamespace=S.oa)(a,b);
|
|
35
|
+
c._QTS_Typeof=(a,b)=>(c._QTS_Typeof=S.pa)(a,b);c._QTS_GetLength=(a,b,d)=>(c._QTS_GetLength=S.qa)(a,b,d);c._QTS_IsEqual=(a,b,d,e)=>(c._QTS_IsEqual=S.ra)(a,b,d,e);c._QTS_GetGlobalObject=a=>(c._QTS_GetGlobalObject=S.sa)(a);c._QTS_NewPromiseCapability=(a,b)=>(c._QTS_NewPromiseCapability=S.ta)(a,b);c._QTS_PromiseState=(a,b)=>(c._QTS_PromiseState=S.ua)(a,b);c._QTS_PromiseResult=(a,b)=>(c._QTS_PromiseResult=S.va)(a,b);c._QTS_TestStringArg=a=>(c._QTS_TestStringArg=S.wa)(a);
|
|
36
|
+
c._QTS_GetDebugLogEnabled=a=>(c._QTS_GetDebugLogEnabled=S.xa)(a);c._QTS_SetDebugLogEnabled=(a,b)=>(c._QTS_SetDebugLogEnabled=S.ya)(a,b);c._QTS_BuildIsDebug=()=>(c._QTS_BuildIsDebug=S.za)();c._QTS_BuildIsAsyncify=()=>(c._QTS_BuildIsAsyncify=S.Aa)();c._QTS_NewFunction=(a,b,d)=>(c._QTS_NewFunction=S.Ba)(a,b,d);c._QTS_ArgvGetJSValueConstPointer=(a,b)=>(c._QTS_ArgvGetJSValueConstPointer=S.Ca)(a,b);c._QTS_RuntimeEnableInterruptHandler=a=>(c._QTS_RuntimeEnableInterruptHandler=S.Da)(a);
|
|
37
|
+
c._QTS_RuntimeDisableInterruptHandler=a=>(c._QTS_RuntimeDisableInterruptHandler=S.Ea)(a);c._QTS_RuntimeEnableModuleLoader=(a,b)=>(c._QTS_RuntimeEnableModuleLoader=S.Fa)(a,b);c._QTS_RuntimeDisableModuleLoader=a=>(c._QTS_RuntimeDisableModuleLoader=S.Ga)(a);c._QTS_bjson_encode=(a,b)=>(c._QTS_bjson_encode=S.Ha)(a,b);c._QTS_bjson_decode=(a,b)=>(c._QTS_bjson_decode=S.Ia)(a,b);c._QTS_EvalFunction=(a,b)=>(c._QTS_EvalFunction=S.Ja)(a,b);c._QTS_EncodeBytecode=(a,b)=>(c._QTS_EncodeBytecode=S.Ka)(a,b);
|
|
38
|
+
c._QTS_DecodeBytecode=(a,b)=>(c._QTS_DecodeBytecode=S.La)(a,b);var Va=(a,b)=>(Va=S.Na)(a,b),Ra=a=>(Ra=S.Oa)(a),Sa=a=>(Sa=S.Pa)(a),Ta=()=>(Ta=S.Qa)(),Na=a=>(Na=S.Ra)(a),Ca=()=>(Ca=S.Sa)(),Ma=a=>(Ma=S.Ta)(a),Oa=()=>(Oa=S.Ua)();c.cwrap=(a,b,d,e)=>{var g=!d||d.every(h=>"number"===h||"boolean"===h);return"string"!==b&&g&&!e?c["_"+a]:(...h)=>Ua(a,b,d,h,e)};c.UTF8ToString=(a,b)=>a?L(A,a,b):"";c.stringToUTF8=(a,b,d)=>O(a,b,d);c.lengthBytesUTF8=Qa;var Z;G=function Xa(){Z||Ya();Z||(G=Xa)};
|
|
39
|
+
function Ya(){function a(){if(!Z&&(Z=!0,c.calledRun=!0,!w)){J(ja);aa(c);c.onRuntimeInitialized?.();if(c.postRun)for("function"==typeof c.postRun&&(c.postRun=[c.postRun]);c.postRun.length;){var b=c.postRun.shift();ka.unshift(b)}J(ka)}}if(!(0<D)){if(c.preRun)for("function"==typeof c.preRun&&(c.preRun=[c.preRun]);c.preRun.length;)la();J(ia);0<D||(c.setStatus?(c.setStatus("Running..."),setTimeout(function(){setTimeout(function(){c.setStatus("")},1);a()},1)):a())}}
|
|
40
|
+
if(c.preInit)for("function"==typeof c.preInit&&(c.preInit=[c.preInit]);0<c.preInit.length;)c.preInit.pop()();Ya();moduleRtn=ba;
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
return moduleRtn;
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
})();
|
|
47
|
+
if (typeof exports === 'object' && typeof module === 'object')
|
|
48
|
+
module.exports = QuickJSRaw;
|
|
49
|
+
else if (typeof define === 'function' && define['amd'])
|
|
50
|
+
define([], () => QuickJSRaw);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Generated from ../../templates/emscripten-module.ASYNCIFY.d.ts
|
|
2
|
+
import type {
|
|
3
|
+
EmscriptenModuleLoader,
|
|
4
|
+
QuickJSAsyncEmscriptenModule,
|
|
5
|
+
} from "@componentor/quickjs-ffi-types"
|
|
6
|
+
/**
|
|
7
|
+
* Emscripten module built from [`quickjs/quickjs.h`](../quickjs/quickjs.h) and
|
|
8
|
+
* our FFI support functions [c/interface.c](../c/interface.c), compiled with -s
|
|
9
|
+
* ASYNCIFY=1.
|
|
10
|
+
*
|
|
11
|
+
* Because this version is built with ASYNCIFY, the C code can call asynchronous
|
|
12
|
+
* Javascript functions as though they were synchronous.
|
|
13
|
+
*
|
|
14
|
+
* Note that emscripten modules returned by a `MODULARIZE=1` emscripten build
|
|
15
|
+
* (like this one) load asynchronously.
|
|
16
|
+
*/
|
|
17
|
+
declare const ModuleLoader: EmscriptenModuleLoader<QuickJSAsyncEmscriptenModule>
|
|
18
|
+
export default ModuleLoader
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Generated from ../../templates/emscripten-module.ASYNCIFY.d.ts
|
|
2
|
+
import type {
|
|
3
|
+
EmscriptenModuleLoader,
|
|
4
|
+
QuickJSAsyncEmscriptenModule,
|
|
5
|
+
} from "@componentor/quickjs-ffi-types"
|
|
6
|
+
/**
|
|
7
|
+
* Emscripten module built from [`quickjs/quickjs.h`](../quickjs/quickjs.h) and
|
|
8
|
+
* our FFI support functions [c/interface.c](../c/interface.c), compiled with -s
|
|
9
|
+
* ASYNCIFY=1.
|
|
10
|
+
*
|
|
11
|
+
* Because this version is built with ASYNCIFY, the C code can call asynchronous
|
|
12
|
+
* Javascript functions as though they were synchronous.
|
|
13
|
+
*
|
|
14
|
+
* Note that emscripten modules returned by a `MODULARIZE=1` emscripten build
|
|
15
|
+
* (like this one) load asynchronously.
|
|
16
|
+
*/
|
|
17
|
+
declare const ModuleLoader: EmscriptenModuleLoader<QuickJSAsyncEmscriptenModule>
|
|
18
|
+
export default ModuleLoader
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
|
|
2
|
+
var QuickJSRaw = (() => {
|
|
3
|
+
var _scriptName = import.meta.url;
|
|
4
|
+
|
|
5
|
+
return (
|
|
6
|
+
async function(moduleArg = {}) {
|
|
7
|
+
var moduleRtn;
|
|
8
|
+
|
|
9
|
+
var c=moduleArg,aa,f,ba=new Promise((a,b)=>{aa=a;f=b}),ca="object"==typeof window,m="function"==typeof importScripts,p="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node;if(p){const {createRequire:a}=await import("module");var require=a(import.meta.url)}function q(a){a={log:a||function(){}};for(const b of q.Va)b(a);return c.quickJSEmscriptenExtensions=a}q.Va=[];c.quickjsEmscriptenInit=q;q.Va.push(a=>{a.getWasmMemory=function(){return t}});
|
|
10
|
+
var da=Object.assign({},c),u="./this.program",w=(a,b)=>{throw b;},x="",z,A;
|
|
11
|
+
if(p){var fs=require("fs"),ea=require("path");x=require("url").fileURLToPath(new URL("./",import.meta.url));A=a=>{a=B(a)?new URL(a):ea.normalize(a);return fs.readFileSync(a)};z=a=>{a=B(a)?new URL(a):ea.normalize(a);return new Promise((b,d)=>{fs.readFile(a,void 0,(e,g)=>{e?d(e):b(g.buffer)})})};!c.thisProgram&&1<process.argv.length&&(u=process.argv[1].replace(/\\/g,"/"));process.argv.slice(2);w=(a,b)=>{process.exitCode=a;throw b;}}else if(ca||m)m?x=self.location.href:"undefined"!=typeof document&&
|
|
12
|
+
document.currentScript&&(x=document.currentScript.src),_scriptName&&(x=_scriptName),x.startsWith("blob:")?x="":x=x.substr(0,x.replace(/[?#].*/,"").lastIndexOf("/")+1),m&&(A=a=>{var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";b.send(null);return new Uint8Array(b.response)}),z=a=>B(a)?new Promise((b,d)=>{var e=new XMLHttpRequest;e.open("GET",a,!0);e.responseType="arraybuffer";e.onload=()=>{200==e.status||0==e.status&&e.response?b(e.response):d(e.status)};e.onerror=d;e.send(null)}):
|
|
13
|
+
fetch(a,{credentials:"same-origin"}).then(b=>b.ok?b.arrayBuffer():Promise.reject(Error(b.status+" : "+b.url)));var fa=c.print||console.log.bind(console),C=c.printErr||console.error.bind(console);Object.assign(c,da);da=null;c.thisProgram&&(u=c.thisProgram);var D=c.wasmBinary,t,F=!1,G,H,I,J,K;
|
|
14
|
+
function ha(){var a=t.buffer;c.HEAP8=H=new Int8Array(a);c.HEAP16=new Int16Array(a);c.HEAPU8=I=new Uint8Array(a);c.HEAPU16=new Uint16Array(a);c.HEAP32=J=new Int32Array(a);c.HEAPU32=K=new Uint32Array(a);c.HEAPF32=new Float32Array(a);c.HEAPF64=new Float64Array(a)}c.wasmMemory?t=c.wasmMemory:t=new WebAssembly.Memory({initial:(c.INITIAL_MEMORY||16777216)/65536,maximum:32768});ha();var ia=[],ja=[],ka=[];function la(){var a=c.preRun.shift();ia.unshift(a)}var L=0,M=null,N=null;
|
|
15
|
+
function O(a){c.onAbort?.(a);a="Aborted("+a+")";C(a);F=!0;G=1;a=new WebAssembly.RuntimeError(a+". Build with -sASSERTIONS for more info.");f(a);throw a;}var ma=a=>a.startsWith("data:application/octet-stream;base64,"),B=a=>a.startsWith("file://"),P;function na(a){if(a==P&&D)return new Uint8Array(D);if(A)return A(a);throw"both async and sync fetching of the wasm failed";}function oa(a){return D?Promise.resolve().then(()=>na(a)):z(a).then(b=>new Uint8Array(b),()=>na(a))}
|
|
16
|
+
function pa(a,b,d){return oa(a).then(e=>WebAssembly.instantiate(e,b)).then(d,e=>{C(`failed to asynchronously prepare wasm: ${e}`);O(e)})}function qa(a,b){var d=P;return D||"function"!=typeof WebAssembly.instantiateStreaming||ma(d)||B(d)||p||"function"!=typeof fetch?pa(d,a,b):fetch(d,{credentials:"same-origin"}).then(e=>WebAssembly.instantiateStreaming(e,a).then(b,function(g){C(`wasm streaming compile failed: ${g}`);C("falling back to ArrayBuffer instantiation");return pa(d,a,b)}))}
|
|
17
|
+
function ra(a){this.name="ExitStatus";this.message=`Program terminated with exit(${a})`;this.status=a}
|
|
18
|
+
var sa=a=>{for(;0<a.length;)a.shift()(c)},ta=c.noExitRuntime||!0,ua="undefined"!=typeof TextDecoder?new TextDecoder:void 0,Q=(a,b,d)=>{var e=b+d;for(d=b;a[d]&&!(d>=e);)++d;if(16<d-b&&a.buffer&&ua)return ua.decode(a.subarray(b,d));for(e="";b<d;){var g=a[b++];if(g&128){var h=a[b++]&63;if(192==(g&224))e+=String.fromCharCode((g&31)<<6|h);else{var k=a[b++]&63;g=224==(g&240)?(g&15)<<12|h<<6|k:(g&7)<<18|h<<12|k<<6|a[b++]&63;65536>g?e+=String.fromCharCode(g):(g-=65536,e+=String.fromCharCode(55296|g>>10,56320|
|
|
19
|
+
g&1023))}}else e+=String.fromCharCode(g)}return e},va=[0,31,60,91,121,152,182,213,244,274,305,335],wa=[0,31,59,90,120,151,181,212,243,273,304,334],R={},S=0,xa=a=>{G=a;ta||0<S||(c.onExit?.(a),F=!0);w(a,new ra(a))},ya=a=>{if(!F)try{if(a(),!(ta||0<S))try{G=a=G,xa(a)}catch(b){b instanceof ra||"unwind"==b||w(1,b)}}catch(b){b instanceof ra||"unwind"==b||w(1,b)}},za;za=()=>performance.now();
|
|
20
|
+
var T=(a,b,d)=>{var e=I;if(!(0<d))return 0;var g=b;d=b+d-1;for(var h=0;h<a.length;++h){var k=a.charCodeAt(h);if(55296<=k&&57343>=k){var l=a.charCodeAt(++h);k=65536+((k&1023)<<10)|l&1023}if(127>=k){if(b>=d)break;e[b++]=k}else{if(2047>=k){if(b+1>=d)break;e[b++]=192|k>>6}else{if(65535>=k){if(b+2>=d)break;e[b++]=224|k>>12}else{if(b+3>=d)break;e[b++]=240|k>>18;e[b++]=128|k>>12&63}e[b++]=128|k>>6&63}e[b++]=128|k&63}}e[b]=0;return b-g},Aa={},Ca=()=>{if(!Ba){var a={USER:"web_user",LOGNAME:"web_user",PATH:"/",
|
|
21
|
+
PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:u||"./this.program"},b;for(b in Aa)void 0===Aa[b]?delete a[b]:a[b]=Aa[b];var d=[];for(b in a)d.push(`${b}=${a[b]}`);Ba=d}return Ba},Ba,Da=[null,[],[]],U=a=>{try{a()}catch(b){O(b)}};
|
|
22
|
+
function Ea(){var a=V,b={};for(let [d,e]of Object.entries(a))b[d]="function"==typeof e?(...g)=>{W.push(d);try{return e(...g)}finally{F||(W.pop(),X&&1===Y&&0===W.length&&(Y=0,U(Fa),"undefined"!=typeof Fibers&&Fibers.Ya()))}}:e;return b}var Y=0,Ga=81920,X=null,Ha=0,W=[],Ia={},Ja={},La=0,Ma=null,Na=[];function Oa(){return new Promise((a,b)=>{Ma={resolve:a,reject:b}})}
|
|
23
|
+
function Pa(){var a=Qa(12+Ga),b=a+12,d=Ga;K[a>>2]=b;K[a+4>>2]=b+d;b=W[0];d=Ia[b];void 0===d&&(d=La++,Ia[b]=d,Ja[d]=b);J[a+8>>2]=d;return a}
|
|
24
|
+
function Ra(a){if(!F){if(0===Y){var b=!1,d=!1;a((e=0)=>{if(!F&&(Ha=e,b=!0,d)){Y=2;U(()=>Sa(X));"undefined"!=typeof Browser&&Browser.Ma.Wa&&Browser.Ma.resume();e=!1;try{var g=(0,V[Ja[J[X+8>>2]]])()}catch(l){g=l,e=!0}var h=!1;if(!X){var k=Ma;k&&(Ma=null,(e?k.reject:k.resolve)(g),h=!0)}if(e&&!h)throw g;}});d=!0;b||(Y=1,X=Pa(),"undefined"!=typeof Browser&&Browser.Ma.Wa&&Browser.Ma.pause(),U(()=>Ta(X)))}else 2===Y?(Y=0,U(Ua),Va(X),X=null,Na.forEach(ya)):O(`invalid state: ${Y}`);return Ha}}
|
|
25
|
+
var Wa=a=>{for(var b=0,d=0;d<a.length;++d){var e=a.charCodeAt(d);127>=e?b++:2047>=e?b+=2:55296<=e&&57343>=e?(b+=4,++d):b+=3}return b},$a=(a,b,d,e,g)=>{function h(n){--S;0!==v&&Xa(v);return"string"===b?n?Q(I,n):"":"boolean"===b?!!n:n}var k={string:n=>{var y=0;if(null!==n&&void 0!==n&&0!==n){y=Wa(n)+1;var Ka=Ya(y);T(n,Ka,y);y=Ka}return y},array:n=>{var y=Ya(n.length);H.set(n,y);return y}};a=c["_"+a];var l=[],v=0;if(e)for(var r=0;r<e.length;r++){var E=k[d[r]];E?(0===v&&(v=Za()),l[r]=E(e[r])):l[r]=e[r]}d=
|
|
26
|
+
X;e=a(...l);g=g?.async;S+=1;if(X!=d)return Oa().then(h);e=h(e);return g?Promise.resolve(e):e},bb={b:(a,b,d,e)=>{O(`Assertion failed: ${a?Q(I,a):""}, at: `+[b?b?Q(I,b):"":"unknown filename",d,e?e?Q(I,e):"":"unknown function"])},q:()=>{O("")},n:()=>{ta=!1;S=0},j:function(a,b,d){a=new Date(1E3*(b+2097152>>>0<4194305-!!a?(a>>>0)+4294967296*b:NaN));J[d>>2]=a.getSeconds();J[d+4>>2]=a.getMinutes();J[d+8>>2]=a.getHours();J[d+12>>2]=a.getDate();J[d+16>>2]=a.getMonth();J[d+20>>2]=a.getFullYear()-1900;J[d+24>>
|
|
27
|
+
2]=a.getDay();b=a.getFullYear();J[d+28>>2]=(0!==b%4||0===b%100&&0!==b%400?wa:va)[a.getMonth()]+a.getDate()-1|0;J[d+36>>2]=-(60*a.getTimezoneOffset());b=(new Date(a.getFullYear(),6,1)).getTimezoneOffset();var e=(new Date(a.getFullYear(),0,1)).getTimezoneOffset();J[d+32>>2]=(b!=e&&a.getTimezoneOffset()==Math.min(e,b))|0},l:(a,b)=>{R[a]&&(clearTimeout(R[a].id),delete R[a]);if(!b)return 0;var d=setTimeout(()=>{delete R[a];ya(()=>ab(a,za()))},b);R[a]={id:d,Xa:b};return 0},o:(a,b,d,e)=>{var g=(new Date).getFullYear(),
|
|
28
|
+
h=(new Date(g,0,1)).getTimezoneOffset();g=(new Date(g,6,1)).getTimezoneOffset();K[a>>2]=60*Math.max(h,g);J[b>>2]=Number(h!=g);b=k=>{var l=Math.abs(k);return`UTC${0<=k?"-":"+"}${String(Math.floor(l/60)).padStart(2,"0")}${String(l%60).padStart(2,"0")}`};a=b(h);b=b(g);g<h?(T(a,d,17),T(b,e,17)):(T(a,e,17),T(b,d,17))},p:()=>Date.now(),m:a=>{var b=I.length;a>>>=0;if(2147483648<a)return!1;for(var d=1;4>=d;d*=2){var e=b*(1+.2/d);e=Math.min(e,a+100663296);a:{e=(Math.min(2147483648,65536*Math.ceil(Math.max(a,
|
|
29
|
+
e)/65536))-t.buffer.byteLength+65535)/65536;try{t.grow(e);ha();var g=1;break a}catch(h){}g=void 0}if(g)return!0}return!1},e:(a,b)=>{var d=0;Ca().forEach((e,g)=>{var h=b+d;g=K[a+4*g>>2]=h;for(h=0;h<e.length;++h)H[g++]=e.charCodeAt(h);H[g]=0;d+=e.length+1});return 0},f:(a,b)=>{var d=Ca();K[a>>2]=d.length;var e=0;d.forEach(g=>e+=g.length+1);K[b>>2]=e;return 0},d:()=>52,k:function(){return 70},c:(a,b,d,e)=>{for(var g=0,h=0;h<d;h++){var k=K[b>>2],l=K[b+4>>2];b+=8;for(var v=0;v<l;v++){var r=I[k+v],E=Da[a];
|
|
30
|
+
0===r||10===r?((1===a?fa:C)(Q(E,0)),E.length=0):E.push(r)}g+=l}K[e>>2]=g;return 0},a:t,r:xa,s:function(a,b,d,e,g){return c.callbacks.callFunction({handleSleep:Ra},a,b,d,e,g)},i:function(a){return c.callbacks.shouldInterrupt(void 0,a)},h:function(a,b,d){const e={handleSleep:Ra};d=d?Q(I,d):"";return c.callbacks.loadModuleSource(e,a,b,d)},g:function(a,b,d,e){const g={handleSleep:Ra};d=d?Q(I,d):"";e=e?Q(I,e):"";return c.callbacks.normalizeModule(g,a,b,d,e)},t:function(a,b){Ga=a||b}},V=function(){function a(d){V=
|
|
31
|
+
d.exports;V=Ea();ja.unshift(V.u);L--;c.monitorRunDependencies?.(L);0==L&&(null!==M&&(clearInterval(M),M=null),N&&(d=N,N=null,d()));return V}var b={a:bb};L++;c.monitorRunDependencies?.(L);if(c.instantiateWasm)try{return c.instantiateWasm(b,a)}catch(d){C(`Module.instantiateWasm callback failed with error: ${d}`),f(d)}P||=c.locateFile?ma("emscripten-module.wasm")?"emscripten-module.wasm":c.locateFile?c.locateFile("emscripten-module.wasm",x):x+"emscripten-module.wasm":(new URL("emscripten-module.wasm",
|
|
32
|
+
import.meta.url)).href;qa(b,function(d){a(d.instance)}).catch(f);return{}}(),Qa=c._malloc=a=>(Qa=c._malloc=V.v)(a);c._QTS_Throw=(a,b)=>(c._QTS_Throw=V.w)(a,b);c._QTS_NewError=a=>(c._QTS_NewError=V.x)(a);c._QTS_RuntimeSetMemoryLimit=(a,b)=>(c._QTS_RuntimeSetMemoryLimit=V.y)(a,b);c._QTS_RuntimeComputeMemoryUsage=(a,b)=>(c._QTS_RuntimeComputeMemoryUsage=V.z)(a,b);c._QTS_RuntimeDumpMemoryUsage=a=>(c._QTS_RuntimeDumpMemoryUsage=V.A)(a);
|
|
33
|
+
c._QTS_RecoverableLeakCheck=()=>(c._QTS_RecoverableLeakCheck=V.B)();c._QTS_BuildIsSanitizeLeak=()=>(c._QTS_BuildIsSanitizeLeak=V.C)();c._QTS_RuntimeSetMaxStackSize=(a,b)=>(c._QTS_RuntimeSetMaxStackSize=V.D)(a,b);c._QTS_GetUndefined=()=>(c._QTS_GetUndefined=V.E)();c._QTS_GetNull=()=>(c._QTS_GetNull=V.F)();c._QTS_GetFalse=()=>(c._QTS_GetFalse=V.G)();c._QTS_GetTrue=()=>(c._QTS_GetTrue=V.H)();c._QTS_NewRuntime=()=>(c._QTS_NewRuntime=V.I)();c._QTS_FreeRuntime=a=>(c._QTS_FreeRuntime=V.J)(a);
|
|
34
|
+
var Va=c._free=a=>(Va=c._free=V.K)(a);c._QTS_NewContext=(a,b)=>(c._QTS_NewContext=V.L)(a,b);c._QTS_FreeContext=a=>(c._QTS_FreeContext=V.M)(a);c._QTS_FreeValuePointer=(a,b)=>(c._QTS_FreeValuePointer=V.N)(a,b);c._QTS_FreeValuePointerRuntime=(a,b)=>(c._QTS_FreeValuePointerRuntime=V.O)(a,b);c._QTS_FreeVoidPointer=(a,b)=>(c._QTS_FreeVoidPointer=V.P)(a,b);c._QTS_FreeCString=(a,b)=>(c._QTS_FreeCString=V.Q)(a,b);c._QTS_DupValuePointer=(a,b)=>(c._QTS_DupValuePointer=V.R)(a,b);
|
|
35
|
+
c._QTS_NewObject=a=>(c._QTS_NewObject=V.S)(a);c._QTS_NewObjectProto=(a,b)=>(c._QTS_NewObjectProto=V.T)(a,b);c._QTS_NewArray=a=>(c._QTS_NewArray=V.U)(a);c._QTS_NewArrayBuffer=(a,b,d)=>(c._QTS_NewArrayBuffer=V.V)(a,b,d);c._QTS_NewFloat64=(a,b)=>(c._QTS_NewFloat64=V.W)(a,b);c._QTS_GetFloat64=(a,b)=>(c._QTS_GetFloat64=V.X)(a,b);c._QTS_NewString=(a,b)=>(c._QTS_NewString=V.Y)(a,b);c._QTS_GetString=(a,b)=>(c._QTS_GetString=V.Z)(a,b);c._QTS_GetArrayBuffer=(a,b)=>(c._QTS_GetArrayBuffer=V._)(a,b);
|
|
36
|
+
c._QTS_GetArrayBufferLength=(a,b)=>(c._QTS_GetArrayBufferLength=V.$)(a,b);c._QTS_NewSymbol=(a,b,d)=>(c._QTS_NewSymbol=V.aa)(a,b,d);c._QTS_GetSymbolDescriptionOrKey=(a,b)=>(c._QTS_GetSymbolDescriptionOrKey=V.ba)(a,b);c._QTS_IsGlobalSymbol=(a,b)=>(c._QTS_IsGlobalSymbol=V.ca)(a,b);c._QTS_IsJobPending=a=>(c._QTS_IsJobPending=V.da)(a);c._QTS_ExecutePendingJob=(a,b,d)=>(c._QTS_ExecutePendingJob=V.ea)(a,b,d);c._QTS_GetProp=(a,b,d)=>(c._QTS_GetProp=V.fa)(a,b,d);
|
|
37
|
+
c._QTS_GetPropNumber=(a,b,d)=>(c._QTS_GetPropNumber=V.ga)(a,b,d);c._QTS_SetProp=(a,b,d,e)=>(c._QTS_SetProp=V.ha)(a,b,d,e);c._QTS_DefineProp=(a,b,d,e,g,h,k,l,v)=>(c._QTS_DefineProp=V.ia)(a,b,d,e,g,h,k,l,v);c._QTS_GetOwnPropertyNames=(a,b,d,e,g)=>(c._QTS_GetOwnPropertyNames=V.ja)(a,b,d,e,g);c._QTS_Call=(a,b,d,e,g)=>(c._QTS_Call=V.ka)(a,b,d,e,g);c._QTS_ResolveException=(a,b)=>(c._QTS_ResolveException=V.la)(a,b);c._QTS_Dump=(a,b)=>(c._QTS_Dump=V.ma)(a,b);
|
|
38
|
+
c._QTS_Eval=(a,b,d,e,g,h)=>(c._QTS_Eval=V.na)(a,b,d,e,g,h);c._QTS_GetModuleNamespace=(a,b)=>(c._QTS_GetModuleNamespace=V.oa)(a,b);c._QTS_Typeof=(a,b)=>(c._QTS_Typeof=V.pa)(a,b);c._QTS_GetLength=(a,b,d)=>(c._QTS_GetLength=V.qa)(a,b,d);c._QTS_IsEqual=(a,b,d,e)=>(c._QTS_IsEqual=V.ra)(a,b,d,e);c._QTS_GetGlobalObject=a=>(c._QTS_GetGlobalObject=V.sa)(a);c._QTS_NewPromiseCapability=(a,b)=>(c._QTS_NewPromiseCapability=V.ta)(a,b);c._QTS_PromiseState=(a,b)=>(c._QTS_PromiseState=V.ua)(a,b);
|
|
39
|
+
c._QTS_PromiseResult=(a,b)=>(c._QTS_PromiseResult=V.va)(a,b);c._QTS_TestStringArg=a=>(c._QTS_TestStringArg=V.wa)(a);c._QTS_GetDebugLogEnabled=a=>(c._QTS_GetDebugLogEnabled=V.xa)(a);c._QTS_SetDebugLogEnabled=(a,b)=>(c._QTS_SetDebugLogEnabled=V.ya)(a,b);c._QTS_BuildIsDebug=()=>(c._QTS_BuildIsDebug=V.za)();c._QTS_BuildIsAsyncify=()=>(c._QTS_BuildIsAsyncify=V.Aa)();c._QTS_NewFunction=(a,b,d)=>(c._QTS_NewFunction=V.Ba)(a,b,d);
|
|
40
|
+
c._QTS_ArgvGetJSValueConstPointer=(a,b)=>(c._QTS_ArgvGetJSValueConstPointer=V.Ca)(a,b);c._QTS_RuntimeEnableInterruptHandler=a=>(c._QTS_RuntimeEnableInterruptHandler=V.Da)(a);c._QTS_RuntimeDisableInterruptHandler=a=>(c._QTS_RuntimeDisableInterruptHandler=V.Ea)(a);c._QTS_RuntimeEnableModuleLoader=(a,b)=>(c._QTS_RuntimeEnableModuleLoader=V.Fa)(a,b);c._QTS_RuntimeDisableModuleLoader=a=>(c._QTS_RuntimeDisableModuleLoader=V.Ga)(a);c._QTS_bjson_encode=(a,b)=>(c._QTS_bjson_encode=V.Ha)(a,b);
|
|
41
|
+
c._QTS_bjson_decode=(a,b)=>(c._QTS_bjson_decode=V.Ia)(a,b);c._QTS_EvalFunction=(a,b)=>(c._QTS_EvalFunction=V.Ja)(a,b);c._QTS_EncodeBytecode=(a,b)=>(c._QTS_EncodeBytecode=V.Ka)(a,b);c._QTS_DecodeBytecode=(a,b)=>(c._QTS_DecodeBytecode=V.La)(a,b);var ab=(a,b)=>(ab=V.Na)(a,b),Xa=a=>(Xa=V.Oa)(a),Ya=a=>(Ya=V.Pa)(a),Za=()=>(Za=V.Qa)(),Ta=a=>(Ta=V.Ra)(a),Fa=()=>(Fa=V.Sa)(),Sa=a=>(Sa=V.Ta)(a),Ua=()=>(Ua=V.Ua)();
|
|
42
|
+
c.cwrap=(a,b,d,e)=>{var g=!d||d.every(h=>"number"===h||"boolean"===h);return"string"!==b&&g&&!e?c["_"+a]:(...h)=>$a(a,b,d,h,e)};c.UTF8ToString=(a,b)=>a?Q(I,a,b):"";c.stringToUTF8=(a,b,d)=>T(a,b,d);c.lengthBytesUTF8=Wa;var Z;N=function cb(){Z||db();Z||(N=cb)};
|
|
43
|
+
function db(){function a(){if(!Z&&(Z=!0,c.calledRun=!0,!F)){sa(ja);aa(c);c.onRuntimeInitialized?.();if(c.postRun)for("function"==typeof c.postRun&&(c.postRun=[c.postRun]);c.postRun.length;){var b=c.postRun.shift();ka.unshift(b)}sa(ka)}}if(!(0<L)){if(c.preRun)for("function"==typeof c.preRun&&(c.preRun=[c.preRun]);c.preRun.length;)la();sa(ia);0<L||(c.setStatus?(c.setStatus("Running..."),setTimeout(function(){setTimeout(function(){c.setStatus("")},1);a()},1)):a())}}
|
|
44
|
+
if(c.preInit)for("function"==typeof c.preInit&&(c.preInit=[c.preInit]);0<c.preInit.length;)c.preInit.pop()();db();moduleRtn=ba;
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
return moduleRtn;
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
})();
|
|
51
|
+
export default QuickJSRaw;
|
|
Binary file
|
package/dist/ffi.d.mts
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { QuickJSAsyncEmscriptenModule, JSContextPointer, JSValuePointer, JSValueConstPointer, JSRuntimePointer, OwnedHeapCharPointer, IntrinsicsFlags, JSVoidPointer, JSBorrowedCharPointer, BorrowedHeapCharPointer, JSContextPointerPointer, JSValuePointerPointerPointer, UInt32Pointer, JSValueConstPointerPointer, EvalDetectModule, EvalFlags, IsEqualOp, JSValuePointerPointer, JSPromiseStateEnum } from '@componentor/quickjs-ffi-types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Low-level FFI bindings to QuickJS's Emscripten module.
|
|
5
|
+
* See instead {@link QuickJSContext}, the public Javascript interface exposed by this
|
|
6
|
+
* library.
|
|
7
|
+
*
|
|
8
|
+
* @unstable The FFI interface is considered private and may change.
|
|
9
|
+
*/
|
|
10
|
+
declare class QuickJSAsyncFFI {
|
|
11
|
+
private module;
|
|
12
|
+
constructor(module: QuickJSAsyncEmscriptenModule);
|
|
13
|
+
/** Set at compile time. */
|
|
14
|
+
readonly DEBUG = false;
|
|
15
|
+
QTS_Throw: (ctx: JSContextPointer, error: JSValuePointer | JSValueConstPointer) => JSValuePointer;
|
|
16
|
+
QTS_NewError: (ctx: JSContextPointer) => JSValuePointer;
|
|
17
|
+
QTS_RuntimeSetMemoryLimit: (rt: JSRuntimePointer, limit: number) => void;
|
|
18
|
+
QTS_RuntimeComputeMemoryUsage: (rt: JSRuntimePointer, ctx: JSContextPointer) => JSValuePointer;
|
|
19
|
+
QTS_RuntimeDumpMemoryUsage: (rt: JSRuntimePointer) => OwnedHeapCharPointer;
|
|
20
|
+
QTS_RecoverableLeakCheck: () => number;
|
|
21
|
+
QTS_BuildIsSanitizeLeak: () => number;
|
|
22
|
+
QTS_RuntimeSetMaxStackSize: (rt: JSRuntimePointer, stack_size: number) => void;
|
|
23
|
+
QTS_GetUndefined: () => JSValueConstPointer;
|
|
24
|
+
QTS_GetNull: () => JSValueConstPointer;
|
|
25
|
+
QTS_GetFalse: () => JSValueConstPointer;
|
|
26
|
+
QTS_GetTrue: () => JSValueConstPointer;
|
|
27
|
+
QTS_NewRuntime: () => JSRuntimePointer;
|
|
28
|
+
QTS_FreeRuntime: (rt: JSRuntimePointer) => void;
|
|
29
|
+
QTS_NewContext: (rt: JSRuntimePointer, intrinsics: IntrinsicsFlags) => JSContextPointer;
|
|
30
|
+
QTS_FreeContext: (ctx: JSContextPointer) => void;
|
|
31
|
+
QTS_FreeValuePointer: (ctx: JSContextPointer, value: JSValuePointer) => void;
|
|
32
|
+
QTS_FreeValuePointerRuntime: (rt: JSRuntimePointer, value: JSValuePointer) => void;
|
|
33
|
+
QTS_FreeVoidPointer: (ctx: JSContextPointer, ptr: JSVoidPointer) => void;
|
|
34
|
+
QTS_FreeCString: (ctx: JSContextPointer, str: JSBorrowedCharPointer) => void;
|
|
35
|
+
QTS_DupValuePointer: (ctx: JSContextPointer, val: JSValuePointer | JSValueConstPointer) => JSValuePointer;
|
|
36
|
+
QTS_NewObject: (ctx: JSContextPointer) => JSValuePointer;
|
|
37
|
+
QTS_NewObjectProto: (ctx: JSContextPointer, proto: JSValuePointer | JSValueConstPointer) => JSValuePointer;
|
|
38
|
+
QTS_NewArray: (ctx: JSContextPointer) => JSValuePointer;
|
|
39
|
+
QTS_NewArrayBuffer: (ctx: JSContextPointer, buffer: JSVoidPointer, length: number) => JSValuePointer;
|
|
40
|
+
QTS_NewFloat64: (ctx: JSContextPointer, num: number) => JSValuePointer;
|
|
41
|
+
QTS_GetFloat64: (ctx: JSContextPointer, value: JSValuePointer | JSValueConstPointer) => number;
|
|
42
|
+
QTS_NewString: (ctx: JSContextPointer, string: BorrowedHeapCharPointer) => JSValuePointer;
|
|
43
|
+
QTS_GetString: (ctx: JSContextPointer, value: JSValuePointer | JSValueConstPointer) => JSBorrowedCharPointer;
|
|
44
|
+
QTS_GetArrayBuffer: (ctx: JSContextPointer, data: JSValuePointer | JSValueConstPointer) => JSVoidPointer;
|
|
45
|
+
QTS_GetArrayBufferLength: (ctx: JSContextPointer, data: JSValuePointer | JSValueConstPointer) => number;
|
|
46
|
+
QTS_NewSymbol: (ctx: JSContextPointer, description: BorrowedHeapCharPointer, isGlobal: number) => JSValuePointer;
|
|
47
|
+
QTS_GetSymbolDescriptionOrKey: (ctx: JSContextPointer, value: JSValuePointer | JSValueConstPointer) => JSBorrowedCharPointer;
|
|
48
|
+
QTS_GetSymbolDescriptionOrKey_MaybeAsync: (ctx: JSContextPointer, value: JSValuePointer | JSValueConstPointer) => JSBorrowedCharPointer | Promise<JSBorrowedCharPointer>;
|
|
49
|
+
QTS_IsGlobalSymbol: (ctx: JSContextPointer, value: JSValuePointer | JSValueConstPointer) => number;
|
|
50
|
+
QTS_IsJobPending: (rt: JSRuntimePointer) => number;
|
|
51
|
+
QTS_ExecutePendingJob: (rt: JSRuntimePointer, maxJobsToExecute: number, lastJobContext: JSContextPointerPointer) => JSValuePointer;
|
|
52
|
+
QTS_ExecutePendingJob_MaybeAsync: (rt: JSRuntimePointer, maxJobsToExecute: number, lastJobContext: JSContextPointerPointer) => JSValuePointer | Promise<JSValuePointer>;
|
|
53
|
+
QTS_GetProp: (ctx: JSContextPointer, this_val: JSValuePointer | JSValueConstPointer, prop_name: JSValuePointer | JSValueConstPointer) => JSValuePointer;
|
|
54
|
+
QTS_GetProp_MaybeAsync: (ctx: JSContextPointer, this_val: JSValuePointer | JSValueConstPointer, prop_name: JSValuePointer | JSValueConstPointer) => JSValuePointer | Promise<JSValuePointer>;
|
|
55
|
+
QTS_GetPropNumber: (ctx: JSContextPointer, this_val: JSValuePointer | JSValueConstPointer, prop_name: number) => JSValuePointer;
|
|
56
|
+
QTS_GetPropNumber_MaybeAsync: (ctx: JSContextPointer, this_val: JSValuePointer | JSValueConstPointer, prop_name: number) => JSValuePointer | Promise<JSValuePointer>;
|
|
57
|
+
QTS_SetProp: (ctx: JSContextPointer, this_val: JSValuePointer | JSValueConstPointer, prop_name: JSValuePointer | JSValueConstPointer, prop_value: JSValuePointer | JSValueConstPointer) => void;
|
|
58
|
+
QTS_SetProp_MaybeAsync: (ctx: JSContextPointer, this_val: JSValuePointer | JSValueConstPointer, prop_name: JSValuePointer | JSValueConstPointer, prop_value: JSValuePointer | JSValueConstPointer) => void | Promise<void>;
|
|
59
|
+
QTS_DefineProp: (ctx: JSContextPointer, this_val: JSValuePointer | JSValueConstPointer, prop_name: JSValuePointer | JSValueConstPointer, prop_value: JSValuePointer | JSValueConstPointer, get: JSValuePointer | JSValueConstPointer, set: JSValuePointer | JSValueConstPointer, configurable: boolean, enumerable: boolean, has_value: boolean) => void;
|
|
60
|
+
QTS_GetOwnPropertyNames: (ctx: JSContextPointer, out_ptrs: JSValuePointerPointerPointer, out_len: UInt32Pointer, obj: JSValuePointer | JSValueConstPointer, flags: number) => JSValuePointer;
|
|
61
|
+
QTS_GetOwnPropertyNames_MaybeAsync: (ctx: JSContextPointer, out_ptrs: JSValuePointerPointerPointer, out_len: UInt32Pointer, obj: JSValuePointer | JSValueConstPointer, flags: number) => JSValuePointer | Promise<JSValuePointer>;
|
|
62
|
+
QTS_Call: (ctx: JSContextPointer, func_obj: JSValuePointer | JSValueConstPointer, this_obj: JSValuePointer | JSValueConstPointer, argc: number, argv_ptrs: JSValueConstPointerPointer) => JSValuePointer;
|
|
63
|
+
QTS_Call_MaybeAsync: (ctx: JSContextPointer, func_obj: JSValuePointer | JSValueConstPointer, this_obj: JSValuePointer | JSValueConstPointer, argc: number, argv_ptrs: JSValueConstPointerPointer) => JSValuePointer | Promise<JSValuePointer>;
|
|
64
|
+
QTS_ResolveException: (ctx: JSContextPointer, maybe_exception: JSValuePointer) => JSValuePointer;
|
|
65
|
+
QTS_Dump: (ctx: JSContextPointer, obj: JSValuePointer | JSValueConstPointer) => JSBorrowedCharPointer;
|
|
66
|
+
QTS_Dump_MaybeAsync: (ctx: JSContextPointer, obj: JSValuePointer | JSValueConstPointer) => JSBorrowedCharPointer | Promise<JSBorrowedCharPointer>;
|
|
67
|
+
QTS_Eval: (ctx: JSContextPointer, js_code: BorrowedHeapCharPointer, js_code_length: number, filename: string, detectModule: EvalDetectModule, evalFlags: EvalFlags) => JSValuePointer;
|
|
68
|
+
QTS_Eval_MaybeAsync: (ctx: JSContextPointer, js_code: BorrowedHeapCharPointer, js_code_length: number, filename: string, detectModule: EvalDetectModule, evalFlags: EvalFlags) => JSValuePointer | Promise<JSValuePointer>;
|
|
69
|
+
QTS_GetModuleNamespace: (ctx: JSContextPointer, module_func_obj: JSValuePointer | JSValueConstPointer) => JSValuePointer;
|
|
70
|
+
QTS_Typeof: (ctx: JSContextPointer, value: JSValuePointer | JSValueConstPointer) => OwnedHeapCharPointer;
|
|
71
|
+
QTS_GetLength: (ctx: JSContextPointer, out_len: UInt32Pointer, value: JSValuePointer | JSValueConstPointer) => number;
|
|
72
|
+
QTS_IsEqual: (ctx: JSContextPointer, a: JSValuePointer | JSValueConstPointer, b: JSValuePointer | JSValueConstPointer, op: IsEqualOp) => number;
|
|
73
|
+
QTS_GetGlobalObject: (ctx: JSContextPointer) => JSValuePointer;
|
|
74
|
+
QTS_NewPromiseCapability: (ctx: JSContextPointer, resolve_funcs_out: JSValuePointerPointer) => JSValuePointer;
|
|
75
|
+
QTS_PromiseState: (ctx: JSContextPointer, promise: JSValuePointer | JSValueConstPointer) => JSPromiseStateEnum;
|
|
76
|
+
QTS_PromiseResult: (ctx: JSContextPointer, promise: JSValuePointer | JSValueConstPointer) => JSValuePointer;
|
|
77
|
+
QTS_TestStringArg: (string: string) => void;
|
|
78
|
+
QTS_GetDebugLogEnabled: (rt: JSRuntimePointer) => number;
|
|
79
|
+
QTS_SetDebugLogEnabled: (rt: JSRuntimePointer, is_enabled: number) => void;
|
|
80
|
+
QTS_BuildIsDebug: () => number;
|
|
81
|
+
QTS_BuildIsAsyncify: () => number;
|
|
82
|
+
QTS_NewFunction: (ctx: JSContextPointer, func_id: number, name: string) => JSValuePointer;
|
|
83
|
+
QTS_ArgvGetJSValueConstPointer: (argv: JSValuePointer | JSValueConstPointer, index: number) => JSValueConstPointer;
|
|
84
|
+
QTS_RuntimeEnableInterruptHandler: (rt: JSRuntimePointer) => void;
|
|
85
|
+
QTS_RuntimeDisableInterruptHandler: (rt: JSRuntimePointer) => void;
|
|
86
|
+
QTS_RuntimeEnableModuleLoader: (rt: JSRuntimePointer, use_custom_normalize: number) => void;
|
|
87
|
+
QTS_RuntimeDisableModuleLoader: (rt: JSRuntimePointer) => void;
|
|
88
|
+
QTS_bjson_encode: (ctx: JSContextPointer, val: JSValuePointer | JSValueConstPointer) => JSValuePointer;
|
|
89
|
+
QTS_bjson_decode: (ctx: JSContextPointer, data: JSValuePointer | JSValueConstPointer) => JSValuePointer;
|
|
90
|
+
QTS_EvalFunction: (ctx: JSContextPointer, fun_obj: JSValuePointer | JSValueConstPointer) => JSValuePointer;
|
|
91
|
+
QTS_EvalFunction_MaybeAsync: (ctx: JSContextPointer, fun_obj: JSValuePointer | JSValueConstPointer) => JSValuePointer | Promise<JSValuePointer>;
|
|
92
|
+
QTS_EncodeBytecode: (ctx: JSContextPointer, val: JSValuePointer | JSValueConstPointer) => JSValuePointer;
|
|
93
|
+
QTS_DecodeBytecode: (ctx: JSContextPointer, data: JSValuePointer | JSValueConstPointer) => JSValuePointer;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export { QuickJSAsyncFFI };
|
package/dist/ffi.d.ts
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { QuickJSAsyncEmscriptenModule, JSContextPointer, JSValuePointer, JSValueConstPointer, JSRuntimePointer, OwnedHeapCharPointer, IntrinsicsFlags, JSVoidPointer, JSBorrowedCharPointer, BorrowedHeapCharPointer, JSContextPointerPointer, JSValuePointerPointerPointer, UInt32Pointer, JSValueConstPointerPointer, EvalDetectModule, EvalFlags, IsEqualOp, JSValuePointerPointer, JSPromiseStateEnum } from '@componentor/quickjs-ffi-types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Low-level FFI bindings to QuickJS's Emscripten module.
|
|
5
|
+
* See instead {@link QuickJSContext}, the public Javascript interface exposed by this
|
|
6
|
+
* library.
|
|
7
|
+
*
|
|
8
|
+
* @unstable The FFI interface is considered private and may change.
|
|
9
|
+
*/
|
|
10
|
+
declare class QuickJSAsyncFFI {
|
|
11
|
+
private module;
|
|
12
|
+
constructor(module: QuickJSAsyncEmscriptenModule);
|
|
13
|
+
/** Set at compile time. */
|
|
14
|
+
readonly DEBUG = false;
|
|
15
|
+
QTS_Throw: (ctx: JSContextPointer, error: JSValuePointer | JSValueConstPointer) => JSValuePointer;
|
|
16
|
+
QTS_NewError: (ctx: JSContextPointer) => JSValuePointer;
|
|
17
|
+
QTS_RuntimeSetMemoryLimit: (rt: JSRuntimePointer, limit: number) => void;
|
|
18
|
+
QTS_RuntimeComputeMemoryUsage: (rt: JSRuntimePointer, ctx: JSContextPointer) => JSValuePointer;
|
|
19
|
+
QTS_RuntimeDumpMemoryUsage: (rt: JSRuntimePointer) => OwnedHeapCharPointer;
|
|
20
|
+
QTS_RecoverableLeakCheck: () => number;
|
|
21
|
+
QTS_BuildIsSanitizeLeak: () => number;
|
|
22
|
+
QTS_RuntimeSetMaxStackSize: (rt: JSRuntimePointer, stack_size: number) => void;
|
|
23
|
+
QTS_GetUndefined: () => JSValueConstPointer;
|
|
24
|
+
QTS_GetNull: () => JSValueConstPointer;
|
|
25
|
+
QTS_GetFalse: () => JSValueConstPointer;
|
|
26
|
+
QTS_GetTrue: () => JSValueConstPointer;
|
|
27
|
+
QTS_NewRuntime: () => JSRuntimePointer;
|
|
28
|
+
QTS_FreeRuntime: (rt: JSRuntimePointer) => void;
|
|
29
|
+
QTS_NewContext: (rt: JSRuntimePointer, intrinsics: IntrinsicsFlags) => JSContextPointer;
|
|
30
|
+
QTS_FreeContext: (ctx: JSContextPointer) => void;
|
|
31
|
+
QTS_FreeValuePointer: (ctx: JSContextPointer, value: JSValuePointer) => void;
|
|
32
|
+
QTS_FreeValuePointerRuntime: (rt: JSRuntimePointer, value: JSValuePointer) => void;
|
|
33
|
+
QTS_FreeVoidPointer: (ctx: JSContextPointer, ptr: JSVoidPointer) => void;
|
|
34
|
+
QTS_FreeCString: (ctx: JSContextPointer, str: JSBorrowedCharPointer) => void;
|
|
35
|
+
QTS_DupValuePointer: (ctx: JSContextPointer, val: JSValuePointer | JSValueConstPointer) => JSValuePointer;
|
|
36
|
+
QTS_NewObject: (ctx: JSContextPointer) => JSValuePointer;
|
|
37
|
+
QTS_NewObjectProto: (ctx: JSContextPointer, proto: JSValuePointer | JSValueConstPointer) => JSValuePointer;
|
|
38
|
+
QTS_NewArray: (ctx: JSContextPointer) => JSValuePointer;
|
|
39
|
+
QTS_NewArrayBuffer: (ctx: JSContextPointer, buffer: JSVoidPointer, length: number) => JSValuePointer;
|
|
40
|
+
QTS_NewFloat64: (ctx: JSContextPointer, num: number) => JSValuePointer;
|
|
41
|
+
QTS_GetFloat64: (ctx: JSContextPointer, value: JSValuePointer | JSValueConstPointer) => number;
|
|
42
|
+
QTS_NewString: (ctx: JSContextPointer, string: BorrowedHeapCharPointer) => JSValuePointer;
|
|
43
|
+
QTS_GetString: (ctx: JSContextPointer, value: JSValuePointer | JSValueConstPointer) => JSBorrowedCharPointer;
|
|
44
|
+
QTS_GetArrayBuffer: (ctx: JSContextPointer, data: JSValuePointer | JSValueConstPointer) => JSVoidPointer;
|
|
45
|
+
QTS_GetArrayBufferLength: (ctx: JSContextPointer, data: JSValuePointer | JSValueConstPointer) => number;
|
|
46
|
+
QTS_NewSymbol: (ctx: JSContextPointer, description: BorrowedHeapCharPointer, isGlobal: number) => JSValuePointer;
|
|
47
|
+
QTS_GetSymbolDescriptionOrKey: (ctx: JSContextPointer, value: JSValuePointer | JSValueConstPointer) => JSBorrowedCharPointer;
|
|
48
|
+
QTS_GetSymbolDescriptionOrKey_MaybeAsync: (ctx: JSContextPointer, value: JSValuePointer | JSValueConstPointer) => JSBorrowedCharPointer | Promise<JSBorrowedCharPointer>;
|
|
49
|
+
QTS_IsGlobalSymbol: (ctx: JSContextPointer, value: JSValuePointer | JSValueConstPointer) => number;
|
|
50
|
+
QTS_IsJobPending: (rt: JSRuntimePointer) => number;
|
|
51
|
+
QTS_ExecutePendingJob: (rt: JSRuntimePointer, maxJobsToExecute: number, lastJobContext: JSContextPointerPointer) => JSValuePointer;
|
|
52
|
+
QTS_ExecutePendingJob_MaybeAsync: (rt: JSRuntimePointer, maxJobsToExecute: number, lastJobContext: JSContextPointerPointer) => JSValuePointer | Promise<JSValuePointer>;
|
|
53
|
+
QTS_GetProp: (ctx: JSContextPointer, this_val: JSValuePointer | JSValueConstPointer, prop_name: JSValuePointer | JSValueConstPointer) => JSValuePointer;
|
|
54
|
+
QTS_GetProp_MaybeAsync: (ctx: JSContextPointer, this_val: JSValuePointer | JSValueConstPointer, prop_name: JSValuePointer | JSValueConstPointer) => JSValuePointer | Promise<JSValuePointer>;
|
|
55
|
+
QTS_GetPropNumber: (ctx: JSContextPointer, this_val: JSValuePointer | JSValueConstPointer, prop_name: number) => JSValuePointer;
|
|
56
|
+
QTS_GetPropNumber_MaybeAsync: (ctx: JSContextPointer, this_val: JSValuePointer | JSValueConstPointer, prop_name: number) => JSValuePointer | Promise<JSValuePointer>;
|
|
57
|
+
QTS_SetProp: (ctx: JSContextPointer, this_val: JSValuePointer | JSValueConstPointer, prop_name: JSValuePointer | JSValueConstPointer, prop_value: JSValuePointer | JSValueConstPointer) => void;
|
|
58
|
+
QTS_SetProp_MaybeAsync: (ctx: JSContextPointer, this_val: JSValuePointer | JSValueConstPointer, prop_name: JSValuePointer | JSValueConstPointer, prop_value: JSValuePointer | JSValueConstPointer) => void | Promise<void>;
|
|
59
|
+
QTS_DefineProp: (ctx: JSContextPointer, this_val: JSValuePointer | JSValueConstPointer, prop_name: JSValuePointer | JSValueConstPointer, prop_value: JSValuePointer | JSValueConstPointer, get: JSValuePointer | JSValueConstPointer, set: JSValuePointer | JSValueConstPointer, configurable: boolean, enumerable: boolean, has_value: boolean) => void;
|
|
60
|
+
QTS_GetOwnPropertyNames: (ctx: JSContextPointer, out_ptrs: JSValuePointerPointerPointer, out_len: UInt32Pointer, obj: JSValuePointer | JSValueConstPointer, flags: number) => JSValuePointer;
|
|
61
|
+
QTS_GetOwnPropertyNames_MaybeAsync: (ctx: JSContextPointer, out_ptrs: JSValuePointerPointerPointer, out_len: UInt32Pointer, obj: JSValuePointer | JSValueConstPointer, flags: number) => JSValuePointer | Promise<JSValuePointer>;
|
|
62
|
+
QTS_Call: (ctx: JSContextPointer, func_obj: JSValuePointer | JSValueConstPointer, this_obj: JSValuePointer | JSValueConstPointer, argc: number, argv_ptrs: JSValueConstPointerPointer) => JSValuePointer;
|
|
63
|
+
QTS_Call_MaybeAsync: (ctx: JSContextPointer, func_obj: JSValuePointer | JSValueConstPointer, this_obj: JSValuePointer | JSValueConstPointer, argc: number, argv_ptrs: JSValueConstPointerPointer) => JSValuePointer | Promise<JSValuePointer>;
|
|
64
|
+
QTS_ResolveException: (ctx: JSContextPointer, maybe_exception: JSValuePointer) => JSValuePointer;
|
|
65
|
+
QTS_Dump: (ctx: JSContextPointer, obj: JSValuePointer | JSValueConstPointer) => JSBorrowedCharPointer;
|
|
66
|
+
QTS_Dump_MaybeAsync: (ctx: JSContextPointer, obj: JSValuePointer | JSValueConstPointer) => JSBorrowedCharPointer | Promise<JSBorrowedCharPointer>;
|
|
67
|
+
QTS_Eval: (ctx: JSContextPointer, js_code: BorrowedHeapCharPointer, js_code_length: number, filename: string, detectModule: EvalDetectModule, evalFlags: EvalFlags) => JSValuePointer;
|
|
68
|
+
QTS_Eval_MaybeAsync: (ctx: JSContextPointer, js_code: BorrowedHeapCharPointer, js_code_length: number, filename: string, detectModule: EvalDetectModule, evalFlags: EvalFlags) => JSValuePointer | Promise<JSValuePointer>;
|
|
69
|
+
QTS_GetModuleNamespace: (ctx: JSContextPointer, module_func_obj: JSValuePointer | JSValueConstPointer) => JSValuePointer;
|
|
70
|
+
QTS_Typeof: (ctx: JSContextPointer, value: JSValuePointer | JSValueConstPointer) => OwnedHeapCharPointer;
|
|
71
|
+
QTS_GetLength: (ctx: JSContextPointer, out_len: UInt32Pointer, value: JSValuePointer | JSValueConstPointer) => number;
|
|
72
|
+
QTS_IsEqual: (ctx: JSContextPointer, a: JSValuePointer | JSValueConstPointer, b: JSValuePointer | JSValueConstPointer, op: IsEqualOp) => number;
|
|
73
|
+
QTS_GetGlobalObject: (ctx: JSContextPointer) => JSValuePointer;
|
|
74
|
+
QTS_NewPromiseCapability: (ctx: JSContextPointer, resolve_funcs_out: JSValuePointerPointer) => JSValuePointer;
|
|
75
|
+
QTS_PromiseState: (ctx: JSContextPointer, promise: JSValuePointer | JSValueConstPointer) => JSPromiseStateEnum;
|
|
76
|
+
QTS_PromiseResult: (ctx: JSContextPointer, promise: JSValuePointer | JSValueConstPointer) => JSValuePointer;
|
|
77
|
+
QTS_TestStringArg: (string: string) => void;
|
|
78
|
+
QTS_GetDebugLogEnabled: (rt: JSRuntimePointer) => number;
|
|
79
|
+
QTS_SetDebugLogEnabled: (rt: JSRuntimePointer, is_enabled: number) => void;
|
|
80
|
+
QTS_BuildIsDebug: () => number;
|
|
81
|
+
QTS_BuildIsAsyncify: () => number;
|
|
82
|
+
QTS_NewFunction: (ctx: JSContextPointer, func_id: number, name: string) => JSValuePointer;
|
|
83
|
+
QTS_ArgvGetJSValueConstPointer: (argv: JSValuePointer | JSValueConstPointer, index: number) => JSValueConstPointer;
|
|
84
|
+
QTS_RuntimeEnableInterruptHandler: (rt: JSRuntimePointer) => void;
|
|
85
|
+
QTS_RuntimeDisableInterruptHandler: (rt: JSRuntimePointer) => void;
|
|
86
|
+
QTS_RuntimeEnableModuleLoader: (rt: JSRuntimePointer, use_custom_normalize: number) => void;
|
|
87
|
+
QTS_RuntimeDisableModuleLoader: (rt: JSRuntimePointer) => void;
|
|
88
|
+
QTS_bjson_encode: (ctx: JSContextPointer, val: JSValuePointer | JSValueConstPointer) => JSValuePointer;
|
|
89
|
+
QTS_bjson_decode: (ctx: JSContextPointer, data: JSValuePointer | JSValueConstPointer) => JSValuePointer;
|
|
90
|
+
QTS_EvalFunction: (ctx: JSContextPointer, fun_obj: JSValuePointer | JSValueConstPointer) => JSValuePointer;
|
|
91
|
+
QTS_EvalFunction_MaybeAsync: (ctx: JSContextPointer, fun_obj: JSValuePointer | JSValueConstPointer) => JSValuePointer | Promise<JSValuePointer>;
|
|
92
|
+
QTS_EncodeBytecode: (ctx: JSContextPointer, val: JSValuePointer | JSValueConstPointer) => JSValuePointer;
|
|
93
|
+
QTS_DecodeBytecode: (ctx: JSContextPointer, data: JSValuePointer | JSValueConstPointer) => JSValuePointer;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export { QuickJSAsyncFFI };
|
package/dist/ffi.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __hasOwnProp=Object.prototype.hasOwnProperty;var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var ffi_exports={};__export(ffi_exports,{QuickJSAsyncFFI:()=>QuickJSAsyncFFI});module.exports=__toCommonJS(ffi_exports);var import_quickjs_ffi_types=require("@componentor/quickjs-ffi-types"),QuickJSAsyncFFI=class{constructor(module2){this.module=module2;this.DEBUG=!1;this.QTS_Throw=this.module.cwrap("QTS_Throw","number",["number","number"]);this.QTS_NewError=this.module.cwrap("QTS_NewError","number",["number"]);this.QTS_RuntimeSetMemoryLimit=this.module.cwrap("QTS_RuntimeSetMemoryLimit",null,["number","number"]);this.QTS_RuntimeComputeMemoryUsage=this.module.cwrap("QTS_RuntimeComputeMemoryUsage","number",["number","number"]);this.QTS_RuntimeDumpMemoryUsage=this.module.cwrap("QTS_RuntimeDumpMemoryUsage","number",["number"]);this.QTS_RecoverableLeakCheck=this.module.cwrap("QTS_RecoverableLeakCheck","number",[]);this.QTS_BuildIsSanitizeLeak=this.module.cwrap("QTS_BuildIsSanitizeLeak","number",[]);this.QTS_RuntimeSetMaxStackSize=this.module.cwrap("QTS_RuntimeSetMaxStackSize",null,["number","number"]);this.QTS_GetUndefined=this.module.cwrap("QTS_GetUndefined","number",[]);this.QTS_GetNull=this.module.cwrap("QTS_GetNull","number",[]);this.QTS_GetFalse=this.module.cwrap("QTS_GetFalse","number",[]);this.QTS_GetTrue=this.module.cwrap("QTS_GetTrue","number",[]);this.QTS_NewRuntime=this.module.cwrap("QTS_NewRuntime","number",[]);this.QTS_FreeRuntime=this.module.cwrap("QTS_FreeRuntime",null,["number"]);this.QTS_NewContext=this.module.cwrap("QTS_NewContext","number",["number","number"]);this.QTS_FreeContext=this.module.cwrap("QTS_FreeContext",null,["number"]);this.QTS_FreeValuePointer=this.module.cwrap("QTS_FreeValuePointer",null,["number","number"]);this.QTS_FreeValuePointerRuntime=this.module.cwrap("QTS_FreeValuePointerRuntime",null,["number","number"]);this.QTS_FreeVoidPointer=this.module.cwrap("QTS_FreeVoidPointer",null,["number","number"]);this.QTS_FreeCString=this.module.cwrap("QTS_FreeCString",null,["number","number"]);this.QTS_DupValuePointer=this.module.cwrap("QTS_DupValuePointer","number",["number","number"]);this.QTS_NewObject=this.module.cwrap("QTS_NewObject","number",["number"]);this.QTS_NewObjectProto=this.module.cwrap("QTS_NewObjectProto","number",["number","number"]);this.QTS_NewArray=this.module.cwrap("QTS_NewArray","number",["number"]);this.QTS_NewArrayBuffer=this.module.cwrap("QTS_NewArrayBuffer","number",["number","number","number"]);this.QTS_NewFloat64=this.module.cwrap("QTS_NewFloat64","number",["number","number"]);this.QTS_GetFloat64=this.module.cwrap("QTS_GetFloat64","number",["number","number"]);this.QTS_NewString=this.module.cwrap("QTS_NewString","number",["number","number"]);this.QTS_GetString=this.module.cwrap("QTS_GetString","number",["number","number"]);this.QTS_GetArrayBuffer=this.module.cwrap("QTS_GetArrayBuffer","number",["number","number"]);this.QTS_GetArrayBufferLength=this.module.cwrap("QTS_GetArrayBufferLength","number",["number","number"]);this.QTS_NewSymbol=this.module.cwrap("QTS_NewSymbol","number",["number","number","number"]);this.QTS_GetSymbolDescriptionOrKey=(0,import_quickjs_ffi_types.assertSync)(this.module.cwrap("QTS_GetSymbolDescriptionOrKey","number",["number","number"]));this.QTS_GetSymbolDescriptionOrKey_MaybeAsync=this.module.cwrap("QTS_GetSymbolDescriptionOrKey","number",["number","number"]);this.QTS_IsGlobalSymbol=this.module.cwrap("QTS_IsGlobalSymbol","number",["number","number"]);this.QTS_IsJobPending=this.module.cwrap("QTS_IsJobPending","number",["number"]);this.QTS_ExecutePendingJob=(0,import_quickjs_ffi_types.assertSync)(this.module.cwrap("QTS_ExecutePendingJob","number",["number","number","number"]));this.QTS_ExecutePendingJob_MaybeAsync=this.module.cwrap("QTS_ExecutePendingJob","number",["number","number","number"]);this.QTS_GetProp=(0,import_quickjs_ffi_types.assertSync)(this.module.cwrap("QTS_GetProp","number",["number","number","number"]));this.QTS_GetProp_MaybeAsync=this.module.cwrap("QTS_GetProp","number",["number","number","number"]);this.QTS_GetPropNumber=(0,import_quickjs_ffi_types.assertSync)(this.module.cwrap("QTS_GetPropNumber","number",["number","number","number"]));this.QTS_GetPropNumber_MaybeAsync=this.module.cwrap("QTS_GetPropNumber","number",["number","number","number"]);this.QTS_SetProp=(0,import_quickjs_ffi_types.assertSync)(this.module.cwrap("QTS_SetProp",null,["number","number","number","number"]));this.QTS_SetProp_MaybeAsync=this.module.cwrap("QTS_SetProp",null,["number","number","number","number"]);this.QTS_DefineProp=this.module.cwrap("QTS_DefineProp",null,["number","number","number","number","number","number","boolean","boolean","boolean"]);this.QTS_GetOwnPropertyNames=(0,import_quickjs_ffi_types.assertSync)(this.module.cwrap("QTS_GetOwnPropertyNames","number",["number","number","number","number","number"]));this.QTS_GetOwnPropertyNames_MaybeAsync=this.module.cwrap("QTS_GetOwnPropertyNames","number",["number","number","number","number","number"]);this.QTS_Call=(0,import_quickjs_ffi_types.assertSync)(this.module.cwrap("QTS_Call","number",["number","number","number","number","number"]));this.QTS_Call_MaybeAsync=this.module.cwrap("QTS_Call","number",["number","number","number","number","number"]);this.QTS_ResolveException=this.module.cwrap("QTS_ResolveException","number",["number","number"]);this.QTS_Dump=(0,import_quickjs_ffi_types.assertSync)(this.module.cwrap("QTS_Dump","number",["number","number"]));this.QTS_Dump_MaybeAsync=this.module.cwrap("QTS_Dump","number",["number","number"]);this.QTS_Eval=(0,import_quickjs_ffi_types.assertSync)(this.module.cwrap("QTS_Eval","number",["number","number","number","string","number","number"]));this.QTS_Eval_MaybeAsync=this.module.cwrap("QTS_Eval","number",["number","number","number","string","number","number"]);this.QTS_GetModuleNamespace=this.module.cwrap("QTS_GetModuleNamespace","number",["number","number"]);this.QTS_Typeof=this.module.cwrap("QTS_Typeof","number",["number","number"]);this.QTS_GetLength=this.module.cwrap("QTS_GetLength","number",["number","number","number"]);this.QTS_IsEqual=this.module.cwrap("QTS_IsEqual","number",["number","number","number","number"]);this.QTS_GetGlobalObject=this.module.cwrap("QTS_GetGlobalObject","number",["number"]);this.QTS_NewPromiseCapability=this.module.cwrap("QTS_NewPromiseCapability","number",["number","number"]);this.QTS_PromiseState=this.module.cwrap("QTS_PromiseState","number",["number","number"]);this.QTS_PromiseResult=this.module.cwrap("QTS_PromiseResult","number",["number","number"]);this.QTS_TestStringArg=this.module.cwrap("QTS_TestStringArg",null,["string"]);this.QTS_GetDebugLogEnabled=this.module.cwrap("QTS_GetDebugLogEnabled","number",["number"]);this.QTS_SetDebugLogEnabled=this.module.cwrap("QTS_SetDebugLogEnabled",null,["number","number"]);this.QTS_BuildIsDebug=this.module.cwrap("QTS_BuildIsDebug","number",[]);this.QTS_BuildIsAsyncify=this.module.cwrap("QTS_BuildIsAsyncify","number",[]);this.QTS_NewFunction=this.module.cwrap("QTS_NewFunction","number",["number","number","string"]);this.QTS_ArgvGetJSValueConstPointer=this.module.cwrap("QTS_ArgvGetJSValueConstPointer","number",["number","number"]);this.QTS_RuntimeEnableInterruptHandler=this.module.cwrap("QTS_RuntimeEnableInterruptHandler",null,["number"]);this.QTS_RuntimeDisableInterruptHandler=this.module.cwrap("QTS_RuntimeDisableInterruptHandler",null,["number"]);this.QTS_RuntimeEnableModuleLoader=this.module.cwrap("QTS_RuntimeEnableModuleLoader",null,["number","number"]);this.QTS_RuntimeDisableModuleLoader=this.module.cwrap("QTS_RuntimeDisableModuleLoader",null,["number"]);this.QTS_bjson_encode=this.module.cwrap("QTS_bjson_encode","number",["number","number"]);this.QTS_bjson_decode=this.module.cwrap("QTS_bjson_decode","number",["number","number"]);this.QTS_EvalFunction=(0,import_quickjs_ffi_types.assertSync)(this.module.cwrap("QTS_EvalFunction","number",["number","number"]));this.QTS_EvalFunction_MaybeAsync=this.module.cwrap("QTS_EvalFunction","number",["number","number"]);this.QTS_EncodeBytecode=this.module.cwrap("QTS_EncodeBytecode","number",["number","number"]);this.QTS_DecodeBytecode=this.module.cwrap("QTS_DecodeBytecode","number",["number","number"])}};0&&(module.exports={QuickJSAsyncFFI});
|
|
2
|
+
//# sourceMappingURL=ffi.js.map
|
package/dist/ffi.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/ffi.ts"],"sourcesContent":["// This file generated by \"generate.ts ffi\" in the root of the repo.\nimport {\n QuickJSAsyncEmscriptenModule,\n JSRuntimePointer,\n JSContextPointer,\n JSContextPointerPointer,\n JSModuleDefPointer,\n JSValuePointer,\n JSValueConstPointer,\n JSValuePointerPointer,\n JSValuePointerPointerPointer,\n JSValueConstPointerPointer,\n QTS_C_To_HostCallbackFuncPointer,\n QTS_C_To_HostInterruptFuncPointer,\n QTS_C_To_HostLoadModuleFuncPointer,\n BorrowedHeapCharPointer,\n OwnedHeapCharPointer,\n JSBorrowedCharPointer,\n JSVoidPointer,\n UInt32Pointer,\n EvalFlags,\n IntrinsicsFlags,\n EvalDetectModule,\n GetOwnPropertyNamesFlags,\n IsEqualOp,\n JSPromiseStateEnum,\n assertSync,\n} from \"@componentor/quickjs-ffi-types\"\n\n/**\n * Low-level FFI bindings to QuickJS's Emscripten module.\n * See instead {@link QuickJSContext}, the public Javascript interface exposed by this\n * library.\n *\n * @unstable The FFI interface is considered private and may change.\n */\nexport class QuickJSAsyncFFI {\n constructor(private module: QuickJSAsyncEmscriptenModule) {}\n /** Set at compile time. */\n readonly DEBUG = false\n\n QTS_Throw: (\n ctx: JSContextPointer,\n error: JSValuePointer | JSValueConstPointer,\n ) => JSValuePointer = this.module.cwrap(\"QTS_Throw\", \"number\", [\"number\", \"number\"])\n\n QTS_NewError: (ctx: JSContextPointer) => JSValuePointer = this.module.cwrap(\n \"QTS_NewError\",\n \"number\",\n [\"number\"],\n )\n\n QTS_RuntimeSetMemoryLimit: (rt: JSRuntimePointer, limit: number) => void = this.module.cwrap(\n \"QTS_RuntimeSetMemoryLimit\",\n null,\n [\"number\", \"number\"],\n )\n\n QTS_RuntimeComputeMemoryUsage: (rt: JSRuntimePointer, ctx: JSContextPointer) => JSValuePointer =\n this.module.cwrap(\"QTS_RuntimeComputeMemoryUsage\", \"number\", [\"number\", \"number\"])\n\n QTS_RuntimeDumpMemoryUsage: (rt: JSRuntimePointer) => OwnedHeapCharPointer = this.module.cwrap(\n \"QTS_RuntimeDumpMemoryUsage\",\n \"number\",\n [\"number\"],\n )\n\n QTS_RecoverableLeakCheck: () => number = this.module.cwrap(\n \"QTS_RecoverableLeakCheck\",\n \"number\",\n [],\n )\n\n QTS_BuildIsSanitizeLeak: () => number = this.module.cwrap(\"QTS_BuildIsSanitizeLeak\", \"number\", [])\n\n QTS_RuntimeSetMaxStackSize: (rt: JSRuntimePointer, stack_size: number) => void =\n this.module.cwrap(\"QTS_RuntimeSetMaxStackSize\", null, [\"number\", \"number\"])\n\n QTS_GetUndefined: () => JSValueConstPointer = this.module.cwrap(\"QTS_GetUndefined\", \"number\", [])\n\n QTS_GetNull: () => JSValueConstPointer = this.module.cwrap(\"QTS_GetNull\", \"number\", [])\n\n QTS_GetFalse: () => JSValueConstPointer = this.module.cwrap(\"QTS_GetFalse\", \"number\", [])\n\n QTS_GetTrue: () => JSValueConstPointer = this.module.cwrap(\"QTS_GetTrue\", \"number\", [])\n\n QTS_NewRuntime: () => JSRuntimePointer = this.module.cwrap(\"QTS_NewRuntime\", \"number\", [])\n\n QTS_FreeRuntime: (rt: JSRuntimePointer) => void = this.module.cwrap(\"QTS_FreeRuntime\", null, [\n \"number\",\n ])\n\n QTS_NewContext: (rt: JSRuntimePointer, intrinsics: IntrinsicsFlags) => JSContextPointer =\n this.module.cwrap(\"QTS_NewContext\", \"number\", [\"number\", \"number\"])\n\n QTS_FreeContext: (ctx: JSContextPointer) => void = this.module.cwrap(\"QTS_FreeContext\", null, [\n \"number\",\n ])\n\n QTS_FreeValuePointer: (ctx: JSContextPointer, value: JSValuePointer) => void = this.module.cwrap(\n \"QTS_FreeValuePointer\",\n null,\n [\"number\", \"number\"],\n )\n\n QTS_FreeValuePointerRuntime: (rt: JSRuntimePointer, value: JSValuePointer) => void =\n this.module.cwrap(\"QTS_FreeValuePointerRuntime\", null, [\"number\", \"number\"])\n\n QTS_FreeVoidPointer: (ctx: JSContextPointer, ptr: JSVoidPointer) => void = this.module.cwrap(\n \"QTS_FreeVoidPointer\",\n null,\n [\"number\", \"number\"],\n )\n\n QTS_FreeCString: (ctx: JSContextPointer, str: JSBorrowedCharPointer) => void = this.module.cwrap(\n \"QTS_FreeCString\",\n null,\n [\"number\", \"number\"],\n )\n\n QTS_DupValuePointer: (\n ctx: JSContextPointer,\n val: JSValuePointer | JSValueConstPointer,\n ) => JSValuePointer = this.module.cwrap(\"QTS_DupValuePointer\", \"number\", [\"number\", \"number\"])\n\n QTS_NewObject: (ctx: JSContextPointer) => JSValuePointer = this.module.cwrap(\n \"QTS_NewObject\",\n \"number\",\n [\"number\"],\n )\n\n QTS_NewObjectProto: (\n ctx: JSContextPointer,\n proto: JSValuePointer | JSValueConstPointer,\n ) => JSValuePointer = this.module.cwrap(\"QTS_NewObjectProto\", \"number\", [\"number\", \"number\"])\n\n QTS_NewArray: (ctx: JSContextPointer) => JSValuePointer = this.module.cwrap(\n \"QTS_NewArray\",\n \"number\",\n [\"number\"],\n )\n\n QTS_NewArrayBuffer: (\n ctx: JSContextPointer,\n buffer: JSVoidPointer,\n length: number,\n ) => JSValuePointer = this.module.cwrap(\"QTS_NewArrayBuffer\", \"number\", [\n \"number\",\n \"number\",\n \"number\",\n ])\n\n QTS_NewFloat64: (ctx: JSContextPointer, num: number) => JSValuePointer = this.module.cwrap(\n \"QTS_NewFloat64\",\n \"number\",\n [\"number\", \"number\"],\n )\n\n QTS_GetFloat64: (ctx: JSContextPointer, value: JSValuePointer | JSValueConstPointer) => number =\n this.module.cwrap(\"QTS_GetFloat64\", \"number\", [\"number\", \"number\"])\n\n QTS_NewString: (ctx: JSContextPointer, string: BorrowedHeapCharPointer) => JSValuePointer =\n this.module.cwrap(\"QTS_NewString\", \"number\", [\"number\", \"number\"])\n\n QTS_GetString: (\n ctx: JSContextPointer,\n value: JSValuePointer | JSValueConstPointer,\n ) => JSBorrowedCharPointer = this.module.cwrap(\"QTS_GetString\", \"number\", [\"number\", \"number\"])\n\n QTS_GetArrayBuffer: (\n ctx: JSContextPointer,\n data: JSValuePointer | JSValueConstPointer,\n ) => JSVoidPointer = this.module.cwrap(\"QTS_GetArrayBuffer\", \"number\", [\"number\", \"number\"])\n\n QTS_GetArrayBufferLength: (\n ctx: JSContextPointer,\n data: JSValuePointer | JSValueConstPointer,\n ) => number = this.module.cwrap(\"QTS_GetArrayBufferLength\", \"number\", [\"number\", \"number\"])\n\n QTS_NewSymbol: (\n ctx: JSContextPointer,\n description: BorrowedHeapCharPointer,\n isGlobal: number,\n ) => JSValuePointer = this.module.cwrap(\"QTS_NewSymbol\", \"number\", [\"number\", \"number\", \"number\"])\n\n QTS_GetSymbolDescriptionOrKey: (\n ctx: JSContextPointer,\n value: JSValuePointer | JSValueConstPointer,\n ) => JSBorrowedCharPointer = assertSync(\n this.module.cwrap(\"QTS_GetSymbolDescriptionOrKey\", \"number\", [\"number\", \"number\"]),\n )\n\n QTS_GetSymbolDescriptionOrKey_MaybeAsync: (\n ctx: JSContextPointer,\n value: JSValuePointer | JSValueConstPointer,\n ) => JSBorrowedCharPointer | Promise<JSBorrowedCharPointer> = this.module.cwrap(\n \"QTS_GetSymbolDescriptionOrKey\",\n \"number\",\n [\"number\", \"number\"],\n )\n\n QTS_IsGlobalSymbol: (\n ctx: JSContextPointer,\n value: JSValuePointer | JSValueConstPointer,\n ) => number = this.module.cwrap(\"QTS_IsGlobalSymbol\", \"number\", [\"number\", \"number\"])\n\n QTS_IsJobPending: (rt: JSRuntimePointer) => number = this.module.cwrap(\n \"QTS_IsJobPending\",\n \"number\",\n [\"number\"],\n )\n\n QTS_ExecutePendingJob: (\n rt: JSRuntimePointer,\n maxJobsToExecute: number,\n lastJobContext: JSContextPointerPointer,\n ) => JSValuePointer = assertSync(\n this.module.cwrap(\"QTS_ExecutePendingJob\", \"number\", [\"number\", \"number\", \"number\"]),\n )\n\n QTS_ExecutePendingJob_MaybeAsync: (\n rt: JSRuntimePointer,\n maxJobsToExecute: number,\n lastJobContext: JSContextPointerPointer,\n ) => JSValuePointer | Promise<JSValuePointer> = this.module.cwrap(\n \"QTS_ExecutePendingJob\",\n \"number\",\n [\"number\", \"number\", \"number\"],\n )\n\n QTS_GetProp: (\n ctx: JSContextPointer,\n this_val: JSValuePointer | JSValueConstPointer,\n prop_name: JSValuePointer | JSValueConstPointer,\n ) => JSValuePointer = assertSync(\n this.module.cwrap(\"QTS_GetProp\", \"number\", [\"number\", \"number\", \"number\"]),\n )\n\n QTS_GetProp_MaybeAsync: (\n ctx: JSContextPointer,\n this_val: JSValuePointer | JSValueConstPointer,\n prop_name: JSValuePointer | JSValueConstPointer,\n ) => JSValuePointer | Promise<JSValuePointer> = this.module.cwrap(\"QTS_GetProp\", \"number\", [\n \"number\",\n \"number\",\n \"number\",\n ])\n\n QTS_GetPropNumber: (\n ctx: JSContextPointer,\n this_val: JSValuePointer | JSValueConstPointer,\n prop_name: number,\n ) => JSValuePointer = assertSync(\n this.module.cwrap(\"QTS_GetPropNumber\", \"number\", [\"number\", \"number\", \"number\"]),\n )\n\n QTS_GetPropNumber_MaybeAsync: (\n ctx: JSContextPointer,\n this_val: JSValuePointer | JSValueConstPointer,\n prop_name: number,\n ) => JSValuePointer | Promise<JSValuePointer> = this.module.cwrap(\"QTS_GetPropNumber\", \"number\", [\n \"number\",\n \"number\",\n \"number\",\n ])\n\n QTS_SetProp: (\n ctx: JSContextPointer,\n this_val: JSValuePointer | JSValueConstPointer,\n prop_name: JSValuePointer | JSValueConstPointer,\n prop_value: JSValuePointer | JSValueConstPointer,\n ) => void = assertSync(\n this.module.cwrap(\"QTS_SetProp\", null, [\"number\", \"number\", \"number\", \"number\"]),\n )\n\n QTS_SetProp_MaybeAsync: (\n ctx: JSContextPointer,\n this_val: JSValuePointer | JSValueConstPointer,\n prop_name: JSValuePointer | JSValueConstPointer,\n prop_value: JSValuePointer | JSValueConstPointer,\n ) => void | Promise<void> = this.module.cwrap(\"QTS_SetProp\", null, [\n \"number\",\n \"number\",\n \"number\",\n \"number\",\n ])\n\n QTS_DefineProp: (\n ctx: JSContextPointer,\n this_val: JSValuePointer | JSValueConstPointer,\n prop_name: JSValuePointer | JSValueConstPointer,\n prop_value: JSValuePointer | JSValueConstPointer,\n get: JSValuePointer | JSValueConstPointer,\n set: JSValuePointer | JSValueConstPointer,\n configurable: boolean,\n enumerable: boolean,\n has_value: boolean,\n ) => void = this.module.cwrap(\"QTS_DefineProp\", null, [\n \"number\",\n \"number\",\n \"number\",\n \"number\",\n \"number\",\n \"number\",\n \"boolean\",\n \"boolean\",\n \"boolean\",\n ])\n\n QTS_GetOwnPropertyNames: (\n ctx: JSContextPointer,\n out_ptrs: JSValuePointerPointerPointer,\n out_len: UInt32Pointer,\n obj: JSValuePointer | JSValueConstPointer,\n flags: number,\n ) => JSValuePointer = assertSync(\n this.module.cwrap(\"QTS_GetOwnPropertyNames\", \"number\", [\n \"number\",\n \"number\",\n \"number\",\n \"number\",\n \"number\",\n ]),\n )\n\n QTS_GetOwnPropertyNames_MaybeAsync: (\n ctx: JSContextPointer,\n out_ptrs: JSValuePointerPointerPointer,\n out_len: UInt32Pointer,\n obj: JSValuePointer | JSValueConstPointer,\n flags: number,\n ) => JSValuePointer | Promise<JSValuePointer> = this.module.cwrap(\n \"QTS_GetOwnPropertyNames\",\n \"number\",\n [\"number\", \"number\", \"number\", \"number\", \"number\"],\n )\n\n QTS_Call: (\n ctx: JSContextPointer,\n func_obj: JSValuePointer | JSValueConstPointer,\n this_obj: JSValuePointer | JSValueConstPointer,\n argc: number,\n argv_ptrs: JSValueConstPointerPointer,\n ) => JSValuePointer = assertSync(\n this.module.cwrap(\"QTS_Call\", \"number\", [\"number\", \"number\", \"number\", \"number\", \"number\"]),\n )\n\n QTS_Call_MaybeAsync: (\n ctx: JSContextPointer,\n func_obj: JSValuePointer | JSValueConstPointer,\n this_obj: JSValuePointer | JSValueConstPointer,\n argc: number,\n argv_ptrs: JSValueConstPointerPointer,\n ) => JSValuePointer | Promise<JSValuePointer> = this.module.cwrap(\"QTS_Call\", \"number\", [\n \"number\",\n \"number\",\n \"number\",\n \"number\",\n \"number\",\n ])\n\n QTS_ResolveException: (ctx: JSContextPointer, maybe_exception: JSValuePointer) => JSValuePointer =\n this.module.cwrap(\"QTS_ResolveException\", \"number\", [\"number\", \"number\"])\n\n QTS_Dump: (\n ctx: JSContextPointer,\n obj: JSValuePointer | JSValueConstPointer,\n ) => JSBorrowedCharPointer = assertSync(\n this.module.cwrap(\"QTS_Dump\", \"number\", [\"number\", \"number\"]),\n )\n\n QTS_Dump_MaybeAsync: (\n ctx: JSContextPointer,\n obj: JSValuePointer | JSValueConstPointer,\n ) => JSBorrowedCharPointer | Promise<JSBorrowedCharPointer> = this.module.cwrap(\n \"QTS_Dump\",\n \"number\",\n [\"number\", \"number\"],\n )\n\n QTS_Eval: (\n ctx: JSContextPointer,\n js_code: BorrowedHeapCharPointer,\n js_code_length: number,\n filename: string,\n detectModule: EvalDetectModule,\n evalFlags: EvalFlags,\n ) => JSValuePointer = assertSync(\n this.module.cwrap(\"QTS_Eval\", \"number\", [\n \"number\",\n \"number\",\n \"number\",\n \"string\",\n \"number\",\n \"number\",\n ]),\n )\n\n QTS_Eval_MaybeAsync: (\n ctx: JSContextPointer,\n js_code: BorrowedHeapCharPointer,\n js_code_length: number,\n filename: string,\n detectModule: EvalDetectModule,\n evalFlags: EvalFlags,\n ) => JSValuePointer | Promise<JSValuePointer> = this.module.cwrap(\"QTS_Eval\", \"number\", [\n \"number\",\n \"number\",\n \"number\",\n \"string\",\n \"number\",\n \"number\",\n ])\n\n QTS_GetModuleNamespace: (\n ctx: JSContextPointer,\n module_func_obj: JSValuePointer | JSValueConstPointer,\n ) => JSValuePointer = this.module.cwrap(\"QTS_GetModuleNamespace\", \"number\", [\"number\", \"number\"])\n\n QTS_Typeof: (\n ctx: JSContextPointer,\n value: JSValuePointer | JSValueConstPointer,\n ) => OwnedHeapCharPointer = this.module.cwrap(\"QTS_Typeof\", \"number\", [\"number\", \"number\"])\n\n QTS_GetLength: (\n ctx: JSContextPointer,\n out_len: UInt32Pointer,\n value: JSValuePointer | JSValueConstPointer,\n ) => number = this.module.cwrap(\"QTS_GetLength\", \"number\", [\"number\", \"number\", \"number\"])\n\n QTS_IsEqual: (\n ctx: JSContextPointer,\n a: JSValuePointer | JSValueConstPointer,\n b: JSValuePointer | JSValueConstPointer,\n op: IsEqualOp,\n ) => number = this.module.cwrap(\"QTS_IsEqual\", \"number\", [\"number\", \"number\", \"number\", \"number\"])\n\n QTS_GetGlobalObject: (ctx: JSContextPointer) => JSValuePointer = this.module.cwrap(\n \"QTS_GetGlobalObject\",\n \"number\",\n [\"number\"],\n )\n\n QTS_NewPromiseCapability: (\n ctx: JSContextPointer,\n resolve_funcs_out: JSValuePointerPointer,\n ) => JSValuePointer = this.module.cwrap(\"QTS_NewPromiseCapability\", \"number\", [\n \"number\",\n \"number\",\n ])\n\n QTS_PromiseState: (\n ctx: JSContextPointer,\n promise: JSValuePointer | JSValueConstPointer,\n ) => JSPromiseStateEnum = this.module.cwrap(\"QTS_PromiseState\", \"number\", [\"number\", \"number\"])\n\n QTS_PromiseResult: (\n ctx: JSContextPointer,\n promise: JSValuePointer | JSValueConstPointer,\n ) => JSValuePointer = this.module.cwrap(\"QTS_PromiseResult\", \"number\", [\"number\", \"number\"])\n\n QTS_TestStringArg: (string: string) => void = this.module.cwrap(\"QTS_TestStringArg\", null, [\n \"string\",\n ])\n\n QTS_GetDebugLogEnabled: (rt: JSRuntimePointer) => number = this.module.cwrap(\n \"QTS_GetDebugLogEnabled\",\n \"number\",\n [\"number\"],\n )\n\n QTS_SetDebugLogEnabled: (rt: JSRuntimePointer, is_enabled: number) => void = this.module.cwrap(\n \"QTS_SetDebugLogEnabled\",\n null,\n [\"number\", \"number\"],\n )\n\n QTS_BuildIsDebug: () => number = this.module.cwrap(\"QTS_BuildIsDebug\", \"number\", [])\n\n QTS_BuildIsAsyncify: () => number = this.module.cwrap(\"QTS_BuildIsAsyncify\", \"number\", [])\n\n QTS_NewFunction: (ctx: JSContextPointer, func_id: number, name: string) => JSValuePointer =\n this.module.cwrap(\"QTS_NewFunction\", \"number\", [\"number\", \"number\", \"string\"])\n\n QTS_ArgvGetJSValueConstPointer: (\n argv: JSValuePointer | JSValueConstPointer,\n index: number,\n ) => JSValueConstPointer = this.module.cwrap(\"QTS_ArgvGetJSValueConstPointer\", \"number\", [\n \"number\",\n \"number\",\n ])\n\n QTS_RuntimeEnableInterruptHandler: (rt: JSRuntimePointer) => void = this.module.cwrap(\n \"QTS_RuntimeEnableInterruptHandler\",\n null,\n [\"number\"],\n )\n\n QTS_RuntimeDisableInterruptHandler: (rt: JSRuntimePointer) => void = this.module.cwrap(\n \"QTS_RuntimeDisableInterruptHandler\",\n null,\n [\"number\"],\n )\n\n QTS_RuntimeEnableModuleLoader: (rt: JSRuntimePointer, use_custom_normalize: number) => void =\n this.module.cwrap(\"QTS_RuntimeEnableModuleLoader\", null, [\"number\", \"number\"])\n\n QTS_RuntimeDisableModuleLoader: (rt: JSRuntimePointer) => void = this.module.cwrap(\n \"QTS_RuntimeDisableModuleLoader\",\n null,\n [\"number\"],\n )\n\n QTS_bjson_encode: (\n ctx: JSContextPointer,\n val: JSValuePointer | JSValueConstPointer,\n ) => JSValuePointer = this.module.cwrap(\"QTS_bjson_encode\", \"number\", [\"number\", \"number\"])\n\n QTS_bjson_decode: (\n ctx: JSContextPointer,\n data: JSValuePointer | JSValueConstPointer,\n ) => JSValuePointer = this.module.cwrap(\"QTS_bjson_decode\", \"number\", [\"number\", \"number\"])\n\n QTS_EvalFunction: (\n ctx: JSContextPointer,\n fun_obj: JSValuePointer | JSValueConstPointer,\n ) => JSValuePointer = assertSync(\n this.module.cwrap(\"QTS_EvalFunction\", \"number\", [\"number\", \"number\"]),\n )\n\n QTS_EvalFunction_MaybeAsync: (\n ctx: JSContextPointer,\n fun_obj: JSValuePointer | JSValueConstPointer,\n ) => JSValuePointer | Promise<JSValuePointer> = this.module.cwrap(\"QTS_EvalFunction\", \"number\", [\n \"number\",\n \"number\",\n ])\n\n QTS_EncodeBytecode: (\n ctx: JSContextPointer,\n val: JSValuePointer | JSValueConstPointer,\n ) => JSValuePointer = this.module.cwrap(\"QTS_EncodeBytecode\", \"number\", [\"number\", \"number\"])\n\n QTS_DecodeBytecode: (\n ctx: JSContextPointer,\n data: JSValuePointer | JSValueConstPointer,\n ) => JSValuePointer = this.module.cwrap(\"QTS_DecodeBytecode\", \"number\", [\"number\", \"number\"])\n}\n"],"mappings":"wpBAAA,wHACA,6BA0BO,0CASM,gBAAN,KAAsB,CAC3B,YAAoBA,QAAsC,CAAtC,YAAAA,QAEpB,KAAS,MAAQ,GAEjB,eAGsB,KAAK,OAAO,MAAM,YAAa,SAAU,CAAC,SAAU,QAAQ,CAAC,EAEnF,kBAA0D,KAAK,OAAO,MACpE,eACA,SACA,CAAC,QAAQ,CACX,EAEA,+BAA2E,KAAK,OAAO,MACrF,4BACA,KACA,CAAC,SAAU,QAAQ,CACrB,EAEA,mCACE,KAAK,OAAO,MAAM,gCAAiC,SAAU,CAAC,SAAU,QAA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C,EAE/E,oCAAiE,KAAK,OAAO,MAC3E,iCACA,KACA,CAAC,QAAQ,CACX,EAEA,sBAGsB,KAAK,OAAO,MAAM,mBAAoB,SAAU,CAAC,SAAU,QAAQ,CAAC,EAE1F,sBAGsB,KAAK,OAAO,MAAM,mBAAoB,SAAU,CAAC,SAAU,QAAQ,CAAC,EAE1F,yBAGsB,qCACpB,KAAK,OAAO,MAAM,mBAAoB,SAAU,CAAC,SAAU,QAAQ,CAAC,CACtE,EAEA,iCAGgD,KAAK,OAAO,MAAM,mBAAoB,SAAU,CAC9F,SACA,QACF,CAAC,EAED,wBAGsB,KAAK,OAAO,MAAM,qBAAsB,SAAU,CAAC,SAAU,QAAQ,CAAC,EAE5F,wBAGsB,KAAK,OAAO,MAAM,qBAAsB,SAAU,CAAC,SAAU,QAAQ,CAAC,CA7fjC,CA8f7D","names":["module"]}
|
package/dist/ffi.mjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{assertSync}from"@componentor/quickjs-ffi-types";var QuickJSAsyncFFI=class{constructor(module){this.module=module;this.DEBUG=!1;this.QTS_Throw=this.module.cwrap("QTS_Throw","number",["number","number"]);this.QTS_NewError=this.module.cwrap("QTS_NewError","number",["number"]);this.QTS_RuntimeSetMemoryLimit=this.module.cwrap("QTS_RuntimeSetMemoryLimit",null,["number","number"]);this.QTS_RuntimeComputeMemoryUsage=this.module.cwrap("QTS_RuntimeComputeMemoryUsage","number",["number","number"]);this.QTS_RuntimeDumpMemoryUsage=this.module.cwrap("QTS_RuntimeDumpMemoryUsage","number",["number"]);this.QTS_RecoverableLeakCheck=this.module.cwrap("QTS_RecoverableLeakCheck","number",[]);this.QTS_BuildIsSanitizeLeak=this.module.cwrap("QTS_BuildIsSanitizeLeak","number",[]);this.QTS_RuntimeSetMaxStackSize=this.module.cwrap("QTS_RuntimeSetMaxStackSize",null,["number","number"]);this.QTS_GetUndefined=this.module.cwrap("QTS_GetUndefined","number",[]);this.QTS_GetNull=this.module.cwrap("QTS_GetNull","number",[]);this.QTS_GetFalse=this.module.cwrap("QTS_GetFalse","number",[]);this.QTS_GetTrue=this.module.cwrap("QTS_GetTrue","number",[]);this.QTS_NewRuntime=this.module.cwrap("QTS_NewRuntime","number",[]);this.QTS_FreeRuntime=this.module.cwrap("QTS_FreeRuntime",null,["number"]);this.QTS_NewContext=this.module.cwrap("QTS_NewContext","number",["number","number"]);this.QTS_FreeContext=this.module.cwrap("QTS_FreeContext",null,["number"]);this.QTS_FreeValuePointer=this.module.cwrap("QTS_FreeValuePointer",null,["number","number"]);this.QTS_FreeValuePointerRuntime=this.module.cwrap("QTS_FreeValuePointerRuntime",null,["number","number"]);this.QTS_FreeVoidPointer=this.module.cwrap("QTS_FreeVoidPointer",null,["number","number"]);this.QTS_FreeCString=this.module.cwrap("QTS_FreeCString",null,["number","number"]);this.QTS_DupValuePointer=this.module.cwrap("QTS_DupValuePointer","number",["number","number"]);this.QTS_NewObject=this.module.cwrap("QTS_NewObject","number",["number"]);this.QTS_NewObjectProto=this.module.cwrap("QTS_NewObjectProto","number",["number","number"]);this.QTS_NewArray=this.module.cwrap("QTS_NewArray","number",["number"]);this.QTS_NewArrayBuffer=this.module.cwrap("QTS_NewArrayBuffer","number",["number","number","number"]);this.QTS_NewFloat64=this.module.cwrap("QTS_NewFloat64","number",["number","number"]);this.QTS_GetFloat64=this.module.cwrap("QTS_GetFloat64","number",["number","number"]);this.QTS_NewString=this.module.cwrap("QTS_NewString","number",["number","number"]);this.QTS_GetString=this.module.cwrap("QTS_GetString","number",["number","number"]);this.QTS_GetArrayBuffer=this.module.cwrap("QTS_GetArrayBuffer","number",["number","number"]);this.QTS_GetArrayBufferLength=this.module.cwrap("QTS_GetArrayBufferLength","number",["number","number"]);this.QTS_NewSymbol=this.module.cwrap("QTS_NewSymbol","number",["number","number","number"]);this.QTS_GetSymbolDescriptionOrKey=assertSync(this.module.cwrap("QTS_GetSymbolDescriptionOrKey","number",["number","number"]));this.QTS_GetSymbolDescriptionOrKey_MaybeAsync=this.module.cwrap("QTS_GetSymbolDescriptionOrKey","number",["number","number"]);this.QTS_IsGlobalSymbol=this.module.cwrap("QTS_IsGlobalSymbol","number",["number","number"]);this.QTS_IsJobPending=this.module.cwrap("QTS_IsJobPending","number",["number"]);this.QTS_ExecutePendingJob=assertSync(this.module.cwrap("QTS_ExecutePendingJob","number",["number","number","number"]));this.QTS_ExecutePendingJob_MaybeAsync=this.module.cwrap("QTS_ExecutePendingJob","number",["number","number","number"]);this.QTS_GetProp=assertSync(this.module.cwrap("QTS_GetProp","number",["number","number","number"]));this.QTS_GetProp_MaybeAsync=this.module.cwrap("QTS_GetProp","number",["number","number","number"]);this.QTS_GetPropNumber=assertSync(this.module.cwrap("QTS_GetPropNumber","number",["number","number","number"]));this.QTS_GetPropNumber_MaybeAsync=this.module.cwrap("QTS_GetPropNumber","number",["number","number","number"]);this.QTS_SetProp=assertSync(this.module.cwrap("QTS_SetProp",null,["number","number","number","number"]));this.QTS_SetProp_MaybeAsync=this.module.cwrap("QTS_SetProp",null,["number","number","number","number"]);this.QTS_DefineProp=this.module.cwrap("QTS_DefineProp",null,["number","number","number","number","number","number","boolean","boolean","boolean"]);this.QTS_GetOwnPropertyNames=assertSync(this.module.cwrap("QTS_GetOwnPropertyNames","number",["number","number","number","number","number"]));this.QTS_GetOwnPropertyNames_MaybeAsync=this.module.cwrap("QTS_GetOwnPropertyNames","number",["number","number","number","number","number"]);this.QTS_Call=assertSync(this.module.cwrap("QTS_Call","number",["number","number","number","number","number"]));this.QTS_Call_MaybeAsync=this.module.cwrap("QTS_Call","number",["number","number","number","number","number"]);this.QTS_ResolveException=this.module.cwrap("QTS_ResolveException","number",["number","number"]);this.QTS_Dump=assertSync(this.module.cwrap("QTS_Dump","number",["number","number"]));this.QTS_Dump_MaybeAsync=this.module.cwrap("QTS_Dump","number",["number","number"]);this.QTS_Eval=assertSync(this.module.cwrap("QTS_Eval","number",["number","number","number","string","number","number"]));this.QTS_Eval_MaybeAsync=this.module.cwrap("QTS_Eval","number",["number","number","number","string","number","number"]);this.QTS_GetModuleNamespace=this.module.cwrap("QTS_GetModuleNamespace","number",["number","number"]);this.QTS_Typeof=this.module.cwrap("QTS_Typeof","number",["number","number"]);this.QTS_GetLength=this.module.cwrap("QTS_GetLength","number",["number","number","number"]);this.QTS_IsEqual=this.module.cwrap("QTS_IsEqual","number",["number","number","number","number"]);this.QTS_GetGlobalObject=this.module.cwrap("QTS_GetGlobalObject","number",["number"]);this.QTS_NewPromiseCapability=this.module.cwrap("QTS_NewPromiseCapability","number",["number","number"]);this.QTS_PromiseState=this.module.cwrap("QTS_PromiseState","number",["number","number"]);this.QTS_PromiseResult=this.module.cwrap("QTS_PromiseResult","number",["number","number"]);this.QTS_TestStringArg=this.module.cwrap("QTS_TestStringArg",null,["string"]);this.QTS_GetDebugLogEnabled=this.module.cwrap("QTS_GetDebugLogEnabled","number",["number"]);this.QTS_SetDebugLogEnabled=this.module.cwrap("QTS_SetDebugLogEnabled",null,["number","number"]);this.QTS_BuildIsDebug=this.module.cwrap("QTS_BuildIsDebug","number",[]);this.QTS_BuildIsAsyncify=this.module.cwrap("QTS_BuildIsAsyncify","number",[]);this.QTS_NewFunction=this.module.cwrap("QTS_NewFunction","number",["number","number","string"]);this.QTS_ArgvGetJSValueConstPointer=this.module.cwrap("QTS_ArgvGetJSValueConstPointer","number",["number","number"]);this.QTS_RuntimeEnableInterruptHandler=this.module.cwrap("QTS_RuntimeEnableInterruptHandler",null,["number"]);this.QTS_RuntimeDisableInterruptHandler=this.module.cwrap("QTS_RuntimeDisableInterruptHandler",null,["number"]);this.QTS_RuntimeEnableModuleLoader=this.module.cwrap("QTS_RuntimeEnableModuleLoader",null,["number","number"]);this.QTS_RuntimeDisableModuleLoader=this.module.cwrap("QTS_RuntimeDisableModuleLoader",null,["number"]);this.QTS_bjson_encode=this.module.cwrap("QTS_bjson_encode","number",["number","number"]);this.QTS_bjson_decode=this.module.cwrap("QTS_bjson_decode","number",["number","number"]);this.QTS_EvalFunction=assertSync(this.module.cwrap("QTS_EvalFunction","number",["number","number"]));this.QTS_EvalFunction_MaybeAsync=this.module.cwrap("QTS_EvalFunction","number",["number","number"]);this.QTS_EncodeBytecode=this.module.cwrap("QTS_EncodeBytecode","number",["number","number"]);this.QTS_DecodeBytecode=this.module.cwrap("QTS_DecodeBytecode","number",["number","number"])}};export{QuickJSAsyncFFI};
|
|
2
|
+
//# sourceMappingURL=ffi.mjs.map
|
package/dist/ffi.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/ffi.ts"],"sourcesContent":["// This file generated by \"generate.ts ffi\" in the root of the repo.\nimport {\n QuickJSAsyncEmscriptenModule,\n JSRuntimePointer,\n JSContextPointer,\n JSContextPointerPointer,\n JSModuleDefPointer,\n JSValuePointer,\n JSValueConstPointer,\n JSValuePointerPointer,\n JSValuePointerPointerPointer,\n JSValueConstPointerPointer,\n QTS_C_To_HostCallbackFuncPointer,\n QTS_C_To_HostInterruptFuncPointer,\n QTS_C_To_HostLoadModuleFuncPointer,\n BorrowedHeapCharPointer,\n OwnedHeapCharPointer,\n JSBorrowedCharPointer,\n JSVoidPointer,\n UInt32Pointer,\n EvalFlags,\n IntrinsicsFlags,\n EvalDetectModule,\n GetOwnPropertyNamesFlags,\n IsEqualOp,\n JSPromiseStateEnum,\n assertSync,\n} from \"@componentor/quickjs-ffi-types\"\n\n/**\n * Low-level FFI bindings to QuickJS's Emscripten module.\n * See instead {@link QuickJSContext}, the public Javascript interface exposed by this\n * library.\n *\n * @unstable The FFI interface is considered private and may change.\n */\nexport class QuickJSAsyncFFI {\n constructor(private module: QuickJSAsyncEmscriptenModule) {}\n /** Set at compile time. */\n readonly DEBUG = false\n\n QTS_Throw: (\n ctx: JSContextPointer,\n error: JSValuePointer | JSValueConstPointer,\n ) => JSValuePointer = this.module.cwrap(\"QTS_Throw\", \"number\", [\"number\", \"number\"])\n\n QTS_NewError: (ctx: JSContextPointer) => JSValuePointer = this.module.cwrap(\n \"QTS_NewError\",\n \"number\",\n [\"number\"],\n )\n\n QTS_RuntimeSetMemoryLimit: (rt: JSRuntimePointer, limit: number) => void = this.module.cwrap(\n \"QTS_RuntimeSetMemoryLimit\",\n null,\n [\"number\", \"number\"],\n )\n\n QTS_RuntimeComputeMemoryUsage: (rt: JSRuntimePointer, ctx: JSContextPointer) => JSValuePointer =\n this.module.cwrap(\"QTS_RuntimeComputeMemoryUsage\", \"number\", [\"number\", \"number\"])\n\n QTS_RuntimeDumpMemoryUsage: (rt: JSRuntimePointer) => OwnedHeapCharPointer = this.module.cwrap(\n \"QTS_RuntimeDumpMemoryUsage\",\n \"number\",\n [\"number\"],\n )\n\n QTS_RecoverableLeakCheck: () => number = this.module.cwrap(\n \"QTS_RecoverableLeakCheck\",\n \"number\",\n [],\n )\n\n QTS_BuildIsSanitizeLeak: () => number = this.module.cwrap(\"QTS_BuildIsSanitizeLeak\", \"number\", [])\n\n QTS_RuntimeSetMaxStackSize: (rt: JSRuntimePointer, stack_size: number) => void =\n this.module.cwrap(\"QTS_RuntimeSetMaxStackSize\", null, [\"number\", \"number\"])\n\n QTS_GetUndefined: () => JSValueConstPointer = this.module.cwrap(\"QTS_GetUndefined\", \"number\", [])\n\n QTS_GetNull: () => JSValueConstPointer = this.module.cwrap(\"QTS_GetNull\", \"number\", [])\n\n QTS_GetFalse: () => JSValueConstPointer = this.module.cwrap(\"QTS_GetFalse\", \"number\", [])\n\n QTS_GetTrue: () => JSValueConstPointer = this.module.cwrap(\"QTS_GetTrue\", \"number\", [])\n\n QTS_NewRuntime: () => JSRuntimePointer = this.module.cwrap(\"QTS_NewRuntime\", \"number\", [])\n\n QTS_FreeRuntime: (rt: JSRuntimePointer) => void = this.module.cwrap(\"QTS_FreeRuntime\", null, [\n \"number\",\n ])\n\n QTS_NewContext: (rt: JSRuntimePointer, intrinsics: IntrinsicsFlags) => JSContextPointer =\n this.module.cwrap(\"QTS_NewContext\", \"number\", [\"number\", \"number\"])\n\n QTS_FreeContext: (ctx: JSContextPointer) => void = this.module.cwrap(\"QTS_FreeContext\", null, [\n \"number\",\n ])\n\n QTS_FreeValuePointer: (ctx: JSContextPointer, value: JSValuePointer) => void = this.module.cwrap(\n \"QTS_FreeValuePointer\",\n null,\n [\"number\", \"number\"],\n )\n\n QTS_FreeValuePointerRuntime: (rt: JSRuntimePointer, value: JSValuePointer) => void =\n this.module.cwrap(\"QTS_FreeValuePointerRuntime\", null, [\"number\", \"number\"])\n\n QTS_FreeVoidPointer: (ctx: JSContextPointer, ptr: JSVoidPointer) => void = this.module.cwrap(\n \"QTS_FreeVoidPointer\",\n null,\n [\"number\", \"number\"],\n )\n\n QTS_FreeCString: (ctx: JSContextPointer, str: JSBorrowedCharPointer) => void = this.module.cwrap(\n \"QTS_FreeCString\",\n null,\n [\"number\", \"number\"],\n )\n\n QTS_DupValuePointer: (\n ctx: JSContextPointer,\n val: JSValuePointer | JSValueConstPointer,\n ) => JSValuePointer = this.module.cwrap(\"QTS_DupValuePointer\", \"number\", [\"number\", \"number\"])\n\n QTS_NewObject: (ctx: JSContextPointer) => JSValuePointer = this.module.cwrap(\n \"QTS_NewObject\",\n \"number\",\n [\"number\"],\n )\n\n QTS_NewObjectProto: (\n ctx: JSContextPointer,\n proto: JSValuePointer | JSValueConstPointer,\n ) => JSValuePointer = this.module.cwrap(\"QTS_NewObjectProto\", \"number\", [\"number\", \"number\"])\n\n QTS_NewArray: (ctx: JSContextPointer) => JSValuePointer = this.module.cwrap(\n \"QTS_NewArray\",\n \"number\",\n [\"number\"],\n )\n\n QTS_NewArrayBuffer: (\n ctx: JSContextPointer,\n buffer: JSVoidPointer,\n length: number,\n ) => JSValuePointer = this.module.cwrap(\"QTS_NewArrayBuffer\", \"number\", [\n \"number\",\n \"number\",\n \"number\",\n ])\n\n QTS_NewFloat64: (ctx: JSContextPointer, num: number) => JSValuePointer = this.module.cwrap(\n \"QTS_NewFloat64\",\n \"number\",\n [\"number\", \"number\"],\n )\n\n QTS_GetFloat64: (ctx: JSContextPointer, value: JSValuePointer | JSValueConstPointer) => number =\n this.module.cwrap(\"QTS_GetFloat64\", \"number\", [\"number\", \"number\"])\n\n QTS_NewString: (ctx: JSContextPointer, string: BorrowedHeapCharPointer) => JSValuePointer =\n this.module.cwrap(\"QTS_NewString\", \"number\", [\"number\", \"number\"])\n\n QTS_GetString: (\n ctx: JSContextPointer,\n value: JSValuePointer | JSValueConstPointer,\n ) => JSBorrowedCharPointer = this.module.cwrap(\"QTS_GetString\", \"number\", [\"number\", \"number\"])\n\n QTS_GetArrayBuffer: (\n ctx: JSContextPointer,\n data: JSValuePointer | JSValueConstPointer,\n ) => JSVoidPointer = this.module.cwrap(\"QTS_GetArrayBuffer\", \"number\", [\"number\", \"number\"])\n\n QTS_GetArrayBufferLength: (\n ctx: JSContextPointer,\n data: JSValuePointer | JSValueConstPointer,\n ) => number = this.module.cwrap(\"QTS_GetArrayBufferLength\", \"number\", [\"number\", \"number\"])\n\n QTS_NewSymbol: (\n ctx: JSContextPointer,\n description: BorrowedHeapCharPointer,\n isGlobal: number,\n ) => JSValuePointer = this.module.cwrap(\"QTS_NewSymbol\", \"number\", [\"number\", \"number\", \"number\"])\n\n QTS_GetSymbolDescriptionOrKey: (\n ctx: JSContextPointer,\n value: JSValuePointer | JSValueConstPointer,\n ) => JSBorrowedCharPointer = assertSync(\n this.module.cwrap(\"QTS_GetSymbolDescriptionOrKey\", \"number\", [\"number\", \"number\"]),\n )\n\n QTS_GetSymbolDescriptionOrKey_MaybeAsync: (\n ctx: JSContextPointer,\n value: JSValuePointer | JSValueConstPointer,\n ) => JSBorrowedCharPointer | Promise<JSBorrowedCharPointer> = this.module.cwrap(\n \"QTS_GetSymbolDescriptionOrKey\",\n \"number\",\n [\"number\", \"number\"],\n )\n\n QTS_IsGlobalSymbol: (\n ctx: JSContextPointer,\n value: JSValuePointer | JSValueConstPointer,\n ) => number = this.module.cwrap(\"QTS_IsGlobalSymbol\", \"number\", [\"number\", \"number\"])\n\n QTS_IsJobPending: (rt: JSRuntimePointer) => number = this.module.cwrap(\n \"QTS_IsJobPending\",\n \"number\",\n [\"number\"],\n )\n\n QTS_ExecutePendingJob: (\n rt: JSRuntimePointer,\n maxJobsToExecute: number,\n lastJobContext: JSContextPointerPointer,\n ) => JSValuePointer = assertSync(\n this.module.cwrap(\"QTS_ExecutePendingJob\", \"number\", [\"number\", \"number\", \"number\"]),\n )\n\n QTS_ExecutePendingJob_MaybeAsync: (\n rt: JSRuntimePointer,\n maxJobsToExecute: number,\n lastJobContext: JSContextPointerPointer,\n ) => JSValuePointer | Promise<JSValuePointer> = this.module.cwrap(\n \"QTS_ExecutePendingJob\",\n \"number\",\n [\"number\", \"number\", \"number\"],\n )\n\n QTS_GetProp: (\n ctx: JSContextPointer,\n this_val: JSValuePointer | JSValueConstPointer,\n prop_name: JSValuePointer | JSValueConstPointer,\n ) => JSValuePointer = assertSync(\n this.module.cwrap(\"QTS_GetProp\", \"number\", [\"number\", \"number\", \"number\"]),\n )\n\n QTS_GetProp_MaybeAsync: (\n ctx: JSContextPointer,\n this_val: JSValuePointer | JSValueConstPointer,\n prop_name: JSValuePointer | JSValueConstPointer,\n ) => JSValuePointer | Promise<JSValuePointer> = this.module.cwrap(\"QTS_GetProp\", \"number\", [\n \"number\",\n \"number\",\n \"number\",\n ])\n\n QTS_GetPropNumber: (\n ctx: JSContextPointer,\n this_val: JSValuePointer | JSValueConstPointer,\n prop_name: number,\n ) => JSValuePointer = assertSync(\n this.module.cwrap(\"QTS_GetPropNumber\", \"number\", [\"number\", \"number\", \"number\"]),\n )\n\n QTS_GetPropNumber_MaybeAsync: (\n ctx: JSContextPointer,\n this_val: JSValuePointer | JSValueConstPointer,\n prop_name: number,\n ) => JSValuePointer | Promise<JSValuePointer> = this.module.cwrap(\"QTS_GetPropNumber\", \"number\", [\n \"number\",\n \"number\",\n \"number\",\n ])\n\n QTS_SetProp: (\n ctx: JSContextPointer,\n this_val: JSValuePointer | JSValueConstPointer,\n prop_name: JSValuePointer | JSValueConstPointer,\n prop_value: JSValuePointer | JSValueConstPointer,\n ) => void = assertSync(\n this.module.cwrap(\"QTS_SetProp\", null, [\"number\", \"number\", \"number\", \"number\"]),\n )\n\n QTS_SetProp_MaybeAsync: (\n ctx: JSContextPointer,\n this_val: JSValuePointer | JSValueConstPointer,\n prop_name: JSValuePointer | JSValueConstPointer,\n prop_value: JSValuePointer | JSValueConstPointer,\n ) => void | Promise<void> = this.module.cwrap(\"QTS_SetProp\", null, [\n \"number\",\n \"number\",\n \"number\",\n \"number\",\n ])\n\n QTS_DefineProp: (\n ctx: JSContextPointer,\n this_val: JSValuePointer | JSValueConstPointer,\n prop_name: JSValuePointer | JSValueConstPointer,\n prop_value: JSValuePointer | JSValueConstPointer,\n get: JSValuePointer | JSValueConstPointer,\n set: JSValuePointer | JSValueConstPointer,\n configurable: boolean,\n enumerable: boolean,\n has_value: boolean,\n ) => void = this.module.cwrap(\"QTS_DefineProp\", null, [\n \"number\",\n \"number\",\n \"number\",\n \"number\",\n \"number\",\n \"number\",\n \"boolean\",\n \"boolean\",\n \"boolean\",\n ])\n\n QTS_GetOwnPropertyNames: (\n ctx: JSContextPointer,\n out_ptrs: JSValuePointerPointerPointer,\n out_len: UInt32Pointer,\n obj: JSValuePointer | JSValueConstPointer,\n flags: number,\n ) => JSValuePointer = assertSync(\n this.module.cwrap(\"QTS_GetOwnPropertyNames\", \"number\", [\n \"number\",\n \"number\",\n \"number\",\n \"number\",\n \"number\",\n ]),\n )\n\n QTS_GetOwnPropertyNames_MaybeAsync: (\n ctx: JSContextPointer,\n out_ptrs: JSValuePointerPointerPointer,\n out_len: UInt32Pointer,\n obj: JSValuePointer | JSValueConstPointer,\n flags: number,\n ) => JSValuePointer | Promise<JSValuePointer> = this.module.cwrap(\n \"QTS_GetOwnPropertyNames\",\n \"number\",\n [\"number\", \"number\", \"number\", \"number\", \"number\"],\n )\n\n QTS_Call: (\n ctx: JSContextPointer,\n func_obj: JSValuePointer | JSValueConstPointer,\n this_obj: JSValuePointer | JSValueConstPointer,\n argc: number,\n argv_ptrs: JSValueConstPointerPointer,\n ) => JSValuePointer = assertSync(\n this.module.cwrap(\"QTS_Call\", \"number\", [\"number\", \"number\", \"number\", \"number\", \"number\"]),\n )\n\n QTS_Call_MaybeAsync: (\n ctx: JSContextPointer,\n func_obj: JSValuePointer | JSValueConstPointer,\n this_obj: JSValuePointer | JSValueConstPointer,\n argc: number,\n argv_ptrs: JSValueConstPointerPointer,\n ) => JSValuePointer | Promise<JSValuePointer> = this.module.cwrap(\"QTS_Call\", \"number\", [\n \"number\",\n \"number\",\n \"number\",\n \"number\",\n \"number\",\n ])\n\n QTS_ResolveException: (ctx: JSContextPointer, maybe_exception: JSValuePointer) => JSValuePointer =\n this.module.cwrap(\"QTS_ResolveException\", \"number\", [\"number\", \"number\"])\n\n QTS_Dump: (\n ctx: JSContextPointer,\n obj: JSValuePointer | JSValueConstPointer,\n ) => JSBorrowedCharPointer = assertSync(\n this.module.cwrap(\"QTS_Dump\", \"number\", [\"number\", \"number\"]),\n )\n\n QTS_Dump_MaybeAsync: (\n ctx: JSContextPointer,\n obj: JSValuePointer | JSValueConstPointer,\n ) => JSBorrowedCharPointer | Promise<JSBorrowedCharPointer> = this.module.cwrap(\n \"QTS_Dump\",\n \"number\",\n [\"number\", \"number\"],\n )\n\n QTS_Eval: (\n ctx: JSContextPointer,\n js_code: BorrowedHeapCharPointer,\n js_code_length: number,\n filename: string,\n detectModule: EvalDetectModule,\n evalFlags: EvalFlags,\n ) => JSValuePointer = assertSync(\n this.module.cwrap(\"QTS_Eval\", \"number\", [\n \"number\",\n \"number\",\n \"number\",\n \"string\",\n \"number\",\n \"number\",\n ]),\n )\n\n QTS_Eval_MaybeAsync: (\n ctx: JSContextPointer,\n js_code: BorrowedHeapCharPointer,\n js_code_length: number,\n filename: string,\n detectModule: EvalDetectModule,\n evalFlags: EvalFlags,\n ) => JSValuePointer | Promise<JSValuePointer> = this.module.cwrap(\"QTS_Eval\", \"number\", [\n \"number\",\n \"number\",\n \"number\",\n \"string\",\n \"number\",\n \"number\",\n ])\n\n QTS_GetModuleNamespace: (\n ctx: JSContextPointer,\n module_func_obj: JSValuePointer | JSValueConstPointer,\n ) => JSValuePointer = this.module.cwrap(\"QTS_GetModuleNamespace\", \"number\", [\"number\", \"number\"])\n\n QTS_Typeof: (\n ctx: JSContextPointer,\n value: JSValuePointer | JSValueConstPointer,\n ) => OwnedHeapCharPointer = this.module.cwrap(\"QTS_Typeof\", \"number\", [\"number\", \"number\"])\n\n QTS_GetLength: (\n ctx: JSContextPointer,\n out_len: UInt32Pointer,\n value: JSValuePointer | JSValueConstPointer,\n ) => number = this.module.cwrap(\"QTS_GetLength\", \"number\", [\"number\", \"number\", \"number\"])\n\n QTS_IsEqual: (\n ctx: JSContextPointer,\n a: JSValuePointer | JSValueConstPointer,\n b: JSValuePointer | JSValueConstPointer,\n op: IsEqualOp,\n ) => number = this.module.cwrap(\"QTS_IsEqual\", \"number\", [\"number\", \"number\", \"number\", \"number\"])\n\n QTS_GetGlobalObject: (ctx: JSContextPointer) => JSValuePointer = this.module.cwrap(\n \"QTS_GetGlobalObject\",\n \"number\",\n [\"number\"],\n )\n\n QTS_NewPromiseCapability: (\n ctx: JSContextPointer,\n resolve_funcs_out: JSValuePointerPointer,\n ) => JSValuePointer = this.module.cwrap(\"QTS_NewPromiseCapability\", \"number\", [\n \"number\",\n \"number\",\n ])\n\n QTS_PromiseState: (\n ctx: JSContextPointer,\n promise: JSValuePointer | JSValueConstPointer,\n ) => JSPromiseStateEnum = this.module.cwrap(\"QTS_PromiseState\", \"number\", [\"number\", \"number\"])\n\n QTS_PromiseResult: (\n ctx: JSContextPointer,\n promise: JSValuePointer | JSValueConstPointer,\n ) => JSValuePointer = this.module.cwrap(\"QTS_PromiseResult\", \"number\", [\"number\", \"number\"])\n\n QTS_TestStringArg: (string: string) => void = this.module.cwrap(\"QTS_TestStringArg\", null, [\n \"string\",\n ])\n\n QTS_GetDebugLogEnabled: (rt: JSRuntimePointer) => number = this.module.cwrap(\n \"QTS_GetDebugLogEnabled\",\n \"number\",\n [\"number\"],\n )\n\n QTS_SetDebugLogEnabled: (rt: JSRuntimePointer, is_enabled: number) => void = this.module.cwrap(\n \"QTS_SetDebugLogEnabled\",\n null,\n [\"number\", \"number\"],\n )\n\n QTS_BuildIsDebug: () => number = this.module.cwrap(\"QTS_BuildIsDebug\", \"number\", [])\n\n QTS_BuildIsAsyncify: () => number = this.module.cwrap(\"QTS_BuildIsAsyncify\", \"number\", [])\n\n QTS_NewFunction: (ctx: JSContextPointer, func_id: number, name: string) => JSValuePointer =\n this.module.cwrap(\"QTS_NewFunction\", \"number\", [\"number\", \"number\", \"string\"])\n\n QTS_ArgvGetJSValueConstPointer: (\n argv: JSValuePointer | JSValueConstPointer,\n index: number,\n ) => JSValueConstPointer = this.module.cwrap(\"QTS_ArgvGetJSValueConstPointer\", \"number\", [\n \"number\",\n \"number\",\n ])\n\n QTS_RuntimeEnableInterruptHandler: (rt: JSRuntimePointer) => void = this.module.cwrap(\n \"QTS_RuntimeEnableInterruptHandler\",\n null,\n [\"number\"],\n )\n\n QTS_RuntimeDisableInterruptHandler: (rt: JSRuntimePointer) => void = this.module.cwrap(\n \"QTS_RuntimeDisableInterruptHandler\",\n null,\n [\"number\"],\n )\n\n QTS_RuntimeEnableModuleLoader: (rt: JSRuntimePointer, use_custom_normalize: number) => void =\n this.module.cwrap(\"QTS_RuntimeEnableModuleLoader\", null, [\"number\", \"number\"])\n\n QTS_RuntimeDisableModuleLoader: (rt: JSRuntimePointer) => void = this.module.cwrap(\n \"QTS_RuntimeDisableModuleLoader\",\n null,\n [\"number\"],\n )\n\n QTS_bjson_encode: (\n ctx: JSContextPointer,\n val: JSValuePointer | JSValueConstPointer,\n ) => JSValuePointer = this.module.cwrap(\"QTS_bjson_encode\", \"number\", [\"number\", \"number\"])\n\n QTS_bjson_decode: (\n ctx: JSContextPointer,\n data: JSValuePointer | JSValueConstPointer,\n ) => JSValuePointer = this.module.cwrap(\"QTS_bjson_decode\", \"number\", [\"number\", \"number\"])\n\n QTS_EvalFunction: (\n ctx: JSContextPointer,\n fun_obj: JSValuePointer | JSValueConstPointer,\n ) => JSValuePointer = assertSync(\n this.module.cwrap(\"QTS_EvalFunction\", \"number\", [\"number\", \"number\"]),\n )\n\n QTS_EvalFunction_MaybeAsync: (\n ctx: JSContextPointer,\n fun_obj: JSValuePointer | JSValueConstPointer,\n ) => JSValuePointer | Promise<JSValuePointer> = this.module.cwrap(\"QTS_EvalFunction\", \"number\", [\n \"number\",\n \"number\",\n ])\n\n QTS_EncodeBytecode: (\n ctx: JSContextPointer,\n val: JSValuePointer | JSValueConstPointer,\n ) => JSValuePointer = this.module.cwrap(\"QTS_EncodeBytecode\", \"number\", [\"number\", \"number\"])\n\n QTS_DecodeBytecode: (\n ctx: JSContextPointer,\n data: JSValuePointer | JSValueConstPointer,\n ) => JSValuePointer = this.module.cwrap(\"QTS_DecodeBytecode\", \"number\", [\"number\", \"number\"])\n}\n"],"mappings":"AACA,OAyBE,eACK,iCASA,IAAM,gBAAN,KAAsB,CAC3B,YAAoB,OAAsC,CAAtC,mBAEpB,KAAS,MAAQ,GAEjB,eAGsB,KAAK,OAAO,MAAM,YAAa,SAAU,CAAC,SAAU,QAAQ,CAAC,EAEnF,kBAA0D,KAAK,OAAO,MACpE,eACA,SACA,CAAC,QAAQ,CACX,EAEA,+BAA2E,KAAK,OAAO,MACrF,4BACA,KACA,CAAC,SAAU,QAAQ,CACrB,EAEA,mCACE,KAAK,OAAO,MAAM,gCAAiC,SAAU,CAAC,SAAU,QAAQ,CAAC,EAEnF,gCAA6E,KAAK,OAAO,MACvF,6BACA,SACA,CAAC,QAAQ,CACX,EAEA,8BAAyC,KAAK,OAAO,MACnD,2BACA,SACA,CAAC,CACH,EAEA,6BAAwC,KAAK,OAAO,MAAM,0BAA2B,SAAU,CAAC,CAAC,EAEjG,gCACE,KAAK,OAAO,MAAM,6BAA8B,KAAM,CA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AM,mBAAoB,SAAU,CAAC,SAAU,QAAQ,CAAC,CACtE,EAEA,iCAGgD,KAAK,OAAO,MAAM,mBAAoB,SAAU,CAC9F,SACA,QACF,CAAC,EAED,wBAGsB,KAAK,OAAO,MAAM,qBAAsB,SAAU,CAAC,SAAU,QAAQ,CAAC,EAE5F,wBAGsB,KAAK,OAAO,MAAM,qBAAsB,SAAU,CAAC,SAAU,QAAQ,CAAC,CA7fjC,CA8f7D","names":[]}
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { QuickJSAsyncVariant } from '@componentor/quickjs-ffi-types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* ### @componentor/quickjs-wasmfile-release-asyncify
|
|
5
|
+
*
|
|
6
|
+
* [Docs](https://github.com/componentor/quickjs-emscripten/blob/main/doc/@componentor/quickjs-wasmfile-release-asyncify/README.md) |
|
|
7
|
+
* Variant with separate .WASM file. Supports browser ESM, NodeJS ESM, and NodeJS CommonJS.
|
|
8
|
+
*
|
|
9
|
+
* | Variable | Setting | Description |
|
|
10
|
+
* | -- | -- | -- |
|
|
11
|
+
* | library | quickjs | The original [bellard/quickjs](https://github.com/bellard/quickjs) library. Version [2024-02-14+36911f0d](https://github.com/bellard/quickjs/commit/36911f0d3ab1a4c190a4d5cbe7c2db225a455389) vendored to quickjs-emscripten on 2024-06-15. |
|
|
12
|
+
* | releaseMode | release | Optimized for performance; use when building/deploying your application. |
|
|
13
|
+
* | syncMode | asyncify | 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. |
|
|
14
|
+
* | emscriptenInclusion | wasm | Has a separate .wasm file. May offer better caching in your browser, and reduces the size of your JS bundle. If you have issues, try a 'singlefile' variant. |
|
|
15
|
+
* | exports | require import browser workerd | Has these package.json export conditions |
|
|
16
|
+
*
|
|
17
|
+
*/
|
|
18
|
+
declare const variant: QuickJSAsyncVariant;
|
|
19
|
+
|
|
20
|
+
export { variant as default };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { QuickJSAsyncVariant } from '@componentor/quickjs-ffi-types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* ### @componentor/quickjs-wasmfile-release-asyncify
|
|
5
|
+
*
|
|
6
|
+
* [Docs](https://github.com/componentor/quickjs-emscripten/blob/main/doc/@componentor/quickjs-wasmfile-release-asyncify/README.md) |
|
|
7
|
+
* Variant with separate .WASM file. Supports browser ESM, NodeJS ESM, and NodeJS CommonJS.
|
|
8
|
+
*
|
|
9
|
+
* | Variable | Setting | Description |
|
|
10
|
+
* | -- | -- | -- |
|
|
11
|
+
* | library | quickjs | The original [bellard/quickjs](https://github.com/bellard/quickjs) library. Version [2024-02-14+36911f0d](https://github.com/bellard/quickjs/commit/36911f0d3ab1a4c190a4d5cbe7c2db225a455389) vendored to quickjs-emscripten on 2024-06-15. |
|
|
12
|
+
* | releaseMode | release | Optimized for performance; use when building/deploying your application. |
|
|
13
|
+
* | syncMode | asyncify | 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. |
|
|
14
|
+
* | emscriptenInclusion | wasm | Has a separate .wasm file. May offer better caching in your browser, and reduces the size of your JS bundle. If you have issues, try a 'singlefile' variant. |
|
|
15
|
+
* | exports | require import browser workerd | Has these package.json export conditions |
|
|
16
|
+
*
|
|
17
|
+
*/
|
|
18
|
+
declare const variant: QuickJSAsyncVariant;
|
|
19
|
+
|
|
20
|
+
export { variant as default };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var __create=Object.create;var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty;var __esm=(fn,res)=>function(){return fn&&(res=(0,fn[__getOwnPropNames(fn)[0]])(fn=0)),res};var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toESM=(mod,isNodeMode,target)=>(target=mod!=null?__create(__getProtoOf(mod)):{},__copyProps(isNodeMode||!mod||!mod.__esModule?__defProp(target,"default",{value:mod,enumerable:!0}):target,mod)),__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var ffi_exports={};__export(ffi_exports,{QuickJSAsyncFFI:()=>QuickJSAsyncFFI});var import_quickjs_ffi_types,QuickJSAsyncFFI,init_ffi=__esm({"src/ffi.ts"(){"use strict";import_quickjs_ffi_types=require("@componentor/quickjs-ffi-types"),QuickJSAsyncFFI=class{constructor(module2){this.module=module2;this.DEBUG=!1;this.QTS_Throw=this.module.cwrap("QTS_Throw","number",["number","number"]);this.QTS_NewError=this.module.cwrap("QTS_NewError","number",["number"]);this.QTS_RuntimeSetMemoryLimit=this.module.cwrap("QTS_RuntimeSetMemoryLimit",null,["number","number"]);this.QTS_RuntimeComputeMemoryUsage=this.module.cwrap("QTS_RuntimeComputeMemoryUsage","number",["number","number"]);this.QTS_RuntimeDumpMemoryUsage=this.module.cwrap("QTS_RuntimeDumpMemoryUsage","number",["number"]);this.QTS_RecoverableLeakCheck=this.module.cwrap("QTS_RecoverableLeakCheck","number",[]);this.QTS_BuildIsSanitizeLeak=this.module.cwrap("QTS_BuildIsSanitizeLeak","number",[]);this.QTS_RuntimeSetMaxStackSize=this.module.cwrap("QTS_RuntimeSetMaxStackSize",null,["number","number"]);this.QTS_GetUndefined=this.module.cwrap("QTS_GetUndefined","number",[]);this.QTS_GetNull=this.module.cwrap("QTS_GetNull","number",[]);this.QTS_GetFalse=this.module.cwrap("QTS_GetFalse","number",[]);this.QTS_GetTrue=this.module.cwrap("QTS_GetTrue","number",[]);this.QTS_NewRuntime=this.module.cwrap("QTS_NewRuntime","number",[]);this.QTS_FreeRuntime=this.module.cwrap("QTS_FreeRuntime",null,["number"]);this.QTS_NewContext=this.module.cwrap("QTS_NewContext","number",["number","number"]);this.QTS_FreeContext=this.module.cwrap("QTS_FreeContext",null,["number"]);this.QTS_FreeValuePointer=this.module.cwrap("QTS_FreeValuePointer",null,["number","number"]);this.QTS_FreeValuePointerRuntime=this.module.cwrap("QTS_FreeValuePointerRuntime",null,["number","number"]);this.QTS_FreeVoidPointer=this.module.cwrap("QTS_FreeVoidPointer",null,["number","number"]);this.QTS_FreeCString=this.module.cwrap("QTS_FreeCString",null,["number","number"]);this.QTS_DupValuePointer=this.module.cwrap("QTS_DupValuePointer","number",["number","number"]);this.QTS_NewObject=this.module.cwrap("QTS_NewObject","number",["number"]);this.QTS_NewObjectProto=this.module.cwrap("QTS_NewObjectProto","number",["number","number"]);this.QTS_NewArray=this.module.cwrap("QTS_NewArray","number",["number"]);this.QTS_NewArrayBuffer=this.module.cwrap("QTS_NewArrayBuffer","number",["number","number","number"]);this.QTS_NewFloat64=this.module.cwrap("QTS_NewFloat64","number",["number","number"]);this.QTS_GetFloat64=this.module.cwrap("QTS_GetFloat64","number",["number","number"]);this.QTS_NewString=this.module.cwrap("QTS_NewString","number",["number","number"]);this.QTS_GetString=this.module.cwrap("QTS_GetString","number",["number","number"]);this.QTS_GetArrayBuffer=this.module.cwrap("QTS_GetArrayBuffer","number",["number","number"]);this.QTS_GetArrayBufferLength=this.module.cwrap("QTS_GetArrayBufferLength","number",["number","number"]);this.QTS_NewSymbol=this.module.cwrap("QTS_NewSymbol","number",["number","number","number"]);this.QTS_GetSymbolDescriptionOrKey=(0,import_quickjs_ffi_types.assertSync)(this.module.cwrap("QTS_GetSymbolDescriptionOrKey","number",["number","number"]));this.QTS_GetSymbolDescriptionOrKey_MaybeAsync=this.module.cwrap("QTS_GetSymbolDescriptionOrKey","number",["number","number"]);this.QTS_IsGlobalSymbol=this.module.cwrap("QTS_IsGlobalSymbol","number",["number","number"]);this.QTS_IsJobPending=this.module.cwrap("QTS_IsJobPending","number",["number"]);this.QTS_ExecutePendingJob=(0,import_quickjs_ffi_types.assertSync)(this.module.cwrap("QTS_ExecutePendingJob","number",["number","number","number"]));this.QTS_ExecutePendingJob_MaybeAsync=this.module.cwrap("QTS_ExecutePendingJob","number",["number","number","number"]);this.QTS_GetProp=(0,import_quickjs_ffi_types.assertSync)(this.module.cwrap("QTS_GetProp","number",["number","number","number"]));this.QTS_GetProp_MaybeAsync=this.module.cwrap("QTS_GetProp","number",["number","number","number"]);this.QTS_GetPropNumber=(0,import_quickjs_ffi_types.assertSync)(this.module.cwrap("QTS_GetPropNumber","number",["number","number","number"]));this.QTS_GetPropNumber_MaybeAsync=this.module.cwrap("QTS_GetPropNumber","number",["number","number","number"]);this.QTS_SetProp=(0,import_quickjs_ffi_types.assertSync)(this.module.cwrap("QTS_SetProp",null,["number","number","number","number"]));this.QTS_SetProp_MaybeAsync=this.module.cwrap("QTS_SetProp",null,["number","number","number","number"]);this.QTS_DefineProp=this.module.cwrap("QTS_DefineProp",null,["number","number","number","number","number","number","boolean","boolean","boolean"]);this.QTS_GetOwnPropertyNames=(0,import_quickjs_ffi_types.assertSync)(this.module.cwrap("QTS_GetOwnPropertyNames","number",["number","number","number","number","number"]));this.QTS_GetOwnPropertyNames_MaybeAsync=this.module.cwrap("QTS_GetOwnPropertyNames","number",["number","number","number","number","number"]);this.QTS_Call=(0,import_quickjs_ffi_types.assertSync)(this.module.cwrap("QTS_Call","number",["number","number","number","number","number"]));this.QTS_Call_MaybeAsync=this.module.cwrap("QTS_Call","number",["number","number","number","number","number"]);this.QTS_ResolveException=this.module.cwrap("QTS_ResolveException","number",["number","number"]);this.QTS_Dump=(0,import_quickjs_ffi_types.assertSync)(this.module.cwrap("QTS_Dump","number",["number","number"]));this.QTS_Dump_MaybeAsync=this.module.cwrap("QTS_Dump","number",["number","number"]);this.QTS_Eval=(0,import_quickjs_ffi_types.assertSync)(this.module.cwrap("QTS_Eval","number",["number","number","number","string","number","number"]));this.QTS_Eval_MaybeAsync=this.module.cwrap("QTS_Eval","number",["number","number","number","string","number","number"]);this.QTS_GetModuleNamespace=this.module.cwrap("QTS_GetModuleNamespace","number",["number","number"]);this.QTS_Typeof=this.module.cwrap("QTS_Typeof","number",["number","number"]);this.QTS_GetLength=this.module.cwrap("QTS_GetLength","number",["number","number","number"]);this.QTS_IsEqual=this.module.cwrap("QTS_IsEqual","number",["number","number","number","number"]);this.QTS_GetGlobalObject=this.module.cwrap("QTS_GetGlobalObject","number",["number"]);this.QTS_NewPromiseCapability=this.module.cwrap("QTS_NewPromiseCapability","number",["number","number"]);this.QTS_PromiseState=this.module.cwrap("QTS_PromiseState","number",["number","number"]);this.QTS_PromiseResult=this.module.cwrap("QTS_PromiseResult","number",["number","number"]);this.QTS_TestStringArg=this.module.cwrap("QTS_TestStringArg",null,["string"]);this.QTS_GetDebugLogEnabled=this.module.cwrap("QTS_GetDebugLogEnabled","number",["number"]);this.QTS_SetDebugLogEnabled=this.module.cwrap("QTS_SetDebugLogEnabled",null,["number","number"]);this.QTS_BuildIsDebug=this.module.cwrap("QTS_BuildIsDebug","number",[]);this.QTS_BuildIsAsyncify=this.module.cwrap("QTS_BuildIsAsyncify","number",[]);this.QTS_NewFunction=this.module.cwrap("QTS_NewFunction","number",["number","number","string"]);this.QTS_ArgvGetJSValueConstPointer=this.module.cwrap("QTS_ArgvGetJSValueConstPointer","number",["number","number"]);this.QTS_RuntimeEnableInterruptHandler=this.module.cwrap("QTS_RuntimeEnableInterruptHandler",null,["number"]);this.QTS_RuntimeDisableInterruptHandler=this.module.cwrap("QTS_RuntimeDisableInterruptHandler",null,["number"]);this.QTS_RuntimeEnableModuleLoader=this.module.cwrap("QTS_RuntimeEnableModuleLoader",null,["number","number"]);this.QTS_RuntimeDisableModuleLoader=this.module.cwrap("QTS_RuntimeDisableModuleLoader",null,["number"]);this.QTS_bjson_encode=this.module.cwrap("QTS_bjson_encode","number",["number","number"]);this.QTS_bjson_decode=this.module.cwrap("QTS_bjson_decode","number",["number","number"]);this.QTS_EvalFunction=(0,import_quickjs_ffi_types.assertSync)(this.module.cwrap("QTS_EvalFunction","number",["number","number"]));this.QTS_EvalFunction_MaybeAsync=this.module.cwrap("QTS_EvalFunction","number",["number","number"]);this.QTS_EncodeBytecode=this.module.cwrap("QTS_EncodeBytecode","number",["number","number"]);this.QTS_DecodeBytecode=this.module.cwrap("QTS_DecodeBytecode","number",["number","number"])}}}});var index_exports={};__export(index_exports,{default:()=>index_default});module.exports=__toCommonJS(index_exports);var variant={type:"async",importFFI:()=>Promise.resolve().then(()=>(init_ffi(),ffi_exports)).then(mod=>mod.QuickJSAsyncFFI),importModuleLoader:()=>import("@componentor/quickjs-wasmfile-release-asyncify/emscripten-module").then(mod=>mod.default)},index_default=variant;
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/ffi.ts","../src/index.ts"],"sourcesContent":["// This file generated by \"generate.ts ffi\" in the root of the repo.\nimport {\n QuickJSAsyncEmscriptenModule,\n JSRuntimePointer,\n JSContextPointer,\n JSContextPointerPointer,\n JSModuleDefPointer,\n JSValuePointer,\n JSValueConstPointer,\n JSValuePointerPointer,\n JSValuePointerPointerPointer,\n JSValueConstPointerPointer,\n QTS_C_To_HostCallbackFuncPointer,\n QTS_C_To_HostInterruptFuncPointer,\n QTS_C_To_HostLoadModuleFuncPointer,\n BorrowedHeapCharPointer,\n OwnedHeapCharPointer,\n JSBorrowedCharPointer,\n JSVoidPointer,\n UInt32Pointer,\n EvalFlags,\n IntrinsicsFlags,\n EvalDetectModule,\n GetOwnPropertyNamesFlags,\n IsEqualOp,\n JSPromiseStateEnum,\n assertSync,\n} from \"@componentor/quickjs-ffi-types\"\n\n/**\n * Low-level FFI bindings to QuickJS's Emscripten module.\n * See instead {@link QuickJSContext}, the public Javascript interface exposed by this\n * library.\n *\n * @unstable The FFI interface is considered private and may change.\n */\nexport class QuickJSAsyncFFI {\n constructor(private module: QuickJSAsyncEmscriptenModule) {}\n /** Set at compile time. */\n readonly DEBUG = false\n\n QTS_Throw: (\n ctx: JSContextPointer,\n error: JSValuePointer | JSValueConstPointer,\n ) => JSValuePointer = this.module.cwrap(\"QTS_Throw\", \"number\", [\"number\", \"number\"])\n\n QTS_NewError: (ctx: JSContextPointer) => JSValuePointer = this.module.cwrap(\n \"QTS_NewError\",\n \"number\",\n [\"number\"],\n )\n\n QTS_RuntimeSetMemoryLimit: (rt: JSRuntimePointer, limit: number) => void = this.module.cwrap(\n \"QTS_RuntimeSetMemoryLimit\",\n null,\n [\"number\", \"number\"],\n )\n\n QTS_RuntimeComputeMemoryUsage: (rt: JSRuntimePointer, ctx: JSContextPointer) => JSValuePointer =\n this.module.cwrap(\"QTS_RuntimeComputeMemoryUsage\", \"number\", [\"number\", \"number\"])\n\n QTS_RuntimeDumpMemoryUsage: (rt: JSRuntimePointer) => OwnedHeapCharPointer = this.module.cwrap(\n \"QTS_RuntimeDumpMemoryUsage\",\n \"number\",\n [\"number\"],\n )\n\n QTS_RecoverableLeakCheck: () => number = this.module.cwrap(\n \"QTS_RecoverableLeakCheck\",\n \"number\",\n [],\n )\n\n QTS_BuildIsSanitizeLeak: () => number = this.module.cwrap(\"QTS_BuildIsSanitizeLeak\", \"number\", [])\n\n QTS_RuntimeSetMaxStackSize: (rt: JSRuntimePointer, stack_size: number) => void =\n this.module.cwrap(\"QTS_RuntimeSetMaxStackSize\", null, [\"number\", \"number\"])\n\n QTS_GetUndefined: () => JSValueConstPointer = this.module.cwrap(\"QTS_GetUndefined\", \"number\", [])\n\n QTS_GetNull: () => JSValueConstPointer = this.module.cwrap(\"QTS_GetNull\", \"number\", [])\n\n QTS_GetFalse: () => JSValueConstPointer = this.module.cwrap(\"QTS_GetFalse\", \"number\", [])\n\n QTS_GetTrue: () => JSValueConstPointer = this.module.cwrap(\"QTS_GetTrue\", \"number\", [])\n\n QTS_NewRuntime: () => JSRuntimePointer = this.module.cwrap(\"QTS_NewRuntime\", \"number\", [])\n\n QTS_FreeRuntime: (rt: JSRuntimePointer) => void = this.module.cwrap(\"QTS_FreeRuntime\", null, [\n \"number\",\n ])\n\n QTS_NewContext: (rt: JSRuntimePointer, intrinsics: IntrinsicsFlags) => JSContextPointer =\n this.module.cwrap(\"QTS_NewContext\", \"number\", [\"number\", \"number\"])\n\n QTS_FreeContext: (ctx: JSContextPointer) => void = this.module.cwrap(\"QTS_FreeContext\", null, [\n \"number\",\n ])\n\n QTS_FreeValuePointer: (ctx: JSContextPointer, value: JSValuePointer) => void = this.module.cwrap(\n \"QTS_FreeValuePointer\",\n null,\n [\"number\", \"number\"],\n )\n\n QTS_FreeValuePointerRuntime: (rt: JSRuntimePointer, value: JSValuePointer) => void =\n this.module.cwrap(\"QTS_FreeValuePointerRuntime\", null, [\"number\", \"number\"])\n\n QTS_FreeVoidPointer: (ctx: JSContextPointer, ptr: JSVoidPointer) => void = this.module.cwrap(\n \"QTS_FreeVoidPointer\",\n null,\n [\"number\", \"number\"],\n )\n\n QTS_FreeCString: (ctx: JSContextPointer, str: JSBorrowedCharPointer) => void = this.module.cwrap(\n \"QTS_FreeCString\",\n null,\n [\"number\", \"number\"],\n )\n\n QTS_DupValuePointer: (\n ctx: JSContextPointer,\n val: JSValuePointer | JSValueConstPointer,\n ) => JSValuePointer = this.module.cwrap(\"QTS_DupValuePointer\", \"number\", [\"number\", \"number\"])\n\n QTS_NewObject: (ctx: JSContextPointer) => JSValuePointer = this.module.cwrap(\n \"QTS_NewObject\",\n \"number\",\n [\"number\"],\n )\n\n QTS_NewObjectProto: (\n ctx: JSContextPointer,\n proto: JSValuePointer | JSValueConstPointer,\n ) => JSValuePointer = this.module.cwrap(\"QTS_NewObjectProto\", \"number\", [\"number\", \"number\"])\n\n QTS_NewArray: (ctx: JSContextPointer) => JSValuePointer = this.module.cwrap(\n \"QTS_NewArray\",\n \"number\",\n [\"number\"],\n )\n\n QTS_NewArrayBuffer: (\n ctx: JSContextPointer,\n buffer: JSVoidPointer,\n length: number,\n ) => JSValuePointer = this.module.cwrap(\"QTS_NewArrayBuffer\", \"number\", [\n \"number\",\n \"number\",\n \"number\",\n ])\n\n QTS_NewFloat64: (ctx: JSContextPointer, num: number) => JSValuePointer = this.module.cwrap(\n \"QTS_NewFloat64\",\n \"number\",\n [\"number\", \"number\"],\n )\n\n QTS_GetFloat64: (ctx: JSContextPointer, value: JSValuePointer | JSValueConstPointer) => number =\n this.module.cwrap(\"QTS_GetFloat64\", \"number\", [\"number\", \"number\"])\n\n QTS_NewString: (ctx: JSContextPointer, string: BorrowedHeapCharPointer) => JSValuePointer =\n this.module.cwrap(\"QTS_NewString\", \"number\", [\"number\", \"number\"])\n\n QTS_GetString: (\n ctx: JSContextPointer,\n value: JSValuePointer | JSValueConstPointer,\n ) => JSBorrowedCharPointer = this.module.cwrap(\"QTS_GetString\", \"number\", [\"number\", \"number\"])\n\n QTS_GetArrayBuffer: (\n ctx: JSContextPointer,\n data: JSValuePointer | JSValueConstPointer,\n ) => JSVoidPointer = this.module.cwrap(\"QTS_GetArrayBuffer\", \"number\", [\"number\", \"number\"])\n\n QTS_GetArrayBufferLength: (\n ctx: JSContextPointer,\n data: JSValuePointer | JSValueConstPointer,\n ) => number = this.module.cwrap(\"QTS_GetArrayBufferLength\", \"number\", [\"number\", \"number\"])\n\n QTS_NewSymbol: (\n ctx: JSContextPointer,\n description: BorrowedHeapCharPointer,\n isGlobal: number,\n ) => JSValuePointer = this.module.cwrap(\"QTS_NewSymbol\", \"number\", [\"number\", \"number\", \"number\"])\n\n QTS_GetSymbolDescriptionOrKey: (\n ctx: JSContextPointer,\n value: JSValuePointer | JSValueConstPointer,\n ) => JSBorrowedCharPointer = assertSync(\n this.module.cwrap(\"QTS_GetSymbolDescriptionOrKey\", \"number\", [\"number\", \"number\"]),\n )\n\n QTS_GetSymbolDescriptionOrKey_MaybeAsync: (\n ctx: JSContextPointer,\n value: JSValuePointer | JSValueConstPointer,\n ) => JSBorrowedCharPointer | Promise<JSBorrowedCharPointer> = this.module.cwrap(\n \"QTS_GetSymbolDescriptionOrKey\",\n \"number\",\n [\"number\", \"number\"],\n )\n\n QTS_IsGlobalSymbol: (\n ctx: JSContextPointer,\n value: JSValuePointer | JSValueConstPointer,\n ) => number = this.module.cwrap(\"QTS_IsGlobalSymbol\", \"number\", [\"number\", \"number\"])\n\n QTS_IsJobPending: (rt: JSRuntimePointer) => number = this.module.cwrap(\n \"QTS_IsJobPending\",\n \"number\",\n [\"number\"],\n )\n\n QTS_ExecutePendingJob: (\n rt: JSRuntimePointer,\n maxJobsToExecute: number,\n lastJobContext: JSContextPointerPointer,\n ) => JSValuePointer = assertSync(\n this.module.cwrap(\"QTS_ExecutePendingJob\", \"number\", [\"number\", \"number\", \"number\"]),\n )\n\n QTS_ExecutePendingJob_MaybeAsync: (\n rt: JSRuntimePointer,\n maxJobsToExecute: number,\n lastJobContext: JSContextPointerPointer,\n ) => JSValuePointer | Promise<JSValuePointer> = this.module.cwrap(\n \"QTS_ExecutePendingJob\",\n \"number\",\n [\"number\", \"number\", \"number\"],\n )\n\n QTS_GetProp: (\n ctx: JSContextPointer,\n this_val: JSValuePointer | JSValueConstPointer,\n prop_name: JSValuePointer | JSValueConstPointer,\n ) => JSValuePointer = assertSync(\n this.module.cwrap(\"QTS_GetProp\", \"number\", [\"number\", \"number\", \"number\"]),\n )\n\n QTS_GetProp_MaybeAsync: (\n ctx: JSContextPointer,\n this_val: JSValuePointer | JSValueConstPointer,\n prop_name: JSValuePointer | JSValueConstPointer,\n ) => JSValuePointer | Promise<JSValuePointer> = this.module.cwrap(\"QTS_GetProp\", \"number\", [\n \"number\",\n \"number\",\n \"number\",\n ])\n\n QTS_GetPropNumber: (\n ctx: JSContextPointer,\n this_val: JSValuePointer | JSValueConstPointer,\n prop_name: number,\n ) => JSValuePointer = assertSync(\n this.module.cwrap(\"QTS_GetPropNumber\", \"number\", [\"number\", \"number\", \"number\"]),\n )\n\n QTS_GetPropNumber_MaybeAsync: (\n ctx: JSContextPointer,\n this_val: JSValuePointer | JSValueConstPointer,\n prop_name: number,\n ) => JSValuePointer | Promise<JSValuePointer> = this.module.cwrap(\"QTS_GetPropNumber\", \"number\", [\n \"number\",\n \"number\",\n \"number\",\n ])\n\n QTS_SetProp: (\n ctx: JSContextPointer,\n this_val: JSValuePointer | JSValueConstPointer,\n prop_name: JSValuePointer | JSValueConstPointer,\n prop_value: JSValuePointer | JSValueConstPointer,\n ) => void = assertSync(\n this.module.cwrap(\"QTS_SetProp\", null, [\"number\", \"number\", \"number\", \"number\"]),\n )\n\n QTS_SetProp_MaybeAsync: (\n ctx: JSContextPointer,\n this_val: JSValuePointer | JSValueConstPointer,\n prop_name: JSValuePointer | JSValueConstPointer,\n prop_value: JSValuePointer | JSValueConstPointer,\n ) => void | Promise<void> = this.module.cwrap(\"QTS_SetProp\", null, [\n \"number\",\n \"number\",\n \"number\",\n \"number\",\n ])\n\n QTS_DefineProp: (\n ctx: JSContextPointer,\n this_val: JSValuePointer | JSValueConstPointer,\n prop_name: JSValuePointer | JSValueConstPointer,\n prop_value: JSValuePointer | JSValueConstPointer,\n get: JSValuePointer | JSValueConstPointer,\n set: JSValuePointer | JSValueConstPointer,\n configurable: boolean,\n enumerable: boolean,\n has_value: boolean,\n ) => void = this.module.cwrap(\"QTS_DefineProp\", null, [\n \"number\",\n \"number\",\n \"number\",\n \"number\",\n \"number\",\n \"number\",\n \"boolean\",\n \"boolean\",\n \"boolean\",\n ])\n\n QTS_GetOwnPropertyNames: (\n ctx: JSContextPointer,\n out_ptrs: JSValuePointerPointerPointer,\n out_len: UInt32Pointer,\n obj: JSValuePointer | JSValueConstPointer,\n flags: number,\n ) => JSValuePointer = assertSync(\n this.module.cwrap(\"QTS_GetOwnPropertyNames\", \"number\", [\n \"number\",\n \"number\",\n \"number\",\n \"number\",\n \"number\",\n ]),\n )\n\n QTS_GetOwnPropertyNames_MaybeAsync: (\n ctx: JSContextPointer,\n out_ptrs: JSValuePointerPointerPointer,\n out_len: UInt32Pointer,\n obj: JSValuePointer | JSValueConstPointer,\n flags: number,\n ) => JSValuePointer | Promise<JSValuePointer> = this.module.cwrap(\n \"QTS_GetOwnPropertyNames\",\n \"number\",\n [\"number\", \"number\", \"number\", \"number\", \"number\"],\n )\n\n QTS_Call: (\n ctx: JSContextPointer,\n func_obj: JSValuePointer | JSValueConstPointer,\n this_obj: JSValuePointer | JSValueConstPointer,\n argc: number,\n argv_ptrs: JSValueConstPointerPointer,\n ) => JSValuePointer = assertSync(\n this.module.cwrap(\"QTS_Call\", \"number\", [\"number\", \"number\", \"number\", \"number\", \"number\"]),\n )\n\n QTS_Call_MaybeAsync: (\n ctx: JSContextPointer,\n func_obj: JSValuePointer | JSValueConstPointer,\n this_obj: JSValuePointer | JSValueConstPointer,\n argc: number,\n argv_ptrs: JSValueConstPointerPointer,\n ) => JSValuePointer | Promise<JSValuePointer> = this.module.cwrap(\"QTS_Call\", \"number\", [\n \"number\",\n \"number\",\n \"number\",\n \"number\",\n \"number\",\n ])\n\n QTS_ResolveException: (ctx: JSContextPointer, maybe_exception: JSValuePointer) => JSValuePointer =\n this.module.cwrap(\"QTS_ResolveException\", \"number\", [\"number\", \"number\"])\n\n QTS_Dump: (\n ctx: JSContextPointer,\n obj: JSValuePointer | JSValueConstPointer,\n ) => JSBorrowedCharPointer = assertSync(\n this.module.cwrap(\"QTS_Dump\", \"number\", [\"number\", \"number\"]),\n )\n\n QTS_Dump_MaybeAsync: (\n ctx: JSContextPointer,\n obj: JSValuePointer | JSValueConstPointer,\n ) => JSBorrowedCharPointer | Promise<JSBorrowedCharPointer> = this.module.cwrap(\n \"QTS_Dump\",\n \"number\",\n [\"number\", \"number\"],\n )\n\n QTS_Eval: (\n ctx: JSContextPointer,\n js_code: BorrowedHeapCharPointer,\n js_code_length: number,\n filename: string,\n detectModule: EvalDetectModule,\n evalFlags: EvalFlags,\n ) => JSValuePointer = assertSync(\n this.module.cwrap(\"QTS_Eval\", \"number\", [\n \"number\",\n \"number\",\n \"number\",\n \"string\",\n \"number\",\n \"number\",\n ]),\n )\n\n QTS_Eval_MaybeAsync: (\n ctx: JSContextPointer,\n js_code: BorrowedHeapCharPointer,\n js_code_length: number,\n filename: string,\n detectModule: EvalDetectModule,\n evalFlags: EvalFlags,\n ) => JSValuePointer | Promise<JSValuePointer> = this.module.cwrap(\"QTS_Eval\", \"number\", [\n \"number\",\n \"number\",\n \"number\",\n \"string\",\n \"number\",\n \"number\",\n ])\n\n QTS_GetModuleNamespace: (\n ctx: JSContextPointer,\n module_func_obj: JSValuePointer | JSValueConstPointer,\n ) => JSValuePointer = this.module.cwrap(\"QTS_GetModuleNamespace\", \"number\", [\"number\", \"number\"])\n\n QTS_Typeof: (\n ctx: JSContextPointer,\n value: JSValuePointer | JSValueConstPointer,\n ) => OwnedHeapCharPointer = this.module.cwrap(\"QTS_Typeof\", \"number\", [\"number\", \"number\"])\n\n QTS_GetLength: (\n ctx: JSContextPointer,\n out_len: UInt32Pointer,\n value: JSValuePointer | JSValueConstPointer,\n ) => number = this.module.cwrap(\"QTS_GetLength\", \"number\", [\"number\", \"number\", \"number\"])\n\n QTS_IsEqual: (\n ctx: JSContextPointer,\n a: JSValuePointer | JSValueConstPointer,\n b: JSValuePointer | JSValueConstPointer,\n op: IsEqualOp,\n ) => number = this.module.cwrap(\"QTS_IsEqual\", \"number\", [\"number\", \"number\", \"number\", \"number\"])\n\n QTS_GetGlobalObject: (ctx: JSContextPointer) => JSValuePointer = this.module.cwrap(\n \"QTS_GetGlobalObject\",\n \"number\",\n [\"number\"],\n )\n\n QTS_NewPromiseCapability: (\n ctx: JSContextPointer,\n resolve_funcs_out: JSValuePointerPointer,\n ) => JSValuePointer = this.module.cwrap(\"QTS_NewPromiseCapability\", \"number\", [\n \"number\",\n \"number\",\n ])\n\n QTS_PromiseState: (\n ctx: JSContextPointer,\n promise: JSValuePointer | JSValueConstPointer,\n ) => JSPromiseStateEnum = this.module.cwrap(\"QTS_PromiseState\", \"number\", [\"number\", \"number\"])\n\n QTS_PromiseResult: (\n ctx: JSContextPointer,\n promise: JSValuePointer | JSValueConstPointer,\n ) => JSValuePointer = this.module.cwrap(\"QTS_PromiseResult\", \"number\", [\"number\", \"number\"])\n\n QTS_TestStringArg: (string: string) => void = this.module.cwrap(\"QTS_TestStringArg\", null, [\n \"string\",\n ])\n\n QTS_GetDebugLogEnabled: (rt: JSRuntimePointer) => number = this.module.cwrap(\n \"QTS_GetDebugLogEnabled\",\n \"number\",\n [\"number\"],\n )\n\n QTS_SetDebugLogEnabled: (rt: JSRuntimePointer, is_enabled: number) => void = this.module.cwrap(\n \"QTS_SetDebugLogEnabled\",\n null,\n [\"number\", \"number\"],\n )\n\n QTS_BuildIsDebug: () => number = this.module.cwrap(\"QTS_BuildIsDebug\", \"number\", [])\n\n QTS_BuildIsAsyncify: () => number = this.module.cwrap(\"QTS_BuildIsAsyncify\", \"number\", [])\n\n QTS_NewFunction: (ctx: JSContextPointer, func_id: number, name: string) => JSValuePointer =\n this.module.cwrap(\"QTS_NewFunction\", \"number\", [\"number\", \"number\", \"string\"])\n\n QTS_ArgvGetJSValueConstPointer: (\n argv: JSValuePointer | JSValueConstPointer,\n index: number,\n ) => JSValueConstPointer = this.module.cwrap(\"QTS_ArgvGetJSValueConstPointer\", \"number\", [\n \"number\",\n \"number\",\n ])\n\n QTS_RuntimeEnableInterruptHandler: (rt: JSRuntimePointer) => void = this.module.cwrap(\n \"QTS_RuntimeEnableInterruptHandler\",\n null,\n [\"number\"],\n )\n\n QTS_RuntimeDisableInterruptHandler: (rt: JSRuntimePointer) => void = this.module.cwrap(\n \"QTS_RuntimeDisableInterruptHandler\",\n null,\n [\"number\"],\n )\n\n QTS_RuntimeEnableModuleLoader: (rt: JSRuntimePointer, use_custom_normalize: number) => void =\n this.module.cwrap(\"QTS_RuntimeEnableModuleLoader\", null, [\"number\", \"number\"])\n\n QTS_RuntimeDisableModuleLoader: (rt: JSRuntimePointer) => void = this.module.cwrap(\n \"QTS_RuntimeDisableModuleLoader\",\n null,\n [\"number\"],\n )\n\n QTS_bjson_encode: (\n ctx: JSContextPointer,\n val: JSValuePointer | JSValueConstPointer,\n ) => JSValuePointer = this.module.cwrap(\"QTS_bjson_encode\", \"number\", [\"number\", \"number\"])\n\n QTS_bjson_decode: (\n ctx: JSContextPointer,\n data: JSValuePointer | JSValueConstPointer,\n ) => JSValuePointer = this.module.cwrap(\"QTS_bjson_decode\", \"number\", [\"number\", \"number\"])\n\n QTS_EvalFunction: (\n ctx: JSContextPointer,\n fun_obj: JSValuePointer | JSValueConstPointer,\n ) => JSValuePointer = assertSync(\n this.module.cwrap(\"QTS_EvalFunction\", \"number\", [\"number\", \"number\"]),\n )\n\n QTS_EvalFunction_MaybeAsync: (\n ctx: JSContextPointer,\n fun_obj: JSValuePointer | JSValueConstPointer,\n ) => JSValuePointer | Promise<JSValuePointer> = this.module.cwrap(\"QTS_EvalFunction\", \"number\", [\n \"number\",\n \"number\",\n ])\n\n QTS_EncodeBytecode: (\n ctx: JSContextPointer,\n val: JSValuePointer | JSValueConstPointer,\n ) => JSValuePointer = this.module.cwrap(\"QTS_EncodeBytecode\", \"number\", [\"number\", \"number\"])\n\n QTS_DecodeBytecode: (\n ctx: JSContextPointer,\n data: JSValuePointer | JSValueConstPointer,\n ) => JSValuePointer = this.module.cwrap(\"QTS_DecodeBytecode\", \"number\", [\"number\", \"number\"])\n}\n","import type { QuickJSAsyncVariant } from \"@componentor/quickjs-ffi-types\"\n\n/**\n * ### @componentor/quickjs-wasmfile-release-asyncify\n *\n * [Docs](https://github.com/componentor/quickjs-emscripten/blob/main/doc/@componentor/quickjs-wasmfile-release-asyncify/README.md) |\n * Variant with separate .WASM file. Supports browser ESM, NodeJS ESM, and NodeJS CommonJS.\n *\n * | Variable | Setting | Description |\n * | -- | -- | -- |\n * | library | quickjs | The original [bellard/quickjs](https://github.com/bellard/quickjs) library. Version [2024-02-14+36911f0d](https://github.com/bellard/quickjs/commit/36911f0d3ab1a4c190a4d5cbe7c2db225a455389) vendored to quickjs-emscripten on 2024-06-15. |\n * | releaseMode | release | Optimized for performance; use when building/deploying your application. |\n * | syncMode | asyncify | 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. |\n * | emscriptenInclusion | wasm | Has a separate .wasm file. May offer better caching in your browser, and reduces the size of your JS bundle. If you have issues, try a 'singlefile' variant. |\n * | exports | require import browser workerd | Has these package.json export conditions |\n *\n */\nconst variant: QuickJSAsyncVariant = {\n type: \"async\",\n importFFI: () => import(\"./ffi.js\").then((mod) => mod.QuickJSAsyncFFI),\n importModuleLoader: () =>\n import(\"@componentor/quickjs-wasmfile-release-asyncify/emscripten-module\").then(\n (mod) => mod.default,\n ),\n} as const\n\nexport default variant\n"],"mappings":"q/BAAA,mFACA,yBAmCa,gBApCb,4CACA,yBA0BO,0CASM,gBAAN,KAAsB,CAC3B,YAAoBA,QAAsC,CAAtC,YAAAA,QAEpB,KAAS,MAAQ,GAEjB,eAGsB,KAAK,OAAO,MAAM,YAAa,SAAU,CAAC,SAAU,QAAQ,CAAC,EAEnF,kBAA0D,KAAK,OAAO,MACpE,eACA,SACA,CAAC,QAAQ,CACX,EAEA,+BAA2E,KAAK,OAAO,MACrF,4BACA,KACA,CAAC,SAAU,QAAQ,CACrB,EAEA,mCACE,KAAK,OAAO,MAAM,gCAAiC,SAAU,CAAC,SAAU,QAAQ,CAAC,EAEnF,gCAA6E,KAAK,OAAO,MACvF,6BACA,SACA,CAAC,QAAQ,CACX,EAEA,8BAAyC,KAAK,OAAO,MACnD,2BACA,SACA,CAAC,CACH,EAEA,6BAAwC,KAAK,OAAO,MAAM,0BAA2B,SAAU,CAAC,CAAC,EAEjG,gCACE,KAAK,OAAO,MAAM,6BAA8B,KAAM,CAAC,SAAU,QAAQ,CAAC,EAE5E,sBAA8C,KAAK,OAAO,MAAM,mBAAoB,SAAU,CAAC,CAAC,EAEhG,iBAAyC,KAAK,OAAO,MAAM,cAAe,SAAU,CAAC,CAAC,EAEtF,kBAA0C,KAAK,OAAO,MAAM,eAAgB,SAAU,CAAC,CAAC,EAExF,iBAAyC,KAAK,OAAO,MAAM,cAAe,SAAU,CAAC,CAAC,EAEtF,oBAAyC,KAAK,OAAO,MAAM,iBAAkB,SAAU,CAAC,CAAC,EAEzF,qBAAkD,KAAK,OAAO,MAAM,kBAAmB,KAAM,CAC3F,QACF,CAAC,EAED,oBACE,KAAK,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B,IAClB,OAAO,kEAAkE,EAAE,KACxE,KAAQ,IAAI,OACf,CACJ,EAEO,cAAQ","names":["module"]}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var variant={type:"async",importFFI:()=>import("./ffi.mjs").then(mod=>mod.QuickJSAsyncFFI),importModuleLoader:()=>import("@componentor/quickjs-wasmfile-release-asyncify/emscripten-module").then(mod=>mod.default)},index_default=variant;export{index_default as default};
|
|
2
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { QuickJSAsyncVariant } from \"@componentor/quickjs-ffi-types\"\n\n/**\n * ### @componentor/quickjs-wasmfile-release-asyncify\n *\n * [Docs](https://github.com/componentor/quickjs-emscripten/blob/main/doc/@componentor/quickjs-wasmfile-release-asyncify/README.md) |\n * Variant with separate .WASM file. Supports browser ESM, NodeJS ESM, and NodeJS CommonJS.\n *\n * | Variable | Setting | Description |\n * | -- | -- | -- |\n * | library | quickjs | The original [bellard/quickjs](https://github.com/bellard/quickjs) library. Version [2024-02-14+36911f0d](https://github.com/bellard/quickjs/commit/36911f0d3ab1a4c190a4d5cbe7c2db225a455389) vendored to quickjs-emscripten on 2024-06-15. |\n * | releaseMode | release | Optimized for performance; use when building/deploying your application. |\n * | syncMode | asyncify | 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. |\n * | emscriptenInclusion | wasm | Has a separate .wasm file. May offer better caching in your browser, and reduces the size of your JS bundle. If you have issues, try a 'singlefile' variant. |\n * | exports | require import browser workerd | Has these package.json export conditions |\n *\n */\nconst variant: QuickJSAsyncVariant = {\n type: \"async\",\n importFFI: () => import(\"./ffi.js\").then((mod) => mod.QuickJSAsyncFFI),\n importModuleLoader: () =>\n import(\"@componentor/quickjs-wasmfile-release-asyncify/emscripten-module\").then(\n (mod) => mod.default,\n ),\n} as const\n\nexport default variant\n"],"mappings":"AAiBA,IAAM,QAA+B,CACnC,KAAM,QACN,UAAW,IAAM,OAAO,WAAU,EAAE,KAAM,KAAQ,IAAI,eAAe,EACrE,mBAAoB,IAClB,OAAO,kEAAkE,EAAE,KACxE,KAAQ,IAAI,OACf,CACJ,EAEO,cAAQ","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@componentor/quickjs-wasmfile-release-asyncify",
|
|
3
|
+
"license": "MIT",
|
|
4
|
+
"version": "0.31.0",
|
|
5
|
+
"description": "Variant of quickjs library: Variant with separate .WASM file. Supports browser ESM, NodeJS ESM, and NodeJS CommonJS.",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/componentor/quickjs-emscripten"
|
|
10
|
+
},
|
|
11
|
+
"author": {
|
|
12
|
+
"name": "Componentor"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"LICENSE",
|
|
16
|
+
"README.md",
|
|
17
|
+
"dist/**/*",
|
|
18
|
+
"!dist/*.tsbuildinfo"
|
|
19
|
+
],
|
|
20
|
+
"types": "./dist/index.d.ts",
|
|
21
|
+
"main": "./dist/index.js",
|
|
22
|
+
"module": "./dist/index.mjs",
|
|
23
|
+
"browser": "./dist/index.mjs",
|
|
24
|
+
"exports": {
|
|
25
|
+
".": {
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
27
|
+
"import": "./dist/index.mjs",
|
|
28
|
+
"require": "./dist/index.js",
|
|
29
|
+
"default": "./dist/index.js"
|
|
30
|
+
},
|
|
31
|
+
"./package.json": "./package.json",
|
|
32
|
+
"./ffi": {
|
|
33
|
+
"types": "./dist/ffi.d.ts",
|
|
34
|
+
"import": "./dist/ffi.mjs",
|
|
35
|
+
"require": "./dist/ffi.js",
|
|
36
|
+
"default": "./dist/ffi.js"
|
|
37
|
+
},
|
|
38
|
+
"./wasm": "./dist/emscripten-module.wasm",
|
|
39
|
+
"./emscripten-module": {
|
|
40
|
+
"types": "./dist/emscripten-module.browser.d.ts",
|
|
41
|
+
"iife": "./dist/emscripten-module.cjs",
|
|
42
|
+
"workerd": "./dist/emscripten-module.cloudflare.cjs",
|
|
43
|
+
"browser": "./dist/emscripten-module.browser.mjs",
|
|
44
|
+
"import": "./dist/emscripten-module.mjs",
|
|
45
|
+
"require": "./dist/emscripten-module.cjs",
|
|
46
|
+
"default": "./dist/emscripten-module.cjs"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"@componentor/quickjs-ffi-types": "0.31.0"
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@jitl/tsconfig": "0.31.0"
|
|
54
|
+
},
|
|
55
|
+
"scripts": {
|
|
56
|
+
"build": "pnpm run build:c && pnpm run build:ts",
|
|
57
|
+
"build:c": "make",
|
|
58
|
+
"build:ts": "npx tsup",
|
|
59
|
+
"check:types": "npx tsc --project . --noEmit",
|
|
60
|
+
"clean": "make clean"
|
|
61
|
+
}
|
|
62
|
+
}
|