@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
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.ComponentStatus = void 0;
|
|
7
|
-
|
|
8
7
|
class ComponentStatus {
|
|
9
8
|
constructor(
|
|
10
9
|
/**
|
|
@@ -53,7 +52,6 @@ class ComponentStatus {
|
|
|
53
52
|
this.nested = nested;
|
|
54
53
|
this.isInCurrentLane = isInCurrentLane;
|
|
55
54
|
}
|
|
56
|
-
|
|
57
55
|
static fromLegacy(status, hasModifiedDependencies, isOutdated, isInCurrentLane) {
|
|
58
56
|
const modify = {
|
|
59
57
|
hasModifiedFiles: !!status.modified,
|
|
@@ -61,9 +59,7 @@ class ComponentStatus {
|
|
|
61
59
|
};
|
|
62
60
|
return new ComponentStatus(modify, !!status.newlyCreated, !!status.deleted, !!status.staged, !status.notExist, !status.missingFromScope, isOutdated, !!status.nested, isInCurrentLane);
|
|
63
61
|
}
|
|
64
|
-
|
|
65
62
|
}
|
|
66
|
-
|
|
67
63
|
exports.ComponentStatus = ComponentStatus;
|
|
68
64
|
|
|
69
65
|
//# sourceMappingURL=component-status.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ComponentStatus","constructor","modifyInfo","isNew","isDeleted","isStaged","isInWorkspace","isInScope","isOutdated","nested","isInCurrentLane","fromLegacy","status","hasModifiedDependencies","modify","hasModifiedFiles","modified","newlyCreated","deleted","staged","notExist","missingFromScope"],"sources":["component-status.ts"],"sourcesContent":["import { ComponentStatus as LegacyComponentStatus } from '@teambit/legacy/dist/consumer/component-ops/component-status-loader';\n\nexport type ModifyInfo = {\n hasModifiedFiles: boolean;\n hasModifiedDependencies: boolean;\n};\n\nexport class ComponentStatus {\n constructor(\n /**\n * is the component modified.\n */\n readonly modifyInfo: ModifyInfo,\n\n /**\n * is the new component new.\n */\n readonly isNew: boolean,\n\n /**\n * is the component deleted from the workspace.\n */\n readonly isDeleted: boolean,\n\n /**\n * is the component staged.\n */\n readonly isStaged: boolean,\n\n /**\n * does the component exists in the workspace.\n */\n readonly isInWorkspace: boolean,\n\n /**\n * does the component exists in the scope.\n */\n readonly isInScope: boolean,\n\n /**\n * does the component is outdated (pending for update).\n */\n readonly isOutdated: boolean,\n\n /**\n * the component is not authored and not imported.\n */\n readonly nested?: boolean,\n /**\n * does the component exist on the current lane\n */\n readonly isInCurrentLane?: boolean\n ) {}\n\n static fromLegacy(\n status: LegacyComponentStatus,\n hasModifiedDependencies: boolean,\n isOutdated: boolean,\n isInCurrentLane?: boolean\n ) {\n const modify: ModifyInfo = {\n hasModifiedFiles: !!status.modified,\n hasModifiedDependencies,\n };\n return new ComponentStatus(\n modify,\n !!status.newlyCreated,\n !!status.deleted,\n !!status.staged,\n !status.notExist,\n !status.missingFromScope,\n isOutdated,\n !!status.nested,\n isInCurrentLane\n );\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["ComponentStatus","constructor","modifyInfo","isNew","isDeleted","isStaged","isInWorkspace","isInScope","isOutdated","nested","isInCurrentLane","fromLegacy","status","hasModifiedDependencies","modify","hasModifiedFiles","modified","newlyCreated","deleted","staged","notExist","missingFromScope"],"sources":["component-status.ts"],"sourcesContent":["import { ComponentStatus as LegacyComponentStatus } from '@teambit/legacy/dist/consumer/component-ops/component-status-loader';\n\nexport type ModifyInfo = {\n hasModifiedFiles: boolean;\n hasModifiedDependencies: boolean;\n};\n\nexport class ComponentStatus {\n constructor(\n /**\n * is the component modified.\n */\n readonly modifyInfo: ModifyInfo,\n\n /**\n * is the new component new.\n */\n readonly isNew: boolean,\n\n /**\n * is the component deleted from the workspace.\n */\n readonly isDeleted: boolean,\n\n /**\n * is the component staged.\n */\n readonly isStaged: boolean,\n\n /**\n * does the component exists in the workspace.\n */\n readonly isInWorkspace: boolean,\n\n /**\n * does the component exists in the scope.\n */\n readonly isInScope: boolean,\n\n /**\n * does the component is outdated (pending for update).\n */\n readonly isOutdated: boolean,\n\n /**\n * the component is not authored and not imported.\n */\n readonly nested?: boolean,\n /**\n * does the component exist on the current lane\n */\n readonly isInCurrentLane?: boolean\n ) {}\n\n static fromLegacy(\n status: LegacyComponentStatus,\n hasModifiedDependencies: boolean,\n isOutdated: boolean,\n isInCurrentLane?: boolean\n ) {\n const modify: ModifyInfo = {\n hasModifiedFiles: !!status.modified,\n hasModifiedDependencies,\n };\n return new ComponentStatus(\n modify,\n !!status.newlyCreated,\n !!status.deleted,\n !!status.staged,\n !status.notExist,\n !status.missingFromScope,\n isOutdated,\n !!status.nested,\n isInCurrentLane\n );\n }\n}\n"],"mappings":";;;;;;AAOO,MAAMA,eAAe,CAAC;EAC3BC,WAAW;EACT;AACJ;AACA;EACaC,UAAsB;EAE/B;AACJ;AACA;EACaC,KAAc;EAEvB;AACJ;AACA;EACaC,SAAkB;EAE3B;AACJ;AACA;EACaC,QAAiB;EAE1B;AACJ;AACA;EACaC,aAAsB;EAE/B;AACJ;AACA;EACaC,SAAkB;EAE3B;AACJ;AACA;EACaC,UAAmB;EAE5B;AACJ;AACA;EACaC,MAAgB;EACzB;AACJ;AACA;EACaC,eAAyB,EAClC;IAAA,KAxCSR,UAAsB,GAAtBA,UAAsB;IAAA,KAKtBC,KAAc,GAAdA,KAAc;IAAA,KAKdC,SAAkB,GAAlBA,SAAkB;IAAA,KAKlBC,QAAiB,GAAjBA,QAAiB;IAAA,KAKjBC,aAAsB,GAAtBA,aAAsB;IAAA,KAKtBC,SAAkB,GAAlBA,SAAkB;IAAA,KAKlBC,UAAmB,GAAnBA,UAAmB;IAAA,KAKnBC,MAAgB,GAAhBA,MAAgB;IAAA,KAIhBC,eAAyB,GAAzBA,eAAyB;EACjC;EAEH,OAAOC,UAAU,CACfC,MAA6B,EAC7BC,uBAAgC,EAChCL,UAAmB,EACnBE,eAAyB,EACzB;IACA,MAAMI,MAAkB,GAAG;MACzBC,gBAAgB,EAAE,CAAC,CAACH,MAAM,CAACI,QAAQ;MACnCH;IACF,CAAC;IACD,OAAO,IAAIb,eAAe,CACxBc,MAAM,EACN,CAAC,CAACF,MAAM,CAACK,YAAY,EACrB,CAAC,CAACL,MAAM,CAACM,OAAO,EAChB,CAAC,CAACN,MAAM,CAACO,MAAM,EACf,CAACP,MAAM,CAACQ,QAAQ,EAChB,CAACR,MAAM,CAACS,gBAAgB,EACxBb,UAAU,EACV,CAAC,CAACI,MAAM,CAACH,MAAM,EACfC,eAAe,CAChB;EACH;AACF;AAAC"}
|
|
@@ -15,24 +15,18 @@ Object.defineProperty(exports, "WorkspaceComponent", {
|
|
|
15
15
|
return _workspaceComponent().WorkspaceComponent;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
|
-
|
|
19
18
|
function _workspaceComponent() {
|
|
20
19
|
const data = require("./workspace-component");
|
|
21
|
-
|
|
22
20
|
_workspaceComponent = function () {
|
|
23
21
|
return data;
|
|
24
22
|
};
|
|
25
|
-
|
|
26
23
|
return data;
|
|
27
24
|
}
|
|
28
|
-
|
|
29
25
|
function _componentStatus() {
|
|
30
26
|
const data = require("./component-status");
|
|
31
|
-
|
|
32
27
|
_componentStatus = function () {
|
|
33
28
|
return data;
|
|
34
29
|
};
|
|
35
|
-
|
|
36
30
|
return data;
|
|
37
31
|
}
|
|
38
32
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { WorkspaceComponent } from './workspace-component';\nexport { ComponentStatus } from './component-status';\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { WorkspaceComponent } from './workspace-component';\nexport { ComponentStatus } from './component-status';\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA"}
|
|
@@ -1,188 +1,132 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
require("core-js/modules/es.array.iterator.js");
|
|
6
|
-
|
|
7
5
|
require("core-js/modules/es.array.sort.js");
|
|
8
|
-
|
|
9
6
|
require("core-js/modules/es.promise.js");
|
|
10
|
-
|
|
11
7
|
Object.defineProperty(exports, "__esModule", {
|
|
12
8
|
value: true
|
|
13
9
|
});
|
|
14
10
|
exports.WorkspaceComponentLoader = void 0;
|
|
15
|
-
|
|
16
11
|
function _defineProperty2() {
|
|
17
12
|
const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
18
|
-
|
|
19
13
|
_defineProperty2 = function () {
|
|
20
14
|
return data;
|
|
21
15
|
};
|
|
22
|
-
|
|
23
16
|
return data;
|
|
24
17
|
}
|
|
25
|
-
|
|
26
18
|
function _component() {
|
|
27
19
|
const data = require("@teambit/component");
|
|
28
|
-
|
|
29
20
|
_component = function () {
|
|
30
21
|
return data;
|
|
31
22
|
};
|
|
32
|
-
|
|
33
23
|
return data;
|
|
34
24
|
}
|
|
35
|
-
|
|
36
25
|
function _extensionData() {
|
|
37
26
|
const data = require("@teambit/legacy/dist/consumer/config/extension-data");
|
|
38
|
-
|
|
39
27
|
_extensionData = function () {
|
|
40
28
|
return data;
|
|
41
29
|
};
|
|
42
|
-
|
|
43
30
|
return data;
|
|
44
31
|
}
|
|
45
|
-
|
|
46
32
|
function _pMapSeries() {
|
|
47
33
|
const data = _interopRequireDefault(require("p-map-series"));
|
|
48
|
-
|
|
49
34
|
_pMapSeries = function () {
|
|
50
35
|
return data;
|
|
51
36
|
};
|
|
52
|
-
|
|
53
37
|
return data;
|
|
54
38
|
}
|
|
55
|
-
|
|
56
39
|
function _lodash() {
|
|
57
40
|
const data = require("lodash");
|
|
58
|
-
|
|
59
41
|
_lodash = function () {
|
|
60
42
|
return data;
|
|
61
43
|
};
|
|
62
|
-
|
|
63
44
|
return data;
|
|
64
45
|
}
|
|
65
|
-
|
|
66
46
|
function _component2() {
|
|
67
47
|
const data = _interopRequireDefault(require("@teambit/legacy/dist/consumer/component"));
|
|
68
|
-
|
|
69
48
|
_component2 = function () {
|
|
70
49
|
return data;
|
|
71
50
|
};
|
|
72
|
-
|
|
73
51
|
return data;
|
|
74
52
|
}
|
|
75
|
-
|
|
76
53
|
function _exceptions() {
|
|
77
54
|
const data = require("@teambit/legacy/dist/consumer/bit-map/exceptions");
|
|
78
|
-
|
|
79
55
|
_exceptions = function () {
|
|
80
56
|
return data;
|
|
81
57
|
};
|
|
82
|
-
|
|
83
58
|
return data;
|
|
84
59
|
}
|
|
85
|
-
|
|
86
60
|
function _utils() {
|
|
87
61
|
const data = require("@teambit/legacy/dist/utils");
|
|
88
|
-
|
|
89
62
|
_utils = function () {
|
|
90
63
|
return data;
|
|
91
64
|
};
|
|
92
|
-
|
|
93
65
|
return data;
|
|
94
66
|
}
|
|
95
|
-
|
|
96
67
|
function _componentIssues() {
|
|
97
68
|
const data = require("@teambit/component-issues");
|
|
98
|
-
|
|
99
69
|
_componentIssues = function () {
|
|
100
70
|
return data;
|
|
101
71
|
};
|
|
102
|
-
|
|
103
72
|
return data;
|
|
104
73
|
}
|
|
105
|
-
|
|
106
74
|
function _exceptions2() {
|
|
107
75
|
const data = require("@teambit/legacy/dist/scope/exceptions");
|
|
108
|
-
|
|
109
76
|
_exceptions2 = function () {
|
|
110
77
|
return data;
|
|
111
78
|
};
|
|
112
|
-
|
|
113
79
|
return data;
|
|
114
80
|
}
|
|
115
|
-
|
|
116
81
|
function _dependencyResolver() {
|
|
117
82
|
const data = require("@teambit/dependency-resolver");
|
|
118
|
-
|
|
119
83
|
_dependencyResolver = function () {
|
|
120
84
|
return data;
|
|
121
85
|
};
|
|
122
|
-
|
|
123
86
|
return data;
|
|
124
87
|
}
|
|
125
|
-
|
|
126
88
|
function _envs() {
|
|
127
89
|
const data = require("@teambit/envs");
|
|
128
|
-
|
|
129
90
|
_envs = function () {
|
|
130
91
|
return data;
|
|
131
92
|
};
|
|
132
|
-
|
|
133
93
|
return data;
|
|
134
94
|
}
|
|
135
|
-
|
|
136
95
|
function _config() {
|
|
137
96
|
const data = require("@teambit/legacy/dist/consumer/config");
|
|
138
|
-
|
|
139
97
|
_config = function () {
|
|
140
98
|
return data;
|
|
141
99
|
};
|
|
142
|
-
|
|
143
100
|
return data;
|
|
144
101
|
}
|
|
145
|
-
|
|
146
102
|
function _inMemoryCache() {
|
|
147
103
|
const data = require("@teambit/legacy/dist/cache/in-memory-cache");
|
|
148
|
-
|
|
149
104
|
_inMemoryCache = function () {
|
|
150
105
|
return data;
|
|
151
106
|
};
|
|
152
|
-
|
|
153
107
|
return data;
|
|
154
108
|
}
|
|
155
|
-
|
|
156
109
|
function _cacheFactory() {
|
|
157
110
|
const data = require("@teambit/legacy/dist/cache/cache-factory");
|
|
158
|
-
|
|
159
111
|
_cacheFactory = function () {
|
|
160
112
|
return data;
|
|
161
113
|
};
|
|
162
|
-
|
|
163
114
|
return data;
|
|
164
115
|
}
|
|
165
|
-
|
|
166
116
|
function _componentNotFoundInPath() {
|
|
167
117
|
const data = _interopRequireDefault(require("@teambit/legacy/dist/consumer/component/exceptions/component-not-found-in-path"));
|
|
168
|
-
|
|
169
118
|
_componentNotFoundInPath = function () {
|
|
170
119
|
return data;
|
|
171
120
|
};
|
|
172
|
-
|
|
173
121
|
return data;
|
|
174
122
|
}
|
|
175
|
-
|
|
176
123
|
function _workspaceComponent() {
|
|
177
124
|
const data = require("./workspace-component");
|
|
178
|
-
|
|
179
125
|
_workspaceComponent = function () {
|
|
180
126
|
return data;
|
|
181
127
|
};
|
|
182
|
-
|
|
183
128
|
return data;
|
|
184
129
|
}
|
|
185
|
-
|
|
186
130
|
class WorkspaceComponentLoader {
|
|
187
131
|
// cache loaded components
|
|
188
132
|
constructor(workspace, logger, dependencyResolver, envs) {
|
|
@@ -195,7 +139,6 @@ class WorkspaceComponentLoader {
|
|
|
195
139
|
maxSize: (0, _inMemoryCache().getMaxSizeForComponents)()
|
|
196
140
|
});
|
|
197
141
|
}
|
|
198
|
-
|
|
199
142
|
async getMany(ids, loadOpts) {
|
|
200
143
|
const idsWithoutEmpty = (0, _lodash().compact)(ids);
|
|
201
144
|
const errors = [];
|
|
@@ -210,7 +153,6 @@ class WorkspaceComponentLoader {
|
|
|
210
153
|
});
|
|
211
154
|
return undefined;
|
|
212
155
|
}
|
|
213
|
-
|
|
214
156
|
throw err;
|
|
215
157
|
});
|
|
216
158
|
});
|
|
@@ -218,20 +160,18 @@ class WorkspaceComponentLoader {
|
|
|
218
160
|
errors.forEach(err => {
|
|
219
161
|
this.logger.console(`failed loading component ${err.id.toString()}, see full error in debug.log file`);
|
|
220
162
|
this.logger.warn(`failed loading component ${err.id.toString()}`, err.err);
|
|
221
|
-
});
|
|
222
|
-
|
|
163
|
+
});
|
|
164
|
+
// remove errored components
|
|
223
165
|
const filteredComponents = (0, _lodash().compact)(components);
|
|
224
166
|
longProcessLogger.end();
|
|
225
167
|
return filteredComponents;
|
|
226
168
|
}
|
|
227
|
-
|
|
228
169
|
async getInvalid(ids) {
|
|
229
170
|
const idsWithoutEmpty = (0, _lodash().compact)(ids);
|
|
230
171
|
const errors = [];
|
|
231
172
|
const longProcessLogger = this.logger.createLongProcessLogger('loading components', ids.length);
|
|
232
173
|
await (0, _pMapSeries().default)(idsWithoutEmpty, async id => {
|
|
233
174
|
longProcessLogger.logProgress(id.toString());
|
|
234
|
-
|
|
235
175
|
try {
|
|
236
176
|
await this.workspace.consumer.loadComponent(id._legacy);
|
|
237
177
|
} catch (err) {
|
|
@@ -242,36 +182,28 @@ class WorkspaceComponentLoader {
|
|
|
242
182
|
});
|
|
243
183
|
return;
|
|
244
184
|
}
|
|
245
|
-
|
|
246
185
|
throw err;
|
|
247
186
|
}
|
|
248
187
|
});
|
|
249
188
|
return errors;
|
|
250
189
|
}
|
|
251
|
-
|
|
252
190
|
async get(componentId, legacyComponent, useCache = true, storeInCache = true, loadOpts) {
|
|
253
191
|
const bitIdWithVersion = (0, _utils().getLatestVersionNumber)(this.workspace.consumer.bitmapIdsFromCurrentLane, componentId._legacy);
|
|
254
192
|
const id = bitIdWithVersion.version ? componentId.changeVersion(bitIdWithVersion.version) : componentId;
|
|
255
193
|
const fromCache = this.getFromCache(id, loadOpts);
|
|
256
|
-
|
|
257
194
|
if (fromCache && useCache) {
|
|
258
195
|
return fromCache;
|
|
259
196
|
}
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
197
|
+
const consumerComponent = legacyComponent || (await this.getConsumerComponent(id));
|
|
198
|
+
// in case of out-of-sync, the id may changed during the load process
|
|
263
199
|
const updatedId = consumerComponent ? _component().ComponentID.fromLegacy(consumerComponent.id, id.scope) : id;
|
|
264
200
|
const component = await this.loadOne(updatedId, consumerComponent, loadOpts);
|
|
265
|
-
|
|
266
201
|
if (storeInCache) {
|
|
267
202
|
this.addMultipleEnvsIssueIfNeeded(component); // it's in storeInCache block, otherwise, it wasn't fully loaded
|
|
268
|
-
|
|
269
203
|
this.saveInCache(component, loadOpts);
|
|
270
204
|
}
|
|
271
|
-
|
|
272
205
|
return component;
|
|
273
206
|
}
|
|
274
|
-
|
|
275
207
|
async getIfExist(componentId) {
|
|
276
208
|
try {
|
|
277
209
|
return await this.get(componentId);
|
|
@@ -279,56 +211,45 @@ class WorkspaceComponentLoader {
|
|
|
279
211
|
if (this.isComponentNotExistsError(err)) {
|
|
280
212
|
return undefined;
|
|
281
213
|
}
|
|
282
|
-
|
|
283
214
|
throw err;
|
|
284
215
|
}
|
|
285
216
|
}
|
|
286
|
-
|
|
287
217
|
addMultipleEnvsIssueIfNeeded(component) {
|
|
288
218
|
const envs = this.envs.getAllEnvsConfiguredOnComponent(component);
|
|
289
219
|
const envIds = (0, _lodash().uniq)(envs.map(env => env.id));
|
|
290
|
-
|
|
291
220
|
if (envIds.length < 2) {
|
|
292
221
|
return;
|
|
293
222
|
}
|
|
294
|
-
|
|
295
223
|
component.state.issues.getOrCreate(_componentIssues().IssuesClasses.MultipleEnvs).data = envIds;
|
|
296
224
|
}
|
|
297
|
-
|
|
298
225
|
clearCache() {
|
|
299
226
|
this.componentsCache.deleteAll();
|
|
300
227
|
}
|
|
301
|
-
|
|
302
228
|
clearComponentCache(id) {
|
|
303
229
|
const idStr = id.toString();
|
|
304
|
-
|
|
305
230
|
for (const cacheKey of this.componentsCache.keys()) {
|
|
306
231
|
if (cacheKey === idStr || cacheKey.startsWith(`${idStr}:`)) {
|
|
307
232
|
this.componentsCache.delete(cacheKey);
|
|
308
233
|
}
|
|
309
234
|
}
|
|
310
235
|
}
|
|
311
|
-
|
|
312
236
|
async loadOne(id, consumerComponent, loadOpts) {
|
|
313
237
|
const componentFromScope = await this.workspace.scope.get(id);
|
|
314
|
-
|
|
315
238
|
if (!consumerComponent) {
|
|
316
239
|
if (!componentFromScope) throw new (_exceptions().MissingBitMapComponent)(id.toString());
|
|
317
240
|
return componentFromScope;
|
|
318
241
|
}
|
|
319
|
-
|
|
320
242
|
const {
|
|
321
243
|
extensions
|
|
322
244
|
} = await this.workspace.componentExtensions(id, componentFromScope);
|
|
323
|
-
const extensionsFromConsumerComponent = consumerComponent.extensions || new (_extensionData().ExtensionDataList)();
|
|
245
|
+
const extensionsFromConsumerComponent = consumerComponent.extensions || new (_extensionData().ExtensionDataList)();
|
|
246
|
+
// Merge extensions added by the legacy code in memory (for example data of dependency resolver)
|
|
247
|
+
const extensionDataList = _extensionData().ExtensionDataList.mergeConfigs([extensionsFromConsumerComponent, extensions]).filterRemovedExtensions();
|
|
324
248
|
|
|
325
|
-
|
|
249
|
+
// temporarily mutate consumer component extensions until we remove all direct access from legacy to extensions data
|
|
326
250
|
// TODO: remove this once we remove all direct access from legacy code to extensions data
|
|
327
|
-
|
|
328
|
-
|
|
329
251
|
consumerComponent.extensions = extensionDataList;
|
|
330
252
|
const state = new (_component().State)(new (_component().Config)(consumerComponent.mainFile, extensionDataList), await this.workspace.createAspectList(extensionDataList), _component().ComponentFS.fromVinyls(consumerComponent.files), consumerComponent.dependencies, consumerComponent);
|
|
331
|
-
|
|
332
253
|
if (componentFromScope) {
|
|
333
254
|
// Removed by @gilad. do not mutate the component from the scope
|
|
334
255
|
// componentFromScope.state = state;
|
|
@@ -337,14 +258,13 @@ class WorkspaceComponentLoader {
|
|
|
337
258
|
const updatedComp = await this.executeLoadSlot(workspaceComponent, loadOpts);
|
|
338
259
|
return updatedComp;
|
|
339
260
|
}
|
|
340
|
-
|
|
341
261
|
return this.executeLoadSlot(this.newComponentFromState(id, state), loadOpts);
|
|
342
262
|
}
|
|
343
|
-
|
|
344
263
|
saveInCache(component, loadOpts) {
|
|
345
264
|
const cacheKey = createComponentCacheKey(component.id, loadOpts);
|
|
346
265
|
this.componentsCache.set(cacheKey, component);
|
|
347
266
|
}
|
|
267
|
+
|
|
348
268
|
/**
|
|
349
269
|
* make sure that not only the id-str match, but also the legacy-id.
|
|
350
270
|
* this is needed because the ComponentID.toString() is the same whether or not the legacy-id has
|
|
@@ -352,19 +272,14 @@ class WorkspaceComponentLoader {
|
|
|
352
272
|
* as a result, when out-of-sync is happening and the id is changed to include scope-name in the
|
|
353
273
|
* legacy-id, the component is the cache has the old id.
|
|
354
274
|
*/
|
|
355
|
-
|
|
356
|
-
|
|
357
275
|
getFromCache(id, loadOpts) {
|
|
358
276
|
const cacheKey = createComponentCacheKey(id, loadOpts);
|
|
359
277
|
const fromCache = this.componentsCache.get(cacheKey);
|
|
360
|
-
|
|
361
278
|
if (fromCache && fromCache.id._legacy.isEqual(id._legacy)) {
|
|
362
279
|
return fromCache;
|
|
363
280
|
}
|
|
364
|
-
|
|
365
281
|
return undefined;
|
|
366
282
|
}
|
|
367
|
-
|
|
368
283
|
async getConsumerComponent(id) {
|
|
369
284
|
try {
|
|
370
285
|
return await this.workspace.consumer.loadComponent(id._legacy);
|
|
@@ -376,36 +291,44 @@ class WorkspaceComponentLoader {
|
|
|
376
291
|
this.logger.debug(`failed loading component "${id.toString()}" from the workspace due to "${err.name}" error\n${err.message}`);
|
|
377
292
|
return undefined;
|
|
378
293
|
}
|
|
379
|
-
|
|
380
294
|
throw err;
|
|
381
295
|
}
|
|
382
296
|
}
|
|
383
|
-
|
|
384
297
|
isComponentNotExistsError(err) {
|
|
385
298
|
return err instanceof _exceptions2().ComponentNotFound || err instanceof _exceptions().MissingBitMapComponent || err instanceof _componentNotFoundInPath().default;
|
|
386
299
|
}
|
|
387
|
-
|
|
388
300
|
async executeLoadSlot(component, loadOpts) {
|
|
389
301
|
if (component.state._consumer.removed) {
|
|
390
302
|
// if it was soft-removed now, the component is not in the FS. loading aspects such as composition ends up with
|
|
391
303
|
// errors as they try to read component files from the filesystem.
|
|
392
304
|
return component;
|
|
393
|
-
}
|
|
394
|
-
// TODO: remove this once those extensions dependent on workspace
|
|
395
|
-
|
|
305
|
+
}
|
|
396
306
|
|
|
397
|
-
|
|
307
|
+
// Special load events which runs from the workspace but should run from the correct aspect
|
|
308
|
+
// TODO: remove this once those extensions dependent on workspace
|
|
309
|
+
const envsData = await this.workspace.getEnvSystemDescriptor(component);
|
|
398
310
|
|
|
311
|
+
// Move to deps resolver main runtime once we switch ws<> deps resolver direction
|
|
399
312
|
const policy = await this.dependencyResolver.mergeVariantPolicies(component.config.extensions);
|
|
400
|
-
const
|
|
313
|
+
const dependenciesList = await this.dependencyResolver.extractDepsFromLegacy(component, policy);
|
|
314
|
+
let dependenciesFromUnmergedHead;
|
|
315
|
+
// Get dependencies from unmerged head if needed
|
|
316
|
+
// we take it from there, as they might not be installed yet and we need to get their versions from the model
|
|
317
|
+
const unmergedComponent = await this.workspace.getUnmergedComponent(component.id);
|
|
318
|
+
if (unmergedComponent) {
|
|
319
|
+
dependenciesFromUnmergedHead = await this.dependencyResolver.extractDepsFromLegacy(unmergedComponent, policy);
|
|
320
|
+
}
|
|
321
|
+
const mergedDependencies = dependenciesFromUnmergedHead ? _dependencyResolver().DependencyList.merge([dependenciesList, dependenciesFromUnmergedHead]) : dependenciesList;
|
|
401
322
|
const depResolverData = {
|
|
402
|
-
dependencies,
|
|
323
|
+
dependencies: mergedDependencies.serialize(),
|
|
403
324
|
policy: policy.serialize()
|
|
404
|
-
};
|
|
325
|
+
};
|
|
405
326
|
|
|
406
|
-
|
|
407
|
-
|
|
327
|
+
// Make sure we are adding the envs / deps data first because other on load events might depend on it
|
|
328
|
+
await Promise.all([this.upsertExtensionData(component, _envs().EnvsAspect.id, envsData), this.upsertExtensionData(component, _dependencyResolver().DependencyResolverAspect.id, depResolverData)]);
|
|
408
329
|
|
|
330
|
+
// We are updating the component state with the envs and deps data here, so in case we have other slots that depend on this data
|
|
331
|
+
// they will be able to get it, as it's very common use case that during on load someone want to access to the component env for example
|
|
409
332
|
const aspectListWithEnvsAndDeps = await this.workspace.createAspectList(component.state.config.extensions);
|
|
410
333
|
component.state.aspects = aspectListWithEnvsAndDeps;
|
|
411
334
|
const entries = this.workspace.onComponentLoadSlot.toArray();
|
|
@@ -413,43 +336,35 @@ class WorkspaceComponentLoader {
|
|
|
413
336
|
const data = await onLoad(component, loadOpts);
|
|
414
337
|
return this.upsertExtensionData(component, extension, data);
|
|
415
338
|
});
|
|
416
|
-
await Promise.all(promises);
|
|
339
|
+
await Promise.all(promises);
|
|
417
340
|
|
|
341
|
+
// Update the aspect list to have changes happened during the on load slot (new data added above)
|
|
418
342
|
const updatedAspectList = await this.workspace.createAspectList(component.state.config.extensions);
|
|
419
343
|
component.state.aspects = updatedAspectList;
|
|
420
344
|
return component;
|
|
421
345
|
}
|
|
422
|
-
|
|
423
346
|
newComponentFromState(id, state) {
|
|
424
347
|
return new (_workspaceComponent().WorkspaceComponent)(id, null, state, new (_component().TagMap)(), this.workspace);
|
|
425
348
|
}
|
|
426
|
-
|
|
427
349
|
async upsertExtensionData(component, extension, data) {
|
|
428
350
|
if (!data) return;
|
|
429
351
|
const existingExtension = component.state.config.extensions.findExtension(extension);
|
|
430
|
-
|
|
431
352
|
if (existingExtension) {
|
|
432
353
|
// Only merge top level of extension data
|
|
433
354
|
Object.assign(existingExtension.data, data);
|
|
434
355
|
return;
|
|
435
356
|
}
|
|
436
|
-
|
|
437
357
|
component.state.config.extensions.push(await this.getDataEntry(extension, data));
|
|
438
358
|
}
|
|
439
|
-
|
|
440
359
|
async getDataEntry(extension, data) {
|
|
441
360
|
// TODO: @gilad we need to refactor the extension data entry api.
|
|
442
361
|
return new (_config().ExtensionDataEntry)(undefined, undefined, extension, undefined, data);
|
|
443
362
|
}
|
|
444
|
-
|
|
445
363
|
}
|
|
446
|
-
|
|
447
364
|
exports.WorkspaceComponentLoader = WorkspaceComponentLoader;
|
|
448
|
-
|
|
449
365
|
function createComponentCacheKey(id, loadOpts) {
|
|
450
366
|
return `${id.toString()}:${JSON.stringify(sortKeys(loadOpts !== null && loadOpts !== void 0 ? loadOpts : {}))}`;
|
|
451
367
|
}
|
|
452
|
-
|
|
453
368
|
function sortKeys(obj) {
|
|
454
369
|
return (0, _lodash().fromPairs)(Object.entries(obj).sort(([k1], [k2]) => k1.localeCompare(k2)));
|
|
455
370
|
}
|