Skip to content

Commit

Permalink
chore: use fixed build for rollup-plugin-dts
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Oct 15, 2022
1 parent 6dc8462 commit f7acbf4
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 31 deletions.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -51,7 +51,7 @@
"pretty-bytes": "^6.0.0",
"rimraf": "^3.0.2",
"rollup": "^3.1.0",
"rollup-plugin-dts": "^4.2.3",
"@unjsio/rollup-plugin-dts": "^5.0.0-rc.1",
"rollup-plugin-esbuild": "^4.10.1",
"scule": "^0.3.2",
"typescript": "^4.8.4",
Expand Down
32 changes: 16 additions & 16 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 2 additions & 13 deletions src/builder/rollup.ts
Expand Up @@ -7,7 +7,7 @@ import commonjs from '@rollup/plugin-commonjs'
import { nodeResolve } from '@rollup/plugin-node-resolve'
import alias from '@rollup/plugin-alias'
import _esbuild from 'rollup-plugin-esbuild'
import dts from 'rollup-plugin-dts'
import dts from '@unjsio/rollup-plugin-dts'
import replace from '@rollup/plugin-replace'
import { resolve, dirname, normalize, extname } from 'pathe'
import { resolvePath, resolveModuleExportNames } from 'mlly'
Expand Down Expand Up @@ -117,18 +117,7 @@ export async function rollupBuild (ctx: BuildContext) {
const shebangPlugin: any = rollupOptions.plugins.find(p => p && p.name === 'unbuild-shebang')
shebangPlugin._options.preserve = false

// TODO: https://github.com/Swatinem/rollup-plugin-dts/issues/226
const dtsPlugin = dts(ctx.options.rollup.dts)
rollupOptions.plugins.push({
...dtsPlugin,
outputOptions (...args) {
const opts = dtsPlugin.outputOptions(...args)
opts.interop = 'esModule'
delete opts.namespaceToStringTag
opts.generatedCode = { symbols: false, ...opts.generatedCode }
return opts
}
})
rollupOptions.plugins.push(dts(ctx.options.rollup.dts))

await ctx.hooks.callHook('rollup:dts:options', ctx, rollupOptions)
const typesBuild = await rollup(rollupOptions)
Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Expand Up @@ -9,7 +9,7 @@ import type { RollupReplaceOptions } from '@rollup/plugin-replace'
import type { RollupAliasOptions } from '@rollup/plugin-alias'
import type { RollupNodeResolveOptions } from '@rollup/plugin-node-resolve'
import type { RollupJsonOptions } from '@rollup/plugin-json'
import type { Options as RollupDtsOptions } from 'rollup-plugin-dts'
import type { Options as RollupDtsOptions } from '@unjsio/rollup-plugin-dts'
import type commonjs from '@rollup/plugin-commonjs'

export type RollupCommonJSOptions = Parameters<typeof commonjs>[0] & {}
Expand Down

0 comments on commit f7acbf4

Please sign in to comment.