@teambit/workspace 0.0.881 → 0.0.883
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bit-map.js +10 -51
- package/dist/bit-map.js.map +1 -1
- package/dist/build-graph-from-fs.js +1 -53
- package/dist/build-graph-from-fs.js.map +1 -1
- package/dist/capsule.cmd.js +2 -34
- package/dist/capsule.cmd.js.map +1 -1
- package/dist/component-config-file/component-config-file.js +2 -60
- package/dist/component-config-file/component-config-file.js.map +1 -1
- package/dist/component-config-file/exceptions/already-exists.js +0 -6
- package/dist/component-config-file/exceptions/already-exists.js.map +1 -1
- package/dist/component-config-file/exceptions/index.js +0 -3
- package/dist/component-config-file/exceptions/index.js.map +1 -1
- package/dist/component-config-file/index.js +0 -6
- package/dist/component-config-file/index.js.map +1 -1
- package/dist/component-tree.widget.js +0 -18
- package/dist/component-tree.widget.js.map +1 -1
- package/dist/constants.js.map +1 -1
- package/dist/eject-conf.cmd.js +0 -23
- package/dist/eject-conf.cmd.js.map +1 -1
- package/dist/envs-subcommands/envs-replace.cmd.js +0 -13
- package/dist/envs-subcommands/envs-replace.cmd.js.map +1 -1
- package/dist/envs-subcommands/envs-set.cmd.js +0 -16
- package/dist/envs-subcommands/envs-set.cmd.js.map +1 -1
- package/dist/envs-subcommands/envs-unset.cmd.js +0 -18
- package/dist/envs-subcommands/envs-unset.cmd.js.map +1 -1
- package/dist/events/index.js +0 -6
- package/dist/events/index.js.map +1 -1
- package/dist/events/on-component-add-event.js +1 -12
- package/dist/events/on-component-add-event.js.map +1 -1
- package/dist/events/on-component-change-event.js +1 -12
- package/dist/events/on-component-change-event.js.map +1 -1
- package/dist/events/on-component-removed-event.js +1 -12
- package/dist/events/on-component-removed-event.js.map +1 -1
- package/dist/exceptions/incorrect-env-aspect.js +0 -6
- package/dist/exceptions/incorrect-env-aspect.js.map +1 -1
- package/dist/index.js +0 -19
- package/dist/index.js.map +1 -1
- package/dist/list.cmd.js +2 -15
- package/dist/list.cmd.js.map +1 -1
- package/dist/pattern.cmd.js +0 -16
- package/dist/pattern.cmd.js.map +1 -1
- package/dist/scope-subcommands/scope-set.cmd.js +0 -17
- package/dist/scope-subcommands/scope-set.cmd.js.map +1 -1
- package/dist/ui/index.js +0 -3
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/workspace/default-component.js.map +1 -1
- package/dist/ui/workspace/index.js +0 -2
- package/dist/ui/workspace/index.js.map +1 -1
- package/dist/ui/workspace/use-workspace.js +14 -49
- package/dist/ui/workspace/use-workspace.js.map +1 -1
- package/dist/ui/workspace/workspace-context.js +0 -7
- package/dist/ui/workspace/workspace-context.js.map +1 -1
- package/dist/ui/workspace/workspace-model.js +2 -14
- package/dist/ui/workspace/workspace-model.js.map +1 -1
- package/dist/ui/workspace/workspace-overview/index.js +0 -3
- package/dist/ui/workspace/workspace-overview/index.js.map +1 -1
- package/dist/ui/workspace/workspace-overview/workspace-overview.js +0 -23
- package/dist/ui/workspace/workspace-overview/workspace-overview.js.map +1 -1
- package/dist/ui/workspace/workspace-provider.js +0 -8
- package/dist/ui/workspace/workspace-provider.js.map +1 -1
- package/dist/ui/workspace/workspace.js +2 -52
- package/dist/ui/workspace/workspace.js.map +1 -1
- package/dist/use.cmd.js +0 -13
- package/dist/use.cmd.js.map +1 -1
- package/dist/watch/check-types.js +0 -1
- package/dist/watch/check-types.js.map +1 -1
- package/dist/watch/output-formatter.js +1 -12
- package/dist/watch/output-formatter.js.map +1 -1
- package/dist/watch/watch-queue.js +0 -13
- package/dist/watch/watch-queue.js.map +1 -1
- package/dist/watch/watch.cmd.js +6 -41
- package/dist/watch/watch.cmd.js.map +1 -1
- package/dist/watch/watcher.js +13 -133
- package/dist/watch/watcher.js.map +1 -1
- package/dist/workspace-component/component-status.js +0 -4
- package/dist/workspace-component/component-status.js.map +1 -1
- package/dist/workspace-component/index.js +0 -6
- package/dist/workspace-component/index.js.map +1 -1
- package/dist/workspace-component/workspace-component-loader.js +31 -116
- package/dist/workspace-component/workspace-component-loader.js.map +1 -1
- package/dist/workspace-component/workspace-component.js +1 -11
- package/dist/workspace-component/workspace-component.js.map +1 -1
- package/dist/workspace-section.js +2 -0
- package/dist/workspace-section.js.map +1 -1
- package/dist/workspace.aspect.js +0 -5
- package/dist/workspace.aspect.js.map +1 -1
- package/dist/workspace.composition.js +0 -6
- package/dist/workspace.composition.js.map +1 -1
- package/dist/workspace.d.ts +1 -0
- package/dist/workspace.graphql.js +0 -12
- package/dist/workspace.graphql.js.map +1 -1
- package/dist/workspace.js +141 -545
- package/dist/workspace.js.map +1 -1
- package/dist/workspace.main.runtime.js +0 -55
- package/dist/workspace.main.runtime.js.map +1 -1
- package/dist/workspace.provider.js +8 -77
- package/dist/workspace.provider.js.map +1 -1
- package/dist/workspace.ui-root.js +3 -17
- package/dist/workspace.ui-root.js.map +1 -1
- package/dist/workspace.ui.drawer.js +2 -24
- package/dist/workspace.ui.drawer.js.map +1 -1
- package/dist/workspace.ui.runtime.js +0 -75
- package/dist/workspace.ui.runtime.js.map +1 -1
- package/package-tar/teambit-workspace-0.0.883.tgz +0 -0
- package/package.json +18 -18
- package/{preview-1666409808293.js → preview-1666582798766.js} +2 -2
- package/workspace-component/workspace-component-loader.ts +13 -3
- package/package-tar/teambit-workspace-0.0.881.tgz +0 -0
package/dist/bit-map.js
CHANGED
|
@@ -1,42 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
require("core-js/modules/es.promise.js");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.BitMap = void 0;
|
|
9
|
-
|
|
10
8
|
function _lodash() {
|
|
11
9
|
const data = require("lodash");
|
|
12
|
-
|
|
13
10
|
_lodash = function () {
|
|
14
11
|
return data;
|
|
15
12
|
};
|
|
16
|
-
|
|
17
13
|
return data;
|
|
18
14
|
}
|
|
19
|
-
|
|
20
15
|
function _config() {
|
|
21
16
|
const data = require("@teambit/legacy/dist/consumer/config");
|
|
22
|
-
|
|
23
17
|
_config = function () {
|
|
24
18
|
return data;
|
|
25
19
|
};
|
|
26
|
-
|
|
27
20
|
return data;
|
|
28
21
|
}
|
|
29
|
-
|
|
30
22
|
function _bitError() {
|
|
31
23
|
const data = require("@teambit/bit-error");
|
|
32
|
-
|
|
33
24
|
_bitError = function () {
|
|
34
25
|
return data;
|
|
35
26
|
};
|
|
36
|
-
|
|
37
27
|
return data;
|
|
38
28
|
}
|
|
39
|
-
|
|
40
29
|
/**
|
|
41
30
|
* consider extracting to a new component.
|
|
42
31
|
* (pro: making Workspace aspect smaller. con: it's an implementation details of the workspace)
|
|
@@ -46,42 +35,37 @@ class BitMap {
|
|
|
46
35
|
this.legacyBitMap = legacyBitMap;
|
|
47
36
|
this.consumer = consumer;
|
|
48
37
|
}
|
|
38
|
+
|
|
49
39
|
/**
|
|
50
40
|
* adds component config to the .bitmap file.
|
|
51
41
|
* later, upon `bit tag`, the data is saved in the scope.
|
|
52
42
|
* returns a boolean indicating whether a change has been made.
|
|
53
43
|
*/
|
|
54
|
-
|
|
55
|
-
|
|
56
44
|
addComponentConfig(id, aspectId, config = {}, shouldMergeConfig = false) {
|
|
57
45
|
if (!aspectId || typeof aspectId !== 'string') throw new Error(`expect aspectId to be string, got ${aspectId}`);
|
|
58
46
|
const bitMapEntry = this.getBitmapEntry(id, {
|
|
59
47
|
ignoreScopeAndVersion: true
|
|
60
48
|
});
|
|
61
49
|
const currentConfig = (bitMapEntry.config || (bitMapEntry.config = {}))[aspectId];
|
|
62
|
-
|
|
63
50
|
if ((0, _lodash().isEqual)(currentConfig, config)) {
|
|
64
51
|
return false; // no changes
|
|
65
52
|
}
|
|
66
53
|
|
|
67
54
|
const getNewConfig = () => {
|
|
68
55
|
if (!config) return null;
|
|
69
|
-
if (!shouldMergeConfig) return config;
|
|
70
|
-
|
|
56
|
+
if (!shouldMergeConfig) return config;
|
|
57
|
+
// should merge
|
|
71
58
|
if (!currentConfig) return config;
|
|
72
|
-
if (currentConfig === '-') return config;
|
|
73
|
-
|
|
59
|
+
if (currentConfig === '-') return config;
|
|
60
|
+
// lodash merge performs a deep merge. (the native concatenation don't)
|
|
74
61
|
return (0, _lodash().merge)(currentConfig, config);
|
|
75
62
|
};
|
|
76
|
-
|
|
77
63
|
const newConfig = getNewConfig();
|
|
78
|
-
|
|
79
64
|
if (newConfig) {
|
|
80
65
|
bitMapEntry.config[aspectId] = newConfig;
|
|
81
66
|
} else {
|
|
82
67
|
delete bitMapEntry.config[aspectId];
|
|
83
68
|
}
|
|
84
|
-
|
|
85
69
|
this.legacyBitMap.markAsChanged();
|
|
86
70
|
return true; // changes have been made
|
|
87
71
|
}
|
|
@@ -92,7 +76,6 @@ class BitMap {
|
|
|
92
76
|
ignoreScopeAndVersion: true
|
|
93
77
|
});
|
|
94
78
|
const currentConfig = (bitMapEntry.config || (bitMapEntry.config = {}))[aspectId];
|
|
95
|
-
|
|
96
79
|
if (currentConfig) {
|
|
97
80
|
delete bitMapEntry.config[aspectId];
|
|
98
81
|
} else {
|
|
@@ -102,7 +85,6 @@ class BitMap {
|
|
|
102
85
|
|
|
103
86
|
bitMapEntry.config[aspectId] = _config().REMOVE_EXTENSION_SPECIAL_SIGN;
|
|
104
87
|
}
|
|
105
|
-
|
|
106
88
|
this.legacyBitMap.markAsChanged();
|
|
107
89
|
return true; // changes have been made
|
|
108
90
|
}
|
|
@@ -116,7 +98,6 @@ class BitMap {
|
|
|
116
98
|
this.legacyBitMap.markAsChanged();
|
|
117
99
|
return true;
|
|
118
100
|
}
|
|
119
|
-
|
|
120
101
|
setEntireConfig(id, config) {
|
|
121
102
|
const bitMapEntry = this.getBitmapEntry(id, {
|
|
122
103
|
ignoreScopeAndVersion: true
|
|
@@ -124,18 +105,15 @@ class BitMap {
|
|
|
124
105
|
bitMapEntry.config = config;
|
|
125
106
|
this.legacyBitMap.markAsChanged();
|
|
126
107
|
}
|
|
127
|
-
|
|
128
108
|
removeDefaultScope(id) {
|
|
129
109
|
const bitMapEntry = this.getBitmapEntry(id, {
|
|
130
110
|
ignoreScopeAndVersion: true
|
|
131
111
|
});
|
|
132
|
-
|
|
133
112
|
if (bitMapEntry.defaultScope) {
|
|
134
113
|
delete bitMapEntry.defaultScope;
|
|
135
114
|
this.legacyBitMap.markAsChanged();
|
|
136
115
|
}
|
|
137
116
|
}
|
|
138
|
-
|
|
139
117
|
setDefaultScope(id, defaultScope) {
|
|
140
118
|
const bitMapEntry = this.getBitmapEntry(id, {
|
|
141
119
|
ignoreScopeAndVersion: true
|
|
@@ -143,19 +121,17 @@ class BitMap {
|
|
|
143
121
|
bitMapEntry.defaultScope = defaultScope;
|
|
144
122
|
this.legacyBitMap.markAsChanged();
|
|
145
123
|
}
|
|
124
|
+
|
|
146
125
|
/**
|
|
147
126
|
* write .bitmap object to the filesystem
|
|
148
127
|
*/
|
|
149
|
-
|
|
150
|
-
|
|
151
128
|
async write() {
|
|
152
129
|
await this.consumer.writeBitMap();
|
|
153
130
|
}
|
|
131
|
+
|
|
154
132
|
/**
|
|
155
133
|
* get the data saved in the .bitmap file for this component-id.
|
|
156
134
|
*/
|
|
157
|
-
|
|
158
|
-
|
|
159
135
|
getBitmapEntry(id, {
|
|
160
136
|
ignoreVersion,
|
|
161
137
|
ignoreScopeAndVersion
|
|
@@ -165,81 +141,64 @@ class BitMap {
|
|
|
165
141
|
ignoreScopeAndVersion
|
|
166
142
|
});
|
|
167
143
|
}
|
|
168
|
-
|
|
169
144
|
getAspectIdFromConfig(componentId, aspectId, ignoreAspectVersion = false) {
|
|
170
145
|
const bitMapEntry = this.getBitmapEntry(componentId);
|
|
171
146
|
const config = bitMapEntry.config;
|
|
172
|
-
|
|
173
147
|
if (!config) {
|
|
174
148
|
return undefined;
|
|
175
149
|
}
|
|
176
|
-
|
|
177
150
|
if (config[aspectId.toString()]) {
|
|
178
151
|
return aspectId.toString();
|
|
179
152
|
}
|
|
180
|
-
|
|
181
153
|
if (!ignoreAspectVersion) {
|
|
182
154
|
return undefined;
|
|
183
155
|
}
|
|
184
|
-
|
|
185
156
|
const allVersions = Object.keys(config).filter(id => id.startsWith(`${aspectId.toStringWithoutVersion()}@`));
|
|
186
|
-
|
|
187
157
|
if (allVersions.length > 1) {
|
|
188
158
|
throw new (_bitError().BitError)(`error: the same aspect ${aspectId.toStringWithoutVersion} configured multiple times for "${componentId.toString()}"\n${allVersions.join('\n')}`);
|
|
189
159
|
}
|
|
190
|
-
|
|
191
160
|
return allVersions.length === 1 ? allVersions[0] : undefined;
|
|
192
161
|
}
|
|
162
|
+
|
|
193
163
|
/**
|
|
194
164
|
* components that were not tagged yet are safe to rename them from the .bitmap file.
|
|
195
165
|
*/
|
|
196
|
-
|
|
197
|
-
|
|
198
166
|
renameNewComponent(sourceId, targetId) {
|
|
199
167
|
const bitMapEntry = this.getBitmapEntry(sourceId);
|
|
200
|
-
|
|
201
168
|
if (bitMapEntry.id.hasVersion()) {
|
|
202
169
|
throw new Error(`unable to rename tagged or exported component: ${bitMapEntry.id.toString()}`);
|
|
203
170
|
}
|
|
204
|
-
|
|
205
171
|
if (sourceId.isEqual(targetId)) {
|
|
206
172
|
throw new Error(`source-id and target-id are equal: "${sourceId.toString()}"`);
|
|
207
173
|
}
|
|
208
|
-
|
|
209
174
|
if (sourceId.fullName !== targetId.fullName) {
|
|
210
175
|
this.legacyBitMap.removeComponent(bitMapEntry.id);
|
|
211
176
|
bitMapEntry.id = targetId._legacy;
|
|
212
177
|
this.legacyBitMap.setComponent(bitMapEntry.id, bitMapEntry);
|
|
213
178
|
}
|
|
214
|
-
|
|
215
179
|
if (sourceId.scope !== targetId.scope) {
|
|
216
180
|
this.setDefaultScope(targetId, targetId.scope);
|
|
217
181
|
}
|
|
218
182
|
}
|
|
219
|
-
|
|
220
183
|
removeComponent(id) {
|
|
221
184
|
this.legacyBitMap.removeComponent(id._legacy);
|
|
222
185
|
}
|
|
186
|
+
|
|
223
187
|
/**
|
|
224
188
|
* this is the lane-id of the recently exported lane. in case of a new lane, which was not exported yet, this will be
|
|
225
189
|
* empty.
|
|
226
190
|
*/
|
|
227
|
-
|
|
228
|
-
|
|
229
191
|
getExportedLaneId() {
|
|
230
192
|
return this.legacyBitMap.isLaneExported ? this.legacyBitMap.laneId : undefined;
|
|
231
193
|
}
|
|
194
|
+
|
|
232
195
|
/**
|
|
233
196
|
* whether .bitmap file has changed in-memory
|
|
234
197
|
*/
|
|
235
|
-
|
|
236
|
-
|
|
237
198
|
hasChanged() {
|
|
238
199
|
return this.legacyBitMap.hasChanged;
|
|
239
200
|
}
|
|
240
|
-
|
|
241
201
|
}
|
|
242
|
-
|
|
243
202
|
exports.BitMap = BitMap;
|
|
244
203
|
|
|
245
204
|
//# sourceMappingURL=bit-map.js.map
|
package/dist/bit-map.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["BitMap","constructor","legacyBitMap","consumer","addComponentConfig","id","aspectId","config","shouldMergeConfig","Error","bitMapEntry","getBitmapEntry","ignoreScopeAndVersion","currentConfig","isEqual","getNewConfig","merge","newConfig","markAsChanged","removeComponentConfig","markWithMinusIfNotExist","REMOVE_EXTENSION_SPECIAL_SIGN","removeEntireConfig","setEntireConfig","removeDefaultScope","defaultScope","setDefaultScope","write","writeBitMap","ignoreVersion","getComponent","_legacy","getAspectIdFromConfig","componentId","ignoreAspectVersion","undefined","toString","allVersions","Object","keys","filter","startsWith","toStringWithoutVersion","length","BitError","join","renameNewComponent","sourceId","targetId","hasVersion","fullName","removeComponent","setComponent","scope","getExportedLaneId","isLaneExported","laneId","hasChanged"],"sources":["bit-map.ts"],"sourcesContent":["import { isEqual, merge } from 'lodash';\nimport { ComponentID } from '@teambit/component-id';\nimport LegacyBitMap from '@teambit/legacy/dist/consumer/bit-map';\nimport { Consumer } from '@teambit/legacy/dist/consumer';\nimport { GetBitMapComponentOptions } from '@teambit/legacy/dist/consumer/bit-map/bit-map';\nimport ComponentMap from '@teambit/legacy/dist/consumer/bit-map/component-map';\nimport { REMOVE_EXTENSION_SPECIAL_SIGN } from '@teambit/legacy/dist/consumer/config';\nimport { BitError } from '@teambit/bit-error';\nimport { LaneId } from '@teambit/lane-id';\n/**\n * consider extracting to a new component.\n * (pro: making Workspace aspect smaller. con: it's an implementation details of the workspace)\n */\nexport class BitMap {\n constructor(private legacyBitMap: LegacyBitMap, private consumer: Consumer) {}\n\n /**\n * adds component config to the .bitmap file.\n * later, upon `bit tag`, the data is saved in the scope.\n * returns a boolean indicating whether a change has been made.\n */\n addComponentConfig(\n id: ComponentID,\n aspectId: string,\n config: Record<string, any> = {},\n shouldMergeConfig = false\n ): boolean {\n if (!aspectId || typeof aspectId !== 'string') throw new Error(`expect aspectId to be string, got ${aspectId}`);\n const bitMapEntry = this.getBitmapEntry(id, { ignoreScopeAndVersion: true });\n const currentConfig = (bitMapEntry.config ||= {})[aspectId];\n if (isEqual(currentConfig, config)) {\n return false; // no changes\n }\n const getNewConfig = () => {\n if (!config) return null;\n if (!shouldMergeConfig) return config;\n // should merge\n if (!currentConfig) return config;\n if (currentConfig === '-') return config;\n // lodash merge performs a deep merge. (the native concatenation don't)\n return merge(currentConfig, config);\n };\n const newConfig = getNewConfig();\n if (newConfig) {\n bitMapEntry.config[aspectId] = newConfig;\n } else {\n delete bitMapEntry.config[aspectId];\n }\n this.legacyBitMap.markAsChanged();\n\n return true; // changes have been made\n }\n\n removeComponentConfig(id: ComponentID, aspectId: string, markWithMinusIfNotExist: boolean): boolean {\n if (!aspectId || typeof aspectId !== 'string') throw new Error(`expect aspectId to be string, got ${aspectId}`);\n const bitMapEntry = this.getBitmapEntry(id, { ignoreScopeAndVersion: true });\n const currentConfig = (bitMapEntry.config ||= {})[aspectId];\n if (currentConfig) {\n delete bitMapEntry.config[aspectId];\n } else {\n if (!markWithMinusIfNotExist) {\n return false; // no changes\n }\n bitMapEntry.config[aspectId] = REMOVE_EXTENSION_SPECIAL_SIGN;\n }\n\n this.legacyBitMap.markAsChanged();\n\n return true; // changes have been made\n }\n\n removeEntireConfig(id: ComponentID): boolean {\n const bitMapEntry = this.getBitmapEntry(id, { ignoreScopeAndVersion: true });\n if (!bitMapEntry.config) return false;\n delete bitMapEntry.config;\n this.legacyBitMap.markAsChanged();\n return true;\n }\n\n setEntireConfig(id: ComponentID, config: Record<string, any>) {\n const bitMapEntry = this.getBitmapEntry(id, { ignoreScopeAndVersion: true });\n bitMapEntry.config = config;\n this.legacyBitMap.markAsChanged();\n }\n\n removeDefaultScope(id: ComponentID) {\n const bitMapEntry = this.getBitmapEntry(id, { ignoreScopeAndVersion: true });\n if (bitMapEntry.defaultScope) {\n delete bitMapEntry.defaultScope;\n this.legacyBitMap.markAsChanged();\n }\n }\n\n setDefaultScope(id: ComponentID, defaultScope: string) {\n const bitMapEntry = this.getBitmapEntry(id, { ignoreScopeAndVersion: true });\n bitMapEntry.defaultScope = defaultScope;\n this.legacyBitMap.markAsChanged();\n }\n\n /**\n * write .bitmap object to the filesystem\n */\n async write() {\n await this.consumer.writeBitMap();\n }\n\n /**\n * get the data saved in the .bitmap file for this component-id.\n */\n getBitmapEntry(\n id: ComponentID,\n { ignoreVersion, ignoreScopeAndVersion }: GetBitMapComponentOptions = {}\n ): ComponentMap {\n return this.legacyBitMap.getComponent(id._legacy, { ignoreVersion, ignoreScopeAndVersion });\n }\n\n getAspectIdFromConfig(\n componentId: ComponentID,\n aspectId: ComponentID,\n ignoreAspectVersion = false\n ): string | undefined {\n const bitMapEntry = this.getBitmapEntry(componentId);\n const config = bitMapEntry.config;\n if (!config) {\n return undefined;\n }\n if (config[aspectId.toString()]) {\n return aspectId.toString();\n }\n if (!ignoreAspectVersion) {\n return undefined;\n }\n const allVersions = Object.keys(config).filter((id) => id.startsWith(`${aspectId.toStringWithoutVersion()}@`));\n if (allVersions.length > 1) {\n throw new BitError(\n `error: the same aspect ${\n aspectId.toStringWithoutVersion\n } configured multiple times for \"${componentId.toString()}\"\\n${allVersions.join('\\n')}`\n );\n }\n return allVersions.length === 1 ? allVersions[0] : undefined;\n }\n\n /**\n * components that were not tagged yet are safe to rename them from the .bitmap file.\n */\n renameNewComponent(sourceId: ComponentID, targetId: ComponentID) {\n const bitMapEntry = this.getBitmapEntry(sourceId);\n if (bitMapEntry.id.hasVersion()) {\n throw new Error(`unable to rename tagged or exported component: ${bitMapEntry.id.toString()}`);\n }\n if (sourceId.isEqual(targetId)) {\n throw new Error(`source-id and target-id are equal: \"${sourceId.toString()}\"`);\n }\n if (sourceId.fullName !== targetId.fullName) {\n this.legacyBitMap.removeComponent(bitMapEntry.id);\n bitMapEntry.id = targetId._legacy;\n this.legacyBitMap.setComponent(bitMapEntry.id, bitMapEntry);\n }\n if (sourceId.scope !== targetId.scope) {\n this.setDefaultScope(targetId, targetId.scope);\n }\n }\n\n removeComponent(id: ComponentID) {\n this.legacyBitMap.removeComponent(id._legacy);\n }\n\n /**\n * this is the lane-id of the recently exported lane. in case of a new lane, which was not exported yet, this will be\n * empty.\n */\n getExportedLaneId(): LaneId | undefined {\n return this.legacyBitMap.isLaneExported ? this.legacyBitMap.laneId : undefined;\n }\n\n /**\n * whether .bitmap file has changed in-memory\n */\n hasChanged(): boolean {\n return this.legacyBitMap.hasChanged;\n }\n}\n"],"mappings":";;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAMA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;AACA;AACA;AACA;AACO,MAAMA,MAAN,CAAa;EAClBC,WAAW,CAASC,YAAT,EAA6CC,QAA7C,EAAiE;IAAA,KAAxDD,YAAwD,GAAxDA,YAAwD;IAAA,KAApBC,QAAoB,GAApBA,QAAoB;EAAE;EAE9E;AACF;AACA;AACA;AACA;;;EACEC,kBAAkB,CAChBC,EADgB,EAEhBC,QAFgB,EAGhBC,MAA2B,GAAG,EAHd,EAIhBC,iBAAiB,GAAG,KAJJ,EAKP;IACT,IAAI,CAACF,QAAD,I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EAED;AACF;AACA;AACA;;;EACEuB,iBAAiB,GAAuB;IACtC,OAAO,KAAKpD,YAAL,CAAkBqD,cAAlB,GAAmC,KAAKrD,YAAL,CAAkBsD,MAArD,GAA8DrB,SAArE;EACD;EAED;AACF;AACA;;;EACEsB,UAAU,GAAY;IACpB,OAAO,KAAKvD,YAAL,CAAkBuD,UAAzB;EACD;;AAxKiB"}
|
|
1
|
+
{"version":3,"names":["BitMap","constructor","legacyBitMap","consumer","addComponentConfig","id","aspectId","config","shouldMergeConfig","Error","bitMapEntry","getBitmapEntry","ignoreScopeAndVersion","currentConfig","isEqual","getNewConfig","merge","newConfig","markAsChanged","removeComponentConfig","markWithMinusIfNotExist","REMOVE_EXTENSION_SPECIAL_SIGN","removeEntireConfig","setEntireConfig","removeDefaultScope","defaultScope","setDefaultScope","write","writeBitMap","ignoreVersion","getComponent","_legacy","getAspectIdFromConfig","componentId","ignoreAspectVersion","undefined","toString","allVersions","Object","keys","filter","startsWith","toStringWithoutVersion","length","BitError","join","renameNewComponent","sourceId","targetId","hasVersion","fullName","removeComponent","setComponent","scope","getExportedLaneId","isLaneExported","laneId","hasChanged"],"sources":["bit-map.ts"],"sourcesContent":["import { isEqual, merge } from 'lodash';\nimport { ComponentID } from '@teambit/component-id';\nimport LegacyBitMap from '@teambit/legacy/dist/consumer/bit-map';\nimport { Consumer } from '@teambit/legacy/dist/consumer';\nimport { GetBitMapComponentOptions } from '@teambit/legacy/dist/consumer/bit-map/bit-map';\nimport ComponentMap from '@teambit/legacy/dist/consumer/bit-map/component-map';\nimport { REMOVE_EXTENSION_SPECIAL_SIGN } from '@teambit/legacy/dist/consumer/config';\nimport { BitError } from '@teambit/bit-error';\nimport { LaneId } from '@teambit/lane-id';\n/**\n * consider extracting to a new component.\n * (pro: making Workspace aspect smaller. con: it's an implementation details of the workspace)\n */\nexport class BitMap {\n constructor(private legacyBitMap: LegacyBitMap, private consumer: Consumer) {}\n\n /**\n * adds component config to the .bitmap file.\n * later, upon `bit tag`, the data is saved in the scope.\n * returns a boolean indicating whether a change has been made.\n */\n addComponentConfig(\n id: ComponentID,\n aspectId: string,\n config: Record<string, any> = {},\n shouldMergeConfig = false\n ): boolean {\n if (!aspectId || typeof aspectId !== 'string') throw new Error(`expect aspectId to be string, got ${aspectId}`);\n const bitMapEntry = this.getBitmapEntry(id, { ignoreScopeAndVersion: true });\n const currentConfig = (bitMapEntry.config ||= {})[aspectId];\n if (isEqual(currentConfig, config)) {\n return false; // no changes\n }\n const getNewConfig = () => {\n if (!config) return null;\n if (!shouldMergeConfig) return config;\n // should merge\n if (!currentConfig) return config;\n if (currentConfig === '-') return config;\n // lodash merge performs a deep merge. (the native concatenation don't)\n return merge(currentConfig, config);\n };\n const newConfig = getNewConfig();\n if (newConfig) {\n bitMapEntry.config[aspectId] = newConfig;\n } else {\n delete bitMapEntry.config[aspectId];\n }\n this.legacyBitMap.markAsChanged();\n\n return true; // changes have been made\n }\n\n removeComponentConfig(id: ComponentID, aspectId: string, markWithMinusIfNotExist: boolean): boolean {\n if (!aspectId || typeof aspectId !== 'string') throw new Error(`expect aspectId to be string, got ${aspectId}`);\n const bitMapEntry = this.getBitmapEntry(id, { ignoreScopeAndVersion: true });\n const currentConfig = (bitMapEntry.config ||= {})[aspectId];\n if (currentConfig) {\n delete bitMapEntry.config[aspectId];\n } else {\n if (!markWithMinusIfNotExist) {\n return false; // no changes\n }\n bitMapEntry.config[aspectId] = REMOVE_EXTENSION_SPECIAL_SIGN;\n }\n\n this.legacyBitMap.markAsChanged();\n\n return true; // changes have been made\n }\n\n removeEntireConfig(id: ComponentID): boolean {\n const bitMapEntry = this.getBitmapEntry(id, { ignoreScopeAndVersion: true });\n if (!bitMapEntry.config) return false;\n delete bitMapEntry.config;\n this.legacyBitMap.markAsChanged();\n return true;\n }\n\n setEntireConfig(id: ComponentID, config: Record<string, any>) {\n const bitMapEntry = this.getBitmapEntry(id, { ignoreScopeAndVersion: true });\n bitMapEntry.config = config;\n this.legacyBitMap.markAsChanged();\n }\n\n removeDefaultScope(id: ComponentID) {\n const bitMapEntry = this.getBitmapEntry(id, { ignoreScopeAndVersion: true });\n if (bitMapEntry.defaultScope) {\n delete bitMapEntry.defaultScope;\n this.legacyBitMap.markAsChanged();\n }\n }\n\n setDefaultScope(id: ComponentID, defaultScope: string) {\n const bitMapEntry = this.getBitmapEntry(id, { ignoreScopeAndVersion: true });\n bitMapEntry.defaultScope = defaultScope;\n this.legacyBitMap.markAsChanged();\n }\n\n /**\n * write .bitmap object to the filesystem\n */\n async write() {\n await this.consumer.writeBitMap();\n }\n\n /**\n * get the data saved in the .bitmap file for this component-id.\n */\n getBitmapEntry(\n id: ComponentID,\n { ignoreVersion, ignoreScopeAndVersion }: GetBitMapComponentOptions = {}\n ): ComponentMap {\n return this.legacyBitMap.getComponent(id._legacy, { ignoreVersion, ignoreScopeAndVersion });\n }\n\n getAspectIdFromConfig(\n componentId: ComponentID,\n aspectId: ComponentID,\n ignoreAspectVersion = false\n ): string | undefined {\n const bitMapEntry = this.getBitmapEntry(componentId);\n const config = bitMapEntry.config;\n if (!config) {\n return undefined;\n }\n if (config[aspectId.toString()]) {\n return aspectId.toString();\n }\n if (!ignoreAspectVersion) {\n return undefined;\n }\n const allVersions = Object.keys(config).filter((id) => id.startsWith(`${aspectId.toStringWithoutVersion()}@`));\n if (allVersions.length > 1) {\n throw new BitError(\n `error: the same aspect ${\n aspectId.toStringWithoutVersion\n } configured multiple times for \"${componentId.toString()}\"\\n${allVersions.join('\\n')}`\n );\n }\n return allVersions.length === 1 ? allVersions[0] : undefined;\n }\n\n /**\n * components that were not tagged yet are safe to rename them from the .bitmap file.\n */\n renameNewComponent(sourceId: ComponentID, targetId: ComponentID) {\n const bitMapEntry = this.getBitmapEntry(sourceId);\n if (bitMapEntry.id.hasVersion()) {\n throw new Error(`unable to rename tagged or exported component: ${bitMapEntry.id.toString()}`);\n }\n if (sourceId.isEqual(targetId)) {\n throw new Error(`source-id and target-id are equal: \"${sourceId.toString()}\"`);\n }\n if (sourceId.fullName !== targetId.fullName) {\n this.legacyBitMap.removeComponent(bitMapEntry.id);\n bitMapEntry.id = targetId._legacy;\n this.legacyBitMap.setComponent(bitMapEntry.id, bitMapEntry);\n }\n if (sourceId.scope !== targetId.scope) {\n this.setDefaultScope(targetId, targetId.scope);\n }\n }\n\n removeComponent(id: ComponentID) {\n this.legacyBitMap.removeComponent(id._legacy);\n }\n\n /**\n * this is the lane-id of the recently exported lane. in case of a new lane, which was not exported yet, this will be\n * empty.\n */\n getExportedLaneId(): LaneId | undefined {\n return this.legacyBitMap.isLaneExported ? this.legacyBitMap.laneId : undefined;\n }\n\n /**\n * whether .bitmap file has changed in-memory\n */\n hasChanged(): boolean {\n return this.legacyBitMap.hasChanged;\n }\n}\n"],"mappings":";;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAMA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;AACA;AACA;AACA;AACO,MAAMA,MAAM,CAAC;EAClBC,WAAW,CAASC,YAA0B,EAAUC,QAAkB,EAAE;IAAA,KAAxDD,YAA0B,GAA1BA,YAA0B;IAAA,KAAUC,QAAkB,GAAlBA,QAAkB;EAAG;;EAE7E;AACF;AACA;AACA;AACA;EACEC,kBAAkB,CAChBC,EAAe,EACfC,QAAgB,EAChBC,MAA2B,GAAG,CAAC,CAAC,EAChCC,iBAAiB,GAAG,KAAK,EAChB;IACT,IAAI,CAACF,QAAQ,IAAI,OAAOA,QAAQ,KAAK,QAAQ,EAAE,MAAM,IAAIG,KAAK,CAAE,qCAAoCH,QAAS,EAAC,CAAC;IAC/G,MAAMI,WAAW,GAAG,IAAI,CAACC,cAAc,CAACN,EAAE,EAAE;MAAEO,qBAAqB,EAAE;IAAK,CAAC,CAAC;IAC5E,MAAMC,aAAa,GAAG,CAACH,WAAW,CAACH,MAAM,KAAlBG,WAAW,CAACH,MAAM,GAAK,CAAC,CAAC,G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
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
require("core-js/modules/es.array.flat.js");
|
|
6
|
-
|
|
7
5
|
require("core-js/modules/es.array.iterator.js");
|
|
8
|
-
|
|
9
6
|
require("core-js/modules/es.array.unscopables.flat.js");
|
|
10
|
-
|
|
11
7
|
require("core-js/modules/es.promise.js");
|
|
12
|
-
|
|
13
8
|
Object.defineProperty(exports, "__esModule", {
|
|
14
9
|
value: true
|
|
15
10
|
});
|
|
16
11
|
exports.GraphFromFsBuilder = void 0;
|
|
17
|
-
|
|
18
12
|
function _defineProperty2() {
|
|
19
13
|
const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
20
|
-
|
|
21
14
|
_defineProperty2 = function () {
|
|
22
15
|
return data;
|
|
23
16
|
};
|
|
24
|
-
|
|
25
17
|
return data;
|
|
26
18
|
}
|
|
27
|
-
|
|
28
19
|
function _pMapSeries() {
|
|
29
20
|
const data = _interopRequireDefault(require("p-map-series"));
|
|
30
|
-
|
|
31
21
|
_pMapSeries = function () {
|
|
32
22
|
return data;
|
|
33
23
|
};
|
|
34
|
-
|
|
35
24
|
return data;
|
|
36
25
|
}
|
|
37
|
-
|
|
38
26
|
function _lodash() {
|
|
39
27
|
const data = require("lodash");
|
|
40
|
-
|
|
41
28
|
_lodash = function () {
|
|
42
29
|
return data;
|
|
43
30
|
};
|
|
44
|
-
|
|
45
31
|
return data;
|
|
46
32
|
}
|
|
47
|
-
|
|
48
33
|
function _bitIds() {
|
|
49
34
|
const data = _interopRequireDefault(require("@teambit/legacy/dist/bit-id/bit-ids"));
|
|
50
|
-
|
|
51
35
|
_bitIds = function () {
|
|
52
36
|
return data;
|
|
53
37
|
};
|
|
54
|
-
|
|
55
38
|
return data;
|
|
56
39
|
}
|
|
57
|
-
|
|
58
40
|
function _graph() {
|
|
59
41
|
const data = _interopRequireDefault(require("@teambit/legacy/dist/scope/graph/graph"));
|
|
60
|
-
|
|
61
42
|
_graph = function () {
|
|
62
43
|
return data;
|
|
63
44
|
};
|
|
64
|
-
|
|
65
45
|
return data;
|
|
66
46
|
}
|
|
67
|
-
|
|
68
47
|
function _scopeComponentsImporter() {
|
|
69
48
|
const data = _interopRequireDefault(require("@teambit/legacy/dist/scope/component-ops/scope-components-importer"));
|
|
70
|
-
|
|
71
49
|
_scopeComponentsImporter = function () {
|
|
72
50
|
return data;
|
|
73
51
|
};
|
|
74
|
-
|
|
75
52
|
return data;
|
|
76
53
|
}
|
|
77
|
-
|
|
78
54
|
function _exceptions() {
|
|
79
55
|
const data = require("@teambit/legacy/dist/scope/exceptions");
|
|
80
|
-
|
|
81
56
|
_exceptions = function () {
|
|
82
57
|
return data;
|
|
83
58
|
};
|
|
84
|
-
|
|
85
59
|
return data;
|
|
86
60
|
}
|
|
87
|
-
|
|
88
61
|
function _scope() {
|
|
89
62
|
const data = require("@teambit/scope");
|
|
90
|
-
|
|
91
63
|
_scope = function () {
|
|
92
64
|
return data;
|
|
93
65
|
};
|
|
94
|
-
|
|
95
66
|
return data;
|
|
96
67
|
}
|
|
97
|
-
|
|
98
68
|
function _lodash2() {
|
|
99
69
|
const data = _interopRequireDefault(require("lodash.compact"));
|
|
100
|
-
|
|
101
70
|
_lodash2 = function () {
|
|
102
71
|
return data;
|
|
103
72
|
};
|
|
104
|
-
|
|
105
73
|
return data;
|
|
106
74
|
}
|
|
107
|
-
|
|
108
75
|
function _bitError() {
|
|
109
76
|
const data = require("@teambit/bit-error");
|
|
110
|
-
|
|
111
77
|
_bitError = function () {
|
|
112
78
|
return data;
|
|
113
79
|
};
|
|
114
|
-
|
|
115
80
|
return data;
|
|
116
81
|
}
|
|
117
|
-
|
|
118
82
|
class GraphFromFsBuilder {
|
|
119
83
|
constructor(workspace, logger, ignoreIds = new (_bitIds().default)(), shouldLoadItsDeps, shouldThrowOnMissingDep = true) {
|
|
120
84
|
this.workspace = workspace;
|
|
@@ -128,6 +92,7 @@ class GraphFromFsBuilder {
|
|
|
128
92
|
(0, _defineProperty2().default)(this, "consumer", void 0);
|
|
129
93
|
this.consumer = this.workspace.consumer;
|
|
130
94
|
}
|
|
95
|
+
|
|
131
96
|
/**
|
|
132
97
|
* create a graph with all dependencies and flattened dependencies of the given components.
|
|
133
98
|
* the nodes are components and the edges has a label of the dependency type.
|
|
@@ -158,8 +123,6 @@ class GraphFromFsBuilder {
|
|
|
158
123
|
* however, since this buildGraph is performed on the workspace, a dependency may be new or
|
|
159
124
|
* modified and as such, we don't know its flattened yet.
|
|
160
125
|
*/
|
|
161
|
-
|
|
162
|
-
|
|
163
126
|
async buildGraph(ids) {
|
|
164
127
|
this.logger.debug(`GraphFromFsBuilder, buildGraph with ${ids.length} seeders`);
|
|
165
128
|
const start = Date.now();
|
|
@@ -168,11 +131,9 @@ class GraphFromFsBuilder {
|
|
|
168
131
|
this.logger.debug(`GraphFromFsBuilder, buildGraph with ${ids.length} seeders completed (${(Date.now() - start) / 1000} sec)`);
|
|
169
132
|
return this.graph;
|
|
170
133
|
}
|
|
171
|
-
|
|
172
134
|
getAllDepsUnfiltered(component) {
|
|
173
135
|
return component.getAllDependenciesIds().difference(this.ignoreIds);
|
|
174
136
|
}
|
|
175
|
-
|
|
176
137
|
async getAllDepsFiltered(component) {
|
|
177
138
|
const depsWithoutIgnore = this.getAllDepsUnfiltered(component);
|
|
178
139
|
const shouldLoadFunc = this.shouldLoadItsDeps;
|
|
@@ -184,7 +145,6 @@ class GraphFromFsBuilder {
|
|
|
184
145
|
});
|
|
185
146
|
return _bitIds().default.fromArray((0, _lodash2().default)(deps));
|
|
186
147
|
}
|
|
187
|
-
|
|
188
148
|
async processManyComponents(components) {
|
|
189
149
|
this.logger.debug(`GraphFromFsBuilder.processManyComponents depth ${this.depth}, ${components.length} components`);
|
|
190
150
|
this.depth += 1;
|
|
@@ -193,7 +153,6 @@ class GraphFromFsBuilder {
|
|
|
193
153
|
const allDependenciesFlattened = (0, _lodash().flatten)(allDependencies);
|
|
194
154
|
if (allDependenciesFlattened.length) await this.processManyComponents(allDependenciesFlattened);
|
|
195
155
|
}
|
|
196
|
-
|
|
197
156
|
async importObjects(components) {
|
|
198
157
|
const allDeps = components.map(c => this.getAllDepsUnfiltered(c)).flat();
|
|
199
158
|
const allDepsWithScope = allDeps.filter(dep => dep.hasScope());
|
|
@@ -205,7 +164,6 @@ class GraphFromFsBuilder {
|
|
|
205
164
|
reFetchUnBuiltVersion: false
|
|
206
165
|
});
|
|
207
166
|
}
|
|
208
|
-
|
|
209
167
|
async processOneComponent(component) {
|
|
210
168
|
const idStr = component.id.toString();
|
|
211
169
|
if (this.completed.includes(idStr)) return [];
|
|
@@ -214,29 +172,24 @@ class GraphFromFsBuilder {
|
|
|
214
172
|
Object.entries(component.depsIdsGroupedByType).forEach(([depType, depsIds]) => {
|
|
215
173
|
depsIds.forEach(depId => {
|
|
216
174
|
if (this.ignoreIds.has(depId)) return;
|
|
217
|
-
|
|
218
175
|
if (!this.graph.hasNode(depId.toString())) {
|
|
219
176
|
if (this.shouldThrowOnMissingDep) {
|
|
220
177
|
throw new Error(`buildOneComponent: missing node of ${depId.toString()}`);
|
|
221
178
|
}
|
|
222
|
-
|
|
223
179
|
this.logger.warn(`ignoring missing ${depId.toString()}`);
|
|
224
180
|
return;
|
|
225
181
|
}
|
|
226
|
-
|
|
227
182
|
this.graph.setEdge(idStr, depId.toString(), depType);
|
|
228
183
|
});
|
|
229
184
|
});
|
|
230
185
|
this.completed.push(idStr);
|
|
231
186
|
return allDependencies;
|
|
232
187
|
}
|
|
233
|
-
|
|
234
188
|
async loadManyComponents(componentsIds, dependenciesOf) {
|
|
235
189
|
const components = await (0, _pMapSeries().default)(componentsIds, async comp => {
|
|
236
190
|
const idStr = comp.toString();
|
|
237
191
|
const fromGraph = this.graph.node(idStr);
|
|
238
192
|
if (fromGraph) return fromGraph;
|
|
239
|
-
|
|
240
193
|
try {
|
|
241
194
|
const component = await this.loadComponent(comp);
|
|
242
195
|
this.graph.setNode(idStr, component);
|
|
@@ -247,25 +200,20 @@ class GraphFromFsBuilder {
|
|
|
247
200
|
this.logger.warn(`component ${idStr}, dependency of ${dependenciesOf} was not found. continuing without it`);
|
|
248
201
|
return null;
|
|
249
202
|
}
|
|
250
|
-
|
|
251
203
|
throw new (_bitError().BitError)(`error: component "${idStr}" was not found.\nthis component is a dependency of "${dependenciesOf || '<none>'}" and is needed as part of the graph generation`);
|
|
252
204
|
}
|
|
253
|
-
|
|
254
205
|
if (dependenciesOf) this.logger.error(`failed loading dependencies of ${dependenciesOf}`);
|
|
255
206
|
throw err;
|
|
256
207
|
}
|
|
257
208
|
});
|
|
258
209
|
return (0, _lodash2().default)(components);
|
|
259
210
|
}
|
|
260
|
-
|
|
261
211
|
async loadComponent(componentId) {
|
|
262
212
|
const compId = await this.workspace.resolveComponentId(componentId);
|
|
263
213
|
const comp = await this.workspace.get(compId);
|
|
264
214
|
return comp.state._consumer;
|
|
265
215
|
}
|
|
266
|
-
|
|
267
216
|
}
|
|
268
|
-
|
|
269
217
|
exports.GraphFromFsBuilder = GraphFromFsBuilder;
|
|
270
218
|
|
|
271
219
|
//# sourceMappingURL=build-graph-from-fs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["GraphFromFsBuilder","constructor","workspace","logger","ignoreIds","BitIds","shouldLoadItsDeps","shouldThrowOnMissingDep","LegacyGraph","consumer","buildGraph","ids","debug","length","start","Date","now","components","loadManyComponents","processManyComponents","graph","getAllDepsUnfiltered","component","getAllDependenciesIds","difference","getAllDepsFiltered","depsWithoutIgnore","shouldLoadFunc","deps","mapSeries","depId","shouldLoad","push","fromArray","compact","depth","importObjects","allDependencies","processOneComponent","allDependenciesFlattened","flatten","allDeps","map","c","flat","allDepsWithScope","filter","dep","hasScope","scopeComponentsImporter","ScopeComponentsImporter","scope","importMany","uniqFromArray","throwForDependencyNotFound","throwForSeederNotFound","reFetchUnBuiltVersion","idStr","id","toString","completed","includes","allIds","Object","entries","depsIdsGroupedByType","forEach","depType","depsIds","has","hasNode","Error","warn","setEdge","componentsIds","dependenciesOf","comp","fromGraph","node","loadComponent","setNode","err","ComponentNotFound","ComponentNotFoundInScope","ScopeNotFound","BitError","error","componentId","compId","resolveComponentId","get","state","_consumer"],"sources":["build-graph-from-fs.ts"],"sourcesContent":["import mapSeries from 'p-map-series';\nimport { flatten } from 'lodash';\nimport { Consumer } from '@teambit/legacy/dist/consumer';\nimport BitIds from '@teambit/legacy/dist/bit-id/bit-ids';\nimport Component from '@teambit/legacy/dist/consumer/component/consumer-component';\nimport LegacyGraph from '@teambit/legacy/dist/scope/graph/graph';\nimport ScopeComponentsImporter from '@teambit/legacy/dist/scope/component-ops/scope-components-importer';\nimport { ComponentNotFound, ScopeNotFound } from '@teambit/legacy/dist/scope/exceptions';\nimport { ComponentNotFound as ComponentNotFoundInScope } from '@teambit/scope';\nimport compact from 'lodash.compact';\nimport { BitId } from '@teambit/legacy-bit-id';\nimport { Logger } from '@teambit/logger';\nimport { BitError } from '@teambit/bit-error';\nimport { Workspace } from './workspace';\n\nexport type ShouldLoadFunc = (bitId: BitId) => Promise<boolean>;\n\nexport class GraphFromFsBuilder {\n private graph = new LegacyGraph();\n private completed: string[] = [];\n private depth = 1;\n private consumer: Consumer;\n constructor(\n private workspace: Workspace,\n private logger: Logger,\n private ignoreIds = new BitIds(),\n private shouldLoadItsDeps?: ShouldLoadFunc,\n private shouldThrowOnMissingDep = true\n ) {\n this.consumer = this.workspace.consumer;\n }\n\n /**\n * create a graph with all dependencies and flattened dependencies of the given components.\n * the nodes are components and the edges has a label of the dependency type.\n *\n * the way how it is done is iterations by depths. each depth we gather all the dependencies of\n * that depths, make sure all objects exist and then check their dependencies for the next depth.\n * once there is no dependency left, we're on the last depth level and the graph is ready.\n *\n * for example, imagine the following graph:\n * A1 -> A2 -> A3\n * B1 -> B2 -> B3\n * C1 -> C2 -> C3\n *\n * where the buildGraph is given [A1, B1, C1].\n * first, it saves all these components as nodes in the graph. then, it finds the dependencies of\n * the next level, in this case they're [A2, B2, C2]. it runs `importMany` in case some objects\n * are missing. then, it loads them all (some from FS, some from the model) and sets the edges\n * between the component and the dependencies.\n * once done, it finds all their dependencies, which are [A3, B3, C3] and repeat the process\n * above. since there are no more dependencies, the graph is completed.\n * in this case, the total depth levels are 3.\n *\n * even with a huge project, there are not many depth levels. by iterating through depth levels\n * we keep performance sane as the importMany doesn't run multiple time and therefore the round\n * trips to the remotes are minimal.\n *\n * normally, one importMany of the seeders is enough as importMany knows to fetch all flattened.\n * however, since this buildGraph is performed on the workspace, a dependency may be new or\n * modified and as such, we don't know its flattened yet.\n */\n async buildGraph(ids: BitId[]): Promise<LegacyGraph> {\n this.logger.debug(`GraphFromFsBuilder, buildGraph with ${ids.length} seeders`);\n const start = Date.now();\n const components = await this.loadManyComponents(ids);\n await this.processManyComponents(components);\n this.logger.debug(\n `GraphFromFsBuilder, buildGraph with ${ids.length} seeders completed (${(Date.now() - start) / 1000} sec)`\n );\n return this.graph;\n }\n\n private getAllDepsUnfiltered(component: Component) {\n return component.getAllDependenciesIds().difference(this.ignoreIds);\n }\n\n private async getAllDepsFiltered(component: Component): Promise<BitIds> {\n const depsWithoutIgnore = this.getAllDepsUnfiltered(component);\n const shouldLoadFunc = this.shouldLoadItsDeps;\n if (!shouldLoadFunc) return depsWithoutIgnore;\n const deps = await mapSeries(depsWithoutIgnore, async (depId) => {\n const shouldLoad = await shouldLoadFunc(depId);\n if (!shouldLoad) this.ignoreIds.push(depId);\n return shouldLoad ? depId : null;\n });\n return BitIds.fromArray(compact(deps));\n }\n\n private async processManyComponents(components: Component[]) {\n this.logger.debug(`GraphFromFsBuilder.processManyComponents depth ${this.depth}, ${components.length} components`);\n this.depth += 1;\n await this.importObjects(components);\n const allDependencies = await mapSeries(components, (component) => this.processOneComponent(component));\n const allDependenciesFlattened = flatten(allDependencies);\n if (allDependenciesFlattened.length) await this.processManyComponents(allDependenciesFlattened);\n }\n\n private async importObjects(components: Component[]) {\n const allDeps = components.map((c) => this.getAllDepsUnfiltered(c)).flat();\n const allDepsWithScope = allDeps.filter((dep) => dep.hasScope());\n const scopeComponentsImporter = new ScopeComponentsImporter(this.consumer.scope);\n await scopeComponentsImporter.importMany({\n ids: BitIds.uniqFromArray(allDepsWithScope),\n throwForDependencyNotFound: this.shouldThrowOnMissingDep,\n throwForSeederNotFound: this.shouldThrowOnMissingDep,\n reFetchUnBuiltVersion: false,\n });\n }\n\n private async processOneComponent(component: Component) {\n const idStr = component.id.toString();\n if (this.completed.includes(idStr)) return [];\n const allIds = await this.getAllDepsFiltered(component);\n\n const allDependencies = await this.loadManyComponents(allIds, idStr);\n Object.entries(component.depsIdsGroupedByType).forEach(([depType, depsIds]) => {\n depsIds.forEach((depId) => {\n if (this.ignoreIds.has(depId)) return;\n if (!this.graph.hasNode(depId.toString())) {\n if (this.shouldThrowOnMissingDep) {\n throw new Error(`buildOneComponent: missing node of ${depId.toString()}`);\n }\n this.logger.warn(`ignoring missing ${depId.toString()}`);\n return;\n }\n this.graph.setEdge(idStr, depId.toString(), depType);\n });\n });\n this.completed.push(idStr);\n return allDependencies;\n }\n\n private async loadManyComponents(componentsIds: BitId[], dependenciesOf?: string): Promise<Component[]> {\n const components = await mapSeries(componentsIds, async (comp: BitId) => {\n const idStr = comp.toString();\n const fromGraph = this.graph.node(idStr);\n if (fromGraph) return fromGraph;\n try {\n const component = await this.loadComponent(comp);\n this.graph.setNode(idStr, component);\n return component;\n } catch (err: any) {\n if (\n err instanceof ComponentNotFound ||\n err instanceof ComponentNotFoundInScope ||\n err instanceof ScopeNotFound\n ) {\n if (dependenciesOf && !this.shouldThrowOnMissingDep) {\n this.logger.warn(\n `component ${idStr}, dependency of ${dependenciesOf} was not found. continuing without it`\n );\n return null;\n }\n throw new BitError(\n `error: component \"${idStr}\" was not found.\\nthis component is a dependency of \"${\n dependenciesOf || '<none>'\n }\" and is needed as part of the graph generation`\n );\n }\n if (dependenciesOf) this.logger.error(`failed loading dependencies of ${dependenciesOf}`);\n throw err;\n }\n });\n return compact(components);\n }\n private async loadComponent(componentId: BitId): Promise<Component> {\n const compId = await this.workspace.resolveComponentId(componentId);\n const comp = await this.workspace.get(compId);\n return comp.state._consumer;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAKO,MAAMA,kBAAN,CAAyB;EAK9BC,WAAW,CACDC,SADC,EAEDC,MAFC,EAGDC,SAAS,GAAG,KAAIC,iBAAJ,GAHX,EAIDC,iBAJC,EAKDC,uBAAuB,GAAG,IALzB,EAMT;IAAA,KALQL,SAKR,GALQA,SAKR;IAAA,KAJQC,MAIR,GAJQA,MAIR;IAAA,KAHQC,SAGR,GAHQA,SAGR;IAAA,KAFQE,iBAER,GAFQA,iBAER;IAAA,KADQC,uBACR,GADQA,uBACR;IAAA,+CAVc,KAAIC,gBAAJ,GAUd;IAAA,mDAT4B,EAS5B;IAAA,+CARc,CAQd;IAAA;IACA,KAAKC,QAAL,GAAgB,KAAKP,SAAL,CAAeO,QAA/B;EACD;EAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;EACkB,MAAVC,UAAU,CAACC,GAAD,EAA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,IAAnB,CAAxB;QACA,KAAKxD,KAAL,CAAW4D,OAAX,CAAmBvB,KAAnB,EAA0BnC,SAA1B;QACA,OAAOA,SAAP;MACD,CAJD,CAIE,OAAO2D,GAAP,EAAiB;QACjB,IACEA,GAAG,YAAYC,+BAAf,IACAD,GAAG,YAAYE,0BADf,IAEAF,GAAG,YAAYG,2BAHjB,EAIE;UACA,IAAIT,cAAc,IAAI,CAAC,KAAKpE,uBAA5B,EAAqD;YACnD,KAAKJ,MAAL,CAAYqE,IAAZ,CACG,aAAYf,KAAM,mBAAkBkB,cAAe,uCADtD;YAGA,OAAO,IAAP;UACD;;UACD,MAAM,KAAIU,oBAAJ,EACH,qBAAoB5B,KAAM,wDACzBkB,cAAc,IAAI,QACnB,iDAHG,CAAN;QAKD;;QACD,IAAIA,cAAJ,EAAoB,KAAKxE,MAAL,CAAYmF,KAAZ,CAAmB,kCAAiCX,cAAe,EAAnE;QACpB,MAAMM,GAAN;MACD;IACF,CA7BwB,CAAzB;IA8BA,OAAO,IAAA/C,kBAAA,EAAQjB,UAAR,CAAP;EACD;;EAC0B,MAAb8D,aAAa,CAACQ,WAAD,EAAyC;IAClE,MAAMC,MAAM,GAAG,MAAM,KAAKtF,SAAL,CAAeuF,kBAAf,CAAkCF,WAAlC,CAArB;IACA,MAAMX,IAAI,GAAG,MAAM,KAAK1E,SAAL,CAAewF,GAAf,CAAmBF,MAAnB,CAAnB;IACA,OAAOZ,IAAI,CAACe,KAAL,CAAWC,SAAlB;EACD;;AAzJ6B"}
|
|
1
|
+
{"version":3,"names":["GraphFromFsBuilder","constructor","workspace","logger","ignoreIds","BitIds","shouldLoadItsDeps","shouldThrowOnMissingDep","LegacyGraph","consumer","buildGraph","ids","debug","length","start","Date","now","components","loadManyComponents","processManyComponents","graph","getAllDepsUnfiltered","component","getAllDependenciesIds","difference","getAllDepsFiltered","depsWithoutIgnore","shouldLoadFunc","deps","mapSeries","depId","shouldLoad","push","fromArray","compact","depth","importObjects","allDependencies","processOneComponent","allDependenciesFlattened","flatten","allDeps","map","c","flat","allDepsWithScope","filter","dep","hasScope","scopeComponentsImporter","ScopeComponentsImporter","scope","importMany","uniqFromArray","throwForDependencyNotFound","throwForSeederNotFound","reFetchUnBuiltVersion","idStr","id","toString","completed","includes","allIds","Object","entries","depsIdsGroupedByType","forEach","depType","depsIds","has","hasNode","Error","warn","setEdge","componentsIds","dependenciesOf","comp","fromGraph","node","loadComponent","setNode","err","ComponentNotFound","ComponentNotFoundInScope","ScopeNotFound","BitError","error","componentId","compId","resolveComponentId","get","state","_consumer"],"sources":["build-graph-from-fs.ts"],"sourcesContent":["import mapSeries from 'p-map-series';\nimport { flatten } from 'lodash';\nimport { Consumer } from '@teambit/legacy/dist/consumer';\nimport BitIds from '@teambit/legacy/dist/bit-id/bit-ids';\nimport Component from '@teambit/legacy/dist/consumer/component/consumer-component';\nimport LegacyGraph from '@teambit/legacy/dist/scope/graph/graph';\nimport ScopeComponentsImporter from '@teambit/legacy/dist/scope/component-ops/scope-components-importer';\nimport { ComponentNotFound, ScopeNotFound } from '@teambit/legacy/dist/scope/exceptions';\nimport { ComponentNotFound as ComponentNotFoundInScope } from '@teambit/scope';\nimport compact from 'lodash.compact';\nimport { BitId } from '@teambit/legacy-bit-id';\nimport { Logger } from '@teambit/logger';\nimport { BitError } from '@teambit/bit-error';\nimport { Workspace } from './workspace';\n\nexport type ShouldLoadFunc = (bitId: BitId) => Promise<boolean>;\n\nexport class GraphFromFsBuilder {\n private graph = new LegacyGraph();\n private completed: string[] = [];\n private depth = 1;\n private consumer: Consumer;\n constructor(\n private workspace: Workspace,\n private logger: Logger,\n private ignoreIds = new BitIds(),\n private shouldLoadItsDeps?: ShouldLoadFunc,\n private shouldThrowOnMissingDep = true\n ) {\n this.consumer = this.workspace.consumer;\n }\n\n /**\n * create a graph with all dependencies and flattened dependencies of the given components.\n * the nodes are components and the edges has a label of the dependency type.\n *\n * the way how it is done is iterations by depths. each depth we gather all the dependencies of\n * that depths, make sure all objects exist and then check their dependencies for the next depth.\n * once there is no dependency left, we're on the last depth level and the graph is ready.\n *\n * for example, imagine the following graph:\n * A1 -> A2 -> A3\n * B1 -> B2 -> B3\n * C1 -> C2 -> C3\n *\n * where the buildGraph is given [A1, B1, C1].\n * first, it saves all these components as nodes in the graph. then, it finds the dependencies of\n * the next level, in this case they're [A2, B2, C2]. it runs `importMany` in case some objects\n * are missing. then, it loads them all (some from FS, some from the model) and sets the edges\n * between the component and the dependencies.\n * once done, it finds all their dependencies, which are [A3, B3, C3] and repeat the process\n * above. since there are no more dependencies, the graph is completed.\n * in this case, the total depth levels are 3.\n *\n * even with a huge project, there are not many depth levels. by iterating through depth levels\n * we keep performance sane as the importMany doesn't run multiple time and therefore the round\n * trips to the remotes are minimal.\n *\n * normally, one importMany of the seeders is enough as importMany knows to fetch all flattened.\n * however, since this buildGraph is performed on the workspace, a dependency may be new or\n * modified and as such, we don't know its flattened yet.\n */\n async buildGraph(ids: BitId[]): Promise<LegacyGraph> {\n this.logger.debug(`GraphFromFsBuilder, buildGraph with ${ids.length} seeders`);\n const start = Date.now();\n const components = await this.loadManyComponents(ids);\n await this.processManyComponents(components);\n this.logger.debug(\n `GraphFromFsBuilder, buildGraph with ${ids.length} seeders completed (${(Date.now() - start) / 1000} sec)`\n );\n return this.graph;\n }\n\n private getAllDepsUnfiltered(component: Component) {\n return component.getAllDependenciesIds().difference(this.ignoreIds);\n }\n\n private async getAllDepsFiltered(component: Component): Promise<BitIds> {\n const depsWithoutIgnore = this.getAllDepsUnfiltered(component);\n const shouldLoadFunc = this.shouldLoadItsDeps;\n if (!shouldLoadFunc) return depsWithoutIgnore;\n const deps = await mapSeries(depsWithoutIgnore, async (depId) => {\n const shouldLoad = await shouldLoadFunc(depId);\n if (!shouldLoad) this.ignoreIds.push(depId);\n return shouldLoad ? depId : null;\n });\n return BitIds.fromArray(compact(deps));\n }\n\n private async processManyComponents(components: Component[]) {\n this.logger.debug(`GraphFromFsBuilder.processManyComponents depth ${this.depth}, ${components.length} components`);\n this.depth += 1;\n await this.importObjects(components);\n const allDependencies = await mapSeries(components, (component) => this.processOneComponent(component));\n const allDependenciesFlattened = flatten(allDependencies);\n if (allDependenciesFlattened.length) await this.processManyComponents(allDependenciesFlattened);\n }\n\n private async importObjects(components: Component[]) {\n const allDeps = components.map((c) => this.getAllDepsUnfiltered(c)).flat();\n const allDepsWithScope = allDeps.filter((dep) => dep.hasScope());\n const scopeComponentsImporter = new ScopeComponentsImporter(this.consumer.scope);\n await scopeComponentsImporter.importMany({\n ids: BitIds.uniqFromArray(allDepsWithScope),\n throwForDependencyNotFound: this.shouldThrowOnMissingDep,\n throwForSeederNotFound: this.shouldThrowOnMissingDep,\n reFetchUnBuiltVersion: false,\n });\n }\n\n private async processOneComponent(component: Component) {\n const idStr = component.id.toString();\n if (this.completed.includes(idStr)) return [];\n const allIds = await this.getAllDepsFiltered(component);\n\n const allDependencies = await this.loadManyComponents(allIds, idStr);\n Object.entries(component.depsIdsGroupedByType).forEach(([depType, depsIds]) => {\n depsIds.forEach((depId) => {\n if (this.ignoreIds.has(depId)) return;\n if (!this.graph.hasNode(depId.toString())) {\n if (this.shouldThrowOnMissingDep) {\n throw new Error(`buildOneComponent: missing node of ${depId.toString()}`);\n }\n this.logger.warn(`ignoring missing ${depId.toString()}`);\n return;\n }\n this.graph.setEdge(idStr, depId.toString(), depType);\n });\n });\n this.completed.push(idStr);\n return allDependencies;\n }\n\n private async loadManyComponents(componentsIds: BitId[], dependenciesOf?: string): Promise<Component[]> {\n const components = await mapSeries(componentsIds, async (comp: BitId) => {\n const idStr = comp.toString();\n const fromGraph = this.graph.node(idStr);\n if (fromGraph) return fromGraph;\n try {\n const component = await this.loadComponent(comp);\n this.graph.setNode(idStr, component);\n return component;\n } catch (err: any) {\n if (\n err instanceof ComponentNotFound ||\n err instanceof ComponentNotFoundInScope ||\n err instanceof ScopeNotFound\n ) {\n if (dependenciesOf && !this.shouldThrowOnMissingDep) {\n this.logger.warn(\n `component ${idStr}, dependency of ${dependenciesOf} was not found. continuing without it`\n );\n return null;\n }\n throw new BitError(\n `error: component \"${idStr}\" was not found.\\nthis component is a dependency of \"${\n dependenciesOf || '<none>'\n }\" and is needed as part of the graph generation`\n );\n }\n if (dependenciesOf) this.logger.error(`failed loading dependencies of ${dependenciesOf}`);\n throw err;\n }\n });\n return compact(components);\n }\n private async loadComponent(componentId: BitId): Promise<Component> {\n const compId = await this.workspace.resolveComponentId(componentId);\n const comp = await this.workspace.get(compId);\n return comp.state._consumer;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAKO,MAAMA,kBAAkB,CAAC;EAK9BC,WAAW,CACDC,SAAoB,EACpBC,MAAc,EACdC,SAAS,GAAG,KAAIC,iBAAM,GAAE,EACxBC,iBAAkC,EAClCC,uBAAuB,GAAG,IAAI,EACtC;IAAA,KALQL,SAAoB,GAApBA,SAAoB;IAAA,KACpBC,MAAc,GAAdA,MAAc;IAAA,KACdC,SAAS,GAATA,SAAS;IAAA,KACTE,iBAAkC,GAAlCA,iBAAkC;IAAA,KAClCC,uBAAuB,GAAvBA,uBAAuB;IAAA,+CATjB,KAAIC,gBAAW,GAAE;IAAA,mDACH,EAAE;IAAA,+CAChB,CAAC;IAAA;IASf,IAAI,CAACC,QAAQ,GAAG,IAAI,CAACP,SAAS,CAACO,QAAQ;EACzC;;EAEA;AACF;AACA;AACA;AACA;AACA;A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