tsdown 0.22.3 → 0.22.5
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-B_nvJe4A.mjs → build-HsrEHUjF.mjs} +24 -20
- package/dist/{config-BJZDmsYq.d.mts → config-CA7V8dZs.d.mts} +8 -9
- package/dist/config.d.mts +2 -2
- package/dist/config.mjs +1 -1
- package/dist/{debug-DLdR-9XB.mjs → debug-DlW99neU.mjs} +1 -1
- package/dist/{detect-B97OSl92.mjs → detect-BNXt7gkp.mjs} +8 -3
- package/dist/{format-DMceewlS.mjs → format-V8jMDi-4.mjs} +13 -7
- package/dist/index.d.mts +14 -12
- package/dist/index.mjs +7 -4
- package/dist/internal.d.mts +1 -2
- package/dist/logger-Dewu9aCG.d.mts +29 -0
- package/dist/{options-Ce3ueyZH.mjs → options-C7WUFwSd.mjs} +4 -4
- package/dist/plugins.d.mts +6 -10
- package/dist/plugins.mjs +2 -2
- package/dist/run.mjs +2 -2
- package/dist/types-n62VBdgE.d.mts +1427 -0
- package/dist/{watch-C3ocHLCt.mjs → watch-CEWY-yCw.mjs} +1 -1
- package/package.json +33 -33
- package/dist/index-C0LaRpVv.d.mts +0 -334
- package/dist/types-F1pJie3k.d.mts +0 -1140
|
@@ -3,10 +3,10 @@ const __cjs_require = __cjs_createRequire(import.meta.url);
|
|
|
3
3
|
import { r as fsRemove } from "./fs-qxJxxoCE.mjs";
|
|
4
4
|
import { a as pkgExists, l as slash, n as importWithError, o as promiseWithResolvers, t as debounce, u as toArray } from "./general-Cp4NiJNK.mjs";
|
|
5
5
|
import { a as globalLogger, t as LogLevels } from "./logger-BxuhTmAE.mjs";
|
|
6
|
-
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-
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { n as
|
|
6
|
+
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-C7WUFwSd.mjs";
|
|
7
|
+
import { i as getShims, n as DepsPlugin } from "./format-V8jMDi-4.mjs";
|
|
8
|
+
import { n as version } from "./debug-DlW99neU.mjs";
|
|
9
|
+
import { a as ReportPlugin, i as ShebangPlugin, n as endsWithConfig, o as NodeProtocolPlugin, r as addOutDirToChunks, s as copy, t as WatchPlugin } from "./watch-CEWY-yCw.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";
|
|
@@ -111,7 +111,7 @@ async function resolveConfig(inlineConfig) {
|
|
|
111
111
|
function warnLegacyCJS(config) {
|
|
112
112
|
if (config.exe || !config.target || !(config.checks?.legacyCjs ?? true) || !config.format.includes("cjs")) return;
|
|
113
113
|
if (config.target.some((t) => {
|
|
114
|
-
const version = coerce(t.split("node")[1]);
|
|
114
|
+
const version = coerce(t.split("node", 2)[1]);
|
|
115
115
|
return version && satisfies(version, "^20.19.0 || >=22.12.0");
|
|
116
116
|
})) config.logger.warnOnce("We recommend using the ESM format instead of CommonJS.\nThe ESM format is compatible with modern platforms and runtimes, and most new libraries are now distributed only in ESM format.\nLearn more at https://nodejs.org/en/learn/modules/publishing-a-package#how-did-we-get-here");
|
|
117
117
|
}
|
|
@@ -347,14 +347,14 @@ async function bundleDone(bundleByPkg, bundle) {
|
|
|
347
347
|
async function packTarball(packageJsonPath) {
|
|
348
348
|
const pkgDir = path.dirname(packageJsonPath);
|
|
349
349
|
const destination = await mkdtemp(path.join(tmpdir(), "tsdown-pack-"));
|
|
350
|
-
const { detect } = await import("./detect-
|
|
350
|
+
const { detect } = await import("./detect-BNXt7gkp.mjs");
|
|
351
351
|
try {
|
|
352
352
|
const detected = await detect({ cwd: pkgDir });
|
|
353
353
|
debug$1("Detected package manager: %o", detected);
|
|
354
354
|
if (detected?.name === "deno") throw new Error(`Cannot pack tarball for Deno projects at ${pkgDir}`);
|
|
355
355
|
const tarballPath = await pack(pkgDir, detected, destination, true);
|
|
356
356
|
debug$1("Packed tarball at %s", tarballPath);
|
|
357
|
-
return readFile(tarballPath);
|
|
357
|
+
return await readFile(tarballPath);
|
|
358
358
|
} finally {
|
|
359
359
|
if (debug$1.enabled) debug$1("Preserving pack directory for debugging: %s", destination);
|
|
360
360
|
else await fsRemove(destination);
|
|
@@ -458,15 +458,15 @@ function createChunkFilename(basename, jsExtension, dtsExtension) {
|
|
|
458
458
|
function resolveChunkAddon(chunkAddon, format) {
|
|
459
459
|
if (!chunkAddon) return;
|
|
460
460
|
return (chunk) => {
|
|
461
|
-
|
|
461
|
+
const resolved = typeof chunkAddon === "function" ? chunkAddon({
|
|
462
462
|
format,
|
|
463
463
|
fileName: chunk.fileName
|
|
464
|
-
});
|
|
465
|
-
if (typeof
|
|
464
|
+
}) : chunkAddon;
|
|
465
|
+
if (typeof resolved === "string") return resolved;
|
|
466
466
|
switch (true) {
|
|
467
|
-
case RE_JS.test(chunk.fileName): return
|
|
468
|
-
case RE_CSS.test(chunk.fileName): return
|
|
469
|
-
case RE_DTS.test(chunk.fileName): return
|
|
467
|
+
case RE_JS.test(chunk.fileName): return resolved?.js || "";
|
|
468
|
+
case RE_CSS.test(chunk.fileName): return resolved?.css || "";
|
|
469
|
+
case RE_DTS.test(chunk.fileName): return resolved?.dts || "";
|
|
470
470
|
default: return "";
|
|
471
471
|
}
|
|
472
472
|
};
|
|
@@ -486,7 +486,8 @@ async function getBuildOptions(config, format, configDeps, bundle, cjsDts = fals
|
|
|
486
486
|
return rolldownConfig;
|
|
487
487
|
}
|
|
488
488
|
async function resolveInputOptions(config, format, configDeps, bundle, cjsDts, isDualFormat) {
|
|
489
|
-
const { alias, checks: { legacyCjs, ...checks } = {}, cjsDefault, cwd, deps, devtools, dts, entry, env, globImport, loader, logger, nameLabel, nodeProtocol, platform, plugins: userPlugins, report, shims, target, treeshake, tsconfig,
|
|
489
|
+
const { alias, checks: { legacyCjs, ...checks } = {}, cjsDefault, cwd, deps, devtools, dts, entry, env, globImport, loader, logger, nameLabel, nodeProtocol, platform, plugins: userPlugins, report, shims, target, treeshake, tsconfig, unused, watch } = config;
|
|
490
|
+
const loggerLevelIndex = LogLevels[logger.level];
|
|
490
491
|
const plugins = [];
|
|
491
492
|
if (nodeProtocol) plugins.push(NodeProtocolPlugin(nodeProtocol));
|
|
492
493
|
if (config.pkg || config.deps.skipNodeModulesBundle) plugins.push(DepsPlugin(config, bundle));
|
|
@@ -523,7 +524,7 @@ async function resolveInputOptions(config, format, configDeps, bundle, cjsDts, i
|
|
|
523
524
|
plugins.push(ShebangPlugin(logger, cwd, nameLabel, isDualFormat));
|
|
524
525
|
if (globImport) plugins.push(importGlobPlugin({ root: cwd }));
|
|
525
526
|
}
|
|
526
|
-
if (report &&
|
|
527
|
+
if (report && loggerLevelIndex >= 3) plugins.push(ReportPlugin(config, cjsDts, isDualFormat));
|
|
527
528
|
if (watch) plugins.push(WatchPlugin(configDeps, bundle));
|
|
528
529
|
if (!cjsDts) plugins.push(userPlugins);
|
|
529
530
|
if (cssPostPlugins) plugins.push(...cssPostPlugins);
|
|
@@ -537,13 +538,15 @@ async function resolveInputOptions(config, format, configDeps, bundle, cjsDts, i
|
|
|
537
538
|
}, Object.create(null))
|
|
538
539
|
};
|
|
539
540
|
let inject;
|
|
540
|
-
if (shims && !cjsDts)
|
|
541
|
+
if (shims && !cjsDts) {
|
|
542
|
+
const shims = getShims(config);
|
|
543
|
+
inject = shims.inject;
|
|
541
544
|
define = {
|
|
542
545
|
...define,
|
|
543
|
-
...
|
|
546
|
+
...shims.define
|
|
544
547
|
};
|
|
545
|
-
plugins.push(
|
|
546
|
-
}
|
|
548
|
+
if (shims.plugin) plugins.push(shims.plugin);
|
|
549
|
+
}
|
|
547
550
|
const dtsExternal = deps.dts.neverBundle ? functionifyExternal(deps.dts.neverBundle) : void 0;
|
|
548
551
|
let external;
|
|
549
552
|
if (deps.neverBundle && dtsExternal) {
|
|
@@ -555,6 +558,7 @@ async function resolveInputOptions(config, format, configDeps, bundle, cjsDts, i
|
|
|
555
558
|
return (importer ? RE_DTS.test(importer) : false) ? dtsExternal(id, importer, ...args) : void 0;
|
|
556
559
|
};
|
|
557
560
|
else external = deps.neverBundle;
|
|
561
|
+
const logLevel = logger.options?.failOnWarn && loggerLevelIndex < 2 ? "warn" : logger.level === "error" ? "silent" : logger.level;
|
|
558
562
|
return await mergeUserOptions({
|
|
559
563
|
input: entry,
|
|
560
564
|
cwd,
|
|
@@ -573,7 +577,7 @@ async function resolveInputOptions(config, format, configDeps, bundle, cjsDts, i
|
|
|
573
577
|
".node": "copy",
|
|
574
578
|
...loader
|
|
575
579
|
},
|
|
576
|
-
logLevel
|
|
580
|
+
logLevel,
|
|
577
581
|
onLog(level, log, defaultHandler) {
|
|
578
582
|
if (cjsDefault && log.code === "MIXED_EXPORT") return;
|
|
579
583
|
if (logger.options?.failOnWarn && level === "warn" && log.code !== "PLUGIN_TIMINGS") defaultHandler("error", log);
|
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
import { d as UserConfig, f as UserConfigExport, i as InlineConfig, o as ResolvedConfig, p as UserConfigFn } from "./types-
|
|
2
|
-
|
|
1
|
+
import { d as UserConfig, f as UserConfigExport, i as InlineConfig, o as ResolvedConfig, p as UserConfigFn } from "./types-n62VBdgE.mjs";
|
|
3
2
|
//#region src/config/options.d.ts
|
|
4
3
|
/**
|
|
5
|
-
* Resolve user config into resolved configs
|
|
6
|
-
*
|
|
7
|
-
* **Internal API, not for public use**
|
|
8
|
-
* @private
|
|
9
|
-
*/
|
|
4
|
+
* Resolve user config into resolved configs
|
|
5
|
+
*
|
|
6
|
+
* **Internal API, not for public use**
|
|
7
|
+
* @private
|
|
8
|
+
*/
|
|
10
9
|
declare function resolveUserConfig(userConfig: UserConfig, inlineConfig: InlineConfig, configDeps: Set<string>): Promise<ResolvedConfig[]>;
|
|
11
10
|
declare function mergeConfig(defaults: UserConfig, ...overrides: UserConfig[]): UserConfig;
|
|
12
11
|
declare function mergeConfig(defaults: InlineConfig, ...overrides: InlineConfig[]): InlineConfig;
|
|
13
12
|
//#endregion
|
|
14
13
|
//#region src/config.d.ts
|
|
15
14
|
/**
|
|
16
|
-
* Defines the configuration for tsdown.
|
|
17
|
-
*/
|
|
15
|
+
* Defines the configuration for tsdown.
|
|
16
|
+
*/
|
|
18
17
|
declare function defineConfig(options: UserConfig): UserConfig;
|
|
19
18
|
declare function defineConfig(options: UserConfig[]): UserConfig[];
|
|
20
19
|
declare function defineConfig(options: UserConfigFn): UserConfigFn;
|
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-n62VBdgE.mjs";
|
|
2
|
+
import { n as mergeConfig, t as defineConfig } from "./config-CA7V8dZs.mjs";
|
|
3
3
|
export { type UserConfig, type UserConfigExport, type UserConfigFn, defineConfig, mergeConfig };
|
package/dist/config.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { s as resolveComma, u as toArray } from "./general-Cp4NiJNK.mjs";
|
|
2
2
|
import { createDebug, enable, namespaces } from "obug";
|
|
3
3
|
//#region package.json
|
|
4
|
-
var version = "0.22.
|
|
4
|
+
var version = "0.22.5";
|
|
5
5
|
//#endregion
|
|
6
6
|
//#region src/features/debug.ts
|
|
7
7
|
const debugLog = createDebug("tsdown:debug");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs from "node:fs/promises";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import process from "node:process";
|
|
4
|
-
//#region node_modules/.pnpm/package-manager-detector@1.
|
|
4
|
+
//#region node_modules/.pnpm/package-manager-detector@1.7.0/node_modules/package-manager-detector/dist/constants.mjs
|
|
5
5
|
const AGENTS = [
|
|
6
6
|
"npm",
|
|
7
7
|
"yarn",
|
|
@@ -9,9 +9,13 @@ const AGENTS = [
|
|
|
9
9
|
"pnpm",
|
|
10
10
|
"pnpm@6",
|
|
11
11
|
"bun",
|
|
12
|
-
"deno"
|
|
12
|
+
"deno",
|
|
13
|
+
"nub",
|
|
14
|
+
"aube"
|
|
13
15
|
];
|
|
14
16
|
const LOCKS = {
|
|
17
|
+
"aube-lock.yaml": "aube",
|
|
18
|
+
"aube-workspace.yaml": "aube",
|
|
15
19
|
"bun.lock": "bun",
|
|
16
20
|
"bun.lockb": "bun",
|
|
17
21
|
"deno.lock": "deno",
|
|
@@ -22,6 +26,7 @@ const LOCKS = {
|
|
|
22
26
|
"npm-shrinkwrap.json": "npm"
|
|
23
27
|
};
|
|
24
28
|
const INSTALL_METADATA = {
|
|
29
|
+
"node_modules/.aube/": "aube",
|
|
25
30
|
"node_modules/.deno/": "deno",
|
|
26
31
|
"node_modules/.pnpm/": "pnpm",
|
|
27
32
|
"node_modules/.yarn-state.yml": "yarn",
|
|
@@ -33,7 +38,7 @@ const INSTALL_METADATA = {
|
|
|
33
38
|
"bun.lockb": "bun"
|
|
34
39
|
};
|
|
35
40
|
//#endregion
|
|
36
|
-
//#region node_modules/.pnpm/package-manager-detector@1.
|
|
41
|
+
//#region node_modules/.pnpm/package-manager-detector@1.7.0/node_modules/package-manager-detector/dist/detect.mjs
|
|
37
42
|
async function pathExists(path2, type) {
|
|
38
43
|
try {
|
|
39
44
|
const stat = await fs.stat(path2);
|
|
@@ -8,6 +8,10 @@ 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");
|
|
11
|
+
const shimsInject = {
|
|
12
|
+
__dirname: [shimFile, "__dirname"],
|
|
13
|
+
__filename: [shimFile, "__filename"]
|
|
14
|
+
};
|
|
11
15
|
const shimsDefine = {
|
|
12
16
|
__dirname: "__TSDOWN_SHIM_DIRNAME__",
|
|
13
17
|
__filename: "__TSDOWN_SHIM_FILENAME__"
|
|
@@ -22,11 +26,13 @@ const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPat
|
|
|
22
26
|
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
23
27
|
`
|
|
24
28
|
};
|
|
25
|
-
function
|
|
26
|
-
if (format
|
|
27
|
-
|
|
28
|
-
|
|
29
|
+
function getShims(config) {
|
|
30
|
+
if (config.format !== "es" || config.platform !== "node") return {};
|
|
31
|
+
if (config.unbundle) return {
|
|
32
|
+
define: shimsDefine,
|
|
33
|
+
plugin: shimsPlugin
|
|
29
34
|
};
|
|
35
|
+
return { inject: shimsInject };
|
|
30
36
|
}
|
|
31
37
|
//#endregion
|
|
32
38
|
//#region src/features/deps.ts
|
|
@@ -123,7 +129,7 @@ function DepsPlugin({ pkg, deps: { alwaysBundle: jsAlwaysBundle, onlyBundle, ski
|
|
|
123
129
|
if (!tsdownBundle.inlinedDeps.has(parsed.pkgName)) tsdownBundle.inlinedDeps.set(parsed.pkgName, /* @__PURE__ */ new Set());
|
|
124
130
|
tsdownBundle.inlinedDeps.get(parsed.pkgName).add(parsed.version);
|
|
125
131
|
const module = this.getModuleInfo(id);
|
|
126
|
-
if (module) importers.set(parsed.name, new Set([...module.importers, ...importers.get(parsed.name) || []]));
|
|
132
|
+
if (module) importers.set(parsed.name, /* @__PURE__ */ new Set([...module.importers, ...importers.get(parsed.name) || []]));
|
|
127
133
|
}
|
|
128
134
|
}
|
|
129
135
|
debug("found deps in bundle: %o", deps);
|
|
@@ -217,7 +223,7 @@ async function resolveDepSubpath(id, resolved) {
|
|
|
217
223
|
return result;
|
|
218
224
|
}
|
|
219
225
|
function getProductionDeps(pkg) {
|
|
220
|
-
return new Set([
|
|
226
|
+
return /* @__PURE__ */ new Set([
|
|
221
227
|
...Object.keys(pkg.dependencies || {}),
|
|
222
228
|
...Object.keys(pkg.peerDependencies || {}),
|
|
223
229
|
...Object.keys(pkg.optionalDependencies || {})
|
|
@@ -231,4 +237,4 @@ function formatBytes(bytes) {
|
|
|
231
237
|
return `${(bytes / 1e3).toFixed(2)} kB`;
|
|
232
238
|
}
|
|
233
239
|
//#endregion
|
|
234
|
-
export {
|
|
240
|
+
export { getShims as i, DepsPlugin as n, resolveDepsConfig as r, formatBytes as t };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,22 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { A as PackageType, B as ResolvedDepsConfig, C as ChunkAddon, D as OutExtensionFactory, E as OutExtensionContext, F as SeaConfig, G as CopyOptionsFn, H as TsdownBundle, I as DevtoolsOptions, L as DepsConfig, M as RolldownContext, N as TsdownHooks, O as OutExtensionObject, P as ExeOptions, S as AttwOptions, T as ChunkAddonObject, U as CopyEntry, V as RolldownChunk, W as CopyOptions, a as NormalizedFormat, b as PublintOptions, c as TreeshakingOptions, d as UserConfig, f as UserConfigExport, g as ReportOptions, h as Workspace, i as InlineConfig, j as BuildContext, k as PackageJsonWithPath, 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 TsdownPlugin, w as ChunkAddonFunction, x as ExportsOptions, y as TsdownPluginOption, z as NoExternalFn } 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-Dewu9aCG.mjs";
|
|
2
|
+
import { A as PackageType, B as ResolvedDepsConfig, C as ChunkAddon, D as OutExtensionFactory, E as OutExtensionContext, F as SeaConfig, G as CopyOptionsFn, H as TsdownBundle, I as DevtoolsOptions, L as DepsConfig, M as RolldownContext, N as TsdownHooks, O as OutExtensionObject, P as ExeOptions, S as AttwOptions, T as ChunkAddonObject, U as CopyEntry, V as RolldownChunk, W as CopyOptions, a as NormalizedFormat, b as PublintOptions, c as TreeshakingOptions, d as UserConfig, f as UserConfigExport, g as ReportOptions, h as Workspace, i as InlineConfig, j as BuildContext, k as PackageJsonWithPath, 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 TsdownPlugin, w as ChunkAddonFunction, x as ExportsOptions, y as TsdownPluginOption, z as NoExternalFn } from "./types-n62VBdgE.mjs";
|
|
3
|
+
import { n as mergeConfig, r as resolveUserConfig, t as defineConfig } from "./config-CA7V8dZs.mjs";
|
|
4
4
|
import * as Rolldown from "rolldown";
|
|
5
|
-
|
|
6
5
|
//#region src/build.d.ts
|
|
7
6
|
/**
|
|
8
|
-
* Build with tsdown.
|
|
9
|
-
*/
|
|
7
|
+
* Build with tsdown.
|
|
8
|
+
*/
|
|
10
9
|
declare function build(inlineConfig?: InlineConfig): Promise<TsdownBundle[]>;
|
|
11
10
|
/**
|
|
12
|
-
* Build with `ResolvedConfigs`.
|
|
13
|
-
*
|
|
14
|
-
* **Internal API, not for public use**
|
|
15
|
-
* @private
|
|
16
|
-
*/
|
|
11
|
+
* Build with `ResolvedConfigs`.
|
|
12
|
+
*
|
|
13
|
+
* **Internal API, not for public use**
|
|
14
|
+
* @private
|
|
15
|
+
*/
|
|
17
16
|
declare function buildWithConfigs(configs: ResolvedConfig[], configDeps: Set<string>, _restart: () => void): Promise<TsdownBundle[]>;
|
|
18
17
|
//#endregion
|
|
19
18
|
//#region src/features/debug.d.ts
|
|
20
19
|
declare function enableDebug(debug?: boolean | Arrayable<string>): void;
|
|
21
20
|
//#endregion
|
|
22
|
-
|
|
21
|
+
//#region src/index.d.ts
|
|
22
|
+
declare const version: string;
|
|
23
|
+
//#endregion
|
|
24
|
+
export { type AttwOptions, type BuildContext, CIOption, type ChunkAddon, type ChunkAddonFunction, type ChunkAddonObject, type CopyEntry, type CopyOptions, type CopyOptionsFn, type DepsConfig, type DevtoolsOptions, DtsOptions, type ExeOptions, type ExportsOptions, Format, InlineConfig, type Logger, type NoExternalFn, NormalizedFormat, type OutExtensionContext, type OutExtensionFactory, type OutExtensionObject, type PackageJsonWithPath, type PackageType, type PublintOptions, type ReportOptions, ResolvedConfig, type ResolvedDepsConfig, Rolldown, type RolldownChunk, type RolldownContext, type SeaConfig, Sourcemap, type TreeshakingOptions, type TsdownBundle, type TsdownHooks, TsdownInputOption, type TsdownPlugin, type TsdownPluginOption, type UnusedOptions, UserConfig, UserConfigExport, UserConfigFn, WithEnabled, Workspace, build, buildWithConfigs, defineConfig, enableDebug, globalLogger, mergeConfig, resolveUserConfig, version };
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import { n as buildWithConfigs, t as build } from "./build-
|
|
1
|
+
import { n as buildWithConfigs, t as build } from "./build-HsrEHUjF.mjs";
|
|
2
2
|
import { a as globalLogger } from "./logger-BxuhTmAE.mjs";
|
|
3
|
-
import { r as resolveUserConfig, t as mergeConfig } from "./options-
|
|
3
|
+
import { r as resolveUserConfig, t as mergeConfig } from "./options-C7WUFwSd.mjs";
|
|
4
4
|
import { defineConfig } from "./config.mjs";
|
|
5
|
-
import { t as enableDebug } from "./debug-
|
|
5
|
+
import { n as version$1, t as enableDebug } from "./debug-DlW99neU.mjs";
|
|
6
6
|
import * as Rolldown from "rolldown";
|
|
7
|
-
|
|
7
|
+
//#region src/index.ts
|
|
8
|
+
const version = version$1;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { Rolldown, build, buildWithConfigs, defineConfig, enableDebug, globalLogger, mergeConfig, resolveUserConfig, version };
|
package/dist/internal.d.mts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { n as Logger, o as MarkPartial, s as Overwrite } from "./logger-Dewu9aCG.mjs";
|
|
3
2
|
//#region src/features/target.d.ts
|
|
4
3
|
declare function expandBaselineTarget(targets: string[]): string[];
|
|
5
4
|
//#endregion
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { InternalModuleFormat } from "rolldown";
|
|
2
|
+
//#region src/utils/types.d.ts
|
|
3
|
+
type Overwrite<T, U> = Omit<T, keyof U> & U;
|
|
4
|
+
type Awaitable<T> = T | Promise<T>;
|
|
5
|
+
type MarkPartial<T, K extends keyof T> = Omit<Required<T>, K> & Partial<Pick<T, K>>;
|
|
6
|
+
type Arrayable<T> = T | T[];
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region src/utils/logger.d.ts
|
|
9
|
+
type LogType = "error" | "warn" | "info";
|
|
10
|
+
type LogLevel = LogType | "silent";
|
|
11
|
+
interface LoggerOptions {
|
|
12
|
+
allowClearScreen?: boolean;
|
|
13
|
+
customLogger?: Logger;
|
|
14
|
+
console?: Console;
|
|
15
|
+
failOnWarn?: boolean;
|
|
16
|
+
}
|
|
17
|
+
interface Logger {
|
|
18
|
+
level: LogLevel;
|
|
19
|
+
options?: LoggerOptions;
|
|
20
|
+
info: (...args: any[]) => void;
|
|
21
|
+
warn: (...args: any[]) => void;
|
|
22
|
+
warnOnce: (...args: any[]) => void;
|
|
23
|
+
error: (...args: any[]) => void;
|
|
24
|
+
success: (...args: any[]) => void;
|
|
25
|
+
clearScreen: (type: LogType) => void;
|
|
26
|
+
}
|
|
27
|
+
declare const globalLogger: Logger;
|
|
28
|
+
//#endregion
|
|
29
|
+
export { Awaitable as a, Arrayable as i, Logger as n, MarkPartial as o, globalLogger as r, Overwrite as s, LogLevel as t };
|
|
@@ -3,7 +3,7 @@ const __cjs_require = __cjs_createRequire(import.meta.url);
|
|
|
3
3
|
import { a as lowestCommonAncestor, i as fsStat, n as fsExists, o as stripExtname, r as fsRemove } from "./fs-qxJxxoCE.mjs";
|
|
4
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-Cp4NiJNK.mjs";
|
|
5
5
|
import { a as globalLogger, i as getNameLabel, n as createLogger, r as generateColor } from "./logger-BxuhTmAE.mjs";
|
|
6
|
-
import { r as resolveDepsConfig, t as formatBytes } from "./format-
|
|
6
|
+
import { r as resolveDepsConfig, t as formatBytes } from "./format-V8jMDi-4.mjs";
|
|
7
7
|
import { n as resolveTarget } from "./target-CqeSqtms.mjs";
|
|
8
8
|
import { mkdir, mkdtemp, readFile, writeFile } from "node:fs/promises";
|
|
9
9
|
import path from "node:path";
|
|
@@ -663,7 +663,7 @@ function createParser(loader) {
|
|
|
663
663
|
if (basename === configPrefix || isPkgJson || basename.endsWith(".json")) {
|
|
664
664
|
const contents = await readFile(filepath, "utf8");
|
|
665
665
|
const parsed = JSON.parse(contents);
|
|
666
|
-
return [isPkgJson ? parsed?.tsdown : parsed, new Set([filepath])];
|
|
666
|
+
return [isPkgJson ? parsed?.tsdown : parsed, /* @__PURE__ */ new Set([filepath])];
|
|
667
667
|
}
|
|
668
668
|
switch (loader) {
|
|
669
669
|
case "native": return nativeImport(filepath);
|
|
@@ -674,7 +674,7 @@ function createParser(loader) {
|
|
|
674
674
|
};
|
|
675
675
|
}
|
|
676
676
|
async function nativeImport(id) {
|
|
677
|
-
const deps = new Set([id]);
|
|
677
|
+
const deps = /* @__PURE__ */ new Set([id]);
|
|
678
678
|
const url = pathToFileURL(id);
|
|
679
679
|
const importAttributes = Object.create(null);
|
|
680
680
|
if (isSupported) {
|
|
@@ -692,7 +692,7 @@ async function nativeImport(id) {
|
|
|
692
692
|
async function tsxImport(id) {
|
|
693
693
|
const { tsImport } = await importWithError("tsx/esm/api");
|
|
694
694
|
const module = await tsImport(pathToFileURL(id).href, import.meta.url);
|
|
695
|
-
return [module?.default || module, new Set([id])];
|
|
695
|
+
return [module?.default || module, /* @__PURE__ */ new Set([id])];
|
|
696
696
|
}
|
|
697
697
|
async function unrunImport(id) {
|
|
698
698
|
const { unrun } = await importWithError("unrun");
|
package/dist/plugins.d.mts
CHANGED
|
@@ -1,21 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { H as TsdownBundle, R as DepsPlugin, _ as ReportPlugin } from "./types-
|
|
1
|
+
import { n as Logger } from "./logger-Dewu9aCG.mjs";
|
|
2
|
+
import { H as TsdownBundle, R as DepsPlugin, _ as ReportPlugin } from "./types-n62VBdgE.mjs";
|
|
3
3
|
import { Plugin } from "rolldown";
|
|
4
|
-
|
|
5
4
|
//#region src/features/node-protocol.d.ts
|
|
6
5
|
/**
|
|
7
|
-
* The `node:` protocol was added in Node.js v14.18.0.
|
|
8
|
-
* @see https://nodejs.org/api/esm.html#node-imports
|
|
9
|
-
*/
|
|
6
|
+
* The `node:` protocol was added in Node.js v14.18.0.
|
|
7
|
+
* @see https://nodejs.org/api/esm.html#node-imports
|
|
8
|
+
*/
|
|
10
9
|
declare function NodeProtocolPlugin(nodeProtocolOption: "strip" | true): Plugin;
|
|
11
10
|
//#endregion
|
|
12
11
|
//#region src/features/shebang.d.ts
|
|
13
12
|
declare function ShebangPlugin(logger: Logger, cwd: string, nameLabel?: string, isDualFormat?: boolean): Plugin;
|
|
14
13
|
//#endregion
|
|
15
14
|
//#region src/features/watch.d.ts
|
|
16
|
-
declare function WatchPlugin(configDeps: Set<string>, {
|
|
17
|
-
config,
|
|
18
|
-
chunks
|
|
19
|
-
}: TsdownBundle): Plugin;
|
|
15
|
+
declare function WatchPlugin(configDeps: Set<string>, { config, chunks }: TsdownBundle): Plugin;
|
|
20
16
|
//#endregion
|
|
21
17
|
export { DepsPlugin, NodeProtocolPlugin, ReportPlugin, ShebangPlugin, WatchPlugin };
|
package/dist/plugins.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { n as DepsPlugin } from "./format-
|
|
2
|
-
import { a as ReportPlugin, i as ShebangPlugin, o as NodeProtocolPlugin, t as WatchPlugin } from "./watch-
|
|
1
|
+
import { n as DepsPlugin } from "./format-V8jMDi-4.mjs";
|
|
2
|
+
import { a as ReportPlugin, i as ShebangPlugin, o as NodeProtocolPlugin, t as WatchPlugin } from "./watch-CEWY-yCw.mjs";
|
|
3
3
|
export { DepsPlugin, NodeProtocolPlugin, ReportPlugin, ShebangPlugin, WatchPlugin };
|
package/dist/run.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { a as globalLogger } from "./logger-BxuhTmAE.mjs";
|
|
3
|
-
import { n as version, t as enableDebug } from "./debug-
|
|
3
|
+
import { n as version, t as enableDebug } from "./debug-DlW99neU.mjs";
|
|
4
4
|
import module from "node:module";
|
|
5
5
|
import process from "node:process";
|
|
6
6
|
import { blue, hex } from "ansis";
|
|
@@ -16,7 +16,7 @@ cli.command("[...files]", "Bundle files", {
|
|
|
16
16
|
}).option("-c, --config <filename>", "Use a custom config file").option("--config-loader <loader>", "Config loader to use: auto, native, tsx, 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 package exports for package.json").action(async (input, flags) => {
|
|
17
17
|
globalLogger.level = flags.logLevel || "info";
|
|
18
18
|
globalLogger.info(`${blue`tsdown v${version}`} powered by ${hex("#ff7e17")`rolldown v${VERSION}`}`);
|
|
19
|
-
const { build } = await import("./build-
|
|
19
|
+
const { build } = await import("./build-HsrEHUjF.mjs").then((n) => n.r);
|
|
20
20
|
if (input.length > 0) flags.entry = input;
|
|
21
21
|
await build(flags);
|
|
22
22
|
});
|