@voidzero-dev/vite-plus-core 0.1.1 → 0.1.3
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/rolldown/cli.mjs +11 -22
- package/dist/rolldown/config.d.mts +1 -2
- package/dist/rolldown/config.mjs +10 -11
- package/dist/rolldown/experimental-index.d.mts +20 -6
- package/dist/rolldown/experimental-index.mjs +24 -22
- package/dist/rolldown/filter-index.d.mts +1 -2
- package/dist/rolldown/filter-index.mjs +2 -8
- package/dist/rolldown/get-log-filter.mjs +1 -2
- package/dist/rolldown/index.d.mts +3 -3
- package/dist/rolldown/index.mjs +10 -13
- package/dist/rolldown/parallel-plugin-worker.mjs +7 -9
- package/dist/rolldown/parallel-plugin.d.mts +1 -2
- package/dist/rolldown/parallel-plugin.mjs +1 -2
- package/dist/rolldown/parse-ast-index.d.mts +1 -1
- package/dist/rolldown/parse-ast-index.mjs +4 -6
- package/dist/rolldown/plugins-index.d.mts +3 -3
- package/dist/rolldown/plugins-index.mjs +4 -6
- package/dist/rolldown/shared/{binding-C4ZlFAt6.d.mts → binding-BohGL_65.d.mts} +10 -5
- package/dist/rolldown/shared/{binding-Bd04_f8P.mjs → binding-COZdHtee.mjs} +7 -16
- package/dist/rolldown/shared/{bindingify-input-options-ffqkmT9z.mjs → bindingify-input-options-DdW_FOGG.mjs} +33 -56
- package/dist/rolldown/shared/{constructors-C5a55nbY.mjs → constructors-CQlws1EK.mjs} +2 -4
- package/dist/rolldown/shared/{constructors-cPsD1J5w.d.mts → constructors-ColrbLxz.d.mts} +2 -2
- package/dist/rolldown/shared/{define-config-DX_4SBzo.d.mts → define-config-BqZZMLjO.d.mts} +66 -30
- package/dist/rolldown/shared/{define-config-BMj_QknW.mjs → define-config-DJOr6Iwt.mjs} +1 -2
- package/dist/rolldown/shared/{error-BYPsvVEN.mjs → error-FTNambir.mjs} +3 -8
- package/dist/rolldown/shared/{load-config-Oj1-3DPg.mjs → load-config-DBRCgd9m.mjs} +2 -4
- package/dist/rolldown/shared/{logs-CCc_0vhs.mjs → logs-D80CXhvg.mjs} +5 -8
- package/dist/rolldown/shared/{misc-Xty885dB.mjs → misc-DJYbNKZX.mjs} +1 -2
- package/dist/rolldown/shared/{normalize-string-or-regex-DoNa0azR.mjs → normalize-string-or-regex-CJTjKt5t.mjs} +3 -6
- package/dist/rolldown/shared/{parse-Wj8OTS4w.mjs → parse-q7gzDQmi.mjs} +2 -5
- package/dist/rolldown/shared/{prompt-CmNr0AI-.mjs → prompt-DZIXsnf9.mjs} +1 -3
- package/dist/rolldown/shared/{rolldown-y9H0nYAD.mjs → rolldown-BJMdRJb1.mjs} +2 -4
- package/dist/rolldown/shared/{rolldown-build-DkOWV5Vu.mjs → rolldown-build-DKv2K096.mjs} +424 -473
- package/dist/rolldown/shared/{transform-DoG7c5_r.d.mts → transform-BoJxrM-e.d.mts} +1 -1
- package/dist/rolldown/shared/{transform-D55YcCvB.mjs → transform-CQppMqL8.mjs} +3 -6
- package/dist/rolldown/shared/{watch-Cn-znpX_.mjs → watch-BeMWbIuq.mjs} +71 -77
- package/dist/rolldown/utils-index.d.mts +2 -2
- package/dist/rolldown/utils-index.mjs +9 -18
- package/dist/tsdown/{build-BjQ7Rt90-tMPZTflz.js → build-TmLngPCw-CBoVPzkZ.js} +312 -324
- package/dist/tsdown/build-gOkJM1H9-D9ngUBpk.js +5 -0
- package/dist/tsdown/{chunk-CdeBBKNj.js → chunk-CSNpwdVU.js} +13 -23
- package/dist/tsdown/{debug-BUVkFfEZ-D3UMJnif.js → debug-tOJ_PtrM-C-Do1Twv.js} +4 -6
- package/dist/tsdown/{detect-CCATtVj7-DhvBg5EF.js → detect-DK-FDZQ9-CHuRhyUG.js} +2 -4
- package/dist/tsdown/{dist-CFTDWtv2.js → dist-Ba2DZx1w.js} +7 -7
- package/dist/tsdown/{dist-DNcnO8LL.js → dist-DCol2bGA.js} +503 -568
- package/dist/tsdown/{dist-kuoe97DJ.js → dist-_l70jCqI.js} +1 -2
- package/dist/tsdown/{filename-CPj0AKvV.js → filename-BDcjeHGl.js} +3 -5
- package/dist/tsdown/{index-node-ShM0x2b6-Bt7Chc0I.js → index-node-Djp92Gzb-B-AUHI4t.js} +2 -4
- package/dist/tsdown/index-types.d.ts +180 -29
- package/dist/tsdown/index.js +7 -9
- package/dist/tsdown/{main-B3qcLRNf.js → main-DYgM-9Cb.js} +71 -83
- package/dist/tsdown/{node-Ba_UB_xO.js → node-B3Gdtau1.js} +1 -4
- package/dist/tsdown/npm_cjs_chunk_chunk.cjs +6 -8
- package/dist/tsdown/npm_cjs_chunk_lt.cjs +28 -0
- package/dist/tsdown/npm_cjs_chunk_range.cjs +22 -49
- package/dist/tsdown/npm_cjs_chunk_semver.cjs +54 -66
- package/dist/tsdown/npm_entry_picomatch.cjs +18 -30
- package/dist/tsdown/npm_entry_semver_functions_coerce.cjs +3 -7
- package/dist/tsdown/npm_entry_semver_functions_lt.cjs +5 -0
- package/dist/tsdown/npm_entry_semver_functions_satisfies.cjs +5 -7
- package/dist/tsdown/npm_entry_semver_ranges_min-version.cjs +5 -7
- package/dist/tsdown/npm_entry_tree-kill.cjs +2 -6
- package/dist/tsdown/{resolver-j7HY1N36-DHVsN9q6.js → resolver-CdD-yT15-3eaymYLw.js} +3 -5
- package/dist/tsdown/run.js +209 -74
- package/dist/tsdown/{tsc-CBjlgM2A.js → tsc-CberiTDq.js} +64 -71
- package/dist/tsdown/{tsc-context-D1h5oZB8.js → tsc-context-DiIjfXAG.js} +3 -5
- package/dist/vite/client/client.mjs +4 -19
- package/dist/vite/client/env.mjs +1 -2
- package/dist/vite/node/chunks/build.js +2 -3
- package/dist/vite/node/chunks/build2.js +91 -243
- package/dist/vite/node/chunks/chunk.js +7 -13
- package/dist/vite/node/chunks/config.js +2 -3
- package/dist/vite/node/chunks/dist.js +27 -61
- package/dist/vite/node/chunks/dist2.js +11 -95
- package/dist/vite/node/chunks/lib.js +1 -7
- package/dist/vite/node/chunks/logger.js +3 -8
- package/dist/vite/node/chunks/node.js +137 -428
- package/dist/vite/node/chunks/optimizer.js +2 -3
- package/dist/vite/node/chunks/postcss-import.js +1 -13
- package/dist/vite/node/chunks/preview.js +2 -3
- package/dist/vite/node/chunks/server.js +2 -3
- package/dist/vite/node/cli.js +1 -4
- package/dist/vite/node/index.d.ts +2 -2
- package/dist/vite/node/index.js +1 -2
- package/dist/vite/node/internal.js +1 -2
- package/dist/vite/node/module-runner.js +44 -3
- package/package.json +15 -11
- package/dist/rolldown/cli-setup.d.mts +0 -1
- package/dist/rolldown/cli-setup.mjs +0 -17
- package/dist/tsdown/build-2oRq4mfQ-YC_gzK3u.js +0 -6
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { r as __toESM, t as __commonJSMin } from "./chunk-
|
|
2
|
-
import { C as
|
|
3
|
-
import { t as createDebug } from "./node-
|
|
4
|
-
import { i as RE_JS, n as RE_DTS, o as RE_NODE_MODULES$1, t as RE_CSS } from "./filename-
|
|
1
|
+
import { r as __toESM, t as __commonJSMin } from "./chunk-CSNpwdVU.js";
|
|
2
|
+
import { C as resolveComma, E as toArray, S as promiseWithResolvers, T as slash, _ as debounce, a as createLogger, b as noop, c as globalLogger, d as bold, f as dim, g as yellow, h as underline, i as LogLevels, l as prettyFormat, m as red, n as q, o as generateColor, p as green, r as version, s as getNameLabel, t as K, u as blue, v as importWithError, w as resolveRegex, x as pkgExists, y as matchPattern } from "./main-DYgM-9Cb.js";
|
|
3
|
+
import { t as createDebug } from "./node-B3Gdtau1.js";
|
|
4
|
+
import { i as RE_JS, n as RE_DTS, o as RE_NODE_MODULES$1, t as RE_CSS$1 } from "./filename-BDcjeHGl.js";
|
|
5
5
|
import module$1, { builtinModules, createRequire, isBuiltin } from "node:module";
|
|
6
|
+
import { pathToFileURL } from "node:url";
|
|
6
7
|
import process$1, { env } from "node:process";
|
|
7
|
-
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
8
8
|
import readline from "node:readline";
|
|
9
9
|
import { formatWithOptions, inspect, promisify } from "node:util";
|
|
10
10
|
import { createRequire as createRequire$1 } from "module";
|
|
@@ -21,8 +21,7 @@ import fs$1, { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
|
21
21
|
import { Buffer } from "node:buffer";
|
|
22
22
|
import { brotliCompress, gzip } from "node:zlib";
|
|
23
23
|
import { importGlobPlugin } from "@voidzero-dev/vite-plus-core/rolldown/experimental";
|
|
24
|
-
|
|
25
|
-
//#region ../../node_modules/.pnpm/tsdown@0.21.0-beta.2_@arethetypeswrong+core@0.18.2_@typescript+native-preview@7.0.0-dev_d0d0ed2124937ee9dd401a280008a3bf/node_modules/tsdown/dist/format-J6JPSe_8.mjs
|
|
24
|
+
//#region ../../node_modules/.pnpm/tsdown@0.21.0_@arethetypeswrong+core@0.18.2_@tsdown+css@0.21.0_@tsdown+exe@0.21.0_@type_df9c58766eba71ed4fabe78a2cfe9dc9/node_modules/tsdown/dist/format-CM79ZE77.mjs
|
|
26
25
|
function fsExists(path) {
|
|
27
26
|
return access(path).then(() => true, () => false);
|
|
28
27
|
}
|
|
@@ -109,7 +108,25 @@ function resolveDepsConfig(config, logger) {
|
|
|
109
108
|
skipNodeModulesBundle
|
|
110
109
|
};
|
|
111
110
|
}
|
|
112
|
-
function
|
|
111
|
+
async function parseBundledDep(moduleId) {
|
|
112
|
+
const slashed = slash(moduleId);
|
|
113
|
+
const lastNmIdx = slashed.lastIndexOf("/node_modules/");
|
|
114
|
+
if (lastNmIdx === -1) return;
|
|
115
|
+
const parts = slashed.slice(lastNmIdx + 14).split("/");
|
|
116
|
+
let name;
|
|
117
|
+
if (parts[0][0] === "@") name = `${parts[0]}/${parts[1]}`;
|
|
118
|
+
else name = parts[0];
|
|
119
|
+
const root = slashed.slice(0, lastNmIdx + 14 + name.length);
|
|
120
|
+
try {
|
|
121
|
+
const json = JSON.parse(await readFile(path.join(root, "package.json"), "utf8"));
|
|
122
|
+
return {
|
|
123
|
+
name,
|
|
124
|
+
pkgName: json.name,
|
|
125
|
+
version: json.version
|
|
126
|
+
};
|
|
127
|
+
} catch {}
|
|
128
|
+
}
|
|
129
|
+
function DepPlugin({ pkg, deps: { alwaysBundle, onlyAllowBundle, skipNodeModulesBundle }, logger, nameLabel }, tsdownBundle) {
|
|
113
130
|
const deps = pkg && Array.from(getProductionDeps(pkg));
|
|
114
131
|
return {
|
|
115
132
|
name: "tsdown:external",
|
|
@@ -127,32 +144,30 @@ function DepPlugin({ pkg, deps: { alwaysBundle, onlyAllowBundle: inlineOnly, ski
|
|
|
127
144
|
};
|
|
128
145
|
}
|
|
129
146
|
},
|
|
130
|
-
generateBundle:
|
|
147
|
+
generateBundle: {
|
|
131
148
|
order: "post",
|
|
132
|
-
handler(options, bundle) {
|
|
149
|
+
async handler(options, bundle) {
|
|
133
150
|
const deps = /* @__PURE__ */ new Set();
|
|
134
151
|
const importers = /* @__PURE__ */ new Map();
|
|
135
152
|
for (const chunk of Object.values(bundle)) {
|
|
136
153
|
if (chunk.type === "asset") continue;
|
|
137
154
|
for (const id of chunk.moduleIds) {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
else dep = parts[0];
|
|
144
|
-
deps.add(dep);
|
|
155
|
+
const parsed = await parseBundledDep(id);
|
|
156
|
+
if (!parsed) continue;
|
|
157
|
+
deps.add(parsed.name);
|
|
158
|
+
if (!tsdownBundle.inlinedDeps.has(parsed.pkgName)) tsdownBundle.inlinedDeps.set(parsed.pkgName, /* @__PURE__ */ new Set());
|
|
159
|
+
tsdownBundle.inlinedDeps.get(parsed.pkgName).add(parsed.version);
|
|
145
160
|
const module = this.getModuleInfo(id);
|
|
146
|
-
if (module) importers.set(
|
|
161
|
+
if (module) importers.set(parsed.name, new Set([...module.importers, ...importers.get(parsed.name) || []]));
|
|
147
162
|
}
|
|
148
163
|
}
|
|
149
164
|
debug$6("found deps in bundle: %o", deps);
|
|
150
|
-
if (
|
|
151
|
-
const errors = Array.from(deps).filter((dep) => !matchPattern(dep,
|
|
165
|
+
if (onlyAllowBundle) {
|
|
166
|
+
const errors = Array.from(deps).filter((dep) => !matchPattern(dep, onlyAllowBundle)).map((dep) => `${yellow(dep)} is located in ${blue`node_modules`} but is not included in ${blue`deps.onlyAllowBundle`} option.\nTo fix this, either add it to ${blue`deps.onlyAllowBundle`}, declare it as a production or peer dependency in your package.json, or externalize it manually.\nImported by\n${[...importers.get(dep) || []].map((s) => `- ${underline(s)}`).join("\n")}`);
|
|
152
167
|
if (errors.length) this.error(errors.join("\n\n"));
|
|
153
|
-
const unusedPatterns =
|
|
168
|
+
const unusedPatterns = onlyAllowBundle.filter((pattern) => !Array.from(deps).some((dep) => matchPattern(dep, [pattern])));
|
|
154
169
|
if (unusedPatterns.length) logger.info(nameLabel, `The following entries in ${blue`deps.onlyAllowBundle`} are not used in the bundle:\n${unusedPatterns.map((pattern) => `- ${yellow(pattern)}`).join("\n")}\nConsider removing them to keep your configuration clean.`);
|
|
155
|
-
} else if (deps.size) logger.info(nameLabel, `Hint: consider adding ${blue`deps.onlyAllowBundle`} option to avoid unintended bundling of dependencies, or set ${blue`deps.onlyAllowBundle: false`} to disable this hint.\nSee more at ${underline`https://tsdown.dev/options/dependencies#deps-onlyallowbundle`}\nDetected dependencies in bundle:\n${Array.from(deps).map((dep) => `- ${blue(dep)}`).join("\n")}`);
|
|
170
|
+
} else if (onlyAllowBundle == null && deps.size) logger.info(nameLabel, `Hint: consider adding ${blue`deps.onlyAllowBundle`} option to avoid unintended bundling of dependencies, or set ${blue`deps.onlyAllowBundle: false`} to disable this hint.\nSee more at ${underline`https://tsdown.dev/options/dependencies#deps-onlyallowbundle`}\nDetected dependencies in bundle:\n${Array.from(deps).map((dep) => `- ${blue(dep)}`).join("\n")}`);
|
|
156
171
|
}
|
|
157
172
|
}
|
|
158
173
|
};
|
|
@@ -197,7 +212,25 @@ function detectIndentation(jsonText) {
|
|
|
197
212
|
}
|
|
198
213
|
return 2;
|
|
199
214
|
}
|
|
200
|
-
|
|
215
|
+
//#endregion
|
|
216
|
+
//#region ../../node_modules/.pnpm/tsdown@0.21.0_@arethetypeswrong+core@0.18.2_@tsdown+css@0.21.0_@tsdown+exe@0.21.0_@type_df9c58766eba71ed4fabe78a2cfe9dc9/node_modules/tsdown/dist/css-CzF_A79W.mjs
|
|
217
|
+
const defaultCssBundleName = "style.css";
|
|
218
|
+
function resolveCssOptions(options = {}, topLevelTarget) {
|
|
219
|
+
let cssTarget;
|
|
220
|
+
if (options.target === false) cssTarget = void 0;
|
|
221
|
+
else if (options.target == null) cssTarget = topLevelTarget;
|
|
222
|
+
else cssTarget = resolveComma(toArray(options.target));
|
|
223
|
+
return {
|
|
224
|
+
transformer: options.transformer ?? "lightningcss",
|
|
225
|
+
splitting: options.splitting ?? false,
|
|
226
|
+
fileName: options.fileName ?? "style.css",
|
|
227
|
+
minify: options.minify ?? false,
|
|
228
|
+
target: cssTarget,
|
|
229
|
+
preprocessorOptions: options.preprocessorOptions,
|
|
230
|
+
lightningcss: options.lightningcss,
|
|
231
|
+
postcss: options.postcss
|
|
232
|
+
};
|
|
233
|
+
}
|
|
201
234
|
//#endregion
|
|
202
235
|
//#region ../../node_modules/.pnpm/defu@6.1.4/node_modules/defu/dist/defu.mjs
|
|
203
236
|
function isPlainObject(value) {
|
|
@@ -225,20 +258,19 @@ function _defu(baseObject, defaults, namespace = ".", merger) {
|
|
|
225
258
|
function createDefu(merger) {
|
|
226
259
|
return (...arguments_) => arguments_.reduce((p, c) => _defu(p, c, "", merger), {});
|
|
227
260
|
}
|
|
228
|
-
|
|
229
|
-
|
|
261
|
+
createDefu();
|
|
262
|
+
createDefu((object, key, currentValue) => {
|
|
230
263
|
if (object[key] !== void 0 && typeof currentValue === "function") {
|
|
231
264
|
object[key] = currentValue(object[key]);
|
|
232
265
|
return true;
|
|
233
266
|
}
|
|
234
267
|
});
|
|
235
|
-
|
|
268
|
+
createDefu((object, key, currentValue) => {
|
|
236
269
|
if (Array.isArray(object[key]) && typeof currentValue === "function") {
|
|
237
270
|
object[key] = currentValue(object[key]);
|
|
238
271
|
return true;
|
|
239
272
|
}
|
|
240
273
|
});
|
|
241
|
-
|
|
242
274
|
//#endregion
|
|
243
275
|
//#region ../../node_modules/.pnpm/fdir@6.5.0_picomatch@4.0.3/node_modules/fdir/dist/index.mjs
|
|
244
276
|
var __require$1 = /* @__PURE__ */ createRequire$1(import.meta.url);
|
|
@@ -747,7 +779,6 @@ var Builder = class {
|
|
|
747
779
|
return this;
|
|
748
780
|
}
|
|
749
781
|
};
|
|
750
|
-
|
|
751
782
|
//#endregion
|
|
752
783
|
//#region ../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/constants.js
|
|
753
784
|
var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
@@ -801,28 +832,24 @@ var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
801
832
|
END_ANCHOR: `(?:[${WIN_SLASH}]|$)`,
|
|
802
833
|
SEP: "\\"
|
|
803
834
|
};
|
|
804
|
-
/**
|
|
805
|
-
* POSIX Bracket Regex
|
|
806
|
-
*/
|
|
807
|
-
const POSIX_REGEX_SOURCE = {
|
|
808
|
-
alnum: "a-zA-Z0-9",
|
|
809
|
-
alpha: "a-zA-Z",
|
|
810
|
-
ascii: "\\x00-\\x7F",
|
|
811
|
-
blank: " \\t",
|
|
812
|
-
cntrl: "\\x00-\\x1F\\x7F",
|
|
813
|
-
digit: "0-9",
|
|
814
|
-
graph: "\\x21-\\x7E",
|
|
815
|
-
lower: "a-z",
|
|
816
|
-
print: "\\x20-\\x7E ",
|
|
817
|
-
punct: "\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",
|
|
818
|
-
space: " \\t\\r\\n\\v\\f",
|
|
819
|
-
upper: "A-Z",
|
|
820
|
-
word: "A-Za-z0-9_",
|
|
821
|
-
xdigit: "A-Fa-f0-9"
|
|
822
|
-
};
|
|
823
835
|
module.exports = {
|
|
824
836
|
MAX_LENGTH: 1024 * 64,
|
|
825
|
-
POSIX_REGEX_SOURCE
|
|
837
|
+
POSIX_REGEX_SOURCE: {
|
|
838
|
+
alnum: "a-zA-Z0-9",
|
|
839
|
+
alpha: "a-zA-Z",
|
|
840
|
+
ascii: "\\x00-\\x7F",
|
|
841
|
+
blank: " \\t",
|
|
842
|
+
cntrl: "\\x00-\\x1F\\x7F",
|
|
843
|
+
digit: "0-9",
|
|
844
|
+
graph: "\\x21-\\x7E",
|
|
845
|
+
lower: "a-z",
|
|
846
|
+
print: "\\x20-\\x7E ",
|
|
847
|
+
punct: "\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",
|
|
848
|
+
space: " \\t\\r\\n\\v\\f",
|
|
849
|
+
upper: "A-Z",
|
|
850
|
+
word: "A-Za-z0-9_",
|
|
851
|
+
xdigit: "A-Fa-f0-9"
|
|
852
|
+
},
|
|
826
853
|
REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
|
|
827
854
|
REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
|
|
828
855
|
REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
|
|
@@ -912,7 +939,6 @@ var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
912
939
|
}
|
|
913
940
|
};
|
|
914
941
|
}));
|
|
915
|
-
|
|
916
942
|
//#endregion
|
|
917
943
|
//#region ../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/utils.js
|
|
918
944
|
var require_utils = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -961,7 +987,6 @@ var require_utils = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
961
987
|
return last;
|
|
962
988
|
};
|
|
963
989
|
}));
|
|
964
|
-
|
|
965
990
|
//#endregion
|
|
966
991
|
//#region ../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/scan.js
|
|
967
992
|
var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
@@ -1249,7 +1274,6 @@ var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1249
1274
|
};
|
|
1250
1275
|
module.exports = scan;
|
|
1251
1276
|
}));
|
|
1252
|
-
|
|
1253
1277
|
//#endregion
|
|
1254
1278
|
//#region ../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/parse.js
|
|
1255
1279
|
var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
@@ -2108,7 +2132,6 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
2108
2132
|
};
|
|
2109
2133
|
module.exports = parse;
|
|
2110
2134
|
}));
|
|
2111
|
-
|
|
2112
2135
|
//#endregion
|
|
2113
2136
|
//#region ../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/picomatch.js
|
|
2114
2137
|
var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
@@ -2401,10 +2424,9 @@ var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
2401
2424
|
*/
|
|
2402
2425
|
module.exports = picomatch;
|
|
2403
2426
|
}));
|
|
2404
|
-
|
|
2405
2427
|
//#endregion
|
|
2406
|
-
//#region ../../node_modules/.pnpm/
|
|
2407
|
-
var
|
|
2428
|
+
//#region ../../node_modules/.pnpm/tinyglobby@0.2.15/node_modules/tinyglobby/dist/index.mjs
|
|
2429
|
+
var import_picomatch = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2408
2430
|
const pico = require_picomatch$1();
|
|
2409
2431
|
const utils = require_utils();
|
|
2410
2432
|
function picomatch(glob, options, returnState = false) {
|
|
@@ -2416,11 +2438,7 @@ var require_picomatch = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
2416
2438
|
}
|
|
2417
2439
|
Object.assign(picomatch, pico);
|
|
2418
2440
|
module.exports = picomatch;
|
|
2419
|
-
}));
|
|
2420
|
-
|
|
2421
|
-
//#endregion
|
|
2422
|
-
//#region ../../node_modules/.pnpm/tinyglobby@0.2.15/node_modules/tinyglobby/dist/index.mjs
|
|
2423
|
-
var import_picomatch = /* @__PURE__ */ __toESM(require_picomatch(), 1);
|
|
2441
|
+
})))(), 1);
|
|
2424
2442
|
const isReadonlyArray = Array.isArray;
|
|
2425
2443
|
const isWin = process.platform === "win32";
|
|
2426
2444
|
const ONLY_PARENT_DIRECTORIES = /^(\/?\.\.)+$/;
|
|
@@ -2701,7 +2719,6 @@ async function glob(patternsOrOptions, options) {
|
|
|
2701
2719
|
if (!relative) return crawler.withPromise();
|
|
2702
2720
|
return formatPaths(await crawler.withPromise(), relative);
|
|
2703
2721
|
}
|
|
2704
|
-
|
|
2705
2722
|
//#endregion
|
|
2706
2723
|
//#region ../../node_modules/.pnpm/empathic@2.0.0/node_modules/empathic/resolve.mjs
|
|
2707
2724
|
/**
|
|
@@ -2715,7 +2732,6 @@ async function glob(patternsOrOptions, options) {
|
|
|
2715
2732
|
function absolute(input, root) {
|
|
2716
2733
|
return isAbsolute(input) ? input : resolve(root || ".", input);
|
|
2717
2734
|
}
|
|
2718
|
-
|
|
2719
2735
|
//#endregion
|
|
2720
2736
|
//#region ../../node_modules/.pnpm/empathic@2.0.0/node_modules/empathic/walk.mjs
|
|
2721
2737
|
/**
|
|
@@ -2736,7 +2752,6 @@ function up$2(base, options) {
|
|
|
2736
2752
|
}
|
|
2737
2753
|
return arr;
|
|
2738
2754
|
}
|
|
2739
|
-
|
|
2740
2755
|
//#endregion
|
|
2741
2756
|
//#region ../../node_modules/.pnpm/empathic@2.0.0/node_modules/empathic/find.mjs
|
|
2742
2757
|
/**
|
|
@@ -2747,13 +2762,11 @@ function up$2(base, options) {
|
|
|
2747
2762
|
*/
|
|
2748
2763
|
function up$1(name, options) {
|
|
2749
2764
|
let dir, tmp;
|
|
2750
|
-
|
|
2751
|
-
for (dir of up$2(start, options)) {
|
|
2765
|
+
for (dir of up$2(options && options.cwd || "", options)) {
|
|
2752
2766
|
tmp = join(dir, name);
|
|
2753
2767
|
if (existsSync(tmp)) return tmp;
|
|
2754
2768
|
}
|
|
2755
2769
|
}
|
|
2756
|
-
|
|
2757
2770
|
//#endregion
|
|
2758
2771
|
//#region ../../node_modules/.pnpm/empathic@2.0.0/node_modules/empathic/package.mjs
|
|
2759
2772
|
/**
|
|
@@ -2763,7 +2776,6 @@ function up$1(name, options) {
|
|
|
2763
2776
|
function up(options) {
|
|
2764
2777
|
return up$1("package.json", options);
|
|
2765
2778
|
}
|
|
2766
|
-
|
|
2767
2779
|
//#endregion
|
|
2768
2780
|
//#region ../../node_modules/.pnpm/import-without-cache@0.2.5/node_modules/import-without-cache/dist/index.mjs
|
|
2769
2781
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
@@ -2820,7 +2832,6 @@ function cleanupImportAttributes(context) {
|
|
|
2820
2832
|
context.importAttributes = attrs;
|
|
2821
2833
|
Object.freeze(context.importAttributes);
|
|
2822
2834
|
}
|
|
2823
|
-
|
|
2824
2835
|
//#endregion
|
|
2825
2836
|
//#region ../../node_modules/.pnpm/quansync@1.0.0/node_modules/quansync/dist/src-C2Pm6gXo.js
|
|
2826
2837
|
const GET_IS_ASYNC = Symbol.for("quansync.getIsAsync");
|
|
@@ -2901,14 +2912,10 @@ function quansync$1(input, options) {
|
|
|
2901
2912
|
if (typeof input === "function") return fromGeneratorFn(input, options);
|
|
2902
2913
|
else return fromObject(input);
|
|
2903
2914
|
}
|
|
2904
|
-
|
|
2905
|
-
* @returns `true` if the current context is async, `false` otherwise.
|
|
2906
|
-
*/
|
|
2907
|
-
const getIsAsync = quansync$1({
|
|
2915
|
+
quansync$1({
|
|
2908
2916
|
async: () => Promise.resolve(true),
|
|
2909
2917
|
sync: () => false
|
|
2910
2918
|
});
|
|
2911
|
-
|
|
2912
2919
|
//#endregion
|
|
2913
2920
|
//#region ../../node_modules/.pnpm/quansync@1.0.0/node_modules/quansync/dist/macro.js
|
|
2914
2921
|
/**
|
|
@@ -2921,34 +2928,19 @@ const getIsAsync = quansync$1({
|
|
|
2921
2928
|
* @internal
|
|
2922
2929
|
*/
|
|
2923
2930
|
const quansync = quansync$1;
|
|
2924
|
-
|
|
2925
|
-
//#endregion
|
|
2926
|
-
//#region ../../node_modules/.pnpm/@quansync+fs@1.0.0/node_modules/@quansync/fs/dist/index.mjs
|
|
2927
|
-
/**
|
|
2928
|
-
* @link https://nodejs.org/api/fs.html#fspromisesreadfilepath-options
|
|
2929
|
-
*/
|
|
2930
|
-
const readFile$1 = quansync$1({
|
|
2931
|
+
quansync$1({
|
|
2931
2932
|
sync: fs$1.readFileSync,
|
|
2932
2933
|
async: fs$1.promises.readFile
|
|
2933
2934
|
});
|
|
2934
|
-
|
|
2935
|
-
* @link https://nodejs.org/api/fs.html#fspromiseswritefilefile-data-options
|
|
2936
|
-
*/
|
|
2937
|
-
const writeFile$1 = quansync$1({
|
|
2935
|
+
quansync$1({
|
|
2938
2936
|
sync: fs$1.writeFileSync,
|
|
2939
2937
|
async: fs$1.promises.writeFile
|
|
2940
2938
|
});
|
|
2941
|
-
|
|
2942
|
-
* @link https://nodejs.org/api/fs.html#fspromisesunlinkpath
|
|
2943
|
-
*/
|
|
2944
|
-
const unlink = quansync$1({
|
|
2939
|
+
quansync$1({
|
|
2945
2940
|
sync: fs$1.unlinkSync,
|
|
2946
2941
|
async: fs$1.promises.unlink
|
|
2947
2942
|
});
|
|
2948
|
-
|
|
2949
|
-
* @link https://nodejs.org/api/fs.html#fspromisesaccesspath-mode
|
|
2950
|
-
*/
|
|
2951
|
-
const access$1 = quansync$1({
|
|
2943
|
+
quansync$1({
|
|
2952
2944
|
sync: fs$1.accessSync,
|
|
2953
2945
|
async: fs$1.promises.access
|
|
2954
2946
|
});
|
|
@@ -2963,105 +2955,62 @@ const lstat = quansync$1({
|
|
|
2963
2955
|
sync: fs$1.lstatSync,
|
|
2964
2956
|
async: fs$1.promises.lstat
|
|
2965
2957
|
});
|
|
2966
|
-
|
|
2967
|
-
* @link https://nodejs.org/api/fs.html#fspromisescpsrc-dest-options
|
|
2968
|
-
*/
|
|
2969
|
-
const cp$1 = quansync$1({
|
|
2958
|
+
quansync$1({
|
|
2970
2959
|
sync: fs$1.copyFileSync,
|
|
2971
2960
|
async: fs$1.promises.copyFile
|
|
2972
2961
|
});
|
|
2973
|
-
|
|
2974
|
-
* @link https://nodejs.org/api/fs.html#fspromisesrmpath-options
|
|
2975
|
-
*/
|
|
2976
|
-
const rm$1 = quansync$1({
|
|
2962
|
+
quansync$1({
|
|
2977
2963
|
sync: fs$1.rmSync,
|
|
2978
2964
|
async: fs$1.promises.rm
|
|
2979
2965
|
});
|
|
2980
|
-
|
|
2981
|
-
* @link https://nodejs.org/api/fs.html#fspromisesmkdirpath-options
|
|
2982
|
-
*/
|
|
2983
|
-
const mkdir = quansync$1({
|
|
2966
|
+
quansync$1({
|
|
2984
2967
|
sync: fs$1.mkdirSync,
|
|
2985
2968
|
async: fs$1.promises.mkdir
|
|
2986
2969
|
});
|
|
2987
|
-
|
|
2988
|
-
* @link https://nodejs.org/api/fs.html#fspromisesrenameoldpath-newpath
|
|
2989
|
-
*/
|
|
2990
|
-
const rename = quansync$1({
|
|
2970
|
+
quansync$1({
|
|
2991
2971
|
sync: fs$1.renameSync,
|
|
2992
2972
|
async: fs$1.promises.rename
|
|
2993
2973
|
});
|
|
2994
|
-
|
|
2995
|
-
* @link https://nodejs.org/api/fs.html#fspromisesreaddirpath-options
|
|
2996
|
-
*/
|
|
2997
|
-
const readdir = quansync$1({
|
|
2974
|
+
quansync$1({
|
|
2998
2975
|
sync: fs$1.readdirSync,
|
|
2999
2976
|
async: fs$1.promises.readdir
|
|
3000
2977
|
});
|
|
3001
|
-
|
|
3002
|
-
* @link https://nodejs.org/api/fs.html#fspromisesrealpathpath-options
|
|
3003
|
-
*/
|
|
3004
|
-
const realpath = quansync$1({
|
|
2978
|
+
quansync$1({
|
|
3005
2979
|
sync: fs$1.realpathSync,
|
|
3006
2980
|
async: fs$1.promises.realpath
|
|
3007
2981
|
});
|
|
3008
|
-
|
|
3009
|
-
* @link https://nodejs.org/api/fs.html#fspromisesreadlinkpath-options
|
|
3010
|
-
*/
|
|
3011
|
-
const readlink = quansync$1({
|
|
2982
|
+
quansync$1({
|
|
3012
2983
|
sync: fs$1.readlinkSync,
|
|
3013
2984
|
async: fs$1.promises.readlink
|
|
3014
2985
|
});
|
|
3015
|
-
|
|
3016
|
-
* @link https://nodejs.org/api/fs.html#fspromisessymlinktarget-path-type
|
|
3017
|
-
*/
|
|
3018
|
-
const symlink = quansync$1({
|
|
2986
|
+
quansync$1({
|
|
3019
2987
|
sync: fs$1.symlinkSync,
|
|
3020
2988
|
async: fs$1.promises.symlink
|
|
3021
2989
|
});
|
|
3022
|
-
|
|
3023
|
-
* @link https://nodejs.org/api/fs.html#fspromiseschownpath-uid-gid
|
|
3024
|
-
*/
|
|
3025
|
-
const chown = quansync$1({
|
|
2990
|
+
quansync$1({
|
|
3026
2991
|
sync: fs$1.chownSync,
|
|
3027
2992
|
async: fs$1.promises.chown
|
|
3028
2993
|
});
|
|
3029
|
-
|
|
3030
|
-
* @link https://nodejs.org/api/fs.html#fspromiseslchownpath-uid-gid
|
|
3031
|
-
*/
|
|
3032
|
-
const lchown = quansync$1({
|
|
2994
|
+
quansync$1({
|
|
3033
2995
|
sync: fs$1.lchownSync,
|
|
3034
2996
|
async: fs$1.promises.lchown
|
|
3035
2997
|
});
|
|
3036
|
-
|
|
3037
|
-
* @link https://nodejs.org/api/fs.html#fspromiseschmodpath-mode
|
|
3038
|
-
*/
|
|
3039
|
-
const chmod$1 = quansync$1({
|
|
2998
|
+
quansync$1({
|
|
3040
2999
|
sync: fs$1.chmodSync,
|
|
3041
3000
|
async: fs$1.promises.chmod
|
|
3042
3001
|
});
|
|
3043
|
-
|
|
3044
|
-
* @link https://nodejs.org/api/fs.html#fspromisesutimespath-atime-mtime
|
|
3045
|
-
*/
|
|
3046
|
-
const utimes = quansync$1({
|
|
3002
|
+
quansync$1({
|
|
3047
3003
|
sync: fs$1.utimesSync,
|
|
3048
3004
|
async: fs$1.promises.utimes
|
|
3049
3005
|
});
|
|
3050
|
-
|
|
3051
|
-
* @link https://nodejs.org/api/fs.html#fspromiseslutimespath-atime-mtime
|
|
3052
|
-
*/
|
|
3053
|
-
const lutimes = quansync$1({
|
|
3006
|
+
quansync$1({
|
|
3054
3007
|
sync: fs$1.lutimesSync,
|
|
3055
3008
|
async: fs$1.promises.lutimes
|
|
3056
3009
|
});
|
|
3057
|
-
|
|
3058
|
-
* @link https://nodejs.org/api/fs.html#fspromisesmkdtempprefix-options
|
|
3059
|
-
*/
|
|
3060
|
-
const mkdtemp$1 = quansync$1({
|
|
3010
|
+
quansync$1({
|
|
3061
3011
|
sync: fs$1.mkdtempSync,
|
|
3062
3012
|
async: fs$1.promises.mkdtemp
|
|
3063
3013
|
});
|
|
3064
|
-
|
|
3065
3014
|
//#endregion
|
|
3066
3015
|
//#region ../../node_modules/.pnpm/unconfig-core@7.5.0/node_modules/unconfig-core/dist/index.mjs
|
|
3067
3016
|
const isFile = quansync(function* (path, allowSymlinks) {
|
|
@@ -3138,12 +3087,11 @@ function createConfigCoreLoader(options) {
|
|
|
3138
3087
|
findConfigs
|
|
3139
3088
|
};
|
|
3140
3089
|
}
|
|
3141
|
-
|
|
3142
3090
|
//#endregion
|
|
3143
|
-
//#region ../../node_modules/.pnpm/tsdown@0.21.
|
|
3091
|
+
//#region ../../node_modules/.pnpm/tsdown@0.21.0_@arethetypeswrong+core@0.18.2_@tsdown+css@0.21.0_@tsdown+exe@0.21.0_@type_df9c58766eba71ed4fabe78a2cfe9dc9/node_modules/tsdown/dist/options-DpJJmGDp.mjs
|
|
3144
3092
|
const __cjs_require$1 = createRequire(import.meta.url);
|
|
3145
|
-
const satisfies$1 = __cjs_require$1("./npm_entry_semver_functions_satisfies.cjs");
|
|
3146
3093
|
const picomatch = __cjs_require$1("./npm_entry_picomatch.cjs");
|
|
3094
|
+
const satisfies$1 = __cjs_require$1("./npm_entry_semver_functions_satisfies.cjs");
|
|
3147
3095
|
const minVersion = __cjs_require$1("./npm_entry_semver_ranges_min-version.cjs");
|
|
3148
3096
|
const check = (key) => key in env && env[key] !== "0" && env[key] !== "false";
|
|
3149
3097
|
const isInCi = check("CI") || check("CONTINUOUS_INTEGRATION");
|
|
@@ -3184,13 +3132,6 @@ async function cleanChunks(outDir, chunks) {
|
|
|
3184
3132
|
await fsRemove(filePath);
|
|
3185
3133
|
}));
|
|
3186
3134
|
}
|
|
3187
|
-
const defaultCssBundleName = "style.css";
|
|
3188
|
-
function resolveCssOptions(options = {}) {
|
|
3189
|
-
return {
|
|
3190
|
-
splitting: options.splitting ?? true,
|
|
3191
|
-
fileName: options.fileName ?? defaultCssBundleName
|
|
3192
|
-
};
|
|
3193
|
-
}
|
|
3194
3135
|
async function resolveEntry(logger, entry, cwd, color, nameLabel) {
|
|
3195
3136
|
if (!entry || Object.keys(entry).length === 0) {
|
|
3196
3137
|
const defaultEntry = path.resolve(cwd, "src/index.ts");
|
|
@@ -3208,6 +3149,12 @@ function toObjectEntry(entry, cwd) {
|
|
|
3208
3149
|
if (!Array.isArray(entry)) return resolveObjectEntry(entry, cwd);
|
|
3209
3150
|
return resolveArrayEntry(entry, cwd);
|
|
3210
3151
|
}
|
|
3152
|
+
function isGlobEntry(entry) {
|
|
3153
|
+
if (!entry) return false;
|
|
3154
|
+
if (typeof entry === "string") return isDynamicPattern(entry);
|
|
3155
|
+
if (Array.isArray(entry)) return entry.some((e) => typeof e === "string" ? isDynamicPattern(e) : isGlobEntry(e));
|
|
3156
|
+
return Object.keys(entry).some((key) => key.includes("*"));
|
|
3157
|
+
}
|
|
3211
3158
|
async function resolveObjectEntry(entries, cwd) {
|
|
3212
3159
|
return Object.fromEntries((await Promise.all(Object.entries(entries).map(async ([key, value]) => {
|
|
3213
3160
|
if (!key.includes("*")) {
|
|
@@ -3253,7 +3200,7 @@ async function resolveArrayEntry(entries, cwd) {
|
|
|
3253
3200
|
const debug$3$2 = createDebug("tsdown:exe");
|
|
3254
3201
|
function validateSea({ dts, entry, logger, nameLabel }) {
|
|
3255
3202
|
if (process$1.versions.bun || process$1.versions.deno) throw new Error("The `exe` option is not supported in Bun and Deno environments.");
|
|
3256
|
-
if (!satisfies$1(process$1.version, ">=25.
|
|
3203
|
+
if (!satisfies$1(process$1.version, ">=25.7.0")) throw new Error(`Node.js version ${process$1.version} does not support \`exe\` option. Please upgrade to Node.js 25.7.0 or later.`);
|
|
3257
3204
|
if (Object.keys(entry).length > 1) throw new Error(`The \`exe\` feature currently only supports single entry points. Found entries:\n${JSON.stringify(entry, void 0, 2)}`);
|
|
3258
3205
|
if (dts) logger.warn(nameLabel, `Generating .d.ts files with \`exe\` option is not recommended since they won't be included in the executable. Consider separating your library and executable targets if you need type declarations.`);
|
|
3259
3206
|
logger.info(nameLabel, "`exe` option is experimental and may change in future releases.");
|
|
@@ -3265,12 +3212,27 @@ async function buildExe(config, chunks) {
|
|
|
3265
3212
|
const chunk = filteredChunks[0];
|
|
3266
3213
|
debug$3$2("Building executable with SEA for chunk:", chunk.fileName);
|
|
3267
3214
|
const bundledFile = path.join(config.outDir, chunk.fileName);
|
|
3268
|
-
|
|
3269
|
-
if (
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3215
|
+
const { targets } = config.exe;
|
|
3216
|
+
if (targets?.length) {
|
|
3217
|
+
if (config.exe.seaConfig?.executable) config.logger.warn(config.nameLabel, "`seaConfig.executable` is ignored when `targets` is specified.");
|
|
3218
|
+
const { resolveNodeBinary, getTargetSuffix } = await importWithError("@tsdown/exe");
|
|
3219
|
+
for (const target of targets) {
|
|
3220
|
+
const nodeBinaryPath = await resolveNodeBinary(target, config.logger);
|
|
3221
|
+
const suffix = getTargetSuffix(target);
|
|
3222
|
+
await buildSingleExe(config, bundledFile, resolveOutputFileName(config.exe, chunk, bundledFile, target, suffix), nodeBinaryPath, target);
|
|
3223
|
+
}
|
|
3224
|
+
} else await buildSingleExe(config, bundledFile, resolveOutputFileName(config.exe, chunk, bundledFile));
|
|
3225
|
+
}
|
|
3226
|
+
function resolveOutputFileName(exe, chunk, bundledFile, target, suffix) {
|
|
3227
|
+
let baseName;
|
|
3228
|
+
if (exe.fileName) baseName = typeof exe.fileName === "function" ? exe.fileName(chunk) : exe.fileName;
|
|
3229
|
+
else baseName = path.basename(bundledFile, path.extname(bundledFile));
|
|
3230
|
+
if (suffix) baseName += suffix;
|
|
3231
|
+
if (target?.platform ? target.platform === "win" : process$1.platform === "win32") baseName += ".exe";
|
|
3232
|
+
return baseName;
|
|
3233
|
+
}
|
|
3234
|
+
async function buildSingleExe(config, bundledFile, outputFile, executable, target) {
|
|
3235
|
+
const exe = config.exe;
|
|
3274
3236
|
const outputPath = path.join(config.outDir, outputFile);
|
|
3275
3237
|
debug$3$2("Building SEA executable: %s -> %s", bundledFile, outputPath);
|
|
3276
3238
|
const t = performance.now();
|
|
@@ -3278,26 +3240,39 @@ async function buildExe(config, chunks) {
|
|
|
3278
3240
|
try {
|
|
3279
3241
|
const seaConfig = {
|
|
3280
3242
|
disableExperimentalSEAWarning: true,
|
|
3281
|
-
...
|
|
3243
|
+
...exe.seaConfig,
|
|
3282
3244
|
main: bundledFile,
|
|
3283
3245
|
output: outputPath,
|
|
3284
3246
|
mainFormat: config.format === "es" ? "module" : "commonjs"
|
|
3285
3247
|
};
|
|
3248
|
+
if (executable) seaConfig.executable = executable;
|
|
3286
3249
|
const seaConfigPath = path.join(tempDir, "sea-config.json");
|
|
3287
3250
|
await writeFile(seaConfigPath, JSON.stringify(seaConfig));
|
|
3288
3251
|
debug$3$2("Wrote sea-config.json: %O -> %s", seaConfig, seaConfigPath);
|
|
3289
|
-
|
|
3252
|
+
debug$3$2("Running: %s --build-sea %s", process$1.execPath, seaConfigPath);
|
|
3253
|
+
await K(process$1.execPath, ["--build-sea", seaConfigPath], {
|
|
3254
|
+
nodeOptions: { stdio: [
|
|
3255
|
+
"ignore",
|
|
3256
|
+
"ignore",
|
|
3257
|
+
"inherit"
|
|
3258
|
+
] },
|
|
3259
|
+
throwOnError: true
|
|
3260
|
+
});
|
|
3290
3261
|
} finally {
|
|
3291
|
-
|
|
3262
|
+
if (debug$3$2.enabled) debug$3$2("Preserving temp directory for debugging: %s", tempDir);
|
|
3263
|
+
else await fsRemove(tempDir);
|
|
3292
3264
|
}
|
|
3293
|
-
if (process$1.platform === "darwin") try {
|
|
3265
|
+
if ((target?.platform || process$1.platform) === "darwin") try {
|
|
3294
3266
|
await K("codesign", [
|
|
3295
3267
|
"--sign",
|
|
3296
3268
|
"-",
|
|
3297
3269
|
outputPath
|
|
3298
|
-
], {
|
|
3270
|
+
], {
|
|
3271
|
+
nodeOptions: { stdio: "inherit" },
|
|
3272
|
+
throwOnError: true
|
|
3273
|
+
});
|
|
3299
3274
|
} catch {
|
|
3300
|
-
config.logger.warn(config.nameLabel, `Failed to
|
|
3275
|
+
config.logger.warn(config.nameLabel, `Failed to code-sign the executable. ${process$1.platform === "darwin" ? `You can sign it manually using:\n codesign --sign - "${outputPath}"` : `Automatic code signing is not supported on ${process$1.platform}.`}`);
|
|
3301
3276
|
}
|
|
3302
3277
|
const stat = await fsStat(outputPath);
|
|
3303
3278
|
if (stat) {
|
|
@@ -3306,9 +3281,9 @@ async function buildExe(config, chunks) {
|
|
|
3306
3281
|
}
|
|
3307
3282
|
config.logger.success(config.nameLabel, `Built executable: ${red(path.relative(config.cwd, outputPath))}`, dim`(${Math.round(performance.now() - t)}ms)`);
|
|
3308
3283
|
}
|
|
3309
|
-
async function writeExports(options, chunks) {
|
|
3284
|
+
async function writeExports(options, chunks, inlinedDeps) {
|
|
3310
3285
|
const { pkg } = options;
|
|
3311
|
-
const { publishExports, ...generated } = await generateExports(pkg, chunks, options);
|
|
3286
|
+
const { publishExports, ...generated } = await generateExports(pkg, chunks, options, inlinedDeps);
|
|
3312
3287
|
const updatedPkg = {
|
|
3313
3288
|
...pkg,
|
|
3314
3289
|
...generated,
|
|
@@ -3327,8 +3302,8 @@ function shouldExclude(fileName, exclude) {
|
|
|
3327
3302
|
if (!exclude?.length) return false;
|
|
3328
3303
|
return matchPattern(fileName, exclude);
|
|
3329
3304
|
}
|
|
3330
|
-
async function generateExports(pkg, chunks, options) {
|
|
3331
|
-
let { exports: { devExports, all, packageJson = true, exclude, customExports, legacy }, css, logger } = options;
|
|
3305
|
+
async function generateExports(pkg, chunks, options, inlinedDeps) {
|
|
3306
|
+
let { exports: { devExports, all, packageJson = true, exclude, customExports, legacy, inlinedDependencies: emitInlinedDeps = true }, css, logger } = options;
|
|
3332
3307
|
const pkgRoot = path.dirname(pkg.packageJsonPath);
|
|
3333
3308
|
let main, module, cjsTypes, esmTypes;
|
|
3334
3309
|
const exportsMap = /* @__PURE__ */ new Map();
|
|
@@ -3407,6 +3382,7 @@ async function generateExports(pkg, chunks, options) {
|
|
|
3407
3382
|
module: legacy ? module || pkg.module : void 0,
|
|
3408
3383
|
types: legacy ? cjsTypes || esmTypes || pkg.types : pkg.types,
|
|
3409
3384
|
exports,
|
|
3385
|
+
inlinedDependencies: emitInlinedDeps ? inlinedDeps : void 0,
|
|
3410
3386
|
publishExports
|
|
3411
3387
|
};
|
|
3412
3388
|
}
|
|
@@ -3429,7 +3405,7 @@ function exportMeta(exports, all, packageJson) {
|
|
|
3429
3405
|
}
|
|
3430
3406
|
function exportCss(exports, chunks, { splitting }, pkgRoot) {
|
|
3431
3407
|
if (splitting) return;
|
|
3432
|
-
for (const chunksByFormat of Object.values(chunks)) for (const chunk of chunksByFormat) if (chunk.type === "asset" && RE_CSS.test(chunk.fileName)) {
|
|
3408
|
+
for (const chunksByFormat of Object.values(chunks)) for (const chunk of chunksByFormat) if (chunk.type === "asset" && RE_CSS$1.test(chunk.fileName)) {
|
|
3433
3409
|
const filename = slash(chunk.fileName);
|
|
3434
3410
|
exports[`./${filename}`] = join$1(pkgRoot, chunk.outDir, filename);
|
|
3435
3411
|
return;
|
|
@@ -3663,7 +3639,7 @@ async function nativeImport(id) {
|
|
|
3663
3639
|
return mod.default || mod;
|
|
3664
3640
|
}
|
|
3665
3641
|
async function unrunImport(id) {
|
|
3666
|
-
const { unrun } = await import("./dist-
|
|
3642
|
+
const { unrun } = await import("./dist-Ba2DZx1w.js");
|
|
3667
3643
|
const { module } = await unrun({ path: pathToFileURL(id).href });
|
|
3668
3644
|
return module;
|
|
3669
3645
|
}
|
|
@@ -3697,6 +3673,7 @@ async function resolveUserConfig(userConfig, inlineConfig) {
|
|
|
3697
3673
|
nodeProtocol = nodeProtocol ?? (removeNodeProtocol ? "strip" : false);
|
|
3698
3674
|
outDir = path.resolve(cwd, outDir);
|
|
3699
3675
|
clean = resolveClean(clean, outDir, cwd);
|
|
3676
|
+
const rawEntry = entry;
|
|
3700
3677
|
const resolvedEntry = await resolveEntry(logger, entry, cwd, color, nameLabel);
|
|
3701
3678
|
target = resolveTarget(logger, target, color, pkg, nameLabel);
|
|
3702
3679
|
tsconfig = await resolveTsconfig(logger, tsconfig, cwd, color, nameLabel);
|
|
@@ -3762,7 +3739,7 @@ async function resolveUserConfig(userConfig, inlineConfig) {
|
|
|
3762
3739
|
cjsDefault,
|
|
3763
3740
|
clean,
|
|
3764
3741
|
copy: publicDir || copy,
|
|
3765
|
-
css: resolveCssOptions(css),
|
|
3742
|
+
css: resolveCssOptions(css, target),
|
|
3766
3743
|
cwd,
|
|
3767
3744
|
deps: depsConfig,
|
|
3768
3745
|
devtools,
|
|
@@ -3784,6 +3761,7 @@ async function resolveUserConfig(userConfig, inlineConfig) {
|
|
|
3784
3761
|
platform,
|
|
3785
3762
|
plugins,
|
|
3786
3763
|
publint,
|
|
3764
|
+
rawEntry,
|
|
3787
3765
|
report,
|
|
3788
3766
|
shims,
|
|
3789
3767
|
sourcemap,
|
|
@@ -3795,13 +3773,9 @@ async function resolveUserConfig(userConfig, inlineConfig) {
|
|
|
3795
3773
|
watch,
|
|
3796
3774
|
write
|
|
3797
3775
|
};
|
|
3798
|
-
|
|
3799
|
-
if (exe) {
|
|
3800
|
-
validateSea(config);
|
|
3801
|
-
if (satisfies$1(process$1.version, "<25.7.0")) defaultFormat = "cjs";
|
|
3802
|
-
}
|
|
3776
|
+
if (exe) validateSea(config);
|
|
3803
3777
|
const objectFormat = typeof format === "object" && !Array.isArray(format);
|
|
3804
|
-
return (objectFormat ? Object.keys(format) : resolveComma(toArray(format,
|
|
3778
|
+
return (objectFormat ? Object.keys(format) : resolveComma(toArray(format, "esm"))).map((fmt, idx) => {
|
|
3805
3779
|
const once = idx === 0;
|
|
3806
3780
|
const overrides = objectFormat ? format[fmt] : void 0;
|
|
3807
3781
|
return {
|
|
@@ -3849,9 +3823,119 @@ function filterConfig(filter, configCwd, name) {
|
|
|
3849
3823
|
if (filter instanceof RegExp) return name && filter.test(name) || filter.test(cwd);
|
|
3850
3824
|
return toArray(filter).some((value) => name && name === value || cwd === value);
|
|
3851
3825
|
}
|
|
3852
|
-
|
|
3853
3826
|
//#endregion
|
|
3854
|
-
//#region ../../node_modules/.pnpm/tsdown@0.21.
|
|
3827
|
+
//#region ../../node_modules/.pnpm/tsdown@0.21.0_@arethetypeswrong+core@0.18.2_@tsdown+css@0.21.0_@tsdown+exe@0.21.0_@type_df9c58766eba71ed4fabe78a2cfe9dc9/node_modules/tsdown/dist/plugin-BQv869Ce.mjs
|
|
3828
|
+
/**
|
|
3829
|
+
* Detect and remove "pure CSS chunks" — JS chunks that exist only because
|
|
3830
|
+
* they imported CSS files. These chunks have no JS exports and all their
|
|
3831
|
+
* modules are CSS. Following Vite's implementation.
|
|
3832
|
+
*/
|
|
3833
|
+
function removePureCssChunks(bundle, styles) {
|
|
3834
|
+
const pureCssChunkNames = [];
|
|
3835
|
+
for (const [fileName, chunk] of Object.entries(bundle)) {
|
|
3836
|
+
if (chunk.type !== "chunk") continue;
|
|
3837
|
+
if (chunk.exports.length > 0) continue;
|
|
3838
|
+
const moduleIds = Object.keys(chunk.modules);
|
|
3839
|
+
if (moduleIds.length === 0) continue;
|
|
3840
|
+
if (!moduleIds.every((id) => styles.has(id))) continue;
|
|
3841
|
+
pureCssChunkNames.push(fileName);
|
|
3842
|
+
}
|
|
3843
|
+
if (!pureCssChunkNames.length) return;
|
|
3844
|
+
const replaceEmptyChunk = getEmptyChunkReplacer(pureCssChunkNames);
|
|
3845
|
+
for (const file of Object.keys(bundle)) {
|
|
3846
|
+
const chunk = bundle[file];
|
|
3847
|
+
if (chunk.type !== "chunk") continue;
|
|
3848
|
+
let chunkImportsPureCssChunk = false;
|
|
3849
|
+
chunk.imports = chunk.imports.filter((importFile) => {
|
|
3850
|
+
if (pureCssChunkNames.includes(importFile)) {
|
|
3851
|
+
chunkImportsPureCssChunk = true;
|
|
3852
|
+
return false;
|
|
3853
|
+
}
|
|
3854
|
+
return true;
|
|
3855
|
+
});
|
|
3856
|
+
if (chunkImportsPureCssChunk) chunk.code = replaceEmptyChunk(chunk.code);
|
|
3857
|
+
}
|
|
3858
|
+
for (const fileName of pureCssChunkNames) {
|
|
3859
|
+
delete bundle[fileName];
|
|
3860
|
+
delete bundle[`${fileName}.map`];
|
|
3861
|
+
}
|
|
3862
|
+
}
|
|
3863
|
+
/**
|
|
3864
|
+
* Create a replacer function that replaces import statements for pure CSS
|
|
3865
|
+
* chunks with block comments of the same length, preserving source map offsets.
|
|
3866
|
+
*/
|
|
3867
|
+
function getEmptyChunkReplacer(pureCssChunkNames) {
|
|
3868
|
+
const emptyChunkFiles = pureCssChunkNames.map((file) => escapeRegex(path.basename(file))).join("|");
|
|
3869
|
+
const emptyChunkRE = new RegExp(String.raw`\bimport\s*["'][^"']*(?:${emptyChunkFiles})["'];`, "g");
|
|
3870
|
+
return (code) => code.replace(emptyChunkRE, (m) => {
|
|
3871
|
+
return `/* empty css ${"".padEnd(m.length - 15)}*/`;
|
|
3872
|
+
});
|
|
3873
|
+
}
|
|
3874
|
+
function escapeRegex(str) {
|
|
3875
|
+
return str.replaceAll(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`);
|
|
3876
|
+
}
|
|
3877
|
+
function createCssPostHooks(config, styles) {
|
|
3878
|
+
const collectedCSS = [];
|
|
3879
|
+
return {
|
|
3880
|
+
renderChunk(_code, chunk) {
|
|
3881
|
+
let chunkCSS = "";
|
|
3882
|
+
for (const id of Object.keys(chunk.modules)) {
|
|
3883
|
+
const code = styles.get(id);
|
|
3884
|
+
if (code) chunkCSS += code;
|
|
3885
|
+
}
|
|
3886
|
+
if (!chunkCSS) return;
|
|
3887
|
+
if (chunkCSS.length > 0 && !chunkCSS.endsWith("\n")) chunkCSS += "\n";
|
|
3888
|
+
if (config.css.splitting) {
|
|
3889
|
+
const cssAssetFileName = chunk.fileName.replace(/\.(m?js|cjs)$/, ".css");
|
|
3890
|
+
this.emitFile({
|
|
3891
|
+
type: "asset",
|
|
3892
|
+
fileName: cssAssetFileName,
|
|
3893
|
+
source: chunkCSS
|
|
3894
|
+
});
|
|
3895
|
+
} else collectedCSS.push(chunkCSS);
|
|
3896
|
+
},
|
|
3897
|
+
generateBundle(_outputOptions, bundle) {
|
|
3898
|
+
if (!config.css.splitting && collectedCSS.length > 0) {
|
|
3899
|
+
const allCSS = collectedCSS.join("");
|
|
3900
|
+
if (allCSS) this.emitFile({
|
|
3901
|
+
type: "asset",
|
|
3902
|
+
fileName: config.css.fileName,
|
|
3903
|
+
source: allCSS,
|
|
3904
|
+
originalFileName: defaultCssBundleName
|
|
3905
|
+
});
|
|
3906
|
+
collectedCSS.length = 0;
|
|
3907
|
+
}
|
|
3908
|
+
removePureCssChunks(bundle, styles);
|
|
3909
|
+
}
|
|
3910
|
+
};
|
|
3911
|
+
}
|
|
3912
|
+
const RE_CSS = /\.css(?:$|\?)/;
|
|
3913
|
+
function CssPlugin(config) {
|
|
3914
|
+
const styles = /* @__PURE__ */ new Map();
|
|
3915
|
+
const postHooks = createCssPostHooks(config, styles);
|
|
3916
|
+
return {
|
|
3917
|
+
name: "tsdown:builtin-css",
|
|
3918
|
+
buildStart() {
|
|
3919
|
+
styles.clear();
|
|
3920
|
+
},
|
|
3921
|
+
load: {
|
|
3922
|
+
filter: { id: RE_CSS },
|
|
3923
|
+
async handler(id) {
|
|
3924
|
+
let code = await readFile(id, "utf8");
|
|
3925
|
+
if (code.length > 0 && !code.endsWith("\n")) code += "\n";
|
|
3926
|
+
styles.set(id, code);
|
|
3927
|
+
return {
|
|
3928
|
+
code: "",
|
|
3929
|
+
moduleSideEffects: "no-treeshake",
|
|
3930
|
+
moduleType: "js"
|
|
3931
|
+
};
|
|
3932
|
+
}
|
|
3933
|
+
},
|
|
3934
|
+
...postHooks
|
|
3935
|
+
};
|
|
3936
|
+
}
|
|
3937
|
+
//#endregion
|
|
3938
|
+
//#region ../../node_modules/.pnpm/tsdown@0.21.0_@arethetypeswrong+core@0.18.2_@tsdown+css@0.21.0_@tsdown+exe@0.21.0_@type_df9c58766eba71ed4fabe78a2cfe9dc9/node_modules/tsdown/dist/watch-BAbxxJcJ.mjs
|
|
3855
3939
|
/**
|
|
3856
3940
|
* The `node:` protocol was added in Node.js v14.18.0.
|
|
3857
3941
|
* @see https://nodejs.org/api/esm.html#node-imports
|
|
@@ -4011,7 +4095,6 @@ function WatchPlugin(configFiles, { config, chunks }) {
|
|
|
4011
4095
|
}
|
|
4012
4096
|
};
|
|
4013
4097
|
}
|
|
4014
|
-
|
|
4015
4098
|
//#endregion
|
|
4016
4099
|
//#region ../../node_modules/.pnpm/hookable@6.0.1/node_modules/hookable/dist/index.mjs
|
|
4017
4100
|
function flatHooks(configHooks, hooks = {}, parentName) {
|
|
@@ -4180,9 +4263,8 @@ var Hookable = class {
|
|
|
4180
4263
|
};
|
|
4181
4264
|
}
|
|
4182
4265
|
};
|
|
4183
|
-
|
|
4184
4266
|
//#endregion
|
|
4185
|
-
//#region ../../node_modules/.pnpm/tsdown@0.21.
|
|
4267
|
+
//#region ../../node_modules/.pnpm/tsdown@0.21.0_@arethetypeswrong+core@0.18.2_@tsdown+css@0.21.0_@tsdown+exe@0.21.0_@type_df9c58766eba71ed4fabe78a2cfe9dc9/node_modules/tsdown/dist/build-TmLngPCw.mjs
|
|
4186
4268
|
const __cjs_require = createRequire(import.meta.url);
|
|
4187
4269
|
const satisfies = __cjs_require("./npm_entry_semver_functions_satisfies.cjs");
|
|
4188
4270
|
const coerce = __cjs_require("./npm_entry_semver_functions_coerce.cjs");
|
|
@@ -4342,7 +4424,8 @@ function executeOnSuccess(config) {
|
|
|
4342
4424
|
if (typeof config.onSuccess === "string") {
|
|
4343
4425
|
const p = q(config.onSuccess, [], { nodeOptions: {
|
|
4344
4426
|
shell: true,
|
|
4345
|
-
stdio: "inherit"
|
|
4427
|
+
stdio: "inherit",
|
|
4428
|
+
cwd: config.cwd
|
|
4346
4429
|
} });
|
|
4347
4430
|
p.then(({ exitCode }) => {
|
|
4348
4431
|
if (exitCode) process$1.exitCode = exitCode;
|
|
@@ -4493,12 +4576,13 @@ async function bundleDone(bundleByPkg, bundle) {
|
|
|
4493
4576
|
if (exportsConfigs.length) {
|
|
4494
4577
|
if (exportsConfigs.length > 1) throw new Error(`Conflicting exports options for package at ${pkg.packageJsonPath}. Please merge them:\n${exportsConfigs.map((config) => `- ${formatWithOptions({ colors: true }, config.exports)}`).join("\n")}`);
|
|
4495
4578
|
const chunks = {};
|
|
4579
|
+
const inlinedDeps = mergeInlinedDeps(ctx.bundles);
|
|
4496
4580
|
for (const bundle of ctx.bundles) {
|
|
4497
4581
|
if (!bundle.config.exports) continue;
|
|
4498
4582
|
chunks[bundle.config.format] ||= [];
|
|
4499
4583
|
chunks[bundle.config.format].push(...bundle.chunks);
|
|
4500
4584
|
}
|
|
4501
|
-
await writeExports(exportsConfigs[0], chunks);
|
|
4585
|
+
await writeExports(exportsConfigs[0], chunks, inlinedDeps);
|
|
4502
4586
|
}
|
|
4503
4587
|
const publintConfigs = dedupeConfigs(configs, "publint");
|
|
4504
4588
|
const attwConfigs = dedupeConfigs(configs, "attw");
|
|
@@ -4516,7 +4600,7 @@ async function bundleDone(bundleByPkg, bundle) {
|
|
|
4516
4600
|
async function packTarball(packageJsonPath) {
|
|
4517
4601
|
const pkgDir = path.dirname(packageJsonPath);
|
|
4518
4602
|
const destination = await mkdtemp(path.join(tmpdir(), "tsdown-pack-"));
|
|
4519
|
-
const [{ detect }, { pack }] = await Promise.all([import("./detect-
|
|
4603
|
+
const [{ detect }, { pack }] = await Promise.all([import("./detect-DK-FDZQ9-CHuRhyUG.js"), import("./index-node-Djp92Gzb-B-AUHI4t.js")]);
|
|
4520
4604
|
try {
|
|
4521
4605
|
const detected = await detect({ cwd: pkgDir });
|
|
4522
4606
|
if (detected?.name === "deno") throw new Error(`Cannot pack tarball for Deno projects at ${pkgDir}`);
|
|
@@ -4542,126 +4626,16 @@ function dedupeConfigs(configs, key) {
|
|
|
4542
4626
|
if (results.length === 0) return [filtered[0]];
|
|
4543
4627
|
return results;
|
|
4544
4628
|
}
|
|
4545
|
-
|
|
4546
|
-
|
|
4547
|
-
|
|
4548
|
-
|
|
4549
|
-
|
|
4550
|
-
* [^3]: https://lightningcss.dev/transpilation.html
|
|
4551
|
-
*/
|
|
4552
|
-
function esbuildTargetToLightningCSS(target) {
|
|
4553
|
-
let targets;
|
|
4554
|
-
const matches = [...target.join(" ").toLowerCase().matchAll(TARGET_REGEX)];
|
|
4555
|
-
for (const match of matches) {
|
|
4556
|
-
const browser = ESBUILD_LIGHTNINGCSS_MAPPING[match[1]];
|
|
4557
|
-
if (!browser) continue;
|
|
4558
|
-
const version = match[2];
|
|
4559
|
-
const versionInt = parseVersion(version);
|
|
4560
|
-
if (versionInt == null) continue;
|
|
4561
|
-
targets = targets || {};
|
|
4562
|
-
targets[browser] = versionInt;
|
|
4629
|
+
function mergeInlinedDeps(bundles) {
|
|
4630
|
+
const merged = /* @__PURE__ */ new Map();
|
|
4631
|
+
for (const bundle of bundles) for (const [pkgName, versions] of bundle.inlinedDeps) {
|
|
4632
|
+
if (!merged.has(pkgName)) merged.set(pkgName, /* @__PURE__ */ new Set());
|
|
4633
|
+
for (const v of versions) merged.get(pkgName).add(v);
|
|
4563
4634
|
}
|
|
4564
|
-
return
|
|
4565
|
-
}
|
|
4566
|
-
const
|
|
4567
|
-
|
|
4568
|
-
chrome: "chrome",
|
|
4569
|
-
edge: "edge",
|
|
4570
|
-
firefox: "firefox",
|
|
4571
|
-
ie: "ie",
|
|
4572
|
-
ios: "ios_saf",
|
|
4573
|
-
opera: "opera",
|
|
4574
|
-
safari: "safari"
|
|
4575
|
-
};
|
|
4576
|
-
function parseVersion(version) {
|
|
4577
|
-
const [major, minor = 0, patch = 0] = version.split("-")[0].split(".").map((v) => Number.parseInt(v, 10));
|
|
4578
|
-
if (Number.isNaN(major) || Number.isNaN(minor) || Number.isNaN(patch)) return null;
|
|
4579
|
-
return major << 16 | minor << 8 | patch;
|
|
4580
|
-
}
|
|
4581
|
-
async function LightningCSSPlugin(options) {
|
|
4582
|
-
const LightningCSS = await import("unplugin-lightningcss/rolldown").catch(() => void 0);
|
|
4583
|
-
if (!LightningCSS) return;
|
|
4584
|
-
const targets = options.target && esbuildTargetToLightningCSS(options.target);
|
|
4585
|
-
if (!targets) return;
|
|
4586
|
-
return LightningCSS.default({ options: { targets } });
|
|
4587
|
-
}
|
|
4588
|
-
/**
|
|
4589
|
-
* CSS Code Split Plugin
|
|
4590
|
-
*
|
|
4591
|
-
* When css.splitting is false, this plugin merges all CSS files into a single file.
|
|
4592
|
-
* When css.splitting is true (default), CSS code splitting is preserved.
|
|
4593
|
-
* Based on Vite's implementation.
|
|
4594
|
-
*/
|
|
4595
|
-
function CssCodeSplitPlugin(config) {
|
|
4596
|
-
const { splitting, fileName } = config.css;
|
|
4597
|
-
if (splitting) return;
|
|
4598
|
-
return {
|
|
4599
|
-
name: "tsdown:css:splitting",
|
|
4600
|
-
generateBundle(_outputOptions, bundle) {
|
|
4601
|
-
const chunks = Object.values(bundle);
|
|
4602
|
-
const cssAssets = /* @__PURE__ */ new Map();
|
|
4603
|
-
for (const asset of chunks) if (asset.type === "asset" && typeof asset.source === "string" && RE_CSS.test(fileName)) cssAssets.set(asset.fileName, asset.source);
|
|
4604
|
-
if (!cssAssets.size) return;
|
|
4605
|
-
const chunkCSSMap = /* @__PURE__ */ new Map();
|
|
4606
|
-
for (const chunk of chunks) {
|
|
4607
|
-
if (chunk.type !== "chunk") continue;
|
|
4608
|
-
for (const moduleId of chunk.moduleIds) if (RE_CSS.test(moduleId)) {
|
|
4609
|
-
if (!chunkCSSMap.has(chunk.fileName)) chunkCSSMap.set(chunk.fileName, []);
|
|
4610
|
-
break;
|
|
4611
|
-
}
|
|
4612
|
-
}
|
|
4613
|
-
for (const cssFileName of cssAssets.keys()) {
|
|
4614
|
-
const cssBaseName = normalizeCssFileName(cssFileName);
|
|
4615
|
-
for (const chunkFileName of chunkCSSMap.keys()) if (normalizeChunkFileName(chunkFileName) === cssBaseName || chunkFileName.startsWith(`${cssBaseName}-`)) {
|
|
4616
|
-
chunkCSSMap.get(chunkFileName).push(cssFileName);
|
|
4617
|
-
break;
|
|
4618
|
-
}
|
|
4619
|
-
}
|
|
4620
|
-
let extractedCss = "";
|
|
4621
|
-
const collected = /* @__PURE__ */ new Set();
|
|
4622
|
-
const dynamicImports = /* @__PURE__ */ new Set();
|
|
4623
|
-
function collect(chunk) {
|
|
4624
|
-
if (!chunk || chunk.type !== "chunk" || collected.has(chunk)) return;
|
|
4625
|
-
collected.add(chunk);
|
|
4626
|
-
chunk.imports.forEach((importName) => {
|
|
4627
|
-
collect(bundle[importName]);
|
|
4628
|
-
});
|
|
4629
|
-
chunk.dynamicImports.forEach((importName) => {
|
|
4630
|
-
dynamicImports.add(importName);
|
|
4631
|
-
});
|
|
4632
|
-
const files = chunkCSSMap.get(chunk.fileName);
|
|
4633
|
-
if (files && files.length > 0) for (const filename of files) extractedCss += cssAssets.get(filename) ?? "";
|
|
4634
|
-
}
|
|
4635
|
-
for (const chunk of chunks) if (chunk.type === "chunk" && chunk.isEntry) collect(chunk);
|
|
4636
|
-
for (const chunkName of dynamicImports) collect(bundle[chunkName]);
|
|
4637
|
-
if (extractedCss) {
|
|
4638
|
-
for (const fileName of cssAssets.keys()) delete bundle[fileName];
|
|
4639
|
-
this.emitFile({
|
|
4640
|
-
type: "asset",
|
|
4641
|
-
source: extractedCss,
|
|
4642
|
-
fileName,
|
|
4643
|
-
originalFileName: defaultCssBundleName
|
|
4644
|
-
});
|
|
4645
|
-
}
|
|
4646
|
-
}
|
|
4647
|
-
};
|
|
4648
|
-
}
|
|
4649
|
-
const RE_CSS_HASH = /-[\w-]+\.css$/;
|
|
4650
|
-
const RE_CHUNK_HASH = /-[\w-]+\.(m?js|cjs)$/;
|
|
4651
|
-
const RE_CHUNK_EXT = /\.(m?js|cjs)$/;
|
|
4652
|
-
/**
|
|
4653
|
-
* Normalize CSS file name by removing hash pattern and extension.
|
|
4654
|
-
* e.g., "async-DcjEOEdU.css" -> "async"
|
|
4655
|
-
*/
|
|
4656
|
-
function normalizeCssFileName(cssFileName) {
|
|
4657
|
-
return cssFileName.replace(RE_CSS_HASH, "").replace(RE_CSS, "");
|
|
4658
|
-
}
|
|
4659
|
-
/**
|
|
4660
|
-
* Normalize chunk file name by removing hash pattern and extension.
|
|
4661
|
-
* e.g., "async-CvIfFAic.mjs" -> "async"
|
|
4662
|
-
*/
|
|
4663
|
-
function normalizeChunkFileName(chunkFileName) {
|
|
4664
|
-
return chunkFileName.replace(RE_CHUNK_HASH, "").replace(RE_CHUNK_EXT, "");
|
|
4635
|
+
if (!merged.size) return void 0;
|
|
4636
|
+
const result = {};
|
|
4637
|
+
for (const [pkgName, versions] of merged) result[pkgName] = versions.size === 1 ? [...versions][0] : [...versions].toSorted();
|
|
4638
|
+
return result;
|
|
4665
4639
|
}
|
|
4666
4640
|
function resolveJsOutputExtension(packageType, format, fixedExtension) {
|
|
4667
4641
|
switch (format) {
|
|
@@ -4703,7 +4677,7 @@ function resolveChunkAddon(chunkAddon, format) {
|
|
|
4703
4677
|
if (typeof chunkAddon === "string") return chunkAddon;
|
|
4704
4678
|
switch (true) {
|
|
4705
4679
|
case RE_JS.test(chunk.fileName): return chunkAddon?.js || "";
|
|
4706
|
-
case RE_CSS.test(chunk.fileName): return chunkAddon?.css || "";
|
|
4680
|
+
case RE_CSS$1.test(chunk.fileName): return chunkAddon?.css || "";
|
|
4707
4681
|
case RE_DTS.test(chunk.fileName): return chunkAddon?.dts || "";
|
|
4708
4682
|
default: return "";
|
|
4709
4683
|
}
|
|
@@ -4725,9 +4699,9 @@ async function resolveInputOptions(config, format, configFiles, bundle, cjsDts,
|
|
|
4725
4699
|
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;
|
|
4726
4700
|
const plugins = [];
|
|
4727
4701
|
if (nodeProtocol) plugins.push(NodeProtocolPlugin(nodeProtocol));
|
|
4728
|
-
if (config.pkg || config.deps.skipNodeModulesBundle) plugins.push(DepPlugin(config));
|
|
4702
|
+
if (config.pkg || config.deps.skipNodeModulesBundle) plugins.push(DepPlugin(config, bundle));
|
|
4729
4703
|
if (dts) {
|
|
4730
|
-
const { dts: dtsPlugin } = await import("./dist-
|
|
4704
|
+
const { dts: dtsPlugin } = await import("./dist-DCol2bGA.js");
|
|
4731
4705
|
const options = {
|
|
4732
4706
|
tsconfig,
|
|
4733
4707
|
...dts
|
|
@@ -4747,10 +4721,14 @@ async function resolveInputOptions(config, format, configFiles, bundle, cjsDts,
|
|
|
4747
4721
|
...unused
|
|
4748
4722
|
}));
|
|
4749
4723
|
}
|
|
4750
|
-
|
|
4751
|
-
|
|
4752
|
-
|
|
4753
|
-
|
|
4724
|
+
let cssPlugin;
|
|
4725
|
+
try {
|
|
4726
|
+
const { CssPlugin: AdvancedCssPlugin } = await import("@tsdown/css");
|
|
4727
|
+
cssPlugin = AdvancedCssPlugin(config, { logger });
|
|
4728
|
+
} catch {
|
|
4729
|
+
cssPlugin = CssPlugin(config);
|
|
4730
|
+
}
|
|
4731
|
+
plugins.push(cssPlugin, ShebangPlugin(logger, cwd, nameLabel, isDualFormat));
|
|
4754
4732
|
if (globImport) plugins.push(importGlobPlugin({ root: cwd }));
|
|
4755
4733
|
}
|
|
4756
4734
|
if (report && LogLevels[logger.level] >= 3) plugins.push(ReportPlugin(config, cjsDts, isDualFormat));
|
|
@@ -4780,11 +4758,14 @@ async function resolveInputOptions(config, format, configFiles, bundle, cjsDts,
|
|
|
4780
4758
|
inject
|
|
4781
4759
|
},
|
|
4782
4760
|
plugins,
|
|
4783
|
-
moduleTypes:
|
|
4761
|
+
moduleTypes: {
|
|
4762
|
+
".node": "copy",
|
|
4763
|
+
...loader
|
|
4764
|
+
},
|
|
4784
4765
|
logLevel: logger.level === "error" ? "silent" : logger.level,
|
|
4785
4766
|
onLog(level, log, defaultHandler) {
|
|
4786
4767
|
if (cjsDefault && log.code === "MIXED_EXPORT") return;
|
|
4787
|
-
if (logger.options?.failOnWarn && level === "warn") defaultHandler("error", log);
|
|
4768
|
+
if (logger.options?.failOnWarn && level === "warn" && log.code !== "PLUGIN_TIMINGS") defaultHandler("error", log);
|
|
4788
4769
|
defaultHandler(level, log);
|
|
4789
4770
|
},
|
|
4790
4771
|
devtools: devtools || void 0,
|
|
@@ -4958,6 +4939,7 @@ async function buildSingle(config, configFiles, isDualFormat, clean, restart, do
|
|
|
4958
4939
|
const bundle = {
|
|
4959
4940
|
chunks,
|
|
4960
4941
|
config,
|
|
4942
|
+
inlinedDeps: /* @__PURE__ */ new Map(),
|
|
4961
4943
|
async [asyncDispose]() {
|
|
4962
4944
|
debouncedPostBuild.cancel();
|
|
4963
4945
|
ab?.abort();
|
|
@@ -4980,7 +4962,7 @@ async function buildSingle(config, configFiles, isDualFormat, clean, restart, do
|
|
|
4980
4962
|
function handleWatcher(watcher) {
|
|
4981
4963
|
const changedFile = [];
|
|
4982
4964
|
let hasError = false;
|
|
4983
|
-
watcher.on("change", (id, event) => {
|
|
4965
|
+
watcher.on("change", async (id, event) => {
|
|
4984
4966
|
if (event.event === "update") {
|
|
4985
4967
|
changedFile.push(id);
|
|
4986
4968
|
debouncedPostBuild.cancel();
|
|
@@ -4990,6 +4972,13 @@ async function buildSingle(config, configFiles, isDualFormat, clean, restart, do
|
|
|
4990
4972
|
globalLogger.info(`Reload config: ${id}, restarting...`);
|
|
4991
4973
|
restart();
|
|
4992
4974
|
}
|
|
4975
|
+
if ((event.event === "create" || event.event === "delete") && config.rawEntry && isGlobEntry(config.rawEntry)) {
|
|
4976
|
+
const newEntry = await toObjectEntry(config.rawEntry, config.cwd);
|
|
4977
|
+
if (Object.keys(config.entry).toSorted().join("\0") !== Object.keys(newEntry).toSorted().join("\0")) {
|
|
4978
|
+
globalLogger.info("Entry files changed, restarting...");
|
|
4979
|
+
restart();
|
|
4980
|
+
}
|
|
4981
|
+
}
|
|
4993
4982
|
});
|
|
4994
4983
|
watcher.on("event", async (event) => {
|
|
4995
4984
|
switch (event.code) {
|
|
@@ -5045,6 +5034,5 @@ async function buildSingle(config, configFiles, isDualFormat, clean, restart, do
|
|
|
5045
5034
|
ab = executeOnSuccess(config);
|
|
5046
5035
|
}
|
|
5047
5036
|
}
|
|
5048
|
-
|
|
5049
5037
|
//#endregion
|
|
5050
|
-
export { resolveUserConfig as i, buildWithConfigs as n, mergeConfig as r, build$1 as t };
|
|
5038
|
+
export { resolveUserConfig as i, buildWithConfigs as n, mergeConfig as r, build$1 as t };
|