vite 4.3.9 → 4.4.0-beta.0

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.

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 { C as colors, D as bindShortcuts, x as createLogger, h as resolveConfig } from './chunks/dep-e8f070e8.js';
5
+ import { C as colors, D as bindShortcuts, x as createLogger, h as resolveConfig } from './chunks/dep-f5e55821.js';
6
6
  import { VERSION } from './constants.js';
7
7
  import 'node:fs/promises';
8
8
  import 'node:url';
@@ -30,16 +30,16 @@ import 'module';
30
30
  import 'node:assert';
31
31
  import 'node:process';
32
32
  import 'node:v8';
33
+ import 'rollup';
33
34
  import 'worker_threads';
34
35
  import 'zlib';
35
36
  import 'buffer';
36
37
  import 'https';
37
38
  import 'tls';
38
- import 'node:http';
39
- import 'node:https';
40
- import 'rollup';
41
39
  import 'querystring';
42
40
  import 'node:readline';
41
+ import 'node:http';
42
+ import 'node:https';
43
43
  import 'node:zlib';
44
44
 
45
45
  function toArr(any) {
@@ -728,7 +728,7 @@ cli
728
728
  filterDuplicateOptions(options);
729
729
  // output structure is preserved even after bundling so require()
730
730
  // is ok here
731
- const { createServer } = await import('./chunks/dep-e8f070e8.js').then(function (n) { return n.I; });
731
+ const { createServer } = await import('./chunks/dep-f5e55821.js').then(function (n) { return n.I; });
732
732
  try {
733
733
  const server = await createServer({
734
734
  root,
@@ -806,7 +806,7 @@ cli
806
806
  .option('-w, --watch', `[boolean] rebuilds when modules have changed on disk`)
807
807
  .action(async (root, options) => {
808
808
  filterDuplicateOptions(options);
809
- const { build } = await import('./chunks/dep-e8f070e8.js').then(function (n) { return n.H; });
809
+ const { build } = await import('./chunks/dep-f5e55821.js').then(function (n) { return n.H; });
810
810
  const buildOptions = cleanOptions(options);
811
811
  try {
812
812
  await build({
@@ -834,7 +834,7 @@ cli
834
834
  .option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
835
835
  .action(async (root, options) => {
836
836
  filterDuplicateOptions(options);
837
- const { optimizeDeps } = await import('./chunks/dep-e8f070e8.js').then(function (n) { return n.G; });
837
+ const { optimizeDeps } = await import('./chunks/dep-f5e55821.js').then(function (n) { return n.G; });
838
838
  try {
839
839
  const config = await resolveConfig({
840
840
  root,
@@ -860,7 +860,7 @@ cli
860
860
  .option('--outDir <dir>', `[string] output directory (default: dist)`)
861
861
  .action(async (root, options) => {
862
862
  filterDuplicateOptions(options);
863
- const { preview } = await import('./chunks/dep-e8f070e8.js').then(function (n) { return n.J; });
863
+ const { preview } = await import('./chunks/dep-f5e55821.js').then(function (n) { return n.J; });
864
864
  try {
865
865
  const server = await preview({
866
866
  root,
@@ -76,6 +76,7 @@ const CLIENT_DIR = path.dirname(CLIENT_ENTRY);
76
76
  // looked up by mrmime.
77
77
  const KNOWN_ASSET_TYPES = [
78
78
  // images
79
+ 'apng',
79
80
  'png',
80
81
  'jpe?g',
81
82
  'jfif',
@@ -198,9 +198,9 @@ export declare interface BuildOptions {
198
198
  /**
199
199
  * Override CSS minification specifically instead of defaulting to `build.minify`,
200
200
  * so you can configure minification for JS and CSS separately.
201
- * @default minify
201
+ * @default 'esbuild'
202
202
  */
203
- cssMinify?: boolean;
203
+ cssMinify?: boolean | 'esbuild' | 'lightningcss';
204
204
  /**
205
205
  * If `true`, a separate sourcemap file will be created. If 'inline', the
206
206
  * sourcemap will be appended to the resulting output file as data URI.
@@ -511,6 +511,13 @@ export declare function createLogger(level?: LogLevel, options?: LoggerOptions):
511
511
 
512
512
  export declare function createServer(inlineConfig?: InlineConfig): Promise<ViteDevServer>;
513
513
 
514
+ declare interface CSSModulesConfig {
515
+ /** The pattern to use when renaming class names and other identifiers. Default is `[hash]_[local]`. */
516
+ pattern?: string,
517
+ /** Whether to rename dashed identifiers, e.g. custom properties. */
518
+ dashedIdents?: boolean
519
+ }
520
+
514
521
  export declare interface CSSModulesOptions {
515
522
  getJSON?: (cssFileName: string, json: Record<string, string>, outputFileName: string) => void;
516
523
  scopeBehaviour?: 'global' | 'local';
@@ -524,6 +531,15 @@ export declare interface CSSModulesOptions {
524
531
  }
525
532
 
526
533
  export declare interface CSSOptions {
534
+ /**
535
+ * Using lightningcss is an experimental option to handle CSS modules,
536
+ * assets and imports via Lightning CSS. It requires to install it as a
537
+ * peer dependency. This is incompatible with the use of preprocessors.
538
+ *
539
+ * @default 'postcss'
540
+ * @experimental
541
+ */
542
+ transformer?: 'postcss' | 'lightningcss';
527
543
  /**
528
544
  * https://github.com/css-modules/postcss-modules
529
545
  */
@@ -538,6 +554,10 @@ export declare interface CSSOptions {
538
554
  * @experimental
539
555
  */
540
556
  devSourcemap?: boolean;
557
+ /**
558
+ * @experimental
559
+ */
560
+ lightningcss?: LightningCSSOptions;
541
561
  }
542
562
 
543
563
  export { CustomEventMap }
@@ -690,6 +710,13 @@ export declare interface DepsOptimizer {
690
710
  options: DepOptimizationOptions;
691
711
  }
692
712
 
713
+ declare interface Drafts {
714
+ /** Whether to enable CSS nesting. */
715
+ nesting?: boolean,
716
+ /** Whether to enable @custom-media rules. */
717
+ customMedia?: boolean
718
+ }
719
+
693
720
  export { ErrorPayload }
694
721
 
695
722
  export declare interface ESBuildOptions extends EsbuildTransformOptions {
@@ -747,6 +774,32 @@ export declare type ExportsData = {
747
774
  jsxLoader?: boolean;
748
775
  };
749
776
 
777
+ declare const enum Features {
778
+ Nesting = 1,
779
+ NotSelectorList = 2,
780
+ DirSelector = 4,
781
+ LangSelectorList = 8,
782
+ IsSelector = 16,
783
+ TextDecorationThicknessPercent = 32,
784
+ MediaIntervalSyntax = 64,
785
+ MediaRangeSyntax = 128,
786
+ CustomMediaQueries = 256,
787
+ ClampFunction = 512,
788
+ ColorFunction = 1024,
789
+ OklabColors = 2048,
790
+ LabColors = 4096,
791
+ P3Colors = 8192,
792
+ HexAlphaColors = 16384,
793
+ SpaceSeparatedColorNotation = 32768,
794
+ FontFamilySystemUi = 65536,
795
+ DoublePositionGradients = 131072,
796
+ VendorPrefixes = 262144,
797
+ LogicalProperties = 524288,
798
+ Selectors = 31,
799
+ MediaQueries = 448,
800
+ Colors = 64512,
801
+ }
802
+
750
803
  export declare interface FileSystemServeOptions {
751
804
  /**
752
805
  * Strictly restrict file accessing outside of allowing paths.
@@ -1197,7 +1250,7 @@ export declare interface InternalResolveOptions extends Required<ResolveOptions>
1197
1250
  scan?: boolean;
1198
1251
  ssrOptimizeCheck?: boolean;
1199
1252
  getDepsOptimizer?: (ssr: boolean) => DepsOptimizer | undefined;
1200
- shouldExternalize?: (id: string) => boolean | undefined;
1253
+ shouldExternalize?: (id: string, importer?: string) => boolean | undefined;
1201
1254
  /* Excluded from this release type: idOnly */
1202
1255
  }
1203
1256
 
@@ -1264,6 +1317,21 @@ export declare interface LibraryOptions {
1264
1317
  fileName?: string | ((format: ModuleFormat, entryName: string) => string);
1265
1318
  }
1266
1319
 
1320
+ /**
1321
+ * Options are spread, so you can also use options that are not typed here like
1322
+ * visitor (not exposed because it would impact too much the bundle size)
1323
+ */
1324
+ export declare type LightningCSSOptions = {
1325
+ targets?: Targets
1326
+ include?: Features
1327
+ exclude?: Features
1328
+ drafts?: Drafts
1329
+ nonStandard?: NonStandard
1330
+ pseudoClasses?: PseudoClasses
1331
+ unusedSymbols?: string[]
1332
+ cssModules?: CSSModulesConfig
1333
+ }
1334
+
1267
1335
  export declare function loadConfigFromFile(configEnv: ConfigEnv, configFile?: string, configRoot?: string, logLevel?: LogLevel): Promise<{
1268
1336
  path: string;
1269
1337
  config: UserConfig;
@@ -1320,7 +1388,7 @@ export declare type Matcher = AnymatchPattern | AnymatchPattern[]
1320
1388
 
1321
1389
  export declare function mergeAlias(a?: AliasOptions, b?: AliasOptions): AliasOptions | undefined;
1322
1390
 
1323
- export declare function mergeConfig(defaults: Record<string, any>, overrides: Record<string, any>, isRoot?: boolean): Record<string, any>;
1391
+ export declare function mergeConfig<D extends Record<string, any>, O extends Record<string, any>>(defaults: D extends Function ? never : D, overrides: O extends Function ? never : O, isRoot?: boolean): Record<string, any>;
1324
1392
 
1325
1393
  export declare class ModuleGraph {
1326
1394
  private resolveId;
@@ -1366,7 +1434,8 @@ export declare class ModuleNode {
1366
1434
  info?: ModuleInfo;
1367
1435
  meta?: Record<string, any>;
1368
1436
  importers: Set<ModuleNode>;
1369
- importedModules: Set<ModuleNode>;
1437
+ clientImportedModules: Set<ModuleNode>;
1438
+ ssrImportedModules: Set<ModuleNode>;
1370
1439
  acceptedHmrDeps: Set<ModuleNode>;
1371
1440
  acceptedHmrExports: Set<string> | null;
1372
1441
  importedBindings: Map<string, Set<string>> | null;
@@ -1381,6 +1450,7 @@ export declare class ModuleNode {
1381
1450
  * @param setIsSelfAccepting - set `false` to set `isSelfAccepting` later. e.g. #7870
1382
1451
  */
1383
1452
  constructor(url: string, setIsSelfAccepting?: boolean);
1453
+ get importedModules(): Set<ModuleNode>;
1384
1454
  }
1385
1455
 
1386
1456
  export declare interface ModulePreloadOptions {
@@ -1397,6 +1467,11 @@ export declare interface ModulePreloadOptions {
1397
1467
  resolveDependencies?: ResolveModulePreloadDependenciesFn;
1398
1468
  }
1399
1469
 
1470
+ declare interface NonStandard {
1471
+ /** Whether to enable the non-standard >>> and /deep/ selector combinators used by Angular and Vue. */
1472
+ deepSelectorCombinator?: boolean
1473
+ }
1474
+
1400
1475
  export declare function normalizePath(id: string): string;
1401
1476
 
1402
1477
  export declare interface OptimizedDepInfo {
@@ -1674,6 +1749,14 @@ export declare interface ProxyOptions extends HttpProxy.ServerOptions {
1674
1749
 
1675
1750
  export { PrunePayload }
1676
1751
 
1752
+ declare interface PseudoClasses {
1753
+ hover?: string,
1754
+ active?: string,
1755
+ focus?: string,
1756
+ focusVisible?: string,
1757
+ focusWithin?: string
1758
+ }
1759
+
1677
1760
  export declare type RenderBuiltAssetUrl = (filename: string, type: {
1678
1761
  type: 'asset' | 'public';
1679
1762
  hostId: string;
@@ -1696,7 +1779,7 @@ export declare interface ResolvedBuildOptions extends Required<Omit<BuildOptions
1696
1779
  modulePreload: false | ResolvedModulePreloadOptions;
1697
1780
  }
1698
1781
 
1699
- export declare type ResolvedConfig = Readonly<Omit<UserConfig, 'plugins' | 'assetsInclude' | 'optimizeDeps' | 'worker'> & {
1782
+ export declare type ResolvedConfig = Readonly<Omit<UserConfig, 'plugins' | 'css' | 'assetsInclude' | 'optimizeDeps' | 'worker'> & {
1700
1783
  configFile: string | undefined;
1701
1784
  configFileDependencies: string[];
1702
1785
  inlineConfig: InlineConfig;
@@ -1716,6 +1799,7 @@ export declare type ResolvedConfig = Readonly<Omit<UserConfig, 'plugins' | 'asse
1716
1799
  alias: Alias[];
1717
1800
  };
1718
1801
  plugins: readonly Plugin_2[];
1802
+ css: ResolvedCSSOptions | undefined;
1719
1803
  esbuild: ESBuildOptions | false;
1720
1804
  server: ResolvedServerOptions;
1721
1805
  build: ResolvedBuildOptions;
@@ -1731,6 +1815,12 @@ export declare type ResolvedConfig = Readonly<Omit<UserConfig, 'plugins' | 'asse
1731
1815
  experimental: ExperimentalOptions;
1732
1816
  } & PluginHookUtils>;
1733
1817
 
1818
+ export declare type ResolvedCSSOptions = Omit<CSSOptions, 'lightningcss'> & {
1819
+ lightningcss?: LightningCSSOptions & {
1820
+ targets: LightningCSSOptions['targets'];
1821
+ };
1822
+ };
1823
+
1734
1824
  export declare interface ResolvedModulePreloadOptions {
1735
1825
  polyfill: boolean;
1736
1826
  resolveDependencies?: ResolveModulePreloadDependenciesFn;
@@ -2094,11 +2184,6 @@ export declare interface ServerOptions extends CommonServerOptions {
2094
2184
  * @default false
2095
2185
  */
2096
2186
  middlewareMode?: boolean | 'html' | 'ssr';
2097
- /**
2098
- * Prepend this folder to http requests, for use when proxying vite as a subfolder
2099
- * Should start and end with the `/` character
2100
- */
2101
- base?: string;
2102
2187
  /**
2103
2188
  * Options for files served via '/\@fs/'.
2104
2189
  */
@@ -2181,6 +2266,18 @@ export declare interface SSROptions {
2181
2266
 
2182
2267
  export declare type SSRTarget = 'node' | 'webworker';
2183
2268
 
2269
+ declare interface Targets {
2270
+ android?: number,
2271
+ chrome?: number,
2272
+ edge?: number,
2273
+ firefox?: number,
2274
+ ie?: number,
2275
+ ios_saf?: number,
2276
+ opera?: number,
2277
+ safari?: number,
2278
+ samsung?: number
2279
+ }
2280
+
2184
2281
  export declare namespace Terser {
2185
2282
  export type ECMA = 5 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020
2186
2283
 
@@ -1,5 +1,5 @@
1
- import { i as isInNodeModules } from './chunks/dep-e8f070e8.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, z as isFileServingAllowed, l as loadConfigFromFile, A 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, B as resolveEnvPrefix, d as resolvePackageData, r as resolvePackageEntry, y as searchForWorkspaceRoot, w as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-e8f070e8.js';
1
+ import { i as isInNodeModules } from './chunks/dep-f5e55821.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, z as isFileServingAllowed, l as loadConfigFromFile, A 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, B as resolveEnvPrefix, d as resolvePackageData, r as resolvePackageEntry, y as searchForWorkspaceRoot, w as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-f5e55821.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';
@@ -37,10 +37,10 @@ import 'zlib';
37
37
  import 'buffer';
38
38
  import 'https';
39
39
  import 'tls';
40
- import 'node:http';
41
- import 'node:https';
42
40
  import 'querystring';
43
41
  import 'node:readline';
42
+ import 'node:http';
43
+ import 'node:https';
44
44
  import 'node:zlib';
45
45
 
46
46
  // This file will be built for both ESM and CJS. Avoid relying on other modules as possible.
@@ -125,6 +125,8 @@ function splitVendorChunkPlugin() {
125
125
  }
126
126
  // else, leave the object form of manualChunks untouched, as
127
127
  // we can't safely replicate rollup handling.
128
+ // eslint-disable-next-line no-console
129
+ console.warn("(!) the `splitVendorChunk` plugin doesn't have any effect when using the object form of `build.rollupOptions.manualChunks`. Consider using the function form instead.");
128
130
  }
129
131
  else {
130
132
  output.manualChunks = viteManualChunks;