tsdown 0.18.0 → 0.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config.d.mts +13 -3
- package/dist/{index-JmTA8ZMA.d.mts → index-CxBVIi0h.d.mts} +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +2 -2
- package/dist/{package-CE44tUXo.mjs → package-Db0DU5Ct.mjs} +1 -1
- package/dist/plugins.d.mts +1 -1
- package/dist/plugins.mjs +2 -2
- package/dist/run.mjs +1 -1
- package/dist/{src-gll494UH.mjs → src-Bln7Ytss.mjs} +25 -16
- package/package.json +16 -14
- package/dist/config-FoWTJggg.d.mts +0 -13
package/dist/config.d.mts
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
-
import { f as UserConfig, m as UserConfigFn, p as UserConfigExport } from "./index-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { f as UserConfig, m as UserConfigFn, p as UserConfigExport } from "./index-CxBVIi0h.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/config.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Defines the configuration for tsdown.
|
|
7
|
+
*/
|
|
8
|
+
declare function defineConfig(options: UserConfig): UserConfig;
|
|
9
|
+
declare function defineConfig(options: UserConfig[]): UserConfig[];
|
|
10
|
+
declare function defineConfig(options: UserConfigFn): UserConfigFn;
|
|
11
|
+
declare function defineConfig(options: UserConfigExport): UserConfigExport;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { type UserConfig, type UserConfigExport, type UserConfigFn, defineConfig };
|
|
@@ -552,7 +552,7 @@ interface UserConfig {
|
|
|
552
552
|
*/
|
|
553
553
|
globImport?: boolean;
|
|
554
554
|
/**
|
|
555
|
-
*
|
|
555
|
+
* Generate package exports for `package.json`.
|
|
556
556
|
*
|
|
557
557
|
* This will set the `main`, `module`, `types`, `exports` fields in `package.json`
|
|
558
558
|
* to point to the generated files.
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as OutExtensionObject, C as TsdownBundle, D as ChunkAddonObject, E as ChunkAddonFunction, F as TsdownHooks, I as DebugOptions, L as CopyEntry, M as PackageType, N as BuildContext, O as OutExtensionContext, P as RolldownContext, R as CopyOptions, S as RolldownChunk, T as ChunkAddon, _ as ReportOptions, a as NoExternalFn, b as globalLogger, c as ResolvedConfig, d as UnusedOptions, f as UserConfig, g as Workspace, h as WithEnabled, i as InlineConfig, j as PackageJsonWithPath, k as OutExtensionFactory, l as Sourcemap, m as UserConfigFn, n as DtsOptions, o as NormalizedFormat, p as UserConfigExport, r as Format, s as PublintOptions, t as CIOption, u as TreeshakingOptions, w as AttwOptions, x as ExportsOptions, y as Logger, z as CopyOptionsFn } from "./index-
|
|
2
|
-
import {
|
|
1
|
+
import { A as OutExtensionObject, C as TsdownBundle, D as ChunkAddonObject, E as ChunkAddonFunction, F as TsdownHooks, I as DebugOptions, L as CopyEntry, M as PackageType, N as BuildContext, O as OutExtensionContext, P as RolldownContext, R as CopyOptions, S as RolldownChunk, T as ChunkAddon, _ as ReportOptions, a as NoExternalFn, b as globalLogger, c as ResolvedConfig, d as UnusedOptions, f as UserConfig, g as Workspace, h as WithEnabled, i as InlineConfig, j as PackageJsonWithPath, k as OutExtensionFactory, l as Sourcemap, m as UserConfigFn, n as DtsOptions, o as NormalizedFormat, p as UserConfigExport, r as Format, s as PublintOptions, t as CIOption, u as TreeshakingOptions, w as AttwOptions, x as ExportsOptions, y as Logger, z as CopyOptionsFn } from "./index-CxBVIi0h.mjs";
|
|
2
|
+
import { defineConfig } from "./config.mjs";
|
|
3
3
|
import * as Rolldown from "rolldown";
|
|
4
4
|
|
|
5
5
|
//#region src/index.d.ts
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as defineConfig } from "./config-DLSWqKoz.mjs";
|
|
2
|
-
import { i as shimFile, n as build, r as buildSingle, t as Rolldown } from "./src-
|
|
3
|
-
import { o as globalLogger } from "./package-
|
|
2
|
+
import { i as shimFile, n as build, r as buildSingle, t as Rolldown } from "./src-Bln7Ytss.mjs";
|
|
3
|
+
import { o as globalLogger } from "./package-Db0DU5Ct.mjs";
|
|
4
4
|
|
|
5
5
|
export { Rolldown, build, buildSingle, defineConfig, globalLogger, shimFile };
|
|
@@ -161,7 +161,7 @@ function hue2rgb(p, q, t) {
|
|
|
161
161
|
|
|
162
162
|
//#endregion
|
|
163
163
|
//#region package.json
|
|
164
|
-
var version = "0.18.
|
|
164
|
+
var version = "0.18.1";
|
|
165
165
|
|
|
166
166
|
//#endregion
|
|
167
167
|
export { getNameLabel as a, importWithError as c, pkgExists as d, promiseWithResolvers as f, toArray as g, slash as h, generateColor as i, matchPattern as l, resolveRegex as m, LogLevels as n, globalLogger as o, resolveComma as p, createLogger as r, prettyFormat as s, version as t, noop as u };
|
package/dist/plugins.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as TsdownBundle, c as ResolvedConfig, v as ReportPlugin, y as Logger } from "./index-
|
|
1
|
+
import { C as TsdownBundle, c as ResolvedConfig, v as ReportPlugin, y as Logger } from "./index-CxBVIi0h.mjs";
|
|
2
2
|
import { Plugin } from "rolldown";
|
|
3
3
|
|
|
4
4
|
//#region src/features/external.d.ts
|
package/dist/plugins.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as WatchPlugin, c as NodeProtocolPlugin, l as ExternalPlugin, o as ShebangPlugin, s as ReportPlugin } from "./src-
|
|
2
|
-
import "./package-
|
|
1
|
+
import { a as WatchPlugin, c as NodeProtocolPlugin, l as ExternalPlugin, o as ShebangPlugin, s as ReportPlugin } from "./src-Bln7Ytss.mjs";
|
|
2
|
+
import "./package-Db0DU5Ct.mjs";
|
|
3
3
|
|
|
4
4
|
export { ExternalPlugin, NodeProtocolPlugin, ReportPlugin, ShebangPlugin, WatchPlugin };
|
package/dist/run.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { g as toArray, o as globalLogger, p as resolveComma, t as version } from "./package-
|
|
2
|
+
import { g as toArray, o as globalLogger, p as resolveComma, t as version } from "./package-Db0DU5Ct.mjs";
|
|
3
3
|
import module from "node:module";
|
|
4
4
|
import { dim } from "ansis";
|
|
5
5
|
import { VERSION } from "rolldown";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createRequire as __cjs_createRequire } from "node:module";
|
|
2
2
|
const __cjs_require = __cjs_createRequire(import.meta.url);
|
|
3
|
-
import { a as getNameLabel, c as importWithError, d as pkgExists, f as promiseWithResolvers, g as toArray, h as slash, i as generateColor, l as matchPattern, m as resolveRegex, n as LogLevels, o as globalLogger, p as resolveComma, r as createLogger, s as prettyFormat, t as version, u as noop } from "./package-
|
|
3
|
+
import { a as getNameLabel, c as importWithError, d as pkgExists, f as promiseWithResolvers, g as toArray, h as slash, i as generateColor, l as matchPattern, m as resolveRegex, n as LogLevels, o as globalLogger, p as resolveComma, r as createLogger, s as prettyFormat, t as version, u as noop } from "./package-Db0DU5Ct.mjs";
|
|
4
4
|
import { builtinModules, isBuiltin } from "node:module";
|
|
5
|
-
import path, { dirname, join, normalize, sep } from "node:path";
|
|
5
|
+
import path, { dirname, extname, join, normalize, sep } from "node:path";
|
|
6
6
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
7
7
|
import { blue, bold, dim, green, underline } from "ansis";
|
|
8
8
|
import { clearRequireCache, init, isSupported } from "import-without-cache";
|
|
@@ -14,6 +14,7 @@ import process, { env } from "node:process";
|
|
|
14
14
|
import { createConfigCoreLoader } from "unconfig-core";
|
|
15
15
|
import { createDefu } from "defu";
|
|
16
16
|
import { glob, isDynamicPattern } from "tinyglobby";
|
|
17
|
+
const picomatch = __cjs_require("picomatch");
|
|
17
18
|
import { RE_CSS, RE_DTS, RE_JS, RE_NODE_MODULES } from "rolldown-plugin-dts/filename";
|
|
18
19
|
const minVersion = __cjs_require("semver/ranges/min-version.js");
|
|
19
20
|
import { up } from "empathic/find";
|
|
@@ -73,6 +74,11 @@ function lowestCommonAncestor(...filepaths) {
|
|
|
73
74
|
}
|
|
74
75
|
return ancestor.length <= 1 && ancestor[0] === "" ? sep + ancestor[0] : ancestor.join(sep);
|
|
75
76
|
}
|
|
77
|
+
function stripExtname(filePath) {
|
|
78
|
+
const ext = extname(filePath);
|
|
79
|
+
if (!ext.length) return filePath;
|
|
80
|
+
return filePath.slice(0, -ext.length);
|
|
81
|
+
}
|
|
76
82
|
|
|
77
83
|
//#endregion
|
|
78
84
|
//#region src/config/file.ts
|
|
@@ -264,7 +270,14 @@ async function resolveEntry(logger, entry, cwd, color, nameLabel) {
|
|
|
264
270
|
}
|
|
265
271
|
async function toObjectEntry(entry, cwd) {
|
|
266
272
|
if (typeof entry === "string") entry = [entry];
|
|
267
|
-
if (!Array.isArray(entry)) return entry
|
|
273
|
+
if (!Array.isArray(entry)) return Object.fromEntries((await Promise.all(Object.entries(entry).map(async ([key, value]) => {
|
|
274
|
+
if (!key.includes("*")) return [[key, value]];
|
|
275
|
+
const valueGlob = picomatch.scan(value);
|
|
276
|
+
return (await glob(value, {
|
|
277
|
+
cwd,
|
|
278
|
+
expandDirectories: false
|
|
279
|
+
})).map((file) => [slash(key.replaceAll("*", stripExtname(path.relative(valueGlob.base, file)))), path.resolve(cwd, file)]);
|
|
280
|
+
}))).flat());
|
|
268
281
|
const isGlob = entry.some((e) => isDynamicPattern(e));
|
|
269
282
|
let resolvedEntry;
|
|
270
283
|
if (isGlob) resolvedEntry = (await glob(entry, {
|
|
@@ -275,8 +288,7 @@ async function toObjectEntry(entry, cwd) {
|
|
|
275
288
|
else resolvedEntry = entry;
|
|
276
289
|
const base = lowestCommonAncestor(...resolvedEntry);
|
|
277
290
|
return Object.fromEntries(resolvedEntry.map((file) => {
|
|
278
|
-
|
|
279
|
-
return [slash(relative.slice(0, relative.length - path.extname(relative).length)), file];
|
|
291
|
+
return [slash(stripExtname(path.relative(base, file))), file];
|
|
280
292
|
}));
|
|
281
293
|
}
|
|
282
294
|
|
|
@@ -331,8 +343,7 @@ async function generateExports(pkg, chunks, { devExports, all, exclude, customEx
|
|
|
331
343
|
const onlyOneEntry = filteredChunks.filter((chunk) => !RE_DTS.test(chunk.fileName)).length === 1;
|
|
332
344
|
for (const chunk of filteredChunks) {
|
|
333
345
|
const normalizedName = slash(chunk.fileName);
|
|
334
|
-
|
|
335
|
-
let name = normalizedName.slice(0, -ext.length);
|
|
346
|
+
let name = stripExtname(normalizedName);
|
|
336
347
|
const isDts = name.endsWith(".d");
|
|
337
348
|
if (isDts) name = name.slice(0, -2);
|
|
338
349
|
const isIndex = onlyOneEntry || name === "index";
|
|
@@ -1170,10 +1181,9 @@ function createChunkFilename(basename, jsExtension, dtsExtension) {
|
|
|
1170
1181
|
return `${basename}${chunk.name.endsWith(".d") ? dtsExtension : jsExtension}`;
|
|
1171
1182
|
};
|
|
1172
1183
|
}
|
|
1173
|
-
function resolveChunkAddon(chunkAddon, format
|
|
1184
|
+
function resolveChunkAddon(chunkAddon, format) {
|
|
1174
1185
|
if (!chunkAddon) return;
|
|
1175
1186
|
return (chunk) => {
|
|
1176
|
-
if (!dts && RE_DTS.test(chunk.fileName)) return "";
|
|
1177
1187
|
if (typeof chunkAddon === "function") chunkAddon = chunkAddon({
|
|
1178
1188
|
format,
|
|
1179
1189
|
fileName: chunk.fileName
|
|
@@ -1348,7 +1358,7 @@ async function getBuildOptions(config, format, configFiles, bundle, cjsDts = fal
|
|
|
1348
1358
|
return rolldownConfig;
|
|
1349
1359
|
}
|
|
1350
1360
|
async function resolveInputOptions(config, format, configFiles, bundle, cjsDts, isDualFormat) {
|
|
1351
|
-
const { alias,
|
|
1361
|
+
const { alias, cjsDefault, cwd, debug: debug$10, dts, entry, env: env$1, external, globImport, loader, logger, nameLabel, nodeProtocol, platform, plugins: userPlugins, report, shims, target, treeshake, tsconfig, unused, watch: watch$1 } = config;
|
|
1352
1362
|
const plugins = [];
|
|
1353
1363
|
if (nodeProtocol) plugins.push(NodeProtocolPlugin(nodeProtocol));
|
|
1354
1364
|
if (config.pkg || config.skipNodeModulesBundle) plugins.push(ExternalPlugin(config));
|
|
@@ -1356,8 +1366,6 @@ async function resolveInputOptions(config, format, configFiles, bundle, cjsDts,
|
|
|
1356
1366
|
const { dts: dtsPlugin } = await import("rolldown-plugin-dts");
|
|
1357
1367
|
const options = {
|
|
1358
1368
|
tsconfig,
|
|
1359
|
-
banner: resolveChunkAddon(banner, format, true),
|
|
1360
|
-
footer: resolveChunkAddon(footer, format, true),
|
|
1361
1369
|
...dts
|
|
1362
1370
|
};
|
|
1363
1371
|
if (format === "es") plugins.push(dtsPlugin(options));
|
|
@@ -1412,11 +1420,12 @@ async function resolveInputOptions(config, format, configFiles, bundle, cjsDts,
|
|
|
1412
1420
|
if (log.code === "MIXED_EXPORT") return;
|
|
1413
1421
|
defaultHandler(level, log);
|
|
1414
1422
|
} : void 0,
|
|
1415
|
-
debug: debug$10 || void 0
|
|
1423
|
+
debug: debug$10 || void 0,
|
|
1424
|
+
checks: { pluginTimings: false }
|
|
1416
1425
|
}, config.inputOptions, [format, { cjsDts }]);
|
|
1417
1426
|
}
|
|
1418
1427
|
async function resolveOutputOptions(inputOptions, config, format, cjsDts) {
|
|
1419
|
-
const {
|
|
1428
|
+
const { banner, cjsDefault, entry, footer, minify, outDir, sourcemap, unbundle } = config;
|
|
1420
1429
|
const [entryFileNames, chunkFileNames] = resolveChunkFilename(config, inputOptions, format);
|
|
1421
1430
|
return await mergeUserOptions({
|
|
1422
1431
|
format: cjsDts ? "es" : format,
|
|
@@ -1429,8 +1438,8 @@ async function resolveOutputOptions(inputOptions, config, format, cjsDts) {
|
|
|
1429
1438
|
chunkFileNames,
|
|
1430
1439
|
preserveModules: unbundle,
|
|
1431
1440
|
preserveModulesRoot: unbundle ? lowestCommonAncestor(...Object.values(entry)) : void 0,
|
|
1432
|
-
|
|
1433
|
-
|
|
1441
|
+
postBanner: resolveChunkAddon(banner, format),
|
|
1442
|
+
postFooter: resolveChunkAddon(footer, format)
|
|
1434
1443
|
}, config.outputOptions, [format, { cjsDts }]);
|
|
1435
1444
|
}
|
|
1436
1445
|
async function getDebugRolldownDir() {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tsdown",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.18.
|
|
4
|
+
"version": "0.18.1",
|
|
5
5
|
"description": "The Elegant Bundler for Libraries",
|
|
6
6
|
"author": "Kevin Deng <sxzz@sxzz.moe>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
51
|
"@arethetypeswrong/core": "^0.18.1",
|
|
52
|
-
"@vitejs/devtools": "
|
|
52
|
+
"@vitejs/devtools": "*",
|
|
53
53
|
"publint": "^0.3.0",
|
|
54
54
|
"typescript": "^5.0.0",
|
|
55
55
|
"unplugin-lightningcss": "^0.4.0",
|
|
@@ -81,32 +81,34 @@
|
|
|
81
81
|
"defu": "^6.1.4",
|
|
82
82
|
"empathic": "^2.0.0",
|
|
83
83
|
"hookable": "^5.5.3",
|
|
84
|
-
"import-without-cache": "^0.2.
|
|
84
|
+
"import-without-cache": "^0.2.4",
|
|
85
85
|
"obug": "^2.1.1",
|
|
86
|
-
"
|
|
87
|
-
"rolldown
|
|
86
|
+
"picomatch": "^4.0.3",
|
|
87
|
+
"rolldown": "1.0.0-beta.55",
|
|
88
|
+
"rolldown-plugin-dts": "^0.19.1",
|
|
88
89
|
"semver": "^7.7.3",
|
|
89
90
|
"tinyexec": "^1.0.2",
|
|
90
91
|
"tinyglobby": "^0.2.15",
|
|
91
92
|
"tree-kill": "^1.2.2",
|
|
92
93
|
"unconfig-core": "^7.4.2",
|
|
93
|
-
"unrun": "^0.2.
|
|
94
|
+
"unrun": "^0.2.20"
|
|
94
95
|
},
|
|
95
96
|
"devDependencies": {
|
|
96
97
|
"@arethetypeswrong/core": "^0.18.2",
|
|
97
98
|
"@sxzz/eslint-config": "^7.4.3",
|
|
98
99
|
"@sxzz/prettier-config": "^2.2.6",
|
|
99
|
-
"@sxzz/test-utils": "^0.5.
|
|
100
|
-
"@types/node": "^25.0.
|
|
100
|
+
"@sxzz/test-utils": "^0.5.15",
|
|
101
|
+
"@types/node": "^25.0.3",
|
|
102
|
+
"@types/picomatch": "^4.0.2",
|
|
101
103
|
"@types/semver": "^7.7.1",
|
|
102
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
104
|
+
"@typescript/native-preview": "7.0.0-dev.20251217.1",
|
|
103
105
|
"@unocss/eslint-plugin": "^66.5.10",
|
|
104
|
-
"@vitejs/devtools": "^0.0.0-alpha.
|
|
105
|
-
"@vitest/coverage-v8": "4.0.
|
|
106
|
-
"@vitest/ui": "^4.0.
|
|
106
|
+
"@vitejs/devtools": "^0.0.0-alpha.20",
|
|
107
|
+
"@vitest/coverage-v8": "4.0.16",
|
|
108
|
+
"@vitest/ui": "^4.0.16",
|
|
107
109
|
"@vueuse/core": "^14.1.0",
|
|
108
110
|
"bumpp": "^10.3.2",
|
|
109
|
-
"dedent": "^1.7.
|
|
111
|
+
"dedent": "^1.7.1",
|
|
110
112
|
"eslint": "^9.39.2",
|
|
111
113
|
"is-in-ci": "^2.0.0",
|
|
112
114
|
"lightningcss": "^1.30.2",
|
|
@@ -120,7 +122,7 @@
|
|
|
120
122
|
"unplugin-lightningcss": "^0.4.3",
|
|
121
123
|
"unplugin-unused": "^0.5.6",
|
|
122
124
|
"vite": "^8.0.0-beta.2",
|
|
123
|
-
"vitest": "^4.0.
|
|
125
|
+
"vitest": "^4.0.16"
|
|
124
126
|
},
|
|
125
127
|
"prettier": "@sxzz/prettier-config",
|
|
126
128
|
"scripts": {
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { f as UserConfig, m as UserConfigFn, p as UserConfigExport } from "./index-JmTA8ZMA.mjs";
|
|
2
|
-
|
|
3
|
-
//#region src/config.d.ts
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Defines the configuration for tsdown.
|
|
7
|
-
*/
|
|
8
|
-
declare function defineConfig(options: UserConfig): UserConfig;
|
|
9
|
-
declare function defineConfig(options: UserConfig[]): UserConfig[];
|
|
10
|
-
declare function defineConfig(options: UserConfigFn): UserConfigFn;
|
|
11
|
-
declare function defineConfig(options: UserConfigExport): UserConfigExport;
|
|
12
|
-
//#endregion
|
|
13
|
-
export { defineConfig as t };
|