tsdown 0.6.9 → 0.7.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/dist/config.d-ByMb52kT.d.ts +7 -0
- package/dist/config.d.ts +3 -12
- package/dist/{dts-1peUIB3t.js → external-UOzsEfbe.js} +57 -74
- package/dist/index.d.ts +9 -21
- package/dist/index.js +19 -12
- package/dist/{migrate-BE_ZyLSg.js → migrate-C215d2_a.js} +6 -21
- package/dist/{options.d-CLfwY926.d.ts → options.d-BGqD3zwd.d.ts} +18 -17
- package/dist/package-D9ZwWI0B.js +6 -0
- package/dist/plugins.d.ts +9 -10
- package/dist/plugins.js +1 -1
- package/dist/run.d.ts +1 -2
- package/dist/run.js +2 -2
- package/package.json +18 -18
- package/dist/package-7shDmypH.js +0 -6
package/dist/config.d.ts
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import 'rolldown';
|
|
4
|
-
import 'typescript';
|
|
5
|
-
import 'unplugin-isolated-decl';
|
|
6
|
-
import 'unplugin-unused';
|
|
1
|
+
import "./options.d-BGqD3zwd.js";
|
|
2
|
+
import { defineConfig } from "./config.d-ByMb52kT.js";
|
|
7
3
|
|
|
8
|
-
|
|
9
|
-
* Defines the configuration for tsdown.
|
|
10
|
-
*/
|
|
11
|
-
declare function defineConfig(options: UserConfig): UserConfig;
|
|
12
|
-
|
|
13
|
-
export { defineConfig };
|
|
4
|
+
export { defineConfig };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import path, { dirname, normalize, sep } from "node:path";
|
|
2
2
|
import process from "node:process";
|
|
3
|
+
import { build } from "rolldown";
|
|
3
4
|
import { access, rm } from "node:fs/promises";
|
|
4
5
|
import Debug from "debug";
|
|
5
6
|
import { ResolverFactory } from "oxc-resolver";
|
|
6
|
-
import {
|
|
7
|
-
import DtsPlugin from "rollup-plugin-dts";
|
|
7
|
+
import { dts } from "rolldown-plugin-dts";
|
|
8
8
|
|
|
9
9
|
//#region src/utils/fs.ts
|
|
10
10
|
function fsExists(path$1) {
|
|
@@ -55,86 +55,31 @@ function debounce(fn, wait) {
|
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
//#endregion
|
|
59
|
-
//#region src/features/external.ts
|
|
60
|
-
const debug$1 = Debug("tsdown:external");
|
|
61
|
-
function ExternalPlugin(options, pkg) {
|
|
62
|
-
const deps = pkg && Array.from(getProductionDeps(pkg));
|
|
63
|
-
return {
|
|
64
|
-
name: "tsdown:external",
|
|
65
|
-
async resolveId(id, importer, { isEntry }) {
|
|
66
|
-
if (isEntry) return;
|
|
67
|
-
const { noExternal } = options;
|
|
68
|
-
if (typeof noExternal === "function" && noExternal(id, importer)) return;
|
|
69
|
-
if (noExternal) {
|
|
70
|
-
const noExternalPatterns = toArray(noExternal);
|
|
71
|
-
if (noExternalPatterns.some((pattern) => {
|
|
72
|
-
return pattern instanceof RegExp ? pattern.test(id) : id === pattern;
|
|
73
|
-
})) return;
|
|
74
|
-
}
|
|
75
|
-
let shouldExternal = false;
|
|
76
|
-
if (options.skipNodeModulesBundle) {
|
|
77
|
-
const resolved = await this.resolve(id);
|
|
78
|
-
if (!resolved) return;
|
|
79
|
-
shouldExternal = resolved.external || /[\\/]node_modules[\\/]/.test(resolved.id);
|
|
80
|
-
}
|
|
81
|
-
if (deps) shouldExternal ||= deps.some((dep) => id === dep || id.startsWith(`${dep}/`));
|
|
82
|
-
if (shouldExternal) {
|
|
83
|
-
debug$1("External dependency:", id);
|
|
84
|
-
return {
|
|
85
|
-
id,
|
|
86
|
-
external: shouldExternal
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
function getProductionDeps(pkg) {
|
|
93
|
-
return new Set([...Object.keys(pkg.dependencies || {}), ...Object.keys(pkg.peerDependencies || {})]);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
58
|
//#endregion
|
|
97
59
|
//#region src/features/dts.ts
|
|
98
|
-
const debug = Debug("tsdown:dts");
|
|
60
|
+
const debug$1 = Debug("tsdown:dts");
|
|
99
61
|
const TEMP_DTS_DIR = ".tsdown-types";
|
|
100
62
|
function getTempDtsDir(format) {
|
|
101
63
|
return `${TEMP_DTS_DIR}-${format}`;
|
|
102
64
|
}
|
|
103
|
-
async function bundleDts(options, jsExtension, format
|
|
104
|
-
const { dts, bundleDts: bundleDts$1 } = options;
|
|
65
|
+
async function bundleDts(options, jsExtension, format) {
|
|
66
|
+
const { dts: dts$1, bundleDts: bundleDts$1 } = options;
|
|
105
67
|
const ext = jsExtension.replace("j", "t");
|
|
106
68
|
const dtsOutDir = path.resolve(options.outDir, getTempDtsDir(format));
|
|
107
69
|
const dtsEntry = Object.fromEntries(Object.keys(options.entry).map((key) => [key, path.resolve(dtsOutDir, `${key}.d.${ext}`)]));
|
|
108
|
-
|
|
70
|
+
let outDir = options.outDir;
|
|
71
|
+
const extraOutdir = dts$1.extraOutdir;
|
|
72
|
+
if (extraOutdir) outDir = path.resolve(outDir, extraOutdir);
|
|
73
|
+
await build({
|
|
109
74
|
input: dtsEntry,
|
|
110
|
-
external: options.external,
|
|
111
75
|
onLog(level, log, defaultHandler) {
|
|
112
76
|
if (log.code !== "EMPTY_BUNDLE" && log.code !== "UNRESOLVED_IMPORT") defaultHandler(level, log);
|
|
113
77
|
},
|
|
114
|
-
plugins: [
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
declaration: true,
|
|
120
|
-
noEmit: false,
|
|
121
|
-
emitDeclarationOnly: true,
|
|
122
|
-
noEmitOnError: true,
|
|
123
|
-
checkJs: false,
|
|
124
|
-
declarationMap: false,
|
|
125
|
-
skipLibCheck: true,
|
|
126
|
-
preserveSymlinks: false,
|
|
127
|
-
target: 99
|
|
128
|
-
} })
|
|
129
|
-
]
|
|
130
|
-
});
|
|
131
|
-
let outDir = options.outDir;
|
|
132
|
-
const extraOutdir = dts.extraOutdir;
|
|
133
|
-
if (extraOutdir) outDir = path.resolve(outDir, extraOutdir);
|
|
134
|
-
await build.write({
|
|
135
|
-
dir: outDir,
|
|
136
|
-
format: "es",
|
|
137
|
-
entryFileNames: `[name].d.${ext}`
|
|
78
|
+
plugins: [bundleDts$1.resolve && ResolveDtsPlugin(bundleDts$1.resolve !== true ? bundleDts$1.resolve : void 0), dts()],
|
|
79
|
+
output: {
|
|
80
|
+
dir: outDir,
|
|
81
|
+
entryFileNames: `[name].d.${ext}`
|
|
82
|
+
}
|
|
138
83
|
});
|
|
139
84
|
await fsRemove(dtsOutDir);
|
|
140
85
|
}
|
|
@@ -164,23 +109,61 @@ function ResolveDtsPlugin(resolveOnly) {
|
|
|
164
109
|
return value.test(id);
|
|
165
110
|
});
|
|
166
111
|
if (!shouldResolve) {
|
|
167
|
-
debug("skipped by matching resolveOnly: %s", id);
|
|
112
|
+
debug$1("skipped by matching resolveOnly: %s", id);
|
|
168
113
|
return;
|
|
169
114
|
}
|
|
170
115
|
}
|
|
171
116
|
const directory = importer ? path.dirname(importer) : process.cwd();
|
|
172
|
-
debug("Resolving:", id, "from:", directory);
|
|
117
|
+
debug$1("Resolving:", id, "from:", directory);
|
|
173
118
|
const { path: resolved } = await resolver.async(directory, id);
|
|
174
119
|
if (!resolved) return;
|
|
175
|
-
debug("Resolved:", resolved);
|
|
120
|
+
debug$1("Resolved:", resolved);
|
|
176
121
|
if (/[cm]?jsx?$/.test(resolved)) {
|
|
177
|
-
const dts = resolved.replace(/\.([cm]?)jsx?$/, ".d.$1ts");
|
|
178
|
-
return await fsExists(dts) ? dts : void 0;
|
|
122
|
+
const dts$1 = resolved.replace(/\.([cm]?)jsx?$/, ".d.$1ts");
|
|
123
|
+
return await fsExists(dts$1) ? dts$1 : void 0;
|
|
179
124
|
}
|
|
180
125
|
return resolved;
|
|
181
126
|
}
|
|
182
127
|
};
|
|
183
128
|
}
|
|
184
129
|
|
|
130
|
+
//#endregion
|
|
131
|
+
//#region src/features/external.ts
|
|
132
|
+
const debug = Debug("tsdown:external");
|
|
133
|
+
function ExternalPlugin(options, pkg) {
|
|
134
|
+
const deps = pkg && Array.from(getProductionDeps(pkg));
|
|
135
|
+
return {
|
|
136
|
+
name: "tsdown:external",
|
|
137
|
+
async resolveId(id, importer, { isEntry }) {
|
|
138
|
+
if (isEntry) return;
|
|
139
|
+
const { noExternal } = options;
|
|
140
|
+
if (typeof noExternal === "function" && noExternal(id, importer)) return;
|
|
141
|
+
if (noExternal) {
|
|
142
|
+
const noExternalPatterns = toArray(noExternal);
|
|
143
|
+
if (noExternalPatterns.some((pattern) => {
|
|
144
|
+
return pattern instanceof RegExp ? pattern.test(id) : id === pattern;
|
|
145
|
+
})) return;
|
|
146
|
+
}
|
|
147
|
+
let shouldExternal = false;
|
|
148
|
+
if (options.skipNodeModulesBundle) {
|
|
149
|
+
const resolved = await this.resolve(id);
|
|
150
|
+
if (!resolved) return;
|
|
151
|
+
shouldExternal = resolved.external || /[\\/]node_modules[\\/]/.test(resolved.id);
|
|
152
|
+
}
|
|
153
|
+
if (deps) shouldExternal ||= deps.some((dep) => id === dep || id.startsWith(`${dep}/`));
|
|
154
|
+
if (shouldExternal) {
|
|
155
|
+
debug("External dependency:", id);
|
|
156
|
+
return {
|
|
157
|
+
id,
|
|
158
|
+
external: shouldExternal
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
function getProductionDeps(pkg) {
|
|
165
|
+
return new Set([...Object.keys(pkg.dependencies || {}), ...Object.keys(pkg.peerDependencies || {})]);
|
|
166
|
+
}
|
|
167
|
+
|
|
185
168
|
//#endregion
|
|
186
169
|
export { ExternalPlugin, ResolveDtsPlugin, bundleDts, debounce, fsExists, fsRemove, getTempDtsDir, lowestCommonAncestor, toArray };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,28 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { ConsolaInstance } from
|
|
4
|
-
|
|
5
|
-
import 'publint';
|
|
6
|
-
import 'rolldown';
|
|
7
|
-
import 'typescript';
|
|
8
|
-
import 'unplugin-isolated-decl';
|
|
9
|
-
import 'unplugin-unused';
|
|
1
|
+
import { Options, ResolvedOptions, UserConfig } from "./options.d-BGqD3zwd.js";
|
|
2
|
+
import { defineConfig } from "./config.d-ByMb52kT.js";
|
|
3
|
+
import { ConsolaInstance } from "consola";
|
|
4
|
+
import "debug";
|
|
10
5
|
|
|
11
|
-
|
|
12
|
-
* Logger instance
|
|
13
|
-
*/
|
|
6
|
+
//#region dist/.tsdown-types-es/utils/logger.d.ts
|
|
14
7
|
declare const logger: ConsolaInstance;
|
|
15
8
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
*/
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region dist/.tsdown-types-es/index.d.ts
|
|
19
11
|
declare function build(userOptions?: Options): Promise<void>;
|
|
20
12
|
declare const pkgRoot: string;
|
|
21
|
-
/**
|
|
22
|
-
* Build a single configuration, without watch and shortcuts features.
|
|
23
|
-
*
|
|
24
|
-
* @param config Resolved options
|
|
25
|
-
*/
|
|
26
13
|
declare function buildSingle(config: ResolvedOptions): Promise<(() => Promise<void>) | undefined>;
|
|
27
14
|
|
|
28
|
-
|
|
15
|
+
//#endregion
|
|
16
|
+
export { Options, UserConfig, build, buildSingle, defineConfig, logger, pkgRoot };
|
package/dist/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { defineConfig } from "./config-0LDjKwZ7.js";
|
|
2
|
-
import { ExternalPlugin, bundleDts, debounce, fsExists, fsRemove, getTempDtsDir, lowestCommonAncestor, toArray } from "./
|
|
2
|
+
import { ExternalPlugin, bundleDts, debounce, fsExists, fsRemove, getTempDtsDir, lowestCommonAncestor, toArray } from "./external-UOzsEfbe.js";
|
|
3
3
|
import { debug, logger, setSilent } from "./logger-9p9U7Sx7.js";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import process from "node:process";
|
|
6
|
-
import { fileURLToPath } from "node:url";
|
|
6
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
7
7
|
import { build as build$1 } from "rolldown";
|
|
8
8
|
import { transformPlugin } from "rolldown/experimental";
|
|
9
|
-
import { readdir, stat } from "node:fs/promises";
|
|
9
|
+
import { readFile, readdir, stat } from "node:fs/promises";
|
|
10
10
|
import Debug from "debug";
|
|
11
11
|
import { glob } from "tinyglobby";
|
|
12
|
-
import {
|
|
12
|
+
import { findUp } from "find-up-simple";
|
|
13
13
|
import readline from "node:readline";
|
|
14
14
|
import { blue, bold, dim, underline } from "ansis";
|
|
15
15
|
import { loadConfig } from "unconfig";
|
|
@@ -33,11 +33,11 @@ async function cleanOutDir(cwd, patterns) {
|
|
|
33
33
|
//#endregion
|
|
34
34
|
//#region src/utils/package.ts
|
|
35
35
|
async function readPackageJson(dir) {
|
|
36
|
-
const packageJsonPath =
|
|
37
|
-
|
|
38
|
-
if (!exists) return;
|
|
36
|
+
const packageJsonPath = await findUp("package.json", { cwd: dir });
|
|
37
|
+
if (!packageJsonPath) return;
|
|
39
38
|
debug("Reading package.json:", packageJsonPath);
|
|
40
|
-
|
|
39
|
+
const contents = await readFile(packageJsonPath, "utf8");
|
|
40
|
+
return JSON.parse(contents);
|
|
41
41
|
}
|
|
42
42
|
function getPackageType(pkg) {
|
|
43
43
|
if (pkg?.type) {
|
|
@@ -262,6 +262,7 @@ async function resolveOptions(options) {
|
|
|
262
262
|
file
|
|
263
263
|
};
|
|
264
264
|
}
|
|
265
|
+
let loaded = false;
|
|
265
266
|
async function loadConfigFile(options) {
|
|
266
267
|
let cwd = process.cwd();
|
|
267
268
|
let overrideConfig = false;
|
|
@@ -281,7 +282,8 @@ async function loadConfigFile(options) {
|
|
|
281
282
|
} else if (stats.isDirectory()) cwd = resolved;
|
|
282
283
|
}
|
|
283
284
|
}
|
|
284
|
-
const
|
|
285
|
+
const nativeTS = process.features.typescript || process.versions.bun || process.versions.deno;
|
|
286
|
+
const { config, sources } = await loadConfig.async({
|
|
285
287
|
sources: overrideConfig ? [{
|
|
286
288
|
files: filePath,
|
|
287
289
|
extensions: []
|
|
@@ -296,7 +298,12 @@ async function loadConfigFile(options) {
|
|
|
296
298
|
"cjs",
|
|
297
299
|
"json",
|
|
298
300
|
""
|
|
299
|
-
]
|
|
301
|
+
],
|
|
302
|
+
parser: loaded || !nativeTS ? "auto" : async (filepath) => {
|
|
303
|
+
const mod = await import(pathToFileURL(filepath).href);
|
|
304
|
+
const config$1 = mod.default || mod;
|
|
305
|
+
return config$1;
|
|
306
|
+
}
|
|
300
307
|
}, {
|
|
301
308
|
files: "package.json",
|
|
302
309
|
extensions: [],
|
|
@@ -304,7 +311,7 @@ async function loadConfigFile(options) {
|
|
|
304
311
|
}],
|
|
305
312
|
cwd,
|
|
306
313
|
defaults: {}
|
|
307
|
-
});
|
|
314
|
+
}).finally(() => loaded = true);
|
|
308
315
|
if (sources.length > 0) logger.info(`Using tsdown config: ${underline(sources.join(", "))}`);
|
|
309
316
|
const file = sources[0];
|
|
310
317
|
return {
|
|
@@ -414,7 +421,7 @@ async function buildSingle(config) {
|
|
|
414
421
|
...inputOptions,
|
|
415
422
|
output: outputOptions
|
|
416
423
|
});
|
|
417
|
-
if (config.dts && config.bundleDts) await bundleDts(config, extension, format$1
|
|
424
|
+
if (config.dts && config.bundleDts) await bundleDts(config, extension, format$1);
|
|
418
425
|
}));
|
|
419
426
|
if (config.publint) if (pkg) await publint(pkg);
|
|
420
427
|
else logger.warn("publint is enabled but package.json is not found");
|
|
@@ -1,26 +1,9 @@
|
|
|
1
|
-
import { version } from "./package-
|
|
1
|
+
import { version } from "./package-D9ZwWI0B.js";
|
|
2
2
|
import process from "node:process";
|
|
3
3
|
import { readFile, unlink, writeFile } from "node:fs/promises";
|
|
4
4
|
import consola from "consola";
|
|
5
|
-
import { gray, green, red } from "ansis";
|
|
6
5
|
import { existsSync } from "node:fs";
|
|
7
|
-
import { diffLines } from "diff";
|
|
8
6
|
|
|
9
|
-
//#region src/utils/diff.ts
|
|
10
|
-
function diff(original, updated) {
|
|
11
|
-
let text = "";
|
|
12
|
-
const diff$1 = diffLines(original, updated, {
|
|
13
|
-
ignoreWhitespace: true,
|
|
14
|
-
ignoreNewlineAtEof: true
|
|
15
|
-
});
|
|
16
|
-
for (const line of diff$1) {
|
|
17
|
-
const { value } = line;
|
|
18
|
-
text += line.added ? green(value) : line.removed ? red(value) : gray(line.value);
|
|
19
|
-
}
|
|
20
|
-
return text;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
//#endregion
|
|
24
7
|
//#region src/migrate.ts
|
|
25
8
|
async function migrate({ cwd, dryRun }) {
|
|
26
9
|
if (dryRun) consola.info("Dry run enabled. No changes were made.");
|
|
@@ -83,8 +66,9 @@ async function migratePackageJson(dryRun) {
|
|
|
83
66
|
}
|
|
84
67
|
const pkgStr = `${JSON.stringify(pkg, null, 2)}\n`;
|
|
85
68
|
if (dryRun) {
|
|
69
|
+
const { createPatch } = await import("diff");
|
|
86
70
|
consola.info("[dry-run] package.json:");
|
|
87
|
-
console.info(
|
|
71
|
+
console.info(createPatch("package.json", pkgRaw, pkgStr));
|
|
88
72
|
} else {
|
|
89
73
|
await writeFile("package.json", pkgStr);
|
|
90
74
|
consola.success("Migrated `package.json`");
|
|
@@ -107,11 +91,12 @@ async function migrateTsupConfig(dryRun) {
|
|
|
107
91
|
consola.info(`Found \`${file}\``);
|
|
108
92
|
found = true;
|
|
109
93
|
const tsupConfigRaw = await readFile(file, "utf-8");
|
|
110
|
-
const tsupConfig = tsupConfigRaw.replaceAll(/\btsup\b/g, "tsdown").
|
|
94
|
+
const tsupConfig = tsupConfigRaw.replaceAll(/\btsup\b/g, "tsdown").replaceAll(/\bTSUP\b/g, "TSDOWN");
|
|
111
95
|
const renamed = file.replaceAll("tsup", "tsdown");
|
|
112
96
|
if (dryRun) {
|
|
97
|
+
const { createTwoFilesPatch } = await import("diff");
|
|
113
98
|
consola.info(`[dry-run] ${file} -> ${renamed}:`);
|
|
114
|
-
console.info(
|
|
99
|
+
console.info(createTwoFilesPatch(file, renamed, tsupConfigRaw, tsupConfig));
|
|
115
100
|
} else {
|
|
116
101
|
await writeFile(renamed, tsupConfig, "utf8");
|
|
117
102
|
await unlink(file);
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { Options
|
|
2
|
-
import { InputOptions,
|
|
3
|
-
import { CompilerOptions } from
|
|
4
|
-
import { Options as Options$1 } from
|
|
5
|
-
import { Options as Options$2 } from
|
|
1
|
+
import { Options } from "publint";
|
|
2
|
+
import { ExternalOption, InputOptions, InternalModuleFormat, ModuleFormat, OutputOptions } from "rolldown";
|
|
3
|
+
import { CompilerOptions } from "typescript";
|
|
4
|
+
import { Options as Options$1 } from "unplugin-isolated-decl";
|
|
5
|
+
import { Options as Options$2 } from "unplugin-unused";
|
|
6
6
|
|
|
7
|
+
//#region dist/.tsdown-types-es/utils/types.d.ts
|
|
7
8
|
type Overwrite<
|
|
8
9
|
T,
|
|
9
10
|
U
|
|
@@ -15,16 +16,15 @@ type MarkPartial<
|
|
|
15
16
|
> = Omit<Required<T>, K> & Partial<Pick<T, K>>;
|
|
16
17
|
type Arrayable<T> = T | T[];
|
|
17
18
|
|
|
19
|
+
//#endregion
|
|
20
|
+
//#region dist/.tsdown-types-es/options.d.ts
|
|
18
21
|
type Sourcemap = boolean | "inline" | "hidden";
|
|
19
22
|
interface BundleDtsOptions {
|
|
20
23
|
/** Resolve external types used in dts files from node_modules */
|
|
21
24
|
resolve?: boolean | (string | RegExp)[];
|
|
22
25
|
compilerOptions?: CompilerOptions;
|
|
23
26
|
}
|
|
24
|
-
|
|
25
|
-
* Options for tsdown.
|
|
26
|
-
*/
|
|
27
|
-
interface Options {
|
|
27
|
+
interface Options$3 {
|
|
28
28
|
entry?: InputOptions["input"];
|
|
29
29
|
external?: ExternalOption;
|
|
30
30
|
noExternal?: Arrayable<string | RegExp> | ((id: string, importer: string | undefined) => boolean | null | undefined | void);
|
|
@@ -70,7 +70,10 @@ interface Options {
|
|
|
70
70
|
* Enable dts generation with `isolatedDeclarations` (experimental)
|
|
71
71
|
*/
|
|
72
72
|
dts?: boolean | Options$1;
|
|
73
|
-
/**
|
|
73
|
+
/**
|
|
74
|
+
* Bundle dts files (experimental)
|
|
75
|
+
* @default true
|
|
76
|
+
*/
|
|
74
77
|
bundleDts?: boolean | BundleDtsOptions;
|
|
75
78
|
/**
|
|
76
79
|
* Enable unused dependencies check with `unplugin-unused`
|
|
@@ -81,18 +84,16 @@ interface Options {
|
|
|
81
84
|
* Run publint after bundling.
|
|
82
85
|
* Requires `publint` to be installed.
|
|
83
86
|
*/
|
|
84
|
-
publint?: boolean | Options
|
|
87
|
+
publint?: boolean | Options;
|
|
85
88
|
}
|
|
86
|
-
|
|
87
|
-
* Options without specifying config file path.
|
|
88
|
-
*/
|
|
89
|
-
type UserConfig = Arrayable<Omit<Options, "config">>;
|
|
89
|
+
type UserConfig = Arrayable<Omit<Options$3, "config">>;
|
|
90
90
|
type NormalizedFormat = Exclude<InternalModuleFormat, "app"> | "experimental-app";
|
|
91
|
-
type ResolvedOptions = Omit<Overwrite<MarkPartial<Options, "globalName" | "inputOptions" | "outputOptions" | "minify" | "target" | "define" | "alias" | "external" | "noExternal" | "onSuccess" | "dts" | "fixedExtension">, {
|
|
91
|
+
type ResolvedOptions = Omit<Overwrite<MarkPartial<Options$3, "globalName" | "inputOptions" | "outputOptions" | "minify" | "target" | "define" | "alias" | "external" | "noExternal" | "onSuccess" | "dts" | "fixedExtension">, {
|
|
92
92
|
format: NormalizedFormat[]
|
|
93
93
|
clean: string[] | false
|
|
94
94
|
dts: false | Options$1
|
|
95
95
|
bundleDts: false | BundleDtsOptions
|
|
96
96
|
}>, "config" | "fromVite">;
|
|
97
97
|
|
|
98
|
-
|
|
98
|
+
//#endregion
|
|
99
|
+
export { Options$3 as Options, ResolvedOptions, UserConfig };
|
package/dist/plugins.d.ts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { Plugin as Plugin$1 } from 'rollup';
|
|
5
|
-
import 'publint';
|
|
6
|
-
import 'typescript';
|
|
7
|
-
import 'unplugin-isolated-decl';
|
|
8
|
-
import 'unplugin-unused';
|
|
1
|
+
import { ResolvedOptions } from "./options.d-BGqD3zwd.js";
|
|
2
|
+
import { Plugin } from "rolldown";
|
|
3
|
+
import { PackageJson } from "pkg-types";
|
|
9
4
|
|
|
5
|
+
//#region dist/.tsdown-types-es/features/external.d.ts
|
|
10
6
|
declare function ExternalPlugin(options: ResolvedOptions, pkg?: PackageJson): Plugin;
|
|
11
7
|
|
|
12
|
-
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region dist/.tsdown-types-es/features/dts.d.ts
|
|
10
|
+
declare function ResolveDtsPlugin(resolveOnly?: Array<string | RegExp>): Plugin;
|
|
13
11
|
|
|
14
|
-
|
|
12
|
+
//#endregion
|
|
13
|
+
export { ExternalPlugin, ResolveDtsPlugin };
|
package/dist/plugins.js
CHANGED
package/dist/run.d.ts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { }
|
|
1
|
+
export {}
|
package/dist/run.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { logger, setSilent } from "./logger-9p9U7Sx7.js";
|
|
2
|
-
import { version } from "./package-
|
|
2
|
+
import { version } from "./package-D9ZwWI0B.js";
|
|
3
3
|
import process from "node:process";
|
|
4
4
|
import { VERSION } from "rolldown";
|
|
5
5
|
import { dim } from "ansis";
|
|
@@ -16,7 +16,7 @@ cli.command("[...files]", "Bundle files", { ignoreOptionDefaultValue: true }).op
|
|
|
16
16
|
await build$1(flags);
|
|
17
17
|
});
|
|
18
18
|
cli.command("migrate", "Migrate from tsup to tsdown").option("-c, --cwd <dir>", "Working directory").option("-d, --dry-run", "Dry run").action(async (args) => {
|
|
19
|
-
const { migrate } = await import("./migrate-
|
|
19
|
+
const { migrate } = await import("./migrate-C215d2_a.js");
|
|
20
20
|
await migrate(args);
|
|
21
21
|
});
|
|
22
22
|
async function runCLI() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tsdown",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "An even faster bundler powered by Rolldown.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -57,38 +57,38 @@
|
|
|
57
57
|
"ansis": "^3.17.0",
|
|
58
58
|
"cac": "^6.7.14",
|
|
59
59
|
"chokidar": "^4.0.3",
|
|
60
|
-
"consola": "^3.4.
|
|
60
|
+
"consola": "^3.4.2",
|
|
61
61
|
"debug": "^4.4.0",
|
|
62
62
|
"diff": "^7.0.0",
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"rolldown": "1.0.0-beta.
|
|
66
|
-
"
|
|
67
|
-
"rollup-plugin-dts": "^6.1.1",
|
|
63
|
+
"find-up-simple": "^1.0.1",
|
|
64
|
+
"oxc-resolver": "^5.0.1",
|
|
65
|
+
"rolldown": "^1.0.0-beta.7",
|
|
66
|
+
"rolldown-plugin-dts": "https://pkg.pr.new/sxzz/rolldown-plugin-dts@eeb45e0",
|
|
68
67
|
"tinyglobby": "^0.2.12",
|
|
69
68
|
"unconfig": "^7.3.1",
|
|
70
|
-
"unplugin-isolated-decl": "^0.13.
|
|
69
|
+
"unplugin-isolated-decl": "^0.13.5"
|
|
71
70
|
},
|
|
72
71
|
"devDependencies": {
|
|
73
|
-
"@sxzz/eslint-config": "^6.
|
|
72
|
+
"@sxzz/eslint-config": "^6.1.1",
|
|
74
73
|
"@sxzz/prettier-config": "^2.2.1",
|
|
75
|
-
"@sxzz/test-utils": "^0.5.
|
|
74
|
+
"@sxzz/test-utils": "^0.5.4",
|
|
76
75
|
"@types/debug": "^4.1.12",
|
|
77
|
-
"@types/diff": "^7.0.
|
|
78
|
-
"@types/node": "^22.13.
|
|
76
|
+
"@types/diff": "^7.0.2",
|
|
77
|
+
"@types/node": "^22.13.14",
|
|
79
78
|
"bumpp": "^10.1.0",
|
|
80
|
-
"eslint": "^9.
|
|
81
|
-
"oxc-transform": "^0.
|
|
79
|
+
"eslint": "^9.23.0",
|
|
80
|
+
"oxc-transform": "^0.61.2",
|
|
81
|
+
"pkg-types": "^2.1.0",
|
|
82
82
|
"prettier": "^3.5.3",
|
|
83
83
|
"publint": "^0.3.9",
|
|
84
|
-
"tinyexec": "^0.
|
|
84
|
+
"tinyexec": "^1.0.1",
|
|
85
85
|
"tsup": "^8.4.0",
|
|
86
86
|
"tsx": "^4.19.3",
|
|
87
87
|
"typescript": "~5.8.2",
|
|
88
|
-
"unplugin-ast": "^0.14.
|
|
88
|
+
"unplugin-ast": "^0.14.4",
|
|
89
89
|
"unplugin-unused": "^0.4.3",
|
|
90
|
-
"vite": "^6.2.
|
|
91
|
-
"vitest": "^3.
|
|
90
|
+
"vite": "^6.2.4",
|
|
91
|
+
"vitest": "^3.1.1"
|
|
92
92
|
},
|
|
93
93
|
"engines": {
|
|
94
94
|
"node": ">=18.0.0"
|