add built in script

This commit is contained in:
pengfei.zhou 2019-12-19 10:58:46 +08:00
parent ea781e43f9
commit 25a6f08a96
3 changed files with 2075 additions and 4 deletions

2060
dist/index.js vendored

File diff suppressed because it is too large Load Diff

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -8,6 +8,20 @@ const sandboxBundle = fs.readFileSync(path.resolve("./node_modules/doric/bundle/
const doricLibBundle = fs.readFileSync(path.resolve("./node_modules/doric/bundle/doric-lib.js"), 'utf-8')
const builtinScript = `
/**++++++++SandBox++++++++*/
${sandboxBundle}
/**--------SandBox--------*/
/**++++++++Lib++++++++*/
Reflect.apply(doric.jsRegisterModule,this,[doric,Reflect.apply(function(__module){(function(module,exports,require){
${doricLibBundle}
})(__module,__module.exports,doric.__require__);
return __module.exports;
},this,[{exports:{}}])]);
/**--------Lib--------*/
`
export default {
input: `build/index.js`,
output: {
@ -15,11 +29,10 @@ export default {
name: "index",
file: `dist/index.js`,
sourcemap: true,
banner: sandboxBundle,
banner: builtinScript,
globals: {
doric: "doric_lib",
'doric/src/runtime/sandbox': 'doric',
doricLibBundle
},
},
plugins: [