UNPKG

knip

Version:

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

13 lines (12 loc) 431 B
import { frontmatterMatcher, scriptBodies } from "../../compilers/compilers.js"; const compiler = (text, path) => { const scripts = []; const frontmatter = text.match(frontmatterMatcher); if (frontmatter?.[1]) scripts.push(frontmatter[1]); const scriptContent = scriptBodies(text, path); if (scriptContent) scripts.push(scriptContent); return scripts.join('\n'); }; export default compiler;