@depup/vite 7.3.1-depup.0
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/LICENSE.md +2120 -0
- package/README.md +20 -0
- package/bin/openChrome.js +68 -0
- package/bin/vite.js +79 -0
- package/client.d.ts +279 -0
- package/dist/client/client.mjs +1106 -0
- package/dist/client/env.mjs +19 -0
- package/dist/node/chunks/build.js +4 -0
- package/dist/node/chunks/build2.js +5538 -0
- package/dist/node/chunks/chunk.js +48 -0
- package/dist/node/chunks/config.js +35978 -0
- package/dist/node/chunks/config2.js +4 -0
- package/dist/node/chunks/dist.js +6758 -0
- package/dist/node/chunks/lib.js +377 -0
- package/dist/node/chunks/logger.js +329 -0
- package/dist/node/chunks/moduleRunnerTransport.d.ts +96 -0
- package/dist/node/chunks/optimizer.js +4 -0
- package/dist/node/chunks/postcss-import.js +479 -0
- package/dist/node/chunks/preview.js +4 -0
- package/dist/node/chunks/server.js +4 -0
- package/dist/node/cli.js +698 -0
- package/dist/node/index.d.ts +3713 -0
- package/dist/node/index.js +30 -0
- package/dist/node/module-runner.d.ts +311 -0
- package/dist/node/module-runner.js +1160 -0
- package/misc/false.js +1 -0
- package/misc/true.js +1 -0
- package/package.json +199 -0
- package/types/customEvent.d.ts +50 -0
- package/types/hmrPayload.d.ts +74 -0
- package/types/hot.d.ts +39 -0
- package/types/import-meta.d.ts +5 -0
- package/types/importGlob.d.ts +89 -0
- package/types/importMeta.d.ts +30 -0
- package/types/internal/cssPreprocessorOptions.d.ts +44 -0
- package/types/internal/lightningcssOptions.d.ts +18 -0
- package/types/internal/terserOptions.d.ts +11 -0
- package/types/metadata.d.ts +33 -0
- package/types/package.json +4 -0
package/misc/false.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default false
|
package/misc/true.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default true
|
package/package.json
ADDED
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@depup/vite",
|
|
3
|
+
"version": "7.3.1-depup.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "Evan You",
|
|
7
|
+
"description": "Native-ESM powered web dev build tool",
|
|
8
|
+
"bin": {
|
|
9
|
+
"vite": "bin/vite.js"
|
|
10
|
+
},
|
|
11
|
+
"keywords": [
|
|
12
|
+
"frontend",
|
|
13
|
+
"framework",
|
|
14
|
+
"hmr",
|
|
15
|
+
"dev-server",
|
|
16
|
+
"build-tool",
|
|
17
|
+
"vite"
|
|
18
|
+
],
|
|
19
|
+
"main": "./dist/node/index.js",
|
|
20
|
+
"types": "./dist/node/index.d.ts",
|
|
21
|
+
"exports": {
|
|
22
|
+
".": "./dist/node/index.js",
|
|
23
|
+
"./client": {
|
|
24
|
+
"types": "./client.d.ts"
|
|
25
|
+
},
|
|
26
|
+
"./module-runner": "./dist/node/module-runner.js",
|
|
27
|
+
"./dist/client/*": "./dist/client/*",
|
|
28
|
+
"./types/*": {
|
|
29
|
+
"types": "./types/*"
|
|
30
|
+
},
|
|
31
|
+
"./types/internal/*": null,
|
|
32
|
+
"./package.json": "./package.json"
|
|
33
|
+
},
|
|
34
|
+
"typesVersions": {
|
|
35
|
+
"*": {
|
|
36
|
+
"module-runner": [
|
|
37
|
+
"dist/node/module-runner.d.ts"
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"imports": {
|
|
42
|
+
"#module-sync-enabled": {
|
|
43
|
+
"module-sync": "./misc/true.js",
|
|
44
|
+
"default": "./misc/false.js"
|
|
45
|
+
},
|
|
46
|
+
"#types/*": "./types/*.d.ts",
|
|
47
|
+
"#dep-types/*": "./src/types/*.d.ts"
|
|
48
|
+
},
|
|
49
|
+
"files": [
|
|
50
|
+
"bin",
|
|
51
|
+
"dist",
|
|
52
|
+
"misc/**/*.js",
|
|
53
|
+
"client.d.ts",
|
|
54
|
+
"types"
|
|
55
|
+
],
|
|
56
|
+
"engines": {
|
|
57
|
+
"node": "^20.19.0 || >=22.12.0"
|
|
58
|
+
},
|
|
59
|
+
"repository": {
|
|
60
|
+
"type": "git",
|
|
61
|
+
"url": "git+https://github.com/vitejs/vite.git",
|
|
62
|
+
"directory": "packages/vite"
|
|
63
|
+
},
|
|
64
|
+
"bugs": {
|
|
65
|
+
"url": "https://github.com/vitejs/vite/issues"
|
|
66
|
+
},
|
|
67
|
+
"homepage": "https://vite.dev",
|
|
68
|
+
"funding": "https://github.com/vitejs/vite?sponsor=1",
|
|
69
|
+
"//": "READ CONTRIBUTING.md to understand what to put under deps vs. devDeps!",
|
|
70
|
+
"dependencies": {
|
|
71
|
+
"esbuild": "^0.27.2",
|
|
72
|
+
"fdir": "^6.5.0",
|
|
73
|
+
"picomatch": "^4.0.3",
|
|
74
|
+
"postcss": "^8.5.6",
|
|
75
|
+
"rollup": "^4.55.1",
|
|
76
|
+
"tinyglobby": "^0.2.15"
|
|
77
|
+
},
|
|
78
|
+
"optionalDependencies": {
|
|
79
|
+
"fsevents": "~2.3.3"
|
|
80
|
+
},
|
|
81
|
+
"devDependencies": {
|
|
82
|
+
"@babel/parser": "^7.28.6",
|
|
83
|
+
"@jridgewell/remapping": "^2.3.5",
|
|
84
|
+
"@jridgewell/trace-mapping": "^0.3.31",
|
|
85
|
+
"@oxc-project/types": "^0.108.0",
|
|
86
|
+
"@polka/compression": "^1.0.0-next.25",
|
|
87
|
+
"@rolldown/pluginutils": "^1.0.0-beta.59",
|
|
88
|
+
"@rollup/plugin-alias": "^6.0.0",
|
|
89
|
+
"@rollup/plugin-commonjs": "^29.0.0",
|
|
90
|
+
"@rollup/plugin-dynamic-import-vars": "^2.1.5",
|
|
91
|
+
"@rollup/pluginutils": "^5.3.0",
|
|
92
|
+
"@types/escape-html": "^1.0.4",
|
|
93
|
+
"@types/pnpapi": "^0.0.5",
|
|
94
|
+
"artichokie": "^0.4.2",
|
|
95
|
+
"baseline-browser-mapping": "^2.9.14",
|
|
96
|
+
"cac": "^6.7.14",
|
|
97
|
+
"chokidar": "^5.0.0",
|
|
98
|
+
"connect": "^3.7.0",
|
|
99
|
+
"convert-source-map": "^2.0.0",
|
|
100
|
+
"cors": "^2.8.5",
|
|
101
|
+
"cross-spawn": "^7.0.6",
|
|
102
|
+
"obug": "^2.1.1",
|
|
103
|
+
"dotenv": "^17.2.3",
|
|
104
|
+
"dotenv-expand": "^12.0.3",
|
|
105
|
+
"es-module-lexer": "^2.0.0",
|
|
106
|
+
"escape-html": "^1.0.3",
|
|
107
|
+
"estree-walker": "^3.0.3",
|
|
108
|
+
"etag": "^1.8.1",
|
|
109
|
+
"host-validation-middleware": "^0.1.2",
|
|
110
|
+
"http-proxy-3": "^1.23.2",
|
|
111
|
+
"launch-editor-middleware": "^2.12.0",
|
|
112
|
+
"lightningcss": "^1.30.2",
|
|
113
|
+
"magic-string": "^0.30.21",
|
|
114
|
+
"mlly": "^1.8.0",
|
|
115
|
+
"mrmime": "^2.0.1",
|
|
116
|
+
"nanoid": "^5.1.6",
|
|
117
|
+
"open": "^11.0.0",
|
|
118
|
+
"parse5": "^8.0.0",
|
|
119
|
+
"pathe": "^2.0.3",
|
|
120
|
+
"periscopic": "^4.0.2",
|
|
121
|
+
"picocolors": "^1.1.1",
|
|
122
|
+
"postcss-import": "^16.1.1",
|
|
123
|
+
"postcss-load-config": "^6.0.1",
|
|
124
|
+
"postcss-modules": "^6.0.1",
|
|
125
|
+
"premove": "^4.0.0",
|
|
126
|
+
"resolve.exports": "^2.0.3",
|
|
127
|
+
"rolldown": "^1.0.0-beta.59",
|
|
128
|
+
"rolldown-plugin-dts": "^0.21.0",
|
|
129
|
+
"rollup-plugin-license": "^3.6.0",
|
|
130
|
+
"sass": "^1.97.2",
|
|
131
|
+
"sass-embedded": "^1.97.2",
|
|
132
|
+
"sirv": "^3.0.2",
|
|
133
|
+
"strip-literal": "^3.1.0",
|
|
134
|
+
"terser": "^5.44.1",
|
|
135
|
+
"tsconfck": "^3.1.6",
|
|
136
|
+
"ufo": "^1.6.2",
|
|
137
|
+
"ws": "^8.19.0"
|
|
138
|
+
},
|
|
139
|
+
"peerDependencies": {
|
|
140
|
+
"@types/node": "^20.19.0 || >=22.12.0",
|
|
141
|
+
"jiti": ">=1.21.0",
|
|
142
|
+
"less": "^4.0.0",
|
|
143
|
+
"lightningcss": "^1.21.0",
|
|
144
|
+
"sass": "^1.70.0",
|
|
145
|
+
"sass-embedded": "^1.70.0",
|
|
146
|
+
"stylus": ">=0.54.8",
|
|
147
|
+
"sugarss": "^5.0.0",
|
|
148
|
+
"terser": "^5.16.0",
|
|
149
|
+
"tsx": "^4.8.1",
|
|
150
|
+
"yaml": "^2.4.2"
|
|
151
|
+
},
|
|
152
|
+
"peerDependenciesMeta": {
|
|
153
|
+
"@types/node": {
|
|
154
|
+
"optional": true
|
|
155
|
+
},
|
|
156
|
+
"jiti": {
|
|
157
|
+
"optional": true
|
|
158
|
+
},
|
|
159
|
+
"sass": {
|
|
160
|
+
"optional": true
|
|
161
|
+
},
|
|
162
|
+
"sass-embedded": {
|
|
163
|
+
"optional": true
|
|
164
|
+
},
|
|
165
|
+
"stylus": {
|
|
166
|
+
"optional": true
|
|
167
|
+
},
|
|
168
|
+
"less": {
|
|
169
|
+
"optional": true
|
|
170
|
+
},
|
|
171
|
+
"sugarss": {
|
|
172
|
+
"optional": true
|
|
173
|
+
},
|
|
174
|
+
"lightningcss": {
|
|
175
|
+
"optional": true
|
|
176
|
+
},
|
|
177
|
+
"terser": {
|
|
178
|
+
"optional": true
|
|
179
|
+
},
|
|
180
|
+
"tsx": {
|
|
181
|
+
"optional": true
|
|
182
|
+
},
|
|
183
|
+
"yaml": {
|
|
184
|
+
"optional": true
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
"scripts": {
|
|
188
|
+
"dev": "premove dist && pnpm build-bundle -w",
|
|
189
|
+
"build": "premove dist && pnpm build-bundle && pnpm build-types",
|
|
190
|
+
"build-bundle": "rolldown --config rolldown.config.ts",
|
|
191
|
+
"build-types": "pnpm build-types-roll && pnpm build-types-check",
|
|
192
|
+
"build-types-roll": "rolldown --config rolldown.dts.config.ts",
|
|
193
|
+
"build-types-check": "tsc --project tsconfig.check.json",
|
|
194
|
+
"typecheck": "tsc && tsc -p src/node && tsc -p src/module-runner && tsc -p src/shared && tsc -p src/node/__tests_dts__",
|
|
195
|
+
"lint": "eslint --cache --ext .ts src/**",
|
|
196
|
+
"format": "prettier --write --cache --parser typescript \"src/**/*.ts\"",
|
|
197
|
+
"generate-target": "tsx scripts/generateTarget.ts"
|
|
198
|
+
}
|
|
199
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ErrorPayload,
|
|
3
|
+
FullReloadPayload,
|
|
4
|
+
PrunePayload,
|
|
5
|
+
UpdatePayload,
|
|
6
|
+
} from './hmrPayload'
|
|
7
|
+
|
|
8
|
+
export interface CustomEventMap {
|
|
9
|
+
// client events
|
|
10
|
+
'vite:beforeUpdate': UpdatePayload
|
|
11
|
+
'vite:afterUpdate': UpdatePayload
|
|
12
|
+
'vite:beforePrune': PrunePayload
|
|
13
|
+
'vite:beforeFullReload': FullReloadPayload
|
|
14
|
+
'vite:error': ErrorPayload
|
|
15
|
+
'vite:invalidate': InvalidatePayload
|
|
16
|
+
'vite:ws:connect': WebSocketConnectionPayload
|
|
17
|
+
'vite:ws:disconnect': WebSocketConnectionPayload
|
|
18
|
+
|
|
19
|
+
// server events
|
|
20
|
+
'vite:client:connect': undefined
|
|
21
|
+
'vite:client:disconnect': undefined
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface WebSocketConnectionPayload {
|
|
25
|
+
/**
|
|
26
|
+
* @experimental
|
|
27
|
+
* We expose this instance experimentally to see potential usage.
|
|
28
|
+
* This might be removed in the future if we didn't find reasonable use cases.
|
|
29
|
+
* If you find this useful, please open an issue with details so we can discuss and make it stable API.
|
|
30
|
+
*/
|
|
31
|
+
// eslint-disable-next-line n/no-unsupported-features/node-builtins
|
|
32
|
+
webSocket: WebSocket
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface InvalidatePayload {
|
|
36
|
+
path: string
|
|
37
|
+
message: string | undefined
|
|
38
|
+
firstInvalidatedBy: string
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* provides types for payloads of built-in Vite events
|
|
43
|
+
*/
|
|
44
|
+
export type InferCustomEventPayload<T extends string> =
|
|
45
|
+
T extends keyof CustomEventMap ? CustomEventMap[T] : any
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* provides types for names of built-in Vite events
|
|
49
|
+
*/
|
|
50
|
+
export type CustomEventName = keyof CustomEventMap | (string & {})
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/** @deprecated use HotPayload */
|
|
2
|
+
export type HMRPayload = HotPayload
|
|
3
|
+
export type HotPayload =
|
|
4
|
+
| ConnectedPayload
|
|
5
|
+
| PingPayload
|
|
6
|
+
| UpdatePayload
|
|
7
|
+
| FullReloadPayload
|
|
8
|
+
| CustomPayload
|
|
9
|
+
| ErrorPayload
|
|
10
|
+
| PrunePayload
|
|
11
|
+
|
|
12
|
+
export interface ConnectedPayload {
|
|
13
|
+
type: 'connected'
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface PingPayload {
|
|
17
|
+
type: 'ping'
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface UpdatePayload {
|
|
21
|
+
type: 'update'
|
|
22
|
+
updates: Update[]
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface Update {
|
|
26
|
+
type: 'js-update' | 'css-update'
|
|
27
|
+
path: string
|
|
28
|
+
acceptedPath: string
|
|
29
|
+
timestamp: number
|
|
30
|
+
/** @internal */
|
|
31
|
+
explicitImportRequired?: boolean
|
|
32
|
+
/** @internal */
|
|
33
|
+
isWithinCircularImport?: boolean
|
|
34
|
+
/** @internal */
|
|
35
|
+
firstInvalidatedBy?: string
|
|
36
|
+
/** @internal */
|
|
37
|
+
invalidates?: string[]
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface PrunePayload {
|
|
41
|
+
type: 'prune'
|
|
42
|
+
paths: string[]
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface FullReloadPayload {
|
|
46
|
+
type: 'full-reload'
|
|
47
|
+
path?: string
|
|
48
|
+
/** @internal */
|
|
49
|
+
triggeredBy?: string
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface CustomPayload {
|
|
53
|
+
type: 'custom'
|
|
54
|
+
event: string
|
|
55
|
+
data?: any
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface ErrorPayload {
|
|
59
|
+
type: 'error'
|
|
60
|
+
err: {
|
|
61
|
+
[name: string]: any
|
|
62
|
+
message: string
|
|
63
|
+
stack: string
|
|
64
|
+
id?: string
|
|
65
|
+
frame?: string
|
|
66
|
+
plugin?: string
|
|
67
|
+
pluginCode?: string
|
|
68
|
+
loc?: {
|
|
69
|
+
file?: string
|
|
70
|
+
line: number
|
|
71
|
+
column: number
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
package/types/hot.d.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { CustomEventName, InferCustomEventPayload } from './customEvent'
|
|
2
|
+
|
|
3
|
+
export type ModuleNamespace = Record<string, any> & {
|
|
4
|
+
[Symbol.toStringTag]: 'Module'
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface ViteHotContext {
|
|
8
|
+
readonly data: any
|
|
9
|
+
|
|
10
|
+
accept(): void
|
|
11
|
+
accept(cb: (mod: ModuleNamespace | undefined) => void): void
|
|
12
|
+
accept(dep: string, cb: (mod: ModuleNamespace | undefined) => void): void
|
|
13
|
+
accept(
|
|
14
|
+
deps: readonly string[],
|
|
15
|
+
cb: (mods: Array<ModuleNamespace | undefined>) => void,
|
|
16
|
+
): void
|
|
17
|
+
|
|
18
|
+
acceptExports(
|
|
19
|
+
exportNames: string | readonly string[],
|
|
20
|
+
cb?: (mod: ModuleNamespace | undefined) => void,
|
|
21
|
+
): void
|
|
22
|
+
|
|
23
|
+
dispose(cb: (data: any) => void): void
|
|
24
|
+
prune(cb: (data: any) => void): void
|
|
25
|
+
invalidate(message?: string): void
|
|
26
|
+
|
|
27
|
+
on<T extends CustomEventName>(
|
|
28
|
+
event: T,
|
|
29
|
+
cb: (payload: InferCustomEventPayload<T>) => void,
|
|
30
|
+
): void
|
|
31
|
+
off<T extends CustomEventName>(
|
|
32
|
+
event: T,
|
|
33
|
+
cb: (payload: InferCustomEventPayload<T>) => void,
|
|
34
|
+
): void
|
|
35
|
+
send<T extends CustomEventName>(
|
|
36
|
+
event: T,
|
|
37
|
+
data?: InferCustomEventPayload<T>,
|
|
38
|
+
): void
|
|
39
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
export interface ImportGlobOptions<
|
|
2
|
+
Eager extends boolean,
|
|
3
|
+
AsType extends string,
|
|
4
|
+
> {
|
|
5
|
+
/**
|
|
6
|
+
* Import type for the import url.
|
|
7
|
+
*
|
|
8
|
+
* @deprecated Use `query` instead, e.g. `as: 'url'` -> `query: '?url', import: 'default'`
|
|
9
|
+
*/
|
|
10
|
+
as?: AsType
|
|
11
|
+
/**
|
|
12
|
+
* Import as static or dynamic
|
|
13
|
+
*
|
|
14
|
+
* @default false
|
|
15
|
+
*/
|
|
16
|
+
eager?: Eager
|
|
17
|
+
/**
|
|
18
|
+
* Import only the specific named export. Set to `default` to import the default export.
|
|
19
|
+
*/
|
|
20
|
+
import?: string
|
|
21
|
+
/**
|
|
22
|
+
* Custom queries
|
|
23
|
+
*/
|
|
24
|
+
query?: string | Record<string, string | number | boolean>
|
|
25
|
+
/**
|
|
26
|
+
* Search files also inside `node_modules/` and hidden directories (e.g. `.git/`). This might have impact on performance.
|
|
27
|
+
*
|
|
28
|
+
* @default false
|
|
29
|
+
*/
|
|
30
|
+
exhaustive?: boolean
|
|
31
|
+
/**
|
|
32
|
+
* Base path to resolve relative paths.
|
|
33
|
+
*/
|
|
34
|
+
base?: string
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export type GeneralImportGlobOptions = ImportGlobOptions<boolean, string>
|
|
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
|
+
|
|
49
|
+
export interface KnownAsTypeMap {
|
|
50
|
+
raw: string
|
|
51
|
+
url: string
|
|
52
|
+
worker: Worker
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface ImportGlobFunction {
|
|
56
|
+
/**
|
|
57
|
+
* Import a list of files with a glob pattern.
|
|
58
|
+
*
|
|
59
|
+
* Overload 1: No generic provided, infer the type from `eager` and `as`
|
|
60
|
+
*/
|
|
61
|
+
<
|
|
62
|
+
Eager extends boolean,
|
|
63
|
+
As extends string,
|
|
64
|
+
T = As extends keyof KnownAsTypeMap ? KnownAsTypeMap[As] : unknown,
|
|
65
|
+
>(
|
|
66
|
+
glob: string | string[],
|
|
67
|
+
options?: ImportGlobOptions<Eager, As>,
|
|
68
|
+
): (Eager extends true ? true : false) extends true
|
|
69
|
+
? Record<string, T>
|
|
70
|
+
: Record<string, () => Promise<T>>
|
|
71
|
+
/**
|
|
72
|
+
* Import a list of files with a glob pattern.
|
|
73
|
+
*
|
|
74
|
+
* Overload 2: Module generic provided, infer the type from `eager: false`
|
|
75
|
+
*/
|
|
76
|
+
<M>(
|
|
77
|
+
glob: string | string[],
|
|
78
|
+
options?: ImportGlobOptions<false, string>,
|
|
79
|
+
): Record<string, () => Promise<M>>
|
|
80
|
+
/**
|
|
81
|
+
* Import a list of files with a glob pattern.
|
|
82
|
+
*
|
|
83
|
+
* Overload 3: Module generic provided, infer the type from `eager: true`
|
|
84
|
+
*/
|
|
85
|
+
<M>(
|
|
86
|
+
glob: string | string[],
|
|
87
|
+
options: ImportGlobOptions<true, string>,
|
|
88
|
+
): Record<string, M>
|
|
89
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// This file is an augmentation to the built-in ImportMeta interface
|
|
2
|
+
// Thus cannot contain any top-level imports
|
|
3
|
+
// <https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation>
|
|
4
|
+
|
|
5
|
+
// This is tested in `packages/vite/src/node/__tests_dts__/typeOptions.ts`
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type -- to allow extending by users
|
|
7
|
+
interface ViteTypeOptions {
|
|
8
|
+
// strictImportMetaEnv: unknown
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
type ImportMetaEnvFallbackKey =
|
|
12
|
+
'strictImportMetaEnv' extends keyof ViteTypeOptions ? never : string
|
|
13
|
+
|
|
14
|
+
interface ImportMetaEnv extends Record<ImportMetaEnvFallbackKey, any> {
|
|
15
|
+
BASE_URL: string
|
|
16
|
+
MODE: string
|
|
17
|
+
DEV: boolean
|
|
18
|
+
PROD: boolean
|
|
19
|
+
SSR: boolean
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
interface ImportMeta {
|
|
23
|
+
url: string
|
|
24
|
+
|
|
25
|
+
readonly hot?: import('./hot').ViteHotContext
|
|
26
|
+
|
|
27
|
+
readonly env: ImportMetaEnv
|
|
28
|
+
|
|
29
|
+
glob: import('./importGlob').ImportGlobFunction
|
|
30
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
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 `stylus` 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 DartSassStringOptionsAsync = DartSass.StringOptions<'async'>
|
|
18
|
+
type SassEmbeddedStringOptionsAsync = SassEmbedded.StringOptions<'async'>
|
|
19
|
+
type SassStringOptionsAsync =
|
|
20
|
+
IsAny<SassEmbeddedStringOptionsAsync> extends false
|
|
21
|
+
? SassEmbeddedStringOptionsAsync
|
|
22
|
+
: DartSassStringOptionsAsync
|
|
23
|
+
|
|
24
|
+
export type SassModernPreprocessBaseOptions = Omit<
|
|
25
|
+
SassStringOptionsAsync,
|
|
26
|
+
'url' | 'sourceMap'
|
|
27
|
+
>
|
|
28
|
+
|
|
29
|
+
export type LessPreprocessorBaseOptions = Omit<
|
|
30
|
+
Less.Options,
|
|
31
|
+
'sourceMap' | 'filename'
|
|
32
|
+
>
|
|
33
|
+
|
|
34
|
+
export type StylusPreprocessorBaseOptions = Omit<
|
|
35
|
+
Stylus.RenderOptions,
|
|
36
|
+
'filename'
|
|
37
|
+
> & { define?: Record<string, any> }
|
|
38
|
+
|
|
39
|
+
declare global {
|
|
40
|
+
// LESS' types somewhat references this which doesn't make sense in Node,
|
|
41
|
+
// so we have to shim it
|
|
42
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
43
|
+
interface HTMLLinkElement {}
|
|
44
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
2
|
+
|
|
3
|
+
// @ts-ignore `lightningcss` 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
|
+
>
|
|
@@ -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
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export interface ChunkMetadata {
|
|
2
|
+
importedAssets: Set<string>
|
|
3
|
+
importedCss: Set<string>
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export interface CustomPluginOptionsVite {
|
|
7
|
+
/**
|
|
8
|
+
* If this is a CSS Rollup module, you can scope to its importer's exports
|
|
9
|
+
* so that if those exports are treeshaken away, the CSS module will also
|
|
10
|
+
* be treeshaken.
|
|
11
|
+
*
|
|
12
|
+
* The "importerId" must import the CSS Rollup module statically.
|
|
13
|
+
*
|
|
14
|
+
* Example config if the CSS id is `/src/App.vue?vue&type=style&lang.css`:
|
|
15
|
+
* ```js
|
|
16
|
+
* cssScopeTo: ['/src/App.vue', 'default']
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
cssScopeTo?: readonly [importerId: string, exportName: string | undefined]
|
|
20
|
+
|
|
21
|
+
/** @deprecated no-op since Vite 6.1 */
|
|
22
|
+
lang?: string
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
declare module 'rollup' {
|
|
26
|
+
export interface RenderedChunk {
|
|
27
|
+
viteMetadata?: ChunkMetadata
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface CustomPluginOptions {
|
|
31
|
+
vite?: CustomPluginOptionsVite
|
|
32
|
+
}
|
|
33
|
+
}
|