@teambit/workspace 0.0.933 → 0.0.935

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.
@@ -0,0 +1,4 @@
1
+ import { BitError } from '@teambit/bit-error';
2
+ export declare class OutsideWorkspaceError extends BitError {
3
+ constructor();
4
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.OutsideWorkspaceError = void 0;
7
+ function _bitError() {
8
+ const data = require("@teambit/bit-error");
9
+ _bitError = function () {
10
+ return data;
11
+ };
12
+ return data;
13
+ }
14
+ class OutsideWorkspaceError extends _bitError().BitError {
15
+ constructor() {
16
+ super(`This command can only be run inside a bit workspace. Please check that you are inside a bit workspace and then re-run (to initialize a new workspace please use bit init)`);
17
+ }
18
+ }
19
+ exports.OutsideWorkspaceError = OutsideWorkspaceError;
20
+
21
+ //# sourceMappingURL=outside-workspace.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["OutsideWorkspaceError","BitError","constructor"],"sources":["outside-workspace.ts"],"sourcesContent":["import { BitError } from '@teambit/bit-error';\n\nexport class OutsideWorkspaceError extends BitError {\n constructor() {\n super(\n `This command can only be run inside a bit workspace. Please check that you are inside a bit workspace and then re-run (to initialize a new workspace please use bit init)`\n );\n }\n}\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,qBAAqB,SAASC,oBAAQ,CAAC;EAClDC,WAAW,GAAG;IACZ,KAAK,CACF,2KAA0K,CAC5K;EACH;AACF;AAAC"}
package/dist/index.d.ts CHANGED
@@ -11,6 +11,7 @@ export type { SerializableResults, OnComponentLoad, OnComponentEventResult } fro
11
11
  export { ComponentStatus } from './workspace-component';
12
12
  export { WorkspaceModelComponent, Workspace as WorkspaceModel } from './ui/workspace/workspace-model';
13
13
  export { WorkspaceContext } from './ui/workspace/workspace-context';
14
+ export { OutsideWorkspaceError } from './exceptions/outside-workspace';
14
15
  export type { WorkspaceComponent } from './workspace-component';
15
16
  export type { ComponentConfigFile } from './component-config-file';
16
17
  export { WorkspaceAspect };
package/dist/index.js CHANGED
@@ -9,7 +9,8 @@ var _exportNames = {
9
9
  ComponentStatus: true,
10
10
  WorkspaceModelComponent: true,
11
11
  WorkspaceModel: true,
12
- WorkspaceContext: true
12
+ WorkspaceContext: true,
13
+ OutsideWorkspaceError: true
13
14
  };
14
15
  Object.defineProperty(exports, "CheckTypes", {
15
16
  enumerable: true,
@@ -23,6 +24,12 @@ Object.defineProperty(exports, "ComponentStatus", {
23
24
  return _workspaceComponent().ComponentStatus;
24
25
  }
25
26
  });
27
+ Object.defineProperty(exports, "OutsideWorkspaceError", {
28
+ enumerable: true,
29
+ get: function () {
30
+ return _outsideWorkspace().OutsideWorkspaceError;
31
+ }
32
+ });
26
33
  Object.defineProperty(exports, "WorkspaceAspect", {
27
34
  enumerable: true,
28
35
  get: function () {
@@ -95,6 +102,13 @@ function _workspaceContext() {
95
102
  };
96
103
  return data;
97
104
  }
105
+ function _outsideWorkspace() {
106
+ const data = require("./exceptions/outside-workspace");
107
+ _outsideWorkspace = function () {
108
+ return data;
109
+ };
110
+ return data;
111
+ }
98
112
  var _default = _workspace().WorkspaceAspect;
99
113
  exports.default = _default;
100
114
 
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["WorkspaceAspect"],"sources":["index.ts"],"sourcesContent":["import { WorkspaceAspect } from './workspace.aspect';\n// eslint-disable-next-line import/prefer-default-export\nexport type { default as Workspace, ExtensionsOrigin } from './workspace';\n// TODO: change to module path once track the utils folder\nexport type { ResolvedComponent } from '@teambit/harmony.modules.resolved-component';\nexport type { AlreadyExistsError as ComponentConfigFileAlreadyExistsError } from './component-config-file';\nexport type { WorkspaceMain } from './workspace.main.runtime';\nexport type { WatchOptions } from './watch/watcher';\nexport { CheckTypes } from './watch/check-types';\nexport * from './events';\nexport type { WorkspaceUI } from './workspace.ui.runtime';\nexport type { SerializableResults, OnComponentLoad, OnComponentEventResult } from './on-component-events';\nexport { ComponentStatus } from './workspace-component';\nexport { WorkspaceModelComponent, Workspace as WorkspaceModel } from './ui/workspace/workspace-model';\nexport { WorkspaceContext } from './ui/workspace/workspace-context';\nexport type { WorkspaceComponent } from './workspace-component';\nexport type { ComponentConfigFile } from './component-config-file';\n\nexport { WorkspaceAspect };\nexport default WorkspaceAspect;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAQA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAAoE,eAKrDA,4BAAe;AAAA"}
1
+ {"version":3,"names":["WorkspaceAspect"],"sources":["index.ts"],"sourcesContent":["import { WorkspaceAspect } from './workspace.aspect';\n// eslint-disable-next-line import/prefer-default-export\nexport type { default as Workspace, ExtensionsOrigin } from './workspace';\n// TODO: change to module path once track the utils folder\nexport type { ResolvedComponent } from '@teambit/harmony.modules.resolved-component';\nexport type { AlreadyExistsError as ComponentConfigFileAlreadyExistsError } from './component-config-file';\nexport type { WorkspaceMain } from './workspace.main.runtime';\nexport type { WatchOptions } from './watch/watcher';\nexport { CheckTypes } from './watch/check-types';\nexport * from './events';\nexport type { WorkspaceUI } from './workspace.ui.runtime';\nexport type { SerializableResults, OnComponentLoad, OnComponentEventResult } from './on-component-events';\nexport { ComponentStatus } from './workspace-component';\nexport { WorkspaceModelComponent, Workspace as WorkspaceModel } from './ui/workspace/workspace-model';\nexport { WorkspaceContext } from './ui/workspace/workspace-context';\nexport { OutsideWorkspaceError } from './exceptions/outside-workspace';\nexport type { WorkspaceComponent } from './workspace-component';\nexport type { ComponentConfigFile } from './component-config-file';\n\nexport { WorkspaceAspect };\nexport default WorkspaceAspect;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAQA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AAGA;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;AAAuE,eAKxDA,4BAAe;AAAA"}
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.workspace_workspace@0.0.933/dist/workspace.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.workspace_workspace@0.0.933/dist/workspace.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.workspace_workspace@0.0.935/dist/workspace.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.workspace_workspace@0.0.935/dist/workspace.docs.mdx';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];
@@ -260,7 +260,7 @@ export declare class Workspace implements ComponentFactory {
260
260
  getDefaultExtensions(): ExtensionDataList;
261
261
  ejectMultipleConfigs(ids: ComponentID[], options: EjectConfOptions): Promise<EjectConfResult[]>;
262
262
  ejectConfig(id: ComponentID, options: EjectConfOptions): Promise<EjectConfResult>;
263
- private getSpecificExtensionsFromScope;
263
+ getSpecificExtensionsFromScope(id: ComponentID): Promise<ExtensionDataList>;
264
264
  /**
265
265
  * see component-aspect, createAspectListFromLegacy() method for a context why this is needed.
266
266
  */
@@ -1 +1 @@
1
- {"version":3,"names":["AspectSpecificField","ComponentAdded","ComponentChanged","ComponentRemoved","DEFAULT_VENDOR_DIR","Workspace","constructor","pubsub","config","consumer","scope","componentAspect","dependencyResolver","variants","aspectLoader","logger","componentList","ComponentsList","harmony","onComponentLoadSlot","onComponentChangeSlot","envs","onComponentAddSlot","onComponentRemoveSlot","onMultipleComponentsAddSlot","onPreWatchSlot","graphql","Watcher","componentLoadedSelfAsAspects","createInMemoryCache","maxSize","getMaxSizeForComponents","owner","defaultOwner","componentLoader","WorkspaceComponentLoader","validateConfig","bitMap","BitMap","componentDefaultScopeFromComponentDirAndNameWithoutConfigFile","memoize","bind","primitive","promise","maxAge","isLegacy","isEmpty","BitError","defaultScope","isValidScopeName","InvalidScopeName","path","getPath","modulesPath","join","onComponentLoad","loadFn","register","registerOnComponentChange","onComponentChangeFunc","registerOnComponentAdd","onComponentAddFunc","registerOnMultipleComponentsAdd","onMultipleComponentsAddFunc","registerOnComponentRemove","onComponentRemoveFunc","registerOnPreWatch","onPreWatchFunc","name","tokenizedPath","split","length","icon","hasModifiedDependencies","component","componentsList","listAutoTagPendingComponents","isAutoTag","find","consumerComponent","id","isEqualWithoutVersion","_legacy","getComponentIssues","state","_consumer","issues","getComponentStatus","status","getComponentStatusById","ComponentStatus","fromLegacy","isOutdated","list","filter","loadOpts","legacyIds","getAllIdsAvailableOnLane","ids","resolveMultipleComponentIds","idsToGet","limit","slice","offset","getMany","listInvalid","getInvalid","listIds","_cachedListIds","hasChanged","bitmapIdsFromCurrentLane","hasId","componentId","found","isEqual","hasName","Boolean","fullName","hasIdNested","includeCache","modified","listModifiedComponents","componentIds","map","ComponentID","newComponents","listNewComponents","getAllComponentIds","bitIds","getAllBitIds","getNewAndModifiedIds","listTagPendingComponents","newAndModified","getLogs","shortHash","startsFrom","getGraph","shouldThrowOnMissingDep","buildOneGraphForComponents","undefined","getGraphIds","graphIdsFromFsBuilder","GraphIdsFromFsBuilder","buildGraph","getSavedGraphOfComponentIfExist","versionObj","legacyScope","getVersionInstance","err","flattenedEdges","flattenedDependencies","flattenedBitIdCompIdMap","toString","Promise","all","bitId","resolveComponentId","getCompIdByIdStr","idStr","compId","Error","nodes","Object","values","edges","edge","source","target","graph","Graph","forEach","node","setNode","Node","setEdge","Edge","type","getDependentsIds","workspaceGraph","DependencyGraph","buildGraphFromWorkspace","workspaceDependencyGraph","workspaceDependents","getDependentsInfo","dependentsLegacyIds","flat","_","dependentsLegacyNoDup","BitIds","uniqFromArray","dependentsIds","createAspectList","extensionDataList","entiresP","entry","extensionDataEntryToAspectEntry","entries","createAspectListFromEntries","dataEntry","AspectEntry","get","legacyComponent","useCache","storeInCache","debug","tryLoadAsAspect","isUsingEnvEnv","isCoreAspect","toStringWithoutVersion","isAspectLoaded","set","loadAspects","e","delete","getEnvSystemDescriptor","env","calculateEnv","__getDescriptor","systemDescriptor","services","isEnvRegistered","getServices","getDescriptor","description","toObject","clearCache","resetFailedLoadAspects","clearComponentCache","clearOneComponentCache","triggerOnComponentChange","files","initiator","write","onChangeEntries","toArray","results","mapSeries","extension","onChangeFunc","onChangeResult","push","extensionId","publish","componentChanged","triggerOnComponentAdd","onAddEntries","filesystem","file","onAddFunc","onAddResult","componentAdded","triggerOnComponentRemove","onRemoveEntries","onRemoveFunc","onRemoveResult","componentRemoved","triggerOnMultipleComponentsAdd","getState","hash","getSnap","getCurrentLaneId","getCurrentRemoteLane","currentLaneId","isDefault","scopeComponentImporter","ScopeComponentsImporter","getInstance","lanes","importLanes","ScopeNotFoundOrDenied","LaneNotFound","InvalidScopeNameFromRemote","bitMapLaneId","getExportedLaneId","loader","stop","warn","message","getDefaultExtensions","extensions","ExtensionDataList","fromConfigObject","ejectMultipleConfigs","options","ejectConfig","getSpecificExtensionsFromScope","aspects","componentDir","ignoreVersion","componentConfigFile","ComponentConfigFile","propagate","override","removeEntireConfig","configPath","composePath","componentFromScope","componentExtensions","resolveScopeAspectListIds","aspectListFromScope","resolvedList","pmap","newId","newEntry","legacy","byPattern","pattern","finalPattern","targetIds","spec","isMatchNamespacePatternItem","match","components","idsByPattern","throwForNoMatch","includes","exists","MissingBitMapComponent","filterIdsFromPoolIdsByPattern","getComponentsByUserInput","includeDependents","newAndModifiedIds","comp","dependentsIdsFiltered","dependents","getComponentsUsingEnv","throwIfNotFound","allComps","allEnvs","createEnvironment","foundEnv","runtimeEnvs","runtimeEnv","envWithoutVersion","availableEnvs","getManyByLegacy","getIfExist","importAndGetMany","importCurrentLaneIfMissing","import","reFetchUnBuiltVersion","shouldReFetchUnBuiltVersion","laneId","laneObj","getCurrentLaneObject","lane","info","objects","writeObjectsToTheFS","scopeComponentsImporter","fromArray","toBitIds","hasScope","importManyDeltaWithoutDeps","fromHead","importMany","add","componentPaths","main","addComponent","AddComponents","addResults","use","aspectIdStr","aspectId","aspectIdToAdd","loadedIds","workspaceConfig","setExtension","overrideExisting","track","trackData","addOwnerToScopeName","rootDir","componentName","mainFile","result","addedComponent","addedComponents","f","relativePath","warnings","scopeName","isSelfHosted","isHostedByBit","wsDefaultScope","rootPath","pathToWrite","relative","fs","outputFile","contents","bitMapOptions","componentDirFromLegacyId","componentPackageDir","packageName","componentIdToPackageName","packageDir","toAbsolutePath","componentMap","getComponent","relativeComponentDir","getComponentDir","NoComponentDir","componentDirToAbsolute","componentDefaultScope","componentDefaultScopeFromComponentDirAndName","componentConfigFileFromComponentDirAndName","bitMapId","getExistingBitId","bitMapEntry","variantConfig","byRootDirAndName","isVendor","isVendorComponentByComponentDir","excludeOrigins","configFileExtensions","variantsExtensions","wsDefaultExtensions","mergeFromScope","getComponentIfExist","bitMapExtensions","unmergedHead","getUnmergedHead","unmergedExtensions","unmergedExtensionsSpecific","unmergedExtensionsNonSpecific","versionInstance","changeVersion","specific","nonSpecific","partition","scopeExtensions","scopeExtensionsNonSpecific","scopeExtensionsSpecific","toLegacy","clone","extensionsToMerge","envWasFoundPreviously","removedExtensionIds","addExtensionsToMerge","origin","extraData","extData","isRemoved","stringId","extsWithoutRemoved","filterRemovedExtensions","selfInMergedExtensions","findExtension","toStringWithoutScopeAndVersion","extsWithoutSelf","remove","extensionDataListFiltered","envIsCurrentlySet","filterEnvsFromExtensionsIfNeeded","warnAboutMisconfiguredEnv","setDataListAsSpecific","continuePropagating","appliedRules","sortedMatches","specificity","isDefaultExtension","resolveExtensionListIds","afterMerge","mergeConfigs","ext","loadExtensions","withoutRemoved","beforeMerge","unmerged","unmergedComponents","getEntry","head","getUnmergedComponent","envAspect","EnvsAspect","envFromEnvsAspect","getCoreEnvsIds","warnedAboutMisconfiguredEnvs","envId","consoleWarning","isModified","consumerComp","_isModified","componentStatus","nonEnvs","triggerOnPreWatch","watchOpts","preWatchFunctions","func","setDefaultScopeToComponents","newComponentIds","hasVersion","compIdsStr","setDefaultScope","WorkspaceAspect","mergeIntoExisting","dir","dirname","addSpecificComponentConfig","shouldMergeWithExisting","shouldMergeWithPrevious","addAspect","obj","toConfigObject","merge","addComponentConfig","removeSpecificComponentConfig","markWithMinusIfNotExist","removeAspect","removeComponentConfig","getAspectIdFromConfig","ignoreAspectVersion","aspectEntry","getSpecificComponentConfig","getBitmapEntry","extensionList","promises","vendorDir","vendor","directory","pathIsInside","getComponentIdByPath","componentPath","isAbsolute","linuxPath","pathNormalizeToLinux","absComponentDir","defaultScopeFromVariantsOrWs","load","getAspectsGraphWithoutCore","isAspect","coreAspectsStringIds","getCoreAspectIds","throwOnError","neededFor","callId","Math","floor","random","loggerPrefix","notLoadedIds","idsWithoutCore","difference","importAndGetAspects","isUsingAspectEnv","isValidAspect","attr","workspaceComps","scopeComps","groupComponentsByWorkspaceAndScope","c","scopeIds","aspect","workspaceAspects","requireComponents","workspaceManifests","getManifestsFromRequireableExtensions","potentialPluginsIndexes","compact","manifest","index","workspaceManifestsIds","m","scopeIdsGrouped","groupAspectIdsByEnvOfTheList","scopeEnvsManifestsIds","currentLane","manifests","scopeOtherManifests","other","getManifestsGraphRecursively","packageManagerConfigRootDir","scopeOtherManifestsIds","loadExtensionsByManifests","pluginsWorkspaceComps","pluginsWorkspaceAspects","pluginsWorkspaceManifests","concat","ignoreIds","shouldLoadFunc","graphFromFsBuilder","GraphFromFsBuilder","resolveAspects","runtimeName","opts","defaultOpts","excludeCore","requestedOnly","mergedOpts","missingPaths","stringIds","idsToResolve","extensionsIds","coreAspectsIds","userAspectsIds","componentIdsToResolve","workspaceIds","groupIdsByWorkspaceAndScope","wsComponents","aspectDefs","compStringId","localPath","getComponentPackagePath","isExist","pathExists","runtimePath","getRuntimePath","aspectFilePath","getAspectFilePath","aspectPath","scopeAspectDefs","coreAspectDefs","coreId","rawDef","getAspectDef","loadDefinition","coreAspect","link","allDefs","fromString","afterExclusion","def","isCore","getId","isTarget","uniqDefs","uniqBy","defs","componentIdsString","existOnWorkspace","originatedFrom","extensionsIdsP","extensionEntry","loadedExtensions","extensionsToLoad","getTempDir","PREFIX","cacheDir","existsSync","mkdirSync","recursive","resolveP","requireFunc","plugins","getPlugins","has","MainRuntime","require","RequireableComponent","resolved","remotes","_legacyRemotes","isHub","ComponentNotFound","configStr","JSON","stringify","raw","_reloadConsumer","loadConsumer","getRuntimeModulePath","defaultDirectory","legacyDefaultDirectory","getDefaultScope","legacyId","getParsedIdIfExist","shouldSearchWithoutScopeInProvidedId","startsWith","idWithVersion","idWithoutVersion","version","_bitMapId","_bitMapIdWithoutVersion","_bitMapIdWithVersion","endsWith","defaultScopeForBitmapId","getFromBitmapAddDefaultScope","_bitmapIdWithVersionForSource","fromScope","error","BitId","parse","resolveExtensionsList","resolveMergedExtensionsP","resolvedId","addDefaultScopeToExtensionsList","changeScope","setEnvToComponents","envStrWithPossiblyVersion","resolveEnvIdWithPotentialVersionForConfig","envIdStrNoVersion","unsetEnvFromComponents","existsOnWorkspace","comps","changed","unchanged","envsAspect","currentEnv","REMOVE_EXTENSION_SPECIAL_SIGN","currentEnvWithPotentialVersion","commandsToReFetch","process","argv"],"sources":["workspace.ts"],"sourcesContent":["/* eslint-disable max-lines */\nimport memoize from 'memoizee';\nimport mapSeries from 'p-map-series';\nimport { Graph, Node, Edge } from '@teambit/graph.cleargraph';\nimport type { PubsubMain } from '@teambit/pubsub';\nimport { IssuesList } from '@teambit/component-issues';\nimport type { AspectLoaderMain, AspectDefinition } from '@teambit/aspect-loader';\nimport { getAspectDef } from '@teambit/aspect-loader';\nimport { MainRuntime } from '@teambit/cli';\nimport DependencyGraph from '@teambit/legacy/dist/scope/graph/scope-graph';\nimport {\n AspectEntry,\n ComponentMain,\n Component,\n ComponentFactory,\n ComponentID,\n AspectList,\n AspectData,\n InvalidComponent,\n ResolveAspectsOptions,\n} from '@teambit/component';\nimport { BitError } from '@teambit/bit-error';\nimport { REMOVE_EXTENSION_SPECIAL_SIGN } from '@teambit/legacy/dist/consumer/config';\nimport { ComponentScopeDirMap, ConfigMain } from '@teambit/config';\nimport { DependencyResolverMain } from '@teambit/dependency-resolver';\nimport { EnvsMain, EnvsAspect, EnvServiceList } from '@teambit/envs';\nimport { GraphqlMain } from '@teambit/graphql';\nimport { Harmony } from '@teambit/harmony';\nimport { Logger } from '@teambit/logger';\nimport type { ScopeMain } from '@teambit/scope';\nimport { isMatchNamespacePatternItem } from '@teambit/workspace.modules.match-pattern';\nimport { RequireableComponent } from '@teambit/harmony.modules.requireable-component';\nimport type { VariantsMain } from '@teambit/variants';\nimport { link } from '@teambit/legacy/dist/api/consumer';\nimport { BitIds } from '@teambit/legacy/dist/bit-id';\nimport { BitId, InvalidScopeName, InvalidScopeNameFromRemote, isValidScopeName } from '@teambit/legacy-bit-id';\nimport { LaneId } from '@teambit/lane-id';\nimport { Consumer, loadConsumer } from '@teambit/legacy/dist/consumer';\nimport { GetBitMapComponentOptions } from '@teambit/legacy/dist/consumer/bit-map/bit-map';\nimport AddComponents from '@teambit/legacy/dist/consumer/component-ops/add-components';\nimport type {\n AddActionResults,\n Warnings,\n} from '@teambit/legacy/dist/consumer/component-ops/add-components/add-components';\nimport { getMaxSizeForComponents, InMemoryCache } from '@teambit/legacy/dist/cache/in-memory-cache';\nimport { createInMemoryCache } from '@teambit/legacy/dist/cache/cache-factory';\nimport { ComponentNotFound } from '@teambit/legacy/dist/scope/exceptions';\nimport ComponentsList from '@teambit/legacy/dist/consumer/component/components-list';\nimport { NoComponentDir } from '@teambit/legacy/dist/consumer/component/exceptions/no-component-dir';\nimport { ExtensionDataList, ExtensionDataEntry } from '@teambit/legacy/dist/consumer/config/extension-data';\nimport { pathIsInside } from '@teambit/legacy/dist/utils';\nimport componentIdToPackageName from '@teambit/legacy/dist/utils/bit/component-id-to-package-name';\nimport {\n PathOsBased,\n PathOsBasedRelative,\n PathOsBasedAbsolute,\n pathNormalizeToLinux,\n} from '@teambit/legacy/dist/utils/path';\nimport fs from 'fs-extra';\nimport { CompIdGraph, DepEdgeType } from '@teambit/graph';\nimport { slice, uniqBy, difference, compact, partition, isEmpty, merge } from 'lodash';\nimport path from 'path';\nimport ConsumerComponent from '@teambit/legacy/dist/consumer/component';\nimport type { ComponentLog } from '@teambit/legacy/dist/scope/models/model-component';\nimport { CompilationInitiator } from '@teambit/compiler';\nimport ScopeComponentsImporter from '@teambit/legacy/dist/scope/component-ops/scope-components-importer';\nimport { MissingBitMapComponent } from '@teambit/legacy/dist/consumer/bit-map/exceptions';\nimport loader from '@teambit/legacy/dist/cli/loader';\nimport { Lane, Version } from '@teambit/legacy/dist/scope/models';\nimport { LaneNotFound } from '@teambit/legacy/dist/api/scope/lib/exceptions/lane-not-found';\nimport { ScopeNotFoundOrDenied } from '@teambit/legacy/dist/remotes/exceptions/scope-not-found-or-denied';\nimport { ComponentLoadOptions } from '@teambit/legacy/dist/consumer/component/component-loader';\nimport { ComponentConfigFile } from './component-config-file';\nimport {\n OnComponentAdd,\n OnComponentChange,\n OnComponentEventResult,\n OnComponentLoad,\n OnComponentRemove,\n OnMultipleComponentsAdd,\n SerializableResults,\n} from './on-component-events';\nimport { WorkspaceExtConfig } from './types';\nimport { Watcher, WatchOptions } from './watch/watcher';\nimport { ComponentStatus } from './workspace-component/component-status';\nimport {\n OnComponentAddSlot,\n OnComponentChangeSlot,\n OnComponentLoadSlot,\n OnComponentRemoveSlot,\n OnMultipleComponentsAddSlot,\n OnPreWatch,\n OnPreWatchSlot,\n} from './workspace.provider';\nimport { WorkspaceComponentLoader } from './workspace-component/workspace-component-loader';\nimport { GraphFromFsBuilder, ShouldLoadFunc } from './build-graph-from-fs';\nimport { BitMap } from './bit-map';\nimport { WorkspaceAspect } from './workspace.aspect';\nimport { GraphIdsFromFsBuilder } from './build-graph-ids-from-fs';\n\nexport type EjectConfResult = {\n configPath: string;\n};\n\nexport const AspectSpecificField = '__specific';\nexport const ComponentAdded = 'componentAdded';\nexport const ComponentChanged = 'componentChanged';\nexport const ComponentRemoved = 'componentRemoved';\n\nexport interface EjectConfOptions {\n propagate?: boolean;\n override?: boolean;\n}\n\nexport type TrackData = {\n rootDir: PathOsBasedRelative; // path relative to the workspace\n componentName?: string; // if empty, it'll be generated from the path\n mainFile?: string; // if empty, attempts will be made to guess the best candidate\n defaultScope?: string; // can be entered as part of \"bit create\" command, helpful for out-of-sync logic\n config?: { [aspectName: string]: any }; // config specific to this component, which overrides variants of workspace.jsonc\n};\n\nexport type ExtensionsOrigin =\n | 'BitmapFile'\n | 'ModelSpecific'\n | 'ModelNonSpecific'\n | 'UnmergedSpecific'\n | 'UnmergedNonSpecific'\n | 'WorkspaceVariants'\n | 'ComponentJsonFile'\n | 'WorkspaceDefault'\n | 'FinalAfterMerge';\n\nexport type TrackResult = { componentName: string; files: string[]; warnings: Warnings };\n\nconst DEFAULT_VENDOR_DIR = 'vendor';\n\n/**\n * API of the Bit Workspace\n */\nexport class Workspace implements ComponentFactory {\n priority = true;\n owner?: string;\n componentsScopeDirsMap: ComponentScopeDirMap;\n componentLoader: WorkspaceComponentLoader;\n bitMap: BitMap;\n private _cachedListIds?: ComponentID[];\n private componentLoadedSelfAsAspects: InMemoryCache<boolean>; // cache loaded components\n private warnedAboutMisconfiguredEnvs: string[] = []; // cache env-ids that have been errored about not having \"env\" type\n constructor(\n /**\n * private pubsub.\n */\n private pubsub: PubsubMain,\n\n private config: WorkspaceExtConfig,\n /**\n * private access to the legacy consumer instance.\n */\n public consumer: Consumer,\n\n /**\n * access to the workspace `Scope` instance\n */\n readonly scope: ScopeMain,\n\n /**\n * access to the `ComponentProvider` instance\n */\n private componentAspect: ComponentMain,\n\n private dependencyResolver: DependencyResolverMain,\n\n private variants: VariantsMain,\n\n private aspectLoader: AspectLoaderMain,\n\n private logger: Logger,\n\n private componentList: ComponentsList = new ComponentsList(consumer),\n\n /**\n * private reference to the instance of Harmony.\n */\n private harmony: Harmony,\n\n /**\n * on component load slot.\n */\n public onComponentLoadSlot: OnComponentLoadSlot,\n\n /**\n * on component change slot.\n */\n private onComponentChangeSlot: OnComponentChangeSlot,\n\n private envs: EnvsMain,\n\n /**\n * on component add slot.\n */\n private onComponentAddSlot: OnComponentAddSlot,\n\n private onComponentRemoveSlot: OnComponentRemoveSlot,\n\n private onMultipleComponentsAddSlot: OnMultipleComponentsAddSlot,\n\n private onPreWatchSlot: OnPreWatchSlot,\n\n private graphql: GraphqlMain\n ) {\n this.componentLoadedSelfAsAspects = createInMemoryCache({ maxSize: getMaxSizeForComponents() });\n\n // TODO: refactor - prefer to avoid code inside the constructor.\n this.owner = this.config?.defaultOwner;\n this.componentLoader = new WorkspaceComponentLoader(this, logger, dependencyResolver, envs);\n this.validateConfig();\n this.bitMap = new BitMap(this.consumer.bitMap, this.consumer);\n // memoize this method to improve performance.\n this.componentDefaultScopeFromComponentDirAndNameWithoutConfigFile = memoize(\n this.componentDefaultScopeFromComponentDirAndNameWithoutConfigFile.bind(this),\n {\n primitive: true,\n promise: true,\n maxAge: 60 * 1000, // 1 min\n }\n );\n }\n\n private validateConfig() {\n if (this.consumer.isLegacy) return;\n if (isEmpty(this.config))\n throw new BitError(\n `fatal: workspace config is empty. probably one of bit files is missing. consider running \"bit init\"`\n );\n const defaultScope = this.config.defaultScope;\n if (!defaultScope) throw new BitError('defaultScope is missing');\n if (!isValidScopeName(defaultScope)) throw new InvalidScopeName(defaultScope);\n }\n\n /**\n * watcher api.\n */\n readonly watcher = new Watcher(this, this.pubsub);\n\n /**\n * root path of the Workspace.\n */\n get path() {\n return this.consumer.getPath();\n }\n\n /** get the `node_modules` folder of this workspace */\n private get modulesPath() {\n return path.join(this.path, 'node_modules');\n }\n\n get isLegacy(): boolean {\n return this.consumer.isLegacy;\n }\n\n onComponentLoad(loadFn: OnComponentLoad) {\n this.onComponentLoadSlot.register(loadFn);\n return this;\n }\n\n registerOnComponentChange(onComponentChangeFunc: OnComponentChange) {\n this.onComponentChangeSlot.register(onComponentChangeFunc);\n return this;\n }\n\n registerOnComponentAdd(onComponentAddFunc: OnComponentAdd) {\n this.onComponentAddSlot.register(onComponentAddFunc);\n return this;\n }\n\n registerOnMultipleComponentsAdd(onMultipleComponentsAddFunc: OnMultipleComponentsAdd) {\n this.onMultipleComponentsAddSlot.register(onMultipleComponentsAddFunc);\n return this;\n }\n\n registerOnComponentRemove(onComponentRemoveFunc: OnComponentRemove) {\n this.onComponentRemoveSlot.register(onComponentRemoveFunc);\n return this;\n }\n\n registerOnPreWatch(onPreWatchFunc: OnPreWatch) {\n this.onPreWatchSlot.register(onPreWatchFunc);\n return this;\n }\n\n /**\n * name of the workspace as configured in either `workspace.json`.\n * defaults to workspace root directory name.\n */\n get name() {\n if (this.config.name) return this.config.name;\n const tokenizedPath = this.path.split('/');\n return tokenizedPath[tokenizedPath.length - 1];\n }\n\n get icon() {\n return this.config.icon;\n }\n\n async hasModifiedDependencies(component: Component) {\n const componentsList = new ComponentsList(this.consumer);\n const listAutoTagPendingComponents = await componentsList.listAutoTagPendingComponents();\n const isAutoTag = listAutoTagPendingComponents.find((consumerComponent) =>\n consumerComponent.id.isEqualWithoutVersion(component.id._legacy)\n );\n if (isAutoTag) return true;\n return false;\n }\n\n /**\n * get Component issues\n */\n getComponentIssues(component: Component): IssuesList | null {\n return component.state._consumer.issues || null;\n }\n\n /**\n * provides status of all components in the workspace.\n */\n async getComponentStatus(component: Component): Promise<ComponentStatus> {\n const status = await this.consumer.getComponentStatusById(component.id._legacy);\n const hasModifiedDependencies = await this.hasModifiedDependencies(component);\n return ComponentStatus.fromLegacy(status, hasModifiedDependencies, component.isOutdated());\n }\n\n /**\n * list all workspace components.\n */\n async list(filter?: { offset: number; limit: number }, loadOpts?: ComponentLoadOptions): Promise<Component[]> {\n const legacyIds = this.consumer.bitMap.getAllIdsAvailableOnLane();\n const ids = await this.resolveMultipleComponentIds(legacyIds);\n const idsToGet = filter && filter.limit ? slice(ids, filter.offset, filter.offset + filter.limit) : ids;\n return this.getMany(idsToGet, loadOpts);\n }\n\n /**\n * list all invalid components.\n * (see the invalid criteria in ConsumerComponent.isComponentInvalidByErrorType())\n */\n async listInvalid(): Promise<InvalidComponent[]> {\n const legacyIds = this.consumer.bitMap.getAllIdsAvailableOnLane();\n const ids = await this.resolveMultipleComponentIds(legacyIds);\n return this.componentLoader.getInvalid(ids);\n }\n\n /**\n * get ids of all workspace components.\n */\n async listIds(): Promise<ComponentID[]> {\n if (this._cachedListIds && this.bitMap.hasChanged()) {\n delete this._cachedListIds;\n }\n if (!this._cachedListIds) {\n this._cachedListIds = await this.resolveMultipleComponentIds(this.consumer.bitmapIdsFromCurrentLane);\n }\n return this._cachedListIds;\n }\n\n /**\n * Check if a specific id exist in the workspace\n * @param componentId\n */\n async hasId(componentId: ComponentID): Promise<boolean> {\n const ids = await this.listIds();\n const found = ids.find((id) => {\n return id.isEqual(componentId);\n });\n return !!found;\n }\n\n /**\n * whether or not a workspace has a component with the given name\n */\n async hasName(name: string): Promise<boolean> {\n const ids = await this.listIds();\n return Boolean(ids.find((id) => id.fullName === name));\n }\n\n /**\n * Check if a specific id exist in the workspace or in the scope\n * @param componentId\n */\n async hasIdNested(componentId: ComponentID, includeCache = true): Promise<boolean> {\n const found = await this.hasId(componentId);\n if (found) return found;\n return this.scope.hasIdNested(componentId, includeCache);\n }\n\n /**\n * list all modified components in the workspace.\n */\n async modified(): Promise<Component[]> {\n const ids: any = await this.componentList.listModifiedComponents(false);\n const componentIds = ids.map(ComponentID.fromLegacy);\n return this.getMany(componentIds);\n }\n\n /**\n * list all new components in the workspace.\n */\n async newComponents() {\n const ids: any = await this.componentList.listNewComponents(false);\n const componentIds = ids.map(ComponentID.fromLegacy);\n return this.getMany(componentIds);\n }\n\n /**\n * get all workspace component-ids, include vendor components.\n * (exclude nested dependencies in case dependencies are saved as components and not packages)\n */\n getAllComponentIds(): Promise<ComponentID[]> {\n const bitIds = this.consumer.bitMap.getAllBitIds();\n return this.resolveMultipleComponentIds(bitIds);\n }\n\n async getNewAndModifiedIds(): Promise<ComponentID[]> {\n const ids = await this.componentList.listTagPendingComponents();\n return this.resolveMultipleComponentIds(ids);\n }\n\n async newAndModified(): Promise<Component[]> {\n const ids = await this.getNewAndModifiedIds();\n return this.getMany(ids);\n }\n\n async getLogs(id: ComponentID, shortHash = false, startsFrom?: string): Promise<ComponentLog[]> {\n return this.scope.getLogs(id, shortHash, startsFrom);\n }\n\n async getGraph(ids?: ComponentID[], shouldThrowOnMissingDep = true): Promise<Graph<Component, string>> {\n if (!ids || ids.length < 1) ids = await this.listIds();\n\n return this.buildOneGraphForComponents(ids, undefined, undefined, shouldThrowOnMissingDep);\n }\n\n async getGraphIds(ids?: ComponentID[], shouldThrowOnMissingDep = true): Promise<CompIdGraph> {\n if (!ids || ids.length < 1) ids = await this.listIds();\n\n const graphIdsFromFsBuilder = new GraphIdsFromFsBuilder(\n this,\n this.logger,\n this.dependencyResolver,\n shouldThrowOnMissingDep\n );\n return graphIdsFromFsBuilder.buildGraph(ids);\n }\n\n async getSavedGraphOfComponentIfExist(component: Component) {\n let versionObj: Version;\n try {\n versionObj = await this.scope.legacyScope.getVersionInstance(component.id._legacy);\n } catch (err) {\n return null;\n }\n\n const flattenedEdges = versionObj.flattenedEdges;\n if (!flattenedEdges.length && versionObj.flattenedDependencies.length) {\n // there are flattenedDependencies, so must be edges, if they're empty, it's because the component was tagged\n // with a version < ~0.0.901, so this flattenedEdges wasn't exist.\n return null;\n }\n const flattenedBitIdCompIdMap: { [bitIdStr: string]: ComponentID } = {};\n flattenedBitIdCompIdMap[component.id._legacy.toString()] = component.id;\n await Promise.all(\n versionObj.flattenedDependencies.map(async (bitId) => {\n flattenedBitIdCompIdMap[bitId.toString()] = await this.resolveComponentId(bitId);\n })\n );\n const getCompIdByIdStr = (idStr: string): ComponentID => {\n const compId = flattenedBitIdCompIdMap[idStr];\n if (!compId)\n throw new Error(`id ${idStr} exists in flattenedEdges but not in flattened of ${component.id.toString()}`);\n return compId;\n };\n const nodes = Object.values(flattenedBitIdCompIdMap);\n const edges = flattenedEdges.map((edge) => ({\n ...edge,\n source: getCompIdByIdStr(edge.source.toString()),\n target: getCompIdByIdStr(edge.target.toString()),\n }));\n\n const graph = new Graph<ComponentID, DepEdgeType>();\n nodes.forEach((node) => graph.setNode(new Node(node.toString(), node)));\n edges.forEach((edge) => graph.setEdge(new Edge(edge.source.toString(), edge.target.toString(), edge.type)));\n return graph;\n }\n\n /**\n * given component ids, find their dependents in the workspace\n */\n async getDependentsIds(ids: ComponentID[]): Promise<ComponentID[]> {\n const workspaceGraph = await DependencyGraph.buildGraphFromWorkspace(this.consumer, true);\n const workspaceDependencyGraph = new DependencyGraph(workspaceGraph);\n const workspaceDependents = ids.map((id) => workspaceDependencyGraph.getDependentsInfo(id._legacy));\n const dependentsLegacyIds = workspaceDependents.flat().map((_) => _.id);\n const dependentsLegacyNoDup = BitIds.uniqFromArray(dependentsLegacyIds);\n const dependentsIds = await this.resolveMultipleComponentIds(dependentsLegacyNoDup);\n return dependentsIds;\n }\n\n public async createAspectList(extensionDataList: ExtensionDataList) {\n const entiresP = extensionDataList.map((entry) => this.extensionDataEntryToAspectEntry(entry));\n const entries: AspectEntry[] = await Promise.all(entiresP);\n return this.componentAspect.createAspectListFromEntries(entries);\n }\n\n private async extensionDataEntryToAspectEntry(dataEntry: ExtensionDataEntry): Promise<AspectEntry> {\n return new AspectEntry(await this.resolveComponentId(dataEntry.id), dataEntry);\n }\n\n /**\n * get a component from workspace\n * @param id component ID\n */\n async get(\n componentId: ComponentID,\n legacyComponent?: ConsumerComponent,\n useCache = true,\n storeInCache = true,\n loadOpts?: ComponentLoadOptions\n ): Promise<Component> {\n this.logger.debug(`get ${componentId.toString()}`);\n const component = await this.componentLoader.get(componentId, legacyComponent, useCache, storeInCache, loadOpts);\n // When loading a component if it's an env make sure to load it as aspect as well\n // We only want to try load it as aspect if it's the first time we load the component\n const tryLoadAsAspect = this.componentLoadedSelfAsAspects.get(component.id.toString()) === undefined;\n // const config = this.harmony.get<ConfigMain>('teambit.harmony/config');\n\n // We are loading the component as aspect if it's an env, in order to be able to run the env-preview-template task which run only on envs.\n // Without this loading we will have a problem in case the env is the only component in the workspace. in that case we will load it as component\n // then we don't run it's provider so it doesn't register to the env slot, so we don't know it's an env.\n if (\n tryLoadAsAspect &&\n this.envs.isUsingEnvEnv(component) &&\n !this.aspectLoader.isCoreAspect(component.id.toStringWithoutVersion()) &&\n !this.aspectLoader.isAspectLoaded(component.id.toString()) &&\n (await this.hasId(component.id))\n // !config.extension(component.id.toStringWithoutVersion(), true)\n ) {\n try {\n this.componentLoadedSelfAsAspects.set(component.id.toString(), true);\n this.logger.debug(`trying to load self as aspect with id ${component.id.toString()}`);\n await this.loadAspects([component.id.toString()], undefined, component.id.toString());\n // In most cases if the load self as aspect failed we don't care about it.\n // we only need it in specific cases to work, but this workspace.get runs on different\n // cases where it might fail (like when importing aspect, after the import objects\n // when we write the package.json we run the applyTransformers which get to pkg which call\n // host.get, but the component not written yet to the fs, so it fails.)\n } catch (e) {\n this.logger.debug(`fail to load self as aspect with id ${component.id.toString()}`);\n this.componentLoadedSelfAsAspects.delete(component.id.toString());\n return component;\n }\n }\n this.componentLoadedSelfAsAspects.set(component.id.toString(), false);\n\n return component;\n }\n\n // TODO: @gilad we should refactor this asap into to the envs aspect.\n async getEnvSystemDescriptor(component: Component): Promise<AspectData> {\n const env = this.envs.calculateEnv(component);\n if (env.env.__getDescriptor && typeof env.env.__getDescriptor === 'function') {\n const systemDescriptor = await env.env.__getDescriptor();\n // !important persist services only on the env itself.\n let services: undefined | EnvServiceList;\n if (this.envs.isEnvRegistered(component.id.toString())) services = this.envs.getServices(env);\n const icon = this.aspectLoader.getDescriptor(env.id)?.icon || env.env.icon;\n\n return {\n type: systemDescriptor.type,\n // Make sure to store the env id in the data without the version\n // The version should always come from the aspect id configured on the component\n id: env.id.split('@')[0],\n name: env.name,\n icon,\n description: env.description,\n services: services?.toObject(),\n };\n }\n\n return {};\n }\n\n clearCache() {\n this.aspectLoader.resetFailedLoadAspects();\n this.logger.debug('clearing the workspace and scope caches');\n delete this._cachedListIds;\n this.componentLoader.clearCache();\n this.scope.clearCache();\n this.componentList = new ComponentsList(this.consumer);\n }\n\n clearComponentCache(id: ComponentID) {\n this.componentLoader.clearComponentCache(id);\n this.consumer.componentLoader.clearOneComponentCache(id._legacy);\n this.componentList = new ComponentsList(this.consumer);\n }\n\n async triggerOnComponentChange(\n id: ComponentID,\n files: string[],\n initiator?: CompilationInitiator\n ): Promise<OnComponentEventResult[]> {\n const component = await this.get(id);\n // if a new file was added, upon component-load, its .bitmap entry is updated to include the\n // new file. write these changes to the .bitmap file so then other processes have access to\n // this new file. If the .bitmap wasn't change, it won't do anything.\n await this.bitMap.write();\n const onChangeEntries = this.onComponentChangeSlot.toArray(); // e.g. [ [ 'teambit.bit/compiler', [Function: bound onComponentChange] ] ]\n const results: Array<{ extensionId: string; results: SerializableResults }> = [];\n await mapSeries(onChangeEntries, async ([extension, onChangeFunc]) => {\n const onChangeResult = await onChangeFunc(component, files, initiator);\n results.push({ extensionId: extension, results: onChangeResult });\n });\n\n // TODO: find way to standardize event names.\n await this.graphql.pubsub.publish(ComponentChanged, { componentChanged: { component } });\n return results;\n }\n\n async triggerOnComponentAdd(id: ComponentID): Promise<OnComponentEventResult[]> {\n const component = await this.get(id);\n const onAddEntries = this.onComponentAddSlot.toArray(); // e.g. [ [ 'teambit.bit/compiler', [Function: bound onComponentChange] ] ]\n const results: Array<{ extensionId: string; results: SerializableResults }> = [];\n const files = component.state.filesystem.files.map((file) => file.path);\n await mapSeries(onAddEntries, async ([extension, onAddFunc]) => {\n const onAddResult = await onAddFunc(component, files);\n results.push({ extensionId: extension, results: onAddResult });\n });\n\n await this.graphql.pubsub.publish(ComponentAdded, { componentAdded: { component } });\n return results;\n }\n\n async triggerOnComponentRemove(id: ComponentID): Promise<OnComponentEventResult[]> {\n const onRemoveEntries = this.onComponentRemoveSlot.toArray(); // e.g. [ [ 'teambit.bit/compiler', [Function: bound onComponentChange] ] ]\n const results: Array<{ extensionId: string; results: SerializableResults }> = [];\n await mapSeries(onRemoveEntries, async ([extension, onRemoveFunc]) => {\n const onRemoveResult = await onRemoveFunc(id);\n results.push({ extensionId: extension, results: onRemoveResult });\n });\n\n await this.graphql.pubsub.publish(ComponentRemoved, { componentRemoved: { componentIds: [id.toObject()] } });\n return results;\n }\n\n async triggerOnMultipleComponentsAdd(): Promise<void> {\n const onAddEntries = this.onMultipleComponentsAddSlot.toArray();\n await mapSeries(onAddEntries, async ([, onAddFunc]) => onAddFunc());\n }\n\n getState(id: ComponentID, hash: string) {\n return this.scope.getState(id, hash);\n }\n\n getSnap(id: ComponentID, hash: string) {\n return this.scope.getSnap(id, hash);\n }\n\n getCurrentLaneId(): LaneId {\n return this.consumer.getCurrentLaneId();\n }\n\n /**\n * if checked out to a lane and the lane exists in the remote,\n * return the remote lane id (name+scope). otherwise, return null.\n */\n async getCurrentRemoteLane(): Promise<Lane | null> {\n const currentLaneId = this.getCurrentLaneId();\n if (currentLaneId.isDefault()) {\n return null;\n }\n const scopeComponentImporter = ScopeComponentsImporter.getInstance(this.consumer.scope);\n try {\n const lanes = await scopeComponentImporter.importLanes([currentLaneId]);\n\n return lanes[0];\n } catch (err) {\n if (\n err instanceof InvalidScopeName ||\n err instanceof ScopeNotFoundOrDenied ||\n err instanceof LaneNotFound ||\n err instanceof InvalidScopeNameFromRemote\n ) {\n const bitMapLaneId = this.bitMap.getExportedLaneId();\n if (bitMapLaneId?.isEqual(currentLaneId)) {\n throw err; // we know the lane is not new, so the error is legit\n }\n // the lane could be a local lane so no need to throw an error in such case\n loader.stop();\n this.logger.warn(`unable to get lane's data from a remote due to an error:\\n${err.message}`);\n return null;\n }\n throw err;\n }\n }\n\n getDefaultExtensions(): ExtensionDataList {\n if (!this.config.extensions) {\n return new ExtensionDataList();\n }\n return ExtensionDataList.fromConfigObject(this.config.extensions);\n }\n\n async ejectMultipleConfigs(ids: ComponentID[], options: EjectConfOptions): Promise<EjectConfResult[]> {\n return Promise.all(ids.map((id) => this.ejectConfig(id, options)));\n }\n\n async ejectConfig(id: ComponentID, options: EjectConfOptions): Promise<EjectConfResult> {\n const componentId = await this.resolveComponentId(id);\n const extensions = await this.getSpecificExtensionsFromScope(id);\n const aspects = await this.createAspectList(extensions);\n const componentDir = this.componentDir(id, { ignoreVersion: true });\n const componentConfigFile = new ComponentConfigFile(componentId, aspects, componentDir, options.propagate);\n await componentConfigFile.write({ override: options.override });\n // remove config from the .bitmap as it's not needed anymore. it is replaced by the component.json\n this.bitMap.removeEntireConfig(id);\n await this.bitMap.write();\n return {\n configPath: ComponentConfigFile.composePath(componentDir),\n };\n }\n\n private async getSpecificExtensionsFromScope(id: ComponentID): Promise<ExtensionDataList> {\n const componentFromScope = await this.scope.get(id);\n const { extensions } = await this.componentExtensions(id, componentFromScope, [\n 'WorkspaceDefault',\n 'WorkspaceVariants',\n ]);\n\n return extensions;\n }\n\n /**\n * see component-aspect, createAspectListFromLegacy() method for a context why this is needed.\n */\n private async resolveScopeAspectListIds(aspectListFromScope: AspectList): Promise<AspectList> {\n const resolvedList = await aspectListFromScope.pmap(async (entry) => {\n if (entry.id.scope !== this.scope.name) {\n return entry;\n }\n const newId = await this.resolveComponentId(entry.id.fullName);\n const newEntry = new AspectEntry(newId, entry.legacy);\n return newEntry;\n });\n return resolvedList;\n }\n\n /**\n * @deprecated use `this.idsByPattern` instead for consistency. also, it supports negation and list of patterns.\n *\n * load components into the workspace through a variants pattern.\n * @param pattern variants.\n * @param scope scope name.\n */\n async byPattern(pattern: string, scope = '**'): Promise<Component[]> {\n const ids = await this.listIds();\n const finalPattern = `${scope}/${pattern || '**'}`;\n const targetIds = ids.filter((id) => {\n const spec = isMatchNamespacePatternItem(id.toStringWithoutVersion(), finalPattern);\n return spec.match;\n });\n\n const components = await this.getMany(targetIds);\n return components;\n }\n\n /**\n * get component-ids matching the given pattern. a pattern can have multiple patterns separated by a comma.\n * it supports negate (!) character to exclude ids.\n */\n async idsByPattern(pattern: string, throwForNoMatch = true): Promise<ComponentID[]> {\n if (!pattern.includes('*') && !pattern.includes(',')) {\n // if it's not a pattern but just id, resolve it without multimatch to support specifying id without scope-name\n const id = await this.resolveComponentId(pattern);\n if (this.exists(id)) return [id];\n if (throwForNoMatch) throw new MissingBitMapComponent(pattern);\n return [];\n }\n const ids = await this.listIds();\n return this.scope.filterIdsFromPoolIdsByPattern(pattern, ids, throwForNoMatch);\n }\n\n /**\n * useful for workspace commands, such as `bit build`, `bit compile`.\n * by default, it should be running on new and modified components.\n * a user can specify `--all` to run on all components or specify a pattern to limit to specific components.\n * some commands such as build/test needs to run also on the dependents.\n */\n async getComponentsByUserInput(all?: boolean, pattern?: string, includeDependents = false): Promise<Component[]> {\n if (all) {\n return this.list();\n }\n if (pattern) {\n const ids = await this.idsByPattern(pattern);\n return this.getMany(ids);\n }\n const newAndModified = await this.newAndModified();\n if (includeDependents) {\n const newAndModifiedIds = newAndModified.map((comp) => comp.id);\n const dependentsIds = await this.getDependentsIds(newAndModifiedIds);\n const dependentsIdsFiltered = dependentsIds.filter((id) => !newAndModified.find((_) => _.id.isEqual(id)));\n const dependents = await this.getMany(dependentsIdsFiltered);\n newAndModified.push(...dependents);\n }\n return newAndModified;\n }\n\n async getComponentsUsingEnv(env: string, ignoreVersion = true, throwIfNotFound = false): Promise<Component[]> {\n const allComps = await this.list();\n const allEnvs = await this.envs.createEnvironment(allComps);\n const foundEnv = allEnvs.runtimeEnvs.find((runtimeEnv) => {\n if (runtimeEnv.id === env) return true;\n if (!ignoreVersion) return false;\n const envWithoutVersion = runtimeEnv.id.split('@')[0];\n return env === envWithoutVersion;\n });\n if (!foundEnv && throwIfNotFound) {\n const availableEnvs = allEnvs.runtimeEnvs.map((runtimeEnv) => runtimeEnv.id);\n throw new BitError(`unable to find components that using \"${env}\" env.\nthe following envs are used in this workspace: ${availableEnvs.join(', ')}`);\n }\n return foundEnv?.components || [];\n }\n\n async getMany(ids: Array<ComponentID>, loadOpts?: ComponentLoadOptions): Promise<Component[]> {\n return this.componentLoader.getMany(ids, loadOpts);\n }\n\n getManyByLegacy(components: ConsumerComponent[], loadOpts?: ComponentLoadOptions): Promise<Component[]> {\n return mapSeries(components, async (component) => {\n const id = await this.resolveComponentId(component.id);\n return this.get(id, component, true, true, loadOpts);\n });\n }\n\n /**\n * don't throw an error if the component was not found, simply return undefined.\n */\n async getIfExist(componentId: ComponentID): Promise<Component | undefined> {\n return this.componentLoader.getIfExist(componentId);\n }\n\n /**\n * whether a component exists in the workspace\n */\n exists(componentId: ComponentID): boolean {\n return Boolean(this.consumer.bitmapIdsFromCurrentLane.find((_) => _.isEqualWithoutVersion(componentId._legacy)));\n }\n\n /**\n * This will make sure to fetch the objects prior to load them\n * do not use it if you are not sure you need it.\n * It will influence the performance\n * currently it used only for get many of aspects\n * @param ids\n */\n async importAndGetMany(ids: Array<ComponentID>): Promise<Component[]> {\n await this.importCurrentLaneIfMissing();\n await this.scope.import(ids, { reFetchUnBuiltVersion: shouldReFetchUnBuiltVersion() });\n return this.componentLoader.getMany(ids);\n }\n\n async importCurrentLaneIfMissing() {\n const laneId = this.getCurrentLaneId();\n const laneObj = await this.scope.legacyScope.getCurrentLaneObject();\n if (laneId.isDefault() || laneObj) {\n return;\n }\n const lane = await this.getCurrentRemoteLane();\n if (!lane) {\n return;\n }\n this.logger.info(`current lane ${laneId.toString()} is missing, importing it`);\n await this.scope.legacyScope.objects.writeObjectsToTheFS([lane]);\n const scopeComponentsImporter = ScopeComponentsImporter.getInstance(this.scope.legacyScope);\n const ids = BitIds.fromArray(lane.toBitIds().filter((id) => id.hasScope()));\n await scopeComponentsImporter.importManyDeltaWithoutDeps({ ids, fromHead: true, lane });\n await scopeComponentsImporter.importMany({ ids, lanes: [lane] });\n }\n\n /**\n * @deprecated use this.track() instead\n * track a new component. (practically, add it to .bitmap).\n *\n * @param componentPaths component paths relative to the workspace dir\n * @param id if not set, will be concluded from the filenames\n * @param main if not set, will try to guess according to some strategies and throws if failed\n * @param override whether add details to an existing component or re-define it\n */\n async add(\n componentPaths: PathOsBasedRelative[],\n id?: string,\n main?: string,\n override = false\n ): Promise<AddActionResults> {\n const addComponent = new AddComponents({ consumer: this.consumer }, { componentPaths, id, main, override });\n const addResults = await addComponent.add();\n // @todo: the legacy commands have `consumer.onDestroy()` on command completion, it writes the\n // .bitmap file. workspace needs a similar mechanism. once done, remove the next line.\n await this.bitMap.write();\n return addResults;\n }\n\n async use(aspectIdStr: string): Promise<string> {\n const aspectId = await this.resolveComponentId(aspectIdStr);\n let aspectIdToAdd = aspectId.toStringWithoutVersion();\n if (!(await this.hasId(aspectId))) {\n const loadedIds = await this.scope.loadAspects([aspectIdStr], true, 'bit use command');\n if (loadedIds[0]) aspectIdToAdd = loadedIds[0];\n }\n const config = this.harmony.get<ConfigMain>('teambit.harmony/config').workspaceConfig;\n if (!config) {\n throw new Error(`use() unable to get the workspace config`);\n }\n config.setExtension(\n aspectIdToAdd,\n {},\n {\n overrideExisting: false,\n ignoreVersion: false,\n }\n );\n await config.write();\n return aspectIdToAdd;\n }\n\n /**\n * add a new component to the .bitmap file.\n * this method only adds the records in memory but doesn't persist to the filesystem.\n * to write the .bitmap file once completed, run \"await this.bitMap.write();\"\n */\n async track(trackData: TrackData): Promise<TrackResult> {\n const defaultScope = trackData.defaultScope ? await this.addOwnerToScopeName(trackData.defaultScope) : undefined;\n const addComponent = new AddComponents(\n { consumer: this.consumer },\n {\n componentPaths: [trackData.rootDir],\n id: trackData.componentName,\n main: trackData.mainFile,\n override: false,\n defaultScope,\n config: trackData.config,\n }\n );\n const result = await addComponent.add();\n const addedComponent = result.addedComponents[0];\n const componentName = addedComponent?.id.name || (trackData.componentName as string);\n const files = addedComponent?.files.map((f) => f.relativePath) || [];\n return { componentName, files, warnings: result.warnings };\n }\n\n /**\n * scopes in bit.dev are \"owner.collection\".\n * we might have the scope-name only without the owner and we need to retrieve it from the defaultScope in the\n * workspace.jsonc file.\n *\n * @param scopeName scopeName that might not have the owner part.\n * @returns full scope name\n */\n private async addOwnerToScopeName(scopeName: string): Promise<string> {\n if (scopeName.includes('.')) return scopeName; // it has owner.\n const isSelfHosted = !(await this.isHostedByBit(scopeName));\n if (isSelfHosted) return scopeName;\n const wsDefaultScope = this.defaultScope;\n if (!wsDefaultScope.includes('.')) {\n throw new Error(`the entered scope has no owner nor the defaultScope in workspace.jsonc`);\n }\n const [owner] = wsDefaultScope.split('.');\n return `${owner}.${scopeName}`;\n }\n\n async write(component: Component, rootPath?: string) {\n await Promise.all(\n component.filesystem.files.map(async (file) => {\n const pathToWrite = rootPath ? path.join(this.path, rootPath, file.relative) : file.path;\n await fs.outputFile(pathToWrite, file.contents);\n })\n );\n }\n\n /**\n * Get the component root dir in the file system (relative to workspace or full) in Linux format\n * @param componentId\n * @param relative return the path relative to the workspace or full path\n */\n componentDir(\n componentId: ComponentID,\n bitMapOptions?: GetBitMapComponentOptions,\n options = { relative: false }\n ): PathOsBased {\n return this.componentDirFromLegacyId(componentId._legacy, bitMapOptions, options);\n }\n\n /**\n * component's files in the workspace are symlinked to the node_modules, and a package.json file is generated on that\n * package directory to simulate a valid node package.\n * @returns the package directory inside the node_module.\n * by default the absolute path, unless `options.relative` was set\n */\n componentPackageDir(component: Component, options = { relative: false }): string {\n const packageName = componentIdToPackageName(component.state._consumer);\n const packageDir = path.join('node_modules', packageName);\n return options.relative ? packageDir : this.consumer.toAbsolutePath(packageDir);\n }\n\n private componentDirFromLegacyId(\n bitId: BitId,\n bitMapOptions?: GetBitMapComponentOptions,\n options = { relative: false }\n ): PathOsBased {\n const componentMap = this.consumer.bitMap.getComponent(bitId, bitMapOptions);\n const relativeComponentDir = componentMap.getComponentDir();\n if (!relativeComponentDir) {\n throw new NoComponentDir(bitId.toString());\n }\n if (options.relative) {\n return relativeComponentDir;\n }\n\n return path.join(this.path, relativeComponentDir);\n }\n\n componentDirToAbsolute(relativeComponentDir: PathOsBasedRelative): PathOsBasedAbsolute {\n return path.join(this.path, relativeComponentDir);\n }\n\n async componentDefaultScope(componentId: ComponentID): Promise<string | undefined> {\n const relativeComponentDir = this.componentDir(componentId, { ignoreVersion: true }, { relative: true });\n return this.componentDefaultScopeFromComponentDirAndName(relativeComponentDir, componentId.fullName);\n }\n\n async componentDefaultScopeFromComponentDirAndName(\n relativeComponentDir: PathOsBasedRelative,\n name: string\n ): Promise<string | undefined> {\n const componentConfigFile = await this.componentConfigFileFromComponentDirAndName(relativeComponentDir, name);\n if (componentConfigFile && componentConfigFile.defaultScope) {\n return componentConfigFile.defaultScope;\n }\n const bitMapId = this.consumer.bitMap.getExistingBitId(name);\n const bitMapEntry = bitMapId ? this.consumer.bitMap.getComponent(bitMapId) : undefined;\n if (bitMapEntry && bitMapEntry.defaultScope) {\n return bitMapEntry.defaultScope;\n }\n return this.componentDefaultScopeFromComponentDirAndNameWithoutConfigFile(relativeComponentDir, name);\n }\n\n get defaultScope() {\n return this.config.defaultScope;\n }\n\n private async componentDefaultScopeFromComponentDirAndNameWithoutConfigFile(\n relativeComponentDir: PathOsBasedRelative,\n name: string\n ): Promise<string | undefined> {\n const variantConfig = this.variants.byRootDirAndName(relativeComponentDir, name);\n if (variantConfig && variantConfig.defaultScope) {\n return variantConfig.defaultScope;\n }\n const isVendor = this.isVendorComponentByComponentDir(relativeComponentDir);\n if (!isVendor) {\n return this.config.defaultScope;\n }\n return undefined;\n }\n\n /**\n * Calculate the component config based on:\n * the config property in the .bitmap file\n * the component.json file in the component folder\n * matching pattern in the variants config\n * defaults extensions from workspace config\n * extensions from the model.\n */\n // eslint-disable-next-line complexity\n async componentExtensions(\n componentId: ComponentID,\n componentFromScope?: Component,\n excludeOrigins: ExtensionsOrigin[] = []\n ): Promise<{\n extensions: ExtensionDataList;\n beforeMerge: Array<{ extensions: ExtensionDataList; origin: ExtensionsOrigin; extraData: any }>; // useful for debugging\n }> {\n // TODO: consider caching this result\n let configFileExtensions: ExtensionDataList | undefined;\n let variantsExtensions: ExtensionDataList | undefined;\n let wsDefaultExtensions: ExtensionDataList | undefined;\n const mergeFromScope = true;\n\n const bitMapEntry = this.consumer.bitMap.getComponentIfExist(componentId._legacy);\n const bitMapExtensions = bitMapEntry?.config;\n\n const unmergedHead = this.getUnmergedHead(componentId);\n let unmergedExtensions: ExtensionDataList | undefined;\n let unmergedExtensionsSpecific: ExtensionDataList | undefined;\n let unmergedExtensionsNonSpecific: ExtensionDataList | undefined;\n if (unmergedHead) {\n const versionInstance = await this.scope.legacyScope.getVersionInstance(\n componentId._legacy.changeVersion(unmergedHead.toString())\n );\n unmergedExtensions = versionInstance.extensions;\n const [specific, nonSpecific] = partition(\n unmergedExtensions,\n (entry) => entry.config[AspectSpecificField] === true\n );\n unmergedExtensionsSpecific = new ExtensionDataList(...specific);\n unmergedExtensionsNonSpecific = new ExtensionDataList(...nonSpecific);\n }\n\n const scopeExtensions = componentFromScope?.config?.extensions || new ExtensionDataList();\n const [specific, nonSpecific] = partition(scopeExtensions, (entry) => entry.config[AspectSpecificField] === true);\n const scopeExtensionsNonSpecific = new ExtensionDataList(...nonSpecific);\n const scopeExtensionsSpecific = new ExtensionDataList(...specific);\n\n const componentConfigFile = await this.componentConfigFile(componentId);\n if (componentConfigFile) {\n configFileExtensions = componentConfigFile.aspects.toLegacy();\n }\n const relativeComponentDir = this.componentDir(componentId, { ignoreVersion: true }, { relative: true });\n const variantConfig = this.variants.byRootDirAndName(relativeComponentDir, componentId.fullName);\n if (variantConfig) {\n variantsExtensions = variantConfig.extensions.clone();\n // Do not merge from scope when there is specific variant (which is not *) that match the component\n // if (variantConfig.maxSpecificity > 0) {\n // mergeFromScope = false;\n // }\n }\n const isVendor = this.isVendorComponentByComponentDir(relativeComponentDir);\n if (!isVendor) {\n wsDefaultExtensions = this.getDefaultExtensions();\n }\n // We don't stop on each step because we want to merge the default scope even if propagate=false but the default scope is not defined\n // in the case the same extension pushed twice, the former takes precedence (opposite of Object.assign)\n const extensionsToMerge: Array<{ origin: ExtensionsOrigin; extensions: ExtensionDataList; extraData: any }> = [];\n let envWasFoundPreviously = false;\n const removedExtensionIds: string[] = [];\n\n const addExtensionsToMerge = async (extensions: ExtensionDataList, origin: ExtensionsOrigin, extraData?: any) => {\n if (!extensions.length) {\n return;\n }\n removedExtensionIds.push(...extensions.filter((extData) => extData.isRemoved).map((extData) => extData.stringId));\n const extsWithoutRemoved = extensions.filterRemovedExtensions();\n const selfInMergedExtensions = extsWithoutRemoved.findExtension(\n componentId._legacy.toStringWithoutScopeAndVersion(),\n true,\n true\n );\n const extsWithoutSelf = selfInMergedExtensions?.extensionId\n ? extsWithoutRemoved.remove(selfInMergedExtensions.extensionId)\n : extsWithoutRemoved;\n const { extensionDataListFiltered, envIsCurrentlySet } = this.filterEnvsFromExtensionsIfNeeded(\n extsWithoutSelf,\n envWasFoundPreviously\n );\n if (envIsCurrentlySet) {\n await this.warnAboutMisconfiguredEnv(componentId, extensions);\n envWasFoundPreviously = true;\n }\n\n extensionsToMerge.push({ origin, extensions: extensionDataListFiltered, extraData });\n };\n const setDataListAsSpecific = (extensions: ExtensionDataList) => {\n extensions.forEach((dataEntry) => (dataEntry.config[AspectSpecificField] = true));\n };\n if (bitMapExtensions && !excludeOrigins.includes('BitmapFile')) {\n const extensionDataList = ExtensionDataList.fromConfigObject(bitMapExtensions);\n setDataListAsSpecific(extensionDataList);\n await addExtensionsToMerge(extensionDataList, 'BitmapFile');\n }\n if (configFileExtensions && !excludeOrigins.includes('ComponentJsonFile')) {\n setDataListAsSpecific(configFileExtensions);\n await addExtensionsToMerge(configFileExtensions, 'ComponentJsonFile');\n }\n if (unmergedExtensionsSpecific && !excludeOrigins.includes('UnmergedSpecific')) {\n await addExtensionsToMerge(ExtensionDataList.fromArray(unmergedExtensionsSpecific), 'UnmergedSpecific');\n }\n if (!excludeOrigins.includes('ModelSpecific')) {\n await addExtensionsToMerge(ExtensionDataList.fromArray(scopeExtensionsSpecific), 'ModelSpecific');\n }\n let continuePropagating = componentConfigFile?.propagate ?? true;\n if (variantsExtensions && continuePropagating && !excludeOrigins.includes('WorkspaceVariants')) {\n const appliedRules = variantConfig?.sortedMatches.map(({ pattern, specificity }) => ({ pattern, specificity }));\n await addExtensionsToMerge(variantsExtensions, 'WorkspaceVariants', { appliedRules });\n }\n continuePropagating = continuePropagating && (variantConfig?.propagate ?? true);\n // Do not apply default extensions on the default extensions (it will create infinite loop when loading them)\n const isDefaultExtension = wsDefaultExtensions?.findExtension(componentId.toString(), true, true);\n if (\n wsDefaultExtensions &&\n continuePropagating &&\n !isDefaultExtension &&\n !excludeOrigins.includes('WorkspaceDefault')\n ) {\n await addExtensionsToMerge(wsDefaultExtensions, 'WorkspaceDefault');\n }\n if (\n unmergedExtensionsNonSpecific &&\n mergeFromScope &&\n continuePropagating &&\n !excludeOrigins.includes('UnmergedNonSpecific')\n ) {\n await addExtensionsToMerge(unmergedExtensionsNonSpecific, 'UnmergedNonSpecific');\n }\n if (mergeFromScope && continuePropagating && !excludeOrigins.includes('ModelNonSpecific')) {\n await addExtensionsToMerge(scopeExtensionsNonSpecific, 'ModelNonSpecific');\n }\n\n // It's important to do this resolution before the merge, otherwise we have issues with extensions\n // coming from scope with local scope name, as opposed to the same extension comes from the workspace with default scope name\n await Promise.all(extensionsToMerge.map((list) => this.resolveExtensionListIds(list.extensions)));\n const afterMerge = ExtensionDataList.mergeConfigs(extensionsToMerge.map((ext) => ext.extensions));\n await this.loadExtensions(afterMerge);\n const withoutRemoved = afterMerge.filter((extData) => !removedExtensionIds.includes(extData.stringId));\n const extensions = ExtensionDataList.fromArray(withoutRemoved);\n return {\n extensions,\n beforeMerge: extensionsToMerge,\n };\n }\n\n private getUnmergedHead(componentId: ComponentID) {\n const unmerged = this.scope.legacyScope.objects.unmergedComponents.getEntry(componentId._legacy.name);\n return unmerged?.head;\n }\n\n async getUnmergedComponent(componentId: ComponentID): Promise<Component | undefined> {\n const unmerged = this.scope.legacyScope.objects.unmergedComponents.getEntry(componentId._legacy.name);\n if (unmerged?.head) {\n return this.scope.get(componentId.changeVersion(unmerged?.head.toString()));\n }\n return undefined;\n }\n\n private async warnAboutMisconfiguredEnv(componentId: ComponentID, extensionDataList: ExtensionDataList) {\n if (!(await this.hasId(componentId))) {\n // if this is a dependency and not belong to the workspace, don't show the warning\n return;\n }\n const envAspect = extensionDataList.findExtension(EnvsAspect.id);\n const envFromEnvsAspect = envAspect?.config.env;\n if (!envFromEnvsAspect) return;\n if (this.envs.getCoreEnvsIds().includes(envFromEnvsAspect)) return;\n if (this.warnedAboutMisconfiguredEnvs.includes(envFromEnvsAspect)) return;\n let env: Component;\n try {\n const envId = await this.resolveComponentId(envFromEnvsAspect);\n env = await this.get(envId);\n } catch (err) {\n return; // unable to get the component for some reason. don't sweat it. forget about the warning\n }\n if (!this.envs.isUsingEnvEnv(env)) {\n this.warnedAboutMisconfiguredEnvs.push(envFromEnvsAspect);\n this.logger.consoleWarning(\n `env \"${envFromEnvsAspect}\" is not of type env. (correct the env's type, or component config with \"bit env set ${envFromEnvsAspect} teambit.envs/env\")`\n );\n }\n }\n\n async isModified(component: Component): Promise<boolean> {\n const head = component.head;\n if (!head) {\n return true; // it's a new component\n }\n const consumerComp = component.state._consumer as ConsumerComponent;\n if (typeof consumerComp._isModified === 'boolean') return consumerComp._isModified;\n const componentStatus = await this.consumer.getComponentStatusById(component.id._legacy);\n return componentStatus.modified === true;\n }\n\n private filterEnvsFromExtensionsIfNeeded(extensionDataList: ExtensionDataList, envWasFoundPreviously: boolean) {\n const envAspect = extensionDataList.findExtension(EnvsAspect.id);\n const envFromEnvsAspect: string | undefined = envAspect?.config.env;\n if (envWasFoundPreviously && envAspect) {\n const nonEnvs = extensionDataList.filter((e) => e.stringId !== envFromEnvsAspect);\n // still, aspect env may have other data other then config.env.\n delete envAspect.config.env;\n return { extensionDataListFiltered: new ExtensionDataList(...nonEnvs), envIsCurrentlySet: true };\n }\n return { extensionDataListFiltered: extensionDataList, envIsCurrentlySet: Boolean(envFromEnvsAspect) };\n }\n\n async triggerOnPreWatch(componentIds: ComponentID[], watchOpts: WatchOptions) {\n const components = await this.getMany(componentIds);\n const preWatchFunctions = this.onPreWatchSlot.values();\n await mapSeries(preWatchFunctions, async (func) => {\n await func(components, watchOpts);\n });\n }\n\n /**\n * filter the given component-ids and set default-scope only to the new ones.\n * returns the affected components.\n */\n async setDefaultScopeToComponents(componentIds: ComponentID[], scopeName: string): Promise<ComponentID[]> {\n if (!isValidScopeName(scopeName)) {\n throw new InvalidScopeName(scopeName);\n }\n const newComponentIds = componentIds.filter((id) => !id.hasVersion());\n if (!newComponentIds.length) {\n const compIdsStr = componentIds.map((compId) => compId.toString()).join(', ');\n throw new BitError(\n `unable to set default-scope for the following components, as they are not new:\\n${compIdsStr}`\n );\n }\n newComponentIds.map((comp) => this.bitMap.setDefaultScope(comp, scopeName));\n await this.bitMap.write();\n return newComponentIds;\n }\n\n async setDefaultScope(scopeName: string) {\n if (this.defaultScope === scopeName) {\n throw new Error(`the default-scope is already set as \"${scopeName}\", nothing to change`);\n }\n const config = this.harmony.get<ConfigMain>('teambit.harmony/config');\n config.workspaceConfig?.setExtension(\n WorkspaceAspect.id,\n { defaultScope: scopeName },\n { mergeIntoExisting: true, ignoreVersion: true }\n );\n await config.workspaceConfig?.write({ dir: path.dirname(config.workspaceConfig.path) });\n }\n\n async addSpecificComponentConfig(\n id: ComponentID,\n aspectId: string,\n config: Record<string, any> = {},\n shouldMergeWithExisting = false,\n /**\n * relevant only when writing to .bitmap.\n * eject config of the given aspect-id, so then it won't override previous config. (see \"adding prod dep, tagging then adding devDep\" e2e-test)\n */\n shouldMergeWithPrevious = false\n ) {\n const componentConfigFile = await this.componentConfigFile(id);\n if (componentConfigFile) {\n await componentConfigFile.addAspect(\n aspectId,\n config,\n this.resolveComponentId.bind(this),\n shouldMergeWithExisting\n );\n await componentConfigFile.write({ override: true });\n } else {\n if (shouldMergeWithPrevious) {\n const extensions = await this.getSpecificExtensionsFromScope(id);\n const obj = extensions.toConfigObject();\n config = obj[aspectId] ? merge(obj[aspectId], config) : config;\n }\n this.bitMap.addComponentConfig(id, aspectId, config, shouldMergeWithExisting);\n }\n }\n\n async removeSpecificComponentConfig(id: ComponentID, aspectId: string, markWithMinusIfNotExist: boolean) {\n const componentConfigFile = await this.componentConfigFile(id);\n if (componentConfigFile) {\n await componentConfigFile.removeAspect(aspectId, markWithMinusIfNotExist, this.resolveComponentId.bind(this));\n await componentConfigFile.write({ override: true });\n } else {\n this.bitMap.removeComponentConfig(id, aspectId, markWithMinusIfNotExist);\n }\n }\n\n async getAspectIdFromConfig(\n componentId: ComponentID,\n aspectIdStr: string,\n ignoreAspectVersion = false\n ): Promise<string | undefined> {\n const aspectId = await this.resolveComponentId(aspectIdStr);\n const componentConfigFile = await this.componentConfigFile(componentId);\n if (componentConfigFile) {\n const aspectEntry = componentConfigFile.aspects.find(aspectId, ignoreAspectVersion);\n return aspectEntry?.id.toString();\n }\n return this.bitMap.getAspectIdFromConfig(componentId, aspectId, ignoreAspectVersion);\n }\n\n async getSpecificComponentConfig(id: ComponentID, aspectId: string): Promise<any> {\n const componentConfigFile = await this.componentConfigFile(id);\n if (componentConfigFile) {\n return componentConfigFile.aspects.get(aspectId)?.config;\n }\n return this.bitMap.getBitmapEntry(id, { ignoreVersion: true }).config?.[aspectId];\n }\n\n /**\n * This will mutate the entries with extensionId prop to have resolved legacy id\n * This should be worked on the extension data list not the new aspect list\n * @param extensionList\n */\n private async resolveExtensionListIds(extensionList: ExtensionDataList): Promise<ExtensionDataList> {\n const promises = extensionList.map(async (entry) => {\n if (entry.extensionId) {\n const id = await this.resolveComponentId(entry.extensionId);\n entry.extensionId = id._legacy;\n }\n\n return entry;\n });\n await Promise.all(promises);\n return extensionList;\n }\n\n private isVendorComponentByComponentDir(relativeComponentDir: PathOsBasedRelative): boolean {\n const vendorDir = this.config.vendor?.directory || DEFAULT_VENDOR_DIR;\n if (pathIsInside(relativeComponentDir, vendorDir)) {\n return true;\n }\n // TODO: implement\n return false;\n }\n\n /**\n * return the component config from its folder (component.json)\n * @param componentId\n */\n public async componentConfigFile(id: ComponentID): Promise<ComponentConfigFile | undefined> {\n const relativeComponentDir = this.componentDir(id, { ignoreVersion: true }, { relative: true });\n return this.componentConfigFileFromComponentDirAndName(relativeComponentDir, id.fullName);\n }\n\n /**\n * @param componentPath can be relative or absolute. supports Linux and Windows\n */\n async getComponentIdByPath(componentPath: PathOsBased): Promise<ComponentID | undefined> {\n const relativePath = path.isAbsolute(componentPath) ? path.relative(this.path, componentPath) : componentPath;\n const linuxPath = pathNormalizeToLinux(relativePath);\n const bitId = this.consumer.bitMap.getComponentIdByPath(linuxPath);\n if (bitId) {\n return this.resolveComponentId(bitId);\n }\n return undefined;\n }\n\n private async componentConfigFileFromComponentDirAndName(\n relativeComponentDir: PathOsBasedRelative,\n name: string\n ): Promise<ComponentConfigFile | undefined> {\n let componentConfigFile;\n if (relativeComponentDir) {\n const absComponentDir = this.componentDirToAbsolute(relativeComponentDir);\n const defaultScopeFromVariantsOrWs = await this.componentDefaultScopeFromComponentDirAndNameWithoutConfigFile(\n relativeComponentDir,\n name\n );\n componentConfigFile = await ComponentConfigFile.load(\n absComponentDir,\n this.createAspectList.bind(this),\n defaultScopeFromVariantsOrWs\n );\n }\n\n return componentConfigFile;\n }\n\n async getAspectsGraphWithoutCore(components: Component[], isAspect?: ShouldLoadFunc) {\n const ids = components.map((component) => component.id);\n const coreAspectsStringIds = this.aspectLoader.getCoreAspectIds();\n // const coreAspectsComponentIds = coreAspectsStringIds.map((id) => BitId.parse(id, true));\n // const aspectsIds = components.reduce((acc, curr) => {\n // const currIds = curr.state.aspects.ids;\n // acc = acc.concat(currIds);\n // return acc;\n // }, [] as any);\n // const otherDependenciesMap = components.reduce((acc, curr) => {\n // // const currIds = curr.state.dependencies.dependencies.map(dep => dep.id.toString());\n // const currMap = curr.state.dependencies.getIdsMap();\n // Object.assign(acc, currMap);\n // return acc;\n // }, {});\n\n // const depsWhichAreNotAspects = difference(Object.keys(otherDependenciesMap), aspectsIds);\n // const depsWhichAreNotAspectsBitIds = depsWhichAreNotAspects.map((strId) => otherDependenciesMap[strId]);\n // We only want to load into the graph components which are aspects and not regular dependencies\n // This come to solve a circular loop when an env aspect use an aspect (as regular dep) and the aspect use the env aspect as its env\n // TODO: @gilad it causes many issues we need to find a better solution. removed for now.\n return this.buildOneGraphForComponents(ids, coreAspectsStringIds, isAspect);\n }\n\n /**\n * load aspects from the workspace and if not exists in the workspace, load from the scope.\n * keep in mind that the graph may have circles.\n */\n async loadAspects(ids: string[] = [], throwOnError = false, neededFor?: string): Promise<string[]> {\n // generate a random callId to be able to identify the call from the logs\n const callId = Math.floor(Math.random() * 1000);\n const loggerPrefix = `[${callId}] loadAspects,`;\n this.logger.info(`${loggerPrefix} loading ${ids.length} aspects.\nids: ${ids.join(', ')}\nneeded-for: ${neededFor || '<unknown>'}`);\n const notLoadedIds = ids.filter((id) => !this.aspectLoader.isAspectLoaded(id));\n if (!notLoadedIds.length) return [];\n const coreAspectsStringIds = this.aspectLoader.getCoreAspectIds();\n const idsWithoutCore: string[] = difference(notLoadedIds, coreAspectsStringIds);\n const componentIds = await this.resolveMultipleComponentIds(idsWithoutCore);\n const components = await this.importAndGetAspects(componentIds);\n\n const isAspect = async (id: ComponentID) => {\n const component = await this.get(id);\n const isUsingAspectEnv = this.envs.isUsingAspectEnv(component);\n const isUsingEnvEnv = this.envs.isUsingEnvEnv(component);\n const isValidAspect = isUsingAspectEnv || isUsingEnvEnv;\n // if (!isValidAspect && idsWithoutCore.includes(component.id.toString())) {\n // const data = this.envs.getEnvData(component);\n // const err = new IncorrectEnvAspect(component.id.toString(), data.type, data.id);\n // if (data.id === DEFAULT_ENV) {\n // // when cloning a project, or when the node-modules dir is deleted, nothing works and all\n // // components are default to the DEFAULT_ENV, which is node-env. we must allow \"bit\n // // install\" to prepare the workspace and let the proper the envs to be loaded\n // this.logger.error(err.message);\n // } else {\n // throw err;\n // }\n // }\n return isValidAspect;\n };\n\n const graph = await this.getAspectsGraphWithoutCore(components, isAspect);\n const aspects = graph.nodes.map((node) => node.attr);\n this.logger.debug(`${loggerPrefix} found ${aspects.length} aspects in the aspects-graph`);\n const { workspaceComps, scopeComps } = await this.groupComponentsByWorkspaceAndScope(aspects);\n this.logger.debug(\n `${loggerPrefix} found ${workspaceComps.length} components in the workspace:\\n${workspaceComps\n .map((c) => c.id.toString())\n .join('\\n')}`\n );\n this.logger.debug(\n `${loggerPrefix} ${\n scopeComps.length\n } components are not in the workspace and are loaded from the scope:\\n${scopeComps\n .map((c) => c.id.toString())\n .join('\\n')}`\n );\n const scopeIds = scopeComps.map((aspect) => aspect.id.toString());\n const workspaceAspects = await this.requireComponents(workspaceComps);\n const workspaceManifests = await this.aspectLoader.getManifestsFromRequireableExtensions(\n workspaceAspects,\n throwOnError\n );\n const potentialPluginsIndexes = compact(\n workspaceManifests.map((manifest, index) => {\n if (this.aspectLoader.isValidAspect(manifest)) return undefined;\n return index;\n })\n );\n const workspaceManifestsIds = compact(workspaceManifests.map((m) => m.id));\n // We are grouping the scope aspects by whether they are envs of something of the list or not\n // if yes, we want to load them first\n // the rest we will load together with the workspace aspects\n const scopeIdsGrouped = await this.scope.groupAspectIdsByEnvOfTheList(scopeIds);\n const scopeEnvsManifestsIds =\n scopeIdsGrouped.envs && scopeIdsGrouped.envs.length\n ? await this.scope.loadAspects(\n scopeIdsGrouped.envs,\n throwOnError,\n 'workspace.loadAspects loading scope aspects'\n )\n : [];\n const currentLane = await this.consumer.getCurrentLaneObject();\n const { manifests: scopeOtherManifests } =\n scopeIdsGrouped.other && scopeIdsGrouped.other.length\n ? await this.scope.getManifestsGraphRecursively(\n scopeIdsGrouped.other,\n compact(workspaceManifestsIds),\n throwOnError,\n currentLane || undefined,\n {\n packageManagerConfigRootDir: this.path,\n }\n )\n : { manifests: [] };\n const scopeOtherManifestsIds = compact(scopeOtherManifests.map((m) => m.id));\n\n await this.aspectLoader.loadExtensionsByManifests(\n [...scopeOtherManifests, ...workspaceManifests],\n throwOnError,\n idsWithoutCore\n );\n // Try require components for potential plugins\n const pluginsWorkspaceComps = potentialPluginsIndexes.map((index) => {\n return workspaceComps[index];\n });\n // Do the require again now that the plugins defs already registered\n const pluginsWorkspaceAspects = await this.requireComponents(pluginsWorkspaceComps);\n const pluginsWorkspaceManifests = await this.aspectLoader.getManifestsFromRequireableExtensions(\n pluginsWorkspaceAspects,\n throwOnError\n );\n await this.aspectLoader.loadExtensionsByManifests(pluginsWorkspaceManifests, throwOnError);\n this.logger.debug(`${loggerPrefix} finish loading aspects`);\n return compact(scopeEnvsManifestsIds.concat(scopeOtherManifestsIds).concat(workspaceManifestsIds));\n }\n\n /**\n * returns one graph that includes all dependencies types. each edge has a label of the dependency\n * type. the nodes content is the Component object.\n */\n async buildOneGraphForComponents(\n ids: ComponentID[],\n ignoreIds?: string[],\n shouldLoadFunc?: ShouldLoadFunc,\n shouldThrowOnMissingDep = true\n ): Promise<Graph<Component, string>> {\n const graphFromFsBuilder = new GraphFromFsBuilder(\n this,\n this.logger,\n this.dependencyResolver,\n ignoreIds,\n shouldLoadFunc,\n shouldThrowOnMissingDep\n );\n return graphFromFsBuilder.buildGraph(ids);\n }\n\n async resolveAspects(\n runtimeName?: string,\n componentIds?: ComponentID[],\n opts?: ResolveAspectsOptions\n ): Promise<AspectDefinition[]> {\n this.logger.debug(`workspace resolveAspects, runtimeName: ${runtimeName}, componentIds: ${componentIds}`);\n const defaultOpts: ResolveAspectsOptions = {\n excludeCore: false,\n requestedOnly: false,\n };\n const mergedOpts = { ...defaultOpts, ...opts };\n let missingPaths = false;\n const stringIds: string[] = [];\n const idsToResolve = componentIds ? componentIds.map((id) => id.toString()) : this.harmony.extensionsIds;\n const coreAspectsIds = this.aspectLoader.getCoreAspectIds();\n const userAspectsIds: string[] = difference(idsToResolve, coreAspectsIds);\n const componentIdsToResolve = await this.resolveMultipleComponentIds(userAspectsIds);\n const { workspaceIds, scopeIds } = await this.groupIdsByWorkspaceAndScope(componentIdsToResolve);\n const wsComponents = await this.getMany(workspaceIds);\n const aspectDefs = await this.aspectLoader.resolveAspects(wsComponents, async (component) => {\n const compStringId = component.id._legacy.toString();\n stringIds.push(compStringId);\n const localPath = this.getComponentPackagePath(component);\n const isExist = await fs.pathExists(localPath);\n if (!isExist) {\n missingPaths = true;\n }\n const runtimePath = runtimeName\n ? await this.aspectLoader.getRuntimePath(component, localPath, runtimeName)\n : null;\n\n const aspectFilePath = await this.aspectLoader.getAspectFilePath(component, localPath);\n\n this.logger.debug(\n `workspace resolveAspects, resolving id: ${compStringId}, localPath: ${localPath}, runtimePath: ${runtimePath}`\n );\n return {\n aspectPath: localPath,\n aspectFilePath,\n runtimePath,\n };\n });\n\n let scopeAspectDefs: AspectDefinition[] = [];\n if (scopeIds.length) {\n scopeAspectDefs = await this.scope.resolveAspects(runtimeName, scopeIds, mergedOpts);\n }\n\n let coreAspectDefs = await Promise.all(\n coreAspectsIds.map(async (coreId) => {\n const rawDef = await getAspectDef(coreId, runtimeName);\n return this.aspectLoader.loadDefinition(rawDef);\n })\n );\n\n // due to lack of workspace and scope runtimes. TODO: fix after adding them.\n if (runtimeName) {\n coreAspectDefs = coreAspectDefs.filter((coreAspect) => {\n return coreAspect.runtimePath;\n });\n }\n\n if (missingPaths) {\n await link(stringIds, false);\n }\n\n const allDefs = aspectDefs.concat(coreAspectDefs).concat(scopeAspectDefs);\n const ids = idsToResolve.map((idStr) => ComponentID.fromString(idStr).toStringWithoutVersion());\n const afterExclusion = mergedOpts.excludeCore\n ? allDefs.filter((def) => {\n const isCore = coreAspectDefs.find((coreId) => def.getId === coreId.getId);\n const id = ComponentID.fromString(def.getId || '');\n const isTarget = ids.includes(id.toStringWithoutVersion());\n if (isTarget) return true;\n return !isCore;\n })\n : allDefs;\n\n const uniqDefs = uniqBy(afterExclusion, (def) => `${def.aspectPath}-${def.runtimePath}`);\n let defs = uniqDefs;\n if (runtimeName) {\n defs = defs.filter((def) => def.runtimePath);\n }\n\n if (componentIds && componentIds.length && mergedOpts.requestedOnly) {\n const componentIdsString = componentIds.map((id) => id.toString());\n defs = defs.filter((def) => {\n return (\n (def.id && componentIdsString.includes(def.id)) ||\n (def.component && componentIdsString.includes(def.component?.id.toString()))\n );\n });\n }\n\n return defs;\n }\n\n private async groupIdsByWorkspaceAndScope(\n ids: ComponentID[]\n ): Promise<{ workspaceIds: ComponentID[]; scopeIds: ComponentID[] }> {\n const workspaceIds: ComponentID[] = [];\n const scopeIds: ComponentID[] = [];\n await Promise.all(\n ids.map(async (id) => {\n const existOnWorkspace = await this.hasId(id);\n existOnWorkspace ? workspaceIds.push(id) : scopeIds.push(id);\n })\n );\n return { workspaceIds, scopeIds };\n }\n\n private async groupComponentsByWorkspaceAndScope(\n components: Component[]\n ): Promise<{ workspaceComps: Component[]; scopeComps: Component[] }> {\n const workspaceComps: Component[] = [];\n const scopeComps: Component[] = [];\n await Promise.all(\n components.map(async (component) => {\n const existOnWorkspace = await this.hasId(component.id);\n existOnWorkspace ? workspaceComps.push(component) : scopeComps.push(component);\n })\n );\n return { workspaceComps, scopeComps };\n }\n\n /**\n * Load all unloaded extensions from a list\n * @param extensions list of extensions with config to load\n */\n async loadExtensions(\n extensions: ExtensionDataList,\n originatedFrom?: ComponentID,\n throwOnError = false\n ): Promise<void> {\n const extensionsIdsP = extensions.map(async (extensionEntry) => {\n // Core extension\n if (!extensionEntry.extensionId) {\n return extensionEntry.stringId as string;\n }\n\n const id = await this.resolveComponentId(extensionEntry.extensionId);\n // return this.resolveComponentId(extensionEntry.extensionId);\n return id.toString();\n });\n const extensionsIds: string[] = await Promise.all(extensionsIdsP);\n const loadedExtensions = this.harmony.extensionsIds;\n const extensionsToLoad = difference(extensionsIds, loadedExtensions);\n if (!extensionsToLoad.length) return;\n await this.loadAspects(extensionsToLoad, throwOnError, originatedFrom?.toString());\n }\n\n /**\n * Provides a cache folder, unique per key.\n * Return value may be undefined, if workspace folder is unconventional (bare-scope, no node_modules, etc)\n */\n getTempDir(\n /*\n * unique key, i.e. aspect or component id\n */\n id: string\n ) {\n const PREFIX = 'bit';\n const cacheDir = path.join(this.modulesPath, '.cache', PREFIX, id);\n\n // maybe should also check it's a folder and has write permissions\n if (!fs.existsSync(cacheDir)) {\n fs.mkdirSync(cacheDir, { recursive: true });\n }\n\n return cacheDir;\n }\n\n async requireComponents(components: Component[]): Promise<RequireableComponent[]> {\n let missingPaths = false;\n const stringIds: string[] = [];\n const resolveP = components.map(async (component) => {\n stringIds.push(component.id._legacy.toString());\n const localPath = this.getComponentPackagePath(component);\n const isExist = await fs.pathExists(localPath);\n if (!isExist) {\n missingPaths = true;\n }\n\n const requireFunc = async () => {\n const plugins = this.aspectLoader.getPlugins(component, localPath);\n if (plugins.has()) {\n return plugins.load(MainRuntime.name);\n }\n\n // eslint-disable-next-line global-require, import/no-dynamic-require\n const aspect = require(localPath);\n // require aspect runtimes\n const runtimePath = await this.aspectLoader.getRuntimePath(component, localPath, MainRuntime.name);\n // eslint-disable-next-line global-require, import/no-dynamic-require\n if (runtimePath) require(runtimePath);\n return aspect;\n };\n return new RequireableComponent(component, requireFunc);\n });\n const resolved = await Promise.all(resolveP);\n // Make sure to link missing components\n if (missingPaths) {\n await link(stringIds, false);\n }\n return resolved;\n }\n\n /**\n * whether a scope is hosted by Bit cloud.\n * otherwise, it is self-hosted\n */\n private async isHostedByBit(scopeName: string): Promise<boolean> {\n // TODO: once scope create a new API for this, replace it with the new one\n const remotes = await this.scope._legacyRemotes();\n return remotes.isHub(scopeName);\n }\n\n /**\n * same as `this.importAndGetMany()` with a specific error handling of ComponentNotFound\n */\n private async importAndGetAspects(componentIds: ComponentID[]): Promise<Component[]> {\n try {\n return await this.importAndGetMany(componentIds);\n } catch (err: any) {\n if (err instanceof ComponentNotFound) {\n const config = this.harmony.get<ConfigMain>('teambit.harmony/config');\n const configStr = JSON.stringify(config.workspaceConfig?.raw || {});\n if (configStr.includes(err.id)) {\n throw new BitError(`error: a component \"${err.id}\" was not found\nyour workspace.jsonc has this component-id set. you might want to remove/change it.`);\n }\n }\n\n throw err;\n }\n }\n\n /**\n * this should be rarely in-use.\n * it's currently used by watch extension as a quick workaround to load .bitmap and the components\n */\n async _reloadConsumer() {\n this.consumer = await loadConsumer(this.path, true);\n this.clearCache();\n }\n\n getComponentPackagePath(component: Component) {\n const relativePath = this.dependencyResolver.getRuntimeModulePath(component);\n return path.join(this.path, relativePath);\n }\n\n // TODO: should we return here the dir as it defined (aka components) or with /{name} prefix (as it used in legacy)\n get defaultDirectory(): string {\n return this.config.defaultDirectory;\n }\n\n get legacyDefaultDirectory(): string {\n if (this.defaultDirectory && !this.defaultDirectory.includes('{name}')) {\n return `${this.defaultDirectory}/{name}`;\n }\n return this.defaultDirectory;\n }\n\n /**\n * Transform the id to ComponentId and get the exact id as appear in bitmap\n *\n * @param {(string | ComponentID | BitId)} id\n * @returns {Promise<ComponentID>}\n * @memberof Workspace\n */\n async resolveComponentId(id: string | ComponentID | BitId): Promise<ComponentID> {\n const getDefaultScope = async (bitId: BitId, bitMapOptions?: GetBitMapComponentOptions) => {\n if (bitId.scope) {\n return bitId.scope;\n }\n const relativeComponentDir = this.componentDirFromLegacyId(bitId, bitMapOptions, { relative: true });\n const defaultScope = await this.componentDefaultScopeFromComponentDirAndName(\n relativeComponentDir,\n bitId.toStringWithoutScopeAndVersion()\n );\n return defaultScope;\n };\n\n // This is required in case where you have in your workspace a component with the same name as a core aspect\n // let's say you have component called react-native (which is eventually my-org.my-scope/react-native)\n // and you set teambit.react/react-native as your env\n // bit will get here with the string teambit.react/react-native and will try to resolve it from the workspace\n // during this it will find the my-org.my-scope/react-native which is incorrect as the core one doesn't exist in the\n // workspace\n if (this.aspectLoader.isCoreAspect(id.toString())) {\n return ComponentID.fromString(id.toString());\n }\n let legacyId = this.consumer.getParsedIdIfExist(id.toString(), true, true);\n if (legacyId) {\n const defaultScope = await getDefaultScope(legacyId);\n // only reason to strip the scopeName from the given id is when this id has the defaultScope, because .bitmap\n // doesn't have the defaultScope. if the given id doesn't have scope or has scope different than the default,\n // then don't ignore it. search with the scope-name.\n const shouldSearchWithoutScopeInProvidedId = id.toString().startsWith(`${defaultScope}/`);\n legacyId = this.consumer.getParsedIdIfExist(id.toString(), true, shouldSearchWithoutScopeInProvidedId);\n if (legacyId) {\n return ComponentID.fromLegacy(legacyId, defaultScope);\n }\n }\n try {\n const idWithVersion = id.toString();\n const [idWithoutVersion, version] = id.toString().split('@');\n const _bitMapId = this.consumer.getParsedIdIfExist(idWithoutVersion, false, true);\n // This logic is very specific, and very sensitive for changes please do not touch this without consulting with @ran or @gilad\n // example (partial list) cases which should be handled are:\n // use case 1 - ws component provided with the local scope name:\n // source id : my-scope1/my-name1\n // bitmap res (_id) : my-name1 (comp is tagged but not exported)\n // local scope name : my-scope1\n // scope content : my-name1\n // expected result : my-name1\n // use case 2 - component with same name exist in ws and scope (but with different scope name)\n // source id : my-scope2/my-name1\n // bitmap res (_id) : my-name1 (comp exist in ws but it's actually different component)\n // local scope name : my-scope1\n // scope content : my-scope2/my-name1\n // expected result : my-scope2/my-name1\n // use case 3 - component with same name exist in ws and scope (but with different scope name) - source provided without scope name\n // source id : my-name1\n // bitmap res (_id) : my-name1 (comp exist in ws but it's actually different component)\n // local scope name : my-scope1\n // scope content : my-scope1/my-name1 and my-scope2/my-name1\n // expected result : my-name1 (get the name from the bitmap)\n // use case 4 - component with the same name and different scope are imported into the ws\n // source id : my-name1\n // bitmap res (_id) : my-scope2/my-name1 (comp exist in ws from different scope (imported))\n // local scope name : my-scope1\n // scope content : my-scope2/my-name1\n // expected result : my-scope2/my-name1 (get the name from the bitmap)\n\n // No entry in bitmap at all, search for the original input id\n if (!_bitMapId) {\n return await this.scope.resolveComponentId(id.toString());\n }\n const _bitMapIdWithoutVersion = _bitMapId.toStringWithoutVersion();\n const _bitMapIdWithVersion = _bitMapId.changeVersion(version).toString();\n // The id in the bitmap has prefix which is not in the source id - the bitmap entry has scope name\n // Handle use case 4\n if (_bitMapIdWithoutVersion.endsWith(idWithoutVersion) && _bitMapIdWithoutVersion !== idWithoutVersion) {\n return await this.scope.resolveComponentId(_bitMapIdWithVersion);\n }\n // Handle case when I tagged the component locally with a default scope which is not the local scope\n // but not exported it yet\n // now i'm trying to load it with source id contain the default scope prefix\n // we want to get it from the local first before assuming it's something coming from outside\n if (!_bitMapId.scope) {\n const defaultScopeForBitmapId = await getDefaultScope(_bitMapId, { ignoreVersion: true });\n const getFromBitmapAddDefaultScope = () => {\n let _bitmapIdWithVersionForSource = _bitMapId;\n if (version) {\n _bitmapIdWithVersionForSource = _bitMapId.changeVersion(version);\n }\n return ComponentID.fromLegacy(_bitmapIdWithVersionForSource, defaultScopeForBitmapId);\n };\n // a case when the given id contains the default scope\n if (idWithVersion.startsWith(`${defaultScopeForBitmapId}/${_bitMapIdWithoutVersion}`)) {\n return getFromBitmapAddDefaultScope();\n }\n // a case when the given id does not contain the default scope\n const fromScope = await this.scope.resolveComponentId(idWithVersion);\n if (!fromScope._legacy.hasScope()) {\n return getFromBitmapAddDefaultScope();\n }\n }\n\n if (idWithoutVersion.endsWith(_bitMapIdWithoutVersion) && _bitMapIdWithoutVersion !== idWithoutVersion) {\n // The id in the bitmap doesn't have scope, the source id has scope\n // Handle use case 2 and use case 1\n if (id.toString().startsWith(this.scope.name)) {\n // Handle use case 1 - the provided id has scope name same as the local scope name\n // we want to send it as it appear in the bitmap\n return await this.scope.resolveComponentId(_bitMapIdWithVersion);\n }\n // Handle use case 2 - the provided id has scope which is not the local scope\n // we want to search by the source id\n return await this.scope.resolveComponentId(idWithVersion);\n }\n // Handle use case 3\n return await this.scope.resolveComponentId(idWithVersion);\n } catch (error: any) {\n legacyId = BitId.parse(id.toString(), true);\n return ComponentID.fromLegacy(legacyId);\n }\n }\n\n async resolveMultipleComponentIds(ids: Array<string | ComponentID | BitId>): Promise<ComponentID[]> {\n return Promise.all(ids.map(async (id) => this.resolveComponentId(id)));\n }\n\n /**\n * This will mutate the original extensions list and resolve it's ids\n *\n * @param {ExtensionDataList} extensions\n * @returns {Promise<void[]>}\n * @memberof Workspace\n */\n resolveExtensionsList(extensions: ExtensionDataList): Promise<void[]> {\n const resolveMergedExtensionsP = extensions.map(async (extensionEntry) => {\n if (extensionEntry.extensionId) {\n // const hasVersion = extensionEntry.extensionId.hasVersion();\n // const useBitmapVersion = !hasVersion;\n // const resolvedId = await this.resolveComponentId(extensionEntry.extensionId, true, useBitmapVersion);\n\n // Assuming extensionId always has scope - do not allow extension id without scope\n const resolvedId = await this.resolveComponentId(extensionEntry.extensionId);\n extensionEntry.extensionId = resolvedId._legacy;\n }\n });\n return Promise.all(resolveMergedExtensionsP);\n }\n\n /**\n * This will mutate the original extensions list and make sure all extensions has the ids with the scope / default scope\n *\n * @param {ExtensionDataList} extensions\n * @returns {Promise<void[]>}\n * @memberof Workspace\n */\n addDefaultScopeToExtensionsList(extensions: ExtensionDataList): Promise<void[]> {\n const resolveMergedExtensionsP = extensions.map(async (extensionEntry) => {\n if (extensionEntry.extensionId && !extensionEntry.extensionId.hasScope()) {\n const componentId = ComponentID.fromLegacy(extensionEntry.extensionId);\n const defaultScope = await this.componentDefaultScope(componentId);\n extensionEntry.extensionId = extensionEntry.extensionId.changeScope(defaultScope);\n }\n });\n return Promise.all(resolveMergedExtensionsP);\n }\n\n /**\n * configure an environment to the given components in the .bitmap file, this configuration overrides other, such as\n * overrides in workspace.jsonc.\n */\n async setEnvToComponents(envId: ComponentID, componentIds: ComponentID[]) {\n const envStrWithPossiblyVersion = await this.resolveEnvIdWithPotentialVersionForConfig(envId);\n const envIdStrNoVersion = envId.toStringWithoutVersion();\n await this.unsetEnvFromComponents(componentIds);\n await Promise.all(\n componentIds.map(async (componentId) => {\n await this.addSpecificComponentConfig(componentId, envStrWithPossiblyVersion);\n await this.addSpecificComponentConfig(componentId, EnvsAspect.id, { env: envIdStrNoVersion });\n })\n );\n await this.bitMap.write();\n }\n\n /**\n * helpful when a user provides an env-string to be set and this env has no version.\n * in the workspace config, a custom-env needs to be set with a version unless it's part of the workspace.\n * (inside envs/envs it's set without a version).\n */\n async resolveEnvIdWithPotentialVersionForConfig(envId: ComponentID): Promise<string> {\n const isCore = this.aspectLoader.isCoreAspect(envId.toStringWithoutVersion());\n const existsOnWorkspace = await this.hasId(envId);\n if (isCore || existsOnWorkspace) {\n // the env needs to be without version\n return envId.toStringWithoutVersion();\n }\n // the env must include a version\n if (envId.hasVersion()) {\n return envId.toString();\n }\n const extensions = this.harmony.get<ConfigMain>('teambit.harmony/config').extensions;\n const found = extensions?.findExtension(envId.toString(), true);\n if (found && found.extensionId?.version) {\n return found.extensionId.toString();\n }\n const comps = await this.importAndGetMany([envId]);\n return comps[0].id.toString();\n }\n\n /**\n * remove env configuration from the .bitmap file, so then other configuration, such as \"variants\" will take place\n */\n async unsetEnvFromComponents(ids: ComponentID[]): Promise<{ changed: ComponentID[]; unchanged: ComponentID[] }> {\n const changed: ComponentID[] = [];\n const unchanged: ComponentID[] = [];\n await Promise.all(\n ids.map(async (id) => {\n const envsAspect = await this.getSpecificComponentConfig(id, EnvsAspect.id);\n const currentEnv = envsAspect && envsAspect !== REMOVE_EXTENSION_SPECIAL_SIGN ? envsAspect.env : null;\n if (!currentEnv) {\n unchanged.push(id);\n return;\n }\n const currentEnvWithPotentialVersion = await this.getAspectIdFromConfig(id, currentEnv, true);\n await this.removeSpecificComponentConfig(id, currentEnvWithPotentialVersion || currentEnv, false);\n await this.removeSpecificComponentConfig(id, EnvsAspect.id, false);\n changed.push(id);\n })\n );\n await this.bitMap.write();\n return { changed, unchanged };\n }\n}\n\n/**\n * this is a super hacky way to do it. problem is that loadAspect is running as onStart hook, where we don't\n * have the CLI fully loaded yet, so we can't get the command from the CLI aspect, we have to retrieve it from\n * process.argv.\n * in general, we don't want every command to try again and again fetching un-built versions. otherwise, every time\n * Bit loads (even bit --help), it'll fetch them and slow down everything.\n * instead, long-running commands and those that need the artifacts from the Version objects, should try to re-fetch.\n */\nfunction shouldReFetchUnBuiltVersion() {\n const commandsToReFetch = ['import'];\n return commandsToReFetch.includes(process.argv[2]);\n}\n\nexport default Workspace;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAIA;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;AAWA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAKA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;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;AAE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QAAQ,CAAC;EACpC,OAAOA,iBAAiB,CAACnY,QAAQ,CAACoY,OAAO,CAACC,IAAI,CAAC,CAAC,CAAC,CAAC;AACpD;AAAC,eAEc3rB,SAAS;AAAA"}
1
+ {"version":3,"names":["AspectSpecificField","ComponentAdded","ComponentChanged","ComponentRemoved","DEFAULT_VENDOR_DIR","Workspace","constructor","pubsub","config","consumer","scope","componentAspect","dependencyResolver","variants","aspectLoader","logger","componentList","ComponentsList","harmony","onComponentLoadSlot","onComponentChangeSlot","envs","onComponentAddSlot","onComponentRemoveSlot","onMultipleComponentsAddSlot","onPreWatchSlot","graphql","Watcher","componentLoadedSelfAsAspects","createInMemoryCache","maxSize","getMaxSizeForComponents","owner","defaultOwner","componentLoader","WorkspaceComponentLoader","validateConfig","bitMap","BitMap","componentDefaultScopeFromComponentDirAndNameWithoutConfigFile","memoize","bind","primitive","promise","maxAge","isLegacy","isEmpty","BitError","defaultScope","isValidScopeName","InvalidScopeName","path","getPath","modulesPath","join","onComponentLoad","loadFn","register","registerOnComponentChange","onComponentChangeFunc","registerOnComponentAdd","onComponentAddFunc","registerOnMultipleComponentsAdd","onMultipleComponentsAddFunc","registerOnComponentRemove","onComponentRemoveFunc","registerOnPreWatch","onPreWatchFunc","name","tokenizedPath","split","length","icon","hasModifiedDependencies","component","componentsList","listAutoTagPendingComponents","isAutoTag","find","consumerComponent","id","isEqualWithoutVersion","_legacy","getComponentIssues","state","_consumer","issues","getComponentStatus","status","getComponentStatusById","ComponentStatus","fromLegacy","isOutdated","list","filter","loadOpts","legacyIds","getAllIdsAvailableOnLane","ids","resolveMultipleComponentIds","idsToGet","limit","slice","offset","getMany","listInvalid","getInvalid","listIds","_cachedListIds","hasChanged","bitmapIdsFromCurrentLane","hasId","componentId","found","isEqual","hasName","Boolean","fullName","hasIdNested","includeCache","modified","listModifiedComponents","componentIds","map","ComponentID","newComponents","listNewComponents","getAllComponentIds","bitIds","getAllBitIds","getNewAndModifiedIds","listTagPendingComponents","newAndModified","getLogs","shortHash","startsFrom","getGraph","shouldThrowOnMissingDep","buildOneGraphForComponents","undefined","getGraphIds","graphIdsFromFsBuilder","GraphIdsFromFsBuilder","buildGraph","getSavedGraphOfComponentIfExist","versionObj","legacyScope","getVersionInstance","err","flattenedEdges","flattenedDependencies","flattenedBitIdCompIdMap","toString","Promise","all","bitId","resolveComponentId","getCompIdByIdStr","idStr","compId","Error","nodes","Object","values","edges","edge","source","target","graph","Graph","forEach","node","setNode","Node","setEdge","Edge","type","getDependentsIds","workspaceGraph","DependencyGraph","buildGraphFromWorkspace","workspaceDependencyGraph","workspaceDependents","getDependentsInfo","dependentsLegacyIds","flat","_","dependentsLegacyNoDup","BitIds","uniqFromArray","dependentsIds","createAspectList","extensionDataList","entiresP","entry","extensionDataEntryToAspectEntry","entries","createAspectListFromEntries","dataEntry","AspectEntry","get","legacyComponent","useCache","storeInCache","debug","tryLoadAsAspect","isUsingEnvEnv","isCoreAspect","toStringWithoutVersion","isAspectLoaded","set","loadAspects","e","delete","getEnvSystemDescriptor","env","calculateEnv","__getDescriptor","systemDescriptor","services","isEnvRegistered","getServices","getDescriptor","description","toObject","clearCache","resetFailedLoadAspects","clearComponentCache","clearOneComponentCache","triggerOnComponentChange","files","initiator","write","onChangeEntries","toArray","results","mapSeries","extension","onChangeFunc","onChangeResult","push","extensionId","publish","componentChanged","triggerOnComponentAdd","onAddEntries","filesystem","file","onAddFunc","onAddResult","componentAdded","triggerOnComponentRemove","onRemoveEntries","onRemoveFunc","onRemoveResult","componentRemoved","triggerOnMultipleComponentsAdd","getState","hash","getSnap","getCurrentLaneId","getCurrentRemoteLane","currentLaneId","isDefault","scopeComponentImporter","ScopeComponentsImporter","getInstance","lanes","importLanes","ScopeNotFoundOrDenied","LaneNotFound","InvalidScopeNameFromRemote","bitMapLaneId","getExportedLaneId","loader","stop","warn","message","getDefaultExtensions","extensions","ExtensionDataList","fromConfigObject","ejectMultipleConfigs","options","ejectConfig","getSpecificExtensionsFromScope","aspects","componentDir","ignoreVersion","componentConfigFile","ComponentConfigFile","propagate","override","removeEntireConfig","configPath","composePath","componentFromScope","componentExtensions","resolveScopeAspectListIds","aspectListFromScope","resolvedList","pmap","newId","newEntry","legacy","byPattern","pattern","finalPattern","targetIds","spec","isMatchNamespacePatternItem","match","components","idsByPattern","throwForNoMatch","includes","exists","MissingBitMapComponent","filterIdsFromPoolIdsByPattern","getComponentsByUserInput","includeDependents","newAndModifiedIds","comp","dependentsIdsFiltered","dependents","getComponentsUsingEnv","throwIfNotFound","allComps","allEnvs","createEnvironment","foundEnv","runtimeEnvs","runtimeEnv","envWithoutVersion","availableEnvs","getManyByLegacy","getIfExist","importAndGetMany","importCurrentLaneIfMissing","import","reFetchUnBuiltVersion","shouldReFetchUnBuiltVersion","laneId","laneObj","getCurrentLaneObject","lane","info","objects","writeObjectsToTheFS","scopeComponentsImporter","fromArray","toBitIds","hasScope","importManyDeltaWithoutDeps","fromHead","importMany","add","componentPaths","main","addComponent","AddComponents","addResults","use","aspectIdStr","aspectId","aspectIdToAdd","loadedIds","workspaceConfig","setExtension","overrideExisting","track","trackData","addOwnerToScopeName","rootDir","componentName","mainFile","result","addedComponent","addedComponents","f","relativePath","warnings","scopeName","isSelfHosted","isHostedByBit","wsDefaultScope","rootPath","pathToWrite","relative","fs","outputFile","contents","bitMapOptions","componentDirFromLegacyId","componentPackageDir","packageName","componentIdToPackageName","packageDir","toAbsolutePath","componentMap","getComponent","relativeComponentDir","getComponentDir","NoComponentDir","componentDirToAbsolute","componentDefaultScope","componentDefaultScopeFromComponentDirAndName","componentConfigFileFromComponentDirAndName","bitMapId","getExistingBitId","bitMapEntry","variantConfig","byRootDirAndName","isVendor","isVendorComponentByComponentDir","excludeOrigins","configFileExtensions","variantsExtensions","wsDefaultExtensions","mergeFromScope","getComponentIfExist","bitMapExtensions","unmergedHead","getUnmergedHead","unmergedExtensions","unmergedExtensionsSpecific","unmergedExtensionsNonSpecific","versionInstance","changeVersion","specific","nonSpecific","partition","scopeExtensions","scopeExtensionsNonSpecific","scopeExtensionsSpecific","toLegacy","clone","extensionsToMerge","envWasFoundPreviously","removedExtensionIds","addExtensionsToMerge","origin","extraData","extData","isRemoved","stringId","extsWithoutRemoved","filterRemovedExtensions","selfInMergedExtensions","findExtension","toStringWithoutScopeAndVersion","extsWithoutSelf","remove","extensionDataListFiltered","envIsCurrentlySet","filterEnvsFromExtensionsIfNeeded","warnAboutMisconfiguredEnv","setDataListAsSpecific","continuePropagating","appliedRules","sortedMatches","specificity","isDefaultExtension","resolveExtensionListIds","afterMerge","mergeConfigs","ext","loadExtensions","withoutRemoved","beforeMerge","unmerged","unmergedComponents","getEntry","head","getUnmergedComponent","envAspect","EnvsAspect","envFromEnvsAspect","getCoreEnvsIds","warnedAboutMisconfiguredEnvs","envId","consoleWarning","isModified","consumerComp","_isModified","componentStatus","nonEnvs","triggerOnPreWatch","watchOpts","preWatchFunctions","func","setDefaultScopeToComponents","newComponentIds","hasVersion","compIdsStr","setDefaultScope","WorkspaceAspect","mergeIntoExisting","dir","dirname","addSpecificComponentConfig","shouldMergeWithExisting","shouldMergeWithPrevious","addAspect","obj","toConfigObject","merge","addComponentConfig","removeSpecificComponentConfig","markWithMinusIfNotExist","removeAspect","removeComponentConfig","getAspectIdFromConfig","ignoreAspectVersion","aspectEntry","getSpecificComponentConfig","getBitmapEntry","extensionList","promises","vendorDir","vendor","directory","pathIsInside","getComponentIdByPath","componentPath","isAbsolute","linuxPath","pathNormalizeToLinux","absComponentDir","defaultScopeFromVariantsOrWs","load","getAspectsGraphWithoutCore","isAspect","coreAspectsStringIds","getCoreAspectIds","throwOnError","neededFor","callId","Math","floor","random","loggerPrefix","notLoadedIds","idsWithoutCore","difference","importAndGetAspects","isUsingAspectEnv","isValidAspect","attr","workspaceComps","scopeComps","groupComponentsByWorkspaceAndScope","c","scopeIds","aspect","workspaceAspects","requireComponents","workspaceManifests","getManifestsFromRequireableExtensions","potentialPluginsIndexes","compact","manifest","index","workspaceManifestsIds","m","scopeIdsGrouped","groupAspectIdsByEnvOfTheList","scopeEnvsManifestsIds","currentLane","manifests","scopeOtherManifests","other","getManifestsGraphRecursively","packageManagerConfigRootDir","scopeOtherManifestsIds","loadExtensionsByManifests","pluginsWorkspaceComps","pluginsWorkspaceAspects","pluginsWorkspaceManifests","concat","ignoreIds","shouldLoadFunc","graphFromFsBuilder","GraphFromFsBuilder","resolveAspects","runtimeName","opts","defaultOpts","excludeCore","requestedOnly","mergedOpts","missingPaths","stringIds","idsToResolve","extensionsIds","coreAspectsIds","userAspectsIds","componentIdsToResolve","workspaceIds","groupIdsByWorkspaceAndScope","wsComponents","aspectDefs","compStringId","localPath","getComponentPackagePath","isExist","pathExists","runtimePath","getRuntimePath","aspectFilePath","getAspectFilePath","aspectPath","scopeAspectDefs","coreAspectDefs","coreId","rawDef","getAspectDef","loadDefinition","coreAspect","link","allDefs","fromString","afterExclusion","def","isCore","getId","isTarget","uniqDefs","uniqBy","defs","componentIdsString","existOnWorkspace","originatedFrom","extensionsIdsP","extensionEntry","loadedExtensions","extensionsToLoad","getTempDir","PREFIX","cacheDir","existsSync","mkdirSync","recursive","resolveP","requireFunc","plugins","getPlugins","has","MainRuntime","require","RequireableComponent","resolved","remotes","_legacyRemotes","isHub","ComponentNotFound","configStr","JSON","stringify","raw","_reloadConsumer","loadConsumer","getRuntimeModulePath","defaultDirectory","legacyDefaultDirectory","getDefaultScope","legacyId","getParsedIdIfExist","shouldSearchWithoutScopeInProvidedId","startsWith","idWithVersion","idWithoutVersion","version","_bitMapId","_bitMapIdWithoutVersion","_bitMapIdWithVersion","endsWith","defaultScopeForBitmapId","getFromBitmapAddDefaultScope","_bitmapIdWithVersionForSource","fromScope","error","BitId","parse","resolveExtensionsList","resolveMergedExtensionsP","resolvedId","addDefaultScopeToExtensionsList","changeScope","setEnvToComponents","envStrWithPossiblyVersion","resolveEnvIdWithPotentialVersionForConfig","envIdStrNoVersion","unsetEnvFromComponents","existsOnWorkspace","comps","changed","unchanged","envsAspect","currentEnv","REMOVE_EXTENSION_SPECIAL_SIGN","currentEnvWithPotentialVersion","commandsToReFetch","process","argv"],"sources":["workspace.ts"],"sourcesContent":["/* eslint-disable max-lines */\nimport memoize from 'memoizee';\nimport mapSeries from 'p-map-series';\nimport { Graph, Node, Edge } from '@teambit/graph.cleargraph';\nimport type { PubsubMain } from '@teambit/pubsub';\nimport { IssuesList } from '@teambit/component-issues';\nimport type { AspectLoaderMain, AspectDefinition } from '@teambit/aspect-loader';\nimport { getAspectDef } from '@teambit/aspect-loader';\nimport { MainRuntime } from '@teambit/cli';\nimport DependencyGraph from '@teambit/legacy/dist/scope/graph/scope-graph';\nimport {\n AspectEntry,\n ComponentMain,\n Component,\n ComponentFactory,\n ComponentID,\n AspectList,\n AspectData,\n InvalidComponent,\n ResolveAspectsOptions,\n} from '@teambit/component';\nimport { BitError } from '@teambit/bit-error';\nimport { REMOVE_EXTENSION_SPECIAL_SIGN } from '@teambit/legacy/dist/consumer/config';\nimport { ComponentScopeDirMap, ConfigMain } from '@teambit/config';\nimport { DependencyResolverMain } from '@teambit/dependency-resolver';\nimport { EnvsMain, EnvsAspect, EnvServiceList } from '@teambit/envs';\nimport { GraphqlMain } from '@teambit/graphql';\nimport { Harmony } from '@teambit/harmony';\nimport { Logger } from '@teambit/logger';\nimport type { ScopeMain } from '@teambit/scope';\nimport { isMatchNamespacePatternItem } from '@teambit/workspace.modules.match-pattern';\nimport { RequireableComponent } from '@teambit/harmony.modules.requireable-component';\nimport type { VariantsMain } from '@teambit/variants';\nimport { link } from '@teambit/legacy/dist/api/consumer';\nimport { BitIds } from '@teambit/legacy/dist/bit-id';\nimport { BitId, InvalidScopeName, InvalidScopeNameFromRemote, isValidScopeName } from '@teambit/legacy-bit-id';\nimport { LaneId } from '@teambit/lane-id';\nimport { Consumer, loadConsumer } from '@teambit/legacy/dist/consumer';\nimport { GetBitMapComponentOptions } from '@teambit/legacy/dist/consumer/bit-map/bit-map';\nimport AddComponents from '@teambit/legacy/dist/consumer/component-ops/add-components';\nimport type {\n AddActionResults,\n Warnings,\n} from '@teambit/legacy/dist/consumer/component-ops/add-components/add-components';\nimport { getMaxSizeForComponents, InMemoryCache } from '@teambit/legacy/dist/cache/in-memory-cache';\nimport { createInMemoryCache } from '@teambit/legacy/dist/cache/cache-factory';\nimport { ComponentNotFound } from '@teambit/legacy/dist/scope/exceptions';\nimport ComponentsList from '@teambit/legacy/dist/consumer/component/components-list';\nimport { NoComponentDir } from '@teambit/legacy/dist/consumer/component/exceptions/no-component-dir';\nimport { ExtensionDataList, ExtensionDataEntry } from '@teambit/legacy/dist/consumer/config/extension-data';\nimport { pathIsInside } from '@teambit/legacy/dist/utils';\nimport componentIdToPackageName from '@teambit/legacy/dist/utils/bit/component-id-to-package-name';\nimport {\n PathOsBased,\n PathOsBasedRelative,\n PathOsBasedAbsolute,\n pathNormalizeToLinux,\n} from '@teambit/legacy/dist/utils/path';\nimport fs from 'fs-extra';\nimport { CompIdGraph, DepEdgeType } from '@teambit/graph';\nimport { slice, uniqBy, difference, compact, partition, isEmpty, merge } from 'lodash';\nimport path from 'path';\nimport ConsumerComponent from '@teambit/legacy/dist/consumer/component';\nimport type { ComponentLog } from '@teambit/legacy/dist/scope/models/model-component';\nimport { CompilationInitiator } from '@teambit/compiler';\nimport ScopeComponentsImporter from '@teambit/legacy/dist/scope/component-ops/scope-components-importer';\nimport { MissingBitMapComponent } from '@teambit/legacy/dist/consumer/bit-map/exceptions';\nimport loader from '@teambit/legacy/dist/cli/loader';\nimport { Lane, Version } from '@teambit/legacy/dist/scope/models';\nimport { LaneNotFound } from '@teambit/legacy/dist/api/scope/lib/exceptions/lane-not-found';\nimport { ScopeNotFoundOrDenied } from '@teambit/legacy/dist/remotes/exceptions/scope-not-found-or-denied';\nimport { ComponentLoadOptions } from '@teambit/legacy/dist/consumer/component/component-loader';\nimport { ComponentConfigFile } from './component-config-file';\nimport {\n OnComponentAdd,\n OnComponentChange,\n OnComponentEventResult,\n OnComponentLoad,\n OnComponentRemove,\n OnMultipleComponentsAdd,\n SerializableResults,\n} from './on-component-events';\nimport { WorkspaceExtConfig } from './types';\nimport { Watcher, WatchOptions } from './watch/watcher';\nimport { ComponentStatus } from './workspace-component/component-status';\nimport {\n OnComponentAddSlot,\n OnComponentChangeSlot,\n OnComponentLoadSlot,\n OnComponentRemoveSlot,\n OnMultipleComponentsAddSlot,\n OnPreWatch,\n OnPreWatchSlot,\n} from './workspace.provider';\nimport { WorkspaceComponentLoader } from './workspace-component/workspace-component-loader';\nimport { GraphFromFsBuilder, ShouldLoadFunc } from './build-graph-from-fs';\nimport { BitMap } from './bit-map';\nimport { WorkspaceAspect } from './workspace.aspect';\nimport { GraphIdsFromFsBuilder } from './build-graph-ids-from-fs';\n\nexport type EjectConfResult = {\n configPath: string;\n};\n\nexport const AspectSpecificField = '__specific';\nexport const ComponentAdded = 'componentAdded';\nexport const ComponentChanged = 'componentChanged';\nexport const ComponentRemoved = 'componentRemoved';\n\nexport interface EjectConfOptions {\n propagate?: boolean;\n override?: boolean;\n}\n\nexport type TrackData = {\n rootDir: PathOsBasedRelative; // path relative to the workspace\n componentName?: string; // if empty, it'll be generated from the path\n mainFile?: string; // if empty, attempts will be made to guess the best candidate\n defaultScope?: string; // can be entered as part of \"bit create\" command, helpful for out-of-sync logic\n config?: { [aspectName: string]: any }; // config specific to this component, which overrides variants of workspace.jsonc\n};\n\nexport type ExtensionsOrigin =\n | 'BitmapFile'\n | 'ModelSpecific'\n | 'ModelNonSpecific'\n | 'UnmergedSpecific'\n | 'UnmergedNonSpecific'\n | 'WorkspaceVariants'\n | 'ComponentJsonFile'\n | 'WorkspaceDefault'\n | 'FinalAfterMerge';\n\nexport type TrackResult = { componentName: string; files: string[]; warnings: Warnings };\n\nconst DEFAULT_VENDOR_DIR = 'vendor';\n\n/**\n * API of the Bit Workspace\n */\nexport class Workspace implements ComponentFactory {\n priority = true;\n owner?: string;\n componentsScopeDirsMap: ComponentScopeDirMap;\n componentLoader: WorkspaceComponentLoader;\n bitMap: BitMap;\n private _cachedListIds?: ComponentID[];\n private componentLoadedSelfAsAspects: InMemoryCache<boolean>; // cache loaded components\n private warnedAboutMisconfiguredEnvs: string[] = []; // cache env-ids that have been errored about not having \"env\" type\n constructor(\n /**\n * private pubsub.\n */\n private pubsub: PubsubMain,\n\n private config: WorkspaceExtConfig,\n /**\n * private access to the legacy consumer instance.\n */\n public consumer: Consumer,\n\n /**\n * access to the workspace `Scope` instance\n */\n readonly scope: ScopeMain,\n\n /**\n * access to the `ComponentProvider` instance\n */\n private componentAspect: ComponentMain,\n\n private dependencyResolver: DependencyResolverMain,\n\n private variants: VariantsMain,\n\n private aspectLoader: AspectLoaderMain,\n\n private logger: Logger,\n\n private componentList: ComponentsList = new ComponentsList(consumer),\n\n /**\n * private reference to the instance of Harmony.\n */\n private harmony: Harmony,\n\n /**\n * on component load slot.\n */\n public onComponentLoadSlot: OnComponentLoadSlot,\n\n /**\n * on component change slot.\n */\n private onComponentChangeSlot: OnComponentChangeSlot,\n\n private envs: EnvsMain,\n\n /**\n * on component add slot.\n */\n private onComponentAddSlot: OnComponentAddSlot,\n\n private onComponentRemoveSlot: OnComponentRemoveSlot,\n\n private onMultipleComponentsAddSlot: OnMultipleComponentsAddSlot,\n\n private onPreWatchSlot: OnPreWatchSlot,\n\n private graphql: GraphqlMain\n ) {\n this.componentLoadedSelfAsAspects = createInMemoryCache({ maxSize: getMaxSizeForComponents() });\n\n // TODO: refactor - prefer to avoid code inside the constructor.\n this.owner = this.config?.defaultOwner;\n this.componentLoader = new WorkspaceComponentLoader(this, logger, dependencyResolver, envs);\n this.validateConfig();\n this.bitMap = new BitMap(this.consumer.bitMap, this.consumer);\n // memoize this method to improve performance.\n this.componentDefaultScopeFromComponentDirAndNameWithoutConfigFile = memoize(\n this.componentDefaultScopeFromComponentDirAndNameWithoutConfigFile.bind(this),\n {\n primitive: true,\n promise: true,\n maxAge: 60 * 1000, // 1 min\n }\n );\n }\n\n private validateConfig() {\n if (this.consumer.isLegacy) return;\n if (isEmpty(this.config))\n throw new BitError(\n `fatal: workspace config is empty. probably one of bit files is missing. consider running \"bit init\"`\n );\n const defaultScope = this.config.defaultScope;\n if (!defaultScope) throw new BitError('defaultScope is missing');\n if (!isValidScopeName(defaultScope)) throw new InvalidScopeName(defaultScope);\n }\n\n /**\n * watcher api.\n */\n readonly watcher = new Watcher(this, this.pubsub);\n\n /**\n * root path of the Workspace.\n */\n get path() {\n return this.consumer.getPath();\n }\n\n /** get the `node_modules` folder of this workspace */\n private get modulesPath() {\n return path.join(this.path, 'node_modules');\n }\n\n get isLegacy(): boolean {\n return this.consumer.isLegacy;\n }\n\n onComponentLoad(loadFn: OnComponentLoad) {\n this.onComponentLoadSlot.register(loadFn);\n return this;\n }\n\n registerOnComponentChange(onComponentChangeFunc: OnComponentChange) {\n this.onComponentChangeSlot.register(onComponentChangeFunc);\n return this;\n }\n\n registerOnComponentAdd(onComponentAddFunc: OnComponentAdd) {\n this.onComponentAddSlot.register(onComponentAddFunc);\n return this;\n }\n\n registerOnMultipleComponentsAdd(onMultipleComponentsAddFunc: OnMultipleComponentsAdd) {\n this.onMultipleComponentsAddSlot.register(onMultipleComponentsAddFunc);\n return this;\n }\n\n registerOnComponentRemove(onComponentRemoveFunc: OnComponentRemove) {\n this.onComponentRemoveSlot.register(onComponentRemoveFunc);\n return this;\n }\n\n registerOnPreWatch(onPreWatchFunc: OnPreWatch) {\n this.onPreWatchSlot.register(onPreWatchFunc);\n return this;\n }\n\n /**\n * name of the workspace as configured in either `workspace.json`.\n * defaults to workspace root directory name.\n */\n get name() {\n if (this.config.name) return this.config.name;\n const tokenizedPath = this.path.split('/');\n return tokenizedPath[tokenizedPath.length - 1];\n }\n\n get icon() {\n return this.config.icon;\n }\n\n async hasModifiedDependencies(component: Component) {\n const componentsList = new ComponentsList(this.consumer);\n const listAutoTagPendingComponents = await componentsList.listAutoTagPendingComponents();\n const isAutoTag = listAutoTagPendingComponents.find((consumerComponent) =>\n consumerComponent.id.isEqualWithoutVersion(component.id._legacy)\n );\n if (isAutoTag) return true;\n return false;\n }\n\n /**\n * get Component issues\n */\n getComponentIssues(component: Component): IssuesList | null {\n return component.state._consumer.issues || null;\n }\n\n /**\n * provides status of all components in the workspace.\n */\n async getComponentStatus(component: Component): Promise<ComponentStatus> {\n const status = await this.consumer.getComponentStatusById(component.id._legacy);\n const hasModifiedDependencies = await this.hasModifiedDependencies(component);\n return ComponentStatus.fromLegacy(status, hasModifiedDependencies, component.isOutdated());\n }\n\n /**\n * list all workspace components.\n */\n async list(filter?: { offset: number; limit: number }, loadOpts?: ComponentLoadOptions): Promise<Component[]> {\n const legacyIds = this.consumer.bitMap.getAllIdsAvailableOnLane();\n const ids = await this.resolveMultipleComponentIds(legacyIds);\n const idsToGet = filter && filter.limit ? slice(ids, filter.offset, filter.offset + filter.limit) : ids;\n return this.getMany(idsToGet, loadOpts);\n }\n\n /**\n * list all invalid components.\n * (see the invalid criteria in ConsumerComponent.isComponentInvalidByErrorType())\n */\n async listInvalid(): Promise<InvalidComponent[]> {\n const legacyIds = this.consumer.bitMap.getAllIdsAvailableOnLane();\n const ids = await this.resolveMultipleComponentIds(legacyIds);\n return this.componentLoader.getInvalid(ids);\n }\n\n /**\n * get ids of all workspace components.\n */\n async listIds(): Promise<ComponentID[]> {\n if (this._cachedListIds && this.bitMap.hasChanged()) {\n delete this._cachedListIds;\n }\n if (!this._cachedListIds) {\n this._cachedListIds = await this.resolveMultipleComponentIds(this.consumer.bitmapIdsFromCurrentLane);\n }\n return this._cachedListIds;\n }\n\n /**\n * Check if a specific id exist in the workspace\n * @param componentId\n */\n async hasId(componentId: ComponentID): Promise<boolean> {\n const ids = await this.listIds();\n const found = ids.find((id) => {\n return id.isEqual(componentId);\n });\n return !!found;\n }\n\n /**\n * whether or not a workspace has a component with the given name\n */\n async hasName(name: string): Promise<boolean> {\n const ids = await this.listIds();\n return Boolean(ids.find((id) => id.fullName === name));\n }\n\n /**\n * Check if a specific id exist in the workspace or in the scope\n * @param componentId\n */\n async hasIdNested(componentId: ComponentID, includeCache = true): Promise<boolean> {\n const found = await this.hasId(componentId);\n if (found) return found;\n return this.scope.hasIdNested(componentId, includeCache);\n }\n\n /**\n * list all modified components in the workspace.\n */\n async modified(): Promise<Component[]> {\n const ids: any = await this.componentList.listModifiedComponents(false);\n const componentIds = ids.map(ComponentID.fromLegacy);\n return this.getMany(componentIds);\n }\n\n /**\n * list all new components in the workspace.\n */\n async newComponents() {\n const ids: any = await this.componentList.listNewComponents(false);\n const componentIds = ids.map(ComponentID.fromLegacy);\n return this.getMany(componentIds);\n }\n\n /**\n * get all workspace component-ids, include vendor components.\n * (exclude nested dependencies in case dependencies are saved as components and not packages)\n */\n getAllComponentIds(): Promise<ComponentID[]> {\n const bitIds = this.consumer.bitMap.getAllBitIds();\n return this.resolveMultipleComponentIds(bitIds);\n }\n\n async getNewAndModifiedIds(): Promise<ComponentID[]> {\n const ids = await this.componentList.listTagPendingComponents();\n return this.resolveMultipleComponentIds(ids);\n }\n\n async newAndModified(): Promise<Component[]> {\n const ids = await this.getNewAndModifiedIds();\n return this.getMany(ids);\n }\n\n async getLogs(id: ComponentID, shortHash = false, startsFrom?: string): Promise<ComponentLog[]> {\n return this.scope.getLogs(id, shortHash, startsFrom);\n }\n\n async getGraph(ids?: ComponentID[], shouldThrowOnMissingDep = true): Promise<Graph<Component, string>> {\n if (!ids || ids.length < 1) ids = await this.listIds();\n\n return this.buildOneGraphForComponents(ids, undefined, undefined, shouldThrowOnMissingDep);\n }\n\n async getGraphIds(ids?: ComponentID[], shouldThrowOnMissingDep = true): Promise<CompIdGraph> {\n if (!ids || ids.length < 1) ids = await this.listIds();\n\n const graphIdsFromFsBuilder = new GraphIdsFromFsBuilder(\n this,\n this.logger,\n this.dependencyResolver,\n shouldThrowOnMissingDep\n );\n return graphIdsFromFsBuilder.buildGraph(ids);\n }\n\n async getSavedGraphOfComponentIfExist(component: Component) {\n let versionObj: Version;\n try {\n versionObj = await this.scope.legacyScope.getVersionInstance(component.id._legacy);\n } catch (err) {\n return null;\n }\n\n const flattenedEdges = versionObj.flattenedEdges;\n if (!flattenedEdges.length && versionObj.flattenedDependencies.length) {\n // there are flattenedDependencies, so must be edges, if they're empty, it's because the component was tagged\n // with a version < ~0.0.901, so this flattenedEdges wasn't exist.\n return null;\n }\n const flattenedBitIdCompIdMap: { [bitIdStr: string]: ComponentID } = {};\n flattenedBitIdCompIdMap[component.id._legacy.toString()] = component.id;\n await Promise.all(\n versionObj.flattenedDependencies.map(async (bitId) => {\n flattenedBitIdCompIdMap[bitId.toString()] = await this.resolveComponentId(bitId);\n })\n );\n const getCompIdByIdStr = (idStr: string): ComponentID => {\n const compId = flattenedBitIdCompIdMap[idStr];\n if (!compId)\n throw new Error(`id ${idStr} exists in flattenedEdges but not in flattened of ${component.id.toString()}`);\n return compId;\n };\n const nodes = Object.values(flattenedBitIdCompIdMap);\n const edges = flattenedEdges.map((edge) => ({\n ...edge,\n source: getCompIdByIdStr(edge.source.toString()),\n target: getCompIdByIdStr(edge.target.toString()),\n }));\n\n const graph = new Graph<ComponentID, DepEdgeType>();\n nodes.forEach((node) => graph.setNode(new Node(node.toString(), node)));\n edges.forEach((edge) => graph.setEdge(new Edge(edge.source.toString(), edge.target.toString(), edge.type)));\n return graph;\n }\n\n /**\n * given component ids, find their dependents in the workspace\n */\n async getDependentsIds(ids: ComponentID[]): Promise<ComponentID[]> {\n const workspaceGraph = await DependencyGraph.buildGraphFromWorkspace(this.consumer, true);\n const workspaceDependencyGraph = new DependencyGraph(workspaceGraph);\n const workspaceDependents = ids.map((id) => workspaceDependencyGraph.getDependentsInfo(id._legacy));\n const dependentsLegacyIds = workspaceDependents.flat().map((_) => _.id);\n const dependentsLegacyNoDup = BitIds.uniqFromArray(dependentsLegacyIds);\n const dependentsIds = await this.resolveMultipleComponentIds(dependentsLegacyNoDup);\n return dependentsIds;\n }\n\n public async createAspectList(extensionDataList: ExtensionDataList) {\n const entiresP = extensionDataList.map((entry) => this.extensionDataEntryToAspectEntry(entry));\n const entries: AspectEntry[] = await Promise.all(entiresP);\n return this.componentAspect.createAspectListFromEntries(entries);\n }\n\n private async extensionDataEntryToAspectEntry(dataEntry: ExtensionDataEntry): Promise<AspectEntry> {\n return new AspectEntry(await this.resolveComponentId(dataEntry.id), dataEntry);\n }\n\n /**\n * get a component from workspace\n * @param id component ID\n */\n async get(\n componentId: ComponentID,\n legacyComponent?: ConsumerComponent,\n useCache = true,\n storeInCache = true,\n loadOpts?: ComponentLoadOptions\n ): Promise<Component> {\n this.logger.debug(`get ${componentId.toString()}`);\n const component = await this.componentLoader.get(componentId, legacyComponent, useCache, storeInCache, loadOpts);\n // When loading a component if it's an env make sure to load it as aspect as well\n // We only want to try load it as aspect if it's the first time we load the component\n const tryLoadAsAspect = this.componentLoadedSelfAsAspects.get(component.id.toString()) === undefined;\n // const config = this.harmony.get<ConfigMain>('teambit.harmony/config');\n\n // We are loading the component as aspect if it's an env, in order to be able to run the env-preview-template task which run only on envs.\n // Without this loading we will have a problem in case the env is the only component in the workspace. in that case we will load it as component\n // then we don't run it's provider so it doesn't register to the env slot, so we don't know it's an env.\n if (\n tryLoadAsAspect &&\n this.envs.isUsingEnvEnv(component) &&\n !this.aspectLoader.isCoreAspect(component.id.toStringWithoutVersion()) &&\n !this.aspectLoader.isAspectLoaded(component.id.toString()) &&\n (await this.hasId(component.id))\n // !config.extension(component.id.toStringWithoutVersion(), true)\n ) {\n try {\n this.componentLoadedSelfAsAspects.set(component.id.toString(), true);\n this.logger.debug(`trying to load self as aspect with id ${component.id.toString()}`);\n await this.loadAspects([component.id.toString()], undefined, component.id.toString());\n // In most cases if the load self as aspect failed we don't care about it.\n // we only need it in specific cases to work, but this workspace.get runs on different\n // cases where it might fail (like when importing aspect, after the import objects\n // when we write the package.json we run the applyTransformers which get to pkg which call\n // host.get, but the component not written yet to the fs, so it fails.)\n } catch (e) {\n this.logger.debug(`fail to load self as aspect with id ${component.id.toString()}`);\n this.componentLoadedSelfAsAspects.delete(component.id.toString());\n return component;\n }\n }\n this.componentLoadedSelfAsAspects.set(component.id.toString(), false);\n\n return component;\n }\n\n // TODO: @gilad we should refactor this asap into to the envs aspect.\n async getEnvSystemDescriptor(component: Component): Promise<AspectData> {\n const env = this.envs.calculateEnv(component);\n if (env.env.__getDescriptor && typeof env.env.__getDescriptor === 'function') {\n const systemDescriptor = await env.env.__getDescriptor();\n // !important persist services only on the env itself.\n let services: undefined | EnvServiceList;\n if (this.envs.isEnvRegistered(component.id.toString())) services = this.envs.getServices(env);\n const icon = this.aspectLoader.getDescriptor(env.id)?.icon || env.env.icon;\n\n return {\n type: systemDescriptor.type,\n // Make sure to store the env id in the data without the version\n // The version should always come from the aspect id configured on the component\n id: env.id.split('@')[0],\n name: env.name,\n icon,\n description: env.description,\n services: services?.toObject(),\n };\n }\n\n return {};\n }\n\n clearCache() {\n this.aspectLoader.resetFailedLoadAspects();\n this.logger.debug('clearing the workspace and scope caches');\n delete this._cachedListIds;\n this.componentLoader.clearCache();\n this.scope.clearCache();\n this.componentList = new ComponentsList(this.consumer);\n }\n\n clearComponentCache(id: ComponentID) {\n this.componentLoader.clearComponentCache(id);\n this.consumer.componentLoader.clearOneComponentCache(id._legacy);\n this.componentList = new ComponentsList(this.consumer);\n }\n\n async triggerOnComponentChange(\n id: ComponentID,\n files: string[],\n initiator?: CompilationInitiator\n ): Promise<OnComponentEventResult[]> {\n const component = await this.get(id);\n // if a new file was added, upon component-load, its .bitmap entry is updated to include the\n // new file. write these changes to the .bitmap file so then other processes have access to\n // this new file. If the .bitmap wasn't change, it won't do anything.\n await this.bitMap.write();\n const onChangeEntries = this.onComponentChangeSlot.toArray(); // e.g. [ [ 'teambit.bit/compiler', [Function: bound onComponentChange] ] ]\n const results: Array<{ extensionId: string; results: SerializableResults }> = [];\n await mapSeries(onChangeEntries, async ([extension, onChangeFunc]) => {\n const onChangeResult = await onChangeFunc(component, files, initiator);\n results.push({ extensionId: extension, results: onChangeResult });\n });\n\n // TODO: find way to standardize event names.\n await this.graphql.pubsub.publish(ComponentChanged, { componentChanged: { component } });\n return results;\n }\n\n async triggerOnComponentAdd(id: ComponentID): Promise<OnComponentEventResult[]> {\n const component = await this.get(id);\n const onAddEntries = this.onComponentAddSlot.toArray(); // e.g. [ [ 'teambit.bit/compiler', [Function: bound onComponentChange] ] ]\n const results: Array<{ extensionId: string; results: SerializableResults }> = [];\n const files = component.state.filesystem.files.map((file) => file.path);\n await mapSeries(onAddEntries, async ([extension, onAddFunc]) => {\n const onAddResult = await onAddFunc(component, files);\n results.push({ extensionId: extension, results: onAddResult });\n });\n\n await this.graphql.pubsub.publish(ComponentAdded, { componentAdded: { component } });\n return results;\n }\n\n async triggerOnComponentRemove(id: ComponentID): Promise<OnComponentEventResult[]> {\n const onRemoveEntries = this.onComponentRemoveSlot.toArray(); // e.g. [ [ 'teambit.bit/compiler', [Function: bound onComponentChange] ] ]\n const results: Array<{ extensionId: string; results: SerializableResults }> = [];\n await mapSeries(onRemoveEntries, async ([extension, onRemoveFunc]) => {\n const onRemoveResult = await onRemoveFunc(id);\n results.push({ extensionId: extension, results: onRemoveResult });\n });\n\n await this.graphql.pubsub.publish(ComponentRemoved, { componentRemoved: { componentIds: [id.toObject()] } });\n return results;\n }\n\n async triggerOnMultipleComponentsAdd(): Promise<void> {\n const onAddEntries = this.onMultipleComponentsAddSlot.toArray();\n await mapSeries(onAddEntries, async ([, onAddFunc]) => onAddFunc());\n }\n\n getState(id: ComponentID, hash: string) {\n return this.scope.getState(id, hash);\n }\n\n getSnap(id: ComponentID, hash: string) {\n return this.scope.getSnap(id, hash);\n }\n\n getCurrentLaneId(): LaneId {\n return this.consumer.getCurrentLaneId();\n }\n\n /**\n * if checked out to a lane and the lane exists in the remote,\n * return the remote lane id (name+scope). otherwise, return null.\n */\n async getCurrentRemoteLane(): Promise<Lane | null> {\n const currentLaneId = this.getCurrentLaneId();\n if (currentLaneId.isDefault()) {\n return null;\n }\n const scopeComponentImporter = ScopeComponentsImporter.getInstance(this.consumer.scope);\n try {\n const lanes = await scopeComponentImporter.importLanes([currentLaneId]);\n\n return lanes[0];\n } catch (err) {\n if (\n err instanceof InvalidScopeName ||\n err instanceof ScopeNotFoundOrDenied ||\n err instanceof LaneNotFound ||\n err instanceof InvalidScopeNameFromRemote\n ) {\n const bitMapLaneId = this.bitMap.getExportedLaneId();\n if (bitMapLaneId?.isEqual(currentLaneId)) {\n throw err; // we know the lane is not new, so the error is legit\n }\n // the lane could be a local lane so no need to throw an error in such case\n loader.stop();\n this.logger.warn(`unable to get lane's data from a remote due to an error:\\n${err.message}`);\n return null;\n }\n throw err;\n }\n }\n\n getDefaultExtensions(): ExtensionDataList {\n if (!this.config.extensions) {\n return new ExtensionDataList();\n }\n return ExtensionDataList.fromConfigObject(this.config.extensions);\n }\n\n async ejectMultipleConfigs(ids: ComponentID[], options: EjectConfOptions): Promise<EjectConfResult[]> {\n return Promise.all(ids.map((id) => this.ejectConfig(id, options)));\n }\n\n async ejectConfig(id: ComponentID, options: EjectConfOptions): Promise<EjectConfResult> {\n const componentId = await this.resolveComponentId(id);\n const extensions = await this.getSpecificExtensionsFromScope(id);\n const aspects = await this.createAspectList(extensions);\n const componentDir = this.componentDir(id, { ignoreVersion: true });\n const componentConfigFile = new ComponentConfigFile(componentId, aspects, componentDir, options.propagate);\n await componentConfigFile.write({ override: options.override });\n // remove config from the .bitmap as it's not needed anymore. it is replaced by the component.json\n this.bitMap.removeEntireConfig(id);\n await this.bitMap.write();\n return {\n configPath: ComponentConfigFile.composePath(componentDir),\n };\n }\n\n async getSpecificExtensionsFromScope(id: ComponentID): Promise<ExtensionDataList> {\n const componentFromScope = await this.scope.get(id);\n const { extensions } = await this.componentExtensions(id, componentFromScope, [\n 'WorkspaceDefault',\n 'WorkspaceVariants',\n ]);\n\n return extensions;\n }\n\n /**\n * see component-aspect, createAspectListFromLegacy() method for a context why this is needed.\n */\n private async resolveScopeAspectListIds(aspectListFromScope: AspectList): Promise<AspectList> {\n const resolvedList = await aspectListFromScope.pmap(async (entry) => {\n if (entry.id.scope !== this.scope.name) {\n return entry;\n }\n const newId = await this.resolveComponentId(entry.id.fullName);\n const newEntry = new AspectEntry(newId, entry.legacy);\n return newEntry;\n });\n return resolvedList;\n }\n\n /**\n * @deprecated use `this.idsByPattern` instead for consistency. also, it supports negation and list of patterns.\n *\n * load components into the workspace through a variants pattern.\n * @param pattern variants.\n * @param scope scope name.\n */\n async byPattern(pattern: string, scope = '**'): Promise<Component[]> {\n const ids = await this.listIds();\n const finalPattern = `${scope}/${pattern || '**'}`;\n const targetIds = ids.filter((id) => {\n const spec = isMatchNamespacePatternItem(id.toStringWithoutVersion(), finalPattern);\n return spec.match;\n });\n\n const components = await this.getMany(targetIds);\n return components;\n }\n\n /**\n * get component-ids matching the given pattern. a pattern can have multiple patterns separated by a comma.\n * it supports negate (!) character to exclude ids.\n */\n async idsByPattern(pattern: string, throwForNoMatch = true): Promise<ComponentID[]> {\n if (!pattern.includes('*') && !pattern.includes(',')) {\n // if it's not a pattern but just id, resolve it without multimatch to support specifying id without scope-name\n const id = await this.resolveComponentId(pattern);\n if (this.exists(id)) return [id];\n if (throwForNoMatch) throw new MissingBitMapComponent(pattern);\n return [];\n }\n const ids = await this.listIds();\n return this.scope.filterIdsFromPoolIdsByPattern(pattern, ids, throwForNoMatch);\n }\n\n /**\n * useful for workspace commands, such as `bit build`, `bit compile`.\n * by default, it should be running on new and modified components.\n * a user can specify `--all` to run on all components or specify a pattern to limit to specific components.\n * some commands such as build/test needs to run also on the dependents.\n */\n async getComponentsByUserInput(all?: boolean, pattern?: string, includeDependents = false): Promise<Component[]> {\n if (all) {\n return this.list();\n }\n if (pattern) {\n const ids = await this.idsByPattern(pattern);\n return this.getMany(ids);\n }\n const newAndModified = await this.newAndModified();\n if (includeDependents) {\n const newAndModifiedIds = newAndModified.map((comp) => comp.id);\n const dependentsIds = await this.getDependentsIds(newAndModifiedIds);\n const dependentsIdsFiltered = dependentsIds.filter((id) => !newAndModified.find((_) => _.id.isEqual(id)));\n const dependents = await this.getMany(dependentsIdsFiltered);\n newAndModified.push(...dependents);\n }\n return newAndModified;\n }\n\n async getComponentsUsingEnv(env: string, ignoreVersion = true, throwIfNotFound = false): Promise<Component[]> {\n const allComps = await this.list();\n const allEnvs = await this.envs.createEnvironment(allComps);\n const foundEnv = allEnvs.runtimeEnvs.find((runtimeEnv) => {\n if (runtimeEnv.id === env) return true;\n if (!ignoreVersion) return false;\n const envWithoutVersion = runtimeEnv.id.split('@')[0];\n return env === envWithoutVersion;\n });\n if (!foundEnv && throwIfNotFound) {\n const availableEnvs = allEnvs.runtimeEnvs.map((runtimeEnv) => runtimeEnv.id);\n throw new BitError(`unable to find components that using \"${env}\" env.\nthe following envs are used in this workspace: ${availableEnvs.join(', ')}`);\n }\n return foundEnv?.components || [];\n }\n\n async getMany(ids: Array<ComponentID>, loadOpts?: ComponentLoadOptions): Promise<Component[]> {\n return this.componentLoader.getMany(ids, loadOpts);\n }\n\n getManyByLegacy(components: ConsumerComponent[], loadOpts?: ComponentLoadOptions): Promise<Component[]> {\n return mapSeries(components, async (component) => {\n const id = await this.resolveComponentId(component.id);\n return this.get(id, component, true, true, loadOpts);\n });\n }\n\n /**\n * don't throw an error if the component was not found, simply return undefined.\n */\n async getIfExist(componentId: ComponentID): Promise<Component | undefined> {\n return this.componentLoader.getIfExist(componentId);\n }\n\n /**\n * whether a component exists in the workspace\n */\n exists(componentId: ComponentID): boolean {\n return Boolean(this.consumer.bitmapIdsFromCurrentLane.find((_) => _.isEqualWithoutVersion(componentId._legacy)));\n }\n\n /**\n * This will make sure to fetch the objects prior to load them\n * do not use it if you are not sure you need it.\n * It will influence the performance\n * currently it used only for get many of aspects\n * @param ids\n */\n async importAndGetMany(ids: Array<ComponentID>): Promise<Component[]> {\n await this.importCurrentLaneIfMissing();\n await this.scope.import(ids, { reFetchUnBuiltVersion: shouldReFetchUnBuiltVersion() });\n return this.componentLoader.getMany(ids);\n }\n\n async importCurrentLaneIfMissing() {\n const laneId = this.getCurrentLaneId();\n const laneObj = await this.scope.legacyScope.getCurrentLaneObject();\n if (laneId.isDefault() || laneObj) {\n return;\n }\n const lane = await this.getCurrentRemoteLane();\n if (!lane) {\n return;\n }\n this.logger.info(`current lane ${laneId.toString()} is missing, importing it`);\n await this.scope.legacyScope.objects.writeObjectsToTheFS([lane]);\n const scopeComponentsImporter = ScopeComponentsImporter.getInstance(this.scope.legacyScope);\n const ids = BitIds.fromArray(lane.toBitIds().filter((id) => id.hasScope()));\n await scopeComponentsImporter.importManyDeltaWithoutDeps({ ids, fromHead: true, lane });\n await scopeComponentsImporter.importMany({ ids, lanes: [lane] });\n }\n\n /**\n * @deprecated use this.track() instead\n * track a new component. (practically, add it to .bitmap).\n *\n * @param componentPaths component paths relative to the workspace dir\n * @param id if not set, will be concluded from the filenames\n * @param main if not set, will try to guess according to some strategies and throws if failed\n * @param override whether add details to an existing component or re-define it\n */\n async add(\n componentPaths: PathOsBasedRelative[],\n id?: string,\n main?: string,\n override = false\n ): Promise<AddActionResults> {\n const addComponent = new AddComponents({ consumer: this.consumer }, { componentPaths, id, main, override });\n const addResults = await addComponent.add();\n // @todo: the legacy commands have `consumer.onDestroy()` on command completion, it writes the\n // .bitmap file. workspace needs a similar mechanism. once done, remove the next line.\n await this.bitMap.write();\n return addResults;\n }\n\n async use(aspectIdStr: string): Promise<string> {\n const aspectId = await this.resolveComponentId(aspectIdStr);\n let aspectIdToAdd = aspectId.toStringWithoutVersion();\n if (!(await this.hasId(aspectId))) {\n const loadedIds = await this.scope.loadAspects([aspectIdStr], true, 'bit use command');\n if (loadedIds[0]) aspectIdToAdd = loadedIds[0];\n }\n const config = this.harmony.get<ConfigMain>('teambit.harmony/config').workspaceConfig;\n if (!config) {\n throw new Error(`use() unable to get the workspace config`);\n }\n config.setExtension(\n aspectIdToAdd,\n {},\n {\n overrideExisting: false,\n ignoreVersion: false,\n }\n );\n await config.write();\n return aspectIdToAdd;\n }\n\n /**\n * add a new component to the .bitmap file.\n * this method only adds the records in memory but doesn't persist to the filesystem.\n * to write the .bitmap file once completed, run \"await this.bitMap.write();\"\n */\n async track(trackData: TrackData): Promise<TrackResult> {\n const defaultScope = trackData.defaultScope ? await this.addOwnerToScopeName(trackData.defaultScope) : undefined;\n const addComponent = new AddComponents(\n { consumer: this.consumer },\n {\n componentPaths: [trackData.rootDir],\n id: trackData.componentName,\n main: trackData.mainFile,\n override: false,\n defaultScope,\n config: trackData.config,\n }\n );\n const result = await addComponent.add();\n const addedComponent = result.addedComponents[0];\n const componentName = addedComponent?.id.name || (trackData.componentName as string);\n const files = addedComponent?.files.map((f) => f.relativePath) || [];\n return { componentName, files, warnings: result.warnings };\n }\n\n /**\n * scopes in bit.dev are \"owner.collection\".\n * we might have the scope-name only without the owner and we need to retrieve it from the defaultScope in the\n * workspace.jsonc file.\n *\n * @param scopeName scopeName that might not have the owner part.\n * @returns full scope name\n */\n private async addOwnerToScopeName(scopeName: string): Promise<string> {\n if (scopeName.includes('.')) return scopeName; // it has owner.\n const isSelfHosted = !(await this.isHostedByBit(scopeName));\n if (isSelfHosted) return scopeName;\n const wsDefaultScope = this.defaultScope;\n if (!wsDefaultScope.includes('.')) {\n throw new Error(`the entered scope has no owner nor the defaultScope in workspace.jsonc`);\n }\n const [owner] = wsDefaultScope.split('.');\n return `${owner}.${scopeName}`;\n }\n\n async write(component: Component, rootPath?: string) {\n await Promise.all(\n component.filesystem.files.map(async (file) => {\n const pathToWrite = rootPath ? path.join(this.path, rootPath, file.relative) : file.path;\n await fs.outputFile(pathToWrite, file.contents);\n })\n );\n }\n\n /**\n * Get the component root dir in the file system (relative to workspace or full) in Linux format\n * @param componentId\n * @param relative return the path relative to the workspace or full path\n */\n componentDir(\n componentId: ComponentID,\n bitMapOptions?: GetBitMapComponentOptions,\n options = { relative: false }\n ): PathOsBased {\n return this.componentDirFromLegacyId(componentId._legacy, bitMapOptions, options);\n }\n\n /**\n * component's files in the workspace are symlinked to the node_modules, and a package.json file is generated on that\n * package directory to simulate a valid node package.\n * @returns the package directory inside the node_module.\n * by default the absolute path, unless `options.relative` was set\n */\n componentPackageDir(component: Component, options = { relative: false }): string {\n const packageName = componentIdToPackageName(component.state._consumer);\n const packageDir = path.join('node_modules', packageName);\n return options.relative ? packageDir : this.consumer.toAbsolutePath(packageDir);\n }\n\n private componentDirFromLegacyId(\n bitId: BitId,\n bitMapOptions?: GetBitMapComponentOptions,\n options = { relative: false }\n ): PathOsBased {\n const componentMap = this.consumer.bitMap.getComponent(bitId, bitMapOptions);\n const relativeComponentDir = componentMap.getComponentDir();\n if (!relativeComponentDir) {\n throw new NoComponentDir(bitId.toString());\n }\n if (options.relative) {\n return relativeComponentDir;\n }\n\n return path.join(this.path, relativeComponentDir);\n }\n\n componentDirToAbsolute(relativeComponentDir: PathOsBasedRelative): PathOsBasedAbsolute {\n return path.join(this.path, relativeComponentDir);\n }\n\n async componentDefaultScope(componentId: ComponentID): Promise<string | undefined> {\n const relativeComponentDir = this.componentDir(componentId, { ignoreVersion: true }, { relative: true });\n return this.componentDefaultScopeFromComponentDirAndName(relativeComponentDir, componentId.fullName);\n }\n\n async componentDefaultScopeFromComponentDirAndName(\n relativeComponentDir: PathOsBasedRelative,\n name: string\n ): Promise<string | undefined> {\n const componentConfigFile = await this.componentConfigFileFromComponentDirAndName(relativeComponentDir, name);\n if (componentConfigFile && componentConfigFile.defaultScope) {\n return componentConfigFile.defaultScope;\n }\n const bitMapId = this.consumer.bitMap.getExistingBitId(name);\n const bitMapEntry = bitMapId ? this.consumer.bitMap.getComponent(bitMapId) : undefined;\n if (bitMapEntry && bitMapEntry.defaultScope) {\n return bitMapEntry.defaultScope;\n }\n return this.componentDefaultScopeFromComponentDirAndNameWithoutConfigFile(relativeComponentDir, name);\n }\n\n get defaultScope() {\n return this.config.defaultScope;\n }\n\n private async componentDefaultScopeFromComponentDirAndNameWithoutConfigFile(\n relativeComponentDir: PathOsBasedRelative,\n name: string\n ): Promise<string | undefined> {\n const variantConfig = this.variants.byRootDirAndName(relativeComponentDir, name);\n if (variantConfig && variantConfig.defaultScope) {\n return variantConfig.defaultScope;\n }\n const isVendor = this.isVendorComponentByComponentDir(relativeComponentDir);\n if (!isVendor) {\n return this.config.defaultScope;\n }\n return undefined;\n }\n\n /**\n * Calculate the component config based on:\n * the config property in the .bitmap file\n * the component.json file in the component folder\n * matching pattern in the variants config\n * defaults extensions from workspace config\n * extensions from the model.\n */\n // eslint-disable-next-line complexity\n async componentExtensions(\n componentId: ComponentID,\n componentFromScope?: Component,\n excludeOrigins: ExtensionsOrigin[] = []\n ): Promise<{\n extensions: ExtensionDataList;\n beforeMerge: Array<{ extensions: ExtensionDataList; origin: ExtensionsOrigin; extraData: any }>; // useful for debugging\n }> {\n // TODO: consider caching this result\n let configFileExtensions: ExtensionDataList | undefined;\n let variantsExtensions: ExtensionDataList | undefined;\n let wsDefaultExtensions: ExtensionDataList | undefined;\n const mergeFromScope = true;\n\n const bitMapEntry = this.consumer.bitMap.getComponentIfExist(componentId._legacy);\n const bitMapExtensions = bitMapEntry?.config;\n\n const unmergedHead = this.getUnmergedHead(componentId);\n let unmergedExtensions: ExtensionDataList | undefined;\n let unmergedExtensionsSpecific: ExtensionDataList | undefined;\n let unmergedExtensionsNonSpecific: ExtensionDataList | undefined;\n if (unmergedHead) {\n const versionInstance = await this.scope.legacyScope.getVersionInstance(\n componentId._legacy.changeVersion(unmergedHead.toString())\n );\n unmergedExtensions = versionInstance.extensions;\n const [specific, nonSpecific] = partition(\n unmergedExtensions,\n (entry) => entry.config[AspectSpecificField] === true\n );\n unmergedExtensionsSpecific = new ExtensionDataList(...specific);\n unmergedExtensionsNonSpecific = new ExtensionDataList(...nonSpecific);\n }\n\n const scopeExtensions = componentFromScope?.config?.extensions || new ExtensionDataList();\n const [specific, nonSpecific] = partition(scopeExtensions, (entry) => entry.config[AspectSpecificField] === true);\n const scopeExtensionsNonSpecific = new ExtensionDataList(...nonSpecific);\n const scopeExtensionsSpecific = new ExtensionDataList(...specific);\n\n const componentConfigFile = await this.componentConfigFile(componentId);\n if (componentConfigFile) {\n configFileExtensions = componentConfigFile.aspects.toLegacy();\n }\n const relativeComponentDir = this.componentDir(componentId, { ignoreVersion: true }, { relative: true });\n const variantConfig = this.variants.byRootDirAndName(relativeComponentDir, componentId.fullName);\n if (variantConfig) {\n variantsExtensions = variantConfig.extensions.clone();\n // Do not merge from scope when there is specific variant (which is not *) that match the component\n // if (variantConfig.maxSpecificity > 0) {\n // mergeFromScope = false;\n // }\n }\n const isVendor = this.isVendorComponentByComponentDir(relativeComponentDir);\n if (!isVendor) {\n wsDefaultExtensions = this.getDefaultExtensions();\n }\n // We don't stop on each step because we want to merge the default scope even if propagate=false but the default scope is not defined\n // in the case the same extension pushed twice, the former takes precedence (opposite of Object.assign)\n const extensionsToMerge: Array<{ origin: ExtensionsOrigin; extensions: ExtensionDataList; extraData: any }> = [];\n let envWasFoundPreviously = false;\n const removedExtensionIds: string[] = [];\n\n const addExtensionsToMerge = async (extensions: ExtensionDataList, origin: ExtensionsOrigin, extraData?: any) => {\n if (!extensions.length) {\n return;\n }\n removedExtensionIds.push(...extensions.filter((extData) => extData.isRemoved).map((extData) => extData.stringId));\n const extsWithoutRemoved = extensions.filterRemovedExtensions();\n const selfInMergedExtensions = extsWithoutRemoved.findExtension(\n componentId._legacy.toStringWithoutScopeAndVersion(),\n true,\n true\n );\n const extsWithoutSelf = selfInMergedExtensions?.extensionId\n ? extsWithoutRemoved.remove(selfInMergedExtensions.extensionId)\n : extsWithoutRemoved;\n const { extensionDataListFiltered, envIsCurrentlySet } = this.filterEnvsFromExtensionsIfNeeded(\n extsWithoutSelf,\n envWasFoundPreviously\n );\n if (envIsCurrentlySet) {\n await this.warnAboutMisconfiguredEnv(componentId, extensions);\n envWasFoundPreviously = true;\n }\n\n extensionsToMerge.push({ origin, extensions: extensionDataListFiltered, extraData });\n };\n const setDataListAsSpecific = (extensions: ExtensionDataList) => {\n extensions.forEach((dataEntry) => (dataEntry.config[AspectSpecificField] = true));\n };\n if (bitMapExtensions && !excludeOrigins.includes('BitmapFile')) {\n const extensionDataList = ExtensionDataList.fromConfigObject(bitMapExtensions);\n setDataListAsSpecific(extensionDataList);\n await addExtensionsToMerge(extensionDataList, 'BitmapFile');\n }\n if (configFileExtensions && !excludeOrigins.includes('ComponentJsonFile')) {\n setDataListAsSpecific(configFileExtensions);\n await addExtensionsToMerge(configFileExtensions, 'ComponentJsonFile');\n }\n if (unmergedExtensionsSpecific && !excludeOrigins.includes('UnmergedSpecific')) {\n await addExtensionsToMerge(ExtensionDataList.fromArray(unmergedExtensionsSpecific), 'UnmergedSpecific');\n }\n if (!excludeOrigins.includes('ModelSpecific')) {\n await addExtensionsToMerge(ExtensionDataList.fromArray(scopeExtensionsSpecific), 'ModelSpecific');\n }\n let continuePropagating = componentConfigFile?.propagate ?? true;\n if (variantsExtensions && continuePropagating && !excludeOrigins.includes('WorkspaceVariants')) {\n const appliedRules = variantConfig?.sortedMatches.map(({ pattern, specificity }) => ({ pattern, specificity }));\n await addExtensionsToMerge(variantsExtensions, 'WorkspaceVariants', { appliedRules });\n }\n continuePropagating = continuePropagating && (variantConfig?.propagate ?? true);\n // Do not apply default extensions on the default extensions (it will create infinite loop when loading them)\n const isDefaultExtension = wsDefaultExtensions?.findExtension(componentId.toString(), true, true);\n if (\n wsDefaultExtensions &&\n continuePropagating &&\n !isDefaultExtension &&\n !excludeOrigins.includes('WorkspaceDefault')\n ) {\n await addExtensionsToMerge(wsDefaultExtensions, 'WorkspaceDefault');\n }\n if (\n unmergedExtensionsNonSpecific &&\n mergeFromScope &&\n continuePropagating &&\n !excludeOrigins.includes('UnmergedNonSpecific')\n ) {\n await addExtensionsToMerge(unmergedExtensionsNonSpecific, 'UnmergedNonSpecific');\n }\n if (mergeFromScope && continuePropagating && !excludeOrigins.includes('ModelNonSpecific')) {\n await addExtensionsToMerge(scopeExtensionsNonSpecific, 'ModelNonSpecific');\n }\n\n // It's important to do this resolution before the merge, otherwise we have issues with extensions\n // coming from scope with local scope name, as opposed to the same extension comes from the workspace with default scope name\n await Promise.all(extensionsToMerge.map((list) => this.resolveExtensionListIds(list.extensions)));\n const afterMerge = ExtensionDataList.mergeConfigs(extensionsToMerge.map((ext) => ext.extensions));\n await this.loadExtensions(afterMerge);\n const withoutRemoved = afterMerge.filter((extData) => !removedExtensionIds.includes(extData.stringId));\n const extensions = ExtensionDataList.fromArray(withoutRemoved);\n return {\n extensions,\n beforeMerge: extensionsToMerge,\n };\n }\n\n private getUnmergedHead(componentId: ComponentID) {\n const unmerged = this.scope.legacyScope.objects.unmergedComponents.getEntry(componentId._legacy.name);\n return unmerged?.head;\n }\n\n async getUnmergedComponent(componentId: ComponentID): Promise<Component | undefined> {\n const unmerged = this.scope.legacyScope.objects.unmergedComponents.getEntry(componentId._legacy.name);\n if (unmerged?.head) {\n return this.scope.get(componentId.changeVersion(unmerged?.head.toString()));\n }\n return undefined;\n }\n\n private async warnAboutMisconfiguredEnv(componentId: ComponentID, extensionDataList: ExtensionDataList) {\n if (!(await this.hasId(componentId))) {\n // if this is a dependency and not belong to the workspace, don't show the warning\n return;\n }\n const envAspect = extensionDataList.findExtension(EnvsAspect.id);\n const envFromEnvsAspect = envAspect?.config.env;\n if (!envFromEnvsAspect) return;\n if (this.envs.getCoreEnvsIds().includes(envFromEnvsAspect)) return;\n if (this.warnedAboutMisconfiguredEnvs.includes(envFromEnvsAspect)) return;\n let env: Component;\n try {\n const envId = await this.resolveComponentId(envFromEnvsAspect);\n env = await this.get(envId);\n } catch (err) {\n return; // unable to get the component for some reason. don't sweat it. forget about the warning\n }\n if (!this.envs.isUsingEnvEnv(env)) {\n this.warnedAboutMisconfiguredEnvs.push(envFromEnvsAspect);\n this.logger.consoleWarning(\n `env \"${envFromEnvsAspect}\" is not of type env. (correct the env's type, or component config with \"bit env set ${envFromEnvsAspect} teambit.envs/env\")`\n );\n }\n }\n\n async isModified(component: Component): Promise<boolean> {\n const head = component.head;\n if (!head) {\n return true; // it's a new component\n }\n const consumerComp = component.state._consumer as ConsumerComponent;\n if (typeof consumerComp._isModified === 'boolean') return consumerComp._isModified;\n const componentStatus = await this.consumer.getComponentStatusById(component.id._legacy);\n return componentStatus.modified === true;\n }\n\n private filterEnvsFromExtensionsIfNeeded(extensionDataList: ExtensionDataList, envWasFoundPreviously: boolean) {\n const envAspect = extensionDataList.findExtension(EnvsAspect.id);\n const envFromEnvsAspect: string | undefined = envAspect?.config.env;\n if (envWasFoundPreviously && envAspect) {\n const nonEnvs = extensionDataList.filter((e) => e.stringId !== envFromEnvsAspect);\n // still, aspect env may have other data other then config.env.\n delete envAspect.config.env;\n return { extensionDataListFiltered: new ExtensionDataList(...nonEnvs), envIsCurrentlySet: true };\n }\n return { extensionDataListFiltered: extensionDataList, envIsCurrentlySet: Boolean(envFromEnvsAspect) };\n }\n\n async triggerOnPreWatch(componentIds: ComponentID[], watchOpts: WatchOptions) {\n const components = await this.getMany(componentIds);\n const preWatchFunctions = this.onPreWatchSlot.values();\n await mapSeries(preWatchFunctions, async (func) => {\n await func(components, watchOpts);\n });\n }\n\n /**\n * filter the given component-ids and set default-scope only to the new ones.\n * returns the affected components.\n */\n async setDefaultScopeToComponents(componentIds: ComponentID[], scopeName: string): Promise<ComponentID[]> {\n if (!isValidScopeName(scopeName)) {\n throw new InvalidScopeName(scopeName);\n }\n const newComponentIds = componentIds.filter((id) => !id.hasVersion());\n if (!newComponentIds.length) {\n const compIdsStr = componentIds.map((compId) => compId.toString()).join(', ');\n throw new BitError(\n `unable to set default-scope for the following components, as they are not new:\\n${compIdsStr}`\n );\n }\n newComponentIds.map((comp) => this.bitMap.setDefaultScope(comp, scopeName));\n await this.bitMap.write();\n return newComponentIds;\n }\n\n async setDefaultScope(scopeName: string) {\n if (this.defaultScope === scopeName) {\n throw new Error(`the default-scope is already set as \"${scopeName}\", nothing to change`);\n }\n const config = this.harmony.get<ConfigMain>('teambit.harmony/config');\n config.workspaceConfig?.setExtension(\n WorkspaceAspect.id,\n { defaultScope: scopeName },\n { mergeIntoExisting: true, ignoreVersion: true }\n );\n await config.workspaceConfig?.write({ dir: path.dirname(config.workspaceConfig.path) });\n }\n\n async addSpecificComponentConfig(\n id: ComponentID,\n aspectId: string,\n config: Record<string, any> = {},\n shouldMergeWithExisting = false,\n /**\n * relevant only when writing to .bitmap.\n * eject config of the given aspect-id, so then it won't override previous config. (see \"adding prod dep, tagging then adding devDep\" e2e-test)\n */\n shouldMergeWithPrevious = false\n ) {\n const componentConfigFile = await this.componentConfigFile(id);\n if (componentConfigFile) {\n await componentConfigFile.addAspect(\n aspectId,\n config,\n this.resolveComponentId.bind(this),\n shouldMergeWithExisting\n );\n await componentConfigFile.write({ override: true });\n } else {\n if (shouldMergeWithPrevious) {\n const extensions = await this.getSpecificExtensionsFromScope(id);\n const obj = extensions.toConfigObject();\n config = obj[aspectId] ? merge(obj[aspectId], config) : config;\n }\n this.bitMap.addComponentConfig(id, aspectId, config, shouldMergeWithExisting);\n }\n }\n\n async removeSpecificComponentConfig(id: ComponentID, aspectId: string, markWithMinusIfNotExist: boolean) {\n const componentConfigFile = await this.componentConfigFile(id);\n if (componentConfigFile) {\n await componentConfigFile.removeAspect(aspectId, markWithMinusIfNotExist, this.resolveComponentId.bind(this));\n await componentConfigFile.write({ override: true });\n } else {\n this.bitMap.removeComponentConfig(id, aspectId, markWithMinusIfNotExist);\n }\n }\n\n async getAspectIdFromConfig(\n componentId: ComponentID,\n aspectIdStr: string,\n ignoreAspectVersion = false\n ): Promise<string | undefined> {\n const aspectId = await this.resolveComponentId(aspectIdStr);\n const componentConfigFile = await this.componentConfigFile(componentId);\n if (componentConfigFile) {\n const aspectEntry = componentConfigFile.aspects.find(aspectId, ignoreAspectVersion);\n return aspectEntry?.id.toString();\n }\n return this.bitMap.getAspectIdFromConfig(componentId, aspectId, ignoreAspectVersion);\n }\n\n async getSpecificComponentConfig(id: ComponentID, aspectId: string): Promise<any> {\n const componentConfigFile = await this.componentConfigFile(id);\n if (componentConfigFile) {\n return componentConfigFile.aspects.get(aspectId)?.config;\n }\n return this.bitMap.getBitmapEntry(id, { ignoreVersion: true }).config?.[aspectId];\n }\n\n /**\n * This will mutate the entries with extensionId prop to have resolved legacy id\n * This should be worked on the extension data list not the new aspect list\n * @param extensionList\n */\n private async resolveExtensionListIds(extensionList: ExtensionDataList): Promise<ExtensionDataList> {\n const promises = extensionList.map(async (entry) => {\n if (entry.extensionId) {\n const id = await this.resolveComponentId(entry.extensionId);\n entry.extensionId = id._legacy;\n }\n\n return entry;\n });\n await Promise.all(promises);\n return extensionList;\n }\n\n private isVendorComponentByComponentDir(relativeComponentDir: PathOsBasedRelative): boolean {\n const vendorDir = this.config.vendor?.directory || DEFAULT_VENDOR_DIR;\n if (pathIsInside(relativeComponentDir, vendorDir)) {\n return true;\n }\n // TODO: implement\n return false;\n }\n\n /**\n * return the component config from its folder (component.json)\n * @param componentId\n */\n public async componentConfigFile(id: ComponentID): Promise<ComponentConfigFile | undefined> {\n const relativeComponentDir = this.componentDir(id, { ignoreVersion: true }, { relative: true });\n return this.componentConfigFileFromComponentDirAndName(relativeComponentDir, id.fullName);\n }\n\n /**\n * @param componentPath can be relative or absolute. supports Linux and Windows\n */\n async getComponentIdByPath(componentPath: PathOsBased): Promise<ComponentID | undefined> {\n const relativePath = path.isAbsolute(componentPath) ? path.relative(this.path, componentPath) : componentPath;\n const linuxPath = pathNormalizeToLinux(relativePath);\n const bitId = this.consumer.bitMap.getComponentIdByPath(linuxPath);\n if (bitId) {\n return this.resolveComponentId(bitId);\n }\n return undefined;\n }\n\n private async componentConfigFileFromComponentDirAndName(\n relativeComponentDir: PathOsBasedRelative,\n name: string\n ): Promise<ComponentConfigFile | undefined> {\n let componentConfigFile;\n if (relativeComponentDir) {\n const absComponentDir = this.componentDirToAbsolute(relativeComponentDir);\n const defaultScopeFromVariantsOrWs = await this.componentDefaultScopeFromComponentDirAndNameWithoutConfigFile(\n relativeComponentDir,\n name\n );\n componentConfigFile = await ComponentConfigFile.load(\n absComponentDir,\n this.createAspectList.bind(this),\n defaultScopeFromVariantsOrWs\n );\n }\n\n return componentConfigFile;\n }\n\n async getAspectsGraphWithoutCore(components: Component[], isAspect?: ShouldLoadFunc) {\n const ids = components.map((component) => component.id);\n const coreAspectsStringIds = this.aspectLoader.getCoreAspectIds();\n // const coreAspectsComponentIds = coreAspectsStringIds.map((id) => BitId.parse(id, true));\n // const aspectsIds = components.reduce((acc, curr) => {\n // const currIds = curr.state.aspects.ids;\n // acc = acc.concat(currIds);\n // return acc;\n // }, [] as any);\n // const otherDependenciesMap = components.reduce((acc, curr) => {\n // // const currIds = curr.state.dependencies.dependencies.map(dep => dep.id.toString());\n // const currMap = curr.state.dependencies.getIdsMap();\n // Object.assign(acc, currMap);\n // return acc;\n // }, {});\n\n // const depsWhichAreNotAspects = difference(Object.keys(otherDependenciesMap), aspectsIds);\n // const depsWhichAreNotAspectsBitIds = depsWhichAreNotAspects.map((strId) => otherDependenciesMap[strId]);\n // We only want to load into the graph components which are aspects and not regular dependencies\n // This come to solve a circular loop when an env aspect use an aspect (as regular dep) and the aspect use the env aspect as its env\n // TODO: @gilad it causes many issues we need to find a better solution. removed for now.\n return this.buildOneGraphForComponents(ids, coreAspectsStringIds, isAspect);\n }\n\n /**\n * load aspects from the workspace and if not exists in the workspace, load from the scope.\n * keep in mind that the graph may have circles.\n */\n async loadAspects(ids: string[] = [], throwOnError = false, neededFor?: string): Promise<string[]> {\n // generate a random callId to be able to identify the call from the logs\n const callId = Math.floor(Math.random() * 1000);\n const loggerPrefix = `[${callId}] loadAspects,`;\n this.logger.info(`${loggerPrefix} loading ${ids.length} aspects.\nids: ${ids.join(', ')}\nneeded-for: ${neededFor || '<unknown>'}`);\n const notLoadedIds = ids.filter((id) => !this.aspectLoader.isAspectLoaded(id));\n if (!notLoadedIds.length) return [];\n const coreAspectsStringIds = this.aspectLoader.getCoreAspectIds();\n const idsWithoutCore: string[] = difference(notLoadedIds, coreAspectsStringIds);\n const componentIds = await this.resolveMultipleComponentIds(idsWithoutCore);\n const components = await this.importAndGetAspects(componentIds);\n\n const isAspect = async (id: ComponentID) => {\n const component = await this.get(id);\n const isUsingAspectEnv = this.envs.isUsingAspectEnv(component);\n const isUsingEnvEnv = this.envs.isUsingEnvEnv(component);\n const isValidAspect = isUsingAspectEnv || isUsingEnvEnv;\n // if (!isValidAspect && idsWithoutCore.includes(component.id.toString())) {\n // const data = this.envs.getEnvData(component);\n // const err = new IncorrectEnvAspect(component.id.toString(), data.type, data.id);\n // if (data.id === DEFAULT_ENV) {\n // // when cloning a project, or when the node-modules dir is deleted, nothing works and all\n // // components are default to the DEFAULT_ENV, which is node-env. we must allow \"bit\n // // install\" to prepare the workspace and let the proper the envs to be loaded\n // this.logger.error(err.message);\n // } else {\n // throw err;\n // }\n // }\n return isValidAspect;\n };\n\n const graph = await this.getAspectsGraphWithoutCore(components, isAspect);\n const aspects = graph.nodes.map((node) => node.attr);\n this.logger.debug(`${loggerPrefix} found ${aspects.length} aspects in the aspects-graph`);\n const { workspaceComps, scopeComps } = await this.groupComponentsByWorkspaceAndScope(aspects);\n this.logger.debug(\n `${loggerPrefix} found ${workspaceComps.length} components in the workspace:\\n${workspaceComps\n .map((c) => c.id.toString())\n .join('\\n')}`\n );\n this.logger.debug(\n `${loggerPrefix} ${\n scopeComps.length\n } components are not in the workspace and are loaded from the scope:\\n${scopeComps\n .map((c) => c.id.toString())\n .join('\\n')}`\n );\n const scopeIds = scopeComps.map((aspect) => aspect.id.toString());\n const workspaceAspects = await this.requireComponents(workspaceComps);\n const workspaceManifests = await this.aspectLoader.getManifestsFromRequireableExtensions(\n workspaceAspects,\n throwOnError\n );\n const potentialPluginsIndexes = compact(\n workspaceManifests.map((manifest, index) => {\n if (this.aspectLoader.isValidAspect(manifest)) return undefined;\n return index;\n })\n );\n const workspaceManifestsIds = compact(workspaceManifests.map((m) => m.id));\n // We are grouping the scope aspects by whether they are envs of something of the list or not\n // if yes, we want to load them first\n // the rest we will load together with the workspace aspects\n const scopeIdsGrouped = await this.scope.groupAspectIdsByEnvOfTheList(scopeIds);\n const scopeEnvsManifestsIds =\n scopeIdsGrouped.envs && scopeIdsGrouped.envs.length\n ? await this.scope.loadAspects(\n scopeIdsGrouped.envs,\n throwOnError,\n 'workspace.loadAspects loading scope aspects'\n )\n : [];\n const currentLane = await this.consumer.getCurrentLaneObject();\n const { manifests: scopeOtherManifests } =\n scopeIdsGrouped.other && scopeIdsGrouped.other.length\n ? await this.scope.getManifestsGraphRecursively(\n scopeIdsGrouped.other,\n compact(workspaceManifestsIds),\n throwOnError,\n currentLane || undefined,\n {\n packageManagerConfigRootDir: this.path,\n }\n )\n : { manifests: [] };\n const scopeOtherManifestsIds = compact(scopeOtherManifests.map((m) => m.id));\n\n await this.aspectLoader.loadExtensionsByManifests(\n [...scopeOtherManifests, ...workspaceManifests],\n throwOnError,\n idsWithoutCore\n );\n // Try require components for potential plugins\n const pluginsWorkspaceComps = potentialPluginsIndexes.map((index) => {\n return workspaceComps[index];\n });\n // Do the require again now that the plugins defs already registered\n const pluginsWorkspaceAspects = await this.requireComponents(pluginsWorkspaceComps);\n const pluginsWorkspaceManifests = await this.aspectLoader.getManifestsFromRequireableExtensions(\n pluginsWorkspaceAspects,\n throwOnError\n );\n await this.aspectLoader.loadExtensionsByManifests(pluginsWorkspaceManifests, throwOnError);\n this.logger.debug(`${loggerPrefix} finish loading aspects`);\n return compact(scopeEnvsManifestsIds.concat(scopeOtherManifestsIds).concat(workspaceManifestsIds));\n }\n\n /**\n * returns one graph that includes all dependencies types. each edge has a label of the dependency\n * type. the nodes content is the Component object.\n */\n async buildOneGraphForComponents(\n ids: ComponentID[],\n ignoreIds?: string[],\n shouldLoadFunc?: ShouldLoadFunc,\n shouldThrowOnMissingDep = true\n ): Promise<Graph<Component, string>> {\n const graphFromFsBuilder = new GraphFromFsBuilder(\n this,\n this.logger,\n this.dependencyResolver,\n ignoreIds,\n shouldLoadFunc,\n shouldThrowOnMissingDep\n );\n return graphFromFsBuilder.buildGraph(ids);\n }\n\n async resolveAspects(\n runtimeName?: string,\n componentIds?: ComponentID[],\n opts?: ResolveAspectsOptions\n ): Promise<AspectDefinition[]> {\n this.logger.debug(`workspace resolveAspects, runtimeName: ${runtimeName}, componentIds: ${componentIds}`);\n const defaultOpts: ResolveAspectsOptions = {\n excludeCore: false,\n requestedOnly: false,\n };\n const mergedOpts = { ...defaultOpts, ...opts };\n let missingPaths = false;\n const stringIds: string[] = [];\n const idsToResolve = componentIds ? componentIds.map((id) => id.toString()) : this.harmony.extensionsIds;\n const coreAspectsIds = this.aspectLoader.getCoreAspectIds();\n const userAspectsIds: string[] = difference(idsToResolve, coreAspectsIds);\n const componentIdsToResolve = await this.resolveMultipleComponentIds(userAspectsIds);\n const { workspaceIds, scopeIds } = await this.groupIdsByWorkspaceAndScope(componentIdsToResolve);\n const wsComponents = await this.getMany(workspaceIds);\n const aspectDefs = await this.aspectLoader.resolveAspects(wsComponents, async (component) => {\n const compStringId = component.id._legacy.toString();\n stringIds.push(compStringId);\n const localPath = this.getComponentPackagePath(component);\n const isExist = await fs.pathExists(localPath);\n if (!isExist) {\n missingPaths = true;\n }\n const runtimePath = runtimeName\n ? await this.aspectLoader.getRuntimePath(component, localPath, runtimeName)\n : null;\n\n const aspectFilePath = await this.aspectLoader.getAspectFilePath(component, localPath);\n\n this.logger.debug(\n `workspace resolveAspects, resolving id: ${compStringId}, localPath: ${localPath}, runtimePath: ${runtimePath}`\n );\n return {\n aspectPath: localPath,\n aspectFilePath,\n runtimePath,\n };\n });\n\n let scopeAspectDefs: AspectDefinition[] = [];\n if (scopeIds.length) {\n scopeAspectDefs = await this.scope.resolveAspects(runtimeName, scopeIds, mergedOpts);\n }\n\n let coreAspectDefs = await Promise.all(\n coreAspectsIds.map(async (coreId) => {\n const rawDef = await getAspectDef(coreId, runtimeName);\n return this.aspectLoader.loadDefinition(rawDef);\n })\n );\n\n // due to lack of workspace and scope runtimes. TODO: fix after adding them.\n if (runtimeName) {\n coreAspectDefs = coreAspectDefs.filter((coreAspect) => {\n return coreAspect.runtimePath;\n });\n }\n\n if (missingPaths) {\n await link(stringIds, false);\n }\n\n const allDefs = aspectDefs.concat(coreAspectDefs).concat(scopeAspectDefs);\n const ids = idsToResolve.map((idStr) => ComponentID.fromString(idStr).toStringWithoutVersion());\n const afterExclusion = mergedOpts.excludeCore\n ? allDefs.filter((def) => {\n const isCore = coreAspectDefs.find((coreId) => def.getId === coreId.getId);\n const id = ComponentID.fromString(def.getId || '');\n const isTarget = ids.includes(id.toStringWithoutVersion());\n if (isTarget) return true;\n return !isCore;\n })\n : allDefs;\n\n const uniqDefs = uniqBy(afterExclusion, (def) => `${def.aspectPath}-${def.runtimePath}`);\n let defs = uniqDefs;\n if (runtimeName) {\n defs = defs.filter((def) => def.runtimePath);\n }\n\n if (componentIds && componentIds.length && mergedOpts.requestedOnly) {\n const componentIdsString = componentIds.map((id) => id.toString());\n defs = defs.filter((def) => {\n return (\n (def.id && componentIdsString.includes(def.id)) ||\n (def.component && componentIdsString.includes(def.component?.id.toString()))\n );\n });\n }\n\n return defs;\n }\n\n private async groupIdsByWorkspaceAndScope(\n ids: ComponentID[]\n ): Promise<{ workspaceIds: ComponentID[]; scopeIds: ComponentID[] }> {\n const workspaceIds: ComponentID[] = [];\n const scopeIds: ComponentID[] = [];\n await Promise.all(\n ids.map(async (id) => {\n const existOnWorkspace = await this.hasId(id);\n existOnWorkspace ? workspaceIds.push(id) : scopeIds.push(id);\n })\n );\n return { workspaceIds, scopeIds };\n }\n\n private async groupComponentsByWorkspaceAndScope(\n components: Component[]\n ): Promise<{ workspaceComps: Component[]; scopeComps: Component[] }> {\n const workspaceComps: Component[] = [];\n const scopeComps: Component[] = [];\n await Promise.all(\n components.map(async (component) => {\n const existOnWorkspace = await this.hasId(component.id);\n existOnWorkspace ? workspaceComps.push(component) : scopeComps.push(component);\n })\n );\n return { workspaceComps, scopeComps };\n }\n\n /**\n * Load all unloaded extensions from a list\n * @param extensions list of extensions with config to load\n */\n async loadExtensions(\n extensions: ExtensionDataList,\n originatedFrom?: ComponentID,\n throwOnError = false\n ): Promise<void> {\n const extensionsIdsP = extensions.map(async (extensionEntry) => {\n // Core extension\n if (!extensionEntry.extensionId) {\n return extensionEntry.stringId as string;\n }\n\n const id = await this.resolveComponentId(extensionEntry.extensionId);\n // return this.resolveComponentId(extensionEntry.extensionId);\n return id.toString();\n });\n const extensionsIds: string[] = await Promise.all(extensionsIdsP);\n const loadedExtensions = this.harmony.extensionsIds;\n const extensionsToLoad = difference(extensionsIds, loadedExtensions);\n if (!extensionsToLoad.length) return;\n await this.loadAspects(extensionsToLoad, throwOnError, originatedFrom?.toString());\n }\n\n /**\n * Provides a cache folder, unique per key.\n * Return value may be undefined, if workspace folder is unconventional (bare-scope, no node_modules, etc)\n */\n getTempDir(\n /*\n * unique key, i.e. aspect or component id\n */\n id: string\n ) {\n const PREFIX = 'bit';\n const cacheDir = path.join(this.modulesPath, '.cache', PREFIX, id);\n\n // maybe should also check it's a folder and has write permissions\n if (!fs.existsSync(cacheDir)) {\n fs.mkdirSync(cacheDir, { recursive: true });\n }\n\n return cacheDir;\n }\n\n async requireComponents(components: Component[]): Promise<RequireableComponent[]> {\n let missingPaths = false;\n const stringIds: string[] = [];\n const resolveP = components.map(async (component) => {\n stringIds.push(component.id._legacy.toString());\n const localPath = this.getComponentPackagePath(component);\n const isExist = await fs.pathExists(localPath);\n if (!isExist) {\n missingPaths = true;\n }\n\n const requireFunc = async () => {\n const plugins = this.aspectLoader.getPlugins(component, localPath);\n if (plugins.has()) {\n return plugins.load(MainRuntime.name);\n }\n\n // eslint-disable-next-line global-require, import/no-dynamic-require\n const aspect = require(localPath);\n // require aspect runtimes\n const runtimePath = await this.aspectLoader.getRuntimePath(component, localPath, MainRuntime.name);\n // eslint-disable-next-line global-require, import/no-dynamic-require\n if (runtimePath) require(runtimePath);\n return aspect;\n };\n return new RequireableComponent(component, requireFunc);\n });\n const resolved = await Promise.all(resolveP);\n // Make sure to link missing components\n if (missingPaths) {\n await link(stringIds, false);\n }\n return resolved;\n }\n\n /**\n * whether a scope is hosted by Bit cloud.\n * otherwise, it is self-hosted\n */\n private async isHostedByBit(scopeName: string): Promise<boolean> {\n // TODO: once scope create a new API for this, replace it with the new one\n const remotes = await this.scope._legacyRemotes();\n return remotes.isHub(scopeName);\n }\n\n /**\n * same as `this.importAndGetMany()` with a specific error handling of ComponentNotFound\n */\n private async importAndGetAspects(componentIds: ComponentID[]): Promise<Component[]> {\n try {\n return await this.importAndGetMany(componentIds);\n } catch (err: any) {\n if (err instanceof ComponentNotFound) {\n const config = this.harmony.get<ConfigMain>('teambit.harmony/config');\n const configStr = JSON.stringify(config.workspaceConfig?.raw || {});\n if (configStr.includes(err.id)) {\n throw new BitError(`error: a component \"${err.id}\" was not found\nyour workspace.jsonc has this component-id set. you might want to remove/change it.`);\n }\n }\n\n throw err;\n }\n }\n\n /**\n * this should be rarely in-use.\n * it's currently used by watch extension as a quick workaround to load .bitmap and the components\n */\n async _reloadConsumer() {\n this.consumer = await loadConsumer(this.path, true);\n this.clearCache();\n }\n\n getComponentPackagePath(component: Component) {\n const relativePath = this.dependencyResolver.getRuntimeModulePath(component);\n return path.join(this.path, relativePath);\n }\n\n // TODO: should we return here the dir as it defined (aka components) or with /{name} prefix (as it used in legacy)\n get defaultDirectory(): string {\n return this.config.defaultDirectory;\n }\n\n get legacyDefaultDirectory(): string {\n if (this.defaultDirectory && !this.defaultDirectory.includes('{name}')) {\n return `${this.defaultDirectory}/{name}`;\n }\n return this.defaultDirectory;\n }\n\n /**\n * Transform the id to ComponentId and get the exact id as appear in bitmap\n *\n * @param {(string | ComponentID | BitId)} id\n * @returns {Promise<ComponentID>}\n * @memberof Workspace\n */\n async resolveComponentId(id: string | ComponentID | BitId): Promise<ComponentID> {\n const getDefaultScope = async (bitId: BitId, bitMapOptions?: GetBitMapComponentOptions) => {\n if (bitId.scope) {\n return bitId.scope;\n }\n const relativeComponentDir = this.componentDirFromLegacyId(bitId, bitMapOptions, { relative: true });\n const defaultScope = await this.componentDefaultScopeFromComponentDirAndName(\n relativeComponentDir,\n bitId.toStringWithoutScopeAndVersion()\n );\n return defaultScope;\n };\n\n // This is required in case where you have in your workspace a component with the same name as a core aspect\n // let's say you have component called react-native (which is eventually my-org.my-scope/react-native)\n // and you set teambit.react/react-native as your env\n // bit will get here with the string teambit.react/react-native and will try to resolve it from the workspace\n // during this it will find the my-org.my-scope/react-native which is incorrect as the core one doesn't exist in the\n // workspace\n if (this.aspectLoader.isCoreAspect(id.toString())) {\n return ComponentID.fromString(id.toString());\n }\n let legacyId = this.consumer.getParsedIdIfExist(id.toString(), true, true);\n if (legacyId) {\n const defaultScope = await getDefaultScope(legacyId);\n // only reason to strip the scopeName from the given id is when this id has the defaultScope, because .bitmap\n // doesn't have the defaultScope. if the given id doesn't have scope or has scope different than the default,\n // then don't ignore it. search with the scope-name.\n const shouldSearchWithoutScopeInProvidedId = id.toString().startsWith(`${defaultScope}/`);\n legacyId = this.consumer.getParsedIdIfExist(id.toString(), true, shouldSearchWithoutScopeInProvidedId);\n if (legacyId) {\n return ComponentID.fromLegacy(legacyId, defaultScope);\n }\n }\n try {\n const idWithVersion = id.toString();\n const [idWithoutVersion, version] = id.toString().split('@');\n const _bitMapId = this.consumer.getParsedIdIfExist(idWithoutVersion, false, true);\n // This logic is very specific, and very sensitive for changes please do not touch this without consulting with @ran or @gilad\n // example (partial list) cases which should be handled are:\n // use case 1 - ws component provided with the local scope name:\n // source id : my-scope1/my-name1\n // bitmap res (_id) : my-name1 (comp is tagged but not exported)\n // local scope name : my-scope1\n // scope content : my-name1\n // expected result : my-name1\n // use case 2 - component with same name exist in ws and scope (but with different scope name)\n // source id : my-scope2/my-name1\n // bitmap res (_id) : my-name1 (comp exist in ws but it's actually different component)\n // local scope name : my-scope1\n // scope content : my-scope2/my-name1\n // expected result : my-scope2/my-name1\n // use case 3 - component with same name exist in ws and scope (but with different scope name) - source provided without scope name\n // source id : my-name1\n // bitmap res (_id) : my-name1 (comp exist in ws but it's actually different component)\n // local scope name : my-scope1\n // scope content : my-scope1/my-name1 and my-scope2/my-name1\n // expected result : my-name1 (get the name from the bitmap)\n // use case 4 - component with the same name and different scope are imported into the ws\n // source id : my-name1\n // bitmap res (_id) : my-scope2/my-name1 (comp exist in ws from different scope (imported))\n // local scope name : my-scope1\n // scope content : my-scope2/my-name1\n // expected result : my-scope2/my-name1 (get the name from the bitmap)\n\n // No entry in bitmap at all, search for the original input id\n if (!_bitMapId) {\n return await this.scope.resolveComponentId(id.toString());\n }\n const _bitMapIdWithoutVersion = _bitMapId.toStringWithoutVersion();\n const _bitMapIdWithVersion = _bitMapId.changeVersion(version).toString();\n // The id in the bitmap has prefix which is not in the source id - the bitmap entry has scope name\n // Handle use case 4\n if (_bitMapIdWithoutVersion.endsWith(idWithoutVersion) && _bitMapIdWithoutVersion !== idWithoutVersion) {\n return await this.scope.resolveComponentId(_bitMapIdWithVersion);\n }\n // Handle case when I tagged the component locally with a default scope which is not the local scope\n // but not exported it yet\n // now i'm trying to load it with source id contain the default scope prefix\n // we want to get it from the local first before assuming it's something coming from outside\n if (!_bitMapId.scope) {\n const defaultScopeForBitmapId = await getDefaultScope(_bitMapId, { ignoreVersion: true });\n const getFromBitmapAddDefaultScope = () => {\n let _bitmapIdWithVersionForSource = _bitMapId;\n if (version) {\n _bitmapIdWithVersionForSource = _bitMapId.changeVersion(version);\n }\n return ComponentID.fromLegacy(_bitmapIdWithVersionForSource, defaultScopeForBitmapId);\n };\n // a case when the given id contains the default scope\n if (idWithVersion.startsWith(`${defaultScopeForBitmapId}/${_bitMapIdWithoutVersion}`)) {\n return getFromBitmapAddDefaultScope();\n }\n // a case when the given id does not contain the default scope\n const fromScope = await this.scope.resolveComponentId(idWithVersion);\n if (!fromScope._legacy.hasScope()) {\n return getFromBitmapAddDefaultScope();\n }\n }\n\n if (idWithoutVersion.endsWith(_bitMapIdWithoutVersion) && _bitMapIdWithoutVersion !== idWithoutVersion) {\n // The id in the bitmap doesn't have scope, the source id has scope\n // Handle use case 2 and use case 1\n if (id.toString().startsWith(this.scope.name)) {\n // Handle use case 1 - the provided id has scope name same as the local scope name\n // we want to send it as it appear in the bitmap\n return await this.scope.resolveComponentId(_bitMapIdWithVersion);\n }\n // Handle use case 2 - the provided id has scope which is not the local scope\n // we want to search by the source id\n return await this.scope.resolveComponentId(idWithVersion);\n }\n // Handle use case 3\n return await this.scope.resolveComponentId(idWithVersion);\n } catch (error: any) {\n legacyId = BitId.parse(id.toString(), true);\n return ComponentID.fromLegacy(legacyId);\n }\n }\n\n async resolveMultipleComponentIds(ids: Array<string | ComponentID | BitId>): Promise<ComponentID[]> {\n return Promise.all(ids.map(async (id) => this.resolveComponentId(id)));\n }\n\n /**\n * This will mutate the original extensions list and resolve it's ids\n *\n * @param {ExtensionDataList} extensions\n * @returns {Promise<void[]>}\n * @memberof Workspace\n */\n resolveExtensionsList(extensions: ExtensionDataList): Promise<void[]> {\n const resolveMergedExtensionsP = extensions.map(async (extensionEntry) => {\n if (extensionEntry.extensionId) {\n // const hasVersion = extensionEntry.extensionId.hasVersion();\n // const useBitmapVersion = !hasVersion;\n // const resolvedId = await this.resolveComponentId(extensionEntry.extensionId, true, useBitmapVersion);\n\n // Assuming extensionId always has scope - do not allow extension id without scope\n const resolvedId = await this.resolveComponentId(extensionEntry.extensionId);\n extensionEntry.extensionId = resolvedId._legacy;\n }\n });\n return Promise.all(resolveMergedExtensionsP);\n }\n\n /**\n * This will mutate the original extensions list and make sure all extensions has the ids with the scope / default scope\n *\n * @param {ExtensionDataList} extensions\n * @returns {Promise<void[]>}\n * @memberof Workspace\n */\n addDefaultScopeToExtensionsList(extensions: ExtensionDataList): Promise<void[]> {\n const resolveMergedExtensionsP = extensions.map(async (extensionEntry) => {\n if (extensionEntry.extensionId && !extensionEntry.extensionId.hasScope()) {\n const componentId = ComponentID.fromLegacy(extensionEntry.extensionId);\n const defaultScope = await this.componentDefaultScope(componentId);\n extensionEntry.extensionId = extensionEntry.extensionId.changeScope(defaultScope);\n }\n });\n return Promise.all(resolveMergedExtensionsP);\n }\n\n /**\n * configure an environment to the given components in the .bitmap file, this configuration overrides other, such as\n * overrides in workspace.jsonc.\n */\n async setEnvToComponents(envId: ComponentID, componentIds: ComponentID[]) {\n const envStrWithPossiblyVersion = await this.resolveEnvIdWithPotentialVersionForConfig(envId);\n const envIdStrNoVersion = envId.toStringWithoutVersion();\n await this.unsetEnvFromComponents(componentIds);\n await Promise.all(\n componentIds.map(async (componentId) => {\n await this.addSpecificComponentConfig(componentId, envStrWithPossiblyVersion);\n await this.addSpecificComponentConfig(componentId, EnvsAspect.id, { env: envIdStrNoVersion });\n })\n );\n await this.bitMap.write();\n }\n\n /**\n * helpful when a user provides an env-string to be set and this env has no version.\n * in the workspace config, a custom-env needs to be set with a version unless it's part of the workspace.\n * (inside envs/envs it's set without a version).\n */\n async resolveEnvIdWithPotentialVersionForConfig(envId: ComponentID): Promise<string> {\n const isCore = this.aspectLoader.isCoreAspect(envId.toStringWithoutVersion());\n const existsOnWorkspace = await this.hasId(envId);\n if (isCore || existsOnWorkspace) {\n // the env needs to be without version\n return envId.toStringWithoutVersion();\n }\n // the env must include a version\n if (envId.hasVersion()) {\n return envId.toString();\n }\n const extensions = this.harmony.get<ConfigMain>('teambit.harmony/config').extensions;\n const found = extensions?.findExtension(envId.toString(), true);\n if (found && found.extensionId?.version) {\n return found.extensionId.toString();\n }\n const comps = await this.importAndGetMany([envId]);\n return comps[0].id.toString();\n }\n\n /**\n * remove env configuration from the .bitmap file, so then other configuration, such as \"variants\" will take place\n */\n async unsetEnvFromComponents(ids: ComponentID[]): Promise<{ changed: ComponentID[]; unchanged: ComponentID[] }> {\n const changed: ComponentID[] = [];\n const unchanged: ComponentID[] = [];\n await Promise.all(\n ids.map(async (id) => {\n const envsAspect = await this.getSpecificComponentConfig(id, EnvsAspect.id);\n const currentEnv = envsAspect && envsAspect !== REMOVE_EXTENSION_SPECIAL_SIGN ? envsAspect.env : null;\n if (!currentEnv) {\n unchanged.push(id);\n return;\n }\n const currentEnvWithPotentialVersion = await this.getAspectIdFromConfig(id, currentEnv, true);\n await this.removeSpecificComponentConfig(id, currentEnvWithPotentialVersion || currentEnv, false);\n await this.removeSpecificComponentConfig(id, EnvsAspect.id, false);\n changed.push(id);\n })\n );\n await this.bitMap.write();\n return { changed, unchanged };\n }\n}\n\n/**\n * this is a super hacky way to do it. problem is that loadAspect is running as onStart hook, where we don't\n * have the CLI fully loaded yet, so we can't get the command from the CLI aspect, we have to retrieve it from\n * process.argv.\n * in general, we don't want every command to try again and again fetching un-built versions. otherwise, every time\n * Bit loads (even bit --help), it'll fetch them and slow down everything.\n * instead, long-running commands and those that need the artifacts from the Version objects, should try to re-fetch.\n */\nfunction shouldReFetchUnBuiltVersion() {\n const commandsToReFetch = ['import'];\n return commandsToReFetch.includes(process.argv[2]);\n}\n\nexport default Workspace;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAIA;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;AAWA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAKA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;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;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAA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Y,OAAO,CAACC,IAAI,CAAC,CAAC,CAAC,CAAC;AACpD;AAAC,eAEc3rB,SAAS;AAAA"}
@@ -0,0 +1,9 @@
1
+ import { BitError } from '@teambit/bit-error';
2
+
3
+ export class OutsideWorkspaceError extends BitError {
4
+ constructor() {
5
+ super(
6
+ `This command can only be run inside a bit workspace. Please check that you are inside a bit workspace and then re-run (to initialize a new workspace please use bit init)`
7
+ );
8
+ }
9
+ }
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/workspace",
3
- "version": "0.0.933",
3
+ "version": "0.0.935",
4
4
  "homepage": "https://bit.dev/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.933"
9
+ "version": "0.0.935"
10
10
  },
11
11
  "dependencies": {
12
12
  "lodash": "4.17.21",
@@ -35,48 +35,48 @@
35
35
  "@teambit/base-ui.surfaces.split-pane.split-pane": "1.0.0",
36
36
  "@teambit/bit-error": "0.0.402",
37
37
  "@teambit/component-id": "0.0.425",
38
- "@teambit/lane-id": "0.0.143",
39
- "@teambit/component": "0.0.933",
40
- "@teambit/dependency-resolver": "0.0.933",
41
- "@teambit/logger": "0.0.718",
42
- "@teambit/scope": "0.0.933",
43
- "@teambit/graph": "0.0.933",
44
- "@teambit/cli": "0.0.625",
45
- "@teambit/isolator": "0.0.933",
46
- "@teambit/component-tree": "0.0.721",
38
+ "@teambit/lane-id": "0.0.144",
39
+ "@teambit/component": "0.0.935",
40
+ "@teambit/dependency-resolver": "0.0.935",
41
+ "@teambit/logger": "0.0.719",
42
+ "@teambit/scope": "0.0.935",
43
+ "@teambit/graph": "0.0.935",
44
+ "@teambit/cli": "0.0.626",
45
+ "@teambit/isolator": "0.0.935",
46
+ "@teambit/component-tree": "0.0.723",
47
47
  "@teambit/component.ui.component-status-resolver": "0.0.503",
48
- "@teambit/lanes.hooks.use-lanes": "0.0.88",
48
+ "@teambit/lanes.hooks.use-lanes": "0.0.89",
49
49
  "@teambit/harmony.modules.resolved-component": "0.0.491",
50
- "@teambit/compiler": "0.0.933",
51
- "@teambit/graphql": "0.0.933",
52
- "@teambit/aspect-loader": "0.0.933",
53
- "@teambit/bundler": "0.0.933",
54
- "@teambit/envs": "0.0.933",
55
- "@teambit/pubsub": "0.0.933",
56
- "@teambit/ui": "0.0.933",
57
- "@teambit/variants": "0.0.730",
50
+ "@teambit/compiler": "0.0.935",
51
+ "@teambit/graphql": "0.0.935",
52
+ "@teambit/aspect-loader": "0.0.935",
53
+ "@teambit/bundler": "0.0.935",
54
+ "@teambit/envs": "0.0.935",
55
+ "@teambit/pubsub": "0.0.935",
56
+ "@teambit/ui": "0.0.935",
57
+ "@teambit/variants": "0.0.731",
58
58
  "@teambit/component-issues": "0.0.83",
59
- "@teambit/config": "0.0.638",
59
+ "@teambit/config": "0.0.639",
60
60
  "@teambit/harmony.modules.requireable-component": "0.0.491",
61
61
  "@teambit/legacy-bit-id": "0.0.421",
62
62
  "@teambit/workspace.modules.match-pattern": "0.0.498",
63
- "@teambit/component.ui.component-drawer": "0.0.182",
63
+ "@teambit/component.ui.component-drawer": "0.0.183",
64
64
  "@teambit/design.ui.tree": "0.0.15",
65
- "@teambit/lanes.hooks.use-lane-components": "0.0.87",
66
- "@teambit/ui-foundation.ui.side-bar": "0.0.699",
67
- "@teambit/command-bar": "0.0.933",
68
- "@teambit/component.ui.component-filters.component-filter-context": "0.0.57",
69
- "@teambit/component.ui.component-filters.deprecate-filter": "0.0.57",
70
- "@teambit/component.ui.component-filters.env-filter": "0.0.63",
71
- "@teambit/component.ui.component-filters.show-main-filter": "0.0.50",
72
- "@teambit/sidebar": "0.0.933",
65
+ "@teambit/lanes.hooks.use-lane-components": "0.0.88",
66
+ "@teambit/ui-foundation.ui.side-bar": "0.0.700",
67
+ "@teambit/command-bar": "0.0.935",
68
+ "@teambit/component.ui.component-filters.component-filter-context": "0.0.58",
69
+ "@teambit/component.ui.component-filters.deprecate-filter": "0.0.58",
70
+ "@teambit/component.ui.component-filters.env-filter": "0.0.64",
71
+ "@teambit/component.ui.component-filters.show-main-filter": "0.0.51",
72
+ "@teambit/sidebar": "0.0.935",
73
73
  "@teambit/ui-foundation.ui.main-dropdown": "0.0.497",
74
74
  "@teambit/ui-foundation.ui.menu": "0.0.497",
75
75
  "@teambit/ui-foundation.ui.react-router.slot-router": "0.0.501",
76
76
  "@teambit/ui-foundation.ui.tree.drawer": "0.0.510",
77
77
  "@teambit/ui-foundation.ui.hooks.use-data-query": "0.0.500",
78
- "@teambit/component-descriptor": "0.0.195",
79
- "@teambit/deprecation": "0.0.933",
78
+ "@teambit/component-descriptor": "0.0.196",
79
+ "@teambit/deprecation": "0.0.935",
80
80
  "@teambit/ui-foundation.ui.constants.z-indexes": "0.0.498",
81
81
  "@teambit/ui-foundation.ui.buttons.collapser": "0.0.206",
82
82
  "@teambit/ui-foundation.ui.corner": "0.0.507",
@@ -103,7 +103,7 @@
103
103
  "peerDependencies": {
104
104
  "react-router-dom": "^6.0.0",
105
105
  "@apollo/client": "^3.6.0",
106
- "@teambit/legacy": "1.0.406",
106
+ "@teambit/legacy": "1.0.407",
107
107
  "react": "^16.8.0 || ^17.0.0",
108
108
  "react-dom": "^16.8.0 || ^17.0.0"
109
109
  },