1.2.2 • Published 1 month ago

vaas-core v1.2.2

Weekly downloads
-
License
MIT
Repository
github
Last release
1 month ago

vaas-core

Virtual as a Service Core

install

npm i vaas-core

example

import { dynamicRun, proxyData } from 'vaas-core'

const exports = dynamicRun({
   filepath:path.join(__dirname,'test.js'),
   overwriteReadCodeSync:(filepath)=>{
       if(filepath===path.join(__dirname,'test.js')) {
           return `
               let res = 1+1;
               exports.res=res;
           `
       }
       return fs.readFileSync(filepath).toString()
   },
   extendVer:{
       var1:'data',
       var2:{key:'data'},
       process:proxyData(process), // Makes the now process variable unmodified
   },
   overwriteRequire:(callbackData)=>{
       if(callbackData.modulePath==='fs') {
           return {
               readFile:()=>{
                   // overwrite readFile someThing
               }
           }
       }
       if(callbackData.modulePath.indexOf(__dirname)!==0) {
           throw new Error(`Only module in the ${__dirname} can be require`)
       }
   }
})
1.2.2

1 month ago

1.2.1

1 month ago

1.1.5

8 months ago

1.1.4

1 year ago

1.1.1

2 years ago

1.0.9

2 years ago

1.1.3

1 year ago

1.1.2

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago