@teambit/insights 1.0.235 → 1.0.237

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.
@@ -23,6 +23,8 @@ export default class FindCycles implements Insight {
23
23
  };
24
24
  }
25
25
  const cycles = graph.findCycles(undefined, opts?.includeDeps);
26
+ // add the first component to the end to make the circular visible in the output
27
+ cycles.forEach((cycle) => cycle.push(cycle[0]));
26
28
  if (cycles.length === 1) {
27
29
  return {
28
30
  message: `Found ${cycles.length} cycle.`,
@@ -1,4 +1,4 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <testsuites tests="0" failures="0" errors="0" skipped="0">
3
- <testsuite name="teambit.explorer/insights@1.0.235" tests="0" failures="0" errors="0" skipped="0"/>
3
+ <testsuite name="teambit.explorer/insights@1.0.237" tests="0" failures="0" errors="0" skipped="0"/>
4
4
  </testsuites>
@@ -2669,7 +2669,7 @@
2669
2669
  "componentId": {
2670
2670
  "scope": "teambit.explorer",
2671
2671
  "name": "insights",
2672
- "version": "1.0.235"
2672
+ "version": "1.0.237"
2673
2673
  },
2674
2674
  "taggedModuleExports": []
2675
2675
  }
@@ -38,6 +38,8 @@ class FindCycles {
38
38
  };
39
39
  }
40
40
  const cycles = graph.findCycles(undefined, opts?.includeDeps);
41
+ // add the first component to the end to make the circular visible in the output
42
+ cycles.forEach(cycle => cycle.push(cycle[0]));
41
43
  if (cycles.length === 1) {
42
44
  return {
43
45
  message: `Found ${cycles.length} cycle.`,
@@ -1 +1 @@
1
- {"version":3,"names":["_componentIssues","data","require","_lodash","_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","r","e","Symbol","toPrimitive","call","TypeError","String","Number","INSIGHT_CIRCULAR_DEPS_NAME","exports","FindCycles","constructor","graphBuilder","runInsight","opts","graph","getGraphIds","ids","message","undefined","cycles","findCycles","includeDeps","length","renderData","string","map","cycle","join","run","bareResult","renderedData","result","metaData","name","description","addAsComponentIssue","components","c","id","allIds","uniq","flat","componentsWithCircular","filter","component","includes","toString","forEach","state","issues","getOrCreate","IssuesClasses","CircularDependencies","default"],"sources":["find-circulars.ts"],"sourcesContent":["import { Component } from '@teambit/component';\nimport { IssuesClasses } from '@teambit/component-issues';\nimport { GraphMain } from '@teambit/graph';\nimport { uniq } from 'lodash';\nimport { Insight, InsightResult, RawResult } from '../insight';\nimport { RunInsightOptions } from '../insight-manager';\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: GraphMain;\n constructor(graphBuilder: GraphMain) {\n this.graphBuilder = graphBuilder;\n }\n private async runInsight(opts?: RunInsightOptions): Promise<RawResult> {\n const graph = await this.graphBuilder.getGraphIds(opts?.ids);\n if (!graph) {\n return {\n message: '',\n data: undefined,\n };\n }\n const cycles = graph.findCycles(undefined, opts?.includeDeps);\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(opts?: RunInsightOptions): Promise<InsightResult> {\n const bareResult = await this.runInsight(opts);\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({ ids: components.map((c) => c.id) });\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,SAAAA,iBAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,gBAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAE,QAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA8B,SAAAG,gBAAAC,GAAA,EAAAC,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAD,GAAA,IAAAI,MAAA,CAAAC,cAAA,CAAAL,GAAA,EAAAC,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAR,GAAA,CAAAC,GAAA,IAAAC,KAAA,WAAAF,GAAA;AAAA,SAAAG,eAAAM,CAAA,QAAAC,CAAA,GAAAC,YAAA,CAAAF,CAAA,uCAAAC,CAAA,GAAAA,CAAA,GAAAA,CAAA;AAAA,SAAAC,aAAAF,CAAA,EAAAG,CAAA,2BAAAH,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAI,CAAA,GAAAJ,CAAA,CAAAK,MAAA,CAAAC,WAAA,kBAAAF,CAAA,QAAAH,CAAA,GAAAG,CAAA,CAAAG,IAAA,CAAAP,CAAA,EAAAG,CAAA,uCAAAF,CAAA,SAAAA,CAAA,YAAAO,SAAA,yEAAAL,CAAA,GAAAM,MAAA,GAAAC,MAAA,EAAAV,CAAA;AAIvB,MAAMW,0BAA0B,GAAAC,OAAA,CAAAD,0BAAA,GAAG,UAAU;AAErC,MAAME,UAAU,CAAoB;EAIjDC,WAAWA,CAACC,YAAuB,EAAE;IAAAzB,eAAA,eAH9BqB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,EAAE;QACRC,IAAI,EAAE,IAAI,CAACA,IAAI;QACfC,WAAW,EAAE,IAAI,CAACA;MACpB,CAAC;MACDnD,IAAI,EAAE8C,UAAU,CAAC9C,IAAI;MACrBkC,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,mBAAmBA,CAACC,UAAuB,EAAE;IACjD,MAAML,MAAM,GAAG,MAAM,IAAI,CAACnB,UAAU,CAAC;MAAEI,GAAG,EAAEoB,UAAU,CAACX,GAAG,CAAEY,CAAC,IAAKA,CAAC,CAACC,EAAE;IAAE,CAAC,CAAC;IAC1E,IAAI,CAACP,MAAM,CAAChD,IAAI,CAACuC,MAAM,EAAE;MACvB,OAAO,CAAC;IACV;IACA,MAAMiB,MAAM,GAAG,IAAAC,cAAI,EAACT,MAAM,CAAChD,IAAI,CAAC0D,IAAI,CAAC,CAAC,CAAC;IACvC,MAAMC,sBAAsB,GAAGN,UAAU,CAACO,MAAM,CAAEC,SAAS,IAAKL,MAAM,CAACM,QAAQ,CAACD,SAAS,CAACN,EAAE,CAACQ,QAAQ,CAAC,CAAC,CAAC,CAAC;IACzGJ,sBAAsB,CAACK,OAAO,CAAEH,SAAS,IAAK;MAC5CA,SAAS,CAACI,KAAK,CAACC,MAAM,CAACC,WAAW,CAACC,gCAAa,CAACC,oBAAoB,CAAC,CAACrE,IAAI,GAAG,IAAI;IACpF,CAAC,CAAC;EACJ;AACF;AAACyB,OAAA,CAAA6C,OAAA,GAAA5C,UAAA","ignoreList":[]}
1
+ {"version":3,"names":["_componentIssues","data","require","_lodash","_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","r","e","Symbol","toPrimitive","call","TypeError","String","Number","INSIGHT_CIRCULAR_DEPS_NAME","exports","FindCycles","constructor","graphBuilder","runInsight","opts","graph","getGraphIds","ids","message","undefined","cycles","findCycles","includeDeps","forEach","cycle","push","length","renderData","string","map","join","run","bareResult","renderedData","result","metaData","name","description","addAsComponentIssue","components","c","id","allIds","uniq","flat","componentsWithCircular","filter","component","includes","toString","state","issues","getOrCreate","IssuesClasses","CircularDependencies","default"],"sources":["find-circulars.ts"],"sourcesContent":["import { Component } from '@teambit/component';\nimport { IssuesClasses } from '@teambit/component-issues';\nimport { GraphMain } from '@teambit/graph';\nimport { uniq } from 'lodash';\nimport { Insight, InsightResult, RawResult } from '../insight';\nimport { RunInsightOptions } from '../insight-manager';\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: GraphMain;\n constructor(graphBuilder: GraphMain) {\n this.graphBuilder = graphBuilder;\n }\n private async runInsight(opts?: RunInsightOptions): Promise<RawResult> {\n const graph = await this.graphBuilder.getGraphIds(opts?.ids);\n if (!graph) {\n return {\n message: '',\n data: undefined,\n };\n }\n const cycles = graph.findCycles(undefined, opts?.includeDeps);\n // add the first component to the end to make the circular visible in the output\n cycles.forEach((cycle) => cycle.push(cycle[0]));\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(opts?: RunInsightOptions): Promise<InsightResult> {\n const bareResult = await this.runInsight(opts);\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({ ids: components.map((c) => c.id) });\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,SAAAA,iBAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,gBAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAE,QAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA8B,SAAAG,gBAAAC,GAAA,EAAAC,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAD,GAAA,IAAAI,MAAA,CAAAC,cAAA,CAAAL,GAAA,EAAAC,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAR,GAAA,CAAAC,GAAA,IAAAC,KAAA,WAAAF,GAAA;AAAA,SAAAG,eAAAM,CAAA,QAAAC,CAAA,GAAAC,YAAA,CAAAF,CAAA,uCAAAC,CAAA,GAAAA,CAAA,GAAAA,CAAA;AAAA,SAAAC,aAAAF,CAAA,EAAAG,CAAA,2BAAAH,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAI,CAAA,GAAAJ,CAAA,CAAAK,MAAA,CAAAC,WAAA,kBAAAF,CAAA,QAAAH,CAAA,GAAAG,CAAA,CAAAG,IAAA,CAAAP,CAAA,EAAAG,CAAA,uCAAAF,CAAA,SAAAA,CAAA,YAAAO,SAAA,yEAAAL,CAAA,GAAAM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a,CAACC,oBAAoB,CAAC,CAACtE,IAAI,GAAG,IAAI;IACpF,CAAC,CAAC;EACJ;AACF;AAACyB,OAAA,CAAA8C,OAAA,GAAA7C,UAAA","ignoreList":[]}
@@ -1,5 +1,5 @@
1
1
  ;
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.explorer_insights@1.0.235/dist/insights.docs.mdx';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.explorer_insights@1.0.237/dist/insights.docs.mdx';
3
3
 
4
4
  export const compositions = [];
5
5
  export const overview = [overview_0];
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/insights",
3
- "version": "1.0.235",
3
+ "version": "1.0.237",
4
4
  "homepage": "https://bit.cloud/teambit/explorer/insights",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.explorer",
8
8
  "name": "insights",
9
- "version": "1.0.235"
9
+ "version": "1.0.237"
10
10
  },
11
11
  "dependencies": {
12
12
  "p-map-series": "2.1.0",
@@ -16,11 +16,11 @@
16
16
  "@teambit/component-id": "1.2.0",
17
17
  "@teambit/harmony": "0.4.6",
18
18
  "@teambit/bit-error": "0.0.404",
19
- "@teambit/graph": "1.0.235",
20
- "@teambit/component": "1.0.235",
19
+ "@teambit/graph": "1.0.237",
20
+ "@teambit/component": "1.0.237",
21
21
  "@teambit/cli": "0.0.862",
22
22
  "@teambit/component-issues": "0.0.147",
23
- "@teambit/issues": "1.0.235"
23
+ "@teambit/issues": "1.0.237"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@types/semver": "7.3.4",