vite 5.1.0-beta.3 → 5.1.0-beta.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/dist/node/chunks/{dep-tbVWvdXL.js → dep-AgYU8wIQ.js} +1 -1
- package/dist/node/chunks/{dep-A6C2SOTv.js → dep-JW1Wr5se.js} +1 -1
- package/dist/node/chunks/{dep-jalgWsWD.js → dep-Y86Adl1p.js} +172 -112
- package/dist/node/cli.js +5 -6
- package/dist/node/index.d.ts +14 -3
- package/dist/node/index.js +2 -3
- package/dist/node-cjs/publicUtils.cjs +15 -7
- package/package.json +3 -3
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { B as commonjsGlobal, A as getDefaultExportFromCjs } from './dep-Y86Adl1p.js';
|
2
2
|
import require$$0__default from 'fs';
|
3
3
|
import require$$0 from 'postcss';
|
4
4
|
import require$$0$1 from 'path';
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import fs$l, { promises as promises$1 } from 'node:fs';
|
2
2
|
import fsp from 'node:fs/promises';
|
3
|
-
import path$o, { posix as posix$1, isAbsolute as isAbsolute$2,
|
3
|
+
import path$o, { posix as posix$1, isAbsolute as isAbsolute$2, dirname as dirname$2, join as join$2, extname as extname$1, relative as relative$2, basename as basename$2 } from 'node:path';
|
4
4
|
import { fileURLToPath, URL as URL$3, parse as parse$i, pathToFileURL } from 'node:url';
|
5
5
|
import { promisify as promisify$4, format as format$2, inspect } from 'node:util';
|
6
6
|
import { performance } from 'node:perf_hooks';
|
@@ -25,14 +25,13 @@ import os$4 from 'node:os';
|
|
25
25
|
import { exec } from 'node:child_process';
|
26
26
|
import { createHash as createHash$2 } from 'node:crypto';
|
27
27
|
import { promises } from 'node:dns';
|
28
|
-
import { CLIENT_ENTRY, VALID_ID_PREFIX, NULL_BYTE_PLACEHOLDER, OPTIMIZABLE_ENTRY_RE, wildcardHosts, loopbackHosts, FS_PREFIX, CLIENT_PUBLIC_PATH, ENV_PUBLIC_PATH, DEFAULT_ASSETS_INLINE_LIMIT, CSS_LANGS_RE, ESBUILD_MODULES_TARGET, SPECIAL_QUERY_RE, ENV_ENTRY, DEP_VERSION_RE, DEFAULT_MAIN_FIELDS, DEFAULT_EXTENSIONS, KNOWN_ASSET_TYPES, JS_TYPES_RE, METADATA_FILENAME, VITE_PACKAGE_DIR, DEFAULT_DEV_PORT, CLIENT_DIR, VERSION
|
28
|
+
import { CLIENT_ENTRY, VALID_ID_PREFIX, NULL_BYTE_PLACEHOLDER, OPTIMIZABLE_ENTRY_RE, wildcardHosts, loopbackHosts, FS_PREFIX, CLIENT_PUBLIC_PATH, ENV_PUBLIC_PATH, DEFAULT_ASSETS_INLINE_LIMIT, CSS_LANGS_RE, ESBUILD_MODULES_TARGET, SPECIAL_QUERY_RE, ENV_ENTRY, DEP_VERSION_RE, DEFAULT_MAIN_FIELDS, DEFAULT_EXTENSIONS, KNOWN_ASSET_TYPES, JS_TYPES_RE, METADATA_FILENAME, VITE_PACKAGE_DIR, DEFAULT_DEV_PORT, CLIENT_DIR, VERSION, DEFAULT_PREVIEW_PORT, DEFAULT_ASSETS_RE, DEFAULT_CONFIG_FILES } from '../constants.js';
|
29
29
|
import require$$0$a from 'crypto';
|
30
30
|
import require$$0$8, { createRequire as createRequire$2 } from 'module';
|
31
31
|
import assert$1 from 'node:assert';
|
32
32
|
import v8 from 'node:v8';
|
33
33
|
import { Worker as Worker$1 } from 'node:worker_threads';
|
34
34
|
import { Buffer as Buffer$1 } from 'node:buffer';
|
35
|
-
import { VERSION } from 'rollup';
|
36
35
|
import { parseAst, parseAstAsync } from 'rollup/parseAst';
|
37
36
|
import * as qs from 'querystring';
|
38
37
|
import readline from 'node:readline';
|
@@ -12048,6 +12047,11 @@ const bareImportRE = /^(?![a-zA-Z]:)[\w@](?!.*:\/\/)/;
|
|
12048
12047
|
const deepImportRE = /^([^@][^/]*)\/|^(@[^/]+\/[^/]+)\//;
|
12049
12048
|
// TODO: use import()
|
12050
12049
|
const _require$1 = createRequire$1(import.meta.url);
|
12050
|
+
function resolveDependencyVersion(dep, pkgRelativePath = '../../package.json') {
|
12051
|
+
const pkgPath = path$o.resolve(_require$1.resolve(dep), pkgRelativePath);
|
12052
|
+
return JSON.parse(fs$l.readFileSync(pkgPath, 'utf-8')).version;
|
12053
|
+
}
|
12054
|
+
const rollupVersion = resolveDependencyVersion('rollup');
|
12051
12055
|
// set in bin/vite.js
|
12052
12056
|
const filter = process.env.VITE_DEBUG_FILTER;
|
12053
12057
|
const DEBUG = process.env.DEBUG;
|
@@ -12226,7 +12230,7 @@ function prettifyUrl(url, root) {
|
|
12226
12230
|
url = removeTimestampQuery(url);
|
12227
12231
|
const isAbsoluteFile = url.startsWith(root);
|
12228
12232
|
if (isAbsoluteFile || url.startsWith(FS_PREFIX)) {
|
12229
|
-
const file = path$o.relative(root, isAbsoluteFile ? url : fsPathFromId(url));
|
12233
|
+
const file = path$o.posix.relative(root, isAbsoluteFile ? url : fsPathFromId(url));
|
12230
12234
|
return colors$1.dim(file);
|
12231
12235
|
}
|
12232
12236
|
else {
|
@@ -29554,7 +29558,7 @@ function stripLiteralDetailed(code, options) {
|
|
29554
29558
|
var main$1 = {exports: {}};
|
29555
29559
|
|
29556
29560
|
var name = "dotenv";
|
29557
|
-
var version$2 = "16.3.
|
29561
|
+
var version$2 = "16.3.2";
|
29558
29562
|
var description = "Loads environment variables from .env file";
|
29559
29563
|
var main = "lib/main.js";
|
29560
29564
|
var types$2 = "lib/main.d.ts";
|
@@ -29825,6 +29829,10 @@ function configDotenv (options) {
|
|
29825
29829
|
}
|
29826
29830
|
if (options.encoding != null) {
|
29827
29831
|
encoding = options.encoding;
|
29832
|
+
} else {
|
29833
|
+
if (debug) {
|
29834
|
+
_debug('No encoding is specified. UTF-8 is used by default');
|
29835
|
+
}
|
29828
29836
|
}
|
29829
29837
|
}
|
29830
29838
|
|
@@ -29872,9 +29880,9 @@ function decrypt (encrypted, keyStr) {
|
|
29872
29880
|
const key = Buffer.from(keyStr.slice(-64), 'hex');
|
29873
29881
|
let ciphertext = Buffer.from(encrypted, 'base64');
|
29874
29882
|
|
29875
|
-
const nonce = ciphertext.
|
29876
|
-
const authTag = ciphertext.
|
29877
|
-
ciphertext = ciphertext.
|
29883
|
+
const nonce = ciphertext.subarray(0, 12);
|
29884
|
+
const authTag = ciphertext.subarray(-16);
|
29885
|
+
ciphertext = ciphertext.subarray(12, -16);
|
29878
29886
|
|
29879
29887
|
try {
|
29880
29888
|
const aesgcm = crypto$1.createDecipheriv('aes-256-gcm', key, nonce);
|
@@ -31994,8 +32002,8 @@ function createCachedImport(imp) {
|
|
31994
32002
|
return cached;
|
31995
32003
|
};
|
31996
32004
|
}
|
31997
|
-
const importPostcssImport = createCachedImport(() => import('./dep-
|
31998
|
-
const importPostcssModules = createCachedImport(() => import('./dep-
|
32005
|
+
const importPostcssImport = createCachedImport(() => import('./dep-JW1Wr5se.js').then(function (n) { return n.i; }));
|
32006
|
+
const importPostcssModules = createCachedImport(() => import('./dep-AgYU8wIQ.js').then(function (n) { return n.i; }));
|
31999
32007
|
const importPostcss = createCachedImport(() => import('postcss'));
|
32000
32008
|
const preprocessorWorkerControllerCache = new WeakMap();
|
32001
32009
|
let alwaysFakeWorkerWorkerControllerCache;
|
@@ -46768,6 +46776,68 @@ function setClientErrorHandler(server, logger) {
|
|
46768
46776
|
});
|
46769
46777
|
}
|
46770
46778
|
|
46779
|
+
// https://github.com/vitejs/vite/issues/2820#issuecomment-812495079
|
46780
|
+
const ROOT_FILES = [
|
46781
|
+
// '.git',
|
46782
|
+
// https://pnpm.io/workspaces/
|
46783
|
+
'pnpm-workspace.yaml',
|
46784
|
+
// https://rushjs.io/pages/advanced/config_files/
|
46785
|
+
// 'rush.json',
|
46786
|
+
// https://nx.dev/latest/react/getting-started/nx-setup
|
46787
|
+
// 'workspace.json',
|
46788
|
+
// 'nx.json',
|
46789
|
+
// https://github.com/lerna/lerna#lernajson
|
46790
|
+
'lerna.json',
|
46791
|
+
];
|
46792
|
+
// npm: https://docs.npmjs.com/cli/v7/using-npm/workspaces#installing-workspaces
|
46793
|
+
// yarn: https://classic.yarnpkg.com/en/docs/workspaces/#toc-how-to-use-it
|
46794
|
+
function hasWorkspacePackageJSON(root) {
|
46795
|
+
const path = join$2(root, 'package.json');
|
46796
|
+
if (!isFileReadable(path)) {
|
46797
|
+
return false;
|
46798
|
+
}
|
46799
|
+
try {
|
46800
|
+
const content = JSON.parse(fs$l.readFileSync(path, 'utf-8')) || {};
|
46801
|
+
return !!content.workspaces;
|
46802
|
+
}
|
46803
|
+
catch {
|
46804
|
+
return false;
|
46805
|
+
}
|
46806
|
+
}
|
46807
|
+
function hasRootFile(root) {
|
46808
|
+
return ROOT_FILES.some((file) => fs$l.existsSync(join$2(root, file)));
|
46809
|
+
}
|
46810
|
+
function hasPackageJSON(root) {
|
46811
|
+
const path = join$2(root, 'package.json');
|
46812
|
+
return fs$l.existsSync(path);
|
46813
|
+
}
|
46814
|
+
/**
|
46815
|
+
* Search up for the nearest `package.json`
|
46816
|
+
*/
|
46817
|
+
function searchForPackageRoot(current, root = current) {
|
46818
|
+
if (hasPackageJSON(current))
|
46819
|
+
return current;
|
46820
|
+
const dir = dirname$2(current);
|
46821
|
+
// reach the fs root
|
46822
|
+
if (!dir || dir === current)
|
46823
|
+
return root;
|
46824
|
+
return searchForPackageRoot(dir, root);
|
46825
|
+
}
|
46826
|
+
/**
|
46827
|
+
* Search up for the nearest workspace root
|
46828
|
+
*/
|
46829
|
+
function searchForWorkspaceRoot(current, root = searchForPackageRoot(current)) {
|
46830
|
+
if (hasRootFile(current))
|
46831
|
+
return current;
|
46832
|
+
if (hasWorkspacePackageJSON(current))
|
46833
|
+
return current;
|
46834
|
+
const dir = dirname$2(current);
|
46835
|
+
// reach the fs root
|
46836
|
+
if (!dir || dir === current)
|
46837
|
+
return root;
|
46838
|
+
return searchForWorkspaceRoot(dir, root);
|
46839
|
+
}
|
46840
|
+
|
46771
46841
|
// An implementation of fsUtils without caching
|
46772
46842
|
const commonFsUtils = {
|
46773
46843
|
existsSync: fs$l.existsSync,
|
@@ -46784,20 +46854,9 @@ function getFsUtils(config) {
|
|
46784
46854
|
// cached fsUtils is only used in the dev server for now, and only when the watcher isn't configured
|
46785
46855
|
// we can support custom ignored patterns later
|
46786
46856
|
fsUtils = commonFsUtils;
|
46787
|
-
}
|
46788
|
-
else if (config.server.watch === null || config.server.watch?.ignored) {
|
46789
|
-
config.logger.warn(
|
46790
|
-
colors.yellow(
|
46791
|
-
`${colors.bold(
|
46792
|
-
`(!)`,
|
46793
|
-
)} server.fs.cachedChecks isn't supported if server.watch is null or a custom server.watch.ignored is configured\n`,
|
46794
|
-
),
|
46795
|
-
)
|
46796
|
-
fsUtils = commonFsUtils
|
46797
|
-
} */
|
46857
|
+
}
|
46798
46858
|
else if (!config.resolve.preserveSymlinks &&
|
46799
46859
|
config.root !== getRealPath(config.root)) {
|
46800
|
-
config.logger.warn(colors$1.yellow(`${colors$1.bold(`(!)`)} server.fs.cachedChecks isn't supported when resolve.preserveSymlinks is false and root is symlinked\n`));
|
46801
46860
|
fsUtils = commonFsUtils;
|
46802
46861
|
}
|
46803
46862
|
else {
|
@@ -46850,7 +46909,7 @@ function pathUntilPart(root, parts, i) {
|
|
46850
46909
|
return p;
|
46851
46910
|
}
|
46852
46911
|
function createCachedFsUtils(config) {
|
46853
|
-
const root = config.root;
|
46912
|
+
const root = normalizePath$3(searchForWorkspaceRoot(config.root));
|
46854
46913
|
const rootDirPath = `${root}/`;
|
46855
46914
|
const rootCache = { type: 'directory' }; // dirents will be computed lazily
|
46856
46915
|
const getDirentCacheSync = (parts) => {
|
@@ -46921,7 +46980,7 @@ function createCachedFsUtils(config) {
|
|
46921
46980
|
return direntCache;
|
46922
46981
|
}
|
46923
46982
|
function onPathAdd(file, type) {
|
46924
|
-
const direntCache = getDirentCacheFromPath(path$o.dirname(file));
|
46983
|
+
const direntCache = getDirentCacheFromPath(normalizePath$3(path$o.dirname(file)));
|
46925
46984
|
if (direntCache &&
|
46926
46985
|
direntCache.type === 'directory' &&
|
46927
46986
|
direntCache.dirents) {
|
@@ -46929,7 +46988,7 @@ function createCachedFsUtils(config) {
|
|
46929
46988
|
}
|
46930
46989
|
}
|
46931
46990
|
function onPathUnlink(file) {
|
46932
|
-
const direntCache = getDirentCacheFromPath(path$o.dirname(file));
|
46991
|
+
const direntCache = getDirentCacheFromPath(normalizePath$3(path$o.dirname(file)));
|
46933
46992
|
if (direntCache &&
|
46934
46993
|
direntCache.type === 'directory' &&
|
46935
46994
|
direntCache.dirents) {
|
@@ -50189,7 +50248,7 @@ async function createPluginContainer(config, moduleGraph, watcher) {
|
|
50189
50248
|
const moduleNodeToLoadAddedImports = new WeakMap();
|
50190
50249
|
const minimalContext = {
|
50191
50250
|
meta: {
|
50192
|
-
rollupVersion
|
50251
|
+
rollupVersion,
|
50193
50252
|
watchMode: true,
|
50194
50253
|
},
|
50195
50254
|
debug: noop$3,
|
@@ -51423,6 +51482,8 @@ async function createDepsOptimizer(config, server) {
|
|
51423
51482
|
let debounceProcessingHandle;
|
51424
51483
|
let closed = false;
|
51425
51484
|
let metadata = cachedMetadata || initDepsOptimizerMetadata(config, ssr, sessionTimestamp);
|
51485
|
+
const options = getDepOptimizationConfig(config, ssr);
|
51486
|
+
const { noDiscovery, holdUntilCrawlEnd } = options;
|
51426
51487
|
const depsOptimizer = {
|
51427
51488
|
metadata,
|
51428
51489
|
registerMissingImport,
|
@@ -51432,7 +51493,7 @@ async function createDepsOptimizer(config, server) {
|
|
51432
51493
|
getOptimizedDepId: (depInfo) => `${depInfo.file}?v=${depInfo.browserHash}`,
|
51433
51494
|
delayDepsOptimizerUntil,
|
51434
51495
|
close,
|
51435
|
-
options
|
51496
|
+
options,
|
51436
51497
|
};
|
51437
51498
|
depsOptimizerMap.set(config, depsOptimizer);
|
51438
51499
|
let newDepsDiscovered = false;
|
@@ -51446,6 +51507,15 @@ async function createDepsOptimizer(config, server) {
|
|
51446
51507
|
newDepsToLog = [];
|
51447
51508
|
}
|
51448
51509
|
};
|
51510
|
+
let discoveredDepsWhileScanning = [];
|
51511
|
+
const logDiscoveredDepsWhileScanning = () => {
|
51512
|
+
if (discoveredDepsWhileScanning.length) {
|
51513
|
+
config.logger.info(colors$1.green(`✨ discovered while scanning: ${depsLogString(discoveredDepsWhileScanning)}`), {
|
51514
|
+
timestamp: true,
|
51515
|
+
});
|
51516
|
+
discoveredDepsWhileScanning = [];
|
51517
|
+
}
|
51518
|
+
};
|
51449
51519
|
let depOptimizationProcessing = promiseWithResolvers();
|
51450
51520
|
let depOptimizationProcessingQueue = [];
|
51451
51521
|
const resolveEnqueuedProcessingPromises = () => {
|
@@ -51458,6 +51528,7 @@ async function createDepsOptimizer(config, server) {
|
|
51458
51528
|
let enqueuedRerun;
|
51459
51529
|
let currentlyProcessing = false;
|
51460
51530
|
let firstRunCalled = !!cachedMetadata;
|
51531
|
+
let warnAboutMissedDependencies = false;
|
51461
51532
|
// If this is a cold run, we wait for static imports discovered
|
51462
51533
|
// from the first request before resolving to minimize full page reloads.
|
51463
51534
|
// On warm start or after the first optimization is run, we use a simpler
|
@@ -51481,17 +51552,17 @@ async function createDepsOptimizer(config, server) {
|
|
51481
51552
|
// Enter processing state until crawl of static imports ends
|
51482
51553
|
currentlyProcessing = true;
|
51483
51554
|
// Initialize discovered deps with manually added optimizeDeps.include info
|
51484
|
-
const
|
51485
|
-
await addManuallyIncludedOptimizeDeps(
|
51486
|
-
const
|
51487
|
-
for (const depInfo of Object.values(
|
51555
|
+
const manuallyIncludedDeps = {};
|
51556
|
+
await addManuallyIncludedOptimizeDeps(manuallyIncludedDeps, config, ssr);
|
51557
|
+
const manuallyIncludedDepsInfo = toDiscoveredDependencies(config, manuallyIncludedDeps, ssr, sessionTimestamp);
|
51558
|
+
for (const depInfo of Object.values(manuallyIncludedDepsInfo)) {
|
51488
51559
|
addOptimizedDepInfo(metadata, 'discovered', {
|
51489
51560
|
...depInfo,
|
51490
51561
|
processing: depOptimizationProcessing.promise,
|
51491
51562
|
});
|
51492
51563
|
newDepsDiscovered = true;
|
51493
51564
|
}
|
51494
|
-
if (
|
51565
|
+
if (noDiscovery) {
|
51495
51566
|
// We don't need to scan for dependencies or wait for the static crawl to end
|
51496
51567
|
// Run the first optimization run immediately
|
51497
51568
|
runOptimizer();
|
@@ -51505,6 +51576,8 @@ async function createDepsOptimizer(config, server) {
|
|
51505
51576
|
discover = discoverProjectDependencies(config);
|
51506
51577
|
const deps = await discover.result;
|
51507
51578
|
discover = undefined;
|
51579
|
+
const manuallyIncluded = Object.keys(manuallyIncludedDepsInfo);
|
51580
|
+
discoveredDepsWhileScanning.push(...Object.keys(metadata.discovered).filter((dep) => !deps[dep] && !manuallyIncluded.includes(dep)));
|
51508
51581
|
// Add these dependencies to the discovered list, as these are currently
|
51509
51582
|
// used by the preAliasPlugin to support aliased and optimized deps.
|
51510
51583
|
// This is also used by the CJS externalization heuristics in legacy mode
|
@@ -51514,11 +51587,28 @@ async function createDepsOptimizer(config, server) {
|
|
51514
51587
|
}
|
51515
51588
|
}
|
51516
51589
|
const knownDeps = prepareKnownDeps();
|
51590
|
+
startNextDiscoveredBatch();
|
51517
51591
|
// For dev, we run the scanner and the first optimization
|
51518
|
-
// run on the background
|
51519
|
-
// to decide if we send this result to the browser or we need to
|
51520
|
-
// do another optimize step
|
51592
|
+
// run on the background
|
51521
51593
|
optimizationResult = runOptimizeDeps(config, knownDeps, ssr);
|
51594
|
+
// If the holdUntilCrawlEnd stratey is used, we wait until crawling has
|
51595
|
+
// ended to decide if we send this result to the browser or we need to
|
51596
|
+
// do another optimize step
|
51597
|
+
if (!holdUntilCrawlEnd) {
|
51598
|
+
// If not, we release the result to the browser as soon as the scanner
|
51599
|
+
// is done. If the scanner missed any dependency, and a new dependency
|
51600
|
+
// is discovered while crawling static imports, then there will be a
|
51601
|
+
// full-page reload if new common chunks are generated between the old
|
51602
|
+
// and new optimized deps.
|
51603
|
+
optimizationResult.result.then((result) => {
|
51604
|
+
// Check if the crawling of static imports has already finished. In that
|
51605
|
+
// case, the result is handled by the onCrawlEnd callback
|
51606
|
+
if (!crawlEndFinder)
|
51607
|
+
return;
|
51608
|
+
optimizationResult = undefined; // signal that we'll be using the result
|
51609
|
+
runOptimizer(result);
|
51610
|
+
});
|
51611
|
+
}
|
51522
51612
|
}
|
51523
51613
|
catch (e) {
|
51524
51614
|
logger.error(e.stack || e.message);
|
@@ -51650,6 +51740,11 @@ async function createDepsOptimizer(config, server) {
|
|
51650
51740
|
newDepsToLogHandle = setTimeout(() => {
|
51651
51741
|
newDepsToLogHandle = undefined;
|
51652
51742
|
logNewlyDiscoveredDeps();
|
51743
|
+
if (warnAboutMissedDependencies) {
|
51744
|
+
logDiscoveredDepsWhileScanning();
|
51745
|
+
config.logger.info(colors$1.magenta(`❗ add these dependencies to optimizeDeps.include to speed up cold start`), { timestamp: true });
|
51746
|
+
warnAboutMissedDependencies = false;
|
51747
|
+
}
|
51653
51748
|
}, 2 * debounceMs);
|
51654
51749
|
}
|
51655
51750
|
else {
|
@@ -51674,6 +51769,11 @@ async function createDepsOptimizer(config, server) {
|
|
51674
51769
|
clearTimeout(newDepsToLogHandle);
|
51675
51770
|
newDepsToLogHandle = undefined;
|
51676
51771
|
logNewlyDiscoveredDeps();
|
51772
|
+
if (warnAboutMissedDependencies) {
|
51773
|
+
logDiscoveredDepsWhileScanning();
|
51774
|
+
config.logger.info(colors$1.magenta(`❗ add these dependencies to optimizeDeps.include to avoid a full page reload during cold start`), { timestamp: true });
|
51775
|
+
warnAboutMissedDependencies = false;
|
51776
|
+
}
|
51677
51777
|
}
|
51678
51778
|
logger.info(colors$1.green(`✨ optimized dependencies changed. reloading`), {
|
51679
51779
|
timestamp: true,
|
@@ -51769,7 +51869,7 @@ async function createDepsOptimizer(config, server) {
|
|
51769
51869
|
}
|
51770
51870
|
function debouncedProcessing(timeout = debounceMs) {
|
51771
51871
|
// Debounced rerun, let other missing dependencies be discovered before
|
51772
|
-
// the
|
51872
|
+
// the next optimizeDeps run
|
51773
51873
|
enqueuedRerun = undefined;
|
51774
51874
|
if (debounceProcessingHandle)
|
51775
51875
|
clearTimeout(debounceProcessingHandle);
|
@@ -51798,8 +51898,16 @@ async function createDepsOptimizer(config, server) {
|
|
51798
51898
|
// It normally should be over by the time crawling of user code ended
|
51799
51899
|
await depsOptimizer.scanProcessing;
|
51800
51900
|
if (optimizationResult && !config.optimizeDeps.noDiscovery) {
|
51801
|
-
|
51802
|
-
|
51901
|
+
// In the holdUntilCrawlEnd strategy, we don't release the result of the
|
51902
|
+
// post-scanner optimize step to the browser until we reach this point
|
51903
|
+
// If there are new dependencies, we do another optimize run, if not, we
|
51904
|
+
// use the post-scanner optimize result
|
51905
|
+
// If holdUntilCrawlEnd is false and we reach here, it means that the
|
51906
|
+
// scan+optimize step finished after crawl end. We follow the same
|
51907
|
+
// process as in the holdUntilCrawlEnd in this case.
|
51908
|
+
const afterScanResult = optimizationResult.result;
|
51909
|
+
optimizationResult = undefined; // signal that we'll be using the result
|
51910
|
+
const result = await afterScanResult;
|
51803
51911
|
currentlyProcessing = false;
|
51804
51912
|
const crawlDeps = Object.keys(metadata.discovered);
|
51805
51913
|
const scanDeps = Object.keys(result.metadata.optimized);
|
@@ -51835,6 +51943,17 @@ async function createDepsOptimizer(config, server) {
|
|
51835
51943
|
runOptimizer(result);
|
51836
51944
|
}
|
51837
51945
|
}
|
51946
|
+
else if (!holdUntilCrawlEnd) {
|
51947
|
+
// The post-scanner optimize result has been released to the browser
|
51948
|
+
// If new deps have been discovered, issue a regular rerun of the
|
51949
|
+
// optimizer. A full page reload may still be avoided if the new
|
51950
|
+
// optimize result is compatible in this case
|
51951
|
+
if (newDepsDiscovered) {
|
51952
|
+
debug$8?.(colors$1.green(`✨ new dependencies were found while crawling static imports, re-running optimizer`));
|
51953
|
+
warnAboutMissedDependencies = true;
|
51954
|
+
debouncedProcessing(0);
|
51955
|
+
}
|
51956
|
+
}
|
51838
51957
|
else {
|
51839
51958
|
const crawlDeps = Object.keys(metadata.discovered);
|
51840
51959
|
currentlyProcessing = false;
|
@@ -53464,7 +53583,7 @@ async function handleModuleSoftInvalidation(mod, ssr, timestamp, server) {
|
|
53464
53583
|
await init;
|
53465
53584
|
const source = transformResult.code;
|
53466
53585
|
const s = new MagicString(source);
|
53467
|
-
const [imports] = parse$e(source);
|
53586
|
+
const [imports] = parse$e(source, mod.id || undefined);
|
53468
53587
|
for (const imp of imports) {
|
53469
53588
|
let rawUrl = source.slice(imp.s, imp.e);
|
53470
53589
|
if (rawUrl === 'import.meta')
|
@@ -62722,7 +62841,7 @@ function proxyMiddleware(httpServer, options, config) {
|
|
62722
62841
|
});
|
62723
62842
|
}
|
62724
62843
|
else if ('req' in res) {
|
62725
|
-
config.logger.error(`${colors$1.red(`http proxy error
|
62844
|
+
config.logger.error(`${colors$1.red(`http proxy error: ${originalRes.req.url}`)}\n${err.stack}`, {
|
62726
62845
|
timestamp: true,
|
62727
62846
|
error: err,
|
62728
62847
|
});
|
@@ -63822,68 +63941,6 @@ function notFoundMiddleware() {
|
|
63822
63941
|
};
|
63823
63942
|
}
|
63824
63943
|
|
63825
|
-
// https://github.com/vitejs/vite/issues/2820#issuecomment-812495079
|
63826
|
-
const ROOT_FILES = [
|
63827
|
-
// '.git',
|
63828
|
-
// https://pnpm.io/workspaces/
|
63829
|
-
'pnpm-workspace.yaml',
|
63830
|
-
// https://rushjs.io/pages/advanced/config_files/
|
63831
|
-
// 'rush.json',
|
63832
|
-
// https://nx.dev/latest/react/getting-started/nx-setup
|
63833
|
-
// 'workspace.json',
|
63834
|
-
// 'nx.json',
|
63835
|
-
// https://github.com/lerna/lerna#lernajson
|
63836
|
-
'lerna.json',
|
63837
|
-
];
|
63838
|
-
// npm: https://docs.npmjs.com/cli/v7/using-npm/workspaces#installing-workspaces
|
63839
|
-
// yarn: https://classic.yarnpkg.com/en/docs/workspaces/#toc-how-to-use-it
|
63840
|
-
function hasWorkspacePackageJSON(root) {
|
63841
|
-
const path = join$2(root, 'package.json');
|
63842
|
-
if (!isFileReadable(path)) {
|
63843
|
-
return false;
|
63844
|
-
}
|
63845
|
-
try {
|
63846
|
-
const content = JSON.parse(fs$l.readFileSync(path, 'utf-8')) || {};
|
63847
|
-
return !!content.workspaces;
|
63848
|
-
}
|
63849
|
-
catch {
|
63850
|
-
return false;
|
63851
|
-
}
|
63852
|
-
}
|
63853
|
-
function hasRootFile(root) {
|
63854
|
-
return ROOT_FILES.some((file) => fs$l.existsSync(join$2(root, file)));
|
63855
|
-
}
|
63856
|
-
function hasPackageJSON(root) {
|
63857
|
-
const path = join$2(root, 'package.json');
|
63858
|
-
return fs$l.existsSync(path);
|
63859
|
-
}
|
63860
|
-
/**
|
63861
|
-
* Search up for the nearest `package.json`
|
63862
|
-
*/
|
63863
|
-
function searchForPackageRoot(current, root = current) {
|
63864
|
-
if (hasPackageJSON(current))
|
63865
|
-
return current;
|
63866
|
-
const dir = dirname$2(current);
|
63867
|
-
// reach the fs root
|
63868
|
-
if (!dir || dir === current)
|
63869
|
-
return root;
|
63870
|
-
return searchForPackageRoot(dir, root);
|
63871
|
-
}
|
63872
|
-
/**
|
63873
|
-
* Search up for the nearest workspace root
|
63874
|
-
*/
|
63875
|
-
function searchForWorkspaceRoot(current, root = searchForPackageRoot(current)) {
|
63876
|
-
if (hasRootFile(current))
|
63877
|
-
return current;
|
63878
|
-
if (hasWorkspacePackageJSON(current))
|
63879
|
-
return current;
|
63880
|
-
const dir = dirname$2(current);
|
63881
|
-
// reach the fs root
|
63882
|
-
if (!dir || dir === current)
|
63883
|
-
return root;
|
63884
|
-
return searchForWorkspaceRoot(dir, root);
|
63885
|
-
}
|
63886
|
-
|
63887
63944
|
function warmupFiles(server) {
|
63888
63945
|
const options = server.config.server.warmup;
|
63889
63946
|
const root = server.config.root;
|
@@ -64436,7 +64493,7 @@ function resolveServerOptions(root, raw, logger) {
|
|
64436
64493
|
strict: server.fs?.strict ?? true,
|
64437
64494
|
allow: allowDirs,
|
64438
64495
|
deny,
|
64439
|
-
cachedChecks: server.fs?.cachedChecks ??
|
64496
|
+
cachedChecks: server.fs?.cachedChecks ?? true,
|
64440
64497
|
};
|
64441
64498
|
if (server.origin?.endsWith('/')) {
|
64442
64499
|
server.origin = server.origin.slice(0, -1);
|
@@ -65488,7 +65545,7 @@ function importAnalysisPlugin(config) {
|
|
65488
65545
|
// `importedUrls` will be mixed with watched files for the module graph,
|
65489
65546
|
// `staticImportedUrls` will only contain the static top-level imports and
|
65490
65547
|
// dynamic imports
|
65491
|
-
const staticImportedUrls = new Set(_orderedImportedUrls);
|
65548
|
+
const staticImportedUrls = new Set(_orderedImportedUrls.map((url) => removeTimestampQuery(url)));
|
65492
65549
|
const acceptedUrls = mergeAcceptedUrls(orderedAcceptedUrls);
|
65493
65550
|
const acceptedExports = mergeAcceptedUrls(orderedAcceptedExports);
|
65494
65551
|
// While we always expect to work with ESM, a classic worker is the only
|
@@ -66407,7 +66464,7 @@ async function build(inlineConfig = {}) {
|
|
66407
66464
|
const options = config.build;
|
66408
66465
|
const ssr = !!options.ssr;
|
66409
66466
|
const libOptions = options.lib;
|
66410
|
-
config.logger.info(colors$1.cyan(`vite v${VERSION
|
66467
|
+
config.logger.info(colors$1.cyan(`vite v${VERSION} ${colors$1.green(`building ${ssr ? `SSR bundle ` : ``}for ${config.mode}...`)}`));
|
66411
66468
|
const resolve = (p) => path$o.resolve(config.root, p);
|
66412
66469
|
const input = libOptions
|
66413
66470
|
? options.rollupOptions?.input ||
|
@@ -66439,9 +66496,6 @@ async function build(inlineConfig = {}) {
|
|
66439
66496
|
const outDir = resolve(options.outDir);
|
66440
66497
|
// inject ssr arg to plugin load/transform hooks
|
66441
66498
|
const plugins = (ssr ? config.plugins.map((p) => injectSsrFlagToHooks(p)) : config.plugins);
|
66442
|
-
if (isDepsOptimizerEnabled(config, ssr)) {
|
66443
|
-
await initDepsOptimizer(config);
|
66444
|
-
}
|
66445
66499
|
const rollupOptions = {
|
66446
66500
|
preserveEntrySignatures: ssr
|
66447
66501
|
? 'allow-extension'
|
@@ -66457,7 +66511,7 @@ async function build(inlineConfig = {}) {
|
|
66457
66511
|
onRollupWarning(warning, warn, config);
|
66458
66512
|
},
|
66459
66513
|
};
|
66460
|
-
const
|
66514
|
+
const mergeRollupError = (e) => {
|
66461
66515
|
let msg = colors$1.red((e.plugin ? `[${e.plugin}] ` : '') + e.message);
|
66462
66516
|
if (e.id) {
|
66463
66517
|
msg += `\nfile: ${colors$1.cyan(e.id + (e.loc ? `:${e.loc.line}:${e.loc.column}` : ''))}`;
|
@@ -66465,6 +66519,10 @@ async function build(inlineConfig = {}) {
|
|
66465
66519
|
if (e.frame) {
|
66466
66520
|
msg += `\n` + colors$1.yellow(e.frame);
|
66467
66521
|
}
|
66522
|
+
return msg;
|
66523
|
+
};
|
66524
|
+
const outputBuildError = (e) => {
|
66525
|
+
const msg = mergeRollupError(e);
|
66468
66526
|
clearLine();
|
66469
66527
|
config.logger.error(msg, { error: e });
|
66470
66528
|
};
|
@@ -66577,7 +66635,8 @@ async function build(inlineConfig = {}) {
|
|
66577
66635
|
return Array.isArray(outputs) ? res : res[0];
|
66578
66636
|
}
|
66579
66637
|
catch (e) {
|
66580
|
-
|
66638
|
+
e.message = mergeRollupError(e);
|
66639
|
+
clearLine();
|
66581
66640
|
throw e;
|
66582
66641
|
}
|
66583
66642
|
finally {
|
@@ -67081,7 +67140,7 @@ function resolvePreviewOptions(preview, server) {
|
|
67081
67140
|
* Starts the Vite server in preview mode, to simulate a production deployment
|
67082
67141
|
*/
|
67083
67142
|
async function preview(inlineConfig = {}) {
|
67084
|
-
const config = await resolveConfig(inlineConfig, 'serve', 'production', 'production');
|
67143
|
+
const config = await resolveConfig(inlineConfig, 'serve', 'production', 'production', true);
|
67085
67144
|
const distDir = path$o.resolve(config.root, config.build.outDir);
|
67086
67145
|
if (!fs$l.existsSync(distDir) &&
|
67087
67146
|
// error if no plugins implement `configurePreviewServer`
|
@@ -67481,6 +67540,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = 'development',
|
|
67481
67540
|
packageCache,
|
67482
67541
|
createResolver,
|
67483
67542
|
optimizeDeps: {
|
67543
|
+
holdUntilCrawlEnd: true,
|
67484
67544
|
...optimizeDeps,
|
67485
67545
|
esbuildOptions: {
|
67486
67546
|
preserveSymlinks: resolveOptions.preserveSymlinks,
|
@@ -67847,4 +67907,4 @@ function optimizeDepsDisabledBackwardCompatibility(resolved, optimizeDeps, optim
|
|
67847
67907
|
}
|
67848
67908
|
}
|
67849
67909
|
|
67850
|
-
export {
|
67910
|
+
export { getDefaultExportFromCjs as A, commonjsGlobal as B, index$1 as C, index as D, build$1 as E, preview$1 as F, arraify as a, build as b, createServer as c, defineConfig as d, preprocessCSS as e, formatPostcssSourceMap as f, buildErrorMessage as g, mergeAlias as h, isInNodeModules$1 as i, createFilter as j, rollupVersion as k, loadConfigFromFile as l, mergeConfig as m, normalizePath$3 as n, optimizeDeps as o, preview as p, send as q, resolveConfig as r, sortUserPlugins as s, transformWithEsbuild as t, createLogger as u, searchForWorkspaceRoot as v, isFileServingAllowed as w, loadEnv as x, resolveEnvPrefix as y, colors$1 as z };
|
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 {
|
5
|
+
import { z as colors, u as createLogger, r as resolveConfig } from './chunks/dep-Y86Adl1p.js';
|
6
6
|
import { VERSION } from './constants.js';
|
7
7
|
import 'node:fs/promises';
|
8
8
|
import 'node:url';
|
@@ -32,7 +32,6 @@ import 'node:assert';
|
|
32
32
|
import 'node:v8';
|
33
33
|
import 'node:worker_threads';
|
34
34
|
import 'node:buffer';
|
35
|
-
import 'rollup';
|
36
35
|
import 'rollup/parseAst';
|
37
36
|
import 'querystring';
|
38
37
|
import 'node:readline';
|
@@ -758,7 +757,7 @@ cli
|
|
758
757
|
filterDuplicateOptions(options);
|
759
758
|
// output structure is preserved even after bundling so require()
|
760
759
|
// is ok here
|
761
|
-
const { createServer } = await import('./chunks/dep-
|
760
|
+
const { createServer } = await import('./chunks/dep-Y86Adl1p.js').then(function (n) { return n.D; });
|
762
761
|
try {
|
763
762
|
const server = await createServer({
|
764
763
|
root,
|
@@ -838,7 +837,7 @@ cli
|
|
838
837
|
.option('-w, --watch', `[boolean] rebuilds when modules have changed on disk`)
|
839
838
|
.action(async (root, options) => {
|
840
839
|
filterDuplicateOptions(options);
|
841
|
-
const { build } = await import('./chunks/dep-
|
840
|
+
const { build } = await import('./chunks/dep-Y86Adl1p.js').then(function (n) { return n.E; });
|
842
841
|
const buildOptions = cleanOptions(options);
|
843
842
|
try {
|
844
843
|
await build({
|
@@ -866,7 +865,7 @@ cli
|
|
866
865
|
.option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
|
867
866
|
.action(async (root, options) => {
|
868
867
|
filterDuplicateOptions(options);
|
869
|
-
const { optimizeDeps } = await import('./chunks/dep-
|
868
|
+
const { optimizeDeps } = await import('./chunks/dep-Y86Adl1p.js').then(function (n) { return n.C; });
|
870
869
|
try {
|
871
870
|
const config = await resolveConfig({
|
872
871
|
root,
|
@@ -892,7 +891,7 @@ cli
|
|
892
891
|
.option('--outDir <dir>', `[string] output directory (default: dist)`)
|
893
892
|
.action(async (root, options) => {
|
894
893
|
filterDuplicateOptions(options);
|
895
|
-
const { preview } = await import('./chunks/dep-
|
894
|
+
const { preview } = await import('./chunks/dep-Y86Adl1p.js').then(function (n) { return n.F; });
|
896
895
|
try {
|
897
896
|
const server = await preview({
|
898
897
|
root,
|
package/dist/node/index.d.ts
CHANGED
@@ -2,7 +2,6 @@
|
|
2
2
|
import { PluginHooks, RollupError, SourceMap, ModuleInfo, PartialResolvedId, InputOptions, CustomPluginOptions, SourceDescription, LoadResult, RollupOptions, WatcherOptions, InputOption, ModuleFormat, RollupOutput, RollupWatcher, SourceMapInput, ExistingRawSourceMap, OutputBundle, OutputChunk, ObjectHook, PluginContext, ResolveIdResult, TransformPluginContext, GetManualChunk } from 'rollup';
|
3
3
|
import * as rollup from 'rollup';
|
4
4
|
export { rollup as Rollup };
|
5
|
-
export { VERSION as rollupVersion } from 'rollup';
|
6
5
|
export { parseAst, parseAstAsync } from 'rollup/parseAst';
|
7
6
|
import * as http from 'node:http';
|
8
7
|
import { OutgoingHttpHeaders, ClientRequestArgs, IncomingMessage, ClientRequest, Agent, Server, ServerResponse } from 'node:http';
|
@@ -1627,7 +1626,7 @@ interface FileSystemServeOptions {
|
|
1627
1626
|
* Enable caching of fs calls.
|
1628
1627
|
*
|
1629
1628
|
* @experimental
|
1630
|
-
* @default
|
1629
|
+
* @default true
|
1631
1630
|
*/
|
1632
1631
|
cachedChecks?: boolean;
|
1633
1632
|
}
|
@@ -2585,6 +2584,17 @@ interface DepOptimizationConfig {
|
|
2585
2584
|
* @experimental
|
2586
2585
|
*/
|
2587
2586
|
noDiscovery?: boolean;
|
2587
|
+
/**
|
2588
|
+
* When enabled, it will hold the first optimized deps results until all static
|
2589
|
+
* imports are crawled on cold start. This avoids the need for full-page reloads
|
2590
|
+
* when new dependencies are discovered and they trigger the generation of new
|
2591
|
+
* common chunks. If all dependencies are found by the scanner plus the explicitely
|
2592
|
+
* defined ones in `include`, it is better to disable this option to let the
|
2593
|
+
* browser process more requests in parallel.
|
2594
|
+
* @default true
|
2595
|
+
* @experimental
|
2596
|
+
*/
|
2597
|
+
holdUntilCrawlEnd?: boolean;
|
2588
2598
|
}
|
2589
2599
|
type DepOptimizationOptions = DepOptimizationConfig & {
|
2590
2600
|
/**
|
@@ -3377,6 +3387,7 @@ type FilterPattern = ReadonlyArray<string | RegExp> | string | RegExp | null;
|
|
3377
3387
|
declare const createFilter: (include?: FilterPattern, exclude?: FilterPattern, options?: {
|
3378
3388
|
resolve?: string | false | null;
|
3379
3389
|
}) => (id: string | unknown) => boolean;
|
3390
|
+
declare const rollupVersion: string;
|
3380
3391
|
declare function normalizePath(id: string): string;
|
3381
3392
|
declare function mergeConfig<D extends Record<string, any>, O extends Record<string, any>>(defaults: D extends Function ? never : D, overrides: O extends Function ? never : O, isRoot?: boolean): Record<string, any>;
|
3382
3393
|
declare function mergeAlias(a?: AliasOptions, b?: AliasOptions): AliasOptions | undefined;
|
@@ -3416,4 +3427,4 @@ interface ManifestChunk {
|
|
3416
3427
|
dynamicImports?: string[];
|
3417
3428
|
}
|
3418
3429
|
|
3419
|
-
export { type Alias, type AliasOptions, type AnymatchFn, type AnymatchPattern, type AppType, type AwaitWriteFinishOptions, type BindCLIShortcutsOptions, type BuildOptions, type CLIShortcut, type CSSModulesOptions, type CSSOptions, type CommonServerOptions, type ConfigEnv, Connect, type CorsOptions, type CorsOrigin, type DepOptimizationConfig, type DepOptimizationMetadata, type DepOptimizationOptions, type ESBuildOptions, type ESBuildTransformResult, type ExperimentalOptions, type ExportsData, FSWatcher, type FileSystemServeOptions, type FilterPattern, type HmrContext, type HmrOptions, type HookHandler, type HtmlTagDescriptor, HttpProxy, type IndexHtmlTransform, type IndexHtmlTransformContext, type IndexHtmlTransformHook, type IndexHtmlTransformResult, type InlineConfig, type InternalResolveOptions, type JsonOptions, type LegacyOptions, type LibraryFormats, type LibraryOptions, type LightningCSSOptions, type LogErrorOptions, type LogLevel, type LogOptions, type LogType, type Logger, type LoggerOptions, type Manifest, type ManifestChunk, type MapToFunction, type AnymatchMatcher as Matcher, ModuleGraph, ModuleNode, type ModulePreloadOptions, type OptimizedDepInfo, type Plugin, type PluginContainer, type PluginHookUtils, type PluginOption, type PreprocessCSSResult, type PreviewOptions, type PreviewServer, type PreviewServerHook, type ProxyOptions, type RenderBuiltAssetUrl, type ResolveFn, type ResolveModulePreloadDependenciesFn, type ResolveOptions, type ResolvedBuildOptions, type ResolvedCSSOptions, type ResolvedConfig, type ResolvedModulePreloadOptions, type ResolvedPreviewOptions, type ResolvedSSROptions, type ResolvedServerOptions, type ResolvedServerUrls, type ResolvedUrl, type ResolvedWorkerOptions, type ResolverFunction, type ResolverObject, type RollupCommonJSOptions, type RollupDynamicImportVarsOptions, type SSROptions, type SSRTarget, type SendOptions, type ServerHook, type ServerOptions, SplitVendorChunkCache, type SsrDepOptimizationOptions, Terser, type TerserOptions, type TransformOptions, type TransformResult, type UserConfig, type UserConfigExport, type UserConfigFn, type UserConfigFnObject, type UserConfigFnPromise, type ViteDevServer, type WatchOptions, WebSocket, WebSocketAlias, type WebSocketClient, type WebSocketCustomListener, WebSocketServer, build, buildErrorMessage, createFilter, createLogger, createServer, defineConfig, formatPostcssSourceMap, isCSSRequest, isFileServingAllowed, loadConfigFromFile, loadEnv, mergeAlias, mergeConfig, normalizePath, optimizeDeps, preprocessCSS, preview, resolveConfig, resolveEnvPrefix, searchForWorkspaceRoot, send, sortUserPlugins, splitVendorChunk, splitVendorChunkPlugin, transformWithEsbuild, VERSION as version };
|
3430
|
+
export { type Alias, type AliasOptions, type AnymatchFn, type AnymatchPattern, type AppType, type AwaitWriteFinishOptions, type BindCLIShortcutsOptions, type BuildOptions, type CLIShortcut, type CSSModulesOptions, type CSSOptions, type CommonServerOptions, type ConfigEnv, Connect, type CorsOptions, type CorsOrigin, type DepOptimizationConfig, type DepOptimizationMetadata, type DepOptimizationOptions, type ESBuildOptions, type ESBuildTransformResult, type ExperimentalOptions, type ExportsData, FSWatcher, type FileSystemServeOptions, type FilterPattern, type HmrContext, type HmrOptions, type HookHandler, type HtmlTagDescriptor, HttpProxy, type IndexHtmlTransform, type IndexHtmlTransformContext, type IndexHtmlTransformHook, type IndexHtmlTransformResult, type InlineConfig, type InternalResolveOptions, type JsonOptions, type LegacyOptions, type LibraryFormats, type LibraryOptions, type LightningCSSOptions, type LogErrorOptions, type LogLevel, type LogOptions, type LogType, type Logger, type LoggerOptions, type Manifest, type ManifestChunk, type MapToFunction, type AnymatchMatcher as Matcher, ModuleGraph, ModuleNode, type ModulePreloadOptions, type OptimizedDepInfo, type Plugin, type PluginContainer, type PluginHookUtils, type PluginOption, type PreprocessCSSResult, type PreviewOptions, type PreviewServer, type PreviewServerHook, type ProxyOptions, type RenderBuiltAssetUrl, type ResolveFn, type ResolveModulePreloadDependenciesFn, type ResolveOptions, type ResolvedBuildOptions, type ResolvedCSSOptions, type ResolvedConfig, type ResolvedModulePreloadOptions, type ResolvedPreviewOptions, type ResolvedSSROptions, type ResolvedServerOptions, type ResolvedServerUrls, type ResolvedUrl, type ResolvedWorkerOptions, type ResolverFunction, type ResolverObject, type RollupCommonJSOptions, type RollupDynamicImportVarsOptions, type SSROptions, type SSRTarget, type SendOptions, type ServerHook, type ServerOptions, SplitVendorChunkCache, type SsrDepOptimizationOptions, Terser, type TerserOptions, type TransformOptions, type TransformResult, type UserConfig, type UserConfigExport, type UserConfigFn, type UserConfigFnObject, type UserConfigFnPromise, type ViteDevServer, type WatchOptions, WebSocket, WebSocketAlias, type WebSocketClient, type WebSocketCustomListener, WebSocketServer, build, buildErrorMessage, createFilter, createLogger, createServer, defineConfig, formatPostcssSourceMap, isCSSRequest, isFileServingAllowed, loadConfigFromFile, loadEnv, mergeAlias, mergeConfig, normalizePath, optimizeDeps, preprocessCSS, preview, resolveConfig, resolveEnvPrefix, rollupVersion, searchForWorkspaceRoot, send, sortUserPlugins, splitVendorChunk, splitVendorChunkPlugin, transformWithEsbuild, VERSION as version };
|
package/dist/node/index.js
CHANGED
@@ -1,9 +1,8 @@
|
|
1
1
|
export { parseAst, parseAstAsync } from 'rollup/parseAst';
|
2
|
-
import { i as isInNodeModules, a as arraify } from './chunks/dep-
|
3
|
-
export { b as build, g as buildErrorMessage, j as createFilter,
|
2
|
+
import { i as isInNodeModules, a as arraify } from './chunks/dep-Y86Adl1p.js';
|
3
|
+
export { b as build, g as buildErrorMessage, j as createFilter, u as createLogger, c as createServer, d as defineConfig, f as formatPostcssSourceMap, w as isFileServingAllowed, l as loadConfigFromFile, x as loadEnv, h as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, e as preprocessCSS, p as preview, r as resolveConfig, y as resolveEnvPrefix, k as rollupVersion, v as searchForWorkspaceRoot, q as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-Y86Adl1p.js';
|
4
4
|
export { VERSION as version } from './constants.js';
|
5
5
|
export { version as esbuildVersion } from 'esbuild';
|
6
|
-
export { VERSION as rollupVersion } from 'rollup';
|
7
6
|
import 'node:fs';
|
8
7
|
import 'node:fs/promises';
|
9
8
|
import 'node:path';
|
@@ -4,7 +4,6 @@ var path$3 = require('node:path');
|
|
4
4
|
var node_url = require('node:url');
|
5
5
|
var fs$1 = require('node:fs');
|
6
6
|
var esbuild = require('esbuild');
|
7
|
-
var rollup = require('rollup');
|
8
7
|
var os$1 = require('node:os');
|
9
8
|
var node_module = require('node:module');
|
10
9
|
var require$$0 = require('tty');
|
@@ -3374,7 +3373,12 @@ function isInNodeModules(id) {
|
|
3374
3373
|
return id.includes('node_modules');
|
3375
3374
|
}
|
3376
3375
|
// TODO: use import()
|
3377
|
-
node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('node-cjs/publicUtils.cjs', document.baseURI).href)));
|
3376
|
+
const _require = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('node-cjs/publicUtils.cjs', document.baseURI).href)));
|
3377
|
+
function resolveDependencyVersion(dep, pkgRelativePath = '../../package.json') {
|
3378
|
+
const pkgPath = path$3.resolve(_require.resolve(dep), pkgRelativePath);
|
3379
|
+
return JSON.parse(fs$1.readFileSync(pkgPath, 'utf-8')).version;
|
3380
|
+
}
|
3381
|
+
const rollupVersion = resolveDependencyVersion('rollup');
|
3378
3382
|
// set in bin/vite.js
|
3379
3383
|
const filter = process.env.VITE_DEBUG_FILTER;
|
3380
3384
|
const DEBUG = process.env.DEBUG;
|
@@ -5541,7 +5545,7 @@ function isFileServingAllowed(url, server) {
|
|
5541
5545
|
var main$1 = {exports: {}};
|
5542
5546
|
|
5543
5547
|
var name = "dotenv";
|
5544
|
-
var version$1 = "16.3.
|
5548
|
+
var version$1 = "16.3.2";
|
5545
5549
|
var description = "Loads environment variables from .env file";
|
5546
5550
|
var main = "lib/main.js";
|
5547
5551
|
var types = "lib/main.d.ts";
|
@@ -5812,6 +5816,10 @@ function configDotenv (options) {
|
|
5812
5816
|
}
|
5813
5817
|
if (options.encoding != null) {
|
5814
5818
|
encoding = options.encoding;
|
5819
|
+
} else {
|
5820
|
+
if (debug) {
|
5821
|
+
_debug('No encoding is specified. UTF-8 is used by default');
|
5822
|
+
}
|
5815
5823
|
}
|
5816
5824
|
}
|
5817
5825
|
|
@@ -5859,9 +5867,9 @@ function decrypt (encrypted, keyStr) {
|
|
5859
5867
|
const key = Buffer.from(keyStr.slice(-64), 'hex');
|
5860
5868
|
let ciphertext = Buffer.from(encrypted, 'base64');
|
5861
5869
|
|
5862
|
-
const nonce = ciphertext.
|
5863
|
-
const authTag = ciphertext.
|
5864
|
-
ciphertext = ciphertext.
|
5870
|
+
const nonce = ciphertext.subarray(0, 12);
|
5871
|
+
const authTag = ciphertext.subarray(-16);
|
5872
|
+
ciphertext = ciphertext.subarray(12, -16);
|
5865
5873
|
|
5866
5874
|
try {
|
5867
5875
|
const aesgcm = crypto.createDecipheriv('aes-256-gcm', key, nonce);
|
@@ -6073,7 +6081,6 @@ function resolveEnvPrefix({ envPrefix = 'VITE_', }) {
|
|
6073
6081
|
}
|
6074
6082
|
|
6075
6083
|
exports.esbuildVersion = esbuild.version;
|
6076
|
-
exports.rollupVersion = rollup.VERSION;
|
6077
6084
|
exports.createFilter = createFilter;
|
6078
6085
|
exports.createLogger = createLogger;
|
6079
6086
|
exports.isCSSRequest = isCSSRequest;
|
@@ -6083,6 +6090,7 @@ exports.mergeAlias = mergeAlias;
|
|
6083
6090
|
exports.mergeConfig = mergeConfig;
|
6084
6091
|
exports.normalizePath = normalizePath;
|
6085
6092
|
exports.resolveEnvPrefix = resolveEnvPrefix;
|
6093
|
+
exports.rollupVersion = rollupVersion;
|
6086
6094
|
exports.searchForWorkspaceRoot = searchForWorkspaceRoot;
|
6087
6095
|
exports.send = send;
|
6088
6096
|
exports.splitVendorChunk = splitVendorChunk;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "vite",
|
3
|
-
"version": "5.1.0-beta.
|
3
|
+
"version": "5.1.0-beta.5",
|
4
4
|
"type": "module",
|
5
5
|
"license": "MIT",
|
6
6
|
"author": "Evan You",
|
@@ -71,7 +71,7 @@
|
|
71
71
|
"devDependencies": {
|
72
72
|
"@ampproject/remapping": "^2.2.1",
|
73
73
|
"@babel/parser": "^7.23.6",
|
74
|
-
"@jridgewell/trace-mapping": "^0.3.
|
74
|
+
"@jridgewell/trace-mapping": "^0.3.22",
|
75
75
|
"@rollup/plugin-alias": "^5.1.0",
|
76
76
|
"@rollup/plugin-commonjs": "^25.0.7",
|
77
77
|
"@rollup/plugin-dynamic-import-vars": "^2.1.2",
|
@@ -92,7 +92,7 @@
|
|
92
92
|
"cross-spawn": "^7.0.3",
|
93
93
|
"debug": "^4.3.4",
|
94
94
|
"dep-types": "link:./src/types",
|
95
|
-
"dotenv": "^16.3.
|
95
|
+
"dotenv": "^16.3.2",
|
96
96
|
"dotenv-expand": "^10.0.0",
|
97
97
|
"es-module-lexer": "^1.4.1",
|
98
98
|
"escape-html": "^1.0.3",
|