vite 6.3.5 → 7.0.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.
Files changed (34) hide show
  1. package/LICENSE.md +29 -0
  2. package/bin/vite.js +4 -4
  3. package/dist/client/client.mjs +793 -921
  4. package/dist/client/env.mjs +14 -19
  5. package/dist/node/chunks/dep-3PhSlasG.js +5 -0
  6. package/dist/node/chunks/dep-B4i1tHPo.js +30 -0
  7. package/dist/node/chunks/dep-BO5GbxpL.js +7345 -0
  8. package/dist/node/chunks/dep-BaSfMtGz.js +5 -0
  9. package/dist/node/chunks/dep-Bb92EWrU.js +5 -0
  10. package/dist/node/chunks/dep-C9KS6hrN.js +5 -0
  11. package/dist/node/chunks/dep-Ctugieod.js +150 -0
  12. package/dist/node/chunks/dep-D5HXLrlI.js +378 -0
  13. package/dist/node/chunks/dep-Da5Rc_CS.js +36548 -0
  14. package/dist/node/chunks/dep-Dg4W3IAQ.js +5597 -0
  15. package/dist/node/chunks/dep-uSUFJk9A.js +446 -0
  16. package/dist/node/cli.js +617 -865
  17. package/dist/node/constants.js +3 -148
  18. package/dist/node/index.d.ts +2724 -3124
  19. package/dist/node/index.js +25 -188
  20. package/dist/node/module-runner.d.ts +243 -234
  21. package/dist/node/module-runner.js +1043 -1172
  22. package/dist/node/moduleRunnerTransport-BWUZBVLX.d.ts +88 -0
  23. package/package.json +38 -41
  24. package/types/importGlob.d.ts +4 -0
  25. package/types/internal/cssPreprocessorOptions.d.ts +3 -22
  26. package/dist/node/chunks/dep-3RmXg9uo.js +0 -553
  27. package/dist/node/chunks/dep-AiMcmC_f.js +0 -822
  28. package/dist/node/chunks/dep-CvfTChi5.js +0 -8218
  29. package/dist/node/chunks/dep-DBxKXgDP.js +0 -49496
  30. package/dist/node/chunks/dep-SgSik2vo.js +0 -7113
  31. package/dist/node/moduleRunnerTransport.d-DJ_mE5sf.d.ts +0 -87
  32. package/dist/node-cjs/publicUtils.cjs +0 -3986
  33. package/index.cjs +0 -96
  34. package/index.d.cts +0 -6
@@ -0,0 +1,88 @@
1
+ import { HotPayload } from "../../types/hmrPayload.js";
2
+
3
+ //#region src/shared/invokeMethods.d.ts
4
+ interface FetchFunctionOptions {
5
+ cached?: boolean;
6
+ startOffset?: number;
7
+ }
8
+ type FetchResult = CachedFetchResult | ExternalFetchResult | ViteFetchResult;
9
+ interface CachedFetchResult {
10
+ /**
11
+ * If module cached in the runner, we can just confirm
12
+ * it wasn't invalidated on the server side.
13
+ */
14
+ cache: true;
15
+ }
16
+ interface ExternalFetchResult {
17
+ /**
18
+ * The path to the externalized module starting with file://,
19
+ * by default this will be imported via a dynamic "import"
20
+ * instead of being transformed by vite and loaded with vite runner
21
+ */
22
+ externalize: string;
23
+ /**
24
+ * Type of the module. Will be used to determine if import statement is correct.
25
+ * For example, if Vite needs to throw an error if variable is not actually exported
26
+ */
27
+ type: 'module' | 'commonjs' | 'builtin' | 'network';
28
+ }
29
+ interface ViteFetchResult {
30
+ /**
31
+ * Code that will be evaluated by vite runner
32
+ * by default this will be wrapped in an async function
33
+ */
34
+ code: string;
35
+ /**
36
+ * File path of the module on disk.
37
+ * This will be resolved as import.meta.url/filename
38
+ * Will be equal to `null` for virtual modules
39
+ */
40
+ file: string | null;
41
+ /**
42
+ * Module ID in the server module graph.
43
+ */
44
+ id: string;
45
+ /**
46
+ * Module URL used in the import.
47
+ */
48
+ url: string;
49
+ /**
50
+ * Invalidate module on the client side.
51
+ */
52
+ invalidate: boolean;
53
+ }
54
+ type InvokeMethods = {
55
+ fetchModule: (id: string, importer?: string, options?: FetchFunctionOptions) => Promise<FetchResult>;
56
+ };
57
+ //#endregion
58
+ //#region src/shared/moduleRunnerTransport.d.ts
59
+ type ModuleRunnerTransportHandlers = {
60
+ onMessage: (data: HotPayload) => void;
61
+ onDisconnection: () => void;
62
+ };
63
+ /**
64
+ * "send and connect" or "invoke" must be implemented
65
+ */
66
+ interface ModuleRunnerTransport {
67
+ connect?(handlers: ModuleRunnerTransportHandlers): Promise<void> | void;
68
+ disconnect?(): Promise<void> | void;
69
+ send?(data: HotPayload): Promise<void> | void;
70
+ invoke?(data: HotPayload): Promise<{
71
+ result: any;
72
+ } | {
73
+ error: any;
74
+ }>;
75
+ timeout?: number;
76
+ }
77
+ interface NormalizedModuleRunnerTransport {
78
+ connect?(onMessage?: (data: HotPayload) => void): Promise<void> | void;
79
+ disconnect?(): Promise<void> | void;
80
+ send(data: HotPayload): Promise<void>;
81
+ invoke<T extends keyof InvokeMethods>(name: T, data: Parameters<InvokeMethods[T]>): Promise<ReturnType<Awaited<InvokeMethods[T]>>>;
82
+ }
83
+ declare const createWebSocketModuleRunnerTransport: (options: {
84
+ createConnection: () => WebSocket;
85
+ pingInterval?: number;
86
+ }) => Required<Pick<ModuleRunnerTransport, "connect" | "disconnect" | "send">>;
87
+ //#endregion
88
+ export { ExternalFetchResult, FetchFunctionOptions, FetchResult, ModuleRunnerTransport, ModuleRunnerTransportHandlers, NormalizedModuleRunnerTransport, ViteFetchResult, createWebSocketModuleRunnerTransport };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite",
3
- "version": "6.3.5",
3
+ "version": "7.0.0-beta.1",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Evan You",
@@ -19,11 +19,7 @@
19
19
  "main": "./dist/node/index.js",
20
20
  "types": "./dist/node/index.d.ts",
21
21
  "exports": {
22
- ".": {
23
- "module-sync": "./dist/node/index.js",
24
- "import": "./dist/node/index.js",
25
- "require": "./index.cjs"
26
- },
22
+ ".": "./dist/node/index.js",
27
23
  "./client": {
28
24
  "types": "./client.d.ts"
29
25
  },
@@ -58,7 +54,7 @@
58
54
  "types"
59
55
  ],
60
56
  "engines": {
61
- "node": "^18.0.0 || ^20.0.0 || >=22.0.0"
57
+ "node": "^20.19.0 || >=22.12.0"
62
58
  },
63
59
  "repository": {
64
60
  "type": "git",
@@ -73,83 +69,84 @@
73
69
  "//": "READ CONTRIBUTING.md to understand what to put under deps vs. devDeps!",
74
70
  "dependencies": {
75
71
  "esbuild": "^0.25.0",
76
- "fdir": "^6.4.4",
72
+ "fdir": "^6.4.5",
77
73
  "picomatch": "^4.0.2",
78
- "postcss": "^8.5.3",
79
- "rollup": "^4.34.9",
80
- "tinyglobby": "^0.2.13"
74
+ "postcss": "^8.5.4",
75
+ "rollup": "^4.40.0",
76
+ "tinyglobby": "^0.2.14"
81
77
  },
82
78
  "optionalDependencies": {
83
79
  "fsevents": "~2.3.3"
84
80
  },
85
81
  "devDependencies": {
86
82
  "@ampproject/remapping": "^2.3.0",
87
- "@babel/parser": "^7.27.0",
83
+ "@babel/parser": "^7.27.5",
88
84
  "@jridgewell/trace-mapping": "^0.3.25",
85
+ "@oxc-project/runtime": "^0.70.0",
86
+ "@oxc-project/types": "^0.70.0",
89
87
  "@polka/compression": "^1.0.0-next.25",
90
88
  "@rollup/plugin-alias": "^5.1.1",
91
89
  "@rollup/plugin-commonjs": "^28.0.3",
92
90
  "@rollup/plugin-dynamic-import-vars": "2.1.4",
93
- "@rollup/plugin-json": "^6.1.0",
94
- "@rollup/plugin-node-resolve": "16.0.1",
95
91
  "@rollup/pluginutils": "^5.1.4",
96
92
  "@types/escape-html": "^1.0.4",
97
93
  "@types/pnpapi": "^0.0.5",
98
94
  "artichokie": "^0.3.1",
95
+ "baseline-browser-mapping": "^2.4.4",
99
96
  "cac": "^6.7.14",
100
97
  "chokidar": "^3.6.0",
101
98
  "connect": "^3.7.0",
102
99
  "convert-source-map": "^2.0.0",
103
100
  "cors": "^2.8.5",
104
101
  "cross-spawn": "^7.0.6",
105
- "debug": "^4.4.0",
102
+ "debug": "^4.4.1",
106
103
  "dep-types": "link:./src/types",
107
104
  "dotenv": "^16.5.0",
108
105
  "dotenv-expand": "^12.0.2",
109
- "es-module-lexer": "^1.6.0",
106
+ "es-module-lexer": "^1.7.0",
110
107
  "escape-html": "^1.0.3",
111
108
  "estree-walker": "^3.0.3",
112
109
  "etag": "^1.8.1",
110
+ "host-validation-middleware": "^0.1.1",
113
111
  "http-proxy": "^1.18.1",
114
112
  "launch-editor-middleware": "^2.10.0",
115
- "lightningcss": "^1.29.3",
113
+ "lightningcss": "^1.30.1",
116
114
  "magic-string": "^0.30.17",
117
115
  "mlly": "^1.7.4",
118
116
  "mrmime": "^2.0.1",
119
117
  "nanoid": "^5.1.5",
120
- "open": "^10.1.1",
121
- "parse5": "^7.2.1",
118
+ "open": "^10.1.2",
119
+ "parse5": "^7.3.0",
122
120
  "pathe": "^2.0.3",
123
121
  "periscopic": "^4.0.2",
124
122
  "picocolors": "^1.1.1",
125
123
  "postcss-import": "^16.1.0",
126
124
  "postcss-load-config": "^6.0.1",
127
125
  "postcss-modules": "^6.0.1",
126
+ "premove": "^4.0.0",
128
127
  "resolve.exports": "^2.0.3",
129
- "rollup-plugin-dts": "^6.2.1",
130
- "rollup-plugin-esbuild": "^6.2.1",
128
+ "rolldown": "^1.0.0-beta.10",
129
+ "rolldown-plugin-dts": "^0.13.7",
131
130
  "rollup-plugin-license": "^3.6.0",
132
- "sass": "^1.86.3",
133
- "sass-embedded": "^1.86.3",
131
+ "sass": "^1.89.0",
132
+ "sass-embedded": "^1.89.0",
134
133
  "sirv": "^3.0.1",
135
- "source-map-support": "^0.5.21",
136
134
  "strip-literal": "^3.0.0",
137
- "terser": "^5.39.0",
138
- "tsconfck": "^3.1.5",
139
- "tslib": "^2.8.1",
135
+ "terser": "^5.41.0",
136
+ "tsconfck": "^3.1.6",
140
137
  "types": "link:./types",
141
138
  "ufo": "^1.6.1",
142
- "ws": "^8.18.1"
139
+ "ws": "^8.18.2"
143
140
  },
144
141
  "peerDependencies": {
145
- "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0",
142
+ "@types/node": "^20.19.0 || >=22.12.0",
146
143
  "jiti": ">=1.21.0",
147
- "less": "*",
144
+ "less": "^4.0.0",
148
145
  "lightningcss": "^1.21.0",
149
- "sass": "*",
150
- "sass-embedded": "*",
151
- "stylus": "*",
152
- "sugarss": "*",
146
+ "sass": "^1.70.0",
147
+ "sass-embedded": "^1.70.0",
148
+ "stylus": ">=0.54.8",
149
+ "sugarss": "^5.0.0",
153
150
  "terser": "^5.16.0",
154
151
  "tsx": "^4.8.1",
155
152
  "yaml": "^2.4.2"
@@ -190,15 +187,15 @@
190
187
  }
191
188
  },
192
189
  "scripts": {
193
- "dev": "tsx scripts/dev.ts",
190
+ "dev": "premove dist && pnpm build-bundle -w",
194
191
  "build": "premove dist && pnpm build-bundle && pnpm build-types",
195
- "build-bundle": "rollup --config rollup.config.ts --configPlugin esbuild",
196
- "build-types": "pnpm build-types-temp && pnpm build-types-roll && pnpm build-types-check",
197
- "build-types-temp": "tsc --emitDeclarationOnly --outDir temp -p src/node/tsconfig.build.json",
198
- "build-types-roll": "rollup --config rollup.dts.config.ts --configPlugin esbuild && premove temp",
192
+ "build-bundle": "rolldown --config rolldown.config.ts",
193
+ "build-types": "pnpm build-types-roll && pnpm build-types-check",
194
+ "build-types-roll": "rolldown --config rolldown.dts.config.ts",
199
195
  "build-types-check": "tsc --project tsconfig.check.json",
200
- "typecheck": "tsc --noEmit && tsc --noEmit -p src/node",
196
+ "typecheck": "tsc && tsc -p src/node",
201
197
  "lint": "eslint --cache --ext .ts src/**",
202
- "format": "prettier --write --cache --parser typescript \"src/**/*.ts\""
198
+ "format": "prettier --write --cache --parser typescript \"src/**/*.ts\"",
199
+ "generate-target": "tsx scripts/generateTarget.ts"
203
200
  }
204
201
  }
@@ -28,6 +28,10 @@ export interface ImportGlobOptions<
28
28
  * @default false
29
29
  */
30
30
  exhaustive?: boolean
31
+ /**
32
+ * Base path to resolve relative paths.
33
+ */
34
+ base?: string
31
35
  }
32
36
 
33
37
  export type GeneralImportGlobOptions = ImportGlobOptions<boolean, string>
@@ -14,31 +14,12 @@ import type Stylus from 'stylus'
14
14
  // https://github.com/type-challenges/type-challenges/issues/29285
15
15
  type IsAny<T> = boolean extends (T extends never ? true : false) ? true : false
16
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
17
  type DartSassStringOptionsAsync = DartSass.StringOptions<'async'>
37
18
  type SassEmbeddedStringOptionsAsync = SassEmbedded.StringOptions<'async'>
38
19
  type SassStringOptionsAsync =
39
- IsAny<DartSassStringOptionsAsync> extends false
40
- ? DartSassStringOptionsAsync
41
- : SassEmbeddedStringOptionsAsync
20
+ IsAny<SassEmbeddedStringOptionsAsync> extends false
21
+ ? SassEmbeddedStringOptionsAsync
22
+ : DartSassStringOptionsAsync
42
23
 
43
24
  export type SassModernPreprocessBaseOptions = Omit<
44
25
  SassStringOptionsAsync,