vite 6.0.0-alpha.13 → 6.0.0-alpha.14
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/node/chunks/dep-B2yOf3Tu.js +6385 -0
- package/dist/node/chunks/{dep-m9gtlanK.js → dep-BH5K5NVS.js} +1 -1
- package/dist/node/chunks/{dep-XbxO4NmM.js → dep-DnG211Xs.js} +6314 -12399
- package/dist/node/chunks/{dep-BJOLgJFH.js → dep-cpG-cLQR.js} +3 -3
- package/dist/node/cli.js +12 -4
- package/dist/node/index.d.ts +37 -39
- package/dist/node/index.js +9 -9
- package/dist/node-cjs/publicUtils.cjs +67 -44
- package/package.json +9 -9
- package/dist/node/chunks/dep-C7zR1Rh8.js +0 -233
@@ -1,233 +0,0 @@
|
|
1
|
-
import readline from 'node:readline';
|
2
|
-
import require$$0 from 'tty';
|
3
|
-
|
4
|
-
import { fileURLToPath as __cjs_fileURLToPath } from 'node:url';
|
5
|
-
import { dirname as __cjs_dirname } from 'node:path';
|
6
|
-
import { createRequire as __cjs_createRequire } from 'node:module';
|
7
|
-
|
8
|
-
const __filename = __cjs_fileURLToPath(import.meta.url);
|
9
|
-
const __dirname = __cjs_dirname(__filename);
|
10
|
-
const require = __cjs_createRequire(import.meta.url);
|
11
|
-
const __require = require;
|
12
|
-
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
13
|
-
|
14
|
-
function getDefaultExportFromCjs (x) {
|
15
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
16
|
-
}
|
17
|
-
|
18
|
-
function getAugmentedNamespace(n) {
|
19
|
-
if (n.__esModule) return n;
|
20
|
-
var f = n.default;
|
21
|
-
if (typeof f == "function") {
|
22
|
-
var a = function a () {
|
23
|
-
if (this instanceof a) {
|
24
|
-
return Reflect.construct(f, arguments, this.constructor);
|
25
|
-
}
|
26
|
-
return f.apply(this, arguments);
|
27
|
-
};
|
28
|
-
a.prototype = f.prototype;
|
29
|
-
} else a = {};
|
30
|
-
Object.defineProperty(a, '__esModule', {value: true});
|
31
|
-
Object.keys(n).forEach(function (k) {
|
32
|
-
var d = Object.getOwnPropertyDescriptor(n, k);
|
33
|
-
Object.defineProperty(a, k, d.get ? d : {
|
34
|
-
enumerable: true,
|
35
|
-
get: function () {
|
36
|
-
return n[k];
|
37
|
-
}
|
38
|
-
});
|
39
|
-
});
|
40
|
-
return a;
|
41
|
-
}
|
42
|
-
|
43
|
-
var picocolors = {exports: {}};
|
44
|
-
|
45
|
-
let tty = require$$0;
|
46
|
-
|
47
|
-
let isColorSupported =
|
48
|
-
!("NO_COLOR" in process.env || process.argv.includes("--no-color")) &&
|
49
|
-
("FORCE_COLOR" in process.env ||
|
50
|
-
process.argv.includes("--color") ||
|
51
|
-
process.platform === "win32" ||
|
52
|
-
(tty.isatty(1) && process.env.TERM !== "dumb") ||
|
53
|
-
"CI" in process.env);
|
54
|
-
|
55
|
-
let formatter =
|
56
|
-
(open, close, replace = open) =>
|
57
|
-
input => {
|
58
|
-
let string = "" + input;
|
59
|
-
let index = string.indexOf(close, open.length);
|
60
|
-
return ~index
|
61
|
-
? open + replaceClose(string, close, replace, index) + close
|
62
|
-
: open + string + close
|
63
|
-
};
|
64
|
-
|
65
|
-
let replaceClose = (string, close, replace, index) => {
|
66
|
-
let start = string.substring(0, index) + replace;
|
67
|
-
let end = string.substring(index + close.length);
|
68
|
-
let nextIndex = end.indexOf(close);
|
69
|
-
return ~nextIndex ? start + replaceClose(end, close, replace, nextIndex) : start + end
|
70
|
-
};
|
71
|
-
|
72
|
-
let createColors = (enabled = isColorSupported) => ({
|
73
|
-
isColorSupported: enabled,
|
74
|
-
reset: enabled ? s => `\x1b[0m${s}\x1b[0m` : String,
|
75
|
-
bold: enabled ? formatter("\x1b[1m", "\x1b[22m", "\x1b[22m\x1b[1m") : String,
|
76
|
-
dim: enabled ? formatter("\x1b[2m", "\x1b[22m", "\x1b[22m\x1b[2m") : String,
|
77
|
-
italic: enabled ? formatter("\x1b[3m", "\x1b[23m") : String,
|
78
|
-
underline: enabled ? formatter("\x1b[4m", "\x1b[24m") : String,
|
79
|
-
inverse: enabled ? formatter("\x1b[7m", "\x1b[27m") : String,
|
80
|
-
hidden: enabled ? formatter("\x1b[8m", "\x1b[28m") : String,
|
81
|
-
strikethrough: enabled ? formatter("\x1b[9m", "\x1b[29m") : String,
|
82
|
-
black: enabled ? formatter("\x1b[30m", "\x1b[39m") : String,
|
83
|
-
red: enabled ? formatter("\x1b[31m", "\x1b[39m") : String,
|
84
|
-
green: enabled ? formatter("\x1b[32m", "\x1b[39m") : String,
|
85
|
-
yellow: enabled ? formatter("\x1b[33m", "\x1b[39m") : String,
|
86
|
-
blue: enabled ? formatter("\x1b[34m", "\x1b[39m") : String,
|
87
|
-
magenta: enabled ? formatter("\x1b[35m", "\x1b[39m") : String,
|
88
|
-
cyan: enabled ? formatter("\x1b[36m", "\x1b[39m") : String,
|
89
|
-
white: enabled ? formatter("\x1b[37m", "\x1b[39m") : String,
|
90
|
-
gray: enabled ? formatter("\x1b[90m", "\x1b[39m") : String,
|
91
|
-
bgBlack: enabled ? formatter("\x1b[40m", "\x1b[49m") : String,
|
92
|
-
bgRed: enabled ? formatter("\x1b[41m", "\x1b[49m") : String,
|
93
|
-
bgGreen: enabled ? formatter("\x1b[42m", "\x1b[49m") : String,
|
94
|
-
bgYellow: enabled ? formatter("\x1b[43m", "\x1b[49m") : String,
|
95
|
-
bgBlue: enabled ? formatter("\x1b[44m", "\x1b[49m") : String,
|
96
|
-
bgMagenta: enabled ? formatter("\x1b[45m", "\x1b[49m") : String,
|
97
|
-
bgCyan: enabled ? formatter("\x1b[46m", "\x1b[49m") : String,
|
98
|
-
bgWhite: enabled ? formatter("\x1b[47m", "\x1b[49m") : String,
|
99
|
-
});
|
100
|
-
|
101
|
-
picocolors.exports = createColors();
|
102
|
-
picocolors.exports.createColors = createColors;
|
103
|
-
|
104
|
-
var picocolorsExports = picocolors.exports;
|
105
|
-
var colors = /*@__PURE__*/getDefaultExportFromCjs(picocolorsExports);
|
106
|
-
|
107
|
-
/* eslint no-console: 0 */
|
108
|
-
const LogLevels = {
|
109
|
-
silent: 0,
|
110
|
-
error: 1,
|
111
|
-
warn: 2,
|
112
|
-
info: 3,
|
113
|
-
};
|
114
|
-
let lastType;
|
115
|
-
let lastMsg;
|
116
|
-
let sameCount = 0;
|
117
|
-
function clearScreen() {
|
118
|
-
const repeatCount = process.stdout.rows - 2;
|
119
|
-
const blank = repeatCount > 0 ? '\n'.repeat(repeatCount) : '';
|
120
|
-
console.log(blank);
|
121
|
-
readline.cursorTo(process.stdout, 0, 0);
|
122
|
-
readline.clearScreenDown(process.stdout);
|
123
|
-
}
|
124
|
-
// Only initialize the timeFormatter when the timestamp option is used, and
|
125
|
-
// reuse it across all loggers
|
126
|
-
let timeFormatter;
|
127
|
-
function getTimeFormatter() {
|
128
|
-
timeFormatter ??= new Intl.DateTimeFormat(undefined, {
|
129
|
-
hour: 'numeric',
|
130
|
-
minute: 'numeric',
|
131
|
-
second: 'numeric',
|
132
|
-
});
|
133
|
-
return timeFormatter;
|
134
|
-
}
|
135
|
-
function createLogger(level = 'info', options = {}) {
|
136
|
-
if (options.customLogger) {
|
137
|
-
return options.customLogger;
|
138
|
-
}
|
139
|
-
const loggedErrors = new WeakSet();
|
140
|
-
const { prefix = '[vite]', allowClearScreen = true } = options;
|
141
|
-
const thresh = LogLevels[level];
|
142
|
-
const canClearScreen = allowClearScreen && process.stdout.isTTY && !process.env.CI;
|
143
|
-
const clear = canClearScreen ? clearScreen : () => { };
|
144
|
-
function format(type, msg, options = {}) {
|
145
|
-
if (options.timestamp) {
|
146
|
-
const color = type === 'info'
|
147
|
-
? colors.cyan
|
148
|
-
: type === 'warn'
|
149
|
-
? colors.yellow
|
150
|
-
: colors.red;
|
151
|
-
const tag = color(colors.bold(prefix));
|
152
|
-
const environment = options.environment ? options.environment + ' ' : '';
|
153
|
-
return `${colors.dim(getTimeFormatter().format(new Date()))} ${tag} ${environment}${msg}`;
|
154
|
-
}
|
155
|
-
else {
|
156
|
-
return msg;
|
157
|
-
}
|
158
|
-
}
|
159
|
-
function output(type, msg, options = {}) {
|
160
|
-
if (thresh >= LogLevels[type]) {
|
161
|
-
const method = type === 'info' ? 'log' : type;
|
162
|
-
if (options.error) {
|
163
|
-
loggedErrors.add(options.error);
|
164
|
-
}
|
165
|
-
if (canClearScreen) {
|
166
|
-
if (type === lastType && msg === lastMsg) {
|
167
|
-
sameCount++;
|
168
|
-
clear();
|
169
|
-
console[method](format(type, msg, options), colors.yellow(`(x${sameCount + 1})`));
|
170
|
-
}
|
171
|
-
else {
|
172
|
-
sameCount = 0;
|
173
|
-
lastMsg = msg;
|
174
|
-
lastType = type;
|
175
|
-
if (options.clear) {
|
176
|
-
clear();
|
177
|
-
}
|
178
|
-
console[method](format(type, msg, options));
|
179
|
-
}
|
180
|
-
}
|
181
|
-
else {
|
182
|
-
console[method](format(type, msg, options));
|
183
|
-
}
|
184
|
-
}
|
185
|
-
}
|
186
|
-
const warnedMessages = new Set();
|
187
|
-
const logger = {
|
188
|
-
hasWarned: false,
|
189
|
-
info(msg, opts) {
|
190
|
-
output('info', msg, opts);
|
191
|
-
},
|
192
|
-
warn(msg, opts) {
|
193
|
-
logger.hasWarned = true;
|
194
|
-
output('warn', msg, opts);
|
195
|
-
},
|
196
|
-
warnOnce(msg, opts) {
|
197
|
-
if (warnedMessages.has(msg))
|
198
|
-
return;
|
199
|
-
logger.hasWarned = true;
|
200
|
-
output('warn', msg, opts);
|
201
|
-
warnedMessages.add(msg);
|
202
|
-
},
|
203
|
-
error(msg, opts) {
|
204
|
-
logger.hasWarned = true;
|
205
|
-
output('error', msg, opts);
|
206
|
-
},
|
207
|
-
clearScreen(type) {
|
208
|
-
if (thresh >= LogLevels[type]) {
|
209
|
-
clear();
|
210
|
-
}
|
211
|
-
},
|
212
|
-
hasErrorLogged(error) {
|
213
|
-
return loggedErrors.has(error);
|
214
|
-
},
|
215
|
-
};
|
216
|
-
return logger;
|
217
|
-
}
|
218
|
-
function printServerUrls(urls, optionsHost, info) {
|
219
|
-
const colorUrl = (url) => colors.cyan(url.replace(/:(\d+)\//, (_, port) => `:${colors.bold(port)}/`));
|
220
|
-
for (const url of urls.local) {
|
221
|
-
info(` ${colors.green('➜')} ${colors.bold('Local')}: ${colorUrl(url)}`);
|
222
|
-
}
|
223
|
-
for (const url of urls.network) {
|
224
|
-
info(` ${colors.green('➜')} ${colors.bold('Network')}: ${colorUrl(url)}`);
|
225
|
-
}
|
226
|
-
if (urls.network.length === 0 && optionsHost === undefined) {
|
227
|
-
info(colors.dim(` ${colors.green('➜')} ${colors.bold('Network')}: use `) +
|
228
|
-
colors.bold('--host') +
|
229
|
-
colors.dim(' to expose'));
|
230
|
-
}
|
231
|
-
}
|
232
|
-
|
233
|
-
export { LogLevels as L, colors as a, commonjsGlobal as b, createLogger as c, getAugmentedNamespace as d, printServerUrls as e, getDefaultExportFromCjs as g, picocolorsExports as p };
|