vite 5.0.8 → 5.0.9
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-uAHLeuC6.js → dep-Pluk1iaB.js} +133 -86
- package/dist/node/chunks/{dep-WV5u8Hxr.js → dep-riInLuGl.js} +1 -1
- package/dist/node/chunks/{dep-Y5q53UKR.js → dep-rzQTjkv_.js} +1 -1
- package/dist/node/cli.js +5 -5
- package/dist/node/index.d.ts +10 -0
- package/dist/node/index.js +2 -2
- package/package.json +1 -1
@@ -40076,8 +40076,8 @@ function createCachedImport(imp) {
|
|
40076
40076
|
return cached;
|
40077
40077
|
};
|
40078
40078
|
}
|
40079
|
-
const importPostcssImport = createCachedImport(() => import('./dep-
|
40080
|
-
const importPostcssModules = createCachedImport(() => import('./dep-
|
40079
|
+
const importPostcssImport = createCachedImport(() => import('./dep-rzQTjkv_.js').then(function (n) { return n.i; }));
|
40080
|
+
const importPostcssModules = createCachedImport(() => import('./dep-riInLuGl.js').then(function (n) { return n.i; }));
|
40081
40081
|
const importPostcss = createCachedImport(() => import('postcss'));
|
40082
40082
|
/**
|
40083
40083
|
* @experimental
|
@@ -58778,6 +58778,8 @@ function htmlFallbackMiddleware(root, spaFallback, fsUtils = commonFsUtils) {
|
|
58778
58778
|
if (
|
58779
58779
|
// Only accept GET or HEAD
|
58780
58780
|
(req.method !== 'GET' && req.method !== 'HEAD') ||
|
58781
|
+
// Exclude default favicon requests
|
58782
|
+
req.url === '/favicon.ico' ||
|
58781
58783
|
// Require Accept: text/html or */*
|
58782
58784
|
!(req.headers.accept === undefined || // equivalent to `Accept: */*`
|
58783
58785
|
req.headers.accept === '' || // equivalent to `Accept: */*`
|
@@ -58885,6 +58887,11 @@ const debugCache = createDebugger('vite:cache');
|
|
58885
58887
|
const knownIgnoreList = new Set(['/', '/favicon.ico']);
|
58886
58888
|
function transformMiddleware(server) {
|
58887
58889
|
// Keep the named function. The name is visible in debug logs via `DEBUG=connect:dispatcher ...`
|
58890
|
+
// check if public dir is inside root dir
|
58891
|
+
const { root } = server.config;
|
58892
|
+
const publicDir = normalizePath$3(server.config.publicDir);
|
58893
|
+
const publicDirInRoot = publicDir.startsWith(withTrailingSlash(root));
|
58894
|
+
const publicPath = `${publicDir.slice(root.length)}/`;
|
58888
58895
|
return async function viteTransformMiddleware(req, res, next) {
|
58889
58896
|
if (req.method !== 'GET' || knownIgnoreList.has(req.url)) {
|
58890
58897
|
return next();
|
@@ -58946,35 +58953,8 @@ function transformMiddleware(server) {
|
|
58946
58953
|
}
|
58947
58954
|
}
|
58948
58955
|
}
|
58949
|
-
|
58950
|
-
|
58951
|
-
const rootDir = normalizePath$3(server.config.root);
|
58952
|
-
if (publicDir.startsWith(withTrailingSlash(rootDir))) {
|
58953
|
-
const publicPath = `${publicDir.slice(rootDir.length)}/`;
|
58954
|
-
// warn explicit public paths
|
58955
|
-
if (url.startsWith(withTrailingSlash(publicPath))) {
|
58956
|
-
let warning;
|
58957
|
-
if (isImportRequest(url)) {
|
58958
|
-
const rawUrl = removeImportQuery(url);
|
58959
|
-
if (urlRE.test(url)) {
|
58960
|
-
warning =
|
58961
|
-
`Assets in the public directory are served at the root path.\n` +
|
58962
|
-
`Instead of ${colors$1.cyan(rawUrl)}, use ${colors$1.cyan(rawUrl.replace(publicPath, '/'))}.`;
|
58963
|
-
}
|
58964
|
-
else {
|
58965
|
-
warning =
|
58966
|
-
'Assets in public directory cannot be imported from JavaScript.\n' +
|
58967
|
-
`If you intend to import that asset, put the file in the src directory, and use ${colors$1.cyan(rawUrl.replace(publicPath, '/src/'))} instead of ${colors$1.cyan(rawUrl)}.\n` +
|
58968
|
-
`If you intend to use the URL of that asset, use ${colors$1.cyan(injectQuery(rawUrl.replace(publicPath, '/'), 'url'))}.`;
|
58969
|
-
}
|
58970
|
-
}
|
58971
|
-
else {
|
58972
|
-
warning =
|
58973
|
-
`Files in the public directory are served at the root path.\n` +
|
58974
|
-
`Instead of ${colors$1.cyan(url)}, use ${colors$1.cyan(url.replace(publicPath, '/'))}.`;
|
58975
|
-
}
|
58976
|
-
server.config.logger.warn(colors$1.yellow(warning));
|
58977
|
-
}
|
58956
|
+
if (publicDirInRoot && url.startsWith(publicPath)) {
|
58957
|
+
warnAboutExplicitPublicPathInUrl(url);
|
58978
58958
|
}
|
58979
58959
|
if (isJSRequest(url) ||
|
58980
58960
|
isImportRequest(url) ||
|
@@ -59069,6 +59049,29 @@ function transformMiddleware(server) {
|
|
59069
59049
|
}
|
59070
59050
|
next();
|
59071
59051
|
};
|
59052
|
+
function warnAboutExplicitPublicPathInUrl(url) {
|
59053
|
+
let warning;
|
59054
|
+
if (isImportRequest(url)) {
|
59055
|
+
const rawUrl = removeImportQuery(url);
|
59056
|
+
if (urlRE.test(url)) {
|
59057
|
+
warning =
|
59058
|
+
`Assets in the public directory are served at the root path.\n` +
|
59059
|
+
`Instead of ${colors$1.cyan(rawUrl)}, use ${colors$1.cyan(rawUrl.replace(publicPath, '/'))}.`;
|
59060
|
+
}
|
59061
|
+
else {
|
59062
|
+
warning =
|
59063
|
+
'Assets in public directory cannot be imported from JavaScript.\n' +
|
59064
|
+
`If you intend to import that asset, put the file in the src directory, and use ${colors$1.cyan(rawUrl.replace(publicPath, '/src/'))} instead of ${colors$1.cyan(rawUrl)}.\n` +
|
59065
|
+
`If you intend to use the URL of that asset, use ${colors$1.cyan(injectQuery(rawUrl.replace(publicPath, '/'), 'url'))}.`;
|
59066
|
+
}
|
59067
|
+
}
|
59068
|
+
else {
|
59069
|
+
warning =
|
59070
|
+
`Files in the public directory are served at the root path.\n` +
|
59071
|
+
`Instead of ${colors$1.cyan(url)}, use ${colors$1.cyan(url.replace(publicPath, '/'))}.`;
|
59072
|
+
}
|
59073
|
+
server.config.logger.warn(colors$1.yellow(warning));
|
59074
|
+
}
|
59072
59075
|
}
|
59073
59076
|
|
59074
59077
|
function createDevHtmlTransformFn(config) {
|
@@ -59986,7 +59989,7 @@ async function _createServer(inlineConfig = {}, options) {
|
|
59986
59989
|
const watcher = watchEnabled
|
59987
59990
|
? chokidar.watch(
|
59988
59991
|
// config file dependencies and env file might be outside of root
|
59989
|
-
[root, ...config.configFileDependencies, config.envDir], resolvedWatchOptions)
|
59992
|
+
[...new Set([root, ...config.configFileDependencies, config.envDir])], resolvedWatchOptions)
|
59990
59993
|
: createNoopWatcher(resolvedWatchOptions);
|
59991
59994
|
const moduleGraph = new ModuleGraph((url, ssr) => container.resolveId(url, undefined, { ssr }));
|
59992
59995
|
const container = await createPluginContainer(config, moduleGraph, watcher);
|
@@ -61241,10 +61244,21 @@ async function workerFileToUrl(config, id, query) {
|
|
61241
61244
|
function webWorkerPostPlugin() {
|
61242
61245
|
return {
|
61243
61246
|
name: 'vite:worker-post',
|
61244
|
-
resolveImportMeta(property, {
|
61247
|
+
resolveImportMeta(property, { format }) {
|
61245
61248
|
// document is undefined in the worker, so we need to avoid it in iife
|
61246
|
-
if (
|
61247
|
-
|
61249
|
+
if (format === 'iife') {
|
61250
|
+
// compiling import.meta
|
61251
|
+
if (!property) {
|
61252
|
+
// rollup only supports `url` property. we only support `url` property as well.
|
61253
|
+
// https://github.com/rollup/rollup/blob/62b648e1cc6a1f00260bb85aa2050097bb4afd2b/src/ast/nodes/MetaProperty.ts#L164-L173
|
61254
|
+
return `{
|
61255
|
+
url: self.location.href
|
61256
|
+
}`;
|
61257
|
+
}
|
61258
|
+
// compiling import.meta.url
|
61259
|
+
if (property === 'url') {
|
61260
|
+
return 'self.location.href';
|
61261
|
+
}
|
61248
61262
|
}
|
61249
61263
|
return null;
|
61250
61264
|
},
|
@@ -61674,7 +61688,11 @@ function importAnalysisPlugin(config) {
|
|
61674
61688
|
url = resolved.id.slice(root.length);
|
61675
61689
|
}
|
61676
61690
|
else if (depsOptimizer?.isOptimizedDepFile(resolved.id) ||
|
61677
|
-
|
61691
|
+
// vite-plugin-react isn't following the leading \0 virtual module convention.
|
61692
|
+
// This is a temporary hack to avoid expensive fs checks for React apps.
|
61693
|
+
// We'll remove this as soon we're able to fix the react plugins.
|
61694
|
+
(resolved.id !== '/@react-refresh' &&
|
61695
|
+
path$o.isAbsolute(resolved.id) &&
|
61678
61696
|
fsUtils.existsSync(cleanUrl(resolved.id)))) {
|
61679
61697
|
// an optimized deps may not yet exists in the filesystem, or
|
61680
61698
|
// a regular file exists but is out of root: rewrite to absolute /@fs/ paths
|
@@ -64143,16 +64161,6 @@ function esbuildScanPlugin(config, container, depImports, missing, entries) {
|
|
64143
64161
|
external: doExternalize(path),
|
64144
64162
|
};
|
64145
64163
|
});
|
64146
|
-
// onResolve is not called for glob imports.
|
64147
|
-
// we need to add that here as well until esbuild calls onResolve for glob imports.
|
64148
|
-
// https://github.com/evanw/esbuild/issues/3317
|
64149
|
-
build.onLoad({ filter, namespace: 'file' }, () => {
|
64150
|
-
const externalOnLoadResult = {
|
64151
|
-
loader: 'js',
|
64152
|
-
contents: 'export default {}',
|
64153
|
-
};
|
64154
|
-
return externalOnLoadResult;
|
64155
|
-
});
|
64156
64164
|
};
|
64157
64165
|
// css
|
64158
64166
|
setupExternalize(CSS_LANGS_RE, isUnlessEntry);
|
@@ -64212,6 +64220,15 @@ function esbuildScanPlugin(config, container, depImports, missing, entries) {
|
|
64212
64220
|
contents,
|
64213
64221
|
};
|
64214
64222
|
});
|
64223
|
+
// onResolve is not called for glob imports.
|
64224
|
+
// we need to add that here as well until esbuild calls onResolve for glob imports.
|
64225
|
+
// https://github.com/evanw/esbuild/issues/3317
|
64226
|
+
build.onLoad({ filter: /.*/, namespace: 'file' }, () => {
|
64227
|
+
return {
|
64228
|
+
loader: 'js',
|
64229
|
+
contents: 'export default {}',
|
64230
|
+
};
|
64231
|
+
});
|
64215
64232
|
},
|
64216
64233
|
};
|
64217
64234
|
}
|
@@ -65055,9 +65072,11 @@ async function optimizeServerSsrDeps(config) {
|
|
65055
65072
|
return result.metadata;
|
65056
65073
|
}
|
65057
65074
|
function initDepsOptimizerMetadata(config, ssr, timestamp) {
|
65058
|
-
const hash = getDepHash(config, ssr);
|
65075
|
+
const { lockfileHash, configHash, hash } = getDepHash(config, ssr);
|
65059
65076
|
return {
|
65060
65077
|
hash,
|
65078
|
+
lockfileHash,
|
65079
|
+
configHash,
|
65061
65080
|
browserHash: getOptimizedBrowserHash(hash, {}, timestamp),
|
65062
65081
|
optimized: {},
|
65063
65082
|
chunks: {},
|
@@ -65091,11 +65110,19 @@ async function loadCachedDepOptimizationMetadata(config, ssr, force = config.opt
|
|
65091
65110
|
}
|
65092
65111
|
catch (e) { }
|
65093
65112
|
// hash is consistent, no need to re-bundle
|
65094
|
-
if (cachedMetadata
|
65095
|
-
|
65096
|
-
|
65097
|
-
|
65098
|
-
|
65113
|
+
if (cachedMetadata) {
|
65114
|
+
if (cachedMetadata.lockfileHash !== getLockfileHash(config)) {
|
65115
|
+
config.logger.info('Re-optimizing dependencies because lockfile has changed');
|
65116
|
+
}
|
65117
|
+
else if (cachedMetadata.configHash !== getConfigHash(config, ssr)) {
|
65118
|
+
config.logger.info('Re-optimizing dependencies because vite config has changed');
|
65119
|
+
}
|
65120
|
+
else {
|
65121
|
+
log?.('Hash is consistent. Skipping. Use --force to override.');
|
65122
|
+
// Nothing to commit or cancel as we are using the cache, we only
|
65123
|
+
// need to resolve the processing promise so requests can move on
|
65124
|
+
return cachedMetadata;
|
65125
|
+
}
|
65099
65126
|
}
|
65100
65127
|
}
|
65101
65128
|
else {
|
@@ -65125,7 +65152,7 @@ function discoverProjectDependencies(config) {
|
|
65125
65152
|
};
|
65126
65153
|
}
|
65127
65154
|
function toDiscoveredDependencies(config, deps, ssr, timestamp) {
|
65128
|
-
const browserHash = getOptimizedBrowserHash(getDepHash(config, ssr), deps, timestamp);
|
65155
|
+
const browserHash = getOptimizedBrowserHash(getDepHash(config, ssr).hash, deps, timestamp);
|
65129
65156
|
const discovered = {};
|
65130
65157
|
for (const id in deps) {
|
65131
65158
|
const src = deps[id];
|
@@ -65155,7 +65182,7 @@ function runOptimizeDeps(resolvedConfig, depsInfo, ssr = resolvedConfig.command
|
|
65155
65182
|
};
|
65156
65183
|
const depsCacheDir = getDepsCacheDir(resolvedConfig, ssr);
|
65157
65184
|
const processingCacheDir = getProcessingDepsCacheDir(resolvedConfig, ssr);
|
65158
|
-
// Create a
|
65185
|
+
// Create a temporary directory so we don't need to delete optimized deps
|
65159
65186
|
// until they have been processed. This also avoids leaving the deps cache
|
65160
65187
|
// directory in a corrupted state if there is an error
|
65161
65188
|
fs$l.mkdirSync(processingCacheDir, { recursive: true });
|
@@ -65195,40 +65222,40 @@ function runOptimizeDeps(resolvedConfig, depsInfo, ssr = resolvedConfig.command
|
|
65195
65222
|
// we finish commiting the new deps cache files to the deps folder
|
65196
65223
|
committed = true;
|
65197
65224
|
// Write metadata file, then commit the processing folder to the global deps cache
|
65198
|
-
// Rewire the file paths from the
|
65225
|
+
// Rewire the file paths from the temporary processing dir to the final deps cache dir
|
65199
65226
|
const dataPath = path$o.join(processingCacheDir, '_metadata.json');
|
65200
65227
|
debug$1?.(colors$1.green(`creating _metadata.json in ${processingCacheDir}`));
|
65201
65228
|
fs$l.writeFileSync(dataPath, stringifyDepsOptimizerMetadata(metadata, depsCacheDir));
|
65202
65229
|
// In order to minimize the time where the deps folder isn't in a consistent state,
|
65203
|
-
// we first rename the old depsCacheDir to a
|
65230
|
+
// we first rename the old depsCacheDir to a temporary path, then we rename the
|
65204
65231
|
// new processing cache dir to the depsCacheDir. In systems where doing so in sync
|
65205
65232
|
// is safe, we do an atomic operation (at least for this thread). For Windows, we
|
65206
65233
|
// found there are cases where the rename operation may finish before it's done
|
65207
65234
|
// so we do a graceful rename checking that the folder has been properly renamed.
|
65208
65235
|
// We found that the rename-rename (then delete the old folder in the background)
|
65209
65236
|
// is safer than a delete-rename operation.
|
65210
|
-
const
|
65237
|
+
const temporaryPath = depsCacheDir + getTempSuffix();
|
65211
65238
|
const depsCacheDirPresent = fs$l.existsSync(depsCacheDir);
|
65212
65239
|
if (isWindows$4) {
|
65213
65240
|
if (depsCacheDirPresent) {
|
65214
|
-
debug$1?.(colors$1.green(`renaming ${depsCacheDir} to ${
|
65215
|
-
await safeRename(depsCacheDir,
|
65241
|
+
debug$1?.(colors$1.green(`renaming ${depsCacheDir} to ${temporaryPath}`));
|
65242
|
+
await safeRename(depsCacheDir, temporaryPath);
|
65216
65243
|
}
|
65217
65244
|
debug$1?.(colors$1.green(`renaming ${processingCacheDir} to ${depsCacheDir}`));
|
65218
65245
|
await safeRename(processingCacheDir, depsCacheDir);
|
65219
65246
|
}
|
65220
65247
|
else {
|
65221
65248
|
if (depsCacheDirPresent) {
|
65222
|
-
debug$1?.(colors$1.green(`renaming ${depsCacheDir} to ${
|
65223
|
-
fs$l.renameSync(depsCacheDir,
|
65249
|
+
debug$1?.(colors$1.green(`renaming ${depsCacheDir} to ${temporaryPath}`));
|
65250
|
+
fs$l.renameSync(depsCacheDir, temporaryPath);
|
65224
65251
|
}
|
65225
65252
|
debug$1?.(colors$1.green(`renaming ${processingCacheDir} to ${depsCacheDir}`));
|
65226
65253
|
fs$l.renameSync(processingCacheDir, depsCacheDir);
|
65227
65254
|
}
|
65228
|
-
// Delete
|
65255
|
+
// Delete temporary path in the background
|
65229
65256
|
if (depsCacheDirPresent) {
|
65230
|
-
debug$1?.(colors$1.green(`removing cache temp dir ${
|
65231
|
-
fsp.rm(
|
65257
|
+
debug$1?.(colors$1.green(`removing cache temp dir ${temporaryPath}`));
|
65258
|
+
fsp.rm(temporaryPath, { recursive: true, force: true });
|
65232
65259
|
}
|
65233
65260
|
},
|
65234
65261
|
};
|
@@ -65527,7 +65554,7 @@ function createIsOptimizedDepUrl(config) {
|
|
65527
65554
|
};
|
65528
65555
|
}
|
65529
65556
|
function parseDepsOptimizerMetadata(jsonMetadata, depsCacheDir) {
|
65530
|
-
const { hash, browserHash, optimized, chunks } = JSON.parse(jsonMetadata, (key, value) => {
|
65557
|
+
const { hash, lockfileHash, configHash, browserHash, optimized, chunks } = JSON.parse(jsonMetadata, (key, value) => {
|
65531
65558
|
// Paths can be absolute or relative to the deps cache dir where
|
65532
65559
|
// the _metadata.json is located
|
65533
65560
|
if (key === 'file' || key === 'src') {
|
@@ -65542,6 +65569,8 @@ function parseDepsOptimizerMetadata(jsonMetadata, depsCacheDir) {
|
|
65542
65569
|
}
|
65543
65570
|
const metadata = {
|
65544
65571
|
hash,
|
65572
|
+
lockfileHash,
|
65573
|
+
configHash,
|
65545
65574
|
browserHash,
|
65546
65575
|
optimized: {},
|
65547
65576
|
discovered: {},
|
@@ -65572,9 +65601,11 @@ function parseDepsOptimizerMetadata(jsonMetadata, depsCacheDir) {
|
|
65572
65601
|
* browserHash to allow long term caching
|
65573
65602
|
*/
|
65574
65603
|
function stringifyDepsOptimizerMetadata(metadata, depsCacheDir) {
|
65575
|
-
const { hash, browserHash, optimized, chunks } = metadata;
|
65604
|
+
const { hash, configHash, lockfileHash, browserHash, optimized, chunks } = metadata;
|
65576
65605
|
return JSON.stringify({
|
65577
65606
|
hash,
|
65607
|
+
configHash,
|
65608
|
+
lockfileHash,
|
65578
65609
|
browserHash,
|
65579
65610
|
optimized: Object.fromEntries(Object.values(optimized).map(({ id, src, file, fileHash, needsInterop }) => [
|
65580
65611
|
id,
|
@@ -65688,25 +65719,11 @@ const lockfileFormats = [
|
|
65688
65719
|
return process.env.npm_config_user_agent?.startsWith(manager) ? 1 : -1;
|
65689
65720
|
});
|
65690
65721
|
const lockfileNames = lockfileFormats.map((l) => l.name);
|
65691
|
-
function
|
65692
|
-
|
65693
|
-
let content = lockfilePath ? fs$l.readFileSync(lockfilePath, 'utf-8') : '';
|
65694
|
-
if (lockfilePath) {
|
65695
|
-
const lockfileName = path$o.basename(lockfilePath);
|
65696
|
-
const { checkPatches } = lockfileFormats.find((f) => f.name === lockfileName);
|
65697
|
-
if (checkPatches) {
|
65698
|
-
// Default of https://github.com/ds300/patch-package
|
65699
|
-
const fullPath = path$o.join(path$o.dirname(lockfilePath), 'patches');
|
65700
|
-
const stat = tryStatSync(fullPath);
|
65701
|
-
if (stat?.isDirectory()) {
|
65702
|
-
content += stat.mtimeMs.toString();
|
65703
|
-
}
|
65704
|
-
}
|
65705
|
-
}
|
65706
|
-
// also take config into account
|
65722
|
+
function getConfigHash(config, ssr) {
|
65723
|
+
// Take config into account
|
65707
65724
|
// only a subset of config options that can affect dep optimization
|
65708
65725
|
const optimizeDeps = getDepOptimizationConfig(config, ssr);
|
65709
|
-
content
|
65726
|
+
const content = JSON.stringify({
|
65710
65727
|
mode: process.env.NODE_ENV || config.mode,
|
65711
65728
|
root: config.root,
|
65712
65729
|
resolve: config.resolve,
|
@@ -65714,8 +65731,12 @@ function getDepHash(config, ssr) {
|
|
65714
65731
|
assetsInclude: config.assetsInclude,
|
65715
65732
|
plugins: config.plugins.map((p) => p.name),
|
65716
65733
|
optimizeDeps: {
|
65717
|
-
include: optimizeDeps?.include
|
65718
|
-
|
65734
|
+
include: optimizeDeps?.include
|
65735
|
+
? Array.from(new Set(optimizeDeps.include)).sort()
|
65736
|
+
: undefined,
|
65737
|
+
exclude: optimizeDeps?.exclude
|
65738
|
+
? Array.from(new Set(optimizeDeps.exclude)).sort()
|
65739
|
+
: undefined,
|
65719
65740
|
esbuildOptions: {
|
65720
65741
|
...optimizeDeps?.esbuildOptions,
|
65721
65742
|
plugins: optimizeDeps?.esbuildOptions?.plugins?.map((p) => p.name),
|
@@ -65729,6 +65750,33 @@ function getDepHash(config, ssr) {
|
|
65729
65750
|
});
|
65730
65751
|
return getHash(content);
|
65731
65752
|
}
|
65753
|
+
function getLockfileHash(config, ssr) {
|
65754
|
+
const lockfilePath = lookupFile(config.root, lockfileNames);
|
65755
|
+
let content = lockfilePath ? fs$l.readFileSync(lockfilePath, 'utf-8') : '';
|
65756
|
+
if (lockfilePath) {
|
65757
|
+
const lockfileName = path$o.basename(lockfilePath);
|
65758
|
+
const { checkPatches } = lockfileFormats.find((f) => f.name === lockfileName);
|
65759
|
+
if (checkPatches) {
|
65760
|
+
// Default of https://github.com/ds300/patch-package
|
65761
|
+
const fullPath = path$o.join(path$o.dirname(lockfilePath), 'patches');
|
65762
|
+
const stat = tryStatSync(fullPath);
|
65763
|
+
if (stat?.isDirectory()) {
|
65764
|
+
content += stat.mtimeMs.toString();
|
65765
|
+
}
|
65766
|
+
}
|
65767
|
+
}
|
65768
|
+
return getHash(content);
|
65769
|
+
}
|
65770
|
+
function getDepHash(config, ssr) {
|
65771
|
+
const lockfileHash = getLockfileHash(config);
|
65772
|
+
const configHash = getConfigHash(config, ssr);
|
65773
|
+
const hash = getHash(lockfileHash + configHash);
|
65774
|
+
return {
|
65775
|
+
hash,
|
65776
|
+
lockfileHash,
|
65777
|
+
configHash,
|
65778
|
+
};
|
65779
|
+
}
|
65732
65780
|
function getOptimizedBrowserHash(hash, deps, timestamp = '') {
|
65733
65781
|
return getHash(hash + JSON.stringify(deps) + timestamp);
|
65734
65782
|
}
|
@@ -65823,7 +65871,6 @@ var index = {
|
|
65823
65871
|
depsLogString: depsLogString,
|
65824
65872
|
discoverProjectDependencies: discoverProjectDependencies,
|
65825
65873
|
extractExportsData: extractExportsData,
|
65826
|
-
getDepHash: getDepHash,
|
65827
65874
|
getDepsCacheDir: getDepsCacheDir,
|
65828
65875
|
getDepsOptimizer: getDepsOptimizer,
|
65829
65876
|
getOptimizedDepPath: getOptimizedDepPath,
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { z as commonjsGlobal, y as getDefaultExportFromCjs } from './dep-
|
1
|
+
import { z as commonjsGlobal, y as getDefaultExportFromCjs } from './dep-Pluk1iaB.js';
|
2
2
|
import require$$0__default from 'fs';
|
3
3
|
import require$$0 from 'postcss';
|
4
4
|
import require$$0$1 from 'path';
|
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 { x as colors, k as createLogger, r as resolveConfig } from './chunks/dep-
|
5
|
+
import { x as colors, k as createLogger, r as resolveConfig } from './chunks/dep-Pluk1iaB.js';
|
6
6
|
import { VERSION } from './constants.js';
|
7
7
|
import 'node:fs/promises';
|
8
8
|
import 'node:url';
|
@@ -759,7 +759,7 @@ cli
|
|
759
759
|
filterDuplicateOptions(options);
|
760
760
|
// output structure is preserved even after bundling so require()
|
761
761
|
// is ok here
|
762
|
-
const { createServer } = await import('./chunks/dep-
|
762
|
+
const { createServer } = await import('./chunks/dep-Pluk1iaB.js').then(function (n) { return n.A; });
|
763
763
|
try {
|
764
764
|
const server = await createServer({
|
765
765
|
root,
|
@@ -839,7 +839,7 @@ cli
|
|
839
839
|
.option('-w, --watch', `[boolean] rebuilds when modules have changed on disk`)
|
840
840
|
.action(async (root, options) => {
|
841
841
|
filterDuplicateOptions(options);
|
842
|
-
const { build } = await import('./chunks/dep-
|
842
|
+
const { build } = await import('./chunks/dep-Pluk1iaB.js').then(function (n) { return n.C; });
|
843
843
|
const buildOptions = cleanOptions(options);
|
844
844
|
try {
|
845
845
|
await build({
|
@@ -867,7 +867,7 @@ cli
|
|
867
867
|
.option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
|
868
868
|
.action(async (root, options) => {
|
869
869
|
filterDuplicateOptions(options);
|
870
|
-
const { optimizeDeps } = await import('./chunks/dep-
|
870
|
+
const { optimizeDeps } = await import('./chunks/dep-Pluk1iaB.js').then(function (n) { return n.B; });
|
871
871
|
try {
|
872
872
|
const config = await resolveConfig({
|
873
873
|
root,
|
@@ -893,7 +893,7 @@ cli
|
|
893
893
|
.option('--outDir <dir>', `[string] output directory (default: dist)`)
|
894
894
|
.action(async (root, options) => {
|
895
895
|
filterDuplicateOptions(options);
|
896
|
-
const { preview } = await import('./chunks/dep-
|
896
|
+
const { preview } = await import('./chunks/dep-Pluk1iaB.js').then(function (n) { return n.D; });
|
897
897
|
try {
|
898
898
|
const server = await preview({
|
899
899
|
root,
|
package/dist/node/index.d.ts
CHANGED
@@ -2570,6 +2570,16 @@ interface DepOptimizationMetadata {
|
|
2570
2570
|
* This is checked on server startup to avoid unnecessary re-bundles.
|
2571
2571
|
*/
|
2572
2572
|
hash: string;
|
2573
|
+
/**
|
2574
|
+
* This hash is determined by dependency lockfiles.
|
2575
|
+
* This is checked on server startup to avoid unnecessary re-bundles.
|
2576
|
+
*/
|
2577
|
+
lockfileHash: string;
|
2578
|
+
/**
|
2579
|
+
* This hash is determined by user config.
|
2580
|
+
* This is checked on server startup to avoid unnecessary re-bundles.
|
2581
|
+
*/
|
2582
|
+
configHash: string;
|
2573
2583
|
/**
|
2574
2584
|
* The browser hash is determined by the main hash plus additional dependencies
|
2575
2585
|
* discovered at runtime. This is used to invalidate browser requests to
|
package/dist/node/index.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
export { parseAst, parseAstAsync } from 'rollup/parseAst';
|
2
|
-
import { i as isInNodeModules } from './chunks/dep-
|
3
|
-
export { b as build, e as buildErrorMessage, h as createFilter, k as createLogger, c as createServer, d as defineConfig, f as formatPostcssSourceMap, u as isFileServingAllowed, l as loadConfigFromFile, v as loadEnv, g as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, a as preprocessCSS, p as preview, r as resolveConfig, w as resolveEnvPrefix, q as searchForWorkspaceRoot, j as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-
|
2
|
+
import { i as isInNodeModules } from './chunks/dep-Pluk1iaB.js';
|
3
|
+
export { b as build, e as buildErrorMessage, h as createFilter, k as createLogger, c as createServer, d as defineConfig, f as formatPostcssSourceMap, u as isFileServingAllowed, l as loadConfigFromFile, v as loadEnv, g as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, a as preprocessCSS, p as preview, r as resolveConfig, w as resolveEnvPrefix, q as searchForWorkspaceRoot, j as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-Pluk1iaB.js';
|
4
4
|
export { VERSION as version } from './constants.js';
|
5
5
|
export { version as esbuildVersion } from 'esbuild';
|
6
6
|
export { VERSION as rollupVersion } from 'rollup';
|