Skip to content

Commit af8a788

Browse files
committed
feat: update deps and fix ts errors
1 parent 3c5d781 commit af8a788

21 files changed

+31331
-24090
lines changed

.storybook/preview-head.html

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
11
<!-- This file is auto-generated by ember-cli-storybook -->
2-
<meta name="broccoli-inspector/config/environment" content="%7B%22ember-websockets%22%3A%7B%22socketIO%22%3Atrue%7D%2C%22apollo%22%3A%7B%22apiURL%22%3A%22http%3A%2F%2Flocalhost%3A4200%2Fbroccoli-inspector%2Fapi%2Fgraphql%22%7D%2C%22modulePrefix%22%3A%22broccoli-inspector%22%2C%22environment%22%3A%22test%22%2C%22rootURL%22%3A%22%2F_broccoli-inspector%2F%22%2C%22locationType%22%3A%22none%22%2C%22EmberENV%22%3A%7B%22FEATURES%22%3A%7B%7D%2C%22EXTEND_PROTOTYPES%22%3A%7B%22Date%22%3Afalse%7D%2C%22_APPLICATION_TEMPLATE_WRAPPER%22%3Afalse%2C%22_DEFAULT_ASYNC_OBSERVERS%22%3Atrue%2C%22_JQUERY_INTEGRATION%22%3Afalse%2C%22_TEMPLATE_ONLY_GLIMMER_COMPONENTS%22%3Atrue%7D%2C%22APP%22%3A%7B%22LOG_ACTIVE_GENERATION%22%3Afalse%2C%22LOG_VIEW_LOOKUPS%22%3Afalse%2C%22rootElement%22%3A%22%23ember-testing%22%2C%22autoboot%22%3Afalse%2C%22appVersion%22%3A%223.0.1%22%2C%22name%22%3A%22broccoli-inspector%22%2C%22version%22%3A%220.4.1%2Baa76a688%22%7D%2C%22ember-paper%22%3A%7B%22insertFontLinks%22%3Atrue%7D%2C%22exportApplicationGlobal%22%3Atrue%7D" />
2+
<meta name="broccoli-inspector/config/environment" content="%7B%22ember-websockets%22%3A%7B%22socketIO%22%3Atrue%7D%2C%22apollo%22%3A%7B%22apiURL%22%3A%22http%3A%2F%2Flocalhost%3A4200%2Fbroccoli-inspector%2Fapi%2Fgraphql%22%7D%2C%22modulePrefix%22%3A%22broccoli-inspector%22%2C%22environment%22%3A%22test%22%2C%22rootURL%22%3A%22%2F_broccoli-inspector%2F%22%2C%22locationType%22%3A%22none%22%2C%22EmberENV%22%3A%7B%22FEATURES%22%3A%7B%7D%2C%22EXTEND_PROTOTYPES%22%3A%7B%22Date%22%3Afalse%7D%2C%22_APPLICATION_TEMPLATE_WRAPPER%22%3Afalse%2C%22_DEFAULT_ASYNC_OBSERVERS%22%3Atrue%2C%22_JQUERY_INTEGRATION%22%3Afalse%2C%22_TEMPLATE_ONLY_GLIMMER_COMPONENTS%22%3Atrue%7D%2C%22APP%22%3A%7B%22LOG_ACTIVE_GENERATION%22%3Afalse%2C%22LOG_VIEW_LOOKUPS%22%3Afalse%2C%22rootElement%22%3A%22%23ember-testing%22%2C%22autoboot%22%3Afalse%2C%22appVersion%22%3A%223.0.1%22%2C%22name%22%3A%22broccoli-inspector%22%2C%22version%22%3A%220.5.0%2B3c5d7814%22%7D%2C%22ember-paper%22%3A%7B%22insertFontLinks%22%3Atrue%7D%2C%22exportApplicationGlobal%22%3Atrue%7D" />
33
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700,400italic" />
44
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons" />
55
<link rel="stylesheet" href="./assets/vendor.css" />
66
<link rel="stylesheet" href="./assets/broccoli-inspector.css" />
7+
<script src="/testem.js"></script>
8+
<script src="./assets/vendor.js"></script>
9+
<script>window.Ember = require("ember").default; runningTests = true; Ember.testing=true;</script>
10+
<script src="./assets/chunk.vendors-node_modules_apollo_client_core_index_js-node_modules_c3_c3_js-node_modules_tinycolor-e8e126.c3c003da907e9fcd7abe.js"></script>
11+
<script src="./assets/chunk.app.9b37a48b972b8a456bac.js"></script>
12+
<script src="./assets/chunk.vendors-node_modules_qunit_qunit_qunit_js.583380f986b5722f7b7a.js"></script>
13+
<script src="./assets/chunk.tests.379b363bdc086668918e.js"></script>
14+
<script src="./assets/broccoli-inspector.js"></script>
715
<script>
816
(function() {
917
var srcUrl = null;
@@ -18,8 +26,4 @@
1826
script.src = location.protocol + '//' + host + ':4200' + src;
1927
document.getElementsByTagName('head')[0].appendChild(script);
2028
}());
21-
</script>
22-
<script src="/testem.js"></script>
23-
<script src="./assets/vendor.js"></script>
24-
<script>runningTests = true; Ember.testing=true;</script>
25-
<script src="./assets/broccoli-inspector.js"></script>
29+
</script>

TODO.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- [ ] show sidebar contents with overflow so that you can see if things are run multiple times with the same name

app/components/build-plugins.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
import Component from "@glimmer/component";
22
import { tracked } from '@glimmer/tracking';
3+
import { type Node } from "broccoli-inspector/types";
34

4-
export default class BuildPlugins extends Component {
5+
interface Args {
6+
nodes?: Node[];
7+
}
8+
9+
export default class BuildPlugins extends Component<Args> {
510
@tracked
611
selectedTab = 0;
712

813
get nodes() {
9-
const nodes = this.args?.nodes;
14+
const nodes = this.args?.nodes || [];
1015

1116
const body = nodes
1217
.map((node) => {

app/components/builds-list.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
1-
import CollapsableComponent from './collapsable-component';
1+
import { NodesByType } from "broccoli-inspector/types";
2+
import CollapsableComponent from "./collapsable-component";
23

3-
export default class BuildsList extends CollapsableComponent {
4-
constructor(...args) {
4+
type Args = {
5+
builds: NodesByType;
6+
};
7+
8+
export default class BuildsList extends CollapsableComponent<Args> {
9+
constructor(...args: any) {
10+
// @ts-ignore
511
super(...args);
612

713
this._items = this.args.builds;

app/components/collapsable-component.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
import Component from "@glimmer/component";
2-
import { tracked } from '@glimmer/tracking';
3-
import { action } from '@ember/object';
2+
import { tracked } from "@glimmer/tracking";
3+
import { action } from "@ember/object";
44

5-
export default class CollapsableComponent extends Component {
5+
export default class CollapsableComponent<
6+
Args extends {} = {}
7+
> extends Component<Args> {
68
@tracked
79
isCollapsed = true;
810

911
@tracked
10-
_items;
12+
_items: any;
1113

1214
get items() {
1315
return this._items.slice(0, this.isCollapsed ? 10 : this._items.length);
Lines changed: 58 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
import Component from "@glimmer/component";
2-
import { inject as service } from '@ember/service';
3-
import { tracked } from '@glimmer/tracking';
4-
import { action } from '@ember/object';
2+
import { inject as service } from "@ember/service";
3+
import { tracked } from "@glimmer/tracking";
4+
import { action } from "@ember/object";
5+
import type RouterService from "@ember/routing/router-service";
56

67
import gql from "graphql-tag";
8+
// @ts-ignore
79
import { queryManager } from "ember-apollo-client";
810

11+
type Args = {
12+
instantiationStack: string;
13+
};
14+
915
const query = gql`
1016
query query($filePath: String!) {
1117
file(filePath: $filePath) {
@@ -14,65 +20,81 @@ const query = gql`
1420
}
1521
`;
1622

17-
export default class InstantiationStackExplorer extends Component {
18-
@service router;
23+
export default class InstantiationStackExplorer extends Component<Args> {
24+
@service
25+
declare router: RouterService;
26+
// @ts-ignore
1927
@queryManager apollo;
2028

2129
@tracked selectedIndex = null;
2230
@tracked loading = false;
23-
@tracked file = null;
24-
@tracked line = null;
25-
@tracked column = null;
26-
@tracked filePath = null;
31+
@tracked file: string | null = null;
32+
@tracked line: number | null = null;
33+
@tracked column: number | null = null;
34+
@tracked filePath: string | null = null;
2735

2836
get instantiationStack() {
2937
const fileReg = /at (.+?)\((\/+.*):(.+?):(.+?)(\)|$)/m;
3038

31-
const { instantiationStack } = this.args
39+
const { instantiationStack } = this.args;
3240

33-
return instantiationStack.split('\n').map((stackLine) => {
34-
if(fileReg.exec(stackLine) !== null) {
41+
return instantiationStack.split("\n").map((stackLine) => {
42+
if (fileReg.exec(stackLine) !== null) {
3543
const match = fileReg.exec(stackLine);
3644

37-
return {
38-
stackLine: `at ${match[1]}`,
39-
filePath: match[2],
40-
line: match[3],
41-
column: match[4]
45+
if (match) {
46+
return {
47+
stackLine: `at ${match[1]}`,
48+
filePath: match[2],
49+
line: match[3],
50+
column: match[4],
51+
};
4252
}
4353
}
4454

45-
if(/at (\/+.*):(.+?):(.+?)$/m.exec(stackLine) !== null) {
55+
if (/at (\/+.*):(.+?):(.+?)$/m.exec(stackLine) !== null) {
4656
const match = /at (\/+.*):(.+?):(.+?)$/gm.exec(stackLine);
4757

48-
return {
49-
stackLine: `at ${match[1]}`,
50-
filePath: match[1],
51-
line: match[2],
52-
column: match[3]
58+
if (match) {
59+
return {
60+
stackLine: `at ${match[1]}`,
61+
filePath: match[1],
62+
line: match[2],
63+
column: match[3],
64+
};
5365
}
5466
}
5567

5668
return {
57-
stackLine
58-
}
69+
stackLine,
70+
};
5971
});
6072
}
6173

6274
@action
63-
onStackClick(filePath, line, column) {
75+
onStackClick(filePath: string, line: number, column: number) {
6476
this.loading = true;
6577

66-
return this.apollo.query({ query, variables: { filePath } }, "file").then((result) => {
67-
this.file = result.value;
68-
this.line = line;
69-
this.column = column;
70-
this.filePath = filePath;
71-
this.loading = false;
78+
return this.apollo
79+
.query({ query, variables: { filePath } }, "file")
80+
.then((result: any) => {
81+
this.file = result.value;
82+
this.line = line;
83+
this.column = column;
84+
this.filePath = filePath;
85+
this.loading = false;
7286

73-
setTimeout(function() {
74-
document.querySelector('.code-block').scroll(0, parseInt(document.querySelector('.line-highlight').style.top.replace('px', '')))
75-
}, 200)
76-
});
87+
setTimeout(function () {
88+
document?.querySelector(".code-block")?.scroll(
89+
0,
90+
parseInt(
91+
document
92+
?.querySelector(".line-highlight")
93+
// @ts-ignore
94+
?.style.top.replace("px", "")
95+
)
96+
);
97+
}, 200);
98+
});
7799
}
78100
}

app/components/navbar.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import Component from "@glimmer/component";
2-
import { inject as service } from '@ember/service';
3-
import { action } from '@ember/object';
4-
import { tracked } from '@glimmer/tracking';
2+
import { inject as service } from "@ember/service";
3+
import { action } from "@ember/object";
4+
import { tracked } from "@glimmer/tracking";
5+
import type Router from "@ember/routing/router";
56

67
export default class Navbar extends Component {
78
@service
8-
router;
9+
declare router: Router;
910

1011
@tracked
11-
searchTerm = '';
12+
searchTerm = "";
1213

1314
@tracked
1415
searchFormOpen = false;
@@ -18,11 +19,12 @@ export default class Navbar extends Component {
1819
this.searchFormOpen = !this.searchFormOpen;
1920
}
2021

22+
// TOOD: fix this with the right type
2123
@action
22-
search(e) {
23-
if(e.keyCode === 13) {
24-
this.router.transitionTo('search', {
25-
queryParams: { query: encodeURI(this.searchTerm) }
24+
search(e: any) {
25+
if (e.keyCode === 13) {
26+
this.router.transitionTo("search", {
27+
queryParams: { query: encodeURI(this.searchTerm) },
2628
});
2729
}
2830
}
Lines changed: 25 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import Component from "@glimmer/component";
2-
import { bind, later } from "@ember/runloop";
3-
import { action, computed } from "@ember/object";
4-
import { tracked } from '@glimmer/tracking';
2+
import { tracked } from "@glimmer/tracking";
3+
import { type FS } from "broccoli-inspector/types";
54

65
interface Args {
7-
fs?: FS
6+
fs?: FS;
87
}
98

109
export default class NodeInfoFsCount extends Component<Args> {
@@ -17,73 +16,69 @@ export default class NodeInfoFsCount extends Component<Args> {
1716
selectedTab = 0;
1817

1918
get fs() {
20-
const fs = this.args ?.fs || {};
19+
const fs = this.args?.fs || {};
2120
const body = Object.keys(fs)
2221
.filter((key) => {
23-
const item = fs[key];
22+
const item = (fs as any)[key];
2423

2524
return item && item.time;
2625
})
2726
.sort((keyA, keyB) => {
28-
const rowA = fs[keyA];
29-
const rowB = fs[keyB];
27+
const rowA = (fs as any)[keyA];
28+
const rowB = (fs as any)[keyB];
3029

3130
return rowB.time - rowA.time;
3231
})
3332
.map((key) => {
34-
const { time, count } = fs[key];
33+
const { time, count } = (fs as any)[key];
3534
// time is ns and we want to convert to ms
3635
return [key, { raw: time, text: `${time / 1000000}ms` }, count];
3736
});
3837

3938
return {
40-
header: [
41-
`Operation`,
42-
`Time`,
43-
`Count`
44-
],
45-
body
46-
}
39+
header: [`Operation`, `Time`, `Count`],
40+
body,
41+
};
4742
}
4843

4944
get data() {
5045
const columns = [];
51-
const fs = this.args ?.fs || {};
46+
const fs = this.args?.fs || {};
5247

5348
for (const operation in fs) {
54-
if (!fs[operation] || !fs[operation].count) continue;
55-
columns.push([operation, fs[operation].count])
49+
if (!(fs as any)[operation] || !(fs as any)[operation].count) continue;
50+
columns.push([operation, (fs as any)[operation].count]);
5651
}
5752

5853
return {
5954
columns,
60-
type: "pie"
61-
}
55+
type: "pie",
56+
};
6257
}
6358

6459
get legend() {
6560
return {
66-
show: true
67-
}
61+
show: true,
62+
};
6863
}
6964

7065
get tooltip() {
7166
return {
7267
format: {
73-
value: function (value, ratio, id, index) {
68+
value: function (value: string, ratio: number) {
7469
return `${value} | ${Number(ratio * 100).toFixed(0)}%`;
75-
}
76-
}
70+
},
71+
},
7772
};
7873
}
7974

8075
get pie() {
8176
return {
8277
label: {
83-
format: function(value, ratio, id) {
78+
format: function (value: string) {
8479
return value;
85-
}
86-
}
87-
}
80+
},
81+
},
82+
};
8883
}
8984
}

0 commit comments

Comments
 (0)