Skip to content

Commit 86c8110

Browse files
Merge pull request #4 from MLH-Fellowship/test/transformer
Integrated transformer tool into CLI
2 parents defc7b7 + ef6bb10 commit 86c8110

File tree

9 files changed

+669
-35
lines changed

9 files changed

+669
-35
lines changed

packages/cli/package.json

+2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"@react-native-community/cli-server-api": "^4.10.1",
3434
"@react-native-community/cli-tools": "^4.10.1",
3535
"@react-native-community/cli-types": "^4.10.1",
36+
"@types/source-map": "^0.5.7",
3637
"chalk": "^3.0.0",
3738
"command-exists": "^1.2.8",
3839
"commander": "^2.19.0",
@@ -59,6 +60,7 @@
5960
"pretty-format": "^25.2.0",
6061
"semver": "^6.3.0",
6162
"serve-static": "^1.13.1",
63+
"source-map": "^0.7.3",
6264
"strip-ansi": "^5.2.0",
6365
"sudo-prompt": "^9.0.0",
6466
"wcwidth": "^1.0.1"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
import {EventsPhase} from './Phases';
2+
3+
export interface SharedEventProperties {
4+
/**
5+
* name of the event
6+
*/
7+
name?: string;
8+
/**
9+
* event category
10+
*/
11+
cat?: string;
12+
/**
13+
* tracing clock timestamp
14+
*/
15+
ts?: number;
16+
/**
17+
* process ID
18+
*/
19+
pid?: number;
20+
/**
21+
* thread ID
22+
*/
23+
tid?: number;
24+
/**
25+
* event type (phase)
26+
*/
27+
ph: EventsPhase;
28+
/**
29+
* id for a stackFrame object
30+
*/
31+
sf?: number;
32+
/**
33+
* thread clock timestamp
34+
*/
35+
tts?: number;
36+
/**
37+
* a fixed color name
38+
*/
39+
cname?: string;
40+
/**
41+
* event arguments
42+
*/
43+
args?: {[key in string]: any};
44+
}
45+
46+
interface DurationEventBegin extends SharedEventProperties {
47+
ph: EventsPhase.DURATION_EVENTS_BEGIN;
48+
}
49+
50+
interface DurationEventEnd extends SharedEventProperties {
51+
ph: EventsPhase.DURATION_EVENTS_END;
52+
}
53+
54+
export type DurationEvent = DurationEventBegin | DurationEventEnd;
55+
56+
export type Event = DurationEvent;
57+
58+
/**
59+
* Each item in the stackFrames object of the hermes profile
60+
*/
61+
export interface HermesStackFrame {
62+
line: string;
63+
column: string;
64+
funcLine: string;
65+
funcColumn: string;
66+
name: string;
67+
category: string;
68+
/**
69+
* A parent function may or may not exist
70+
*/
71+
parent?: number;
72+
}
73+
/**
74+
* Each item in the samples array of the hermes profile
75+
*/
76+
export interface HermesSample {
77+
cpu: string;
78+
name: string;
79+
ts: string;
80+
pid: number;
81+
tid: string;
82+
weight: string;
83+
/**
84+
* Will refer to an element in the stackFrames object of the Hermes Profile
85+
*/
86+
sf: number;
87+
stackFrameData?: HermesStackFrame;
88+
}
89+
90+
/**
91+
* Hermes Profile Interface
92+
*/
93+
export interface HermesCPUProfile {
94+
traceEvents: SharedEventProperties[];
95+
samples: HermesSample[];
96+
stackFrames: {[key in string]: HermesStackFrame};
97+
}
98+
99+
export interface CPUProfileChunk {
100+
id: string;
101+
pid: number;
102+
tid: string;
103+
startTime: number;
104+
nodes: CPUProfileChunkNode[];
105+
samples: number[];
106+
timeDeltas: number[];
107+
}
108+
109+
export interface CPUProfileChunkNode {
110+
id: number;
111+
callFrame: {
112+
line: string;
113+
column: string;
114+
funcLine: string;
115+
funcColumn: string;
116+
name: string;
117+
url?: string;
118+
category: string;
119+
};
120+
parent?: number;
121+
}
122+
123+
export type CPUProfileChunker = {
124+
nodes: CPUProfileChunkNode[];
125+
sampleNumbers: number[];
126+
timeDeltas: number[];
127+
};
128+
129+
export interface SourceMap {
130+
version: string;
131+
sources: string[];
132+
sourceContent: string[];
133+
x_facebook_sources: {names: string[]; mappings: string}[] | null;
134+
names: string[];
135+
mappings: string;
136+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
export enum EventsPhase {
2+
DURATION_EVENTS_BEGIN = 'B',
3+
DURATION_EVENTS_END = 'E',
4+
COMPLETE_EVENTS = 'X',
5+
INSTANT_EVENTS = 'I',
6+
COUNTER_EVENTS = 'C',
7+
ASYNC_EVENTS_NESTABLE_START = 'b',
8+
ASYNC_EVENTS_NESTABLE_INSTANT = 'n',
9+
ASYNC_EVENTS_NESTABLE_END = 'e',
10+
FLOW_EVENTS_START = 's',
11+
FLOW_EVENTS_STEP = 't',
12+
FLOW_EVENTS_END = 'f',
13+
SAMPLE_EVENTS = 'P',
14+
OBJECT_EVENTS_CREATED = 'N',
15+
OBJECT_EVENTS_SNAPSHOT = 'O',
16+
OBJECT_EVENTS_DESTROYED = 'D',
17+
METADATA_EVENTS = 'M',
18+
MEMORY_DUMP_EVENTS_GLOBAL = 'V',
19+
MEMORY_DUMP_EVENTS_PROCESS = 'v',
20+
MARK_EVENTS = 'R',
21+
CLOCK_SYNC_EVENTS = 'c',
22+
CONTEXT_EVENTS_ENTER = '(',
23+
CONTEXT_EVENTS_LEAVE = ')',
24+
// Deprecated
25+
ASYNC_EVENTS_START = 'S',
26+
ASYNC_EVENTS_STEP_INTO = 'T',
27+
ASYNC_EVENTS_STEP_PAST = 'p',
28+
ASYNC_EVENTS_END = 'F',
29+
LINKED_ID_EVENTS = '=',
30+
}

0 commit comments

Comments
 (0)