vite 5.1.1 → 5.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-XbJJvsnO.js → dep-PB-S7R_m.js} +1 -1
- package/dist/node/chunks/{dep-xESY8DUV.js → dep-ZEDYRkoC.js} +1 -1
- package/dist/node/chunks/{dep-94_H5fT6.js → dep-stQc5rCc.js} +121 -113
- package/dist/node/cli.js +5 -5
- package/dist/node/index.js +2 -2
- package/dist/node/runtime.js +11 -8
- package/dist/node-cjs/publicUtils.cjs +69 -69
- package/package.json +3 -3
@@ -1,4 +1,4 @@
|
|
1
|
-
import { C as commonjsGlobal, B as getDefaultExportFromCjs } from './dep-
|
1
|
+
import { C as commonjsGlobal, B as getDefaultExportFromCjs } from './dep-stQc5rCc.js';
|
2
2
|
import require$$0__default from 'fs';
|
3
3
|
import require$$0 from 'postcss';
|
4
4
|
import require$$0$1 from 'path';
|
@@ -13077,6 +13077,21 @@ function sortObjectKeys(obj) {
|
|
13077
13077
|
}
|
13078
13078
|
return sorted;
|
13079
13079
|
}
|
13080
|
+
function displayTime(time) {
|
13081
|
+
// display: {X}ms
|
13082
|
+
if (time < 1000) {
|
13083
|
+
return `${time}ms`;
|
13084
|
+
}
|
13085
|
+
time = time / 1000;
|
13086
|
+
// display: {X}s
|
13087
|
+
if (time < 60) {
|
13088
|
+
return `${time.toFixed(2)}s`;
|
13089
|
+
}
|
13090
|
+
const mins = parseInt((time / 60).toString());
|
13091
|
+
const seconds = time % 60;
|
13092
|
+
// display: {X}m {Y}s
|
13093
|
+
return `${mins}m${seconds < 1 ? '' : ` ${seconds.toFixed(0)}s`}`;
|
13094
|
+
}
|
13080
13095
|
|
13081
13096
|
/* eslint no-console: 0 */
|
13082
13097
|
const LogLevels = {
|
@@ -13226,8 +13241,6 @@ function buildReporterPlugin(config) {
|
|
13226
13241
|
let transformedCount = 0;
|
13227
13242
|
let chunkCount = 0;
|
13228
13243
|
let compressedCount = 0;
|
13229
|
-
let startTime = Date.now();
|
13230
|
-
let buildFailed = false;
|
13231
13244
|
async function getCompressedSize(code) {
|
13232
13245
|
if (config.build.ssr || !config.build.reportCompressedSize) {
|
13233
13246
|
return null;
|
@@ -13270,14 +13283,10 @@ function buildReporterPlugin(config) {
|
|
13270
13283
|
}
|
13271
13284
|
return null;
|
13272
13285
|
},
|
13273
|
-
options() {
|
13274
|
-
startTime = Date.now();
|
13275
|
-
},
|
13276
13286
|
buildStart() {
|
13277
13287
|
transformedCount = 0;
|
13278
13288
|
},
|
13279
|
-
buildEnd(
|
13280
|
-
buildFailed = !!error;
|
13289
|
+
buildEnd() {
|
13281
13290
|
if (shouldLogInfo) {
|
13282
13291
|
if (tty) {
|
13283
13292
|
clearLine$1();
|
@@ -13424,11 +13433,6 @@ function buildReporterPlugin(config) {
|
|
13424
13433
|
`- Adjust chunk size limit for this warning via build.chunkSizeWarningLimit.`));
|
13425
13434
|
}
|
13426
13435
|
},
|
13427
|
-
closeBundle() {
|
13428
|
-
if (shouldLogInfo && !config.build.watch && !buildFailed) {
|
13429
|
-
config.logger.info(`${colors$1.green(`✓ built in ${displayTime(Date.now() - startTime)}`)}`);
|
13430
|
-
}
|
13431
|
-
},
|
13432
13436
|
};
|
13433
13437
|
}
|
13434
13438
|
function writeLine(output) {
|
@@ -13455,21 +13459,6 @@ function throttle(fn) {
|
|
13455
13459
|
}, 100);
|
13456
13460
|
};
|
13457
13461
|
}
|
13458
|
-
function displayTime(time) {
|
13459
|
-
// display: {X}ms
|
13460
|
-
if (time < 1000) {
|
13461
|
-
return `${time}ms`;
|
13462
|
-
}
|
13463
|
-
time = time / 1000;
|
13464
|
-
// display: {X}s
|
13465
|
-
if (time < 60) {
|
13466
|
-
return `${time.toFixed(2)}s`;
|
13467
|
-
}
|
13468
|
-
const mins = parseInt((time / 60).toString());
|
13469
|
-
const seconds = time % 60;
|
13470
|
-
// display: {X}m {Y}s
|
13471
|
-
return `${mins}m${seconds < 1 ? '' : ` ${seconds.toFixed(0)}s`}`;
|
13472
|
-
}
|
13473
13462
|
|
13474
13463
|
const POSIX_SEP_RE = new RegExp('\\' + path$o.posix.sep, 'g');
|
13475
13464
|
const NATIVE_SEP_RE = new RegExp('\\' + path$o.sep, 'g');
|
@@ -29603,7 +29592,7 @@ function stripLiteralDetailed(code, options) {
|
|
29603
29592
|
var main$1 = {exports: {}};
|
29604
29593
|
|
29605
29594
|
var name = "dotenv";
|
29606
|
-
var version$2 = "16.4.
|
29595
|
+
var version$2 = "16.4.2";
|
29607
29596
|
var description = "Loads environment variables from .env file";
|
29608
29597
|
var main = "lib/main.js";
|
29609
29598
|
var types$2 = "lib/main.d.ts";
|
@@ -29634,7 +29623,7 @@ var repository = {
|
|
29634
29623
|
type: "git",
|
29635
29624
|
url: "git://github.com/motdotla/dotenv.git"
|
29636
29625
|
};
|
29637
|
-
var funding = "https://
|
29626
|
+
var funding = "https://dotenvx.com";
|
29638
29627
|
var keywords$2 = [
|
29639
29628
|
"dotenv",
|
29640
29629
|
"env",
|
@@ -29743,7 +29732,7 @@ function _parseVault (options) {
|
|
29743
29732
|
}
|
29744
29733
|
|
29745
29734
|
// handle scenario for comma separated keys - for use with key rotation
|
29746
|
-
// example: DOTENV_KEY="dotenv://:key_1234@
|
29735
|
+
// example: DOTENV_KEY="dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=prod,dotenv://:key_7890@dotenvx.com/vault/.env.vault?environment=prod"
|
29747
29736
|
const keys = _dotenvKey(options).split(',');
|
29748
29737
|
const length = keys.length;
|
29749
29738
|
|
@@ -29807,7 +29796,7 @@ function _instructions (result, dotenvKey) {
|
|
29807
29796
|
uri = new URL(dotenvKey);
|
29808
29797
|
} catch (error) {
|
29809
29798
|
if (error.code === 'ERR_INVALID_URL') {
|
29810
|
-
const err = new Error('INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@
|
29799
|
+
const err = new Error('INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development');
|
29811
29800
|
err.code = 'INVALID_DOTENV_KEY';
|
29812
29801
|
throw err
|
29813
29802
|
}
|
@@ -30037,81 +30026,80 @@ main$1.exports.populate = DotenvModule.populate;
|
|
30037
30026
|
|
30038
30027
|
main$1.exports = DotenvModule;
|
30039
30028
|
|
30040
|
-
//
|
30041
|
-
|
30042
|
-
|
30043
|
-
|
30044
|
-
|
30029
|
+
// * /
|
30030
|
+
// * (\\)? # is it escaped with a backslash?
|
30031
|
+
// * (\$) # literal $
|
30032
|
+
// * (?!\() # shouldnt be followed by parenthesis
|
30033
|
+
// * (\{?) # first brace wrap opening
|
30034
|
+
// * ([\w.]+) # key
|
30035
|
+
// * (?::-((?:\$\{(?:\$\{(?:\$\{[^}]*\}|[^}])*}|[^}])*}|[^}])+))? # optional default nested 3 times
|
30036
|
+
// * (\}?) # last brace warp closing
|
30037
|
+
// * /xi
|
30045
30038
|
|
30046
|
-
|
30047
|
-
// find the last unescaped dollar sign in the
|
30048
|
-
// value so that we can evaluate it
|
30049
|
-
const lastUnescapedDollarSignIndex = _searchLast(envValue, /(?!(?<=\\))\$/g);
|
30039
|
+
const DOTENV_SUBSTITUTION_REGEX = /(\\)?(\$)(?!\()(\{?)([\w.]+)(?::?-((?:\$\{(?:\$\{(?:\$\{[^}]*\}|[^}])*}|[^}])*}|[^}])+))?(\}?)/gi;
|
30050
30040
|
|
30051
|
-
|
30052
|
-
|
30053
|
-
|
30041
|
+
function _resolveEscapeSequences (value) {
|
30042
|
+
return value.replace(/\\\$/g, '$')
|
30043
|
+
}
|
30054
30044
|
|
30055
|
-
|
30056
|
-
|
30045
|
+
function interpolate (value, processEnv, parsed) {
|
30046
|
+
return value.replace(DOTENV_SUBSTITUTION_REGEX, (match, escaped, dollarSign, openBrace, key, defaultValue, closeBrace) => {
|
30047
|
+
if (escaped === '\\') {
|
30048
|
+
return match.slice(1)
|
30049
|
+
} else {
|
30050
|
+
if (processEnv[key]) {
|
30051
|
+
return processEnv[key]
|
30052
|
+
}
|
30057
30053
|
|
30058
|
-
|
30059
|
-
|
30060
|
-
|
30061
|
-
* (
|
30062
|
-
* (?!(?<=\\))\$ // only match dollar signs that are not escaped
|
30063
|
-
* {? // optional opening curly brace
|
30064
|
-
* ([\w]+) // match the variable name
|
30065
|
-
* (?::-([^}\\]*))? // match an optional default value
|
30066
|
-
* }? // optional closing curly brace
|
30067
|
-
* )
|
30068
|
-
*/
|
30069
|
-
const matchGroup = /((?!(?<=\\))\${?([\w]+)(?::-([^}\\]*))?}?)/;
|
30070
|
-
const match = rightMostGroup.match(matchGroup);
|
30071
|
-
|
30072
|
-
if (match != null) {
|
30073
|
-
const [, group, variableName, defaultValue] = match;
|
30074
|
-
|
30075
|
-
return _interpolate(
|
30076
|
-
envValue.replace(
|
30077
|
-
group,
|
30078
|
-
environment[variableName] ||
|
30079
|
-
defaultValue ||
|
30080
|
-
config.parsed[variableName] ||
|
30081
|
-
''
|
30082
|
-
),
|
30083
|
-
environment,
|
30084
|
-
config
|
30085
|
-
)
|
30086
|
-
}
|
30054
|
+
if (parsed[key]) {
|
30055
|
+
return parsed[key]
|
30056
|
+
}
|
30087
30057
|
|
30088
|
-
|
30089
|
-
|
30058
|
+
if (defaultValue) {
|
30059
|
+
if (defaultValue.startsWith('$')) {
|
30060
|
+
return interpolate(defaultValue, processEnv, parsed)
|
30061
|
+
} else {
|
30062
|
+
return defaultValue
|
30063
|
+
}
|
30064
|
+
}
|
30090
30065
|
|
30091
|
-
|
30092
|
-
|
30066
|
+
return ''
|
30067
|
+
}
|
30068
|
+
})
|
30093
30069
|
}
|
30094
30070
|
|
30095
|
-
function expand (
|
30096
|
-
|
30097
|
-
|
30071
|
+
function expand (options) {
|
30072
|
+
let processEnv = process.env;
|
30073
|
+
if (options && options.processEnv != null) {
|
30074
|
+
processEnv = options.processEnv;
|
30075
|
+
}
|
30098
30076
|
|
30099
|
-
for (const
|
30100
|
-
|
30101
|
-
? environment[configKey]
|
30102
|
-
: config.parsed[configKey];
|
30077
|
+
for (const key in options.parsed) {
|
30078
|
+
let value = options.parsed[key];
|
30103
30079
|
|
30104
|
-
|
30105
|
-
|
30106
|
-
)
|
30080
|
+
const inProcessEnv = Object.prototype.hasOwnProperty.call(processEnv, key);
|
30081
|
+
|
30082
|
+
if (inProcessEnv) {
|
30083
|
+
if (processEnv[key] === options.parsed[key]) {
|
30084
|
+
// assume was set to processEnv from the .env file if the values match and therefore interpolate
|
30085
|
+
value = interpolate(value, processEnv, options.parsed);
|
30086
|
+
} else {
|
30087
|
+
// do not interpolate - assume processEnv had the intended value even if containing a $.
|
30088
|
+
value = processEnv[key];
|
30089
|
+
}
|
30090
|
+
} else {
|
30091
|
+
// not inProcessEnv so assume interpolation for this .env key
|
30092
|
+
value = interpolate(value, processEnv, options.parsed);
|
30093
|
+
}
|
30094
|
+
|
30095
|
+
options.parsed[key] = _resolveEscapeSequences(value);
|
30107
30096
|
}
|
30108
30097
|
|
30109
|
-
|
30110
|
-
|
30111
|
-
|
30112
|
-
// }
|
30098
|
+
for (const processKey in options.parsed) {
|
30099
|
+
processEnv[processKey] = options.parsed[processKey];
|
30100
|
+
}
|
30113
30101
|
|
30114
|
-
return
|
30102
|
+
return options
|
30115
30103
|
}
|
30116
30104
|
|
30117
30105
|
var expand_1 = expand;
|
@@ -30148,9 +30136,10 @@ function loadEnv(mode, envDir, prefixes = 'VITE_') {
|
|
30148
30136
|
if (parsed.BROWSER_ARGS && process.env.BROWSER_ARGS === undefined) {
|
30149
30137
|
process.env.BROWSER_ARGS = parsed.BROWSER_ARGS;
|
30150
30138
|
}
|
30151
|
-
// let environment variables use each other
|
30152
|
-
//
|
30153
|
-
|
30139
|
+
// let environment variables use each other. make a copy of `process.env` so that `dotenv-expand`
|
30140
|
+
// doesn't re-assign the expanded values to the global `process.env`.
|
30141
|
+
const processEnv = { ...process.env };
|
30142
|
+
expand_1({ parsed, processEnv });
|
30154
30143
|
// only keys that start with prefix are exposed to client
|
30155
30144
|
for (const [key, value] of Object.entries(parsed)) {
|
30156
30145
|
if (prefixes.some((prefix) => key.startsWith(prefix))) {
|
@@ -32082,8 +32071,8 @@ function createCachedImport(imp) {
|
|
32082
32071
|
return cached;
|
32083
32072
|
};
|
32084
32073
|
}
|
32085
|
-
const importPostcssImport = createCachedImport(() => import('./dep-
|
32086
|
-
const importPostcssModules = createCachedImport(() => import('./dep-
|
32074
|
+
const importPostcssImport = createCachedImport(() => import('./dep-ZEDYRkoC.js').then(function (n) { return n.i; }));
|
32075
|
+
const importPostcssModules = createCachedImport(() => import('./dep-PB-S7R_m.js').then(function (n) { return n.i; }));
|
32087
32076
|
const importPostcss = createCachedImport(() => import('postcss'));
|
32088
32077
|
const preprocessorWorkerControllerCache = new WeakMap();
|
32089
32078
|
let alwaysFakeWorkerWorkerControllerCache;
|
@@ -49247,10 +49236,11 @@ function webWorkerPlugin(config) {
|
|
49247
49236
|
// Using blob URL for SharedWorker results in multiple instances of a same worker
|
49248
49237
|
workerConstructor === 'Worker'
|
49249
49238
|
? `${encodedJs}
|
49239
|
+
const decodeBase64 = (base64) => Uint8Array.from(atob(base64), c => c.charCodeAt(0));
|
49250
49240
|
const blob = typeof window !== "undefined" && window.Blob && new Blob([${workerType === 'classic'
|
49251
49241
|
? ''
|
49252
49242
|
: // `URL` is always available, in `Worker[type="module"]`
|
49253
|
-
`'URL.revokeObjectURL(import.meta.url);'
|
49243
|
+
`'URL.revokeObjectURL(import.meta.url);',`}decodeBase64(encodedJs)], { type: "text/javascript;charset=utf-8" });
|
49254
49244
|
export default function WorkerWrapper(options) {
|
49255
49245
|
let objURL;
|
49256
49246
|
try {
|
@@ -56180,7 +56170,7 @@ async function fetchModule(server, url, importer, options = {}) {
|
|
56180
56170
|
throw err;
|
56181
56171
|
}
|
56182
56172
|
const file = pathToFileURL(resolved.id).toString();
|
56183
|
-
const type = isFilePathESM(
|
56173
|
+
const type = isFilePathESM(resolved.id, server.config.packageCache)
|
56184
56174
|
? 'module'
|
56185
56175
|
: 'commonjs';
|
56186
56176
|
return { externalize: file, type };
|
@@ -56207,6 +56197,7 @@ let SOURCEMAPPING_URL = 'sourceMa';
|
|
56207
56197
|
SOURCEMAPPING_URL += 'ppingURL';
|
56208
56198
|
const VITE_RUNTIME_SOURCEMAPPING_SOURCE = '//# sourceMappingSource=vite-runtime';
|
56209
56199
|
const VITE_RUNTIME_SOURCEMAPPING_URL = `${SOURCEMAPPING_URL}=data:application/json;charset=utf-8`;
|
56200
|
+
const OTHER_SOURCE_MAP_REGEXP = new RegExp(`//# ${SOURCEMAPPING_URL}=data:application/json[^,]+base64,([A-Za-z0-9+/=]+)$`, 'gm');
|
56210
56201
|
function inlineSourceMap(mod, result, processSourceMap) {
|
56211
56202
|
const map = result.map;
|
56212
56203
|
let code = result.code;
|
@@ -56215,8 +56206,8 @@ function inlineSourceMap(mod, result, processSourceMap) {
|
|
56215
56206
|
code.includes(VITE_RUNTIME_SOURCEMAPPING_SOURCE))
|
56216
56207
|
return result;
|
56217
56208
|
// to reduce the payload size, we only inline vite node source map, because it's also the only one we use
|
56218
|
-
|
56219
|
-
|
56209
|
+
OTHER_SOURCE_MAP_REGEXP.lastIndex = 0;
|
56210
|
+
if (OTHER_SOURCE_MAP_REGEXP.test(code))
|
56220
56211
|
code = code.replace(OTHER_SOURCE_MAP_REGEXP, '');
|
56221
56212
|
const sourceMap = Buffer.from(JSON.stringify(processSourceMap?.(map) || map), 'utf-8').toString('base64');
|
56222
56213
|
result.code = `${code.trimEnd()}\n//# sourceURL=${mod.id}\n${VITE_RUNTIME_SOURCEMAPPING_SOURCE}\n//# ${VITE_RUNTIME_SOURCEMAPPING_URL};base64,${sourceMap}\n`;
|
@@ -63271,12 +63262,11 @@ function cachedTransformMiddleware(server) {
|
|
63271
63262
|
if (ifNoneMatch) {
|
63272
63263
|
const moduleByEtag = server.moduleGraph.getModuleByEtag(ifNoneMatch);
|
63273
63264
|
if (moduleByEtag?.transformResult?.etag === ifNoneMatch) {
|
63274
|
-
// For
|
63265
|
+
// For CSS requests, if the same CSS file is imported in a module,
|
63275
63266
|
// the browser sends the request for the direct CSS request with the etag
|
63276
63267
|
// from the imported CSS module. We ignore the etag in this case.
|
63277
|
-
const
|
63278
|
-
|
63279
|
-
if (!mixedEtag) {
|
63268
|
+
const maybeMixedEtag = isCSSRequest(req.url);
|
63269
|
+
if (!maybeMixedEtag) {
|
63280
63270
|
debugCache?.(`[304] ${prettifyUrl(req.url, server.config.root)}`);
|
63281
63271
|
res.statusCode = 304;
|
63282
63272
|
return res.end();
|
@@ -63365,12 +63355,23 @@ function transformMiddleware(server) {
|
|
63365
63355
|
// Strip valid id prefix. This is prepended to resolved Ids that are
|
63366
63356
|
// not valid browser import specifiers by the importAnalysis plugin.
|
63367
63357
|
url = unwrapId(url);
|
63368
|
-
// for CSS, we
|
63369
|
-
|
63370
|
-
|
63371
|
-
|
63372
|
-
|
63373
|
-
|
63358
|
+
// for CSS, we differentiate between normal CSS requests and imports
|
63359
|
+
if (isCSSRequest(url)) {
|
63360
|
+
if (req.headers.accept?.includes('text/css') &&
|
63361
|
+
!isDirectRequest(url)) {
|
63362
|
+
url = injectQuery(url, 'direct');
|
63363
|
+
}
|
63364
|
+
// check if we can return 304 early for CSS requests. These aren't handled
|
63365
|
+
// by the cachedTransformMiddleware due to the browser possibly mixing the
|
63366
|
+
// etags of direct and imported CSS
|
63367
|
+
const ifNoneMatch = req.headers['if-none-match'];
|
63368
|
+
if (ifNoneMatch &&
|
63369
|
+
(await server.moduleGraph.getModuleByUrl(url, false))
|
63370
|
+
?.transformResult?.etag === ifNoneMatch) {
|
63371
|
+
debugCache?.(`[304] ${prettifyUrl(url, server.config.root)}`);
|
63372
|
+
res.statusCode = 304;
|
63373
|
+
return res.end();
|
63374
|
+
}
|
63374
63375
|
}
|
63375
63376
|
// resolve, load and transform using the plugin container
|
63376
63377
|
const result = await transformRequest(url, server, {
|
@@ -65558,7 +65559,7 @@ function importAnalysisPlugin(config) {
|
|
65558
65559
|
}
|
65559
65560
|
// fix#9534, prevent the importerModuleNode being stopped from propagating updates
|
65560
65561
|
importerModule.isSelfAccepting = false;
|
65561
|
-
return this.error(`Failed to resolve import "${url}" from "${path$o.relative(process.cwd(), importerFile)}". Does the file exist?`, pos);
|
65562
|
+
return this.error(`Failed to resolve import "${url}" from "${normalizePath$3(path$o.relative(process.cwd(), importerFile))}". Does the file exist?`, pos);
|
65562
65563
|
}
|
65563
65564
|
if (isExternalUrl(resolved.id)) {
|
65564
65565
|
return [resolved.id, resolved.id];
|
@@ -66793,6 +66794,7 @@ async function build(inlineConfig = {}) {
|
|
66793
66794
|
config.logger.error(msg, { error: e });
|
66794
66795
|
};
|
66795
66796
|
let bundle;
|
66797
|
+
let startTime;
|
66796
66798
|
try {
|
66797
66799
|
const buildOutputOptions = (output = {}) => {
|
66798
66800
|
// @ts-expect-error See https://github.com/vitejs/vite/issues/5812#issuecomment-984345618
|
@@ -66890,6 +66892,7 @@ async function build(inlineConfig = {}) {
|
|
66890
66892
|
}
|
66891
66893
|
// write or generate files with rollup
|
66892
66894
|
const { rollup } = await import('rollup');
|
66895
|
+
startTime = Date.now();
|
66893
66896
|
bundle = await rollup(rollupOptions);
|
66894
66897
|
if (options.write) {
|
66895
66898
|
prepareOutDir(outDirs, options.emptyOutDir, config);
|
@@ -66898,11 +66901,16 @@ async function build(inlineConfig = {}) {
|
|
66898
66901
|
for (const output of normalizedOutputs) {
|
66899
66902
|
res.push(await bundle[options.write ? 'write' : 'generate'](output));
|
66900
66903
|
}
|
66904
|
+
config.logger.info(`${colors$1.green(`✓ built in ${displayTime(Date.now() - startTime)}`)}`);
|
66901
66905
|
return Array.isArray(outputs) ? res : res[0];
|
66902
66906
|
}
|
66903
66907
|
catch (e) {
|
66904
66908
|
e.message = mergeRollupError(e);
|
66905
66909
|
clearLine();
|
66910
|
+
if (startTime) {
|
66911
|
+
config.logger.error(`${colors$1.red('x')} Build failed in ${displayTime(Date.now() - startTime)}`);
|
66912
|
+
startTime = undefined;
|
66913
|
+
}
|
66906
66914
|
throw e;
|
66907
66915
|
}
|
66908
66916
|
finally {
|
package/dist/node/cli.js
CHANGED
@@ -2,7 +2,7 @@ import path from 'node:path';
|
|
2
2
|
import fs from 'node:fs';
|
3
3
|
import { performance } from 'node:perf_hooks';
|
4
4
|
import { EventEmitter } from 'events';
|
5
|
-
import { c as colors, a as createLogger, r as resolveConfig } from './chunks/dep-
|
5
|
+
import { c as colors, a as createLogger, r as resolveConfig } from './chunks/dep-stQc5rCc.js';
|
6
6
|
import { VERSION } from './constants.js';
|
7
7
|
import 'node:fs/promises';
|
8
8
|
import 'node:url';
|
@@ -757,7 +757,7 @@ cli
|
|
757
757
|
filterDuplicateOptions(options);
|
758
758
|
// output structure is preserved even after bundling so require()
|
759
759
|
// is ok here
|
760
|
-
const { createServer } = await import('./chunks/dep-
|
760
|
+
const { createServer } = await import('./chunks/dep-stQc5rCc.js').then(function (n) { return n.E; });
|
761
761
|
try {
|
762
762
|
const server = await createServer({
|
763
763
|
root,
|
@@ -836,7 +836,7 @@ cli
|
|
836
836
|
.option('-w, --watch', `[boolean] rebuilds when modules have changed on disk`)
|
837
837
|
.action(async (root, options) => {
|
838
838
|
filterDuplicateOptions(options);
|
839
|
-
const { build } = await import('./chunks/dep-
|
839
|
+
const { build } = await import('./chunks/dep-stQc5rCc.js').then(function (n) { return n.F; });
|
840
840
|
const buildOptions = cleanOptions(options);
|
841
841
|
try {
|
842
842
|
await build({
|
@@ -863,7 +863,7 @@ cli
|
|
863
863
|
.option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
|
864
864
|
.action(async (root, options) => {
|
865
865
|
filterDuplicateOptions(options);
|
866
|
-
const { optimizeDeps } = await import('./chunks/dep-
|
866
|
+
const { optimizeDeps } = await import('./chunks/dep-stQc5rCc.js').then(function (n) { return n.D; });
|
867
867
|
try {
|
868
868
|
const config = await resolveConfig({
|
869
869
|
root,
|
@@ -889,7 +889,7 @@ cli
|
|
889
889
|
.option('--outDir <dir>', `[string] output directory (default: dist)`)
|
890
890
|
.action(async (root, options) => {
|
891
891
|
filterDuplicateOptions(options);
|
892
|
-
const { preview } = await import('./chunks/dep-
|
892
|
+
const { preview } = await import('./chunks/dep-stQc5rCc.js').then(function (n) { return n.G; });
|
893
893
|
try {
|
894
894
|
const server = await preview({
|
895
895
|
root,
|
package/dist/node/index.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
export { parseAst, parseAstAsync } from 'rollup/parseAst';
|
2
|
-
import { i as isInNodeModules, b as arraify } from './chunks/dep-
|
3
|
-
export { f as build, j as buildErrorMessage, u as createFilter, a as createLogger, e as createServer, d as defineConfig, k as fetchModule, g as formatPostcssSourceMap, y as isFileServingAllowed, l as loadConfigFromFile, z as loadEnv, q as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, h as preprocessCSS, p as preview, r as resolveConfig, A as resolveEnvPrefix, v as rollupVersion, x as searchForWorkspaceRoot, w as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-
|
2
|
+
import { i as isInNodeModules, b as arraify } from './chunks/dep-stQc5rCc.js';
|
3
|
+
export { f as build, j as buildErrorMessage, u as createFilter, a as createLogger, e as createServer, d as defineConfig, k as fetchModule, g as formatPostcssSourceMap, y as isFileServingAllowed, l as loadConfigFromFile, z as loadEnv, q as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, h as preprocessCSS, p as preview, r as resolveConfig, A as resolveEnvPrefix, v as rollupVersion, x as searchForWorkspaceRoot, w as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-stQc5rCc.js';
|
4
4
|
export { VERSION as version } from './constants.js';
|
5
5
|
export { version as esbuildVersion } from 'esbuild';
|
6
6
|
import { existsSync, readFileSync } from 'node:fs';
|
package/dist/node/runtime.js
CHANGED
@@ -1381,13 +1381,16 @@ class ViteRuntime {
|
|
1381
1381
|
if (mod.exports)
|
1382
1382
|
return this.processImport(mod.exports, fetchedModule, metadata);
|
1383
1383
|
}
|
1384
|
-
const getStack = () => `stack:\n${[...callstack, moduleId]
|
1385
|
-
.reverse()
|
1386
|
-
.map((p) => ` - ${p}`)
|
1387
|
-
.join('\n')}`;
|
1388
1384
|
let debugTimer;
|
1389
|
-
if (this.debug)
|
1390
|
-
debugTimer = setTimeout(() =>
|
1385
|
+
if (this.debug) {
|
1386
|
+
debugTimer = setTimeout(() => {
|
1387
|
+
const getStack = () => `stack:\n${[...callstack, moduleId]
|
1388
|
+
.reverse()
|
1389
|
+
.map((p) => ` - ${p}`)
|
1390
|
+
.join('\n')}`;
|
1391
|
+
this.debug(`[vite-runtime] module ${moduleId} takes over 2s to load.\n${getStack()}`);
|
1392
|
+
}, 2000);
|
1393
|
+
}
|
1391
1394
|
try {
|
1392
1395
|
// cached module
|
1393
1396
|
if (mod.promise)
|
@@ -1417,7 +1420,7 @@ class ViteRuntime {
|
|
1417
1420
|
this.debug?.('[vite-runtime] fetching', id);
|
1418
1421
|
// fast return for established externalized patterns
|
1419
1422
|
const fetchedModule = id.startsWith('data:')
|
1420
|
-
? { externalize: id, type: 'builtin' }
|
1423
|
+
? ({ externalize: id, type: 'builtin' })
|
1421
1424
|
: await this.options.fetchModule(id, importer);
|
1422
1425
|
// base moduleId on "file" and not on id
|
1423
1426
|
// if `import(variable)` is called it's possible that it doesn't have an extension for example
|
@@ -1604,7 +1607,7 @@ class ESModulesRunner {
|
|
1604
1607
|
// source map should already be inlined by Vite
|
1605
1608
|
'"use strict";' + code);
|
1606
1609
|
await initModule(context[ssrModuleExportsKey], context[ssrImportMetaKey], context[ssrImportKey], context[ssrDynamicImportKey], context[ssrExportAllKey]);
|
1607
|
-
Object.
|
1610
|
+
Object.seal(context[ssrModuleExportsKey]);
|
1608
1611
|
}
|
1609
1612
|
runExternalModule(filepath) {
|
1610
1613
|
return import(filepath);
|
@@ -5577,7 +5577,7 @@ function isFileServingAllowed(url, server) {
|
|
5577
5577
|
var main$1 = {exports: {}};
|
5578
5578
|
|
5579
5579
|
var name = "dotenv";
|
5580
|
-
var version$1 = "16.4.
|
5580
|
+
var version$1 = "16.4.2";
|
5581
5581
|
var description = "Loads environment variables from .env file";
|
5582
5582
|
var main = "lib/main.js";
|
5583
5583
|
var types = "lib/main.d.ts";
|
@@ -5608,7 +5608,7 @@ var repository = {
|
|
5608
5608
|
type: "git",
|
5609
5609
|
url: "git://github.com/motdotla/dotenv.git"
|
5610
5610
|
};
|
5611
|
-
var funding = "https://
|
5611
|
+
var funding = "https://dotenvx.com";
|
5612
5612
|
var keywords = [
|
5613
5613
|
"dotenv",
|
5614
5614
|
"env",
|
@@ -5717,7 +5717,7 @@ function _parseVault (options) {
|
|
5717
5717
|
}
|
5718
5718
|
|
5719
5719
|
// handle scenario for comma separated keys - for use with key rotation
|
5720
|
-
// example: DOTENV_KEY="dotenv://:key_1234@
|
5720
|
+
// example: DOTENV_KEY="dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=prod,dotenv://:key_7890@dotenvx.com/vault/.env.vault?environment=prod"
|
5721
5721
|
const keys = _dotenvKey(options).split(',');
|
5722
5722
|
const length = keys.length;
|
5723
5723
|
|
@@ -5781,7 +5781,7 @@ function _instructions (result, dotenvKey) {
|
|
5781
5781
|
uri = new URL(dotenvKey);
|
5782
5782
|
} catch (error) {
|
5783
5783
|
if (error.code === 'ERR_INVALID_URL') {
|
5784
|
-
const err = new Error('INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@
|
5784
|
+
const err = new Error('INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development');
|
5785
5785
|
err.code = 'INVALID_DOTENV_KEY';
|
5786
5786
|
throw err
|
5787
5787
|
}
|
@@ -6011,81 +6011,80 @@ main$1.exports.populate = DotenvModule.populate;
|
|
6011
6011
|
|
6012
6012
|
main$1.exports = DotenvModule;
|
6013
6013
|
|
6014
|
-
//
|
6015
|
-
|
6016
|
-
|
6017
|
-
|
6018
|
-
|
6014
|
+
// * /
|
6015
|
+
// * (\\)? # is it escaped with a backslash?
|
6016
|
+
// * (\$) # literal $
|
6017
|
+
// * (?!\() # shouldnt be followed by parenthesis
|
6018
|
+
// * (\{?) # first brace wrap opening
|
6019
|
+
// * ([\w.]+) # key
|
6020
|
+
// * (?::-((?:\$\{(?:\$\{(?:\$\{[^}]*\}|[^}])*}|[^}])*}|[^}])+))? # optional default nested 3 times
|
6021
|
+
// * (\}?) # last brace warp closing
|
6022
|
+
// * /xi
|
6019
6023
|
|
6020
|
-
|
6021
|
-
// find the last unescaped dollar sign in the
|
6022
|
-
// value so that we can evaluate it
|
6023
|
-
const lastUnescapedDollarSignIndex = _searchLast(envValue, /(?!(?<=\\))\$/g);
|
6024
|
+
const DOTENV_SUBSTITUTION_REGEX = /(\\)?(\$)(?!\()(\{?)([\w.]+)(?::?-((?:\$\{(?:\$\{(?:\$\{[^}]*\}|[^}])*}|[^}])*}|[^}])+))?(\}?)/gi;
|
6024
6025
|
|
6025
|
-
|
6026
|
-
|
6027
|
-
|
6026
|
+
function _resolveEscapeSequences (value) {
|
6027
|
+
return value.replace(/\\\$/g, '$')
|
6028
|
+
}
|
6028
6029
|
|
6029
|
-
|
6030
|
-
|
6030
|
+
function interpolate (value, processEnv, parsed) {
|
6031
|
+
return value.replace(DOTENV_SUBSTITUTION_REGEX, (match, escaped, dollarSign, openBrace, key, defaultValue, closeBrace) => {
|
6032
|
+
if (escaped === '\\') {
|
6033
|
+
return match.slice(1)
|
6034
|
+
} else {
|
6035
|
+
if (processEnv[key]) {
|
6036
|
+
return processEnv[key]
|
6037
|
+
}
|
6031
6038
|
|
6032
|
-
|
6033
|
-
|
6034
|
-
|
6035
|
-
* (
|
6036
|
-
* (?!(?<=\\))\$ // only match dollar signs that are not escaped
|
6037
|
-
* {? // optional opening curly brace
|
6038
|
-
* ([\w]+) // match the variable name
|
6039
|
-
* (?::-([^}\\]*))? // match an optional default value
|
6040
|
-
* }? // optional closing curly brace
|
6041
|
-
* )
|
6042
|
-
*/
|
6043
|
-
const matchGroup = /((?!(?<=\\))\${?([\w]+)(?::-([^}\\]*))?}?)/;
|
6044
|
-
const match = rightMostGroup.match(matchGroup);
|
6045
|
-
|
6046
|
-
if (match != null) {
|
6047
|
-
const [, group, variableName, defaultValue] = match;
|
6048
|
-
|
6049
|
-
return _interpolate(
|
6050
|
-
envValue.replace(
|
6051
|
-
group,
|
6052
|
-
environment[variableName] ||
|
6053
|
-
defaultValue ||
|
6054
|
-
config.parsed[variableName] ||
|
6055
|
-
''
|
6056
|
-
),
|
6057
|
-
environment,
|
6058
|
-
config
|
6059
|
-
)
|
6060
|
-
}
|
6039
|
+
if (parsed[key]) {
|
6040
|
+
return parsed[key]
|
6041
|
+
}
|
6061
6042
|
|
6062
|
-
|
6063
|
-
|
6043
|
+
if (defaultValue) {
|
6044
|
+
if (defaultValue.startsWith('$')) {
|
6045
|
+
return interpolate(defaultValue, processEnv, parsed)
|
6046
|
+
} else {
|
6047
|
+
return defaultValue
|
6048
|
+
}
|
6049
|
+
}
|
6064
6050
|
|
6065
|
-
|
6066
|
-
|
6051
|
+
return ''
|
6052
|
+
}
|
6053
|
+
})
|
6067
6054
|
}
|
6068
6055
|
|
6069
|
-
function expand (
|
6070
|
-
|
6071
|
-
|
6056
|
+
function expand (options) {
|
6057
|
+
let processEnv = process.env;
|
6058
|
+
if (options && options.processEnv != null) {
|
6059
|
+
processEnv = options.processEnv;
|
6060
|
+
}
|
6061
|
+
|
6062
|
+
for (const key in options.parsed) {
|
6063
|
+
let value = options.parsed[key];
|
6072
6064
|
|
6073
|
-
|
6074
|
-
const value = Object.prototype.hasOwnProperty.call(environment, configKey)
|
6075
|
-
? environment[configKey]
|
6076
|
-
: config.parsed[configKey];
|
6065
|
+
const inProcessEnv = Object.prototype.hasOwnProperty.call(processEnv, key);
|
6077
6066
|
|
6078
|
-
|
6079
|
-
|
6080
|
-
|
6067
|
+
if (inProcessEnv) {
|
6068
|
+
if (processEnv[key] === options.parsed[key]) {
|
6069
|
+
// assume was set to processEnv from the .env file if the values match and therefore interpolate
|
6070
|
+
value = interpolate(value, processEnv, options.parsed);
|
6071
|
+
} else {
|
6072
|
+
// do not interpolate - assume processEnv had the intended value even if containing a $.
|
6073
|
+
value = processEnv[key];
|
6074
|
+
}
|
6075
|
+
} else {
|
6076
|
+
// not inProcessEnv so assume interpolation for this .env key
|
6077
|
+
value = interpolate(value, processEnv, options.parsed);
|
6078
|
+
}
|
6079
|
+
|
6080
|
+
options.parsed[key] = _resolveEscapeSequences(value);
|
6081
6081
|
}
|
6082
6082
|
|
6083
|
-
|
6084
|
-
|
6085
|
-
|
6086
|
-
// }
|
6083
|
+
for (const processKey in options.parsed) {
|
6084
|
+
processEnv[processKey] = options.parsed[processKey];
|
6085
|
+
}
|
6087
6086
|
|
6088
|
-
return
|
6087
|
+
return options
|
6089
6088
|
}
|
6090
6089
|
|
6091
6090
|
var expand_1 = expand;
|
@@ -6122,9 +6121,10 @@ function loadEnv(mode, envDir, prefixes = 'VITE_') {
|
|
6122
6121
|
if (parsed.BROWSER_ARGS && process.env.BROWSER_ARGS === undefined) {
|
6123
6122
|
process.env.BROWSER_ARGS = parsed.BROWSER_ARGS;
|
6124
6123
|
}
|
6125
|
-
// let environment variables use each other
|
6126
|
-
//
|
6127
|
-
|
6124
|
+
// let environment variables use each other. make a copy of `process.env` so that `dotenv-expand`
|
6125
|
+
// doesn't re-assign the expanded values to the global `process.env`.
|
6126
|
+
const processEnv = { ...process.env };
|
6127
|
+
expand_1({ parsed, processEnv });
|
6128
6128
|
// only keys that start with prefix are exposed to client
|
6129
6129
|
for (const [key, value] of Object.entries(parsed)) {
|
6130
6130
|
if (prefixes.some((prefix) => key.startsWith(prefix))) {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "vite",
|
3
|
-
"version": "5.1.
|
3
|
+
"version": "5.1.3",
|
4
4
|
"type": "module",
|
5
5
|
"license": "MIT",
|
6
6
|
"author": "Evan You",
|
@@ -103,8 +103,8 @@
|
|
103
103
|
"cross-spawn": "^7.0.3",
|
104
104
|
"debug": "^4.3.4",
|
105
105
|
"dep-types": "link:./src/types",
|
106
|
-
"dotenv": "^16.4.
|
107
|
-
"dotenv-expand": "^
|
106
|
+
"dotenv": "^16.4.2",
|
107
|
+
"dotenv-expand": "^11.0.3",
|
108
108
|
"es-module-lexer": "^1.4.1",
|
109
109
|
"escape-html": "^1.0.3",
|
110
110
|
"estree-walker": "^3.0.3",
|