UNPKG

knip

Version:

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

9 lines (8 loc) 494 B
import { fencedCodeBlockMatcher, importMatcher, importsWithinFrontmatter, inlineCodeMatcher, } from "../../compilers/compilers.js"; const frontmatterImportFields = ['layout']; const compiler = (text) => { const imports = text.replace(fencedCodeBlockMatcher, '').replace(inlineCodeMatcher, '').matchAll(importMatcher); const frontmatterImports = importsWithinFrontmatter(text, frontmatterImportFields); return [...imports, frontmatterImports].join('\n'); }; export default compiler;