knip
Version:
Find and fix unused dependencies, exports and files in your TypeScript and JavaScript projects
23 lines (22 loc) • 818 B
JavaScript
import { toDependency } from "../../util/input.js";
import { hasDependency } from "../../util/plugin.js";
import { toC12config } from "../../util/plugin-config.js";
const title = 'openapi-ts';
const enablers = ['@hey-api/openapi-ts'];
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
const config = ['package.json', ...toC12config('openapi-ts')];
const resolveConfig = config => {
const configs = Array.isArray(config) ? config : [config];
return configs.flatMap(config => (config.plugins ?? [])
.map(plugin => (typeof plugin === 'string' ? plugin : plugin.name))
.filter((name) => typeof name === 'string')
.map(id => toDependency(id)));
};
const plugin = {
title,
enablers,
isEnabled,
config,
resolveConfig,
};
export default plugin;