vite 6.0.0-alpha.2 → 6.0.0-alpha.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/client/client.mjs +9 -8
- package/dist/client/client.mjs.map +1 -1
- package/dist/node/chunks/{dep-DKZVy3_n.js → dep-BJOLgJFH.js} +1 -1
- package/dist/node/chunks/dep-C7zR1Rh8.js +233 -0
- package/dist/node/chunks/{dep-E4cF1RpV.js → dep-DitPlFWl.js} +27467 -27574
- package/dist/node/chunks/{dep-DK04Q0H9.js → dep-m9gtlanK.js} +1 -1
- package/dist/node/cli.js +30 -56
- package/dist/node/index.d.ts +150 -75
- package/dist/node/index.js +9 -120
- package/dist/node/module-runner.d.ts +11 -10
- package/dist/node/module-runner.js +55 -44
- package/dist/node-cjs/publicUtils.cjs +72 -33
- package/index.cjs +1 -0
- package/package.json +1 -1
@@ -2956,9 +2956,9 @@ const isObject$2 = val => val && typeof val === 'object' && !Array.isArray(val);
|
|
2956
2956
|
* @api public
|
2957
2957
|
*/
|
2958
2958
|
|
2959
|
-
const picomatch$
|
2959
|
+
const picomatch$2 = (glob, options, returnState = false) => {
|
2960
2960
|
if (Array.isArray(glob)) {
|
2961
|
-
const fns = glob.map(input => picomatch$
|
2961
|
+
const fns = glob.map(input => picomatch$2(input, options, returnState));
|
2962
2962
|
const arrayMatcher = str => {
|
2963
2963
|
for (const isMatch of fns) {
|
2964
2964
|
const state = isMatch(str);
|
@@ -2978,8 +2978,8 @@ const picomatch$1 = (glob, options, returnState = false) => {
|
|
2978
2978
|
const opts = options || {};
|
2979
2979
|
const posix = utils.isWindows(options);
|
2980
2980
|
const regex = isState
|
2981
|
-
? picomatch$
|
2982
|
-
: picomatch$
|
2981
|
+
? picomatch$2.compileRe(glob, options)
|
2982
|
+
: picomatch$2.makeRe(glob, options, false, true);
|
2983
2983
|
|
2984
2984
|
const state = regex.state;
|
2985
2985
|
delete regex.state;
|
@@ -2987,11 +2987,11 @@ const picomatch$1 = (glob, options, returnState = false) => {
|
|
2987
2987
|
let isIgnored = () => false;
|
2988
2988
|
if (opts.ignore) {
|
2989
2989
|
const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null };
|
2990
|
-
isIgnored = picomatch$
|
2990
|
+
isIgnored = picomatch$2(opts.ignore, ignoreOpts, returnState);
|
2991
2991
|
}
|
2992
2992
|
|
2993
2993
|
const matcher = (input, returnObject = false) => {
|
2994
|
-
const { isMatch, match, output } = picomatch$
|
2994
|
+
const { isMatch, match, output } = picomatch$2.test(input, regex, options, { glob, posix });
|
2995
2995
|
const result = { glob, state, regex, posix, input, output, match, isMatch };
|
2996
2996
|
|
2997
2997
|
if (typeof opts.onResult === 'function') {
|
@@ -3041,7 +3041,7 @@ const picomatch$1 = (glob, options, returnState = false) => {
|
|
3041
3041
|
* @api public
|
3042
3042
|
*/
|
3043
3043
|
|
3044
|
-
picomatch$
|
3044
|
+
picomatch$2.test = (input, regex, options, { glob, posix } = {}) => {
|
3045
3045
|
if (typeof input !== 'string') {
|
3046
3046
|
throw new TypeError('Expected input to be a string');
|
3047
3047
|
}
|
@@ -3062,7 +3062,7 @@ picomatch$1.test = (input, regex, options, { glob, posix } = {}) => {
|
|
3062
3062
|
|
3063
3063
|
if (match === false || opts.capture === true) {
|
3064
3064
|
if (opts.matchBase === true || opts.basename === true) {
|
3065
|
-
match = picomatch$
|
3065
|
+
match = picomatch$2.matchBase(input, regex, options, posix);
|
3066
3066
|
} else {
|
3067
3067
|
match = regex.exec(output);
|
3068
3068
|
}
|
@@ -3085,8 +3085,8 @@ picomatch$1.test = (input, regex, options, { glob, posix } = {}) => {
|
|
3085
3085
|
* @api public
|
3086
3086
|
*/
|
3087
3087
|
|
3088
|
-
picomatch$
|
3089
|
-
const regex = glob instanceof RegExp ? glob : picomatch$
|
3088
|
+
picomatch$2.matchBase = (input, glob, options, posix = utils.isWindows(options)) => {
|
3089
|
+
const regex = glob instanceof RegExp ? glob : picomatch$2.makeRe(glob, options);
|
3090
3090
|
return regex.test(path$1.basename(input));
|
3091
3091
|
};
|
3092
3092
|
|
@@ -3107,7 +3107,7 @@ picomatch$1.matchBase = (input, glob, options, posix = utils.isWindows(options))
|
|
3107
3107
|
* @api public
|
3108
3108
|
*/
|
3109
3109
|
|
3110
|
-
picomatch$
|
3110
|
+
picomatch$2.isMatch = (str, patterns, options) => picomatch$2(patterns, options)(str);
|
3111
3111
|
|
3112
3112
|
/**
|
3113
3113
|
* Parse a glob pattern to create the source string for a regular
|
@@ -3123,8 +3123,8 @@ picomatch$1.isMatch = (str, patterns, options) => picomatch$1(patterns, options)
|
|
3123
3123
|
* @api public
|
3124
3124
|
*/
|
3125
3125
|
|
3126
|
-
picomatch$
|
3127
|
-
if (Array.isArray(pattern)) return pattern.map(p => picomatch$
|
3126
|
+
picomatch$2.parse = (pattern, options) => {
|
3127
|
+
if (Array.isArray(pattern)) return pattern.map(p => picomatch$2.parse(p, options));
|
3128
3128
|
return parse$1(pattern, { ...options, fastpaths: false });
|
3129
3129
|
};
|
3130
3130
|
|
@@ -3155,7 +3155,7 @@ picomatch$1.parse = (pattern, options) => {
|
|
3155
3155
|
* @api public
|
3156
3156
|
*/
|
3157
3157
|
|
3158
|
-
picomatch$
|
3158
|
+
picomatch$2.scan = (input, options) => scan(input, options);
|
3159
3159
|
|
3160
3160
|
/**
|
3161
3161
|
* Compile a regular expression from the `state` object returned by the
|
@@ -3169,7 +3169,7 @@ picomatch$1.scan = (input, options) => scan(input, options);
|
|
3169
3169
|
* @api public
|
3170
3170
|
*/
|
3171
3171
|
|
3172
|
-
picomatch$
|
3172
|
+
picomatch$2.compileRe = (state, options, returnOutput = false, returnState = false) => {
|
3173
3173
|
if (returnOutput === true) {
|
3174
3174
|
return state.output;
|
3175
3175
|
}
|
@@ -3183,7 +3183,7 @@ picomatch$1.compileRe = (state, options, returnOutput = false, returnState = fal
|
|
3183
3183
|
source = `^(?!${source}).*$`;
|
3184
3184
|
}
|
3185
3185
|
|
3186
|
-
const regex = picomatch$
|
3186
|
+
const regex = picomatch$2.toRegex(source, options);
|
3187
3187
|
if (returnState === true) {
|
3188
3188
|
regex.state = state;
|
3189
3189
|
}
|
@@ -3210,7 +3210,7 @@ picomatch$1.compileRe = (state, options, returnOutput = false, returnState = fal
|
|
3210
3210
|
* @api public
|
3211
3211
|
*/
|
3212
3212
|
|
3213
|
-
picomatch$
|
3213
|
+
picomatch$2.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
|
3214
3214
|
if (!input || typeof input !== 'string') {
|
3215
3215
|
throw new TypeError('Expected a non-empty string');
|
3216
3216
|
}
|
@@ -3225,7 +3225,7 @@ picomatch$1.makeRe = (input, options = {}, returnOutput = false, returnState = f
|
|
3225
3225
|
parsed = parse$1(input, options);
|
3226
3226
|
}
|
3227
3227
|
|
3228
|
-
return picomatch$
|
3228
|
+
return picomatch$2.compileRe(parsed, options, returnOutput, returnState);
|
3229
3229
|
};
|
3230
3230
|
|
3231
3231
|
/**
|
@@ -3245,7 +3245,7 @@ picomatch$1.makeRe = (input, options = {}, returnOutput = false, returnState = f
|
|
3245
3245
|
* @api public
|
3246
3246
|
*/
|
3247
3247
|
|
3248
|
-
picomatch$
|
3248
|
+
picomatch$2.toRegex = (source, options) => {
|
3249
3249
|
try {
|
3250
3250
|
const opts = options || {};
|
3251
3251
|
return new RegExp(source, opts.flags || (opts.nocase ? 'i' : ''));
|
@@ -3260,17 +3260,17 @@ picomatch$1.toRegex = (source, options) => {
|
|
3260
3260
|
* @return {Object}
|
3261
3261
|
*/
|
3262
3262
|
|
3263
|
-
picomatch$
|
3263
|
+
picomatch$2.constants = constants;
|
3264
3264
|
|
3265
3265
|
/**
|
3266
3266
|
* Expose "picomatch"
|
3267
3267
|
*/
|
3268
3268
|
|
3269
|
-
var picomatch_1 = picomatch$
|
3269
|
+
var picomatch_1 = picomatch$2;
|
3270
3270
|
|
3271
3271
|
var picomatch = picomatch_1;
|
3272
3272
|
|
3273
|
-
var
|
3273
|
+
var picomatch$1 = /*@__PURE__*/getDefaultExportFromCjs(picomatch);
|
3274
3274
|
|
3275
3275
|
// Helper since Typescript can't detect readonly arrays with Array.isArray
|
3276
3276
|
function isArray(arg) {
|
@@ -3310,7 +3310,7 @@ const createFilter$1 = function createFilter(include, exclude, options) {
|
|
3310
3310
|
test: (what) => {
|
3311
3311
|
// this refactor is a tad overly verbose but makes for easy debugging
|
3312
3312
|
const pattern = getMatcherString(id, resolutionBase);
|
3313
|
-
const fn =
|
3313
|
+
const fn = picomatch$1(pattern, { dot: true });
|
3314
3314
|
const result = fn(what);
|
3315
3315
|
return result;
|
3316
3316
|
}
|
@@ -5435,12 +5435,14 @@ function createLogger(level = 'info', options = {}) {
|
|
5435
5435
|
const clear = canClearScreen ? clearScreen : () => { };
|
5436
5436
|
function format(type, msg, options = {}) {
|
5437
5437
|
if (options.timestamp) {
|
5438
|
-
const
|
5439
|
-
? colors.cyan
|
5438
|
+
const color = type === 'info'
|
5439
|
+
? colors.cyan
|
5440
5440
|
: type === 'warn'
|
5441
|
-
? colors.yellow
|
5442
|
-
: colors.red
|
5443
|
-
|
5441
|
+
? colors.yellow
|
5442
|
+
: colors.red;
|
5443
|
+
const tag = color(colors.bold(prefix));
|
5444
|
+
const environment = options.environment ? options.environment + ' ' : '';
|
5445
|
+
return `${colors.dim(getTimeFormatter().format(new Date()))} ${tag} ${environment}${msg}`;
|
5444
5446
|
}
|
5445
5447
|
else {
|
5446
5448
|
return msg;
|
@@ -5568,18 +5570,55 @@ function searchForWorkspaceRoot(current, root = searchForPackageRoot(current)) {
|
|
5568
5570
|
return searchForWorkspaceRoot(dir, root);
|
5569
5571
|
}
|
5570
5572
|
|
5573
|
+
const safeModulePathsCache = new WeakMap();
|
5574
|
+
function isSafeModulePath(config, filePath) {
|
5575
|
+
let safeModulePaths = safeModulePathsCache.get(config);
|
5576
|
+
if (!safeModulePaths) {
|
5577
|
+
safeModulePaths = new Set();
|
5578
|
+
safeModulePathsCache.set(config, safeModulePaths);
|
5579
|
+
}
|
5580
|
+
return safeModulePaths.has(filePath);
|
5581
|
+
}
|
5582
|
+
const fsDenyGlobCache = new WeakMap();
|
5583
|
+
function fsDenyGlob(config, filePath) {
|
5584
|
+
let matcher = fsDenyGlobCache.get(config);
|
5585
|
+
if (!matcher) {
|
5586
|
+
(matcher = picomatch$1(
|
5587
|
+
// matchBase: true does not work as it's documented
|
5588
|
+
// https://github.com/micromatch/picomatch/issues/89
|
5589
|
+
// convert patterns without `/` on our side for now
|
5590
|
+
config.server.fs.deny.map((pattern) => pattern.includes('/') ? pattern : `**/${pattern}`), {
|
5591
|
+
matchBase: false,
|
5592
|
+
nocase: true,
|
5593
|
+
dot: true,
|
5594
|
+
})),
|
5595
|
+
fsDenyGlobCache.set(config, matcher);
|
5596
|
+
}
|
5597
|
+
return matcher(filePath);
|
5598
|
+
}
|
5571
5599
|
/**
|
5572
5600
|
* Check if the url is allowed to be served, via the `server.fs` config.
|
5601
|
+
* @deprecate use isFileLoadingAllowed
|
5573
5602
|
*/
|
5574
5603
|
function isFileServingAllowed(url, server) {
|
5575
|
-
|
5604
|
+
const { config } = server;
|
5605
|
+
if (!config.server.fs.strict)
|
5606
|
+
return true;
|
5607
|
+
const filePath = fsPathFromUrl(url);
|
5608
|
+
return isFileLoadingAllowed(config, filePath);
|
5609
|
+
}
|
5610
|
+
function isUriInFilePath(uri, filePath) {
|
5611
|
+
return isSameFileUri(uri, filePath) || isParentDirectory(uri, filePath);
|
5612
|
+
}
|
5613
|
+
function isFileLoadingAllowed(config, filePath) {
|
5614
|
+
const { fs } = config.server;
|
5615
|
+
if (!fs.strict)
|
5576
5616
|
return true;
|
5577
|
-
|
5578
|
-
if (server._fsDenyGlob(file))
|
5617
|
+
if (fsDenyGlob(config, filePath))
|
5579
5618
|
return false;
|
5580
|
-
if (
|
5619
|
+
if (isSafeModulePath(config, filePath))
|
5581
5620
|
return true;
|
5582
|
-
if (
|
5621
|
+
if (fs.allow.some((uri) => isUriInFilePath(uri, filePath)))
|
5583
5622
|
return true;
|
5584
5623
|
return false;
|
5585
5624
|
}
|
package/index.cjs
CHANGED
@@ -6,6 +6,7 @@ warnCjsUsage()
|
|
6
6
|
module.exports.defineConfig = (config) => config
|
7
7
|
|
8
8
|
// proxy cjs utils (sync functions)
|
9
|
+
// eslint-disable-next-line n/no-missing-require -- will be generated by build
|
9
10
|
Object.assign(module.exports, require('./dist/node-cjs/publicUtils.cjs'))
|
10
11
|
|
11
12
|
// async functions, can be redirect from ESM build
|