vite 3.0.0-beta.3 → 3.0.0-beta.6

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-b5bfa135.js';
3
+ import { x as picocolors, q as createLogger, e as resolveConfig } from './chunks/dep-c7f6d0a5.js';
4
4
  import { VERSION } from './constants.js';
5
5
  import 'node:fs';
6
6
  import 'node:path';
@@ -25,7 +25,6 @@ import 'node:dns';
25
25
  import 'resolve';
26
26
  import 'crypto';
27
27
  import 'buffer';
28
- import 'querystring';
29
28
  import 'module';
30
29
  import 'zlib';
31
30
  import 'https';
@@ -33,6 +32,7 @@ import 'tls';
33
32
  import 'node:http';
34
33
  import 'node:https';
35
34
  import 'worker_threads';
35
+ import 'querystring';
36
36
  import 'readline';
37
37
  import 'node:child_process';
38
38
  import 'node:zlib';
@@ -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-b5bfa135.js').then(function (n) { return n.D; });
697
+ const { createServer } = await import('./chunks/dep-c7f6d0a5.js').then(function (n) { return n.D; });
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-b5bfa135.js').then(function (n) { return n.C; });
744
+ const { build } = await import('./chunks/dep-c7f6d0a5.js').then(function (n) { return n.C; });
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-b5bfa135.js').then(function (n) { return n.B; });
768
+ const { optimizeDeps } = await import('./chunks/dep-c7f6d0a5.js').then(function (n) { return n.B; });
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-b5bfa135.js').then(function (n) { return n.E; });
791
+ const { preview } = await import('./chunks/dep-c7f6d0a5.js').then(function (n) { return n.E; });
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.3";
4
+ var version = "3.0.0-beta.6";
5
5
 
6
6
  const VERSION = version;
7
7
  const DEFAULT_MAIN_FIELDS = [
@@ -9,6 +9,15 @@ const DEFAULT_MAIN_FIELDS = [
9
9
  'jsnext:main',
10
10
  'jsnext'
11
11
  ];
12
+ // Support browserslist
13
+ // "defaults and supports es6-module and supports es6-module-dynamic-import",
14
+ const ESBUILD_MODULES_TARGET = [
15
+ 'es2020',
16
+ 'edge88',
17
+ 'firefox78',
18
+ 'chrome87',
19
+ 'safari13' // transpile nullish coalescing
20
+ ];
12
21
  const DEFAULT_EXTENSIONS = [
13
22
  '.mjs',
14
23
  '.js',
@@ -26,7 +35,7 @@ const DEFAULT_CONFIG_FILES = [
26
35
  'vite.config.cts'
27
36
  ];
28
37
  const JS_TYPES_RE = /\.(?:j|t)sx?$|\.mjs$/;
29
- const OPTIMIZABLE_ENTRY_RE = /\.(?:m?js|ts)$/;
38
+ const OPTIMIZABLE_ENTRY_RE = /\.(?:(m|c)?js|ts)$/;
30
39
  const SPECIAL_QUERY_RE = /[\?&](?:worker|sharedworker|raw|url)\b/;
31
40
  /**
32
41
  * Prefix for resolved fs paths, since windows paths may not be valid as URLs.
@@ -106,4 +115,4 @@ const wildcardHosts = new Set([
106
115
  '0000:0000:0000:0000:0000:0000:0000:0000'
107
116
  ]);
108
117
 
109
- export { CLIENT_DIR, CLIENT_ENTRY, CLIENT_PUBLIC_PATH, DEFAULT_ASSETS_RE, DEFAULT_CONFIG_FILES, DEFAULT_EXTENSIONS, DEFAULT_MAIN_FIELDS, DEP_VERSION_RE, ENV_ENTRY, ENV_PUBLIC_PATH, FS_PREFIX, JS_TYPES_RE, KNOWN_ASSET_TYPES, NULL_BYTE_PLACEHOLDER, OPTIMIZABLE_ENTRY_RE, SPECIAL_QUERY_RE, VALID_ID_PREFIX, VERSION, VITE_PACKAGE_DIR, loopbackHosts, wildcardHosts };
118
+ export { CLIENT_DIR, CLIENT_ENTRY, CLIENT_PUBLIC_PATH, DEFAULT_ASSETS_RE, DEFAULT_CONFIG_FILES, DEFAULT_EXTENSIONS, DEFAULT_MAIN_FIELDS, DEP_VERSION_RE, ENV_ENTRY, ENV_PUBLIC_PATH, ESBUILD_MODULES_TARGET, FS_PREFIX, JS_TYPES_RE, KNOWN_ASSET_TYPES, NULL_BYTE_PLACEHOLDER, OPTIMIZABLE_ENTRY_RE, SPECIAL_QUERY_RE, VALID_ID_PREFIX, VERSION, VITE_PACKAGE_DIR, loopbackHosts, wildcardHosts };
@@ -104,26 +104,6 @@ export declare interface AwaitWriteFinishOptions {
104
104
  */
105
105
  export declare function build(inlineConfig?: InlineConfig): Promise<RollupOutput | RollupOutput[] | RollupWatcher>;
106
106
 
107
- export declare type BuildAdvancedBaseConfig = BuildAdvancedBaseOptions & {
108
- /**
109
- * Base for assets and public files in case they should be different
110
- */
111
- assets?: string | BuildAdvancedBaseOptions;
112
- public?: string | BuildAdvancedBaseOptions;
113
- };
114
-
115
- export declare interface BuildAdvancedBaseOptions {
116
- /**
117
- * Relative base. If true, every generated URL is relative and the dist folder
118
- * can be deployed to any base or subdomain. Use this option when the base
119
- * is unkown at build time
120
- * @default false
121
- */
122
- relative?: boolean;
123
- url?: string;
124
- runtime?: (filename: string) => string;
125
- }
126
-
127
107
  export declare interface BuildOptions {
128
108
  /**
129
109
  * Compatibility transform target. The transform is performed with esbuild
@@ -346,6 +326,7 @@ export declare interface CommonServerOptions {
346
326
  export declare interface ConfigEnv {
347
327
  command: 'build' | 'serve';
348
328
  mode: string;
329
+ ssrBuild: boolean;
349
330
  }
350
331
 
351
332
  export declare namespace Connect {
@@ -495,7 +476,7 @@ export declare interface CSSOptions {
495
476
  modules?: CSSModulesOptions | false;
496
477
  preprocessorOptions?: Record<string, any>;
497
478
  postcss?: string | (PostCSS.ProcessOptions & {
498
- plugins?: PostCSS.Plugin[];
479
+ plugins?: PostCSS.AcceptedPlugin[];
499
480
  });
500
481
  /**
501
482
  * Enables css sourcemaps during dev
@@ -638,9 +619,7 @@ export declare interface DepOptimizationResult {
638
619
  }
639
620
 
640
621
  export declare interface DepsOptimizer {
641
- metadata: (options: {
642
- ssr: boolean;
643
- }) => DepOptimizationMetadata;
622
+ metadata: DepOptimizationMetadata;
644
623
  scanProcessing?: Promise<void>;
645
624
  registerMissingImport: (id: string, resolved: string, ssr?: boolean) => OptimizedDepInfo;
646
625
  run: () => void;
@@ -699,11 +678,11 @@ export declare interface ExperimentalOptions {
699
678
  */
700
679
  importGlobRestoreExtension?: boolean;
701
680
  /**
702
- * Build advanced base options. Allow finegrain contol over assets and public files base
681
+ * Allow finegrain contol over assets and public files paths
703
682
  *
704
683
  * @experimental
705
684
  */
706
- buildAdvancedBaseOptions?: BuildAdvancedBaseConfig;
685
+ renderBuiltUrl?: RenderBuiltAssetUrl;
707
686
  /**
708
687
  * Enables support of HMR partial accept via `import.meta.hot.acceptExports`.
709
688
  *
@@ -1227,7 +1206,9 @@ export declare interface InternalResolveOptions extends ResolveOptions {
1227
1206
  isFromTsImporter?: boolean;
1228
1207
  tryEsmOnly?: boolean;
1229
1208
  scan?: boolean;
1230
- getDepsOptimizer?: () => DepsOptimizer | undefined;
1209
+ getDepsOptimizer?: (type: {
1210
+ ssr?: boolean;
1211
+ }) => DepsOptimizer | undefined;
1231
1212
  shouldExternalize?: (id: string) => boolean | undefined;
1232
1213
  }
1233
1214
 
@@ -1380,7 +1361,7 @@ export declare class ModuleGraph {
1380
1361
  * returned as a Set.
1381
1362
  */
1382
1363
  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>;
1383
- ensureEntryFromUrl(rawUrl: string, ssr?: boolean): Promise<ModuleNode>;
1364
+ ensureEntryFromUrl(rawUrl: string, ssr?: boolean, setIsSelfAccepting?: boolean): Promise<ModuleNode>;
1384
1365
  createFileOnlyEntry(file: string): ModuleNode;
1385
1366
  resolveUrl(url: string, ssr?: boolean): Promise<ResolvedUrl>;
1386
1367
  }
@@ -1410,7 +1391,10 @@ export declare class ModuleNode {
1410
1391
  ssrError: Error | null;
1411
1392
  lastHMRTimestamp: number;
1412
1393
  lastInvalidationTimestamp: number;
1413
- constructor(url: string);
1394
+ /**
1395
+ * @param setIsSelfAccepting - set `false` to set `isSelfAccepting` later. e.g. #7870
1396
+ */
1397
+ constructor(url: string, setIsSelfAccepting?: boolean);
1414
1398
  }
1415
1399
 
1416
1400
  export declare function normalizePath(id: string): string;
@@ -1653,19 +1637,24 @@ export declare interface PrunePayload {
1653
1637
  paths: string[]
1654
1638
  }
1655
1639
 
1640
+ export declare type RenderBuiltAssetUrl = (filename: string, type: {
1641
+ type: 'asset' | 'public';
1642
+ hostId: string;
1643
+ hostType: 'js' | 'css' | 'html';
1644
+ ssr: boolean;
1645
+ }) => string | {
1646
+ relative?: boolean;
1647
+ runtime?: string;
1648
+ } | undefined;
1649
+
1656
1650
  /**
1657
1651
  * Resolve base url. Note that some users use Vite to build for non-web targets like
1658
1652
  * electron or expects to deploy
1659
1653
  */
1660
- export declare function resolveBaseUrl(base: string | undefined, isBuild: boolean, logger: Logger, optionName: string): string;
1654
+ export declare function resolveBaseUrl(base: string | undefined, isBuild: boolean, logger: Logger): string;
1661
1655
 
1662
1656
  export declare function resolveConfig(inlineConfig: InlineConfig, command: 'build' | 'serve', defaultMode?: string): Promise<ResolvedConfig>;
1663
1657
 
1664
- export declare type ResolvedBuildAdvancedBaseConfig = BuildAdvancedBaseOptions & {
1665
- assets: BuildAdvancedBaseOptions;
1666
- public: BuildAdvancedBaseOptions;
1667
- };
1668
-
1669
1658
  export declare type ResolvedBuildOptions = Required<BuildOptions>;
1670
1659
 
1671
1660
  export declare type ResolvedConfig = Readonly<Omit<UserConfig, 'plugins' | 'assetsInclude' | 'optimizeDeps' | 'worker'> & {
@@ -1697,13 +1686,9 @@ export declare type ResolvedConfig = Readonly<Omit<UserConfig, 'plugins' | 'asse
1697
1686
  /* Excluded from this release type: packageCache */
1698
1687
  worker: ResolveWorkerOptions;
1699
1688
  appType: AppType;
1700
- experimental: ResolvedExperimentalOptions;
1689
+ experimental: ExperimentalOptions;
1701
1690
  }>;
1702
1691
 
1703
- export declare type ResolvedExperimentalOptions = Required<ExperimentalOptions> & {
1704
- buildAdvancedBaseOptions: ResolvedBuildAdvancedBaseConfig;
1705
- };
1706
-
1707
1692
  export declare interface ResolvedPreviewOptions extends PreviewOptions {
1708
1693
  }
1709
1694
 
@@ -2005,6 +1990,13 @@ export declare interface ServerOptions extends CommonServerOptions {
2005
1990
  * @default true
2006
1991
  */
2007
1992
  preTransformRequests?: boolean;
1993
+ /**
1994
+ * Force dep pre-optimization regardless of whether deps have changed.
1995
+ *
1996
+ * @deprecated Use optimizeDeps.force instead, this option may be removed
1997
+ * in a future minor version without following semver
1998
+ */
1999
+ force?: boolean;
2008
2000
  }
2009
2001
 
2010
2002
  export declare function sortUserPlugins(plugins: (Plugin_2 | Plugin_2[])[] | undefined): [Plugin_2[], Plugin_2[], Plugin_2[]];
@@ -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-b5bfa135.js';
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-c7f6d0a5.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';
@@ -26,7 +26,6 @@ import 'node:dns';
26
26
  import 'resolve';
27
27
  import 'crypto';
28
28
  import 'buffer';
29
- import 'querystring';
30
29
  import 'module';
31
30
  import 'zlib';
32
31
  import 'https';
@@ -34,6 +33,7 @@ import 'tls';
34
33
  import 'node:http';
35
34
  import 'node:https';
36
35
  import 'worker_threads';
36
+ import 'querystring';
37
37
  import 'readline';
38
38
  import 'node:child_process';
39
39
  import 'node:zlib';
@@ -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.3";
34
+ var version = "3.0.0-beta.6";
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.3",
3
+ "version": "3.0.0-beta.6",
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",
@@ -57,7 +58,7 @@
57
58
  },
58
59
  "//": "READ CONTRIBUTING.md to understand what to put under deps vs. devDeps!",
59
60
  "dependencies": {
60
- "esbuild": "^0.14.43",
61
+ "esbuild": "^0.14.47",
61
62
  "postcss": "^8.4.14",
62
63
  "resolve": "^1.22.1",
63
64
  "rollup": "^2.75.6"
@@ -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,7 +99,7 @@
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
104
  "node-forge": "^1.3.1",
104
105
  "okie": "^1.0.1",
@@ -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