Skip to content

Commit a5c50b8

Browse files
committed
chore: update
1 parent 060f0e7 commit a5c50b8

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

packages/plugin-dts/src/utils.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -378,9 +378,7 @@ export async function processDtsFiles(
378378
);
379379
}
380380

381-
const dtsFiles = await glob(convertPath(join(dir, '/**/*.d.{ts,cts,mts}')), {
382-
absolute: true,
383-
});
381+
const dtsFiles = await globDtsFiles(dir);
384382

385383
await Promise.all(
386384
dtsFiles.map(async (file) => {
@@ -468,15 +466,19 @@ export async function calcLongestCommonPath(
468466
return lca;
469467
}
470468

471-
export async function cleanDtsFiles(dir: string): Promise<void> {
469+
export const globDtsFiles = async (dir: string): Promise<string[]> => {
472470
const patterns = ['/**/*.d.ts', '/**/*.d.cts', '/**/*.d.mts'];
473-
const files = await Promise.all(
471+
const dtsFiles = await Promise.all(
474472
patterns.map((pattern) =>
475473
glob(convertPath(join(dir, pattern)), { absolute: true }),
476474
),
477475
);
478476

479-
const allFiles = files.flat();
477+
return dtsFiles.flat();
478+
};
479+
480+
export async function cleanDtsFiles(dir: string): Promise<void> {
481+
const allFiles = await globDtsFiles(dir);
480482

481483
await Promise.all(allFiles.map((file) => fsP.rm(file, { force: true })));
482484
}

0 commit comments

Comments
 (0)