vite 3.0.0-alpha.8 → 3.0.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 +82 -3
- package/bin/vite.js +1 -1
- package/client.d.ts +12 -0
- package/dist/client/client.mjs +51 -9
- package/dist/client/client.mjs.map +1 -1
- package/dist/node/chunks/{dep-8250f392.js → dep-077259ad.js} +14726 -13068
- package/dist/node/chunks/{dep-8259d5f4.js → dep-35befe4f.js} +21 -9
- package/dist/node/chunks/{dep-17430d09.js → dep-58d622b1.js} +5 -5
- package/dist/node/chunks/{dep-6b269949.js → dep-cd58a191.js} +7 -7
- package/dist/node/chunks/{dep-cfa39351.js → dep-d0efd013.js} +4 -4
- package/dist/node/chunks/dep-e8ca8d40.js +3 -3
- package/dist/node/cli.js +24 -11
- package/dist/node/constants.js +22 -5
- package/dist/node/index.d.ts +161 -44
- package/dist/node/index.js +21 -8
- package/dist/node-cjs/publicUtils.cjs +2177 -28
- package/package.json +26 -25
- package/src/client/client.ts +95 -22
- package/types/chokidar.d.ts +2 -2
- package/types/connect.d.ts +1 -1
- package/types/hot.d.ts +17 -3
- package/types/http-proxy.d.ts +5 -5
- package/types/ws.d.ts +6 -6
- package/dist/node-cjs/terser.cjs +0 -31023
|
@@ -1,33 +1,45 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { y as commonjsGlobal } from './dep-077259ad.js';
|
|
2
2
|
import require$$1 from 'crypto';
|
|
3
|
-
import 'fs';
|
|
4
|
-
import 'path';
|
|
5
|
-
import 'url';
|
|
6
|
-
import 'perf_hooks';
|
|
7
|
-
import 'module';
|
|
3
|
+
import 'node:fs';
|
|
4
|
+
import 'node:path';
|
|
5
|
+
import 'node:url';
|
|
6
|
+
import 'node:perf_hooks';
|
|
7
|
+
import 'node:module';
|
|
8
8
|
import 'tty';
|
|
9
9
|
import 'esbuild';
|
|
10
|
+
import 'path';
|
|
11
|
+
import 'fs';
|
|
10
12
|
import 'events';
|
|
11
13
|
import 'assert';
|
|
12
14
|
import 'resolve';
|
|
13
15
|
import 'util';
|
|
14
16
|
import 'net';
|
|
17
|
+
import 'url';
|
|
15
18
|
import 'http';
|
|
16
19
|
import 'stream';
|
|
17
20
|
import 'os';
|
|
18
21
|
import 'child_process';
|
|
22
|
+
import 'node:os';
|
|
23
|
+
import 'node:crypto';
|
|
24
|
+
import 'node:util';
|
|
25
|
+
import 'node:dns';
|
|
19
26
|
import '../constants.js';
|
|
20
27
|
import 'buffer';
|
|
21
28
|
import 'querystring';
|
|
29
|
+
import 'module';
|
|
22
30
|
import 'zlib';
|
|
23
31
|
import 'https';
|
|
24
32
|
import 'tls';
|
|
33
|
+
import 'node:http';
|
|
34
|
+
import 'node:https';
|
|
25
35
|
import 'worker_threads';
|
|
26
36
|
import 'readline';
|
|
37
|
+
import 'node:child_process';
|
|
38
|
+
import 'node:zlib';
|
|
27
39
|
|
|
28
|
-
import { fileURLToPath as __cjs_fileURLToPath } from 'url';
|
|
29
|
-
import { dirname as __cjs_dirname } from 'path';
|
|
30
|
-
import { createRequire as __cjs_createRequire } from 'module';
|
|
40
|
+
import { fileURLToPath as __cjs_fileURLToPath } from 'node:url';
|
|
41
|
+
import { dirname as __cjs_dirname } from 'node:path';
|
|
42
|
+
import { createRequire as __cjs_createRequire } from 'node:module';
|
|
31
43
|
|
|
32
44
|
const __filename = __cjs_fileURLToPath(import.meta.url);
|
|
33
45
|
const __dirname = __cjs_dirname(__filename);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import path$3 from 'path';
|
|
2
2
|
import __resolve from 'resolve';
|
|
3
|
-
import
|
|
3
|
+
import require$$0__default from 'fs';
|
|
4
4
|
import { l as lib } from './dep-e8ca8d40.js';
|
|
5
5
|
|
|
6
|
-
import { fileURLToPath as __cjs_fileURLToPath } from 'url';
|
|
7
|
-
import { dirname as __cjs_dirname } from 'path';
|
|
8
|
-
import { createRequire as __cjs_createRequire } from 'module';
|
|
6
|
+
import { fileURLToPath as __cjs_fileURLToPath } from 'node:url';
|
|
7
|
+
import { dirname as __cjs_dirname } from 'node:path';
|
|
8
|
+
import { createRequire as __cjs_createRequire } from 'node:module';
|
|
9
9
|
|
|
10
10
|
const __filename = __cjs_fileURLToPath(import.meta.url);
|
|
11
11
|
const __dirname = __cjs_dirname(__filename);
|
|
@@ -159,7 +159,7 @@ var pify$1 = pify$2.exports = function (obj, P, opts) {
|
|
|
159
159
|
|
|
160
160
|
pify$1.all = pify$1;
|
|
161
161
|
|
|
162
|
-
var fs =
|
|
162
|
+
var fs = require$$0__default;
|
|
163
163
|
var path$2 = path$3;
|
|
164
164
|
var pify = pify$2.exports;
|
|
165
165
|
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import require$$0 from 'postcss';
|
|
2
|
-
import {
|
|
2
|
+
import { y as commonjsGlobal } from './dep-077259ad.js';
|
|
3
3
|
import path$2 from 'path';
|
|
4
4
|
import require$$1 from 'crypto';
|
|
5
|
-
import
|
|
5
|
+
import require$$0__default from 'fs';
|
|
6
6
|
import require$$0$1 from 'util';
|
|
7
7
|
import { l as lib$1 } from './dep-e8ca8d40.js';
|
|
8
8
|
|
|
9
|
-
import { fileURLToPath as __cjs_fileURLToPath } from 'url';
|
|
10
|
-
import { dirname as __cjs_dirname } from 'path';
|
|
11
|
-
import { createRequire as __cjs_createRequire } from 'module';
|
|
9
|
+
import { fileURLToPath as __cjs_fileURLToPath } from 'node:url';
|
|
10
|
+
import { dirname as __cjs_dirname } from 'node:path';
|
|
11
|
+
import { createRequire as __cjs_createRequire } from 'node:module';
|
|
12
12
|
|
|
13
13
|
const __filename = __cjs_fileURLToPath(import.meta.url);
|
|
14
14
|
const __dirname = __cjs_dirname(__filename);
|
|
@@ -1482,7 +1482,7 @@ var _postcss$1 = require$$0;
|
|
|
1482
1482
|
|
|
1483
1483
|
var _postcss2$1 = _interopRequireDefault$5(_postcss$1);
|
|
1484
1484
|
|
|
1485
|
-
var _fs$1 =
|
|
1485
|
+
var _fs$1 = require$$0__default;
|
|
1486
1486
|
|
|
1487
1487
|
var _fs2 = _interopRequireDefault$5(_fs$1);
|
|
1488
1488
|
|
|
@@ -1638,7 +1638,7 @@ Object.defineProperty(saveJSON$1, "__esModule", {
|
|
|
1638
1638
|
});
|
|
1639
1639
|
saveJSON$1.default = saveJSON;
|
|
1640
1640
|
|
|
1641
|
-
var _fs =
|
|
1641
|
+
var _fs = require$$0__default;
|
|
1642
1642
|
|
|
1643
1643
|
function saveJSON(cssFile, json) {
|
|
1644
1644
|
return new Promise((resolve, reject) => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { z as getAugmentedNamespace, A as getDefaultExportFromCjs } from './dep-077259ad.js';
|
|
2
2
|
|
|
3
|
-
import { fileURLToPath as __cjs_fileURLToPath } from 'url';
|
|
4
|
-
import { dirname as __cjs_dirname } from 'path';
|
|
5
|
-
import { createRequire as __cjs_createRequire } from 'module';
|
|
3
|
+
import { fileURLToPath as __cjs_fileURLToPath } from 'node:url';
|
|
4
|
+
import { dirname as __cjs_dirname } from 'node:path';
|
|
5
|
+
import { createRequire as __cjs_createRequire } from 'node:module';
|
|
6
6
|
|
|
7
7
|
const __filename = __cjs_fileURLToPath(import.meta.url);
|
|
8
8
|
const __dirname = __cjs_dirname(__filename);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { fileURLToPath as __cjs_fileURLToPath } from 'url';
|
|
2
|
-
import { dirname as __cjs_dirname } from 'path';
|
|
3
|
-
import { createRequire as __cjs_createRequire } from 'module';
|
|
1
|
+
import { fileURLToPath as __cjs_fileURLToPath } from 'node:url';
|
|
2
|
+
import { dirname as __cjs_dirname } from 'node:path';
|
|
3
|
+
import { createRequire as __cjs_createRequire } from 'node:module';
|
|
4
4
|
|
|
5
5
|
const __filename = __cjs_fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __cjs_dirname(__filename);
|
package/dist/node/cli.js
CHANGED
|
@@ -1,29 +1,41 @@
|
|
|
1
|
-
import { performance } from 'perf_hooks';
|
|
1
|
+
import { performance } from 'node:perf_hooks';
|
|
2
2
|
import { EventEmitter } from 'events';
|
|
3
|
-
import {
|
|
3
|
+
import { x as colors, q as createLogger, e as resolveConfig } from './chunks/dep-077259ad.js';
|
|
4
4
|
import { VERSION } from './constants.js';
|
|
5
|
-
import 'fs';
|
|
6
|
-
import 'path';
|
|
7
|
-
import 'url';
|
|
8
|
-
import 'module';
|
|
5
|
+
import 'node:fs';
|
|
6
|
+
import 'node:path';
|
|
7
|
+
import 'node:url';
|
|
8
|
+
import 'node:module';
|
|
9
9
|
import 'tty';
|
|
10
10
|
import 'esbuild';
|
|
11
|
+
import 'path';
|
|
12
|
+
import 'fs';
|
|
11
13
|
import 'assert';
|
|
12
14
|
import 'resolve';
|
|
13
15
|
import 'util';
|
|
14
16
|
import 'net';
|
|
17
|
+
import 'url';
|
|
15
18
|
import 'http';
|
|
16
19
|
import 'stream';
|
|
17
20
|
import 'os';
|
|
18
21
|
import 'child_process';
|
|
22
|
+
import 'node:os';
|
|
23
|
+
import 'node:crypto';
|
|
24
|
+
import 'node:util';
|
|
25
|
+
import 'node:dns';
|
|
19
26
|
import 'crypto';
|
|
20
27
|
import 'buffer';
|
|
21
28
|
import 'querystring';
|
|
29
|
+
import 'module';
|
|
22
30
|
import 'zlib';
|
|
23
31
|
import 'https';
|
|
24
32
|
import 'tls';
|
|
33
|
+
import 'node:http';
|
|
34
|
+
import 'node:https';
|
|
25
35
|
import 'worker_threads';
|
|
26
36
|
import 'readline';
|
|
37
|
+
import 'node:child_process';
|
|
38
|
+
import 'node:zlib';
|
|
27
39
|
|
|
28
40
|
function toArr(any) {
|
|
29
41
|
return any == null ? [] : Array.isArray(any) ? any : [any];
|
|
@@ -682,7 +694,7 @@ cli
|
|
|
682
694
|
.action(async (root, options) => {
|
|
683
695
|
// output structure is preserved even after bundling so require()
|
|
684
696
|
// is ok here
|
|
685
|
-
const { createServer } = await import('./chunks/dep-
|
|
697
|
+
const { createServer } = await import('./chunks/dep-077259ad.js').then(function (n) { return n.D; });
|
|
686
698
|
try {
|
|
687
699
|
const server = await createServer({
|
|
688
700
|
root,
|
|
@@ -691,6 +703,7 @@ cli
|
|
|
691
703
|
configFile: options.config,
|
|
692
704
|
logLevel: options.logLevel,
|
|
693
705
|
clearScreen: options.clearScreen,
|
|
706
|
+
optimizeDeps: { force: options.force },
|
|
694
707
|
server: cleanOptions(options)
|
|
695
708
|
});
|
|
696
709
|
if (!server.httpServer) {
|
|
@@ -728,7 +741,7 @@ cli
|
|
|
728
741
|
.option('--emptyOutDir', `[boolean] force empty outDir when it's outside of root`)
|
|
729
742
|
.option('-w, --watch', `[boolean] rebuilds when modules have changed on disk`)
|
|
730
743
|
.action(async (root, options) => {
|
|
731
|
-
const { build } = await import('./chunks/dep-
|
|
744
|
+
const { build } = await import('./chunks/dep-077259ad.js').then(function (n) { return n.C; });
|
|
732
745
|
const buildOptions = cleanOptions(options);
|
|
733
746
|
try {
|
|
734
747
|
await build({
|
|
@@ -738,7 +751,7 @@ cli
|
|
|
738
751
|
configFile: options.config,
|
|
739
752
|
logLevel: options.logLevel,
|
|
740
753
|
clearScreen: options.clearScreen,
|
|
741
|
-
force: options.force,
|
|
754
|
+
optimizeDeps: { force: options.force },
|
|
742
755
|
build: buildOptions
|
|
743
756
|
});
|
|
744
757
|
}
|
|
@@ -752,7 +765,7 @@ cli
|
|
|
752
765
|
.command('optimize [root]', 'pre-bundle dependencies')
|
|
753
766
|
.option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
|
|
754
767
|
.action(async (root, options) => {
|
|
755
|
-
const { optimizeDeps } = await import('./chunks/dep-
|
|
768
|
+
const { optimizeDeps } = await import('./chunks/dep-077259ad.js').then(function (n) { return n.B; });
|
|
756
769
|
try {
|
|
757
770
|
const config = await resolveConfig({
|
|
758
771
|
root,
|
|
@@ -775,7 +788,7 @@ cli
|
|
|
775
788
|
.option('--https', `[boolean] use TLS + HTTP/2`)
|
|
776
789
|
.option('--open [path]', `[boolean | string] open browser on startup`)
|
|
777
790
|
.action(async (root, options) => {
|
|
778
|
-
const { preview } = await import('./chunks/dep-
|
|
791
|
+
const { preview } = await import('./chunks/dep-077259ad.js').then(function (n) { return n.E; });
|
|
779
792
|
try {
|
|
780
793
|
const server = await preview({
|
|
781
794
|
root,
|
package/dist/node/constants.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import path, { resolve } from 'path';
|
|
2
|
-
import { fileURLToPath } from 'url';
|
|
1
|
+
import path, { resolve } from 'node:path';
|
|
2
|
+
import { fileURLToPath } from 'node:url';
|
|
3
3
|
|
|
4
|
-
var version = "3.0.0-
|
|
4
|
+
var version = "3.0.0-beta.1";
|
|
5
5
|
|
|
6
6
|
const VERSION = version;
|
|
7
7
|
const DEFAULT_MAIN_FIELDS = [
|
|
@@ -48,11 +48,17 @@ const ENV_ENTRY = resolve(VITE_PACKAGE_DIR, 'dist/client/env.mjs');
|
|
|
48
48
|
const CLIENT_DIR = path.dirname(CLIENT_ENTRY);
|
|
49
49
|
// ** READ THIS ** before editing `KNOWN_ASSET_TYPES`.
|
|
50
50
|
// If you add an asset to `KNOWN_ASSET_TYPES`, make sure to also add it
|
|
51
|
-
// to the TypeScript declaration file `packages/vite/client.d.ts
|
|
51
|
+
// to the TypeScript declaration file `packages/vite/client.d.ts` and
|
|
52
|
+
// add a mime type to the `registerCustomMime` in
|
|
53
|
+
// `packages/vite/src/node/plugin/assets.ts` if mime type cannot be
|
|
54
|
+
// looked up by mrmime.
|
|
52
55
|
const KNOWN_ASSET_TYPES = [
|
|
53
56
|
// images
|
|
54
57
|
'png',
|
|
55
58
|
'jpe?g',
|
|
59
|
+
'jfif',
|
|
60
|
+
'pjpeg',
|
|
61
|
+
'pjp',
|
|
56
62
|
'gif',
|
|
57
63
|
'svg',
|
|
58
64
|
'ico',
|
|
@@ -78,5 +84,16 @@ const KNOWN_ASSET_TYPES = [
|
|
|
78
84
|
];
|
|
79
85
|
const DEFAULT_ASSETS_RE = new RegExp(`\\.(` + KNOWN_ASSET_TYPES.join('|') + `)(\\?.*)?$`);
|
|
80
86
|
const DEP_VERSION_RE = /[\?&](v=[\w\.-]+)\b/;
|
|
87
|
+
const loopbackHosts = new Set([
|
|
88
|
+
'localhost',
|
|
89
|
+
'127.0.0.1',
|
|
90
|
+
'::1',
|
|
91
|
+
'0000:0000:0000:0000:0000:0000:0000:0001'
|
|
92
|
+
]);
|
|
93
|
+
const wildcardHosts = new Set([
|
|
94
|
+
'0.0.0.0',
|
|
95
|
+
'::',
|
|
96
|
+
'0000:0000:0000:0000:0000:0000:0000:0000'
|
|
97
|
+
]);
|
|
81
98
|
|
|
82
|
-
export { CLIENT_DIR, CLIENT_ENTRY, CLIENT_PUBLIC_PATH, DEFAULT_ASSETS_RE, DEFAULT_EXTENSIONS, DEFAULT_MAIN_FIELDS, DEP_VERSION_RE, ENV_ENTRY, ENV_PUBLIC_PATH, FS_PREFIX, JS_TYPES_RE, KNOWN_ASSET_TYPES, NULL_BYTE_PLACEHOLDER, OPTIMIZABLE_ENTRY_RE, SPECIAL_QUERY_RE, VALID_ID_PREFIX, VERSION, VITE_PACKAGE_DIR };
|
|
99
|
+
export { CLIENT_DIR, CLIENT_ENTRY, CLIENT_PUBLIC_PATH, DEFAULT_ASSETS_RE, DEFAULT_EXTENSIONS, DEFAULT_MAIN_FIELDS, DEP_VERSION_RE, ENV_ENTRY, ENV_PUBLIC_PATH, FS_PREFIX, JS_TYPES_RE, KNOWN_ASSET_TYPES, NULL_BYTE_PLACEHOLDER, OPTIMIZABLE_ENTRY_RE, SPECIAL_QUERY_RE, VALID_ID_PREFIX, VERSION, VITE_PACKAGE_DIR, loopbackHosts, wildcardHosts };
|