feat: optimze plugin system
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ccms/container",
|
||||
"version": "0.27.3-beta.0",
|
||||
"version": "0.27.3",
|
||||
"description": "MiaoScript container package",
|
||||
"keywords": [
|
||||
"miaoscript",
|
||||
@@ -19,7 +19,7 @@
|
||||
"test": "echo \"Error: run tests from root\" && exit 1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@ccms/nashorn": "^0.27.3-beta.0",
|
||||
"@ccms/nashorn": "^0.27.3",
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"rimraf": "^4.1.2",
|
||||
"typescript": "^4.9.5"
|
||||
|
||||
@@ -154,8 +154,9 @@ export const reduceMetadata = (ctx: interfaces.Context): any => {
|
||||
function initAutowired(container: Container) {
|
||||
container.bind(ioc.Autowired).toDynamicValue((ctx) => {
|
||||
var metadata: any = reduceMetadata(ctx)
|
||||
let key = Object.toString.call(metadata.named)
|
||||
let key = Object.prototype.toString.call(metadata.named)
|
||||
if (key === "[object Function]" || key === "[object Symbol]") { return container.get(metadata.named) }
|
||||
console.warn('container autowired', metadata.named, 'failed. Error: illegal serviceIdentifier type', key)
|
||||
return undefined
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user