vite 4.0.0-beta.4 → 4.0.0-beta.6
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.
|
@@ -12597,8 +12597,9 @@ function printServerUrls(urls, optionsHost, info) {
|
|
|
12597
12597
|
info(` ${picocolors.exports.green('➜')} ${picocolors.exports.bold('Network')}: ${colorUrl(url)}`);
|
|
12598
12598
|
}
|
|
12599
12599
|
if (urls.network.length === 0 && optionsHost === undefined) {
|
|
12600
|
-
|
|
12601
|
-
|
|
12600
|
+
info(picocolors.exports.dim(` ${picocolors.exports.green('➜')} ${picocolors.exports.bold('Network')}: use `) +
|
|
12601
|
+
picocolors.exports.bold('--host') +
|
|
12602
|
+
picocolors.exports.dim(' to expose'));
|
|
12602
12603
|
}
|
|
12603
12604
|
}
|
|
12604
12605
|
|
|
@@ -13391,8 +13392,6 @@ async function transformWithEsbuild(code, filename, options, inMap) {
|
|
|
13391
13392
|
};
|
|
13392
13393
|
}
|
|
13393
13394
|
const resolvedOptions = {
|
|
13394
|
-
// esbuild 0.16.0 & 0.16.1 defaults to 'browser': https://github.com/evanw/esbuild/issues/2718
|
|
13395
|
-
platform: 'neutral',
|
|
13396
13395
|
sourcemap: true,
|
|
13397
13396
|
// ensure source file name contains full query
|
|
13398
13397
|
sourcefile: filename,
|
|
@@ -37612,7 +37611,7 @@ async function compileCSS(id, code, config, urlReplacer) {
|
|
|
37612
37611
|
}));
|
|
37613
37612
|
}
|
|
37614
37613
|
if (isModule) {
|
|
37615
|
-
postcssPlugins.unshift((await import('./dep-
|
|
37614
|
+
postcssPlugins.unshift((await import('./dep-da28aebd.js').then(function (n) { return n.i; })).default({
|
|
37616
37615
|
...modulesOptions,
|
|
37617
37616
|
localsConvention: modulesOptions?.localsConvention,
|
|
37618
37617
|
getJSON(cssFileName, _modules, outputFileName) {
|
|
@@ -42672,16 +42671,19 @@ async function scanImports(config) {
|
|
|
42672
42671
|
const container = await createPluginContainer(config);
|
|
42673
42672
|
const plugin = esbuildScanPlugin(config, container, deps, missing, entries);
|
|
42674
42673
|
const { plugins = [], ...esbuildOptions } = config.optimizeDeps?.esbuildOptions ?? {};
|
|
42675
|
-
await
|
|
42674
|
+
await build$3({
|
|
42676
42675
|
absWorkingDir: process.cwd(),
|
|
42677
42676
|
write: false,
|
|
42678
|
-
|
|
42677
|
+
stdin: {
|
|
42678
|
+
contents: entries.map((e) => `import ${JSON.stringify(e)}`).join('\n'),
|
|
42679
|
+
loader: 'js',
|
|
42680
|
+
},
|
|
42679
42681
|
bundle: true,
|
|
42680
42682
|
format: 'esm',
|
|
42681
42683
|
logLevel: 'error',
|
|
42682
42684
|
plugins: [...plugins, plugin],
|
|
42683
42685
|
...esbuildOptions,
|
|
42684
|
-
})
|
|
42686
|
+
});
|
|
42685
42687
|
debug$8(`Scan completed in ${(performance.now() - start).toFixed(2)}ms:`, deps);
|
|
42686
42688
|
return {
|
|
42687
42689
|
// Ensure a fixed order so hashes are stable and improve logs
|
|
@@ -43127,15 +43129,14 @@ async function createDepsOptimizer(config, server) {
|
|
|
43127
43129
|
// If there wasn't a cache or it is outdated, we need to prepare a first run
|
|
43128
43130
|
let firstRunCalled = !!cachedMetadata;
|
|
43129
43131
|
let postScanOptimizationResult;
|
|
43130
|
-
let discoverProjectDependenciesPromise;
|
|
43131
43132
|
let optimizingNewDeps;
|
|
43132
43133
|
async function close() {
|
|
43133
43134
|
closed = true;
|
|
43134
|
-
await
|
|
43135
|
-
|
|
43136
|
-
|
|
43137
|
-
|
|
43138
|
-
|
|
43135
|
+
await Promise.allSettled([
|
|
43136
|
+
depsOptimizer.scanProcessing,
|
|
43137
|
+
postScanOptimizationResult,
|
|
43138
|
+
optimizingNewDeps,
|
|
43139
|
+
]);
|
|
43139
43140
|
}
|
|
43140
43141
|
if (!cachedMetadata) {
|
|
43141
43142
|
// Enter processing state until crawl of static imports ends
|
|
@@ -43153,43 +43154,41 @@ async function createDepsOptimizer(config, server) {
|
|
|
43153
43154
|
}
|
|
43154
43155
|
if (!isBuild) {
|
|
43155
43156
|
// Important, the scanner is dev only
|
|
43156
|
-
|
|
43157
|
-
|
|
43158
|
-
|
|
43159
|
-
|
|
43160
|
-
|
|
43161
|
-
|
|
43162
|
-
|
|
43163
|
-
|
|
43164
|
-
|
|
43165
|
-
|
|
43166
|
-
|
|
43167
|
-
|
|
43168
|
-
|
|
43169
|
-
|
|
43170
|
-
|
|
43171
|
-
|
|
43172
|
-
|
|
43173
|
-
|
|
43157
|
+
depsOptimizer.scanProcessing = new Promise((resolve) => {
|
|
43158
|
+
// Ensure server listen is called before the scanner
|
|
43159
|
+
setTimeout(async () => {
|
|
43160
|
+
try {
|
|
43161
|
+
debuggerViteDeps(picocolors.exports.green(`scanning for dependencies...`));
|
|
43162
|
+
const deps = await discoverProjectDependencies(config);
|
|
43163
|
+
debuggerViteDeps(picocolors.exports.green(Object.keys(deps).length > 0
|
|
43164
|
+
? `dependencies found by scanner: ${depsLogString(Object.keys(deps))}`
|
|
43165
|
+
: `no dependencies found by scanner`));
|
|
43166
|
+
// Add these dependencies to the discovered list, as these are currently
|
|
43167
|
+
// used by the preAliasPlugin to support aliased and optimized deps.
|
|
43168
|
+
// This is also used by the CJS externalization heuristics in legacy mode
|
|
43169
|
+
for (const id of Object.keys(deps)) {
|
|
43170
|
+
if (!metadata.discovered[id]) {
|
|
43171
|
+
addMissingDep(id, deps[id]);
|
|
43172
|
+
}
|
|
43173
|
+
}
|
|
43174
|
+
if (!isBuild) {
|
|
43175
|
+
const knownDeps = prepareKnownDeps();
|
|
43176
|
+
// For dev, we run the scanner and the first optimization
|
|
43177
|
+
// run on the background, but we wait until crawling has ended
|
|
43178
|
+
// to decide if we send this result to the browser or we need to
|
|
43179
|
+
// do another optimize step
|
|
43180
|
+
postScanOptimizationResult = runOptimizeDeps(config, knownDeps);
|
|
43174
43181
|
}
|
|
43175
43182
|
}
|
|
43176
|
-
|
|
43177
|
-
|
|
43178
|
-
// For dev, we run the scanner and the first optimization
|
|
43179
|
-
// run on the background, but we wait until crawling has ended
|
|
43180
|
-
// to decide if we send this result to the browser or we need to
|
|
43181
|
-
// do another optimize step
|
|
43182
|
-
postScanOptimizationResult = runOptimizeDeps(config, knownDeps);
|
|
43183
|
+
catch (e) {
|
|
43184
|
+
logger.error(e.message);
|
|
43183
43185
|
}
|
|
43184
|
-
|
|
43185
|
-
|
|
43186
|
-
|
|
43187
|
-
|
|
43188
|
-
|
|
43189
|
-
|
|
43190
|
-
depsOptimizer.scanProcessing = undefined;
|
|
43191
|
-
}
|
|
43192
|
-
}, 0);
|
|
43186
|
+
finally {
|
|
43187
|
+
resolve();
|
|
43188
|
+
depsOptimizer.scanProcessing = undefined;
|
|
43189
|
+
}
|
|
43190
|
+
}, 0);
|
|
43191
|
+
});
|
|
43193
43192
|
}
|
|
43194
43193
|
}
|
|
43195
43194
|
function startNextDiscoveredBatch() {
|
|
@@ -53120,6 +53119,17 @@ function rebindErrorStacktrace(e, stacktrace) {
|
|
|
53120
53119
|
e.stack = stacktrace;
|
|
53121
53120
|
}
|
|
53122
53121
|
}
|
|
53122
|
+
const rewroteStacktraces = new WeakSet();
|
|
53123
|
+
function ssrFixStacktrace(e, moduleGraph) {
|
|
53124
|
+
if (!e.stack)
|
|
53125
|
+
return;
|
|
53126
|
+
// stacktrace shouldn't be rewritten more than once
|
|
53127
|
+
if (rewroteStacktraces.has(e))
|
|
53128
|
+
return;
|
|
53129
|
+
const stacktrace = ssrRewriteStacktrace(e.stack, moduleGraph);
|
|
53130
|
+
rebindErrorStacktrace(e, stacktrace);
|
|
53131
|
+
rewroteStacktraces.add(e);
|
|
53132
|
+
}
|
|
53123
53133
|
|
|
53124
53134
|
const pendingModules = new Map();
|
|
53125
53135
|
const pendingImports = new Map();
|
|
@@ -53240,9 +53250,8 @@ async function instantiateModule(url, server, context = { global }, urlStack = [
|
|
|
53240
53250
|
catch (e) {
|
|
53241
53251
|
mod.ssrError = e;
|
|
53242
53252
|
if (e.stack && fixStacktrace) {
|
|
53243
|
-
|
|
53244
|
-
|
|
53245
|
-
server.config.logger.error(`Error when evaluating SSR module ${url}:\n${stacktrace}`, {
|
|
53253
|
+
ssrFixStacktrace(e, moduleGraph);
|
|
53254
|
+
server.config.logger.error(`Error when evaluating SSR module ${url}:\n${e.stack}`, {
|
|
53246
53255
|
timestamp: true,
|
|
53247
53256
|
clear: server.config.clearScreen,
|
|
53248
53257
|
error: e,
|
|
@@ -54425,8 +54434,9 @@ function startBrowserProcess(browser, url) {
|
|
|
54425
54434
|
}
|
|
54426
54435
|
|
|
54427
54436
|
function bindShortcuts(server, opts) {
|
|
54428
|
-
if (!server.httpServer)
|
|
54437
|
+
if (!server.httpServer || !process.stdin.isTTY || process.env.CI) {
|
|
54429
54438
|
return;
|
|
54439
|
+
}
|
|
54430
54440
|
server._shortcutsOptions = opts;
|
|
54431
54441
|
if (opts.print) {
|
|
54432
54442
|
server.config.logger.info(picocolors.exports.dim(picocolors.exports.green(' ➜')) +
|
|
@@ -54447,11 +54457,13 @@ function bindShortcuts(server, opts) {
|
|
|
54447
54457
|
if (actionRunning)
|
|
54448
54458
|
return;
|
|
54449
54459
|
if (input === 'h') {
|
|
54450
|
-
server.config.logger.info(
|
|
54451
|
-
|
|
54452
|
-
picocolors.exports.bold(
|
|
54453
|
-
picocolors.exports.dim(
|
|
54454
|
-
|
|
54460
|
+
server.config.logger.info([
|
|
54461
|
+
'',
|
|
54462
|
+
picocolors.exports.bold(' Shortcuts'),
|
|
54463
|
+
...shortcuts.map((shortcut) => picocolors.exports.dim(' press ') +
|
|
54464
|
+
picocolors.exports.bold(shortcut.key) +
|
|
54465
|
+
picocolors.exports.dim(` to ${shortcut.description}`)),
|
|
54466
|
+
].join('\n'));
|
|
54455
54467
|
}
|
|
54456
54468
|
const shortcut = shortcuts.find((shortcut) => shortcut.key === input);
|
|
54457
54469
|
if (!shortcut)
|
|
@@ -54460,9 +54472,7 @@ function bindShortcuts(server, opts) {
|
|
|
54460
54472
|
await shortcut.action(server);
|
|
54461
54473
|
actionRunning = false;
|
|
54462
54474
|
};
|
|
54463
|
-
|
|
54464
|
-
process.stdin.setRawMode(true);
|
|
54465
|
-
}
|
|
54475
|
+
process.stdin.setRawMode(true);
|
|
54466
54476
|
process.stdin.on('data', onInput).setEncoding('utf8').resume();
|
|
54467
54477
|
server.httpServer.on('close', () => {
|
|
54468
54478
|
process.stdin.off('data', onInput).pause();
|
|
@@ -61917,10 +61927,7 @@ async function createServer(inlineConfig = {}) {
|
|
|
61917
61927
|
return ssrLoadModule(url, server, undefined, undefined, opts?.fixStacktrace);
|
|
61918
61928
|
},
|
|
61919
61929
|
ssrFixStacktrace(e) {
|
|
61920
|
-
|
|
61921
|
-
const stacktrace = ssrRewriteStacktrace(e.stack, moduleGraph);
|
|
61922
|
-
rebindErrorStacktrace(e, stacktrace);
|
|
61923
|
-
}
|
|
61930
|
+
ssrFixStacktrace(e, moduleGraph);
|
|
61924
61931
|
},
|
|
61925
61932
|
ssrRewriteStacktrace(stack) {
|
|
61926
61933
|
return ssrRewriteStacktrace(stack, moduleGraph);
|
|
@@ -61944,7 +61951,7 @@ async function createServer(inlineConfig = {}) {
|
|
|
61944
61951
|
process.stdin.off('end', exitProcess);
|
|
61945
61952
|
}
|
|
61946
61953
|
}
|
|
61947
|
-
await Promise.
|
|
61954
|
+
await Promise.allSettled([
|
|
61948
61955
|
watcher.close(),
|
|
61949
61956
|
ws.close(),
|
|
61950
61957
|
container.close(),
|
|
@@ -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-cf256579.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 picocolors, B as bindShortcuts, w as createLogger, h as resolveConfig } from './chunks/dep-
|
|
5
|
+
import { A as picocolors, B as bindShortcuts, w as createLogger, h as resolveConfig } from './chunks/dep-cf256579.js';
|
|
6
6
|
import { VERSION } from './constants.js';
|
|
7
7
|
import 'node:url';
|
|
8
8
|
import 'node:module';
|
|
@@ -725,7 +725,7 @@ cli
|
|
|
725
725
|
filterDuplicateOptions(options);
|
|
726
726
|
// output structure is preserved even after bundling so require()
|
|
727
727
|
// is ok here
|
|
728
|
-
const { createServer } = await import('./chunks/dep-
|
|
728
|
+
const { createServer } = await import('./chunks/dep-cf256579.js').then(function (n) { return n.F; });
|
|
729
729
|
try {
|
|
730
730
|
const server = await createServer({
|
|
731
731
|
root,
|
|
@@ -804,7 +804,7 @@ cli
|
|
|
804
804
|
.option('-w, --watch', `[boolean] rebuilds when modules have changed on disk`)
|
|
805
805
|
.action(async (root, options) => {
|
|
806
806
|
filterDuplicateOptions(options);
|
|
807
|
-
const { build } = await import('./chunks/dep-
|
|
807
|
+
const { build } = await import('./chunks/dep-cf256579.js').then(function (n) { return n.E; });
|
|
808
808
|
const buildOptions = cleanOptions(options);
|
|
809
809
|
try {
|
|
810
810
|
await build({
|
|
@@ -832,7 +832,7 @@ cli
|
|
|
832
832
|
.option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
|
|
833
833
|
.action(async (root, options) => {
|
|
834
834
|
filterDuplicateOptions(options);
|
|
835
|
-
const { optimizeDeps } = await import('./chunks/dep-
|
|
835
|
+
const { optimizeDeps } = await import('./chunks/dep-cf256579.js').then(function (n) { return n.D; });
|
|
836
836
|
try {
|
|
837
837
|
const config = await resolveConfig({
|
|
838
838
|
root,
|
|
@@ -857,7 +857,7 @@ cli
|
|
|
857
857
|
.option('--outDir <dir>', `[string] output directory (default: dist)`)
|
|
858
858
|
.action(async (root, options) => {
|
|
859
859
|
filterDuplicateOptions(options);
|
|
860
|
-
const { preview } = await import('./chunks/dep-
|
|
860
|
+
const { preview } = await import('./chunks/dep-cf256579.js').then(function (n) { return n.G; });
|
|
861
861
|
try {
|
|
862
862
|
const server = await preview({
|
|
863
863
|
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-cf256579.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-beta.
|
|
3
|
+
"version": "4.0.0-beta.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Evan You",
|
|
@@ -58,10 +58,10 @@
|
|
|
58
58
|
},
|
|
59
59
|
"//": "READ CONTRIBUTING.md to understand what to put under deps vs. devDeps!",
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"esbuild": "^0.16.
|
|
61
|
+
"esbuild": "^0.16.2",
|
|
62
62
|
"postcss": "^8.4.19",
|
|
63
63
|
"resolve": "^1.22.1",
|
|
64
|
-
"rollup": "^3.
|
|
64
|
+
"rollup": "^3.7.0"
|
|
65
65
|
},
|
|
66
66
|
"optionalDependencies": {
|
|
67
67
|
"fsevents": "~2.3.2"
|