tsdown 0.4.4 → 0.5.0
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/index.d.ts +84 -8
- package/dist/index.js +62 -33
- package/dist/plugins.d-CKHmQhmh.d.ts +7 -0
- package/dist/plugins.d.ts +3 -1
- package/dist/run.d.ts +2 -1
- package/dist/run.js +5 -5
- package/package.json +8 -6
- package/dist/cli.d.ts +0 -1
- package/dist/features/clean.d.ts +0 -1
- package/dist/features/entry.d.ts +0 -2
- package/dist/features/external.d.ts +0 -5
- package/dist/features/output.d.ts +0 -2
- package/dist/features/shims.d.ts +0 -2
- package/dist/features/shortcuts.d.ts +0 -6
- package/dist/features/watch.d.ts +0 -3
- package/dist/options.d.ts +0 -59
- package/dist/utils/fs.d.ts +0 -2
- package/dist/utils/general.d.ts +0 -2
- package/dist/utils/logger.d.ts +0 -7
- package/dist/utils/package.d.ts +0 -3
- package/dist/utils/types.d.ts +0 -10
package/dist/index.d.ts
CHANGED
|
@@ -1,19 +1,95 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { E as External } from './plugins.d-CKHmQhmh.js';
|
|
2
|
+
import { InputOptions, ModuleFormat, OutputOptions, InternalModuleFormat } from 'rolldown';
|
|
3
|
+
import { Options as Options$1 } from 'unplugin-isolated-decl';
|
|
4
|
+
import { Options as Options$2 } from 'unplugin-unused';
|
|
5
|
+
import { ConsolaInstance } from 'consola';
|
|
6
|
+
import 'pkg-types';
|
|
7
|
+
|
|
8
|
+
type Overwrite<
|
|
9
|
+
T,
|
|
10
|
+
U
|
|
11
|
+
> = Omit<T, keyof U> & U;
|
|
12
|
+
type MaybePromise<T> = T | Promise<T>;
|
|
13
|
+
type MarkPartial<
|
|
14
|
+
T,
|
|
15
|
+
K extends keyof T
|
|
16
|
+
> = Omit<Required<T>, K> & Partial<Pick<T, K>>;
|
|
17
|
+
type Arrayable<T> = T | T[];
|
|
18
|
+
|
|
19
|
+
type Sourcemap = boolean | "inline" | "hidden";
|
|
20
|
+
/**
|
|
21
|
+
* Options for tsdown.
|
|
22
|
+
*/
|
|
23
|
+
interface Options {
|
|
24
|
+
entry?: InputOptions["input"];
|
|
25
|
+
format?: ModuleFormat | ModuleFormat[];
|
|
26
|
+
globalName?: string;
|
|
27
|
+
plugins?: InputOptions["plugins"];
|
|
28
|
+
external?: External;
|
|
29
|
+
outDir?: string;
|
|
30
|
+
clean?: boolean | string[];
|
|
31
|
+
silent?: boolean;
|
|
32
|
+
config?: boolean | string;
|
|
33
|
+
sourcemap?: Sourcemap;
|
|
34
|
+
alias?: Record<string, string>;
|
|
35
|
+
/** @default true */
|
|
36
|
+
treeshake?: boolean;
|
|
37
|
+
/** @default false */
|
|
38
|
+
minify?: boolean;
|
|
39
|
+
target?: string | string[];
|
|
40
|
+
define?: Record<string, string>;
|
|
41
|
+
/** @default 'node' */
|
|
42
|
+
platform?: "node" | "neutral" | "browser";
|
|
43
|
+
shims?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Enable dts generation with `isolatedDeclarations` (experimental)
|
|
46
|
+
*/
|
|
47
|
+
dts?: boolean | Options$1;
|
|
48
|
+
/** @default true */
|
|
49
|
+
bundleDts?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Enable unused dependencies check with `unplugin-unused` (experimental)
|
|
52
|
+
*/
|
|
53
|
+
unused?: boolean | Options$2;
|
|
54
|
+
watch?: boolean | string | string[];
|
|
55
|
+
inputOptions?: InputOptions;
|
|
56
|
+
outputOptions?: OutputOptions | ((options: OutputOptions, format: ModuleFormat) => MaybePromise<OutputOptions | void | null>);
|
|
57
|
+
onSuccess?: () => void | Promise<void>;
|
|
58
|
+
/**
|
|
59
|
+
* Skip bundling node_modules.
|
|
60
|
+
*/
|
|
61
|
+
skipNodeModulesBundle?: boolean;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Options without specifying config file path.
|
|
65
|
+
*/
|
|
66
|
+
type Config = Arrayable<Omit<Options, "config">>;
|
|
67
|
+
type NormalizedFormat = Exclude<InternalModuleFormat, "app"> | "experimental-app";
|
|
68
|
+
type ResolvedOptions = Omit<Overwrite<MarkPartial<Options, "globalName" | "inputOptions" | "outputOptions" | "minify" | "target" | "define" | "alias" | "external" | "onSuccess" | "dts">, {
|
|
69
|
+
format: NormalizedFormat[];
|
|
70
|
+
clean: string[] | false;
|
|
71
|
+
dts: false | Options$1;
|
|
72
|
+
}>, "config">;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Logger instance
|
|
76
|
+
*/
|
|
77
|
+
declare const logger: ConsolaInstance;
|
|
78
|
+
|
|
3
79
|
/**
|
|
4
80
|
* Build with tsdown.
|
|
5
81
|
*/
|
|
6
|
-
|
|
7
|
-
|
|
82
|
+
declare function build(userOptions?: Omit<Options, "silent">): Promise<void>;
|
|
83
|
+
declare const pkgRoot: string;
|
|
8
84
|
/**
|
|
9
85
|
* Build a single configuration, without watch and shortcuts features.
|
|
10
86
|
*
|
|
11
87
|
* @param resolved Resolved options
|
|
12
88
|
*/
|
|
13
|
-
|
|
89
|
+
declare function buildSingle(resolved: ResolvedOptions): Promise<(() => Promise<void>) | undefined>;
|
|
14
90
|
/**
|
|
15
91
|
* Defines the configuration for tsdown.
|
|
16
92
|
*/
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
export type
|
|
93
|
+
declare function defineConfig(options: Config): Config;
|
|
94
|
+
|
|
95
|
+
export { type Config, type Options, build, buildSingle, defineConfig, logger, pkgRoot };
|
package/dist/index.js
CHANGED
|
@@ -1,26 +1,28 @@
|
|
|
1
1
|
import { debug, logger } from "./logger-Pk57TMWT.js";
|
|
2
2
|
import { ExternalPlugin } from "./external-9r3oq3tH.js";
|
|
3
|
-
import path, { dirname
|
|
3
|
+
import path, { dirname, normalize, sep, default as path$1, default as path$2, default as path$3, default as path$4, default as path$5, default as path$6 } from "node:path";
|
|
4
4
|
import process, { default as process$1, default as process$2, default as process$3 } from "node:process";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
|
-
import { build as
|
|
6
|
+
import { build as build$1 } from "rolldown";
|
|
7
7
|
import { transformPlugin } from "rolldown/experimental";
|
|
8
8
|
import { IsolatedDecl } from "unplugin-isolated-decl";
|
|
9
9
|
import { Unused } from "unplugin-unused";
|
|
10
10
|
import { access, readdir, rm, stat } from "node:fs/promises";
|
|
11
|
-
import { glob
|
|
11
|
+
import { glob } from "tinyglobby";
|
|
12
|
+
import { rollup } from "rollup";
|
|
13
|
+
import DtsPlugin from "rollup-plugin-dts";
|
|
12
14
|
import { readPackageJSON } from "pkg-types";
|
|
13
15
|
import readline from "node:readline";
|
|
14
16
|
import pc, { default as pc$1, default as pc$2 } from "picocolors";
|
|
15
17
|
import { loadConfig } from "unconfig";
|
|
16
18
|
|
|
17
19
|
//#region src/utils/fs.ts
|
|
18
|
-
function fsExists(path$
|
|
19
|
-
return access(path$
|
|
20
|
+
function fsExists(path$7) {
|
|
21
|
+
return access(path$7).then(() => true, () => false);
|
|
20
22
|
}
|
|
21
23
|
function lowestCommonAncestor(...filepaths) {
|
|
22
24
|
if (filepaths.length === 0) return "";
|
|
23
|
-
if (filepaths.length === 1) return dirname
|
|
25
|
+
if (filepaths.length === 1) return dirname(filepaths[0]);
|
|
24
26
|
filepaths = filepaths.map(normalize);
|
|
25
27
|
const [first, ...rest] = filepaths;
|
|
26
28
|
let ancestor = first.split(sep);
|
|
@@ -41,8 +43,8 @@ else {
|
|
|
41
43
|
//#region src/features/clean.ts
|
|
42
44
|
async function cleanOutDir(cwd, patterns) {
|
|
43
45
|
const files = [];
|
|
44
|
-
if (await fsExists(cwd)) files.push(...(await readdir(cwd)).map((file) => path$
|
|
45
|
-
if (patterns.length) files.push(...await glob
|
|
46
|
+
if (await fsExists(cwd)) files.push(...(await readdir(cwd)).map((file) => path$6.resolve(cwd, file)));
|
|
47
|
+
if (patterns.length) files.push(...await glob(patterns, {
|
|
46
48
|
cwd,
|
|
47
49
|
absolute: true
|
|
48
50
|
}));
|
|
@@ -56,6 +58,31 @@ async function cleanOutDir(cwd, patterns) {
|
|
|
56
58
|
}
|
|
57
59
|
}
|
|
58
60
|
|
|
61
|
+
//#endregion
|
|
62
|
+
//#region src/features/dts.ts
|
|
63
|
+
const TEMP_DTS_DIR = ".tsdown-types";
|
|
64
|
+
async function bundleDts(options, jsExtension) {
|
|
65
|
+
const ext = jsExtension.replace("j", "t");
|
|
66
|
+
const dtsOutDir = path$5.resolve(options.outDir, TEMP_DTS_DIR);
|
|
67
|
+
const dtsEntry = Object.fromEntries(Object.keys(options.entry).map((key) => [key, path$5.resolve(dtsOutDir, `${key}.d.${ext}`)]));
|
|
68
|
+
const build$2 = await rollup({
|
|
69
|
+
input: dtsEntry,
|
|
70
|
+
onLog(level, log, defaultHandler) {
|
|
71
|
+
if (log.code !== "EMPTY_BUNDLE") defaultHandler(level, log);
|
|
72
|
+
},
|
|
73
|
+
plugins: [DtsPlugin()]
|
|
74
|
+
});
|
|
75
|
+
let outDir = options.outDir;
|
|
76
|
+
const extraOutdir = options.dts.extraOutdir;
|
|
77
|
+
if (extraOutdir) outDir = path$5.resolve(outDir, extraOutdir);
|
|
78
|
+
await build$2.write({
|
|
79
|
+
dir: outDir,
|
|
80
|
+
format: "es",
|
|
81
|
+
entryFileNames: `[name].d.${ext}`
|
|
82
|
+
});
|
|
83
|
+
await rm(dtsOutDir, { recursive: true });
|
|
84
|
+
}
|
|
85
|
+
|
|
59
86
|
//#endregion
|
|
60
87
|
//#region src/utils/package.ts
|
|
61
88
|
async function readPackageJson(dir) {
|
|
@@ -193,25 +220,21 @@ async function watchBuild(options, rebuild) {
|
|
|
193
220
|
//#region src/features/entry.ts
|
|
194
221
|
async function resolveEntry(entry) {
|
|
195
222
|
if (!entry || Object.keys(entry).length === 0) throw new Error(`No input files, try "tsdown <your-file>" instead`);
|
|
223
|
+
const objectEntry = await toObjectEntry(entry);
|
|
224
|
+
const entries = Object.values(objectEntry);
|
|
225
|
+
if (entries.length === 0) throw new Error(`Cannot find entry: ${JSON.stringify(entry)}`);
|
|
226
|
+
logger.info(`entry: ${pc$1.blue(entries.join(", "))}`);
|
|
227
|
+
return objectEntry;
|
|
228
|
+
}
|
|
229
|
+
async function toObjectEntry(entry) {
|
|
196
230
|
if (typeof entry === "string") entry = [entry];
|
|
197
|
-
if (Array.isArray(entry))
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
return [relative.slice(0, relative.length - path$2.extname(relative).length), file];
|
|
205
|
-
}));
|
|
206
|
-
} else throw new Error(`Cannot find entry: ${entry}`);
|
|
207
|
-
} else {
|
|
208
|
-
const files = Object.values(entry);
|
|
209
|
-
files.forEach((filename) => {
|
|
210
|
-
if (!fsExists(filename)) throw new Error(`Cannot find entry: ${filename}`);
|
|
211
|
-
});
|
|
212
|
-
logger.info(`entry: ${pc$1.blue(files.join(", "))}`);
|
|
213
|
-
}
|
|
214
|
-
return entry;
|
|
231
|
+
if (!Array.isArray(entry)) return entry;
|
|
232
|
+
const resolvedEntry = await glob(entry);
|
|
233
|
+
const base = lowestCommonAncestor(...resolvedEntry);
|
|
234
|
+
return Object.fromEntries(resolvedEntry.map((file) => {
|
|
235
|
+
const relative = path$2.relative(base, file);
|
|
236
|
+
return [relative.slice(0, relative.length - path$2.extname(relative).length), file];
|
|
237
|
+
}));
|
|
215
238
|
}
|
|
216
239
|
|
|
217
240
|
//#endregion
|
|
@@ -224,7 +247,7 @@ async function resolveOptions(options) {
|
|
|
224
247
|
...subConfig,
|
|
225
248
|
...options
|
|
226
249
|
};
|
|
227
|
-
let { entry, format = ["es"], plugins = [], clean = false, silent = false, treeshake = true, platform = "node", outDir = "dist", sourcemap = false, dts = false, unused = false, watch = false, shims = false, skipNodeModulesBundle = false } = subOptions;
|
|
250
|
+
let { entry, format = ["es"], plugins = [], clean = false, silent = false, treeshake = true, platform = "node", outDir = "dist", sourcemap = false, dts = false, bundleDts: bundleDts$1 = true, unused = false, watch = false, shims = false, skipNodeModulesBundle = false } = subOptions;
|
|
228
251
|
entry = await resolveEntry(entry);
|
|
229
252
|
if (clean === true) clean = [];
|
|
230
253
|
return {
|
|
@@ -238,7 +261,8 @@ async function resolveOptions(options) {
|
|
|
238
261
|
treeshake,
|
|
239
262
|
platform,
|
|
240
263
|
sourcemap,
|
|
241
|
-
dts,
|
|
264
|
+
dts: dts === true ? {} : dts,
|
|
265
|
+
bundleDts: bundleDts$1,
|
|
242
266
|
unused,
|
|
243
267
|
watch,
|
|
244
268
|
shims,
|
|
@@ -294,7 +318,8 @@ async function loadConfigFile(options) {
|
|
|
294
318
|
rewrite: (config$1) => config$1?.tsdown
|
|
295
319
|
}],
|
|
296
320
|
cwd,
|
|
297
|
-
defaults: {}
|
|
321
|
+
defaults: {},
|
|
322
|
+
importx: { loader: "bundle-require" }
|
|
298
323
|
});
|
|
299
324
|
if (sources.length > 0) logger.info(`Using tsdown config: ${pc.underline(sources.join(", "))}`);
|
|
300
325
|
const file = sources[0];
|
|
@@ -321,8 +346,8 @@ else debug("No config file found");
|
|
|
321
346
|
build(userOptions);
|
|
322
347
|
});
|
|
323
348
|
}
|
|
324
|
-
const dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
325
|
-
const pkgRoot = path.resolve(dirname, "..");
|
|
349
|
+
const dirname$1 = path.dirname(fileURLToPath(import.meta.url));
|
|
350
|
+
const pkgRoot = path.resolve(dirname$1, "..");
|
|
326
351
|
async function buildSingle(resolved) {
|
|
327
352
|
const { entry, external, plugins: userPlugins, outDir, format, clean, platform, alias, treeshake, sourcemap, dts, minify, watch, unused, target, define, shims, onSuccess } = resolved;
|
|
328
353
|
if (clean) await cleanOutDir(outDir, clean);
|
|
@@ -334,7 +359,10 @@ async function buildSingle(resolved) {
|
|
|
334
359
|
const plugins = [
|
|
335
360
|
pkg && ExternalPlugin(pkg, resolved.skipNodeModulesBundle),
|
|
336
361
|
unused && Unused.rolldown(unused === true ? {} : unused),
|
|
337
|
-
dts && IsolatedDecl.rolldown(
|
|
362
|
+
dts && IsolatedDecl.rolldown({
|
|
363
|
+
...dts,
|
|
364
|
+
extraOutdir: resolved.bundleDts ? TEMP_DTS_DIR : dts.extraOutdir
|
|
365
|
+
}),
|
|
338
366
|
target && transformPlugin({ target: target && (typeof target === "string" ? target : target.join(",")) }),
|
|
339
367
|
userPlugins
|
|
340
368
|
].filter((plugin) => !!plugin);
|
|
@@ -368,10 +396,11 @@ async function buildSingle(resolved) {
|
|
|
368
396
|
...outputOptions,
|
|
369
397
|
...userOutputOptions
|
|
370
398
|
};
|
|
371
|
-
await
|
|
399
|
+
await build$1({
|
|
372
400
|
...inputOptions,
|
|
373
401
|
output: outputOptions
|
|
374
402
|
});
|
|
403
|
+
if (resolved.dts && resolved.bundleDts) await bundleDts(resolved, extension);
|
|
375
404
|
}));
|
|
376
405
|
logger.success(`${first ? "Build" : "Rebuild"} complete in ${Math.round(performance.now() - startTime)}ms`);
|
|
377
406
|
await onSuccess?.();
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { PackageJson } from 'pkg-types';
|
|
2
|
+
import { Plugin, InputOptions } from 'rolldown';
|
|
3
|
+
|
|
4
|
+
type External = InputOptions["external"];
|
|
5
|
+
declare function ExternalPlugin(pkg: PackageJson, skipNodeModulesBundle?: boolean): Plugin;
|
|
6
|
+
|
|
7
|
+
export { type External as E, ExternalPlugin as a };
|
package/dist/plugins.d.ts
CHANGED
package/dist/run.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
export { }
|
package/dist/run.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { logger } from "./logger-Pk57TMWT.js";
|
|
2
2
|
import process from "node:process";
|
|
3
|
-
import { VERSION
|
|
3
|
+
import { VERSION } from "rolldown";
|
|
4
4
|
import pc from "picocolors";
|
|
5
5
|
import { cac } from "cac";
|
|
6
6
|
|
|
7
7
|
//#region package.json
|
|
8
|
-
var version = "0.
|
|
8
|
+
var version = "0.5.0";
|
|
9
9
|
|
|
10
10
|
//#endregion
|
|
11
11
|
//#region src/cli.ts
|
|
@@ -13,10 +13,10 @@ async function runCLI() {
|
|
|
13
13
|
const cli = cac("tsdown");
|
|
14
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("--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("-w, --watch [path]", "Watch mode").action(async (input, flags) => {
|
|
15
15
|
if (!("CONSOLA_LEVEL" in process.env)) logger.level = flags.silent ? 0 : 3;
|
|
16
|
-
logger.info(`tsdown ${pc.dim(`v${version}`)} powered by rolldown ${pc.dim(`v${
|
|
17
|
-
const { build } = await import("./index.js");
|
|
16
|
+
logger.info(`tsdown ${pc.dim(`v${version}`)} powered by rolldown ${pc.dim(`v${VERSION}`)}`);
|
|
17
|
+
const { build: build$1 } = await import("./index.js");
|
|
18
18
|
if (input.length > 0) flags.entry = input;
|
|
19
|
-
await build(flags);
|
|
19
|
+
await build$1(flags);
|
|
20
20
|
});
|
|
21
21
|
cli.help();
|
|
22
22
|
cli.version(version);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tsdown",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "An even faster bundler powered by Rolldown.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -43,23 +43,25 @@
|
|
|
43
43
|
"cac": "^6.7.14",
|
|
44
44
|
"chokidar": "^4.0.1",
|
|
45
45
|
"consola": "^3.2.3",
|
|
46
|
-
"debug": "^4.
|
|
46
|
+
"debug": "^4.4.0",
|
|
47
47
|
"picocolors": "^1.1.1",
|
|
48
48
|
"pkg-types": "^1.2.1",
|
|
49
|
-
"rolldown": "
|
|
49
|
+
"rolldown": "nightly",
|
|
50
|
+
"rollup": "^4.28.1",
|
|
51
|
+
"rollup-plugin-dts": "^6.1.1",
|
|
50
52
|
"tinyglobby": "^0.2.10",
|
|
51
53
|
"unconfig": "^0.6.0",
|
|
52
|
-
"unplugin-isolated-decl": "^0.
|
|
54
|
+
"unplugin-isolated-decl": "^0.10.0",
|
|
53
55
|
"unplugin-unused": "^0.2.3"
|
|
54
56
|
},
|
|
55
57
|
"devDependencies": {
|
|
56
58
|
"@sxzz/eslint-config": "^4.5.1",
|
|
57
59
|
"@sxzz/prettier-config": "^2.0.2",
|
|
60
|
+
"@sxzz/test-utils": "^0.3.11",
|
|
58
61
|
"@types/debug": "^4.1.12",
|
|
59
62
|
"@types/node": "^22.10.1",
|
|
60
|
-
"bumpp": "^9.
|
|
63
|
+
"bumpp": "^9.9.0",
|
|
61
64
|
"eslint": "^9.16.0",
|
|
62
|
-
"fdir": "^6.4.2",
|
|
63
65
|
"oxc-transform": "^0.39.0",
|
|
64
66
|
"prettier": "^3.4.2",
|
|
65
67
|
"tinyexec": "^0.3.1",
|
package/dist/cli.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function runCLI(): Promise<void>;
|
package/dist/features/clean.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function cleanOutDir(cwd: string, patterns: string[]): Promise<void>;
|
package/dist/features/entry.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { PackageJson } from "pkg-types";
|
|
2
|
-
import type { InputOptions, Plugin } from "rolldown";
|
|
3
|
-
export type External = InputOptions["external"];
|
|
4
|
-
export declare function ExternalPlugin(pkg: PackageJson, skipNodeModulesBundle?: boolean): Plugin;
|
|
5
|
-
export declare function getProductionDeps(pkg: PackageJson): Set<string>;
|
package/dist/features/shims.d.ts
DELETED
package/dist/features/watch.d.ts
DELETED
package/dist/options.d.ts
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import type { External } from "./features/external.js";
|
|
2
|
-
import type { Arrayable, MarkPartial, MaybePromise, Overwrite } from "./utils/types.js";
|
|
3
|
-
import type { InputOptions, InternalModuleFormat, ModuleFormat, OutputOptions } from "rolldown";
|
|
4
|
-
import type { Options as IsolatedDeclOptions } from "unplugin-isolated-decl";
|
|
5
|
-
import type { Options as UnusedOptions } from "unplugin-unused";
|
|
6
|
-
export type Sourcemap = boolean | "inline" | "hidden";
|
|
7
|
-
/**
|
|
8
|
-
* Options for tsdown.
|
|
9
|
-
*/
|
|
10
|
-
export interface Options {
|
|
11
|
-
entry?: InputOptions["input"];
|
|
12
|
-
format?: ModuleFormat | ModuleFormat[];
|
|
13
|
-
globalName?: string;
|
|
14
|
-
plugins?: InputOptions["plugins"];
|
|
15
|
-
external?: External;
|
|
16
|
-
outDir?: string;
|
|
17
|
-
clean?: boolean | string[];
|
|
18
|
-
silent?: boolean;
|
|
19
|
-
config?: boolean | string;
|
|
20
|
-
sourcemap?: Sourcemap;
|
|
21
|
-
alias?: Record<string, string>;
|
|
22
|
-
/** @default true */
|
|
23
|
-
treeshake?: boolean;
|
|
24
|
-
/** @default false */
|
|
25
|
-
minify?: boolean;
|
|
26
|
-
target?: string | string[];
|
|
27
|
-
define?: Record<string, string>;
|
|
28
|
-
/** @default 'node' */
|
|
29
|
-
platform?: "node" | "neutral" | "browser";
|
|
30
|
-
shims?: boolean;
|
|
31
|
-
/**
|
|
32
|
-
* Enable dts generation with `isolatedDeclarations` (experimental)
|
|
33
|
-
*/
|
|
34
|
-
dts?: boolean | IsolatedDeclOptions;
|
|
35
|
-
/**
|
|
36
|
-
* Enable unused dependencies check with `unplugin-unused` (experimental)
|
|
37
|
-
*/
|
|
38
|
-
unused?: boolean | UnusedOptions;
|
|
39
|
-
watch?: boolean | string | string[];
|
|
40
|
-
inputOptions?: InputOptions;
|
|
41
|
-
outputOptions?: OutputOptions | ((options: OutputOptions, format: ModuleFormat) => MaybePromise<OutputOptions | void | null>);
|
|
42
|
-
onSuccess?: () => void | Promise<void>;
|
|
43
|
-
/**
|
|
44
|
-
* Skip bundling node_modules.
|
|
45
|
-
*/
|
|
46
|
-
skipNodeModulesBundle?: boolean;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Options without specifying config file path.
|
|
50
|
-
*/
|
|
51
|
-
export type Config = Arrayable<Omit<Options, "config">>;
|
|
52
|
-
export type ResolvedConfig = Extract<Config, any[]>;
|
|
53
|
-
export type NormalizedFormat = Exclude<InternalModuleFormat, "app"> | "experimental-app";
|
|
54
|
-
export type ResolvedOptions = Omit<Overwrite<MarkPartial<Options, "globalName" | "inputOptions" | "outputOptions" | "minify" | "target" | "define" | "alias" | "external" | "onSuccess">, {
|
|
55
|
-
format: NormalizedFormat[];
|
|
56
|
-
clean: string[] | false;
|
|
57
|
-
}>, "config">;
|
|
58
|
-
export declare function resolveOptions(options: Options): Promise<[configs: ResolvedOptions[], configFile?: string]>;
|
|
59
|
-
export declare function normalizeFormat(format: ModuleFormat | ModuleFormat[]): NormalizedFormat[];
|
package/dist/utils/fs.d.ts
DELETED
package/dist/utils/general.d.ts
DELETED
package/dist/utils/logger.d.ts
DELETED
package/dist/utils/package.d.ts
DELETED
package/dist/utils/types.d.ts
DELETED