vite 3.0.0-beta.5 → 3.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.
package/dist/node/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { performance } from 'node:perf_hooks';
2
2
  import { EventEmitter } from 'events';
3
- import { x as picocolors, q as createLogger, e as resolveConfig } from './chunks/dep-332aa27f.js';
3
+ import { y as picocolors, u as createLogger, e as resolveConfig } from './chunks/dep-5ccc5f38.js';
4
4
  import { VERSION } from './constants.js';
5
5
  import 'node:fs';
6
6
  import 'node:path';
@@ -694,7 +694,7 @@ cli
694
694
  .action(async (root, options) => {
695
695
  // output structure is preserved even after bundling so require()
696
696
  // is ok here
697
- const { createServer } = await import('./chunks/dep-332aa27f.js').then(function (n) { return n.D; });
697
+ const { createServer } = await import('./chunks/dep-5ccc5f38.js').then(function (n) { return n.E; });
698
698
  try {
699
699
  const server = await createServer({
700
700
  root,
@@ -741,7 +741,7 @@ cli
741
741
  .option('--emptyOutDir', `[boolean] force empty outDir when it's outside of root`)
742
742
  .option('-w, --watch', `[boolean] rebuilds when modules have changed on disk`)
743
743
  .action(async (root, options) => {
744
- const { build } = await import('./chunks/dep-332aa27f.js').then(function (n) { return n.C; });
744
+ const { build } = await import('./chunks/dep-5ccc5f38.js').then(function (n) { return n.D; });
745
745
  const buildOptions = cleanOptions(options);
746
746
  try {
747
747
  await build({
@@ -765,7 +765,7 @@ cli
765
765
  .command('optimize [root]', 'pre-bundle dependencies')
766
766
  .option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
767
767
  .action(async (root, options) => {
768
- const { optimizeDeps } = await import('./chunks/dep-332aa27f.js').then(function (n) { return n.B; });
768
+ const { optimizeDeps } = await import('./chunks/dep-5ccc5f38.js').then(function (n) { return n.C; });
769
769
  try {
770
770
  const config = await resolveConfig({
771
771
  root,
@@ -788,7 +788,7 @@ cli
788
788
  .option('--https', `[boolean] use TLS + HTTP/2`)
789
789
  .option('--open [path]', `[boolean | string] open browser on startup`)
790
790
  .action(async (root, options) => {
791
- const { preview } = await import('./chunks/dep-332aa27f.js').then(function (n) { return n.E; });
791
+ const { preview } = await import('./chunks/dep-5ccc5f38.js').then(function (n) { return n.F; });
792
792
  try {
793
793
  const server = await preview({
794
794
  root,
@@ -1,7 +1,7 @@
1
1
  import path, { resolve } from 'node:path';
2
2
  import { fileURLToPath } from 'node:url';
3
3
 
4
- var version = "3.0.0-beta.5";
4
+ var version = "3.0.0-beta.8";
5
5
 
6
6
  const VERSION = version;
7
7
  const DEFAULT_MAIN_FIELDS = [
@@ -35,7 +35,7 @@ const DEFAULT_CONFIG_FILES = [
35
35
  'vite.config.cts'
36
36
  ];
37
37
  const JS_TYPES_RE = /\.(?:j|t)sx?$|\.mjs$/;
38
- const OPTIMIZABLE_ENTRY_RE = /\.(?:m?js|ts)$/;
38
+ const OPTIMIZABLE_ENTRY_RE = /\.(?:(m|c)?js|ts)$/;
39
39
  const SPECIAL_QUERY_RE = /[\?&](?:worker|sharedworker|raw|url)\b/;
40
40
  /**
41
41
  * Prefix for resolved fs paths, since windows paths may not be valid as URLs.
@@ -326,6 +326,10 @@ export declare interface CommonServerOptions {
326
326
  export declare interface ConfigEnv {
327
327
  command: 'build' | 'serve';
328
328
  mode: string;
329
+ /**
330
+ * @experimental
331
+ */
332
+ ssrBuild?: boolean;
329
333
  }
330
334
 
331
335
  export declare namespace Connect {
@@ -475,7 +479,7 @@ export declare interface CSSOptions {
475
479
  modules?: CSSModulesOptions | false;
476
480
  preprocessorOptions?: Record<string, any>;
477
481
  postcss?: string | (PostCSS.ProcessOptions & {
478
- plugins?: PostCSS.Plugin[];
482
+ plugins?: PostCSS.AcceptedPlugin[];
479
483
  });
480
484
  /**
481
485
  * Enables css sourcemaps during dev
@@ -506,48 +510,7 @@ export declare interface CustomPayload {
506
510
  */
507
511
  export declare function defineConfig(config: UserConfigExport): UserConfigExport;
508
512
 
509
- export declare interface DepOptimizationMetadata {
510
- /**
511
- * The main hash is determined by user config and dependency lockfiles.
512
- * This is checked on server startup to avoid unnecessary re-bundles.
513
- */
514
- hash: string;
515
- /**
516
- * The browser hash is determined by the main hash plus additional dependencies
517
- * discovered at runtime. This is used to invalidate browser requests to
518
- * optimized deps.
519
- */
520
- browserHash: string;
521
- /**
522
- * Metadata for each already optimized dependency
523
- */
524
- optimized: Record<string, OptimizedDepInfo>;
525
- /**
526
- * Metadata for non-entry optimized chunks and dynamic imports
527
- */
528
- chunks: Record<string, OptimizedDepInfo>;
529
- /**
530
- * Metadata for each newly discovered dependency after processing
531
- */
532
- discovered: Record<string, OptimizedDepInfo>;
533
- /**
534
- * OptimizedDepInfo list
535
- */
536
- depInfoList: OptimizedDepInfo[];
537
- }
538
-
539
- export declare interface DepOptimizationOptions {
540
- /**
541
- * By default, Vite will crawl your `index.html` to detect dependencies that
542
- * need to be pre-bundled. If `build.rollupOptions.input` is specified, Vite
543
- * will crawl those entry points instead.
544
- *
545
- * If neither of these fit your needs, you can specify custom entries using
546
- * this option - the value should be a fast-glob pattern or array of patterns
547
- * (https://github.com/mrmlnc/fast-glob#basic-syntax) that are relative from
548
- * vite project root. This will overwrite default entries inference.
549
- */
550
- entries?: string | string[];
513
+ export declare interface DepOptimizationConfig {
551
514
  /**
552
515
  * Force optimize listed dependencies (must be resolvable import paths,
553
516
  * cannot be globs).
@@ -594,12 +557,56 @@ export declare interface DepOptimizationOptions {
594
557
  * @experimental
595
558
  */
596
559
  disabled?: boolean | 'build' | 'dev';
560
+ }
561
+
562
+ export declare interface DepOptimizationMetadata {
563
+ /**
564
+ * The main hash is determined by user config and dependency lockfiles.
565
+ * This is checked on server startup to avoid unnecessary re-bundles.
566
+ */
567
+ hash: string;
568
+ /**
569
+ * The browser hash is determined by the main hash plus additional dependencies
570
+ * discovered at runtime. This is used to invalidate browser requests to
571
+ * optimized deps.
572
+ */
573
+ browserHash: string;
574
+ /**
575
+ * Metadata for each already optimized dependency
576
+ */
577
+ optimized: Record<string, OptimizedDepInfo>;
578
+ /**
579
+ * Metadata for non-entry optimized chunks and dynamic imports
580
+ */
581
+ chunks: Record<string, OptimizedDepInfo>;
582
+ /**
583
+ * Metadata for each newly discovered dependency after processing
584
+ */
585
+ discovered: Record<string, OptimizedDepInfo>;
586
+ /**
587
+ * OptimizedDepInfo list
588
+ */
589
+ depInfoList: OptimizedDepInfo[];
590
+ }
591
+
592
+ export declare type DepOptimizationOptions = DepOptimizationConfig & {
593
+ /**
594
+ * By default, Vite will crawl your `index.html` to detect dependencies that
595
+ * need to be pre-bundled. If `build.rollupOptions.input` is specified, Vite
596
+ * will crawl those entry points instead.
597
+ *
598
+ * If neither of these fit your needs, you can specify custom entries using
599
+ * this option - the value should be a fast-glob pattern or array of patterns
600
+ * (https://github.com/mrmlnc/fast-glob#basic-syntax) that are relative from
601
+ * vite project root. This will overwrite default entries inference.
602
+ */
603
+ entries?: string | string[];
597
604
  /**
598
605
  * Force dep pre-optimization regardless of whether deps have changed.
599
606
  * @experimental
600
607
  */
601
608
  force?: boolean;
602
- }
609
+ };
603
610
 
604
611
  export declare interface DepOptimizationProcessing {
605
612
  promise: Promise<void>;
@@ -618,11 +625,9 @@ export declare interface DepOptimizationResult {
618
625
  }
619
626
 
620
627
  export declare interface DepsOptimizer {
621
- metadata: (options: {
622
- ssr: boolean;
623
- }) => DepOptimizationMetadata;
628
+ metadata: DepOptimizationMetadata;
624
629
  scanProcessing?: Promise<void>;
625
- registerMissingImport: (id: string, resolved: string, ssr?: boolean) => OptimizedDepInfo;
630
+ registerMissingImport: (id: string, resolved: string) => OptimizedDepInfo;
626
631
  run: () => void;
627
632
  isOptimizedDepFile: (id: string) => boolean;
628
633
  isOptimizedDepUrl: (url: string) => boolean;
@@ -812,6 +817,8 @@ export declare interface FullReloadPayload {
812
817
  path?: string
813
818
  }
814
819
 
820
+ export declare function getDepOptimizationConfig(config: ResolvedConfig, ssr: boolean): DepOptimizationConfig;
821
+
815
822
  export declare interface HmrContext {
816
823
  file: string;
817
824
  timestamp: number;
@@ -1207,11 +1214,12 @@ export declare interface InternalResolveOptions extends ResolveOptions {
1207
1214
  isFromTsImporter?: boolean;
1208
1215
  tryEsmOnly?: boolean;
1209
1216
  scan?: boolean;
1210
- getDepsOptimizer?: () => DepsOptimizer | undefined;
1217
+ ssrOptimizeCheck?: boolean;
1218
+ getDepsOptimizer?: (ssr: boolean) => DepsOptimizer | undefined;
1211
1219
  shouldExternalize?: (id: string) => boolean | undefined;
1212
1220
  }
1213
1221
 
1214
- export declare function isDepsOptimizerEnabled(config: ResolvedConfig): boolean;
1222
+ export declare function isDepsOptimizerEnabled(config: ResolvedConfig, ssr: boolean): boolean;
1215
1223
 
1216
1224
  export declare interface JsonOptions {
1217
1225
  /**
@@ -1234,22 +1242,6 @@ export declare interface KnownAsTypeMap {
1234
1242
  }
1235
1243
 
1236
1244
  export declare interface LegacyOptions {
1237
- /**
1238
- * Revert vite dev to the v2.9 strategy. Enable esbuild based deps scanner.
1239
- *
1240
- * @experimental
1241
- * @deprecated
1242
- * @default false
1243
- */
1244
- devDepsScanner?: boolean;
1245
- /**
1246
- * Revert vite build to the v2.9 strategy. Disable esbuild deps optimization and adds `@rollup/plugin-commonjs`
1247
- *
1248
- * @experimental
1249
- * @deprecated
1250
- * @default false
1251
- */
1252
- buildRollupPluginCommonjs?: boolean;
1253
1245
  /**
1254
1246
  * Revert vite build --ssr to the v2.9 strategy. Use CJS SSR build and v2.9 externalization heuristics
1255
1247
  *
@@ -1360,7 +1352,7 @@ export declare class ModuleGraph {
1360
1352
  * returned as a Set.
1361
1353
  */
1362
1354
  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>;
1363
- ensureEntryFromUrl(rawUrl: string, ssr?: boolean): Promise<ModuleNode>;
1355
+ ensureEntryFromUrl(rawUrl: string, ssr?: boolean, setIsSelfAccepting?: boolean): Promise<ModuleNode>;
1364
1356
  createFileOnlyEntry(file: string): ModuleNode;
1365
1357
  resolveUrl(url: string, ssr?: boolean): Promise<ResolvedUrl>;
1366
1358
  }
@@ -1390,7 +1382,10 @@ export declare class ModuleNode {
1390
1382
  ssrError: Error | null;
1391
1383
  lastHMRTimestamp: number;
1392
1384
  lastInvalidationTimestamp: number;
1393
- constructor(url: string);
1385
+ /**
1386
+ * @param setIsSelfAccepting - set `false` to set `isSelfAccepting` later. e.g. #7870
1387
+ */
1388
+ constructor(url: string, setIsSelfAccepting?: boolean);
1394
1389
  }
1395
1390
 
1396
1391
  export declare function normalizePath(id: string): string;
@@ -1568,6 +1563,7 @@ export declare interface PluginContainer {
1568
1563
  getModuleInfo(id: string): ModuleInfo | null;
1569
1564
  buildStart(options: InputOptions): Promise<void>;
1570
1565
  resolveId(id: string, importer?: string, options?: {
1566
+ custom?: CustomPluginOptions;
1571
1567
  skip?: Set<Plugin_2>;
1572
1568
  ssr?: boolean;
1573
1569
  /* Excluded from this release type: scan */
@@ -1674,7 +1670,7 @@ export declare type ResolvedConfig = Readonly<Omit<UserConfig, 'plugins' | 'asse
1674
1670
  server: ResolvedServerOptions;
1675
1671
  build: ResolvedBuildOptions;
1676
1672
  preview: ResolvedPreviewOptions;
1677
- ssr: ResolvedSSROptions | undefined;
1673
+ ssr: ResolvedSSROptions;
1678
1674
  assetsInclude: (file: string) => boolean;
1679
1675
  logger: Logger;
1680
1676
  createResolver: (options?: Partial<InternalResolveOptions>) => ResolveFn;
@@ -1696,6 +1692,7 @@ export declare interface ResolvedServerOptions extends ServerOptions {
1696
1692
  export declare interface ResolvedSSROptions extends SSROptions {
1697
1693
  target: SSRTarget;
1698
1694
  format: SSRFormat;
1695
+ optimizeDeps: SsrDepOptimizationOptions;
1699
1696
  }
1700
1697
 
1701
1698
  export declare type ResolvedUrl = [
@@ -1986,6 +1983,13 @@ export declare interface ServerOptions extends CommonServerOptions {
1986
1983
  * @default true
1987
1984
  */
1988
1985
  preTransformRequests?: boolean;
1986
+ /**
1987
+ * Force dep pre-optimization regardless of whether deps have changed.
1988
+ *
1989
+ * @deprecated Use optimizeDeps.force instead, this option may be removed
1990
+ * in a future minor version without following semver
1991
+ */
1992
+ force?: boolean;
1989
1993
  }
1990
1994
 
1991
1995
  export declare function sortUserPlugins(plugins: (Plugin_2 | Plugin_2[])[] | undefined): [Plugin_2[], Plugin_2[], Plugin_2[]];
@@ -2002,11 +2006,13 @@ export declare class SplitVendorChunkCache {
2002
2006
 
2003
2007
  export declare function splitVendorChunkPlugin(): Plugin_2;
2004
2008
 
2009
+ export declare type SsrDepOptimizationOptions = DepOptimizationConfig;
2010
+
2005
2011
  export declare type SSRFormat = 'esm' | 'cjs';
2006
2012
 
2007
2013
  export declare interface SSROptions {
2008
- external?: string[];
2009
2014
  noExternal?: string | RegExp | (string | RegExp)[] | true;
2015
+ external?: string[];
2010
2016
  /**
2011
2017
  * Define the target for the ssr build. The browser field in package.json
2012
2018
  * is ignored for node but used if webworker is the target
@@ -2021,6 +2027,15 @@ export declare interface SSROptions {
2021
2027
  * @experimental
2022
2028
  */
2023
2029
  format?: SSRFormat;
2030
+ /**
2031
+ * Control over which dependencies are optimized during SSR and esbuild options
2032
+ * During build:
2033
+ * no external CJS dependencies are optimized by default
2034
+ * During dev:
2035
+ * explicit no external CJS dependencies are optimized by default
2036
+ * @experimental
2037
+ */
2038
+ optimizeDeps?: SsrDepOptimizationOptions;
2024
2039
  }
2025
2040
 
2026
2041
  export declare type SSRTarget = 'node' | 'webworker';
@@ -1,4 +1,4 @@
1
- export { b as build, j as createFilter, q as createLogger, c as createServer, d as defineConfig, f as formatPostcssSourceMap, i as isDepsOptimizerEnabled, l as loadConfigFromFile, v as loadEnv, h as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, p as preview, g as resolveBaseUrl, e as resolveConfig, w as resolveEnvPrefix, a as resolvePackageData, r as resolvePackageEntry, u as searchForWorkspaceRoot, k as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-332aa27f.js';
1
+ export { b as build, k as createFilter, u as createLogger, c as createServer, d as defineConfig, f as formatPostcssSourceMap, h as getDepOptimizationConfig, i as isDepsOptimizerEnabled, l as loadConfigFromFile, w as loadEnv, j as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, p as preview, g as resolveBaseUrl, e as resolveConfig, x as resolveEnvPrefix, a as resolvePackageData, r as resolvePackageEntry, v as searchForWorkspaceRoot, q as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-5ccc5f38.js';
2
2
  export { VERSION as version } from './constants.js';
3
3
  export { version as esbuildVersion } from 'esbuild';
4
4
  export { VERSION as rollupVersion } from 'rollup';
@@ -31,7 +31,7 @@ var require$$1__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$1$1);
31
31
  var readline__default = /*#__PURE__*/_interopDefaultLegacy(readline);
32
32
  var require$$2__default = /*#__PURE__*/_interopDefaultLegacy(require$$2);
33
33
 
34
- var version = "3.0.0-beta.5";
34
+ var version = "3.0.0-beta.8";
35
35
 
36
36
  const VERSION = version;
37
37
  const VITE_PACKAGE_DIR = path$3.resolve(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite",
3
- "version": "3.0.0-beta.5",
3
+ "version": "3.0.0-beta.8",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Evan You",
@@ -20,7 +20,8 @@
20
20
  "./client": {
21
21
  "types": "./client.d.ts"
22
22
  },
23
- "./dist/client/*": "./dist/client/*"
23
+ "./dist/client/*": "./dist/client/*",
24
+ "./package.json": "./package.json"
24
25
  },
25
26
  "files": [
26
27
  "bin",
@@ -67,9 +68,9 @@
67
68
  },
68
69
  "devDependencies": {
69
70
  "@ampproject/remapping": "^2.2.0",
70
- "@babel/parser": "^7.18.5",
71
- "@babel/types": "^7.18.4",
72
- "@jridgewell/trace-mapping": "^0.3.13",
71
+ "@babel/parser": "^7.18.6",
72
+ "@babel/types": "^7.18.7",
73
+ "@jridgewell/trace-mapping": "^0.3.14",
73
74
  "@rollup/plugin-alias": "^3.1.9",
74
75
  "@rollup/plugin-commonjs": "^22.0.1",
75
76
  "@rollup/plugin-dynamic-import-vars": "^1.4.3",
@@ -82,7 +83,7 @@
82
83
  "cac": "^6.7.12",
83
84
  "chokidar": "^3.5.3",
84
85
  "connect": "^3.7.0",
85
- "connect-history-api-fallback": "^1.6.0",
86
+ "connect-history-api-fallback": "^2.0.0",
86
87
  "convert-source-map": "^1.8.0",
87
88
  "cors": "^2.8.5",
88
89
  "cross-spawn": "^7.0.3",
@@ -98,9 +99,8 @@
98
99
  "launch-editor-middleware": "^2.4.0",
99
100
  "magic-string": "^0.26.2",
100
101
  "micromatch": "^4.0.5",
101
- "mlly": "^0.5.3",
102
+ "mlly": "^0.5.4",
102
103
  "mrmime": "^1.0.1",
103
- "node-forge": "^1.3.1",
104
104
  "okie": "^1.0.1",
105
105
  "open": "^8.4.0",
106
106
  "periscopic": "^3.0.4",
@@ -2,8 +2,6 @@
2
2
  "extends": "../../tsconfig.base.json",
3
3
  "include": ["./", "../../types"],
4
4
  "compilerOptions": {
5
- "outDir": "../../dist/client",
6
- "module": "ESNext",
7
5
  "types": [],
8
6
  "lib": ["ESNext", "DOM"],
9
7
  "declaration": false