@teambit/insights 0.0.881 → 0.0.883
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/dist/all-insights/duplicate-dependencies.js +3 -35
- package/dist/all-insights/duplicate-dependencies.js.map +1 -1
- package/dist/all-insights/find-circulars.js +0 -30
- package/dist/all-insights/find-circulars.js.map +1 -1
- package/dist/core-insights-getter.js +0 -8
- package/dist/core-insights-getter.js.map +1 -1
- package/dist/exceptions/insight-already-exists.js +0 -6
- package/dist/exceptions/insight-already-exists.js.map +1 -1
- package/dist/exceptions/insight-not-found.js +0 -6
- package/dist/exceptions/insight-not-found.js.map +1 -1
- package/dist/exceptions/no-data-for-insight.js +0 -6
- package/dist/exceptions/no-data-for-insight.js.map +1 -1
- package/dist/index.js +0 -12
- package/dist/index.js.map +1 -1
- package/dist/insight-manager.js +8 -38
- package/dist/insight-manager.js.map +1 -1
- package/dist/insights.aspect.js +0 -5
- package/dist/insights.aspect.js.map +1 -1
- package/dist/insights.cmd.js +0 -17
- package/dist/insights.cmd.js.map +1 -1
- package/dist/insights.compositon.js +0 -6
- package/dist/insights.compositon.js.map +1 -1
- package/dist/insights.main.runtime.js +2 -45
- package/dist/insights.main.runtime.js.map +1 -1
- package/package-tar/teambit-insights-0.0.883.tgz +0 -0
- package/package.json +5 -5
- package/{preview-1666409808293.js → preview-1666582798766.js} +1 -1
- package/package-tar/teambit-insights-0.0.881.tgz +0 -0
|
@@ -1,58 +1,44 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
require("core-js/modules/es.symbol.description.js");
|
|
6
|
-
|
|
7
5
|
require("core-js/modules/es.array.iterator.js");
|
|
8
|
-
|
|
9
6
|
require("core-js/modules/es.array.sort.js");
|
|
10
|
-
|
|
11
7
|
require("core-js/modules/es.promise.js");
|
|
12
|
-
|
|
13
8
|
require("core-js/modules/es.regexp.exec.js");
|
|
14
|
-
|
|
15
9
|
Object.defineProperty(exports, "__esModule", {
|
|
16
10
|
value: true
|
|
17
11
|
});
|
|
18
12
|
exports.default = exports.INSIGHT_NAME = void 0;
|
|
19
|
-
|
|
20
13
|
function _defineProperty2() {
|
|
21
14
|
const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
22
|
-
|
|
23
15
|
_defineProperty2 = function () {
|
|
24
16
|
return data;
|
|
25
17
|
};
|
|
26
|
-
|
|
27
18
|
return data;
|
|
28
19
|
}
|
|
29
|
-
|
|
30
20
|
function _semver() {
|
|
31
21
|
const data = require("semver");
|
|
32
|
-
|
|
33
22
|
_semver = function () {
|
|
34
23
|
return data;
|
|
35
24
|
};
|
|
36
|
-
|
|
37
25
|
return data;
|
|
38
26
|
}
|
|
39
|
-
|
|
40
27
|
function _component() {
|
|
41
28
|
const data = require("@teambit/component");
|
|
42
|
-
|
|
43
29
|
_component = function () {
|
|
44
30
|
return data;
|
|
45
31
|
};
|
|
46
|
-
|
|
47
32
|
return data;
|
|
48
33
|
}
|
|
49
|
-
|
|
50
34
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
35
|
+
|
|
51
36
|
// import { ComponentID } from '../../../component/component-id';
|
|
37
|
+
|
|
52
38
|
// import NoDataForInsight from '../exceptions/no-data-for-insight';
|
|
39
|
+
|
|
53
40
|
const INSIGHT_NAME = 'duplicate dependencies';
|
|
54
41
|
exports.INSIGHT_NAME = INSIGHT_NAME;
|
|
55
|
-
|
|
56
42
|
class DuplicateDependencies {
|
|
57
43
|
constructor(graphBuilder) {
|
|
58
44
|
(0, _defineProperty2().default)(this, "name", INSIGHT_NAME);
|
|
@@ -60,36 +46,29 @@ class DuplicateDependencies {
|
|
|
60
46
|
(0, _defineProperty2().default)(this, "graphBuilder", void 0);
|
|
61
47
|
this.graphBuilder = graphBuilder;
|
|
62
48
|
}
|
|
63
|
-
|
|
64
49
|
async runInsight() {
|
|
65
50
|
const graph = await this.graphBuilder.getGraph();
|
|
66
|
-
|
|
67
51
|
if (!graph) {
|
|
68
52
|
return {
|
|
69
53
|
message: 'No graph found',
|
|
70
54
|
data: undefined
|
|
71
55
|
};
|
|
72
56
|
}
|
|
73
|
-
|
|
74
57
|
const duplicates = graph.findDuplicateDependencies();
|
|
75
58
|
const lenDependencies = [...duplicates.keys()].length;
|
|
76
|
-
|
|
77
59
|
if (lenDependencies === 1) {
|
|
78
60
|
return {
|
|
79
61
|
message: `Found ${lenDependencies} duplicate dependency.`,
|
|
80
62
|
data: duplicates
|
|
81
63
|
};
|
|
82
64
|
}
|
|
83
|
-
|
|
84
65
|
return {
|
|
85
66
|
message: `Found ${lenDependencies} duplicate dependencies.`,
|
|
86
67
|
data: duplicates
|
|
87
68
|
};
|
|
88
69
|
}
|
|
89
|
-
|
|
90
70
|
formatData(data) {
|
|
91
71
|
const formatted = [];
|
|
92
|
-
|
|
93
72
|
for (const [dependency, depData] of data.entries()) {
|
|
94
73
|
const {
|
|
95
74
|
totalOutdatedDependents,
|
|
@@ -102,10 +81,8 @@ class DuplicateDependencies {
|
|
|
102
81
|
dependentsByVersion
|
|
103
82
|
});
|
|
104
83
|
}
|
|
105
|
-
|
|
106
84
|
return formatted;
|
|
107
85
|
}
|
|
108
|
-
|
|
109
86
|
getDependents(priorVersions) {
|
|
110
87
|
let totalOutdatedDependents = 0;
|
|
111
88
|
const dependentsByVersion = [];
|
|
@@ -131,7 +108,6 @@ class DuplicateDependencies {
|
|
|
131
108
|
dependentsByVersion
|
|
132
109
|
};
|
|
133
110
|
}
|
|
134
|
-
|
|
135
111
|
revreseCompareVersions(v1, v2) {
|
|
136
112
|
try {
|
|
137
113
|
return (0, _semver().rcompare)(v1.version, v2.version);
|
|
@@ -140,21 +116,18 @@ class DuplicateDependencies {
|
|
|
140
116
|
return 0;
|
|
141
117
|
}
|
|
142
118
|
}
|
|
143
|
-
|
|
144
119
|
stringifyDependents(dependents) {
|
|
145
120
|
const string = dependents.map(dependent => {
|
|
146
121
|
return `- ${dependent.id} => ${dependent.usedVersion}`;
|
|
147
122
|
}).join('\n');
|
|
148
123
|
return string;
|
|
149
124
|
}
|
|
150
|
-
|
|
151
125
|
stringifyDependentsByVersion(versions) {
|
|
152
126
|
const string = versions.map(version => {
|
|
153
127
|
return `- ${version.compId} has ${version.dependents.length} dependents`;
|
|
154
128
|
}).join('\n');
|
|
155
129
|
return string;
|
|
156
130
|
}
|
|
157
|
-
|
|
158
131
|
renderData(data) {
|
|
159
132
|
const string = data.map(obj => {
|
|
160
133
|
return `\n\nFound ${obj.totalOutdatedDependents} outdated dependents for ${obj.dependencyId}
|
|
@@ -164,7 +137,6 @@ ${this.stringifyDependentsByVersion(obj.dependentsByVersion)}`;
|
|
|
164
137
|
}).join('\n');
|
|
165
138
|
return string;
|
|
166
139
|
}
|
|
167
|
-
|
|
168
140
|
async run() {
|
|
169
141
|
const bareResult = await this.runInsight();
|
|
170
142
|
const formattedData = this.formatData(bareResult.data);
|
|
@@ -178,16 +150,12 @@ ${this.stringifyDependentsByVersion(obj.dependentsByVersion)}`;
|
|
|
178
150
|
message: bareResult.message,
|
|
179
151
|
renderedData
|
|
180
152
|
};
|
|
181
|
-
|
|
182
153
|
if (bareResult.message) {
|
|
183
154
|
result.message = bareResult.message;
|
|
184
155
|
}
|
|
185
|
-
|
|
186
156
|
return result;
|
|
187
157
|
}
|
|
188
|
-
|
|
189
158
|
}
|
|
190
|
-
|
|
191
159
|
exports.default = DuplicateDependencies;
|
|
192
160
|
|
|
193
161
|
//# sourceMappingURL=duplicate-dependencies.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["INSIGHT_NAME","DuplicateDependencies","constructor","graphBuilder","runInsight","graph","getGraph","message","data","undefined","duplicates","findDuplicateDependencies","lenDependencies","keys","length","formatData","formatted","dependency","depData","entries","totalOutdatedDependents","dependentsByVersion","getDependents","priorVersions","push","dependencyId","latestVersion","latestVersionId","toString","forEach","pVersion","dependents","version","ComponentID","fromString","versionId","split","immediateDependents","dependent","id","usedVersion","compId","sort","revreseCompareVersions","v1","v2","rcompare","err","stringifyDependents","string","map","join","stringifyDependentsByVersion","versions","renderData","obj","run","bareResult","formattedData","renderedData","result","metaData","name","description"],"sources":["duplicate-dependencies.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\nimport { GraphBuilder, VersionSubgraph } from '@teambit/graph';\nimport { rcompare } from 'semver';\n// import { ComponentID } from '../../../component/component-id';\nimport { ComponentID } from '@teambit/component';\nimport { Insight, InsightResult, RawResult } from '../insight';\n// import NoDataForInsight from '../exceptions/no-data-for-insight';\n\nexport const INSIGHT_NAME = 'duplicate dependencies';\n\ntype Dependent = {\n id: string;\n usedVersion: string;\n};\n\ntype VersionWithDependents = {\n version: string;\n compId: string;\n dependents: Dependent[];\n};\n\ntype FormattedEntry = {\n dependencyId: string;\n latestVersion: string;\n totalOutdatedDependents: string;\n dependentsByVersion: VersionWithDependents[];\n};\nexport default class DuplicateDependencies implements Insight {\n name = INSIGHT_NAME;\n description = 'Get all duplicate dependencies in component graph';\n graphBuilder: GraphBuilder;\n constructor(graphBuilder: GraphBuilder) {\n this.graphBuilder = graphBuilder;\n }\n private async runInsight(): Promise<RawResult> {\n const graph = await this.graphBuilder.getGraph();\n if (!graph) {\n return {\n message: 'No graph found',\n data: undefined,\n };\n }\n const duplicates = graph.findDuplicateDependencies();\n const lenDependencies = [...duplicates.keys()].length;\n if (lenDependencies === 1) {\n return {\n message: `Found ${lenDependencies} duplicate dependency.`,\n data: duplicates,\n };\n }\n return {\n message: `Found ${lenDependencies} duplicate dependencies.`,\n data: duplicates,\n };\n }\n\n private formatData(data: any): FormattedEntry[] {\n const formatted: FormattedEntry[] = [];\n for (const [dependency, depData] of data.entries()) {\n const { totalOutdatedDependents, dependentsByVersion } = this.getDependents(depData.priorVersions);\n formatted.push({\n dependencyId: dependency,\n latestVersion: depData.latestVersionId,\n totalOutdatedDependents: totalOutdatedDependents.toString(),\n dependentsByVersion,\n });\n }\n return formatted;\n }\n\n private getDependents(priorVersions: VersionSubgraph[]): {\n totalOutdatedDependents: number;\n dependentsByVersion: VersionWithDependents[];\n } {\n let totalOutdatedDependents = 0;\n const dependentsByVersion: VersionWithDependents[] = [];\n priorVersions.forEach((pVersion: VersionSubgraph) => {\n const dependents: Dependent[] = [];\n const version = ComponentID.fromString(pVersion.versionId).version || pVersion.versionId.split('@')[1];\n pVersion.immediateDependents.forEach((dependent: string) => {\n dependents.push({\n id: dependent,\n usedVersion: pVersion.versionId,\n });\n });\n dependentsByVersion.push({\n compId: pVersion.versionId,\n version,\n dependents,\n });\n totalOutdatedDependents += pVersion.immediateDependents.length;\n });\n dependentsByVersion.sort(this.revreseCompareVersions);\n return { totalOutdatedDependents, dependentsByVersion };\n }\n\n revreseCompareVersions(v1: VersionWithDependents, v2: VersionWithDependents) {\n try {\n return rcompare(v1.version, v2.version);\n } catch (err) {\n // in case one of them is a snap\n return 0;\n }\n }\n\n private stringifyDependents(dependents: Dependent[]): string {\n const string = dependents\n .map((dependent) => {\n return `- ${dependent.id} => ${dependent.usedVersion}`;\n })\n .join('\\n');\n return string;\n }\n\n private stringifyDependentsByVersion(versions: VersionWithDependents[]): string {\n const string = versions\n .map((version) => {\n return `- ${version.compId} has ${version.dependents.length} dependents`;\n })\n .join('\\n');\n return string;\n }\n\n private renderData(data: FormattedEntry[]) {\n const string = data\n .map((obj) => {\n return `\\n\\nFound ${obj.totalOutdatedDependents} outdated dependents for ${obj.dependencyId}\nThe latest version is \"${obj.latestVersion}\"\nOutdated dependents:\n${this.stringifyDependentsByVersion(obj.dependentsByVersion)}`;\n })\n .join('\\n');\n return string;\n }\n\n async run(): Promise<InsightResult> {\n const bareResult = await this.runInsight();\n const formattedData = this.formatData(bareResult.data);\n const renderedData = this.renderData(formattedData);\n const result: InsightResult = {\n metaData: {\n name: this.name,\n description: this.description,\n },\n data: formattedData,\n message: bareResult.message,\n renderedData,\n };\n\n if (bareResult.message) {\n result.message = bareResult.message;\n }\n return result;\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["INSIGHT_NAME","DuplicateDependencies","constructor","graphBuilder","runInsight","graph","getGraph","message","data","undefined","duplicates","findDuplicateDependencies","lenDependencies","keys","length","formatData","formatted","dependency","depData","entries","totalOutdatedDependents","dependentsByVersion","getDependents","priorVersions","push","dependencyId","latestVersion","latestVersionId","toString","forEach","pVersion","dependents","version","ComponentID","fromString","versionId","split","immediateDependents","dependent","id","usedVersion","compId","sort","revreseCompareVersions","v1","v2","rcompare","err","stringifyDependents","string","map","join","stringifyDependentsByVersion","versions","renderData","obj","run","bareResult","formattedData","renderedData","result","metaData","name","description"],"sources":["duplicate-dependencies.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\nimport { GraphBuilder, VersionSubgraph } from '@teambit/graph';\nimport { rcompare } from 'semver';\n// import { ComponentID } from '../../../component/component-id';\nimport { ComponentID } from '@teambit/component';\nimport { Insight, InsightResult, RawResult } from '../insight';\n// import NoDataForInsight from '../exceptions/no-data-for-insight';\n\nexport const INSIGHT_NAME = 'duplicate dependencies';\n\ntype Dependent = {\n id: string;\n usedVersion: string;\n};\n\ntype VersionWithDependents = {\n version: string;\n compId: string;\n dependents: Dependent[];\n};\n\ntype FormattedEntry = {\n dependencyId: string;\n latestVersion: string;\n totalOutdatedDependents: string;\n dependentsByVersion: VersionWithDependents[];\n};\nexport default class DuplicateDependencies implements Insight {\n name = INSIGHT_NAME;\n description = 'Get all duplicate dependencies in component graph';\n graphBuilder: GraphBuilder;\n constructor(graphBuilder: GraphBuilder) {\n this.graphBuilder = graphBuilder;\n }\n private async runInsight(): Promise<RawResult> {\n const graph = await this.graphBuilder.getGraph();\n if (!graph) {\n return {\n message: 'No graph found',\n data: undefined,\n };\n }\n const duplicates = graph.findDuplicateDependencies();\n const lenDependencies = [...duplicates.keys()].length;\n if (lenDependencies === 1) {\n return {\n message: `Found ${lenDependencies} duplicate dependency.`,\n data: duplicates,\n };\n }\n return {\n message: `Found ${lenDependencies} duplicate dependencies.`,\n data: duplicates,\n };\n }\n\n private formatData(data: any): FormattedEntry[] {\n const formatted: FormattedEntry[] = [];\n for (const [dependency, depData] of data.entries()) {\n const { totalOutdatedDependents, dependentsByVersion } = this.getDependents(depData.priorVersions);\n formatted.push({\n dependencyId: dependency,\n latestVersion: depData.latestVersionId,\n totalOutdatedDependents: totalOutdatedDependents.toString(),\n dependentsByVersion,\n });\n }\n return formatted;\n }\n\n private getDependents(priorVersions: VersionSubgraph[]): {\n totalOutdatedDependents: number;\n dependentsByVersion: VersionWithDependents[];\n } {\n let totalOutdatedDependents = 0;\n const dependentsByVersion: VersionWithDependents[] = [];\n priorVersions.forEach((pVersion: VersionSubgraph) => {\n const dependents: Dependent[] = [];\n const version = ComponentID.fromString(pVersion.versionId).version || pVersion.versionId.split('@')[1];\n pVersion.immediateDependents.forEach((dependent: string) => {\n dependents.push({\n id: dependent,\n usedVersion: pVersion.versionId,\n });\n });\n dependentsByVersion.push({\n compId: pVersion.versionId,\n version,\n dependents,\n });\n totalOutdatedDependents += pVersion.immediateDependents.length;\n });\n dependentsByVersion.sort(this.revreseCompareVersions);\n return { totalOutdatedDependents, dependentsByVersion };\n }\n\n revreseCompareVersions(v1: VersionWithDependents, v2: VersionWithDependents) {\n try {\n return rcompare(v1.version, v2.version);\n } catch (err) {\n // in case one of them is a snap\n return 0;\n }\n }\n\n private stringifyDependents(dependents: Dependent[]): string {\n const string = dependents\n .map((dependent) => {\n return `- ${dependent.id} => ${dependent.usedVersion}`;\n })\n .join('\\n');\n return string;\n }\n\n private stringifyDependentsByVersion(versions: VersionWithDependents[]): string {\n const string = versions\n .map((version) => {\n return `- ${version.compId} has ${version.dependents.length} dependents`;\n })\n .join('\\n');\n return string;\n }\n\n private renderData(data: FormattedEntry[]) {\n const string = data\n .map((obj) => {\n return `\\n\\nFound ${obj.totalOutdatedDependents} outdated dependents for ${obj.dependencyId}\nThe latest version is \"${obj.latestVersion}\"\nOutdated dependents:\n${this.stringifyDependentsByVersion(obj.dependentsByVersion)}`;\n })\n .join('\\n');\n return string;\n }\n\n async run(): Promise<InsightResult> {\n const bareResult = await this.runInsight();\n const formattedData = this.formatData(bareResult.data);\n const renderedData = this.renderData(formattedData);\n const result: InsightResult = {\n metaData: {\n name: this.name,\n description: this.description,\n },\n data: formattedData,\n message: bareResult.message,\n renderedData,\n };\n\n if (bareResult.message) {\n result.message = bareResult.message;\n }\n return result;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAJA;;AAGA;;AAGA;;AAEO,MAAMA,YAAY,GAAG,wBAAwB;AAAC;AAmBtC,MAAMC,qBAAqB,CAAoB;EAI5DC,WAAW,CAACC,YAA0B,EAAE;IAAA,8CAHjCH,YAAY;IAAA,qDACL,mDAAmD;IAAA;IAG/D,IAAI,CAACG,YAAY,GAAGA,YAAY;EAClC;EACA,MAAcC,UAAU,GAAuB;IAC7C,MAAMC,KAAK,GAAG,MAAM,IAAI,CAACF,YAAY,CAACG,QAAQ,EAAE;IAChD,IAAI,CAACD,KAAK,EAAE;MACV,OAAO;QACLE,OAAO,EAAE,gBAAgB;QACzBC,IAAI,EAAEC;MACR,CAAC;IACH;IACA,MAAMC,UAAU,GAAGL,KAAK,CAACM,yBAAyB,EAAE;IACpD,MAAMC,eAAe,GAAG,CAAC,GAAGF,UAAU,CAACG,IAAI,EAAE,CAAC,CAACC,MAAM;IACrD,IAAIF,eAAe,KAAK,CAAC,EAAE;MACzB,OAAO;QACLL,OAAO,EAAG,SAAQK,eAAgB,wBAAuB;QACzDJ,IAAI,EAAEE;MACR,CAAC;IACH;IACA,OAAO;MACLH,OAAO,EAAG,SAAQK,eAAgB,0BAAyB;MAC3DJ,IAAI,EAAEE;IACR,CAAC;EACH;EAEQK,UAAU,CAACP,IAAS,EAAoB;IAC9C,MAAMQ,SA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0C,UAAU,CAACjD,IAAI,CAAC;IACtD,MAAMmD,YAAY,GAAG,IAAI,CAACL,UAAU,CAACI,aAAa,CAAC;IACnD,MAAME,MAAqB,GAAG;MAC5BC,QAAQ,EAAE;QACRC,IAAI,EAAE,IAAI,CAACA,IAAI;QACfC,WAAW,EAAE,IAAI,CAACA;MACpB,CAAC;MACDvD,IAAI,EAAEkD,aAAa;MACnBnD,OAAO,EAAEkD,UAAU,CAAClD,OAAO;MAC3BoD;IACF,CAAC;IAED,IAAIF,UAAU,CAAClD,OAAO,EAAE;MACtBqD,MAAM,CAACrD,OAAO,GAAGkD,UAAU,CAAClD,OAAO;IACrC;IACA,OAAOqD,MAAM;EACf;AACF;AAAC"}
|
|
@@ -1,53 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
require("core-js/modules/es.symbol.description.js");
|
|
6
|
-
|
|
7
5
|
require("core-js/modules/es.array.flat.js");
|
|
8
|
-
|
|
9
6
|
require("core-js/modules/es.array.unscopables.flat.js");
|
|
10
|
-
|
|
11
7
|
require("core-js/modules/es.promise.js");
|
|
12
|
-
|
|
13
8
|
Object.defineProperty(exports, "__esModule", {
|
|
14
9
|
value: true
|
|
15
10
|
});
|
|
16
11
|
exports.default = exports.INSIGHT_CIRCULAR_DEPS_NAME = void 0;
|
|
17
|
-
|
|
18
12
|
function _defineProperty2() {
|
|
19
13
|
const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
20
|
-
|
|
21
14
|
_defineProperty2 = function () {
|
|
22
15
|
return data;
|
|
23
16
|
};
|
|
24
|
-
|
|
25
17
|
return data;
|
|
26
18
|
}
|
|
27
|
-
|
|
28
19
|
function _componentIssues() {
|
|
29
20
|
const data = require("@teambit/component-issues");
|
|
30
|
-
|
|
31
21
|
_componentIssues = function () {
|
|
32
22
|
return data;
|
|
33
23
|
};
|
|
34
|
-
|
|
35
24
|
return data;
|
|
36
25
|
}
|
|
37
|
-
|
|
38
26
|
function _lodash() {
|
|
39
27
|
const data = require("lodash");
|
|
40
|
-
|
|
41
28
|
_lodash = function () {
|
|
42
29
|
return data;
|
|
43
30
|
};
|
|
44
|
-
|
|
45
31
|
return data;
|
|
46
32
|
}
|
|
47
|
-
|
|
48
33
|
const INSIGHT_CIRCULAR_DEPS_NAME = 'circular';
|
|
49
34
|
exports.INSIGHT_CIRCULAR_DEPS_NAME = INSIGHT_CIRCULAR_DEPS_NAME;
|
|
50
|
-
|
|
51
35
|
class FindCycles {
|
|
52
36
|
constructor(graphBuilder) {
|
|
53
37
|
(0, _defineProperty2().default)(this, "name", INSIGHT_CIRCULAR_DEPS_NAME);
|
|
@@ -55,37 +39,30 @@ class FindCycles {
|
|
|
55
39
|
(0, _defineProperty2().default)(this, "graphBuilder", void 0);
|
|
56
40
|
this.graphBuilder = graphBuilder;
|
|
57
41
|
}
|
|
58
|
-
|
|
59
42
|
async runInsight() {
|
|
60
43
|
const graph = await this.graphBuilder.getGraph();
|
|
61
|
-
|
|
62
44
|
if (!graph) {
|
|
63
45
|
return {
|
|
64
46
|
message: '',
|
|
65
47
|
data: undefined
|
|
66
48
|
};
|
|
67
49
|
}
|
|
68
|
-
|
|
69
50
|
const cycles = graph.findCycles();
|
|
70
|
-
|
|
71
51
|
if (cycles.length === 1) {
|
|
72
52
|
return {
|
|
73
53
|
message: `Found ${cycles.length} cycle.`,
|
|
74
54
|
data: cycles
|
|
75
55
|
};
|
|
76
56
|
}
|
|
77
|
-
|
|
78
57
|
return {
|
|
79
58
|
message: `Found ${cycles.length} cycles.`,
|
|
80
59
|
data: cycles
|
|
81
60
|
};
|
|
82
61
|
}
|
|
83
|
-
|
|
84
62
|
renderData(data) {
|
|
85
63
|
if (data.data.length === 0) {
|
|
86
64
|
return 'No cyclic dependencies';
|
|
87
65
|
}
|
|
88
|
-
|
|
89
66
|
const string = data.data.map(cycle => {
|
|
90
67
|
return `\nCyclic dependency
|
|
91
68
|
-----------------
|
|
@@ -93,7 +70,6 @@ class FindCycles {
|
|
|
93
70
|
}).join('\n');
|
|
94
71
|
return string;
|
|
95
72
|
}
|
|
96
|
-
|
|
97
73
|
async run() {
|
|
98
74
|
const bareResult = await this.runInsight();
|
|
99
75
|
const renderedData = this.renderData(bareResult);
|
|
@@ -106,17 +82,13 @@ class FindCycles {
|
|
|
106
82
|
message: bareResult.message,
|
|
107
83
|
renderedData
|
|
108
84
|
};
|
|
109
|
-
|
|
110
85
|
if (bareResult.message) {
|
|
111
86
|
result.message = bareResult.message;
|
|
112
87
|
}
|
|
113
|
-
|
|
114
88
|
return result;
|
|
115
89
|
}
|
|
116
|
-
|
|
117
90
|
async addAsComponentIssue(components) {
|
|
118
91
|
const result = await this.runInsight();
|
|
119
|
-
|
|
120
92
|
if (!result.data.length) {
|
|
121
93
|
return; // no circulars
|
|
122
94
|
}
|
|
@@ -127,9 +99,7 @@ class FindCycles {
|
|
|
127
99
|
component.state.issues.getOrCreate(_componentIssues().IssuesClasses.CircularDependencies).data = true;
|
|
128
100
|
});
|
|
129
101
|
}
|
|
130
|
-
|
|
131
102
|
}
|
|
132
|
-
|
|
133
103
|
exports.default = FindCycles;
|
|
134
104
|
|
|
135
105
|
//# sourceMappingURL=find-circulars.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["INSIGHT_CIRCULAR_DEPS_NAME","FindCycles","constructor","graphBuilder","runInsight","graph","getGraph","message","data","undefined","cycles","findCycles","length","renderData","string","map","cycle","join","run","bareResult","renderedData","result","metaData","name","description","addAsComponentIssue","components","allIds","uniq","flat","componentsWithCircular","filter","component","includes","id","toString","forEach","state","issues","getOrCreate","IssuesClasses","CircularDependencies"],"sources":["find-circulars.ts"],"sourcesContent":["import { Component } from '@teambit/component';\nimport { IssuesClasses } from '@teambit/component-issues';\nimport { GraphBuilder } from '@teambit/graph';\nimport { uniq } from 'lodash';\nimport { Insight, InsightResult, RawResult } from '../insight';\n\nexport const INSIGHT_CIRCULAR_DEPS_NAME = 'circular';\n\nexport default class FindCycles implements Insight {\n name = INSIGHT_CIRCULAR_DEPS_NAME;\n description = 'Get all circular dependencies in component graph';\n graphBuilder: GraphBuilder;\n constructor(graphBuilder: GraphBuilder) {\n this.graphBuilder = graphBuilder;\n }\n private async runInsight(): Promise<RawResult> {\n const graph = await this.graphBuilder.getGraph();\n if (!graph) {\n return {\n message: '',\n data: undefined,\n };\n }\n const cycles = graph.findCycles();\n if (cycles.length === 1) {\n return {\n message: `Found ${cycles.length} cycle.`,\n data: cycles,\n };\n }\n return {\n message: `Found ${cycles.length} cycles.`,\n data: cycles,\n };\n }\n\n private renderData(data: RawResult) {\n if (data.data.length === 0) {\n return 'No cyclic dependencies';\n }\n const string = data.data\n .map((cycle) => {\n return `\\nCyclic dependency\n-----------------\n- ${cycle.join('\\n- ')}`;\n })\n .join('\\n');\n return string;\n }\n\n async run(): Promise<InsightResult> {\n const bareResult = await this.runInsight();\n const renderedData = this.renderData(bareResult);\n const result: InsightResult = {\n metaData: {\n name: this.name,\n description: this.description,\n },\n data: bareResult.data,\n message: bareResult.message,\n renderedData,\n };\n\n if (bareResult.message) {\n result.message = bareResult.message;\n }\n return result;\n }\n\n async addAsComponentIssue(components: Component[]) {\n const result = await this.runInsight();\n if (!result.data.length) {\n return; // no circulars\n }\n const allIds = uniq(result.data.flat());\n const componentsWithCircular = components.filter((component) => allIds.includes(component.id.toString()));\n componentsWithCircular.forEach((component) => {\n component.state.issues.getOrCreate(IssuesClasses.CircularDependencies).data = true;\n });\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["INSIGHT_CIRCULAR_DEPS_NAME","FindCycles","constructor","graphBuilder","runInsight","graph","getGraph","message","data","undefined","cycles","findCycles","length","renderData","string","map","cycle","join","run","bareResult","renderedData","result","metaData","name","description","addAsComponentIssue","components","allIds","uniq","flat","componentsWithCircular","filter","component","includes","id","toString","forEach","state","issues","getOrCreate","IssuesClasses","CircularDependencies"],"sources":["find-circulars.ts"],"sourcesContent":["import { Component } from '@teambit/component';\nimport { IssuesClasses } from '@teambit/component-issues';\nimport { GraphBuilder } from '@teambit/graph';\nimport { uniq } from 'lodash';\nimport { Insight, InsightResult, RawResult } from '../insight';\n\nexport const INSIGHT_CIRCULAR_DEPS_NAME = 'circular';\n\nexport default class FindCycles implements Insight {\n name = INSIGHT_CIRCULAR_DEPS_NAME;\n description = 'Get all circular dependencies in component graph';\n graphBuilder: GraphBuilder;\n constructor(graphBuilder: GraphBuilder) {\n this.graphBuilder = graphBuilder;\n }\n private async runInsight(): Promise<RawResult> {\n const graph = await this.graphBuilder.getGraph();\n if (!graph) {\n return {\n message: '',\n data: undefined,\n };\n }\n const cycles = graph.findCycles();\n if (cycles.length === 1) {\n return {\n message: `Found ${cycles.length} cycle.`,\n data: cycles,\n };\n }\n return {\n message: `Found ${cycles.length} cycles.`,\n data: cycles,\n };\n }\n\n private renderData(data: RawResult) {\n if (data.data.length === 0) {\n return 'No cyclic dependencies';\n }\n const string = data.data\n .map((cycle) => {\n return `\\nCyclic dependency\n-----------------\n- ${cycle.join('\\n- ')}`;\n })\n .join('\\n');\n return string;\n }\n\n async run(): Promise<InsightResult> {\n const bareResult = await this.runInsight();\n const renderedData = this.renderData(bareResult);\n const result: InsightResult = {\n metaData: {\n name: this.name,\n description: this.description,\n },\n data: bareResult.data,\n message: bareResult.message,\n renderedData,\n };\n\n if (bareResult.message) {\n result.message = bareResult.message;\n }\n return result;\n }\n\n async addAsComponentIssue(components: Component[]) {\n const result = await this.runInsight();\n if (!result.data.length) {\n return; // no circulars\n }\n const allIds = uniq(result.data.flat());\n const componentsWithCircular = components.filter((component) => allIds.includes(component.id.toString()));\n componentsWithCircular.forEach((component) => {\n component.state.issues.getOrCreate(IssuesClasses.CircularDependencies).data = true;\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA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AQ,EAAE;QACRC,IAAI,EAAE,IAAI,CAACA,IAAI;QACfC,WAAW,EAAE,IAAI,CAACA;MACpB,CAAC;MACDhB,IAAI,EAAEW,UAAU,CAACX,IAAI;MACrBD,OAAO,EAAEY,UAAU,CAACZ,OAAO;MAC3Ba;IACF,CAAC;IAED,IAAID,UAAU,CAACZ,OAAO,EAAE;MACtBc,MAAM,CAACd,OAAO,GAAGY,UAAU,CAACZ,OAAO;IACrC;IACA,OAAOc,MAAM;EACf;EAEA,MAAMI,mBAAmB,CAACC,UAAuB,EAAE;IACjD,MAAML,MAAM,GAAG,MAAM,IAAI,CAACjB,UAAU,EAAE;IACtC,IAAI,CAACiB,MAAM,CAACb,IAAI,CAACI,MAAM,EAAE;MACvB,OAAO,CAAC;IACV;;IACA,MAAMe,MAAM,GAAG,IAAAC,cAAI,EAACP,MAAM,CAACb,IAAI,CAACqB,IAAI,EAAE,CAAC;IACvC,MAAMC,sBAAsB,GAAGJ,UAAU,CAACK,MAAM,CAAEC,SAAS,IAAKL,MAAM,CAACM,QAAQ,CAACD,SAAS,CAACE,EAAE,CAACC,QAAQ,EAAE,CAAC,CAAC;IACzGL,sBAAsB,CAACM,OAAO,CAAEJ,SAAS,IAAK;MAC5CA,SAAS,CAACK,KAAK,CAACC,MAAM,CAACC,WAAW,CAACC,gCAAa,CAACC,oBAAoB,CAAC,CAACjC,IAAI,GAAG,IAAI;IACpF,CAAC,CAAC;EACJ;AACF;AAAC"}
|
|
@@ -1,32 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = getCoreInsights;
|
|
9
|
-
|
|
10
8
|
function _duplicateDependencies() {
|
|
11
9
|
const data = _interopRequireDefault(require("./all-insights/duplicate-dependencies"));
|
|
12
|
-
|
|
13
10
|
_duplicateDependencies = function () {
|
|
14
11
|
return data;
|
|
15
12
|
};
|
|
16
|
-
|
|
17
13
|
return data;
|
|
18
14
|
}
|
|
19
|
-
|
|
20
15
|
function _findCirculars() {
|
|
21
16
|
const data = _interopRequireDefault(require("./all-insights/find-circulars"));
|
|
22
|
-
|
|
23
17
|
_findCirculars = function () {
|
|
24
18
|
return data;
|
|
25
19
|
};
|
|
26
|
-
|
|
27
20
|
return data;
|
|
28
21
|
}
|
|
29
|
-
|
|
30
22
|
function getCoreInsights(graphBuilder) {
|
|
31
23
|
const coreInsights = [new (_findCirculars().default)(graphBuilder), new (_duplicateDependencies().default)(graphBuilder)];
|
|
32
24
|
return coreInsights;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getCoreInsights","graphBuilder","coreInsights","FindCycles","DuplicateDependencies"],"sources":["core-insights-getter.ts"],"sourcesContent":["import { GraphBuilder } from '@teambit/graph';\n\nimport DuplicateDependencies from './all-insights/duplicate-dependencies';\nimport FindCycles from './all-insights/find-circulars';\n\nexport default function getCoreInsights(graphBuilder: GraphBuilder) {\n const coreInsights = [new FindCycles(graphBuilder), new DuplicateDependencies(graphBuilder)];\n return coreInsights;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["getCoreInsights","graphBuilder","coreInsights","FindCycles","DuplicateDependencies"],"sources":["core-insights-getter.ts"],"sourcesContent":["import { GraphBuilder } from '@teambit/graph';\n\nimport DuplicateDependencies from './all-insights/duplicate-dependencies';\nimport FindCycles from './all-insights/find-circulars';\n\nexport default function getCoreInsights(graphBuilder: GraphBuilder) {\n const coreInsights = [new FindCycles(graphBuilder), new DuplicateDependencies(graphBuilder)];\n return coreInsights;\n}\n"],"mappings":";;;;;;;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEe,SAASA,eAAe,CAACC,YAA0B,EAAE;EAClE,MAAMC,YAAY,GAAG,CAAC,KAAIC,wBAAU,EAACF,YAAY,CAAC,EAAE,KAAIG,gCAAqB,EAACH,YAAY,CAAC,CAAC;EAC5F,OAAOC,YAAY;AACrB"}
|
|
@@ -4,25 +4,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
function _bitError() {
|
|
9
8
|
const data = require("@teambit/bit-error");
|
|
10
|
-
|
|
11
9
|
_bitError = function () {
|
|
12
10
|
return data;
|
|
13
11
|
};
|
|
14
|
-
|
|
15
12
|
return data;
|
|
16
13
|
}
|
|
17
|
-
|
|
18
14
|
class InsightAlreadyExists extends _bitError().BitError {
|
|
19
15
|
constructor(insightName) {
|
|
20
16
|
super(`Insight ${insightName} already exists`);
|
|
21
17
|
this.insightName = insightName;
|
|
22
18
|
}
|
|
23
|
-
|
|
24
19
|
}
|
|
25
|
-
|
|
26
20
|
exports.default = InsightAlreadyExists;
|
|
27
21
|
|
|
28
22
|
//# sourceMappingURL=insight-already-exists.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["InsightAlreadyExists","BitError","constructor","insightName"],"sources":["insight-already-exists.ts"],"sourcesContent":["import { BitError } from '@teambit/bit-error';\n\nexport default class InsightAlreadyExists extends BitError {\n constructor(readonly insightName: string) {\n super(`Insight ${insightName} already exists`);\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["InsightAlreadyExists","BitError","constructor","insightName"],"sources":["insight-already-exists.ts"],"sourcesContent":["import { BitError } from '@teambit/bit-error';\n\nexport default class InsightAlreadyExists extends BitError {\n constructor(readonly insightName: string) {\n super(`Insight ${insightName} already exists`);\n }\n}\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEe,MAAMA,oBAAoB,SAASC,oBAAQ,CAAC;EACzDC,WAAW,CAAUC,WAAmB,EAAE;IACxC,KAAK,CAAE,WAAUA,WAAY,iBAAgB,CAAC;IAAC,KAD5BA,WAAmB,GAAnBA,WAAmB;EAExC;AACF;AAAC"}
|
|
@@ -4,25 +4,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
function _bitError() {
|
|
9
8
|
const data = require("@teambit/bit-error");
|
|
10
|
-
|
|
11
9
|
_bitError = function () {
|
|
12
10
|
return data;
|
|
13
11
|
};
|
|
14
|
-
|
|
15
12
|
return data;
|
|
16
13
|
}
|
|
17
|
-
|
|
18
14
|
class InsightNotFound extends _bitError().BitError {
|
|
19
15
|
constructor(insightName) {
|
|
20
16
|
super(`Insight ${insightName} not found`);
|
|
21
17
|
this.insightName = insightName;
|
|
22
18
|
}
|
|
23
|
-
|
|
24
19
|
}
|
|
25
|
-
|
|
26
20
|
exports.default = InsightNotFound;
|
|
27
21
|
|
|
28
22
|
//# sourceMappingURL=insight-not-found.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["InsightNotFound","BitError","constructor","insightName"],"sources":["insight-not-found.ts"],"sourcesContent":["import { BitError } from '@teambit/bit-error';\n\nexport default class InsightNotFound extends BitError {\n constructor(readonly insightName: string) {\n super(`Insight ${insightName} not found`);\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["InsightNotFound","BitError","constructor","insightName"],"sources":["insight-not-found.ts"],"sourcesContent":["import { BitError } from '@teambit/bit-error';\n\nexport default class InsightNotFound extends BitError {\n constructor(readonly insightName: string) {\n super(`Insight ${insightName} not found`);\n }\n}\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEe,MAAMA,eAAe,SAASC,oBAAQ,CAAC;EACpDC,WAAW,CAAUC,WAAmB,EAAE;IACxC,KAAK,CAAE,WAAUA,WAAY,YAAW,CAAC;IAAC,KADvBA,WAAmB,GAAnBA,WAAmB;EAExC;AACF;AAAC"}
|
|
@@ -4,25 +4,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
function _bitError() {
|
|
9
8
|
const data = require("@teambit/bit-error");
|
|
10
|
-
|
|
11
9
|
_bitError = function () {
|
|
12
10
|
return data;
|
|
13
11
|
};
|
|
14
|
-
|
|
15
12
|
return data;
|
|
16
13
|
}
|
|
17
|
-
|
|
18
14
|
class NoDataForInsight extends _bitError().BitError {
|
|
19
15
|
constructor(insightName) {
|
|
20
16
|
super(`No data for ${insightName}`);
|
|
21
17
|
this.insightName = insightName;
|
|
22
18
|
}
|
|
23
|
-
|
|
24
19
|
}
|
|
25
|
-
|
|
26
20
|
exports.default = NoDataForInsight;
|
|
27
21
|
|
|
28
22
|
//# sourceMappingURL=no-data-for-insight.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NoDataForInsight","BitError","constructor","insightName"],"sources":["no-data-for-insight.ts"],"sourcesContent":["import { BitError } from '@teambit/bit-error';\n\nexport default class NoDataForInsight extends BitError {\n constructor(readonly insightName: string) {\n super(`No data for ${insightName}`);\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["NoDataForInsight","BitError","constructor","insightName"],"sources":["no-data-for-insight.ts"],"sourcesContent":["import { BitError } from '@teambit/bit-error';\n\nexport default class NoDataForInsight extends BitError {\n constructor(readonly insightName: string) {\n super(`No data for ${insightName}`);\n }\n}\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEe,MAAMA,gBAAgB,SAASC,oBAAQ,CAAC;EACrDC,WAAW,CAAUC,WAAmB,EAAE;IACxC,KAAK,CAAE,eAAcA,WAAY,EAAC,CAAC;IAAC,KADjBA,WAAmB,GAAnBA,WAAmB;EAExC;AACF;AAAC"}
|
package/dist/index.js
CHANGED
|
@@ -27,44 +27,32 @@ Object.defineProperty(exports, "InsightsAspect", {
|
|
|
27
27
|
return _insights().InsightsAspect;
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
|
-
|
|
31
30
|
function _insightManager() {
|
|
32
31
|
const data = require("./insight-manager");
|
|
33
|
-
|
|
34
32
|
_insightManager = function () {
|
|
35
33
|
return data;
|
|
36
34
|
};
|
|
37
|
-
|
|
38
35
|
return data;
|
|
39
36
|
}
|
|
40
|
-
|
|
41
37
|
function _insight() {
|
|
42
38
|
const data = require("./insight");
|
|
43
|
-
|
|
44
39
|
_insight = function () {
|
|
45
40
|
return data;
|
|
46
41
|
};
|
|
47
|
-
|
|
48
42
|
return data;
|
|
49
43
|
}
|
|
50
|
-
|
|
51
44
|
function _insights() {
|
|
52
45
|
const data = require("./insights.aspect");
|
|
53
|
-
|
|
54
46
|
_insights = function () {
|
|
55
47
|
return data;
|
|
56
48
|
};
|
|
57
|
-
|
|
58
49
|
return data;
|
|
59
50
|
}
|
|
60
|
-
|
|
61
51
|
function _findCirculars() {
|
|
62
52
|
const data = require("./all-insights/find-circulars");
|
|
63
|
-
|
|
64
53
|
_findCirculars = function () {
|
|
65
54
|
return data;
|
|
66
55
|
};
|
|
67
|
-
|
|
68
56
|
return data;
|
|
69
57
|
}
|
|
70
58
|
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { InsightManager } from './insight-manager';\nexport { Insight } from './insight';\nexport type { InsightsMain } from './insights.main.runtime';\nexport { InsightsAspect } from './insights.aspect';\nexport { INSIGHT_CIRCULAR_DEPS_NAME } from './all-insights/find-circulars';\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { InsightManager } from './insight-manager';\nexport { Insight } from './insight';\nexport type { InsightsMain } from './insights.main.runtime';\nexport { InsightsAspect } from './insights.aspect';\nexport { INSIGHT_CIRCULAR_DEPS_NAME } from './all-insights/find-circulars';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA"}
|
package/dist/insight-manager.js
CHANGED
|
@@ -1,58 +1,43 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
require("core-js/modules/es.array.iterator.js");
|
|
6
|
-
|
|
7
5
|
require("core-js/modules/es.promise.js");
|
|
8
|
-
|
|
9
6
|
Object.defineProperty(exports, "__esModule", {
|
|
10
7
|
value: true
|
|
11
8
|
});
|
|
12
9
|
exports.InsightManager = void 0;
|
|
13
|
-
|
|
14
10
|
function _defineProperty2() {
|
|
15
11
|
const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
16
|
-
|
|
17
12
|
_defineProperty2 = function () {
|
|
18
13
|
return data;
|
|
19
14
|
};
|
|
20
|
-
|
|
21
15
|
return data;
|
|
22
16
|
}
|
|
23
|
-
|
|
24
17
|
function _pMapSeries() {
|
|
25
18
|
const data = _interopRequireDefault(require("p-map-series"));
|
|
26
|
-
|
|
27
19
|
_pMapSeries = function () {
|
|
28
20
|
return data;
|
|
29
21
|
};
|
|
30
|
-
|
|
31
22
|
return data;
|
|
32
23
|
}
|
|
33
|
-
|
|
34
24
|
function _insightAlreadyExists() {
|
|
35
25
|
const data = _interopRequireDefault(require("./exceptions/insight-already-exists"));
|
|
36
|
-
|
|
37
26
|
_insightAlreadyExists = function () {
|
|
38
27
|
return data;
|
|
39
28
|
};
|
|
40
|
-
|
|
41
29
|
return data;
|
|
42
30
|
}
|
|
43
|
-
|
|
44
31
|
function _insightNotFound() {
|
|
45
32
|
const data = _interopRequireDefault(require("./exceptions/insight-not-found"));
|
|
46
|
-
|
|
47
33
|
_insightNotFound = function () {
|
|
48
34
|
return data;
|
|
49
35
|
};
|
|
50
|
-
|
|
51
36
|
return data;
|
|
52
37
|
}
|
|
53
|
-
|
|
54
38
|
class InsightManager {
|
|
55
39
|
/** insights is an insight registry */
|
|
40
|
+
|
|
56
41
|
constructor(
|
|
57
42
|
/**
|
|
58
43
|
* array of registered insights
|
|
@@ -63,87 +48,72 @@ class InsightManager {
|
|
|
63
48
|
this.register(insight);
|
|
64
49
|
});
|
|
65
50
|
}
|
|
51
|
+
|
|
66
52
|
/**
|
|
67
53
|
* registers a new insight and returns the updated insight registry map
|
|
68
54
|
*/
|
|
69
|
-
|
|
70
|
-
|
|
71
55
|
register(insight) {
|
|
72
56
|
const name = insight.name;
|
|
73
|
-
|
|
74
57
|
if (this.insights.has(name)) {
|
|
75
58
|
throw new (_insightAlreadyExists().default)(name);
|
|
76
59
|
}
|
|
77
|
-
|
|
78
60
|
this.insights.set(name, insight);
|
|
79
61
|
}
|
|
80
62
|
/**
|
|
81
63
|
* list of all registered insights
|
|
82
64
|
*/
|
|
83
|
-
|
|
84
|
-
|
|
85
65
|
listInsights() {
|
|
86
66
|
return [...this.insights.keys()];
|
|
87
67
|
}
|
|
68
|
+
|
|
88
69
|
/**
|
|
89
70
|
* gets a specific insight by its name or undefined if doesn't exist
|
|
90
71
|
*/
|
|
91
|
-
|
|
92
|
-
|
|
93
72
|
getByName(insightName) {
|
|
94
73
|
return this.insights.get(insightName);
|
|
95
74
|
}
|
|
75
|
+
|
|
96
76
|
/**
|
|
97
77
|
* deletes a specific insight by its name if exists
|
|
98
78
|
*/
|
|
99
|
-
|
|
100
|
-
|
|
101
79
|
delete(insightName) {
|
|
102
80
|
if (!this.insights.has(insightName)) {
|
|
103
81
|
throw new (_insightNotFound().default)(insightName);
|
|
104
82
|
}
|
|
105
|
-
|
|
106
83
|
this.insights.delete(insightName);
|
|
107
84
|
}
|
|
85
|
+
|
|
108
86
|
/**
|
|
109
87
|
* execute an array of insights
|
|
110
88
|
*
|
|
111
89
|
*/
|
|
112
|
-
|
|
113
|
-
|
|
114
90
|
async run(insightNames, opts) {
|
|
115
|
-
const res = [];
|
|
91
|
+
const res = [];
|
|
92
|
+
// the reason for not using Promise.all here is that the current both insights building the graph.
|
|
116
93
|
// if it happens at the same time, some props are not populated in one of the instances. it obviously
|
|
117
94
|
// should be fixed in the GraphBuilder class. see "todo" there.
|
|
118
|
-
|
|
119
95
|
await (0, _pMapSeries().default)(insightNames, async insightName => {
|
|
120
96
|
const insight = this.getByName(insightName);
|
|
121
|
-
|
|
122
97
|
if (insight) {
|
|
123
98
|
const insightRes = await insight.run();
|
|
124
|
-
|
|
125
99
|
if (!opts.renderData) {
|
|
126
100
|
delete insightRes.renderedData;
|
|
127
101
|
}
|
|
128
|
-
|
|
129
102
|
res.push(insightRes);
|
|
130
103
|
}
|
|
131
104
|
});
|
|
132
105
|
return res;
|
|
133
106
|
}
|
|
107
|
+
|
|
134
108
|
/**
|
|
135
109
|
* execute all insights in the registry
|
|
136
110
|
*
|
|
137
111
|
*/
|
|
138
|
-
|
|
139
|
-
|
|
140
112
|
async runAll(opts) {
|
|
141
113
|
const allInsightNames = this.listInsights();
|
|
142
114
|
return this.run(allInsightNames, opts);
|
|
143
115
|
}
|
|
144
|
-
|
|
145
116
|
}
|
|
146
|
-
|
|
147
117
|
exports.InsightManager = InsightManager;
|
|
148
118
|
|
|
149
119
|
//# sourceMappingURL=insight-manager.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["InsightManager","constructor","insights","Map","forEach","insight","register","name","has","InsightAlreadyExists","set","listInsights","keys","getByName","insightName","get","delete","InsightNotFound","run","insightNames","opts","res","pMapSeries","insightRes","renderData","renderedData","push","runAll","allInsightNames"],"sources":["insight-manager.ts"],"sourcesContent":["import pMapSeries from 'p-map-series';\nimport InsightAlreadyExists from './exceptions/insight-already-exists';\nimport InsightNotFound from './exceptions/insight-not-found';\nimport { Insight, InsightResult } from './insight';\n\nexport type RunInsightOptions = {\n renderData: boolean;\n};\nexport class InsightManager {\n /** insights is an insight registry */\n readonly insights: Map<string, Insight> = new Map();\n constructor(\n /**\n * array of registered insights\n */\n insights: Insight[]\n ) {\n insights.forEach((insight) => {\n this.register(insight);\n });\n }\n\n /**\n * registers a new insight and returns the updated insight registry map\n */\n register(insight: Insight) {\n const name = insight.name;\n if (this.insights.has(name)) {\n throw new InsightAlreadyExists(name);\n }\n this.insights.set(name, insight);\n }\n /**\n * list of all registered insights\n */\n listInsights(): string[] {\n return [...this.insights.keys()];\n }\n\n /**\n * gets a specific insight by its name or undefined if doesn't exist\n */\n getByName(insightName: string): Insight | undefined {\n return this.insights.get(insightName);\n }\n\n /**\n * deletes a specific insight by its name if exists\n */\n delete(insightName: string) {\n if (!this.insights.has(insightName)) {\n throw new InsightNotFound(insightName);\n }\n this.insights.delete(insightName);\n }\n\n /**\n * execute an array of insights\n *\n */\n async run(insightNames: string[], opts: RunInsightOptions): Promise<InsightResult[]> {\n const res: InsightResult[] = [];\n // the reason for not using Promise.all here is that the current both insights building the graph.\n // if it happens at the same time, some props are not populated in one of the instances. it obviously\n // should be fixed in the GraphBuilder class. see \"todo\" there.\n await pMapSeries(insightNames, async (insightName) => {\n const insight = this.getByName(insightName);\n if (insight) {\n const insightRes: InsightResult = await insight.run();\n if (!opts.renderData) {\n delete insightRes.renderedData;\n }\n res.push(insightRes);\n }\n });\n return res;\n }\n\n /**\n * execute all insights in the registry\n *\n */\n async runAll(opts: RunInsightOptions): Promise<InsightResult[]> {\n const allInsightNames = this.listInsights();\n return this.run(allInsightNames, opts);\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["InsightManager","constructor","insights","Map","forEach","insight","register","name","has","InsightAlreadyExists","set","listInsights","keys","getByName","insightName","get","delete","InsightNotFound","run","insightNames","opts","res","pMapSeries","insightRes","renderData","renderedData","push","runAll","allInsightNames"],"sources":["insight-manager.ts"],"sourcesContent":["import pMapSeries from 'p-map-series';\nimport InsightAlreadyExists from './exceptions/insight-already-exists';\nimport InsightNotFound from './exceptions/insight-not-found';\nimport { Insight, InsightResult } from './insight';\n\nexport type RunInsightOptions = {\n renderData: boolean;\n};\nexport class InsightManager {\n /** insights is an insight registry */\n readonly insights: Map<string, Insight> = new Map();\n constructor(\n /**\n * array of registered insights\n */\n insights: Insight[]\n ) {\n insights.forEach((insight) => {\n this.register(insight);\n });\n }\n\n /**\n * registers a new insight and returns the updated insight registry map\n */\n register(insight: Insight) {\n const name = insight.name;\n if (this.insights.has(name)) {\n throw new InsightAlreadyExists(name);\n }\n this.insights.set(name, insight);\n }\n /**\n * list of all registered insights\n */\n listInsights(): string[] {\n return [...this.insights.keys()];\n }\n\n /**\n * gets a specific insight by its name or undefined if doesn't exist\n */\n getByName(insightName: string): Insight | undefined {\n return this.insights.get(insightName);\n }\n\n /**\n * deletes a specific insight by its name if exists\n */\n delete(insightName: string) {\n if (!this.insights.has(insightName)) {\n throw new InsightNotFound(insightName);\n }\n this.insights.delete(insightName);\n }\n\n /**\n * execute an array of insights\n *\n */\n async run(insightNames: string[], opts: RunInsightOptions): Promise<InsightResult[]> {\n const res: InsightResult[] = [];\n // the reason for not using Promise.all here is that the current both insights building the graph.\n // if it happens at the same time, some props are not populated in one of the instances. it obviously\n // should be fixed in the GraphBuilder class. see \"todo\" there.\n await pMapSeries(insightNames, async (insightName) => {\n const insight = this.getByName(insightName);\n if (insight) {\n const insightRes: InsightResult = await insight.run();\n if (!opts.renderData) {\n delete insightRes.renderedData;\n }\n res.push(insightRes);\n }\n });\n return res;\n }\n\n /**\n * execute all insights in the registry\n *\n */\n async runAll(opts: RunInsightOptions): Promise<InsightResult[]> {\n const allInsightNames = this.listInsights();\n return this.run(allInsightNames, opts);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAMO,MAAMA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O,EAAE;QACX,MAAMkB,UAAyB,GAAG,MAAMlB,OAAO,CAACa,GAAG,EAAE;QACrD,IAAI,CAACE,IAAI,CAACI,UAAU,EAAE;UACpB,OAAOD,UAAU,CAACE,YAAY;QAChC;QACAJ,GAAG,CAACK,IAAI,CAACH,UAAU,CAAC;MACtB;IACF,CAAC,CAAC;IACF,OAAOF,GAAG;EACZ;;EAEA;AACF;AACA;AACA;EACE,MAAMM,MAAM,CAACP,IAAuB,EAA4B;IAC9D,MAAMQ,eAAe,GAAG,IAAI,CAACjB,YAAY,EAAE;IAC3C,OAAO,IAAI,CAACO,GAAG,CAACU,eAAe,EAAER,IAAI,CAAC;EACxC;AACF;AAAC"}
|
package/dist/insights.aspect.js
CHANGED
|
@@ -4,23 +4,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.InsightsAspect = void 0;
|
|
7
|
-
|
|
8
7
|
function _harmony() {
|
|
9
8
|
const data = require("@teambit/harmony");
|
|
10
|
-
|
|
11
9
|
_harmony = function () {
|
|
12
10
|
return data;
|
|
13
11
|
};
|
|
14
|
-
|
|
15
12
|
return data;
|
|
16
13
|
}
|
|
17
|
-
|
|
18
14
|
const InsightsAspect = _harmony().Aspect.create({
|
|
19
15
|
id: 'teambit.explorer/insights',
|
|
20
16
|
dependencies: [],
|
|
21
17
|
defaultConfig: {}
|
|
22
18
|
});
|
|
23
|
-
|
|
24
19
|
exports.InsightsAspect = InsightsAspect;
|
|
25
20
|
|
|
26
21
|
//# sourceMappingURL=insights.aspect.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["InsightsAspect","Aspect","create","id","dependencies","defaultConfig"],"sources":["insights.aspect.ts"],"sourcesContent":["import { Aspect } from '@teambit/harmony';\n\nexport const InsightsAspect = Aspect.create({\n id: 'teambit.explorer/insights',\n dependencies: [],\n defaultConfig: {},\n});\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["InsightsAspect","Aspect","create","id","dependencies","defaultConfig"],"sources":["insights.aspect.ts"],"sourcesContent":["import { Aspect } from '@teambit/harmony';\n\nexport const InsightsAspect = Aspect.create({\n id: 'teambit.explorer/insights',\n dependencies: [],\n defaultConfig: {},\n});\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,cAAc,GAAGC,iBAAM,CAACC,MAAM,CAAC;EAC1CC,EAAE,EAAE,2BAA2B;EAC/BC,YAAY,EAAE,EAAE;EAChBC,aAAa,EAAE,CAAC;AAClB,CAAC,CAAC;AAAC"}
|
package/dist/insights.cmd.js
CHANGED
|
@@ -1,36 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
require("core-js/modules/es.array.iterator.js");
|
|
6
|
-
|
|
7
5
|
require("core-js/modules/es.promise.js");
|
|
8
|
-
|
|
9
6
|
Object.defineProperty(exports, "__esModule", {
|
|
10
7
|
value: true
|
|
11
8
|
});
|
|
12
9
|
exports.default = void 0;
|
|
13
|
-
|
|
14
10
|
function _defineProperty2() {
|
|
15
11
|
const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
16
|
-
|
|
17
12
|
_defineProperty2 = function () {
|
|
18
13
|
return data;
|
|
19
14
|
};
|
|
20
|
-
|
|
21
15
|
return data;
|
|
22
16
|
}
|
|
23
|
-
|
|
24
17
|
function _chalk() {
|
|
25
18
|
const data = _interopRequireDefault(require("chalk"));
|
|
26
|
-
|
|
27
19
|
_chalk = function () {
|
|
28
20
|
return data;
|
|
29
21
|
};
|
|
30
|
-
|
|
31
22
|
return data;
|
|
32
23
|
}
|
|
33
|
-
|
|
34
24
|
class InsightsCmd {
|
|
35
25
|
constructor(insights) {
|
|
36
26
|
this.insights = insights;
|
|
@@ -40,19 +30,16 @@ class InsightsCmd {
|
|
|
40
30
|
(0, _defineProperty2().default)(this, "private", true);
|
|
41
31
|
(0, _defineProperty2().default)(this, "options", [['l', 'list', 'list all insights'], ['j', 'json', 'return the insights in json format']]);
|
|
42
32
|
}
|
|
43
|
-
|
|
44
33
|
async report([names], options) {
|
|
45
34
|
if (options.list) {
|
|
46
35
|
const results = await this.json([names], options);
|
|
47
36
|
return JSON.stringify(results, null, 2);
|
|
48
37
|
}
|
|
49
|
-
|
|
50
38
|
const results = await this.insights.runInsights(names, {
|
|
51
39
|
renderData: true
|
|
52
40
|
});
|
|
53
41
|
return template(results);
|
|
54
42
|
}
|
|
55
|
-
|
|
56
43
|
async json([names], {
|
|
57
44
|
list
|
|
58
45
|
}) {
|
|
@@ -60,16 +47,12 @@ class InsightsCmd {
|
|
|
60
47
|
const results = this.insights.listInsights();
|
|
61
48
|
return results;
|
|
62
49
|
}
|
|
63
|
-
|
|
64
50
|
return this.insights.runInsights(names, {
|
|
65
51
|
renderData: false
|
|
66
52
|
});
|
|
67
53
|
}
|
|
68
|
-
|
|
69
54
|
}
|
|
70
|
-
|
|
71
55
|
exports.default = InsightsCmd;
|
|
72
|
-
|
|
73
56
|
function template(results) {
|
|
74
57
|
const elements = results.map(result => {
|
|
75
58
|
return `\n${_chalk().default.cyan.bold(result.message)}
|
package/dist/insights.cmd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["InsightsCmd","constructor","insights","report","names","options","list","results","json","JSON","stringify","runInsights","renderData","template","listInsights","elements","map","result","chalk","cyan","bold","message","renderedData","join"],"sources":["insights.cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { InsightResult } from './insight';\nimport { InsightsMain } from './insights.main.runtime';\n\nexport default class InsightsCmd implements Command {\n name = 'insights [names...]';\n description = 'Insights on component graph';\n group = 'development';\n private = true;\n options = [\n ['l', 'list', 'list all insights'],\n ['j', 'json', 'return the insights in json format'],\n ] as CommandOptions;\n constructor(private insights: InsightsMain) {}\n\n async report([names]: [string[]], options: { list: boolean }): Promise<string> {\n if (options.list) {\n const results = await this.json([names], options);\n return JSON.stringify(results, null, 2);\n }\n const results = await this.insights.runInsights(names, { renderData: true });\n return template(results);\n }\n\n async json([names]: [string[]], { list }: { list: boolean }) {\n if (list) {\n const results = this.insights.listInsights();\n return results;\n }\n return this.insights.runInsights(names, { renderData: false });\n }\n}\n\nfunction template(results: InsightResult[]): string {\n const elements = results\n .map((result) => {\n return `\\n${chalk.cyan.bold(result.message)}\n ${result.renderedData}`;\n })\n .join('\\n');\n return elements;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["InsightsCmd","constructor","insights","report","names","options","list","results","json","JSON","stringify","runInsights","renderData","template","listInsights","elements","map","result","chalk","cyan","bold","message","renderedData","join"],"sources":["insights.cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { InsightResult } from './insight';\nimport { InsightsMain } from './insights.main.runtime';\n\nexport default class InsightsCmd implements Command {\n name = 'insights [names...]';\n description = 'Insights on component graph';\n group = 'development';\n private = true;\n options = [\n ['l', 'list', 'list all insights'],\n ['j', 'json', 'return the insights in json format'],\n ] as CommandOptions;\n constructor(private insights: InsightsMain) {}\n\n async report([names]: [string[]], options: { list: boolean }): Promise<string> {\n if (options.list) {\n const results = await this.json([names], options);\n return JSON.stringify(results, null, 2);\n }\n const results = await this.insights.runInsights(names, { renderData: true });\n return template(results);\n }\n\n async json([names]: [string[]], { list }: { list: boolean }) {\n if (list) {\n const results = this.insights.listInsights();\n return results;\n }\n return this.insights.runInsights(names, { renderData: false });\n }\n}\n\nfunction template(results: InsightResult[]): string {\n const elements = results\n .map((result) => {\n return `\\n${chalk.cyan.bold(result.message)}\n ${result.renderedData}`;\n })\n .join('\\n');\n return elements;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAKe,MAAMA,WAAW,CAAoB;EASlDC,WAAW,C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C;EACrB,CAAC,CAAC,CACDC,IAAI,CAAC,IAAI,CAAC;EACb,OAAOR,QAAQ;AACjB"}
|
|
@@ -1,22 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.Logo = void 0;
|
|
9
|
-
|
|
10
8
|
function _react() {
|
|
11
9
|
const data = _interopRequireDefault(require("react"));
|
|
12
|
-
|
|
13
10
|
_react = function () {
|
|
14
11
|
return data;
|
|
15
12
|
};
|
|
16
|
-
|
|
17
13
|
return data;
|
|
18
14
|
}
|
|
19
|
-
|
|
20
15
|
const Logo = () => /*#__PURE__*/_react().default.createElement("div", {
|
|
21
16
|
style: {
|
|
22
17
|
height: '100%',
|
|
@@ -29,7 +24,6 @@ const Logo = () => /*#__PURE__*/_react().default.createElement("div", {
|
|
|
29
24
|
},
|
|
30
25
|
src: "https://static.bit.dev/extensions-icons/insights.svg"
|
|
31
26
|
}));
|
|
32
|
-
|
|
33
27
|
exports.Logo = Logo;
|
|
34
28
|
|
|
35
29
|
//# sourceMappingURL=insights.compositon.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Logo","height","display","justifyContent","width"],"sources":["insights.compositon.tsx"],"sourcesContent":["import React from 'react';\n\nexport const Logo = () => (\n <div style={{ height: '100%', display: 'flex', justifyContent: 'center' }}>\n <img style={{ width: 70 }} src=\"https://static.bit.dev/extensions-icons/insights.svg\" />\n </div>\n);\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["Logo","height","display","justifyContent","width"],"sources":["insights.compositon.tsx"],"sourcesContent":["import React from 'react';\n\nexport const Logo = () => (\n <div style={{ height: '100%', display: 'flex', justifyContent: 'center' }}>\n <img style={{ width: 70 }} src=\"https://static.bit.dev/extensions-icons/insights.svg\" />\n </div>\n);\n"],"mappings":";;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,IAAI,GAAG,mBAClB;EAAK,KAAK,EAAE;IAAEC,MAAM,EAAE,MAAM;IAAEC,OAAO,EAAE,MAAM;IAAEC,cAAc,EAAE;EAAS;AAAE,gBACxE;EAAK,KAAK,EAAE;IAAEC,KAAK,EAAE;EAAG,CAAE;EAAC,GAAG,EAAC;AAAsD,EAAG,CAE3F;AAAC"}
|
|
@@ -1,121 +1,86 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
require("core-js/modules/es.array.iterator.js");
|
|
6
|
-
|
|
7
5
|
require("core-js/modules/es.promise.js");
|
|
8
|
-
|
|
9
6
|
Object.defineProperty(exports, "__esModule", {
|
|
10
7
|
value: true
|
|
11
8
|
});
|
|
12
9
|
exports.InsightsMain = void 0;
|
|
13
|
-
|
|
14
10
|
function _defineProperty2() {
|
|
15
11
|
const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
16
|
-
|
|
17
12
|
_defineProperty2 = function () {
|
|
18
13
|
return data;
|
|
19
14
|
};
|
|
20
|
-
|
|
21
15
|
return data;
|
|
22
16
|
}
|
|
23
|
-
|
|
24
17
|
function _cli() {
|
|
25
18
|
const data = require("@teambit/cli");
|
|
26
|
-
|
|
27
19
|
_cli = function () {
|
|
28
20
|
return data;
|
|
29
21
|
};
|
|
30
|
-
|
|
31
22
|
return data;
|
|
32
23
|
}
|
|
33
|
-
|
|
34
24
|
function _graph() {
|
|
35
25
|
const data = require("@teambit/graph");
|
|
36
|
-
|
|
37
26
|
_graph = function () {
|
|
38
27
|
return data;
|
|
39
28
|
};
|
|
40
|
-
|
|
41
29
|
return data;
|
|
42
30
|
}
|
|
43
|
-
|
|
44
31
|
function _componentIssues() {
|
|
45
32
|
const data = require("@teambit/component-issues");
|
|
46
|
-
|
|
47
33
|
_componentIssues = function () {
|
|
48
34
|
return data;
|
|
49
35
|
};
|
|
50
|
-
|
|
51
36
|
return data;
|
|
52
37
|
}
|
|
53
|
-
|
|
54
38
|
function _issues() {
|
|
55
39
|
const data = _interopRequireDefault(require("@teambit/issues"));
|
|
56
|
-
|
|
57
40
|
_issues = function () {
|
|
58
41
|
return data;
|
|
59
42
|
};
|
|
60
|
-
|
|
61
43
|
return data;
|
|
62
44
|
}
|
|
63
|
-
|
|
64
45
|
function _pMapSeries() {
|
|
65
46
|
const data = _interopRequireDefault(require("p-map-series"));
|
|
66
|
-
|
|
67
47
|
_pMapSeries = function () {
|
|
68
48
|
return data;
|
|
69
49
|
};
|
|
70
|
-
|
|
71
50
|
return data;
|
|
72
51
|
}
|
|
73
|
-
|
|
74
52
|
function _insights() {
|
|
75
53
|
const data = require("./insights.aspect");
|
|
76
|
-
|
|
77
54
|
_insights = function () {
|
|
78
55
|
return data;
|
|
79
56
|
};
|
|
80
|
-
|
|
81
57
|
return data;
|
|
82
58
|
}
|
|
83
|
-
|
|
84
59
|
function _coreInsightsGetter() {
|
|
85
60
|
const data = _interopRequireDefault(require("./core-insights-getter"));
|
|
86
|
-
|
|
87
61
|
_coreInsightsGetter = function () {
|
|
88
62
|
return data;
|
|
89
63
|
};
|
|
90
|
-
|
|
91
64
|
return data;
|
|
92
65
|
}
|
|
93
|
-
|
|
94
66
|
function _insightManager() {
|
|
95
67
|
const data = require("./insight-manager");
|
|
96
|
-
|
|
97
68
|
_insightManager = function () {
|
|
98
69
|
return data;
|
|
99
70
|
};
|
|
100
|
-
|
|
101
71
|
return data;
|
|
102
72
|
}
|
|
103
|
-
|
|
104
73
|
function _insights2() {
|
|
105
74
|
const data = _interopRequireDefault(require("./insights.cmd"));
|
|
106
|
-
|
|
107
75
|
_insights2 = function () {
|
|
108
76
|
return data;
|
|
109
77
|
};
|
|
110
|
-
|
|
111
78
|
return data;
|
|
112
79
|
}
|
|
113
|
-
|
|
114
80
|
class InsightsMain {
|
|
115
81
|
constructor(insightManager) {
|
|
116
82
|
this.insightManager = insightManager;
|
|
117
83
|
}
|
|
118
|
-
|
|
119
84
|
async runInsights(names, opts) {
|
|
120
85
|
if (names) {
|
|
121
86
|
let results = [];
|
|
@@ -123,19 +88,15 @@ class InsightsMain {
|
|
|
123
88
|
results = await this.insightManager.run(namesArr, opts);
|
|
124
89
|
return results;
|
|
125
90
|
}
|
|
126
|
-
|
|
127
91
|
const results = await this.insightManager.runAll(opts);
|
|
128
92
|
return results;
|
|
129
93
|
}
|
|
130
|
-
|
|
131
94
|
listInsights() {
|
|
132
95
|
return this.insightManager.listInsights();
|
|
133
96
|
}
|
|
134
|
-
|
|
135
97
|
async addInsightsAsComponentIssues(components, issuesToIgnore) {
|
|
136
98
|
const insightNames = this.listInsights();
|
|
137
99
|
const insights = insightNames.map(name => this.insightManager.getByName(name));
|
|
138
|
-
|
|
139
100
|
if (!issuesToIgnore.includes(_componentIssues().IssuesClasses.CircularDependencies.name)) {
|
|
140
101
|
await (0, _pMapSeries().default)(insights, async insight => {
|
|
141
102
|
if (insight && insight.addAsComponentIssue) {
|
|
@@ -144,12 +105,11 @@ class InsightsMain {
|
|
|
144
105
|
});
|
|
145
106
|
}
|
|
146
107
|
}
|
|
147
|
-
|
|
148
108
|
static async provider([graphBuilder, cli, issues]) {
|
|
149
109
|
// get all insights from registry
|
|
150
|
-
const initialInsights = (0, _coreInsightsGetter().default)(graphBuilder);
|
|
110
|
+
const initialInsights = (0, _coreInsightsGetter().default)(graphBuilder);
|
|
111
|
+
// register all insights in cli
|
|
151
112
|
// TODO - get user-defined insights as well, and use them when instantiating InsightManager and InsightsCmd
|
|
152
|
-
|
|
153
113
|
const insightManager = new (_insightManager().InsightManager)(initialInsights);
|
|
154
114
|
const insightsMain = new InsightsMain(insightManager);
|
|
155
115
|
issues.registerAddComponentsIssues(insightsMain.addInsightsAsComponentIssues.bind(insightsMain));
|
|
@@ -157,9 +117,7 @@ class InsightsMain {
|
|
|
157
117
|
cli.register(insightsCmd);
|
|
158
118
|
return insightsMain;
|
|
159
119
|
}
|
|
160
|
-
|
|
161
120
|
}
|
|
162
|
-
|
|
163
121
|
exports.InsightsMain = InsightsMain;
|
|
164
122
|
(0, _defineProperty2().default)(InsightsMain, "slots", []);
|
|
165
123
|
(0, _defineProperty2().default)(InsightsMain, "dependencies", [_graph().GraphAspect, _cli().CLIAspect, _issues().default]);
|
|
@@ -167,7 +125,6 @@ exports.InsightsMain = InsightsMain;
|
|
|
167
125
|
(0, _defineProperty2().default)(InsightsMain, "config", {
|
|
168
126
|
silence: false
|
|
169
127
|
});
|
|
170
|
-
|
|
171
128
|
_insights().InsightsAspect.addRuntime(InsightsMain);
|
|
172
129
|
|
|
173
130
|
//# sourceMappingURL=insights.main.runtime.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["InsightsMain","constructor","insightManager","runInsights","names","opts","results","namesArr","run","runAll","listInsights","addInsightsAsComponentIssues","components","issuesToIgnore","insightNames","insights","map","name","getByName","includes","IssuesClasses","CircularDependencies","pMapSeries","insight","addAsComponentIssue","provider","graphBuilder","cli","issues","initialInsights","getCoreInsights","InsightManager","insightsMain","registerAddComponentsIssues","bind","insightsCmd","InsightsCmd","register","GraphAspect","CLIAspect","IssuesAspect","MainRuntime","silence","InsightsAspect","addRuntime"],"sources":["insights.main.runtime.ts"],"sourcesContent":["import { CLIAspect, MainRuntime, CLIMain } from '@teambit/cli';\nimport { GraphAspect, GraphBuilder } from '@teambit/graph';\nimport { IssuesClasses } from '@teambit/component-issues';\nimport IssuesAspect, { IssuesMain } from '@teambit/issues';\nimport pMapSeries from 'p-map-series';\nimport { Component } from '@teambit/component';\nimport { InsightsAspect } from './insights.aspect';\nimport getCoreInsights from './core-insights-getter';\nimport { Insight, InsightResult } from './insight';\nimport { InsightManager, RunInsightOptions } from './insight-manager';\nimport InsightsCmd from './insights.cmd';\n\nexport class InsightsMain {\n constructor(private insightManager: InsightManager) {}\n\n async runInsights(names: string[], opts: RunInsightOptions) {\n if (names) {\n let results: InsightResult[] = [];\n const namesArr = typeof names === 'string' ? [names] : names;\n results = await this.insightManager.run(namesArr, opts);\n return results;\n }\n const results = await this.insightManager.runAll(opts);\n return results;\n }\n\n listInsights() {\n return this.insightManager.listInsights();\n }\n\n async addInsightsAsComponentIssues(components: Component[], issuesToIgnore: string[]) {\n const insightNames: string[] = this.listInsights();\n const insights = insightNames.map((name) => this.insightManager.getByName(name));\n if (!issuesToIgnore.includes(IssuesClasses.CircularDependencies.name)) {\n await pMapSeries(insights, async (insight) => {\n if (insight && insight.addAsComponentIssue) {\n await insight.addAsComponentIssue(components);\n }\n });\n }\n }\n\n static slots = [];\n static dependencies = [GraphAspect, CLIAspect, IssuesAspect];\n static runtime = MainRuntime;\n static config = {\n silence: false,\n };\n static async provider([graphBuilder, cli, issues]: [GraphBuilder, CLIMain, IssuesMain]) {\n // get all insights from registry\n const initialInsights: Insight[] = getCoreInsights(graphBuilder);\n // register all insights in cli\n // TODO - get user-defined insights as well, and use them when instantiating InsightManager and InsightsCmd\n const insightManager = new InsightManager(initialInsights);\n const insightsMain = new InsightsMain(insightManager);\n issues.registerAddComponentsIssues(insightsMain.addInsightsAsComponentIssues.bind(insightsMain));\n const insightsCmd = new InsightsCmd(insightsMain);\n cli.register(insightsCmd);\n return insightsMain;\n }\n}\n\nInsightsAspect.addRuntime(InsightsMain);\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["InsightsMain","constructor","insightManager","runInsights","names","opts","results","namesArr","run","runAll","listInsights","addInsightsAsComponentIssues","components","issuesToIgnore","insightNames","insights","map","name","getByName","includes","IssuesClasses","CircularDependencies","pMapSeries","insight","addAsComponentIssue","provider","graphBuilder","cli","issues","initialInsights","getCoreInsights","InsightManager","insightsMain","registerAddComponentsIssues","bind","insightsCmd","InsightsCmd","register","GraphAspect","CLIAspect","IssuesAspect","MainRuntime","silence","InsightsAspect","addRuntime"],"sources":["insights.main.runtime.ts"],"sourcesContent":["import { CLIAspect, MainRuntime, CLIMain } from '@teambit/cli';\nimport { GraphAspect, GraphBuilder } from '@teambit/graph';\nimport { IssuesClasses } from '@teambit/component-issues';\nimport IssuesAspect, { IssuesMain } from '@teambit/issues';\nimport pMapSeries from 'p-map-series';\nimport { Component } from '@teambit/component';\nimport { InsightsAspect } from './insights.aspect';\nimport getCoreInsights from './core-insights-getter';\nimport { Insight, InsightResult } from './insight';\nimport { InsightManager, RunInsightOptions } from './insight-manager';\nimport InsightsCmd from './insights.cmd';\n\nexport class InsightsMain {\n constructor(private insightManager: InsightManager) {}\n\n async runInsights(names: string[], opts: RunInsightOptions) {\n if (names) {\n let results: InsightResult[] = [];\n const namesArr = typeof names === 'string' ? [names] : names;\n results = await this.insightManager.run(namesArr, opts);\n return results;\n }\n const results = await this.insightManager.runAll(opts);\n return results;\n }\n\n listInsights() {\n return this.insightManager.listInsights();\n }\n\n async addInsightsAsComponentIssues(components: Component[], issuesToIgnore: string[]) {\n const insightNames: string[] = this.listInsights();\n const insights = insightNames.map((name) => this.insightManager.getByName(name));\n if (!issuesToIgnore.includes(IssuesClasses.CircularDependencies.name)) {\n await pMapSeries(insights, async (insight) => {\n if (insight && insight.addAsComponentIssue) {\n await insight.addAsComponentIssue(components);\n }\n });\n }\n }\n\n static slots = [];\n static dependencies = [GraphAspect, CLIAspect, IssuesAspect];\n static runtime = MainRuntime;\n static config = {\n silence: false,\n };\n static async provider([graphBuilder, cli, issues]: [GraphBuilder, CLIMain, IssuesMain]) {\n // get all insights from registry\n const initialInsights: Insight[] = getCoreInsights(graphBuilder);\n // register all insights in cli\n // TODO - get user-defined insights as well, and use them when instantiating InsightManager and InsightsCmd\n const insightManager = new InsightManager(initialInsights);\n const insightsMain = new InsightsMain(insightManager);\n issues.registerAddComponentsIssues(insightsMain.addInsightsAsComponentIssues.bind(insightsMain));\n const insightsCmd = new InsightsCmd(insightsMain);\n cli.register(insightsCmd);\n return insightsMain;\n }\n}\n\nInsightsAspect.addRuntime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epage": "https://bit.dev/teambit/explorer/insights",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.explorer",
|
|
8
8
|
"name": "insights",
|
|
9
|
-
"version": "0.0.
|
|
9
|
+
"version": "0.0.883"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"p-map-series": "2.1.0",
|
|
@@ -16,11 +16,11 @@
|
|
|
16
16
|
"@babel/runtime": "7.12.18",
|
|
17
17
|
"core-js": "^3.0.0",
|
|
18
18
|
"@teambit/harmony": "0.3.3",
|
|
19
|
-
"@teambit/graph": "0.0.
|
|
20
|
-
"@teambit/component": "0.0.
|
|
19
|
+
"@teambit/graph": "0.0.883",
|
|
20
|
+
"@teambit/component": "0.0.883",
|
|
21
21
|
"@teambit/cli": "0.0.591",
|
|
22
22
|
"@teambit/component-issues": "0.0.73",
|
|
23
|
-
"@teambit/issues": "0.0.
|
|
23
|
+
"@teambit/issues": "0.0.191",
|
|
24
24
|
"@teambit/bit-error": "0.0.400"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
;
|
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.explorer_insights@0.0.
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.explorer_insights@0.0.883/dist/insights.docs.mdx';
|
|
3
3
|
|
|
4
4
|
export const compositions = [];
|
|
5
5
|
export const overview = [overview_0];
|
|
Binary file
|