Skip to content

Commit

Permalink
chore: update
Browse files Browse the repository at this point in the history
  • Loading branch information
Timeless0911 committed Aug 9, 2024
1 parent 3f7ff71 commit 64c8a7d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
6 changes: 3 additions & 3 deletions e2e/cases/dts/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ describe('dts when bundle: true', () => {
'dts',
);

expect(entryFiles.esm).toEqual('./dist/esm/index.d.ts');
expect(entryFiles.esm).toEqual('./dist/esm/main.d.ts');
expect(entries).toMatchSnapshot();
});

Expand All @@ -113,7 +113,7 @@ describe('dts when bundle: true', () => {
'dts',
);

expect(entryFiles.esm).toEqual('./dist/custom/index.d.ts');
expect(entryFiles.esm).toEqual('./dist/custom/main.d.ts');
});

test('abortOnError: false', async () => {
Expand All @@ -135,7 +135,7 @@ describe('dts when bundle: true', () => {
'dts',
);

expect(entryFiles.cjs).toEqual('./dist/cjs/index.d.cts');
expect(entryFiles.cjs).toEqual('./dist/cjs/main.d.cts');
});

test('bundleName -- set source.entry', async () => {
Expand Down
11 changes: 7 additions & 4 deletions packages/plugin-dts/src/apiExtractor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export type BundleOptions = {
cwd: string;
outDir: string;
dtsExtension: string;
dtsEntry: DtsEntry;
dtsEntry: Required<DtsEntry>;
tsconfigPath?: string;
};

Expand All @@ -24,17 +24,20 @@ export async function bundleDts(options: BundleOptions): Promise<void> {
cwd,
outDir,
dtsExtension,
dtsEntry,
dtsEntry = {
name: 'index',
path: 'index.d.ts',
},
tsconfigPath = 'tsconfig.json',
} = options;
try {
const start = Date.now();
const untrimmedFilePath = join(
cwd,
relative(cwd, outDir),
`${dtsEntry.name ?? 'index'}${dtsExtension}`,
`${dtsEntry.name}${dtsExtension}`,
);
const mainEntryPointFilePath = dtsEntry.path ?? 'index.d.ts';
const mainEntryPointFilePath = dtsEntry.path;
const internalConfig = {
mainEntryPointFilePath,
// TODO: use !externals
Expand Down

0 comments on commit 64c8a7d

Please sign in to comment.