Skip to content

Commit f42a77e

Browse files
committed
WIP - swapping parcel for webpack
1 parent 1b7d99c commit f42a77e

17 files changed

+3716
-5413
lines changed

crossbow.yaml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,19 @@ tasks:
1313
- chrome
1414
- inject
1515
- bg
16-
- build-chrome
17-
- tasks/manifest
16+
- webpack
1817

1918
start:
2019
description: |
2120
Run the application in a regular Browser window with sample data
2221
tasks:
2322
- app-watch
2423

25-
build-chrome:
26-
description: |
27-
Build the chrome Shell
24+
webpack:
2825
adaptor: npm
29-
command: >
30-
parcel build chrome.html --out-dir shells/chrome/dist --no-cache
26+
env:
27+
NODE_ENV: production
28+
command: webpack
3129

3230
app-watch:
3331
description: Run the extension in regular browser window

fixtures/large-page.html

Lines changed: 1038 additions & 0 deletions
Large diffs are not rendered by default.

fixtures/large.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4152,4 +4152,4 @@
41524152
],
41534153
"id": "2"
41544154
}
4155-
]
4155+
]

package.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
"license": "ISC",
1414
"dependencies": {
1515
"@types/node": "^9.4.7",
16+
"@types/react": "16.0.41",
17+
"@types/react-dom": "16.0.4",
18+
"awesome-typescript-loader": "4.0.1",
1619
"browserify": "^16.1.1",
1720
"classnames": "^2.2.5",
1821
"dlv": "^1.1.1",
@@ -28,10 +31,14 @@
2831
"react-addons-perf": "15.4.2",
2932
"react-dom": "^16.2.0",
3033
"rxjs": "^5.5.6",
31-
"ts-node": "^5.0.1"
34+
"ts-node": "^5.0.1",
35+
"uglifyjs-webpack-plugin": "1.2.4",
36+
"webpack": "4.2.0",
37+
"webpack-dev-server": "3.1.1"
3238
},
3339
"devDependencies": {
3440
"node-sass": "4.7.2",
35-
"typescript": "2.7.2"
41+
"typescript": "2.7.2",
42+
"webpack-cli": "2.0.13"
3643
}
3744
}

plain.html

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,41 @@
66
<meta http-equiv="X-UA-Compatible" content="ie=edge">
77
<title>Document</title>
88
<link rel="stylesheet" href="./scss/core.scss">
9+
<style>
10+
html,body {
11+
padding:0;
12+
margin:0;
13+
height:100%;
14+
width: 100%;
15+
overflow: hidden;
16+
}
17+
.wrapper {
18+
width: 100%;
19+
height: 100%;
20+
}
21+
.iframe {
22+
width: 100%;
23+
height: 50%;
24+
position: absolute;
25+
top: 0;
26+
left: 0;
27+
}
28+
.devtoolspanel {
29+
width: 100%;
30+
height: 50%;
31+
position: absolute;
32+
top: 50%;
33+
left: 0;
34+
}
35+
</style>
936
</head>
1037
<body>
11-
<div id="app"></div>
12-
<script src="./src/plain.tsx"></script>
38+
<div class="wrapper">
39+
<iframe class="iframe" src="./fixtures/large-page.html" id="m2-iframe" width="100%"></iframe>
40+
<div class="devtoolspanel">
41+
<div id="app"></div>
42+
</div>
43+
</div>
44+
<script src="/panel.js"></script>
1345
</body>
14-
</html>
46+
</html>

src/components/ActionBar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as React from 'react';
22
import {pullData} from "../utils";
33
import {NodeItem} from "../types";
44
import {App} from "./App";
5-
import * as dlv from "dlv";
5+
const dlv = require('dlv');
66
import {SelectionOverlay} from "./SelectionOverlay";
77

88
export interface ActionBarProps {

src/components/App.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import * as React from 'react';
22
import {Node} from "./Node";
3-
import * as dlv from "dlv";
43

54
declare var require;
65
import {collectIds, flattenNodes, getSearchNodes} from "../utils";
@@ -23,7 +22,6 @@ export interface AppProps {
2322
export class App extends React.Component<AppProps, any> {
2423
props: AppProps;
2524
sub: Subscription | null;
26-
setState: (...args) => void;
2725
ref: any;
2826
state: {
2927
collapsed: Set<string>,

src/components/Node.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {NodeId, NodeItem, NodePath} from "../types";
33
import {NodeHead} from "./NodeHead";
44
import {NodeEnd} from "./NodeEnd";
55
import {App} from "./App";
6-
import * as dlv from 'dlv';
6+
const dlv = require('dlv');
77

88
export interface NodeProps {
99
key?: string|number,
@@ -15,15 +15,14 @@ export interface NodeProps {
1515
select(id: NodeId, path: NodePath, pos: {head: boolean, tail: boolean}): void,
1616
addHover(id: NodeId): void,
1717
toggle(id: NodeId): void,
18-
removeHover(id: NodeId): void
1918
showOverlay(id: NodeId): void
2019
}
2120

2221
export class Node extends React.PureComponent<NodeProps> {
2322
props: NodeProps;
2423
render() {
2524
const {props} = this;
26-
const {node, depth, addHover, removeHover, searchTerm} = props;
25+
const {node, depth, addHover, searchTerm} = props;
2726
const {children} = node;
2827
const hasNodes = children && (children.length > 0);
2928
const isCollapsed = props.collapsed.has(node.id);
@@ -37,7 +36,6 @@ export class Node extends React.PureComponent<NodeProps> {
3736
depth={nextDepth}
3837
key={n.id}
3938
addHover={addHover}
40-
removeHover={removeHover}
4139
toggle={props.toggle}
4240
collapsed={props.collapsed}
4341
searchTerm={searchTerm}
@@ -54,7 +52,6 @@ export class Node extends React.PureComponent<NodeProps> {
5452
hasChildren={hasNodes}
5553
indent={indent}
5654
addHover={addHover}
57-
removeHover={removeHover}
5855
isCollapsed={isCollapsed}
5956
toggle={props.toggle}
6057
searchTerm={searchTerm}
@@ -69,7 +66,6 @@ export class Node extends React.PureComponent<NodeProps> {
6966
hasChildren={hasNodes}
7067
indent={indent}
7168
addHover={addHover}
72-
removeHover={removeHover}
7369
isSelected={tailIsSelected}
7470
select={props.select}
7571
showOverlay={props.showOverlay}

src/components/NodeEnd.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ export interface NodeEndProps {
1313
showOverlay(id: NodeId): void,
1414
select(id: NodeId, path: NodePath, pos: {head: boolean, tail: boolean}): void,
1515
addHover(id: NodeId, path: NodePath, pos: {head: boolean, tail: boolean}): void,
16-
removeHover(id: NodeId): void
1716
}
1817
export class NodeEnd extends React.PureComponent<NodeEndProps> {
1918
props: NodeEndProps;

src/components/NodeHead.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import {NodeInfoButton} from "./NodeInfoButton";
88
export interface NodeInfoProps {
99
node: NodeItem,
1010
indent: number,
11-
isHovered: boolean,
1211
isCollapsed: boolean,
1312
isSelected: boolean,
1413
hasChildren: boolean,
@@ -35,7 +34,6 @@ export class NodeHead extends React.PureComponent<NodeInfoProps> {
3534
}
3635
const classes = classnames({
3736
node_info: true,
38-
'node_info--hovered': props.isHovered,
3937
'node_info--selected': props.isSelected
4038
});
4139
const nodeName = node.data && node.data.type;

0 commit comments

Comments
 (0)