vite 6.0.0-beta.7 → 6.0.0-beta.8

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,4 +1,4 @@
1
- import { M as commonjsGlobal, L as getDefaultExportFromCjs } from './dep-Vd7gFLqj.js';
1
+ import { M as commonjsGlobal, L as getDefaultExportFromCjs } from './dep-Ddvoc4zx.js';
2
2
  import require$$0$1 from 'fs';
3
3
  import require$$0 from 'postcss';
4
4
  import sysPath__default from 'path';
package/dist/node/cli.js CHANGED
@@ -2,7 +2,7 @@ import path from 'node:path';
2
2
  import fs__default from 'node:fs';
3
3
  import { performance } from 'node:perf_hooks';
4
4
  import { EventEmitter } from 'events';
5
- import { K as colors, E as createLogger, r as resolveConfig } from './chunks/dep-Vd7gFLqj.js';
5
+ import { K as colors, E as createLogger, r as resolveConfig } from './chunks/dep-Ddvoc4zx.js';
6
6
  import { VERSION } from './constants.js';
7
7
  import 'node:fs/promises';
8
8
  import 'node:url';
@@ -741,7 +741,7 @@ cli.command("[root]", "start dev server").alias("serve").alias("dev").option("--
741
741
  `[boolean] force the optimizer to ignore the cache and re-bundle`
742
742
  ).action(async (root, options) => {
743
743
  filterDuplicateOptions(options);
744
- const { createServer } = await import('./chunks/dep-Vd7gFLqj.js').then(function (n) { return n.O; });
744
+ const { createServer } = await import('./chunks/dep-Ddvoc4zx.js').then(function (n) { return n.O; });
745
745
  try {
746
746
  const server = await createServer({
747
747
  root,
@@ -834,7 +834,7 @@ cli.command("build [root]", "build for production").option("--target <target>",
834
834
  ).option("-w, --watch", `[boolean] rebuilds when modules have changed on disk`).option("--app", `[boolean] same as \`builder: {}\``).action(
835
835
  async (root, options) => {
836
836
  filterDuplicateOptions(options);
837
- const { createBuilder } = await import('./chunks/dep-Vd7gFLqj.js').then(function (n) { return n.P; });
837
+ const { createBuilder } = await import('./chunks/dep-Ddvoc4zx.js').then(function (n) { return n.P; });
838
838
  const buildOptions = cleanGlobalCLIOptions(
839
839
  cleanBuilderCLIOptions(options)
840
840
  );
@@ -869,7 +869,7 @@ cli.command("optimize [root]", "pre-bundle dependencies").option(
869
869
  ).action(
870
870
  async (root, options) => {
871
871
  filterDuplicateOptions(options);
872
- const { optimizeDeps } = await import('./chunks/dep-Vd7gFLqj.js').then(function (n) { return n.N; });
872
+ const { optimizeDeps } = await import('./chunks/dep-Ddvoc4zx.js').then(function (n) { return n.N; });
873
873
  try {
874
874
  const config = await resolveConfig(
875
875
  {
@@ -895,7 +895,7 @@ ${e.stack}`),
895
895
  cli.command("preview [root]", "locally preview production build").option("--host [host]", `[string] specify hostname`, { type: [convertHost] }).option("--port <port>", `[number] specify port`).option("--strictPort", `[boolean] exit if specified port is already in use`).option("--open [path]", `[boolean | string] open browser on startup`).option("--outDir <dir>", `[string] output directory (default: dist)`).action(
896
896
  async (root, options) => {
897
897
  filterDuplicateOptions(options);
898
- const { preview } = await import('./chunks/dep-Vd7gFLqj.js').then(function (n) { return n.Q; });
898
+ const { preview } = await import('./chunks/dep-Ddvoc4zx.js').then(function (n) { return n.Q; });
899
899
  try {
900
900
  const server = await preview({
901
901
  root,
@@ -42,6 +42,14 @@ const DEFAULT_MAIN_FIELDS = [
42
42
  // moment still uses this...
43
43
  "jsnext"
44
44
  ];
45
+ const DEV_PROD_CONDITION = `development|production`;
46
+ const DEFAULT_CONDITIONS = [
47
+ "module",
48
+ "browser",
49
+ "node",
50
+ DEV_PROD_CONDITION
51
+ ];
52
+ const DEFAULT_EXTERNAL_CONDITIONS = ["node"];
45
53
  const ESBUILD_MODULES_TARGET = [
46
54
  "es2020",
47
55
  // support import.meta.url
@@ -141,4 +149,4 @@ const ERR_OPTIMIZE_DEPS_PROCESSING_ERROR = "ERR_OPTIMIZE_DEPS_PROCESSING_ERROR";
141
149
  const ERR_OUTDATED_OPTIMIZED_DEP = "ERR_OUTDATED_OPTIMIZED_DEP";
142
150
  const ERR_FILE_NOT_FOUND_IN_OPTIMIZED_DEP_DIR = "ERR_FILE_NOT_FOUND_IN_OPTIMIZED_DEP_DIR";
143
151
 
144
- 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, ERR_FILE_NOT_FOUND_IN_OPTIMIZED_DEP_DIR, ERR_OPTIMIZE_DEPS_PROCESSING_ERROR, ERR_OUTDATED_OPTIMIZED_DEP, ESBUILD_MODULES_TARGET, FS_PREFIX, JS_TYPES_RE, KNOWN_ASSET_TYPES, METADATA_FILENAME, OPTIMIZABLE_ENTRY_RE, ROLLUP_HOOKS, SPECIAL_QUERY_RE, VERSION, VITE_PACKAGE_DIR, loopbackHosts, wildcardHosts };
152
+ export { CLIENT_DIR, CLIENT_ENTRY, CLIENT_PUBLIC_PATH, CSS_LANGS_RE, DEFAULT_ASSETS_INLINE_LIMIT, DEFAULT_ASSETS_RE, DEFAULT_CONDITIONS, DEFAULT_CONFIG_FILES, DEFAULT_DEV_PORT, DEFAULT_EXTENSIONS, DEFAULT_EXTERNAL_CONDITIONS, DEFAULT_MAIN_FIELDS, DEFAULT_PREVIEW_PORT, DEP_VERSION_RE, DEV_PROD_CONDITION, ENV_ENTRY, ENV_PUBLIC_PATH, ERR_FILE_NOT_FOUND_IN_OPTIMIZED_DEP_DIR, ERR_OPTIMIZE_DEPS_PROCESSING_ERROR, ERR_OUTDATED_OPTIMIZED_DEP, ESBUILD_MODULES_TARGET, FS_PREFIX, JS_TYPES_RE, KNOWN_ASSET_TYPES, METADATA_FILENAME, OPTIMIZABLE_ENTRY_RE, ROLLUP_HOOKS, SPECIAL_QUERY_RE, VERSION, VITE_PACKAGE_DIR, loopbackHosts, wildcardHosts };
@@ -1687,18 +1687,6 @@ interface TerserOptions extends Terser.MinifyOptions {
1687
1687
  maxWorkers?: number;
1688
1688
  }
1689
1689
 
1690
- interface FsUtils {
1691
- existsSync: (path: string) => boolean;
1692
- isDirectory: (path: string) => boolean;
1693
- tryResolveRealFile: (path: string, preserveSymlinks?: boolean) => string | undefined;
1694
- tryResolveRealFileWithExtensions: (path: string, extensions: string[], preserveSymlinks?: boolean) => string | undefined;
1695
- tryResolveRealFileOrType: (path: string, preserveSymlinks?: boolean) => {
1696
- path?: string;
1697
- type: 'directory' | 'file';
1698
- } | undefined;
1699
- initWatcher?: (watcher: FSWatcher) => void;
1700
- }
1701
-
1702
1690
  interface EnvironmentResolveOptions {
1703
1691
  /**
1704
1692
  * @default ['browser', 'module', 'jsnext:main', 'jsnext']
@@ -1735,7 +1723,6 @@ interface ResolvePluginOptions {
1735
1723
  isBuild: boolean;
1736
1724
  isProduction: boolean;
1737
1725
  packageCache?: PackageCache;
1738
- fsUtils?: FsUtils;
1739
1726
  /**
1740
1727
  * src code mode also attempts the following:
1741
1728
  * - resolving /xxx as URLs
@@ -1746,10 +1733,8 @@ interface ResolvePluginOptions {
1746
1733
  tryPrefix?: string;
1747
1734
  preferRelative?: boolean;
1748
1735
  isRequire?: boolean;
1749
- webCompatible?: boolean;
1750
1736
  isFromTsImporter?: boolean;
1751
1737
  scan?: boolean;
1752
- ssrOptimizeCheck?: boolean;
1753
1738
  /**
1754
1739
  * @deprecated environment.config are used instead
1755
1740
  */
@@ -1757,15 +1742,14 @@ interface ResolvePluginOptions {
1757
1742
  }
1758
1743
  interface InternalResolveOptions extends Required<ResolveOptions>, ResolvePluginOptions {
1759
1744
  }
1760
- type InternalResolveOptionsWithOverrideConditions = InternalResolveOptions & {};
1761
1745
 
1762
1746
  /** Cache for package.json resolution and package.json contents */
1763
1747
  type PackageCache = Map<string, PackageData>;
1764
1748
  interface PackageData {
1765
1749
  dir: string;
1766
1750
  hasSideEffects: (id: string) => boolean | 'no-treeshake' | null;
1767
- setResolvedCache: (key: string, entry: string, options: InternalResolveOptionsWithOverrideConditions) => void;
1768
- getResolvedCache: (key: string, options: InternalResolveOptionsWithOverrideConditions) => string | undefined;
1751
+ setResolvedCache: (key: string, entry: string, options: InternalResolveOptions) => void;
1752
+ getResolvedCache: (key: string, options: InternalResolveOptions) => string | undefined;
1769
1753
  data: {
1770
1754
  [field: string]: any;
1771
1755
  name: string;
@@ -2843,13 +2827,6 @@ interface FileSystemServeOptions {
2843
2827
  * @default ['.env', '.env.*', '*.{crt,pem}', '**\/.git/**']
2844
2828
  */
2845
2829
  deny?: string[];
2846
- /**
2847
- * Enable caching of fs calls. It is enabled by default if no custom watch ignored patterns are provided.
2848
- *
2849
- * @experimental
2850
- * @default undefined
2851
- */
2852
- cachedChecks?: boolean;
2853
2830
  }
2854
2831
  type ServerHook = (this: void, server: ViteDevServer) => (() => void) | void | Promise<(() => void) | void>;
2855
2832
  type HttpServer = http.Server | Http2SecureServer;
@@ -3381,7 +3358,7 @@ interface SSROptions {
3381
3358
  /**
3382
3359
  * Define the target for the ssr build. The browser field in package.json
3383
3360
  * is ignored for node but used if webworker is the target
3384
- * This option may be replaced by the experimental `environmentOptions.webCompatible`
3361
+ * This option will be removed in a future major version
3385
3362
  * @default 'node'
3386
3363
  */
3387
3364
  target?: SSRTarget;
@@ -3518,10 +3495,10 @@ interface SharedEnvironmentOptions {
3518
3495
  */
3519
3496
  consumer?: 'client' | 'server';
3520
3497
  /**
3521
- * Runtime Compatibility
3522
- * Temporal options, we should remove these in favor of fine-grained control
3498
+ * If true, `process.env` referenced in code will be preserved as-is and evaluated in runtime.
3499
+ * Otherwise, it is statically replaced as an empty object.
3523
3500
  */
3524
- webCompatible?: boolean;
3501
+ keepProcessEnv?: boolean;
3525
3502
  /**
3526
3503
  * Optimize deps config
3527
3504
  */
@@ -3542,12 +3519,12 @@ type ResolvedEnvironmentOptions = {
3542
3519
  define?: Record<string, any>;
3543
3520
  resolve: ResolvedResolveOptions;
3544
3521
  consumer: 'client' | 'server';
3545
- webCompatible: boolean;
3522
+ keepProcessEnv?: boolean;
3546
3523
  optimizeDeps: DepOptimizationOptions;
3547
3524
  dev: ResolvedDevEnvironmentOptions;
3548
3525
  build: ResolvedBuildEnvironmentOptions;
3549
3526
  };
3550
- type DefaultEnvironmentOptions = Omit<EnvironmentOptions, 'consumer' | 'webCompatible' | 'resolve'> & {
3527
+ type DefaultEnvironmentOptions = Omit<EnvironmentOptions, 'consumer' | 'resolve'> & {
3551
3528
  resolve?: AllResolveOptions;
3552
3529
  };
3553
3530
  interface UserConfig extends DefaultEnvironmentOptions {
@@ -1,6 +1,6 @@
1
1
  export { parseAst, parseAstAsync } from 'rollup/parseAst';
2
- import { i as isInNodeModules, a as arraify } from './chunks/dep-Vd7gFLqj.js';
3
- export { B as BuildEnvironment, D as DevEnvironment, S as ServerHMRConnector, b as build, j as buildErrorMessage, e as createBuilder, z as createFilter, f as createIdResolver, E as createLogger, k as createRunnableDevEnvironment, c as createServer, u as createServerHotChannel, q as createServerModuleRunner, d as defineConfig, n as fetchModule, g as formatPostcssSourceMap, H as isFileLoadingAllowed, G as isFileServingAllowed, m as isRunnableDevEnvironment, l as loadConfigFromFile, I as loadEnv, y as mergeAlias, x as mergeConfig, v as moduleRunnerTransform, w as normalizePath, o as optimizeDeps, h as preprocessCSS, p as preview, r as resolveConfig, J as resolveEnvPrefix, A as rollupVersion, F as searchForWorkspaceRoot, C as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-Vd7gFLqj.js';
2
+ import { i as isInNodeModules, a as arraify } from './chunks/dep-Ddvoc4zx.js';
3
+ export { B as BuildEnvironment, D as DevEnvironment, S as ServerHMRConnector, b as build, j as buildErrorMessage, e as createBuilder, z as createFilter, f as createIdResolver, E as createLogger, k as createRunnableDevEnvironment, c as createServer, u as createServerHotChannel, q as createServerModuleRunner, d as defineConfig, n as fetchModule, g as formatPostcssSourceMap, H as isFileLoadingAllowed, G as isFileServingAllowed, m as isRunnableDevEnvironment, l as loadConfigFromFile, I as loadEnv, y as mergeAlias, x as mergeConfig, v as moduleRunnerTransform, w as normalizePath, o as optimizeDeps, h as preprocessCSS, p as preview, r as resolveConfig, J as resolveEnvPrefix, A as rollupVersion, F as searchForWorkspaceRoot, C as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-Ddvoc4zx.js';
4
4
  export { VERSION as version } from './constants.js';
5
5
  export { version as esbuildVersion } from 'esbuild';
6
6
  import 'node:fs';
@@ -3547,10 +3547,8 @@ function loadPackageData(pkgPath) {
3547
3547
  function getResolveCacheKey(key, options) {
3548
3548
  return [
3549
3549
  key,
3550
- options.webCompatible ? "1" : "0",
3551
3550
  options.isRequire ? "1" : "0",
3552
3551
  options.conditions.join("_"),
3553
- options.overrideConditions?.join("_") || "",
3554
3552
  options.extensions.join("_"),
3555
3553
  options.mainFields.join("_")
3556
3554
  ].join("|");
@@ -3569,7 +3567,7 @@ const DEBUG = process.env.DEBUG;
3569
3567
  function createDebugger(namespace, options = {}) {
3570
3568
  const log = debug$2(namespace);
3571
3569
  const { onlyWhenFocused, depth } = options;
3572
- if (depth && log.inspectOpts.depth == null) {
3570
+ if (depth && log.inspectOpts && log.inspectOpts.depth == null) {
3573
3571
  log.inspectOpts.depth = options.depth;
3574
3572
  }
3575
3573
  let enabled = log.enabled;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite",
3
- "version": "6.0.0-beta.7",
3
+ "version": "6.0.0-beta.8",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Evan You",