tsdown 0.17.3 → 0.18.0
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-AyGupPUp.d.mts → config-FoWTJggg.d.mts} +1 -1
- package/dist/config.d.mts +2 -2
- package/dist/{index-By1cRKOf.d.mts → index-JmTA8ZMA.d.mts} +21 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +2 -2
- package/dist/{package-C_J1HjlZ.mjs → package-CE44tUXo.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-CrcPAzch.mjs → src-gll494UH.mjs} +36 -16
- package/package.json +9 -7
package/dist/config.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { f as UserConfig, m as UserConfigFn, p as UserConfigExport } from "./index-
|
|
2
|
-
import { t as defineConfig } from "./config-
|
|
1
|
+
import { f as UserConfig, m as UserConfigFn, p as UserConfigExport } from "./index-JmTA8ZMA.mjs";
|
|
2
|
+
import { t as defineConfig } from "./config-FoWTJggg.mjs";
|
|
3
3
|
export { UserConfig, UserConfigExport, UserConfigFn, defineConfig };
|
|
@@ -28,9 +28,18 @@ interface CopyEntry {
|
|
|
28
28
|
/**
|
|
29
29
|
* Whether to flatten the copied files (not preserving directory structure).
|
|
30
30
|
*
|
|
31
|
-
* @default
|
|
31
|
+
* @default true
|
|
32
32
|
*/
|
|
33
33
|
flatten?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Output copied items to console.
|
|
36
|
+
* @default false
|
|
37
|
+
*/
|
|
38
|
+
verbose?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Change destination file or folder name.
|
|
41
|
+
*/
|
|
42
|
+
rename?: string | ((name: string, extension: string, fullPath: string) => string);
|
|
34
43
|
}
|
|
35
44
|
type CopyOptions = Arrayable<string | CopyEntry>;
|
|
36
45
|
type CopyOptionsFn = (options: ResolvedConfig) => Awaitable<CopyOptions>;
|
|
@@ -160,6 +169,17 @@ interface ExportsOptions {
|
|
|
160
169
|
* Exports for all files.
|
|
161
170
|
*/
|
|
162
171
|
all?: boolean;
|
|
172
|
+
/**
|
|
173
|
+
* Define filenames or RegExp patterns to exclude files from exports.
|
|
174
|
+
* This is useful for excluding files that should not be part of the package exports,
|
|
175
|
+
* such as bin files or internal utilities.
|
|
176
|
+
*
|
|
177
|
+
* @example
|
|
178
|
+
* ```js
|
|
179
|
+
* exclude: ['foo.ts', /\.spec\.ts$/, /internal/]
|
|
180
|
+
* ```
|
|
181
|
+
*/
|
|
182
|
+
exclude?: (RegExp | string)[];
|
|
163
183
|
customExports?: (exports: Record<string, any>, context: {
|
|
164
184
|
pkg: PackageJson;
|
|
165
185
|
chunks: ChunksByFormat;
|
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 { t as defineConfig } from "./config-
|
|
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-JmTA8ZMA.mjs";
|
|
2
|
+
import { t as defineConfig } from "./config-FoWTJggg.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-gll494UH.mjs";
|
|
3
|
+
import { o as globalLogger } from "./package-CE44tUXo.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.
|
|
164
|
+
var version = "0.18.0";
|
|
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-JmTA8ZMA.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-gll494UH.mjs";
|
|
2
|
+
import "./package-CE44tUXo.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-CE44tUXo.mjs";
|
|
3
3
|
import module from "node:module";
|
|
4
4
|
import { dim } from "ansis";
|
|
5
5
|
import { VERSION } from "rolldown";
|
|
@@ -1,6 +1,6 @@
|
|
|
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-CE44tUXo.mjs";
|
|
4
4
|
import { builtinModules, isBuiltin } from "node:module";
|
|
5
5
|
import path, { dirname, join, normalize, sep } from "node:path";
|
|
6
6
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
@@ -163,8 +163,8 @@ async function loadConfigFile(inlineConfig, workspace) {
|
|
|
163
163
|
if (exported.some((config) => typeof config === "function")) throw new Error("Function should not be nested within multiple tsdown configurations. It must be at the top level.\nExample: export default defineConfig(() => [...])");
|
|
164
164
|
return {
|
|
165
165
|
configs: exported.map((config) => ({
|
|
166
|
-
|
|
167
|
-
|
|
166
|
+
...config,
|
|
167
|
+
cwd: config.cwd ? path.resolve(cwd, config.cwd) : cwd
|
|
168
168
|
})),
|
|
169
169
|
file
|
|
170
170
|
};
|
|
@@ -317,15 +317,19 @@ async function writeExports(options, chunks) {
|
|
|
317
317
|
if (original.endsWith("\n")) contents += "\n";
|
|
318
318
|
if (contents !== original) await writeFile(pkg.packageJsonPath, contents, "utf8");
|
|
319
319
|
}
|
|
320
|
-
|
|
320
|
+
function shouldExclude(fileName, exclude) {
|
|
321
|
+
if (!exclude?.length) return false;
|
|
322
|
+
return matchPattern(fileName, exclude);
|
|
323
|
+
}
|
|
324
|
+
async function generateExports(pkg, chunks, { devExports, all, exclude, customExports }) {
|
|
321
325
|
const pkgRoot$1 = path.dirname(pkg.packageJsonPath);
|
|
322
326
|
let main, module$1, cjsTypes, esmTypes;
|
|
323
327
|
const exportsMap = /* @__PURE__ */ new Map();
|
|
324
328
|
for (const [format, chunksByFormat] of Object.entries(chunks)) {
|
|
325
329
|
if (format !== "es" && format !== "cjs") continue;
|
|
326
|
-
const
|
|
327
|
-
|
|
328
|
-
|
|
330
|
+
const filteredChunks = chunksByFormat.filter((chunk) => chunk.type === "chunk" && chunk.isEntry && !shouldExclude(chunk.fileName, exclude));
|
|
331
|
+
const onlyOneEntry = filteredChunks.filter((chunk) => !RE_DTS.test(chunk.fileName)).length === 1;
|
|
332
|
+
for (const chunk of filteredChunks) {
|
|
329
333
|
const normalizedName = slash(chunk.fileName);
|
|
330
334
|
const ext = path.extname(chunk.fileName);
|
|
331
335
|
let name = normalizedName.slice(0, -ext.length);
|
|
@@ -706,6 +710,7 @@ async function resolveWorkspace(config, inlineConfig) {
|
|
|
706
710
|
const debug$5 = createDebug("tsdown:config");
|
|
707
711
|
async function resolveConfig(inlineConfig) {
|
|
708
712
|
debug$5("inline config %O", inlineConfig);
|
|
713
|
+
if (inlineConfig.cwd) inlineConfig.cwd = path.resolve(inlineConfig.cwd);
|
|
709
714
|
const { configs: rootConfigs, file } = await loadConfigFile(inlineConfig);
|
|
710
715
|
const files = [];
|
|
711
716
|
if (file) {
|
|
@@ -755,23 +760,37 @@ async function copy(options) {
|
|
|
755
760
|
onlyFiles: true,
|
|
756
761
|
expandDirectories: false
|
|
757
762
|
});
|
|
758
|
-
return
|
|
763
|
+
return from.map((file) => resolveCopyEntry({
|
|
759
764
|
...entry,
|
|
760
765
|
from: file
|
|
761
|
-
}))
|
|
766
|
+
}));
|
|
762
767
|
}))).flat();
|
|
763
|
-
|
|
764
|
-
options.logger.
|
|
768
|
+
if (!resolved.length) {
|
|
769
|
+
options.logger.warn(options.nameLabel, `No files matched for copying.`);
|
|
770
|
+
return;
|
|
771
|
+
}
|
|
772
|
+
await Promise.all(resolved.map(({ from, to, verbose }) => {
|
|
773
|
+
if (verbose) options.logger.info(options.nameLabel, `Copying files from ${path.relative(options.cwd, from)} to ${path.relative(options.cwd, to)}`);
|
|
765
774
|
return fsCopy(from, to);
|
|
766
775
|
}));
|
|
767
|
-
|
|
776
|
+
function resolveCopyEntry(entry) {
|
|
777
|
+
const { flatten = true, rename } = entry;
|
|
768
778
|
const from = path.resolve(options.cwd, entry.from);
|
|
769
|
-
const
|
|
770
|
-
const
|
|
771
|
-
|
|
772
|
-
|
|
779
|
+
const to = entry.to ? path.resolve(options.cwd, entry.to) : options.outDir;
|
|
780
|
+
const { base, dir } = path.parse(path.relative(options.cwd, from));
|
|
781
|
+
const destFolder = flatten || !flatten && !dir ? to : dir.replace(dir.split(path.sep)[0], to);
|
|
782
|
+
const dest = path.join(destFolder, rename ? renameTarget(base, rename, from) : base);
|
|
783
|
+
return {
|
|
784
|
+
...entry,
|
|
785
|
+
from,
|
|
786
|
+
to: dest
|
|
787
|
+
};
|
|
773
788
|
}
|
|
774
789
|
}
|
|
790
|
+
function renameTarget(target, rename, src) {
|
|
791
|
+
const parsedPath = path.parse(target);
|
|
792
|
+
return typeof rename === "string" ? rename : rename(parsedPath.name, parsedPath.ext.replace(".", ""), src);
|
|
793
|
+
}
|
|
775
794
|
|
|
776
795
|
//#endregion
|
|
777
796
|
//#region src/features/hooks.ts
|
|
@@ -1453,6 +1472,7 @@ function shortcuts(restart) {
|
|
|
1453
1472
|
let actionRunning = false;
|
|
1454
1473
|
async function onInput(input) {
|
|
1455
1474
|
if (actionRunning) return;
|
|
1475
|
+
input = input.trim().toLowerCase();
|
|
1456
1476
|
const SHORTCUTS = [
|
|
1457
1477
|
{
|
|
1458
1478
|
key: "r",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tsdown",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.18.0",
|
|
5
5
|
"description": "The Elegant Bundler for Libraries",
|
|
6
6
|
"author": "Kevin Deng <sxzz@sxzz.moe>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -94,21 +94,23 @@
|
|
|
94
94
|
},
|
|
95
95
|
"devDependencies": {
|
|
96
96
|
"@arethetypeswrong/core": "^0.18.2",
|
|
97
|
-
"@sxzz/eslint-config": "^7.4.
|
|
97
|
+
"@sxzz/eslint-config": "^7.4.3",
|
|
98
98
|
"@sxzz/prettier-config": "^2.2.6",
|
|
99
|
-
"@sxzz/test-utils": "^0.5.
|
|
100
|
-
"@types/node": "^
|
|
99
|
+
"@sxzz/test-utils": "^0.5.14",
|
|
100
|
+
"@types/node": "^25.0.1",
|
|
101
101
|
"@types/semver": "^7.7.1",
|
|
102
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
102
|
+
"@typescript/native-preview": "7.0.0-dev.20251212.1",
|
|
103
103
|
"@unocss/eslint-plugin": "^66.5.10",
|
|
104
104
|
"@vitejs/devtools": "^0.0.0-alpha.19",
|
|
105
105
|
"@vitest/coverage-v8": "4.0.15",
|
|
106
|
+
"@vitest/ui": "^4.0.15",
|
|
106
107
|
"@vueuse/core": "^14.1.0",
|
|
107
108
|
"bumpp": "^10.3.2",
|
|
108
109
|
"dedent": "^1.7.0",
|
|
109
|
-
"eslint": "^9.39.
|
|
110
|
+
"eslint": "^9.39.2",
|
|
110
111
|
"is-in-ci": "^2.0.0",
|
|
111
112
|
"lightningcss": "^1.30.2",
|
|
113
|
+
"memfs": "^4.51.1",
|
|
112
114
|
"pkg-types": "^2.3.0",
|
|
113
115
|
"prettier": "^3.7.4",
|
|
114
116
|
"publint": "^0.3.16",
|
|
@@ -117,7 +119,7 @@
|
|
|
117
119
|
"unocss": "^66.5.10",
|
|
118
120
|
"unplugin-lightningcss": "^0.4.3",
|
|
119
121
|
"unplugin-unused": "^0.5.6",
|
|
120
|
-
"vite": "
|
|
122
|
+
"vite": "^8.0.0-beta.2",
|
|
121
123
|
"vitest": "^4.0.15"
|
|
122
124
|
},
|
|
123
125
|
"prettier": "@sxzz/prettier-config",
|