tsdown 0.11.12 → 0.12.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-GQTSGL72.d.ts → config-DttGOO6N.d.ts} +1 -1
- package/dist/config.d.ts +2 -2
- package/dist/index.d.ts +5 -4
- package/dist/index.js +92 -14
- package/dist/{logger-BdIBA2vO.js → logger-DcIo21Wv.js} +5 -1
- package/dist/{migrate-DFC9EXfl.js → migrate-Cq_lJ3EI.js} +2 -2
- package/dist/package-rd2yGx0m.js +5 -0
- package/dist/{plugins-G7Z0rtO5.js → plugins-BV3QPDFO.js} +1 -1
- package/dist/plugins.d.ts +1 -1
- package/dist/plugins.js +2 -2
- package/dist/run.js +4 -4
- package/dist/{types-CsOn0For.d.ts → types-CHTYRF4v.d.ts} +14 -7
- package/package.json +6 -6
- package/dist/package-DQpXq2zc.js +0 -5
package/dist/config.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { UserConfig, UserConfigFn } from "./types-
|
|
2
|
-
import { defineConfig$1 as defineConfig } from "./config-
|
|
1
|
+
import { UserConfig, UserConfigFn } from "./types-CHTYRF4v.js";
|
|
2
|
+
import { defineConfig$1 as defineConfig } from "./config-DttGOO6N.js";
|
|
3
3
|
export { UserConfig, UserConfigFn, defineConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { BuildContext, Options, ResolvedOptions, TsdownHooks, UserConfig, UserConfigFn } from "./types-
|
|
2
|
-
import { defineConfig$1 as defineConfig } from "./config-
|
|
1
|
+
import { BuildContext, NormalizedFormat, Options, ResolvedOptions, TsdownHooks, UserConfig, UserConfigFn } from "./types-CHTYRF4v.js";
|
|
2
|
+
import { defineConfig$1 as defineConfig } from "./config-DttGOO6N.js";
|
|
3
3
|
import "ansis";
|
|
4
|
-
import { InternalModuleFormat } from "rolldown";
|
|
4
|
+
import { InternalModuleFormat, OutputAsset, OutputChunk } from "rolldown";
|
|
5
5
|
|
|
6
6
|
//#region src/utils/logger.d.ts
|
|
7
7
|
declare class Logger {
|
|
@@ -20,6 +20,7 @@ declare const logger: Logger; //#endregion
|
|
|
20
20
|
*/
|
|
21
21
|
declare function build(userOptions?: Options): Promise<void>;
|
|
22
22
|
declare const pkgRoot: string;
|
|
23
|
+
type TsdownChunks = Partial<Record<NormalizedFormat, Array<OutputChunk | OutputAsset>>>;
|
|
23
24
|
/**
|
|
24
25
|
* Build a single configuration, without watch and shortcuts features.
|
|
25
26
|
*
|
|
@@ -31,4 +32,4 @@ declare const pkgRoot: string;
|
|
|
31
32
|
declare function buildSingle(config: ResolvedOptions, clean: () => Promise<void>): Promise<(() => Promise<void>) | undefined>;
|
|
32
33
|
|
|
33
34
|
//#endregion
|
|
34
|
-
export { BuildContext, Options, TsdownHooks, UserConfig, UserConfigFn, build, buildSingle, defineConfig, logger, pkgRoot };
|
|
35
|
+
export { BuildContext, Options, TsdownChunks, TsdownHooks, UserConfig, UserConfigFn, build, buildSingle, defineConfig, logger, pkgRoot };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineConfig } from "./config-yiJy1jd0.js";
|
|
2
|
-
import { ExternalPlugin, NodeProtocolPlugin, ReportPlugin, ShebangPlugin, fsCopy, fsRemove, fsStat, lowestCommonAncestor } from "./plugins-
|
|
3
|
-
import { debounce, generateColor, logger, prettyName, resolveComma, slash, toArray } from "./logger-
|
|
2
|
+
import { ExternalPlugin, NodeProtocolPlugin, ReportPlugin, ShebangPlugin, fsCopy, fsRemove, fsStat, lowestCommonAncestor } from "./plugins-BV3QPDFO.js";
|
|
3
|
+
import { debounce, generateColor, logger, prettyName, resolveComma, resolveRegex, slash, toArray } from "./logger-DcIo21Wv.js";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import process from "node:process";
|
|
6
6
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
@@ -9,7 +9,8 @@ import { build as build$1 } from "rolldown";
|
|
|
9
9
|
import { exec } from "tinyexec";
|
|
10
10
|
import Debug from "debug";
|
|
11
11
|
import { glob } from "tinyglobby";
|
|
12
|
-
import { readFile } from "node:fs/promises";
|
|
12
|
+
import { readFile, writeFile } from "node:fs/promises";
|
|
13
|
+
import { RE_DTS } from "rolldown-plugin-dts";
|
|
13
14
|
import { createHooks } from "hookable";
|
|
14
15
|
import { up } from "empathic/package";
|
|
15
16
|
import readline from "node:readline";
|
|
@@ -65,6 +66,71 @@ function cp$1(cwd, from, to) {
|
|
|
65
66
|
return fsCopy(path.resolve(cwd, from), path.resolve(cwd, to));
|
|
66
67
|
}
|
|
67
68
|
|
|
69
|
+
//#endregion
|
|
70
|
+
//#region src/features/exports.ts
|
|
71
|
+
async function writeExports(options, chunks) {
|
|
72
|
+
if (!options.exports) return;
|
|
73
|
+
const { outDir, pkg } = options;
|
|
74
|
+
if (!pkg) throw new Error("`package.json` not found, cannot write exports");
|
|
75
|
+
const generated = generateExports(pkg, outDir, chunks);
|
|
76
|
+
await writeFile(pkg.packageJsonPath, `${JSON.stringify({
|
|
77
|
+
...pkg,
|
|
78
|
+
...generated,
|
|
79
|
+
packageJsonPath: void 0
|
|
80
|
+
}, null, 2)}\n`);
|
|
81
|
+
}
|
|
82
|
+
function generateExports(pkg, outDir, chunks) {
|
|
83
|
+
const packageJsonPath = pkg.packageJsonPath;
|
|
84
|
+
const basePath = path.relative(path.dirname(packageJsonPath), outDir);
|
|
85
|
+
let main, module, cjsTypes, esmTypes;
|
|
86
|
+
const exportsMap = new Map();
|
|
87
|
+
for (const [format, chunksByFormat] of Object.entries(chunks)) {
|
|
88
|
+
if (format !== "es" && format !== "cjs") continue;
|
|
89
|
+
const onlyOneEntry = chunksByFormat.filter((chunk) => chunk.type === "chunk" && chunk.isEntry && !RE_DTS.test(chunk.fileName)).length === 1;
|
|
90
|
+
for (const chunk of chunksByFormat) {
|
|
91
|
+
if (chunk.type !== "chunk" || !chunk.isEntry) continue;
|
|
92
|
+
const distFile = `./${path.join(basePath, chunk.fileName)}`;
|
|
93
|
+
const ext = path.extname(chunk.fileName);
|
|
94
|
+
let name = chunk.fileName.slice(0, -ext.length);
|
|
95
|
+
const isDts = name.endsWith(".d");
|
|
96
|
+
if (isDts) name = name.slice(0, -2);
|
|
97
|
+
const isIndex = name === "index" || onlyOneEntry;
|
|
98
|
+
if (isIndex) {
|
|
99
|
+
name = ".";
|
|
100
|
+
if (format === "cjs") if (isDts) cjsTypes = distFile;
|
|
101
|
+
else main = distFile;
|
|
102
|
+
else if (format === "es") if (isDts) esmTypes = distFile;
|
|
103
|
+
else module = distFile;
|
|
104
|
+
} else name = `./${name}`;
|
|
105
|
+
let map = exportsMap.get(name);
|
|
106
|
+
if (!map) {
|
|
107
|
+
map = new Map();
|
|
108
|
+
exportsMap.set(name, map);
|
|
109
|
+
}
|
|
110
|
+
if (!isDts && !RE_DTS.test(chunk.fileName)) map.set(format, distFile);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
const exports = Object.fromEntries(Array.from(exportsMap.entries()).sort(([a], [b]) => {
|
|
114
|
+
if (a === "index") return -1;
|
|
115
|
+
return a.localeCompare(b);
|
|
116
|
+
}).map(([name, map]) => {
|
|
117
|
+
let value;
|
|
118
|
+
if (map.size === 1) value = map.get("cjs") || map.get("es");
|
|
119
|
+
else value = {
|
|
120
|
+
import: map.get("es"),
|
|
121
|
+
require: map.get("cjs")
|
|
122
|
+
};
|
|
123
|
+
return [name, value];
|
|
124
|
+
}));
|
|
125
|
+
if (!exports["./package.json"]) exports["./package.json"] = "./package.json";
|
|
126
|
+
return {
|
|
127
|
+
main: main || module || pkg.main,
|
|
128
|
+
module: module || pkg.module,
|
|
129
|
+
types: cjsTypes || esmTypes || pkg.types,
|
|
130
|
+
exports
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
|
|
68
134
|
//#endregion
|
|
69
135
|
//#region src/features/hooks.ts
|
|
70
136
|
async function createHooks$1(options, pkg) {
|
|
@@ -141,7 +207,10 @@ async function readPackageJson(dir) {
|
|
|
141
207
|
if (!packageJsonPath) return;
|
|
142
208
|
debug$2("Reading package.json:", packageJsonPath);
|
|
143
209
|
const contents = await readFile(packageJsonPath, "utf8");
|
|
144
|
-
return
|
|
210
|
+
return {
|
|
211
|
+
...JSON.parse(contents),
|
|
212
|
+
packageJsonPath
|
|
213
|
+
};
|
|
145
214
|
}
|
|
146
215
|
function getPackageType(pkg) {
|
|
147
216
|
if (pkg?.type) {
|
|
@@ -599,7 +668,7 @@ async function resolveWorkspace(config, options) {
|
|
|
599
668
|
};
|
|
600
669
|
}
|
|
601
670
|
async function resolveConfig(userConfig) {
|
|
602
|
-
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 } = userConfig;
|
|
671
|
+
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 } = userConfig;
|
|
603
672
|
outDir = path.resolve(cwd, outDir);
|
|
604
673
|
clean = resolveClean(clean, outDir, cwd);
|
|
605
674
|
const pkg = await readPackageJson(cwd);
|
|
@@ -608,6 +677,8 @@ async function resolveConfig(userConfig) {
|
|
|
608
677
|
if (dts == null) dts = !!(pkg?.types || pkg?.typings);
|
|
609
678
|
target = resolveTarget(target, pkg, name);
|
|
610
679
|
tsconfig = await resolveTsconfig(tsconfig, cwd, name);
|
|
680
|
+
if (typeof external === "string") external = resolveRegex(external);
|
|
681
|
+
if (typeof noExternal === "string") noExternal = resolveRegex(noExternal);
|
|
611
682
|
if (publint$1 === true) publint$1 = {};
|
|
612
683
|
if (publicDir) if (copy$1) throw new TypeError("`publicDir` is deprecated. Cannot be used with `copy`");
|
|
613
684
|
else logger.warn(`${blue`publicDir`} is deprecated. Use ${blue`copy`} instead.`);
|
|
@@ -647,7 +718,9 @@ async function resolveConfig(userConfig) {
|
|
|
647
718
|
pkg,
|
|
648
719
|
copy: publicDir || copy$1,
|
|
649
720
|
hash: hash ?? true,
|
|
650
|
-
name
|
|
721
|
+
name,
|
|
722
|
+
external,
|
|
723
|
+
noExternal
|
|
651
724
|
};
|
|
652
725
|
return config;
|
|
653
726
|
}
|
|
@@ -710,15 +783,20 @@ async function buildSingle(config, clean) {
|
|
|
710
783
|
await clean();
|
|
711
784
|
let hasErrors = false;
|
|
712
785
|
const isMultiFormat = formats.length > 1;
|
|
786
|
+
const chunks = {};
|
|
713
787
|
await Promise.all(formats.map(async (format) => {
|
|
714
788
|
try {
|
|
715
|
-
const buildOptions = await getBuildOptions(config, format,
|
|
789
|
+
const buildOptions = await getBuildOptions(config, format, isMultiFormat, false);
|
|
716
790
|
await hooks.callHook("build:before", {
|
|
717
791
|
...context,
|
|
718
792
|
buildOptions
|
|
719
793
|
});
|
|
720
|
-
await build$1(buildOptions);
|
|
721
|
-
|
|
794
|
+
const { output } = await build$1(buildOptions);
|
|
795
|
+
chunks[format] = output;
|
|
796
|
+
if (format === "cjs" && dts) {
|
|
797
|
+
const { output: output$1 } = await build$1(await getBuildOptions(config, format, isMultiFormat, true));
|
|
798
|
+
chunks[format].push(...output$1);
|
|
799
|
+
}
|
|
722
800
|
} catch (error) {
|
|
723
801
|
if (watch) {
|
|
724
802
|
logger.error(error);
|
|
@@ -729,6 +807,7 @@ async function buildSingle(config, clean) {
|
|
|
729
807
|
}
|
|
730
808
|
}));
|
|
731
809
|
if (hasErrors) return;
|
|
810
|
+
await writeExports(config, chunks);
|
|
732
811
|
await publint(config);
|
|
733
812
|
await copy(config);
|
|
734
813
|
await hooks.callHook("build:done", context);
|
|
@@ -745,7 +824,7 @@ async function buildSingle(config, clean) {
|
|
|
745
824
|
} else await onSuccess?.(config);
|
|
746
825
|
}
|
|
747
826
|
}
|
|
748
|
-
async function getBuildOptions(config, format,
|
|
827
|
+
async function getBuildOptions(config, format, isMultiFormat, cjsDts) {
|
|
749
828
|
const { entry, external, plugins: userPlugins, outDir, platform, alias, treeshake, sourcemap, dts, minify, unused, target, define, shims, tsconfig, cwd, report, env, removeNodeProtocol, loader, name } = config;
|
|
750
829
|
const plugins = [];
|
|
751
830
|
if (removeNodeProtocol) plugins.push(NodeProtocolPlugin());
|
|
@@ -767,12 +846,11 @@ async function getBuildOptions(config, format, cjsDts, isMultiFormat) {
|
|
|
767
846
|
const { Unused } = await import("unplugin-unused");
|
|
768
847
|
plugins.push(Unused.rolldown(unused === true ? {} : unused));
|
|
769
848
|
}
|
|
770
|
-
if (target) plugins.push(RuntimeHelperCheckPlugin(target));
|
|
849
|
+
if (target) plugins.push(RuntimeHelperCheckPlugin(target), await LightningCSSPlugin({ target }));
|
|
771
850
|
plugins.push(ShebangPlugin(cwd, name, isMultiFormat));
|
|
772
851
|
}
|
|
773
852
|
if (report && !logger.silent) plugins.push(ReportPlugin(report, cwd, cjsDts, name, isMultiFormat));
|
|
774
|
-
if (
|
|
775
|
-
plugins.push(userPlugins);
|
|
853
|
+
if (!cjsDts) plugins.push(userPlugins);
|
|
776
854
|
const inputOptions = await mergeUserOptions({
|
|
777
855
|
input: entry,
|
|
778
856
|
cwd,
|
|
@@ -803,7 +881,7 @@ async function getBuildOptions(config, format, cjsDts, isMultiFormat) {
|
|
|
803
881
|
sourcemap,
|
|
804
882
|
dir: outDir,
|
|
805
883
|
target,
|
|
806
|
-
minify,
|
|
884
|
+
minify: !cjsDts && minify,
|
|
807
885
|
entryFileNames,
|
|
808
886
|
chunkFileNames
|
|
809
887
|
}, config.outputOptions, [format]);
|
|
@@ -11,6 +11,10 @@ function toArray(val, defaultValue) {
|
|
|
11
11
|
function resolveComma(arr) {
|
|
12
12
|
return arr.flatMap((format) => format.split(","));
|
|
13
13
|
}
|
|
14
|
+
function resolveRegex(str) {
|
|
15
|
+
if (str.length > 2 && str[0] === "/" && str.at(-1) === "/") return new RegExp(str.slice(1, -1));
|
|
16
|
+
return str;
|
|
17
|
+
}
|
|
14
18
|
function debounce(fn, wait) {
|
|
15
19
|
let timeout;
|
|
16
20
|
return function(...args) {
|
|
@@ -113,4 +117,4 @@ function hue2rgb(p, q, t) {
|
|
|
113
117
|
}
|
|
114
118
|
|
|
115
119
|
//#endregion
|
|
116
|
-
export { debounce, generateColor, logger, noop, prettyFormat, prettyName, resolveComma, slash, toArray };
|
|
120
|
+
export { debounce, generateColor, logger, noop, prettyFormat, prettyName, resolveComma, resolveRegex, slash, toArray };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { logger } from "./logger-
|
|
2
|
-
import { version } from "./package-
|
|
1
|
+
import { logger } from "./logger-DcIo21Wv.js";
|
|
2
|
+
import { version } from "./package-rd2yGx0m.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,4 +1,4 @@
|
|
|
1
|
-
import { logger, noop, prettyFormat, prettyName, toArray } from "./logger-
|
|
1
|
+
import { logger, noop, prettyFormat, prettyName, toArray } from "./logger-DcIo21Wv.js";
|
|
2
2
|
import path, { dirname, normalize, sep } from "node:path";
|
|
3
3
|
import { bold, dim, green, underline } from "ansis";
|
|
4
4
|
import Debug from "debug";
|
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-BV3QPDFO.js";
|
|
2
|
+
import "./logger-DcIo21Wv.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, resolveComma, toArray } from "./logger-
|
|
3
|
-
import { version } from "./package-
|
|
2
|
+
import { logger, resolveComma, toArray } from "./logger-DcIo21Wv.js";
|
|
3
|
+
import { version } from "./package-rd2yGx0m.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("--format <format>", "Bundle format: esm, cjs, iife", { default: "esm" }).option("--clean", "Clean output directory").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("-W, --workspace [dir]", "Enable workspace mode").option("-
|
|
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("-W, --workspace [dir]", "Enable workspace mode").option("-F, --filter <pattern>", "Filter workspace packages, e.g. /regex/ or substring").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-Cq_lJ3EI.js");
|
|
26
26
|
await migrate(args);
|
|
27
27
|
});
|
|
28
28
|
async function runCLI() {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BuildOptions, ExternalOption, InputOption, InputOptions, InternalModuleFormat, MinifyOptions, ModuleFormat, OutputOptions, Plugin } from "rolldown";
|
|
2
|
+
import { Options } from "rolldown-plugin-dts";
|
|
2
3
|
import { Hookable } from "hookable";
|
|
3
|
-
import { Options } from "publint";
|
|
4
|
-
import { Options as Options$1 } from "rolldown-plugin-dts";
|
|
4
|
+
import { Options as Options$1 } from "publint";
|
|
5
5
|
import { Options as Options$2 } from "unplugin-unused";
|
|
6
6
|
import { PackageJson } from "pkg-types";
|
|
7
7
|
|
|
@@ -229,7 +229,7 @@ interface Options$3 {
|
|
|
229
229
|
* - If the `types` field is present in `package.json`, declaration file emission is enabled.
|
|
230
230
|
* - If the `types` field is absent, declaration file emission is disabled by default.
|
|
231
231
|
*/
|
|
232
|
-
dts?: boolean | Options
|
|
232
|
+
dts?: boolean | Options;
|
|
233
233
|
/**
|
|
234
234
|
* Enable unused dependencies check with `unplugin-unused`
|
|
235
235
|
* Requires `unplugin-unused` to be installed.
|
|
@@ -241,13 +241,20 @@ interface Options$3 {
|
|
|
241
241
|
* Requires `publint` to be installed.
|
|
242
242
|
* @default false
|
|
243
243
|
*/
|
|
244
|
-
publint?: boolean | Options;
|
|
244
|
+
publint?: boolean | Options$1;
|
|
245
245
|
/**
|
|
246
246
|
* Enable size reporting after bundling.
|
|
247
247
|
* @default true
|
|
248
248
|
*/
|
|
249
249
|
report?: boolean | ReportOptions;
|
|
250
250
|
/**
|
|
251
|
+
* Generate exports map for `package.json`.
|
|
252
|
+
*
|
|
253
|
+
* This will set the `main`, `module`, `types`, `exports` fields in `package.json`
|
|
254
|
+
* to point to the generated files.
|
|
255
|
+
*/
|
|
256
|
+
exports?: boolean;
|
|
257
|
+
/**
|
|
251
258
|
* Compile-time env variables.
|
|
252
259
|
* @example
|
|
253
260
|
* ```json
|
|
@@ -310,13 +317,13 @@ interface Options$3 {
|
|
|
310
317
|
*/
|
|
311
318
|
type UserConfig = Arrayable<Omit<Options$3, "config" | "filter">>;
|
|
312
319
|
type UserConfigFn = (cliOptions: Options$3) => Awaitable<UserConfig>;
|
|
313
|
-
type ResolvedOptions = Omit<Overwrite<MarkPartial<Omit<Options$3, "publicDir" | "workspace" | "filter">, "globalName" | "inputOptions" | "outputOptions" | "minify" | "define" | "alias" | "external" | "noExternal" | "onSuccess" | "fixedExtension" | "outExtensions" | "hooks" | "removeNodeProtocol" | "copy" | "loader" | "name">, {
|
|
320
|
+
type ResolvedOptions = Omit<Overwrite<MarkPartial<Omit<Options$3, "publicDir" | "workspace" | "filter">, "globalName" | "inputOptions" | "outputOptions" | "minify" | "define" | "alias" | "external" | "noExternal" | "onSuccess" | "fixedExtension" | "outExtensions" | "hooks" | "removeNodeProtocol" | "copy" | "loader" | "name" | "exports">, {
|
|
314
321
|
format: NormalizedFormat[];
|
|
315
322
|
target?: string[];
|
|
316
323
|
clean: string[];
|
|
317
|
-
dts: false | Options
|
|
324
|
+
dts: false | Options;
|
|
318
325
|
report: false | ReportOptions;
|
|
319
326
|
tsconfig: string | false;
|
|
320
327
|
pkg?: PackageJson;
|
|
321
328
|
}>, "config" | "fromVite">; //#endregion
|
|
322
|
-
export { BuildContext, Options$3 as Options, ReportPlugin as ReportPlugin$1, ResolvedOptions, TsdownHooks, UserConfig, UserConfigFn };
|
|
329
|
+
export { BuildContext, NormalizedFormat, Options$3 as Options, ReportPlugin as ReportPlugin$1, ResolvedOptions, TsdownHooks, UserConfig, UserConfigFn };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tsdown",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "The Elegant Bundler for Libraries",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
".": "./dist/index.js",
|
|
26
26
|
"./config": "./dist/config.js",
|
|
27
27
|
"./plugins": "./dist/plugins.js",
|
|
28
|
+
"./run": "./dist/run.js",
|
|
28
29
|
"./package.json": "./package.json"
|
|
29
30
|
},
|
|
30
31
|
"typesVersions": {
|
|
@@ -70,7 +71,7 @@
|
|
|
70
71
|
"empathic": "^1.1.0",
|
|
71
72
|
"hookable": "^5.5.3",
|
|
72
73
|
"rolldown": "1.0.0-beta.9",
|
|
73
|
-
"rolldown-plugin-dts": "^0.13.
|
|
74
|
+
"rolldown-plugin-dts": "^0.13.4",
|
|
74
75
|
"semver": "^7.7.2",
|
|
75
76
|
"tinyexec": "^1.0.1",
|
|
76
77
|
"tinyglobby": "^0.2.13",
|
|
@@ -82,7 +83,7 @@
|
|
|
82
83
|
"@sxzz/prettier-config": "^2.2.1",
|
|
83
84
|
"@sxzz/test-utils": "^0.5.6",
|
|
84
85
|
"@types/debug": "^4.1.12",
|
|
85
|
-
"@types/node": "^22.15.
|
|
86
|
+
"@types/node": "^22.15.21",
|
|
86
87
|
"@types/semver": "^7.7.0",
|
|
87
88
|
"@unocss/eslint-plugin": "^66.1.2",
|
|
88
89
|
"bumpp": "^10.1.1",
|
|
@@ -91,7 +92,6 @@
|
|
|
91
92
|
"pkg-types": "^2.1.0",
|
|
92
93
|
"prettier": "^3.5.3",
|
|
93
94
|
"publint": "^0.3.12",
|
|
94
|
-
"tsup": "^8.5.0",
|
|
95
95
|
"typedoc": "^0.28.4",
|
|
96
96
|
"typedoc-plugin-markdown": "^4.6.3",
|
|
97
97
|
"typescript": "~5.8.3",
|
|
@@ -101,8 +101,8 @@
|
|
|
101
101
|
"vite": "^6.3.5",
|
|
102
102
|
"vitepress": "^1.6.3",
|
|
103
103
|
"vitepress-plugin-group-icons": "^1.5.5",
|
|
104
|
-
"vitepress-plugin-llms": "^1.2
|
|
105
|
-
"vitest": "^3.1.
|
|
104
|
+
"vitepress-plugin-llms": "^1.3.2",
|
|
105
|
+
"vitest": "^3.1.4",
|
|
106
106
|
"vue": "^3.5.14"
|
|
107
107
|
},
|
|
108
108
|
"engines": {
|