@@ -168,24 +168,12 @@ export async function esbuildAsync(
168168}
169169
170170/**
171- * Recursively delete files.
172- *
173- * @see `traverseFiles`.
174- *
175- * @param root Root directory to search.
176- * @param conditionFn Predicate used to delete the files.
171+ * Type of the parameter of `traverseFiles` callbacks
177172 */
178- export function removeFiles (
179- root : string ,
180- conditionFn : ( paths : {
181- absolutePath : string ;
182- relativePath : string ;
183- } ) => boolean ,
184- ) {
185- traverseFiles ( root , conditionFn , ( { absolutePath } ) =>
186- fs . rmSync ( absolutePath , { force : true } ) ,
187- ) ;
188- }
173+ export type TraversePath = {
174+ absolutePath : string ;
175+ relativePath : string ;
176+ } ;
189177
190178/**
191179 * Recursively traverse files in a directory and call `callbackFn` when `conditionFn` returns true
@@ -199,11 +187,8 @@ export function removeFiles(
199187 */
200188export function traverseFiles (
201189 root : string ,
202- conditionFn : ( paths : {
203- absolutePath : string ;
204- relativePath : string ;
205- } ) => boolean ,
206- callbackFn : ( paths : { absolutePath : string ; relativePath : string } ) => void ,
190+ conditionFn : ( paths : TraversePath ) => boolean ,
191+ callbackFn : ( paths : TraversePath ) => void ,
207192 searchingDir : string = "" ,
208193) {
209194 fs . readdirSync ( path . join ( root , searchingDir ) ) . forEach ( ( file ) => {
@@ -221,6 +206,23 @@ export function traverseFiles(
221206 } ) ;
222207}
223208
209+ /**
210+ * Recursively delete files.
211+ *
212+ * @see `traverseFiles`.
213+ *
214+ * @param root Root directory to search.
215+ * @param conditionFn Predicate used to delete the files.
216+ */
217+ export function removeFiles (
218+ root : string ,
219+ conditionFn : ( paths : TraversePath ) => boolean ,
220+ ) {
221+ traverseFiles ( root , conditionFn , ( { absolutePath } ) =>
222+ fs . rmSync ( absolutePath , { force : true } ) ,
223+ ) ;
224+ }
225+
224226export function getHtmlPages ( dotNextPath : string ) {
225227 // Get a list of HTML pages
226228 //
0 commit comments