Skip to content

Commit 97c0a26

Browse files
committed
installed typedoc
1 parent a567d19 commit 97c0a26

File tree

7 files changed

+78
-84
lines changed

7 files changed

+78
-84
lines changed

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
"@babel/preset-react": "^7.10.4",
6363
"@types/chrome": "^0.0.119",
6464
"@types/jest": "^26.0.4",
65-
"@types/node": "^12.12.50",
65+
"@types/node": "^14.0.23",
6666
"babel-loader": "^8.1.0",
6767
"core-js": "^3.6.5",
6868
"css-loader": "^3.6.0",
@@ -78,6 +78,7 @@
7878
"express": "^4.17.1",
7979
"jest": "^26.1.0",
8080
"jest-cli": "^26.1.0",
81+
"jest-diff": "^26.1.0",
8182
"jest-puppeteer": "^4.4.0",
8283
"jest-runner-eslint": "^0.7.7",
8384
"node-sass": "^4.14.1",
@@ -88,6 +89,8 @@
8889
"style-loader": "^0.23.1",
8990
"ts-jest": "^26.1.1",
9091
"ts-loader": "^7.0.5",
92+
"typedoc": "^0.17.8",
93+
"typedoc-webpack-plugin": "^1.1.4",
9194
"typescript": "^3.9.6",
9295
"webpack": "^4.43.0",
9396
"webpack-chrome-extension-reloader": "^1.3.0",

src/backend/index.js

Lines changed: 0 additions & 68 deletions
This file was deleted.

src/backend/linkFiber.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,12 @@ import 'core-js';
3838
// const componentActionsRecord = require('./masterState');
3939
import acorn from 'acorn'; // javascript parser
4040
import jsx from 'acorn-jsx';
41-
import Tree from './tree.ts';
41+
import Tree from './tree';
4242
import componentActionsRecord from './masterState';
4343

4444
import { throttle, getHooksNames } from './helpers';
4545

46-
let doWork: boolean = true;
46+
let doWork = true;
4747
const circularComponentTable = new Set();
4848

4949
// module.exports = (snap, mode) => {
@@ -117,7 +117,7 @@ export default (snap, mode) => {
117117
} = currentFiber;
118118

119119
let newState = null;
120-
let componentData = {};
120+
let componentData: any= {};
121121
let componentFound = false;
122122

123123
// Check if node is a stateful setState component

src/backend/module.d.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
declare module 'core-js';
2-
declare module 'regenerator-runtime/runtime';
2+
declare module 'regenerator-runtime/runtime';
3+
declare module 'acorn-jsx'
4+
declare module 'acorn'

src/backend/tree.ts

Lines changed: 43 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,35 @@ import 'core-js';
66
// import * as reactWorkTags from './reactWorkTags';
77

88
const Flatted = require('flatted');
9-
9+
/**
10+
* @var copyInstances : Number of copies of Instances
11+
*/
1012
let copyInstances: number = 0;
1113
const circularComponentTable = new Set<Tree> ();
12-
13-
// removes unserializable state data such as functions
14+
/**
15+
* @function scrubUnserializableMembers : Removes unserializable state data such as functions
16+
*/
17+
//
1418
function scrubUnserializableMembers(tree: Tree): Tree {
1519
Object.entries(tree.state).forEach(keyValuePair => {
1620
if (typeof keyValuePair[1] === 'function') tree.state[keyValuePair[0]] = 'function';
1721
});
1822
return tree;
1923
}
2024

21-
// this is the current snapshot that is being sent to the snapshots array.
25+
/**
26+
*
27+
* This is the current snapshot that is being sent to the snapshots array.
28+
*
29+
*/
2230
class Tree {
31+
/**
32+
* Create a Tree
33+
* @param state : the tree's current state
34+
* @param name : the tree's name
35+
* @param componentData : Data in the component tree
36+
* @parent generates a new tree (recursive call)
37+
*/
2338
state: string | {};
2439
name: string;
2540
componentData: {};
@@ -32,23 +47,43 @@ class Tree {
3247
this.children = [];
3348
this.parent = null; // ref to parent so we can add siblings
3449
}
35-
50+
/**
51+
*
52+
* @function addChild : Pushes a new child tree in the children array
53+
*
54+
*/
3655
addChild(state: string | {} , name: string, componentData: {}): Tree {
56+
/**
57+
* @var newChild creates a new Child Tree
58+
*/
3759
const newChild: Tree = new Tree(state, name, componentData);
3860
newChild.parent = this;
3961
this.children.push(newChild);
4062
return newChild;
4163
}
42-
64+
/**
65+
*
66+
* @function addSibling : Adds a sibing to the current tree
67+
*
68+
*/
4369
addSibling(state: string | {} , name: string, componentData: {}): Tree {
70+
/**
71+
* @var newSibling: creates a new Sibling Tree
72+
*/
4473
const newSibling: Tree = new Tree(state, name, componentData);
4574
newSibling.parent = this.parent;
4675
this.parent.children.push(newSibling);
4776
return newSibling;
4877
}
49-
78+
/**
79+
* @function cleanTreeCopy : Adds a sibing to the current tree
80+
*/
5081
cleanTreeCopy(): Tree {
51-
// Clear circular component table only on first call, not recursive ones
82+
/**
83+
* @object circularComponentTable : Clears circular component table only on first call, not recursive ones
84+
* @
85+
*/
86+
//
5287
if (copyInstances === 0) {
5388
copyInstances++;
5489
circularComponentTable.clear();

tsconfig.json

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,19 @@
55
"target": "es5",
66
"jsx": "react",
77
"allowJs": true,
8+
"typeRoots": [
9+
"./node_modules/@types"
10+
],
811
"types": ["chrome", "jest", "node"],
9-
"esModuleInterop": true
10-
}
12+
"esModuleInterop": true,
13+
"moduleResolution": "node",
14+
"resolveJsonModule": true,
15+
"forceConsistentCasingInFileNames": true
16+
},
17+
"include": ["./src/app", "./src/backend", "./src/extension"],
18+
"exclude": ["./src/app/__tests__", "./src/backend/__tests__"],
19+
"typeDocOptions": {
20+
"mode": "modules",
21+
"out": "docs"
22+
},
1123
}

webpack.config.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
const path = require('path');
22
const ChromeExtensionReloader = require('webpack-chrome-extension-reloader'); // enable hot reloading while developing a chrome extension
3+
const TypedocWebpackPlugin = require('typedoc-webpack-plugin');
4+
35

46
const config = {
57
// use a "multi-main entry" to inject multiple dependent files together and graph their dependencies into one "chunk"
@@ -62,7 +64,15 @@ const config = {
6264
},
6365
],
6466
},
65-
plugins: [],
67+
plugins: [
68+
new TypedocWebpackPlugin({
69+
name: 'Contoso',
70+
mode: 'file',
71+
theme: './typedoc-theme/',
72+
includeDeclarations: false,
73+
ignoreCompilerErrors: true,
74+
}),
75+
],
6676
};
6777

6878
module.exports = (env, argv) => {

0 commit comments

Comments
 (0)