vite 5.1.0-beta.3 → 5.1.0-beta.4
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-0RU5--AQ.js} +1 -1
- package/dist/node/chunks/{dep-jalgWsWD.js → dep-2l_yqaZo.js} +164 -105
- package/dist/node/chunks/{dep-A6C2SOTv.js → dep-y3MfcbcG.js} +1 -1
- 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 +7 -3
- package/package.json +1 -1
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { B as commonjsGlobal, A as getDefaultExportFromCjs } from './dep-2l_yqaZo.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 {
|
@@ -31994,8 +31998,8 @@ function createCachedImport(imp) {
|
|
31994
31998
|
return cached;
|
31995
31999
|
};
|
31996
32000
|
}
|
31997
|
-
const importPostcssImport = createCachedImport(() => import('./dep-
|
31998
|
-
const importPostcssModules = createCachedImport(() => import('./dep-
|
32001
|
+
const importPostcssImport = createCachedImport(() => import('./dep-y3MfcbcG.js').then(function (n) { return n.i; }));
|
32002
|
+
const importPostcssModules = createCachedImport(() => import('./dep-0RU5--AQ.js').then(function (n) { return n.i; }));
|
31999
32003
|
const importPostcss = createCachedImport(() => import('postcss'));
|
32000
32004
|
const preprocessorWorkerControllerCache = new WeakMap();
|
32001
32005
|
let alwaysFakeWorkerWorkerControllerCache;
|
@@ -46768,6 +46772,68 @@ function setClientErrorHandler(server, logger) {
|
|
46768
46772
|
});
|
46769
46773
|
}
|
46770
46774
|
|
46775
|
+
// https://github.com/vitejs/vite/issues/2820#issuecomment-812495079
|
46776
|
+
const ROOT_FILES = [
|
46777
|
+
// '.git',
|
46778
|
+
// https://pnpm.io/workspaces/
|
46779
|
+
'pnpm-workspace.yaml',
|
46780
|
+
// https://rushjs.io/pages/advanced/config_files/
|
46781
|
+
// 'rush.json',
|
46782
|
+
// https://nx.dev/latest/react/getting-started/nx-setup
|
46783
|
+
// 'workspace.json',
|
46784
|
+
// 'nx.json',
|
46785
|
+
// https://github.com/lerna/lerna#lernajson
|
46786
|
+
'lerna.json',
|
46787
|
+
];
|
46788
|
+
// npm: https://docs.npmjs.com/cli/v7/using-npm/workspaces#installing-workspaces
|
46789
|
+
// yarn: https://classic.yarnpkg.com/en/docs/workspaces/#toc-how-to-use-it
|
46790
|
+
function hasWorkspacePackageJSON(root) {
|
46791
|
+
const path = join$2(root, 'package.json');
|
46792
|
+
if (!isFileReadable(path)) {
|
46793
|
+
return false;
|
46794
|
+
}
|
46795
|
+
try {
|
46796
|
+
const content = JSON.parse(fs$l.readFileSync(path, 'utf-8')) || {};
|
46797
|
+
return !!content.workspaces;
|
46798
|
+
}
|
46799
|
+
catch {
|
46800
|
+
return false;
|
46801
|
+
}
|
46802
|
+
}
|
46803
|
+
function hasRootFile(root) {
|
46804
|
+
return ROOT_FILES.some((file) => fs$l.existsSync(join$2(root, file)));
|
46805
|
+
}
|
46806
|
+
function hasPackageJSON(root) {
|
46807
|
+
const path = join$2(root, 'package.json');
|
46808
|
+
return fs$l.existsSync(path);
|
46809
|
+
}
|
46810
|
+
/**
|
46811
|
+
* Search up for the nearest `package.json`
|
46812
|
+
*/
|
46813
|
+
function searchForPackageRoot(current, root = current) {
|
46814
|
+
if (hasPackageJSON(current))
|
46815
|
+
return current;
|
46816
|
+
const dir = dirname$2(current);
|
46817
|
+
// reach the fs root
|
46818
|
+
if (!dir || dir === current)
|
46819
|
+
return root;
|
46820
|
+
return searchForPackageRoot(dir, root);
|
46821
|
+
}
|
46822
|
+
/**
|
46823
|
+
* Search up for the nearest workspace root
|
46824
|
+
*/
|
46825
|
+
function searchForWorkspaceRoot(current, root = searchForPackageRoot(current)) {
|
46826
|
+
if (hasRootFile(current))
|
46827
|
+
return current;
|
46828
|
+
if (hasWorkspacePackageJSON(current))
|
46829
|
+
return current;
|
46830
|
+
const dir = dirname$2(current);
|
46831
|
+
// reach the fs root
|
46832
|
+
if (!dir || dir === current)
|
46833
|
+
return root;
|
46834
|
+
return searchForWorkspaceRoot(dir, root);
|
46835
|
+
}
|
46836
|
+
|
46771
46837
|
// An implementation of fsUtils without caching
|
46772
46838
|
const commonFsUtils = {
|
46773
46839
|
existsSync: fs$l.existsSync,
|
@@ -46784,20 +46850,9 @@ function getFsUtils(config) {
|
|
46784
46850
|
// cached fsUtils is only used in the dev server for now, and only when the watcher isn't configured
|
46785
46851
|
// we can support custom ignored patterns later
|
46786
46852
|
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
|
-
} */
|
46853
|
+
}
|
46798
46854
|
else if (!config.resolve.preserveSymlinks &&
|
46799
46855
|
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
46856
|
fsUtils = commonFsUtils;
|
46802
46857
|
}
|
46803
46858
|
else {
|
@@ -46850,7 +46905,7 @@ function pathUntilPart(root, parts, i) {
|
|
46850
46905
|
return p;
|
46851
46906
|
}
|
46852
46907
|
function createCachedFsUtils(config) {
|
46853
|
-
const root = config.root;
|
46908
|
+
const root = normalizePath$3(searchForWorkspaceRoot(config.root));
|
46854
46909
|
const rootDirPath = `${root}/`;
|
46855
46910
|
const rootCache = { type: 'directory' }; // dirents will be computed lazily
|
46856
46911
|
const getDirentCacheSync = (parts) => {
|
@@ -46921,7 +46976,7 @@ function createCachedFsUtils(config) {
|
|
46921
46976
|
return direntCache;
|
46922
46977
|
}
|
46923
46978
|
function onPathAdd(file, type) {
|
46924
|
-
const direntCache = getDirentCacheFromPath(path$o.dirname(file));
|
46979
|
+
const direntCache = getDirentCacheFromPath(normalizePath$3(path$o.dirname(file)));
|
46925
46980
|
if (direntCache &&
|
46926
46981
|
direntCache.type === 'directory' &&
|
46927
46982
|
direntCache.dirents) {
|
@@ -46929,7 +46984,7 @@ function createCachedFsUtils(config) {
|
|
46929
46984
|
}
|
46930
46985
|
}
|
46931
46986
|
function onPathUnlink(file) {
|
46932
|
-
const direntCache = getDirentCacheFromPath(path$o.dirname(file));
|
46987
|
+
const direntCache = getDirentCacheFromPath(normalizePath$3(path$o.dirname(file)));
|
46933
46988
|
if (direntCache &&
|
46934
46989
|
direntCache.type === 'directory' &&
|
46935
46990
|
direntCache.dirents) {
|
@@ -50189,7 +50244,7 @@ async function createPluginContainer(config, moduleGraph, watcher) {
|
|
50189
50244
|
const moduleNodeToLoadAddedImports = new WeakMap();
|
50190
50245
|
const minimalContext = {
|
50191
50246
|
meta: {
|
50192
|
-
rollupVersion
|
50247
|
+
rollupVersion,
|
50193
50248
|
watchMode: true,
|
50194
50249
|
},
|
50195
50250
|
debug: noop$3,
|
@@ -51423,6 +51478,8 @@ async function createDepsOptimizer(config, server) {
|
|
51423
51478
|
let debounceProcessingHandle;
|
51424
51479
|
let closed = false;
|
51425
51480
|
let metadata = cachedMetadata || initDepsOptimizerMetadata(config, ssr, sessionTimestamp);
|
51481
|
+
const options = getDepOptimizationConfig(config, ssr);
|
51482
|
+
const { noDiscovery, holdUntilCrawlEnd } = options;
|
51426
51483
|
const depsOptimizer = {
|
51427
51484
|
metadata,
|
51428
51485
|
registerMissingImport,
|
@@ -51432,7 +51489,7 @@ async function createDepsOptimizer(config, server) {
|
|
51432
51489
|
getOptimizedDepId: (depInfo) => `${depInfo.file}?v=${depInfo.browserHash}`,
|
51433
51490
|
delayDepsOptimizerUntil,
|
51434
51491
|
close,
|
51435
|
-
options
|
51492
|
+
options,
|
51436
51493
|
};
|
51437
51494
|
depsOptimizerMap.set(config, depsOptimizer);
|
51438
51495
|
let newDepsDiscovered = false;
|
@@ -51446,6 +51503,15 @@ async function createDepsOptimizer(config, server) {
|
|
51446
51503
|
newDepsToLog = [];
|
51447
51504
|
}
|
51448
51505
|
};
|
51506
|
+
let discoveredDepsWhileScanning = [];
|
51507
|
+
const logDiscoveredDepsWhileScanning = () => {
|
51508
|
+
if (discoveredDepsWhileScanning.length) {
|
51509
|
+
config.logger.info(colors$1.green(`✨ discovered while scanning: ${depsLogString(discoveredDepsWhileScanning)}`), {
|
51510
|
+
timestamp: true,
|
51511
|
+
});
|
51512
|
+
discoveredDepsWhileScanning = [];
|
51513
|
+
}
|
51514
|
+
};
|
51449
51515
|
let depOptimizationProcessing = promiseWithResolvers();
|
51450
51516
|
let depOptimizationProcessingQueue = [];
|
51451
51517
|
const resolveEnqueuedProcessingPromises = () => {
|
@@ -51458,6 +51524,7 @@ async function createDepsOptimizer(config, server) {
|
|
51458
51524
|
let enqueuedRerun;
|
51459
51525
|
let currentlyProcessing = false;
|
51460
51526
|
let firstRunCalled = !!cachedMetadata;
|
51527
|
+
let warnAboutMissedDependencies = false;
|
51461
51528
|
// If this is a cold run, we wait for static imports discovered
|
51462
51529
|
// from the first request before resolving to minimize full page reloads.
|
51463
51530
|
// On warm start or after the first optimization is run, we use a simpler
|
@@ -51481,17 +51548,17 @@ async function createDepsOptimizer(config, server) {
|
|
51481
51548
|
// Enter processing state until crawl of static imports ends
|
51482
51549
|
currentlyProcessing = true;
|
51483
51550
|
// Initialize discovered deps with manually added optimizeDeps.include info
|
51484
|
-
const
|
51485
|
-
await addManuallyIncludedOptimizeDeps(
|
51486
|
-
const
|
51487
|
-
for (const depInfo of Object.values(
|
51551
|
+
const manuallyIncludedDeps = {};
|
51552
|
+
await addManuallyIncludedOptimizeDeps(manuallyIncludedDeps, config, ssr);
|
51553
|
+
const manuallyIncludedDepsInfo = toDiscoveredDependencies(config, manuallyIncludedDeps, ssr, sessionTimestamp);
|
51554
|
+
for (const depInfo of Object.values(manuallyIncludedDepsInfo)) {
|
51488
51555
|
addOptimizedDepInfo(metadata, 'discovered', {
|
51489
51556
|
...depInfo,
|
51490
51557
|
processing: depOptimizationProcessing.promise,
|
51491
51558
|
});
|
51492
51559
|
newDepsDiscovered = true;
|
51493
51560
|
}
|
51494
|
-
if (
|
51561
|
+
if (noDiscovery) {
|
51495
51562
|
// We don't need to scan for dependencies or wait for the static crawl to end
|
51496
51563
|
// Run the first optimization run immediately
|
51497
51564
|
runOptimizer();
|
@@ -51505,6 +51572,8 @@ async function createDepsOptimizer(config, server) {
|
|
51505
51572
|
discover = discoverProjectDependencies(config);
|
51506
51573
|
const deps = await discover.result;
|
51507
51574
|
discover = undefined;
|
51575
|
+
const manuallyIncluded = Object.keys(manuallyIncludedDepsInfo);
|
51576
|
+
discoveredDepsWhileScanning.push(...Object.keys(metadata.discovered).filter((dep) => !deps[dep] && !manuallyIncluded.includes(dep)));
|
51508
51577
|
// Add these dependencies to the discovered list, as these are currently
|
51509
51578
|
// used by the preAliasPlugin to support aliased and optimized deps.
|
51510
51579
|
// This is also used by the CJS externalization heuristics in legacy mode
|
@@ -51514,11 +51583,28 @@ async function createDepsOptimizer(config, server) {
|
|
51514
51583
|
}
|
51515
51584
|
}
|
51516
51585
|
const knownDeps = prepareKnownDeps();
|
51586
|
+
startNextDiscoveredBatch();
|
51517
51587
|
// 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
|
51588
|
+
// run on the background
|
51521
51589
|
optimizationResult = runOptimizeDeps(config, knownDeps, ssr);
|
51590
|
+
// If the holdUntilCrawlEnd stratey is used, we wait until crawling has
|
51591
|
+
// ended to decide if we send this result to the browser or we need to
|
51592
|
+
// do another optimize step
|
51593
|
+
if (!holdUntilCrawlEnd) {
|
51594
|
+
// If not, we release the result to the browser as soon as the scanner
|
51595
|
+
// is done. If the scanner missed any dependency, and a new dependency
|
51596
|
+
// is discovered while crawling static imports, then there will be a
|
51597
|
+
// full-page reload if new common chunks are generated between the old
|
51598
|
+
// and new optimized deps.
|
51599
|
+
optimizationResult.result.then((result) => {
|
51600
|
+
// Check if the crawling of static imports has already finished. In that
|
51601
|
+
// case, the result is handled by the onCrawlEnd callback
|
51602
|
+
if (!crawlEndFinder)
|
51603
|
+
return;
|
51604
|
+
optimizationResult = undefined; // signal that we'll be using the result
|
51605
|
+
runOptimizer(result);
|
51606
|
+
});
|
51607
|
+
}
|
51522
51608
|
}
|
51523
51609
|
catch (e) {
|
51524
51610
|
logger.error(e.stack || e.message);
|
@@ -51650,6 +51736,11 @@ async function createDepsOptimizer(config, server) {
|
|
51650
51736
|
newDepsToLogHandle = setTimeout(() => {
|
51651
51737
|
newDepsToLogHandle = undefined;
|
51652
51738
|
logNewlyDiscoveredDeps();
|
51739
|
+
if (warnAboutMissedDependencies) {
|
51740
|
+
logDiscoveredDepsWhileScanning();
|
51741
|
+
config.logger.info(colors$1.magenta(`❗ add these dependencies to optimizeDeps.include to speed up cold start`), { timestamp: true });
|
51742
|
+
warnAboutMissedDependencies = false;
|
51743
|
+
}
|
51653
51744
|
}, 2 * debounceMs);
|
51654
51745
|
}
|
51655
51746
|
else {
|
@@ -51674,6 +51765,11 @@ async function createDepsOptimizer(config, server) {
|
|
51674
51765
|
clearTimeout(newDepsToLogHandle);
|
51675
51766
|
newDepsToLogHandle = undefined;
|
51676
51767
|
logNewlyDiscoveredDeps();
|
51768
|
+
if (warnAboutMissedDependencies) {
|
51769
|
+
logDiscoveredDepsWhileScanning();
|
51770
|
+
config.logger.info(colors$1.magenta(`❗ add these dependencies to optimizeDeps.include to avoid a full page reload during cold start`), { timestamp: true });
|
51771
|
+
warnAboutMissedDependencies = false;
|
51772
|
+
}
|
51677
51773
|
}
|
51678
51774
|
logger.info(colors$1.green(`✨ optimized dependencies changed. reloading`), {
|
51679
51775
|
timestamp: true,
|
@@ -51769,7 +51865,7 @@ async function createDepsOptimizer(config, server) {
|
|
51769
51865
|
}
|
51770
51866
|
function debouncedProcessing(timeout = debounceMs) {
|
51771
51867
|
// Debounced rerun, let other missing dependencies be discovered before
|
51772
|
-
// the
|
51868
|
+
// the next optimizeDeps run
|
51773
51869
|
enqueuedRerun = undefined;
|
51774
51870
|
if (debounceProcessingHandle)
|
51775
51871
|
clearTimeout(debounceProcessingHandle);
|
@@ -51798,8 +51894,16 @@ async function createDepsOptimizer(config, server) {
|
|
51798
51894
|
// It normally should be over by the time crawling of user code ended
|
51799
51895
|
await depsOptimizer.scanProcessing;
|
51800
51896
|
if (optimizationResult && !config.optimizeDeps.noDiscovery) {
|
51801
|
-
|
51802
|
-
|
51897
|
+
// In the holdUntilCrawlEnd strategy, we don't release the result of the
|
51898
|
+
// post-scanner optimize step to the browser until we reach this point
|
51899
|
+
// If there are new dependencies, we do another optimize run, if not, we
|
51900
|
+
// use the post-scanner optimize result
|
51901
|
+
// If holdUntilCrawlEnd is false and we reach here, it means that the
|
51902
|
+
// scan+optimize step finished after crawl end. We follow the same
|
51903
|
+
// process as in the holdUntilCrawlEnd in this case.
|
51904
|
+
const afterScanResult = optimizationResult.result;
|
51905
|
+
optimizationResult = undefined; // signal that we'll be using the result
|
51906
|
+
const result = await afterScanResult;
|
51803
51907
|
currentlyProcessing = false;
|
51804
51908
|
const crawlDeps = Object.keys(metadata.discovered);
|
51805
51909
|
const scanDeps = Object.keys(result.metadata.optimized);
|
@@ -51835,6 +51939,17 @@ async function createDepsOptimizer(config, server) {
|
|
51835
51939
|
runOptimizer(result);
|
51836
51940
|
}
|
51837
51941
|
}
|
51942
|
+
else if (!holdUntilCrawlEnd) {
|
51943
|
+
// The post-scanner optimize result has been released to the browser
|
51944
|
+
// If new deps have been discovered, issue a regular rerun of the
|
51945
|
+
// optimizer. A full page reload may still be avoided if the new
|
51946
|
+
// optimize result is compatible in this case
|
51947
|
+
if (newDepsDiscovered) {
|
51948
|
+
debug$8?.(colors$1.green(`✨ new dependencies were found while crawling static imports, re-running optimizer`));
|
51949
|
+
warnAboutMissedDependencies = true;
|
51950
|
+
debouncedProcessing(0);
|
51951
|
+
}
|
51952
|
+
}
|
51838
51953
|
else {
|
51839
51954
|
const crawlDeps = Object.keys(metadata.discovered);
|
51840
51955
|
currentlyProcessing = false;
|
@@ -53464,7 +53579,7 @@ async function handleModuleSoftInvalidation(mod, ssr, timestamp, server) {
|
|
53464
53579
|
await init;
|
53465
53580
|
const source = transformResult.code;
|
53466
53581
|
const s = new MagicString(source);
|
53467
|
-
const [imports] = parse$e(source);
|
53582
|
+
const [imports] = parse$e(source, mod.id || undefined);
|
53468
53583
|
for (const imp of imports) {
|
53469
53584
|
let rawUrl = source.slice(imp.s, imp.e);
|
53470
53585
|
if (rawUrl === 'import.meta')
|
@@ -62722,7 +62837,7 @@ function proxyMiddleware(httpServer, options, config) {
|
|
62722
62837
|
});
|
62723
62838
|
}
|
62724
62839
|
else if ('req' in res) {
|
62725
|
-
config.logger.error(`${colors$1.red(`http proxy error
|
62840
|
+
config.logger.error(`${colors$1.red(`http proxy error: ${originalRes.req.url}`)}\n${err.stack}`, {
|
62726
62841
|
timestamp: true,
|
62727
62842
|
error: err,
|
62728
62843
|
});
|
@@ -63822,68 +63937,6 @@ function notFoundMiddleware() {
|
|
63822
63937
|
};
|
63823
63938
|
}
|
63824
63939
|
|
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
63940
|
function warmupFiles(server) {
|
63888
63941
|
const options = server.config.server.warmup;
|
63889
63942
|
const root = server.config.root;
|
@@ -64436,7 +64489,7 @@ function resolveServerOptions(root, raw, logger) {
|
|
64436
64489
|
strict: server.fs?.strict ?? true,
|
64437
64490
|
allow: allowDirs,
|
64438
64491
|
deny,
|
64439
|
-
cachedChecks: server.fs?.cachedChecks ??
|
64492
|
+
cachedChecks: server.fs?.cachedChecks ?? true,
|
64440
64493
|
};
|
64441
64494
|
if (server.origin?.endsWith('/')) {
|
64442
64495
|
server.origin = server.origin.slice(0, -1);
|
@@ -65488,7 +65541,7 @@ function importAnalysisPlugin(config) {
|
|
65488
65541
|
// `importedUrls` will be mixed with watched files for the module graph,
|
65489
65542
|
// `staticImportedUrls` will only contain the static top-level imports and
|
65490
65543
|
// dynamic imports
|
65491
|
-
const staticImportedUrls = new Set(_orderedImportedUrls);
|
65544
|
+
const staticImportedUrls = new Set(_orderedImportedUrls.map((url) => removeTimestampQuery(url)));
|
65492
65545
|
const acceptedUrls = mergeAcceptedUrls(orderedAcceptedUrls);
|
65493
65546
|
const acceptedExports = mergeAcceptedUrls(orderedAcceptedExports);
|
65494
65547
|
// While we always expect to work with ESM, a classic worker is the only
|
@@ -66407,7 +66460,7 @@ async function build(inlineConfig = {}) {
|
|
66407
66460
|
const options = config.build;
|
66408
66461
|
const ssr = !!options.ssr;
|
66409
66462
|
const libOptions = options.lib;
|
66410
|
-
config.logger.info(colors$1.cyan(`vite v${VERSION
|
66463
|
+
config.logger.info(colors$1.cyan(`vite v${VERSION} ${colors$1.green(`building ${ssr ? `SSR bundle ` : ``}for ${config.mode}...`)}`));
|
66411
66464
|
const resolve = (p) => path$o.resolve(config.root, p);
|
66412
66465
|
const input = libOptions
|
66413
66466
|
? options.rollupOptions?.input ||
|
@@ -66457,7 +66510,7 @@ async function build(inlineConfig = {}) {
|
|
66457
66510
|
onRollupWarning(warning, warn, config);
|
66458
66511
|
},
|
66459
66512
|
};
|
66460
|
-
const
|
66513
|
+
const mergeRollupError = (e) => {
|
66461
66514
|
let msg = colors$1.red((e.plugin ? `[${e.plugin}] ` : '') + e.message);
|
66462
66515
|
if (e.id) {
|
66463
66516
|
msg += `\nfile: ${colors$1.cyan(e.id + (e.loc ? `:${e.loc.line}:${e.loc.column}` : ''))}`;
|
@@ -66465,6 +66518,10 @@ async function build(inlineConfig = {}) {
|
|
66465
66518
|
if (e.frame) {
|
66466
66519
|
msg += `\n` + colors$1.yellow(e.frame);
|
66467
66520
|
}
|
66521
|
+
return msg;
|
66522
|
+
};
|
66523
|
+
const outputBuildError = (e) => {
|
66524
|
+
const msg = mergeRollupError(e);
|
66468
66525
|
clearLine();
|
66469
66526
|
config.logger.error(msg, { error: e });
|
66470
66527
|
};
|
@@ -66577,7 +66634,8 @@ async function build(inlineConfig = {}) {
|
|
66577
66634
|
return Array.isArray(outputs) ? res : res[0];
|
66578
66635
|
}
|
66579
66636
|
catch (e) {
|
66580
|
-
|
66637
|
+
e.message = mergeRollupError(e);
|
66638
|
+
clearLine();
|
66581
66639
|
throw e;
|
66582
66640
|
}
|
66583
66641
|
finally {
|
@@ -67081,7 +67139,7 @@ function resolvePreviewOptions(preview, server) {
|
|
67081
67139
|
* Starts the Vite server in preview mode, to simulate a production deployment
|
67082
67140
|
*/
|
67083
67141
|
async function preview(inlineConfig = {}) {
|
67084
|
-
const config = await resolveConfig(inlineConfig, 'serve', 'production', 'production');
|
67142
|
+
const config = await resolveConfig(inlineConfig, 'serve', 'production', 'production', true);
|
67085
67143
|
const distDir = path$o.resolve(config.root, config.build.outDir);
|
67086
67144
|
if (!fs$l.existsSync(distDir) &&
|
67087
67145
|
// error if no plugins implement `configurePreviewServer`
|
@@ -67481,6 +67539,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = 'development',
|
|
67481
67539
|
packageCache,
|
67482
67540
|
createResolver,
|
67483
67541
|
optimizeDeps: {
|
67542
|
+
holdUntilCrawlEnd: true,
|
67484
67543
|
...optimizeDeps,
|
67485
67544
|
esbuildOptions: {
|
67486
67545
|
preserveSymlinks: resolveOptions.preserveSymlinks,
|
@@ -67847,4 +67906,4 @@ function optimizeDepsDisabledBackwardCompatibility(resolved, optimizeDeps, optim
|
|
67847
67906
|
}
|
67848
67907
|
}
|
67849
67908
|
|
67850
|
-
export {
|
67909
|
+
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-2l_yqaZo.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-2l_yqaZo.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-2l_yqaZo.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-2l_yqaZo.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-2l_yqaZo.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-2l_yqaZo.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-2l_yqaZo.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;
|
@@ -6073,7 +6077,6 @@ function resolveEnvPrefix({ envPrefix = 'VITE_', }) {
|
|
6073
6077
|
}
|
6074
6078
|
|
6075
6079
|
exports.esbuildVersion = esbuild.version;
|
6076
|
-
exports.rollupVersion = rollup.VERSION;
|
6077
6080
|
exports.createFilter = createFilter;
|
6078
6081
|
exports.createLogger = createLogger;
|
6079
6082
|
exports.isCSSRequest = isCSSRequest;
|
@@ -6083,6 +6086,7 @@ exports.mergeAlias = mergeAlias;
|
|
6083
6086
|
exports.mergeConfig = mergeConfig;
|
6084
6087
|
exports.normalizePath = normalizePath;
|
6085
6088
|
exports.resolveEnvPrefix = resolveEnvPrefix;
|
6089
|
+
exports.rollupVersion = rollupVersion;
|
6086
6090
|
exports.searchForWorkspaceRoot = searchForWorkspaceRoot;
|
6087
6091
|
exports.send = send;
|
6088
6092
|
exports.splitVendorChunk = splitVendorChunk;
|