UNPKG

knip

Version:

Find and fix unused dependencies, exports and files in your TypeScript and JavaScript projects

20 lines (19 loc) 676 B
import { toProductionEntry } from '../../util/input.js'; import { hasDependency } from '../../util/plugin.js'; import { config } from '../astro/index.js'; import { getComponentPathsFromSourceFile } from './resolveFromAST.js'; const title = 'Starlight'; const enablers = ['@astrojs/starlight']; const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers); const resolveFromAST = (sourceFile) => { const componentPaths = getComponentPathsFromSourceFile(sourceFile); return Array.from(componentPaths).map(id => toProductionEntry(id)); }; const plugin = { title, enablers, isEnabled, config, resolveFromAST, }; export default plugin;