tsdown 0.21.5 → 0.21.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/{build-DpU0PBVv.mjs → build-DU-BFLB1.mjs} +57 -24
- package/dist/{config-DR_xLSbh.d.mts → config-BJiwtsMo.d.mts} +3 -3
- package/dist/config.d.mts +2 -2
- package/dist/config.mjs +1 -1
- package/dist/{debug-C4FmgzkJ.mjs → debug-BmAPbhgA.mjs} +1 -1
- package/dist/{format-CzYq8yvJ.mjs → format-_3CEX8E7.mjs} +6 -3
- package/dist/{general-CRszZCrY.mjs → general-D3muxt2f.mjs} +3 -11
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +4 -4
- package/dist/internal.d.mts +2 -2
- package/dist/internal.mjs +1 -1
- package/dist/{logger-BU0v7CAk.mjs → logger-uV8l1UFa.mjs} +1 -1
- package/dist/{options-efTzQ_AE.mjs → options-j2tUAf6W.mjs} +71 -12
- package/dist/{package-BIUrKRH5.mjs → package-CBgnLfjl.mjs} +1 -1
- package/dist/plugins.d.mts +2 -2
- package/dist/plugins.mjs +2 -2
- package/dist/run.mjs +6 -6
- package/dist/{types-7diXKIyw.d.mts → types-DD-uKQPn.d.mts} +45 -5
- package/dist/{watch-BywZdNr-.mjs → watch-ZJbRq-K8.mjs} +4 -4
- package/package.json +15 -15
- package/dist/build-D-zhBXEK.mjs +0 -2
- /package/dist/{detect-DN3DXXYt.mjs → detect-h8ZFBH96.mjs} +0 -0
- /package/dist/{logger-DtCm1ySP.d.mts → logger-DLaktdLm.d.mts} +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { createRequire as __cjs_createRequire } from "node:module";
|
|
2
2
|
const __cjs_require = __cjs_createRequire(import.meta.url);
|
|
3
|
-
import { a as
|
|
4
|
-
import { a as getPackageType, c as isGlobEntry, d as cleanOutDir, i as loadConfigFile, l as toObjectEntry, n as mergeUserOptions, o as writeExports, r as resolveUserConfig, s as buildExe, u as cleanChunks } from "./options-efTzQ_AE.mjs";
|
|
3
|
+
import { a as getPackageType, c as isGlobEntry, d as cleanOutDir, i as loadConfigFile, l as toObjectEntry, n as mergeUserOptions, o as writeExports, r as resolveUserConfig, s as buildExe, t as mergeConfig, u as cleanChunks } from "./options-j2tUAf6W.mjs";
|
|
5
4
|
import { r as fsRemove } from "./fs-Dd6Htx2P.mjs";
|
|
6
|
-
import { a as
|
|
7
|
-
import { a as
|
|
8
|
-
import { a as
|
|
9
|
-
import { t as
|
|
5
|
+
import { a as pkgExists, l as slash, n as importWithError, o as promiseWithResolvers, t as debounce } from "./general-D3muxt2f.mjs";
|
|
6
|
+
import { a as globalLogger, t as LogLevels } from "./logger-uV8l1UFa.mjs";
|
|
7
|
+
import { a as getShimsInject, r as DepsPlugin } from "./format-_3CEX8E7.mjs";
|
|
8
|
+
import { a as ReportPlugin, i as ShebangPlugin, n as endsWithConfig, o as NodeProtocolPlugin, r as addOutDirToChunks, s as copy, t as WatchPlugin } from "./watch-ZJbRq-K8.mjs";
|
|
9
|
+
import { t as version } from "./package-CBgnLfjl.mjs";
|
|
10
10
|
import { mkdtemp, readFile, readdir, writeFile } from "node:fs/promises";
|
|
11
11
|
import path from "node:path";
|
|
12
12
|
import process from "node:process";
|
|
@@ -14,7 +14,7 @@ import { bold, dim, green } from "ansis";
|
|
|
14
14
|
import { createDebug } from "obug";
|
|
15
15
|
import { glob } from "tinyglobby";
|
|
16
16
|
import readline from "node:readline";
|
|
17
|
-
import { RE_CSS, RE_DTS, RE_JS } from "rolldown-plugin-dts/
|
|
17
|
+
import { RE_CSS, RE_DTS, RE_JS, filename_js_to_dts } from "rolldown-plugin-dts/internal";
|
|
18
18
|
import { tmpdir } from "node:os";
|
|
19
19
|
const satisfies = __cjs_require("semver/functions/satisfies.js");
|
|
20
20
|
import { exec, x } from "tinyexec";
|
|
@@ -25,6 +25,18 @@ import { Hookable } from "hookable";
|
|
|
25
25
|
const treeKill = __cjs_require("tree-kill");
|
|
26
26
|
import { formatWithOptions, inspect } from "node:util";
|
|
27
27
|
import { importGlobPlugin } from "rolldown/experimental";
|
|
28
|
+
//#region \0rolldown/runtime.js
|
|
29
|
+
var __defProp = Object.defineProperty;
|
|
30
|
+
var __exportAll = (all, no_symbols) => {
|
|
31
|
+
let target = {};
|
|
32
|
+
for (var name in all) __defProp(target, name, {
|
|
33
|
+
get: all[name],
|
|
34
|
+
enumerable: true
|
|
35
|
+
});
|
|
36
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
37
|
+
return target;
|
|
38
|
+
};
|
|
39
|
+
//#endregion
|
|
28
40
|
//#region src/config/workspace.ts
|
|
29
41
|
const debug$4 = createDebug("tsdown:config:workspace");
|
|
30
42
|
const DEFAULT_EXCLUDE_WORKSPACE = [
|
|
@@ -34,10 +46,7 @@ const DEFAULT_EXCLUDE_WORKSPACE = [
|
|
|
34
46
|
"**/t?(e)mp/**"
|
|
35
47
|
];
|
|
36
48
|
async function resolveWorkspace(config, inlineConfig) {
|
|
37
|
-
const normalized =
|
|
38
|
-
...config,
|
|
39
|
-
...inlineConfig
|
|
40
|
-
};
|
|
49
|
+
const normalized = mergeConfig(config, inlineConfig);
|
|
41
50
|
const rootCwd = normalized.cwd || process.cwd();
|
|
42
51
|
let { workspace } = normalized;
|
|
43
52
|
if (!workspace) return {
|
|
@@ -68,15 +77,12 @@ async function resolveWorkspace(config, inlineConfig) {
|
|
|
68
77
|
...inlineConfig,
|
|
69
78
|
config: workspaceConfig,
|
|
70
79
|
cwd
|
|
71
|
-
}, cwd);
|
|
80
|
+
}, cwd, normalized);
|
|
72
81
|
if (file) {
|
|
73
82
|
debug$4("loaded workspace config file %s", file);
|
|
74
83
|
files.push(file);
|
|
75
84
|
} else debug$4("no workspace config file found in %s", cwd);
|
|
76
|
-
return configs.map((config) => (
|
|
77
|
-
...normalized,
|
|
78
|
-
...config
|
|
79
|
-
}));
|
|
85
|
+
return configs.map((config) => mergeConfig(normalized, config));
|
|
80
86
|
}))).flat(),
|
|
81
87
|
files
|
|
82
88
|
};
|
|
@@ -198,7 +204,7 @@ async function attw(options, tarball) {
|
|
|
198
204
|
if (invalidRules.length) options.logger.warn(`attw config option 'ignoreRules' contains invalid value '${invalidRules.join(", ")}'.`);
|
|
199
205
|
const t = performance.now();
|
|
200
206
|
debug$2("Running attw check");
|
|
201
|
-
const attwCore = await importWithError("@arethetypeswrong/core"
|
|
207
|
+
const attwCore = options.attw.module || await importWithError("@arethetypeswrong/core");
|
|
202
208
|
const pkg = attwCore.createPackageFromTarballData(tarball);
|
|
203
209
|
const checkResult = await attwCore.checkPackage(pkg, attwOptions);
|
|
204
210
|
let errorMessage;
|
|
@@ -250,8 +256,8 @@ async function publint(options, tarball) {
|
|
|
250
256
|
}
|
|
251
257
|
const t = performance.now();
|
|
252
258
|
debug$1("Running publint");
|
|
253
|
-
const { publint } = await importWithError("publint"
|
|
254
|
-
const { formatMessage } = await importWithError("publint/utils"
|
|
259
|
+
const { publint } = options.publint.module?.[0] || await importWithError("publint");
|
|
260
|
+
const { formatMessage } = options.publint.module?.[1] || await importWithError("publint/utils");
|
|
255
261
|
const { messages } = await publint({
|
|
256
262
|
...options.publint,
|
|
257
263
|
pack: { tarball: tarball.buffer }
|
|
@@ -328,7 +334,7 @@ async function bundleDone(bundleByPkg, bundle) {
|
|
|
328
334
|
async function packTarball(packageJsonPath) {
|
|
329
335
|
const pkgDir = path.dirname(packageJsonPath);
|
|
330
336
|
const destination = await mkdtemp(path.join(tmpdir(), "tsdown-pack-"));
|
|
331
|
-
const { detect } = await import("./detect-
|
|
337
|
+
const { detect } = await import("./detect-h8ZFBH96.mjs");
|
|
332
338
|
try {
|
|
333
339
|
const detected = await detect({ cwd: pkgDir });
|
|
334
340
|
if (detected?.name === "deno") throw new Error(`Cannot pack tarball for Deno projects at ${pkgDir}`);
|
|
@@ -469,9 +475,10 @@ async function resolveInputOptions(config, format, configFiles, bundle, cjsDts,
|
|
|
469
475
|
if (config.pkg || config.deps.skipNodeModulesBundle) plugins.push(DepsPlugin(config, bundle));
|
|
470
476
|
if (dts) {
|
|
471
477
|
const { dts: dtsPlugin } = await import("rolldown-plugin-dts");
|
|
478
|
+
const { cjsReexport: _, ...dtsPluginOptions } = dts;
|
|
472
479
|
const options = {
|
|
473
480
|
tsconfig,
|
|
474
|
-
...
|
|
481
|
+
...dtsPluginOptions
|
|
475
482
|
};
|
|
476
483
|
if (format === "es") plugins.push(dtsPlugin(options));
|
|
477
484
|
else if (cjsDts) plugins.push(dtsPlugin({
|
|
@@ -479,7 +486,9 @@ async function resolveInputOptions(config, format, configFiles, bundle, cjsDts,
|
|
|
479
486
|
emitDtsOnly: true,
|
|
480
487
|
cjsDefault
|
|
481
488
|
}));
|
|
489
|
+
else if (dts.cjsReexport && isDualFormat) plugins.push(CjsDtsReexportPlugin());
|
|
482
490
|
}
|
|
491
|
+
let cssPostPlugins;
|
|
483
492
|
if (!cjsDts) {
|
|
484
493
|
if (unused) {
|
|
485
494
|
const { Unused } = await importWithError("unplugin-unused");
|
|
@@ -490,7 +499,9 @@ async function resolveInputOptions(config, format, configFiles, bundle, cjsDts,
|
|
|
490
499
|
}
|
|
491
500
|
if (pkgExists("@tsdown/css")) {
|
|
492
501
|
const { CssPlugin } = await import("@tsdown/css");
|
|
493
|
-
|
|
502
|
+
const cssPlugins = CssPlugin(config, { logger });
|
|
503
|
+
plugins.push(...cssPlugins.pre);
|
|
504
|
+
cssPostPlugins = cssPlugins.post;
|
|
494
505
|
} else plugins.push(CssGuardPlugin());
|
|
495
506
|
plugins.push(ShebangPlugin(logger, cwd, nameLabel, isDualFormat));
|
|
496
507
|
if (globImport) plugins.push(importGlobPlugin({ root: cwd }));
|
|
@@ -498,6 +509,7 @@ async function resolveInputOptions(config, format, configFiles, bundle, cjsDts,
|
|
|
498
509
|
if (report && LogLevels[logger.level] >= 3) plugins.push(ReportPlugin(config, cjsDts, isDualFormat));
|
|
499
510
|
if (watch) plugins.push(WatchPlugin(configFiles, bundle));
|
|
500
511
|
if (!cjsDts) plugins.push(userPlugins);
|
|
512
|
+
if (cssPostPlugins) plugins.push(...cssPostPlugins);
|
|
501
513
|
const define = {
|
|
502
514
|
...config.define,
|
|
503
515
|
...Object.keys(env).reduce((acc, key) => {
|
|
@@ -587,6 +599,23 @@ function handlePluginInspect(plugins) {
|
|
|
587
599
|
else return `"rolldown plugin: ${plugins.name}"`;
|
|
588
600
|
};
|
|
589
601
|
}
|
|
602
|
+
function CjsDtsReexportPlugin() {
|
|
603
|
+
return {
|
|
604
|
+
name: "tsdown:cjs-dts-reexport",
|
|
605
|
+
generateBundle(_options, bundle) {
|
|
606
|
+
for (const chunk of Object.values(bundle)) {
|
|
607
|
+
if (chunk.type !== "chunk") continue;
|
|
608
|
+
if (!chunk.fileName.endsWith(".cjs") && !chunk.fileName.endsWith(".js")) continue;
|
|
609
|
+
const content = `export * from './${path.basename(chunk.fileName.replace(RE_JS, ".d.mts"))}'\n`;
|
|
610
|
+
this.emitFile({
|
|
611
|
+
type: "prebuilt-chunk",
|
|
612
|
+
fileName: filename_js_to_dts(chunk.fileName),
|
|
613
|
+
code: content
|
|
614
|
+
});
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
};
|
|
618
|
+
}
|
|
590
619
|
function CssGuardPlugin() {
|
|
591
620
|
return {
|
|
592
621
|
name: "tsdown:css-guard",
|
|
@@ -652,6 +681,10 @@ function shortcuts(restart) {
|
|
|
652
681
|
}
|
|
653
682
|
//#endregion
|
|
654
683
|
//#region src/build.ts
|
|
684
|
+
var build_exports = /* @__PURE__ */ __exportAll({
|
|
685
|
+
build: () => build$1,
|
|
686
|
+
buildWithConfigs: () => buildWithConfigs
|
|
687
|
+
});
|
|
655
688
|
const asyncDispose = Symbol.asyncDispose || Symbol.for("Symbol.asyncDispose");
|
|
656
689
|
/**
|
|
657
690
|
* Build with tsdown.
|
|
@@ -798,7 +831,7 @@ async function buildSingle(config, configFiles, isDualFormat, clean, restart, do
|
|
|
798
831
|
});
|
|
799
832
|
if (debugRolldownConfigDir) await debugBuildOptions(debugRolldownConfigDir, config.name, format, buildOptions);
|
|
800
833
|
const configs = [buildOptions];
|
|
801
|
-
if (format === "cjs" && dts) configs.push(await getBuildOptions(config, format, configFiles, bundle, true, isDualFormat));
|
|
834
|
+
if (format === "cjs" && dts && (!isDualFormat || !dts.cjsReexport)) configs.push(await getBuildOptions(config, format, configFiles, bundle, true, isDualFormat));
|
|
802
835
|
return configs;
|
|
803
836
|
}
|
|
804
837
|
async function postBuild() {
|
|
@@ -815,4 +848,4 @@ async function buildSingle(config, configFiles, isDualFormat, clean, restart, do
|
|
|
815
848
|
}
|
|
816
849
|
}
|
|
817
850
|
//#endregion
|
|
818
|
-
export { buildWithConfigs as n, build$1 as t };
|
|
851
|
+
export { buildWithConfigs as n, build_exports as r, build$1 as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as UserConfig, f as UserConfigExport, i as InlineConfig, o as ResolvedConfig, p as UserConfigFn } from "./types-
|
|
1
|
+
import { d as UserConfig, f as UserConfigExport, i as InlineConfig, o as ResolvedConfig, p as UserConfigFn } from "./types-DD-uKQPn.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/config/options.d.ts
|
|
4
4
|
/**
|
|
@@ -8,8 +8,8 @@ import { d as UserConfig, f as UserConfigExport, i as InlineConfig, o as Resolve
|
|
|
8
8
|
* @private
|
|
9
9
|
*/
|
|
10
10
|
declare function resolveUserConfig(userConfig: UserConfig, inlineConfig: InlineConfig): Promise<ResolvedConfig[]>;
|
|
11
|
-
declare function mergeConfig(defaults: UserConfig, overrides: UserConfig): UserConfig;
|
|
12
|
-
declare function mergeConfig(defaults: InlineConfig, overrides: InlineConfig): InlineConfig;
|
|
11
|
+
declare function mergeConfig(defaults: UserConfig, ...overrides: UserConfig[]): UserConfig;
|
|
12
|
+
declare function mergeConfig(defaults: InlineConfig, ...overrides: InlineConfig[]): InlineConfig;
|
|
13
13
|
//#endregion
|
|
14
14
|
//#region src/config.d.ts
|
|
15
15
|
/**
|
package/dist/config.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { d as UserConfig, f as UserConfigExport, p as UserConfigFn } from "./types-
|
|
2
|
-
import { n as mergeConfig, t as defineConfig } from "./config-
|
|
1
|
+
import { d as UserConfig, f as UserConfigExport, p as UserConfigFn } from "./types-DD-uKQPn.mjs";
|
|
2
|
+
import { n as mergeConfig, t as defineConfig } from "./config-BJiwtsMo.mjs";
|
|
3
3
|
export { UserConfig, UserConfigExport, UserConfigFn, defineConfig, mergeConfig };
|
package/dist/config.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { s as resolveComma, u as toArray } from "./general-
|
|
1
|
+
import { s as resolveComma, u as toArray } from "./general-D3muxt2f.mjs";
|
|
2
2
|
import { createDebug, enable, namespaces } from "obug";
|
|
3
3
|
//#region src/features/debug.ts
|
|
4
4
|
const debugLog = createDebug("tsdown:debug");
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { c as resolveRegex, l as slash, r as matchPattern, u as toArray } from "./general-
|
|
1
|
+
import { c as resolveRegex, l as slash, r as matchPattern, u as toArray } from "./general-D3muxt2f.mjs";
|
|
2
2
|
import { isBuiltin } from "node:module";
|
|
3
3
|
import { readFile } from "node:fs/promises";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { blue, underline, yellow } from "ansis";
|
|
6
6
|
import { createDebug } from "obug";
|
|
7
|
-
import { RE_DTS, RE_NODE_MODULES } from "rolldown-plugin-dts/
|
|
7
|
+
import { RE_DTS, RE_NODE_MODULES } from "rolldown-plugin-dts/internal";
|
|
8
8
|
import { and, id, importerId, include } from "rolldown/filter";
|
|
9
9
|
//#region src/features/shims.ts
|
|
10
10
|
const shimFile = path.resolve(import.meta.dirname, "..", "esm-shims.js");
|
|
@@ -127,7 +127,10 @@ function DepsPlugin({ pkg, deps: { alwaysBundle, onlyBundle, skipNodeModulesBund
|
|
|
127
127
|
async function externalStrategy(id, importer, resolved) {
|
|
128
128
|
if (id === shimFile) return false;
|
|
129
129
|
if (alwaysBundle?.(id, importer)) return "no-external";
|
|
130
|
-
if (skipNodeModulesBundle && resolved && (resolved.external || RE_NODE_MODULES.test(resolved.id)))
|
|
130
|
+
if (skipNodeModulesBundle && resolved && (resolved.external || RE_NODE_MODULES.test(resolved.id))) {
|
|
131
|
+
const resolvedDep = await resolveDepSubpath(id, resolved);
|
|
132
|
+
return resolvedDep ? [true, resolvedDep] : true;
|
|
133
|
+
}
|
|
131
134
|
if (deps) {
|
|
132
135
|
if (deps.includes(id) || deps.some((dep) => id.startsWith(`${dep}/`))) {
|
|
133
136
|
const resolvedDep = await resolveDepSubpath(id, resolved);
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import { createRequire as __cjs_createRequire } from "node:module";
|
|
2
|
-
const
|
|
3
|
-
import { createRequire } from "node:module";
|
|
4
|
-
import { pathToFileURL } from "node:url";
|
|
5
|
-
const picomatch = __cjs_require("picomatch");
|
|
6
|
-
//#region \0rolldown/runtime.js
|
|
7
|
-
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
8
|
-
//#endregion
|
|
2
|
+
const picomatch = __cjs_createRequire(import.meta.url)("picomatch");
|
|
9
3
|
//#region src/utils/general.ts
|
|
10
4
|
function toArray(val, defaultValue) {
|
|
11
5
|
if (Array.isArray(val)) return val;
|
|
@@ -41,11 +35,9 @@ function pkgExists(moduleName) {
|
|
|
41
35
|
} catch {}
|
|
42
36
|
return false;
|
|
43
37
|
}
|
|
44
|
-
async function importWithError(moduleName
|
|
45
|
-
let resolved;
|
|
46
|
-
if (resolvePaths) resolved = pathToFileURL(__require.resolve(moduleName, { paths: resolvePaths })).href;
|
|
38
|
+
async function importWithError(moduleName) {
|
|
47
39
|
try {
|
|
48
|
-
return await import(
|
|
40
|
+
return await import(moduleName);
|
|
49
41
|
} catch (error) {
|
|
50
42
|
throw new Error(`Failed to import module "${moduleName}". Please ensure it is installed.`, { cause: error });
|
|
51
43
|
}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { i as Arrayable, n as Logger, r as globalLogger } from "./logger-
|
|
2
|
-
import { A as RolldownContext, B as TsdownBundle, C as ChunkAddonObject, D as PackageJsonWithPath, E as OutExtensionObject, F as DepsConfig, H as CopyOptions, L as NoExternalFn, M as ExeOptions, N as SeaConfig, O as PackageType, P as DevtoolsOptions, R as ResolvedDepsConfig, S as ChunkAddonFunction, T as OutExtensionFactory, U as CopyOptionsFn, V as CopyEntry, a as NormalizedFormat, b as AttwOptions, c as TreeshakingOptions, d as UserConfig, f as UserConfigExport, g as ReportOptions, h as Workspace, i as InlineConfig, j as TsdownHooks, k as BuildContext, l as TsdownInputOption, m as WithEnabled, n as DtsOptions, o as ResolvedConfig, p as UserConfigFn, r as Format, s as Sourcemap, t as CIOption, u as UnusedOptions, v as PublintOptions, w as OutExtensionContext, x as ChunkAddon, y as ExportsOptions, z as RolldownChunk } from "./types-
|
|
3
|
-
import { n as mergeConfig, r as resolveUserConfig, t as defineConfig } from "./config-
|
|
1
|
+
import { i as Arrayable, n as Logger, r as globalLogger } from "./logger-DLaktdLm.mjs";
|
|
2
|
+
import { A as RolldownContext, B as TsdownBundle, C as ChunkAddonObject, D as PackageJsonWithPath, E as OutExtensionObject, F as DepsConfig, H as CopyOptions, L as NoExternalFn, M as ExeOptions, N as SeaConfig, O as PackageType, P as DevtoolsOptions, R as ResolvedDepsConfig, S as ChunkAddonFunction, T as OutExtensionFactory, U as CopyOptionsFn, V as CopyEntry, a as NormalizedFormat, b as AttwOptions, c as TreeshakingOptions, d as UserConfig, f as UserConfigExport, g as ReportOptions, h as Workspace, i as InlineConfig, j as TsdownHooks, k as BuildContext, l as TsdownInputOption, m as WithEnabled, n as DtsOptions, o as ResolvedConfig, p as UserConfigFn, r as Format, s as Sourcemap, t as CIOption, u as UnusedOptions, v as PublintOptions, w as OutExtensionContext, x as ChunkAddon, y as ExportsOptions, z as RolldownChunk } from "./types-DD-uKQPn.mjs";
|
|
3
|
+
import { n as mergeConfig, r as resolveUserConfig, t as defineConfig } from "./config-BJiwtsMo.mjs";
|
|
4
4
|
import * as Rolldown from "rolldown";
|
|
5
5
|
|
|
6
6
|
//#region src/build.d.ts
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { n as buildWithConfigs, t as build } from "./build-DU-BFLB1.mjs";
|
|
2
|
+
import { r as resolveUserConfig, t as mergeConfig } from "./options-j2tUAf6W.mjs";
|
|
3
|
+
import { a as globalLogger } from "./logger-uV8l1UFa.mjs";
|
|
3
4
|
import { defineConfig } from "./config.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import { t as enableDebug } from "./debug-C4FmgzkJ.mjs";
|
|
5
|
+
import { t as enableDebug } from "./debug-BmAPbhgA.mjs";
|
|
6
6
|
import * as Rolldown from "rolldown";
|
|
7
7
|
export { Rolldown, build, buildWithConfigs, defineConfig, enableDebug, globalLogger, mergeConfig, resolveUserConfig };
|
package/dist/internal.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as Logger, o as MarkPartial, s as Overwrite } from "./logger-
|
|
1
|
+
import { n as Logger, o as MarkPartial, s as Overwrite } from "./logger-DLaktdLm.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/utils/fs.d.ts
|
|
4
4
|
declare function fsExists(path: string): Promise<boolean>;
|
|
@@ -7,6 +7,6 @@ declare function fsRemove(path: string): Promise<void>;
|
|
|
7
7
|
//#region src/utils/general.d.ts
|
|
8
8
|
declare function toArray<T>(val: T | T[] | null | undefined, defaultValue?: T): T[];
|
|
9
9
|
declare function resolveComma<T extends string>(arr: T[]): T[];
|
|
10
|
-
declare function importWithError<T>(moduleName: string
|
|
10
|
+
declare function importWithError<T>(moduleName: string): Promise<T>;
|
|
11
11
|
//#endregion
|
|
12
12
|
export { type Logger, type MarkPartial, type Overwrite, fsExists, fsRemove, importWithError, resolveComma, toArray };
|
package/dist/internal.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { n as importWithError, s as resolveComma, u as toArray } from "./general-CRszZCrY.mjs";
|
|
2
1
|
import { n as fsExists, r as fsRemove } from "./fs-Dd6Htx2P.mjs";
|
|
2
|
+
import { n as importWithError, s as resolveComma, u as toArray } from "./general-D3muxt2f.mjs";
|
|
3
3
|
export { fsExists, fsRemove, importWithError, resolveComma, toArray };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createRequire as __cjs_createRequire } from "node:module";
|
|
2
2
|
const __cjs_require = __cjs_createRequire(import.meta.url);
|
|
3
|
-
import { a as pkgExists, c as resolveRegex, l as slash, n as importWithError, r as matchPattern, s as resolveComma, u as toArray } from "./general-CRszZCrY.mjs";
|
|
4
3
|
import { a as lowestCommonAncestor, i as fsStat, n as fsExists, o as stripExtname, r as fsRemove } from "./fs-Dd6Htx2P.mjs";
|
|
5
|
-
import { a as
|
|
6
|
-
import { i as
|
|
4
|
+
import { a as pkgExists, c as resolveRegex, l as slash, n as importWithError, r as matchPattern, s as resolveComma, u as toArray } from "./general-D3muxt2f.mjs";
|
|
5
|
+
import { a as globalLogger, i as getNameLabel, n as createLogger, r as generateColor } from "./logger-uV8l1UFa.mjs";
|
|
6
|
+
import { i as resolveDepsConfig, n as formatBytes, t as detectIndentation } from "./format-_3CEX8E7.mjs";
|
|
7
7
|
import { mkdir, mkdtemp, readFile, writeFile } from "node:fs/promises";
|
|
8
8
|
import path from "node:path";
|
|
9
9
|
import process, { env } from "node:process";
|
|
@@ -11,9 +11,8 @@ import { blue, bold, dim, red, underline } from "ansis";
|
|
|
11
11
|
import { createDefu } from "defu";
|
|
12
12
|
import { createDebug } from "obug";
|
|
13
13
|
import { glob, isDynamicPattern } from "tinyglobby";
|
|
14
|
-
import { pathToFileURL } from "node:url";
|
|
15
14
|
const picomatch = __cjs_require("picomatch");
|
|
16
|
-
import { RE_CSS, RE_DTS, RE_NODE_MODULES } from "rolldown-plugin-dts/
|
|
15
|
+
import { RE_CSS, RE_DTS, RE_NODE_MODULES } from "rolldown-plugin-dts/internal";
|
|
17
16
|
import { tmpdir } from "node:os";
|
|
18
17
|
const satisfies = __cjs_require("semver/functions/satisfies.js");
|
|
19
18
|
import { x } from "tinyexec";
|
|
@@ -21,6 +20,7 @@ import { readFileSync, writeFileSync } from "node:fs";
|
|
|
21
20
|
const minVersion = __cjs_require("semver/ranges/min-version.js");
|
|
22
21
|
import { up } from "empathic/find";
|
|
23
22
|
import { up as up$1 } from "empathic/package";
|
|
23
|
+
import { pathToFileURL } from "node:url";
|
|
24
24
|
import { init, isSupported } from "import-without-cache";
|
|
25
25
|
import { createConfigCoreLoader } from "unconfig-core";
|
|
26
26
|
//#region node_modules/.pnpm/is-in-ci@2.0.0/node_modules/is-in-ci/index.js
|
|
@@ -80,7 +80,7 @@ async function resolveEntry(logger, entry, cwd, color, nameLabel, root) {
|
|
|
80
80
|
const [entryMap, computedRoot] = await toObjectEntry(entry, cwd, root);
|
|
81
81
|
const entries = Object.values(entryMap);
|
|
82
82
|
if (entries.length === 0) throw new Error(`${nameLabel} Cannot find entry: ${JSON.stringify(entry)}`);
|
|
83
|
-
logger.info(nameLabel, `entry: ${color(entries.map((entry) => path.relative(cwd, entry)).join(", "))}`);
|
|
83
|
+
logger.info(nameLabel, `entry: ${color(entries.map((entry) => path.isAbsolute(entry) ? path.relative(cwd, entry) : entry).join(", "))}`);
|
|
84
84
|
return [entryMap, computedRoot];
|
|
85
85
|
}
|
|
86
86
|
function toObjectEntry(entry, cwd, root) {
|
|
@@ -234,10 +234,11 @@ async function buildSingleExe(config, bundledFile, outputFile, executable, targe
|
|
|
234
234
|
//#region src/features/pkg/exports.ts
|
|
235
235
|
async function writeExports(options, chunks, inlinedDeps) {
|
|
236
236
|
const { pkg } = options;
|
|
237
|
-
const { publishExports, ...generated } = await generateExports(pkg, chunks, options, inlinedDeps);
|
|
237
|
+
const { publishExports, bin, ...generated } = await generateExports(pkg, chunks, options, inlinedDeps);
|
|
238
238
|
const updatedPkg = {
|
|
239
239
|
...pkg,
|
|
240
240
|
...generated,
|
|
241
|
+
...bin === void 0 ? {} : { bin },
|
|
241
242
|
packageJsonPath: void 0
|
|
242
243
|
};
|
|
243
244
|
if (publishExports) {
|
|
@@ -255,7 +256,7 @@ function shouldExclude(fileName, exclude) {
|
|
|
255
256
|
return matchPattern(fileName, exclude);
|
|
256
257
|
}
|
|
257
258
|
async function generateExports(pkg, chunks, options, inlinedDeps) {
|
|
258
|
-
let { exports: { devExports, all, packageJson = true, exclude, customExports, legacy, inlinedDependencies: emitInlinedDeps = true }, css, logger } = options;
|
|
259
|
+
let { exports: { devExports, all, packageJson = true, exclude, customExports, legacy, inlinedDependencies: emitInlinedDeps = true, bin }, css, logger, cwd } = options;
|
|
259
260
|
const pkgRoot = path.dirname(pkg.packageJsonPath);
|
|
260
261
|
let main, module, cjsTypes, esmTypes;
|
|
261
262
|
const exportsMap = /* @__PURE__ */ new Map();
|
|
@@ -334,6 +335,7 @@ async function generateExports(pkg, chunks, options, inlinedDeps) {
|
|
|
334
335
|
module: legacy ? module || pkg.module : void 0,
|
|
335
336
|
types: legacy ? cjsTypes || esmTypes || pkg.types : pkg.types,
|
|
336
337
|
exports,
|
|
338
|
+
bin: generateBin(bin, pkg, chunks, pkgRoot, logger, cwd),
|
|
337
339
|
inlinedDependencies: emitInlinedDeps ? inlinedDeps : void 0,
|
|
338
340
|
publishExports
|
|
339
341
|
};
|
|
@@ -375,6 +377,60 @@ function hasExportsTypes(pkg) {
|
|
|
375
377
|
}
|
|
376
378
|
return false;
|
|
377
379
|
}
|
|
380
|
+
const RE_SHEBANG = /^#!.*/;
|
|
381
|
+
function generateBin(bin, pkg, chunks, pkgRoot, logger, cwd) {
|
|
382
|
+
if (!bin) return;
|
|
383
|
+
if (bin === true || typeof bin === "string") {
|
|
384
|
+
if (!pkg.name) throw new Error("Package name is required when using string form for `bin`");
|
|
385
|
+
const binName = pkg.name[0] === "@" ? pkg.name.split("/", 2)[1] : pkg.name;
|
|
386
|
+
if (bin === true) {
|
|
387
|
+
let detected;
|
|
388
|
+
const seen = /* @__PURE__ */ new Set();
|
|
389
|
+
for (const format of ["es", "cjs"]) {
|
|
390
|
+
const formatChunks = chunks[format];
|
|
391
|
+
if (!formatChunks) continue;
|
|
392
|
+
for (const chunk of formatChunks) {
|
|
393
|
+
if (chunk.type !== "chunk" || !chunk.isEntry || !chunk.facadeModuleId) continue;
|
|
394
|
+
if (!RE_SHEBANG.test(chunk.code)) continue;
|
|
395
|
+
if (seen.has(chunk.facadeModuleId)) continue;
|
|
396
|
+
seen.add(chunk.facadeModuleId);
|
|
397
|
+
if (detected) throw new Error("Multiple entry chunks with shebangs found. Use `exports.bin: { name: \"./src/file.ts\" }` to specify which one to use.");
|
|
398
|
+
detected = join(pkgRoot, chunk.outDir, slash(chunk.fileName));
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
if (detected == null) {
|
|
402
|
+
logger.warn("`exports.bin` is true but no entry chunks with shebangs were found");
|
|
403
|
+
return;
|
|
404
|
+
}
|
|
405
|
+
return { [binName]: detected };
|
|
406
|
+
}
|
|
407
|
+
if (typeof bin === "string") {
|
|
408
|
+
const match = findChunkBySource(bin);
|
|
409
|
+
if (!match) throw new Error(`Could not find output chunk for bin entry "${bin}"`);
|
|
410
|
+
return { [binName]: match };
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
const result = {};
|
|
414
|
+
for (const [cmdName, sourcePath] of Object.entries(bin)) {
|
|
415
|
+
const match = findChunkBySource(sourcePath);
|
|
416
|
+
if (!match) throw new Error(`Could not find output chunk for bin entry "${cmdName}": "${sourcePath}"`);
|
|
417
|
+
result[cmdName] = match;
|
|
418
|
+
}
|
|
419
|
+
return result;
|
|
420
|
+
function findChunkBySource(sourcePath) {
|
|
421
|
+
const resolved = path.resolve(cwd, sourcePath);
|
|
422
|
+
for (const format of ["es", "cjs"]) {
|
|
423
|
+
const formatChunks = chunks[format];
|
|
424
|
+
if (!formatChunks) continue;
|
|
425
|
+
for (const chunk of formatChunks) {
|
|
426
|
+
if (chunk.type !== "chunk" || !chunk.isEntry) continue;
|
|
427
|
+
if (chunk.facadeModuleId !== resolved) continue;
|
|
428
|
+
if (!RE_SHEBANG.test(chunk.code)) logger.warn(`Bin entry "${sourcePath}" does not contain a shebang line`);
|
|
429
|
+
return join(pkgRoot, chunk.outDir, slash(chunk.fileName));
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
}
|
|
378
434
|
function getExportName(chunk) {
|
|
379
435
|
const normalizedName = slash(chunk.fileName);
|
|
380
436
|
let name = stripExtname(normalizedName);
|
|
@@ -501,7 +557,7 @@ async function loadViteConfig(prefix, cwd, configLoader) {
|
|
|
501
557
|
return resolved;
|
|
502
558
|
}
|
|
503
559
|
const configPrefix = "tsdown.config";
|
|
504
|
-
async function loadConfigFile(inlineConfig, workspace) {
|
|
560
|
+
async function loadConfigFile(inlineConfig, workspace, rootConfig) {
|
|
505
561
|
let cwd = inlineConfig.cwd || process.cwd();
|
|
506
562
|
let overrideConfig = false;
|
|
507
563
|
let { config: filePath } = inlineConfig;
|
|
@@ -550,7 +606,10 @@ async function loadConfigFile(inlineConfig, workspace) {
|
|
|
550
606
|
({config: exported, source: file} = result);
|
|
551
607
|
globalLogger.info(`config file: ${underline(file)}`, loader === "native" ? "" : `(${loader})`);
|
|
552
608
|
exported = await exported;
|
|
553
|
-
if (typeof exported === "function") exported = await exported(inlineConfig, {
|
|
609
|
+
if (typeof exported === "function") exported = await exported(inlineConfig, {
|
|
610
|
+
ci: isInCi,
|
|
611
|
+
rootConfig
|
|
612
|
+
});
|
|
554
613
|
}
|
|
555
614
|
exported = toArray(exported);
|
|
556
615
|
if (exported.length === 0) exported.push({});
|
|
@@ -769,8 +828,8 @@ const defu = createDefu((obj, key, value) => {
|
|
|
769
828
|
return true;
|
|
770
829
|
}
|
|
771
830
|
});
|
|
772
|
-
function mergeConfig(defaults, overrides) {
|
|
773
|
-
return defu(overrides, defaults);
|
|
831
|
+
function mergeConfig(defaults, ...overrides) {
|
|
832
|
+
return defu(...overrides.toReversed(), defaults);
|
|
774
833
|
}
|
|
775
834
|
async function mergeUserOptions(defaults, user, args) {
|
|
776
835
|
const userOutputOptions = typeof user === "function" ? await user(defaults, ...args) : user;
|
package/dist/plugins.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as Logger } from "./logger-
|
|
2
|
-
import { B as TsdownBundle, I as DepsPlugin, _ as ReportPlugin } from "./types-
|
|
1
|
+
import { n as Logger } from "./logger-DLaktdLm.mjs";
|
|
2
|
+
import { B as TsdownBundle, I as DepsPlugin, _ as ReportPlugin } from "./types-DD-uKQPn.mjs";
|
|
3
3
|
import { Plugin } from "rolldown";
|
|
4
4
|
|
|
5
5
|
//#region src/features/node-protocol.d.ts
|
package/dist/plugins.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { r as DepsPlugin } from "./format-
|
|
2
|
-
import { a as ReportPlugin, i as ShebangPlugin, o as NodeProtocolPlugin, t as WatchPlugin } from "./watch-
|
|
1
|
+
import { r as DepsPlugin } from "./format-_3CEX8E7.mjs";
|
|
2
|
+
import { a as ReportPlugin, i as ShebangPlugin, o as NodeProtocolPlugin, t as WatchPlugin } from "./watch-ZJbRq-K8.mjs";
|
|
3
3
|
export { DepsPlugin, NodeProtocolPlugin, ReportPlugin, ShebangPlugin, WatchPlugin };
|
package/dist/run.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __cjs_createRequire } from "node:module";
|
|
3
3
|
const __cjs_require = __cjs_createRequire(import.meta.url);
|
|
4
|
-
import { a as globalLogger } from "./logger-
|
|
5
|
-
import { t as version } from "./package-
|
|
6
|
-
import { t as enableDebug } from "./debug-
|
|
4
|
+
import { a as globalLogger } from "./logger-uV8l1UFa.mjs";
|
|
5
|
+
import { t as version } from "./package-CBgnLfjl.mjs";
|
|
6
|
+
import { t as enableDebug } from "./debug-BmAPbhgA.mjs";
|
|
7
7
|
import module from "node:module";
|
|
8
8
|
import process from "node:process";
|
|
9
|
-
import {
|
|
9
|
+
import { blue, hex, yellow } from "ansis";
|
|
10
10
|
import { x } from "tinyexec";
|
|
11
11
|
import { VERSION } from "rolldown";
|
|
12
12
|
const lt = __cjs_require("semver/functions/lt.js");
|
|
@@ -19,8 +19,8 @@ cli.command("[...files]", "Bundle files", {
|
|
|
19
19
|
allowUnknownOptions: true
|
|
20
20
|
}).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("--deps.never-bundle <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("--root <dir>", "Root directory of input files").option("--exe", "Bundle as executable").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) => {
|
|
21
21
|
globalLogger.level = flags.logLevel || "info";
|
|
22
|
-
globalLogger.info(`tsdown
|
|
23
|
-
const { build } = await import("./build-
|
|
22
|
+
globalLogger.info(`${blue`tsdown v${version}`} powered by ${hex("#ff7e17")`rolldown v${VERSION}`}`);
|
|
23
|
+
const { build } = await import("./build-DU-BFLB1.mjs").then((n) => n.r);
|
|
24
24
|
if (input.length > 0) flags.entry = input;
|
|
25
25
|
await build(flags);
|
|
26
26
|
});
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import { a as Awaitable, i as Arrayable, n as Logger, o as MarkPartial, s as Overwrite, t as LogLevel } from "./logger-
|
|
1
|
+
import { a as Awaitable, i as Arrayable, n as Logger, o as MarkPartial, s as Overwrite, t as LogLevel } from "./logger-DLaktdLm.mjs";
|
|
2
2
|
import { BuildOptions, ChecksOptions, ExternalOption, InputOptions, InternalModuleFormat, MinifyOptions, ModuleFormat, ModuleTypes, OutputAsset, OutputChunk, OutputOptions, Plugin, TreeshakingOptions } from "rolldown";
|
|
3
3
|
import { Hookable } from "hookable";
|
|
4
4
|
import { Buffer } from "node:buffer";
|
|
5
|
-
import * as _tsdown_css0 from "@tsdown/css";
|
|
5
|
+
import * as _$_tsdown_css0 from "@tsdown/css";
|
|
6
6
|
import { StartOptions } from "@vitejs/devtools/cli-commands";
|
|
7
7
|
import { ExeExtensionOptions } from "@tsdown/exe";
|
|
8
|
+
import * as _$_arethetypeswrong_core0 from "@arethetypeswrong/core";
|
|
8
9
|
import { CheckPackageOptions } from "@arethetypeswrong/core";
|
|
10
|
+
import * as _$publint from "publint";
|
|
9
11
|
import { Options } from "publint";
|
|
10
|
-
import
|
|
12
|
+
import * as _$publint_utils0 from "publint/utils";
|
|
13
|
+
import { Options as Options$1 } from "rolldown-plugin-dts";
|
|
11
14
|
import { Options as UnusedOptions } from "unplugin-unused";
|
|
12
15
|
|
|
13
16
|
//#region src/features/copy.d.ts
|
|
@@ -520,6 +523,7 @@ type ChunkAddon = ChunkAddonObject | ChunkAddonFunction | string;
|
|
|
520
523
|
//#endregion
|
|
521
524
|
//#region src/features/pkg/attw.d.ts
|
|
522
525
|
interface AttwOptions extends CheckPackageOptions {
|
|
526
|
+
module?: typeof _$_arethetypeswrong_core0;
|
|
523
527
|
/**
|
|
524
528
|
* Profiles select a set of resolution modes to require/ignore. All are evaluated but failures outside
|
|
525
529
|
* of those required are ignored.
|
|
@@ -638,10 +642,28 @@ interface ExportsOptions {
|
|
|
638
642
|
* @see {@link https://github.com/e18e/ecosystem-issues/issues/237}
|
|
639
643
|
*/
|
|
640
644
|
inlinedDependencies?: boolean;
|
|
645
|
+
/**
|
|
646
|
+
* Auto-generate the `bin` field in package.json.
|
|
647
|
+
*
|
|
648
|
+
* - `true`: Auto-detect entry chunks with shebangs. Uses package name (without scope) as bin name.
|
|
649
|
+
* Errors if multiple shebang entries are found.
|
|
650
|
+
* - `string`: Source file path to use as the bin entry. Bin name defaults to package name (without scope).
|
|
651
|
+
* - `Record<string, string>`: Map of bin command names to source file paths.
|
|
652
|
+
*
|
|
653
|
+
* @example
|
|
654
|
+
* bin: true
|
|
655
|
+
* @example
|
|
656
|
+
* bin: './src/cli.ts'
|
|
657
|
+
* @example
|
|
658
|
+
* bin: { tool: './src/cli-tool.ts' }
|
|
659
|
+
*/
|
|
660
|
+
bin?: boolean | string | Record<string, string>;
|
|
641
661
|
}
|
|
642
662
|
//#endregion
|
|
643
663
|
//#region src/features/pkg/publint.d.ts
|
|
644
|
-
interface PublintOptions extends Omit<Options, "pack" | "pkgDir"> {
|
|
664
|
+
interface PublintOptions extends Omit<Options, "pack" | "pkgDir"> {
|
|
665
|
+
module?: [typeof _$publint, typeof _$publint_utils0];
|
|
666
|
+
}
|
|
645
667
|
//#endregion
|
|
646
668
|
//#region src/features/report.d.ts
|
|
647
669
|
interface ReportOptions {
|
|
@@ -668,6 +690,23 @@ interface ReportOptions {
|
|
|
668
690
|
declare function ReportPlugin(config: ResolvedConfig, cjsDts?: boolean, isDualFormat?: boolean): Plugin;
|
|
669
691
|
//#endregion
|
|
670
692
|
//#region src/config/types.d.ts
|
|
693
|
+
interface DtsOptions extends Options$1 {
|
|
694
|
+
/**
|
|
695
|
+
* When building dual ESM+CJS formats, generate a `.d.cts` re-export stub
|
|
696
|
+
* instead of running a full second TypeScript compilation pass.
|
|
697
|
+
*
|
|
698
|
+
* The stub re-exports everything from the corresponding `.d.mts` file,
|
|
699
|
+
* ensuring CJS and ESM consumers share the same type declarations. This
|
|
700
|
+
* eliminates the TypeScript "dual module hazard" where separate `.d.cts`
|
|
701
|
+
* and `.d.mts` declarations cause `TS2352` ("neither type sufficiently
|
|
702
|
+
* overlaps") errors when casting between types derived from the same class.
|
|
703
|
+
*
|
|
704
|
+
* Only applies when building both `esm` and `cjs` formats simultaneously.
|
|
705
|
+
*
|
|
706
|
+
* @default false
|
|
707
|
+
*/
|
|
708
|
+
cjsReexport?: boolean;
|
|
709
|
+
}
|
|
671
710
|
type Sourcemap = boolean | "inline" | "hidden";
|
|
672
711
|
type Format = ModuleFormat;
|
|
673
712
|
type NormalizedFormat = InternalModuleFormat;
|
|
@@ -1074,7 +1113,7 @@ interface UserConfig {
|
|
|
1074
1113
|
* **[experimental]** CSS options.
|
|
1075
1114
|
* Requires `@tsdown/css` to be installed.
|
|
1076
1115
|
*/
|
|
1077
|
-
css?: _tsdown_css0.CssOptions;
|
|
1116
|
+
css?: _$_tsdown_css0.CssOptions;
|
|
1078
1117
|
/**
|
|
1079
1118
|
* @deprecated Use `css.inject` instead.
|
|
1080
1119
|
*/
|
|
@@ -1128,6 +1167,7 @@ interface InlineConfig extends UserConfig {
|
|
|
1128
1167
|
}
|
|
1129
1168
|
type UserConfigFn = (inlineConfig: InlineConfig, context: {
|
|
1130
1169
|
ci: boolean;
|
|
1170
|
+
rootConfig?: UserConfig;
|
|
1131
1171
|
}) => Awaitable<Arrayable<UserConfig>>;
|
|
1132
1172
|
type UserConfigExport = Awaitable<Arrayable<UserConfig> | UserConfigFn>;
|
|
1133
1173
|
type ResolvedConfig = Overwrite<MarkPartial<Omit<UserConfig, "workspace" | "fromVite" | "publicDir" | "bundle" | "injectStyle" | "removeNodeProtocol" | "external" | "noExternal" | "inlineOnly" | "skipNodeModulesBundle" | "logLevel" | "failOnWarn" | "customLogger" | "envFile" | "envPrefix">, "globalName" | "inputOptions" | "outputOptions" | "minify" | "define" | "alias" | "onSuccess" | "outExtensions" | "hooks" | "copy" | "loader" | "name" | "banner" | "footer" | "checks" | "css">, {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { i as noop, s as resolveComma, u as toArray } from "./general-CRszZCrY.mjs";
|
|
2
1
|
import { n as fsExists, t as fsCopy } from "./fs-Dd6Htx2P.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { i as noop, s as resolveComma, u as toArray } from "./general-D3muxt2f.mjs";
|
|
3
|
+
import { o as prettyFormat } from "./logger-uV8l1UFa.mjs";
|
|
4
|
+
import { n as formatBytes } from "./format-_3CEX8E7.mjs";
|
|
5
5
|
import { builtinModules } from "node:module";
|
|
6
6
|
import { chmod } from "node:fs/promises";
|
|
7
7
|
import path from "node:path";
|
|
8
8
|
import { bold, dim, green, underline } from "ansis";
|
|
9
9
|
import { createDebug } from "obug";
|
|
10
10
|
import { glob, isDynamicPattern } from "tinyglobby";
|
|
11
|
-
import { RE_DTS } from "rolldown-plugin-dts/
|
|
11
|
+
import { RE_DTS } from "rolldown-plugin-dts/internal";
|
|
12
12
|
import { promisify } from "node:util";
|
|
13
13
|
import { Buffer } from "node:buffer";
|
|
14
14
|
import { brotliCompress, gzip } from "node:zlib";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tsdown",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.21.
|
|
4
|
+
"version": "0.21.7",
|
|
5
5
|
"description": "The Elegant Bundler for Libraries",
|
|
6
6
|
"author": "Kevin Deng <sxzz@sxzz.moe>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -52,8 +52,8 @@
|
|
|
52
52
|
"publint": "^0.3.0",
|
|
53
53
|
"typescript": "^5.0.0 || ^6.0.0",
|
|
54
54
|
"unplugin-unused": "^0.5.0",
|
|
55
|
-
"@tsdown/css": "0.21.
|
|
56
|
-
"@tsdown/exe": "0.21.
|
|
55
|
+
"@tsdown/css": "0.21.7",
|
|
56
|
+
"@tsdown/exe": "0.21.7"
|
|
57
57
|
},
|
|
58
58
|
"peerDependenciesMeta": {
|
|
59
59
|
"@arethetypeswrong/core": {
|
|
@@ -87,14 +87,14 @@
|
|
|
87
87
|
"import-without-cache": "^0.2.5",
|
|
88
88
|
"obug": "^2.1.1",
|
|
89
89
|
"picomatch": "^4.0.4",
|
|
90
|
-
"rolldown": "1.0.0-rc.
|
|
91
|
-
"rolldown-plugin-dts": "^0.
|
|
90
|
+
"rolldown": "1.0.0-rc.12",
|
|
91
|
+
"rolldown-plugin-dts": "^0.23.2",
|
|
92
92
|
"semver": "^7.7.4",
|
|
93
93
|
"tinyexec": "^1.0.4",
|
|
94
94
|
"tinyglobby": "^0.2.15",
|
|
95
95
|
"tree-kill": "^1.2.2",
|
|
96
96
|
"unconfig-core": "^7.5.0",
|
|
97
|
-
"unrun": "^0.2.
|
|
97
|
+
"unrun": "^0.2.34"
|
|
98
98
|
},
|
|
99
99
|
"inlinedDependencies": {
|
|
100
100
|
"is-in-ci": "2.0.0",
|
|
@@ -103,17 +103,17 @@
|
|
|
103
103
|
},
|
|
104
104
|
"devDependencies": {
|
|
105
105
|
"@arethetypeswrong/core": "^0.18.2",
|
|
106
|
-
"@sxzz/eslint-config": "^7.8.
|
|
106
|
+
"@sxzz/eslint-config": "^7.8.4",
|
|
107
107
|
"@sxzz/prettier-config": "^2.3.1",
|
|
108
|
-
"@sxzz/test-utils": "^0.5.
|
|
108
|
+
"@sxzz/test-utils": "^0.5.16",
|
|
109
109
|
"@types/node": "^25.5.0",
|
|
110
110
|
"@types/picomatch": "^4.0.2",
|
|
111
111
|
"@types/semver": "^7.7.1",
|
|
112
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
112
|
+
"@typescript/native-preview": "7.0.0-dev.20260328.1",
|
|
113
113
|
"@unocss/eslint-plugin": "^66.6.7",
|
|
114
114
|
"@vitejs/devtools": "^0.1.11",
|
|
115
|
-
"@vitest/coverage-v8": "^4.1.
|
|
116
|
-
"@vitest/ui": "^4.1.
|
|
115
|
+
"@vitest/coverage-v8": "^4.1.2",
|
|
116
|
+
"@vitest/ui": "^4.1.2",
|
|
117
117
|
"@vueuse/core": "^14.2.1",
|
|
118
118
|
"bumpp": "^11.0.1",
|
|
119
119
|
"dedent": "^1.7.2",
|
|
@@ -135,11 +135,11 @@
|
|
|
135
135
|
"unplugin-raw": "^0.6.4",
|
|
136
136
|
"unplugin-unused": "^0.5.7",
|
|
137
137
|
"unplugin-vue": "^7.1.1",
|
|
138
|
-
"vite": "^8.0.
|
|
139
|
-
"vitest": "^4.1.
|
|
138
|
+
"vite": "^8.0.3",
|
|
139
|
+
"vitest": "^4.1.2",
|
|
140
140
|
"vue": "^3.5.31",
|
|
141
|
-
"@tsdown/css": "0.21.
|
|
142
|
-
"@tsdown/exe": "0.21.
|
|
141
|
+
"@tsdown/css": "0.21.7",
|
|
142
|
+
"@tsdown/exe": "0.21.7"
|
|
143
143
|
},
|
|
144
144
|
"prettier": "@sxzz/prettier-config",
|
|
145
145
|
"scripts": {
|
package/dist/build-D-zhBXEK.mjs
DELETED
|
File without changes
|
|
File without changes
|