Skip to content

Commit 84046d3

Browse files
committed
chore: update
1 parent 9909939 commit 84046d3

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

packages/plugin-dts/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { type ChildProcess, fork } from 'node:child_process';
2-
import { dirname, extname, join, relative } from 'node:path';
2+
import { dirname, extname, join } from 'node:path';
33
import { fileURLToPath } from 'node:url';
44
import { type RsbuildConfig, type RsbuildPlugin, logger } from '@rsbuild/core';
55
import color from 'picocolors';

packages/plugin-dts/src/utils.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,11 @@ export async function cleanTsBuildInfoFile(
506506
}
507507
}
508508

509+
const windowsSlashRegex = /\\/g;
510+
export function normalizeSlash(p: string): string {
511+
return p.replace(windowsSlashRegex, '/');
512+
}
513+
509514
export function warnIfOutside(
510515
cwd: string,
511516
dir: string | undefined,
@@ -515,7 +520,7 @@ export function warnIfOutside(
515520
const relDir = relative(cwd, dir);
516521
if (relDir.startsWith('..') || relDir.startsWith('/')) {
517522
logger.warn(
518-
`The resolved ${label} ${color.cyan(dir)} is outside the project root ${color.cyan(cwd)}, please check your tsconfig file.`,
523+
`The resolved ${normalizeSlash(label)} ${color.cyan(normalizeSlash(dir))} is outside the project root ${color.cyan(cwd)}, please check your tsconfig file.`,
519524
);
520525
}
521526
}

tests/integration/dts/index.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -618,11 +618,12 @@ describe('check tsconfig.json field', async () => {
618618
});
619619
const logStrings = logs.map((log) => stripAnsi(log));
620620

621+
console.log('logStrings: ', logStrings);
621622
expect(files.esm).toMatchInlineSnapshot('undefined');
622623
expect(
623624
logStrings.some((log) =>
624625
log.includes(
625-
`The resolved declarationDir ${normalize(join(__dirname, 'check/tsconfig/dist'))} is outside the project root ${normalize(join(__dirname, 'check/outside-root'))}, please check your tsconfig file.`,
626+
`The resolved declarationDir ${join(__dirname, 'check/tsconfig/dist')} is outside the project root ${join(__dirname, 'check/outside-root')}, please check your tsconfig file.`,
626627
),
627628
),
628629
).toEqual(true);

0 commit comments

Comments
 (0)