add require module
This commit is contained in:
@@ -6,7 +6,8 @@
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"dev": "tsc -p .&& rollup -c && node ./bundle/bundle.js",
|
||||
"build": "tsc -p . && rollup -c "
|
||||
"build": "tsc -p . && rollup -c ",
|
||||
"clean": "rm -rf build && rm -rf demo && rm -rf bundle"
|
||||
},
|
||||
"repository": {
|
||||
"type": "https",
|
||||
|
@@ -9,7 +9,7 @@ export default [
|
||||
output: {
|
||||
name: "hego",
|
||||
format: "iife",
|
||||
file: "bundle/sandbox.js",
|
||||
file: "bundle/hego-sandbox.js",
|
||||
},
|
||||
sourceMap: true,
|
||||
plugins: [
|
||||
@@ -21,12 +21,11 @@ export default [
|
||||
input: "build/index.js",
|
||||
output: {
|
||||
format: "cjs",
|
||||
file: "bundle/bundle.js",
|
||||
file: "bundle/hego-lib.js",
|
||||
},
|
||||
sourceMap: true,
|
||||
plugins: [
|
||||
resolve({ jsnext: true, main: true }),
|
||||
commonjs()
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@@ -14,11 +14,13 @@ import { loge } from "../util/log";
|
||||
* hego.__require__,
|
||||
* ])
|
||||
* // load module in global scope
|
||||
* Reflect.apply(hego.registerModule,this,[
|
||||
* Reflect.apply(hego.jsRegisterModule,this,[
|
||||
* moduleName,
|
||||
* Reflect.apply(function(__module){
|
||||
* return function(module,export,require){
|
||||
* })(__module,__module.exports,hego.__require__)
|
||||
* (function(module,exports,require){
|
||||
* //module content
|
||||
* })(__module,__module.exports,hego.__require__);
|
||||
* return __module.exports
|
||||
* },this,[{exports:{}}])
|
||||
* ])
|
||||
*
|
||||
@@ -83,7 +85,7 @@ export class Context {
|
||||
})
|
||||
})
|
||||
}
|
||||
registor(instance: Object) {
|
||||
register(instance: Object) {
|
||||
this.entity = instance
|
||||
}
|
||||
}
|
||||
|
@@ -5,7 +5,7 @@ export function Registor<T extends { new(...args: any[]): {} }>(constructor: T)
|
||||
const ret = class extends constructor {
|
||||
context = context
|
||||
}
|
||||
context.registor(new ret)
|
||||
context.register(new ret)
|
||||
return ret
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user