@teambit/workspace 1.0.337 → 1.0.339
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/artifacts/__bit_junit.xml +1 -1
- package/artifacts/preview/teambit_workspace_workspace-preview.js +1 -1
- package/artifacts/schema.json +2057 -1869
- package/dist/{preview-1721099996991.js → preview-1721223204715.js} +2 -2
- package/dist/types.d.ts +5 -0
- package/dist/types.js.map +1 -1
- package/dist/workspace-aspects-loader.js +2 -2
- package/dist/workspace-aspects-loader.js.map +1 -1
- package/dist/workspace.d.ts +5 -0
- package/dist/workspace.js +20 -3
- package/dist/workspace.js.map +1 -1
- package/package.json +28 -28
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.workspace_workspace@1.0.
|
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.workspace_workspace@1.0.
|
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.workspace_workspace@1.0.339/dist/workspace.composition.js';
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.workspace_workspace@1.0.339/dist/workspace.docs.mdx';
|
|
3
3
|
|
|
4
4
|
export const compositions = [compositions_0];
|
|
5
5
|
export const overview = [overview_0];
|
package/dist/types.d.ts
CHANGED
|
@@ -18,6 +18,11 @@ export interface WorkspaceExtConfig {
|
|
|
18
18
|
* set the default directory when there is no matching for the component in the components array.
|
|
19
19
|
*/
|
|
20
20
|
defaultDirectory: string;
|
|
21
|
+
/**
|
|
22
|
+
* sets the location of the root components directory.
|
|
23
|
+
* The location is a relative path to the workspace root and should use linux path separators (/).
|
|
24
|
+
*/
|
|
25
|
+
rootComponentsDirectory?: string;
|
|
21
26
|
/**
|
|
22
27
|
* set the default structure of components in your project
|
|
23
28
|
*/
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["interface VendorConfig {\n directory: string;\n}\n\nexport interface WorkspaceExtConfig {\n /**\n * name of the workspace.\n */\n name: string;\n\n /**\n * path to icon.\n */\n icon: string;\n\n /**\n * set the default scope when there is no matching for the component in the components array.\n */\n defaultScope: string;\n\n /**\n * set the default directory when there is no matching for the component in the components array.\n */\n defaultDirectory: string;\n\n /**\n * set the default structure of components in your project\n */\n vendor: VendorConfig;\n\n /**\n * All component extensions applied by default on all components in the workspace (except vendor components)\n */\n extensions: { [extensionsId: string]: string };\n\n /**\n * If set to\n * `true`, it allows the workspace to resolve scope's aspects from node modules\n * installed in the workspace's `node_modules` directory. If not set or set to `false`, aspects will only be resolved\n * from the scope aspects capsule.\n */\n resolveAspectsFromNodeModules?: boolean;\n\n /**\n * If set to `true`, it allows the workspace to resolve envs from node modules\n * installed in the workspace's `node_modules` directory.\n * the envs will be resolved from the node_modules of the env's root (workspace/node_modules/.bit_roots/{envId})\n * and if not found (usually when the env was hoisted to the root node_modules) then from the node_modules of the\n * workspace.\n * If not set or set to `false`, envs will only be resolved from the scope envs capsule.\n */\n resolveEnvsFromRoots?: boolean;\n\n /**\n * If set to `true`, bit will try to load aspects dependencies automatically.\n * even if the aspects dependencies are not configured in the workspace.jsonc root config.\n * for example having the aspect\n * main aspect\n * export class MainAspectMain {\n * ...\n * static dependencies = [MyDepAspect];\n * }\n * and the in the workspace.jsonc file:\n * {\n * ...\n * main-aspect: {}\n * }\n * when set to true, bit will try to load MyDepAspect automatically.\n */\n autoLoadAspectsDeps?: boolean;\n}\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["interface VendorConfig {\n directory: string;\n}\n\nexport interface WorkspaceExtConfig {\n /**\n * name of the workspace.\n */\n name: string;\n\n /**\n * path to icon.\n */\n icon: string;\n\n /**\n * set the default scope when there is no matching for the component in the components array.\n */\n defaultScope: string;\n\n /**\n * set the default directory when there is no matching for the component in the components array.\n */\n defaultDirectory: string;\n\n /**\n * sets the location of the root components directory.\n * The location is a relative path to the workspace root and should use linux path separators (/).\n */\n rootComponentsDirectory?: string;\n\n /**\n * set the default structure of components in your project\n */\n vendor: VendorConfig;\n\n /**\n * All component extensions applied by default on all components in the workspace (except vendor components)\n */\n extensions: { [extensionsId: string]: string };\n\n /**\n * If set to\n * `true`, it allows the workspace to resolve scope's aspects from node modules\n * installed in the workspace's `node_modules` directory. If not set or set to `false`, aspects will only be resolved\n * from the scope aspects capsule.\n */\n resolveAspectsFromNodeModules?: boolean;\n\n /**\n * If set to `true`, it allows the workspace to resolve envs from node modules\n * installed in the workspace's `node_modules` directory.\n * the envs will be resolved from the node_modules of the env's root (workspace/node_modules/.bit_roots/{envId})\n * and if not found (usually when the env was hoisted to the root node_modules) then from the node_modules of the\n * workspace.\n * If not set or set to `false`, envs will only be resolved from the scope envs capsule.\n */\n resolveEnvsFromRoots?: boolean;\n\n /**\n * If set to `true`, bit will try to load aspects dependencies automatically.\n * even if the aspects dependencies are not configured in the workspace.jsonc root config.\n * for example having the aspect\n * main aspect\n * export class MainAspectMain {\n * ...\n * static dependencies = [MyDepAspect];\n * }\n * and the in the workspace.jsonc file:\n * {\n * ...\n * main-aspect: {}\n * }\n * when set to true, bit will try to load MyDepAspect automatically.\n */\n autoLoadAspectsDeps?: boolean;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -399,9 +399,9 @@ your workspace.jsonc has this component-id set. you might want to remove/change
|
|
|
399
399
|
return aspectIdToAdd;
|
|
400
400
|
}
|
|
401
401
|
async getConfiguredUserAspectsPackages(options = {}) {
|
|
402
|
-
const
|
|
402
|
+
const rawConfiguredAspects = this.workspace.getWorkspaceConfig()?.extensionsIds;
|
|
403
403
|
const coreAspectsIds = this.aspectLoader.getCoreAspectIds();
|
|
404
|
-
const userAspectsIds = (0, _lodash().difference)(
|
|
404
|
+
const userAspectsIds = (0, _lodash().difference)(rawConfiguredAspects, coreAspectsIds);
|
|
405
405
|
const componentIdsToResolve = await this.workspace.resolveMultipleComponentIds(userAspectsIds.filter(id => !id.startsWith('file:')));
|
|
406
406
|
const aspectsComponents = await this.importAndGetAspects(componentIdsToResolve);
|
|
407
407
|
let componentsToGetPackages = aspectsComponents;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_constants","data","require","_findRoot","_interopRequireDefault","_toolboxModules","_aspectLoader","_cli","_fsExtra","_harmonyModules","_workspaceModules","_componentId","_exceptions","_pMapSeries","_lodash","_bitError","e","__esModule","default","ownKeys","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","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","profile","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","manifestIds","debug","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.profile(`[${callId}] workspace.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(`[${callId}] 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 const manifestIds = manifests.map((manifest) => manifest.id);\n this.logger.debug(`${loggerPrefix} finish loading aspects`);\n this.logger.profile(`[${callId}] 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(nonWorkspaceIdsString, throwOnError, neededFor, currentLane, {\n packageManagerConfigRootDir: this.workspace.path,\n workspaceName: this.workspace.name,\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,U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AAC,CACH,CAAC;IACD,OAAO;MAAE0L,aAAa;MAAE/L;IAAiB,CAAC;EAC5C;EAEA,MAAc7C,4BAA4BA,CACxCvC,GAAkB,EAClBN,oBAA8B,EAC4C;IAC1E,IAAI2C,YAA2B,GAAG,EAAE;IACpC,IAAIC,eAA8B,GAAG,EAAE;IACvC,MAAMyE,OAAO,CAACC,GAAG,CACfhH,GAAG,CAACsD,GAAG,CAAC,MAAO5B,EAAE,IAAK;MACpB,MAAM8O,gBAAgB,GAAG,MAAM,IAAI,CAACzR,SAAS,CAACgM,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,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":[]}
|
|
1
|
+
{"version":3,"names":["_constants","data","require","_findRoot","_interopRequireDefault","_toolboxModules","_aspectLoader","_cli","_fsExtra","_harmonyModules","_workspaceModules","_componentId","_exceptions","_pMapSeries","_lodash","_bitError","e","__esModule","default","ownKeys","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","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","profile","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","manifestIds","debug","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","rawConfiguredAspects","getWorkspaceConfig","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.profile(`[${callId}] workspace.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(`[${callId}] 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 const manifestIds = manifests.map((manifest) => manifest.id);\n this.logger.debug(`${loggerPrefix} finish loading aspects`);\n this.logger.profile(`[${callId}] 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(nonWorkspaceIdsString, throwOnError, neededFor, currentLane, {\n packageManagerConfigRootDir: this.workspace.path,\n workspaceName: this.workspace.name,\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 rawConfiguredAspects = this.workspace.getWorkspaceConfig()?.extensionsIds;\n const coreAspectsIds = this.aspectLoader.getCoreAspectIds();\n const userAspectsIds: string[] = difference(rawConfiguredAspects, 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,IA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ACvDgP,gBAAgB,GAAGrO,YAAY,CAAC9E,IAAI,CAACmE,EAAE,CAAC,GAAGY,eAAe,CAAC/E,IAAI,CAACmE,EAAE,CAAC;IACrE,CAAC,CACH,CAAC;IACD;IACA,MAAM4P,eAAe,GAAG,MAAM,IAAI,CAAC5K,mBAAmB,CAACpE,eAAe,CAAC;IACvE,MAAM;MAAEqG,iBAAiB;MAAED;IAAe,CAAC,GAAG,MAAM,IAAI,CAACE,mCAAmC,CAC1F0I,eAAe,EACf5R,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;AAACiP,OAAA,CAAA1S,sBAAA,GAAAA,sBAAA","ignoreList":[]}
|
package/dist/workspace.d.ts
CHANGED
|
@@ -178,6 +178,10 @@ export declare class Workspace implements ComponentFactory {
|
|
|
178
178
|
* root path of the Workspace.
|
|
179
179
|
*/
|
|
180
180
|
get path(): string;
|
|
181
|
+
/**
|
|
182
|
+
* Get the location of the bit roots folder
|
|
183
|
+
*/
|
|
184
|
+
get rootComponentsPath(): string;
|
|
181
185
|
/** get the `node_modules` folder of this workspace */
|
|
182
186
|
private get modulesPath();
|
|
183
187
|
get isLegacy(): boolean;
|
|
@@ -501,6 +505,7 @@ export declare class Workspace implements ComponentFactory {
|
|
|
501
505
|
*/
|
|
502
506
|
_reloadConsumer(): Promise<void>;
|
|
503
507
|
getComponentPackagePath(component: Component): Promise<string>;
|
|
508
|
+
_getComponentRelativePath(component: Component): Promise<string>;
|
|
504
509
|
get defaultDirectory(): string;
|
|
505
510
|
get legacyDefaultDirectory(): string;
|
|
506
511
|
resolveComponentIdFromPackageName(packageName: string): Promise<ComponentID>;
|
package/dist/workspace.js
CHANGED
|
@@ -429,6 +429,9 @@ class Workspace {
|
|
|
429
429
|
if ((0, _lodash().isEmpty)(this.config)) throw new (_bitError().BitError)(`fatal: workspace config is empty. probably one of bit files is missing. please run "bit init" to rewrite them`);
|
|
430
430
|
const defaultScope = this.config.defaultScope;
|
|
431
431
|
if (!defaultScope) throw new (_bitError().BitError)('defaultScope is missing');
|
|
432
|
+
if (this.config.rootComponentsDirectory === '') {
|
|
433
|
+
throw new (_bitError().BitError)('rootComponentsDirectory cannot be empty. Root components directory location cannot be the same as the workspace directory path');
|
|
434
|
+
}
|
|
432
435
|
if (!(0, _legacyBitId().isValidScopeName)(defaultScope)) throw new (_legacyBitId().InvalidScopeName)(defaultScope);
|
|
433
436
|
}
|
|
434
437
|
|
|
@@ -439,6 +442,13 @@ class Workspace {
|
|
|
439
442
|
return this.consumer.getPath();
|
|
440
443
|
}
|
|
441
444
|
|
|
445
|
+
/**
|
|
446
|
+
* Get the location of the bit roots folder
|
|
447
|
+
*/
|
|
448
|
+
get rootComponentsPath() {
|
|
449
|
+
return this.config.rootComponentsDirectory ?? _path().default.join(this.modulesPath, '.bit_roots');
|
|
450
|
+
}
|
|
451
|
+
|
|
442
452
|
/** get the `node_modules` folder of this workspace */
|
|
443
453
|
get modulesPath() {
|
|
444
454
|
return _path().default.join(this.path, 'node_modules');
|
|
@@ -1677,9 +1687,16 @@ the following envs are used in this workspace: ${availableEnvs.join(', ')}`);
|
|
|
1677
1687
|
await this.clearCache();
|
|
1678
1688
|
}
|
|
1679
1689
|
async getComponentPackagePath(component) {
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1690
|
+
return _path().default.join(this.path, await this._getComponentRelativePath(component));
|
|
1691
|
+
}
|
|
1692
|
+
async _getComponentRelativePath(component) {
|
|
1693
|
+
if (this.hasId(component.id)) {
|
|
1694
|
+
return this.dependencyResolver.getRuntimeModulePathInWorkspace(component, {
|
|
1695
|
+
workspacePath: this.path,
|
|
1696
|
+
rootComponentsPath: this.rootComponentsPath
|
|
1697
|
+
});
|
|
1698
|
+
}
|
|
1699
|
+
return this.dependencyResolver.getRuntimeModulePathInCapsules(component);
|
|
1683
1700
|
}
|
|
1684
1701
|
|
|
1685
1702
|
// TODO: should we return here the dir as it defined (aka components) or with /{name} prefix (as it used in legacy)
|