vite 4.0.0-alpha.4 → 4.0.0-alpha.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.
- package/LICENSE.md +1 -8
- package/dist/client/client.mjs +4 -3
- package/dist/client/client.mjs.map +1 -1
- package/dist/node/chunks/{dep-adb60dd8.js → dep-31fe3c68.js} +228 -116
- package/dist/node/chunks/{dep-2ed340b5.js → dep-72c42a3f.js} +5438 -5403
- package/dist/node/chunks/{dep-b73c4a2f.js → dep-fadb3c21.js} +82 -81
- package/dist/node/cli.js +5 -5
- package/dist/node/index.js +1 -1
- package/package.json +5 -5
- package/types/customEvent.d.ts +1 -0
- package/types/hot.d.ts +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import fs$l, { promises as promises$2 } from 'node:fs';
|
|
2
2
|
import path$o, { posix as posix$1, isAbsolute as isAbsolute$2, join as join$2, relative as relative$2, dirname as dirname$2, basename as basename$2, extname as extname$1 } from 'node:path';
|
|
3
|
-
import { URL as URL$3, URLSearchParams, parse as parse$j, pathToFileURL
|
|
3
|
+
import { URL as URL$3, URLSearchParams, parse as parse$j, pathToFileURL } from 'node:url';
|
|
4
4
|
import { performance } from 'node:perf_hooks';
|
|
5
5
|
import { createRequire as createRequire$1, builtinModules } from 'node:module';
|
|
6
6
|
import require$$0$3 from 'tty';
|
|
@@ -12,7 +12,7 @@ import require$$0$5 from 'events';
|
|
|
12
12
|
import assert$1 from 'assert';
|
|
13
13
|
import require$$0$6, { format as format$2, inspect } from 'util';
|
|
14
14
|
import require$$3$1 from 'net';
|
|
15
|
-
import require$$0$9
|
|
15
|
+
import require$$0$9 from 'url';
|
|
16
16
|
import require$$1$1 from 'http';
|
|
17
17
|
import require$$0$7 from 'stream';
|
|
18
18
|
import require$$2 from 'os';
|
|
@@ -12672,21 +12672,21 @@ function buildReporterPlugin(config) {
|
|
|
12672
12672
|
const chunkLimit = config.build.chunkSizeWarningLimit;
|
|
12673
12673
|
function isLarge(code) {
|
|
12674
12674
|
// bail out on particularly large chunks
|
|
12675
|
-
return code.length /
|
|
12675
|
+
return code.length / 1000 > chunkLimit;
|
|
12676
12676
|
}
|
|
12677
12677
|
async function getCompressedSize(code) {
|
|
12678
12678
|
if (config.build.ssr || !config.build.reportCompressedSize) {
|
|
12679
12679
|
return '';
|
|
12680
12680
|
}
|
|
12681
|
-
return ` / gzip: ${((await compress(typeof code === 'string' ? code : Buffer.from(code)))
|
|
12682
|
-
.length /
|
|
12681
|
+
return ` / gzip: ${displaySize((await compress(typeof code === 'string' ? code : Buffer.from(code)))
|
|
12682
|
+
.length / 1000)}`;
|
|
12683
12683
|
}
|
|
12684
12684
|
function printFileInfo(filePath, content, type, maxLength, outDir = config.build.outDir, compressedSize = '') {
|
|
12685
12685
|
outDir =
|
|
12686
12686
|
normalizePath$3(path$o.relative(config.root, path$o.resolve(config.root, outDir))) + '/';
|
|
12687
|
-
const
|
|
12688
|
-
const sizeColor =
|
|
12689
|
-
config.logger.info(`${picocolors.exports.gray(picocolors.exports.white(picocolors.exports.dim(outDir)))}${writeColors[type](filePath.padEnd(maxLength + 2))} ${sizeColor(`${
|
|
12687
|
+
const kB = content.length / 1000;
|
|
12688
|
+
const sizeColor = kB > chunkLimit ? picocolors.exports.yellow : picocolors.exports.dim;
|
|
12689
|
+
config.logger.info(`${picocolors.exports.gray(picocolors.exports.white(picocolors.exports.dim(outDir)))}${writeColors[type](filePath.padEnd(maxLength + 2))} ${sizeColor(`${displaySize(kB)}${compressedSize}`)}`);
|
|
12690
12690
|
}
|
|
12691
12691
|
const tty = process.stdout.isTTY && !process.env.CI;
|
|
12692
12692
|
const shouldLogInfo = LogLevels[config.logLevel || 'info'] >= LogLevels.info;
|
|
@@ -12793,14 +12793,14 @@ function buildReporterPlugin(config) {
|
|
|
12793
12793
|
else {
|
|
12794
12794
|
hasLargeChunks = Object.keys(output).some((file) => {
|
|
12795
12795
|
const chunk = output[file];
|
|
12796
|
-
return chunk.type === 'chunk' && chunk.code.length /
|
|
12796
|
+
return chunk.type === 'chunk' && chunk.code.length / 1000 > chunkLimit;
|
|
12797
12797
|
});
|
|
12798
12798
|
}
|
|
12799
12799
|
if (hasLargeChunks &&
|
|
12800
12800
|
config.build.minify &&
|
|
12801
12801
|
!config.build.lib &&
|
|
12802
12802
|
!config.build.ssr) {
|
|
12803
|
-
config.logger.warn(picocolors.exports.yellow(`\n(!) Some chunks are larger than ${chunkLimit}
|
|
12803
|
+
config.logger.warn(picocolors.exports.yellow(`\n(!) Some chunks are larger than ${chunkLimit} kBs after minification. Consider:\n` +
|
|
12804
12804
|
`- Using dynamic import() to code-split the application\n` +
|
|
12805
12805
|
`- Use build.rollupOptions.output.manualChunks to improve chunking: https://rollupjs.org/guide/en/#outputmanualchunks\n` +
|
|
12806
12806
|
`- Adjust chunk size limit for this warning via build.chunkSizeWarningLimit.`));
|
|
@@ -12829,6 +12829,12 @@ function throttle(fn) {
|
|
|
12829
12829
|
}, 100);
|
|
12830
12830
|
};
|
|
12831
12831
|
}
|
|
12832
|
+
function displaySize(kB) {
|
|
12833
|
+
return `${kB.toLocaleString('en', {
|
|
12834
|
+
maximumFractionDigits: 2,
|
|
12835
|
+
minimumFractionDigits: 2
|
|
12836
|
+
})} kB`;
|
|
12837
|
+
}
|
|
12832
12838
|
|
|
12833
12839
|
var __defProp = Object.defineProperty;
|
|
12834
12840
|
var __defProps = Object.defineProperties;
|
|
@@ -20458,43 +20464,6 @@ var acorn = {
|
|
|
20458
20464
|
version: version
|
|
20459
20465
|
};
|
|
20460
20466
|
|
|
20461
|
-
const HASH_RE = /#/g;
|
|
20462
|
-
const AMPERSAND_RE = /&/g;
|
|
20463
|
-
const EQUAL_RE = /=/g;
|
|
20464
|
-
const PLUS_RE = /\+/g;
|
|
20465
|
-
const ENC_BRACKET_OPEN_RE = /%5B/gi;
|
|
20466
|
-
const ENC_BRACKET_CLOSE_RE = /%5D/gi;
|
|
20467
|
-
const ENC_CARET_RE = /%5E/gi;
|
|
20468
|
-
const ENC_BACKTICK_RE = /%60/gi;
|
|
20469
|
-
const ENC_CURLY_OPEN_RE = /%7B/gi;
|
|
20470
|
-
const ENC_PIPE_RE = /%7C/gi;
|
|
20471
|
-
const ENC_CURLY_CLOSE_RE = /%7D/gi;
|
|
20472
|
-
const ENC_SPACE_RE = /%20/gi;
|
|
20473
|
-
function encode(text) {
|
|
20474
|
-
return encodeURI("" + text).replace(ENC_PIPE_RE, "|").replace(ENC_BRACKET_OPEN_RE, "[").replace(ENC_BRACKET_CLOSE_RE, "]");
|
|
20475
|
-
}
|
|
20476
|
-
function encodeQueryValue(text) {
|
|
20477
|
-
return encode(text).replace(PLUS_RE, "%2B").replace(ENC_SPACE_RE, "+").replace(HASH_RE, "%23").replace(AMPERSAND_RE, "%26").replace(ENC_BACKTICK_RE, "`").replace(ENC_CURLY_OPEN_RE, "{").replace(ENC_CURLY_CLOSE_RE, "}").replace(ENC_CARET_RE, "^");
|
|
20478
|
-
}
|
|
20479
|
-
function encodeQueryKey(text) {
|
|
20480
|
-
return encodeQueryValue(text).replace(EQUAL_RE, "%3D");
|
|
20481
|
-
}
|
|
20482
|
-
function encodeQueryItem(key, val) {
|
|
20483
|
-
if (typeof val === "number" || typeof val === "boolean") {
|
|
20484
|
-
val = String(val);
|
|
20485
|
-
}
|
|
20486
|
-
if (!val) {
|
|
20487
|
-
return encodeQueryKey(key);
|
|
20488
|
-
}
|
|
20489
|
-
if (Array.isArray(val)) {
|
|
20490
|
-
return val.map((_val) => `${encodeQueryKey(key)}=${encodeQueryValue(_val)}`).join("&");
|
|
20491
|
-
}
|
|
20492
|
-
return `${encodeQueryKey(key)}=${encodeQueryValue(val)}`;
|
|
20493
|
-
}
|
|
20494
|
-
function stringifyQuery(query) {
|
|
20495
|
-
return Object.keys(query).map((k) => encodeQueryItem(k, query[k])).join("&");
|
|
20496
|
-
}
|
|
20497
|
-
|
|
20498
20467
|
function matchAll(regex, string, addition) {
|
|
20499
20468
|
const matches = [];
|
|
20500
20469
|
for (const match of string.matchAll(regex)) {
|
|
@@ -20700,22 +20669,22 @@ function getMessage(key, args, self) {
|
|
|
20700
20669
|
Object.freeze(["node", "import"]);
|
|
20701
20670
|
pathToFileURL(process.cwd());
|
|
20702
20671
|
|
|
20703
|
-
const ESM_STATIC_IMPORT_RE = /(?<=\s|^|;)import\s*(["'
|
|
20672
|
+
const ESM_STATIC_IMPORT_RE = /(?<=\s|^|;)import\s*([\s"']*(?<imports>[\w\t\n\r $*,/{}]+)from\s*)?["']\s*(?<specifier>(?<="\s*)[^"]*[^\s"](?=\s*")|(?<='\s*)[^']*[^\s'](?=\s*'))\s*["'][\s;]*/gm;
|
|
20704
20673
|
function findStaticImports(code) {
|
|
20705
20674
|
return matchAll(ESM_STATIC_IMPORT_RE, code, { type: "static" });
|
|
20706
20675
|
}
|
|
20707
20676
|
function parseStaticImport(matched) {
|
|
20708
20677
|
const cleanedImports = (matched.imports || "").replace(/(\/\/[^\n]*\n|\/\*.*\*\/)/g, "").replace(/\s+/g, " ");
|
|
20709
20678
|
const namedImports = {};
|
|
20710
|
-
for (const namedImport of cleanedImports.match(
|
|
20711
|
-
const [, source = namedImport.trim(), importName = source] = namedImport.match(/^\s*(
|
|
20679
|
+
for (const namedImport of cleanedImports.match(/{([^}]*)}/)?.[1]?.split(",") || []) {
|
|
20680
|
+
const [, source = namedImport.trim(), importName = source] = namedImport.match(/^\s*(\S*) as (\S*)\s*$/) || [];
|
|
20712
20681
|
if (source) {
|
|
20713
20682
|
namedImports[source] = importName;
|
|
20714
20683
|
}
|
|
20715
20684
|
}
|
|
20716
|
-
const topLevelImports = cleanedImports.replace(
|
|
20717
|
-
const namespacedImport = topLevelImports.match(/\* as \s*(
|
|
20718
|
-
const defaultImport = topLevelImports.split(",").find((
|
|
20685
|
+
const topLevelImports = cleanedImports.replace(/{([^}]*)}/, "");
|
|
20686
|
+
const namespacedImport = topLevelImports.match(/\* as \s*(\S*)/)?.[1];
|
|
20687
|
+
const defaultImport = topLevelImports.split(",").find((index) => !/[*{}]/.test(index))?.trim() || void 0;
|
|
20719
20688
|
return {
|
|
20720
20689
|
...matched,
|
|
20721
20690
|
defaultImport,
|
|
@@ -20724,7 +20693,7 @@ function parseStaticImport(matched) {
|
|
|
20724
20693
|
};
|
|
20725
20694
|
}
|
|
20726
20695
|
|
|
20727
|
-
const ESM_RE = /([\s;]|^)(import[\w
|
|
20696
|
+
const ESM_RE = /([\s;]|^)(import[\s\w*,{}]*from|import\s*["'*{]|export\b\s*(?:[*{]|default|class|type|function|const|var|let|async function)|import\.meta\b)/m;
|
|
20728
20697
|
function hasESMSyntax(code) {
|
|
20729
20698
|
return ESM_RE.test(code);
|
|
20730
20699
|
}
|
|
@@ -35191,7 +35160,7 @@ function traverseNodes(node, visitor) {
|
|
|
35191
35160
|
}
|
|
35192
35161
|
async function traverseHtml(html, filePath, visitor) {
|
|
35193
35162
|
// lazy load compiler
|
|
35194
|
-
const { parse } = await import('./dep-
|
|
35163
|
+
const { parse } = await import('./dep-31fe3c68.js');
|
|
35195
35164
|
const ast = parse(html, {
|
|
35196
35165
|
sourceCodeLocationInfo: true,
|
|
35197
35166
|
onParseError: (e) => {
|
|
@@ -36452,7 +36421,7 @@ async function compileCSS(id, code, config, urlReplacer) {
|
|
|
36452
36421
|
}));
|
|
36453
36422
|
}
|
|
36454
36423
|
if (isModule) {
|
|
36455
|
-
postcssPlugins.unshift((await import('./dep-
|
|
36424
|
+
postcssPlugins.unshift((await import('./dep-72c42a3f.js').then(function (n) { return n.i; })).default({
|
|
36456
36425
|
...modulesOptions,
|
|
36457
36426
|
localsConvention: modulesOptions?.localsConvention,
|
|
36458
36427
|
getJSON(cssFileName, _modules, outputFileName) {
|
|
@@ -36461,9 +36430,9 @@ async function compileCSS(id, code, config, urlReplacer) {
|
|
|
36461
36430
|
modulesOptions.getJSON(cssFileName, _modules, outputFileName);
|
|
36462
36431
|
}
|
|
36463
36432
|
},
|
|
36464
|
-
async resolve(id) {
|
|
36433
|
+
async resolve(id, importer) {
|
|
36465
36434
|
for (const key of getCssResolversKeys(atImportResolvers)) {
|
|
36466
|
-
const resolved = await atImportResolvers[key](id);
|
|
36435
|
+
const resolved = await atImportResolvers[key](id, importer);
|
|
36467
36436
|
if (resolved) {
|
|
36468
36437
|
return path$o.resolve(resolved);
|
|
36469
36438
|
}
|
|
@@ -37154,6 +37123,43 @@ function getCssDialect(lang) {
|
|
|
37154
37123
|
return lang === 'sss' ? 'sss' : 'css';
|
|
37155
37124
|
}
|
|
37156
37125
|
|
|
37126
|
+
const HASH_RE = /#/g;
|
|
37127
|
+
const AMPERSAND_RE = /&/g;
|
|
37128
|
+
const EQUAL_RE = /=/g;
|
|
37129
|
+
const PLUS_RE = /\+/g;
|
|
37130
|
+
const ENC_BRACKET_OPEN_RE = /%5B/gi;
|
|
37131
|
+
const ENC_BRACKET_CLOSE_RE = /%5D/gi;
|
|
37132
|
+
const ENC_CARET_RE = /%5E/gi;
|
|
37133
|
+
const ENC_BACKTICK_RE = /%60/gi;
|
|
37134
|
+
const ENC_CURLY_OPEN_RE = /%7B/gi;
|
|
37135
|
+
const ENC_PIPE_RE = /%7C/gi;
|
|
37136
|
+
const ENC_CURLY_CLOSE_RE = /%7D/gi;
|
|
37137
|
+
const ENC_SPACE_RE = /%20/gi;
|
|
37138
|
+
function encode(text) {
|
|
37139
|
+
return encodeURI("" + text).replace(ENC_PIPE_RE, "|").replace(ENC_BRACKET_OPEN_RE, "[").replace(ENC_BRACKET_CLOSE_RE, "]");
|
|
37140
|
+
}
|
|
37141
|
+
function encodeQueryValue(text) {
|
|
37142
|
+
return encode(text).replace(PLUS_RE, "%2B").replace(ENC_SPACE_RE, "+").replace(HASH_RE, "%23").replace(AMPERSAND_RE, "%26").replace(ENC_BACKTICK_RE, "`").replace(ENC_CURLY_OPEN_RE, "{").replace(ENC_CURLY_CLOSE_RE, "}").replace(ENC_CARET_RE, "^");
|
|
37143
|
+
}
|
|
37144
|
+
function encodeQueryKey(text) {
|
|
37145
|
+
return encodeQueryValue(text).replace(EQUAL_RE, "%3D");
|
|
37146
|
+
}
|
|
37147
|
+
function encodeQueryItem(key, val) {
|
|
37148
|
+
if (typeof val === "number" || typeof val === "boolean") {
|
|
37149
|
+
val = String(val);
|
|
37150
|
+
}
|
|
37151
|
+
if (!val) {
|
|
37152
|
+
return encodeQueryKey(key);
|
|
37153
|
+
}
|
|
37154
|
+
if (Array.isArray(val)) {
|
|
37155
|
+
return val.map((_val) => `${encodeQueryKey(key)}=${encodeQueryValue(_val)}`).join("&");
|
|
37156
|
+
}
|
|
37157
|
+
return `${encodeQueryKey(key)}=${encodeQueryValue(val)}`;
|
|
37158
|
+
}
|
|
37159
|
+
function stringifyQuery(query) {
|
|
37160
|
+
return Object.keys(query).map((k) => encodeQueryItem(k, query[k])).join("&");
|
|
37161
|
+
}
|
|
37162
|
+
|
|
37157
37163
|
const { isMatch: isMatch$1, scan } = micromatch_1;
|
|
37158
37164
|
function getAffectedGlobModules(file, server) {
|
|
37159
37165
|
const modules = [];
|
|
@@ -37617,7 +37623,7 @@ async function handleHMRUpdate(file, server) {
|
|
|
37617
37623
|
}
|
|
37618
37624
|
updateModules(shortFile, hmrContext.modules, timestamp, server);
|
|
37619
37625
|
}
|
|
37620
|
-
function updateModules(file, modules, timestamp, { config, ws }) {
|
|
37626
|
+
function updateModules(file, modules, timestamp, { config, ws }, afterInvalidation) {
|
|
37621
37627
|
const updates = [];
|
|
37622
37628
|
const invalidatedModules = new Set();
|
|
37623
37629
|
let needFullReload = false;
|
|
@@ -37644,7 +37650,7 @@ function updateModules(file, modules, timestamp, { config, ws }) {
|
|
|
37644
37650
|
}
|
|
37645
37651
|
if (needFullReload) {
|
|
37646
37652
|
config.logger.info(picocolors.exports.green(`page reload `) + picocolors.exports.dim(file), {
|
|
37647
|
-
clear:
|
|
37653
|
+
clear: !afterInvalidation,
|
|
37648
37654
|
timestamp: true
|
|
37649
37655
|
});
|
|
37650
37656
|
ws.send({
|
|
@@ -37657,7 +37663,7 @@ function updateModules(file, modules, timestamp, { config, ws }) {
|
|
|
37657
37663
|
return;
|
|
37658
37664
|
}
|
|
37659
37665
|
config.logger.info(picocolors.exports.green(`hmr update `) +
|
|
37660
|
-
picocolors.exports.dim([...new Set(updates.map((u) => u.path))].join(', ')), { clear:
|
|
37666
|
+
picocolors.exports.dim([...new Set(updates.map((u) => u.path))].join(', ')), { clear: !afterInvalidation, timestamp: true });
|
|
37661
37667
|
ws.send({
|
|
37662
37668
|
type: 'update',
|
|
37663
37669
|
updates
|
|
@@ -52947,7 +52953,7 @@ async function instantiateModule(url, server, context = { global }, urlStack = [
|
|
|
52947
52953
|
mod.ssrModule = ssrModule;
|
|
52948
52954
|
const ssrImportMeta = {
|
|
52949
52955
|
// The filesystem URL, matching native Node.js modules
|
|
52950
|
-
url: pathToFileURL
|
|
52956
|
+
url: pathToFileURL(mod.file).toString()
|
|
52951
52957
|
};
|
|
52952
52958
|
urlStack = urlStack.concat(url);
|
|
52953
52959
|
const isCircular = (url) => urlStack.includes(url);
|
|
@@ -53093,7 +53099,7 @@ async function nodeImport(id, importer, resolveOptions) {
|
|
|
53093
53099
|
? { ...resolveOptions, tryEsmOnly: true }
|
|
53094
53100
|
: resolveOptions);
|
|
53095
53101
|
if (usingDynamicImport) {
|
|
53096
|
-
url = pathToFileURL
|
|
53102
|
+
url = pathToFileURL(url).toString();
|
|
53097
53103
|
}
|
|
53098
53104
|
}
|
|
53099
53105
|
try {
|
|
@@ -59776,11 +59782,6 @@ function proxyMiddleware(httpServer, options, config) {
|
|
|
59776
59782
|
debug$1(`bypass: ${req.url} -> ${bypassResult}`);
|
|
59777
59783
|
return next();
|
|
59778
59784
|
}
|
|
59779
|
-
else if (isObject$1(bypassResult)) {
|
|
59780
|
-
Object.assign(options, bypassResult);
|
|
59781
|
-
debug$1(`bypass: ${req.url} use modified options: %O`, options);
|
|
59782
|
-
return next();
|
|
59783
|
-
}
|
|
59784
59785
|
else if (bypassResult === false) {
|
|
59785
59786
|
debug$1(`bypass: ${req.url} -> 404`);
|
|
59786
59787
|
return res.end(404);
|
|
@@ -59936,16 +59937,12 @@ function htmlFallbackMiddleware(root, spaFallback) {
|
|
|
59936
59937
|
rewrites: [
|
|
59937
59938
|
{
|
|
59938
59939
|
from: /\/$/,
|
|
59939
|
-
to({ parsedUrl }) {
|
|
59940
|
+
to({ parsedUrl, request }) {
|
|
59940
59941
|
const rewritten = decodeURIComponent(parsedUrl.pathname) + 'index.html';
|
|
59941
59942
|
if (fs$l.existsSync(path$o.join(root, rewritten))) {
|
|
59942
59943
|
return rewritten;
|
|
59943
59944
|
}
|
|
59944
|
-
|
|
59945
|
-
if (spaFallback) {
|
|
59946
|
-
return `/index.html`;
|
|
59947
|
-
}
|
|
59948
|
-
}
|
|
59945
|
+
return spaFallback ? `/index.html` : request.url;
|
|
59949
59946
|
}
|
|
59950
59947
|
}
|
|
59951
59948
|
]
|
|
@@ -60160,14 +60157,15 @@ const processNodeUrl = (attr, sourceCodeLocation, s, config, htmlPath, originalU
|
|
|
60160
60157
|
const devBase = config.base;
|
|
60161
60158
|
if (startsWithSingleSlashRE.test(url)) {
|
|
60162
60159
|
// prefix with base (dev only, base is never relative)
|
|
60163
|
-
const fullUrl =
|
|
60160
|
+
const fullUrl = path$o.posix.join(devBase, url);
|
|
60164
60161
|
overwriteAttrValue(s, sourceCodeLocation, fullUrl);
|
|
60165
60162
|
}
|
|
60166
60163
|
else if (url.startsWith('.') &&
|
|
60167
60164
|
originalUrl &&
|
|
60168
60165
|
originalUrl !== '/' &&
|
|
60169
60166
|
htmlPath === '/index.html') {
|
|
60170
|
-
|
|
60167
|
+
// prefix with base (dev only, base is never relative)
|
|
60168
|
+
const replacer = (url) => path$o.posix.join(devBase, url);
|
|
60171
60169
|
// #3230 if some request url (localhost:3000/a/b) return to fallback html, the relative assets
|
|
60172
60170
|
// path will add `/a/` prefix, it will caused 404.
|
|
60173
60171
|
// rewrite before `./index.js` -> `localhost:5173/a/index.js`.
|
|
@@ -61790,11 +61788,14 @@ async function createServer(inlineConfig = {}) {
|
|
|
61790
61788
|
watcher.on('unlink', (file) => {
|
|
61791
61789
|
handleFileAddUnlink(normalizePath$3(file), server);
|
|
61792
61790
|
});
|
|
61793
|
-
ws.on('vite:invalidate', async ({ path }) => {
|
|
61791
|
+
ws.on('vite:invalidate', async ({ path, message }) => {
|
|
61794
61792
|
const mod = moduleGraph.urlToModuleMap.get(path);
|
|
61795
61793
|
if (mod && mod.isSelfAccepting && mod.lastHMRTimestamp > 0) {
|
|
61794
|
+
config.logger.info(picocolors.exports.yellow(`hmr invalidate `) +
|
|
61795
|
+
picocolors.exports.dim(path) +
|
|
61796
|
+
(message ? ` ${message}` : ''), { timestamp: true });
|
|
61796
61797
|
const file = getShortName(mod.file, config.root);
|
|
61797
|
-
updateModules(file, [...mod.importers], mod.lastHMRTimestamp, server);
|
|
61798
|
+
updateModules(file, [...mod.importers], mod.lastHMRTimestamp, server, true);
|
|
61798
61799
|
}
|
|
61799
61800
|
});
|
|
61800
61801
|
if (!middlewareMode && httpServer) {
|
|
@@ -62769,7 +62770,7 @@ async function bundleConfigFile(fileName, isESM) {
|
|
|
62769
62770
|
}
|
|
62770
62771
|
let idFsPath = tryNodeResolve(id, importer, options, false)?.id;
|
|
62771
62772
|
if (idFsPath && (isESM || kind === 'dynamic-import')) {
|
|
62772
|
-
idFsPath = pathToFileURL
|
|
62773
|
+
idFsPath = pathToFileURL(idFsPath).href;
|
|
62773
62774
|
}
|
|
62774
62775
|
return {
|
|
62775
62776
|
path: idFsPath,
|
|
@@ -62785,7 +62786,7 @@ async function bundleConfigFile(fileName, isESM) {
|
|
|
62785
62786
|
const contents = await fs$l.promises.readFile(args.path, 'utf8');
|
|
62786
62787
|
const injectValues = `const ${dirnameVarName} = ${JSON.stringify(path$o.dirname(args.path))};` +
|
|
62787
62788
|
`const ${filenameVarName} = ${JSON.stringify(args.path)};` +
|
|
62788
|
-
`const ${importMetaUrlVarName} = ${JSON.stringify(pathToFileURL
|
|
62789
|
+
`const ${importMetaUrlVarName} = ${JSON.stringify(pathToFileURL(args.path).href)};`;
|
|
62789
62790
|
return {
|
|
62790
62791
|
loader: args.path.endsWith('ts') ? 'ts' : 'js',
|
|
62791
62792
|
contents: injectValues + contents
|
|
@@ -62809,7 +62810,7 @@ async function loadConfigFromBundledFile(fileName, bundledCode, isESM) {
|
|
|
62809
62810
|
if (isESM) {
|
|
62810
62811
|
const fileBase = `${fileName}.timestamp-${Date.now()}`;
|
|
62811
62812
|
const fileNameTmp = `${fileBase}.mjs`;
|
|
62812
|
-
const fileUrl = `${pathToFileURL
|
|
62813
|
+
const fileUrl = `${pathToFileURL(fileBase)}.mjs`;
|
|
62813
62814
|
fs$l.writeFileSync(fileNameTmp, bundledCode);
|
|
62814
62815
|
try {
|
|
62815
62816
|
return (await dynamicImport(fileUrl)).default;
|
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 { z as picocolors, v as createLogger, g as resolveConfig } from './chunks/dep-
|
|
5
|
+
import { z as picocolors, v as createLogger, g as resolveConfig } from './chunks/dep-fadb3c21.js';
|
|
6
6
|
import { VERSION } from './constants.js';
|
|
7
7
|
import 'node:url';
|
|
8
8
|
import 'node:module';
|
|
@@ -720,7 +720,7 @@ cli
|
|
|
720
720
|
filterDuplicateOptions(options);
|
|
721
721
|
// output structure is preserved even after bundling so require()
|
|
722
722
|
// is ok here
|
|
723
|
-
const { createServer } = await import('./chunks/dep-
|
|
723
|
+
const { createServer } = await import('./chunks/dep-fadb3c21.js').then(function (n) { return n.D; });
|
|
724
724
|
try {
|
|
725
725
|
const server = await createServer({
|
|
726
726
|
root,
|
|
@@ -773,7 +773,7 @@ cli
|
|
|
773
773
|
.option('-w, --watch', `[boolean] rebuilds when modules have changed on disk`)
|
|
774
774
|
.action(async (root, options) => {
|
|
775
775
|
filterDuplicateOptions(options);
|
|
776
|
-
const { build } = await import('./chunks/dep-
|
|
776
|
+
const { build } = await import('./chunks/dep-fadb3c21.js').then(function (n) { return n.C; });
|
|
777
777
|
const buildOptions = cleanOptions(options);
|
|
778
778
|
try {
|
|
779
779
|
await build({
|
|
@@ -801,7 +801,7 @@ cli
|
|
|
801
801
|
.option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
|
|
802
802
|
.action(async (root, options) => {
|
|
803
803
|
filterDuplicateOptions(options);
|
|
804
|
-
const { optimizeDeps } = await import('./chunks/dep-
|
|
804
|
+
const { optimizeDeps } = await import('./chunks/dep-fadb3c21.js').then(function (n) { return n.B; });
|
|
805
805
|
try {
|
|
806
806
|
const config = await resolveConfig({
|
|
807
807
|
root,
|
|
@@ -826,7 +826,7 @@ cli
|
|
|
826
826
|
.option('--outDir <dir>', `[string] output directory (default: dist)`)
|
|
827
827
|
.action(async (root, options) => {
|
|
828
828
|
filterDuplicateOptions(options);
|
|
829
|
-
const { preview } = await import('./chunks/dep-
|
|
829
|
+
const { preview } = await import('./chunks/dep-fadb3c21.js').then(function (n) { return n.E; });
|
|
830
830
|
try {
|
|
831
831
|
const server = await preview({
|
|
832
832
|
root,
|
package/dist/node/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { b as build, q as createFilter, v as createLogger, c as createServer, e as defineConfig, f as formatPostcssSourceMap, i as getDepOptimizationConfig, j as isDepsOptimizerEnabled, l as loadConfigFromFile, x as loadEnv, k as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, a as preprocessCSS, p as preview, h as resolveBaseUrl, g as resolveConfig, y as resolveEnvPrefix, d as resolvePackageData, r as resolvePackageEntry, w as searchForWorkspaceRoot, u as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-
|
|
1
|
+
export { b as build, q as createFilter, v as createLogger, c as createServer, e as defineConfig, f as formatPostcssSourceMap, i as getDepOptimizationConfig, j as isDepsOptimizerEnabled, l as loadConfigFromFile, x as loadEnv, k as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, a as preprocessCSS, p as preview, h as resolveBaseUrl, g as resolveConfig, y as resolveEnvPrefix, d as resolvePackageData, r as resolvePackageEntry, w as searchForWorkspaceRoot, u as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-fadb3c21.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';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Evan You",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"@rollup/plugin-dynamic-import-vars": "^2.0.1",
|
|
77
77
|
"@rollup/plugin-json": "^5.0.1",
|
|
78
78
|
"@rollup/plugin-node-resolve": "15.0.1",
|
|
79
|
-
"@rollup/plugin-typescript": "^
|
|
79
|
+
"@rollup/plugin-typescript": "^9.0.2",
|
|
80
80
|
"@rollup/pluginutils": "^4.2.1",
|
|
81
81
|
"acorn": "^8.8.1",
|
|
82
82
|
"cac": "^6.7.14",
|
|
@@ -99,17 +99,17 @@
|
|
|
99
99
|
"launch-editor-middleware": "^2.6.0",
|
|
100
100
|
"magic-string": "^0.26.7",
|
|
101
101
|
"micromatch": "^4.0.5",
|
|
102
|
-
"mlly": "^0.5.
|
|
102
|
+
"mlly": "^0.5.17",
|
|
103
103
|
"mrmime": "^1.0.1",
|
|
104
104
|
"okie": "^1.0.1",
|
|
105
105
|
"open": "^8.4.0",
|
|
106
|
-
"parse5": "^7.1.
|
|
106
|
+
"parse5": "^7.1.2",
|
|
107
107
|
"periscopic": "^3.0.4",
|
|
108
108
|
"picocolors": "^1.0.0",
|
|
109
109
|
"picomatch": "^2.3.1",
|
|
110
110
|
"postcss-import": "^15.0.0",
|
|
111
111
|
"postcss-load-config": "^4.0.1",
|
|
112
|
-
"postcss-modules": "^
|
|
112
|
+
"postcss-modules": "^6.0.0",
|
|
113
113
|
"resolve.exports": "^1.1.0",
|
|
114
114
|
"sirv": "^2.0.2",
|
|
115
115
|
"source-map-js": "^1.0.2",
|
package/types/customEvent.d.ts
CHANGED