@teambit/workspace 1.0.220 → 1.0.221

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.
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.workspace_workspace@1.0.220/dist/workspace.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.workspace_workspace@1.0.220/dist/workspace.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.workspace_workspace@1.0.221/dist/workspace.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.workspace_workspace@1.0.221/dist/workspace.docs.mdx';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];
@@ -128,6 +128,7 @@ class WorkspaceAspectsLoader {
128
128
  * keep in mind that the graph may have circles.
129
129
  */
130
130
  async loadAspects(ids = [], throwOnError, neededFor, opts = {}) {
131
+ this.logger.profile('workspace.loadAspects');
131
132
  const calculatedThrowOnError = throwOnError ?? false;
132
133
  const defaultOpts = {
133
134
  useScopeAspectsCapsule: false,
@@ -150,7 +151,10 @@ needed-for: ${neededFor || '<unknown>'}. using opts: ${JSON.stringify(mergedOpts
150
151
  this.workspace.localAspects = localAspects;
151
152
  await this.aspectLoader.loadAspectFromPath(this.workspace.localAspects);
152
153
  const notLoadedIds = nonLocalAspects.filter(id => !this.aspectLoader.isAspectLoaded(id));
153
- if (!notLoadedIds.length) return [];
154
+ if (!notLoadedIds.length) {
155
+ this.logger.profile('workspace.loadAspects');
156
+ return [];
157
+ }
154
158
  const coreAspectsStringIds = this.aspectLoader.getCoreAspectIds();
155
159
  const idsWithoutCore = (0, _lodash().difference)(notLoadedIds, coreAspectsStringIds);
156
160
  const componentIds = await this.workspace.resolveMultipleComponentIds(idsWithoutCore);
@@ -197,6 +201,7 @@ needed-for: ${neededFor || '<unknown>'}. using opts: ${JSON.stringify(mergedOpts
197
201
  });
198
202
  this.logger.debug(`${loggerPrefix} finish loading aspects`);
199
203
  const manifestIds = manifests.map(manifest => manifest.id);
204
+ this.logger.profile('workspace.loadAspects');
200
205
  return (0, _lodash().compact)(manifestIds.concat(scopeAspectIds));
201
206
  }
202
207
  async loadFromScopeAspectsCapsule(ids, throwOnError, neededFor) {
@@ -1 +1 @@
1
- {"version":3,"names":["_constants","data","require","_findRoot","_interopRequireDefault","_toolboxModules","_aspectLoader","_cli","_fsExtra","_harmonyModules","_workspaceModules","_componentId","_exceptions","_pMapSeries","_lodash","_bitError","obj","__esModule","default","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","key","value","_toPropertyKey","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","WorkspaceAspectsLoader","constructor","workspace","scope","aspectLoader","envs","dependencyResolver","logger","globalConfig","harmony","onAspectsResolveSlot","onRootAspectAddedSlot","resolveAspectsFromNodeModules","resolveEnvsFromRoots","consumer","resolvedInstalledAspects","Map","hasRootComponents","loadAspects","ids","throwOnError","neededFor","opts","calculatedThrowOnError","defaultOpts","useScopeAspectsCapsule","runSubscribers","skipDeps","hideMissingModuleError","inInstallContext","ignoreErrors","mergedOpts","callId","Math","floor","random","loggerPrefix","info","join","JSON","stringify","localAspects","nonLocalAspects","partition","id","startsWith","loadAspectFromPath","notLoadedIds","isAspectLoaded","coreAspectsStringIds","getCoreAspectIds","idsWithoutCore","difference","componentIds","resolveMultipleComponentIds","workspaceIds","nonWorkspaceIds","groupIdsByWorkspaceExistence","logFoundWorkspaceVsScope","idsToLoadFromWs","scopeAspectIds","loadFromScopeAspectsCapsule","aspectsDefs","resolveAspects","undefined","excludeCore","requestedOnly","manifests","requireableComponents","loadAspectDefsByOrder","potentialPluginsIndexes","compact","map","manifest","index","isValidAspect","pluginsRequireableComponents","pluginsManifests","getManifestsFromRequireableExtensions","loadExtensionsByManifests","debug","manifestIds","concat","currentLane","getCurrentLaneObject","nonWorkspaceIdsString","toString","packageManagerConfigRootDir","path","workspaceName","name","err","throwWsJsoncAspectNotFoundError","ComponentNotFound","config","get","configStr","workspaceConfig","raw","includes","BitError","seeders","nonWorkspaceDefs","groupAspectDefsByWorkspaceExistence","scopeAspectsLoader","getScopeAspectsLoader","scopeIds","aspectDef","getId","scopeIdsGrouped","groupAspectIdsByEnvOfTheList","aspectDefsToRequireableComponents","runtimeName","filterByRuntime","idsToResolve","extensionsIds","coreAspectsIds","configuredAspects","getConfiguredAspects","userAspectsIds","toStringWithoutVersion","rootAspectsIds","componentIdsToResolve","components","importAndGetAspects","runOnAspectsResolveFunctions","wsAspectDefs","getWorkspaceAspectResolver","coreAspectDefs","Promise","all","coreId","rawDef","getAspectDef","loadDefinition","idsToFilter","idStr","ComponentID","fromString","targetDefs","finalDefs","filterAspectDefs","groupedByIsPlugin","groupBy","component","hasPluginFiles","graph","getAspectsGraphWithoutCore","false","isAspect","bind","aspectsComponents","nodes","node","attr","true","workspaceComps","nonWorkspaceComps","groupComponentsByWorkspaceExistence","workspaceCompsIds","c","nonWorkspaceCompsIds","stringIds","linkIfMissingWorkspaceAspects","componentsToResolveFromScope","componentsToResolveFromInstalled","nonWorkspaceCompsGroups","isEnv","scopeAspectsDefs","installedAspectsDefs","getInstalledAspectResolver","coreAspect","runtimePath","localResolved","resolveLocalAspects","allDefsExceptLocal","withoutLocalAspects","aspectId","find","localAspect","allDefs","filteredDefs","shouldUseHashForCapsules","getSync","CFG_CAPSULES_BUILD_COMPONENTS_BASE_DIR","getCapsulePath","defaultPath","workspaceIdsStr","nonWorkspaceIdsStr","use","aspectIdStr","resolveComponentId","inWs","hasId","aspectIdToAdd","aspectsComponent","Error","setExtension","overrideExisting","ignoreVersion","write","reasonForChange","addInMemoryConfiguredAspect","runOnRootAspectAddedFunctions","getConfiguredUserAspectsPackages","options","componentsToGetPackages","externalsOnly","packages","aspectComponent","packageName","getPackageName","version","aspectDefs","localPath","aspectPath","requireFunc","plugins","getPlugins","has","load","MainRuntime","isModule","isEsmModule","aspect","loadEsm","getRuntimePath","RequireableComponent","aspects","idsToLink","isInWs","exist","fs","pathExists","idsToLinkWithoutNull","linkToNodeModulesByIds","workspaceAspectResolver","compStringId","getComponentPackagePath","aspectFilePath","getAspectFilePath","funcs","getOnAspectsResolveFunctions","pMapSeries","func","error","aspectsResolveFunctions","values","aspectsId","getOnRootAspectAddedFunctions","RootAspectAddedFunctions","rootIds","installedAspectsResolver","resolveInstalledAspectRecursively","aspectStringId","resolvedPath","set","parent","predecessors","parentPath","resolveFrom","findRoot","consoleWarning","message","buildOneGraphForComponents","loadComponentsExtensions","extensions","originatedFrom","extensionsIdsP","extensionEntry","extensionId","stringId","harmonyExtensions","loadedExtensions","extId","loaded","extensionsToLoad","isUsingAspectEnv","isUsingEnvEnv","loadOpts","idsToNotLoadAsAspects","importAndGetMany","existOnWorkspace","rootComps","nonRootComps","groupComponentsByLoadFromRootComps","shouldLoadFromRootComps","rootDir","rootDirExist","aspectFilePathExist","pluginFiles","getPluginFiles","hasEnvManifest","workspaceDefs","scopeComponents","exports"],"sources":["workspace-aspects-loader.ts"],"sourcesContent":["import { CFG_CAPSULES_BUILD_COMPONENTS_BASE_DIR } from '@teambit/legacy/dist/constants';\nimport { GlobalConfigMain } from '@teambit/global-config';\nimport findRoot from 'find-root';\nimport { resolveFrom } from '@teambit/toolbox.modules.module-resolver';\nimport { Graph } from '@teambit/graph.cleargraph';\nimport { ExtensionDataList } from '@teambit/legacy/dist/consumer/config/extension-data';\nimport { ExtensionManifest, Harmony, Aspect } from '@teambit/harmony';\nimport {\n AspectDefinition,\n AspectLoaderMain,\n AspectResolver,\n getAspectDef,\n ResolvedAspect,\n} from '@teambit/aspect-loader';\nimport { MainRuntime } from '@teambit/cli';\nimport fs from 'fs-extra';\nimport { RequireableComponent } from '@teambit/harmony.modules.requireable-component';\nimport { linkToNodeModulesByIds } from '@teambit/workspace.modules.node-modules-linker';\nimport { ComponentID } from '@teambit/component-id';\nimport { ComponentNotFound } from '@teambit/legacy/dist/scope/exceptions';\nimport pMapSeries from 'p-map-series';\nimport { difference, compact, groupBy, partition } from 'lodash';\nimport { Consumer } from '@teambit/legacy/dist/consumer';\nimport { Component, LoadAspectsOptions, ResolveAspectsOptions } from '@teambit/component';\nimport { ScopeMain } from '@teambit/scope';\nimport { Logger } from '@teambit/logger';\nimport { BitError } from '@teambit/bit-error';\nimport { EnvsMain } from '@teambit/envs';\nimport { ConfigMain } from '@teambit/config';\nimport { DependencyResolverMain } from '@teambit/dependency-resolver';\nimport { ShouldLoadFunc } from './build-graph-from-fs';\nimport type { Workspace } from './workspace';\nimport {\n OnAspectsResolve,\n OnAspectsResolveSlot,\n OnRootAspectAdded,\n OnRootAspectAddedSlot,\n} from './workspace.main.runtime';\nimport { ComponentLoadOptions } from './workspace-component/workspace-component-loader';\n\nexport type GetConfiguredUserAspectsPackagesOptions = {\n externalsOnly?: boolean;\n};\n\nexport type WorkspaceLoadAspectsOptions = LoadAspectsOptions & {\n useScopeAspectsCapsule?: boolean;\n runSubscribers?: boolean;\n skipDeps?: boolean;\n resolveEnvsFromRoots?: boolean;\n};\n\nexport type AspectPackage = { packageName: string; version: string };\n\nexport class WorkspaceAspectsLoader {\n private consumer: Consumer;\n private resolvedInstalledAspects: Map<string, string | null>;\n\n constructor(\n private workspace: Workspace,\n private scope: ScopeMain,\n private aspectLoader: AspectLoaderMain,\n private envs: EnvsMain,\n private dependencyResolver: DependencyResolverMain,\n private logger: Logger,\n private globalConfig: GlobalConfigMain,\n private harmony: Harmony,\n private onAspectsResolveSlot: OnAspectsResolveSlot,\n private onRootAspectAddedSlot: OnRootAspectAddedSlot,\n private resolveAspectsFromNodeModules = false,\n private resolveEnvsFromRoots = false\n ) {\n this.consumer = this.workspace.consumer;\n this.resolvedInstalledAspects = new Map();\n // Only enable this when root components is enabled as well\n this.resolveEnvsFromRoots = this.resolveEnvsFromRoots && this.dependencyResolver.hasRootComponents();\n }\n\n /**\n * load aspects from the workspace and if not exists in the workspace, load from the node_modules.\n * keep in mind that the graph may have circles.\n */\n async loadAspects(\n ids: string[] = [],\n throwOnError?: boolean,\n neededFor?: string,\n opts: WorkspaceLoadAspectsOptions = {}\n ): Promise<string[]> {\n const calculatedThrowOnError: boolean = throwOnError ?? false;\n const defaultOpts: Required<WorkspaceLoadAspectsOptions> = {\n useScopeAspectsCapsule: false,\n throwOnError: calculatedThrowOnError,\n runSubscribers: true,\n skipDeps: false,\n hideMissingModuleError: !!this.workspace.inInstallContext,\n ignoreErrors: false,\n resolveEnvsFromRoots: this.resolveEnvsFromRoots,\n };\n const mergedOpts: Required<WorkspaceLoadAspectsOptions> = { ...defaultOpts, ...opts };\n\n // generate a random callId to be able to identify the call from the logs\n const callId = Math.floor(Math.random() * 1000);\n const loggerPrefix = `[${callId}] loadAspects,`;\n this.logger.info(`${loggerPrefix} loading ${ids.length} aspects.\nids: ${ids.join(', ')}\nneeded-for: ${neededFor || '<unknown>'}. using opts: ${JSON.stringify(mergedOpts, null, 2)}`);\n const [localAspects, nonLocalAspects] = partition(ids, (id) => id.startsWith('file:'));\n this.workspace.localAspects = localAspects;\n await this.aspectLoader.loadAspectFromPath(this.workspace.localAspects);\n const notLoadedIds = nonLocalAspects.filter((id) => !this.aspectLoader.isAspectLoaded(id));\n if (!notLoadedIds.length) return [];\n const coreAspectsStringIds = this.aspectLoader.getCoreAspectIds();\n const idsWithoutCore: string[] = difference(notLoadedIds, coreAspectsStringIds);\n\n const componentIds = await this.workspace.resolveMultipleComponentIds(idsWithoutCore);\n\n const { workspaceIds, nonWorkspaceIds } = await this.groupIdsByWorkspaceExistence(\n componentIds,\n mergedOpts.resolveEnvsFromRoots\n );\n\n this.logFoundWorkspaceVsScope(loggerPrefix, workspaceIds, nonWorkspaceIds);\n let idsToLoadFromWs = componentIds;\n let scopeAspectIds: string[] = [];\n\n // TODO: hard coded use the old approach and loading from the scope capsules\n // This is because right now loading from the ws node_modules causes issues in some cases\n // like for the cloud app\n // it should be removed once we fix the issues\n if (!this.resolveAspectsFromNodeModules) {\n mergedOpts.useScopeAspectsCapsule = true;\n }\n\n if (mergedOpts.useScopeAspectsCapsule) {\n idsToLoadFromWs = workspaceIds;\n scopeAspectIds = await this.loadFromScopeAspectsCapsule(nonWorkspaceIds, throwOnError, neededFor);\n }\n\n const aspectsDefs = await this.resolveAspects(undefined, idsToLoadFromWs, {\n excludeCore: true,\n requestedOnly: false,\n ...mergedOpts,\n });\n\n const { manifests, requireableComponents } = await this.loadAspectDefsByOrder(\n aspectsDefs,\n idsWithoutCore,\n mergedOpts.throwOnError,\n mergedOpts.hideMissingModuleError,\n neededFor,\n mergedOpts.runSubscribers\n );\n\n const potentialPluginsIndexes = compact(\n manifests.map((manifest, index) => {\n if (this.aspectLoader.isValidAspect(manifest)) return undefined;\n return index;\n })\n );\n\n // Try require components for potential plugins\n const pluginsRequireableComponents = potentialPluginsIndexes.map((index) => {\n return requireableComponents[index];\n });\n // Do the require again now that the plugins defs already registered\n const pluginsManifests = await this.aspectLoader.getManifestsFromRequireableExtensions(\n pluginsRequireableComponents,\n throwOnError,\n opts.runSubscribers\n );\n\n await this.aspectLoader.loadExtensionsByManifests(pluginsManifests, undefined, { throwOnError });\n this.logger.debug(`${loggerPrefix} finish loading aspects`);\n const manifestIds = manifests.map((manifest) => manifest.id);\n return compact(manifestIds.concat(scopeAspectIds));\n }\n\n private async loadFromScopeAspectsCapsule(ids: ComponentID[], throwOnError?: boolean, neededFor?: string) {\n let scopeAspectIds: string[] = [];\n const currentLane = await this.consumer.getCurrentLaneObject();\n\n if (!ids.length) return [];\n\n const nonWorkspaceIdsString = ids.map((id) => id.toString());\n try {\n scopeAspectIds = await this.scope.loadAspects(\n nonWorkspaceIdsString,\n throwOnError,\n neededFor,\n currentLane || undefined,\n {\n packageManagerConfigRootDir: this.workspace.path,\n workspaceName: this.workspace.name,\n }\n );\n return scopeAspectIds;\n } catch (err: any) {\n this.throwWsJsoncAspectNotFoundError(err);\n return scopeAspectIds;\n\n throw err;\n }\n }\n\n throwWsJsoncAspectNotFoundError(err: any) {\n if (err instanceof ComponentNotFound) {\n const config = this.harmony.get<ConfigMain>('teambit.harmony/config');\n const configStr = JSON.stringify(config.workspaceConfig?.raw || {});\n if (configStr.includes(err.id)) {\n throw new BitError(`error: a component \"${err.id}\" was not found\nyour workspace.jsonc has this component-id set. you might want to remove/change it.`);\n }\n }\n }\n\n private async loadAspectDefsByOrder(\n aspectsDefs: AspectDefinition[],\n seeders: string[],\n throwOnError: boolean,\n hideMissingModuleError: boolean,\n neededFor?: string,\n runSubscribers = true\n ): Promise<{ manifests: Array<Aspect | ExtensionManifest>; requireableComponents: RequireableComponent[] }> {\n const { nonWorkspaceDefs } = await this.groupAspectDefsByWorkspaceExistence(aspectsDefs);\n const scopeAspectsLoader = this.scope.getScopeAspectsLoader();\n const scopeIds: string[] = compact(nonWorkspaceDefs.map((aspectDef) => aspectDef.getId));\n const scopeIdsGrouped = await scopeAspectsLoader.groupAspectIdsByEnvOfTheList(scopeIds);\n\n // Make sure to first load envs from the list otherwise it will fail when trying to load other aspects\n // as their envs might not be loaded yet\n if (scopeIdsGrouped.envs && scopeIdsGrouped.envs.length && !runSubscribers) {\n await this.scope.loadAspects(scopeIdsGrouped.envs, throwOnError, 'workspace.loadAspects loading scope aspects');\n }\n const requireableComponents = this.aspectDefsToRequireableComponents(aspectsDefs);\n const manifests = await this.aspectLoader.getManifestsFromRequireableExtensions(\n requireableComponents,\n throwOnError,\n runSubscribers\n );\n await this.aspectLoader.loadExtensionsByManifests(\n manifests,\n { seeders, neededFor },\n { throwOnError, hideMissingModuleError }\n );\n return { manifests, requireableComponents };\n }\n\n async resolveAspects(\n runtimeName?: string,\n componentIds?: ComponentID[],\n opts?: ResolveAspectsOptions\n ): Promise<AspectDefinition[]> {\n const callId = Math.floor(Math.random() * 1000);\n const loggerPrefix = `[${callId}] workspace resolveAspects,`;\n\n this.logger.debug(\n `${loggerPrefix}, resolving aspects for - runtimeName: ${runtimeName}, componentIds: ${componentIds}`\n );\n const defaultOpts: ResolveAspectsOptions = {\n excludeCore: false,\n requestedOnly: false,\n filterByRuntime: true,\n useScopeAspectsCapsule: false,\n workspaceName: this.workspace.name,\n resolveEnvsFromRoots: this.resolveEnvsFromRoots,\n packageManagerConfigRootDir: this.workspace.path,\n };\n const mergedOpts = { ...defaultOpts, ...opts };\n const idsToResolve = componentIds ? componentIds.map((id) => id.toString()) : this.harmony.extensionsIds;\n const coreAspectsIds = this.aspectLoader.getCoreAspectIds();\n const configuredAspects = this.aspectLoader.getConfiguredAspects();\n // it's possible that componentIds are core-aspects that got version for some reason, remove the version to\n // correctly filter them out later.\n const userAspectsIds: string[] = componentIds\n ? componentIds.filter((id) => !coreAspectsIds.includes(id.toStringWithoutVersion())).map((id) => id.toString())\n : difference(this.harmony.extensionsIds, coreAspectsIds);\n const rootAspectsIds: string[] = difference(configuredAspects, coreAspectsIds);\n const componentIdsToResolve = await this.workspace.resolveMultipleComponentIds(userAspectsIds);\n const components = await this.importAndGetAspects(componentIdsToResolve, opts?.throwOnError);\n // Run the on load slot\n await this.runOnAspectsResolveFunctions(components);\n\n if (opts?.skipDeps) {\n const wsAspectDefs = await this.aspectLoader.resolveAspects(\n components,\n this.getWorkspaceAspectResolver([], runtimeName)\n );\n\n const coreAspectDefs = await Promise.all(\n coreAspectsIds.map(async (coreId) => {\n const rawDef = await getAspectDef(coreId, runtimeName);\n return this.aspectLoader.loadDefinition(rawDef);\n })\n );\n\n const idsToFilter = idsToResolve.map((idStr) => ComponentID.fromString(idStr));\n const targetDefs = wsAspectDefs.concat(coreAspectDefs);\n const finalDefs = this.aspectLoader.filterAspectDefs(targetDefs, idsToFilter, runtimeName, mergedOpts);\n\n return finalDefs;\n }\n\n const groupedByIsPlugin = groupBy(components, (component) => {\n return this.aspectLoader.hasPluginFiles(component);\n });\n const graph = await this.getAspectsGraphWithoutCore(groupedByIsPlugin.false, this.isAspect.bind(this));\n const aspectsComponents = graph.nodes.map((node) => node.attr).concat(groupedByIsPlugin.true || []);\n this.logger.debug(`${loggerPrefix} found ${aspectsComponents.length} aspects in the aspects-graph`);\n const { workspaceComps, nonWorkspaceComps } = await this.groupComponentsByWorkspaceExistence(\n aspectsComponents,\n mergedOpts.resolveEnvsFromRoots\n );\n\n const workspaceCompsIds = workspaceComps.map((c) => c.id);\n const nonWorkspaceCompsIds = nonWorkspaceComps.map((c) => c.id);\n this.logFoundWorkspaceVsScope(loggerPrefix, workspaceCompsIds, nonWorkspaceCompsIds);\n\n const stringIds: string[] = [];\n const wsAspectDefs = await this.aspectLoader.resolveAspects(\n workspaceComps,\n this.getWorkspaceAspectResolver(stringIds, runtimeName)\n );\n\n await this.linkIfMissingWorkspaceAspects(wsAspectDefs);\n\n // TODO: hard coded use the old approach and loading from the scope capsules\n // This is because right now loading from the ws node_modules causes issues in some cases\n // like for the cloud app\n // it should be removed once we fix the issues\n if (!this.resolveAspectsFromNodeModules) {\n mergedOpts.useScopeAspectsCapsule = true;\n }\n\n let componentsToResolveFromScope = nonWorkspaceComps;\n let componentsToResolveFromInstalled: Component[] = [];\n if (!mergedOpts.useScopeAspectsCapsule) {\n const nonWorkspaceCompsGroups = groupBy(nonWorkspaceComps, (component) => this.envs.isEnv(component));\n componentsToResolveFromScope = nonWorkspaceCompsGroups.true || [];\n componentsToResolveFromInstalled = nonWorkspaceCompsGroups.false || [];\n }\n\n const scopeIds = componentsToResolveFromScope.map((c) => c.id);\n this.logger.debug(\n `${loggerPrefix} ${\n scopeIds.length\n } components are not in the workspace and are loaded from the scope capsules:\\n${scopeIds\n .map((id) => id.toString())\n .join('\\n')}`\n );\n const scopeAspectsDefs: AspectDefinition[] = scopeIds.length\n ? await this.scope.resolveAspects(runtimeName, scopeIds, mergedOpts)\n : [];\n\n this.logger.debug(\n `${loggerPrefix} ${\n componentsToResolveFromInstalled.length\n } components are not in the workspace and are loaded from the node_modules:\\n${componentsToResolveFromInstalled\n .map((c) => c.id.toString())\n .join('\\n')}`\n );\n const installedAspectsDefs: AspectDefinition[] = componentsToResolveFromInstalled.length\n ? await this.aspectLoader.resolveAspects(\n componentsToResolveFromInstalled,\n this.getInstalledAspectResolver(graph, rootAspectsIds, runtimeName, {\n throwOnError: opts?.throwOnError ?? false,\n })\n )\n : [];\n\n let coreAspectDefs = await Promise.all(\n coreAspectsIds.map(async (coreId) => {\n const rawDef = await getAspectDef(coreId, runtimeName);\n return this.aspectLoader.loadDefinition(rawDef);\n })\n );\n\n // due to lack of workspace and scope runtimes. TODO: fix after adding them.\n if (runtimeName && mergedOpts.filterByRuntime) {\n coreAspectDefs = coreAspectDefs.filter((coreAspect) => {\n return coreAspect.runtimePath;\n });\n }\n const localResolved = await this.aspectLoader.resolveLocalAspects(this.workspace.localAspects, runtimeName);\n const allDefsExceptLocal = [...wsAspectDefs, ...coreAspectDefs, ...scopeAspectsDefs, ...installedAspectsDefs];\n const withoutLocalAspects = allDefsExceptLocal.filter((aspectId) => {\n return !localResolved.find((localAspect) => {\n return localAspect.id === aspectId.component?.id?.toStringWithoutVersion();\n });\n });\n const allDefs = [...withoutLocalAspects, ...localResolved];\n const idsToFilter = idsToResolve.map((idStr) => ComponentID.fromString(idStr));\n const filteredDefs = this.aspectLoader.filterAspectDefs(allDefs, idsToFilter, runtimeName, mergedOpts);\n return filteredDefs;\n }\n\n shouldUseHashForCapsules(): boolean {\n return !this.globalConfig.getSync(CFG_CAPSULES_BUILD_COMPONENTS_BASE_DIR);\n }\n\n getCapsulePath() {\n const defaultPath = this.workspace.path;\n return this.globalConfig.getSync(CFG_CAPSULES_BUILD_COMPONENTS_BASE_DIR) || defaultPath;\n }\n\n private logFoundWorkspaceVsScope(loggerPrefix: string, workspaceIds: ComponentID[], nonWorkspaceIds: ComponentID[]) {\n const workspaceIdsStr = workspaceIds.length ? workspaceIds.map((id) => id.toString()).join('\\n') : '';\n const nonWorkspaceIdsStr = nonWorkspaceIds.length ? nonWorkspaceIds.map((id) => id.toString()).join('\\n') : '';\n this.logger.debug(\n `${loggerPrefix} found ${workspaceIds.length} components in the workspace, ${nonWorkspaceIds.length} not in the workspace`\n );\n if (workspaceIdsStr) this.logger.debug(`${loggerPrefix} workspace components:\\n${workspaceIdsStr}`);\n if (nonWorkspaceIdsStr)\n this.logger.debug(\n `${loggerPrefix} non workspace components (loaded from the scope capsules or from the node_modules):\\n${nonWorkspaceIdsStr}`\n );\n }\n\n async use(aspectIdStr: string): Promise<string> {\n let aspectId = await this.workspace.resolveComponentId(aspectIdStr);\n const inWs = await this.workspace.hasId(aspectId);\n let aspectIdToAdd = aspectId.toStringWithoutVersion();\n\n let aspectsComponent;\n // let aspectPackage;\n if (!inWs) {\n const aspectsComponents = await this.importAndGetAspects([aspectId]);\n if (aspectsComponents[0]) {\n aspectsComponent = aspectsComponents[0];\n aspectId = aspectsComponent.id;\n aspectIdToAdd = aspectId.toString();\n }\n }\n\n const config = this.harmony.get<ConfigMain>('teambit.harmony/config').workspaceConfig;\n if (!config) {\n throw new Error(`use() unable to get the workspace config`);\n }\n config.setExtension(\n aspectIdToAdd,\n {},\n {\n overrideExisting: false,\n ignoreVersion: false,\n }\n );\n await config.write({ reasonForChange: `use (${aspectIdStr})` });\n this.aspectLoader.addInMemoryConfiguredAspect(aspectIdToAdd);\n await this.runOnRootAspectAddedFunctions(aspectId, inWs);\n return aspectIdToAdd;\n }\n\n async getConfiguredUserAspectsPackages(\n options: GetConfiguredUserAspectsPackagesOptions = {}\n ): Promise<AspectPackage[]> {\n const configuredAspects = this.aspectLoader.getConfiguredAspects();\n const coreAspectsIds = this.aspectLoader.getCoreAspectIds();\n const userAspectsIds: string[] = difference(configuredAspects, coreAspectsIds);\n const componentIdsToResolve = await this.workspace.resolveMultipleComponentIds(\n userAspectsIds.filter((id) => !id.startsWith('file:'))\n );\n const aspectsComponents = await this.importAndGetAspects(componentIdsToResolve);\n let componentsToGetPackages = aspectsComponents;\n if (options.externalsOnly) {\n const { nonWorkspaceComps } = await this.groupComponentsByWorkspaceExistence(aspectsComponents);\n componentsToGetPackages = nonWorkspaceComps;\n }\n const packages = componentsToGetPackages.map((aspectComponent) => {\n const packageName = this.dependencyResolver.getPackageName(aspectComponent);\n const version = aspectComponent.id.version || '*';\n return { packageName, version };\n });\n return packages;\n }\n\n private aspectDefsToRequireableComponents(aspectDefs: AspectDefinition[]): RequireableComponent[] {\n const requireableComponents = aspectDefs.map((aspectDef) => {\n const localPath = aspectDef.aspectPath;\n const component = aspectDef.component;\n if (!component) return undefined;\n const requireFunc = async () => {\n const plugins = this.aspectLoader.getPlugins(component, localPath);\n if (plugins.has()) {\n return plugins.load(MainRuntime.name);\n }\n\n const isModule = await this.aspectLoader.isEsmModule(localPath);\n\n const aspect = !isModule\n ? // eslint-disable-next-line global-require, import/no-dynamic-require\n require(localPath)\n : // : await this.aspectLoader.loadEsm(join(localPath, 'dist', 'index.js'));\n await this.aspectLoader.loadEsm(localPath);\n\n // require aspect runtimes\n const runtimePath = await this.aspectLoader.getRuntimePath(component, localPath, MainRuntime.name);\n if (runtimePath) {\n if (isModule) await this.aspectLoader.loadEsm(runtimePath);\n // eslint-disable-next-line global-require, import/no-dynamic-require\n require(runtimePath);\n }\n return aspect;\n };\n return new RequireableComponent(component, requireFunc);\n });\n return compact(requireableComponents);\n }\n\n private async linkIfMissingWorkspaceAspects(aspects: AspectDefinition[]) {\n const idsToLink = await Promise.all(\n aspects.map(async (aspect) => {\n if (!aspect.component)\n throw new Error(`linkIfMissingWorkspaceAspects, aspect.component is missing for ${aspect.aspectPath}`);\n const isInWs = await this.workspace.hasId(aspect.component.id);\n if (!isInWs) return null;\n const exist = await fs.pathExists(aspect.aspectPath);\n if (!exist) return aspect.component.id;\n return null;\n })\n );\n const idsToLinkWithoutNull = compact(idsToLink);\n if (!idsToLinkWithoutNull.length) return;\n await linkToNodeModulesByIds(this.workspace, idsToLinkWithoutNull);\n }\n\n /**\n * This will return a resolver that knows to resolve aspects which are part of the workspace.\n * means aspects exist in the bitmap file\n * @param stringIds\n * @param runtimeName\n * @returns\n */\n private getWorkspaceAspectResolver(stringIds: string[], runtimeName?: string): AspectResolver {\n const workspaceAspectResolver = async (component: Component): Promise<ResolvedAspect> => {\n const compStringId = component.id.toString();\n stringIds.push(compStringId);\n const localPath = await this.workspace.getComponentPackagePath(component);\n\n const runtimePath = runtimeName\n ? await this.aspectLoader.getRuntimePath(component, localPath, runtimeName)\n : null;\n\n const aspectFilePath = await this.aspectLoader.getAspectFilePath(component, localPath);\n\n this.logger.debug(\n `workspace resolveAspects, resolving id: ${compStringId}, localPath: ${localPath}, runtimePath: ${runtimePath}`\n );\n return {\n aspectPath: localPath,\n aspectFilePath,\n runtimePath,\n };\n };\n return workspaceAspectResolver;\n }\n\n private async runOnAspectsResolveFunctions(aspectsComponents: Component[]): Promise<void> {\n const funcs = this.getOnAspectsResolveFunctions();\n await pMapSeries(funcs, async (func) => {\n try {\n await func(aspectsComponents);\n } catch (err) {\n this.logger.error('failed running onAspectsResolve function', err);\n }\n });\n }\n\n private getOnAspectsResolveFunctions(): OnAspectsResolve[] {\n const aspectsResolveFunctions = this.onAspectsResolveSlot.values();\n return aspectsResolveFunctions;\n }\n\n private async runOnRootAspectAddedFunctions(aspectsId: ComponentID, inWs: boolean): Promise<void> {\n const funcs = this.getOnRootAspectAddedFunctions();\n await pMapSeries(funcs, async (func) => {\n try {\n await func(aspectsId, inWs);\n } catch (err) {\n this.logger.error('failed running onRootAspectAdded function', err);\n }\n });\n }\n\n private getOnRootAspectAddedFunctions(): OnRootAspectAdded[] {\n const RootAspectAddedFunctions = this.onRootAspectAddedSlot.values();\n return RootAspectAddedFunctions;\n }\n\n /**\n * This will return a resolver that knows to resolve aspects which are not part of the workspace.\n * means aspects that does not exist in the bitmap file\n * instead it will resolve them from the node_modules recursively\n * @param graph\n * @param rootIds\n * @param runtimeName\n * @returns\n */\n private getInstalledAspectResolver(\n graph: Graph<Component, string>,\n rootIds: string[],\n runtimeName?: string,\n opts: { throwOnError: boolean } = { throwOnError: false }\n ): AspectResolver {\n const installedAspectsResolver = async (component: Component): Promise<ResolvedAspect | undefined> => {\n const compStringId = component.id.toString();\n // stringIds.push(compStringId);\n const localPath = await this.resolveInstalledAspectRecursively(component, rootIds, graph, opts);\n if (!localPath) return undefined;\n\n const runtimePath = runtimeName\n ? await this.aspectLoader.getRuntimePath(component, localPath, runtimeName)\n : null;\n\n const aspectFilePath = await this.aspectLoader.getAspectFilePath(component, localPath);\n\n this.logger.debug(\n `workspace resolveInstalledAspects, resolving id: ${compStringId}, localPath: ${localPath}, runtimePath: ${runtimePath}`\n );\n return {\n aspectPath: localPath,\n aspectFilePath,\n runtimePath,\n };\n };\n return installedAspectsResolver;\n }\n\n private async resolveInstalledAspectRecursively(\n aspectComponent: Component,\n rootIds: string[],\n graph: Graph<Component, string>,\n opts: { throwOnError: boolean } = { throwOnError: false }\n ): Promise<string | null | undefined> {\n const aspectStringId = aspectComponent.id.toString();\n if (this.resolvedInstalledAspects.has(aspectStringId)) {\n const resolvedPath = this.resolvedInstalledAspects.get(aspectStringId);\n return resolvedPath;\n }\n if (rootIds.includes(aspectStringId)) {\n const localPath = await this.workspace.getComponentPackagePath(aspectComponent);\n this.resolvedInstalledAspects.set(aspectStringId, localPath);\n return localPath;\n }\n const parent = graph.predecessors(aspectStringId)[0];\n if (!parent) return undefined;\n const parentPath = await this.resolveInstalledAspectRecursively(parent.attr, rootIds, graph);\n if (!parentPath) {\n this.resolvedInstalledAspects.set(aspectStringId, null);\n return undefined;\n }\n const packageName = this.dependencyResolver.getPackageName(aspectComponent);\n try {\n const resolvedPath = resolveFrom(parentPath, [packageName]);\n const localPath = findRoot(resolvedPath);\n this.resolvedInstalledAspects.set(aspectStringId, localPath);\n return localPath;\n } catch (error: any) {\n this.resolvedInstalledAspects.set(aspectStringId, null);\n if (opts.throwOnError) {\n throw error;\n }\n this.logger.consoleWarning(\n `failed resolving aspect ${aspectStringId} from ${parentPath}, error: ${error.message}`\n );\n return undefined;\n }\n }\n\n /**\n * Create a graph of aspects without the core aspects.\n * @param components\n * @param isAspect\n * @returns\n */\n private async getAspectsGraphWithoutCore(\n components: Component[] = [],\n isAspect?: ShouldLoadFunc\n ): Promise<Graph<Component, string>> {\n const ids = components.map((component) => component.id);\n const coreAspectsStringIds = this.aspectLoader.getCoreAspectIds();\n // TODO: @gilad it causes many issues we need to find a better solution. removed for now.\n // const coreAspectsComponentIds = coreAspectsStringIds.map((id) => ComponentID.fromString(id));\n // const aspectsIds = components.reduce((acc, curr) => {\n // const currIds = curr.state.aspects.ids;\n // acc = acc.concat(currIds);\n // return acc;\n // }, [] as any);\n // const otherDependenciesMap = components.reduce((acc, curr) => {\n // // const currIds = curr.state.dependencies.dependencies.map(dep => dep.id.toString());\n // const currMap = curr.state.dependencies.getIdsMap();\n // Object.assign(acc, currMap);\n // return acc;\n // }, {});\n\n // const depsWhichAreNotAspects = difference(Object.keys(otherDependenciesMap), aspectsIds);\n // const depsWhichAreNotAspectsBitIds = depsWhichAreNotAspects.map((strId) => otherDependenciesMap[strId]);\n // We only want to load into the graph components which are aspects and not regular dependencies\n // This come to solve a circular loop when an env aspect use an aspect (as regular dep) and the aspect use the env aspect as its env\n return this.workspace.buildOneGraphForComponents(ids, coreAspectsStringIds, isAspect);\n }\n\n /**\n * Load all unloaded extensions from an extension list\n * this will resolve the extensions from the scope aspects capsules if they are not in the ws\n * Only use it for component extensions\n * for workspace/scope root aspect use the load aspects directly\n *\n * The reason we are loading component extensions with \"scope aspects capsules\" is because for component extensions\n * we might have the same extension in multiple versions\n * (for example I might have 2 components using different versions of the same env)\n * in such case, I can't install both version into the root of the node_modules so I need to place it somewhere else (capsules)\n * @param extensions list of extensions with config to load\n */\n async loadComponentsExtensions(\n extensions: ExtensionDataList,\n originatedFrom?: ComponentID,\n opts: WorkspaceLoadAspectsOptions = {}\n ): Promise<void> {\n const defaultOpts: WorkspaceLoadAspectsOptions = {\n useScopeAspectsCapsule: true,\n throwOnError: false,\n hideMissingModuleError: !!this.workspace.inInstallContext,\n resolveEnvsFromRoots: this.resolveEnvsFromRoots,\n };\n const mergedOpts = { ...defaultOpts, ...opts };\n const extensionsIdsP = extensions.map(async (extensionEntry) => {\n // Core extension\n if (!extensionEntry.extensionId) {\n return extensionEntry.stringId as string;\n }\n\n const id = await this.workspace.resolveComponentId(extensionEntry.extensionId);\n // return this.resolveComponentId(extensionEntry.extensionId);\n return id.toString();\n });\n const extensionsIds: string[] = await Promise.all(extensionsIdsP);\n const harmonyExtensions = this.harmony.extensionsIds;\n const loadedExtensions = harmonyExtensions.filter((extId) => {\n return this.harmony.extensions.get(extId)?.loaded;\n });\n const extensionsToLoad = difference(extensionsIds, loadedExtensions);\n if (!extensionsToLoad.length) return;\n await this.loadAspects(extensionsToLoad, undefined, originatedFrom?.toString(), mergedOpts);\n }\n\n private async isAspect(id: ComponentID) {\n const component = await this.workspace.get(id);\n const isUsingAspectEnv = this.envs.isUsingAspectEnv(component);\n const isUsingEnvEnv = this.envs.isUsingEnvEnv(component);\n const isValidAspect = isUsingAspectEnv || isUsingEnvEnv;\n return isValidAspect;\n }\n\n /**\n * same as `this.importAndGetMany()` with a specific error handling of ComponentNotFound\n */\n private async importAndGetAspects(componentIds: ComponentID[], throwOnError = true): Promise<Component[]> {\n try {\n // We don't want to load the seeders as aspects as it will cause an infinite loop\n // once you try to load the seeder it will try to load the workspace component\n // that will arrive here again and again\n const loadOpts: ComponentLoadOptions = {\n idsToNotLoadAsAspects: componentIds.map((id) => id.toString()),\n };\n return await this.workspace.importAndGetMany(\n componentIds,\n 'to load aspects from the workspace',\n loadOpts,\n throwOnError\n );\n } catch (err: any) {\n this.throwWsJsoncAspectNotFoundError(err);\n\n throw err;\n }\n }\n\n /**\n * split the provided components into 2 groups, one which are workspace components and the other which are not.\n * @param components\n * @returns\n */\n private async groupComponentsByWorkspaceExistence(\n components: Component[],\n resolveEnvsFromRoots?: boolean\n ): Promise<{ workspaceComps: Component[]; nonWorkspaceComps: Component[] }> {\n let workspaceComps: Component[] = [];\n let nonWorkspaceComps: Component[] = [];\n await Promise.all(\n components.map(async (component) => {\n const existOnWorkspace = await this.workspace.hasId(component.id);\n existOnWorkspace ? workspaceComps.push(component) : nonWorkspaceComps.push(component);\n })\n );\n if (resolveEnvsFromRoots) {\n const { rootComps, nonRootComps } = await this.groupComponentsByLoadFromRootComps(nonWorkspaceComps);\n workspaceComps = workspaceComps.concat(rootComps);\n nonWorkspaceComps = nonRootComps;\n }\n return { workspaceComps, nonWorkspaceComps };\n }\n\n private async groupComponentsByLoadFromRootComps(\n components: Component[]\n ): Promise<{ rootComps: Component[]; nonRootComps: Component[] }> {\n const rootComps: Component[] = [];\n const nonRootComps: Component[] = [];\n await Promise.all(\n components.map(async (component) => {\n const shouldLoadFromRootComps = await this.shouldLoadFromRootComps(component);\n if (shouldLoadFromRootComps) {\n rootComps.push(component);\n return;\n }\n nonRootComps.push(component);\n })\n );\n return { rootComps, nonRootComps };\n }\n\n private async shouldLoadFromRootComps(component: Component): Promise<boolean> {\n const rootDir = await this.workspace.getComponentPackagePath(component);\n const rootDirExist = await fs.pathExists(rootDir);\n const aspectFilePath = await this.aspectLoader.getAspectFilePath(component, rootDir);\n const aspectFilePathExist = aspectFilePath ? await fs.pathExists(aspectFilePath) : false;\n const pluginFiles = await this.aspectLoader.getPluginFiles(component, rootDir);\n\n // checking that we have the root dir (this means it's an aspect that needs to be loaded from there)\n // and validate that localPathExist so we can\n // really load the component from that path (if it's there it means that it's an env)\n if (rootDirExist && (aspectFilePathExist || pluginFiles.length)) {\n return true;\n }\n // If the component has env.jsonc we want to list it to be loaded from the root folder\n // even if it's not there yet\n // in that case we will fail to load it, and the user will need to run bit install\n if (this.envs.hasEnvManifest(component)) {\n return true;\n }\n return false;\n }\n\n /**\n * split the provided components into 2 groups, one which are workspace components and the other which are not.\n * @param components\n * @returns\n */\n private async groupAspectDefsByWorkspaceExistence(\n aspectDefs: AspectDefinition[]\n ): Promise<{ workspaceDefs: AspectDefinition[]; nonWorkspaceDefs: AspectDefinition[] }> {\n const workspaceDefs: AspectDefinition[] = [];\n const nonWorkspaceDefs: AspectDefinition[] = [];\n await Promise.all(\n aspectDefs.map(async (aspectDef) => {\n const id = aspectDef.component?.id;\n const existOnWorkspace = id ? await this.workspace.hasId(id) : true;\n if (existOnWorkspace) {\n workspaceDefs.push(aspectDef);\n return;\n }\n const shouldLoadFromRootComps = aspectDef.component\n ? await this.shouldLoadFromRootComps(aspectDef.component)\n : undefined;\n if (shouldLoadFromRootComps) {\n workspaceDefs.push(aspectDef);\n return;\n }\n nonWorkspaceDefs.push(aspectDef);\n })\n );\n return { workspaceDefs, nonWorkspaceDefs };\n }\n\n private async groupIdsByWorkspaceExistence(\n ids: ComponentID[],\n resolveEnvsFromRoots?: boolean\n ): Promise<{ workspaceIds: ComponentID[]; nonWorkspaceIds: ComponentID[] }> {\n let workspaceIds: ComponentID[] = [];\n let nonWorkspaceIds: ComponentID[] = [];\n await Promise.all(\n ids.map(async (id) => {\n const existOnWorkspace = await this.workspace.hasId(id);\n existOnWorkspace ? workspaceIds.push(id) : nonWorkspaceIds.push(id);\n })\n );\n // We need to bring the components in order to really group them with taking the root comps into account\n const scopeComponents = await this.importAndGetAspects(nonWorkspaceIds);\n const { nonWorkspaceComps, workspaceComps } = await this.groupComponentsByWorkspaceExistence(\n scopeComponents,\n resolveEnvsFromRoots\n );\n workspaceIds = workspaceIds.concat(workspaceComps.map((c) => c.id));\n nonWorkspaceIds = nonWorkspaceComps.map((c) => c.id);\n return { workspaceIds, nonWorkspaceIds };\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,WAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,UAAA,YAAAA,CAAA;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I0C,YAA2B,GAAG,EAAE;IACpC,IAAIC,eAA8B,GAAG,EAAE;IACvC,MAAMyE,OAAO,CAACC,GAAG,CACf/G,GAAG,CAACqD,GAAG,CAAC,MAAO5B,EAAE,IAAK;MACpB,MAAM8O,gBAAgB,GAAG,MAAM,IAAI,CAACxR,SAAS,CAAC+L,KAAK,CAACrJ,EAAE,CAAC;MACvD8O,gBAAgB,GAAGnO,YAAY,CAAC9E,IAAI,CAACmE,EAAE,CAAC,GAAGY,eAAe,CAAC/E,IAAI,CAACmE,EAAE,CAAC;IACrE,CAAC,CACH,CAAC;IACD;IACA,MAAM0P,eAAe,GAAG,MAAM,IAAI,CAAC1K,mBAAmB,CAACpE,eAAe,CAAC;IACvE,MAAM;MAAEqG,iBAAiB;MAAED;IAAe,CAAC,GAAG,MAAM,IAAI,CAACE,mCAAmC,CAC1FwI,eAAe,EACfzR,oBACF,CAAC;IACD0C,YAAY,GAAGA,YAAY,CAAC2B,MAAM,CAAC0E,cAAc,CAACpF,GAAG,CAAEwF,CAAC,IAAKA,CAAC,CAACpH,EAAE,CAAC,CAAC;IACnEY,eAAe,GAAGqG,iBAAiB,CAACrF,GAAG,CAAEwF,CAAC,IAAKA,CAAC,CAACpH,EAAE,CAAC;IACpD,OAAO;MAAEW,YAAY;MAAEC;IAAgB,CAAC;EAC1C;AACF;AAAC+O,OAAA,CAAAvS,sBAAA,GAAAA,sBAAA","ignoreList":[]}
1
+ {"version":3,"names":["_constants","data","require","_findRoot","_interopRequireDefault","_toolboxModules","_aspectLoader","_cli","_fsExtra","_harmonyModules","_workspaceModules","_componentId","_exceptions","_pMapSeries","_lodash","_bitError","obj","__esModule","default","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","key","value","_toPropertyKey","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","WorkspaceAspectsLoader","constructor","workspace","scope","aspectLoader","envs","dependencyResolver","logger","globalConfig","harmony","onAspectsResolveSlot","onRootAspectAddedSlot","resolveAspectsFromNodeModules","resolveEnvsFromRoots","consumer","resolvedInstalledAspects","Map","hasRootComponents","loadAspects","ids","throwOnError","neededFor","opts","profile","calculatedThrowOnError","defaultOpts","useScopeAspectsCapsule","runSubscribers","skipDeps","hideMissingModuleError","inInstallContext","ignoreErrors","mergedOpts","callId","Math","floor","random","loggerPrefix","info","join","JSON","stringify","localAspects","nonLocalAspects","partition","id","startsWith","loadAspectFromPath","notLoadedIds","isAspectLoaded","coreAspectsStringIds","getCoreAspectIds","idsWithoutCore","difference","componentIds","resolveMultipleComponentIds","workspaceIds","nonWorkspaceIds","groupIdsByWorkspaceExistence","logFoundWorkspaceVsScope","idsToLoadFromWs","scopeAspectIds","loadFromScopeAspectsCapsule","aspectsDefs","resolveAspects","undefined","excludeCore","requestedOnly","manifests","requireableComponents","loadAspectDefsByOrder","potentialPluginsIndexes","compact","map","manifest","index","isValidAspect","pluginsRequireableComponents","pluginsManifests","getManifestsFromRequireableExtensions","loadExtensionsByManifests","debug","manifestIds","concat","currentLane","getCurrentLaneObject","nonWorkspaceIdsString","toString","packageManagerConfigRootDir","path","workspaceName","name","err","throwWsJsoncAspectNotFoundError","ComponentNotFound","config","get","configStr","workspaceConfig","raw","includes","BitError","seeders","nonWorkspaceDefs","groupAspectDefsByWorkspaceExistence","scopeAspectsLoader","getScopeAspectsLoader","scopeIds","aspectDef","getId","scopeIdsGrouped","groupAspectIdsByEnvOfTheList","aspectDefsToRequireableComponents","runtimeName","filterByRuntime","idsToResolve","extensionsIds","coreAspectsIds","configuredAspects","getConfiguredAspects","userAspectsIds","toStringWithoutVersion","rootAspectsIds","componentIdsToResolve","components","importAndGetAspects","runOnAspectsResolveFunctions","wsAspectDefs","getWorkspaceAspectResolver","coreAspectDefs","Promise","all","coreId","rawDef","getAspectDef","loadDefinition","idsToFilter","idStr","ComponentID","fromString","targetDefs","finalDefs","filterAspectDefs","groupedByIsPlugin","groupBy","component","hasPluginFiles","graph","getAspectsGraphWithoutCore","false","isAspect","bind","aspectsComponents","nodes","node","attr","true","workspaceComps","nonWorkspaceComps","groupComponentsByWorkspaceExistence","workspaceCompsIds","c","nonWorkspaceCompsIds","stringIds","linkIfMissingWorkspaceAspects","componentsToResolveFromScope","componentsToResolveFromInstalled","nonWorkspaceCompsGroups","isEnv","scopeAspectsDefs","installedAspectsDefs","getInstalledAspectResolver","coreAspect","runtimePath","localResolved","resolveLocalAspects","allDefsExceptLocal","withoutLocalAspects","aspectId","find","localAspect","allDefs","filteredDefs","shouldUseHashForCapsules","getSync","CFG_CAPSULES_BUILD_COMPONENTS_BASE_DIR","getCapsulePath","defaultPath","workspaceIdsStr","nonWorkspaceIdsStr","use","aspectIdStr","resolveComponentId","inWs","hasId","aspectIdToAdd","aspectsComponent","Error","setExtension","overrideExisting","ignoreVersion","write","reasonForChange","addInMemoryConfiguredAspect","runOnRootAspectAddedFunctions","getConfiguredUserAspectsPackages","options","componentsToGetPackages","externalsOnly","packages","aspectComponent","packageName","getPackageName","version","aspectDefs","localPath","aspectPath","requireFunc","plugins","getPlugins","has","load","MainRuntime","isModule","isEsmModule","aspect","loadEsm","getRuntimePath","RequireableComponent","aspects","idsToLink","isInWs","exist","fs","pathExists","idsToLinkWithoutNull","linkToNodeModulesByIds","workspaceAspectResolver","compStringId","getComponentPackagePath","aspectFilePath","getAspectFilePath","funcs","getOnAspectsResolveFunctions","pMapSeries","func","error","aspectsResolveFunctions","values","aspectsId","getOnRootAspectAddedFunctions","RootAspectAddedFunctions","rootIds","installedAspectsResolver","resolveInstalledAspectRecursively","aspectStringId","resolvedPath","set","parent","predecessors","parentPath","resolveFrom","findRoot","consoleWarning","message","buildOneGraphForComponents","loadComponentsExtensions","extensions","originatedFrom","extensionsIdsP","extensionEntry","extensionId","stringId","harmonyExtensions","loadedExtensions","extId","loaded","extensionsToLoad","isUsingAspectEnv","isUsingEnvEnv","loadOpts","idsToNotLoadAsAspects","importAndGetMany","existOnWorkspace","rootComps","nonRootComps","groupComponentsByLoadFromRootComps","shouldLoadFromRootComps","rootDir","rootDirExist","aspectFilePathExist","pluginFiles","getPluginFiles","hasEnvManifest","workspaceDefs","scopeComponents","exports"],"sources":["workspace-aspects-loader.ts"],"sourcesContent":["import { CFG_CAPSULES_BUILD_COMPONENTS_BASE_DIR } from '@teambit/legacy/dist/constants';\nimport { GlobalConfigMain } from '@teambit/global-config';\nimport findRoot from 'find-root';\nimport { resolveFrom } from '@teambit/toolbox.modules.module-resolver';\nimport { Graph } from '@teambit/graph.cleargraph';\nimport { ExtensionDataList } from '@teambit/legacy/dist/consumer/config/extension-data';\nimport { ExtensionManifest, Harmony, Aspect } from '@teambit/harmony';\nimport {\n AspectDefinition,\n AspectLoaderMain,\n AspectResolver,\n getAspectDef,\n ResolvedAspect,\n} from '@teambit/aspect-loader';\nimport { MainRuntime } from '@teambit/cli';\nimport fs from 'fs-extra';\nimport { RequireableComponent } from '@teambit/harmony.modules.requireable-component';\nimport { linkToNodeModulesByIds } from '@teambit/workspace.modules.node-modules-linker';\nimport { ComponentID } from '@teambit/component-id';\nimport { ComponentNotFound } from '@teambit/legacy/dist/scope/exceptions';\nimport pMapSeries from 'p-map-series';\nimport { difference, compact, groupBy, partition } from 'lodash';\nimport { Consumer } from '@teambit/legacy/dist/consumer';\nimport { Component, LoadAspectsOptions, ResolveAspectsOptions } from '@teambit/component';\nimport { ScopeMain } from '@teambit/scope';\nimport { Logger } from '@teambit/logger';\nimport { BitError } from '@teambit/bit-error';\nimport { EnvsMain } from '@teambit/envs';\nimport { ConfigMain } from '@teambit/config';\nimport { DependencyResolverMain } from '@teambit/dependency-resolver';\nimport { ShouldLoadFunc } from './build-graph-from-fs';\nimport type { Workspace } from './workspace';\nimport {\n OnAspectsResolve,\n OnAspectsResolveSlot,\n OnRootAspectAdded,\n OnRootAspectAddedSlot,\n} from './workspace.main.runtime';\nimport { ComponentLoadOptions } from './workspace-component/workspace-component-loader';\n\nexport type GetConfiguredUserAspectsPackagesOptions = {\n externalsOnly?: boolean;\n};\n\nexport type WorkspaceLoadAspectsOptions = LoadAspectsOptions & {\n useScopeAspectsCapsule?: boolean;\n runSubscribers?: boolean;\n skipDeps?: boolean;\n resolveEnvsFromRoots?: boolean;\n};\n\nexport type AspectPackage = { packageName: string; version: string };\n\nexport class WorkspaceAspectsLoader {\n private consumer: Consumer;\n private resolvedInstalledAspects: Map<string, string | null>;\n\n constructor(\n private workspace: Workspace,\n private scope: ScopeMain,\n private aspectLoader: AspectLoaderMain,\n private envs: EnvsMain,\n private dependencyResolver: DependencyResolverMain,\n private logger: Logger,\n private globalConfig: GlobalConfigMain,\n private harmony: Harmony,\n private onAspectsResolveSlot: OnAspectsResolveSlot,\n private onRootAspectAddedSlot: OnRootAspectAddedSlot,\n private resolveAspectsFromNodeModules = false,\n private resolveEnvsFromRoots = false\n ) {\n this.consumer = this.workspace.consumer;\n this.resolvedInstalledAspects = new Map();\n // Only enable this when root components is enabled as well\n this.resolveEnvsFromRoots = this.resolveEnvsFromRoots && this.dependencyResolver.hasRootComponents();\n }\n\n /**\n * load aspects from the workspace and if not exists in the workspace, load from the node_modules.\n * keep in mind that the graph may have circles.\n */\n async loadAspects(\n ids: string[] = [],\n throwOnError?: boolean,\n neededFor?: string,\n opts: WorkspaceLoadAspectsOptions = {}\n ): Promise<string[]> {\n this.logger.profile('workspace.loadAspects');\n const calculatedThrowOnError: boolean = throwOnError ?? false;\n const defaultOpts: Required<WorkspaceLoadAspectsOptions> = {\n useScopeAspectsCapsule: false,\n throwOnError: calculatedThrowOnError,\n runSubscribers: true,\n skipDeps: false,\n hideMissingModuleError: !!this.workspace.inInstallContext,\n ignoreErrors: false,\n resolveEnvsFromRoots: this.resolveEnvsFromRoots,\n };\n const mergedOpts: Required<WorkspaceLoadAspectsOptions> = { ...defaultOpts, ...opts };\n\n // generate a random callId to be able to identify the call from the logs\n const callId = Math.floor(Math.random() * 1000);\n const loggerPrefix = `[${callId}] loadAspects,`;\n this.logger.info(`${loggerPrefix} loading ${ids.length} aspects.\nids: ${ids.join(', ')}\nneeded-for: ${neededFor || '<unknown>'}. using opts: ${JSON.stringify(mergedOpts, null, 2)}`);\n const [localAspects, nonLocalAspects] = partition(ids, (id) => id.startsWith('file:'));\n this.workspace.localAspects = localAspects;\n await this.aspectLoader.loadAspectFromPath(this.workspace.localAspects);\n const notLoadedIds = nonLocalAspects.filter((id) => !this.aspectLoader.isAspectLoaded(id));\n if (!notLoadedIds.length) {\n this.logger.profile('workspace.loadAspects');\n return [];\n }\n const coreAspectsStringIds = this.aspectLoader.getCoreAspectIds();\n const idsWithoutCore: string[] = difference(notLoadedIds, coreAspectsStringIds);\n\n const componentIds = await this.workspace.resolveMultipleComponentIds(idsWithoutCore);\n\n const { workspaceIds, nonWorkspaceIds } = await this.groupIdsByWorkspaceExistence(\n componentIds,\n mergedOpts.resolveEnvsFromRoots\n );\n\n this.logFoundWorkspaceVsScope(loggerPrefix, workspaceIds, nonWorkspaceIds);\n let idsToLoadFromWs = componentIds;\n let scopeAspectIds: string[] = [];\n\n // TODO: hard coded use the old approach and loading from the scope capsules\n // This is because right now loading from the ws node_modules causes issues in some cases\n // like for the cloud app\n // it should be removed once we fix the issues\n if (!this.resolveAspectsFromNodeModules) {\n mergedOpts.useScopeAspectsCapsule = true;\n }\n\n if (mergedOpts.useScopeAspectsCapsule) {\n idsToLoadFromWs = workspaceIds;\n scopeAspectIds = await this.loadFromScopeAspectsCapsule(nonWorkspaceIds, throwOnError, neededFor);\n }\n\n const aspectsDefs = await this.resolveAspects(undefined, idsToLoadFromWs, {\n excludeCore: true,\n requestedOnly: false,\n ...mergedOpts,\n });\n\n const { manifests, requireableComponents } = await this.loadAspectDefsByOrder(\n aspectsDefs,\n idsWithoutCore,\n mergedOpts.throwOnError,\n mergedOpts.hideMissingModuleError,\n neededFor,\n mergedOpts.runSubscribers\n );\n\n const potentialPluginsIndexes = compact(\n manifests.map((manifest, index) => {\n if (this.aspectLoader.isValidAspect(manifest)) return undefined;\n return index;\n })\n );\n\n // Try require components for potential plugins\n const pluginsRequireableComponents = potentialPluginsIndexes.map((index) => {\n return requireableComponents[index];\n });\n // Do the require again now that the plugins defs already registered\n const pluginsManifests = await this.aspectLoader.getManifestsFromRequireableExtensions(\n pluginsRequireableComponents,\n throwOnError,\n opts.runSubscribers\n );\n\n await this.aspectLoader.loadExtensionsByManifests(pluginsManifests, undefined, { throwOnError });\n this.logger.debug(`${loggerPrefix} finish loading aspects`);\n const manifestIds = manifests.map((manifest) => manifest.id);\n this.logger.profile('workspace.loadAspects');\n return compact(manifestIds.concat(scopeAspectIds));\n }\n\n private async loadFromScopeAspectsCapsule(ids: ComponentID[], throwOnError?: boolean, neededFor?: string) {\n let scopeAspectIds: string[] = [];\n const currentLane = await this.consumer.getCurrentLaneObject();\n\n if (!ids.length) return [];\n\n const nonWorkspaceIdsString = ids.map((id) => id.toString());\n try {\n scopeAspectIds = await this.scope.loadAspects(\n nonWorkspaceIdsString,\n throwOnError,\n neededFor,\n currentLane || undefined,\n {\n packageManagerConfigRootDir: this.workspace.path,\n workspaceName: this.workspace.name,\n }\n );\n return scopeAspectIds;\n } catch (err: any) {\n this.throwWsJsoncAspectNotFoundError(err);\n return scopeAspectIds;\n\n throw err;\n }\n }\n\n throwWsJsoncAspectNotFoundError(err: any) {\n if (err instanceof ComponentNotFound) {\n const config = this.harmony.get<ConfigMain>('teambit.harmony/config');\n const configStr = JSON.stringify(config.workspaceConfig?.raw || {});\n if (configStr.includes(err.id)) {\n throw new BitError(`error: a component \"${err.id}\" was not found\nyour workspace.jsonc has this component-id set. you might want to remove/change it.`);\n }\n }\n }\n\n private async loadAspectDefsByOrder(\n aspectsDefs: AspectDefinition[],\n seeders: string[],\n throwOnError: boolean,\n hideMissingModuleError: boolean,\n neededFor?: string,\n runSubscribers = true\n ): Promise<{ manifests: Array<Aspect | ExtensionManifest>; requireableComponents: RequireableComponent[] }> {\n const { nonWorkspaceDefs } = await this.groupAspectDefsByWorkspaceExistence(aspectsDefs);\n const scopeAspectsLoader = this.scope.getScopeAspectsLoader();\n const scopeIds: string[] = compact(nonWorkspaceDefs.map((aspectDef) => aspectDef.getId));\n const scopeIdsGrouped = await scopeAspectsLoader.groupAspectIdsByEnvOfTheList(scopeIds);\n\n // Make sure to first load envs from the list otherwise it will fail when trying to load other aspects\n // as their envs might not be loaded yet\n if (scopeIdsGrouped.envs && scopeIdsGrouped.envs.length && !runSubscribers) {\n await this.scope.loadAspects(scopeIdsGrouped.envs, throwOnError, 'workspace.loadAspects loading scope aspects');\n }\n const requireableComponents = this.aspectDefsToRequireableComponents(aspectsDefs);\n const manifests = await this.aspectLoader.getManifestsFromRequireableExtensions(\n requireableComponents,\n throwOnError,\n runSubscribers\n );\n await this.aspectLoader.loadExtensionsByManifests(\n manifests,\n { seeders, neededFor },\n { throwOnError, hideMissingModuleError }\n );\n return { manifests, requireableComponents };\n }\n\n async resolveAspects(\n runtimeName?: string,\n componentIds?: ComponentID[],\n opts?: ResolveAspectsOptions\n ): Promise<AspectDefinition[]> {\n const callId = Math.floor(Math.random() * 1000);\n const loggerPrefix = `[${callId}] workspace resolveAspects,`;\n\n this.logger.debug(\n `${loggerPrefix}, resolving aspects for - runtimeName: ${runtimeName}, componentIds: ${componentIds}`\n );\n const defaultOpts: ResolveAspectsOptions = {\n excludeCore: false,\n requestedOnly: false,\n filterByRuntime: true,\n useScopeAspectsCapsule: false,\n workspaceName: this.workspace.name,\n resolveEnvsFromRoots: this.resolveEnvsFromRoots,\n packageManagerConfigRootDir: this.workspace.path,\n };\n const mergedOpts = { ...defaultOpts, ...opts };\n const idsToResolve = componentIds ? componentIds.map((id) => id.toString()) : this.harmony.extensionsIds;\n const coreAspectsIds = this.aspectLoader.getCoreAspectIds();\n const configuredAspects = this.aspectLoader.getConfiguredAspects();\n // it's possible that componentIds are core-aspects that got version for some reason, remove the version to\n // correctly filter them out later.\n const userAspectsIds: string[] = componentIds\n ? componentIds.filter((id) => !coreAspectsIds.includes(id.toStringWithoutVersion())).map((id) => id.toString())\n : difference(this.harmony.extensionsIds, coreAspectsIds);\n const rootAspectsIds: string[] = difference(configuredAspects, coreAspectsIds);\n const componentIdsToResolve = await this.workspace.resolveMultipleComponentIds(userAspectsIds);\n const components = await this.importAndGetAspects(componentIdsToResolve, opts?.throwOnError);\n // Run the on load slot\n await this.runOnAspectsResolveFunctions(components);\n\n if (opts?.skipDeps) {\n const wsAspectDefs = await this.aspectLoader.resolveAspects(\n components,\n this.getWorkspaceAspectResolver([], runtimeName)\n );\n\n const coreAspectDefs = await Promise.all(\n coreAspectsIds.map(async (coreId) => {\n const rawDef = await getAspectDef(coreId, runtimeName);\n return this.aspectLoader.loadDefinition(rawDef);\n })\n );\n\n const idsToFilter = idsToResolve.map((idStr) => ComponentID.fromString(idStr));\n const targetDefs = wsAspectDefs.concat(coreAspectDefs);\n const finalDefs = this.aspectLoader.filterAspectDefs(targetDefs, idsToFilter, runtimeName, mergedOpts);\n\n return finalDefs;\n }\n\n const groupedByIsPlugin = groupBy(components, (component) => {\n return this.aspectLoader.hasPluginFiles(component);\n });\n const graph = await this.getAspectsGraphWithoutCore(groupedByIsPlugin.false, this.isAspect.bind(this));\n const aspectsComponents = graph.nodes.map((node) => node.attr).concat(groupedByIsPlugin.true || []);\n this.logger.debug(`${loggerPrefix} found ${aspectsComponents.length} aspects in the aspects-graph`);\n const { workspaceComps, nonWorkspaceComps } = await this.groupComponentsByWorkspaceExistence(\n aspectsComponents,\n mergedOpts.resolveEnvsFromRoots\n );\n\n const workspaceCompsIds = workspaceComps.map((c) => c.id);\n const nonWorkspaceCompsIds = nonWorkspaceComps.map((c) => c.id);\n this.logFoundWorkspaceVsScope(loggerPrefix, workspaceCompsIds, nonWorkspaceCompsIds);\n\n const stringIds: string[] = [];\n const wsAspectDefs = await this.aspectLoader.resolveAspects(\n workspaceComps,\n this.getWorkspaceAspectResolver(stringIds, runtimeName)\n );\n\n await this.linkIfMissingWorkspaceAspects(wsAspectDefs);\n\n // TODO: hard coded use the old approach and loading from the scope capsules\n // This is because right now loading from the ws node_modules causes issues in some cases\n // like for the cloud app\n // it should be removed once we fix the issues\n if (!this.resolveAspectsFromNodeModules) {\n mergedOpts.useScopeAspectsCapsule = true;\n }\n\n let componentsToResolveFromScope = nonWorkspaceComps;\n let componentsToResolveFromInstalled: Component[] = [];\n if (!mergedOpts.useScopeAspectsCapsule) {\n const nonWorkspaceCompsGroups = groupBy(nonWorkspaceComps, (component) => this.envs.isEnv(component));\n componentsToResolveFromScope = nonWorkspaceCompsGroups.true || [];\n componentsToResolveFromInstalled = nonWorkspaceCompsGroups.false || [];\n }\n\n const scopeIds = componentsToResolveFromScope.map((c) => c.id);\n this.logger.debug(\n `${loggerPrefix} ${\n scopeIds.length\n } components are not in the workspace and are loaded from the scope capsules:\\n${scopeIds\n .map((id) => id.toString())\n .join('\\n')}`\n );\n const scopeAspectsDefs: AspectDefinition[] = scopeIds.length\n ? await this.scope.resolveAspects(runtimeName, scopeIds, mergedOpts)\n : [];\n\n this.logger.debug(\n `${loggerPrefix} ${\n componentsToResolveFromInstalled.length\n } components are not in the workspace and are loaded from the node_modules:\\n${componentsToResolveFromInstalled\n .map((c) => c.id.toString())\n .join('\\n')}`\n );\n const installedAspectsDefs: AspectDefinition[] = componentsToResolveFromInstalled.length\n ? await this.aspectLoader.resolveAspects(\n componentsToResolveFromInstalled,\n this.getInstalledAspectResolver(graph, rootAspectsIds, runtimeName, {\n throwOnError: opts?.throwOnError ?? false,\n })\n )\n : [];\n\n let coreAspectDefs = await Promise.all(\n coreAspectsIds.map(async (coreId) => {\n const rawDef = await getAspectDef(coreId, runtimeName);\n return this.aspectLoader.loadDefinition(rawDef);\n })\n );\n\n // due to lack of workspace and scope runtimes. TODO: fix after adding them.\n if (runtimeName && mergedOpts.filterByRuntime) {\n coreAspectDefs = coreAspectDefs.filter((coreAspect) => {\n return coreAspect.runtimePath;\n });\n }\n const localResolved = await this.aspectLoader.resolveLocalAspects(this.workspace.localAspects, runtimeName);\n const allDefsExceptLocal = [...wsAspectDefs, ...coreAspectDefs, ...scopeAspectsDefs, ...installedAspectsDefs];\n const withoutLocalAspects = allDefsExceptLocal.filter((aspectId) => {\n return !localResolved.find((localAspect) => {\n return localAspect.id === aspectId.component?.id?.toStringWithoutVersion();\n });\n });\n const allDefs = [...withoutLocalAspects, ...localResolved];\n const idsToFilter = idsToResolve.map((idStr) => ComponentID.fromString(idStr));\n const filteredDefs = this.aspectLoader.filterAspectDefs(allDefs, idsToFilter, runtimeName, mergedOpts);\n return filteredDefs;\n }\n\n shouldUseHashForCapsules(): boolean {\n return !this.globalConfig.getSync(CFG_CAPSULES_BUILD_COMPONENTS_BASE_DIR);\n }\n\n getCapsulePath() {\n const defaultPath = this.workspace.path;\n return this.globalConfig.getSync(CFG_CAPSULES_BUILD_COMPONENTS_BASE_DIR) || defaultPath;\n }\n\n private logFoundWorkspaceVsScope(loggerPrefix: string, workspaceIds: ComponentID[], nonWorkspaceIds: ComponentID[]) {\n const workspaceIdsStr = workspaceIds.length ? workspaceIds.map((id) => id.toString()).join('\\n') : '';\n const nonWorkspaceIdsStr = nonWorkspaceIds.length ? nonWorkspaceIds.map((id) => id.toString()).join('\\n') : '';\n this.logger.debug(\n `${loggerPrefix} found ${workspaceIds.length} components in the workspace, ${nonWorkspaceIds.length} not in the workspace`\n );\n if (workspaceIdsStr) this.logger.debug(`${loggerPrefix} workspace components:\\n${workspaceIdsStr}`);\n if (nonWorkspaceIdsStr)\n this.logger.debug(\n `${loggerPrefix} non workspace components (loaded from the scope capsules or from the node_modules):\\n${nonWorkspaceIdsStr}`\n );\n }\n\n async use(aspectIdStr: string): Promise<string> {\n let aspectId = await this.workspace.resolveComponentId(aspectIdStr);\n const inWs = await this.workspace.hasId(aspectId);\n let aspectIdToAdd = aspectId.toStringWithoutVersion();\n\n let aspectsComponent;\n // let aspectPackage;\n if (!inWs) {\n const aspectsComponents = await this.importAndGetAspects([aspectId]);\n if (aspectsComponents[0]) {\n aspectsComponent = aspectsComponents[0];\n aspectId = aspectsComponent.id;\n aspectIdToAdd = aspectId.toString();\n }\n }\n\n const config = this.harmony.get<ConfigMain>('teambit.harmony/config').workspaceConfig;\n if (!config) {\n throw new Error(`use() unable to get the workspace config`);\n }\n config.setExtension(\n aspectIdToAdd,\n {},\n {\n overrideExisting: false,\n ignoreVersion: false,\n }\n );\n await config.write({ reasonForChange: `use (${aspectIdStr})` });\n this.aspectLoader.addInMemoryConfiguredAspect(aspectIdToAdd);\n await this.runOnRootAspectAddedFunctions(aspectId, inWs);\n return aspectIdToAdd;\n }\n\n async getConfiguredUserAspectsPackages(\n options: GetConfiguredUserAspectsPackagesOptions = {}\n ): Promise<AspectPackage[]> {\n const configuredAspects = this.aspectLoader.getConfiguredAspects();\n const coreAspectsIds = this.aspectLoader.getCoreAspectIds();\n const userAspectsIds: string[] = difference(configuredAspects, coreAspectsIds);\n const componentIdsToResolve = await this.workspace.resolveMultipleComponentIds(\n userAspectsIds.filter((id) => !id.startsWith('file:'))\n );\n const aspectsComponents = await this.importAndGetAspects(componentIdsToResolve);\n let componentsToGetPackages = aspectsComponents;\n if (options.externalsOnly) {\n const { nonWorkspaceComps } = await this.groupComponentsByWorkspaceExistence(aspectsComponents);\n componentsToGetPackages = nonWorkspaceComps;\n }\n const packages = componentsToGetPackages.map((aspectComponent) => {\n const packageName = this.dependencyResolver.getPackageName(aspectComponent);\n const version = aspectComponent.id.version || '*';\n return { packageName, version };\n });\n return packages;\n }\n\n private aspectDefsToRequireableComponents(aspectDefs: AspectDefinition[]): RequireableComponent[] {\n const requireableComponents = aspectDefs.map((aspectDef) => {\n const localPath = aspectDef.aspectPath;\n const component = aspectDef.component;\n if (!component) return undefined;\n const requireFunc = async () => {\n const plugins = this.aspectLoader.getPlugins(component, localPath);\n if (plugins.has()) {\n return plugins.load(MainRuntime.name);\n }\n\n const isModule = await this.aspectLoader.isEsmModule(localPath);\n\n const aspect = !isModule\n ? // eslint-disable-next-line global-require, import/no-dynamic-require\n require(localPath)\n : // : await this.aspectLoader.loadEsm(join(localPath, 'dist', 'index.js'));\n await this.aspectLoader.loadEsm(localPath);\n\n // require aspect runtimes\n const runtimePath = await this.aspectLoader.getRuntimePath(component, localPath, MainRuntime.name);\n if (runtimePath) {\n if (isModule) await this.aspectLoader.loadEsm(runtimePath);\n // eslint-disable-next-line global-require, import/no-dynamic-require\n require(runtimePath);\n }\n return aspect;\n };\n return new RequireableComponent(component, requireFunc);\n });\n return compact(requireableComponents);\n }\n\n private async linkIfMissingWorkspaceAspects(aspects: AspectDefinition[]) {\n const idsToLink = await Promise.all(\n aspects.map(async (aspect) => {\n if (!aspect.component)\n throw new Error(`linkIfMissingWorkspaceAspects, aspect.component is missing for ${aspect.aspectPath}`);\n const isInWs = await this.workspace.hasId(aspect.component.id);\n if (!isInWs) return null;\n const exist = await fs.pathExists(aspect.aspectPath);\n if (!exist) return aspect.component.id;\n return null;\n })\n );\n const idsToLinkWithoutNull = compact(idsToLink);\n if (!idsToLinkWithoutNull.length) return;\n await linkToNodeModulesByIds(this.workspace, idsToLinkWithoutNull);\n }\n\n /**\n * This will return a resolver that knows to resolve aspects which are part of the workspace.\n * means aspects exist in the bitmap file\n * @param stringIds\n * @param runtimeName\n * @returns\n */\n private getWorkspaceAspectResolver(stringIds: string[], runtimeName?: string): AspectResolver {\n const workspaceAspectResolver = async (component: Component): Promise<ResolvedAspect> => {\n const compStringId = component.id.toString();\n stringIds.push(compStringId);\n const localPath = await this.workspace.getComponentPackagePath(component);\n\n const runtimePath = runtimeName\n ? await this.aspectLoader.getRuntimePath(component, localPath, runtimeName)\n : null;\n\n const aspectFilePath = await this.aspectLoader.getAspectFilePath(component, localPath);\n\n this.logger.debug(\n `workspace resolveAspects, resolving id: ${compStringId}, localPath: ${localPath}, runtimePath: ${runtimePath}`\n );\n return {\n aspectPath: localPath,\n aspectFilePath,\n runtimePath,\n };\n };\n return workspaceAspectResolver;\n }\n\n private async runOnAspectsResolveFunctions(aspectsComponents: Component[]): Promise<void> {\n const funcs = this.getOnAspectsResolveFunctions();\n await pMapSeries(funcs, async (func) => {\n try {\n await func(aspectsComponents);\n } catch (err) {\n this.logger.error('failed running onAspectsResolve function', err);\n }\n });\n }\n\n private getOnAspectsResolveFunctions(): OnAspectsResolve[] {\n const aspectsResolveFunctions = this.onAspectsResolveSlot.values();\n return aspectsResolveFunctions;\n }\n\n private async runOnRootAspectAddedFunctions(aspectsId: ComponentID, inWs: boolean): Promise<void> {\n const funcs = this.getOnRootAspectAddedFunctions();\n await pMapSeries(funcs, async (func) => {\n try {\n await func(aspectsId, inWs);\n } catch (err) {\n this.logger.error('failed running onRootAspectAdded function', err);\n }\n });\n }\n\n private getOnRootAspectAddedFunctions(): OnRootAspectAdded[] {\n const RootAspectAddedFunctions = this.onRootAspectAddedSlot.values();\n return RootAspectAddedFunctions;\n }\n\n /**\n * This will return a resolver that knows to resolve aspects which are not part of the workspace.\n * means aspects that does not exist in the bitmap file\n * instead it will resolve them from the node_modules recursively\n * @param graph\n * @param rootIds\n * @param runtimeName\n * @returns\n */\n private getInstalledAspectResolver(\n graph: Graph<Component, string>,\n rootIds: string[],\n runtimeName?: string,\n opts: { throwOnError: boolean } = { throwOnError: false }\n ): AspectResolver {\n const installedAspectsResolver = async (component: Component): Promise<ResolvedAspect | undefined> => {\n const compStringId = component.id.toString();\n // stringIds.push(compStringId);\n const localPath = await this.resolveInstalledAspectRecursively(component, rootIds, graph, opts);\n if (!localPath) return undefined;\n\n const runtimePath = runtimeName\n ? await this.aspectLoader.getRuntimePath(component, localPath, runtimeName)\n : null;\n\n const aspectFilePath = await this.aspectLoader.getAspectFilePath(component, localPath);\n\n this.logger.debug(\n `workspace resolveInstalledAspects, resolving id: ${compStringId}, localPath: ${localPath}, runtimePath: ${runtimePath}`\n );\n return {\n aspectPath: localPath,\n aspectFilePath,\n runtimePath,\n };\n };\n return installedAspectsResolver;\n }\n\n private async resolveInstalledAspectRecursively(\n aspectComponent: Component,\n rootIds: string[],\n graph: Graph<Component, string>,\n opts: { throwOnError: boolean } = { throwOnError: false }\n ): Promise<string | null | undefined> {\n const aspectStringId = aspectComponent.id.toString();\n if (this.resolvedInstalledAspects.has(aspectStringId)) {\n const resolvedPath = this.resolvedInstalledAspects.get(aspectStringId);\n return resolvedPath;\n }\n if (rootIds.includes(aspectStringId)) {\n const localPath = await this.workspace.getComponentPackagePath(aspectComponent);\n this.resolvedInstalledAspects.set(aspectStringId, localPath);\n return localPath;\n }\n const parent = graph.predecessors(aspectStringId)[0];\n if (!parent) return undefined;\n const parentPath = await this.resolveInstalledAspectRecursively(parent.attr, rootIds, graph);\n if (!parentPath) {\n this.resolvedInstalledAspects.set(aspectStringId, null);\n return undefined;\n }\n const packageName = this.dependencyResolver.getPackageName(aspectComponent);\n try {\n const resolvedPath = resolveFrom(parentPath, [packageName]);\n const localPath = findRoot(resolvedPath);\n this.resolvedInstalledAspects.set(aspectStringId, localPath);\n return localPath;\n } catch (error: any) {\n this.resolvedInstalledAspects.set(aspectStringId, null);\n if (opts.throwOnError) {\n throw error;\n }\n this.logger.consoleWarning(\n `failed resolving aspect ${aspectStringId} from ${parentPath}, error: ${error.message}`\n );\n return undefined;\n }\n }\n\n /**\n * Create a graph of aspects without the core aspects.\n * @param components\n * @param isAspect\n * @returns\n */\n private async getAspectsGraphWithoutCore(\n components: Component[] = [],\n isAspect?: ShouldLoadFunc\n ): Promise<Graph<Component, string>> {\n const ids = components.map((component) => component.id);\n const coreAspectsStringIds = this.aspectLoader.getCoreAspectIds();\n // TODO: @gilad it causes many issues we need to find a better solution. removed for now.\n // const coreAspectsComponentIds = coreAspectsStringIds.map((id) => ComponentID.fromString(id));\n // const aspectsIds = components.reduce((acc, curr) => {\n // const currIds = curr.state.aspects.ids;\n // acc = acc.concat(currIds);\n // return acc;\n // }, [] as any);\n // const otherDependenciesMap = components.reduce((acc, curr) => {\n // // const currIds = curr.state.dependencies.dependencies.map(dep => dep.id.toString());\n // const currMap = curr.state.dependencies.getIdsMap();\n // Object.assign(acc, currMap);\n // return acc;\n // }, {});\n\n // const depsWhichAreNotAspects = difference(Object.keys(otherDependenciesMap), aspectsIds);\n // const depsWhichAreNotAspectsBitIds = depsWhichAreNotAspects.map((strId) => otherDependenciesMap[strId]);\n // We only want to load into the graph components which are aspects and not regular dependencies\n // This come to solve a circular loop when an env aspect use an aspect (as regular dep) and the aspect use the env aspect as its env\n return this.workspace.buildOneGraphForComponents(ids, coreAspectsStringIds, isAspect);\n }\n\n /**\n * Load all unloaded extensions from an extension list\n * this will resolve the extensions from the scope aspects capsules if they are not in the ws\n * Only use it for component extensions\n * for workspace/scope root aspect use the load aspects directly\n *\n * The reason we are loading component extensions with \"scope aspects capsules\" is because for component extensions\n * we might have the same extension in multiple versions\n * (for example I might have 2 components using different versions of the same env)\n * in such case, I can't install both version into the root of the node_modules so I need to place it somewhere else (capsules)\n * @param extensions list of extensions with config to load\n */\n async loadComponentsExtensions(\n extensions: ExtensionDataList,\n originatedFrom?: ComponentID,\n opts: WorkspaceLoadAspectsOptions = {}\n ): Promise<void> {\n const defaultOpts: WorkspaceLoadAspectsOptions = {\n useScopeAspectsCapsule: true,\n throwOnError: false,\n hideMissingModuleError: !!this.workspace.inInstallContext,\n resolveEnvsFromRoots: this.resolveEnvsFromRoots,\n };\n const mergedOpts = { ...defaultOpts, ...opts };\n const extensionsIdsP = extensions.map(async (extensionEntry) => {\n // Core extension\n if (!extensionEntry.extensionId) {\n return extensionEntry.stringId as string;\n }\n\n const id = await this.workspace.resolveComponentId(extensionEntry.extensionId);\n // return this.resolveComponentId(extensionEntry.extensionId);\n return id.toString();\n });\n const extensionsIds: string[] = await Promise.all(extensionsIdsP);\n const harmonyExtensions = this.harmony.extensionsIds;\n const loadedExtensions = harmonyExtensions.filter((extId) => {\n return this.harmony.extensions.get(extId)?.loaded;\n });\n const extensionsToLoad = difference(extensionsIds, loadedExtensions);\n if (!extensionsToLoad.length) return;\n await this.loadAspects(extensionsToLoad, undefined, originatedFrom?.toString(), mergedOpts);\n }\n\n private async isAspect(id: ComponentID) {\n const component = await this.workspace.get(id);\n const isUsingAspectEnv = this.envs.isUsingAspectEnv(component);\n const isUsingEnvEnv = this.envs.isUsingEnvEnv(component);\n const isValidAspect = isUsingAspectEnv || isUsingEnvEnv;\n return isValidAspect;\n }\n\n /**\n * same as `this.importAndGetMany()` with a specific error handling of ComponentNotFound\n */\n private async importAndGetAspects(componentIds: ComponentID[], throwOnError = true): Promise<Component[]> {\n try {\n // We don't want to load the seeders as aspects as it will cause an infinite loop\n // once you try to load the seeder it will try to load the workspace component\n // that will arrive here again and again\n const loadOpts: ComponentLoadOptions = {\n idsToNotLoadAsAspects: componentIds.map((id) => id.toString()),\n };\n return await this.workspace.importAndGetMany(\n componentIds,\n 'to load aspects from the workspace',\n loadOpts,\n throwOnError\n );\n } catch (err: any) {\n this.throwWsJsoncAspectNotFoundError(err);\n\n throw err;\n }\n }\n\n /**\n * split the provided components into 2 groups, one which are workspace components and the other which are not.\n * @param components\n * @returns\n */\n private async groupComponentsByWorkspaceExistence(\n components: Component[],\n resolveEnvsFromRoots?: boolean\n ): Promise<{ workspaceComps: Component[]; nonWorkspaceComps: Component[] }> {\n let workspaceComps: Component[] = [];\n let nonWorkspaceComps: Component[] = [];\n await Promise.all(\n components.map(async (component) => {\n const existOnWorkspace = await this.workspace.hasId(component.id);\n existOnWorkspace ? workspaceComps.push(component) : nonWorkspaceComps.push(component);\n })\n );\n if (resolveEnvsFromRoots) {\n const { rootComps, nonRootComps } = await this.groupComponentsByLoadFromRootComps(nonWorkspaceComps);\n workspaceComps = workspaceComps.concat(rootComps);\n nonWorkspaceComps = nonRootComps;\n }\n return { workspaceComps, nonWorkspaceComps };\n }\n\n private async groupComponentsByLoadFromRootComps(\n components: Component[]\n ): Promise<{ rootComps: Component[]; nonRootComps: Component[] }> {\n const rootComps: Component[] = [];\n const nonRootComps: Component[] = [];\n await Promise.all(\n components.map(async (component) => {\n const shouldLoadFromRootComps = await this.shouldLoadFromRootComps(component);\n if (shouldLoadFromRootComps) {\n rootComps.push(component);\n return;\n }\n nonRootComps.push(component);\n })\n );\n return { rootComps, nonRootComps };\n }\n\n private async shouldLoadFromRootComps(component: Component): Promise<boolean> {\n const rootDir = await this.workspace.getComponentPackagePath(component);\n const rootDirExist = await fs.pathExists(rootDir);\n const aspectFilePath = await this.aspectLoader.getAspectFilePath(component, rootDir);\n const aspectFilePathExist = aspectFilePath ? await fs.pathExists(aspectFilePath) : false;\n const pluginFiles = await this.aspectLoader.getPluginFiles(component, rootDir);\n\n // checking that we have the root dir (this means it's an aspect that needs to be loaded from there)\n // and validate that localPathExist so we can\n // really load the component from that path (if it's there it means that it's an env)\n if (rootDirExist && (aspectFilePathExist || pluginFiles.length)) {\n return true;\n }\n // If the component has env.jsonc we want to list it to be loaded from the root folder\n // even if it's not there yet\n // in that case we will fail to load it, and the user will need to run bit install\n if (this.envs.hasEnvManifest(component)) {\n return true;\n }\n return false;\n }\n\n /**\n * split the provided components into 2 groups, one which are workspace components and the other which are not.\n * @param components\n * @returns\n */\n private async groupAspectDefsByWorkspaceExistence(\n aspectDefs: AspectDefinition[]\n ): Promise<{ workspaceDefs: AspectDefinition[]; nonWorkspaceDefs: AspectDefinition[] }> {\n const workspaceDefs: AspectDefinition[] = [];\n const nonWorkspaceDefs: AspectDefinition[] = [];\n await Promise.all(\n aspectDefs.map(async (aspectDef) => {\n const id = aspectDef.component?.id;\n const existOnWorkspace = id ? await this.workspace.hasId(id) : true;\n if (existOnWorkspace) {\n workspaceDefs.push(aspectDef);\n return;\n }\n const shouldLoadFromRootComps = aspectDef.component\n ? await this.shouldLoadFromRootComps(aspectDef.component)\n : undefined;\n if (shouldLoadFromRootComps) {\n workspaceDefs.push(aspectDef);\n return;\n }\n nonWorkspaceDefs.push(aspectDef);\n })\n );\n return { workspaceDefs, nonWorkspaceDefs };\n }\n\n private async groupIdsByWorkspaceExistence(\n ids: ComponentID[],\n resolveEnvsFromRoots?: boolean\n ): Promise<{ workspaceIds: ComponentID[]; nonWorkspaceIds: ComponentID[] }> {\n let workspaceIds: ComponentID[] = [];\n let nonWorkspaceIds: ComponentID[] = [];\n await Promise.all(\n ids.map(async (id) => {\n const existOnWorkspace = await this.workspace.hasId(id);\n existOnWorkspace ? workspaceIds.push(id) : nonWorkspaceIds.push(id);\n })\n );\n // We need to bring the components in order to really group them with taking the root comps into account\n const scopeComponents = await this.importAndGetAspects(nonWorkspaceIds);\n const { nonWorkspaceComps, workspaceComps } = await this.groupComponentsByWorkspaceExistence(\n scopeComponents,\n resolveEnvsFromRoots\n );\n workspaceIds = workspaceIds.concat(workspaceComps.map((c) => c.id));\n nonWorkspaceIds = nonWorkspaceComps.map((c) => c.id);\n return { workspaceIds, nonWorkspaceIds };\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,WAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,UAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAE,UAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,SAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,gBAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,eAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAIA,SAAAK,cAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,aAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAOA,SAAAM,KAAA;EAAA,MAAAN,IAAA,GAAAC,OAAA;EAAAK,IAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,SAAA;EAAA,MAAAP,IAAA,GAAAG,sBAAA,CAAAF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,MAAM;MAAEqG,iBAAiB;MAAED;IAAe,CAAC,GAAG,MAAM,IAAI,CAACE,mCAAmC,CAC1FwI,eAAe,EACf1R,oBACF,CAAC;IACD2C,YAAY,GAAGA,YAAY,CAAC2B,MAAM,CAAC0E,cAAc,CAACpF,GAAG,CAAEwF,CAAC,IAAKA,CAAC,CAACpH,EAAE,CAAC,CAAC;IACnEY,eAAe,GAAGqG,iBAAiB,CAACrF,GAAG,CAAEwF,CAAC,IAAKA,CAAC,CAACpH,EAAE,CAAC;IACpD,OAAO;MAAEW,YAAY;MAAEC;IAAgB,CAAC;EAC1C;AACF;AAAC+O,OAAA,CAAAxS,sBAAA,GAAAA,sBAAA","ignoreList":[]}
@@ -184,6 +184,8 @@ class WorkspaceComponentLoader {
184
184
  });
185
185
  }
186
186
  async getMany(ids, loadOpts, throwOnFailure = true) {
187
+ const callId = Math.floor(Math.random() * 1000); // generate a random callId to be able to identify the call from the logs
188
+ this.logger.profile(`getMany-${callId}`);
187
189
  const idsWithoutEmpty = (0, _lodash().compact)(ids);
188
190
  this.logger.setStatusLine(`loading ${ids.length} component(s)`);
189
191
  const loadOptsWithDefaults = Object.assign(
@@ -214,7 +216,7 @@ class WorkspaceComponentLoader {
214
216
  const {
215
217
  components: loadedComponents,
216
218
  invalidComponents
217
- } = await this.getAndLoadSlotOrdered(loadOrCached.idsToLoad || [], loadOptsWithDefaults);
219
+ } = await this.getAndLoadSlotOrdered(loadOrCached.idsToLoad || [], loadOptsWithDefaults, callId);
218
220
  invalidComponents.forEach(({
219
221
  err
220
222
  }) => {
@@ -229,23 +231,26 @@ class WorkspaceComponentLoader {
229
231
  executeLoadSlot: true
230
232
  });
231
233
  });
234
+ this.logger.profile(`getMany-${callId}`);
232
235
  return {
233
236
  components,
234
237
  invalidComponents
235
238
  };
236
239
  }
237
- async getAndLoadSlotOrdered(ids, loadOpts) {
240
+ async getAndLoadSlotOrdered(ids, loadOpts, callId = 0) {
238
241
  if (!ids?.length) return {
239
242
  components: [],
240
243
  invalidComponents: []
241
244
  };
242
245
  const workspaceScopeIdsMap = await this.groupAndUpdateIds(ids);
246
+ this.logger.profile('buildLoadGroups');
243
247
  const groupsToHandle = await this.buildLoadGroups(workspaceScopeIdsMap);
248
+ this.logger.profile('buildLoadGroups');
244
249
  // prefix your command with "BIT_LOG=*" to see the detailed groups
245
250
  if (process.env.BIT_LOG) {
246
251
  printGroupsToHandle(groupsToHandle, this.logger);
247
252
  }
248
- const groupsRes = (0, _lodash().compact)(await (0, _pMapSeries().default)(groupsToHandle, async group => {
253
+ const groupsRes = (0, _lodash().compact)(await (0, _pMapSeries().default)(groupsToHandle, async (group, index) => {
249
254
  const {
250
255
  scopeIds,
251
256
  workspaceIds,
@@ -253,12 +258,17 @@ class WorkspaceComponentLoader {
253
258
  core,
254
259
  seeders
255
260
  } = group;
256
- if (!workspaceIds.length && !scopeIds.length) return undefined;
261
+ const groupDesc = `getMany-${callId} group ${index + 1}/${groupsToHandle.length} - ${loadGroupToStr(group)}`;
262
+ this.logger.profile(groupDesc);
263
+ if (!workspaceIds.length && !scopeIds.length) {
264
+ throw new Error('getAndLoadSlotOrdered - group has no ids to load');
265
+ }
257
266
  const res = await this.getAndLoadSlot(workspaceIds, scopeIds, _objectSpread(_objectSpread({}, loadOpts), {}, {
258
267
  core,
259
268
  seeders,
260
269
  aspects
261
270
  }));
271
+ this.logger.profile(groupDesc);
262
272
  // We don't want to return components that were not asked originally (we do want to load them)
263
273
  if (!group.seeders) return undefined;
264
274
  return res;
@@ -308,8 +318,8 @@ class WorkspaceComponentLoader {
308
318
  }
309
319
  }
310
320
  await this.groupAndUpdateIds(extsNotFromTheList, workspaceScopeIdsMap);
311
- const layerdExtFromTheList = this.regroupExtIdsFromTheList(groupedByIsExtOfAnother.true);
312
- const layerdExtGroups = layerdExtFromTheList.map(ids => {
321
+ const layeredExtFromTheList = this.regroupExtIdsFromTheList(groupedByIsExtOfAnother.true);
322
+ const layeredExtGroups = layeredExtFromTheList.map(ids => {
313
323
  return {
314
324
  ids,
315
325
  core: false,
@@ -329,13 +339,14 @@ class WorkspaceComponentLoader {
329
339
  core: false,
330
340
  aspects: true,
331
341
  seeders: false
332
- }, ...layerdExtGroups, {
342
+ }, ...layeredExtGroups, {
333
343
  ids: groupedByIsExtOfAnother.false || [],
334
344
  core: false,
335
345
  aspects: false,
336
346
  seeders: true
337
347
  }];
338
348
  const groupsByWsScope = groupsToHandle.map(group => {
349
+ if (!group.ids?.length) return undefined;
339
350
  const groupedByWsScope = (0, _lodash().groupBy)(group.ids, id => {
340
351
  return workspaceScopeIdsMap.workspaceIds.has(id.toString());
341
352
  });
@@ -347,7 +358,7 @@ class WorkspaceComponentLoader {
347
358
  seeders: group.seeders
348
359
  };
349
360
  });
350
- return groupsByWsScope;
361
+ return (0, _lodash().compact)(groupsByWsScope);
351
362
  }
352
363
  regroupExtIdsFromTheList(ids) {
353
364
  // TODO: implement this function
@@ -372,12 +383,16 @@ class WorkspaceComponentLoader {
372
383
  // Ensure we won't load the same extension many times
373
384
  // We don't want to ignore version here, as we do want to load different extensions with same id but different versions here
374
385
  const mergedExtensions = _config().ExtensionDataList.mergeConfigs(allExtensions, false);
386
+ this.logger.profile('loadComponentsExtensions');
375
387
  await this.workspace.loadComponentsExtensions(mergedExtensions);
388
+ this.logger.profile('loadComponentsExtensions');
376
389
  let wsComponentsWithAspects = workspaceComponents;
377
390
  // if (loadOpts.seeders) {
391
+ this.logger.profile('executeLoadSlot');
378
392
  wsComponentsWithAspects = await (0, _promiseWithConcurrent().pMapPool)(workspaceComponents, component => this.executeLoadSlot(component), {
379
393
  concurrency: (0, _concurrency().concurrentComponentsLimit)()
380
394
  });
395
+ this.logger.profile('executeLoadSlot');
381
396
  await this.warnAboutMisconfiguredEnvs(wsComponentsWithAspects);
382
397
  // }
383
398
 
@@ -386,6 +401,7 @@ class WorkspaceComponentLoader {
386
401
  // It's important to load the workspace components as aspects here
387
402
  // otherwise the envs from the workspace won't be loaded at time
388
403
  // so we will get wrong dependencies from component who uses envs from the workspace
404
+ this.logger.profile('loadCompsAsAspects');
389
405
  if (loadOpts.loadSeedersAsAspects || loadOpts.core && loadOpts.aspects) {
390
406
  await this.loadCompsAsAspects(workspaceComponents.concat(scopeComponents), {
391
407
  loadApps: true,
@@ -396,6 +412,7 @@ class WorkspaceComponentLoader {
396
412
  idsToNotLoadAsAspects: loadOpts.idsToNotLoadAsAspects
397
413
  });
398
414
  }
415
+ this.logger.profile('loadCompsAsAspects');
399
416
  return {
400
417
  components: withAspects,
401
418
  invalidComponents
@@ -524,11 +541,13 @@ class WorkspaceComponentLoader {
524
541
  workspaceIds.forEach(id => {
525
542
  idsIndex[id.toString()] = id;
526
543
  });
544
+ this.logger.profile('consumer.loadComponents');
527
545
  const {
528
546
  components: legacyComponents,
529
547
  invalidComponents: legacyInvalidComponents,
530
548
  removedComponents
531
549
  } = await this.workspace.consumer.loadComponents(_componentId().ComponentIdList.fromArray(workspaceIds), false, loadOptsWithDefaults);
550
+ this.logger.profile('consumer.loadComponents');
532
551
  const allLegacyComponents = legacyComponents.concat(removedComponents);
533
552
  legacyInvalidComponents.forEach(invalidComponent => {
534
553
  const entry = {
@@ -866,5 +885,19 @@ function printGroupsToHandle(groupsToHandle, logger) {
866
885
  }, null, 2)}`);
867
886
  });
868
887
  }
888
+ function loadGroupToStr(loadGroup) {
889
+ const {
890
+ scopeIds,
891
+ workspaceIds,
892
+ aspects,
893
+ core,
894
+ seeders
895
+ } = loadGroup;
896
+ const attr = [];
897
+ if (aspects) attr.push('aspects');
898
+ if (core) attr.push('core');
899
+ if (seeders) attr.push('seeders');
900
+ return `workspaceIds: ${workspaceIds.length}, scopeIds: ${scopeIds.length}, (${attr.join('+')})`;
901
+ }
869
902
 
870
903
  //# sourceMappingURL=workspace-component-loader.js.map