tsdown 0.2.10 → 0.2.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/{external-uGOHYulu.js → external-NHKSS1J8.js} +2 -2
- package/dist/index.js +14 -10
- package/dist/options.d.ts +2 -2
- package/dist/plugins.js +1 -1
- package/dist/run.js +3 -6
- package/dist/utils/types.d.ts +1 -1
- package/package.json +13 -12
|
@@ -2,11 +2,11 @@ import { isBuiltin } from "node:module";
|
|
|
2
2
|
|
|
3
3
|
//#region src/features/external.ts
|
|
4
4
|
function ExternalPlugin(pkg, platform) {
|
|
5
|
-
const deps = pkg && getProductionDeps(pkg);
|
|
5
|
+
const deps = pkg && Array.from(getProductionDeps(pkg));
|
|
6
6
|
return {
|
|
7
7
|
name: "tsdown:external",
|
|
8
8
|
resolveId(id) {
|
|
9
|
-
let shouldExternal = deps
|
|
9
|
+
let shouldExternal = deps && deps.some((dep) => id === dep || id.startsWith(`${dep}/`));
|
|
10
10
|
shouldExternal ||= platform === "node" && isBuiltin(id);
|
|
11
11
|
if (shouldExternal) {
|
|
12
12
|
return {
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { logger } from "./logger-e0Fr5WMR.js";
|
|
2
|
-
import { ExternalPlugin } from "./external-
|
|
2
|
+
import { ExternalPlugin } from "./external-NHKSS1J8.js";
|
|
3
3
|
import { default as process, default as process$1, default as process$2 } from "node:process";
|
|
4
4
|
import { rolldown } from "rolldown";
|
|
5
5
|
import { IsolatedDecl } from "unplugin-isolated-decl";
|
|
@@ -56,14 +56,18 @@ function getPackageType(pkg) {
|
|
|
56
56
|
//#endregion
|
|
57
57
|
//#region src/features/output.ts
|
|
58
58
|
function resolveOutputExtension(pkg, format) {
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
59
|
+
const moduleType = getPackageType(pkg);
|
|
60
|
+
switch (format) {
|
|
61
|
+
case "iife": return "js";
|
|
62
|
+
case "es":
|
|
63
|
+
case "esm":
|
|
64
|
+
case "module": {
|
|
65
|
+
return moduleType === "module" ? "js" : "mjs";
|
|
66
|
+
}
|
|
67
|
+
case "cjs":
|
|
68
|
+
case "commonjs": {
|
|
69
|
+
return moduleType === "module" ? "mjs" : "js";
|
|
70
|
+
}
|
|
67
71
|
}
|
|
68
72
|
}
|
|
69
73
|
|
|
@@ -218,6 +222,7 @@ async function build(userOptions = {}) {
|
|
|
218
222
|
external,
|
|
219
223
|
resolve: { alias },
|
|
220
224
|
treeshake,
|
|
225
|
+
platform,
|
|
221
226
|
plugins: [ExternalPlugin(pkg, platform), dts && IsolatedDecl.rolldown(dts === true ? {} : dts), ...plugins,].filter((plugin) => !!plugin),
|
|
222
227
|
...resolved.inputOptions
|
|
223
228
|
};
|
|
@@ -227,7 +232,6 @@ async function build(userOptions = {}) {
|
|
|
227
232
|
await watchBuild(resolved, writeBundle);
|
|
228
233
|
} else {
|
|
229
234
|
await build$1.destroy();
|
|
230
|
-
process.exit(0);
|
|
231
235
|
}
|
|
232
236
|
async function writeBundle(first) {
|
|
233
237
|
if (!first) startTime = performance.now();
|
package/dist/options.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { External } from "./features/external";
|
|
|
2
2
|
import type { MarkPartial, MaybePromise, Overwrite } from "./utils/types";
|
|
3
3
|
import type { InputOptions, OutputOptions } from "rolldown";
|
|
4
4
|
import type { Options as IsolatedDeclOptions } from "unplugin-isolated-decl";
|
|
5
|
-
export type Format = "es" | "esm" | "module" | "
|
|
5
|
+
export type Format = "es" | "cjs" | "esm" | "module" | "commonjs" | "iife";
|
|
6
6
|
export type Sourcemap = boolean | "inline" | "hidden";
|
|
7
7
|
export interface Options {
|
|
8
8
|
entry?: InputOptions["input"];
|
|
@@ -17,7 +17,7 @@ export interface Options {
|
|
|
17
17
|
alias?: Record<string, string>;
|
|
18
18
|
treeshake?: boolean;
|
|
19
19
|
minify?: boolean;
|
|
20
|
-
platform?: "node" | "neutral";
|
|
20
|
+
platform?: "node" | "neutral" | "browser";
|
|
21
21
|
dts?: boolean | IsolatedDeclOptions;
|
|
22
22
|
watch?: boolean | string | string[];
|
|
23
23
|
inputOptions?: InputOptions;
|
package/dist/plugins.js
CHANGED
package/dist/run.js
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import { logger } from "./logger-e0Fr5WMR.js";
|
|
2
2
|
import { default as process } from "node:process";
|
|
3
|
+
import { VERSION as rolldownVersion } from "rolldown";
|
|
3
4
|
import { default as pc } from "picocolors";
|
|
4
5
|
import { cac } from "cac";
|
|
5
6
|
|
|
6
|
-
//#region node_modules/.pnpm/rolldown@0.12.2-snapshot-374cd3d-20240819002934/node_modules/rolldown/package.json
|
|
7
|
-
const version$1 = "0.12.2-snapshot-374cd3d-20240819002934";
|
|
8
|
-
|
|
9
|
-
//#endregion
|
|
10
7
|
//#region package.json
|
|
11
|
-
const version = "0.2.
|
|
8
|
+
const version = "0.2.12";
|
|
12
9
|
|
|
13
10
|
//#endregion
|
|
14
11
|
//#region src/cli.ts
|
|
@@ -16,7 +13,7 @@ async function runCLI() {
|
|
|
16
13
|
const cli = cac("tsdown");
|
|
17
14
|
cli.command("[...files]", "Bundle files", { ignoreOptionDefaultValue: true }).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("--minify", "Minify output").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("--platform <platform>", "Target platform", { default: "node" }).option("--watch", "Watch mode").action(async (input, flags) => {
|
|
18
15
|
logger.level = flags.silent ? 0 : 3;
|
|
19
|
-
logger.info(`tsdown ${pc.dim(`v${version}`)} powered by rolldown ${pc.dim(`v${
|
|
16
|
+
logger.info(`tsdown ${pc.dim(`v${version}`)} powered by rolldown ${pc.dim(`v${rolldownVersion}`)}`);
|
|
20
17
|
const { build } = await import("./index.js");
|
|
21
18
|
if (input.length > 0) flags.entry = input;
|
|
22
19
|
await build(flags);
|
package/dist/utils/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tsdown",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.12",
|
|
4
4
|
"description": "An even faster bundler powered by Rolldown.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -42,25 +42,26 @@
|
|
|
42
42
|
"cac": "^6.7.14",
|
|
43
43
|
"chokidar": "^3.6.0",
|
|
44
44
|
"consola": "^3.2.3",
|
|
45
|
-
"picocolors": "^1.0
|
|
46
|
-
"pkg-types": "^1.
|
|
47
|
-
"rolldown": "
|
|
48
|
-
"tinyglobby": "^0.2.
|
|
45
|
+
"picocolors": "^1.1.0",
|
|
46
|
+
"pkg-types": "^1.2.0",
|
|
47
|
+
"rolldown": "https://pkg.pr.new/rolldown@04deb7f",
|
|
48
|
+
"tinyglobby": "^0.2.5",
|
|
49
49
|
"unconfig": "^0.5.5",
|
|
50
|
-
"unplugin-isolated-decl": "^0.4.
|
|
50
|
+
"unplugin-isolated-decl": "^0.4.7"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@sxzz/eslint-config": "^
|
|
53
|
+
"@sxzz/eslint-config": "^4.1.5",
|
|
54
54
|
"@sxzz/prettier-config": "^2.0.2",
|
|
55
|
-
"@types/node": "^
|
|
56
|
-
"bumpp": "^9.5.
|
|
57
|
-
"eslint": "^9.
|
|
55
|
+
"@types/node": "^22.5.4",
|
|
56
|
+
"bumpp": "^9.5.2",
|
|
57
|
+
"eslint": "^9.10.0",
|
|
58
58
|
"execa": "^9.3.1",
|
|
59
|
-
"fdir": "^6.
|
|
59
|
+
"fdir": "^6.3.0",
|
|
60
60
|
"prettier": "^3.3.3",
|
|
61
61
|
"tsup": "^8.2.4",
|
|
62
|
-
"tsx": "^4.
|
|
62
|
+
"tsx": "^4.19.0",
|
|
63
63
|
"typescript": "~5.5.4",
|
|
64
|
+
"unplugin-unused": "^0.1.7",
|
|
64
65
|
"vitest": "^2.0.5"
|
|
65
66
|
},
|
|
66
67
|
"engines": {
|