@componentor/quickjs-wasmfs-release-sync 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 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,75 @@
1
+ # @componentor/quickjs-wasmfs-release-sync
2
+
3
+ QuickJS variant with WasmFS and OPFS support for native filesystem access in browsers without JS boundary crossing.
4
+
5
+ ## Features
6
+
7
+ - **WasmFS**: Filesystem operations run entirely inside Wasm, eliminating JS↔Wasm boundary overhead
8
+ - **OPFS Backend**: Persistent storage via Origin Private File System
9
+ - **File Watching**: Polling-based directory watcher for HMR support
10
+ - **Browser-Only**: Optimized for browser environments (OPFS is a browser API)
11
+
12
+ ## Variant Settings
13
+
14
+ | Variable | Setting | Description |
15
+ | ------------------- | ------- | ------------------------------------------------------------------ |
16
+ | library | quickjs | The original [bellard/quickjs](https://github.com/bellard/quickjs) |
17
+ | releaseMode | release | Optimized for performance |
18
+ | syncMode | sync | Synchronous execution mode |
19
+ | emscriptenInclusion | wasm | Separate .wasm file with WasmFS + OPFS support |
20
+ | exports | browser | Browser-only (OPFS is a browser API) |
21
+
22
+ ## Usage
23
+
24
+ ```typescript
25
+ import variant from "@componentor/quickjs-wasmfs-release-sync"
26
+ import { newQuickJSWASMModuleFromVariant } from "quickjs-emscripten"
27
+
28
+ const QuickJS = await newQuickJSWASMModuleFromVariant(variant)
29
+
30
+ // Mount OPFS at /opfs
31
+ await QuickJS.getWasmModule().mountOPFS("/opfs")
32
+
33
+ // Now filesystem operations inside QuickJS can access /opfs/*
34
+ // without crossing the JS↔Wasm boundary
35
+ ```
36
+
37
+ ## File Watching (for HMR)
38
+
39
+ ```typescript
40
+ const wasm = QuickJS.getWasmModule()
41
+
42
+ // Watch a directory for changes (polling-based)
43
+ const stopWatching = wasm.watchDirectory(
44
+ "/opfs/src",
45
+ (changes) => {
46
+ for (const { path, type } of changes) {
47
+ console.log(`${type}: ${path}`)
48
+ }
49
+ },
50
+ 100,
51
+ ) // poll every 100ms
52
+
53
+ // Stop watching when done
54
+ stopWatching()
55
+ ```
56
+
57
+ ## Performance Benefits
58
+
59
+ Traditional architecture (with @componentor/fs):
60
+
61
+ ```
62
+ QuickJS (Wasm) ↔ JS Bridge ↔ @componentor/fs ↔ OPFS
63
+ ```
64
+
65
+ WasmFS architecture:
66
+
67
+ ```
68
+ QuickJS (Wasm) → WasmFS (same Wasm instance) → OPFS
69
+ ```
70
+
71
+ The WasmFS approach eliminates the expensive JS↔Wasm boundary crossing for every filesystem operation, resulting in significantly faster I/O performance for file-heavy workloads.
72
+
73
+ ## License
74
+
75
+ MIT
@@ -0,0 +1,11 @@
1
+ // Generated from ../../templates/emscripten-module.SYNC.d.ts - WasmFS variant with OPFS support
2
+ import type { EmscriptenModuleLoader, QuickJSEmscriptenModule } from "@jitl/quickjs-ffi-types"
3
+ /**
4
+ * Emscripten module built from the unmodified [`quickjs/quickjs.h`](../quickjs/quickjs.h)
5
+ * and our FFI support functions [c/interface.c](../c/interface.c).
6
+ *
7
+ * Note that emscripten modules returned by a `MODULARIZE=1` emscripten build
8
+ * (like this one) load asynchronously.
9
+ */
10
+ declare const ModuleLoader: EmscriptenModuleLoader<QuickJSEmscriptenModule>
11
+ export default ModuleLoader
@@ -0,0 +1,84 @@
1
+
2
+ var QuickJSRaw = (() => {
3
+ var _scriptName = import.meta.url;
4
+
5
+ return (
6
+ function(moduleArg = {}) {
7
+ var moduleRtn;
8
+
9
+ var aa="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){if(a==Array.prototype||a==Object.prototype)return a;a[b]=c.value;return a};function ba(a){a=["object"==typeof globalThis&&globalThis,a,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global];for(var b=0;b<a.length;++b){var c=a[b];if(c&&c.Math==Math)return c}throw Error("Cannot find global object");}var ca=ba(this);
10
+ function d(a,b){if(b)a:{var c=ca;a=a.split(".");for(var e=0;e<a.length-1;e++){var f=a[e];if(!(f in c))break a;c=c[f]}a=a[a.length-1];e=c[a];b=b(e);b!=e&&null!=b&&aa(c,a,{configurable:!0,writable:!0,value:b})}}function da(a){a=Math.trunc(a)||0;0>a&&(a+=this.length);if(!(0>a||a>=this.length))return this[a]}d("Array.prototype.at",function(a){return a?a:da});function g(a){return a?a:da}d("Int8Array.prototype.at",g);d("Uint8Array.prototype.at",g);d("Uint8ClampedArray.prototype.at",g);
11
+ d("Int16Array.prototype.at",g);d("Uint16Array.prototype.at",g);d("Int32Array.prototype.at",g);d("Uint32Array.prototype.at",g);d("Float32Array.prototype.at",g);d("Float64Array.prototype.at",g);d("String.prototype.at",function(a){return a?a:da});var l=moduleArg,ea,fa,ha=new Promise((a,b)=>{ea=a;fa=b}),ia="object"==typeof window,ja="function"==typeof importScripts;function ka(a){a={log:a||function(){}};for(const b of ka.uc)b(a);return l.quickJSEmscriptenExtensions=a}ka.uc=[];
12
+ l.quickjsEmscriptenInit=ka;ka.uc.push(a=>{a.getWasmMemory=function(){return n}});
13
+ l.mountOPFS=async function(a="/opfs"){if(!navigator.storage||!navigator.storage.getDirectory)throw Error("OPFS is not supported in this browser");const b=await navigator.storage.getDirectory();try{l.FS.xc(a)}catch(c){"EEXIST"!==c.code&&console.warn("[WasmFS] Mount point creation warning:",c)}if("function"===typeof l.wasmfsOPFSGetOrCreateDir)await l.wasmfsOPFSGetOrCreateDir(b,a);else if(l.FS&&l.FS.tc&&l.FS.tc.Ac)l.FS.Hc(l.FS.tc.Ac,{root:b},a);else throw Error("WasmFS OPFS backend not available. Ensure -lopfs.js is in build flags.");
14
+ console.log("[WasmFS] OPFS mounted at",a);return a};
15
+ l.watchFiles=function(a,b,c=100){const e=new Map;for(const h of a)try{const k=l.FS.stat(h);e.set(h,k.kc.getTime())}catch(k){e.set(h,0)}const f=setInterval(()=>{for(const h of a)try{const k=l.FS.stat(h).kc.getTime(),m=e.get(h);k!==m&&(e.set(h,k),0!==m&&b(h,"change"))}catch(k){0!==e.get(h)&&(e.set(h,0),b(h,"delete"))}},c);return{close:function(){clearInterval(f)},addPath:function(h){if(!a.includes(h)){a.push(h);try{const k=l.FS.stat(h);e.set(h,k.kc.getTime())}catch(k){e.set(h,0)}}},wd:function(h){const k=
16
+ a.indexOf(h);-1!==k&&(a.splice(k,1),e.delete(h))}}};
17
+ l.watchDirectory=function(a,b,c=100){function e(m){const u=[];try{var p=l.FS.Kc(m);for(const x of p)if("."!==x&&".."!==x){p=m+"/"+x;try{const I=l.FS.stat(p);I.isDirectory()?u.push(...e(p)):u.push({path:p,kc:I.kc.getTime()})}catch(I){}}}catch(x){}return u}const f=new Map,h=e(a);for(const m of h)f.set(m.path,m.kc);const k=setInterval(()=>{var m=e(a);const u=new Set;for(const p of m)u.add(p.path),m=f.get(p.path),void 0===m?(f.set(p.path,p.kc),b(p.path,"add")):p.kc!==m&&(f.set(p.path,p.kc),b(p.path,"change"));
18
+ for(const [p]of f)u.has(p)||(f.delete(p),b(p,"delete"))},c);return{close:function(){clearInterval(k)}}};l.readFileString=function(a){a=la(a);return(new TextDecoder).decode(a)};l.writeFileString=function(a,b){b=(new TextEncoder).encode(b);l.FS.Pc(a,b)};l.syncOPFS=async function(){if(l.FS&&l.FS.Mc)return new Promise((a,b)=>{l.FS.Mc(!1,c=>{c?b(c):a()})})};var ma=Object.assign({},l),na="./this.program",q="",oa,pa;
19
+ if(ia||ja)ja?q=self.location.href:"undefined"!=typeof document&&document.currentScript&&(q=document.currentScript.src),_scriptName&&(q=_scriptName),q.startsWith("blob:")?q="":q=q.substr(0,q.replace(/[?#].*/,"").lastIndexOf("/")+1),ja&&(pa=a=>{var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";b.send(null);return new Uint8Array(b.response)}),oa=a=>fetch(a,{credentials:"same-origin"}).then(b=>b.ok?b.arrayBuffer():Promise.reject(Error(b.status+" : "+b.url)));
20
+ var qa=l.print||console.log.bind(console),r=l.printErr||console.error.bind(console);Object.assign(l,ma);ma=null;l.thisProgram&&(na=l.thisProgram);var ra=l.wasmBinary,n,sa=!1,ta,t,v,w,y;function ua(){var a=n.buffer;l.HEAP8=t=new Int8Array(a);l.HEAP16=new Int16Array(a);l.HEAPU8=v=new Uint8Array(a);l.HEAPU16=new Uint16Array(a);l.HEAP32=w=new Int32Array(a);l.HEAPU32=y=new Uint32Array(a);l.HEAPF32=new Float32Array(a);l.HEAPF64=new Float64Array(a)}
21
+ l.wasmMemory?n=l.wasmMemory:n=new WebAssembly.Memory({initial:(l.INITIAL_MEMORY||16777216)/65536,maximum:32768});ua();var va=[],wa=[],xa=[];function ya(){var a=l.preRun.shift();va.unshift(a)}var z=0,za=null,A=null;function Aa(){z++;l.monitorRunDependencies?.(z)}function B(){z--;l.monitorRunDependencies?.(z);if(0==z&&(null!==za&&(clearInterval(za),za=null),A)){var a=A;A=null;a()}}
22
+ function C(a){l.onAbort?.(a);a="Aborted("+a+")";r(a);sa=!0;ta=1;a=new WebAssembly.RuntimeError(a+". Build with -sASSERTIONS for more info.");fa(a);throw a;}var Ba=a=>a.startsWith("data:application/octet-stream;base64,"),Ca;function Ea(a){if(a==Ca&&ra)return new Uint8Array(ra);if(pa)return pa(a);throw"both async and sync fetching of the wasm failed";}function Fa(a){return ra?Promise.resolve().then(()=>Ea(a)):oa(a).then(b=>new Uint8Array(b),()=>Ea(a))}
23
+ function Ga(a,b,c){return Fa(a).then(e=>WebAssembly.instantiate(e,b)).then(c,e=>{r(`failed to asynchronously prepare wasm: ${e}`);C(e)})}function Ha(a,b){var c=Ca;return ra||"function"!=typeof WebAssembly.instantiateStreaming||Ba(c)||"function"!=typeof fetch?Ga(c,a,b):fetch(c,{credentials:"same-origin"}).then(e=>WebAssembly.instantiateStreaming(e,a).then(b,function(f){r(`wasm streaming compile failed: ${f}`);r("falling back to ArrayBuffer instantiation");return Ga(c,a,b)}))}var D,E;
24
+ function Ia(a){this.name="ExitStatus";this.message=`Program terminated with exit(${a})`;this.status=a}
25
+ var Ja=a=>{for(;0<a.length;)a.shift()(l)},Ka=l.noExitRuntime||!0,La="undefined"!=typeof TextDecoder?new TextDecoder:void 0,F=(a,b)=>{for(var c=b+NaN,e=b;a[e]&&!(e>=c);)++e;if(16<e-b&&a.buffer&&La)return La.decode(a.subarray(b,e));for(c="";b<e;){var f=a[b++];if(f&128){var h=a[b++]&63;if(192==(f&224))c+=String.fromCharCode((f&31)<<6|h);else{var k=a[b++]&63;f=224==(f&240)?(f&15)<<12|h<<6|k:(f&7)<<18|h<<12|k<<6|a[b++]&63;65536>f?c+=String.fromCharCode(f):(f-=65536,c+=String.fromCharCode(55296|f>>10,56320|
26
+ f&1023))}}else c+=String.fromCharCode(f)}return c},Ma=[0,31,60,91,121,152,182,213,244,274,305,335],Na=[0,31,59,90,120,151,181,212,243,273,304,334],G=(a,b)=>b+2097152>>>0<4194305-!!a?(a>>>0)+4294967296*b:NaN,H={},Oa=a=>{if(!(a instanceof Ia||"unwind"==a))throw a;},Pa=0,Qa=a=>{ta=a;Ka||0<Pa||(l.onExit?.(a),sa=!0);throw new Ia(a);},Ra=a=>{if(!sa)try{if(a(),!(Ka||0<Pa))try{ta=a=ta,Qa(a)}catch(b){Oa(b)}}catch(b){Oa(b)}},Sa;Sa=()=>performance.now();
27
+ var J=(a,b,c,e)=>{if(!(0<e))return 0;var f=c;e=c+e-1;for(var h=0;h<a.length;++h){var k=a.charCodeAt(h);if(55296<=k&&57343>=k){var m=a.charCodeAt(++h);k=65536+((k&1023)<<10)|m&1023}if(127>=k){if(c>=e)break;b[c++]=k}else{if(2047>=k){if(c+1>=e)break;b[c++]=192|k>>6}else{if(65535>=k){if(c+2>=e)break;b[c++]=224|k>>12}else{if(c+3>=e)break;b[c++]=240|k>>18;b[c++]=128|k>>12&63}b[c++]=128|k>>6&63}b[c++]=128|k&63}}b[c]=0;return c-f},Ta=[],K=[],Ua=!1,L=a=>{for(var b=0,c=0;c<a.length;++c){var e=a.charCodeAt(c);
28
+ 127>=e?b++:2047>=e?b+=2:55296<=e&&57343>=e?(b+=4,++c):b+=3}return b};function Va(a,b){a.lc[b]=void 0;a.zc.push(b)}class Wa{constructor(){this.lc=[void 0];this.zc=[]}get(a){return this.lc[a]}has(a){return void 0!==this.lc[a]}nc(a){var b=this.zc.pop()||this.lc.length;this.lc[b]=a;return b}}var M=new Wa,Xa=new Wa,N=new Wa,O=new Wa;
29
+ async function Ya(a,b,c){a=N.get(a);let e;try{e=await a.getFileHandle(b,{create:c})}catch(f){return"NotFoundError"===f.name?-20:"TypeMismatchError"===f.name?-31:-29}return O.nc(e)}async function Za(a,b,c){a=N.get(a);let e;try{e=await a.getDirectoryHandle(b,{create:c})}catch(f){return"NotFoundError"===f.name?-20:"TypeMismatchError"===f.name?-54:-29}return N.nc(e)}
30
+ class $a{constructor(a){this.handle=a}async close(){}async flush(){}async getSize(){return(await this.handle.getFile()).size}async read(a,b={at:0}){b=await (await (await this.handle.getFile()).slice(b.at,b.at+a.length)).arrayBuffer();b=new Uint8Array(b);a.set(b);return b.length}async write(a,b={at:0}){let c=await this.handle.createWritable({keepExistingData:!0});await c.write({type:"write",position:b.at,data:a});await c.close();return a.length}async truncate(a){let b=await this.handle.createWritable({keepExistingData:!0});
31
+ await b.truncate(a);await b.close()}}
32
+ var ab=[],bb={},fb=()=>{if(!cb){var a={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:na||"./this.program"},b;for(b in bb)void 0===bb[b]?delete a[b]:a[b]=bb[b];var c=[];for(b in a)c.push(`${b}=${a[b]}`);cb=c}return cb},cb,gb=()=>{if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues)return a=>crypto.getRandomValues(a);C("initRandomDevice")},hb=
33
+ a=>(hb=gb())(a),P={vc:a=>"/"===a.charAt(0),Lc:a=>/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(a).slice(1),yc:(a,b)=>{for(var c=0,e=a.length-1;0<=e;e--){var f=a[e];"."===f?a.splice(e,1):".."===f?(a.splice(e,1),c++):c&&(a.splice(e,1),c--)}if(b)for(;c;c--)a.unshift("..");return a},normalize:a=>{var b=P.vc(a),c="/"===a.substr(-1);(a=P.yc(a.split("/").filter(e=>!!e),!b).join("/"))||b||(a=".");a&&c&&(a+="/");return(b?"/":"")+a},dirname:a=>{var b=P.Lc(a);a=b[0];b=b[1];if(!a&&!b)return".";
34
+ b&&=b.substr(0,b.length-1);return a+b},Sc:a=>{if("/"===a)return"/";a=P.normalize(a);a=a.replace(/\/$/,"");var b=a.lastIndexOf("/");return-1===b?a:a.substr(b+1)},join:(...a)=>P.normalize(a.join("/")),rc:(a,b)=>P.normalize(a+"/"+b)},Q=a=>{var b=L(a)+1,c=ib(b);J(a,v,c,b);return c},T=a=>{var b=R();a=a();S(b);return a},U=a=>y[a>>2]+4294967296*w[a+4>>2],kb=(a,b,c)=>V.handleError(T(()=>{var e=Q(a);return jb(e,b,c)})),lb=(a,b=438)=>kb(a,b&4095|32768,0),nb=(a,b)=>{var c=R();a=Q(a);if("string"==typeof b){var e=
35
+ new Uint8Array(L(b)+1);b=J(b,e,0,e.length);b=e.slice(0,b)}e=W(b.length);for(var f=0;f<b.length;f++)t[e+f]=b[f];b=mb(a,e,b.length);X(e);S(c);return b},pb=(a,b,c,e,f)=>{a=b?a+"/"+b:a;e=ob(e,f);Ua?(lb(a,e),nb(a,c)):K.push({Jc:a,sc:c,mode:e})},qb=(a,b,c)=>{var e=`al ${a}`;oa(a).then(f=>{b(new Uint8Array(f));e&&B(e)},()=>{if(c)c();else throw`Loading data file "${a}" failed.`;});e&&Aa(e)},rb=(...a)=>{for(var b="",c=!1,e=a.length-1;-1<=e&&!c;e--){c=0<=e?a[e]:V.Ec();if("string"!=typeof c)throw new TypeError("Arguments to path.resolve must be strings");
36
+ if(!c)return"";b=c+"/"+b;c=P.vc(c)}b=P.yc(b.split("/").filter(f=>!!f),!c).join("/");return(c?"/":"")+b||"."},sb=l.preloadPlugins||[],ub=(a,b,c,e)=>{"undefined"!=typeof Browser&&tb();var f=!1;sb.forEach(h=>{!f&&h.canHandle(b)&&(h.handle(a,b,c,e),f=!0)});return f},vb=(a,b,c,e,f,h,k,m,u,p)=>{function x(db){function eb(oc){p?.();m||pb(a,b,oc,e,f,u);h?.();B(Da)}ub(db,I,eb,()=>{k?.();B(Da)})||eb(db)}var I=b?rb(P.rc(a,b)):a,Da=`cp ${I}`;Aa(Da);"string"==typeof c?qb(c,x,k):x(c)},ob=(a,b)=>{var c=0;a&&(c|=
37
+ 365);b&&(c|=146);return c},xb=(a,b=511)=>V.handleError(T(()=>{var c=Q(a);return wb(c,b)})),zb=a=>T(()=>{var b=Q(a);return yb(b)}),Y={},Ab={},Bb={};function la(a){var b=b||"binary";if("utf8"!==b&&"binary"!==b)throw Error('Invalid encoding type "'+b+'"');var c=R();a=Cb(Q(a));S(c);c=new Uint8Array(v.subarray(a+8,a+8+U(a)));"utf8"===b&&(c=F(c,0));return c}
38
+ function tb(){V.ub||(V.ub=function(a){this.qc=a;this.message="FS error";this.name="ErrnoError"},V.ub.prototype=Error(),V.ub.prototype.constructor=V.ub)}function Db(a){var b=T(()=>Eb(Q(a)));return 44==b?null:{jd:31==b,hd:!1}}function Fb(a){var b=a+88;return{bd:y[a>>2],mode:y[a+4>>2],sd:y[a+8>>2],uid:y[a+12>>2],fd:y[a+16>>2],ud:y[a+20>>2],size:U(a+24),Tc:y[a+32>>2],Uc:y[a+36>>2],Rc:U(a+40),kc:U(a+56),ad:U(a+72),gd:y[b>>2]+4294967296*y[b+4>>2]}}
39
+ function Gb(a,b){var c=Hb(),e={Nc:b.read,Oc:b.write,Bc:f=>{Bb[f]={}},Fc:f=>{Bb[f]=void 0},getSize:()=>{},zd:()=>0,read:(f,h,k,m)=>{var u=l.oc.subarray(h,h+k);try{var p=e.Nc(Bb[f],u,0,k,m)}catch(x){return-x.qc}l.oc.set(u,h);return p},write:(f,h,k,m)=>{var u=l.oc.subarray(h,h+k);try{var p=e.Oc(Bb[f],u,0,k,m)}catch(x){return-x.qc}l.oc.set(u,h);return p}};Y[c]=e;Ab[a]=c}
40
+ function Ib(a,b,c){"undefined"===typeof c&&(c=b,b=438);var e=Ab[c];if(!e)throw Error("Invalid device ID.");return V.handleError(T(()=>Jb(Q(a),b,e)))}
41
+ var V={ub:null,handleError(a){if(0>a)throw new V.ub(-a);return a},Zc(a,b,c,e,f,h){pb(a,b,c,e,f,h)},Dc(a,b){for(b=b.split("/").reverse();b.length;){var c=b.pop();if(c){var e=P.rc(a,c);Ua?V.xc(e):Ta.push({Ic:a,Cc:c});a=e}}return e},$c(a,b,c,e,f,h,k,m,u,p){return vb(a,b,c,e,f,h,k,m,u,p)},Ec:()=>{var a=Kb();return a?F(v,a):""},Qc(a){var b=!!Db(a);return{cd:b,object:{Xc:b?la(a):null}}},xc:(a,b)=>xb(a,b),nd:(a,b)=>{a=a.split("/");for(var c="",e=0;e<a.length;++e)if(a[e]){c+="/"+a[e];try{xb(c,b)}catch(f){if(20!=
42
+ f.qc)throw f;}}},yd:a=>V.handleError(T(()=>Lb(Q(a)))),open:(a,b,c)=>T(()=>{if("string"==typeof b){var e={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[b];if("undefined"==typeof e)throw Error(`Unknown file open mode: ${b}`);}else e=b;b=e;c="undefined"==typeof c?438:c;e=Q(a);return{mc:V.handleError(Mb(e,b,c))}}),create:(a,b)=>lb(a,b),close:a=>V.handleError(-Nb(a.mc)),Cd:a=>zb(a),Vc:a=>T(()=>{var b=Q(a);return Ob(b)}),read(a,b,c,e,f){var h="undefined"!=typeof f,k=W(e);a=h?Pb(a.mc,k,e,f):Qb(a.mc,k,e);a=
43
+ V.handleError(a);for(f=0;f<e;f++)b[c+f]=t[k+f];X(k);return a},write(a,b,c,e,f){for(var h="undefined"!=typeof f,k=W(e),m=0;m<e;m++)t[k+m]=b[c+m];a=h?Rb(a.mc,k,e,f):Sb(a.mc,k,e);a=V.handleError(a);X(k);return a},nc(a,b,c){return V.handleError(Tb(a.mc,b>>>0,(D=b,1<=+Math.abs(D)?0<D?+Math.floor(D/4294967296)>>>0:~~+Math.ceil((D-+(~~D>>>0))/4294967296)>>>0:0),c>>>0,(D=c,1<=+Math.abs(D)?0<D?+Math.floor(D/4294967296)>>>0:~~+Math.ceil((D-+(~~D>>>0))/4294967296)>>>0:0)))},Pc:(a,b)=>nb(a,b),pd:(a,b,c,e,f)=>
44
+ ({td:V.handleError(Ub(b,e,f,a.mc,c>>>0,(D=c,1<=+Math.abs(D)?0<D?+Math.floor(D/4294967296)>>>0:~~+Math.ceil((D-+(~~D>>>0))/4294967296)>>>0:0))),lc:!0}),qd:(a,b,c,e,f)=>{0===c||C();return V.handleError(Vb(b,e,f))},rd:(a,b)=>V.handleError(Wb(a,b)),Ad:(a,b)=>T(()=>Xb(Q(a),Q(b))),vd(a){var b=V.handleError(T(()=>Yb(Q(a))));return b?F(v,b):""},stat(a){var b=W(96);V.handleError(T(()=>Zb(Q(a),b)));var c=Fb(b);X(b);return c},md(a){var b=W(96);V.handleError(T(()=>$b(Q(a),b)));var c=Fb(b);X(b);return c},Wc(a,
45
+ b){return V.handleError(T(()=>{var c=Q(a);return ac(c,b)}))},kd(a,b){return V.handleError(T(()=>{var c=Q(a);return bc(c,b)}))},dd(a,b){return V.handleError(cc(a,b))},Ed:(a,b,c)=>V.handleError(T(()=>dc(Q(a),b,c))),truncate(a,b){return V.handleError(T(()=>ec(Q(a),b>>>0,(D=b,1<=+Math.abs(D)?0<D?+Math.floor(D/4294967296)>>>0:~~+Math.ceil((D-+(~~D>>>0))/4294967296)>>>0:0))))},ed(a,b){return V.handleError(fc(a,b>>>0,(D=b,1<=+Math.abs(D)?0<D?+Math.floor(D/4294967296)>>>0:~~+Math.ceil((D-+(~~D>>>0))/4294967296)>>>
46
+ 0:0)))},Kc:a=>T(()=>{var b=Q(a),c=[];b=gc(b);if(!b)throw Error("No such directory");for(var e;e=hc(b);)c.push(e?F(v,e):"");ic(b);return c}),Hc:(a,b,c)=>{var e=a.Yc(b);return V.handleError(T(()=>jc(Q(c),e)))},Dd:a=>V.handleError(T(()=>kc(Q(a)))),od:(a,b,c)=>kb(a,b,c),Gc:(a,b)=>a<<8|b,pc(a,b,c,e){if("string"!=typeof a)throw Error("Only string paths are accepted");a=P.rc(a,b);b=ob(!!c,!!e);V.pc.wc||(V.pc.wc=64);var f=V.Gc(V.pc.wc++,0);Gb(f,{read(h,k,m,u){for(var p=h=0;p<u;p++){try{var x=c()}catch(I){throw new V.ub(29);
47
+ }if(void 0===x&&0===h)throw new V.ub(6);if(null===x||void 0===x)break;h++;k[m+p]=x}return h},write(h,k,m,u){for(h=0;h<u;h++)try{e(k[m+h])}catch(p){throw new V.ub(29);}return h}});return Ib(a,b,f)},xd(a,b){return V.handleError(T(()=>{var c=Q(a),e=Q(b);return lc(c,e)}))},ld(a,b,c){return V.handleError(mc(a.mc,b>>>0,(D=b,1<=+Math.abs(D)?0<D?+Math.floor(D/4294967296)>>>0:~~+Math.ceil((D-+(~~D>>>0))/4294967296)>>>0:0),c))}},nc=V.Dc;tb();
48
+ var rc={b:(a,b,c,e)=>{C(`Assertion failed: ${a?F(v,a):""}, at: `+[b?b?F(v,b):"":"unknown filename",c,e?e?F(v,e):"":"unknown function"])},k:()=>{C("")},_:()=>{Ka=!1;Pa=0},t:function(a,b,c){a=new Date(1E3*G(a,b));w[c>>2]=a.getSeconds();w[c+4>>2]=a.getMinutes();w[c+8>>2]=a.getHours();w[c+12>>2]=a.getDate();w[c+16>>2]=a.getMonth();w[c+20>>2]=a.getFullYear()-1900;w[c+24>>2]=a.getDay();b=a.getFullYear();w[c+28>>2]=(0!==b%4||0===b%100&&0!==b%400?Na:Ma)[a.getMonth()]+a.getDate()-1|0;w[c+36>>2]=-(60*a.getTimezoneOffset());
49
+ b=(new Date(a.getFullYear(),6,1)).getTimezoneOffset();var e=(new Date(a.getFullYear(),0,1)).getTimezoneOffset();w[c+32>>2]=(b!=e&&a.getTimezoneOffset()==Math.min(e,b))|0},u:(a,b)=>{H[a]&&(clearTimeout(H[a].id),delete H[a]);if(!b)return 0;var c=setTimeout(()=>{delete H[a];Ra(()=>pc(a,Sa()))},b);H[a]={id:c,Bd:b};return 0},$:(a,b,c,e)=>{var f=(new Date).getFullYear(),h=(new Date(f,0,1)).getTimezoneOffset();f=(new Date(f,6,1)).getTimezoneOffset();y[a>>2]=60*Math.max(h,f);w[b>>2]=Number(h!=f);b=k=>{var m=
50
+ Math.abs(k);return`UTC${0<=k?"-":"+"}${String(Math.floor(m/60)).padStart(2,"0")}${String(m%60).padStart(2,"0")}`};a=b(h);b=b(f);f<h?(J(a,v,c,17),J(b,v,e,17)):(J(a,v,e,17),J(b,v,c,17))},U:(a,b)=>v.set(K[a].sc,b),R:()=>Ta.length,T:()=>{Ua=!0;return K.length},P:(a,b)=>{a=Ta[a].Cc;J(a,v,b,L(a)+1)},N:a=>K[a].mode,V:a=>K[a].sc.length,Q:(a,b)=>{a=Ta[a].Ic;J(a,v,b,L(a)+1)},O:(a,b)=>{a=K[a].Jc;J(a,v,b,L(a)+1)},M:(a,b)=>Y[a].Bc(b),j:(a,b)=>Y[a].Fc(b),L:(a,b)=>Y[a].getSize(b),r:function(a,b,c,e,f,h){return Y[a].read?
51
+ Y[a].read(b,c,e,G(f,h)):-28},p:()=>0,q:function(a,b,c,e,f,h){return Y[a].write?Y[a].write(b,c,e,G(f,h)):-28},D:async function(a,b,c){a=M.get(b);try{await a.close()}catch{w[c>>2]=-29}Va(M,b)},h:a=>{Va(Xa,a)},z:async function(a,b,c){a=M.get(b);try{await a.flush()}catch{w[c>>2]=-29}},e:a=>{Va(N,a)},g:a=>{Va(O,a)},J:async function(a,b,c,e,f){a=c?F(v,c):"";c=1;let h=await Ya(b,a,!1);-31==h&&(c=2,h=await Za(b,a,!1));w[e>>2]=c;w[f>>2]=h},v:async function(a,b,c,e){a=N.get(b);try{let f=a.entries();for(let h;h=
52
+ await f.next(),!h.done;){let [k,m]=h.value,u=R(),p=Q(k);qc(c,p,"file"==m.kind?1:2);S(u)}}catch{w[e>>2]=-29}},G:async function(a,b,c){a=M.get(b);let e;try{e=await a.getSize()}catch{e=-29}E=[e>>>0,(D=e,1<=+Math.abs(D)?0<D?+Math.floor(D/4294967296)>>>0:~~+Math.ceil((D-+(~~D>>>0))/4294967296)>>>0:0)];w[c>>2]=E[0];w[c+4>>2]=E[1]},F:a=>Xa.get(a).size,H:async function(a,b,c){a=O.get(b);let e;try{e=(await a.getFile()).size}catch{e=-29}E=[e>>>0,(D=e,1<=+Math.abs(D)?0<D?+Math.floor(D/4294967296)>>>0:~~+Math.ceil((D-
53
+ +(~~D>>>0))/4294967296)>>>0:0)];w[c>>2]=E[0];w[c+4>>2]=E[1]},K:async function(){if(1==N.lc.length){let a=await navigator.storage.getDirectory();N.lc.push(a)}},x:async function(a,b,c,e){a=c?F(v,c):"";b=await Za(b,a,!0);w[e>>2]=b},y:async function(a,b,c,e){a=c?F(v,c):"";b=await Ya(b,a,!0);w[e>>2]=b},f:async function(a,b,c,e,f){a=e?F(v,e):"";b=O.get(b);c=N.get(c);try{await b.move(c,a)}catch{w[f>>2]=-29}},i:async function(a,b,c){a=O.get(b);let e;try{let f;f=await new $a(a);e=M.nc(f)}catch(f){e="InvalidStateError"===
54
+ f.name||"NoModificationAllowedError"===f.name?-2:-29}w[c>>2]=e},E:async function(a,b,c){a=O.get(b);let e;try{let f=await a.getFile();e=Xa.nc(f)}catch(f){e="NotAllowedError"===f.name?-2:-29}w[c>>2]=e},C:async function(a,b,c,e){a=M.get(a);b=v.subarray(b,b+c);try{return await a.read(b,{at:e})}catch(f){return"TypeError"==f.name?-28:-29}},B:async function(a,b,c,e,f,h){a=Xa.get(b).slice(f,f+e);b=0;try{let k=await a.arrayBuffer(),m=new Uint8Array(k);v.set(m,c);b+=m.length}catch(k){b=k instanceof RangeError?
55
+ -21:-29}w[h>>2]=b},w:async function(a,b,c,e){a=c?F(v,c):"";b=N.get(b);try{await b.removeEntry(a)}catch{w[e>>2]=-29}},o:async function(a,b,c,e,f){a=G(c,e);b=M.get(b);try{await b.truncate(a)}catch{w[f>>2]=-29}},n:async function(a,b,c,e,f){a=G(c,e);b=O.get(b);try{let h=await b.createWritable({keepExistingData:!0});await h.truncate(a);await h.close()}catch{w[f>>2]=-29}},A:async function(a,b,c,e){a=M.get(a);b=v.subarray(b,b+c);try{return await a.write(b,{at:e})}catch(f){return"TypeError"==f.name?-28:-29}},
56
+ Y:()=>{a:{if(!ab.length){var a=null;"undefined"!=typeof window&&"function"==typeof window.prompt&&(a=window.prompt("Input: "),null!==a&&(a+="\n"));if(!a){var b=null;break a}b=Array(L(a)+1);a=J(a,b,0,b.length);b.length=a;ab=b}b=ab.shift()}return"number"===typeof b?b:-1},c:()=>Date.now(),d:a=>r(a?F(v,a):""),X:a=>qa(a?F(v,a):""),Z:a=>{var b=v.length;a>>>=0;if(2147483648<a)return!1;for(var c=1;4>=c;c*=2){var e=b*(1+.2/c);e=Math.min(e,a+100663296);a:{e=(Math.min(2147483648,65536*Math.ceil(Math.max(a,e)/
57
+ 65536))-n.buffer.byteLength+65535)/65536;try{n.grow(e);ua();var f=1;break a}catch(h){}f=void 0}if(f)return!0}return!1},m:(a,b)=>{var c=0;fb().forEach((e,f)=>{var h=b+c;f=y[a+4*f>>2]=h;for(h=0;h<e.length;++h)t[f++]=e.charCodeAt(h);t[f]=0;c+=e.length+1});return 0},s:(a,b)=>{var c=fb();y[a>>2]=c.length;var e=0;c.forEach(f=>e+=f.length+1);y[b>>2]=e;return 0},W:(a,b)=>{hb(v.subarray(a,a+b));return 0},a:n,l:Qa,ba:function(a,b,c,e,f){return l.callbacks.callFunction(void 0,a,b,c,e,f)},aa:function(a){return l.callbacks.shouldInterrupt(void 0,
58
+ a)},S:function(a,b,c){c=c?F(v,c):"";return l.callbacks.loadModuleSource(void 0,a,b,c)},I:function(a,b,c,e){c=c?F(v,c):"";e=e?F(v,e):"";return l.callbacks.normalizeModule(void 0,a,b,c,e)}},Z=function(){function a(c){Z=c.exports;wa.unshift(Z.ca);B("wasm-instantiate");return Z}var b={a:rc};Aa("wasm-instantiate");if(l.instantiateWasm)try{return l.instantiateWasm(b,a)}catch(c){r(`Module.instantiateWasm callback failed with error: ${c}`),fa(c)}Ca||=l.locateFile?Ba("emscripten-module.wasm")?"emscripten-module.wasm":
59
+ l.locateFile?l.locateFile("emscripten-module.wasm",q):q+"emscripten-module.wasm":(new URL("emscripten-module.wasm",import.meta.url)).href;Ha(b,function(c){a(c.instance)}).catch(fa);return{}}(),W=l._malloc=a=>(W=l._malloc=Z.da)(a);l._QTS_Throw=(a,b)=>(l._QTS_Throw=Z.ea)(a,b);l._QTS_NewError=a=>(l._QTS_NewError=Z.fa)(a);l._QTS_RuntimeSetMemoryLimit=(a,b)=>(l._QTS_RuntimeSetMemoryLimit=Z.ga)(a,b);l._QTS_RuntimeComputeMemoryUsage=(a,b)=>(l._QTS_RuntimeComputeMemoryUsage=Z.ha)(a,b);
60
+ l._QTS_RuntimeDumpMemoryUsage=a=>(l._QTS_RuntimeDumpMemoryUsage=Z.ia)(a);l._QTS_RecoverableLeakCheck=()=>(l._QTS_RecoverableLeakCheck=Z.ja)();l._QTS_BuildIsSanitizeLeak=()=>(l._QTS_BuildIsSanitizeLeak=Z.ka)();l._QTS_RuntimeSetMaxStackSize=(a,b)=>(l._QTS_RuntimeSetMaxStackSize=Z.la)(a,b);l._QTS_GetUndefined=()=>(l._QTS_GetUndefined=Z.ma)();l._QTS_GetNull=()=>(l._QTS_GetNull=Z.na)();l._QTS_GetFalse=()=>(l._QTS_GetFalse=Z.oa)();l._QTS_GetTrue=()=>(l._QTS_GetTrue=Z.pa)();
61
+ l._QTS_NewRuntime=()=>(l._QTS_NewRuntime=Z.qa)();l._QTS_FreeRuntime=a=>(l._QTS_FreeRuntime=Z.ra)(a);var X=l._free=a=>(X=l._free=Z.sa)(a);l._QTS_NewContext=(a,b)=>(l._QTS_NewContext=Z.ta)(a,b);l._QTS_FreeContext=a=>(l._QTS_FreeContext=Z.ua)(a);l._QTS_FreeValuePointer=(a,b)=>(l._QTS_FreeValuePointer=Z.va)(a,b);l._QTS_FreeValuePointerRuntime=(a,b)=>(l._QTS_FreeValuePointerRuntime=Z.wa)(a,b);l._QTS_FreeVoidPointer=(a,b)=>(l._QTS_FreeVoidPointer=Z.xa)(a,b);
62
+ l._QTS_FreeCString=(a,b)=>(l._QTS_FreeCString=Z.ya)(a,b);l._QTS_DupValuePointer=(a,b)=>(l._QTS_DupValuePointer=Z.za)(a,b);l._QTS_NewObject=a=>(l._QTS_NewObject=Z.Aa)(a);l._QTS_NewObjectProto=(a,b)=>(l._QTS_NewObjectProto=Z.Ba)(a,b);l._QTS_NewArray=a=>(l._QTS_NewArray=Z.Ca)(a);l._QTS_NewArrayBuffer=(a,b,c)=>(l._QTS_NewArrayBuffer=Z.Da)(a,b,c);l._QTS_NewFloat64=(a,b)=>(l._QTS_NewFloat64=Z.Ea)(a,b);l._QTS_GetFloat64=(a,b)=>(l._QTS_GetFloat64=Z.Fa)(a,b);
63
+ l._QTS_NewString=(a,b)=>(l._QTS_NewString=Z.Ga)(a,b);l._QTS_GetString=(a,b)=>(l._QTS_GetString=Z.Ha)(a,b);l._QTS_GetArrayBuffer=(a,b)=>(l._QTS_GetArrayBuffer=Z.Ia)(a,b);l._QTS_GetArrayBufferLength=(a,b)=>(l._QTS_GetArrayBufferLength=Z.Ja)(a,b);l._QTS_NewSymbol=(a,b,c)=>(l._QTS_NewSymbol=Z.Ka)(a,b,c);l._QTS_GetSymbolDescriptionOrKey=(a,b)=>(l._QTS_GetSymbolDescriptionOrKey=Z.La)(a,b);l._QTS_IsGlobalSymbol=(a,b)=>(l._QTS_IsGlobalSymbol=Z.Ma)(a,b);l._QTS_IsJobPending=a=>(l._QTS_IsJobPending=Z.Na)(a);
64
+ l._QTS_ExecutePendingJob=(a,b,c)=>(l._QTS_ExecutePendingJob=Z.Oa)(a,b,c);l._QTS_GetProp=(a,b,c)=>(l._QTS_GetProp=Z.Pa)(a,b,c);l._QTS_GetPropNumber=(a,b,c)=>(l._QTS_GetPropNumber=Z.Qa)(a,b,c);l._QTS_SetProp=(a,b,c,e)=>(l._QTS_SetProp=Z.Ra)(a,b,c,e);l._QTS_DefineProp=(a,b,c,e,f,h,k,m,u)=>(l._QTS_DefineProp=Z.Sa)(a,b,c,e,f,h,k,m,u);l._QTS_GetOwnPropertyNames=(a,b,c,e,f)=>(l._QTS_GetOwnPropertyNames=Z.Ta)(a,b,c,e,f);l._QTS_Call=(a,b,c,e,f)=>(l._QTS_Call=Z.Ua)(a,b,c,e,f);
65
+ l._QTS_ResolveException=(a,b)=>(l._QTS_ResolveException=Z.Va)(a,b);l._QTS_Dump=(a,b)=>(l._QTS_Dump=Z.Wa)(a,b);l._QTS_Eval=(a,b,c,e,f,h)=>(l._QTS_Eval=Z.Xa)(a,b,c,e,f,h);l._QTS_GetModuleNamespace=(a,b)=>(l._QTS_GetModuleNamespace=Z.Ya)(a,b);l._QTS_Typeof=(a,b)=>(l._QTS_Typeof=Z.Za)(a,b);l._QTS_GetLength=(a,b,c)=>(l._QTS_GetLength=Z._a)(a,b,c);l._QTS_IsEqual=(a,b,c,e)=>(l._QTS_IsEqual=Z.$a)(a,b,c,e);l._QTS_GetGlobalObject=a=>(l._QTS_GetGlobalObject=Z.ab)(a);
66
+ l._QTS_NewPromiseCapability=(a,b)=>(l._QTS_NewPromiseCapability=Z.bb)(a,b);l._QTS_PromiseState=(a,b)=>(l._QTS_PromiseState=Z.cb)(a,b);l._QTS_PromiseResult=(a,b)=>(l._QTS_PromiseResult=Z.db)(a,b);l._QTS_TestStringArg=a=>(l._QTS_TestStringArg=Z.eb)(a);l._QTS_GetDebugLogEnabled=a=>(l._QTS_GetDebugLogEnabled=Z.fb)(a);l._QTS_SetDebugLogEnabled=(a,b)=>(l._QTS_SetDebugLogEnabled=Z.gb)(a,b);l._QTS_BuildIsDebug=()=>(l._QTS_BuildIsDebug=Z.hb)();l._QTS_BuildIsAsyncify=()=>(l._QTS_BuildIsAsyncify=Z.ib)();
67
+ l._QTS_NewFunction=(a,b,c)=>(l._QTS_NewFunction=Z.jb)(a,b,c);l._QTS_ArgvGetJSValueConstPointer=(a,b)=>(l._QTS_ArgvGetJSValueConstPointer=Z.kb)(a,b);l._QTS_RuntimeEnableInterruptHandler=a=>(l._QTS_RuntimeEnableInterruptHandler=Z.lb)(a);l._QTS_RuntimeDisableInterruptHandler=a=>(l._QTS_RuntimeDisableInterruptHandler=Z.mb)(a);l._QTS_RuntimeEnableModuleLoader=(a,b)=>(l._QTS_RuntimeEnableModuleLoader=Z.nb)(a,b);l._QTS_RuntimeDisableModuleLoader=a=>(l._QTS_RuntimeDisableModuleLoader=Z.ob)(a);
68
+ l._QTS_bjson_encode=(a,b)=>(l._QTS_bjson_encode=Z.pb)(a,b);l._QTS_bjson_decode=(a,b)=>(l._QTS_bjson_decode=Z.qb)(a,b);l._QTS_EvalFunction=(a,b)=>(l._QTS_EvalFunction=Z.rb)(a,b);l._QTS_EncodeBytecode=(a,b)=>(l._QTS_EncodeBytecode=Z.sb)(a,b);l._QTS_DecodeBytecode=(a,b)=>(l._QTS_DecodeBytecode=Z.tb)(a,b);
69
+ var pc=(a,b)=>(pc=Z.vb)(a,b),S=a=>(S=Z.wb)(a),ib=a=>(ib=Z.xb)(a),R=()=>(R=Z.yb)(),Cb=a=>(Cb=Z.zb)(a),mb=(a,b,c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(Jb=Z.jc)(a,b,c);l.addRunDependency=Aa;l.removeRunDependency=B;
72
+ l.ERRNO_CODES={EPERM:63,ENOENT:44,ESRCH:71,EINTR:27,EIO:29,ENXIO:60,E2BIG:1,ENOEXEC:45,EBADF:8,ECHILD:12,EAGAIN:6,EWOULDBLOCK:6,ENOMEM:48,EACCES:2,EFAULT:21,ENOTBLK:105,EBUSY:10,EEXIST:20,EXDEV:75,ENODEV:43,ENOTDIR:54,EISDIR:31,EINVAL:28,ENFILE:41,EMFILE:33,ENOTTY:59,ETXTBSY:74,EFBIG:22,ENOSPC:51,ESPIPE:70,EROFS:69,EMLINK:34,EPIPE:64,EDOM:18,ERANGE:68,ENOMSG:49,EIDRM:24,ECHRNG:106,EL2NSYNC:156,EL3HLT:107,EL3RST:108,ELNRNG:109,EUNATCH:110,ENOCSI:111,EL2HLT:112,EDEADLK:16,ENOLCK:46,EBADE:113,EBADR:114,
73
+ EXFULL:115,ENOANO:104,EBADRQC:103,EBADSLT:102,EDEADLOCK:16,EBFONT:101,ENOSTR:100,ENODATA:116,ETIME:117,ENOSR:118,ENONET:119,ENOPKG:120,EREMOTE:121,ENOLINK:47,EADV:122,ESRMNT:123,ECOMM:124,EPROTO:65,EMULTIHOP:36,EDOTDOT:125,EBADMSG:9,ENOTUNIQ:126,EBADFD:127,EREMCHG:128,ELIBACC:129,ELIBBAD:130,ELIBSCN:131,ELIBMAX:132,ELIBEXEC:133,ENOSYS:52,ENOTEMPTY:55,ENAMETOOLONG:37,ELOOP:32,EOPNOTSUPP:138,EPFNOSUPPORT:139,ECONNRESET:15,ENOBUFS:42,EAFNOSUPPORT:5,EPROTOTYPE:67,ENOTSOCK:57,ENOPROTOOPT:50,ESHUTDOWN:140,
74
+ ECONNREFUSED:14,EADDRINUSE:3,ECONNABORTED:13,ENETUNREACH:40,ENETDOWN:38,ETIMEDOUT:73,EHOSTDOWN:142,EHOSTUNREACH:23,EINPROGRESS:26,EALREADY:7,EDESTADDRREQ:17,EMSGSIZE:35,EPROTONOSUPPORT:66,ESOCKTNOSUPPORT:137,EADDRNOTAVAIL:4,ENETRESET:39,EISCONN:30,ENOTCONN:53,ETOOMANYREFS:141,EUSERS:136,EDQUOT:19,ESTALE:72,ENOTSUP:138,ENOMEDIUM:148,EILSEQ:25,EOVERFLOW:61,ECANCELED:11,ENOTRECOVERABLE:56,EOWNERDEAD:62,ESTRPIPE:135};l.PATH=P;l.FS_createPreloadedFile=vb;l.FS_unlink=zb;l.FS_createPath=nc;l.FS=V;
75
+ l.FS_createDataFile=pb;l.wasmfsOPFSGetOrCreateFile=Ya;l.wasmfsOPFSGetOrCreateDir=Za;var sc;A=function tc(){sc||uc();sc||(A=tc)};
76
+ function uc(){function a(){if(!sc&&(sc=!0,l.calledRun=!0,!sa)){Ja(wa);ea(l);l.onRuntimeInitialized?.();if(l.postRun)for("function"==typeof l.postRun&&(l.postRun=[l.postRun]);l.postRun.length;){var b=l.postRun.shift();xa.unshift(b)}Ja(xa)}}if(!(0<z)){if(l.preRun)for("function"==typeof l.preRun&&(l.preRun=[l.preRun]);l.preRun.length;)ya();Ja(va);0<z||(l.setStatus?(l.setStatus("Running..."),setTimeout(function(){setTimeout(function(){l.setStatus("")},1);a()},1)):a())}}
77
+ if(l.preInit)for("function"==typeof l.preInit&&(l.preInit=[l.preInit]);0<l.preInit.length;)l.preInit.pop()();uc();moduleRtn=ha;
78
+
79
+
80
+ return moduleRtn;
81
+ }
82
+ );
83
+ })();
84
+ export default QuickJSRaw;
Binary file
package/dist/ffi.d.mts ADDED
@@ -0,0 +1,86 @@
1
+ import { QuickJSEmscriptenModule, JSContextPointer, JSValuePointer, JSValueConstPointer, JSRuntimePointer, OwnedHeapCharPointer, IntrinsicsFlags, JSVoidPointer, JSBorrowedCharPointer, BorrowedHeapCharPointer, JSContextPointerPointer, JSValuePointerPointerPointer, UInt32Pointer, JSValueConstPointerPointer, EvalDetectModule, EvalFlags, IsEqualOp, JSValuePointerPointer, JSPromiseStateEnum } from '@jitl/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 QuickJSFFI {
11
+ private module;
12
+ constructor(module: QuickJSEmscriptenModule);
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_IsGlobalSymbol: (ctx: JSContextPointer, value: JSValuePointer | JSValueConstPointer) => number;
49
+ QTS_IsJobPending: (rt: JSRuntimePointer) => number;
50
+ QTS_ExecutePendingJob: (rt: JSRuntimePointer, maxJobsToExecute: number, lastJobContext: JSContextPointerPointer) => JSValuePointer;
51
+ QTS_GetProp: (ctx: JSContextPointer, this_val: JSValuePointer | JSValueConstPointer, prop_name: JSValuePointer | JSValueConstPointer) => JSValuePointer;
52
+ QTS_GetPropNumber: (ctx: JSContextPointer, this_val: JSValuePointer | JSValueConstPointer, prop_name: number) => JSValuePointer;
53
+ QTS_SetProp: (ctx: JSContextPointer, this_val: JSValuePointer | JSValueConstPointer, prop_name: JSValuePointer | JSValueConstPointer, prop_value: JSValuePointer | JSValueConstPointer) => void;
54
+ 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;
55
+ QTS_GetOwnPropertyNames: (ctx: JSContextPointer, out_ptrs: JSValuePointerPointerPointer, out_len: UInt32Pointer, obj: JSValuePointer | JSValueConstPointer, flags: number) => JSValuePointer;
56
+ QTS_Call: (ctx: JSContextPointer, func_obj: JSValuePointer | JSValueConstPointer, this_obj: JSValuePointer | JSValueConstPointer, argc: number, argv_ptrs: JSValueConstPointerPointer) => JSValuePointer;
57
+ QTS_ResolveException: (ctx: JSContextPointer, maybe_exception: JSValuePointer) => JSValuePointer;
58
+ QTS_Dump: (ctx: JSContextPointer, obj: JSValuePointer | JSValueConstPointer) => JSBorrowedCharPointer;
59
+ QTS_Eval: (ctx: JSContextPointer, js_code: BorrowedHeapCharPointer, js_code_length: number, filename: string, detectModule: EvalDetectModule, evalFlags: EvalFlags) => JSValuePointer;
60
+ QTS_GetModuleNamespace: (ctx: JSContextPointer, module_func_obj: JSValuePointer | JSValueConstPointer) => JSValuePointer;
61
+ QTS_Typeof: (ctx: JSContextPointer, value: JSValuePointer | JSValueConstPointer) => OwnedHeapCharPointer;
62
+ QTS_GetLength: (ctx: JSContextPointer, out_len: UInt32Pointer, value: JSValuePointer | JSValueConstPointer) => number;
63
+ QTS_IsEqual: (ctx: JSContextPointer, a: JSValuePointer | JSValueConstPointer, b: JSValuePointer | JSValueConstPointer, op: IsEqualOp) => number;
64
+ QTS_GetGlobalObject: (ctx: JSContextPointer) => JSValuePointer;
65
+ QTS_NewPromiseCapability: (ctx: JSContextPointer, resolve_funcs_out: JSValuePointerPointer) => JSValuePointer;
66
+ QTS_PromiseState: (ctx: JSContextPointer, promise: JSValuePointer | JSValueConstPointer) => JSPromiseStateEnum;
67
+ QTS_PromiseResult: (ctx: JSContextPointer, promise: JSValuePointer | JSValueConstPointer) => JSValuePointer;
68
+ QTS_TestStringArg: (string: string) => void;
69
+ QTS_GetDebugLogEnabled: (rt: JSRuntimePointer) => number;
70
+ QTS_SetDebugLogEnabled: (rt: JSRuntimePointer, is_enabled: number) => void;
71
+ QTS_BuildIsDebug: () => number;
72
+ QTS_BuildIsAsyncify: () => number;
73
+ QTS_NewFunction: (ctx: JSContextPointer, func_id: number, name: string) => JSValuePointer;
74
+ QTS_ArgvGetJSValueConstPointer: (argv: JSValuePointer | JSValueConstPointer, index: number) => JSValueConstPointer;
75
+ QTS_RuntimeEnableInterruptHandler: (rt: JSRuntimePointer) => void;
76
+ QTS_RuntimeDisableInterruptHandler: (rt: JSRuntimePointer) => void;
77
+ QTS_RuntimeEnableModuleLoader: (rt: JSRuntimePointer, use_custom_normalize: number) => void;
78
+ QTS_RuntimeDisableModuleLoader: (rt: JSRuntimePointer) => void;
79
+ QTS_bjson_encode: (ctx: JSContextPointer, val: JSValuePointer | JSValueConstPointer) => JSValuePointer;
80
+ QTS_bjson_decode: (ctx: JSContextPointer, data: JSValuePointer | JSValueConstPointer) => JSValuePointer;
81
+ QTS_EvalFunction: (ctx: JSContextPointer, fun_obj: JSValuePointer | JSValueConstPointer) => JSValuePointer;
82
+ QTS_EncodeBytecode: (ctx: JSContextPointer, val: JSValuePointer | JSValueConstPointer) => JSValuePointer;
83
+ QTS_DecodeBytecode: (ctx: JSContextPointer, data: JSValuePointer | JSValueConstPointer) => JSValuePointer;
84
+ }
85
+
86
+ export { QuickJSFFI };
package/dist/ffi.d.ts ADDED
@@ -0,0 +1,86 @@
1
+ import { QuickJSEmscriptenModule, JSContextPointer, JSValuePointer, JSValueConstPointer, JSRuntimePointer, OwnedHeapCharPointer, IntrinsicsFlags, JSVoidPointer, JSBorrowedCharPointer, BorrowedHeapCharPointer, JSContextPointerPointer, JSValuePointerPointerPointer, UInt32Pointer, JSValueConstPointerPointer, EvalDetectModule, EvalFlags, IsEqualOp, JSValuePointerPointer, JSPromiseStateEnum } from '@jitl/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 QuickJSFFI {
11
+ private module;
12
+ constructor(module: QuickJSEmscriptenModule);
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_IsGlobalSymbol: (ctx: JSContextPointer, value: JSValuePointer | JSValueConstPointer) => number;
49
+ QTS_IsJobPending: (rt: JSRuntimePointer) => number;
50
+ QTS_ExecutePendingJob: (rt: JSRuntimePointer, maxJobsToExecute: number, lastJobContext: JSContextPointerPointer) => JSValuePointer;
51
+ QTS_GetProp: (ctx: JSContextPointer, this_val: JSValuePointer | JSValueConstPointer, prop_name: JSValuePointer | JSValueConstPointer) => JSValuePointer;
52
+ QTS_GetPropNumber: (ctx: JSContextPointer, this_val: JSValuePointer | JSValueConstPointer, prop_name: number) => JSValuePointer;
53
+ QTS_SetProp: (ctx: JSContextPointer, this_val: JSValuePointer | JSValueConstPointer, prop_name: JSValuePointer | JSValueConstPointer, prop_value: JSValuePointer | JSValueConstPointer) => void;
54
+ 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;
55
+ QTS_GetOwnPropertyNames: (ctx: JSContextPointer, out_ptrs: JSValuePointerPointerPointer, out_len: UInt32Pointer, obj: JSValuePointer | JSValueConstPointer, flags: number) => JSValuePointer;
56
+ QTS_Call: (ctx: JSContextPointer, func_obj: JSValuePointer | JSValueConstPointer, this_obj: JSValuePointer | JSValueConstPointer, argc: number, argv_ptrs: JSValueConstPointerPointer) => JSValuePointer;
57
+ QTS_ResolveException: (ctx: JSContextPointer, maybe_exception: JSValuePointer) => JSValuePointer;
58
+ QTS_Dump: (ctx: JSContextPointer, obj: JSValuePointer | JSValueConstPointer) => JSBorrowedCharPointer;
59
+ QTS_Eval: (ctx: JSContextPointer, js_code: BorrowedHeapCharPointer, js_code_length: number, filename: string, detectModule: EvalDetectModule, evalFlags: EvalFlags) => JSValuePointer;
60
+ QTS_GetModuleNamespace: (ctx: JSContextPointer, module_func_obj: JSValuePointer | JSValueConstPointer) => JSValuePointer;
61
+ QTS_Typeof: (ctx: JSContextPointer, value: JSValuePointer | JSValueConstPointer) => OwnedHeapCharPointer;
62
+ QTS_GetLength: (ctx: JSContextPointer, out_len: UInt32Pointer, value: JSValuePointer | JSValueConstPointer) => number;
63
+ QTS_IsEqual: (ctx: JSContextPointer, a: JSValuePointer | JSValueConstPointer, b: JSValuePointer | JSValueConstPointer, op: IsEqualOp) => number;
64
+ QTS_GetGlobalObject: (ctx: JSContextPointer) => JSValuePointer;
65
+ QTS_NewPromiseCapability: (ctx: JSContextPointer, resolve_funcs_out: JSValuePointerPointer) => JSValuePointer;
66
+ QTS_PromiseState: (ctx: JSContextPointer, promise: JSValuePointer | JSValueConstPointer) => JSPromiseStateEnum;
67
+ QTS_PromiseResult: (ctx: JSContextPointer, promise: JSValuePointer | JSValueConstPointer) => JSValuePointer;
68
+ QTS_TestStringArg: (string: string) => void;
69
+ QTS_GetDebugLogEnabled: (rt: JSRuntimePointer) => number;
70
+ QTS_SetDebugLogEnabled: (rt: JSRuntimePointer, is_enabled: number) => void;
71
+ QTS_BuildIsDebug: () => number;
72
+ QTS_BuildIsAsyncify: () => number;
73
+ QTS_NewFunction: (ctx: JSContextPointer, func_id: number, name: string) => JSValuePointer;
74
+ QTS_ArgvGetJSValueConstPointer: (argv: JSValuePointer | JSValueConstPointer, index: number) => JSValueConstPointer;
75
+ QTS_RuntimeEnableInterruptHandler: (rt: JSRuntimePointer) => void;
76
+ QTS_RuntimeDisableInterruptHandler: (rt: JSRuntimePointer) => void;
77
+ QTS_RuntimeEnableModuleLoader: (rt: JSRuntimePointer, use_custom_normalize: number) => void;
78
+ QTS_RuntimeDisableModuleLoader: (rt: JSRuntimePointer) => void;
79
+ QTS_bjson_encode: (ctx: JSContextPointer, val: JSValuePointer | JSValueConstPointer) => JSValuePointer;
80
+ QTS_bjson_decode: (ctx: JSContextPointer, data: JSValuePointer | JSValueConstPointer) => JSValuePointer;
81
+ QTS_EvalFunction: (ctx: JSContextPointer, fun_obj: JSValuePointer | JSValueConstPointer) => JSValuePointer;
82
+ QTS_EncodeBytecode: (ctx: JSContextPointer, val: JSValuePointer | JSValueConstPointer) => JSValuePointer;
83
+ QTS_DecodeBytecode: (ctx: JSContextPointer, data: JSValuePointer | JSValueConstPointer) => JSValuePointer;
84
+ }
85
+
86
+ export { QuickJSFFI };
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,{QuickJSFFI:()=>QuickJSFFI});module.exports=__toCommonJS(ffi_exports);var QuickJSFFI=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=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=this.module.cwrap("QTS_ExecutePendingJob","number",["number","number","number"]);this.QTS_GetProp=this.module.cwrap("QTS_GetProp","number",["number","number","number"]);this.QTS_GetPropNumber=this.module.cwrap("QTS_GetPropNumber","number",["number","number","number"]);this.QTS_SetProp=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=this.module.cwrap("QTS_GetOwnPropertyNames","number",["number","number","number","number","number"]);this.QTS_Call=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=this.module.cwrap("QTS_Dump","number",["number","number"]);this.QTS_Eval=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=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={QuickJSFFI});
2
+ //# sourceMappingURL=ffi.js.map
@@ -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 QuickJSEmscriptenModule,\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} from \"@jitl/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 QuickJSFFI {\n constructor(private module: QuickJSEmscriptenModule) {}\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 = this.module.cwrap(\"QTS_GetSymbolDescriptionOrKey\", \"number\", [\n \"number\",\n \"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 = this.module.cwrap(\"QTS_ExecutePendingJob\", \"number\", [\n \"number\",\n \"number\",\n \"number\",\n ])\n\n QTS_GetProp: (\n ctx: JSContextPointer,\n this_val: JSValuePointer | JSValueConstPointer,\n prop_name: JSValuePointer | JSValueConstPointer,\n ) => JSValuePointer = this.module.cwrap(\"QTS_GetProp\", \"number\", [\"number\", \"number\", \"number\"])\n\n QTS_GetPropNumber: (\n ctx: JSContextPointer,\n this_val: JSValuePointer | JSValueConstPointer,\n prop_name: number,\n ) => 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 = this.module.cwrap(\"QTS_SetProp\", null, [\"number\", \"number\", \"number\", \"number\"])\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 = this.module.cwrap(\"QTS_GetOwnPropertyNames\", \"number\", [\n \"number\",\n \"number\",\n \"number\",\n \"number\",\n \"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 = 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 = this.module.cwrap(\"QTS_Dump\", \"number\", [\"number\", \"number\"])\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 = 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 = this.module.cwrap(\"QTS_EvalFunction\", \"number\", [\"number\", \"number\"])\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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":["module"]}
package/dist/ffi.mjs ADDED
@@ -0,0 +1,2 @@
1
+ var QuickJSFFI=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=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=this.module.cwrap("QTS_ExecutePendingJob","number",["number","number","number"]);this.QTS_GetProp=this.module.cwrap("QTS_GetProp","number",["number","number","number"]);this.QTS_GetPropNumber=this.module.cwrap("QTS_GetPropNumber","number",["number","number","number"]);this.QTS_SetProp=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=this.module.cwrap("QTS_GetOwnPropertyNames","number",["number","number","number","number","number"]);this.QTS_Call=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=this.module.cwrap("QTS_Dump","number",["number","number"]);this.QTS_Eval=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=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{QuickJSFFI};
2
+ //# sourceMappingURL=ffi.mjs.map
@@ -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 QuickJSEmscriptenModule,\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} from \"@jitl/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 QuickJSFFI {\n constructor(private module: QuickJSEmscriptenModule) {}\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 = this.module.cwrap(\"QTS_GetSymbolDescriptionOrKey\", \"number\", [\n \"number\",\n \"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 = this.module.cwrap(\"QTS_ExecutePendingJob\", \"number\", [\n \"number\",\n \"number\",\n \"number\",\n ])\n\n QTS_GetProp: (\n ctx: JSContextPointer,\n this_val: JSValuePointer | JSValueConstPointer,\n prop_name: JSValuePointer | JSValueConstPointer,\n ) => JSValuePointer = this.module.cwrap(\"QTS_GetProp\", \"number\", [\"number\", \"number\", \"number\"])\n\n QTS_GetPropNumber: (\n ctx: JSContextPointer,\n this_val: JSValuePointer | JSValueConstPointer,\n prop_name: number,\n ) => 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 = this.module.cwrap(\"QTS_SetProp\", null, [\"number\", \"number\", \"number\", \"number\"])\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 = this.module.cwrap(\"QTS_GetOwnPropertyNames\", \"number\", [\n \"number\",\n \"number\",\n \"number\",\n \"number\",\n \"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 = 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 = this.module.cwrap(\"QTS_Dump\", \"number\", [\"number\", \"number\"])\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 = 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 = this.module.cwrap(\"QTS_EvalFunction\", \"number\", [\"number\", \"number\"])\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":"AAmCO,IAAM,WAAN,KAAiB,CACtB,YAAoB,OAAiC,CAAjC,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,CA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AC,CAAC,EAEzF,qBACE,KAAK,OAAO,MAAM,kBAAmB,SAAU,CAAC,SAAU,SAAU,QAAQ,CAAC,EAE/E,oCAG2B,KAAK,OAAO,MAAM,iCAAkC,SAAU,CACvF,SACA,QACF,CAAC,EAED,uCAAoE,KAAK,OAAO,MAC9E,oCACA,KACA,CAAC,QAAQ,CACX,EAEA,wCAAqE,KAAK,OAAO,MAC/E,qCACA,KACA,CAAC,QAAQ,CACX,EAEA,mCACE,KAAK,OAAO,MAAM,gCAAiC,KAAM,CAAC,SAAU,QAAQ,CAAC,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,sBAGsB,KAAK,OAAO,MAAM,mBAAoB,SAAU,CAAC,SAAU,QAAQ,CAAC,EAE1F,wBAGsB,KAAK,OAAO,MAAM,qBAAsB,SAAU,CAAC,SAAU,QAAQ,CAAC,EAE5F,wBAGsB,KAAK,OAAO,MAAM,qBAAsB,SAAU,CAAC,SAAU,QAAQ,CAAC,CA5YtC,CA6YxD","names":[]}
@@ -0,0 +1,20 @@
1
+ import { QuickJSSyncVariant } from '@jitl/quickjs-ffi-types';
2
+
3
+ /**
4
+ * ### @componentor/quickjs-wasmfs-release-sync
5
+ *
6
+ * QuickJS variant with WasmFS and OPFS support for native filesystem access
7
+ * in browsers without JS boundary crossing.
8
+ *
9
+ * | Variable | Setting | Description |
10
+ * | -- | -- | -- |
11
+ * | library | quickjs | The original [bellard/quickjs](https://github.com/bellard/quickjs) library. |
12
+ * | releaseMode | release | Optimized for performance. |
13
+ * | syncMode | sync | Synchronous execution mode. |
14
+ * | emscriptenInclusion | wasm | Has a separate .wasm file with WasmFS + OPFS support. |
15
+ * | exports | browser | Browser-only (OPFS is a browser API) |
16
+ *
17
+ */
18
+ declare const variant: QuickJSSyncVariant;
19
+
20
+ export { variant as default };
@@ -0,0 +1,20 @@
1
+ import { QuickJSSyncVariant } from '@jitl/quickjs-ffi-types';
2
+
3
+ /**
4
+ * ### @componentor/quickjs-wasmfs-release-sync
5
+ *
6
+ * QuickJS variant with WasmFS and OPFS support for native filesystem access
7
+ * in browsers without JS boundary crossing.
8
+ *
9
+ * | Variable | Setting | Description |
10
+ * | -- | -- | -- |
11
+ * | library | quickjs | The original [bellard/quickjs](https://github.com/bellard/quickjs) library. |
12
+ * | releaseMode | release | Optimized for performance. |
13
+ * | syncMode | sync | Synchronous execution mode. |
14
+ * | emscriptenInclusion | wasm | Has a separate .wasm file with WasmFS + OPFS support. |
15
+ * | exports | browser | Browser-only (OPFS is a browser API) |
16
+ *
17
+ */
18
+ declare const variant: QuickJSSyncVariant;
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,{QuickJSFFI:()=>QuickJSFFI});var QuickJSFFI,init_ffi=__esm({"src/ffi.ts"(){"use strict";QuickJSFFI=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=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=this.module.cwrap("QTS_ExecutePendingJob","number",["number","number","number"]);this.QTS_GetProp=this.module.cwrap("QTS_GetProp","number",["number","number","number"]);this.QTS_GetPropNumber=this.module.cwrap("QTS_GetPropNumber","number",["number","number","number"]);this.QTS_SetProp=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=this.module.cwrap("QTS_GetOwnPropertyNames","number",["number","number","number","number","number"]);this.QTS_Call=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=this.module.cwrap("QTS_Dump","number",["number","number"]);this.QTS_Eval=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=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:"sync",importFFI:()=>Promise.resolve().then(()=>(init_ffi(),ffi_exports)).then(mod=>mod.QuickJSFFI),importModuleLoader:()=>import("@componentor/quickjs-wasmfs-release-sync/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 QuickJSEmscriptenModule,\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} from \"@jitl/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 QuickJSFFI {\n constructor(private module: QuickJSEmscriptenModule) {}\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 = this.module.cwrap(\"QTS_GetSymbolDescriptionOrKey\", \"number\", [\n \"number\",\n \"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 = this.module.cwrap(\"QTS_ExecutePendingJob\", \"number\", [\n \"number\",\n \"number\",\n \"number\",\n ])\n\n QTS_GetProp: (\n ctx: JSContextPointer,\n this_val: JSValuePointer | JSValueConstPointer,\n prop_name: JSValuePointer | JSValueConstPointer,\n ) => JSValuePointer = this.module.cwrap(\"QTS_GetProp\", \"number\", [\"number\", \"number\", \"number\"])\n\n QTS_GetPropNumber: (\n ctx: JSContextPointer,\n this_val: JSValuePointer | JSValueConstPointer,\n prop_name: number,\n ) => 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 = this.module.cwrap(\"QTS_SetProp\", null, [\"number\", \"number\", \"number\", \"number\"])\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 = this.module.cwrap(\"QTS_GetOwnPropertyNames\", \"number\", [\n \"number\",\n \"number\",\n \"number\",\n \"number\",\n \"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 = 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 = this.module.cwrap(\"QTS_Dump\", \"number\", [\"number\", \"number\"])\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 = 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 = this.module.cwrap(\"QTS_EvalFunction\", \"number\", [\"number\", \"number\"])\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 { QuickJSSyncVariant } from \"@jitl/quickjs-ffi-types\"\n\n/**\n * ### @componentor/quickjs-wasmfs-release-sync\n *\n * QuickJS variant with WasmFS and OPFS support for native filesystem access\n * in browsers without JS boundary crossing.\n *\n * | Variable | Setting | Description |\n * | -- | -- | -- |\n * | library | quickjs | The original [bellard/quickjs](https://github.com/bellard/quickjs) library. |\n * | releaseMode | release | Optimized for performance. |\n * | syncMode | sync | Synchronous execution mode. |\n * | emscriptenInclusion | wasm | Has a separate .wasm file with WasmFS + OPFS support. |\n * | exports | browser | Browser-only (OPFS is a browser API) |\n *\n */\nconst variant: QuickJSSyncVariant = {\n type: \"sync\",\n importFFI: () => import(\"./ffi.js\").then((mod) => mod.QuickJSFFI),\n importModuleLoader: () =>\n import(\"@componentor/quickjs-wasmfs-release-sync/emscripten-module\").then((mod) => mod.default),\n} as const\n\nexport default variant\n"],"mappings":"q/BAAA,yEAmCa,WAnCb,4CAmCa,WAAN,KAAiB,CACtB,YAAoBA,QAAiC,CAAjC,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,oBA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M,mBAAoB,SAAU,CAAC,SAAU,QAAQ,CAAC,EAE1F,sBAGsB,KAAK,OAAO,MAAM,mBAAoB,SAAU,CAAC,SAAU,QAAQ,CAAC,EAE1F,sBAGsB,KAAK,OAAO,MAAM,mBAAoB,SAAU,CAAC,SAAU,QAAQ,CAAC,EAE1F,wBAGsB,KAAK,OAAO,MAAM,qBAAsB,SAAU,CAAC,SAAU,QAAQ,CAAC,EAE5F,wBAGsB,KAAK,OAAO,MAAM,qBAAsB,SAAU,CAAC,SAAU,QAAQ,CAAC,CA5YtC,CA6YxD,KCjbA,oHAiBA,IAAM,QAA8B,CAClC,KAAM,OACN,UAAW,IAAM,qDAAmB,KAAM,KAAQ,IAAI,UAAU,EAChE,mBAAoB,IAClB,OAAO,4DAA4D,EAAE,KAAM,KAAQ,IAAI,OAAO,CAClG,EAEO,cAAQ","names":["module"]}
package/dist/index.mjs ADDED
@@ -0,0 +1,2 @@
1
+ var variant={type:"sync",importFFI:()=>import("./ffi.mjs").then(mod=>mod.QuickJSFFI),importModuleLoader:()=>import("@componentor/quickjs-wasmfs-release-sync/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 { QuickJSSyncVariant } from \"@jitl/quickjs-ffi-types\"\n\n/**\n * ### @componentor/quickjs-wasmfs-release-sync\n *\n * QuickJS variant with WasmFS and OPFS support for native filesystem access\n * in browsers without JS boundary crossing.\n *\n * | Variable | Setting | Description |\n * | -- | -- | -- |\n * | library | quickjs | The original [bellard/quickjs](https://github.com/bellard/quickjs) library. |\n * | releaseMode | release | Optimized for performance. |\n * | syncMode | sync | Synchronous execution mode. |\n * | emscriptenInclusion | wasm | Has a separate .wasm file with WasmFS + OPFS support. |\n * | exports | browser | Browser-only (OPFS is a browser API) |\n *\n */\nconst variant: QuickJSSyncVariant = {\n type: \"sync\",\n importFFI: () => import(\"./ffi.js\").then((mod) => mod.QuickJSFFI),\n importModuleLoader: () =>\n import(\"@componentor/quickjs-wasmfs-release-sync/emscripten-module\").then((mod) => mod.default),\n} as const\n\nexport default variant\n"],"mappings":"AAiBA,IAAM,QAA8B,CAClC,KAAM,OACN,UAAW,IAAM,OAAO,WAAU,EAAE,KAAM,KAAQ,IAAI,UAAU,EAChE,mBAAoB,IAClB,OAAO,4DAA4D,EAAE,KAAM,KAAQ,IAAI,OAAO,CAClG,EAEO,cAAQ","names":[]}
package/package.json ADDED
@@ -0,0 +1,58 @@
1
+ {
2
+ "name": "@componentor/quickjs-wasmfs-release-sync",
3
+ "license": "MIT",
4
+ "version": "0.31.0",
5
+ "description": "QuickJS variant with WasmFS and OPFS support for native filesystem access in browsers without JS boundary crossing.",
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
+ "browser": "./dist/emscripten-module.browser.mjs",
42
+ "default": "./dist/emscripten-module.browser.mjs"
43
+ }
44
+ },
45
+ "dependencies": {
46
+ "@jitl/quickjs-ffi-types": "0.31.0"
47
+ },
48
+ "devDependencies": {
49
+ "@jitl/tsconfig": "0.31.0"
50
+ },
51
+ "scripts": {
52
+ "build": "pnpm run build:c && pnpm run build:ts",
53
+ "build:c": "make",
54
+ "build:ts": "npx tsup",
55
+ "check:types": "npx tsc --project . --noEmit",
56
+ "clean": "make clean"
57
+ }
58
+ }