vite 5.0.0-beta.9 → 5.0.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 +22 -36
- package/dist/client/client.mjs +17 -3
- package/dist/client/client.mjs.map +1 -1
- package/dist/node/chunks/{dep-e04185e5.js → dep-M-BNPx05.js} +2 -2
- package/dist/node/chunks/{dep-ffdf177d.js → dep-T98iZFpD.js} +23525 -23424
- package/dist/node/chunks/{dep-6d23b7fa.js → dep-_v8GkZ9b.js} +145 -145
- package/dist/node/cli.js +32 -35
- package/dist/node/constants.js +1 -0
- package/dist/node/index.d.ts +121 -67
- package/dist/node/index.js +4 -3
- package/dist/node-cjs/publicUtils.cjs +389 -373
- package/index.cjs +0 -1
- package/package.json +12 -13
- /package/dist/node/chunks/{dep-c423598f.js → dep-8a-6Quh6.js} +0 -0
- /package/dist/node/chunks/{dep-f0c7dae0.js → dep-kjUoH5nk.js} +0 -0
package/dist/node/index.d.ts
CHANGED
|
@@ -3,8 +3,10 @@ import { PluginHooks, RollupError, SourceMap, ModuleInfo, PartialResolvedId, Inp
|
|
|
3
3
|
import * as rollup from 'rollup';
|
|
4
4
|
export { rollup as Rollup };
|
|
5
5
|
export { VERSION as rollupVersion } from 'rollup';
|
|
6
|
+
export { parseAst, parseAstAsync } from 'rollup/parseAst';
|
|
6
7
|
import * as http from 'node:http';
|
|
7
8
|
import { OutgoingHttpHeaders, ClientRequestArgs, IncomingMessage, ClientRequest, Agent, Server, ServerResponse } from 'node:http';
|
|
9
|
+
import { Http2SecureServer } from 'node:http2';
|
|
8
10
|
import * as fs from 'node:fs';
|
|
9
11
|
import * as events from 'node:events';
|
|
10
12
|
import { EventEmitter } from 'node:events';
|
|
@@ -53,7 +55,7 @@ interface ResolverObject {
|
|
|
53
55
|
* in that the first defined rules are applied first.
|
|
54
56
|
*
|
|
55
57
|
* This is passed to \@rollup/plugin-alias as the "entries" field
|
|
56
|
-
* https
|
|
58
|
+
* https://github.com/rollup/plugins/tree/master/packages/alias#entries
|
|
57
59
|
*/
|
|
58
60
|
type AliasOptions = readonly Alias[] | { [find: string]: string }
|
|
59
61
|
|
|
@@ -61,6 +63,8 @@ type AnymatchFn = (testString: string) => boolean
|
|
|
61
63
|
type AnymatchPattern = string | RegExp | AnymatchFn
|
|
62
64
|
type AnymatchMatcher = AnymatchPattern | AnymatchPattern[]
|
|
63
65
|
|
|
66
|
+
// Inlined to avoid extra dependency (chokidar is bundled in the published build)
|
|
67
|
+
|
|
64
68
|
declare class FSWatcher extends EventEmitter implements fs.FSWatcher {
|
|
65
69
|
options: WatchOptions
|
|
66
70
|
|
|
@@ -142,11 +146,11 @@ interface WatchOptions {
|
|
|
142
146
|
persistent?: boolean
|
|
143
147
|
|
|
144
148
|
/**
|
|
145
|
-
* ([anymatch](https
|
|
149
|
+
* ([anymatch](https://github.com/micromatch/anymatch)-compatible definition) Defines files/paths to
|
|
146
150
|
* be ignored. The whole relative or absolute path is tested, not just filename. If a function
|
|
147
151
|
* with two arguments is provided, it gets called twice per path - once with a single argument
|
|
148
152
|
* (the path), second time with two arguments (the path and the
|
|
149
|
-
* [`fs.Stats`](https
|
|
153
|
+
* [`fs.Stats`](https://nodejs.org/api/fs.html#fs_class_fs_stats) object of that path).
|
|
150
154
|
*/
|
|
151
155
|
ignored?: AnymatchMatcher
|
|
152
156
|
|
|
@@ -193,7 +197,7 @@ interface WatchOptions {
|
|
|
193
197
|
useFsEvents?: boolean
|
|
194
198
|
|
|
195
199
|
/**
|
|
196
|
-
* If relying upon the [`fs.Stats`](https
|
|
200
|
+
* If relying upon the [`fs.Stats`](https://nodejs.org/api/fs.html#fs_class_fs_stats) object that
|
|
197
201
|
* may get passed with `add`, `addDir`, and `change` events, set this to `true` to ensure it is
|
|
198
202
|
* provided even in cases where it wasn't already available from the underlying watch events.
|
|
199
203
|
*/
|
|
@@ -210,7 +214,7 @@ interface WatchOptions {
|
|
|
210
214
|
interval?: number
|
|
211
215
|
|
|
212
216
|
/**
|
|
213
|
-
* Interval of file system polling for binary files. ([see list of binary extensions](https
|
|
217
|
+
* Interval of file system polling for binary files. ([see list of binary extensions](https://gi
|
|
214
218
|
* thub.com/sindresorhus/binary-extensions/blob/master/binary-extensions.json))
|
|
215
219
|
*/
|
|
216
220
|
binaryInterval?: number
|
|
@@ -249,6 +253,9 @@ interface AwaitWriteFinishOptions {
|
|
|
249
253
|
pollInterval?: number
|
|
250
254
|
}
|
|
251
255
|
|
|
256
|
+
// Inlined to avoid extra dependency
|
|
257
|
+
// MIT Licensed https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/LICENSE
|
|
258
|
+
|
|
252
259
|
declare namespace Connect {
|
|
253
260
|
export type ServerHandle = HandleFunction | http.Server
|
|
254
261
|
|
|
@@ -349,6 +356,9 @@ declare namespace Connect {
|
|
|
349
356
|
}
|
|
350
357
|
}
|
|
351
358
|
|
|
359
|
+
// Inlined to avoid extra dependency
|
|
360
|
+
// MIT Licensed https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/LICENSE
|
|
361
|
+
|
|
352
362
|
declare namespace HttpProxy {
|
|
353
363
|
export type ProxyTarget = ProxyTargetUrl | ProxyTargetDetailed
|
|
354
364
|
|
|
@@ -639,7 +649,7 @@ interface CommonServerOptions {
|
|
|
639
649
|
* Enable TLS + HTTP/2.
|
|
640
650
|
* Note: this downgrades to TLS only when the proxy option is also used.
|
|
641
651
|
*/
|
|
642
|
-
https?:
|
|
652
|
+
https?: HttpsServerOptions;
|
|
643
653
|
/**
|
|
644
654
|
* Open browser window on startup
|
|
645
655
|
*/
|
|
@@ -647,18 +657,18 @@ interface CommonServerOptions {
|
|
|
647
657
|
/**
|
|
648
658
|
* Configure custom proxy rules for the dev server. Expects an object
|
|
649
659
|
* of `{ key: options }` pairs.
|
|
650
|
-
* Uses [`http-proxy`](https
|
|
651
|
-
* Full options [here](https
|
|
660
|
+
* Uses [`http-proxy`](https://github.com/http-party/node-http-proxy).
|
|
661
|
+
* Full options [here](https://github.com/http-party/node-http-proxy#options).
|
|
652
662
|
*
|
|
653
663
|
* Example `vite.config.js`:
|
|
654
664
|
* ``` js
|
|
655
665
|
* module.exports = {
|
|
656
666
|
* proxy: {
|
|
657
|
-
*
|
|
658
|
-
* '/foo': 'http:
|
|
659
|
-
*
|
|
667
|
+
* // string shorthand
|
|
668
|
+
* '/foo': 'http://localhost:4567/foo',
|
|
669
|
+
* // with options
|
|
660
670
|
* '/api': {
|
|
661
|
-
* target: 'http
|
|
671
|
+
* target: 'http://jsonplaceholder.typicode.com',
|
|
662
672
|
* changeOrigin: true,
|
|
663
673
|
* rewrite: path => path.replace(/^\/api/, '')
|
|
664
674
|
* }
|
|
@@ -669,7 +679,7 @@ interface CommonServerOptions {
|
|
|
669
679
|
proxy?: Record<string, string | ProxyOptions>;
|
|
670
680
|
/**
|
|
671
681
|
* Configure CORS for the dev server.
|
|
672
|
-
* Uses https
|
|
682
|
+
* Uses https://github.com/expressjs/cors.
|
|
673
683
|
* Set to `true` to allow all methods from any origin, or configure separately
|
|
674
684
|
* using an object.
|
|
675
685
|
*/
|
|
@@ -680,7 +690,7 @@ interface CommonServerOptions {
|
|
|
680
690
|
headers?: OutgoingHttpHeaders;
|
|
681
691
|
}
|
|
682
692
|
/**
|
|
683
|
-
* https
|
|
693
|
+
* https://github.com/expressjs/cors#configuration-options
|
|
684
694
|
*/
|
|
685
695
|
interface CorsOptions {
|
|
686
696
|
origin?: CorsOrigin | ((origin: string, cb: (err: Error, origins: CorsOrigin) => void) => void);
|
|
@@ -709,13 +719,13 @@ interface PreviewServer {
|
|
|
709
719
|
* - Can also be used as the handler function of a custom http server
|
|
710
720
|
* or as a middleware in any connect-style Node.js frameworks
|
|
711
721
|
*
|
|
712
|
-
* https
|
|
722
|
+
* https://github.com/senchalabs/connect#use-middleware
|
|
713
723
|
*/
|
|
714
724
|
middlewares: Connect.Server;
|
|
715
725
|
/**
|
|
716
726
|
* native Node http server instance
|
|
717
727
|
*/
|
|
718
|
-
httpServer:
|
|
728
|
+
httpServer: HttpServer;
|
|
719
729
|
/**
|
|
720
730
|
* The resolved urls Vite prints on the CLI.
|
|
721
731
|
* null before server is listening.
|
|
@@ -738,10 +748,14 @@ declare function preview(inlineConfig?: InlineConfig): Promise<PreviewServer>;
|
|
|
738
748
|
|
|
739
749
|
type BindCLIShortcutsOptions<Server = ViteDevServer | PreviewServer> = {
|
|
740
750
|
/**
|
|
741
|
-
* Print a one
|
|
751
|
+
* Print a one-line shortcuts "help" hint to the terminal
|
|
742
752
|
*/
|
|
743
753
|
print?: boolean;
|
|
744
|
-
|
|
754
|
+
/**
|
|
755
|
+
* Custom shortcuts to run when a key is pressed. These shortcuts take priority
|
|
756
|
+
* over the default shortcuts if they have the same keys (except the `h` key).
|
|
757
|
+
*/
|
|
758
|
+
customShortcuts?: CLIShortcut<Server>[];
|
|
745
759
|
};
|
|
746
760
|
type CLIShortcut<Server = ViteDevServer | PreviewServer> = {
|
|
747
761
|
key: string;
|
|
@@ -811,14 +825,19 @@ declare class ModuleGraph {
|
|
|
811
825
|
getModuleById(id: string): ModuleNode | undefined;
|
|
812
826
|
getModulesByFile(file: string): Set<ModuleNode> | undefined;
|
|
813
827
|
onFileChange(file: string): void;
|
|
814
|
-
invalidateModule(mod: ModuleNode, seen?: Set<ModuleNode>, timestamp?: number, isHmr?: boolean,
|
|
828
|
+
invalidateModule(mod: ModuleNode, seen?: Set<ModuleNode>, timestamp?: number, isHmr?: boolean,
|
|
829
|
+
): void;
|
|
815
830
|
invalidateAll(): void;
|
|
816
831
|
/**
|
|
817
832
|
* Update the module graph based on a module's updated imports information
|
|
818
833
|
* If there are dependencies that no longer have any importers, they are
|
|
819
834
|
* returned as a Set.
|
|
835
|
+
*
|
|
836
|
+
* @param staticImportedUrls Subset of `importedModules` where they're statically imported in code.
|
|
837
|
+
* This is only used for soft invalidations so `undefined` is fine but may cause more runtime processing.
|
|
820
838
|
*/
|
|
821
|
-
updateModuleInfo(mod: ModuleNode, importedModules: Set<string | ModuleNode>, importedBindings: Map<string, Set<string>> | null, acceptedModules: Set<string | ModuleNode>, acceptedExports: Set<string> | null, isSelfAccepting: boolean, ssr?: boolean
|
|
839
|
+
updateModuleInfo(mod: ModuleNode, importedModules: Set<string | ModuleNode>, importedBindings: Map<string, Set<string>> | null, acceptedModules: Set<string | ModuleNode>, acceptedExports: Set<string> | null, isSelfAccepting: boolean, ssr?: boolean,
|
|
840
|
+
): Promise<Set<ModuleNode> | undefined>;
|
|
822
841
|
ensureEntryFromUrl(rawUrl: string, ssr?: boolean, setIsSelfAccepting?: boolean): Promise<ModuleNode>;
|
|
823
842
|
createFileOnlyEntry(file: string): ModuleNode;
|
|
824
843
|
resolveUrl(url: string, ssr?: boolean): Promise<ResolvedUrl>;
|
|
@@ -826,7 +845,7 @@ declare class ModuleGraph {
|
|
|
826
845
|
|
|
827
846
|
/**
|
|
828
847
|
* This file is refactored into TypeScript based on
|
|
829
|
-
* https
|
|
848
|
+
* https://github.com/preactjs/wmr/blob/main/packages/wmr/src/lib/rollup-plugin-container.js
|
|
830
849
|
*/
|
|
831
850
|
|
|
832
851
|
interface PluginContainer {
|
|
@@ -834,7 +853,7 @@ interface PluginContainer {
|
|
|
834
853
|
getModuleInfo(id: string): ModuleInfo | null;
|
|
835
854
|
buildStart(options: InputOptions): Promise<void>;
|
|
836
855
|
resolveId(id: string, importer?: string, options?: {
|
|
837
|
-
|
|
856
|
+
attributes?: Record<string, string>;
|
|
838
857
|
custom?: CustomPluginOptions;
|
|
839
858
|
skip?: Set<Plugin>;
|
|
840
859
|
ssr?: boolean;
|
|
@@ -852,12 +871,18 @@ interface PluginContainer {
|
|
|
852
871
|
load(id: string, options?: {
|
|
853
872
|
ssr?: boolean;
|
|
854
873
|
}): Promise<LoadResult | null>;
|
|
874
|
+
watchChange(id: string, change: {
|
|
875
|
+
event: 'create' | 'update' | 'delete';
|
|
876
|
+
}): Promise<void>;
|
|
855
877
|
close(): Promise<void>;
|
|
856
878
|
}
|
|
857
879
|
|
|
880
|
+
// Modified and inlined to avoid extra dependency
|
|
881
|
+
// Source: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/ws/index.d.ts
|
|
882
|
+
|
|
858
883
|
declare const WebSocketAlias: typeof WebSocket
|
|
859
884
|
interface WebSocketAlias extends WebSocket {}
|
|
860
|
-
|
|
885
|
+
// WebSocket socket.
|
|
861
886
|
declare class WebSocket extends EventEmitter {
|
|
862
887
|
/** The connection is not yet open. */
|
|
863
888
|
static readonly CONNECTING: 0
|
|
@@ -935,7 +960,7 @@ declare class WebSocket extends EventEmitter {
|
|
|
935
960
|
*/
|
|
936
961
|
resume(): void
|
|
937
962
|
|
|
938
|
-
|
|
963
|
+
// HTML5 WebSocket events
|
|
939
964
|
addEventListener(
|
|
940
965
|
method: 'message',
|
|
941
966
|
cb: (event: WebSocket.MessageEvent) => void,
|
|
@@ -974,7 +999,7 @@ declare class WebSocket extends EventEmitter {
|
|
|
974
999
|
cb: (event: WebSocket.Event) => void,
|
|
975
1000
|
): void
|
|
976
1001
|
|
|
977
|
-
|
|
1002
|
+
// Events
|
|
978
1003
|
on(
|
|
979
1004
|
event: 'close',
|
|
980
1005
|
listener: (this: WebSocket, code: number, reason: Buffer) => void,
|
|
@@ -1125,7 +1150,7 @@ declare class WebSocket extends EventEmitter {
|
|
|
1125
1150
|
listener: (...args: any[]) => void,
|
|
1126
1151
|
): this
|
|
1127
1152
|
}
|
|
1128
|
-
|
|
1153
|
+
// tslint:disable-line no-empty-interface
|
|
1129
1154
|
|
|
1130
1155
|
declare namespace WebSocket {
|
|
1131
1156
|
/**
|
|
@@ -1270,7 +1295,7 @@ declare namespace WebSocket {
|
|
|
1270
1295
|
port: number
|
|
1271
1296
|
}
|
|
1272
1297
|
|
|
1273
|
-
|
|
1298
|
+
// WebSocket Server
|
|
1274
1299
|
class Server<T extends WebSocket = WebSocket> extends EventEmitter {
|
|
1275
1300
|
options: ServerOptions
|
|
1276
1301
|
path: string
|
|
@@ -1288,7 +1313,7 @@ declare namespace WebSocket {
|
|
|
1288
1313
|
): void
|
|
1289
1314
|
shouldHandle(request: IncomingMessage): boolean | Promise<boolean>
|
|
1290
1315
|
|
|
1291
|
-
|
|
1316
|
+
// Events
|
|
1292
1317
|
on(
|
|
1293
1318
|
event: 'connection',
|
|
1294
1319
|
cb: (this: Server<T>, socket: T, request: IncomingMessage) => void,
|
|
@@ -1375,11 +1400,11 @@ declare namespace WebSocket {
|
|
|
1375
1400
|
}
|
|
1376
1401
|
|
|
1377
1402
|
const WebSocketServer: typeof Server
|
|
1378
|
-
interface WebSocketServer extends Server {}
|
|
1403
|
+
interface WebSocketServer extends Server {} // tslint:disable-line no-empty-interface
|
|
1379
1404
|
const WebSocket: typeof WebSocketAlias
|
|
1380
|
-
interface WebSocket extends WebSocketAlias {}
|
|
1405
|
+
interface WebSocket extends WebSocketAlias {} // tslint:disable-line no-empty-interface
|
|
1381
1406
|
|
|
1382
|
-
|
|
1407
|
+
// WebSocket stream
|
|
1383
1408
|
function createWebSocketStream(
|
|
1384
1409
|
websocket: WebSocket,
|
|
1385
1410
|
options?: DuplexOptions,
|
|
@@ -1476,14 +1501,21 @@ interface ServerOptions extends CommonServerOptions {
|
|
|
1476
1501
|
};
|
|
1477
1502
|
/**
|
|
1478
1503
|
* chokidar watch options or null to disable FS watching
|
|
1479
|
-
* https
|
|
1504
|
+
* https://github.com/paulmillr/chokidar#api
|
|
1480
1505
|
*/
|
|
1481
1506
|
watch?: WatchOptions | null;
|
|
1482
1507
|
/**
|
|
1483
1508
|
* Create Vite dev server to be used as a middleware in an existing server
|
|
1484
1509
|
* @default false
|
|
1485
1510
|
*/
|
|
1486
|
-
middlewareMode?: boolean |
|
|
1511
|
+
middlewareMode?: boolean | {
|
|
1512
|
+
/**
|
|
1513
|
+
* Parent server instance to attach to
|
|
1514
|
+
*
|
|
1515
|
+
* This is needed to proxy WebSocket connections to the parent server.
|
|
1516
|
+
*/
|
|
1517
|
+
server: http.Server;
|
|
1518
|
+
};
|
|
1487
1519
|
/**
|
|
1488
1520
|
* Options for files served via '/\@fs/'.
|
|
1489
1521
|
*/
|
|
@@ -1491,7 +1523,7 @@ interface ServerOptions extends CommonServerOptions {
|
|
|
1491
1523
|
/**
|
|
1492
1524
|
* Origin for the generated asset URLs.
|
|
1493
1525
|
*
|
|
1494
|
-
* @example `http:
|
|
1526
|
+
* @example `http://127.0.0.1:8080`
|
|
1495
1527
|
*/
|
|
1496
1528
|
origin?: string;
|
|
1497
1529
|
/**
|
|
@@ -1501,7 +1533,7 @@ interface ServerOptions extends CommonServerOptions {
|
|
|
1501
1533
|
preTransformRequests?: boolean;
|
|
1502
1534
|
/**
|
|
1503
1535
|
* Whether or not to ignore-list source files in the dev server sourcemap, used to populate
|
|
1504
|
-
* the [`x_google_ignoreList` source map extension](https
|
|
1536
|
+
* the [`x_google_ignoreList` source map extension](https://developer.chrome.com/blog/devtools-better-angular-debugging/#the-x_google_ignorelist-source-map-extension).
|
|
1505
1537
|
*
|
|
1506
1538
|
* By default, it excludes all paths containing `node_modules`. You can pass `false` to
|
|
1507
1539
|
* disable this behavior, or, for full control, a function that takes the source path and
|
|
@@ -1541,6 +1573,7 @@ interface FileSystemServeOptions {
|
|
|
1541
1573
|
deny?: string[];
|
|
1542
1574
|
}
|
|
1543
1575
|
type ServerHook = (this: void, server: ViteDevServer) => (() => void) | void | Promise<(() => void) | void>;
|
|
1576
|
+
type HttpServer = http.Server | Http2SecureServer;
|
|
1544
1577
|
interface ViteDevServer {
|
|
1545
1578
|
/**
|
|
1546
1579
|
* The resolved vite config object
|
|
@@ -1552,17 +1585,17 @@ interface ViteDevServer {
|
|
|
1552
1585
|
* - Can also be used as the handler function of a custom http server
|
|
1553
1586
|
* or as a middleware in any connect-style Node.js frameworks
|
|
1554
1587
|
*
|
|
1555
|
-
* https
|
|
1588
|
+
* https://github.com/senchalabs/connect#use-middleware
|
|
1556
1589
|
*/
|
|
1557
1590
|
middlewares: Connect.Server;
|
|
1558
1591
|
/**
|
|
1559
1592
|
* native Node http server instance
|
|
1560
1593
|
* will be null in middleware mode
|
|
1561
1594
|
*/
|
|
1562
|
-
httpServer:
|
|
1595
|
+
httpServer: HttpServer | null;
|
|
1563
1596
|
/**
|
|
1564
1597
|
* chokidar watcher instance
|
|
1565
|
-
* https
|
|
1598
|
+
* https://github.com/paulmillr/chokidar#api
|
|
1566
1599
|
*/
|
|
1567
1600
|
watcher: FSWatcher;
|
|
1568
1601
|
/**
|
|
@@ -1588,6 +1621,12 @@ interface ViteDevServer {
|
|
|
1588
1621
|
* without going through the http request pipeline.
|
|
1589
1622
|
*/
|
|
1590
1623
|
transformRequest(url: string, options?: TransformOptions): Promise<TransformResult | null>;
|
|
1624
|
+
/**
|
|
1625
|
+
* Same as `transformRequest` but only warm up the URLs so the next request
|
|
1626
|
+
* will already be cached. The function will never throw as it handles and
|
|
1627
|
+
* reports errors internally.
|
|
1628
|
+
*/
|
|
1629
|
+
warmupRequest(url: string, options?: TransformOptions): Promise<void>;
|
|
1591
1630
|
/**
|
|
1592
1631
|
* Apply vite built-in HTML transforms and any plugin HTML transforms.
|
|
1593
1632
|
*/
|
|
@@ -1820,10 +1859,10 @@ interface RollupCommonJSOptions {
|
|
|
1820
1859
|
* imports i.e.
|
|
1821
1860
|
*
|
|
1822
1861
|
* ```js
|
|
1823
|
-
*
|
|
1862
|
+
* // input
|
|
1824
1863
|
* const foo = require('foo');
|
|
1825
1864
|
*
|
|
1826
|
-
*
|
|
1865
|
+
* // output
|
|
1827
1866
|
* import * as foo from 'foo';
|
|
1828
1867
|
* ```
|
|
1829
1868
|
*
|
|
@@ -1915,6 +1954,10 @@ interface RollupDynamicImportVarsOptions {
|
|
|
1915
1954
|
warnOnError?: boolean
|
|
1916
1955
|
}
|
|
1917
1956
|
|
|
1957
|
+
// Modified and inlined to avoid extra dependency
|
|
1958
|
+
// Source: https://github.com/terser/terser/blob/master/tools/terser.d.ts
|
|
1959
|
+
// BSD Licensed https://github.com/terser/terser/blob/master/LICENSE
|
|
1960
|
+
|
|
1918
1961
|
declare namespace Terser {
|
|
1919
1962
|
export type ECMA = 5 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020
|
|
1920
1963
|
|
|
@@ -2149,13 +2192,13 @@ interface BuildOptions {
|
|
|
2149
2192
|
*
|
|
2150
2193
|
* Default: 'modules' - Similar to `@babel/preset-env`'s targets.esmodules,
|
|
2151
2194
|
* transpile targeting browsers that natively support dynamic es module imports.
|
|
2152
|
-
* https
|
|
2195
|
+
* https://caniuse.com/es6-module-dynamic-import
|
|
2153
2196
|
*
|
|
2154
2197
|
* Another special value is 'esnext' - which only performs minimal transpiling
|
|
2155
2198
|
* (for minification compat) and assumes native dynamic imports support.
|
|
2156
2199
|
*
|
|
2157
|
-
* For custom targets, see https
|
|
2158
|
-
* https
|
|
2200
|
+
* For custom targets, see https://esbuild.github.io/api/#target and
|
|
2201
|
+
* https://esbuild.github.io/content-types/#javascript for more details.
|
|
2159
2202
|
* @default 'modules'
|
|
2160
2203
|
*/
|
|
2161
2204
|
target?: 'modules' | esbuild_TransformOptions['target'] | false;
|
|
@@ -2229,7 +2272,7 @@ interface BuildOptions {
|
|
|
2229
2272
|
minify?: boolean | 'terser' | 'esbuild';
|
|
2230
2273
|
/**
|
|
2231
2274
|
* Options for terser
|
|
2232
|
-
* https
|
|
2275
|
+
* https://terser.org/docs/api-reference#minify-options
|
|
2233
2276
|
*
|
|
2234
2277
|
* In addition, you can also pass a `maxWorkers: number` option to specify the
|
|
2235
2278
|
* max number of workers to spawn. Defaults to the number of CPUs minus 1.
|
|
@@ -2237,7 +2280,7 @@ interface BuildOptions {
|
|
|
2237
2280
|
terserOptions?: TerserOptions;
|
|
2238
2281
|
/**
|
|
2239
2282
|
* Will be merged with internal rollup options.
|
|
2240
|
-
* https
|
|
2283
|
+
* https://rollupjs.org/configuration-options/
|
|
2241
2284
|
*/
|
|
2242
2285
|
rollupOptions?: RollupOptions;
|
|
2243
2286
|
/**
|
|
@@ -2320,7 +2363,7 @@ interface BuildOptions {
|
|
|
2320
2363
|
chunkSizeWarningLimit?: number;
|
|
2321
2364
|
/**
|
|
2322
2365
|
* Rollup watch options
|
|
2323
|
-
* https
|
|
2366
|
+
* https://rollupjs.org/configuration-options/#watch
|
|
2324
2367
|
* @default null
|
|
2325
2368
|
*/
|
|
2326
2369
|
watch?: WatcherOptions | null;
|
|
@@ -2447,7 +2490,7 @@ interface DepOptimizationConfig {
|
|
|
2447
2490
|
* - `external` is also omitted, use Vite's `optimizeDeps.exclude` option
|
|
2448
2491
|
* - `plugins` are merged with Vite's dep plugin
|
|
2449
2492
|
*
|
|
2450
|
-
* https
|
|
2493
|
+
* https://esbuild.github.io/api
|
|
2451
2494
|
*/
|
|
2452
2495
|
esbuildOptions?: Omit<esbuild_BuildOptions, 'bundle' | 'entryPoints' | 'external' | 'write' | 'watch' | 'outdir' | 'outfile' | 'outbase' | 'outExtension' | 'metafile'>;
|
|
2453
2496
|
/**
|
|
@@ -2485,7 +2528,7 @@ type DepOptimizationOptions = DepOptimizationConfig & {
|
|
|
2485
2528
|
*
|
|
2486
2529
|
* If neither of these fit your needs, you can specify custom entries using
|
|
2487
2530
|
* this option - the value should be a fast-glob pattern or array of patterns
|
|
2488
|
-
* (https
|
|
2531
|
+
* (https://github.com/mrmlnc/fast-glob#basic-syntax) that are relative from
|
|
2489
2532
|
* vite project root. This will overwrite default entries inference.
|
|
2490
2533
|
*/
|
|
2491
2534
|
entries?: string | string[];
|
|
@@ -2592,14 +2635,9 @@ interface ResolvedSSROptions extends SSROptions {
|
|
|
2592
2635
|
|
|
2593
2636
|
interface ResolveOptions {
|
|
2594
2637
|
/**
|
|
2595
|
-
* @default ['module', 'jsnext:main', 'jsnext']
|
|
2638
|
+
* @default ['browser', 'module', 'jsnext:main', 'jsnext']
|
|
2596
2639
|
*/
|
|
2597
2640
|
mainFields?: string[];
|
|
2598
|
-
/**
|
|
2599
|
-
* @deprecated In future, `mainFields` should be used instead.
|
|
2600
|
-
* @default true
|
|
2601
|
-
*/
|
|
2602
|
-
browserField?: boolean;
|
|
2603
2641
|
conditions?: string[];
|
|
2604
2642
|
/**
|
|
2605
2643
|
* @default ['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json']
|
|
@@ -2635,6 +2673,8 @@ interface InternalResolveOptions extends Required<ResolveOptions> {
|
|
|
2635
2673
|
shouldExternalize?: (id: string, importer?: string) => boolean | undefined;
|
|
2636
2674
|
}
|
|
2637
2675
|
|
|
2676
|
+
// This file is autogenerated by build-prefixes.js. DO NOT EDIT!
|
|
2677
|
+
|
|
2638
2678
|
interface Targets {
|
|
2639
2679
|
android?: number,
|
|
2640
2680
|
chrome?: number,
|
|
@@ -2698,7 +2738,7 @@ interface CSSOptions {
|
|
|
2698
2738
|
*/
|
|
2699
2739
|
transformer?: 'postcss' | 'lightningcss';
|
|
2700
2740
|
/**
|
|
2701
|
-
* https
|
|
2741
|
+
* https://github.com/css-modules/postcss-modules
|
|
2702
2742
|
*/
|
|
2703
2743
|
modules?: CSSModulesOptions | false;
|
|
2704
2744
|
preprocessorOptions?: Record<string, any>;
|
|
@@ -2899,7 +2939,7 @@ interface Plugin<A = any> extends rollup.Plugin<A> {
|
|
|
2899
2939
|
* extend hooks with ssr flag
|
|
2900
2940
|
*/
|
|
2901
2941
|
resolveId?: ObjectHook<(this: PluginContext, source: string, importer: string | undefined, options: {
|
|
2902
|
-
|
|
2942
|
+
attributes: Record<string, string>;
|
|
2903
2943
|
custom?: CustomPluginOptions;
|
|
2904
2944
|
ssr?: boolean;
|
|
2905
2945
|
isEntry: boolean;
|
|
@@ -2912,6 +2952,9 @@ interface Plugin<A = any> extends rollup.Plugin<A> {
|
|
|
2912
2952
|
}) => Promise<rollup.TransformResult> | rollup.TransformResult>;
|
|
2913
2953
|
}
|
|
2914
2954
|
type HookHandler<T> = T extends ObjectHook<infer H> ? H : T;
|
|
2955
|
+
type PluginWithRequiredHook<K extends keyof Plugin> = Plugin & {
|
|
2956
|
+
[P in K]: NonNullable<Plugin[P]>;
|
|
2957
|
+
};
|
|
2915
2958
|
|
|
2916
2959
|
interface JsonOptions {
|
|
2917
2960
|
/**
|
|
@@ -2930,10 +2973,8 @@ interface JsonOptions {
|
|
|
2930
2973
|
interface ConfigEnv {
|
|
2931
2974
|
command: 'build' | 'serve';
|
|
2932
2975
|
mode: string;
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
*/
|
|
2936
|
-
ssrBuild?: boolean;
|
|
2976
|
+
isSsrBuild?: boolean;
|
|
2977
|
+
isPreview?: boolean;
|
|
2937
2978
|
}
|
|
2938
2979
|
/**
|
|
2939
2980
|
* spa: include SPA fallback middleware and configure sirv with `single: true` in preview
|
|
@@ -3095,9 +3136,11 @@ interface UserConfig {
|
|
|
3095
3136
|
*/
|
|
3096
3137
|
format?: 'es' | 'iife';
|
|
3097
3138
|
/**
|
|
3098
|
-
* Vite plugins that apply to worker bundle
|
|
3139
|
+
* Vite plugins that apply to worker bundle. The plugins returned by this function
|
|
3140
|
+
* should be new instances every time it is called, because they are used for each
|
|
3141
|
+
* rollup worker bundling process.
|
|
3099
3142
|
*/
|
|
3100
|
-
plugins?: PluginOption[];
|
|
3143
|
+
plugins?: () => PluginOption[];
|
|
3101
3144
|
/**
|
|
3102
3145
|
* Rollup options to build worker bundle
|
|
3103
3146
|
*/
|
|
@@ -3142,10 +3185,21 @@ interface ExperimentalOptions {
|
|
|
3142
3185
|
skipSsrTransform?: boolean;
|
|
3143
3186
|
}
|
|
3144
3187
|
interface LegacyOptions {
|
|
3188
|
+
/**
|
|
3189
|
+
* In Vite 4, SSR-externalized modules (modules not bundled and loaded by Node.js at runtime)
|
|
3190
|
+
* are implicitly proxied in dev to automatically handle `default` and `__esModule` access.
|
|
3191
|
+
* However, this does not correctly reflect how it works in the Node.js runtime, causing
|
|
3192
|
+
* inconsistencies between dev and prod.
|
|
3193
|
+
*
|
|
3194
|
+
* In Vite 5, the proxy is removed so dev and prod are consistent, but if you still require
|
|
3195
|
+
* the old behaviour, you can enable this option. If so, please leave your feedback at
|
|
3196
|
+
* https://github.com/vitejs/vite/discussions/14697.
|
|
3197
|
+
*/
|
|
3198
|
+
proxySsrExternalModules?: boolean;
|
|
3145
3199
|
}
|
|
3146
|
-
interface ResolvedWorkerOptions
|
|
3200
|
+
interface ResolvedWorkerOptions {
|
|
3147
3201
|
format: 'es' | 'iife';
|
|
3148
|
-
plugins: Plugin[]
|
|
3202
|
+
plugins: () => Promise<Plugin[]>;
|
|
3149
3203
|
rollupOptions: RollupOptions;
|
|
3150
3204
|
}
|
|
3151
3205
|
interface InlineConfig extends UserConfig {
|
|
@@ -3170,7 +3224,7 @@ type ResolvedConfig = Readonly<Omit<UserConfig, 'plugins' | 'css' | 'assetsInclu
|
|
|
3170
3224
|
alias: Alias[];
|
|
3171
3225
|
};
|
|
3172
3226
|
plugins: readonly Plugin[];
|
|
3173
|
-
css: ResolvedCSSOptions
|
|
3227
|
+
css: ResolvedCSSOptions;
|
|
3174
3228
|
esbuild: ESBuildOptions | false;
|
|
3175
3229
|
server: ResolvedServerOptions;
|
|
3176
3230
|
build: ResolvedBuildOptions;
|
|
@@ -3185,11 +3239,11 @@ type ResolvedConfig = Readonly<Omit<UserConfig, 'plugins' | 'css' | 'assetsInclu
|
|
|
3185
3239
|
experimental: ExperimentalOptions;
|
|
3186
3240
|
} & PluginHookUtils>;
|
|
3187
3241
|
interface PluginHookUtils {
|
|
3188
|
-
getSortedPlugins: (hookName:
|
|
3242
|
+
getSortedPlugins: <K extends keyof Plugin>(hookName: K) => PluginWithRequiredHook<K>[];
|
|
3189
3243
|
getSortedPluginHooks: <K extends keyof Plugin>(hookName: K) => NonNullable<HookHandler<Plugin[K]>>[];
|
|
3190
3244
|
}
|
|
3191
3245
|
type ResolveFn = (id: string, importer?: string, aliasOnly?: boolean, ssr?: boolean) => Promise<string | undefined>;
|
|
3192
|
-
declare function resolveConfig(inlineConfig: InlineConfig, command: 'build' | 'serve', defaultMode?: string, defaultNodeEnv?: string): Promise<ResolvedConfig>;
|
|
3246
|
+
declare function resolveConfig(inlineConfig: InlineConfig, command: 'build' | 'serve', defaultMode?: string, defaultNodeEnv?: string, isPreview?: boolean): Promise<ResolvedConfig>;
|
|
3193
3247
|
declare function sortUserPlugins(plugins: (Plugin | Plugin[])[] | undefined): [Plugin[], Plugin[], Plugin[]];
|
|
3194
3248
|
declare function loadConfigFromFile(configEnv: ConfigEnv, configFile?: string, configRoot?: string, logLevel?: LogLevel): Promise<{
|
|
3195
3249
|
path: string;
|
package/dist/node/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export { parseAst, parseAstAsync } from 'rollup/parseAst';
|
|
2
|
+
import { i as isInNodeModules } from './chunks/dep-T98iZFpD.js';
|
|
3
|
+
export { b as build, e as buildErrorMessage, h as createFilter, k as createLogger, c as createServer, d as defineConfig, f as formatPostcssSourceMap, u as isFileServingAllowed, l as loadConfigFromFile, v as loadEnv, g as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, a as preprocessCSS, p as preview, r as resolveConfig, w as resolveEnvPrefix, q as searchForWorkspaceRoot, j as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-T98iZFpD.js';
|
|
3
4
|
export { VERSION as version } from './constants.js';
|
|
4
5
|
export { version as esbuildVersion } from 'esbuild';
|
|
5
6
|
export { VERSION as rollupVersion } from 'rollup';
|
|
@@ -16,6 +17,7 @@ import 'fs';
|
|
|
16
17
|
import 'events';
|
|
17
18
|
import 'assert';
|
|
18
19
|
import 'node:http';
|
|
20
|
+
import 'node:https';
|
|
19
21
|
import 'util';
|
|
20
22
|
import 'net';
|
|
21
23
|
import 'url';
|
|
@@ -36,7 +38,6 @@ import 'node:v8';
|
|
|
36
38
|
import 'querystring';
|
|
37
39
|
import 'node:readline';
|
|
38
40
|
import 'node:events';
|
|
39
|
-
import 'node:https';
|
|
40
41
|
import 'zlib';
|
|
41
42
|
import 'buffer';
|
|
42
43
|
import 'https';
|