vite 6.3.5 → 7.1.5

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 (39) hide show
  1. package/LICENSE.md +81 -314
  2. package/bin/openChrome.js +68 -0
  3. package/bin/vite.js +7 -7
  4. package/dist/client/client.mjs +886 -922
  5. package/dist/client/env.mjs +14 -19
  6. package/dist/node/chunks/dep-BuoK8Wda.js +377 -0
  7. package/dist/node/chunks/dep-BvyJBvVx.js +4 -0
  8. package/dist/node/chunks/dep-Cs9lwdKu.js +4 -0
  9. package/dist/node/chunks/dep-DCVhRpiz.js +5595 -0
  10. package/dist/node/chunks/dep-DDbTn5rw.js +482 -0
  11. package/dist/node/chunks/dep-D_YDhiNx.js +4 -0
  12. package/dist/node/chunks/dep-M_KD0XSK.js +36707 -0
  13. package/dist/node/chunks/dep-SmwnYDP9.js +320 -0
  14. package/dist/node/chunks/dep-cWFO4sv4.js +4 -0
  15. package/dist/node/chunks/dep-lCKrEJQm.js +31 -0
  16. package/dist/node/chunks/dep-sDKrrA4S.js +6814 -0
  17. package/dist/node/chunks/dep-yxQqhtZq.js +4 -0
  18. package/dist/node/cli.js +624 -865
  19. package/dist/node/index.d.ts +2723 -3277
  20. package/dist/node/index.js +24 -188
  21. package/dist/node/module-runner.d.ts +256 -234
  22. package/dist/node/module-runner.js +1000 -1178
  23. package/dist/node/moduleRunnerTransport-BWUZBVLX.d.ts +88 -0
  24. package/package.json +52 -55
  25. package/types/importGlob.d.ts +14 -0
  26. package/types/internal/cssPreprocessorOptions.d.ts +3 -22
  27. package/types/internal/terserOptions.d.ts +11 -0
  28. package/types/metadata.d.ts +0 -2
  29. package/bin/openChrome.applescript +0 -95
  30. package/dist/node/chunks/dep-3RmXg9uo.js +0 -553
  31. package/dist/node/chunks/dep-AiMcmC_f.js +0 -822
  32. package/dist/node/chunks/dep-CvfTChi5.js +0 -8218
  33. package/dist/node/chunks/dep-DBxKXgDP.js +0 -49496
  34. package/dist/node/chunks/dep-SgSik2vo.js +0 -7113
  35. package/dist/node/constants.js +0 -149
  36. package/dist/node/moduleRunnerTransport.d-DJ_mE5sf.d.ts +0 -87
  37. package/dist/node-cjs/publicUtils.cjs +0 -3986
  38. package/index.cjs +0 -96
  39. 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.1.5",
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",
77
- "picomatch": "^4.0.2",
78
- "postcss": "^8.5.3",
79
- "rollup": "^4.34.9",
80
- "tinyglobby": "^0.2.13"
72
+ "fdir": "^6.5.0",
73
+ "picomatch": "^4.0.3",
74
+ "postcss": "^8.5.6",
75
+ "rollup": "^4.43.0",
76
+ "tinyglobby": "^0.2.15"
81
77
  },
82
78
  "optionalDependencies": {
83
79
  "fsevents": "~2.3.3"
84
80
  },
85
81
  "devDependencies": {
86
- "@ampproject/remapping": "^2.3.0",
87
- "@babel/parser": "^7.27.0",
88
- "@jridgewell/trace-mapping": "^0.3.25",
82
+ "@babel/parser": "^7.28.4",
83
+ "@jridgewell/remapping": "^2.3.5",
84
+ "@jridgewell/trace-mapping": "^0.3.30",
85
+ "@oxc-project/types": "0.81.0",
89
86
  "@polka/compression": "^1.0.0-next.25",
87
+ "@rolldown/pluginutils": "^1.0.0-beta.35",
90
88
  "@rollup/plugin-alias": "^5.1.1",
91
- "@rollup/plugin-commonjs": "^28.0.3",
89
+ "@rollup/plugin-commonjs": "^28.0.6",
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
- "@rollup/pluginutils": "^5.1.4",
91
+ "@rollup/pluginutils": "^5.3.0",
96
92
  "@types/escape-html": "^1.0.4",
97
93
  "@types/pnpapi": "^0.0.5",
98
- "artichokie": "^0.3.1",
94
+ "artichokie": "^0.4.0",
95
+ "baseline-browser-mapping": "^2.7.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
- "dotenv": "^16.5.0",
108
- "dotenv-expand": "^12.0.2",
109
- "es-module-lexer": "^1.6.0",
104
+ "dotenv": "^17.2.2",
105
+ "dotenv-expand": "^12.0.3",
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",
113
- "http-proxy": "^1.18.1",
114
- "launch-editor-middleware": "^2.10.0",
115
- "lightningcss": "^1.29.3",
116
- "magic-string": "^0.30.17",
117
- "mlly": "^1.7.4",
110
+ "host-validation-middleware": "^0.1.1",
111
+ "http-proxy-3": "^1.21.0",
112
+ "launch-editor-middleware": "^2.11.1",
113
+ "lightningcss": "^1.30.1",
114
+ "magic-string": "^0.30.18",
115
+ "mlly": "^1.8.0",
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.2.0",
119
+ "parse5": "^8.0.0",
122
120
  "pathe": "^2.0.3",
123
121
  "periscopic": "^4.0.2",
124
122
  "picocolors": "^1.1.1",
125
- "postcss-import": "^16.1.0",
123
+ "postcss-import": "^16.1.1",
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.32",
129
+ "rolldown-plugin-dts": "^0.15.6",
131
130
  "rollup-plugin-license": "^3.6.0",
132
- "sass": "^1.86.3",
133
- "sass-embedded": "^1.86.3",
134
- "sirv": "^3.0.1",
135
- "source-map-support": "^0.5.21",
131
+ "sass": "^1.92.1",
132
+ "sass-embedded": "^1.92.1",
133
+ "sirv": "^3.0.2",
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.44.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.3"
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,10 +28,24 @@ 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>
34
38
 
39
+ /**
40
+ * Declare Worker in case DOM is not added to the tsconfig lib causing
41
+ * Worker interface is not defined. For developers with DOM lib added,
42
+ * the Worker interface will be merged correctly.
43
+ */
44
+ declare global {
45
+ // eslint-disable-next-line @typescript-eslint/no-empty-object-type
46
+ interface Worker {}
47
+ }
48
+
35
49
  export interface KnownAsTypeMap {
36
50
  raw: string
37
51
  url: 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,
@@ -0,0 +1,11 @@
1
+ /* eslint-disable @typescript-eslint/ban-ts-comment */
2
+
3
+ // @ts-ignore `terser` may not be installed
4
+ export type * as Terser from 'terser'
5
+ // @ts-ignore `terser` may not be installed
6
+ import type * as Terser from 'terser'
7
+
8
+ /* eslint-enable @typescript-eslint/ban-ts-comment */
9
+
10
+ export type TerserMinifyOptions = Terser.MinifyOptions
11
+ export type TerserMinifyOutput = Terser.MinifyOutput
@@ -15,8 +15,6 @@ export interface CustomPluginOptionsVite {
15
15
  * ```js
16
16
  * cssScopeTo: ['/src/App.vue', 'default']
17
17
  * ```
18
- *
19
- * @experimental
20
18
  */
21
19
  cssScopeTo?: readonly [importerId: string, exportName: string | undefined]
22
20
 
@@ -1,95 +0,0 @@
1
- (*
2
- Copyright (c) 2015-present, Facebook, Inc.
3
-
4
- This source code is licensed under the MIT license found in the
5
- LICENSE file at
6
- https://github.com/facebookincubator/create-react-app/blob/master/LICENSE
7
- *)
8
-
9
- property targetTab: null
10
- property targetTabIndex: -1
11
- property targetWindow: null
12
- property theProgram: "Google Chrome"
13
-
14
- on run argv
15
- set theURL to item 1 of argv
16
-
17
- -- Allow requested program to be optional,
18
- -- default to Google Chrome
19
- if (count of argv) > 1 then
20
- set theProgram to item 2 of argv
21
- end if
22
-
23
- using terms from application "Google Chrome"
24
- tell application theProgram
25
-
26
- if (count every window) = 0 then
27
- make new window
28
- end if
29
-
30
- -- 1: Looking for tab running debugger
31
- -- then, Reload debugging tab if found
32
- -- then return
33
- set found to my lookupTabWithUrl(theURL)
34
- if found then
35
- set targetWindow's active tab index to targetTabIndex
36
- tell targetTab to reload
37
- tell targetWindow to activate
38
- set index of targetWindow to 1
39
- return
40
- end if
41
-
42
- -- 2: Looking for Empty tab
43
- -- In case debugging tab was not found
44
- -- We try to find an empty tab instead
45
- set found to my lookupTabWithUrl("chrome://newtab/")
46
- if found then
47
- set targetWindow's active tab index to targetTabIndex
48
- set URL of targetTab to theURL
49
- tell targetWindow to activate
50
- return
51
- end if
52
-
53
- -- 3: Create new tab
54
- -- both debugging and empty tab were not found
55
- -- make a new tab with url
56
- tell window 1
57
- activate
58
- make new tab with properties {URL:theURL}
59
- end tell
60
- end tell
61
- end using terms from
62
- end run
63
-
64
- -- Function:
65
- -- Lookup tab with given url
66
- -- if found, store tab, index, and window in properties
67
- -- (properties were declared on top of file)
68
- on lookupTabWithUrl(lookupUrl)
69
- using terms from application "Google Chrome"
70
- tell application theProgram
71
- -- Find a tab with the given url
72
- set found to false
73
- set theTabIndex to -1
74
- repeat with theWindow in every window
75
- set theTabIndex to 0
76
- repeat with theTab in every tab of theWindow
77
- set theTabIndex to theTabIndex + 1
78
- if (theTab's URL as string) contains lookupUrl then
79
- -- assign tab, tab index, and window to properties
80
- set targetTab to theTab
81
- set targetTabIndex to theTabIndex
82
- set targetWindow to theWindow
83
- set found to true
84
- exit repeat
85
- end if
86
- end repeat
87
-
88
- if found then
89
- exit repeat
90
- end if
91
- end repeat
92
- end tell
93
- end using terms from
94
- return found
95
- end lookupTabWithUrl