mirror of
https://github.com/acid-info/Kurate.git
synced 2025-02-04 20:14:18 +00:00
2c6b128723
Co-authored-by: Vojtech Simetka <vojtech@simetka.cz>
26 lines
770 B
TypeScript
26 lines
770 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/*'],
|
|
'$env/*': ['.svelte-kit/ambient.d.ts'],
|
|
'$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
|