vite 2.7.1 → 2.7.2
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.
Potentially problematic release.
This version of vite might be problematic. Click here for more details.
- package/CHANGELOG.md +11 -0
- package/dist/node/build.d.ts +200 -0
- package/dist/node/chunks/{dep-51488e9f.js → dep-453486e7.js} +2 -2
- package/dist/node/chunks/{dep-51488e9f.js.map → dep-453486e7.js.map} +1 -1
- package/dist/node/chunks/{dep-3daf770c.js → dep-7817f5b4.js} +125 -27
- package/dist/node/chunks/dep-7817f5b4.js.map +1 -0
- package/dist/node/chunks/{dep-8ff556de.js → dep-93096c54.js} +2 -2
- package/dist/node/chunks/{dep-8ff556de.js.map → dep-93096c54.js.map} +1 -1
- package/dist/node/chunks/{dep-76c973d0.js → dep-fffc0487.js} +2 -2
- package/dist/node/chunks/{dep-76c973d0.js.map → dep-fffc0487.js.map} +1 -1
- package/dist/node/cli.d.ts +1 -0
- package/dist/node/cli.js +4 -4
- package/dist/node/cli.js.map +1 -1
- package/dist/node/config.d.ts +202 -0
- package/dist/node/constants.d.ts +33 -0
- package/dist/node/http.d.ts +84 -0
- package/dist/node/importGlob.d.ts +9 -0
- package/dist/node/index.d.ts +275 -280
- package/dist/node/index.js +1 -1
- package/dist/node/logger.d.ts +35 -0
- package/dist/node/optimizer/esbuildDepPlugin.d.ts +4 -0
- package/dist/node/optimizer/index.d.ts +66 -0
- package/dist/node/optimizer/registerMissing.d.ts +2 -0
- package/dist/node/optimizer/scan.d.ts +9 -0
- package/dist/node/packages.d.ts +25 -0
- package/dist/node/plugin.d.ts +115 -0
- package/dist/node/plugins/asset.d.ts +40 -0
- package/dist/node/plugins/assetImportMetaUrl.d.ts +13 -0
- package/dist/node/plugins/clientInjections.d.ts +7 -0
- package/dist/node/plugins/css.d.ts +72 -0
- package/dist/node/plugins/dataUri.d.ts +5 -0
- package/dist/node/plugins/define.d.ts +3 -0
- package/dist/node/plugins/esbuild.d.ts +15 -0
- package/dist/node/plugins/html.d.ts +102 -0
- package/dist/node/plugins/importAnalysis.d.ts +46 -0
- package/dist/node/plugins/importAnalysisBuild.d.ts +15 -0
- package/dist/node/plugins/index.d.ts +3 -0
- package/dist/node/plugins/json.d.ts +22 -0
- package/dist/node/plugins/loadFallback.d.ts +5 -0
- package/dist/node/plugins/manifest.d.ts +14 -0
- package/dist/node/plugins/modulePreloadPolyfill.d.ts +4 -0
- package/dist/node/plugins/preAlias.d.ts +5 -0
- package/dist/node/plugins/reporter.d.ts +3 -0
- package/dist/node/plugins/resolve.d.ts +38 -0
- package/dist/node/plugins/ssrRequireHook.d.ts +12 -0
- package/dist/node/plugins/terser.d.ts +3 -0
- package/dist/node/plugins/wasm.d.ts +3 -0
- package/dist/node/plugins/worker.d.ts +3 -0
- package/dist/node/preview.d.ts +31 -0
- package/dist/node/server/hmr.d.ts +37 -0
- package/dist/node/server/index.d.ts +214 -0
- package/dist/node/server/middlewares/base.d.ts +3 -0
- package/dist/node/server/middlewares/error.d.ts +8 -0
- package/dist/node/server/middlewares/indexHtml.d.ts +4 -0
- package/dist/node/server/middlewares/proxy.d.ts +20 -0
- package/dist/node/server/middlewares/spaFallback.d.ts +2 -0
- package/dist/node/server/middlewares/static.d.ts +6 -0
- package/dist/node/server/middlewares/time.d.ts +2 -0
- package/dist/node/server/middlewares/transform.d.ts +3 -0
- package/dist/node/server/moduleGraph.d.ts +53 -0
- package/dist/node/server/openBrowser.d.ts +15 -0
- package/dist/node/server/pluginContainer.d.ts +37 -0
- package/dist/node/server/searchRoot.d.ts +8 -0
- package/dist/node/server/send.d.ts +4 -0
- package/dist/node/server/sourcemap.d.ts +8 -0
- package/dist/node/server/transformRequest.d.ts +14 -0
- package/dist/node/server/ws.d.ts +14 -0
- package/dist/node/ssr/ssrExternal.d.ts +7 -0
- package/dist/node/ssr/ssrManifestPlugin.d.ts +3 -0
- package/dist/node/ssr/ssrModuleLoader.d.ts +7 -0
- package/dist/node/ssr/ssrStacktrace.d.ts +3 -0
- package/dist/node/ssr/ssrTransform.d.ts +8 -0
- package/dist/node/utils.d.ts +114 -0
- package/package.json +3 -3
- package/types/ws.d.ts +277 -281
- package/dist/node/chunks/dep-3daf770c.js.map +0 -1
|
@@ -4316,8 +4316,8 @@ function arraify(target) {
|
|
|
4316
4316
|
function toUpperCaseDriveLetter(pathName) {
|
|
4317
4317
|
return pathName.replace(/^\w:/, (letter) => letter.toUpperCase());
|
|
4318
4318
|
}
|
|
4319
|
-
const multilineCommentsRE = /\/\*(.|[\r\n])*?\*\//gm;
|
|
4320
|
-
const singlelineCommentsRE = /\/\/.*/g;
|
|
4319
|
+
const multilineCommentsRE$1 = /\/\*(.|[\r\n])*?\*\//gm;
|
|
4320
|
+
const singlelineCommentsRE$1 = /\/\/.*/g;
|
|
4321
4321
|
const usingDynamicImport = typeof jest === 'undefined';
|
|
4322
4322
|
/**
|
|
4323
4323
|
* Dynamically import files. It will make sure it's not being compiled away by TS/Rollup.
|
|
@@ -20396,7 +20396,7 @@ async function compileCSS(id, code, config, urlReplacer, atImportResolvers, serv
|
|
|
20396
20396
|
replacer: urlReplacer
|
|
20397
20397
|
}));
|
|
20398
20398
|
if (isModule) {
|
|
20399
|
-
postcssPlugins.unshift((await Promise.resolve().then(function () { return require('./dep-
|
|
20399
|
+
postcssPlugins.unshift((await Promise.resolve().then(function () { return require('./dep-fffc0487.js'); }).then(function (n) { return n.index; })).default({
|
|
20400
20400
|
...modulesOptions,
|
|
20401
20401
|
getJSON(cssFileName, _modules, outputFileName) {
|
|
20402
20402
|
modules = _modules;
|
|
@@ -20976,7 +20976,34 @@ function lexGlobPattern(code, pos) {
|
|
|
20976
20976
|
throw new Error('unknown import.meta.glob lexer state');
|
|
20977
20977
|
}
|
|
20978
20978
|
}
|
|
20979
|
-
|
|
20979
|
+
const endIndex = getEndIndex(code, i);
|
|
20980
|
+
return [pattern, endIndex + 1];
|
|
20981
|
+
}
|
|
20982
|
+
// reg without the 'g' option, only matches the first match
|
|
20983
|
+
const multilineCommentsRE = /\/\*(.|[\r\n])*?\*\//m;
|
|
20984
|
+
const singlelineCommentsRE = /\/\/.*/;
|
|
20985
|
+
function getEndIndex(code, i) {
|
|
20986
|
+
var _a;
|
|
20987
|
+
const findStart = i;
|
|
20988
|
+
const endIndex = code.indexOf(`)`, findStart);
|
|
20989
|
+
const subCode = code.substring(findStart);
|
|
20990
|
+
const matched = (_a = subCode.match(singlelineCommentsRE)) !== null && _a !== void 0 ? _a : subCode.match(multilineCommentsRE);
|
|
20991
|
+
if (!matched) {
|
|
20992
|
+
return endIndex;
|
|
20993
|
+
}
|
|
20994
|
+
const str = matched[0];
|
|
20995
|
+
const index = matched.index;
|
|
20996
|
+
if (!index) {
|
|
20997
|
+
return endIndex;
|
|
20998
|
+
}
|
|
20999
|
+
const commentStart = findStart + index;
|
|
21000
|
+
const commentEnd = commentStart + str.length;
|
|
21001
|
+
if (endIndex > commentStart && endIndex < commentEnd) {
|
|
21002
|
+
return getEndIndex(code, commentEnd);
|
|
21003
|
+
}
|
|
21004
|
+
else {
|
|
21005
|
+
return endIndex;
|
|
21006
|
+
}
|
|
20980
21007
|
}
|
|
20981
21008
|
function error$3(pos) {
|
|
20982
21009
|
const err = new Error(`import.meta.glob() can only accept string literals.`);
|
|
@@ -21342,7 +21369,7 @@ function htmlInlineScriptProxyPlugin(config) {
|
|
|
21342
21369
|
const file = cleanUrl(id);
|
|
21343
21370
|
const url = file.replace(normalizePath$4(config.root), '');
|
|
21344
21371
|
const result = htmlProxyMap.get(config).get(url)[index];
|
|
21345
|
-
if (result) {
|
|
21372
|
+
if (typeof result === 'string') {
|
|
21346
21373
|
return result;
|
|
21347
21374
|
}
|
|
21348
21375
|
else {
|
|
@@ -21374,7 +21401,7 @@ const assetAttrsConfig = {
|
|
|
21374
21401
|
const isAsyncScriptMap = new WeakMap();
|
|
21375
21402
|
async function traverseHtml(html, filePath, visitor) {
|
|
21376
21403
|
// lazy load compiler
|
|
21377
|
-
const { parse, transform } = await Promise.resolve().then(function () { return require('./dep-
|
|
21404
|
+
const { parse, transform } = await Promise.resolve().then(function () { return require('./dep-93096c54.js'); }).then(function (n) { return n.compilerDom_cjs; });
|
|
21378
21405
|
// @vue/compiler-core doesn't like lowercase doctypes
|
|
21379
21406
|
html = html.replace(/<!doctype\s/i, '<!DOCTYPE ');
|
|
21380
21407
|
try {
|
|
@@ -43198,8 +43225,8 @@ async function transformGlob(source, importer, root, loader) {
|
|
|
43198
43225
|
function extractImportPaths(code) {
|
|
43199
43226
|
// empty singleline & multiline comments to avoid matching comments
|
|
43200
43227
|
code = code
|
|
43201
|
-
.replace(multilineCommentsRE, '/* */')
|
|
43202
|
-
.replace(singlelineCommentsRE, '');
|
|
43228
|
+
.replace(multilineCommentsRE$1, '/* */')
|
|
43229
|
+
.replace(singlelineCommentsRE$1, '');
|
|
43203
43230
|
let js = '';
|
|
43204
43231
|
let m;
|
|
43205
43232
|
while ((m = importsRE.exec(code)) != null) {
|
|
@@ -43244,8 +43271,8 @@ function assetImportMetaUrlPlugin(config) {
|
|
|
43244
43271
|
if (code.includes('new URL') && code.includes(`import.meta.url`)) {
|
|
43245
43272
|
const importMetaUrlRE = /\bnew\s+URL\s*\(\s*('[^']+'|"[^"]+"|`[^`]+`)\s*,\s*import\.meta\.url\s*\)/g;
|
|
43246
43273
|
const noCommentsCode = code
|
|
43247
|
-
.replace(multilineCommentsRE, (m) => ' '.repeat(m.length))
|
|
43248
|
-
.replace(singlelineCommentsRE, (m) => ' '.repeat(m.length));
|
|
43274
|
+
.replace(multilineCommentsRE$1, (m) => ' '.repeat(m.length))
|
|
43275
|
+
.replace(singlelineCommentsRE$1, (m) => ' '.repeat(m.length));
|
|
43249
43276
|
let s = null;
|
|
43250
43277
|
let match;
|
|
43251
43278
|
while ((match = importMetaUrlRE.exec(noCommentsCode))) {
|
|
@@ -49533,7 +49560,7 @@ function readFileIfExists(value) {
|
|
|
49533
49560
|
* https://github.com/webpack/webpack-dev-server/blob/master/LICENSE
|
|
49534
49561
|
*/
|
|
49535
49562
|
async function createCertificate() {
|
|
49536
|
-
const { generate } = await Promise.resolve().then(function () { return require('./dep-
|
|
49563
|
+
const { generate } = await Promise.resolve().then(function () { return require('./dep-453486e7.js'); }).then(function (n) { return n.index; });
|
|
49537
49564
|
const pems = generate(null, {
|
|
49538
49565
|
algorithm: 'sha256',
|
|
49539
49566
|
days: 30,
|
|
@@ -51157,8 +51184,8 @@ class Sender$1 {
|
|
|
51157
51184
|
if (payloadLength === 126) {
|
|
51158
51185
|
target.writeUInt16BE(data.length, 2);
|
|
51159
51186
|
} else if (payloadLength === 127) {
|
|
51160
|
-
target
|
|
51161
|
-
target.
|
|
51187
|
+
target[2] = target[3] = 0;
|
|
51188
|
+
target.writeUIntBE(data.length, 4, 6);
|
|
51162
51189
|
}
|
|
51163
51190
|
|
|
51164
51191
|
if (!options.mask) return [target, data];
|
|
@@ -52027,6 +52054,7 @@ class WebSocket$1 extends EventEmitter$1 {
|
|
|
52027
52054
|
this._closeMessage = EMPTY_BUFFER;
|
|
52028
52055
|
this._closeTimer = null;
|
|
52029
52056
|
this._extensions = {};
|
|
52057
|
+
this._paused = false;
|
|
52030
52058
|
this._protocol = '';
|
|
52031
52059
|
this._readyState = WebSocket$1.CONNECTING;
|
|
52032
52060
|
this._receiver = null;
|
|
@@ -52093,6 +52121,13 @@ class WebSocket$1 extends EventEmitter$1 {
|
|
|
52093
52121
|
return Object.keys(this._extensions).join();
|
|
52094
52122
|
}
|
|
52095
52123
|
|
|
52124
|
+
/**
|
|
52125
|
+
* @type {Boolean}
|
|
52126
|
+
*/
|
|
52127
|
+
get isPaused() {
|
|
52128
|
+
return this._paused;
|
|
52129
|
+
}
|
|
52130
|
+
|
|
52096
52131
|
/**
|
|
52097
52132
|
* @type {Function}
|
|
52098
52133
|
*/
|
|
@@ -52281,6 +52316,23 @@ class WebSocket$1 extends EventEmitter$1 {
|
|
|
52281
52316
|
);
|
|
52282
52317
|
}
|
|
52283
52318
|
|
|
52319
|
+
/**
|
|
52320
|
+
* Pause the socket.
|
|
52321
|
+
*
|
|
52322
|
+
* @public
|
|
52323
|
+
*/
|
|
52324
|
+
pause() {
|
|
52325
|
+
if (
|
|
52326
|
+
this.readyState === WebSocket$1.CONNECTING ||
|
|
52327
|
+
this.readyState === WebSocket$1.CLOSED
|
|
52328
|
+
) {
|
|
52329
|
+
return;
|
|
52330
|
+
}
|
|
52331
|
+
|
|
52332
|
+
this._paused = true;
|
|
52333
|
+
this._socket.pause();
|
|
52334
|
+
}
|
|
52335
|
+
|
|
52284
52336
|
/**
|
|
52285
52337
|
* Send a ping.
|
|
52286
52338
|
*
|
|
@@ -52345,6 +52397,23 @@ class WebSocket$1 extends EventEmitter$1 {
|
|
|
52345
52397
|
this._sender.pong(data || EMPTY_BUFFER, mask, cb);
|
|
52346
52398
|
}
|
|
52347
52399
|
|
|
52400
|
+
/**
|
|
52401
|
+
* Resume the socket.
|
|
52402
|
+
*
|
|
52403
|
+
* @public
|
|
52404
|
+
*/
|
|
52405
|
+
resume() {
|
|
52406
|
+
if (
|
|
52407
|
+
this.readyState === WebSocket$1.CONNECTING ||
|
|
52408
|
+
this.readyState === WebSocket$1.CLOSED
|
|
52409
|
+
) {
|
|
52410
|
+
return;
|
|
52411
|
+
}
|
|
52412
|
+
|
|
52413
|
+
this._paused = false;
|
|
52414
|
+
if (!this._receiver._writableState.needDrain) this._socket.resume();
|
|
52415
|
+
}
|
|
52416
|
+
|
|
52348
52417
|
/**
|
|
52349
52418
|
* Send a data message.
|
|
52350
52419
|
*
|
|
@@ -52487,6 +52556,7 @@ Object.defineProperty(WebSocket$1.prototype, 'CLOSED', {
|
|
|
52487
52556
|
'binaryType',
|
|
52488
52557
|
'bufferedAmount',
|
|
52489
52558
|
'extensions',
|
|
52559
|
+
'isPaused',
|
|
52490
52560
|
'protocol',
|
|
52491
52561
|
'readyState',
|
|
52492
52562
|
'url'
|
|
@@ -52599,19 +52669,26 @@ function initAsClient(websocket, address, protocols, options) {
|
|
|
52599
52669
|
|
|
52600
52670
|
const isSecure = parsedUrl.protocol === 'wss:';
|
|
52601
52671
|
const isUnixSocket = parsedUrl.protocol === 'ws+unix:';
|
|
52672
|
+
let invalidURLMessage;
|
|
52602
52673
|
|
|
52603
52674
|
if (parsedUrl.protocol !== 'ws:' && !isSecure && !isUnixSocket) {
|
|
52604
|
-
|
|
52605
|
-
'The URL\'s protocol must be one of "ws:", "wss:", or "ws+unix:"'
|
|
52606
|
-
|
|
52675
|
+
invalidURLMessage =
|
|
52676
|
+
'The URL\'s protocol must be one of "ws:", "wss:", or "ws+unix:"';
|
|
52677
|
+
} else if (isUnixSocket && !parsedUrl.pathname) {
|
|
52678
|
+
invalidURLMessage = "The URL's pathname is empty";
|
|
52679
|
+
} else if (parsedUrl.hash) {
|
|
52680
|
+
invalidURLMessage = 'The URL contains a fragment identifier';
|
|
52607
52681
|
}
|
|
52608
52682
|
|
|
52609
|
-
if (
|
|
52610
|
-
|
|
52611
|
-
}
|
|
52683
|
+
if (invalidURLMessage) {
|
|
52684
|
+
const err = new SyntaxError(invalidURLMessage);
|
|
52612
52685
|
|
|
52613
|
-
|
|
52614
|
-
|
|
52686
|
+
if (websocket._redirects === 0) {
|
|
52687
|
+
throw err;
|
|
52688
|
+
} else {
|
|
52689
|
+
emitErrorAndClose(websocket, err);
|
|
52690
|
+
return;
|
|
52691
|
+
}
|
|
52615
52692
|
}
|
|
52616
52693
|
|
|
52617
52694
|
const defaultPort = isSecure ? 443 : 80;
|
|
@@ -52693,9 +52770,7 @@ function initAsClient(websocket, address, protocols, options) {
|
|
|
52693
52770
|
if (req === null || req.aborted) return;
|
|
52694
52771
|
|
|
52695
52772
|
req = websocket._req = null;
|
|
52696
|
-
websocket
|
|
52697
|
-
websocket.emit('error', err);
|
|
52698
|
-
websocket.emitClose();
|
|
52773
|
+
emitErrorAndClose(websocket, err);
|
|
52699
52774
|
});
|
|
52700
52775
|
|
|
52701
52776
|
req.on('response', (res) => {
|
|
@@ -52715,7 +52790,15 @@ function initAsClient(websocket, address, protocols, options) {
|
|
|
52715
52790
|
|
|
52716
52791
|
req.abort();
|
|
52717
52792
|
|
|
52718
|
-
|
|
52793
|
+
let addr;
|
|
52794
|
+
|
|
52795
|
+
try {
|
|
52796
|
+
addr = new URL$2(location, address);
|
|
52797
|
+
} catch (e) {
|
|
52798
|
+
const err = new SyntaxError(`Invalid URL: ${location}`);
|
|
52799
|
+
emitErrorAndClose(websocket, err);
|
|
52800
|
+
return;
|
|
52801
|
+
}
|
|
52719
52802
|
|
|
52720
52803
|
initAsClient(websocket, addr, protocols, options);
|
|
52721
52804
|
} else if (!websocket.emit('unexpected-response', req, res)) {
|
|
@@ -52818,6 +52901,19 @@ function initAsClient(websocket, address, protocols, options) {
|
|
|
52818
52901
|
});
|
|
52819
52902
|
}
|
|
52820
52903
|
|
|
52904
|
+
/**
|
|
52905
|
+
* Emit the `'error'` and `'close'` event.
|
|
52906
|
+
*
|
|
52907
|
+
* @param {WebSocket} websocket The WebSocket instance
|
|
52908
|
+
* @param {Error} The error to emit
|
|
52909
|
+
* @private
|
|
52910
|
+
*/
|
|
52911
|
+
function emitErrorAndClose(websocket, err) {
|
|
52912
|
+
websocket._readyState = WebSocket$1.CLOSING;
|
|
52913
|
+
websocket.emit('error', err);
|
|
52914
|
+
websocket.emitClose();
|
|
52915
|
+
}
|
|
52916
|
+
|
|
52821
52917
|
/**
|
|
52822
52918
|
* Create a `net.Socket` and initiate a connection.
|
|
52823
52919
|
*
|
|
@@ -52944,7 +53040,9 @@ function receiverOnConclude(code, reason) {
|
|
|
52944
53040
|
* @private
|
|
52945
53041
|
*/
|
|
52946
53042
|
function receiverOnDrain() {
|
|
52947
|
-
this[kWebSocket$1]
|
|
53043
|
+
const websocket = this[kWebSocket$1];
|
|
53044
|
+
|
|
53045
|
+
if (!websocket.isPaused) websocket._socket.resume();
|
|
52948
53046
|
}
|
|
52949
53047
|
|
|
52950
53048
|
/**
|
|
@@ -82457,4 +82555,4 @@ exports.send = send$1;
|
|
|
82457
82555
|
exports.sortUserPlugins = sortUserPlugins;
|
|
82458
82556
|
exports.source = source;
|
|
82459
82557
|
exports.transformWithEsbuild = transformWithEsbuild;
|
|
82460
|
-
//# sourceMappingURL=dep-
|
|
82558
|
+
//# sourceMappingURL=dep-7817f5b4.js.map
|