qlin f8b70f0ebb Ts type (#133)
* fix: 优化类型提示

* fix: 添加 enums 接口类型声明

* feat: 配置插件api提示

Co-authored-by: wanchun <445436867@qq.com>
2022-06-22 19:24:49 +08:00

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,
}));
};