vite 5.1.5 → 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-G-px366b.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-G-px366b.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-G-px366b.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-G-px366b.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-G-px366b.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-G-px366b.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-AKzkD8vd.js';
19
- export { a as FetchFunction } from './types.d-AKzkD8vd.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';
@@ -1615,9 +1615,9 @@ interface ServerOptions extends CommonServerOptions {
1615
1615
  */
1616
1616
  sourcemapIgnoreList?: false | ((sourcePath: string, sourcemapPath: string) => boolean);
1617
1617
  }
1618
- interface ResolvedServerOptions extends ServerOptions {
1618
+ interface ResolvedServerOptions extends Omit<ServerOptions, 'fs' | 'middlewareMode' | 'sourcemapIgnoreList'> {
1619
1619
  fs: Required<FileSystemServeOptions>;
1620
- middlewareMode: boolean;
1620
+ middlewareMode: NonNullable<ServerOptions['middlewareMode']>;
1621
1621
  sourcemapIgnoreList: Exclude<ServerOptions['sourcemapIgnoreList'], false | undefined>;
1622
1622
  }
1623
1623
  interface FileSystemServeOptions {
@@ -3341,7 +3341,7 @@ interface LegacyOptions {
3341
3341
  }
3342
3342
  interface ResolvedWorkerOptions {
3343
3343
  format: 'es' | 'iife';
3344
- plugins: () => Promise<Plugin[]>;
3344
+ plugins: (bundleChain: string[]) => Promise<Plugin[]>;
3345
3345
  rollupOptions: RollupOptions;
3346
3346
  }
3347
3347
  interface InlineConfig extends UserConfig {
@@ -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-G-px366b.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-G-px366b.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-AKzkD8vd.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-AKzkD8vd.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';
@@ -1,13 +1,17 @@
1
1
  const VALID_ID_PREFIX = "/@id/", NULL_BYTE_PLACEHOLDER = "__x00__";
2
2
  let SOURCEMAPPING_URL = "sourceMa";
3
3
  SOURCEMAPPING_URL += "ppingURL";
4
- const VITE_RUNTIME_SOURCEMAPPING_URL = `${SOURCEMAPPING_URL}=data:application/json;charset=utf-8`, isWindows = typeof process < "u" && process.platform === "win32";
4
+ const isWindows = typeof process < "u" && process.platform === "win32";
5
5
  function wrapId(id) {
6
6
  return id.startsWith(VALID_ID_PREFIX) ? id : VALID_ID_PREFIX + id.replace("\0", NULL_BYTE_PLACEHOLDER);
7
7
  }
8
8
  function unwrapId(id) {
9
9
  return id.startsWith(VALID_ID_PREFIX) ? id.slice(VALID_ID_PREFIX.length).replace(NULL_BYTE_PLACEHOLDER, "\0") : id;
10
10
  }
11
+ const windowsSlashRE = /\\/g;
12
+ function slash(p) {
13
+ return p.replace(windowsSlashRE, "/");
14
+ }
11
15
  const postfixRE = /[?#].*$/;
12
16
  function cleanUrl(url) {
13
17
  return url.replace(postfixRE, "");
@@ -18,7 +22,8 @@ function isPrimitive(value) {
18
22
  function withTrailingSlash(path) {
19
23
  return path[path.length - 1] !== "/" ? `${path}/` : path;
20
24
  }
21
- const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
25
+ const AsyncFunction = async function() {
26
+ }.constructor, _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
22
27
  function normalizeWindowsPath(input = "") {
23
28
  return input && input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
24
29
  }
@@ -86,7 +91,7 @@ function posixPathToFileHref(posixPath) {
86
91
  function toWindowsPath(path) {
87
92
  return path.replace(/\//g, "\\");
88
93
  }
89
- 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);
90
95
  for (let i = 0; i < chars.length; i++) {
91
96
  const c = chars.charCodeAt(i);
92
97
  intToChar[i] = c, charToInt[c] = i;
@@ -215,7 +220,7 @@ function getOriginalPosition(map, needle) {
215
220
  const result = originalPositionFor(map, needle);
216
221
  return result.column == null ? null : result;
217
222
  }
218
- const VITE_RUNTIME_SOURCEMAPPING_REGEXP = new RegExp(`//# ${VITE_RUNTIME_SOURCEMAPPING_URL};base64,(.+)`);
223
+ const VITE_RUNTIME_SOURCEMAPPING_REGEXP = new RegExp(`//# ${SOURCEMAPPING_URL}=data:application/json;base64,(.+)`);
219
224
  class ModuleCacheMap extends Map {
220
225
  root;
221
226
  constructor(root, entries) {
@@ -321,7 +326,7 @@ const prefixedBuiltins = /* @__PURE__ */ new Set(["node:test"]);
321
326
  function normalizeModuleId(file, root) {
322
327
  if (prefixedBuiltins.has(file))
323
328
  return file;
324
- let unixFile = file.replace(/\\/g, "/").replace(/^\/@fs\//, isWindows ? "" : "/").replace(/^node:/, "").replace(/^\/+/, "/");
329
+ let unixFile = slash(file).replace(/^\/@fs\//, isWindows ? "" : "/").replace(/^node:/, "").replace(/^\/+/, "/");
325
330
  return unixFile.startsWith(root) && (unixFile = unixFile.slice(root.length - 1)), unixFile.replace(/^file:\//, "/");
326
331
  }
327
332
  class HMRContext {
@@ -446,9 +451,12 @@ class HMRClient {
446
451
  // After an HMR update, some modules are no longer imported on the page
447
452
  // but they may have left behind side effects that need to be cleaned up
448
453
  // (.e.g style injections)
449
- // TODO Trigger their dispose callbacks.
450
- prunePaths(paths) {
451
- 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) => {
452
460
  const fn = this.pruneMap.get(path);
453
461
  fn && fn(this.dataMap.get(path));
454
462
  });
@@ -493,6 +501,29 @@ class HMRClient {
493
501
  };
494
502
  }
495
503
  }
504
+ function analyzeImportedModDifference(mod, rawId, moduleType, metadata) {
505
+ if (!metadata?.isDynamicImport && moduleType !== "module" && metadata?.importedNames?.length) {
506
+ const missingBindings = metadata.importedNames.filter((s) => !(s in mod));
507
+ if (missingBindings.length) {
508
+ const lastBinding = missingBindings[missingBindings.length - 1];
509
+ throw new SyntaxError(`[vite] Named export '${lastBinding}' not found. The requested module '${rawId}' is a CommonJS module, which may not support all module.exports as named exports.
510
+ CommonJS modules can always be imported via the default export, for example using:
511
+
512
+ import pkg from '${rawId}';
513
+ const {${missingBindings.join(", ")}} = pkg;
514
+ `);
515
+ }
516
+ }
517
+ }
518
+ function proxyGuardOnlyEsm(mod, rawId, metadata) {
519
+ return metadata?.importedNames?.length ? new Proxy(mod, {
520
+ get(mod2, prop) {
521
+ if (prop !== "then" && !(prop in mod2))
522
+ throw new SyntaxError(`[vite] The requested module '${rawId}' does not provide an export named '${prop.toString()}'`);
523
+ return mod2[prop];
524
+ }
525
+ }) : mod;
526
+ }
496
527
  const ssrModuleExportsKey = "__vite_ssr_exports__", ssrImportKey = "__vite_ssr_import__", ssrDynamicImportKey = "__vite_ssr_dynamic_import__", ssrExportAllKey = "__vite_ssr_exportAll__", ssrImportMetaKey = "__vite_ssr_import_meta__", noop = () => {
497
528
  }, silentConsole = {
498
529
  debug: noop,
@@ -533,7 +564,7 @@ async function handleHMRPayload(runtime, payload) {
533
564
  break;
534
565
  }
535
566
  case "prune":
536
- await hmrClient.notifyListeners("vite:beforePrune", payload), hmrClient.prunePaths(payload.paths);
567
+ await hmrClient.notifyListeners("vite:beforePrune", payload), await hmrClient.prunePaths(payload.paths);
537
568
  break;
538
569
  case "error": {
539
570
  await hmrClient.notifyListeners("vite:error", payload);
@@ -575,22 +606,22 @@ const sourceMapCache = {}, fileContentsCache = {}, moduleGraphs = /* @__PURE__ *
575
606
  return result;
576
607
  }
577
608
  return null;
578
- }, retrieveFileFromHandlers = createExecHandlers(retrieveFileHandlers), retrievSourceMapFromHandlers = createExecHandlers(retrieveSourceMapHandlers);
579
- let overriden = !1;
609
+ }, retrieveFileFromHandlers = createExecHandlers(retrieveFileHandlers), retrieveSourceMapFromHandlers = createExecHandlers(retrieveSourceMapHandlers);
610
+ let overridden = !1;
580
611
  const originalPrepare = Error.prepareStackTrace;
581
612
  function resetInterceptor(runtime, options) {
582
- moduleGraphs.delete(runtime.moduleCache), options.retrieveFile && retrieveFileHandlers.delete(options.retrieveFile), options.retrieveSourceMap && retrieveSourceMapHandlers.delete(options.retrieveSourceMap), moduleGraphs.size === 0 && (Error.prepareStackTrace = originalPrepare, overriden = !1);
613
+ moduleGraphs.delete(runtime.moduleCache), options.retrieveFile && retrieveFileHandlers.delete(options.retrieveFile), options.retrieveSourceMap && retrieveSourceMapHandlers.delete(options.retrieveSourceMap), moduleGraphs.size === 0 && (Error.prepareStackTrace = originalPrepare, overridden = !1);
583
614
  }
584
615
  function interceptStackTrace(runtime, options = {}) {
585
- return overriden || (Error.prepareStackTrace = prepareStackTrace, overriden = !0), moduleGraphs.add(runtime.moduleCache), options.retrieveFile && retrieveFileHandlers.add(options.retrieveFile), options.retrieveSourceMap && retrieveSourceMapHandlers.add(options.retrieveSourceMap), () => resetInterceptor(runtime, options);
616
+ return overridden || (Error.prepareStackTrace = prepareStackTrace, overridden = !0), moduleGraphs.add(runtime.moduleCache), options.retrieveFile && retrieveFileHandlers.add(options.retrieveFile), options.retrieveSourceMap && retrieveSourceMapHandlers.add(options.retrieveSourceMap), () => resetInterceptor(runtime, options);
586
617
  }
587
618
  function supportRelativeURL(file, url) {
588
619
  if (!file)
589
620
  return url;
590
- const dir = posixDirname(file.replace(/\\/g, "/")), match = /^\w+:\/\/[^/]*/.exec(dir);
621
+ const dir = posixDirname(slash(file)), match = /^\w+:\/\/[^/]*/.exec(dir);
591
622
  let protocol = match ? match[0] : "";
592
623
  const startPath = dir.slice(protocol.length);
593
- return protocol && /^\/\w:/.test(startPath) ? (protocol += "/", protocol + posixResolve(dir.slice(protocol.length), url).replace(/\\/g, "/")) : protocol + posixResolve(dir.slice(protocol.length), url);
624
+ return protocol && /^\/\w:/.test(startPath) ? (protocol += "/", protocol + slash(posixResolve(startPath, url))) : protocol + posixResolve(startPath, url);
594
625
  }
595
626
  function getRuntimeSourceMap(position) {
596
627
  for (const moduleCache of moduleGraphs) {
@@ -622,7 +653,7 @@ function retrieveSourceMapURL(source) {
622
653
  }
623
654
  const reSourceMap = /^data:application\/json[^,]+base64,/;
624
655
  function retrieveSourceMap(source) {
625
- const urlAndMap = retrievSourceMapFromHandlers(source);
656
+ const urlAndMap = retrieveSourceMapFromHandlers(source);
626
657
  if (urlAndMap)
627
658
  return urlAndMap;
628
659
  let sourceMappingURL = retrieveSourceMapURL(source);
@@ -738,7 +769,7 @@ function wrapCallSite(frame, state) {
738
769
  state.curPosition = position, frame = cloneCallSite(frame);
739
770
  const originalFunctionName = frame.getFunctionName;
740
771
  return frame.getFunctionName = function() {
741
- const name = (() => state.nextPosition == null ? originalFunctionName() : state.nextPosition.name || originalFunctionName())();
772
+ const name = state.nextPosition == null ? originalFunctionName() : state.nextPosition.name || originalFunctionName();
742
773
  return name === "eval" && "_vite" in position ? null : name;
743
774
  }, frame.getFileName = function() {
744
775
  return position.source ?? void 0;
@@ -847,7 +878,7 @@ class ViteRuntime {
847
878
  normalizeEntryUrl(url) {
848
879
  if (url[0] === ".")
849
880
  return url;
850
- url.startsWith("file://") && (url = url.slice(isWindows ? 8 : 7)), url = url.replace(/\\/g, "/");
881
+ url.startsWith("file://") && (url = url.slice(isWindows ? 8 : 7)), url = slash(url);
851
882
  const _root = this.options.root, root = _root[_root.length - 1] === "/" ? _root : `${_root}/`;
852
883
  return url.startsWith(root) ? url.slice(root.length - 1) : url[0] === "/" ? url : wrapId(url);
853
884
  }
@@ -968,31 +999,6 @@ function exportAll(exports, sourceModule) {
968
999
  }
969
1000
  }
970
1001
  }
971
- function analyzeImportedModDifference(mod, rawId, moduleType, metadata) {
972
- if (!metadata?.isDynamicImport && moduleType !== "module" && metadata?.importedNames?.length) {
973
- const missingBindings = metadata.importedNames.filter((s) => !(s in mod));
974
- if (missingBindings.length) {
975
- const lastBinding = missingBindings[missingBindings.length - 1];
976
- throw new SyntaxError(`[vite] Named export '${lastBinding}' not found. The requested module '${rawId}' is a CommonJS module, which may not support all module.exports as named exports.
977
- CommonJS modules can always be imported via the default export, for example using:
978
-
979
- import pkg from '${rawId}';
980
- const {${missingBindings.join(", ")}} = pkg;
981
- `);
982
- }
983
- }
984
- }
985
- function proxyGuardOnlyEsm(mod, rawId, metadata) {
986
- return metadata?.importedNames?.length ? new Proxy(mod, {
987
- get(mod2, prop) {
988
- if (prop !== "then" && !(prop in mod2))
989
- throw new SyntaxError(`[vite] The requested module '${rawId}' does not provide an export named '${prop.toString()}'`);
990
- return mod2[prop];
991
- }
992
- }) : mod;
993
- }
994
- const AsyncFunction = async function() {
995
- }.constructor;
996
1002
  class ESModulesRunner {
997
1003
  async runViteModule(context, code) {
998
1004
  await new AsyncFunction(
@@ -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;
@@ -58,6 +58,22 @@ declare class HMRClient {
58
58
  private fetchUpdate;
59
59
  }
60
60
 
61
+ interface DefineImportMetadata {
62
+ /**
63
+ * Imported names before being transformed to `ssrImportKey`
64
+ *
65
+ * import foo, { bar as baz, qux } from 'hello'
66
+ * => ['default', 'bar', 'qux']
67
+ *
68
+ * import * as namespace from 'world
69
+ * => undefined
70
+ */
71
+ importedNames?: string[];
72
+ }
73
+ interface SSRImportBaseMetadata extends DefineImportMetadata {
74
+ isDynamicImport?: boolean;
75
+ }
76
+
61
77
  interface SourceMapLike {
62
78
  version: number;
63
79
  mappings?: string;
@@ -132,17 +148,8 @@ interface InterceptorOptions {
132
148
  retrieveSourceMap?: RetrieveSourceMapHandler;
133
149
  }
134
150
 
135
- interface DefineImportMetadata {
136
- /**
137
- * Imported names before being transformed to `ssrImportKey`
138
- *
139
- * import foo, { bar as baz, qux } from 'hello'
140
- * => ['default', 'bar', 'qux']
141
- *
142
- * import * as namespace from 'world
143
- * => undefined
144
- */
145
- importedNames?: string[];
151
+ interface SSRImportMetadata extends SSRImportBaseMetadata {
152
+ entrypoint?: boolean;
146
153
  }
147
154
  interface HMRRuntimeConnection extends HMRConnection {
148
155
  /**
@@ -151,10 +158,6 @@ interface HMRRuntimeConnection extends HMRConnection {
151
158
  */
152
159
  onUpdate(callback: (payload: HMRPayload) => void): void;
153
160
  }
154
- interface SSRImportMetadata extends DefineImportMetadata {
155
- isDynamicImport?: boolean;
156
- entrypoint?: boolean;
157
- }
158
161
  interface ViteRuntimeImportMeta extends ImportMeta {
159
162
  url: string;
160
163
  env: ImportMetaEnv;