vite 4.0.4 → 4.1.0-beta.1

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.

@@ -950,15 +950,15 @@ function hasUnescapedText(tn, scriptingEnabled) {
950
950
 
951
951
  var html = {
952
952
  __proto__: null,
953
- get NS () { return NS; },
954
953
  get ATTRS () { return ATTRS; },
955
954
  get DOCUMENT_MODE () { return DOCUMENT_MODE; },
956
- get TAG_NAMES () { return TAG_NAMES; },
955
+ get NS () { return NS; },
956
+ SPECIAL_ELEMENTS: SPECIAL_ELEMENTS,
957
957
  get TAG_ID () { return TAG_ID; },
958
+ get TAG_NAMES () { return TAG_NAMES; },
958
959
  getTagID: getTagID,
959
- SPECIAL_ELEMENTS: SPECIAL_ELEMENTS,
960
- isNumberedHeader: isNumberedHeader,
961
- hasUnescapedText: hasUnescapedText
960
+ hasUnescapedText: hasUnescapedText,
961
+ isNumberedHeader: isNumberedHeader
962
962
  };
963
963
 
964
964
  //C1 Unicode control character reference replacements
@@ -4797,11 +4797,11 @@ function isIntegrationPoint(tn, ns, attrs, foreignNS) {
4797
4797
  var foreignContent = {
4798
4798
  __proto__: null,
4799
4799
  SVG_TAG_NAMES_ADJUSTMENT_MAP: SVG_TAG_NAMES_ADJUSTMENT_MAP,
4800
- causesExit: causesExit,
4801
4800
  adjustTokenMathMLAttrs: adjustTokenMathMLAttrs,
4802
4801
  adjustTokenSVGAttrs: adjustTokenSVGAttrs,
4803
- adjustTokenXMLAttrs: adjustTokenXMLAttrs,
4804
4802
  adjustTokenSVGTagName: adjustTokenSVGTagName,
4803
+ adjustTokenXMLAttrs: adjustTokenXMLAttrs,
4804
+ causesExit: causesExit,
4805
4805
  isIntegrationPoint: isIntegrationPoint
4806
4806
  };
4807
4807
 
@@ -0,0 +1,43 @@
1
+ import { fileURLToPath as __cjs_fileURLToPath } from 'node:url';
2
+ import { dirname as __cjs_dirname } from 'node:path';
3
+ import { createRequire as __cjs_createRequire } from 'node:module';
4
+
5
+ const __filename = __cjs_fileURLToPath(import.meta.url);
6
+ const __dirname = __cjs_dirname(__filename);
7
+ const require = __cjs_createRequire(import.meta.url);
8
+ const __require = require;
9
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
10
+
11
+ function getDefaultExportFromCjs (x) {
12
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
13
+ }
14
+
15
+ function getAugmentedNamespace(n) {
16
+ if (n.__esModule) return n;
17
+ var f = n.default;
18
+ if (typeof f == "function") {
19
+ var a = function a () {
20
+ if (this instanceof a) {
21
+ var args = [null];
22
+ args.push.apply(args, arguments);
23
+ var Ctor = Function.bind.apply(f, args);
24
+ return new Ctor();
25
+ }
26
+ return f.apply(this, arguments);
27
+ };
28
+ a.prototype = f.prototype;
29
+ } else a = {};
30
+ Object.defineProperty(a, '__esModule', {value: true});
31
+ Object.keys(n).forEach(function (k) {
32
+ var d = Object.getOwnPropertyDescriptor(n, k);
33
+ Object.defineProperty(a, k, d.get ? d : {
34
+ enumerable: true,
35
+ get: function () {
36
+ return n[k];
37
+ }
38
+ });
39
+ });
40
+ return a;
41
+ }
42
+
43
+ export { getAugmentedNamespace as a, commonjsGlobal as c, getDefaultExportFromCjs as g };
@@ -1,6 +1,6 @@
1
1
  import require$$0__default from 'fs';
2
2
  import require$$0 from 'postcss';
3
- import { C as commonjsGlobal } from './dep-5e7f419b.js';
3
+ import { c as commonjsGlobal } from './dep-ace95160.js';
4
4
  import require$$0$1 from 'path';
5
5
  import require$$5 from 'crypto';
6
6
  import require$$0$2 from 'util';
@@ -7669,8 +7669,8 @@ var postcss = buildExports.postcss = true;
7669
7669
 
7670
7670
  var index = /*#__PURE__*/_mergeNamespaces({
7671
7671
  __proto__: null,
7672
- postcss: postcss,
7673
- get default () { return buildExports; }
7672
+ get default () { return buildExports; },
7673
+ postcss: postcss
7674
7674
  }, [buildExports]);
7675
7675
 
7676
7676
  export { index as i };
package/dist/node/cli.js CHANGED
@@ -2,13 +2,14 @@ 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 { A as picocolorsExports, B as bindShortcuts, w as createLogger, h as resolveConfig } from './chunks/dep-5e7f419b.js';
5
+ import { A as picocolorsExports, B as bindShortcuts, w as createLogger, h as resolveConfig } from './chunks/dep-387affca.js';
6
6
  import { VERSION } from './constants.js';
7
7
  import 'node:url';
8
8
  import 'node:module';
9
9
  import 'tty';
10
10
  import 'esbuild';
11
11
  import 'path';
12
+ import './chunks/dep-ace95160.js';
12
13
  import 'fs';
13
14
  import 'assert';
14
15
  import 'util';
@@ -26,8 +27,12 @@ import 'resolve';
26
27
  import 'crypto';
27
28
  import 'node:buffer';
28
29
  import 'module';
30
+ import 'node:assert';
31
+ import 'node:process';
32
+ import 'node:v8';
29
33
  import 'worker_threads';
30
34
  import 'zlib';
35
+ import 'buffer';
31
36
  import 'https';
32
37
  import 'tls';
33
38
  import 'node:http';
@@ -724,7 +729,7 @@ cli
724
729
  filterDuplicateOptions(options);
725
730
  // output structure is preserved even after bundling so require()
726
731
  // is ok here
727
- const { createServer } = await import('./chunks/dep-5e7f419b.js').then(function (n) { return n.F; });
732
+ const { createServer } = await import('./chunks/dep-387affca.js').then(function (n) { return n.E; });
728
733
  try {
729
734
  const server = await createServer({
730
735
  root,
@@ -802,7 +807,7 @@ cli
802
807
  .option('-w, --watch', `[boolean] rebuilds when modules have changed on disk`)
803
808
  .action(async (root, options) => {
804
809
  filterDuplicateOptions(options);
805
- const { build } = await import('./chunks/dep-5e7f419b.js').then(function (n) { return n.E; });
810
+ const { build } = await import('./chunks/dep-387affca.js').then(function (n) { return n.D; });
806
811
  const buildOptions = cleanOptions(options);
807
812
  try {
808
813
  await build({
@@ -830,7 +835,7 @@ cli
830
835
  .option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
831
836
  .action(async (root, options) => {
832
837
  filterDuplicateOptions(options);
833
- const { optimizeDeps } = await import('./chunks/dep-5e7f419b.js').then(function (n) { return n.D; });
838
+ const { optimizeDeps } = await import('./chunks/dep-387affca.js').then(function (n) { return n.C; });
834
839
  try {
835
840
  const config = await resolveConfig({
836
841
  root,
@@ -855,7 +860,7 @@ cli
855
860
  .option('--outDir <dir>', `[string] output directory (default: dist)`)
856
861
  .action(async (root, options) => {
857
862
  filterDuplicateOptions(options);
858
- const { preview } = await import('./chunks/dep-5e7f419b.js').then(function (n) { return n.G; });
863
+ const { preview } = await import('./chunks/dep-387affca.js').then(function (n) { return n.F; });
859
864
  try {
860
865
  const server = await preview({
861
866
  root,
@@ -117,5 +117,7 @@ const wildcardHosts = new Set([
117
117
  '::',
118
118
  '0000:0000:0000:0000:0000:0000:0000:0000',
119
119
  ]);
120
+ const DEFAULT_DEV_PORT = 5173;
121
+ const DEFAULT_PREVIEW_PORT = 4173;
120
122
 
121
- export { CLIENT_DIR, CLIENT_ENTRY, CLIENT_PUBLIC_PATH, CSS_LANGS_RE, 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 };
123
+ export { CLIENT_DIR, CLIENT_ENTRY, CLIENT_PUBLIC_PATH, CSS_LANGS_RE, 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, 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 };
@@ -2,6 +2,7 @@
2
2
 
3
3
  import type { Agent } from 'node:http';
4
4
  import type { BuildOptions as BuildOptions_2 } from 'esbuild';
5
+ import { ChunkMetadata } from "../../types/metadata";
5
6
  import type { ClientRequest } from 'node:http';
6
7
  import type { ClientRequestArgs } from 'node:http';
7
8
  import { ConnectedPayload } from "../../types/hmrPayload";
@@ -212,7 +213,7 @@ export declare interface BuildOptions {
212
213
  terserOptions?: Terser.MinifyOptions;
213
214
  /**
214
215
  * Will be merged with internal rollup options.
215
- * https://rollupjs.org/guide/en/#big-list-of-options
216
+ * https://rollupjs.org/configuration-options/
216
217
  */
217
218
  rollupOptions?: RollupOptions;
218
219
  /**
@@ -275,6 +276,12 @@ export declare interface BuildOptions {
275
276
  * directives in production.
276
277
  */
277
278
  ssrManifest?: boolean | string;
279
+ /**
280
+ * Emit assets during SSR.
281
+ * @experimental
282
+ * @default false
283
+ */
284
+ ssrEmitAssets?: boolean;
278
285
  /**
279
286
  * Set to false to disable reporting compressed chunk sizes.
280
287
  * Can slightly improve build speed.
@@ -287,15 +294,12 @@ export declare interface BuildOptions {
287
294
  chunkSizeWarningLimit?: number;
288
295
  /**
289
296
  * Rollup watch options
290
- * https://rollupjs.org/guide/en/#watchoptions
297
+ * https://rollupjs.org/configuration-options/#watch
291
298
  */
292
299
  watch?: WatcherOptions | null;
293
300
  }
294
301
 
295
- export declare interface ChunkMetadata {
296
- importedAssets: Set<string>;
297
- importedCss: Set<string>;
298
- }
302
+ export { ChunkMetadata }
299
303
 
300
304
  export declare interface CommonServerOptions {
301
305
  /**
@@ -705,6 +709,14 @@ export declare interface ExperimentalOptions {
705
709
  * @default false
706
710
  */
707
711
  hmrPartialAccept?: boolean;
712
+ /**
713
+ * Skips SSR transform to make it easier to use Vite with Node ESM loaders.
714
+ * @warning Enabling this will break normal operation of Vite's SSR in development mode.
715
+ *
716
+ * @experimental
717
+ * @default false
718
+ */
719
+ skipSsrTransform?: boolean;
708
720
  }
709
721
 
710
722
  export declare type ExportsData = {
@@ -1296,7 +1308,7 @@ export declare class ModuleGraph {
1296
1308
  getModuleById(id: string): ModuleNode | undefined;
1297
1309
  getModulesByFile(file: string): Set<ModuleNode> | undefined;
1298
1310
  onFileChange(file: string): void;
1299
- invalidateModule(mod: ModuleNode, seen?: Set<ModuleNode>, timestamp?: number): void;
1311
+ invalidateModule(mod: ModuleNode, seen?: Set<ModuleNode>, timestamp?: number, isHmr?: boolean): void;
1300
1312
  invalidateAll(): void;
1301
1313
  /**
1302
1314
  * Update the module graph based on a module's updated imports information
@@ -2437,7 +2449,7 @@ export declare interface UserConfig {
2437
2449
  legacy?: LegacyOptions;
2438
2450
  /**
2439
2451
  * Log level.
2440
- * Default: 'info'
2452
+ * @default 'info'
2441
2453
  */
2442
2454
  logLevel?: LogLevel;
2443
2455
  /**
@@ -2445,7 +2457,7 @@ export declare interface UserConfig {
2445
2457
  */
2446
2458
  customLogger?: Logger;
2447
2459
  /**
2448
- * Default: true
2460
+ * @default true
2449
2461
  */
2450
2462
  clearScreen?: boolean;
2451
2463
  /**
@@ -1,4 +1,4 @@
1
- export { b as build, e as buildErrorMessage, u as createFilter, w as createLogger, c as createServer, g as defineConfig, f as formatPostcssSourceMap, j as getDepOptimizationConfig, k as isDepsOptimizerEnabled, l as loadConfigFromFile, y as loadEnv, q as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, a as preprocessCSS, p as preview, i as resolveBaseUrl, h as resolveConfig, z as resolveEnvPrefix, d as resolvePackageData, r as resolvePackageEntry, x as searchForWorkspaceRoot, v as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-5e7f419b.js';
1
+ export { b as build, e as buildErrorMessage, u as createFilter, w as createLogger, c as createServer, g as defineConfig, f as formatPostcssSourceMap, j as getDepOptimizationConfig, k as isDepsOptimizerEnabled, l as loadConfigFromFile, y as loadEnv, q as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, a as preprocessCSS, p as preview, i as resolveBaseUrl, h as resolveConfig, z as resolveEnvPrefix, d as resolvePackageData, r as resolvePackageEntry, x as searchForWorkspaceRoot, v as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-387affca.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';
@@ -9,6 +9,7 @@ import 'node:perf_hooks';
9
9
  import 'node:module';
10
10
  import 'tty';
11
11
  import 'path';
12
+ import './chunks/dep-ace95160.js';
12
13
  import 'fs';
13
14
  import 'events';
14
15
  import 'assert';
@@ -27,8 +28,12 @@ import 'resolve';
27
28
  import 'crypto';
28
29
  import 'node:buffer';
29
30
  import 'module';
31
+ import 'node:assert';
32
+ import 'node:process';
33
+ import 'node:v8';
30
34
  import 'worker_threads';
31
35
  import 'zlib';
36
+ import 'buffer';
32
37
  import 'https';
33
38
  import 'tls';
34
39
  import 'node:http';
@@ -3786,10 +3786,10 @@ function getCodeWithSourcemap(type, code, map) {
3786
3786
  code += `\n/*${JSON.stringify(map, null, 2).replace(/\*\//g, '*\\/')}*/\n`;
3787
3787
  }
3788
3788
  if (type === 'js') {
3789
- code += `\n//# sourceMappingURL=${genSourceMapUrl(map ?? undefined)}`;
3789
+ code += `\n//# sourceMappingURL=${genSourceMapUrl(map)}`;
3790
3790
  }
3791
3791
  else if (type === 'css') {
3792
- code += `\n/*# sourceMappingURL=${genSourceMapUrl(map ?? undefined)} */`;
3792
+ code += `\n/*# sourceMappingURL=${genSourceMapUrl(map)} */`;
3793
3793
  }
3794
3794
  return code;
3795
3795
  }
@@ -4264,6 +4264,13 @@ function loadEnv(mode, envDir, prefixes = 'VITE_') {
4264
4264
  if (parsed.NODE_ENV && process.env.VITE_USER_NODE_ENV === undefined) {
4265
4265
  process.env.VITE_USER_NODE_ENV = parsed.NODE_ENV;
4266
4266
  }
4267
+ // support BROWSER and BROWSER_ARGS env variables
4268
+ if (parsed.BROWSER && process.env.BROWSER === undefined) {
4269
+ process.env.BROWSER = parsed.BROWSER;
4270
+ }
4271
+ if (parsed.BROWSER_ARGS && process.env.BROWSER_ARGS === undefined) {
4272
+ process.env.BROWSER_ARGS = parsed.BROWSER_ARGS;
4273
+ }
4267
4274
  try {
4268
4275
  // let environment variables use each other
4269
4276
  expand_1({ parsed });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite",
3
- "version": "4.0.4",
3
+ "version": "4.1.0-beta.1",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Evan You",
@@ -8,8 +8,15 @@
8
8
  "bin": {
9
9
  "vite": "bin/vite.js"
10
10
  },
11
+ "keywords": [
12
+ "frontend",
13
+ "framework",
14
+ "hmr",
15
+ "dev-server",
16
+ "build-tool",
17
+ "vite"
18
+ ],
11
19
  "main": "./dist/node/index.js",
12
- "module": "./dist/node/index.js",
13
20
  "types": "./dist/node/index.d.ts",
14
21
  "exports": {
15
22
  ".": {
@@ -59,27 +66,27 @@
59
66
  },
60
67
  "//": "READ CONTRIBUTING.md to understand what to put under deps vs. devDeps!",
61
68
  "dependencies": {
62
- "esbuild": "^0.16.3",
63
- "postcss": "^8.4.20",
69
+ "esbuild": "^0.16.14",
70
+ "postcss": "^8.4.21",
64
71
  "resolve": "^1.22.1",
65
- "rollup": "^3.7.0"
72
+ "rollup": "^3.10.0"
66
73
  },
67
74
  "optionalDependencies": {
68
75
  "fsevents": "~2.3.2"
69
76
  },
70
77
  "devDependencies": {
71
78
  "@ampproject/remapping": "^2.2.0",
72
- "@babel/parser": "^7.20.5",
73
- "@babel/types": "^7.20.5",
79
+ "@babel/parser": "^7.20.13",
80
+ "@babel/types": "^7.20.7",
74
81
  "@jridgewell/trace-mapping": "^0.3.17",
75
- "@rollup/plugin-alias": "^4.0.2",
76
- "@rollup/plugin-commonjs": "^24.0.0",
77
- "@rollup/plugin-dynamic-import-vars": "^2.0.1",
82
+ "@rollup/plugin-alias": "^4.0.3",
83
+ "@rollup/plugin-commonjs": "^24.0.1",
84
+ "@rollup/plugin-dynamic-import-vars": "^2.0.3",
78
85
  "@rollup/plugin-json": "^6.0.0",
79
86
  "@rollup/plugin-node-resolve": "15.0.1",
80
- "@rollup/plugin-typescript": "^10.0.1",
87
+ "@rollup/plugin-typescript": "^11.0.0",
81
88
  "@rollup/pluginutils": "^5.0.2",
82
- "acorn": "^8.8.1",
89
+ "acorn": "^8.8.2",
83
90
  "acorn-walk": "^8.2.0",
84
91
  "cac": "^6.7.14",
85
92
  "chokidar": "^3.5.3",
@@ -93,14 +100,15 @@
93
100
  "dotenv": "^16.0.3",
94
101
  "dotenv-expand": "^9.0.0",
95
102
  "es-module-lexer": "^1.1.0",
96
- "estree-walker": "^3.0.1",
103
+ "estree-walker": "^3.0.3",
97
104
  "etag": "^1.8.1",
98
105
  "fast-glob": "^3.2.12",
99
106
  "http-proxy": "^1.18.1",
107
+ "json-stable-stringify": "^1.0.2",
100
108
  "launch-editor-middleware": "^2.6.0",
101
109
  "magic-string": "^0.27.0",
102
110
  "micromatch": "^4.0.5",
103
- "mlly": "^1.0.0",
111
+ "mlly": "^1.1.0",
104
112
  "mrmime": "^1.0.1",
105
113
  "okie": "^1.0.1",
106
114
  "open": "^8.4.0",
@@ -111,18 +119,18 @@
111
119
  "postcss-import": "^15.1.0",
112
120
  "postcss-load-config": "^4.0.1",
113
121
  "postcss-modules": "^6.0.0",
114
- "resolve.exports": "^1.1.0",
122
+ "resolve.exports": "^2.0.0",
115
123
  "rollup-plugin-license": "^3.0.1",
116
124
  "sirv": "^2.0.2",
117
125
  "source-map-js": "^1.0.2",
118
126
  "source-map-support": "^0.5.21",
119
127
  "strip-ansi": "^7.0.1",
120
128
  "strip-literal": "^0.4.2",
121
- "tsconfck": "^2.0.1",
129
+ "tsconfck": "^2.0.2",
122
130
  "tslib": "^2.4.1",
123
131
  "types": "link:./types",
124
132
  "ufo": "^1.0.1",
125
- "ws": "^8.11.0"
133
+ "ws": "^8.12.0"
126
134
  },
127
135
  "peerDependencies": {
128
136
  "@types/node": ">= 14",
@@ -0,0 +1,10 @@
1
+ export interface ChunkMetadata {
2
+ importedAssets: Set<string>
3
+ importedCss: Set<string>
4
+ }
5
+
6
+ declare module 'rollup' {
7
+ export interface RenderedChunk {
8
+ viteMetadata: ChunkMetadata
9
+ }
10
+ }