@@ -119,12 +119,10 @@ const DEFAULT_CDN = 'https://cdn.jsdelivr.net/npm'
119119 *
120120 * - `match`: regex to match against dependency names in package.json
121121 * - `family`: extracts the font family name from the package name
122- * - `file`: CSS entry file to parse (default: 'index.css')
123122 */
124123interface KnownFontPackage {
125124 match : RegExp
126125 family : ( pkgName : string ) => string
127- file ?: string
128126}
129127
130128const KNOWN_FONT_PACKAGES : KnownFontPackage [ ] = [
@@ -248,7 +246,6 @@ function packageDirFor(path: string, cssFile: string): string {
248246interface DetectedFont {
249247 family : string
250248 pkgName : string
251- file ?: string
252249}
253250
254251export default defineFontProvider ( 'npm' , ( providerOptions : NpmProviderOptions , ctx ) => {
@@ -331,7 +328,6 @@ export default defineFontProvider('npm', (providerOptions: NpmProviderOptions, c
331328 detectedFonts . set ( family . toLowerCase ( ) , {
332329 family,
333330 pkgName : depName ,
334- file : pattern . file ,
335331 } )
336332 break
337333 }
@@ -492,8 +488,7 @@ export default defineFontProvider('npm', (providerOptions: NpmProviderOptions, c
492488 async getFontProperties ( family : string ) {
493489 const detected = ( await getDetectedFonts ( ) ) . get ( family . toLowerCase ( ) )
494490 const pkgName = detected ?. pkgName ?? guessPackageForFamily ( family )
495- const file = detected ?. file
496- const cssFiles = file ? [ file ] : resolveCssFiles ( pkgName , { weights : STANDARD_WEIGHTS , styles : [ 'normal' , 'italic' ] } )
491+ const cssFiles = resolveCssFiles ( pkgName , { weights : STANDARD_WEIGHTS , styles : [ 'normal' , 'italic' ] } )
497492
498493 const allFormats : ResolveFontOptions [ 'formats' ] = [ 'woff2' , 'woff' , 'otf' , 'ttf' , 'eot' ]
499494 const fonts = await ctx . storage . getItem ( `npm:${ pkgName } /properties.json` , async ( ) => {
@@ -557,7 +552,7 @@ export default defineFontProvider('npm', (providerOptions: NpmProviderOptions, c
557552 const fonts = await getDetectedFonts ( )
558553 const detected = fonts . get ( family . toLowerCase ( ) )
559554 pkgName = detected ?. pkgName ?? guessPackageForFamily ( family )
560- file = familyOptions . file || detected ?. file
555+ file = familyOptions . file
561556 }
562557
563558 const pkgVersion = familyOptions . version || 'latest'
0 commit comments