vite 4.3.0-beta.1 → 4.3.0-beta.3

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.

Potentially problematic release.


This version of vite might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  import require$$0__default from 'fs';
2
2
  import require$$0 from 'postcss';
3
- import { D as commonjsGlobal } from './dep-f365bad6.js';
3
+ import { D as commonjsGlobal } from './dep-366ea021.js';
4
4
  import require$$0$1 from 'path';
5
5
  import require$$5 from 'crypto';
6
6
  import require$$0$2 from 'util';
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 { B as picocolorsExports, C as bindShortcuts, x as createLogger, h as resolveConfig } from './chunks/dep-f365bad6.js';
5
+ import { B as picocolorsExports, C as bindShortcuts, x as createLogger, h as resolveConfig } from './chunks/dep-366ea021.js';
6
6
  import { VERSION } from './constants.js';
7
7
  import 'node:fs/promises';
8
8
  import 'node:url';
@@ -23,7 +23,6 @@ import 'node:os';
23
23
  import 'node:child_process';
24
24
  import 'node:crypto';
25
25
  import 'node:dns';
26
- import 'resolve';
27
26
  import 'crypto';
28
27
  import 'node:buffer';
29
28
  import 'node:util';
@@ -729,7 +728,7 @@ cli
729
728
  filterDuplicateOptions(options);
730
729
  // output structure is preserved even after bundling so require()
731
730
  // is ok here
732
- const { createServer } = await import('./chunks/dep-f365bad6.js').then(function (n) { return n.G; });
731
+ const { createServer } = await import('./chunks/dep-366ea021.js').then(function (n) { return n.G; });
733
732
  try {
734
733
  const server = await createServer({
735
734
  root,
@@ -807,7 +806,7 @@ cli
807
806
  .option('-w, --watch', `[boolean] rebuilds when modules have changed on disk`)
808
807
  .action(async (root, options) => {
809
808
  filterDuplicateOptions(options);
810
- const { build } = await import('./chunks/dep-f365bad6.js').then(function (n) { return n.F; });
809
+ const { build } = await import('./chunks/dep-366ea021.js').then(function (n) { return n.F; });
811
810
  const buildOptions = cleanOptions(options);
812
811
  try {
813
812
  await build({
@@ -835,7 +834,7 @@ cli
835
834
  .option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
836
835
  .action(async (root, options) => {
837
836
  filterDuplicateOptions(options);
838
- const { optimizeDeps } = await import('./chunks/dep-f365bad6.js').then(function (n) { return n.E; });
837
+ const { optimizeDeps } = await import('./chunks/dep-366ea021.js').then(function (n) { return n.E; });
839
838
  try {
840
839
  const config = await resolveConfig({
841
840
  root,
@@ -860,7 +859,7 @@ cli
860
859
  .option('--outDir <dir>', `[string] output directory (default: dist)`)
861
860
  .action(async (root, options) => {
862
861
  filterDuplicateOptions(options);
863
- const { preview } = await import('./chunks/dep-f365bad6.js').then(function (n) { return n.H; });
862
+ const { preview } = await import('./chunks/dep-366ea021.js').then(function (n) { return n.H; });
864
863
  try {
865
864
  const server = await preview({
866
865
  root,
@@ -663,9 +663,6 @@ export declare interface DepOptimizationResult {
663
663
  * to be able to discard the result
664
664
  */
665
665
  commit: () => Promise<void>;
666
- /**
667
- * @deprecated noop
668
- */
669
666
  cancel: () => void;
670
667
  }
671
668
 
@@ -740,8 +737,6 @@ export declare interface ExperimentalOptions {
740
737
  export declare type ExportsData = {
741
738
  hasImports: boolean;
742
739
  exports: readonly string[];
743
- facade: boolean;
744
- hasReExports?: boolean;
745
740
  jsxLoader?: boolean;
746
741
  };
747
742
 
@@ -1320,6 +1315,8 @@ export declare class ModuleGraph {
1320
1315
  idToModuleMap: Map<string, ModuleNode>;
1321
1316
  fileToModulesMap: Map<string, Set<ModuleNode>>;
1322
1317
  safeModulesPath: Set<string>;
1318
+ /* Excluded from this release type: _unresolvedUrlToModuleMap */
1319
+ /* Excluded from this release type: _ssrUnresolvedUrlToModuleMap */
1323
1320
  constructor(resolveId: (url: string, ssr: boolean) => Promise<PartialResolvedId | null>);
1324
1321
  getModuleByUrl(rawUrl: string, ssr?: boolean): Promise<ModuleNode | undefined>;
1325
1322
  getModuleById(id: string): ModuleNode | undefined;
@@ -1334,8 +1331,12 @@ export declare class ModuleGraph {
1334
1331
  */
1335
1332
  updateModuleInfo(mod: ModuleNode, importedModules: Set<string | ModuleNode>, importedBindings: Map<string, Set<string>> | null, acceptedModules: Set<string | ModuleNode>, acceptedExports: Set<string> | null, isSelfAccepting: boolean, ssr?: boolean): Promise<Set<ModuleNode> | undefined>;
1336
1333
  ensureEntryFromUrl(rawUrl: string, ssr?: boolean, setIsSelfAccepting?: boolean): Promise<ModuleNode>;
1334
+ /* Excluded from this release type: _ensureEntryFromUrl */
1337
1335
  createFileOnlyEntry(file: string): ModuleNode;
1338
1336
  resolveUrl(url: string, ssr?: boolean): Promise<ResolvedUrl>;
1337
+ /* Excluded from this release type: _getUnresolvedUrlToModule */
1338
+ /* Excluded from this release type: _setUnresolvedUrlToModule */
1339
+ /* Excluded from this release type: _resolveUrl */
1339
1340
  }
1340
1341
 
1341
1342
  export declare class ModuleNode {
@@ -3318,6 +3319,10 @@ export declare interface WebSocketClient {
3318
3319
  export declare type WebSocketCustomListener<T> = (data: T, client: WebSocketClient) => void;
3319
3320
 
3320
3321
  export declare interface WebSocketServer {
3322
+ /**
3323
+ * Listen on port and host
3324
+ */
3325
+ listen(): void;
3321
3326
  /**
3322
3327
  * Get all connected clients.
3323
3328
  */
@@ -1,5 +1,5 @@
1
- import { i as isInNodeModules } from './chunks/dep-f365bad6.js';
2
- export { b as build, e as buildErrorMessage, v as createFilter, x as createLogger, c as createServer, g as defineConfig, f as formatPostcssSourceMap, k as getDepOptimizationConfig, m as isDepsOptimizerEnabled, l as loadConfigFromFile, z as loadEnv, u as mergeAlias, q as mergeConfig, n as normalizePath, o as optimizeDeps, a as preprocessCSS, p as preview, j as resolveBaseUrl, h as resolveConfig, A as resolveEnvPrefix, d as resolvePackageData, r as resolvePackageEntry, y as searchForWorkspaceRoot, w as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-f365bad6.js';
1
+ import { i as isInNodeModules } from './chunks/dep-366ea021.js';
2
+ export { b as build, e as buildErrorMessage, v as createFilter, x as createLogger, c as createServer, g as defineConfig, f as formatPostcssSourceMap, k as getDepOptimizationConfig, m as isDepsOptimizerEnabled, l as loadConfigFromFile, z as loadEnv, u as mergeAlias, q as mergeConfig, n as normalizePath, o as optimizeDeps, a as preprocessCSS, p as preview, j as resolveBaseUrl, h as resolveConfig, A as resolveEnvPrefix, d as resolvePackageData, r as resolvePackageEntry, y as searchForWorkspaceRoot, w as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-366ea021.js';
3
3
  export { VERSION as version } from './constants.js';
4
4
  export { version as esbuildVersion } from 'esbuild';
5
5
  export { VERSION as rollupVersion } from 'rollup';
@@ -25,7 +25,6 @@ import 'node:os';
25
25
  import 'node:child_process';
26
26
  import 'node:crypto';
27
27
  import 'node:dns';
28
- import 'resolve';
29
28
  import 'crypto';
30
29
  import 'node:buffer';
31
30
  import 'node:util';
@@ -1150,7 +1150,7 @@ function requireNode () {
1150
1150
  }
1151
1151
  } (src));
1152
1152
 
1153
- var debug = /*@__PURE__*/getDefaultExportFromCjs(srcExports);
1153
+ var debug$1 = /*@__PURE__*/getDefaultExportFromCjs(srcExports);
1154
1154
 
1155
1155
  var picomatchExports = {};
1156
1156
  var picomatch$1 = {
@@ -3295,6 +3295,13 @@ const builtins = 'arguments Infinity NaN undefined null true false eval uneval i
3295
3295
  const forbiddenIdentifiers = new Set(`${reservedWords} ${builtins}`.split(' '));
3296
3296
  forbiddenIdentifiers.add('');
3297
3297
 
3298
+ if (process.versions.pnp) {
3299
+ try {
3300
+ node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (document.currentScript && document.currentScript.src || new URL('node-cjs/publicUtils.cjs', document.baseURI).href)))('pnpapi');
3301
+ }
3302
+ catch { }
3303
+ }
3304
+
3298
3305
  const createFilter = createFilter$1;
3299
3306
  const windowsSlashRE = /\\/g;
3300
3307
  function slash(p) {
@@ -3309,18 +3316,20 @@ const _require = node_module.createRequire((typeof document === 'undefined' ? re
3309
3316
  const filter = process.env.VITE_DEBUG_FILTER;
3310
3317
  const DEBUG = process.env.DEBUG;
3311
3318
  function createDebugger(namespace, options = {}) {
3312
- const log = debug(namespace);
3319
+ const log = debug$1(namespace);
3313
3320
  const { onlyWhenFocused } = options;
3314
- const focus = typeof onlyWhenFocused === 'string' ? onlyWhenFocused : namespace;
3315
- return (msg, ...args) => {
3316
- if (filter && !msg.includes(filter)) {
3317
- return;
3318
- }
3319
- if (onlyWhenFocused && !DEBUG?.includes(focus)) {
3320
- return;
3321
- }
3322
- log(msg, ...args);
3323
- };
3321
+ let enabled = log.enabled;
3322
+ if (enabled && onlyWhenFocused) {
3323
+ const ns = typeof onlyWhenFocused === 'string' ? onlyWhenFocused : namespace;
3324
+ enabled = !!DEBUG?.includes(ns);
3325
+ }
3326
+ if (enabled) {
3327
+ return (...args) => {
3328
+ if (!filter || args.some((a) => a?.includes(filter))) {
3329
+ log(...args);
3330
+ }
3331
+ };
3332
+ }
3324
3333
  }
3325
3334
  function testCaseInsensitiveFS() {
3326
3335
  if (!CLIENT_ENTRY.endsWith('client.mjs')) {
@@ -3350,6 +3359,11 @@ function tryStatSync(file) {
3350
3359
  }
3351
3360
  function isFileReadable(filename) {
3352
3361
  try {
3362
+ // The "throwIfNoEntry" is a performance optimization for cases where the file does not exist
3363
+ if (!fs$1.statSync(filename, { throwIfNoEntry: false })) {
3364
+ return false;
3365
+ }
3366
+ // Check if current process has read permission to the file
3353
3367
  fs$1.accessSync(filename, fs$1.constants.R_OK);
3354
3368
  return true;
3355
3369
  }
@@ -3374,6 +3388,7 @@ const usingDynamicImport = typeof jest === 'undefined';
3374
3388
  usingDynamicImport
3375
3389
  ? new Function('file', 'return import(file)')
3376
3390
  : _require;
3391
+ path$3.dirname(node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (document.currentScript && document.currentScript.src || new URL('node-cjs/publicUtils.cjs', document.baseURI).href))));
3377
3392
  function mergeConfigRecursively(defaults, overrides, rootPath) {
3378
3393
  const merged = { ...defaults };
3379
3394
  for (const key in overrides) {
@@ -3692,8 +3707,7 @@ function stattag (stat) {
3692
3707
  return '"' + size + '-' + mtime + '"'
3693
3708
  }
3694
3709
 
3695
- const isDebug = !!process.env.DEBUG;
3696
- createDebugger('vite:sourcemap', {
3710
+ const debug = createDebugger('vite:sourcemap', {
3697
3711
  onlyWhenFocused: true,
3698
3712
  });
3699
3713
  function genSourceMapUrl(map) {
@@ -3703,7 +3717,7 @@ function genSourceMapUrl(map) {
3703
3717
  return `data:application/json;base64,${Buffer.from(map).toString('base64')}`;
3704
3718
  }
3705
3719
  function getCodeWithSourcemap(type, code, map) {
3706
- if (isDebug) {
3720
+ if (debug) {
3707
3721
  code += `\n/*${JSON.stringify(map, null, 2).replace(/\*\//g, '*\\/')}*/\n`;
3708
3722
  }
3709
3723
  if (type === 'js') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite",
3
- "version": "4.3.0-beta.1",
3
+ "version": "4.3.0-beta.3",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Evan You",
@@ -68,8 +68,7 @@
68
68
  "dependencies": {
69
69
  "esbuild": "^0.17.5",
70
70
  "postcss": "^8.4.21",
71
- "resolve": "^1.22.1",
72
- "rollup": "^3.20.0"
71
+ "rollup": "^3.20.2"
73
72
  },
74
73
  "optionalDependencies": {
75
74
  "fsevents": "~2.3.2"