vite 4.3.0-beta.2 → 4.3.0-beta.3
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/dist/node/chunks/{dep-53dc1ef4.js → dep-0eeee069.js} +1 -43
- package/dist/node/chunks/{dep-281af434.js → dep-366ea021.js} +146 -133
- package/dist/node/chunks/{dep-3b7a7ba2.js → dep-afdc0526.js} +1 -1
- package/dist/node/cli.js +5 -6
- package/dist/node/index.js +2 -3
- package/dist/node-cjs/publicUtils.cjs +3 -3
- package/package.json +1 -2
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import require$$0 from 'path';
|
|
2
|
-
import resolve$2 from 'resolve';
|
|
3
2
|
import require$$0__default from 'fs';
|
|
4
3
|
import { l as lib } from './dep-c423598f.js';
|
|
5
4
|
|
|
@@ -58,47 +57,6 @@ var joinLayer$1 = function (parentLayer, childLayer) {
|
|
|
58
57
|
return parentLayer.concat(childLayer)
|
|
59
58
|
};
|
|
60
59
|
|
|
61
|
-
// external tooling
|
|
62
|
-
const resolve$1 = resolve$2;
|
|
63
|
-
|
|
64
|
-
const moduleDirectories = ["web_modules", "node_modules"];
|
|
65
|
-
|
|
66
|
-
function resolveModule(id, opts) {
|
|
67
|
-
return new Promise((res, rej) => {
|
|
68
|
-
resolve$1(id, opts, (err, path) => (err ? rej(err) : res(path)));
|
|
69
|
-
})
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
var resolveId$1 = function (id, base, options) {
|
|
73
|
-
const paths = options.path;
|
|
74
|
-
|
|
75
|
-
const resolveOpts = {
|
|
76
|
-
basedir: base,
|
|
77
|
-
moduleDirectory: moduleDirectories.concat(options.addModulesDirectories),
|
|
78
|
-
paths,
|
|
79
|
-
extensions: [".css"],
|
|
80
|
-
packageFilter: function processPackage(pkg) {
|
|
81
|
-
if (pkg.style) pkg.main = pkg.style;
|
|
82
|
-
else if (!pkg.main || !/\.css$/.test(pkg.main)) pkg.main = "index.css";
|
|
83
|
-
return pkg
|
|
84
|
-
},
|
|
85
|
-
preserveSymlinks: false,
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
return resolveModule(`./${id}`, resolveOpts)
|
|
89
|
-
.catch(() => resolveModule(id, resolveOpts))
|
|
90
|
-
.catch(() => {
|
|
91
|
-
if (paths.indexOf(base) === -1) paths.unshift(base);
|
|
92
|
-
|
|
93
|
-
throw new Error(
|
|
94
|
-
`Failed to find '${id}'
|
|
95
|
-
in [
|
|
96
|
-
${paths.join(",\n ")}
|
|
97
|
-
]`
|
|
98
|
-
)
|
|
99
|
-
})
|
|
100
|
-
};
|
|
101
|
-
|
|
102
60
|
var readCacheExports = {};
|
|
103
61
|
var readCache$1 = {
|
|
104
62
|
get exports(){ return readCacheExports; },
|
|
@@ -535,7 +493,7 @@ const path = require$$0;
|
|
|
535
493
|
// internal tooling
|
|
536
494
|
const joinMedia = joinMedia$1;
|
|
537
495
|
const joinLayer = joinLayer$1;
|
|
538
|
-
const resolveId =
|
|
496
|
+
const resolveId = undefined;
|
|
539
497
|
const loadContent = loadContent$1;
|
|
540
498
|
const processContent = processContent$1;
|
|
541
499
|
const parseStatements = parseStatements$1;
|
|
@@ -22,8 +22,7 @@ import os$3 from 'node:os';
|
|
|
22
22
|
import { exec } from 'node:child_process';
|
|
23
23
|
import { createHash as createHash$2 } from 'node:crypto';
|
|
24
24
|
import { promises } from 'node:dns';
|
|
25
|
-
import
|
|
26
|
-
import { CLIENT_ENTRY, OPTIMIZABLE_ENTRY_RE, wildcardHosts, loopbackHosts, VALID_ID_PREFIX, NULL_BYTE_PLACEHOLDER, FS_PREFIX, DEFAULT_EXTENSIONS as DEFAULT_EXTENSIONS$1, CLIENT_PUBLIC_PATH, ENV_PUBLIC_PATH, ENV_ENTRY, DEFAULT_MAIN_FIELDS, SPECIAL_QUERY_RE, DEP_VERSION_RE, CSS_LANGS_RE, KNOWN_ASSET_TYPES, CLIENT_DIR, JS_TYPES_RE, ESBUILD_MODULES_TARGET, VERSION as VERSION$1, VITE_PACKAGE_DIR, DEFAULT_DEV_PORT, DEFAULT_PREVIEW_PORT, DEFAULT_ASSETS_RE, DEFAULT_CONFIG_FILES } from '../constants.js';
|
|
25
|
+
import { CLIENT_ENTRY, OPTIMIZABLE_ENTRY_RE, wildcardHosts, loopbackHosts, VALID_ID_PREFIX, NULL_BYTE_PLACEHOLDER, FS_PREFIX, CLIENT_PUBLIC_PATH, ENV_PUBLIC_PATH, ENV_ENTRY, DEFAULT_MAIN_FIELDS, DEFAULT_EXTENSIONS as DEFAULT_EXTENSIONS$1, SPECIAL_QUERY_RE, DEP_VERSION_RE, CSS_LANGS_RE, KNOWN_ASSET_TYPES, CLIENT_DIR, JS_TYPES_RE, ESBUILD_MODULES_TARGET, VERSION as VERSION$1, VITE_PACKAGE_DIR, DEFAULT_DEV_PORT, DEFAULT_PREVIEW_PORT, DEFAULT_ASSETS_RE, DEFAULT_CONFIG_FILES } from '../constants.js';
|
|
27
26
|
import require$$5$1 from 'crypto';
|
|
28
27
|
import { Buffer as Buffer$1 } from 'node:buffer';
|
|
29
28
|
import { promisify as promisify$4, format as format$2, inspect } from 'node:util';
|
|
@@ -11549,7 +11548,6 @@ if (process.versions.pnp) {
|
|
|
11549
11548
|
catch { }
|
|
11550
11549
|
}
|
|
11551
11550
|
function invalidatePackageData(packageCache, pkgPath) {
|
|
11552
|
-
packageCache.delete(pkgPath);
|
|
11553
11551
|
const pkgDir = path$o.dirname(pkgPath);
|
|
11554
11552
|
packageCache.forEach((pkg, cacheKey) => {
|
|
11555
11553
|
if (pkg.dir === pkgDir) {
|
|
@@ -11687,32 +11685,40 @@ function loadPackageData(pkgPath) {
|
|
|
11687
11685
|
};
|
|
11688
11686
|
return pkg;
|
|
11689
11687
|
}
|
|
11690
|
-
function watchPackageDataPlugin(
|
|
11688
|
+
function watchPackageDataPlugin(packageCache) {
|
|
11689
|
+
// a list of files to watch before the plugin is ready
|
|
11691
11690
|
const watchQueue = new Set();
|
|
11692
|
-
|
|
11691
|
+
const watchedDirs = new Set();
|
|
11692
|
+
const watchFileStub = (id) => {
|
|
11693
11693
|
watchQueue.add(id);
|
|
11694
11694
|
};
|
|
11695
|
-
|
|
11695
|
+
let watchFile = watchFileStub;
|
|
11696
11696
|
const setPackageData = packageCache.set.bind(packageCache);
|
|
11697
11697
|
packageCache.set = (id, pkg) => {
|
|
11698
|
-
if (
|
|
11699
|
-
|
|
11698
|
+
if (!isInNodeModules(pkg.dir) && !watchedDirs.has(pkg.dir)) {
|
|
11699
|
+
watchedDirs.add(pkg.dir);
|
|
11700
|
+
watchFile(path$o.join(pkg.dir, 'package.json'));
|
|
11700
11701
|
}
|
|
11701
11702
|
return setPackageData(id, pkg);
|
|
11702
11703
|
};
|
|
11703
11704
|
return {
|
|
11704
11705
|
name: 'vite:watch-package-data',
|
|
11705
11706
|
buildStart() {
|
|
11706
|
-
watchFile = this.addWatchFile;
|
|
11707
|
+
watchFile = this.addWatchFile.bind(this);
|
|
11707
11708
|
watchQueue.forEach(watchFile);
|
|
11708
11709
|
watchQueue.clear();
|
|
11709
11710
|
},
|
|
11710
11711
|
buildEnd() {
|
|
11711
|
-
watchFile =
|
|
11712
|
+
watchFile = watchFileStub;
|
|
11712
11713
|
},
|
|
11713
11714
|
watchChange(id) {
|
|
11714
11715
|
if (id.endsWith('/package.json')) {
|
|
11715
|
-
invalidatePackageData(packageCache, id);
|
|
11716
|
+
invalidatePackageData(packageCache, path$o.normalize(id));
|
|
11717
|
+
}
|
|
11718
|
+
},
|
|
11719
|
+
handleHotUpdate({ file }) {
|
|
11720
|
+
if (file.endsWith('/package.json')) {
|
|
11721
|
+
invalidatePackageData(packageCache, path$o.normalize(file));
|
|
11716
11722
|
}
|
|
11717
11723
|
},
|
|
11718
11724
|
};
|
|
@@ -11854,16 +11860,6 @@ const bareImportRE = /^[\w@](?!.*:\/\/)/;
|
|
|
11854
11860
|
const deepImportRE = /^([^@][^/]*)\/|^(@[^/]+\/[^/]+)\//;
|
|
11855
11861
|
// TODO: use import()
|
|
11856
11862
|
const _require$3 = createRequire$1(import.meta.url);
|
|
11857
|
-
const ssrExtensions = ['.js', '.cjs', '.json', '.node'];
|
|
11858
|
-
function resolveFrom(id, basedir, preserveSymlinks = false, ssr = false) {
|
|
11859
|
-
return resolve$4.sync(id, {
|
|
11860
|
-
basedir,
|
|
11861
|
-
paths: [],
|
|
11862
|
-
extensions: ssr ? ssrExtensions : DEFAULT_EXTENSIONS$1,
|
|
11863
|
-
// necessary to work with pnpm
|
|
11864
|
-
preserveSymlinks: preserveSymlinks || !!process.versions.pnp || false,
|
|
11865
|
-
});
|
|
11866
|
-
}
|
|
11867
11863
|
// set in bin/vite.js
|
|
11868
11864
|
const filter = process.env.VITE_DEBUG_FILTER;
|
|
11869
11865
|
const DEBUG = process.env.DEBUG;
|
|
@@ -11876,9 +11872,9 @@ function createDebugger(namespace, options = {}) {
|
|
|
11876
11872
|
enabled = !!DEBUG?.includes(ns);
|
|
11877
11873
|
}
|
|
11878
11874
|
if (enabled) {
|
|
11879
|
-
return (
|
|
11880
|
-
if (!filter ||
|
|
11881
|
-
log(
|
|
11875
|
+
return (...args) => {
|
|
11876
|
+
if (!filter || args.some((a) => a?.includes(filter))) {
|
|
11877
|
+
log(...args);
|
|
11882
11878
|
}
|
|
11883
11879
|
};
|
|
11884
11880
|
}
|
|
@@ -22705,12 +22701,12 @@ function resolvePlugin(resolveOptions) {
|
|
|
22705
22701
|
}
|
|
22706
22702
|
// explicit fs paths that starts with /@fs/*
|
|
22707
22703
|
if (asSrc && id.startsWith(FS_PREFIX)) {
|
|
22708
|
-
|
|
22709
|
-
|
|
22710
|
-
debug$d?.(`[@fs] ${picocolorsExports.cyan(id)} -> ${picocolorsExports.dim(res)}`);
|
|
22704
|
+
res = fsPathFromId(id);
|
|
22705
|
+
// We don't need to resolve these paths since they are already resolved
|
|
22711
22706
|
// always return here even if res doesn't exist since /@fs/ is explicit
|
|
22712
|
-
// if the file doesn't exist it should be a 404
|
|
22713
|
-
|
|
22707
|
+
// if the file doesn't exist it should be a 404.
|
|
22708
|
+
debug$d?.(`[@fs] ${picocolorsExports.cyan(id)} -> ${picocolorsExports.dim(res)}`);
|
|
22709
|
+
return ensureVersionQuery(res, id, options, depsOptimizer);
|
|
22714
22710
|
}
|
|
22715
22711
|
// URL
|
|
22716
22712
|
// /foo -> /fs-root/foo
|
|
@@ -22791,7 +22787,7 @@ function resolvePlugin(resolveOptions) {
|
|
|
22791
22787
|
asSrc &&
|
|
22792
22788
|
depsOptimizer &&
|
|
22793
22789
|
!options.scan &&
|
|
22794
|
-
(res = await tryOptimizedResolve(depsOptimizer, id, importer))) {
|
|
22790
|
+
(res = await tryOptimizedResolve(depsOptimizer, id, importer, options.preserveSymlinks, options.packageCache))) {
|
|
22795
22791
|
return res;
|
|
22796
22792
|
}
|
|
22797
22793
|
if (targetWeb &&
|
|
@@ -23158,7 +23154,7 @@ function tryNodeResolve(id, importer, options, targetWeb, depsOptimizer, ssr = f
|
|
|
23158
23154
|
return { id: resolved };
|
|
23159
23155
|
}
|
|
23160
23156
|
}
|
|
23161
|
-
async function tryOptimizedResolve(depsOptimizer, id, importer) {
|
|
23157
|
+
async function tryOptimizedResolve(depsOptimizer, id, importer, preserveSymlinks, packageCache) {
|
|
23162
23158
|
// TODO: we need to wait until scanning is done here as this function
|
|
23163
23159
|
// is used in the preAliasPlugin to decide if an aliased dep is optimized,
|
|
23164
23160
|
// and avoid replacing the bare import with the resolved path.
|
|
@@ -23172,30 +23168,25 @@ async function tryOptimizedResolve(depsOptimizer, id, importer) {
|
|
|
23172
23168
|
if (!importer)
|
|
23173
23169
|
return;
|
|
23174
23170
|
// further check if id is imported by nested dependency
|
|
23175
|
-
let
|
|
23171
|
+
let idPkgDir;
|
|
23172
|
+
const nestedIdMatch = `> ${id}`;
|
|
23176
23173
|
for (const optimizedData of metadata.depInfoList) {
|
|
23177
23174
|
if (!optimizedData.src)
|
|
23178
23175
|
continue; // Ignore chunks
|
|
23179
|
-
|
|
23180
|
-
|
|
23181
|
-
// pkgPath => "my-lib > foo"
|
|
23182
|
-
// id => "foo"
|
|
23183
|
-
// this narrows the need to do a full resolve
|
|
23184
|
-
if (!pkgPath.endsWith(id))
|
|
23176
|
+
// check where "foo" is nested in "my-lib > foo"
|
|
23177
|
+
if (!optimizedData.id.endsWith(nestedIdMatch))
|
|
23185
23178
|
continue;
|
|
23186
|
-
// lazily initialize
|
|
23187
|
-
if (
|
|
23188
|
-
|
|
23189
|
-
|
|
23190
|
-
|
|
23191
|
-
|
|
23192
|
-
catch {
|
|
23193
|
-
// this is best-effort only so swallow errors
|
|
23179
|
+
// lazily initialize idPkgDir
|
|
23180
|
+
if (idPkgDir == null) {
|
|
23181
|
+
idPkgDir = resolvePackageData(id, importer, preserveSymlinks, packageCache)?.dir;
|
|
23182
|
+
// if still null, it likely means that this id isn't a dep for importer.
|
|
23183
|
+
// break to bail early
|
|
23184
|
+
if (idPkgDir == null)
|
|
23194
23185
|
break;
|
|
23195
|
-
|
|
23186
|
+
idPkgDir = normalizePath$3(idPkgDir);
|
|
23196
23187
|
}
|
|
23197
23188
|
// match by src to correctly identify if id belongs to nested dependency
|
|
23198
|
-
if (optimizedData.src
|
|
23189
|
+
if (optimizedData.src.startsWith(idPkgDir)) {
|
|
23199
23190
|
return depsOptimizer.getOptimizedDepId(optimizedData);
|
|
23200
23191
|
}
|
|
23201
23192
|
}
|
|
@@ -38470,8 +38461,8 @@ function createCachedImport(imp) {
|
|
|
38470
38461
|
return cached;
|
|
38471
38462
|
};
|
|
38472
38463
|
}
|
|
38473
|
-
const importPostcssImport = createCachedImport(() => import('./dep-
|
|
38474
|
-
const importPostcssModules = createCachedImport(() => import('./dep-
|
|
38464
|
+
const importPostcssImport = createCachedImport(() => import('./dep-0eeee069.js').then(function (n) { return n.i; }));
|
|
38465
|
+
const importPostcssModules = createCachedImport(() => import('./dep-afdc0526.js').then(function (n) { return n.i; }));
|
|
38475
38466
|
const importPostcss = createCachedImport(() => import('postcss'));
|
|
38476
38467
|
/**
|
|
38477
38468
|
* @experimental
|
|
@@ -40369,9 +40360,7 @@ function importAnalysisPlugin(config) {
|
|
|
40369
40360
|
let s;
|
|
40370
40361
|
const str = () => s || (s = new MagicString(source));
|
|
40371
40362
|
const importedUrls = new Set();
|
|
40372
|
-
const acceptedUrls = new Set();
|
|
40373
40363
|
let isPartiallySelfAccepting = false;
|
|
40374
|
-
const acceptedExports = new Set();
|
|
40375
40364
|
const importedBindings = enablePartialAccept
|
|
40376
40365
|
? new Map()
|
|
40377
40366
|
: null;
|
|
@@ -40471,11 +40460,13 @@ function importAnalysisPlugin(config) {
|
|
|
40471
40460
|
}
|
|
40472
40461
|
return [url, resolved.id];
|
|
40473
40462
|
};
|
|
40474
|
-
|
|
40463
|
+
const orderedAcceptedUrls = new Array(imports.length);
|
|
40464
|
+
const orderedAcceptedExports = new Array(imports.length);
|
|
40465
|
+
await Promise.all(imports.map(async (importSpecifier, index) => {
|
|
40475
40466
|
const { s: start, e: end, ss: expStart, se: expEnd, d: dynamicIndex,
|
|
40476
40467
|
// #2083 User may use escape path,
|
|
40477
40468
|
// so use imports[index].n to get the unescaped string
|
|
40478
|
-
n: specifier, a: assertIndex, } =
|
|
40469
|
+
n: specifier, a: assertIndex, } = importSpecifier;
|
|
40479
40470
|
const rawUrl = source.slice(start, end);
|
|
40480
40471
|
// check import.meta usage
|
|
40481
40472
|
if (rawUrl === 'import.meta') {
|
|
@@ -40486,18 +40477,24 @@ function importAnalysisPlugin(config) {
|
|
|
40486
40477
|
if (source.slice(endHot, endHot + 7) === '.accept') {
|
|
40487
40478
|
// further analyze accepted modules
|
|
40488
40479
|
if (source.slice(endHot, endHot + 14) === '.acceptExports') {
|
|
40489
|
-
|
|
40480
|
+
const importAcceptedExports = (orderedAcceptedExports[index] =
|
|
40481
|
+
new Set());
|
|
40482
|
+
lexAcceptedHmrExports(source, source.indexOf('(', endHot + 14) + 1, importAcceptedExports);
|
|
40490
40483
|
isPartiallySelfAccepting = true;
|
|
40491
40484
|
}
|
|
40492
|
-
else
|
|
40493
|
-
|
|
40485
|
+
else {
|
|
40486
|
+
const importAcceptedUrls = (orderedAcceptedUrls[index] =
|
|
40487
|
+
new Set());
|
|
40488
|
+
if (lexAcceptedHmrDeps(source, source.indexOf('(', endHot + 7) + 1, importAcceptedUrls)) {
|
|
40489
|
+
isSelfAccepting = true;
|
|
40490
|
+
}
|
|
40494
40491
|
}
|
|
40495
40492
|
}
|
|
40496
40493
|
}
|
|
40497
40494
|
else if (prop === '.env') {
|
|
40498
40495
|
hasEnv = true;
|
|
40499
40496
|
}
|
|
40500
|
-
|
|
40497
|
+
return;
|
|
40501
40498
|
}
|
|
40502
40499
|
const isDynamicImport = dynamicIndex > -1;
|
|
40503
40500
|
// strip import assertions as we can process them ourselves
|
|
@@ -40509,25 +40506,25 @@ function importAnalysisPlugin(config) {
|
|
|
40509
40506
|
if (specifier) {
|
|
40510
40507
|
// skip external / data uri
|
|
40511
40508
|
if (isExternalUrl(specifier) || isDataUrl(specifier)) {
|
|
40512
|
-
|
|
40509
|
+
return;
|
|
40513
40510
|
}
|
|
40514
40511
|
// skip ssr external
|
|
40515
40512
|
if (ssr) {
|
|
40516
40513
|
if (config.legacy?.buildSsrCjsExternalHeuristics) {
|
|
40517
40514
|
if (cjsShouldExternalizeForSSR(specifier, server._ssrExternals)) {
|
|
40518
|
-
|
|
40515
|
+
return;
|
|
40519
40516
|
}
|
|
40520
40517
|
}
|
|
40521
40518
|
else if (shouldExternalizeForSSR(specifier, config)) {
|
|
40522
|
-
|
|
40519
|
+
return;
|
|
40523
40520
|
}
|
|
40524
40521
|
if (isBuiltin(specifier)) {
|
|
40525
|
-
|
|
40522
|
+
return;
|
|
40526
40523
|
}
|
|
40527
40524
|
}
|
|
40528
40525
|
// skip client
|
|
40529
40526
|
if (specifier === clientPublicPath) {
|
|
40530
|
-
|
|
40527
|
+
return;
|
|
40531
40528
|
}
|
|
40532
40529
|
// warn imports to non-asset /public files
|
|
40533
40530
|
if (specifier[0] === '/' &&
|
|
@@ -40582,7 +40579,7 @@ function importAnalysisPlugin(config) {
|
|
|
40582
40579
|
}
|
|
40583
40580
|
else if (needsInterop) {
|
|
40584
40581
|
debug$a?.(`${url} needs interop`);
|
|
40585
|
-
interopNamedImports(str(),
|
|
40582
|
+
interopNamedImports(str(), importSpecifier, url, index);
|
|
40586
40583
|
rewriteDone = true;
|
|
40587
40584
|
}
|
|
40588
40585
|
}
|
|
@@ -40591,7 +40588,7 @@ function importAnalysisPlugin(config) {
|
|
|
40591
40588
|
// correctly throw the error message.
|
|
40592
40589
|
else if (url.includes(browserExternalId) &&
|
|
40593
40590
|
source.slice(expStart, start).includes('{')) {
|
|
40594
|
-
interopNamedImports(str(),
|
|
40591
|
+
interopNamedImports(str(), importSpecifier, url, index);
|
|
40595
40592
|
rewriteDone = true;
|
|
40596
40593
|
}
|
|
40597
40594
|
if (!rewriteDone) {
|
|
@@ -40611,7 +40608,7 @@ function importAnalysisPlugin(config) {
|
|
|
40611
40608
|
importedUrls.add(hmrUrl);
|
|
40612
40609
|
}
|
|
40613
40610
|
if (enablePartialAccept && importedBindings) {
|
|
40614
|
-
extractImportedBindings(resolvedId, source,
|
|
40611
|
+
extractImportedBindings(resolvedId, source, importSpecifier, importedBindings);
|
|
40615
40612
|
}
|
|
40616
40613
|
if (!isDynamicImport &&
|
|
40617
40614
|
isLocalImport &&
|
|
@@ -40657,7 +40654,9 @@ function importAnalysisPlugin(config) {
|
|
|
40657
40654
|
}
|
|
40658
40655
|
}
|
|
40659
40656
|
}
|
|
40660
|
-
}
|
|
40657
|
+
}));
|
|
40658
|
+
const acceptedUrls = mergeAcceptedUrls(orderedAcceptedUrls);
|
|
40659
|
+
const acceptedExports = mergeAcceptedUrls(orderedAcceptedExports);
|
|
40661
40660
|
if (hasEnv) {
|
|
40662
40661
|
// inject import.meta.env
|
|
40663
40662
|
str().prepend(getEnv(ssr));
|
|
@@ -40724,6 +40723,16 @@ function importAnalysisPlugin(config) {
|
|
|
40724
40723
|
},
|
|
40725
40724
|
};
|
|
40726
40725
|
}
|
|
40726
|
+
function mergeAcceptedUrls(orderedUrls) {
|
|
40727
|
+
const acceptedUrls = new Set();
|
|
40728
|
+
for (const urls of orderedUrls) {
|
|
40729
|
+
if (!urls)
|
|
40730
|
+
continue;
|
|
40731
|
+
for (const url of urls)
|
|
40732
|
+
acceptedUrls.add(url);
|
|
40733
|
+
}
|
|
40734
|
+
return acceptedUrls;
|
|
40735
|
+
}
|
|
40727
40736
|
function interopNamedImports(str, importSpecifier, rewrittenUrl, importIndex) {
|
|
40728
40737
|
const source = str.original;
|
|
40729
40738
|
const { s: start, e: end, ss: expStart, se: expEnd, d: dynamicIndex, } = importSpecifier;
|
|
@@ -41320,7 +41329,7 @@ function preAliasPlugin(config) {
|
|
|
41320
41329
|
id !== '@vite/client' &&
|
|
41321
41330
|
id !== '@vite/env') {
|
|
41322
41331
|
if (findPatterns.find((pattern) => matches(pattern, id))) {
|
|
41323
|
-
const optimizedId = await tryOptimizedResolve(depsOptimizer, id, importer);
|
|
41332
|
+
const optimizedId = await tryOptimizedResolve(depsOptimizer, id, importer, config.resolve.preserveSymlinks, config.packageCache);
|
|
41324
41333
|
if (optimizedId) {
|
|
41325
41334
|
return optimizedId; // aliased dep already optimized
|
|
41326
41335
|
}
|
|
@@ -42088,6 +42097,7 @@ async function resolvePlugins(config, prePlugins, normalPlugins, postPlugins) {
|
|
|
42088
42097
|
return [
|
|
42089
42098
|
isWatch ? ensureWatchPlugin() : null,
|
|
42090
42099
|
isBuild ? metadataPlugin() : null,
|
|
42100
|
+
watchPackageDataPlugin(config.packageCache),
|
|
42091
42101
|
preAliasPlugin(config),
|
|
42092
42102
|
alias$1({ entries: config.resolve.alias }),
|
|
42093
42103
|
...prePlugins,
|
|
@@ -45638,7 +45648,6 @@ async function resolveBuildPlugins(config) {
|
|
|
45638
45648
|
pre: [
|
|
45639
45649
|
completeSystemWrapPlugin(),
|
|
45640
45650
|
...(options.watch ? [ensureWatchPlugin()] : []),
|
|
45641
|
-
watchPackageDataPlugin(config),
|
|
45642
45651
|
...(usePluginCommonjs ? [commonjs(options.commonjsOptions)] : []),
|
|
45643
45652
|
dataURIPlugin(),
|
|
45644
45653
|
...(await asyncFlatten(Array.isArray(rollupOptionsPlugins)
|
|
@@ -45939,32 +45948,36 @@ const dynamicImportWarningIgnoreList = [
|
|
|
45939
45948
|
`statically analyzed`,
|
|
45940
45949
|
];
|
|
45941
45950
|
function onRollupWarning(warning, warn, config) {
|
|
45942
|
-
|
|
45943
|
-
|
|
45944
|
-
|
|
45945
|
-
|
|
45946
|
-
|
|
45947
|
-
|
|
45948
|
-
|
|
45949
|
-
|
|
45950
|
-
|
|
45951
|
-
|
|
45952
|
-
|
|
45953
|
-
|
|
45954
|
-
|
|
45955
|
-
|
|
45956
|
-
|
|
45957
|
-
if (!warningIgnoreList.includes(warning.code)) {
|
|
45958
|
-
const userOnWarn = config.build.rollupOptions?.onwarn;
|
|
45959
|
-
if (userOnWarn) {
|
|
45960
|
-
userOnWarn(warning, warn);
|
|
45951
|
+
function viteWarn(warning) {
|
|
45952
|
+
if (warning.code === 'UNRESOLVED_IMPORT') {
|
|
45953
|
+
const id = warning.id;
|
|
45954
|
+
const exporter = warning.exporter;
|
|
45955
|
+
// throw unless it's commonjs external...
|
|
45956
|
+
if (!id || !/\?commonjs-external$/.test(id)) {
|
|
45957
|
+
throw new Error(`[vite]: Rollup failed to resolve import "${exporter}" from "${id}".\n` +
|
|
45958
|
+
`This is most likely unintended because it can break your application at runtime.\n` +
|
|
45959
|
+
`If you do want to externalize this module explicitly add it to\n` +
|
|
45960
|
+
`\`build.rollupOptions.external\``);
|
|
45961
|
+
}
|
|
45962
|
+
}
|
|
45963
|
+
if (warning.plugin === 'rollup-plugin-dynamic-import-variables' &&
|
|
45964
|
+
dynamicImportWarningIgnoreList.some((msg) => warning.message.includes(msg))) {
|
|
45965
|
+
return;
|
|
45961
45966
|
}
|
|
45962
|
-
|
|
45963
|
-
|
|
45967
|
+
if (!warningIgnoreList.includes(warning.code)) {
|
|
45968
|
+
return;
|
|
45964
45969
|
}
|
|
45965
|
-
|
|
45966
|
-
warn(warning);
|
|
45970
|
+
if (warning.code === 'PLUGIN_WARNING') {
|
|
45971
|
+
config.logger.warn(`${picocolorsExports.bold(picocolorsExports.yellow(`[plugin:${warning.plugin}]`))} ${picocolorsExports.yellow(warning.message)}`);
|
|
45967
45972
|
}
|
|
45973
|
+
warn(warning);
|
|
45974
|
+
}
|
|
45975
|
+
const userOnWarn = config.build.rollupOptions?.onwarn;
|
|
45976
|
+
if (userOnWarn) {
|
|
45977
|
+
userOnWarn(warning, viteWarn);
|
|
45978
|
+
}
|
|
45979
|
+
else {
|
|
45980
|
+
viteWarn(warning);
|
|
45968
45981
|
}
|
|
45969
45982
|
}
|
|
45970
45983
|
async function cjsSsrResolveExternal(config, user) {
|
|
@@ -53170,6 +53183,10 @@ async function loadAndTransform(id, url, server, options, timestamp) {
|
|
|
53170
53183
|
const file = cleanUrl(id);
|
|
53171
53184
|
let code = null;
|
|
53172
53185
|
let map = null;
|
|
53186
|
+
// Ensure that the module is in the graph before it is loaded and the file is checked.
|
|
53187
|
+
// This prevents errors from occurring during the load process and interrupting the watching process at its inception.
|
|
53188
|
+
const mod = await moduleGraph.ensureEntryFromUrl(url, ssr);
|
|
53189
|
+
ensureWatchedFile(watcher, mod.file, root);
|
|
53173
53190
|
// load
|
|
53174
53191
|
const loadStart = debugLoad ? performance$1.now() : 0;
|
|
53175
53192
|
const loadResult = await pluginContainer.load(id, { ssr });
|
|
@@ -53234,9 +53251,6 @@ async function loadAndTransform(id, url, server, options, timestamp) {
|
|
|
53234
53251
|
err.code = isPublicFile ? ERR_LOAD_PUBLIC_URL : ERR_LOAD_URL;
|
|
53235
53252
|
throw err;
|
|
53236
53253
|
}
|
|
53237
|
-
// ensure module in graph after successful load
|
|
53238
|
-
const mod = await moduleGraph.ensureEntryFromUrl(url, ssr);
|
|
53239
|
-
ensureWatchedFile(watcher, mod.file, root);
|
|
53240
53254
|
// transform
|
|
53241
53255
|
const transformStart = debugTransform ? performance$1.now() : 0;
|
|
53242
53256
|
const transformResult = await pluginContainer.transform(code, id, {
|
|
@@ -61846,32 +61860,36 @@ class ModuleGraph {
|
|
|
61846
61860
|
if (mod) {
|
|
61847
61861
|
return mod;
|
|
61848
61862
|
}
|
|
61849
|
-
const
|
|
61850
|
-
|
|
61851
|
-
|
|
61852
|
-
|
|
61853
|
-
|
|
61854
|
-
|
|
61855
|
-
|
|
61856
|
-
|
|
61857
|
-
|
|
61858
|
-
|
|
61859
|
-
|
|
61860
|
-
|
|
61861
|
-
|
|
61862
|
-
|
|
61863
|
-
|
|
61864
|
-
|
|
61865
|
-
|
|
61866
|
-
|
|
61867
|
-
|
|
61868
|
-
|
|
61869
|
-
this.urlToModuleMap.
|
|
61870
|
-
|
|
61863
|
+
const modPromise = (async () => {
|
|
61864
|
+
const [url, resolvedId, meta] = await this._resolveUrl(rawUrl, ssr, resolved);
|
|
61865
|
+
mod = this.idToModuleMap.get(resolvedId);
|
|
61866
|
+
if (!mod) {
|
|
61867
|
+
mod = new ModuleNode(url, setIsSelfAccepting);
|
|
61868
|
+
if (meta)
|
|
61869
|
+
mod.meta = meta;
|
|
61870
|
+
this.urlToModuleMap.set(url, mod);
|
|
61871
|
+
mod.id = resolvedId;
|
|
61872
|
+
this.idToModuleMap.set(resolvedId, mod);
|
|
61873
|
+
const file = (mod.file = cleanUrl(resolvedId));
|
|
61874
|
+
let fileMappedModules = this.fileToModulesMap.get(file);
|
|
61875
|
+
if (!fileMappedModules) {
|
|
61876
|
+
fileMappedModules = new Set();
|
|
61877
|
+
this.fileToModulesMap.set(file, fileMappedModules);
|
|
61878
|
+
}
|
|
61879
|
+
fileMappedModules.add(mod);
|
|
61880
|
+
}
|
|
61881
|
+
// multiple urls can map to the same module and id, make sure we register
|
|
61882
|
+
// the url to the existing module in that case
|
|
61883
|
+
else if (!this.urlToModuleMap.has(url)) {
|
|
61884
|
+
this.urlToModuleMap.set(url, mod);
|
|
61885
|
+
}
|
|
61886
|
+
this._setUnresolvedUrlToModule(rawUrl, mod, ssr);
|
|
61887
|
+
return mod;
|
|
61888
|
+
})();
|
|
61871
61889
|
// Also register the clean url to the module, so that we can short-circuit
|
|
61872
61890
|
// resolving the same url twice
|
|
61873
|
-
this._setUnresolvedUrlToModule(rawUrl,
|
|
61874
|
-
return
|
|
61891
|
+
this._setUnresolvedUrlToModule(rawUrl, modPromise, ssr);
|
|
61892
|
+
return modPromise;
|
|
61875
61893
|
}
|
|
61876
61894
|
// some deps, like a css file referenced via @import, don't have its own
|
|
61877
61895
|
// url because they are inlined into the main css import. But they still
|
|
@@ -61901,7 +61919,7 @@ class ModuleGraph {
|
|
|
61901
61919
|
// the same module
|
|
61902
61920
|
async resolveUrl(url, ssr) {
|
|
61903
61921
|
url = removeImportQuery(removeTimestampQuery(url));
|
|
61904
|
-
const mod = this._getUnresolvedUrlToModule(url, ssr);
|
|
61922
|
+
const mod = await this._getUnresolvedUrlToModule(url, ssr);
|
|
61905
61923
|
if (mod?.id) {
|
|
61906
61924
|
return [mod.url, mod.id, mod.meta];
|
|
61907
61925
|
}
|
|
@@ -63254,14 +63272,6 @@ async function _createServer(inlineConfig = {}, options) {
|
|
|
63254
63272
|
process.stdin.on('end', exitProcess);
|
|
63255
63273
|
}
|
|
63256
63274
|
}
|
|
63257
|
-
const { packageCache } = config;
|
|
63258
|
-
const setPackageData = packageCache.set.bind(packageCache);
|
|
63259
|
-
packageCache.set = (id, pkg) => {
|
|
63260
|
-
if (id.endsWith('.json')) {
|
|
63261
|
-
watcher.add(id);
|
|
63262
|
-
}
|
|
63263
|
-
return setPackageData(id, pkg);
|
|
63264
|
-
};
|
|
63265
63275
|
const onHMRUpdate = async (file, configOnly) => {
|
|
63266
63276
|
if (serverConfig.hmr !== false) {
|
|
63267
63277
|
try {
|
|
@@ -63282,9 +63292,6 @@ async function _createServer(inlineConfig = {}, options) {
|
|
|
63282
63292
|
};
|
|
63283
63293
|
watcher.on('change', async (file) => {
|
|
63284
63294
|
file = normalizePath$3(file);
|
|
63285
|
-
if (file.endsWith('/package.json')) {
|
|
63286
|
-
return invalidatePackageData(packageCache, file);
|
|
63287
|
-
}
|
|
63288
63295
|
// invalidate module graph cache on file change
|
|
63289
63296
|
moduleGraph.onFileChange(file);
|
|
63290
63297
|
await onHMRUpdate(file, false);
|
|
@@ -63891,8 +63898,14 @@ async function resolveConfig(inlineConfig, command, defaultMode = 'development',
|
|
|
63891
63898
|
// resolve root
|
|
63892
63899
|
const resolvedRoot = normalizePath$3(config.root ? path$o.resolve(config.root) : process.cwd());
|
|
63893
63900
|
const clientAlias = [
|
|
63894
|
-
{
|
|
63895
|
-
|
|
63901
|
+
{
|
|
63902
|
+
find: /^\/?@vite\/env/,
|
|
63903
|
+
replacement: path$o.posix.join(FS_PREFIX, normalizePath$3(ENV_ENTRY)),
|
|
63904
|
+
},
|
|
63905
|
+
{
|
|
63906
|
+
find: /^\/?@vite\/client/,
|
|
63907
|
+
replacement: path$o.posix.join(FS_PREFIX, normalizePath$3(CLIENT_ENTRY)),
|
|
63908
|
+
},
|
|
63896
63909
|
];
|
|
63897
63910
|
// resolve alias with internal client alias
|
|
63898
63911
|
const resolvedAlias = normalizeAlias(mergeAlias(clientAlias, config.resolve?.alias || []));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import require$$0__default from 'fs';
|
|
2
2
|
import require$$0 from 'postcss';
|
|
3
|
-
import { D as commonjsGlobal } from './dep-
|
|
3
|
+
import { D as commonjsGlobal } from './dep-366ea021.js';
|
|
4
4
|
import require$$0$1 from 'path';
|
|
5
5
|
import require$$5 from 'crypto';
|
|
6
6
|
import require$$0$2 from 'util';
|
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 { B as picocolorsExports, C as bindShortcuts, x as createLogger, h as resolveConfig } from './chunks/dep-
|
|
5
|
+
import { B as picocolorsExports, C as bindShortcuts, x as createLogger, h as resolveConfig } from './chunks/dep-366ea021.js';
|
|
6
6
|
import { VERSION } from './constants.js';
|
|
7
7
|
import 'node:fs/promises';
|
|
8
8
|
import 'node:url';
|
|
@@ -23,7 +23,6 @@ import 'node:os';
|
|
|
23
23
|
import 'node:child_process';
|
|
24
24
|
import 'node:crypto';
|
|
25
25
|
import 'node:dns';
|
|
26
|
-
import 'resolve';
|
|
27
26
|
import 'crypto';
|
|
28
27
|
import 'node:buffer';
|
|
29
28
|
import 'node:util';
|
|
@@ -729,7 +728,7 @@ cli
|
|
|
729
728
|
filterDuplicateOptions(options);
|
|
730
729
|
// output structure is preserved even after bundling so require()
|
|
731
730
|
// is ok here
|
|
732
|
-
const { createServer } = await import('./chunks/dep-
|
|
731
|
+
const { createServer } = await import('./chunks/dep-366ea021.js').then(function (n) { return n.G; });
|
|
733
732
|
try {
|
|
734
733
|
const server = await createServer({
|
|
735
734
|
root,
|
|
@@ -807,7 +806,7 @@ cli
|
|
|
807
806
|
.option('-w, --watch', `[boolean] rebuilds when modules have changed on disk`)
|
|
808
807
|
.action(async (root, options) => {
|
|
809
808
|
filterDuplicateOptions(options);
|
|
810
|
-
const { build } = await import('./chunks/dep-
|
|
809
|
+
const { build } = await import('./chunks/dep-366ea021.js').then(function (n) { return n.F; });
|
|
811
810
|
const buildOptions = cleanOptions(options);
|
|
812
811
|
try {
|
|
813
812
|
await build({
|
|
@@ -835,7 +834,7 @@ cli
|
|
|
835
834
|
.option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
|
|
836
835
|
.action(async (root, options) => {
|
|
837
836
|
filterDuplicateOptions(options);
|
|
838
|
-
const { optimizeDeps } = await import('./chunks/dep-
|
|
837
|
+
const { optimizeDeps } = await import('./chunks/dep-366ea021.js').then(function (n) { return n.E; });
|
|
839
838
|
try {
|
|
840
839
|
const config = await resolveConfig({
|
|
841
840
|
root,
|
|
@@ -860,7 +859,7 @@ cli
|
|
|
860
859
|
.option('--outDir <dir>', `[string] output directory (default: dist)`)
|
|
861
860
|
.action(async (root, options) => {
|
|
862
861
|
filterDuplicateOptions(options);
|
|
863
|
-
const { preview } = await import('./chunks/dep-
|
|
862
|
+
const { preview } = await import('./chunks/dep-366ea021.js').then(function (n) { return n.H; });
|
|
864
863
|
try {
|
|
865
864
|
const server = await preview({
|
|
866
865
|
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, l as loadConfigFromFile, z 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, A 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-366ea021.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, l as loadConfigFromFile, z 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, A as resolveEnvPrefix, d as resolvePackageData, r as resolvePackageEntry, y as searchForWorkspaceRoot, w as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-366ea021.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';
|
|
@@ -25,7 +25,6 @@ import 'node:os';
|
|
|
25
25
|
import 'node:child_process';
|
|
26
26
|
import 'node:crypto';
|
|
27
27
|
import 'node:dns';
|
|
28
|
-
import 'resolve';
|
|
29
28
|
import 'crypto';
|
|
30
29
|
import 'node:buffer';
|
|
31
30
|
import 'node:util';
|
|
@@ -3324,9 +3324,9 @@ function createDebugger(namespace, options = {}) {
|
|
|
3324
3324
|
enabled = !!DEBUG?.includes(ns);
|
|
3325
3325
|
}
|
|
3326
3326
|
if (enabled) {
|
|
3327
|
-
return (
|
|
3328
|
-
if (!filter ||
|
|
3329
|
-
log(
|
|
3327
|
+
return (...args) => {
|
|
3328
|
+
if (!filter || args.some((a) => a?.includes(filter))) {
|
|
3329
|
+
log(...args);
|
|
3330
3330
|
}
|
|
3331
3331
|
};
|
|
3332
3332
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite",
|
|
3
|
-
"version": "4.3.0-beta.
|
|
3
|
+
"version": "4.3.0-beta.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Evan You",
|
|
@@ -68,7 +68,6 @@
|
|
|
68
68
|
"dependencies": {
|
|
69
69
|
"esbuild": "^0.17.5",
|
|
70
70
|
"postcss": "^8.4.21",
|
|
71
|
-
"resolve": "^1.22.1",
|
|
72
71
|
"rollup": "^3.20.2"
|
|
73
72
|
},
|
|
74
73
|
"optionalDependencies": {
|