@componentor/quickjs-wasmfile-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,82 @@
1
+ # @componentor/quickjs-wasmfile-release-sync
2
+
3
+ Variant with separate .WASM file. Supports browser ESM, NodeJS ESM, and NodeJS CommonJS.
4
+
5
+ This generated package is part of [quickjs-emscripten](https://github.com/componentor/quickjs-emscripten).
6
+ It contains a variant of the quickjs WASM library, and can be used with @componentor/quickjs-emscripten-core.
7
+
8
+ ```typescript
9
+ import variant from "@componentor/quickjs-wasmfile-release-sync"
10
+ import { newQuickJSWASMModuleFromVariant } from "@componentor/quickjs-emscripten-core"
11
+ const QuickJS = await newQuickJSWASMModuleFromVariant(variant)
12
+ ```
13
+
14
+ This variant was built with the following settings:
15
+
16
+ ## Library: quickjs
17
+
18
+ The original [bellard/quickjs](https://github.com/bellard/quickjs) library.
19
+
20
+ Version [2024-02-14+36911f0d](https://github.com/bellard/quickjs/commit/36911f0d3ab1a4c190a4d5cbe7c2db225a455389) vendored to quickjs-emscripten on 2024-06-15.
21
+
22
+ ## Release mode: release
23
+
24
+ Optimized for performance; use when building/deploying your application.
25
+
26
+ ## Exports: require import browser workerd
27
+
28
+ Exports the following in package.json for the package entrypoint:
29
+
30
+ - Exports a NodeJS-compatible CommonJS module, which is faster to load and run compared to an ESModule.
31
+ - Exports a NodeJS-compatible ESModule. Cannot be imported synchronously from a NodeJS CommonJS module.
32
+ - Exports a browser-compatible ESModule, designed to work in browsers and browser-like environments.
33
+ - Targets Cloudflare Workers.
34
+
35
+ ## Extra async magic? No
36
+
37
+ The default, normal build. Note that both variants support regular async functions.
38
+
39
+ ## Single-file, or separate .wasm file? wasm
40
+
41
+ Has a separate .wasm file. May offer better caching in your browser, and reduces the size of your JS bundle. If you have issues, try a 'singlefile' variant.
42
+
43
+ ## More details
44
+
45
+ Full variant JSON description:
46
+
47
+ ```json
48
+ {
49
+ "library": "quickjs",
50
+ "releaseMode": "release",
51
+ "syncMode": "sync",
52
+ "description": "Variant with separate .WASM file. Supports browser ESM, NodeJS ESM, and NodeJS CommonJS.",
53
+ "emscriptenInclusion": "wasm",
54
+ "exports": {
55
+ "require": {
56
+ "emscriptenEnvironment": ["node"]
57
+ },
58
+ "import": {
59
+ "emscriptenEnvironment": ["node"]
60
+ },
61
+ "browser": {
62
+ "emscriptenEnvironment": ["web", "worker"]
63
+ },
64
+ "workerd": {
65
+ "emscriptenEnvironment": ["web"]
66
+ }
67
+ }
68
+ }
69
+ ```
70
+
71
+ Variant-specific Emscripten build flags:
72
+
73
+ ```json
74
+ [
75
+ "-Oz",
76
+ "-flto",
77
+ "--closure 1",
78
+ "-s FILESYSTEM=0",
79
+ "--pre-js $(TEMPLATES)/pre-extension.js",
80
+ "--pre-js $(TEMPLATES)/pre-wasmMemory.js"
81
+ ]
82
+ ```
@@ -0,0 +1,14 @@
1
+ // Generated from ../../templates/emscripten-module.SYNC.d.ts
2
+ import type {
3
+ EmscriptenModuleLoader,
4
+ QuickJSEmscriptenModule,
5
+ } from "@componentor/quickjs-ffi-types"
6
+ /**
7
+ * Emscripten module built from the unmodified [`quickjs/quickjs.h`](../quickjs/quickjs.h)
8
+ * and our FFI support functions [c/interface.c](../c/interface.c).
9
+ *
10
+ * Note that emscripten modules returned by a `MODULARIZE=1` emscripten build
11
+ * (like this one) load asynchronously.
12
+ */
13
+ declare const ModuleLoader: EmscriptenModuleLoader<QuickJSEmscriptenModule>
14
+ export default ModuleLoader
@@ -0,0 +1,44 @@
1
+
2
+ var QuickJSRaw = (() => {
3
+ var _scriptName = import.meta.url;
4
+
5
+ return (
6
+ function(moduleArg = {}) {
7
+ var moduleRtn;
8
+
9
+ var c=moduleArg,f,n,aa=new Promise((a,b)=>{f=a;n=b}),ba="object"==typeof window,p="function"==typeof importScripts;function r(a){a={log:a||function(){}};for(const b of r.La)b(a);return c.quickJSEmscriptenExtensions=a}r.La=[];c.quickjsEmscriptenInit=r;r.La.push(a=>{a.getWasmMemory=function(){return t}});var u=Object.assign({},c),w="./this.program",x="",y,z;
10
+ if(ba||p)p?x=self.location.href:"undefined"!=typeof document&&document.currentScript&&(x=document.currentScript.src),_scriptName&&(x=_scriptName),x.startsWith("blob:")?x="":x=x.substr(0,x.replace(/[?#].*/,"").lastIndexOf("/")+1),p&&(z=a=>{var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";b.send(null);return new Uint8Array(b.response)}),y=a=>fetch(a,{credentials:"same-origin"}).then(b=>b.ok?b.arrayBuffer():Promise.reject(Error(b.status+" : "+b.url)));
11
+ var ca=c.print||console.log.bind(console),A=c.printErr||console.error.bind(console);Object.assign(c,u);u=null;c.thisProgram&&(w=c.thisProgram);var B=c.wasmBinary,t,C=!1,D,E,F,G,H;function I(){var a=t.buffer;c.HEAP8=E=new Int8Array(a);c.HEAP16=new Int16Array(a);c.HEAPU8=F=new Uint8Array(a);c.HEAPU16=new Uint16Array(a);c.HEAP32=G=new Int32Array(a);c.HEAPU32=H=new Uint32Array(a);c.HEAPF32=new Float32Array(a);c.HEAPF64=new Float64Array(a)}
12
+ c.wasmMemory?t=c.wasmMemory:t=new WebAssembly.Memory({initial:(c.INITIAL_MEMORY||16777216)/65536,maximum:32768});I();var J=[],da=[],ea=[];function fa(){var a=c.preRun.shift();J.unshift(a)}var K=0,L=null,M=null;function N(a){c.onAbort?.(a);a="Aborted("+a+")";A(a);C=!0;D=1;a=new WebAssembly.RuntimeError(a+". Build with -sASSERTIONS for more info.");n(a);throw a;}var ha=a=>a.startsWith("data:application/octet-stream;base64,"),O;
13
+ function ia(a){if(a==O&&B)return new Uint8Array(B);if(z)return z(a);throw"both async and sync fetching of the wasm failed";}function ja(a){return B?Promise.resolve().then(()=>ia(a)):y(a).then(b=>new Uint8Array(b),()=>ia(a))}function ka(a,b,d){return ja(a).then(e=>WebAssembly.instantiate(e,b)).then(d,e=>{A(`failed to asynchronously prepare wasm: ${e}`);N(e)})}
14
+ function la(a,b){var d=O;return B||"function"!=typeof WebAssembly.instantiateStreaming||ha(d)||"function"!=typeof fetch?ka(d,a,b):fetch(d,{credentials:"same-origin"}).then(e=>WebAssembly.instantiateStreaming(e,a).then(b,function(g){A(`wasm streaming compile failed: ${g}`);A("falling back to ArrayBuffer instantiation");return ka(d,a,b)}))}function ma(a){this.name="ExitStatus";this.message=`Program terminated with exit(${a})`;this.status=a}
15
+ var P=a=>{for(;0<a.length;)a.shift()(c)},Q=c.noExitRuntime||!0,oa="undefined"!=typeof TextDecoder?new TextDecoder:void 0,R=(a,b,d)=>{var e=b+d;for(d=b;a[d]&&!(d>=e);)++d;if(16<d-b&&a.buffer&&oa)return oa.decode(a.subarray(b,d));for(e="";b<d;){var g=a[b++];if(g&128){var h=a[b++]&63;if(192==(g&224))e+=String.fromCharCode((g&31)<<6|h);else{var k=a[b++]&63;g=224==(g&240)?(g&15)<<12|h<<6|k:(g&7)<<18|h<<12|k<<6|a[b++]&63;65536>g?e+=String.fromCharCode(g):(g-=65536,e+=String.fromCharCode(55296|g>>10,56320|
16
+ g&1023))}}else e+=String.fromCharCode(g)}return e},pa=[0,31,60,91,121,152,182,213,244,274,305,335],qa=[0,31,59,90,120,151,181,212,243,273,304,334],S={},ra=a=>{if(!(a instanceof ma||"unwind"==a))throw a;},T=0,sa=a=>{D=a;Q||0<T||(c.onExit?.(a),C=!0);throw new ma(a);},ta=a=>{if(!C)try{if(a(),!(Q||0<T))try{D=a=D,sa(a)}catch(b){ra(b)}}catch(b){ra(b)}},ua;ua=()=>performance.now();
17
+ var U=(a,b,d)=>{var e=F;if(!(0<d))return 0;var g=b;d=b+d-1;for(var h=0;h<a.length;++h){var k=a.charCodeAt(h);if(55296<=k&&57343>=k){var l=a.charCodeAt(++h);k=65536+((k&1023)<<10)|l&1023}if(127>=k){if(b>=d)break;e[b++]=k}else{if(2047>=k){if(b+1>=d)break;e[b++]=192|k>>6}else{if(65535>=k){if(b+2>=d)break;e[b++]=224|k>>12}else{if(b+3>=d)break;e[b++]=240|k>>18;e[b++]=128|k>>12&63}e[b++]=128|k>>6&63}e[b++]=128|k&63}}e[b]=0;return b-g},V={},va=()=>{if(!W){var a={USER:"web_user",LOGNAME:"web_user",PATH:"/",
18
+ PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:w||"./this.program"},b;for(b in V)void 0===V[b]?delete a[b]:a[b]=V[b];var d=[];for(b in a)d.push(`${b}=${a[b]}`);W=d}return W},W,wa=[null,[],[]],xa=a=>{for(var b=0,d=0;d<a.length;++d){var e=a.charCodeAt(d);127>=e?b++:2047>=e?b+=2:55296<=e&&57343>=e?(b+=4,++d):b+=3}return b},Aa=(a,b,d,e)=>{var g={string:m=>{var q=0;if(null!==m&&void 0!==m&&0!==m){q=xa(m)+1;var na=
19
+ X(q);U(m,na,q);q=na}return q},array:m=>{var q=X(m.length);E.set(m,q);return q}};a=c["_"+a];var h=[],k=0;if(e)for(var l=0;l<e.length;l++){var v=g[d[l]];v?(0===k&&(k=ya()),h[l]=v(e[l])):h[l]=e[l]}d=a(...h);return d=function(m){0!==k&&za(k);return"string"===b?m?R(F,m):"":"boolean"===b?!!m:m}(d)},Ca={b:(a,b,d,e)=>{N(`Assertion failed: ${a?R(F,a):""}, at: `+[b?b?R(F,b):"":"unknown filename",d,e?e?R(F,e):"":"unknown function"])},q:()=>{N("")},n:()=>{Q=!1;T=0},j:function(a,b,d){a=new Date(1E3*(b+2097152>>>
20
+ 0<4194305-!!a?(a>>>0)+4294967296*b:NaN));G[d>>2]=a.getSeconds();G[d+4>>2]=a.getMinutes();G[d+8>>2]=a.getHours();G[d+12>>2]=a.getDate();G[d+16>>2]=a.getMonth();G[d+20>>2]=a.getFullYear()-1900;G[d+24>>2]=a.getDay();b=a.getFullYear();G[d+28>>2]=(0!==b%4||0===b%100&&0!==b%400?qa:pa)[a.getMonth()]+a.getDate()-1|0;G[d+36>>2]=-(60*a.getTimezoneOffset());b=(new Date(a.getFullYear(),6,1)).getTimezoneOffset();var e=(new Date(a.getFullYear(),0,1)).getTimezoneOffset();G[d+32>>2]=(b!=e&&a.getTimezoneOffset()==
21
+ Math.min(e,b))|0},l:(a,b)=>{S[a]&&(clearTimeout(S[a].id),delete S[a]);if(!b)return 0;var d=setTimeout(()=>{delete S[a];ta(()=>Ba(a,ua()))},b);S[a]={id:d,Qa:b};return 0},o:(a,b,d,e)=>{var g=(new Date).getFullYear(),h=(new Date(g,0,1)).getTimezoneOffset();g=(new Date(g,6,1)).getTimezoneOffset();H[a>>2]=60*Math.max(h,g);G[b>>2]=Number(h!=g);b=k=>{var l=Math.abs(k);return`UTC${0<=k?"-":"+"}${String(Math.floor(l/60)).padStart(2,"0")}${String(l%60).padStart(2,"0")}`};a=b(h);b=b(g);g<h?(U(a,d,17),U(b,e,
22
+ 17)):(U(a,e,17),U(b,d,17))},p:()=>Date.now(),m:a=>{var b=F.length;a>>>=0;if(2147483648<a)return!1;for(var d=1;4>=d;d*=2){var e=b*(1+.2/d);e=Math.min(e,a+100663296);a:{e=(Math.min(2147483648,65536*Math.ceil(Math.max(a,e)/65536))-t.buffer.byteLength+65535)/65536;try{t.grow(e);I();var g=1;break a}catch(h){}g=void 0}if(g)return!0}return!1},f:(a,b)=>{var d=0;va().forEach((e,g)=>{var h=b+d;g=H[a+4*g>>2]=h;for(h=0;h<e.length;++h)E[g++]=e.charCodeAt(h);E[g]=0;d+=e.length+1});return 0},g:(a,b)=>{var d=va();
23
+ H[a>>2]=d.length;var e=0;d.forEach(g=>e+=g.length+1);H[b>>2]=e;return 0},e:()=>52,k:function(){return 70},d:(a,b,d,e)=>{for(var g=0,h=0;h<d;h++){var k=H[b>>2],l=H[b+4>>2];b+=8;for(var v=0;v<l;v++){var m=F[k+v],q=wa[a];0===m||10===m?((1===a?ca:A)(R(q,0)),q.length=0):q.push(m)}g+=l}H[e>>2]=g;return 0},a:t,c:sa,s:function(a,b,d,e,g){return c.callbacks.callFunction(void 0,a,b,d,e,g)},r:function(a){return c.callbacks.shouldInterrupt(void 0,a)},i:function(a,b,d){d=d?R(F,d):"";return c.callbacks.loadModuleSource(void 0,
24
+ a,b,d)},h:function(a,b,d,e){d=d?R(F,d):"";e=e?R(F,e):"";return c.callbacks.normalizeModule(void 0,a,b,d,e)}},Y=function(){function a(d){Y=d.exports;da.unshift(Y.t);K--;c.monitorRunDependencies?.(K);0==K&&(null!==L&&(clearInterval(L),L=null),M&&(d=M,M=null,d()));return Y}var b={a:Ca};K++;c.monitorRunDependencies?.(K);if(c.instantiateWasm)try{return c.instantiateWasm(b,a)}catch(d){A(`Module.instantiateWasm callback failed with error: ${d}`),n(d)}O||=c.locateFile?ha("emscripten-module.wasm")?"emscripten-module.wasm":
25
+ c.locateFile?c.locateFile("emscripten-module.wasm",x):x+"emscripten-module.wasm":(new URL("emscripten-module.wasm",import.meta.url)).href;la(b,function(d){a(d.instance)}).catch(n);return{}}();c._malloc=a=>(c._malloc=Y.u)(a);c._QTS_Throw=(a,b)=>(c._QTS_Throw=Y.v)(a,b);c._QTS_NewError=a=>(c._QTS_NewError=Y.w)(a);c._QTS_RuntimeSetMemoryLimit=(a,b)=>(c._QTS_RuntimeSetMemoryLimit=Y.x)(a,b);c._QTS_RuntimeComputeMemoryUsage=(a,b)=>(c._QTS_RuntimeComputeMemoryUsage=Y.y)(a,b);
26
+ c._QTS_RuntimeDumpMemoryUsage=a=>(c._QTS_RuntimeDumpMemoryUsage=Y.z)(a);c._QTS_RecoverableLeakCheck=()=>(c._QTS_RecoverableLeakCheck=Y.A)();c._QTS_BuildIsSanitizeLeak=()=>(c._QTS_BuildIsSanitizeLeak=Y.B)();c._QTS_RuntimeSetMaxStackSize=(a,b)=>(c._QTS_RuntimeSetMaxStackSize=Y.C)(a,b);c._QTS_GetUndefined=()=>(c._QTS_GetUndefined=Y.D)();c._QTS_GetNull=()=>(c._QTS_GetNull=Y.E)();c._QTS_GetFalse=()=>(c._QTS_GetFalse=Y.F)();c._QTS_GetTrue=()=>(c._QTS_GetTrue=Y.G)();
27
+ c._QTS_NewRuntime=()=>(c._QTS_NewRuntime=Y.H)();c._QTS_FreeRuntime=a=>(c._QTS_FreeRuntime=Y.I)(a);c._free=a=>(c._free=Y.J)(a);c._QTS_NewContext=(a,b)=>(c._QTS_NewContext=Y.K)(a,b);c._QTS_FreeContext=a=>(c._QTS_FreeContext=Y.L)(a);c._QTS_FreeValuePointer=(a,b)=>(c._QTS_FreeValuePointer=Y.M)(a,b);c._QTS_FreeValuePointerRuntime=(a,b)=>(c._QTS_FreeValuePointerRuntime=Y.N)(a,b);c._QTS_FreeVoidPointer=(a,b)=>(c._QTS_FreeVoidPointer=Y.O)(a,b);c._QTS_FreeCString=(a,b)=>(c._QTS_FreeCString=Y.P)(a,b);
28
+ c._QTS_DupValuePointer=(a,b)=>(c._QTS_DupValuePointer=Y.Q)(a,b);c._QTS_NewObject=a=>(c._QTS_NewObject=Y.R)(a);c._QTS_NewObjectProto=(a,b)=>(c._QTS_NewObjectProto=Y.S)(a,b);c._QTS_NewArray=a=>(c._QTS_NewArray=Y.T)(a);c._QTS_NewArrayBuffer=(a,b,d)=>(c._QTS_NewArrayBuffer=Y.U)(a,b,d);c._QTS_NewFloat64=(a,b)=>(c._QTS_NewFloat64=Y.V)(a,b);c._QTS_GetFloat64=(a,b)=>(c._QTS_GetFloat64=Y.W)(a,b);c._QTS_NewString=(a,b)=>(c._QTS_NewString=Y.X)(a,b);c._QTS_GetString=(a,b)=>(c._QTS_GetString=Y.Y)(a,b);
29
+ c._QTS_GetArrayBuffer=(a,b)=>(c._QTS_GetArrayBuffer=Y.Z)(a,b);c._QTS_GetArrayBufferLength=(a,b)=>(c._QTS_GetArrayBufferLength=Y._)(a,b);c._QTS_NewSymbol=(a,b,d)=>(c._QTS_NewSymbol=Y.$)(a,b,d);c._QTS_GetSymbolDescriptionOrKey=(a,b)=>(c._QTS_GetSymbolDescriptionOrKey=Y.aa)(a,b);c._QTS_IsGlobalSymbol=(a,b)=>(c._QTS_IsGlobalSymbol=Y.ba)(a,b);c._QTS_IsJobPending=a=>(c._QTS_IsJobPending=Y.ca)(a);c._QTS_ExecutePendingJob=(a,b,d)=>(c._QTS_ExecutePendingJob=Y.da)(a,b,d);
30
+ c._QTS_GetProp=(a,b,d)=>(c._QTS_GetProp=Y.ea)(a,b,d);c._QTS_GetPropNumber=(a,b,d)=>(c._QTS_GetPropNumber=Y.fa)(a,b,d);c._QTS_SetProp=(a,b,d,e)=>(c._QTS_SetProp=Y.ga)(a,b,d,e);c._QTS_DefineProp=(a,b,d,e,g,h,k,l,v)=>(c._QTS_DefineProp=Y.ha)(a,b,d,e,g,h,k,l,v);c._QTS_GetOwnPropertyNames=(a,b,d,e,g)=>(c._QTS_GetOwnPropertyNames=Y.ia)(a,b,d,e,g);c._QTS_Call=(a,b,d,e,g)=>(c._QTS_Call=Y.ja)(a,b,d,e,g);c._QTS_ResolveException=(a,b)=>(c._QTS_ResolveException=Y.ka)(a,b);
31
+ c._QTS_Dump=(a,b)=>(c._QTS_Dump=Y.la)(a,b);c._QTS_Eval=(a,b,d,e,g,h)=>(c._QTS_Eval=Y.ma)(a,b,d,e,g,h);c._QTS_GetModuleNamespace=(a,b)=>(c._QTS_GetModuleNamespace=Y.na)(a,b);c._QTS_Typeof=(a,b)=>(c._QTS_Typeof=Y.oa)(a,b);c._QTS_GetLength=(a,b,d)=>(c._QTS_GetLength=Y.pa)(a,b,d);c._QTS_IsEqual=(a,b,d,e)=>(c._QTS_IsEqual=Y.qa)(a,b,d,e);c._QTS_GetGlobalObject=a=>(c._QTS_GetGlobalObject=Y.ra)(a);c._QTS_NewPromiseCapability=(a,b)=>(c._QTS_NewPromiseCapability=Y.sa)(a,b);
32
+ c._QTS_PromiseState=(a,b)=>(c._QTS_PromiseState=Y.ta)(a,b);c._QTS_PromiseResult=(a,b)=>(c._QTS_PromiseResult=Y.ua)(a,b);c._QTS_TestStringArg=a=>(c._QTS_TestStringArg=Y.va)(a);c._QTS_GetDebugLogEnabled=a=>(c._QTS_GetDebugLogEnabled=Y.wa)(a);c._QTS_SetDebugLogEnabled=(a,b)=>(c._QTS_SetDebugLogEnabled=Y.xa)(a,b);c._QTS_BuildIsDebug=()=>(c._QTS_BuildIsDebug=Y.ya)();c._QTS_BuildIsAsyncify=()=>(c._QTS_BuildIsAsyncify=Y.za)();c._QTS_NewFunction=(a,b,d)=>(c._QTS_NewFunction=Y.Aa)(a,b,d);
33
+ c._QTS_ArgvGetJSValueConstPointer=(a,b)=>(c._QTS_ArgvGetJSValueConstPointer=Y.Ba)(a,b);c._QTS_RuntimeEnableInterruptHandler=a=>(c._QTS_RuntimeEnableInterruptHandler=Y.Ca)(a);c._QTS_RuntimeDisableInterruptHandler=a=>(c._QTS_RuntimeDisableInterruptHandler=Y.Da)(a);c._QTS_RuntimeEnableModuleLoader=(a,b)=>(c._QTS_RuntimeEnableModuleLoader=Y.Ea)(a,b);c._QTS_RuntimeDisableModuleLoader=a=>(c._QTS_RuntimeDisableModuleLoader=Y.Fa)(a);c._QTS_bjson_encode=(a,b)=>(c._QTS_bjson_encode=Y.Ga)(a,b);
34
+ c._QTS_bjson_decode=(a,b)=>(c._QTS_bjson_decode=Y.Ha)(a,b);c._QTS_EvalFunction=(a,b)=>(c._QTS_EvalFunction=Y.Ia)(a,b);c._QTS_EncodeBytecode=(a,b)=>(c._QTS_EncodeBytecode=Y.Ja)(a,b);c._QTS_DecodeBytecode=(a,b)=>(c._QTS_DecodeBytecode=Y.Ka)(a,b);var Ba=(a,b)=>(Ba=Y.Ma)(a,b),za=a=>(za=Y.Na)(a),X=a=>(X=Y.Oa)(a),ya=()=>(ya=Y.Pa)();c.cwrap=(a,b,d,e)=>{var g=!d||d.every(h=>"number"===h||"boolean"===h);return"string"!==b&&g&&!e?c["_"+a]:(...h)=>Aa(a,b,d,h)};c.UTF8ToString=(a,b)=>a?R(F,a,b):"";
35
+ c.stringToUTF8=(a,b,d)=>U(a,b,d);c.lengthBytesUTF8=xa;var Z;M=function Da(){Z||Ea();Z||(M=Da)};
36
+ function Ea(){function a(){if(!Z&&(Z=!0,c.calledRun=!0,!C)){P(da);f(c);c.onRuntimeInitialized?.();if(c.postRun)for("function"==typeof c.postRun&&(c.postRun=[c.postRun]);c.postRun.length;){var b=c.postRun.shift();ea.unshift(b)}P(ea)}}if(!(0<K)){if(c.preRun)for("function"==typeof c.preRun&&(c.preRun=[c.preRun]);c.preRun.length;)fa();P(J);0<K||(c.setStatus?(c.setStatus("Running..."),setTimeout(function(){setTimeout(function(){c.setStatus("")},1);a()},1)):a())}}
37
+ if(c.preInit)for("function"==typeof c.preInit&&(c.preInit=[c.preInit]);0<c.preInit.length;)c.preInit.pop()();Ea();moduleRtn=aa;
38
+
39
+
40
+ return moduleRtn;
41
+ }
42
+ );
43
+ })();
44
+ export default QuickJSRaw;
@@ -0,0 +1,46 @@
1
+
2
+ var QuickJSRaw = (() => {
3
+ var _scriptName = typeof document != 'undefined' ? document.currentScript?.src : undefined;
4
+ if (typeof __filename != 'undefined') _scriptName ||= __filename;
5
+ return (
6
+ function(moduleArg = {}) {
7
+ var moduleRtn;
8
+
9
+ var c=moduleArg,e,n,aa=new Promise((a,b)=>{e=a;n=b});function p(a){a={log:a||function(){}};for(const b of p.La)b(a);return c.quickJSEmscriptenExtensions=a}p.La=[];c.quickjsEmscriptenInit=p;p.La.push(a=>{a.getWasmMemory=function(){return r}});var t=Object.assign({},c),v="./this.program",w=(a,b)=>{throw b;},x="",y,z,fs=require("fs"),A=require("path");x=__dirname+"/";z=a=>{a=ba(a)?new URL(a):A.normalize(a);return fs.readFileSync(a)};
10
+ y=a=>{a=ba(a)?new URL(a):A.normalize(a);return new Promise((b,d)=>{fs.readFile(a,void 0,(f,g)=>{f?d(f):b(g.buffer)})})};!c.thisProgram&&1<process.argv.length&&(v=process.argv[1].replace(/\\/g,"/"));process.argv.slice(2);w=(a,b)=>{process.exitCode=a;throw b;};var ca=c.print||console.log.bind(console),B=c.printErr||console.error.bind(console);Object.assign(c,t);t=null;c.thisProgram&&(v=c.thisProgram);var C=c.wasmBinary,r,D=!1,E,F,G,H,I;
11
+ function da(){var a=r.buffer;c.HEAP8=F=new Int8Array(a);c.HEAP16=new Int16Array(a);c.HEAPU8=G=new Uint8Array(a);c.HEAPU16=new Uint16Array(a);c.HEAP32=H=new Int32Array(a);c.HEAPU32=I=new Uint32Array(a);c.HEAPF32=new Float32Array(a);c.HEAPF64=new Float64Array(a)}c.wasmMemory?r=c.wasmMemory:r=new WebAssembly.Memory({initial:(c.INITIAL_MEMORY||16777216)/65536,maximum:32768});da();var ea=[],fa=[],ha=[];function ia(){var a=c.preRun.shift();ea.unshift(a)}var J=0,K=null,L=null;
12
+ function M(a){c.onAbort?.(a);a="Aborted("+a+")";B(a);D=!0;E=1;a=new WebAssembly.RuntimeError(a+". Build with -sASSERTIONS for more info.");n(a);throw a;}var ja=a=>a.startsWith("data:application/octet-stream;base64,"),ba=a=>a.startsWith("file://"),N;function ka(a){if(a==N&&C)return new Uint8Array(C);if(z)return z(a);throw"both async and sync fetching of the wasm failed";}function la(){var a=N;return C?Promise.resolve().then(()=>ka(a)):y(a).then(b=>new Uint8Array(b),()=>ka(a))}
13
+ function na(a,b){return la().then(d=>WebAssembly.instantiate(d,a)).then(b,d=>{B(`failed to asynchronously prepare wasm: ${d}`);M(d)})}function oa(a,b){return na(a,b)}function O(a){this.name="ExitStatus";this.message=`Program terminated with exit(${a})`;this.status=a}
14
+ var P=a=>{for(;0<a.length;)a.shift()(c)},Q=c.noExitRuntime||!0,pa="undefined"!=typeof TextDecoder?new TextDecoder:void 0,R=(a,b,d)=>{var f=b+d;for(d=b;a[d]&&!(d>=f);)++d;if(16<d-b&&a.buffer&&pa)return pa.decode(a.subarray(b,d));for(f="";b<d;){var g=a[b++];if(g&128){var h=a[b++]&63;if(192==(g&224))f+=String.fromCharCode((g&31)<<6|h);else{var k=a[b++]&63;g=224==(g&240)?(g&15)<<12|h<<6|k:(g&7)<<18|h<<12|k<<6|a[b++]&63;65536>g?f+=String.fromCharCode(g):(g-=65536,f+=String.fromCharCode(55296|g>>10,56320|
15
+ g&1023))}}else f+=String.fromCharCode(g)}return f},qa=[0,31,60,91,121,152,182,213,244,274,305,335],ra=[0,31,59,90,120,151,181,212,243,273,304,334],S={},T=0,sa=a=>{E=a;Q||0<T||(c.onExit?.(a),D=!0);w(a,new O(a))},ta=a=>{if(!D)try{if(a(),!(Q||0<T))try{E=a=E,sa(a)}catch(b){b instanceof O||"unwind"==b||w(1,b)}}catch(b){b instanceof O||"unwind"==b||w(1,b)}},ua;ua=()=>performance.now();
16
+ var U=(a,b,d)=>{var f=G;if(!(0<d))return 0;var g=b;d=b+d-1;for(var h=0;h<a.length;++h){var k=a.charCodeAt(h);if(55296<=k&&57343>=k){var l=a.charCodeAt(++h);k=65536+((k&1023)<<10)|l&1023}if(127>=k){if(b>=d)break;f[b++]=k}else{if(2047>=k){if(b+1>=d)break;f[b++]=192|k>>6}else{if(65535>=k){if(b+2>=d)break;f[b++]=224|k>>12}else{if(b+3>=d)break;f[b++]=240|k>>18;f[b++]=128|k>>12&63}f[b++]=128|k>>6&63}f[b++]=128|k&63}}f[b]=0;return b-g},V={},va=()=>{if(!W){var a={USER:"web_user",LOGNAME:"web_user",PATH:"/",
17
+ PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:v||"./this.program"},b;for(b in V)void 0===V[b]?delete a[b]:a[b]=V[b];var d=[];for(b in a)d.push(`${b}=${a[b]}`);W=d}return W},W,wa=[null,[],[]],xa=a=>{for(var b=0,d=0;d<a.length;++d){var f=a.charCodeAt(d);127>=f?b++:2047>=f?b+=2:55296<=f&&57343>=f?(b+=4,++d):b+=3}return b},Aa=(a,b,d,f)=>{var g={string:m=>{var q=0;if(null!==m&&void 0!==m&&0!==m){q=xa(m)+1;var ma=
18
+ X(q);U(m,ma,q);q=ma}return q},array:m=>{var q=X(m.length);F.set(m,q);return q}};a=c["_"+a];var h=[],k=0;if(f)for(var l=0;l<f.length;l++){var u=g[d[l]];u?(0===k&&(k=ya()),h[l]=u(f[l])):h[l]=f[l]}d=a(...h);return d=function(m){0!==k&&za(k);return"string"===b?m?R(G,m):"":"boolean"===b?!!m:m}(d)},Ca={b:(a,b,d,f)=>{M(`Assertion failed: ${a?R(G,a):""}, at: `+[b?b?R(G,b):"":"unknown filename",d,f?f?R(G,f):"":"unknown function"])},q:()=>{M("")},n:()=>{Q=!1;T=0},j:function(a,b,d){a=new Date(1E3*(b+2097152>>>
19
+ 0<4194305-!!a?(a>>>0)+4294967296*b:NaN));H[d>>2]=a.getSeconds();H[d+4>>2]=a.getMinutes();H[d+8>>2]=a.getHours();H[d+12>>2]=a.getDate();H[d+16>>2]=a.getMonth();H[d+20>>2]=a.getFullYear()-1900;H[d+24>>2]=a.getDay();b=a.getFullYear();H[d+28>>2]=(0!==b%4||0===b%100&&0!==b%400?ra:qa)[a.getMonth()]+a.getDate()-1|0;H[d+36>>2]=-(60*a.getTimezoneOffset());b=(new Date(a.getFullYear(),6,1)).getTimezoneOffset();var f=(new Date(a.getFullYear(),0,1)).getTimezoneOffset();H[d+32>>2]=(b!=f&&a.getTimezoneOffset()==
20
+ Math.min(f,b))|0},l:(a,b)=>{S[a]&&(clearTimeout(S[a].id),delete S[a]);if(!b)return 0;var d=setTimeout(()=>{delete S[a];ta(()=>Ba(a,ua()))},b);S[a]={id:d,Qa:b};return 0},o:(a,b,d,f)=>{var g=(new Date).getFullYear(),h=(new Date(g,0,1)).getTimezoneOffset();g=(new Date(g,6,1)).getTimezoneOffset();I[a>>2]=60*Math.max(h,g);H[b>>2]=Number(h!=g);b=k=>{var l=Math.abs(k);return`UTC${0<=k?"-":"+"}${String(Math.floor(l/60)).padStart(2,"0")}${String(l%60).padStart(2,"0")}`};a=b(h);b=b(g);g<h?(U(a,d,17),U(b,f,
21
+ 17)):(U(a,f,17),U(b,d,17))},p:()=>Date.now(),m:a=>{var b=G.length;a>>>=0;if(2147483648<a)return!1;for(var d=1;4>=d;d*=2){var f=b*(1+.2/d);f=Math.min(f,a+100663296);a:{f=(Math.min(2147483648,65536*Math.ceil(Math.max(a,f)/65536))-r.buffer.byteLength+65535)/65536;try{r.grow(f);da();var g=1;break a}catch(h){}g=void 0}if(g)return!0}return!1},f:(a,b)=>{var d=0;va().forEach((f,g)=>{var h=b+d;g=I[a+4*g>>2]=h;for(h=0;h<f.length;++h)F[g++]=f.charCodeAt(h);F[g]=0;d+=f.length+1});return 0},g:(a,b)=>{var d=va();
22
+ I[a>>2]=d.length;var f=0;d.forEach(g=>f+=g.length+1);I[b>>2]=f;return 0},e:()=>52,k:function(){return 70},d:(a,b,d,f)=>{for(var g=0,h=0;h<d;h++){var k=I[b>>2],l=I[b+4>>2];b+=8;for(var u=0;u<l;u++){var m=G[k+u],q=wa[a];0===m||10===m?((1===a?ca:B)(R(q,0)),q.length=0):q.push(m)}g+=l}I[f>>2]=g;return 0},a:r,c:sa,s:function(a,b,d,f,g){return c.callbacks.callFunction(void 0,a,b,d,f,g)},r:function(a){return c.callbacks.shouldInterrupt(void 0,a)},i:function(a,b,d){d=d?R(G,d):"";return c.callbacks.loadModuleSource(void 0,
23
+ a,b,d)},h:function(a,b,d,f){d=d?R(G,d):"";f=f?R(G,f):"";return c.callbacks.normalizeModule(void 0,a,b,d,f)}},Y=function(){function a(d){Y=d.exports;fa.unshift(Y.t);J--;c.monitorRunDependencies?.(J);0==J&&(null!==K&&(clearInterval(K),K=null),L&&(d=L,L=null,d()));return Y}var b={a:Ca};J++;c.monitorRunDependencies?.(J);if(c.instantiateWasm)try{return c.instantiateWasm(b,a)}catch(d){B(`Module.instantiateWasm callback failed with error: ${d}`),n(d)}N||=ja("emscripten-module.wasm")?"emscripten-module.wasm":
24
+ c.locateFile?c.locateFile("emscripten-module.wasm",x):x+"emscripten-module.wasm";oa(b,function(d){a(d.instance)}).catch(n);return{}}();c._malloc=a=>(c._malloc=Y.u)(a);c._QTS_Throw=(a,b)=>(c._QTS_Throw=Y.v)(a,b);c._QTS_NewError=a=>(c._QTS_NewError=Y.w)(a);c._QTS_RuntimeSetMemoryLimit=(a,b)=>(c._QTS_RuntimeSetMemoryLimit=Y.x)(a,b);c._QTS_RuntimeComputeMemoryUsage=(a,b)=>(c._QTS_RuntimeComputeMemoryUsage=Y.y)(a,b);c._QTS_RuntimeDumpMemoryUsage=a=>(c._QTS_RuntimeDumpMemoryUsage=Y.z)(a);
25
+ c._QTS_RecoverableLeakCheck=()=>(c._QTS_RecoverableLeakCheck=Y.A)();c._QTS_BuildIsSanitizeLeak=()=>(c._QTS_BuildIsSanitizeLeak=Y.B)();c._QTS_RuntimeSetMaxStackSize=(a,b)=>(c._QTS_RuntimeSetMaxStackSize=Y.C)(a,b);c._QTS_GetUndefined=()=>(c._QTS_GetUndefined=Y.D)();c._QTS_GetNull=()=>(c._QTS_GetNull=Y.E)();c._QTS_GetFalse=()=>(c._QTS_GetFalse=Y.F)();c._QTS_GetTrue=()=>(c._QTS_GetTrue=Y.G)();c._QTS_NewRuntime=()=>(c._QTS_NewRuntime=Y.H)();c._QTS_FreeRuntime=a=>(c._QTS_FreeRuntime=Y.I)(a);
26
+ c._free=a=>(c._free=Y.J)(a);c._QTS_NewContext=(a,b)=>(c._QTS_NewContext=Y.K)(a,b);c._QTS_FreeContext=a=>(c._QTS_FreeContext=Y.L)(a);c._QTS_FreeValuePointer=(a,b)=>(c._QTS_FreeValuePointer=Y.M)(a,b);c._QTS_FreeValuePointerRuntime=(a,b)=>(c._QTS_FreeValuePointerRuntime=Y.N)(a,b);c._QTS_FreeVoidPointer=(a,b)=>(c._QTS_FreeVoidPointer=Y.O)(a,b);c._QTS_FreeCString=(a,b)=>(c._QTS_FreeCString=Y.P)(a,b);c._QTS_DupValuePointer=(a,b)=>(c._QTS_DupValuePointer=Y.Q)(a,b);c._QTS_NewObject=a=>(c._QTS_NewObject=Y.R)(a);
27
+ c._QTS_NewObjectProto=(a,b)=>(c._QTS_NewObjectProto=Y.S)(a,b);c._QTS_NewArray=a=>(c._QTS_NewArray=Y.T)(a);c._QTS_NewArrayBuffer=(a,b,d)=>(c._QTS_NewArrayBuffer=Y.U)(a,b,d);c._QTS_NewFloat64=(a,b)=>(c._QTS_NewFloat64=Y.V)(a,b);c._QTS_GetFloat64=(a,b)=>(c._QTS_GetFloat64=Y.W)(a,b);c._QTS_NewString=(a,b)=>(c._QTS_NewString=Y.X)(a,b);c._QTS_GetString=(a,b)=>(c._QTS_GetString=Y.Y)(a,b);c._QTS_GetArrayBuffer=(a,b)=>(c._QTS_GetArrayBuffer=Y.Z)(a,b);
28
+ c._QTS_GetArrayBufferLength=(a,b)=>(c._QTS_GetArrayBufferLength=Y._)(a,b);c._QTS_NewSymbol=(a,b,d)=>(c._QTS_NewSymbol=Y.$)(a,b,d);c._QTS_GetSymbolDescriptionOrKey=(a,b)=>(c._QTS_GetSymbolDescriptionOrKey=Y.aa)(a,b);c._QTS_IsGlobalSymbol=(a,b)=>(c._QTS_IsGlobalSymbol=Y.ba)(a,b);c._QTS_IsJobPending=a=>(c._QTS_IsJobPending=Y.ca)(a);c._QTS_ExecutePendingJob=(a,b,d)=>(c._QTS_ExecutePendingJob=Y.da)(a,b,d);c._QTS_GetProp=(a,b,d)=>(c._QTS_GetProp=Y.ea)(a,b,d);
29
+ c._QTS_GetPropNumber=(a,b,d)=>(c._QTS_GetPropNumber=Y.fa)(a,b,d);c._QTS_SetProp=(a,b,d,f)=>(c._QTS_SetProp=Y.ga)(a,b,d,f);c._QTS_DefineProp=(a,b,d,f,g,h,k,l,u)=>(c._QTS_DefineProp=Y.ha)(a,b,d,f,g,h,k,l,u);c._QTS_GetOwnPropertyNames=(a,b,d,f,g)=>(c._QTS_GetOwnPropertyNames=Y.ia)(a,b,d,f,g);c._QTS_Call=(a,b,d,f,g)=>(c._QTS_Call=Y.ja)(a,b,d,f,g);c._QTS_ResolveException=(a,b)=>(c._QTS_ResolveException=Y.ka)(a,b);c._QTS_Dump=(a,b)=>(c._QTS_Dump=Y.la)(a,b);
30
+ c._QTS_Eval=(a,b,d,f,g,h)=>(c._QTS_Eval=Y.ma)(a,b,d,f,g,h);c._QTS_GetModuleNamespace=(a,b)=>(c._QTS_GetModuleNamespace=Y.na)(a,b);c._QTS_Typeof=(a,b)=>(c._QTS_Typeof=Y.oa)(a,b);c._QTS_GetLength=(a,b,d)=>(c._QTS_GetLength=Y.pa)(a,b,d);c._QTS_IsEqual=(a,b,d,f)=>(c._QTS_IsEqual=Y.qa)(a,b,d,f);c._QTS_GetGlobalObject=a=>(c._QTS_GetGlobalObject=Y.ra)(a);c._QTS_NewPromiseCapability=(a,b)=>(c._QTS_NewPromiseCapability=Y.sa)(a,b);c._QTS_PromiseState=(a,b)=>(c._QTS_PromiseState=Y.ta)(a,b);
31
+ c._QTS_PromiseResult=(a,b)=>(c._QTS_PromiseResult=Y.ua)(a,b);c._QTS_TestStringArg=a=>(c._QTS_TestStringArg=Y.va)(a);c._QTS_GetDebugLogEnabled=a=>(c._QTS_GetDebugLogEnabled=Y.wa)(a);c._QTS_SetDebugLogEnabled=(a,b)=>(c._QTS_SetDebugLogEnabled=Y.xa)(a,b);c._QTS_BuildIsDebug=()=>(c._QTS_BuildIsDebug=Y.ya)();c._QTS_BuildIsAsyncify=()=>(c._QTS_BuildIsAsyncify=Y.za)();c._QTS_NewFunction=(a,b,d)=>(c._QTS_NewFunction=Y.Aa)(a,b,d);
32
+ c._QTS_ArgvGetJSValueConstPointer=(a,b)=>(c._QTS_ArgvGetJSValueConstPointer=Y.Ba)(a,b);c._QTS_RuntimeEnableInterruptHandler=a=>(c._QTS_RuntimeEnableInterruptHandler=Y.Ca)(a);c._QTS_RuntimeDisableInterruptHandler=a=>(c._QTS_RuntimeDisableInterruptHandler=Y.Da)(a);c._QTS_RuntimeEnableModuleLoader=(a,b)=>(c._QTS_RuntimeEnableModuleLoader=Y.Ea)(a,b);c._QTS_RuntimeDisableModuleLoader=a=>(c._QTS_RuntimeDisableModuleLoader=Y.Fa)(a);c._QTS_bjson_encode=(a,b)=>(c._QTS_bjson_encode=Y.Ga)(a,b);
33
+ c._QTS_bjson_decode=(a,b)=>(c._QTS_bjson_decode=Y.Ha)(a,b);c._QTS_EvalFunction=(a,b)=>(c._QTS_EvalFunction=Y.Ia)(a,b);c._QTS_EncodeBytecode=(a,b)=>(c._QTS_EncodeBytecode=Y.Ja)(a,b);c._QTS_DecodeBytecode=(a,b)=>(c._QTS_DecodeBytecode=Y.Ka)(a,b);var Ba=(a,b)=>(Ba=Y.Ma)(a,b),za=a=>(za=Y.Na)(a),X=a=>(X=Y.Oa)(a),ya=()=>(ya=Y.Pa)();c.cwrap=(a,b,d,f)=>{var g=!d||d.every(h=>"number"===h||"boolean"===h);return"string"!==b&&g&&!f?c["_"+a]:(...h)=>Aa(a,b,d,h)};c.UTF8ToString=(a,b)=>a?R(G,a,b):"";
34
+ c.stringToUTF8=(a,b,d)=>U(a,b,d);c.lengthBytesUTF8=xa;var Z;L=function Da(){Z||Ea();Z||(L=Da)};
35
+ function Ea(){function a(){if(!Z&&(Z=!0,c.calledRun=!0,!D)){P(fa);e(c);c.onRuntimeInitialized?.();if(c.postRun)for("function"==typeof c.postRun&&(c.postRun=[c.postRun]);c.postRun.length;){var b=c.postRun.shift();ha.unshift(b)}P(ha)}}if(!(0<J)){if(c.preRun)for("function"==typeof c.preRun&&(c.preRun=[c.preRun]);c.preRun.length;)ia();P(ea);0<J||(c.setStatus?(c.setStatus("Running..."),setTimeout(function(){setTimeout(function(){c.setStatus("")},1);a()},1)):a())}}
36
+ if(c.preInit)for("function"==typeof c.preInit&&(c.preInit=[c.preInit]);0<c.preInit.length;)c.preInit.pop()();Ea();moduleRtn=aa;
37
+
38
+
39
+ return moduleRtn;
40
+ }
41
+ );
42
+ })();
43
+ if (typeof exports === 'object' && typeof module === 'object')
44
+ module.exports = QuickJSRaw;
45
+ else if (typeof define === 'function' && define['amd'])
46
+ define([], () => QuickJSRaw);
@@ -0,0 +1,47 @@
1
+
2
+ var QuickJSRaw = (() => {
3
+ var _scriptName = typeof document != 'undefined' ? document.currentScript?.src : undefined;
4
+
5
+ return (
6
+ function(moduleArg = {}) {
7
+ var moduleRtn;
8
+
9
+ var c=moduleArg,f,n,aa=new Promise((a,b)=>{f=a;n=b});function p(a){a={log:a||function(){}};for(const b of p.La)b(a);return c.quickJSEmscriptenExtensions=a}p.La=[];c.quickjsEmscriptenInit=p;p.La.push(a=>{a.getWasmMemory=function(){return r}});var t=Object.assign({},c),u="./this.program",w="",x;"undefined"!=typeof document&&document.currentScript&&(w=document.currentScript.src);_scriptName&&(w=_scriptName);w.startsWith("blob:")?w="":w=w.substr(0,w.replace(/[?#].*/,"").lastIndexOf("/")+1);
10
+ x=a=>fetch(a,{credentials:"same-origin"}).then(b=>b.ok?b.arrayBuffer():Promise.reject(Error(b.status+" : "+b.url)));var ba=c.print||console.log.bind(console),y=c.printErr||console.error.bind(console);Object.assign(c,t);t=null;c.thisProgram&&(u=c.thisProgram);var z=c.wasmBinary,r,A=!1,B,C,D,E,F;
11
+ function G(){var a=r.buffer;c.HEAP8=C=new Int8Array(a);c.HEAP16=new Int16Array(a);c.HEAPU8=D=new Uint8Array(a);c.HEAPU16=new Uint16Array(a);c.HEAP32=E=new Int32Array(a);c.HEAPU32=F=new Uint32Array(a);c.HEAPF32=new Float32Array(a);c.HEAPF64=new Float64Array(a)}c.wasmMemory?r=c.wasmMemory:r=new WebAssembly.Memory({initial:(c.INITIAL_MEMORY||16777216)/65536,maximum:32768});G();var H=[],I=[],J=[];function ca(){var a=c.preRun.shift();H.unshift(a)}var K=0,L=null,M=null;
12
+ function N(a){c.onAbort?.(a);a="Aborted("+a+")";y(a);A=!0;B=1;a=new WebAssembly.RuntimeError(a+". Build with -sASSERTIONS for more info.");n(a);throw a;}var da=a=>a.startsWith("data:application/octet-stream;base64,"),O;function ea(a){if(a==O&&z)return new Uint8Array(z);throw"both async and sync fetching of the wasm failed";}function fa(a){return z?Promise.resolve().then(()=>ea(a)):x(a).then(b=>new Uint8Array(b),()=>ea(a))}
13
+ function ha(a,b,d){return fa(a).then(e=>WebAssembly.instantiate(e,b)).then(d,e=>{y(`failed to asynchronously prepare wasm: ${e}`);N(e)})}function ia(a,b){var d=O;return z||"function"!=typeof WebAssembly.instantiateStreaming||da(d)||"function"!=typeof fetch?ha(d,a,b):fetch(d,{credentials:"same-origin"}).then(e=>WebAssembly.instantiateStreaming(e,a).then(b,function(g){y(`wasm streaming compile failed: ${g}`);y("falling back to ArrayBuffer instantiation");return ha(d,a,b)}))}
14
+ function ja(a){this.name="ExitStatus";this.message=`Program terminated with exit(${a})`;this.status=a}
15
+ var P=a=>{for(;0<a.length;)a.shift()(c)},Q=c.noExitRuntime||!0,ka="undefined"!=typeof TextDecoder?new TextDecoder:void 0,R=(a,b,d)=>{var e=b+d;for(d=b;a[d]&&!(d>=e);)++d;if(16<d-b&&a.buffer&&ka)return ka.decode(a.subarray(b,d));for(e="";b<d;){var g=a[b++];if(g&128){var h=a[b++]&63;if(192==(g&224))e+=String.fromCharCode((g&31)<<6|h);else{var k=a[b++]&63;g=224==(g&240)?(g&15)<<12|h<<6|k:(g&7)<<18|h<<12|k<<6|a[b++]&63;65536>g?e+=String.fromCharCode(g):(g-=65536,e+=String.fromCharCode(55296|g>>10,56320|
16
+ g&1023))}}else e+=String.fromCharCode(g)}return e},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],S={},oa=a=>{if(!(a instanceof ja||"unwind"==a))throw a;},T=0,pa=a=>{B=a;Q||0<T||(c.onExit?.(a),A=!0);throw new ja(a);},qa=a=>{if(!A)try{if(a(),!(Q||0<T))try{B=a=B,pa(a)}catch(b){oa(b)}}catch(b){oa(b)}},ra;ra=()=>performance.now();
17
+ var U=(a,b,d)=>{var e=D;if(!(0<d))return 0;var g=b;d=b+d-1;for(var h=0;h<a.length;++h){var k=a.charCodeAt(h);if(55296<=k&&57343>=k){var l=a.charCodeAt(++h);k=65536+((k&1023)<<10)|l&1023}if(127>=k){if(b>=d)break;e[b++]=k}else{if(2047>=k){if(b+1>=d)break;e[b++]=192|k>>6}else{if(65535>=k){if(b+2>=d)break;e[b++]=224|k>>12}else{if(b+3>=d)break;e[b++]=240|k>>18;e[b++]=128|k>>12&63}e[b++]=128|k>>6&63}e[b++]=128|k&63}}e[b]=0;return b-g},V={},sa=()=>{if(!W){var a={USER:"web_user",LOGNAME:"web_user",PATH:"/",
18
+ PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:u||"./this.program"},b;for(b in V)void 0===V[b]?delete a[b]:a[b]=V[b];var d=[];for(b in a)d.push(`${b}=${a[b]}`);W=d}return W},W,ta=[null,[],[]],ua=a=>{for(var b=0,d=0;d<a.length;++d){var e=a.charCodeAt(d);127>=e?b++:2047>=e?b+=2:55296<=e&&57343>=e?(b+=4,++d):b+=3}return b},xa=(a,b,d,e)=>{var g={string:m=>{var q=0;if(null!==m&&void 0!==m&&0!==m){q=ua(m)+1;var la=
19
+ X(q);U(m,la,q);q=la}return q},array:m=>{var q=X(m.length);C.set(m,q);return q}};a=c["_"+a];var h=[],k=0;if(e)for(var l=0;l<e.length;l++){var v=g[d[l]];v?(0===k&&(k=va()),h[l]=v(e[l])):h[l]=e[l]}d=a(...h);return d=function(m){0!==k&&wa(k);return"string"===b?m?R(D,m):"":"boolean"===b?!!m:m}(d)},za={b:(a,b,d,e)=>{N(`Assertion failed: ${a?R(D,a):""}, at: `+[b?b?R(D,b):"":"unknown filename",d,e?e?R(D,e):"":"unknown function"])},q:()=>{N("")},n:()=>{Q=!1;T=0},j:function(a,b,d){a=new Date(1E3*(b+2097152>>>
20
+ 0<4194305-!!a?(a>>>0)+4294967296*b:NaN));E[d>>2]=a.getSeconds();E[d+4>>2]=a.getMinutes();E[d+8>>2]=a.getHours();E[d+12>>2]=a.getDate();E[d+16>>2]=a.getMonth();E[d+20>>2]=a.getFullYear()-1900;E[d+24>>2]=a.getDay();b=a.getFullYear();E[d+28>>2]=(0!==b%4||0===b%100&&0!==b%400?na:ma)[a.getMonth()]+a.getDate()-1|0;E[d+36>>2]=-(60*a.getTimezoneOffset());b=(new Date(a.getFullYear(),6,1)).getTimezoneOffset();var e=(new Date(a.getFullYear(),0,1)).getTimezoneOffset();E[d+32>>2]=(b!=e&&a.getTimezoneOffset()==
21
+ Math.min(e,b))|0},l:(a,b)=>{S[a]&&(clearTimeout(S[a].id),delete S[a]);if(!b)return 0;var d=setTimeout(()=>{delete S[a];qa(()=>ya(a,ra()))},b);S[a]={id:d,Qa:b};return 0},o:(a,b,d,e)=>{var g=(new Date).getFullYear(),h=(new Date(g,0,1)).getTimezoneOffset();g=(new Date(g,6,1)).getTimezoneOffset();F[a>>2]=60*Math.max(h,g);E[b>>2]=Number(h!=g);b=k=>{var l=Math.abs(k);return`UTC${0<=k?"-":"+"}${String(Math.floor(l/60)).padStart(2,"0")}${String(l%60).padStart(2,"0")}`};a=b(h);b=b(g);g<h?(U(a,d,17),U(b,e,
22
+ 17)):(U(a,e,17),U(b,d,17))},p:()=>Date.now(),m:a=>{var b=D.length;a>>>=0;if(2147483648<a)return!1;for(var d=1;4>=d;d*=2){var e=b*(1+.2/d);e=Math.min(e,a+100663296);a:{e=(Math.min(2147483648,65536*Math.ceil(Math.max(a,e)/65536))-r.buffer.byteLength+65535)/65536;try{r.grow(e);G();var g=1;break a}catch(h){}g=void 0}if(g)return!0}return!1},f:(a,b)=>{var d=0;sa().forEach((e,g)=>{var h=b+d;g=F[a+4*g>>2]=h;for(h=0;h<e.length;++h)C[g++]=e.charCodeAt(h);C[g]=0;d+=e.length+1});return 0},g:(a,b)=>{var d=sa();
23
+ F[a>>2]=d.length;var e=0;d.forEach(g=>e+=g.length+1);F[b>>2]=e;return 0},e:()=>52,k:function(){return 70},d:(a,b,d,e)=>{for(var g=0,h=0;h<d;h++){var k=F[b>>2],l=F[b+4>>2];b+=8;for(var v=0;v<l;v++){var m=D[k+v],q=ta[a];0===m||10===m?((1===a?ba:y)(R(q,0)),q.length=0):q.push(m)}g+=l}F[e>>2]=g;return 0},a:r,c:pa,s:function(a,b,d,e,g){return c.callbacks.callFunction(void 0,a,b,d,e,g)},r:function(a){return c.callbacks.shouldInterrupt(void 0,a)},i:function(a,b,d){d=d?R(D,d):"";return c.callbacks.loadModuleSource(void 0,
24
+ a,b,d)},h:function(a,b,d,e){d=d?R(D,d):"";e=e?R(D,e):"";return c.callbacks.normalizeModule(void 0,a,b,d,e)}},Y=function(){function a(d){Y=d.exports;I.unshift(Y.t);K--;c.monitorRunDependencies?.(K);0==K&&(null!==L&&(clearInterval(L),L=null),M&&(d=M,M=null,d()));return Y}var b={a:za};K++;c.monitorRunDependencies?.(K);if(c.instantiateWasm)try{return c.instantiateWasm(b,a)}catch(d){y(`Module.instantiateWasm callback failed with error: ${d}`),n(d)}O||=da("emscripten-module.wasm")?"emscripten-module.wasm":
25
+ c.locateFile?c.locateFile("emscripten-module.wasm",w):w+"emscripten-module.wasm";ia(b,function(d){a(d.instance)}).catch(n);return{}}();c._malloc=a=>(c._malloc=Y.u)(a);c._QTS_Throw=(a,b)=>(c._QTS_Throw=Y.v)(a,b);c._QTS_NewError=a=>(c._QTS_NewError=Y.w)(a);c._QTS_RuntimeSetMemoryLimit=(a,b)=>(c._QTS_RuntimeSetMemoryLimit=Y.x)(a,b);c._QTS_RuntimeComputeMemoryUsage=(a,b)=>(c._QTS_RuntimeComputeMemoryUsage=Y.y)(a,b);c._QTS_RuntimeDumpMemoryUsage=a=>(c._QTS_RuntimeDumpMemoryUsage=Y.z)(a);
26
+ c._QTS_RecoverableLeakCheck=()=>(c._QTS_RecoverableLeakCheck=Y.A)();c._QTS_BuildIsSanitizeLeak=()=>(c._QTS_BuildIsSanitizeLeak=Y.B)();c._QTS_RuntimeSetMaxStackSize=(a,b)=>(c._QTS_RuntimeSetMaxStackSize=Y.C)(a,b);c._QTS_GetUndefined=()=>(c._QTS_GetUndefined=Y.D)();c._QTS_GetNull=()=>(c._QTS_GetNull=Y.E)();c._QTS_GetFalse=()=>(c._QTS_GetFalse=Y.F)();c._QTS_GetTrue=()=>(c._QTS_GetTrue=Y.G)();c._QTS_NewRuntime=()=>(c._QTS_NewRuntime=Y.H)();c._QTS_FreeRuntime=a=>(c._QTS_FreeRuntime=Y.I)(a);
27
+ c._free=a=>(c._free=Y.J)(a);c._QTS_NewContext=(a,b)=>(c._QTS_NewContext=Y.K)(a,b);c._QTS_FreeContext=a=>(c._QTS_FreeContext=Y.L)(a);c._QTS_FreeValuePointer=(a,b)=>(c._QTS_FreeValuePointer=Y.M)(a,b);c._QTS_FreeValuePointerRuntime=(a,b)=>(c._QTS_FreeValuePointerRuntime=Y.N)(a,b);c._QTS_FreeVoidPointer=(a,b)=>(c._QTS_FreeVoidPointer=Y.O)(a,b);c._QTS_FreeCString=(a,b)=>(c._QTS_FreeCString=Y.P)(a,b);c._QTS_DupValuePointer=(a,b)=>(c._QTS_DupValuePointer=Y.Q)(a,b);c._QTS_NewObject=a=>(c._QTS_NewObject=Y.R)(a);
28
+ c._QTS_NewObjectProto=(a,b)=>(c._QTS_NewObjectProto=Y.S)(a,b);c._QTS_NewArray=a=>(c._QTS_NewArray=Y.T)(a);c._QTS_NewArrayBuffer=(a,b,d)=>(c._QTS_NewArrayBuffer=Y.U)(a,b,d);c._QTS_NewFloat64=(a,b)=>(c._QTS_NewFloat64=Y.V)(a,b);c._QTS_GetFloat64=(a,b)=>(c._QTS_GetFloat64=Y.W)(a,b);c._QTS_NewString=(a,b)=>(c._QTS_NewString=Y.X)(a,b);c._QTS_GetString=(a,b)=>(c._QTS_GetString=Y.Y)(a,b);c._QTS_GetArrayBuffer=(a,b)=>(c._QTS_GetArrayBuffer=Y.Z)(a,b);
29
+ c._QTS_GetArrayBufferLength=(a,b)=>(c._QTS_GetArrayBufferLength=Y._)(a,b);c._QTS_NewSymbol=(a,b,d)=>(c._QTS_NewSymbol=Y.$)(a,b,d);c._QTS_GetSymbolDescriptionOrKey=(a,b)=>(c._QTS_GetSymbolDescriptionOrKey=Y.aa)(a,b);c._QTS_IsGlobalSymbol=(a,b)=>(c._QTS_IsGlobalSymbol=Y.ba)(a,b);c._QTS_IsJobPending=a=>(c._QTS_IsJobPending=Y.ca)(a);c._QTS_ExecutePendingJob=(a,b,d)=>(c._QTS_ExecutePendingJob=Y.da)(a,b,d);c._QTS_GetProp=(a,b,d)=>(c._QTS_GetProp=Y.ea)(a,b,d);
30
+ c._QTS_GetPropNumber=(a,b,d)=>(c._QTS_GetPropNumber=Y.fa)(a,b,d);c._QTS_SetProp=(a,b,d,e)=>(c._QTS_SetProp=Y.ga)(a,b,d,e);c._QTS_DefineProp=(a,b,d,e,g,h,k,l,v)=>(c._QTS_DefineProp=Y.ha)(a,b,d,e,g,h,k,l,v);c._QTS_GetOwnPropertyNames=(a,b,d,e,g)=>(c._QTS_GetOwnPropertyNames=Y.ia)(a,b,d,e,g);c._QTS_Call=(a,b,d,e,g)=>(c._QTS_Call=Y.ja)(a,b,d,e,g);c._QTS_ResolveException=(a,b)=>(c._QTS_ResolveException=Y.ka)(a,b);c._QTS_Dump=(a,b)=>(c._QTS_Dump=Y.la)(a,b);
31
+ c._QTS_Eval=(a,b,d,e,g,h)=>(c._QTS_Eval=Y.ma)(a,b,d,e,g,h);c._QTS_GetModuleNamespace=(a,b)=>(c._QTS_GetModuleNamespace=Y.na)(a,b);c._QTS_Typeof=(a,b)=>(c._QTS_Typeof=Y.oa)(a,b);c._QTS_GetLength=(a,b,d)=>(c._QTS_GetLength=Y.pa)(a,b,d);c._QTS_IsEqual=(a,b,d,e)=>(c._QTS_IsEqual=Y.qa)(a,b,d,e);c._QTS_GetGlobalObject=a=>(c._QTS_GetGlobalObject=Y.ra)(a);c._QTS_NewPromiseCapability=(a,b)=>(c._QTS_NewPromiseCapability=Y.sa)(a,b);c._QTS_PromiseState=(a,b)=>(c._QTS_PromiseState=Y.ta)(a,b);
32
+ c._QTS_PromiseResult=(a,b)=>(c._QTS_PromiseResult=Y.ua)(a,b);c._QTS_TestStringArg=a=>(c._QTS_TestStringArg=Y.va)(a);c._QTS_GetDebugLogEnabled=a=>(c._QTS_GetDebugLogEnabled=Y.wa)(a);c._QTS_SetDebugLogEnabled=(a,b)=>(c._QTS_SetDebugLogEnabled=Y.xa)(a,b);c._QTS_BuildIsDebug=()=>(c._QTS_BuildIsDebug=Y.ya)();c._QTS_BuildIsAsyncify=()=>(c._QTS_BuildIsAsyncify=Y.za)();c._QTS_NewFunction=(a,b,d)=>(c._QTS_NewFunction=Y.Aa)(a,b,d);
33
+ c._QTS_ArgvGetJSValueConstPointer=(a,b)=>(c._QTS_ArgvGetJSValueConstPointer=Y.Ba)(a,b);c._QTS_RuntimeEnableInterruptHandler=a=>(c._QTS_RuntimeEnableInterruptHandler=Y.Ca)(a);c._QTS_RuntimeDisableInterruptHandler=a=>(c._QTS_RuntimeDisableInterruptHandler=Y.Da)(a);c._QTS_RuntimeEnableModuleLoader=(a,b)=>(c._QTS_RuntimeEnableModuleLoader=Y.Ea)(a,b);c._QTS_RuntimeDisableModuleLoader=a=>(c._QTS_RuntimeDisableModuleLoader=Y.Fa)(a);c._QTS_bjson_encode=(a,b)=>(c._QTS_bjson_encode=Y.Ga)(a,b);
34
+ c._QTS_bjson_decode=(a,b)=>(c._QTS_bjson_decode=Y.Ha)(a,b);c._QTS_EvalFunction=(a,b)=>(c._QTS_EvalFunction=Y.Ia)(a,b);c._QTS_EncodeBytecode=(a,b)=>(c._QTS_EncodeBytecode=Y.Ja)(a,b);c._QTS_DecodeBytecode=(a,b)=>(c._QTS_DecodeBytecode=Y.Ka)(a,b);var ya=(a,b)=>(ya=Y.Ma)(a,b),wa=a=>(wa=Y.Na)(a),X=a=>(X=Y.Oa)(a),va=()=>(va=Y.Pa)();c.cwrap=(a,b,d,e)=>{var g=!d||d.every(h=>"number"===h||"boolean"===h);return"string"!==b&&g&&!e?c["_"+a]:(...h)=>xa(a,b,d,h)};c.UTF8ToString=(a,b)=>a?R(D,a,b):"";
35
+ c.stringToUTF8=(a,b,d)=>U(a,b,d);c.lengthBytesUTF8=ua;var Z;M=function Aa(){Z||Ba();Z||(M=Aa)};
36
+ function Ba(){function a(){if(!Z&&(Z=!0,c.calledRun=!0,!A)){P(I);f(c);c.onRuntimeInitialized?.();if(c.postRun)for("function"==typeof c.postRun&&(c.postRun=[c.postRun]);c.postRun.length;){var b=c.postRun.shift();J.unshift(b)}P(J)}}if(!(0<K)){if(c.preRun)for("function"==typeof c.preRun&&(c.preRun=[c.preRun]);c.preRun.length;)ca();P(H);0<K||(c.setStatus?(c.setStatus("Running..."),setTimeout(function(){setTimeout(function(){c.setStatus("")},1);a()},1)):a())}}
37
+ if(c.preInit)for("function"==typeof c.preInit&&(c.preInit=[c.preInit]);0<c.preInit.length;)c.preInit.pop()();Ba();moduleRtn=aa;
38
+
39
+
40
+ return moduleRtn;
41
+ }
42
+ );
43
+ })();
44
+ if (typeof exports === 'object' && typeof module === 'object')
45
+ module.exports = QuickJSRaw;
46
+ else if (typeof define === 'function' && define['amd'])
47
+ define([], () => QuickJSRaw);
@@ -0,0 +1,14 @@
1
+ // Generated from ../../templates/emscripten-module.SYNC.d.ts
2
+ import type {
3
+ EmscriptenModuleLoader,
4
+ QuickJSEmscriptenModule,
5
+ } from "@componentor/quickjs-ffi-types"
6
+ /**
7
+ * Emscripten module built from the unmodified [`quickjs/quickjs.h`](../quickjs/quickjs.h)
8
+ * and our FFI support functions [c/interface.c](../c/interface.c).
9
+ *
10
+ * Note that emscripten modules returned by a `MODULARIZE=1` emscripten build
11
+ * (like this one) load asynchronously.
12
+ */
13
+ declare const ModuleLoader: EmscriptenModuleLoader<QuickJSEmscriptenModule>
14
+ export default ModuleLoader
@@ -0,0 +1,14 @@
1
+ // Generated from ../../templates/emscripten-module.SYNC.d.ts
2
+ import type {
3
+ EmscriptenModuleLoader,
4
+ QuickJSEmscriptenModule,
5
+ } from "@componentor/quickjs-ffi-types"
6
+ /**
7
+ * Emscripten module built from the unmodified [`quickjs/quickjs.h`](../quickjs/quickjs.h)
8
+ * and our FFI support functions [c/interface.c](../c/interface.c).
9
+ *
10
+ * Note that emscripten modules returned by a `MODULARIZE=1` emscripten build
11
+ * (like this one) load asynchronously.
12
+ */
13
+ declare const ModuleLoader: EmscriptenModuleLoader<QuickJSEmscriptenModule>
14
+ export default ModuleLoader
@@ -0,0 +1,47 @@
1
+
2
+ var QuickJSRaw = (() => {
3
+ var _scriptName = import.meta.url;
4
+
5
+ return (
6
+ async function(moduleArg = {}) {
7
+ var moduleRtn;
8
+
9
+ var c=moduleArg,aa,f,ba=new Promise((a,b)=>{aa=a;f=b}),ca="object"==typeof window,n="function"==typeof importScripts,p="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node;if(p){const {createRequire:a}=await import("module");var require=a(import.meta.url)}function r(a){a={log:a||function(){}};for(const b of r.La)b(a);return c.quickJSEmscriptenExtensions=a}r.La=[];c.quickjsEmscriptenInit=r;r.La.push(a=>{a.getWasmMemory=function(){return t}});
10
+ var da=Object.assign({},c),u="./this.program",w=(a,b)=>{throw b;},x="",y,z;
11
+ if(p){var fs=require("fs"),ea=require("path");x=require("url").fileURLToPath(new URL("./",import.meta.url));z=a=>{a=A(a)?new URL(a):ea.normalize(a);return fs.readFileSync(a)};y=a=>{a=A(a)?new URL(a):ea.normalize(a);return new Promise((b,d)=>{fs.readFile(a,void 0,(e,g)=>{e?d(e):b(g.buffer)})})};!c.thisProgram&&1<process.argv.length&&(u=process.argv[1].replace(/\\/g,"/"));process.argv.slice(2);w=(a,b)=>{process.exitCode=a;throw b;}}else if(ca||n)n?x=self.location.href:"undefined"!=typeof document&&
12
+ document.currentScript&&(x=document.currentScript.src),_scriptName&&(x=_scriptName),x.startsWith("blob:")?x="":x=x.substr(0,x.replace(/[?#].*/,"").lastIndexOf("/")+1),n&&(z=a=>{var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";b.send(null);return new Uint8Array(b.response)}),y=a=>A(a)?new Promise((b,d)=>{var e=new XMLHttpRequest;e.open("GET",a,!0);e.responseType="arraybuffer";e.onload=()=>{200==e.status||0==e.status&&e.response?b(e.response):d(e.status)};e.onerror=d;e.send(null)}):
13
+ fetch(a,{credentials:"same-origin"}).then(b=>b.ok?b.arrayBuffer():Promise.reject(Error(b.status+" : "+b.url)));var fa=c.print||console.log.bind(console),B=c.printErr||console.error.bind(console);Object.assign(c,da);da=null;c.thisProgram&&(u=c.thisProgram);var C=c.wasmBinary,t,D=!1,E,F,G,H,I;
14
+ function ha(){var a=t.buffer;c.HEAP8=F=new Int8Array(a);c.HEAP16=new Int16Array(a);c.HEAPU8=G=new Uint8Array(a);c.HEAPU16=new Uint16Array(a);c.HEAP32=H=new Int32Array(a);c.HEAPU32=I=new Uint32Array(a);c.HEAPF32=new Float32Array(a);c.HEAPF64=new Float64Array(a)}c.wasmMemory?t=c.wasmMemory:t=new WebAssembly.Memory({initial:(c.INITIAL_MEMORY||16777216)/65536,maximum:32768});ha();var ia=[],ja=[],ka=[];function la(){var a=c.preRun.shift();ia.unshift(a)}var J=0,K=null,L=null;
15
+ function M(a){c.onAbort?.(a);a="Aborted("+a+")";B(a);D=!0;E=1;a=new WebAssembly.RuntimeError(a+". Build with -sASSERTIONS for more info.");f(a);throw a;}var ma=a=>a.startsWith("data:application/octet-stream;base64,"),A=a=>a.startsWith("file://"),N;function na(a){if(a==N&&C)return new Uint8Array(C);if(z)return z(a);throw"both async and sync fetching of the wasm failed";}function oa(a){return C?Promise.resolve().then(()=>na(a)):y(a).then(b=>new Uint8Array(b),()=>na(a))}
16
+ function pa(a,b,d){return oa(a).then(e=>WebAssembly.instantiate(e,b)).then(d,e=>{B(`failed to asynchronously prepare wasm: ${e}`);M(e)})}function ra(a,b){var d=N;return C||"function"!=typeof WebAssembly.instantiateStreaming||ma(d)||A(d)||p||"function"!=typeof fetch?pa(d,a,b):fetch(d,{credentials:"same-origin"}).then(e=>WebAssembly.instantiateStreaming(e,a).then(b,function(g){B(`wasm streaming compile failed: ${g}`);B("falling back to ArrayBuffer instantiation");return pa(d,a,b)}))}
17
+ function O(a){this.name="ExitStatus";this.message=`Program terminated with exit(${a})`;this.status=a}
18
+ var P=a=>{for(;0<a.length;)a.shift()(c)},Q=c.noExitRuntime||!0,sa="undefined"!=typeof TextDecoder?new TextDecoder:void 0,R=(a,b,d)=>{var e=b+d;for(d=b;a[d]&&!(d>=e);)++d;if(16<d-b&&a.buffer&&sa)return sa.decode(a.subarray(b,d));for(e="";b<d;){var g=a[b++];if(g&128){var h=a[b++]&63;if(192==(g&224))e+=String.fromCharCode((g&31)<<6|h);else{var k=a[b++]&63;g=224==(g&240)?(g&15)<<12|h<<6|k:(g&7)<<18|h<<12|k<<6|a[b++]&63;65536>g?e+=String.fromCharCode(g):(g-=65536,e+=String.fromCharCode(55296|g>>10,56320|
19
+ g&1023))}}else e+=String.fromCharCode(g)}return e},ta=[0,31,60,91,121,152,182,213,244,274,305,335],ua=[0,31,59,90,120,151,181,212,243,273,304,334],S={},T=0,va=a=>{E=a;Q||0<T||(c.onExit?.(a),D=!0);w(a,new O(a))},wa=a=>{if(!D)try{if(a(),!(Q||0<T))try{E=a=E,va(a)}catch(b){b instanceof O||"unwind"==b||w(1,b)}}catch(b){b instanceof O||"unwind"==b||w(1,b)}},xa;xa=()=>performance.now();
20
+ var U=(a,b,d)=>{var e=G;if(!(0<d))return 0;var g=b;d=b+d-1;for(var h=0;h<a.length;++h){var k=a.charCodeAt(h);if(55296<=k&&57343>=k){var l=a.charCodeAt(++h);k=65536+((k&1023)<<10)|l&1023}if(127>=k){if(b>=d)break;e[b++]=k}else{if(2047>=k){if(b+1>=d)break;e[b++]=192|k>>6}else{if(65535>=k){if(b+2>=d)break;e[b++]=224|k>>12}else{if(b+3>=d)break;e[b++]=240|k>>18;e[b++]=128|k>>12&63}e[b++]=128|k>>6&63}e[b++]=128|k&63}}e[b]=0;return b-g},V={},ya=()=>{if(!W){var a={USER:"web_user",LOGNAME:"web_user",PATH:"/",
21
+ PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:u||"./this.program"},b;for(b in V)void 0===V[b]?delete a[b]:a[b]=V[b];var d=[];for(b in a)d.push(`${b}=${a[b]}`);W=d}return W},W,za=[null,[],[]],Aa=a=>{for(var b=0,d=0;d<a.length;++d){var e=a.charCodeAt(d);127>=e?b++:2047>=e?b+=2:55296<=e&&57343>=e?(b+=4,++d):b+=3}return b},Da=(a,b,d,e)=>{var g={string:m=>{var q=0;if(null!==m&&void 0!==m&&0!==m){q=Aa(m)+1;var qa=
22
+ X(q);U(m,qa,q);q=qa}return q},array:m=>{var q=X(m.length);F.set(m,q);return q}};a=c["_"+a];var h=[],k=0;if(e)for(var l=0;l<e.length;l++){var v=g[d[l]];v?(0===k&&(k=Ba()),h[l]=v(e[l])):h[l]=e[l]}d=a(...h);return d=function(m){0!==k&&Ca(k);return"string"===b?m?R(G,m):"":"boolean"===b?!!m:m}(d)},Fa={b:(a,b,d,e)=>{M(`Assertion failed: ${a?R(G,a):""}, at: `+[b?b?R(G,b):"":"unknown filename",d,e?e?R(G,e):"":"unknown function"])},q:()=>{M("")},n:()=>{Q=!1;T=0},j:function(a,b,d){a=new Date(1E3*(b+2097152>>>
23
+ 0<4194305-!!a?(a>>>0)+4294967296*b:NaN));H[d>>2]=a.getSeconds();H[d+4>>2]=a.getMinutes();H[d+8>>2]=a.getHours();H[d+12>>2]=a.getDate();H[d+16>>2]=a.getMonth();H[d+20>>2]=a.getFullYear()-1900;H[d+24>>2]=a.getDay();b=a.getFullYear();H[d+28>>2]=(0!==b%4||0===b%100&&0!==b%400?ua:ta)[a.getMonth()]+a.getDate()-1|0;H[d+36>>2]=-(60*a.getTimezoneOffset());b=(new Date(a.getFullYear(),6,1)).getTimezoneOffset();var e=(new Date(a.getFullYear(),0,1)).getTimezoneOffset();H[d+32>>2]=(b!=e&&a.getTimezoneOffset()==
24
+ Math.min(e,b))|0},l:(a,b)=>{S[a]&&(clearTimeout(S[a].id),delete S[a]);if(!b)return 0;var d=setTimeout(()=>{delete S[a];wa(()=>Ea(a,xa()))},b);S[a]={id:d,Qa:b};return 0},o:(a,b,d,e)=>{var g=(new Date).getFullYear(),h=(new Date(g,0,1)).getTimezoneOffset();g=(new Date(g,6,1)).getTimezoneOffset();I[a>>2]=60*Math.max(h,g);H[b>>2]=Number(h!=g);b=k=>{var l=Math.abs(k);return`UTC${0<=k?"-":"+"}${String(Math.floor(l/60)).padStart(2,"0")}${String(l%60).padStart(2,"0")}`};a=b(h);b=b(g);g<h?(U(a,d,17),U(b,e,
25
+ 17)):(U(a,e,17),U(b,d,17))},p:()=>Date.now(),m:a=>{var b=G.length;a>>>=0;if(2147483648<a)return!1;for(var d=1;4>=d;d*=2){var e=b*(1+.2/d);e=Math.min(e,a+100663296);a:{e=(Math.min(2147483648,65536*Math.ceil(Math.max(a,e)/65536))-t.buffer.byteLength+65535)/65536;try{t.grow(e);ha();var g=1;break a}catch(h){}g=void 0}if(g)return!0}return!1},f:(a,b)=>{var d=0;ya().forEach((e,g)=>{var h=b+d;g=I[a+4*g>>2]=h;for(h=0;h<e.length;++h)F[g++]=e.charCodeAt(h);F[g]=0;d+=e.length+1});return 0},g:(a,b)=>{var d=ya();
26
+ I[a>>2]=d.length;var e=0;d.forEach(g=>e+=g.length+1);I[b>>2]=e;return 0},e:()=>52,k:function(){return 70},d:(a,b,d,e)=>{for(var g=0,h=0;h<d;h++){var k=I[b>>2],l=I[b+4>>2];b+=8;for(var v=0;v<l;v++){var m=G[k+v],q=za[a];0===m||10===m?((1===a?fa:B)(R(q,0)),q.length=0):q.push(m)}g+=l}I[e>>2]=g;return 0},a:t,c:va,s:function(a,b,d,e,g){return c.callbacks.callFunction(void 0,a,b,d,e,g)},r:function(a){return c.callbacks.shouldInterrupt(void 0,a)},i:function(a,b,d){d=d?R(G,d):"";return c.callbacks.loadModuleSource(void 0,
27
+ a,b,d)},h:function(a,b,d,e){d=d?R(G,d):"";e=e?R(G,e):"";return c.callbacks.normalizeModule(void 0,a,b,d,e)}},Y=function(){function a(d){Y=d.exports;ja.unshift(Y.t);J--;c.monitorRunDependencies?.(J);0==J&&(null!==K&&(clearInterval(K),K=null),L&&(d=L,L=null,d()));return Y}var b={a:Fa};J++;c.monitorRunDependencies?.(J);if(c.instantiateWasm)try{return c.instantiateWasm(b,a)}catch(d){B(`Module.instantiateWasm callback failed with error: ${d}`),f(d)}N||=c.locateFile?ma("emscripten-module.wasm")?"emscripten-module.wasm":
28
+ c.locateFile?c.locateFile("emscripten-module.wasm",x):x+"emscripten-module.wasm":(new URL("emscripten-module.wasm",import.meta.url)).href;ra(b,function(d){a(d.instance)}).catch(f);return{}}();c._malloc=a=>(c._malloc=Y.u)(a);c._QTS_Throw=(a,b)=>(c._QTS_Throw=Y.v)(a,b);c._QTS_NewError=a=>(c._QTS_NewError=Y.w)(a);c._QTS_RuntimeSetMemoryLimit=(a,b)=>(c._QTS_RuntimeSetMemoryLimit=Y.x)(a,b);c._QTS_RuntimeComputeMemoryUsage=(a,b)=>(c._QTS_RuntimeComputeMemoryUsage=Y.y)(a,b);
29
+ c._QTS_RuntimeDumpMemoryUsage=a=>(c._QTS_RuntimeDumpMemoryUsage=Y.z)(a);c._QTS_RecoverableLeakCheck=()=>(c._QTS_RecoverableLeakCheck=Y.A)();c._QTS_BuildIsSanitizeLeak=()=>(c._QTS_BuildIsSanitizeLeak=Y.B)();c._QTS_RuntimeSetMaxStackSize=(a,b)=>(c._QTS_RuntimeSetMaxStackSize=Y.C)(a,b);c._QTS_GetUndefined=()=>(c._QTS_GetUndefined=Y.D)();c._QTS_GetNull=()=>(c._QTS_GetNull=Y.E)();c._QTS_GetFalse=()=>(c._QTS_GetFalse=Y.F)();c._QTS_GetTrue=()=>(c._QTS_GetTrue=Y.G)();
30
+ c._QTS_NewRuntime=()=>(c._QTS_NewRuntime=Y.H)();c._QTS_FreeRuntime=a=>(c._QTS_FreeRuntime=Y.I)(a);c._free=a=>(c._free=Y.J)(a);c._QTS_NewContext=(a,b)=>(c._QTS_NewContext=Y.K)(a,b);c._QTS_FreeContext=a=>(c._QTS_FreeContext=Y.L)(a);c._QTS_FreeValuePointer=(a,b)=>(c._QTS_FreeValuePointer=Y.M)(a,b);c._QTS_FreeValuePointerRuntime=(a,b)=>(c._QTS_FreeValuePointerRuntime=Y.N)(a,b);c._QTS_FreeVoidPointer=(a,b)=>(c._QTS_FreeVoidPointer=Y.O)(a,b);c._QTS_FreeCString=(a,b)=>(c._QTS_FreeCString=Y.P)(a,b);
31
+ c._QTS_DupValuePointer=(a,b)=>(c._QTS_DupValuePointer=Y.Q)(a,b);c._QTS_NewObject=a=>(c._QTS_NewObject=Y.R)(a);c._QTS_NewObjectProto=(a,b)=>(c._QTS_NewObjectProto=Y.S)(a,b);c._QTS_NewArray=a=>(c._QTS_NewArray=Y.T)(a);c._QTS_NewArrayBuffer=(a,b,d)=>(c._QTS_NewArrayBuffer=Y.U)(a,b,d);c._QTS_NewFloat64=(a,b)=>(c._QTS_NewFloat64=Y.V)(a,b);c._QTS_GetFloat64=(a,b)=>(c._QTS_GetFloat64=Y.W)(a,b);c._QTS_NewString=(a,b)=>(c._QTS_NewString=Y.X)(a,b);c._QTS_GetString=(a,b)=>(c._QTS_GetString=Y.Y)(a,b);
32
+ c._QTS_GetArrayBuffer=(a,b)=>(c._QTS_GetArrayBuffer=Y.Z)(a,b);c._QTS_GetArrayBufferLength=(a,b)=>(c._QTS_GetArrayBufferLength=Y._)(a,b);c._QTS_NewSymbol=(a,b,d)=>(c._QTS_NewSymbol=Y.$)(a,b,d);c._QTS_GetSymbolDescriptionOrKey=(a,b)=>(c._QTS_GetSymbolDescriptionOrKey=Y.aa)(a,b);c._QTS_IsGlobalSymbol=(a,b)=>(c._QTS_IsGlobalSymbol=Y.ba)(a,b);c._QTS_IsJobPending=a=>(c._QTS_IsJobPending=Y.ca)(a);c._QTS_ExecutePendingJob=(a,b,d)=>(c._QTS_ExecutePendingJob=Y.da)(a,b,d);
33
+ c._QTS_GetProp=(a,b,d)=>(c._QTS_GetProp=Y.ea)(a,b,d);c._QTS_GetPropNumber=(a,b,d)=>(c._QTS_GetPropNumber=Y.fa)(a,b,d);c._QTS_SetProp=(a,b,d,e)=>(c._QTS_SetProp=Y.ga)(a,b,d,e);c._QTS_DefineProp=(a,b,d,e,g,h,k,l,v)=>(c._QTS_DefineProp=Y.ha)(a,b,d,e,g,h,k,l,v);c._QTS_GetOwnPropertyNames=(a,b,d,e,g)=>(c._QTS_GetOwnPropertyNames=Y.ia)(a,b,d,e,g);c._QTS_Call=(a,b,d,e,g)=>(c._QTS_Call=Y.ja)(a,b,d,e,g);c._QTS_ResolveException=(a,b)=>(c._QTS_ResolveException=Y.ka)(a,b);
34
+ c._QTS_Dump=(a,b)=>(c._QTS_Dump=Y.la)(a,b);c._QTS_Eval=(a,b,d,e,g,h)=>(c._QTS_Eval=Y.ma)(a,b,d,e,g,h);c._QTS_GetModuleNamespace=(a,b)=>(c._QTS_GetModuleNamespace=Y.na)(a,b);c._QTS_Typeof=(a,b)=>(c._QTS_Typeof=Y.oa)(a,b);c._QTS_GetLength=(a,b,d)=>(c._QTS_GetLength=Y.pa)(a,b,d);c._QTS_IsEqual=(a,b,d,e)=>(c._QTS_IsEqual=Y.qa)(a,b,d,e);c._QTS_GetGlobalObject=a=>(c._QTS_GetGlobalObject=Y.ra)(a);c._QTS_NewPromiseCapability=(a,b)=>(c._QTS_NewPromiseCapability=Y.sa)(a,b);
35
+ c._QTS_PromiseState=(a,b)=>(c._QTS_PromiseState=Y.ta)(a,b);c._QTS_PromiseResult=(a,b)=>(c._QTS_PromiseResult=Y.ua)(a,b);c._QTS_TestStringArg=a=>(c._QTS_TestStringArg=Y.va)(a);c._QTS_GetDebugLogEnabled=a=>(c._QTS_GetDebugLogEnabled=Y.wa)(a);c._QTS_SetDebugLogEnabled=(a,b)=>(c._QTS_SetDebugLogEnabled=Y.xa)(a,b);c._QTS_BuildIsDebug=()=>(c._QTS_BuildIsDebug=Y.ya)();c._QTS_BuildIsAsyncify=()=>(c._QTS_BuildIsAsyncify=Y.za)();c._QTS_NewFunction=(a,b,d)=>(c._QTS_NewFunction=Y.Aa)(a,b,d);
36
+ c._QTS_ArgvGetJSValueConstPointer=(a,b)=>(c._QTS_ArgvGetJSValueConstPointer=Y.Ba)(a,b);c._QTS_RuntimeEnableInterruptHandler=a=>(c._QTS_RuntimeEnableInterruptHandler=Y.Ca)(a);c._QTS_RuntimeDisableInterruptHandler=a=>(c._QTS_RuntimeDisableInterruptHandler=Y.Da)(a);c._QTS_RuntimeEnableModuleLoader=(a,b)=>(c._QTS_RuntimeEnableModuleLoader=Y.Ea)(a,b);c._QTS_RuntimeDisableModuleLoader=a=>(c._QTS_RuntimeDisableModuleLoader=Y.Fa)(a);c._QTS_bjson_encode=(a,b)=>(c._QTS_bjson_encode=Y.Ga)(a,b);
37
+ c._QTS_bjson_decode=(a,b)=>(c._QTS_bjson_decode=Y.Ha)(a,b);c._QTS_EvalFunction=(a,b)=>(c._QTS_EvalFunction=Y.Ia)(a,b);c._QTS_EncodeBytecode=(a,b)=>(c._QTS_EncodeBytecode=Y.Ja)(a,b);c._QTS_DecodeBytecode=(a,b)=>(c._QTS_DecodeBytecode=Y.Ka)(a,b);var Ea=(a,b)=>(Ea=Y.Ma)(a,b),Ca=a=>(Ca=Y.Na)(a),X=a=>(X=Y.Oa)(a),Ba=()=>(Ba=Y.Pa)();c.cwrap=(a,b,d,e)=>{var g=!d||d.every(h=>"number"===h||"boolean"===h);return"string"!==b&&g&&!e?c["_"+a]:(...h)=>Da(a,b,d,h)};c.UTF8ToString=(a,b)=>a?R(G,a,b):"";
38
+ c.stringToUTF8=(a,b,d)=>U(a,b,d);c.lengthBytesUTF8=Aa;var Z;L=function Ga(){Z||Ha();Z||(L=Ga)};
39
+ function Ha(){function a(){if(!Z&&(Z=!0,c.calledRun=!0,!D)){P(ja);aa(c);c.onRuntimeInitialized?.();if(c.postRun)for("function"==typeof c.postRun&&(c.postRun=[c.postRun]);c.postRun.length;){var b=c.postRun.shift();ka.unshift(b)}P(ka)}}if(!(0<J)){if(c.preRun)for("function"==typeof c.preRun&&(c.preRun=[c.preRun]);c.preRun.length;)la();P(ia);0<J||(c.setStatus?(c.setStatus("Running..."),setTimeout(function(){setTimeout(function(){c.setStatus("")},1);a()},1)):a())}}
40
+ if(c.preInit)for("function"==typeof c.preInit&&(c.preInit=[c.preInit]);0<c.preInit.length;)c.preInit.pop()();Ha();moduleRtn=ba;
41
+
42
+
43
+ return moduleRtn;
44
+ }
45
+ );
46
+ })();
47
+ 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 '@componentor/quickjs-ffi-types';
2
+
3
+ /**
4
+ * Low-level FFI bindings to QuickJS's Emscripten module.
5
+ * See instead {@link QuickJSContext}, the public Javascript interface exposed by this
6
+ * library.
7
+ *
8
+ * @unstable The FFI interface is considered private and may change.
9
+ */
10
+ declare class 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 '@componentor/quickjs-ffi-types';
2
+
3
+ /**
4
+ * Low-level FFI bindings to QuickJS's Emscripten module.
5
+ * See instead {@link QuickJSContext}, the public Javascript interface exposed by this
6
+ * library.
7
+ *
8
+ * @unstable The FFI interface is considered private and may change.
9
+ */
10
+ declare class 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 \"@componentor/quickjs-ffi-types\"\n\n/**\n * Low-level FFI bindings to QuickJS's Emscripten module.\n * See instead {@link QuickJSContext}, the public Javascript interface exposed by this\n * library.\n *\n * @unstable The FFI interface is considered private and may change.\n */\nexport class 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":"wpBAAA,8GAmCO,IAAM,WAAN,KAAiB,CACtB,YAAoBA,QAAiC,CAAjC,YAAAA,QAEpB,KAAS,MAAQ,GAEjB,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w","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 \"@componentor/quickjs-ffi-types\"\n\n/**\n * Low-level FFI bindings to QuickJS's Emscripten module.\n * See instead {@link QuickJSContext}, the public Javascript interface exposed by this\n * library.\n *\n * @unstable The FFI interface is considered private and may change.\n */\nexport class 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,CAAC,QAAQ,CACX,EAEA,8BAAyC,KAAK,OAAO,MACnD,2BACA,SACA,CAAC,CACH,EAEA,6BAAwC,KAAK,OAAO,MAAM,0BAA2B,SAAU,CAAC,CA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kC,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 '@componentor/quickjs-ffi-types';
2
+
3
+ /**
4
+ * ### @componentor/quickjs-wasmfile-release-sync
5
+ *
6
+ * [Docs](https://github.com/componentor/quickjs-emscripten/blob/main/doc/@componentor/quickjs-wasmfile-release-sync/README.md) |
7
+ * Variant with separate .WASM file. Supports browser ESM, NodeJS ESM, and NodeJS CommonJS.
8
+ *
9
+ * | Variable | Setting | Description |
10
+ * | -- | -- | -- |
11
+ * | library | quickjs | The original [bellard/quickjs](https://github.com/bellard/quickjs) library. Version [2024-02-14+36911f0d](https://github.com/bellard/quickjs/commit/36911f0d3ab1a4c190a4d5cbe7c2db225a455389) vendored to quickjs-emscripten on 2024-06-15. |
12
+ * | releaseMode | release | Optimized for performance; use when building/deploying your application. |
13
+ * | syncMode | sync | The default, normal build. Note that both variants support regular async functions. |
14
+ * | emscriptenInclusion | wasm | Has a separate .wasm file. May offer better caching in your browser, and reduces the size of your JS bundle. If you have issues, try a 'singlefile' variant. |
15
+ * | exports | require import browser workerd | Has these package.json export conditions |
16
+ *
17
+ */
18
+ declare const variant: QuickJSSyncVariant;
19
+
20
+ export { variant as default };
@@ -0,0 +1,20 @@
1
+ import { QuickJSSyncVariant } from '@componentor/quickjs-ffi-types';
2
+
3
+ /**
4
+ * ### @componentor/quickjs-wasmfile-release-sync
5
+ *
6
+ * [Docs](https://github.com/componentor/quickjs-emscripten/blob/main/doc/@componentor/quickjs-wasmfile-release-sync/README.md) |
7
+ * Variant with separate .WASM file. Supports browser ESM, NodeJS ESM, and NodeJS CommonJS.
8
+ *
9
+ * | Variable | Setting | Description |
10
+ * | -- | -- | -- |
11
+ * | library | quickjs | The original [bellard/quickjs](https://github.com/bellard/quickjs) library. Version [2024-02-14+36911f0d](https://github.com/bellard/quickjs/commit/36911f0d3ab1a4c190a4d5cbe7c2db225a455389) vendored to quickjs-emscripten on 2024-06-15. |
12
+ * | releaseMode | release | Optimized for performance; use when building/deploying your application. |
13
+ * | syncMode | sync | The default, normal build. Note that both variants support regular async functions. |
14
+ * | emscriptenInclusion | wasm | Has a separate .wasm file. May offer better caching in your browser, and reduces the size of your JS bundle. If you have issues, try a 'singlefile' variant. |
15
+ * | exports | require import browser workerd | Has these package.json export conditions |
16
+ *
17
+ */
18
+ declare const variant: 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-wasmfile-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 \"@componentor/quickjs-ffi-types\"\n\n/**\n * Low-level FFI bindings to QuickJS's Emscripten module.\n * See instead {@link QuickJSContext}, the public Javascript interface exposed by this\n * library.\n *\n * @unstable The FFI interface is considered private and may change.\n */\nexport class 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 \"@componentor/quickjs-ffi-types\"\n\n/**\n * ### @componentor/quickjs-wasmfile-release-sync\n *\n * [Docs](https://github.com/componentor/quickjs-emscripten/blob/main/doc/@componentor/quickjs-wasmfile-release-sync/README.md) |\n * Variant with separate .WASM file. Supports browser ESM, NodeJS ESM, and NodeJS CommonJS.\n *\n * | Variable | Setting | Description |\n * | -- | -- | -- |\n * | library | quickjs | The original [bellard/quickjs](https://github.com/bellard/quickjs) library. Version [2024-02-14+36911f0d](https://github.com/bellard/quickjs/commit/36911f0d3ab1a4c190a4d5cbe7c2db225a455389) vendored to quickjs-emscripten on 2024-06-15. |\n * | releaseMode | release | Optimized for performance; use when building/deploying your application. |\n * | syncMode | sync | The default, normal build. Note that both variants support regular async functions. |\n * | emscriptenInclusion | wasm | Has a separate .wasm file. May offer better caching in your browser, and reduces the size of your JS bundle. If you have issues, try a 'singlefile' variant. |\n * | exports | require import browser workerd | Has these package.json export conditions |\n *\n */\nconst variant: QuickJSSyncVariant = {\n type: \"sync\",\n importFFI: () => import(\"./ffi.js\").then((mod) => mod.QuickJSFFI),\n importModuleLoader: () =>\n import(\"@componentor/quickjs-wasmfile-release-sync/emscripten-module\").then(\n (mod) => mod.default,\n ),\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,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Loader:()=>import("@componentor/quickjs-wasmfile-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 \"@componentor/quickjs-ffi-types\"\n\n/**\n * ### @componentor/quickjs-wasmfile-release-sync\n *\n * [Docs](https://github.com/componentor/quickjs-emscripten/blob/main/doc/@componentor/quickjs-wasmfile-release-sync/README.md) |\n * Variant with separate .WASM file. Supports browser ESM, NodeJS ESM, and NodeJS CommonJS.\n *\n * | Variable | Setting | Description |\n * | -- | -- | -- |\n * | library | quickjs | The original [bellard/quickjs](https://github.com/bellard/quickjs) library. Version [2024-02-14+36911f0d](https://github.com/bellard/quickjs/commit/36911f0d3ab1a4c190a4d5cbe7c2db225a455389) vendored to quickjs-emscripten on 2024-06-15. |\n * | releaseMode | release | Optimized for performance; use when building/deploying your application. |\n * | syncMode | sync | The default, normal build. Note that both variants support regular async functions. |\n * | emscriptenInclusion | wasm | Has a separate .wasm file. May offer better caching in your browser, and reduces the size of your JS bundle. If you have issues, try a 'singlefile' variant. |\n * | exports | require import browser workerd | Has these package.json export conditions |\n *\n */\nconst variant: QuickJSSyncVariant = {\n type: \"sync\",\n importFFI: () => import(\"./ffi.js\").then((mod) => mod.QuickJSFFI),\n importModuleLoader: () =>\n import(\"@componentor/quickjs-wasmfile-release-sync/emscripten-module\").then(\n (mod) => mod.default,\n ),\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,8DAA8D,EAAE,KACpE,KAAQ,IAAI,OACf,CACJ,EAEO,cAAQ","names":[]}
package/package.json ADDED
@@ -0,0 +1,62 @@
1
+ {
2
+ "name": "@componentor/quickjs-wasmfile-release-sync",
3
+ "license": "MIT",
4
+ "version": "0.31.0",
5
+ "description": "Variant of quickjs library: Variant with separate .WASM file. Supports browser ESM, NodeJS ESM, and NodeJS CommonJS.",
6
+ "sideEffects": false,
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/componentor/quickjs-emscripten"
10
+ },
11
+ "author": {
12
+ "name": "Componentor"
13
+ },
14
+ "files": [
15
+ "LICENSE",
16
+ "README.md",
17
+ "dist/**/*",
18
+ "!dist/*.tsbuildinfo"
19
+ ],
20
+ "types": "./dist/index.d.ts",
21
+ "main": "./dist/index.js",
22
+ "module": "./dist/index.mjs",
23
+ "browser": "./dist/index.mjs",
24
+ "exports": {
25
+ ".": {
26
+ "types": "./dist/index.d.ts",
27
+ "import": "./dist/index.mjs",
28
+ "require": "./dist/index.js",
29
+ "default": "./dist/index.js"
30
+ },
31
+ "./package.json": "./package.json",
32
+ "./ffi": {
33
+ "types": "./dist/ffi.d.ts",
34
+ "import": "./dist/ffi.mjs",
35
+ "require": "./dist/ffi.js",
36
+ "default": "./dist/ffi.js"
37
+ },
38
+ "./wasm": "./dist/emscripten-module.wasm",
39
+ "./emscripten-module": {
40
+ "types": "./dist/emscripten-module.browser.d.ts",
41
+ "iife": "./dist/emscripten-module.cjs",
42
+ "workerd": "./dist/emscripten-module.cloudflare.cjs",
43
+ "browser": "./dist/emscripten-module.browser.mjs",
44
+ "import": "./dist/emscripten-module.mjs",
45
+ "require": "./dist/emscripten-module.cjs",
46
+ "default": "./dist/emscripten-module.cjs"
47
+ }
48
+ },
49
+ "dependencies": {
50
+ "@componentor/quickjs-ffi-types": "0.31.0"
51
+ },
52
+ "devDependencies": {
53
+ "@jitl/tsconfig": "0.31.0"
54
+ },
55
+ "scripts": {
56
+ "build": "pnpm run build:c && pnpm run build:ts",
57
+ "build:c": "make",
58
+ "build:ts": "npx tsup",
59
+ "check:types": "npx tsc --project . --noEmit",
60
+ "clean": "make clean"
61
+ }
62
+ }