vite 5.1.3 → 5.1.5
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/client/client.mjs +1 -1
- package/dist/client/client.mjs.map +1 -1
- package/dist/node/chunks/{dep-stQc5rCc.js → dep-G-px366b.js} +298 -236
- package/dist/node/chunks/{dep-ZEDYRkoC.js → dep-OHeF5w5D.js} +14 -27
- package/dist/node/chunks/{dep-PB-S7R_m.js → dep-WMYkPWs9.js} +1 -1
- package/dist/node/cli.js +5 -5
- package/dist/node/constants.js +1 -17
- package/dist/node/index.d.ts +3 -2
- package/dist/node/index.js +3 -3
- package/dist/node/runtime.d.ts +54 -3
- package/dist/node/runtime.js +929 -1525
- package/dist/node/{types.d-jgA8ss1A.d.ts → types.d-AKzkD8vd.d.ts} +6 -52
- package/dist/node-cjs/publicUtils.cjs +69 -64
- package/package.json +9 -7
- package/types/hmrPayload.d.ts +2 -0
@@ -96,6 +96,11 @@ declare class ModuleCacheMap extends Map<string, ModuleCache> {
|
|
96
96
|
get(fsPath: string): ModuleCache;
|
97
97
|
deleteByModuleId(modulePath: string): boolean;
|
98
98
|
delete(fsPath: string): boolean;
|
99
|
+
invalidate(id: string): void;
|
100
|
+
isImported({ importedId, importedBy, }: {
|
101
|
+
importedId: string;
|
102
|
+
importedBy: string;
|
103
|
+
}, seen?: Set<string>): boolean;
|
99
104
|
/**
|
100
105
|
* Invalidate modules that dependent on the given modules, up to the main entry
|
101
106
|
*/
|
@@ -113,57 +118,6 @@ declare const ssrDynamicImportKey = "__vite_ssr_dynamic_import__";
|
|
113
118
|
declare const ssrExportAllKey = "__vite_ssr_exportAll__";
|
114
119
|
declare const ssrImportMetaKey = "__vite_ssr_import_meta__";
|
115
120
|
|
116
|
-
interface ViteRuntimeDebugger {
|
117
|
-
(formatter: unknown, ...args: unknown[]): void;
|
118
|
-
}
|
119
|
-
declare class ViteRuntime {
|
120
|
-
options: ViteRuntimeOptions;
|
121
|
-
runner: ViteModuleRunner;
|
122
|
-
private debug?;
|
123
|
-
/**
|
124
|
-
* Holds the cache of modules
|
125
|
-
* Keys of the map are ids
|
126
|
-
*/
|
127
|
-
moduleCache: ModuleCacheMap;
|
128
|
-
hmrClient?: HMRClient;
|
129
|
-
entrypoints: Set<string>;
|
130
|
-
private idToUrlMap;
|
131
|
-
private fileToIdMap;
|
132
|
-
private envProxy;
|
133
|
-
private _destroyed;
|
134
|
-
private _resetSourceMapSupport?;
|
135
|
-
constructor(options: ViteRuntimeOptions, runner: ViteModuleRunner, debug?: ViteRuntimeDebugger | undefined);
|
136
|
-
/**
|
137
|
-
* URL to execute. Accepts file path, server path or id relative to the root.
|
138
|
-
*/
|
139
|
-
executeUrl<T = any>(url: string): Promise<T>;
|
140
|
-
/**
|
141
|
-
* Entrypoint URL to execute. Accepts file path, server path or id relative to the root.
|
142
|
-
* In the case of a full reload triggered by HMR, this is the module that will be reloaded.
|
143
|
-
* If this method is called multiple times, all entrypoints will be reloaded one at a time.
|
144
|
-
*/
|
145
|
-
executeEntrypoint<T = any>(url: string): Promise<T>;
|
146
|
-
/**
|
147
|
-
* Clear all caches including HMR listeners.
|
148
|
-
*/
|
149
|
-
clearCache(): void;
|
150
|
-
/**
|
151
|
-
* Clears all caches, removes all HMR listeners, and resets source map support.
|
152
|
-
* This method doesn't stop the HMR connection.
|
153
|
-
*/
|
154
|
-
destroy(): Promise<void>;
|
155
|
-
/**
|
156
|
-
* Returns `true` if the runtime has been destroyed by calling `destroy()` method.
|
157
|
-
*/
|
158
|
-
isDestroyed(): boolean;
|
159
|
-
private invalidateFiles;
|
160
|
-
private normalizeEntryUrl;
|
161
|
-
private processImport;
|
162
|
-
private cachedRequest;
|
163
|
-
private cachedModule;
|
164
|
-
protected directRequest(id: string, fetchResult: ResolvedResult, _callstack: string[]): Promise<any>;
|
165
|
-
}
|
166
|
-
|
167
121
|
interface RetrieveFileHandler {
|
168
122
|
(path: string): string | null | undefined | false;
|
169
123
|
}
|
@@ -321,4 +275,4 @@ interface ImportMetaEnv {
|
|
321
275
|
SSR: boolean;
|
322
276
|
}
|
323
277
|
|
324
|
-
export { type FetchResult as F, type HMRLogger as H, ModuleCacheMap as M, type ResolvedResult as R, type SSRImportMetadata as S, type ViteRuntimeOptions as V, type
|
278
|
+
export { type FetchResult as F, type HMRLogger as H, ModuleCacheMap as M, type ResolvedResult as R, type SSRImportMetadata as S, type ViteRuntimeOptions as V, type FetchFunction as a, type ViteModuleRunner as b, HMRClient as c, type ViteRuntimeModuleContext as d, type HMRConnection as e, type ModuleCache as f, type HMRRuntimeConnection as g, type ViteRuntimeImportMeta as h, ssrExportAllKey as i, ssrImportKey as j, ssrImportMetaKey as k, ssrModuleExportsKey as l, ssrDynamicImportKey as s };
|
@@ -4,7 +4,6 @@ var path$3 = require('node:path');
|
|
4
4
|
var node_url = require('node:url');
|
5
5
|
var fs$1 = require('node:fs');
|
6
6
|
var esbuild = require('esbuild');
|
7
|
-
var os$1 = require('node:os');
|
8
7
|
var node_module = require('node:module');
|
9
8
|
var require$$0 = require('tty');
|
10
9
|
var require$$1 = require('util');
|
@@ -116,18 +115,6 @@ function encodeInteger(buf, pos, state, segment, j) {
|
|
116
115
|
return pos;
|
117
116
|
}
|
118
117
|
|
119
|
-
// Matches the scheme of a URL, eg "http://"
|
120
|
-
var UrlType;
|
121
|
-
(function (UrlType) {
|
122
|
-
UrlType[UrlType["Empty"] = 1] = "Empty";
|
123
|
-
UrlType[UrlType["Hash"] = 2] = "Hash";
|
124
|
-
UrlType[UrlType["Query"] = 3] = "Query";
|
125
|
-
UrlType[UrlType["RelativePath"] = 4] = "RelativePath";
|
126
|
-
UrlType[UrlType["AbsolutePath"] = 5] = "AbsolutePath";
|
127
|
-
UrlType[UrlType["SchemeRelative"] = 6] = "SchemeRelative";
|
128
|
-
UrlType[UrlType["Absolute"] = 7] = "Absolute";
|
129
|
-
})(UrlType || (UrlType = {}));
|
130
|
-
|
131
118
|
function getDefaultExportFromCjs (x) {
|
132
119
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
133
120
|
}
|
@@ -3355,6 +3342,22 @@ const builtins = 'arguments Infinity NaN undefined null true false eval uneval i
|
|
3355
3342
|
const forbiddenIdentifiers = new Set(`${reservedWords} ${builtins}`.split(' '));
|
3356
3343
|
forbiddenIdentifiers.add('');
|
3357
3344
|
|
3345
|
+
const isWindows = typeof process !== 'undefined' && process.platform === 'win32';
|
3346
|
+
const windowsSlashRE = /\\/g;
|
3347
|
+
function slash(p) {
|
3348
|
+
return p.replace(windowsSlashRE, '/');
|
3349
|
+
}
|
3350
|
+
const postfixRE = /[?#].*$/;
|
3351
|
+
function cleanUrl(url) {
|
3352
|
+
return url.replace(postfixRE, '');
|
3353
|
+
}
|
3354
|
+
function withTrailingSlash(path) {
|
3355
|
+
if (path[path.length - 1] !== '/') {
|
3356
|
+
return `${path}/`;
|
3357
|
+
}
|
3358
|
+
return path;
|
3359
|
+
}
|
3360
|
+
|
3358
3361
|
if (process.versions.pnp) {
|
3359
3362
|
try {
|
3360
3363
|
node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('node-cjs/publicUtils.cjs', document.baseURI).href)))('pnpapi');
|
@@ -3363,10 +3366,6 @@ if (process.versions.pnp) {
|
|
3363
3366
|
}
|
3364
3367
|
|
3365
3368
|
const createFilter = createFilter$1;
|
3366
|
-
const windowsSlashRE = /\\/g;
|
3367
|
-
function slash(p) {
|
3368
|
-
return p.replace(windowsSlashRE, '/');
|
3369
|
-
}
|
3370
3369
|
// Some runtimes like Bun injects namespaced modules here, which is not a node builtin
|
3371
3370
|
node_module.builtinModules.filter((id) => !id.includes(':'));
|
3372
3371
|
function isInNodeModules(id) {
|
@@ -3409,7 +3408,6 @@ function testCaseInsensitiveFS() {
|
|
3409
3408
|
return fs$1.existsSync(CLIENT_ENTRY.replace('client.mjs', 'cLiEnT.mjs'));
|
3410
3409
|
}
|
3411
3410
|
const isCaseInsensitiveFS = testCaseInsensitiveFS();
|
3412
|
-
const isWindows = os$1.platform() === 'win32';
|
3413
3411
|
const VOLUME_RE = /^[A-Z]:/i;
|
3414
3412
|
function normalizePath(id) {
|
3415
3413
|
return path$3.posix.normalize(isWindows ? slash(id) : id);
|
@@ -3421,12 +3419,6 @@ function fsPathFromId(id) {
|
|
3421
3419
|
function fsPathFromUrl(url) {
|
3422
3420
|
return fsPathFromId(cleanUrl(url));
|
3423
3421
|
}
|
3424
|
-
function withTrailingSlash(path) {
|
3425
|
-
if (path[path.length - 1] !== '/') {
|
3426
|
-
return `${path}/`;
|
3427
|
-
}
|
3428
|
-
return path;
|
3429
|
-
}
|
3430
3422
|
/**
|
3431
3423
|
* Check if dir is a parent of file
|
3432
3424
|
*
|
@@ -3454,10 +3446,6 @@ function isSameFileUri(file1, file2) {
|
|
3454
3446
|
return (file1 === file2 ||
|
3455
3447
|
(isCaseInsensitiveFS && file1.toLowerCase() === file2.toLowerCase()));
|
3456
3448
|
}
|
3457
|
-
const postfixRE = /[?#].*$/s;
|
3458
|
-
function cleanUrl(url) {
|
3459
|
-
return url.replace(postfixRE, '');
|
3460
|
-
}
|
3461
3449
|
const trailingSeparatorRE = /[?&]$/;
|
3462
3450
|
const timestampRE = /\bt=\d{13}&?\b/;
|
3463
3451
|
function removeTimestampQuery(url) {
|
@@ -5577,7 +5565,7 @@ function isFileServingAllowed(url, server) {
|
|
5577
5565
|
var main$1 = {exports: {}};
|
5578
5566
|
|
5579
5567
|
var name = "dotenv";
|
5580
|
-
var version$1 = "16.4.
|
5568
|
+
var version$1 = "16.4.5";
|
5581
5569
|
var description = "Loads environment variables from .env file";
|
5582
5570
|
var main = "lib/main.js";
|
5583
5571
|
var types = "lib/main.d.ts";
|
@@ -5601,6 +5589,7 @@ var scripts = {
|
|
5601
5589
|
"lint-readme": "standard-markdown",
|
5602
5590
|
pretest: "npm run lint && npm run dts-check",
|
5603
5591
|
test: "tap tests/*.js --100 -Rspec",
|
5592
|
+
"test:coverage": "tap --coverage-report=lcov",
|
5604
5593
|
prerelease: "npm test",
|
5605
5594
|
release: "standard-version"
|
5606
5595
|
};
|
@@ -5861,52 +5850,59 @@ function _configVault (options) {
|
|
5861
5850
|
}
|
5862
5851
|
|
5863
5852
|
function configDotenv (options) {
|
5864
|
-
|
5853
|
+
const dotenvPath = path.resolve(process.cwd(), '.env');
|
5865
5854
|
let encoding = 'utf8';
|
5866
5855
|
const debug = Boolean(options && options.debug);
|
5867
5856
|
|
5868
|
-
if (options) {
|
5869
|
-
|
5870
|
-
|
5871
|
-
|
5872
|
-
|
5873
|
-
for (const filepath of options.path) {
|
5874
|
-
if (fs.existsSync(filepath)) {
|
5875
|
-
envPath = filepath;
|
5876
|
-
break
|
5877
|
-
}
|
5878
|
-
}
|
5879
|
-
}
|
5880
|
-
|
5881
|
-
dotenvPath = _resolveHome(envPath);
|
5857
|
+
if (options && options.encoding) {
|
5858
|
+
encoding = options.encoding;
|
5859
|
+
} else {
|
5860
|
+
if (debug) {
|
5861
|
+
_debug('No encoding is specified. UTF-8 is used by default');
|
5882
5862
|
}
|
5883
|
-
|
5884
|
-
|
5863
|
+
}
|
5864
|
+
|
5865
|
+
let optionPaths = [dotenvPath]; // default, look for .env
|
5866
|
+
if (options && options.path) {
|
5867
|
+
if (!Array.isArray(options.path)) {
|
5868
|
+
optionPaths = [_resolveHome(options.path)];
|
5885
5869
|
} else {
|
5886
|
-
|
5887
|
-
|
5870
|
+
optionPaths = []; // reset default
|
5871
|
+
for (const filepath of options.path) {
|
5872
|
+
optionPaths.push(_resolveHome(filepath));
|
5888
5873
|
}
|
5889
5874
|
}
|
5890
5875
|
}
|
5891
5876
|
|
5892
|
-
|
5893
|
-
|
5894
|
-
|
5877
|
+
// Build the parsed data in a temporary object (because we need to return it). Once we have the final
|
5878
|
+
// parsed data, we will combine it with process.env (or options.processEnv if provided).
|
5879
|
+
let lastError;
|
5880
|
+
const parsedAll = {};
|
5881
|
+
for (const path of optionPaths) {
|
5882
|
+
try {
|
5883
|
+
// Specifying an encoding returns a string instead of a buffer
|
5884
|
+
const parsed = DotenvModule.parse(fs.readFileSync(path, { encoding }));
|
5895
5885
|
|
5896
|
-
|
5897
|
-
|
5898
|
-
|
5886
|
+
DotenvModule.populate(parsedAll, parsed, options);
|
5887
|
+
} catch (e) {
|
5888
|
+
if (debug) {
|
5889
|
+
_debug(`Failed to load ${path} ${e.message}`);
|
5890
|
+
}
|
5891
|
+
lastError = e;
|
5899
5892
|
}
|
5893
|
+
}
|
5900
5894
|
|
5901
|
-
|
5895
|
+
let processEnv = process.env;
|
5896
|
+
if (options && options.processEnv != null) {
|
5897
|
+
processEnv = options.processEnv;
|
5898
|
+
}
|
5902
5899
|
|
5903
|
-
|
5904
|
-
} catch (e) {
|
5905
|
-
if (debug) {
|
5906
|
-
_debug(`Failed to load ${dotenvPath} ${e.message}`);
|
5907
|
-
}
|
5900
|
+
DotenvModule.populate(processEnv, parsedAll, options);
|
5908
5901
|
|
5909
|
-
|
5902
|
+
if (lastError) {
|
5903
|
+
return { parsed: parsedAll, error: lastError }
|
5904
|
+
} else {
|
5905
|
+
return { parsed: parsedAll }
|
5910
5906
|
}
|
5911
5907
|
}
|
5912
5908
|
|
@@ -6033,11 +6029,21 @@ function interpolate (value, processEnv, parsed) {
|
|
6033
6029
|
return match.slice(1)
|
6034
6030
|
} else {
|
6035
6031
|
if (processEnv[key]) {
|
6036
|
-
|
6032
|
+
if (processEnv[key] === parsed[key]) {
|
6033
|
+
return processEnv[key]
|
6034
|
+
} else {
|
6035
|
+
// scenario: PASSWORD_EXPAND_NESTED=${PASSWORD_EXPAND}
|
6036
|
+
return interpolate(processEnv[key], processEnv, parsed)
|
6037
|
+
}
|
6037
6038
|
}
|
6038
6039
|
|
6039
6040
|
if (parsed[key]) {
|
6040
|
-
|
6041
|
+
// avoid recursion from EXPAND_SELF=$EXPAND_SELF
|
6042
|
+
if (parsed[key] === value) {
|
6043
|
+
return parsed[key]
|
6044
|
+
} else {
|
6045
|
+
return interpolate(parsed[key], processEnv, parsed)
|
6046
|
+
}
|
6041
6047
|
}
|
6042
6048
|
|
6043
6049
|
if (defaultValue) {
|
@@ -6063,7 +6069,6 @@ function expand (options) {
|
|
6063
6069
|
let value = options.parsed[key];
|
6064
6070
|
|
6065
6071
|
const inProcessEnv = Object.prototype.hasOwnProperty.call(processEnv, key);
|
6066
|
-
|
6067
6072
|
if (inProcessEnv) {
|
6068
6073
|
if (processEnv[key] === options.parsed[key]) {
|
6069
6074
|
// assume was set to processEnv from the .env file if the values match and therefore interpolate
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "vite",
|
3
|
-
"version": "5.1.
|
3
|
+
"version": "5.1.5",
|
4
4
|
"type": "module",
|
5
5
|
"license": "MIT",
|
6
6
|
"author": "Evan You",
|
@@ -82,7 +82,7 @@
|
|
82
82
|
"devDependencies": {
|
83
83
|
"@ampproject/remapping": "^2.2.1",
|
84
84
|
"@babel/parser": "^7.23.9",
|
85
|
-
"@jridgewell/trace-mapping": "^0.3.
|
85
|
+
"@jridgewell/trace-mapping": "^0.3.23",
|
86
86
|
"@rollup/plugin-alias": "^5.1.0",
|
87
87
|
"@rollup/plugin-commonjs": "^25.0.7",
|
88
88
|
"@rollup/plugin-dynamic-import-vars": "^2.1.2",
|
@@ -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": "^11.0.
|
106
|
+
"dotenv": "^16.4.5",
|
107
|
+
"dotenv-expand": "^11.0.6",
|
108
108
|
"es-module-lexer": "^1.4.1",
|
109
109
|
"escape-html": "^1.0.3",
|
110
110
|
"estree-walker": "^3.0.3",
|
@@ -112,21 +112,23 @@
|
|
112
112
|
"fast-glob": "^3.3.2",
|
113
113
|
"http-proxy": "^1.18.1",
|
114
114
|
"launch-editor-middleware": "^2.6.1",
|
115
|
-
"lightningcss": "^1.
|
115
|
+
"lightningcss": "^1.24.0",
|
116
116
|
"magic-string": "^0.30.7",
|
117
117
|
"micromatch": "^4.0.5",
|
118
|
-
"mlly": "^1.
|
118
|
+
"mlly": "^1.6.1",
|
119
119
|
"mrmime": "^2.0.0",
|
120
120
|
"open": "^8.4.2",
|
121
121
|
"parse5": "^7.1.2",
|
122
|
+
"pathe": "^1.1.2",
|
122
123
|
"periscopic": "^4.0.2",
|
123
124
|
"picocolors": "^1.0.0",
|
124
125
|
"picomatch": "^2.3.1",
|
125
|
-
"postcss-import": "^16.0.
|
126
|
+
"postcss-import": "^16.0.1",
|
126
127
|
"postcss-load-config": "^4.0.2",
|
127
128
|
"postcss-modules": "^6.0.0",
|
128
129
|
"resolve.exports": "^2.0.2",
|
129
130
|
"rollup-plugin-dts": "^6.1.0",
|
131
|
+
"rollup-plugin-esbuild": "^6.1.1",
|
130
132
|
"rollup-plugin-license": "^3.2.0",
|
131
133
|
"sirv": "^2.0.4",
|
132
134
|
"source-map-support": "^0.5.21",
|