tsdown 0.22.3 → 0.22.4
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-CXv0CAc1.mjs} +11 -9
- package/dist/{config-BJZDmsYq.d.mts → config-OWDxm8p5.d.mts} +8 -9
- package/dist/config.d.mts +2 -2
- package/dist/config.mjs +1 -1
- package/dist/{debug-DLdR-9XB.mjs → debug-CeGbjKZM.mjs} +1 -1
- package/dist/{detect-B97OSl92.mjs → detect-BNXt7gkp.mjs} +8 -3
- package/dist/{format-DMceewlS.mjs → format-COa2pUTn.mjs} +2 -2
- package/dist/{index-C0LaRpVv.d.mts → index-4SbnPhas.d.mts} +3 -10
- package/dist/index.d.mts +14 -12
- package/dist/index.mjs +7 -4
- package/dist/internal.d.mts +1 -2
- package/dist/{options-Ce3ueyZH.mjs → options-BFfWGQT3.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-BmQCl9Kc.d.mts +1129 -0
- package/dist/{watch-C3ocHLCt.mjs → watch-CvXOpI62.mjs} +1 -1
- package/package.json +32 -32
- 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 { a as shimsDefine, i as getShimsInject, n as DepsPlugin, o as shimsPlugin } from "./format-
|
|
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-BFfWGQT3.mjs";
|
|
7
|
+
import { a as shimsDefine, i as getShimsInject, n as DepsPlugin, o as shimsPlugin } from "./format-COa2pUTn.mjs";
|
|
8
|
+
import { n as version } from "./debug-CeGbjKZM.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-CvXOpI62.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);
|
|
@@ -487,6 +487,7 @@ async function getBuildOptions(config, format, configDeps, bundle, cjsDts = fals
|
|
|
487
487
|
}
|
|
488
488
|
async function resolveInputOptions(config, format, configDeps, bundle, cjsDts, isDualFormat) {
|
|
489
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, unbundle, 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);
|
|
@@ -555,6 +556,7 @@ async function resolveInputOptions(config, format, configDeps, bundle, cjsDts, i
|
|
|
555
556
|
return (importer ? RE_DTS.test(importer) : false) ? dtsExternal(id, importer, ...args) : void 0;
|
|
556
557
|
};
|
|
557
558
|
else external = deps.neverBundle;
|
|
559
|
+
const logLevel = logger.options?.failOnWarn && loggerLevelIndex < 2 ? "warn" : logger.level === "error" ? "silent" : logger.level;
|
|
558
560
|
return await mergeUserOptions({
|
|
559
561
|
input: entry,
|
|
560
562
|
cwd,
|
|
@@ -573,7 +575,7 @@ async function resolveInputOptions(config, format, configDeps, bundle, cjsDts, i
|
|
|
573
575
|
".node": "copy",
|
|
574
576
|
...loader
|
|
575
577
|
},
|
|
576
|
-
logLevel
|
|
578
|
+
logLevel,
|
|
577
579
|
onLog(level, log, defaultHandler) {
|
|
578
580
|
if (cjsDefault && log.code === "MIXED_EXPORT") return;
|
|
579
581
|
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-BmQCl9Kc.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-BmQCl9Kc.mjs";
|
|
2
|
+
import { n as mergeConfig, t as defineConfig } from "./config-OWDxm8p5.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.4";
|
|
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);
|
|
@@ -123,7 +123,7 @@ function DepsPlugin({ pkg, deps: { alwaysBundle: jsAlwaysBundle, onlyBundle, ski
|
|
|
123
123
|
if (!tsdownBundle.inlinedDeps.has(parsed.pkgName)) tsdownBundle.inlinedDeps.set(parsed.pkgName, /* @__PURE__ */ new Set());
|
|
124
124
|
tsdownBundle.inlinedDeps.get(parsed.pkgName).add(parsed.version);
|
|
125
125
|
const module = this.getModuleInfo(id);
|
|
126
|
-
if (module) importers.set(parsed.name, new Set([...module.importers, ...importers.get(parsed.name) || []]));
|
|
126
|
+
if (module) importers.set(parsed.name, /* @__PURE__ */ new Set([...module.importers, ...importers.get(parsed.name) || []]));
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
129
|
debug("found deps in bundle: %o", deps);
|
|
@@ -217,7 +217,7 @@ async function resolveDepSubpath(id, resolved) {
|
|
|
217
217
|
return result;
|
|
218
218
|
}
|
|
219
219
|
function getProductionDeps(pkg) {
|
|
220
|
-
return new Set([
|
|
220
|
+
return /* @__PURE__ */ new Set([
|
|
221
221
|
...Object.keys(pkg.dependencies || {}),
|
|
222
222
|
...Object.keys(pkg.peerDependencies || {}),
|
|
223
223
|
...Object.keys(pkg.optionalDependencies || {})
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { InternalModuleFormat } from "rolldown";
|
|
2
|
-
|
|
3
2
|
//#region src/utils/types.d.ts
|
|
4
3
|
type Overwrite<T, U> = Omit<T, keyof U> & U;
|
|
5
4
|
type Awaitable<T> = T | Promise<T>;
|
|
@@ -308,7 +307,7 @@ type PackageJsonNpmLifeCycleScripts = "dependencies" | "prepublishOnly" | Packag
|
|
|
308
307
|
type PackageJsonPnpmLifeCycleScripts = "pnpm:devPreinstall";
|
|
309
308
|
type PackageJsonCommonScripts = "build" | "coverage" | "deploy" | "dev" | "format" | "lint" | "preview" | "release" | "typecheck" | "watch";
|
|
310
309
|
type PackageJsonScriptName = PackageJsonCommonScripts | PackageJsonNpmLifeCycleScripts | PackageJsonPnpmLifeCycleScripts | (string & {});
|
|
311
|
-
type PackageJsonScripts = { [P in PackageJsonScriptName]?: string };
|
|
310
|
+
type PackageJsonScripts = { [P in PackageJsonScriptName]?: string; };
|
|
312
311
|
/**
|
|
313
312
|
* A “person” is an object with a “name” field and optionally “url” and “email”. Or you can shorten that all into a single string, and npm will parse it for you.
|
|
314
313
|
*/
|
|
@@ -322,13 +321,7 @@ type PackageJsonFunding = string | {
|
|
|
322
321
|
type?: string;
|
|
323
322
|
};
|
|
324
323
|
type PackageJsonExportKey = "." | "import" | "require" | "types" | "node" | "browser" | "default" | (string & {});
|
|
325
|
-
type PackageJsonExportsObject = { [P in PackageJsonExportKey]?: string | PackageJsonExportsObject | Array<string | PackageJsonExportsObject
|
|
326
|
-
type PackageJsonExports = string | PackageJsonExportsObject | Array<string | PackageJsonExportsObject>;
|
|
327
|
-
//#region src/packagejson/utils.d.ts
|
|
328
|
-
/**
|
|
329
|
-
* Defines a PackageJson structure.
|
|
330
|
-
* @param pkg - The `package.json` content as an object. See {@link PackageJson}.
|
|
331
|
-
* @returns the same `package.json` object.
|
|
332
|
-
*/
|
|
324
|
+
type PackageJsonExportsObject = { [P in PackageJsonExportKey]?: string | PackageJsonExportsObject | Array<string | PackageJsonExportsObject>; };
|
|
325
|
+
type PackageJsonExports = string | PackageJsonExportsObject | Array<string | PackageJsonExportsObject>;
|
|
333
326
|
//#endregion
|
|
334
327
|
export { Arrayable as a, Overwrite as c, globalLogger as i, LogLevel as n, Awaitable as o, Logger as r, MarkPartial as s, PackageJson as t };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,22 +1,24 @@
|
|
|
1
|
-
import { a as Arrayable, i as globalLogger, r as Logger } from "./index-
|
|
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 { a as Arrayable, i as globalLogger, r as Logger } from "./index-4SbnPhas.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-BmQCl9Kc.mjs";
|
|
3
|
+
import { n as mergeConfig, r as resolveUserConfig, t as defineConfig } from "./config-OWDxm8p5.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-CXv0CAc1.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-BFfWGQT3.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-CeGbjKZM.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 { c as Overwrite, r as Logger, s as MarkPartial } from "./index-
|
|
2
|
-
|
|
1
|
+
import { c as Overwrite, r as Logger, s as MarkPartial } from "./index-4SbnPhas.mjs";
|
|
3
2
|
//#region src/features/target.d.ts
|
|
4
3
|
declare function expandBaselineTarget(targets: string[]): string[];
|
|
5
4
|
//#endregion
|
|
@@ -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-COa2pUTn.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 { r as Logger } from "./index-
|
|
2
|
-
import { H as TsdownBundle, R as DepsPlugin, _ as ReportPlugin } from "./types-
|
|
1
|
+
import { r as Logger } from "./index-4SbnPhas.mjs";
|
|
2
|
+
import { H as TsdownBundle, R as DepsPlugin, _ as ReportPlugin } from "./types-BmQCl9Kc.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-COa2pUTn.mjs";
|
|
2
|
+
import { a as ReportPlugin, i as ShebangPlugin, o as NodeProtocolPlugin, t as WatchPlugin } from "./watch-CvXOpI62.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-CeGbjKZM.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-CXv0CAc1.mjs").then((n) => n.r);
|
|
20
20
|
if (input.length > 0) flags.entry = input;
|
|
21
21
|
await build(flags);
|
|
22
22
|
});
|