vite 5.1.4 → 5.1.6
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-jDlpJiMN.js → dep-jvB8WLp9.js} +553 -439
- package/dist/node/chunks/{dep-g6LmopN4.js → dep-pxQDj-UY.js} +1 -1
- package/dist/node/chunks/{dep-wALyWXZB.js → dep-sFlFG1c_.js} +1 -1
- package/dist/node/cli.js +5 -5
- package/dist/node/constants.js +1 -17
- package/dist/node/index.d.ts +6 -5
- package/dist/node/index.js +3 -3
- package/dist/node/runtime.d.ts +54 -3
- package/dist/node/runtime.js +934 -1527
- package/dist/node/{types.d-jgA8ss1A.d.ts → types.d-FdqQ54oU.d.ts} +24 -67
- package/dist/node-cjs/publicUtils.cjs +49 -62
- package/package.json +12 -10
- package/types/hmrPayload.d.ts +2 -0
@@ -58,6 +58,22 @@ declare class HMRClient {
|
|
58
58
|
private fetchUpdate;
|
59
59
|
}
|
60
60
|
|
61
|
+
interface DefineImportMetadata {
|
62
|
+
/**
|
63
|
+
* Imported names before being transformed to `ssrImportKey`
|
64
|
+
*
|
65
|
+
* import foo, { bar as baz, qux } from 'hello'
|
66
|
+
* => ['default', 'bar', 'qux']
|
67
|
+
*
|
68
|
+
* import * as namespace from 'world
|
69
|
+
* => undefined
|
70
|
+
*/
|
71
|
+
importedNames?: string[];
|
72
|
+
}
|
73
|
+
interface SSRImportBaseMetadata extends DefineImportMetadata {
|
74
|
+
isDynamicImport?: boolean;
|
75
|
+
}
|
76
|
+
|
61
77
|
interface SourceMapLike {
|
62
78
|
version: number;
|
63
79
|
mappings?: string;
|
@@ -96,6 +112,11 @@ declare class ModuleCacheMap extends Map<string, ModuleCache> {
|
|
96
112
|
get(fsPath: string): ModuleCache;
|
97
113
|
deleteByModuleId(modulePath: string): boolean;
|
98
114
|
delete(fsPath: string): boolean;
|
115
|
+
invalidate(id: string): void;
|
116
|
+
isImported({ importedId, importedBy, }: {
|
117
|
+
importedId: string;
|
118
|
+
importedBy: string;
|
119
|
+
}, seen?: Set<string>): boolean;
|
99
120
|
/**
|
100
121
|
* Invalidate modules that dependent on the given modules, up to the main entry
|
101
122
|
*/
|
@@ -113,57 +134,6 @@ declare const ssrDynamicImportKey = "__vite_ssr_dynamic_import__";
|
|
113
134
|
declare const ssrExportAllKey = "__vite_ssr_exportAll__";
|
114
135
|
declare const ssrImportMetaKey = "__vite_ssr_import_meta__";
|
115
136
|
|
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
137
|
interface RetrieveFileHandler {
|
168
138
|
(path: string): string | null | undefined | false;
|
169
139
|
}
|
@@ -178,17 +148,8 @@ interface InterceptorOptions {
|
|
178
148
|
retrieveSourceMap?: RetrieveSourceMapHandler;
|
179
149
|
}
|
180
150
|
|
181
|
-
interface
|
182
|
-
|
183
|
-
* Imported names before being transformed to `ssrImportKey`
|
184
|
-
*
|
185
|
-
* import foo, { bar as baz, qux } from 'hello'
|
186
|
-
* => ['default', 'bar', 'qux']
|
187
|
-
*
|
188
|
-
* import * as namespace from 'world
|
189
|
-
* => undefined
|
190
|
-
*/
|
191
|
-
importedNames?: string[];
|
151
|
+
interface SSRImportMetadata extends SSRImportBaseMetadata {
|
152
|
+
entrypoint?: boolean;
|
192
153
|
}
|
193
154
|
interface HMRRuntimeConnection extends HMRConnection {
|
194
155
|
/**
|
@@ -197,10 +158,6 @@ interface HMRRuntimeConnection extends HMRConnection {
|
|
197
158
|
*/
|
198
159
|
onUpdate(callback: (payload: HMRPayload) => void): void;
|
199
160
|
}
|
200
|
-
interface SSRImportMetadata extends DefineImportMetadata {
|
201
|
-
isDynamicImport?: boolean;
|
202
|
-
entrypoint?: boolean;
|
203
|
-
}
|
204
161
|
interface ViteRuntimeImportMeta extends ImportMeta {
|
205
162
|
url: string;
|
206
163
|
env: ImportMetaEnv;
|
@@ -321,4 +278,4 @@ interface ImportMetaEnv {
|
|
321
278
|
SSR: boolean;
|
322
279
|
}
|
323
280
|
|
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
|
281
|
+
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 = /[?#].*$/;
|
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) {
|
@@ -3536,7 +3524,7 @@ function mergeConfigRecursively(defaults, overrides, rootPath) {
|
|
3536
3524
|
continue;
|
3537
3525
|
}
|
3538
3526
|
if (Array.isArray(existing) || Array.isArray(value)) {
|
3539
|
-
merged[key] = [...arraify(existing
|
3527
|
+
merged[key] = [...arraify(existing), ...arraify(value)];
|
3540
3528
|
continue;
|
3541
3529
|
}
|
3542
3530
|
if (isObject$1(existing) && isObject$1(value)) {
|
@@ -4395,9 +4383,12 @@ class Mappings {
|
|
4395
4383
|
|
4396
4384
|
addEdit(sourceIndex, content, loc, nameIndex) {
|
4397
4385
|
if (content.length) {
|
4386
|
+
const contentLengthMinusOne = content.length - 1;
|
4398
4387
|
let contentLineEnd = content.indexOf('\n', 0);
|
4399
4388
|
let previousContentLineEnd = -1;
|
4400
|
-
|
4389
|
+
// Loop through each line in the content and add a segment, but stop if the last line is empty,
|
4390
|
+
// else code afterwards would fill one line too many
|
4391
|
+
while (contentLineEnd >= 0 && contentLengthMinusOne > contentLineEnd) {
|
4401
4392
|
const segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];
|
4402
4393
|
if (nameIndex >= 0) {
|
4403
4394
|
segment.push(nameIndex);
|
@@ -5577,7 +5568,7 @@ function isFileServingAllowed(url, server) {
|
|
5577
5568
|
var main$1 = {exports: {}};
|
5578
5569
|
|
5579
5570
|
var name = "dotenv";
|
5580
|
-
var version$1 = "16.4.
|
5571
|
+
var version$1 = "16.4.5";
|
5581
5572
|
var description = "Loads environment variables from .env file";
|
5582
5573
|
var main = "lib/main.js";
|
5583
5574
|
var types = "lib/main.d.ts";
|
@@ -5874,52 +5865,48 @@ function configDotenv (options) {
|
|
5874
5865
|
}
|
5875
5866
|
}
|
5876
5867
|
|
5877
|
-
let
|
5868
|
+
let optionPaths = [dotenvPath]; // default, look for .env
|
5878
5869
|
if (options && options.path) {
|
5879
5870
|
if (!Array.isArray(options.path)) {
|
5880
|
-
|
5881
|
-
optionPathsThatExist = [_resolveHome(options.path)];
|
5882
|
-
}
|
5871
|
+
optionPaths = [_resolveHome(options.path)];
|
5883
5872
|
} else {
|
5873
|
+
optionPaths = []; // reset default
|
5884
5874
|
for (const filepath of options.path) {
|
5885
|
-
|
5886
|
-
optionPathsThatExist.push(_resolveHome(filepath));
|
5887
|
-
}
|
5875
|
+
optionPaths.push(_resolveHome(filepath));
|
5888
5876
|
}
|
5889
5877
|
}
|
5890
|
-
|
5891
|
-
if (!optionPathsThatExist.length) {
|
5892
|
-
optionPathsThatExist = [dotenvPath];
|
5893
|
-
}
|
5894
5878
|
}
|
5895
5879
|
|
5896
|
-
// If we have options.path, and it had valid paths, use them. Else fall back to .env
|
5897
|
-
const pathsToProcess = optionPathsThatExist.length ? optionPathsThatExist : [dotenvPath];
|
5898
|
-
|
5899
5880
|
// Build the parsed data in a temporary object (because we need to return it). Once we have the final
|
5900
5881
|
// parsed data, we will combine it with process.env (or options.processEnv if provided).
|
5901
|
-
|
5902
|
-
const
|
5903
|
-
|
5904
|
-
|
5882
|
+
let lastError;
|
5883
|
+
const parsedAll = {};
|
5884
|
+
for (const path of optionPaths) {
|
5885
|
+
try {
|
5905
5886
|
// Specifying an encoding returns a string instead of a buffer
|
5906
|
-
const
|
5907
|
-
DotenvModule.populate(parsed, singleFileParsed, options);
|
5908
|
-
}
|
5887
|
+
const parsed = DotenvModule.parse(fs.readFileSync(path, { encoding }));
|
5909
5888
|
|
5910
|
-
|
5911
|
-
|
5912
|
-
|
5889
|
+
DotenvModule.populate(parsedAll, parsed, options);
|
5890
|
+
} catch (e) {
|
5891
|
+
if (debug) {
|
5892
|
+
_debug(`Failed to load ${path} ${e.message}`);
|
5893
|
+
}
|
5894
|
+
lastError = e;
|
5913
5895
|
}
|
5896
|
+
}
|
5914
5897
|
|
5915
|
-
|
5916
|
-
|
5917
|
-
|
5918
|
-
|
5919
|
-
|
5920
|
-
|
5898
|
+
let processEnv = process.env;
|
5899
|
+
if (options && options.processEnv != null) {
|
5900
|
+
processEnv = options.processEnv;
|
5901
|
+
}
|
5902
|
+
|
5903
|
+
DotenvModule.populate(processEnv, parsedAll, options);
|
5904
|
+
|
5905
|
+
if (lastError) {
|
5906
|
+
return { parsed: parsedAll, error: lastError }
|
5907
|
+
} else {
|
5908
|
+
return { parsed: parsedAll }
|
5921
5909
|
}
|
5922
|
-
return { parsed }
|
5923
5910
|
}
|
5924
5911
|
|
5925
5912
|
// Populates process.env from .env file
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "vite",
|
3
|
-
"version": "5.1.
|
3
|
+
"version": "5.1.6",
|
4
4
|
"type": "module",
|
5
5
|
"license": "MIT",
|
6
6
|
"author": "Evan You",
|
@@ -80,9 +80,9 @@
|
|
80
80
|
"fsevents": "~2.3.3"
|
81
81
|
},
|
82
82
|
"devDependencies": {
|
83
|
-
"@ampproject/remapping": "^2.
|
84
|
-
"@babel/parser": "^7.
|
85
|
-
"@jridgewell/trace-mapping": "^0.3.
|
83
|
+
"@ampproject/remapping": "^2.3.0",
|
84
|
+
"@babel/parser": "^7.24.0",
|
85
|
+
"@jridgewell/trace-mapping": "^0.3.25",
|
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,7 +103,7 @@
|
|
103
103
|
"cross-spawn": "^7.0.3",
|
104
104
|
"debug": "^4.3.4",
|
105
105
|
"dep-types": "link:./src/types",
|
106
|
-
"dotenv": "^16.4.
|
106
|
+
"dotenv": "^16.4.5",
|
107
107
|
"dotenv-expand": "^11.0.6",
|
108
108
|
"es-module-lexer": "^1.4.1",
|
109
109
|
"escape-html": "^1.0.3",
|
@@ -112,13 +112,14 @@
|
|
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.
|
116
|
-
"magic-string": "^0.30.
|
115
|
+
"lightningcss": "^1.24.0",
|
116
|
+
"magic-string": "^0.30.8",
|
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",
|
@@ -127,12 +128,13 @@
|
|
127
128
|
"postcss-modules": "^6.0.0",
|
128
129
|
"resolve.exports": "^2.0.2",
|
129
130
|
"rollup-plugin-dts": "^6.1.0",
|
130
|
-
"rollup-plugin-
|
131
|
+
"rollup-plugin-esbuild": "^6.1.1",
|
132
|
+
"rollup-plugin-license": "^3.3.1",
|
131
133
|
"sirv": "^2.0.4",
|
132
134
|
"source-map-support": "^0.5.21",
|
133
135
|
"strip-ansi": "^7.1.0",
|
134
136
|
"strip-literal": "^2.0.0",
|
135
|
-
"tsconfck": "^3.0.
|
137
|
+
"tsconfck": "^3.0.3",
|
136
138
|
"tslib": "^2.6.2",
|
137
139
|
"types": "link:./types",
|
138
140
|
"ufo": "^1.4.0",
|