vite 3.1.2 → 3.1.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.
- package/dist/node/chunks/{dep-b9b42dbd.js → dep-0fc42251.js} +1 -1
- package/dist/node/chunks/{dep-cff57044.js → dep-557f29e6.js} +50 -26
- package/dist/node/cli.js +5 -5
- package/dist/node/constants.js +1 -1
- package/dist/node/index.js +1 -1
- package/dist/node-cjs/publicUtils.cjs +1 -1
- package/package.json +1 -1
|
@@ -22,7 +22,7 @@ import { createHash as createHash$2 } from 'node:crypto';
|
|
|
22
22
|
import { promisify as promisify$4 } from 'node:util';
|
|
23
23
|
import { promises } from 'node:dns';
|
|
24
24
|
import resolve$5 from 'resolve';
|
|
25
|
-
import { CLIENT_ENTRY, OPTIMIZABLE_ENTRY_RE, DEFAULT_EXTENSIONS as DEFAULT_EXTENSIONS$1, wildcardHosts, loopbackHosts, VALID_ID_PREFIX, FS_PREFIX, CLIENT_PUBLIC_PATH, ENV_PUBLIC_PATH, ENV_ENTRY, DEFAULT_MAIN_FIELDS, DEP_VERSION_RE, SPECIAL_QUERY_RE, KNOWN_ASSET_TYPES, CLIENT_DIR,
|
|
25
|
+
import { CLIENT_ENTRY, OPTIMIZABLE_ENTRY_RE, DEFAULT_EXTENSIONS as DEFAULT_EXTENSIONS$1, wildcardHosts, loopbackHosts, VALID_ID_PREFIX, NULL_BYTE_PLACEHOLDER, FS_PREFIX, CLIENT_PUBLIC_PATH, ENV_PUBLIC_PATH, ENV_ENTRY, DEFAULT_MAIN_FIELDS, DEP_VERSION_RE, SPECIAL_QUERY_RE, KNOWN_ASSET_TYPES, CLIENT_DIR, JS_TYPES_RE, ESBUILD_MODULES_TARGET, VERSION, VITE_PACKAGE_DIR, DEFAULT_ASSETS_RE, DEFAULT_CONFIG_FILES } from '../constants.js';
|
|
26
26
|
import require$$5 from 'crypto';
|
|
27
27
|
import require$$0$a from 'buffer';
|
|
28
28
|
import { Buffer as Buffer$1 } from 'node:buffer';
|
|
@@ -7569,7 +7569,7 @@ function normalize (path) {
|
|
|
7569
7569
|
}
|
|
7570
7570
|
|
|
7571
7571
|
const isWrappedId = (id, suffix) => id.endsWith(suffix);
|
|
7572
|
-
const wrapId = (id, suffix) => `\0${id}${suffix}`;
|
|
7572
|
+
const wrapId$1 = (id, suffix) => `\0${id}${suffix}`;
|
|
7573
7573
|
const unwrapId$1 = (wrappedId, suffix) => wrappedId.slice(1, -suffix.length);
|
|
7574
7574
|
|
|
7575
7575
|
const PROXY_SUFFIX = '?commonjs-proxy';
|
|
@@ -7848,7 +7848,7 @@ function getResolveId(extensions, isPossibleCjsId) {
|
|
|
7848
7848
|
return resolved.id + ENTRY_SUFFIX;
|
|
7849
7849
|
}
|
|
7850
7850
|
if (isCommonJS === IS_WRAPPED_COMMONJS) {
|
|
7851
|
-
return { id: wrapId(resolved.id, ES_IMPORT_SUFFIX), meta: { commonjs: { resolved } } };
|
|
7851
|
+
return { id: wrapId$1(resolved.id, ES_IMPORT_SUFFIX), meta: { commonjs: { resolved } } };
|
|
7852
7852
|
}
|
|
7853
7853
|
}
|
|
7854
7854
|
}
|
|
@@ -8024,11 +8024,11 @@ function getRequireResolver(extensions, detectCyclesAndConditional, currentlyRes
|
|
|
8024
8024
|
})) || resolveExtensions(source, parentId, extensions);
|
|
8025
8025
|
currentlyResolvingForParent.delete(source);
|
|
8026
8026
|
if (!resolved) {
|
|
8027
|
-
return { id: wrapId(source, EXTERNAL_SUFFIX), allowProxy: false };
|
|
8027
|
+
return { id: wrapId$1(source, EXTERNAL_SUFFIX), allowProxy: false };
|
|
8028
8028
|
}
|
|
8029
8029
|
const childId = resolved.id;
|
|
8030
8030
|
if (resolved.external) {
|
|
8031
|
-
return { id: wrapId(childId, EXTERNAL_SUFFIX), allowProxy: false };
|
|
8031
|
+
return { id: wrapId$1(childId, EXTERNAL_SUFFIX), allowProxy: false };
|
|
8032
8032
|
}
|
|
8033
8033
|
parentMeta.requires.push({ resolved, isConditional });
|
|
8034
8034
|
await analyzeRequiredModule(parentId, resolved, isConditional, rollupContext.load);
|
|
@@ -8047,8 +8047,8 @@ function getRequireResolver(extensions, detectCyclesAndConditional, currentlyRes
|
|
|
8047
8047
|
source: sources[index].source,
|
|
8048
8048
|
id: allowProxy
|
|
8049
8049
|
? isCommonJS === IS_WRAPPED_COMMONJS
|
|
8050
|
-
? wrapId(dependencyId, WRAPPED_SUFFIX)
|
|
8051
|
-
: wrapId(dependencyId, PROXY_SUFFIX)
|
|
8050
|
+
? wrapId$1(dependencyId, WRAPPED_SUFFIX)
|
|
8051
|
+
: wrapId$1(dependencyId, PROXY_SUFFIX)
|
|
8052
8052
|
: dependencyId,
|
|
8053
8053
|
isCommonJS
|
|
8054
8054
|
};
|
|
@@ -8549,12 +8549,12 @@ function getRequireHandlers() {
|
|
|
8549
8549
|
if (exportMode === 'module') {
|
|
8550
8550
|
imports.push(
|
|
8551
8551
|
`import { __module as ${moduleName}, exports as ${exportsName} } from ${JSON.stringify(
|
|
8552
|
-
wrapId(id, MODULE_SUFFIX)
|
|
8552
|
+
wrapId$1(id, MODULE_SUFFIX)
|
|
8553
8553
|
)}`
|
|
8554
8554
|
);
|
|
8555
8555
|
} else if (exportMode === 'exports') {
|
|
8556
8556
|
imports.push(
|
|
8557
|
-
`import { __exports as ${exportsName} } from ${JSON.stringify(wrapId(id, EXPORTS_SUFFIX))}`
|
|
8557
|
+
`import { __exports as ${exportsName} } from ${JSON.stringify(wrapId$1(id, EXPORTS_SUFFIX))}`
|
|
8558
8558
|
);
|
|
8559
8559
|
}
|
|
8560
8560
|
const requiresBySource = collectSources(requireExpressions);
|
|
@@ -11623,10 +11623,23 @@ const createFilter = createFilter$1;
|
|
|
11623
11623
|
function slash$1(p) {
|
|
11624
11624
|
return p.replace(/\\/g, '/');
|
|
11625
11625
|
}
|
|
11626
|
-
|
|
11627
|
-
|
|
11626
|
+
/**
|
|
11627
|
+
* Prepend `/@id/` and replace null byte so the id is URL-safe.
|
|
11628
|
+
* This is prepended to resolved ids that are not valid browser
|
|
11629
|
+
* import specifiers by the importAnalysis plugin.
|
|
11630
|
+
*/
|
|
11631
|
+
function wrapId(id) {
|
|
11632
|
+
return id.startsWith(VALID_ID_PREFIX)
|
|
11633
|
+
? id
|
|
11634
|
+
: VALID_ID_PREFIX + id.replace('\0', NULL_BYTE_PLACEHOLDER);
|
|
11635
|
+
}
|
|
11636
|
+
/**
|
|
11637
|
+
* Undo {@link wrapId}'s `/@id/` and null byte replacements.
|
|
11638
|
+
*/
|
|
11628
11639
|
function unwrapId(id) {
|
|
11629
|
-
return id.startsWith(VALID_ID_PREFIX)
|
|
11640
|
+
return id.startsWith(VALID_ID_PREFIX)
|
|
11641
|
+
? id.slice(VALID_ID_PREFIX.length).replace(NULL_BYTE_PLACEHOLDER, '\0')
|
|
11642
|
+
: id;
|
|
11630
11643
|
}
|
|
11631
11644
|
const flattenId = (id) => id
|
|
11632
11645
|
.replace(/[\/:]/g, '_')
|
|
@@ -37596,8 +37609,7 @@ function importAnalysisPlugin(config) {
|
|
|
37596
37609
|
// prefix it to make it valid. We will strip this before feeding it
|
|
37597
37610
|
// back into the transform pipeline
|
|
37598
37611
|
if (!url.startsWith('.') && !url.startsWith('/')) {
|
|
37599
|
-
url =
|
|
37600
|
-
VALID_ID_PREFIX + resolved.id.replace('\0', NULL_BYTE_PLACEHOLDER);
|
|
37612
|
+
url = wrapId(resolved.id);
|
|
37601
37613
|
}
|
|
37602
37614
|
// make the URL browser-valid if not SSR
|
|
37603
37615
|
if (!ssr) {
|
|
@@ -37621,7 +37633,7 @@ function importAnalysisPlugin(config) {
|
|
|
37621
37633
|
// up-to-date version of this module.
|
|
37622
37634
|
try {
|
|
37623
37635
|
// delay setting `isSelfAccepting` until the file is actually used (#7870)
|
|
37624
|
-
const depModule = await moduleGraph.ensureEntryFromUrl(url, ssr, canSkipImportAnalysis(url));
|
|
37636
|
+
const depModule = await moduleGraph.ensureEntryFromUrl(unwrapId(url), ssr, canSkipImportAnalysis(url));
|
|
37625
37637
|
if (depModule.lastHMRTimestamp > 0) {
|
|
37626
37638
|
url = injectQuery(url, `t=${depModule.lastHMRTimestamp}`);
|
|
37627
37639
|
}
|
|
@@ -37749,15 +37761,15 @@ function importAnalysisPlugin(config) {
|
|
|
37749
37761
|
}
|
|
37750
37762
|
}
|
|
37751
37763
|
// record for HMR import chain analysis
|
|
37752
|
-
// make sure to normalize away base
|
|
37753
|
-
const
|
|
37754
|
-
importedUrls.add(
|
|
37764
|
+
// make sure to unwrap and normalize away base
|
|
37765
|
+
const hmrUrl = unwrapId(url.replace(base, '/'));
|
|
37766
|
+
importedUrls.add(hmrUrl);
|
|
37755
37767
|
if (enablePartialAccept && importedBindings) {
|
|
37756
37768
|
extractImportedBindings(resolvedId, source, imports[index], importedBindings);
|
|
37757
37769
|
}
|
|
37758
37770
|
if (!isDynamicImport) {
|
|
37759
37771
|
// for pre-transforming
|
|
37760
|
-
staticImportedUrls.add({ url:
|
|
37772
|
+
staticImportedUrls.add({ url: hmrUrl, id: resolvedId });
|
|
37761
37773
|
}
|
|
37762
37774
|
}
|
|
37763
37775
|
else if (!importer.startsWith(clientDir)) {
|
|
@@ -37864,7 +37876,7 @@ function importAnalysisPlugin(config) {
|
|
|
37864
37876
|
// by the deps optimizer
|
|
37865
37877
|
if (config.server.preTransformRequests && staticImportedUrls.size) {
|
|
37866
37878
|
staticImportedUrls.forEach(({ url, id }) => {
|
|
37867
|
-
url =
|
|
37879
|
+
url = removeImportQuery(url);
|
|
37868
37880
|
transformRequest(url, server, { ssr }).catch((e) => {
|
|
37869
37881
|
if (e?.code === ERR_OUTDATED_OPTIMIZED_DEP) {
|
|
37870
37882
|
// This are expected errors
|
|
@@ -42582,8 +42594,20 @@ function stringifyDepsOptimizerMetadata(metadata, depsCacheDir) {
|
|
|
42582
42594
|
}, 2);
|
|
42583
42595
|
}
|
|
42584
42596
|
function esbuildOutputFromId(outputs, id, cacheDirOutputPath) {
|
|
42597
|
+
const cwd = process.cwd();
|
|
42585
42598
|
const flatId = flattenId(id) + '.js';
|
|
42586
|
-
|
|
42599
|
+
const normalizedOutputPath = normalizePath$3(path$n.relative(cwd, path$n.join(cacheDirOutputPath, flatId)));
|
|
42600
|
+
const output = outputs[normalizedOutputPath];
|
|
42601
|
+
if (output) {
|
|
42602
|
+
return output;
|
|
42603
|
+
}
|
|
42604
|
+
// If the root dir was symlinked, esbuild could return output keys as `../cwd/`
|
|
42605
|
+
// Normalize keys to support this case too
|
|
42606
|
+
for (const [key, value] of Object.entries(outputs)) {
|
|
42607
|
+
if (normalizePath$3(path$n.relative(cwd, key)) === normalizedOutputPath) {
|
|
42608
|
+
return value;
|
|
42609
|
+
}
|
|
42610
|
+
}
|
|
42587
42611
|
}
|
|
42588
42612
|
async function extractExportsData(filePath, config, ssr) {
|
|
42589
42613
|
await init;
|
|
@@ -44487,7 +44511,7 @@ async function compileCSS(id, code, config, urlReplacer, atImportResolvers, serv
|
|
|
44487
44511
|
logger: config.logger
|
|
44488
44512
|
}));
|
|
44489
44513
|
if (isModule) {
|
|
44490
|
-
postcssPlugins.unshift((await import('./dep-
|
|
44514
|
+
postcssPlugins.unshift((await import('./dep-0fc42251.js').then(function (n) { return n.i; })).default({
|
|
44491
44515
|
...modulesOptions,
|
|
44492
44516
|
getJSON(cssFileName, _modules, outputFileName) {
|
|
44493
44517
|
modules = _modules;
|
|
@@ -45644,7 +45668,7 @@ async function doBuild(inlineConfig = {}) {
|
|
|
45644
45668
|
config.logger.info(picocolors.exports.cyan(`vite v${VERSION} ${picocolors.exports.green(`building ${ssr ? `SSR bundle ` : ``}for ${config.mode}...`)}`));
|
|
45645
45669
|
const resolve = (p) => path$n.resolve(config.root, p);
|
|
45646
45670
|
const input = libOptions
|
|
45647
|
-
? resolve(libOptions.entry)
|
|
45671
|
+
? options.rollupOptions?.input || resolve(libOptions.entry)
|
|
45648
45672
|
: typeof options.ssr === 'string'
|
|
45649
45673
|
? resolve(options.ssr)
|
|
45650
45674
|
: options.rollupOptions?.input || resolve('index.html');
|
|
@@ -53276,7 +53300,7 @@ function rebindErrorStacktrace(e, stacktrace) {
|
|
|
53276
53300
|
const pendingModules = new Map();
|
|
53277
53301
|
const pendingImports = new Map();
|
|
53278
53302
|
async function ssrLoadModule(url, server, context = { global }, urlStack = [], fixStacktrace) {
|
|
53279
|
-
url = unwrapId(url)
|
|
53303
|
+
url = unwrapId(url);
|
|
53280
53304
|
// when we instantiate multiple dependency modules in parallel, they may
|
|
53281
53305
|
// point to shared modules. We need to avoid duplicate instantiation attempts
|
|
53282
53306
|
// by register every module as pending synchronously so that all subsequent
|
|
@@ -53346,7 +53370,7 @@ async function instantiateModule(url, server, context = { global }, urlStack = [
|
|
|
53346
53370
|
return nodeImport(dep, mod.file, resolveOptions);
|
|
53347
53371
|
}
|
|
53348
53372
|
// convert to rollup URL because `pendingImports`, `moduleGraph.urlToModuleMap` requires that
|
|
53349
|
-
dep = unwrapId(dep)
|
|
53373
|
+
dep = unwrapId(dep);
|
|
53350
53374
|
if (!isCircular(dep) && !pendingImports.get(dep)?.some(isCircular)) {
|
|
53351
53375
|
pendingDeps.push(dep);
|
|
53352
53376
|
if (pendingDeps.length === 1) {
|
|
@@ -60557,7 +60581,7 @@ const devHtmlHook = async (html, { path: htmlPath, filename, server, originalUrl
|
|
|
60557
60581
|
// and ids are properly handled
|
|
60558
60582
|
const validPath = `${htmlPath}${trailingSlash ? 'index.html' : ''}`;
|
|
60559
60583
|
proxyModulePath = `\0${validPath}`;
|
|
60560
|
-
proxyModuleUrl =
|
|
60584
|
+
proxyModuleUrl = wrapId(proxyModulePath);
|
|
60561
60585
|
}
|
|
60562
60586
|
const s = new MagicString(html);
|
|
60563
60587
|
let inlineModuleIndex = -1;
|
package/dist/node/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { performance } from 'node:perf_hooks';
|
|
2
2
|
import { EventEmitter } from 'events';
|
|
3
|
-
import { y as picocolors, u as createLogger, e as resolveConfig } from './chunks/dep-
|
|
3
|
+
import { y as picocolors, u as createLogger, e as resolveConfig } from './chunks/dep-557f29e6.js';
|
|
4
4
|
import { VERSION } from './constants.js';
|
|
5
5
|
import 'node:fs';
|
|
6
6
|
import 'node:path';
|
|
@@ -695,7 +695,7 @@ cli
|
|
|
695
695
|
.action(async (root, options) => {
|
|
696
696
|
// output structure is preserved even after bundling so require()
|
|
697
697
|
// is ok here
|
|
698
|
-
const { createServer } = await import('./chunks/dep-
|
|
698
|
+
const { createServer } = await import('./chunks/dep-557f29e6.js').then(function (n) { return n.C; });
|
|
699
699
|
try {
|
|
700
700
|
const server = await createServer({
|
|
701
701
|
root,
|
|
@@ -742,7 +742,7 @@ cli
|
|
|
742
742
|
.option('--emptyOutDir', `[boolean] force empty outDir when it's outside of root`)
|
|
743
743
|
.option('-w, --watch', `[boolean] rebuilds when modules have changed on disk`)
|
|
744
744
|
.action(async (root, options) => {
|
|
745
|
-
const { build } = await import('./chunks/dep-
|
|
745
|
+
const { build } = await import('./chunks/dep-557f29e6.js').then(function (n) { return n.B; });
|
|
746
746
|
const buildOptions = cleanOptions(options);
|
|
747
747
|
try {
|
|
748
748
|
await build({
|
|
@@ -766,7 +766,7 @@ cli
|
|
|
766
766
|
.command('optimize [root]', 'pre-bundle dependencies')
|
|
767
767
|
.option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
|
|
768
768
|
.action(async (root, options) => {
|
|
769
|
-
const { optimizeDeps } = await import('./chunks/dep-
|
|
769
|
+
const { optimizeDeps } = await import('./chunks/dep-557f29e6.js').then(function (n) { return n.A; });
|
|
770
770
|
try {
|
|
771
771
|
const config = await resolveConfig({
|
|
772
772
|
root,
|
|
@@ -789,7 +789,7 @@ cli
|
|
|
789
789
|
.option('--https', `[boolean] use TLS + HTTP/2`)
|
|
790
790
|
.option('--open [path]', `[boolean | string] open browser on startup`)
|
|
791
791
|
.action(async (root, options) => {
|
|
792
|
-
const { preview } = await import('./chunks/dep-
|
|
792
|
+
const { preview } = await import('./chunks/dep-557f29e6.js').then(function (n) { return n.D; });
|
|
793
793
|
try {
|
|
794
794
|
const server = await preview({
|
|
795
795
|
root,
|
package/dist/node/constants.js
CHANGED
package/dist/node/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { b as build, k as createFilter, u as createLogger, c as createServer, d as defineConfig, f as formatPostcssSourceMap, h as getDepOptimizationConfig, i as isDepsOptimizerEnabled, l as loadConfigFromFile, w as loadEnv, j as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, p as preview, g as resolveBaseUrl, e as resolveConfig, x as resolveEnvPrefix, a as resolvePackageData, r as resolvePackageEntry, v as searchForWorkspaceRoot, q as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-
|
|
1
|
+
export { b as build, k as createFilter, u as createLogger, c as createServer, d as defineConfig, f as formatPostcssSourceMap, h as getDepOptimizationConfig, i as isDepsOptimizerEnabled, l as loadConfigFromFile, w as loadEnv, j as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, p as preview, g as resolveBaseUrl, e as resolveConfig, x as resolveEnvPrefix, a as resolvePackageData, r as resolvePackageEntry, v as searchForWorkspaceRoot, q as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-557f29e6.js';
|
|
2
2
|
export { VERSION as version } from './constants.js';
|
|
3
3
|
export { version as esbuildVersion } from 'esbuild';
|
|
4
4
|
export { VERSION as rollupVersion } from 'rollup';
|
|
@@ -31,7 +31,7 @@ var require$$1__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$1$1);
|
|
|
31
31
|
var readline__default = /*#__PURE__*/_interopDefaultLegacy(readline);
|
|
32
32
|
var require$$2__default = /*#__PURE__*/_interopDefaultLegacy(require$$2);
|
|
33
33
|
|
|
34
|
-
var version = "3.1.
|
|
34
|
+
var version = "3.1.3";
|
|
35
35
|
|
|
36
36
|
const VERSION = version;
|
|
37
37
|
const VITE_PACKAGE_DIR = path$3.resolve(
|