vite 5.3.0-beta.1 → 5.3.0-beta.2

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.
@@ -2,114 +2,110 @@ import path, { resolve } from 'node:path';
2
2
  import { fileURLToPath } from 'node:url';
3
3
  import { readFileSync } from 'node:fs';
4
4
 
5
- const { version } = JSON.parse(readFileSync(new URL('../../package.json', import.meta.url)).toString());
5
+ const { version } = JSON.parse(
6
+ readFileSync(new URL("../../package.json", import.meta.url)).toString()
7
+ );
6
8
  const VERSION = version;
7
9
  const DEFAULT_MAIN_FIELDS = [
8
- 'browser',
9
- 'module',
10
- 'jsnext:main',
11
- 'jsnext',
10
+ "browser",
11
+ "module",
12
+ "jsnext:main",
13
+ // moment still uses this...
14
+ "jsnext"
12
15
  ];
13
- // Baseline support browserslist
14
- // "defaults and supports es6-module and supports es6-module-dynamic-import"
15
- // Higher browser versions may be needed for extra features.
16
16
  const ESBUILD_MODULES_TARGET = [
17
- 'es2020',
18
- 'edge88',
19
- 'firefox78',
20
- 'chrome87',
21
- 'safari14',
17
+ "es2020",
18
+ // support import.meta.url
19
+ "edge88",
20
+ "firefox78",
21
+ "chrome87",
22
+ "safari14"
22
23
  ];
23
24
  const DEFAULT_EXTENSIONS = [
24
- '.mjs',
25
- '.js',
26
- '.mts',
27
- '.ts',
28
- '.jsx',
29
- '.tsx',
30
- '.json',
25
+ ".mjs",
26
+ ".js",
27
+ ".mts",
28
+ ".ts",
29
+ ".jsx",
30
+ ".tsx",
31
+ ".json"
31
32
  ];
32
33
  const DEFAULT_CONFIG_FILES = [
33
- 'vite.config.js',
34
- 'vite.config.mjs',
35
- 'vite.config.ts',
36
- 'vite.config.cjs',
37
- 'vite.config.mts',
38
- 'vite.config.cts',
34
+ "vite.config.js",
35
+ "vite.config.mjs",
36
+ "vite.config.ts",
37
+ "vite.config.cjs",
38
+ "vite.config.mts",
39
+ "vite.config.cts"
39
40
  ];
40
41
  const JS_TYPES_RE = /\.(?:j|t)sx?$|\.mjs$/;
41
42
  const CSS_LANGS_RE = /\.(css|less|sass|scss|styl|stylus|pcss|postcss|sss)(?:$|\?)/;
42
43
  const OPTIMIZABLE_ENTRY_RE = /\.[cm]?[jt]s$/;
43
44
  const SPECIAL_QUERY_RE = /[?&](?:worker|sharedworker|raw|url)\b/;
44
- /**
45
- * Prefix for resolved fs paths, since windows paths may not be valid as URLs.
46
- */
47
45
  const FS_PREFIX = `/@fs/`;
48
46
  const CLIENT_PUBLIC_PATH = `/@vite/client`;
49
47
  const ENV_PUBLIC_PATH = `/@vite/env`;
50
48
  const VITE_PACKAGE_DIR = resolve(
51
- // import.meta.url is `dist/node/constants.js` after bundle
52
- fileURLToPath(import.meta.url), '../../..');
53
- const CLIENT_ENTRY = resolve(VITE_PACKAGE_DIR, 'dist/client/client.mjs');
54
- const ENV_ENTRY = resolve(VITE_PACKAGE_DIR, 'dist/client/env.mjs');
49
+ // import.meta.url is `dist/node/constants.js` after bundle
50
+ fileURLToPath(import.meta.url),
51
+ "../../.."
52
+ );
53
+ const CLIENT_ENTRY = resolve(VITE_PACKAGE_DIR, "dist/client/client.mjs");
54
+ const ENV_ENTRY = resolve(VITE_PACKAGE_DIR, "dist/client/env.mjs");
55
55
  const CLIENT_DIR = path.dirname(CLIENT_ENTRY);
56
- // ** READ THIS ** before editing `KNOWN_ASSET_TYPES`.
57
- // If you add an asset to `KNOWN_ASSET_TYPES`, make sure to also add it
58
- // to the TypeScript declaration file `packages/vite/client.d.ts` and
59
- // add a mime type to the `registerCustomMime` in
60
- // `packages/vite/src/node/plugin/assets.ts` if mime type cannot be
61
- // looked up by mrmime.
62
56
  const KNOWN_ASSET_TYPES = [
63
- // images
64
- 'apng',
65
- 'png',
66
- 'jpe?g',
67
- 'jfif',
68
- 'pjpeg',
69
- 'pjp',
70
- 'gif',
71
- 'svg',
72
- 'ico',
73
- 'webp',
74
- 'avif',
75
- // media
76
- 'mp4',
77
- 'webm',
78
- 'ogg',
79
- 'mp3',
80
- 'wav',
81
- 'flac',
82
- 'aac',
83
- 'opus',
84
- 'mov',
85
- 'm4a',
86
- 'vtt',
87
- // fonts
88
- 'woff2?',
89
- 'eot',
90
- 'ttf',
91
- 'otf',
92
- // other
93
- 'webmanifest',
94
- 'pdf',
95
- 'txt',
57
+ // images
58
+ "apng",
59
+ "png",
60
+ "jpe?g",
61
+ "jfif",
62
+ "pjpeg",
63
+ "pjp",
64
+ "gif",
65
+ "svg",
66
+ "ico",
67
+ "webp",
68
+ "avif",
69
+ // media
70
+ "mp4",
71
+ "webm",
72
+ "ogg",
73
+ "mp3",
74
+ "wav",
75
+ "flac",
76
+ "aac",
77
+ "opus",
78
+ "mov",
79
+ "m4a",
80
+ "vtt",
81
+ // fonts
82
+ "woff2?",
83
+ "eot",
84
+ "ttf",
85
+ "otf",
86
+ // other
87
+ "webmanifest",
88
+ "pdf",
89
+ "txt"
96
90
  ];
97
- const DEFAULT_ASSETS_RE = new RegExp(`\\.(` + KNOWN_ASSET_TYPES.join('|') + `)(\\?.*)?$`);
91
+ const DEFAULT_ASSETS_RE = new RegExp(
92
+ `\\.(` + KNOWN_ASSET_TYPES.join("|") + `)(\\?.*)?$`
93
+ );
98
94
  const DEP_VERSION_RE = /[?&](v=[\w.-]+)\b/;
99
- const loopbackHosts = new Set([
100
- 'localhost',
101
- '127.0.0.1',
102
- '::1',
103
- '0000:0000:0000:0000:0000:0000:0000:0001',
95
+ const loopbackHosts = /* @__PURE__ */ new Set([
96
+ "localhost",
97
+ "127.0.0.1",
98
+ "::1",
99
+ "0000:0000:0000:0000:0000:0000:0000:0001"
104
100
  ]);
105
- const wildcardHosts = new Set([
106
- '0.0.0.0',
107
- '::',
108
- '0000:0000:0000:0000:0000:0000:0000:0000',
101
+ const wildcardHosts = /* @__PURE__ */ new Set([
102
+ "0.0.0.0",
103
+ "::",
104
+ "0000:0000:0000:0000:0000:0000:0000:0000"
109
105
  ]);
110
106
  const DEFAULT_DEV_PORT = 5173;
111
107
  const DEFAULT_PREVIEW_PORT = 4173;
112
108
  const DEFAULT_ASSETS_INLINE_LIMIT = 4096;
113
- const METADATA_FILENAME = '_metadata.json';
109
+ const METADATA_FILENAME = "_metadata.json";
114
110
 
115
111
  export { CLIENT_DIR, CLIENT_ENTRY, CLIENT_PUBLIC_PATH, CSS_LANGS_RE, DEFAULT_ASSETS_INLINE_LIMIT, DEFAULT_ASSETS_RE, DEFAULT_CONFIG_FILES, DEFAULT_DEV_PORT, DEFAULT_EXTENSIONS, DEFAULT_MAIN_FIELDS, DEFAULT_PREVIEW_PORT, DEP_VERSION_RE, ENV_ENTRY, ENV_PUBLIC_PATH, ESBUILD_MODULES_TARGET, FS_PREFIX, JS_TYPES_RE, KNOWN_ASSET_TYPES, METADATA_FILENAME, OPTIMIZABLE_ENTRY_RE, SPECIAL_QUERY_RE, VERSION, VITE_PACKAGE_DIR, loopbackHosts, wildcardHosts };
@@ -2886,6 +2886,7 @@ type LightningCSSOptions = {
2886
2886
  pseudoClasses?: PseudoClasses
2887
2887
  unusedSymbols?: string[]
2888
2888
  cssModules?: CSSModulesConfig
2889
+ errorRecovery?: boolean
2889
2890
  }
2890
2891
 
2891
2892
  interface CSSOptions {
@@ -1,6 +1,6 @@
1
1
  export { parseAst, parseAstAsync } from 'rollup/parseAst';
2
- import { i as isInNodeModules, a as arraify } from './chunks/dep-Dz0We6of.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-Dz0We6of.js';
2
+ import { i as isInNodeModules, a as arraify } from './chunks/dep-DxsHXWQ1.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-DxsHXWQ1.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';
@@ -14,13 +14,15 @@ import 'node:module';
14
14
  import 'tty';
15
15
  import 'path';
16
16
  import 'fs';
17
- import 'events';
18
- import 'assert';
17
+ import 'node:events';
18
+ import 'node:stream';
19
+ import 'node:string_decoder';
19
20
  import 'node:child_process';
20
21
  import 'node:http';
21
22
  import 'node:https';
22
23
  import 'util';
23
24
  import 'net';
25
+ import 'events';
24
26
  import 'url';
25
27
  import 'http';
26
28
  import 'stream';
@@ -35,238 +37,224 @@ import 'node:assert';
35
37
  import 'node:v8';
36
38
  import 'node:worker_threads';
37
39
  import 'node:buffer';
38
- import 'node:events';
39
40
  import 'querystring';
40
41
  import 'node:readline';
41
42
  import 'zlib';
42
43
  import 'buffer';
43
44
  import 'https';
44
45
  import 'tls';
46
+ import 'assert';
45
47
  import 'node:zlib';
46
48
 
47
- // This file will be built for both ESM and CJS. Avoid relying on other modules as possible.
48
- // copy from constants.ts
49
- const CSS_LANGS_RE =
50
- // eslint-disable-next-line regexp/no-unused-capturing-group
51
- /\.(css|less|sass|scss|styl|stylus|pcss|postcss|sss)(?:$|\?)/;
49
+ const CSS_LANGS_RE = (
50
+ // eslint-disable-next-line regexp/no-unused-capturing-group
51
+ /\.(css|less|sass|scss|styl|stylus|pcss|postcss|sss)(?:$|\?)/
52
+ );
52
53
  const isCSSRequest = (request) => CSS_LANGS_RE.test(request);
53
- // Use splitVendorChunkPlugin() to get the same manualChunks strategy as Vite 2.7
54
- // We don't recommend using this strategy as a general solution moving forward
55
- // splitVendorChunk is a simple index/vendor strategy that was used in Vite
56
- // until v2.8. It is exposed to let people continue to use it in case it was
57
- // working well for their setups.
58
- // The cache needs to be reset on buildStart for watch mode to work correctly
59
- // Don't use this manualChunks strategy for ssr, lib mode, and 'umd' or 'iife'
60
- /**
61
- * @deprecated use build.rollupOptions.output.manualChunks or framework specific configuration
62
- */
63
54
  class SplitVendorChunkCache {
64
- cache;
65
- constructor() {
66
- this.cache = new Map();
67
- }
68
- reset() {
69
- this.cache = new Map();
70
- }
55
+ cache;
56
+ constructor() {
57
+ this.cache = /* @__PURE__ */ new Map();
58
+ }
59
+ reset() {
60
+ this.cache = /* @__PURE__ */ new Map();
61
+ }
71
62
  }
72
- /**
73
- * @deprecated use build.rollupOptions.output.manualChunks or framework specific configuration
74
- */
75
63
  function splitVendorChunk(options = {}) {
76
- const cache = options.cache ?? new SplitVendorChunkCache();
77
- return (id, { getModuleInfo }) => {
78
- if (isInNodeModules(id) &&
79
- !isCSSRequest(id) &&
80
- staticImportedByEntry(id, getModuleInfo, cache.cache)) {
81
- return 'vendor';
82
- }
83
- };
64
+ const cache = options.cache ?? new SplitVendorChunkCache();
65
+ return (id, { getModuleInfo }) => {
66
+ if (isInNodeModules(id) && !isCSSRequest(id) && staticImportedByEntry(id, getModuleInfo, cache.cache)) {
67
+ return "vendor";
68
+ }
69
+ };
84
70
  }
85
71
  function staticImportedByEntry(id, getModuleInfo, cache, importStack = []) {
86
- if (cache.has(id)) {
87
- return cache.get(id);
88
- }
89
- if (importStack.includes(id)) {
90
- // circular deps!
91
- cache.set(id, false);
92
- return false;
93
- }
94
- const mod = getModuleInfo(id);
95
- if (!mod) {
96
- cache.set(id, false);
97
- return false;
98
- }
99
- if (mod.isEntry) {
100
- cache.set(id, true);
101
- return true;
102
- }
103
- const someImporterIs = mod.importers.some((importer) => staticImportedByEntry(importer, getModuleInfo, cache, importStack.concat(id)));
104
- cache.set(id, someImporterIs);
105
- return someImporterIs;
72
+ if (cache.has(id)) {
73
+ return cache.get(id);
74
+ }
75
+ if (importStack.includes(id)) {
76
+ cache.set(id, false);
77
+ return false;
78
+ }
79
+ const mod = getModuleInfo(id);
80
+ if (!mod) {
81
+ cache.set(id, false);
82
+ return false;
83
+ }
84
+ if (mod.isEntry) {
85
+ cache.set(id, true);
86
+ return true;
87
+ }
88
+ const someImporterIs = mod.importers.some(
89
+ (importer) => staticImportedByEntry(
90
+ importer,
91
+ getModuleInfo,
92
+ cache,
93
+ importStack.concat(id)
94
+ )
95
+ );
96
+ cache.set(id, someImporterIs);
97
+ return someImporterIs;
106
98
  }
107
- /**
108
- * @deprecated use build.rollupOptions.output.manualChunks or framework specific configuration
109
- */
110
99
  function splitVendorChunkPlugin() {
111
- const caches = [];
112
- function createSplitVendorChunk(output, config) {
113
- const cache = new SplitVendorChunkCache();
114
- caches.push(cache);
115
- const build = config.build ?? {};
116
- const format = output?.format;
117
- if (!build.ssr && !build.lib && format !== 'umd' && format !== 'iife') {
118
- return splitVendorChunk({ cache });
119
- }
100
+ const caches = [];
101
+ function createSplitVendorChunk(output, config) {
102
+ const cache = new SplitVendorChunkCache();
103
+ caches.push(cache);
104
+ const build = config.build ?? {};
105
+ const format = output?.format;
106
+ if (!build.ssr && !build.lib && format !== "umd" && format !== "iife") {
107
+ return splitVendorChunk({ cache });
120
108
  }
121
- return {
122
- name: 'vite:split-vendor-chunk',
123
- config(config) {
124
- let outputs = config?.build?.rollupOptions?.output;
125
- if (outputs) {
126
- outputs = arraify(outputs);
127
- for (const output of outputs) {
128
- const viteManualChunks = createSplitVendorChunk(output, config);
129
- if (viteManualChunks) {
130
- if (output.manualChunks) {
131
- if (typeof output.manualChunks === 'function') {
132
- const userManualChunks = output.manualChunks;
133
- output.manualChunks = (id, api) => {
134
- return userManualChunks(id, api) ?? viteManualChunks(id, api);
135
- };
136
- }
137
- else {
138
- // else, leave the object form of manualChunks untouched, as
139
- // we can't safely replicate rollup handling.
140
- // eslint-disable-next-line no-console
141
- console.warn("(!) the `splitVendorChunk` plugin doesn't have any effect when using the object form of `build.rollupOptions.output.manualChunks`. Consider using the function form instead.");
142
- }
143
- }
144
- else {
145
- output.manualChunks = viteManualChunks;
146
- }
147
- }
148
- }
149
- }
150
- else {
151
- return {
152
- build: {
153
- rollupOptions: {
154
- output: {
155
- manualChunks: createSplitVendorChunk({}, config),
156
- },
157
- },
158
- },
109
+ }
110
+ return {
111
+ name: "vite:split-vendor-chunk",
112
+ config(config) {
113
+ let outputs = config?.build?.rollupOptions?.output;
114
+ if (outputs) {
115
+ outputs = arraify(outputs);
116
+ for (const output of outputs) {
117
+ const viteManualChunks = createSplitVendorChunk(output, config);
118
+ if (viteManualChunks) {
119
+ if (output.manualChunks) {
120
+ if (typeof output.manualChunks === "function") {
121
+ const userManualChunks = output.manualChunks;
122
+ output.manualChunks = (id, api) => {
123
+ return userManualChunks(id, api) ?? viteManualChunks(id, api);
159
124
  };
125
+ } else {
126
+ console.warn(
127
+ "(!) the `splitVendorChunk` plugin doesn't have any effect when using the object form of `build.rollupOptions.output.manualChunks`. Consider using the function form instead."
128
+ );
129
+ }
130
+ } else {
131
+ output.manualChunks = viteManualChunks;
132
+ }
133
+ }
134
+ }
135
+ } else {
136
+ return {
137
+ build: {
138
+ rollupOptions: {
139
+ output: {
140
+ manualChunks: createSplitVendorChunk({}, config)
141
+ }
160
142
  }
161
- },
162
- buildStart() {
163
- caches.forEach((cache) => cache.reset());
164
- },
165
- };
143
+ }
144
+ };
145
+ }
146
+ },
147
+ buildStart() {
148
+ caches.forEach((cache) => cache.reset());
149
+ }
150
+ };
166
151
  }
167
152
 
168
153
  class ServerHMRBroadcasterClient {
169
- hmrChannel;
170
- constructor(hmrChannel) {
171
- this.hmrChannel = hmrChannel;
154
+ constructor(hmrChannel) {
155
+ this.hmrChannel = hmrChannel;
156
+ }
157
+ send(...args) {
158
+ let payload;
159
+ if (typeof args[0] === "string") {
160
+ payload = {
161
+ type: "custom",
162
+ event: args[0],
163
+ data: args[1]
164
+ };
165
+ } else {
166
+ payload = args[0];
172
167
  }
173
- send(...args) {
174
- let payload;
175
- if (typeof args[0] === 'string') {
176
- payload = {
177
- type: 'custom',
178
- event: args[0],
179
- data: args[1],
180
- };
181
- }
182
- else {
183
- payload = args[0];
184
- }
185
- if (payload.type !== 'custom') {
186
- throw new Error('Cannot send non-custom events from the client to the server.');
187
- }
188
- this.hmrChannel.send(payload);
168
+ if (payload.type !== "custom") {
169
+ throw new Error(
170
+ "Cannot send non-custom events from the client to the server."
171
+ );
189
172
  }
173
+ this.hmrChannel.send(payload);
174
+ }
190
175
  }
191
- /**
192
- * The connector class to establish HMR communication between the server and the Vite runtime.
193
- * @experimental
194
- */
195
176
  class ServerHMRConnector {
196
- handlers = [];
197
- hmrChannel;
198
- hmrClient;
199
- connected = false;
200
- constructor(server) {
201
- const hmrChannel = server.hot?.channels.find((c) => c.name === 'ssr');
202
- if (!hmrChannel) {
203
- throw new Error("Your version of Vite doesn't support HMR during SSR. Please, use Vite 5.1 or higher.");
204
- }
205
- this.hmrClient = new ServerHMRBroadcasterClient(hmrChannel);
206
- hmrChannel.api.outsideEmitter.on('send', (payload) => {
207
- this.handlers.forEach((listener) => listener(payload));
208
- });
209
- this.hmrChannel = hmrChannel;
210
- }
211
- isReady() {
212
- return this.connected;
213
- }
214
- send(message) {
215
- const payload = JSON.parse(message);
216
- this.hmrChannel.api.innerEmitter.emit(payload.event, payload.data, this.hmrClient);
217
- }
218
- onUpdate(handler) {
219
- this.handlers.push(handler);
220
- handler({ type: 'connected' });
221
- this.connected = true;
177
+ handlers = [];
178
+ hmrChannel;
179
+ hmrClient;
180
+ connected = false;
181
+ constructor(server) {
182
+ const hmrChannel = server.hot?.channels.find(
183
+ (c) => c.name === "ssr"
184
+ );
185
+ if (!hmrChannel) {
186
+ throw new Error(
187
+ "Your version of Vite doesn't support HMR during SSR. Please, use Vite 5.1 or higher."
188
+ );
222
189
  }
190
+ this.hmrClient = new ServerHMRBroadcasterClient(hmrChannel);
191
+ hmrChannel.api.outsideEmitter.on("send", (payload) => {
192
+ this.handlers.forEach((listener) => listener(payload));
193
+ });
194
+ this.hmrChannel = hmrChannel;
195
+ }
196
+ isReady() {
197
+ return this.connected;
198
+ }
199
+ send(message) {
200
+ const payload = JSON.parse(message);
201
+ this.hmrChannel.api.innerEmitter.emit(
202
+ payload.event,
203
+ payload.data,
204
+ this.hmrClient
205
+ );
206
+ }
207
+ onUpdate(handler) {
208
+ this.handlers.push(handler);
209
+ handler({ type: "connected" });
210
+ this.connected = true;
211
+ }
223
212
  }
224
213
 
225
214
  function createHMROptions(server, options) {
226
- if (server.config.server.hmr === false || options.hmr === false) {
227
- return false;
228
- }
229
- const connection = new ServerHMRConnector(server);
230
- return {
231
- connection,
232
- logger: options.hmr?.logger,
233
- };
215
+ if (server.config.server.hmr === false || options.hmr === false) {
216
+ return false;
217
+ }
218
+ const connection = new ServerHMRConnector(server);
219
+ return {
220
+ connection,
221
+ logger: options.hmr?.logger
222
+ };
234
223
  }
235
224
  const prepareStackTrace = {
236
- retrieveFile(id) {
237
- if (existsSync(id)) {
238
- return readFileSync(id, 'utf-8');
239
- }
240
- },
225
+ retrieveFile(id) {
226
+ if (existsSync(id)) {
227
+ return readFileSync(id, "utf-8");
228
+ }
229
+ }
241
230
  };
242
231
  function resolveSourceMapOptions(options) {
243
- if (options.sourcemapInterceptor != null) {
244
- if (options.sourcemapInterceptor === 'prepareStackTrace') {
245
- return prepareStackTrace;
246
- }
247
- if (typeof options.sourcemapInterceptor === 'object') {
248
- return { ...prepareStackTrace, ...options.sourcemapInterceptor };
249
- }
250
- return options.sourcemapInterceptor;
232
+ if (options.sourcemapInterceptor != null) {
233
+ if (options.sourcemapInterceptor === "prepareStackTrace") {
234
+ return prepareStackTrace;
251
235
  }
252
- if (typeof process !== 'undefined' && 'setSourceMapsEnabled' in process) {
253
- return 'node';
236
+ if (typeof options.sourcemapInterceptor === "object") {
237
+ return { ...prepareStackTrace, ...options.sourcemapInterceptor };
254
238
  }
255
- return prepareStackTrace;
239
+ return options.sourcemapInterceptor;
240
+ }
241
+ if (typeof process !== "undefined" && "setSourceMapsEnabled" in process) {
242
+ return "node";
243
+ }
244
+ return prepareStackTrace;
256
245
  }
257
- /**
258
- * Create an instance of the Vite SSR runtime that support HMR.
259
- * @experimental
260
- */
261
246
  async function createViteRuntime(server, options = {}) {
262
- const hmr = createHMROptions(server, options);
263
- return new ViteRuntime({
264
- ...options,
265
- root: server.config.root,
266
- fetchModule: server.ssrFetchModule,
267
- hmr,
268
- sourcemapInterceptor: resolveSourceMapOptions(options),
269
- }, options.runner || new ESModulesRunner());
247
+ const hmr = createHMROptions(server, options);
248
+ return new ViteRuntime(
249
+ {
250
+ ...options,
251
+ root: server.config.root,
252
+ fetchModule: server.ssrFetchModule,
253
+ hmr,
254
+ sourcemapInterceptor: resolveSourceMapOptions(options)
255
+ },
256
+ options.runner || new ESModulesRunner()
257
+ );
270
258
  }
271
259
 
272
260
  export { ServerHMRConnector, createViteRuntime, isCSSRequest, splitVendorChunk, splitVendorChunkPlugin };