tsdown 0.13.0 → 0.13.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-CzjtjH-U.mjs → config-CCGWF4al.mjs} +0 -3
- package/dist/config-CZj6NGiw.d.mts +11 -0
- package/dist/config.d.mts +2 -1
- package/dist/config.mjs +1 -1
- package/dist/index.d.mts +35 -2
- package/dist/index.mjs +2 -2
- package/dist/{migrate-B4LQBP_A.mjs → migrate-ZlgAVcyW.mjs} +1 -1
- package/dist/package-DjP1xJYq.mjs +5 -0
- package/dist/plugins.d.mts +1 -1
- package/dist/plugins.mjs +2 -2
- package/dist/run.mjs +2 -2
- package/dist/{src-vU2xJl3a.mjs → src-CbHsyAUh.mjs} +16 -8
- package/dist/{config-9hj-APNF.d.mts → types-DIH2hGTd.d.mts} +20 -55
- package/package.json +16 -18
- package/dist/package-CtrYqHTS.mjs +0 -5
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { UserConfig, UserConfigFn } from "./types-DIH2hGTd.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/config.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Defines the configuration for tsdown.
|
|
7
|
+
*/
|
|
8
|
+
declare function defineConfig(options: UserConfig): UserConfig;
|
|
9
|
+
declare function defineConfig(options: UserConfigFn): UserConfigFn;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { defineConfig };
|
package/dist/config.d.mts
CHANGED
package/dist/config.mjs
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -1,2 +1,35 @@
|
|
|
1
|
-
import { AttwOptions, BuildContext, ChunkAddon, CopyOptions, DtsOptions, ExportsOptions, Format, ModuleTypes, NormalizedFormat, NormalizedUserConfig, Options, PublintOptions, ReportOptions, ResolvedOptions, RolldownContext, Sourcemap, TsdownChunks, TsdownHooks, UnusedOptions, UserConfig, UserConfigFn, Workspace
|
|
2
|
-
|
|
1
|
+
import { AttwOptions, BuildContext, ChunkAddon, ChunkAddonFunction, ChunkAddonObject, CopyEntry, CopyOptions, CopyOptionsFn, DtsOptions, ExportsOptions, Format, ModuleTypes, NormalizedFormat, NormalizedUserConfig, Options, OutExtensionContext, OutExtensionFactory, OutExtensionObject, PackageType, PublintOptions, ReportOptions, ResolvedOptions, RolldownContext, Sourcemap, TsdownChunks, TsdownHooks, UnusedOptions, UserConfig, UserConfigFn, Workspace } from "./types-DIH2hGTd.mjs";
|
|
2
|
+
import { defineConfig } from "./config-CZj6NGiw.mjs";
|
|
3
|
+
import "ansis";
|
|
4
|
+
import { InternalModuleFormat } from "rolldown";
|
|
5
|
+
|
|
6
|
+
//#region src/utils/logger.d.ts
|
|
7
|
+
declare class Logger {
|
|
8
|
+
silent: boolean;
|
|
9
|
+
setSilent(value: boolean): void;
|
|
10
|
+
filter(...args: any[]): any[];
|
|
11
|
+
info(...args: any[]): void;
|
|
12
|
+
warn(...args: any[]): void;
|
|
13
|
+
error(...args: any[]): void;
|
|
14
|
+
success(...args: any[]): void;
|
|
15
|
+
}
|
|
16
|
+
declare const logger: Logger;
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region src/index.d.ts
|
|
19
|
+
/**
|
|
20
|
+
* Build with tsdown.
|
|
21
|
+
*/
|
|
22
|
+
declare function build(userOptions?: Options): Promise<void>;
|
|
23
|
+
/** @internal */
|
|
24
|
+
declare const shimFile: string;
|
|
25
|
+
/**
|
|
26
|
+
* Build a single configuration, without watch and shortcuts features.
|
|
27
|
+
*
|
|
28
|
+
* Internal API, not for public use
|
|
29
|
+
*
|
|
30
|
+
* @private
|
|
31
|
+
* @param config Resolved options
|
|
32
|
+
*/
|
|
33
|
+
declare function buildSingle(config: ResolvedOptions, clean: () => Promise<void>): Promise<(() => Promise<void>) | undefined>;
|
|
34
|
+
//#endregion
|
|
35
|
+
export { AttwOptions, BuildContext, ChunkAddon, ChunkAddonFunction, ChunkAddonObject, CopyEntry, CopyOptions, CopyOptionsFn, DtsOptions, ExportsOptions, Format, type Logger, ModuleTypes, NormalizedFormat, NormalizedUserConfig, type Options, OutExtensionContext, OutExtensionFactory, OutExtensionObject, PackageType, PublintOptions, ReportOptions, type ResolvedOptions, RolldownContext, Sourcemap, TsdownChunks, TsdownHooks, UnusedOptions, type UserConfig, type UserConfigFn, Workspace, build, buildSingle, defineConfig, logger, shimFile };
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineConfig } from "./config-
|
|
2
|
-
import { build, buildSingle, shimFile } from "./src-
|
|
1
|
+
import { defineConfig } from "./config-CCGWF4al.mjs";
|
|
2
|
+
import { build, buildSingle, shimFile } from "./src-CbHsyAUh.mjs";
|
|
3
3
|
import { logger } from "./logger-6IV2T7t1.mjs";
|
|
4
4
|
|
|
5
5
|
export { build, buildSingle, defineConfig, logger, shimFile };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { logger } from "./logger-6IV2T7t1.mjs";
|
|
2
|
-
import { version } from "./package-
|
|
2
|
+
import { version } from "./package-DjP1xJYq.mjs";
|
|
3
3
|
import process from "node:process";
|
|
4
4
|
import { bold, green, underline } from "ansis";
|
|
5
5
|
import { readFile, unlink, writeFile } from "node:fs/promises";
|
package/dist/plugins.d.mts
CHANGED
package/dist/plugins.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./config-
|
|
2
|
-
import { ExternalPlugin, NodeProtocolPlugin, ReportPlugin, ShebangPlugin } from "./src-
|
|
1
|
+
import "./config-CCGWF4al.mjs";
|
|
2
|
+
import { ExternalPlugin, NodeProtocolPlugin, ReportPlugin, ShebangPlugin } from "./src-CbHsyAUh.mjs";
|
|
3
3
|
import "./logger-6IV2T7t1.mjs";
|
|
4
4
|
|
|
5
5
|
export { ExternalPlugin, NodeProtocolPlugin, ReportPlugin, ShebangPlugin };
|
package/dist/run.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { logger, resolveComma, toArray } from "./logger-6IV2T7t1.mjs";
|
|
3
|
-
import { version } from "./package-
|
|
3
|
+
import { version } from "./package-DjP1xJYq.mjs";
|
|
4
4
|
import module from "node:module";
|
|
5
5
|
import process from "node:process";
|
|
6
6
|
import { dim } from "ansis";
|
|
@@ -22,7 +22,7 @@ cli.command("[...files]", "Bundle files", {
|
|
|
22
22
|
await build$1(flags);
|
|
23
23
|
});
|
|
24
24
|
cli.command("migrate", "Migrate from tsup to tsdown").option("-c, --cwd <dir>", "Working directory").option("-d, --dry-run", "Dry run").action(async (args) => {
|
|
25
|
-
const { migrate } = await import("./migrate-
|
|
25
|
+
const { migrate } = await import("./migrate-ZlgAVcyW.mjs");
|
|
26
26
|
await migrate(args);
|
|
27
27
|
});
|
|
28
28
|
async function runCLI() {
|
|
@@ -6,6 +6,7 @@ import { fileURLToPath, pathToFileURL } from "node:url";
|
|
|
6
6
|
import { blue, bold, dim, green, underline } from "ansis";
|
|
7
7
|
import { build } from "rolldown";
|
|
8
8
|
import { exec } from "tinyexec";
|
|
9
|
+
import treeKill from "tree-kill";
|
|
9
10
|
import child_process from "node:child_process";
|
|
10
11
|
import { access, chmod, cp, mkdtemp, readFile, rm, stat, writeFile } from "node:fs/promises";
|
|
11
12
|
import { tmpdir } from "node:os";
|
|
@@ -243,7 +244,10 @@ async function generateExports(pkg, outDir, chunks, { devExports, all, customExp
|
|
|
243
244
|
else main = distFile;
|
|
244
245
|
else if (format === "es") if (isDts) esmTypes = distFile;
|
|
245
246
|
else module$1 = distFile;
|
|
246
|
-
} else
|
|
247
|
+
} else {
|
|
248
|
+
const isDirIndex = name.endsWith("/index");
|
|
249
|
+
name = isDirIndex ? `./${name.slice(0, -6)}` : `./${name}`;
|
|
250
|
+
}
|
|
247
251
|
let subExport = exportsMap.get(name);
|
|
248
252
|
if (!subExport) {
|
|
249
253
|
subExport = {};
|
|
@@ -1117,21 +1121,22 @@ async function build$1(userOptions = {}) {
|
|
|
1117
1121
|
};
|
|
1118
1122
|
logger.info("Build start");
|
|
1119
1123
|
const rebuilds = await Promise.all(configs.map((options) => buildSingle(options, clean)));
|
|
1120
|
-
const
|
|
1124
|
+
const disposeCbs = [];
|
|
1121
1125
|
for (const [i, config] of configs.entries()) {
|
|
1122
1126
|
const rebuild = rebuilds[i];
|
|
1123
1127
|
if (!rebuild) continue;
|
|
1124
1128
|
const watcher = await watchBuild(config, configFiles, rebuild, restart);
|
|
1125
|
-
|
|
1129
|
+
disposeCbs.push(() => watcher.close());
|
|
1126
1130
|
}
|
|
1127
|
-
if (
|
|
1131
|
+
if (disposeCbs.length) shortcuts(restart);
|
|
1128
1132
|
async function restart() {
|
|
1129
|
-
for (const
|
|
1133
|
+
for (const dispose of disposeCbs) await dispose();
|
|
1130
1134
|
build$1(userOptions);
|
|
1131
1135
|
}
|
|
1132
1136
|
}
|
|
1133
1137
|
const dirname$1 = path.dirname(fileURLToPath(import.meta.url));
|
|
1134
1138
|
const pkgRoot = path.resolve(dirname$1, "..");
|
|
1139
|
+
/** @internal */
|
|
1135
1140
|
const shimFile = path.resolve(pkgRoot, "esm-shims.js");
|
|
1136
1141
|
/**
|
|
1137
1142
|
* Build a single configuration, without watch and shortcuts features.
|
|
@@ -1151,7 +1156,8 @@ async function buildSingle(config, clean) {
|
|
|
1151
1156
|
const startTime = performance.now();
|
|
1152
1157
|
await hooks.callHook("build:prepare", context);
|
|
1153
1158
|
ab?.abort();
|
|
1154
|
-
await clean();
|
|
1159
|
+
if (first) await clean();
|
|
1160
|
+
else await cleanOutDir([config]);
|
|
1155
1161
|
let hasErrors = false;
|
|
1156
1162
|
const isMultiFormat = formats.length > 1;
|
|
1157
1163
|
const chunks = {};
|
|
@@ -1186,12 +1192,14 @@ async function buildSingle(config, clean) {
|
|
|
1186
1192
|
if (typeof onSuccess === "string") {
|
|
1187
1193
|
const p = exec(onSuccess, [], { nodeOptions: {
|
|
1188
1194
|
shell: true,
|
|
1189
|
-
stdio: "inherit"
|
|
1190
|
-
signal: ab.signal
|
|
1195
|
+
stdio: "inherit"
|
|
1191
1196
|
} });
|
|
1192
1197
|
p.then(({ exitCode }) => {
|
|
1193
1198
|
if (exitCode) process.exitCode = exitCode;
|
|
1194
1199
|
});
|
|
1200
|
+
ab.signal.addEventListener("abort", () => {
|
|
1201
|
+
if (typeof p.pid === "number") treeKill(p.pid);
|
|
1202
|
+
});
|
|
1195
1203
|
} else await onSuccess?.(config, ab.signal);
|
|
1196
1204
|
}
|
|
1197
1205
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import "ansis";
|
|
2
1
|
import { BuildOptions, ExternalOption, InputOption, InputOptions, InternalModuleFormat, MinifyOptions, ModuleFormat, OutputAsset, OutputChunk, OutputOptions, Plugin } from "rolldown";
|
|
3
2
|
import { Hookable } from "hookable";
|
|
4
3
|
import { CheckPackageOptions } from "@arethetypeswrong/core";
|
|
@@ -47,17 +46,26 @@ interface CopyEntry {
|
|
|
47
46
|
type CopyOptions = Arrayable<string | CopyEntry>;
|
|
48
47
|
type CopyOptionsFn = (options: ResolvedOptions) => Awaitable<CopyOptions>;
|
|
49
48
|
//#endregion
|
|
50
|
-
//#region src/
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
49
|
+
//#region src/features/exports.d.ts
|
|
50
|
+
type TsdownChunks = Partial<Record<NormalizedFormat, Array<OutputChunk | OutputAsset>>>;
|
|
51
|
+
interface ExportsOptions {
|
|
52
|
+
/**
|
|
53
|
+
* Generate exports that link to source code during development.
|
|
54
|
+
* - string: add as a custom condition.
|
|
55
|
+
* - true: all conditions point to source files, and add dist exports to `publishConfig`.
|
|
56
|
+
*/
|
|
57
|
+
devExports?: boolean | string;
|
|
58
|
+
/**
|
|
59
|
+
* Exports for all files.
|
|
60
|
+
*/
|
|
61
|
+
all?: boolean;
|
|
62
|
+
customExports?: (exports: Record<string, any>, context: {
|
|
63
|
+
pkg: PackageJson;
|
|
64
|
+
chunks: TsdownChunks;
|
|
65
|
+
outDir: string;
|
|
66
|
+
isPublish: boolean;
|
|
67
|
+
}) => Awaitable<Record<string, any>>;
|
|
59
68
|
}
|
|
60
|
-
declare const logger: Logger;
|
|
61
69
|
//#endregion
|
|
62
70
|
//#region src/features/hooks.d.ts
|
|
63
71
|
interface BuildContext {
|
|
@@ -89,43 +97,6 @@ interface TsdownHooks {
|
|
|
89
97
|
"build:done": (ctx: BuildContext) => void | Promise<void>;
|
|
90
98
|
}
|
|
91
99
|
//#endregion
|
|
92
|
-
//#region src/index.d.ts
|
|
93
|
-
/**
|
|
94
|
-
* Build with tsdown.
|
|
95
|
-
*/
|
|
96
|
-
declare function build$1(userOptions?: Options): Promise<void>;
|
|
97
|
-
declare const shimFile: string;
|
|
98
|
-
type TsdownChunks = Partial<Record<NormalizedFormat, Array<OutputChunk | OutputAsset>>>;
|
|
99
|
-
/**
|
|
100
|
-
* Build a single configuration, without watch and shortcuts features.
|
|
101
|
-
*
|
|
102
|
-
* Internal API, not for public use
|
|
103
|
-
*
|
|
104
|
-
* @private
|
|
105
|
-
* @param config Resolved options
|
|
106
|
-
*/
|
|
107
|
-
declare function buildSingle(config: ResolvedOptions, clean: () => Promise<void>): Promise<(() => Promise<void>) | undefined>;
|
|
108
|
-
//#endregion
|
|
109
|
-
//#region src/features/exports.d.ts
|
|
110
|
-
interface ExportsOptions {
|
|
111
|
-
/**
|
|
112
|
-
* Generate exports that link to source code during development.
|
|
113
|
-
* - string: add as a custom condition.
|
|
114
|
-
* - true: all conditions point to source files, and add dist exports to `publishConfig`.
|
|
115
|
-
*/
|
|
116
|
-
devExports?: boolean | string;
|
|
117
|
-
/**
|
|
118
|
-
* Exports for all files.
|
|
119
|
-
*/
|
|
120
|
-
all?: boolean;
|
|
121
|
-
customExports?: (exports: Record<string, any>, context: {
|
|
122
|
-
pkg: PackageJson;
|
|
123
|
-
chunks: TsdownChunks;
|
|
124
|
-
outDir: string;
|
|
125
|
-
isPublish: boolean;
|
|
126
|
-
}) => Awaitable<Record<string, any>>;
|
|
127
|
-
}
|
|
128
|
-
//#endregion
|
|
129
100
|
//#region src/utils/package.d.ts
|
|
130
101
|
type PackageType = "module" | "commonjs" | undefined;
|
|
131
102
|
//#endregion
|
|
@@ -463,10 +434,4 @@ type ResolvedOptions = Omit<Overwrite<MarkPartial<Omit<Options, "publicDir" | "w
|
|
|
463
434
|
nodeProtocol: "strip" | boolean;
|
|
464
435
|
}>, "config" | "fromVite">;
|
|
465
436
|
//#endregion
|
|
466
|
-
|
|
467
|
-
/**
|
|
468
|
-
* Defines the configuration for tsdown.
|
|
469
|
-
*/
|
|
470
|
-
declare function defineConfig<const T extends UserConfig | UserConfigFn>(options: T): T;
|
|
471
|
-
//#endregion
|
|
472
|
-
export { type AttwOptions, type BuildContext, type ChunkAddon, type CopyOptions, type DtsOptions, type ExportsOptions, Format, ModuleTypes, NormalizedFormat, NormalizedUserConfig, type Options, type PublintOptions, type ReportOptions, ReportPlugin, type ResolvedOptions, type RolldownContext, Sourcemap, TsdownChunks, type TsdownHooks, type UnusedOptions, type UserConfig, type UserConfigFn, Workspace, build$1 as build, buildSingle, defineConfig, logger, shimFile };
|
|
437
|
+
export { type AttwOptions, type BuildContext, type ChunkAddon, type ChunkAddonFunction, type ChunkAddonObject, type CopyEntry, type CopyOptions, type CopyOptionsFn, type DtsOptions, type ExportsOptions, Format, ModuleTypes, NormalizedFormat, NormalizedUserConfig, Options, type OutExtensionContext, type OutExtensionFactory, type OutExtensionObject, type PackageType, type PublintOptions, type ReportOptions, ReportPlugin, ResolvedOptions, type RolldownContext, Sourcemap, type TsdownChunks, type TsdownHooks, type UnusedOptions, UserConfig, UserConfigFn, Workspace };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tsdown",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.1",
|
|
4
4
|
"description": "The Elegant Bundler for Libraries",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -74,33 +74,35 @@
|
|
|
74
74
|
"diff": "^8.0.2",
|
|
75
75
|
"empathic": "^2.0.0",
|
|
76
76
|
"hookable": "^5.5.3",
|
|
77
|
-
"rolldown": "^1.0.0-beta.
|
|
78
|
-
"rolldown-plugin-dts": "^0.14.
|
|
77
|
+
"rolldown": "^1.0.0-beta.30",
|
|
78
|
+
"rolldown-plugin-dts": "^0.14.3",
|
|
79
79
|
"semver": "^7.7.2",
|
|
80
80
|
"tinyexec": "^1.0.1",
|
|
81
81
|
"tinyglobby": "^0.2.14",
|
|
82
|
+
"tree-kill": "^1.2.2",
|
|
82
83
|
"unconfig": "^7.3.2"
|
|
83
84
|
},
|
|
84
85
|
"devDependencies": {
|
|
85
86
|
"@arethetypeswrong/core": "^0.18.2",
|
|
86
|
-
"@sxzz/eslint-config": "^7.
|
|
87
|
+
"@sxzz/eslint-config": "^7.1.1",
|
|
87
88
|
"@sxzz/prettier-config": "^2.2.3",
|
|
88
|
-
"@sxzz/test-utils": "^0.5.
|
|
89
|
+
"@sxzz/test-utils": "^0.5.9",
|
|
89
90
|
"@types/debug": "^4.1.12",
|
|
90
|
-
"@types/node": "^24.0
|
|
91
|
+
"@types/node": "^24.1.0",
|
|
91
92
|
"@types/semver": "^7.7.0",
|
|
92
93
|
"@unocss/eslint-plugin": "^66.3.3",
|
|
93
|
-
"@vueuse/core": "^13.
|
|
94
|
-
"bumpp": "^10.2.
|
|
95
|
-
"eslint": "^9.
|
|
94
|
+
"@vueuse/core": "^13.6.0",
|
|
95
|
+
"bumpp": "^10.2.1",
|
|
96
|
+
"eslint": "^9.32.0",
|
|
96
97
|
"lightningcss": "^1.30.1",
|
|
97
|
-
"oxc-minify": "^0.
|
|
98
|
+
"oxc-minify": "^0.79.1",
|
|
98
99
|
"pkg-types": "^2.2.0",
|
|
99
100
|
"prettier": "^3.6.2",
|
|
100
101
|
"publint": "^0.3.12",
|
|
101
102
|
"tsx": "^4.20.3",
|
|
102
|
-
"typedoc": "^0.28.
|
|
103
|
-
"typedoc-plugin-markdown": "^4.
|
|
103
|
+
"typedoc": "^0.28.8",
|
|
104
|
+
"typedoc-plugin-markdown": "^4.8.0",
|
|
105
|
+
"typedoc-vitepress-theme": "^1.1.2",
|
|
104
106
|
"typescript": "~5.8.3",
|
|
105
107
|
"unocss": "^66.3.3",
|
|
106
108
|
"unplugin-lightningcss": "^0.4.1",
|
|
@@ -108,17 +110,13 @@
|
|
|
108
110
|
"vite": "npm:rolldown-vite@latest",
|
|
109
111
|
"vitepress": "^2.0.0-alpha.7",
|
|
110
112
|
"vitepress-plugin-group-icons": "^1.6.1",
|
|
111
|
-
"vitepress-plugin-llms": "^1.7.
|
|
113
|
+
"vitepress-plugin-llms": "^1.7.2",
|
|
112
114
|
"vitest": "^3.2.4",
|
|
113
|
-
"vue": "^3.5.
|
|
115
|
+
"vue": "^3.5.18"
|
|
114
116
|
},
|
|
115
117
|
"engines": {
|
|
116
118
|
"node": ">=20.19.0"
|
|
117
119
|
},
|
|
118
|
-
"resolutions": {
|
|
119
|
-
"rolldown": "catalog:prod",
|
|
120
|
-
"vite": "catalog:docs"
|
|
121
|
-
},
|
|
122
120
|
"prettier": "@sxzz/prettier-config",
|
|
123
121
|
"scripts": {
|
|
124
122
|
"lint": "eslint --cache --max-warnings 0 .",
|