vite 8.0.0-beta.7 → 8.0.0-beta.9

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.
@@ -254,36 +254,36 @@ function getTimeFormatter() {
254
254
  function createLogger(level = "info", options = {}) {
255
255
  if (options.customLogger) return options.customLogger;
256
256
  const loggedErrors = /* @__PURE__ */ new WeakSet();
257
- const { prefix = "[vite]", allowClearScreen = true, console: console$1 = globalThis.console } = options;
257
+ const { prefix = "[vite]", allowClearScreen = true, console = globalThis.console } = options;
258
258
  const thresh = LogLevels[level];
259
259
  const canClearScreen = allowClearScreen && process.stdout.isTTY && !process.env.CI;
260
260
  const clear = canClearScreen ? clearScreen : () => {};
261
- function format(type, msg, options$1 = {}) {
262
- if (options$1.timestamp) {
261
+ function format(type, msg, options = {}) {
262
+ if (options.timestamp) {
263
263
  let tag = "";
264
264
  if (type === "info") tag = import_picocolors.default.cyan(import_picocolors.default.bold(prefix));
265
265
  else if (type === "warn") tag = import_picocolors.default.yellow(import_picocolors.default.bold(prefix));
266
266
  else tag = import_picocolors.default.red(import_picocolors.default.bold(prefix));
267
- const environment = options$1.environment ? options$1.environment + " " : "";
267
+ const environment = options.environment ? options.environment + " " : "";
268
268
  return `${import_picocolors.default.dim(getTimeFormatter().format(/* @__PURE__ */ new Date()))} ${tag} ${environment}${msg}`;
269
269
  } else return msg;
270
270
  }
271
- function output(type, msg, options$1 = {}) {
271
+ function output(type, msg, options = {}) {
272
272
  if (thresh >= LogLevels[type]) {
273
273
  const method = type === "info" ? "log" : type;
274
- if (options$1.error) loggedErrors.add(options$1.error);
274
+ if (options.error) loggedErrors.add(options.error);
275
275
  if (canClearScreen) if (type === lastType && msg === lastMsg) {
276
276
  sameCount++;
277
277
  clear();
278
- console$1[method](format(type, msg, options$1), import_picocolors.default.yellow(`(x${sameCount + 1})`));
278
+ console[method](format(type, msg, options), import_picocolors.default.yellow(`(x${sameCount + 1})`));
279
279
  } else {
280
280
  sameCount = 0;
281
281
  lastMsg = msg;
282
282
  lastType = type;
283
- if (options$1.clear) clear();
284
- console$1[method](format(type, msg, options$1));
283
+ if (options.clear) clear();
284
+ console[method](format(type, msg, options));
285
285
  }
286
- else console$1[method](format(type, msg, options$1));
286
+ else console[method](format(type, msg, options));
287
287
  }
288
288
  }
289
289
  const warnedMessages = /* @__PURE__ */ new Set();
@@ -316,9 +316,9 @@ function createLogger(level = "info", options = {}) {
316
316
  return logger;
317
317
  }
318
318
  function printServerUrls(urls, optionsHost, info) {
319
- const colorUrl = (url$1) => import_picocolors.default.cyan(url$1.replace(/:(\d+)\//, (_, port) => `:${import_picocolors.default.bold(port)}/`));
320
- for (const url$1 of urls.local) info(` ${import_picocolors.default.green("➜")} ${import_picocolors.default.bold("Local")}: ${colorUrl(url$1)}`);
321
- for (const url$1 of urls.network) info(` ${import_picocolors.default.green("➜")} ${import_picocolors.default.bold("Network")}: ${colorUrl(url$1)}`);
319
+ const colorUrl = (url) => import_picocolors.default.cyan(url.replace(/:(\d+)\//, (_, port) => `:${import_picocolors.default.bold(port)}/`));
320
+ for (const url of urls.local) info(` ${import_picocolors.default.green("➜")} ${import_picocolors.default.bold("Local")}: ${colorUrl(url)}`);
321
+ for (const url of urls.network) info(` ${import_picocolors.default.green("➜")} ${import_picocolors.default.bold("Network")}: ${colorUrl(url)}`);
322
322
  if (urls.network.length === 0 && optionsHost === void 0) info(import_picocolors.default.dim(` ${import_picocolors.default.green("➜")} ${import_picocolors.default.bold("Network")}: use `) + import_picocolors.default.bold("--host") + import_picocolors.default.dim(" to expose"));
323
323
  }
324
324
 
@@ -8,47 +8,47 @@ interface FetchFunctionOptions {
8
8
  type FetchResult = CachedFetchResult | ExternalFetchResult | ViteFetchResult;
9
9
  interface CachedFetchResult {
10
10
  /**
11
- * If module cached in the runner, we can just confirm
12
- * it wasn't invalidated on the server side.
13
- */
11
+ * If module cached in the runner, we can just confirm
12
+ * it wasn't invalidated on the server side.
13
+ */
14
14
  cache: true;
15
15
  }
16
16
  interface ExternalFetchResult {
17
17
  /**
18
- * The path to the externalized module starting with file://,
19
- * by default this will be imported via a dynamic "import"
20
- * instead of being transformed by vite and loaded with vite runner
21
- */
18
+ * The path to the externalized module starting with file://,
19
+ * by default this will be imported via a dynamic "import"
20
+ * instead of being transformed by vite and loaded with vite runner
21
+ */
22
22
  externalize: string;
23
23
  /**
24
- * Type of the module. Will be used to determine if import statement is correct.
25
- * For example, if Vite needs to throw an error if variable is not actually exported
26
- */
24
+ * Type of the module. Will be used to determine if import statement is correct.
25
+ * For example, if Vite needs to throw an error if variable is not actually exported
26
+ */
27
27
  type: "module" | "commonjs" | "builtin" | "network";
28
28
  }
29
29
  interface ViteFetchResult {
30
30
  /**
31
- * Code that will be evaluated by vite runner
32
- * by default this will be wrapped in an async function
33
- */
31
+ * Code that will be evaluated by vite runner
32
+ * by default this will be wrapped in an async function
33
+ */
34
34
  code: string;
35
35
  /**
36
- * File path of the module on disk.
37
- * This will be resolved as import.meta.url/filename
38
- * Will be equal to `null` for virtual modules
39
- */
36
+ * File path of the module on disk.
37
+ * This will be resolved as import.meta.url/filename
38
+ * Will be equal to `null` for virtual modules
39
+ */
40
40
  file: string | null;
41
41
  /**
42
- * Module ID in the server module graph.
43
- */
42
+ * Module ID in the server module graph.
43
+ */
44
44
  id: string;
45
45
  /**
46
- * Module URL used in the import.
47
- */
46
+ * Module URL used in the import.
47
+ */
48
48
  url: string;
49
49
  /**
50
- * Invalidate module on the client side.
51
- */
50
+ * Invalidate module on the client side.
51
+ */
52
52
  invalidate: boolean;
53
53
  }
54
54
  type InvokeMethods = {