vite 5.0.1 → 5.0.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.
package/dist/node/cli.js CHANGED
@@ -2,15 +2,15 @@ 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 { x as colors, k as createLogger, r as resolveConfig } from './chunks/dep-VPh1kAXQ.js';
5
+ import { x as colors, k as createLogger, r as resolveConfig } from './chunks/dep-vyqc0_aB.js';
6
6
  import { VERSION } from './constants.js';
7
7
  import 'node:fs/promises';
8
8
  import 'node:url';
9
9
  import 'node:util';
10
10
  import 'node:module';
11
11
  import 'tty';
12
- import 'esbuild';
13
12
  import 'path';
13
+ import 'esbuild';
14
14
  import 'fs';
15
15
  import 'assert';
16
16
  import 'node:http';
@@ -759,7 +759,7 @@ cli
759
759
  filterDuplicateOptions(options);
760
760
  // output structure is preserved even after bundling so require()
761
761
  // is ok here
762
- const { createServer } = await import('./chunks/dep-VPh1kAXQ.js').then(function (n) { return n.A; });
762
+ const { createServer } = await import('./chunks/dep-vyqc0_aB.js').then(function (n) { return n.A; });
763
763
  try {
764
764
  const server = await createServer({
765
765
  root,
@@ -839,7 +839,7 @@ cli
839
839
  .option('-w, --watch', `[boolean] rebuilds when modules have changed on disk`)
840
840
  .action(async (root, options) => {
841
841
  filterDuplicateOptions(options);
842
- const { build } = await import('./chunks/dep-VPh1kAXQ.js').then(function (n) { return n.C; });
842
+ const { build } = await import('./chunks/dep-vyqc0_aB.js').then(function (n) { return n.C; });
843
843
  const buildOptions = cleanOptions(options);
844
844
  try {
845
845
  await build({
@@ -867,7 +867,7 @@ cli
867
867
  .option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
868
868
  .action(async (root, options) => {
869
869
  filterDuplicateOptions(options);
870
- const { optimizeDeps } = await import('./chunks/dep-VPh1kAXQ.js').then(function (n) { return n.B; });
870
+ const { optimizeDeps } = await import('./chunks/dep-vyqc0_aB.js').then(function (n) { return n.B; });
871
871
  try {
872
872
  const config = await resolveConfig({
873
873
  root,
@@ -893,7 +893,7 @@ cli
893
893
  .option('--outDir <dir>', `[string] output directory (default: dist)`)
894
894
  .action(async (root, options) => {
895
895
  filterDuplicateOptions(options);
896
- const { preview } = await import('./chunks/dep-VPh1kAXQ.js').then(function (n) { return n.D; });
896
+ const { preview } = await import('./chunks/dep-vyqc0_aB.js').then(function (n) { return n.D; });
897
897
  try {
898
898
  const server = await preview({
899
899
  root,
@@ -3285,6 +3285,8 @@ interface SendOptions {
3285
3285
  map?: SourceMap | {
3286
3286
  mappings: '';
3287
3287
  } | null;
3288
+ /** only used when type === 'js' && map == null (when the fallback sourcemap is used) */
3289
+ originalContent?: string;
3288
3290
  }
3289
3291
  declare function send(req: IncomingMessage, res: ServerResponse, content: string | Buffer, type: string, options: SendOptions): void;
3290
3292
 
@@ -1,6 +1,6 @@
1
1
  export { parseAst, parseAstAsync } from 'rollup/parseAst';
2
- import { i as isInNodeModules } from './chunks/dep-VPh1kAXQ.js';
3
- export { b as build, e as buildErrorMessage, h as createFilter, k as createLogger, c as createServer, d as defineConfig, f as formatPostcssSourceMap, u as isFileServingAllowed, l as loadConfigFromFile, v as loadEnv, g as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, a as preprocessCSS, p as preview, r as resolveConfig, w as resolveEnvPrefix, q as searchForWorkspaceRoot, j as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-VPh1kAXQ.js';
2
+ import { i as isInNodeModules } from './chunks/dep-vyqc0_aB.js';
3
+ export { b as build, e as buildErrorMessage, h as createFilter, k as createLogger, c as createServer, d as defineConfig, f as formatPostcssSourceMap, u as isFileServingAllowed, l as loadConfigFromFile, v as loadEnv, g as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, a as preprocessCSS, p as preview, r as resolveConfig, w as resolveEnvPrefix, q as searchForWorkspaceRoot, j as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-vyqc0_aB.js';
4
4
  export { VERSION as version } from './constants.js';
5
5
  export { version as esbuildVersion } from 'esbuild';
6
6
  export { VERSION as rollupVersion } from 'rollup';
@@ -5329,7 +5329,9 @@ function send(req, res, content, type, options) {
5329
5329
  }
5330
5330
  // inject fallback sourcemap for js for improved debugging
5331
5331
  // https://github.com/vitejs/vite/pull/13514#issuecomment-1592431496
5332
- else if (type === 'js' && (!map || map.mappings !== '')) {
5332
+ // for { mappings: "" }, we don't inject fallback sourcemap
5333
+ // because it indicates generating a sourcemap is meaningless
5334
+ else if (type === 'js' && map == null) {
5333
5335
  const code = content.toString();
5334
5336
  // if the code has existing inline sourcemap, assume it's correct and skip
5335
5337
  if (convertSourceMap.mapFileCommentRegex.test(code)) {
@@ -5338,11 +5340,15 @@ function send(req, res, content, type, options) {
5338
5340
  else {
5339
5341
  const urlWithoutTimestamp = removeTimestampQuery(req.url);
5340
5342
  const ms = new MagicString(code);
5341
- content = getCodeWithSourcemap(type, code, ms.generateMap({
5343
+ const map = ms.generateMap({
5342
5344
  source: path$3.basename(urlWithoutTimestamp),
5343
5345
  hires: 'boundary',
5344
- includeContent: true,
5345
- }));
5346
+ includeContent: !options.originalContent,
5347
+ });
5348
+ if (options.originalContent != null) {
5349
+ map.sourcesContent = [options.originalContent];
5350
+ }
5351
+ content = getCodeWithSourcemap(type, code, map);
5346
5352
  }
5347
5353
  }
5348
5354
  res.statusCode = 200;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite",
3
- "version": "5.0.1",
3
+ "version": "5.0.3",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Evan You",
@@ -70,11 +70,11 @@
70
70
  },
71
71
  "devDependencies": {
72
72
  "@ampproject/remapping": "^2.2.1",
73
- "@babel/parser": "^7.23.3",
73
+ "@babel/parser": "^7.23.4",
74
74
  "@jridgewell/trace-mapping": "^0.3.20",
75
- "@rollup/plugin-alias": "^5.0.1",
75
+ "@rollup/plugin-alias": "^5.1.0",
76
76
  "@rollup/plugin-commonjs": "^25.0.7",
77
- "@rollup/plugin-dynamic-import-vars": "^2.1.0",
77
+ "@rollup/plugin-dynamic-import-vars": "^2.1.1",
78
78
  "@rollup/plugin-json": "^6.0.1",
79
79
  "@rollup/plugin-node-resolve": "15.2.3",
80
80
  "@rollup/plugin-typescript": "^11.1.5",
@@ -99,7 +99,7 @@
99
99
  "etag": "^1.8.1",
100
100
  "fast-glob": "^3.3.2",
101
101
  "http-proxy": "^1.18.1",
102
- "json-stable-stringify": "^1.0.2",
102
+ "json-stable-stringify": "^1.1.0",
103
103
  "launch-editor-middleware": "^2.6.1",
104
104
  "lightningcss": "^1.22.1",
105
105
  "magic-string": "^0.30.5",
@@ -113,7 +113,7 @@
113
113
  "picocolors": "^1.0.0",
114
114
  "picomatch": "^2.3.1",
115
115
  "postcss-import": "^15.1.0",
116
- "postcss-load-config": "^4.0.1",
116
+ "postcss-load-config": "^4.0.2",
117
117
  "postcss-modules": "^6.0.0",
118
118
  "resolve.exports": "^2.0.2",
119
119
  "rollup-plugin-dts": "^6.1.0",
@@ -125,7 +125,7 @@
125
125
  "tsconfck": "^3.0.0",
126
126
  "tslib": "^2.6.2",
127
127
  "types": "link:./types",
128
- "ufo": "^1.3.1",
128
+ "ufo": "^1.3.2",
129
129
  "ws": "^8.14.2"
130
130
  },
131
131
  "peerDependencies": {