Skip to content

Commit aba3b6b

Browse files
authored
Merge pull request #48 from aquinojardim/extension
Add tests to react App folder
2 parents abe8175 + 0d16fca commit aba3b6b

35 files changed

+285
-124
lines changed

dev-reactime/astParser.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@ const JSXParser = acorn.Parser.extend(jsx());
88
// Helper function to grab the getters/setters from `elementType`
99
module.exports = elementType => {
1010
// Initialize empty object to store the setters and getter
11-
console.log('entered ast parser');
12-
//console.log('elementType: ', elementType);
1311
let ast = JSXParser.parse(elementType);
14-
//console.log('ast:', ast);
1512
const hookState = {};
1613

1714
while (Object.hasOwnProperty.call(ast, 'body')) {

dev-reactime/index.d.ts

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,27 @@
1010
* @returns {void} --> no return value
1111
*
1212
* Reactime contributors:
13-
* Abaas Khorrami
14-
* Andy Wond
15-
* Bryan Lee
16-
* Chris Flannery
17-
* David Chai
18-
* Ergi Shehu
19-
* Joshua Howard
20-
* Josh Kim
21-
* Prasanna Malla
22-
* Rajeeb Banstola
23-
* Rocky Lin
24-
* Ruth Anam
25-
* Ryan Dang
26-
* Sierra Swaby
27-
* Yujin Kang
13+
"Abaas Khorrami",
14+
"Andy Wong",
15+
"Bryan Lee",
16+
"Carlos Perez",
17+
"Chris Flannery",
18+
"David Chai",
19+
"Edwin Menendez",
20+
"Ergi Shehu",
21+
"Gabriela Jardim Aquino",
22+
"Gregory Panciera",
23+
"Josh Kim",
24+
"Joshua Howard",
25+
"Nathanael Wa Mwenze",
26+
"Prasanna Malla",
27+
"Rajeeb Banstola",
28+
"Raymond Kwan",
29+
"Rocky Lin",
30+
"Ruth Anam",
31+
"Ryan Dang",
32+
"Sierra Swaby",
33+
"Yujin Kang"
2834
*
2935
*
3036
* NOTE: TypeScript support is in beta and still experimental.

dev-reactime/index.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ const mode = {
2020
};
2121

2222
// const linkFiber = require('./linkFiber')(snapShot, mode);
23-
// console.log('import timeJump in index.js:', JSON.parse(JSON.stringify(snapShot)));
2423
// const timeJump = require('./timeJump')(snapShot, mode);
2524

2625

@@ -45,7 +44,6 @@ function getRouteURL(node) {
4544
window.addEventListener('message', ({ data: { action, payload } }) => {
4645
switch (action) {
4746
case 'jumpToSnap':
48-
// console.log('payload in jumpToSnap', payload);
4947
timeJump(payload); // * This sets state with given payload
5048
// Get the pathname from payload and add new entry to browser history
5149
// MORE: https://developer.mozilla.org/en-US/docs/Web/API/History/pushState
@@ -64,7 +62,6 @@ window.addEventListener('message', ({ data: { action, payload } }) => {
6462
}
6563
});
6664

67-
console.log('index.js: loading reactime');
6865
linkFiber();
6966

7067
// module.exports = linkFiber;

dev-reactime/linkFiber.js

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -70,17 +70,13 @@ export default (snap, mode) => {
7070
alwaysLog('sendSnapshot called');
7171
// Don't send messages while jumping or while paused
7272
circularComponentTable.clear();
73-
// console.log('sending snapshot');
7473
if (mode.jumping || mode.paused) return;
75-
// console.log('PAYLOAD: before cleaning', snap.tree);
7674

7775
if (!snap.tree) {
78-
// console.log('snapshot empty, sending root');
7976
snap.tree = new Tree('root', 'root');
8077
}
8178
const payload = snap.tree.cleanTreeCopy();// snap.tree.getCopy();
8279

83-
// console.log('PAYLOAD: after cleaning', payload);
8480
// try {
8581
// await window.postMessage({
8682
window.postMessage({
@@ -118,7 +114,6 @@ export default (snap, mode) => {
118114
let ctRunning = 0;
119115
function createTree(currentFiber, tree = new Tree('root', 'root'), fromSibling = false) {
120116
// Base case: child or sibling pointed to null
121-
console.log('createTree: creating tree');
122117
if (!currentFiber) return null;
123118
if (!tree) return tree;
124119

@@ -145,7 +140,6 @@ export default (snap, mode) => {
145140
if (stateNode && stateNode.state && (tag === 0 || tag === 1 || tag ===2)) { // { || tag === 2)) {
146141
// Save component's state and setState() function to our record for future
147142
// time-travel state changing. Add record index to snapshot so we can retrieve.
148-
console.log('createTree() found setState component');
149143
componentData.index = componentActionsRecord.saveNew(stateNode.state, stateNode);
150144
newState = stateNode.state;
151145
componentFound = true;
@@ -155,7 +149,6 @@ export default (snap, mode) => {
155149
let hooksIndex;
156150
if (memoizedState && (tag === 0 || tag === 1 || tag === 2 || tag === 10)) {
157151
if (memoizedState.queue) {
158-
console.log('createTree() found hooks component');
159152
// Hooks states are stored as a linked list using memoizedState.next,
160153
// so we must traverse through the list and get the states.
161154
// We then store them along with the corresponding memoizedState.queue,
@@ -176,10 +169,9 @@ export default (snap, mode) => {
176169
}
177170

178171
// This grabs stateless components
179-
/*
180172
if (!componentFound && (tag === 0 || tag === 1 || tag === 2)) {
181173
newState = 'stateless';
182-
}*/
174+
}
183175

184176
// Adds performance metrics to the component data
185177
componentData = {
@@ -193,18 +185,15 @@ export default (snap, mode) => {
193185
let newNode = null;
194186
if (componentFound || newState === 'stateless') {
195187
if (fromSibling) {
196-
console.log('createTree(), relevant component found in sibling');
197188
newNode = tree.addSibling(newState,
198189
elementType ? elementType.name : 'nameless',
199190
componentData);
200191
} else {
201-
console.log('createTree(), relevant component found in child');
202192
newNode = tree.addChild(newState,
203193
elementType ? elementType.name : 'nameless',
204194
componentData);
205195
}
206196
} else {
207-
console.log('createTree(), no new relevant nodes, continuing from same node')
208197
newNode = tree;
209198
}
210199

@@ -214,13 +203,11 @@ export default (snap, mode) => {
214203
// If this node had state we appended to the children array,
215204
// so attach children to the newly appended child.
216205
// Otherwise, attach children to this same node.
217-
console.log('going into child');
218206
circularComponentTable.add(child);
219207
createTree(child, newNode);
220208
}
221209
// Recurse on siblings
222210
if (sibling && !circularComponentTable.has(sibling)) {
223-
console.log('going into sibling');
224211
circularComponentTable.add(sibling);
225212
createTree(sibling, newNode, true);
226213
}
@@ -233,21 +220,17 @@ export default (snap, mode) => {
233220
console.log('found circular sibling, exiting tree loop');
234221
}
235222

236-
// // console.log('linkFiber.js: processed children and sibling, returning tree');
237223
return tree;
238224
}
239225

240226
let updateSnapshotTreeCount = 0;
241227
function updateSnapShotTree() {
242-
// console.log('updateSnapshotTree(), checking if fiberRoot updated');
243228

244229
updateSnapshotTreeCount++;
245230
if (updateSnapshotTreeCount > 1) alwaysLog('MULTIPLE SNAPSHOT TREE UPDATES:', updateSnapshotTreeCount);
246231
if (fiberRoot) {
247-
console.log('updateSnapshotTree(), updating snapshot', snap.tree);
248232
const { current } = fiberRoot;
249233
snap.tree = createTree(current);
250-
console.log('updateSnapshotTree(), completed snapshot', snap.tree);
251234
}
252235
updateSnapshotTreeCount--;
253236
}
@@ -274,11 +257,8 @@ export default (snap, mode) => {
274257
devTools.onCommitFiberRoot = (function (original) {
275258
return function (...args) {
276259
fiberRoot = args[1];
277-
//console.log('Fiber committed, updating snapshot tree with:', fiberRoot);
278260
updateSnapShotTree();
279-
console.log('Fiber committed, sending latest snapshot');
280261
sendSnapshot();
281-
console.log('Fiber committed, latest snapshot sent');
282262
return original(...args);
283263
};
284264
}(devTools.onCommitFiberRoot));

dev-reactime/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dev-reactime/package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dev-reactime",
3-
"version": "3.1.1",
3+
"version": "4.0.0",
44
"description": "A library that helps debug React by memorizing the state of components with every render.",
55
"main": "index.js",
66
"repository": {
@@ -28,11 +28,16 @@
2828
"Abaas Khorrami",
2929
"Andy Wong",
3030
"Bryan Lee",
31+
"Carlos Perez",
3132
"Chris Flannery",
3233
"David Chai",
34+
"Edwin Menendez",
3335
"Ergi Shehu",
36+
"Gabriela Jardim Aquino",
37+
"Gregory Panciera",
3438
"Josh Kim",
3539
"Joshua Howard",
40+
"Nathanael Wa Mwenze",
3641
"Prasanna Malla",
3742
"Rajeeb Banstola",
3843
"Raymond Kwan",

dev-reactime/readme.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,11 @@ Reactime offers beta support for TypeScript applications using stateful class co
101101

102102
## Authors
103103

104+
- **Carlos Perez** - [@crperezt](https://github.com/crperezt)
105+
- **Edwin Menendez** - [@edwinjmenendez](https://github.com/edwinjmenendez)
106+
- **Gabriela Jardim Aquino** - [@aquinojardim](https://github.com/aquinojardim)
107+
- **Gregory Panciera** - [@gpanciera](https://github.com/gpanciera)
108+
- **Nathanael Wa Mwenze** - [@nmwenz90](https://github.com/nmwenz90)
104109
- **Ryan Dang** - [@rydang](https://github.com/rydang)
105110
- **Bryan Lee** - [@mylee1995](https://github.com/mylee1995)
106111
- **Josh Kim** - [@joshua0308](https://github.com/joshua0308)

dev-reactime/timeJump.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ export default (origin, mode) => {
4242
target.state.hooksState.forEach(hooksState => {
4343
if (component && component.dispatch) {
4444
const hooksComponent = componentActionsRecord.getComponentByIndex(hooksState[1]);
45-
// console.log('dispatch going back to hooks state: ', target.state.hooksState[0]);
4645
hooksComponent.dispatch(target.state.hooksState[0]);
4746
}
4847
});

dev-reactime/tree.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,13 @@ class Tree {
2828
}
2929

3030
addChild(state, name, componentData) {
31-
//console.log('tree.js: in addChild');
3231
const newChild = new Tree(state, name, componentData);
3332
newChild.parent = this;
3433
this.children.push(newChild);
3534
return newChild;
3635
}
3736

3837
addSibling(state, name, componentData) {
39-
// console.log('tree.js: in addSibling');
4038
const newSibling = new Tree(state, name, componentData);
4139
newSibling.parent = this.parent;
4240
this.parent.children.push(newSibling);
@@ -74,7 +72,6 @@ class Tree {
7472
// BUG FIX: Don't print the Router as a component
7573
// Change how the children are printed
7674
print() {
77-
// console.log('current tree structure for *this : ', this);
7875
const children = ['children: '];
7976
// DEV: What should we push instead for components using hooks (it wouldn't be state)
8077
// if this.children is always initialized to empty array, when would there ever be anything to iterate through here?

flatted_test.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
11
const Flatted = require('flatted');
22

33

4-
let a = {'a': 'b', c: 3};
5-
6-
console.log(a);
7-
console.log(Flatted.stringify(a));
8-
9-
console.log(a);
4+
let a = {'a': 'b', c: 3};

0 commit comments

Comments
 (0)