/
types.ts
83 lines (71 loc) · 1.76 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
import type { ModuleCacheMap } from './client'
export type Nullable<T> = T | null | undefined
export type Arrayable<T> = T | Array<T>
export interface DepsHandlingOptions {
external?: (string | RegExp)[]
inline?: (string | RegExp)[]
/**
* Try to guess the CJS version of a package when it's invalid ESM
* @default false
*/
fallbackCJS?: boolean
}
export interface StartOfSourceMap {
file?: string
sourceRoot?: string
}
export interface RawSourceMap extends StartOfSourceMap {
version: string
sources: string[]
names: string[]
sourcesContent?: string[]
mappings: string
}
export interface FetchResult {
code?: string
externalize?: string
map?: RawSourceMap
}
export type FetchFunction = (id: string) => Promise<FetchResult>
export type ResolveIdFunction = (id: string, importer?: string) => Promise<ViteNodeResolveId | null>
export interface ModuleCache {
promise?: Promise<any>
exports?: any
code?: string
}
export interface ViteNodeRunnerOptions {
root: string
fetchModule: FetchFunction
resolveId?: ResolveIdFunction
base?: string
moduleCache?: ModuleCacheMap
interopDefault?: boolean
requestStubs?: Record<string, any>
debug?: boolean
}
export interface ViteNodeResolveId {
external?: boolean | 'absolute' | 'relative'
id: string
meta?: Record<string, any> | null
moduleSideEffects?: boolean | 'no-treeshake' | null
syntheticNamedExports?: boolean | string | null
}
export interface ViteNodeServerOptions {
/**
* Inject inline sourcemap to modules
* @default 'inline'
*/
sourcemap?: 'inline' | boolean
/**
* Deps handling
*/
deps?: DepsHandlingOptions
/**
* Transform method for modules
*/
transformMode?: {
ssr?: RegExp[]
web?: RegExp[]
}
}
export type { ModuleCacheMap }