tsdown 0.12.6 → 0.12.8
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-CzJapb1X.d.ts → config-D_2fTM9-.d.mts} +64 -31
- package/dist/config.d.mts +2 -0
- package/dist/config.mjs +3 -0
- package/dist/index.d.mts +2 -0
- package/dist/{index.js → index.mjs} +63 -10
- package/dist/{migrate-BcMqjqIs.js → migrate-D3HAtePC.mjs} +2 -2
- package/dist/package-DRxdhN87.mjs +5 -0
- package/dist/{plugins-BxGX3AUF.js → plugins-qNZNAFcS.mjs} +10 -10
- package/dist/{plugins.d.ts → plugins.d.mts} +1 -1
- package/dist/{plugins.js → plugins.mjs} +2 -2
- package/dist/{run.js → run.mjs} +4 -4
- package/package.json +23 -23
- package/dist/config.d.ts +0 -2
- package/dist/config.js +0 -3
- package/dist/index.d.ts +0 -2
- package/dist/package-BWIL_dgZ.js +0 -5
- /package/dist/{config-yiJy1jd0.js → config-CzjtjH-U.mjs} +0 -0
- /package/dist/{logger-BMB8Jggq.js → logger-CdK2zFTY.mjs} +0 -0
- /package/dist/{run.d.ts → run.d.mts} +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "ansis";
|
|
2
2
|
import { BuildOptions, ExternalOption, InputOption, InputOptions, InternalModuleFormat, MinifyOptions, ModuleFormat, OutputAsset, OutputChunk, OutputOptions, Plugin } from "rolldown";
|
|
3
|
-
import { Options } from "rolldown-plugin-dts";
|
|
4
3
|
import { Hookable } from "hookable";
|
|
5
4
|
import { CheckPackageOptions } from "@arethetypeswrong/core";
|
|
6
|
-
import { Options
|
|
5
|
+
import { Options } from "publint";
|
|
6
|
+
import { Options as Options$1 } from "rolldown-plugin-dts";
|
|
7
7
|
import { Options as Options$2 } from "unplugin-unused";
|
|
8
8
|
import { PackageJson } from "pkg-types";
|
|
9
9
|
|
|
@@ -13,6 +13,40 @@ type Awaitable<T> = T | Promise<T>;
|
|
|
13
13
|
type MarkPartial<T, K extends keyof T> = Omit<Required<T>, K> & Partial<Pick<T, K>>;
|
|
14
14
|
type Arrayable<T> = T | T[];
|
|
15
15
|
//#endregion
|
|
16
|
+
//#region src/features/attw.d.ts
|
|
17
|
+
interface AttwOptions extends CheckPackageOptions {
|
|
18
|
+
/**
|
|
19
|
+
* Profiles select a set of resolution modes to require/ignore. All are evaluated but failures outside
|
|
20
|
+
* of those required are ignored.
|
|
21
|
+
*
|
|
22
|
+
* The available profiles are:
|
|
23
|
+
* - `strict`: requires all resolutions
|
|
24
|
+
* - `node16`: ignores node10 resolution failures
|
|
25
|
+
* - `esmOnly`: ignores CJS resolution failures
|
|
26
|
+
*
|
|
27
|
+
* @default 'strict'
|
|
28
|
+
*/
|
|
29
|
+
profile?: "strict" | "node16" | "esmOnly";
|
|
30
|
+
/**
|
|
31
|
+
* The level of the check.
|
|
32
|
+
*
|
|
33
|
+
* The available levels are:
|
|
34
|
+
* - `error`: fails the build
|
|
35
|
+
* - `warn`: warns the build
|
|
36
|
+
*
|
|
37
|
+
* @default 'warn'
|
|
38
|
+
*/
|
|
39
|
+
level?: "error" | "warn";
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region src/features/copy.d.ts
|
|
43
|
+
interface CopyEntry {
|
|
44
|
+
from: string;
|
|
45
|
+
to: string;
|
|
46
|
+
}
|
|
47
|
+
type CopyOptions = Arrayable<string | CopyEntry>;
|
|
48
|
+
type CopyOptionsFn = (options: ResolvedOptions) => Awaitable<CopyOptions>;
|
|
49
|
+
//#endregion
|
|
16
50
|
//#region src/utils/logger.d.ts
|
|
17
51
|
declare class Logger {
|
|
18
52
|
silent: boolean;
|
|
@@ -72,13 +106,25 @@ type TsdownChunks = Partial<Record<NormalizedFormat, Array<OutputChunk | OutputA
|
|
|
72
106
|
*/
|
|
73
107
|
declare function buildSingle(config: ResolvedOptions, clean: () => Promise<void>): Promise<(() => Promise<void>) | undefined>;
|
|
74
108
|
//#endregion
|
|
75
|
-
//#region src/features/
|
|
76
|
-
interface
|
|
77
|
-
|
|
78
|
-
to
|
|
109
|
+
//#region src/features/exports.d.ts
|
|
110
|
+
interface ExportsOptions {
|
|
111
|
+
/**
|
|
112
|
+
* Generate exports that link to source code during development.
|
|
113
|
+
* - string: add as a custom condition.
|
|
114
|
+
* - true: all conditions point to source files, and add dist exports to `publishConfig`.
|
|
115
|
+
*/
|
|
116
|
+
devExports?: boolean | string;
|
|
117
|
+
/**
|
|
118
|
+
* Exports for all files.
|
|
119
|
+
*/
|
|
120
|
+
all?: boolean;
|
|
121
|
+
customExports?: (exports: Record<string, any>, context: {
|
|
122
|
+
pkg: PackageJson;
|
|
123
|
+
chunks: TsdownChunks;
|
|
124
|
+
outDir: string;
|
|
125
|
+
isPublish: boolean;
|
|
126
|
+
}) => Awaitable<Record<string, any>>;
|
|
79
127
|
}
|
|
80
|
-
type CopyOptions = Arrayable<string | CopyEntry>;
|
|
81
|
-
type CopyOptionsFn = (options: ResolvedOptions) => Awaitable<CopyOptions>;
|
|
82
128
|
//#endregion
|
|
83
129
|
//#region src/utils/package.d.ts
|
|
84
130
|
type PackageType = "module" | "commonjs" | undefined;
|
|
@@ -135,24 +181,6 @@ interface Workspace {
|
|
|
135
181
|
*/
|
|
136
182
|
config?: boolean | string;
|
|
137
183
|
}
|
|
138
|
-
interface ExportsOptions {
|
|
139
|
-
/**
|
|
140
|
-
* Generate exports that link to source code during development.
|
|
141
|
-
* - string: add as a custom condition.
|
|
142
|
-
* - true: all conditions point to source files, and add dist exports to `publishConfig`.
|
|
143
|
-
*/
|
|
144
|
-
devExports?: boolean | string;
|
|
145
|
-
/**
|
|
146
|
-
* Exports for all files.
|
|
147
|
-
*/
|
|
148
|
-
all?: boolean;
|
|
149
|
-
customExports?: (exports: Record<string, any>, context: {
|
|
150
|
-
pkg: PackageJson;
|
|
151
|
-
chunks: TsdownChunks;
|
|
152
|
-
outDir: string;
|
|
153
|
-
isPublish: boolean;
|
|
154
|
-
}) => Awaitable<Record<string, any>>;
|
|
155
|
-
}
|
|
156
184
|
/**
|
|
157
185
|
* Options for tsdown.
|
|
158
186
|
*/
|
|
@@ -225,6 +253,11 @@ interface Options$3 {
|
|
|
225
253
|
* @default false
|
|
226
254
|
*/
|
|
227
255
|
unbundle?: boolean;
|
|
256
|
+
/**
|
|
257
|
+
* @deprecated Use `unbundle` instead.
|
|
258
|
+
* @default true
|
|
259
|
+
*/
|
|
260
|
+
bundle?: boolean;
|
|
228
261
|
define?: Record<string, string>;
|
|
229
262
|
/** @default false */
|
|
230
263
|
shims?: boolean;
|
|
@@ -290,7 +323,7 @@ interface Options$3 {
|
|
|
290
323
|
* - If the `types` field is present in `package.json`, declaration file emission is enabled.
|
|
291
324
|
* - If the `types` field is absent, declaration file emission is disabled by default.
|
|
292
325
|
*/
|
|
293
|
-
dts?: boolean | Options;
|
|
326
|
+
dts?: boolean | Options$1;
|
|
294
327
|
/**
|
|
295
328
|
* Enable unused dependencies check with `unplugin-unused`
|
|
296
329
|
* Requires `unplugin-unused` to be installed.
|
|
@@ -302,7 +335,7 @@ interface Options$3 {
|
|
|
302
335
|
* Requires `publint` to be installed.
|
|
303
336
|
* @default false
|
|
304
337
|
*/
|
|
305
|
-
publint?: boolean | Options
|
|
338
|
+
publint?: boolean | Options;
|
|
306
339
|
/**
|
|
307
340
|
* Run `arethetypeswrong` after bundling.
|
|
308
341
|
* Requires `@arethetypeswrong/core` to be installed.
|
|
@@ -310,7 +343,7 @@ interface Options$3 {
|
|
|
310
343
|
* @default false
|
|
311
344
|
* @see https://github.com/arethetypeswrong/arethetypeswrong.github.io
|
|
312
345
|
*/
|
|
313
|
-
attw?: boolean |
|
|
346
|
+
attw?: boolean | AttwOptions;
|
|
314
347
|
/**
|
|
315
348
|
* Enable size reporting after bundling.
|
|
316
349
|
* @default true
|
|
@@ -386,11 +419,11 @@ interface Options$3 {
|
|
|
386
419
|
*/
|
|
387
420
|
type UserConfig = Arrayable<Omit<Options$3, "config" | "filter">>;
|
|
388
421
|
type UserConfigFn = (cliOptions: Options$3) => Awaitable<UserConfig>;
|
|
389
|
-
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" | "
|
|
422
|
+
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" | "bundle">, {
|
|
390
423
|
format: NormalizedFormat[];
|
|
391
424
|
target?: string[];
|
|
392
425
|
clean: string[];
|
|
393
|
-
dts: false | Options;
|
|
426
|
+
dts: false | Options$1;
|
|
394
427
|
report: false | ReportOptions;
|
|
395
428
|
tsconfig: string | false;
|
|
396
429
|
pkg?: PackageJson;
|
package/dist/config.mjs
ADDED
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { BuildContext, Options, ResolvedOptions, TsdownChunks, TsdownHooks, UserConfig, UserConfigFn, build, buildSingle, defineConfig, logger, pkgRoot } from "./config-D_2fTM9-.mjs";
|
|
2
|
+
export { BuildContext, Options, ResolvedOptions, TsdownChunks, TsdownHooks, UserConfig, UserConfigFn, build, buildSingle, defineConfig, logger, pkgRoot };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { defineConfig } from "./config-
|
|
2
|
-
import { ExternalPlugin, NodeProtocolPlugin, ReportPlugin, ShebangPlugin, fsCopy, fsExists, fsRemove, fsStat, lowestCommonAncestor } from "./plugins-
|
|
3
|
-
import { debounce, generateColor, logger, prettyName, resolveComma, resolveRegex, slash, toArray } from "./logger-
|
|
1
|
+
import { defineConfig } from "./config-CzjtjH-U.mjs";
|
|
2
|
+
import { ExternalPlugin, NodeProtocolPlugin, ReportPlugin, ShebangPlugin, fsCopy, fsExists, fsRemove, fsStat, lowestCommonAncestor } from "./plugins-qNZNAFcS.mjs";
|
|
3
|
+
import { debounce, generateColor, logger, prettyName, resolveComma, resolveRegex, slash, toArray } from "./logger-CdK2zFTY.mjs";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import process from "node:process";
|
|
6
6
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
@@ -13,7 +13,7 @@ import { tmpdir } from "node:os";
|
|
|
13
13
|
import { promisify } from "node:util";
|
|
14
14
|
import debug from "debug";
|
|
15
15
|
import { glob } from "tinyglobby";
|
|
16
|
-
import { RE_DTS } from "rolldown-plugin-dts";
|
|
16
|
+
import { RE_DTS } from "rolldown-plugin-dts/filename";
|
|
17
17
|
import { createHooks } from "hookable";
|
|
18
18
|
import { up } from "empathic/package";
|
|
19
19
|
import readline from "node:readline";
|
|
@@ -24,12 +24,50 @@ import { loadConfig } from "unconfig";
|
|
|
24
24
|
//#region src/features/attw.ts
|
|
25
25
|
const debug$5 = debug("tsdown:attw");
|
|
26
26
|
const exec$1 = promisify(child_process.exec);
|
|
27
|
+
/**
|
|
28
|
+
* ATTW profiles.
|
|
29
|
+
* Defines the resolution modes to ignore for each profile.
|
|
30
|
+
*
|
|
31
|
+
* @see https://github.com/arethetypeswrong/arethetypeswrong.github.io/blob/main/packages/cli/README.md#profiles
|
|
32
|
+
*/
|
|
33
|
+
const profiles = {
|
|
34
|
+
strict: [],
|
|
35
|
+
node16: ["node10"],
|
|
36
|
+
esmOnly: ["node10", "node16-cjs"]
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Format an ATTW problem for display
|
|
40
|
+
*/
|
|
41
|
+
function formatProblem(problem) {
|
|
42
|
+
const resolutionKind = "resolutionKind" in problem ? ` (${problem.resolutionKind})` : "";
|
|
43
|
+
const entrypoint = "entrypoint" in problem ? ` at ${problem.entrypoint}` : "";
|
|
44
|
+
switch (problem.kind) {
|
|
45
|
+
case "NoResolution": return ` ❌ No resolution${resolutionKind}${entrypoint}`;
|
|
46
|
+
case "UntypedResolution": return ` ⚠️ Untyped resolution${resolutionKind}${entrypoint}`;
|
|
47
|
+
case "FalseESM": return ` 🔄 False ESM: Types indicate ESM (${problem.typesModuleKind}) but implementation is CJS (${problem.implementationModuleKind})\n Types: ${problem.typesFileName} | Implementation: ${problem.implementationFileName}`;
|
|
48
|
+
case "FalseCJS": return ` 🔄 False CJS: Types indicate CJS (${problem.typesModuleKind}) but implementation is ESM (${problem.implementationModuleKind})\n Types: ${problem.typesFileName} | Implementation: ${problem.implementationFileName}`;
|
|
49
|
+
case "CJSResolvesToESM": return ` ⚡ CJS resolves to ESM${resolutionKind}${entrypoint}`;
|
|
50
|
+
case "NamedExports": {
|
|
51
|
+
const missingExports = problem.missing?.length > 0 ? ` Missing: ${problem.missing.join(", ")}` : "";
|
|
52
|
+
const allMissing = problem.isMissingAllNamed ? " (all named exports missing)" : "";
|
|
53
|
+
return ` 📤 Named exports problem${allMissing}${missingExports}\n Types: ${problem.typesFileName} | Implementation: ${problem.implementationFileName}`;
|
|
54
|
+
}
|
|
55
|
+
case "FallbackCondition": return ` 🎯 Fallback condition used${resolutionKind}${entrypoint}`;
|
|
56
|
+
case "FalseExportDefault": return ` 🎭 False export default\n Types: ${problem.typesFileName} | Implementation: ${problem.implementationFileName}`;
|
|
57
|
+
case "MissingExportEquals": return ` 📝 Missing export equals\n Types: ${problem.typesFileName} | Implementation: ${problem.implementationFileName}`;
|
|
58
|
+
case "InternalResolutionError": return ` 💥 Internal resolution error in ${problem.fileName} (${problem.resolutionOption})\n Module: ${problem.moduleSpecifier} | Mode: ${problem.resolutionMode}`;
|
|
59
|
+
case "UnexpectedModuleSyntax": return ` 📋 Unexpected module syntax in ${problem.fileName}\n Expected: ${problem.moduleKind} | Found: ${problem.syntax === 99 ? "ESM" : "CJS"}`;
|
|
60
|
+
case "CJSOnlyExportsDefault": return ` 🏷️ CJS only exports default in ${problem.fileName}`;
|
|
61
|
+
default: return ` ❓ Unknown problem: ${JSON.stringify(problem)}`;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
27
64
|
async function attw(options) {
|
|
28
65
|
if (!options.attw) return;
|
|
29
66
|
if (!options.pkg) {
|
|
30
67
|
logger.warn("attw is enabled but package.json is not found");
|
|
31
68
|
return;
|
|
32
69
|
}
|
|
70
|
+
const { profile = "strict", level = "warn",...attwOptions } = options.attw === true ? {} : options.attw;
|
|
33
71
|
const t = performance.now();
|
|
34
72
|
debug$5("Running attw check");
|
|
35
73
|
const tempDir = await mkdtemp(path.join(tmpdir(), "tsdown-attw-"));
|
|
@@ -41,15 +79,28 @@ async function attw(options) {
|
|
|
41
79
|
return;
|
|
42
80
|
}
|
|
43
81
|
try {
|
|
44
|
-
const { stdout: tarballInfo } = await exec$1(`npm pack --json ----pack-destination ${tempDir}`, {
|
|
82
|
+
const { stdout: tarballInfo } = await exec$1(`npm pack --json ----pack-destination ${tempDir}`, {
|
|
83
|
+
encoding: "utf8",
|
|
84
|
+
cwd: options.cwd
|
|
85
|
+
});
|
|
45
86
|
const parsed = JSON.parse(tarballInfo);
|
|
46
87
|
if (!Array.isArray(parsed) || !parsed[0]?.filename) throw new Error("Invalid npm pack output format");
|
|
47
88
|
const tarballPath = path.join(tempDir, parsed[0].filename);
|
|
48
89
|
const tarball = await readFile(tarballPath);
|
|
49
90
|
const pkg = attwCore.createPackageFromTarballData(tarball);
|
|
50
|
-
const checkResult = await attwCore.checkPackage(pkg,
|
|
51
|
-
if (checkResult.types !== false && checkResult.problems)
|
|
52
|
-
|
|
91
|
+
const checkResult = await attwCore.checkPackage(pkg, attwOptions);
|
|
92
|
+
if (checkResult.types !== false && checkResult.problems) {
|
|
93
|
+
const problems = checkResult.problems.filter((problem) => {
|
|
94
|
+
if ("resolutionKind" in problem) return !profiles[profile]?.includes(problem.resolutionKind);
|
|
95
|
+
return true;
|
|
96
|
+
});
|
|
97
|
+
if (problems.length) {
|
|
98
|
+
const problemList = problems.map(formatProblem).join("\n");
|
|
99
|
+
const problemMessage = `Are the types wrong problems found:\n${problemList}`;
|
|
100
|
+
if (level === "error") throw new Error(problemMessage);
|
|
101
|
+
logger.warn(problemMessage);
|
|
102
|
+
}
|
|
103
|
+
} else logger.success(`No Are the types wrong problems found`, dim`(${Math.round(performance.now() - t)}ms)`);
|
|
53
104
|
} catch (error) {
|
|
54
105
|
logger.error("ATTW check failed:", error);
|
|
55
106
|
debug$5("Found errors, setting exit code to 1");
|
|
@@ -751,7 +802,8 @@ async function resolveWorkspace(config, options) {
|
|
|
751
802
|
};
|
|
752
803
|
}
|
|
753
804
|
async function resolveConfig(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;
|
|
805
|
+
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, bundle, unbundle = typeof bundle === "boolean" ? !bundle : false } = userConfig;
|
|
806
|
+
if (typeof bundle === "boolean") logger.warn("`bundle` option is deprecated. Use `unbundle` instead.");
|
|
755
807
|
outDir = path.resolve(cwd, outDir);
|
|
756
808
|
clean = resolveClean(clean, outDir, cwd);
|
|
757
809
|
const pkg = await readPackageJson(cwd);
|
|
@@ -807,7 +859,8 @@ async function resolveConfig(userConfig) {
|
|
|
807
859
|
name,
|
|
808
860
|
external,
|
|
809
861
|
noExternal,
|
|
810
|
-
exports
|
|
862
|
+
exports,
|
|
863
|
+
unbundle
|
|
811
864
|
};
|
|
812
865
|
return config;
|
|
813
866
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { logger } from "./logger-
|
|
2
|
-
import { version } from "./package-
|
|
1
|
+
import { logger } from "./logger-CdK2zFTY.mjs";
|
|
2
|
+
import { version } from "./package-DRxdhN87.mjs";
|
|
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,11 @@
|
|
|
1
|
-
import { logger, noop, prettyFormat, prettyName, toArray } from "./logger-
|
|
2
|
-
import {
|
|
1
|
+
import { logger, noop, prettyFormat, prettyName, toArray } from "./logger-CdK2zFTY.mjs";
|
|
2
|
+
import { builtinModules } from "node:module";
|
|
3
3
|
import path, { dirname, normalize, sep } from "node:path";
|
|
4
4
|
import { bold, dim, green, underline } from "ansis";
|
|
5
5
|
import { access, chmod, cp, rm, stat } from "node:fs/promises";
|
|
6
6
|
import { promisify } from "node:util";
|
|
7
7
|
import debug from "debug";
|
|
8
|
-
import { RE_DTS } from "rolldown-plugin-dts";
|
|
8
|
+
import { RE_DTS } from "rolldown-plugin-dts/filename";
|
|
9
9
|
import { Buffer } from "node:buffer";
|
|
10
10
|
import { brotliCompress, gzip } from "node:zlib";
|
|
11
11
|
|
|
@@ -61,7 +61,11 @@ function ExternalPlugin(options) {
|
|
|
61
61
|
if (noExternal) {
|
|
62
62
|
const noExternalPatterns = toArray(noExternal);
|
|
63
63
|
if (noExternalPatterns.some((pattern) => {
|
|
64
|
-
|
|
64
|
+
if (pattern instanceof RegExp) {
|
|
65
|
+
pattern.lastIndex = 0;
|
|
66
|
+
return pattern.test(id);
|
|
67
|
+
}
|
|
68
|
+
return id === pattern;
|
|
65
69
|
})) return;
|
|
66
70
|
}
|
|
67
71
|
let shouldExternal = false;
|
|
@@ -76,7 +80,7 @@ function ExternalPlugin(options) {
|
|
|
76
80
|
return {
|
|
77
81
|
id,
|
|
78
82
|
external: shouldExternal,
|
|
79
|
-
moduleSideEffects: id.startsWith("node:") ||
|
|
83
|
+
moduleSideEffects: id.startsWith("node:") || builtinModules.includes(id) ? false : void 0
|
|
80
84
|
};
|
|
81
85
|
}
|
|
82
86
|
}
|
|
@@ -113,11 +117,7 @@ function NodeProtocolPlugin() {
|
|
|
113
117
|
//#region src/utils/format.ts
|
|
114
118
|
function formatBytes(bytes) {
|
|
115
119
|
if (bytes === Infinity) return void 0;
|
|
116
|
-
|
|
117
|
-
maximumFractionDigits: 2,
|
|
118
|
-
minimumFractionDigits: 2
|
|
119
|
-
});
|
|
120
|
-
return `${numberFormatter.format(bytes / 1e3)} kB`;
|
|
120
|
+
return `${(bytes / 1e3).toFixed(2)} kB`;
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ExternalPlugin, NodeProtocolPlugin, ReportPlugin, ShebangPlugin } from "./plugins-
|
|
2
|
-
import "./logger-
|
|
1
|
+
import { ExternalPlugin, NodeProtocolPlugin, ReportPlugin, ShebangPlugin } from "./plugins-qNZNAFcS.mjs";
|
|
2
|
+
import "./logger-CdK2zFTY.mjs";
|
|
3
3
|
|
|
4
4
|
export { ExternalPlugin, NodeProtocolPlugin, ReportPlugin, ShebangPlugin };
|
package/dist/{run.js → run.mjs}
RENAMED
|
@@ -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-CdK2zFTY.mjs";
|
|
3
|
+
import { version } from "./package-DRxdhN87.mjs";
|
|
4
4
|
import module from "node:module";
|
|
5
5
|
import process from "node:process";
|
|
6
6
|
import { dim } from "ansis";
|
|
@@ -17,12 +17,12 @@ cli.command("[...files]", "Bundle files", {
|
|
|
17
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
|
-
const { build: build$1 } = await import("./index.
|
|
20
|
+
const { build: build$1 } = await import("./index.mjs");
|
|
21
21
|
if (input.length > 0) flags.entry = input;
|
|
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-D3HAtePC.mjs");
|
|
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.8",
|
|
4
4
|
"description": "The Elegant Bundler for Libraries",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -18,14 +18,14 @@
|
|
|
18
18
|
"dist",
|
|
19
19
|
"esm-shims.js"
|
|
20
20
|
],
|
|
21
|
-
"main": "./dist/index.
|
|
22
|
-
"module": "./dist/index.
|
|
23
|
-
"types": "./dist/index.d.
|
|
21
|
+
"main": "./dist/index.mjs",
|
|
22
|
+
"module": "./dist/index.mjs",
|
|
23
|
+
"types": "./dist/index.d.mts",
|
|
24
24
|
"exports": {
|
|
25
|
-
".": "./dist/index.
|
|
26
|
-
"./config": "./dist/config.
|
|
27
|
-
"./plugins": "./dist/plugins.
|
|
28
|
-
"./run": "./dist/run.
|
|
25
|
+
".": "./dist/index.mjs",
|
|
26
|
+
"./config": "./dist/config.mjs",
|
|
27
|
+
"./plugins": "./dist/plugins.mjs",
|
|
28
|
+
"./run": "./dist/run.mjs",
|
|
29
29
|
"./package.json": "./package.json"
|
|
30
30
|
},
|
|
31
31
|
"typesVersions": {
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
}
|
|
38
38
|
},
|
|
39
39
|
"bin": {
|
|
40
|
-
"tsdown": "./dist/run.
|
|
40
|
+
"tsdown": "./dist/run.mjs"
|
|
41
41
|
},
|
|
42
42
|
"publishConfig": {
|
|
43
43
|
"access": "public"
|
|
@@ -74,41 +74,41 @@
|
|
|
74
74
|
"diff": "^8.0.2",
|
|
75
75
|
"empathic": "^1.1.0",
|
|
76
76
|
"hookable": "^5.5.3",
|
|
77
|
-
"rolldown": "1.0.0-beta.
|
|
78
|
-
"rolldown-plugin-dts": "^0.13.
|
|
77
|
+
"rolldown": "1.0.0-beta.15",
|
|
78
|
+
"rolldown-plugin-dts": "^0.13.11",
|
|
79
79
|
"semver": "^7.7.2",
|
|
80
80
|
"tinyexec": "^1.0.1",
|
|
81
81
|
"tinyglobby": "^0.2.14",
|
|
82
82
|
"unconfig": "^7.3.2"
|
|
83
83
|
},
|
|
84
84
|
"devDependencies": {
|
|
85
|
-
"@arethetypeswrong/core": "^0.18.
|
|
86
|
-
"@oxc-node/core": "^0.0.
|
|
87
|
-
"@sxzz/eslint-config": "^7.0.
|
|
85
|
+
"@arethetypeswrong/core": "^0.18.2",
|
|
86
|
+
"@oxc-node/core": "^0.0.28",
|
|
87
|
+
"@sxzz/eslint-config": "^7.0.2",
|
|
88
88
|
"@sxzz/prettier-config": "^2.2.1",
|
|
89
89
|
"@sxzz/test-utils": "^0.5.6",
|
|
90
90
|
"@types/debug": "^4.1.12",
|
|
91
|
-
"@types/node": "^
|
|
91
|
+
"@types/node": "^24.0.1",
|
|
92
92
|
"@types/semver": "^7.7.0",
|
|
93
|
-
"@unocss/eslint-plugin": "^66.
|
|
93
|
+
"@unocss/eslint-plugin": "^66.2.0",
|
|
94
94
|
"@vueuse/core": "^13.3.0",
|
|
95
95
|
"bumpp": "^10.1.1",
|
|
96
|
-
"eslint": "^9.
|
|
96
|
+
"eslint": "^9.28.0",
|
|
97
97
|
"lightningcss": "^1.30.1",
|
|
98
98
|
"pkg-types": "^2.1.0",
|
|
99
99
|
"prettier": "^3.5.3",
|
|
100
100
|
"publint": "^0.3.12",
|
|
101
101
|
"typedoc": "^0.28.5",
|
|
102
|
-
"typedoc-plugin-markdown": "^4.6.
|
|
102
|
+
"typedoc-plugin-markdown": "^4.6.4",
|
|
103
103
|
"typescript": "~5.8.3",
|
|
104
|
-
"unocss": "^66.
|
|
104
|
+
"unocss": "^66.2.0",
|
|
105
105
|
"unplugin-lightningcss": "^0.4.1",
|
|
106
|
-
"unplugin-unused": "^0.5.
|
|
106
|
+
"unplugin-unused": "^0.5.1",
|
|
107
107
|
"vite": "npm:rolldown-vite@latest",
|
|
108
108
|
"vitepress": "^1.6.3",
|
|
109
|
-
"vitepress-plugin-group-icons": "^1.
|
|
110
|
-
"vitepress-plugin-llms": "^1.
|
|
111
|
-
"vitest": "^3.
|
|
109
|
+
"vitepress-plugin-group-icons": "^1.6.0",
|
|
110
|
+
"vitepress-plugin-llms": "^1.5.0",
|
|
111
|
+
"vitest": "^3.2.3",
|
|
112
112
|
"vue": "^3.5.16"
|
|
113
113
|
},
|
|
114
114
|
"engines": {
|
package/dist/config.d.ts
DELETED
package/dist/config.js
DELETED
package/dist/index.d.ts
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { BuildContext, Options, TsdownChunks, TsdownHooks, UserConfig, UserConfigFn, build, buildSingle, defineConfig, logger, pkgRoot } from "./config-CzJapb1X.js";
|
|
2
|
-
export { BuildContext, Options, TsdownChunks, TsdownHooks, UserConfig, UserConfigFn, build, buildSingle, defineConfig, logger, pkgRoot };
|
package/dist/package-BWIL_dgZ.js
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|