tsdown 0.21.3 → 0.21.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-D-zhBXEK.mjs +2 -0
- package/dist/{build-Dh89hfzV.mjs → build-DpU0PBVv.mjs} +5 -5
- package/dist/{config-D9p_BCF3.d.mts → config-DR_xLSbh.d.mts} +1 -1
- package/dist/config.d.mts +2 -2
- package/dist/config.mjs +1 -1
- package/dist/{format-DPVBd8E4.mjs → format-CzYq8yvJ.mjs} +88 -35
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +2 -2
- package/dist/{options-CoPog4o1.mjs → options-efTzQ_AE.mjs} +2 -1
- package/dist/{package-CaVX988O.mjs → package-BIUrKRH5.mjs} +1 -1
- package/dist/plugins.d.mts +2 -2
- package/dist/plugins.mjs +3 -3
- package/dist/run.mjs +2 -2
- package/dist/{types-D2Jnze_i.d.mts → types-7diXKIyw.d.mts} +4 -4
- package/dist/{watch-CS1xCZMR.mjs → watch-BywZdNr-.mjs} +1 -1
- package/package.json +23 -24
- package/dist/build-CGB4R_gC.mjs +0 -2
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { createRequire as __cjs_createRequire } from "node:module";
|
|
2
2
|
const __cjs_require = __cjs_createRequire(import.meta.url);
|
|
3
3
|
import { a as pkgExists, l as slash, n as importWithError, o as promiseWithResolvers, t as debounce } from "./general-CRszZCrY.mjs";
|
|
4
|
-
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, u as cleanChunks } from "./options-
|
|
4
|
+
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, u as cleanChunks } from "./options-efTzQ_AE.mjs";
|
|
5
5
|
import { r as fsRemove } from "./fs-Dd6Htx2P.mjs";
|
|
6
6
|
import { a as globalLogger, t as LogLevels } from "./logger-BU0v7CAk.mjs";
|
|
7
|
-
import { a as getShimsInject, r as
|
|
8
|
-
import { a as ReportPlugin, i as ShebangPlugin, n as endsWithConfig, o as NodeProtocolPlugin, r as addOutDirToChunks, s as copy, t as WatchPlugin } from "./watch-
|
|
9
|
-
import { t as version } from "./package-
|
|
7
|
+
import { a as getShimsInject, r as DepsPlugin } from "./format-CzYq8yvJ.mjs";
|
|
8
|
+
import { a as ReportPlugin, i as ShebangPlugin, n as endsWithConfig, o as NodeProtocolPlugin, r as addOutDirToChunks, s as copy, t as WatchPlugin } from "./watch-BywZdNr-.mjs";
|
|
9
|
+
import { t as version } from "./package-BIUrKRH5.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";
|
|
@@ -466,7 +466,7 @@ async function resolveInputOptions(config, format, configFiles, bundle, cjsDts,
|
|
|
466
466
|
const { alias, checks: { legacyCjs, ...checks } = {}, cjsDefault, cwd, deps: { neverBundle }, devtools, dts, entry, env, globImport, loader, logger, nameLabel, nodeProtocol, platform, plugins: userPlugins, report, shims, target, treeshake, tsconfig, unused, watch } = config;
|
|
467
467
|
const plugins = [];
|
|
468
468
|
if (nodeProtocol) plugins.push(NodeProtocolPlugin(nodeProtocol));
|
|
469
|
-
if (config.pkg || config.deps.skipNodeModulesBundle) plugins.push(
|
|
469
|
+
if (config.pkg || config.deps.skipNodeModulesBundle) plugins.push(DepsPlugin(config, bundle));
|
|
470
470
|
if (dts) {
|
|
471
471
|
const { dts: dtsPlugin } = await import("rolldown-plugin-dts");
|
|
472
472
|
const options = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as UserConfig, f as UserConfigExport, i as InlineConfig, o as ResolvedConfig, p as UserConfigFn } from "./types-
|
|
1
|
+
import { d as UserConfig, f as UserConfigExport, i as InlineConfig, o as ResolvedConfig, p as UserConfigFn } from "./types-7diXKIyw.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/config/options.d.ts
|
|
4
4
|
/**
|
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-7diXKIyw.mjs";
|
|
2
|
+
import { n as mergeConfig, t as defineConfig } from "./config-DR_xLSbh.mjs";
|
|
3
3
|
export { UserConfig, UserConfigExport, UserConfigFn, defineConfig, mergeConfig };
|
package/dist/config.mjs
CHANGED
|
@@ -16,7 +16,7 @@ function getShimsInject(format, platform) {
|
|
|
16
16
|
}
|
|
17
17
|
//#endregion
|
|
18
18
|
//#region src/features/deps.ts
|
|
19
|
-
const debug = createDebug("tsdown:
|
|
19
|
+
const debug = createDebug("tsdown:deps");
|
|
20
20
|
function resolveDepsConfig(config, logger) {
|
|
21
21
|
let { neverBundle, alwaysBundle, onlyBundle, skipNodeModulesBundle = false } = config.deps || {};
|
|
22
22
|
if (config.external != null) {
|
|
@@ -59,39 +59,34 @@ function resolveDepsConfig(config, logger) {
|
|
|
59
59
|
skipNodeModulesBundle
|
|
60
60
|
};
|
|
61
61
|
}
|
|
62
|
-
|
|
63
|
-
const slashed = slash(moduleId);
|
|
64
|
-
const lastNmIdx = slashed.lastIndexOf("/node_modules/");
|
|
65
|
-
if (lastNmIdx === -1) return;
|
|
66
|
-
const parts = slashed.slice(lastNmIdx + 14).split("/");
|
|
67
|
-
let name;
|
|
68
|
-
if (parts[0][0] === "@") name = `${parts[0]}/${parts[1]}`;
|
|
69
|
-
else name = parts[0];
|
|
70
|
-
const root = slashed.slice(0, lastNmIdx + 14 + name.length);
|
|
71
|
-
try {
|
|
72
|
-
const json = JSON.parse(await readFile(path.join(root, "package.json"), "utf8"));
|
|
73
|
-
return {
|
|
74
|
-
name,
|
|
75
|
-
pkgName: json.name,
|
|
76
|
-
version: json.version
|
|
77
|
-
};
|
|
78
|
-
} catch {}
|
|
79
|
-
}
|
|
80
|
-
function DepPlugin({ pkg, deps: { alwaysBundle, onlyBundle, skipNodeModulesBundle }, logger, nameLabel }, tsdownBundle) {
|
|
62
|
+
function DepsPlugin({ pkg, deps: { alwaysBundle, onlyBundle, skipNodeModulesBundle }, logger, nameLabel }, tsdownBundle) {
|
|
81
63
|
const deps = pkg && Array.from(getProductionDeps(pkg));
|
|
82
64
|
return {
|
|
83
|
-
name: "tsdown:
|
|
65
|
+
name: "tsdown:deps",
|
|
84
66
|
resolveId: {
|
|
85
67
|
filter: [include(and(id(/^[^.]/), importerId(/./)))],
|
|
86
68
|
async handler(id, importer, extraOptions) {
|
|
87
69
|
if (extraOptions.isEntry) return;
|
|
88
|
-
const
|
|
89
|
-
|
|
70
|
+
const resolved = await this.resolve(id, importer, {
|
|
71
|
+
...extraOptions,
|
|
72
|
+
skipSelf: true
|
|
73
|
+
});
|
|
74
|
+
let shouldExternal = await externalStrategy(id, importer, resolved);
|
|
75
|
+
if (Array.isArray(shouldExternal)) {
|
|
76
|
+
debug("custom resolved id for %o -> %o", id, shouldExternal[1]);
|
|
77
|
+
id = shouldExternal[1];
|
|
78
|
+
shouldExternal = shouldExternal[0];
|
|
79
|
+
}
|
|
80
|
+
const moduleSideEffects = isBuiltin(id) ? false : void 0;
|
|
90
81
|
debug("shouldExternal: %o = %o", id, shouldExternal);
|
|
91
82
|
if (shouldExternal === true || shouldExternal === "absolute") return {
|
|
92
83
|
id,
|
|
93
84
|
external: shouldExternal,
|
|
94
|
-
moduleSideEffects
|
|
85
|
+
moduleSideEffects
|
|
86
|
+
};
|
|
87
|
+
if (resolved) return {
|
|
88
|
+
...resolved,
|
|
89
|
+
moduleSideEffects
|
|
95
90
|
};
|
|
96
91
|
}
|
|
97
92
|
},
|
|
@@ -103,7 +98,7 @@ function DepPlugin({ pkg, deps: { alwaysBundle, onlyBundle, skipNodeModulesBundl
|
|
|
103
98
|
for (const chunk of Object.values(bundle)) {
|
|
104
99
|
if (chunk.type === "asset") continue;
|
|
105
100
|
for (const id of chunk.moduleIds) {
|
|
106
|
-
const parsed = await
|
|
101
|
+
const parsed = await readBundledDepInfo(id);
|
|
107
102
|
if (!parsed) continue;
|
|
108
103
|
deps.add(parsed.name);
|
|
109
104
|
if (!tsdownBundle.inlinedDeps.has(parsed.pkgName)) tsdownBundle.inlinedDeps.set(parsed.pkgName, /* @__PURE__ */ new Set());
|
|
@@ -124,29 +119,87 @@ function DepPlugin({ pkg, deps: { alwaysBundle, onlyBundle, skipNodeModulesBundl
|
|
|
124
119
|
};
|
|
125
120
|
/**
|
|
126
121
|
* - `true`: always external
|
|
122
|
+
* - `[true, resolvedId]`: external with custom resolved ID
|
|
127
123
|
* - `false`: skip, let other plugins handle it
|
|
128
124
|
* - `'absolute'`: external as absolute path
|
|
129
125
|
* - `'no-external'`: skip, but mark as non-external for inlineOnly check
|
|
130
126
|
*/
|
|
131
|
-
async function externalStrategy(
|
|
127
|
+
async function externalStrategy(id, importer, resolved) {
|
|
132
128
|
if (id === shimFile) return false;
|
|
133
129
|
if (alwaysBundle?.(id, importer)) return "no-external";
|
|
134
|
-
if (skipNodeModulesBundle)
|
|
135
|
-
const resolved = await context.resolve(id, importer, extraOptions);
|
|
136
|
-
if (resolved && (resolved.external || RE_NODE_MODULES.test(resolved.id))) return true;
|
|
137
|
-
}
|
|
130
|
+
if (skipNodeModulesBundle && resolved && (resolved.external || RE_NODE_MODULES.test(resolved.id))) return true;
|
|
138
131
|
if (deps) {
|
|
139
|
-
if (deps.includes(id) || deps.some((dep) => id.startsWith(`${dep}/`)))
|
|
132
|
+
if (deps.includes(id) || deps.some((dep) => id.startsWith(`${dep}/`))) {
|
|
133
|
+
const resolvedDep = await resolveDepSubpath(id, resolved);
|
|
134
|
+
return resolvedDep ? [true, resolvedDep] : true;
|
|
135
|
+
}
|
|
140
136
|
if (importer && RE_DTS.test(importer) && !id.startsWith("@types/")) {
|
|
141
|
-
const typesName =
|
|
142
|
-
if (deps.includes(typesName)) return true;
|
|
137
|
+
const typesName = getTypesPackageName(id);
|
|
138
|
+
if (typesName && deps.includes(typesName)) return true;
|
|
143
139
|
}
|
|
144
140
|
}
|
|
145
141
|
return false;
|
|
146
142
|
}
|
|
147
143
|
}
|
|
144
|
+
function parsePackageSpecifier(id) {
|
|
145
|
+
const [first, second] = id.split("/", 3);
|
|
146
|
+
const name = first[0] === "@" && second ? `${first}/${second}` : first;
|
|
147
|
+
return [name, id.slice(name.length)];
|
|
148
|
+
}
|
|
149
|
+
const NODE_MODULES = "/node_modules/";
|
|
150
|
+
function parseNodeModulesPath(id) {
|
|
151
|
+
const slashed = slash(id);
|
|
152
|
+
const lastNmIdx = slashed.lastIndexOf(NODE_MODULES);
|
|
153
|
+
if (lastNmIdx === -1) return;
|
|
154
|
+
const [name, subpath] = parsePackageSpecifier(slashed.slice(lastNmIdx + 14));
|
|
155
|
+
return [
|
|
156
|
+
name,
|
|
157
|
+
subpath,
|
|
158
|
+
slashed.slice(0, lastNmIdx + 14 + name.length)
|
|
159
|
+
];
|
|
160
|
+
}
|
|
161
|
+
async function readBundledDepInfo(moduleId) {
|
|
162
|
+
const parsed = parseNodeModulesPath(moduleId);
|
|
163
|
+
if (!parsed) return;
|
|
164
|
+
const [name, , root] = parsed;
|
|
165
|
+
try {
|
|
166
|
+
const json = JSON.parse(await readFile(path.join(root, "package.json"), "utf8"));
|
|
167
|
+
return {
|
|
168
|
+
name,
|
|
169
|
+
pkgName: json.name,
|
|
170
|
+
version: json.version
|
|
171
|
+
};
|
|
172
|
+
} catch {}
|
|
173
|
+
}
|
|
174
|
+
function getTypesPackageName(id) {
|
|
175
|
+
const name = parsePackageSpecifier(id)[0];
|
|
176
|
+
if (!name) return;
|
|
177
|
+
return `@types/${name.replace(/^@/, "").replace("/", "__")}`;
|
|
178
|
+
}
|
|
179
|
+
async function resolveDepSubpath(id, resolved) {
|
|
180
|
+
if (!resolved?.packageJsonPath) return;
|
|
181
|
+
const parts = id.split("/");
|
|
182
|
+
if (parts[0][0] === "@") parts.shift();
|
|
183
|
+
if (parts.length === 1 || parts.at(-1).includes(".")) return;
|
|
184
|
+
let pkgJson;
|
|
185
|
+
try {
|
|
186
|
+
pkgJson = JSON.parse(await readFile(resolved.packageJsonPath, "utf8"));
|
|
187
|
+
} catch {
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
if (pkgJson.exports) return;
|
|
191
|
+
const parsed = parseNodeModulesPath(resolved.id);
|
|
192
|
+
if (!parsed) return;
|
|
193
|
+
const result = parsed[0] + parsed[1];
|
|
194
|
+
if (result === id) return;
|
|
195
|
+
return result;
|
|
196
|
+
}
|
|
148
197
|
function getProductionDeps(pkg) {
|
|
149
|
-
return new Set([
|
|
198
|
+
return new Set([
|
|
199
|
+
...Object.keys(pkg.dependencies || {}),
|
|
200
|
+
...Object.keys(pkg.peerDependencies || {}),
|
|
201
|
+
...Object.keys(pkg.optionalDependencies || {})
|
|
202
|
+
]);
|
|
150
203
|
}
|
|
151
204
|
//#endregion
|
|
152
205
|
//#region src/utils/format.ts
|
|
@@ -166,4 +219,4 @@ function detectIndentation(jsonText) {
|
|
|
166
219
|
return 2;
|
|
167
220
|
}
|
|
168
221
|
//#endregion
|
|
169
|
-
export { getShimsInject as a, resolveDepsConfig as i, formatBytes as n,
|
|
222
|
+
export { getShimsInject as a, resolveDepsConfig as i, formatBytes as n, DepsPlugin as r, detectIndentation as t };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { i as Arrayable, n as Logger, r as globalLogger } from "./logger-DtCm1ySP.mjs";
|
|
2
|
-
import { A as RolldownContext, B as TsdownBundle, C as ChunkAddonObject, D as PackageJsonWithPath, E as OutExtensionObject,
|
|
3
|
-
import { n as mergeConfig, r as resolveUserConfig, t as defineConfig } from "./config-
|
|
2
|
+
import { A as RolldownContext, B as TsdownBundle, C as ChunkAddonObject, D as PackageJsonWithPath, E as OutExtensionObject, F as DepsConfig, H as CopyOptions, L as NoExternalFn, M as ExeOptions, N as SeaConfig, O as PackageType, P as DevtoolsOptions, R as ResolvedDepsConfig, S as ChunkAddonFunction, T as OutExtensionFactory, U as CopyOptionsFn, V as CopyEntry, a as NormalizedFormat, b as AttwOptions, c as TreeshakingOptions, d as UserConfig, f as UserConfigExport, g as ReportOptions, h as Workspace, i as InlineConfig, j as TsdownHooks, k as BuildContext, 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 PublintOptions, w as OutExtensionContext, x as ChunkAddon, y as ExportsOptions, z as RolldownChunk } from "./types-7diXKIyw.mjs";
|
|
3
|
+
import { n as mergeConfig, r as resolveUserConfig, t as defineConfig } from "./config-DR_xLSbh.mjs";
|
|
4
4
|
import * as Rolldown from "rolldown";
|
|
5
5
|
|
|
6
6
|
//#region src/build.d.ts
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { r as resolveUserConfig, t as mergeConfig } from "./options-
|
|
1
|
+
import { r as resolveUserConfig, t as mergeConfig } from "./options-efTzQ_AE.mjs";
|
|
2
2
|
import { a as globalLogger } from "./logger-BU0v7CAk.mjs";
|
|
3
3
|
import { defineConfig } from "./config.mjs";
|
|
4
|
-
import { n as buildWithConfigs, t as build } from "./build-
|
|
4
|
+
import { n as buildWithConfigs, t as build } from "./build-DpU0PBVv.mjs";
|
|
5
5
|
import { t as enableDebug } from "./debug-C4FmgzkJ.mjs";
|
|
6
6
|
import * as Rolldown from "rolldown";
|
|
7
7
|
export { Rolldown, build, buildWithConfigs, defineConfig, enableDebug, globalLogger, mergeConfig, resolveUserConfig };
|
|
@@ -3,7 +3,7 @@ const __cjs_require = __cjs_createRequire(import.meta.url);
|
|
|
3
3
|
import { a as pkgExists, c as resolveRegex, l as slash, n as importWithError, r as matchPattern, s as resolveComma, u as toArray } from "./general-CRszZCrY.mjs";
|
|
4
4
|
import { a as lowestCommonAncestor, i as fsStat, n as fsExists, o as stripExtname, r as fsRemove } from "./fs-Dd6Htx2P.mjs";
|
|
5
5
|
import { a as globalLogger, i as getNameLabel, n as createLogger, r as generateColor } from "./logger-BU0v7CAk.mjs";
|
|
6
|
-
import { i as resolveDepsConfig, n as formatBytes, t as detectIndentation } from "./format-
|
|
6
|
+
import { i as resolveDepsConfig, n as formatBytes, t as detectIndentation } from "./format-CzYq8yvJ.mjs";
|
|
7
7
|
import { mkdir, mkdtemp, readFile, writeFile } from "node:fs/promises";
|
|
8
8
|
import path from "node:path";
|
|
9
9
|
import process, { env } from "node:process";
|
|
@@ -246,6 +246,7 @@ async function writeExports(options, chunks, inlinedDeps) {
|
|
|
246
246
|
}
|
|
247
247
|
const original = readFileSync(pkg.packageJsonPath, "utf8");
|
|
248
248
|
let contents = JSON.stringify(updatedPkg, null, detectIndentation(original));
|
|
249
|
+
if (original.includes("\r\n")) contents = contents.replaceAll("\n", "\r\n");
|
|
249
250
|
if (original.endsWith("\n")) contents += "\n";
|
|
250
251
|
if (contents !== original) writeFileSync(pkg.packageJsonPath, contents, "utf8");
|
|
251
252
|
}
|
package/dist/plugins.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as Logger } from "./logger-DtCm1ySP.mjs";
|
|
2
|
-
import { B as TsdownBundle,
|
|
2
|
+
import { B as TsdownBundle, I as DepsPlugin, _ as ReportPlugin } from "./types-7diXKIyw.mjs";
|
|
3
3
|
import { Plugin } from "rolldown";
|
|
4
4
|
|
|
5
5
|
//#region src/features/node-protocol.d.ts
|
|
@@ -18,4 +18,4 @@ declare function WatchPlugin(configFiles: string[], {
|
|
|
18
18
|
chunks
|
|
19
19
|
}: TsdownBundle): Plugin;
|
|
20
20
|
//#endregion
|
|
21
|
-
export {
|
|
21
|
+
export { DepsPlugin, NodeProtocolPlugin, ReportPlugin, ShebangPlugin, WatchPlugin };
|
package/dist/plugins.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { r as
|
|
2
|
-
import { a as ReportPlugin, i as ShebangPlugin, o as NodeProtocolPlugin, t as WatchPlugin } from "./watch-
|
|
3
|
-
export {
|
|
1
|
+
import { r as DepsPlugin } from "./format-CzYq8yvJ.mjs";
|
|
2
|
+
import { a as ReportPlugin, i as ShebangPlugin, o as NodeProtocolPlugin, t as WatchPlugin } from "./watch-BywZdNr-.mjs";
|
|
3
|
+
export { DepsPlugin, NodeProtocolPlugin, ReportPlugin, ShebangPlugin, WatchPlugin };
|
package/dist/run.mjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { createRequire as __cjs_createRequire } from "node:module";
|
|
3
3
|
const __cjs_require = __cjs_createRequire(import.meta.url);
|
|
4
4
|
import { a as globalLogger } from "./logger-BU0v7CAk.mjs";
|
|
5
|
-
import { t as version } from "./package-
|
|
5
|
+
import { t as version } from "./package-BIUrKRH5.mjs";
|
|
6
6
|
import { t as enableDebug } from "./debug-C4FmgzkJ.mjs";
|
|
7
7
|
import module from "node:module";
|
|
8
8
|
import process from "node:process";
|
|
@@ -20,7 +20,7 @@ cli.command("[...files]", "Bundle files", {
|
|
|
20
20
|
}).option("-c, --config <filename>", "Use a custom config file").option("--config-loader <loader>", "Config loader to use: auto, native, 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 export-related metadata for package.json (experimental)").action(async (input, flags) => {
|
|
21
21
|
globalLogger.level = flags.logLevel || "info";
|
|
22
22
|
globalLogger.info(`tsdown ${dim`v${version}`} powered by rolldown ${dim`v${VERSION}`}`);
|
|
23
|
-
const { build } = await import("./build-
|
|
23
|
+
const { build } = await import("./build-D-zhBXEK.mjs");
|
|
24
24
|
if (input.length > 0) flags.entry = input;
|
|
25
25
|
await build(flags);
|
|
26
26
|
});
|
|
@@ -3,11 +3,11 @@ import { BuildOptions, ChecksOptions, ExternalOption, InputOptions, InternalModu
|
|
|
3
3
|
import { Hookable } from "hookable";
|
|
4
4
|
import { Buffer } from "node:buffer";
|
|
5
5
|
import * as _tsdown_css0 from "@tsdown/css";
|
|
6
|
-
import { Options as DtsOptions } from "rolldown-plugin-dts";
|
|
7
6
|
import { StartOptions } from "@vitejs/devtools/cli-commands";
|
|
8
7
|
import { ExeExtensionOptions } from "@tsdown/exe";
|
|
9
8
|
import { CheckPackageOptions } from "@arethetypeswrong/core";
|
|
10
9
|
import { Options } from "publint";
|
|
10
|
+
import { Options as DtsOptions } from "rolldown-plugin-dts";
|
|
11
11
|
import { Options as UnusedOptions } from "unplugin-unused";
|
|
12
12
|
|
|
13
13
|
//#region src/features/copy.d.ts
|
|
@@ -60,7 +60,7 @@ interface DepsConfig {
|
|
|
60
60
|
*/
|
|
61
61
|
neverBundle?: ExternalOption;
|
|
62
62
|
/**
|
|
63
|
-
* Force dependencies to be bundled, even if they are in `dependencies` or `
|
|
63
|
+
* Force dependencies to be bundled, even if they are in `dependencies`, `peerDependencies`, or `optionalDependencies`.
|
|
64
64
|
*/
|
|
65
65
|
alwaysBundle?: Arrayable<string | RegExp> | NoExternalFn;
|
|
66
66
|
/**
|
|
@@ -92,7 +92,7 @@ interface ResolvedDepsConfig {
|
|
|
92
92
|
onlyBundle?: Array<string | RegExp> | false;
|
|
93
93
|
skipNodeModulesBundle: boolean;
|
|
94
94
|
}
|
|
95
|
-
declare function
|
|
95
|
+
declare function DepsPlugin({
|
|
96
96
|
pkg,
|
|
97
97
|
deps: {
|
|
98
98
|
alwaysBundle,
|
|
@@ -1154,4 +1154,4 @@ type ResolvedConfig = Overwrite<MarkPartial<Omit<UserConfig, "workspace" | "from
|
|
|
1154
1154
|
exe: false | ExeOptions;
|
|
1155
1155
|
}>;
|
|
1156
1156
|
//#endregion
|
|
1157
|
-
export { RolldownContext as A, TsdownBundle as B, ChunkAddonObject as C, PackageJsonWithPath as D, OutExtensionObject as E,
|
|
1157
|
+
export { RolldownContext as A, TsdownBundle as B, ChunkAddonObject as C, PackageJsonWithPath as D, OutExtensionObject as E, DepsConfig as F, CopyOptions as H, DepsPlugin as I, NoExternalFn as L, ExeOptions as M, SeaConfig as N, PackageType as O, DevtoolsOptions as P, ResolvedDepsConfig as R, ChunkAddonFunction as S, OutExtensionFactory as T, CopyOptionsFn as U, CopyEntry as V, ReportPlugin as _, NormalizedFormat as a, AttwOptions as b, TreeshakingOptions as c, UserConfig as d, UserConfigExport as f, ReportOptions as g, Workspace as h, InlineConfig as i, TsdownHooks as j, BuildContext as k, TsdownInputOption as l, WithEnabled as m, DtsOptions as n, ResolvedConfig as o, UserConfigFn as p, Format as r, Sourcemap as s, CIOption as t, UnusedOptions as u, PublintOptions as v, OutExtensionContext as w, ChunkAddon as x, ExportsOptions as y, RolldownChunk as z };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { i as noop, s as resolveComma, u as toArray } from "./general-CRszZCrY.mjs";
|
|
2
2
|
import { n as fsExists, t as fsCopy } from "./fs-Dd6Htx2P.mjs";
|
|
3
3
|
import { o as prettyFormat } from "./logger-BU0v7CAk.mjs";
|
|
4
|
-
import { n as formatBytes } from "./format-
|
|
4
|
+
import { n as formatBytes } from "./format-CzYq8yvJ.mjs";
|
|
5
5
|
import { builtinModules } from "node:module";
|
|
6
6
|
import { chmod } from "node:fs/promises";
|
|
7
7
|
import path from "node:path";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tsdown",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.21.
|
|
4
|
+
"version": "0.21.5",
|
|
5
5
|
"description": "The Elegant Bundler for Libraries",
|
|
6
6
|
"author": "Kevin Deng <sxzz@sxzz.moe>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -50,10 +50,10 @@
|
|
|
50
50
|
"@arethetypeswrong/core": "^0.18.1",
|
|
51
51
|
"@vitejs/devtools": "*",
|
|
52
52
|
"publint": "^0.3.0",
|
|
53
|
-
"typescript": "^5.0.0",
|
|
53
|
+
"typescript": "^5.0.0 || ^6.0.0",
|
|
54
54
|
"unplugin-unused": "^0.5.0",
|
|
55
|
-
"@tsdown/
|
|
56
|
-
"@tsdown/
|
|
55
|
+
"@tsdown/css": "0.21.5",
|
|
56
|
+
"@tsdown/exe": "0.21.5"
|
|
57
57
|
},
|
|
58
58
|
"peerDependenciesMeta": {
|
|
59
59
|
"@arethetypeswrong/core": {
|
|
@@ -83,18 +83,18 @@
|
|
|
83
83
|
"cac": "^7.0.0",
|
|
84
84
|
"defu": "^6.1.4",
|
|
85
85
|
"empathic": "^2.0.0",
|
|
86
|
-
"hookable": "^6.0
|
|
86
|
+
"hookable": "^6.1.0",
|
|
87
87
|
"import-without-cache": "^0.2.5",
|
|
88
88
|
"obug": "^2.1.1",
|
|
89
|
-
"picomatch": "^4.0.
|
|
90
|
-
"rolldown": "1.0.0-rc.
|
|
89
|
+
"picomatch": "^4.0.4",
|
|
90
|
+
"rolldown": "1.0.0-rc.11",
|
|
91
91
|
"rolldown-plugin-dts": "^0.22.5",
|
|
92
92
|
"semver": "^7.7.4",
|
|
93
93
|
"tinyexec": "^1.0.4",
|
|
94
94
|
"tinyglobby": "^0.2.15",
|
|
95
95
|
"tree-kill": "^1.2.2",
|
|
96
96
|
"unconfig-core": "^7.5.0",
|
|
97
|
-
"unrun": "^0.2.
|
|
97
|
+
"unrun": "^0.2.33"
|
|
98
98
|
},
|
|
99
99
|
"inlinedDependencies": {
|
|
100
100
|
"is-in-ci": "2.0.0",
|
|
@@ -103,24 +103,23 @@
|
|
|
103
103
|
},
|
|
104
104
|
"devDependencies": {
|
|
105
105
|
"@arethetypeswrong/core": "^0.18.2",
|
|
106
|
-
"@publint/pack": "^0.1.4",
|
|
107
106
|
"@sxzz/eslint-config": "^7.8.3",
|
|
108
107
|
"@sxzz/prettier-config": "^2.3.1",
|
|
109
108
|
"@sxzz/test-utils": "^0.5.15",
|
|
110
109
|
"@types/node": "^25.5.0",
|
|
111
110
|
"@types/picomatch": "^4.0.2",
|
|
112
111
|
"@types/semver": "^7.7.1",
|
|
113
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
114
|
-
"@unocss/eslint-plugin": "^66.6.
|
|
115
|
-
"@vitejs/devtools": "^0.1.
|
|
116
|
-
"@vitest/coverage-v8": "^4.1.
|
|
117
|
-
"@vitest/ui": "^4.1.
|
|
112
|
+
"@typescript/native-preview": "7.0.0-dev.20260325.1",
|
|
113
|
+
"@unocss/eslint-plugin": "^66.6.7",
|
|
114
|
+
"@vitejs/devtools": "^0.1.11",
|
|
115
|
+
"@vitest/coverage-v8": "^4.1.1",
|
|
116
|
+
"@vitest/ui": "^4.1.1",
|
|
118
117
|
"@vueuse/core": "^14.2.1",
|
|
119
|
-
"bumpp": "^11.0.
|
|
118
|
+
"bumpp": "^11.0.1",
|
|
120
119
|
"dedent": "^1.7.2",
|
|
121
|
-
"eslint": "^10.0
|
|
120
|
+
"eslint": "^10.1.0",
|
|
122
121
|
"is-in-ci": "^2.0.0",
|
|
123
|
-
"memfs": "^4.
|
|
122
|
+
"memfs": "^4.57.1",
|
|
124
123
|
"package-manager-detector": "^1.6.0",
|
|
125
124
|
"pkg-types": "^2.3.0",
|
|
126
125
|
"postcss": "^8.5.8",
|
|
@@ -130,17 +129,17 @@
|
|
|
130
129
|
"rolldown-plugin-dts-snapshot": "^0.4.0",
|
|
131
130
|
"rolldown-plugin-require-cjs": "^0.4.0",
|
|
132
131
|
"sass": "^1.98.0",
|
|
133
|
-
"typescript": "~
|
|
134
|
-
"unocss": "^66.6.
|
|
132
|
+
"typescript": "~6.0.2",
|
|
133
|
+
"unocss": "^66.6.7",
|
|
135
134
|
"unplugin-ast": "^0.16.0",
|
|
136
135
|
"unplugin-raw": "^0.6.4",
|
|
137
136
|
"unplugin-unused": "^0.5.7",
|
|
138
137
|
"unplugin-vue": "^7.1.1",
|
|
139
|
-
"vite": "^8.0.
|
|
140
|
-
"vitest": "^4.1.
|
|
141
|
-
"vue": "^3.5.
|
|
142
|
-
"@tsdown/css": "0.21.
|
|
143
|
-
"@tsdown/exe": "0.21.
|
|
138
|
+
"vite": "^8.0.2",
|
|
139
|
+
"vitest": "^4.1.1",
|
|
140
|
+
"vue": "^3.5.31",
|
|
141
|
+
"@tsdown/css": "0.21.5",
|
|
142
|
+
"@tsdown/exe": "0.21.5"
|
|
144
143
|
},
|
|
145
144
|
"prettier": "@sxzz/prettier-config",
|
|
146
145
|
"scripts": {
|
package/dist/build-CGB4R_gC.mjs
DELETED