@voidzero-dev/vite-plus-core 0.0.0-0bfcc90f.20260209-0731
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/LICENSE +41 -0
- package/dist/pluginutils/filter/composable-filters.d.ts +90 -0
- package/dist/pluginutils/filter/composable-filters.js +256 -0
- package/dist/pluginutils/filter/filter-vite-plugins.d.ts +28 -0
- package/dist/pluginutils/filter/filter-vite-plugins.js +75 -0
- package/dist/pluginutils/filter/index.d.ts +3 -0
- package/dist/pluginutils/filter/index.js +3 -0
- package/dist/pluginutils/filter/simple-filters.d.ts +71 -0
- package/dist/pluginutils/filter/simple-filters.js +70 -0
- package/dist/pluginutils/index.d.ts +1 -0
- package/dist/pluginutils/index.js +1 -0
- package/dist/pluginutils/utils.d.ts +2 -0
- package/dist/pluginutils/utils.js +17 -0
- package/dist/rolldown/cli-setup.d.mts +1 -0
- package/dist/rolldown/cli-setup.mjs +17 -0
- package/dist/rolldown/cli.d.mts +1 -0
- package/dist/rolldown/cli.mjs +608 -0
- package/dist/rolldown/config.d.mts +7 -0
- package/dist/rolldown/config.mjs +10 -0
- package/dist/rolldown/experimental-index.d.mts +194 -0
- package/dist/rolldown/experimental-index.mjs +291 -0
- package/dist/rolldown/experimental-runtime-types.d.ts +98 -0
- package/dist/rolldown/filter-index.d.mts +197 -0
- package/dist/rolldown/filter-index.mjs +369 -0
- package/dist/rolldown/get-log-filter.d.mts +7 -0
- package/dist/rolldown/get-log-filter.mjs +47 -0
- package/dist/rolldown/index.d.mts +4 -0
- package/dist/rolldown/index.mjs +57 -0
- package/dist/rolldown/parallel-plugin-worker.d.mts +1 -0
- package/dist/rolldown/parallel-plugin-worker.mjs +32 -0
- package/dist/rolldown/parallel-plugin.d.mts +14 -0
- package/dist/rolldown/parallel-plugin.mjs +7 -0
- package/dist/rolldown/parse-ast-index.d.mts +8 -0
- package/dist/rolldown/parse-ast-index.mjs +47 -0
- package/dist/rolldown/plugins-index.d.mts +30 -0
- package/dist/rolldown/plugins-index.mjs +40 -0
- package/dist/rolldown/shared/binding-D-XMzSaG.d.mts +1665 -0
- package/dist/rolldown/shared/binding-DuOSzYPt.mjs +587 -0
- package/dist/rolldown/shared/bindingify-input-options-Bu6nUTgS.mjs +2257 -0
- package/dist/rolldown/shared/constructors-DZVRHTli.mjs +61 -0
- package/dist/rolldown/shared/constructors-KD7LvxpN.d.mts +28 -0
- package/dist/rolldown/shared/define-config-BVG4QvnP.mjs +7 -0
- package/dist/rolldown/shared/define-config-U4pj0ZDn.d.mts +3616 -0
- package/dist/rolldown/shared/load-config-O1K_tT_z.mjs +114 -0
- package/dist/rolldown/shared/logging-CE90D8JR.d.mts +50 -0
- package/dist/rolldown/shared/logs-NH298mHo.mjs +183 -0
- package/dist/rolldown/shared/misc-CCZIsXVO.mjs +22 -0
- package/dist/rolldown/shared/normalize-string-or-regex-DeZqg15i.mjs +61 -0
- package/dist/rolldown/shared/parse-DLraxqjd.mjs +56 -0
- package/dist/rolldown/shared/prompt-DeISmFRp.mjs +847 -0
- package/dist/rolldown/shared/rolldown-O0UKbTKf.mjs +42 -0
- package/dist/rolldown/shared/rolldown-build-BIs7C4B_.mjs +3354 -0
- package/dist/rolldown/shared/watch-DQXGaDjx.mjs +379 -0
- package/dist/tsdown/build-l5WhXg4M-BBPqZr0m.js +4933 -0
- package/dist/tsdown/chunk-CdeBBKNj.js +44 -0
- package/dist/tsdown/debug-Cb_Nqpo4-BueIRvg1.js +18 -0
- package/dist/tsdown/detect-CCATtVj7-B86m8IqW.js +165 -0
- package/dist/tsdown/dist-BUOkzr_P.js +201 -0
- package/dist/tsdown/dist-BVMGwPdF.js +32363 -0
- package/dist/tsdown/dist-dc0X0G6b.js +742 -0
- package/dist/tsdown/filename-7rlgePeo.js +31 -0
- package/dist/tsdown/index-node-BjDys8jy--sqPE5mM.js +251 -0
- package/dist/tsdown/index-types.d.ts +2163 -0
- package/dist/tsdown/index.js +14 -0
- package/dist/tsdown/main-d9yZSQqW.js +926 -0
- package/dist/tsdown/node-Cb5OsnKg.js +271 -0
- package/dist/tsdown/npm_cjs_chunk_chunk.cjs +11 -0
- package/dist/tsdown/npm_cjs_chunk_range.cjs +484 -0
- package/dist/tsdown/npm_cjs_chunk_semver.cjs +362 -0
- package/dist/tsdown/npm_entry_picomatch.cjs +1676 -0
- package/dist/tsdown/npm_entry_semver_functions_coerce.cjs +52 -0
- package/dist/tsdown/npm_entry_semver_functions_satisfies.cjs +23 -0
- package/dist/tsdown/npm_entry_semver_ranges_min-version.cjs +48 -0
- package/dist/tsdown/npm_entry_tree-kill.cjs +103 -0
- package/dist/tsdown/resolver-j7HY1N36-CIu_7LX6.js +20 -0
- package/dist/tsdown/run.js +537 -0
- package/dist/tsdown/tsc-context-BNYuT3cE.js +25 -0
- package/dist/tsdown/tsc-reo6aLWc.js +423 -0
- package/dist/vite/client/client.mjs +1140 -0
- package/dist/vite/client/env.mjs +19 -0
- package/dist/vite/client.d.ts +279 -0
- package/dist/vite/misc/false.d.ts +2 -0
- package/dist/vite/misc/false.js +1 -0
- package/dist/vite/misc/true.d.ts +2 -0
- package/dist/vite/misc/true.js +1 -0
- package/dist/vite/node/chunks/build2.js +5538 -0
- package/dist/vite/node/chunks/chunk.js +45 -0
- package/dist/vite/node/chunks/dist.js +6758 -0
- package/dist/vite/node/chunks/dist2.js +6651 -0
- package/dist/vite/node/chunks/fetchableEnvironments.js +41395 -0
- package/dist/vite/node/chunks/lib.js +377 -0
- package/dist/vite/node/chunks/logger.js +332 -0
- package/dist/vite/node/chunks/moduleRunnerTransport.d.ts +96 -0
- package/dist/vite/node/chunks/postcss-import.js +479 -0
- package/dist/vite/node/cli.js +699 -0
- package/dist/vite/node/index.d.ts +3807 -0
- package/dist/vite/node/index.js +15 -0
- package/dist/vite/node/internal.d.ts +2 -0
- package/dist/vite/node/internal.js +3 -0
- package/dist/vite/node/module-runner.d.ts +311 -0
- package/dist/vite/node/module-runner.js +1159 -0
- package/dist/vite/types/customEvent.d.ts +52 -0
- package/dist/vite/types/hmrPayload.d.ts +80 -0
- package/dist/vite/types/hot.d.ts +39 -0
- package/dist/vite/types/import-meta.d.ts +5 -0
- package/dist/vite/types/importGlob.d.ts +89 -0
- package/dist/vite/types/importMeta.d.ts +30 -0
- package/dist/vite/types/internal/cssPreprocessorOptions.d.ts +44 -0
- package/dist/vite/types/internal/esbuildOptions.d.ts +28 -0
- package/dist/vite/types/internal/lightningcssOptions.d.ts +18 -0
- package/dist/vite/types/internal/rollupTypeCompat.d.ts +24 -0
- package/dist/vite/types/internal/terserOptions.d.ts +11 -0
- package/dist/vite/types/metadata.d.ts +47 -0
- package/package.json +204 -0
|
@@ -0,0 +1,537 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { S as dim, l as globalLogger, r as version, t as K } from "./main-d9yZSQqW.js";
|
|
3
|
+
import "./node-Cb5OsnKg.js";
|
|
4
|
+
import { t as enableDebug } from "./debug-Cb_Nqpo4-BueIRvg1.js";
|
|
5
|
+
import module from "node:module";
|
|
6
|
+
import process$1 from "node:process";
|
|
7
|
+
import { VERSION } from "@voidzero-dev/vite-plus-core/rolldown";
|
|
8
|
+
import { EventEmitter } from "events";
|
|
9
|
+
|
|
10
|
+
//#region ../../node_modules/.pnpm/cac@6.7.14/node_modules/cac/dist/index.mjs
|
|
11
|
+
function toArr(any) {
|
|
12
|
+
return any == null ? [] : Array.isArray(any) ? any : [any];
|
|
13
|
+
}
|
|
14
|
+
function toVal(out, key, val, opts) {
|
|
15
|
+
var x, old = out[key], nxt = !!~opts.string.indexOf(key) ? val == null || val === true ? "" : String(val) : typeof val === "boolean" ? val : !!~opts.boolean.indexOf(key) ? val === "false" ? false : val === "true" || (out._.push((x = +val, x * 0 === 0) ? x : val), !!val) : (x = +val, x * 0 === 0) ? x : val;
|
|
16
|
+
out[key] = old == null ? nxt : Array.isArray(old) ? old.concat(nxt) : [old, nxt];
|
|
17
|
+
}
|
|
18
|
+
function mri2(args, opts) {
|
|
19
|
+
args = args || [];
|
|
20
|
+
opts = opts || {};
|
|
21
|
+
var k, arr, arg, name, val, out = { _: [] };
|
|
22
|
+
var i = 0, j = 0, idx = 0, len = args.length;
|
|
23
|
+
const alibi = opts.alias !== void 0;
|
|
24
|
+
const strict = opts.unknown !== void 0;
|
|
25
|
+
const defaults = opts.default !== void 0;
|
|
26
|
+
opts.alias = opts.alias || {};
|
|
27
|
+
opts.string = toArr(opts.string);
|
|
28
|
+
opts.boolean = toArr(opts.boolean);
|
|
29
|
+
if (alibi) for (k in opts.alias) {
|
|
30
|
+
arr = opts.alias[k] = toArr(opts.alias[k]);
|
|
31
|
+
for (i = 0; i < arr.length; i++) (opts.alias[arr[i]] = arr.concat(k)).splice(i, 1);
|
|
32
|
+
}
|
|
33
|
+
for (i = opts.boolean.length; i-- > 0;) {
|
|
34
|
+
arr = opts.alias[opts.boolean[i]] || [];
|
|
35
|
+
for (j = arr.length; j-- > 0;) opts.boolean.push(arr[j]);
|
|
36
|
+
}
|
|
37
|
+
for (i = opts.string.length; i-- > 0;) {
|
|
38
|
+
arr = opts.alias[opts.string[i]] || [];
|
|
39
|
+
for (j = arr.length; j-- > 0;) opts.string.push(arr[j]);
|
|
40
|
+
}
|
|
41
|
+
if (defaults) for (k in opts.default) {
|
|
42
|
+
name = typeof opts.default[k];
|
|
43
|
+
arr = opts.alias[k] = opts.alias[k] || [];
|
|
44
|
+
if (opts[name] !== void 0) {
|
|
45
|
+
opts[name].push(k);
|
|
46
|
+
for (i = 0; i < arr.length; i++) opts[name].push(arr[i]);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
const keys = strict ? Object.keys(opts.alias) : [];
|
|
50
|
+
for (i = 0; i < len; i++) {
|
|
51
|
+
arg = args[i];
|
|
52
|
+
if (arg === "--") {
|
|
53
|
+
out._ = out._.concat(args.slice(++i));
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
for (j = 0; j < arg.length; j++) if (arg.charCodeAt(j) !== 45) break;
|
|
57
|
+
if (j === 0) out._.push(arg);
|
|
58
|
+
else if (arg.substring(j, j + 3) === "no-") {
|
|
59
|
+
name = arg.substring(j + 3);
|
|
60
|
+
if (strict && !~keys.indexOf(name)) return opts.unknown(arg);
|
|
61
|
+
out[name] = false;
|
|
62
|
+
} else {
|
|
63
|
+
for (idx = j + 1; idx < arg.length; idx++) if (arg.charCodeAt(idx) === 61) break;
|
|
64
|
+
name = arg.substring(j, idx);
|
|
65
|
+
val = arg.substring(++idx) || i + 1 === len || ("" + args[i + 1]).charCodeAt(0) === 45 || args[++i];
|
|
66
|
+
arr = j === 2 ? [name] : name;
|
|
67
|
+
for (idx = 0; idx < arr.length; idx++) {
|
|
68
|
+
name = arr[idx];
|
|
69
|
+
if (strict && !~keys.indexOf(name)) return opts.unknown("-".repeat(j) + name);
|
|
70
|
+
toVal(out, name, idx + 1 < arr.length || val, opts);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
if (defaults) {
|
|
75
|
+
for (k in opts.default) if (out[k] === void 0) out[k] = opts.default[k];
|
|
76
|
+
}
|
|
77
|
+
if (alibi) for (k in out) {
|
|
78
|
+
arr = opts.alias[k] || [];
|
|
79
|
+
while (arr.length > 0) out[arr.shift()] = out[k];
|
|
80
|
+
}
|
|
81
|
+
return out;
|
|
82
|
+
}
|
|
83
|
+
const removeBrackets = (v) => v.replace(/[<[].+/, "").trim();
|
|
84
|
+
const findAllBrackets = (v) => {
|
|
85
|
+
const ANGLED_BRACKET_RE_GLOBAL = /<([^>]+)>/g;
|
|
86
|
+
const SQUARE_BRACKET_RE_GLOBAL = /\[([^\]]+)\]/g;
|
|
87
|
+
const res = [];
|
|
88
|
+
const parse = (match) => {
|
|
89
|
+
let variadic = false;
|
|
90
|
+
let value = match[1];
|
|
91
|
+
if (value.startsWith("...")) {
|
|
92
|
+
value = value.slice(3);
|
|
93
|
+
variadic = true;
|
|
94
|
+
}
|
|
95
|
+
return {
|
|
96
|
+
required: match[0].startsWith("<"),
|
|
97
|
+
value,
|
|
98
|
+
variadic
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
let angledMatch;
|
|
102
|
+
while (angledMatch = ANGLED_BRACKET_RE_GLOBAL.exec(v)) res.push(parse(angledMatch));
|
|
103
|
+
let squareMatch;
|
|
104
|
+
while (squareMatch = SQUARE_BRACKET_RE_GLOBAL.exec(v)) res.push(parse(squareMatch));
|
|
105
|
+
return res;
|
|
106
|
+
};
|
|
107
|
+
const getMriOptions = (options) => {
|
|
108
|
+
const result = {
|
|
109
|
+
alias: {},
|
|
110
|
+
boolean: []
|
|
111
|
+
};
|
|
112
|
+
for (const [index, option] of options.entries()) {
|
|
113
|
+
if (option.names.length > 1) result.alias[option.names[0]] = option.names.slice(1);
|
|
114
|
+
if (option.isBoolean) if (option.negated) {
|
|
115
|
+
if (!options.some((o, i) => {
|
|
116
|
+
return i !== index && o.names.some((name) => option.names.includes(name)) && typeof o.required === "boolean";
|
|
117
|
+
})) result.boolean.push(option.names[0]);
|
|
118
|
+
} else result.boolean.push(option.names[0]);
|
|
119
|
+
}
|
|
120
|
+
return result;
|
|
121
|
+
};
|
|
122
|
+
const findLongest = (arr) => {
|
|
123
|
+
return arr.sort((a, b) => {
|
|
124
|
+
return a.length > b.length ? -1 : 1;
|
|
125
|
+
})[0];
|
|
126
|
+
};
|
|
127
|
+
const padRight = (str, length) => {
|
|
128
|
+
return str.length >= length ? str : `${str}${" ".repeat(length - str.length)}`;
|
|
129
|
+
};
|
|
130
|
+
const camelcase = (input) => {
|
|
131
|
+
return input.replace(/([a-z])-([a-z])/g, (_, p1, p2) => {
|
|
132
|
+
return p1 + p2.toUpperCase();
|
|
133
|
+
});
|
|
134
|
+
};
|
|
135
|
+
const setDotProp = (obj, keys, val) => {
|
|
136
|
+
let i = 0;
|
|
137
|
+
let length = keys.length;
|
|
138
|
+
let t = obj;
|
|
139
|
+
let x;
|
|
140
|
+
for (; i < length; ++i) {
|
|
141
|
+
x = t[keys[i]];
|
|
142
|
+
t = t[keys[i]] = i === length - 1 ? val : x != null ? x : !!~keys[i + 1].indexOf(".") || !(+keys[i + 1] > -1) ? {} : [];
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
const setByType = (obj, transforms) => {
|
|
146
|
+
for (const key of Object.keys(transforms)) {
|
|
147
|
+
const transform = transforms[key];
|
|
148
|
+
if (transform.shouldTransform) {
|
|
149
|
+
obj[key] = Array.prototype.concat.call([], obj[key]);
|
|
150
|
+
if (typeof transform.transformFunction === "function") obj[key] = obj[key].map(transform.transformFunction);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
const getFileName = (input) => {
|
|
155
|
+
const m = /([^\\\/]+)$/.exec(input);
|
|
156
|
+
return m ? m[1] : "";
|
|
157
|
+
};
|
|
158
|
+
const camelcaseOptionName = (name) => {
|
|
159
|
+
return name.split(".").map((v, i) => {
|
|
160
|
+
return i === 0 ? camelcase(v) : v;
|
|
161
|
+
}).join(".");
|
|
162
|
+
};
|
|
163
|
+
var CACError = class extends Error {
|
|
164
|
+
constructor(message) {
|
|
165
|
+
super(message);
|
|
166
|
+
this.name = this.constructor.name;
|
|
167
|
+
if (typeof Error.captureStackTrace === "function") Error.captureStackTrace(this, this.constructor);
|
|
168
|
+
else this.stack = new Error(message).stack;
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
var Option = class {
|
|
172
|
+
constructor(rawName, description, config) {
|
|
173
|
+
this.rawName = rawName;
|
|
174
|
+
this.description = description;
|
|
175
|
+
this.config = Object.assign({}, config);
|
|
176
|
+
rawName = rawName.replace(/\.\*/g, "");
|
|
177
|
+
this.negated = false;
|
|
178
|
+
this.names = removeBrackets(rawName).split(",").map((v) => {
|
|
179
|
+
let name = v.trim().replace(/^-{1,2}/, "");
|
|
180
|
+
if (name.startsWith("no-")) {
|
|
181
|
+
this.negated = true;
|
|
182
|
+
name = name.replace(/^no-/, "");
|
|
183
|
+
}
|
|
184
|
+
return camelcaseOptionName(name);
|
|
185
|
+
}).sort((a, b) => a.length > b.length ? 1 : -1);
|
|
186
|
+
this.name = this.names[this.names.length - 1];
|
|
187
|
+
if (this.negated && this.config.default == null) this.config.default = true;
|
|
188
|
+
if (rawName.includes("<")) this.required = true;
|
|
189
|
+
else if (rawName.includes("[")) this.required = false;
|
|
190
|
+
else this.isBoolean = true;
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
const processArgs = process.argv;
|
|
194
|
+
const platformInfo = `${process.platform}-${process.arch} node-${process.version}`;
|
|
195
|
+
var Command = class {
|
|
196
|
+
constructor(rawName, description, config = {}, cli) {
|
|
197
|
+
this.rawName = rawName;
|
|
198
|
+
this.description = description;
|
|
199
|
+
this.config = config;
|
|
200
|
+
this.cli = cli;
|
|
201
|
+
this.options = [];
|
|
202
|
+
this.aliasNames = [];
|
|
203
|
+
this.name = removeBrackets(rawName);
|
|
204
|
+
this.args = findAllBrackets(rawName);
|
|
205
|
+
this.examples = [];
|
|
206
|
+
}
|
|
207
|
+
usage(text) {
|
|
208
|
+
this.usageText = text;
|
|
209
|
+
return this;
|
|
210
|
+
}
|
|
211
|
+
allowUnknownOptions() {
|
|
212
|
+
this.config.allowUnknownOptions = true;
|
|
213
|
+
return this;
|
|
214
|
+
}
|
|
215
|
+
ignoreOptionDefaultValue() {
|
|
216
|
+
this.config.ignoreOptionDefaultValue = true;
|
|
217
|
+
return this;
|
|
218
|
+
}
|
|
219
|
+
version(version, customFlags = "-v, --version") {
|
|
220
|
+
this.versionNumber = version;
|
|
221
|
+
this.option(customFlags, "Display version number");
|
|
222
|
+
return this;
|
|
223
|
+
}
|
|
224
|
+
example(example) {
|
|
225
|
+
this.examples.push(example);
|
|
226
|
+
return this;
|
|
227
|
+
}
|
|
228
|
+
option(rawName, description, config) {
|
|
229
|
+
const option = new Option(rawName, description, config);
|
|
230
|
+
this.options.push(option);
|
|
231
|
+
return this;
|
|
232
|
+
}
|
|
233
|
+
alias(name) {
|
|
234
|
+
this.aliasNames.push(name);
|
|
235
|
+
return this;
|
|
236
|
+
}
|
|
237
|
+
action(callback) {
|
|
238
|
+
this.commandAction = callback;
|
|
239
|
+
return this;
|
|
240
|
+
}
|
|
241
|
+
isMatched(name) {
|
|
242
|
+
return this.name === name || this.aliasNames.includes(name);
|
|
243
|
+
}
|
|
244
|
+
get isDefaultCommand() {
|
|
245
|
+
return this.name === "" || this.aliasNames.includes("!");
|
|
246
|
+
}
|
|
247
|
+
get isGlobalCommand() {
|
|
248
|
+
return this instanceof GlobalCommand;
|
|
249
|
+
}
|
|
250
|
+
hasOption(name) {
|
|
251
|
+
name = name.split(".")[0];
|
|
252
|
+
return this.options.find((option) => {
|
|
253
|
+
return option.names.includes(name);
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
outputHelp() {
|
|
257
|
+
const { name, commands } = this.cli;
|
|
258
|
+
const { versionNumber, options: globalOptions, helpCallback } = this.cli.globalCommand;
|
|
259
|
+
let sections = [{ body: `${name}${versionNumber ? `/${versionNumber}` : ""}` }];
|
|
260
|
+
sections.push({
|
|
261
|
+
title: "Usage",
|
|
262
|
+
body: ` $ ${name} ${this.usageText || this.rawName}`
|
|
263
|
+
});
|
|
264
|
+
if ((this.isGlobalCommand || this.isDefaultCommand) && commands.length > 0) {
|
|
265
|
+
const longestCommandName = findLongest(commands.map((command) => command.rawName));
|
|
266
|
+
sections.push({
|
|
267
|
+
title: "Commands",
|
|
268
|
+
body: commands.map((command) => {
|
|
269
|
+
return ` ${padRight(command.rawName, longestCommandName.length)} ${command.description}`;
|
|
270
|
+
}).join("\n")
|
|
271
|
+
});
|
|
272
|
+
sections.push({
|
|
273
|
+
title: `For more info, run any command with the \`--help\` flag`,
|
|
274
|
+
body: commands.map((command) => ` $ ${name}${command.name === "" ? "" : ` ${command.name}`} --help`).join("\n")
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
let options = this.isGlobalCommand ? globalOptions : [...this.options, ...globalOptions || []];
|
|
278
|
+
if (!this.isGlobalCommand && !this.isDefaultCommand) options = options.filter((option) => option.name !== "version");
|
|
279
|
+
if (options.length > 0) {
|
|
280
|
+
const longestOptionName = findLongest(options.map((option) => option.rawName));
|
|
281
|
+
sections.push({
|
|
282
|
+
title: "Options",
|
|
283
|
+
body: options.map((option) => {
|
|
284
|
+
return ` ${padRight(option.rawName, longestOptionName.length)} ${option.description} ${option.config.default === void 0 ? "" : `(default: ${option.config.default})`}`;
|
|
285
|
+
}).join("\n")
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
if (this.examples.length > 0) sections.push({
|
|
289
|
+
title: "Examples",
|
|
290
|
+
body: this.examples.map((example) => {
|
|
291
|
+
if (typeof example === "function") return example(name);
|
|
292
|
+
return example;
|
|
293
|
+
}).join("\n")
|
|
294
|
+
});
|
|
295
|
+
if (helpCallback) sections = helpCallback(sections) || sections;
|
|
296
|
+
console.log(sections.map((section) => {
|
|
297
|
+
return section.title ? `${section.title}:
|
|
298
|
+
${section.body}` : section.body;
|
|
299
|
+
}).join("\n\n"));
|
|
300
|
+
}
|
|
301
|
+
outputVersion() {
|
|
302
|
+
const { name } = this.cli;
|
|
303
|
+
const { versionNumber } = this.cli.globalCommand;
|
|
304
|
+
if (versionNumber) console.log(`${name}/${versionNumber} ${platformInfo}`);
|
|
305
|
+
}
|
|
306
|
+
checkRequiredArgs() {
|
|
307
|
+
const minimalArgsCount = this.args.filter((arg) => arg.required).length;
|
|
308
|
+
if (this.cli.args.length < minimalArgsCount) throw new CACError(`missing required args for command \`${this.rawName}\``);
|
|
309
|
+
}
|
|
310
|
+
checkUnknownOptions() {
|
|
311
|
+
const { options, globalCommand } = this.cli;
|
|
312
|
+
if (!this.config.allowUnknownOptions) {
|
|
313
|
+
for (const name of Object.keys(options)) if (name !== "--" && !this.hasOption(name) && !globalCommand.hasOption(name)) throw new CACError(`Unknown option \`${name.length > 1 ? `--${name}` : `-${name}`}\``);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
checkOptionValue() {
|
|
317
|
+
const { options: parsedOptions, globalCommand } = this.cli;
|
|
318
|
+
const options = [...globalCommand.options, ...this.options];
|
|
319
|
+
for (const option of options) {
|
|
320
|
+
const value = parsedOptions[option.name.split(".")[0]];
|
|
321
|
+
if (option.required) {
|
|
322
|
+
const hasNegated = options.some((o) => o.negated && o.names.includes(option.name));
|
|
323
|
+
if (value === true || value === false && !hasNegated) throw new CACError(`option \`${option.rawName}\` value is missing`);
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
};
|
|
328
|
+
var GlobalCommand = class extends Command {
|
|
329
|
+
constructor(cli) {
|
|
330
|
+
super("@@global@@", "", {}, cli);
|
|
331
|
+
}
|
|
332
|
+
};
|
|
333
|
+
var __assign = Object.assign;
|
|
334
|
+
var CAC = class extends EventEmitter {
|
|
335
|
+
constructor(name = "") {
|
|
336
|
+
super();
|
|
337
|
+
this.name = name;
|
|
338
|
+
this.commands = [];
|
|
339
|
+
this.rawArgs = [];
|
|
340
|
+
this.args = [];
|
|
341
|
+
this.options = {};
|
|
342
|
+
this.globalCommand = new GlobalCommand(this);
|
|
343
|
+
this.globalCommand.usage("<command> [options]");
|
|
344
|
+
}
|
|
345
|
+
usage(text) {
|
|
346
|
+
this.globalCommand.usage(text);
|
|
347
|
+
return this;
|
|
348
|
+
}
|
|
349
|
+
command(rawName, description, config) {
|
|
350
|
+
const command = new Command(rawName, description || "", config, this);
|
|
351
|
+
command.globalCommand = this.globalCommand;
|
|
352
|
+
this.commands.push(command);
|
|
353
|
+
return command;
|
|
354
|
+
}
|
|
355
|
+
option(rawName, description, config) {
|
|
356
|
+
this.globalCommand.option(rawName, description, config);
|
|
357
|
+
return this;
|
|
358
|
+
}
|
|
359
|
+
help(callback) {
|
|
360
|
+
this.globalCommand.option("-h, --help", "Display this message");
|
|
361
|
+
this.globalCommand.helpCallback = callback;
|
|
362
|
+
this.showHelpOnExit = true;
|
|
363
|
+
return this;
|
|
364
|
+
}
|
|
365
|
+
version(version, customFlags = "-v, --version") {
|
|
366
|
+
this.globalCommand.version(version, customFlags);
|
|
367
|
+
this.showVersionOnExit = true;
|
|
368
|
+
return this;
|
|
369
|
+
}
|
|
370
|
+
example(example) {
|
|
371
|
+
this.globalCommand.example(example);
|
|
372
|
+
return this;
|
|
373
|
+
}
|
|
374
|
+
outputHelp() {
|
|
375
|
+
if (this.matchedCommand) this.matchedCommand.outputHelp();
|
|
376
|
+
else this.globalCommand.outputHelp();
|
|
377
|
+
}
|
|
378
|
+
outputVersion() {
|
|
379
|
+
this.globalCommand.outputVersion();
|
|
380
|
+
}
|
|
381
|
+
setParsedInfo({ args, options }, matchedCommand, matchedCommandName) {
|
|
382
|
+
this.args = args;
|
|
383
|
+
this.options = options;
|
|
384
|
+
if (matchedCommand) this.matchedCommand = matchedCommand;
|
|
385
|
+
if (matchedCommandName) this.matchedCommandName = matchedCommandName;
|
|
386
|
+
return this;
|
|
387
|
+
}
|
|
388
|
+
unsetMatchedCommand() {
|
|
389
|
+
this.matchedCommand = void 0;
|
|
390
|
+
this.matchedCommandName = void 0;
|
|
391
|
+
}
|
|
392
|
+
parse(argv = processArgs, { run = true } = {}) {
|
|
393
|
+
this.rawArgs = argv;
|
|
394
|
+
if (!this.name) this.name = argv[1] ? getFileName(argv[1]) : "cli";
|
|
395
|
+
let shouldParse = true;
|
|
396
|
+
for (const command of this.commands) {
|
|
397
|
+
const parsed = this.mri(argv.slice(2), command);
|
|
398
|
+
const commandName = parsed.args[0];
|
|
399
|
+
if (command.isMatched(commandName)) {
|
|
400
|
+
shouldParse = false;
|
|
401
|
+
const parsedInfo = __assign(__assign({}, parsed), { args: parsed.args.slice(1) });
|
|
402
|
+
this.setParsedInfo(parsedInfo, command, commandName);
|
|
403
|
+
this.emit(`command:${commandName}`, command);
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
if (shouldParse) {
|
|
407
|
+
for (const command of this.commands) if (command.name === "") {
|
|
408
|
+
shouldParse = false;
|
|
409
|
+
const parsed = this.mri(argv.slice(2), command);
|
|
410
|
+
this.setParsedInfo(parsed, command);
|
|
411
|
+
this.emit(`command:!`, command);
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
if (shouldParse) {
|
|
415
|
+
const parsed = this.mri(argv.slice(2));
|
|
416
|
+
this.setParsedInfo(parsed);
|
|
417
|
+
}
|
|
418
|
+
if (this.options.help && this.showHelpOnExit) {
|
|
419
|
+
this.outputHelp();
|
|
420
|
+
run = false;
|
|
421
|
+
this.unsetMatchedCommand();
|
|
422
|
+
}
|
|
423
|
+
if (this.options.version && this.showVersionOnExit && this.matchedCommandName == null) {
|
|
424
|
+
this.outputVersion();
|
|
425
|
+
run = false;
|
|
426
|
+
this.unsetMatchedCommand();
|
|
427
|
+
}
|
|
428
|
+
const parsedArgv = {
|
|
429
|
+
args: this.args,
|
|
430
|
+
options: this.options
|
|
431
|
+
};
|
|
432
|
+
if (run) this.runMatchedCommand();
|
|
433
|
+
if (!this.matchedCommand && this.args[0]) this.emit("command:*");
|
|
434
|
+
return parsedArgv;
|
|
435
|
+
}
|
|
436
|
+
mri(argv, command) {
|
|
437
|
+
const cliOptions = [...this.globalCommand.options, ...command ? command.options : []];
|
|
438
|
+
const mriOptions = getMriOptions(cliOptions);
|
|
439
|
+
let argsAfterDoubleDashes = [];
|
|
440
|
+
const doubleDashesIndex = argv.indexOf("--");
|
|
441
|
+
if (doubleDashesIndex > -1) {
|
|
442
|
+
argsAfterDoubleDashes = argv.slice(doubleDashesIndex + 1);
|
|
443
|
+
argv = argv.slice(0, doubleDashesIndex);
|
|
444
|
+
}
|
|
445
|
+
let parsed = mri2(argv, mriOptions);
|
|
446
|
+
parsed = Object.keys(parsed).reduce((res, name) => {
|
|
447
|
+
return __assign(__assign({}, res), { [camelcaseOptionName(name)]: parsed[name] });
|
|
448
|
+
}, { _: [] });
|
|
449
|
+
const args = parsed._;
|
|
450
|
+
const options = { "--": argsAfterDoubleDashes };
|
|
451
|
+
const ignoreDefault = command && command.config.ignoreOptionDefaultValue ? command.config.ignoreOptionDefaultValue : this.globalCommand.config.ignoreOptionDefaultValue;
|
|
452
|
+
let transforms = Object.create(null);
|
|
453
|
+
for (const cliOption of cliOptions) {
|
|
454
|
+
if (!ignoreDefault && cliOption.config.default !== void 0) for (const name of cliOption.names) options[name] = cliOption.config.default;
|
|
455
|
+
if (Array.isArray(cliOption.config.type)) {
|
|
456
|
+
if (transforms[cliOption.name] === void 0) {
|
|
457
|
+
transforms[cliOption.name] = Object.create(null);
|
|
458
|
+
transforms[cliOption.name]["shouldTransform"] = true;
|
|
459
|
+
transforms[cliOption.name]["transformFunction"] = cliOption.config.type[0];
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
for (const key of Object.keys(parsed)) if (key !== "_") {
|
|
464
|
+
setDotProp(options, key.split("."), parsed[key]);
|
|
465
|
+
setByType(options, transforms);
|
|
466
|
+
}
|
|
467
|
+
return {
|
|
468
|
+
args,
|
|
469
|
+
options
|
|
470
|
+
};
|
|
471
|
+
}
|
|
472
|
+
runMatchedCommand() {
|
|
473
|
+
const { args, options, matchedCommand: command } = this;
|
|
474
|
+
if (!command || !command.commandAction) return;
|
|
475
|
+
command.checkUnknownOptions();
|
|
476
|
+
command.checkOptionValue();
|
|
477
|
+
command.checkRequiredArgs();
|
|
478
|
+
const actionArgs = [];
|
|
479
|
+
command.args.forEach((arg, index) => {
|
|
480
|
+
if (arg.variadic) actionArgs.push(args.slice(index));
|
|
481
|
+
else actionArgs.push(args[index]);
|
|
482
|
+
});
|
|
483
|
+
actionArgs.push(options);
|
|
484
|
+
return command.commandAction.apply(this, actionArgs);
|
|
485
|
+
}
|
|
486
|
+
};
|
|
487
|
+
const cac = (name = "") => new CAC(name);
|
|
488
|
+
|
|
489
|
+
//#endregion
|
|
490
|
+
//#region ../../node_modules/.pnpm/tsdown@0.20.2_@arethetypeswrong+core@0.18.2_@typescript+native-preview@7.0.0-dev.202601_11c6934cad7d4cedf7999249d5905a1c/node_modules/tsdown/dist/run.mjs
|
|
491
|
+
const cli = cac("tsdown");
|
|
492
|
+
cli.help().version(version);
|
|
493
|
+
cli.command("[...files]", "Bundle files", {
|
|
494
|
+
ignoreOptionDefaultValue: true,
|
|
495
|
+
allowUnknownOptions: true
|
|
496
|
+
}).option("-c, --config <filename>", "Use a custom config file").option("--config-loader <loader>", "Config loader to use: auto, native, unrun", { default: "auto" }).option("--no-config", "Disable config file").option("-f, --format <format>", "Bundle format: esm, cjs, iife, umd", { default: "esm" }).option("--clean", "Clean output directory, --no-clean to disable").option("--external <module>", "Mark dependencies as external").option("--minify", "Minify output").option("--devtools", "Enable devtools integration").option("--debug [feat]", "Show debug logs").option("--target <target>", "Bundle target, e.g \"es2015\", \"esnext\"").option("-l, --logLevel <level>", "Set log level: info, warn, error, silent").option("--fail-on-warn", "Fail on warnings", { default: true }).option("--no-write", "Disable writing files to disk, incompatible with watch mode").option("-d, --out-dir <dir>", "Output directory", { default: "dist" }).option("--treeshake", "Tree-shake bundle", { default: true }).option("--sourcemap", "Generate source map", { default: false }).option("--shims", "Enable cjs and esm shims ", { default: false }).option("--platform <platform>", "Target platform", { default: "node" }).option("--dts", "Generate dts files").option("--publint", "Enable publint", { default: false }).option("--attw", "Enable Are the types wrong integration", { default: false }).option("--unused", "Enable unused dependencies check", { default: false }).option("-w, --watch [path]", "Watch mode").option("--ignore-watch <path>", "Ignore custom paths in watch mode").option("--from-vite [vitest]", "Reuse config from Vite or Vitest").option("--report", "Size report", { default: true }).option("--env.* <value>", "Define compile-time env variables").option("--env-file <file>", "Load environment variables from a file, when used together with --env, variables in --env take precedence").option("--env-prefix <prefix>", "Prefix for env variables to inject into the bundle", { default: "TSDOWN_" }).option("--on-success <command>", "Command to run on success").option("--copy <dir>", "Copy files to output dir").option("--public-dir <dir>", "Alias for --copy, deprecated").option("--tsconfig <tsconfig>", "Set tsconfig path").option("--unbundle", "Unbundle mode").option("-W, --workspace [dir]", "Enable workspace mode").option("-F, --filter <pattern>", "Filter configs (cwd or name), e.g. /pkg-name$/ or pkg-name").option("--exports", "Generate export-related metadata for package.json (experimental)").action(async (input, flags) => {
|
|
497
|
+
globalLogger.level = flags.logLevel || "info";
|
|
498
|
+
globalLogger.info(`tsdown ${dim`v${version}`} powered by rolldown ${dim`v${VERSION}`}`);
|
|
499
|
+
const { build } = await import("./build-l5WhXg4M-BBPqZr0m.js").then((n) => n.r).then((n) => n.r);
|
|
500
|
+
if (input.length > 0) flags.entry = input;
|
|
501
|
+
await build(flags);
|
|
502
|
+
});
|
|
503
|
+
cli.command("create", "[deprecated] Create a tsdown project. Use \"npx create-tsdown\" instead.", { allowUnknownOptions: true }).action(async () => {
|
|
504
|
+
globalLogger.warn(`"tsdown create" is deprecated. Please use "npx create-tsdown" instead.`);
|
|
505
|
+
const { exitCode } = await K("npx", [
|
|
506
|
+
"-y",
|
|
507
|
+
"create-tsdown@latest",
|
|
508
|
+
...process$1.argv.slice(3)
|
|
509
|
+
], { nodeOptions: { stdio: "inherit" } });
|
|
510
|
+
process$1.exitCode = exitCode;
|
|
511
|
+
});
|
|
512
|
+
cli.command("migrate", "[deprecated] Migrate from tsup to tsdown. Use \"npx tsdown-migrate\" instead.", { allowUnknownOptions: true }).action(async () => {
|
|
513
|
+
globalLogger.warn(`"tsdown migrate" is deprecated. Please use "npx tsdown-migrate" instead.`);
|
|
514
|
+
const { exitCode } = await K("npx", [
|
|
515
|
+
"-y",
|
|
516
|
+
"tsdown-migrate@latest",
|
|
517
|
+
...process$1.argv.slice(3)
|
|
518
|
+
], { nodeOptions: { stdio: "inherit" } });
|
|
519
|
+
process$1.exitCode = exitCode;
|
|
520
|
+
});
|
|
521
|
+
async function runCLI() {
|
|
522
|
+
cli.parse(process$1.argv, { run: false });
|
|
523
|
+
enableDebug(cli.options.debug);
|
|
524
|
+
try {
|
|
525
|
+
await cli.runMatchedCommand();
|
|
526
|
+
} catch (error) {
|
|
527
|
+
globalLogger.error(String(error.stack || error.message));
|
|
528
|
+
process$1.exit(1);
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
try {
|
|
532
|
+
module.enableCompileCache?.();
|
|
533
|
+
} catch {}
|
|
534
|
+
runCLI();
|
|
535
|
+
|
|
536
|
+
//#endregion
|
|
537
|
+
export { };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { t as createDebug } from "./node-Cb5OsnKg.js";
|
|
2
|
+
|
|
3
|
+
//#region ../../node_modules/.pnpm/rolldown-plugin-dts@0.22.1_@typescript+native-preview@7.0.0-dev.20260122.2_oxc-resolver_d2e4a246ecba2d40b4415d1b79df8dc9/node_modules/rolldown-plugin-dts/dist/tsc-context.mjs
|
|
4
|
+
const path = globalThis.process.getBuiltinModule("node:path");
|
|
5
|
+
const debug = createDebug("rolldown-plugin-dts:tsc-context");
|
|
6
|
+
function createContext() {
|
|
7
|
+
return {
|
|
8
|
+
programs: [],
|
|
9
|
+
files: /* @__PURE__ */ new Map(),
|
|
10
|
+
projects: /* @__PURE__ */ new Map()
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
function invalidateContextFile(context, file) {
|
|
14
|
+
file = path.resolve(file).replaceAll("\\", "/");
|
|
15
|
+
debug(`invalidating context file: ${file}`);
|
|
16
|
+
context.files.delete(file);
|
|
17
|
+
context.programs = context.programs.filter((program) => {
|
|
18
|
+
return !program.getSourceFiles().some((sourceFile) => sourceFile.fileName === file);
|
|
19
|
+
});
|
|
20
|
+
context.projects.clear();
|
|
21
|
+
}
|
|
22
|
+
const globalContext = createContext();
|
|
23
|
+
|
|
24
|
+
//#endregion
|
|
25
|
+
export { globalContext as n, invalidateContextFile as r, createContext as t };
|