vite 5.2.11 → 5.3.0-beta.0
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 +1 -59
- package/dist/node/chunks/{dep-cNe07EU9.js → dep-BBErwUJM.js} +5701 -10694
- package/dist/node/chunks/{dep-DyOjWWe9.js → dep-BPjeYeh_.js} +1 -1
- package/dist/node/chunks/{dep-BcfrWFrf.js → dep-CTAUzmEN.js} +1 -1
- package/dist/node/cli.js +6 -6
- package/dist/node/index.d.ts +44 -18
- package/dist/node/index.js +5 -5
- package/dist/node/runtime.js +18 -30
- package/dist/node-cjs/publicUtils.cjs +65 -43
- package/package.json +13 -15
- package/types/customEvent.d.ts +1 -0
@@ -1,4 +1,4 @@
|
|
1
|
-
import { C as commonjsGlobal, B as getDefaultExportFromCjs } from './dep-
|
1
|
+
import { C as commonjsGlobal, B as getDefaultExportFromCjs } from './dep-BBErwUJM.js';
|
2
2
|
import require$$0__default from 'fs';
|
3
3
|
import require$$0 from 'postcss';
|
4
4
|
import require$$0$1 from 'path';
|
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-BBErwUJM.js';
|
6
6
|
import { VERSION } from './constants.js';
|
7
7
|
import 'node:fs/promises';
|
8
8
|
import 'node:url';
|
@@ -32,8 +32,8 @@ import 'node:assert';
|
|
32
32
|
import 'node:v8';
|
33
33
|
import 'node:worker_threads';
|
34
34
|
import 'node:buffer';
|
35
|
-
import 'node:events';
|
36
35
|
import 'rollup/parseAst';
|
36
|
+
import 'node:events';
|
37
37
|
import 'querystring';
|
38
38
|
import 'node:readline';
|
39
39
|
import 'zlib';
|
@@ -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-BBErwUJM.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-BBErwUJM.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-BBErwUJM.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-BBErwUJM.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
@@ -1,5 +1,5 @@
|
|
1
1
|
/// <reference types="node" />
|
2
|
-
import { PluginHooks, RollupError, SourceMap, ModuleInfo, PartialResolvedId, InputOptions, CustomPluginOptions,
|
2
|
+
import { PluginHooks, RollupError, SourceMap, ModuleInfo, PartialResolvedId, MinimalPluginContext, InputOptions, CustomPluginOptions, LoadResult, SourceDescription, RollupOptions, WatcherOptions, InputOption, ModuleFormat, RollupOutput, RollupWatcher, SourceMapInput, ExistingRawSourceMap, OutputBundle, OutputChunk, ObjectHook, PluginContext, ResolveIdResult, TransformPluginContext, GetManualChunk } from 'rollup';
|
3
3
|
import * as rollup from 'rollup';
|
4
4
|
export { rollup as Rollup };
|
5
5
|
export { parseAst, parseAstAsync } from 'rollup/parseAst';
|
@@ -680,8 +680,8 @@ interface CommonServerOptions {
|
|
680
680
|
* ``` js
|
681
681
|
* module.exports = {
|
682
682
|
* proxy: {
|
683
|
-
* // string shorthand
|
684
|
-
* '/foo': 'http://localhost:4567
|
683
|
+
* // string shorthand: /foo -> http://localhost:4567/foo
|
684
|
+
* '/foo': 'http://localhost:4567',
|
685
685
|
* // with options
|
686
686
|
* '/api': {
|
687
687
|
* target: 'http://jsonplaceholder.typicode.com',
|
@@ -873,29 +873,50 @@ declare class ModuleGraph {
|
|
873
873
|
* https://github.com/preactjs/wmr/blob/main/packages/wmr/src/lib/rollup-plugin-container.js
|
874
874
|
*/
|
875
875
|
|
876
|
-
|
877
|
-
|
876
|
+
declare class PluginContainer {
|
877
|
+
config: ResolvedConfig;
|
878
|
+
moduleGraph?: ModuleGraph | undefined;
|
879
|
+
watcher?: FSWatcher | undefined;
|
880
|
+
plugins: readonly Plugin<any>[];
|
881
|
+
private _pluginContextMap;
|
882
|
+
private _pluginContextMapSsr;
|
883
|
+
private _resolvedRollupOptions?;
|
884
|
+
private _processesing;
|
885
|
+
private _seenResolves;
|
886
|
+
private _closed;
|
887
|
+
private _moduleNodeToLoadAddedImports;
|
888
|
+
getSortedPluginHooks: PluginHookUtils['getSortedPluginHooks'];
|
889
|
+
getSortedPlugins: PluginHookUtils['getSortedPlugins'];
|
890
|
+
watchFiles: Set<string>;
|
891
|
+
minimalContext: MinimalPluginContext;
|
892
|
+
private _updateModuleLoadAddedImports;
|
893
|
+
private _getAddedImports;
|
878
894
|
getModuleInfo(id: string): ModuleInfo | null;
|
879
|
-
|
880
|
-
|
895
|
+
private handleHookPromise;
|
896
|
+
get options(): InputOptions;
|
897
|
+
resolveRollupOptions(): Promise<InputOptions>;
|
898
|
+
private _getPluginContext;
|
899
|
+
private hookParallel;
|
900
|
+
buildStart(_options?: InputOptions): Promise<void>;
|
901
|
+
resolveId(rawId: string, importer?: string | undefined, options?: {
|
881
902
|
attributes?: Record<string, string>;
|
882
903
|
custom?: CustomPluginOptions;
|
883
904
|
skip?: Set<Plugin>;
|
884
905
|
ssr?: boolean;
|
885
906
|
isEntry?: boolean;
|
886
907
|
}): Promise<PartialResolvedId | null>;
|
908
|
+
load(id: string, options?: {
|
909
|
+
ssr?: boolean;
|
910
|
+
}): Promise<LoadResult | null>;
|
887
911
|
transform(code: string, id: string, options?: {
|
888
|
-
inMap?: SourceDescription['map'];
|
889
912
|
ssr?: boolean;
|
913
|
+
inMap?: SourceDescription['map'];
|
890
914
|
}): Promise<{
|
891
915
|
code: string;
|
892
916
|
map: SourceMap | {
|
893
917
|
mappings: '';
|
894
918
|
} | null;
|
895
919
|
}>;
|
896
|
-
load(id: string, options?: {
|
897
|
-
ssr?: boolean;
|
898
|
-
}): Promise<LoadResult | null>;
|
899
920
|
watchChange(id: string, change: {
|
900
921
|
event: 'create' | 'update' | 'delete';
|
901
922
|
}): Promise<void>;
|
@@ -1560,6 +1581,11 @@ interface ServerOptions extends CommonServerOptions {
|
|
1560
1581
|
* Configure HMR-specific options (port, host, path & protocol)
|
1561
1582
|
*/
|
1562
1583
|
hmr?: HmrOptions | boolean;
|
1584
|
+
/**
|
1585
|
+
* Do not start the websocket connection.
|
1586
|
+
* @experimental
|
1587
|
+
*/
|
1588
|
+
ws?: false;
|
1563
1589
|
/**
|
1564
1590
|
* Warm-up files to transform and cache the results in advance. This improves the
|
1565
1591
|
* initial page load during server starts and prevents transform waterfalls.
|
@@ -1682,7 +1708,6 @@ interface ViteDevServer {
|
|
1682
1708
|
watcher: FSWatcher;
|
1683
1709
|
/**
|
1684
1710
|
* web socket server with `send(payload)` method
|
1685
|
-
* @deprecated use `hot` instead
|
1686
1711
|
*/
|
1687
1712
|
ws: WebSocketServer;
|
1688
1713
|
/**
|
@@ -1690,6 +1715,7 @@ interface ViteDevServer {
|
|
1690
1715
|
*
|
1691
1716
|
* Always sends a message to at least a WebSocket client. Any third party can
|
1692
1717
|
* add a channel to the broadcaster to process messages
|
1718
|
+
* @deprecated will be replaced with the environment api in v6.
|
1693
1719
|
*/
|
1694
1720
|
hot: HMRBroadcaster;
|
1695
1721
|
/**
|
@@ -2493,7 +2519,7 @@ interface LibraryOptions {
|
|
2493
2519
|
*/
|
2494
2520
|
fileName?: string | ((format: ModuleFormat, entryName: string) => string);
|
2495
2521
|
}
|
2496
|
-
type LibraryFormats = 'es' | 'cjs' | 'umd' | 'iife';
|
2522
|
+
type LibraryFormats = 'es' | 'cjs' | 'umd' | 'iife' | 'system';
|
2497
2523
|
interface ModulePreloadOptions {
|
2498
2524
|
/**
|
2499
2525
|
* Whether to inject a module preload polyfill.
|
@@ -3080,7 +3106,7 @@ interface Plugin<A = any> extends rollup.Plugin<A> {
|
|
3080
3106
|
* the descriptors.
|
3081
3107
|
*
|
3082
3108
|
* - The hook can also return an empty array and then perform custom updates
|
3083
|
-
* by sending a custom hmr payload via server.
|
3109
|
+
* by sending a custom hmr payload via server.ws.send().
|
3084
3110
|
*
|
3085
3111
|
* - If the hook doesn't return a value, the hmr update will be performed as
|
3086
3112
|
* normal.
|
@@ -3433,7 +3459,7 @@ declare const VERSION: string;
|
|
3433
3459
|
|
3434
3460
|
declare const isCSSRequest: (request: string) => boolean;
|
3435
3461
|
/**
|
3436
|
-
* @deprecated use build.
|
3462
|
+
* @deprecated use build.rollupOptions.output.manualChunks or framework specific configuration
|
3437
3463
|
*/
|
3438
3464
|
declare class SplitVendorChunkCache {
|
3439
3465
|
cache: Map<string, boolean>;
|
@@ -3441,13 +3467,13 @@ declare class SplitVendorChunkCache {
|
|
3441
3467
|
reset(): void;
|
3442
3468
|
}
|
3443
3469
|
/**
|
3444
|
-
* @deprecated use build.
|
3470
|
+
* @deprecated use build.rollupOptions.output.manualChunks or framework specific configuration
|
3445
3471
|
*/
|
3446
3472
|
declare function splitVendorChunk(options?: {
|
3447
3473
|
cache?: SplitVendorChunkCache;
|
3448
3474
|
}): GetManualChunk;
|
3449
3475
|
/**
|
3450
|
-
* @deprecated use build.
|
3476
|
+
* @deprecated use build.rollupOptions.output.manualChunks or framework specific configuration
|
3451
3477
|
*/
|
3452
3478
|
declare function splitVendorChunkPlugin(): Plugin;
|
3453
3479
|
|
@@ -3535,4 +3561,4 @@ declare class ServerHMRConnector implements HMRRuntimeConnection {
|
|
3535
3561
|
onUpdate(handler: (payload: HMRPayload) => void): void;
|
3536
3562
|
}
|
3537
3563
|
|
3538
|
-
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,
|
3564
|
+
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, 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-BBErwUJM.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-BBErwUJM.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';
|
@@ -58,7 +58,7 @@ const isCSSRequest = (request) => CSS_LANGS_RE.test(request);
|
|
58
58
|
// The cache needs to be reset on buildStart for watch mode to work correctly
|
59
59
|
// Don't use this manualChunks strategy for ssr, lib mode, and 'umd' or 'iife'
|
60
60
|
/**
|
61
|
-
* @deprecated use build.
|
61
|
+
* @deprecated use build.rollupOptions.output.manualChunks or framework specific configuration
|
62
62
|
*/
|
63
63
|
class SplitVendorChunkCache {
|
64
64
|
cache;
|
@@ -70,7 +70,7 @@ class SplitVendorChunkCache {
|
|
70
70
|
}
|
71
71
|
}
|
72
72
|
/**
|
73
|
-
* @deprecated use build.
|
73
|
+
* @deprecated use build.rollupOptions.output.manualChunks or framework specific configuration
|
74
74
|
*/
|
75
75
|
function splitVendorChunk(options = {}) {
|
76
76
|
const cache = options.cache ?? new SplitVendorChunkCache();
|
@@ -105,7 +105,7 @@ function staticImportedByEntry(id, getModuleInfo, cache, importStack = []) {
|
|
105
105
|
return someImporterIs;
|
106
106
|
}
|
107
107
|
/**
|
108
|
-
* @deprecated use build.
|
108
|
+
* @deprecated use build.rollupOptions.output.manualChunks or framework specific configuration
|
109
109
|
*/
|
110
110
|
function splitVendorChunkPlugin() {
|
111
111
|
const caches = [];
|
package/dist/node/runtime.js
CHANGED
@@ -51,24 +51,22 @@ function normalizeString(path, allowAboveRoot) {
|
|
51
51
|
char = "/";
|
52
52
|
}
|
53
53
|
if (char === "/") {
|
54
|
-
if (!(lastSlash === index - 1 || dots === 1))
|
55
|
-
if (
|
56
|
-
if (res.length
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
continue;
|
64
|
-
}
|
54
|
+
if (!(lastSlash === index - 1 || dots === 1)) if (dots === 2) {
|
55
|
+
if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
|
56
|
+
if (res.length > 2) {
|
57
|
+
const lastSlashIndex = res.lastIndexOf("/");
|
58
|
+
lastSlashIndex === -1 ? (res = "", lastSegmentLength = 0) : (res = res.slice(0, lastSlashIndex), lastSegmentLength = res.length - 1 - res.lastIndexOf("/")), lastSlash = index, dots = 0;
|
59
|
+
continue;
|
60
|
+
} else if (res.length > 0) {
|
61
|
+
res = "", lastSegmentLength = 0, lastSlash = index, dots = 0;
|
62
|
+
continue;
|
65
63
|
}
|
66
|
-
|
67
|
-
|
68
|
-
|
64
|
+
}
|
65
|
+
allowAboveRoot && (res += res.length > 0 ? "/.." : "..", lastSegmentLength = 2);
|
66
|
+
} else
|
67
|
+
res.length > 0 ? res += `/${path.slice(lastSlash + 1, index)}` : res = path.slice(lastSlash + 1, index), lastSegmentLength = index - lastSlash - 1;
|
69
68
|
lastSlash = index, dots = 0;
|
70
|
-
} else
|
71
|
-
char === "." && dots !== -1 ? ++dots : dots = -1;
|
69
|
+
} else char === "." && dots !== -1 ? ++dots : dots = -1;
|
72
70
|
}
|
73
71
|
return res;
|
74
72
|
}
|
@@ -507,11 +505,11 @@ class HMRClient {
|
|
507
505
|
}
|
508
506
|
}
|
509
507
|
function analyzeImportedModDifference(mod, rawId, moduleType, metadata) {
|
510
|
-
if (!metadata?.isDynamicImport &&
|
508
|
+
if (!metadata?.isDynamicImport && metadata?.importedNames?.length) {
|
511
509
|
const missingBindings = metadata.importedNames.filter((s) => !(s in mod));
|
512
510
|
if (missingBindings.length) {
|
513
511
|
const lastBinding = missingBindings[missingBindings.length - 1];
|
514
|
-
throw new SyntaxError(`[vite] Named export '${lastBinding}' not found. The requested module '${rawId}' is a CommonJS module, which may not support all module.exports as named exports.
|
512
|
+
throw moduleType === "module" ? new SyntaxError(`[vite] The requested module '${rawId}' does not provide an export named '${lastBinding}'`) : new SyntaxError(`[vite] Named export '${lastBinding}' not found. The requested module '${rawId}' is a CommonJS module, which may not support all module.exports as named exports.
|
515
513
|
CommonJS modules can always be imported via the default export, for example using:
|
516
514
|
|
517
515
|
import pkg from '${rawId}';
|
@@ -520,15 +518,6 @@ const {${missingBindings.join(", ")}} = pkg;
|
|
520
518
|
}
|
521
519
|
}
|
522
520
|
}
|
523
|
-
function proxyGuardOnlyEsm(mod, rawId, metadata) {
|
524
|
-
return metadata?.importedNames?.length ? new Proxy(mod, {
|
525
|
-
get(mod2, prop) {
|
526
|
-
if (prop !== "then" && !(prop in mod2))
|
527
|
-
throw new SyntaxError(`[vite] The requested module '${rawId}' does not provide an export named '${prop.toString()}'`);
|
528
|
-
return mod2[prop];
|
529
|
-
}
|
530
|
-
}) : mod;
|
531
|
-
}
|
532
521
|
const ssrModuleExportsKey = "__vite_ssr_exports__", ssrImportKey = "__vite_ssr_import__", ssrDynamicImportKey = "__vite_ssr_dynamic_import__", ssrExportAllKey = "__vite_ssr_exportAll__", ssrImportMetaKey = "__vite_ssr_import_meta__", noop = () => {
|
533
522
|
}, silentConsole = {
|
534
523
|
debug: noop,
|
@@ -743,8 +732,7 @@ function CallSiteToString() {
|
|
743
732
|
typeName === "[object Object]" && (typeName = "null");
|
744
733
|
const methodName = this.getMethodName();
|
745
734
|
functionName ? (typeName && functionName.indexOf(typeName) !== 0 && (line += `${typeName}.`), line += functionName, methodName && functionName.indexOf(`.${methodName}`) !== functionName.length - methodName.length - 1 && (line += ` [as ${methodName}]`)) : line += `${typeName}.${methodName || "<anonymous>"}`;
|
746
|
-
} else
|
747
|
-
isConstructor ? line += `new ${functionName || "<anonymous>"}` : functionName ? line += functionName : (line += fileLocation, addSuffix = !1);
|
735
|
+
} else isConstructor ? line += `new ${functionName || "<anonymous>"}` : functionName ? line += functionName : (line += fileLocation, addSuffix = !1);
|
748
736
|
return addSuffix && (line += ` (${fileLocation})`), line;
|
749
737
|
}
|
750
738
|
function cloneCallSite(frame) {
|
@@ -891,7 +879,7 @@ class ViteRuntime {
|
|
891
879
|
if (!("externalize" in fetchResult))
|
892
880
|
return exports;
|
893
881
|
const { id, type } = fetchResult;
|
894
|
-
return type !== "module" && type !== "commonjs"
|
882
|
+
return type !== "module" && type !== "commonjs" || analyzeImportedModDifference(exports, id, type, metadata), exports;
|
895
883
|
}
|
896
884
|
async cachedRequest(id, fetchedModule, callstack = [], metadata) {
|
897
885
|
const moduleId = fetchedModule.id;
|
@@ -119,17 +119,21 @@ function getDefaultExportFromCjs (x) {
|
|
119
119
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
120
120
|
}
|
121
121
|
|
122
|
-
|
122
|
+
function commonjsRequire(path) {
|
123
|
+
throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
|
124
|
+
}
|
123
125
|
|
124
|
-
|
126
|
+
var picocolors = {exports: {}};
|
125
127
|
|
128
|
+
let argv = process.argv || [],
|
129
|
+
env = process.env;
|
126
130
|
let isColorSupported =
|
127
|
-
!("NO_COLOR" in
|
128
|
-
("FORCE_COLOR" in
|
129
|
-
|
131
|
+
!("NO_COLOR" in env || argv.includes("--no-color")) &&
|
132
|
+
("FORCE_COLOR" in env ||
|
133
|
+
argv.includes("--color") ||
|
130
134
|
process.platform === "win32" ||
|
131
|
-
(
|
132
|
-
"CI" in
|
135
|
+
(commonjsRequire != null && require$$0.isatty(1) && env.TERM !== "dumb") ||
|
136
|
+
"CI" in env);
|
133
137
|
|
134
138
|
let formatter =
|
135
139
|
(open, close, replace = open) =>
|
@@ -142,40 +146,47 @@ let formatter =
|
|
142
146
|
};
|
143
147
|
|
144
148
|
let replaceClose = (string, close, replace, index) => {
|
145
|
-
let
|
146
|
-
let
|
147
|
-
|
148
|
-
|
149
|
+
let result = "";
|
150
|
+
let cursor = 0;
|
151
|
+
do {
|
152
|
+
result += string.substring(cursor, index) + replace;
|
153
|
+
cursor = index + close.length;
|
154
|
+
index = string.indexOf(close, cursor);
|
155
|
+
} while (~index)
|
156
|
+
return result + string.substring(cursor)
|
149
157
|
};
|
150
158
|
|
151
|
-
let createColors = (enabled = isColorSupported) =>
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
159
|
+
let createColors = (enabled = isColorSupported) => {
|
160
|
+
let init = enabled ? formatter : () => String;
|
161
|
+
return {
|
162
|
+
isColorSupported: enabled,
|
163
|
+
reset: init("\x1b[0m", "\x1b[0m"),
|
164
|
+
bold: init("\x1b[1m", "\x1b[22m", "\x1b[22m\x1b[1m"),
|
165
|
+
dim: init("\x1b[2m", "\x1b[22m", "\x1b[22m\x1b[2m"),
|
166
|
+
italic: init("\x1b[3m", "\x1b[23m"),
|
167
|
+
underline: init("\x1b[4m", "\x1b[24m"),
|
168
|
+
inverse: init("\x1b[7m", "\x1b[27m"),
|
169
|
+
hidden: init("\x1b[8m", "\x1b[28m"),
|
170
|
+
strikethrough: init("\x1b[9m", "\x1b[29m"),
|
171
|
+
black: init("\x1b[30m", "\x1b[39m"),
|
172
|
+
red: init("\x1b[31m", "\x1b[39m"),
|
173
|
+
green: init("\x1b[32m", "\x1b[39m"),
|
174
|
+
yellow: init("\x1b[33m", "\x1b[39m"),
|
175
|
+
blue: init("\x1b[34m", "\x1b[39m"),
|
176
|
+
magenta: init("\x1b[35m", "\x1b[39m"),
|
177
|
+
cyan: init("\x1b[36m", "\x1b[39m"),
|
178
|
+
white: init("\x1b[37m", "\x1b[39m"),
|
179
|
+
gray: init("\x1b[90m", "\x1b[39m"),
|
180
|
+
bgBlack: init("\x1b[40m", "\x1b[49m"),
|
181
|
+
bgRed: init("\x1b[41m", "\x1b[49m"),
|
182
|
+
bgGreen: init("\x1b[42m", "\x1b[49m"),
|
183
|
+
bgYellow: init("\x1b[43m", "\x1b[49m"),
|
184
|
+
bgBlue: init("\x1b[44m", "\x1b[49m"),
|
185
|
+
bgMagenta: init("\x1b[45m", "\x1b[49m"),
|
186
|
+
bgCyan: init("\x1b[46m", "\x1b[49m"),
|
187
|
+
bgWhite: init("\x1b[47m", "\x1b[49m"),
|
188
|
+
}
|
189
|
+
};
|
179
190
|
|
180
191
|
picocolors.exports = createColors();
|
181
192
|
picocolors.exports.createColors = createColors;
|
@@ -3463,6 +3474,7 @@ function tryStatSync(file) {
|
|
3463
3474
|
// Ignore errors
|
3464
3475
|
}
|
3465
3476
|
}
|
3477
|
+
const splitRE = /\r?\n/g;
|
3466
3478
|
function isFileReadable(filename) {
|
3467
3479
|
if (!tryStatSync(filename)) {
|
3468
3480
|
return false;
|
@@ -3594,7 +3606,7 @@ const isCSSRequest = (request) => CSS_LANGS_RE.test(request);
|
|
3594
3606
|
// The cache needs to be reset on buildStart for watch mode to work correctly
|
3595
3607
|
// Don't use this manualChunks strategy for ssr, lib mode, and 'umd' or 'iife'
|
3596
3608
|
/**
|
3597
|
-
* @deprecated use build.
|
3609
|
+
* @deprecated use build.rollupOptions.output.manualChunks or framework specific configuration
|
3598
3610
|
*/
|
3599
3611
|
class SplitVendorChunkCache {
|
3600
3612
|
cache;
|
@@ -3606,7 +3618,7 @@ class SplitVendorChunkCache {
|
|
3606
3618
|
}
|
3607
3619
|
}
|
3608
3620
|
/**
|
3609
|
-
* @deprecated use build.
|
3621
|
+
* @deprecated use build.rollupOptions.output.manualChunks or framework specific configuration
|
3610
3622
|
*/
|
3611
3623
|
function splitVendorChunk(options = {}) {
|
3612
3624
|
const cache = options.cache ?? new SplitVendorChunkCache();
|
@@ -3641,7 +3653,7 @@ function staticImportedByEntry(id, getModuleInfo, cache, importStack = []) {
|
|
3641
3653
|
return someImporterIs;
|
3642
3654
|
}
|
3643
3655
|
/**
|
3644
|
-
* @deprecated use build.
|
3656
|
+
* @deprecated use build.rollupOptions.output.manualChunks or framework specific configuration
|
3645
3657
|
*/
|
3646
3658
|
function splitVendorChunkPlugin() {
|
3647
3659
|
const caches = [];
|
@@ -5424,6 +5436,7 @@ function getTimeFormatter() {
|
|
5424
5436
|
});
|
5425
5437
|
return timeFormatter;
|
5426
5438
|
}
|
5439
|
+
const MAX_LOG_CHAR = 5000;
|
5427
5440
|
function createLogger(level = 'info', options = {}) {
|
5428
5441
|
if (options.customLogger) {
|
5429
5442
|
return options.customLogger;
|
@@ -5433,7 +5446,16 @@ function createLogger(level = 'info', options = {}) {
|
|
5433
5446
|
const thresh = LogLevels[level];
|
5434
5447
|
const canClearScreen = allowClearScreen && process.stdout.isTTY && !process.env.CI;
|
5435
5448
|
const clear = canClearScreen ? clearScreen : () => { };
|
5436
|
-
function
|
5449
|
+
function preventOverflow(msg) {
|
5450
|
+
if (msg.length > MAX_LOG_CHAR) {
|
5451
|
+
const shorten = msg.slice(0, MAX_LOG_CHAR);
|
5452
|
+
const lines = msg.slice(MAX_LOG_CHAR).match(splitRE)?.length || 0;
|
5453
|
+
return `${shorten}\n... and ${lines} lines more`;
|
5454
|
+
}
|
5455
|
+
return msg;
|
5456
|
+
}
|
5457
|
+
function format(type, rawMsg, options = {}) {
|
5458
|
+
const msg = preventOverflow(rawMsg);
|
5437
5459
|
if (options.timestamp) {
|
5438
5460
|
const tag = type === 'info'
|
5439
5461
|
? colors.cyan(colors.bold(prefix))
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "vite",
|
3
|
-
"version": "5.
|
3
|
+
"version": "5.3.0-beta.0",
|
4
4
|
"type": "module",
|
5
5
|
"license": "MIT",
|
6
6
|
"author": "Evan You",
|
@@ -72,7 +72,7 @@
|
|
72
72
|
"funding": "https://github.com/vitejs/vite?sponsor=1",
|
73
73
|
"//": "READ CONTRIBUTING.md to understand what to put under deps vs. devDeps!",
|
74
74
|
"dependencies": {
|
75
|
-
"esbuild": "^0.
|
75
|
+
"esbuild": "^0.21.3",
|
76
76
|
"postcss": "^8.4.38",
|
77
77
|
"rollup": "^4.13.0"
|
78
78
|
},
|
@@ -81,11 +81,11 @@
|
|
81
81
|
},
|
82
82
|
"devDependencies": {
|
83
83
|
"@ampproject/remapping": "^2.3.0",
|
84
|
-
"@babel/parser": "^7.24.
|
84
|
+
"@babel/parser": "^7.24.6",
|
85
85
|
"@jridgewell/trace-mapping": "^0.3.25",
|
86
86
|
"@polka/compression": "^1.0.0-next.25",
|
87
87
|
"@rollup/plugin-alias": "^5.1.0",
|
88
|
-
"@rollup/plugin-commonjs": "^25.0.
|
88
|
+
"@rollup/plugin-commonjs": "^25.0.8",
|
89
89
|
"@rollup/plugin-dynamic-import-vars": "^2.1.2",
|
90
90
|
"@rollup/plugin-json": "^6.1.0",
|
91
91
|
"@rollup/plugin-node-resolve": "15.2.3",
|
@@ -93,9 +93,7 @@
|
|
93
93
|
"@rollup/pluginutils": "^5.1.0",
|
94
94
|
"@types/escape-html": "^1.0.4",
|
95
95
|
"@types/pnpapi": "^0.0.5",
|
96
|
-
"
|
97
|
-
"acorn-walk": "^8.3.2",
|
98
|
-
"artichokie": "^0.2.0",
|
96
|
+
"artichokie": "^0.2.1",
|
99
97
|
"cac": "^6.7.14",
|
100
98
|
"chokidar": "^3.6.0",
|
101
99
|
"connect": "^3.7.0",
|
@@ -106,32 +104,32 @@
|
|
106
104
|
"dep-types": "link:./src/types",
|
107
105
|
"dotenv": "^16.4.5",
|
108
106
|
"dotenv-expand": "^11.0.6",
|
109
|
-
"es-module-lexer": "^1.5.
|
107
|
+
"es-module-lexer": "^1.5.3",
|
110
108
|
"escape-html": "^1.0.3",
|
111
109
|
"estree-walker": "^3.0.3",
|
112
110
|
"etag": "^1.8.1",
|
113
111
|
"fast-glob": "^3.3.2",
|
114
112
|
"http-proxy": "^1.18.1",
|
115
113
|
"launch-editor-middleware": "^2.6.1",
|
116
|
-
"lightningcss": "^1.
|
114
|
+
"lightningcss": "^1.25.1",
|
117
115
|
"magic-string": "^0.30.10",
|
118
|
-
"micromatch": "^4.0.
|
119
|
-
"mlly": "^1.
|
116
|
+
"micromatch": "^4.0.7",
|
117
|
+
"mlly": "^1.7.0",
|
120
118
|
"mrmime": "^2.0.0",
|
121
119
|
"open": "^8.4.2",
|
122
120
|
"parse5": "^7.1.2",
|
123
121
|
"pathe": "^1.1.2",
|
124
122
|
"periscopic": "^4.0.2",
|
125
|
-
"picocolors": "^1.0.
|
123
|
+
"picocolors": "^1.0.1",
|
126
124
|
"picomatch": "^2.3.1",
|
127
125
|
"postcss-import": "^16.1.0",
|
128
126
|
"postcss-load-config": "^4.0.2",
|
129
127
|
"postcss-modules": "^6.0.0",
|
130
128
|
"resolve.exports": "^2.0.2",
|
131
|
-
"rollup-plugin-dts": "^6.1.
|
129
|
+
"rollup-plugin-dts": "^6.1.1",
|
132
130
|
"rollup-plugin-esbuild": "^6.1.1",
|
133
|
-
"rollup-plugin-license": "^3.
|
134
|
-
"sass": "^1.
|
131
|
+
"rollup-plugin-license": "^3.4.0",
|
132
|
+
"sass": "^1.77.2",
|
135
133
|
"sirv": "^2.0.4",
|
136
134
|
"source-map-support": "^0.5.21",
|
137
135
|
"strip-ansi": "^7.1.0",
|
package/types/customEvent.d.ts
CHANGED
@@ -23,6 +23,7 @@ export interface WebSocketConnectionPayload {
|
|
23
23
|
* This might be removed in the future if we didn't find reasonable use cases.
|
24
24
|
* If you find this useful, please open an issue with details so we can discuss and make it stable API.
|
25
25
|
*/
|
26
|
+
// eslint-disable-next-line n/no-unsupported-features/node-builtins
|
26
27
|
webSocket: WebSocket
|
27
28
|
}
|
28
29
|
|