tsdown 0.6.10 → 0.7.1
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-DZHHBSOL.js} +67 -75
- package/dist/index.d.ts +9 -21
- package/dist/index.js +19 -12
- package/dist/{migrate-BHmos2OO.js → migrate-DSjN3NWz.js} +6 -21
- package/dist/{options.d-CLfwY926.d.ts → options.d-BGqD3zwd.d.ts} +18 -17
- package/dist/package-BJ0L6v49.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 +8 -8
- package/dist/package-DjM_DJr5.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,88 +55,35 @@ 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
|
-
|
|
65
|
+
async function bundleDts(options, jsExtension, format) {
|
|
66
|
+
debug$1("Bundle dts for %s", format);
|
|
67
|
+
const { dts: dts$1, bundleDts: bundleDts$1 } = options;
|
|
105
68
|
const ext = jsExtension.replace("j", "t");
|
|
106
69
|
const dtsOutDir = path.resolve(options.outDir, getTempDtsDir(format));
|
|
107
70
|
const dtsEntry = Object.fromEntries(Object.keys(options.entry).map((key) => [key, path.resolve(dtsOutDir, `${key}.d.${ext}`)]));
|
|
108
|
-
|
|
71
|
+
let outDir = options.outDir;
|
|
72
|
+
if (dts$1.extraOutdir) outDir = path.resolve(outDir, dts$1.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
|
-
|
|
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
|
+
chunkFileNames: `[name]-[hash].d.${ext}`
|
|
83
|
+
}
|
|
138
84
|
});
|
|
139
85
|
await fsRemove(dtsOutDir);
|
|
86
|
+
debug$1("Bundle dts done for %s", format);
|
|
140
87
|
}
|
|
141
88
|
let resolver;
|
|
142
89
|
function ResolveDtsPlugin(resolveOnly) {
|
|
@@ -151,7 +98,14 @@ function ResolveDtsPlugin(resolveOnly) {
|
|
|
151
98
|
"import",
|
|
152
99
|
"require"
|
|
153
100
|
],
|
|
154
|
-
extensions: [
|
|
101
|
+
extensions: [
|
|
102
|
+
".d.ts",
|
|
103
|
+
".d.mts",
|
|
104
|
+
".d.cts",
|
|
105
|
+
".ts",
|
|
106
|
+
".mts",
|
|
107
|
+
".cts"
|
|
108
|
+
],
|
|
155
109
|
modules: ["node_modules", "node_modules/@types"]
|
|
156
110
|
});
|
|
157
111
|
},
|
|
@@ -164,23 +118,61 @@ function ResolveDtsPlugin(resolveOnly) {
|
|
|
164
118
|
return value.test(id);
|
|
165
119
|
});
|
|
166
120
|
if (!shouldResolve) {
|
|
167
|
-
debug("skipped by matching resolveOnly: %s", id);
|
|
121
|
+
debug$1("skipped by matching resolveOnly: %s", id);
|
|
168
122
|
return;
|
|
169
123
|
}
|
|
170
124
|
}
|
|
171
125
|
const directory = importer ? path.dirname(importer) : process.cwd();
|
|
172
|
-
debug("Resolving:", id, "from:", directory);
|
|
126
|
+
debug$1("Resolving:", id, "from:", directory);
|
|
173
127
|
const { path: resolved } = await resolver.async(directory, id);
|
|
174
128
|
if (!resolved) return;
|
|
175
|
-
debug("Resolved:", resolved);
|
|
129
|
+
debug$1("Resolved:", resolved);
|
|
176
130
|
if (/[cm]?jsx?$/.test(resolved)) {
|
|
177
|
-
const dts = resolved.replace(/\.([cm]?)jsx?$/, ".d.$1ts");
|
|
178
|
-
return await fsExists(dts) ? dts : void 0;
|
|
131
|
+
const dts$1 = resolved.replace(/\.([cm]?)jsx?$/, ".d.$1ts");
|
|
132
|
+
return await fsExists(dts$1) ? dts$1 : void 0;
|
|
179
133
|
}
|
|
180
134
|
return resolved;
|
|
181
135
|
}
|
|
182
136
|
};
|
|
183
137
|
}
|
|
184
138
|
|
|
139
|
+
//#endregion
|
|
140
|
+
//#region src/features/external.ts
|
|
141
|
+
const debug = Debug("tsdown:external");
|
|
142
|
+
function ExternalPlugin(options, pkg) {
|
|
143
|
+
const deps = pkg && Array.from(getProductionDeps(pkg));
|
|
144
|
+
return {
|
|
145
|
+
name: "tsdown:external",
|
|
146
|
+
async resolveId(id, importer, { isEntry }) {
|
|
147
|
+
if (isEntry) return;
|
|
148
|
+
const { noExternal } = options;
|
|
149
|
+
if (typeof noExternal === "function" && noExternal(id, importer)) return;
|
|
150
|
+
if (noExternal) {
|
|
151
|
+
const noExternalPatterns = toArray(noExternal);
|
|
152
|
+
if (noExternalPatterns.some((pattern) => {
|
|
153
|
+
return pattern instanceof RegExp ? pattern.test(id) : id === pattern;
|
|
154
|
+
})) return;
|
|
155
|
+
}
|
|
156
|
+
let shouldExternal = false;
|
|
157
|
+
if (options.skipNodeModulesBundle) {
|
|
158
|
+
const resolved = await this.resolve(id);
|
|
159
|
+
if (!resolved) return;
|
|
160
|
+
shouldExternal = resolved.external || /[\\/]node_modules[\\/]/.test(resolved.id);
|
|
161
|
+
}
|
|
162
|
+
if (deps) shouldExternal ||= deps.some((dep) => id === dep || id.startsWith(`${dep}/`));
|
|
163
|
+
if (shouldExternal) {
|
|
164
|
+
debug("External dependency:", id);
|
|
165
|
+
return {
|
|
166
|
+
id,
|
|
167
|
+
external: shouldExternal
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
function getProductionDeps(pkg) {
|
|
174
|
+
return new Set([...Object.keys(pkg.dependencies || {}), ...Object.keys(pkg.peerDependencies || {})]);
|
|
175
|
+
}
|
|
176
|
+
|
|
185
177
|
//#endregion
|
|
186
178
|
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-DZHHBSOL.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-BJ0L6v49.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-BJ0L6v49.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-DSjN3NWz.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.1",
|
|
4
4
|
"description": "An even faster bundler powered by Rolldown.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -60,25 +60,25 @@
|
|
|
60
60
|
"consola": "^3.4.2",
|
|
61
61
|
"debug": "^4.4.0",
|
|
62
62
|
"diff": "^7.0.0",
|
|
63
|
+
"find-up-simple": "^1.0.1",
|
|
63
64
|
"oxc-resolver": "^5.0.1",
|
|
64
|
-
"pkg-types": "^2.1.0",
|
|
65
65
|
"rolldown": "^1.0.0-beta.7",
|
|
66
|
-
"
|
|
67
|
-
"rollup-plugin-dts": "^6.2.1",
|
|
66
|
+
"rolldown-plugin-dts": "https://pkg.pr.new/sxzz/rolldown-plugin-dts@7b446ed",
|
|
68
67
|
"tinyglobby": "^0.2.12",
|
|
69
68
|
"unconfig": "^7.3.1",
|
|
70
69
|
"unplugin-isolated-decl": "^0.13.5"
|
|
71
70
|
},
|
|
72
71
|
"devDependencies": {
|
|
73
|
-
"@sxzz/eslint-config": "^6.1.
|
|
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
76
|
"@types/diff": "^7.0.2",
|
|
78
77
|
"@types/node": "^22.13.14",
|
|
79
78
|
"bumpp": "^10.1.0",
|
|
80
79
|
"eslint": "^9.23.0",
|
|
81
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
84
|
"tinyexec": "^1.0.1",
|
|
@@ -87,8 +87,8 @@
|
|
|
87
87
|
"typescript": "~5.8.2",
|
|
88
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"
|