@teambit/component-compare 1.0.950 → 1.0.951

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,5 +1,16 @@
1
1
  import type { Command, CommandOptions } from '@teambit/cli';
2
2
  import type { ComponentCompareMain } from './component-compare.main.runtime';
3
+ type DiffFlags = {
4
+ verbose?: boolean;
5
+ table?: boolean;
6
+ parent?: boolean;
7
+ file?: string;
8
+ filesOnly?: boolean;
9
+ configsOnly?: boolean;
10
+ nameOnly?: boolean;
11
+ stat?: boolean;
12
+ json?: boolean;
13
+ };
3
14
  export declare class DiffCmd implements Command {
4
15
  private componentCompareMain;
5
16
  name: string;
@@ -19,9 +30,29 @@ export declare class DiffCmd implements Command {
19
30
  }[];
20
31
  loader: boolean;
21
32
  constructor(componentCompareMain: ComponentCompareMain);
22
- report([pattern, version, toVersion]: [string, string, string], { verbose, table, parent }: {
23
- verbose?: boolean;
24
- table: boolean;
25
- parent?: boolean;
26
- }): Promise<string>;
33
+ report([pattern, version, toVersion]: [string, string, string], flags: DiffFlags): Promise<string>;
34
+ json([pattern, version, toVersion]: [string, string, string], flags: DiffFlags): Promise<{
35
+ id: string;
36
+ hasDiff: boolean;
37
+ filesDiff: ({
38
+ additions: number;
39
+ deletions: number;
40
+ filePath: string;
41
+ status: import("@teambit/legacy.component-diff/components-diff").DiffStatus;
42
+ diffOutput?: undefined;
43
+ } | {
44
+ filePath: string;
45
+ status: import("@teambit/legacy.component-diff/components-diff").DiffStatus;
46
+ diffOutput?: undefined;
47
+ } | {
48
+ filePath: string;
49
+ status: import("@teambit/legacy.component-diff/components-diff").DiffStatus;
50
+ diffOutput: string;
51
+ })[] | undefined;
52
+ fieldsDiff: import("@teambit/legacy.component-diff").FieldsDiff[] | null | undefined;
53
+ }[]>;
54
+ private projectFileDiffForJson;
55
+ private runDiff;
56
+ private parseOutputOpts;
27
57
  }
58
+ export {};
package/dist/diff-cmd.js CHANGED
@@ -11,6 +11,13 @@ function _chalk() {
11
11
  };
12
12
  return data;
13
13
  }
14
+ function _bitError() {
15
+ const data = require("@teambit/bit-error");
16
+ _bitError = function () {
17
+ return data;
18
+ };
19
+ return data;
20
+ }
14
21
  function _legacy() {
15
22
  const data = require("@teambit/legacy.constants");
16
23
  _legacy = function () {
@@ -26,6 +33,8 @@ function _legacy2() {
26
33
  return data;
27
34
  }
28
35
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
36
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
37
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
29
38
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
30
39
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
31
40
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
@@ -35,9 +44,11 @@ class DiffCmd {
35
44
  _defineProperty(this, "name", 'diff [component-pattern] [version] [to-version]');
36
45
  _defineProperty(this, "group", 'info-analysis');
37
46
  _defineProperty(this, "description", 'compare component changes between versions or against the current workspace');
38
- _defineProperty(this, "extendedDescription", `shows a detailed diff of component files, dependencies, and configuration changes.
47
+ _defineProperty(this, "extendedDescription", `shows a detailed diff of component files, dependencies, and configuration changes.
39
48
  by default, compares workspace changes against the latest version. specify versions to compare historical changes.
40
- supports pattern matching to filter components and various output formats for better readability.`);
49
+ supports pattern matching to filter components and various output formats for better readability.
50
+ for ai-agent workflows, use --name-only to list what changed, --file to drill into a specific file,
51
+ --files-only / --configs-only to focus on one diff category, or --json for machine-readable output.`);
41
52
  _defineProperty(this, "helpUrl", 'docs/components/merging-changes#compare-component-snaps');
42
53
  _defineProperty(this, "arguments", [{
43
54
  name: 'component-pattern',
@@ -51,7 +62,7 @@ supports pattern matching to filter components and various output formats for be
51
62
  if both "version" and "to-version" are provided, compare those two versions directly (ignoring the workspace).`
52
63
  }]);
53
64
  _defineProperty(this, "alias", '');
54
- _defineProperty(this, "options", [['p', 'parent', 'compare the specified "version" to its immediate parent instead of comparing to the current one'], ['v', 'verbose', 'show a more verbose output where possible'], ['t', 'table', 'show tables instead of plain text for dependencies diff']]);
65
+ _defineProperty(this, "options", [['p', 'parent', 'compare the specified "version" to its immediate parent instead of comparing to the current one'], ['v', 'verbose', 'show a more verbose output where possible'], ['t', 'table', 'show tables instead of plain text for dependencies diff'], ['', 'file <paths>', 'show only file diffs for the given component-relative path(s). comma-separated. implies --files-only'], ['', 'files-only', 'show only file-content diffs; omit dependency, env, and aspect-config changes'], ['', 'configs-only', 'show only dependency, env, and aspect-config changes; omit file-content diffs'], ['', 'name-only', 'summary: list changed files with status (M/A/D) and changed field categories; no diff bodies'], ['', 'stat', 'summary: like --name-only but includes +N -M line counts per file'], ['j', 'json', 'return the diff result as json']]);
55
66
  _defineProperty(this, "examples", [{
56
67
  cmd: 'diff',
57
68
  description: 'show diff for all modified components'
@@ -70,23 +81,99 @@ if both "version" and "to-version" are provided, compare those two versions dire
70
81
  }, {
71
82
  cmd: 'diff foo 0.0.2 --parent',
72
83
  description: 'compare "foo@0.0.2" to its parent version. showing what changed in 0.0.2'
84
+ }, {
85
+ cmd: 'diff foo --name-only',
86
+ description: 'list changed files and field categories without diff bodies'
87
+ }, {
88
+ cmd: 'diff foo --file src/index.ts',
89
+ description: 'show the diff of a single file in a component'
90
+ }, {
91
+ cmd: 'diff foo --files-only',
92
+ description: 'show only source-code diffs, skip dependency/config changes'
93
+ }, {
94
+ cmd: 'diff foo --json',
95
+ description: 'return the diff result as json for programmatic consumption'
73
96
  }]);
74
97
  _defineProperty(this, "loader", true);
75
98
  }
76
- async report([pattern, version, toVersion], {
99
+ async report([pattern, version, toVersion], flags) {
100
+ const outputOpts = this.parseOutputOpts(flags);
101
+ const diffResults = await this.runDiff([pattern, version, toVersion], flags);
102
+ if (!diffResults.length) {
103
+ return _chalk().default.yellow('there are no modified components to diff');
104
+ }
105
+ return (0, _legacy2().outputDiffResultsFormatted)(diffResults, outputOpts);
106
+ }
107
+ async json([pattern, version, toVersion], flags) {
108
+ const outputOpts = this.parseOutputOpts(flags);
109
+ const diffResults = await this.runDiff([pattern, version, toVersion], flags);
110
+ const filtered = (0, _legacy2().filterDiffResults)(diffResults, outputOpts);
111
+ return filtered.map(result => ({
112
+ id: result.id.toStringWithoutVersion(),
113
+ hasDiff: result.hasDiff,
114
+ filesDiff: result.filesDiff?.filter(fd => fd.status !== 'UNCHANGED' && fd.diffOutput).map(fd => this.projectFileDiffForJson(fd, outputOpts)),
115
+ fieldsDiff: result.fieldsDiff
116
+ }));
117
+ }
118
+ projectFileDiffForJson(fd, opts) {
119
+ const {
120
+ filePath,
121
+ status
122
+ } = fd;
123
+ if (opts.stat) {
124
+ return _objectSpread({
125
+ filePath,
126
+ status
127
+ }, (0, _legacy2().countDiffLines)(fd.diffOutput));
128
+ }
129
+ if (opts.nameOnly) {
130
+ return {
131
+ filePath,
132
+ status
133
+ };
134
+ }
135
+ return {
136
+ filePath,
137
+ status,
138
+ diffOutput: fd.diffOutput
139
+ };
140
+ }
141
+ async runDiff([pattern, version, toVersion], {
77
142
  verbose = false,
78
143
  table = false,
79
144
  parent
80
145
  }) {
81
- const diffResults = await this.componentCompareMain.diffByCLIValues(pattern, version, toVersion, {
146
+ return this.componentCompareMain.diffByCLIValues(pattern, version, toVersion, {
82
147
  verbose,
83
148
  table,
84
149
  parent
85
150
  });
86
- if (!diffResults.length) {
87
- return _chalk().default.yellow('there are no modified components to diff');
151
+ }
152
+ parseOutputOpts(flags) {
153
+ const {
154
+ file,
155
+ filesOnly,
156
+ configsOnly,
157
+ nameOnly,
158
+ stat
159
+ } = flags;
160
+ const files = file ? file.split(',').map(f => f.trim()).filter(Boolean) : undefined;
161
+ if (filesOnly && configsOnly) {
162
+ throw new (_bitError().BitError)('--files-only and --configs-only are mutually exclusive');
163
+ }
164
+ if (configsOnly && files && files.length) {
165
+ throw new (_bitError().BitError)('--file and --configs-only are mutually exclusive');
166
+ }
167
+ if (nameOnly && stat) {
168
+ throw new (_bitError().BitError)('--name-only and --stat are mutually exclusive');
88
169
  }
89
- return (0, _legacy2().outputDiffResults)(diffResults);
170
+ return {
171
+ filesOnly: filesOnly || Boolean(files && files.length),
172
+ configsOnly,
173
+ files,
174
+ nameOnly,
175
+ stat
176
+ };
90
177
  }
91
178
  }
92
179
  exports.DiffCmd = DiffCmd;
@@ -1 +1 @@
1
- {"version":3,"names":["_chalk","data","_interopRequireDefault","require","_legacy","_legacy2","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","DiffCmd","constructor","componentCompareMain","name","description","COMPONENT_PATTERN_HELP","cmd","report","pattern","version","toVersion","verbose","table","parent","diffResults","diffByCLIValues","length","chalk","yellow","outputDiffResults","exports"],"sources":["diff-cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport type { Command, CommandOptions } from '@teambit/cli';\nimport { COMPONENT_PATTERN_HELP } from '@teambit/legacy.constants';\nimport type { DiffResults } from '@teambit/legacy.component-diff';\nimport { outputDiffResults } from '@teambit/legacy.component-diff';\nimport type { ComponentCompareMain } from './component-compare.main.runtime';\n\nexport class DiffCmd implements Command {\n name = 'diff [component-pattern] [version] [to-version]';\n group = 'info-analysis';\n description = 'compare component changes between versions or against the current workspace';\n extendedDescription = `shows a detailed diff of component files, dependencies, and configuration changes. \nby default, compares workspace changes against the latest version. specify versions to compare historical changes.\nsupports pattern matching to filter components and various output formats for better readability.`;\n helpUrl = 'docs/components/merging-changes#compare-component-snaps';\n arguments = [\n {\n name: 'component-pattern',\n description: COMPONENT_PATTERN_HELP,\n },\n {\n name: 'version',\n description: `the base version to compare from. if omitted, compares the workspace's current files to the component's latest version.`,\n },\n {\n name: 'to-version',\n description: `the target version to compare against \"version\".\nif both \"version\" and \"to-version\" are provided, compare those two versions directly (ignoring the workspace).`,\n },\n ];\n alias = '';\n options = [\n ['p', 'parent', 'compare the specified \"version\" to its immediate parent instead of comparing to the current one'],\n ['v', 'verbose', 'show a more verbose output where possible'],\n ['t', 'table', 'show tables instead of plain text for dependencies diff'],\n ] as CommandOptions;\n examples = [\n { cmd: 'diff', description: 'show diff for all modified components' },\n { cmd: 'diff foo', description: 'show diff for a component \"foo\"' },\n { cmd: 'diff foo 0.0.1', description: 'show diff for a component \"foo\" from the current state to version 0.0.1' },\n { cmd: 'diff foo 0.0.1 0.0.2', description: 'show diff for a component \"foo\" from version 0.0.1 to version 0.0.2' },\n {\n cmd: \"diff '$codeModified' \",\n description: 'show diff only for components with modified files. ignore config changes',\n },\n {\n cmd: 'diff foo 0.0.2 --parent',\n description: 'compare \"foo@0.0.2\" to its parent version. showing what changed in 0.0.2',\n },\n ];\n loader = true;\n\n constructor(private componentCompareMain: ComponentCompareMain) {}\n\n async report(\n [pattern, version, toVersion]: [string, string, string],\n { verbose = false, table = false, parent }: { verbose?: boolean; table: boolean; parent?: boolean }\n ) {\n const diffResults: DiffResults[] = await this.componentCompareMain.diffByCLIValues(pattern, version, toVersion, {\n verbose,\n table,\n parent,\n });\n if (!diffResults.length) {\n return chalk.yellow('there are no modified components to diff');\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AAEC,OAAO,GAAG,KAAK;IAAEC,KAAK,GAAG,KAAK;IAAEC;EAAgE,CAAC,EACnG;IACA,MAAMC,WAA0B,GAAG,MAAM,IAAI,CAACZ,oBAAoB,CAACa,eAAe,CAACP,OAAO,EAAEC,OAAO,EAAEC,SAAS,EAAE;MAC9GC,OAAO;MACPC,KAAK;MACLC;IACF,CAAC,CAAC;IACF,IAAI,CAACC,WAAW,CAACE,MAAM,EAAE;MACvB,OAAOC,gBAAK,CAACC,MAAM,CAAC,0CAA0C,CAAC;IACjE;IACA,OAAO,IAAAC,4BAAiB,EAACL,WAAW,CAAC;EACvC;AACF;AAACM,OAAA,CAAApB,OAAA,GAAAA,OAAA","ignoreList":[]}
1
+ {"version":3,"names":["_chalk","data","_interopRequireDefault","require","_bitError","_legacy","_legacy2","e","__esModule","default","ownKeys","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","DiffCmd","constructor","componentCompareMain","name","description","COMPONENT_PATTERN_HELP","cmd","report","pattern","version","toVersion","flags","outputOpts","parseOutputOpts","diffResults","runDiff","chalk","yellow","outputDiffResultsFormatted","json","filtered","filterDiffResults","map","result","id","toStringWithoutVersion","hasDiff","filesDiff","fd","status","diffOutput","projectFileDiffForJson","fieldsDiff","opts","filePath","stat","countDiffLines","nameOnly","verbose","table","parent","diffByCLIValues","file","filesOnly","configsOnly","files","split","f","trim","Boolean","undefined","BitError","exports"],"sources":["diff-cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { BitError } from '@teambit/bit-error';\nimport type { Command, CommandOptions } from '@teambit/cli';\nimport { COMPONENT_PATTERN_HELP } from '@teambit/legacy.constants';\nimport type { DiffOutputOptions, DiffResults, FileDiff } from '@teambit/legacy.component-diff';\nimport { countDiffLines, filterDiffResults, outputDiffResultsFormatted } from '@teambit/legacy.component-diff';\nimport type { ComponentCompareMain } from './component-compare.main.runtime';\n\ntype DiffFlags = {\n verbose?: boolean;\n table?: boolean;\n parent?: boolean;\n file?: string;\n filesOnly?: boolean;\n configsOnly?: boolean;\n nameOnly?: boolean;\n stat?: boolean;\n json?: boolean;\n};\n\nexport class DiffCmd implements Command {\n name = 'diff [component-pattern] [version] [to-version]';\n group = 'info-analysis';\n description = 'compare component changes between versions or against the current workspace';\n extendedDescription = `shows a detailed diff of component files, dependencies, and configuration changes.\nby default, compares workspace changes against the latest version. specify versions to compare historical changes.\nsupports pattern matching to filter components and various output formats for better readability.\nfor ai-agent workflows, use --name-only to list what changed, --file to drill into a specific file,\n--files-only / --configs-only to focus on one diff category, or --json for machine-readable output.`;\n helpUrl = 'docs/components/merging-changes#compare-component-snaps';\n arguments = [\n {\n name: 'component-pattern',\n description: COMPONENT_PATTERN_HELP,\n },\n {\n name: 'version',\n description: `the base version to compare from. if omitted, compares the workspace's current files to the component's latest version.`,\n },\n {\n name: 'to-version',\n description: `the target version to compare against \"version\".\nif both \"version\" and \"to-version\" are provided, compare those two versions directly (ignoring the workspace).`,\n },\n ];\n alias = '';\n options = [\n ['p', 'parent', 'compare the specified \"version\" to its immediate parent instead of comparing to the current one'],\n ['v', 'verbose', 'show a more verbose output where possible'],\n ['t', 'table', 'show tables instead of plain text for dependencies diff'],\n [\n '',\n 'file <paths>',\n 'show only file diffs for the given component-relative path(s). comma-separated. implies --files-only',\n ],\n ['', 'files-only', 'show only file-content diffs; omit dependency, env, and aspect-config changes'],\n ['', 'configs-only', 'show only dependency, env, and aspect-config changes; omit file-content diffs'],\n ['', 'name-only', 'summary: list changed files with status (M/A/D) and changed field categories; no diff bodies'],\n ['', 'stat', 'summary: like --name-only but includes +N -M line counts per file'],\n ['j', 'json', 'return the diff result as json'],\n ] as CommandOptions;\n examples = [\n { cmd: 'diff', description: 'show diff for all modified components' },\n { cmd: 'diff foo', description: 'show diff for a component \"foo\"' },\n { cmd: 'diff foo 0.0.1', description: 'show diff for a component \"foo\" from the current state to version 0.0.1' },\n { cmd: 'diff foo 0.0.1 0.0.2', description: 'show diff for a component \"foo\" from version 0.0.1 to version 0.0.2' },\n {\n cmd: \"diff '$codeModified' \",\n description: 'show diff only for components with modified files. ignore config changes',\n },\n {\n cmd: 'diff foo 0.0.2 --parent',\n description: 'compare \"foo@0.0.2\" to its parent version. showing what changed in 0.0.2',\n },\n { cmd: 'diff foo --name-only', description: 'list changed files and field categories without diff bodies' },\n { cmd: 'diff foo --file src/index.ts', description: 'show the diff of a single file in a component' },\n { cmd: 'diff foo --files-only', description: 'show only source-code diffs, skip dependency/config changes' },\n { cmd: 'diff foo --json', description: 'return the diff result as json for programmatic consumption' },\n ];\n loader = true;\n\n constructor(private componentCompareMain: ComponentCompareMain) {}\n\n async report([pattern, version, toVersion]: [string, string, string], flags: DiffFlags) {\n const outputOpts = this.parseOutputOpts(flags);\n const diffResults = await this.runDiff([pattern, version, toVersion], flags);\n if (!diffResults.length) {\n return chalk.yellow('there are no modified components to diff');\n }\n return outputDiffResultsFormatted(diffResults, outputOpts);\n }\n\n async json([pattern, version, toVersion]: [string, string, string], flags: DiffFlags) {\n const outputOpts = this.parseOutputOpts(flags);\n const diffResults = await this.runDiff([pattern, version, toVersion], flags);\n const filtered = filterDiffResults(diffResults, outputOpts);\n return filtered.map((result) => ({\n id: result.id.toStringWithoutVersion(),\n hasDiff: result.hasDiff,\n filesDiff: result.filesDiff\n ?.filter((fd) => fd.status !== 'UNCHANGED' && fd.diffOutput)\n .map((fd) => this.projectFileDiffForJson(fd, outputOpts)),\n fieldsDiff: result.fieldsDiff,\n }));\n }\n\n private projectFileDiffForJson(fd: FileDiff, opts: DiffOutputOptions) {\n const { filePath, status } = fd;\n if (opts.stat) {\n return { filePath, status, ...countDiffLines(fd.diffOutput) };\n }\n if (opts.nameOnly) {\n return { filePath, status };\n }\n return { filePath, status, diffOutput: fd.diffOutput };\n }\n\n private async runDiff(\n [pattern, version, toVersion]: [string, string, string],\n { verbose = false, table = false, parent }: DiffFlags\n ): Promise<DiffResults[]> {\n return this.componentCompareMain.diffByCLIValues(pattern, version, toVersion, {\n verbose,\n table,\n parent,\n });\n }\n\n private parseOutputOpts(flags: DiffFlags): DiffOutputOptions {\n const { file, filesOnly, configsOnly, nameOnly, stat } = flags;\n const files = file\n ? file\n .split(',')\n .map((f) => f.trim())\n .filter(Boolean)\n : undefined;\n\n if (filesOnly && configsOnly) {\n throw new BitError('--files-only and --configs-only are mutually exclusive');\n }\n if (configsOnly && files && files.length) {\n throw new BitError('--file and --configs-only are mutually exclusive');\n }\n if (nameOnly && stat) {\n throw new BitError('--name-only and --stat are mutually exclusive');\n }\n\n return {\n filesOnly: filesOnly || Boolean(files && files.length),\n configsOnly,\n files,\n nameOnly,\n stat,\n };\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,UAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,SAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,QAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,OAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAK,SAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,QAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA+G,SAAAC,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,QAAAH,CAAA,EAAAI,CAAA,QAAAC,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;AAACiB,OAAA,CAAApD,OAAA,GAAAA,OAAA","ignoreList":[]}
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.component_component-compare@1.0.950/dist/component-compare.compositions.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.component_component-compare@1.0.950/dist/component-compare.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.component_component-compare@1.0.951/dist/component-compare.compositions.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.component_component-compare@1.0.951/dist/component-compare.docs.mdx';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/component-compare",
3
- "version": "1.0.950",
3
+ "version": "1.0.951",
4
4
  "homepage": "https://bit.cloud/teambit/component/component-compare",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.component",
8
8
  "name": "component-compare",
9
- "version": "1.0.950"
9
+ "version": "1.0.951"
10
10
  },
11
11
  "dependencies": {
12
12
  "graphql-tag": "2.12.1",
@@ -20,7 +20,6 @@
20
20
  "@teambit/bit-error": "0.0.404",
21
21
  "@teambit/cli": "0.0.1316",
22
22
  "@teambit/component-id": "1.2.4",
23
- "@teambit/legacy.component-diff": "0.0.161",
24
23
  "@teambit/legacy.consumer-component": "0.0.108",
25
24
  "@teambit/logger": "0.0.1409",
26
25
  "@teambit/component.ui.component-compare.changelog": "0.0.237",
@@ -28,17 +27,18 @@
28
27
  "@teambit/ui-foundation.ui.react-router.slot-router": "0.0.522",
29
28
  "@teambit/component.ui.component-compare.compare-aspects.compare-aspects": "0.0.155",
30
29
  "@teambit/legacy.constants": "0.0.26",
31
- "@teambit/component": "1.0.950",
32
- "@teambit/graphql": "1.0.950",
33
- "@teambit/builder": "1.0.950",
34
- "@teambit/dependency-resolver": "1.0.950",
35
- "@teambit/importer": "1.0.950",
36
- "@teambit/objects": "0.0.457",
37
- "@teambit/schema": "1.0.950",
38
- "@teambit/scope": "1.0.950",
39
- "@teambit/tester": "1.0.950",
40
- "@teambit/workspace": "1.0.950",
41
- "@teambit/ui": "1.0.950"
30
+ "@teambit/component": "1.0.951",
31
+ "@teambit/graphql": "1.0.951",
32
+ "@teambit/builder": "1.0.951",
33
+ "@teambit/dependency-resolver": "1.0.951",
34
+ "@teambit/importer": "1.0.951",
35
+ "@teambit/legacy.component-diff": "0.0.162",
36
+ "@teambit/objects": "0.0.458",
37
+ "@teambit/schema": "1.0.951",
38
+ "@teambit/scope": "1.0.951",
39
+ "@teambit/tester": "1.0.951",
40
+ "@teambit/workspace": "1.0.951",
41
+ "@teambit/ui": "1.0.951"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@types/lodash": "4.14.165",