vite 5.4.6 → 5.4.18

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.
@@ -669,6 +669,18 @@ interface CommonServerOptions {
669
669
  * Set to 0.0.0.0 to listen on all addresses, including LAN and public addresses.
670
670
  */
671
671
  host?: string | boolean;
672
+ /**
673
+ * The hostnames that Vite is allowed to respond to.
674
+ * `localhost` and subdomains under `.localhost` and all IP addresses are allowed by default.
675
+ * When using HTTPS, this check is skipped.
676
+ *
677
+ * If a string starts with `.`, it will allow that hostname without the `.` and all subdomains under the hostname.
678
+ * For example, `.example.com` will allow `example.com`, `foo.example.com`, and `foo.bar.example.com`.
679
+ *
680
+ * If set to `true`, the server is allowed to respond to requests for any hosts.
681
+ * This is not recommended as it will be vulnerable to DNS rebinding attacks.
682
+ */
683
+ allowedHosts?: string[] | true;
672
684
  /**
673
685
  * Enable TLS + HTTP/2.
674
686
  * Note: this downgrades to TLS only when the proxy option is also used.
@@ -704,8 +716,14 @@ interface CommonServerOptions {
704
716
  /**
705
717
  * Configure CORS for the dev server.
706
718
  * Uses https://github.com/expressjs/cors.
719
+ *
720
+ * When enabling this option, **we recommend setting a specific value
721
+ * rather than `true`** to avoid exposing the source code to untrusted origins.
722
+ *
707
723
  * Set to `true` to allow all methods from any origin, or configure separately
708
724
  * using an object.
725
+ *
726
+ * @default false
709
727
  */
710
728
  cors?: CorsOptions | boolean;
711
729
  /**
@@ -717,6 +735,12 @@ interface CommonServerOptions {
717
735
  * https://github.com/expressjs/cors#configuration-options
718
736
  */
719
737
  interface CorsOptions {
738
+ /**
739
+ * Configures the Access-Control-Allow-Origin CORS header.
740
+ *
741
+ * **We recommend setting a specific value rather than
742
+ * `true`** to avoid exposing the source code to untrusted origins.
743
+ */
720
744
  origin?: CorsOrigin | ((origin: string | undefined, cb: (err: Error, origins: CorsOrigin) => void) => void);
721
745
  methods?: string | string[];
722
746
  allowedHeaders?: string | string[];
@@ -3402,6 +3426,18 @@ interface LegacyOptions {
3402
3426
  * https://github.com/vitejs/vite/discussions/14697.
3403
3427
  */
3404
3428
  proxySsrExternalModules?: boolean;
3429
+ /**
3430
+ * In Vite 6.0.8 / 5.4.11 and below, WebSocket server was able to connect from any web pages. However,
3431
+ * that could be exploited by a malicious web page.
3432
+ *
3433
+ * In Vite 6.0.9+ / 5.4.12+, the WebSocket server now requires a token to connect from a web page.
3434
+ * But this may break some plugins and frameworks that connects to the WebSocket server
3435
+ * on their own. Enabling this option will make Vite skip the token check.
3436
+ *
3437
+ * **We do not recommend enabling this option unless you are sure that you are fine with
3438
+ * that security weakness.**
3439
+ */
3440
+ skipWebSocketTokenCheck?: boolean;
3405
3441
  }
3406
3442
  interface ResolvedWorkerOptions {
3407
3443
  format: 'es' | 'iife';
@@ -3443,6 +3479,17 @@ type ResolvedConfig = Readonly<Omit<UserConfig, 'plugins' | 'css' | 'assetsInclu
3443
3479
  worker: ResolvedWorkerOptions;
3444
3480
  appType: AppType;
3445
3481
  experimental: ExperimentalOptions;
3482
+ /**
3483
+ * The token to connect to the WebSocket server from browsers.
3484
+ *
3485
+ * We recommend using `import.meta.hot` rather than connecting
3486
+ * to the WebSocket server directly.
3487
+ * If you have a usecase that requires connecting to the WebSocket
3488
+ * server, please create an issue so that we can discuss.
3489
+ *
3490
+ * @deprecated
3491
+ */
3492
+ webSocketToken: string;
3446
3493
  } & PluginHookUtils>;
3447
3494
  interface PluginHookUtils {
3448
3495
  getSortedPlugins: <K extends keyof Plugin>(hookName: K) => PluginWithRequiredHook<K>[];
@@ -1,6 +1,6 @@
1
1
  export { parseAst, parseAstAsync } from 'rollup/parseAst';
2
- import { i as isInNodeModules, a as arraify } from './chunks/dep-DyBnyoVI.js';
3
- export { b as build, g as buildErrorMessage, k as createFilter, v as createLogger, c as createServer, d as defineConfig, h as fetchModule, f as formatPostcssSourceMap, x as isFileServingAllowed, l as loadConfigFromFile, y as loadEnv, j as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, e as preprocessCSS, p as preview, r as resolveConfig, z as resolveEnvPrefix, q as rollupVersion, w as searchForWorkspaceRoot, u as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-DyBnyoVI.js';
2
+ import { i as isInNodeModules, a as arraify } from './chunks/dep-DbT5NFX0.js';
3
+ export { b as build, g as buildErrorMessage, k as createFilter, v as createLogger, c as createServer, d as defineConfig, h as fetchModule, f as formatPostcssSourceMap, x as isFileServingAllowed, l as loadConfigFromFile, y as loadEnv, j as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, e as preprocessCSS, p as preview, r as resolveConfig, z as resolveEnvPrefix, q as rollupVersion, w as searchForWorkspaceRoot, u as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-DbT5NFX0.js';
4
4
  export { VERSION as version } from './constants.js';
5
5
  export { version as esbuildVersion } from 'esbuild';
6
6
  import { existsSync, readFileSync } from 'node:fs';
@@ -11,6 +11,7 @@ import 'node:url';
11
11
  import 'node:util';
12
12
  import 'node:perf_hooks';
13
13
  import 'node:module';
14
+ import 'node:crypto';
14
15
  import 'tty';
15
16
  import 'path';
16
17
  import 'fs';
@@ -29,7 +30,6 @@ import 'stream';
29
30
  import 'os';
30
31
  import 'child_process';
31
32
  import 'node:os';
32
- import 'node:crypto';
33
33
  import 'node:dns';
34
34
  import 'crypto';
35
35
  import 'module';
@@ -43,6 +43,7 @@ import 'zlib';
43
43
  import 'buffer';
44
44
  import 'https';
45
45
  import 'tls';
46
+ import 'node:net';
46
47
  import 'assert';
47
48
  import 'node:zlib';
48
49
 
package/index.cjs CHANGED
@@ -40,7 +40,7 @@ function warnCjsUsage() {
40
40
  const yellow = (str) => `\u001b[33m${str}\u001b[39m`
41
41
  console.warn(
42
42
  yellow(
43
- `The CJS build of Vite's Node API is deprecated. See https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.`,
43
+ `The CJS build of Vite's Node API is deprecated. See https://vite.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.`,
44
44
  ),
45
45
  )
46
46
  if (process.env.VITE_CJS_TRACE) {
package/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @deprecated The CJS build of Vite's Node API is deprecated. See https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.
2
+ * @deprecated The CJS build of Vite's Node API is deprecated. See https://vite.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.
3
3
  */
4
4
  declare const module: any
5
5
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite",
3
- "version": "5.4.6",
3
+ "version": "5.4.18",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Evan You",
@@ -68,7 +68,7 @@
68
68
  "bugs": {
69
69
  "url": "https://github.com/vitejs/vite/issues"
70
70
  },
71
- "homepage": "https://vitejs.dev",
71
+ "homepage": "https://vite.dev",
72
72
  "funding": "https://github.com/vitejs/vite?sponsor=1",
73
73
  "//": "READ CONTRIBUTING.md to understand what to put under deps vs. devDeps!",
74
74
  "dependencies": {
@@ -109,7 +109,7 @@
109
109
  "etag": "^1.8.1",
110
110
  "fast-glob": "^3.3.2",
111
111
  "http-proxy": "^1.18.1",
112
- "launch-editor-middleware": "^2.8.1",
112
+ "launch-editor-middleware": "^2.9.1",
113
113
  "lightningcss": "^1.26.0",
114
114
  "magic-string": "^0.30.11",
115
115
  "micromatch": "^4.0.8",
@@ -134,7 +134,7 @@
134
134
  "source-map-support": "^0.5.21",
135
135
  "strip-ansi": "^7.1.0",
136
136
  "strip-literal": "^2.1.0",
137
- "tsconfck": "^3.1.3",
137
+ "tsconfck": "^3.1.4",
138
138
  "tslib": "^2.7.0",
139
139
  "types": "link:./types",
140
140
  "ufo": "^1.5.4",