import * as path from 'path' ; import NormalizedPath from '../types/NormalizedPath' ; import normalizePath from './normalizePath' ; const minimatch = require ( 'minimatch' ) ; export default function fileMatchesConfigGlob ( importFile , configPath , modulesGlob ) { if ( modulesGlob == '*' ) { return true ; } importFile = removeFileExtension ( importFile ) ; return minimatch ( importFile , normalizePath ( configPath , modulesGlob ) ) ; } function removeFileExtension ( filePath ) { let extension = filePath . endsWith ( '.d.ts' ) ? '.d.ts' : path . extname ( filePath ) ; return < NormalizedPath > filePath . slice ( 0 , filePath . length - extension . length ) ; }