-
Notifications
You must be signed in to change notification settings - Fork 31
/
index.d.ts
41 lines (30 loc) 路 1.31 KB
/
index.d.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
// CommonJS
export interface CommonjsContext {
__filename: string
__dirname: string
require: NodeRequire
}
export function createCommonJS (url: string) : CommonjsContext
// Resolve
export interface ResolveOptions {
from?: string | URL
conditions?: string[]
}
export function resolve (id: string, opts: ResolveOptions) : Promise<string>
export function resolvePath (id: string, opts: ResolveOptions) : Promise<string>
export function resolveSync (id: string, opts: ResolveOptions) : string
export function resolvePathSync (id: string, opts: ResolveOptions) : string
export function createResolve (defaults: ResolveOptions) : (id: string, url?: string | URL) => Promise<string>
export function resolveImports (code: string, opts: ResolveOptions) : Promise<string>
// Evaluate
export interface EvaluateOptions extends ResolveOptions {
url?: string
}
export function loadModule (url: string, opts?: EvaluateOptions) : Promise<any>
export function evalModule (code: string, opts?: EvaluateOptions) : Promise<any>
export function transformModule(code: string, opts?: EvaluateOptions) : Promise<string>
// Utils
export function fileURLToPath (id: URL | string) : string
export function normalizeid (id: URL | string) : string
export function loadURL (id: string) : Promise<string>
export function toDataURL(code: string) : string