tsdown 0.18.3 → 0.19.0-beta.1
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-FSGZ1pUf.d.mts +16 -0
- package/dist/config-qNEP9juZ.mjs +811 -0
- package/dist/config.d.mts +3 -13
- package/dist/config.mjs +3 -2
- package/dist/{index-BuAkqPeD.d.mts → index-CIxE8YXE.d.mts} +47 -9
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +4 -4
- package/dist/{package-deaowsxO.mjs → logger-D_2uXZBG.mjs} +12 -8
- package/dist/package-qmfxt6gc.mjs +5 -0
- package/dist/plugins.d.mts +1 -1
- package/dist/plugins.mjs +3 -2
- package/dist/run.mjs +13 -12
- package/dist/{src-D06o_Qq1.mjs → src-BjKgxr08.mjs} +31 -688
- package/package.json +9 -10
- package/dist/config-DLSWqKoz.mjs +0 -7
package/dist/config.d.mts
CHANGED
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Defines the configuration for tsdown.
|
|
7
|
-
*/
|
|
8
|
-
declare function defineConfig(options: UserConfig): UserConfig;
|
|
9
|
-
declare function defineConfig(options: UserConfig[]): UserConfig[];
|
|
10
|
-
declare function defineConfig(options: UserConfigFn): UserConfigFn;
|
|
11
|
-
declare function defineConfig(options: UserConfigExport): UserConfigExport;
|
|
12
|
-
//#endregion
|
|
13
|
-
export { type UserConfig, type UserConfigExport, type UserConfigFn, defineConfig };
|
|
1
|
+
import { f as UserConfig, m as UserConfigFn, p as UserConfigExport } from "./index-CIxE8YXE.mjs";
|
|
2
|
+
import { n as mergeConfig, t as defineConfig } from "./config-FSGZ1pUf.mjs";
|
|
3
|
+
export { UserConfig, UserConfigExport, UserConfigFn, defineConfig, mergeConfig };
|
package/dist/config.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import { Hookable } from "hookable";
|
|
|
4
4
|
import { Options as DtsOptions } from "rolldown-plugin-dts";
|
|
5
5
|
import { StartOptions } from "@vitejs/devtools/cli-commands";
|
|
6
6
|
import { CheckPackageOptions } from "@arethetypeswrong/core";
|
|
7
|
-
import { Options
|
|
7
|
+
import { Options } from "publint";
|
|
8
8
|
import { Options as UnusedOptions } from "unplugin-unused";
|
|
9
9
|
|
|
10
10
|
//#region src/utils/types.d.ts
|
|
@@ -43,14 +43,30 @@ interface CopyEntry {
|
|
|
43
43
|
type CopyOptions = Arrayable<string | CopyEntry>;
|
|
44
44
|
type CopyOptionsFn = (options: ResolvedConfig) => Awaitable<CopyOptions>;
|
|
45
45
|
//#endregion
|
|
46
|
-
//#region src/features/
|
|
47
|
-
interface
|
|
46
|
+
//#region src/features/css.d.ts
|
|
47
|
+
interface CssOptions {
|
|
48
|
+
/**
|
|
49
|
+
* Enable/disable CSS code splitting.
|
|
50
|
+
* When set to `false`, all CSS in the entire project will be extracted into a single CSS file.
|
|
51
|
+
* When set to `true`, CSS imported in async JS chunks will be preserved as chunks.
|
|
52
|
+
* @default true
|
|
53
|
+
*/
|
|
54
|
+
splitting?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Specify the name of the CSS file.
|
|
57
|
+
* @default 'style.css'
|
|
58
|
+
*/
|
|
59
|
+
fileName?: string;
|
|
60
|
+
}
|
|
61
|
+
//#endregion
|
|
62
|
+
//#region src/features/devtools.d.ts
|
|
63
|
+
interface DevtoolsOptions extends NonNullable<InputOptions["devtools"]> {
|
|
48
64
|
/**
|
|
49
65
|
* **[experimental]** Enable devtools integration. `@vitejs/devtools` must be installed as a dependency.
|
|
50
66
|
*
|
|
51
67
|
* Defaults to true, if `@vitejs/devtools` is installed.
|
|
52
68
|
*/
|
|
53
|
-
|
|
69
|
+
ui?: boolean | Partial<StartOptions>;
|
|
54
70
|
/**
|
|
55
71
|
* Clean devtools stale sessions.
|
|
56
72
|
*
|
|
@@ -491,6 +507,11 @@ interface ExportsOptions {
|
|
|
491
507
|
*/
|
|
492
508
|
devExports?: boolean | string;
|
|
493
509
|
/**
|
|
510
|
+
* Exports for package.json file.
|
|
511
|
+
* @default true
|
|
512
|
+
*/
|
|
513
|
+
packageJson?: boolean;
|
|
514
|
+
/**
|
|
494
515
|
* Exports for all files.
|
|
495
516
|
*/
|
|
496
517
|
all?: boolean;
|
|
@@ -505,6 +526,15 @@ interface ExportsOptions {
|
|
|
505
526
|
* ```
|
|
506
527
|
*/
|
|
507
528
|
exclude?: (RegExp | string)[];
|
|
529
|
+
/**
|
|
530
|
+
* Generate legacy fields (`main` and `module`) for older Node.js and bundlers
|
|
531
|
+
* that do not support package `exports` field.
|
|
532
|
+
*
|
|
533
|
+
* Defaults to false, if only ESM builds are included, true otherwise.
|
|
534
|
+
*
|
|
535
|
+
* @see {@link https://github.com/publint/publint/issues/24}
|
|
536
|
+
*/
|
|
537
|
+
legacy?: boolean;
|
|
508
538
|
customExports?: (exports: Record<string, any>, context: {
|
|
509
539
|
pkg: PackageJson;
|
|
510
540
|
chunks: ChunksByFormat;
|
|
@@ -512,6 +542,9 @@ interface ExportsOptions {
|
|
|
512
542
|
}) => Awaitable<Record<string, any>>;
|
|
513
543
|
}
|
|
514
544
|
//#endregion
|
|
545
|
+
//#region src/features/pkg/publint.d.ts
|
|
546
|
+
interface PublintOptions extends Options {}
|
|
547
|
+
//#endregion
|
|
515
548
|
//#region src/utils/logger.d.ts
|
|
516
549
|
type LogType = "error" | "warn" | "info";
|
|
517
550
|
type LogLevel = LogType | "silent";
|
|
@@ -861,15 +894,15 @@ interface UserConfig {
|
|
|
861
894
|
*/
|
|
862
895
|
ignoreWatch?: Arrayable<string | RegExp>;
|
|
863
896
|
/**
|
|
864
|
-
* **[experimental]** Enable
|
|
897
|
+
* **[experimental]** Enable devtools.
|
|
865
898
|
*
|
|
866
|
-
*
|
|
899
|
+
*DevTools is still under development, and this is for early testers only.
|
|
867
900
|
*
|
|
868
901
|
* This may slow down the build process significantly.
|
|
869
902
|
*
|
|
870
903
|
* @default false
|
|
871
904
|
*/
|
|
872
|
-
|
|
905
|
+
devtools?: WithEnabled<DevtoolsOptions>;
|
|
873
906
|
/**
|
|
874
907
|
* You can specify command to be executed after a successful build, specially useful for Watch mode
|
|
875
908
|
*/
|
|
@@ -921,6 +954,10 @@ interface UserConfig {
|
|
|
921
954
|
*/
|
|
922
955
|
exports?: WithEnabled<ExportsOptions>;
|
|
923
956
|
/**
|
|
957
|
+
* **[experimental]** CSS options.
|
|
958
|
+
*/
|
|
959
|
+
css?: CssOptions;
|
|
960
|
+
/**
|
|
924
961
|
* @deprecated Alias for `copy`, will be removed in the future.
|
|
925
962
|
*/
|
|
926
963
|
publicDir?: CopyOptions | CopyOptionsFn;
|
|
@@ -977,14 +1014,15 @@ type ResolvedConfig = Overwrite<MarkPartial<Omit<UserConfig, "workspace" | "from
|
|
|
977
1014
|
ignoreWatch: Array<string | RegExp>;
|
|
978
1015
|
noExternal?: NoExternalFn;
|
|
979
1016
|
inlineOnly?: Array<string | RegExp>;
|
|
1017
|
+
css: Required<CssOptions>;
|
|
980
1018
|
dts: false | DtsOptions;
|
|
981
1019
|
report: false | ReportOptions;
|
|
982
1020
|
tsconfig: false | string;
|
|
983
1021
|
exports: false | ExportsOptions;
|
|
984
|
-
|
|
1022
|
+
devtools: false | DevtoolsOptions;
|
|
985
1023
|
publint: false | PublintOptions;
|
|
986
1024
|
attw: false | AttwOptions;
|
|
987
1025
|
unused: false | UnusedOptions;
|
|
988
1026
|
}>;
|
|
989
1027
|
//#endregion
|
|
990
|
-
export { OutExtensionFactory as A,
|
|
1028
|
+
export { OutExtensionFactory as A, CopyOptions as B, RolldownChunk as C, ChunkAddonFunction as D, ChunkAddon as E, RolldownContext as F, TsdownHooks as I, DevtoolsOptions as L, PackageJsonWithPath as M, PackageType as N, ChunkAddonObject as O, BuildContext as P, CssOptions as R, ExportsOptions as S, AttwOptions as T, CopyOptionsFn as V, ReportOptions as _, NoExternalFn as a, globalLogger as b, Sourcemap as c, UnusedOptions as d, UserConfig as f, Workspace as g, WithEnabled as h, InlineConfig as i, OutExtensionObject as j, OutExtensionContext as k, TreeshakingOptions as l, UserConfigFn as m, DtsOptions as n, NormalizedFormat as o, UserConfigExport as p, Format as r, ResolvedConfig as s, CIOption as t, TsdownInputOption as u, ReportPlugin as v, TsdownBundle as w, PublintOptions as x, Logger as y, CopyEntry as z };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as OutExtensionFactory, B as
|
|
2
|
-
import { defineConfig } from "./config.mjs";
|
|
1
|
+
import { A as OutExtensionFactory, B as CopyOptions, C as RolldownChunk, D as ChunkAddonFunction, E as ChunkAddon, F as RolldownContext, I as TsdownHooks, L as DevtoolsOptions, M as PackageJsonWithPath, N as PackageType, O as ChunkAddonObject, P as BuildContext, R as CssOptions, S as ExportsOptions, T as AttwOptions, V as CopyOptionsFn, _ as ReportOptions, a as NoExternalFn, b as globalLogger, c as Sourcemap, d as UnusedOptions, f as UserConfig, g as Workspace, h as WithEnabled, i as InlineConfig, j as OutExtensionObject, k as OutExtensionContext, l as TreeshakingOptions, m as UserConfigFn, n as DtsOptions, o as NormalizedFormat, p as UserConfigExport, r as Format, s as ResolvedConfig, t as CIOption, u as TsdownInputOption, w as TsdownBundle, x as PublintOptions, y as Logger, z as CopyEntry } from "./index-CIxE8YXE.mjs";
|
|
2
|
+
import { n as mergeConfig, t as defineConfig } from "./config-FSGZ1pUf.mjs";
|
|
3
3
|
import * as Rolldown from "rolldown";
|
|
4
4
|
|
|
5
5
|
//#region src/index.d.ts
|
|
@@ -8,4 +8,4 @@ import * as Rolldown from "rolldown";
|
|
|
8
8
|
*/
|
|
9
9
|
declare function build(userOptions?: InlineConfig): Promise<TsdownBundle[]>;
|
|
10
10
|
//#endregion
|
|
11
|
-
export { AttwOptions, BuildContext, CIOption, ChunkAddon, ChunkAddonFunction, ChunkAddonObject, CopyEntry, CopyOptions, CopyOptionsFn,
|
|
11
|
+
export { AttwOptions, BuildContext, CIOption, ChunkAddon, ChunkAddonFunction, ChunkAddonObject, CopyEntry, CopyOptions, CopyOptionsFn, CssOptions, DevtoolsOptions, DtsOptions, ExportsOptions, Format, InlineConfig, type Logger, NoExternalFn, NormalizedFormat, OutExtensionContext, OutExtensionFactory, OutExtensionObject, PackageJsonWithPath, PackageType, PublintOptions, ReportOptions, ResolvedConfig, Rolldown, RolldownChunk, RolldownContext, Sourcemap, TreeshakingOptions, TsdownBundle, TsdownHooks, TsdownInputOption, UnusedOptions, UserConfig, UserConfigExport, UserConfigFn, WithEnabled, Workspace, build, defineConfig, globalLogger, mergeConfig };
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { a as globalLogger } from "./logger-D_2uXZBG.mjs";
|
|
2
|
+
import { n as mergeConfig, t as defineConfig } from "./config-qNEP9juZ.mjs";
|
|
3
|
+
import { i as shimFile, n as build, r as buildSingle, t as Rolldown } from "./src-BjKgxr08.mjs";
|
|
4
4
|
|
|
5
|
-
export { Rolldown, build, buildSingle, defineConfig, globalLogger, shimFile };
|
|
5
|
+
export { Rolldown, build, buildSingle, defineConfig, globalLogger, mergeConfig, shimFile };
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { createRequire as __cjs_createRequire } from "node:module";
|
|
2
2
|
const __cjs_require = __cjs_createRequire(import.meta.url);
|
|
3
|
-
import {
|
|
3
|
+
import { createRequire } from "node:module";
|
|
4
4
|
import process from "node:process";
|
|
5
|
+
import { bgRed, bgYellow, blue, green, rgb, yellow } from "ansis";
|
|
6
|
+
import { pathToFileURL } from "node:url";
|
|
5
7
|
const picomatch = __cjs_require("picomatch");
|
|
6
8
|
|
|
9
|
+
//#region rolldown:runtime
|
|
10
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
7
13
|
//#region src/utils/general.ts
|
|
8
14
|
function toArray(val, defaultValue) {
|
|
9
15
|
if (Array.isArray(val)) return val;
|
|
@@ -39,9 +45,11 @@ function pkgExists(moduleName) {
|
|
|
39
45
|
} catch {}
|
|
40
46
|
return false;
|
|
41
47
|
}
|
|
42
|
-
async function importWithError(moduleName) {
|
|
48
|
+
async function importWithError(moduleName, resolvePaths) {
|
|
49
|
+
let resolved;
|
|
50
|
+
if (resolvePaths) resolved = pathToFileURL(__require.resolve(moduleName, { paths: resolvePaths })).href;
|
|
43
51
|
try {
|
|
44
|
-
return await import(moduleName);
|
|
52
|
+
return await import(resolved || moduleName);
|
|
45
53
|
} catch (error) {
|
|
46
54
|
throw new Error(`Failed to import module "${moduleName}". Please ensure it is installed.`, { cause: error });
|
|
47
55
|
}
|
|
@@ -163,8 +171,4 @@ function hue2rgb(p, q, t) {
|
|
|
163
171
|
}
|
|
164
172
|
|
|
165
173
|
//#endregion
|
|
166
|
-
|
|
167
|
-
var version = "0.18.3";
|
|
168
|
-
|
|
169
|
-
//#endregion
|
|
170
|
-
export { getNameLabel as a, importWithError as c, pkgExists as d, promiseWithResolvers as f, toArray as g, slash as h, generateColor as i, matchPattern as l, resolveRegex as m, LogLevels as n, globalLogger as o, resolveComma as p, createLogger as r, prettyFormat as s, version as t, noop as u };
|
|
174
|
+
export { globalLogger as a, matchPattern as c, promiseWithResolvers as d, resolveComma as f, toArray as h, getNameLabel as i, noop as l, slash as m, createLogger as n, prettyFormat as o, resolveRegex as p, generateColor as r, importWithError as s, LogLevels as t, pkgExists as u };
|
package/dist/plugins.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { s as ResolvedConfig, v as ReportPlugin, w as TsdownBundle, y as Logger } from "./index-CIxE8YXE.mjs";
|
|
2
2
|
import { Plugin } from "rolldown";
|
|
3
3
|
|
|
4
4
|
//#region src/features/external.d.ts
|
package/dist/plugins.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import "./
|
|
1
|
+
import "./logger-D_2uXZBG.mjs";
|
|
2
|
+
import "./config-qNEP9juZ.mjs";
|
|
3
|
+
import { a as WatchPlugin, c as NodeProtocolPlugin, l as ExternalPlugin, o as ShebangPlugin, s as ReportPlugin } from "./src-BjKgxr08.mjs";
|
|
3
4
|
|
|
4
5
|
export { ExternalPlugin, NodeProtocolPlugin, ReportPlugin, ShebangPlugin, WatchPlugin };
|
package/dist/run.mjs
CHANGED
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
2
|
+
import { a as globalLogger, f as resolveComma, h as toArray } from "./logger-D_2uXZBG.mjs";
|
|
3
|
+
import { t as version } from "./package-qmfxt6gc.mjs";
|
|
3
4
|
import module from "node:module";
|
|
5
|
+
import process from "node:process";
|
|
4
6
|
import { dim } from "ansis";
|
|
5
|
-
import { VERSION } from "rolldown";
|
|
6
7
|
import { createDebug, enable, namespaces } from "obug";
|
|
7
|
-
import
|
|
8
|
+
import { VERSION } from "rolldown";
|
|
8
9
|
import { x } from "tinyexec";
|
|
9
10
|
import { cac } from "cac";
|
|
10
11
|
|
|
11
12
|
//#region src/features/debug.ts
|
|
12
|
-
const
|
|
13
|
-
function
|
|
14
|
-
const {
|
|
15
|
-
if (!
|
|
13
|
+
const debugLog = createDebug("tsdown:debug");
|
|
14
|
+
function enableDebug(cliOptions) {
|
|
15
|
+
const { debug } = cliOptions;
|
|
16
|
+
if (!debug) return;
|
|
16
17
|
let namespace;
|
|
17
|
-
if (
|
|
18
|
-
else namespace = resolveComma(toArray(
|
|
18
|
+
if (debug === true) namespace = "tsdown:*";
|
|
19
|
+
else namespace = resolveComma(toArray(debug)).map((v) => `tsdown:${v}`).join(",");
|
|
19
20
|
const ns = namespaces();
|
|
20
21
|
if (ns) namespace += `,${ns}`;
|
|
21
22
|
enable(namespace);
|
|
22
|
-
|
|
23
|
+
debugLog("Debugging enabled", namespace);
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
//#endregion
|
|
@@ -29,7 +30,7 @@ cli.help().version(version);
|
|
|
29
30
|
cli.command("[...files]", "Bundle files", {
|
|
30
31
|
ignoreOptionDefaultValue: true,
|
|
31
32
|
allowUnknownOptions: true
|
|
32
|
-
}).option("-c, --config <filename>", "Use a custom config file").option("--config-loader <loader>", "Config loader to use: auto, native, unrun", { default: "auto" }).option("--no-config", "Disable config file").option("-f, --format <format>", "Bundle format: esm, cjs, iife, umd", { default: "esm" }).option("--clean", "Clean output directory, --no-clean to disable").option("--external <module>", "Mark dependencies as external").option("--minify", "Minify output").option("--
|
|
33
|
+
}).option("-c, --config <filename>", "Use a custom config file").option("--config-loader <loader>", "Config loader to use: auto, native, unrun", { default: "auto" }).option("--no-config", "Disable config file").option("-f, --format <format>", "Bundle format: esm, cjs, iife, umd", { default: "esm" }).option("--clean", "Clean output directory, --no-clean to disable").option("--external <module>", "Mark dependencies as external").option("--minify", "Minify output").option("--devtools", "Enable devtools integration").option("--debug [feat]", "Show debug logs").option("--target <target>", "Bundle target, e.g \"es2015\", \"esnext\"").option("-l, --logLevel <level>", "Set log level: info, warn, error, silent").option("--fail-on-warn", "Fail on warnings", { default: true }).option("--no-write", "Disable writing files to disk, incompatible with watch mode").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("--attw", "Enable Are the types wrong integration", { default: false }).option("--unused", "Enable unused dependencies check", { default: false }).option("-w, --watch [path]", "Watch mode").option("--ignore-watch <path>", "Ignore custom paths in 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("--env-file <file>", "Load environment variables from a file, when used together with --env, variables in --env take precedence").option("--env-prefix <prefix>", "Prefix for env variables to inject into the bundle", { default: "TSDOWN_" }).option("--on-success <command>", "Command to run on success").option("--copy <dir>", "Copy files to output dir").option("--public-dir <dir>", "Alias for --copy, deprecated").option("--tsconfig <tsconfig>", "Set tsconfig path").option("--unbundle", "Unbundle mode").option("-W, --workspace [dir]", "Enable workspace mode").option("-F, --filter <pattern>", "Filter configs (cwd or name), e.g. /pkg-name$/ or pkg-name").option("--exports", "Generate export-related metadata for package.json (experimental)").action(async (input, flags) => {
|
|
33
34
|
globalLogger.level = flags.logLevel || (flags.silent ? "error" : "info");
|
|
34
35
|
globalLogger.info(`tsdown ${dim`v${version}`} powered by rolldown ${dim`v${VERSION}`}`);
|
|
35
36
|
const { build: build$1 } = await import("./index.mjs");
|
|
@@ -56,7 +57,7 @@ cli.command("migrate", "[deprecated] Migrate from tsup to tsdown. Use \"npx tsdo
|
|
|
56
57
|
});
|
|
57
58
|
async function runCLI() {
|
|
58
59
|
cli.parse(process.argv, { run: false });
|
|
59
|
-
|
|
60
|
+
enableDebug(cli.options);
|
|
60
61
|
try {
|
|
61
62
|
await cli.runMatchedCommand();
|
|
62
63
|
} catch (error) {
|