tsdown 0.9.6 → 0.9.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{config.d-DOpadTUl.d.ts → config.d-jKttq4Nu.d.ts} +1 -1
- package/dist/config.d.ts +2 -2
- package/dist/general-C06aMSSY.js +38 -0
- package/dist/index.d.ts +2 -3
- package/dist/index.js +33 -17
- package/dist/{migrate-B7KTdsUd.js → migrate-Cr0H4OLK.js} +1 -1
- package/dist/{options.d-VgsCNgLk.d.ts → options.d-DVjImwcI.d.ts} +11 -0
- package/dist/package-B5RDOoPA.js +5 -0
- package/dist/{plugins-DU1CCXkW.js → plugins-BcuTSrGE.js} +13 -36
- package/dist/plugins.d.ts +1 -1
- package/dist/plugins.js +2 -2
- package/dist/run.js +18 -4
- package/package.json +2 -2
- package/dist/logger-Dt3D6T-U.js +0 -16
- package/dist/package-B1O-I_4B.js +0 -5
package/dist/config.d.ts
CHANGED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import process from "node:process";
|
|
2
|
+
import { consola } from "consola";
|
|
3
|
+
|
|
4
|
+
//#region src/utils/logger.ts
|
|
5
|
+
/**
|
|
6
|
+
* Logger instance
|
|
7
|
+
*/
|
|
8
|
+
const logger = consola.withTag("tsdown");
|
|
9
|
+
function setSilent(silent) {
|
|
10
|
+
if (!("CONSOLA_LEVEL" in process.env)) logger.level = silent ? 0 : 3;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/utils/general.ts
|
|
15
|
+
function toArray(val, defaultValue) {
|
|
16
|
+
if (Array.isArray(val)) return val;
|
|
17
|
+
else if (val == null) {
|
|
18
|
+
if (defaultValue) return [defaultValue];
|
|
19
|
+
return [];
|
|
20
|
+
} else return [val];
|
|
21
|
+
}
|
|
22
|
+
function resolveComma(arr) {
|
|
23
|
+
return arr.flatMap((format) => format.split(","));
|
|
24
|
+
}
|
|
25
|
+
function debounce(fn, wait) {
|
|
26
|
+
let timeout;
|
|
27
|
+
return function(...args) {
|
|
28
|
+
if (timeout) clearTimeout(timeout);
|
|
29
|
+
timeout = setTimeout(() => {
|
|
30
|
+
timeout = void 0;
|
|
31
|
+
fn.apply(this, args);
|
|
32
|
+
}, wait);
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
const noop = (v) => v;
|
|
36
|
+
|
|
37
|
+
//#endregion
|
|
38
|
+
export { debounce, logger, noop, resolveComma, setSilent, toArray };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { BuildContext, Options, ResolvedOptions, TsdownHooks, UserConfig } from "./options.d-
|
|
2
|
-
import { defineConfig$1 as defineConfig } from "./config.d-
|
|
3
|
-
import Debug from "debug";
|
|
1
|
+
import { BuildContext, Options, ResolvedOptions, TsdownHooks, UserConfig } from "./options.d-DVjImwcI.js";
|
|
2
|
+
import { defineConfig$1 as defineConfig } from "./config.d-jKttq4Nu.js";
|
|
4
3
|
import { ConsolaInstance } from "consola";
|
|
5
4
|
|
|
6
5
|
//#region src/utils/logger.d.ts
|
package/dist/index.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { defineConfig } from "./config-yiJy1jd0.js";
|
|
2
|
-
import { ExternalPlugin, ReportPlugin, ShebangPlugin,
|
|
3
|
-
import {
|
|
2
|
+
import { ExternalPlugin, ReportPlugin, ShebangPlugin, fsExists, fsRemove, getPackageType, lowestCommonAncestor, normalizeFormat, prettyFormat, readPackageJson } from "./plugins-BcuTSrGE.js";
|
|
3
|
+
import { debounce, logger, resolveComma, setSilent, toArray } from "./general-C06aMSSY.js";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import process from "node:process";
|
|
6
6
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
7
7
|
import { blue, bold, dim, green, underline } from "ansis";
|
|
8
|
+
import Debug from "debug";
|
|
8
9
|
import { build as build$1 } from "rolldown";
|
|
9
10
|
import { transformPlugin } from "rolldown/experimental";
|
|
10
11
|
import { exec } from "tinyexec";
|
|
11
12
|
import { readdir, stat } from "node:fs/promises";
|
|
12
|
-
import Debug from "debug";
|
|
13
13
|
import { glob } from "tinyglobby";
|
|
14
14
|
import { createHooks } from "hookable";
|
|
15
|
-
import { findUp } from "find-up-simple";
|
|
16
15
|
import readline from "node:readline";
|
|
17
16
|
import { loadConfig } from "unconfig";
|
|
17
|
+
import { up } from "empathic/find";
|
|
18
18
|
|
|
19
19
|
//#region src/features/clean.ts
|
|
20
20
|
const debug$2 = Debug("tsdown:clean");
|
|
@@ -175,11 +175,13 @@ function shortcuts(restart) {
|
|
|
175
175
|
//#region src/features/watch.ts
|
|
176
176
|
const endsWithPackageJson = /[\\/]package\.json$/;
|
|
177
177
|
async function watchBuild(options, configFile, rebuild, restart) {
|
|
178
|
-
const
|
|
179
|
-
|
|
180
|
-
const files = toArray(typeof options.watch === "boolean" ?
|
|
178
|
+
const cwd = process.cwd();
|
|
179
|
+
if (typeof options.watch === "boolean" && options.outDir === cwd) throw new Error("Watch is enabled, but output directory is the same as the current working directory.Please specify a different watch directory using `watch` option,or set `outDir` to a different directory.");
|
|
180
|
+
const files = toArray(typeof options.watch === "boolean" ? cwd : options.watch);
|
|
181
181
|
logger.info(`Watching for changes in ${files.join(", ")}`);
|
|
182
182
|
if (configFile) files.push(configFile);
|
|
183
|
+
const { watch } = await import("chokidar");
|
|
184
|
+
const debouncedRebuild = debounce(rebuild, 100);
|
|
183
185
|
const watcher = watch(files, {
|
|
184
186
|
ignoreInitial: true,
|
|
185
187
|
ignorePermissionErrors: true,
|
|
@@ -224,8 +226,8 @@ async function toObjectEntry(entry, cwd) {
|
|
|
224
226
|
|
|
225
227
|
//#endregion
|
|
226
228
|
//#region src/utils/tsconfig.ts
|
|
227
|
-
|
|
228
|
-
return
|
|
229
|
+
function findTsconfig(cwd, name = "tsconfig.json") {
|
|
230
|
+
return up(name, { cwd }) || false;
|
|
229
231
|
}
|
|
230
232
|
|
|
231
233
|
//#endregion
|
|
@@ -238,14 +240,14 @@ async function resolveOptions(options) {
|
|
|
238
240
|
...subConfig,
|
|
239
241
|
...options
|
|
240
242
|
};
|
|
241
|
-
let { entry, format = ["es"], plugins = [], clean = false, silent = false, treeshake = true, platform = "node", outDir = "dist", sourcemap = false, dts = false, unused = false, watch = false, shims = false, skipNodeModulesBundle = false, publint: publint$1 = false, fromVite, alias, tsconfig, report = true, target } = subOptions;
|
|
243
|
+
let { entry, format = ["es"], plugins = [], clean = false, silent = false, treeshake = true, platform = "node", outDir = "dist", sourcemap = false, dts = false, unused = false, watch = false, shims = false, skipNodeModulesBundle = false, publint: publint$1 = false, fromVite, alias, tsconfig, report = true, target, env = {} } = subOptions;
|
|
242
244
|
entry = await resolveEntry(entry, cwd);
|
|
243
245
|
if (clean === true) clean = [];
|
|
244
246
|
if (publint$1 === true) publint$1 = {};
|
|
245
247
|
if (tsconfig !== false) {
|
|
246
248
|
if (tsconfig === true || tsconfig == null) {
|
|
247
249
|
const isSet = tsconfig;
|
|
248
|
-
tsconfig =
|
|
250
|
+
tsconfig = findTsconfig(cwd);
|
|
249
251
|
if (isSet && !tsconfig) logger.warn(`No tsconfig found in \`${cwd}\``);
|
|
250
252
|
} else {
|
|
251
253
|
const tsconfigPath = path.resolve(cwd, tsconfig);
|
|
@@ -254,7 +256,7 @@ async function resolveOptions(options) {
|
|
|
254
256
|
logger.warn(`tsconfig \`${tsconfig}\` doesn't exist`);
|
|
255
257
|
tsconfig = false;
|
|
256
258
|
} else {
|
|
257
|
-
tsconfig =
|
|
259
|
+
tsconfig = findTsconfig(cwd, tsconfig);
|
|
258
260
|
if (!tsconfig) logger.warn(`No \`${tsconfig}\` found in \`${cwd}\``);
|
|
259
261
|
}
|
|
260
262
|
}
|
|
@@ -290,7 +292,8 @@ async function resolveOptions(options) {
|
|
|
290
292
|
publint: publint$1,
|
|
291
293
|
alias,
|
|
292
294
|
tsconfig,
|
|
293
|
-
cwd
|
|
295
|
+
cwd,
|
|
296
|
+
env
|
|
294
297
|
};
|
|
295
298
|
return config;
|
|
296
299
|
}));
|
|
@@ -394,6 +397,7 @@ async function mergeUserOptions(defaults, user, args) {
|
|
|
394
397
|
|
|
395
398
|
//#endregion
|
|
396
399
|
//#region src/index.ts
|
|
400
|
+
const debug = Debug("tsdown:config");
|
|
397
401
|
/**
|
|
398
402
|
* Build with tsdown.
|
|
399
403
|
*/
|
|
@@ -401,8 +405,12 @@ async function build(userOptions = {}) {
|
|
|
401
405
|
if (typeof userOptions.silent === "boolean") setSilent(userOptions.silent);
|
|
402
406
|
debug("Loading config");
|
|
403
407
|
const { configs, file: configFile } = await resolveOptions(userOptions);
|
|
404
|
-
if (configFile)
|
|
405
|
-
|
|
408
|
+
if (configFile) {
|
|
409
|
+
debug("Loaded config:", configFile);
|
|
410
|
+
configs.forEach((config) => {
|
|
411
|
+
debug("using resolved config: %O", config);
|
|
412
|
+
});
|
|
413
|
+
} else debug("No config file found");
|
|
406
414
|
const rebuilds = await Promise.all(configs.map(buildSingle));
|
|
407
415
|
const cleanCbs = [];
|
|
408
416
|
for (const [i, config] of configs.entries()) {
|
|
@@ -475,7 +483,7 @@ async function buildSingle(config) {
|
|
|
475
483
|
}
|
|
476
484
|
}
|
|
477
485
|
async function getBuildOptions(config, pkg, format, cjsDts) {
|
|
478
|
-
const { entry, external, plugins: userPlugins, outDir, platform, alias, treeshake, sourcemap, dts, minify, unused, target, define, shims, tsconfig, cwd, report } = config;
|
|
486
|
+
const { entry, external, plugins: userPlugins, outDir, platform, alias, treeshake, sourcemap, dts, minify, unused, target, define, shims, tsconfig, cwd, report, env } = config;
|
|
479
487
|
const plugins = [];
|
|
480
488
|
if (pkg || config.skipNodeModulesBundle) plugins.push(ExternalPlugin(config, pkg));
|
|
481
489
|
if (dts) {
|
|
@@ -514,7 +522,15 @@ async function getBuildOptions(config, pkg, format, cjsDts) {
|
|
|
514
522
|
},
|
|
515
523
|
treeshake,
|
|
516
524
|
platform,
|
|
517
|
-
define
|
|
525
|
+
define: {
|
|
526
|
+
...define,
|
|
527
|
+
...Object.keys(env).reduce((acc, key) => {
|
|
528
|
+
const value = JSON.stringify(env[key]);
|
|
529
|
+
acc[`process.env.${key}`] = value;
|
|
530
|
+
acc[`import.meta.env.${key}`] = value;
|
|
531
|
+
return acc;
|
|
532
|
+
}, Object.create(null))
|
|
533
|
+
},
|
|
518
534
|
plugins,
|
|
519
535
|
inject: { ...shims && !cjsDts && getShimsInject(format, platform) }
|
|
520
536
|
}, config.inputOptions, [format]);
|
|
@@ -169,6 +169,17 @@ interface Options$3 {
|
|
|
169
169
|
* @default true
|
|
170
170
|
*/
|
|
171
171
|
report?: boolean | ReportOptions;
|
|
172
|
+
/**
|
|
173
|
+
* Compile-time env variables.
|
|
174
|
+
* @example
|
|
175
|
+
* ```ts
|
|
176
|
+
* {
|
|
177
|
+
* "DEBUG": true,
|
|
178
|
+
* "NODE_ENV": "production"
|
|
179
|
+
* }
|
|
180
|
+
* ```
|
|
181
|
+
*/
|
|
182
|
+
env?: Record<string, any>;
|
|
172
183
|
hooks?: Partial<TsdownHooks> | ((hooks: Hookable<TsdownHooks>) => Awaitable<void>);
|
|
173
184
|
}
|
|
174
185
|
/**
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { logger, noop, resolveComma, toArray } from "./general-C06aMSSY.js";
|
|
2
2
|
import path, { dirname, normalize, sep } from "node:path";
|
|
3
3
|
import { blue, bold, dim, green, underline, yellow } from "ansis";
|
|
4
|
-
import { access, chmod, readFile, rm } from "node:fs/promises";
|
|
5
4
|
import Debug from "debug";
|
|
6
|
-
import {
|
|
5
|
+
import { access, chmod, readFile, rm } from "node:fs/promises";
|
|
6
|
+
import { up } from "empathic/package";
|
|
7
7
|
import { Buffer } from "node:buffer";
|
|
8
8
|
import { promisify } from "node:util";
|
|
9
9
|
import { brotliCompress, gzip } from "node:zlib";
|
|
@@ -37,30 +37,6 @@ function lowestCommonAncestor(...filepaths) {
|
|
|
37
37
|
return ancestor.length <= 1 && ancestor[0] === "" ? sep + ancestor[0] : ancestor.join(sep);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
//#endregion
|
|
41
|
-
//#region src/utils/general.ts
|
|
42
|
-
function toArray(val, defaultValue) {
|
|
43
|
-
if (Array.isArray(val)) return val;
|
|
44
|
-
else if (val == null) {
|
|
45
|
-
if (defaultValue) return [defaultValue];
|
|
46
|
-
return [];
|
|
47
|
-
} else return [val];
|
|
48
|
-
}
|
|
49
|
-
function resolveComma(arr) {
|
|
50
|
-
return arr.flatMap((format) => format.split(","));
|
|
51
|
-
}
|
|
52
|
-
function debounce(fn, wait) {
|
|
53
|
-
let timeout;
|
|
54
|
-
return function(...args) {
|
|
55
|
-
if (timeout) clearTimeout(timeout);
|
|
56
|
-
timeout = setTimeout(() => {
|
|
57
|
-
timeout = void 0;
|
|
58
|
-
fn.apply(this, args);
|
|
59
|
-
}, wait);
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
const noop = (v) => v;
|
|
63
|
-
|
|
64
40
|
//#endregion
|
|
65
41
|
//#region src/features/external.ts
|
|
66
42
|
const debug$2 = Debug("tsdown:external");
|
|
@@ -103,10 +79,11 @@ function getProductionDeps(pkg) {
|
|
|
103
79
|
|
|
104
80
|
//#endregion
|
|
105
81
|
//#region src/utils/package.ts
|
|
82
|
+
const debug$1 = Debug("tsdown:package");
|
|
106
83
|
async function readPackageJson(dir) {
|
|
107
|
-
const packageJsonPath =
|
|
84
|
+
const packageJsonPath = up({ cwd: dir });
|
|
108
85
|
if (!packageJsonPath) return;
|
|
109
|
-
debug("Reading package.json:", packageJsonPath);
|
|
86
|
+
debug$1("Reading package.json:", packageJsonPath);
|
|
110
87
|
const contents = await readFile(packageJsonPath, "utf8");
|
|
111
88
|
return JSON.parse(contents);
|
|
112
89
|
}
|
|
@@ -155,7 +132,7 @@ function formatBytes(bytes) {
|
|
|
155
132
|
|
|
156
133
|
//#endregion
|
|
157
134
|
//#region src/features/report.ts
|
|
158
|
-
const debug
|
|
135
|
+
const debug = Debug("tsdown:report");
|
|
159
136
|
const brotliCompressAsync = promisify(brotliCompress);
|
|
160
137
|
const gzipAsync = promisify(gzip);
|
|
161
138
|
const RE_DTS = /\.d\.[cm]?ts$/;
|
|
@@ -196,19 +173,19 @@ function ReportPlugin(options, cwd, cjsDts) {
|
|
|
196
173
|
};
|
|
197
174
|
}
|
|
198
175
|
async function calcSize(options, chunk) {
|
|
199
|
-
debug
|
|
176
|
+
debug(`Calculating size for`, chunk.fileName);
|
|
200
177
|
const content = chunk.type === "chunk" ? chunk.code : chunk.source;
|
|
201
178
|
const raw = Buffer.byteLength(content, "utf8");
|
|
202
|
-
debug
|
|
179
|
+
debug("[size]", chunk.fileName, raw);
|
|
203
180
|
let gzip$1 = Infinity;
|
|
204
181
|
let brotli = Infinity;
|
|
205
|
-
if (raw > (options.maxCompressSize ?? 1e6)) debug
|
|
182
|
+
if (raw > (options.maxCompressSize ?? 1e6)) debug(chunk.fileName, "file size exceeds limit, skip gzip/brotli");
|
|
206
183
|
else {
|
|
207
184
|
gzip$1 = (await gzipAsync(content)).length;
|
|
208
|
-
debug
|
|
185
|
+
debug("[gzip]", chunk.fileName, gzip$1);
|
|
209
186
|
if (options.brotli) {
|
|
210
187
|
brotli = (await brotliCompressAsync(content)).length;
|
|
211
|
-
debug
|
|
188
|
+
debug("[brotli]", chunk.fileName, brotli);
|
|
212
189
|
}
|
|
213
190
|
}
|
|
214
191
|
return {
|
|
@@ -245,4 +222,4 @@ function ShebangPlugin(cwd) {
|
|
|
245
222
|
}
|
|
246
223
|
|
|
247
224
|
//#endregion
|
|
248
|
-
export { ExternalPlugin, ReportPlugin, ShebangPlugin,
|
|
225
|
+
export { ExternalPlugin, ReportPlugin, ShebangPlugin, fsExists, fsRemove, getPackageType, lowestCommonAncestor, normalizeFormat, prettyFormat, readPackageJson };
|
package/dist/plugins.d.ts
CHANGED
package/dist/plugins.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ExternalPlugin, ReportPlugin, ShebangPlugin } from "./plugins-
|
|
2
|
-
import "./
|
|
1
|
+
import { ExternalPlugin, ReportPlugin, ShebangPlugin } from "./plugins-BcuTSrGE.js";
|
|
2
|
+
import "./general-C06aMSSY.js";
|
|
3
3
|
|
|
4
4
|
export { ExternalPlugin, ReportPlugin, ShebangPlugin };
|
package/dist/run.js
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { logger, setSilent } from "./
|
|
3
|
-
import { version } from "./package-
|
|
2
|
+
import { logger, resolveComma, setSilent, toArray } from "./general-C06aMSSY.js";
|
|
3
|
+
import { version } from "./package-B5RDOoPA.js";
|
|
4
4
|
import process from "node:process";
|
|
5
5
|
import { dim } from "ansis";
|
|
6
|
+
import Debug from "debug";
|
|
6
7
|
import { VERSION } from "rolldown";
|
|
8
|
+
import module from "node:module";
|
|
7
9
|
import { cac } from "cac";
|
|
8
10
|
|
|
9
11
|
//#region src/cli.ts
|
|
10
12
|
const cli = cac("tsdown");
|
|
11
13
|
cli.help().version(version);
|
|
12
|
-
cli.command("[...files]", "Bundle files", { ignoreOptionDefaultValue: true }).option("-c, --config <filename>", "Use a custom config file").option("--no-config", "Disable config file").option("--format <format>", "Bundle format: esm, cjs, iife", { default: "esm" }).option("--clean", "Clean output directory").option("--external <module>", "Mark dependencies as external").option("--minify", "Minify output").option("--target <target>", "Bundle target, e.g \"es2015\", \"esnext\"").option("--silent", "Suppress non-error logs").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", { default: false }).option("--publint", "Enable publint", { default: false }).option("--unused", "Enable unused dependencies check", { default: false }).option("-w, --watch [path]", "Watch mode").option("--from-vite [vitest]", "Reuse config from Vite or Vitest").option("--report", "Size report", { default: true }).action(async (input, flags) => {
|
|
14
|
+
cli.command("[...files]", "Bundle files", { ignoreOptionDefaultValue: true }).option("-c, --config <filename>", "Use a custom config file").option("--no-config", "Disable config file").option("--format <format>", "Bundle format: esm, cjs, iife", { default: "esm" }).option("--clean", "Clean output directory").option("--external <module>", "Mark dependencies as external").option("--minify", "Minify output").option("--debug [scope]", "Show debug logs").option("--target <target>", "Bundle target, e.g \"es2015\", \"esnext\"").option("--silent", "Suppress non-error logs").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", { default: false }).option("--publint", "Enable publint", { default: false }).option("--unused", "Enable unused dependencies check", { default: false }).option("-w, --watch [path]", "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").action(async (input, flags) => {
|
|
13
15
|
setSilent(!!flags.silent);
|
|
14
16
|
logger.info(`tsdown ${dim`v${version}`} powered by rolldown ${dim`v${VERSION}`}`);
|
|
15
17
|
const { build: build$1 } = await import("./index.js");
|
|
@@ -17,11 +19,20 @@ cli.command("[...files]", "Bundle files", { ignoreOptionDefaultValue: true }).op
|
|
|
17
19
|
await build$1(flags);
|
|
18
20
|
});
|
|
19
21
|
cli.command("migrate", "Migrate from tsup to tsdown").option("-c, --cwd <dir>", "Working directory").option("-d, --dry-run", "Dry run").action(async (args) => {
|
|
20
|
-
const { migrate } = await import("./migrate-
|
|
22
|
+
const { migrate } = await import("./migrate-Cr0H4OLK.js");
|
|
21
23
|
await migrate(args);
|
|
22
24
|
});
|
|
23
25
|
async function runCLI() {
|
|
24
26
|
cli.parse(process.argv, { run: false });
|
|
27
|
+
if (cli.options.debug) {
|
|
28
|
+
let namespace;
|
|
29
|
+
if (cli.options.debug === true) namespace = "tsdown:*";
|
|
30
|
+
else namespace = resolveComma(toArray(cli.options.debug)).map((v) => `tsdown:${v}`).join(",");
|
|
31
|
+
const enabled = Debug.disable();
|
|
32
|
+
if (enabled) namespace += `,${enabled}`;
|
|
33
|
+
Debug.enable(namespace);
|
|
34
|
+
Debug("tsdown:debug")("Debugging enabled", namespace);
|
|
35
|
+
}
|
|
25
36
|
try {
|
|
26
37
|
await cli.runMatchedCommand();
|
|
27
38
|
} catch (error) {
|
|
@@ -32,6 +43,9 @@ async function runCLI() {
|
|
|
32
43
|
|
|
33
44
|
//#endregion
|
|
34
45
|
//#region src/run.ts
|
|
46
|
+
try {
|
|
47
|
+
module.enableCompileCache?.();
|
|
48
|
+
} catch {}
|
|
35
49
|
runCLI();
|
|
36
50
|
|
|
37
51
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tsdown",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.7",
|
|
4
4
|
"description": "The Elegant Bundler for Libraries",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"consola": "^3.4.2",
|
|
61
61
|
"debug": "^4.4.0",
|
|
62
62
|
"diff": "^7.0.0",
|
|
63
|
-
"
|
|
63
|
+
"empathic": "^1.0.0",
|
|
64
64
|
"hookable": "^5.5.3",
|
|
65
65
|
"rolldown": "1.0.0-beta.8-commit.2686eb1",
|
|
66
66
|
"rolldown-plugin-dts": "^0.8.3",
|
package/dist/logger-Dt3D6T-U.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import process from "node:process";
|
|
2
|
-
import Debug from "debug";
|
|
3
|
-
import { consola } from "consola";
|
|
4
|
-
|
|
5
|
-
//#region src/utils/logger.ts
|
|
6
|
-
/**
|
|
7
|
-
* Logger instance
|
|
8
|
-
*/
|
|
9
|
-
const logger = consola.withTag("tsdown");
|
|
10
|
-
const debug = Debug("tsdown");
|
|
11
|
-
function setSilent(silent) {
|
|
12
|
-
if (!("CONSOLA_LEVEL" in process.env)) logger.level = silent ? 0 : 3;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
//#endregion
|
|
16
|
-
export { debug, logger, setSilent };
|