vite 5.2.2 → 5.2.4

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-B-u6xNiR.js';
1
+ import { C as commonjsGlobal, B as getDefaultExportFromCjs } from './dep-DJaaTb_D.js';
2
2
  import require$$0__default from 'fs';
3
3
  import require$$0 from 'postcss';
4
4
  import require$$0$1 from 'path';
@@ -13182,6 +13182,8 @@ function displayTime(time) {
13182
13182
  * Encodes the URI path portion (ignores part after ? or #)
13183
13183
  */
13184
13184
  function encodeURIPath(uri) {
13185
+ if (uri.startsWith('data:'))
13186
+ return uri;
13185
13187
  const filePath = cleanUrl(uri);
13186
13188
  const postfix = filePath !== uri ? uri.slice(filePath.length) : '';
13187
13189
  return encodeURI(filePath) + postfix;
@@ -13191,6 +13193,8 @@ function encodeURIPath(uri) {
13191
13193
  * that can handle un-encoded URIs, where `%` is the only ambiguous character.
13192
13194
  */
13193
13195
  function partialEncodeURIPath(uri) {
13196
+ if (uri.startsWith('data:'))
13197
+ return uri;
13194
13198
  const filePath = cleanUrl(uri);
13195
13199
  const postfix = filePath !== uri ? uri.slice(filePath.length) : '';
13196
13200
  return filePath.replaceAll('%', '%25') + postfix;
@@ -15917,7 +15921,7 @@ function assetPlugin(config) {
15917
15921
  }
15918
15922
  }
15919
15923
  return {
15920
- code: `export default ${JSON.stringify(url.startsWith('data:') ? url : encodeURIPath(url))}`,
15924
+ code: `export default ${JSON.stringify(encodeURIPath(url))}`,
15921
15925
  // Force rollup to keep this module from being shared between other entry points if it's an entrypoint.
15922
15926
  // If the resulting chunk is empty, it will be removed in generateBundle.
15923
15927
  moduleSideEffects: config.command === 'build' && this.getModuleInfo(id)?.isEntry
@@ -32289,8 +32293,8 @@ function createCachedImport(imp) {
32289
32293
  return cached;
32290
32294
  };
32291
32295
  }
32292
- const importPostcssImport = createCachedImport(() => import('./dep-BDnA8AV1.js').then(function (n) { return n.i; }));
32293
- const importPostcssModules = createCachedImport(() => import('./dep-B1nD54tQ.js').then(function (n) { return n.i; }));
32296
+ const importPostcssImport = createCachedImport(() => import('./dep-dbS6PJl1.js').then(function (n) { return n.i; }));
32297
+ const importPostcssModules = createCachedImport(() => import('./dep-BdASg7BL.js').then(function (n) { return n.i; }));
32294
32298
  const importPostcss = createCachedImport(() => import('postcss'));
32295
32299
  const preprocessorWorkerControllerCache = new WeakMap();
32296
32300
  let alwaysFakeWorkerWorkerControllerCache;
@@ -51750,6 +51754,13 @@ function expandGlobIds(id, config) {
51750
51754
  ignore: ['node_modules'],
51751
51755
  })
51752
51756
  .map((filePath) => {
51757
+ // ensure "./" prefix for inconsistent fast-glob result
51758
+ // glob.sync("./some-dir/**/*") -> "./some-dir/some-file"
51759
+ // glob.sync("./**/*") -> "some-dir/some-file"
51760
+ if (exportsValue.startsWith('./') &&
51761
+ !filePath.startsWith('./')) {
51762
+ filePath = './' + filePath;
51763
+ }
51753
51764
  // "./glob/*": "./dist/glob/*-browser/*.js"
51754
51765
  // `filePath`: "./dist/glob/foo-browser/foo.js"
51755
51766
  // we need to revert the file path back to the export key by
@@ -64540,7 +64551,10 @@ async function _createServer(inlineConfig = {}, options) {
64540
64551
  return transformRequest(url, server, options);
64541
64552
  },
64542
64553
  async warmupRequest(url, options) {
64543
- await transformRequest(url, server, options).catch((e) => {
64554
+ try {
64555
+ await transformRequest(url, server, options);
64556
+ }
64557
+ catch (e) {
64544
64558
  if (e?.code === ERR_OUTDATED_OPTIMIZED_DEP ||
64545
64559
  e?.code === ERR_CLOSED_SERVER) {
64546
64560
  // these are expected errors
@@ -64551,7 +64565,7 @@ async function _createServer(inlineConfig = {}, options) {
64551
64565
  error: e,
64552
64566
  timestamp: true,
64553
64567
  });
64554
- });
64568
+ }
64555
64569
  },
64556
64570
  transformIndexHtml(url, html, originalUrl) {
64557
64571
  return devHtmlTransformFn(server, url, html, originalUrl);
@@ -66091,7 +66105,7 @@ function importAnalysisPlugin(config) {
66091
66105
  rewriteDone = true;
66092
66106
  }
66093
66107
  if (!rewriteDone) {
66094
- const rewrittenUrl = JSON.stringify(ssr ? url : partialEncodeURIPath(url));
66108
+ const rewrittenUrl = JSON.stringify(url);
66095
66109
  const s = isDynamicImport ? start : start - 1;
66096
66110
  const e = isDynamicImport ? end : end + 1;
66097
66111
  str().overwrite(s, e, rewrittenUrl, {
@@ -68445,7 +68459,7 @@ async function bundleConfigFile(fileName, isESM) {
68445
68459
  name: 'inject-file-scope-variables',
68446
68460
  setup(build) {
68447
68461
  build.onLoad({ filter: /\.[cm]?[jt]s$/ }, async (args) => {
68448
- const contents = await fsp.readFile(args.path, 'utf8');
68462
+ const contents = await fsp.readFile(args.path, 'utf-8');
68449
68463
  const injectValues = `const ${dirnameVarName} = ${JSON.stringify(path$o.dirname(args.path))};` +
68450
68464
  `const ${filenameVarName} = ${JSON.stringify(args.path)};` +
68451
68465
  `const ${importMetaUrlVarName} = ${JSON.stringify(pathToFileURL(args.path).href)};`;
@@ -1,4 +1,4 @@
1
- import { B as getDefaultExportFromCjs } from './dep-B-u6xNiR.js';
1
+ import { B as getDefaultExportFromCjs } from './dep-DJaaTb_D.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-B-u6xNiR.js';
5
+ import { A as colors, v as createLogger, r as resolveConfig } from './chunks/dep-DJaaTb_D.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-B-u6xNiR.js').then(function (n) { return n.E; });
760
+ const { createServer } = await import('./chunks/dep-DJaaTb_D.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-B-u6xNiR.js').then(function (n) { return n.F; });
839
+ const { build } = await import('./chunks/dep-DJaaTb_D.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-B-u6xNiR.js').then(function (n) { return n.D; });
866
+ const { optimizeDeps } = await import('./chunks/dep-DJaaTb_D.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-B-u6xNiR.js').then(function (n) { return n.G; });
892
+ const { preview } = await import('./chunks/dep-DJaaTb_D.js').then(function (n) { return n.G; });
893
893
  try {
894
894
  const server = await preview({
895
895
  root,
@@ -1,6 +1,6 @@
1
1
  export { parseAst, parseAstAsync } from 'rollup/parseAst';
2
- import { i as isInNodeModules, a as arraify } from './chunks/dep-B-u6xNiR.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-B-u6xNiR.js';
2
+ import { i as isInNodeModules, a as arraify } from './chunks/dep-DJaaTb_D.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-DJaaTb_D.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';
@@ -151,6 +151,11 @@ function upperBound(haystack, needle, index) {
151
151
  ;
152
152
  return index;
153
153
  }
154
+ function lowerBound(haystack, needle, index) {
155
+ for (let i = index - 1; i >= 0 && haystack[i][COLUMN] === needle; index = i--)
156
+ ;
157
+ return index;
158
+ }
154
159
  function memoizedBinarySearch(haystack, needle, state, key) {
155
160
  const { lastKey, lastNeedle, lastIndex } = state;
156
161
  let low = 0, high = haystack.length - 1;
@@ -161,7 +166,7 @@ function memoizedBinarySearch(haystack, needle, state, key) {
161
166
  }
162
167
  return state.lastKey = key, state.lastNeedle = needle, state.lastIndex = binarySearch(haystack, needle, low, high);
163
168
  }
164
- const LINE_GTR_ZERO = "`line` must be greater than 0 (lines start at line 1)", COL_GTR_EQ_ZERO = "`column` must be greater than or equal to 0 (columns start at column 0)";
169
+ const LINE_GTR_ZERO = "`line` must be greater than 0 (lines start at line 1)", COL_GTR_EQ_ZERO = "`column` must be greater than or equal to 0 (columns start at column 0)", LEAST_UPPER_BOUND = -1, GREATEST_LOWER_BOUND = 1;
165
170
  function cast(map) {
166
171
  return map;
167
172
  }
@@ -178,7 +183,7 @@ function originalPositionFor(map, needle) {
178
183
  const decoded = decodedMappings(map);
179
184
  if (line >= decoded.length)
180
185
  return OMapping(null, null, null, null);
181
- const segments = decoded[line], index = traceSegmentInternal(segments, map._decodedMemo, line, column);
186
+ const segments = decoded[line], index = traceSegmentInternal(segments, map._decodedMemo, line, column, bias || GREATEST_LOWER_BOUND);
182
187
  if (index === -1)
183
188
  return OMapping(null, null, null, null);
184
189
  const segment = segments[index];
@@ -192,7 +197,7 @@ function OMapping(source, line, column, name) {
192
197
  }
193
198
  function traceSegmentInternal(segments, memo, line, column, bias) {
194
199
  let index = memoizedBinarySearch(segments, column, memo, line);
195
- return found ? index = upperBound(segments, column, index) : index++, index === -1 || index === segments.length ? -1 : index;
200
+ return found ? index = (bias === LEAST_UPPER_BOUND ? upperBound : lowerBound)(segments, column, index) : bias === LEAST_UPPER_BOUND && index++, index === -1 || index === segments.length ? -1 : index;
196
201
  }
197
202
  class DecodedMap {
198
203
  map;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite",
3
- "version": "5.2.2",
3
+ "version": "5.2.4",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Evan You",