vite 5.3.2 → 5.3.3

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.
@@ -36576,8 +36576,8 @@ function createCachedImport(imp) {
36576
36576
  return cached;
36577
36577
  };
36578
36578
  }
36579
- const importPostcssImport = createCachedImport(() => import('./dep-Cti1d3iP.js').then(function (n) { return n.i; }));
36580
- const importPostcssModules = createCachedImport(() => import('./dep-MsRcieA4.js').then(function (n) { return n.i; }));
36579
+ const importPostcssImport = createCachedImport(() => import('./dep-DL1Zl8zp.js').then(function (n) { return n.i; }));
36580
+ const importPostcssModules = createCachedImport(() => import('./dep-DDAZqU2f.js').then(function (n) { return n.i; }));
36581
36581
  const importPostcss = createCachedImport(() => import('postcss'));
36582
36582
  const preprocessorWorkerControllerCache = /* @__PURE__ */ new WeakMap();
36583
36583
  let alwaysFakeWorkerWorkerControllerCache;
@@ -61826,9 +61826,17 @@ var httpProxy = httpProxy$2;
61826
61826
  var httpProxy$1 = /*@__PURE__*/getDefaultExportFromCjs(httpProxy);
61827
61827
 
61828
61828
  const debug$4 = createDebugger("vite:proxy");
61829
- const setOriginHeader = (proxyReq, options) => {
61830
- if (options.changeOrigin) {
61829
+ const rewriteOriginHeader = (proxyReq, options, config) => {
61830
+ if (options.rewriteWsOrigin) {
61831
61831
  const { target } = options;
61832
+ if (proxyReq.headersSent) {
61833
+ config.logger.warn(
61834
+ colors$1.yellow(
61835
+ `Unable to rewrite Origin header as headers are already sent.`
61836
+ )
61837
+ );
61838
+ return;
61839
+ }
61832
61840
  if (proxyReq.getHeader("origin") && target) {
61833
61841
  const changedOrigin = typeof target === "object" ? `${target.protocol}//${target.host}` : target;
61834
61842
  proxyReq.setHeader("origin", changedOrigin);
@@ -61883,11 +61891,8 @@ ${err.stack}`, {
61883
61891
  res.end();
61884
61892
  }
61885
61893
  });
61886
- proxy.on("proxyReq", (proxyReq, req, res, options2) => {
61887
- setOriginHeader(proxyReq, options2);
61888
- });
61889
61894
  proxy.on("proxyReqWs", (proxyReq, req, socket, options2, head) => {
61890
- setOriginHeader(proxyReq, options2);
61895
+ rewriteOriginHeader(proxyReq, options2, config);
61891
61896
  socket.on("error", (err) => {
61892
61897
  config.logger.error(
61893
61898
  `${colors$1.red(`ws proxy socket error:`)}
@@ -65025,7 +65030,7 @@ function buildImportAnalysisPlugin(config) {
65025
65030
  if (format !== "es") {
65026
65031
  return;
65027
65032
  }
65028
- if (ssr || isWorker) {
65033
+ if (!insertPreload) {
65029
65034
  const removedPureCssFiles = removedPureCssFilesCache.get(config);
65030
65035
  if (removedPureCssFiles && removedPureCssFiles.size > 0) {
65031
65036
  for (const file in bundle) {
@@ -65231,7 +65236,7 @@ function buildImportAnalysisPlugin(config) {
65231
65236
  const fileDepsCode = `[${fileDeps.map(
65232
65237
  (fileDep) => fileDep.runtime ? fileDep.url : JSON.stringify(fileDep.url)
65233
65238
  ).join(",")}]`;
65234
- const mapDepsCode = `const __vite__fileDeps=${fileDepsCode},__vite__mapDeps=i=>i.map(i=>__vite__fileDeps[i]);
65239
+ const mapDepsCode = `const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=${fileDepsCode})))=>i.map(i=>d[i]);
65235
65240
  `;
65236
65241
  if (code.startsWith("#!")) {
65237
65242
  s.prependLeft(code.indexOf("\n") + 1, mapDepsCode);
@@ -1,4 +1,4 @@
1
- import { C as commonjsGlobal, B as getDefaultExportFromCjs } from './dep-C1-ZB6nQ.js';
1
+ import { C as commonjsGlobal, B as getDefaultExportFromCjs } from './dep-CzJTQ5q7.js';
2
2
  import require$$0__default from 'fs';
3
3
  import require$$0 from 'postcss';
4
4
  import require$$0$1 from 'path';
@@ -1,4 +1,4 @@
1
- import { B as getDefaultExportFromCjs } from './dep-C1-ZB6nQ.js';
1
+ import { B as getDefaultExportFromCjs } from './dep-CzJTQ5q7.js';
2
2
  import require$$0 from 'path';
3
3
  import require$$0__default from 'fs';
4
4
  import { l as lib } from './dep-IQS-Za7F.js';
package/dist/node/cli.js CHANGED
@@ -2,7 +2,7 @@ import path from 'node:path';
2
2
  import fs__default from 'node:fs';
3
3
  import { performance } from 'node:perf_hooks';
4
4
  import { EventEmitter } from 'events';
5
- import { A as colors, v as createLogger, r as resolveConfig } from './chunks/dep-C1-ZB6nQ.js';
5
+ import { A as colors, v as createLogger, r as resolveConfig } from './chunks/dep-CzJTQ5q7.js';
6
6
  import { VERSION } from './constants.js';
7
7
  import 'node:fs/promises';
8
8
  import 'node:url';
@@ -730,7 +730,7 @@ cli.command("[root]", "start dev server").alias("serve").alias("dev").option("--
730
730
  `[boolean] force the optimizer to ignore the cache and re-bundle`
731
731
  ).action(async (root, options) => {
732
732
  filterDuplicateOptions(options);
733
- const { createServer } = await import('./chunks/dep-C1-ZB6nQ.js').then(function (n) { return n.E; });
733
+ const { createServer } = await import('./chunks/dep-CzJTQ5q7.js').then(function (n) { return n.E; });
734
734
  try {
735
735
  const server = await createServer({
736
736
  root,
@@ -822,7 +822,7 @@ cli.command("build [root]", "build for production").option("--target <target>",
822
822
  `[boolean] force empty outDir when it's outside of root`
823
823
  ).option("-w, --watch", `[boolean] rebuilds when modules have changed on disk`).action(async (root, options) => {
824
824
  filterDuplicateOptions(options);
825
- const { build } = await import('./chunks/dep-C1-ZB6nQ.js').then(function (n) { return n.F; });
825
+ const { build } = await import('./chunks/dep-CzJTQ5q7.js').then(function (n) { return n.F; });
826
826
  const buildOptions = cleanOptions(options);
827
827
  try {
828
828
  await build({
@@ -851,7 +851,7 @@ cli.command("optimize [root]", "pre-bundle dependencies").option(
851
851
  ).action(
852
852
  async (root, options) => {
853
853
  filterDuplicateOptions(options);
854
- const { optimizeDeps } = await import('./chunks/dep-C1-ZB6nQ.js').then(function (n) { return n.D; });
854
+ const { optimizeDeps } = await import('./chunks/dep-CzJTQ5q7.js').then(function (n) { return n.D; });
855
855
  try {
856
856
  const config = await resolveConfig(
857
857
  {
@@ -877,7 +877,7 @@ ${e.stack}`),
877
877
  cli.command("preview [root]", "locally preview production build").option("--host [host]", `[string] specify hostname`, { type: [convertHost] }).option("--port <port>", `[number] specify port`).option("--strictPort", `[boolean] exit if specified port is already in use`).option("--open [path]", `[boolean | string] open browser on startup`).option("--outDir <dir>", `[string] output directory (default: dist)`).action(
878
878
  async (root, options) => {
879
879
  filterDuplicateOptions(options);
880
- const { preview } = await import('./chunks/dep-C1-ZB6nQ.js').then(function (n) { return n.G; });
880
+ const { preview } = await import('./chunks/dep-CzJTQ5q7.js').then(function (n) { return n.G; });
881
881
  try {
882
882
  const server = await preview({
883
883
  root,
@@ -618,6 +618,12 @@ interface ProxyOptions extends HttpProxy.ServerOptions {
618
618
  * webpack-dev-server style bypass function
619
619
  */
620
620
  bypass?: (req: http.IncomingMessage, res: http.ServerResponse, options: ProxyOptions) => void | null | undefined | false | string;
621
+ /**
622
+ * rewrite the Origin header of a WebSocket request to match the the target
623
+ *
624
+ * **Exercise caution as rewriting the Origin can leave the proxying open to [CSRF attacks](https://owasp.org/www-community/attacks/csrf).**
625
+ */
626
+ rewriteWsOrigin?: boolean | undefined;
621
627
  }
622
628
 
623
629
  type LogType = 'error' | 'warn' | 'info';
@@ -1,6 +1,6 @@
1
1
  export { parseAst, parseAstAsync } from 'rollup/parseAst';
2
- import { i as isInNodeModules, a as arraify } from './chunks/dep-C1-ZB6nQ.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-C1-ZB6nQ.js';
2
+ import { i as isInNodeModules, a as arraify } from './chunks/dep-CzJTQ5q7.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-CzJTQ5q7.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';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite",
3
- "version": "5.3.2",
3
+ "version": "5.3.3",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Evan You",
@@ -73,7 +73,7 @@
73
73
  "//": "READ CONTRIBUTING.md to understand what to put under deps vs. devDeps!",
74
74
  "dependencies": {
75
75
  "esbuild": "^0.21.3",
76
- "postcss": "^8.4.38",
76
+ "postcss": "^8.4.39",
77
77
  "rollup": "^4.13.0"
78
78
  },
79
79
  "optionalDependencies": {