vite 3.0.1 → 3.0.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.
- package/dist/node/chunks/{dep-10d8d214.js → dep-1513d487.js} +57 -36
- package/dist/node/chunks/{dep-7d66befd.js → dep-3f457808.js} +1 -1
- package/dist/node/chunks/{dep-adbb28b2.js → dep-f07a4e2f.js} +1 -1
- package/dist/node/cli.js +5 -5
- package/dist/node/constants.js +1 -1
- package/dist/node/index.js +1 -1
- package/dist/node-cjs/publicUtils.cjs +1 -1
- package/package.json +4 -4
|
@@ -36137,7 +36137,7 @@ function getDepsOptimizer(config, ssr) {
|
|
|
36137
36137
|
}
|
|
36138
36138
|
async function initDepsOptimizer(config, server) {
|
|
36139
36139
|
// Non Dev SSR Optimizer
|
|
36140
|
-
const ssr = !!config.build.ssr;
|
|
36140
|
+
const ssr = config.command === 'build' && !!config.build.ssr;
|
|
36141
36141
|
if (!getDepsOptimizer(config, ssr)) {
|
|
36142
36142
|
await createDepsOptimizer(config, server);
|
|
36143
36143
|
}
|
|
@@ -36168,7 +36168,7 @@ async function initDevSsrDepsOptimizer(config, server) {
|
|
|
36168
36168
|
async function createDepsOptimizer(config, server) {
|
|
36169
36169
|
const { logger } = config;
|
|
36170
36170
|
const isBuild = config.command === 'build';
|
|
36171
|
-
const ssr = !!config.build.ssr; // safe as Dev SSR don't use this optimizer
|
|
36171
|
+
const ssr = isBuild && !!config.build.ssr; // safe as Dev SSR don't use this optimizer
|
|
36172
36172
|
const sessionTimestamp = Date.now().toString();
|
|
36173
36173
|
const cachedMetadata = loadCachedDepOptimizationMetadata(config, ssr);
|
|
36174
36174
|
let handle;
|
|
@@ -36684,7 +36684,7 @@ const jsMapExtensionRE = /\.js\.map$/i;
|
|
|
36684
36684
|
*/
|
|
36685
36685
|
async function optimizeDeps(config, force = config.optimizeDeps.force, asCommand = false) {
|
|
36686
36686
|
const log = asCommand ? config.logger.info : debug$a;
|
|
36687
|
-
const ssr = !!config.build.ssr;
|
|
36687
|
+
const ssr = config.command === 'build' && !!config.build.ssr;
|
|
36688
36688
|
const cachedMetadata = loadCachedDepOptimizationMetadata(config, ssr, force, asCommand);
|
|
36689
36689
|
if (cachedMetadata) {
|
|
36690
36690
|
return cachedMetadata;
|
|
@@ -36819,7 +36819,8 @@ function depsLogString(qualifiedIds) {
|
|
|
36819
36819
|
* Internally, Vite uses this function to prepare a optimizeDeps run. When Vite starts, we can get
|
|
36820
36820
|
* the metadata and start the server without waiting for the optimizeDeps processing to be completed
|
|
36821
36821
|
*/
|
|
36822
|
-
async function runOptimizeDeps(resolvedConfig, depsInfo, ssr =
|
|
36822
|
+
async function runOptimizeDeps(resolvedConfig, depsInfo, ssr = resolvedConfig.command === 'build' &&
|
|
36823
|
+
!!resolvedConfig.build.ssr) {
|
|
36823
36824
|
const isBuild = resolvedConfig.command === 'build';
|
|
36824
36825
|
const config = {
|
|
36825
36826
|
...resolvedConfig,
|
|
@@ -37045,7 +37046,7 @@ function newDepOptimizationProcessing() {
|
|
|
37045
37046
|
function depsFromOptimizedDepInfo(depsInfo) {
|
|
37046
37047
|
return Object.fromEntries(Object.entries(depsInfo).map((d) => [d[0], d[1].src]));
|
|
37047
37048
|
}
|
|
37048
|
-
function getOptimizedDepPath(id, config, ssr
|
|
37049
|
+
function getOptimizedDepPath(id, config, ssr) {
|
|
37049
37050
|
return normalizePath$3(path$n.resolve(getDepsCacheDir(config, ssr), flattenId(id) + '.js'));
|
|
37050
37051
|
}
|
|
37051
37052
|
function getDepsCacheSuffix(config, ssr) {
|
|
@@ -39500,32 +39501,36 @@ function serveStaticMiddleware(dir, server) {
|
|
|
39500
39501
|
isInternalRequest(req.url)) {
|
|
39501
39502
|
return next();
|
|
39502
39503
|
}
|
|
39503
|
-
const url =
|
|
39504
|
+
const url = new URL(req.url, 'http://example.com');
|
|
39505
|
+
const pathname = decodeURIComponent(url.pathname);
|
|
39504
39506
|
// apply aliases to static requests as well
|
|
39505
|
-
let
|
|
39507
|
+
let redirectedPathname;
|
|
39506
39508
|
for (const { find, replacement } of server.config.resolve.alias) {
|
|
39507
|
-
const matches = typeof find === 'string'
|
|
39509
|
+
const matches = typeof find === 'string'
|
|
39510
|
+
? pathname.startsWith(find)
|
|
39511
|
+
: find.test(pathname);
|
|
39508
39512
|
if (matches) {
|
|
39509
|
-
|
|
39513
|
+
redirectedPathname = pathname.replace(find, replacement);
|
|
39510
39514
|
break;
|
|
39511
39515
|
}
|
|
39512
39516
|
}
|
|
39513
|
-
if (
|
|
39517
|
+
if (redirectedPathname) {
|
|
39514
39518
|
// dir is pre-normalized to posix style
|
|
39515
|
-
if (
|
|
39516
|
-
|
|
39519
|
+
if (redirectedPathname.startsWith(dir)) {
|
|
39520
|
+
redirectedPathname = redirectedPathname.slice(dir.length);
|
|
39517
39521
|
}
|
|
39518
39522
|
}
|
|
39519
|
-
const
|
|
39520
|
-
let fileUrl = path$n.resolve(dir,
|
|
39521
|
-
if (
|
|
39523
|
+
const resolvedPathname = redirectedPathname || pathname;
|
|
39524
|
+
let fileUrl = path$n.resolve(dir, resolvedPathname.replace(/^\//, ''));
|
|
39525
|
+
if (resolvedPathname.endsWith('/') && !fileUrl.endsWith('/')) {
|
|
39522
39526
|
fileUrl = fileUrl + '/';
|
|
39523
39527
|
}
|
|
39524
39528
|
if (!ensureServingAccess(fileUrl, server, res, next)) {
|
|
39525
39529
|
return;
|
|
39526
39530
|
}
|
|
39527
|
-
if (
|
|
39528
|
-
|
|
39531
|
+
if (redirectedPathname) {
|
|
39532
|
+
url.pathname = encodeURIComponent(redirectedPathname);
|
|
39533
|
+
req.url = url.href.slice(url.origin.length);
|
|
39529
39534
|
}
|
|
39530
39535
|
serve(req, res, next);
|
|
39531
39536
|
};
|
|
@@ -39534,20 +39539,22 @@ function serveRawFsMiddleware(server) {
|
|
|
39534
39539
|
const serveFromRoot = sirv('/', sirvOptions(server.config.server.headers));
|
|
39535
39540
|
// Keep the named function. The name is visible in debug logs via `DEBUG=connect:dispatcher ...`
|
|
39536
39541
|
return function viteServeRawFsMiddleware(req, res, next) {
|
|
39537
|
-
|
|
39542
|
+
const url = new URL(req.url, 'http://example.com');
|
|
39538
39543
|
// In some cases (e.g. linked monorepos) files outside of root will
|
|
39539
39544
|
// reference assets that are also out of served root. In such cases
|
|
39540
39545
|
// the paths are rewritten to `/@fs/` prefixed paths and must be served by
|
|
39541
39546
|
// searching based from fs root.
|
|
39542
|
-
if (url.startsWith(FS_PREFIX)) {
|
|
39547
|
+
if (url.pathname.startsWith(FS_PREFIX)) {
|
|
39548
|
+
const pathname = decodeURIComponent(url.pathname);
|
|
39543
39549
|
// restrict files outside of `fs.allow`
|
|
39544
|
-
if (!ensureServingAccess(slash$1(path$n.resolve(fsPathFromId(
|
|
39550
|
+
if (!ensureServingAccess(slash$1(path$n.resolve(fsPathFromId(pathname))), server, res, next)) {
|
|
39545
39551
|
return;
|
|
39546
39552
|
}
|
|
39547
|
-
|
|
39553
|
+
let newPathname = pathname.slice(FS_PREFIX.length);
|
|
39548
39554
|
if (isWindows$4)
|
|
39549
|
-
|
|
39550
|
-
|
|
39555
|
+
newPathname = newPathname.replace(/^[A-Z]:/i, '');
|
|
39556
|
+
url.pathname = encodeURIComponent(newPathname);
|
|
39557
|
+
req.url = url.href.slice(url.origin.length);
|
|
39551
39558
|
serveFromRoot(req, res, next);
|
|
39552
39559
|
}
|
|
39553
39560
|
else {
|
|
@@ -41056,7 +41063,7 @@ const assetAttrsConfig = {
|
|
|
41056
41063
|
const isAsyncScriptMap = new WeakMap();
|
|
41057
41064
|
async function traverseHtml(html, filePath, visitor) {
|
|
41058
41065
|
// lazy load compiler
|
|
41059
|
-
const { parse, transform } = await import('./dep-
|
|
41066
|
+
const { parse, transform } = await import('./dep-3f457808.js').then(function (n) { return n.c; });
|
|
41060
41067
|
// @vue/compiler-core doesn't like lowercase doctypes
|
|
41061
41068
|
html = html.replace(/<!doctype\s/i, '<!DOCTYPE ');
|
|
41062
41069
|
try {
|
|
@@ -42186,7 +42193,7 @@ async function compileCSS(id, code, config, urlReplacer, atImportResolvers, serv
|
|
|
42186
42193
|
logger: config.logger
|
|
42187
42194
|
}));
|
|
42188
42195
|
if (isModule) {
|
|
42189
|
-
postcssPlugins.unshift((await import('./dep-
|
|
42196
|
+
postcssPlugins.unshift((await import('./dep-f07a4e2f.js').then(function (n) { return n.i; })).default({
|
|
42190
42197
|
...modulesOptions,
|
|
42191
42198
|
getJSON(cssFileName, _modules, outputFileName) {
|
|
42192
42199
|
modules = _modules;
|
|
@@ -50276,7 +50283,8 @@ async function instantiateModule(url, server, context = { global }, urlStack = [
|
|
|
50276
50283
|
if (dep[0] !== '.' && dep[0] !== '/') {
|
|
50277
50284
|
return nodeImport(dep, mod.file, resolveOptions);
|
|
50278
50285
|
}
|
|
50279
|
-
|
|
50286
|
+
// convert to rollup URL because `pendingImports`, `moduleGraph.urlToModuleMap` requires that
|
|
50287
|
+
dep = unwrapId(dep).replace(NULL_BYTE_PLACEHOLDER, '\0');
|
|
50280
50288
|
if (!isCircular(dep) && !pendingImports.get(dep)?.some(isCircular)) {
|
|
50281
50289
|
pendingDeps.push(dep);
|
|
50282
50290
|
if (pendingDeps.length === 1) {
|
|
@@ -53520,11 +53528,11 @@ function initAsClient(websocket, address, protocols, options) {
|
|
|
53520
53528
|
? parsedUrl.hostname.slice(1, -1)
|
|
53521
53529
|
: parsedUrl.hostname;
|
|
53522
53530
|
opts.headers = {
|
|
53531
|
+
...opts.headers,
|
|
53523
53532
|
'Sec-WebSocket-Version': opts.protocolVersion,
|
|
53524
53533
|
'Sec-WebSocket-Key': key,
|
|
53525
53534
|
Connection: 'Upgrade',
|
|
53526
|
-
Upgrade: 'websocket'
|
|
53527
|
-
...opts.headers
|
|
53535
|
+
Upgrade: 'websocket'
|
|
53528
53536
|
};
|
|
53529
53537
|
opts.path = parsedUrl.pathname + parsedUrl.search;
|
|
53530
53538
|
opts.timeout = opts.handshakeTimeout;
|
|
@@ -53578,8 +53586,11 @@ function initAsClient(websocket, address, protocols, options) {
|
|
|
53578
53586
|
|
|
53579
53587
|
if (opts.followRedirects) {
|
|
53580
53588
|
if (websocket._redirects === 0) {
|
|
53589
|
+
websocket._originalUnixSocket = isUnixSocket;
|
|
53581
53590
|
websocket._originalSecure = isSecure;
|
|
53582
|
-
websocket.
|
|
53591
|
+
websocket._originalHostOrSocketPath = isUnixSocket
|
|
53592
|
+
? opts.socketPath
|
|
53593
|
+
: parsedUrl.host;
|
|
53583
53594
|
|
|
53584
53595
|
const headers = options && options.headers;
|
|
53585
53596
|
|
|
@@ -53595,7 +53606,13 @@ function initAsClient(websocket, address, protocols, options) {
|
|
|
53595
53606
|
}
|
|
53596
53607
|
}
|
|
53597
53608
|
} else if (websocket.listenerCount('redirect') === 0) {
|
|
53598
|
-
const isSameHost =
|
|
53609
|
+
const isSameHost = isUnixSocket
|
|
53610
|
+
? websocket._originalUnixSocket
|
|
53611
|
+
? opts.socketPath === websocket._originalHostOrSocketPath
|
|
53612
|
+
: false
|
|
53613
|
+
: websocket._originalUnixSocket
|
|
53614
|
+
? false
|
|
53615
|
+
: parsedUrl.host === websocket._originalHostOrSocketPath;
|
|
53599
53616
|
|
|
53600
53617
|
if (!isSameHost || (websocket._originalSecure && !isSecure)) {
|
|
53601
53618
|
//
|
|
@@ -56970,7 +56987,7 @@ function proxyMiddleware(httpServer, options, config) {
|
|
|
56970
56987
|
timestamp: true,
|
|
56971
56988
|
error: err
|
|
56972
56989
|
});
|
|
56973
|
-
if (!res.writableEnded) {
|
|
56990
|
+
if (!res.headersSent && !res.writableEnded) {
|
|
56974
56991
|
res
|
|
56975
56992
|
.writeHead(500, {
|
|
56976
56993
|
'Content-Type': 'text/plain'
|
|
@@ -57766,10 +57783,14 @@ class ModuleGraph {
|
|
|
57766
57783
|
url = removeImportQuery(removeTimestampQuery(url));
|
|
57767
57784
|
const resolved = await this.resolveId(url, !!ssr);
|
|
57768
57785
|
const resolvedId = resolved?.id || url;
|
|
57769
|
-
|
|
57770
|
-
|
|
57771
|
-
|
|
57772
|
-
|
|
57786
|
+
if (url !== resolvedId &&
|
|
57787
|
+
!url.includes('\0') &&
|
|
57788
|
+
!url.startsWith(`virtual:`)) {
|
|
57789
|
+
const ext = extname$1(cleanUrl(resolvedId));
|
|
57790
|
+
const { pathname, search, hash } = new URL(url, 'relative://');
|
|
57791
|
+
if (ext && !pathname.endsWith(ext)) {
|
|
57792
|
+
url = pathname + ext + search + hash;
|
|
57793
|
+
}
|
|
57773
57794
|
}
|
|
57774
57795
|
return [url, resolvedId, resolved?.meta];
|
|
57775
57796
|
}
|
|
@@ -61998,7 +62019,7 @@ async function resolvePlugins(config, prePlugins, normalPlugins, postPlugins) {
|
|
|
61998
62019
|
wasmFallbackPlugin(),
|
|
61999
62020
|
definePlugin(config),
|
|
62000
62021
|
cssPostPlugin(config),
|
|
62001
|
-
config.build.ssr ? ssrRequireHookPlugin(config) : null,
|
|
62022
|
+
isBuild && config.build.ssr ? ssrRequireHookPlugin(config) : null,
|
|
62002
62023
|
isBuild && buildHtmlPlugin(config),
|
|
62003
62024
|
workerImportMetaUrlPlugin(config),
|
|
62004
62025
|
...buildPlugins.pre,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as getAugmentedNamespace, B as getDefaultExportFromCjs } from './dep-
|
|
1
|
+
import { A as getAugmentedNamespace, B as getDefaultExportFromCjs } from './dep-1513d487.js';
|
|
2
2
|
|
|
3
3
|
import { fileURLToPath as __cjs_fileURLToPath } from 'node:url';
|
|
4
4
|
import { dirname as __cjs_dirname } from 'node:path';
|
package/dist/node/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { performance } from 'node:perf_hooks';
|
|
2
2
|
import { EventEmitter } from 'events';
|
|
3
|
-
import { y as picocolors, u as createLogger, e as resolveConfig } from './chunks/dep-
|
|
3
|
+
import { y as picocolors, u as createLogger, e as resolveConfig } from './chunks/dep-1513d487.js';
|
|
4
4
|
import { VERSION } from './constants.js';
|
|
5
5
|
import 'node:fs';
|
|
6
6
|
import 'node:path';
|
|
@@ -694,7 +694,7 @@ cli
|
|
|
694
694
|
.action(async (root, options) => {
|
|
695
695
|
// output structure is preserved even after bundling so require()
|
|
696
696
|
// is ok here
|
|
697
|
-
const { createServer } = await import('./chunks/dep-
|
|
697
|
+
const { createServer } = await import('./chunks/dep-1513d487.js').then(function (n) { return n.E; });
|
|
698
698
|
try {
|
|
699
699
|
const server = await createServer({
|
|
700
700
|
root,
|
|
@@ -741,7 +741,7 @@ cli
|
|
|
741
741
|
.option('--emptyOutDir', `[boolean] force empty outDir when it's outside of root`)
|
|
742
742
|
.option('-w, --watch', `[boolean] rebuilds when modules have changed on disk`)
|
|
743
743
|
.action(async (root, options) => {
|
|
744
|
-
const { build } = await import('./chunks/dep-
|
|
744
|
+
const { build } = await import('./chunks/dep-1513d487.js').then(function (n) { return n.D; });
|
|
745
745
|
const buildOptions = cleanOptions(options);
|
|
746
746
|
try {
|
|
747
747
|
await build({
|
|
@@ -765,7 +765,7 @@ cli
|
|
|
765
765
|
.command('optimize [root]', 'pre-bundle dependencies')
|
|
766
766
|
.option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
|
|
767
767
|
.action(async (root, options) => {
|
|
768
|
-
const { optimizeDeps } = await import('./chunks/dep-
|
|
768
|
+
const { optimizeDeps } = await import('./chunks/dep-1513d487.js').then(function (n) { return n.C; });
|
|
769
769
|
try {
|
|
770
770
|
const config = await resolveConfig({
|
|
771
771
|
root,
|
|
@@ -788,7 +788,7 @@ cli
|
|
|
788
788
|
.option('--https', `[boolean] use TLS + HTTP/2`)
|
|
789
789
|
.option('--open [path]', `[boolean | string] open browser on startup`)
|
|
790
790
|
.action(async (root, options) => {
|
|
791
|
-
const { preview } = await import('./chunks/dep-
|
|
791
|
+
const { preview } = await import('./chunks/dep-1513d487.js').then(function (n) { return n.F; });
|
|
792
792
|
try {
|
|
793
793
|
const server = await preview({
|
|
794
794
|
root,
|
package/dist/node/constants.js
CHANGED
package/dist/node/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { b as build, k as createFilter, u as createLogger, c as createServer, d as defineConfig, f as formatPostcssSourceMap, h as getDepOptimizationConfig, i as isDepsOptimizerEnabled, l as loadConfigFromFile, w as loadEnv, j as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, p as preview, g as resolveBaseUrl, e as resolveConfig, x as resolveEnvPrefix, a as resolvePackageData, r as resolvePackageEntry, v as searchForWorkspaceRoot, q as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-
|
|
1
|
+
export { b as build, k as createFilter, u as createLogger, c as createServer, d as defineConfig, f as formatPostcssSourceMap, h as getDepOptimizationConfig, i as isDepsOptimizerEnabled, l as loadConfigFromFile, w as loadEnv, j as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, p as preview, g as resolveBaseUrl, e as resolveConfig, x as resolveEnvPrefix, a as resolvePackageData, r as resolvePackageEntry, v as searchForWorkspaceRoot, q as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-1513d487.js';
|
|
2
2
|
export { VERSION as version } from './constants.js';
|
|
3
3
|
export { version as esbuildVersion } from 'esbuild';
|
|
4
4
|
export { VERSION as rollupVersion } from 'rollup';
|
|
@@ -31,7 +31,7 @@ var require$$1__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$1$1);
|
|
|
31
31
|
var readline__default = /*#__PURE__*/_interopDefaultLegacy(readline);
|
|
32
32
|
var require$$2__default = /*#__PURE__*/_interopDefaultLegacy(require$$2);
|
|
33
33
|
|
|
34
|
-
var version = "3.0.
|
|
34
|
+
var version = "3.0.2";
|
|
35
35
|
|
|
36
36
|
const VERSION = version;
|
|
37
37
|
const VITE_PACKAGE_DIR = path$3.resolve(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Evan You",
|
|
@@ -68,8 +68,8 @@
|
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
70
|
"@ampproject/remapping": "^2.2.0",
|
|
71
|
-
"@babel/parser": "^7.18.
|
|
72
|
-
"@babel/types": "^7.18.
|
|
71
|
+
"@babel/parser": "^7.18.9",
|
|
72
|
+
"@babel/types": "^7.18.9",
|
|
73
73
|
"@jridgewell/trace-mapping": "^0.3.14",
|
|
74
74
|
"@rollup/plugin-alias": "^3.1.9",
|
|
75
75
|
"@rollup/plugin-commonjs": "^22.0.1",
|
|
@@ -119,7 +119,7 @@
|
|
|
119
119
|
"tslib": "^2.4.0",
|
|
120
120
|
"types": "link:./types",
|
|
121
121
|
"ufo": "^0.8.5",
|
|
122
|
-
"ws": "^8.8.
|
|
122
|
+
"ws": "^8.8.1"
|
|
123
123
|
},
|
|
124
124
|
"peerDependencies": {
|
|
125
125
|
"less": "*",
|