mirror of
https://github.com/acid-info/Kurate.git
synced 2025-02-23 13:08:20 +00:00
25 lines
728 B
TypeScript
25 lines
728 B
TypeScript
|
import sveltePreprocess from 'svelte-preprocess'
|
||
|
import { preprocess, compile } from 'svelte/compiler'
|
||
|
import type { KnipConfig } from 'knip'
|
||
|
|
||
|
const sveltePreprocessor = sveltePreprocess()
|
||
|
|
||
|
const config: KnipConfig = {
|
||
|
ignore: ['**/*.d.ts'],
|
||
|
paths: {
|
||
|
// This ain't pretty, but Svelte basically does the same
|
||
|
'$app/*': ['node_modules/@sveltejs/kit/src/runtime/app/*'],
|
||
|
'$lib/*': ['src/lib/*'],
|
||
|
},
|
||
|
compilers: {
|
||
|
svelte: async (text: string) => {
|
||
|
const processed = await preprocess(text, sveltePreprocessor, { filename: 'dummy.ts' })
|
||
|
const compiled = compile(processed.code)
|
||
|
return compiled.js.code
|
||
|
},
|
||
|
css: (text: string) => [...text.matchAll(/(?<=@)import[^;]+/g)].join('\n'),
|
||
|
},
|
||
|
}
|
||
|
|
||
|
export default config
|