vite 5.1.6 → 5.2.0-beta.0

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,7 +1,7 @@
1
- import { B as getDefaultExportFromCjs } from './dep-jvB8WLp9.js';
1
+ import { B as getDefaultExportFromCjs } from './dep-BxRAmRCV.js';
2
2
  import require$$0 from 'path';
3
3
  import require$$0__default from 'fs';
4
- import { l as lib } from './dep-8a-6Quh6.js';
4
+ import { l as lib } from './dep-IQS-Za7F.js';
5
5
 
6
6
  import { fileURLToPath as __cjs_fileURLToPath } from 'node:url';
7
7
  import { dirname as __cjs_dirname } from 'node:path';
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-jvB8WLp9.js';
5
+ import { A as colors, v as createLogger, r as resolveConfig } from './chunks/dep-BxRAmRCV.js';
6
6
  import { VERSION } from './constants.js';
7
7
  import 'node:fs/promises';
8
8
  import 'node:url';
@@ -13,6 +13,7 @@ import 'path';
13
13
  import 'esbuild';
14
14
  import 'fs';
15
15
  import 'assert';
16
+ import 'node:child_process';
16
17
  import 'node:http';
17
18
  import 'node:https';
18
19
  import 'util';
@@ -23,7 +24,6 @@ import 'stream';
23
24
  import 'os';
24
25
  import 'child_process';
25
26
  import 'node:os';
26
- import 'node:child_process';
27
27
  import 'node:crypto';
28
28
  import 'node:dns';
29
29
  import 'crypto';
@@ -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-jvB8WLp9.js').then(function (n) { return n.E; });
760
+ const { createServer } = await import('./chunks/dep-BxRAmRCV.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-jvB8WLp9.js').then(function (n) { return n.F; });
839
+ const { build } = await import('./chunks/dep-BxRAmRCV.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-jvB8WLp9.js').then(function (n) { return n.D; });
866
+ const { optimizeDeps } = await import('./chunks/dep-BxRAmRCV.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-jvB8WLp9.js').then(function (n) { return n.G; });
892
+ const { preview } = await import('./chunks/dep-BxRAmRCV.js').then(function (n) { return n.G; });
893
893
  try {
894
894
  const server = await preview({
895
895
  root,
@@ -15,8 +15,8 @@ import * as url from 'node:url';
15
15
  import { URL } from 'node:url';
16
16
  import * as stream from 'node:stream';
17
17
  import { Duplex, DuplexOptions } from 'node:stream';
18
- import { F as FetchResult, H as HMRLogger } from './types.d-FdqQ54oU.js';
19
- export { a as FetchFunction } from './types.d-FdqQ54oU.js';
18
+ import { F as FetchResult, H as HMRLogger } from './types.d-aGj9QkWt.js';
19
+ export { a as FetchFunction } from './types.d-aGj9QkWt.js';
20
20
  import { SecureContextOptions } from 'node:tls';
21
21
  import { ZlibOptions } from 'node:zlib';
22
22
  import { HMRPayload, CustomPayload } from '../../types/hmrPayload.js';
@@ -3460,6 +3460,7 @@ interface ManifestChunk {
3460
3460
  css?: string[];
3461
3461
  assets?: string[];
3462
3462
  isEntry?: boolean;
3463
+ name?: string;
3463
3464
  isDynamicEntry?: boolean;
3464
3465
  imports?: string[];
3465
3466
  dynamicImports?: string[];
@@ -1,6 +1,6 @@
1
1
  export { parseAst, parseAstAsync } from 'rollup/parseAst';
2
- import { i as isInNodeModules, a as arraify } from './chunks/dep-jvB8WLp9.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-jvB8WLp9.js';
2
+ import { i as isInNodeModules, a as arraify } from './chunks/dep-BxRAmRCV.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-BxRAmRCV.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';
@@ -16,6 +16,7 @@ import 'path';
16
16
  import 'fs';
17
17
  import 'events';
18
18
  import 'assert';
19
+ import 'node:child_process';
19
20
  import 'node:http';
20
21
  import 'node:https';
21
22
  import 'util';
@@ -26,7 +27,6 @@ import 'stream';
26
27
  import 'os';
27
28
  import 'child_process';
28
29
  import 'node:os';
29
- import 'node:child_process';
30
30
  import 'node:crypto';
31
31
  import 'node:dns';
32
32
  import 'crypto';
@@ -1,5 +1,5 @@
1
- import { V as ViteRuntimeOptions, b as ViteModuleRunner, M as ModuleCacheMap, c as HMRClient, R as ResolvedResult, d as ViteRuntimeModuleContext } from './types.d-FdqQ54oU.js';
2
- export { a as FetchFunction, F as FetchResult, e as HMRConnection, H as HMRLogger, g as HMRRuntimeConnection, f as ModuleCache, S as SSRImportMetadata, h as ViteRuntimeImportMeta, s as ssrDynamicImportKey, i as ssrExportAllKey, j as ssrImportKey, k as ssrImportMetaKey, l as ssrModuleExportsKey } from './types.d-FdqQ54oU.js';
1
+ import { V as ViteRuntimeOptions, b as ViteModuleRunner, M as ModuleCacheMap, c as HMRClient, R as ResolvedResult, d as ViteRuntimeModuleContext } from './types.d-aGj9QkWt.js';
2
+ export { a as FetchFunction, F as FetchResult, e as HMRConnection, H as HMRLogger, g as HMRRuntimeConnection, f as ModuleCache, S as SSRImportMetadata, h as ViteRuntimeImportMeta, s as ssrDynamicImportKey, i as ssrExportAllKey, j as ssrImportKey, k as ssrImportMetaKey, l as ssrModuleExportsKey } from './types.d-aGj9QkWt.js';
3
3
  import '../../types/hot.js';
4
4
  import '../../types/hmrPayload.js';
5
5
  import '../../types/customEvent.js';
@@ -91,7 +91,7 @@ function posixPathToFileHref(posixPath) {
91
91
  function toWindowsPath(path) {
92
92
  return path.replace(/\//g, "\\");
93
93
  }
94
- const comma = ",".charCodeAt(0), chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", intToChar = new Uint8Array(64), charToInt = new Uint8Array(128);
94
+ const comma = 44, chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", intToChar = new Uint8Array(64), charToInt = new Uint8Array(128);
95
95
  for (let i = 0; i < chars.length; i++) {
96
96
  const c = chars.charCodeAt(i);
97
97
  intToChar[i] = c, charToInt[c] = i;
@@ -451,9 +451,12 @@ class HMRClient {
451
451
  // After an HMR update, some modules are no longer imported on the page
452
452
  // but they may have left behind side effects that need to be cleaned up
453
453
  // (.e.g style injections)
454
- // TODO Trigger their dispose callbacks.
455
- prunePaths(paths) {
456
- paths.forEach((path) => {
454
+ async prunePaths(paths) {
455
+ await Promise.all(paths.map((path) => {
456
+ const disposer = this.disposeMap.get(path);
457
+ if (disposer)
458
+ return disposer(this.dataMap.get(path));
459
+ })), paths.forEach((path) => {
457
460
  const fn = this.pruneMap.get(path);
458
461
  fn && fn(this.dataMap.get(path));
459
462
  });
@@ -561,7 +564,7 @@ async function handleHMRPayload(runtime, payload) {
561
564
  break;
562
565
  }
563
566
  case "prune":
564
- await hmrClient.notifyListeners("vite:beforePrune", payload), hmrClient.prunePaths(payload.paths);
567
+ await hmrClient.notifyListeners("vite:beforePrune", payload), await hmrClient.prunePaths(payload.paths);
565
568
  break;
566
569
  case "error": {
567
570
  await hmrClient.notifyListeners("vite:error", payload);
@@ -766,7 +769,7 @@ function wrapCallSite(frame, state) {
766
769
  state.curPosition = position, frame = cloneCallSite(frame);
767
770
  const originalFunctionName = frame.getFunctionName;
768
771
  return frame.getFunctionName = function() {
769
- const name = (() => state.nextPosition == null ? originalFunctionName() : state.nextPosition.name || originalFunctionName())();
772
+ const name = state.nextPosition == null ? originalFunctionName() : state.nextPosition.name || originalFunctionName();
770
773
  return name === "eval" && "_vite" in position ? null : name;
771
774
  }, frame.getFileName = function() {
772
775
  return position.source ?? void 0;
@@ -45,7 +45,7 @@ declare class HMRClient {
45
45
  constructor(logger: HMRLogger, connection: HMRConnection, importUpdatedModule: (update: Update) => Promise<ModuleNamespace>);
46
46
  notifyListeners<T extends string>(event: T, data: InferCustomEventPayload<T>): Promise<void>;
47
47
  clear(): void;
48
- prunePaths(paths: string[]): void;
48
+ prunePaths(paths: string[]): Promise<void>;
49
49
  protected warnFailedUpdate(err: Error, path: string | string[]): void;
50
50
  private updateQueue;
51
51
  private pendingUpdateQueue;