vite 4.0.3 → 4.0.5
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.
|
@@ -11968,7 +11968,12 @@ function copyDir(srcDir, destDir) {
|
|
|
11968
11968
|
const removeDir = isWindows$4
|
|
11969
11969
|
? promisify$4(gracefulRemoveDir)
|
|
11970
11970
|
: function removeDirSync(dir) {
|
|
11971
|
-
|
|
11971
|
+
// when removing `.vite/deps`, if it doesn't exist, nodejs may also remove
|
|
11972
|
+
// other directories within `.vite/`, including `.vite/deps_temp` (bug).
|
|
11973
|
+
// workaround by checking for directory existence before removing for now.
|
|
11974
|
+
if (fs$l.existsSync(dir)) {
|
|
11975
|
+
fs$l.rmSync(dir, { recursive: true, force: true });
|
|
11976
|
+
}
|
|
11972
11977
|
};
|
|
11973
11978
|
const renameDir = isWindows$4 ? promisify$4(gracefulRename) : fs$l.renameSync;
|
|
11974
11979
|
function ensureWatchedFile(watcher, file, root) {
|
|
@@ -12152,8 +12157,8 @@ async function resolveServerUrls(server, options, config) {
|
|
|
12152
12157
|
const base = config.rawBase === './' || config.rawBase === '' ? '/' : config.rawBase;
|
|
12153
12158
|
if (hostname.host && loopbackHosts.has(hostname.host)) {
|
|
12154
12159
|
let hostnameName = hostname.name;
|
|
12155
|
-
|
|
12156
|
-
|
|
12160
|
+
// ipv6 host
|
|
12161
|
+
if (hostnameName.includes(':')) {
|
|
12157
12162
|
hostnameName = `[${hostnameName}]`;
|
|
12158
12163
|
}
|
|
12159
12164
|
local.push(`${protocol}://${hostnameName}:${port}${base}`);
|
|
@@ -12167,7 +12172,11 @@ async function resolveServerUrls(server, options, config) {
|
|
|
12167
12172
|
// @ts-expect-error Node 18.0 - 18.3 returns number
|
|
12168
12173
|
(typeof detail.family === 'number' && detail.family === 4)))
|
|
12169
12174
|
.forEach((detail) => {
|
|
12170
|
-
|
|
12175
|
+
let host = detail.address.replace('127.0.0.1', hostname.name);
|
|
12176
|
+
// ipv6 host
|
|
12177
|
+
if (host.includes(':')) {
|
|
12178
|
+
host = `[${host}]`;
|
|
12179
|
+
}
|
|
12171
12180
|
const url = `${protocol}://${host}:${port}${base}`;
|
|
12172
12181
|
if (detail.address.includes('127.0.0.1')) {
|
|
12173
12182
|
local.push(url);
|
|
@@ -14282,6 +14291,7 @@ function lookup(extn) {
|
|
|
14282
14291
|
const assetUrlRE = /__VITE_ASSET__([a-z\d]+)__(?:\$_(.*?)__)?/g;
|
|
14283
14292
|
const rawRE = /(?:\?|&)raw(?:&|$)/;
|
|
14284
14293
|
const urlRE = /(\?|&)url(?:&|$)/;
|
|
14294
|
+
const jsSourceMapRE = /\.[cm]?js\.map$/;
|
|
14285
14295
|
const assetCache = new WeakMap();
|
|
14286
14296
|
const generatedAssets = new WeakMap();
|
|
14287
14297
|
// add own dictionary entry by directly assigning mrmime
|
|
@@ -14390,7 +14400,8 @@ function assetPlugin(config) {
|
|
|
14390
14400
|
if (config.command === 'build' && config.build.ssr) {
|
|
14391
14401
|
for (const file in bundle) {
|
|
14392
14402
|
if (bundle[file].type === 'asset' &&
|
|
14393
|
-
!file.
|
|
14403
|
+
!file.endsWith('ssr-manifest.json') &&
|
|
14404
|
+
!jsSourceMapRE.test(file)) {
|
|
14394
14405
|
delete bundle[file];
|
|
14395
14406
|
}
|
|
14396
14407
|
}
|
|
@@ -14405,6 +14416,10 @@ function checkPublicFile(url, { publicDir }) {
|
|
|
14405
14416
|
return;
|
|
14406
14417
|
}
|
|
14407
14418
|
const publicFile = path$o.join(publicDir, cleanUrl(url));
|
|
14419
|
+
if (!publicFile.startsWith(publicDir)) {
|
|
14420
|
+
// can happen if URL starts with '../'
|
|
14421
|
+
return;
|
|
14422
|
+
}
|
|
14408
14423
|
if (fs$l.existsSync(publicFile)) {
|
|
14409
14424
|
return publicFile;
|
|
14410
14425
|
}
|
|
@@ -35157,6 +35172,8 @@ const inlineImportRE = /(?<!(?<!\.\.)\.)\bimport\s*\(("(?:[^"]|(?<=\\)")*"|'(?:[
|
|
|
35157
35172
|
const htmlLangRE = /\.(?:html|htm)$/;
|
|
35158
35173
|
const importMapRE = /[ \t]*<script[^>]*type\s*=\s*(?:"importmap"|'importmap'|importmap)[^>]*>.*?<\/script>/is;
|
|
35159
35174
|
const moduleScriptRE = /[ \t]*<script[^>]*type\s*=\s*(?:"module"|'module'|module)[^>]*>/i;
|
|
35175
|
+
const modulePreloadLinkRE = /[ \t]*<link[^>]*rel\s*=\s*(?:"modulepreload"|'modulepreload'|modulepreload)[\s\S]*?\/>/i;
|
|
35176
|
+
const importMapAppendRE = new RegExp([moduleScriptRE, modulePreloadLinkRE].map((r) => r.source).join('|'), 'i');
|
|
35160
35177
|
const isHTMLProxy = (id) => htmlProxyRE$1.test(id);
|
|
35161
35178
|
const isHTMLRequest = (request) => htmlLangRE.test(request);
|
|
35162
35179
|
// HTML Proxy Caches are stored by config -> filePath -> index
|
|
@@ -35719,21 +35736,21 @@ function preImportMapHook(config) {
|
|
|
35719
35736
|
const importMapIndex = html.match(importMapRE)?.index;
|
|
35720
35737
|
if (importMapIndex === undefined)
|
|
35721
35738
|
return;
|
|
35722
|
-
const
|
|
35723
|
-
if (
|
|
35739
|
+
const importMapAppendIndex = html.match(importMapAppendRE)?.index;
|
|
35740
|
+
if (importMapAppendIndex === undefined)
|
|
35724
35741
|
return;
|
|
35725
|
-
if (
|
|
35742
|
+
if (importMapAppendIndex < importMapIndex) {
|
|
35726
35743
|
const relativeHtml = normalizePath$3(path$o.relative(config.root, ctx.filename));
|
|
35727
|
-
config.logger.warnOnce(picocolorsExports.yellow(picocolorsExports.bold(`(!) <script type="importmap"> should come before <script type="module"> in /${relativeHtml}`)));
|
|
35744
|
+
config.logger.warnOnce(picocolorsExports.yellow(picocolorsExports.bold(`(!) <script type="importmap"> should come before <script type="module"> and <link rel="modulepreload"> in /${relativeHtml}`)));
|
|
35728
35745
|
}
|
|
35729
35746
|
};
|
|
35730
35747
|
}
|
|
35731
35748
|
/**
|
|
35732
|
-
* Move importmap before the first module script
|
|
35749
|
+
* Move importmap before the first module script and modulepreload link
|
|
35733
35750
|
*/
|
|
35734
35751
|
function postImportMapHook() {
|
|
35735
35752
|
return (html) => {
|
|
35736
|
-
if (!
|
|
35753
|
+
if (!importMapAppendRE.test(html))
|
|
35737
35754
|
return;
|
|
35738
35755
|
let importMap;
|
|
35739
35756
|
html = html.replace(importMapRE, (match) => {
|
|
@@ -35741,7 +35758,7 @@ function postImportMapHook() {
|
|
|
35741
35758
|
return '';
|
|
35742
35759
|
});
|
|
35743
35760
|
if (importMap) {
|
|
35744
|
-
html = html.replace(
|
|
35761
|
+
html = html.replace(importMapAppendRE, (match) => `${importMap}\n${match}`);
|
|
35745
35762
|
}
|
|
35746
35763
|
return html;
|
|
35747
35764
|
};
|
|
@@ -36297,6 +36314,15 @@ function cssPostPlugin(config) {
|
|
|
36297
36314
|
}
|
|
36298
36315
|
return null;
|
|
36299
36316
|
},
|
|
36317
|
+
augmentChunkHash(chunk) {
|
|
36318
|
+
if (chunk.viteMetadata?.importedCss.size) {
|
|
36319
|
+
let hash = '';
|
|
36320
|
+
for (const id of chunk.viteMetadata.importedCss) {
|
|
36321
|
+
hash += id;
|
|
36322
|
+
}
|
|
36323
|
+
return hash;
|
|
36324
|
+
}
|
|
36325
|
+
},
|
|
36300
36326
|
async generateBundle(opts, bundle) {
|
|
36301
36327
|
// @ts-expect-error asset emits are skipped in legacy bundle
|
|
36302
36328
|
if (opts.__vite_skip_asset_emit__) {
|
|
@@ -36500,7 +36526,7 @@ async function compileCSS(id, code, config, urlReplacer) {
|
|
|
36500
36526
|
}));
|
|
36501
36527
|
}
|
|
36502
36528
|
if (isModule) {
|
|
36503
|
-
postcssPlugins.unshift((await import('./dep-
|
|
36529
|
+
postcssPlugins.unshift((await import('./dep-cf26f61d.js').then(function (n) { return n.i; })).default({
|
|
36504
36530
|
...modulesOptions,
|
|
36505
36531
|
localsConvention: modulesOptions?.localsConvention,
|
|
36506
36532
|
getJSON(cssFileName, _modules, outputFileName) {
|
|
@@ -39010,7 +39036,7 @@ function serveStaticMiddleware(dir, server) {
|
|
|
39010
39036
|
isInternalRequest(req.url)) {
|
|
39011
39037
|
return next();
|
|
39012
39038
|
}
|
|
39013
|
-
const url = new URL(req.url, 'http://example.com');
|
|
39039
|
+
const url = new URL(req.url.replace(/^\/+/, '/'), 'http://example.com');
|
|
39014
39040
|
const pathname = decodeURIComponent(url.pathname);
|
|
39015
39041
|
// apply aliases to static requests as well
|
|
39016
39042
|
let redirectedPathname;
|
|
@@ -39048,7 +39074,7 @@ function serveRawFsMiddleware(server) {
|
|
|
39048
39074
|
const serveFromRoot = sirv('/', sirvOptions({ headers: server.config.server.headers }));
|
|
39049
39075
|
// Keep the named function. The name is visible in debug logs via `DEBUG=connect:dispatcher ...`
|
|
39050
39076
|
return function viteServeRawFsMiddleware(req, res, next) {
|
|
39051
|
-
const url = new URL(req.url, 'http://example.com');
|
|
39077
|
+
const url = new URL(req.url.replace(/^\/+/, '/'), 'http://example.com');
|
|
39052
39078
|
// In some cases (e.g. linked monorepos) files outside of root will
|
|
39053
39079
|
// reference assets that are also out of served root. In such cases
|
|
39054
39080
|
// the paths are rewritten to `/@fs/` prefixed paths and must be served by
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import require$$0__default from 'fs';
|
|
2
2
|
import require$$0 from 'postcss';
|
|
3
|
-
import { C as commonjsGlobal } from './dep-
|
|
3
|
+
import { C as commonjsGlobal } from './dep-9cd3c8cb.js';
|
|
4
4
|
import require$$0$1 from 'path';
|
|
5
5
|
import require$$5 from 'crypto';
|
|
6
6
|
import require$$0$2 from 'util';
|
package/dist/node/cli.js
CHANGED
|
@@ -2,7 +2,7 @@ import path from 'node:path';
|
|
|
2
2
|
import fs from 'node:fs';
|
|
3
3
|
import { performance } from 'node:perf_hooks';
|
|
4
4
|
import { EventEmitter } from 'events';
|
|
5
|
-
import { A as picocolorsExports, B as bindShortcuts, w as createLogger, h as resolveConfig } from './chunks/dep-
|
|
5
|
+
import { A as picocolorsExports, B as bindShortcuts, w as createLogger, h as resolveConfig } from './chunks/dep-9cd3c8cb.js';
|
|
6
6
|
import { VERSION } from './constants.js';
|
|
7
7
|
import 'node:url';
|
|
8
8
|
import 'node:module';
|
|
@@ -724,7 +724,7 @@ cli
|
|
|
724
724
|
filterDuplicateOptions(options);
|
|
725
725
|
// output structure is preserved even after bundling so require()
|
|
726
726
|
// is ok here
|
|
727
|
-
const { createServer } = await import('./chunks/dep-
|
|
727
|
+
const { createServer } = await import('./chunks/dep-9cd3c8cb.js').then(function (n) { return n.F; });
|
|
728
728
|
try {
|
|
729
729
|
const server = await createServer({
|
|
730
730
|
root,
|
|
@@ -802,7 +802,7 @@ cli
|
|
|
802
802
|
.option('-w, --watch', `[boolean] rebuilds when modules have changed on disk`)
|
|
803
803
|
.action(async (root, options) => {
|
|
804
804
|
filterDuplicateOptions(options);
|
|
805
|
-
const { build } = await import('./chunks/dep-
|
|
805
|
+
const { build } = await import('./chunks/dep-9cd3c8cb.js').then(function (n) { return n.E; });
|
|
806
806
|
const buildOptions = cleanOptions(options);
|
|
807
807
|
try {
|
|
808
808
|
await build({
|
|
@@ -830,7 +830,7 @@ cli
|
|
|
830
830
|
.option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
|
|
831
831
|
.action(async (root, options) => {
|
|
832
832
|
filterDuplicateOptions(options);
|
|
833
|
-
const { optimizeDeps } = await import('./chunks/dep-
|
|
833
|
+
const { optimizeDeps } = await import('./chunks/dep-9cd3c8cb.js').then(function (n) { return n.D; });
|
|
834
834
|
try {
|
|
835
835
|
const config = await resolveConfig({
|
|
836
836
|
root,
|
|
@@ -855,7 +855,7 @@ cli
|
|
|
855
855
|
.option('--outDir <dir>', `[string] output directory (default: dist)`)
|
|
856
856
|
.action(async (root, options) => {
|
|
857
857
|
filterDuplicateOptions(options);
|
|
858
|
-
const { preview } = await import('./chunks/dep-
|
|
858
|
+
const { preview } = await import('./chunks/dep-9cd3c8cb.js').then(function (n) { return n.G; });
|
|
859
859
|
try {
|
|
860
860
|
const server = await preview({
|
|
861
861
|
root,
|
package/dist/node/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { b as build, e as buildErrorMessage, u as createFilter, w as createLogger, c as createServer, g as defineConfig, f as formatPostcssSourceMap, j as getDepOptimizationConfig, k as isDepsOptimizerEnabled, l as loadConfigFromFile, y as loadEnv, q as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, a as preprocessCSS, p as preview, i as resolveBaseUrl, h as resolveConfig, z as resolveEnvPrefix, d as resolvePackageData, r as resolvePackageEntry, x as searchForWorkspaceRoot, v as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-
|
|
1
|
+
export { b as build, e as buildErrorMessage, u as createFilter, w as createLogger, c as createServer, g as defineConfig, f as formatPostcssSourceMap, j as getDepOptimizationConfig, k as isDepsOptimizerEnabled, l as loadConfigFromFile, y as loadEnv, q as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, a as preprocessCSS, p as preview, i as resolveBaseUrl, h as resolveConfig, z as resolveEnvPrefix, d as resolvePackageData, r as resolvePackageEntry, x as searchForWorkspaceRoot, v as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-9cd3c8cb.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';
|
|
@@ -3478,7 +3478,12 @@ function isFileReadable(filename) {
|
|
|
3478
3478
|
isWindows
|
|
3479
3479
|
? node_util.promisify(gracefulRemoveDir)
|
|
3480
3480
|
: function removeDirSync(dir) {
|
|
3481
|
-
|
|
3481
|
+
// when removing `.vite/deps`, if it doesn't exist, nodejs may also remove
|
|
3482
|
+
// other directories within `.vite/`, including `.vite/deps_temp` (bug).
|
|
3483
|
+
// workaround by checking for directory existence before removing for now.
|
|
3484
|
+
if (fs$1.existsSync(dir)) {
|
|
3485
|
+
fs$1.rmSync(dir, { recursive: true, force: true });
|
|
3486
|
+
}
|
|
3482
3487
|
};
|
|
3483
3488
|
isWindows ? node_util.promisify(gracefulRename) : fs$1.renameSync;
|
|
3484
3489
|
function arraify(target) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Evan You",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"@rollup/plugin-alias": "^4.0.2",
|
|
76
76
|
"@rollup/plugin-commonjs": "^24.0.0",
|
|
77
77
|
"@rollup/plugin-dynamic-import-vars": "^2.0.1",
|
|
78
|
-
"@rollup/plugin-json": "^
|
|
78
|
+
"@rollup/plugin-json": "^6.0.0",
|
|
79
79
|
"@rollup/plugin-node-resolve": "15.0.1",
|
|
80
80
|
"@rollup/plugin-typescript": "^10.0.1",
|
|
81
81
|
"@rollup/pluginutils": "^5.0.2",
|