@joai/warps-vm-node 1.0.1 → 1.0.3

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/dist/runInVm.js CHANGED
@@ -1 +1 @@
1
- "use strict";var u=Object.create;var o=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var p=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty;var y=(n,t)=>{for(var r in t)o(n,r,{get:t[r],enumerable:!0})},i=(n,t,r,e)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of f(t))!c.call(n,s)&&s!==r&&o(n,s,{get:()=>t[s],enumerable:!(e=l(t,s))||e.enumerable});return n};var d=(n,t,r)=>(r=n!=null?u(p(n)):{},i(t||!n||!n.__esModule?o(r,"default",{value:n,enumerable:!0}):r,n)),w=n=>i(o({},"__esModule",{value:!0}),n);var T={};y(T,{createNodeTransformRunner:()=>v,runInVm:()=>m});module.exports=w(T);var a=null;async function h(){if(a)return a;try{return a=await import("vm2"),a}catch(n){throw n?.code==="MODULE_NOT_FOUND"||n?.message?.includes("Cannot find module")?new Error('The optional dependency "vm2" is not installed. To use runInVm in Node.js, please install vm2: npm install vm2 --save.'):n}}var m=async(n,t)=>{try{let{VM:r}=await h(),e=new r({timeout:2e3,sandbox:{results:t,...t},eval:!1,wasm:!1});return n.trim().startsWith("(")&&n.includes("=>")?e.run(`(${n})(results)`):n.trim().startsWith("function")?e.run(`(${n})(results)`):e.run(`(${n})`)}catch(r){throw r?.message?.includes('The optional dependency "vm2" is not installed')?r:new Error(`Transform error: ${r?.message||String(r)}`)}},v=()=>({run:m});0&&(module.exports={createNodeTransformRunner,runInVm});
1
+ "use strict";var u=Object.create;var s=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var c=Object.getPrototypeOf,f=Object.prototype.hasOwnProperty;var d=(n,t)=>{for(var r in t)s(n,r,{get:t[r],enumerable:!0})},i=(n,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of p(t))!f.call(n,e)&&e!==r&&s(n,e,{get:()=>t[e],enumerable:!(o=l(t,e))||o.enumerable});return n};var y=(n,t,r)=>(r=n!=null?u(c(n)):{},i(t||!n||!n.__esModule?s(r,"default",{value:n,enumerable:!0}):r,n)),w=n=>i(s({},"__esModule",{value:!0}),n);var T={};d(T,{createNodeTransformRunner:()=>v,runInVm:()=>m});module.exports=w(T);var a=null;async function h(){if(a)return a;try{return a=await import("vm2"),a}catch(n){throw n?.code==="MODULE_NOT_FOUND"||n?.message?.includes("Cannot find module")?new Error('The optional dependency "vm2" is not installed. To use runInVm in Node.js, please install vm2: npm install vm2 --save.'):n}}var m=async(n,t)=>{try{let{VM:r}=await h(),o=new r({timeout:2e3,sandbox:{results:t,out:t?.out,inputs:t?.inputs},eval:!1,wasm:!1}),e=n.trim().startsWith("(")&&n.includes("=>")||n.trim().startsWith("function");return o.run(e?`(${n})(results)`:`(${n})`)}catch(r){throw r?.message?.includes('The optional dependency "vm2" is not installed')?r:new Error(`Transform error: ${r?.message||String(r)}`)}},v=()=>({run:m});0&&(module.exports={createNodeTransformRunner,runInVm});
package/dist/runInVm.mjs CHANGED
@@ -1 +1 @@
1
- var t=null;async function o(){if(t)return t;try{return t=await import("vm2"),t}catch(n){throw n?.code==="MODULE_NOT_FOUND"||n?.message?.includes("Cannot find module")?new Error('The optional dependency "vm2" is not installed. To use runInVm in Node.js, please install vm2: npm install vm2 --save.'):n}}var a=async(n,s)=>{try{let{VM:r}=await o(),e=new r({timeout:2e3,sandbox:{results:s,...s},eval:!1,wasm:!1});return n.trim().startsWith("(")&&n.includes("=>")?e.run(`(${n})(results)`):n.trim().startsWith("function")?e.run(`(${n})(results)`):e.run(`(${n})`)}catch(r){throw r?.message?.includes('The optional dependency "vm2" is not installed')?r:new Error(`Transform error: ${r?.message||String(r)}`)}},i=()=>({run:a});export{i as createNodeTransformRunner,a as runInVm};
1
+ var r=null;async function a(){if(r)return r;try{return r=await import("vm2"),r}catch(n){throw n?.code==="MODULE_NOT_FOUND"||n?.message?.includes("Cannot find module")?new Error('The optional dependency "vm2" is not installed. To use runInVm in Node.js, please install vm2: npm install vm2 --save.'):n}}var i=async(n,e)=>{try{let{VM:t}=await a(),o=new t({timeout:2e3,sandbox:{results:e,out:e?.out,inputs:e?.inputs},eval:!1,wasm:!1}),s=n.trim().startsWith("(")&&n.includes("=>")||n.trim().startsWith("function");return o.run(s?`(${n})(results)`:`(${n})`)}catch(t){throw t?.message?.includes('The optional dependency "vm2" is not installed')?t:new Error(`Transform error: ${t?.message||String(t)}`)}},m=()=>({run:i});export{m as createNodeTransformRunner,i as runInVm};
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@joai/warps-vm-node",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "type": "module",
5
5
  "types": "dist/runInVm.d.ts",
6
6
  "files": [
7
7
  "dist"
8
8
  ],
9
9
  "dependencies": {
10
- "@joai/warps": "^3.0.0",
10
+ "@joai/warps": "^4.0.0",
11
11
  "vm2": "^3.10.0"
12
12
  },
13
13
  "devDependencies": {