vite 6.0.0-beta.5 → 6.0.0-beta.7

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,6 +1,6 @@
1
1
  export { parseAst, parseAstAsync } from 'rollup/parseAst';
2
- import { i as isInNodeModules, a as arraify } from './chunks/dep-BW_D9zgJ.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-BW_D9zgJ.js';
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';
4
4
  export { VERSION as version } from './constants.js';
5
5
  export { version as esbuildVersion } from 'esbuild';
6
6
  import 'node:fs';
@@ -21,6 +21,7 @@ import 'net';
21
21
  import 'events';
22
22
  import 'url';
23
23
  import 'http';
24
+ import 'fs/promises';
24
25
  import 'stream';
25
26
  import 'os';
26
27
  import 'child_process';
@@ -28,15 +29,15 @@ import 'node:os';
28
29
  import 'node:crypto';
29
30
  import 'node:dns';
30
31
  import 'vite/module-runner';
32
+ import 'module';
31
33
  import 'node:readline';
32
34
  import 'node:process';
33
35
  import 'node:buffer';
34
- import 'node:events';
35
36
  import 'crypto';
36
- import 'module';
37
37
  import 'node:assert';
38
38
  import 'node:v8';
39
39
  import 'node:worker_threads';
40
+ import 'node:events';
40
41
  import 'zlib';
41
42
  import 'buffer';
42
43
  import 'https';
@@ -17,11 +17,17 @@ function isPrimitive(value) {
17
17
  return !value || typeof value != "object" && typeof value != "function";
18
18
  }
19
19
  const AsyncFunction = async function() {
20
- }.constructor, asyncFunctionDeclarationPaddingLineCount = /* @__PURE__ */ (() => {
21
- const body = "/*code*/", source = new AsyncFunction("a", "b", body).toString();
22
- return source.slice(0, source.indexOf(body)).split(`
20
+ }.constructor;
21
+ let asyncFunctionDeclarationPaddingLineCount;
22
+ function getAsyncFunctionDeclarationPaddingLineCount() {
23
+ if (typeof asyncFunctionDeclarationPaddingLineCount > "u") {
24
+ const body = "/*code*/", source = new AsyncFunction("a", "b", body).toString();
25
+ asyncFunctionDeclarationPaddingLineCount = source.slice(0, source.indexOf(body)).split(`
23
26
  `).length - 1;
24
- })(), _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
27
+ }
28
+ return asyncFunctionDeclarationPaddingLineCount;
29
+ }
30
+ const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
25
31
  function normalizeWindowsPath(input = "") {
26
32
  return input && input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
27
33
  }
@@ -1052,7 +1058,7 @@ function exportAll(exports, sourceModule) {
1052
1058
  }
1053
1059
  }
1054
1060
  class ESModulesEvaluator {
1055
- startOffset = asyncFunctionDeclarationPaddingLineCount;
1061
+ startOffset = getAsyncFunctionDeclarationPaddingLineCount();
1056
1062
  async runInlinedModule(context, code) {
1057
1063
  await new AsyncFunction(
1058
1064
  ssrModuleExportsKey,
@@ -3568,7 +3568,10 @@ const filter = process.env.VITE_DEBUG_FILTER;
3568
3568
  const DEBUG = process.env.DEBUG;
3569
3569
  function createDebugger(namespace, options = {}) {
3570
3570
  const log = debug$2(namespace);
3571
- const { onlyWhenFocused } = options;
3571
+ const { onlyWhenFocused, depth } = options;
3572
+ if (depth && log.inspectOpts.depth == null) {
3573
+ log.inspectOpts.depth = options.depth;
3574
+ }
3572
3575
  let enabled = log.enabled;
3573
3576
  if (enabled && onlyWhenFocused) {
3574
3577
  const ns = typeof onlyWhenFocused === "string" ? onlyWhenFocused : namespace;
@@ -5650,7 +5653,11 @@ function createLogger(level = "info", options = {}) {
5650
5653
  return options.customLogger;
5651
5654
  }
5652
5655
  const loggedErrors = /* @__PURE__ */ new WeakSet();
5653
- const { prefix = "[vite]", allowClearScreen = true } = options;
5656
+ const {
5657
+ prefix = "[vite]",
5658
+ allowClearScreen = true,
5659
+ console: console2 = globalThis.console
5660
+ } = options;
5654
5661
  const thresh = LogLevels[level];
5655
5662
  const canClearScreen = allowClearScreen && process.stdout.isTTY && !process.env.CI;
5656
5663
  const clear = canClearScreen ? clearScreen : () => {
@@ -5681,7 +5688,7 @@ function createLogger(level = "info", options = {}) {
5681
5688
  if (type === lastType && msg === lastMsg) {
5682
5689
  sameCount++;
5683
5690
  clear();
5684
- console[method](
5691
+ console2[method](
5685
5692
  format(type, msg, options2),
5686
5693
  colors.yellow(`(x${sameCount + 1})`)
5687
5694
  );
@@ -5692,10 +5699,10 @@ function createLogger(level = "info", options = {}) {
5692
5699
  if (options2.clear) {
5693
5700
  clear();
5694
5701
  }
5695
- console[method](format(type, msg, options2));
5702
+ console2[method](format(type, msg, options2));
5696
5703
  }
5697
5704
  } else {
5698
- console[method](format(type, msg, options2));
5705
+ console2[method](format(type, msg, options2));
5699
5706
  }
5700
5707
  }
5701
5708
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite",
3
- "version": "6.0.0-beta.5",
3
+ "version": "6.0.0-beta.7",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Evan You",
@@ -40,6 +40,7 @@
40
40
  "./types/*": {
41
41
  "types": "./types/*"
42
42
  },
43
+ "./types/internal/*": null,
43
44
  "./package.json": "./package.json"
44
45
  },
45
46
  "typesVersions": {
@@ -76,25 +77,22 @@
76
77
  "postcss": "^8.4.47",
77
78
  "rollup": "^4.23.0"
78
79
  },
79
- "optionalDependencies": {
80
- "fsevents": "~2.3.3"
81
- },
82
80
  "devDependencies": {
83
81
  "@ampproject/remapping": "^2.3.0",
84
- "@babel/parser": "^7.25.8",
82
+ "@babel/parser": "^7.26.1",
85
83
  "@jridgewell/trace-mapping": "^0.3.25",
86
84
  "@polka/compression": "^1.0.0-next.25",
87
85
  "@rollup/plugin-alias": "^5.1.1",
88
86
  "@rollup/plugin-commonjs": "^28.0.1",
89
- "@rollup/plugin-dynamic-import-vars": "^2.1.4",
87
+ "@rollup/plugin-dynamic-import-vars": "2.1.4",
90
88
  "@rollup/plugin-json": "^6.1.0",
91
89
  "@rollup/plugin-node-resolve": "15.3.0",
92
- "@rollup/pluginutils": "^5.1.2",
90
+ "@rollup/pluginutils": "^5.1.3",
93
91
  "@types/escape-html": "^1.0.4",
94
92
  "@types/pnpapi": "^0.0.5",
95
93
  "artichokie": "^0.2.1",
96
94
  "cac": "^6.7.14",
97
- "chokidar": "^3.6.0",
95
+ "chokidar": "^4.0.1",
98
96
  "connect": "^3.7.0",
99
97
  "convert-source-map": "^2.0.0",
100
98
  "cors": "^2.8.5",
@@ -111,7 +109,6 @@
111
109
  "launch-editor-middleware": "^2.9.1",
112
110
  "lightningcss": "^1.27.0",
113
111
  "magic-string": "^0.30.12",
114
- "micromatch": "^4.0.8",
115
112
  "mlly": "^1.7.2",
116
113
  "mrmime": "^2.0.0",
117
114
  "nanoid": "^5.0.7",
@@ -122,19 +119,19 @@
122
119
  "picocolors": "^1.1.1",
123
120
  "picomatch": "^4.0.2",
124
121
  "postcss-import": "^16.1.0",
125
- "postcss-load-config": "^4.0.2",
122
+ "postcss-load-config": "^6.0.1",
126
123
  "postcss-modules": "^6.0.0",
127
124
  "resolve.exports": "^2.0.2",
128
125
  "rollup-plugin-dts": "^6.1.1",
129
126
  "rollup-plugin-esbuild": "^6.1.1",
130
127
  "rollup-plugin-license": "^3.5.3",
131
- "sass": "^1.80.3",
132
- "sass-embedded": "^1.80.3",
128
+ "sass": "^1.80.4",
129
+ "sass-embedded": "^1.80.4",
133
130
  "sirv": "^3.0.0",
134
131
  "source-map-support": "^0.5.21",
135
132
  "strip-ansi": "^7.1.0",
136
133
  "strip-literal": "^2.1.0",
137
- "tinyglobby": "^0.2.9",
134
+ "tinyglobby": "^0.2.10",
138
135
  "tsconfck": "^3.1.4",
139
136
  "tslib": "^2.8.0",
140
137
  "types": "link:./types",
@@ -143,18 +140,24 @@
143
140
  },
144
141
  "peerDependencies": {
145
142
  "@types/node": "^18.0.0 || >=20.0.0",
143
+ "jiti": ">=1.21.0",
146
144
  "less": "*",
147
145
  "lightningcss": "^1.21.0",
148
146
  "sass": "*",
149
147
  "sass-embedded": "*",
150
148
  "stylus": "*",
151
149
  "sugarss": "*",
152
- "terser": "^5.16.0"
150
+ "terser": "^5.16.0",
151
+ "tsx": "^4.8.1",
152
+ "yaml": "^2.4.2"
153
153
  },
154
154
  "peerDependenciesMeta": {
155
155
  "@types/node": {
156
156
  "optional": true
157
157
  },
158
+ "jiti": {
159
+ "optional": true
160
+ },
158
161
  "sass": {
159
162
  "optional": true
160
163
  },
@@ -175,15 +178,21 @@
175
178
  },
176
179
  "terser": {
177
180
  "optional": true
181
+ },
182
+ "tsx": {
183
+ "optional": true
184
+ },
185
+ "yaml": {
186
+ "optional": true
178
187
  }
179
188
  },
180
189
  "scripts": {
181
190
  "dev": "tsx scripts/dev.ts",
182
- "build": "rimraf dist && pnpm build-bundle && pnpm build-types",
191
+ "build": "premove dist && pnpm build-bundle && pnpm build-types",
183
192
  "build-bundle": "rollup --config rollup.config.ts --configPlugin esbuild",
184
193
  "build-types": "pnpm build-types-temp && pnpm build-types-roll && pnpm build-types-check",
185
194
  "build-types-temp": "tsc --emitDeclarationOnly --outDir temp -p src/node",
186
- "build-types-roll": "rollup --config rollup.dts.config.ts --configPlugin esbuild && rimraf temp",
195
+ "build-types-roll": "rollup --config rollup.dts.config.ts --configPlugin esbuild && premove temp",
187
196
  "build-types-check": "tsc --project tsconfig.check.json",
188
197
  "typecheck": "tsc --noEmit && tsc --noEmit -p src/node",
189
198
  "lint": "eslint --cache --ext .ts src/**",
@@ -1,7 +1,9 @@
1
1
  /* eslint-disable @typescript-eslint/ban-ts-comment */
2
2
 
3
3
  // @ts-ignore `sass` may not be installed
4
- import type Sass from 'sass'
4
+ import type DartSass from 'sass'
5
+ // @ts-ignore `sass-embedded` may not be installed
6
+ import type SassEmbedded from 'sass-embedded'
5
7
  // @ts-ignore `less` may not be installed
6
8
  import type Less from 'less'
7
9
  // @ts-ignore `less` may not be installed
@@ -9,8 +11,19 @@ import type Stylus from 'stylus'
9
11
 
10
12
  /* eslint-enable @typescript-eslint/ban-ts-comment */
11
13
 
14
+ // https://github.com/type-challenges/type-challenges/issues/29285
15
+ type IsAny<T> = boolean extends (T extends never ? true : false) ? true : false
16
+
17
+ type DartSassLegacyStringOptionsAsync = DartSass.LegacyStringOptions<'async'>
18
+ type SassEmbeddedLegacyStringOptionsAsync =
19
+ SassEmbedded.LegacyStringOptions<'async'>
20
+ type SassLegacyStringOptionsAsync =
21
+ IsAny<DartSassLegacyStringOptionsAsync> extends false
22
+ ? DartSassLegacyStringOptionsAsync
23
+ : SassEmbeddedLegacyStringOptionsAsync
24
+
12
25
  export type SassLegacyPreprocessBaseOptions = Omit<
13
- Sass.LegacyStringOptions<'async'>,
26
+ SassLegacyStringOptionsAsync,
14
27
  | 'data'
15
28
  | 'file'
16
29
  | 'outFile'
@@ -20,8 +33,15 @@ export type SassLegacyPreprocessBaseOptions = Omit<
20
33
  | 'sourceMapRoot'
21
34
  >
22
35
 
36
+ type DartSassStringOptionsAsync = DartSass.StringOptions<'async'>
37
+ type SassEmbeddedStringOptionsAsync = SassEmbedded.StringOptions<'async'>
38
+ type SassStringOptionsAsync =
39
+ IsAny<DartSassStringOptionsAsync> extends false
40
+ ? DartSassStringOptionsAsync
41
+ : SassEmbeddedStringOptionsAsync
42
+
23
43
  export type SassModernPreprocessBaseOptions = Omit<
24
- Sass.StringOptions<'async'>,
44
+ SassStringOptionsAsync,
25
45
  'url' | 'sourceMap'
26
46
  >
27
47
 
@@ -0,0 +1,18 @@
1
+ /* eslint-disable @typescript-eslint/ban-ts-comment */
2
+
3
+ // @ts-ignore `sass` may not be installed
4
+ import type Lightningcss from 'lightningcss'
5
+
6
+ /* eslint-enable @typescript-eslint/ban-ts-comment */
7
+
8
+ export type LightningCSSOptions = Omit<
9
+ Lightningcss.BundleAsyncOptions<Lightningcss.CustomAtRules>,
10
+ | 'filename'
11
+ | 'resolver'
12
+ | 'minify'
13
+ | 'sourceMap'
14
+ | 'analyzeDependencies'
15
+ // properties not overridden by Vite, but does not make sense to set by end users
16
+ | 'inputSourceMap'
17
+ | 'projectRoot'
18
+ >