vite 4.4.9 → 4.4.11
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.
Potentially problematic release.
This version of vite might be problematic. Click here for more details.
- package/client.d.ts +1 -1
- package/dist/node/chunks/{dep-73522cdf.js → dep-24337c19.js} +1 -1
- package/dist/node/chunks/{dep-df561101.js → dep-2b82a1ce.js} +137 -63
- package/dist/node/chunks/{dep-e0331088.js → dep-4950a6a7.js} +1 -1
- package/dist/node/cli.js +28 -8
- package/dist/node/index.js +2 -2
- package/dist/node-cjs/publicUtils.cjs +35 -7
- package/package.json +4 -1
package/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { F as commonjsGlobal, E as getDefaultExportFromCjs } from './dep-
|
|
1
|
+
import { F as commonjsGlobal, E as getDefaultExportFromCjs } from './dep-2b82a1ce.js';
|
|
2
2
|
import require$$0__default from 'fs';
|
|
3
3
|
import require$$0 from 'postcss';
|
|
4
4
|
import require$$0$1 from 'path';
|
|
@@ -11834,6 +11834,12 @@ const flattenId = (id) => id
|
|
|
11834
11834
|
.replace(replaceNestedIdRE, '___')
|
|
11835
11835
|
.replace(replaceHashRE, '____');
|
|
11836
11836
|
const normalizeId = (id) => id.replace(replaceNestedIdRE, ' > ');
|
|
11837
|
+
// Supported by Node, Deno, Bun
|
|
11838
|
+
const NODE_BUILTIN_NAMESPACE = 'node:';
|
|
11839
|
+
// Supported by Deno
|
|
11840
|
+
const NPM_BUILTIN_NAMESPACE = 'npm:';
|
|
11841
|
+
// Supported by Bun
|
|
11842
|
+
const BUN_BUILTIN_NAMESPACE = 'bun:';
|
|
11837
11843
|
//TODO: revisit later to see if the edge case that "compiling using node v12 code to be run in node v16 in the server" is what we intend to support.
|
|
11838
11844
|
const builtins = new Set([
|
|
11839
11845
|
...builtinModules,
|
|
@@ -11851,17 +11857,26 @@ const builtins = new Set([
|
|
|
11851
11857
|
'util/types',
|
|
11852
11858
|
'wasi',
|
|
11853
11859
|
]);
|
|
11854
|
-
|
|
11860
|
+
// Some runtimes like Bun injects namespaced modules here, which is not a node builtin
|
|
11861
|
+
const nodeBuiltins = [...builtins].filter((id) => !id.includes(':'));
|
|
11862
|
+
// TODO: Use `isBuiltin` from `node:module`, but Deno doesn't support it
|
|
11855
11863
|
function isBuiltin(id) {
|
|
11856
|
-
|
|
11857
|
-
|
|
11858
|
-
|
|
11864
|
+
if (process.versions.deno && id.startsWith(NPM_BUILTIN_NAMESPACE))
|
|
11865
|
+
return true;
|
|
11866
|
+
if (process.versions.bun && id.startsWith(BUN_BUILTIN_NAMESPACE))
|
|
11867
|
+
return true;
|
|
11868
|
+
return isNodeBuiltin(id);
|
|
11869
|
+
}
|
|
11870
|
+
function isNodeBuiltin(id) {
|
|
11871
|
+
if (id.startsWith(NODE_BUILTIN_NAMESPACE))
|
|
11872
|
+
return true;
|
|
11873
|
+
return nodeBuiltins.includes(id);
|
|
11859
11874
|
}
|
|
11860
11875
|
function isInNodeModules(id) {
|
|
11861
11876
|
return id.includes('node_modules');
|
|
11862
11877
|
}
|
|
11863
11878
|
function moduleListContains(moduleList, id) {
|
|
11864
|
-
return moduleList?.some((m) => m === id || id.startsWith(m
|
|
11879
|
+
return moduleList?.some((m) => m === id || id.startsWith(withTrailingSlash(m)));
|
|
11865
11880
|
}
|
|
11866
11881
|
function isOptimizable(id, optimizeDeps) {
|
|
11867
11882
|
const { extensions } = optimizeDeps;
|
|
@@ -11923,6 +11938,12 @@ function fsPathFromId(id) {
|
|
|
11923
11938
|
function fsPathFromUrl(url) {
|
|
11924
11939
|
return fsPathFromId(cleanUrl(url));
|
|
11925
11940
|
}
|
|
11941
|
+
function withTrailingSlash(path) {
|
|
11942
|
+
if (path[path.length - 1] !== '/') {
|
|
11943
|
+
return `${path}/`;
|
|
11944
|
+
}
|
|
11945
|
+
return path;
|
|
11946
|
+
}
|
|
11926
11947
|
/**
|
|
11927
11948
|
* Check if dir is a parent of file
|
|
11928
11949
|
*
|
|
@@ -11933,9 +11954,7 @@ function fsPathFromUrl(url) {
|
|
|
11933
11954
|
* @returns true if dir is a parent of file
|
|
11934
11955
|
*/
|
|
11935
11956
|
function isParentDirectory(dir, file) {
|
|
11936
|
-
|
|
11937
|
-
dir = `${dir}/`;
|
|
11938
|
-
}
|
|
11957
|
+
dir = withTrailingSlash(dir);
|
|
11939
11958
|
return (file.startsWith(dir) ||
|
|
11940
11959
|
(isCaseInsensitiveFS && file.toLowerCase().startsWith(dir.toLowerCase())));
|
|
11941
11960
|
}
|
|
@@ -12287,7 +12306,7 @@ function optimizeSafeRealPathSync() {
|
|
|
12287
12306
|
function ensureWatchedFile(watcher, file, root) {
|
|
12288
12307
|
if (file &&
|
|
12289
12308
|
// only need to watch if out of root
|
|
12290
|
-
!file.startsWith(root
|
|
12309
|
+
!file.startsWith(withTrailingSlash(root)) &&
|
|
12291
12310
|
// some rollup plugins use null bytes for private resolved Ids
|
|
12292
12311
|
!file.includes('\0') &&
|
|
12293
12312
|
fs$l.existsSync(file)) {
|
|
@@ -12727,7 +12746,7 @@ function stripBase(path, base) {
|
|
|
12727
12746
|
if (path === base) {
|
|
12728
12747
|
return '/';
|
|
12729
12748
|
}
|
|
12730
|
-
const devBase = base
|
|
12749
|
+
const devBase = withTrailingSlash(base);
|
|
12731
12750
|
return path.startsWith(devBase) ? path.slice(devBase.length - 1) : path;
|
|
12732
12751
|
}
|
|
12733
12752
|
function arrayEqual(a, b) {
|
|
@@ -13084,9 +13103,10 @@ function buildReporterPlugin(config) {
|
|
|
13084
13103
|
if (isLarge)
|
|
13085
13104
|
hasLargeChunks = true;
|
|
13086
13105
|
const sizeColor = isLarge ? colors$1.yellow : colors$1.dim;
|
|
13087
|
-
let log = colors$1.dim(relativeOutDir
|
|
13106
|
+
let log = colors$1.dim(withTrailingSlash(relativeOutDir));
|
|
13088
13107
|
log +=
|
|
13089
|
-
!config.build.lib &&
|
|
13108
|
+
!config.build.lib &&
|
|
13109
|
+
entry.name.startsWith(withTrailingSlash(assetsDir))
|
|
13090
13110
|
? colors$1.dim(assetsDir) +
|
|
13091
13111
|
group.color(entry.name
|
|
13092
13112
|
.slice(assetsDir.length)
|
|
@@ -13756,8 +13776,13 @@ function hasWorkspacePackageJSON(root) {
|
|
|
13756
13776
|
if (!isFileReadable(path)) {
|
|
13757
13777
|
return false;
|
|
13758
13778
|
}
|
|
13759
|
-
|
|
13760
|
-
|
|
13779
|
+
try {
|
|
13780
|
+
const content = JSON.parse(fs$l.readFileSync(path, 'utf-8')) || {};
|
|
13781
|
+
return !!content.workspaces;
|
|
13782
|
+
}
|
|
13783
|
+
catch {
|
|
13784
|
+
return false;
|
|
13785
|
+
}
|
|
13761
13786
|
}
|
|
13762
13787
|
function hasRootFile(root) {
|
|
13763
13788
|
return ROOT_FILES.some((file) => fs$l.existsSync(join$2(root, file)));
|
|
@@ -16176,7 +16201,7 @@ function checkPublicFile(url, { publicDir }) {
|
|
|
16176
16201
|
return;
|
|
16177
16202
|
}
|
|
16178
16203
|
const publicFile = path$o.join(publicDir, cleanUrl(url));
|
|
16179
|
-
if (!publicFile.startsWith(publicDir)) {
|
|
16204
|
+
if (!normalizePath$3(publicFile).startsWith(withTrailingSlash(normalizePath$3(publicDir)))) {
|
|
16180
16205
|
// can happen if URL starts with '../'
|
|
16181
16206
|
return;
|
|
16182
16207
|
}
|
|
@@ -16201,7 +16226,7 @@ function fileToDevUrl(id, config) {
|
|
|
16201
16226
|
// in public dir, keep the url as-is
|
|
16202
16227
|
rtn = id;
|
|
16203
16228
|
}
|
|
16204
|
-
else if (id.startsWith(config.root)) {
|
|
16229
|
+
else if (id.startsWith(withTrailingSlash(config.root))) {
|
|
16205
16230
|
// in project root, infer short public path
|
|
16206
16231
|
rtn = '/' + path$o.posix.relative(config.root, id);
|
|
16207
16232
|
}
|
|
@@ -28086,7 +28111,9 @@ function resolvePlugin(resolveOptions) {
|
|
|
28086
28111
|
}
|
|
28087
28112
|
// URL
|
|
28088
28113
|
// /foo -> /fs-root/foo
|
|
28089
|
-
if (asSrc &&
|
|
28114
|
+
if (asSrc &&
|
|
28115
|
+
id[0] === '/' &&
|
|
28116
|
+
(rootInRoot || !id.startsWith(withTrailingSlash(root)))) {
|
|
28090
28117
|
const fsPath = path$o.resolve(root, id.slice(1));
|
|
28091
28118
|
if ((res = tryFsResolve(fsPath, options))) {
|
|
28092
28119
|
debug$d?.(`[url] ${colors$1.cyan(id)} -> ${colors$1.dim(res)}`);
|
|
@@ -28402,8 +28429,10 @@ function tryNodeResolve(id, importer, options, targetWeb, depsOptimizer, ssr = f
|
|
|
28402
28429
|
bareImportRE.test(id)) {
|
|
28403
28430
|
const mainPkg = findNearestMainPackageData(basedir, packageCache)?.data;
|
|
28404
28431
|
if (mainPkg) {
|
|
28405
|
-
|
|
28406
|
-
|
|
28432
|
+
const pkgName = getNpmPackageName(id);
|
|
28433
|
+
if (pkgName != null &&
|
|
28434
|
+
mainPkg.peerDependencies?.[pkgName] &&
|
|
28435
|
+
mainPkg.peerDependenciesMeta?.[pkgName]?.optional) {
|
|
28407
28436
|
return {
|
|
28408
28437
|
id: `${optionalPeerDepId}:${id}:${mainPkg.name}`,
|
|
28409
28438
|
};
|
|
@@ -28580,7 +28609,7 @@ async function tryOptimizedResolve(depsOptimizer, id, importer, preserveSymlinks
|
|
|
28580
28609
|
idPkgDir = normalizePath$3(idPkgDir);
|
|
28581
28610
|
}
|
|
28582
28611
|
// match by src to correctly identify if id belongs to nested dependency
|
|
28583
|
-
if (optimizedData.src.startsWith(idPkgDir)) {
|
|
28612
|
+
if (optimizedData.src.startsWith(withTrailingSlash(idPkgDir))) {
|
|
28584
28613
|
return depsOptimizer.getOptimizedDepId(optimizedData);
|
|
28585
28614
|
}
|
|
28586
28615
|
}
|
|
@@ -36691,7 +36720,7 @@ function _stripLiteralAcorn(code, options) {
|
|
|
36691
36720
|
|
|
36692
36721
|
const multilineCommentsRE = /\/\*([^*\/])*?\*\//gms;
|
|
36693
36722
|
const singlelineCommentsRE = /(?:^|\n|\r)\s*\/\/.*(?:\r|\n|$)/gm;
|
|
36694
|
-
const templateLiteralRE = /\$\{(\s*(?:|{.*}|(?!\$\{).|\n|\r)*?\s*)\}/g;
|
|
36723
|
+
const templateLiteralRE$1 = /\$\{(\s*(?:|{.*}|(?!\$\{).|\n|\r)*?\s*)\}/g;
|
|
36695
36724
|
const quotesRE = [
|
|
36696
36725
|
/(["'`])((?:\\\1|(?!\1)|.|\r)*?)\1/gm,
|
|
36697
36726
|
/([`])((?:\\\1|(?!\1)|.|\n|\r)*?)\1/gm
|
|
@@ -36705,7 +36734,7 @@ function stripLiteralRegex(code, options) {
|
|
|
36705
36734
|
let expanded = code;
|
|
36706
36735
|
for (let i = 0; i < 16; i++) {
|
|
36707
36736
|
const before = expanded;
|
|
36708
|
-
expanded = expanded.replace(templateLiteralRE, "` $1`");
|
|
36737
|
+
expanded = expanded.replace(templateLiteralRE$1, "` $1`");
|
|
36709
36738
|
if (expanded === before)
|
|
36710
36739
|
break;
|
|
36711
36740
|
}
|
|
@@ -38345,7 +38374,7 @@ function cssPostPlugin(config) {
|
|
|
38345
38374
|
};
|
|
38346
38375
|
return {
|
|
38347
38376
|
name: 'vite:css-post',
|
|
38348
|
-
|
|
38377
|
+
renderStart() {
|
|
38349
38378
|
// Ensure new caches for every build (i.e. rebuilding in watch mode)
|
|
38350
38379
|
pureCssChunks = new Set();
|
|
38351
38380
|
outputToExtractedCSSMap = new Map();
|
|
@@ -38633,9 +38662,9 @@ function cssPostPlugin(config) {
|
|
|
38633
38662
|
// chunks instead.
|
|
38634
38663
|
chunk.imports = chunk.imports.filter((file) => {
|
|
38635
38664
|
if (pureCssChunkNames.includes(file)) {
|
|
38636
|
-
const { importedCss } = bundle[file]
|
|
38637
|
-
.viteMetadata;
|
|
38665
|
+
const { importedCss, importedAssets } = bundle[file].viteMetadata;
|
|
38638
38666
|
importedCss.forEach((file) => chunk.viteMetadata.importedCss.add(file));
|
|
38667
|
+
importedAssets.forEach((file) => chunk.viteMetadata.importedAssets.add(file));
|
|
38639
38668
|
return false;
|
|
38640
38669
|
}
|
|
38641
38670
|
return true;
|
|
@@ -38649,6 +38678,7 @@ function cssPostPlugin(config) {
|
|
|
38649
38678
|
pureCssChunkNames.forEach((fileName) => {
|
|
38650
38679
|
removedPureCssFiles.set(fileName, bundle[fileName]);
|
|
38651
38680
|
delete bundle[fileName];
|
|
38681
|
+
delete bundle[`${fileName}.map`];
|
|
38652
38682
|
});
|
|
38653
38683
|
}
|
|
38654
38684
|
let extractedCss = outputToExtractedCSSMap.get(opts);
|
|
@@ -38959,8 +38989,8 @@ function createCachedImport(imp) {
|
|
|
38959
38989
|
return cached;
|
|
38960
38990
|
};
|
|
38961
38991
|
}
|
|
38962
|
-
const importPostcssImport = createCachedImport(() => import('./dep-
|
|
38963
|
-
const importPostcssModules = createCachedImport(() => import('./dep-
|
|
38992
|
+
const importPostcssImport = createCachedImport(() => import('./dep-4950a6a7.js').then(function (n) { return n.i; }));
|
|
38993
|
+
const importPostcssModules = createCachedImport(() => import('./dep-24337c19.js').then(function (n) { return n.i; }));
|
|
38964
38994
|
const importPostcss = createCachedImport(() => import('postcss'));
|
|
38965
38995
|
/**
|
|
38966
38996
|
* @experimental
|
|
@@ -40274,7 +40304,8 @@ function cjsShouldExternalizeForSSR(id, externals) {
|
|
|
40274
40304
|
}
|
|
40275
40305
|
// deep imports, check ext before externalizing - only externalize
|
|
40276
40306
|
// extension-less imports and explicit .js imports
|
|
40277
|
-
if (id.startsWith(e
|
|
40307
|
+
if (id.startsWith(withTrailingSlash(e)) &&
|
|
40308
|
+
(!path$o.extname(id) || id.endsWith('.js'))) {
|
|
40278
40309
|
return true;
|
|
40279
40310
|
}
|
|
40280
40311
|
});
|
|
@@ -40784,8 +40815,11 @@ function getAffectedGlobModules(file, server) {
|
|
|
40784
40815
|
for (const [id, allGlobs] of server._importGlobMap) {
|
|
40785
40816
|
// (glob1 || glob2) && !glob3 && !glob4...
|
|
40786
40817
|
if (allGlobs.some(({ affirmed, negated }) => (!affirmed.length || affirmed.some((glob) => isMatch$1(file, glob))) &&
|
|
40787
|
-
(!negated.length || negated.every((glob) => isMatch$1(file, glob)))))
|
|
40788
|
-
|
|
40818
|
+
(!negated.length || negated.every((glob) => isMatch$1(file, glob))))) {
|
|
40819
|
+
const mod = server.moduleGraph.getModuleById(id);
|
|
40820
|
+
if (mod)
|
|
40821
|
+
modules.push(mod);
|
|
40822
|
+
}
|
|
40789
40823
|
}
|
|
40790
40824
|
modules.forEach((i) => {
|
|
40791
40825
|
if (i?.file)
|
|
@@ -41216,7 +41250,9 @@ const debugHmr = createDebugger('vite:hmr');
|
|
|
41216
41250
|
const whitespaceRE = /\s/;
|
|
41217
41251
|
const normalizedClientDir = normalizePath$3(CLIENT_DIR);
|
|
41218
41252
|
function getShortName(file, root) {
|
|
41219
|
-
return file.startsWith(
|
|
41253
|
+
return file.startsWith(withTrailingSlash(root))
|
|
41254
|
+
? path$o.posix.relative(root, file)
|
|
41255
|
+
: file;
|
|
41220
41256
|
}
|
|
41221
41257
|
async function handleHMRUpdate(file, server, configOnly) {
|
|
41222
41258
|
const { ws, config, moduleGraph } = server;
|
|
@@ -41243,7 +41279,7 @@ async function handleHMRUpdate(file, server, configOnly) {
|
|
|
41243
41279
|
}
|
|
41244
41280
|
debugHmr?.(`[file change] ${colors$1.dim(shortFile)}`);
|
|
41245
41281
|
// (dev only) the client itself cannot be hot updated.
|
|
41246
|
-
if (file.startsWith(normalizedClientDir)) {
|
|
41282
|
+
if (file.startsWith(withTrailingSlash(normalizedClientDir))) {
|
|
41247
41283
|
ws.send({
|
|
41248
41284
|
type: 'full-reload',
|
|
41249
41285
|
path: '*',
|
|
@@ -41607,6 +41643,7 @@ const hasImportInQueryParamsRE = /[?&]import=?\b/;
|
|
|
41607
41643
|
const hasViteIgnoreRE = /\/\*\s*@vite-ignore\s*\*\//;
|
|
41608
41644
|
const cleanUpRawUrlRE = /\/\*[\s\S]*?\*\/|([^\\:]|^)\/\/.*$/gm;
|
|
41609
41645
|
const urlIsStringRE = /^(?:'.*'|".*"|`.*`)$/;
|
|
41646
|
+
const templateLiteralRE = /^\s*`(.*)`\s*$/;
|
|
41610
41647
|
function isExplicitImportRequired(url) {
|
|
41611
41648
|
return !isJSRequest(cleanUrl(url)) && !isCSSRequest(url);
|
|
41612
41649
|
}
|
|
@@ -41764,7 +41801,6 @@ function importAnalysisPlugin(config) {
|
|
|
41764
41801
|
let needQueryInjectHelper = false;
|
|
41765
41802
|
let s;
|
|
41766
41803
|
const str = () => s || (s = new MagicString(source));
|
|
41767
|
-
const importedUrls = new Set();
|
|
41768
41804
|
let isPartiallySelfAccepting = false;
|
|
41769
41805
|
const importedBindings = enablePartialAccept
|
|
41770
41806
|
? new Map()
|
|
@@ -41804,7 +41840,7 @@ function importAnalysisPlugin(config) {
|
|
|
41804
41840
|
const isSelfImport = !isRelative && cleanUrl(url) === cleanUrl(importer);
|
|
41805
41841
|
// normalize all imports into resolved URLs
|
|
41806
41842
|
// e.g. `import 'foo'` -> `import '/@fs/.../node_modules/foo/index.js'`
|
|
41807
|
-
if (resolved.id.startsWith(root
|
|
41843
|
+
if (resolved.id.startsWith(withTrailingSlash(root))) {
|
|
41808
41844
|
// in root: infer short absolute path from root
|
|
41809
41845
|
url = resolved.id.slice(root.length);
|
|
41810
41846
|
}
|
|
@@ -41865,13 +41901,14 @@ function importAnalysisPlugin(config) {
|
|
|
41865
41901
|
}
|
|
41866
41902
|
return [url, resolved.id];
|
|
41867
41903
|
};
|
|
41904
|
+
const orderedImportedUrls = new Array(imports.length);
|
|
41868
41905
|
const orderedAcceptedUrls = new Array(imports.length);
|
|
41869
41906
|
const orderedAcceptedExports = new Array(imports.length);
|
|
41870
41907
|
await Promise.all(imports.map(async (importSpecifier, index) => {
|
|
41871
|
-
const { s: start, e: end, ss: expStart, se: expEnd, d: dynamicIndex,
|
|
41908
|
+
const { s: start, e: end, ss: expStart, se: expEnd, d: dynamicIndex, a: assertIndex, } = importSpecifier;
|
|
41872
41909
|
// #2083 User may use escape path,
|
|
41873
41910
|
// so use imports[index].n to get the unescaped string
|
|
41874
|
-
|
|
41911
|
+
let specifier = importSpecifier.n;
|
|
41875
41912
|
const rawUrl = source.slice(start, end);
|
|
41876
41913
|
// check import.meta usage
|
|
41877
41914
|
if (rawUrl === 'import.meta') {
|
|
@@ -41901,6 +41938,15 @@ function importAnalysisPlugin(config) {
|
|
|
41901
41938
|
}
|
|
41902
41939
|
return;
|
|
41903
41940
|
}
|
|
41941
|
+
else if (templateLiteralRE.test(rawUrl)) {
|
|
41942
|
+
// If the import has backticks but isn't transformed as a glob import
|
|
41943
|
+
// (as there's nothing to glob), check if it's simply a plain string.
|
|
41944
|
+
// If so, we can replace the specifier as a plain string to prevent
|
|
41945
|
+
// an incorrect "cannot be analyzed" warning.
|
|
41946
|
+
if (!(rawUrl.includes('${') && rawUrl.includes('}'))) {
|
|
41947
|
+
specifier = rawUrl.replace(templateLiteralRE, '$1');
|
|
41948
|
+
}
|
|
41949
|
+
}
|
|
41904
41950
|
const isDynamicImport = dynamicIndex > -1;
|
|
41905
41951
|
// strip import assertions as we can process them ourselves
|
|
41906
41952
|
if (!isDynamicImport && assertIndex > -1) {
|
|
@@ -42013,7 +42059,7 @@ function importAnalysisPlugin(config) {
|
|
|
42013
42059
|
const hmrUrl = unwrapId(stripBase(url, base));
|
|
42014
42060
|
const isLocalImport = !isExternalUrl(hmrUrl) && !isDataUrl(hmrUrl);
|
|
42015
42061
|
if (isLocalImport) {
|
|
42016
|
-
|
|
42062
|
+
orderedImportedUrls[index] = hmrUrl;
|
|
42017
42063
|
}
|
|
42018
42064
|
if (enablePartialAccept && importedBindings) {
|
|
42019
42065
|
extractImportedBindings(resolvedId, source, importSpecifier, importedBindings);
|
|
@@ -42036,7 +42082,7 @@ function importAnalysisPlugin(config) {
|
|
|
42036
42082
|
});
|
|
42037
42083
|
}
|
|
42038
42084
|
}
|
|
42039
|
-
else if (!importer.startsWith(clientDir)) {
|
|
42085
|
+
else if (!importer.startsWith(withTrailingSlash(clientDir))) {
|
|
42040
42086
|
if (!isInNodeModules(importer)) {
|
|
42041
42087
|
// check @vite-ignore which suppresses dynamic import warning
|
|
42042
42088
|
const hasViteIgnore = hasViteIgnoreRE.test(
|
|
@@ -42064,6 +42110,7 @@ function importAnalysisPlugin(config) {
|
|
|
42064
42110
|
}
|
|
42065
42111
|
}
|
|
42066
42112
|
}));
|
|
42113
|
+
const importedUrls = new Set(orderedImportedUrls.filter(Boolean));
|
|
42067
42114
|
const acceptedUrls = mergeAcceptedUrls(orderedAcceptedUrls);
|
|
42068
42115
|
const acceptedExports = mergeAcceptedUrls(orderedAcceptedExports);
|
|
42069
42116
|
if (hasEnv) {
|
|
@@ -42145,23 +42192,32 @@ function mergeAcceptedUrls(orderedUrls) {
|
|
|
42145
42192
|
function interopNamedImports(str, importSpecifier, rewrittenUrl, importIndex, importer, config) {
|
|
42146
42193
|
const source = str.original;
|
|
42147
42194
|
const { s: start, e: end, ss: expStart, se: expEnd, d: dynamicIndex, } = importSpecifier;
|
|
42195
|
+
const exp = source.slice(expStart, expEnd);
|
|
42148
42196
|
if (dynamicIndex > -1) {
|
|
42149
42197
|
// rewrite `import('package')` to expose the default directly
|
|
42150
|
-
str.overwrite(expStart, expEnd, `import('${rewrittenUrl}').then(m => m.default && m.default.__esModule ? m.default : ({ ...m.default, default: m.default }))
|
|
42198
|
+
str.overwrite(expStart, expEnd, `import('${rewrittenUrl}').then(m => m.default && m.default.__esModule ? m.default : ({ ...m.default, default: m.default }))` +
|
|
42199
|
+
getLineBreaks(exp), { contentOnly: true });
|
|
42151
42200
|
}
|
|
42152
42201
|
else {
|
|
42153
|
-
const exp = source.slice(expStart, expEnd);
|
|
42154
42202
|
const rawUrl = source.slice(start, end);
|
|
42155
42203
|
const rewritten = transformCjsImport(exp, rewrittenUrl, rawUrl, importIndex, importer, config);
|
|
42156
42204
|
if (rewritten) {
|
|
42157
|
-
str.overwrite(expStart, expEnd, rewritten, {
|
|
42205
|
+
str.overwrite(expStart, expEnd, rewritten + getLineBreaks(exp), {
|
|
42206
|
+
contentOnly: true,
|
|
42207
|
+
});
|
|
42158
42208
|
}
|
|
42159
42209
|
else {
|
|
42160
42210
|
// #1439 export * from '...'
|
|
42161
|
-
str.overwrite(start, end, rewrittenUrl
|
|
42211
|
+
str.overwrite(start, end, rewrittenUrl + getLineBreaks(source.slice(start, end)), {
|
|
42212
|
+
contentOnly: true,
|
|
42213
|
+
});
|
|
42162
42214
|
}
|
|
42163
42215
|
}
|
|
42164
42216
|
}
|
|
42217
|
+
// get line breaks to preserve line count for not breaking source maps
|
|
42218
|
+
function getLineBreaks(str) {
|
|
42219
|
+
return str.includes('\n') ? '\n'.repeat(str.split('\n').length - 1) : '';
|
|
42220
|
+
}
|
|
42165
42221
|
/**
|
|
42166
42222
|
* Detect import statements to a known optimized CJS dependency and provide
|
|
42167
42223
|
* ES named imports interop. We do this by rewriting named imports to a variable
|
|
@@ -42610,9 +42666,15 @@ function webWorkerPlugin(config) {
|
|
|
42610
42666
|
injectEnv = module?.transformResult?.code || '';
|
|
42611
42667
|
}
|
|
42612
42668
|
}
|
|
42613
|
-
|
|
42614
|
-
|
|
42615
|
-
|
|
42669
|
+
if (injectEnv) {
|
|
42670
|
+
const s = new MagicString(raw);
|
|
42671
|
+
s.prepend(injectEnv);
|
|
42672
|
+
return {
|
|
42673
|
+
code: s.toString(),
|
|
42674
|
+
map: s.generateMap({ hires: 'boundary' }),
|
|
42675
|
+
};
|
|
42676
|
+
}
|
|
42677
|
+
return;
|
|
42616
42678
|
}
|
|
42617
42679
|
if (query == null ||
|
|
42618
42680
|
(query && (query.worker ?? query.sharedworker) == null)) {
|
|
@@ -42805,7 +42867,7 @@ function matches(pattern, importee) {
|
|
|
42805
42867
|
if (importee === pattern) {
|
|
42806
42868
|
return true;
|
|
42807
42869
|
}
|
|
42808
|
-
return importee.startsWith(pattern
|
|
42870
|
+
return importee.startsWith(withTrailingSlash(pattern));
|
|
42809
42871
|
}
|
|
42810
42872
|
function getAliasPatterns(entries) {
|
|
42811
42873
|
if (!entries) {
|
|
@@ -45412,7 +45474,6 @@ async function createDepsOptimizer(config, server) {
|
|
|
45412
45474
|
if (closed) {
|
|
45413
45475
|
return;
|
|
45414
45476
|
}
|
|
45415
|
-
const crawlDeps = Object.keys(metadata.discovered);
|
|
45416
45477
|
// Await for the scan+optimize step running in the background
|
|
45417
45478
|
// It normally should be over by the time crawling of user code ended
|
|
45418
45479
|
await depsOptimizer.scanProcessing;
|
|
@@ -45420,6 +45481,7 @@ async function createDepsOptimizer(config, server) {
|
|
|
45420
45481
|
const result = await optimizationResult.result;
|
|
45421
45482
|
optimizationResult = undefined;
|
|
45422
45483
|
currentlyProcessing = false;
|
|
45484
|
+
const crawlDeps = Object.keys(metadata.discovered);
|
|
45423
45485
|
const scanDeps = Object.keys(result.metadata.optimized);
|
|
45424
45486
|
if (scanDeps.length === 0 && crawlDeps.length === 0) {
|
|
45425
45487
|
debug$8?.(colors$1.green(`✨ no dependencies found by the scanner or crawling static imports`));
|
|
@@ -45452,6 +45514,7 @@ async function createDepsOptimizer(config, server) {
|
|
|
45452
45514
|
}
|
|
45453
45515
|
}
|
|
45454
45516
|
else {
|
|
45517
|
+
const crawlDeps = Object.keys(metadata.discovered);
|
|
45455
45518
|
currentlyProcessing = false;
|
|
45456
45519
|
if (crawlDeps.length === 0) {
|
|
45457
45520
|
debug$8?.(colors$1.green(`✨ no dependencies found while crawling the static imports`));
|
|
@@ -46615,7 +46678,7 @@ function buildImportAnalysisPlugin(config) {
|
|
|
46615
46678
|
}
|
|
46616
46679
|
// normalize all imports into resolved URLs
|
|
46617
46680
|
// e.g. `import 'foo'` -> `import '/@fs/.../node_modules/foo/index.js'`
|
|
46618
|
-
if (resolved.id.startsWith(root
|
|
46681
|
+
if (resolved.id.startsWith(withTrailingSlash(root))) {
|
|
46619
46682
|
// in root: infer short absolute path from root
|
|
46620
46683
|
url = resolved.id.slice(root.length);
|
|
46621
46684
|
}
|
|
@@ -47614,7 +47677,7 @@ function serveStaticMiddleware(dir, server) {
|
|
|
47614
47677
|
}
|
|
47615
47678
|
if (redirectedPathname) {
|
|
47616
47679
|
// dir is pre-normalized to posix style
|
|
47617
|
-
if (redirectedPathname.startsWith(dir)) {
|
|
47680
|
+
if (redirectedPathname.startsWith(withTrailingSlash(dir))) {
|
|
47618
47681
|
redirectedPathname = redirectedPathname.slice(dir.length);
|
|
47619
47682
|
}
|
|
47620
47683
|
}
|
|
@@ -47622,7 +47685,7 @@ function serveStaticMiddleware(dir, server) {
|
|
|
47622
47685
|
let fileUrl = path$o.resolve(dir, removeLeadingSlash(resolvedPathname));
|
|
47623
47686
|
if (resolvedPathname[resolvedPathname.length - 1] === '/' &&
|
|
47624
47687
|
fileUrl[fileUrl.length - 1] !== '/') {
|
|
47625
|
-
fileUrl = fileUrl
|
|
47688
|
+
fileUrl = withTrailingSlash(fileUrl);
|
|
47626
47689
|
}
|
|
47627
47690
|
if (!ensureServingAccess(fileUrl, server, res, next)) {
|
|
47628
47691
|
return;
|
|
@@ -48027,7 +48090,7 @@ function prepareOutDir(outDirs, emptyOutDir, config) {
|
|
|
48027
48090
|
if (emptyOutDir == null) {
|
|
48028
48091
|
for (const outDir of nonDuplicateDirs) {
|
|
48029
48092
|
if (fs$l.existsSync(outDir) &&
|
|
48030
|
-
!normalizePath$3(outDir).startsWith(config.root
|
|
48093
|
+
!normalizePath$3(outDir).startsWith(withTrailingSlash(config.root))) {
|
|
48031
48094
|
// warn if outDir is outside of root
|
|
48032
48095
|
config.logger.warn(colors$1.yellow(`\n${colors$1.bold(`(!)`)} outDir ${colors$1.white(colors$1.dim(outDir))} is not inside project root and will not be emptied.\n` +
|
|
48033
48096
|
`Use --emptyOutDir to override.\n`));
|
|
@@ -48391,7 +48454,9 @@ const toOutputFilePathInHtml = toOutputFilePathWithoutRuntime;
|
|
|
48391
48454
|
function areSeparateFolders(a, b) {
|
|
48392
48455
|
const na = normalizePath$3(a);
|
|
48393
48456
|
const nb = normalizePath$3(b);
|
|
48394
|
-
return na !== nb &&
|
|
48457
|
+
return (na !== nb &&
|
|
48458
|
+
!na.startsWith(withTrailingSlash(nb)) &&
|
|
48459
|
+
!nb.startsWith(withTrailingSlash(na)));
|
|
48395
48460
|
}
|
|
48396
48461
|
|
|
48397
48462
|
var build$1 = {
|
|
@@ -55995,7 +56060,7 @@ async function instantiateModule(url, server, context = { global }, urlStack = [
|
|
|
55995
56060
|
// In node@12+ we can use dynamic import to load CJS and ESM
|
|
55996
56061
|
async function nodeImport(id, importer, resolveOptions) {
|
|
55997
56062
|
let url;
|
|
55998
|
-
if (id.startsWith('
|
|
56063
|
+
if (id.startsWith('data:') || isBuiltin(id)) {
|
|
55999
56064
|
url = id;
|
|
56000
56065
|
}
|
|
56001
56066
|
else {
|
|
@@ -61692,6 +61757,7 @@ function createWebSocketServer(server, config, httpsOptions) {
|
|
|
61692
61757
|
// TODO: the main server port may not have been chosen yet as it may use the next available
|
|
61693
61758
|
const portsAreCompatible = !hmrPort || hmrPort === config.server.port;
|
|
61694
61759
|
const wsServer = hmrServer || (portsAreCompatible && server);
|
|
61760
|
+
let hmrServerWsListener;
|
|
61695
61761
|
const customListeners = new Map();
|
|
61696
61762
|
const clientsMap = new WeakMap();
|
|
61697
61763
|
const port = hmrPort || 24678;
|
|
@@ -61703,14 +61769,15 @@ function createWebSocketServer(server, config, httpsOptions) {
|
|
|
61703
61769
|
hmrBase = path$o.posix.join(hmrBase, hmrPath);
|
|
61704
61770
|
}
|
|
61705
61771
|
wss = new WebSocketServerRaw({ noServer: true });
|
|
61706
|
-
|
|
61772
|
+
hmrServerWsListener = (req, socket, head) => {
|
|
61707
61773
|
if (req.headers['sec-websocket-protocol'] === HMR_HEADER &&
|
|
61708
61774
|
req.url === hmrBase) {
|
|
61709
61775
|
wss.handleUpgrade(req, socket, head, (ws) => {
|
|
61710
61776
|
wss.emit('connection', ws, req);
|
|
61711
61777
|
});
|
|
61712
61778
|
}
|
|
61713
|
-
}
|
|
61779
|
+
};
|
|
61780
|
+
wsServer.on('upgrade', hmrServerWsListener);
|
|
61714
61781
|
}
|
|
61715
61782
|
else {
|
|
61716
61783
|
// http server request handler keeps the same with
|
|
@@ -61852,6 +61919,11 @@ function createWebSocketServer(server, config, httpsOptions) {
|
|
|
61852
61919
|
});
|
|
61853
61920
|
},
|
|
61854
61921
|
close() {
|
|
61922
|
+
// should remove listener if hmr.server is set
|
|
61923
|
+
// otherwise the old listener swallows all WebSocket connections
|
|
61924
|
+
if (hmrServerWsListener && wsServer) {
|
|
61925
|
+
wsServer.off('upgrade', hmrServerWsListener);
|
|
61926
|
+
}
|
|
61855
61927
|
return new Promise((resolve, reject) => {
|
|
61856
61928
|
wss.clients.forEach((client) => {
|
|
61857
61929
|
client.terminate();
|
|
@@ -61909,7 +61981,7 @@ function baseMiddleware({ config, }) {
|
|
|
61909
61981
|
}
|
|
61910
61982
|
else if (req.headers.accept?.includes('text/html')) {
|
|
61911
61983
|
// non-based page visit
|
|
61912
|
-
const redirectPath = url
|
|
61984
|
+
const redirectPath = withTrailingSlash(url) !== base ? joinUrlSegments(base, url) : base;
|
|
61913
61985
|
res.writeHead(404, {
|
|
61914
61986
|
'Content-Type': 'text/html',
|
|
61915
61987
|
});
|
|
@@ -64289,10 +64361,10 @@ function transformMiddleware(server) {
|
|
|
64289
64361
|
// check if public dir is inside root dir
|
|
64290
64362
|
const publicDir = normalizePath$3(server.config.publicDir);
|
|
64291
64363
|
const rootDir = normalizePath$3(server.config.root);
|
|
64292
|
-
if (publicDir.startsWith(rootDir)) {
|
|
64364
|
+
if (publicDir.startsWith(withTrailingSlash(rootDir))) {
|
|
64293
64365
|
const publicPath = `${publicDir.slice(rootDir.length)}/`;
|
|
64294
64366
|
// warn explicit public paths
|
|
64295
|
-
if (url.startsWith(publicPath)) {
|
|
64367
|
+
if (url.startsWith(withTrailingSlash(publicPath))) {
|
|
64296
64368
|
let warning;
|
|
64297
64369
|
if (isImportRequest(url)) {
|
|
64298
64370
|
const rawUrl = removeImportQuery(url);
|
|
@@ -65871,7 +65943,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = 'development',
|
|
|
65871
65943
|
configFileDependencies: configFileDependencies.map((name) => normalizePath$3(path$o.resolve(name))),
|
|
65872
65944
|
inlineConfig,
|
|
65873
65945
|
root: resolvedRoot,
|
|
65874
|
-
base: resolvedBase
|
|
65946
|
+
base: withTrailingSlash(resolvedBase),
|
|
65875
65947
|
rawBase: resolvedBase,
|
|
65876
65948
|
resolve: resolveOptions,
|
|
65877
65949
|
publicDir: resolvedPublicDir,
|
|
@@ -65994,7 +66066,7 @@ assetFileNames isn't equal for every build.rollupOptions.output. A single patter
|
|
|
65994
66066
|
if (config.legacy?.buildSsrCjsExternalHeuristics ||
|
|
65995
66067
|
config.ssr?.format === 'cjs') {
|
|
65996
66068
|
resolved.logger.warn(colors$1.yellow(`
|
|
65997
|
-
(!) Experimental legacy.buildSsrCjsExternalHeuristics and ssr.format: 'cjs' are going to be removed in Vite 5.
|
|
66069
|
+
(!) Experimental legacy.buildSsrCjsExternalHeuristics and ssr.format: 'cjs' are going to be removed in Vite 5.
|
|
65998
66070
|
Find more information and give feedback at https://github.com/vitejs/vite/discussions/13816.
|
|
65999
66071
|
`));
|
|
66000
66072
|
}
|
|
@@ -66158,11 +66230,13 @@ async function bundleConfigFile(fileName, isESM) {
|
|
|
66158
66230
|
build.onResolve({ filter: /^[^.].*/ }, async ({ path: id, importer, kind }) => {
|
|
66159
66231
|
if (kind === 'entry-point' ||
|
|
66160
66232
|
path$o.isAbsolute(id) ||
|
|
66161
|
-
|
|
66233
|
+
isNodeBuiltin(id)) {
|
|
66162
66234
|
return;
|
|
66163
66235
|
}
|
|
66164
|
-
//
|
|
66165
|
-
|
|
66236
|
+
// With the `isNodeBuiltin` check above, this check captures if the builtin is a
|
|
66237
|
+
// non-node built-in, which esbuild doesn't know how to handle. In that case, we
|
|
66238
|
+
// externalize it so the non-node runtime handles it instead.
|
|
66239
|
+
if (isBuiltin(id)) {
|
|
66166
66240
|
return { external: true };
|
|
66167
66241
|
}
|
|
66168
66242
|
const isImport = isESM || kind === 'dynamic-import';
|
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 { C as colors, D as bindShortcuts, x as createLogger, h as resolveConfig } from './chunks/dep-
|
|
5
|
+
import { C as colors, D as bindShortcuts, x as createLogger, h as resolveConfig } from './chunks/dep-2b82a1ce.js';
|
|
6
6
|
import { VERSION } from './constants.js';
|
|
7
7
|
import 'node:fs/promises';
|
|
8
8
|
import 'node:url';
|
|
@@ -714,9 +714,29 @@ function cleanOptions(options) {
|
|
|
714
714
|
}
|
|
715
715
|
return ret;
|
|
716
716
|
}
|
|
717
|
+
/**
|
|
718
|
+
* host may be a number (like 0), should convert to string
|
|
719
|
+
*/
|
|
720
|
+
const convertHost = (v) => {
|
|
721
|
+
if (typeof v === 'number') {
|
|
722
|
+
return String(v);
|
|
723
|
+
}
|
|
724
|
+
return v;
|
|
725
|
+
};
|
|
726
|
+
/**
|
|
727
|
+
* base may be a number (like 0), should convert to empty string
|
|
728
|
+
*/
|
|
729
|
+
const convertBase = (v) => {
|
|
730
|
+
if (v === 0) {
|
|
731
|
+
return '';
|
|
732
|
+
}
|
|
733
|
+
return v;
|
|
734
|
+
};
|
|
717
735
|
cli
|
|
718
736
|
.option('-c, --config <file>', `[string] use specified config file`)
|
|
719
|
-
.option('--base <path>', `[string] public base path (default: /)
|
|
737
|
+
.option('--base <path>', `[string] public base path (default: /)`, {
|
|
738
|
+
type: [convertBase],
|
|
739
|
+
})
|
|
720
740
|
.option('-l, --logLevel <level>', `[string] info | warn | error | silent`)
|
|
721
741
|
.option('--clearScreen', `[boolean] allow/disable clear screen when logging`)
|
|
722
742
|
.option('-d, --debug [feat]', `[string | boolean] show debug logs`)
|
|
@@ -727,7 +747,7 @@ cli
|
|
|
727
747
|
.command('[root]', 'start dev server') // default command
|
|
728
748
|
.alias('serve') // the command is called 'serve' in Vite's API
|
|
729
749
|
.alias('dev') // alias to align with the script name
|
|
730
|
-
.option('--host [host]', `[string] specify hostname
|
|
750
|
+
.option('--host [host]', `[string] specify hostname`, { type: [convertHost] })
|
|
731
751
|
.option('--port <port>', `[number] specify port`)
|
|
732
752
|
.option('--https', `[boolean] use TLS + HTTP/2`)
|
|
733
753
|
.option('--open [path]', `[boolean | string] open browser on startup`)
|
|
@@ -738,7 +758,7 @@ cli
|
|
|
738
758
|
filterDuplicateOptions(options);
|
|
739
759
|
// output structure is preserved even after bundling so require()
|
|
740
760
|
// is ok here
|
|
741
|
-
const { createServer } = await import('./chunks/dep-
|
|
761
|
+
const { createServer } = await import('./chunks/dep-2b82a1ce.js').then(function (n) { return n.I; });
|
|
742
762
|
try {
|
|
743
763
|
const server = await createServer({
|
|
744
764
|
root,
|
|
@@ -816,7 +836,7 @@ cli
|
|
|
816
836
|
.option('-w, --watch', `[boolean] rebuilds when modules have changed on disk`)
|
|
817
837
|
.action(async (root, options) => {
|
|
818
838
|
filterDuplicateOptions(options);
|
|
819
|
-
const { build } = await import('./chunks/dep-
|
|
839
|
+
const { build } = await import('./chunks/dep-2b82a1ce.js').then(function (n) { return n.H; });
|
|
820
840
|
const buildOptions = cleanOptions(options);
|
|
821
841
|
try {
|
|
822
842
|
await build({
|
|
@@ -844,7 +864,7 @@ cli
|
|
|
844
864
|
.option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
|
|
845
865
|
.action(async (root, options) => {
|
|
846
866
|
filterDuplicateOptions(options);
|
|
847
|
-
const { optimizeDeps } = await import('./chunks/dep-
|
|
867
|
+
const { optimizeDeps } = await import('./chunks/dep-2b82a1ce.js').then(function (n) { return n.G; });
|
|
848
868
|
try {
|
|
849
869
|
const config = await resolveConfig({
|
|
850
870
|
root,
|
|
@@ -863,7 +883,7 @@ cli
|
|
|
863
883
|
// preview
|
|
864
884
|
cli
|
|
865
885
|
.command('preview [root]', 'locally preview production build')
|
|
866
|
-
.option('--host [host]', `[string] specify hostname
|
|
886
|
+
.option('--host [host]', `[string] specify hostname`, { type: [convertHost] })
|
|
867
887
|
.option('--port <port>', `[number] specify port`)
|
|
868
888
|
.option('--strictPort', `[boolean] exit if specified port is already in use`)
|
|
869
889
|
.option('--https', `[boolean] use TLS + HTTP/2`)
|
|
@@ -871,7 +891,7 @@ cli
|
|
|
871
891
|
.option('--outDir <dir>', `[string] output directory (default: dist)`)
|
|
872
892
|
.action(async (root, options) => {
|
|
873
893
|
filterDuplicateOptions(options);
|
|
874
|
-
const { preview } = await import('./chunks/dep-
|
|
894
|
+
const { preview } = await import('./chunks/dep-2b82a1ce.js').then(function (n) { return n.J; });
|
|
875
895
|
try {
|
|
876
896
|
const server = await preview({
|
|
877
897
|
root,
|
package/dist/node/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as isInNodeModules } from './chunks/dep-
|
|
2
|
-
export { b as build, e as buildErrorMessage, v as createFilter, x as createLogger, c as createServer, g as defineConfig, f as formatPostcssSourceMap, k as getDepOptimizationConfig, m as isDepsOptimizerEnabled, z as isFileServingAllowed, l as loadConfigFromFile, A as loadEnv, u as mergeAlias, q as mergeConfig, n as normalizePath, o as optimizeDeps, a as preprocessCSS, p as preview, j as resolveBaseUrl, h as resolveConfig, B as resolveEnvPrefix, d as resolvePackageData, r as resolvePackageEntry, y as searchForWorkspaceRoot, w as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-
|
|
1
|
+
import { i as isInNodeModules } from './chunks/dep-2b82a1ce.js';
|
|
2
|
+
export { b as build, e as buildErrorMessage, v as createFilter, x as createLogger, c as createServer, g as defineConfig, f as formatPostcssSourceMap, k as getDepOptimizationConfig, m as isDepsOptimizerEnabled, z as isFileServingAllowed, l as loadConfigFromFile, A as loadEnv, u as mergeAlias, q as mergeConfig, n as normalizePath, o as optimizeDeps, a as preprocessCSS, p as preview, j as resolveBaseUrl, h as resolveConfig, B as resolveEnvPrefix, d as resolvePackageData, r as resolvePackageEntry, y as searchForWorkspaceRoot, w as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-2b82a1ce.js';
|
|
3
3
|
export { VERSION as version } from './constants.js';
|
|
4
4
|
export { version as esbuildVersion } from 'esbuild';
|
|
5
5
|
export { VERSION as rollupVersion } from 'rollup';
|
|
@@ -3281,8 +3281,8 @@ const createFilter$1 = function createFilter(include, exclude, options) {
|
|
|
3281
3281
|
};
|
|
3282
3282
|
|
|
3283
3283
|
const reservedWords = 'break case class catch const continue debugger default delete do else export extends finally for function if import in instanceof let new return super switch this throw try typeof var void while with yield enum await implements package protected static interface private public';
|
|
3284
|
-
const builtins = 'arguments Infinity NaN undefined null true false eval uneval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Symbol Error EvalError InternalError RangeError ReferenceError SyntaxError TypeError URIError Number Math Date String RegExp Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array Map Set WeakMap WeakSet SIMD ArrayBuffer DataView JSON Promise Generator GeneratorFunction Reflect Proxy Intl';
|
|
3285
|
-
const forbiddenIdentifiers = new Set(`${reservedWords} ${builtins}`.split(' '));
|
|
3284
|
+
const builtins$1 = 'arguments Infinity NaN undefined null true false eval uneval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Symbol Error EvalError InternalError RangeError ReferenceError SyntaxError TypeError URIError Number Math Date String RegExp Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array Map Set WeakMap WeakSet SIMD ArrayBuffer DataView JSON Promise Generator GeneratorFunction Reflect Proxy Intl';
|
|
3285
|
+
const forbiddenIdentifiers = new Set(`${reservedWords} ${builtins$1}`.split(' '));
|
|
3286
3286
|
forbiddenIdentifiers.add('');
|
|
3287
3287
|
|
|
3288
3288
|
if (process.versions.pnp) {
|
|
@@ -3297,6 +3297,25 @@ const windowsSlashRE = /\\/g;
|
|
|
3297
3297
|
function slash(p) {
|
|
3298
3298
|
return p.replace(windowsSlashRE, '/');
|
|
3299
3299
|
}
|
|
3300
|
+
//TODO: revisit later to see if the edge case that "compiling using node v12 code to be run in node v16 in the server" is what we intend to support.
|
|
3301
|
+
const builtins = new Set([
|
|
3302
|
+
...node_module.builtinModules,
|
|
3303
|
+
'assert/strict',
|
|
3304
|
+
'diagnostics_channel',
|
|
3305
|
+
'dns/promises',
|
|
3306
|
+
'fs/promises',
|
|
3307
|
+
'path/posix',
|
|
3308
|
+
'path/win32',
|
|
3309
|
+
'readline/promises',
|
|
3310
|
+
'stream/consumers',
|
|
3311
|
+
'stream/promises',
|
|
3312
|
+
'stream/web',
|
|
3313
|
+
'timers/promises',
|
|
3314
|
+
'util/types',
|
|
3315
|
+
'wasi',
|
|
3316
|
+
]);
|
|
3317
|
+
// Some runtimes like Bun injects namespaced modules here, which is not a node builtin
|
|
3318
|
+
[...builtins].filter((id) => !id.includes(':'));
|
|
3300
3319
|
function isInNodeModules(id) {
|
|
3301
3320
|
return id.includes('node_modules');
|
|
3302
3321
|
}
|
|
@@ -3344,6 +3363,12 @@ function fsPathFromId(id) {
|
|
|
3344
3363
|
function fsPathFromUrl(url) {
|
|
3345
3364
|
return fsPathFromId(cleanUrl(url));
|
|
3346
3365
|
}
|
|
3366
|
+
function withTrailingSlash(path) {
|
|
3367
|
+
if (path[path.length - 1] !== '/') {
|
|
3368
|
+
return `${path}/`;
|
|
3369
|
+
}
|
|
3370
|
+
return path;
|
|
3371
|
+
}
|
|
3347
3372
|
/**
|
|
3348
3373
|
* Check if dir is a parent of file
|
|
3349
3374
|
*
|
|
@@ -3354,9 +3379,7 @@ function fsPathFromUrl(url) {
|
|
|
3354
3379
|
* @returns true if dir is a parent of file
|
|
3355
3380
|
*/
|
|
3356
3381
|
function isParentDirectory(dir, file) {
|
|
3357
|
-
|
|
3358
|
-
dir = `${dir}/`;
|
|
3359
|
-
}
|
|
3382
|
+
dir = withTrailingSlash(dir);
|
|
3360
3383
|
return (file.startsWith(dir) ||
|
|
3361
3384
|
(isCaseInsensitiveFS && file.toLowerCase().startsWith(dir.toLowerCase())));
|
|
3362
3385
|
}
|
|
@@ -3928,8 +3951,13 @@ function hasWorkspacePackageJSON(root) {
|
|
|
3928
3951
|
if (!isFileReadable(path)) {
|
|
3929
3952
|
return false;
|
|
3930
3953
|
}
|
|
3931
|
-
|
|
3932
|
-
|
|
3954
|
+
try {
|
|
3955
|
+
const content = JSON.parse(fs$1.readFileSync(path, 'utf-8')) || {};
|
|
3956
|
+
return !!content.workspaces;
|
|
3957
|
+
}
|
|
3958
|
+
catch {
|
|
3959
|
+
return false;
|
|
3960
|
+
}
|
|
3933
3961
|
}
|
|
3934
3962
|
function hasRootFile(root) {
|
|
3935
3963
|
return ROOT_FILES.some((file) => fs$1.existsSync(path$3.join(root, file)));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite",
|
|
3
|
-
"version": "4.4.
|
|
3
|
+
"version": "4.4.11",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Evan You",
|
|
@@ -28,6 +28,9 @@
|
|
|
28
28
|
"types": "./client.d.ts"
|
|
29
29
|
},
|
|
30
30
|
"./dist/client/*": "./dist/client/*",
|
|
31
|
+
"./types/*": {
|
|
32
|
+
"types": "./types/*"
|
|
33
|
+
},
|
|
31
34
|
"./package.json": "./package.json"
|
|
32
35
|
},
|
|
33
36
|
"files": [
|