vite 3.0.4 → 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.
@@ -1,4 +1,4 @@
1
- import { A as getAugmentedNamespace, B as getDefaultExportFromCjs } from './dep-71eb12cb.js';
1
+ import { A as getAugmentedNamespace, B as getDefaultExportFromCjs } from './dep-5cb728cb.js';
2
2
 
3
3
  import { fileURLToPath as __cjs_fileURLToPath } from 'node:url';
4
4
  import { dirname as __cjs_dirname } from 'node:path';
package/dist/node/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { performance } from 'node:perf_hooks';
2
2
  import { EventEmitter } from 'events';
3
- import { y as picocolors, u as createLogger, e as resolveConfig } from './chunks/dep-71eb12cb.js';
3
+ import { y as picocolors, u as createLogger, e as resolveConfig } from './chunks/dep-5cb728cb.js';
4
4
  import { VERSION } from './constants.js';
5
5
  import 'node:fs';
6
6
  import 'node:path';
@@ -33,7 +33,7 @@ import 'node:http';
33
33
  import 'node:https';
34
34
  import 'worker_threads';
35
35
  import 'querystring';
36
- import 'readline';
36
+ import 'node:readline';
37
37
  import 'node:child_process';
38
38
  import 'node:zlib';
39
39
 
@@ -694,7 +694,7 @@ cli
694
694
  .action(async (root, options) => {
695
695
  // output structure is preserved even after bundling so require()
696
696
  // is ok here
697
- const { createServer } = await import('./chunks/dep-71eb12cb.js').then(function (n) { return n.E; });
697
+ const { createServer } = await import('./chunks/dep-5cb728cb.js').then(function (n) { return n.E; });
698
698
  try {
699
699
  const server = await createServer({
700
700
  root,
@@ -741,7 +741,7 @@ cli
741
741
  .option('--emptyOutDir', `[boolean] force empty outDir when it's outside of root`)
742
742
  .option('-w, --watch', `[boolean] rebuilds when modules have changed on disk`)
743
743
  .action(async (root, options) => {
744
- const { build } = await import('./chunks/dep-71eb12cb.js').then(function (n) { return n.D; });
744
+ const { build } = await import('./chunks/dep-5cb728cb.js').then(function (n) { return n.D; });
745
745
  const buildOptions = cleanOptions(options);
746
746
  try {
747
747
  await build({
@@ -765,7 +765,7 @@ cli
765
765
  .command('optimize [root]', 'pre-bundle dependencies')
766
766
  .option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
767
767
  .action(async (root, options) => {
768
- const { optimizeDeps } = await import('./chunks/dep-71eb12cb.js').then(function (n) { return n.C; });
768
+ const { optimizeDeps } = await import('./chunks/dep-5cb728cb.js').then(function (n) { return n.C; });
769
769
  try {
770
770
  const config = await resolveConfig({
771
771
  root,
@@ -788,7 +788,7 @@ cli
788
788
  .option('--https', `[boolean] use TLS + HTTP/2`)
789
789
  .option('--open [path]', `[boolean | string] open browser on startup`)
790
790
  .action(async (root, options) => {
791
- const { preview } = await import('./chunks/dep-71eb12cb.js').then(function (n) { return n.F; });
791
+ const { preview } = await import('./chunks/dep-5cb728cb.js').then(function (n) { return n.F; });
792
792
  try {
793
793
  const server = await preview({
794
794
  root,
@@ -1,7 +1,7 @@
1
1
  import path, { resolve } from 'node:path';
2
2
  import { fileURLToPath } from 'node:url';
3
3
 
4
- var version = "3.0.4";
4
+ var version = "3.0.5";
5
5
 
6
6
  const VERSION = version;
7
7
  const DEFAULT_MAIN_FIELDS = [
@@ -35,7 +35,7 @@ import type { RollupOptions } from 'rollup';
35
35
  import type { RollupOutput } from 'rollup';
36
36
  import { VERSION as rollupVersion } from 'rollup';
37
37
  import type { RollupWatcher } from 'rollup';
38
- import type { SecureContextOptions } from 'tls';
38
+ import type { SecureContextOptions } from 'node:tls';
39
39
  import type { Server } from 'node:http';
40
40
  import type { Server as Server_2 } from 'node:https';
41
41
  import type { ServerOptions as ServerOptions_2 } from 'node:https';
@@ -336,7 +336,7 @@ export declare namespace Connect {
336
336
  export type ServerHandle = HandleFunction | http.Server
337
337
 
338
338
  export class IncomingMessage extends http.IncomingMessage {
339
- originalUrl?: http.IncomingMessage['url']
339
+ originalUrl?: http.IncomingMessage['url'] | undefined
340
340
  }
341
341
 
342
342
  export type NextFunction = (err?: any) => void
@@ -864,16 +864,16 @@ export declare namespace HttpProxy {
864
864
  export interface ProxyTargetDetailed {
865
865
  host: string
866
866
  port: number
867
- protocol?: string
868
- hostname?: string
869
- socketPath?: string
870
- key?: string
871
- passphrase?: string
872
- pfx?: Buffer | string
873
- cert?: string
874
- ca?: string
875
- ciphers?: string
876
- secureProtocol?: string
867
+ protocol?: string | undefined
868
+ hostname?: string | undefined
869
+ socketPath?: string | undefined
870
+ key?: string | undefined
871
+ passphrase?: string | undefined
872
+ pfx?: Buffer | string | undefined
873
+ cert?: string | undefined
874
+ ca?: string | undefined
875
+ ciphers?: string | undefined
876
+ secureProtocol?: string | undefined
877
877
  }
878
878
 
879
879
  export type ErrorCallback = (
@@ -1026,55 +1026,63 @@ export declare namespace HttpProxy {
1026
1026
 
1027
1027
  export interface ServerOptions {
1028
1028
  /** URL string to be parsed with the url module. */
1029
- target?: ProxyTarget
1029
+ target?: ProxyTarget | undefined
1030
1030
  /** URL string to be parsed with the url module. */
1031
- forward?: ProxyTargetUrl
1031
+ forward?: ProxyTargetUrl | undefined
1032
1032
  /** Object to be passed to http(s).request. */
1033
1033
  agent?: any
1034
1034
  /** Object to be passed to https.createServer(). */
1035
1035
  ssl?: any
1036
1036
  /** If you want to proxy websockets. */
1037
- ws?: boolean
1037
+ ws?: boolean | undefined
1038
1038
  /** Adds x- forward headers. */
1039
- xfwd?: boolean
1039
+ xfwd?: boolean | undefined
1040
1040
  /** Verify SSL certificate. */
1041
- secure?: boolean
1041
+ secure?: boolean | undefined
1042
1042
  /** Explicitly specify if we are proxying to another proxy. */
1043
- toProxy?: boolean
1043
+ toProxy?: boolean | undefined
1044
1044
  /** Specify whether you want to prepend the target's path to the proxy path. */
1045
- prependPath?: boolean
1045
+ prependPath?: boolean | undefined
1046
1046
  /** Specify whether you want to ignore the proxy path of the incoming request. */
1047
- ignorePath?: boolean
1047
+ ignorePath?: boolean | undefined
1048
1048
  /** Local interface string to bind for outgoing connections. */
1049
- localAddress?: string
1049
+ localAddress?: string | undefined
1050
1050
  /** Changes the origin of the host header to the target URL. */
1051
- changeOrigin?: boolean
1051
+ changeOrigin?: boolean | undefined
1052
1052
  /** specify whether you want to keep letter case of response header key */
1053
- preserveHeaderKeyCase?: boolean
1053
+ preserveHeaderKeyCase?: boolean | undefined
1054
1054
  /** Basic authentication i.e. 'user:password' to compute an Authorization header. */
1055
- auth?: string
1055
+ auth?: string | undefined
1056
1056
  /** Rewrites the location hostname on (301 / 302 / 307 / 308) redirects, Default: null. */
1057
- hostRewrite?: string
1057
+ hostRewrite?: string | undefined
1058
1058
  /** Rewrites the location host/ port on (301 / 302 / 307 / 308) redirects based on requested host/ port.Default: false. */
1059
- autoRewrite?: boolean
1059
+ autoRewrite?: boolean | undefined
1060
1060
  /** Rewrites the location protocol on (301 / 302 / 307 / 308) redirects to 'http' or 'https'.Default: null. */
1061
- protocolRewrite?: string
1061
+ protocolRewrite?: string | undefined
1062
1062
  /** rewrites domain of set-cookie headers. */
1063
- cookieDomainRewrite?: false | string | { [oldDomain: string]: string }
1063
+ cookieDomainRewrite?:
1064
+ | false
1065
+ | string
1066
+ | { [oldDomain: string]: string }
1067
+ | undefined
1064
1068
  /** rewrites path of set-cookie headers. Default: false */
1065
- cookiePathRewrite?: false | string | { [oldPath: string]: string }
1069
+ cookiePathRewrite?:
1070
+ | false
1071
+ | string
1072
+ | { [oldPath: string]: string }
1073
+ | undefined
1066
1074
  /** object with extra headers to be added to target requests. */
1067
- headers?: { [header: string]: string }
1075
+ headers?: { [header: string]: string } | undefined
1068
1076
  /** Timeout (in milliseconds) when proxy receives no response from target. Default: 120000 (2 minutes) */
1069
- proxyTimeout?: number
1077
+ proxyTimeout?: number | undefined
1070
1078
  /** Timeout (in milliseconds) for incoming requests */
1071
- timeout?: number
1079
+ timeout?: number | undefined
1072
1080
  /** Specify whether you want to follow redirects. Default: false */
1073
- followRedirects?: boolean
1081
+ followRedirects?: boolean | undefined
1074
1082
  /** 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 */
1075
- selfHandleResponse?: boolean
1083
+ selfHandleResponse?: boolean | undefined
1076
1084
  /** Buffer */
1077
- buffer?: stream.Stream
1085
+ buffer?: stream.Stream | undefined
1078
1086
  }
1079
1087
  }
1080
1088
 
@@ -1600,7 +1608,7 @@ export declare interface PreviewServer {
1600
1608
  */
1601
1609
  httpServer: http.Server;
1602
1610
  /**
1603
- * The resolved urls Vite prints on the
1611
+ * The resolved urls Vite prints on the CLI
1604
1612
  *
1605
1613
  * @experimental
1606
1614
  */
@@ -1751,17 +1759,17 @@ export declare interface ResolveWorkerOptions {
1751
1759
  */
1752
1760
  export declare interface RollupCommonJSOptions {
1753
1761
  /**
1754
- * A picomatch pattern, or array of patterns, which specifies the files in
1762
+ * A minimatch pattern, or array of patterns, which specifies the files in
1755
1763
  * the build the plugin should operate on. By default, all files with
1756
- * extension `".cjs"` or those in `extensions` are included, but you can narrow
1757
- * this list by only including specific files. These files will be analyzed
1758
- * and transpiled if either the analysis does not find ES module specific
1759
- * statements or `transformMixedEsModules` is `true`.
1764
+ * extension `".cjs"` or those in `extensions` are included, but you can
1765
+ * narrow this list by only including specific files. These files will be
1766
+ * analyzed and transpiled if either the analysis does not find ES module
1767
+ * specific statements or `transformMixedEsModules` is `true`.
1760
1768
  * @default undefined
1761
1769
  */
1762
1770
  include?: string | RegExp | readonly (string | RegExp)[]
1763
1771
  /**
1764
- * A picomatch pattern, or array of patterns, which specifies the files in
1772
+ * A minimatch pattern, or array of patterns, which specifies the files in
1765
1773
  * the build the plugin should _ignore_. By default, all files with
1766
1774
  * extensions other than those in `extensions` or `".cjs"` are ignored, but you
1767
1775
  * can exclude additional files. See also the `include` option.
@@ -1781,7 +1789,8 @@ export declare interface RollupCommonJSOptions {
1781
1789
  */
1782
1790
  ignoreGlobal?: boolean
1783
1791
  /**
1784
- * If false, skips source map generation for CommonJS modules. This will improve performance.
1792
+ * If false, skips source map generation for CommonJS modules. This will
1793
+ * improve performance.
1785
1794
  * @default true
1786
1795
  */
1787
1796
  sourceMap?: boolean
@@ -1809,6 +1818,39 @@ export declare interface RollupCommonJSOptions {
1809
1818
  * @default false
1810
1819
  */
1811
1820
  transformMixedEsModules?: boolean
1821
+ /**
1822
+ * By default, this plugin will try to hoist `require` statements as imports
1823
+ * to the top of each file. While this works well for many code bases and
1824
+ * allows for very efficient ESM output, it does not perfectly capture
1825
+ * CommonJS semantics as the order of side effects like log statements may
1826
+ * change. But it is especially problematic when there are circular `require`
1827
+ * calls between CommonJS modules as those often rely on the lazy execution of
1828
+ * nested `require` calls.
1829
+ *
1830
+ * Setting this option to `true` will wrap all CommonJS files in functions
1831
+ * which are executed when they are required for the first time, preserving
1832
+ * NodeJS semantics. Note that this can have an impact on the size and
1833
+ * performance of the generated code.
1834
+ *
1835
+ * The default value of `"auto"` will only wrap CommonJS files when they are
1836
+ * part of a CommonJS dependency cycle, e.g. an index file that is required by
1837
+ * many of its dependencies. All other CommonJS files are hoisted. This is the
1838
+ * recommended setting for most code bases.
1839
+ *
1840
+ * `false` will entirely prevent wrapping and hoist all files. This may still
1841
+ * work depending on the nature of cyclic dependencies but will often cause
1842
+ * problems.
1843
+ *
1844
+ * You can also provide a minimatch pattern, or array of patterns, to only
1845
+ * specify a subset of files which should be wrapped in functions for proper
1846
+ * `require` semantics.
1847
+ *
1848
+ * `"debug"` works like `"auto"` but after bundling, it will display a warning
1849
+ * containing a list of ids that have been wrapped which can be used as
1850
+ * minimatch pattern for fine-tuning.
1851
+ * @default "auto"
1852
+ */
1853
+ strictRequires?: boolean | string | RegExp | readonly (string | RegExp)[]
1812
1854
  /**
1813
1855
  * Sometimes you have to leave require statements unconverted. Pass an array
1814
1856
  * containing the IDs or a `id => boolean` function.
@@ -1819,14 +1861,16 @@ export declare interface RollupCommonJSOptions {
1819
1861
  * In most cases, where `require` calls are inside a `try-catch` clause,
1820
1862
  * they should be left unconverted as it requires an optional dependency
1821
1863
  * that may or may not be installed beside the rolled up package.
1822
- * Due to the conversion of `require` to a static `import` - the call is hoisted
1823
- * to the top of the file, outside of the `try-catch` clause.
1864
+ * Due to the conversion of `require` to a static `import` - the call is
1865
+ * hoisted to the top of the file, outside of the `try-catch` clause.
1824
1866
  *
1825
1867
  * - `true`: All `require` calls inside a `try` will be left unconverted.
1826
- * - `false`: All `require` calls inside a `try` will be converted as if the `try-catch` clause is not there.
1868
+ * - `false`: All `require` calls inside a `try` will be converted as if the
1869
+ * `try-catch` clause is not there.
1827
1870
  * - `remove`: Remove all `require` calls from inside any `try` block.
1828
1871
  * - `string[]`: Pass an array containing the IDs to left unconverted.
1829
- * - `((id: string) => boolean|'remove')`: Pass a function that control individual IDs.
1872
+ * - `((id: string) => boolean|'remove')`: Pass a function that control
1873
+ * individual IDs.
1830
1874
  *
1831
1875
  * @default false
1832
1876
  */
@@ -1909,12 +1953,17 @@ export declare interface RollupCommonJSOptions {
1909
1953
  | 'preferred'
1910
1954
  | 'namespace'
1911
1955
  | ((id: string) => boolean | 'auto' | 'preferred' | 'namespace')
1956
+
1957
+ /**
1958
+ * @default "auto"
1959
+ */
1960
+ defaultIsModuleExports?: boolean | 'auto' | ((id: string) => boolean | 'auto')
1912
1961
  /**
1913
1962
  * Some modules contain dynamic `require` calls, or require modules that
1914
1963
  * contain circular dependencies, which are not handled well by static
1915
1964
  * imports. Including those modules as `dynamicRequireTargets` will simulate a
1916
- * CommonJS (NodeJS-like) environment for them with support for dynamic and
1917
- * circular dependencies.
1965
+ * CommonJS (NodeJS-like) environment for them with support for dynamic
1966
+ * dependencies. It also enables `strictRequires` for those modules.
1918
1967
  *
1919
1968
  * Note: In extreme cases, this feature may result in some paths being
1920
1969
  * rendered as absolute in the final bundle. The plugin tries to avoid
@@ -1923,6 +1972,13 @@ export declare interface RollupCommonJSOptions {
1923
1972
  * replacing strings like `"/Users/John/Desktop/foo-project/"` -\> `"/"`.
1924
1973
  */
1925
1974
  dynamicRequireTargets?: string | ReadonlyArray<string>
1975
+ /**
1976
+ * To avoid long paths when using the `dynamicRequireTargets` option, you can use this option to specify a directory
1977
+ * that is a common parent for all files that use dynamic require statements. Using a directory higher up such as `/`
1978
+ * may lead to unnecessarily long paths in the generated code and may expose directory names on your machine like your
1979
+ * home directory name. By default it uses the current working directory.
1980
+ */
1981
+ dynamicRequireRoot?: string
1926
1982
  }
1927
1983
 
1928
1984
  export declare interface RollupDynamicImportVarsOptions {
@@ -2057,6 +2113,7 @@ export declare namespace Terser {
2057
2113
 
2058
2114
  export interface ParseOptions {
2059
2115
  bare_returns?: boolean
2116
+ /** @deprecated legacy option. Currently, all supported EcmaScript is valid to parse. */
2060
2117
  ecma?: ECMA
2061
2118
  html5_comments?: boolean
2062
2119
  shebang?: boolean
@@ -2131,22 +2188,59 @@ export declare namespace Terser {
2131
2188
  keep_classnames?: boolean | RegExp
2132
2189
  keep_fnames?: boolean | RegExp
2133
2190
  module?: boolean
2191
+ nth_identifier?: SimpleIdentifierMangler | WeightedIdentifierMangler
2134
2192
  properties?: boolean | ManglePropertiesOptions
2135
2193
  reserved?: string[]
2136
2194
  safari10?: boolean
2137
2195
  toplevel?: boolean
2138
2196
  }
2139
2197
 
2198
+ /**
2199
+ * An identifier mangler for which the output is invariant with respect to the source code.
2200
+ */
2201
+ export interface SimpleIdentifierMangler {
2202
+ /**
2203
+ * Obtains the nth most favored (usually shortest) identifier to rename a variable to.
2204
+ * The mangler will increment n and retry until the return value is not in use in scope, and is not a reserved word.
2205
+ * This function is expected to be stable; Evaluating get(n) === get(n) should always return true.
2206
+ * @param n - The ordinal of the identifier.
2207
+ */
2208
+ get(n: number): string
2209
+ }
2210
+
2211
+ /**
2212
+ * An identifier mangler that leverages character frequency analysis to determine identifier precedence.
2213
+ */
2214
+ export interface WeightedIdentifierMangler extends SimpleIdentifierMangler {
2215
+ /**
2216
+ * Modifies the internal weighting of the input characters by the specified delta.
2217
+ * Will be invoked on the entire printed AST, and then deduct mangleable identifiers.
2218
+ * @param chars - The characters to modify the weighting of.
2219
+ * @param delta - The numeric weight to add to the characters.
2220
+ */
2221
+ consider(chars: string, delta: number): number
2222
+ /**
2223
+ * Resets character weights.
2224
+ */
2225
+ reset(): void
2226
+ /**
2227
+ * Sorts identifiers by character frequency, in preparation for calls to get(n).
2228
+ */
2229
+ sort(): void
2230
+ }
2231
+
2140
2232
  export interface ManglePropertiesOptions {
2141
2233
  builtins?: boolean
2142
2234
  debug?: boolean
2143
2235
  keep_quoted?: boolean | 'strict'
2236
+ nth_identifier?: SimpleIdentifierMangler | WeightedIdentifierMangler
2144
2237
  regex?: RegExp | string
2145
2238
  reserved?: string[]
2146
2239
  }
2147
2240
 
2148
2241
  export interface FormatOptions {
2149
2242
  ascii_only?: boolean
2243
+ /** @deprecated Not implemented anymore */
2150
2244
  beautify?: boolean
2151
2245
  braces?: boolean
2152
2246
  comments?:
@@ -2166,6 +2260,7 @@ export declare namespace Terser {
2166
2260
  ) => boolean)
2167
2261
  ecma?: ECMA
2168
2262
  ie8?: boolean
2263
+ keep_numbers?: boolean
2169
2264
  indent_level?: number
2170
2265
  indent_start?: number
2171
2266
  inline_script?: boolean
@@ -2196,6 +2291,7 @@ export declare namespace Terser {
2196
2291
  export interface MinifyOptions {
2197
2292
  compress?: boolean | CompressOptions
2198
2293
  ecma?: ECMA
2294
+ enclose?: boolean | string
2199
2295
  ie8?: boolean
2200
2296
  keep_classnames?: boolean | RegExp
2201
2297
  keep_fnames?: boolean | RegExp
@@ -2203,6 +2299,8 @@ export declare namespace Terser {
2203
2299
  module?: boolean
2204
2300
  nameCache?: object
2205
2301
  format?: FormatOptions
2302
+ /** @deprecated deprecated */
2303
+ output?: FormatOptions
2206
2304
  parse?: ParseOptions
2207
2305
  safari10?: boolean
2208
2306
  sourceMap?: boolean | SourceMapOptions
@@ -2212,6 +2310,7 @@ export declare namespace Terser {
2212
2310
  export interface MinifyOutput {
2213
2311
  code?: string
2214
2312
  map?: object | string
2313
+ decoded_map?: object | null
2215
2314
  }
2216
2315
 
2217
2316
  export interface SourceMapOptions {
@@ -1,4 +1,4 @@
1
- export { b as build, k as createFilter, u as createLogger, c as createServer, d as defineConfig, f as formatPostcssSourceMap, h as getDepOptimizationConfig, i as isDepsOptimizerEnabled, l as loadConfigFromFile, w as loadEnv, j as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, p as preview, g as resolveBaseUrl, e as resolveConfig, x as resolveEnvPrefix, a as resolvePackageData, r as resolvePackageEntry, v as searchForWorkspaceRoot, q as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-71eb12cb.js';
1
+ export { b as build, k as createFilter, u as createLogger, c as createServer, d as defineConfig, f as formatPostcssSourceMap, h as getDepOptimizationConfig, i as isDepsOptimizerEnabled, l as loadConfigFromFile, w as loadEnv, j as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, p as preview, g as resolveBaseUrl, e as resolveConfig, x as resolveEnvPrefix, a as resolvePackageData, r as resolvePackageEntry, v as searchForWorkspaceRoot, q as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-5cb728cb.js';
2
2
  export { VERSION as version } from './constants.js';
3
3
  export { version as esbuildVersion } from 'esbuild';
4
4
  export { VERSION as rollupVersion } from 'rollup';
@@ -34,7 +34,7 @@ import 'node:http';
34
34
  import 'node:https';
35
35
  import 'worker_threads';
36
36
  import 'querystring';
37
- import 'readline';
37
+ import 'node:readline';
38
38
  import 'node:child_process';
39
39
  import 'node:zlib';
40
40
 
@@ -15,7 +15,7 @@ var require$$1 = require('util');
15
15
  var require$$0$1 = require('path');
16
16
  var require$$0$2 = require('crypto');
17
17
  var require$$1$1 = require('fs');
18
- var readline = require('readline');
18
+ var readline = require('node:readline');
19
19
  var require$$2 = require('os');
20
20
 
21
21
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e["default"] : e; }
@@ -31,7 +31,7 @@ var require$$1__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$1$1);
31
31
  var readline__default = /*#__PURE__*/_interopDefaultLegacy(readline);
32
32
  var require$$2__default = /*#__PURE__*/_interopDefaultLegacy(require$$2);
33
33
 
34
- var version = "3.0.4";
34
+ var version = "3.0.5";
35
35
 
36
36
  const VERSION = version;
37
37
  const VITE_PACKAGE_DIR = path$3.resolve(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite",
3
- "version": "3.0.4",
3
+ "version": "3.0.5",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Evan You",
@@ -59,7 +59,7 @@
59
59
  "//": "READ CONTRIBUTING.md to understand what to put under deps vs. devDeps!",
60
60
  "dependencies": {
61
61
  "esbuild": "^0.14.47",
62
- "postcss": "^8.4.14",
62
+ "postcss": "^8.4.16",
63
63
  "resolve": "^1.22.1",
64
64
  "rollup": "^2.75.6"
65
65
  },
@@ -68,15 +68,15 @@
68
68
  },
69
69
  "devDependencies": {
70
70
  "@ampproject/remapping": "^2.2.0",
71
- "@babel/parser": "^7.18.9",
72
- "@babel/types": "^7.18.9",
71
+ "@babel/parser": "^7.18.11",
72
+ "@babel/types": "^7.18.10",
73
73
  "@jridgewell/trace-mapping": "^0.3.14",
74
74
  "@rollup/plugin-alias": "^3.1.9",
75
- "@rollup/plugin-commonjs": "^22.0.1",
76
- "@rollup/plugin-dynamic-import-vars": "^1.4.3",
75
+ "@rollup/plugin-commonjs": "^22.0.2",
76
+ "@rollup/plugin-dynamic-import-vars": "^1.4.4",
77
77
  "@rollup/plugin-json": "^4.1.0",
78
78
  "@rollup/plugin-node-resolve": "13.3.0",
79
- "@rollup/plugin-typescript": "^8.3.3",
79
+ "@rollup/plugin-typescript": "^8.3.4",
80
80
  "@rollup/pluginutils": "^4.2.1",
81
81
  "@vue/compiler-dom": "^3.2.37",
82
82
  "acorn": "^8.8.0",
@@ -96,10 +96,10 @@
96
96
  "fast-glob": "^3.2.11",
97
97
  "http-proxy": "^1.18.1",
98
98
  "json5": "^2.2.1",
99
- "launch-editor-middleware": "^2.4.0",
99
+ "launch-editor-middleware": "^2.5.0",
100
100
  "magic-string": "^0.26.2",
101
101
  "micromatch": "^4.0.5",
102
- "mlly": "^0.5.5",
102
+ "mlly": "^0.5.7",
103
103
  "mrmime": "^1.0.1",
104
104
  "okie": "^1.0.1",
105
105
  "open": "^8.4.0",
@@ -7,17 +7,17 @@
7
7
  */
8
8
  export interface RollupCommonJSOptions {
9
9
  /**
10
- * A picomatch pattern, or array of patterns, which specifies the files in
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 narrow
13
- * this list by only including specific files. These files will be analyzed
14
- * and transpiled if either the analysis does not find ES module specific
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 picomatch pattern, or array of patterns, which specifies the files in
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 improve performance.
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 hoisted
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 `try-catch` clause is not there.
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 individual IDs.
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 and
173
- * circular dependencies.
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
  }
@@ -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