tsdown 0.2.5 → 0.2.7
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/features/entry.d.ts +2 -2
- package/dist/features/external.d.ts +5 -5
- package/dist/features/output.d.ts +2 -2
- package/dist/features/watch.d.ts +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/options.d.ts +13 -12
- package/dist/plugins.d.ts +1 -1
- package/dist/run.d.ts +1 -0
- package/dist/run.js +9 -3
- package/dist/utils/logger.d.ts +1 -1
- package/dist/utils/package.d.ts +2 -2
- package/package.json +9 -8
package/dist/features/entry.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { Options } from
|
|
2
|
-
export declare function resolveEntry(entry: Options[
|
|
1
|
+
import type { Options } from "../options";
|
|
2
|
+
export declare function resolveEntry(entry: Options["entry"]): Promise<string[] | Record<string, string>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { ResolvedOptions } from
|
|
2
|
-
import type { PackageJson } from
|
|
3
|
-
import type { InputOptions, Plugin } from
|
|
4
|
-
export type External = InputOptions[
|
|
5
|
-
export declare function ExternalPlugin(pkg: PackageJson | undefined, platform: ResolvedOptions[
|
|
1
|
+
import type { ResolvedOptions } from "../options";
|
|
2
|
+
import type { PackageJson } from "pkg-types";
|
|
3
|
+
import type { InputOptions, Plugin } from "rolldown";
|
|
4
|
+
export type External = InputOptions["external"];
|
|
5
|
+
export declare function ExternalPlugin(pkg: PackageJson | undefined, platform: ResolvedOptions["platform"]): Plugin;
|
|
6
6
|
export declare function getProductionDeps(pkg: PackageJson): Set<string>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { Format } from
|
|
2
|
-
export declare function resolveOutputExtension(pkg: any, format: Format):
|
|
1
|
+
import type { Format } from "../options";
|
|
2
|
+
export declare function resolveOutputExtension(pkg: any, format: Format): "mjs" | "cjs" | "js";
|
package/dist/features/watch.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { ResolvedOptions } from
|
|
1
|
+
import type { ResolvedOptions } from "../options";
|
|
2
2
|
export declare function watchBuild(options: ResolvedOptions, rebuild: () => void): Promise<void>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import { type Options, type OptionsWithoutConfig } from
|
|
1
|
+
import { type Options, type OptionsWithoutConfig } from "./options";
|
|
2
2
|
export declare function build(userOptions?: Options): Promise<void>;
|
|
3
3
|
export declare function defineConfig(options: OptionsWithoutConfig): OptionsWithoutConfig;
|
|
4
|
+
export type { Options, OptionsWithoutConfig };
|
package/dist/index.js
CHANGED
|
@@ -144,7 +144,7 @@ async function normalizeOptions(options) {
|
|
|
144
144
|
...await loadConfigFile(options),
|
|
145
145
|
...options
|
|
146
146
|
};
|
|
147
|
-
let { entry, format = ["es"], plugins = [], external, clean = false, treeshake = true, platform = "node", outDir = "dist", sourcemap = false, dts = false, minify, alias, watch = false, inputOptions, outputOptions } = options;
|
|
147
|
+
let { entry, format = ["es"], plugins = [], external, clean = false, silent = false, treeshake = true, platform = "node", outDir = "dist", sourcemap = false, dts = false, minify, alias, watch = false, inputOptions, outputOptions } = options;
|
|
148
148
|
entry = await resolveEntry(entry);
|
|
149
149
|
format = toArray(format, "es");
|
|
150
150
|
if (clean === true) clean = [];
|
|
@@ -155,6 +155,7 @@ async function normalizeOptions(options) {
|
|
|
155
155
|
format,
|
|
156
156
|
outDir,
|
|
157
157
|
clean,
|
|
158
|
+
silent,
|
|
158
159
|
alias,
|
|
159
160
|
treeshake,
|
|
160
161
|
platform,
|
package/dist/options.d.ts
CHANGED
|
@@ -1,30 +1,31 @@
|
|
|
1
|
-
import type { External } from
|
|
2
|
-
import type { MarkPartial, MaybePromise, Overwrite } from
|
|
3
|
-
import type { InputOptions, OutputOptions } from
|
|
4
|
-
import type { Options as IsolatedDeclOptions } from
|
|
5
|
-
export type Format =
|
|
6
|
-
export type Sourcemap = boolean |
|
|
1
|
+
import type { External } from "./features/external";
|
|
2
|
+
import type { MarkPartial, MaybePromise, Overwrite } from "./utils/types";
|
|
3
|
+
import type { InputOptions, OutputOptions } from "rolldown";
|
|
4
|
+
import type { Options as IsolatedDeclOptions } from "unplugin-isolated-decl";
|
|
5
|
+
export type Format = "es" | "esm" | "module" | "cjs" | "commonjs";
|
|
6
|
+
export type Sourcemap = boolean | "inline" | "hidden";
|
|
7
7
|
export interface Options {
|
|
8
|
-
entry?: InputOptions[
|
|
8
|
+
entry?: InputOptions["input"];
|
|
9
9
|
format?: Format | Format[];
|
|
10
|
-
plugins?: InputOptions[
|
|
10
|
+
plugins?: InputOptions["plugins"];
|
|
11
11
|
external?: External;
|
|
12
12
|
outDir?: string;
|
|
13
13
|
clean?: boolean | string[];
|
|
14
|
+
silent?: boolean;
|
|
14
15
|
config?: boolean | string;
|
|
15
16
|
sourcemap?: Sourcemap;
|
|
16
17
|
alias?: Record<string, string>;
|
|
17
18
|
treeshake?: boolean;
|
|
18
19
|
minify?: boolean;
|
|
19
|
-
platform?:
|
|
20
|
+
platform?: "node" | "neutral";
|
|
20
21
|
dts?: boolean | IsolatedDeclOptions;
|
|
21
22
|
watch?: boolean | string | string[];
|
|
22
23
|
inputOptions?: InputOptions;
|
|
23
24
|
outputOptions?: OutputOptions | ((options: OutputOptions, format: Format) => MaybePromise<OutputOptions | void | null>);
|
|
24
25
|
}
|
|
25
|
-
export type OptionsWithoutConfig = Omit<Options,
|
|
26
|
-
export type ResolvedOptions = Omit<Overwrite<MarkPartial<Options,
|
|
26
|
+
export type OptionsWithoutConfig = Omit<Options, "config">;
|
|
27
|
+
export type ResolvedOptions = Omit<Overwrite<MarkPartial<Options, "inputOptions" | "outputOptions" | "minify" | "alias" | "external">, {
|
|
27
28
|
format: Format[];
|
|
28
29
|
clean: string[] | false;
|
|
29
|
-
}>,
|
|
30
|
+
}>, "config">;
|
|
30
31
|
export declare function normalizeOptions(options: Options): Promise<ResolvedOptions>;
|
package/dist/plugins.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { ExternalPlugin } from
|
|
1
|
+
export { ExternalPlugin } from "./features/external";
|
package/dist/run.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/run.js
CHANGED
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
import { logger } from "./logger-e0Fr5WMR.js";
|
|
2
2
|
import { default as process } from "node:process";
|
|
3
3
|
import { cac } from "cac";
|
|
4
|
+
import { default as pc } from "picocolors";
|
|
4
5
|
|
|
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
|
|
5
10
|
//#region package.json
|
|
6
|
-
const version = "0.2.
|
|
11
|
+
const version = "0.2.7";
|
|
7
12
|
|
|
8
13
|
//#endregion
|
|
9
14
|
//#region src/cli.ts
|
|
10
15
|
async function runCLI() {
|
|
11
16
|
const cli = cac("tsdown");
|
|
12
|
-
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("-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) => {
|
|
13
|
-
logger.
|
|
17
|
+
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
|
+
logger.level = flags.silent ? 0 : 3;
|
|
19
|
+
logger.info(`tsdown ${pc.gray(`v${version}`)} powered by rolldown ${pc.gray(`v${version$1}`)}`);
|
|
14
20
|
const { build } = await import("./index.js");
|
|
15
21
|
if (input.length > 0) flags.entry = input;
|
|
16
22
|
await build(flags);
|
package/dist/utils/logger.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { type ConsolaInstance } from
|
|
1
|
+
import { type ConsolaInstance } from "consola";
|
|
2
2
|
export declare const logger: ConsolaInstance;
|
package/dist/utils/package.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { type PackageJson } from
|
|
1
|
+
import { type PackageJson } from "pkg-types";
|
|
2
2
|
export declare function readPackageJson(dir: string): Promise<PackageJson | undefined>;
|
|
3
|
-
export declare function getPackageType(pkg: PackageJson | undefined):
|
|
3
|
+
export declare function getPackageType(pkg: PackageJson | undefined): "module" | "commonjs";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tsdown",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7",
|
|
4
4
|
"description": "An even faster bundler powered by Rolldown.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -43,22 +43,23 @@
|
|
|
43
43
|
"chokidar": "^3.6.0",
|
|
44
44
|
"consola": "^3.2.3",
|
|
45
45
|
"fast-glob": "^3.3.2",
|
|
46
|
+
"picocolors": "^1.0.1",
|
|
46
47
|
"pkg-types": "^1.1.3",
|
|
47
48
|
"rolldown": "nightly",
|
|
48
49
|
"unconfig": "^0.5.5",
|
|
49
|
-
"unplugin-isolated-decl": "^0.4.
|
|
50
|
+
"unplugin-isolated-decl": "^0.4.5"
|
|
50
51
|
},
|
|
51
52
|
"devDependencies": {
|
|
52
|
-
"@sxzz/eslint-config": "^3.
|
|
53
|
+
"@sxzz/eslint-config": "^3.17.3",
|
|
53
54
|
"@sxzz/prettier-config": "^2.0.2",
|
|
54
|
-
"@types/node": "^20.
|
|
55
|
-
"bumpp": "^9.
|
|
56
|
-
"eslint": "^9.
|
|
57
|
-
"execa": "^9.3.
|
|
55
|
+
"@types/node": "^20.16.1",
|
|
56
|
+
"bumpp": "^9.5.1",
|
|
57
|
+
"eslint": "^9.9.0",
|
|
58
|
+
"execa": "^9.3.1",
|
|
58
59
|
"fdir": "^6.2.0",
|
|
59
60
|
"prettier": "^3.3.3",
|
|
60
61
|
"tsup": "^8.2.4",
|
|
61
|
-
"tsx": "^4.
|
|
62
|
+
"tsx": "^4.17.0",
|
|
62
63
|
"typescript": "~5.5.4",
|
|
63
64
|
"vitest": "^2.0.5"
|
|
64
65
|
},
|