diff --git a/e2e/scripts/helper.ts b/e2e/scripts/helper.ts index 1d36600f3..fe2cd7ffb 100644 --- a/e2e/scripts/helper.ts +++ b/e2e/scripts/helper.ts @@ -6,8 +6,6 @@ import fg, { } from 'fast-glob'; import fse from 'fs-extra'; -export const getFiles = async (_pattern: string) => {}; - // fast-glob only accepts posix path // https://github.com/mrmlnc/fast-glob#convertpathtopatternpath const convertPath = (path: string) => { diff --git a/packages/plugin-dts/src/utils.ts b/packages/plugin-dts/src/utils.ts index cba3bc1dc..8e3c80b78 100644 --- a/packages/plugin-dts/src/utils.ts +++ b/packages/plugin-dts/src/utils.ts @@ -63,6 +63,8 @@ export async function processDtsFiles( const dtsFiles = await fg(`${dir}/**/*.d.ts`); + console.log('11111 fg', dir, 'dtsFiles', dtsFiles); + for (const file of dtsFiles) { try { const newFile = file.replace('.d.ts', dtsExtension); @@ -107,7 +109,12 @@ export async function calcLongestCommonPath( return null; } - const splitPaths = absPaths.map((p) => p.split(path.sep)); + // we support two cases + // 1. /packages-a/src/index.ts + // 2. D:/packages-a/src/index.ts + const sep = path.posix.sep as '/'; + + const splitPaths = absPaths.map((p) => p.split(sep)); let lcaFragments = splitPaths[0]!; for (let i = 1; i < splitPaths.length; i++) { const currentPath = splitPaths[i]!; @@ -121,7 +128,7 @@ export async function calcLongestCommonPath( lcaFragments = lcaFragments.slice(0, j); } - let lca = lcaFragments.length > 0 ? lcaFragments.join(path.sep) : '/'; + let lca = lcaFragments.length > 0 ? lcaFragments.join(sep) : sep; const stats = await fsP.stat(lca); if (stats?.isFile()) {