@teambit/lanes.modules.diff 0.0.524 → 0.0.525

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/index.js CHANGED
@@ -1,10 +1,52 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LaneDiffGenerator = exports.LaneHistoryDiffCmd = exports.LaneDiffCmd = void 0;
4
- var lane_diff_cmd_1 = require("./lane-diff.cmd");
5
- Object.defineProperty(exports, "LaneDiffCmd", { enumerable: true, get: function () { return lane_diff_cmd_1.LaneDiffCmd; } });
6
- var lane_history_diff_cmd_1 = require("./lane-history-diff.cmd");
7
- Object.defineProperty(exports, "LaneHistoryDiffCmd", { enumerable: true, get: function () { return lane_history_diff_cmd_1.LaneHistoryDiffCmd; } });
8
- var lane_diff_generator_1 = require("./lane-diff-generator");
9
- Object.defineProperty(exports, "LaneDiffGenerator", { enumerable: true, get: function () { return lane_diff_generator_1.LaneDiffGenerator; } });
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "LaneDiffCmd", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _laneDiff().LaneDiffCmd;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "LaneDiffGenerator", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _laneDiffGenerator().LaneDiffGenerator;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "LaneDiffResults", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _laneDiffGenerator().LaneDiffResults;
22
+ }
23
+ });
24
+ Object.defineProperty(exports, "LaneHistoryDiffCmd", {
25
+ enumerable: true,
26
+ get: function () {
27
+ return _laneHistoryDiff().LaneHistoryDiffCmd;
28
+ }
29
+ });
30
+ function _laneDiff() {
31
+ const data = require("./lane-diff.cmd");
32
+ _laneDiff = function () {
33
+ return data;
34
+ };
35
+ return data;
36
+ }
37
+ function _laneHistoryDiff() {
38
+ const data = require("./lane-history-diff.cmd");
39
+ _laneHistoryDiff = function () {
40
+ return data;
41
+ };
42
+ return data;
43
+ }
44
+ function _laneDiffGenerator() {
45
+ const data = require("./lane-diff-generator");
46
+ _laneDiffGenerator = function () {
47
+ return data;
48
+ };
49
+ return data;
50
+ }
51
+
10
52
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;AAAA,iDAA8C;AAArC,4GAAA,WAAW,OAAA;AACpB,iEAA6D;AAApD,2HAAA,kBAAkB,OAAA;AAC3B,6DAA2E;AAAlE,wHAAA,iBAAiB,OAAA"}
1
+ {"version":3,"names":["_laneDiff","data","require","_laneHistoryDiff","_laneDiffGenerator"],"sources":["index.ts"],"sourcesContent":["export { LaneDiffCmd } from './lane-diff.cmd';\nexport { LaneHistoryDiffCmd } from './lane-history-diff.cmd';\nexport { LaneDiffGenerator, LaneDiffResults } from './lane-diff-generator';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAAA,UAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,SAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,iBAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,gBAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,mBAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,kBAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA","ignoreList":[]}
@@ -1,296 +1,336 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
15
6
  exports.LaneDiffGenerator = void 0;
16
- const objects_1 = require("@teambit/objects");
17
- const component_id_1 = require("@teambit/component-id");
18
- const legacy_component_diff_1 = require("@teambit/legacy.component-diff");
19
- const lane_id_1 = require("@teambit/lane-id");
20
- const bit_error_1 = require("@teambit/bit-error");
21
- const chalk_1 = __importDefault(require("chalk"));
7
+ function _objects() {
8
+ const data = require("@teambit/objects");
9
+ _objects = function () {
10
+ return data;
11
+ };
12
+ return data;
13
+ }
14
+ function _componentId() {
15
+ const data = require("@teambit/component-id");
16
+ _componentId = function () {
17
+ return data;
18
+ };
19
+ return data;
20
+ }
21
+ function _legacy() {
22
+ const data = require("@teambit/legacy.component-diff");
23
+ _legacy = function () {
24
+ return data;
25
+ };
26
+ return data;
27
+ }
28
+ function _laneId() {
29
+ const data = require("@teambit/lane-id");
30
+ _laneId = function () {
31
+ return data;
32
+ };
33
+ return data;
34
+ }
35
+ function _bitError() {
36
+ const data = require("@teambit/bit-error");
37
+ _bitError = function () {
38
+ return data;
39
+ };
40
+ return data;
41
+ }
42
+ function _chalk() {
43
+ const data = _interopRequireDefault(require("chalk"));
44
+ _chalk = function () {
45
+ return data;
46
+ };
47
+ return data;
48
+ }
49
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
22
50
  class LaneDiffGenerator {
23
- constructor(workspace, scope, componentCompare) {
24
- this.workspace = workspace;
25
- this.scope = scope;
26
- this.componentCompare = componentCompare;
27
- this.newCompsFrom = [];
28
- this.newCompsTo = [];
29
- this.compsWithDiff = [];
30
- this.compsWithNoChanges = [];
31
- this.failures = [];
51
+ newCompsFrom = [];
52
+ newCompsTo = [];
53
+ compsWithDiff = [];
54
+ compsWithNoChanges = [];
55
+ failures = [];
56
+ constructor(workspace, scope, componentCompare) {
57
+ this.workspace = workspace;
58
+ this.scope = scope;
59
+ this.componentCompare = componentCompare;
60
+ }
61
+
62
+ /**
63
+ * the values array may include zero to two values and will be processed as following:
64
+ * [] => diff between the default lane (from) and the current lane (to). (only inside workspace).
65
+ * [to] => diff between the current lane (or default-lane when in scope) and "to" lane.
66
+ * [from, to] => diff between "from" lane and "to" lane.
67
+ */
68
+ async generate(values, diffOptions = {}, pattern) {
69
+ const {
70
+ fromLaneName,
71
+ toLaneName
72
+ } = this.getLaneNames(values);
73
+ if (fromLaneName === toLaneName) {
74
+ throw new Error(`unable to run diff between "${fromLaneName}" and "${toLaneName}", they're the same lane`);
32
75
  }
33
- /**
34
- * the values array may include zero to two values and will be processed as following:
35
- * [] => diff between the default lane (from) and the current lane (to). (only inside workspace).
36
- * [to] => diff between the current lane (or default-lane when in scope) and "to" lane.
37
- * [from, to] => diff between "from" lane and "to" lane.
38
- */
39
- generate(values_1) {
40
- return __awaiter(this, arguments, void 0, function* (values, diffOptions = {}, pattern) {
41
- const { fromLaneName, toLaneName } = this.getLaneNames(values);
42
- if (fromLaneName === toLaneName) {
43
- throw new Error(`unable to run diff between "${fromLaneName}" and "${toLaneName}", they're the same lane`);
44
- }
45
- const legacyScope = this.scope.legacyScope;
46
- const fromLaneId = yield legacyScope.lanes.parseLaneIdFromString(fromLaneName);
47
- const toLaneId = yield legacyScope.lanes.parseLaneIdFromString(toLaneName);
48
- let toLane;
49
- let fromLane;
50
- if (fromLaneId.isDefault()) {
51
- if (toLaneId.isDefault())
52
- throw new Error(`unable to diff between main and main, they're the same lane`);
53
- toLane = yield legacyScope.lanes.loadLane(toLaneId);
54
- if (!toLane)
55
- throw new Error(`unable to find a lane "${toLaneName}" in the scope`);
56
- this.toLaneData = yield this.mapToLaneData(toLane);
57
- const bitIds = toLane.components.map((c) => c.id);
58
- this.fromLaneData = yield this.getDefaultLaneData(bitIds);
59
- }
60
- else if (toLaneId.isDefault()) {
61
- fromLane = yield legacyScope.lanes.loadLane(fromLaneId);
62
- if (!fromLane)
63
- throw new Error(`unable to find a lane "${fromLaneName}" in the scope`);
64
- this.fromLaneData = yield this.mapToLaneData(fromLane);
65
- const bitIds = (fromLane === null || fromLane === void 0 ? void 0 : fromLane.components.map((c) => c.id)) || [];
66
- this.toLaneData = yield this.getDefaultLaneData(bitIds);
67
- }
68
- else {
69
- // both, "from" and "to" are not default-lane.
70
- toLane = yield legacyScope.lanes.loadLane(toLaneId);
71
- if (!toLane)
72
- throw new Error(`unable to find a lane "${toLaneName}" in the scope`);
73
- fromLane = yield legacyScope.lanes.loadLane(fromLaneId);
74
- if (!fromLane)
75
- throw new Error(`unable to find a lane "${fromLaneName}" in the scope`);
76
- this.toLaneData = yield this.mapToLaneData(toLane);
77
- this.fromLaneData = yield this.mapToLaneData(fromLane);
78
- }
79
- let idsToCheckDiff;
80
- if (pattern) {
81
- const compIds = this.toLaneData.components.map((c) => c.id);
82
- idsToCheckDiff = component_id_1.ComponentIdList.fromArray(yield this.scope.filterIdsFromPoolIdsByPattern(pattern, compIds));
83
- }
84
- if (!this.toLaneData.components.length) {
85
- throw new bit_error_1.BitError(`lane "${toLaneName}" is empty, nothing to show`);
86
- }
87
- const idsOfTo = component_id_1.ComponentIdList.fromArray(this.toLaneData.components.map((c) => { var _a; return c.id.changeVersion((_a = c.head) === null || _a === void 0 ? void 0 : _a.toString()); }));
88
- yield this.scope.legacyScope.scopeImporter.importWithoutDeps(idsOfTo, {
89
- cache: true,
90
- lane: toLane || undefined,
91
- ignoreMissingHead: true,
92
- reason: `for the "to" diff - ${toLane ? toLane.name : lane_id_1.DEFAULT_LANE}`,
93
- });
94
- const idsOfFrom = component_id_1.ComponentIdList.fromArray(this.fromLaneData.components.map((c) => { var _a; return c.id.changeVersion((_a = c.head) === null || _a === void 0 ? void 0 : _a.toString()); }));
95
- yield this.scope.legacyScope.scopeImporter.importWithoutDeps(idsOfFrom, {
96
- cache: true,
97
- lane: fromLane || undefined,
98
- ignoreMissingHead: true,
99
- reason: `for the "from" diff - ${fromLane ? fromLane.name : lane_id_1.DEFAULT_LANE}`,
100
- });
101
- yield Promise.all(this.toLaneData.components.map((_a) => __awaiter(this, [_a], void 0, function* ({ id, head }) {
102
- if (idsToCheckDiff && !idsToCheckDiff.hasWithoutVersion(id)) {
103
- return;
104
- }
105
- yield this.componentDiff(id, head, diffOptions, true);
106
- })));
107
- return {
108
- newCompsFrom: this.newCompsFrom.map((id) => id.toString()),
109
- newCompsTo: this.newCompsTo.map((id) => id.toString()),
110
- compsWithDiff: this.compsWithDiff,
111
- compsWithNoChanges: this.compsWithNoChanges.map((id) => id.toString()),
112
- toLaneName: this.toLaneData.name,
113
- fromLaneName: this.fromLaneData.name,
114
- failures: this.failures,
115
- };
116
- });
76
+ const legacyScope = this.scope.legacyScope;
77
+ const fromLaneId = await legacyScope.lanes.parseLaneIdFromString(fromLaneName);
78
+ const toLaneId = await legacyScope.lanes.parseLaneIdFromString(toLaneName);
79
+ let toLane;
80
+ let fromLane;
81
+ if (fromLaneId.isDefault()) {
82
+ if (toLaneId.isDefault()) throw new Error(`unable to diff between main and main, they're the same lane`);
83
+ toLane = await legacyScope.lanes.loadLane(toLaneId);
84
+ if (!toLane) throw new Error(`unable to find a lane "${toLaneName}" in the scope`);
85
+ this.toLaneData = await this.mapToLaneData(toLane);
86
+ const bitIds = toLane.components.map(c => c.id);
87
+ this.fromLaneData = await this.getDefaultLaneData(bitIds);
88
+ } else if (toLaneId.isDefault()) {
89
+ fromLane = await legacyScope.lanes.loadLane(fromLaneId);
90
+ if (!fromLane) throw new Error(`unable to find a lane "${fromLaneName}" in the scope`);
91
+ this.fromLaneData = await this.mapToLaneData(fromLane);
92
+ const bitIds = fromLane?.components.map(c => c.id) || [];
93
+ this.toLaneData = await this.getDefaultLaneData(bitIds);
94
+ } else {
95
+ // both, "from" and "to" are not default-lane.
96
+ toLane = await legacyScope.lanes.loadLane(toLaneId);
97
+ if (!toLane) throw new Error(`unable to find a lane "${toLaneName}" in the scope`);
98
+ fromLane = await legacyScope.lanes.loadLane(fromLaneId);
99
+ if (!fromLane) throw new Error(`unable to find a lane "${fromLaneName}" in the scope`);
100
+ this.toLaneData = await this.mapToLaneData(toLane);
101
+ this.fromLaneData = await this.mapToLaneData(fromLane);
117
102
  }
118
- generateDiffHistory(lane, laneHistory, fromHistoryId, toHistoryId, pattern) {
119
- return __awaiter(this, void 0, void 0, function* () {
120
- const laneId = lane.toLaneId();
121
- const history = laneHistory.getHistory();
122
- const fromLane = history[fromHistoryId];
123
- const toLane = history[toHistoryId];
124
- if (!fromLane)
125
- throw new Error(`unable to find the from-history-id "${fromHistoryId}" in lane "${laneId.toString()}"`);
126
- if (!toLane)
127
- throw new Error(`unable to find the to-history-id "${toHistoryId}" in lane "${laneId.toString()}"`);
128
- this.fromLaneData = this.mapHistoryToLaneData(laneId, fromHistoryId, fromLane);
129
- this.toLaneData = this.mapHistoryToLaneData(laneId, toHistoryId, toLane);
130
- let idsToCheckDiff;
131
- if (pattern) {
132
- const compIds = this.toLaneData.components.map((c) => c.id);
133
- idsToCheckDiff = component_id_1.ComponentIdList.fromArray(yield this.scope.filterIdsFromPoolIdsByPattern(pattern, compIds));
134
- }
135
- if (!this.toLaneData.components.length) {
136
- throw new bit_error_1.BitError(`lane-history "${toHistoryId}" is empty, nothing to show`);
137
- }
138
- const idsOfTo = component_id_1.ComponentIdList.fromArray(this.toLaneData.components.map((c) => { var _a; return c.id.changeVersion((_a = c.head) === null || _a === void 0 ? void 0 : _a.toString()); }));
139
- yield this.scope.legacyScope.scopeImporter.importWithoutDeps(idsOfTo, {
140
- cache: true,
141
- lane,
142
- ignoreMissingHead: true,
143
- reason: `for the "to" diff - ${laneId.toString()}-${toHistoryId}`,
144
- });
145
- const idsOfFrom = component_id_1.ComponentIdList.fromArray(this.fromLaneData.components.map((c) => { var _a; return c.id.changeVersion((_a = c.head) === null || _a === void 0 ? void 0 : _a.toString()); }));
146
- yield this.scope.legacyScope.scopeImporter.importWithoutDeps(idsOfFrom, {
147
- cache: true,
148
- lane,
149
- ignoreMissingHead: true,
150
- reason: `for the "from" diff - ${laneId.toString()}-${fromHistoryId}`,
151
- });
152
- yield Promise.all(this.toLaneData.components.map((_a) => __awaiter(this, [_a], void 0, function* ({ id, head }) {
153
- if (idsToCheckDiff && !idsToCheckDiff.hasWithoutVersion(id)) {
154
- return;
155
- }
156
- yield this.componentDiff(id, head);
157
- })));
158
- return {
159
- newCompsFrom: this.newCompsFrom.map((id) => id.toString()),
160
- newCompsTo: this.newCompsTo.map((id) => id.toString()),
161
- compsWithDiff: this.compsWithDiff,
162
- compsWithNoChanges: this.compsWithNoChanges.map((id) => id.toString()),
163
- toLaneName: this.toLaneData.name,
164
- fromLaneName: this.fromLaneData.name,
165
- failures: this.failures,
166
- };
167
- });
103
+ let idsToCheckDiff;
104
+ if (pattern) {
105
+ const compIds = this.toLaneData.components.map(c => c.id);
106
+ idsToCheckDiff = _componentId().ComponentIdList.fromArray(await this.scope.filterIdsFromPoolIdsByPattern(pattern, compIds));
168
107
  }
169
- laneDiffResultsToString(laneDiffResults) {
170
- const { compsWithDiff, newCompsFrom, newCompsTo, toLaneName, fromLaneName, failures } = laneDiffResults;
171
- const newCompsOutput = (laneName, ids) => {
172
- if (!ids.length)
173
- return '';
174
- const newCompsIdsStr = ids.map((id) => chalk_1.default.bold(id)).join('\n');
175
- const newCompsTitle = `\nThe following components were introduced in ${chalk_1.default.bold(laneName)} lane`;
176
- return `${chalk_1.default.inverse(newCompsTitle)}\n${newCompsIdsStr}`;
177
- };
178
- const diffResultsStr = (0, legacy_component_diff_1.outputDiffResults)(compsWithDiff);
179
- const failuresTitle = `\n\nDiff failed on the following component(s)`;
180
- const failuresIds = failures.map((f) => `${f.id.toString()} - ${chalk_1.default.red(f.msg)}`).join('\n');
181
- const failuresStr = failures.length ? `${chalk_1.default.inverse(failuresTitle)}\n${failuresIds}` : '';
182
- const newCompsToStr = newCompsOutput(toLaneName, newCompsTo);
183
- const newCompsFromStr = newCompsOutput(fromLaneName, newCompsFrom);
184
- return `${diffResultsStr}${newCompsToStr}${newCompsFromStr}${failuresStr}`;
108
+ if (!this.toLaneData.components.length) {
109
+ throw new (_bitError().BitError)(`lane "${toLaneName}" is empty, nothing to show`);
185
110
  }
186
- componentDiff(id_1, toLaneHead_1) {
187
- return __awaiter(this, arguments, void 0, function* (id, toLaneHead, diffOptions = {}, compareToHeadIfEmpty = false) {
188
- var _a;
189
- const modelComponent = yield this.scope.legacyScope.getModelComponent(id);
190
- const foundFromLane = (_a = this.fromLaneData.components.find((c) => c.id.isEqualWithoutVersion(id))) === null || _a === void 0 ? void 0 : _a.head;
191
- const fromLaneHead = compareToHeadIfEmpty ? foundFromLane || modelComponent.head : foundFromLane;
192
- if (!fromLaneHead) {
193
- this.newCompsTo.push(id);
194
- return;
195
- }
196
- if (!toLaneHead) {
197
- this.newCompsFrom.push(id);
198
- return;
199
- }
200
- if (fromLaneHead.isEqual(toLaneHead)) {
201
- this.compsWithNoChanges.push(id);
202
- return;
203
- }
204
- let fromVersion;
205
- try {
206
- fromVersion = yield modelComponent.loadVersion(fromLaneHead.toString(), this.scope.legacyScope.objects, true);
207
- }
208
- catch (err) {
209
- this.failures.push({ id, msg: err.message });
210
- return;
211
- }
212
- const toVersion = yield toLaneHead.load(this.scope.legacyScope.objects);
213
- const fromLaneStr = this.fromLaneData.name;
214
- diffOptions.formatDepsAsTable = false;
215
- const diff = yield this.componentCompare.diffBetweenVersionsObjects(modelComponent, fromVersion, toVersion, fromLaneStr, this.toLaneData.name, diffOptions);
216
- this.compsWithDiff.push(diff);
217
- });
111
+ const idsOfTo = _componentId().ComponentIdList.fromArray(this.toLaneData.components.map(c => c.id.changeVersion(c.head?.toString())));
112
+ await this.scope.legacyScope.scopeImporter.importWithoutDeps(idsOfTo, {
113
+ cache: true,
114
+ lane: toLane || undefined,
115
+ ignoreMissingHead: true,
116
+ reason: `for the "to" diff - ${toLane ? toLane.name : _laneId().DEFAULT_LANE}`
117
+ });
118
+ const idsOfFrom = _componentId().ComponentIdList.fromArray(this.fromLaneData.components.map(c => c.id.changeVersion(c.head?.toString())));
119
+ await this.scope.legacyScope.scopeImporter.importWithoutDeps(idsOfFrom, {
120
+ cache: true,
121
+ lane: fromLane || undefined,
122
+ ignoreMissingHead: true,
123
+ reason: `for the "from" diff - ${fromLane ? fromLane.name : _laneId().DEFAULT_LANE}`
124
+ });
125
+ await Promise.all(this.toLaneData.components.map(async ({
126
+ id,
127
+ head
128
+ }) => {
129
+ if (idsToCheckDiff && !idsToCheckDiff.hasWithoutVersion(id)) {
130
+ return;
131
+ }
132
+ await this.componentDiff(id, head, diffOptions, true);
133
+ }));
134
+ return {
135
+ newCompsFrom: this.newCompsFrom.map(id => id.toString()),
136
+ newCompsTo: this.newCompsTo.map(id => id.toString()),
137
+ compsWithDiff: this.compsWithDiff,
138
+ compsWithNoChanges: this.compsWithNoChanges.map(id => id.toString()),
139
+ toLaneName: this.toLaneData.name,
140
+ fromLaneName: this.fromLaneData.name,
141
+ failures: this.failures
142
+ };
143
+ }
144
+ async generateDiffHistory(lane, laneHistory, fromHistoryId, toHistoryId, pattern) {
145
+ const laneId = lane.toLaneId();
146
+ const history = laneHistory.getHistory();
147
+ const fromLane = history[fromHistoryId];
148
+ const toLane = history[toHistoryId];
149
+ if (!fromLane) throw new Error(`unable to find the from-history-id "${fromHistoryId}" in lane "${laneId.toString()}"`);
150
+ if (!toLane) throw new Error(`unable to find the to-history-id "${toHistoryId}" in lane "${laneId.toString()}"`);
151
+ this.fromLaneData = this.mapHistoryToLaneData(laneId, fromHistoryId, fromLane);
152
+ this.toLaneData = this.mapHistoryToLaneData(laneId, toHistoryId, toLane);
153
+ let idsToCheckDiff;
154
+ if (pattern) {
155
+ const compIds = this.toLaneData.components.map(c => c.id);
156
+ idsToCheckDiff = _componentId().ComponentIdList.fromArray(await this.scope.filterIdsFromPoolIdsByPattern(pattern, compIds));
218
157
  }
219
- getLaneNames(values) {
220
- if (values.length > 2) {
221
- throw new Error(`expect "values" to include no more than two args, got ${values.length}`);
222
- }
223
- if (this.workspace) {
224
- const currentLane = this.workspace.getCurrentLaneId();
225
- if (!values.length) {
226
- if (currentLane.isDefault()) {
227
- throw new Error(`you are currently on the default branch, to run diff between lanes, please specify them`);
228
- }
229
- return { toLaneName: currentLane.name, fromLaneName: lane_id_1.DEFAULT_LANE };
230
- }
231
- if (values.length === 1) {
232
- const toLaneName = currentLane.isDefault() ? lane_id_1.DEFAULT_LANE : currentLane.name;
233
- return { toLaneName, fromLaneName: values[0] };
234
- }
235
- return { toLaneName: values[1], fromLaneName: values[0] };
236
- }
237
- // running from the scope
238
- if (values.length < 1) {
239
- throw new Error(`expect "values" to include at least one arg - the lane name`);
240
- }
241
- const fromLaneName = values.length === 2 ? values[0] : lane_id_1.DEFAULT_LANE;
242
- const toLaneName = values.length === 2 ? values[1] : values[0];
243
- return { fromLaneName, toLaneName };
158
+ if (!this.toLaneData.components.length) {
159
+ throw new (_bitError().BitError)(`lane-history "${toHistoryId}" is empty, nothing to show`);
160
+ }
161
+ const idsOfTo = _componentId().ComponentIdList.fromArray(this.toLaneData.components.map(c => c.id.changeVersion(c.head?.toString())));
162
+ await this.scope.legacyScope.scopeImporter.importWithoutDeps(idsOfTo, {
163
+ cache: true,
164
+ lane,
165
+ ignoreMissingHead: true,
166
+ reason: `for the "to" diff - ${laneId.toString()}-${toHistoryId}`
167
+ });
168
+ const idsOfFrom = _componentId().ComponentIdList.fromArray(this.fromLaneData.components.map(c => c.id.changeVersion(c.head?.toString())));
169
+ await this.scope.legacyScope.scopeImporter.importWithoutDeps(idsOfFrom, {
170
+ cache: true,
171
+ lane,
172
+ ignoreMissingHead: true,
173
+ reason: `for the "from" diff - ${laneId.toString()}-${fromHistoryId}`
174
+ });
175
+ await Promise.all(this.toLaneData.components.map(async ({
176
+ id,
177
+ head
178
+ }) => {
179
+ if (idsToCheckDiff && !idsToCheckDiff.hasWithoutVersion(id)) {
180
+ return;
181
+ }
182
+ await this.componentDiff(id, head);
183
+ }));
184
+ return {
185
+ newCompsFrom: this.newCompsFrom.map(id => id.toString()),
186
+ newCompsTo: this.newCompsTo.map(id => id.toString()),
187
+ compsWithDiff: this.compsWithDiff,
188
+ compsWithNoChanges: this.compsWithNoChanges.map(id => id.toString()),
189
+ toLaneName: this.toLaneData.name,
190
+ fromLaneName: this.fromLaneData.name,
191
+ failures: this.failures
192
+ };
193
+ }
194
+ laneDiffResultsToString(laneDiffResults) {
195
+ const {
196
+ compsWithDiff,
197
+ newCompsFrom,
198
+ newCompsTo,
199
+ toLaneName,
200
+ fromLaneName,
201
+ failures
202
+ } = laneDiffResults;
203
+ const newCompsOutput = (laneName, ids) => {
204
+ if (!ids.length) return '';
205
+ const newCompsIdsStr = ids.map(id => _chalk().default.bold(id)).join('\n');
206
+ const newCompsTitle = `\nThe following components were introduced in ${_chalk().default.bold(laneName)} lane`;
207
+ return `${_chalk().default.inverse(newCompsTitle)}\n${newCompsIdsStr}`;
208
+ };
209
+ const diffResultsStr = (0, _legacy().outputDiffResults)(compsWithDiff);
210
+ const failuresTitle = `\n\nDiff failed on the following component(s)`;
211
+ const failuresIds = failures.map(f => `${f.id.toString()} - ${_chalk().default.red(f.msg)}`).join('\n');
212
+ const failuresStr = failures.length ? `${_chalk().default.inverse(failuresTitle)}\n${failuresIds}` : '';
213
+ const newCompsToStr = newCompsOutput(toLaneName, newCompsTo);
214
+ const newCompsFromStr = newCompsOutput(fromLaneName, newCompsFrom);
215
+ return `${diffResultsStr}${newCompsToStr}${newCompsFromStr}${failuresStr}`;
216
+ }
217
+ async componentDiff(id, toLaneHead, diffOptions = {}, compareToHeadIfEmpty = false) {
218
+ const modelComponent = await this.scope.legacyScope.getModelComponent(id);
219
+ const foundFromLane = this.fromLaneData.components.find(c => c.id.isEqualWithoutVersion(id))?.head;
220
+ const fromLaneHead = compareToHeadIfEmpty ? foundFromLane || modelComponent.head : foundFromLane;
221
+ if (!fromLaneHead) {
222
+ this.newCompsTo.push(id);
223
+ return;
224
+ }
225
+ if (!toLaneHead) {
226
+ this.newCompsFrom.push(id);
227
+ return;
228
+ }
229
+ if (fromLaneHead.isEqual(toLaneHead)) {
230
+ this.compsWithNoChanges.push(id);
231
+ return;
244
232
  }
245
- getDefaultLaneData(ids) {
246
- return __awaiter(this, void 0, void 0, function* () {
247
- const laneData = {
248
- name: lane_id_1.DEFAULT_LANE,
249
- remote: null,
250
- components: [],
251
- };
252
- yield Promise.all(ids.map((id) => __awaiter(this, void 0, void 0, function* () {
253
- const modelComponent = yield this.scope.legacyScope.getModelComponent(id);
254
- const laneComponent = {
255
- id,
256
- head: modelComponent.head, // @todo: this is not true. it can be undefined
257
- version: modelComponent.latestVersion(), // should this be latestVersion() or bitId.version.toString()
258
- };
259
- laneData.components.push(laneComponent);
260
- })));
261
- return laneData;
262
- });
233
+ let fromVersion;
234
+ try {
235
+ fromVersion = await modelComponent.loadVersion(fromLaneHead.toString(), this.scope.legacyScope.objects, true);
236
+ } catch (err) {
237
+ this.failures.push({
238
+ id,
239
+ msg: err.message
240
+ });
241
+ return;
263
242
  }
264
- mapToLaneData(lane) {
265
- return __awaiter(this, void 0, void 0, function* () {
266
- const { name, components } = lane;
267
- return {
268
- name,
269
- components: components.map((lc) => {
270
- var _a;
271
- return ({
272
- id: lc.id,
273
- head: lc.head,
274
- version: (_a = lc.id.version) === null || _a === void 0 ? void 0 : _a.toString(),
275
- });
276
- }),
277
- remote: lane.toLaneId().toString(),
278
- };
279
- });
243
+ const toVersion = await toLaneHead.load(this.scope.legacyScope.objects);
244
+ const fromLaneStr = this.fromLaneData.name;
245
+ diffOptions.formatDepsAsTable = false;
246
+ const diff = await this.componentCompare.diffBetweenVersionsObjects(modelComponent, fromVersion, toVersion, fromLaneStr, this.toLaneData.name, diffOptions);
247
+ this.compsWithDiff.push(diff);
248
+ }
249
+ getLaneNames(values) {
250
+ if (values.length > 2) {
251
+ throw new Error(`expect "values" to include no more than two args, got ${values.length}`);
280
252
  }
281
- mapHistoryToLaneData(laneId, historyId, historyItem) {
253
+ if (this.workspace) {
254
+ const currentLane = this.workspace.getCurrentLaneId();
255
+ if (!values.length) {
256
+ if (currentLane.isDefault()) {
257
+ throw new Error(`you are currently on the default branch, to run diff between lanes, please specify them`);
258
+ }
259
+ return {
260
+ toLaneName: currentLane.name,
261
+ fromLaneName: _laneId().DEFAULT_LANE
262
+ };
263
+ }
264
+ if (values.length === 1) {
265
+ const toLaneName = currentLane.isDefault() ? _laneId().DEFAULT_LANE : currentLane.name;
282
266
  return {
283
- name: historyId,
284
- components: historyItem.components.map((compStr) => {
285
- const compId = component_id_1.ComponentID.fromString(compStr);
286
- return {
287
- id: compId.changeVersion(undefined),
288
- head: objects_1.Ref.from(compId.version),
289
- };
290
- }),
291
- remote: laneId.toString(),
267
+ toLaneName,
268
+ fromLaneName: values[0]
292
269
  };
270
+ }
271
+ return {
272
+ toLaneName: values[1],
273
+ fromLaneName: values[0]
274
+ };
293
275
  }
276
+ // running from the scope
277
+ if (values.length < 1) {
278
+ throw new Error(`expect "values" to include at least one arg - the lane name`);
279
+ }
280
+ const fromLaneName = values.length === 2 ? values[0] : _laneId().DEFAULT_LANE;
281
+ const toLaneName = values.length === 2 ? values[1] : values[0];
282
+ return {
283
+ fromLaneName,
284
+ toLaneName
285
+ };
286
+ }
287
+ async getDefaultLaneData(ids) {
288
+ const laneData = {
289
+ name: _laneId().DEFAULT_LANE,
290
+ remote: null,
291
+ components: []
292
+ };
293
+ await Promise.all(ids.map(async id => {
294
+ const modelComponent = await this.scope.legacyScope.getModelComponent(id);
295
+ const laneComponent = {
296
+ id,
297
+ head: modelComponent.head,
298
+ // @todo: this is not true. it can be undefined
299
+ version: modelComponent.latestVersion() // should this be latestVersion() or bitId.version.toString()
300
+ };
301
+ laneData.components.push(laneComponent);
302
+ }));
303
+ return laneData;
304
+ }
305
+ async mapToLaneData(lane) {
306
+ const {
307
+ name,
308
+ components
309
+ } = lane;
310
+ return {
311
+ name,
312
+ components: components.map(lc => ({
313
+ id: lc.id,
314
+ head: lc.head,
315
+ version: lc.id.version?.toString()
316
+ })),
317
+ remote: lane.toLaneId().toString()
318
+ };
319
+ }
320
+ mapHistoryToLaneData(laneId, historyId, historyItem) {
321
+ return {
322
+ name: historyId,
323
+ components: historyItem.components.map(compStr => {
324
+ const compId = _componentId().ComponentID.fromString(compStr);
325
+ return {
326
+ id: compId.changeVersion(undefined),
327
+ head: _objects().Ref.from(compId.version)
328
+ };
329
+ }),
330
+ remote: laneId.toString()
331
+ };
332
+ }
294
333
  }
295
334
  exports.LaneDiffGenerator = LaneDiffGenerator;
335
+
296
336
  //# sourceMappingURL=lane-diff-generator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"lane-diff-generator.js","sourceRoot":"","sources":["../lane-diff-generator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAEA,8CAAgF;AAChF,wDAAqE;AACrE,0EAA6F;AAC7F,8CAAwD;AACxD,kDAA8C;AAE9C,kDAA0B;AAuB1B,MAAa,iBAAiB;IAQ5B,YACU,SAAgC,EAChC,KAAgB,EAChB,gBAAsC;QAFtC,cAAS,GAAT,SAAS,CAAuB;QAChC,UAAK,GAAL,KAAK,CAAW;QAChB,qBAAgB,GAAhB,gBAAgB,CAAsB;QAVxC,iBAAY,GAAkB,EAAE,CAAC;QACjC,eAAU,GAAkB,EAAE,CAAC;QAC/B,kBAAa,GAAkB,EAAE,CAAC;QAClC,uBAAkB,GAAkB,EAAE,CAAC;QAGvC,aAAQ,GAAc,EAAE,CAAC;IAK9B,CAAC;IAEJ;;;;;OAKG;IACG,QAAQ;6DAAC,MAAgB,EAAE,cAA2B,EAAE,EAAE,OA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AAU,CAAC,OAAO,CAAC,CAAC;gBAC/C,OAAO;oBACL,EAAE,EAAE,MAAM,CAAC,aAAa,CAAC,SAAS,CAAC;oBACnC,IAAI,EAAE,aAAG,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC;iBAC/B,CAAC;YACJ,CAAC,CAAC;YACF,MAAM,EAAE,MAAM,CAAC,QAAQ,EAAE;SAC1B,CAAC;IACJ,CAAC;CACF;AApTD,8CAoTC"}
1
+ {"version":3,"names":["_objects","data","require","_componentId","_legacy","_laneId","_bitError","_chalk","_interopRequireDefault","e","__esModule","default","LaneDiffGenerator","newCompsFrom","newCompsTo","compsWithDiff","compsWithNoChanges","failures","constructor","workspace","scope","componentCompare","generate","values","diffOptions","pattern","fromLaneName","toLaneName","getLaneNames","Error","legacyScope","fromLaneId","lanes","parseLaneIdFromString","toLaneId","toLane","fromLane","isDefault","loadLane","toLaneData","mapToLaneData","bitIds","components","map","c","id","fromLaneData","getDefaultLaneData","idsToCheckDiff","compIds","ComponentIdList","fromArray","filterIdsFromPoolIdsByPattern","length","BitError","idsOfTo","changeVersion","head","toString","scopeImporter","importWithoutDeps","cache","lane","undefined","ignoreMissingHead","reason","name","DEFAULT_LANE","idsOfFrom","Promise","all","hasWithoutVersion","componentDiff","generateDiffHistory","laneHistory","fromHistoryId","toHistoryId","laneId","history","getHistory","mapHistoryToLaneData","laneDiffResultsToString","laneDiffResults","newCompsOutput","laneName","ids","newCompsIdsStr","chalk","bold","join","newCompsTitle","inverse","diffResultsStr","outputDiffResults","failuresTitle","failuresIds","f","red","msg","failuresStr","newCompsToStr","newCompsFromStr","toLaneHead","compareToHeadIfEmpty","modelComponent","getModelComponent","foundFromLane","find","isEqualWithoutVersion","fromLaneHead","push","isEqual","fromVersion","loadVersion","objects","err","message","toVersion","load","fromLaneStr","formatDepsAsTable","diff","diffBetweenVersionsObjects","currentLane","getCurrentLaneId","laneData","remote","laneComponent","version","latestVersion","lc","historyId","historyItem","compStr","compId","ComponentID","fromString","Ref","from","exports"],"sources":["lane-diff-generator.ts"],"sourcesContent":["import { ScopeMain } from '@teambit/scope';\nimport { Workspace } from '@teambit/workspace';\nimport { HistoryItem, Ref, Lane, LaneHistory, Version } from '@teambit/objects';\nimport { ComponentID, ComponentIdList } from '@teambit/component-id';\nimport { DiffResults, DiffOptions, outputDiffResults } from '@teambit/legacy.component-diff';\nimport { DEFAULT_LANE, LaneId } from '@teambit/lane-id';\nimport { BitError } from '@teambit/bit-error';\nimport { ComponentCompareMain } from '@teambit/component-compare';\nimport chalk from 'chalk';\n\ntype LaneData = {\n name: string;\n components: Array<{\n id: ComponentID;\n head: Ref;\n }>;\n remote: string | null;\n};\n\ntype Failure = { id: ComponentID; msg: string };\n\nexport type LaneDiffResults = {\n newCompsFrom: string[];\n newCompsTo: string[];\n compsWithDiff: DiffResults[];\n compsWithNoChanges: string[];\n toLaneName: string;\n fromLaneName: string;\n failures: Failure[];\n};\n\nexport class LaneDiffGenerator {\n private newCompsFrom: ComponentID[] = [];\n private newCompsTo: ComponentID[] = [];\n private compsWithDiff: DiffResults[] = [];\n private compsWithNoChanges: ComponentID[] = [];\n private fromLaneData: LaneData;\n private toLaneData: LaneData;\n private failures: Failure[] = [];\n constructor(\n private workspace: Workspace | undefined,\n private scope: ScopeMain,\n private componentCompare: ComponentCompareMain\n ) {}\n\n /**\n * the values array may include zero to two values and will be processed as following:\n * [] => diff between the default lane (from) and the current lane (to). (only inside workspace).\n * [to] => diff between the current lane (or default-lane when in scope) and \"to\" lane.\n * [from, to] => diff between \"from\" lane and \"to\" lane.\n */\n async generate(values: string[], diffOptions: DiffOptions = {}, pattern?: string): Promise<LaneDiffResults> {\n const { fromLaneName, toLaneName } = this.getLaneNames(values);\n\n if (fromLaneName === toLaneName) {\n throw new Error(`unable to run diff between \"${fromLaneName}\" and \"${toLaneName}\", they're the same lane`);\n }\n const legacyScope = this.scope.legacyScope;\n const fromLaneId = await legacyScope.lanes.parseLaneIdFromString(fromLaneName);\n const toLaneId = await legacyScope.lanes.parseLaneIdFromString(toLaneName);\n let toLane: Lane | null | undefined;\n let fromLane: Lane | null | undefined;\n\n if (fromLaneId.isDefault()) {\n if (toLaneId.isDefault()) throw new Error(`unable to diff between main and main, they're the same lane`);\n toLane = await legacyScope.lanes.loadLane(toLaneId);\n if (!toLane) throw new Error(`unable to find a lane \"${toLaneName}\" in the scope`);\n this.toLaneData = await this.mapToLaneData(toLane);\n const bitIds = toLane.components.map((c) => c.id);\n this.fromLaneData = await this.getDefaultLaneData(bitIds);\n } else if (toLaneId.isDefault()) {\n fromLane = await legacyScope.lanes.loadLane(fromLaneId);\n if (!fromLane) throw new Error(`unable to find a lane \"${fromLaneName}\" in the scope`);\n this.fromLaneData = await this.mapToLaneData(fromLane);\n const bitIds = fromLane?.components.map((c) => c.id) || [];\n this.toLaneData = await this.getDefaultLaneData(bitIds);\n } else {\n // both, \"from\" and \"to\" are not default-lane.\n toLane = await legacyScope.lanes.loadLane(toLaneId);\n if (!toLane) throw new Error(`unable to find a lane \"${toLaneName}\" in the scope`);\n fromLane = await legacyScope.lanes.loadLane(fromLaneId);\n if (!fromLane) throw new Error(`unable to find a lane \"${fromLaneName}\" in the scope`);\n this.toLaneData = await this.mapToLaneData(toLane);\n this.fromLaneData = await this.mapToLaneData(fromLane);\n }\n\n let idsToCheckDiff: ComponentIdList | undefined;\n if (pattern) {\n const compIds = this.toLaneData.components.map((c) => c.id);\n idsToCheckDiff = ComponentIdList.fromArray(await this.scope.filterIdsFromPoolIdsByPattern(pattern, compIds));\n }\n\n if (!this.toLaneData.components.length) {\n throw new BitError(`lane \"${toLaneName}\" is empty, nothing to show`);\n }\n\n const idsOfTo = ComponentIdList.fromArray(\n this.toLaneData.components.map((c) => c.id.changeVersion(c.head?.toString()))\n );\n await this.scope.legacyScope.scopeImporter.importWithoutDeps(idsOfTo, {\n cache: true,\n lane: toLane || undefined,\n ignoreMissingHead: true,\n reason: `for the \"to\" diff - ${toLane ? toLane.name : DEFAULT_LANE}`,\n });\n const idsOfFrom = ComponentIdList.fromArray(\n this.fromLaneData.components.map((c) => c.id.changeVersion(c.head?.toString()))\n );\n await this.scope.legacyScope.scopeImporter.importWithoutDeps(idsOfFrom, {\n cache: true,\n lane: fromLane || undefined,\n ignoreMissingHead: true,\n reason: `for the \"from\" diff - ${fromLane ? fromLane.name : DEFAULT_LANE}`,\n });\n\n await Promise.all(\n this.toLaneData.components.map(async ({ id, head }) => {\n if (idsToCheckDiff && !idsToCheckDiff.hasWithoutVersion(id)) {\n return;\n }\n await this.componentDiff(id, head, diffOptions, true);\n })\n );\n\n return {\n newCompsFrom: this.newCompsFrom.map((id) => id.toString()),\n newCompsTo: this.newCompsTo.map((id) => id.toString()),\n compsWithDiff: this.compsWithDiff,\n compsWithNoChanges: this.compsWithNoChanges.map((id) => id.toString()),\n toLaneName: this.toLaneData.name,\n fromLaneName: this.fromLaneData.name,\n failures: this.failures,\n };\n }\n\n async generateDiffHistory(\n lane: Lane,\n laneHistory: LaneHistory,\n fromHistoryId: string,\n toHistoryId: string,\n pattern?: string\n ): Promise<LaneDiffResults> {\n const laneId = lane.toLaneId();\n const history = laneHistory.getHistory();\n const fromLane = history[fromHistoryId];\n const toLane = history[toHistoryId];\n if (!fromLane)\n throw new Error(`unable to find the from-history-id \"${fromHistoryId}\" in lane \"${laneId.toString()}\"`);\n if (!toLane) throw new Error(`unable to find the to-history-id \"${toHistoryId}\" in lane \"${laneId.toString()}\"`);\n this.fromLaneData = this.mapHistoryToLaneData(laneId, fromHistoryId, fromLane);\n this.toLaneData = this.mapHistoryToLaneData(laneId, toHistoryId, toLane);\n\n let idsToCheckDiff: ComponentIdList | undefined;\n if (pattern) {\n const compIds = this.toLaneData.components.map((c) => c.id);\n idsToCheckDiff = ComponentIdList.fromArray(await this.scope.filterIdsFromPoolIdsByPattern(pattern, compIds));\n }\n\n if (!this.toLaneData.components.length) {\n throw new BitError(`lane-history \"${toHistoryId}\" is empty, nothing to show`);\n }\n\n const idsOfTo = ComponentIdList.fromArray(\n this.toLaneData.components.map((c) => c.id.changeVersion(c.head?.toString()))\n );\n await this.scope.legacyScope.scopeImporter.importWithoutDeps(idsOfTo, {\n cache: true,\n lane,\n ignoreMissingHead: true,\n reason: `for the \"to\" diff - ${laneId.toString()}-${toHistoryId}`,\n });\n const idsOfFrom = ComponentIdList.fromArray(\n this.fromLaneData.components.map((c) => c.id.changeVersion(c.head?.toString()))\n );\n await this.scope.legacyScope.scopeImporter.importWithoutDeps(idsOfFrom, {\n cache: true,\n lane,\n ignoreMissingHead: true,\n reason: `for the \"from\" diff - ${laneId.toString()}-${fromHistoryId}`,\n });\n\n await Promise.all(\n this.toLaneData.components.map(async ({ id, head }) => {\n if (idsToCheckDiff && !idsToCheckDiff.hasWithoutVersion(id)) {\n return;\n }\n await this.componentDiff(id, head);\n })\n );\n\n return {\n newCompsFrom: this.newCompsFrom.map((id) => id.toString()),\n newCompsTo: this.newCompsTo.map((id) => id.toString()),\n compsWithDiff: this.compsWithDiff,\n compsWithNoChanges: this.compsWithNoChanges.map((id) => id.toString()),\n toLaneName: this.toLaneData.name,\n fromLaneName: this.fromLaneData.name,\n failures: this.failures,\n };\n }\n\n laneDiffResultsToString(laneDiffResults: LaneDiffResults): string {\n const { compsWithDiff, newCompsFrom, newCompsTo, toLaneName, fromLaneName, failures } = laneDiffResults;\n\n const newCompsOutput = (laneName: string, ids: string[]) => {\n if (!ids.length) return '';\n const newCompsIdsStr = ids.map((id) => chalk.bold(id)).join('\\n');\n const newCompsTitle = `\\nThe following components were introduced in ${chalk.bold(laneName)} lane`;\n return `${chalk.inverse(newCompsTitle)}\\n${newCompsIdsStr}`;\n };\n\n const diffResultsStr = outputDiffResults(compsWithDiff);\n\n const failuresTitle = `\\n\\nDiff failed on the following component(s)`;\n const failuresIds = failures.map((f) => `${f.id.toString()} - ${chalk.red(f.msg)}`).join('\\n');\n const failuresStr = failures.length ? `${chalk.inverse(failuresTitle)}\\n${failuresIds}` : '';\n const newCompsToStr = newCompsOutput(toLaneName, newCompsTo);\n\n const newCompsFromStr = newCompsOutput(fromLaneName, newCompsFrom);\n return `${diffResultsStr}${newCompsToStr}${newCompsFromStr}${failuresStr}`;\n }\n\n private async componentDiff(\n id: ComponentID,\n toLaneHead: Ref | null,\n diffOptions: DiffOptions = {},\n compareToHeadIfEmpty = false\n ) {\n const modelComponent = await this.scope.legacyScope.getModelComponent(id);\n const foundFromLane = this.fromLaneData.components.find((c) => c.id.isEqualWithoutVersion(id))?.head;\n const fromLaneHead = compareToHeadIfEmpty ? foundFromLane || modelComponent.head : foundFromLane;\n if (!fromLaneHead) {\n this.newCompsTo.push(id);\n return;\n }\n if (!toLaneHead) {\n this.newCompsFrom.push(id);\n return;\n }\n if (fromLaneHead.isEqual(toLaneHead)) {\n this.compsWithNoChanges.push(id);\n return;\n }\n let fromVersion: Version;\n try {\n fromVersion = await modelComponent.loadVersion(fromLaneHead.toString(), this.scope.legacyScope.objects, true);\n } catch (err: any) {\n this.failures.push({ id, msg: err.message });\n return;\n }\n const toVersion = await toLaneHead.load(this.scope.legacyScope.objects);\n const fromLaneStr = this.fromLaneData.name;\n diffOptions.formatDepsAsTable = false;\n const diff = await this.componentCompare.diffBetweenVersionsObjects(\n modelComponent,\n fromVersion,\n toVersion as Version,\n fromLaneStr,\n this.toLaneData.name,\n diffOptions\n );\n this.compsWithDiff.push(diff);\n }\n\n private getLaneNames(values: string[]): { fromLaneName: string; toLaneName: string } {\n if (values.length > 2) {\n throw new Error(`expect \"values\" to include no more than two args, got ${values.length}`);\n }\n if (this.workspace) {\n const currentLane = this.workspace.getCurrentLaneId();\n if (!values.length) {\n if (currentLane.isDefault()) {\n throw new Error(`you are currently on the default branch, to run diff between lanes, please specify them`);\n }\n return { toLaneName: currentLane.name, fromLaneName: DEFAULT_LANE };\n }\n if (values.length === 1) {\n const toLaneName = currentLane.isDefault() ? DEFAULT_LANE : currentLane.name;\n return { toLaneName, fromLaneName: values[0] };\n }\n return { toLaneName: values[1], fromLaneName: values[0] };\n }\n // running from the scope\n if (values.length < 1) {\n throw new Error(`expect \"values\" to include at least one arg - the lane name`);\n }\n const fromLaneName = values.length === 2 ? values[0] : DEFAULT_LANE;\n const toLaneName = values.length === 2 ? values[1] : values[0];\n return { fromLaneName, toLaneName };\n }\n\n private async getDefaultLaneData(ids: ComponentID[]): Promise<LaneData> {\n const laneData: LaneData = {\n name: DEFAULT_LANE,\n remote: null,\n components: [],\n };\n\n await Promise.all(\n ids.map(async (id) => {\n const modelComponent = await this.scope.legacyScope.getModelComponent(id);\n const laneComponent = {\n id,\n head: modelComponent.head as Ref, // @todo: this is not true. it can be undefined\n version: modelComponent.latestVersion(), // should this be latestVersion() or bitId.version.toString()\n };\n laneData.components.push(laneComponent);\n })\n );\n\n return laneData;\n }\n\n private async mapToLaneData(lane: Lane): Promise<LaneData> {\n const { name, components } = lane;\n return {\n name,\n components: components.map((lc) => ({\n id: lc.id,\n head: lc.head,\n version: lc.id.version?.toString(),\n })),\n remote: lane.toLaneId().toString(),\n };\n }\n\n private mapHistoryToLaneData(laneId: LaneId, historyId: string, historyItem: HistoryItem): LaneData {\n return {\n name: historyId,\n components: historyItem.components.map((compStr) => {\n const compId = ComponentID.fromString(compStr);\n return {\n id: compId.changeVersion(undefined),\n head: Ref.from(compId.version),\n };\n }),\n remote: laneId.toString(),\n };\n }\n}\n"],"mappings":";;;;;;AAEA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,aAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,YAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,QAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,OAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAA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;IAClG,OAAO;MACLlE,IAAI,EAAEiE,SAAS;MACfzF,UAAU,EAAE0F,WAAW,CAAC1F,UAAU,CAACC,GAAG,CAAE0F,OAAO,IAAK;QAClD,MAAMC,MAAM,GAAGC,0BAAW,CAACC,UAAU,CAACH,OAAO,CAAC;QAC9C,OAAO;UACLxF,EAAE,EAAEyF,MAAM,CAAC9E,aAAa,CAACO,SAAS,CAAC;UACnCN,IAAI,EAAEgF,cAAG,CAACC,IAAI,CAACJ,MAAM,CAACN,OAAO;QAC/B,CAAC;MACH,CAAC,CAAC;MACFF,MAAM,EAAEjD,MAAM,CAACnB,QAAQ,CAAC;IAC1B,CAAC;EACH;AACF;AAACiF,OAAA,CAAA/H,iBAAA,GAAAA,iBAAA","ignoreList":[]}
@@ -1,58 +1,56 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
12
6
  exports.LaneDiffCmd = void 0;
13
- const legacy_constants_1 = require("@teambit/legacy.constants");
14
- const lane_diff_generator_1 = require("./lane-diff-generator");
7
+ function _legacy() {
8
+ const data = require("@teambit/legacy.constants");
9
+ _legacy = function () {
10
+ return data;
11
+ };
12
+ return data;
13
+ }
14
+ function _laneDiffGenerator() {
15
+ const data = require("./lane-diff-generator");
16
+ _laneDiffGenerator = function () {
17
+ return data;
18
+ };
19
+ return data;
20
+ }
15
21
  class LaneDiffCmd {
16
- constructor(workspace, scope, componentCompare) {
17
- this.workspace = workspace;
18
- this.scope = scope;
19
- this.componentCompare = componentCompare;
20
- this.name = 'diff [values...]';
21
- this.description = `show diff between lanes`;
22
- this.extendedDescription = `bit lane diff => diff between the current lane and default lane. (only inside workspace).
22
+ name = 'diff [values...]';
23
+ description = `show diff between lanes`;
24
+ extendedDescription = `bit lane diff => diff between the current lane and default lane. (only inside workspace).
23
25
  bit lane diff to => diff between the current lane (or default-lane when in scope) and "to" lane.
24
26
  bit lane diff from to => diff between "from" lane and "to" lane.`;
25
- this.alias = '';
26
- this.arguments = [
27
- {
28
- name: 'from',
29
- description: `base lane for comparison`,
30
- },
31
- {
32
- name: 'to',
33
- description: `lane being compared to base lane`,
34
- },
35
- ];
36
- this.options = [
37
- [
38
- '',
39
- 'pattern <component-pattern>',
40
- `show lane-diff for components conforming to the specified component-pattern only
41
- component-pattern format: ${legacy_constants_1.COMPONENT_PATTERN_HELP}`,
42
- ],
43
- ];
44
- this.loader = true;
45
- this.private = true;
46
- this.remoteOp = true;
47
- this.skipWorkspace = true;
48
- }
49
- report(_a, _b) {
50
- return __awaiter(this, arguments, void 0, function* ([values = []], { pattern }) {
51
- const laneDiffGenerator = new lane_diff_generator_1.LaneDiffGenerator(this.workspace, this.scope, this.componentCompare);
52
- const results = yield laneDiffGenerator.generate(values, undefined, pattern);
53
- return laneDiffGenerator.laneDiffResultsToString(results);
54
- });
55
- }
27
+ alias = '';
28
+ arguments = [{
29
+ name: 'from',
30
+ description: `base lane for comparison`
31
+ }, {
32
+ name: 'to',
33
+ description: `lane being compared to base lane`
34
+ }];
35
+ options = [['', 'pattern <component-pattern>', `show lane-diff for components conforming to the specified component-pattern only
36
+ component-pattern format: ${_legacy().COMPONENT_PATTERN_HELP}`]];
37
+ loader = true;
38
+ private = true;
39
+ remoteOp = true;
40
+ skipWorkspace = true;
41
+ constructor(workspace, scope, componentCompare) {
42
+ this.workspace = workspace;
43
+ this.scope = scope;
44
+ this.componentCompare = componentCompare;
45
+ }
46
+ async report([values = []], {
47
+ pattern
48
+ }) {
49
+ const laneDiffGenerator = new (_laneDiffGenerator().LaneDiffGenerator)(this.workspace, this.scope, this.componentCompare);
50
+ const results = await laneDiffGenerator.generate(values, undefined, pattern);
51
+ return laneDiffGenerator.laneDiffResultsToString(results);
52
+ }
56
53
  }
57
54
  exports.LaneDiffCmd = LaneDiffCmd;
55
+
58
56
  //# sourceMappingURL=lane-diff.cmd.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"lane-diff.cmd.js","sourceRoot":"","sources":["../lane-diff.cmd.ts"],"names":[],"mappings":";;;;;;;;;;;;AAIA,gEAAmE;AACnE,+DAA0D;AAE1D,MAAa,WAAW;IA8BtB,YACU,SAAoB,EACpB,KAAgB,EAChB,gBAAsC;QAFtC,cAAS,GAAT,SAAS,CAAW;QACpB,UAAK,GAAL,KAAK,CAAW;QAChB,qBAAgB,GAAhB,gBAAgB,CAAsB;QAhChD,SAAI,GAAG,kBAAkB,CAAC;QAC1B,gBAAW,GAAG,yBAAyB,CAAC;QACxC,wBAAmB,GAAG;;iEAEyC,CAAC;QAChE,UAAK,GAAG,EAAE,CAAC;QACX,cAAS,GAAG;YACV;gBACE,IAAI,EAAE,MAAM;gBACZ,WAAW,EAAE,0BAA0B;aACxC;YACD;gBACE,IAAI,EAAE,IAAI;gBACV,WAAW,EAAE,kCAAkC;aAChD;SACF,CAAC;QACF,YAAO,GAAG;YACR;gBACE,EAAE;gBACF,6BAA6B;gBAC7B;4BACsB,yCAAsB,EAAE;aAC/C;SACgB,CAAC;QACpB,WAAM,GAAG,IAAI,CAAC;QACd,YAAO,GAAG,IAAI,CAAC;QACf,aAAQ,GAAG,IAAI,CAAC;QAChB,kBAAa,GAAG,IAAI,CAAC;IAMlB,CAAC;IAEE,MAAM;6DAAC,CAAC,MAAM,GAAG,EAAE,CAAa,EAAE,EAAE,OAAO,EAAwB;YACvE,MAAM,iBAAiB,GAAG,IAAI,uCAAiB,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;YACnG,MAAM,OAAO,GAAG,MAAM,iBAAiB,CAAC,QAAQ,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;YAC7E,OAAO,iBAAiB,CAAC,uBAAuB,CAAC,OAAO,CAAC,CAAC;QAC5D,CAAC;KAAA;CACF;AAzCD,kCAyCC"}
1
+ {"version":3,"names":["_legacy","data","require","_laneDiffGenerator","LaneDiffCmd","name","description","extendedDescription","alias","arguments","options","COMPONENT_PATTERN_HELP","loader","private","remoteOp","skipWorkspace","constructor","workspace","scope","componentCompare","report","values","pattern","laneDiffGenerator","LaneDiffGenerator","results","generate","undefined","laneDiffResultsToString","exports"],"sources":["lane-diff.cmd.ts"],"sourcesContent":["import { Command, CommandOptions } from '@teambit/cli';\nimport { ScopeMain } from '@teambit/scope';\nimport { Workspace } from '@teambit/workspace';\nimport { ComponentCompareMain } from '@teambit/component-compare';\nimport { COMPONENT_PATTERN_HELP } from '@teambit/legacy.constants';\nimport { LaneDiffGenerator } from './lane-diff-generator';\n\nexport class LaneDiffCmd implements Command {\n name = 'diff [values...]';\n description = `show diff between lanes`;\n extendedDescription = `bit lane diff => diff between the current lane and default lane. (only inside workspace).\nbit lane diff to => diff between the current lane (or default-lane when in scope) and \"to\" lane.\nbit lane diff from to => diff between \"from\" lane and \"to\" lane.`;\n alias = '';\n arguments = [\n {\n name: 'from',\n description: `base lane for comparison`,\n },\n {\n name: 'to',\n description: `lane being compared to base lane`,\n },\n ];\n options = [\n [\n '',\n 'pattern <component-pattern>',\n `show lane-diff for components conforming to the specified component-pattern only\ncomponent-pattern format: ${COMPONENT_PATTERN_HELP}`,\n ],\n ] as CommandOptions;\n loader = true;\n private = true;\n remoteOp = true;\n skipWorkspace = true;\n\n constructor(\n private workspace: Workspace,\n private scope: ScopeMain,\n private componentCompare: ComponentCompareMain\n ) {}\n\n async report([values = []]: [string[]], { pattern }: { pattern?: string }) {\n const laneDiffGenerator = new LaneDiffGenerator(this.workspace, this.scope, this.componentCompare);\n const results = await laneDiffGenerator.generate(values, undefined, pattern);\n return laneDiffGenerator.laneDiffResultsToString(results);\n }\n}\n"],"mappings":";;;;;;AAIA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,mBAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,kBAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEO,MAAMG,WAAW,CAAoB;EAC1CC,IAAI,GAAG,kBAAkB;EACzBC,WAAW,GAAG,yBAAyB;EACvCC,mBAAmB,GAAG;AACxB;AACA,iEAAiE;EAC/DC,KAAK,GAAG,EAAE;EACVC,SAAS,GAAG,CACV;IACEJ,IAAI,EAAE,MAAM;IACZC,WAAW,EAAE;EACf,CAAC,EACD;IACED,IAAI,EAAE,IAAI;IACVC,WAAW,EAAE;EACf,CAAC,CACF;EACDI,OAAO,GAAG,CACR,CACE,EAAE,EACF,6BAA6B,EAC7B;AACN,4BAA4BC,gCAAsB,EAAE,CAC/C,CACF;EACDC,MAAM,GAAG,IAAI;EACbC,OAAO,GAAG,IAAI;EACdC,QAAQ,GAAG,IAAI;EACfC,aAAa,GAAG,IAAI;EAEpBC,WAAWA,CACDC,SAAoB,EACpBC,KAAgB,EAChBC,gBAAsC,EAC9C;IAAA,KAHQF,SAAoB,GAApBA,SAAoB;IAAA,KACpBC,KAAgB,GAAhBA,KAAgB;IAAA,KAChBC,gBAAsC,GAAtCA,gBAAsC;EAC7C;EAEH,MAAMC,MAAMA,CAAC,CAACC,MAAM,GAAG,EAAE,CAAa,EAAE;IAAEC;EAA8B,CAAC,EAAE;IACzE,MAAMC,iBAAiB,GAAG,KAAIC,sCAAiB,EAAC,IAAI,CAACP,SAAS,EAAE,IAAI,CAACC,KAAK,EAAE,IAAI,CAACC,gBAAgB,CAAC;IAClG,MAAMM,OAAO,GAAG,MAAMF,iBAAiB,CAACG,QAAQ,CAACL,MAAM,EAAEM,SAAS,EAAEL,OAAO,CAAC;IAC5E,OAAOC,iBAAiB,CAACK,uBAAuB,CAACH,OAAO,CAAC;EAC3D;AACF;AAACI,OAAA,CAAAzB,WAAA,GAAAA,WAAA","ignoreList":[]}
@@ -1,52 +1,58 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
12
6
  exports.LaneHistoryDiffCmd = void 0;
13
- const legacy_constants_1 = require("@teambit/legacy.constants");
14
- const lane_diff_generator_1 = require("./lane-diff-generator");
15
- const bit_error_1 = require("@teambit/bit-error");
7
+ function _legacy() {
8
+ const data = require("@teambit/legacy.constants");
9
+ _legacy = function () {
10
+ return data;
11
+ };
12
+ return data;
13
+ }
14
+ function _laneDiffGenerator() {
15
+ const data = require("./lane-diff-generator");
16
+ _laneDiffGenerator = function () {
17
+ return data;
18
+ };
19
+ return data;
20
+ }
21
+ function _bitError() {
22
+ const data = require("@teambit/bit-error");
23
+ _bitError = function () {
24
+ return data;
25
+ };
26
+ return data;
27
+ }
16
28
  class LaneHistoryDiffCmd {
17
- constructor(lanes, workspace, scope, componentCompare) {
18
- this.lanes = lanes;
19
- this.workspace = workspace;
20
- this.scope = scope;
21
- this.componentCompare = componentCompare;
22
- this.name = 'history-diff <from-history-id> <to-history-id>';
23
- this.description = 'EXPERIMENTAL. show diff between two lane-history ids';
24
- this.extendedDescription = 'run "bit lane history" to find these history-ids';
25
- this.alias = '';
26
- this.options = [
27
- ['l', 'lane <lane-name>', 'the name of the lane to diff. if not specified, the current lane is used'],
28
- [
29
- '',
30
- 'pattern <component-pattern>',
31
- `show lane-diff for components conforming to the specified component-pattern only
32
- component-pattern format: ${legacy_constants_1.COMPONENT_PATTERN_HELP}`,
33
- ],
34
- ];
35
- this.loader = true;
36
- }
37
- report(_a, _b) {
38
- return __awaiter(this, arguments, void 0, function* ([fromHistoryId, toHistoryId], { lane, pattern }) {
39
- const laneId = lane ? yield this.lanes.parseLaneId(lane) : this.lanes.getCurrentLaneId();
40
- if (!laneId || laneId.isDefault())
41
- throw new bit_error_1.BitError(`unable to show diff-history of the default lane (main)`);
42
- yield this.lanes.importLaneHistory(laneId);
43
- const laneHistory = yield this.lanes.getLaneHistory(laneId);
44
- const laneDiffGenerator = new lane_diff_generator_1.LaneDiffGenerator(this.workspace, this.scope, this.componentCompare);
45
- const laneObj = yield this.lanes.loadLane(laneId);
46
- const results = yield laneDiffGenerator.generateDiffHistory(laneObj, laneHistory, fromHistoryId, toHistoryId, pattern);
47
- return laneDiffGenerator.laneDiffResultsToString(results);
48
- });
49
- }
29
+ name = 'history-diff <from-history-id> <to-history-id>';
30
+ description = 'EXPERIMENTAL. show diff between two lane-history ids';
31
+ extendedDescription = 'run "bit lane history" to find these history-ids';
32
+ alias = '';
33
+ options = [['l', 'lane <lane-name>', 'the name of the lane to diff. if not specified, the current lane is used'], ['', 'pattern <component-pattern>', `show lane-diff for components conforming to the specified component-pattern only
34
+ component-pattern format: ${_legacy().COMPONENT_PATTERN_HELP}`]];
35
+ loader = true;
36
+ constructor(lanes, workspace, scope, componentCompare) {
37
+ this.lanes = lanes;
38
+ this.workspace = workspace;
39
+ this.scope = scope;
40
+ this.componentCompare = componentCompare;
41
+ }
42
+ async report([fromHistoryId, toHistoryId], {
43
+ lane,
44
+ pattern
45
+ }) {
46
+ const laneId = lane ? await this.lanes.parseLaneId(lane) : this.lanes.getCurrentLaneId();
47
+ if (!laneId || laneId.isDefault()) throw new (_bitError().BitError)(`unable to show diff-history of the default lane (main)`);
48
+ await this.lanes.importLaneHistory(laneId);
49
+ const laneHistory = await this.lanes.getLaneHistory(laneId);
50
+ const laneDiffGenerator = new (_laneDiffGenerator().LaneDiffGenerator)(this.workspace, this.scope, this.componentCompare);
51
+ const laneObj = await this.lanes.loadLane(laneId);
52
+ const results = await laneDiffGenerator.generateDiffHistory(laneObj, laneHistory, fromHistoryId, toHistoryId, pattern);
53
+ return laneDiffGenerator.laneDiffResultsToString(results);
54
+ }
50
55
  }
51
56
  exports.LaneHistoryDiffCmd = LaneHistoryDiffCmd;
57
+
52
58
  //# sourceMappingURL=lane-history-diff.cmd.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"lane-history-diff.cmd.js","sourceRoot":"","sources":["../lane-history-diff.cmd.ts"],"names":[],"mappings":";;;;;;;;;;;;AAIA,gEAAmE;AACnE,+DAA0D;AAC1D,kDAA8C;AAG9C,MAAa,kBAAkB;IAgB7B,YACU,KAAgB,EAChB,SAAoB,EACpB,KAAgB,EAChB,gBAAsC;QAHtC,UAAK,GAAL,KAAK,CAAW;QAChB,cAAS,GAAT,SAAS,CAAW;QACpB,UAAK,GAAL,KAAK,CAAW;QAChB,qBAAgB,GAAhB,gBAAgB,CAAsB;QAnBhD,SAAI,GAAG,gDAAgD,CAAC;QACxD,gBAAW,GAAG,sDAAsD,CAAC;QACrE,wBAAmB,GAAG,kDAAkD,CAAC;QACzE,UAAK,GAAG,EAAE,CAAC;QACX,YAAO,GAAG;YACR,CAAC,GAAG,EAAE,kBAAkB,EAAE,0EAA0E,CAAC;YACrG;gBACE,EAAE;gBACF,6BAA6B;gBAC7B;4BACsB,yCAAsB,EAAE;aAC/C;SACgB,CAAC;QACpB,WAAM,GAAG,IAAI,CAAC;IAOX,CAAC;IAEE,MAAM;6DACV,CAAC,aAAa,EAAE,WAAW,CAAmB,EAC9C,EAAE,IAAI,EAAE,OAAO,EAAuC;YAEtD,MAAM,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,gBAAgB,EAAE,CAAC;YACzF,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,SAAS,EAAE;gBAAE,MAAM,IAAI,oBAAQ,CAAC,wDAAwD,CAAC,CAAC;YAChH,MAAM,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;YAC3C,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;YAC5D,MAAM,iBAAiB,GAAG,IAAI,uCAAiB,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;YACnG,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;YAClD,MAAM,OAAO,GAAG,MAAM,iBAAiB,CAAC,mBAAmB,CACzD,OAAQ,EACR,WAAW,EACX,aAAa,EACb,WAAW,EACX,OAAO,CACR,CAAC;YACF,OAAO,iBAAiB,CAAC,uBAAuB,CAAC,OAAO,CAAC,CAAC;QAC5D,CAAC;KAAA;CACF;AA1CD,gDA0CC"}
1
+ {"version":3,"names":["_legacy","data","require","_laneDiffGenerator","_bitError","LaneHistoryDiffCmd","name","description","extendedDescription","alias","options","COMPONENT_PATTERN_HELP","loader","constructor","lanes","workspace","scope","componentCompare","report","fromHistoryId","toHistoryId","lane","pattern","laneId","parseLaneId","getCurrentLaneId","isDefault","BitError","importLaneHistory","laneHistory","getLaneHistory","laneDiffGenerator","LaneDiffGenerator","laneObj","loadLane","results","generateDiffHistory","laneDiffResultsToString","exports"],"sources":["lane-history-diff.cmd.ts"],"sourcesContent":["import { Command, CommandOptions } from '@teambit/cli';\nimport { ScopeMain } from '@teambit/scope';\nimport { Workspace } from '@teambit/workspace';\nimport { ComponentCompareMain } from '@teambit/component-compare';\nimport { COMPONENT_PATTERN_HELP } from '@teambit/legacy.constants';\nimport { LaneDiffGenerator } from './lane-diff-generator';\nimport { BitError } from '@teambit/bit-error';\nimport { LanesMain } from '@teambit/lanes';\n\nexport class LaneHistoryDiffCmd implements Command {\n name = 'history-diff <from-history-id> <to-history-id>';\n description = 'EXPERIMENTAL. show diff between two lane-history ids';\n extendedDescription = 'run \"bit lane history\" to find these history-ids';\n alias = '';\n options = [\n ['l', 'lane <lane-name>', 'the name of the lane to diff. if not specified, the current lane is used'],\n [\n '',\n 'pattern <component-pattern>',\n `show lane-diff for components conforming to the specified component-pattern only\ncomponent-pattern format: ${COMPONENT_PATTERN_HELP}`,\n ],\n ] as CommandOptions;\n loader = true;\n\n constructor(\n private lanes: LanesMain,\n private workspace: Workspace,\n private scope: ScopeMain,\n private componentCompare: ComponentCompareMain\n ) {}\n\n async report(\n [fromHistoryId, toHistoryId]: [string, string],\n { lane, pattern }: { lane?: string; pattern?: string }\n ): Promise<string> {\n const laneId = lane ? await this.lanes.parseLaneId(lane) : this.lanes.getCurrentLaneId();\n if (!laneId || laneId.isDefault()) throw new BitError(`unable to show diff-history of the default lane (main)`);\n await this.lanes.importLaneHistory(laneId);\n const laneHistory = await this.lanes.getLaneHistory(laneId);\n const laneDiffGenerator = new LaneDiffGenerator(this.workspace, this.scope, this.componentCompare);\n const laneObj = await this.lanes.loadLane(laneId);\n const results = await laneDiffGenerator.generateDiffHistory(\n laneObj!,\n laneHistory,\n fromHistoryId,\n toHistoryId,\n pattern\n );\n return laneDiffGenerator.laneDiffResultsToString(results);\n }\n}\n"],"mappings":";;;;;;AAIA,SAAAA,QAAA;EAAA,MAAAC,IAAA,G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,wDAAwD,CAAC;IAC/G,MAAM,IAAI,CAACb,KAAK,CAACc,iBAAiB,CAACL,MAAM,CAAC;IAC1C,MAAMM,WAAW,GAAG,MAAM,IAAI,CAACf,KAAK,CAACgB,cAAc,CAACP,MAAM,CAAC;IAC3D,MAAMQ,iBAAiB,GAAG,KAAIC,sCAAiB,EAAC,IAAI,CAACjB,SAAS,EAAE,IAAI,CAACC,KAAK,EAAE,IAAI,CAACC,gBAAgB,CAAC;IAClG,MAAMgB,OAAO,GAAG,MAAM,IAAI,CAACnB,KAAK,CAACoB,QAAQ,CAACX,MAAM,CAAC;IACjD,MAAMY,OAAO,GAAG,MAAMJ,iBAAiB,CAACK,mBAAmB,CACzDH,OAAO,EACPJ,WAAW,EACXV,aAAa,EACbC,WAAW,EACXE,OACF,CAAC;IACD,OAAOS,iBAAiB,CAACM,uBAAuB,CAACF,OAAO,CAAC;EAC3D;AACF;AAACG,OAAA,CAAAjC,kBAAA,GAAAA,kBAAA","ignoreList":[]}
package/package.json CHANGED
@@ -1,25 +1,25 @@
1
1
  {
2
2
  "name": "@teambit/lanes.modules.diff",
3
- "version": "0.0.524",
3
+ "version": "0.0.525",
4
4
  "homepage": "https://bit.cloud/teambit/lanes/modules/diff",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.lanes",
8
8
  "name": "modules/diff",
9
- "version": "0.0.524"
9
+ "version": "0.0.525"
10
10
  },
11
11
  "dependencies": {
12
12
  "chalk": "2.4.2",
13
13
  "@teambit/bit-error": "0.0.404",
14
14
  "@teambit/component-id": "1.2.2",
15
15
  "@teambit/lane-id": "0.0.312",
16
- "@teambit/legacy.component-diff": "0.0.80",
17
- "@teambit/legacy.constants": "0.0.8"
16
+ "@teambit/legacy.component-diff": "0.0.81",
17
+ "@teambit/legacy.constants": "0.0.9"
18
18
  },
19
19
  "devDependencies": {
20
20
  "@types/mocha": "9.1.0",
21
- "@types/jest": "26.0.20",
22
- "@types/node": "22.10.5"
21
+ "chai": "4.3.0",
22
+ "@teambit/node.envs.node-babel-mocha": "0.1.4"
23
23
  },
24
24
  "peerDependencies": {},
25
25
  "license": "Apache-2.0",
package/types/asset.d.ts CHANGED
@@ -5,12 +5,12 @@ declare module '*.png' {
5
5
  declare module '*.svg' {
6
6
  import type { FunctionComponent, SVGProps } from 'react';
7
7
 
8
- export const ReactComponent: FunctionComponent<SVGProps<SVGSVGElement> & { title?: string }>;
8
+ export const ReactComponent: FunctionComponent<
9
+ SVGProps<SVGSVGElement> & { title?: string }
10
+ >;
9
11
  const src: string;
10
12
  export default src;
11
13
  }
12
-
13
- // @TODO Gilad
14
14
  declare module '*.jpg' {
15
15
  const value: any;
16
16
  export = value;
@@ -27,3 +27,15 @@ declare module '*.bmp' {
27
27
  const value: any;
28
28
  export = value;
29
29
  }
30
+ declare module '*.otf' {
31
+ const value: any;
32
+ export = value;
33
+ }
34
+ declare module '*.woff' {
35
+ const value: any;
36
+ export = value;
37
+ }
38
+ declare module '*.woff2' {
39
+ const value: any;
40
+ export = value;
41
+ }
@@ -1,7 +0,0 @@
1
- ;
2
- ;
3
-
4
- export const compositions = [];
5
- export const overview = [];
6
-
7
- export const compositions_metadata = {"compositions":[]};