vite 5.0.8 → 5.0.10
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-R0I0XnyH.js} +137 -88
- package/dist/node/chunks/{dep-Y5q53UKR.js → dep-TyoTMUQy.js} +1 -1
- package/dist/node/chunks/{dep-WV5u8Hxr.js → dep-mc9zj7Ue.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
@@ -16739,13 +16739,15 @@ async function urlToBuiltUrl(url, importer, config, pluginContext, shouldInline)
|
|
16739
16739
|
// skip public check since we just did it above
|
16740
16740
|
true, shouldInline);
|
16741
16741
|
}
|
16742
|
+
const nestedQuotesRE = /"[^"']*'[^"]*"|'[^'"]*"[^']*'/;
|
16742
16743
|
// Inspired by https://github.com/iconify/iconify/blob/main/packages/utils/src/svg/url.ts
|
16743
16744
|
function svgToDataURL(content) {
|
16744
16745
|
const stringContent = content.toString();
|
16745
16746
|
// If the SVG contains some text or HTML, any transformation is unsafe, and given that double quotes would then
|
16746
16747
|
// need to be escaped, the gain to use a data URI would be ridiculous if not negative
|
16747
16748
|
if (stringContent.includes('<text') ||
|
16748
|
-
stringContent.includes('<foreignObject')
|
16749
|
+
stringContent.includes('<foreignObject') ||
|
16750
|
+
nestedQuotesRE.test(stringContent)) {
|
16749
16751
|
return `data:image/svg+xml;base64,${content.toString('base64')}`;
|
16750
16752
|
}
|
16751
16753
|
else {
|
@@ -40076,8 +40078,8 @@ function createCachedImport(imp) {
|
|
40076
40078
|
return cached;
|
40077
40079
|
};
|
40078
40080
|
}
|
40079
|
-
const importPostcssImport = createCachedImport(() => import('./dep-
|
40080
|
-
const importPostcssModules = createCachedImport(() => import('./dep-
|
40081
|
+
const importPostcssImport = createCachedImport(() => import('./dep-TyoTMUQy.js').then(function (n) { return n.i; }));
|
40082
|
+
const importPostcssModules = createCachedImport(() => import('./dep-mc9zj7Ue.js').then(function (n) { return n.i; }));
|
40081
40083
|
const importPostcss = createCachedImport(() => import('postcss'));
|
40082
40084
|
/**
|
40083
40085
|
* @experimental
|
@@ -58778,6 +58780,8 @@ function htmlFallbackMiddleware(root, spaFallback, fsUtils = commonFsUtils) {
|
|
58778
58780
|
if (
|
58779
58781
|
// Only accept GET or HEAD
|
58780
58782
|
(req.method !== 'GET' && req.method !== 'HEAD') ||
|
58783
|
+
// Exclude default favicon requests
|
58784
|
+
req.url === '/favicon.ico' ||
|
58781
58785
|
// Require Accept: text/html or */*
|
58782
58786
|
!(req.headers.accept === undefined || // equivalent to `Accept: */*`
|
58783
58787
|
req.headers.accept === '' || // equivalent to `Accept: */*`
|
@@ -58885,6 +58889,11 @@ const debugCache = createDebugger('vite:cache');
|
|
58885
58889
|
const knownIgnoreList = new Set(['/', '/favicon.ico']);
|
58886
58890
|
function transformMiddleware(server) {
|
58887
58891
|
// Keep the named function. The name is visible in debug logs via `DEBUG=connect:dispatcher ...`
|
58892
|
+
// check if public dir is inside root dir
|
58893
|
+
const { root } = server.config;
|
58894
|
+
const publicDir = normalizePath$3(server.config.publicDir);
|
58895
|
+
const publicDirInRoot = publicDir.startsWith(withTrailingSlash(root));
|
58896
|
+
const publicPath = `${publicDir.slice(root.length)}/`;
|
58888
58897
|
return async function viteTransformMiddleware(req, res, next) {
|
58889
58898
|
if (req.method !== 'GET' || knownIgnoreList.has(req.url)) {
|
58890
58899
|
return next();
|
@@ -58946,35 +58955,8 @@ function transformMiddleware(server) {
|
|
58946
58955
|
}
|
58947
58956
|
}
|
58948
58957
|
}
|
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
|
-
}
|
58958
|
+
if (publicDirInRoot && url.startsWith(publicPath)) {
|
58959
|
+
warnAboutExplicitPublicPathInUrl(url);
|
58978
58960
|
}
|
58979
58961
|
if (isJSRequest(url) ||
|
58980
58962
|
isImportRequest(url) ||
|
@@ -59069,6 +59051,29 @@ function transformMiddleware(server) {
|
|
59069
59051
|
}
|
59070
59052
|
next();
|
59071
59053
|
};
|
59054
|
+
function warnAboutExplicitPublicPathInUrl(url) {
|
59055
|
+
let warning;
|
59056
|
+
if (isImportRequest(url)) {
|
59057
|
+
const rawUrl = removeImportQuery(url);
|
59058
|
+
if (urlRE.test(url)) {
|
59059
|
+
warning =
|
59060
|
+
`Assets in the public directory are served at the root path.\n` +
|
59061
|
+
`Instead of ${colors$1.cyan(rawUrl)}, use ${colors$1.cyan(rawUrl.replace(publicPath, '/'))}.`;
|
59062
|
+
}
|
59063
|
+
else {
|
59064
|
+
warning =
|
59065
|
+
'Assets in public directory cannot be imported from JavaScript.\n' +
|
59066
|
+
`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` +
|
59067
|
+
`If you intend to use the URL of that asset, use ${colors$1.cyan(injectQuery(rawUrl.replace(publicPath, '/'), 'url'))}.`;
|
59068
|
+
}
|
59069
|
+
}
|
59070
|
+
else {
|
59071
|
+
warning =
|
59072
|
+
`Files in the public directory are served at the root path.\n` +
|
59073
|
+
`Instead of ${colors$1.cyan(url)}, use ${colors$1.cyan(url.replace(publicPath, '/'))}.`;
|
59074
|
+
}
|
59075
|
+
server.config.logger.warn(colors$1.yellow(warning));
|
59076
|
+
}
|
59072
59077
|
}
|
59073
59078
|
|
59074
59079
|
function createDevHtmlTransformFn(config) {
|
@@ -59132,7 +59137,7 @@ const processNodeUrl = (url, useSrcSetReplacer, config, htmlPath, originalUrl, s
|
|
59132
59137
|
}
|
59133
59138
|
if (server && shouldPreTransform(url, config)) {
|
59134
59139
|
let preTransformUrl;
|
59135
|
-
if (url[0] === '/') {
|
59140
|
+
if (url[0] === '/' && url[1] !== '/') {
|
59136
59141
|
preTransformUrl = url;
|
59137
59142
|
}
|
59138
59143
|
else if (url[0] === '.' || isBareRelative(url)) {
|
@@ -59986,7 +59991,7 @@ async function _createServer(inlineConfig = {}, options) {
|
|
59986
59991
|
const watcher = watchEnabled
|
59987
59992
|
? chokidar.watch(
|
59988
59993
|
// config file dependencies and env file might be outside of root
|
59989
|
-
[root, ...config.configFileDependencies, config.envDir], resolvedWatchOptions)
|
59994
|
+
[...new Set([root, ...config.configFileDependencies, config.envDir])], resolvedWatchOptions)
|
59990
59995
|
: createNoopWatcher(resolvedWatchOptions);
|
59991
59996
|
const moduleGraph = new ModuleGraph((url, ssr) => container.resolveId(url, undefined, { ssr }));
|
59992
59997
|
const container = await createPluginContainer(config, moduleGraph, watcher);
|
@@ -61241,10 +61246,21 @@ async function workerFileToUrl(config, id, query) {
|
|
61241
61246
|
function webWorkerPostPlugin() {
|
61242
61247
|
return {
|
61243
61248
|
name: 'vite:worker-post',
|
61244
|
-
resolveImportMeta(property, {
|
61249
|
+
resolveImportMeta(property, { format }) {
|
61245
61250
|
// document is undefined in the worker, so we need to avoid it in iife
|
61246
|
-
if (
|
61247
|
-
|
61251
|
+
if (format === 'iife') {
|
61252
|
+
// compiling import.meta
|
61253
|
+
if (!property) {
|
61254
|
+
// rollup only supports `url` property. we only support `url` property as well.
|
61255
|
+
// https://github.com/rollup/rollup/blob/62b648e1cc6a1f00260bb85aa2050097bb4afd2b/src/ast/nodes/MetaProperty.ts#L164-L173
|
61256
|
+
return `{
|
61257
|
+
url: self.location.href
|
61258
|
+
}`;
|
61259
|
+
}
|
61260
|
+
// compiling import.meta.url
|
61261
|
+
if (property === 'url') {
|
61262
|
+
return 'self.location.href';
|
61263
|
+
}
|
61248
61264
|
}
|
61249
61265
|
return null;
|
61250
61266
|
},
|
@@ -61674,7 +61690,11 @@ function importAnalysisPlugin(config) {
|
|
61674
61690
|
url = resolved.id.slice(root.length);
|
61675
61691
|
}
|
61676
61692
|
else if (depsOptimizer?.isOptimizedDepFile(resolved.id) ||
|
61677
|
-
|
61693
|
+
// vite-plugin-react isn't following the leading \0 virtual module convention.
|
61694
|
+
// This is a temporary hack to avoid expensive fs checks for React apps.
|
61695
|
+
// We'll remove this as soon we're able to fix the react plugins.
|
61696
|
+
(resolved.id !== '/@react-refresh' &&
|
61697
|
+
path$o.isAbsolute(resolved.id) &&
|
61678
61698
|
fsUtils.existsSync(cleanUrl(resolved.id)))) {
|
61679
61699
|
// an optimized deps may not yet exists in the filesystem, or
|
61680
61700
|
// a regular file exists but is out of root: rewrite to absolute /@fs/ paths
|
@@ -64143,16 +64163,6 @@ function esbuildScanPlugin(config, container, depImports, missing, entries) {
|
|
64143
64163
|
external: doExternalize(path),
|
64144
64164
|
};
|
64145
64165
|
});
|
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
64166
|
};
|
64157
64167
|
// css
|
64158
64168
|
setupExternalize(CSS_LANGS_RE, isUnlessEntry);
|
@@ -64212,6 +64222,15 @@ function esbuildScanPlugin(config, container, depImports, missing, entries) {
|
|
64212
64222
|
contents,
|
64213
64223
|
};
|
64214
64224
|
});
|
64225
|
+
// onResolve is not called for glob imports.
|
64226
|
+
// we need to add that here as well until esbuild calls onResolve for glob imports.
|
64227
|
+
// https://github.com/evanw/esbuild/issues/3317
|
64228
|
+
build.onLoad({ filter: /.*/, namespace: 'file' }, () => {
|
64229
|
+
return {
|
64230
|
+
loader: 'js',
|
64231
|
+
contents: 'export default {}',
|
64232
|
+
};
|
64233
|
+
});
|
64215
64234
|
},
|
64216
64235
|
};
|
64217
64236
|
}
|
@@ -65055,9 +65074,11 @@ async function optimizeServerSsrDeps(config) {
|
|
65055
65074
|
return result.metadata;
|
65056
65075
|
}
|
65057
65076
|
function initDepsOptimizerMetadata(config, ssr, timestamp) {
|
65058
|
-
const hash = getDepHash(config, ssr);
|
65077
|
+
const { lockfileHash, configHash, hash } = getDepHash(config, ssr);
|
65059
65078
|
return {
|
65060
65079
|
hash,
|
65080
|
+
lockfileHash,
|
65081
|
+
configHash,
|
65061
65082
|
browserHash: getOptimizedBrowserHash(hash, {}, timestamp),
|
65062
65083
|
optimized: {},
|
65063
65084
|
chunks: {},
|
@@ -65091,11 +65112,19 @@ async function loadCachedDepOptimizationMetadata(config, ssr, force = config.opt
|
|
65091
65112
|
}
|
65092
65113
|
catch (e) { }
|
65093
65114
|
// hash is consistent, no need to re-bundle
|
65094
|
-
if (cachedMetadata
|
65095
|
-
|
65096
|
-
|
65097
|
-
|
65098
|
-
|
65115
|
+
if (cachedMetadata) {
|
65116
|
+
if (cachedMetadata.lockfileHash !== getLockfileHash(config)) {
|
65117
|
+
config.logger.info('Re-optimizing dependencies because lockfile has changed');
|
65118
|
+
}
|
65119
|
+
else if (cachedMetadata.configHash !== getConfigHash(config, ssr)) {
|
65120
|
+
config.logger.info('Re-optimizing dependencies because vite config has changed');
|
65121
|
+
}
|
65122
|
+
else {
|
65123
|
+
log?.('Hash is consistent. Skipping. Use --force to override.');
|
65124
|
+
// Nothing to commit or cancel as we are using the cache, we only
|
65125
|
+
// need to resolve the processing promise so requests can move on
|
65126
|
+
return cachedMetadata;
|
65127
|
+
}
|
65099
65128
|
}
|
65100
65129
|
}
|
65101
65130
|
else {
|
@@ -65125,7 +65154,7 @@ function discoverProjectDependencies(config) {
|
|
65125
65154
|
};
|
65126
65155
|
}
|
65127
65156
|
function toDiscoveredDependencies(config, deps, ssr, timestamp) {
|
65128
|
-
const browserHash = getOptimizedBrowserHash(getDepHash(config, ssr), deps, timestamp);
|
65157
|
+
const browserHash = getOptimizedBrowserHash(getDepHash(config, ssr).hash, deps, timestamp);
|
65129
65158
|
const discovered = {};
|
65130
65159
|
for (const id in deps) {
|
65131
65160
|
const src = deps[id];
|
@@ -65155,7 +65184,7 @@ function runOptimizeDeps(resolvedConfig, depsInfo, ssr = resolvedConfig.command
|
|
65155
65184
|
};
|
65156
65185
|
const depsCacheDir = getDepsCacheDir(resolvedConfig, ssr);
|
65157
65186
|
const processingCacheDir = getProcessingDepsCacheDir(resolvedConfig, ssr);
|
65158
|
-
// Create a
|
65187
|
+
// Create a temporary directory so we don't need to delete optimized deps
|
65159
65188
|
// until they have been processed. This also avoids leaving the deps cache
|
65160
65189
|
// directory in a corrupted state if there is an error
|
65161
65190
|
fs$l.mkdirSync(processingCacheDir, { recursive: true });
|
@@ -65195,40 +65224,40 @@ function runOptimizeDeps(resolvedConfig, depsInfo, ssr = resolvedConfig.command
|
|
65195
65224
|
// we finish commiting the new deps cache files to the deps folder
|
65196
65225
|
committed = true;
|
65197
65226
|
// Write metadata file, then commit the processing folder to the global deps cache
|
65198
|
-
// Rewire the file paths from the
|
65227
|
+
// Rewire the file paths from the temporary processing dir to the final deps cache dir
|
65199
65228
|
const dataPath = path$o.join(processingCacheDir, '_metadata.json');
|
65200
65229
|
debug$1?.(colors$1.green(`creating _metadata.json in ${processingCacheDir}`));
|
65201
65230
|
fs$l.writeFileSync(dataPath, stringifyDepsOptimizerMetadata(metadata, depsCacheDir));
|
65202
65231
|
// 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
|
65232
|
+
// we first rename the old depsCacheDir to a temporary path, then we rename the
|
65204
65233
|
// new processing cache dir to the depsCacheDir. In systems where doing so in sync
|
65205
65234
|
// is safe, we do an atomic operation (at least for this thread). For Windows, we
|
65206
65235
|
// found there are cases where the rename operation may finish before it's done
|
65207
65236
|
// so we do a graceful rename checking that the folder has been properly renamed.
|
65208
65237
|
// We found that the rename-rename (then delete the old folder in the background)
|
65209
65238
|
// is safer than a delete-rename operation.
|
65210
|
-
const
|
65239
|
+
const temporaryPath = depsCacheDir + getTempSuffix();
|
65211
65240
|
const depsCacheDirPresent = fs$l.existsSync(depsCacheDir);
|
65212
65241
|
if (isWindows$4) {
|
65213
65242
|
if (depsCacheDirPresent) {
|
65214
|
-
debug$1?.(colors$1.green(`renaming ${depsCacheDir} to ${
|
65215
|
-
await safeRename(depsCacheDir,
|
65243
|
+
debug$1?.(colors$1.green(`renaming ${depsCacheDir} to ${temporaryPath}`));
|
65244
|
+
await safeRename(depsCacheDir, temporaryPath);
|
65216
65245
|
}
|
65217
65246
|
debug$1?.(colors$1.green(`renaming ${processingCacheDir} to ${depsCacheDir}`));
|
65218
65247
|
await safeRename(processingCacheDir, depsCacheDir);
|
65219
65248
|
}
|
65220
65249
|
else {
|
65221
65250
|
if (depsCacheDirPresent) {
|
65222
|
-
debug$1?.(colors$1.green(`renaming ${depsCacheDir} to ${
|
65223
|
-
fs$l.renameSync(depsCacheDir,
|
65251
|
+
debug$1?.(colors$1.green(`renaming ${depsCacheDir} to ${temporaryPath}`));
|
65252
|
+
fs$l.renameSync(depsCacheDir, temporaryPath);
|
65224
65253
|
}
|
65225
65254
|
debug$1?.(colors$1.green(`renaming ${processingCacheDir} to ${depsCacheDir}`));
|
65226
65255
|
fs$l.renameSync(processingCacheDir, depsCacheDir);
|
65227
65256
|
}
|
65228
|
-
// Delete
|
65257
|
+
// Delete temporary path in the background
|
65229
65258
|
if (depsCacheDirPresent) {
|
65230
|
-
debug$1?.(colors$1.green(`removing cache temp dir ${
|
65231
|
-
fsp.rm(
|
65259
|
+
debug$1?.(colors$1.green(`removing cache temp dir ${temporaryPath}`));
|
65260
|
+
fsp.rm(temporaryPath, { recursive: true, force: true });
|
65232
65261
|
}
|
65233
65262
|
},
|
65234
65263
|
};
|
@@ -65527,7 +65556,7 @@ function createIsOptimizedDepUrl(config) {
|
|
65527
65556
|
};
|
65528
65557
|
}
|
65529
65558
|
function parseDepsOptimizerMetadata(jsonMetadata, depsCacheDir) {
|
65530
|
-
const { hash, browserHash, optimized, chunks } = JSON.parse(jsonMetadata, (key, value) => {
|
65559
|
+
const { hash, lockfileHash, configHash, browserHash, optimized, chunks } = JSON.parse(jsonMetadata, (key, value) => {
|
65531
65560
|
// Paths can be absolute or relative to the deps cache dir where
|
65532
65561
|
// the _metadata.json is located
|
65533
65562
|
if (key === 'file' || key === 'src') {
|
@@ -65542,6 +65571,8 @@ function parseDepsOptimizerMetadata(jsonMetadata, depsCacheDir) {
|
|
65542
65571
|
}
|
65543
65572
|
const metadata = {
|
65544
65573
|
hash,
|
65574
|
+
lockfileHash,
|
65575
|
+
configHash,
|
65545
65576
|
browserHash,
|
65546
65577
|
optimized: {},
|
65547
65578
|
discovered: {},
|
@@ -65572,9 +65603,11 @@ function parseDepsOptimizerMetadata(jsonMetadata, depsCacheDir) {
|
|
65572
65603
|
* browserHash to allow long term caching
|
65573
65604
|
*/
|
65574
65605
|
function stringifyDepsOptimizerMetadata(metadata, depsCacheDir) {
|
65575
|
-
const { hash, browserHash, optimized, chunks } = metadata;
|
65606
|
+
const { hash, configHash, lockfileHash, browserHash, optimized, chunks } = metadata;
|
65576
65607
|
return JSON.stringify({
|
65577
65608
|
hash,
|
65609
|
+
configHash,
|
65610
|
+
lockfileHash,
|
65578
65611
|
browserHash,
|
65579
65612
|
optimized: Object.fromEntries(Object.values(optimized).map(({ id, src, file, fileHash, needsInterop }) => [
|
65580
65613
|
id,
|
@@ -65688,25 +65721,11 @@ const lockfileFormats = [
|
|
65688
65721
|
return process.env.npm_config_user_agent?.startsWith(manager) ? 1 : -1;
|
65689
65722
|
});
|
65690
65723
|
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
|
65724
|
+
function getConfigHash(config, ssr) {
|
65725
|
+
// Take config into account
|
65707
65726
|
// only a subset of config options that can affect dep optimization
|
65708
65727
|
const optimizeDeps = getDepOptimizationConfig(config, ssr);
|
65709
|
-
content
|
65728
|
+
const content = JSON.stringify({
|
65710
65729
|
mode: process.env.NODE_ENV || config.mode,
|
65711
65730
|
root: config.root,
|
65712
65731
|
resolve: config.resolve,
|
@@ -65714,8 +65733,12 @@ function getDepHash(config, ssr) {
|
|
65714
65733
|
assetsInclude: config.assetsInclude,
|
65715
65734
|
plugins: config.plugins.map((p) => p.name),
|
65716
65735
|
optimizeDeps: {
|
65717
|
-
include: optimizeDeps?.include
|
65718
|
-
|
65736
|
+
include: optimizeDeps?.include
|
65737
|
+
? Array.from(new Set(optimizeDeps.include)).sort()
|
65738
|
+
: undefined,
|
65739
|
+
exclude: optimizeDeps?.exclude
|
65740
|
+
? Array.from(new Set(optimizeDeps.exclude)).sort()
|
65741
|
+
: undefined,
|
65719
65742
|
esbuildOptions: {
|
65720
65743
|
...optimizeDeps?.esbuildOptions,
|
65721
65744
|
plugins: optimizeDeps?.esbuildOptions?.plugins?.map((p) => p.name),
|
@@ -65729,6 +65752,33 @@ function getDepHash(config, ssr) {
|
|
65729
65752
|
});
|
65730
65753
|
return getHash(content);
|
65731
65754
|
}
|
65755
|
+
function getLockfileHash(config, ssr) {
|
65756
|
+
const lockfilePath = lookupFile(config.root, lockfileNames);
|
65757
|
+
let content = lockfilePath ? fs$l.readFileSync(lockfilePath, 'utf-8') : '';
|
65758
|
+
if (lockfilePath) {
|
65759
|
+
const lockfileName = path$o.basename(lockfilePath);
|
65760
|
+
const { checkPatches } = lockfileFormats.find((f) => f.name === lockfileName);
|
65761
|
+
if (checkPatches) {
|
65762
|
+
// Default of https://github.com/ds300/patch-package
|
65763
|
+
const fullPath = path$o.join(path$o.dirname(lockfilePath), 'patches');
|
65764
|
+
const stat = tryStatSync(fullPath);
|
65765
|
+
if (stat?.isDirectory()) {
|
65766
|
+
content += stat.mtimeMs.toString();
|
65767
|
+
}
|
65768
|
+
}
|
65769
|
+
}
|
65770
|
+
return getHash(content);
|
65771
|
+
}
|
65772
|
+
function getDepHash(config, ssr) {
|
65773
|
+
const lockfileHash = getLockfileHash(config);
|
65774
|
+
const configHash = getConfigHash(config, ssr);
|
65775
|
+
const hash = getHash(lockfileHash + configHash);
|
65776
|
+
return {
|
65777
|
+
hash,
|
65778
|
+
lockfileHash,
|
65779
|
+
configHash,
|
65780
|
+
};
|
65781
|
+
}
|
65732
65782
|
function getOptimizedBrowserHash(hash, deps, timestamp = '') {
|
65733
65783
|
return getHash(hash + JSON.stringify(deps) + timestamp);
|
65734
65784
|
}
|
@@ -65823,7 +65873,6 @@ var index = {
|
|
65823
65873
|
depsLogString: depsLogString,
|
65824
65874
|
discoverProjectDependencies: discoverProjectDependencies,
|
65825
65875
|
extractExportsData: extractExportsData,
|
65826
|
-
getDepHash: getDepHash,
|
65827
65876
|
getDepsCacheDir: getDepsCacheDir,
|
65828
65877
|
getDepsOptimizer: getDepsOptimizer,
|
65829
65878
|
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-R0I0XnyH.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-R0I0XnyH.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-R0I0XnyH.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-R0I0XnyH.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-R0I0XnyH.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-R0I0XnyH.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-R0I0XnyH.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-R0I0XnyH.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';
|