tsdown 0.12.4 → 0.12.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-DcChLYA_.d.ts → config-CzJapb1X.d.ts} +11 -3
- package/dist/config.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +60 -17
- package/dist/{logger-CS4H_tpu.js → logger-BMB8Jggq.js} +2 -2
- package/dist/{migrate-BD_TCCI8.js → migrate-BcMqjqIs.js} +2 -2
- package/dist/package-BWIL_dgZ.js +5 -0
- package/dist/{plugins-BK9K-20W.js → plugins-BxGX3AUF.js} +6 -4
- package/dist/plugins.d.ts +1 -1
- package/dist/plugins.js +2 -2
- package/dist/run.js +4 -4
- package/package.json +17 -7
- package/dist/package-DHv574be.js +0 -5
|
@@ -2,6 +2,7 @@ import "ansis";
|
|
|
2
2
|
import { BuildOptions, ExternalOption, InputOption, InputOptions, InternalModuleFormat, MinifyOptions, ModuleFormat, OutputAsset, OutputChunk, OutputOptions, Plugin } from "rolldown";
|
|
3
3
|
import { Options } from "rolldown-plugin-dts";
|
|
4
4
|
import { Hookable } from "hookable";
|
|
5
|
+
import { CheckPackageOptions } from "@arethetypeswrong/core";
|
|
5
6
|
import { Options as Options$1 } from "publint";
|
|
6
7
|
import { Options as Options$2 } from "unplugin-unused";
|
|
7
8
|
import { PackageJson } from "pkg-types";
|
|
@@ -27,7 +28,6 @@ declare const logger: Logger;
|
|
|
27
28
|
//#region src/features/hooks.d.ts
|
|
28
29
|
interface BuildContext {
|
|
29
30
|
options: ResolvedOptions;
|
|
30
|
-
pkg?: PackageJson;
|
|
31
31
|
hooks: Hookable<TsdownHooks>;
|
|
32
32
|
}
|
|
33
33
|
interface RolldownContext {
|
|
@@ -271,7 +271,7 @@ interface Options$3 {
|
|
|
271
271
|
/**
|
|
272
272
|
* You can specify command to be executed after a successful build, specially useful for Watch mode
|
|
273
273
|
*/
|
|
274
|
-
onSuccess?: string | ((config: ResolvedOptions) => void | Promise<void>);
|
|
274
|
+
onSuccess?: string | ((config: ResolvedOptions, signal: AbortSignal) => void | Promise<void>);
|
|
275
275
|
/**
|
|
276
276
|
* Skip bundling `node_modules`.
|
|
277
277
|
* @default false
|
|
@@ -304,6 +304,14 @@ interface Options$3 {
|
|
|
304
304
|
*/
|
|
305
305
|
publint?: boolean | Options$1;
|
|
306
306
|
/**
|
|
307
|
+
* Run `arethetypeswrong` after bundling.
|
|
308
|
+
* Requires `@arethetypeswrong/core` to be installed.
|
|
309
|
+
*
|
|
310
|
+
* @default false
|
|
311
|
+
* @see https://github.com/arethetypeswrong/arethetypeswrong.github.io
|
|
312
|
+
*/
|
|
313
|
+
attw?: boolean | CheckPackageOptions;
|
|
314
|
+
/**
|
|
307
315
|
* Enable size reporting after bundling.
|
|
308
316
|
* @default true
|
|
309
317
|
*/
|
|
@@ -395,4 +403,4 @@ type ResolvedOptions = Omit<Overwrite<MarkPartial<Omit<Options$3, "publicDir" |
|
|
|
395
403
|
*/
|
|
396
404
|
declare function defineConfig(options: UserConfig | UserConfigFn): UserConfig | UserConfigFn;
|
|
397
405
|
//#endregion
|
|
398
|
-
export { BuildContext, Options$3 as Options, ReportPlugin
|
|
406
|
+
export { BuildContext, Options$3 as Options, ReportPlugin, ResolvedOptions, TsdownChunks, TsdownHooks, UserConfig, UserConfigFn, build$1 as build, buildSingle, defineConfig, logger, pkgRoot };
|
package/dist/config.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { UserConfig, UserConfigFn, defineConfig
|
|
1
|
+
import { UserConfig, UserConfigFn, defineConfig } from "./config-CzJapb1X.js";
|
|
2
2
|
export { UserConfig, UserConfigFn, defineConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { BuildContext, Options, TsdownChunks, TsdownHooks, UserConfig, UserConfigFn, build, buildSingle, defineConfig
|
|
1
|
+
import { BuildContext, Options, TsdownChunks, TsdownHooks, UserConfig, UserConfigFn, build, buildSingle, defineConfig, logger, pkgRoot } from "./config-CzJapb1X.js";
|
|
2
2
|
export { BuildContext, Options, TsdownChunks, TsdownHooks, UserConfig, UserConfigFn, build, buildSingle, defineConfig, logger, pkgRoot };
|
package/dist/index.js
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import { defineConfig } from "./config-yiJy1jd0.js";
|
|
2
|
-
import { ExternalPlugin, NodeProtocolPlugin, ReportPlugin, ShebangPlugin, fsCopy, fsExists, fsRemove, fsStat, lowestCommonAncestor } from "./plugins-
|
|
3
|
-
import { debounce, generateColor, logger
|
|
2
|
+
import { ExternalPlugin, NodeProtocolPlugin, ReportPlugin, ShebangPlugin, fsCopy, fsExists, fsRemove, fsStat, lowestCommonAncestor } from "./plugins-BxGX3AUF.js";
|
|
3
|
+
import { debounce, generateColor, logger, prettyName, resolveComma, resolveRegex, slash, toArray } from "./logger-BMB8Jggq.js";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import process from "node:process";
|
|
6
6
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
7
7
|
import { blue, bold, dim, green, underline } from "ansis";
|
|
8
8
|
import { build as build$1 } from "rolldown";
|
|
9
9
|
import { exec } from "tinyexec";
|
|
10
|
+
import child_process from "node:child_process";
|
|
11
|
+
import { mkdtemp, readFile, writeFile } from "node:fs/promises";
|
|
12
|
+
import { tmpdir } from "node:os";
|
|
13
|
+
import { promisify } from "node:util";
|
|
10
14
|
import debug from "debug";
|
|
11
15
|
import { glob } from "tinyglobby";
|
|
12
|
-
import { readFile, writeFile } from "node:fs/promises";
|
|
13
16
|
import { RE_DTS } from "rolldown-plugin-dts";
|
|
14
17
|
import { createHooks } from "hookable";
|
|
15
18
|
import { up } from "empathic/package";
|
|
@@ -18,11 +21,50 @@ import minVersion from "semver/ranges/min-version.js";
|
|
|
18
21
|
import { up as up$1 } from "empathic/find";
|
|
19
22
|
import { loadConfig } from "unconfig";
|
|
20
23
|
|
|
24
|
+
//#region src/features/attw.ts
|
|
25
|
+
const debug$5 = debug("tsdown:attw");
|
|
26
|
+
const exec$1 = promisify(child_process.exec);
|
|
27
|
+
async function attw(options) {
|
|
28
|
+
if (!options.attw) return;
|
|
29
|
+
if (!options.pkg) {
|
|
30
|
+
logger.warn("attw is enabled but package.json is not found");
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const t = performance.now();
|
|
34
|
+
debug$5("Running attw check");
|
|
35
|
+
const tempDir = await mkdtemp(path.join(tmpdir(), "tsdown-attw-"));
|
|
36
|
+
let attwCore;
|
|
37
|
+
try {
|
|
38
|
+
attwCore = await import("@arethetypeswrong/core");
|
|
39
|
+
} catch {
|
|
40
|
+
logger.error(`ATTW check requires ${blue`@arethetypeswrong/core`} to be installed.`);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
try {
|
|
44
|
+
const { stdout: tarballInfo } = await exec$1(`npm pack --json ----pack-destination ${tempDir}`, { encoding: "utf-8" });
|
|
45
|
+
const parsed = JSON.parse(tarballInfo);
|
|
46
|
+
if (!Array.isArray(parsed) || !parsed[0]?.filename) throw new Error("Invalid npm pack output format");
|
|
47
|
+
const tarballPath = path.join(tempDir, parsed[0].filename);
|
|
48
|
+
const tarball = await readFile(tarballPath);
|
|
49
|
+
const pkg = attwCore.createPackageFromTarballData(tarball);
|
|
50
|
+
const checkResult = await attwCore.checkPackage(pkg, options.attw === true ? {} : options.attw);
|
|
51
|
+
if (checkResult.types !== false && checkResult.problems) for (const problem of checkResult.problems) logger.warn("Are the types wrong problem:", problem);
|
|
52
|
+
else logger.success(`No Are the types wrong problems found`, dim`(${Math.round(performance.now() - t)}ms)`);
|
|
53
|
+
} catch (error) {
|
|
54
|
+
logger.error("ATTW check failed:", error);
|
|
55
|
+
debug$5("Found errors, setting exit code to 1");
|
|
56
|
+
process.exitCode = 1;
|
|
57
|
+
} finally {
|
|
58
|
+
await fsRemove(tempDir);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
//#endregion
|
|
21
63
|
//#region src/features/clean.ts
|
|
22
64
|
const debug$4 = debug("tsdown:clean");
|
|
23
65
|
const RE_LAST_SLASH = /[/\\]$/;
|
|
24
66
|
async function cleanOutDir(configs) {
|
|
25
|
-
const removes = new Set();
|
|
67
|
+
const removes = /* @__PURE__ */ new Set();
|
|
26
68
|
for (const config of configs) {
|
|
27
69
|
if (!config.clean.length) continue;
|
|
28
70
|
const files = await glob(config.clean, {
|
|
@@ -93,7 +135,7 @@ async function generateExports(pkg, outDir, chunks, { devExports, all, customExp
|
|
|
93
135
|
const pkgRoot$1 = path.dirname(pkgJsonPath);
|
|
94
136
|
const outDirRelative = slash(path.relative(pkgRoot$1, outDir));
|
|
95
137
|
let main, module, cjsTypes, esmTypes;
|
|
96
|
-
const exportsMap = new Map();
|
|
138
|
+
const exportsMap = /* @__PURE__ */ new Map();
|
|
97
139
|
for (const [format, chunksByFormat] of Object.entries(chunks)) {
|
|
98
140
|
if (format !== "es" && format !== "cjs") continue;
|
|
99
141
|
const onlyOneEntry = chunksByFormat.filter((chunk) => chunk.type === "chunk" && chunk.isEntry && !RE_DTS.test(chunk.fileName)).length === 1;
|
|
@@ -174,13 +216,12 @@ function exportMeta(exports, all) {
|
|
|
174
216
|
|
|
175
217
|
//#endregion
|
|
176
218
|
//#region src/features/hooks.ts
|
|
177
|
-
async function createHooks$1(options
|
|
219
|
+
async function createHooks$1(options) {
|
|
178
220
|
const hooks = createHooks();
|
|
179
221
|
if (typeof options.hooks === "object") hooks.addHooks(options.hooks);
|
|
180
222
|
else if (typeof options.hooks === "function") await options.hooks(hooks);
|
|
181
223
|
const context = {
|
|
182
224
|
options,
|
|
183
|
-
pkg,
|
|
184
225
|
hooks
|
|
185
226
|
};
|
|
186
227
|
return {
|
|
@@ -381,7 +422,7 @@ function shortcuts(restart) {
|
|
|
381
422
|
}
|
|
382
423
|
];
|
|
383
424
|
if (input === "h") {
|
|
384
|
-
const loggedKeys = new Set();
|
|
425
|
+
const loggedKeys = /* @__PURE__ */ new Set();
|
|
385
426
|
logger.info(" Shortcuts");
|
|
386
427
|
for (const shortcut$1 of SHORTCUTS) {
|
|
387
428
|
if (loggedKeys.has(shortcut$1.key)) continue;
|
|
@@ -710,7 +751,7 @@ async function resolveWorkspace(config, options) {
|
|
|
710
751
|
};
|
|
711
752
|
}
|
|
712
753
|
async function resolveConfig(userConfig) {
|
|
713
|
-
let { entry, format = ["es"], plugins = [], clean = true, silent = false, treeshake = true, platform = "node", outDir = "dist", sourcemap = false, dts, unused = false, watch = false, ignoreWatch = [], shims = false, skipNodeModulesBundle = false, publint: publint$1 = false, fromVite, alias, tsconfig, report = true, target, env = {}, copy: copy$1, publicDir, hash, cwd = process.cwd(), name, workspace, external, noExternal, exports = false } = userConfig;
|
|
754
|
+
let { entry, format = ["es"], plugins = [], clean = true, silent = false, treeshake = true, platform = "node", outDir = "dist", sourcemap = false, dts, unused = false, watch = false, ignoreWatch = [], shims = false, skipNodeModulesBundle = false, publint: publint$1 = false, attw: attw$1 = false, fromVite, alias, tsconfig, report = true, target, env = {}, copy: copy$1, publicDir, hash, cwd = process.cwd(), name, workspace, external, noExternal, exports = false } = userConfig;
|
|
714
755
|
outDir = path.resolve(cwd, outDir);
|
|
715
756
|
clean = resolveClean(clean, outDir, cwd);
|
|
716
757
|
const pkg = await readPackageJson(cwd);
|
|
@@ -722,6 +763,7 @@ async function resolveConfig(userConfig) {
|
|
|
722
763
|
if (typeof external === "string") external = resolveRegex(external);
|
|
723
764
|
if (typeof noExternal === "string") noExternal = resolveRegex(noExternal);
|
|
724
765
|
if (publint$1 === true) publint$1 = {};
|
|
766
|
+
if (attw$1 === true) attw$1 = {};
|
|
725
767
|
if (exports === true) exports = {};
|
|
726
768
|
if (publicDir) if (copy$1) throw new TypeError("`publicDir` is deprecated. Cannot be used with `copy`");
|
|
727
769
|
else logger.warn(`${blue`publicDir`} is deprecated. Use ${blue`copy`} instead.`);
|
|
@@ -754,6 +796,7 @@ async function resolveConfig(userConfig) {
|
|
|
754
796
|
shims,
|
|
755
797
|
skipNodeModulesBundle,
|
|
756
798
|
publint: publint$1,
|
|
799
|
+
attw: attw$1,
|
|
757
800
|
alias,
|
|
758
801
|
tsconfig,
|
|
759
802
|
cwd,
|
|
@@ -816,14 +859,14 @@ const pkgRoot = path.resolve(dirname$1, "..");
|
|
|
816
859
|
*/
|
|
817
860
|
async function buildSingle(config, clean) {
|
|
818
861
|
const { format: formats, dts, watch, onSuccess } = config;
|
|
819
|
-
let
|
|
862
|
+
let ab;
|
|
820
863
|
const { hooks, context } = await createHooks$1(config);
|
|
821
864
|
await rebuild(true);
|
|
822
865
|
if (watch) return () => rebuild();
|
|
823
866
|
async function rebuild(first) {
|
|
824
867
|
const startTime = performance.now();
|
|
825
868
|
await hooks.callHook("build:prepare", context);
|
|
826
|
-
|
|
869
|
+
ab?.abort();
|
|
827
870
|
await clean();
|
|
828
871
|
let hasErrors = false;
|
|
829
872
|
const isMultiFormat = formats.length > 1;
|
|
@@ -851,21 +894,21 @@ async function buildSingle(config, clean) {
|
|
|
851
894
|
}
|
|
852
895
|
}));
|
|
853
896
|
if (hasErrors) return;
|
|
854
|
-
await writeExports(config, chunks);
|
|
855
|
-
await publint(config);
|
|
856
|
-
await copy(config);
|
|
897
|
+
await Promise.all([writeExports(config, chunks), copy(config)]);
|
|
898
|
+
await Promise.all([publint(config), attw(config)]);
|
|
857
899
|
await hooks.callHook("build:done", context);
|
|
858
900
|
logger.success(prettyName(config.name), `${first ? "Build" : "Rebuild"} complete in ${green(`${Math.round(performance.now() - startTime)}ms`)}`);
|
|
901
|
+
ab = new AbortController();
|
|
859
902
|
if (typeof onSuccess === "string") {
|
|
860
903
|
const p = exec(onSuccess, [], { nodeOptions: {
|
|
861
904
|
shell: true,
|
|
862
|
-
stdio: "inherit"
|
|
905
|
+
stdio: "inherit",
|
|
906
|
+
signal: ab.signal
|
|
863
907
|
} });
|
|
864
908
|
p.then(({ exitCode }) => {
|
|
865
909
|
if (exitCode) process.exitCode = exitCode;
|
|
866
910
|
});
|
|
867
|
-
|
|
868
|
-
} else await onSuccess?.(config);
|
|
911
|
+
} else await onSuccess?.(config, ab.signal);
|
|
869
912
|
}
|
|
870
913
|
}
|
|
871
914
|
async function getBuildOptions(config, format, isMultiFormat, cjsDts) {
|
|
@@ -71,7 +71,7 @@ function prettyFormat(format) {
|
|
|
71
71
|
}
|
|
72
72
|
return formatColor(`[${formatText}]`);
|
|
73
73
|
}
|
|
74
|
-
const colors = new Map();
|
|
74
|
+
const colors = /* @__PURE__ */ new Map();
|
|
75
75
|
function generateColor(name = "default") {
|
|
76
76
|
if (colors.has(name)) return colors.get(name);
|
|
77
77
|
let color;
|
|
@@ -117,4 +117,4 @@ function hue2rgb(p, q, t) {
|
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
//#endregion
|
|
120
|
-
export { debounce, generateColor, logger
|
|
120
|
+
export { debounce, generateColor, logger, noop, prettyFormat, prettyName, resolveComma, resolveRegex, slash, toArray };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { logger
|
|
2
|
-
import { version } from "./package-
|
|
1
|
+
import { logger } from "./logger-BMB8Jggq.js";
|
|
2
|
+
import { version } from "./package-BWIL_dgZ.js";
|
|
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";
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { logger
|
|
1
|
+
import { logger, noop, prettyFormat, prettyName, toArray } from "./logger-BMB8Jggq.js";
|
|
2
|
+
import { isBuiltin } from "node:module";
|
|
2
3
|
import path, { dirname, normalize, sep } from "node:path";
|
|
3
4
|
import { bold, dim, green, underline } from "ansis";
|
|
4
|
-
import debug from "debug";
|
|
5
5
|
import { access, chmod, cp, rm, stat } from "node:fs/promises";
|
|
6
|
+
import { promisify } from "node:util";
|
|
7
|
+
import debug from "debug";
|
|
6
8
|
import { RE_DTS } from "rolldown-plugin-dts";
|
|
7
9
|
import { Buffer } from "node:buffer";
|
|
8
|
-
import { promisify } from "node:util";
|
|
9
10
|
import { brotliCompress, gzip } from "node:zlib";
|
|
10
11
|
|
|
11
12
|
//#region src/utils/fs.ts
|
|
@@ -74,7 +75,8 @@ function ExternalPlugin(options) {
|
|
|
74
75
|
debug$2("External dependency:", id);
|
|
75
76
|
return {
|
|
76
77
|
id,
|
|
77
|
-
external: shouldExternal
|
|
78
|
+
external: shouldExternal,
|
|
79
|
+
moduleSideEffects: id.startsWith("node:") || isBuiltin(id) ? false : void 0
|
|
78
80
|
};
|
|
79
81
|
}
|
|
80
82
|
}
|
package/dist/plugins.d.ts
CHANGED
package/dist/plugins.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ExternalPlugin, NodeProtocolPlugin, ReportPlugin, ShebangPlugin } from "./plugins-
|
|
2
|
-
import "./logger-
|
|
1
|
+
import { ExternalPlugin, NodeProtocolPlugin, ReportPlugin, ShebangPlugin } from "./plugins-BxGX3AUF.js";
|
|
2
|
+
import "./logger-BMB8Jggq.js";
|
|
3
3
|
|
|
4
4
|
export { ExternalPlugin, NodeProtocolPlugin, ReportPlugin, ShebangPlugin };
|
package/dist/run.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { logger
|
|
3
|
-
import { version } from "./package-
|
|
2
|
+
import { logger, resolveComma, toArray } from "./logger-BMB8Jggq.js";
|
|
3
|
+
import { version } from "./package-BWIL_dgZ.js";
|
|
4
4
|
import module from "node:module";
|
|
5
5
|
import process from "node:process";
|
|
6
6
|
import { dim } from "ansis";
|
|
@@ -14,7 +14,7 @@ cli.help().version(version);
|
|
|
14
14
|
cli.command("[...files]", "Bundle files", {
|
|
15
15
|
ignoreOptionDefaultValue: true,
|
|
16
16
|
allowUnknownOptions: true
|
|
17
|
-
}).option("-c, --config <filename>", "Use a custom config file").option("--no-config", "Disable config file").option("-f, --format <format>", "Bundle format: esm, cjs, iife", { default: "esm" }).option("--clean", "Clean output directory, --no-clean to disable").option("--external <module>", "Mark dependencies as external").option("--minify", "Minify output").option("--debug [feat]", "Show debug logs").option("--target <target>", "Bundle target, e.g \"es2015\", \"esnext\"").option("--silent", "Suppress non-error logs").option("-d, --out-dir <dir>", "Output directory", { default: "dist" }).option("--treeshake", "Tree-shake bundle", { default: true }).option("--sourcemap", "Generate source map", { default: false }).option("--shims", "Enable cjs and esm shims ", { default: false }).option("--platform <platform>", "Target platform", { default: "node" }).option("--dts", "Generate dts files").option("--publint", "Enable publint", { default: false }).option("--unused", "Enable unused dependencies check", { default: false }).option("-w, --watch [path]", "Watch mode").option("--ignore-watch <path>", "Ignore custom paths in watch mode").option("--from-vite [vitest]", "Reuse config from Vite or Vitest").option("--report", "Size report", { default: true }).option("--env.* <value>", "Define compile-time env variables").option("--on-success <command>", "Command to run on success").option("--copy <dir>", "Copy files to output dir").option("--public-dir <dir>", "Alias for --copy, deprecated").option("--tsconfig <tsconfig>", "Set tsconfig path").option("--unbundle", "Unbundle mode").option("-W, --workspace [dir]", "Enable workspace mode").option("-F, --filter <pattern>", "Filter workspace packages, e.g. /regex/ or substring").option("--exports", "Generate export-related metadata for package.json (experimental)").action(async (input, flags) => {
|
|
17
|
+
}).option("-c, --config <filename>", "Use a custom config file").option("--no-config", "Disable config file").option("-f, --format <format>", "Bundle format: esm, cjs, iife", { default: "esm" }).option("--clean", "Clean output directory, --no-clean to disable").option("--external <module>", "Mark dependencies as external").option("--minify", "Minify output").option("--debug [feat]", "Show debug logs").option("--target <target>", "Bundle target, e.g \"es2015\", \"esnext\"").option("--silent", "Suppress non-error logs").option("-d, --out-dir <dir>", "Output directory", { default: "dist" }).option("--treeshake", "Tree-shake bundle", { default: true }).option("--sourcemap", "Generate source map", { default: false }).option("--shims", "Enable cjs and esm shims ", { default: false }).option("--platform <platform>", "Target platform", { default: "node" }).option("--dts", "Generate dts files").option("--publint", "Enable publint", { default: false }).option("--attw", "Enable Are the types wrong integration", { default: false }).option("--unused", "Enable unused dependencies check", { default: false }).option("-w, --watch [path]", "Watch mode").option("--ignore-watch <path>", "Ignore custom paths in watch mode").option("--from-vite [vitest]", "Reuse config from Vite or Vitest").option("--report", "Size report", { default: true }).option("--env.* <value>", "Define compile-time env variables").option("--on-success <command>", "Command to run on success").option("--copy <dir>", "Copy files to output dir").option("--public-dir <dir>", "Alias for --copy, deprecated").option("--tsconfig <tsconfig>", "Set tsconfig path").option("--unbundle", "Unbundle mode").option("-W, --workspace [dir]", "Enable workspace mode").option("-F, --filter <pattern>", "Filter workspace packages, e.g. /regex/ or substring").option("--exports", "Generate export-related metadata for package.json (experimental)").action(async (input, flags) => {
|
|
18
18
|
logger.setSilent(!!flags.silent);
|
|
19
19
|
logger.info(`tsdown ${dim`v${version}`} powered by rolldown ${dim`v${VERSION}`}`);
|
|
20
20
|
const { build: build$1 } = await import("./index.js");
|
|
@@ -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-BcMqjqIs.js");
|
|
26
26
|
await migrate(args);
|
|
27
27
|
});
|
|
28
28
|
async function runCLI() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tsdown",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.6",
|
|
4
4
|
"description": "The Elegant Bundler for Libraries",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -43,12 +43,16 @@
|
|
|
43
43
|
"access": "public"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
|
+
"@arethetypeswrong/core": "^0.18.1",
|
|
46
47
|
"publint": "^0.3.0",
|
|
47
48
|
"typescript": "^5.0.0",
|
|
48
49
|
"unplugin-lightningcss": "^0.4.0",
|
|
49
50
|
"unplugin-unused": "^0.5.0"
|
|
50
51
|
},
|
|
51
52
|
"peerDependenciesMeta": {
|
|
53
|
+
"@arethetypeswrong/core": {
|
|
54
|
+
"optional": true
|
|
55
|
+
},
|
|
52
56
|
"publint": {
|
|
53
57
|
"optional": true
|
|
54
58
|
},
|
|
@@ -63,29 +67,31 @@
|
|
|
63
67
|
}
|
|
64
68
|
},
|
|
65
69
|
"dependencies": {
|
|
66
|
-
"ansis": "^4.
|
|
70
|
+
"ansis": "^4.1.0",
|
|
67
71
|
"cac": "^6.7.14",
|
|
68
72
|
"chokidar": "^4.0.3",
|
|
69
73
|
"debug": "^4.4.1",
|
|
70
74
|
"diff": "^8.0.2",
|
|
71
75
|
"empathic": "^1.1.0",
|
|
72
76
|
"hookable": "^5.5.3",
|
|
73
|
-
"rolldown": "1.0.0-beta.
|
|
74
|
-
"rolldown-plugin-dts": "^0.13.
|
|
77
|
+
"rolldown": "1.0.0-beta.10-commit.87188ed",
|
|
78
|
+
"rolldown-plugin-dts": "^0.13.6",
|
|
75
79
|
"semver": "^7.7.2",
|
|
76
80
|
"tinyexec": "^1.0.1",
|
|
77
81
|
"tinyglobby": "^0.2.14",
|
|
78
82
|
"unconfig": "^7.3.2"
|
|
79
83
|
},
|
|
80
84
|
"devDependencies": {
|
|
85
|
+
"@arethetypeswrong/core": "^0.18.1",
|
|
81
86
|
"@oxc-node/core": "^0.0.27",
|
|
82
87
|
"@sxzz/eslint-config": "^7.0.1",
|
|
83
88
|
"@sxzz/prettier-config": "^2.2.1",
|
|
84
89
|
"@sxzz/test-utils": "^0.5.6",
|
|
85
90
|
"@types/debug": "^4.1.12",
|
|
86
|
-
"@types/node": "^22.15.
|
|
91
|
+
"@types/node": "^22.15.27",
|
|
87
92
|
"@types/semver": "^7.7.0",
|
|
88
93
|
"@unocss/eslint-plugin": "^66.1.2",
|
|
94
|
+
"@vueuse/core": "^13.3.0",
|
|
89
95
|
"bumpp": "^10.1.1",
|
|
90
96
|
"eslint": "^9.27.0",
|
|
91
97
|
"lightningcss": "^1.30.1",
|
|
@@ -98,16 +104,20 @@
|
|
|
98
104
|
"unocss": "^66.1.2",
|
|
99
105
|
"unplugin-lightningcss": "^0.4.1",
|
|
100
106
|
"unplugin-unused": "^0.5.0",
|
|
101
|
-
"vite": "
|
|
107
|
+
"vite": "npm:rolldown-vite@latest",
|
|
102
108
|
"vitepress": "^1.6.3",
|
|
103
109
|
"vitepress-plugin-group-icons": "^1.5.5",
|
|
104
110
|
"vitepress-plugin-llms": "^1.3.4",
|
|
105
111
|
"vitest": "^3.1.4",
|
|
106
|
-
"vue": "^3.5.
|
|
112
|
+
"vue": "^3.5.16"
|
|
107
113
|
},
|
|
108
114
|
"engines": {
|
|
109
115
|
"node": ">=18.0.0"
|
|
110
116
|
},
|
|
117
|
+
"resolutions": {
|
|
118
|
+
"rolldown": "catalog:prod",
|
|
119
|
+
"vite": "catalog:docs"
|
|
120
|
+
},
|
|
111
121
|
"prettier": "@sxzz/prettier-config",
|
|
112
122
|
"scripts": {
|
|
113
123
|
"lint": "eslint --cache --max-warnings 0 .",
|