mirror of
https://github.com/WeBankFinTech/fes.js.git
synced 2025-04-25 19:22:30 +08:00
* fix: 优化类型提示 * fix: 添加 enums 接口类型声明 * feat: 配置插件api提示 Co-authored-by: wanchun <445436867@qq.com>
31 lines
681 B
JavaScript
31 lines
681 B
JavaScript
import { join } from 'path';
|
|
import { name } from '../package.json';
|
|
|
|
export default (api) => {
|
|
api.addRuntimePluginKey(() => 'request');
|
|
|
|
const namespace = 'plugin-request';
|
|
const absoluteFilePath = `${namespace}/request.js`;
|
|
|
|
let generatedOnce = false;
|
|
api.onGenerateFiles(() => {
|
|
if (generatedOnce) return;
|
|
generatedOnce = true;
|
|
api.copyTmpFiles({
|
|
namespace,
|
|
path: join(__dirname, 'template'),
|
|
});
|
|
});
|
|
|
|
api.addPluginExports(() => [
|
|
{
|
|
exportAll: true,
|
|
source: absoluteFilePath,
|
|
},
|
|
]);
|
|
|
|
api.addConfigType(() => ({
|
|
source: name,
|
|
}));
|
|
};
|