rolldown-plugin-dts 0.18.4 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -8
- package/dist/index.d.mts +2 -13
- package/dist/index.mjs +1 -35
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -108,14 +108,6 @@ If set to `true`, and you are only exporting a single item using `export default
|
|
|
108
108
|
the output will use `export = ...` instead of the standard ES module syntax.
|
|
109
109
|
This is useful for compatibility with CommonJS.
|
|
110
110
|
|
|
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
|
-
|
|
119
111
|
#### `sideEffects`
|
|
120
112
|
|
|
121
113
|
Indicates whether the generated `.d.ts` files have side effects.
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as RE_JSON, c as RE_VUE, i as RE_JS, n as RE_DTS, o as RE_NODE_MODULES, r as RE_DTS_MAP, s as RE_TS, t as RE_CSS } from "./filename-Dn8CLu7g.mjs";
|
|
2
2
|
import { IsolatedDeclarationsOptions } from "rolldown/experimental";
|
|
3
3
|
import { TsConfigJson } from "get-tsconfig";
|
|
4
|
-
import {
|
|
4
|
+
import { Plugin } from "rolldown";
|
|
5
5
|
|
|
6
6
|
//#region src/options.d.ts
|
|
7
7
|
interface GeneralOptions {
|
|
@@ -161,14 +161,6 @@ interface TscOptions {
|
|
|
161
161
|
* `false`.
|
|
162
162
|
*/
|
|
163
163
|
emitJs?: boolean;
|
|
164
|
-
/**
|
|
165
|
-
* Content to be added at the top of each generated `.d.ts` file.
|
|
166
|
-
*/
|
|
167
|
-
banner?: string | Promise<string> | AddonFunction;
|
|
168
|
-
/**
|
|
169
|
-
* Content to be added at the bottom of each generated `.d.ts` file.
|
|
170
|
-
*/
|
|
171
|
-
footer?: string | Promise<string> | AddonFunction;
|
|
172
164
|
}
|
|
173
165
|
interface Options extends GeneralOptions, TscOptions {
|
|
174
166
|
/**
|
|
@@ -189,8 +181,7 @@ interface Options extends GeneralOptions, TscOptions {
|
|
|
189
181
|
tsgo?: boolean;
|
|
190
182
|
}
|
|
191
183
|
type Overwrite<T, U> = Pick<T, Exclude<keyof T, keyof U>> & U;
|
|
192
|
-
type
|
|
193
|
-
type OptionsResolved = Overwrite<MarkPartial<Omit<Options, "compilerOptions">, "banner" | "footer">, {
|
|
184
|
+
type OptionsResolved = Overwrite<Required<Omit<Options, "compilerOptions">>, {
|
|
194
185
|
tsconfig?: string;
|
|
195
186
|
oxc: IsolatedDeclarationsOptions | false;
|
|
196
187
|
tsconfigRaw: TsConfigJson;
|
|
@@ -206,8 +197,6 @@ declare function resolveOptions({
|
|
|
206
197
|
resolve,
|
|
207
198
|
resolver,
|
|
208
199
|
cjsDefault,
|
|
209
|
-
banner,
|
|
210
|
-
footer,
|
|
211
200
|
sideEffects,
|
|
212
201
|
build,
|
|
213
202
|
incremental,
|
package/dist/index.mjs
CHANGED
|
@@ -2,7 +2,6 @@ const __cjs_require = globalThis.process.getBuiltinModule("module").createRequir
|
|
|
2
2
|
import { a as RE_JSON, c as RE_VUE, d as filename_to_dts, f as replaceTemplateName, i as RE_JS, l as filename_dts_to, n as RE_DTS, o as RE_NODE_MODULES, p as resolveTemplateFn, r as RE_DTS_MAP, s as RE_TS, t as RE_CSS, u as filename_js_to_dts } from "./filename-Cqnsj8Gp.mjs";
|
|
3
3
|
import { n as globalContext, r as invalidateContextFile, t as createContext } from "./context-EuY-ImLj.mjs";
|
|
4
4
|
import { createDebug } from "obug";
|
|
5
|
-
import MagicString from "magic-string";
|
|
6
5
|
const {
|
|
7
6
|
generate
|
|
8
7
|
} = __cjs_require("@babel/generator");
|
|
@@ -32,36 +31,6 @@ const process = globalThis.process;
|
|
|
32
31
|
import { getTsconfig, parseTsconfig } from "get-tsconfig";
|
|
33
32
|
import { createResolver } from "dts-resolver";
|
|
34
33
|
|
|
35
|
-
//#region src/banner.ts
|
|
36
|
-
function createBannerPlugin({ banner, footer }) {
|
|
37
|
-
return {
|
|
38
|
-
name: "rolldown-plugin-dts:banner",
|
|
39
|
-
async renderChunk(code, chunk) {
|
|
40
|
-
if (!RE_DTS.test(chunk.fileName)) return;
|
|
41
|
-
const s = new MagicString(code);
|
|
42
|
-
if (banner) {
|
|
43
|
-
const code$1 = await (typeof banner === "function" ? banner(chunk) : banner);
|
|
44
|
-
if (code$1) s.prepend(`${code$1}\n`);
|
|
45
|
-
}
|
|
46
|
-
if (footer) {
|
|
47
|
-
const code$1 = await (typeof footer === "function" ? footer(chunk) : footer);
|
|
48
|
-
if (code$1) s.append(`\n${code$1}`);
|
|
49
|
-
}
|
|
50
|
-
return {
|
|
51
|
-
code: s.toString(),
|
|
52
|
-
get map() {
|
|
53
|
-
return s.generateMap({
|
|
54
|
-
source: chunk.fileName,
|
|
55
|
-
includeContent: true,
|
|
56
|
-
hires: "boundary"
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
//#endregion
|
|
65
34
|
//#region src/dts-input.ts
|
|
66
35
|
function createDtsInputPlugin({ sideEffects }) {
|
|
67
36
|
return {
|
|
@@ -882,7 +851,7 @@ function collectJsonExports(code) {
|
|
|
882
851
|
//#endregion
|
|
883
852
|
//#region src/options.ts
|
|
884
853
|
let warnedTsgo = false;
|
|
885
|
-
function resolveOptions({ cwd = process.cwd(), dtsInput = false, emitDtsOnly = false, tsconfig, tsconfigRaw: overriddenTsconfigRaw = {}, compilerOptions = {}, sourcemap, resolve = false, resolver = "oxc", cjsDefault = false,
|
|
854
|
+
function resolveOptions({ cwd = process.cwd(), dtsInput = false, emitDtsOnly = false, tsconfig, tsconfigRaw: overriddenTsconfigRaw = {}, compilerOptions = {}, sourcemap, resolve = false, resolver = "oxc", cjsDefault = false, sideEffects = false, build = false, incremental = false, vue = false, tsMacro = false, parallel = false, eager = false, newContext = false, emitJs, oxc, tsgo = false }) {
|
|
886
855
|
let resolvedTsconfig;
|
|
887
856
|
if (tsconfig === true || tsconfig == null) {
|
|
888
857
|
const { config, path: path$1 } = getTsconfig(cwd) || {};
|
|
@@ -932,8 +901,6 @@ function resolveOptions({ cwd = process.cwd(), dtsInput = false, emitDtsOnly = f
|
|
|
932
901
|
resolve,
|
|
933
902
|
resolver,
|
|
934
903
|
cjsDefault,
|
|
935
|
-
banner,
|
|
936
|
-
footer,
|
|
937
904
|
sideEffects,
|
|
938
905
|
build,
|
|
939
906
|
incremental,
|
|
@@ -1040,7 +1007,6 @@ function dts(options = {}) {
|
|
|
1040
1007
|
if (options.dtsInput) plugins.push(createDtsInputPlugin(resolved));
|
|
1041
1008
|
else plugins.push(createGeneratePlugin(resolved));
|
|
1042
1009
|
plugins.push(createDtsResolvePlugin(resolved), createFakeJsPlugin(resolved));
|
|
1043
|
-
if (options.banner || options.footer) plugins.push(createBannerPlugin(resolved));
|
|
1044
1010
|
return plugins;
|
|
1045
1011
|
}
|
|
1046
1012
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rolldown-plugin-dts",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.19.0",
|
|
5
5
|
"description": "A Rolldown plugin to generate and bundle dts files.",
|
|
6
6
|
"author": "Kevin Deng <sxzz@sxzz.moe>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"peerDependencies": {
|
|
46
46
|
"@ts-macro/tsc": "^0.3.6",
|
|
47
47
|
"@typescript/native-preview": ">=7.0.0-dev.20250601.1",
|
|
48
|
-
"rolldown": "^1.0.0-beta.
|
|
48
|
+
"rolldown": "^1.0.0-beta.55",
|
|
49
49
|
"typescript": "^5.0.0",
|
|
50
50
|
"vue-tsc": "~3.1.0"
|
|
51
51
|
},
|
|
@@ -77,10 +77,10 @@
|
|
|
77
77
|
"devDependencies": {
|
|
78
78
|
"@sxzz/eslint-config": "^7.4.3",
|
|
79
79
|
"@sxzz/prettier-config": "^2.2.6",
|
|
80
|
-
"@sxzz/test-utils": "^0.5.
|
|
80
|
+
"@sxzz/test-utils": "^0.5.15",
|
|
81
81
|
"@types/babel__generator": "^7.27.0",
|
|
82
|
-
"@types/node": "^25.0.
|
|
83
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
82
|
+
"@types/node": "^25.0.3",
|
|
83
|
+
"@typescript/native-preview": "7.0.0-dev.20251217.1",
|
|
84
84
|
"@volar/typescript": "^2.4.27",
|
|
85
85
|
"@vue/language-core": "^3.1.8",
|
|
86
86
|
"arktype": "^2.1.29",
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
"diff": "^8.0.2",
|
|
89
89
|
"eslint": "^9.39.2",
|
|
90
90
|
"prettier": "^3.7.4",
|
|
91
|
-
"rolldown": "^1.0.0-beta.
|
|
91
|
+
"rolldown": "^1.0.0-beta.55",
|
|
92
92
|
"rolldown-plugin-require-cjs": "^0.3.3",
|
|
93
93
|
"rollup-plugin-dts": "^6.3.0",
|
|
94
94
|
"tinyglobby": "^0.2.15",
|