Skip to content

Commit a251e42

Browse files
committed
refactor: improve options
1 parent 2729e12 commit a251e42

File tree

4 files changed

+14
-7
lines changed

4 files changed

+14
-7
lines changed

src/fake-js.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ interface SymbolInfo {
3535
export function createFakeJsPlugin({
3636
dtsInput,
3737
sourcemap,
38-
}: OptionsResolved): Plugin {
38+
}: Pick<OptionsResolved, 'dtsInput' | 'sourcemap'>): Plugin {
3939
let symbolIdx = 0
4040
let identifierIdx = 0
4141
const symbolMap = new Map<number /* symbol id */, SymbolInfo>()

src/generate.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ export function createGeneratePlugin({
2626
compilerOptions = {},
2727
isolatedDeclarations,
2828
emitDtsOnly = false,
29-
}: OptionsResolved): Plugin {
29+
}: Pick<
30+
OptionsResolved,
31+
'compilerOptions' | 'isolatedDeclarations' | 'emitDtsOnly'
32+
>): Plugin {
3033
const dtsMap: DtsMap = new Map<string, TsModule>()
3134

3235
/**

src/resolve.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export const meta = { dtsFile: true } as const
1717
export function createDtsResolvePlugin({
1818
tsconfig,
1919
resolve,
20-
}: OptionsResolved): Plugin {
20+
}: Pick<OptionsResolved, 'tsconfig' | 'resolve'>): Plugin {
2121
const resolver = createResolver({
2222
tsconfig: tsconfig ? (tsconfig as string) : undefined,
2323
})

tests/rollup-plugin-dts.test.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,14 @@ await testFixtures(
2424

2525
let error: any
2626
let [rolldownSnapshot, rollupSnapshot] = await Promise.all([
27-
rolldownBuild(entries, [createFakeJsPlugin({ dtsInput: true })], {
28-
treeshake: true,
29-
external: ['typescript'],
30-
}).then(({ snapshot }) => snapshot),
27+
rolldownBuild(
28+
entries,
29+
[createFakeJsPlugin({ dtsInput: true, sourcemap: false })],
30+
{
31+
treeshake: true,
32+
external: ['typescript'],
33+
},
34+
).then(({ snapshot }) => snapshot),
3135
rollupBuild(entries, [rollupDts()], undefined, {
3236
entryFileNames: '[name].ts',
3337
}).then(({ snapshot }) => snapshot),

0 commit comments

Comments
 (0)