forked from microsoft/devicescript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinfo.ts
More file actions
107 lines (92 loc) · 2.4 KB
/
Copy pathinfo.ts
File metadata and controls
107 lines (92 loc) · 2.4 KB
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
// location is offset into concatenation of all SrcFile's plus length
import { LocalBuildConfig } from "./archconfig"
// both are in 16-bit JS codepoints
export type SrcLocation = [number, number]
export interface SrcFile {
path: string
length: number // in 16-bit codepoints; useful if text is missing
text?: string
index?: number
}
export const srcMapEntrySize = 3
// format is (Dpos, len, Dpc) repeated
// [pos, len] is SrcLocation
// pc is byte offset in the image
// pc is Dpc + previous pc
// pos is Dpos + previous pos
export type SrcMap = number[]
export type ConstValue = number | boolean | string | null | { special: string }
export interface FunctionDebugInfo {
name: string
startpc: number
size: number
// where the function is defined; some functions are synthetic and miss location
location?: SrcLocation
// where the function is called from; may include `location` eg. for inline handlers
users: SrcLocation[]
slots: VarDebugInfo[]
constVars: Record<string, ConstValue>
}
export type DebugVarType = "loc" | "glb" | "arg" | "tmp"
export interface VarDebugInfo {
name: string
type: string
}
export interface SpecDebugInfo {
name: string
classIdentifier: number
}
export interface DebugInfo {
sizes: Record<string, number> & {
header: number
floats: number
strings: number
roles: number
align: number
}
localConfig: LocalBuildConfig
functions: FunctionDebugInfo[]
specs: SpecDebugInfo[]
globals: VarDebugInfo[]
srcmap: SrcMap
sources: SrcFile[]
binarySHA256?: string // hex-encoded
binary: { hex: string }
_resolverCache?: any
}
export interface VersionInfo {
devsVersion: string
runtimeVersion: string
nodeVersion: string
}
export function emptyDebugInfo(): DebugInfo {
return {
sizes: {
header: 0,
floats: 0,
strings: 0,
roles: 0,
align: 0,
},
localConfig: {
hwInfo: {},
},
functions: [],
globals: [],
specs: [],
srcmap: [],
sources: [],
binary: { hex: "" },
}
}
export interface ServerInfo {
label: string
startName: string
detail: string
classIdentifiers?: number[]
imports: Record<string, string>
snippet: string
}
export interface ServerInfoFile {
servers: ServerInfo[]
}