@teambit/insights 0.0.879 → 0.0.880

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.
@@ -1,20 +1,20 @@
1
1
  import { CLIMain } from '@teambit/cli';
2
2
  import { GraphBuilder } from '@teambit/graph';
3
+ import { IssuesMain } from '@teambit/issues';
3
4
  import { Component } from '@teambit/component';
4
5
  import { InsightResult } from './insight';
5
6
  import { InsightManager, RunInsightOptions } from './insight-manager';
6
- export declare type InsightDeps = [GraphBuilder, CLIMain];
7
7
  export declare class InsightsMain {
8
8
  private insightManager;
9
9
  constructor(insightManager: InsightManager);
10
10
  runInsights(names: string[], opts: RunInsightOptions): Promise<InsightResult[]>;
11
11
  listInsights(): string[];
12
- addInsightsAsComponentIssues(components: Component[], insightNames?: string[]): Promise<void>;
12
+ addInsightsAsComponentIssues(components: Component[], issuesToIgnore: string[]): Promise<void>;
13
13
  static slots: never[];
14
14
  static dependencies: import("@teambit/harmony").Aspect[];
15
15
  static runtime: import("@teambit/harmony").RuntimeDefinition;
16
16
  static config: {
17
17
  silence: boolean;
18
18
  };
19
- static provider([graphBuilder, cli]: InsightDeps): Promise<InsightsMain>;
19
+ static provider([graphBuilder, cli, issues]: [GraphBuilder, CLIMain, IssuesMain]): Promise<InsightsMain>;
20
20
  }
@@ -41,6 +41,26 @@ function _graph() {
41
41
  return data;
42
42
  }
43
43
 
44
+ function _componentIssues() {
45
+ const data = require("@teambit/component-issues");
46
+
47
+ _componentIssues = function () {
48
+ return data;
49
+ };
50
+
51
+ return data;
52
+ }
53
+
54
+ function _issues() {
55
+ const data = _interopRequireDefault(require("@teambit/issues"));
56
+
57
+ _issues = function () {
58
+ return data;
59
+ };
60
+
61
+ return data;
62
+ }
63
+
44
64
  function _pMapSeries() {
45
65
  const data = _interopRequireDefault(require("p-map-series"));
46
66
 
@@ -112,22 +132,27 @@ class InsightsMain {
112
132
  return this.insightManager.listInsights();
113
133
  }
114
134
 
115
- async addInsightsAsComponentIssues(components, insightNames = this.listInsights()) {
135
+ async addInsightsAsComponentIssues(components, issuesToIgnore) {
136
+ const insightNames = this.listInsights();
116
137
  const insights = insightNames.map(name => this.insightManager.getByName(name));
117
- await (0, _pMapSeries().default)(insights, async insight => {
118
- if (insight && insight.addAsComponentIssue) {
119
- await insight.addAsComponentIssue(components);
120
- }
121
- });
138
+
139
+ if (!issuesToIgnore.includes(_componentIssues().IssuesClasses.CircularDependencies.name)) {
140
+ await (0, _pMapSeries().default)(insights, async insight => {
141
+ if (insight && insight.addAsComponentIssue) {
142
+ await insight.addAsComponentIssue(components);
143
+ }
144
+ });
145
+ }
122
146
  }
123
147
 
124
- static async provider([graphBuilder, cli]) {
148
+ static async provider([graphBuilder, cli, issues]) {
125
149
  // get all insights from registry
126
150
  const initialInsights = (0, _coreInsightsGetter().default)(graphBuilder); // register all insights in cli
127
151
  // TODO - get user-defined insights as well, and use them when instantiating InsightManager and InsightsCmd
128
152
 
129
153
  const insightManager = new (_insightManager().InsightManager)(initialInsights);
130
154
  const insightsMain = new InsightsMain(insightManager);
155
+ issues.registerAddComponentsIssues(insightsMain.addInsightsAsComponentIssues.bind(insightsMain));
131
156
  const insightsCmd = new (_insights2().default)(insightsMain);
132
157
  cli.register(insightsCmd);
133
158
  return insightsMain;
@@ -137,7 +162,7 @@ class InsightsMain {
137
162
 
138
163
  exports.InsightsMain = InsightsMain;
139
164
  (0, _defineProperty2().default)(InsightsMain, "slots", []);
140
- (0, _defineProperty2().default)(InsightsMain, "dependencies", [_graph().GraphAspect, _cli().CLIAspect]);
165
+ (0, _defineProperty2().default)(InsightsMain, "dependencies", [_graph().GraphAspect, _cli().CLIAspect, _issues().default]);
141
166
  (0, _defineProperty2().default)(InsightsMain, "runtime", _cli().MainRuntime);
142
167
  (0, _defineProperty2().default)(InsightsMain, "config", {
143
168
  silence: false
@@ -1 +1 @@
1
- {"version":3,"names":["InsightsMain","constructor","insightManager","runInsights","names","opts","results","namesArr","run","runAll","listInsights","addInsightsAsComponentIssues","components","insightNames","insights","map","name","getByName","pMapSeries","insight","addAsComponentIssue","provider","graphBuilder","cli","initialInsights","getCoreInsights","InsightManager","insightsMain","insightsCmd","InsightsCmd","register","GraphAspect","CLIAspect","MainRuntime","silence","InsightsAspect","addRuntime"],"sources":["insights.main.runtime.ts"],"sourcesContent":["import { CLIAspect, MainRuntime, CLIMain } from '@teambit/cli';\nimport { GraphAspect, GraphBuilder } from '@teambit/graph';\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 type InsightDeps = [GraphBuilder, CLIMain];\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[], insightNames: string[] = this.listInsights()) {\n const insights = insightNames.map((name) => this.insightManager.getByName(name));\n await pMapSeries(insights, async (insight) => {\n if (insight && insight.addAsComponentIssue) {\n await insight.addAsComponentIssue(components);\n }\n });\n }\n\n static slots = [];\n static dependencies = [GraphAspect, CLIAspect];\n static runtime = MainRuntime;\n static config = {\n silence: false,\n };\n static async provider([graphBuilder, cli]: InsightDeps) {\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 const insightsCmd = new InsightsCmd(insightsMain);\n cli.register(insightsCmd);\n return insightsMain;\n }\n}\n\nInsight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AqB,MAAOK,OAAP,IAAmB;MAC5C,IAAIA,OAAO,IAAIA,OAAO,CAACC,mBAAvB,EAA4C;QAC1C,MAAMD,OAAO,CAACC,mBAAR,CAA4BR,UAA5B,CAAN;MACD;IACF,CAJK,CAAN;EAKD;;EAQoB,aAARS,QAAQ,CAAC,CAACC,YAAD,EAAeC,GAAf,CAAD,EAAmC;IACtD;IACA,MAAMC,eAA0B,GAAG,IAAAC,6BAAA,EAAgBH,YAAhB,CAAnC,CAFsD,CAGtD;IACA;;IACA,MAAMpB,cAAc,GAAG,KAAIwB,gCAAJ,EAAmBF,eAAnB,CAAvB;IACA,MAAMG,YAAY,GAAG,IAAI3B,YAAJ,CAAiBE,cAAjB,CAArB;IACA,MAAM0B,WAAW,GAAG,KAAIC,oBAAJ,EAAgBF,YAAhB,CAApB;IACAJ,GAAG,CAACO,QAAJ,CAAaF,WAAb;IACA,OAAOD,YAAP;EACD;;AA3CuB;;;gCAAb3B,Y,WA2BI,E;gCA3BJA,Y,kBA4BW,CAAC+B,oBAAD,EAAcC,gBAAd,C;gCA5BXhC,Y,aA6BMiC,kB;gCA7BNjC,Y,YA8BK;EACdkC,OAAO,EAAE;AADK,C;;AAgBlBC,0BAAA,CAAeC,UAAf,CAA0BpC,YAA1B"}
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":";;;;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAA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CAAcC,oBAAd,CAAmCJ,IAA3D,CAAL,EAAuE;MACrE,MAAM,IAAAK,qBAAA,EAAWP,QAAX,EAAqB,MAAOQ,OAAP,IAAmB;QAC5C,IAAIA,OAAO,IAAIA,OAAO,CAACC,mBAAvB,EAA4C;UAC1C,MAAMD,OAAO,CAACC,mBAAR,CAA4BZ,UAA5B,CAAN;QACD;MACF,CAJK,CAAN;IAKD;EACF;;EAQoB,aAARa,QAAQ,CAAC,CAACC,YAAD,EAAeC,GAAf,EAAoBC,MAApB,CAAD,EAAmE;IACtF;IACA,MAAMC,eAA0B,GAAG,IAAAC,6BAAA,EAAgBJ,YAAhB,CAAnC,CAFsF,CAGtF;IACA;;IACA,MAAMxB,cAAc,GAAG,KAAI6B,gCAAJ,EAAmBF,eAAnB,CAAvB;IACA,MAAMG,YAAY,GAAG,IAAIhC,YAAJ,CAAiBE,cAAjB,CAArB;IACA0B,MAAM,CAACK,2BAAP,CAAmCD,YAAY,CAACrB,4BAAb,CAA0CuB,IAA1C,CAA+CF,YAA/C,CAAnC;IACA,MAAMG,WAAW,GAAG,KAAIC,oBAAJ,EAAgBJ,YAAhB,CAApB;IACAL,GAAG,CAACU,QAAJ,CAAaF,WAAb;IACA,OAAOH,YAAP;EACD;;AA/CuB;;;gCAAbhC,Y,WA8BI,E;gCA9BJA,Y,kBA+BW,CAACsC,oBAAD,EAAcC,gBAAd,EAAyBC,iBAAzB,C;gCA/BXxC,Y,aAgCMyC,kB;gCAhCNzC,Y,YAiCK;EACd0C,OAAO,EAAE;AADK,C;;AAiBlBC,0BAAA,CAAeC,UAAf,CAA0B5C,YAA1B"}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/insights",
3
- "version": "0.0.879",
3
+ "version": "0.0.880",
4
4
  "homepage": "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.879"
9
+ "version": "0.0.880"
10
10
  },
11
11
  "dependencies": {
12
12
  "p-map-series": "2.1.0",
@@ -16,10 +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.879",
20
- "@teambit/component": "0.0.879",
21
- "@teambit/cli": "0.0.589",
22
- "@teambit/component-issues": "0.0.72",
19
+ "@teambit/graph": "0.0.880",
20
+ "@teambit/component": "0.0.880",
21
+ "@teambit/cli": "0.0.590",
22
+ "@teambit/component-issues": "0.0.73",
23
+ "@teambit/issues": "0.0.188",
23
24
  "@teambit/bit-error": "0.0.400"
24
25
  },
25
26
  "devDependencies": {
@@ -33,7 +34,7 @@
33
34
  "@types/node": "12.20.4"
34
35
  },
35
36
  "peerDependencies": {
36
- "@teambit/legacy": "1.0.370",
37
+ "@teambit/legacy": "1.0.373",
37
38
  "react-dom": "^16.8.0 || ^17.0.0",
38
39
  "react": "^16.8.0 || ^17.0.0"
39
40
  },
@@ -1,5 +1,5 @@
1
1
  ;
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.explorer_insights@0.0.879/dist/insights.docs.mdx';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.explorer_insights@0.0.880/dist/insights.docs.mdx';
3
3
 
4
4
  export const compositions = [];
5
5
  export const overview = [overview_0];