File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11export default {
22 ignore : '.astro/types.d.ts' ,
3+ ignoreExportsUsedInFile : true ,
34 compilers : {
45 css : ( text : string ) => [ ...text . matchAll ( / (?< = @ ) i m p o r t [ ^ ; ] + / g) ] . join ( '\n' ) ,
56 } ,
Original file line number Diff line number Diff line change 11---
2- interface Props {
2+ export interface Props {
33 date: Date ;
44}
55
Original file line number Diff line number Diff line change 11import { frontmatterMatcher , scriptBodies } from '../../compilers/compilers.ts' ;
22
3+ const propsDeclMatcher = / (?: ^ | [ \s ; ] ) (?: i n t e r f a c e | t y p e ) \s + P r o p s \b / ;
4+
35const compiler = ( text : string , path : string ) => {
46 const scripts = [ ] ;
57
68 const frontmatter = text . match ( frontmatterMatcher ) ;
7- if ( frontmatter ?. [ 1 ] ) scripts . push ( frontmatter [ 1 ] ) ;
9+ if ( frontmatter ?. [ 1 ] ) {
10+ let fm = frontmatter [ 1 ] ;
11+ if ( propsDeclMatcher . test ( fm ) && text . includes ( 'Astro.props' ) ) fm += '\ntype __knip_astro_props = Props;' ;
12+ scripts . push ( fm ) ;
13+ }
814
915 const scriptContent = scriptBodies ( text , path ) ;
1016 if ( scriptContent ) scripts . push ( scriptContent ) ;
You can’t perform that action at this time.
0 commit comments