chore: 移除autowire特性

This commit is contained in:
xiaojunnuo
2025-04-28 21:55:23 +08:00
parent 048696ee93
commit 0b6941d5ce
25 changed files with 55 additions and 106 deletions
@@ -1,17 +0,0 @@
import { Decorator } from "./index.js";
export type AutowireProp = {
name?: string;
type?: any;
};
export const AUTOWIRE_KEY = "pipeline:autowire";
export function Autowire(props?: AutowireProp): PropertyDecorator {
return (target, propertyKey) => {
const _type = Reflect.getMetadata("design:type", target, propertyKey);
target = Decorator.target(target, propertyKey);
props = props || {};
props.type = _type;
Reflect.defineMetadata(AUTOWIRE_KEY, props || {}, target, propertyKey);
};
}
@@ -1,2 +1 @@
export * from "./utils.js";
export * from "./common.js";
-4
View File
@@ -51,10 +51,6 @@ export type PluginDefine = Registrable & {
[key: string]: TaskOutputDefine;
};
autowire?: {
[key: string]: any;
};
shortcut?: {
[key: string]: {
title: string;
@@ -1,7 +1,6 @@
import { pluginRegistry } from "./registry.js";
import { PluginDefine, TaskInputDefine, TaskOutputDefine } from "./api.js";
import { Decorator } from "../decorator/index.js";
import { AUTOWIRE_KEY } from "../decorator/index.js";
import "reflect-metadata";
import { merge, sortBy } from "lodash-es";
// 提供一个唯一 key
@@ -12,7 +11,6 @@ export function IsTaskPlugin(define: PluginDefine): ClassDecorator {
target = Decorator.target(target);
const inputs: any = {};
const autowires: any = {};
const outputs: any = {};
const properties = Decorator.getClassProperties(target);
for (const property in properties) {
@@ -21,11 +19,6 @@ export function IsTaskPlugin(define: PluginDefine): ClassDecorator {
inputs[property] = input;
}
const autowire = Reflect.getMetadata(AUTOWIRE_KEY, target, property);
if (autowire) {
autowires[property] = autowire;
}
const output = Reflect.getMetadata(PLUGIN_OUTPUT_KEY, target, property);
if (output) {
outputs[property] = output;
@@ -57,7 +50,7 @@ export function IsTaskPlugin(define: PluginDefine): ClassDecorator {
},
};
define = merge(defaultConfig, define, { input: inputMap, autowire: autowires, output: outputs });
define = merge(defaultConfig, define, { input: inputMap, output: outputs });
Reflect.defineMetadata(PLUGIN_CLASS_KEY, define, target);