vite 7.0.0-beta.2 → 7.0.1

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,13 +1,5 @@
1
1
  /**
2
- * Plugins that use 'virtual modules' (e.g. for helper functions), prefix the
3
- * module ID with `\0`, a convention from the rollup ecosystem.
4
- * This prevents other plugins from trying to process the id (like node resolution),
5
- * and core features like sourcemaps can use this info to differentiate between
6
- * virtual modules and regular files.
7
- * `\0` is not a permitted char in import URLs so we have to replace them during
8
- * import analysis. The id will be decoded back before entering the plugins pipeline.
9
- * These encoded virtual ids are also prefixed by the VALID_ID_PREFIX, so virtual
10
- * modules in the browser end up encoded as `/@id/__x00__{id}`
2
+ * Prefix for resolved Ids that are not valid browser import specifiers
11
3
  */
12
4
  const VALID_ID_PREFIX = "/@id/", NULL_BYTE_PLACEHOLDER = "__x00__";
13
5
  let SOURCEMAPPING_URL = "sourceMa";
@@ -109,7 +101,7 @@ function toWindowsPath(path) {
109
101
  return path.replace(/\//g, "\\");
110
102
  }
111
103
  const comma = 44, semicolon = 59, chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", intToChar = new Uint8Array(64), charToInt = new Uint8Array(128);
112
- for (let i = 0; i < chars.length; i++) {
104
+ for (let i = 0; i < 64; i++) {
113
105
  let c = chars.charCodeAt(i);
114
106
  intToChar[i] = c, charToInt[c] = i;
115
107
  }
@@ -170,24 +162,7 @@ function sort(line) {
170
162
  function sortComparator(a, b) {
171
163
  return a[0] - b[0];
172
164
  }
173
- const COLUMN = 0, SOURCES_INDEX = 1, SOURCE_LINE = 2, SOURCE_COLUMN = 3, NAMES_INDEX = 4;
174
- let found = !1;
175
- /**
176
- * A binary search implementation that returns the index if a match is found.
177
- * If no match is found, then the left-index (the index associated with the item that comes just
178
- * before the desired index) is returned. To maintain proper sort order, a splice would happen at
179
- * the next index:
180
- *
181
- * ```js
182
- * const array = [1, 3];
183
- * const needle = 2;
184
- * const index = binarySearch(array, needle, (item, needle) => item - needle);
185
- *
186
- * assert.equal(index, 0);
187
- * array.splice(index + 1, 0, needle);
188
- * assert.deepEqual(array, [1, 2, 3]);
189
- * ```
190
- */
165
+ var COLUMN = 0, SOURCES_INDEX = 1, SOURCE_LINE = 2, SOURCE_COLUMN = 3, NAMES_INDEX = 4, found = !1;
191
166
  function binarySearch(haystack, needle, low, high) {
192
167
  for (; low <= high;) {
193
168
  let mid = low + (high - low >> 1), cmp = haystack[mid][COLUMN] - needle;
@@ -204,10 +179,6 @@ function lowerBound(haystack, needle, index) {
204
179
  for (let i = index - 1; i >= 0 && haystack[i][COLUMN] === needle; index = i--);
205
180
  return index;
206
181
  }
207
- /**
208
- * This overly complicated beast is just to record the last tested line/column and the resulting
209
- * index, allowing us to skip a few tests if mappings are monotonically increasing.
210
- */
211
182
  function memoizedBinarySearch(haystack, needle, state, key) {
212
183
  let { lastKey, lastNeedle, lastIndex } = state, low = 0, high = haystack.length - 1;
213
184
  if (key === lastKey) {
@@ -216,26 +187,14 @@ function memoizedBinarySearch(haystack, needle, state, key) {
216
187
  }
217
188
  return state.lastKey = key, state.lastNeedle = needle, state.lastIndex = binarySearch(haystack, needle, low, high);
218
189
  }
219
- 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;
220
- /**
221
- * Typescript doesn't allow friend access to private fields, so this just casts the map into a type
222
- * with public access modifiers.
223
- */
190
+ var 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;
224
191
  function cast(map) {
225
192
  return map;
226
193
  }
227
- /**
228
- * Returns the decoded (array of lines of segments) form of the SourceMap's mappings field.
229
- */
230
194
  function decodedMappings(map) {
231
195
  var _a;
232
196
  return (_a = cast(map))._decoded || (_a._decoded = decode(cast(map)._encoded));
233
197
  }
234
- /**
235
- * A higher-level API to find the source/line/column associated with a generated line/column
236
- * (think, from a stack trace). Line is 1-based, but column is 0-based, due to legacy behavior in
237
- * `source-map` library.
238
- */
239
198
  function originalPositionFor(map, needle) {
240
199
  let { line, column, bias } = needle;
241
200
  if (line--, line < 0) throw Error(LINE_GTR_ZERO);
@@ -286,7 +245,7 @@ function getOriginalPosition(map, needle) {
286
245
  let result = originalPositionFor(map, needle);
287
246
  return result.column == null ? null : result;
288
247
  }
289
- const MODULE_RUNNER_SOURCEMAPPING_REGEXP = RegExp(`//# ${SOURCEMAPPING_URL}=data:application/json;base64,(.+)`);
248
+ const MODULE_RUNNER_SOURCEMAPPING_REGEXP = /* @__PURE__ */ RegExp(`//# ${SOURCEMAPPING_URL}=data:application/json;base64,(.+)`);
290
249
  var EvaluatedModuleNode = class {
291
250
  importers = /* @__PURE__ */ new Set();
292
251
  imports = /* @__PURE__ */ new Set();
@@ -560,7 +519,7 @@ let urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzr
560
519
  };
561
520
  function reviveInvokeError(e) {
562
521
  let error = Error(e.message || "Unknown invoke error");
563
- return Object.assign(error, e, { runnerError: Error("RunnerError") }), error;
522
+ return Object.assign(error, e, { runnerError: /* @__PURE__ */ Error("RunnerError") }), error;
564
523
  }
565
524
  const createInvokeableTransport = (transport) => {
566
525
  if (transport.invoke) return {
@@ -604,7 +563,7 @@ const createInvokeableTransport = (transport) => {
604
563
  },
605
564
  disconnect() {
606
565
  return rpcPromises.forEach((promise) => {
607
- promise.reject(Error(`transport was disconnected, cannot call ${JSON.stringify(promise.name)}`));
566
+ promise.reject(/* @__PURE__ */ Error(`transport was disconnected, cannot call ${JSON.stringify(promise.name)}`));
608
567
  }), rpcPromises.clear(), transport.disconnect?.();
609
568
  },
610
569
  send(data) {
@@ -621,7 +580,7 @@ const createInvokeableTransport = (transport) => {
621
580
  }
622
581
  }, sendPromise = transport.send(wrappedData), { promise, resolve: resolve$1, reject } = promiseWithResolvers(), timeout = transport.timeout ?? 6e4, timeoutId;
623
582
  timeout > 0 && (timeoutId = setTimeout(() => {
624
- rpcPromises.delete(promiseId), reject(Error(`transport invoke timed out after ${timeout}ms (data: ${JSON.stringify(wrappedData)})`));
583
+ rpcPromises.delete(promiseId), reject(/* @__PURE__ */ Error(`transport invoke timed out after ${timeout}ms (data: ${JSON.stringify(wrappedData)})`));
625
584
  }, timeout), timeoutId?.unref?.()), rpcPromises.set(promiseId, {
626
585
  resolve: resolve$1,
627
586
  reject,
@@ -685,7 +644,7 @@ const createInvokeableTransport = (transport) => {
685
644
  isOpened = !0, resolve$1();
686
645
  }, { once: !0 }), socket.addEventListener("close", async () => {
687
646
  if (!isOpened) {
688
- reject(Error("WebSocket closed without opened."));
647
+ reject(/* @__PURE__ */ Error("WebSocket closed without opened."));
689
648
  return;
690
649
  }
691
650
  onMessage({
@@ -1179,4 +1138,4 @@ function exportAll(exports, sourceModule) {
1179
1138
  } catch {}
1180
1139
  }
1181
1140
  }
1182
- export { ESModulesEvaluator, EvaluatedModules, ModuleRunner, createWebSocketModuleRunnerTransport, ssrDynamicImportKey, ssrExportAllKey, ssrImportKey, ssrImportMetaKey, ssrModuleExportsKey };
1141
+ export { ESModulesEvaluator, EvaluatedModules, ModuleRunner, createWebSocketModuleRunnerTransport, normalizeModuleId, ssrDynamicImportKey, ssrExportAllKey, ssrExportNameKey, ssrImportKey, ssrImportMetaKey, ssrModuleExportsKey };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite",
3
- "version": "7.0.0-beta.2",
3
+ "version": "7.0.1",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Evan You",
@@ -71,7 +71,7 @@
71
71
  "esbuild": "^0.25.0",
72
72
  "fdir": "^6.4.6",
73
73
  "picomatch": "^4.0.2",
74
- "postcss": "^8.5.5",
74
+ "postcss": "^8.5.6",
75
75
  "rollup": "^4.40.0",
76
76
  "tinyglobby": "^0.2.14"
77
77
  },
@@ -80,15 +80,15 @@
80
80
  },
81
81
  "devDependencies": {
82
82
  "@ampproject/remapping": "^2.3.0",
83
- "@babel/parser": "^7.27.5",
84
- "@jridgewell/trace-mapping": "^0.3.25",
83
+ "@babel/parser": "^7.27.7",
84
+ "@jridgewell/trace-mapping": "^0.3.26",
85
85
  "@oxc-project/runtime": "^0.70.0",
86
86
  "@oxc-project/types": "^0.70.0",
87
87
  "@polka/compression": "^1.0.0-next.25",
88
88
  "@rollup/plugin-alias": "^5.1.1",
89
- "@rollup/plugin-commonjs": "^28.0.5",
89
+ "@rollup/plugin-commonjs": "^28.0.6",
90
90
  "@rollup/plugin-dynamic-import-vars": "2.1.4",
91
- "@rollup/pluginutils": "^5.1.4",
91
+ "@rollup/pluginutils": "^5.2.0",
92
92
  "@types/escape-html": "^1.0.4",
93
93
  "@types/pnpapi": "^0.0.5",
94
94
  "artichokie": "^0.3.1",
@@ -101,7 +101,7 @@
101
101
  "cross-spawn": "^7.0.6",
102
102
  "debug": "^4.4.1",
103
103
  "dep-types": "link:./src/types",
104
- "dotenv": "^16.5.0",
104
+ "dotenv": "^16.6.1",
105
105
  "dotenv-expand": "^12.0.2",
106
106
  "es-module-lexer": "^1.7.0",
107
107
  "escape-html": "^1.0.3",
@@ -120,23 +120,23 @@
120
120
  "pathe": "^2.0.3",
121
121
  "periscopic": "^4.0.2",
122
122
  "picocolors": "^1.1.1",
123
- "postcss-import": "^16.1.0",
123
+ "postcss-import": "^16.1.1",
124
124
  "postcss-load-config": "^6.0.1",
125
125
  "postcss-modules": "^6.0.1",
126
126
  "premove": "^4.0.0",
127
127
  "resolve.exports": "^2.0.3",
128
- "rolldown": "^1.0.0-beta.16",
129
- "rolldown-plugin-dts": "^0.13.11",
128
+ "rolldown": "^1.0.0-beta.21",
129
+ "rolldown-plugin-dts": "^0.13.13",
130
130
  "rollup-plugin-license": "^3.6.0",
131
131
  "sass": "^1.89.2",
132
132
  "sass-embedded": "^1.89.2",
133
133
  "sirv": "^3.0.1",
134
134
  "strip-literal": "^3.0.0",
135
- "terser": "^5.42.0",
135
+ "terser": "^5.43.1",
136
136
  "tsconfck": "^3.1.6",
137
137
  "types": "link:./types",
138
138
  "ufo": "^1.6.1",
139
- "ws": "^8.18.2"
139
+ "ws": "^8.18.3"
140
140
  },
141
141
  "peerDependencies": {
142
142
  "@types/node": "^20.19.0 || >=22.12.0",
@@ -36,6 +36,16 @@ export interface ImportGlobOptions<
36
36
 
37
37
  export type GeneralImportGlobOptions = ImportGlobOptions<boolean, string>
38
38
 
39
+ /**
40
+ * Declare Worker in case DOM is not added to the tsconfig lib causing
41
+ * Worker interface is not defined. For developers with DOM lib added,
42
+ * the Worker interface will be merged correctly.
43
+ */
44
+ declare global {
45
+ // eslint-disable-next-line @typescript-eslint/no-empty-object-type
46
+ interface Worker {}
47
+ }
48
+
39
49
  export interface KnownAsTypeMap {
40
50
  raw: string
41
51
  url: string
@@ -0,0 +1,11 @@
1
+ /* eslint-disable @typescript-eslint/ban-ts-comment */
2
+
3
+ // @ts-ignore `terser` may not be installed
4
+ export type * as Terser from 'terser'
5
+ // @ts-ignore `terser` may not be installed
6
+ import type * as Terser from 'terser'
7
+
8
+ /* eslint-enable @typescript-eslint/ban-ts-comment */
9
+
10
+ export type TerserMinifyOptions = Terser.MinifyOptions
11
+ export type TerserMinifyOutput = Terser.MinifyOutput