Skip to content

Commit 5640374

Browse files
committed
feat!: drop banner / footer
Use `output.postBanner` / `output.postFooter` instead
1 parent fc92a1d commit 5640374

8 files changed

Lines changed: 268 additions & 371 deletions

File tree

‎README.md‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -108,14 +108,6 @@ If set to `true`, and you are only exporting a single item using `export default
108108
the output will use `export = ...` instead of the standard ES module syntax.
109109
This is useful for compatibility with CommonJS.
110110

111-
#### `banner`
112-
113-
Content to be added at the top of each generated `.d.ts` file.
114-
115-
#### `footer`
116-
117-
Content to be added at the bottom of each generated `.d.ts` file.
118-
119111
#### `sideEffects`
120112

121113
Indicates whether the generated `.d.ts` files have side effects.

‎package.json‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
"peerDependencies": {
5858
"@ts-macro/tsc": "^0.3.6",
5959
"@typescript/native-preview": ">=7.0.0-dev.20250601.1",
60-
"rolldown": "^1.0.0-beta.51",
60+
"rolldown": "^1.0.0-beta.55",
6161
"typescript": "^5.0.0",
6262
"vue-tsc": "~3.1.0"
6363
},
@@ -89,18 +89,18 @@
8989
"devDependencies": {
9090
"@sxzz/eslint-config": "^7.4.3",
9191
"@sxzz/prettier-config": "^2.2.6",
92-
"@sxzz/test-utils": "^0.5.14",
92+
"@sxzz/test-utils": "^0.5.15",
9393
"@types/babel__generator": "^7.27.0",
94-
"@types/node": "^25.0.2",
95-
"@typescript/native-preview": "7.0.0-dev.20251216.1",
94+
"@types/node": "^25.0.3",
95+
"@typescript/native-preview": "7.0.0-dev.20251217.1",
9696
"@volar/typescript": "^2.4.27",
9797
"@vue/language-core": "^3.1.8",
9898
"arktype": "^2.1.29",
9999
"bumpp": "^10.3.2",
100100
"diff": "^8.0.2",
101101
"eslint": "^9.39.2",
102102
"prettier": "^3.7.4",
103-
"rolldown": "^1.0.0-beta.54",
103+
"rolldown": "^1.0.0-beta.55",
104104
"rolldown-plugin-require-cjs": "^0.3.3",
105105
"rollup-plugin-dts": "^6.3.0",
106106
"tinyglobby": "^0.2.15",

‎pnpm-lock.yaml‎

Lines changed: 262 additions & 267 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/banner.ts‎

Lines changed: 0 additions & 43 deletions
This file was deleted.

‎src/index.ts‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { createDebug } from 'obug'
2-
import { createBannerPlugin } from './banner.ts'
32
import { createDtsInputPlugin } from './dts-input.ts'
43
import { createFakeJsPlugin } from './fake-js.ts'
54
import { createGeneratePlugin } from './generate.ts'
@@ -32,9 +31,6 @@ export function dts(options: Options = {}): Plugin[] {
3231
plugins.push(createGeneratePlugin(resolved))
3332
}
3433
plugins.push(createDtsResolvePlugin(resolved), createFakeJsPlugin(resolved))
35-
if (options.banner || options.footer) {
36-
plugins.push(createBannerPlugin(resolved))
37-
}
3834
return plugins
3935
}
4036

‎src/options.ts‎

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
type TsConfigJson,
77
type TsConfigJsonResolved,
88
} from 'get-tsconfig'
9-
import type { AddonFunction } from 'rolldown'
109
import type { IsolatedDeclarationsOptions } from 'rolldown/experimental'
1110

1211
//#region General Options
@@ -186,15 +185,6 @@ export interface TscOptions {
186185
* `false`.
187186
*/
188187
emitJs?: boolean
189-
190-
/**
191-
* Content to be added at the top of each generated `.d.ts` file.
192-
*/
193-
banner?: string | Promise<string> | AddonFunction
194-
/**
195-
* Content to be added at the bottom of each generated `.d.ts` file.
196-
*/
197-
footer?: string | Promise<string> | AddonFunction
198188
}
199189

200190
export interface Options extends GeneralOptions, TscOptions {
@@ -222,11 +212,8 @@ export interface Options extends GeneralOptions, TscOptions {
222212
}
223213

224214
type Overwrite<T, U> = Pick<T, Exclude<keyof T, keyof U>> & U
225-
type MarkPartial<T, K extends keyof T> = Omit<Required<T>, K> &
226-
Partial<Pick<T, K>>
227-
228215
export type OptionsResolved = Overwrite<
229-
MarkPartial<Omit<Options, 'compilerOptions'>, 'banner' | 'footer'>,
216+
Required<Omit<Options, 'compilerOptions'>>,
230217
{
231218
tsconfig?: string
232219
oxc: IsolatedDeclarationsOptions | false
@@ -247,8 +234,6 @@ export function resolveOptions({
247234
resolve = false,
248235
resolver = 'oxc',
249236
cjsDefault = false,
250-
banner,
251-
footer,
252237
sideEffects = false,
253238

254239
// tsc
@@ -349,8 +334,6 @@ export function resolveOptions({
349334
resolve,
350335
resolver,
351336
cjsDefault,
352-
banner,
353-
footer,
354337
sideEffects,
355338

356339
// tsc

‎tests/__snapshots__/index.test.ts.snap‎

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,6 @@ declare const shared1 = "shared1";
1515
export { shared1 as t };"
1616
`;
1717

18-
exports[`banner 1`] = `
19-
"// minimal.d.ts
20-
/* My Banner */
21-
//#region tests/fixtures/minimal.d.ts
22-
declare function foo(): void;
23-
//#endregion
24-
export { foo };
25-
/* My Footer minimal.d.ts */"
26-
`;
27-
2818
exports[`basic 1`] = `
2919
"// basic.d.ts
3020
//#region tests/fixtures/basic.d.ts

‎tests/index.test.ts‎

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -415,22 +415,6 @@ test('should error when file import cannot be found', async () => {
415415
).rejects.toThrow("Could not resolve './missing-file'")
416416
})
417417

418-
test('banner', async () => {
419-
const { snapshot } = await rolldownBuild(
420-
path.resolve(dirname, 'fixtures/minimal.ts'),
421-
[
422-
dts({
423-
emitDtsOnly: true,
424-
banner: '/* My Banner */',
425-
footer: (chunk) => `/* My Footer ${chunk.fileName} */`,
426-
}),
427-
],
428-
)
429-
expect(snapshot).toMatchSnapshot()
430-
expect(snapshot).toContain('/* My Banner */\n')
431-
expect(snapshot).toContain('\n/* My Footer minimal.d.ts */')
432-
})
433-
434418
test('manualChunks', async () => {
435419
const { snapshot, chunks } = await rolldownBuild(
436420
path.resolve(dirname, 'fixtures/manual-chunk/entry.ts'),

0 commit comments

Comments
 (0)