tsdown 0.9.4 → 0.9.6
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-DHsClbv0.d.ts → config.d-DOpadTUl.d.ts} +1 -1
- package/dist/config.d.ts +2 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.js +35 -6
- package/dist/{migrate-DRASxtab.js → migrate-B7KTdsUd.js} +1 -1
- package/dist/{options.d-CRAKIn7H.d.ts → options.d-VgsCNgLk.d.ts} +61 -6
- package/dist/package-B1O-I_4B.js +5 -0
- package/dist/{plugins-x9xHcxDm.js → plugins-DU1CCXkW.js} +39 -23
- package/dist/plugins.d.ts +1 -5
- package/dist/plugins.js +1 -1
- package/dist/run.js +2 -2
- package/package.json +3 -2
- package/dist/package-BgsbkBlA.js +0 -5
package/dist/config.d.ts
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Options, ResolvedOptions, UserConfig } from "./options.d-
|
|
2
|
-
import { defineConfig$1 as defineConfig } from "./config.d-
|
|
1
|
+
import { BuildContext, Options, ResolvedOptions, TsdownHooks, UserConfig } from "./options.d-VgsCNgLk.js";
|
|
2
|
+
import { defineConfig$1 as defineConfig } from "./config.d-DOpadTUl.js";
|
|
3
3
|
import Debug from "debug";
|
|
4
4
|
import { ConsolaInstance } from "consola";
|
|
5
5
|
|
|
@@ -24,4 +24,4 @@ declare const pkgRoot: string;
|
|
|
24
24
|
declare function buildSingle(config: ResolvedOptions): Promise<(() => Promise<void>) | undefined>;
|
|
25
25
|
|
|
26
26
|
//#endregion
|
|
27
|
-
export { Options, UserConfig, build, buildSingle, defineConfig, logger, pkgRoot };
|
|
27
|
+
export { BuildContext, Options, TsdownHooks, UserConfig, build, buildSingle, defineConfig, logger, pkgRoot };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineConfig } from "./config-yiJy1jd0.js";
|
|
2
|
-
import { ExternalPlugin, ReportPlugin, ShebangPlugin, debounce, fsExists, fsRemove, getPackageType, lowestCommonAncestor, normalizeFormat, readPackageJson, toArray } from "./plugins-
|
|
2
|
+
import { ExternalPlugin, ReportPlugin, ShebangPlugin, debounce, fsExists, fsRemove, getPackageType, lowestCommonAncestor, normalizeFormat, prettyFormat, readPackageJson, resolveComma, toArray } from "./plugins-DU1CCXkW.js";
|
|
3
3
|
import { debug, logger, setSilent } from "./logger-Dt3D6T-U.js";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import process from "node:process";
|
|
@@ -11,6 +11,7 @@ import { exec } from "tinyexec";
|
|
|
11
11
|
import { readdir, stat } from "node:fs/promises";
|
|
12
12
|
import Debug from "debug";
|
|
13
13
|
import { glob } from "tinyglobby";
|
|
14
|
+
import { createHooks } from "hookable";
|
|
14
15
|
import { findUp } from "find-up-simple";
|
|
15
16
|
import readline from "node:readline";
|
|
16
17
|
import { loadConfig } from "unconfig";
|
|
@@ -31,6 +32,23 @@ async function cleanOutDir(cwd, patterns) {
|
|
|
31
32
|
}
|
|
32
33
|
}
|
|
33
34
|
|
|
35
|
+
//#endregion
|
|
36
|
+
//#region src/features/hooks.ts
|
|
37
|
+
async function createHooks$1(options, pkg) {
|
|
38
|
+
const hooks = createHooks();
|
|
39
|
+
if (typeof options.hooks === "object") hooks.addHooks(options.hooks);
|
|
40
|
+
else if (typeof options.hooks === "function") await options.hooks(hooks);
|
|
41
|
+
const context = {
|
|
42
|
+
options,
|
|
43
|
+
pkg,
|
|
44
|
+
hooks
|
|
45
|
+
};
|
|
46
|
+
return {
|
|
47
|
+
hooks,
|
|
48
|
+
context
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
|
|
34
52
|
//#endregion
|
|
35
53
|
//#region src/features/output.ts
|
|
36
54
|
function resolveJsOutputExtension(packageType, format, fixedExtension) {
|
|
@@ -220,7 +238,7 @@ async function resolveOptions(options) {
|
|
|
220
238
|
...subConfig,
|
|
221
239
|
...options
|
|
222
240
|
};
|
|
223
|
-
let { entry, format = ["es"], plugins = [], clean = false, silent = false, treeshake = true, platform = "node", outDir = "dist", sourcemap = false, dts = false, unused = false, watch = false, shims = false, skipNodeModulesBundle = false, publint: publint$1 = false, fromVite, alias, tsconfig, report = true } = subOptions;
|
|
241
|
+
let { entry, format = ["es"], plugins = [], clean = false, silent = false, treeshake = true, platform = "node", outDir = "dist", sourcemap = false, dts = false, unused = false, watch = false, shims = false, skipNodeModulesBundle = false, publint: publint$1 = false, fromVite, alias, tsconfig, report = true, target } = subOptions;
|
|
224
242
|
entry = await resolveEntry(entry, cwd);
|
|
225
243
|
if (clean === true) clean = [];
|
|
226
244
|
if (publint$1 === true) publint$1 = {};
|
|
@@ -256,6 +274,7 @@ async function resolveOptions(options) {
|
|
|
256
274
|
entry,
|
|
257
275
|
plugins,
|
|
258
276
|
format: normalizeFormat(format),
|
|
277
|
+
target: target ? resolveComma(toArray(target)) : void 0,
|
|
259
278
|
outDir: path.resolve(outDir),
|
|
260
279
|
clean,
|
|
261
280
|
silent,
|
|
@@ -263,6 +282,7 @@ async function resolveOptions(options) {
|
|
|
263
282
|
platform,
|
|
264
283
|
sourcemap,
|
|
265
284
|
dts: dts === true ? {} : dts,
|
|
285
|
+
report: report === true ? {} : report,
|
|
266
286
|
unused,
|
|
267
287
|
watch,
|
|
268
288
|
shims,
|
|
@@ -270,8 +290,7 @@ async function resolveOptions(options) {
|
|
|
270
290
|
publint: publint$1,
|
|
271
291
|
alias,
|
|
272
292
|
tsconfig,
|
|
273
|
-
cwd
|
|
274
|
-
report
|
|
293
|
+
cwd
|
|
275
294
|
};
|
|
276
295
|
return config;
|
|
277
296
|
}));
|
|
@@ -409,16 +428,25 @@ async function buildSingle(config) {
|
|
|
409
428
|
const { outDir, format: formats, clean, dts, watch, onSuccess } = config;
|
|
410
429
|
let onSuccessCleanup;
|
|
411
430
|
const pkg = await readPackageJson(process.cwd());
|
|
431
|
+
const { hooks, context } = await createHooks$1(config);
|
|
412
432
|
await rebuild(true);
|
|
413
433
|
if (watch) return () => rebuild();
|
|
414
434
|
async function rebuild(first) {
|
|
415
435
|
const startTime = performance.now();
|
|
436
|
+
await hooks.callHook("build:prepare", context);
|
|
416
437
|
onSuccessCleanup?.();
|
|
417
438
|
if (clean) await cleanOutDir(outDir, clean);
|
|
418
439
|
let hasErrors = false;
|
|
419
440
|
await Promise.all(formats.map(async (format) => {
|
|
420
441
|
try {
|
|
421
|
-
|
|
442
|
+
const formatLabel = prettyFormat(format);
|
|
443
|
+
logger.info(formatLabel, "Build start");
|
|
444
|
+
const buildOptions = await getBuildOptions(config, pkg, format);
|
|
445
|
+
await hooks.callHook("build:before", {
|
|
446
|
+
...context,
|
|
447
|
+
buildOptions
|
|
448
|
+
});
|
|
449
|
+
await build$1(buildOptions);
|
|
422
450
|
if (format === "cjs" && dts) await build$1(await getBuildOptions(config, pkg, format, true));
|
|
423
451
|
} catch (error) {
|
|
424
452
|
if (watch) {
|
|
@@ -430,6 +458,7 @@ async function buildSingle(config) {
|
|
|
430
458
|
}
|
|
431
459
|
}));
|
|
432
460
|
if (hasErrors) return;
|
|
461
|
+
await hooks.callHook("build:done", context);
|
|
433
462
|
if (config.publint) if (pkg) await publint(pkg);
|
|
434
463
|
else logger.warn("publint is enabled but package.json is not found");
|
|
435
464
|
logger.success(`${first ? "Build" : "Rebuild"} complete in ${green(`${Math.round(performance.now() - startTime)}ms`)}`);
|
|
@@ -473,7 +502,7 @@ async function getBuildOptions(config, pkg, format, cjsDts) {
|
|
|
473
502
|
}));
|
|
474
503
|
plugins.push(ShebangPlugin(cwd));
|
|
475
504
|
}
|
|
476
|
-
if (report) plugins.push(ReportPlugin(cwd, cjsDts));
|
|
505
|
+
if (report) plugins.push(ReportPlugin(report, cwd, cjsDts));
|
|
477
506
|
plugins.push(userPlugins);
|
|
478
507
|
const inputOptions = await mergeUserOptions({
|
|
479
508
|
input: entry,
|
|
@@ -1,9 +1,42 @@
|
|
|
1
|
-
import { ExternalOption, InputOption, InputOptions, InternalModuleFormat, ModuleFormat, OutputOptions } from "rolldown";
|
|
1
|
+
import { BuildOptions, ExternalOption, InputOption, InputOptions, InternalModuleFormat, ModuleFormat, OutputOptions, Plugin } from "rolldown";
|
|
2
|
+
import { Hookable } from "hookable";
|
|
2
3
|
import { Options } from "publint";
|
|
3
4
|
import { Options as Options$1 } from "rolldown-plugin-dts";
|
|
4
5
|
import { Options as Options$2 } from "unplugin-unused";
|
|
5
6
|
import { PackageJson } from "pkg-types";
|
|
6
7
|
|
|
8
|
+
//#region src/features/hooks.d.ts
|
|
9
|
+
interface BuildContext {
|
|
10
|
+
options: ResolvedOptions;
|
|
11
|
+
pkg?: PackageJson;
|
|
12
|
+
hooks: Hookable<TsdownHooks>;
|
|
13
|
+
}
|
|
14
|
+
interface RolldownContext {
|
|
15
|
+
buildOptions: BuildOptions;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Hooks for tsdown.
|
|
19
|
+
*/
|
|
20
|
+
interface TsdownHooks {
|
|
21
|
+
/**
|
|
22
|
+
* Invoked before each tsdown build starts.
|
|
23
|
+
* Use this hook to perform setup or preparation tasks.
|
|
24
|
+
*/
|
|
25
|
+
"build:prepare": (ctx: BuildContext) => void | Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* Invoked before each Rolldown build.
|
|
28
|
+
* For dual-format builds, this hook is called for each format.
|
|
29
|
+
* Useful for configuring or modifying the build context before bundling.
|
|
30
|
+
*/
|
|
31
|
+
"build:before": (ctx: BuildContext & RolldownContext) => void | Promise<void>;
|
|
32
|
+
/**
|
|
33
|
+
* Invoked after each tsdown build completes.
|
|
34
|
+
* Use this hook for cleanup or post-processing tasks.
|
|
35
|
+
*/
|
|
36
|
+
"build:done": (ctx: BuildContext) => void | Promise<void>;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
//#endregion
|
|
7
40
|
//#region src/utils/package.d.ts
|
|
8
41
|
type PackageType = "module" | "commonjs" | undefined;
|
|
9
42
|
|
|
@@ -21,6 +54,24 @@ interface OutExtensionObject {
|
|
|
21
54
|
}
|
|
22
55
|
type OutExtensionFactory = (ctx: OutExtensionContext) => OutExtensionObject;
|
|
23
56
|
|
|
57
|
+
//#endregion
|
|
58
|
+
//#region src/features/report.d.ts
|
|
59
|
+
interface ReportOptions {
|
|
60
|
+
/**
|
|
61
|
+
* Enable/disable brotli-compressed size reporting.
|
|
62
|
+
* Compressing large output files can be slow, so disabling this may increase build performance for large projects.
|
|
63
|
+
*
|
|
64
|
+
* @default false
|
|
65
|
+
*/
|
|
66
|
+
brotli?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Skip reporting compressed size for files larger than this size.
|
|
69
|
+
* @default 1_000_000 // 1MB
|
|
70
|
+
*/
|
|
71
|
+
maxCompressSize?: number;
|
|
72
|
+
}
|
|
73
|
+
declare function ReportPlugin(options: ReportOptions, cwd: string, cjsDts?: boolean): Plugin;
|
|
74
|
+
|
|
24
75
|
//#endregion
|
|
25
76
|
//#region src/utils/types.d.ts
|
|
26
77
|
type Overwrite<
|
|
@@ -37,6 +88,8 @@ type Arrayable<T> = T | T[];
|
|
|
37
88
|
//#endregion
|
|
38
89
|
//#region src/options.d.ts
|
|
39
90
|
type Sourcemap = boolean | "inline" | "hidden";
|
|
91
|
+
type Format = Exclude<ModuleFormat, "experimental-app">;
|
|
92
|
+
type NormalizedFormat = Exclude<InternalModuleFormat, "app">;
|
|
40
93
|
/**
|
|
41
94
|
* Options for tsdown.
|
|
42
95
|
*/
|
|
@@ -50,7 +103,7 @@ interface Options$3 {
|
|
|
50
103
|
platform?: "node" | "neutral" | "browser";
|
|
51
104
|
inputOptions?: InputOptions | ((options: InputOptions, format: NormalizedFormat) => Awaitable<InputOptions | void | null>);
|
|
52
105
|
/** @default 'es' */
|
|
53
|
-
format?:
|
|
106
|
+
format?: Format | Format[];
|
|
54
107
|
globalName?: string;
|
|
55
108
|
/** @default 'dist' */
|
|
56
109
|
outDir?: string;
|
|
@@ -115,20 +168,22 @@ interface Options$3 {
|
|
|
115
168
|
* Enable size reporting after bundling.
|
|
116
169
|
* @default true
|
|
117
170
|
*/
|
|
118
|
-
report?: boolean;
|
|
171
|
+
report?: boolean | ReportOptions;
|
|
172
|
+
hooks?: Partial<TsdownHooks> | ((hooks: Hookable<TsdownHooks>) => Awaitable<void>);
|
|
119
173
|
}
|
|
120
174
|
/**
|
|
121
175
|
* Options without specifying config file path.
|
|
122
176
|
*/
|
|
123
177
|
type UserConfig = Arrayable<Omit<Options$3, "config">>;
|
|
124
|
-
type
|
|
125
|
-
type ResolvedOptions = Omit<Overwrite<MarkPartial<Options$3, "globalName" | "inputOptions" | "outputOptions" | "minify" | "target" | "define" | "alias" | "external" | "noExternal" | "onSuccess" | "dts" | "fixedExtension" | "outExtensions">, {
|
|
178
|
+
type ResolvedOptions = Omit<Overwrite<MarkPartial<Options$3, "globalName" | "inputOptions" | "outputOptions" | "minify" | "define" | "alias" | "external" | "noExternal" | "onSuccess" | "fixedExtension" | "outExtensions" | "hooks">, {
|
|
126
179
|
format: NormalizedFormat[]
|
|
180
|
+
target?: string[]
|
|
127
181
|
clean: string[] | false
|
|
128
182
|
dts: false | Options$1
|
|
183
|
+
report: false | ReportOptions
|
|
129
184
|
tsconfig: string | false
|
|
130
185
|
cwd: string
|
|
131
186
|
}>, "config" | "fromVite">;
|
|
132
187
|
|
|
133
188
|
//#endregion
|
|
134
|
-
export { Options$3 as Options, ResolvedOptions, UserConfig };
|
|
189
|
+
export { BuildContext, Options$3 as Options, ReportPlugin as ReportPlugin$1, ResolvedOptions, TsdownHooks, UserConfig };
|
|
@@ -46,6 +46,9 @@ function toArray(val, defaultValue) {
|
|
|
46
46
|
return [];
|
|
47
47
|
} else return [val];
|
|
48
48
|
}
|
|
49
|
+
function resolveComma(arr) {
|
|
50
|
+
return arr.flatMap((format) => format.split(","));
|
|
51
|
+
}
|
|
49
52
|
function debounce(fn, wait) {
|
|
50
53
|
let timeout;
|
|
51
54
|
return function(...args) {
|
|
@@ -56,6 +59,7 @@ function debounce(fn, wait) {
|
|
|
56
59
|
}, wait);
|
|
57
60
|
};
|
|
58
61
|
}
|
|
62
|
+
const noop = (v) => v;
|
|
59
63
|
|
|
60
64
|
//#endregion
|
|
61
65
|
//#region src/features/external.ts
|
|
@@ -113,7 +117,7 @@ function getPackageType(pkg) {
|
|
|
113
117
|
}
|
|
114
118
|
}
|
|
115
119
|
function normalizeFormat(format) {
|
|
116
|
-
return toArray(format, "es").map((format$1) => {
|
|
120
|
+
return resolveComma(toArray(format, "es")).map((format$1) => {
|
|
117
121
|
switch (format$1) {
|
|
118
122
|
case "es":
|
|
119
123
|
case "esm":
|
|
@@ -125,18 +129,23 @@ function normalizeFormat(format) {
|
|
|
125
129
|
});
|
|
126
130
|
}
|
|
127
131
|
function prettyFormat(format) {
|
|
132
|
+
const formatColor = format === "es" ? blue : format === "cjs" ? yellow : noop;
|
|
133
|
+
let formatText;
|
|
128
134
|
switch (format) {
|
|
129
|
-
case "es":
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
135
|
+
case "es":
|
|
136
|
+
formatText = "ESM";
|
|
137
|
+
break;
|
|
138
|
+
default:
|
|
139
|
+
formatText = format.toUpperCase();
|
|
140
|
+
break;
|
|
134
141
|
}
|
|
142
|
+
return formatColor(`[${formatText}]`);
|
|
135
143
|
}
|
|
136
144
|
|
|
137
145
|
//#endregion
|
|
138
146
|
//#region src/utils/format.ts
|
|
139
147
|
function formatBytes(bytes) {
|
|
148
|
+
if (bytes === Infinity) return "too large";
|
|
140
149
|
const numberFormatter = new Intl.NumberFormat("en", {
|
|
141
150
|
maximumFractionDigits: 2,
|
|
142
151
|
minimumFractionDigits: 2
|
|
@@ -147,18 +156,17 @@ function formatBytes(bytes) {
|
|
|
147
156
|
//#endregion
|
|
148
157
|
//#region src/features/report.ts
|
|
149
158
|
const debug$1 = Debug("tsdown:report");
|
|
150
|
-
const noop = (v) => v;
|
|
151
159
|
const brotliCompressAsync = promisify(brotliCompress);
|
|
152
160
|
const gzipAsync = promisify(gzip);
|
|
153
161
|
const RE_DTS = /\.d\.[cm]?ts$/;
|
|
154
|
-
function ReportPlugin(cwd, cjsDts) {
|
|
162
|
+
function ReportPlugin(options, cwd, cjsDts) {
|
|
155
163
|
return {
|
|
156
164
|
name: "tsdown:report",
|
|
157
|
-
async writeBundle(
|
|
158
|
-
const outDir = path.relative(cwd,
|
|
165
|
+
async writeBundle(outputOptions, bundle) {
|
|
166
|
+
const outDir = path.relative(cwd, outputOptions.file ? path.resolve(cwd, outputOptions.file, "..") : path.resolve(cwd, outputOptions.dir));
|
|
159
167
|
const sizes = [];
|
|
160
168
|
for (const chunk of Object.values(bundle)) {
|
|
161
|
-
const size = await calcSize(chunk);
|
|
169
|
+
const size = await calcSize(options, chunk);
|
|
162
170
|
sizes.push(size);
|
|
163
171
|
}
|
|
164
172
|
const filenameLength = Math.max(...sizes.map((size) => size.filename.length));
|
|
@@ -175,26 +183,34 @@ function ReportPlugin(cwd, cjsDts) {
|
|
|
175
183
|
sizes.sort((a, b) => {
|
|
176
184
|
if (a.dts !== b.dts) return a.dts ? 1 : -1;
|
|
177
185
|
if (a.isEntry !== b.isEntry) return a.isEntry ? -1 : 1;
|
|
178
|
-
return b.
|
|
186
|
+
return b.raw - a.raw;
|
|
179
187
|
});
|
|
180
|
-
const
|
|
181
|
-
const formatColor = format === "es" ? blue : format === "cjs" ? yellow : noop;
|
|
182
|
-
const formatText = formatColor(`[${prettyFormat(format)}]`);
|
|
188
|
+
const formatLabel = prettyFormat(cjsDts ? "cjs" : outputOptions.format);
|
|
183
189
|
for (const size of sizes) {
|
|
184
190
|
const filenameColor = size.dts ? green : noop;
|
|
185
|
-
logger.info(
|
|
191
|
+
logger.info(formatLabel, dim(`${outDir}/`) + filenameColor((size.isEntry ? bold : noop)(size.filename)), ` `.repeat(filenameLength - size.filename.length), dim`${size.rawText} │ gzip: ${size.gzipText}`, options.brotli ? dim` │ brotli: ${size.brotliText}` : "");
|
|
186
192
|
}
|
|
187
193
|
const totalSizeText = formatBytes(totalRaw);
|
|
188
|
-
logger.info(
|
|
194
|
+
logger.info(formatLabel, `${sizes.length} files, total: ${totalSizeText}`);
|
|
189
195
|
}
|
|
190
196
|
};
|
|
191
197
|
}
|
|
192
|
-
async function calcSize(chunk) {
|
|
193
|
-
debug$1(`Calculating size for
|
|
198
|
+
async function calcSize(options, chunk) {
|
|
199
|
+
debug$1(`Calculating size for`, chunk.fileName);
|
|
194
200
|
const content = chunk.type === "chunk" ? chunk.code : chunk.source;
|
|
195
201
|
const raw = Buffer.byteLength(content, "utf8");
|
|
196
|
-
|
|
197
|
-
|
|
202
|
+
debug$1("[size]", chunk.fileName, raw);
|
|
203
|
+
let gzip$1 = Infinity;
|
|
204
|
+
let brotli = Infinity;
|
|
205
|
+
if (raw > (options.maxCompressSize ?? 1e6)) debug$1(chunk.fileName, "file size exceeds limit, skip gzip/brotli");
|
|
206
|
+
else {
|
|
207
|
+
gzip$1 = (await gzipAsync(content)).length;
|
|
208
|
+
debug$1("[gzip]", chunk.fileName, gzip$1);
|
|
209
|
+
if (options.brotli) {
|
|
210
|
+
brotli = (await brotliCompressAsync(content)).length;
|
|
211
|
+
debug$1("[brotli]", chunk.fileName, brotli);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
198
214
|
return {
|
|
199
215
|
filename: chunk.fileName,
|
|
200
216
|
dts: RE_DTS.test(chunk.fileName),
|
|
@@ -220,7 +236,7 @@ function ShebangPlugin(cwd) {
|
|
|
220
236
|
if (!RE_SHEBANG.test(chunk.code)) continue;
|
|
221
237
|
const filepath = path.resolve(cwd, options.file || path.join(options.dir, chunk.fileName));
|
|
222
238
|
if (await fsExists(filepath)) {
|
|
223
|
-
logger.info(`Granting execute permission to ${underline(path.relative(cwd, filepath))}`);
|
|
239
|
+
logger.info(prettyFormat(options.format), `Granting execute permission to ${underline(path.relative(cwd, filepath))}`);
|
|
224
240
|
await chmod(filepath, 493);
|
|
225
241
|
}
|
|
226
242
|
}
|
|
@@ -229,4 +245,4 @@ function ShebangPlugin(cwd) {
|
|
|
229
245
|
}
|
|
230
246
|
|
|
231
247
|
//#endregion
|
|
232
|
-
export { ExternalPlugin, ReportPlugin, ShebangPlugin, debounce, fsExists, fsRemove, getPackageType, lowestCommonAncestor, normalizeFormat, readPackageJson, toArray };
|
|
248
|
+
export { ExternalPlugin, ReportPlugin, ShebangPlugin, debounce, fsExists, fsRemove, getPackageType, lowestCommonAncestor, normalizeFormat, prettyFormat, readPackageJson, resolveComma, toArray };
|
package/dist/plugins.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ResolvedOptions } from "./options.d-
|
|
1
|
+
import { ReportPlugin$1 as ReportPlugin, ResolvedOptions } from "./options.d-VgsCNgLk.js";
|
|
2
2
|
import { Plugin } from "rolldown";
|
|
3
3
|
import { PackageJson } from "pkg-types";
|
|
4
4
|
|
|
@@ -9,9 +9,5 @@ declare function ExternalPlugin(options: ResolvedOptions, pkg?: PackageJson): Pl
|
|
|
9
9
|
//#region src/features/shebang.d.ts
|
|
10
10
|
declare function ShebangPlugin(cwd: string): Plugin;
|
|
11
11
|
|
|
12
|
-
//#endregion
|
|
13
|
-
//#region src/features/report.d.ts
|
|
14
|
-
declare function ReportPlugin(cwd: string, cjsDts?: boolean): Plugin;
|
|
15
|
-
|
|
16
12
|
//#endregion
|
|
17
13
|
export { ExternalPlugin, ReportPlugin, ShebangPlugin };
|
package/dist/plugins.js
CHANGED
package/dist/run.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { logger, setSilent } from "./logger-Dt3D6T-U.js";
|
|
3
|
-
import { version } from "./package-
|
|
3
|
+
import { version } from "./package-B1O-I_4B.js";
|
|
4
4
|
import process from "node:process";
|
|
5
5
|
import { dim } from "ansis";
|
|
6
6
|
import { VERSION } from "rolldown";
|
|
@@ -17,7 +17,7 @@ cli.command("[...files]", "Bundle files", { ignoreOptionDefaultValue: true }).op
|
|
|
17
17
|
await build$1(flags);
|
|
18
18
|
});
|
|
19
19
|
cli.command("migrate", "Migrate from tsup to tsdown").option("-c, --cwd <dir>", "Working directory").option("-d, --dry-run", "Dry run").action(async (args) => {
|
|
20
|
-
const { migrate } = await import("./migrate-
|
|
20
|
+
const { migrate } = await import("./migrate-B7KTdsUd.js");
|
|
21
21
|
await migrate(args);
|
|
22
22
|
});
|
|
23
23
|
async function runCLI() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tsdown",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.6",
|
|
4
4
|
"description": "The Elegant Bundler for Libraries",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -61,7 +61,8 @@
|
|
|
61
61
|
"debug": "^4.4.0",
|
|
62
62
|
"diff": "^7.0.0",
|
|
63
63
|
"find-up-simple": "^1.0.1",
|
|
64
|
-
"
|
|
64
|
+
"hookable": "^5.5.3",
|
|
65
|
+
"rolldown": "1.0.0-beta.8-commit.2686eb1",
|
|
65
66
|
"rolldown-plugin-dts": "^0.8.3",
|
|
66
67
|
"tinyexec": "^1.0.1",
|
|
67
68
|
"tinyglobby": "^0.2.13",
|