vite 3.0.2 → 3.0.5
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/bin/vite.js +1 -1
- package/dist/client/client.mjs +4 -2
- package/dist/client/client.mjs.map +1 -1
- package/dist/node/chunks/{dep-f07a4e2f.js → dep-0f192b10.js} +1 -1
- package/dist/node/chunks/{dep-1513d487.js → dep-5cb728cb.js} +457 -269
- package/dist/node/chunks/{dep-41eb528c.js → dep-94c1417a.js} +0 -0
- package/dist/node/chunks/{dep-3f457808.js → dep-b58adab6.js} +1 -1
- package/dist/node/cli.js +6 -6
- package/dist/node/constants.js +6 -4
- package/dist/node/index.d.ts +152 -53
- package/dist/node/index.js +2 -2
- package/dist/node-cjs/publicUtils.cjs +2 -2
- package/package.json +10 -10
- package/src/client/overlay.ts +1 -1
- package/src/client/tsconfig.json +1 -0
- package/types/commonjs.d.ts +61 -13
- package/types/connect.d.ts +1 -1
- package/types/http-proxy.d.ts +41 -33
- package/types/terser.d.ts +43 -0
- package/types/ws.d.ts +1 -1
package/types/commonjs.d.ts
CHANGED
|
@@ -7,17 +7,17 @@
|
|
|
7
7
|
*/
|
|
8
8
|
export interface RollupCommonJSOptions {
|
|
9
9
|
/**
|
|
10
|
-
* A
|
|
10
|
+
* A minimatch pattern, or array of patterns, which specifies the files in
|
|
11
11
|
* the build the plugin should operate on. By default, all files with
|
|
12
|
-
* extension `".cjs"` or those in `extensions` are included, but you can
|
|
13
|
-
* this list by only including specific files. These files will be
|
|
14
|
-
* and transpiled if either the analysis does not find ES module
|
|
15
|
-
* statements or `transformMixedEsModules` is `true`.
|
|
12
|
+
* extension `".cjs"` or those in `extensions` are included, but you can
|
|
13
|
+
* narrow this list by only including specific files. These files will be
|
|
14
|
+
* analyzed and transpiled if either the analysis does not find ES module
|
|
15
|
+
* specific statements or `transformMixedEsModules` is `true`.
|
|
16
16
|
* @default undefined
|
|
17
17
|
*/
|
|
18
18
|
include?: string | RegExp | readonly (string | RegExp)[]
|
|
19
19
|
/**
|
|
20
|
-
* A
|
|
20
|
+
* A minimatch pattern, or array of patterns, which specifies the files in
|
|
21
21
|
* the build the plugin should _ignore_. By default, all files with
|
|
22
22
|
* extensions other than those in `extensions` or `".cjs"` are ignored, but you
|
|
23
23
|
* can exclude additional files. See also the `include` option.
|
|
@@ -37,7 +37,8 @@ export interface RollupCommonJSOptions {
|
|
|
37
37
|
*/
|
|
38
38
|
ignoreGlobal?: boolean
|
|
39
39
|
/**
|
|
40
|
-
* If false, skips source map generation for CommonJS modules. This will
|
|
40
|
+
* If false, skips source map generation for CommonJS modules. This will
|
|
41
|
+
* improve performance.
|
|
41
42
|
* @default true
|
|
42
43
|
*/
|
|
43
44
|
sourceMap?: boolean
|
|
@@ -65,6 +66,39 @@ export interface RollupCommonJSOptions {
|
|
|
65
66
|
* @default false
|
|
66
67
|
*/
|
|
67
68
|
transformMixedEsModules?: boolean
|
|
69
|
+
/**
|
|
70
|
+
* By default, this plugin will try to hoist `require` statements as imports
|
|
71
|
+
* to the top of each file. While this works well for many code bases and
|
|
72
|
+
* allows for very efficient ESM output, it does not perfectly capture
|
|
73
|
+
* CommonJS semantics as the order of side effects like log statements may
|
|
74
|
+
* change. But it is especially problematic when there are circular `require`
|
|
75
|
+
* calls between CommonJS modules as those often rely on the lazy execution of
|
|
76
|
+
* nested `require` calls.
|
|
77
|
+
*
|
|
78
|
+
* Setting this option to `true` will wrap all CommonJS files in functions
|
|
79
|
+
* which are executed when they are required for the first time, preserving
|
|
80
|
+
* NodeJS semantics. Note that this can have an impact on the size and
|
|
81
|
+
* performance of the generated code.
|
|
82
|
+
*
|
|
83
|
+
* The default value of `"auto"` will only wrap CommonJS files when they are
|
|
84
|
+
* part of a CommonJS dependency cycle, e.g. an index file that is required by
|
|
85
|
+
* many of its dependencies. All other CommonJS files are hoisted. This is the
|
|
86
|
+
* recommended setting for most code bases.
|
|
87
|
+
*
|
|
88
|
+
* `false` will entirely prevent wrapping and hoist all files. This may still
|
|
89
|
+
* work depending on the nature of cyclic dependencies but will often cause
|
|
90
|
+
* problems.
|
|
91
|
+
*
|
|
92
|
+
* You can also provide a minimatch pattern, or array of patterns, to only
|
|
93
|
+
* specify a subset of files which should be wrapped in functions for proper
|
|
94
|
+
* `require` semantics.
|
|
95
|
+
*
|
|
96
|
+
* `"debug"` works like `"auto"` but after bundling, it will display a warning
|
|
97
|
+
* containing a list of ids that have been wrapped which can be used as
|
|
98
|
+
* minimatch pattern for fine-tuning.
|
|
99
|
+
* @default "auto"
|
|
100
|
+
*/
|
|
101
|
+
strictRequires?: boolean | string | RegExp | readonly (string | RegExp)[]
|
|
68
102
|
/**
|
|
69
103
|
* Sometimes you have to leave require statements unconverted. Pass an array
|
|
70
104
|
* containing the IDs or a `id => boolean` function.
|
|
@@ -75,14 +109,16 @@ export interface RollupCommonJSOptions {
|
|
|
75
109
|
* In most cases, where `require` calls are inside a `try-catch` clause,
|
|
76
110
|
* they should be left unconverted as it requires an optional dependency
|
|
77
111
|
* that may or may not be installed beside the rolled up package.
|
|
78
|
-
* Due to the conversion of `require` to a static `import` - the call is
|
|
79
|
-
* to the top of the file, outside of the `try-catch` clause.
|
|
112
|
+
* Due to the conversion of `require` to a static `import` - the call is
|
|
113
|
+
* hoisted to the top of the file, outside of the `try-catch` clause.
|
|
80
114
|
*
|
|
81
115
|
* - `true`: All `require` calls inside a `try` will be left unconverted.
|
|
82
|
-
* - `false`: All `require` calls inside a `try` will be converted as if the
|
|
116
|
+
* - `false`: All `require` calls inside a `try` will be converted as if the
|
|
117
|
+
* `try-catch` clause is not there.
|
|
83
118
|
* - `remove`: Remove all `require` calls from inside any `try` block.
|
|
84
119
|
* - `string[]`: Pass an array containing the IDs to left unconverted.
|
|
85
|
-
* - `((id: string) => boolean|'remove')`: Pass a function that control
|
|
120
|
+
* - `((id: string) => boolean|'remove')`: Pass a function that control
|
|
121
|
+
* individual IDs.
|
|
86
122
|
*
|
|
87
123
|
* @default false
|
|
88
124
|
*/
|
|
@@ -165,12 +201,17 @@ export interface RollupCommonJSOptions {
|
|
|
165
201
|
| 'preferred'
|
|
166
202
|
| 'namespace'
|
|
167
203
|
| ((id: string) => boolean | 'auto' | 'preferred' | 'namespace')
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* @default "auto"
|
|
207
|
+
*/
|
|
208
|
+
defaultIsModuleExports?: boolean | 'auto' | ((id: string) => boolean | 'auto')
|
|
168
209
|
/**
|
|
169
210
|
* Some modules contain dynamic `require` calls, or require modules that
|
|
170
211
|
* contain circular dependencies, which are not handled well by static
|
|
171
212
|
* imports. Including those modules as `dynamicRequireTargets` will simulate a
|
|
172
|
-
* CommonJS (NodeJS-like) environment for them with support for dynamic
|
|
173
|
-
*
|
|
213
|
+
* CommonJS (NodeJS-like) environment for them with support for dynamic
|
|
214
|
+
* dependencies. It also enables `strictRequires` for those modules.
|
|
174
215
|
*
|
|
175
216
|
* Note: In extreme cases, this feature may result in some paths being
|
|
176
217
|
* rendered as absolute in the final bundle. The plugin tries to avoid
|
|
@@ -179,4 +220,11 @@ export interface RollupCommonJSOptions {
|
|
|
179
220
|
* replacing strings like `"/Users/John/Desktop/foo-project/"` -\> `"/"`.
|
|
180
221
|
*/
|
|
181
222
|
dynamicRequireTargets?: string | ReadonlyArray<string>
|
|
223
|
+
/**
|
|
224
|
+
* To avoid long paths when using the `dynamicRequireTargets` option, you can use this option to specify a directory
|
|
225
|
+
* that is a common parent for all files that use dynamic require statements. Using a directory higher up such as `/`
|
|
226
|
+
* may lead to unnecessarily long paths in the generated code and may expose directory names on your machine like your
|
|
227
|
+
* home directory name. By default it uses the current working directory.
|
|
228
|
+
*/
|
|
229
|
+
dynamicRequireRoot?: string
|
|
182
230
|
}
|
package/types/connect.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export namespace Connect {
|
|
|
14
14
|
export type ServerHandle = HandleFunction | http.Server
|
|
15
15
|
|
|
16
16
|
export class IncomingMessage extends http.IncomingMessage {
|
|
17
|
-
originalUrl?: http.IncomingMessage['url']
|
|
17
|
+
originalUrl?: http.IncomingMessage['url'] | undefined
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
export type NextFunction = (err?: any) => void
|
package/types/http-proxy.d.ts
CHANGED
|
@@ -27,16 +27,16 @@ export namespace HttpProxy {
|
|
|
27
27
|
export interface ProxyTargetDetailed {
|
|
28
28
|
host: string
|
|
29
29
|
port: number
|
|
30
|
-
protocol?: string
|
|
31
|
-
hostname?: string
|
|
32
|
-
socketPath?: string
|
|
33
|
-
key?: string
|
|
34
|
-
passphrase?: string
|
|
35
|
-
pfx?: Buffer | string
|
|
36
|
-
cert?: string
|
|
37
|
-
ca?: string
|
|
38
|
-
ciphers?: string
|
|
39
|
-
secureProtocol?: string
|
|
30
|
+
protocol?: string | undefined
|
|
31
|
+
hostname?: string | undefined
|
|
32
|
+
socketPath?: string | undefined
|
|
33
|
+
key?: string | undefined
|
|
34
|
+
passphrase?: string | undefined
|
|
35
|
+
pfx?: Buffer | string | undefined
|
|
36
|
+
cert?: string | undefined
|
|
37
|
+
ca?: string | undefined
|
|
38
|
+
ciphers?: string | undefined
|
|
39
|
+
secureProtocol?: string | undefined
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
export type ErrorCallback = (
|
|
@@ -189,54 +189,62 @@ export namespace HttpProxy {
|
|
|
189
189
|
|
|
190
190
|
export interface ServerOptions {
|
|
191
191
|
/** URL string to be parsed with the url module. */
|
|
192
|
-
target?: ProxyTarget
|
|
192
|
+
target?: ProxyTarget | undefined
|
|
193
193
|
/** URL string to be parsed with the url module. */
|
|
194
|
-
forward?: ProxyTargetUrl
|
|
194
|
+
forward?: ProxyTargetUrl | undefined
|
|
195
195
|
/** Object to be passed to http(s).request. */
|
|
196
196
|
agent?: any
|
|
197
197
|
/** Object to be passed to https.createServer(). */
|
|
198
198
|
ssl?: any
|
|
199
199
|
/** If you want to proxy websockets. */
|
|
200
|
-
ws?: boolean
|
|
200
|
+
ws?: boolean | undefined
|
|
201
201
|
/** Adds x- forward headers. */
|
|
202
|
-
xfwd?: boolean
|
|
202
|
+
xfwd?: boolean | undefined
|
|
203
203
|
/** Verify SSL certificate. */
|
|
204
|
-
secure?: boolean
|
|
204
|
+
secure?: boolean | undefined
|
|
205
205
|
/** Explicitly specify if we are proxying to another proxy. */
|
|
206
|
-
toProxy?: boolean
|
|
206
|
+
toProxy?: boolean | undefined
|
|
207
207
|
/** Specify whether you want to prepend the target's path to the proxy path. */
|
|
208
|
-
prependPath?: boolean
|
|
208
|
+
prependPath?: boolean | undefined
|
|
209
209
|
/** Specify whether you want to ignore the proxy path of the incoming request. */
|
|
210
|
-
ignorePath?: boolean
|
|
210
|
+
ignorePath?: boolean | undefined
|
|
211
211
|
/** Local interface string to bind for outgoing connections. */
|
|
212
|
-
localAddress?: string
|
|
212
|
+
localAddress?: string | undefined
|
|
213
213
|
/** Changes the origin of the host header to the target URL. */
|
|
214
|
-
changeOrigin?: boolean
|
|
214
|
+
changeOrigin?: boolean | undefined
|
|
215
215
|
/** specify whether you want to keep letter case of response header key */
|
|
216
|
-
preserveHeaderKeyCase?: boolean
|
|
216
|
+
preserveHeaderKeyCase?: boolean | undefined
|
|
217
217
|
/** Basic authentication i.e. 'user:password' to compute an Authorization header. */
|
|
218
|
-
auth?: string
|
|
218
|
+
auth?: string | undefined
|
|
219
219
|
/** Rewrites the location hostname on (301 / 302 / 307 / 308) redirects, Default: null. */
|
|
220
|
-
hostRewrite?: string
|
|
220
|
+
hostRewrite?: string | undefined
|
|
221
221
|
/** Rewrites the location host/ port on (301 / 302 / 307 / 308) redirects based on requested host/ port.Default: false. */
|
|
222
|
-
autoRewrite?: boolean
|
|
222
|
+
autoRewrite?: boolean | undefined
|
|
223
223
|
/** Rewrites the location protocol on (301 / 302 / 307 / 308) redirects to 'http' or 'https'.Default: null. */
|
|
224
|
-
protocolRewrite?: string
|
|
224
|
+
protocolRewrite?: string | undefined
|
|
225
225
|
/** rewrites domain of set-cookie headers. */
|
|
226
|
-
cookieDomainRewrite?:
|
|
226
|
+
cookieDomainRewrite?:
|
|
227
|
+
| false
|
|
228
|
+
| string
|
|
229
|
+
| { [oldDomain: string]: string }
|
|
230
|
+
| undefined
|
|
227
231
|
/** rewrites path of set-cookie headers. Default: false */
|
|
228
|
-
cookiePathRewrite?:
|
|
232
|
+
cookiePathRewrite?:
|
|
233
|
+
| false
|
|
234
|
+
| string
|
|
235
|
+
| { [oldPath: string]: string }
|
|
236
|
+
| undefined
|
|
229
237
|
/** object with extra headers to be added to target requests. */
|
|
230
|
-
headers?: { [header: string]: string }
|
|
238
|
+
headers?: { [header: string]: string } | undefined
|
|
231
239
|
/** Timeout (in milliseconds) when proxy receives no response from target. Default: 120000 (2 minutes) */
|
|
232
|
-
proxyTimeout?: number
|
|
240
|
+
proxyTimeout?: number | undefined
|
|
233
241
|
/** Timeout (in milliseconds) for incoming requests */
|
|
234
|
-
timeout?: number
|
|
242
|
+
timeout?: number | undefined
|
|
235
243
|
/** Specify whether you want to follow redirects. Default: false */
|
|
236
|
-
followRedirects?: boolean
|
|
244
|
+
followRedirects?: boolean | undefined
|
|
237
245
|
/** If set to true, none of the webOutgoing passes are called and it's your responsibility to appropriately return the response by listening and acting on the proxyRes event */
|
|
238
|
-
selfHandleResponse?: boolean
|
|
246
|
+
selfHandleResponse?: boolean | undefined
|
|
239
247
|
/** Buffer */
|
|
240
|
-
buffer?: stream.Stream
|
|
248
|
+
buffer?: stream.Stream | undefined
|
|
241
249
|
}
|
|
242
250
|
}
|
package/types/terser.d.ts
CHANGED
|
@@ -39,6 +39,7 @@ export namespace Terser {
|
|
|
39
39
|
|
|
40
40
|
export interface ParseOptions {
|
|
41
41
|
bare_returns?: boolean
|
|
42
|
+
/** @deprecated legacy option. Currently, all supported EcmaScript is valid to parse. */
|
|
42
43
|
ecma?: ECMA
|
|
43
44
|
html5_comments?: boolean
|
|
44
45
|
shebang?: boolean
|
|
@@ -113,22 +114,59 @@ export namespace Terser {
|
|
|
113
114
|
keep_classnames?: boolean | RegExp
|
|
114
115
|
keep_fnames?: boolean | RegExp
|
|
115
116
|
module?: boolean
|
|
117
|
+
nth_identifier?: SimpleIdentifierMangler | WeightedIdentifierMangler
|
|
116
118
|
properties?: boolean | ManglePropertiesOptions
|
|
117
119
|
reserved?: string[]
|
|
118
120
|
safari10?: boolean
|
|
119
121
|
toplevel?: boolean
|
|
120
122
|
}
|
|
121
123
|
|
|
124
|
+
/**
|
|
125
|
+
* An identifier mangler for which the output is invariant with respect to the source code.
|
|
126
|
+
*/
|
|
127
|
+
export interface SimpleIdentifierMangler {
|
|
128
|
+
/**
|
|
129
|
+
* Obtains the nth most favored (usually shortest) identifier to rename a variable to.
|
|
130
|
+
* The mangler will increment n and retry until the return value is not in use in scope, and is not a reserved word.
|
|
131
|
+
* This function is expected to be stable; Evaluating get(n) === get(n) should always return true.
|
|
132
|
+
* @param n - The ordinal of the identifier.
|
|
133
|
+
*/
|
|
134
|
+
get(n: number): string
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* An identifier mangler that leverages character frequency analysis to determine identifier precedence.
|
|
139
|
+
*/
|
|
140
|
+
export interface WeightedIdentifierMangler extends SimpleIdentifierMangler {
|
|
141
|
+
/**
|
|
142
|
+
* Modifies the internal weighting of the input characters by the specified delta.
|
|
143
|
+
* Will be invoked on the entire printed AST, and then deduct mangleable identifiers.
|
|
144
|
+
* @param chars - The characters to modify the weighting of.
|
|
145
|
+
* @param delta - The numeric weight to add to the characters.
|
|
146
|
+
*/
|
|
147
|
+
consider(chars: string, delta: number): number
|
|
148
|
+
/**
|
|
149
|
+
* Resets character weights.
|
|
150
|
+
*/
|
|
151
|
+
reset(): void
|
|
152
|
+
/**
|
|
153
|
+
* Sorts identifiers by character frequency, in preparation for calls to get(n).
|
|
154
|
+
*/
|
|
155
|
+
sort(): void
|
|
156
|
+
}
|
|
157
|
+
|
|
122
158
|
export interface ManglePropertiesOptions {
|
|
123
159
|
builtins?: boolean
|
|
124
160
|
debug?: boolean
|
|
125
161
|
keep_quoted?: boolean | 'strict'
|
|
162
|
+
nth_identifier?: SimpleIdentifierMangler | WeightedIdentifierMangler
|
|
126
163
|
regex?: RegExp | string
|
|
127
164
|
reserved?: string[]
|
|
128
165
|
}
|
|
129
166
|
|
|
130
167
|
export interface FormatOptions {
|
|
131
168
|
ascii_only?: boolean
|
|
169
|
+
/** @deprecated Not implemented anymore */
|
|
132
170
|
beautify?: boolean
|
|
133
171
|
braces?: boolean
|
|
134
172
|
comments?:
|
|
@@ -148,6 +186,7 @@ export namespace Terser {
|
|
|
148
186
|
) => boolean)
|
|
149
187
|
ecma?: ECMA
|
|
150
188
|
ie8?: boolean
|
|
189
|
+
keep_numbers?: boolean
|
|
151
190
|
indent_level?: number
|
|
152
191
|
indent_start?: number
|
|
153
192
|
inline_script?: boolean
|
|
@@ -178,6 +217,7 @@ export namespace Terser {
|
|
|
178
217
|
export interface MinifyOptions {
|
|
179
218
|
compress?: boolean | CompressOptions
|
|
180
219
|
ecma?: ECMA
|
|
220
|
+
enclose?: boolean | string
|
|
181
221
|
ie8?: boolean
|
|
182
222
|
keep_classnames?: boolean | RegExp
|
|
183
223
|
keep_fnames?: boolean | RegExp
|
|
@@ -185,6 +225,8 @@ export namespace Terser {
|
|
|
185
225
|
module?: boolean
|
|
186
226
|
nameCache?: object
|
|
187
227
|
format?: FormatOptions
|
|
228
|
+
/** @deprecated deprecated */
|
|
229
|
+
output?: FormatOptions
|
|
188
230
|
parse?: ParseOptions
|
|
189
231
|
safari10?: boolean
|
|
190
232
|
sourceMap?: boolean | SourceMapOptions
|
|
@@ -194,6 +236,7 @@ export namespace Terser {
|
|
|
194
236
|
export interface MinifyOutput {
|
|
195
237
|
code?: string
|
|
196
238
|
map?: object | string
|
|
239
|
+
decoded_map?: object | null
|
|
197
240
|
}
|
|
198
241
|
|
|
199
242
|
export interface SourceMapOptions {
|
package/types/ws.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ import type {
|
|
|
26
26
|
} from 'node:http'
|
|
27
27
|
import type { Server as HTTPSServer } from 'node:https'
|
|
28
28
|
import type { Duplex, DuplexOptions } from 'node:stream'
|
|
29
|
-
import type { SecureContextOptions } from 'tls'
|
|
29
|
+
import type { SecureContextOptions } from 'node:tls'
|
|
30
30
|
import type { URL } from 'node:url'
|
|
31
31
|
import type { ZlibOptions } from 'node:zlib'
|
|
32
32
|
|