@teambit/workspace 0.0.1134 → 0.0.1135

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/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/workspace",
3
- "version": "0.0.1134",
3
+ "version": "0.0.1135",
4
4
  "homepage": "https://bit.cloud/teambit/workspace/workspace",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.workspace",
8
8
  "name": "workspace",
9
- "version": "0.0.1134"
9
+ "version": "0.0.1135"
10
10
  },
11
11
  "dependencies": {
12
12
  "lodash": "4.17.21",
@@ -35,52 +35,52 @@
35
35
  "@teambit/base-ui.surfaces.split-pane.hover-splitter": "1.0.0",
36
36
  "@teambit/base-ui.surfaces.split-pane.split-pane": "1.0.0",
37
37
  "@teambit/explorer.ui.gallery.component-grid": "0.0.496",
38
- "@teambit/component": "0.0.1134",
39
- "@teambit/dependency-resolver": "0.0.1134",
40
- "@teambit/envs": "0.0.1134",
38
+ "@teambit/component": "0.0.1135",
39
+ "@teambit/dependency-resolver": "0.0.1135",
40
+ "@teambit/envs": "0.0.1135",
41
41
  "@teambit/bit-error": "0.0.402",
42
- "@teambit/lane-id": "0.0.275",
43
- "@teambit/logger": "0.0.853",
44
- "@teambit/scope": "0.0.1134",
45
- "@teambit/graph": "0.0.1134",
46
- "@teambit/cli": "0.0.760",
47
- "@teambit/isolator": "0.0.1134",
48
- "@teambit/component-tree": "0.0.922",
42
+ "@teambit/lane-id": "0.0.276",
43
+ "@teambit/logger": "0.0.854",
44
+ "@teambit/scope": "0.0.1135",
45
+ "@teambit/graph": "0.0.1135",
46
+ "@teambit/cli": "0.0.761",
47
+ "@teambit/isolator": "0.0.1135",
48
+ "@teambit/component-tree": "0.0.923",
49
49
  "@teambit/component.ui.component-status-resolver": "0.0.505",
50
50
  "@teambit/harmony.modules.resolved-component": "0.0.491",
51
- "@teambit/compiler": "0.0.1134",
52
- "@teambit/aspect-loader": "0.0.1134",
53
- "@teambit/config": "0.0.774",
54
- "@teambit/global-config": "0.0.762",
51
+ "@teambit/compiler": "0.0.1135",
52
+ "@teambit/aspect-loader": "0.0.1135",
53
+ "@teambit/config": "0.0.775",
54
+ "@teambit/global-config": "0.0.763",
55
55
  "@teambit/harmony.modules.requireable-component": "0.0.491",
56
56
  "@teambit/toolbox.modules.module-resolver": "0.0.1",
57
- "@teambit/workspace.modules.node-modules-linker": "0.0.102",
58
- "@teambit/graphql": "0.0.1134",
59
- "@teambit/bundler": "0.0.1134",
60
- "@teambit/pubsub": "0.0.1134",
61
- "@teambit/ui": "0.0.1134",
62
- "@teambit/variants": "0.0.866",
57
+ "@teambit/workspace.modules.node-modules-linker": "0.0.103",
58
+ "@teambit/graphql": "0.0.1135",
59
+ "@teambit/bundler": "0.0.1135",
60
+ "@teambit/pubsub": "0.0.1135",
61
+ "@teambit/ui": "0.0.1135",
62
+ "@teambit/variants": "0.0.867",
63
63
  "@teambit/component-issues": "0.0.95",
64
64
  "@teambit/component-version": "1.0.0",
65
65
  "@teambit/workspace.modules.match-pattern": "0.0.498",
66
- "@teambit/component.ui.component-drawer": "0.0.318",
67
- "@teambit/lanes.hooks.use-lane-components": "0.0.221",
68
- "@teambit/lanes.hooks.use-lanes": "0.0.222",
69
- "@teambit/lanes.ui.models.lanes-model": "0.0.175",
70
- "@teambit/ui-foundation.ui.side-bar": "0.0.835",
71
- "@teambit/command-bar": "0.0.1134",
72
- "@teambit/component.ui.component-filters.component-filter-context": "0.0.182",
73
- "@teambit/component.ui.component-filters.deprecate-filter": "0.0.182",
74
- "@teambit/component.ui.component-filters.env-filter": "0.0.188",
75
- "@teambit/component.ui.component-filters.show-main-filter": "0.0.175",
76
- "@teambit/sidebar": "0.0.1134",
66
+ "@teambit/component.ui.component-drawer": "0.0.319",
67
+ "@teambit/lanes.hooks.use-lane-components": "0.0.222",
68
+ "@teambit/lanes.hooks.use-lanes": "0.0.223",
69
+ "@teambit/lanes.ui.models.lanes-model": "0.0.176",
70
+ "@teambit/ui-foundation.ui.side-bar": "0.0.836",
71
+ "@teambit/command-bar": "0.0.1135",
72
+ "@teambit/component.ui.component-filters.component-filter-context": "0.0.183",
73
+ "@teambit/component.ui.component-filters.deprecate-filter": "0.0.183",
74
+ "@teambit/component.ui.component-filters.env-filter": "0.0.189",
75
+ "@teambit/component.ui.component-filters.show-main-filter": "0.0.176",
76
+ "@teambit/sidebar": "0.0.1135",
77
77
  "@teambit/ui-foundation.ui.main-dropdown": "0.0.497",
78
78
  "@teambit/ui-foundation.ui.menu": "0.0.497",
79
79
  "@teambit/ui-foundation.ui.react-router.slot-router": "0.0.501",
80
80
  "@teambit/ui-foundation.ui.tree.drawer": "0.0.512",
81
81
  "@teambit/ui-foundation.ui.hooks.use-data-query": "0.0.500",
82
- "@teambit/component-descriptor": "0.0.327",
83
- "@teambit/deprecation": "0.0.1134",
82
+ "@teambit/component-descriptor": "0.0.328",
83
+ "@teambit/deprecation": "0.0.1135",
84
84
  "@teambit/ui-foundation.ui.constants.z-indexes": "0.0.499",
85
85
  "@teambit/ui-foundation.ui.buttons.collapser": "0.0.207",
86
86
  "@teambit/ui-foundation.ui.corner": "0.0.510",
@@ -107,7 +107,7 @@
107
107
  "peerDependencies": {
108
108
  "@apollo/client": "^3.6.0",
109
109
  "react-router-dom": "^6.0.0",
110
- "@teambit/legacy": "1.0.544",
110
+ "@teambit/legacy": "1.0.545",
111
111
  "react": "^16.8.0 || ^17.0.0",
112
112
  "react-dom": "^16.8.0 || ^17.0.0"
113
113
  },
@@ -31,14 +31,29 @@ export class WorkspaceComponentLoader {
31
31
  this.componentsCache = createInMemoryCache({ maxSize: getMaxSizeForComponents() });
32
32
  }
33
33
 
34
- async getMany(ids: Array<ComponentID>, loadOpts?: ComponentLoadOptions): Promise<Component[]> {
34
+ async getMany(
35
+ ids: Array<ComponentID>,
36
+ loadOpts?: ComponentLoadOptions,
37
+ throwOnFailure = true
38
+ ): Promise<{
39
+ components: Component[];
40
+ invalidComponents: InvalidComponent[];
41
+ }> {
35
42
  const idsWithoutEmpty = compact(ids);
36
43
  const errors: { id: ComponentID; err: Error }[] = [];
44
+ const invalidComponents: InvalidComponent[] = [];
37
45
  const longProcessLogger = this.logger.createLongProcessLogger('loading components', ids.length);
38
46
  const componentsP = mapSeries(idsWithoutEmpty, async (id: ComponentID) => {
39
47
  longProcessLogger.logProgress(id.toString());
40
48
  return this.get(id, undefined, undefined, undefined, loadOpts).catch((err) => {
41
- if (this.isComponentNotExistsError(err)) {
49
+ if (ConsumerComponent.isComponentInvalidByErrorType(err) && !throwOnFailure) {
50
+ invalidComponents.push({
51
+ id,
52
+ err,
53
+ });
54
+ return undefined;
55
+ }
56
+ if (this.isComponentNotExistsError(err) || err instanceof ComponentNotFoundInPath) {
42
57
  errors.push({
43
58
  id,
44
59
  err,
@@ -56,7 +71,7 @@ export class WorkspaceComponentLoader {
56
71
  // remove errored components
57
72
  const filteredComponents: Component[] = compact(components);
58
73
  longProcessLogger.end();
59
- return filteredComponents;
74
+ return { components: filteredComponents, invalidComponents };
60
75
  }
61
76
 
62
77
  async getInvalid(ids: Array<ComponentID>): Promise<InvalidComponent[]> {
@@ -200,7 +215,7 @@ export class WorkspaceComponentLoader {
200
215
  return undefined;
201
216
  }
202
217
 
203
- async getConsumerComponent(
218
+ private async getConsumerComponent(
204
219
  id: ComponentID,
205
220
  loadOpts: ComponentLoadOptions = {}
206
221
  ): Promise<ConsumerComponent | undefined> {
@@ -227,11 +242,7 @@ export class WorkspaceComponentLoader {
227
242
  }
228
243
 
229
244
  private isComponentNotExistsError(err: Error): boolean {
230
- return (
231
- err instanceof ComponentNotFound ||
232
- err instanceof MissingBitMapComponent ||
233
- err instanceof ComponentNotFoundInPath
234
- );
245
+ return err instanceof ComponentNotFound || err instanceof MissingBitMapComponent;
235
246
  }
236
247
 
237
248
  private async executeLoadSlot(component: Component, loadOpts?: ComponentLoadOptions) {