Skip to content

Commit

Permalink
feat: update mdx detection dependency list and update custom compiler… (
Browse files Browse the repository at this point in the history
  • Loading branch information
CHC383 authored Dec 10, 2024
1 parent c80ac0e commit 055a2e3
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion packages/knip/src/compilers/mdx.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
import { fencedCodeBlockMatcher, importMatcher } from './compilers.js';
import type { HasDependency } from './types.js';

const condition = (hasDependency: HasDependency) => hasDependency('@mdx-js/mdx') || hasDependency('astro');
// https://mdxjs.com/packages/
const mdxDependencies = [
'astro',
'@mdx-js/esbuild',
'@mdx-js/loader',
'@mdx-js/mdx',
'@mdx-js/node-loader',
'@mdx-js/preact',
'@mdx-js/react',
'@mdx-js/rollup',
'@mdx-js/vue',
'remark-mdx',
];

const condition = (hasDependency: HasDependency) => mdxDependencies.some(hasDependency);

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

Expand Down

0 comments on commit 055a2e3

Please sign in to comment.