@teambit/workspace 1.0.1018 → 1.0.1019
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/component-loading-redesign.md +279 -0
- package/dist/component-loading-redesign.md +279 -0
- package/dist/debug-load.cmd.d.ts +53 -0
- package/dist/debug-load.cmd.js +177 -0
- package/dist/debug-load.cmd.js.map +1 -0
- package/dist/{preview-1781544183062.js → preview-1781551713034.js} +2 -2
- package/dist/ui/workspace/use-workspace.d.ts +1 -1
- package/dist/workspace-aspects-loader.d.ts +1 -0
- package/dist/workspace-aspects-loader.js +21 -7
- package/dist/workspace-aspects-loader.js.map +1 -1
- package/dist/workspace-component/workspace-component-loader.d.ts +13 -0
- package/dist/workspace-component/workspace-component-loader.js +158 -24
- package/dist/workspace-component/workspace-component-loader.js.map +1 -1
- package/dist/workspace.d.ts +19 -1
- package/dist/workspace.js +32 -1
- package/dist/workspace.js.map +1 -1
- package/dist/workspace.main.runtime.js +8 -1
- package/dist/workspace.main.runtime.js.map +1 -1
- package/package.json +38 -37
- package/workspace-component/workspace-component-loader.ts +181 -41
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_pMap","data","_interopRequireDefault","require","_legacy","_toolboxPromise","_harmonyModules","_component","_componentId","_pMapSeries","_lodash","_legacy2","_legacy3","_componentIssues","_legacy4","_dependencyResolver","_envs","_legacy5","_harmonyModules2","_workspaceComponent","_mergeConfigConflict","e","__esModule","default","ownKeys","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","WorkspaceComponentLoader","constructor","workspace","logger","dependencyResolver","envs","aspectLoader","componentsCache","createInMemoryCache","maxSize","getMaxSizeForComponents","scopeComponentsCache","componentsExtensionsCache","componentLoadedSelfAsAspects","getMany","ids","loadOpts","throwOnFailure","idsWithoutEmpty","compact","components","invalidComponents","callId","Math","floor","random","profileTrace","setStatusLine","loadOptsWithDefaults","assign","loadExtensions","executeLoadSlot","loadSeedersAsAspects","resolveExtensionsVersions","loadOrCached","idsToLoad","fromCache","id","componentFromCache","getFromCache","loadedComponents","getAndLoadSlotOrdered","err","uniqBy","comp","toString","saveInCache","idsWithEmptyStrs","map","requestedComponents","includes","toStringWithoutVersion","clearStatusLine","workspaceScopeIdsMap","groupAndUpdateIds","groupsToHandle","buildLoadGroups","process","env","BIT_LOG","printGroupsToHandle","groupsRes","mapSeries","group","index","scopeIds","workspaceIds","aspects","core","seeders","groupDesc","loadGroupToStr","Error","res","getAndLoadSlot","undefined","finalRes","reduce","acc","curr","wsIds","Array","from","values","allIds","groupedByIsCoreEnvs","groupBy","isCoreEnv","nonCoreEnvs","false","populateScopeAndExtensionsCache","allExtIds","Map","idStr","get","extensions","ext","has","stringId","newExtensionId","set","allExtCompIds","envsIdsOfWsComps","Set","envId","add","groupedByIsEnvOfWsComps","withoutVersion","split","notEnvOfWsCompsStrs","groupedByIsExtOfAnother","extIdsFromTheList","true","extsNotFromTheList","entries","layeredExtFromTheList","regroupExtIdsFromTheList","layeredExtGroups","layeredEnvsFromTheList","regroupEnvsIdsFromTheList","layeredEnvsGroups","envsOfCoreAspectEnv","coreAspectEnvGroup","filteredIds","unshift","groupsByWsScope","groupedByWsScope","envIds","envsOfEnvs","envOfEnvId","existingEnvsOfEnvs","notExistingEnvsOfEnvs","workspaceComponents","scopeComponents","getComponentsWithoutLoadExtensions","allExtensions","component","state","_consumer","mergedExtensions","ExtensionDataList","mergeConfigs","filteredMergeExtensions","idsToNotLoadAsAspects","loadComponentsExtensions","wsComponentsWithAspects","pMapPool","concurrency","concurrentComponentsLimit","warnAboutMisconfiguredEnvs","withAspects","concat","loadCompsAsAspects","loadApps","loadEnvs","loadAspects","opts","aspectIds","firstTimeToLoad","excluded","isCore","isCoreAspect","alreadyLoaded","isAspectLoaded","skipLoading","appData","appName","envsData","EnvsAspect","services","self","type","useScopeAspectsCapsule","warn","join","componentFromScope","scope","wsAspectLoader","getWorkspaceAspectsLoader","throwWsJsoncAspectNotFoundError","errors","componentExtensions","uniq","getEnvId","Promise","all","warnAboutMisconfiguredEnv","existingGroups","result","componentId","inWs","isInWsIncludeDeleted","resolvedVersions","resolveVersion","nonDeletedWsIds","listIds","deletedWsIds","locallyDeletedIds","allWsIds","find","isEqual","ignoreVersion","hasVersion","idsIndex","legacyComponents","legacyInvalidComponents","removedComponents","consumer","loadComponents","ComponentIdList","fromArray","allLegacyComponents","invalidComponent","entry","error","ConsumerComponent","isComponentInvalidByErrorType","isComponentNotExistsError","ComponentNotFoundInPath","getWithCatch","legacyComponent","catch","componentsP","pMap","changeVersion","version","console","getInvalid","longProcessLogger","createLongProcessLogger","logProgress","loadComponent","useCache","storeInCache","getOpts","resolveIdVersion","consumerComponent","getConsumerComponent","updatedId","loadOne","addMultipleEnvsIssueIfNeeded","getIfExist","bitIdWithVersion","getLatestVersionNumber","bitmapIdsFromCurrentLaneIncludeRemoved","getAllEnvsConfiguredOnComponent","issues","getOrCreate","IssuesClasses","MultipleEnvs","clearCache","deleteAll","clearComponentCache","cachesToClear","cache","cacheKey","startsWith","delete","MissingBitMapComponent","extErrorsFromCache","some","MergeConfigConflict","MergeConfigHasConflict","State","Config","createAspectList","ComponentFS","fromVinyls","files","dependencies","workspaceComponent","WorkspaceComponent","head","tags","newComponent","newComponentFromState","createComponentCacheKey","cacheKeyWithTrueLoadOpts","originatedFromHarmony","debug","name","message","ComponentNotFound","removed","calcDescriptor","skipWarnings","inInstallContext","wsDeps","modelDeps","componentFromModel","merged","Dependencies","merge","envExtendsDeps","policy","mergeVariantPolicies","config","dependenciesList","extractDepsFromLegacy","resolvedEnvJsonc","calculateEnvManifest","depResolverData","packageName","calcPackageName","serialize","componentRangePrefix","calcComponentRangePrefixByConsumerComponent","upsertExtensionData","DependencyResolverAspect","aspectListWithEnvsAndDeps","onComponentLoadSlot","toArray","extension","onLoad","upsertEntry","resolveComponentId","TagMap","existingExtension","findExtension","getDataEntry","ExtensionDataEntry","exports","relevantOpts","pick","JSON","stringify","sortKeys","obj","fromPairs","sort","k1","k2","localeCompare","loadGroup","attr"],"sources":["workspace-component-loader.ts"],"sourcesContent":["import pMap from 'p-map';\nimport { getLatestVersionNumber } from '@teambit/legacy.utils';\nimport { pMapPool } from '@teambit/toolbox.promise.map-pool';\nimport { concurrentComponentsLimit } from '@teambit/harmony.modules.concurrency';\nimport type { Component, InvalidComponent } from '@teambit/component';\nimport { ComponentFS, Config, State, TagMap } from '@teambit/component';\nimport type { ComponentID } from '@teambit/component-id';\nimport { ComponentIdList } from '@teambit/component-id';\nimport mapSeries from 'p-map-series';\nimport { compact, fromPairs, groupBy, pick, uniq, uniqBy } from 'lodash';\nimport type { ComponentLoadOptions as LegacyComponentLoadOptions } from '@teambit/legacy.consumer-component';\nimport { ComponentNotFoundInPath, ConsumerComponent, Dependencies } from '@teambit/legacy.consumer-component';\nimport { MissingBitMapComponent } from '@teambit/legacy.bit-map';\nimport { IssuesClasses } from '@teambit/component-issues';\nimport { ComponentNotFound } from '@teambit/legacy.scope';\nimport type { DependencyResolverMain } from '@teambit/dependency-resolver';\nimport { DependencyResolverAspect } from '@teambit/dependency-resolver';\nimport type { Logger } from '@teambit/logger';\nimport type { EnvsMain } from '@teambit/envs';\nimport { EnvsAspect } from '@teambit/envs';\nimport { ExtensionDataEntry, ExtensionDataList } from '@teambit/legacy.extension-data';\nimport type { InMemoryCache } from '@teambit/harmony.modules.in-memory-cache';\nimport { getMaxSizeForComponents, createInMemoryCache } from '@teambit/harmony.modules.in-memory-cache';\nimport type { AspectLoaderMain } from '@teambit/aspect-loader';\nimport type { Workspace } from '../workspace';\nimport { WorkspaceComponent } from './workspace-component';\nimport { MergeConfigConflict } from '../exceptions/merge-config-conflict';\n\ntype GetManyRes = {\n components: Component[];\n invalidComponents: InvalidComponent[];\n};\n\nexport type ComponentLoadOptions = LegacyComponentLoadOptions & {\n loadExtensions?: boolean;\n executeLoadSlot?: boolean;\n idsToNotLoadAsAspects?: string[];\n loadSeedersAsAspects?: boolean;\n resolveExtensionsVersions?: boolean;\n};\n\ntype LoadGroup = { workspaceIds: ComponentID[]; scopeIds: ComponentID[] } & LoadGroupMetadata;\ntype LoadGroupMetadata = {\n core?: boolean;\n aspects?: boolean;\n seeders?: boolean;\n envs?: boolean;\n};\n\ntype GetAndLoadSlotOpts = ComponentLoadOptions & LoadGroupMetadata;\n\ntype ComponentGetOneOptions = {\n resolveIdVersion?: boolean;\n};\n\ntype WorkspaceScopeIdsMap = {\n scopeIds: Map<string, ComponentID>;\n workspaceIds: Map<string, ComponentID>;\n};\n\nexport type LoadCompAsAspectsOptions = {\n /**\n * In case the component we are loading is app, whether to load it as app (in a scope aspects capsule)\n */\n loadApps?: boolean;\n /**\n * In case the component we are loading is env, whether to load it as env (in a scope aspects capsule)\n */\n loadEnvs?: boolean;\n\n /**\n * In case the component we are loading is a regular aspect, whether to load it as aspect (in a scope aspects capsule)\n */\n loadAspects?: boolean;\n\n idsToNotLoadAsAspects?: string[];\n\n /**\n * Are this core aspects\n */\n core?: boolean;\n\n /**\n * Are this aspects seeders of the load many operation\n */\n seeders?: boolean;\n};\n\nexport class WorkspaceComponentLoader {\n private componentsCache: InMemoryCache<Component>; // cache loaded components\n /**\n * Cache components that loaded from scope (especially for get many for perf improvements)\n */\n private scopeComponentsCache: InMemoryCache<Component>;\n /**\n * Cache extension list for components. used by get many for perf improvements.\n * And to make sure we load extensions first.\n */\n private componentsExtensionsCache: InMemoryCache<{\n extensions: ExtensionDataList;\n errors: Error[] | undefined;\n envId: string | undefined;\n }>;\n\n private componentLoadedSelfAsAspects: InMemoryCache<boolean>; // cache loaded components\n constructor(\n private workspace: Workspace,\n private logger: Logger,\n private dependencyResolver: DependencyResolverMain,\n private envs: EnvsMain,\n private aspectLoader: AspectLoaderMain\n ) {\n this.componentsCache = createInMemoryCache({ maxSize: getMaxSizeForComponents() });\n this.scopeComponentsCache = createInMemoryCache({ maxSize: getMaxSizeForComponents() });\n this.componentsExtensionsCache = createInMemoryCache({ maxSize: getMaxSizeForComponents() });\n this.componentLoadedSelfAsAspects = createInMemoryCache({ maxSize: getMaxSizeForComponents() });\n }\n\n async getMany(ids: Array<ComponentID>, loadOpts?: ComponentLoadOptions, throwOnFailure = true): Promise<GetManyRes> {\n const idsWithoutEmpty = compact(ids);\n if (!idsWithoutEmpty.length) {\n return { components: [], invalidComponents: [] };\n }\n const callId = Math.floor(Math.random() * 1000); // generate a random callId to be able to identify the call from the logs\n this.logger.profileTrace(`getMany-${callId}`);\n this.logger.setStatusLine(`loading ${ids.length} component(s)`);\n const loadOptsWithDefaults: ComponentLoadOptions = Object.assign(\n // We don't want to load extension or execute the load slot at this step\n // we will do it later\n // this important for better performance\n // We don't want to resolveExtensionsVersions as with get many we call aspect merger merge before update dependencies\n // so we will have the correct versions for extensions already and update them after will resolve wrong versions\n // in some cases\n { loadExtensions: false, executeLoadSlot: false, loadSeedersAsAspects: true, resolveExtensionsVersions: false },\n loadOpts || {}\n );\n\n const loadOrCached: { idsToLoad: ComponentID[]; fromCache: Component[] } = { idsToLoad: [], fromCache: [] };\n idsWithoutEmpty.forEach((id) => {\n const componentFromCache = this.getFromCache(id, loadOptsWithDefaults);\n if (componentFromCache) {\n loadOrCached.fromCache.push(componentFromCache);\n } else {\n loadOrCached.idsToLoad.push(id);\n }\n }, loadOrCached);\n\n const { components: loadedComponents, invalidComponents } = await this.getAndLoadSlotOrdered(\n loadOrCached.idsToLoad || [],\n loadOptsWithDefaults,\n callId\n );\n\n invalidComponents.forEach(({ err }) => {\n if (throwOnFailure) throw err;\n });\n\n const components = uniqBy([...loadedComponents, ...loadOrCached.fromCache], (comp) => {\n return comp.id.toString();\n });\n\n // this.logger.clearStatusLine();\n components.forEach((comp) => {\n this.saveInCache(comp, { loadExtensions: true, executeLoadSlot: true });\n });\n const idsWithEmptyStrs = ids.map((id) => id.toString());\n const requestedComponents = components.filter(\n (comp) =>\n idsWithEmptyStrs.includes(comp.id.toString()) || idsWithEmptyStrs.includes(comp.id.toStringWithoutVersion())\n );\n this.logger.profileTrace(`getMany-${callId}`);\n this.logger.clearStatusLine();\n return { components: requestedComponents, invalidComponents };\n }\n\n private async getAndLoadSlotOrdered(\n ids: ComponentID[],\n loadOpts: ComponentLoadOptions,\n callId = 0\n ): Promise<GetManyRes> {\n if (!ids?.length) return { components: [], invalidComponents: [] };\n\n const workspaceScopeIdsMap: WorkspaceScopeIdsMap = await this.groupAndUpdateIds(ids);\n this.logger.profileTrace('buildLoadGroups');\n const groupsToHandle = await this.buildLoadGroups(workspaceScopeIdsMap);\n this.logger.profileTrace('buildLoadGroups');\n // prefix your command with \"BIT_LOG=*\" to see the detailed groups\n if (process.env.BIT_LOG) {\n printGroupsToHandle(groupsToHandle, this.logger);\n }\n const groupsRes = compact(\n await mapSeries(groupsToHandle, async (group, index) => {\n const { scopeIds, workspaceIds, aspects, core, seeders, envs } = group;\n const groupDesc = `getMany-${callId} group ${index + 1}/${groupsToHandle.length} - ${loadGroupToStr(group)}`;\n this.logger.profileTrace(groupDesc);\n if (!workspaceIds.length && !scopeIds.length) {\n throw new Error('getAndLoadSlotOrdered - group has no ids to load');\n }\n const res = await this.getAndLoadSlot(workspaceIds, scopeIds, { ...loadOpts, core, seeders, aspects, envs });\n this.logger.profileTrace(groupDesc);\n // We don't want to return components that were not asked originally (we do want to load them)\n if (!group.seeders) return undefined;\n return res;\n })\n );\n const finalRes = groupsRes.reduce(\n (acc, curr) => {\n return {\n components: [...acc.components, ...curr.components],\n invalidComponents: [...acc.invalidComponents, ...curr.invalidComponents],\n };\n },\n { components: [], invalidComponents: [] }\n );\n return finalRes;\n }\n\n private async buildLoadGroups(workspaceScopeIdsMap: WorkspaceScopeIdsMap): Promise<Array<LoadGroup>> {\n const wsIds = Array.from(workspaceScopeIdsMap.workspaceIds.values());\n const scopeIds = Array.from(workspaceScopeIdsMap.scopeIds.values());\n const allIds = [...wsIds, ...scopeIds];\n const groupedByIsCoreEnvs = groupBy(allIds, (id) => {\n return this.envs.isCoreEnv(id.toStringWithoutVersion());\n });\n const nonCoreEnvs = groupedByIsCoreEnvs.false || [];\n await this.populateScopeAndExtensionsCache(nonCoreEnvs, workspaceScopeIdsMap);\n const allExtIds: Map<string, ComponentID> = new Map();\n nonCoreEnvs.forEach((id) => {\n const idStr = id.toString();\n const fromCache = this.componentsExtensionsCache.get(idStr);\n if (!fromCache || !fromCache.extensions) {\n return;\n }\n fromCache.extensions.forEach((ext) => {\n if (!allExtIds.has(ext.stringId) && ext.newExtensionId) {\n allExtIds.set(ext.stringId, ext.newExtensionId);\n }\n });\n });\n const allExtCompIds = Array.from(allExtIds.values());\n await this.populateScopeAndExtensionsCache(allExtCompIds || [], workspaceScopeIdsMap);\n\n // const allExtIdsStr = allExtCompIds.map((id) => id.toString());\n\n const envsIdsOfWsComps = new Set<string>();\n wsIds.forEach((id) => {\n const idStr = id.toString();\n const fromCache = this.componentsExtensionsCache.get(idStr);\n if (!fromCache || !fromCache.envId) {\n return;\n }\n const envId = fromCache.envId;\n if (envId) {\n envsIdsOfWsComps.add(envId);\n }\n });\n\n const groupedByIsEnvOfWsComps = groupBy(allExtCompIds, (id) => {\n const idStr = id.toString();\n const withoutVersion = idStr.split('@')[0];\n return envsIdsOfWsComps.has(idStr) || envsIdsOfWsComps.has(withoutVersion);\n });\n const notEnvOfWsCompsStrs = (groupedByIsEnvOfWsComps.false || []).map((id) => id.toString());\n\n const groupedByIsExtOfAnother = groupBy(nonCoreEnvs, (id) => {\n return notEnvOfWsCompsStrs.includes(id.toString());\n });\n const extIdsFromTheList = (groupedByIsExtOfAnother.true || []).map((id) => id.toString());\n const extsNotFromTheList: ComponentID[] = [];\n for (const [, id] of allExtIds.entries()) {\n if (!extIdsFromTheList.includes(id.toString())) {\n extsNotFromTheList.push(id);\n }\n }\n\n await this.groupAndUpdateIds(extsNotFromTheList, workspaceScopeIdsMap);\n\n const layeredExtFromTheList = this.regroupExtIdsFromTheList(groupedByIsExtOfAnother.true);\n const layeredExtGroups = layeredExtFromTheList.map((ids) => {\n return {\n ids,\n core: false,\n aspects: true,\n seeders: true,\n envs: false,\n };\n });\n\n const layeredEnvsFromTheList = this.regroupEnvsIdsFromTheList(groupedByIsEnvOfWsComps.true, envsIdsOfWsComps);\n const layeredEnvsGroups = layeredEnvsFromTheList.map((ids) => {\n return {\n ids,\n core: false,\n aspects: true,\n seeders: true,\n envs: true,\n };\n });\n\n const groupsToHandle = [\n // Always load first core envs\n { ids: groupedByIsCoreEnvs.true || [], core: true, aspects: true, seeders: true, envs: true },\n // { ids: groupedByIsEnvOfWsComps.true || [], core: false, aspects: true, seeders: false, envs: true },\n ...layeredEnvsGroups,\n { ids: extsNotFromTheList || [], core: false, aspects: true, seeders: false, envs: false },\n ...layeredExtGroups,\n { ids: groupedByIsExtOfAnother.false || [], core: false, aspects: false, seeders: true, envs: false },\n ];\n\n // This is a special use case mostly for the bit core repo\n const envsOfCoreAspectEnv = ['teambit.harmony/envs/core-aspect-env', 'teambit.harmony/envs/core-aspect-env-jest'];\n const coreAspectEnvGroup = { ids: [], core: true, aspects: true, seeders: true, envs: true };\n layeredEnvsGroups.forEach((group) => {\n const filteredIds = group.ids.filter((id) => envsOfCoreAspectEnv.includes(id.toStringWithoutVersion()));\n if (filteredIds.length) {\n // @ts-ignore\n coreAspectEnvGroup.ids.push(...filteredIds);\n }\n });\n if (coreAspectEnvGroup.ids.length) {\n // enter first in the list\n groupsToHandle.unshift(coreAspectEnvGroup);\n }\n // END of bit repo special use case\n\n const groupsByWsScope = groupsToHandle.map((group) => {\n if (!group.ids?.length) return undefined;\n const groupedByWsScope = groupBy(group.ids, (id) => {\n return workspaceScopeIdsMap.workspaceIds.has(id.toString());\n });\n return {\n workspaceIds: groupedByWsScope.true || [],\n scopeIds: groupedByWsScope.false || [],\n core: group.core,\n aspects: group.aspects,\n seeders: group.seeders,\n envs: group.envs,\n };\n });\n return compact(groupsByWsScope);\n }\n\n /**\n * This function will get a list of envs ids and will regroup them into two groups:\n * 1. envs that are envs of envs from the group\n * 2. other envs (envs which are just envs of regular components of the workspace)\n * For Example:\n * envsIds: [ReactEnv, NodeEnv, BitEnv]\n * The env of ReactEnv and NodeEnv is BitEnv\n * The result will be:\n * [ [BitEnv], [ReactEnv, NodeEnv] ]\n *\n * At the moment this function is not recursive, in the future we might want to make it recursive\n * @param envIds\n * @param envsIdsOfWsComps\n * @returns\n */\n private regroupEnvsIdsFromTheList(envIds: ComponentID[] = [], envsIdsOfWsComps: Set<string>): Array<ComponentID[]> {\n const envsOfEnvs = new Set<string>();\n envIds.forEach((envId) => {\n const idStr = envId.toString();\n const fromCache = this.componentsExtensionsCache.get(idStr);\n if (!fromCache || !fromCache.extensions) {\n return;\n }\n const envOfEnvId = fromCache.envId;\n if (envOfEnvId && !envsIdsOfWsComps.has(idStr)) {\n envsOfEnvs.add(envOfEnvId);\n }\n });\n const existingEnvsOfEnvs = envIds.filter(\n (id) => envsOfEnvs.has(id.toString()) || envsOfEnvs.has(id.toStringWithoutVersion())\n );\n const notExistingEnvsOfEnvs = envIds.filter(\n (id) => !envsOfEnvs.has(id.toString()) && !envsOfEnvs.has(id.toStringWithoutVersion())\n );\n return [existingEnvsOfEnvs, notExistingEnvsOfEnvs];\n }\n\n private regroupExtIdsFromTheList(ids: ComponentID[]): Array<ComponentID[]> {\n // TODO: implement this function\n // this should handle a case when you have:\n // compA that has extA and that extA has extB\n // in that case we now get the following group:\n // ids: [extA, extB]\n // while we need extB to be in a different group before extA\n return [ids];\n }\n\n private async getAndLoadSlot(\n workspaceIds: ComponentID[],\n scopeIds: ComponentID[],\n loadOpts: GetAndLoadSlotOpts\n ): Promise<GetManyRes> {\n const { workspaceComponents, scopeComponents, invalidComponents } = await this.getComponentsWithoutLoadExtensions(\n workspaceIds,\n scopeIds,\n loadOpts\n );\n\n // If we are here it means we are on workspace, in that case we don't want to load\n // aspects of scope components as aspects only aspects of workspace components\n // const components = workspaceComponents.concat(scopeComponents);\n const allExtensions: ExtensionDataList[] = workspaceComponents.map((component) => {\n return component.state._consumer.extensions;\n });\n\n // Ensure we won't load the same extension many times\n // We don't want to ignore version here, as we do want to load different extensions with same id but different versions here\n const mergedExtensions = ExtensionDataList.mergeConfigs(allExtensions, false);\n const filteredMergeExtensions = mergedExtensions.filter((ext) => {\n return !loadOpts.idsToNotLoadAsAspects?.includes(ext.stringId);\n });\n if (loadOpts.loadExtensions) {\n this.logger.profileTrace('loadComponentsExtensions');\n await this.workspace.loadComponentsExtensions(filteredMergeExtensions);\n this.logger.profileTrace('loadComponentsExtensions');\n }\n let wsComponentsWithAspects = workspaceComponents;\n // if (loadOpts.seeders) {\n this.logger.profileTrace('executeLoadSlot');\n wsComponentsWithAspects = await pMapPool(workspaceComponents, (component) => this.executeLoadSlot(component), {\n concurrency: concurrentComponentsLimit(),\n });\n this.logger.profileTrace('executeLoadSlot');\n await this.warnAboutMisconfiguredEnvs(wsComponentsWithAspects);\n // }\n\n const withAspects = wsComponentsWithAspects.concat(scopeComponents);\n\n // It's important to load the workspace components as aspects here\n // otherwise the envs from the workspace won't be loaded at time\n // so we will get wrong dependencies from component who uses envs from the workspace\n this.logger.profileTrace('loadCompsAsAspects');\n if (loadOpts.loadSeedersAsAspects || (loadOpts.core && loadOpts.aspects)) {\n await this.loadCompsAsAspects(workspaceComponents.concat(scopeComponents), {\n loadApps: true,\n loadEnvs: true,\n loadAspects: loadOpts.aspects,\n core: loadOpts.core,\n seeders: loadOpts.seeders,\n idsToNotLoadAsAspects: loadOpts.idsToNotLoadAsAspects,\n });\n }\n this.logger.profileTrace('loadCompsAsAspects');\n\n return { components: withAspects, invalidComponents };\n }\n\n // TODO: this is similar to scope.main.runtime loadCompAspects func, we should merge them.\n async loadCompsAsAspects(\n components: Component[],\n opts: LoadCompAsAspectsOptions = { loadApps: true, loadEnvs: true, loadAspects: true }\n ): Promise<void> {\n const aspectIds: string[] = [];\n components.forEach((component) => {\n const firstTimeToLoad = this.componentLoadedSelfAsAspects.get(component.id.toString()) === undefined;\n const excluded = opts.idsToNotLoadAsAspects?.includes(component.id.toString());\n const isCore = this.aspectLoader.isCoreAspect(component.id.toStringWithoutVersion());\n const alreadyLoaded = this.aspectLoader.isAspectLoaded(component.id.toString());\n const skipLoading = excluded || isCore || alreadyLoaded || !firstTimeToLoad;\n\n if (skipLoading) {\n return;\n }\n const idStr = component.id.toString();\n const appData = component.state.aspects.get('teambit.harmony/application');\n if (opts.loadApps && appData?.data?.appName) {\n aspectIds.push(idStr);\n this.componentLoadedSelfAsAspects.set(idStr, true);\n }\n const envsData = component.state.aspects.get(EnvsAspect.id);\n if (opts.loadEnvs && (envsData?.data?.services || envsData?.data?.self || envsData?.data?.type === 'env')) {\n aspectIds.push(idStr);\n this.componentLoadedSelfAsAspects.set(idStr, true);\n }\n if (opts.loadAspects && envsData?.data?.type === 'aspect') {\n aspectIds.push(idStr);\n this.componentLoadedSelfAsAspects.set(idStr, true);\n }\n });\n if (!aspectIds.length) return;\n\n try {\n await this.workspace.loadAspects(aspectIds, true, 'self loading aspects', { useScopeAspectsCapsule: true });\n } catch (err: any) {\n this.logger.warn(`failed loading components as aspects for components ${aspectIds.join(', ')}`, err);\n // we ignore that errors at the moment\n }\n }\n\n private async populateScopeAndExtensionsCache(ids: ComponentID[], workspaceScopeIdsMap: WorkspaceScopeIdsMap) {\n return mapSeries(ids, async (id) => {\n const idStr = id.toString();\n let componentFromScope;\n if (!this.scopeComponentsCache.has(idStr)) {\n try {\n // Do not import automatically if it's missing, it will throw an error later\n componentFromScope = await this.workspace.scope.get(id, undefined, false);\n if (componentFromScope) {\n this.scopeComponentsCache.set(idStr, componentFromScope);\n }\n // This is fine here, as it will be handled later in the process\n } catch (err: any) {\n const wsAspectLoader = this.workspace.getWorkspaceAspectsLoader();\n wsAspectLoader.throwWsJsoncAspectNotFoundError(err);\n this.logger.warn(`populateScopeAndExtensionsCache - failed loading component ${idStr} from scope`, err);\n }\n }\n if (!this.componentsExtensionsCache.has(idStr) && workspaceScopeIdsMap.workspaceIds.has(idStr)) {\n componentFromScope = componentFromScope || this.scopeComponentsCache.get(idStr);\n const { extensions, errors, envId } = await this.workspace.componentExtensions(\n id,\n componentFromScope,\n undefined,\n {\n loadExtensions: false,\n }\n );\n this.componentsExtensionsCache.set(idStr, { extensions, errors, envId });\n }\n });\n }\n\n private async warnAboutMisconfiguredEnvs(components: Component[]) {\n const allIds = uniq(components.map((component) => this.envs.getEnvId(component)));\n return Promise.all(allIds.map((envId) => this.workspace.warnAboutMisconfiguredEnv(envId)));\n }\n\n private async groupAndUpdateIds(\n ids: ComponentID[],\n existingGroups?: WorkspaceScopeIdsMap\n ): Promise<WorkspaceScopeIdsMap> {\n const result: WorkspaceScopeIdsMap = existingGroups || {\n scopeIds: new Map(),\n workspaceIds: new Map(),\n };\n\n await Promise.all(\n ids.map(async (componentId) => {\n const inWs = await this.isInWsIncludeDeleted(componentId);\n\n if (!inWs) {\n result.scopeIds.set(componentId.toString(), componentId);\n return undefined;\n }\n const resolvedVersions = this.resolveVersion(componentId);\n result.workspaceIds.set(resolvedVersions.toString(), resolvedVersions);\n return undefined;\n })\n );\n return result;\n }\n\n private async isInWsIncludeDeleted(componentId: ComponentID): Promise<boolean> {\n const nonDeletedWsIds = this.workspace.listIds();\n const deletedWsIds = await this.workspace.locallyDeletedIds();\n const allWsIds = nonDeletedWsIds.concat(deletedWsIds);\n const inWs = allWsIds.find((id) => id.isEqual(componentId, { ignoreVersion: !componentId.hasVersion() }));\n return !!inWs;\n }\n\n private async getComponentsWithoutLoadExtensions(\n workspaceIds: ComponentID[],\n scopeIds: ComponentID[],\n loadOpts: GetAndLoadSlotOpts\n ) {\n const invalidComponents: InvalidComponent[] = [];\n const errors: { id: ComponentID; err: Error }[] = [];\n const loadOptsWithDefaults: ComponentLoadOptions = Object.assign(\n // We don't want to load extension or execute the load slot at this step\n // we will do it later\n // this important for better performance\n // We don't want to store deps in fs cache, as at this point extensions are not loaded yet\n // so it might save a wrong deps into the cache\n { loadExtensions: false, executeLoadSlot: false },\n loadOpts || {}\n );\n\n const idsIndex = {};\n\n workspaceIds.forEach((id) => {\n idsIndex[id.toString()] = id;\n });\n this.logger.profileTrace('consumer.loadComponents');\n const {\n components: legacyComponents,\n invalidComponents: legacyInvalidComponents,\n removedComponents,\n } = await this.workspace.consumer.loadComponents(\n ComponentIdList.fromArray(workspaceIds),\n false,\n loadOptsWithDefaults\n );\n this.logger.profileTrace('consumer.loadComponents');\n const allLegacyComponents = legacyComponents.concat(removedComponents);\n legacyInvalidComponents.forEach((invalidComponent) => {\n const entry = { id: idsIndex[invalidComponent.id.toString()], err: invalidComponent.error };\n if (ConsumerComponent.isComponentInvalidByErrorType(invalidComponent.error)) {\n invalidComponents.push(entry);\n return;\n }\n if (\n this.isComponentNotExistsError(invalidComponent.error) ||\n invalidComponent.error instanceof ComponentNotFoundInPath\n ) {\n errors.push(entry);\n }\n });\n\n const getWithCatch = (id, legacyComponent) => {\n return this.get(id, legacyComponent, undefined, undefined, loadOptsWithDefaults).catch((err) => {\n if (ConsumerComponent.isComponentInvalidByErrorType(err)) {\n invalidComponents.push({\n id,\n err,\n });\n return undefined;\n }\n if (this.isComponentNotExistsError(err) || err instanceof ComponentNotFoundInPath) {\n errors.push({\n id,\n err,\n });\n return undefined;\n }\n throw err;\n });\n };\n\n // await this.getConsumerComponent(id, loadOpts)\n const componentsP = pMap(\n allLegacyComponents,\n (legacyComponent: ConsumerComponent) => {\n // const componentsP = Promise.all(\n // allLegacyComponents.map(async (legacyComponent) => {\n let id = idsIndex[legacyComponent.id.toString()];\n if (!id) {\n const withoutVersion = idsIndex[legacyComponent.id.toStringWithoutVersion()] || legacyComponent.id;\n if (withoutVersion) {\n id = withoutVersion.changeVersion(legacyComponent.id.version);\n idsIndex[legacyComponent.id.toString()] = id;\n }\n }\n return getWithCatch(id, legacyComponent);\n },\n {\n concurrency: concurrentComponentsLimit(),\n }\n );\n\n errors.forEach((err) => {\n this.logger.console(`failed loading component ${err.id.toString()}, see full error in debug.log file`);\n this.logger.warn(`failed loading component ${err.id.toString()}`, err.err);\n });\n const components: Component[] = compact(await componentsP);\n\n // Here we need to load many, otherwise we will get wrong overrides dependencies data\n // as when loading the next batch of components (next group) we won't have the envs loaded\n\n try {\n const scopeComponents = await this.workspace.scope.getMany(scopeIds);\n\n // We don't want to load envs as part of this step, they will be loaded later\n // const scopeComponents = await this.workspace.scope.loadMany(scopeIds, undefined, {\n // loadApps: false,\n // loadEnvs: true,\n // loadCompAspects: false,\n // });\n return {\n workspaceComponents: components,\n scopeComponents,\n invalidComponents,\n };\n } catch (err) {\n const wsAspectLoader = this.workspace.getWorkspaceAspectsLoader();\n wsAspectLoader.throwWsJsoncAspectNotFoundError(err);\n throw err;\n }\n }\n\n async getInvalid(ids: Array<ComponentID>): Promise<InvalidComponent[]> {\n const idsWithoutEmpty = compact(ids);\n const errors: InvalidComponent[] = [];\n const longProcessLogger = this.logger.createLongProcessLogger('loading components', ids.length);\n await mapSeries(idsWithoutEmpty, async (id: ComponentID) => {\n longProcessLogger.logProgress(id.toString());\n try {\n await this.workspace.consumer.loadComponent(id);\n } catch (err: any) {\n if (ConsumerComponent.isComponentInvalidByErrorType(err)) {\n errors.push({\n id,\n err,\n });\n return;\n }\n throw err;\n }\n });\n return errors;\n }\n\n async get(\n componentId: ComponentID,\n legacyComponent?: ConsumerComponent,\n useCache = true,\n storeInCache = true,\n loadOpts?: ComponentLoadOptions,\n getOpts: ComponentGetOneOptions = { resolveIdVersion: true }\n ): Promise<Component> {\n const loadOptsWithDefaults: ComponentLoadOptions = Object.assign(\n { loadExtensions: true, executeLoadSlot: true },\n loadOpts || {}\n );\n const id = getOpts?.resolveIdVersion ? this.resolveVersion(componentId) : componentId;\n const fromCache = this.getFromCache(id, loadOptsWithDefaults);\n if (fromCache && useCache) {\n return fromCache;\n }\n let consumerComponent = legacyComponent;\n const inWs = await this.isInWsIncludeDeleted(id);\n if (inWs && !consumerComponent) {\n consumerComponent = await this.getConsumerComponent(id, loadOptsWithDefaults);\n }\n\n // in case of out-of-sync, the id may changed during the load process\n const updatedId = consumerComponent ? consumerComponent.id : id;\n const component = await this.loadOne(updatedId, consumerComponent, loadOptsWithDefaults);\n if (storeInCache) {\n this.addMultipleEnvsIssueIfNeeded(component); // it's in storeInCache block, otherwise, it wasn't fully loaded\n this.saveInCache(component, loadOptsWithDefaults);\n }\n return component;\n }\n\n async getIfExist(componentId: ComponentID) {\n try {\n return await this.get(componentId);\n } catch (err: any) {\n if (this.isComponentNotExistsError(err)) {\n return undefined;\n }\n throw err;\n }\n }\n\n private resolveVersion(componentId: ComponentID): ComponentID {\n const bitIdWithVersion: ComponentID = getLatestVersionNumber(\n this.workspace.consumer.bitmapIdsFromCurrentLaneIncludeRemoved,\n componentId\n );\n const id = bitIdWithVersion.version ? componentId.changeVersion(bitIdWithVersion.version) : componentId;\n return id;\n }\n\n private addMultipleEnvsIssueIfNeeded(component: Component) {\n const envs = this.envs.getAllEnvsConfiguredOnComponent(component);\n const envIds = uniq(envs.map((env) => env.id));\n if (envIds.length < 2) {\n return;\n }\n component.state.issues.getOrCreate(IssuesClasses.MultipleEnvs).data = envIds;\n }\n\n clearCache() {\n this.componentsCache.deleteAll();\n this.scopeComponentsCache.deleteAll();\n this.componentsExtensionsCache.deleteAll();\n this.componentLoadedSelfAsAspects.deleteAll();\n }\n\n clearComponentCache(id: ComponentID) {\n const idStr = id.toString();\n const cachesToClear = [\n this.componentsCache,\n this.scopeComponentsCache,\n this.componentsExtensionsCache,\n this.componentLoadedSelfAsAspects,\n ];\n cachesToClear.forEach((cache) => {\n for (const cacheKey of cache.keys()) {\n if (cacheKey === idStr || cacheKey.startsWith(`${idStr}:`)) {\n cache.delete(cacheKey);\n }\n }\n });\n }\n\n private async loadOne(id: ComponentID, consumerComponent?: ConsumerComponent, loadOpts?: ComponentLoadOptions) {\n const idStr = id.toString();\n const componentFromScope = this.scopeComponentsCache.has(idStr)\n ? this.scopeComponentsCache.get(idStr)\n : await this.workspace.scope.get(id);\n if (!consumerComponent) {\n if (!componentFromScope) throw new MissingBitMapComponent(id.toString());\n return componentFromScope;\n }\n const extErrorsFromCache = this.componentsExtensionsCache.has(idStr)\n ? this.componentsExtensionsCache.get(idStr)\n : undefined;\n const { extensions, errors } =\n extErrorsFromCache ||\n (await this.workspace.componentExtensions(id, componentFromScope, undefined, {\n loadExtensions: loadOpts?.loadExtensions,\n }));\n if (errors?.some((err) => err instanceof MergeConfigConflict)) {\n consumerComponent.issues.getOrCreate(IssuesClasses.MergeConfigHasConflict).data = true;\n }\n\n // temporarily mutate consumer component extensions until we remove all direct access from legacy to extensions data\n // TODO: remove this once we remove all direct access from legacy code to extensions data\n consumerComponent.extensions = extensions;\n\n const state = new State(\n new Config(consumerComponent),\n await this.workspace.createAspectList(extensions),\n ComponentFS.fromVinyls(consumerComponent.files),\n consumerComponent.dependencies,\n consumerComponent\n );\n if (componentFromScope) {\n // Removed by @gilad. do not mutate the component from the scope\n // componentFromScope.state = state;\n // const workspaceComponent = WorkspaceComponent.fromComponent(componentFromScope, this.workspace);\n const workspaceComponent = new WorkspaceComponent(\n componentFromScope.id,\n componentFromScope.head,\n state,\n componentFromScope.tags,\n this.workspace\n );\n if (loadOpts?.executeLoadSlot) {\n return this.executeLoadSlot(workspaceComponent, loadOpts);\n }\n // const updatedComp = await this.executeLoadSlot(workspaceComponent, loadOpts);\n return workspaceComponent;\n }\n const newComponent = this.newComponentFromState(id, state);\n if (!loadOpts?.executeLoadSlot) {\n return newComponent;\n }\n return this.executeLoadSlot(newComponent, loadOpts);\n }\n\n private saveInCache(component: Component, loadOpts?: ComponentLoadOptions): void {\n const cacheKey = createComponentCacheKey(component.id, loadOpts);\n this.componentsCache.set(cacheKey, component);\n }\n\n /**\n * make sure that not only the id-str match, but also the legacy-id.\n * this is needed because the ComponentID.toString() is the same whether or not the legacy-id has\n * scope-name, as it includes the defaultScope if the scope is empty.\n * as a result, when out-of-sync is happening and the id is changed to include scope-name in the\n * legacy-id, the component is the cache has the old id.\n */\n private getFromCache(componentId: ComponentID, loadOpts?: ComponentLoadOptions): Component | undefined {\n const bitIdWithVersion: ComponentID = this.resolveVersion(componentId);\n const id = bitIdWithVersion.version ? componentId.changeVersion(bitIdWithVersion.version) : componentId;\n const cacheKey = createComponentCacheKey(id, loadOpts);\n // If we try to look for the cache without load extensions/ without execute load slot\n // but there is an entry after the load, we want to use it as well.\n // as we want the component, so if we already loaded it with everything, it's fine.\n // this sometime relevant for cases with tiny cache size (during tag)\n const cacheKeyWithTrueLoadOpts = createComponentCacheKey(id, { loadExtensions: true, executeLoadSlot: true });\n const fromCache = this.componentsCache.get(cacheKey) || this.componentsCache.get(cacheKeyWithTrueLoadOpts);\n if (fromCache && fromCache.id.isEqual(id)) {\n return fromCache;\n }\n return undefined;\n }\n\n private async getConsumerComponent(\n id: ComponentID,\n loadOpts: ComponentLoadOptions = {}\n ): Promise<ConsumerComponent | undefined> {\n loadOpts.originatedFromHarmony = true;\n try {\n const { components, removedComponents } = await this.workspace.consumer.loadComponents(\n ComponentIdList.fromArray([id]),\n true,\n loadOpts\n );\n return components?.[0] || removedComponents?.[0];\n } catch (err: any) {\n // don't return undefined for any error. otherwise, if the component is invalid (e.g. main\n // file is missing) it returns the model component later unexpectedly, or if it's new, it\n // shows MissingBitMapComponent error incorrectly.\n if (this.isComponentNotExistsError(err)) {\n this.logger.debug(\n `failed loading component \"${id.toString()}\" from the workspace due to \"${err.name}\" error\\n${err.message}`\n );\n return undefined;\n }\n throw err;\n }\n }\n\n private isComponentNotExistsError(err: Error): boolean {\n return err instanceof ComponentNotFound || err instanceof MissingBitMapComponent;\n }\n\n private async executeLoadSlot(component: Component, loadOpts?: ComponentLoadOptions) {\n if (component.state._consumer.removed) {\n // if it was soft-removed now, the component is not in the FS. loading aspects such as composition ends up with\n // errors as they try to read component files from the filesystem.\n return component;\n }\n\n // Special load events which runs from the workspace but should run from the correct aspect\n // TODO: remove this once those extensions dependent on workspace\n const envsData = await this.envs.calcDescriptor(component, { skipWarnings: !!this.workspace.inInstallContext });\n\n const wsDeps = component.state._consumer.dependencies.dependencies || [];\n const modelDeps = component.state._consumer.componentFromModel?.dependencies.dependencies || [];\n const merged = Dependencies.merge([wsDeps, modelDeps]);\n const envExtendsDeps = merged.get();\n\n // Move to deps resolver main runtime once we switch ws<> deps resolver direction\n const policy = await this.dependencyResolver.mergeVariantPolicies(\n component.config.extensions,\n component.id,\n component.state._consumer.files,\n envExtendsDeps\n );\n const dependenciesList = await this.dependencyResolver.extractDepsFromLegacy(component, policy);\n const resolvedEnvJsonc = await this.envs.calculateEnvManifest(\n component,\n component.state._consumer.files,\n envExtendsDeps\n );\n if (resolvedEnvJsonc) {\n // @ts-ignore\n envsData.resolvedEnvJsonc = resolvedEnvJsonc;\n }\n\n const depResolverData = {\n packageName: this.dependencyResolver.calcPackageName(component),\n dependencies: dependenciesList.serialize(),\n policy: policy.serialize(),\n componentRangePrefix: this.dependencyResolver.calcComponentRangePrefixByConsumerComponent(\n component.state._consumer\n ),\n };\n\n // Make sure we are adding the envs / deps data first because other on load events might depend on it\n await Promise.all([\n this.upsertExtensionData(component, EnvsAspect.id, envsData),\n this.upsertExtensionData(component, DependencyResolverAspect.id, depResolverData),\n ]);\n\n // We are updating the component state with the envs and deps data here, so in case we have other slots that depend on this data\n // they will be able to get it, as it's very common use case that during on load someone want to access to the component env for example\n const aspectListWithEnvsAndDeps = await this.workspace.createAspectList(component.state.config.extensions);\n component.state.aspects = aspectListWithEnvsAndDeps;\n\n const entries = this.workspace.onComponentLoadSlot.toArray();\n await mapSeries(entries, async ([extension, onLoad]) => {\n const data = await onLoad(component, loadOpts);\n await this.upsertExtensionData(component, extension, data);\n // Update the aspect list to have changes happened during the on load slot (new data added above)\n component.state.aspects.upsertEntry(await this.workspace.resolveComponentId(extension), data);\n });\n\n return component;\n }\n\n private newComponentFromState(id: ComponentID, state: State): Component {\n return new WorkspaceComponent(id, null, state, new TagMap(), this.workspace);\n }\n\n private async upsertExtensionData(component: Component, extension: string, data: any) {\n if (!data) return;\n const existingExtension = component.state.config.extensions.findExtension(extension);\n if (existingExtension) {\n // Only merge top level of extension data\n Object.assign(existingExtension.data, data);\n return;\n }\n component.state.config.extensions.push(await this.getDataEntry(extension, data));\n }\n\n private async getDataEntry(extension: string, data: { [key: string]: any }): Promise<ExtensionDataEntry> {\n // TODO: @gilad we need to refactor the extension data entry api.\n return new ExtensionDataEntry(undefined, undefined, extension, undefined, data);\n }\n}\n\nfunction createComponentCacheKey(id: ComponentID, loadOpts?: ComponentLoadOptions): string {\n const relevantOpts = pick(loadOpts, ['loadExtensions', 'executeLoadSlot', 'loadDocs', 'loadCompositions']);\n return `${id.toString()}:${JSON.stringify(sortKeys(relevantOpts ?? {}))}`;\n}\n\nfunction sortKeys(obj: object) {\n return fromPairs(Object.entries(obj).sort(([k1], [k2]) => k1.localeCompare(k2)));\n}\n\nfunction printGroupsToHandle(groupsToHandle: Array<LoadGroup>, logger: Logger): void {\n groupsToHandle.forEach((group) => {\n const { scopeIds, workspaceIds, aspects, core, seeders, envs } = group;\n logger.console(\n `workspace-component-loader ~ groupsToHandle ${JSON.stringify(\n {\n scopeIds: scopeIds.map((id) => id.toString()),\n workspaceIds: workspaceIds.map((id) => id.toString()),\n aspects,\n core,\n seeders,\n envs,\n },\n null,\n 2\n )}`\n );\n });\n}\n\nfunction loadGroupToStr(loadGroup: LoadGroup): string {\n const { scopeIds, workspaceIds, aspects, core, seeders, envs } = loadGroup;\n\n const attr: string[] = [];\n if (aspects) attr.push('aspects');\n if (core) attr.push('core');\n if (seeders) attr.push('seeders');\n if (envs) attr.push('envs');\n\n return `workspaceIds: ${workspaceIds.length}, scopeIds: ${scopeIds.length}, (${attr.join('+')})`;\n}\n"],"mappings":";;;;;;AAAA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,KAAA,YAAAA,CAAA;IAA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zB,IAAI3Q,OAAO,EAAE2Q,IAAI,CAACpW,IAAI,CAAC,SAAS,CAAC;EACjC,IAAI0F,IAAI,EAAE0Q,IAAI,CAACpW,IAAI,CAAC,MAAM,CAAC;EAC3B,IAAI2F,OAAO,EAAEyQ,IAAI,CAACpW,IAAI,CAAC,SAAS,CAAC;EACjC,IAAI2B,IAAI,EAAEyU,IAAI,CAACpW,IAAI,CAAC,MAAM,CAAC;EAE3B,OAAO,iBAAiBwF,YAAY,CAACpF,MAAM,eAAemF,QAAQ,CAACnF,MAAM,MAAMgW,IAAI,CAAChK,IAAI,CAAC,GAAG,CAAC,GAAG;AAClG","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_pMap","data","_interopRequireDefault","require","_legacy","_toolboxPromise","_harmonyModules","_component","_componentId","_pMapSeries","_lodash","_legacy2","_legacy3","_componentIssues","_legacy4","_dependencyResolver","_envs","_legacy5","_harmonyModules2","_harmonyModules3","_workspaceComponent","_mergeConfigConflict","e","__esModule","default","ownKeys","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","WorkspaceComponentLoader","constructor","workspace","logger","dependencyResolver","envs","aspectLoader","componentsCache","createInMemoryCache","maxSize","getMaxSizeForComponents","scopeComponentsCache","componentsExtensionsCache","componentLoadedSelfAsAspects","getMany","ids","loadOpts","throwOnFailure","idsWithoutEmpty","compact","components","invalidComponents","startOrJoinLoadTrace","span","getManyWithSpan","callId","Math","floor","random","profileTrace","setStatusLine","loadOptsWithDefaults","assign","loadExtensions","executeLoadSlot","loadSeedersAsAspects","resolveExtensionsVersions","loadOrCached","idsToLoad","fromCache","id","componentFromCache","getFromCache","setAttribute","loadedComponents","getAndLoadSlotOrdered","err","uniqBy","comp","toString","saveInCache","idsWithEmptyStrs","map","requestedComponents","includes","toStringWithoutVersion","clearStatusLine","workspaceScopeIdsMap","loadSpan","groupAndUpdateIds","groupsToHandle","buildLoadGroups","process","env","BIT_LOG","printGroupsToHandle","groupsRes","mapSeries","group","index","scopeIds","workspaceIds","aspects","core","seeders","groupStr","loadGroupToStr","groupDesc","Error","res","desc","getAndLoadSlot","undefined","finalRes","reduce","acc","curr","wsIds","Array","from","values","allIds","groupedByIsCoreEnvs","groupBy","isCoreEnv","nonCoreEnvs","false","populateScopeAndExtensionsCache","allExtIds","Map","idStr","get","extensions","ext","has","stringId","newExtensionId","set","allExtCompIds","envsIdsOfWsComps","Set","envId","add","groupedByIsEnvOfWsComps","withoutVersion","split","notEnvOfWsCompsStrs","groupedByIsExtOfAnother","extIdsFromTheList","true","extsNotFromTheList","entries","layeredExtFromTheList","regroupExtIdsFromTheList","layeredExtGroups","layeredEnvsFromTheList","regroupEnvsIdsFromTheList","layeredEnvsGroups","envsOfCoreAspectEnv","coreAspectEnvGroup","filteredIds","unshift","groupsByWsScope","groupedByWsScope","envIds","envsOfEnvs","envOfEnvId","existingEnvsOfEnvs","notExistingEnvsOfEnvs","workspaceComponents","scopeComponents","getComponentsWithoutLoadExtensions","allExtensions","component","state","_consumer","mergedExtensions","ExtensionDataList","mergeConfigs","filteredMergeExtensions","idsToNotLoadAsAspects","loadComponentsExtensions","wsComponentsWithAspects","pMapPool","concurrency","concurrentComponentsLimit","warnAboutMisconfiguredEnvs","withAspects","concat","loadCompsAsAspects","loadApps","loadEnvs","loadAspects","attachReportedLoadFailures","opts","aspectIds","firstTimeToLoad","excluded","isCore","isCoreAspect","alreadyLoaded","isAspectLoaded","skipLoading","appData","appName","envsData","EnvsAspect","services","self","type","useScopeAspectsCapsule","warn","join","inInstallContext","errMsg","message","aspectId","reportLoadFailure","failedId","phase","error","addLoadFailureIssue","consumerComponent","issue","issues","getOrCreate","IssuesClasses","LoadFailures","alreadyReported","some","entry","failures","currentLoadTrace","loadFailures","noVersion","componentIdStr","usedIds","failure","usedId","registerAggregatedLoadFailure","populateScopeAndExtensionsCacheWithSpan","scopeCacheHits","extensionsCacheHits","result","componentFromScope","scope","wsAspectLoader","getWorkspaceAspectsLoader","throwWsJsoncAspectNotFoundError","errors","componentExtensions","uniq","getEnvId","Promise","all","warnAboutMisconfiguredEnv","existingGroups","componentId","inWs","isInWsIncludeDeleted","resolvedVersions","resolveVersion","nonDeletedWsIds","listIds","deletedWsIds","locallyDeletedIds","allWsIds","find","isEqual","ignoreVersion","hasVersion","idsIndex","legacyComponents","legacyInvalidComponents","removedComponents","consumer","loadComponents","ComponentIdList","fromArray","allLegacyComponents","invalidComponent","ConsumerComponent","isComponentInvalidByErrorType","isComponentNotExistsError","ComponentNotFoundInPath","getWithCatch","legacyComponent","catch","componentsP","pMap","changeVersion","version","console","getInvalid","longProcessLogger","createLongProcessLogger","logProgress","loadComponent","useCache","storeInCache","getOpts","resolveIdVersion","getWithSpan","getConsumerComponent","updatedId","loadOne","addMultipleEnvsIssueIfNeeded","getIfExist","bitIdWithVersion","getLatestVersionNumber","bitmapIdsFromCurrentLaneIncludeRemoved","getAllEnvsConfiguredOnComponent","MultipleEnvs","clearCache","deleteAll","clearComponentCache","cachesToClear","cache","cacheKey","startsWith","delete","scopeCacheHit","MissingBitMapComponent","extErrorsFromCache","MergeConfigConflict","MergeConfigHasConflict","State","Config","createAspectList","ComponentFS","fromVinyls","files","dependencies","workspaceComponent","WorkspaceComponent","head","tags","newComponent","newComponentFromState","createComponentCacheKey","cacheKeyWithTrueLoadOpts","originatedFromHarmony","debug","name","ComponentNotFound","executeLoadSlotWithSpan","removed","calcDescriptor","skipWarnings","wsDeps","modelDeps","componentFromModel","merged","Dependencies","merge","envExtendsDeps","policy","dependenciesList","mergedPolicy","mergeVariantPolicies","config","extractDepsFromLegacy","resolvedEnvJsonc","calculateEnvManifest","depResolverData","packageName","calcPackageName","serialize","componentRangePrefix","calcComponentRangePrefixByConsumerComponent","upsertExtensionData","DependencyResolverAspect","aspectListWithEnvsAndDeps","onComponentLoadSlot","toArray","extension","onLoad","aspect","upsertEntry","resolveComponentId","TagMap","existingExtension","findExtension","getDataEntry","ExtensionDataEntry","exports","relevantOpts","pick","JSON","stringify","sortKeys","obj","fromPairs","sort","k1","k2","localeCompare","loadGroup","attr"],"sources":["workspace-component-loader.ts"],"sourcesContent":["import pMap from 'p-map';\nimport { getLatestVersionNumber } from '@teambit/legacy.utils';\nimport { pMapPool } from '@teambit/toolbox.promise.map-pool';\nimport { concurrentComponentsLimit } from '@teambit/harmony.modules.concurrency';\nimport type { Component, InvalidComponent } from '@teambit/component';\nimport { ComponentFS, Config, State, TagMap } from '@teambit/component';\nimport type { ComponentID } from '@teambit/component-id';\nimport { ComponentIdList } from '@teambit/component-id';\nimport mapSeries from 'p-map-series';\nimport { compact, fromPairs, groupBy, pick, uniq, uniqBy } from 'lodash';\nimport type { ComponentLoadOptions as LegacyComponentLoadOptions } from '@teambit/legacy.consumer-component';\nimport { ComponentNotFoundInPath, ConsumerComponent, Dependencies } from '@teambit/legacy.consumer-component';\nimport { MissingBitMapComponent } from '@teambit/legacy.bit-map';\nimport { IssuesClasses } from '@teambit/component-issues';\nimport { ComponentNotFound } from '@teambit/legacy.scope';\nimport type { DependencyResolverMain } from '@teambit/dependency-resolver';\nimport { DependencyResolverAspect } from '@teambit/dependency-resolver';\nimport type { Logger } from '@teambit/logger';\nimport type { EnvsMain } from '@teambit/envs';\nimport { EnvsAspect } from '@teambit/envs';\nimport { ExtensionDataEntry, ExtensionDataList } from '@teambit/legacy.extension-data';\nimport type { InMemoryCache } from '@teambit/harmony.modules.in-memory-cache';\nimport { getMaxSizeForComponents, createInMemoryCache } from '@teambit/harmony.modules.in-memory-cache';\nimport type { LoadSpan } from '@teambit/harmony.modules.load-trace';\nimport {\n startOrJoinLoadTrace,\n loadSpan,\n currentLoadTrace,\n reportLoadFailure,\n} from '@teambit/harmony.modules.load-trace';\nimport type { AspectLoaderMain } from '@teambit/aspect-loader';\nimport type { Workspace } from '../workspace';\nimport { WorkspaceComponent } from './workspace-component';\nimport { MergeConfigConflict } from '../exceptions/merge-config-conflict';\n\ntype GetManyRes = {\n components: Component[];\n invalidComponents: InvalidComponent[];\n};\n\nexport type ComponentLoadOptions = LegacyComponentLoadOptions & {\n loadExtensions?: boolean;\n executeLoadSlot?: boolean;\n idsToNotLoadAsAspects?: string[];\n loadSeedersAsAspects?: boolean;\n resolveExtensionsVersions?: boolean;\n};\n\ntype LoadGroup = { workspaceIds: ComponentID[]; scopeIds: ComponentID[] } & LoadGroupMetadata;\ntype LoadGroupMetadata = {\n core?: boolean;\n aspects?: boolean;\n seeders?: boolean;\n envs?: boolean;\n};\n\ntype GetAndLoadSlotOpts = ComponentLoadOptions & LoadGroupMetadata;\n\ntype ComponentGetOneOptions = {\n resolveIdVersion?: boolean;\n};\n\ntype WorkspaceScopeIdsMap = {\n scopeIds: Map<string, ComponentID>;\n workspaceIds: Map<string, ComponentID>;\n};\n\nexport type LoadCompAsAspectsOptions = {\n /**\n * In case the component we are loading is app, whether to load it as app (in a scope aspects capsule)\n */\n loadApps?: boolean;\n /**\n * In case the component we are loading is env, whether to load it as env (in a scope aspects capsule)\n */\n loadEnvs?: boolean;\n\n /**\n * In case the component we are loading is a regular aspect, whether to load it as aspect (in a scope aspects capsule)\n */\n loadAspects?: boolean;\n\n idsToNotLoadAsAspects?: string[];\n\n /**\n * Are this core aspects\n */\n core?: boolean;\n\n /**\n * Are this aspects seeders of the load many operation\n */\n seeders?: boolean;\n};\n\nexport class WorkspaceComponentLoader {\n private componentsCache: InMemoryCache<Component>; // cache loaded components\n /**\n * Cache components that loaded from scope (especially for get many for perf improvements)\n */\n private scopeComponentsCache: InMemoryCache<Component>;\n /**\n * Cache extension list for components. used by get many for perf improvements.\n * And to make sure we load extensions first.\n */\n private componentsExtensionsCache: InMemoryCache<{\n extensions: ExtensionDataList;\n errors: Error[] | undefined;\n envId: string | undefined;\n }>;\n\n private componentLoadedSelfAsAspects: InMemoryCache<boolean>; // cache loaded components\n constructor(\n private workspace: Workspace,\n private logger: Logger,\n private dependencyResolver: DependencyResolverMain,\n private envs: EnvsMain,\n private aspectLoader: AspectLoaderMain\n ) {\n this.componentsCache = createInMemoryCache({ maxSize: getMaxSizeForComponents() });\n this.scopeComponentsCache = createInMemoryCache({ maxSize: getMaxSizeForComponents() });\n this.componentsExtensionsCache = createInMemoryCache({ maxSize: getMaxSizeForComponents() });\n this.componentLoadedSelfAsAspects = createInMemoryCache({ maxSize: getMaxSizeForComponents() });\n }\n\n async getMany(ids: Array<ComponentID>, loadOpts?: ComponentLoadOptions, throwOnFailure = true): Promise<GetManyRes> {\n const idsWithoutEmpty = compact(ids);\n if (!idsWithoutEmpty.length) {\n return { components: [], invalidComponents: [] };\n }\n return startOrJoinLoadTrace('workspace.getMany', { ids: idsWithoutEmpty.length }, (span) =>\n this.getManyWithSpan(idsWithoutEmpty, span, loadOpts, throwOnFailure)\n );\n }\n\n private async getManyWithSpan(\n idsWithoutEmpty: Array<ComponentID>,\n span: LoadSpan,\n loadOpts?: ComponentLoadOptions,\n throwOnFailure = true\n ): Promise<GetManyRes> {\n const callId = Math.floor(Math.random() * 1000); // generate a random callId to be able to identify the call from the logs\n this.logger.profileTrace(`getMany-${callId}`);\n this.logger.setStatusLine(`loading ${idsWithoutEmpty.length} component(s)`);\n const loadOptsWithDefaults: ComponentLoadOptions = Object.assign(\n // We don't want to load extension or execute the load slot at this step\n // we will do it later\n // this important for better performance\n // We don't want to resolveExtensionsVersions as with get many we call aspect merger merge before update dependencies\n // so we will have the correct versions for extensions already and update them after will resolve wrong versions\n // in some cases\n { loadExtensions: false, executeLoadSlot: false, loadSeedersAsAspects: true, resolveExtensionsVersions: false },\n loadOpts || {}\n );\n\n const loadOrCached: { idsToLoad: ComponentID[]; fromCache: Component[] } = { idsToLoad: [], fromCache: [] };\n idsWithoutEmpty.forEach((id) => {\n const componentFromCache = this.getFromCache(id, loadOptsWithDefaults);\n if (componentFromCache) {\n loadOrCached.fromCache.push(componentFromCache);\n } else {\n loadOrCached.idsToLoad.push(id);\n }\n }, loadOrCached);\n\n span.setAttribute('componentsCache:hits', loadOrCached.fromCache.length);\n span.setAttribute('componentsCache:misses', loadOrCached.idsToLoad.length);\n const { components: loadedComponents, invalidComponents } = await this.getAndLoadSlotOrdered(\n loadOrCached.idsToLoad || [],\n loadOptsWithDefaults,\n callId\n );\n\n invalidComponents.forEach(({ err }) => {\n if (throwOnFailure) throw err;\n });\n\n const components = uniqBy([...loadedComponents, ...loadOrCached.fromCache], (comp) => {\n return comp.id.toString();\n });\n\n // this.logger.clearStatusLine();\n components.forEach((comp) => {\n this.saveInCache(comp, { loadExtensions: true, executeLoadSlot: true });\n });\n const idsWithEmptyStrs = idsWithoutEmpty.map((id) => id.toString());\n const requestedComponents = components.filter(\n (comp) =>\n idsWithEmptyStrs.includes(comp.id.toString()) || idsWithEmptyStrs.includes(comp.id.toStringWithoutVersion())\n );\n this.logger.profileTrace(`getMany-${callId}`);\n this.logger.clearStatusLine();\n return { components: requestedComponents, invalidComponents };\n }\n\n private async getAndLoadSlotOrdered(\n ids: ComponentID[],\n loadOpts: ComponentLoadOptions,\n callId = 0\n ): Promise<GetManyRes> {\n if (!ids?.length) return { components: [], invalidComponents: [] };\n\n const workspaceScopeIdsMap: WorkspaceScopeIdsMap = await loadSpan('id-resolution', { ids: ids.length }, () =>\n this.groupAndUpdateIds(ids)\n );\n this.logger.profileTrace('buildLoadGroups');\n const groupsToHandle = await loadSpan('build-load-groups', {}, () => this.buildLoadGroups(workspaceScopeIdsMap));\n this.logger.profileTrace('buildLoadGroups');\n // prefix your command with \"BIT_LOG=*\" to see the detailed groups\n if (process.env.BIT_LOG) {\n printGroupsToHandle(groupsToHandle, this.logger);\n }\n const groupsRes = compact(\n await mapSeries(groupsToHandle, async (group, index) => {\n const { scopeIds, workspaceIds, aspects, core, seeders, envs } = group;\n const groupStr = loadGroupToStr(group);\n const groupDesc = `getMany-${callId} group ${index + 1}/${groupsToHandle.length} - ${groupStr}`;\n this.logger.profileTrace(groupDesc);\n if (!workspaceIds.length && !scopeIds.length) {\n throw new Error('getAndLoadSlotOrdered - group has no ids to load');\n }\n const res = await loadSpan(\n 'load-group',\n { group: `${index + 1}/${groupsToHandle.length}`, desc: groupStr },\n () => this.getAndLoadSlot(workspaceIds, scopeIds, { ...loadOpts, core, seeders, aspects, envs })\n );\n this.logger.profileTrace(groupDesc);\n // We don't want to return components that were not asked originally (we do want to load them)\n if (!group.seeders) return undefined;\n return res;\n })\n );\n const finalRes = groupsRes.reduce(\n (acc, curr) => {\n return {\n components: [...acc.components, ...curr.components],\n invalidComponents: [...acc.invalidComponents, ...curr.invalidComponents],\n };\n },\n { components: [], invalidComponents: [] }\n );\n return finalRes;\n }\n\n private async buildLoadGroups(workspaceScopeIdsMap: WorkspaceScopeIdsMap): Promise<Array<LoadGroup>> {\n const wsIds = Array.from(workspaceScopeIdsMap.workspaceIds.values());\n const scopeIds = Array.from(workspaceScopeIdsMap.scopeIds.values());\n const allIds = [...wsIds, ...scopeIds];\n const groupedByIsCoreEnvs = groupBy(allIds, (id) => {\n return this.envs.isCoreEnv(id.toStringWithoutVersion());\n });\n const nonCoreEnvs = groupedByIsCoreEnvs.false || [];\n await this.populateScopeAndExtensionsCache(nonCoreEnvs, workspaceScopeIdsMap);\n const allExtIds: Map<string, ComponentID> = new Map();\n nonCoreEnvs.forEach((id) => {\n const idStr = id.toString();\n const fromCache = this.componentsExtensionsCache.get(idStr);\n if (!fromCache || !fromCache.extensions) {\n return;\n }\n fromCache.extensions.forEach((ext) => {\n if (!allExtIds.has(ext.stringId) && ext.newExtensionId) {\n allExtIds.set(ext.stringId, ext.newExtensionId);\n }\n });\n });\n const allExtCompIds = Array.from(allExtIds.values());\n await this.populateScopeAndExtensionsCache(allExtCompIds || [], workspaceScopeIdsMap);\n\n // const allExtIdsStr = allExtCompIds.map((id) => id.toString());\n\n const envsIdsOfWsComps = new Set<string>();\n wsIds.forEach((id) => {\n const idStr = id.toString();\n const fromCache = this.componentsExtensionsCache.get(idStr);\n if (!fromCache || !fromCache.envId) {\n return;\n }\n const envId = fromCache.envId;\n if (envId) {\n envsIdsOfWsComps.add(envId);\n }\n });\n\n const groupedByIsEnvOfWsComps = groupBy(allExtCompIds, (id) => {\n const idStr = id.toString();\n const withoutVersion = idStr.split('@')[0];\n return envsIdsOfWsComps.has(idStr) || envsIdsOfWsComps.has(withoutVersion);\n });\n const notEnvOfWsCompsStrs = (groupedByIsEnvOfWsComps.false || []).map((id) => id.toString());\n\n const groupedByIsExtOfAnother = groupBy(nonCoreEnvs, (id) => {\n return notEnvOfWsCompsStrs.includes(id.toString());\n });\n const extIdsFromTheList = (groupedByIsExtOfAnother.true || []).map((id) => id.toString());\n const extsNotFromTheList: ComponentID[] = [];\n for (const [, id] of allExtIds.entries()) {\n if (!extIdsFromTheList.includes(id.toString())) {\n extsNotFromTheList.push(id);\n }\n }\n\n await this.groupAndUpdateIds(extsNotFromTheList, workspaceScopeIdsMap);\n\n const layeredExtFromTheList = this.regroupExtIdsFromTheList(groupedByIsExtOfAnother.true);\n const layeredExtGroups = layeredExtFromTheList.map((ids) => {\n return {\n ids,\n core: false,\n aspects: true,\n seeders: true,\n envs: false,\n };\n });\n\n const layeredEnvsFromTheList = this.regroupEnvsIdsFromTheList(groupedByIsEnvOfWsComps.true, envsIdsOfWsComps);\n const layeredEnvsGroups = layeredEnvsFromTheList.map((ids) => {\n return {\n ids,\n core: false,\n aspects: true,\n seeders: true,\n envs: true,\n };\n });\n\n const groupsToHandle = [\n // Always load first core envs\n { ids: groupedByIsCoreEnvs.true || [], core: true, aspects: true, seeders: true, envs: true },\n // { ids: groupedByIsEnvOfWsComps.true || [], core: false, aspects: true, seeders: false, envs: true },\n ...layeredEnvsGroups,\n { ids: extsNotFromTheList || [], core: false, aspects: true, seeders: false, envs: false },\n ...layeredExtGroups,\n { ids: groupedByIsExtOfAnother.false || [], core: false, aspects: false, seeders: true, envs: false },\n ];\n\n // This is a special use case mostly for the bit core repo\n const envsOfCoreAspectEnv = ['teambit.harmony/envs/core-aspect-env', 'teambit.harmony/envs/core-aspect-env-jest'];\n const coreAspectEnvGroup = { ids: [], core: true, aspects: true, seeders: true, envs: true };\n layeredEnvsGroups.forEach((group) => {\n const filteredIds = group.ids.filter((id) => envsOfCoreAspectEnv.includes(id.toStringWithoutVersion()));\n if (filteredIds.length) {\n // @ts-ignore\n coreAspectEnvGroup.ids.push(...filteredIds);\n }\n });\n if (coreAspectEnvGroup.ids.length) {\n // enter first in the list\n groupsToHandle.unshift(coreAspectEnvGroup);\n }\n // END of bit repo special use case\n\n const groupsByWsScope = groupsToHandle.map((group) => {\n if (!group.ids?.length) return undefined;\n const groupedByWsScope = groupBy(group.ids, (id) => {\n return workspaceScopeIdsMap.workspaceIds.has(id.toString());\n });\n return {\n workspaceIds: groupedByWsScope.true || [],\n scopeIds: groupedByWsScope.false || [],\n core: group.core,\n aspects: group.aspects,\n seeders: group.seeders,\n envs: group.envs,\n };\n });\n return compact(groupsByWsScope);\n }\n\n /**\n * This function will get a list of envs ids and will regroup them into two groups:\n * 1. envs that are envs of envs from the group\n * 2. other envs (envs which are just envs of regular components of the workspace)\n * For Example:\n * envsIds: [ReactEnv, NodeEnv, BitEnv]\n * The env of ReactEnv and NodeEnv is BitEnv\n * The result will be:\n * [ [BitEnv], [ReactEnv, NodeEnv] ]\n *\n * At the moment this function is not recursive, in the future we might want to make it recursive\n * @param envIds\n * @param envsIdsOfWsComps\n * @returns\n */\n private regroupEnvsIdsFromTheList(envIds: ComponentID[] = [], envsIdsOfWsComps: Set<string>): Array<ComponentID[]> {\n const envsOfEnvs = new Set<string>();\n envIds.forEach((envId) => {\n const idStr = envId.toString();\n const fromCache = this.componentsExtensionsCache.get(idStr);\n if (!fromCache || !fromCache.extensions) {\n return;\n }\n const envOfEnvId = fromCache.envId;\n if (envOfEnvId && !envsIdsOfWsComps.has(idStr)) {\n envsOfEnvs.add(envOfEnvId);\n }\n });\n const existingEnvsOfEnvs = envIds.filter(\n (id) => envsOfEnvs.has(id.toString()) || envsOfEnvs.has(id.toStringWithoutVersion())\n );\n const notExistingEnvsOfEnvs = envIds.filter(\n (id) => !envsOfEnvs.has(id.toString()) && !envsOfEnvs.has(id.toStringWithoutVersion())\n );\n return [existingEnvsOfEnvs, notExistingEnvsOfEnvs];\n }\n\n private regroupExtIdsFromTheList(ids: ComponentID[]): Array<ComponentID[]> {\n // TODO: implement this function\n // this should handle a case when you have:\n // compA that has extA and that extA has extB\n // in that case we now get the following group:\n // ids: [extA, extB]\n // while we need extB to be in a different group before extA\n return [ids];\n }\n\n private async getAndLoadSlot(\n workspaceIds: ComponentID[],\n scopeIds: ComponentID[],\n loadOpts: GetAndLoadSlotOpts\n ): Promise<GetManyRes> {\n const { workspaceComponents, scopeComponents, invalidComponents } = await this.getComponentsWithoutLoadExtensions(\n workspaceIds,\n scopeIds,\n loadOpts\n );\n\n // If we are here it means we are on workspace, in that case we don't want to load\n // aspects of scope components as aspects only aspects of workspace components\n // const components = workspaceComponents.concat(scopeComponents);\n const allExtensions: ExtensionDataList[] = workspaceComponents.map((component) => {\n return component.state._consumer.extensions;\n });\n\n // Ensure we won't load the same extension many times\n // We don't want to ignore version here, as we do want to load different extensions with same id but different versions here\n const mergedExtensions = ExtensionDataList.mergeConfigs(allExtensions, false);\n const filteredMergeExtensions = mergedExtensions.filter((ext) => {\n return !loadOpts.idsToNotLoadAsAspects?.includes(ext.stringId);\n });\n if (loadOpts.loadExtensions) {\n this.logger.profileTrace('loadComponentsExtensions');\n await loadSpan('load-components-extensions', { extensions: filteredMergeExtensions.length }, () =>\n this.workspace.loadComponentsExtensions(filteredMergeExtensions)\n );\n this.logger.profileTrace('loadComponentsExtensions');\n }\n let wsComponentsWithAspects = workspaceComponents;\n // if (loadOpts.seeders) {\n this.logger.profileTrace('executeLoadSlot');\n wsComponentsWithAspects = await pMapPool(workspaceComponents, (component) => this.executeLoadSlot(component), {\n concurrency: concurrentComponentsLimit(),\n });\n this.logger.profileTrace('executeLoadSlot');\n await this.warnAboutMisconfiguredEnvs(wsComponentsWithAspects);\n // }\n\n const withAspects = wsComponentsWithAspects.concat(scopeComponents);\n\n // It's important to load the workspace components as aspects here\n // otherwise the envs from the workspace won't be loaded at time\n // so we will get wrong dependencies from component who uses envs from the workspace\n this.logger.profileTrace('loadCompsAsAspects');\n if (loadOpts.loadSeedersAsAspects || (loadOpts.core && loadOpts.aspects)) {\n await loadSpan('load-comps-as-aspects', { components: workspaceComponents.length + scopeComponents.length }, () =>\n this.loadCompsAsAspects(workspaceComponents.concat(scopeComponents), {\n loadApps: true,\n loadEnvs: true,\n loadAspects: loadOpts.aspects,\n core: loadOpts.core,\n seeders: loadOpts.seeders,\n idsToNotLoadAsAspects: loadOpts.idsToNotLoadAsAspects,\n })\n );\n }\n this.logger.profileTrace('loadCompsAsAspects');\n\n this.attachReportedLoadFailures(withAspects);\n\n return { components: withAspects, invalidComponents };\n }\n\n // TODO: this is similar to scope.main.runtime loadCompAspects func, we should merge them.\n async loadCompsAsAspects(\n components: Component[],\n opts: LoadCompAsAspectsOptions = { loadApps: true, loadEnvs: true, loadAspects: true }\n ): Promise<void> {\n const aspectIds: string[] = [];\n components.forEach((component) => {\n const firstTimeToLoad = this.componentLoadedSelfAsAspects.get(component.id.toString()) === undefined;\n const excluded = opts.idsToNotLoadAsAspects?.includes(component.id.toString());\n const isCore = this.aspectLoader.isCoreAspect(component.id.toStringWithoutVersion());\n const alreadyLoaded = this.aspectLoader.isAspectLoaded(component.id.toString());\n const skipLoading = excluded || isCore || alreadyLoaded || !firstTimeToLoad;\n\n if (skipLoading) {\n return;\n }\n const idStr = component.id.toString();\n const appData = component.state.aspects.get('teambit.harmony/application');\n if (opts.loadApps && appData?.data?.appName) {\n aspectIds.push(idStr);\n this.componentLoadedSelfAsAspects.set(idStr, true);\n }\n const envsData = component.state.aspects.get(EnvsAspect.id);\n if (opts.loadEnvs && (envsData?.data?.services || envsData?.data?.self || envsData?.data?.type === 'env')) {\n aspectIds.push(idStr);\n this.componentLoadedSelfAsAspects.set(idStr, true);\n }\n if (opts.loadAspects && envsData?.data?.type === 'aspect') {\n aspectIds.push(idStr);\n this.componentLoadedSelfAsAspects.set(idStr, true);\n }\n });\n if (!aspectIds.length) return;\n\n try {\n await this.workspace.loadAspects(aspectIds, true, 'self loading aspects', { useScopeAspectsCapsule: true });\n } catch (err: any) {\n this.logger.warn(`failed loading components as aspects for components ${aspectIds.join(', ')}`, err);\n // the error is not thrown (best-effort loading), but it's surfaced as a component issue\n // so it shows up in \"bit status\" instead of disappearing.\n if (!this.workspace.inInstallContext) {\n const errMsg = err.message || String(err);\n aspectIds.forEach((aspectId) => {\n reportLoadFailure({ failedId: aspectId, phase: 'load-comps-as-aspects', error: errMsg });\n });\n components.forEach((component) => {\n if (!aspectIds.includes(component.id.toString())) return;\n this.addLoadFailureIssue(component, component.id.toString(), 'load-comps-as-aspects', errMsg);\n });\n }\n }\n }\n\n private addLoadFailureIssue(component: Component, failedId: string, phase: string, error: string) {\n const consumerComponent = component.state._consumer;\n if (!consumerComponent) return;\n const issue = component.state.issues.getOrCreate(IssuesClasses.LoadFailures);\n const alreadyReported = issue.data.some((entry) => entry.failedId === failedId && entry.phase === phase);\n if (!alreadyReported) issue.data.push({ failedId, phase, error });\n }\n\n /**\n * surface load failures that were reported to the active trace by deep loader code (e.g. aspect\n * require failures in the scope loader). the failing component itself gets a per-component\n * issue. components merely *using* the failed aspect/env are aggregated into a single\n * workspace-level issue — one failing env may be used by 100 components, and attaching the\n * issue to each of them would flood \"bit status\".\n */\n private attachReportedLoadFailures(components: Component[]) {\n if (this.workspace.inInstallContext) return;\n const failures = currentLoadTrace()?.loadFailures;\n if (!failures?.length) return;\n const noVersion = (id: string) => id.split('@')[0];\n components.forEach((component) => {\n const componentIdStr = component.id.toString();\n const usedIds: string[] = component.state._consumer\n ? component.state._consumer.extensions.map((ext) => ext.stringId)\n : [];\n // the env may be set via the EnvsAspect config rather than as a direct extension entry, in\n // which case its id won't appear in the extensions list above. include it explicitly so a\n // failure loading that env still gets aggregated to this component.\n const envId = component.state.aspects.get(EnvsAspect.id)?.data?.id;\n if (envId) usedIds.push(envId);\n failures.forEach((failure) => {\n if (noVersion(failure.failedId) === noVersion(componentIdStr)) {\n this.addLoadFailureIssue(component, failure.failedId, failure.phase, failure.error);\n return;\n }\n if (usedIds.some((usedId) => noVersion(usedId) === noVersion(failure.failedId))) {\n this.workspace.registerAggregatedLoadFailure(failure, componentIdStr);\n }\n });\n });\n }\n\n private async populateScopeAndExtensionsCache(ids: ComponentID[], workspaceScopeIdsMap: WorkspaceScopeIdsMap) {\n return loadSpan('populate-scope-and-extensions-cache', { ids: ids.length }, (span) =>\n this.populateScopeAndExtensionsCacheWithSpan(ids, workspaceScopeIdsMap, span)\n );\n }\n\n private async populateScopeAndExtensionsCacheWithSpan(\n ids: ComponentID[],\n workspaceScopeIdsMap: WorkspaceScopeIdsMap,\n span: LoadSpan\n ) {\n let scopeCacheHits = 0;\n let extensionsCacheHits = 0;\n const result = await mapSeries(ids, async (id) => {\n const idStr = id.toString();\n let componentFromScope;\n if (this.scopeComponentsCache.has(idStr)) scopeCacheHits += 1;\n if (this.componentsExtensionsCache.has(idStr)) extensionsCacheHits += 1;\n if (!this.scopeComponentsCache.has(idStr)) {\n try {\n // Do not import automatically if it's missing, it will throw an error later\n componentFromScope = await this.workspace.scope.get(id, undefined, false);\n if (componentFromScope) {\n this.scopeComponentsCache.set(idStr, componentFromScope);\n }\n // This is fine here, as it will be handled later in the process\n } catch (err: any) {\n const wsAspectLoader = this.workspace.getWorkspaceAspectsLoader();\n wsAspectLoader.throwWsJsoncAspectNotFoundError(err);\n this.logger.warn(`populateScopeAndExtensionsCache - failed loading component ${idStr} from scope`, err);\n }\n }\n if (!this.componentsExtensionsCache.has(idStr) && workspaceScopeIdsMap.workspaceIds.has(idStr)) {\n componentFromScope = componentFromScope || this.scopeComponentsCache.get(idStr);\n const { extensions, errors, envId } = await this.workspace.componentExtensions(\n id,\n componentFromScope,\n undefined,\n {\n loadExtensions: false,\n }\n );\n this.componentsExtensionsCache.set(idStr, { extensions, errors, envId });\n }\n });\n span.setAttribute('scopeComponentsCache:hits', scopeCacheHits);\n span.setAttribute('scopeComponentsCache:misses', ids.length - scopeCacheHits);\n span.setAttribute('componentsExtensionsCache:hits', extensionsCacheHits);\n return result;\n }\n\n private async warnAboutMisconfiguredEnvs(components: Component[]) {\n const allIds = uniq(components.map((component) => this.envs.getEnvId(component)));\n return Promise.all(allIds.map((envId) => this.workspace.warnAboutMisconfiguredEnv(envId)));\n }\n\n private async groupAndUpdateIds(\n ids: ComponentID[],\n existingGroups?: WorkspaceScopeIdsMap\n ): Promise<WorkspaceScopeIdsMap> {\n const result: WorkspaceScopeIdsMap = existingGroups || {\n scopeIds: new Map(),\n workspaceIds: new Map(),\n };\n\n await Promise.all(\n ids.map(async (componentId) => {\n const inWs = await this.isInWsIncludeDeleted(componentId);\n\n if (!inWs) {\n result.scopeIds.set(componentId.toString(), componentId);\n return undefined;\n }\n const resolvedVersions = this.resolveVersion(componentId);\n result.workspaceIds.set(resolvedVersions.toString(), resolvedVersions);\n return undefined;\n })\n );\n return result;\n }\n\n private async isInWsIncludeDeleted(componentId: ComponentID): Promise<boolean> {\n const nonDeletedWsIds = this.workspace.listIds();\n const deletedWsIds = await this.workspace.locallyDeletedIds();\n const allWsIds = nonDeletedWsIds.concat(deletedWsIds);\n const inWs = allWsIds.find((id) => id.isEqual(componentId, { ignoreVersion: !componentId.hasVersion() }));\n return !!inWs;\n }\n\n private async getComponentsWithoutLoadExtensions(\n workspaceIds: ComponentID[],\n scopeIds: ComponentID[],\n loadOpts: GetAndLoadSlotOpts\n ) {\n const invalidComponents: InvalidComponent[] = [];\n const errors: { id: ComponentID; err: Error }[] = [];\n const loadOptsWithDefaults: ComponentLoadOptions = Object.assign(\n // We don't want to load extension or execute the load slot at this step\n // we will do it later\n // this important for better performance\n // We don't want to store deps in fs cache, as at this point extensions are not loaded yet\n // so it might save a wrong deps into the cache\n { loadExtensions: false, executeLoadSlot: false },\n loadOpts || {}\n );\n\n const idsIndex = {};\n\n workspaceIds.forEach((id) => {\n idsIndex[id.toString()] = id;\n });\n this.logger.profileTrace('consumer.loadComponents');\n const {\n components: legacyComponents,\n invalidComponents: legacyInvalidComponents,\n removedComponents,\n } = await loadSpan('consumer-fs-load', { ids: workspaceIds.length }, () =>\n this.workspace.consumer.loadComponents(ComponentIdList.fromArray(workspaceIds), false, loadOptsWithDefaults)\n );\n this.logger.profileTrace('consumer.loadComponents');\n const allLegacyComponents = legacyComponents.concat(removedComponents);\n legacyInvalidComponents.forEach((invalidComponent) => {\n const entry = { id: idsIndex[invalidComponent.id.toString()], err: invalidComponent.error };\n if (ConsumerComponent.isComponentInvalidByErrorType(invalidComponent.error)) {\n invalidComponents.push(entry);\n return;\n }\n if (\n this.isComponentNotExistsError(invalidComponent.error) ||\n invalidComponent.error instanceof ComponentNotFoundInPath\n ) {\n errors.push(entry);\n }\n });\n\n const getWithCatch = (id, legacyComponent) => {\n return this.get(id, legacyComponent, undefined, undefined, loadOptsWithDefaults).catch((err) => {\n if (ConsumerComponent.isComponentInvalidByErrorType(err)) {\n invalidComponents.push({\n id,\n err,\n });\n return undefined;\n }\n if (this.isComponentNotExistsError(err) || err instanceof ComponentNotFoundInPath) {\n errors.push({\n id,\n err,\n });\n return undefined;\n }\n throw err;\n });\n };\n\n // await this.getConsumerComponent(id, loadOpts)\n const componentsP = pMap(\n allLegacyComponents,\n (legacyComponent: ConsumerComponent) => {\n // const componentsP = Promise.all(\n // allLegacyComponents.map(async (legacyComponent) => {\n let id = idsIndex[legacyComponent.id.toString()];\n if (!id) {\n const withoutVersion = idsIndex[legacyComponent.id.toStringWithoutVersion()] || legacyComponent.id;\n if (withoutVersion) {\n id = withoutVersion.changeVersion(legacyComponent.id.version);\n idsIndex[legacyComponent.id.toString()] = id;\n }\n }\n return getWithCatch(id, legacyComponent);\n },\n {\n concurrency: concurrentComponentsLimit(),\n }\n );\n\n errors.forEach((err) => {\n this.logger.console(`failed loading component ${err.id.toString()}, see full error in debug.log file`);\n this.logger.warn(`failed loading component ${err.id.toString()}`, err.err);\n });\n const components: Component[] = compact(await componentsP);\n\n // Here we need to load many, otherwise we will get wrong overrides dependencies data\n // as when loading the next batch of components (next group) we won't have the envs loaded\n\n try {\n const scopeComponents = await loadSpan('scope-load', { ids: scopeIds.length }, () =>\n this.workspace.scope.getMany(scopeIds)\n );\n\n // We don't want to load envs as part of this step, they will be loaded later\n // const scopeComponents = await this.workspace.scope.loadMany(scopeIds, undefined, {\n // loadApps: false,\n // loadEnvs: true,\n // loadCompAspects: false,\n // });\n return {\n workspaceComponents: components,\n scopeComponents,\n invalidComponents,\n };\n } catch (err) {\n const wsAspectLoader = this.workspace.getWorkspaceAspectsLoader();\n wsAspectLoader.throwWsJsoncAspectNotFoundError(err);\n throw err;\n }\n }\n\n async getInvalid(ids: Array<ComponentID>): Promise<InvalidComponent[]> {\n const idsWithoutEmpty = compact(ids);\n const errors: InvalidComponent[] = [];\n const longProcessLogger = this.logger.createLongProcessLogger('loading components', ids.length);\n await mapSeries(idsWithoutEmpty, async (id: ComponentID) => {\n longProcessLogger.logProgress(id.toString());\n try {\n await this.workspace.consumer.loadComponent(id);\n } catch (err: any) {\n if (ConsumerComponent.isComponentInvalidByErrorType(err)) {\n errors.push({\n id,\n err,\n });\n return;\n }\n throw err;\n }\n });\n return errors;\n }\n\n async get(\n componentId: ComponentID,\n legacyComponent?: ConsumerComponent,\n useCache = true,\n storeInCache = true,\n loadOpts?: ComponentLoadOptions,\n getOpts: ComponentGetOneOptions = { resolveIdVersion: true }\n ): Promise<Component> {\n return startOrJoinLoadTrace('workspace.get', { id: componentId.toString() }, (span) =>\n this.getWithSpan(componentId, span, legacyComponent, useCache, storeInCache, loadOpts, getOpts)\n );\n }\n\n private async getWithSpan(\n componentId: ComponentID,\n span: LoadSpan,\n legacyComponent?: ConsumerComponent,\n useCache = true,\n storeInCache = true,\n loadOpts?: ComponentLoadOptions,\n getOpts: ComponentGetOneOptions = { resolveIdVersion: true }\n ): Promise<Component> {\n const loadOptsWithDefaults: ComponentLoadOptions = Object.assign(\n { loadExtensions: true, executeLoadSlot: true },\n loadOpts || {}\n );\n const id = getOpts?.resolveIdVersion ? this.resolveVersion(componentId) : componentId;\n const fromCache = this.getFromCache(id, loadOptsWithDefaults);\n if (fromCache && useCache) {\n span.setAttribute('componentsCache', 'hit');\n return fromCache;\n }\n span.setAttribute('componentsCache', 'miss');\n let consumerComponent = legacyComponent;\n const inWs = await this.isInWsIncludeDeleted(id);\n if (inWs && !consumerComponent) {\n consumerComponent = await loadSpan('consumer-fs-load', { id: id.toString() }, () =>\n this.getConsumerComponent(id, loadOptsWithDefaults)\n );\n }\n\n // in case of out-of-sync, the id may changed during the load process\n const updatedId = consumerComponent ? consumerComponent.id : id;\n const component = await this.loadOne(updatedId, consumerComponent, loadOptsWithDefaults);\n this.attachReportedLoadFailures([component]);\n if (storeInCache) {\n this.addMultipleEnvsIssueIfNeeded(component); // it's in storeInCache block, otherwise, it wasn't fully loaded\n this.saveInCache(component, loadOptsWithDefaults);\n }\n return component;\n }\n\n async getIfExist(componentId: ComponentID) {\n try {\n return await this.get(componentId);\n } catch (err: any) {\n if (this.isComponentNotExistsError(err)) {\n return undefined;\n }\n throw err;\n }\n }\n\n private resolveVersion(componentId: ComponentID): ComponentID {\n const bitIdWithVersion: ComponentID = getLatestVersionNumber(\n this.workspace.consumer.bitmapIdsFromCurrentLaneIncludeRemoved,\n componentId\n );\n const id = bitIdWithVersion.version ? componentId.changeVersion(bitIdWithVersion.version) : componentId;\n return id;\n }\n\n private addMultipleEnvsIssueIfNeeded(component: Component) {\n const envs = this.envs.getAllEnvsConfiguredOnComponent(component);\n const envIds = uniq(envs.map((env) => env.id));\n if (envIds.length < 2) {\n return;\n }\n component.state.issues.getOrCreate(IssuesClasses.MultipleEnvs).data = envIds;\n }\n\n clearCache() {\n this.componentsCache.deleteAll();\n this.scopeComponentsCache.deleteAll();\n this.componentsExtensionsCache.deleteAll();\n this.componentLoadedSelfAsAspects.deleteAll();\n }\n\n clearComponentCache(id: ComponentID) {\n const idStr = id.toString();\n const cachesToClear = [\n this.componentsCache,\n this.scopeComponentsCache,\n this.componentsExtensionsCache,\n this.componentLoadedSelfAsAspects,\n ];\n cachesToClear.forEach((cache) => {\n for (const cacheKey of cache.keys()) {\n if (cacheKey === idStr || cacheKey.startsWith(`${idStr}:`)) {\n cache.delete(cacheKey);\n }\n }\n });\n }\n\n private async loadOne(id: ComponentID, consumerComponent?: ConsumerComponent, loadOpts?: ComponentLoadOptions) {\n const idStr = id.toString();\n const scopeCacheHit = this.scopeComponentsCache.has(idStr);\n const componentFromScope = scopeCacheHit\n ? this.scopeComponentsCache.get(idStr)\n : await loadSpan('scope-load', { id: idStr }, () => this.workspace.scope.get(id));\n if (!consumerComponent) {\n if (!componentFromScope) throw new MissingBitMapComponent(id.toString());\n return componentFromScope;\n }\n const extErrorsFromCache = this.componentsExtensionsCache.has(idStr)\n ? this.componentsExtensionsCache.get(idStr)\n : undefined;\n const { extensions, errors } =\n extErrorsFromCache ||\n (await loadSpan(\n 'extension-merge',\n { id: idStr, scopeComponentsCache: scopeCacheHit ? 'hit' : 'miss', componentsExtensionsCache: 'miss' },\n () =>\n this.workspace.componentExtensions(id, componentFromScope, undefined, {\n loadExtensions: loadOpts?.loadExtensions,\n })\n ));\n if (errors?.some((err) => err instanceof MergeConfigConflict)) {\n consumerComponent.issues.getOrCreate(IssuesClasses.MergeConfigHasConflict).data = true;\n }\n\n // temporarily mutate consumer component extensions until we remove all direct access from legacy to extensions data\n // TODO: remove this once we remove all direct access from legacy code to extensions data\n consumerComponent.extensions = extensions;\n\n const state = new State(\n new Config(consumerComponent),\n await this.workspace.createAspectList(extensions),\n ComponentFS.fromVinyls(consumerComponent.files),\n consumerComponent.dependencies,\n consumerComponent\n );\n if (componentFromScope) {\n // Removed by @gilad. do not mutate the component from the scope\n // componentFromScope.state = state;\n // const workspaceComponent = WorkspaceComponent.fromComponent(componentFromScope, this.workspace);\n const workspaceComponent = new WorkspaceComponent(\n componentFromScope.id,\n componentFromScope.head,\n state,\n componentFromScope.tags,\n this.workspace\n );\n if (loadOpts?.executeLoadSlot) {\n return this.executeLoadSlot(workspaceComponent, loadOpts);\n }\n // const updatedComp = await this.executeLoadSlot(workspaceComponent, loadOpts);\n return workspaceComponent;\n }\n const newComponent = this.newComponentFromState(id, state);\n if (!loadOpts?.executeLoadSlot) {\n return newComponent;\n }\n return this.executeLoadSlot(newComponent, loadOpts);\n }\n\n private saveInCache(component: Component, loadOpts?: ComponentLoadOptions): void {\n const cacheKey = createComponentCacheKey(component.id, loadOpts);\n this.componentsCache.set(cacheKey, component);\n }\n\n /**\n * make sure that not only the id-str match, but also the legacy-id.\n * this is needed because the ComponentID.toString() is the same whether or not the legacy-id has\n * scope-name, as it includes the defaultScope if the scope is empty.\n * as a result, when out-of-sync is happening and the id is changed to include scope-name in the\n * legacy-id, the component is the cache has the old id.\n */\n private getFromCache(componentId: ComponentID, loadOpts?: ComponentLoadOptions): Component | undefined {\n const bitIdWithVersion: ComponentID = this.resolveVersion(componentId);\n const id = bitIdWithVersion.version ? componentId.changeVersion(bitIdWithVersion.version) : componentId;\n const cacheKey = createComponentCacheKey(id, loadOpts);\n // If we try to look for the cache without load extensions/ without execute load slot\n // but there is an entry after the load, we want to use it as well.\n // as we want the component, so if we already loaded it with everything, it's fine.\n // this sometime relevant for cases with tiny cache size (during tag)\n const cacheKeyWithTrueLoadOpts = createComponentCacheKey(id, { loadExtensions: true, executeLoadSlot: true });\n const fromCache = this.componentsCache.get(cacheKey) || this.componentsCache.get(cacheKeyWithTrueLoadOpts);\n if (fromCache && fromCache.id.isEqual(id)) {\n return fromCache;\n }\n return undefined;\n }\n\n private async getConsumerComponent(\n id: ComponentID,\n loadOpts: ComponentLoadOptions = {}\n ): Promise<ConsumerComponent | undefined> {\n loadOpts.originatedFromHarmony = true;\n try {\n const { components, removedComponents } = await this.workspace.consumer.loadComponents(\n ComponentIdList.fromArray([id]),\n true,\n loadOpts\n );\n return components?.[0] || removedComponents?.[0];\n } catch (err: any) {\n // don't return undefined for any error. otherwise, if the component is invalid (e.g. main\n // file is missing) it returns the model component later unexpectedly, or if it's new, it\n // shows MissingBitMapComponent error incorrectly.\n if (this.isComponentNotExistsError(err)) {\n this.logger.debug(\n `failed loading component \"${id.toString()}\" from the workspace due to \"${err.name}\" error\\n${err.message}`\n );\n return undefined;\n }\n throw err;\n }\n }\n\n private isComponentNotExistsError(err: Error): boolean {\n return err instanceof ComponentNotFound || err instanceof MissingBitMapComponent;\n }\n\n private async executeLoadSlot(component: Component, loadOpts?: ComponentLoadOptions) {\n return loadSpan('execute-load-slot', { id: component.id.toString() }, () =>\n this.executeLoadSlotWithSpan(component, loadOpts)\n );\n }\n\n private async executeLoadSlotWithSpan(component: Component, loadOpts?: ComponentLoadOptions) {\n if (component.state._consumer.removed) {\n // if it was soft-removed now, the component is not in the FS. loading aspects such as composition ends up with\n // errors as they try to read component files from the filesystem.\n return component;\n }\n\n // Special load events which runs from the workspace but should run from the correct aspect\n // TODO: remove this once those extensions dependent on workspace\n const envsData = await loadSpan('env-calc', {}, () =>\n this.envs.calcDescriptor(component, { skipWarnings: !!this.workspace.inInstallContext })\n );\n\n const wsDeps = component.state._consumer.dependencies.dependencies || [];\n const modelDeps = component.state._consumer.componentFromModel?.dependencies.dependencies || [];\n const merged = Dependencies.merge([wsDeps, modelDeps]);\n const envExtendsDeps = merged.get();\n\n // Move to deps resolver main runtime once we switch ws<> deps resolver direction\n const { policy, dependenciesList } = await loadSpan('dependency-resolution', {}, async () => {\n const mergedPolicy = await this.dependencyResolver.mergeVariantPolicies(\n component.config.extensions,\n component.id,\n component.state._consumer.files,\n envExtendsDeps\n );\n return {\n policy: mergedPolicy,\n dependenciesList: await this.dependencyResolver.extractDepsFromLegacy(component, mergedPolicy),\n };\n });\n const resolvedEnvJsonc = await loadSpan('env-manifest', {}, () =>\n this.envs.calculateEnvManifest(component, component.state._consumer.files, envExtendsDeps)\n );\n if (resolvedEnvJsonc) {\n // @ts-ignore\n envsData.resolvedEnvJsonc = resolvedEnvJsonc;\n }\n\n const depResolverData = {\n packageName: this.dependencyResolver.calcPackageName(component),\n dependencies: dependenciesList.serialize(),\n policy: policy.serialize(),\n componentRangePrefix: this.dependencyResolver.calcComponentRangePrefixByConsumerComponent(\n component.state._consumer\n ),\n };\n\n // Make sure we are adding the envs / deps data first because other on load events might depend on it\n await Promise.all([\n this.upsertExtensionData(component, EnvsAspect.id, envsData),\n this.upsertExtensionData(component, DependencyResolverAspect.id, depResolverData),\n ]);\n\n // We are updating the component state with the envs and deps data here, so in case we have other slots that depend on this data\n // they will be able to get it, as it's very common use case that during on load someone want to access to the component env for example\n const aspectListWithEnvsAndDeps = await this.workspace.createAspectList(component.state.config.extensions);\n component.state.aspects = aspectListWithEnvsAndDeps;\n\n const entries = this.workspace.onComponentLoadSlot.toArray();\n await mapSeries(entries, async ([extension, onLoad]) => {\n const data = await loadSpan('on-load', { aspect: extension }, () => onLoad(component, loadOpts));\n await this.upsertExtensionData(component, extension, data);\n // Update the aspect list to have changes happened during the on load slot (new data added above)\n component.state.aspects.upsertEntry(await this.workspace.resolveComponentId(extension), data);\n });\n\n return component;\n }\n\n private newComponentFromState(id: ComponentID, state: State): Component {\n return new WorkspaceComponent(id, null, state, new TagMap(), this.workspace);\n }\n\n private async upsertExtensionData(component: Component, extension: string, data: any) {\n if (!data) return;\n const existingExtension = component.state.config.extensions.findExtension(extension);\n if (existingExtension) {\n // Only merge top level of extension data\n Object.assign(existingExtension.data, data);\n return;\n }\n component.state.config.extensions.push(await this.getDataEntry(extension, data));\n }\n\n private async getDataEntry(extension: string, data: { [key: string]: any }): Promise<ExtensionDataEntry> {\n // TODO: @gilad we need to refactor the extension data entry api.\n return new ExtensionDataEntry(undefined, undefined, extension, undefined, data);\n }\n}\n\nfunction createComponentCacheKey(id: ComponentID, loadOpts?: ComponentLoadOptions): string {\n const relevantOpts = pick(loadOpts, ['loadExtensions', 'executeLoadSlot', 'loadDocs', 'loadCompositions']);\n return `${id.toString()}:${JSON.stringify(sortKeys(relevantOpts ?? {}))}`;\n}\n\nfunction sortKeys(obj: object) {\n return fromPairs(Object.entries(obj).sort(([k1], [k2]) => k1.localeCompare(k2)));\n}\n\nfunction printGroupsToHandle(groupsToHandle: Array<LoadGroup>, logger: Logger): void {\n groupsToHandle.forEach((group) => {\n const { scopeIds, workspaceIds, aspects, core, seeders, envs } = group;\n logger.console(\n `workspace-component-loader ~ groupsToHandle ${JSON.stringify(\n {\n scopeIds: scopeIds.map((id) => id.toString()),\n workspaceIds: workspaceIds.map((id) => id.toString()),\n aspects,\n core,\n seeders,\n envs,\n },\n null,\n 2\n )}`\n );\n });\n}\n\nfunction loadGroupToStr(loadGroup: LoadGroup): string {\n const { scopeIds, workspaceIds, aspects, core, seeders, envs } = loadGroup;\n\n const attr: string[] = [];\n if (aspects) attr.push('aspects');\n if (core) attr.push('core');\n if (seeders) attr.push('seeders');\n if (envs) attr.push('envs');\n\n return `workspaceIds: ${workspaceIds.length}, scopeIds: ${scopeIds.length}, (${attr.join('+')})`;\n}\n"],"mappings":";;;;;;AAAA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,QAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,gBAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,eAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,gBAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,eAAA,YAAAA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;IAAErE;EAAK,CAAC,GAAG0W,SAAS;EAE1E,MAAMC,IAAc,GAAG,EAAE;EACzB,IAAIxS,OAAO,EAAEwS,IAAI,CAACtY,IAAI,CAAC,SAAS,CAAC;EACjC,IAAI+F,IAAI,EAAEuS,IAAI,CAACtY,IAAI,CAAC,MAAM,CAAC;EAC3B,IAAIgG,OAAO,EAAEsS,IAAI,CAACtY,IAAI,CAAC,SAAS,CAAC;EACjC,IAAI2B,IAAI,EAAE2W,IAAI,CAACtY,IAAI,CAAC,MAAM,CAAC;EAE3B,OAAO,iBAAiB6F,YAAY,CAACzF,MAAM,eAAewF,QAAQ,CAACxF,MAAM,MAAMkY,IAAI,CAAC1L,IAAI,CAAC,GAAG,CAAC,GAAG;AAClG","ignoreList":[]}
|
package/dist/workspace.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ import { BitId } from '@teambit/legacy-bit-id';
|
|
|
15
15
|
import type { LaneId } from '@teambit/lane-id';
|
|
16
16
|
import type { Consumer } from '@teambit/legacy.consumer';
|
|
17
17
|
import type { GetBitMapComponentOptions } from '@teambit/legacy.bit-map';
|
|
18
|
+
import type { LoadFailure } from '@teambit/harmony.modules.load-trace';
|
|
18
19
|
import { ComponentsList } from '@teambit/legacy.component-list';
|
|
19
20
|
import { ExtensionDataList } from '@teambit/legacy.extension-data';
|
|
20
21
|
import type { PathOsBased, PathOsBasedRelative, PathOsBasedAbsolute } from '@teambit/toolbox.path.path';
|
|
@@ -516,7 +517,24 @@ export declare class Workspace implements ComponentFactory {
|
|
|
516
517
|
data?: Record<string, any>;
|
|
517
518
|
conflict: boolean;
|
|
518
519
|
};
|
|
519
|
-
|
|
520
|
+
/**
|
|
521
|
+
* @param includeNonBlocking when true (default), also returns non-blocking issues (e.g. aggregated
|
|
522
|
+
* load failures) that should be shown in "bit status" but must not block tag/snap. The tag/snap
|
|
523
|
+
* gate (`builder.throwForComponentIssues`) passes `false` so previously-swallowed load failures
|
|
524
|
+
* stay best-effort — phase 1 of the loading redesign makes them visible without changing which
|
|
525
|
+
* operations succeed.
|
|
526
|
+
*/
|
|
527
|
+
getWorkspaceIssues(opts?: {
|
|
528
|
+
includeNonBlocking?: boolean;
|
|
529
|
+
}): Error[];
|
|
530
|
+
/**
|
|
531
|
+
* load failures of aspects/envs that affect multiple components. aggregated here (instead of
|
|
532
|
+
* attaching an issue to every affected component) to keep "bit status" readable when e.g. one
|
|
533
|
+
* env used by 100 components fails to load. the failing component itself still gets a
|
|
534
|
+
* per-component LoadFailures issue.
|
|
535
|
+
*/
|
|
536
|
+
private aggregatedLoadFailures;
|
|
537
|
+
registerAggregatedLoadFailure(failure: LoadFailure, affectedComponentId: string): void;
|
|
520
538
|
listComponentsDuringMerge(): Promise<ComponentID[]>;
|
|
521
539
|
getUnmergedComponent(componentId: ComponentID): Promise<Component | undefined>;
|
|
522
540
|
isModified(component: Component): Promise<boolean>;
|
package/dist/workspace.js
CHANGED
|
@@ -438,6 +438,13 @@ class Workspace {
|
|
|
438
438
|
_defineProperty(this, "_componentList", void 0);
|
|
439
439
|
_defineProperty(this, "localAspects", {});
|
|
440
440
|
_defineProperty(this, "filter", void 0);
|
|
441
|
+
/**
|
|
442
|
+
* load failures of aspects/envs that affect multiple components. aggregated here (instead of
|
|
443
|
+
* attaching an issue to every affected component) to keep "bit status" readable when e.g. one
|
|
444
|
+
* env used by 100 components fails to load. the failing component itself still gets a
|
|
445
|
+
* per-component LoadFailures issue.
|
|
446
|
+
*/
|
|
447
|
+
_defineProperty(this, "aggregatedLoadFailures", new Map());
|
|
441
448
|
this.componentLoadedSelfAsAspects = (0, _harmonyModules().createInMemoryCache)({
|
|
442
449
|
maxSize: (0, _harmonyModules().getMaxSizeForComponents)()
|
|
443
450
|
});
|
|
@@ -939,6 +946,7 @@ it's possible that the version ${component.id.version} belong to ${idStr.split('
|
|
|
939
946
|
this.componentLoader.clearCache();
|
|
940
947
|
this.consumer.componentLoader.clearComponentsCache();
|
|
941
948
|
this.componentStatusLoader.clearCache();
|
|
949
|
+
this.aggregatedLoadFailures.clear();
|
|
942
950
|
this._componentList = new (_legacy3().ComponentsList)(this);
|
|
943
951
|
}
|
|
944
952
|
clearComponentCache(id) {
|
|
@@ -1759,7 +1767,16 @@ the following envs are used in this workspace: ${(0, _lodash().uniq)(availableEn
|
|
|
1759
1767
|
conflict
|
|
1760
1768
|
};
|
|
1761
1769
|
}
|
|
1762
|
-
|
|
1770
|
+
|
|
1771
|
+
/**
|
|
1772
|
+
* @param includeNonBlocking when true (default), also returns non-blocking issues (e.g. aggregated
|
|
1773
|
+
* load failures) that should be shown in "bit status" but must not block tag/snap. The tag/snap
|
|
1774
|
+
* gate (`builder.throwForComponentIssues`) passes `false` so previously-swallowed load failures
|
|
1775
|
+
* stay best-effort — phase 1 of the loading redesign makes them visible without changing which
|
|
1776
|
+
* operations succeed.
|
|
1777
|
+
*/
|
|
1778
|
+
getWorkspaceIssues(opts) {
|
|
1779
|
+
const includeNonBlocking = opts?.includeNonBlocking ?? true;
|
|
1763
1780
|
const errors = [];
|
|
1764
1781
|
|
|
1765
1782
|
// since PR #8393, the workspace.jsonc conflicts are not written to the config-merge file anymore.
|
|
@@ -1772,8 +1789,22 @@ the following envs are used in this workspace: ${(0, _lodash().uniq)(availableEn
|
|
|
1772
1789
|
errors.push(err);
|
|
1773
1790
|
}
|
|
1774
1791
|
}
|
|
1792
|
+
if (includeNonBlocking) {
|
|
1793
|
+
this.aggregatedLoadFailures.forEach(failure => {
|
|
1794
|
+
const affected = failure.affected.size === 1 ? '1 component' : `${failure.affected.size} components`;
|
|
1795
|
+
errors.push(new Error(`failed loading "${failure.failedId}" (during ${failure.phase}), affects ${affected}: ${failure.error}. the load continued without it, data computed by it may be missing`));
|
|
1796
|
+
});
|
|
1797
|
+
}
|
|
1775
1798
|
return errors;
|
|
1776
1799
|
}
|
|
1800
|
+
registerAggregatedLoadFailure(failure, affectedComponentId) {
|
|
1801
|
+
// keyed by the failing id only: the same root cause may be reported from several load phases,
|
|
1802
|
+
// and it should still render as a single workspace issue.
|
|
1803
|
+
const existing = this.aggregatedLoadFailures.get(failure.failedId);
|
|
1804
|
+
if (existing) existing.affected.add(affectedComponentId);else this.aggregatedLoadFailures.set(failure.failedId, _objectSpread(_objectSpread({}, failure), {}, {
|
|
1805
|
+
affected: new Set([affectedComponentId])
|
|
1806
|
+
}));
|
|
1807
|
+
}
|
|
1777
1808
|
async listComponentsDuringMerge() {
|
|
1778
1809
|
const unmergedComps = this.scope.legacyScope.objects.unmergedComponents.getComponents();
|
|
1779
1810
|
const bitIds = unmergedComps.map(u => _componentId().ComponentID.fromObject(u.id));
|