Skip to content

Commit c1ea1b6

Browse files
committed
chore: update
1 parent 1bb588e commit c1ea1b6

File tree

3 files changed

+4
-12
lines changed

3 files changed

+4
-12
lines changed

e2e/cases/dts/index.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ test('dts when bundle: true', async () => {
1616
const fixturePath = join(__dirname, 'bundle');
1717
const { entryFiles } = await buildAndGetResults(fixturePath, 'dts');
1818

19-
console.log('entryFiles: ', entryFiles);
2019
expect(entryFiles.esm!.endsWith('index.d.ts')).toEqual(true);
2120
expect(entryFiles.cjs!.endsWith('index.d.ts')).toEqual(true);
2221
});

packages/plugin-dts/src/index.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ export const pluginDts = (
2525

2626
setup(api) {
2727
const { tsconfigPath, distPath, bundle, isWatch } = options;
28-
let isFirstCompile = true;
2928

3029
api.onBeforeBuild(async ({ environments }) => {
3130
const cwd = process.cwd();
@@ -48,7 +47,7 @@ export const pluginDts = (
4847
const declarationDir = getDeclarationDir(bundle, distPath) || './dist';
4948
let entry = '';
5049

51-
if (options.bundle === true) {
50+
if (bundle === true) {
5251
const entrySourcePath = join(
5352
cwd,
5453
environments.esm?.config.source.entry?.main as string,
@@ -62,7 +61,7 @@ export const pluginDts = (
6261
}
6362

6463
const onComplete = (isSuccess: boolean) => {
65-
if (isSuccess && options.bundle === true) {
64+
if (isSuccess && bundle === true) {
6665
bundleDts({
6766
cwd,
6867
outDir,
@@ -79,23 +78,18 @@ export const pluginDts = (
7978
rootDir,
8079
declarationDir,
8180
},
82-
isFirstCompile,
8381
onComplete,
8482
isWatch,
8583
);
8684

87-
if (options.bundle === true && !isWatch) {
85+
if (bundle === true && !isWatch) {
8886
bundleDts({
8987
cwd,
9088
outDir,
9189
entry,
9290
tsconfigPath,
9391
});
9492
}
95-
96-
if (isFirstCompile) {
97-
isFirstCompile = false;
98-
}
9993
});
10094
},
10195
});

packages/plugin-dts/src/tsc.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ export type emitDtsOptions = {
1111

1212
export function emitDts(
1313
options: emitDtsOptions,
14-
isFirstCompile: boolean,
1514
onComplete: (isSuccess: boolean) => void,
1615
isWatch = false,
1716
) {
@@ -73,7 +72,7 @@ export function emitDts(
7372
}
7473

7574
logger.info('TypeScript compilation succeeded\n');
76-
} else if (isFirstCompile) {
75+
} else {
7776
const createProgram = ts.createSemanticDiagnosticsBuilderProgram;
7877
const formatHost: ts.FormatDiagnosticsHost = {
7978
getCanonicalFileName: (path) => path,

0 commit comments

Comments
 (0)