vite 5.2.11 → 5.2.13

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 { C as commonjsGlobal, B as getDefaultExportFromCjs } from './dep-cNe07EU9.js';
1
+ import { C as commonjsGlobal, B as getDefaultExportFromCjs } from './dep-DEPSZ3SS.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-cNe07EU9.js';
1
+ import { B as getDefaultExportFromCjs } from './dep-DEPSZ3SS.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 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-cNe07EU9.js';
5
+ import { A as colors, v as createLogger, r as resolveConfig } from './chunks/dep-DEPSZ3SS.js';
6
6
  import { VERSION } from './constants.js';
7
7
  import 'node:fs/promises';
8
8
  import 'node:url';
@@ -757,7 +757,7 @@ cli
757
757
  filterDuplicateOptions(options);
758
758
  // output structure is preserved even after bundling so require()
759
759
  // is ok here
760
- const { createServer } = await import('./chunks/dep-cNe07EU9.js').then(function (n) { return n.E; });
760
+ const { createServer } = await import('./chunks/dep-DEPSZ3SS.js').then(function (n) { return n.E; });
761
761
  try {
762
762
  const server = await createServer({
763
763
  root,
@@ -836,7 +836,7 @@ cli
836
836
  .option('-w, --watch', `[boolean] rebuilds when modules have changed on disk`)
837
837
  .action(async (root, options) => {
838
838
  filterDuplicateOptions(options);
839
- const { build } = await import('./chunks/dep-cNe07EU9.js').then(function (n) { return n.F; });
839
+ const { build } = await import('./chunks/dep-DEPSZ3SS.js').then(function (n) { return n.F; });
840
840
  const buildOptions = cleanOptions(options);
841
841
  try {
842
842
  await build({
@@ -863,7 +863,7 @@ cli
863
863
  .option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
864
864
  .action(async (root, options) => {
865
865
  filterDuplicateOptions(options);
866
- const { optimizeDeps } = await import('./chunks/dep-cNe07EU9.js').then(function (n) { return n.D; });
866
+ const { optimizeDeps } = await import('./chunks/dep-DEPSZ3SS.js').then(function (n) { return n.D; });
867
867
  try {
868
868
  const config = await resolveConfig({
869
869
  root,
@@ -889,7 +889,7 @@ cli
889
889
  .option('--outDir <dir>', `[string] output directory (default: dist)`)
890
890
  .action(async (root, options) => {
891
891
  filterDuplicateOptions(options);
892
- const { preview } = await import('./chunks/dep-cNe07EU9.js').then(function (n) { return n.G; });
892
+ const { preview } = await import('./chunks/dep-DEPSZ3SS.js').then(function (n) { return n.G; });
893
893
  try {
894
894
  const server = await preview({
895
895
  root,
@@ -680,8 +680,8 @@ interface CommonServerOptions {
680
680
  * ``` js
681
681
  * module.exports = {
682
682
  * proxy: {
683
- * // string shorthand
684
- * '/foo': 'http://localhost:4567/foo',
683
+ * // string shorthand: /foo -> http://localhost:4567/foo
684
+ * '/foo': 'http://localhost:4567',
685
685
  * // with options
686
686
  * '/api': {
687
687
  * target: 'http://jsonplaceholder.typicode.com',
@@ -1682,7 +1682,6 @@ interface ViteDevServer {
1682
1682
  watcher: FSWatcher;
1683
1683
  /**
1684
1684
  * web socket server with `send(payload)` method
1685
- * @deprecated use `hot` instead
1686
1685
  */
1687
1686
  ws: WebSocketServer;
1688
1687
  /**
@@ -1690,6 +1689,7 @@ interface ViteDevServer {
1690
1689
  *
1691
1690
  * Always sends a message to at least a WebSocket client. Any third party can
1692
1691
  * add a channel to the broadcaster to process messages
1692
+ * @deprecated will be replaced with the environment api in v6.
1693
1693
  */
1694
1694
  hot: HMRBroadcaster;
1695
1695
  /**
@@ -3080,7 +3080,7 @@ interface Plugin<A = any> extends rollup.Plugin<A> {
3080
3080
  * the descriptors.
3081
3081
  *
3082
3082
  * - The hook can also return an empty array and then perform custom updates
3083
- * by sending a custom hmr payload via server.hot.send().
3083
+ * by sending a custom hmr payload via server.ws.send().
3084
3084
  *
3085
3085
  * - If the hook doesn't return a value, the hmr update will be performed as
3086
3086
  * normal.
@@ -3433,7 +3433,7 @@ declare const VERSION: string;
3433
3433
 
3434
3434
  declare const isCSSRequest: (request: string) => boolean;
3435
3435
  /**
3436
- * @deprecated use build.rollupOutput.manualChunks or framework specific configuration
3436
+ * @deprecated use build.rollupOptions.output.manualChunks or framework specific configuration
3437
3437
  */
3438
3438
  declare class SplitVendorChunkCache {
3439
3439
  cache: Map<string, boolean>;
@@ -3441,13 +3441,13 @@ declare class SplitVendorChunkCache {
3441
3441
  reset(): void;
3442
3442
  }
3443
3443
  /**
3444
- * @deprecated use build.rollupOutput.manualChunks or framework specific configuration
3444
+ * @deprecated use build.rollupOptions.output.manualChunks or framework specific configuration
3445
3445
  */
3446
3446
  declare function splitVendorChunk(options?: {
3447
3447
  cache?: SplitVendorChunkCache;
3448
3448
  }): GetManualChunk;
3449
3449
  /**
3450
- * @deprecated use build.rollupOutput.manualChunks or framework specific configuration
3450
+ * @deprecated use build.rollupOptions.output.manualChunks or framework specific configuration
3451
3451
  */
3452
3452
  declare function splitVendorChunkPlugin(): Plugin;
3453
3453
 
@@ -1,6 +1,6 @@
1
1
  export { parseAst, parseAstAsync } from 'rollup/parseAst';
2
- import { i as isInNodeModules, a as arraify } from './chunks/dep-cNe07EU9.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-cNe07EU9.js';
2
+ import { i as isInNodeModules, a as arraify } from './chunks/dep-DEPSZ3SS.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-DEPSZ3SS.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';
@@ -58,7 +58,7 @@ const isCSSRequest = (request) => CSS_LANGS_RE.test(request);
58
58
  // The cache needs to be reset on buildStart for watch mode to work correctly
59
59
  // Don't use this manualChunks strategy for ssr, lib mode, and 'umd' or 'iife'
60
60
  /**
61
- * @deprecated use build.rollupOutput.manualChunks or framework specific configuration
61
+ * @deprecated use build.rollupOptions.output.manualChunks or framework specific configuration
62
62
  */
63
63
  class SplitVendorChunkCache {
64
64
  cache;
@@ -70,7 +70,7 @@ class SplitVendorChunkCache {
70
70
  }
71
71
  }
72
72
  /**
73
- * @deprecated use build.rollupOutput.manualChunks or framework specific configuration
73
+ * @deprecated use build.rollupOptions.output.manualChunks or framework specific configuration
74
74
  */
75
75
  function splitVendorChunk(options = {}) {
76
76
  const cache = options.cache ?? new SplitVendorChunkCache();
@@ -105,7 +105,7 @@ function staticImportedByEntry(id, getModuleInfo, cache, importStack = []) {
105
105
  return someImporterIs;
106
106
  }
107
107
  /**
108
- * @deprecated use build.rollupOutput.manualChunks or framework specific configuration
108
+ * @deprecated use build.rollupOptions.output.manualChunks or framework specific configuration
109
109
  */
110
110
  function splitVendorChunkPlugin() {
111
111
  const caches = [];
@@ -119,17 +119,21 @@ function getDefaultExportFromCjs (x) {
119
119
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
120
120
  }
121
121
 
122
- var picocolors = {exports: {}};
122
+ function commonjsRequire(path) {
123
+ throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
124
+ }
123
125
 
124
- let tty = require$$0;
126
+ var picocolors = {exports: {}};
125
127
 
128
+ let argv = process.argv || [],
129
+ env = process.env;
126
130
  let isColorSupported =
127
- !("NO_COLOR" in process.env || process.argv.includes("--no-color")) &&
128
- ("FORCE_COLOR" in process.env ||
129
- process.argv.includes("--color") ||
131
+ !("NO_COLOR" in env || argv.includes("--no-color")) &&
132
+ ("FORCE_COLOR" in env ||
133
+ argv.includes("--color") ||
130
134
  process.platform === "win32" ||
131
- (tty.isatty(1) && process.env.TERM !== "dumb") ||
132
- "CI" in process.env);
135
+ (commonjsRequire != null && require$$0.isatty(1) && env.TERM !== "dumb") ||
136
+ "CI" in env);
133
137
 
134
138
  let formatter =
135
139
  (open, close, replace = open) =>
@@ -142,40 +146,47 @@ let formatter =
142
146
  };
143
147
 
144
148
  let replaceClose = (string, close, replace, index) => {
145
- let start = string.substring(0, index) + replace;
146
- let end = string.substring(index + close.length);
147
- let nextIndex = end.indexOf(close);
148
- return ~nextIndex ? start + replaceClose(end, close, replace, nextIndex) : start + end
149
+ let result = "";
150
+ let cursor = 0;
151
+ do {
152
+ result += string.substring(cursor, index) + replace;
153
+ cursor = index + close.length;
154
+ index = string.indexOf(close, cursor);
155
+ } while (~index)
156
+ return result + string.substring(cursor)
149
157
  };
150
158
 
151
- let createColors = (enabled = isColorSupported) => ({
152
- isColorSupported: enabled,
153
- reset: enabled ? s => `\x1b[0m${s}\x1b[0m` : String,
154
- bold: enabled ? formatter("\x1b[1m", "\x1b[22m", "\x1b[22m\x1b[1m") : String,
155
- dim: enabled ? formatter("\x1b[2m", "\x1b[22m", "\x1b[22m\x1b[2m") : String,
156
- italic: enabled ? formatter("\x1b[3m", "\x1b[23m") : String,
157
- underline: enabled ? formatter("\x1b[4m", "\x1b[24m") : String,
158
- inverse: enabled ? formatter("\x1b[7m", "\x1b[27m") : String,
159
- hidden: enabled ? formatter("\x1b[8m", "\x1b[28m") : String,
160
- strikethrough: enabled ? formatter("\x1b[9m", "\x1b[29m") : String,
161
- black: enabled ? formatter("\x1b[30m", "\x1b[39m") : String,
162
- red: enabled ? formatter("\x1b[31m", "\x1b[39m") : String,
163
- green: enabled ? formatter("\x1b[32m", "\x1b[39m") : String,
164
- yellow: enabled ? formatter("\x1b[33m", "\x1b[39m") : String,
165
- blue: enabled ? formatter("\x1b[34m", "\x1b[39m") : String,
166
- magenta: enabled ? formatter("\x1b[35m", "\x1b[39m") : String,
167
- cyan: enabled ? formatter("\x1b[36m", "\x1b[39m") : String,
168
- white: enabled ? formatter("\x1b[37m", "\x1b[39m") : String,
169
- gray: enabled ? formatter("\x1b[90m", "\x1b[39m") : String,
170
- bgBlack: enabled ? formatter("\x1b[40m", "\x1b[49m") : String,
171
- bgRed: enabled ? formatter("\x1b[41m", "\x1b[49m") : String,
172
- bgGreen: enabled ? formatter("\x1b[42m", "\x1b[49m") : String,
173
- bgYellow: enabled ? formatter("\x1b[43m", "\x1b[49m") : String,
174
- bgBlue: enabled ? formatter("\x1b[44m", "\x1b[49m") : String,
175
- bgMagenta: enabled ? formatter("\x1b[45m", "\x1b[49m") : String,
176
- bgCyan: enabled ? formatter("\x1b[46m", "\x1b[49m") : String,
177
- bgWhite: enabled ? formatter("\x1b[47m", "\x1b[49m") : String,
178
- });
159
+ let createColors = (enabled = isColorSupported) => {
160
+ let init = enabled ? formatter : () => String;
161
+ return {
162
+ isColorSupported: enabled,
163
+ reset: init("\x1b[0m", "\x1b[0m"),
164
+ bold: init("\x1b[1m", "\x1b[22m", "\x1b[22m\x1b[1m"),
165
+ dim: init("\x1b[2m", "\x1b[22m", "\x1b[22m\x1b[2m"),
166
+ italic: init("\x1b[3m", "\x1b[23m"),
167
+ underline: init("\x1b[4m", "\x1b[24m"),
168
+ inverse: init("\x1b[7m", "\x1b[27m"),
169
+ hidden: init("\x1b[8m", "\x1b[28m"),
170
+ strikethrough: init("\x1b[9m", "\x1b[29m"),
171
+ black: init("\x1b[30m", "\x1b[39m"),
172
+ red: init("\x1b[31m", "\x1b[39m"),
173
+ green: init("\x1b[32m", "\x1b[39m"),
174
+ yellow: init("\x1b[33m", "\x1b[39m"),
175
+ blue: init("\x1b[34m", "\x1b[39m"),
176
+ magenta: init("\x1b[35m", "\x1b[39m"),
177
+ cyan: init("\x1b[36m", "\x1b[39m"),
178
+ white: init("\x1b[37m", "\x1b[39m"),
179
+ gray: init("\x1b[90m", "\x1b[39m"),
180
+ bgBlack: init("\x1b[40m", "\x1b[49m"),
181
+ bgRed: init("\x1b[41m", "\x1b[49m"),
182
+ bgGreen: init("\x1b[42m", "\x1b[49m"),
183
+ bgYellow: init("\x1b[43m", "\x1b[49m"),
184
+ bgBlue: init("\x1b[44m", "\x1b[49m"),
185
+ bgMagenta: init("\x1b[45m", "\x1b[49m"),
186
+ bgCyan: init("\x1b[46m", "\x1b[49m"),
187
+ bgWhite: init("\x1b[47m", "\x1b[49m"),
188
+ }
189
+ };
179
190
 
180
191
  picocolors.exports = createColors();
181
192
  picocolors.exports.createColors = createColors;
@@ -3463,6 +3474,7 @@ function tryStatSync(file) {
3463
3474
  // Ignore errors
3464
3475
  }
3465
3476
  }
3477
+ const splitRE = /\r?\n/g;
3466
3478
  function isFileReadable(filename) {
3467
3479
  if (!tryStatSync(filename)) {
3468
3480
  return false;
@@ -3594,7 +3606,7 @@ const isCSSRequest = (request) => CSS_LANGS_RE.test(request);
3594
3606
  // The cache needs to be reset on buildStart for watch mode to work correctly
3595
3607
  // Don't use this manualChunks strategy for ssr, lib mode, and 'umd' or 'iife'
3596
3608
  /**
3597
- * @deprecated use build.rollupOutput.manualChunks or framework specific configuration
3609
+ * @deprecated use build.rollupOptions.output.manualChunks or framework specific configuration
3598
3610
  */
3599
3611
  class SplitVendorChunkCache {
3600
3612
  cache;
@@ -3606,7 +3618,7 @@ class SplitVendorChunkCache {
3606
3618
  }
3607
3619
  }
3608
3620
  /**
3609
- * @deprecated use build.rollupOutput.manualChunks or framework specific configuration
3621
+ * @deprecated use build.rollupOptions.output.manualChunks or framework specific configuration
3610
3622
  */
3611
3623
  function splitVendorChunk(options = {}) {
3612
3624
  const cache = options.cache ?? new SplitVendorChunkCache();
@@ -3641,7 +3653,7 @@ function staticImportedByEntry(id, getModuleInfo, cache, importStack = []) {
3641
3653
  return someImporterIs;
3642
3654
  }
3643
3655
  /**
3644
- * @deprecated use build.rollupOutput.manualChunks or framework specific configuration
3656
+ * @deprecated use build.rollupOptions.output.manualChunks or framework specific configuration
3645
3657
  */
3646
3658
  function splitVendorChunkPlugin() {
3647
3659
  const caches = [];
@@ -5424,6 +5436,7 @@ function getTimeFormatter() {
5424
5436
  });
5425
5437
  return timeFormatter;
5426
5438
  }
5439
+ const MAX_LOG_CHAR = 5000;
5427
5440
  function createLogger(level = 'info', options = {}) {
5428
5441
  if (options.customLogger) {
5429
5442
  return options.customLogger;
@@ -5433,7 +5446,16 @@ function createLogger(level = 'info', options = {}) {
5433
5446
  const thresh = LogLevels[level];
5434
5447
  const canClearScreen = allowClearScreen && process.stdout.isTTY && !process.env.CI;
5435
5448
  const clear = canClearScreen ? clearScreen : () => { };
5436
- function format(type, msg, options = {}) {
5449
+ function preventOverflow(msg) {
5450
+ if (msg.length > MAX_LOG_CHAR) {
5451
+ const shorten = msg.slice(0, MAX_LOG_CHAR);
5452
+ const lines = msg.slice(MAX_LOG_CHAR).match(splitRE)?.length || 0;
5453
+ return `${shorten}\n... and ${lines} lines more`;
5454
+ }
5455
+ return msg;
5456
+ }
5457
+ function format(type, rawMsg, options = {}) {
5458
+ const msg = preventOverflow(rawMsg);
5437
5459
  if (options.timestamp) {
5438
5460
  const tag = type === 'info'
5439
5461
  ? colors.cyan(colors.bold(prefix))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite",
3
- "version": "5.2.11",
3
+ "version": "5.2.13",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Evan You",
@@ -81,11 +81,11 @@
81
81
  },
82
82
  "devDependencies": {
83
83
  "@ampproject/remapping": "^2.3.0",
84
- "@babel/parser": "^7.24.5",
84
+ "@babel/parser": "^7.24.6",
85
85
  "@jridgewell/trace-mapping": "^0.3.25",
86
86
  "@polka/compression": "^1.0.0-next.25",
87
87
  "@rollup/plugin-alias": "^5.1.0",
88
- "@rollup/plugin-commonjs": "^25.0.7",
88
+ "@rollup/plugin-commonjs": "^25.0.8",
89
89
  "@rollup/plugin-dynamic-import-vars": "^2.1.2",
90
90
  "@rollup/plugin-json": "^6.1.0",
91
91
  "@rollup/plugin-node-resolve": "15.2.3",
@@ -95,7 +95,7 @@
95
95
  "@types/pnpapi": "^0.0.5",
96
96
  "acorn": "^8.11.3",
97
97
  "acorn-walk": "^8.3.2",
98
- "artichokie": "^0.2.0",
98
+ "artichokie": "^0.2.1",
99
99
  "cac": "^6.7.14",
100
100
  "chokidar": "^3.6.0",
101
101
  "connect": "^3.7.0",
@@ -106,32 +106,32 @@
106
106
  "dep-types": "link:./src/types",
107
107
  "dotenv": "^16.4.5",
108
108
  "dotenv-expand": "^11.0.6",
109
- "es-module-lexer": "^1.5.2",
109
+ "es-module-lexer": "^1.5.3",
110
110
  "escape-html": "^1.0.3",
111
111
  "estree-walker": "^3.0.3",
112
112
  "etag": "^1.8.1",
113
113
  "fast-glob": "^3.3.2",
114
114
  "http-proxy": "^1.18.1",
115
115
  "launch-editor-middleware": "^2.6.1",
116
- "lightningcss": "^1.24.1",
116
+ "lightningcss": "^1.25.1",
117
117
  "magic-string": "^0.30.10",
118
- "micromatch": "^4.0.5",
119
- "mlly": "^1.6.1",
118
+ "micromatch": "^4.0.7",
119
+ "mlly": "^1.7.0",
120
120
  "mrmime": "^2.0.0",
121
121
  "open": "^8.4.2",
122
122
  "parse5": "^7.1.2",
123
123
  "pathe": "^1.1.2",
124
124
  "periscopic": "^4.0.2",
125
- "picocolors": "^1.0.0",
125
+ "picocolors": "^1.0.1",
126
126
  "picomatch": "^2.3.1",
127
127
  "postcss-import": "^16.1.0",
128
128
  "postcss-load-config": "^4.0.2",
129
129
  "postcss-modules": "^6.0.0",
130
130
  "resolve.exports": "^2.0.2",
131
- "rollup-plugin-dts": "^6.1.0",
131
+ "rollup-plugin-dts": "^6.1.1",
132
132
  "rollup-plugin-esbuild": "^6.1.1",
133
- "rollup-plugin-license": "^3.3.1",
134
- "sass": "^1.76.0",
133
+ "rollup-plugin-license": "^3.4.0",
134
+ "sass": "^1.77.2",
135
135
  "sirv": "^2.0.4",
136
136
  "source-map-support": "^0.5.21",
137
137
  "strip-ansi": "^7.1.0",
@@ -23,6 +23,7 @@ export interface WebSocketConnectionPayload {
23
23
  * This might be removed in the future if we didn't find reasonable use cases.
24
24
  * If you find this useful, please open an issue with details so we can discuss and make it stable API.
25
25
  */
26
+ // eslint-disable-next-line n/no-unsupported-features/node-builtins
26
27
  webSocket: WebSocket
27
28
  }
28
29