@teambit/workspace 1.0.106 → 1.0.108

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.
Files changed (86) hide show
  1. package/aspects-merger.ts +319 -0
  2. package/bit-map.ts +277 -0
  3. package/build-graph-from-fs.ts +188 -0
  4. package/build-graph-ids-from-fs.ts +216 -0
  5. package/capsule.cmd.ts +217 -0
  6. package/constants.ts +1 -0
  7. package/dist/aspects-merger.js +13 -22
  8. package/dist/aspects-merger.js.map +1 -1
  9. package/dist/bit-map.d.ts +1 -1
  10. package/dist/build-graph-from-fs.d.ts +2 -2
  11. package/dist/build-graph-from-fs.js +1 -2
  12. package/dist/build-graph-from-fs.js.map +1 -1
  13. package/dist/build-graph-ids-from-fs.js +1 -1
  14. package/dist/build-graph-ids-from-fs.js.map +1 -1
  15. package/dist/capsule.cmd.d.ts +2 -2
  16. package/dist/capsule.cmd.js +1 -2
  17. package/dist/capsule.cmd.js.map +1 -1
  18. package/dist/component-config-file/component-config-file.d.ts +2 -2
  19. package/dist/component-tree.widget.d.ts +2 -2
  20. package/dist/eject-conf.cmd.d.ts +2 -2
  21. package/dist/envs-subcommands/envs-replace.cmd.d.ts +1 -1
  22. package/dist/envs-subcommands/envs-set.cmd.d.ts +1 -1
  23. package/dist/envs-subcommands/envs-unset.cmd.d.ts +1 -1
  24. package/dist/envs-subcommands/envs-update.cmd.d.ts +1 -1
  25. package/dist/filter.d.ts +1 -1
  26. package/dist/filter.js +1 -1
  27. package/dist/filter.js.map +1 -1
  28. package/dist/merge-conflict-file.d.ts +1 -1
  29. package/dist/merge-conflict-file.js +1 -2
  30. package/dist/merge-conflict-file.js.map +1 -1
  31. package/dist/on-component-events.d.ts +6 -6
  32. package/dist/{preview-1703505948637.js → preview-1703647408454.js} +2 -2
  33. package/dist/scope-subcommands/scope-set.cmd.d.ts +1 -1
  34. package/dist/ui/workspace/use-workspace.d.ts +8 -8
  35. package/dist/ui/workspace/use-workspace.js +7 -18
  36. package/dist/ui/workspace/use-workspace.js.map +1 -1
  37. package/dist/ui/workspace/workspace-model.d.ts +3 -3
  38. package/dist/ui/workspace/workspace-overview/workspace-overview.d.ts +2 -2
  39. package/dist/ui/workspace/workspace-overview/workspace-overview.js +1 -2
  40. package/dist/ui/workspace/workspace-overview/workspace-overview.js.map +1 -1
  41. package/dist/ui/workspace/workspace-provider.d.ts +3 -3
  42. package/dist/ui/workspace/workspace.d.ts +3 -3
  43. package/dist/workspace-aspects-loader.d.ts +3 -3
  44. package/dist/workspace-aspects-loader.js +7 -11
  45. package/dist/workspace-aspects-loader.js.map +1 -1
  46. package/dist/workspace-component/comp-files.d.ts +3 -3
  47. package/dist/workspace-component/component-status.d.ts +3 -3
  48. package/dist/workspace-component/workspace-component-loader.d.ts +5 -5
  49. package/dist/workspace-component/workspace-component-loader.js +31 -28
  50. package/dist/workspace-component/workspace-component-loader.js.map +1 -1
  51. package/dist/workspace.composition.d.ts +2 -2
  52. package/dist/workspace.d.ts +6 -6
  53. package/dist/workspace.graphql.d.ts +2 -2
  54. package/dist/workspace.graphql.js +2 -4
  55. package/dist/workspace.graphql.js.map +1 -1
  56. package/dist/workspace.js +16 -23
  57. package/dist/workspace.js.map +1 -1
  58. package/dist/workspace.provider.d.ts +12 -12
  59. package/dist/workspace.provider.js +8 -11
  60. package/dist/workspace.provider.js.map +1 -1
  61. package/dist/workspace.ui.drawer.d.ts +1 -1
  62. package/dist/workspace.ui.drawer.js +5 -6
  63. package/dist/workspace.ui.drawer.js.map +1 -1
  64. package/dist/workspace.ui.runtime.d.ts +1 -1
  65. package/dist/workspace.ui.runtime.js +2 -8
  66. package/dist/workspace.ui.runtime.js.map +1 -1
  67. package/eject-conf.cmd.ts +57 -0
  68. package/filter.ts +139 -0
  69. package/index.ts +22 -0
  70. package/merge-conflict-file.ts +129 -0
  71. package/on-component-events.ts +24 -0
  72. package/package.json +39 -46
  73. package/pattern.cmd.ts +53 -0
  74. package/tsconfig.json +16 -21
  75. package/types/asset.d.ts +15 -3
  76. package/types.ts +71 -0
  77. package/use.cmd.ts +25 -0
  78. package/workspace-aspects-loader.ts +885 -0
  79. package/workspace-component/workspace-component-loader.ts +25 -16
  80. package/workspace-section.ts +14 -0
  81. package/workspace.aspect.ts +9 -0
  82. package/workspace.graphql.ts +133 -0
  83. package/workspace.main.runtime.ts +56 -0
  84. package/workspace.provider.ts +282 -0
  85. package/workspace.ts +2014 -0
  86. package/workspace.ui-root.ts +65 -0
@@ -1 +1 @@
1
- {"version":3,"names":["_graphqlTag","data","_interopRequireDefault","require","_workspace","obj","__esModule","default","_default","workspace","graphql","typeDefs","gql","resolvers","Subscription","componentAdded","subscribe","pubsub","asyncIterator","ComponentAdded","componentChanged","ComponentChanged","componentRemoved","ComponentRemoved","Component","status","wsComponent","getStatus","issuesCount","_wsComponent$getIssue","getIssues","count","issues","_wsComponent$getIssue2","toObjectWithDataAsString","Workspace","path","ws","name","icon","components","offset","limit","list","getComponent","id","componentID","resolveComponentId","component","get","error","Query","exports"],"sources":["workspace.graphql.ts"],"sourcesContent":["import { GraphqlMain } from '@teambit/graphql';\nimport gql from 'graphql-tag';\n\nimport { ComponentAdded, ComponentChanged, ComponentRemoved, Workspace } from './workspace';\nimport { WorkspaceComponent } from './workspace-component';\n\nexport default (workspace: Workspace, graphql: GraphqlMain) => {\n return {\n typeDefs: gql`\n type ModifyInfo {\n # is the component modified.\n hasModifiedFiles: Boolean\n\n # the component has Modified Dependencies\n hasModifiedDependencies: Boolean\n }\n\n type ComponentStatus {\n # component is pending to be tagged automatically.\n modifyInfo: ModifyInfo\n\n # is the new component new.\n isNew: Boolean\n\n # is the component deleted from the workspace.\n isDeleted: Boolean\n\n # is the component staged.\n isStaged: Boolean\n\n # does the component exists in the workspace.\n isInWorkspace: Boolean\n\n # does the component exists in the scope.\n isInScope: Boolean\n\n # does the component is outdated (pending for update).\n isOutdated: Boolean\n }\n\n extend type Component {\n status: ComponentStatus\n }\n\n type Issue {\n type: String!\n description: String!\n solution: String\n data: String\n }\n\n extend type Component {\n # the count of errors in component in workspace\n issuesCount: Int\n issues: [Issue]\n }\n\n type Workspace {\n name: String\n path: String\n icon: String\n components(offset: Int, limit: Int): [Component]\n getComponent(id: String!): Component\n }\n\n type Subscription {\n componentAdded: ComponentAdded\n componentChanged: ComponentChanged\n componentRemoved: ComponentRemoved\n }\n\n type ComponentAdded {\n component: Component\n }\n\n type ComponentChanged {\n component: Component\n }\n\n type ComponentRemoved {\n componentIds: [ComponentID]\n }\n\n type Query {\n workspace: Workspace\n }\n `,\n resolvers: {\n Subscription: {\n componentAdded: {\n subscribe: () => graphql.pubsub.asyncIterator(ComponentAdded),\n },\n componentChanged: {\n subscribe: () => graphql.pubsub.asyncIterator(ComponentChanged),\n },\n componentRemoved: {\n subscribe: () => graphql.pubsub.asyncIterator(ComponentRemoved),\n },\n },\n Component: {\n status: async (wsComponent: WorkspaceComponent) => {\n return wsComponent.getStatus();\n },\n issuesCount: (wsComponent: WorkspaceComponent): number => {\n return wsComponent.getIssues()?.count || 0;\n },\n issues: (wsComponent: WorkspaceComponent) => {\n return wsComponent.getIssues()?.toObjectWithDataAsString();\n },\n },\n Workspace: {\n path: (ws) => ws.path,\n name: (ws) => ws.name,\n icon: (ws) => ws.icon,\n components: async (ws: Workspace, { offset, limit }: { offset: number; limit: number }) => {\n return ws.list({ offset, limit });\n },\n getComponent: async (ws: Workspace, { id }: { id: string }) => {\n try {\n const componentID = await ws.resolveComponentId(id);\n const component = await ws.get(componentID);\n return component;\n } catch (error: any) {\n return null;\n }\n },\n },\n Query: {\n workspace: () => workspace,\n },\n },\n };\n};\n"],"mappings":"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"}
1
+ {"version":3,"names":["_graphqlTag","data","_interopRequireDefault","require","_workspace","obj","__esModule","default","_default","workspace","graphql","typeDefs","gql","resolvers","Subscription","componentAdded","subscribe","pubsub","asyncIterator","ComponentAdded","componentChanged","ComponentChanged","componentRemoved","ComponentRemoved","Component","status","wsComponent","getStatus","issuesCount","getIssues","count","issues","toObjectWithDataAsString","Workspace","path","ws","name","icon","components","offset","limit","list","getComponent","id","componentID","resolveComponentId","component","get","error","Query","exports"],"sources":["workspace.graphql.ts"],"sourcesContent":["import { GraphqlMain } from '@teambit/graphql';\nimport gql from 'graphql-tag';\n\nimport { ComponentAdded, ComponentChanged, ComponentRemoved, Workspace } from './workspace';\nimport { WorkspaceComponent } from './workspace-component';\n\nexport default (workspace: Workspace, graphql: GraphqlMain) => {\n return {\n typeDefs: gql`\n type ModifyInfo {\n # is the component modified.\n hasModifiedFiles: Boolean\n\n # the component has Modified Dependencies\n hasModifiedDependencies: Boolean\n }\n\n type ComponentStatus {\n # component is pending to be tagged automatically.\n modifyInfo: ModifyInfo\n\n # is the new component new.\n isNew: Boolean\n\n # is the component deleted from the workspace.\n isDeleted: Boolean\n\n # is the component staged.\n isStaged: Boolean\n\n # does the component exists in the workspace.\n isInWorkspace: Boolean\n\n # does the component exists in the scope.\n isInScope: Boolean\n\n # does the component is outdated (pending for update).\n isOutdated: Boolean\n }\n\n extend type Component {\n status: ComponentStatus\n }\n\n type Issue {\n type: String!\n description: String!\n solution: String\n data: String\n }\n\n extend type Component {\n # the count of errors in component in workspace\n issuesCount: Int\n issues: [Issue]\n }\n\n type Workspace {\n name: String\n path: String\n icon: String\n components(offset: Int, limit: Int): [Component]\n getComponent(id: String!): Component\n }\n\n type Subscription {\n componentAdded: ComponentAdded\n componentChanged: ComponentChanged\n componentRemoved: ComponentRemoved\n }\n\n type ComponentAdded {\n component: Component\n }\n\n type ComponentChanged {\n component: Component\n }\n\n type ComponentRemoved {\n componentIds: [ComponentID]\n }\n\n type Query {\n workspace: Workspace\n }\n `,\n resolvers: {\n Subscription: {\n componentAdded: {\n subscribe: () => graphql.pubsub.asyncIterator(ComponentAdded),\n },\n componentChanged: {\n subscribe: () => graphql.pubsub.asyncIterator(ComponentChanged),\n },\n componentRemoved: {\n subscribe: () => graphql.pubsub.asyncIterator(ComponentRemoved),\n },\n },\n Component: {\n status: async (wsComponent: WorkspaceComponent) => {\n return wsComponent.getStatus();\n },\n issuesCount: (wsComponent: WorkspaceComponent): number => {\n return wsComponent.getIssues()?.count || 0;\n },\n issues: (wsComponent: WorkspaceComponent) => {\n return wsComponent.getIssues()?.toObjectWithDataAsString();\n },\n },\n Workspace: {\n path: (ws) => ws.path,\n name: (ws) => ws.name,\n icon: (ws) => ws.icon,\n components: async (ws: Workspace, { offset, limit }: { offset: number; limit: number }) => {\n return ws.list({ offset, limit });\n },\n getComponent: async (ws: Workspace, { id }: { id: string }) => {\n try {\n const componentID = await ws.resolveComponentId(id);\n const component = await ws.get(componentID);\n return component;\n } catch (error: any) {\n return null;\n }\n },\n },\n Query: {\n workspace: () => workspace,\n },\n },\n };\n};\n"],"mappings":";;;;;;AACA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAG,WAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,UAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA4F,SAAAC,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,IAAAG,QAAA,GAG7EA,CAACC,SAAoB,EAAEC,OAAoB,KAAK;EAC7D,OAAO;IACLC,QAAQ,EAAE,IAAAC,qBAAG,CAAC;AAClB;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;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;IACDC,SAAS,EAAE;MACTC,YAAY,EAAE;QACZC,cAAc,EAAE;UACdC,SAAS,EAAEA,CAAA,KAAMN,OAAO,CAACO,MAAM,CAACC,aAAa,CAACC,2BAAc;QAC9D,CAAC;QACDC,gBAAgB,EAAE;UAChBJ,SAAS,EAAEA,CAAA,KAAMN,OAAO,CAACO,MAAM,CAACC,aAAa,CAACG,6BAAgB;QAChE,CAAC;QACDC,gBAAgB,EAAE;UAChBN,SAAS,EAAEA,CAAA,KAAMN,OAAO,CAACO,MAAM,CAACC,aAAa,CAACK,6BAAgB;QAChE;MACF,CAAC;MACDC,SAAS,EAAE;QACTC,MAAM,EAAE,MAAOC,WAA+B,IAAK;UACjD,OAAOA,WAAW,CAACC,SAAS,CAAC,CAAC;QAChC,CAAC;QACDC,WAAW,EAAGF,WAA+B,IAAa;UACxD,OAAOA,WAAW,CAACG,SAAS,CAAC,CAAC,EAAEC,KAAK,IAAI,CAAC;QAC5C,CAAC;QACDC,MAAM,EAAGL,WAA+B,IAAK;UAC3C,OAAOA,WAAW,CAACG,SAAS,CAAC,CAAC,EAAEG,wBAAwB,CAAC,CAAC;QAC5D;MACF,CAAC;MACDC,SAAS,EAAE;QACTC,IAAI,EAAGC,EAAE,IAAKA,EAAE,CAACD,IAAI;QACrBE,IAAI,EAAGD,EAAE,IAAKA,EAAE,CAACC,IAAI;QACrBC,IAAI,EAAGF,EAAE,IAAKA,EAAE,CAACE,IAAI;QACrBC,UAAU,EAAE,MAAAA,CAAOH,EAAa,EAAE;UAAEI,MAAM;UAAEC;QAAyC,CAAC,KAAK;UACzF,OAAOL,EAAE,CAACM,IAAI,CAAC;YAAEF,MAAM;YAAEC;UAAM,CAAC,CAAC;QACnC,CAAC;QACDE,YAAY,EAAE,MAAAA,CAAOP,EAAa,EAAE;UAAEQ;QAAmB,CAAC,KAAK;UAC7D,IAAI;YACF,MAAMC,WAAW,GAAG,MAAMT,EAAE,CAACU,kBAAkB,CAACF,EAAE,CAAC;YACnD,MAAMG,SAAS,GAAG,MAAMX,EAAE,CAACY,GAAG,CAACH,WAAW,CAAC;YAC3C,OAAOE,SAAS;UAClB,CAAC,CAAC,OAAOE,KAAU,EAAE;YACnB,OAAO,IAAI;UACb;QACF;MACF,CAAC;MACDC,KAAK,EAAE;QACLxC,SAAS,EAAEA,CAAA,KAAMA;MACnB;IACF;EACF,CAAC;AACH,CAAC;AAAAyC,OAAA,CAAA3C,OAAA,GAAAC,QAAA"}
package/dist/workspace.js CHANGED
@@ -709,12 +709,11 @@ class Workspace {
709
709
  }
710
710
  const flattenedBitIdCompIdMap = {};
711
711
  const getCurrentVersionAsTagIfPossible = () => {
712
- var _component$tags$byHas;
713
712
  const currentVer = component.id.version;
714
713
  if (!currentVer) return undefined;
715
714
  const isCurrentVerAHash = (0, _componentVersion().isHash)(currentVer);
716
715
  if (!isCurrentVerAHash) return currentVer;
717
- const tag = (_component$tags$byHas = component.tags.byHash(currentVer)) === null || _component$tags$byHas === void 0 ? void 0 : _component$tags$byHas.version.raw;
716
+ const tag = component.tags.byHash(currentVer)?.version.raw;
718
717
  return tag || currentVer;
719
718
  };
720
719
  const currentVersion = getCurrentVersionAsTagIfPossible();
@@ -983,7 +982,7 @@ it's possible that the version ${component.id.version} belong to ${idStr.split('
983
982
  } catch (err) {
984
983
  if (err instanceof _legacyBitId().InvalidScopeName || err instanceof _scopeNotFoundOrDenied().ScopeNotFoundOrDenied || err instanceof _laneNotFound().LaneNotFound || err instanceof _legacyBitId().InvalidScopeNameFromRemote) {
985
984
  const bitMapLaneId = this.bitMap.getExportedLaneId();
986
- if (bitMapLaneId !== null && bitMapLaneId !== void 0 && bitMapLaneId.isEqual(currentLaneId)) {
985
+ if (bitMapLaneId?.isEqual(currentLaneId)) {
987
986
  throw err; // we know the lane is not new, so the error is legit
988
987
  }
989
988
  // the lane could be a local lane so no need to throw an error in such case
@@ -1129,7 +1128,7 @@ it's possible that the version ${component.id.version} belong to ${idStr.split('
1129
1128
  throw new (_bitError().BitError)(`unable to find components that using "${env}" env.
1130
1129
  the following envs are used in this workspace: ${availableEnvs.join(', ')}`);
1131
1130
  }
1132
- return (foundEnv === null || foundEnv === void 0 ? void 0 : foundEnv.components) || [];
1131
+ return foundEnv?.components || [];
1133
1132
  }
1134
1133
  async getMany(ids, loadOpts) {
1135
1134
  const {
@@ -1389,8 +1388,8 @@ the following envs are used in this workspace: ${availableEnvs.join(', ')}`);
1389
1388
  }
1390
1389
  async getUnmergedComponent(componentId) {
1391
1390
  const unmerged = this.scope.legacyScope.objects.unmergedComponents.getEntry(componentId.fullName);
1392
- if (unmerged !== null && unmerged !== void 0 && unmerged.head) {
1393
- return this.scope.get(componentId.changeVersion(unmerged === null || unmerged === void 0 ? void 0 : unmerged.head.toString()));
1391
+ if (unmerged?.head) {
1392
+ return this.scope.get(componentId.changeVersion(unmerged?.head.toString()));
1394
1393
  }
1395
1394
  return undefined;
1396
1395
  }
@@ -1437,7 +1436,6 @@ the following envs are used in this workspace: ${availableEnvs.join(', ')}`);
1437
1436
  return newComponentIds;
1438
1437
  }
1439
1438
  async setDefaultScope(scopeName) {
1440
- var _config$workspaceConf, _config$workspaceConf2;
1441
1439
  if (this.defaultScope === scopeName) {
1442
1440
  throw new Error(`the default-scope is already set as "${scopeName}", nothing to change`);
1443
1441
  }
@@ -1445,7 +1443,7 @@ the following envs are used in this workspace: ${availableEnvs.join(', ')}`);
1445
1443
  throw new (_legacyBitId().InvalidScopeName)(scopeName);
1446
1444
  }
1447
1445
  const config = this.harmony.get('teambit.harmony/config');
1448
- (_config$workspaceConf = config.workspaceConfig) === null || _config$workspaceConf === void 0 || _config$workspaceConf.setExtension(_workspace().WorkspaceAspect.id, {
1446
+ config.workspaceConfig?.setExtension(_workspace().WorkspaceAspect.id, {
1449
1447
  defaultScope: scopeName
1450
1448
  }, {
1451
1449
  mergeIntoExisting: true,
@@ -1454,9 +1452,9 @@ the following envs are used in this workspace: ${availableEnvs.join(', ')}`);
1454
1452
  // fix also comps using the old default-scope
1455
1453
  this.bitMap.updateDefaultScope(this.config.defaultScope, scopeName);
1456
1454
  this.config.defaultScope = scopeName;
1457
- await ((_config$workspaceConf2 = config.workspaceConfig) === null || _config$workspaceConf2 === void 0 ? void 0 : _config$workspaceConf2.write({
1455
+ await config.workspaceConfig?.write({
1458
1456
  dir: _path2().default.dirname(config.workspaceConfig.path)
1459
- }));
1457
+ });
1460
1458
  await this.bitMap.write('scope-set');
1461
1459
  }
1462
1460
  async addSpecificComponentConfig(id, aspectId, config = {}, {
@@ -1495,22 +1493,19 @@ the following envs are used in this workspace: ${availableEnvs.join(', ')}`);
1495
1493
  async getAspectIdFromConfig(componentId, aspectIdStr, ignoreAspectVersion = false) {
1496
1494
  const config = await this.getExtensionsFromScopeAndSpecific(componentId);
1497
1495
  const aspectEntry = config.findExtension(aspectIdStr, ignoreAspectVersion);
1498
- return aspectEntry === null || aspectEntry === void 0 ? void 0 : aspectEntry.id.toString();
1496
+ return aspectEntry?.id.toString();
1499
1497
  }
1500
1498
  async getSpecificComponentConfig(id, aspectId) {
1501
- var _this$bitMap$getBitma;
1502
1499
  const componentConfigFile = await this.componentConfigFile(id);
1503
1500
  if (componentConfigFile) {
1504
- var _componentConfigFile$;
1505
- return (_componentConfigFile$ = componentConfigFile.aspects.get(aspectId)) === null || _componentConfigFile$ === void 0 ? void 0 : _componentConfigFile$.config;
1501
+ return componentConfigFile.aspects.get(aspectId)?.config;
1506
1502
  }
1507
- return (_this$bitMap$getBitma = this.bitMap.getBitmapEntry(id, {
1503
+ return this.bitMap.getBitmapEntry(id, {
1508
1504
  ignoreVersion: true
1509
- }).config) === null || _this$bitMap$getBitma === void 0 ? void 0 : _this$bitMap$getBitma[aspectId];
1505
+ }).config?.[aspectId];
1510
1506
  }
1511
1507
  isVendorComponentByComponentDir(relativeComponentDir) {
1512
- var _this$config$vendor;
1513
- const vendorDir = ((_this$config$vendor = this.config.vendor) === null || _this$config$vendor === void 0 ? void 0 : _this$config$vendor.directory) || DEFAULT_VENDOR_DIR;
1508
+ const vendorDir = this.config.vendor?.directory || DEFAULT_VENDOR_DIR;
1514
1509
  if ((0, _utils().pathIsInside)(relativeComponentDir, vendorDir)) {
1515
1510
  return true;
1516
1511
  }
@@ -1832,7 +1827,6 @@ the following envs are used in this workspace: ${availableEnvs.join(', ')}`);
1832
1827
  * (inside envs/envs it's set without a version).
1833
1828
  */
1834
1829
  async resolveEnvIdWithPotentialVersionForConfig(envId) {
1835
- var _found$extensionId;
1836
1830
  const isCore = this.aspectLoader.isCoreAspect(envId.toStringWithoutVersion());
1837
1831
  const existsOnWorkspace = await this.hasId(envId);
1838
1832
  if (isCore || existsOnWorkspace) {
@@ -1844,8 +1838,8 @@ the following envs are used in this workspace: ${availableEnvs.join(', ')}`);
1844
1838
  return envId.toString();
1845
1839
  }
1846
1840
  const extensions = this.harmony.get('teambit.harmony/config').extensions;
1847
- const found = extensions === null || extensions === void 0 ? void 0 : extensions.findExtension(envId.toString(), true);
1848
- if (found && (_found$extensionId = found.extensionId) !== null && _found$extensionId !== void 0 && _found$extensionId.version) {
1841
+ const found = extensions?.findExtension(envId.toString(), true);
1842
+ if (found && found.extensionId?.version) {
1849
1843
  return found.extensionId.toString();
1850
1844
  }
1851
1845
  const comps = await this.importAndGetMany([envId], `to get the env ${envId.toString()}`);
@@ -1859,9 +1853,8 @@ the following envs are used in this workspace: ${availableEnvs.join(', ')}`);
1859
1853
  const changed = [];
1860
1854
  const unchanged = [];
1861
1855
  await Promise.all(ids.map(async id => {
1862
- var _extensions$findCoreE;
1863
1856
  const extensions = await this.getExtensionsFromScopeAndSpecific(id);
1864
- const envsAspect = (_extensions$findCoreE = extensions.findCoreExtension(_envs().EnvsAspect.id)) === null || _extensions$findCoreE === void 0 ? void 0 : _extensions$findCoreE.rawConfig;
1857
+ const envsAspect = extensions.findCoreExtension(_envs().EnvsAspect.id)?.rawConfig;
1865
1858
  const currentEnv = envsAspect && envsAspect !== _config().REMOVE_EXTENSION_SPECIAL_SIGN ? envsAspect.env : null;
1866
1859
  if (!currentEnv) {
1867
1860
  unchanged.push(id);