Comparing version 0.3.7 to 0.3.8
declare const _default: { | ||
aop: { | ||
useCtxProxyForAppComponent: boolean; | ||
autoRegisterToCtx: boolean; | ||
}; | ||
}; | ||
export default _default; |
@@ -6,3 +6,4 @@ "use strict"; | ||
useCtxProxyForAppComponent: false, | ||
autoRegisterToCtx: false, | ||
} | ||
}; |
@@ -19,6 +19,3 @@ "use strict"; | ||
const clsType = classType || target; | ||
Object.defineProperty(clsType, getInstance_1.contextTypeSymbol, { | ||
value: from | ||
}); | ||
typeLoader_1.typeLoader.register(clsType, keyType || clsType, { autoNew: false }); | ||
typeLoader_1.register(clsType, keyType || clsType, from); | ||
}; | ||
@@ -25,0 +22,0 @@ } |
@@ -21,4 +21,11 @@ "use strict"; | ||
let ioc = undefined; | ||
let useCtxProxyForAppComponent = app.config.aop.useCtxProxyForAppComponent; | ||
const useCtxProxyForAppComponent = app.config.aop.useCtxProxyForAppComponent; | ||
const autoRegisterToCtx = app.config.aop.autoRegisterToCtx; | ||
if (autoRegisterToCtx && !typeLoader_1.typeLoader.has(clsType)) { | ||
typeLoader_1.register(clsType, clsType, 'Context'); | ||
} | ||
const targetClsType = typeLoader_1.typeLoader.get(clsType); | ||
if (!targetClsType) { | ||
throw new Error(`ClassType [${utils_1.getGlobalType(clsType)}] NOT found!`); | ||
} | ||
const from = targetClsType[exports.contextTypeSymbol]; | ||
@@ -25,0 +32,0 @@ if (from === 'Application') { |
export * from './decorators'; | ||
export { getApp, getCtx } from './appctx'; | ||
export * from './getInstance'; | ||
export * from './typeLoader'; | ||
export { typeLoader } from './typeLoader'; | ||
export * from './aspect'; |
@@ -9,3 +9,4 @@ "use strict"; | ||
tslib_1.__exportStar(require("./getInstance"), exports); | ||
tslib_1.__exportStar(require("./typeLoader"), exports); | ||
var typeLoader_1 = require("./typeLoader"); | ||
exports.typeLoader = typeLoader_1.typeLoader; | ||
tslib_1.__exportStar(require("./aspect"), exports); |
import { IocContext } from 'power-di'; | ||
import { InstanceSource } from './getInstance'; | ||
export declare const typeLoader: IocContext; | ||
export declare function register(clsType: any, keyType: any, from: InstanceSource): void; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const power_di_1 = require("power-di"); | ||
const getInstance_1 = require("./getInstance"); | ||
exports.typeLoader = new power_di_1.IocContext; | ||
function register(clsType, keyType, from) { | ||
Object.defineProperty(clsType, getInstance_1.contextTypeSymbol, { | ||
value: from | ||
}); | ||
exports.typeLoader.register(clsType, keyType, { autoNew: false }); | ||
} | ||
exports.register = register; |
{ | ||
"name": "egg-aop", | ||
"version": "0.3.7", | ||
"version": "0.3.8", | ||
"description": "aop for egg.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16191
399