@voidzero-dev/vite-plus-core 0.1.15-alpha.4 → 0.1.15-alpha.6
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/tsdown/build-DU-BFLB1-BCro_0va.js +2 -0
- package/dist/tsdown/{build-DpU0PBVv-CUY7qeWj.js → build-DU-BFLB1-BP6FOpRZ.js} +172 -78
- package/dist/tsdown/{debug-C4FmgzkJ-A9B4RM_w.js → debug-BmAPbhgA-BPQhbB8P.js} +2 -2
- package/dist/tsdown/{detect-DN3DXXYt-GIMDNpE1.js → detect-h8ZFBH96-C_8f1Pj6.js} +1 -1
- package/dist/tsdown/{dist-dJp148cE.js → dist-B98oBzil.js} +642 -1359
- package/dist/tsdown/{dist-BkOM3Vdg.js → dist-Cqme3mtE.js} +14 -14
- package/dist/tsdown/dist-CxeZzY9B.js +848 -0
- package/dist/tsdown/{filename-UU7z2A9Z.js → filename-DQnUJlio-B_23lF2M.js} +1 -1
- package/dist/tsdown/index-types.d.ts +11629 -178
- package/dist/tsdown/index.js +4 -4
- package/dist/tsdown/{main-BgAbc3Rw.js → main-CYOGr7IM.js} +8 -11
- package/dist/tsdown/run.js +4 -4
- package/dist/tsdown/{tsc-ncSpKhL9.js → tsc-Cabpo8gE.js} +3 -3
- package/dist/tsdown/{tsc-context-BQtoHArj.js → tsc-context-CltQOpVo.js} +1 -1
- package/dist/vite/node/chunks/logger.js +1 -1
- package/package.json +7 -7
- package/dist/tsdown/build-D-zhBXEK-X12uvwLb.js +0 -2
- /package/dist/tsdown/{dist-_l70jCqI.js → dist-D8aGMhnG.js} +0 -0
- /package/dist/tsdown/{resolver-BUWpVKW_-BR1glCep.js → resolver-DkvdaW3s-CCXGyGZ3.js} +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { r as __toESM, t as __commonJSMin } from "./chunk-CSNpwdVU.js";
|
|
2
|
-
import { C as
|
|
2
|
+
import { C as promiseWithResolvers, D as toArray, E as slash, S as pkgExists, T as resolveRegex, _ as yellow, a as createLogger, b as matchPattern, c as globalLogger, d as bold, f as dim, g as underline, h as red, i as LogLevels, l as prettyFormat, n as z, o as generateColor, p as green, r as version, s as getNameLabel, t as R, u as blue, v as debounce, w as resolveComma, x as noop, y as importWithError } from "./main-CYOGr7IM.js";
|
|
3
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 } from "./filename-
|
|
4
|
+
import { d as filename_js_to_dts, i as RE_JS, n as RE_DTS, o as RE_NODE_MODULES$1, t as RE_CSS } from "./filename-DQnUJlio-B_23lF2M.js";
|
|
5
|
+
import "./dist-CxeZzY9B.js";
|
|
5
6
|
import module$1, { builtinModules, createRequire, isBuiltin } from "node:module";
|
|
6
|
-
import { pathToFileURL } from "node:url";
|
|
7
7
|
import process$1, { env } from "node:process";
|
|
8
8
|
import readline from "node:readline";
|
|
9
9
|
import { formatWithOptions, inspect, promisify } from "node:util";
|
|
@@ -11,17 +11,18 @@ import path, { dirname, isAbsolute, join, parse, resolve } from "node:path";
|
|
|
11
11
|
import { VERSION, build, watch } from "@voidzero-dev/vite-plus-core/rolldown";
|
|
12
12
|
import { access, chmod, cp, mkdir, mkdtemp, readFile, readdir, rm, stat, writeFile } from "node:fs/promises";
|
|
13
13
|
import { and, id, importerId, include } from "@voidzero-dev/vite-plus-core/rolldown/filter";
|
|
14
|
+
import re, { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
14
15
|
import * as nativeFs$1 from "fs";
|
|
15
16
|
import nativeFs from "fs";
|
|
16
17
|
import path$1, { basename, dirname as dirname$1, normalize as normalize$1, posix, relative, resolve as resolve$1, sep } from "path";
|
|
17
|
-
import { fileURLToPath
|
|
18
|
+
import { fileURLToPath } from "url";
|
|
18
19
|
import { createRequire as createRequire$1 } from "module";
|
|
19
20
|
import { tmpdir } from "node:os";
|
|
20
|
-
import
|
|
21
|
+
import { pathToFileURL } from "node:url";
|
|
21
22
|
import { Buffer } from "node:buffer";
|
|
22
23
|
import { brotliCompress, gzip } from "node:zlib";
|
|
23
24
|
import { importGlobPlugin } from "@voidzero-dev/vite-plus-core/rolldown/experimental";
|
|
24
|
-
//#region ../../node_modules/.pnpm/tsdown@0.21.
|
|
25
|
+
//#region ../../node_modules/.pnpm/tsdown@0.21.7_@arethetypeswrong+core@0.18.2_@tsdown+css@0.21.7_@tsdown+exe@0.21.7_@type_f4ea40ca957034c1fa8bb4b9c4426b84/node_modules/tsdown/dist/fs-Dd6Htx2P.mjs
|
|
25
26
|
function fsExists(path) {
|
|
26
27
|
return access(path).then(() => true, () => false);
|
|
27
28
|
}
|
|
@@ -64,7 +65,7 @@ function stripExtname(filePath) {
|
|
|
64
65
|
return filePath.slice(0, -ext.length);
|
|
65
66
|
}
|
|
66
67
|
//#endregion
|
|
67
|
-
//#region ../../node_modules/.pnpm/tsdown@0.21.
|
|
68
|
+
//#region ../../node_modules/.pnpm/tsdown@0.21.7_@arethetypeswrong+core@0.18.2_@tsdown+css@0.21.7_@tsdown+exe@0.21.7_@type_f4ea40ca957034c1fa8bb4b9c4426b84/node_modules/tsdown/dist/format-_3CEX8E7.mjs
|
|
68
69
|
const shimFile = path.resolve(import.meta.dirname, "..", "esm-shims.js");
|
|
69
70
|
function getShimsInject(format, platform) {
|
|
70
71
|
if (format === "es" && platform === "node") return {
|
|
@@ -183,7 +184,10 @@ function DepsPlugin({ pkg, deps: { alwaysBundle, onlyBundle, skipNodeModulesBund
|
|
|
183
184
|
async function externalStrategy(id, importer, resolved) {
|
|
184
185
|
if (id === shimFile) return false;
|
|
185
186
|
if (alwaysBundle?.(id, importer)) return "no-external";
|
|
186
|
-
if (skipNodeModulesBundle && resolved && (resolved.external || RE_NODE_MODULES$1.test(resolved.id)))
|
|
187
|
+
if (skipNodeModulesBundle && resolved && (resolved.external || RE_NODE_MODULES$1.test(resolved.id))) {
|
|
188
|
+
const resolvedDep = await resolveDepSubpath(id, resolved);
|
|
189
|
+
return resolvedDep ? [true, resolvedDep] : true;
|
|
190
|
+
}
|
|
187
191
|
if (deps) {
|
|
188
192
|
if (deps.includes(id) || deps.some((dep) => id.startsWith(`${dep}/`))) {
|
|
189
193
|
const resolvedDep = await resolveDepSubpath(id, resolved);
|
|
@@ -2866,7 +2870,7 @@ function formatPaths(paths, relative) {
|
|
|
2866
2870
|
}
|
|
2867
2871
|
function normalizeCwd(cwd) {
|
|
2868
2872
|
if (!cwd) return process.cwd().replace(BACKSLASHES, "/");
|
|
2869
|
-
if (cwd instanceof URL) return fileURLToPath
|
|
2873
|
+
if (cwd instanceof URL) return fileURLToPath(cwd).replace(BACKSLASHES, "/");
|
|
2870
2874
|
return path$1.resolve(cwd).replace(BACKSLASHES, "/");
|
|
2871
2875
|
}
|
|
2872
2876
|
function getCrawler(patterns, inputOptions = {}) {
|
|
@@ -3178,87 +3182,87 @@ quansync$1({
|
|
|
3178
3182
|
*/
|
|
3179
3183
|
const quansync = quansync$1;
|
|
3180
3184
|
quansync$1({
|
|
3181
|
-
sync:
|
|
3182
|
-
async:
|
|
3185
|
+
sync: re.readFileSync,
|
|
3186
|
+
async: re.promises.readFile
|
|
3183
3187
|
});
|
|
3184
3188
|
quansync$1({
|
|
3185
|
-
sync:
|
|
3186
|
-
async:
|
|
3189
|
+
sync: re.writeFileSync,
|
|
3190
|
+
async: re.promises.writeFile
|
|
3187
3191
|
});
|
|
3188
3192
|
quansync$1({
|
|
3189
|
-
sync:
|
|
3190
|
-
async:
|
|
3193
|
+
sync: re.unlinkSync,
|
|
3194
|
+
async: re.promises.unlink
|
|
3191
3195
|
});
|
|
3192
3196
|
quansync$1({
|
|
3193
|
-
sync:
|
|
3194
|
-
async:
|
|
3197
|
+
sync: re.accessSync,
|
|
3198
|
+
async: re.promises.access
|
|
3195
3199
|
});
|
|
3196
3200
|
/**
|
|
3197
3201
|
* @link https://nodejs.org/api/fs.html#fspromisesstatpath-options
|
|
3198
3202
|
*/
|
|
3199
3203
|
const stat$1 = quansync$1({
|
|
3200
|
-
sync:
|
|
3201
|
-
async:
|
|
3204
|
+
sync: re.statSync,
|
|
3205
|
+
async: re.promises.stat
|
|
3202
3206
|
});
|
|
3203
3207
|
const lstat = quansync$1({
|
|
3204
|
-
sync:
|
|
3205
|
-
async:
|
|
3208
|
+
sync: re.lstatSync,
|
|
3209
|
+
async: re.promises.lstat
|
|
3206
3210
|
});
|
|
3207
3211
|
quansync$1({
|
|
3208
|
-
sync:
|
|
3209
|
-
async:
|
|
3212
|
+
sync: re.copyFileSync,
|
|
3213
|
+
async: re.promises.copyFile
|
|
3210
3214
|
});
|
|
3211
3215
|
quansync$1({
|
|
3212
|
-
sync:
|
|
3213
|
-
async:
|
|
3216
|
+
sync: re.rmSync,
|
|
3217
|
+
async: re.promises.rm
|
|
3214
3218
|
});
|
|
3215
3219
|
quansync$1({
|
|
3216
|
-
sync:
|
|
3217
|
-
async:
|
|
3220
|
+
sync: re.mkdirSync,
|
|
3221
|
+
async: re.promises.mkdir
|
|
3218
3222
|
});
|
|
3219
3223
|
quansync$1({
|
|
3220
|
-
sync:
|
|
3221
|
-
async:
|
|
3224
|
+
sync: re.renameSync,
|
|
3225
|
+
async: re.promises.rename
|
|
3222
3226
|
});
|
|
3223
3227
|
quansync$1({
|
|
3224
|
-
sync:
|
|
3225
|
-
async:
|
|
3228
|
+
sync: re.readdirSync,
|
|
3229
|
+
async: re.promises.readdir
|
|
3226
3230
|
});
|
|
3227
3231
|
quansync$1({
|
|
3228
|
-
sync:
|
|
3229
|
-
async:
|
|
3232
|
+
sync: re.realpathSync,
|
|
3233
|
+
async: re.promises.realpath
|
|
3230
3234
|
});
|
|
3231
3235
|
quansync$1({
|
|
3232
|
-
sync:
|
|
3233
|
-
async:
|
|
3236
|
+
sync: re.readlinkSync,
|
|
3237
|
+
async: re.promises.readlink
|
|
3234
3238
|
});
|
|
3235
3239
|
quansync$1({
|
|
3236
|
-
sync:
|
|
3237
|
-
async:
|
|
3240
|
+
sync: re.symlinkSync,
|
|
3241
|
+
async: re.promises.symlink
|
|
3238
3242
|
});
|
|
3239
3243
|
quansync$1({
|
|
3240
|
-
sync:
|
|
3241
|
-
async:
|
|
3244
|
+
sync: re.chownSync,
|
|
3245
|
+
async: re.promises.chown
|
|
3242
3246
|
});
|
|
3243
3247
|
quansync$1({
|
|
3244
|
-
sync:
|
|
3245
|
-
async:
|
|
3248
|
+
sync: re.lchownSync,
|
|
3249
|
+
async: re.promises.lchown
|
|
3246
3250
|
});
|
|
3247
3251
|
quansync$1({
|
|
3248
|
-
sync:
|
|
3249
|
-
async:
|
|
3252
|
+
sync: re.chmodSync,
|
|
3253
|
+
async: re.promises.chmod
|
|
3250
3254
|
});
|
|
3251
3255
|
quansync$1({
|
|
3252
|
-
sync:
|
|
3253
|
-
async:
|
|
3256
|
+
sync: re.utimesSync,
|
|
3257
|
+
async: re.promises.utimes
|
|
3254
3258
|
});
|
|
3255
3259
|
quansync$1({
|
|
3256
|
-
sync:
|
|
3257
|
-
async:
|
|
3260
|
+
sync: re.lutimesSync,
|
|
3261
|
+
async: re.promises.lutimes
|
|
3258
3262
|
});
|
|
3259
3263
|
quansync$1({
|
|
3260
|
-
sync:
|
|
3261
|
-
async:
|
|
3264
|
+
sync: re.mkdtempSync,
|
|
3265
|
+
async: re.promises.mkdtemp
|
|
3262
3266
|
});
|
|
3263
3267
|
//#endregion
|
|
3264
3268
|
//#region ../../node_modules/.pnpm/unconfig-core@7.5.0/node_modules/unconfig-core/dist/index.mjs
|
|
@@ -3337,7 +3341,7 @@ function createConfigCoreLoader(options) {
|
|
|
3337
3341
|
};
|
|
3338
3342
|
}
|
|
3339
3343
|
//#endregion
|
|
3340
|
-
//#region ../../node_modules/.pnpm/tsdown@0.21.
|
|
3344
|
+
//#region ../../node_modules/.pnpm/tsdown@0.21.7_@arethetypeswrong+core@0.18.2_@tsdown+css@0.21.7_@tsdown+exe@0.21.7_@type_f4ea40ca957034c1fa8bb4b9c4426b84/node_modules/tsdown/dist/options-j2tUAf6W.mjs
|
|
3341
3345
|
const __cjs_require$1 = createRequire(import.meta.url);
|
|
3342
3346
|
const picomatch = __cjs_require$1("./npm_entry_picomatch.cjs");
|
|
3343
3347
|
const satisfies$1 = __cjs_require$1("./npm_entry_semver_functions_satisfies.cjs");
|
|
@@ -3394,7 +3398,7 @@ async function resolveEntry(logger, entry, cwd, color, nameLabel, root) {
|
|
|
3394
3398
|
const [entryMap, computedRoot] = await toObjectEntry(entry, cwd, root);
|
|
3395
3399
|
const entries = Object.values(entryMap);
|
|
3396
3400
|
if (entries.length === 0) throw new Error(`${nameLabel ? `${nameLabel} ` : ""}Cannot find entry: ${JSON.stringify(entry)}`);
|
|
3397
|
-
logger.info(nameLabel, `entry: ${color(entries.map((entry) => path.relative(cwd, entry)).join(", "))}`);
|
|
3401
|
+
logger.info(nameLabel, `entry: ${color(entries.map((entry) => path.isAbsolute(entry) ? path.relative(cwd, entry) : entry).join(", "))}`);
|
|
3398
3402
|
return [entryMap, computedRoot];
|
|
3399
3403
|
}
|
|
3400
3404
|
function toObjectEntry(entry, cwd, root) {
|
|
@@ -3544,10 +3548,11 @@ async function buildSingleExe(config, bundledFile, outputFile, executable, targe
|
|
|
3544
3548
|
}
|
|
3545
3549
|
async function writeExports(options, chunks, inlinedDeps) {
|
|
3546
3550
|
const { pkg } = options;
|
|
3547
|
-
const { publishExports, ...generated } = await generateExports(pkg, chunks, options, inlinedDeps);
|
|
3551
|
+
const { publishExports, bin, ...generated } = await generateExports(pkg, chunks, options, inlinedDeps);
|
|
3548
3552
|
const updatedPkg = {
|
|
3549
3553
|
...pkg,
|
|
3550
3554
|
...generated,
|
|
3555
|
+
...bin === void 0 ? {} : { bin },
|
|
3551
3556
|
packageJsonPath: void 0
|
|
3552
3557
|
};
|
|
3553
3558
|
if (publishExports) {
|
|
@@ -3565,7 +3570,7 @@ function shouldExclude(fileName, exclude) {
|
|
|
3565
3570
|
return matchPattern(fileName, exclude);
|
|
3566
3571
|
}
|
|
3567
3572
|
async function generateExports(pkg, chunks, options, inlinedDeps) {
|
|
3568
|
-
let { exports: { devExports, all, packageJson = true, exclude, customExports, legacy, inlinedDependencies: emitInlinedDeps = true }, css, logger } = options;
|
|
3573
|
+
let { exports: { devExports, all, packageJson = true, exclude, customExports, legacy, inlinedDependencies: emitInlinedDeps = true, bin }, css, logger, cwd } = options;
|
|
3569
3574
|
const pkgRoot = path.dirname(pkg.packageJsonPath);
|
|
3570
3575
|
let main, module, cjsTypes, esmTypes;
|
|
3571
3576
|
const exportsMap = /* @__PURE__ */ new Map();
|
|
@@ -3644,6 +3649,7 @@ async function generateExports(pkg, chunks, options, inlinedDeps) {
|
|
|
3644
3649
|
module: legacy ? module || pkg.module : void 0,
|
|
3645
3650
|
types: legacy ? cjsTypes || esmTypes || pkg.types : pkg.types,
|
|
3646
3651
|
exports,
|
|
3652
|
+
bin: generateBin(bin, pkg, chunks, pkgRoot, logger, cwd),
|
|
3647
3653
|
inlinedDependencies: emitInlinedDeps ? inlinedDeps : void 0,
|
|
3648
3654
|
publishExports
|
|
3649
3655
|
};
|
|
@@ -3685,6 +3691,60 @@ function hasExportsTypes(pkg) {
|
|
|
3685
3691
|
}
|
|
3686
3692
|
return false;
|
|
3687
3693
|
}
|
|
3694
|
+
const RE_SHEBANG$1 = /^#!.*/;
|
|
3695
|
+
function generateBin(bin, pkg, chunks, pkgRoot, logger, cwd) {
|
|
3696
|
+
if (!bin) return;
|
|
3697
|
+
if (bin === true || typeof bin === "string") {
|
|
3698
|
+
if (!pkg.name) throw new Error("Package name is required when using string form for `bin`");
|
|
3699
|
+
const binName = pkg.name[0] === "@" ? pkg.name.split("/", 2)[1] : pkg.name;
|
|
3700
|
+
if (bin === true) {
|
|
3701
|
+
let detected;
|
|
3702
|
+
const seen = /* @__PURE__ */ new Set();
|
|
3703
|
+
for (const format of ["es", "cjs"]) {
|
|
3704
|
+
const formatChunks = chunks[format];
|
|
3705
|
+
if (!formatChunks) continue;
|
|
3706
|
+
for (const chunk of formatChunks) {
|
|
3707
|
+
if (chunk.type !== "chunk" || !chunk.isEntry || !chunk.facadeModuleId) continue;
|
|
3708
|
+
if (!RE_SHEBANG$1.test(chunk.code)) continue;
|
|
3709
|
+
if (seen.has(chunk.facadeModuleId)) continue;
|
|
3710
|
+
seen.add(chunk.facadeModuleId);
|
|
3711
|
+
if (detected) throw new Error("Multiple entry chunks with shebangs found. Use `exports.bin: { name: \"./src/file.ts\" }` to specify which one to use.");
|
|
3712
|
+
detected = join$1(pkgRoot, chunk.outDir, slash(chunk.fileName));
|
|
3713
|
+
}
|
|
3714
|
+
}
|
|
3715
|
+
if (detected == null) {
|
|
3716
|
+
logger.warn("`exports.bin` is true but no entry chunks with shebangs were found");
|
|
3717
|
+
return;
|
|
3718
|
+
}
|
|
3719
|
+
return { [binName]: detected };
|
|
3720
|
+
}
|
|
3721
|
+
if (typeof bin === "string") {
|
|
3722
|
+
const match = findChunkBySource(bin);
|
|
3723
|
+
if (!match) throw new Error(`Could not find output chunk for bin entry "${bin}"`);
|
|
3724
|
+
return { [binName]: match };
|
|
3725
|
+
}
|
|
3726
|
+
}
|
|
3727
|
+
const result = {};
|
|
3728
|
+
for (const [cmdName, sourcePath] of Object.entries(bin)) {
|
|
3729
|
+
const match = findChunkBySource(sourcePath);
|
|
3730
|
+
if (!match) throw new Error(`Could not find output chunk for bin entry "${cmdName}": "${sourcePath}"`);
|
|
3731
|
+
result[cmdName] = match;
|
|
3732
|
+
}
|
|
3733
|
+
return result;
|
|
3734
|
+
function findChunkBySource(sourcePath) {
|
|
3735
|
+
const resolved = path.resolve(cwd, sourcePath);
|
|
3736
|
+
for (const format of ["es", "cjs"]) {
|
|
3737
|
+
const formatChunks = chunks[format];
|
|
3738
|
+
if (!formatChunks) continue;
|
|
3739
|
+
for (const chunk of formatChunks) {
|
|
3740
|
+
if (chunk.type !== "chunk" || !chunk.isEntry) continue;
|
|
3741
|
+
if (chunk.facadeModuleId !== resolved) continue;
|
|
3742
|
+
if (!RE_SHEBANG$1.test(chunk.code)) logger.warn(`Bin entry "${sourcePath}" does not contain a shebang line`);
|
|
3743
|
+
return join$1(pkgRoot, chunk.outDir, slash(chunk.fileName));
|
|
3744
|
+
}
|
|
3745
|
+
}
|
|
3746
|
+
}
|
|
3747
|
+
}
|
|
3688
3748
|
function getExportName(chunk) {
|
|
3689
3749
|
const normalizedName = slash(chunk.fileName);
|
|
3690
3750
|
let name = stripExtname(normalizedName);
|
|
@@ -3803,7 +3863,7 @@ async function loadViteConfig(prefix, cwd, configLoader) {
|
|
|
3803
3863
|
return resolved;
|
|
3804
3864
|
}
|
|
3805
3865
|
const configPrefix = "tsdown.config";
|
|
3806
|
-
async function loadConfigFile(inlineConfig, workspace) {
|
|
3866
|
+
async function loadConfigFile(inlineConfig, workspace, rootConfig) {
|
|
3807
3867
|
let cwd = inlineConfig.cwd || process$1.cwd();
|
|
3808
3868
|
let overrideConfig = false;
|
|
3809
3869
|
let { config: filePath } = inlineConfig;
|
|
@@ -3852,7 +3912,10 @@ async function loadConfigFile(inlineConfig, workspace) {
|
|
|
3852
3912
|
({config: exported, source: file} = result);
|
|
3853
3913
|
globalLogger.info(`config file: ${underline(file)}`, loader === "native" ? "" : `(${loader})`);
|
|
3854
3914
|
exported = await exported;
|
|
3855
|
-
if (typeof exported === "function") exported = await exported(inlineConfig, {
|
|
3915
|
+
if (typeof exported === "function") exported = await exported(inlineConfig, {
|
|
3916
|
+
ci: isInCi,
|
|
3917
|
+
rootConfig
|
|
3918
|
+
});
|
|
3856
3919
|
}
|
|
3857
3920
|
exported = toArray(exported);
|
|
3858
3921
|
if (exported.length === 0) exported.push({});
|
|
@@ -3901,7 +3964,7 @@ async function nativeImport(id) {
|
|
|
3901
3964
|
return mod.default || mod;
|
|
3902
3965
|
}
|
|
3903
3966
|
async function unrunImport(id) {
|
|
3904
|
-
const { unrun } = await import("./dist-
|
|
3967
|
+
const { unrun } = await import("./dist-Cqme3mtE.js");
|
|
3905
3968
|
const { module } = await unrun({ path: pathToFileURL(id).href });
|
|
3906
3969
|
return module;
|
|
3907
3970
|
}
|
|
@@ -4069,8 +4132,8 @@ const defu = createDefu((obj, key, value) => {
|
|
|
4069
4132
|
return true;
|
|
4070
4133
|
}
|
|
4071
4134
|
});
|
|
4072
|
-
function mergeConfig(defaults, overrides) {
|
|
4073
|
-
return defu(overrides, defaults);
|
|
4135
|
+
function mergeConfig(defaults, ...overrides) {
|
|
4136
|
+
return defu(...overrides.toReversed(), defaults);
|
|
4074
4137
|
}
|
|
4075
4138
|
async function mergeUserOptions(defaults, user, args) {
|
|
4076
4139
|
const userOutputOptions = typeof user === "function" ? await user(defaults, ...args) : user;
|
|
@@ -4094,7 +4157,7 @@ function filterConfig(filter, configCwd, name) {
|
|
|
4094
4157
|
return toArray(filter).some((value) => name && name === value || cwd === value);
|
|
4095
4158
|
}
|
|
4096
4159
|
//#endregion
|
|
4097
|
-
//#region ../../node_modules/.pnpm/tsdown@0.21.
|
|
4160
|
+
//#region ../../node_modules/.pnpm/tsdown@0.21.7_@arethetypeswrong+core@0.18.2_@tsdown+css@0.21.7_@tsdown+exe@0.21.7_@type_f4ea40ca957034c1fa8bb4b9c4426b84/node_modules/tsdown/dist/watch-ZJbRq-K8.mjs
|
|
4098
4161
|
async function copy(options) {
|
|
4099
4162
|
if (!options.copy) return;
|
|
4100
4163
|
const resolved = await resolveCopyEntries(options);
|
|
@@ -4474,11 +4537,21 @@ var Hookable = class {
|
|
|
4474
4537
|
}
|
|
4475
4538
|
};
|
|
4476
4539
|
//#endregion
|
|
4477
|
-
//#region ../../node_modules/.pnpm/tsdown@0.21.
|
|
4540
|
+
//#region ../../node_modules/.pnpm/tsdown@0.21.7_@arethetypeswrong+core@0.18.2_@tsdown+css@0.21.7_@tsdown+exe@0.21.7_@type_f4ea40ca957034c1fa8bb4b9c4426b84/node_modules/tsdown/dist/build-DU-BFLB1.mjs
|
|
4478
4541
|
const __cjs_require = createRequire(import.meta.url);
|
|
4479
4542
|
const satisfies = __cjs_require("./npm_entry_semver_functions_satisfies.cjs");
|
|
4480
4543
|
const coerce = __cjs_require("./npm_entry_semver_functions_coerce.cjs");
|
|
4481
4544
|
const treeKill = __cjs_require("./npm_entry_tree-kill.cjs");
|
|
4545
|
+
var __defProp = Object.defineProperty;
|
|
4546
|
+
var __exportAll = (all, no_symbols) => {
|
|
4547
|
+
let target = {};
|
|
4548
|
+
for (var name in all) __defProp(target, name, {
|
|
4549
|
+
get: all[name],
|
|
4550
|
+
enumerable: true
|
|
4551
|
+
});
|
|
4552
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
4553
|
+
return target;
|
|
4554
|
+
};
|
|
4482
4555
|
const debug$4 = createDebug("tsdown:config:workspace");
|
|
4483
4556
|
const DEFAULT_EXCLUDE_WORKSPACE = [
|
|
4484
4557
|
"**/node_modules/**",
|
|
@@ -4487,10 +4560,7 @@ const DEFAULT_EXCLUDE_WORKSPACE = [
|
|
|
4487
4560
|
"**/t?(e)mp/**"
|
|
4488
4561
|
];
|
|
4489
4562
|
async function resolveWorkspace(config, inlineConfig) {
|
|
4490
|
-
const normalized =
|
|
4491
|
-
...config,
|
|
4492
|
-
...inlineConfig
|
|
4493
|
-
};
|
|
4563
|
+
const normalized = mergeConfig(config, inlineConfig);
|
|
4494
4564
|
const rootCwd = normalized.cwd || process$1.cwd();
|
|
4495
4565
|
let { workspace } = normalized;
|
|
4496
4566
|
if (!workspace) return {
|
|
@@ -4521,15 +4591,12 @@ async function resolveWorkspace(config, inlineConfig) {
|
|
|
4521
4591
|
...inlineConfig,
|
|
4522
4592
|
config: workspaceConfig,
|
|
4523
4593
|
cwd
|
|
4524
|
-
}, cwd);
|
|
4594
|
+
}, cwd, normalized);
|
|
4525
4595
|
if (file) {
|
|
4526
4596
|
debug$4("loaded workspace config file %s", file);
|
|
4527
4597
|
files.push(file);
|
|
4528
4598
|
} else debug$4("no workspace config file found in %s", cwd);
|
|
4529
|
-
return configs.map((config) => (
|
|
4530
|
-
...normalized,
|
|
4531
|
-
...config
|
|
4532
|
-
}));
|
|
4599
|
+
return configs.map((config) => mergeConfig(normalized, config));
|
|
4533
4600
|
}))).flat(),
|
|
4534
4601
|
files
|
|
4535
4602
|
};
|
|
@@ -4641,7 +4708,7 @@ async function attw(options, tarball) {
|
|
|
4641
4708
|
if (invalidRules.length) options.logger.warn(`attw config option 'ignoreRules' contains invalid value '${invalidRules.join(", ")}'.`);
|
|
4642
4709
|
const t = performance.now();
|
|
4643
4710
|
debug$2("Running attw check");
|
|
4644
|
-
const attwCore = await importWithError("@arethetypeswrong/core"
|
|
4711
|
+
const attwCore = options.attw.module || await importWithError("@arethetypeswrong/core");
|
|
4645
4712
|
const pkg = attwCore.createPackageFromTarballData(tarball);
|
|
4646
4713
|
const checkResult = await attwCore.checkPackage(pkg, attwOptions);
|
|
4647
4714
|
let errorMessage;
|
|
@@ -4691,8 +4758,8 @@ async function publint(options, tarball) {
|
|
|
4691
4758
|
}
|
|
4692
4759
|
const t = performance.now();
|
|
4693
4760
|
debug$1("Running publint");
|
|
4694
|
-
const { publint } = await importWithError("publint"
|
|
4695
|
-
const { formatMessage } = await importWithError("publint/utils"
|
|
4761
|
+
const { publint } = options.publint.module?.[0] || await importWithError("publint");
|
|
4762
|
+
const { formatMessage } = options.publint.module?.[1] || await importWithError("publint/utils");
|
|
4696
4763
|
const { messages } = await publint({
|
|
4697
4764
|
...options.publint,
|
|
4698
4765
|
pack: { tarball: tarball.buffer }
|
|
@@ -4767,7 +4834,7 @@ async function bundleDone(bundleByPkg, bundle) {
|
|
|
4767
4834
|
async function packTarball(packageJsonPath) {
|
|
4768
4835
|
const pkgDir = path.dirname(packageJsonPath);
|
|
4769
4836
|
const destination = await mkdtemp(path.join(tmpdir(), "tsdown-pack-"));
|
|
4770
|
-
const { detect } = await import("./detect-
|
|
4837
|
+
const { detect } = await import("./detect-h8ZFBH96-C_8f1Pj6.js");
|
|
4771
4838
|
try {
|
|
4772
4839
|
const detected = await detect({ cwd: pkgDir });
|
|
4773
4840
|
if (detected?.name === "deno") throw new Error(`Cannot pack tarball for Deno projects at ${pkgDir}`);
|
|
@@ -4903,10 +4970,11 @@ async function resolveInputOptions(config, format, configFiles, bundle, cjsDts,
|
|
|
4903
4970
|
if (nodeProtocol) plugins.push(NodeProtocolPlugin(nodeProtocol));
|
|
4904
4971
|
if (config.pkg || config.deps.skipNodeModulesBundle) plugins.push(DepsPlugin(config, bundle));
|
|
4905
4972
|
if (dts) {
|
|
4906
|
-
const { dts: dtsPlugin } = await import("./dist-
|
|
4973
|
+
const { dts: dtsPlugin } = await import("./dist-B98oBzil.js");
|
|
4974
|
+
const { cjsReexport: _, ...dtsPluginOptions } = dts;
|
|
4907
4975
|
const options = {
|
|
4908
4976
|
tsconfig,
|
|
4909
|
-
...
|
|
4977
|
+
...dtsPluginOptions
|
|
4910
4978
|
};
|
|
4911
4979
|
if (format === "es") plugins.push(dtsPlugin(options));
|
|
4912
4980
|
else if (cjsDts) plugins.push(dtsPlugin({
|
|
@@ -4914,7 +4982,9 @@ async function resolveInputOptions(config, format, configFiles, bundle, cjsDts,
|
|
|
4914
4982
|
emitDtsOnly: true,
|
|
4915
4983
|
cjsDefault
|
|
4916
4984
|
}));
|
|
4985
|
+
else if (dts.cjsReexport && isDualFormat) plugins.push(CjsDtsReexportPlugin());
|
|
4917
4986
|
}
|
|
4987
|
+
let cssPostPlugins;
|
|
4918
4988
|
if (!cjsDts) {
|
|
4919
4989
|
if (unused) {
|
|
4920
4990
|
const { Unused } = await importWithError("unplugin-unused");
|
|
@@ -4925,7 +4995,9 @@ async function resolveInputOptions(config, format, configFiles, bundle, cjsDts,
|
|
|
4925
4995
|
}
|
|
4926
4996
|
if (pkgExists("@tsdown/css")) {
|
|
4927
4997
|
const { CssPlugin } = await import("@tsdown/css");
|
|
4928
|
-
|
|
4998
|
+
const cssPlugins = CssPlugin(config, { logger });
|
|
4999
|
+
plugins.push(...cssPlugins.pre);
|
|
5000
|
+
cssPostPlugins = cssPlugins.post;
|
|
4929
5001
|
} else plugins.push(CssGuardPlugin());
|
|
4930
5002
|
plugins.push(ShebangPlugin(logger, cwd, nameLabel, isDualFormat));
|
|
4931
5003
|
if (globImport) plugins.push(importGlobPlugin({ root: cwd }));
|
|
@@ -4933,6 +5005,7 @@ async function resolveInputOptions(config, format, configFiles, bundle, cjsDts,
|
|
|
4933
5005
|
if (report && LogLevels[logger.level] >= 3) plugins.push(ReportPlugin(config, cjsDts, isDualFormat));
|
|
4934
5006
|
if (watch) plugins.push(WatchPlugin(configFiles, bundle));
|
|
4935
5007
|
if (!cjsDts) plugins.push(userPlugins);
|
|
5008
|
+
if (cssPostPlugins) plugins.push(...cssPostPlugins);
|
|
4936
5009
|
const define = {
|
|
4937
5010
|
...config.define,
|
|
4938
5011
|
...Object.keys(env).reduce((acc, key) => {
|
|
@@ -5022,6 +5095,23 @@ function handlePluginInspect(plugins) {
|
|
|
5022
5095
|
else return `"rolldown plugin: ${plugins.name}"`;
|
|
5023
5096
|
};
|
|
5024
5097
|
}
|
|
5098
|
+
function CjsDtsReexportPlugin() {
|
|
5099
|
+
return {
|
|
5100
|
+
name: "tsdown:cjs-dts-reexport",
|
|
5101
|
+
generateBundle(_options, bundle) {
|
|
5102
|
+
for (const chunk of Object.values(bundle)) {
|
|
5103
|
+
if (chunk.type !== "chunk") continue;
|
|
5104
|
+
if (!chunk.fileName.endsWith(".cjs") && !chunk.fileName.endsWith(".js")) continue;
|
|
5105
|
+
const content = `export * from './${path.basename(chunk.fileName.replace(RE_JS, ".d.mts"))}'\n`;
|
|
5106
|
+
this.emitFile({
|
|
5107
|
+
type: "prebuilt-chunk",
|
|
5108
|
+
fileName: filename_js_to_dts(chunk.fileName),
|
|
5109
|
+
code: content
|
|
5110
|
+
});
|
|
5111
|
+
}
|
|
5112
|
+
}
|
|
5113
|
+
};
|
|
5114
|
+
}
|
|
5025
5115
|
function CssGuardPlugin() {
|
|
5026
5116
|
return {
|
|
5027
5117
|
name: "tsdown:css-guard",
|
|
@@ -5083,6 +5173,10 @@ function shortcuts(restart) {
|
|
|
5083
5173
|
rl.on("line", onInput);
|
|
5084
5174
|
return () => rl.close();
|
|
5085
5175
|
}
|
|
5176
|
+
var build_exports = /* @__PURE__ */ __exportAll({
|
|
5177
|
+
build: () => build$1,
|
|
5178
|
+
buildWithConfigs: () => buildWithConfigs
|
|
5179
|
+
});
|
|
5086
5180
|
const asyncDispose = Symbol.asyncDispose || Symbol.for("Symbol.asyncDispose");
|
|
5087
5181
|
/**
|
|
5088
5182
|
* Build with tsdown.
|
|
@@ -5229,7 +5323,7 @@ async function buildSingle(config, configFiles, isDualFormat, clean, restart, do
|
|
|
5229
5323
|
});
|
|
5230
5324
|
if (debugRolldownConfigDir) await debugBuildOptions(debugRolldownConfigDir, config.name, format, buildOptions);
|
|
5231
5325
|
const configs = [buildOptions];
|
|
5232
|
-
if (format === "cjs" && dts) configs.push(await getBuildOptions(config, format, configFiles, bundle, true, isDualFormat));
|
|
5326
|
+
if (format === "cjs" && dts && (!isDualFormat || !dts.cjsReexport)) configs.push(await getBuildOptions(config, format, configFiles, bundle, true, isDualFormat));
|
|
5233
5327
|
return configs;
|
|
5234
5328
|
}
|
|
5235
5329
|
async function postBuild() {
|
|
@@ -5246,4 +5340,4 @@ async function buildSingle(config, configFiles, isDualFormat, clean, restart, do
|
|
|
5246
5340
|
}
|
|
5247
5341
|
}
|
|
5248
5342
|
//#endregion
|
|
5249
|
-
export { resolveUserConfig as i, buildWithConfigs as n,
|
|
5343
|
+
export { resolveUserConfig as a, mergeConfig as i, buildWithConfigs as n, build_exports as r, build$1 as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { D as toArray, w as resolveComma } from "./main-CYOGr7IM.js";
|
|
2
2
|
import { n as enable, r as namespaces, t as createDebug } from "./node-B3Gdtau1.js";
|
|
3
|
-
//#region ../../node_modules/.pnpm/tsdown@0.21.
|
|
3
|
+
//#region ../../node_modules/.pnpm/tsdown@0.21.7_@arethetypeswrong+core@0.18.2_@tsdown+css@0.21.7_@tsdown+exe@0.21.7_@type_f4ea40ca957034c1fa8bb4b9c4426b84/node_modules/tsdown/dist/debug-BmAPbhgA.mjs
|
|
4
4
|
const debugLog = createDebug("tsdown:debug");
|
|
5
5
|
function enableDebug(debug) {
|
|
6
6
|
if (!debug) return;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import process from "node:process";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import fs from "node:fs/promises";
|
|
4
|
-
//#region ../../node_modules/.pnpm/tsdown@0.21.
|
|
4
|
+
//#region ../../node_modules/.pnpm/tsdown@0.21.7_@arethetypeswrong+core@0.18.2_@tsdown+css@0.21.7_@tsdown+exe@0.21.7_@type_f4ea40ca957034c1fa8bb4b9c4426b84/node_modules/tsdown/dist/detect-h8ZFBH96.mjs
|
|
5
5
|
const AGENTS = [
|
|
6
6
|
"npm",
|
|
7
7
|
"yarn",
|