@teambit/workspace 1.0.1226 → 1.0.1227

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": "1.0.1226",
3
+ "version": "1.0.1227",
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": "1.0.1226"
9
+ "version": "1.0.1227"
10
10
  },
11
11
  "dependencies": {
12
12
  "lodash": "4.18.1",
@@ -29,9 +29,6 @@
29
29
  "pluralize": "8.0.0",
30
30
  "reset-css": "5.0.1",
31
31
  "@teambit/component-id": "1.2.5",
32
- "@teambit/component": "1.0.1222",
33
- "@teambit/dependency-resolver": "1.0.1222",
34
- "@teambit/envs": "1.0.1222",
35
32
  "@teambit/harmony": "0.4.12",
36
33
  "@teambit/legacy.extension-data": "0.0.185",
37
34
  "@teambit/legacy.scope": "0.0.183",
@@ -50,18 +47,18 @@
50
47
  "@teambit/cli": "0.0.1414",
51
48
  "@teambit/config-store": "0.0.295",
52
49
  "@teambit/legacy.constants": "0.0.49",
53
- "@teambit/component-tree": "1.0.1222",
54
50
  "@teambit/component.ui.component-status-resolver": "0.0.510",
55
51
  "@teambit/harmony.modules.load-trace": "0.0.17",
56
52
  "@teambit/harmony.modules.resolved-component": "0.0.530",
57
53
  "@teambit/legacy.utils": "0.0.56",
58
54
  "@teambit/scope.remotes": "0.0.183",
59
- "@teambit/aspect-loader": "1.0.1222",
55
+ "@teambit/component-package-version": "0.0.466",
60
56
  "@teambit/config": "0.0.1589",
61
57
  "@teambit/harmony.modules.requireable-component": "0.0.530",
62
58
  "@teambit/harmony.modules.runtimes": "0.0.4",
63
59
  "@teambit/toolbox.modules.module-resolver": "0.0.29",
64
60
  "@teambit/workspace.modules.node-modules-linker": "0.0.416",
61
+ "@teambit/workspace.root-components": "1.0.1",
65
62
  "@teambit/graphql": "1.0.1206",
66
63
  "@teambit/global-config": "0.0.1418",
67
64
  "@teambit/legacy.consumer-config": "0.0.183",
@@ -86,7 +83,6 @@
86
83
  "@teambit/component.ui.component-filters.env-filter": "0.0.296",
87
84
  "@teambit/component.ui.component-filters.show-main-filter": "0.0.243",
88
85
  "@teambit/design.ui.surfaces.menu.link-item": "1.0.13",
89
- "@teambit/sidebar": "1.0.1222",
90
86
  "@teambit/ui-foundation.ui.main-dropdown": "0.0.505",
91
87
  "@teambit/ui-foundation.ui.menu": "0.0.503",
92
88
  "@teambit/ui-foundation.ui.react-router.slot-router": "0.0.533",
@@ -111,12 +107,18 @@
111
107
  "@teambit/workspace.hooks.use-url-change-broadcaster": "0.0.7",
112
108
  "@teambit/workspace.ui.preserve-workspace-mode": "0.0.8",
113
109
  "@teambit/evangelist.elements.icon": "1.0.5",
114
- "@teambit/scope": "1.0.1226",
115
- "@teambit/graph": "1.0.1226",
116
- "@teambit/isolator": "1.0.1226",
117
- "@teambit/bundler": "1.0.1226",
118
- "@teambit/ui": "1.0.1226",
119
- "@teambit/command-bar": "1.0.1226"
110
+ "@teambit/component": "1.0.1223",
111
+ "@teambit/dependency-resolver": "1.0.1223",
112
+ "@teambit/envs": "1.0.1223",
113
+ "@teambit/scope": "1.0.1227",
114
+ "@teambit/graph": "1.0.1227",
115
+ "@teambit/isolator": "1.0.1227",
116
+ "@teambit/component-tree": "1.0.1223",
117
+ "@teambit/aspect-loader": "1.0.1223",
118
+ "@teambit/bundler": "1.0.1227",
119
+ "@teambit/ui": "1.0.1227",
120
+ "@teambit/command-bar": "1.0.1227",
121
+ "@teambit/sidebar": "1.0.1223"
120
122
  },
121
123
  "devDependencies": {
122
124
  "@types/lodash": "4.14.165",
@@ -574,20 +574,33 @@ export class WorkspaceComponentLoader {
574
574
  });
575
575
  if (!aspectIds.length) return;
576
576
 
577
+ const loadAsAspects = (ids: string[]) =>
578
+ this.workspace.loadAspects(ids, true, 'self loading aspects', { useScopeAspectsCapsule: true });
577
579
  try {
578
- await this.workspace.loadAspects(aspectIds, true, 'self loading aspects', { useScopeAspectsCapsule: true });
580
+ await loadAsAspects(aspectIds);
579
581
  } catch (err: any) {
580
582
  this.logger.warn(`failed loading components as aspects for components ${aspectIds.join(', ')}`, err);
583
+ // one failing aspect fails the entire batch. load them one by one, so the aspects that are fine get loaded,
584
+ // and only the failing ones (and the components using them) are reported.
585
+ const failures: Array<{ aspectId: string; errMsg: string }> = [];
586
+ await mapSeries(aspectIds, async (aspectId) => {
587
+ let singleErr: any;
588
+ await loadAsAspects([aspectId]).catch((loadErr) => {
589
+ singleErr = loadErr;
590
+ });
591
+ // a load that doesn't throw is not enough. the loader hides errors it already reported in the batch.
592
+ if (!this.aspectLoader.hasAspectInstance(aspectId)) {
593
+ const failure = singleErr || err;
594
+ failures.push({ aspectId, errMsg: failure.message || String(failure) });
595
+ }
596
+ });
581
597
  // the error is not thrown (best-effort loading), but it's surfaced as a component issue
582
598
  // so it shows up in "bit status" instead of disappearing.
583
599
  if (!this.workspace.inInstallContext) {
584
- const errMsg = err.message || String(err);
585
- aspectIds.forEach((aspectId) => {
600
+ failures.forEach(({ aspectId, errMsg }) => {
586
601
  reportLoadFailure({ failedId: aspectId, phase: 'load-comps-as-aspects', error: errMsg });
587
- });
588
- components.forEach((component) => {
589
- if (!aspectIds.includes(component.id.toString())) return;
590
- this.addLoadFailureIssue(component, component.id.toString(), 'load-comps-as-aspects', errMsg);
602
+ const component = components.find((comp) => comp.id.toString() === aspectId);
603
+ if (component) this.addLoadFailureIssue(component, aspectId, 'load-comps-as-aspects', errMsg);
591
604
  });
592
605
  }
593
606
  }