tsdown 0.11.10 → 0.11.12
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-Cyqx6Xup.d.ts → config-GQTSGL72.d.ts} +1 -1
- package/dist/config.d.ts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +29 -35
- package/dist/{migrate-Bt-9GxhE.js → migrate-DFC9EXfl.js} +1 -1
- package/dist/package-DQpXq2zc.js +5 -0
- package/dist/{plugins-AcF8M16F.js → plugins-G7Z0rtO5.js} +9 -9
- package/dist/plugins.d.ts +4 -1
- package/dist/plugins.js +1 -1
- package/dist/run.js +7 -7
- package/dist/{index-B5B9KM9d.d.ts → types-CsOn0For.d.ts} +5 -1
- package/package.json +6 -6
- package/dist/package-DNOe3jsX.js +0 -5
package/dist/config.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { UserConfig, UserConfigFn } from "./
|
|
2
|
-
import { defineConfig$1 as defineConfig } from "./config-
|
|
1
|
+
import { UserConfig, UserConfigFn } from "./types-CsOn0For.js";
|
|
2
|
+
import { defineConfig$1 as defineConfig } from "./config-GQTSGL72.js";
|
|
3
3
|
export { UserConfig, UserConfigFn, defineConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BuildContext, Options, ResolvedOptions, TsdownHooks, UserConfig, UserConfigFn } from "./
|
|
2
|
-
import { defineConfig$1 as defineConfig } from "./config-
|
|
1
|
+
import { BuildContext, Options, ResolvedOptions, TsdownHooks, UserConfig, UserConfigFn } from "./types-CsOn0For.js";
|
|
2
|
+
import { defineConfig$1 as defineConfig } from "./config-GQTSGL72.js";
|
|
3
3
|
import "ansis";
|
|
4
4
|
import { InternalModuleFormat } from "rolldown";
|
|
5
5
|
|
package/dist/index.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { defineConfig } from "./config-yiJy1jd0.js";
|
|
2
|
-
import { ExternalPlugin, NodeProtocolPlugin, ReportPlugin, ShebangPlugin, fsCopy, fsRemove, fsStat, lowestCommonAncestor } from "./plugins-
|
|
2
|
+
import { ExternalPlugin, NodeProtocolPlugin, ReportPlugin, ShebangPlugin, fsCopy, fsRemove, fsStat, lowestCommonAncestor } from "./plugins-G7Z0rtO5.js";
|
|
3
3
|
import { debounce, generateColor, logger, prettyName, resolveComma, slash, toArray } from "./logger-BdIBA2vO.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
|
-
import { transformPlugin } from "rolldown/experimental";
|
|
10
9
|
import { exec } from "tinyexec";
|
|
11
|
-
import
|
|
10
|
+
import Debug from "debug";
|
|
12
11
|
import { glob } from "tinyglobby";
|
|
13
12
|
import { readFile } from "node:fs/promises";
|
|
14
13
|
import { createHooks } from "hookable";
|
|
@@ -19,7 +18,7 @@ import { up as up$1 } from "empathic/find";
|
|
|
19
18
|
import { loadConfig } from "unconfig";
|
|
20
19
|
|
|
21
20
|
//#region src/features/clean.ts
|
|
22
|
-
const debug$
|
|
21
|
+
const debug$3 = Debug("tsdown:clean");
|
|
23
22
|
const RE_LAST_SLASH = /[/\\]$/;
|
|
24
23
|
async function cleanOutDir(configs) {
|
|
25
24
|
const removes = new Set();
|
|
@@ -39,10 +38,10 @@ async function cleanOutDir(configs) {
|
|
|
39
38
|
if (!removes.size) return;
|
|
40
39
|
logger.info(`Cleaning ${removes.size} files`);
|
|
41
40
|
await Promise.all([...removes].map(async (file) => {
|
|
42
|
-
debug$
|
|
41
|
+
debug$3("Removing", file);
|
|
43
42
|
await fsRemove(file);
|
|
44
43
|
}));
|
|
45
|
-
debug$
|
|
44
|
+
debug$3("Removed %d files", removes.size);
|
|
46
45
|
}
|
|
47
46
|
function resolveClean(clean, outDir, cwd) {
|
|
48
47
|
if (clean === true) clean = [slash(outDir)];
|
|
@@ -136,11 +135,11 @@ async function LightningCSSPlugin(options) {
|
|
|
136
135
|
|
|
137
136
|
//#endregion
|
|
138
137
|
//#region src/utils/package.ts
|
|
139
|
-
const debug$
|
|
138
|
+
const debug$2 = Debug("tsdown:package");
|
|
140
139
|
async function readPackageJson(dir) {
|
|
141
140
|
const packageJsonPath = up({ cwd: dir });
|
|
142
141
|
if (!packageJsonPath) return;
|
|
143
|
-
debug$
|
|
142
|
+
debug$2("Reading package.json:", packageJsonPath);
|
|
144
143
|
const contents = await readFile(packageJsonPath, "utf8");
|
|
145
144
|
return JSON.parse(contents);
|
|
146
145
|
}
|
|
@@ -198,7 +197,7 @@ function createChunkFilename(basename, jsExtension, dtsExtension) {
|
|
|
198
197
|
|
|
199
198
|
//#endregion
|
|
200
199
|
//#region src/features/publint.ts
|
|
201
|
-
const debug$
|
|
200
|
+
const debug$1 = Debug("tsdown:publint");
|
|
202
201
|
async function publint(options) {
|
|
203
202
|
if (!options.publint) return;
|
|
204
203
|
if (!options.pkg) {
|
|
@@ -206,11 +205,11 @@ async function publint(options) {
|
|
|
206
205
|
return;
|
|
207
206
|
}
|
|
208
207
|
const t = performance.now();
|
|
209
|
-
debug$
|
|
208
|
+
debug$1("Running publint");
|
|
210
209
|
const { publint: publint$1 } = await import("publint");
|
|
211
210
|
const { formatMessage } = await import("publint/utils");
|
|
212
211
|
const { messages } = await publint$1(options.publint === true ? {} : options.publint);
|
|
213
|
-
debug$
|
|
212
|
+
debug$1("Found %d issues", messages.length);
|
|
214
213
|
if (!messages.length) logger.success(`No publint issues found`, dim`(${Math.round(performance.now() - t)}ms)`);
|
|
215
214
|
let hasError = false;
|
|
216
215
|
for (const message of messages) {
|
|
@@ -224,7 +223,7 @@ async function publint(options) {
|
|
|
224
223
|
logger[logType](formattedMessage);
|
|
225
224
|
}
|
|
226
225
|
if (hasError) {
|
|
227
|
-
debug$
|
|
226
|
+
debug$1("Found errors, setting exit code to 1");
|
|
228
227
|
process.exitCode = 1;
|
|
229
228
|
}
|
|
230
229
|
}
|
|
@@ -355,7 +354,8 @@ async function watchBuild(options, configFiles, rebuild, restart) {
|
|
|
355
354
|
ignored: [
|
|
356
355
|
/[\\/]\.git[\\/]/,
|
|
357
356
|
/[\\/]node_modules[\\/]/,
|
|
358
|
-
options.outDir
|
|
357
|
+
options.outDir,
|
|
358
|
+
...toArray(options.ignoreWatch)
|
|
359
359
|
]
|
|
360
360
|
});
|
|
361
361
|
watcher.on("all", (type, file) => {
|
|
@@ -513,7 +513,7 @@ async function loadConfigFile(options, workspace) {
|
|
|
513
513
|
|
|
514
514
|
//#endregion
|
|
515
515
|
//#region src/options/index.ts
|
|
516
|
-
const debug
|
|
516
|
+
const debug = Debug("tsdown:options");
|
|
517
517
|
const DEFAULT_EXCLUDE_WORKSPACE = [
|
|
518
518
|
"**/node_modules/**",
|
|
519
519
|
"**/dist/**",
|
|
@@ -522,20 +522,20 @@ const DEFAULT_EXCLUDE_WORKSPACE = [
|
|
|
522
522
|
];
|
|
523
523
|
async function resolveOptions(options) {
|
|
524
524
|
const files = [];
|
|
525
|
-
debug
|
|
526
|
-
debug
|
|
525
|
+
debug("options %O", options);
|
|
526
|
+
debug("loading config file: %s", options.config);
|
|
527
527
|
const { configs: rootConfigs, file } = await loadConfigFile(options);
|
|
528
528
|
if (file) {
|
|
529
529
|
files.push(file);
|
|
530
|
-
debug
|
|
531
|
-
debug
|
|
532
|
-
} else debug
|
|
530
|
+
debug("loaded root config file %s", file);
|
|
531
|
+
debug("root configs %o", rootConfigs);
|
|
532
|
+
} else debug("no root config file found");
|
|
533
533
|
const configs = (await Promise.all(rootConfigs.map(async (rootConfig) => {
|
|
534
534
|
const { configs: workspaceConfigs, files: workspaceFiles } = await resolveWorkspace(rootConfig, options);
|
|
535
535
|
if (workspaceFiles) files.push(...workspaceFiles);
|
|
536
|
-
return Promise.all(workspaceConfigs.filter((config) => !config.workspace || config.entry
|
|
536
|
+
return Promise.all(workspaceConfigs.filter((config) => !config.workspace || config.entry).map((config) => resolveConfig(config)));
|
|
537
537
|
}))).flat();
|
|
538
|
-
debug
|
|
538
|
+
debug("resolved configs %O", configs);
|
|
539
539
|
return {
|
|
540
540
|
configs,
|
|
541
541
|
files
|
|
@@ -577,16 +577,16 @@ async function resolveWorkspace(config, options) {
|
|
|
577
577
|
}
|
|
578
578
|
const files = [];
|
|
579
579
|
const configs = (await Promise.all(packages.map(async (cwd) => {
|
|
580
|
-
debug
|
|
580
|
+
debug("loading workspace config %s", cwd);
|
|
581
581
|
const { configs: configs$1, file } = await loadConfigFile({
|
|
582
582
|
...options,
|
|
583
583
|
config: workspaceConfig,
|
|
584
584
|
cwd
|
|
585
585
|
}, cwd);
|
|
586
586
|
if (file) {
|
|
587
|
-
debug
|
|
587
|
+
debug("loaded workspace config file %s", file);
|
|
588
588
|
files.push(file);
|
|
589
|
-
} else debug
|
|
589
|
+
} else debug("no workspace config file found in %s", cwd);
|
|
590
590
|
return configs$1.map((config$1) => ({
|
|
591
591
|
...normalized,
|
|
592
592
|
cwd,
|
|
@@ -599,7 +599,7 @@ async function resolveWorkspace(config, options) {
|
|
|
599
599
|
};
|
|
600
600
|
}
|
|
601
601
|
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, 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;
|
|
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;
|
|
603
603
|
outDir = path.resolve(cwd, outDir);
|
|
604
604
|
clean = resolveClean(clean, outDir, cwd);
|
|
605
605
|
const pkg = await readPackageJson(cwd);
|
|
@@ -636,6 +636,7 @@ async function resolveConfig(userConfig) {
|
|
|
636
636
|
report: report === true ? {} : report,
|
|
637
637
|
unused,
|
|
638
638
|
watch,
|
|
639
|
+
ignoreWatch,
|
|
639
640
|
shims,
|
|
640
641
|
skipNodeModulesBundle,
|
|
641
642
|
publint: publint$1,
|
|
@@ -766,19 +767,11 @@ async function getBuildOptions(config, format, cjsDts, isMultiFormat) {
|
|
|
766
767
|
const { Unused } = await import("unplugin-unused");
|
|
767
768
|
plugins.push(Unused.rolldown(unused === true ? {} : unused));
|
|
768
769
|
}
|
|
769
|
-
if (target) plugins.push(
|
|
770
|
-
include: /\.[cm]?[jt]sx?$/,
|
|
771
|
-
exclude: /\.d\.[cm]?ts$/,
|
|
772
|
-
transformOptions: { target }
|
|
773
|
-
}), RuntimeHelperCheckPlugin(target));
|
|
770
|
+
if (target) plugins.push(RuntimeHelperCheckPlugin(target));
|
|
774
771
|
plugins.push(ShebangPlugin(cwd, name, isMultiFormat));
|
|
775
772
|
}
|
|
776
773
|
if (report && !logger.silent) plugins.push(ReportPlugin(report, cwd, cjsDts, name, isMultiFormat));
|
|
777
|
-
if (target) plugins.push(
|
|
778
|
-
// Use Lightning CSS to handle CSS input. This is a temporary solution
|
|
779
|
-
// until Rolldown supports CSS syntax lowering natively.
|
|
780
|
-
await LightningCSSPlugin({ target })
|
|
781
|
-
);
|
|
774
|
+
if (target) plugins.push(await LightningCSSPlugin({ target }));
|
|
782
775
|
plugins.push(userPlugins);
|
|
783
776
|
const inputOptions = await mergeUserOptions({
|
|
784
777
|
input: entry,
|
|
@@ -809,6 +802,7 @@ async function getBuildOptions(config, format, cjsDts, isMultiFormat) {
|
|
|
809
802
|
name: config.globalName,
|
|
810
803
|
sourcemap,
|
|
811
804
|
dir: outDir,
|
|
805
|
+
target,
|
|
812
806
|
minify,
|
|
813
807
|
entryFileNames,
|
|
814
808
|
chunkFileNames
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { logger } from "./logger-BdIBA2vO.js";
|
|
2
|
-
import { version } from "./package-
|
|
2
|
+
import { version } from "./package-DQpXq2zc.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,7 +1,7 @@
|
|
|
1
1
|
import { logger, noop, prettyFormat, prettyName, toArray } from "./logger-BdIBA2vO.js";
|
|
2
2
|
import path, { dirname, normalize, sep } from "node:path";
|
|
3
3
|
import { bold, dim, green, underline } from "ansis";
|
|
4
|
-
import
|
|
4
|
+
import Debug from "debug";
|
|
5
5
|
import { access, chmod, cp, rm, stat } from "node:fs/promises";
|
|
6
6
|
import { Buffer } from "node:buffer";
|
|
7
7
|
import { promisify } from "node:util";
|
|
@@ -47,7 +47,7 @@ function lowestCommonAncestor(...filepaths) {
|
|
|
47
47
|
|
|
48
48
|
//#endregion
|
|
49
49
|
//#region src/features/external.ts
|
|
50
|
-
const debug$
|
|
50
|
+
const debug$1 = Debug("tsdown:external");
|
|
51
51
|
function ExternalPlugin(options) {
|
|
52
52
|
const deps = options.pkg && Array.from(getProductionDeps(options.pkg));
|
|
53
53
|
return {
|
|
@@ -70,7 +70,7 @@ function ExternalPlugin(options) {
|
|
|
70
70
|
}
|
|
71
71
|
if (deps) shouldExternal ||= deps.some((dep) => id === dep || id.startsWith(`${dep}/`));
|
|
72
72
|
if (shouldExternal) {
|
|
73
|
-
debug$
|
|
73
|
+
debug$1("External dependency:", id);
|
|
74
74
|
return {
|
|
75
75
|
id,
|
|
76
76
|
external: shouldExternal
|
|
@@ -119,7 +119,7 @@ function formatBytes(bytes) {
|
|
|
119
119
|
|
|
120
120
|
//#endregion
|
|
121
121
|
//#region src/features/report.ts
|
|
122
|
-
const debug
|
|
122
|
+
const debug = Debug("tsdown:report");
|
|
123
123
|
const brotliCompressAsync = promisify(brotliCompress);
|
|
124
124
|
const gzipAsync = promisify(gzip);
|
|
125
125
|
const RE_DTS = /\.d\.[cm]?ts$/;
|
|
@@ -161,19 +161,19 @@ function ReportPlugin(options, cwd, cjsDts, name, isMultiFormat) {
|
|
|
161
161
|
};
|
|
162
162
|
}
|
|
163
163
|
async function calcSize(options, chunk) {
|
|
164
|
-
debug
|
|
164
|
+
debug(`Calculating size for`, chunk.fileName);
|
|
165
165
|
const content = chunk.type === "chunk" ? chunk.code : chunk.source;
|
|
166
166
|
const raw = Buffer.byteLength(content, "utf8");
|
|
167
|
-
debug
|
|
167
|
+
debug("[size]", chunk.fileName, raw);
|
|
168
168
|
let gzip$1 = Infinity;
|
|
169
169
|
let brotli = Infinity;
|
|
170
|
-
if (raw > (options.maxCompressSize ?? 1e6)) debug
|
|
170
|
+
if (raw > (options.maxCompressSize ?? 1e6)) debug(chunk.fileName, "file size exceeds limit, skip gzip/brotli");
|
|
171
171
|
else {
|
|
172
172
|
gzip$1 = (await gzipAsync(content)).length;
|
|
173
|
-
debug
|
|
173
|
+
debug("[gzip]", chunk.fileName, gzip$1);
|
|
174
174
|
if (options.brotli) {
|
|
175
175
|
brotli = (await brotliCompressAsync(content)).length;
|
|
176
|
-
debug
|
|
176
|
+
debug("[brotli]", chunk.fileName, brotli);
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
179
|
return {
|
package/dist/plugins.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReportPlugin$1 as ReportPlugin, ResolvedOptions } from "./
|
|
1
|
+
import { ReportPlugin$1 as ReportPlugin, ResolvedOptions } from "./types-CsOn0For.js";
|
|
2
2
|
import { Plugin } from "rolldown";
|
|
3
3
|
import { PackageJson } from "pkg-types";
|
|
4
4
|
|
|
@@ -7,6 +7,9 @@ declare function ExternalPlugin(options: ResolvedOptions): Plugin;
|
|
|
7
7
|
|
|
8
8
|
//#endregion
|
|
9
9
|
//#region src/features/shebang.d.ts
|
|
10
|
+
/*
|
|
11
|
+
* Production deps should be excluded from the bundle
|
|
12
|
+
*/
|
|
10
13
|
declare function ShebangPlugin(cwd: string, name?: string, isMultiFormat?: boolean): Plugin;
|
|
11
14
|
|
|
12
15
|
//#endregion
|
package/dist/plugins.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ExternalPlugin, NodeProtocolPlugin, ReportPlugin, ShebangPlugin } from "./plugins-
|
|
1
|
+
import { ExternalPlugin, NodeProtocolPlugin, ReportPlugin, ShebangPlugin } from "./plugins-G7Z0rtO5.js";
|
|
2
2
|
import "./logger-BdIBA2vO.js";
|
|
3
3
|
|
|
4
4
|
export { ExternalPlugin, NodeProtocolPlugin, ReportPlugin, ShebangPlugin };
|
package/dist/run.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { logger, resolveComma, toArray } from "./logger-BdIBA2vO.js";
|
|
3
|
-
import { version } from "./package-
|
|
3
|
+
import { version } from "./package-DQpXq2zc.js";
|
|
4
4
|
import module from "node:module";
|
|
5
5
|
import process from "node:process";
|
|
6
6
|
import { dim } from "ansis";
|
|
7
7
|
import { VERSION } from "rolldown";
|
|
8
|
-
import
|
|
8
|
+
import Debug from "debug";
|
|
9
9
|
import { cac } from "cac";
|
|
10
10
|
|
|
11
11
|
//#region src/cli.ts
|
|
@@ -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("--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) => {
|
|
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("-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-DFC9EXfl.js");
|
|
26
26
|
await migrate(args);
|
|
27
27
|
});
|
|
28
28
|
async function runCLI() {
|
|
@@ -31,10 +31,10 @@ async function runCLI() {
|
|
|
31
31
|
let namespace;
|
|
32
32
|
if (cli.options.debug === true) namespace = "tsdown:*";
|
|
33
33
|
else namespace = resolveComma(toArray(cli.options.debug)).map((v) => `tsdown:${v}`).join(",");
|
|
34
|
-
const enabled =
|
|
34
|
+
const enabled = Debug.disable();
|
|
35
35
|
if (enabled) namespace += `,${enabled}`;
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
Debug.enable(namespace);
|
|
37
|
+
Debug("tsdown:debug")("Debugging enabled", namespace);
|
|
38
38
|
}
|
|
39
39
|
try {
|
|
40
40
|
await cli.runMatchedCommand();
|
|
@@ -89,7 +89,7 @@ interface ReportOptions {
|
|
|
89
89
|
declare function ReportPlugin(options: ReportOptions, cwd: string, cjsDts?: boolean, name?: string, isMultiFormat?: boolean): Plugin;
|
|
90
90
|
|
|
91
91
|
//#endregion
|
|
92
|
-
//#region src/options/
|
|
92
|
+
//#region src/options/types.d.ts
|
|
93
93
|
type Sourcemap = boolean | "inline" | "hidden";
|
|
94
94
|
type Format = Exclude<ModuleFormat, "experimental-app">;
|
|
95
95
|
type NormalizedFormat = Exclude<InternalModuleFormat, "app">;
|
|
@@ -115,6 +115,7 @@ interface Workspace {
|
|
|
115
115
|
* Options for tsdown.
|
|
116
116
|
*/
|
|
117
117
|
interface Options$3 {
|
|
118
|
+
/// build options
|
|
118
119
|
entry?: InputOption;
|
|
119
120
|
external?: ExternalOption;
|
|
120
121
|
noExternal?: Arrayable<string | RegExp> | ((id: string, importer: string | undefined) => boolean | null | undefined | void);
|
|
@@ -123,6 +124,7 @@ interface Options$3 {
|
|
|
123
124
|
/** @default 'node' */
|
|
124
125
|
platform?: "node" | "neutral" | "browser";
|
|
125
126
|
inputOptions?: InputOptions | ((options: InputOptions, format: NormalizedFormat) => Awaitable<InputOptions | void | null>);
|
|
127
|
+
/// output options
|
|
126
128
|
/** @default ['es'] */
|
|
127
129
|
format?: Format | Format[];
|
|
128
130
|
globalName?: string;
|
|
@@ -204,6 +206,7 @@ interface Options$3 {
|
|
|
204
206
|
config?: boolean | string;
|
|
205
207
|
/** @default false */
|
|
206
208
|
watch?: boolean | string | string[];
|
|
209
|
+
ignoreWatch?: string | string[];
|
|
207
210
|
/**
|
|
208
211
|
* You can specify command to be executed after a successful build, specially useful for Watch mode
|
|
209
212
|
*/
|
|
@@ -218,6 +221,7 @@ interface Options$3 {
|
|
|
218
221
|
* @default false
|
|
219
222
|
*/
|
|
220
223
|
fromVite?: boolean | "vitest";
|
|
224
|
+
/// addons
|
|
221
225
|
/**
|
|
222
226
|
* Emit TypeScript declaration files (.d.ts).
|
|
223
227
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tsdown",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.12",
|
|
4
4
|
"description": "The Elegant Bundler for Libraries",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -69,8 +69,8 @@
|
|
|
69
69
|
"diff": "^8.0.1",
|
|
70
70
|
"empathic": "^1.1.0",
|
|
71
71
|
"hookable": "^5.5.3",
|
|
72
|
-
"rolldown": "1.0.0-beta.
|
|
73
|
-
"rolldown-plugin-dts": "^0.13.
|
|
72
|
+
"rolldown": "1.0.0-beta.9",
|
|
73
|
+
"rolldown-plugin-dts": "^0.13.2",
|
|
74
74
|
"semver": "^7.7.2",
|
|
75
75
|
"tinyexec": "^1.0.1",
|
|
76
76
|
"tinyglobby": "^0.2.13",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"@sxzz/prettier-config": "^2.2.1",
|
|
83
83
|
"@sxzz/test-utils": "^0.5.6",
|
|
84
84
|
"@types/debug": "^4.1.12",
|
|
85
|
-
"@types/node": "^22.15.
|
|
85
|
+
"@types/node": "^22.15.19",
|
|
86
86
|
"@types/semver": "^7.7.0",
|
|
87
87
|
"@unocss/eslint-plugin": "^66.1.2",
|
|
88
88
|
"bumpp": "^10.1.1",
|
|
@@ -101,7 +101,7 @@
|
|
|
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.
|
|
104
|
+
"vitepress-plugin-llms": "^1.2.0",
|
|
105
105
|
"vitest": "^3.1.3",
|
|
106
106
|
"vue": "^3.5.14"
|
|
107
107
|
},
|
|
@@ -121,6 +121,6 @@
|
|
|
121
121
|
"docs:dev": "vitepress dev docs",
|
|
122
122
|
"docs:build": "vitepress build docs",
|
|
123
123
|
"docs:preview": "vitepress preview docs",
|
|
124
|
-
"docs:generate": "./docs/.vitepress/scripts/docs-generate.
|
|
124
|
+
"docs:generate": "node --import @oxc-node/core/register ./docs/.vitepress/scripts/docs-generate.ts"
|
|
125
125
|
}
|
|
126
126
|
}
|