Init: Create & Init ms Project...

Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
2019-09-07 12:23:15 +08:00
commit 05bf312076
64 changed files with 2027 additions and 0 deletions

View File

@ -0,0 +1,20 @@
import { interfaces } from './interfaces'
import { METADATA_KEY } from './constants'
import { injectable, decorate } from "inversify";
import { getPluginMetadatas } from './utils'
/**
* MiaoScript plugin
* @param name namespace name default is '/'
* @param middleware middleware array
*/
export function plugin(currentMetadata: interfaces.PluginMetadata) {
return function(target: any) {
target.description = currentMetadata;
currentMetadata.target = target;
decorate(injectable(), target);
Reflect.defineMetadata(METADATA_KEY.plugin, currentMetadata, target);
const previousMetadata: interfaces.PluginMetadata[] = getPluginMetadatas();
Reflect.defineMetadata(METADATA_KEY.plugin, [currentMetadata, ...previousMetadata], Reflect);
};
}