vite 4.1.0 → 4.1.2
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.
|
@@ -21589,7 +21589,13 @@ function tryFsResolve(fsPath, options, tryIndex = true, targetWeb = true) {
|
|
|
21589
21589
|
}
|
|
21590
21590
|
}
|
|
21591
21591
|
function tryResolveFile(file, postfix, options, tryIndex, targetWeb, tryPrefix, skipPackageJson, skipTsExtension) {
|
|
21592
|
-
|
|
21592
|
+
let stat;
|
|
21593
|
+
try {
|
|
21594
|
+
stat = fs$l.statSync(file, { throwIfNoEntry: false });
|
|
21595
|
+
}
|
|
21596
|
+
catch {
|
|
21597
|
+
return;
|
|
21598
|
+
}
|
|
21593
21599
|
if (stat) {
|
|
21594
21600
|
if (!stat.isDirectory()) {
|
|
21595
21601
|
return getRealPath(file, options.preserveSymlinks) + postfix;
|
|
@@ -35224,12 +35230,13 @@ function stripLiteralAcorn(code) {
|
|
|
35224
35230
|
return result;
|
|
35225
35231
|
}
|
|
35226
35232
|
|
|
35227
|
-
const multilineCommentsRE =
|
|
35233
|
+
const multilineCommentsRE = /\/\*([^*\/])*?\*\//gms;
|
|
35228
35234
|
const singlelineCommentsRE = /(?:^|\n|\r)\s*\/\/.*(?:\r|\n|$)/gm;
|
|
35229
35235
|
const templateLiteralRE = /\$\{(\s*(?:(?!\$\{).|\n|\r)*?\s*)\}/g;
|
|
35230
35236
|
const quotesRE = [
|
|
35231
35237
|
/(["'`])((?:\\\1|(?!\1)|.|\r)*?)\1/gm,
|
|
35232
35238
|
/([`])((?:\\\1|(?!\1)|.|\n|\r)*?)\1/gm
|
|
35239
|
+
// multi-line strings (i.e. template literals only)
|
|
35233
35240
|
];
|
|
35234
35241
|
function stripLiteralRegex(code) {
|
|
35235
35242
|
code = code.replace(multilineCommentsRE, (s) => " ".repeat(s.length)).replace(singlelineCommentsRE, (s) => " ".repeat(s.length));
|
|
@@ -35302,15 +35309,15 @@ function polyfill() {
|
|
|
35302
35309
|
}
|
|
35303
35310
|
}
|
|
35304
35311
|
}).observe(document, { childList: true, subtree: true });
|
|
35305
|
-
function getFetchOpts(
|
|
35312
|
+
function getFetchOpts(link) {
|
|
35306
35313
|
const fetchOpts = {};
|
|
35307
|
-
if (
|
|
35308
|
-
fetchOpts.integrity =
|
|
35309
|
-
if (
|
|
35310
|
-
fetchOpts.referrerPolicy =
|
|
35311
|
-
if (
|
|
35314
|
+
if (link.integrity)
|
|
35315
|
+
fetchOpts.integrity = link.integrity;
|
|
35316
|
+
if (link.referrerPolicy)
|
|
35317
|
+
fetchOpts.referrerPolicy = link.referrerPolicy;
|
|
35318
|
+
if (link.crossOrigin === 'use-credentials')
|
|
35312
35319
|
fetchOpts.credentials = 'include';
|
|
35313
|
-
else if (
|
|
35320
|
+
else if (link.crossOrigin === 'anonymous')
|
|
35314
35321
|
fetchOpts.credentials = 'omit';
|
|
35315
35322
|
else
|
|
35316
35323
|
fetchOpts.credentials = 'same-origin';
|
|
@@ -39761,13 +39768,14 @@ function importAnalysisPlugin(config) {
|
|
|
39761
39768
|
const prop = source.slice(end, end + 4);
|
|
39762
39769
|
if (prop === '.hot') {
|
|
39763
39770
|
hasHMR = true;
|
|
39764
|
-
|
|
39771
|
+
const endHot = end + 4 + (source[end + 4] === '?' ? 1 : 0);
|
|
39772
|
+
if (source.slice(endHot, endHot + 7) === '.accept') {
|
|
39765
39773
|
// further analyze accepted modules
|
|
39766
|
-
if (source.slice(
|
|
39767
|
-
lexAcceptedHmrExports(source, source.indexOf('(',
|
|
39774
|
+
if (source.slice(endHot, endHot + 14) === '.acceptExports') {
|
|
39775
|
+
lexAcceptedHmrExports(source, source.indexOf('(', endHot + 14) + 1, acceptedExports);
|
|
39768
39776
|
isPartiallySelfAccepting = true;
|
|
39769
39777
|
}
|
|
39770
|
-
else if (lexAcceptedHmrDeps(source, source.indexOf('(',
|
|
39778
|
+
else if (lexAcceptedHmrDeps(source, source.indexOf('(', endHot + 7) + 1, acceptedUrls)) {
|
|
39771
39779
|
isSelfAccepting = true;
|
|
39772
39780
|
}
|
|
39773
39781
|
}
|
|
@@ -40356,6 +40364,7 @@ function getAliasPatterns(entries) {
|
|
|
40356
40364
|
}
|
|
40357
40365
|
|
|
40358
40366
|
const nonJsRe = /\.json(?:$|\?)/;
|
|
40367
|
+
const metaEnvRe = /import\.meta\.env\.(.+)/;
|
|
40359
40368
|
const isNonJsRequest = (request) => nonJsRe.test(request);
|
|
40360
40369
|
function definePlugin(config) {
|
|
40361
40370
|
const isBuild = config.command === 'build';
|
|
@@ -40377,20 +40386,23 @@ function definePlugin(config) {
|
|
|
40377
40386
|
__vite_process_env_NODE_ENV: JSON.stringify(nodeEnv),
|
|
40378
40387
|
});
|
|
40379
40388
|
}
|
|
40389
|
+
const env = { ...config.env };
|
|
40380
40390
|
const userDefine = {};
|
|
40381
40391
|
for (const key in config.define) {
|
|
40382
40392
|
const val = config.define[key];
|
|
40383
40393
|
userDefine[key] = typeof val === 'string' ? val : JSON.stringify(val);
|
|
40394
|
+
// make sure `import.meta.env` object has user define properties
|
|
40395
|
+
const match = key.match(metaEnvRe);
|
|
40396
|
+
if (match) {
|
|
40397
|
+
env[match[1]] = val;
|
|
40398
|
+
}
|
|
40384
40399
|
}
|
|
40385
40400
|
// during dev, import.meta properties are handled by importAnalysis plugin.
|
|
40386
40401
|
// ignore replace import.meta.env in lib build
|
|
40387
40402
|
const importMetaKeys = {};
|
|
40388
40403
|
const importMetaFallbackKeys = {};
|
|
40389
40404
|
if (isBuild) {
|
|
40390
|
-
|
|
40391
|
-
...config.env,
|
|
40392
|
-
SSR: !!config.build.ssr,
|
|
40393
|
-
};
|
|
40405
|
+
env.SSR = !!config.build.ssr;
|
|
40394
40406
|
// set here to allow override with config.define
|
|
40395
40407
|
importMetaKeys['import.meta.hot'] = `undefined`;
|
|
40396
40408
|
for (const key in env) {
|
|
@@ -40398,7 +40410,7 @@ function definePlugin(config) {
|
|
|
40398
40410
|
}
|
|
40399
40411
|
Object.assign(importMetaFallbackKeys, {
|
|
40400
40412
|
'import.meta.env.': `({}).`,
|
|
40401
|
-
'import.meta.env': JSON.stringify(
|
|
40413
|
+
'import.meta.env': JSON.stringify(env),
|
|
40402
40414
|
});
|
|
40403
40415
|
}
|
|
40404
40416
|
function generatePattern(ssr) {
|
|
@@ -41393,12 +41405,8 @@ async function createPluginContainer(config, moduleGraph, watcher) {
|
|
|
41393
41405
|
err.id = ctx._activeId;
|
|
41394
41406
|
if (ctx._activeCode) {
|
|
41395
41407
|
err.pluginCode = ctx._activeCode;
|
|
41396
|
-
|
|
41397
|
-
|
|
41398
|
-
: err.pos != null
|
|
41399
|
-
? err.pos
|
|
41400
|
-
: // some rollup plugins, e.g. json, sets position instead of pos
|
|
41401
|
-
err.position;
|
|
41408
|
+
// some rollup plugins, e.g. json, sets err.position instead of err.pos
|
|
41409
|
+
const pos = position ?? err.pos ?? err.position;
|
|
41402
41410
|
if (pos != null) {
|
|
41403
41411
|
let errLocation;
|
|
41404
41412
|
try {
|
|
@@ -42490,7 +42498,7 @@ async function createDepsOptimizer(config, server) {
|
|
|
42490
42498
|
id,
|
|
42491
42499
|
file: getOptimizedDepPath(id, config, ssr),
|
|
42492
42500
|
src: resolved,
|
|
42493
|
-
//
|
|
42501
|
+
// Adding a browserHash to this missing dependency that is unique to
|
|
42494
42502
|
// the current state of known + missing deps. If its optimizeDeps run
|
|
42495
42503
|
// doesn't alter the bundled files of previous known dependencies,
|
|
42496
42504
|
// we don't need a full reload and this browserHash will be kept
|
|
@@ -43485,7 +43493,7 @@ function buildImportAnalysisPlugin(config) {
|
|
|
43485
43493
|
// The importerUrl is passed as third parameter to __vitePreload in this case
|
|
43486
43494
|
`function(dep, importerUrl) { return new URL(dep, importerUrl).href }`
|
|
43487
43495
|
: // If the base isn't relative, then the deps are relative to the projects `outDir` and the base
|
|
43488
|
-
// is
|
|
43496
|
+
// is appended inside __vitePreload too.
|
|
43489
43497
|
`function(dep) { return ${JSON.stringify(config.base)}+dep }`;
|
|
43490
43498
|
const preloadCode = `const scriptRel = ${scriptRel};const assetsURL = ${assetsURL};const seen = {};export const ${preloadMethod} = ${preload.toString()}`;
|
|
43491
43499
|
return {
|
|
@@ -44253,6 +44261,10 @@ function _interpolate (envValue, environment, config) {
|
|
|
44253
44261
|
replacePart = parts[0];
|
|
44254
44262
|
value = replacePart.replace('\\$', '$');
|
|
44255
44263
|
} else {
|
|
44264
|
+
// PATCH: compatible with env variables ended with unescaped $
|
|
44265
|
+
if(!parts[2]) {
|
|
44266
|
+
return newEnv
|
|
44267
|
+
}
|
|
44256
44268
|
const keyParts = parts[2].split(':-');
|
|
44257
44269
|
const key = keyParts[0];
|
|
44258
44270
|
replacePart = parts[0].substring(prefix.length);
|
|
@@ -44329,18 +44341,9 @@ function loadEnv(mode, envDir, prefixes = 'VITE_') {
|
|
|
44329
44341
|
if (parsed.BROWSER_ARGS && process.env.BROWSER_ARGS === undefined) {
|
|
44330
44342
|
process.env.BROWSER_ARGS = parsed.BROWSER_ARGS;
|
|
44331
44343
|
}
|
|
44332
|
-
|
|
44333
|
-
|
|
44334
|
-
|
|
44335
|
-
}
|
|
44336
|
-
catch (e) {
|
|
44337
|
-
// custom error handling until https://github.com/motdotla/dotenv-expand/issues/65 is fixed upstream
|
|
44338
|
-
// check for message "TypeError: Cannot read properties of undefined (reading 'split')"
|
|
44339
|
-
if (e.message.includes('split')) {
|
|
44340
|
-
throw new Error('dotenv-expand failed to expand env vars. Maybe you need to escape `$`?');
|
|
44341
|
-
}
|
|
44342
|
-
throw e;
|
|
44343
|
-
}
|
|
44344
|
+
// let environment variables use each other
|
|
44345
|
+
// `expand` patched in patches/dotenv-expand@9.0.0.patch
|
|
44346
|
+
expand_1({ parsed });
|
|
44344
44347
|
// only keys that start with prefix are exposed to client
|
|
44345
44348
|
for (const [key, value] of Object.entries(parsed)) {
|
|
44346
44349
|
if (prefixes.some((prefix) => key.startsWith(prefix))) {
|
|
@@ -51805,7 +51808,7 @@ async function ssrTransformScript(code, inMap, url, originalCode) {
|
|
|
51805
51808
|
if (!err.loc || !err.loc.line)
|
|
51806
51809
|
throw err;
|
|
51807
51810
|
const line = err.loc.line;
|
|
51808
|
-
throw new Error(`Parse failure: ${err.message}\nContents of line ${line}: ${code.split('\n')[line - 1]}`);
|
|
51811
|
+
throw new Error(`Parse failure: ${err.message}\nAt file: ${url}\nContents of line ${line}: ${code.split('\n')[line - 1]}`);
|
|
51809
51812
|
}
|
|
51810
51813
|
let uid = 0;
|
|
51811
51814
|
const deps = new Set();
|
|
@@ -52238,13 +52241,13 @@ function ssrRewriteStacktrace(stack, moduleGraph) {
|
|
|
52238
52241
|
if (!pos.source || pos.line == null || pos.column == null) {
|
|
52239
52242
|
return input;
|
|
52240
52243
|
}
|
|
52241
|
-
const
|
|
52244
|
+
const trimmedVarName = varName.trim();
|
|
52242
52245
|
const source = `${pos.source}:${pos.line}:${pos.column}`;
|
|
52243
|
-
if (!
|
|
52246
|
+
if (!trimmedVarName || trimmedVarName === 'eval') {
|
|
52244
52247
|
return ` at ${source}`;
|
|
52245
52248
|
}
|
|
52246
52249
|
else {
|
|
52247
|
-
return ` at ${
|
|
52250
|
+
return ` at ${trimmedVarName} (${source})`;
|
|
52248
52251
|
}
|
|
52249
52252
|
});
|
|
52250
52253
|
})
|
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-9912c491.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-9912c491.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-9912c491.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-9912c491.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-9912c491.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-9912c491.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.2",
|
|
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",
|