vite 2.8.0-beta.3 → 2.8.0-beta.7
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.
Potentially problematic release.
This version of vite might be problematic. Click here for more details.
- package/CHANGELOG.md +47 -1
- package/LICENSE.md +34 -6
- package/dist/client/client.mjs +10 -5
- package/dist/client/client.mjs.map +1 -1
- package/dist/node/chunks/{dep-885d4c21.js → dep-6a30742f.js} +1 -1
- package/dist/node/chunks/{dep-84e12b4e.js → dep-752d5fd3.js} +1 -1
- package/dist/node/chunks/{dep-6f0b746c.js → dep-9e561a04.js} +16 -4
- package/dist/node/chunks/{dep-a5ab6d86.js → dep-c9c9d3e5.js} +1282 -2025
- package/dist/node/cli.js +4 -4
- package/dist/node/index.d.ts +18 -18
- package/dist/node/index.js +1 -1
- package/package.json +20 -20
- package/src/client/client.ts +18 -10
- package/types/chokidar.d.ts +27 -18
package/dist/node/cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var require$$0 = require('events');
|
|
4
|
-
var build = require('./chunks/dep-
|
|
4
|
+
var build = require('./chunks/dep-c9c9d3e5.js');
|
|
5
5
|
var perf_hooks = require('perf_hooks');
|
|
6
6
|
require('fs');
|
|
7
7
|
require('path');
|
|
@@ -683,7 +683,7 @@ cli
|
|
|
683
683
|
.action(async (root, options) => {
|
|
684
684
|
// output structure is preserved even after bundling so require()
|
|
685
685
|
// is ok here
|
|
686
|
-
const { createServer } = await Promise.resolve().then(function () { return require('./chunks/dep-
|
|
686
|
+
const { createServer } = await Promise.resolve().then(function () { return require('./chunks/dep-c9c9d3e5.js'); }).then(function (n) { return n.index$1; });
|
|
687
687
|
try {
|
|
688
688
|
const server = await createServer({
|
|
689
689
|
root,
|
|
@@ -732,7 +732,7 @@ cli
|
|
|
732
732
|
.option('--emptyOutDir', `[boolean] force empty outDir when it's outside of root`)
|
|
733
733
|
.option('-w, --watch', `[boolean] rebuilds when modules have changed on disk`)
|
|
734
734
|
.action(async (root, options) => {
|
|
735
|
-
const { build: build$1 } = await Promise.resolve().then(function () { return require('./chunks/dep-
|
|
735
|
+
const { build: build$1 } = await Promise.resolve().then(function () { return require('./chunks/dep-c9c9d3e5.js'); }).then(function (n) { return n.build$1; });
|
|
736
736
|
const buildOptions = cleanOptions(options);
|
|
737
737
|
try {
|
|
738
738
|
await build$1({
|
|
@@ -755,7 +755,7 @@ cli
|
|
|
755
755
|
.command('optimize [root]')
|
|
756
756
|
.option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
|
|
757
757
|
.action(async (root, options) => {
|
|
758
|
-
const { optimizeDeps } = await Promise.resolve().then(function () { return require('./chunks/dep-
|
|
758
|
+
const { optimizeDeps } = await Promise.resolve().then(function () { return require('./chunks/dep-c9c9d3e5.js'); }).then(function (n) { return n.index; });
|
|
759
759
|
try {
|
|
760
760
|
const config = await build.resolveConfig({
|
|
761
761
|
root,
|
package/dist/node/index.d.ts
CHANGED
|
@@ -74,6 +74,18 @@ export declare type AnymatchFn = (testString: string) => boolean
|
|
|
74
74
|
|
|
75
75
|
export declare type AnymatchPattern = string | RegExp | AnymatchFn
|
|
76
76
|
|
|
77
|
+
export declare interface AwaitWriteFinishOptions {
|
|
78
|
+
/**
|
|
79
|
+
* Amount of time in milliseconds for a file size to remain constant before emitting its event.
|
|
80
|
+
*/
|
|
81
|
+
stabilityThreshold?: number
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* File size polling interval.
|
|
85
|
+
*/
|
|
86
|
+
pollInterval?: number
|
|
87
|
+
}
|
|
88
|
+
|
|
77
89
|
/**
|
|
78
90
|
* Bundles the app for production.
|
|
79
91
|
* Returns a Promise containing the build result.
|
|
@@ -601,25 +613,25 @@ export declare interface FileSystemServeOptions {
|
|
|
601
613
|
deny?: string[];
|
|
602
614
|
}
|
|
603
615
|
|
|
604
|
-
export declare
|
|
616
|
+
export declare class FSWatcher extends EventEmitter implements fs.FSWatcher {
|
|
605
617
|
options: WatchOptions
|
|
606
618
|
|
|
607
619
|
/**
|
|
608
620
|
* Constructs a new FSWatcher instance with optional WatchOptions parameter.
|
|
609
621
|
*/
|
|
610
|
-
(options?: WatchOptions)
|
|
622
|
+
constructor(options?: WatchOptions)
|
|
611
623
|
|
|
612
624
|
/**
|
|
613
625
|
* Add files, directories, or glob patterns for tracking. Takes an array of strings or just one
|
|
614
626
|
* string.
|
|
615
627
|
*/
|
|
616
|
-
add(paths: string | ReadonlyArray<string>):
|
|
628
|
+
add(paths: string | ReadonlyArray<string>): this
|
|
617
629
|
|
|
618
630
|
/**
|
|
619
631
|
* Stop watching files, directories, or glob patterns. Takes an array of strings or just one
|
|
620
632
|
* string.
|
|
621
633
|
*/
|
|
622
|
-
unwatch(paths: string | ReadonlyArray<string>):
|
|
634
|
+
unwatch(paths: string | ReadonlyArray<string>): this
|
|
623
635
|
|
|
624
636
|
/**
|
|
625
637
|
* Returns an object representing all the paths on the file system being watched by this
|
|
@@ -2163,7 +2175,7 @@ export declare interface WatchOptions {
|
|
|
2163
2175
|
|
|
2164
2176
|
/**
|
|
2165
2177
|
* Whether to use the `fsevents` watching interface if available. When set to `true` explicitly
|
|
2166
|
-
* and `fsevents` is available this
|
|
2178
|
+
* and `fsevents` is available this supercedes the `usePolling` setting. When set to `false` on
|
|
2167
2179
|
* OS X, `usePolling: true` becomes the default.
|
|
2168
2180
|
*/
|
|
2169
2181
|
useFsEvents?: boolean
|
|
@@ -2210,19 +2222,7 @@ export declare interface WatchOptions {
|
|
|
2210
2222
|
/**
|
|
2211
2223
|
* can be set to an object in order to adjust timing params:
|
|
2212
2224
|
*/
|
|
2213
|
-
awaitWriteFinish?:
|
|
2214
|
-
| {
|
|
2215
|
-
/**
|
|
2216
|
-
* Amount of time in milliseconds for a file size to remain constant before emitting its event.
|
|
2217
|
-
*/
|
|
2218
|
-
stabilityThreshold?: number
|
|
2219
|
-
|
|
2220
|
-
/**
|
|
2221
|
-
* File size polling interval.
|
|
2222
|
-
*/
|
|
2223
|
-
pollInterval?: number
|
|
2224
|
-
}
|
|
2225
|
-
| boolean
|
|
2225
|
+
awaitWriteFinish?: AwaitWriteFinishOptions | boolean
|
|
2226
2226
|
}
|
|
2227
2227
|
|
|
2228
2228
|
export declare class WebSocket extends EventEmitter {
|
package/dist/node/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite",
|
|
3
|
-
"version": "2.8.0-beta.
|
|
3
|
+
"version": "2.8.0-beta.7",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Evan You",
|
|
6
6
|
"description": "Native-ESM powered web dev build tool",
|
|
@@ -44,23 +44,23 @@
|
|
|
44
44
|
},
|
|
45
45
|
"//": "READ CONTRIBUTING.md to understand what to put under deps vs. devDeps!",
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"esbuild": "0.14.
|
|
47
|
+
"esbuild": "^0.14.14",
|
|
48
48
|
"postcss": "^8.4.5",
|
|
49
|
-
"resolve": "^1.
|
|
49
|
+
"resolve": "^1.22.0",
|
|
50
50
|
"rollup": "^2.59.0"
|
|
51
51
|
},
|
|
52
52
|
"optionalDependencies": {
|
|
53
53
|
"fsevents": "~2.3.2"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@ampproject/remapping": "^1.
|
|
57
|
-
"@babel/parser": "^7.16.
|
|
58
|
-
"@babel/types": "^7.16.
|
|
59
|
-
"@rollup/plugin-alias": "^3.1.
|
|
56
|
+
"@ampproject/remapping": "^1.1.1",
|
|
57
|
+
"@babel/parser": "^7.16.12",
|
|
58
|
+
"@babel/types": "^7.16.8",
|
|
59
|
+
"@rollup/plugin-alias": "^3.1.9",
|
|
60
60
|
"@rollup/plugin-commonjs": "^21.0.1",
|
|
61
61
|
"@rollup/plugin-dynamic-import-vars": "^1.4.2",
|
|
62
62
|
"@rollup/plugin-json": "^4.1.0",
|
|
63
|
-
"@rollup/plugin-node-resolve": "13.1.
|
|
63
|
+
"@rollup/plugin-node-resolve": "13.1.3",
|
|
64
64
|
"@rollup/plugin-typescript": "^8.3.0",
|
|
65
65
|
"@rollup/pluginutils": "^4.1.2",
|
|
66
66
|
"@types/convert-source-map": "^1.5.2",
|
|
@@ -71,15 +71,15 @@
|
|
|
71
71
|
"@types/less": "^3.0.3",
|
|
72
72
|
"@types/micromatch": "^4.0.2",
|
|
73
73
|
"@types/mime": "^2.0.3",
|
|
74
|
-
"@types/node": "^16.11.
|
|
74
|
+
"@types/node": "^16.11.21",
|
|
75
75
|
"@types/resolve": "^1.20.1",
|
|
76
76
|
"@types/sass": "~1.43.1",
|
|
77
77
|
"@types/stylus": "^0.48.36",
|
|
78
78
|
"@types/ws": "^8.2.2",
|
|
79
|
-
"@vue/compiler-dom": "^3.2.
|
|
79
|
+
"@vue/compiler-dom": "^3.2.29",
|
|
80
80
|
"acorn": "^8.7.0",
|
|
81
81
|
"cac": "6.7.9",
|
|
82
|
-
"chokidar": "^3.5.
|
|
82
|
+
"chokidar": "^3.5.3",
|
|
83
83
|
"compression": "^1.7.4",
|
|
84
84
|
"connect": "^3.7.0",
|
|
85
85
|
"connect-history-api-fallback": "^1.6.0",
|
|
@@ -87,19 +87,19 @@
|
|
|
87
87
|
"cors": "^2.8.5",
|
|
88
88
|
"cross-spawn": "^7.0.3",
|
|
89
89
|
"debug": "^4.3.3",
|
|
90
|
-
"dotenv": "^
|
|
91
|
-
"dotenv-expand": "^
|
|
90
|
+
"dotenv": "^14.3.2",
|
|
91
|
+
"dotenv-expand": "^6.0.1",
|
|
92
92
|
"es-module-lexer": "^0.9.3",
|
|
93
93
|
"estree-walker": "^2.0.2",
|
|
94
94
|
"etag": "^1.8.1",
|
|
95
|
-
"fast-glob": "^3.2.
|
|
95
|
+
"fast-glob": "^3.2.11",
|
|
96
96
|
"http-proxy": "^1.18.1",
|
|
97
97
|
"json5": "^2.2.0",
|
|
98
98
|
"launch-editor-middleware": "^2.3.0",
|
|
99
99
|
"magic-string": "^0.25.7",
|
|
100
100
|
"micromatch": "^4.0.4",
|
|
101
101
|
"mrmime": "^1.0.0",
|
|
102
|
-
"node-forge": "^1.2.
|
|
102
|
+
"node-forge": "^1.2.1",
|
|
103
103
|
"okie": "^1.0.1",
|
|
104
104
|
"open": "^8.4.0",
|
|
105
105
|
"periscopic": "^2.0.3",
|
|
@@ -108,16 +108,16 @@
|
|
|
108
108
|
"postcss-load-config": "^3.1.1",
|
|
109
109
|
"postcss-modules": "^4.3.0",
|
|
110
110
|
"resolve.exports": "^1.1.0",
|
|
111
|
-
"rollup-plugin-license": "^2.6.
|
|
112
|
-
"sirv": "^2.0.
|
|
113
|
-
"source-map": "^0.
|
|
111
|
+
"rollup-plugin-license": "^2.6.1",
|
|
112
|
+
"sirv": "^2.0.2",
|
|
113
|
+
"source-map-js": "^1.0.2",
|
|
114
114
|
"source-map-support": "^0.5.21",
|
|
115
115
|
"strip-ansi": "^6.0.1",
|
|
116
116
|
"terser": "^5.10.0",
|
|
117
|
-
"tsconfck": "1.1.
|
|
117
|
+
"tsconfck": "1.1.2",
|
|
118
118
|
"tslib": "^2.3.1",
|
|
119
119
|
"types": "link:./types",
|
|
120
|
-
"ws": "^8.4.
|
|
120
|
+
"ws": "^8.4.2"
|
|
121
121
|
},
|
|
122
122
|
"peerDependencies": {
|
|
123
123
|
"less": "*",
|
package/src/client/client.ts
CHANGED
|
@@ -39,6 +39,12 @@ function warnFailedFetch(err: Error, path: string | string[]) {
|
|
|
39
39
|
)
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
function cleanUrl(pathname: string): string {
|
|
43
|
+
const url = new URL(pathname, location.toString())
|
|
44
|
+
url.searchParams.delete('direct')
|
|
45
|
+
return url.pathname + url.search
|
|
46
|
+
}
|
|
47
|
+
|
|
42
48
|
// Listen for messages
|
|
43
49
|
socket.addEventListener('message', async ({ data }) => {
|
|
44
50
|
handleMessage(JSON.parse(data))
|
|
@@ -73,21 +79,21 @@ async function handleMessage(payload: HMRPayload) {
|
|
|
73
79
|
} else {
|
|
74
80
|
// css-update
|
|
75
81
|
// this is only sent when a css file referenced with <link> is updated
|
|
76
|
-
|
|
77
|
-
|
|
82
|
+
const { path, timestamp } = update
|
|
83
|
+
const searchUrl = cleanUrl(path)
|
|
78
84
|
// can't use querySelector with `[href*=]` here since the link may be
|
|
79
85
|
// using relative paths so we need to use link.href to grab the full
|
|
80
86
|
// URL for the include check.
|
|
81
87
|
const el = Array.from(
|
|
82
88
|
document.querySelectorAll<HTMLLinkElement>('link')
|
|
83
|
-
).find((e) => e.href.includes(
|
|
89
|
+
).find((e) => cleanUrl(e.href).includes(searchUrl))
|
|
84
90
|
if (el) {
|
|
85
|
-
const newPath = `${base}${
|
|
86
|
-
|
|
91
|
+
const newPath = `${base}${searchUrl.slice(1)}${
|
|
92
|
+
searchUrl.includes('?') ? '&' : '?'
|
|
87
93
|
}t=${timestamp}`
|
|
88
94
|
el.href = new URL(newPath, el.href).href
|
|
89
95
|
}
|
|
90
|
-
console.log(`[vite] css hot updated: ${
|
|
96
|
+
console.log(`[vite] css hot updated: ${searchUrl}`)
|
|
91
97
|
}
|
|
92
98
|
})
|
|
93
99
|
break
|
|
@@ -226,10 +232,12 @@ socket.addEventListener('close', async ({ wasClean }) => {
|
|
|
226
232
|
|
|
227
233
|
// https://wicg.github.io/construct-stylesheets
|
|
228
234
|
const supportsConstructedSheet = (() => {
|
|
229
|
-
try
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
235
|
+
// TODO: re-enable this try block once Chrome fixes the performance of
|
|
236
|
+
// rule insertion in really big stylesheets
|
|
237
|
+
// try {
|
|
238
|
+
// new CSSStyleSheet()
|
|
239
|
+
// return true
|
|
240
|
+
// } catch (e) {}
|
|
233
241
|
return false
|
|
234
242
|
})()
|
|
235
243
|
|
package/types/chokidar.d.ts
CHANGED
|
@@ -29,27 +29,28 @@ THE SOFTWARE.
|
|
|
29
29
|
/// <reference types="node" />
|
|
30
30
|
|
|
31
31
|
import type * as fs from 'fs'
|
|
32
|
+
import { EventEmitter } from 'events'
|
|
32
33
|
import type { Matcher } from './anymatch'
|
|
33
34
|
|
|
34
|
-
export
|
|
35
|
+
export class FSWatcher extends EventEmitter implements fs.FSWatcher {
|
|
35
36
|
options: WatchOptions
|
|
36
37
|
|
|
37
38
|
/**
|
|
38
39
|
* Constructs a new FSWatcher instance with optional WatchOptions parameter.
|
|
39
40
|
*/
|
|
40
|
-
(options?: WatchOptions)
|
|
41
|
+
constructor(options?: WatchOptions)
|
|
41
42
|
|
|
42
43
|
/**
|
|
43
44
|
* Add files, directories, or glob patterns for tracking. Takes an array of strings or just one
|
|
44
45
|
* string.
|
|
45
46
|
*/
|
|
46
|
-
add(paths: string | ReadonlyArray<string>):
|
|
47
|
+
add(paths: string | ReadonlyArray<string>): this
|
|
47
48
|
|
|
48
49
|
/**
|
|
49
50
|
* Stop watching files, directories, or glob patterns. Takes an array of strings or just one
|
|
50
51
|
* string.
|
|
51
52
|
*/
|
|
52
|
-
unwatch(paths: string | ReadonlyArray<string>):
|
|
53
|
+
unwatch(paths: string | ReadonlyArray<string>): this
|
|
53
54
|
|
|
54
55
|
/**
|
|
55
56
|
* Returns an object representing all the paths on the file system being watched by this
|
|
@@ -155,7 +156,7 @@ export interface WatchOptions {
|
|
|
155
156
|
|
|
156
157
|
/**
|
|
157
158
|
* Whether to use the `fsevents` watching interface if available. When set to `true` explicitly
|
|
158
|
-
* and `fsevents` is available this
|
|
159
|
+
* and `fsevents` is available this supercedes the `usePolling` setting. When set to `false` on
|
|
159
160
|
* OS X, `usePolling: true` becomes the default.
|
|
160
161
|
*/
|
|
161
162
|
useFsEvents?: boolean
|
|
@@ -202,17 +203,25 @@ export interface WatchOptions {
|
|
|
202
203
|
/**
|
|
203
204
|
* can be set to an object in order to adjust timing params:
|
|
204
205
|
*/
|
|
205
|
-
awaitWriteFinish?:
|
|
206
|
-
| {
|
|
207
|
-
/**
|
|
208
|
-
* Amount of time in milliseconds for a file size to remain constant before emitting its event.
|
|
209
|
-
*/
|
|
210
|
-
stabilityThreshold?: number
|
|
211
|
-
|
|
212
|
-
/**
|
|
213
|
-
* File size polling interval.
|
|
214
|
-
*/
|
|
215
|
-
pollInterval?: number
|
|
216
|
-
}
|
|
217
|
-
| boolean
|
|
206
|
+
awaitWriteFinish?: AwaitWriteFinishOptions | boolean
|
|
218
207
|
}
|
|
208
|
+
|
|
209
|
+
export interface AwaitWriteFinishOptions {
|
|
210
|
+
/**
|
|
211
|
+
* Amount of time in milliseconds for a file size to remain constant before emitting its event.
|
|
212
|
+
*/
|
|
213
|
+
stabilityThreshold?: number
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* File size polling interval.
|
|
217
|
+
*/
|
|
218
|
+
pollInterval?: number
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* produces an instance of `FSWatcher`.
|
|
223
|
+
*/
|
|
224
|
+
export function watch(
|
|
225
|
+
paths: string | ReadonlyArray<string>,
|
|
226
|
+
options?: WatchOptions
|
|
227
|
+
): FSWatcher
|