feat: optimze plugin system

This commit is contained in:
2023-07-19 17:16:50 +08:00
parent 25a8f35f28
commit 3f1de332fd
39 changed files with 6701 additions and 131 deletions

View File

@@ -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"

View File

@@ -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
})
}