@@ -7,7 +7,6 @@ import assert, {AssertionError} from "assert";
77import chalk from "chalk" ;
88import { Parser } from "./parser.js" ;
99import axios from "axios" ;
10- import globby from "globby" ;
1110import path from "path" ;
1211import semver from "semver" ;
1312import { RE2JS } from "re2js" ;
@@ -93,7 +92,7 @@ export class ParserIncludes {
9392 }
9493 if ( value [ "local" ] ) {
9594 validateIncludeLocal ( value [ "local" ] ) ;
96- const files = resolveIncludeLocal ( value [ "local" ] , cwd ) ;
95+ const files = await resolveIncludeLocal ( value [ "local" ] , cwd ) ;
9796 if ( files . length == 0 ) {
9897 throw new AssertionError ( { message : `Local include file cannot be found ${ value [ "local" ] } ` } ) ;
9998 }
@@ -327,11 +326,11 @@ export class ParserIncludes {
327326
328327 static readonly memoLocalRepoFiles = ( ( ) => {
329328 const cache = new Map < string , string [ ] > ( ) ;
330- return ( path : string ) => {
329+ return async ( path : string ) => {
331330 let result = cache . get ( path ) ;
332331 if ( typeof result !== "undefined" ) return result ;
333332
334- result = globby . sync ( path , { dot : true , gitignore : true } ) ;
333+ result = ( await Utils . getTrackedFiles ( path ) ) . map ( p => ` ${ path } / ${ p } ` ) ;
335334 cache . set ( path , result ) ;
336335 return result ;
337336 } ;
@@ -361,8 +360,8 @@ export function resolveSemanticVersionRange (range: string, gitTags: string[]) {
361360 return found ;
362361}
363362
364- export function resolveIncludeLocal ( pattern : string , cwd : string ) {
365- const repoFiles = ParserIncludes . memoLocalRepoFiles ( cwd ) ;
363+ export async function resolveIncludeLocal ( pattern : string , cwd : string ) {
364+ const repoFiles = await ParserIncludes . memoLocalRepoFiles ( cwd ) ;
366365
367366 if ( ! pattern . startsWith ( "/" ) ) pattern = `/${ pattern } ` ; // Ensure pattern starts with `/`
368367 pattern = `${ cwd } ${ pattern } ` ;
0 commit comments