-
-
Notifications
You must be signed in to change notification settings - Fork 336
Open
Labels
feature requestFeature requestFeature request
Description
Suggest an idea for Knip
Starlight renders code blocks internally using Expressive Code.
https://starlight.astro.build/guides/authoring-content/#expressive-code-features
Since Expressive Code supports a configuration file named ec.config.mjs,
I believe that ec.config.mjs should be treated as an entryin the Starlight plugin.
https://expressive-code.com/reference/configuration/
NOTE: current implementation of startlight plugin:
knip/packages/knip/src/plugins/starlight/index.ts
Lines 1 to 29 in 3e0b847
| import type ts from 'typescript'; | |
| import type { IsPluginEnabled, Plugin, ResolveFromAST } from '../../types/config.js'; | |
| import { toProductionEntry } from '../../util/input.js'; | |
| import { hasDependency } from '../../util/plugin.js'; | |
| import { config } from '../astro/index.js'; | |
| import { getComponentPathsFromSourceFile } from './resolveFromAST.js'; | |
| // https://starlight.astro.build/reference/configuration/ | |
| const title = 'Starlight'; | |
| const enablers = ['@astrojs/starlight']; | |
| const isEnabled: IsPluginEnabled = ({ dependencies }) => hasDependency(dependencies, enablers); | |
| const resolveFromAST: ResolveFromAST = (sourceFile: ts.SourceFile) => { | |
| const componentPaths = getComponentPathsFromSourceFile(sourceFile); | |
| return Array.from(componentPaths).map(id => toProductionEntry(id)); | |
| }; | |
| const plugin: Plugin = { | |
| title, | |
| enablers, | |
| isEnabled, | |
| config, | |
| resolveFromAST, | |
| }; | |
| export default plugin; |
Metadata
Metadata
Assignees
Labels
feature requestFeature requestFeature request