@componentor/quickjs-emscripten 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 +21 -0
- package/README.md +925 -0
- package/dist/chunk-IBGVJUFE.mjs +2 -0
- package/dist/chunk-IBGVJUFE.mjs.map +1 -0
- package/dist/index.d.mts +57 -0
- package/dist/index.d.ts +57 -0
- package/dist/index.global.js +6 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +2 -0
- package/dist/index.mjs.map +1 -0
- package/dist/variants.d.mts +39 -0
- package/dist/variants.d.ts +39 -0
- package/dist/variants.js +2 -0
- package/dist/variants.js.map +1 -0
- package/dist/variants.mjs +2 -0
- package/dist/variants.mjs.map +1 -0
- package/package.json +81 -0
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 __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},__reExport=(target,mod,secondTarget)=>(__copyProps(target,mod,"default"),secondTarget&&__copyProps(secondTarget,mod,"default")),__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 index_exports={};__export(index_exports,{DEBUG_ASYNC:()=>import_quickjs_wasmfile_debug_asyncify.default,DEBUG_SYNC:()=>import_quickjs_wasmfile_debug_sync.default,RELEASE_ASYNC:()=>import_quickjs_wasmfile_release_asyncify.default,RELEASE_SYNC:()=>import_quickjs_wasmfile_release_sync.default,getQuickJS:()=>getQuickJS,getQuickJSSync:()=>getQuickJSSync,newAsyncContext:()=>newAsyncContext,newAsyncRuntime:()=>newAsyncRuntime,newQuickJSAsyncWASMModule:()=>newQuickJSAsyncWASMModule,newQuickJSWASMModule:()=>newQuickJSWASMModule});module.exports=__toCommonJS(index_exports);__reExport(index_exports,require("@componentor/quickjs-emscripten-core"),module.exports);var import_quickjs_emscripten_core=require("@componentor/quickjs-emscripten-core"),import_quickjs_wasmfile_debug_sync=__toESM(require("@componentor/quickjs-wasmfile-debug-sync")),import_quickjs_wasmfile_release_sync=__toESM(require("@componentor/quickjs-wasmfile-release-sync")),import_quickjs_wasmfile_debug_asyncify=__toESM(require("@componentor/quickjs-wasmfile-debug-asyncify")),import_quickjs_wasmfile_release_asyncify=__toESM(require("@componentor/quickjs-wasmfile-release-asyncify"));async function newQuickJSWASMModule(variantOrPromise=import_quickjs_wasmfile_release_sync.default){return(0,import_quickjs_emscripten_core.newQuickJSWASMModuleFromVariant)(variantOrPromise)}async function newQuickJSAsyncWASMModule(variantOrPromise=import_quickjs_wasmfile_release_asyncify.default){return(0,import_quickjs_emscripten_core.newQuickJSAsyncWASMModuleFromVariant)(variantOrPromise)}var singleton,singletonPromise;async function getQuickJS(){return singletonPromise??(singletonPromise=newQuickJSWASMModule().then(instance=>(singleton=instance,instance))),await singletonPromise}function getQuickJSSync(){if(!singleton)throw new Error("QuickJS not initialized. Await getQuickJS() at least once.");return singleton}async function newAsyncRuntime(options){return(await newQuickJSAsyncWASMModule()).newRuntime(options)}async function newAsyncContext(options){return(await newQuickJSAsyncWASMModule()).newContext(options)}0&&(module.exports={DEBUG_ASYNC,DEBUG_SYNC,RELEASE_ASYNC,RELEASE_SYNC,getQuickJS,getQuickJSSync,newAsyncContext,newAsyncRuntime,newQuickJSAsyncWASMModule,newQuickJSWASMModule,...require("@componentor/quickjs-emscripten-core")});
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/variants.ts","../src/mod.ts"],"sourcesContent":["export * from \"@componentor/quickjs-emscripten-core\"\nexport * from \"#variants\"\nexport * from \"./mod.js\"\n","import type {\n QuickJSSyncVariant,\n QuickJSAsyncVariant,\n QuickJSWASMModule,\n QuickJSAsyncWASMModule,\n PromisedDefault,\n} from \"@componentor/quickjs-emscripten-core\"\nimport {\n newQuickJSWASMModuleFromVariant,\n newQuickJSAsyncWASMModuleFromVariant,\n} from \"@componentor/quickjs-emscripten-core\"\nimport DEBUG_SYNC from \"@componentor/quickjs-wasmfile-debug-sync\"\nimport RELEASE_SYNC from \"@componentor/quickjs-wasmfile-release-sync\"\nimport DEBUG_ASYNC from \"@componentor/quickjs-wasmfile-debug-asyncify\"\nimport RELEASE_ASYNC from \"@componentor/quickjs-wasmfile-release-asyncify\"\n\n/**\n * Create a new, completely isolated WebAssembly module containing the QuickJS library.\n * See the documentation on {@link QuickJSWASMModule}.\n *\n * Note that there is a hard limit on the number of WebAssembly modules in older\n * versions of v8:\n * https://bugs.chromium.org/p/v8/issues/detail?id=12076\n */\nexport async function newQuickJSWASMModule(\n /**\n * Optionally, pass a {@link QuickJSSyncVariant} to construct a different WebAssembly module.\n */\n variantOrPromise: PromisedDefault<QuickJSSyncVariant> = RELEASE_SYNC,\n): Promise<QuickJSWASMModule> {\n return newQuickJSWASMModuleFromVariant(variantOrPromise)\n}\n\n/**\n * Create a new, completely isolated WebAssembly module containing a version of the QuickJS library\n * compiled with Emscripten's [ASYNCIFY](https://emscripten.org/docs/porting/asyncify.html) transform.\n *\n * This version of the library offers features that enable synchronous code\n * inside the VM to interact with asynchronous code in the host environment.\n * See the documentation on {@link QuickJSAsyncWASMModule}, {@link QuickJSAsyncRuntime},\n * and {@link QuickJSAsyncContext}.\n *\n * Note that there is a hard limit on the number of WebAssembly modules in older\n * versions of v8:\n * https://bugs.chromium.org/p/v8/issues/detail?id=12076\n */\nexport async function newQuickJSAsyncWASMModule(\n /**\n * Optionally, pass a {@link QuickJSAsyncVariant} to construct a different WebAssembly module.\n */\n variantOrPromise: PromisedDefault<QuickJSAsyncVariant> = RELEASE_ASYNC,\n): Promise<QuickJSAsyncWASMModule> {\n return newQuickJSAsyncWASMModuleFromVariant(variantOrPromise)\n}\n\nexport { DEBUG_SYNC, RELEASE_SYNC, DEBUG_ASYNC, RELEASE_ASYNC }\n","import type {\n AsyncRuntimeOptions,\n ContextOptions,\n QuickJSAsyncContext,\n QuickJSAsyncRuntime,\n QuickJSWASMModule,\n} from \"@componentor/quickjs-emscripten-core\"\nimport { newQuickJSAsyncWASMModule, newQuickJSWASMModule } from \"#variants\"\n\nlet singleton: QuickJSWASMModule | undefined = undefined\nlet singletonPromise: Promise<QuickJSWASMModule> | undefined = undefined\n\n/**\n * Get a shared singleton {@link QuickJSWASMModule}. Use this to evaluate code\n * or create Javascript environments.\n *\n * This is the top-level entrypoint for the quickjs-emscripten library.\n *\n * If you need strictest possible isolation guarantees, you may create a\n * separate {@link QuickJSWASMModule} via {@link newQuickJSWASMModule}.\n *\n * To work with the asyncified version of this library, see these functions:\n *\n * - {@link newAsyncRuntime}.\n * - {@link newAsyncContext}.\n * - {@link newQuickJSAsyncWASMModule}.\n */\nexport async function getQuickJS(): Promise<QuickJSWASMModule> {\n singletonPromise ??= newQuickJSWASMModule().then((instance) => {\n singleton = instance\n return instance\n })\n return await singletonPromise\n}\n\n/**\n * Provides synchronous access to the shared {@link QuickJSWASMModule} instance returned by {@link getQuickJS}, as long as\n * least once.\n * @throws If called before `getQuickJS` resolves.\n */\nexport function getQuickJSSync(): QuickJSWASMModule {\n if (!singleton) {\n throw new Error(\"QuickJS not initialized. Await getQuickJS() at least once.\")\n }\n return singleton\n}\n\n/**\n * Create a new {@link QuickJSAsyncRuntime} in a separate WebAssembly module.\n *\n * Each runtime is isolated in a separate WebAssembly module, so that errors in\n * one runtime cannot contaminate another runtime, and each runtime can execute\n * an asynchronous action without conflicts.\n *\n * Note that there is a hard limit on the number of WebAssembly modules in older\n * versions of v8:\n * https://bugs.chromium.org/p/v8/issues/detail?id=12076\n */\nexport async function newAsyncRuntime(options?: AsyncRuntimeOptions): Promise<QuickJSAsyncRuntime> {\n const module = await newQuickJSAsyncWASMModule()\n return module.newRuntime(options)\n}\n\n/**\n * Create a new {@link QuickJSAsyncContext} (with an associated runtime) in an\n * separate WebAssembly module.\n *\n * Each context is isolated in a separate WebAssembly module, so that errors in\n * one runtime cannot contaminate another runtime, and each runtime can execute\n * an asynchronous action without conflicts.\n *\n * Note that there is a hard limit on the number of WebAssembly modules in older\n * versions of v8:\n * https://bugs.chromium.org/p/v8/issues/detail?id=12076\n */\nexport async function newAsyncContext(options?: ContextOptions): Promise<QuickJSAsyncContext> {\n const module = await newQuickJSAsyncWASMModule()\n return module.newContext(options)\n}\n"],"mappings":"qhCAAA,oGAAAA,QAAA,kDAAAC,QAAA,2DAAAC,QAAA,sDAAAC,QAAA,gTAAc,gDAAd,gBCOA,mCAGO,gDACP,mCAAuB,6DACvB,qCAAyB,+DACzB,uCAAwB,iEACxB,yCAA0B,mEAU1B,eAAsB,qBAIpB,iBAAwD,qCAAAC,QAC5B,CAC5B,SAAO,gEAAgC,gBAAgB,CACzD,CAeA,eAAsB,0BAIpB,iBAAyD,yCAAAC,QACxB,CACjC,SAAO,qEAAqC,gBAAgB,CAC9D,CC5CA,IAAI,UACA,iBAiBJ,eAAsB,YAAyC,CAC7D,2CAAqB,qBAAqB,EAAE,KAAM,WAChD,UAAY,SACL,SACR,GACM,MAAM,gBACf,CAOO,SAAS,gBAAoC,CAClD,GAAI,CAAC,UACH,MAAM,IAAI,MAAM,4DAA4D,EAE9E,OAAO,SACT,CAaA,eAAsB,gBAAgB,QAA6D,CAEjG,OADe,MAAM,0BAA0B,GACjC,WAAW,OAAO,CAClC,CAcA,eAAsB,gBAAgB,QAAwD,CAE5F,OADe,MAAM,0BAA0B,GACjC,WAAW,OAAO,CAClC","names":["DEBUG_ASYNC","DEBUG_SYNC","RELEASE_ASYNC","RELEASE_SYNC","RELEASE_SYNC","RELEASE_ASYNC"]}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{DEBUG_ASYNC,DEBUG_SYNC,RELEASE_ASYNC,RELEASE_SYNC,newQuickJSAsyncWASMModule,newQuickJSWASMModule}from"./chunk-IBGVJUFE.mjs";export*from"@componentor/quickjs-emscripten-core";var singleton,singletonPromise;async function getQuickJS(){return singletonPromise??(singletonPromise=newQuickJSWASMModule().then(instance=>(singleton=instance,instance))),await singletonPromise}function getQuickJSSync(){if(!singleton)throw new Error("QuickJS not initialized. Await getQuickJS() at least once.");return singleton}async function newAsyncRuntime(options){return(await newQuickJSAsyncWASMModule()).newRuntime(options)}async function newAsyncContext(options){return(await newQuickJSAsyncWASMModule()).newContext(options)}export{DEBUG_ASYNC,DEBUG_SYNC,RELEASE_ASYNC,RELEASE_SYNC,getQuickJS,getQuickJSSync,newAsyncContext,newAsyncRuntime,newQuickJSAsyncWASMModule,newQuickJSWASMModule};
|
|
2
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/mod.ts"],"sourcesContent":["export * from \"@componentor/quickjs-emscripten-core\"\nexport * from \"#variants\"\nexport * from \"./mod.js\"\n","import type {\n AsyncRuntimeOptions,\n ContextOptions,\n QuickJSAsyncContext,\n QuickJSAsyncRuntime,\n QuickJSWASMModule,\n} from \"@componentor/quickjs-emscripten-core\"\nimport { newQuickJSAsyncWASMModule, newQuickJSWASMModule } from \"#variants\"\n\nlet singleton: QuickJSWASMModule | undefined = undefined\nlet singletonPromise: Promise<QuickJSWASMModule> | undefined = undefined\n\n/**\n * Get a shared singleton {@link QuickJSWASMModule}. Use this to evaluate code\n * or create Javascript environments.\n *\n * This is the top-level entrypoint for the quickjs-emscripten library.\n *\n * If you need strictest possible isolation guarantees, you may create a\n * separate {@link QuickJSWASMModule} via {@link newQuickJSWASMModule}.\n *\n * To work with the asyncified version of this library, see these functions:\n *\n * - {@link newAsyncRuntime}.\n * - {@link newAsyncContext}.\n * - {@link newQuickJSAsyncWASMModule}.\n */\nexport async function getQuickJS(): Promise<QuickJSWASMModule> {\n singletonPromise ??= newQuickJSWASMModule().then((instance) => {\n singleton = instance\n return instance\n })\n return await singletonPromise\n}\n\n/**\n * Provides synchronous access to the shared {@link QuickJSWASMModule} instance returned by {@link getQuickJS}, as long as\n * least once.\n * @throws If called before `getQuickJS` resolves.\n */\nexport function getQuickJSSync(): QuickJSWASMModule {\n if (!singleton) {\n throw new Error(\"QuickJS not initialized. Await getQuickJS() at least once.\")\n }\n return singleton\n}\n\n/**\n * Create a new {@link QuickJSAsyncRuntime} in a separate WebAssembly module.\n *\n * Each runtime is isolated in a separate WebAssembly module, so that errors in\n * one runtime cannot contaminate another runtime, and each runtime can execute\n * an asynchronous action without conflicts.\n *\n * Note that there is a hard limit on the number of WebAssembly modules in older\n * versions of v8:\n * https://bugs.chromium.org/p/v8/issues/detail?id=12076\n */\nexport async function newAsyncRuntime(options?: AsyncRuntimeOptions): Promise<QuickJSAsyncRuntime> {\n const module = await newQuickJSAsyncWASMModule()\n return module.newRuntime(options)\n}\n\n/**\n * Create a new {@link QuickJSAsyncContext} (with an associated runtime) in an\n * separate WebAssembly module.\n *\n * Each context is isolated in a separate WebAssembly module, so that errors in\n * one runtime cannot contaminate another runtime, and each runtime can execute\n * an asynchronous action without conflicts.\n *\n * Note that there is a hard limit on the number of WebAssembly modules in older\n * versions of v8:\n * https://bugs.chromium.org/p/v8/issues/detail?id=12076\n */\nexport async function newAsyncContext(options?: ContextOptions): Promise<QuickJSAsyncContext> {\n const module = await newQuickJSAsyncWASMModule()\n return module.newContext(options)\n}\n"],"mappings":"mIAAA,WAAc,uCCSd,IAAI,UACA,iBAiBJ,eAAsB,YAAyC,CAC7D,2CAAqB,qBAAqB,EAAE,KAAM,WAChD,UAAY,SACL,SACR,GACM,MAAM,gBACf,CAOO,SAAS,gBAAoC,CAClD,GAAI,CAAC,UACH,MAAM,IAAI,MAAM,4DAA4D,EAE9E,OAAO,SACT,CAaA,eAAsB,gBAAgB,QAA6D,CAEjG,OADe,MAAM,0BAA0B,GACjC,WAAW,OAAO,CAClC,CAcA,eAAsB,gBAAgB,QAAwD,CAE5F,OADe,MAAM,0BAA0B,GACjC,WAAW,OAAO,CAClC","names":[]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { PromisedDefault, QuickJSSyncVariant, QuickJSWASMModule, QuickJSAsyncVariant, QuickJSAsyncWASMModule } from '@componentor/quickjs-emscripten-core';
|
|
2
|
+
export { default as DEBUG_SYNC } from '@componentor/quickjs-wasmfile-debug-sync';
|
|
3
|
+
export { default as RELEASE_SYNC } from '@componentor/quickjs-wasmfile-release-sync';
|
|
4
|
+
export { default as DEBUG_ASYNC } from '@componentor/quickjs-wasmfile-debug-asyncify';
|
|
5
|
+
export { default as RELEASE_ASYNC } from '@componentor/quickjs-wasmfile-release-asyncify';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Create a new, completely isolated WebAssembly module containing the QuickJS library.
|
|
9
|
+
* See the documentation on {@link QuickJSWASMModule}.
|
|
10
|
+
*
|
|
11
|
+
* Note that there is a hard limit on the number of WebAssembly modules in older
|
|
12
|
+
* versions of v8:
|
|
13
|
+
* https://bugs.chromium.org/p/v8/issues/detail?id=12076
|
|
14
|
+
*/
|
|
15
|
+
declare function newQuickJSWASMModule(
|
|
16
|
+
/**
|
|
17
|
+
* Optionally, pass a {@link QuickJSSyncVariant} to construct a different WebAssembly module.
|
|
18
|
+
*/
|
|
19
|
+
variantOrPromise?: PromisedDefault<QuickJSSyncVariant>): Promise<QuickJSWASMModule>;
|
|
20
|
+
/**
|
|
21
|
+
* Create a new, completely isolated WebAssembly module containing a version of the QuickJS library
|
|
22
|
+
* compiled with Emscripten's [ASYNCIFY](https://emscripten.org/docs/porting/asyncify.html) transform.
|
|
23
|
+
*
|
|
24
|
+
* This version of the library offers features that enable synchronous code
|
|
25
|
+
* inside the VM to interact with asynchronous code in the host environment.
|
|
26
|
+
* See the documentation on {@link QuickJSAsyncWASMModule}, {@link QuickJSAsyncRuntime},
|
|
27
|
+
* and {@link QuickJSAsyncContext}.
|
|
28
|
+
*
|
|
29
|
+
* Note that there is a hard limit on the number of WebAssembly modules in older
|
|
30
|
+
* versions of v8:
|
|
31
|
+
* https://bugs.chromium.org/p/v8/issues/detail?id=12076
|
|
32
|
+
*/
|
|
33
|
+
declare function newQuickJSAsyncWASMModule(
|
|
34
|
+
/**
|
|
35
|
+
* Optionally, pass a {@link QuickJSAsyncVariant} to construct a different WebAssembly module.
|
|
36
|
+
*/
|
|
37
|
+
variantOrPromise?: PromisedDefault<QuickJSAsyncVariant>): Promise<QuickJSAsyncWASMModule>;
|
|
38
|
+
|
|
39
|
+
export { newQuickJSAsyncWASMModule, newQuickJSWASMModule };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { PromisedDefault, QuickJSSyncVariant, QuickJSWASMModule, QuickJSAsyncVariant, QuickJSAsyncWASMModule } from '@componentor/quickjs-emscripten-core';
|
|
2
|
+
export { default as DEBUG_SYNC } from '@componentor/quickjs-wasmfile-debug-sync';
|
|
3
|
+
export { default as RELEASE_SYNC } from '@componentor/quickjs-wasmfile-release-sync';
|
|
4
|
+
export { default as DEBUG_ASYNC } from '@componentor/quickjs-wasmfile-debug-asyncify';
|
|
5
|
+
export { default as RELEASE_ASYNC } from '@componentor/quickjs-wasmfile-release-asyncify';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Create a new, completely isolated WebAssembly module containing the QuickJS library.
|
|
9
|
+
* See the documentation on {@link QuickJSWASMModule}.
|
|
10
|
+
*
|
|
11
|
+
* Note that there is a hard limit on the number of WebAssembly modules in older
|
|
12
|
+
* versions of v8:
|
|
13
|
+
* https://bugs.chromium.org/p/v8/issues/detail?id=12076
|
|
14
|
+
*/
|
|
15
|
+
declare function newQuickJSWASMModule(
|
|
16
|
+
/**
|
|
17
|
+
* Optionally, pass a {@link QuickJSSyncVariant} to construct a different WebAssembly module.
|
|
18
|
+
*/
|
|
19
|
+
variantOrPromise?: PromisedDefault<QuickJSSyncVariant>): Promise<QuickJSWASMModule>;
|
|
20
|
+
/**
|
|
21
|
+
* Create a new, completely isolated WebAssembly module containing a version of the QuickJS library
|
|
22
|
+
* compiled with Emscripten's [ASYNCIFY](https://emscripten.org/docs/porting/asyncify.html) transform.
|
|
23
|
+
*
|
|
24
|
+
* This version of the library offers features that enable synchronous code
|
|
25
|
+
* inside the VM to interact with asynchronous code in the host environment.
|
|
26
|
+
* See the documentation on {@link QuickJSAsyncWASMModule}, {@link QuickJSAsyncRuntime},
|
|
27
|
+
* and {@link QuickJSAsyncContext}.
|
|
28
|
+
*
|
|
29
|
+
* Note that there is a hard limit on the number of WebAssembly modules in older
|
|
30
|
+
* versions of v8:
|
|
31
|
+
* https://bugs.chromium.org/p/v8/issues/detail?id=12076
|
|
32
|
+
*/
|
|
33
|
+
declare function newQuickJSAsyncWASMModule(
|
|
34
|
+
/**
|
|
35
|
+
* Optionally, pass a {@link QuickJSAsyncVariant} to construct a different WebAssembly module.
|
|
36
|
+
*/
|
|
37
|
+
variantOrPromise?: PromisedDefault<QuickJSAsyncVariant>): Promise<QuickJSAsyncWASMModule>;
|
|
38
|
+
|
|
39
|
+
export { newQuickJSAsyncWASMModule, newQuickJSWASMModule };
|
package/dist/variants.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 __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 variants_exports={};__export(variants_exports,{DEBUG_ASYNC:()=>import_quickjs_wasmfile_debug_asyncify.default,DEBUG_SYNC:()=>import_quickjs_wasmfile_debug_sync.default,RELEASE_ASYNC:()=>import_quickjs_wasmfile_release_asyncify.default,RELEASE_SYNC:()=>import_quickjs_wasmfile_release_sync.default,newQuickJSAsyncWASMModule:()=>newQuickJSAsyncWASMModule,newQuickJSWASMModule:()=>newQuickJSWASMModule});module.exports=__toCommonJS(variants_exports);var import_quickjs_emscripten_core=require("@componentor/quickjs-emscripten-core"),import_quickjs_wasmfile_debug_sync=__toESM(require("@componentor/quickjs-wasmfile-debug-sync")),import_quickjs_wasmfile_release_sync=__toESM(require("@componentor/quickjs-wasmfile-release-sync")),import_quickjs_wasmfile_debug_asyncify=__toESM(require("@componentor/quickjs-wasmfile-debug-asyncify")),import_quickjs_wasmfile_release_asyncify=__toESM(require("@componentor/quickjs-wasmfile-release-asyncify"));async function newQuickJSWASMModule(variantOrPromise=import_quickjs_wasmfile_release_sync.default){return(0,import_quickjs_emscripten_core.newQuickJSWASMModuleFromVariant)(variantOrPromise)}async function newQuickJSAsyncWASMModule(variantOrPromise=import_quickjs_wasmfile_release_asyncify.default){return(0,import_quickjs_emscripten_core.newQuickJSAsyncWASMModuleFromVariant)(variantOrPromise)}0&&(module.exports={DEBUG_ASYNC,DEBUG_SYNC,RELEASE_ASYNC,RELEASE_SYNC,newQuickJSAsyncWASMModule,newQuickJSWASMModule});
|
|
2
|
+
//# sourceMappingURL=variants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/variants.ts"],"sourcesContent":["import type {\n QuickJSSyncVariant,\n QuickJSAsyncVariant,\n QuickJSWASMModule,\n QuickJSAsyncWASMModule,\n PromisedDefault,\n} from \"@componentor/quickjs-emscripten-core\"\nimport {\n newQuickJSWASMModuleFromVariant,\n newQuickJSAsyncWASMModuleFromVariant,\n} from \"@componentor/quickjs-emscripten-core\"\nimport DEBUG_SYNC from \"@componentor/quickjs-wasmfile-debug-sync\"\nimport RELEASE_SYNC from \"@componentor/quickjs-wasmfile-release-sync\"\nimport DEBUG_ASYNC from \"@componentor/quickjs-wasmfile-debug-asyncify\"\nimport RELEASE_ASYNC from \"@componentor/quickjs-wasmfile-release-asyncify\"\n\n/**\n * Create a new, completely isolated WebAssembly module containing the QuickJS library.\n * See the documentation on {@link QuickJSWASMModule}.\n *\n * Note that there is a hard limit on the number of WebAssembly modules in older\n * versions of v8:\n * https://bugs.chromium.org/p/v8/issues/detail?id=12076\n */\nexport async function newQuickJSWASMModule(\n /**\n * Optionally, pass a {@link QuickJSSyncVariant} to construct a different WebAssembly module.\n */\n variantOrPromise: PromisedDefault<QuickJSSyncVariant> = RELEASE_SYNC,\n): Promise<QuickJSWASMModule> {\n return newQuickJSWASMModuleFromVariant(variantOrPromise)\n}\n\n/**\n * Create a new, completely isolated WebAssembly module containing a version of the QuickJS library\n * compiled with Emscripten's [ASYNCIFY](https://emscripten.org/docs/porting/asyncify.html) transform.\n *\n * This version of the library offers features that enable synchronous code\n * inside the VM to interact with asynchronous code in the host environment.\n * See the documentation on {@link QuickJSAsyncWASMModule}, {@link QuickJSAsyncRuntime},\n * and {@link QuickJSAsyncContext}.\n *\n * Note that there is a hard limit on the number of WebAssembly modules in older\n * versions of v8:\n * https://bugs.chromium.org/p/v8/issues/detail?id=12076\n */\nexport async function newQuickJSAsyncWASMModule(\n /**\n * Optionally, pass a {@link QuickJSAsyncVariant} to construct a different WebAssembly module.\n */\n variantOrPromise: PromisedDefault<QuickJSAsyncVariant> = RELEASE_ASYNC,\n): Promise<QuickJSAsyncWASMModule> {\n return newQuickJSAsyncWASMModuleFromVariant(variantOrPromise)\n}\n\nexport { DEBUG_SYNC, RELEASE_SYNC, DEBUG_ASYNC, RELEASE_ASYNC }\n"],"mappings":"y5BAAA,0GAAAA,QAAA,kDAAAC,QAAA,2DAAAC,QAAA,sDAAAC,QAAA,sJAOA,mCAGO,gDACP,mCAAuB,6DACvB,qCAAyB,+DACzB,uCAAwB,iEACxB,yCAA0B,mEAU1B,eAAsB,qBAIpB,iBAAwD,qCAAAA,QAC5B,CAC5B,SAAO,gEAAgC,gBAAgB,CACzD,CAeA,eAAsB,0BAIpB,iBAAyD,yCAAAD,QACxB,CACjC,SAAO,qEAAqC,gBAAgB,CAC9D","names":["DEBUG_ASYNC","DEBUG_SYNC","RELEASE_ASYNC","RELEASE_SYNC"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@componentor/quickjs-emscripten",
|
|
3
|
+
"version": "0.31.0",
|
|
4
|
+
"sideEffects": false,
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "commonjs",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"eval",
|
|
9
|
+
"quickjs",
|
|
10
|
+
"vm",
|
|
11
|
+
"interpreter",
|
|
12
|
+
"runtime",
|
|
13
|
+
"safe",
|
|
14
|
+
"emscripten",
|
|
15
|
+
"wasm"
|
|
16
|
+
],
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "https://github.com/componentor/quickjs-emscripten"
|
|
20
|
+
},
|
|
21
|
+
"author": {
|
|
22
|
+
"name": "Componentor"
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"LICENSE",
|
|
26
|
+
"dist/**/*",
|
|
27
|
+
"!dist/*.test.js",
|
|
28
|
+
"!dist/*.tsbuildinfo"
|
|
29
|
+
],
|
|
30
|
+
"types": "./dist/index.d.ts",
|
|
31
|
+
"main": "./dist/index.js",
|
|
32
|
+
"module": "./dist/index.mjs",
|
|
33
|
+
"exports": {
|
|
34
|
+
".": {
|
|
35
|
+
"types": "./dist/index.d.ts",
|
|
36
|
+
"import": "./dist/index.mjs",
|
|
37
|
+
"require": "./dist/index.js"
|
|
38
|
+
},
|
|
39
|
+
"./variants": {
|
|
40
|
+
"types": "./dist/variants.d.ts",
|
|
41
|
+
"import": "./dist/variants.mjs",
|
|
42
|
+
"require": "./dist/variants.js"
|
|
43
|
+
},
|
|
44
|
+
"./package.json": "./package.json"
|
|
45
|
+
},
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"@componentor/quickjs-wasmfile-release-asyncify": "0.31.0",
|
|
48
|
+
"@componentor/quickjs-wasmfile-debug-sync": "0.31.0",
|
|
49
|
+
"@componentor/quickjs-wasmfile-release-sync": "0.31.0",
|
|
50
|
+
"@componentor/quickjs-emscripten-core": "0.31.0",
|
|
51
|
+
"@componentor/quickjs-wasmfile-debug-asyncify": "0.31.0"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@componentor/quickjs-asmjs-mjs-release-sync": "0.31.0",
|
|
55
|
+
"@componentor/quickjs-ng-wasmfile-debug-asyncify": "0.31.0",
|
|
56
|
+
"@componentor/quickjs-ng-wasmfile-debug-sync": "0.31.0",
|
|
57
|
+
"@componentor/quickjs-ng-wasmfile-release-asyncify": "0.31.0",
|
|
58
|
+
"@componentor/quickjs-ng-wasmfile-release-sync": "0.31.0",
|
|
59
|
+
"@componentor/quickjs-singlefile-cjs-debug-asyncify": "0.31.0",
|
|
60
|
+
"@componentor/quickjs-singlefile-cjs-debug-sync": "0.31.0",
|
|
61
|
+
"@componentor/quickjs-singlefile-cjs-release-asyncify": "0.31.0",
|
|
62
|
+
"@componentor/quickjs-ffi-types": "0.31.0",
|
|
63
|
+
"@componentor/quickjs-singlefile-cjs-release-sync": "0.31.0",
|
|
64
|
+
"@componentor/quickjs-singlefile-mjs-debug-sync": "0.31.0",
|
|
65
|
+
"@componentor/quickjs-singlefile-mjs-release-asyncify": "0.31.0",
|
|
66
|
+
"@componentor/quickjs-singlefile-mjs-release-sync": "0.31.0",
|
|
67
|
+
"@jitl/tsconfig": "0.31.0",
|
|
68
|
+
"@componentor/quickjs-singlefile-mjs-debug-asyncify": "0.31.0"
|
|
69
|
+
},
|
|
70
|
+
"engines": {
|
|
71
|
+
"node": ">=16.0.0"
|
|
72
|
+
},
|
|
73
|
+
"scripts": {
|
|
74
|
+
"build": "npx tsup",
|
|
75
|
+
"clean": "git clean -fx dist .output",
|
|
76
|
+
"tsc": "npx tsc -p . --noEmit",
|
|
77
|
+
"test:vi": "VITEST=1 npx vitest run",
|
|
78
|
+
"test:node": "npx tsc -p tsconfig.build.json && ./makeTestPackageJson.ts && node --experimental-import-meta-resolve -r source-map-support/register --test ./.output/*node-test*.*js",
|
|
79
|
+
"test": "npm run test:vi && npm run test:node"
|
|
80
|
+
}
|
|
81
|
+
}
|