currentactivity 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +38 -0
- package/build/extension.js +13 -0
- package/build/index.js +303 -0
- package/package.json +39 -0
- package/src/@types/treeify.d.ts +11 -0
- package/src/extension.ts +23 -0
- package/src/index.ts +371 -0
- package/tsconfig.json +101 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Zech
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# currentactivity
|
|
2
|
+
> A command line tool to display the current activity for android
|
|
3
|
+
|
|
4
|
+
## Feature
|
|
5
|
+
1. show current window package name and activity name.
|
|
6
|
+
2. show current display activity stack.
|
|
7
|
+
3. show current display fragments in focused activity.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
npm install -g currentactivity
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Preamble
|
|
16
|
+
|
|
17
|
+
To use this cli tool, you need to install [adb](https://developer.android.com/studio/command-line/adb) first. If If you are using Mac OS, you can use homebrew to install adb.
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
brew install android-platform-tools
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
Exec `currentactivity` in your terminal.
|
|
25
|
+
```
|
|
26
|
+
currentactivity
|
|
27
|
+
```
|
|
28
|
+
That's it.
|
|
29
|
+
|
|
30
|
+
## Changelog
|
|
31
|
+
|
|
32
|
+
* 1.0.0
|
|
33
|
+
* Initial version
|
|
34
|
+
|
|
35
|
+
## License
|
|
36
|
+
|
|
37
|
+
MIT
|
|
38
|
+
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
if (!Array.prototype.last) {
|
|
4
|
+
Array.prototype.last = function (n) {
|
|
5
|
+
return this[this.length - 1 - n];
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
if (!String.prototype.removeLast) {
|
|
9
|
+
String.prototype.removeLast = function (n) {
|
|
10
|
+
const end = this.length - n;
|
|
11
|
+
return this.substring(0, end);
|
|
12
|
+
};
|
|
13
|
+
}
|
package/build/index.js
ADDED
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
#! /usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
4
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
5
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
6
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
7
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
8
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
9
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
const child_process_1 = require("child_process");
|
|
14
|
+
const table_1 = require("table");
|
|
15
|
+
const treeify_1 = require("treeify");
|
|
16
|
+
require("./extension");
|
|
17
|
+
function printDumpInfo() {
|
|
18
|
+
var _a, _b, _c, _d, _e, _f;
|
|
19
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
// exec adb shell dumpsys window displays
|
|
21
|
+
const windowOutput = (0, child_process_1.execSync)("adb shell dumpsys window displays", {
|
|
22
|
+
encoding: "utf-8",
|
|
23
|
+
});
|
|
24
|
+
const windowLines = windowOutput.split("\n");
|
|
25
|
+
const currentFocusLine = findFirstLines(windowLines, "mCurrentFocus");
|
|
26
|
+
const currentWindow = (_b = (_a = currentFocusLine === null || currentFocusLine === void 0 ? void 0 : currentFocusLine.split(" ")) === null || _a === void 0 ? void 0 : _a.last(0)) === null || _b === void 0 ? void 0 : _b.removeLast(1);
|
|
27
|
+
const currentFocusAppLine = findFirstLines(windowLines, "mFocusedApp");
|
|
28
|
+
const currentActivity = (_c = currentFocusAppLine === null || currentFocusAppLine === void 0 ? void 0 : currentFocusAppLine.split(" ")) === null || _c === void 0 ? void 0 : _c.last(1);
|
|
29
|
+
const stackId = (_e = (_d = currentFocusAppLine === null || currentFocusAppLine === void 0 ? void 0 : currentFocusAppLine.split(" ")) === null || _d === void 0 ? void 0 : _d.last(0)) === null || _e === void 0 ? void 0 : _e.removeLast(1);
|
|
30
|
+
const currentApp = (_f = currentActivity === null || currentActivity === void 0 ? void 0 : currentActivity.split("/")) === null || _f === void 0 ? void 0 : _f.at(0);
|
|
31
|
+
const frameworkFragmentLines = Array();
|
|
32
|
+
const androidxFragmentLines = Array();
|
|
33
|
+
if (currentApp != undefined) {
|
|
34
|
+
const activityOutput = (0, child_process_1.execSync)("adb shell dumpsys activity " + currentApp, { encoding: "utf-8" });
|
|
35
|
+
const activityLines = activityOutput.split("\n");
|
|
36
|
+
// 1. find top activity
|
|
37
|
+
const activitesLines = findLines(activityLines, "ACTIVITY");
|
|
38
|
+
let sliceStart = 0;
|
|
39
|
+
let sliceEnd = activityLines.length - 1;
|
|
40
|
+
activitesLines.forEach((v, index) => {
|
|
41
|
+
if (currentActivity && v.content.indexOf(currentActivity) > 0) {
|
|
42
|
+
sliceStart = v.index;
|
|
43
|
+
if (index + 1 <= activitesLines.length - 1) {
|
|
44
|
+
sliceEnd = activitesLines[index + 1].index;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
// 2. cut out the top activity lines
|
|
49
|
+
const topActivityLines = activityLines.slice(sliceStart, sliceEnd);
|
|
50
|
+
// 3. split into framework fragments and androidx fragments
|
|
51
|
+
const splitLine = findLastLines(topActivityLines, "Local FragmentActivity");
|
|
52
|
+
let frameworkLines;
|
|
53
|
+
let androidxLines;
|
|
54
|
+
if (splitLine != undefined) {
|
|
55
|
+
const splitLineIndex = topActivityLines.indexOf(splitLine);
|
|
56
|
+
frameworkLines = topActivityLines.slice(0, splitLineIndex);
|
|
57
|
+
androidxLines = topActivityLines.slice(splitLineIndex);
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
frameworkLines = topActivityLines;
|
|
61
|
+
}
|
|
62
|
+
// 4. find all children of between "Active Fragments" and "Added Fragments" node
|
|
63
|
+
const frameworkRangeLines = findRangeLines(frameworkLines, "Active Fragments", "Added Fragments");
|
|
64
|
+
frameworkRangeLines.sort((a, b) => a.start.index - b.start.index);
|
|
65
|
+
frameworkRangeLines.forEach((v) => {
|
|
66
|
+
const firstFragmentLine = frameworkLines === null || frameworkLines === void 0 ? void 0 : frameworkLines.at(v.start.index + 1);
|
|
67
|
+
if (firstFragmentLine) {
|
|
68
|
+
frameworkFragmentLines.push({
|
|
69
|
+
content: firstFragmentLine,
|
|
70
|
+
index: v.start.index + 1,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
frameworkLines === null || frameworkLines === void 0 ? void 0 : frameworkLines.forEach((item, index) => {
|
|
74
|
+
if (firstFragmentLine &&
|
|
75
|
+
spaceCount(item) == spaceCount(firstFragmentLine) &&
|
|
76
|
+
index > v.start.index + 1 &&
|
|
77
|
+
index < v.end.index) {
|
|
78
|
+
frameworkFragmentLines.push({ content: item, index: index });
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
if (androidxLines) {
|
|
83
|
+
const androidxRangeLines = findRangeLines(androidxLines, "Active Fragments", "Added Fragments");
|
|
84
|
+
androidxRangeLines.sort((a, b) => a.start.index - b.start.index);
|
|
85
|
+
androidxRangeLines.forEach((v) => {
|
|
86
|
+
const firstFragmentLine = androidxLines === null || androidxLines === void 0 ? void 0 : androidxLines.at(v.start.index + 1);
|
|
87
|
+
if (firstFragmentLine) {
|
|
88
|
+
androidxFragmentLines.push({
|
|
89
|
+
content: firstFragmentLine,
|
|
90
|
+
index: v.start.index + 1,
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
androidxLines === null || androidxLines === void 0 ? void 0 : androidxLines.forEach((item, index) => {
|
|
94
|
+
if (firstFragmentLine &&
|
|
95
|
+
spaceCount(item) == spaceCount(firstFragmentLine) &&
|
|
96
|
+
index > v.start.index + 1 &&
|
|
97
|
+
index < v.end.index) {
|
|
98
|
+
androidxFragmentLines.push({ content: item, index: index });
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
console.clear();
|
|
105
|
+
// print current window
|
|
106
|
+
if (currentWindow) {
|
|
107
|
+
const windowTable = Array();
|
|
108
|
+
windowTable.push([currentWindow]);
|
|
109
|
+
console.log((0, table_1.table)(windowTable, {
|
|
110
|
+
header: { content: "current window", alignment: "center" },
|
|
111
|
+
}));
|
|
112
|
+
}
|
|
113
|
+
// print current activity stack
|
|
114
|
+
if (stackId != undefined) {
|
|
115
|
+
const stackLines = windowLines.filter((v) => {
|
|
116
|
+
const s = v.trim();
|
|
117
|
+
return s.startsWith("*") && s.indexOf(stackId) > 0;
|
|
118
|
+
});
|
|
119
|
+
const stacks = stackLines.map((v) => v.trim().split(" ")[3]);
|
|
120
|
+
if (stacks[0] != currentActivity) {
|
|
121
|
+
stacks.shift();
|
|
122
|
+
}
|
|
123
|
+
const statckTable = Array();
|
|
124
|
+
stacks.forEach((v) => statckTable.push([v]));
|
|
125
|
+
console.log("\n");
|
|
126
|
+
console.log((0, table_1.table)(statckTable, {
|
|
127
|
+
header: { content: "activity stack", alignment: "center" },
|
|
128
|
+
}));
|
|
129
|
+
}
|
|
130
|
+
// print current fragments which in focused activity
|
|
131
|
+
if (frameworkFragmentLines.length > 0 || androidxFragmentLines.length > 0) {
|
|
132
|
+
const fragmentTable = Array();
|
|
133
|
+
if (frameworkFragmentLines.length > 0) {
|
|
134
|
+
frameworkFragmentLines.sort((a, b) => a.index - b.index);
|
|
135
|
+
fragmentTable.push([
|
|
136
|
+
"framework fragments",
|
|
137
|
+
(0, treeify_1.asTree)(toTreeObject(listToTree(toTreeArray(frameworkFragmentLines))), true),
|
|
138
|
+
]);
|
|
139
|
+
}
|
|
140
|
+
if (androidxFragmentLines.length > 0) {
|
|
141
|
+
androidxFragmentLines.sort((a, b) => a.index - b.index);
|
|
142
|
+
fragmentTable.push([
|
|
143
|
+
"androidx fragments",
|
|
144
|
+
(0, treeify_1.asTree)(toTreeObject(listToTree(toTreeArray(androidxFragmentLines))), true),
|
|
145
|
+
]);
|
|
146
|
+
}
|
|
147
|
+
console.log("\n");
|
|
148
|
+
console.log((0, table_1.table)(fragmentTable, {
|
|
149
|
+
header: { content: "fragments", alignment: "center" },
|
|
150
|
+
}));
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
function toTreeArray(arr) {
|
|
155
|
+
const result = Array();
|
|
156
|
+
arr.forEach((v, index) => {
|
|
157
|
+
result.push({
|
|
158
|
+
id: index.toString(),
|
|
159
|
+
content: v.content.trim(),
|
|
160
|
+
parentId: findParentIndex(arr.map((item) => item.content), v.content)
|
|
161
|
+
.toString(),
|
|
162
|
+
children: null,
|
|
163
|
+
});
|
|
164
|
+
});
|
|
165
|
+
return result;
|
|
166
|
+
}
|
|
167
|
+
function findParentIndex(arr, target) {
|
|
168
|
+
const targetIndex = arr.indexOf(target);
|
|
169
|
+
if (targetIndex < 0)
|
|
170
|
+
return -1;
|
|
171
|
+
let parentIndex = -1;
|
|
172
|
+
for (let index = targetIndex; index >= 0; index--) {
|
|
173
|
+
const element = arr[index];
|
|
174
|
+
if (spaceCount(element) < spaceCount(target)) {
|
|
175
|
+
parentIndex = index;
|
|
176
|
+
break;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
return parentIndex;
|
|
180
|
+
}
|
|
181
|
+
function findParent(arr, target) {
|
|
182
|
+
const targetIndex = arr.indexOf(target);
|
|
183
|
+
if (targetIndex < 0)
|
|
184
|
+
return undefined;
|
|
185
|
+
let parent = undefined;
|
|
186
|
+
for (let index = targetIndex; index >= 0; index--) {
|
|
187
|
+
const element = arr[index];
|
|
188
|
+
if (spaceCount(element) < spaceCount(target)) {
|
|
189
|
+
parent = element;
|
|
190
|
+
break;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
return parent;
|
|
194
|
+
}
|
|
195
|
+
function listToTree(arr) {
|
|
196
|
+
var _a;
|
|
197
|
+
const map = {};
|
|
198
|
+
let node;
|
|
199
|
+
const roots = Array();
|
|
200
|
+
for (let index = 0; index < arr.length; index++) {
|
|
201
|
+
map[arr[index].id] = index;
|
|
202
|
+
arr[index].children = [];
|
|
203
|
+
}
|
|
204
|
+
for (let index = 0; index < arr.length; index++) {
|
|
205
|
+
node = arr[index];
|
|
206
|
+
if (node.parentId !== "-1") {
|
|
207
|
+
// if you have dangling branches check that map[node.parentId] exists
|
|
208
|
+
(_a = arr[map[node.parentId]].children) === null || _a === void 0 ? void 0 : _a.push(node);
|
|
209
|
+
}
|
|
210
|
+
else {
|
|
211
|
+
roots.push(node);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
return roots;
|
|
215
|
+
}
|
|
216
|
+
function toTreeObject(arr) {
|
|
217
|
+
const result = {};
|
|
218
|
+
arr.forEach((v) => {
|
|
219
|
+
if (v.children && v.children.length > 0) {
|
|
220
|
+
result[v.content.trim()] = toTreeObject(v.children);
|
|
221
|
+
}
|
|
222
|
+
else {
|
|
223
|
+
result[v.content.trim()] = null;
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
return result;
|
|
227
|
+
}
|
|
228
|
+
function findChildren(arr, target) {
|
|
229
|
+
const result = Array();
|
|
230
|
+
const targetIndex = arr.indexOf(target);
|
|
231
|
+
if (targetIndex < 0 || targetIndex == arr.length - 1)
|
|
232
|
+
return result;
|
|
233
|
+
const nextBrotherIndex = arr.findIndex((v, i) => spaceCount(v) == spaceCount(target) && i > targetIndex);
|
|
234
|
+
if (nextBrotherIndex == targetIndex + 1)
|
|
235
|
+
return result;
|
|
236
|
+
const firstChild = arr.at(targetIndex + 1);
|
|
237
|
+
if (firstChild) {
|
|
238
|
+
const range = arr.slice(targetIndex, nextBrotherIndex);
|
|
239
|
+
const children = range.filter((v) => spaceCount(v) == spaceCount(firstChild));
|
|
240
|
+
result.concat(children);
|
|
241
|
+
}
|
|
242
|
+
return result;
|
|
243
|
+
}
|
|
244
|
+
function spaceCount(value) {
|
|
245
|
+
const trim = value.trimStart();
|
|
246
|
+
return value.length - trim.length;
|
|
247
|
+
}
|
|
248
|
+
function findLines(lines, target) {
|
|
249
|
+
const result = Array();
|
|
250
|
+
lines.forEach((v, i) => {
|
|
251
|
+
if (v.indexOf(target) > 0) {
|
|
252
|
+
result.push({
|
|
253
|
+
content: v,
|
|
254
|
+
index: i,
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
return result;
|
|
259
|
+
}
|
|
260
|
+
function findFirstLines(lines, target) {
|
|
261
|
+
var _a;
|
|
262
|
+
return (_a = findLines(lines, target).at(0)) === null || _a === void 0 ? void 0 : _a.content;
|
|
263
|
+
}
|
|
264
|
+
function findLastLines(lines, target) {
|
|
265
|
+
var _a;
|
|
266
|
+
return (_a = findLines(lines, target).last(0)) === null || _a === void 0 ? void 0 : _a.content;
|
|
267
|
+
}
|
|
268
|
+
function findRangeLines(lines, start, end) {
|
|
269
|
+
const startLines = findLines(lines, start);
|
|
270
|
+
const endLines = findLines(lines, end);
|
|
271
|
+
const allLines = startLines.concat(endLines);
|
|
272
|
+
allLines.sort((a, b) => a.index - b.index);
|
|
273
|
+
const children = Array();
|
|
274
|
+
const stack = Array();
|
|
275
|
+
allLines.forEach((v) => {
|
|
276
|
+
if (startLines.some((line) => Object.is(line, v))) {
|
|
277
|
+
stack.push(v);
|
|
278
|
+
}
|
|
279
|
+
else {
|
|
280
|
+
const start = stack.pop();
|
|
281
|
+
if (start) {
|
|
282
|
+
children.push({
|
|
283
|
+
start,
|
|
284
|
+
end: v,
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
});
|
|
289
|
+
return children;
|
|
290
|
+
}
|
|
291
|
+
let oldActivity = "";
|
|
292
|
+
function main(onCurrentWindowChanged) {
|
|
293
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
294
|
+
while (true) {
|
|
295
|
+
const currentActivity = (0, child_process_1.execSync)("adb shell dumpsys window displays | grep -E 'mCurrentFocus'", { encoding: "utf-8" });
|
|
296
|
+
if (oldActivity != currentActivity) {
|
|
297
|
+
onCurrentWindowChanged();
|
|
298
|
+
oldActivity = currentActivity;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
main(() => printDumpInfo());
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "currentactivity",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A command line tool to display the current activity for android.",
|
|
5
|
+
"main": "./build/index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"start": "tsc && node ./build/index.js"
|
|
8
|
+
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/Alluretears/currentactivity.git"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [
|
|
14
|
+
"current activity",
|
|
15
|
+
"activity",
|
|
16
|
+
"fragment",
|
|
17
|
+
"android"
|
|
18
|
+
],
|
|
19
|
+
"author": "Zech",
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"bugs": {
|
|
22
|
+
"url": "https://github.com/Alluretears/currentactivity/issues"
|
|
23
|
+
},
|
|
24
|
+
"homepage": "https://github.com/Alluretears/currentactivity#readme",
|
|
25
|
+
"bin": {
|
|
26
|
+
"currentactivity": "./build/index.js"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"ts-node": "^10.4.0",
|
|
30
|
+
"typescript": "^4.5.5"
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"table": "^6.8.0",
|
|
34
|
+
"treeify": "^1.1.0"
|
|
35
|
+
},
|
|
36
|
+
"publishConfig": {
|
|
37
|
+
"access": "public"
|
|
38
|
+
}
|
|
39
|
+
}
|
package/src/extension.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
interface Array<T> {
|
|
3
|
+
last(n: number): T;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
interface String {
|
|
7
|
+
removeLast(n: number): string;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
if (!Array.prototype.last) {
|
|
11
|
+
Array.prototype.last = function <T>(n: number): T {
|
|
12
|
+
return this[this.length - 1 - n];
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
if (!String.prototype.removeLast) {
|
|
17
|
+
String.prototype.removeLast = function (n: number): string {
|
|
18
|
+
const end = this.length - n;
|
|
19
|
+
return this.substring(0, end);
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export {};
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
#! /usr/bin/env node
|
|
2
|
+
import { execSync } from "child_process";
|
|
3
|
+
import { table } from "table";
|
|
4
|
+
import { asTree } from "treeify";
|
|
5
|
+
import "./extension";
|
|
6
|
+
|
|
7
|
+
async function printDumpInfo() {
|
|
8
|
+
// exec adb shell dumpsys window displays
|
|
9
|
+
const windowOutput = execSync("adb shell dumpsys window displays", {
|
|
10
|
+
encoding: "utf-8",
|
|
11
|
+
});
|
|
12
|
+
const windowLines = windowOutput.split("\n");
|
|
13
|
+
|
|
14
|
+
const currentFocusLine = findFirstLines(windowLines, "mCurrentFocus");
|
|
15
|
+
const currentWindow = currentFocusLine?.split(" ")?.last(0)?.removeLast(1);
|
|
16
|
+
|
|
17
|
+
const currentFocusAppLine = findFirstLines(windowLines, "mFocusedApp");
|
|
18
|
+
const currentActivity = currentFocusAppLine?.split(" ")?.last(1);
|
|
19
|
+
const stackId = currentFocusAppLine?.split(" ")?.last(0)?.removeLast(1);
|
|
20
|
+
const currentApp = currentActivity?.split("/")?.at(0);
|
|
21
|
+
|
|
22
|
+
const frameworkFragmentLines = Array<Line>();
|
|
23
|
+
const androidxFragmentLines = Array<Line>();
|
|
24
|
+
if (currentApp != undefined) {
|
|
25
|
+
const activityOutput = execSync(
|
|
26
|
+
"adb shell dumpsys activity " + currentApp,
|
|
27
|
+
{ encoding: "utf-8" },
|
|
28
|
+
);
|
|
29
|
+
const activityLines = activityOutput.split("\n");
|
|
30
|
+
|
|
31
|
+
// 1. find top activity
|
|
32
|
+
const activitesLines = findLines(activityLines, "ACTIVITY");
|
|
33
|
+
let sliceStart = 0;
|
|
34
|
+
let sliceEnd = activityLines.length - 1;
|
|
35
|
+
activitesLines.forEach((v, index) => {
|
|
36
|
+
if (currentActivity && v.content.indexOf(currentActivity) > 0) {
|
|
37
|
+
sliceStart = v.index;
|
|
38
|
+
if (index + 1 <= activitesLines.length - 1) {
|
|
39
|
+
sliceEnd = activitesLines[index + 1].index;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
// 2. cut out the top activity lines
|
|
45
|
+
const topActivityLines = activityLines.slice(sliceStart, sliceEnd);
|
|
46
|
+
// 3. split into framework fragments and androidx fragments
|
|
47
|
+
const splitLine = findLastLines(
|
|
48
|
+
topActivityLines,
|
|
49
|
+
"Local FragmentActivity",
|
|
50
|
+
);
|
|
51
|
+
let frameworkLines: Array<string>;
|
|
52
|
+
let androidxLines: Array<string> | undefined;
|
|
53
|
+
if (splitLine != undefined) {
|
|
54
|
+
const splitLineIndex = topActivityLines.indexOf(splitLine);
|
|
55
|
+
frameworkLines = topActivityLines.slice(0, splitLineIndex);
|
|
56
|
+
androidxLines = topActivityLines.slice(splitLineIndex);
|
|
57
|
+
} else {
|
|
58
|
+
frameworkLines = topActivityLines;
|
|
59
|
+
}
|
|
60
|
+
// 4. find all children of between "Active Fragments" and "Added Fragments" node
|
|
61
|
+
const frameworkRangeLines = findRangeLines(
|
|
62
|
+
frameworkLines,
|
|
63
|
+
"Active Fragments",
|
|
64
|
+
"Added Fragments",
|
|
65
|
+
);
|
|
66
|
+
frameworkRangeLines.sort((a, b) => a.start.index - b.start.index);
|
|
67
|
+
frameworkRangeLines.forEach((v) => {
|
|
68
|
+
const firstFragmentLine = frameworkLines?.at(v.start.index + 1);
|
|
69
|
+
if (firstFragmentLine) {
|
|
70
|
+
frameworkFragmentLines.push({
|
|
71
|
+
content: firstFragmentLine,
|
|
72
|
+
index: v.start.index + 1,
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
frameworkLines?.forEach((item, index) => {
|
|
76
|
+
if (
|
|
77
|
+
firstFragmentLine &&
|
|
78
|
+
spaceCount(item) == spaceCount(firstFragmentLine) &&
|
|
79
|
+
index > v.start.index + 1 &&
|
|
80
|
+
index < v.end.index
|
|
81
|
+
) {
|
|
82
|
+
frameworkFragmentLines.push({ content: item, index: index });
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
if (androidxLines) {
|
|
88
|
+
const androidxRangeLines = findRangeLines(
|
|
89
|
+
androidxLines,
|
|
90
|
+
"Active Fragments",
|
|
91
|
+
"Added Fragments",
|
|
92
|
+
);
|
|
93
|
+
androidxRangeLines.sort((a, b) => a.start.index - b.start.index);
|
|
94
|
+
|
|
95
|
+
androidxRangeLines.forEach((v) => {
|
|
96
|
+
const firstFragmentLine = androidxLines?.at(v.start.index + 1);
|
|
97
|
+
if (firstFragmentLine) {
|
|
98
|
+
androidxFragmentLines.push({
|
|
99
|
+
content: firstFragmentLine,
|
|
100
|
+
index: v.start.index + 1,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
androidxLines?.forEach((item, index) => {
|
|
104
|
+
if (
|
|
105
|
+
firstFragmentLine &&
|
|
106
|
+
spaceCount(item) == spaceCount(firstFragmentLine) &&
|
|
107
|
+
index > v.start.index + 1 &&
|
|
108
|
+
index < v.end.index
|
|
109
|
+
) {
|
|
110
|
+
androidxFragmentLines.push({ content: item, index: index });
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
console.clear();
|
|
118
|
+
|
|
119
|
+
// print current window
|
|
120
|
+
if (currentWindow) {
|
|
121
|
+
const windowTable = Array<Array<string>>();
|
|
122
|
+
windowTable.push([currentWindow]);
|
|
123
|
+
console.log(
|
|
124
|
+
table(windowTable, {
|
|
125
|
+
header: { content: "current window", alignment: "center" },
|
|
126
|
+
}),
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// print current activity stack
|
|
131
|
+
if (stackId != undefined) {
|
|
132
|
+
const stackLines = windowLines.filter((v) => {
|
|
133
|
+
const s = v.trim();
|
|
134
|
+
return s.startsWith("*") && s.indexOf(stackId) > 0;
|
|
135
|
+
});
|
|
136
|
+
const stacks = stackLines.map((v) => v.trim().split(" ")[3]);
|
|
137
|
+
if (stacks[0] != currentActivity) {
|
|
138
|
+
stacks.shift();
|
|
139
|
+
}
|
|
140
|
+
const statckTable = Array<Array<string>>();
|
|
141
|
+
stacks.forEach((v) => statckTable.push([v]));
|
|
142
|
+
console.log("\n");
|
|
143
|
+
console.log(
|
|
144
|
+
table(statckTable, {
|
|
145
|
+
header: { content: "activity stack", alignment: "center" },
|
|
146
|
+
}),
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// print current fragments which in focused activity
|
|
151
|
+
if (frameworkFragmentLines.length > 0 || androidxFragmentLines.length > 0) {
|
|
152
|
+
const fragmentTable = Array<Array<string>>();
|
|
153
|
+
if (frameworkFragmentLines.length > 0) {
|
|
154
|
+
frameworkFragmentLines.sort((a, b) => a.index - b.index);
|
|
155
|
+
fragmentTable.push([
|
|
156
|
+
"framework fragments",
|
|
157
|
+
asTree(
|
|
158
|
+
toTreeObject(listToTree(toTreeArray(frameworkFragmentLines))),
|
|
159
|
+
true,
|
|
160
|
+
),
|
|
161
|
+
]);
|
|
162
|
+
}
|
|
163
|
+
if (androidxFragmentLines.length > 0) {
|
|
164
|
+
androidxFragmentLines.sort((a, b) => a.index - b.index);
|
|
165
|
+
fragmentTable.push([
|
|
166
|
+
"androidx fragments",
|
|
167
|
+
asTree(
|
|
168
|
+
toTreeObject(listToTree(toTreeArray(androidxFragmentLines))),
|
|
169
|
+
true,
|
|
170
|
+
),
|
|
171
|
+
]);
|
|
172
|
+
}
|
|
173
|
+
console.log("\n");
|
|
174
|
+
console.log(
|
|
175
|
+
table(fragmentTable, {
|
|
176
|
+
header: { content: "fragments", alignment: "center" },
|
|
177
|
+
}),
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
type Tree = {
|
|
183
|
+
id: string;
|
|
184
|
+
content: string;
|
|
185
|
+
parentId: string;
|
|
186
|
+
children: Tree[] | null;
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
function toTreeArray(arr: Array<Line>): Array<Tree> {
|
|
190
|
+
const result = Array<Tree>();
|
|
191
|
+
arr.forEach((v, index) => {
|
|
192
|
+
result.push({
|
|
193
|
+
id: index.toString(),
|
|
194
|
+
content: v.content.trim(),
|
|
195
|
+
parentId: findParentIndex(arr.map((item) => item.content), v.content)
|
|
196
|
+
.toString(),
|
|
197
|
+
children: null,
|
|
198
|
+
});
|
|
199
|
+
});
|
|
200
|
+
return result;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
function findParentIndex(
|
|
204
|
+
arr: Array<string>,
|
|
205
|
+
target: string,
|
|
206
|
+
): number {
|
|
207
|
+
const targetIndex = arr.indexOf(target);
|
|
208
|
+
if (targetIndex < 0) return -1;
|
|
209
|
+
let parentIndex = -1;
|
|
210
|
+
for (let index = targetIndex; index >= 0; index--) {
|
|
211
|
+
const element = arr[index];
|
|
212
|
+
if (spaceCount(element) < spaceCount(target)) {
|
|
213
|
+
parentIndex = index;
|
|
214
|
+
break;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
return parentIndex;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
function findParent(arr: Array<string>, target: string): string | undefined {
|
|
221
|
+
const targetIndex = arr.indexOf(target);
|
|
222
|
+
if (targetIndex < 0) return undefined;
|
|
223
|
+
let parent = undefined;
|
|
224
|
+
for (let index = targetIndex; index >= 0; index--) {
|
|
225
|
+
const element = arr[index];
|
|
226
|
+
if (spaceCount(element) < spaceCount(target)) {
|
|
227
|
+
parent = element;
|
|
228
|
+
break;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
return parent;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
function listToTree(arr: Array<Tree>): Array<Tree> {
|
|
235
|
+
const map: { [k: string]: number } = {};
|
|
236
|
+
let node: Tree;
|
|
237
|
+
const roots = Array<Tree>();
|
|
238
|
+
for (let index = 0; index < arr.length; index++) {
|
|
239
|
+
map[arr[index].id] = index;
|
|
240
|
+
arr[index].children = [];
|
|
241
|
+
}
|
|
242
|
+
for (let index = 0; index < arr.length; index++) {
|
|
243
|
+
node = arr[index];
|
|
244
|
+
if (node.parentId !== "-1") {
|
|
245
|
+
// if you have dangling branches check that map[node.parentId] exists
|
|
246
|
+
arr[map[node.parentId]].children?.push(node);
|
|
247
|
+
} else {
|
|
248
|
+
roots.push(node);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
return roots;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
function toTreeObject(arr: Array<Tree>): { [k: string]: any } {
|
|
255
|
+
const result: { [k: string]: any } = {};
|
|
256
|
+
arr.forEach((v) => {
|
|
257
|
+
if (v.children && v.children.length > 0) {
|
|
258
|
+
result[v.content.trim()] = toTreeObject(v.children);
|
|
259
|
+
} else {
|
|
260
|
+
result[v.content.trim()] = null;
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
return result;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
function findChildren(arr: Array<string>, target: string): Array<string> {
|
|
267
|
+
const result = Array<string>();
|
|
268
|
+
const targetIndex = arr.indexOf(target);
|
|
269
|
+
if (targetIndex < 0 || targetIndex == arr.length - 1) return result;
|
|
270
|
+
const nextBrotherIndex = arr.findIndex((v, i) =>
|
|
271
|
+
spaceCount(v) == spaceCount(target) && i > targetIndex
|
|
272
|
+
);
|
|
273
|
+
if (nextBrotherIndex == targetIndex + 1) return result;
|
|
274
|
+
const firstChild = arr.at(targetIndex + 1);
|
|
275
|
+
if (firstChild) {
|
|
276
|
+
const range = arr.slice(targetIndex, nextBrotherIndex);
|
|
277
|
+
const children = range.filter((v) =>
|
|
278
|
+
spaceCount(v) == spaceCount(firstChild)
|
|
279
|
+
);
|
|
280
|
+
result.concat(children);
|
|
281
|
+
}
|
|
282
|
+
return result;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
function spaceCount(value: string): number {
|
|
286
|
+
const trim = value.trimStart();
|
|
287
|
+
return value.length - trim.length;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
type Line = {
|
|
291
|
+
content: string;
|
|
292
|
+
index: number;
|
|
293
|
+
};
|
|
294
|
+
|
|
295
|
+
function findLines(
|
|
296
|
+
lines: Array<string>,
|
|
297
|
+
target: string,
|
|
298
|
+
): Array<Line> {
|
|
299
|
+
const result = Array<Line>();
|
|
300
|
+
lines.forEach((v, i) => {
|
|
301
|
+
if (v.indexOf(target) > 0) {
|
|
302
|
+
result.push({
|
|
303
|
+
content: v,
|
|
304
|
+
index: i,
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
return result;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
function findFirstLines(
|
|
312
|
+
lines: Array<string>,
|
|
313
|
+
target: string,
|
|
314
|
+
): string | undefined {
|
|
315
|
+
return findLines(lines, target).at(0)?.content;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
function findLastLines(
|
|
319
|
+
lines: Array<string>,
|
|
320
|
+
target: string,
|
|
321
|
+
): string | undefined {
|
|
322
|
+
return findLines(lines, target).last(0)?.content;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
type RangeLine = {
|
|
326
|
+
start: Line;
|
|
327
|
+
end: Line;
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
function findRangeLines(
|
|
331
|
+
lines: Array<string>,
|
|
332
|
+
start: string,
|
|
333
|
+
end: string,
|
|
334
|
+
): Array<RangeLine> {
|
|
335
|
+
const startLines = findLines(lines, start);
|
|
336
|
+
const endLines = findLines(lines, end);
|
|
337
|
+
const allLines = startLines.concat(endLines);
|
|
338
|
+
allLines.sort((a, b) => a.index - b.index);
|
|
339
|
+
const children = Array<RangeLine>();
|
|
340
|
+
const stack = Array<Line>();
|
|
341
|
+
allLines.forEach((v) => {
|
|
342
|
+
if (startLines.some((line) => Object.is(line, v))) {
|
|
343
|
+
stack.push(v);
|
|
344
|
+
} else {
|
|
345
|
+
const start = stack.pop();
|
|
346
|
+
if (start) {
|
|
347
|
+
children.push({
|
|
348
|
+
start,
|
|
349
|
+
end: v,
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
});
|
|
354
|
+
return children;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
let oldActivity = "";
|
|
358
|
+
async function main(onCurrentWindowChanged: () => void) {
|
|
359
|
+
while (true) {
|
|
360
|
+
const currentActivity = execSync(
|
|
361
|
+
"adb shell dumpsys window displays | grep -E 'mCurrentFocus'",
|
|
362
|
+
{ encoding: "utf-8" },
|
|
363
|
+
);
|
|
364
|
+
if (oldActivity != currentActivity) {
|
|
365
|
+
onCurrentWindowChanged();
|
|
366
|
+
oldActivity = currentActivity;
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
main(() => printDumpInfo());
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
/* Visit https://aka.ms/tsconfig.json to read more about this file */
|
|
4
|
+
|
|
5
|
+
/* Projects */
|
|
6
|
+
// "incremental": true, /* Enable incremental compilation */
|
|
7
|
+
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
|
8
|
+
// "tsBuildInfoFile": "./", /* Specify the folder for .tsbuildinfo incremental compilation files. */
|
|
9
|
+
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects */
|
|
10
|
+
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
|
11
|
+
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
|
12
|
+
|
|
13
|
+
/* Language and Environment */
|
|
14
|
+
"target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
|
15
|
+
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
|
16
|
+
// "jsx": "preserve", /* Specify what JSX code is generated. */
|
|
17
|
+
// "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
|
|
18
|
+
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
|
19
|
+
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h' */
|
|
20
|
+
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
|
|
21
|
+
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using `jsx: react-jsx*`.` */
|
|
22
|
+
// "reactNamespace": "", /* Specify the object invoked for `createElement`. This only applies when targeting `react` JSX emit. */
|
|
23
|
+
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
|
24
|
+
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
|
25
|
+
|
|
26
|
+
/* Modules */
|
|
27
|
+
"module": "commonjs", /* Specify what module code is generated. */
|
|
28
|
+
// "rootDir": "./", /* Specify the root folder within your source files. */
|
|
29
|
+
"moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
|
|
30
|
+
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
|
31
|
+
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
|
32
|
+
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
|
33
|
+
// "typeRoots": [], /* Specify multiple folders that act like `./node_modules/@types`. */
|
|
34
|
+
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
|
35
|
+
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
|
36
|
+
// "resolveJsonModule": true, /* Enable importing .json files */
|
|
37
|
+
// "noResolve": true, /* Disallow `import`s, `require`s or `<reference>`s from expanding the number of files TypeScript should add to a project. */
|
|
38
|
+
|
|
39
|
+
/* JavaScript Support */
|
|
40
|
+
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */
|
|
41
|
+
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
|
|
42
|
+
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`. */
|
|
43
|
+
|
|
44
|
+
/* Emit */
|
|
45
|
+
// "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
|
46
|
+
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
|
|
47
|
+
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
|
48
|
+
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
|
49
|
+
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */
|
|
50
|
+
"outDir": "./build", /* Specify an output folder for all emitted files. */
|
|
51
|
+
// "removeComments": true, /* Disable emitting comments. */
|
|
52
|
+
// "noEmit": true, /* Disable emitting files from a compilation. */
|
|
53
|
+
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
|
54
|
+
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */
|
|
55
|
+
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
|
56
|
+
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
|
|
57
|
+
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
|
58
|
+
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
|
59
|
+
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
|
|
60
|
+
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
|
|
61
|
+
// "newLine": "crlf", /* Set the newline character for emitting files. */
|
|
62
|
+
// "stripInternal": true, /* Disable emitting declarations that have `@internal` in their JSDoc comments. */
|
|
63
|
+
// "noEmitHelpers": true, /* Disable generating custom helper functions like `__extends` in compiled output. */
|
|
64
|
+
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
|
|
65
|
+
// "preserveConstEnums": true, /* Disable erasing `const enum` declarations in generated code. */
|
|
66
|
+
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
|
|
67
|
+
// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
|
|
68
|
+
|
|
69
|
+
/* Interop Constraints */
|
|
70
|
+
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
|
|
71
|
+
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
|
|
72
|
+
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */
|
|
73
|
+
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
|
74
|
+
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
|
|
75
|
+
|
|
76
|
+
/* Type Checking */
|
|
77
|
+
"strict": false, /* Enable all strict type-checking options. */
|
|
78
|
+
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied `any` type.. */
|
|
79
|
+
// "strictNullChecks": true, /* When type checking, take into account `null` and `undefined`. */
|
|
80
|
+
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
|
81
|
+
// "strictBindCallApply": true, /* Check that the arguments for `bind`, `call`, and `apply` methods match the original function. */
|
|
82
|
+
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
|
83
|
+
// "noImplicitThis": true, /* Enable error reporting when `this` is given the type `any`. */
|
|
84
|
+
// "useUnknownInCatchVariables": true, /* Type catch clause variables as 'unknown' instead of 'any'. */
|
|
85
|
+
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
|
86
|
+
// "noUnusedLocals": true, /* Enable error reporting when a local variables aren't read. */
|
|
87
|
+
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read */
|
|
88
|
+
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
|
89
|
+
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
|
90
|
+
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
|
91
|
+
// "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
|
|
92
|
+
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
|
|
93
|
+
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type */
|
|
94
|
+
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
|
|
95
|
+
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
|
|
96
|
+
|
|
97
|
+
/* Completeness */
|
|
98
|
+
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
|
99
|
+
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
|
100
|
+
}
|
|
101
|
+
}
|