vite 5.0.5 → 5.0.7
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.
@@ -1,4 +1,4 @@
|
|
1
|
-
import { z as commonjsGlobal, y as getDefaultExportFromCjs } from './dep-
|
1
|
+
import { z as commonjsGlobal, y as getDefaultExportFromCjs } from './dep-wTaJK0Jt.js';
|
2
2
|
import require$$0__default from 'fs';
|
3
3
|
import require$$0 from 'postcss';
|
4
4
|
import require$$0$1 from 'path';
|
@@ -27,11 +27,11 @@ import { createHash as createHash$2 } from 'node:crypto';
|
|
27
27
|
import { promises } from 'node:dns';
|
28
28
|
import { CLIENT_ENTRY, VALID_ID_PREFIX, NULL_BYTE_PLACEHOLDER, OPTIMIZABLE_ENTRY_RE, FS_PREFIX, wildcardHosts, loopbackHosts, CLIENT_PUBLIC_PATH, ENV_PUBLIC_PATH, ENV_ENTRY, DEP_VERSION_RE, SPECIAL_QUERY_RE, DEFAULT_MAIN_FIELDS, DEFAULT_EXTENSIONS, CSS_LANGS_RE, ESBUILD_MODULES_TARGET, KNOWN_ASSET_TYPES, VITE_PACKAGE_DIR, DEFAULT_DEV_PORT, CLIENT_DIR, JS_TYPES_RE, VERSION as VERSION$1, DEFAULT_PREVIEW_PORT, DEFAULT_ASSETS_RE, DEFAULT_CONFIG_FILES } from '../constants.js';
|
29
29
|
import require$$0$a from 'crypto';
|
30
|
-
import { Buffer as Buffer$1 } from 'node:buffer';
|
31
30
|
import require$$0$8, { createRequire as createRequire$2 } from 'module';
|
32
31
|
import assert$1 from 'node:assert';
|
33
32
|
import process$1 from 'node:process';
|
34
33
|
import v8 from 'node:v8';
|
34
|
+
import { Buffer as Buffer$1 } from 'node:buffer';
|
35
35
|
import { VERSION } from 'rollup';
|
36
36
|
import { parseAstAsync, parseAst } from 'rollup/parseAst';
|
37
37
|
import * as qs from 'querystring';
|
@@ -12419,6 +12419,33 @@ function copyDir(srcDir, destDir) {
|
|
12419
12419
|
}
|
12420
12420
|
}
|
12421
12421
|
}
|
12422
|
+
const ERR_SYMLINK_IN_RECURSIVE_READDIR = 'ERR_SYMLINK_IN_RECURSIVE_READDIR';
|
12423
|
+
async function recursiveReaddir(dir) {
|
12424
|
+
if (!fs$l.existsSync(dir)) {
|
12425
|
+
return [];
|
12426
|
+
}
|
12427
|
+
let dirents;
|
12428
|
+
try {
|
12429
|
+
dirents = await fsp.readdir(dir, { withFileTypes: true });
|
12430
|
+
}
|
12431
|
+
catch (e) {
|
12432
|
+
if (e.code === 'EACCES') {
|
12433
|
+
// Ignore permission errors
|
12434
|
+
return [];
|
12435
|
+
}
|
12436
|
+
throw e;
|
12437
|
+
}
|
12438
|
+
if (dirents.some((dirent) => dirent.isSymbolicLink())) {
|
12439
|
+
const err = new Error('Symbolic links are not supported in recursiveReaddir');
|
12440
|
+
err.code = ERR_SYMLINK_IN_RECURSIVE_READDIR;
|
12441
|
+
throw err;
|
12442
|
+
}
|
12443
|
+
const files = await Promise.all(dirents.map((dirent) => {
|
12444
|
+
const res = path$o.resolve(dir, dirent.name);
|
12445
|
+
return dirent.isDirectory() ? recursiveReaddir(res) : normalizePath$3(res);
|
12446
|
+
}));
|
12447
|
+
return files.flat(1);
|
12448
|
+
}
|
12422
12449
|
// `fs.realpathSync.native` resolves differently in Windows network drive,
|
12423
12450
|
// causing file read errors. skip for now.
|
12424
12451
|
// https://github.com/nodejs/node/issues/37737
|
@@ -16401,6 +16428,48 @@ function lookup(extn) {
|
|
16401
16428
|
return mimes$1[!~idx ? tmp : tmp.substring(++idx)];
|
16402
16429
|
}
|
16403
16430
|
|
16431
|
+
const publicFilesMap = new WeakMap();
|
16432
|
+
async function initPublicFiles(config) {
|
16433
|
+
let fileNames;
|
16434
|
+
try {
|
16435
|
+
fileNames = await recursiveReaddir(config.publicDir);
|
16436
|
+
}
|
16437
|
+
catch (e) {
|
16438
|
+
if (e.code === ERR_SYMLINK_IN_RECURSIVE_READDIR) {
|
16439
|
+
return;
|
16440
|
+
}
|
16441
|
+
throw e;
|
16442
|
+
}
|
16443
|
+
const publicFiles = new Set(fileNames.map((fileName) => fileName.slice(config.publicDir.length)));
|
16444
|
+
publicFilesMap.set(config, publicFiles);
|
16445
|
+
return publicFiles;
|
16446
|
+
}
|
16447
|
+
function getPublicFiles(config) {
|
16448
|
+
return publicFilesMap.get(config);
|
16449
|
+
}
|
16450
|
+
function checkPublicFile(url, config) {
|
16451
|
+
// note if the file is in /public, the resolver would have returned it
|
16452
|
+
// as-is so it's not going to be a fully resolved path.
|
16453
|
+
const { publicDir } = config;
|
16454
|
+
if (!publicDir || url[0] !== '/') {
|
16455
|
+
return;
|
16456
|
+
}
|
16457
|
+
const fileName = cleanUrl(url);
|
16458
|
+
// short-circuit if we have an in-memory publicFiles cache
|
16459
|
+
const publicFiles = getPublicFiles(config);
|
16460
|
+
if (publicFiles) {
|
16461
|
+
return publicFiles.has(fileName)
|
16462
|
+
? normalizePath$3(path$o.join(publicDir, fileName))
|
16463
|
+
: undefined;
|
16464
|
+
}
|
16465
|
+
const publicFile = normalizePath$3(path$o.join(publicDir, fileName));
|
16466
|
+
if (!publicFile.startsWith(withTrailingSlash(normalizePath$3(publicDir)))) {
|
16467
|
+
// can happen if URL starts with '../'
|
16468
|
+
return;
|
16469
|
+
}
|
16470
|
+
return fs$l.existsSync(publicFile) ? publicFile : undefined;
|
16471
|
+
}
|
16472
|
+
|
16404
16473
|
// referenceId is base64url but replaces - with $
|
16405
16474
|
const assetUrlRE = /__VITE_ASSET__([\w$]+)__(?:\$_(.*?)__)?/g;
|
16406
16475
|
const rawRE = /(?:\?|&)raw(?:&|$)/;
|
@@ -16550,24 +16619,6 @@ function assetPlugin(config) {
|
|
16550
16619
|
},
|
16551
16620
|
};
|
16552
16621
|
}
|
16553
|
-
function checkPublicFile(url, { publicDir }) {
|
16554
|
-
// note if the file is in /public, the resolver would have returned it
|
16555
|
-
// as-is so it's not going to be a fully resolved path.
|
16556
|
-
if (!publicDir || url[0] !== '/') {
|
16557
|
-
return;
|
16558
|
-
}
|
16559
|
-
const publicFile = path$o.join(publicDir, cleanUrl(url));
|
16560
|
-
if (!normalizePath$3(publicFile).startsWith(withTrailingSlash(normalizePath$3(publicDir)))) {
|
16561
|
-
// can happen if URL starts with '../'
|
16562
|
-
return;
|
16563
|
-
}
|
16564
|
-
if (fs$l.existsSync(publicFile)) {
|
16565
|
-
return publicFile;
|
16566
|
-
}
|
16567
|
-
else {
|
16568
|
-
return;
|
16569
|
-
}
|
16570
|
-
}
|
16571
16622
|
async function fileToUrl$1(id, config, ctx) {
|
16572
16623
|
if (config.command === 'serve') {
|
16573
16624
|
return fileToDevUrl(id, config);
|
@@ -16626,7 +16677,7 @@ function isGitLfsPlaceholder(content) {
|
|
16626
16677
|
* Register an asset to be emitted as part of the bundle (if necessary)
|
16627
16678
|
* and returns the resolved public URL
|
16628
16679
|
*/
|
16629
|
-
async function fileToBuiltUrl(id, config, pluginContext, skipPublicCheck = false) {
|
16680
|
+
async function fileToBuiltUrl(id, config, pluginContext, skipPublicCheck = false, shouldInline) {
|
16630
16681
|
if (!skipPublicCheck && checkPublicFile(id, config)) {
|
16631
16682
|
return publicFileToBuiltUrl(id, config);
|
16632
16683
|
}
|
@@ -16637,13 +16688,17 @@ async function fileToBuiltUrl(id, config, pluginContext, skipPublicCheck = false
|
|
16637
16688
|
}
|
16638
16689
|
const file = cleanUrl(id);
|
16639
16690
|
const content = await fsp.readFile(file);
|
16691
|
+
if (shouldInline == null) {
|
16692
|
+
shouldInline =
|
16693
|
+
!!config.build.lib ||
|
16694
|
+
// Don't inline SVG with fragments, as they are meant to be reused
|
16695
|
+
(!(file.endsWith('.svg') && id.includes('#')) &&
|
16696
|
+
!file.endsWith('.html') &&
|
16697
|
+
content.length < Number(config.build.assetsInlineLimit) &&
|
16698
|
+
!isGitLfsPlaceholder(content));
|
16699
|
+
}
|
16640
16700
|
let url;
|
16641
|
-
if (
|
16642
|
-
// Don't inline SVG with fragments, as they are meant to be reused
|
16643
|
-
(!(file.endsWith('.svg') && id.includes('#')) &&
|
16644
|
-
!file.endsWith('.html') &&
|
16645
|
-
content.length < Number(config.build.assetsInlineLimit) &&
|
16646
|
-
!isGitLfsPlaceholder(content))) {
|
16701
|
+
if (shouldInline) {
|
16647
16702
|
if (config.build.lib && isGitLfsPlaceholder(content)) {
|
16648
16703
|
config.logger.warn(colors$1.yellow(`Inlined file ${id} was not downloaded via Git LFS`));
|
16649
16704
|
}
|
@@ -16673,7 +16728,7 @@ async function fileToBuiltUrl(id, config, pluginContext, skipPublicCheck = false
|
|
16673
16728
|
cache.set(id, url);
|
16674
16729
|
return url;
|
16675
16730
|
}
|
16676
|
-
async function urlToBuiltUrl(url, importer, config, pluginContext) {
|
16731
|
+
async function urlToBuiltUrl(url, importer, config, pluginContext, shouldInline) {
|
16677
16732
|
if (checkPublicFile(url, config)) {
|
16678
16733
|
return publicFileToBuiltUrl(url, config);
|
16679
16734
|
}
|
@@ -16682,7 +16737,7 @@ async function urlToBuiltUrl(url, importer, config, pluginContext) {
|
|
16682
16737
|
: path$o.join(path$o.dirname(importer), url);
|
16683
16738
|
return fileToBuiltUrl(file, config, pluginContext,
|
16684
16739
|
// skip public check since we just did it above
|
16685
|
-
true);
|
16740
|
+
true, shouldInline);
|
16686
16741
|
}
|
16687
16742
|
// Inspired by https://github.com/iconify/iconify/blob/main/packages/utils/src/svg/url.ts
|
16688
16743
|
function svgToDataURL(content) {
|
@@ -29259,7 +29314,7 @@ function equalWithoutSuffix(path, key, suffix) {
|
|
29259
29314
|
return key.endsWith(suffix) && key.slice(0, -suffix.length) === path;
|
29260
29315
|
}
|
29261
29316
|
function getRealPath(resolved, preserveSymlinks) {
|
29262
|
-
if (!preserveSymlinks
|
29317
|
+
if (!preserveSymlinks) {
|
29263
29318
|
resolved = safeRealpathSync(resolved);
|
29264
29319
|
}
|
29265
29320
|
return normalizePath$3(resolved);
|
@@ -37976,10 +38031,9 @@ function polyfill() {
|
|
37976
38031
|
const htmlProxyRE$1 = /\?html-proxy=?(?:&inline-css)?(?:&style-attr)?&index=(\d+)\.(js|css)$/;
|
37977
38032
|
const inlineCSSRE$1 = /__VITE_INLINE_CSS__([a-z\d]{8}_\d+)__/g;
|
37978
38033
|
// Do not allow preceding '.', but do allow preceding '...' for spread operations
|
37979
|
-
const inlineImportRE =
|
37980
|
-
// eslint-disable-next-line regexp/no-unused-capturing-group -- https://github.com/ota-meshi/eslint-plugin-regexp/issues/675
|
37981
|
-
/(?<!(?<!\.\.)\.)\bimport\s*\(("(?:[^"]|(?<=\\)")*"|'(?:[^']|(?<=\\)')*')\)/dg;
|
38034
|
+
const inlineImportRE = /(?<!(?<!\.\.)\.)\bimport\s*\(("(?:[^"]|(?<=\\)")*"|'(?:[^']|(?<=\\)')*')\)/dg;
|
37982
38035
|
const htmlLangRE = /\.(?:html|htm)$/;
|
38036
|
+
const spaceRe = /[\t\n\f\r ]/;
|
37983
38037
|
const importMapRE = /[ \t]*<script[^>]*type\s*=\s*(?:"importmap"|'importmap'|importmap)[^>]*>.*?<\/script>/is;
|
37984
38038
|
const moduleScriptRE = /[ \t]*<script[^>]*type\s*=\s*(?:"module"|'module'|module)[^>]*>/i;
|
37985
38039
|
const modulePreloadLinkRE = /[ \t]*<link[^>]*rel\s*=\s*(?:"modulepreload"|'modulepreload'|modulepreload)[\s\S]*?\/>/i;
|
@@ -38042,6 +38096,16 @@ const assetAttrsConfig = {
|
|
38042
38096
|
image: ['xlink:href', 'href'],
|
38043
38097
|
use: ['xlink:href', 'href'],
|
38044
38098
|
};
|
38099
|
+
// Some `<link rel>` elements should not be inlined in build. Excluding:
|
38100
|
+
// - `shortcut` : only valid for IE <9, use `icon`
|
38101
|
+
// - `mask-icon` : deprecated since Safari 12 (for pinned tabs)
|
38102
|
+
// - `apple-touch-icon-precomposed` : only valid for iOS <7 (for avoiding gloss effect)
|
38103
|
+
const noInlineLinkRels = new Set([
|
38104
|
+
'icon',
|
38105
|
+
'apple-touch-icon',
|
38106
|
+
'apple-touch-startup-image',
|
38107
|
+
'manifest',
|
38108
|
+
]);
|
38045
38109
|
const isAsyncScriptMap = new WeakMap();
|
38046
38110
|
function nodeIsElement(node) {
|
38047
38111
|
return node.nodeName[0] !== '#';
|
@@ -38203,13 +38267,13 @@ function buildHtmlPlugin(config) {
|
|
38203
38267
|
// references the post-build location, ignoring empty attributes and
|
38204
38268
|
// attributes that directly reference named output.
|
38205
38269
|
const namedOutput = Object.keys(config?.build?.rollupOptions?.input || {});
|
38206
|
-
const processAssetUrl = async (url) => {
|
38270
|
+
const processAssetUrl = async (url, shouldInline) => {
|
38207
38271
|
if (url !== '' && // Empty attribute
|
38208
38272
|
!namedOutput.includes(url) && // Direct reference to named output
|
38209
38273
|
!namedOutput.includes(removeLeadingSlash(url)) // Allow for absolute references as named output can't be an absolute path
|
38210
38274
|
) {
|
38211
38275
|
try {
|
38212
|
-
return await urlToBuiltUrl(url, id, config, this);
|
38276
|
+
return await urlToBuiltUrl(url, id, config, this, shouldInline);
|
38213
38277
|
}
|
38214
38278
|
catch (e) {
|
38215
38279
|
if (e.code !== 'ENOENT') {
|
@@ -38309,8 +38373,16 @@ function buildHtmlPlugin(config) {
|
|
38309
38373
|
js += importExpression;
|
38310
38374
|
}
|
38311
38375
|
else {
|
38376
|
+
// If the node is a link, check if it can be inlined. If not, set `shouldInline`
|
38377
|
+
// to `false` to force no inline. If `undefined`, it leaves to the default heuristics.
|
38378
|
+
const isNoInlineLink = node.nodeName === 'link' &&
|
38379
|
+
node.attrs.some((p) => p.name === 'rel' &&
|
38380
|
+
p.value
|
38381
|
+
.split(spaceRe)
|
38382
|
+
.some((v) => noInlineLinkRels.has(v.toLowerCase())));
|
38383
|
+
const shouldInline = isNoInlineLink ? false : undefined;
|
38312
38384
|
assetUrlsPromises.push((async () => {
|
38313
|
-
const processedUrl = await processAssetUrl(url);
|
38385
|
+
const processedUrl = await processAssetUrl(url, shouldInline);
|
38314
38386
|
if (processedUrl !== url) {
|
38315
38387
|
overwriteAttrValue(s, getAttrSourceCodeLocation(node, attrKey), processedUrl);
|
38316
38388
|
}
|
@@ -39703,8 +39775,8 @@ function createCachedImport(imp) {
|
|
39703
39775
|
return cached;
|
39704
39776
|
};
|
39705
39777
|
}
|
39706
|
-
const importPostcssImport = createCachedImport(() => import('./dep-
|
39707
|
-
const importPostcssModules = createCachedImport(() => import('./dep-
|
39778
|
+
const importPostcssImport = createCachedImport(() => import('./dep-tttr_ygS.js').then(function (n) { return n.i; }));
|
39779
|
+
const importPostcssModules = createCachedImport(() => import('./dep-iw_F17O-.js').then(function (n) { return n.i; }));
|
39708
39780
|
const importPostcss = createCachedImport(() => import('postcss'));
|
39709
39781
|
/**
|
39710
39782
|
* @experimental
|
@@ -48640,7 +48712,7 @@ function sirv (dir, opts={}) {
|
|
48640
48712
|
}
|
48641
48713
|
|
48642
48714
|
const knownJavascriptExtensionRE = /\.[tj]sx?$/;
|
48643
|
-
const sirvOptions = ({ getHeaders,
|
48715
|
+
const sirvOptions = ({ getHeaders, }) => {
|
48644
48716
|
return {
|
48645
48717
|
dev: true,
|
48646
48718
|
etag: true,
|
@@ -48661,19 +48733,33 @@ const sirvOptions = ({ getHeaders, shouldServe, }) => {
|
|
48661
48733
|
}
|
48662
48734
|
}
|
48663
48735
|
},
|
48664
|
-
shouldServe,
|
48665
48736
|
};
|
48666
48737
|
};
|
48667
|
-
function servePublicMiddleware(server) {
|
48738
|
+
function servePublicMiddleware(server, publicFiles) {
|
48668
48739
|
const dir = server.config.publicDir;
|
48669
48740
|
const serve = sirv(dir, sirvOptions({
|
48670
48741
|
getHeaders: () => server.config.server.headers,
|
48671
|
-
shouldServe: (filePath) => shouldServeFile(filePath, dir),
|
48672
48742
|
}));
|
48743
|
+
const toFilePath = (url) => {
|
48744
|
+
let filePath = cleanUrl(url);
|
48745
|
+
if (filePath.indexOf('%') !== -1) {
|
48746
|
+
try {
|
48747
|
+
filePath = decodeURI(filePath);
|
48748
|
+
}
|
48749
|
+
catch (err) {
|
48750
|
+
/* malform uri */
|
48751
|
+
}
|
48752
|
+
}
|
48753
|
+
return normalizePath$3(filePath);
|
48754
|
+
};
|
48673
48755
|
// Keep the named function. The name is visible in debug logs via `DEBUG=connect:dispatcher ...`
|
48674
48756
|
return function viteServePublicMiddleware(req, res, next) {
|
48675
|
-
//
|
48676
|
-
|
48757
|
+
// To avoid the performance impact of `existsSync` on every request, we check against an
|
48758
|
+
// in-memory set of known public files. This set is updated on restarts.
|
48759
|
+
// also skip import request and internal requests `/@fs/ /@vite-client` etc...
|
48760
|
+
if ((publicFiles && !publicFiles.has(toFilePath(req.url))) ||
|
48761
|
+
isImportRequest(req.url) ||
|
48762
|
+
isInternalRequest(req.url)) {
|
48677
48763
|
return next();
|
48678
48764
|
}
|
48679
48765
|
serve(req, res, next);
|
@@ -59546,6 +59632,7 @@ function createServer(inlineConfig = {}) {
|
|
59546
59632
|
}
|
59547
59633
|
async function _createServer(inlineConfig = {}, options) {
|
59548
59634
|
const config = await resolveConfig(inlineConfig, 'serve');
|
59635
|
+
const initPublicFilesPromise = initPublicFiles(config);
|
59549
59636
|
const { root, server: serverConfig } = config;
|
59550
59637
|
const httpsOptions = await resolveHttpsConfig(config.server.https);
|
59551
59638
|
const { middlewareMode } = serverConfig;
|
@@ -59744,6 +59831,7 @@ async function _createServer(inlineConfig = {}, options) {
|
|
59744
59831
|
process.stdin.on('end', exitProcess);
|
59745
59832
|
}
|
59746
59833
|
}
|
59834
|
+
const publicFiles = await initPublicFilesPromise;
|
59747
59835
|
const onHMRUpdate = async (file, configOnly) => {
|
59748
59836
|
if (serverConfig.hmr !== false) {
|
59749
59837
|
try {
|
@@ -59760,6 +59848,9 @@ async function _createServer(inlineConfig = {}, options) {
|
|
59760
59848
|
const onFileAddUnlink = async (file, isUnlink) => {
|
59761
59849
|
file = normalizePath$3(file);
|
59762
59850
|
await container.watchChange(file, { event: isUnlink ? 'delete' : 'create' });
|
59851
|
+
if (publicFiles && config.publicDir && file.startsWith(config.publicDir)) {
|
59852
|
+
publicFiles[isUnlink ? 'delete' : 'add'](file.slice(config.publicDir.length));
|
59853
|
+
}
|
59763
59854
|
await handleFileAddUnlink(file, server, isUnlink);
|
59764
59855
|
await onHMRUpdate(file, true);
|
59765
59856
|
};
|
@@ -59831,7 +59922,7 @@ async function _createServer(inlineConfig = {}, options) {
|
|
59831
59922
|
// this applies before the transform middleware so that these files are served
|
59832
59923
|
// as-is without transforms.
|
59833
59924
|
if (config.publicDir) {
|
59834
|
-
middlewares.use(servePublicMiddleware(server));
|
59925
|
+
middlewares.use(servePublicMiddleware(server, publicFiles));
|
59835
59926
|
}
|
59836
59927
|
// main transform middleware
|
59837
59928
|
middlewares.use(transformMiddleware(server));
|
@@ -62061,9 +62152,7 @@ function workerImportMetaUrlPlugin(config) {
|
|
62061
62152
|
const query = parseRequest(id);
|
62062
62153
|
let s;
|
62063
62154
|
const cleanString = stripLiteral(code);
|
62064
|
-
const workerImportMetaUrlRE =
|
62065
|
-
// eslint-disable-next-line regexp/no-unused-capturing-group -- https://github.com/ota-meshi/eslint-plugin-regexp/issues/675
|
62066
|
-
/\bnew\s+(?:Worker|SharedWorker)\s*\(\s*(new\s+URL\s*\(\s*('[^']+'|"[^"]+"|`[^`]+`)\s*,\s*import\.meta\.url\s*\))/dg;
|
62155
|
+
const workerImportMetaUrlRE = /\bnew\s+(?:Worker|SharedWorker)\s*\(\s*(new\s+URL\s*\(\s*('[^']+'|"[^"]+"|`[^`]+`)\s*,\s*import\.meta\.url\s*\))/dg;
|
62067
62156
|
let match;
|
62068
62157
|
while ((match = workerImportMetaUrlRE.exec(cleanString))) {
|
62069
62158
|
const [[, endIndex], [expStart, expEnd], [urlStart, urlEnd]] = match.indices;
|
@@ -62146,9 +62235,7 @@ function assetImportMetaUrlPlugin(config) {
|
|
62146
62235
|
code.includes('new URL') &&
|
62147
62236
|
code.includes(`import.meta.url`)) {
|
62148
62237
|
let s;
|
62149
|
-
const assetImportMetaUrlRE =
|
62150
|
-
// eslint-disable-next-line regexp/no-unused-capturing-group -- https://github.com/ota-meshi/eslint-plugin-regexp/issues/675
|
62151
|
-
/\bnew\s+URL\s*\(\s*('[^']+'|"[^"]+"|`[^`]+`)\s*,\s*import\.meta\.url\s*(?:,\s*)?\)/dg;
|
62238
|
+
const assetImportMetaUrlRE = /\bnew\s+URL\s*\(\s*('[^']+'|"[^"]+"|`[^`]+`)\s*,\s*import\.meta\.url\s*(?:,\s*)?\)/dg;
|
62152
62239
|
const cleanString = stripLiteral(code);
|
62153
62240
|
let match;
|
62154
62241
|
while ((match = assetImportMetaUrlRE.exec(cleanString))) {
|
@@ -64161,7 +64248,7 @@ async function createDepsOptimizer(config, server) {
|
|
64161
64248
|
// Ensure that a rerun will not be issued for current discovered deps
|
64162
64249
|
if (debounceProcessingHandle)
|
64163
64250
|
clearTimeout(debounceProcessingHandle);
|
64164
|
-
if (closed
|
64251
|
+
if (closed) {
|
64165
64252
|
currentlyProcessing = false;
|
64166
64253
|
return;
|
64167
64254
|
}
|
@@ -64362,9 +64449,6 @@ async function createDepsOptimizer(config, server) {
|
|
64362
64449
|
});
|
64363
64450
|
}
|
64364
64451
|
function debouncedProcessing(timeout = debounceMs) {
|
64365
|
-
if (!newDepsDiscovered) {
|
64366
|
-
return;
|
64367
|
-
}
|
64368
64452
|
// Debounced rerun, let other missing dependencies be discovered before
|
64369
64453
|
// the running next optimizeDeps
|
64370
64454
|
enqueuedRerun = undefined;
|
@@ -64406,8 +64490,10 @@ async function createDepsOptimizer(config, server) {
|
|
64406
64490
|
const scanDeps = Object.keys(result.metadata.optimized);
|
64407
64491
|
if (scanDeps.length === 0 && crawlDeps.length === 0) {
|
64408
64492
|
debug$2?.(colors$1.green(`✨ no dependencies found by the scanner or crawling static imports`));
|
64409
|
-
result
|
64410
|
-
|
64493
|
+
// We still commit the result so the scanner isn't run on the next cold start
|
64494
|
+
// for projects without dependencies
|
64495
|
+
startNextDiscoveredBatch();
|
64496
|
+
runOptimizer(result);
|
64411
64497
|
return;
|
64412
64498
|
}
|
64413
64499
|
const needsInteropMismatch = findInteropMismatches(metadata.discovered, result.metadata.optimized);
|
@@ -64441,10 +64527,8 @@ async function createDepsOptimizer(config, server) {
|
|
64441
64527
|
debug$2?.(colors$1.green(`✨ no dependencies found while crawling the static imports`));
|
64442
64528
|
firstRunCalled = true;
|
64443
64529
|
}
|
64444
|
-
|
64445
|
-
|
64446
|
-
debouncedProcessing(0);
|
64447
|
-
}
|
64530
|
+
// queue the first optimizer run, even without deps so the result is cached
|
64531
|
+
debouncedProcessing(0);
|
64448
64532
|
}
|
64449
64533
|
}
|
64450
64534
|
// Called during buildStart at build time, when build --watch is used.
|
@@ -67288,7 +67372,9 @@ async function resolveConfig(inlineConfig, command, defaultMode = 'development',
|
|
67288
67372
|
},
|
67289
67373
|
});
|
67290
67374
|
// validate config
|
67291
|
-
if (config.build?.terserOptions &&
|
67375
|
+
if (config.build?.terserOptions &&
|
67376
|
+
config.build.minify &&
|
67377
|
+
config.build.minify !== 'terser') {
|
67292
67378
|
logger.warn(colors$1.yellow(`build.terserOptions is specified but build.minify is not set to use Terser. ` +
|
67293
67379
|
`Note Vite now defaults to use esbuild for minification. If you still ` +
|
67294
67380
|
`prefer Terser, set build.minify to "terser".`));
|
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-wTaJK0Jt.js';
|
6
6
|
import { VERSION } from './constants.js';
|
7
7
|
import 'node:fs/promises';
|
8
8
|
import 'node:url';
|
@@ -27,11 +27,11 @@ import 'node:child_process';
|
|
27
27
|
import 'node:crypto';
|
28
28
|
import 'node:dns';
|
29
29
|
import 'crypto';
|
30
|
-
import 'node:buffer';
|
31
30
|
import 'module';
|
32
31
|
import 'node:assert';
|
33
32
|
import 'node:process';
|
34
33
|
import 'node:v8';
|
34
|
+
import 'node:buffer';
|
35
35
|
import 'rollup';
|
36
36
|
import 'rollup/parseAst';
|
37
37
|
import 'querystring';
|
@@ -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-wTaJK0Jt.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-wTaJK0Jt.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-wTaJK0Jt.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-wTaJK0Jt.js').then(function (n) { return n.D; });
|
897
897
|
try {
|
898
898
|
const server = await preview({
|
899
899
|
root,
|
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-wTaJK0Jt.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-wTaJK0Jt.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';
|
@@ -30,11 +30,11 @@ import 'node:child_process';
|
|
30
30
|
import 'node:crypto';
|
31
31
|
import 'node:dns';
|
32
32
|
import 'crypto';
|
33
|
-
import 'node:buffer';
|
34
33
|
import 'module';
|
35
34
|
import 'node:assert';
|
36
35
|
import 'node:process';
|
37
36
|
import 'node:v8';
|
37
|
+
import 'node:buffer';
|
38
38
|
import 'querystring';
|
39
39
|
import 'node:readline';
|
40
40
|
import 'node:events';
|