tsdown 0.15.11 → 0.15.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-CqBC_jjD.d.mts → config-Bl5kiN1A.d.mts} +1 -1
- package/dist/config.d.mts +2 -2
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +2 -2
- package/dist/{migrate-De95qtTc.mjs → migrate-GNvnRFv2.mjs} +1 -1
- package/dist/{package-BzY0XlO4.mjs → package-qYegZAPv.mjs} +1 -1
- package/dist/plugins.d.mts +1 -1
- package/dist/plugins.mjs +2 -2
- package/dist/run.mjs +6 -6
- package/dist/{src-D6aJlyPX.mjs → src-Cy1Bj4rU.mjs} +37 -37
- package/dist/{types-BquFAfMw.d.mts → types-XjcKkhrO.d.mts} +5 -3
- package/package.json +11 -7
package/dist/config.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as defineConfig } from "./config-
|
|
1
|
+
import { f as UserConfig, p as UserConfigFn } from "./types-XjcKkhrO.mjs";
|
|
2
|
+
import { t as defineConfig } from "./config-Bl5kiN1A.mjs";
|
|
3
3
|
export { UserConfig, UserConfigFn, defineConfig };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
import { t as defineConfig } from "./config-
|
|
1
|
+
import { A as TsdownChunks, C as OutExtensionFactory, D as RolldownContext, E as BuildContext, M as CopyOptions, N as CopyOptionsFn, O as TsdownHooks, P as AttwOptions, S as OutExtensionContext, T as PackageType, _ as Logger, a as NormalizedUserConfig, b as ChunkAddonFunction, c as ResolvedOptions, d as UnusedOptions, f as UserConfig, h as ReportOptions, i as NormalizedFormat, j as CopyEntry, k as ExportsOptions, l as Sourcemap, m as Workspace, n as Format, o as Options, p as UserConfigFn, r as NoExternalFn, s as PublintOptions, t as DtsOptions, u as TreeshakingOptions, v as globalLogger, w as OutExtensionObject, x as ChunkAddonObject, y as ChunkAddon } from "./types-XjcKkhrO.mjs";
|
|
2
|
+
import { t as defineConfig } from "./config-Bl5kiN1A.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/index.d.ts
|
|
5
5
|
|
|
@@ -19,4 +19,4 @@ declare const shimFile: string;
|
|
|
19
19
|
*/
|
|
20
20
|
declare function buildSingle(config: ResolvedOptions, clean: () => Promise<void>): Promise<(() => Promise<void>) | undefined>;
|
|
21
21
|
//#endregion
|
|
22
|
-
export { AttwOptions, BuildContext, ChunkAddon, ChunkAddonFunction, ChunkAddonObject, CopyEntry, CopyOptions, CopyOptionsFn, DtsOptions, ExportsOptions, Format, type Logger, NoExternalFn, NormalizedFormat, NormalizedUserConfig, type Options, OutExtensionContext, OutExtensionFactory, OutExtensionObject, PackageType, PublintOptions, ReportOptions, type ResolvedOptions, RolldownContext, Sourcemap, TsdownChunks, TsdownHooks, UnusedOptions, type UserConfig, type UserConfigFn, Workspace, build, buildSingle, defineConfig, globalLogger, shimFile };
|
|
22
|
+
export { AttwOptions, BuildContext, ChunkAddon, ChunkAddonFunction, ChunkAddonObject, CopyEntry, CopyOptions, CopyOptionsFn, DtsOptions, ExportsOptions, Format, type Logger, NoExternalFn, NormalizedFormat, NormalizedUserConfig, type Options, OutExtensionContext, OutExtensionFactory, OutExtensionObject, PackageType, PublintOptions, ReportOptions, type ResolvedOptions, RolldownContext, Sourcemap, TreeshakingOptions, TsdownChunks, TsdownHooks, UnusedOptions, type UserConfig, type UserConfigFn, Workspace, build, buildSingle, defineConfig, globalLogger, shimFile };
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as defineConfig } from "./config-BPLXnzPK.mjs";
|
|
2
|
-
import { n as buildSingle, r as shimFile, t as build } from "./src-
|
|
3
|
-
import { a as globalLogger } from "./package-
|
|
2
|
+
import { n as buildSingle, r as shimFile, t as build } from "./src-Cy1Bj4rU.mjs";
|
|
3
|
+
import { a as globalLogger } from "./package-qYegZAPv.mjs";
|
|
4
4
|
|
|
5
5
|
export { build, buildSingle, defineConfig, globalLogger, shimFile };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as globalLogger, t as version } from "./package-
|
|
1
|
+
import { a as globalLogger, t as version } from "./package-qYegZAPv.mjs";
|
|
2
2
|
import process from "node:process";
|
|
3
3
|
import { bold, green, underline } from "ansis";
|
|
4
4
|
import { readFile, unlink, writeFile } from "node:fs/promises";
|
|
@@ -146,7 +146,7 @@ function hue2rgb(p, q, t) {
|
|
|
146
146
|
|
|
147
147
|
//#endregion
|
|
148
148
|
//#region package.json
|
|
149
|
-
var version = "0.15.
|
|
149
|
+
var version = "0.15.12";
|
|
150
150
|
|
|
151
151
|
//#endregion
|
|
152
152
|
export { globalLogger as a, debounce as c, resolveComma as d, resolveRegex as f, generateColor as i, matchPattern as l, toArray as m, LogLevels as n, prettyFormat as o, slash as p, createLogger as r, prettyName as s, version as t, noop as u };
|
package/dist/plugins.d.mts
CHANGED
package/dist/plugins.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "./config-BPLXnzPK.mjs";
|
|
2
|
-
import { a as ReportPlugin, i as ShebangPlugin, o as NodeProtocolPlugin, s as ExternalPlugin } from "./src-
|
|
3
|
-
import "./package-
|
|
2
|
+
import { a as ReportPlugin, i as ShebangPlugin, o as NodeProtocolPlugin, s as ExternalPlugin } from "./src-Cy1Bj4rU.mjs";
|
|
3
|
+
import "./package-qYegZAPv.mjs";
|
|
4
4
|
|
|
5
5
|
export { ExternalPlugin, NodeProtocolPlugin, ReportPlugin, ShebangPlugin };
|
package/dist/run.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __cjs_createRequire } from "node:module";
|
|
3
3
|
const __cjs_require = __cjs_createRequire(import.meta.url);
|
|
4
|
-
import { a as globalLogger, d as resolveComma, m as toArray, t as version } from "./package-
|
|
4
|
+
import { a as globalLogger, d as resolveComma, m as toArray, t as version } from "./package-qYegZAPv.mjs";
|
|
5
5
|
import module from "node:module";
|
|
6
6
|
import process from "node:process";
|
|
7
7
|
import { dim } from "ansis";
|
|
8
8
|
import { VERSION } from "rolldown";
|
|
9
|
-
const
|
|
9
|
+
const Debug = __cjs_require("debug");
|
|
10
10
|
import { cac } from "cac";
|
|
11
11
|
|
|
12
12
|
//#region src/cli.ts
|
|
@@ -23,7 +23,7 @@ cli.command("[...files]", "Bundle files", {
|
|
|
23
23
|
await build$1(flags);
|
|
24
24
|
});
|
|
25
25
|
cli.command("migrate", "Migrate from tsup to tsdown").option("-c, --cwd <dir>", "Working directory").option("-d, --dry-run", "Dry run").action(async (args) => {
|
|
26
|
-
const { migrate } = await import("./migrate-
|
|
26
|
+
const { migrate } = await import("./migrate-GNvnRFv2.mjs");
|
|
27
27
|
await migrate(args);
|
|
28
28
|
});
|
|
29
29
|
async function runCLI() {
|
|
@@ -32,10 +32,10 @@ async function runCLI() {
|
|
|
32
32
|
let namespace;
|
|
33
33
|
if (cli.options.debug === true) namespace = "tsdown:*";
|
|
34
34
|
else namespace = resolveComma(toArray(cli.options.debug)).map((v) => `tsdown:${v}`).join(",");
|
|
35
|
-
const enabled =
|
|
35
|
+
const enabled = Debug.disable();
|
|
36
36
|
if (enabled) namespace += `,${enabled}`;
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
Debug.enable(namespace);
|
|
38
|
+
Debug("tsdown:debug")("Debugging enabled", namespace);
|
|
39
39
|
}
|
|
40
40
|
try {
|
|
41
41
|
await cli.runMatchedCommand();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __cjs_createRequire } from "node:module";
|
|
2
2
|
const __cjs_require = __cjs_createRequire(import.meta.url);
|
|
3
|
-
import { a as globalLogger, c as debounce, d as resolveComma, f as resolveRegex, i as generateColor, l as matchPattern, m as toArray, n as LogLevels, o as prettyFormat, p as slash, r as createLogger, s as prettyName, t as version, u as noop } from "./package-
|
|
3
|
+
import { a as globalLogger, c as debounce, d as resolveComma, f as resolveRegex, i as generateColor, l as matchPattern, m as toArray, n as LogLevels, o as prettyFormat, p as slash, r as createLogger, s as prettyName, t as version, u as noop } from "./package-qYegZAPv.mjs";
|
|
4
4
|
import { builtinModules, isBuiltin } from "node:module";
|
|
5
5
|
import path, { dirname, join, normalize, sep } from "node:path";
|
|
6
6
|
import process from "node:process";
|
|
@@ -13,7 +13,7 @@ import child_process from "node:child_process";
|
|
|
13
13
|
import { access, chmod, cp, mkdtemp, readFile, rm, stat, writeFile } from "node:fs/promises";
|
|
14
14
|
import { tmpdir } from "node:os";
|
|
15
15
|
import util, { promisify } from "node:util";
|
|
16
|
-
const
|
|
16
|
+
const Debug = __cjs_require("debug");
|
|
17
17
|
const coerce = __cjs_require("semver/functions/coerce.js");
|
|
18
18
|
const satisfies = __cjs_require("semver/functions/satisfies.js");
|
|
19
19
|
import { glob } from "tinyglobby";
|
|
@@ -24,7 +24,6 @@ const minVersion = __cjs_require("semver/ranges/min-version.js");
|
|
|
24
24
|
import { up } from "empathic/find";
|
|
25
25
|
import { up as up$1 } from "empathic/package";
|
|
26
26
|
import { loadConfig } from "unconfig";
|
|
27
|
-
import { unrun } from "unrun";
|
|
28
27
|
import { Buffer } from "node:buffer";
|
|
29
28
|
import { brotliCompress, gzip } from "node:zlib";
|
|
30
29
|
import readline from "node:readline";
|
|
@@ -70,7 +69,7 @@ function lowestCommonAncestor(...filepaths) {
|
|
|
70
69
|
|
|
71
70
|
//#endregion
|
|
72
71
|
//#region src/features/attw.ts
|
|
73
|
-
const debug$
|
|
72
|
+
const debug$7 = Debug("tsdown:attw");
|
|
74
73
|
const exec$1 = promisify(child_process.exec);
|
|
75
74
|
/**
|
|
76
75
|
* ATTW profiles.
|
|
@@ -116,7 +115,7 @@ async function attw(options) {
|
|
|
116
115
|
}
|
|
117
116
|
const { profile = "strict", level = "warn",...attwOptions } = options.attw === true ? {} : options.attw;
|
|
118
117
|
const t = performance.now();
|
|
119
|
-
debug$
|
|
118
|
+
debug$7("Running attw check");
|
|
120
119
|
const tempDir = await mkdtemp(path.join(tmpdir(), "tsdown-attw-"));
|
|
121
120
|
let attwCore;
|
|
122
121
|
try {
|
|
@@ -148,7 +147,7 @@ async function attw(options) {
|
|
|
148
147
|
} else options.logger.success(`No Are the types wrong problems found`, dim`(${Math.round(performance.now() - t)}ms)`);
|
|
149
148
|
} catch (error) {
|
|
150
149
|
options.logger.error("ATTW check failed:", error);
|
|
151
|
-
debug$
|
|
150
|
+
debug$7("Found errors, setting exit code to 1");
|
|
152
151
|
process.exitCode = 1;
|
|
153
152
|
} finally {
|
|
154
153
|
await fsRemove(tempDir);
|
|
@@ -172,7 +171,7 @@ function warnLegacyCJS(config) {
|
|
|
172
171
|
|
|
173
172
|
//#endregion
|
|
174
173
|
//#region src/features/clean.ts
|
|
175
|
-
const debug$
|
|
174
|
+
const debug$6 = Debug("tsdown:clean");
|
|
176
175
|
const RE_LAST_SLASH = /[/\\]$/;
|
|
177
176
|
async function cleanOutDir(configs) {
|
|
178
177
|
const removes = /* @__PURE__ */ new Set();
|
|
@@ -189,10 +188,10 @@ async function cleanOutDir(configs) {
|
|
|
189
188
|
if (!removes.size) return;
|
|
190
189
|
globalLogger.info(`Cleaning ${removes.size} files`);
|
|
191
190
|
await Promise.all([...removes].map(async (file) => {
|
|
192
|
-
debug$
|
|
191
|
+
debug$6("Removing", file);
|
|
193
192
|
await fsRemove(file);
|
|
194
193
|
}));
|
|
195
|
-
debug$
|
|
194
|
+
debug$6("Removed %d files", removes.size);
|
|
196
195
|
}
|
|
197
196
|
function resolveClean(clean, outDir, cwd) {
|
|
198
197
|
if (clean === true) clean = [slash(outDir)];
|
|
@@ -352,7 +351,7 @@ async function createHooks$1(options) {
|
|
|
352
351
|
|
|
353
352
|
//#endregion
|
|
354
353
|
//#region src/features/publint.ts
|
|
355
|
-
const debug$
|
|
354
|
+
const debug$5 = Debug("tsdown:publint");
|
|
356
355
|
async function publint(options) {
|
|
357
356
|
if (!options.publint) return;
|
|
358
357
|
if (!options.pkg) {
|
|
@@ -360,14 +359,14 @@ async function publint(options) {
|
|
|
360
359
|
return;
|
|
361
360
|
}
|
|
362
361
|
const t = performance.now();
|
|
363
|
-
debug$
|
|
362
|
+
debug$5("Running publint");
|
|
364
363
|
const { publint: publint$1 } = await import("publint");
|
|
365
364
|
const { formatMessage } = await import("publint/utils");
|
|
366
365
|
const { messages } = await publint$1({
|
|
367
366
|
...options.publint === true ? {} : options.publint,
|
|
368
367
|
pkgDir: path.dirname(options.pkg.packageJsonPath)
|
|
369
368
|
});
|
|
370
|
-
debug$
|
|
369
|
+
debug$5("Found %d issues", messages.length);
|
|
371
370
|
if (!messages.length) options.logger.success(prettyName(options.name), `No publint issues found`, dim`(${Math.round(performance.now() - t)}ms)`);
|
|
372
371
|
let hasError = false;
|
|
373
372
|
for (const message of messages) {
|
|
@@ -381,7 +380,7 @@ async function publint(options) {
|
|
|
381
380
|
options.logger[logType](prettyName(options.name), formattedMessage);
|
|
382
381
|
}
|
|
383
382
|
if (hasError) {
|
|
384
|
-
debug$
|
|
383
|
+
debug$5("Found errors, setting exit code to 1");
|
|
385
384
|
process.exitCode = 1;
|
|
386
385
|
}
|
|
387
386
|
}
|
|
@@ -468,11 +467,11 @@ async function resolveTsconfig(logger, tsconfig, cwd, name) {
|
|
|
468
467
|
|
|
469
468
|
//#endregion
|
|
470
469
|
//#region src/utils/package.ts
|
|
471
|
-
const debug$
|
|
470
|
+
const debug$4 = Debug("tsdown:package");
|
|
472
471
|
async function readPackageJson(dir) {
|
|
473
472
|
const packageJsonPath = up$1({ cwd: dir });
|
|
474
473
|
if (!packageJsonPath) return;
|
|
475
|
-
debug$
|
|
474
|
+
debug$4("Reading package.json:", packageJsonPath);
|
|
476
475
|
const contents = await readFile(packageJsonPath, "utf8");
|
|
477
476
|
return {
|
|
478
477
|
...JSON.parse(contents),
|
|
@@ -596,6 +595,7 @@ async function nativeImport(id) {
|
|
|
596
595
|
return mod.default || mod;
|
|
597
596
|
}
|
|
598
597
|
async function unrunImport(id) {
|
|
598
|
+
const { unrun } = await import("unrun");
|
|
599
599
|
const { module: module$1 } = await unrun({ path: pathToFileURL(id).href }).catch((error) => {
|
|
600
600
|
if (error?.message?.includes?.("Cannot find module")) {
|
|
601
601
|
const configError = /* @__PURE__ */ new Error(`Failed to load the config file. \`unrun\` is experimental; try setting the --config-loader CLI flag to \`unconfig\` instead.\n\n${error.message}`);
|
|
@@ -608,7 +608,7 @@ async function unrunImport(id) {
|
|
|
608
608
|
|
|
609
609
|
//#endregion
|
|
610
610
|
//#region src/options/index.ts
|
|
611
|
-
const debug$
|
|
611
|
+
const debug$3 = Debug("tsdown:options");
|
|
612
612
|
const DEFAULT_EXCLUDE_WORKSPACE = [
|
|
613
613
|
"**/node_modules/**",
|
|
614
614
|
"**/dist/**",
|
|
@@ -616,20 +616,20 @@ const DEFAULT_EXCLUDE_WORKSPACE = [
|
|
|
616
616
|
"**/t?(e)mp/**"
|
|
617
617
|
];
|
|
618
618
|
async function resolveOptions(options) {
|
|
619
|
-
debug$
|
|
619
|
+
debug$3("options %O", options);
|
|
620
620
|
const { configs: rootConfigs, file } = await loadConfigFile(options);
|
|
621
621
|
const files = [];
|
|
622
622
|
if (file) {
|
|
623
623
|
files.push(file);
|
|
624
|
-
debug$
|
|
625
|
-
debug$
|
|
626
|
-
} else debug$
|
|
624
|
+
debug$3("loaded root config file %s", file);
|
|
625
|
+
debug$3("root configs %O", rootConfigs);
|
|
626
|
+
} else debug$3("no root config file found");
|
|
627
627
|
const configs = (await Promise.all(rootConfigs.map(async (rootConfig) => {
|
|
628
628
|
const { configs: workspaceConfigs, files: workspaceFiles } = await resolveWorkspace(rootConfig, options);
|
|
629
629
|
if (workspaceFiles) files.push(...workspaceFiles);
|
|
630
630
|
return Promise.all(workspaceConfigs.filter((config) => !config.workspace || config.entry).map((config) => resolveConfig(config)));
|
|
631
631
|
}))).flat();
|
|
632
|
-
debug$
|
|
632
|
+
debug$3("resolved configs %O", configs);
|
|
633
633
|
return {
|
|
634
634
|
configs,
|
|
635
635
|
files
|
|
@@ -672,16 +672,16 @@ async function resolveWorkspace(config, options) {
|
|
|
672
672
|
const files = [];
|
|
673
673
|
return {
|
|
674
674
|
configs: (await Promise.all(packages.map(async (cwd) => {
|
|
675
|
-
debug$
|
|
675
|
+
debug$3("loading workspace config %s", cwd);
|
|
676
676
|
const { configs, file } = await loadConfigFile({
|
|
677
677
|
...options,
|
|
678
678
|
config: workspaceConfig,
|
|
679
679
|
cwd
|
|
680
680
|
}, cwd);
|
|
681
681
|
if (file) {
|
|
682
|
-
debug$
|
|
682
|
+
debug$3("loaded workspace config file %s", file);
|
|
683
683
|
files.push(file);
|
|
684
|
-
} else debug$
|
|
684
|
+
} else debug$3("no workspace config file found in %s", cwd);
|
|
685
685
|
return configs.map((config$1) => ({
|
|
686
686
|
...normalized,
|
|
687
687
|
cwd,
|
|
@@ -786,7 +786,7 @@ async function mergeUserOptions(defaults, user, args) {
|
|
|
786
786
|
|
|
787
787
|
//#endregion
|
|
788
788
|
//#region src/features/external.ts
|
|
789
|
-
const debug$
|
|
789
|
+
const debug$2 = Debug("tsdown:external");
|
|
790
790
|
function ExternalPlugin({ pkg, noExternal, inlineOnly, skipNodeModulesBundle }) {
|
|
791
791
|
const deps = pkg && Array.from(getProductionDeps(pkg));
|
|
792
792
|
return {
|
|
@@ -795,7 +795,7 @@ function ExternalPlugin({ pkg, noExternal, inlineOnly, skipNodeModulesBundle })
|
|
|
795
795
|
if (extraOptions.isEntry || !importer) return;
|
|
796
796
|
const shouldExternal = await externalStrategy(this, id, importer, extraOptions);
|
|
797
797
|
const nodeBuiltinModule = isBuiltin(id);
|
|
798
|
-
debug$
|
|
798
|
+
debug$2("shouldExternal: %s = %s", id, shouldExternal);
|
|
799
799
|
if (shouldExternal === true || shouldExternal === "absolute") return {
|
|
800
800
|
id,
|
|
801
801
|
external: shouldExternal,
|
|
@@ -803,7 +803,7 @@ function ExternalPlugin({ pkg, noExternal, inlineOnly, skipNodeModulesBundle })
|
|
|
803
803
|
};
|
|
804
804
|
if (inlineOnly && !RE_DTS.test(importer) && !nodeBuiltinModule && id[0] !== "." && !path.isAbsolute(id)) {
|
|
805
805
|
const shouldInline = shouldExternal === "no-external" || matchPattern(id, inlineOnly);
|
|
806
|
-
debug$
|
|
806
|
+
debug$2("shouldInline: %s = %s", id, shouldInline);
|
|
807
807
|
if (shouldInline) return;
|
|
808
808
|
const resolved = await this.resolve(id, importer, extraOptions);
|
|
809
809
|
if (!resolved) return;
|
|
@@ -981,7 +981,7 @@ function formatBytes(bytes) {
|
|
|
981
981
|
|
|
982
982
|
//#endregion
|
|
983
983
|
//#region src/features/report.ts
|
|
984
|
-
const debug$
|
|
984
|
+
const debug$1 = Debug("tsdown:report");
|
|
985
985
|
const brotliCompressAsync = promisify(brotliCompress);
|
|
986
986
|
const gzipAsync = promisify(gzip);
|
|
987
987
|
const defaultOptions = {
|
|
@@ -1031,21 +1031,21 @@ function ReportPlugin(userOptions, logger, cwd, cjsDts, name, isMultiFormat) {
|
|
|
1031
1031
|
};
|
|
1032
1032
|
}
|
|
1033
1033
|
async function calcSize(options, chunk) {
|
|
1034
|
-
debug$
|
|
1034
|
+
debug$1(`Calculating size for`, chunk.fileName);
|
|
1035
1035
|
const content = chunk.type === "chunk" ? chunk.code : chunk.source;
|
|
1036
1036
|
const raw = Buffer.byteLength(content, "utf8");
|
|
1037
|
-
debug$
|
|
1037
|
+
debug$1("[size]", chunk.fileName, raw);
|
|
1038
1038
|
let gzip$1 = Infinity;
|
|
1039
1039
|
let brotli = Infinity;
|
|
1040
|
-
if (raw > options.maxCompressSize) debug$
|
|
1040
|
+
if (raw > options.maxCompressSize) debug$1(chunk.fileName, "file size exceeds limit, skip gzip/brotli");
|
|
1041
1041
|
else {
|
|
1042
1042
|
if (options.gzip) {
|
|
1043
1043
|
gzip$1 = (await gzipAsync(content)).length;
|
|
1044
|
-
debug$
|
|
1044
|
+
debug$1("[gzip]", chunk.fileName, gzip$1);
|
|
1045
1045
|
}
|
|
1046
1046
|
if (options.brotli) {
|
|
1047
1047
|
brotli = (await brotliCompressAsync(content)).length;
|
|
1048
|
-
debug$
|
|
1048
|
+
debug$1("[brotli]", chunk.fileName, brotli);
|
|
1049
1049
|
}
|
|
1050
1050
|
}
|
|
1051
1051
|
return {
|
|
@@ -1092,7 +1092,7 @@ function getShimsInject(format, platform) {
|
|
|
1092
1092
|
|
|
1093
1093
|
//#endregion
|
|
1094
1094
|
//#region src/features/rolldown.ts
|
|
1095
|
-
const debug
|
|
1095
|
+
const debug = Debug("tsdown:rolldown");
|
|
1096
1096
|
async function getBuildOptions(config, format, isMultiFormat, cjsDts = false) {
|
|
1097
1097
|
const inputOptions = await resolveInputOptions(config, format, cjsDts, isMultiFormat);
|
|
1098
1098
|
const outputOptions = await resolveOutputOptions(inputOptions, config, format, cjsDts);
|
|
@@ -1100,7 +1100,7 @@ async function getBuildOptions(config, format, isMultiFormat, cjsDts = false) {
|
|
|
1100
1100
|
...inputOptions,
|
|
1101
1101
|
output: outputOptions
|
|
1102
1102
|
};
|
|
1103
|
-
debug
|
|
1103
|
+
debug("rolldown config with format \"%s\" %O", cjsDts ? "cjs dts" : format, rolldownConfig);
|
|
1104
1104
|
return rolldownConfig;
|
|
1105
1105
|
}
|
|
1106
1106
|
async function resolveInputOptions(config, format, cjsDts, isMultiFormat) {
|
|
@@ -1185,7 +1185,7 @@ async function resolveOutputOptions(inputOptions, config, format, cjsDts) {
|
|
|
1185
1185
|
}, config.outputOptions, [format, { cjsDts }]);
|
|
1186
1186
|
}
|
|
1187
1187
|
async function getDebugRolldownDir() {
|
|
1188
|
-
if (!debug
|
|
1188
|
+
if (!debug.enabled) return;
|
|
1189
1189
|
return await mkdtemp(join(tmpdir(), "tsdown-config-"));
|
|
1190
1190
|
}
|
|
1191
1191
|
async function debugBuildOptions(dir, name, format, buildOptions) {
|
|
@@ -1204,7 +1204,7 @@ Package name: ${name || "not specified"}
|
|
|
1204
1204
|
*/
|
|
1205
1205
|
|
|
1206
1206
|
export default ${serialized}\n`);
|
|
1207
|
-
debug
|
|
1207
|
+
debug("Wrote debug rolldown config for \"%s\" (%s) -> %s", name || "default name", format, outFile);
|
|
1208
1208
|
}
|
|
1209
1209
|
function handlePluginInspect(plugins) {
|
|
1210
1210
|
if (Array.isArray(plugins)) for (const plugin of plugins) handlePluginInspect(plugin);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "ansis";
|
|
2
|
-
import { BuildOptions, ExternalOption, InputOption, InputOptions, InternalModuleFormat, MinifyOptions, ModuleFormat, ModuleTypes, OutputAsset, OutputChunk, OutputOptions, Plugin } from "rolldown";
|
|
2
|
+
import { BuildOptions, ExternalOption, InputOption, InputOptions, InternalModuleFormat, MinifyOptions, ModuleFormat, ModuleTypes, OutputAsset, OutputChunk, OutputOptions, Plugin, TreeshakingOptions } from "rolldown";
|
|
3
3
|
import { Hookable } from "hookable";
|
|
4
4
|
import { CheckPackageOptions } from "@arethetypeswrong/core";
|
|
5
5
|
import { Options as PublintOptions } from "publint";
|
|
@@ -263,9 +263,11 @@ interface Options {
|
|
|
263
263
|
/** @default false */
|
|
264
264
|
shims?: boolean;
|
|
265
265
|
/**
|
|
266
|
+
* Configure tree shaking options.
|
|
267
|
+
* @see {@link https://rolldown.rs/options/treeshake} for more details.
|
|
266
268
|
* @default true
|
|
267
269
|
*/
|
|
268
|
-
treeshake?: boolean;
|
|
270
|
+
treeshake?: boolean | TreeshakingOptions;
|
|
269
271
|
/**
|
|
270
272
|
* Sets how input files are processed.
|
|
271
273
|
* For example, use 'js' to treat files as JavaScript or 'base64' for images.
|
|
@@ -525,4 +527,4 @@ type ResolvedOptions = Omit<Overwrite<MarkPartial<Omit<Options, "publicDir" | "w
|
|
|
525
527
|
inlineOnly?: Array<string | RegExp>;
|
|
526
528
|
}>, "config" | "fromVite">;
|
|
527
529
|
//#endregion
|
|
528
|
-
export {
|
|
530
|
+
export { TsdownChunks as A, OutExtensionFactory as C, RolldownContext as D, BuildContext as E, CopyOptions as M, CopyOptionsFn as N, TsdownHooks as O, AttwOptions as P, OutExtensionContext as S, PackageType as T, Logger as _, NormalizedUserConfig as a, ChunkAddonFunction as b, ResolvedOptions as c, UnusedOptions as d, UserConfig as f, ReportPlugin as g, ReportOptions as h, NormalizedFormat as i, CopyEntry as j, ExportsOptions as k, Sourcemap as l, Workspace as m, Format as n, Options as o, UserConfigFn as p, NoExternalFn as r, PublintOptions as s, DtsOptions as t, TreeshakingOptions as u, globalLogger as v, OutExtensionObject as w, ChunkAddonObject as x, ChunkAddon as y };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tsdown",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.12",
|
|
4
4
|
"description": "The Elegant Bundler for Libraries",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -49,7 +49,8 @@
|
|
|
49
49
|
"publint": "^0.3.0",
|
|
50
50
|
"typescript": "^5.0.0",
|
|
51
51
|
"unplugin-lightningcss": "^0.4.0",
|
|
52
|
-
"unplugin-unused": "^0.5.0"
|
|
52
|
+
"unplugin-unused": "^0.5.0",
|
|
53
|
+
"unrun": "^0.2.1"
|
|
53
54
|
},
|
|
54
55
|
"peerDependenciesMeta": {
|
|
55
56
|
"@arethetypeswrong/core": {
|
|
@@ -66,6 +67,9 @@
|
|
|
66
67
|
},
|
|
67
68
|
"unplugin-unused": {
|
|
68
69
|
"optional": true
|
|
70
|
+
},
|
|
71
|
+
"unrun": {
|
|
72
|
+
"optional": true
|
|
69
73
|
}
|
|
70
74
|
},
|
|
71
75
|
"dependencies": {
|
|
@@ -77,13 +81,12 @@
|
|
|
77
81
|
"empathic": "^2.0.0",
|
|
78
82
|
"hookable": "^5.5.3",
|
|
79
83
|
"rolldown": "1.0.0-beta.45",
|
|
80
|
-
"rolldown-plugin-dts": "^0.17.
|
|
84
|
+
"rolldown-plugin-dts": "^0.17.2",
|
|
81
85
|
"semver": "^7.7.3",
|
|
82
86
|
"tinyexec": "^1.0.1",
|
|
83
87
|
"tinyglobby": "^0.2.15",
|
|
84
88
|
"tree-kill": "^1.2.2",
|
|
85
|
-
"unconfig": "^7.3.3"
|
|
86
|
-
"unrun": "^0.2.0"
|
|
89
|
+
"unconfig": "^7.3.3"
|
|
87
90
|
},
|
|
88
91
|
"devDependencies": {
|
|
89
92
|
"@arethetypeswrong/core": "^0.18.2",
|
|
@@ -91,7 +94,7 @@
|
|
|
91
94
|
"@sxzz/prettier-config": "^2.2.4",
|
|
92
95
|
"@sxzz/test-utils": "^0.5.12",
|
|
93
96
|
"@types/debug": "^4.1.12",
|
|
94
|
-
"@types/node": "^24.9.
|
|
97
|
+
"@types/node": "^24.9.2",
|
|
95
98
|
"@types/semver": "^7.7.1",
|
|
96
99
|
"@unocss/eslint-plugin": "^66.5.4",
|
|
97
100
|
"@vueuse/core": "^14.0.0",
|
|
@@ -106,8 +109,9 @@
|
|
|
106
109
|
"unocss": "^66.5.4",
|
|
107
110
|
"unplugin-lightningcss": "^0.4.3",
|
|
108
111
|
"unplugin-unused": "^0.5.4",
|
|
112
|
+
"unrun": "^0.2.1",
|
|
109
113
|
"vite": "npm:rolldown-vite@latest",
|
|
110
|
-
"vitest": "^4.0.
|
|
114
|
+
"vitest": "^4.0.4"
|
|
111
115
|
},
|
|
112
116
|
"engines": {
|
|
113
117
|
"node": ">=20.19.0"
|