vite 4.1.1 → 4.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.
Potentially problematic release.
This version of vite might be problematic. Click here for more details.
|
@@ -13307,7 +13307,7 @@ var TSConfckParseError = class extends Error {
|
|
|
13307
13307
|
|
|
13308
13308
|
const debug$f = createDebugger('vite:esbuild');
|
|
13309
13309
|
const INJECT_HELPERS_IIFE_RE = /^(.*?)((?:const|var)\s+\S+\s*=\s*function\s*\([^)]*\)\s*\{.*?"use strict";)/s;
|
|
13310
|
-
const INJECT_HELPERS_UMD_RE = /^(.*?)(\(function\([^)]*\)\s*\{
|
|
13310
|
+
const INJECT_HELPERS_UMD_RE = /^(.*?)(\(function\([^)]*\)\s*\{.+?amd.+?function\([^)]*\)\s*\{.*?"use strict";)/s;
|
|
13311
13311
|
let server;
|
|
13312
13312
|
async function transformWithEsbuild(code, filename, options, inMap) {
|
|
13313
13313
|
let loader = options?.loader;
|
|
@@ -21367,6 +21367,7 @@ function resolvePlugin(resolveOptions) {
|
|
|
21367
21367
|
}
|
|
21368
21368
|
const ensureVersionQuery = (resolved) => {
|
|
21369
21369
|
if (!options.isBuild &&
|
|
21370
|
+
!options.scan &&
|
|
21370
21371
|
depsOptimizer &&
|
|
21371
21372
|
!(resolved === normalizedClientEntry$1 ||
|
|
21372
21373
|
resolved === normalizedEnvEntry$1)) {
|
|
@@ -35230,12 +35231,13 @@ function stripLiteralAcorn(code) {
|
|
|
35230
35231
|
return result;
|
|
35231
35232
|
}
|
|
35232
35233
|
|
|
35233
|
-
const multilineCommentsRE =
|
|
35234
|
+
const multilineCommentsRE = /\/\*([^*\/])*?\*\//gms;
|
|
35234
35235
|
const singlelineCommentsRE = /(?:^|\n|\r)\s*\/\/.*(?:\r|\n|$)/gm;
|
|
35235
35236
|
const templateLiteralRE = /\$\{(\s*(?:(?!\$\{).|\n|\r)*?\s*)\}/g;
|
|
35236
35237
|
const quotesRE = [
|
|
35237
35238
|
/(["'`])((?:\\\1|(?!\1)|.|\r)*?)\1/gm,
|
|
35238
35239
|
/([`])((?:\\\1|(?!\1)|.|\n|\r)*?)\1/gm
|
|
35240
|
+
// multi-line strings (i.e. template literals only)
|
|
35239
35241
|
];
|
|
35240
35242
|
function stripLiteralRegex(code) {
|
|
35241
35243
|
code = code.replace(multilineCommentsRE, (s) => " ".repeat(s.length)).replace(singlelineCommentsRE, (s) => " ".repeat(s.length));
|
|
@@ -35308,15 +35310,15 @@ function polyfill() {
|
|
|
35308
35310
|
}
|
|
35309
35311
|
}
|
|
35310
35312
|
}).observe(document, { childList: true, subtree: true });
|
|
35311
|
-
function getFetchOpts(
|
|
35313
|
+
function getFetchOpts(link) {
|
|
35312
35314
|
const fetchOpts = {};
|
|
35313
|
-
if (
|
|
35314
|
-
fetchOpts.integrity =
|
|
35315
|
-
if (
|
|
35316
|
-
fetchOpts.referrerPolicy =
|
|
35317
|
-
if (
|
|
35315
|
+
if (link.integrity)
|
|
35316
|
+
fetchOpts.integrity = link.integrity;
|
|
35317
|
+
if (link.referrerPolicy)
|
|
35318
|
+
fetchOpts.referrerPolicy = link.referrerPolicy;
|
|
35319
|
+
if (link.crossOrigin === 'use-credentials')
|
|
35318
35320
|
fetchOpts.credentials = 'include';
|
|
35319
|
-
else if (
|
|
35321
|
+
else if (link.crossOrigin === 'anonymous')
|
|
35320
35322
|
fetchOpts.credentials = 'omit';
|
|
35321
35323
|
else
|
|
35322
35324
|
fetchOpts.credentials = 'same-origin';
|
|
@@ -35416,6 +35418,7 @@ async function traverseHtml(html, filePath, visitor) {
|
|
|
35416
35418
|
// lazy load compiler
|
|
35417
35419
|
const { parse } = await import('./dep-98d07f71.js');
|
|
35418
35420
|
const ast = parse(html, {
|
|
35421
|
+
scriptingEnabled: false,
|
|
35419
35422
|
sourceCodeLocationInfo: true,
|
|
35420
35423
|
onParseError: (e) => {
|
|
35421
35424
|
handleParseError(e, html, filePath);
|
|
@@ -35826,20 +35829,20 @@ function buildHtmlPlugin(config) {
|
|
|
35826
35829
|
assetTags = imports.map((chunk) => toScriptTag(chunk, toOutputAssetFilePath, isAsync));
|
|
35827
35830
|
}
|
|
35828
35831
|
else {
|
|
35832
|
+
assetTags = [toScriptTag(chunk, toOutputAssetFilePath, isAsync)];
|
|
35829
35833
|
const { modulePreload } = config.build;
|
|
35830
|
-
|
|
35831
|
-
modulePreload
|
|
35832
|
-
|
|
35833
|
-
|
|
35834
|
-
|
|
35835
|
-
|
|
35836
|
-
|
|
35837
|
-
|
|
35838
|
-
|
|
35839
|
-
|
|
35840
|
-
|
|
35841
|
-
|
|
35842
|
-
];
|
|
35834
|
+
if (modulePreload !== false) {
|
|
35835
|
+
const resolveDependencies = typeof modulePreload === 'object' &&
|
|
35836
|
+
modulePreload.resolveDependencies;
|
|
35837
|
+
const importsFileNames = imports.map((chunk) => chunk.fileName);
|
|
35838
|
+
const resolvedDeps = resolveDependencies
|
|
35839
|
+
? resolveDependencies(chunk.fileName, importsFileNames, {
|
|
35840
|
+
hostId: relativeUrlPath,
|
|
35841
|
+
hostType: 'html',
|
|
35842
|
+
})
|
|
35843
|
+
: importsFileNames;
|
|
35844
|
+
assetTags.push(...resolvedDeps.map((i) => toPreloadTag(i, toOutputAssetFilePath)));
|
|
35845
|
+
}
|
|
35843
35846
|
}
|
|
35844
35847
|
assetTags.push(...getCssTagsForChunk(chunk, toOutputAssetFilePath));
|
|
35845
35848
|
result = injectToHead(result, assetTags);
|
|
@@ -36371,13 +36374,18 @@ function cssPostPlugin(config) {
|
|
|
36371
36374
|
let isPureCssChunk = true;
|
|
36372
36375
|
const ids = Object.keys(chunk.modules);
|
|
36373
36376
|
for (const id of ids) {
|
|
36374
|
-
if (!isCSSRequest(id) ||
|
|
36375
|
-
cssModuleRE.test(id) ||
|
|
36376
|
-
commonjsProxyRE.test(id)) {
|
|
36377
|
-
isPureCssChunk = false;
|
|
36378
|
-
}
|
|
36379
36377
|
if (styles.has(id)) {
|
|
36380
36378
|
chunkCSS += styles.get(id);
|
|
36379
|
+
// a css module contains JS, so it makes this not a pure css chunk
|
|
36380
|
+
if (cssModuleRE.test(id)) {
|
|
36381
|
+
isPureCssChunk = false;
|
|
36382
|
+
}
|
|
36383
|
+
}
|
|
36384
|
+
else {
|
|
36385
|
+
// if the module does not have a style, then it's not a pure css chunk.
|
|
36386
|
+
// this is true because in the `transform` hook above, only modules
|
|
36387
|
+
// that are css gets added to the `styles` map.
|
|
36388
|
+
isPureCssChunk = false;
|
|
36381
36389
|
}
|
|
36382
36390
|
}
|
|
36383
36391
|
if (!chunkCSS) {
|
|
@@ -39454,7 +39462,12 @@ async function loadAndTransform(id, url, server, options, timestamp) {
|
|
|
39454
39462
|
`going through the plugin transforms, and therefore should not be ` +
|
|
39455
39463
|
`imported from source code. It can only be referenced via HTML tags.`
|
|
39456
39464
|
: `Does the file exist?`;
|
|
39457
|
-
const
|
|
39465
|
+
const importerMod = server.moduleGraph.idToModuleMap
|
|
39466
|
+
.get(id)
|
|
39467
|
+
?.importers.values()
|
|
39468
|
+
.next().value;
|
|
39469
|
+
const importer = importerMod?.file || importerMod?.url;
|
|
39470
|
+
const err = new Error(`Failed to load url ${url} (resolved id: ${id})${importer ? ` in ${importer}` : ''}. ${msg}`);
|
|
39458
39471
|
err.code = isPublicFile ? ERR_LOAD_PUBLIC_URL : ERR_LOAD_URL;
|
|
39459
39472
|
throw err;
|
|
39460
39473
|
}
|
|
@@ -39767,13 +39780,14 @@ function importAnalysisPlugin(config) {
|
|
|
39767
39780
|
const prop = source.slice(end, end + 4);
|
|
39768
39781
|
if (prop === '.hot') {
|
|
39769
39782
|
hasHMR = true;
|
|
39770
|
-
|
|
39783
|
+
const endHot = end + 4 + (source[end + 4] === '?' ? 1 : 0);
|
|
39784
|
+
if (source.slice(endHot, endHot + 7) === '.accept') {
|
|
39771
39785
|
// further analyze accepted modules
|
|
39772
|
-
if (source.slice(
|
|
39773
|
-
lexAcceptedHmrExports(source, source.indexOf('(',
|
|
39786
|
+
if (source.slice(endHot, endHot + 14) === '.acceptExports') {
|
|
39787
|
+
lexAcceptedHmrExports(source, source.indexOf('(', endHot + 14) + 1, acceptedExports);
|
|
39774
39788
|
isPartiallySelfAccepting = true;
|
|
39775
39789
|
}
|
|
39776
|
-
else if (lexAcceptedHmrDeps(source, source.indexOf('(',
|
|
39790
|
+
else if (lexAcceptedHmrDeps(source, source.indexOf('(', endHot + 7) + 1, acceptedUrls)) {
|
|
39777
39791
|
isSelfAccepting = true;
|
|
39778
39792
|
}
|
|
39779
39793
|
}
|
|
@@ -40362,6 +40376,7 @@ function getAliasPatterns(entries) {
|
|
|
40362
40376
|
}
|
|
40363
40377
|
|
|
40364
40378
|
const nonJsRe = /\.json(?:$|\?)/;
|
|
40379
|
+
const metaEnvRe = /import\.meta\.env\.(.+)/;
|
|
40365
40380
|
const isNonJsRequest = (request) => nonJsRe.test(request);
|
|
40366
40381
|
function definePlugin(config) {
|
|
40367
40382
|
const isBuild = config.command === 'build';
|
|
@@ -40383,20 +40398,23 @@ function definePlugin(config) {
|
|
|
40383
40398
|
__vite_process_env_NODE_ENV: JSON.stringify(nodeEnv),
|
|
40384
40399
|
});
|
|
40385
40400
|
}
|
|
40401
|
+
const env = { ...config.env };
|
|
40386
40402
|
const userDefine = {};
|
|
40387
40403
|
for (const key in config.define) {
|
|
40388
40404
|
const val = config.define[key];
|
|
40389
40405
|
userDefine[key] = typeof val === 'string' ? val : JSON.stringify(val);
|
|
40406
|
+
// make sure `import.meta.env` object has user define properties
|
|
40407
|
+
const match = key.match(metaEnvRe);
|
|
40408
|
+
if (match) {
|
|
40409
|
+
env[match[1]] = val;
|
|
40410
|
+
}
|
|
40390
40411
|
}
|
|
40391
40412
|
// during dev, import.meta properties are handled by importAnalysis plugin.
|
|
40392
40413
|
// ignore replace import.meta.env in lib build
|
|
40393
40414
|
const importMetaKeys = {};
|
|
40394
40415
|
const importMetaFallbackKeys = {};
|
|
40395
40416
|
if (isBuild) {
|
|
40396
|
-
|
|
40397
|
-
...config.env,
|
|
40398
|
-
SSR: !!config.build.ssr,
|
|
40399
|
-
};
|
|
40417
|
+
env.SSR = !!config.build.ssr;
|
|
40400
40418
|
// set here to allow override with config.define
|
|
40401
40419
|
importMetaKeys['import.meta.hot'] = `undefined`;
|
|
40402
40420
|
for (const key in env) {
|
|
@@ -40404,7 +40422,7 @@ function definePlugin(config) {
|
|
|
40404
40422
|
}
|
|
40405
40423
|
Object.assign(importMetaFallbackKeys, {
|
|
40406
40424
|
'import.meta.env.': `({}).`,
|
|
40407
|
-
'import.meta.env': JSON.stringify(
|
|
40425
|
+
'import.meta.env': JSON.stringify(env),
|
|
40408
40426
|
});
|
|
40409
40427
|
}
|
|
40410
40428
|
function generatePattern(ssr) {
|
|
@@ -41399,12 +41417,8 @@ async function createPluginContainer(config, moduleGraph, watcher) {
|
|
|
41399
41417
|
err.id = ctx._activeId;
|
|
41400
41418
|
if (ctx._activeCode) {
|
|
41401
41419
|
err.pluginCode = ctx._activeCode;
|
|
41402
|
-
|
|
41403
|
-
|
|
41404
|
-
: err.pos != null
|
|
41405
|
-
? err.pos
|
|
41406
|
-
: // some rollup plugins, e.g. json, sets position instead of pos
|
|
41407
|
-
err.position;
|
|
41420
|
+
// some rollup plugins, e.g. json, sets err.position instead of err.pos
|
|
41421
|
+
const pos = position ?? err.pos ?? err.position;
|
|
41408
41422
|
if (pos != null) {
|
|
41409
41423
|
let errLocation;
|
|
41410
41424
|
try {
|
|
@@ -42496,7 +42510,7 @@ async function createDepsOptimizer(config, server) {
|
|
|
42496
42510
|
id,
|
|
42497
42511
|
file: getOptimizedDepPath(id, config, ssr),
|
|
42498
42512
|
src: resolved,
|
|
42499
|
-
//
|
|
42513
|
+
// Adding a browserHash to this missing dependency that is unique to
|
|
42500
42514
|
// the current state of known + missing deps. If its optimizeDeps run
|
|
42501
42515
|
// doesn't alter the bundled files of previous known dependencies,
|
|
42502
42516
|
// we don't need a full reload and this browserHash will be kept
|
|
@@ -43491,7 +43505,7 @@ function buildImportAnalysisPlugin(config) {
|
|
|
43491
43505
|
// The importerUrl is passed as third parameter to __vitePreload in this case
|
|
43492
43506
|
`function(dep, importerUrl) { return new URL(dep, importerUrl).href }`
|
|
43493
43507
|
: // If the base isn't relative, then the deps are relative to the projects `outDir` and the base
|
|
43494
|
-
// is
|
|
43508
|
+
// is appended inside __vitePreload too.
|
|
43495
43509
|
`function(dep) { return ${JSON.stringify(config.base)}+dep }`;
|
|
43496
43510
|
const preloadCode = `const scriptRel = ${scriptRel};const assetsURL = ${assetsURL};const seen = {};export const ${preloadMethod} = ${preload.toString()}`;
|
|
43497
43511
|
return {
|
|
@@ -44259,6 +44273,10 @@ function _interpolate (envValue, environment, config) {
|
|
|
44259
44273
|
replacePart = parts[0];
|
|
44260
44274
|
value = replacePart.replace('\\$', '$');
|
|
44261
44275
|
} else {
|
|
44276
|
+
// PATCH: compatible with env variables ended with unescaped $
|
|
44277
|
+
if(!parts[2]) {
|
|
44278
|
+
return newEnv
|
|
44279
|
+
}
|
|
44262
44280
|
const keyParts = parts[2].split(':-');
|
|
44263
44281
|
const key = keyParts[0];
|
|
44264
44282
|
replacePart = parts[0].substring(prefix.length);
|
|
@@ -44335,18 +44353,9 @@ function loadEnv(mode, envDir, prefixes = 'VITE_') {
|
|
|
44335
44353
|
if (parsed.BROWSER_ARGS && process.env.BROWSER_ARGS === undefined) {
|
|
44336
44354
|
process.env.BROWSER_ARGS = parsed.BROWSER_ARGS;
|
|
44337
44355
|
}
|
|
44338
|
-
|
|
44339
|
-
|
|
44340
|
-
|
|
44341
|
-
}
|
|
44342
|
-
catch (e) {
|
|
44343
|
-
// custom error handling until https://github.com/motdotla/dotenv-expand/issues/65 is fixed upstream
|
|
44344
|
-
// check for message "TypeError: Cannot read properties of undefined (reading 'split')"
|
|
44345
|
-
if (e.message.includes('split')) {
|
|
44346
|
-
throw new Error('dotenv-expand failed to expand env vars. Maybe you need to escape `$`?');
|
|
44347
|
-
}
|
|
44348
|
-
throw e;
|
|
44349
|
-
}
|
|
44356
|
+
// let environment variables use each other
|
|
44357
|
+
// `expand` patched in patches/dotenv-expand@9.0.0.patch
|
|
44358
|
+
expand_1({ parsed });
|
|
44350
44359
|
// only keys that start with prefix are exposed to client
|
|
44351
44360
|
for (const [key, value] of Object.entries(parsed)) {
|
|
44352
44361
|
if (prefixes.some((prefix) => key.startsWith(prefix))) {
|
|
@@ -51811,7 +51820,7 @@ async function ssrTransformScript(code, inMap, url, originalCode) {
|
|
|
51811
51820
|
if (!err.loc || !err.loc.line)
|
|
51812
51821
|
throw err;
|
|
51813
51822
|
const line = err.loc.line;
|
|
51814
|
-
throw new Error(`Parse failure: ${err.message}\nContents of line ${line}: ${code.split('\n')[line - 1]}`);
|
|
51823
|
+
throw new Error(`Parse failure: ${err.message}\nAt file: ${url}\nContents of line ${line}: ${code.split('\n')[line - 1]}`);
|
|
51815
51824
|
}
|
|
51816
51825
|
let uid = 0;
|
|
51817
51826
|
const deps = new Set();
|
|
@@ -52244,13 +52253,13 @@ function ssrRewriteStacktrace(stack, moduleGraph) {
|
|
|
52244
52253
|
if (!pos.source || pos.line == null || pos.column == null) {
|
|
52245
52254
|
return input;
|
|
52246
52255
|
}
|
|
52247
|
-
const
|
|
52256
|
+
const trimmedVarName = varName.trim();
|
|
52248
52257
|
const source = `${pos.source}:${pos.line}:${pos.column}`;
|
|
52249
|
-
if (!
|
|
52258
|
+
if (!trimmedVarName || trimmedVarName === 'eval') {
|
|
52250
52259
|
return ` at ${source}`;
|
|
52251
52260
|
}
|
|
52252
52261
|
else {
|
|
52253
|
-
return ` at ${
|
|
52262
|
+
return ` at ${trimmedVarName} (${source})`;
|
|
52254
52263
|
}
|
|
52255
52264
|
});
|
|
52256
52265
|
})
|
|
@@ -58109,6 +58118,12 @@ function createWebSocketServer(server, config, httpsOptions) {
|
|
|
58109
58118
|
const client = getSocketClient(socket);
|
|
58110
58119
|
listeners.forEach((listener) => listener(parsed.data, client));
|
|
58111
58120
|
});
|
|
58121
|
+
socket.on('error', (err) => {
|
|
58122
|
+
config.logger.error(`${picocolorsExports.red(`ws error:`)}\n${err.stack}`, {
|
|
58123
|
+
timestamp: true,
|
|
58124
|
+
error: err,
|
|
58125
|
+
});
|
|
58126
|
+
});
|
|
58112
58127
|
socket.send(JSON.stringify({ type: 'connected' }));
|
|
58113
58128
|
if (bufferedError) {
|
|
58114
58129
|
socket.send(JSON.stringify(bufferedError));
|
|
@@ -61674,6 +61689,16 @@ function resolvePreviewOptions(preview, server) {
|
|
|
61674
61689
|
*/
|
|
61675
61690
|
async function preview(inlineConfig = {}) {
|
|
61676
61691
|
const config = await resolveConfig(inlineConfig, 'serve', 'production', 'production');
|
|
61692
|
+
const distDir = path$o.resolve(config.root, config.build.outDir);
|
|
61693
|
+
if (!fs$l.existsSync(distDir) &&
|
|
61694
|
+
// error if no plugins implement `configurePreviewServer`
|
|
61695
|
+
config.plugins.every((plugin) => !plugin.configurePreviewServer) &&
|
|
61696
|
+
// error if called in CLI only. programmatic usage could access `httpServer`
|
|
61697
|
+
// and affect file serving
|
|
61698
|
+
process.argv[1]?.endsWith(path$o.normalize('bin/vite.js')) &&
|
|
61699
|
+
process.argv[2] === 'preview') {
|
|
61700
|
+
throw new Error(`The directory "${config.build.outDir}" does not exist. Did you build your project?`);
|
|
61701
|
+
}
|
|
61677
61702
|
const app = connect();
|
|
61678
61703
|
const httpServer = await resolveHttpServer(config.preview, app, await resolveHttpsConfig(config.preview?.https));
|
|
61679
61704
|
setClientErrorHandler(httpServer, config.logger);
|
|
@@ -61695,7 +61720,6 @@ async function preview(inlineConfig = {}) {
|
|
|
61695
61720
|
app.use(compression());
|
|
61696
61721
|
const previewBase = config.base === './' || config.base === '' ? '/' : config.base;
|
|
61697
61722
|
// static assets
|
|
61698
|
-
const distDir = path$o.resolve(config.root, config.build.outDir);
|
|
61699
61723
|
const headers = config.preview.headers;
|
|
61700
61724
|
const assetServer = sirv(distDir, {
|
|
61701
61725
|
etag: true,
|
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 { A as picocolorsExports, B as bindShortcuts, w as createLogger, h as resolveConfig } from './chunks/dep-
|
|
5
|
+
import { A as picocolorsExports, B as bindShortcuts, w as createLogger, h as resolveConfig } from './chunks/dep-ae3fae1b.js';
|
|
6
6
|
import { VERSION } from './constants.js';
|
|
7
7
|
import 'node:url';
|
|
8
8
|
import 'node:module';
|
|
@@ -729,7 +729,7 @@ cli
|
|
|
729
729
|
filterDuplicateOptions(options);
|
|
730
730
|
// output structure is preserved even after bundling so require()
|
|
731
731
|
// is ok here
|
|
732
|
-
const { createServer } = await import('./chunks/dep-
|
|
732
|
+
const { createServer } = await import('./chunks/dep-ae3fae1b.js').then(function (n) { return n.E; });
|
|
733
733
|
try {
|
|
734
734
|
const server = await createServer({
|
|
735
735
|
root,
|
|
@@ -807,7 +807,7 @@ cli
|
|
|
807
807
|
.option('-w, --watch', `[boolean] rebuilds when modules have changed on disk`)
|
|
808
808
|
.action(async (root, options) => {
|
|
809
809
|
filterDuplicateOptions(options);
|
|
810
|
-
const { build } = await import('./chunks/dep-
|
|
810
|
+
const { build } = await import('./chunks/dep-ae3fae1b.js').then(function (n) { return n.D; });
|
|
811
811
|
const buildOptions = cleanOptions(options);
|
|
812
812
|
try {
|
|
813
813
|
await build({
|
|
@@ -835,7 +835,7 @@ cli
|
|
|
835
835
|
.option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
|
|
836
836
|
.action(async (root, options) => {
|
|
837
837
|
filterDuplicateOptions(options);
|
|
838
|
-
const { optimizeDeps } = await import('./chunks/dep-
|
|
838
|
+
const { optimizeDeps } = await import('./chunks/dep-ae3fae1b.js').then(function (n) { return n.C; });
|
|
839
839
|
try {
|
|
840
840
|
const config = await resolveConfig({
|
|
841
841
|
root,
|
|
@@ -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-ae3fae1b.js').then(function (n) { return n.F; });
|
|
864
864
|
try {
|
|
865
865
|
const server = await preview({
|
|
866
866
|
root,
|
package/dist/node/index.d.ts
CHANGED
|
@@ -143,6 +143,7 @@ export declare interface BuildOptions {
|
|
|
143
143
|
*
|
|
144
144
|
* For custom targets, see https://esbuild.github.io/api/#target and
|
|
145
145
|
* https://esbuild.github.io/content-types/#javascript for more details.
|
|
146
|
+
* @default 'modules'
|
|
146
147
|
*/
|
|
147
148
|
target?: 'modules' | EsbuildTransformOptions['target'] | false;
|
|
148
149
|
/**
|
|
@@ -190,6 +191,7 @@ export declare interface BuildOptions {
|
|
|
190
191
|
* a niche browser that comes with most modern JavaScript features
|
|
191
192
|
* but has poor CSS support, e.g. Android WeChat WebView, which
|
|
192
193
|
* doesn't support the #RGBA syntax.
|
|
194
|
+
* @default target
|
|
193
195
|
*/
|
|
194
196
|
cssTarget?: EsbuildTransformOptions['target'] | false;
|
|
195
197
|
/**
|
|
@@ -264,16 +266,19 @@ export declare interface BuildOptions {
|
|
|
264
266
|
* Build in library mode. The value should be the global name of the lib in
|
|
265
267
|
* UMD mode. This will produce esm + cjs + umd bundle formats with default
|
|
266
268
|
* configurations that are suitable for distributing libraries.
|
|
269
|
+
* @default false
|
|
267
270
|
*/
|
|
268
271
|
lib?: LibraryOptions | false;
|
|
269
272
|
/**
|
|
270
273
|
* Produce SSR oriented build. Note this requires specifying SSR entry via
|
|
271
274
|
* `rollupOptions.input`.
|
|
275
|
+
* @default false
|
|
272
276
|
*/
|
|
273
277
|
ssr?: boolean | string;
|
|
274
278
|
/**
|
|
275
279
|
* Generate SSR manifest for determining style links and asset preload
|
|
276
280
|
* directives in production.
|
|
281
|
+
* @default false
|
|
277
282
|
*/
|
|
278
283
|
ssrManifest?: boolean | string;
|
|
279
284
|
/**
|
|
@@ -285,6 +290,7 @@ export declare interface BuildOptions {
|
|
|
285
290
|
/**
|
|
286
291
|
* Set to false to disable reporting compressed chunk sizes.
|
|
287
292
|
* Can slightly improve build speed.
|
|
293
|
+
* @default true
|
|
288
294
|
*/
|
|
289
295
|
reportCompressedSize?: boolean;
|
|
290
296
|
/**
|
|
@@ -295,6 +301,7 @@ export declare interface BuildOptions {
|
|
|
295
301
|
/**
|
|
296
302
|
* Rollup watch options
|
|
297
303
|
* https://rollupjs.org/configuration-options/#watch
|
|
304
|
+
* @default null
|
|
298
305
|
*/
|
|
299
306
|
watch?: WatcherOptions | null;
|
|
300
307
|
}
|
|
@@ -1723,6 +1730,9 @@ export declare type ResolveModulePreloadDependenciesFn = (filename: string, deps
|
|
|
1723
1730
|
}) => string[];
|
|
1724
1731
|
|
|
1725
1732
|
export declare interface ResolveOptions {
|
|
1733
|
+
/**
|
|
1734
|
+
* @default ['module', 'jsnext:main', 'jsnext']
|
|
1735
|
+
*/
|
|
1726
1736
|
mainFields?: string[];
|
|
1727
1737
|
/**
|
|
1728
1738
|
* @deprecated In future, `mainFields` should be used instead.
|
|
@@ -1730,8 +1740,14 @@ export declare interface ResolveOptions {
|
|
|
1730
1740
|
*/
|
|
1731
1741
|
browserField?: boolean;
|
|
1732
1742
|
conditions?: string[];
|
|
1743
|
+
/**
|
|
1744
|
+
* @default ['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json']
|
|
1745
|
+
*/
|
|
1733
1746
|
extensions?: string[];
|
|
1734
1747
|
dedupe?: string[];
|
|
1748
|
+
/**
|
|
1749
|
+
* @default false
|
|
1750
|
+
*/
|
|
1735
1751
|
preserveSymlinks?: boolean;
|
|
1736
1752
|
}
|
|
1737
1753
|
|
|
@@ -2031,6 +2047,7 @@ export declare interface ServerOptions extends CommonServerOptions {
|
|
|
2031
2047
|
watch?: WatchOptions;
|
|
2032
2048
|
/**
|
|
2033
2049
|
* Create Vite dev server to be used as a middleware in an existing server
|
|
2050
|
+
* @default false
|
|
2034
2051
|
*/
|
|
2035
2052
|
middlewareMode?: boolean | 'html' | 'ssr';
|
|
2036
2053
|
/**
|
|
@@ -2086,7 +2103,7 @@ export declare interface SSROptions {
|
|
|
2086
2103
|
/**
|
|
2087
2104
|
* Define the target for the ssr build. The browser field in package.json
|
|
2088
2105
|
* is ignored for node but used if webworker is the target
|
|
2089
|
-
*
|
|
2106
|
+
* @default 'node'
|
|
2090
2107
|
*/
|
|
2091
2108
|
target?: SSRTarget;
|
|
2092
2109
|
/**
|
|
@@ -2095,6 +2112,7 @@ export declare interface SSROptions {
|
|
|
2095
2112
|
* left marked as experimental to give users more time to update to ESM. CJS builds requires
|
|
2096
2113
|
* complex externalization heuristics that aren't present in the ESM format.
|
|
2097
2114
|
* @experimental
|
|
2115
|
+
* @default 'esm'
|
|
2098
2116
|
*/
|
|
2099
2117
|
format?: SSRFormat;
|
|
2100
2118
|
/**
|
package/dist/node/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { b as build, e as buildErrorMessage, u as createFilter, w as createLogger, c as createServer, g as defineConfig, f as formatPostcssSourceMap, j as getDepOptimizationConfig, k as isDepsOptimizerEnabled, l as loadConfigFromFile, y as loadEnv, q as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, a as preprocessCSS, p as preview, i as resolveBaseUrl, h as resolveConfig, z as resolveEnvPrefix, d as resolvePackageData, r as resolvePackageEntry, x as searchForWorkspaceRoot, v as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-
|
|
1
|
+
export { b as build, e as buildErrorMessage, u as createFilter, w as createLogger, c as createServer, g as defineConfig, f as formatPostcssSourceMap, j as getDepOptimizationConfig, k as isDepsOptimizerEnabled, l as loadConfigFromFile, y as loadEnv, q as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, a as preprocessCSS, p as preview, i as resolveBaseUrl, h as resolveConfig, z as resolveEnvPrefix, d as resolvePackageData, r as resolvePackageEntry, x as searchForWorkspaceRoot, v as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-ae3fae1b.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';
|
|
@@ -4195,6 +4195,10 @@ function _interpolate (envValue, environment, config) {
|
|
|
4195
4195
|
replacePart = parts[0];
|
|
4196
4196
|
value = replacePart.replace('\\$', '$');
|
|
4197
4197
|
} else {
|
|
4198
|
+
// PATCH: compatible with env variables ended with unescaped $
|
|
4199
|
+
if(!parts[2]) {
|
|
4200
|
+
return newEnv
|
|
4201
|
+
}
|
|
4198
4202
|
const keyParts = parts[2].split(':-');
|
|
4199
4203
|
const key = keyParts[0];
|
|
4200
4204
|
replacePart = parts[0].substring(prefix.length);
|
|
@@ -4271,18 +4275,9 @@ function loadEnv(mode, envDir, prefixes = 'VITE_') {
|
|
|
4271
4275
|
if (parsed.BROWSER_ARGS && process.env.BROWSER_ARGS === undefined) {
|
|
4272
4276
|
process.env.BROWSER_ARGS = parsed.BROWSER_ARGS;
|
|
4273
4277
|
}
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
|
|
4277
|
-
}
|
|
4278
|
-
catch (e) {
|
|
4279
|
-
// custom error handling until https://github.com/motdotla/dotenv-expand/issues/65 is fixed upstream
|
|
4280
|
-
// check for message "TypeError: Cannot read properties of undefined (reading 'split')"
|
|
4281
|
-
if (e.message.includes('split')) {
|
|
4282
|
-
throw new Error('dotenv-expand failed to expand env vars. Maybe you need to escape `$`?');
|
|
4283
|
-
}
|
|
4284
|
-
throw e;
|
|
4285
|
-
}
|
|
4278
|
+
// let environment variables use each other
|
|
4279
|
+
// `expand` patched in patches/dotenv-expand@9.0.0.patch
|
|
4280
|
+
expand_1({ parsed });
|
|
4286
4281
|
// only keys that start with prefix are exposed to client
|
|
4287
4282
|
for (const [key, value] of Object.entries(parsed)) {
|
|
4288
4283
|
if (prefixes.some((prefix) => key.startsWith(prefix))) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Evan You",
|
|
@@ -125,7 +125,7 @@
|
|
|
125
125
|
"source-map-js": "^1.0.2",
|
|
126
126
|
"source-map-support": "^0.5.21",
|
|
127
127
|
"strip-ansi": "^7.0.1",
|
|
128
|
-
"strip-literal": "^0.
|
|
128
|
+
"strip-literal": "^1.0.1",
|
|
129
129
|
"tsconfck": "^2.0.2",
|
|
130
130
|
"tslib": "^2.5.0",
|
|
131
131
|
"types": "link:./types",
|