tsdown 0.10.1 → 0.10.2
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/README.md +1 -1
- package/dist/{config.d-D3EdptPL.d.ts → config.d-DRSsMo60.d.ts} +4 -1
- package/dist/config.d.ts +2 -2
- package/dist/index.d.ts +5 -3
- package/dist/index.js +8 -2
- package/dist/{migrate-CowIU0R_.js → migrate-Dm7wrtcG.js} +1 -1
- package/dist/{options.d--a1aWVL6.d.ts → options.d-BCXr2j3p.d.ts} +0 -3
- package/dist/package-DNcXUvW0.js +5 -0
- package/dist/plugins.d.ts +1 -1
- package/dist/run.js +3 -3
- package/package.json +6 -6
- package/dist/package-DfgxaSyP.js +0 -5
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<img src="./docs/public/og-image.svg" alt="tsdown" width="100%" /><br>
|
|
2
2
|
|
|
3
|
-
# tsdown [](https://npmjs.com/package/tsdown) [](https://github.com/rolldown/tsdown/actions/workflows/tests.yml) [](https://jsr.io/@sxzz/tsdown)
|
|
3
|
+
# tsdown [](https://npmjs.com/package/tsdown) [](https://github.com/rolldown/tsdown/actions/workflows/tests.yml) [](https://jsr.io/@sxzz/tsdown) [](https://stackblitz.com/github/rolldown/tsdown-starter-stackblitz)
|
|
4
4
|
|
|
5
5
|
✨ The elegant bundler for libraries powered by [Rolldown](https://github.com/rolldown/rolldown).
|
|
6
6
|
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import { UserConfig, UserConfigFn } from "./options.d
|
|
1
|
+
import { UserConfig, UserConfigFn } from "./options.d-BCXr2j3p.js";
|
|
2
2
|
|
|
3
3
|
//#region src/config.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Defines the configuration for tsdown.
|
|
6
6
|
*/
|
|
7
|
+
/**
|
|
8
|
+
* Defines the configuration for tsdown.
|
|
9
|
+
*/
|
|
7
10
|
declare function defineConfig(options: UserConfig): UserConfig;
|
|
8
11
|
declare function defineConfig(options: UserConfigFn): UserConfigFn;
|
|
9
12
|
|
package/dist/config.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { UserConfig, UserConfigFn } from "./options.d
|
|
2
|
-
import { defineConfig$1 as defineConfig } from "./config.d-
|
|
1
|
+
import { UserConfig, UserConfigFn } from "./options.d-BCXr2j3p.js";
|
|
2
|
+
import { defineConfig$1 as defineConfig } from "./config.d-DRSsMo60.js";
|
|
3
3
|
export { UserConfig, UserConfigFn, defineConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import { BuildContext, Options, ResolvedOptions, TsdownHooks, UserConfig } from "./options.d
|
|
2
|
-
import { defineConfig$1 as defineConfig } from "./config.d-
|
|
1
|
+
import { BuildContext, Options, ResolvedOptions, TsdownHooks, UserConfig } from "./options.d-BCXr2j3p.js";
|
|
2
|
+
import { defineConfig$1 as defineConfig } from "./config.d-DRSsMo60.js";
|
|
3
3
|
import { ConsolaInstance } from "consola";
|
|
4
4
|
|
|
5
5
|
//#region src/utils/logger.d.ts
|
|
6
6
|
/**
|
|
7
7
|
* Logger instance
|
|
8
8
|
*/
|
|
9
|
+
/**
|
|
10
|
+
* Logger instance
|
|
11
|
+
*/
|
|
9
12
|
declare const logger: ConsolaInstance;
|
|
10
13
|
|
|
11
14
|
//#endregion
|
|
@@ -15,7 +18,6 @@ declare const logger: ConsolaInstance;
|
|
|
15
18
|
*/
|
|
16
19
|
declare function build(userOptions?: Options): Promise<void>;
|
|
17
20
|
declare const pkgRoot: string;
|
|
18
|
-
|
|
19
21
|
/**
|
|
20
22
|
* Build a single configuration, without watch and shortcuts features.
|
|
21
23
|
*
|
package/dist/index.js
CHANGED
|
@@ -19,15 +19,21 @@ import { up } from "empathic/find";
|
|
|
19
19
|
|
|
20
20
|
//#region src/features/clean.ts
|
|
21
21
|
const debug$3 = Debug("tsdown:clean");
|
|
22
|
+
const RE_LAST_SLASH = /[/\\]$/;
|
|
22
23
|
async function cleanOutDir(configs) {
|
|
23
24
|
const removes = new Set();
|
|
24
25
|
for (const config of configs) {
|
|
25
26
|
if (!config.clean.length) continue;
|
|
26
27
|
const files = await glob(config.clean, {
|
|
27
28
|
cwd: config.cwd,
|
|
28
|
-
absolute: true
|
|
29
|
+
absolute: true,
|
|
30
|
+
onlyFiles: false
|
|
29
31
|
});
|
|
30
|
-
|
|
32
|
+
const normalizedOutDir = config.outDir.replace(RE_LAST_SLASH, "");
|
|
33
|
+
for (const file of files) {
|
|
34
|
+
const normalizedFile = file.replace(RE_LAST_SLASH, "");
|
|
35
|
+
if (normalizedFile !== normalizedOutDir) removes.add(file);
|
|
36
|
+
}
|
|
31
37
|
}
|
|
32
38
|
if (!removes.size) return;
|
|
33
39
|
logger.info("Cleaning %d files", removes.size);
|
|
@@ -14,7 +14,6 @@ interface BuildContext {
|
|
|
14
14
|
interface RolldownContext {
|
|
15
15
|
buildOptions: BuildOptions;
|
|
16
16
|
}
|
|
17
|
-
|
|
18
17
|
/**
|
|
19
18
|
* Hooks for tsdown.
|
|
20
19
|
*/
|
|
@@ -83,7 +82,6 @@ type Arrayable<T> = T | T[];
|
|
|
83
82
|
type Sourcemap = boolean | "inline" | "hidden";
|
|
84
83
|
type Format = Exclude<ModuleFormat, "experimental-app">;
|
|
85
84
|
type NormalizedFormat = Exclude<InternalModuleFormat, "app">;
|
|
86
|
-
|
|
87
85
|
/**
|
|
88
86
|
* Options for tsdown.
|
|
89
87
|
*/
|
|
@@ -185,7 +183,6 @@ interface Options$3 {
|
|
|
185
183
|
env?: Record<string, any>;
|
|
186
184
|
hooks?: Partial<TsdownHooks> | ((hooks: Hookable<TsdownHooks>) => Awaitable<void>);
|
|
187
185
|
}
|
|
188
|
-
|
|
189
186
|
/**
|
|
190
187
|
* Options without specifying config file path.
|
|
191
188
|
*/
|
package/dist/plugins.d.ts
CHANGED
package/dist/run.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { logger, resolveComma, setSilent, toArray } from "./general-C06aMSSY.js";
|
|
3
|
-
import { version } from "./package-
|
|
3
|
+
import { version } from "./package-DNcXUvW0.js";
|
|
4
4
|
import process from "node:process";
|
|
5
5
|
import { dim } from "ansis";
|
|
6
6
|
import Debug from "debug";
|
|
@@ -11,7 +11,7 @@ import { cac } from "cac";
|
|
|
11
11
|
//#region src/cli.ts
|
|
12
12
|
const cli = cac("tsdown");
|
|
13
13
|
cli.help().version(version);
|
|
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("--external <module>", "Mark dependencies as external").option("--minify", "Minify output").option("--debug [scope]", "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").action(async (input, flags) => {
|
|
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("--external <module>", "Mark dependencies as external").option("--minify", "Minify output").option("--debug [scope]", "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").action(async (input, flags) => {
|
|
15
15
|
setSilent(!!flags.silent);
|
|
16
16
|
logger.info(`tsdown ${dim`v${version}`} powered by rolldown ${dim`v${VERSION}`}`);
|
|
17
17
|
const { build: build$1 } = await import("./index.js");
|
|
@@ -19,7 +19,7 @@ cli.command("[...files]", "Bundle files", { ignoreOptionDefaultValue: true }).op
|
|
|
19
19
|
await build$1(flags);
|
|
20
20
|
});
|
|
21
21
|
cli.command("migrate", "Migrate from tsup to tsdown").option("-c, --cwd <dir>", "Working directory").option("-d, --dry-run", "Dry run").action(async (args) => {
|
|
22
|
-
const { migrate } = await import("./migrate-
|
|
22
|
+
const { migrate } = await import("./migrate-Dm7wrtcG.js");
|
|
23
23
|
await migrate(args);
|
|
24
24
|
});
|
|
25
25
|
async function runCLI() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tsdown",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.2",
|
|
4
4
|
"description": "The Elegant Bundler for Libraries",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -64,19 +64,19 @@
|
|
|
64
64
|
"hookable": "^5.5.3",
|
|
65
65
|
"lightningcss": "^1.29.3",
|
|
66
66
|
"rolldown": "1.0.0-beta.8-commit.852c603",
|
|
67
|
-
"rolldown-plugin-dts": "^0.9.
|
|
67
|
+
"rolldown-plugin-dts": "^0.9.7",
|
|
68
68
|
"tinyexec": "^1.0.1",
|
|
69
69
|
"tinyglobby": "^0.2.13",
|
|
70
70
|
"unconfig": "^7.3.2",
|
|
71
71
|
"unplugin-lightningcss": "^0.3.3"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
|
-
"@sxzz/eslint-config": "^6.
|
|
74
|
+
"@sxzz/eslint-config": "^6.2.0",
|
|
75
75
|
"@sxzz/prettier-config": "^2.2.1",
|
|
76
76
|
"@sxzz/test-utils": "^0.5.5",
|
|
77
77
|
"@types/debug": "^4.1.12",
|
|
78
78
|
"@types/diff": "^7.0.2",
|
|
79
|
-
"@types/node": "^22.15.
|
|
79
|
+
"@types/node": "^22.15.3",
|
|
80
80
|
"@unocss/eslint-plugin": "^66.1.0-beta.12",
|
|
81
81
|
"bumpp": "^10.1.0",
|
|
82
82
|
"eslint": "^9.25.1",
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"prettier": "^3.5.3",
|
|
85
85
|
"publint": "^0.3.12",
|
|
86
86
|
"tsup": "^8.4.0",
|
|
87
|
-
"tsx": "^4.19.
|
|
87
|
+
"tsx": "^4.19.4",
|
|
88
88
|
"typedoc": "^0.28.3",
|
|
89
89
|
"typedoc-plugin-markdown": "^4.6.3",
|
|
90
90
|
"typescript": "~5.8.3",
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
"vite": "^6.3.3",
|
|
94
94
|
"vitepress": "^1.6.3",
|
|
95
95
|
"vitepress-plugin-group-icons": "^1.5.2",
|
|
96
|
-
"vitepress-plugin-llms": "^1.1.
|
|
96
|
+
"vitepress-plugin-llms": "^1.1.1",
|
|
97
97
|
"vitest": "^3.1.2",
|
|
98
98
|
"vue": "^3.5.13"
|
|
99
99
|
},
|