tsdown 0.11.5 → 0.11.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/{config-DQE4wDWb.d.ts → config-DwXF0PxK.d.ts} +1 -1
- package/dist/config.d.ts +2 -2
- package/dist/{options-BPeORY5t.d.ts → index-DSS5MGRw.d.ts} +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +97 -93
- package/dist/{migrate-BtPH5ywH.js → migrate-iRKeD4mW.js} +1 -1
- package/dist/package-DIqr7O5d.js +5 -0
- package/dist/plugins.d.ts +1 -1
- package/dist/run.js +2 -2
- package/package.json +10 -7
- package/dist/package-B9R2bt2m.js +0 -5
package/dist/config.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { UserConfig, UserConfigFn } from "./
|
|
2
|
-
import { defineConfig$1 as defineConfig } from "./config-
|
|
1
|
+
import { UserConfig, UserConfigFn } from "./index-DSS5MGRw.js";
|
|
2
|
+
import { defineConfig$1 as defineConfig } from "./config-DwXF0PxK.js";
|
|
3
3
|
export { UserConfig, UserConfigFn, defineConfig };
|
|
@@ -89,7 +89,7 @@ interface ReportOptions {
|
|
|
89
89
|
declare function ReportPlugin(options: ReportOptions, cwd: string, cjsDts?: boolean): Plugin;
|
|
90
90
|
|
|
91
91
|
//#endregion
|
|
92
|
-
//#region src/options.d.ts
|
|
92
|
+
//#region src/options/index.d.ts
|
|
93
93
|
type Sourcemap = boolean | "inline" | "hidden";
|
|
94
94
|
type Format = Exclude<ModuleFormat, "experimental-app">;
|
|
95
95
|
type NormalizedFormat = Exclude<InternalModuleFormat, "app">;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BuildContext, Options, ResolvedOptions, TsdownHooks, UserConfig, UserConfigFn } from "./
|
|
2
|
-
import { defineConfig$1 as defineConfig } from "./config-
|
|
1
|
+
import { BuildContext, Options, ResolvedOptions, TsdownHooks, UserConfig, UserConfigFn } from "./index-DSS5MGRw.js";
|
|
2
|
+
import { defineConfig$1 as defineConfig } from "./config-DwXF0PxK.js";
|
|
3
3
|
|
|
4
4
|
//#region src/utils/logger.d.ts
|
|
5
5
|
declare class Logger {
|
package/dist/index.js
CHANGED
|
@@ -13,9 +13,9 @@ import { exec } from "tinyexec";
|
|
|
13
13
|
import { glob } from "tinyglobby";
|
|
14
14
|
import { createHooks } from "hookable";
|
|
15
15
|
import readline from "node:readline";
|
|
16
|
-
import { loadConfig } from "unconfig";
|
|
17
16
|
import minVersion from "semver/ranges/min-version.js";
|
|
18
17
|
import { up } from "empathic/find";
|
|
18
|
+
import { loadConfig } from "unconfig";
|
|
19
19
|
|
|
20
20
|
//#region src/features/clean.ts
|
|
21
21
|
const debug$3 = Debug("tsdown:clean");
|
|
@@ -367,73 +367,33 @@ async function resolveTsconfig(tsconfig, cwd) {
|
|
|
367
367
|
}
|
|
368
368
|
|
|
369
369
|
//#endregion
|
|
370
|
-
//#region src/options.ts
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
if (viteUserConfig) {
|
|
398
|
-
if (Array.isArray(alias)) throw new TypeError("Unsupported resolve.alias in Vite config. Use object instead of array");
|
|
399
|
-
if (viteUserConfig.plugins) plugins = [viteUserConfig.plugins, plugins];
|
|
400
|
-
const viteAlias = viteUserConfig.resolve?.alias;
|
|
401
|
-
if (viteAlias && !Array.isArray(viteAlias)) alias = viteAlias;
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
const config = {
|
|
405
|
-
...subOptions,
|
|
406
|
-
entry,
|
|
407
|
-
plugins,
|
|
408
|
-
format: normalizeFormat(format),
|
|
409
|
-
target,
|
|
410
|
-
outDir,
|
|
411
|
-
clean,
|
|
412
|
-
silent,
|
|
413
|
-
treeshake,
|
|
414
|
-
platform,
|
|
415
|
-
sourcemap,
|
|
416
|
-
dts: dts === true ? {} : dts,
|
|
417
|
-
report: report === true ? {} : report,
|
|
418
|
-
unused,
|
|
419
|
-
watch,
|
|
420
|
-
shims,
|
|
421
|
-
skipNodeModulesBundle,
|
|
422
|
-
publint: publint$1,
|
|
423
|
-
alias,
|
|
424
|
-
tsconfig,
|
|
425
|
-
cwd,
|
|
426
|
-
env,
|
|
427
|
-
pkg,
|
|
428
|
-
copy: publicDir || copy$1,
|
|
429
|
-
hash: hash ?? true
|
|
430
|
-
};
|
|
431
|
-
return config;
|
|
432
|
-
}));
|
|
433
|
-
return {
|
|
434
|
-
configs,
|
|
435
|
-
file
|
|
436
|
-
};
|
|
370
|
+
//#region src/options/config.ts
|
|
371
|
+
async function loadViteConfig(prefix, cwd) {
|
|
372
|
+
const { config, sources: [source] } = await loadConfig({
|
|
373
|
+
sources: [{
|
|
374
|
+
files: `${prefix}.config`,
|
|
375
|
+
extensions: [
|
|
376
|
+
"ts",
|
|
377
|
+
"mts",
|
|
378
|
+
"cts",
|
|
379
|
+
"js",
|
|
380
|
+
"mjs",
|
|
381
|
+
"cjs",
|
|
382
|
+
"json",
|
|
383
|
+
""
|
|
384
|
+
]
|
|
385
|
+
}],
|
|
386
|
+
cwd,
|
|
387
|
+
defaults: {}
|
|
388
|
+
});
|
|
389
|
+
if (!source) return;
|
|
390
|
+
logger.info(`Using Vite config: ${underline(source)}`);
|
|
391
|
+
const resolved = await config;
|
|
392
|
+
if (typeof resolved === "function") return resolved({
|
|
393
|
+
command: "build",
|
|
394
|
+
mode: "production"
|
|
395
|
+
});
|
|
396
|
+
return resolved;
|
|
437
397
|
}
|
|
438
398
|
let loaded = false;
|
|
439
399
|
async function loadConfigFile(options) {
|
|
@@ -490,32 +450,76 @@ async function loadConfigFile(options) {
|
|
|
490
450
|
file
|
|
491
451
|
};
|
|
492
452
|
}
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
453
|
+
|
|
454
|
+
//#endregion
|
|
455
|
+
//#region src/options/index.ts
|
|
456
|
+
const debug$1 = Debug("tsdown:options");
|
|
457
|
+
async function resolveOptions(options) {
|
|
458
|
+
const { configs: userConfigs, file } = await loadConfigFile(options);
|
|
459
|
+
if (userConfigs.length === 0) userConfigs.push({});
|
|
460
|
+
if (file) {
|
|
461
|
+
debug$1("Loaded config file %s", file);
|
|
462
|
+
debug$1("User configs %o", userConfigs);
|
|
463
|
+
}
|
|
464
|
+
const configs = await Promise.all(userConfigs.map((userConfig) => resolveConfig(userConfig, options)));
|
|
465
|
+
return {
|
|
466
|
+
configs,
|
|
467
|
+
file
|
|
468
|
+
};
|
|
469
|
+
}
|
|
470
|
+
async function resolveConfig(userConfig, overrides) {
|
|
471
|
+
const subOptions = {
|
|
472
|
+
...userConfig,
|
|
473
|
+
...overrides
|
|
474
|
+
};
|
|
475
|
+
let { entry, format = ["es"], plugins = [], clean = true, silent = false, treeshake = true, platform = "node", outDir = "dist", sourcemap = false, dts, unused = false, watch = false, shims = false, skipNodeModulesBundle = false, publint: publint$1 = false, fromVite, alias, tsconfig, report = true, target, env = {}, copy: copy$1, publicDir, hash, cwd = process.cwd() } = subOptions;
|
|
476
|
+
outDir = path.resolve(cwd, outDir);
|
|
477
|
+
clean = resolveClean(clean, outDir, cwd);
|
|
478
|
+
const pkg = await readPackageJson(cwd);
|
|
479
|
+
entry = await resolveEntry(entry, cwd);
|
|
480
|
+
if (dts == null) dts = !!(pkg?.types || pkg?.typings);
|
|
481
|
+
target = resolveTarget(target, pkg);
|
|
482
|
+
tsconfig = await resolveTsconfig(tsconfig, cwd);
|
|
483
|
+
if (publint$1 === true) publint$1 = {};
|
|
484
|
+
if (publicDir) if (copy$1) throw new TypeError("`publicDir` is deprecated. Cannot be used with `copy`");
|
|
485
|
+
else logger.warn(`${blue`publicDir`} is deprecated. Use ${blue`copy`} instead.`);
|
|
486
|
+
if (fromVite) {
|
|
487
|
+
const viteUserConfig = await loadViteConfig(fromVite === true ? "vite" : fromVite, cwd);
|
|
488
|
+
if (viteUserConfig) {
|
|
489
|
+
if (Array.isArray(alias)) throw new TypeError("Unsupported resolve.alias in Vite config. Use object instead of array");
|
|
490
|
+
if (viteUserConfig.plugins) plugins = [viteUserConfig.plugins, plugins];
|
|
491
|
+
const viteAlias = viteUserConfig.resolve?.alias;
|
|
492
|
+
if (viteAlias && !Array.isArray(viteAlias)) alias = viteAlias;
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
const config = {
|
|
496
|
+
...subOptions,
|
|
497
|
+
entry,
|
|
498
|
+
plugins,
|
|
499
|
+
format: normalizeFormat(format),
|
|
500
|
+
target,
|
|
501
|
+
outDir,
|
|
502
|
+
clean,
|
|
503
|
+
silent,
|
|
504
|
+
treeshake,
|
|
505
|
+
platform,
|
|
506
|
+
sourcemap,
|
|
507
|
+
dts: dts === true ? {} : dts,
|
|
508
|
+
report: report === true ? {} : report,
|
|
509
|
+
unused,
|
|
510
|
+
watch,
|
|
511
|
+
shims,
|
|
512
|
+
skipNodeModulesBundle,
|
|
513
|
+
publint: publint$1,
|
|
514
|
+
alias,
|
|
515
|
+
tsconfig,
|
|
508
516
|
cwd,
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
command: "build",
|
|
516
|
-
mode: "production"
|
|
517
|
-
});
|
|
518
|
-
return resolved;
|
|
517
|
+
env,
|
|
518
|
+
pkg,
|
|
519
|
+
copy: publicDir || copy$1,
|
|
520
|
+
hash: hash ?? true
|
|
521
|
+
};
|
|
522
|
+
return config;
|
|
519
523
|
}
|
|
520
524
|
async function mergeUserOptions(defaults, user, args) {
|
|
521
525
|
const userOutputOptions = typeof user === "function" ? await user(defaults, ...args) : user;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { logger } from "./logger-DYeY_1KP.js";
|
|
2
|
-
import { version } from "./package-
|
|
2
|
+
import { version } from "./package-DIqr7O5d.js";
|
|
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";
|
package/dist/plugins.d.ts
CHANGED
package/dist/run.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { resolveComma, toArray } from "./general-CPYs4M61.js";
|
|
3
3
|
import { logger } from "./logger-DYeY_1KP.js";
|
|
4
|
-
import { version } from "./package-
|
|
4
|
+
import { version } from "./package-DIqr7O5d.js";
|
|
5
5
|
import module from "node:module";
|
|
6
6
|
import process from "node:process";
|
|
7
7
|
import { dim } from "ansis";
|
|
@@ -20,7 +20,7 @@ cli.command("[...files]", "Bundle files", { ignoreOptionDefaultValue: true }).op
|
|
|
20
20
|
await build$1(flags);
|
|
21
21
|
});
|
|
22
22
|
cli.command("migrate", "Migrate from tsup to tsdown").option("-c, --cwd <dir>", "Working directory").option("-d, --dry-run", "Dry run").action(async (args) => {
|
|
23
|
-
const { migrate } = await import("./migrate-
|
|
23
|
+
const { migrate } = await import("./migrate-iRKeD4mW.js");
|
|
24
24
|
await migrate(args);
|
|
25
25
|
});
|
|
26
26
|
async function runCLI() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tsdown",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.7",
|
|
4
4
|
"description": "The Elegant Bundler for Libraries",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"publint": "^0.3.0",
|
|
46
|
+
"typescript": "^5.0.0",
|
|
46
47
|
"unplugin-lightningcss": "^0.4.0",
|
|
47
48
|
"unplugin-unused": "^0.5.0"
|
|
48
49
|
},
|
|
@@ -50,6 +51,9 @@
|
|
|
50
51
|
"publint": {
|
|
51
52
|
"optional": true
|
|
52
53
|
},
|
|
54
|
+
"typescript": {
|
|
55
|
+
"optional": true
|
|
56
|
+
},
|
|
53
57
|
"unplugin-lightningcss": {
|
|
54
58
|
"optional": true
|
|
55
59
|
},
|
|
@@ -62,12 +66,12 @@
|
|
|
62
66
|
"cac": "^6.7.14",
|
|
63
67
|
"chokidar": "^4.0.3",
|
|
64
68
|
"debug": "^4.4.0",
|
|
65
|
-
"diff": "^
|
|
69
|
+
"diff": "^8.0.0",
|
|
66
70
|
"empathic": "^1.1.0",
|
|
67
71
|
"hookable": "^5.5.3",
|
|
68
|
-
"rolldown": "1.0.0-beta.8-commit.
|
|
69
|
-
"rolldown-plugin-dts": "^0.12.
|
|
70
|
-
"semver": "^7.7.
|
|
72
|
+
"rolldown": "1.0.0-beta.8-commit.d95f99e",
|
|
73
|
+
"rolldown-plugin-dts": "^0.12.1",
|
|
74
|
+
"semver": "^7.7.2",
|
|
71
75
|
"tinyexec": "^1.0.1",
|
|
72
76
|
"tinyglobby": "^0.2.13",
|
|
73
77
|
"unconfig": "^7.3.2"
|
|
@@ -78,7 +82,6 @@
|
|
|
78
82
|
"@sxzz/prettier-config": "^2.2.1",
|
|
79
83
|
"@sxzz/test-utils": "^0.5.6",
|
|
80
84
|
"@types/debug": "^4.1.12",
|
|
81
|
-
"@types/diff": "^7.0.2",
|
|
82
85
|
"@types/node": "^22.15.17",
|
|
83
86
|
"@types/semver": "^7.7.0",
|
|
84
87
|
"@unocss/eslint-plugin": "^66.1.1",
|
|
@@ -98,7 +101,7 @@
|
|
|
98
101
|
"vite": "^6.3.5",
|
|
99
102
|
"vitepress": "^1.6.3",
|
|
100
103
|
"vitepress-plugin-group-icons": "^1.5.2",
|
|
101
|
-
"vitepress-plugin-llms": "^1.1.
|
|
104
|
+
"vitepress-plugin-llms": "^1.1.4",
|
|
102
105
|
"vitest": "^3.1.3",
|
|
103
106
|
"vue": "^3.5.13"
|
|
104
107
|
},
|