vite 5.1.0-beta.0 → 5.1.0-beta.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.
- package/dist/node/chunks/{dep-VtWyYv-v.js → dep-7G7SPddr.js} +1 -1
- package/dist/node/chunks/{dep-oXyoRRWa.js → dep-AFY35plO.js} +1 -1
- package/dist/node/chunks/{dep-7tgnmQn7.js → dep-BzxBS-ea.js} +34997 -35154
- package/dist/node/cli.js +5 -6
- package/dist/node/index.d.ts +86 -31
- package/dist/node/index.js +2 -3
- package/dist/node-cjs/publicUtils.cjs +1 -1
- package/package.json +5 -5
- package/types/hmrPayload.d.ts +2 -2
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 { y as colors, q as createLogger, r as resolveConfig } from './chunks/dep-
|
5
|
+
import { y as colors, q as createLogger, r as resolveConfig } from './chunks/dep-BzxBS-ea.js';
|
6
6
|
import { VERSION } from './constants.js';
|
7
7
|
import 'node:fs/promises';
|
8
8
|
import 'node:url';
|
@@ -29,7 +29,6 @@ import 'node:dns';
|
|
29
29
|
import 'crypto';
|
30
30
|
import 'module';
|
31
31
|
import 'node:assert';
|
32
|
-
import 'node:process';
|
33
32
|
import 'node:v8';
|
34
33
|
import 'node:buffer';
|
35
34
|
import 'rollup';
|
@@ -759,7 +758,7 @@ cli
|
|
759
758
|
filterDuplicateOptions(options);
|
760
759
|
// output structure is preserved even after bundling so require()
|
761
760
|
// is ok here
|
762
|
-
const { createServer } = await import('./chunks/dep-
|
761
|
+
const { createServer } = await import('./chunks/dep-BzxBS-ea.js').then(function (n) { return n.C; });
|
763
762
|
try {
|
764
763
|
const server = await createServer({
|
765
764
|
root,
|
@@ -839,7 +838,7 @@ cli
|
|
839
838
|
.option('-w, --watch', `[boolean] rebuilds when modules have changed on disk`)
|
840
839
|
.action(async (root, options) => {
|
841
840
|
filterDuplicateOptions(options);
|
842
|
-
const { build } = await import('./chunks/dep-
|
841
|
+
const { build } = await import('./chunks/dep-BzxBS-ea.js').then(function (n) { return n.D; });
|
843
842
|
const buildOptions = cleanOptions(options);
|
844
843
|
try {
|
845
844
|
await build({
|
@@ -867,7 +866,7 @@ cli
|
|
867
866
|
.option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
|
868
867
|
.action(async (root, options) => {
|
869
868
|
filterDuplicateOptions(options);
|
870
|
-
const { optimizeDeps } = await import('./chunks/dep-
|
869
|
+
const { optimizeDeps } = await import('./chunks/dep-BzxBS-ea.js').then(function (n) { return n.B; });
|
871
870
|
try {
|
872
871
|
const config = await resolveConfig({
|
873
872
|
root,
|
@@ -893,7 +892,7 @@ cli
|
|
893
892
|
.option('--outDir <dir>', `[string] output directory (default: dist)`)
|
894
893
|
.action(async (root, options) => {
|
895
894
|
filterDuplicateOptions(options);
|
896
|
-
const { preview } = await import('./chunks/dep-
|
895
|
+
const { preview } = await import('./chunks/dep-BzxBS-ea.js').then(function (n) { return n.E; });
|
897
896
|
try {
|
898
897
|
const server = await preview({
|
899
898
|
root,
|
package/dist/node/index.d.ts
CHANGED
@@ -713,6 +713,10 @@ interface PreviewServer {
|
|
713
713
|
* The resolved vite config object
|
714
714
|
*/
|
715
715
|
config: ResolvedConfig;
|
716
|
+
/**
|
717
|
+
* Stop the server.
|
718
|
+
*/
|
719
|
+
close(): Promise<void>;
|
716
720
|
/**
|
717
721
|
* A connect app instance.
|
718
722
|
* - Can be used to attach custom middlewares to the preview server.
|
@@ -1412,16 +1416,38 @@ declare namespace WebSocket {
|
|
1412
1416
|
): Duplex
|
1413
1417
|
}
|
1414
1418
|
|
1415
|
-
|
1416
|
-
|
1419
|
+
interface HmrOptions {
|
1420
|
+
protocol?: string;
|
1421
|
+
host?: string;
|
1422
|
+
port?: number;
|
1423
|
+
clientPort?: number;
|
1424
|
+
path?: string;
|
1425
|
+
timeout?: number;
|
1426
|
+
overlay?: boolean;
|
1427
|
+
server?: Server;
|
1428
|
+
}
|
1429
|
+
interface HmrContext {
|
1430
|
+
file: string;
|
1431
|
+
timestamp: number;
|
1432
|
+
modules: Array<ModuleNode>;
|
1433
|
+
read: () => string | Promise<string>;
|
1434
|
+
server: ViteDevServer;
|
1435
|
+
}
|
1436
|
+
interface HMRBroadcasterClient {
|
1417
1437
|
/**
|
1418
|
-
*
|
1438
|
+
* Send event to the client
|
1419
1439
|
*/
|
1420
|
-
|
1440
|
+
send(payload: HMRPayload): void;
|
1421
1441
|
/**
|
1422
|
-
*
|
1442
|
+
* Send custom event
|
1423
1443
|
*/
|
1424
|
-
|
1444
|
+
send(event: string, payload?: CustomPayload['data']): void;
|
1445
|
+
}
|
1446
|
+
interface HMRChannel {
|
1447
|
+
/**
|
1448
|
+
* Unique channel name
|
1449
|
+
*/
|
1450
|
+
name: string;
|
1425
1451
|
/**
|
1426
1452
|
* Broadcast events to all clients
|
1427
1453
|
*/
|
@@ -1430,6 +1456,46 @@ interface WebSocketServer {
|
|
1430
1456
|
* Send custom event
|
1431
1457
|
*/
|
1432
1458
|
send<T extends string>(event: T, payload?: InferCustomEventPayload<T>): void;
|
1459
|
+
/**
|
1460
|
+
* Handle custom event emitted by `import.meta.hot.send`
|
1461
|
+
*/
|
1462
|
+
on<T extends string>(event: T, listener: (data: InferCustomEventPayload<T>, client: HMRBroadcasterClient, ...args: any[]) => void): void;
|
1463
|
+
on(event: 'connection', listener: () => void): void;
|
1464
|
+
/**
|
1465
|
+
* Unregister event listener
|
1466
|
+
*/
|
1467
|
+
off(event: string, listener: Function): void;
|
1468
|
+
/**
|
1469
|
+
* Start listening for messages
|
1470
|
+
*/
|
1471
|
+
listen(): void;
|
1472
|
+
/**
|
1473
|
+
* Disconnect all clients, called when server is closed or restarted.
|
1474
|
+
*/
|
1475
|
+
close(): void;
|
1476
|
+
}
|
1477
|
+
interface HMRBroadcaster extends Omit<HMRChannel, 'close' | 'name'> {
|
1478
|
+
/**
|
1479
|
+
* All registered channels. Always has websocket channel.
|
1480
|
+
*/
|
1481
|
+
readonly channels: HMRChannel[];
|
1482
|
+
/**
|
1483
|
+
* Add a new third-party channel.
|
1484
|
+
*/
|
1485
|
+
addChannel(connection: HMRChannel): HMRBroadcaster;
|
1486
|
+
close(): Promise<unknown[]>;
|
1487
|
+
}
|
1488
|
+
|
1489
|
+
type WebSocketCustomListener<T> = (data: T, client: WebSocketClient) => void;
|
1490
|
+
interface WebSocketServer extends HMRChannel {
|
1491
|
+
/**
|
1492
|
+
* Listen on port and host
|
1493
|
+
*/
|
1494
|
+
listen(): void;
|
1495
|
+
/**
|
1496
|
+
* Get all connected clients.
|
1497
|
+
*/
|
1498
|
+
clients: Set<WebSocketClient>;
|
1433
1499
|
/**
|
1434
1500
|
* Disconnect all clients and terminate the server.
|
1435
1501
|
*/
|
@@ -1463,24 +1529,6 @@ interface WebSocketClient {
|
|
1463
1529
|
socket: WebSocket;
|
1464
1530
|
}
|
1465
1531
|
|
1466
|
-
interface HmrOptions {
|
1467
|
-
protocol?: string;
|
1468
|
-
host?: string;
|
1469
|
-
port?: number;
|
1470
|
-
clientPort?: number;
|
1471
|
-
path?: string;
|
1472
|
-
timeout?: number;
|
1473
|
-
overlay?: boolean;
|
1474
|
-
server?: Server;
|
1475
|
-
}
|
1476
|
-
interface HmrContext {
|
1477
|
-
file: string;
|
1478
|
-
timestamp: number;
|
1479
|
-
modules: Array<ModuleNode>;
|
1480
|
-
read: () => string | Promise<string>;
|
1481
|
-
server: ViteDevServer;
|
1482
|
-
}
|
1483
|
-
|
1484
1532
|
interface ServerOptions extends CommonServerOptions {
|
1485
1533
|
/**
|
1486
1534
|
* Configure HMR-specific options (port, host, path & protocol)
|
@@ -1608,8 +1656,16 @@ interface ViteDevServer {
|
|
1608
1656
|
watcher: FSWatcher;
|
1609
1657
|
/**
|
1610
1658
|
* web socket server with `send(payload)` method
|
1659
|
+
* @deprecated use `hot` instead
|
1611
1660
|
*/
|
1612
1661
|
ws: WebSocketServer;
|
1662
|
+
/**
|
1663
|
+
* HMR broadcaster that can be used to send custom HMR messages to the client
|
1664
|
+
*
|
1665
|
+
* Always sends a message to at least a WebSocket client. Any third party can
|
1666
|
+
* add a channel to the broadcaster to process messages
|
1667
|
+
*/
|
1668
|
+
hot: HMRBroadcaster;
|
1613
1669
|
/**
|
1614
1670
|
* Rollup plugin container that can run plugin hooks on a given file
|
1615
1671
|
*/
|
@@ -2466,9 +2522,6 @@ interface DepsOptimizer {
|
|
2466
2522
|
isOptimizedDepUrl: (url: string) => boolean;
|
2467
2523
|
getOptimizedDepId: (depInfo: OptimizedDepInfo) => string;
|
2468
2524
|
delayDepsOptimizerUntil: (id: string, done: () => Promise<any>) => void;
|
2469
|
-
registerWorkersSource: (id: string) => void;
|
2470
|
-
resetRegisteredIds: () => void;
|
2471
|
-
ensureFirstRun: () => void;
|
2472
2525
|
close: () => Promise<void>;
|
2473
2526
|
options: DepOptimizationOptions;
|
2474
2527
|
}
|
@@ -2512,10 +2565,12 @@ interface DepOptimizationConfig {
|
|
2512
2565
|
*/
|
2513
2566
|
extensions?: string[];
|
2514
2567
|
/**
|
2515
|
-
*
|
2516
|
-
*
|
2517
|
-
*
|
2568
|
+
* Deps optimization during build was removed in Vite 5.1. This option is
|
2569
|
+
* now redundant and will be removed in a future version. Switch to using
|
2570
|
+
* `optimizeDeps.noDiscovery` and an empty or undefined `optimizeDeps.include`.
|
2571
|
+
* true or 'dev' disables the optimizer, false or 'build' leaves it enabled.
|
2518
2572
|
* @default 'build'
|
2573
|
+
* @deprecated
|
2519
2574
|
* @experimental
|
2520
2575
|
*/
|
2521
2576
|
disabled?: boolean | 'build' | 'dev';
|
@@ -2961,7 +3016,7 @@ interface Plugin<A = any> extends rollup.Plugin<A> {
|
|
2961
3016
|
* the descriptors.
|
2962
3017
|
*
|
2963
3018
|
* - The hook can also return an empty array and then perform custom updates
|
2964
|
-
* by sending a custom hmr payload via server.
|
3019
|
+
* by sending a custom hmr payload via server.hot.send().
|
2965
3020
|
*
|
2966
3021
|
* - If the hook doesn't return a value, the hmr update will be performed as
|
2967
3022
|
* normal.
|
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, j as createFilter, q as createLogger, c as createServer, d as defineConfig, f as formatPostcssSourceMap, v as isFileServingAllowed, l as loadConfigFromFile, w as loadEnv, h as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, e as preprocessCSS, p as preview, r as resolveConfig, x as resolveEnvPrefix, u as searchForWorkspaceRoot, k as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-
|
2
|
+
import { i as isInNodeModules, a as arraify } from './chunks/dep-BzxBS-ea.js';
|
3
|
+
export { b as build, g as buildErrorMessage, j as createFilter, q as createLogger, c as createServer, d as defineConfig, f as formatPostcssSourceMap, v as isFileServingAllowed, l as loadConfigFromFile, w as loadEnv, h as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, e as preprocessCSS, p as preview, r as resolveConfig, x as resolveEnvPrefix, u as searchForWorkspaceRoot, k as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-BzxBS-ea.js';
|
4
4
|
export { VERSION as version } from './constants.js';
|
5
5
|
export { version as esbuildVersion } from 'esbuild';
|
6
6
|
export { VERSION as rollupVersion } from 'rollup';
|
@@ -32,7 +32,6 @@ import 'node:dns';
|
|
32
32
|
import 'crypto';
|
33
33
|
import 'module';
|
34
34
|
import 'node:assert';
|
35
|
-
import 'node:process';
|
36
35
|
import 'node:v8';
|
37
36
|
import 'node:buffer';
|
38
37
|
import 'querystring';
|
@@ -6020,7 +6020,7 @@ function getEnvFilesForMode(mode, envDir) {
|
|
6020
6020
|
/** local file */ `.env.local`,
|
6021
6021
|
/** mode file */ `.env.${mode}`,
|
6022
6022
|
/** mode local file */ `.env.${mode}.local`,
|
6023
|
-
].map((file) => path$3.join(envDir, file));
|
6023
|
+
].map((file) => normalizePath(path$3.join(envDir, file)));
|
6024
6024
|
}
|
6025
6025
|
function loadEnv(mode, envDir, prefixes = 'VITE_') {
|
6026
6026
|
if (mode === 'local') {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "vite",
|
3
|
-
"version": "5.1.0-beta.
|
3
|
+
"version": "5.1.0-beta.2",
|
4
4
|
"type": "module",
|
5
5
|
"license": "MIT",
|
6
6
|
"author": "Evan You",
|
@@ -71,7 +71,7 @@
|
|
71
71
|
"devDependencies": {
|
72
72
|
"@ampproject/remapping": "^2.2.1",
|
73
73
|
"@babel/parser": "^7.23.6",
|
74
|
-
"@jridgewell/trace-mapping": "^0.3.
|
74
|
+
"@jridgewell/trace-mapping": "^0.3.21",
|
75
75
|
"@rollup/plugin-alias": "^5.1.0",
|
76
76
|
"@rollup/plugin-commonjs": "^25.0.7",
|
77
77
|
"@rollup/plugin-dynamic-import-vars": "^2.1.2",
|
@@ -82,7 +82,7 @@
|
|
82
82
|
"@types/escape-html": "^1.0.4",
|
83
83
|
"@types/pnpapi": "^0.0.5",
|
84
84
|
"acorn": "^8.11.3",
|
85
|
-
"acorn-walk": "^8.3.
|
85
|
+
"acorn-walk": "^8.3.2",
|
86
86
|
"cac": "^6.7.14",
|
87
87
|
"chokidar": "^3.5.3",
|
88
88
|
"connect": "^3.7.0",
|
@@ -100,10 +100,10 @@
|
|
100
100
|
"fast-glob": "^3.3.2",
|
101
101
|
"http-proxy": "^1.18.1",
|
102
102
|
"launch-editor-middleware": "^2.6.1",
|
103
|
-
"lightningcss": "^1.
|
103
|
+
"lightningcss": "^1.23.0",
|
104
104
|
"magic-string": "^0.30.5",
|
105
105
|
"micromatch": "^4.0.5",
|
106
|
-
"mlly": "^1.
|
106
|
+
"mlly": "^1.5.0",
|
107
107
|
"mrmime": "^2.0.0",
|
108
108
|
"okie": "^1.0.1",
|
109
109
|
"open": "^8.4.2",
|
package/types/hmrPayload.d.ts
CHANGED
@@ -21,9 +21,9 @@ export interface Update {
|
|
21
21
|
acceptedPath: string
|
22
22
|
timestamp: number
|
23
23
|
/** @internal */
|
24
|
-
explicitImportRequired
|
24
|
+
explicitImportRequired?: boolean
|
25
25
|
/** @internal */
|
26
|
-
isWithinCircularImport
|
26
|
+
isWithinCircularImport?: boolean
|
27
27
|
}
|
28
28
|
|
29
29
|
export interface PrunePayload {
|