Skip to content

Commit 055a2e3

Browse files
authoredDec 10, 2024··
feat: update mdx detection dependency list and update custom compiler… (#875)
1 parent c80ac0e commit 055a2e3

File tree

1 file changed

+15
-1
lines changed
  • packages/knip/src/compilers

1 file changed

+15
-1
lines changed
 

‎packages/knip/src/compilers/mdx.ts

+15-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,21 @@
11
import { fencedCodeBlockMatcher, importMatcher } from './compilers.js';
22
import type { HasDependency } from './types.js';
33

4-
const condition = (hasDependency: HasDependency) => hasDependency('@mdx-js/mdx') || hasDependency('astro');
4+
// https://mdxjs.com/packages/
5+
const mdxDependencies = [
6+
'astro',
7+
'@mdx-js/esbuild',
8+
'@mdx-js/loader',
9+
'@mdx-js/mdx',
10+
'@mdx-js/node-loader',
11+
'@mdx-js/preact',
12+
'@mdx-js/react',
13+
'@mdx-js/rollup',
14+
'@mdx-js/vue',
15+
'remark-mdx',
16+
];
17+
18+
const condition = (hasDependency: HasDependency) => mdxDependencies.some(hasDependency);
519

620
const compiler = (text: string) => [...text.replace(fencedCodeBlockMatcher, '').matchAll(importMatcher)].join('\n');
721

0 commit comments

Comments
 (0)
Please sign in to comment.