vite 6.0.0-beta.1 → 6.0.0-beta.10

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/index.cjs CHANGED
@@ -1,3 +1,6 @@
1
+ const description =
2
+ ' See https://vite.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.'
3
+
1
4
  warnCjsUsage()
2
5
 
3
6
  // type utils
@@ -17,12 +20,43 @@ const asyncFunctions = [
17
20
  'formatPostcssSourceMap',
18
21
  'loadConfigFromFile',
19
22
  'preprocessCSS',
23
+ 'createBuilder',
20
24
  ]
21
25
  asyncFunctions.forEach((name) => {
22
26
  module.exports[name] = (...args) =>
23
27
  import('./dist/node/index.js').then((i) => i[name](...args))
24
28
  })
25
29
 
30
+ // variables and sync functions that cannot be used from cjs build
31
+ const disallowedVariables = [
32
+ // was not exposed in cjs from the beginning
33
+ 'parseAst',
34
+ 'parseAstAsync',
35
+ 'buildErrorMessage',
36
+ 'sortUserPlugins',
37
+ // Environment API related variables that are too big to include in the cjs build
38
+ 'DevEnvironment',
39
+ 'BuildEnvironment',
40
+ 'createIdResolver',
41
+ 'createRunnableDevEnvironment',
42
+ // can be redirected from ESM, but doesn't make sense as it's Environment API related
43
+ 'fetchModule',
44
+ 'moduleRunnerTransform',
45
+ // can be exposed, but doesn't make sense as it's Environment API related
46
+ 'createServerHotChannel',
47
+ 'createServerModuleRunner',
48
+ 'isRunnableDevEnvironment',
49
+ ]
50
+ disallowedVariables.forEach((name) => {
51
+ Object.defineProperty(module.exports, name, {
52
+ get() {
53
+ throw new Error(
54
+ `${name} is not available in the CJS build of Vite.` + description,
55
+ )
56
+ },
57
+ })
58
+ })
59
+
26
60
  function warnCjsUsage() {
27
61
  if (process.env.VITE_CJS_IGNORE_WARNING) return
28
62
  const logLevelIndex = process.argv.findIndex((arg) =>
@@ -39,9 +73,7 @@ function warnCjsUsage() {
39
73
  }
40
74
  const yellow = (str) => `\u001b[33m${str}\u001b[39m`
41
75
  console.warn(
42
- yellow(
43
- `The CJS build of Vite's Node API is deprecated. See https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.`,
44
- ),
76
+ yellow("The CJS build of Vite's Node API is deprecated." + description),
45
77
  )
46
78
  if (process.env.VITE_CJS_TRACE) {
47
79
  const e = {}
package/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @deprecated The CJS build of Vite's Node API is deprecated. See https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.
2
+ * @deprecated The CJS build of Vite's Node API is deprecated. See https://vite.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.
3
3
  */
4
4
  declare const module: any
5
5
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite",
3
- "version": "6.0.0-beta.1",
3
+ "version": "6.0.0-beta.10",
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": {
@@ -68,28 +69,28 @@
68
69
  "bugs": {
69
70
  "url": "https://github.com/vitejs/vite/issues"
70
71
  },
71
- "homepage": "https://vitejs.dev",
72
+ "homepage": "https://vite.dev",
72
73
  "funding": "https://github.com/vitejs/vite?sponsor=1",
73
74
  "//": "READ CONTRIBUTING.md to understand what to put under deps vs. devDeps!",
74
75
  "dependencies": {
75
- "esbuild": "^0.21.3",
76
- "postcss": "^8.4.45",
77
- "rollup": "^4.20.0"
76
+ "esbuild": "^0.24.0",
77
+ "postcss": "^8.4.48",
78
+ "rollup": "^4.23.0"
78
79
  },
79
80
  "optionalDependencies": {
80
81
  "fsevents": "~2.3.3"
81
82
  },
82
83
  "devDependencies": {
83
84
  "@ampproject/remapping": "^2.3.0",
84
- "@babel/parser": "^7.25.6",
85
+ "@babel/parser": "^7.26.2",
85
86
  "@jridgewell/trace-mapping": "^0.3.25",
86
87
  "@polka/compression": "^1.0.0-next.25",
87
- "@rollup/plugin-alias": "^5.1.0",
88
- "@rollup/plugin-commonjs": "^26.0.1",
89
- "@rollup/plugin-dynamic-import-vars": "^2.1.2",
88
+ "@rollup/plugin-alias": "^5.1.1",
89
+ "@rollup/plugin-commonjs": "^28.0.1",
90
+ "@rollup/plugin-dynamic-import-vars": "2.1.4",
90
91
  "@rollup/plugin-json": "^6.1.0",
91
- "@rollup/plugin-node-resolve": "15.2.3",
92
- "@rollup/pluginutils": "^5.1.0",
92
+ "@rollup/plugin-node-resolve": "15.3.0",
93
+ "@rollup/pluginutils": "^5.1.3",
93
94
  "@types/escape-html": "^1.0.4",
94
95
  "@types/pnpapi": "^0.0.5",
95
96
  "artichokie": "^0.2.1",
@@ -98,7 +99,7 @@
98
99
  "connect": "^3.7.0",
99
100
  "convert-source-map": "^2.0.0",
100
101
  "cors": "^2.8.5",
101
- "cross-spawn": "^7.0.3",
102
+ "cross-spawn": "^7.0.5",
102
103
  "debug": "^4.3.7",
103
104
  "dep-types": "link:./src/types",
104
105
  "dotenv": "^16.4.5",
@@ -107,54 +108,58 @@
107
108
  "escape-html": "^1.0.3",
108
109
  "estree-walker": "^3.0.3",
109
110
  "etag": "^1.8.1",
110
- "fast-glob": "^3.3.2",
111
111
  "http-proxy": "^1.18.1",
112
112
  "launch-editor-middleware": "^2.9.1",
113
- "lightningcss": "^1.26.0",
114
- "magic-string": "^0.30.11",
115
- "micromatch": "^4.0.8",
116
- "mlly": "^1.7.1",
113
+ "lightningcss": "^1.28.1",
114
+ "magic-string": "^0.30.12",
115
+ "mlly": "^1.7.2",
117
116
  "mrmime": "^2.0.0",
118
- "nanoid": "^5.0.7",
119
- "open": "^8.4.2",
120
- "parse5": "^7.1.2",
117
+ "nanoid": "^5.0.8",
118
+ "open": "^10.1.0",
119
+ "parse5": "^7.2.1",
121
120
  "pathe": "^1.1.2",
122
121
  "periscopic": "^4.0.2",
123
- "picocolors": "^1.1.0",
124
- "picomatch": "^2.3.1",
122
+ "picocolors": "^1.1.1",
123
+ "picomatch": "^4.0.2",
125
124
  "postcss-import": "^16.1.0",
126
- "postcss-load-config": "^4.0.2",
125
+ "postcss-load-config": "^6.0.1",
127
126
  "postcss-modules": "^6.0.0",
128
127
  "resolve.exports": "^2.0.2",
129
128
  "rollup-plugin-dts": "^6.1.1",
130
129
  "rollup-plugin-esbuild": "^6.1.1",
131
- "rollup-plugin-license": "^3.5.2",
132
- "sass": "^1.78.0",
133
- "sass-embedded": "^1.78.0",
134
- "sirv": "^2.0.4",
130
+ "rollup-plugin-license": "^3.5.3",
131
+ "sass": "^1.80.6",
132
+ "sass-embedded": "^1.80.6",
133
+ "sirv": "^3.0.0",
135
134
  "source-map-support": "^0.5.21",
136
- "strip-ansi": "^7.1.0",
137
135
  "strip-literal": "^2.1.0",
138
- "tsconfck": "^3.1.3",
139
- "tslib": "^2.7.0",
136
+ "tinyglobby": "^0.2.10",
137
+ "tsconfck": "^3.1.4",
138
+ "tslib": "^2.8.1",
140
139
  "types": "link:./types",
141
140
  "ufo": "^1.5.4",
142
141
  "ws": "^8.18.0"
143
142
  },
144
143
  "peerDependencies": {
145
144
  "@types/node": "^18.0.0 || >=20.0.0",
145
+ "jiti": ">=1.21.0",
146
146
  "less": "*",
147
147
  "lightningcss": "^1.21.0",
148
148
  "sass": "*",
149
149
  "sass-embedded": "*",
150
150
  "stylus": "*",
151
151
  "sugarss": "*",
152
- "terser": "^5.4.0"
152
+ "terser": "^5.16.0",
153
+ "tsx": "^4.8.1",
154
+ "yaml": "^2.4.2"
153
155
  },
154
156
  "peerDependenciesMeta": {
155
157
  "@types/node": {
156
158
  "optional": true
157
159
  },
160
+ "jiti": {
161
+ "optional": true
162
+ },
158
163
  "sass": {
159
164
  "optional": true
160
165
  },
@@ -175,15 +180,21 @@
175
180
  },
176
181
  "terser": {
177
182
  "optional": true
183
+ },
184
+ "tsx": {
185
+ "optional": true
186
+ },
187
+ "yaml": {
188
+ "optional": true
178
189
  }
179
190
  },
180
191
  "scripts": {
181
192
  "dev": "tsx scripts/dev.ts",
182
- "build": "rimraf dist && pnpm build-bundle && pnpm build-types",
193
+ "build": "premove dist && pnpm build-bundle && pnpm build-types",
183
194
  "build-bundle": "rollup --config rollup.config.ts --configPlugin esbuild",
184
195
  "build-types": "pnpm build-types-temp && pnpm build-types-roll && pnpm build-types-check",
185
196
  "build-types-temp": "tsc --emitDeclarationOnly --outDir temp -p src/node",
186
- "build-types-roll": "rollup --config rollup.dts.config.ts --configPlugin esbuild && rimraf temp",
197
+ "build-types-roll": "rollup --config rollup.dts.config.ts --configPlugin esbuild && premove temp",
187
198
  "build-types-check": "tsc --project tsconfig.check.json",
188
199
  "typecheck": "tsc --noEmit && tsc --noEmit -p src/node",
189
200
  "lint": "eslint --cache --ext .ts src/**",
@@ -2,6 +2,7 @@
2
2
  export type HMRPayload = HotPayload
3
3
  export type HotPayload =
4
4
  | ConnectedPayload
5
+ | PingPayload
5
6
  | UpdatePayload
6
7
  | FullReloadPayload
7
8
  | CustomPayload
@@ -12,6 +13,10 @@ export interface ConnectedPayload {
12
13
  type: 'connected'
13
14
  }
14
15
 
16
+ export interface PingPayload {
17
+ type: 'ping'
18
+ }
19
+
15
20
  export interface UpdatePayload {
16
21
  type: 'update'
17
22
  updates: Update[]
@@ -0,0 +1,63 @@
1
+ /* eslint-disable @typescript-eslint/ban-ts-comment */
2
+
3
+ // @ts-ignore `sass` may not be installed
4
+ import type DartSass from 'sass'
5
+ // @ts-ignore `sass-embedded` may not be installed
6
+ import type SassEmbedded from 'sass-embedded'
7
+ // @ts-ignore `less` may not be installed
8
+ import type Less from 'less'
9
+ // @ts-ignore `less` may not be installed
10
+ import type Stylus from 'stylus'
11
+
12
+ /* eslint-enable @typescript-eslint/ban-ts-comment */
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
+
25
+ export type SassLegacyPreprocessBaseOptions = Omit<
26
+ SassLegacyStringOptionsAsync,
27
+ | 'data'
28
+ | 'file'
29
+ | 'outFile'
30
+ | 'sourceMap'
31
+ | 'omitSourceMapUrl'
32
+ | 'sourceMapEmbed'
33
+ | 'sourceMapRoot'
34
+ >
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
+
43
+ export type SassModernPreprocessBaseOptions = Omit<
44
+ SassStringOptionsAsync,
45
+ 'url' | 'sourceMap'
46
+ >
47
+
48
+ export type LessPreprocessorBaseOptions = Omit<
49
+ Less.Options,
50
+ 'sourceMap' | 'filename'
51
+ >
52
+
53
+ export type StylusPreprocessorBaseOptions = Omit<
54
+ Stylus.RenderOptions,
55
+ 'filename'
56
+ > & { define?: Record<string, any> }
57
+
58
+ declare global {
59
+ // LESS' types somewhat references this which doesn't make sense in Node,
60
+ // so we have to shim it
61
+ // eslint-disable-next-line @typescript-eslint/no-empty-object-type
62
+ interface HTMLLinkElement {}
63
+ }
@@ -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
+ >