vite 4.3.0-beta.2 → 4.3.0-beta.4
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-281af434.js → dep-a36bfc56.js} +207 -163
- package/dist/node/chunks/{dep-3b7a7ba2.js → dep-a4107a1b.js} +1 -1
- package/dist/node/chunks/{dep-53dc1ef4.js → dep-e3f470e2.js} +2 -44
- package/dist/node/cli.js +6 -6
- package/dist/node/index.d.ts +1 -0
- package/dist/node/index.js +2 -3
- package/dist/node-cjs/publicUtils.cjs +3 -3
- package/package.json +1 -2
|
@@ -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
|
}
|
|
@@ -12881,6 +12877,9 @@ function buildReporterPlugin(config) {
|
|
|
12881
12877
|
options() {
|
|
12882
12878
|
startTime = Date.now();
|
|
12883
12879
|
},
|
|
12880
|
+
buildStart() {
|
|
12881
|
+
transformedCount = 0;
|
|
12882
|
+
},
|
|
12884
12883
|
buildEnd() {
|
|
12885
12884
|
if (shouldLogInfo) {
|
|
12886
12885
|
if (tty) {
|
|
@@ -15856,7 +15855,7 @@ function registerCustomMime() {
|
|
|
15856
15855
|
mimes$1['eot'] = 'application/vnd.ms-fontobject';
|
|
15857
15856
|
}
|
|
15858
15857
|
function renderAssetUrlInJS(ctx, config, chunk, opts, code) {
|
|
15859
|
-
const toRelativeRuntime = createToImportMetaURLBasedRelativeRuntime(opts.format);
|
|
15858
|
+
const toRelativeRuntime = createToImportMetaURLBasedRelativeRuntime(opts.format, config.isWorker);
|
|
15860
15859
|
let match;
|
|
15861
15860
|
let s;
|
|
15862
15861
|
// Urls added with JS using e.g.
|
|
@@ -22705,12 +22704,12 @@ function resolvePlugin(resolveOptions) {
|
|
|
22705
22704
|
}
|
|
22706
22705
|
// explicit fs paths that starts with /@fs/*
|
|
22707
22706
|
if (asSrc && id.startsWith(FS_PREFIX)) {
|
|
22708
|
-
|
|
22709
|
-
|
|
22710
|
-
debug$d?.(`[@fs] ${picocolorsExports.cyan(id)} -> ${picocolorsExports.dim(res)}`);
|
|
22707
|
+
res = fsPathFromId(id);
|
|
22708
|
+
// We don't need to resolve these paths since they are already resolved
|
|
22711
22709
|
// 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
|
-
|
|
22710
|
+
// if the file doesn't exist it should be a 404.
|
|
22711
|
+
debug$d?.(`[@fs] ${picocolorsExports.cyan(id)} -> ${picocolorsExports.dim(res)}`);
|
|
22712
|
+
return ensureVersionQuery(res, id, options, depsOptimizer);
|
|
22714
22713
|
}
|
|
22715
22714
|
// URL
|
|
22716
22715
|
// /foo -> /fs-root/foo
|
|
@@ -22746,15 +22745,23 @@ function resolvePlugin(resolveOptions) {
|
|
|
22746
22745
|
return res;
|
|
22747
22746
|
}
|
|
22748
22747
|
if ((res = tryFsResolve(fsPath, options))) {
|
|
22749
|
-
const resPkg = findNearestPackageData(path$o.dirname(res), options.packageCache);
|
|
22750
22748
|
res = ensureVersionQuery(res, id, options, depsOptimizer);
|
|
22751
22749
|
debug$d?.(`[relative] ${picocolorsExports.cyan(id)} -> ${picocolorsExports.dim(res)}`);
|
|
22752
|
-
|
|
22753
|
-
|
|
22754
|
-
|
|
22755
|
-
|
|
22750
|
+
// If this isn't a script imported from a .html file, include side effects
|
|
22751
|
+
// hints so the non-used code is properly tree-shaken during build time.
|
|
22752
|
+
if (!options.idOnly &&
|
|
22753
|
+
!options.scan &&
|
|
22754
|
+
options.isBuild &&
|
|
22755
|
+
!importer?.endsWith('.html')) {
|
|
22756
|
+
const resPkg = findNearestPackageData(path$o.dirname(res), options.packageCache);
|
|
22757
|
+
if (resPkg) {
|
|
22758
|
+
return {
|
|
22759
|
+
id: res,
|
|
22760
|
+
moduleSideEffects: resPkg.hasSideEffects(res),
|
|
22761
|
+
};
|
|
22756
22762
|
}
|
|
22757
|
-
|
|
22763
|
+
}
|
|
22764
|
+
return res;
|
|
22758
22765
|
}
|
|
22759
22766
|
}
|
|
22760
22767
|
// drive relative fs paths (only windows)
|
|
@@ -22774,10 +22781,7 @@ function resolvePlugin(resolveOptions) {
|
|
|
22774
22781
|
}
|
|
22775
22782
|
// external
|
|
22776
22783
|
if (isExternalUrl(id)) {
|
|
22777
|
-
return {
|
|
22778
|
-
id,
|
|
22779
|
-
external: true,
|
|
22780
|
-
};
|
|
22784
|
+
return options.idOnly ? id : { id, external: true };
|
|
22781
22785
|
}
|
|
22782
22786
|
// data uri: pass through (this only happens during build and will be
|
|
22783
22787
|
// handled by dedicated plugin)
|
|
@@ -22791,7 +22795,7 @@ function resolvePlugin(resolveOptions) {
|
|
|
22791
22795
|
asSrc &&
|
|
22792
22796
|
depsOptimizer &&
|
|
22793
22797
|
!options.scan &&
|
|
22794
|
-
(res = await tryOptimizedResolve(depsOptimizer, id, importer))) {
|
|
22798
|
+
(res = await tryOptimizedResolve(depsOptimizer, id, importer, options.preserveSymlinks, options.packageCache))) {
|
|
22795
22799
|
return res;
|
|
22796
22800
|
}
|
|
22797
22801
|
if (targetWeb &&
|
|
@@ -22814,16 +22818,17 @@ function resolvePlugin(resolveOptions) {
|
|
|
22814
22818
|
message += `. Consider disabling ssr.noExternal or remove the built-in dependency.`;
|
|
22815
22819
|
this.error(message);
|
|
22816
22820
|
}
|
|
22817
|
-
return {
|
|
22818
|
-
id,
|
|
22819
|
-
external: true,
|
|
22820
|
-
};
|
|
22821
|
+
return options.idOnly ? id : { id, external: true };
|
|
22821
22822
|
}
|
|
22822
22823
|
else {
|
|
22823
22824
|
if (!asSrc) {
|
|
22824
22825
|
debug$d?.(`externalized node built-in "${id}" to empty module. ` +
|
|
22825
22826
|
`(imported by: ${picocolorsExports.white(picocolorsExports.dim(importer))})`);
|
|
22826
22827
|
}
|
|
22828
|
+
else if (isProduction) {
|
|
22829
|
+
this.warn(`Module "${id}" has been externalized for browser compatibility, imported by "${importer}". ` +
|
|
22830
|
+
`See http://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.`);
|
|
22831
|
+
}
|
|
22827
22832
|
return isProduction
|
|
22828
22833
|
? browserExternalId
|
|
22829
22834
|
: `${browserExternalId}:${id}`;
|
|
@@ -23004,10 +23009,11 @@ function tryNodeResolve(id, importer, options, targetWeb, depsOptimizer, ssr = f
|
|
|
23004
23009
|
if (dedupe?.includes(pkgId)) {
|
|
23005
23010
|
basedir = root;
|
|
23006
23011
|
}
|
|
23007
|
-
else if (importer &&
|
|
23008
|
-
path$o.isAbsolute(importer) &&
|
|
23009
|
-
fs$l.existsSync(cleanUrl(importer))) {
|
|
23012
|
+
else if (importer && path$o.isAbsolute(importer)) {
|
|
23010
23013
|
basedir = path$o.dirname(importer);
|
|
23014
|
+
if (!fs$l.existsSync(basedir)) {
|
|
23015
|
+
basedir = root;
|
|
23016
|
+
}
|
|
23011
23017
|
}
|
|
23012
23018
|
else {
|
|
23013
23019
|
basedir = root;
|
|
@@ -23077,7 +23083,8 @@ function tryNodeResolve(id, importer, options, targetWeb, depsOptimizer, ssr = f
|
|
|
23077
23083
|
}
|
|
23078
23084
|
return { ...resolved, id: resolvedId, external: true };
|
|
23079
23085
|
};
|
|
23080
|
-
if (
|
|
23086
|
+
if (!options.idOnly &&
|
|
23087
|
+
((!options.scan && isBuild && !depsOptimizer) || externalize)) {
|
|
23081
23088
|
// Resolve package side effects for build so that rollup can better
|
|
23082
23089
|
// perform tree-shaking
|
|
23083
23090
|
return processResult({
|
|
@@ -23146,7 +23153,7 @@ function tryNodeResolve(id, importer, options, targetWeb, depsOptimizer, ssr = f
|
|
|
23146
23153
|
const optimizedInfo = depsOptimizer.registerMissingImport(id, resolved);
|
|
23147
23154
|
resolved = depsOptimizer.getOptimizedDepId(optimizedInfo);
|
|
23148
23155
|
}
|
|
23149
|
-
if (isBuild) {
|
|
23156
|
+
if (!options.idOnly && !options.scan && isBuild) {
|
|
23150
23157
|
// Resolve package side effects for build so that rollup can better
|
|
23151
23158
|
// perform tree-shaking
|
|
23152
23159
|
return {
|
|
@@ -23158,7 +23165,7 @@ function tryNodeResolve(id, importer, options, targetWeb, depsOptimizer, ssr = f
|
|
|
23158
23165
|
return { id: resolved };
|
|
23159
23166
|
}
|
|
23160
23167
|
}
|
|
23161
|
-
async function tryOptimizedResolve(depsOptimizer, id, importer) {
|
|
23168
|
+
async function tryOptimizedResolve(depsOptimizer, id, importer, preserveSymlinks, packageCache) {
|
|
23162
23169
|
// TODO: we need to wait until scanning is done here as this function
|
|
23163
23170
|
// is used in the preAliasPlugin to decide if an aliased dep is optimized,
|
|
23164
23171
|
// and avoid replacing the bare import with the resolved path.
|
|
@@ -23172,30 +23179,25 @@ async function tryOptimizedResolve(depsOptimizer, id, importer) {
|
|
|
23172
23179
|
if (!importer)
|
|
23173
23180
|
return;
|
|
23174
23181
|
// further check if id is imported by nested dependency
|
|
23175
|
-
let
|
|
23182
|
+
let idPkgDir;
|
|
23183
|
+
const nestedIdMatch = `> ${id}`;
|
|
23176
23184
|
for (const optimizedData of metadata.depInfoList) {
|
|
23177
23185
|
if (!optimizedData.src)
|
|
23178
23186
|
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))
|
|
23187
|
+
// check where "foo" is nested in "my-lib > foo"
|
|
23188
|
+
if (!optimizedData.id.endsWith(nestedIdMatch))
|
|
23185
23189
|
continue;
|
|
23186
|
-
// lazily initialize
|
|
23187
|
-
if (
|
|
23188
|
-
|
|
23189
|
-
|
|
23190
|
-
|
|
23191
|
-
|
|
23192
|
-
catch {
|
|
23193
|
-
// this is best-effort only so swallow errors
|
|
23190
|
+
// lazily initialize idPkgDir
|
|
23191
|
+
if (idPkgDir == null) {
|
|
23192
|
+
idPkgDir = resolvePackageData(id, importer, preserveSymlinks, packageCache)?.dir;
|
|
23193
|
+
// if still null, it likely means that this id isn't a dep for importer.
|
|
23194
|
+
// break to bail early
|
|
23195
|
+
if (idPkgDir == null)
|
|
23194
23196
|
break;
|
|
23195
|
-
|
|
23197
|
+
idPkgDir = normalizePath$3(idPkgDir);
|
|
23196
23198
|
}
|
|
23197
23199
|
// match by src to correctly identify if id belongs to nested dependency
|
|
23198
|
-
if (optimizedData.src
|
|
23200
|
+
if (optimizedData.src.startsWith(idPkgDir)) {
|
|
23199
23201
|
return depsOptimizer.getOptimizedDepId(optimizedData);
|
|
23200
23202
|
}
|
|
23201
23203
|
}
|
|
@@ -23401,13 +23403,19 @@ function tryResolveBrowserMapping(id, importer, options, isFilePath, externalize
|
|
|
23401
23403
|
? tryNodeResolve(browserMappedPath, importer, options, true)?.id
|
|
23402
23404
|
: tryFsResolve(path$o.join(pkg.dir, browserMappedPath), options))) {
|
|
23403
23405
|
debug$d?.(`[browser mapped] ${picocolorsExports.cyan(id)} -> ${picocolorsExports.dim(res)}`);
|
|
23404
|
-
|
|
23405
|
-
|
|
23406
|
-
|
|
23407
|
-
|
|
23408
|
-
|
|
23406
|
+
let result = { id: res };
|
|
23407
|
+
if (options.idOnly) {
|
|
23408
|
+
return result;
|
|
23409
|
+
}
|
|
23410
|
+
if (!options.scan && options.isBuild) {
|
|
23411
|
+
const resPkg = findNearestPackageData(path$o.dirname(res), options.packageCache);
|
|
23412
|
+
if (resPkg) {
|
|
23413
|
+
result = {
|
|
23414
|
+
id: res,
|
|
23415
|
+
moduleSideEffects: resPkg.hasSideEffects(res),
|
|
23416
|
+
};
|
|
23409
23417
|
}
|
|
23410
|
-
|
|
23418
|
+
}
|
|
23411
23419
|
return externalize ? { ...result, external: true } : result;
|
|
23412
23420
|
}
|
|
23413
23421
|
}
|
|
@@ -38331,6 +38339,12 @@ async function compileCSS(id, code, config, urlReplacer) {
|
|
|
38331
38339
|
if (resolved) {
|
|
38332
38340
|
return path$o.resolve(resolved);
|
|
38333
38341
|
}
|
|
38342
|
+
// postcss-import falls back to `resolve` dep if this is unresolved,
|
|
38343
|
+
// but we've shimmed to remove the `resolve` dep to cut on bundle size.
|
|
38344
|
+
// warn here to provide a better error message.
|
|
38345
|
+
if (!path$o.isAbsolute(id)) {
|
|
38346
|
+
config.logger.error(picocolorsExports.red(`Unable to resolve \`@import "${id}"\` from ${basedir}`));
|
|
38347
|
+
}
|
|
38334
38348
|
return id;
|
|
38335
38349
|
},
|
|
38336
38350
|
nameLayer(index) {
|
|
@@ -38470,8 +38484,8 @@ function createCachedImport(imp) {
|
|
|
38470
38484
|
return cached;
|
|
38471
38485
|
};
|
|
38472
38486
|
}
|
|
38473
|
-
const importPostcssImport = createCachedImport(() => import('./dep-
|
|
38474
|
-
const importPostcssModules = createCachedImport(() => import('./dep-
|
|
38487
|
+
const importPostcssImport = createCachedImport(() => import('./dep-e3f470e2.js').then(function (n) { return n.i; }));
|
|
38488
|
+
const importPostcssModules = createCachedImport(() => import('./dep-a4107a1b.js').then(function (n) { return n.i; }));
|
|
38475
38489
|
const importPostcss = createCachedImport(() => import('postcss'));
|
|
38476
38490
|
/**
|
|
38477
38491
|
* @experimental
|
|
@@ -40369,9 +40383,7 @@ function importAnalysisPlugin(config) {
|
|
|
40369
40383
|
let s;
|
|
40370
40384
|
const str = () => s || (s = new MagicString(source));
|
|
40371
40385
|
const importedUrls = new Set();
|
|
40372
|
-
const acceptedUrls = new Set();
|
|
40373
40386
|
let isPartiallySelfAccepting = false;
|
|
40374
|
-
const acceptedExports = new Set();
|
|
40375
40387
|
const importedBindings = enablePartialAccept
|
|
40376
40388
|
? new Map()
|
|
40377
40389
|
: null;
|
|
@@ -40471,11 +40483,13 @@ function importAnalysisPlugin(config) {
|
|
|
40471
40483
|
}
|
|
40472
40484
|
return [url, resolved.id];
|
|
40473
40485
|
};
|
|
40474
|
-
|
|
40486
|
+
const orderedAcceptedUrls = new Array(imports.length);
|
|
40487
|
+
const orderedAcceptedExports = new Array(imports.length);
|
|
40488
|
+
await Promise.all(imports.map(async (importSpecifier, index) => {
|
|
40475
40489
|
const { s: start, e: end, ss: expStart, se: expEnd, d: dynamicIndex,
|
|
40476
40490
|
// #2083 User may use escape path,
|
|
40477
40491
|
// so use imports[index].n to get the unescaped string
|
|
40478
|
-
n: specifier, a: assertIndex, } =
|
|
40492
|
+
n: specifier, a: assertIndex, } = importSpecifier;
|
|
40479
40493
|
const rawUrl = source.slice(start, end);
|
|
40480
40494
|
// check import.meta usage
|
|
40481
40495
|
if (rawUrl === 'import.meta') {
|
|
@@ -40486,18 +40500,24 @@ function importAnalysisPlugin(config) {
|
|
|
40486
40500
|
if (source.slice(endHot, endHot + 7) === '.accept') {
|
|
40487
40501
|
// further analyze accepted modules
|
|
40488
40502
|
if (source.slice(endHot, endHot + 14) === '.acceptExports') {
|
|
40489
|
-
|
|
40503
|
+
const importAcceptedExports = (orderedAcceptedExports[index] =
|
|
40504
|
+
new Set());
|
|
40505
|
+
lexAcceptedHmrExports(source, source.indexOf('(', endHot + 14) + 1, importAcceptedExports);
|
|
40490
40506
|
isPartiallySelfAccepting = true;
|
|
40491
40507
|
}
|
|
40492
|
-
else
|
|
40493
|
-
|
|
40508
|
+
else {
|
|
40509
|
+
const importAcceptedUrls = (orderedAcceptedUrls[index] =
|
|
40510
|
+
new Set());
|
|
40511
|
+
if (lexAcceptedHmrDeps(source, source.indexOf('(', endHot + 7) + 1, importAcceptedUrls)) {
|
|
40512
|
+
isSelfAccepting = true;
|
|
40513
|
+
}
|
|
40494
40514
|
}
|
|
40495
40515
|
}
|
|
40496
40516
|
}
|
|
40497
40517
|
else if (prop === '.env') {
|
|
40498
40518
|
hasEnv = true;
|
|
40499
40519
|
}
|
|
40500
|
-
|
|
40520
|
+
return;
|
|
40501
40521
|
}
|
|
40502
40522
|
const isDynamicImport = dynamicIndex > -1;
|
|
40503
40523
|
// strip import assertions as we can process them ourselves
|
|
@@ -40509,25 +40529,25 @@ function importAnalysisPlugin(config) {
|
|
|
40509
40529
|
if (specifier) {
|
|
40510
40530
|
// skip external / data uri
|
|
40511
40531
|
if (isExternalUrl(specifier) || isDataUrl(specifier)) {
|
|
40512
|
-
|
|
40532
|
+
return;
|
|
40513
40533
|
}
|
|
40514
40534
|
// skip ssr external
|
|
40515
40535
|
if (ssr) {
|
|
40516
40536
|
if (config.legacy?.buildSsrCjsExternalHeuristics) {
|
|
40517
40537
|
if (cjsShouldExternalizeForSSR(specifier, server._ssrExternals)) {
|
|
40518
|
-
|
|
40538
|
+
return;
|
|
40519
40539
|
}
|
|
40520
40540
|
}
|
|
40521
40541
|
else if (shouldExternalizeForSSR(specifier, config)) {
|
|
40522
|
-
|
|
40542
|
+
return;
|
|
40523
40543
|
}
|
|
40524
40544
|
if (isBuiltin(specifier)) {
|
|
40525
|
-
|
|
40545
|
+
return;
|
|
40526
40546
|
}
|
|
40527
40547
|
}
|
|
40528
40548
|
// skip client
|
|
40529
40549
|
if (specifier === clientPublicPath) {
|
|
40530
|
-
|
|
40550
|
+
return;
|
|
40531
40551
|
}
|
|
40532
40552
|
// warn imports to non-asset /public files
|
|
40533
40553
|
if (specifier[0] === '/' &&
|
|
@@ -40582,7 +40602,7 @@ function importAnalysisPlugin(config) {
|
|
|
40582
40602
|
}
|
|
40583
40603
|
else if (needsInterop) {
|
|
40584
40604
|
debug$a?.(`${url} needs interop`);
|
|
40585
|
-
interopNamedImports(str(),
|
|
40605
|
+
interopNamedImports(str(), importSpecifier, url, index);
|
|
40586
40606
|
rewriteDone = true;
|
|
40587
40607
|
}
|
|
40588
40608
|
}
|
|
@@ -40591,7 +40611,7 @@ function importAnalysisPlugin(config) {
|
|
|
40591
40611
|
// correctly throw the error message.
|
|
40592
40612
|
else if (url.includes(browserExternalId) &&
|
|
40593
40613
|
source.slice(expStart, start).includes('{')) {
|
|
40594
|
-
interopNamedImports(str(),
|
|
40614
|
+
interopNamedImports(str(), importSpecifier, url, index);
|
|
40595
40615
|
rewriteDone = true;
|
|
40596
40616
|
}
|
|
40597
40617
|
if (!rewriteDone) {
|
|
@@ -40611,7 +40631,7 @@ function importAnalysisPlugin(config) {
|
|
|
40611
40631
|
importedUrls.add(hmrUrl);
|
|
40612
40632
|
}
|
|
40613
40633
|
if (enablePartialAccept && importedBindings) {
|
|
40614
|
-
extractImportedBindings(resolvedId, source,
|
|
40634
|
+
extractImportedBindings(resolvedId, source, importSpecifier, importedBindings);
|
|
40615
40635
|
}
|
|
40616
40636
|
if (!isDynamicImport &&
|
|
40617
40637
|
isLocalImport &&
|
|
@@ -40657,7 +40677,9 @@ function importAnalysisPlugin(config) {
|
|
|
40657
40677
|
}
|
|
40658
40678
|
}
|
|
40659
40679
|
}
|
|
40660
|
-
}
|
|
40680
|
+
}));
|
|
40681
|
+
const acceptedUrls = mergeAcceptedUrls(orderedAcceptedUrls);
|
|
40682
|
+
const acceptedExports = mergeAcceptedUrls(orderedAcceptedExports);
|
|
40661
40683
|
if (hasEnv) {
|
|
40662
40684
|
// inject import.meta.env
|
|
40663
40685
|
str().prepend(getEnv(ssr));
|
|
@@ -40724,6 +40746,16 @@ function importAnalysisPlugin(config) {
|
|
|
40724
40746
|
},
|
|
40725
40747
|
};
|
|
40726
40748
|
}
|
|
40749
|
+
function mergeAcceptedUrls(orderedUrls) {
|
|
40750
|
+
const acceptedUrls = new Set();
|
|
40751
|
+
for (const urls of orderedUrls) {
|
|
40752
|
+
if (!urls)
|
|
40753
|
+
continue;
|
|
40754
|
+
for (const url of urls)
|
|
40755
|
+
acceptedUrls.add(url);
|
|
40756
|
+
}
|
|
40757
|
+
return acceptedUrls;
|
|
40758
|
+
}
|
|
40727
40759
|
function interopNamedImports(str, importSpecifier, rewrittenUrl, importIndex) {
|
|
40728
40760
|
const source = str.original;
|
|
40729
40761
|
const { s: start, e: end, ss: expStart, se: expEnd, d: dynamicIndex, } = importSpecifier;
|
|
@@ -41154,11 +41186,12 @@ function webWorkerPlugin(config) {
|
|
|
41154
41186
|
return '';
|
|
41155
41187
|
}
|
|
41156
41188
|
},
|
|
41189
|
+
// @ts-expect-error return void to fallback to other plugins, even though
|
|
41190
|
+
// the types doesn't allow it. https://github.com/rollup/rollup/pull/4932
|
|
41157
41191
|
shouldTransformCachedModule({ id }) {
|
|
41158
41192
|
if (isBuild && isWorkerQueryId(id) && config.build.watch) {
|
|
41159
41193
|
return true;
|
|
41160
41194
|
}
|
|
41161
|
-
return false;
|
|
41162
41195
|
},
|
|
41163
41196
|
async transform(raw, id, options) {
|
|
41164
41197
|
const ssr = options?.ssr === true;
|
|
@@ -41268,7 +41301,7 @@ function webWorkerPlugin(config) {
|
|
|
41268
41301
|
});
|
|
41269
41302
|
};
|
|
41270
41303
|
if (code.match(workerAssetUrlRE)) {
|
|
41271
|
-
const toRelativeRuntime = createToImportMetaURLBasedRelativeRuntime(outputOptions.format);
|
|
41304
|
+
const toRelativeRuntime = createToImportMetaURLBasedRelativeRuntime(outputOptions.format, config.isWorker);
|
|
41272
41305
|
let match;
|
|
41273
41306
|
s = new MagicString(code);
|
|
41274
41307
|
workerAssetUrlRE.lastIndex = 0;
|
|
@@ -41320,7 +41353,7 @@ function preAliasPlugin(config) {
|
|
|
41320
41353
|
id !== '@vite/client' &&
|
|
41321
41354
|
id !== '@vite/env') {
|
|
41322
41355
|
if (findPatterns.find((pattern) => matches(pattern, id))) {
|
|
41323
|
-
const optimizedId = await tryOptimizedResolve(depsOptimizer, id, importer);
|
|
41356
|
+
const optimizedId = await tryOptimizedResolve(depsOptimizer, id, importer, config.resolve.preserveSymlinks, config.packageCache);
|
|
41324
41357
|
if (optimizedId) {
|
|
41325
41358
|
return optimizedId; // aliased dep already optimized
|
|
41326
41359
|
}
|
|
@@ -42088,6 +42121,7 @@ async function resolvePlugins(config, prePlugins, normalPlugins, postPlugins) {
|
|
|
42088
42121
|
return [
|
|
42089
42122
|
isWatch ? ensureWatchPlugin() : null,
|
|
42090
42123
|
isBuild ? metadataPlugin() : null,
|
|
42124
|
+
watchPackageDataPlugin(config.packageCache),
|
|
42091
42125
|
preAliasPlugin(config),
|
|
42092
42126
|
alias$1({ entries: config.resolve.alias }),
|
|
42093
42127
|
...prePlugins,
|
|
@@ -45638,7 +45672,6 @@ async function resolveBuildPlugins(config) {
|
|
|
45638
45672
|
pre: [
|
|
45639
45673
|
completeSystemWrapPlugin(),
|
|
45640
45674
|
...(options.watch ? [ensureWatchPlugin()] : []),
|
|
45641
|
-
watchPackageDataPlugin(config),
|
|
45642
45675
|
...(usePluginCommonjs ? [commonjs(options.commonjsOptions)] : []),
|
|
45643
45676
|
dataURIPlugin(),
|
|
45644
45677
|
...(await asyncFlatten(Array.isArray(rollupOptionsPlugins)
|
|
@@ -45939,32 +45972,36 @@ const dynamicImportWarningIgnoreList = [
|
|
|
45939
45972
|
`statically analyzed`,
|
|
45940
45973
|
];
|
|
45941
45974
|
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);
|
|
45975
|
+
function viteWarn(warning) {
|
|
45976
|
+
if (warning.code === 'UNRESOLVED_IMPORT') {
|
|
45977
|
+
const id = warning.id;
|
|
45978
|
+
const exporter = warning.exporter;
|
|
45979
|
+
// throw unless it's commonjs external...
|
|
45980
|
+
if (!id || !/\?commonjs-external$/.test(id)) {
|
|
45981
|
+
throw new Error(`[vite]: Rollup failed to resolve import "${exporter}" from "${id}".\n` +
|
|
45982
|
+
`This is most likely unintended because it can break your application at runtime.\n` +
|
|
45983
|
+
`If you do want to externalize this module explicitly add it to\n` +
|
|
45984
|
+
`\`build.rollupOptions.external\``);
|
|
45985
|
+
}
|
|
45986
|
+
}
|
|
45987
|
+
if (warning.plugin === 'rollup-plugin-dynamic-import-variables' &&
|
|
45988
|
+
dynamicImportWarningIgnoreList.some((msg) => warning.message.includes(msg))) {
|
|
45989
|
+
return;
|
|
45961
45990
|
}
|
|
45962
|
-
|
|
45963
|
-
|
|
45991
|
+
if (!warningIgnoreList.includes(warning.code)) {
|
|
45992
|
+
return;
|
|
45964
45993
|
}
|
|
45965
|
-
|
|
45966
|
-
warn(warning);
|
|
45994
|
+
if (warning.code === 'PLUGIN_WARNING') {
|
|
45995
|
+
config.logger.warn(`${picocolorsExports.bold(picocolorsExports.yellow(`[plugin:${warning.plugin}]`))} ${picocolorsExports.yellow(warning.message)}`);
|
|
45967
45996
|
}
|
|
45997
|
+
warn(warning);
|
|
45998
|
+
}
|
|
45999
|
+
const userOnWarn = config.build.rollupOptions?.onwarn;
|
|
46000
|
+
if (userOnWarn) {
|
|
46001
|
+
userOnWarn(warning, viteWarn);
|
|
46002
|
+
}
|
|
46003
|
+
else {
|
|
46004
|
+
viteWarn(warning);
|
|
45968
46005
|
}
|
|
45969
46006
|
}
|
|
45970
46007
|
async function cjsSsrResolveExternal(config, user) {
|
|
@@ -46111,6 +46148,11 @@ const relativeUrlMechanisms = {
|
|
|
46111
46148
|
system: (relativePath) => getResolveUrl(`'${relativePath}', module.meta.url`),
|
|
46112
46149
|
umd: (relativePath) => `(typeof document === 'undefined' && typeof location === 'undefined' ? ${getFileUrlFromRelativePath(relativePath)} : ${getRelativeUrlFromDocument(relativePath, true)})`,
|
|
46113
46150
|
};
|
|
46151
|
+
/* end of copy */
|
|
46152
|
+
const customRelativeUrlMechanisms = {
|
|
46153
|
+
...relativeUrlMechanisms,
|
|
46154
|
+
'worker-iife': (relativePath) => getResolveUrl(`'${relativePath}', self.location.href`),
|
|
46155
|
+
};
|
|
46114
46156
|
function toOutputFilePathInJS(filename, type, hostId, hostType, config, toRelative) {
|
|
46115
46157
|
const { renderBuiltUrl } = config.experimental;
|
|
46116
46158
|
let relative = config.base === '' || config.base === './';
|
|
@@ -46138,8 +46180,9 @@ function toOutputFilePathInJS(filename, type, hostId, hostType, config, toRelati
|
|
|
46138
46180
|
}
|
|
46139
46181
|
return joinUrlSegments(config.base, filename);
|
|
46140
46182
|
}
|
|
46141
|
-
function createToImportMetaURLBasedRelativeRuntime(format) {
|
|
46142
|
-
const
|
|
46183
|
+
function createToImportMetaURLBasedRelativeRuntime(format, isWorker) {
|
|
46184
|
+
const formatLong = isWorker && format === 'iife' ? 'worker-iife' : format;
|
|
46185
|
+
const toRelativePath = customRelativeUrlMechanisms[formatLong];
|
|
46143
46186
|
return (filename, importer) => ({
|
|
46144
46187
|
runtime: toRelativePath(path$o.posix.relative(path$o.dirname(importer), filename)),
|
|
46145
46188
|
});
|
|
@@ -53170,6 +53213,10 @@ async function loadAndTransform(id, url, server, options, timestamp) {
|
|
|
53170
53213
|
const file = cleanUrl(id);
|
|
53171
53214
|
let code = null;
|
|
53172
53215
|
let map = null;
|
|
53216
|
+
// Ensure that the module is in the graph before it is loaded and the file is checked.
|
|
53217
|
+
// This prevents errors from occurring during the load process and interrupting the watching process at its inception.
|
|
53218
|
+
const mod = await moduleGraph.ensureEntryFromUrl(url, ssr);
|
|
53219
|
+
ensureWatchedFile(watcher, mod.file, root);
|
|
53173
53220
|
// load
|
|
53174
53221
|
const loadStart = debugLoad ? performance$1.now() : 0;
|
|
53175
53222
|
const loadResult = await pluginContainer.load(id, { ssr });
|
|
@@ -53234,9 +53281,6 @@ async function loadAndTransform(id, url, server, options, timestamp) {
|
|
|
53234
53281
|
err.code = isPublicFile ? ERR_LOAD_PUBLIC_URL : ERR_LOAD_URL;
|
|
53235
53282
|
throw err;
|
|
53236
53283
|
}
|
|
53237
|
-
// ensure module in graph after successful load
|
|
53238
|
-
const mod = await moduleGraph.ensureEntryFromUrl(url, ssr);
|
|
53239
|
-
ensureWatchedFile(watcher, mod.file, root);
|
|
53240
53284
|
// transform
|
|
53241
53285
|
const transformStart = debugTransform ? performance$1.now() : 0;
|
|
53242
53286
|
const transformResult = await pluginContainer.transform(code, id, {
|
|
@@ -61846,32 +61890,36 @@ class ModuleGraph {
|
|
|
61846
61890
|
if (mod) {
|
|
61847
61891
|
return mod;
|
|
61848
61892
|
}
|
|
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
|
-
|
|
61893
|
+
const modPromise = (async () => {
|
|
61894
|
+
const [url, resolvedId, meta] = await this._resolveUrl(rawUrl, ssr, resolved);
|
|
61895
|
+
mod = this.idToModuleMap.get(resolvedId);
|
|
61896
|
+
if (!mod) {
|
|
61897
|
+
mod = new ModuleNode(url, setIsSelfAccepting);
|
|
61898
|
+
if (meta)
|
|
61899
|
+
mod.meta = meta;
|
|
61900
|
+
this.urlToModuleMap.set(url, mod);
|
|
61901
|
+
mod.id = resolvedId;
|
|
61902
|
+
this.idToModuleMap.set(resolvedId, mod);
|
|
61903
|
+
const file = (mod.file = cleanUrl(resolvedId));
|
|
61904
|
+
let fileMappedModules = this.fileToModulesMap.get(file);
|
|
61905
|
+
if (!fileMappedModules) {
|
|
61906
|
+
fileMappedModules = new Set();
|
|
61907
|
+
this.fileToModulesMap.set(file, fileMappedModules);
|
|
61908
|
+
}
|
|
61909
|
+
fileMappedModules.add(mod);
|
|
61910
|
+
}
|
|
61911
|
+
// multiple urls can map to the same module and id, make sure we register
|
|
61912
|
+
// the url to the existing module in that case
|
|
61913
|
+
else if (!this.urlToModuleMap.has(url)) {
|
|
61914
|
+
this.urlToModuleMap.set(url, mod);
|
|
61915
|
+
}
|
|
61916
|
+
this._setUnresolvedUrlToModule(rawUrl, mod, ssr);
|
|
61917
|
+
return mod;
|
|
61918
|
+
})();
|
|
61871
61919
|
// Also register the clean url to the module, so that we can short-circuit
|
|
61872
61920
|
// resolving the same url twice
|
|
61873
|
-
this._setUnresolvedUrlToModule(rawUrl,
|
|
61874
|
-
return
|
|
61921
|
+
this._setUnresolvedUrlToModule(rawUrl, modPromise, ssr);
|
|
61922
|
+
return modPromise;
|
|
61875
61923
|
}
|
|
61876
61924
|
// some deps, like a css file referenced via @import, don't have its own
|
|
61877
61925
|
// url because they are inlined into the main css import. But they still
|
|
@@ -61901,7 +61949,7 @@ class ModuleGraph {
|
|
|
61901
61949
|
// the same module
|
|
61902
61950
|
async resolveUrl(url, ssr) {
|
|
61903
61951
|
url = removeImportQuery(removeTimestampQuery(url));
|
|
61904
|
-
const mod = this._getUnresolvedUrlToModule(url, ssr);
|
|
61952
|
+
const mod = await this._getUnresolvedUrlToModule(url, ssr);
|
|
61905
61953
|
if (mod?.id) {
|
|
61906
61954
|
return [mod.url, mod.id, mod.meta];
|
|
61907
61955
|
}
|
|
@@ -63254,14 +63302,6 @@ async function _createServer(inlineConfig = {}, options) {
|
|
|
63254
63302
|
process.stdin.on('end', exitProcess);
|
|
63255
63303
|
}
|
|
63256
63304
|
}
|
|
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
63305
|
const onHMRUpdate = async (file, configOnly) => {
|
|
63266
63306
|
if (serverConfig.hmr !== false) {
|
|
63267
63307
|
try {
|
|
@@ -63282,9 +63322,6 @@ async function _createServer(inlineConfig = {}, options) {
|
|
|
63282
63322
|
};
|
|
63283
63323
|
watcher.on('change', async (file) => {
|
|
63284
63324
|
file = normalizePath$3(file);
|
|
63285
|
-
if (file.endsWith('/package.json')) {
|
|
63286
|
-
return invalidatePackageData(packageCache, file);
|
|
63287
|
-
}
|
|
63288
63325
|
// invalidate module graph cache on file change
|
|
63289
63326
|
moduleGraph.onFileChange(file);
|
|
63290
63327
|
await onHMRUpdate(file, false);
|
|
@@ -63891,8 +63928,14 @@ async function resolveConfig(inlineConfig, command, defaultMode = 'development',
|
|
|
63891
63928
|
// resolve root
|
|
63892
63929
|
const resolvedRoot = normalizePath$3(config.root ? path$o.resolve(config.root) : process.cwd());
|
|
63893
63930
|
const clientAlias = [
|
|
63894
|
-
{
|
|
63895
|
-
|
|
63931
|
+
{
|
|
63932
|
+
find: /^\/?@vite\/env/,
|
|
63933
|
+
replacement: path$o.posix.join(FS_PREFIX, normalizePath$3(ENV_ENTRY)),
|
|
63934
|
+
},
|
|
63935
|
+
{
|
|
63936
|
+
find: /^\/?@vite\/client/,
|
|
63937
|
+
replacement: path$o.posix.join(FS_PREFIX, normalizePath$3(CLIENT_ENTRY)),
|
|
63938
|
+
},
|
|
63896
63939
|
];
|
|
63897
63940
|
// resolve alias with internal client alias
|
|
63898
63941
|
const resolvedAlias = normalizeAlias(mergeAlias(clientAlias, config.resolve?.alias || []));
|
|
@@ -63982,6 +64025,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = 'development',
|
|
|
63982
64025
|
preferRelative: false,
|
|
63983
64026
|
tryIndex: true,
|
|
63984
64027
|
...options,
|
|
64028
|
+
idOnly: true,
|
|
63985
64029
|
}),
|
|
63986
64030
|
],
|
|
63987
64031
|
}));
|
|
@@ -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-a36bfc56.js';
|
|
4
4
|
import require$$0$1 from 'path';
|
|
5
5
|
import require$$5 from 'crypto';
|
|
6
6
|
import require$$0$2 from 'util';
|
|
@@ -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 = (id) => id;
|
|
539
497
|
const loadContent = loadContent$1;
|
|
540
498
|
const processContent = processContent$1;
|
|
541
499
|
const parseStatements = parseStatements$1;
|
|
@@ -845,7 +803,7 @@ function AtImport(options) {
|
|
|
845
803
|
return Promise.all(
|
|
846
804
|
paths.map(file => {
|
|
847
805
|
return !path.isAbsolute(file)
|
|
848
|
-
? resolveId(file
|
|
806
|
+
? resolveId(file)
|
|
849
807
|
: file
|
|
850
808
|
})
|
|
851
809
|
)
|
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-a36bfc56.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-a36bfc56.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-a36bfc56.js').then(function (n) { return n.F; });
|
|
811
810
|
const buildOptions = cleanOptions(options);
|
|
812
811
|
try {
|
|
813
812
|
await build({
|
|
@@ -835,13 +834,14 @@ 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-a36bfc56.js').then(function (n) { return n.E; });
|
|
839
838
|
try {
|
|
840
839
|
const config = await resolveConfig({
|
|
841
840
|
root,
|
|
842
841
|
base: options.base,
|
|
843
842
|
configFile: options.config,
|
|
844
843
|
logLevel: options.logLevel,
|
|
844
|
+
mode: options.mode,
|
|
845
845
|
}, 'serve');
|
|
846
846
|
await optimizeDeps(config, options.force, true);
|
|
847
847
|
}
|
|
@@ -860,7 +860,7 @@ cli
|
|
|
860
860
|
.option('--outDir <dir>', `[string] output directory (default: dist)`)
|
|
861
861
|
.action(async (root, options) => {
|
|
862
862
|
filterDuplicateOptions(options);
|
|
863
|
-
const { preview } = await import('./chunks/dep-
|
|
863
|
+
const { preview } = await import('./chunks/dep-a36bfc56.js').then(function (n) { return n.H; });
|
|
864
864
|
try {
|
|
865
865
|
const server = await preview({
|
|
866
866
|
root,
|
package/dist/node/index.d.ts
CHANGED
|
@@ -1191,6 +1191,7 @@ export declare interface InternalResolveOptions extends Required<ResolveOptions>
|
|
|
1191
1191
|
ssrOptimizeCheck?: boolean;
|
|
1192
1192
|
getDepsOptimizer?: (ssr: boolean) => DepsOptimizer | undefined;
|
|
1193
1193
|
shouldExternalize?: (id: string) => boolean | undefined;
|
|
1194
|
+
/* Excluded from this release type: idOnly */
|
|
1194
1195
|
}
|
|
1195
1196
|
|
|
1196
1197
|
export { InvalidatePayload }
|
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-a36bfc56.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-a36bfc56.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.4",
|
|
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": {
|