vite 5.1.6 → 5.2.0-beta.1
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/LICENSE.md +6 -0
- package/dist/client/client.mjs +30 -22
- package/dist/client/client.mjs.map +1 -1
- package/dist/node/chunks/{dep-pxQDj-UY.js → dep-BC11CTkQ.js} +145 -145
- package/dist/node/chunks/{dep-sFlFG1c_.js → dep-Q9IC80br.js} +2 -2
- package/dist/node/chunks/{dep-jvB8WLp9.js → dep-Zq4BZdyw.js} +1060 -877
- package/dist/node/cli.js +6 -6
- package/dist/node/index.d.ts +24 -4
- package/dist/node/index.js +3 -3
- package/dist/node/runtime.d.ts +2 -2
- package/dist/node/runtime.js +9 -6
- package/dist/node/{types.d-FdqQ54oU.d.ts → types.d-aGj9QkWt.d.ts} +1 -1
- package/dist/node-cjs/publicUtils.cjs +405 -405
- package/package.json +4 -3
- /package/dist/node/chunks/{dep-kjUoH5nk.js → dep-CrWVpuYf.js} +0 -0
- /package/dist/node/chunks/{dep-8a-6Quh6.js → dep-IQS-Za7F.js} +0 -0
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 colors, v as createLogger, r as resolveConfig } from './chunks/dep-
|
5
|
+
import { A as colors, v as createLogger, r as resolveConfig } from './chunks/dep-Zq4BZdyw.js';
|
6
6
|
import { VERSION } from './constants.js';
|
7
7
|
import 'node:fs/promises';
|
8
8
|
import 'node:url';
|
@@ -13,6 +13,7 @@ import 'path';
|
|
13
13
|
import 'esbuild';
|
14
14
|
import 'fs';
|
15
15
|
import 'assert';
|
16
|
+
import 'node:child_process';
|
16
17
|
import 'node:http';
|
17
18
|
import 'node:https';
|
18
19
|
import 'util';
|
@@ -23,7 +24,6 @@ import 'stream';
|
|
23
24
|
import 'os';
|
24
25
|
import 'child_process';
|
25
26
|
import 'node:os';
|
26
|
-
import 'node:child_process';
|
27
27
|
import 'node:crypto';
|
28
28
|
import 'node:dns';
|
29
29
|
import 'crypto';
|
@@ -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-Zq4BZdyw.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-Zq4BZdyw.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-Zq4BZdyw.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-Zq4BZdyw.js').then(function (n) { return n.G; });
|
893
893
|
try {
|
894
894
|
const server = await preview({
|
895
895
|
root,
|
package/dist/node/index.d.ts
CHANGED
@@ -15,8 +15,8 @@ import * as url from 'node:url';
|
|
15
15
|
import { URL } from 'node:url';
|
16
16
|
import * as stream from 'node:stream';
|
17
17
|
import { Duplex, DuplexOptions } from 'node:stream';
|
18
|
-
import { F as FetchResult, H as HMRLogger } from './types.d-
|
19
|
-
export { a as FetchFunction } from './types.d-
|
18
|
+
import { F as FetchResult, H as HMRLogger } from './types.d-aGj9QkWt.js';
|
19
|
+
export { a as FetchFunction } from './types.d-aGj9QkWt.js';
|
20
20
|
import { SecureContextOptions } from 'node:tls';
|
21
21
|
import { ZlibOptions } from 'node:zlib';
|
22
22
|
import { HMRPayload, CustomPayload } from '../../types/hmrPayload.js';
|
@@ -1776,6 +1776,14 @@ interface ViteDevServer {
|
|
1776
1776
|
* Open browser
|
1777
1777
|
*/
|
1778
1778
|
openBrowser(): void;
|
1779
|
+
/**
|
1780
|
+
* Calling `await server.waitForRequestsIdle(id)` will wait until all static imports
|
1781
|
+
* are processed. If called from a load or transform plugin hook, the id needs to be
|
1782
|
+
* passed as a parameter to avoid deadlocks. Calling this function after the first
|
1783
|
+
* static imports section of the module graph has been processed will resolve immediately.
|
1784
|
+
* @experimental
|
1785
|
+
*/
|
1786
|
+
waitForRequestsIdle: (ignoredId?: string) => Promise<void>;
|
1779
1787
|
}
|
1780
1788
|
interface ResolvedServerUrls {
|
1781
1789
|
local: string[];
|
@@ -2551,7 +2559,6 @@ interface DepsOptimizer {
|
|
2551
2559
|
isOptimizedDepFile: (id: string) => boolean;
|
2552
2560
|
isOptimizedDepUrl: (url: string) => boolean;
|
2553
2561
|
getOptimizedDepId: (depInfo: OptimizedDepInfo) => string;
|
2554
|
-
delayDepsOptimizerUntil: (id: string, done: () => Promise<any>) => void;
|
2555
2562
|
close: () => Promise<void>;
|
2556
2563
|
options: DepOptimizationOptions;
|
2557
2564
|
}
|
@@ -3192,6 +3199,10 @@ interface UserConfig {
|
|
3192
3199
|
resolve?: ResolveOptions & {
|
3193
3200
|
alias?: AliasOptions;
|
3194
3201
|
};
|
3202
|
+
/**
|
3203
|
+
* HTML related options
|
3204
|
+
*/
|
3205
|
+
html?: HTMLOptions;
|
3195
3206
|
/**
|
3196
3207
|
* CSS related options (preprocessors and CSS modules)
|
3197
3208
|
*/
|
@@ -3296,6 +3307,14 @@ interface UserConfig {
|
|
3296
3307
|
*/
|
3297
3308
|
appType?: AppType;
|
3298
3309
|
}
|
3310
|
+
interface HTMLOptions {
|
3311
|
+
/**
|
3312
|
+
* A nonce value placeholder that will be used when generating script/style tags.
|
3313
|
+
*
|
3314
|
+
* Make sure that this placeholder will be replaced with a unique value for each request by the server.
|
3315
|
+
*/
|
3316
|
+
cspNonce?: string;
|
3317
|
+
}
|
3299
3318
|
interface ExperimentalOptions {
|
3300
3319
|
/**
|
3301
3320
|
* Append fake `&lang.(ext)` when queries are specified, to preserve the file extension for following plugins to process.
|
@@ -3460,6 +3479,7 @@ interface ManifestChunk {
|
|
3460
3479
|
css?: string[];
|
3461
3480
|
assets?: string[];
|
3462
3481
|
isEntry?: boolean;
|
3482
|
+
name?: string;
|
3463
3483
|
isDynamicEntry?: boolean;
|
3464
3484
|
imports?: string[];
|
3465
3485
|
dynamicImports?: string[];
|
@@ -3501,4 +3521,4 @@ declare class ServerHMRConnector implements HMRRuntimeConnection {
|
|
3501
3521
|
onUpdate(handler: (payload: HMRPayload) => void): void;
|
3502
3522
|
}
|
3503
3523
|
|
3504
|
-
export { type Alias, type AliasOptions, type AnymatchFn, type AnymatchPattern, type AppType, type AwaitWriteFinishOptions, type BindCLIShortcutsOptions, type BuildOptions, type CLIShortcut, type CSSModulesOptions, type CSSOptions, type CommonServerOptions, type ConfigEnv, Connect, type CorsOptions, type CorsOrigin, type DepOptimizationConfig, type DepOptimizationMetadata, type DepOptimizationOptions, type ESBuildOptions, type ESBuildTransformResult, type ExperimentalOptions, type ExportsData, FSWatcher, type FetchModuleOptions, type FileSystemServeOptions, type FilterPattern, type HMRBroadcaster, type HMRBroadcasterClient, type HMRChannel, type HmrContext, type HmrOptions, type HookHandler, type HtmlTagDescriptor, HttpProxy, type IndexHtmlTransform, type IndexHtmlTransformContext, type IndexHtmlTransformHook, type IndexHtmlTransformResult, type InlineConfig, type InternalResolveOptions, type JsonOptions, type LegacyOptions, type LibraryFormats, type LibraryOptions, type LightningCSSOptions, type LogErrorOptions, type LogLevel, type LogOptions, type LogType, type Logger, type LoggerOptions, type MainThreadRuntimeOptions, type Manifest, type ManifestChunk, type MapToFunction, type AnymatchMatcher as Matcher, ModuleGraph, ModuleNode, type ModulePreloadOptions, type OptimizedDepInfo, type Plugin, type PluginContainer, type PluginHookUtils, type PluginOption, type PreprocessCSSResult, type PreviewOptions, type PreviewServer, type PreviewServerHook, type ProxyOptions, type RenderBuiltAssetUrl, type ResolveFn, type ResolveModulePreloadDependenciesFn, type ResolveOptions, type ResolvedBuildOptions, type ResolvedCSSOptions, type ResolvedConfig, type ResolvedModulePreloadOptions, type ResolvedPreviewOptions, type ResolvedSSROptions, type ResolvedServerOptions, type ResolvedServerUrls, type ResolvedUrl, type ResolvedWorkerOptions, type ResolverFunction, type ResolverObject, type RollupCommonJSOptions, type RollupDynamicImportVarsOptions, type SSROptions, type SSRTarget, type SendOptions, type ServerHMRChannel, ServerHMRConnector, type ServerHook, type ServerOptions, SplitVendorChunkCache, type SsrDepOptimizationOptions, Terser, type TerserOptions, type TransformOptions, type TransformResult, type UserConfig, type UserConfigExport, type UserConfigFn, type UserConfigFnObject, type UserConfigFnPromise, type ViteDevServer, type WatchOptions, WebSocket, WebSocketAlias, type WebSocketClient, type WebSocketCustomListener, WebSocketServer, build, buildErrorMessage, createFilter, createLogger, createServer, createViteRuntime, defineConfig, fetchModule, formatPostcssSourceMap, isCSSRequest, isFileServingAllowed, loadConfigFromFile, loadEnv, mergeAlias, mergeConfig, normalizePath, optimizeDeps, preprocessCSS, preview, resolveConfig, resolveEnvPrefix, rollupVersion, searchForWorkspaceRoot, send, sortUserPlugins, splitVendorChunk, splitVendorChunkPlugin, transformWithEsbuild, VERSION as version };
|
3524
|
+
export { type Alias, type AliasOptions, type AnymatchFn, type AnymatchPattern, type AppType, type AwaitWriteFinishOptions, type BindCLIShortcutsOptions, type BuildOptions, type CLIShortcut, type CSSModulesOptions, type CSSOptions, type CommonServerOptions, type ConfigEnv, Connect, type CorsOptions, type CorsOrigin, type DepOptimizationConfig, type DepOptimizationMetadata, type DepOptimizationOptions, type ESBuildOptions, type ESBuildTransformResult, type ExperimentalOptions, type ExportsData, FSWatcher, type FetchModuleOptions, type FileSystemServeOptions, type FilterPattern, type HMRBroadcaster, type HMRBroadcasterClient, type HMRChannel, type HTMLOptions, type HmrContext, type HmrOptions, type HookHandler, type HtmlTagDescriptor, HttpProxy, type IndexHtmlTransform, type IndexHtmlTransformContext, type IndexHtmlTransformHook, type IndexHtmlTransformResult, type InlineConfig, type InternalResolveOptions, type JsonOptions, type LegacyOptions, type LibraryFormats, type LibraryOptions, type LightningCSSOptions, type LogErrorOptions, type LogLevel, type LogOptions, type LogType, type Logger, type LoggerOptions, type MainThreadRuntimeOptions, type Manifest, type ManifestChunk, type MapToFunction, type AnymatchMatcher as Matcher, ModuleGraph, ModuleNode, type ModulePreloadOptions, type OptimizedDepInfo, type Plugin, type PluginContainer, type PluginHookUtils, type PluginOption, type PreprocessCSSResult, type PreviewOptions, type PreviewServer, type PreviewServerHook, type ProxyOptions, type RenderBuiltAssetUrl, type ResolveFn, type ResolveModulePreloadDependenciesFn, type ResolveOptions, type ResolvedBuildOptions, type ResolvedCSSOptions, type ResolvedConfig, type ResolvedModulePreloadOptions, type ResolvedPreviewOptions, type ResolvedSSROptions, type ResolvedServerOptions, type ResolvedServerUrls, type ResolvedUrl, type ResolvedWorkerOptions, type ResolverFunction, type ResolverObject, type RollupCommonJSOptions, type RollupDynamicImportVarsOptions, type SSROptions, type SSRTarget, type SendOptions, type ServerHMRChannel, ServerHMRConnector, type ServerHook, type ServerOptions, SplitVendorChunkCache, type SsrDepOptimizationOptions, Terser, type TerserOptions, type TransformOptions, type TransformResult, type UserConfig, type UserConfigExport, type UserConfigFn, type UserConfigFnObject, type UserConfigFnPromise, type ViteDevServer, type WatchOptions, WebSocket, WebSocketAlias, type WebSocketClient, type WebSocketCustomListener, WebSocketServer, build, buildErrorMessage, createFilter, createLogger, createServer, createViteRuntime, defineConfig, fetchModule, formatPostcssSourceMap, isCSSRequest, isFileServingAllowed, loadConfigFromFile, loadEnv, mergeAlias, mergeConfig, normalizePath, optimizeDeps, preprocessCSS, preview, resolveConfig, resolveEnvPrefix, rollupVersion, searchForWorkspaceRoot, send, sortUserPlugins, splitVendorChunk, splitVendorChunkPlugin, transformWithEsbuild, VERSION as version };
|
package/dist/node/index.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
export { parseAst, parseAstAsync } from 'rollup/parseAst';
|
2
|
-
import { i as isInNodeModules, a as arraify } from './chunks/dep-
|
3
|
-
export { b as build, g as buildErrorMessage, k as createFilter, v as createLogger, c as createServer, d as defineConfig, h as fetchModule, f as formatPostcssSourceMap, x as isFileServingAllowed, l as loadConfigFromFile, y as loadEnv, j as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, e as preprocessCSS, p as preview, r as resolveConfig, z as resolveEnvPrefix, q as rollupVersion, w as searchForWorkspaceRoot, u as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-
|
2
|
+
import { i as isInNodeModules, a as arraify } from './chunks/dep-Zq4BZdyw.js';
|
3
|
+
export { b as build, g as buildErrorMessage, k as createFilter, v as createLogger, c as createServer, d as defineConfig, h as fetchModule, f as formatPostcssSourceMap, x as isFileServingAllowed, l as loadConfigFromFile, y as loadEnv, j as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, e as preprocessCSS, p as preview, r as resolveConfig, z as resolveEnvPrefix, q as rollupVersion, w as searchForWorkspaceRoot, u as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-Zq4BZdyw.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';
|
@@ -16,6 +16,7 @@ import 'path';
|
|
16
16
|
import 'fs';
|
17
17
|
import 'events';
|
18
18
|
import 'assert';
|
19
|
+
import 'node:child_process';
|
19
20
|
import 'node:http';
|
20
21
|
import 'node:https';
|
21
22
|
import 'util';
|
@@ -26,7 +27,6 @@ import 'stream';
|
|
26
27
|
import 'os';
|
27
28
|
import 'child_process';
|
28
29
|
import 'node:os';
|
29
|
-
import 'node:child_process';
|
30
30
|
import 'node:crypto';
|
31
31
|
import 'node:dns';
|
32
32
|
import 'crypto';
|
package/dist/node/runtime.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import { V as ViteRuntimeOptions, b as ViteModuleRunner, M as ModuleCacheMap, c as HMRClient, R as ResolvedResult, d as ViteRuntimeModuleContext } from './types.d-
|
2
|
-
export { a as FetchFunction, F as FetchResult, e as HMRConnection, H as HMRLogger, g as HMRRuntimeConnection, f as ModuleCache, S as SSRImportMetadata, h as ViteRuntimeImportMeta, s as ssrDynamicImportKey, i as ssrExportAllKey, j as ssrImportKey, k as ssrImportMetaKey, l as ssrModuleExportsKey } from './types.d-
|
1
|
+
import { V as ViteRuntimeOptions, b as ViteModuleRunner, M as ModuleCacheMap, c as HMRClient, R as ResolvedResult, d as ViteRuntimeModuleContext } from './types.d-aGj9QkWt.js';
|
2
|
+
export { a as FetchFunction, F as FetchResult, e as HMRConnection, H as HMRLogger, g as HMRRuntimeConnection, f as ModuleCache, S as SSRImportMetadata, h as ViteRuntimeImportMeta, s as ssrDynamicImportKey, i as ssrExportAllKey, j as ssrImportKey, k as ssrImportMetaKey, l as ssrModuleExportsKey } from './types.d-aGj9QkWt.js';
|
3
3
|
import '../../types/hot.js';
|
4
4
|
import '../../types/hmrPayload.js';
|
5
5
|
import '../../types/customEvent.js';
|
package/dist/node/runtime.js
CHANGED
@@ -91,7 +91,7 @@ function posixPathToFileHref(posixPath) {
|
|
91
91
|
function toWindowsPath(path) {
|
92
92
|
return path.replace(/\//g, "\\");
|
93
93
|
}
|
94
|
-
const comma =
|
94
|
+
const comma = 44, chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", intToChar = new Uint8Array(64), charToInt = new Uint8Array(128);
|
95
95
|
for (let i = 0; i < chars.length; i++) {
|
96
96
|
const c = chars.charCodeAt(i);
|
97
97
|
intToChar[i] = c, charToInt[c] = i;
|
@@ -451,9 +451,12 @@ class HMRClient {
|
|
451
451
|
// After an HMR update, some modules are no longer imported on the page
|
452
452
|
// but they may have left behind side effects that need to be cleaned up
|
453
453
|
// (.e.g style injections)
|
454
|
-
|
455
|
-
|
456
|
-
|
454
|
+
async prunePaths(paths) {
|
455
|
+
await Promise.all(paths.map((path) => {
|
456
|
+
const disposer = this.disposeMap.get(path);
|
457
|
+
if (disposer)
|
458
|
+
return disposer(this.dataMap.get(path));
|
459
|
+
})), paths.forEach((path) => {
|
457
460
|
const fn = this.pruneMap.get(path);
|
458
461
|
fn && fn(this.dataMap.get(path));
|
459
462
|
});
|
@@ -561,7 +564,7 @@ async function handleHMRPayload(runtime, payload) {
|
|
561
564
|
break;
|
562
565
|
}
|
563
566
|
case "prune":
|
564
|
-
await hmrClient.notifyListeners("vite:beforePrune", payload), hmrClient.prunePaths(payload.paths);
|
567
|
+
await hmrClient.notifyListeners("vite:beforePrune", payload), await hmrClient.prunePaths(payload.paths);
|
565
568
|
break;
|
566
569
|
case "error": {
|
567
570
|
await hmrClient.notifyListeners("vite:error", payload);
|
@@ -766,7 +769,7 @@ function wrapCallSite(frame, state) {
|
|
766
769
|
state.curPosition = position, frame = cloneCallSite(frame);
|
767
770
|
const originalFunctionName = frame.getFunctionName;
|
768
771
|
return frame.getFunctionName = function() {
|
769
|
-
const name =
|
772
|
+
const name = state.nextPosition == null ? originalFunctionName() : state.nextPosition.name || originalFunctionName();
|
770
773
|
return name === "eval" && "_vite" in position ? null : name;
|
771
774
|
}, frame.getFileName = function() {
|
772
775
|
return position.source ?? void 0;
|
@@ -45,7 +45,7 @@ declare class HMRClient {
|
|
45
45
|
constructor(logger: HMRLogger, connection: HMRConnection, importUpdatedModule: (update: Update) => Promise<ModuleNamespace>);
|
46
46
|
notifyListeners<T extends string>(event: T, data: InferCustomEventPayload<T>): Promise<void>;
|
47
47
|
clear(): void;
|
48
|
-
prunePaths(paths: string[]): void
|
48
|
+
prunePaths(paths: string[]): Promise<void>;
|
49
49
|
protected warnFailedUpdate(err: Error, path: string | string[]): void;
|
50
50
|
private updateQueue;
|
51
51
|
private pendingUpdateQueue;
|