@teambit/workspace 0.0.1050 → 0.0.1052
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/dist/{preview-1683532125666.js → preview-1683689530779.js} +2 -2
- package/dist/types.d.ts +17 -0
- package/dist/types.js.map +1 -1
- package/dist/use.cmd.js.map +1 -1
- package/dist/workspace-aspects-loader.d.ts +2 -0
- package/dist/workspace-aspects-loader.js +18 -5
- package/dist/workspace-aspects-loader.js.map +1 -1
- package/dist/workspace-component/workspace-component-loader.d.ts +1 -1
- package/dist/workspace-component/workspace-component-loader.js.map +1 -1
- package/dist/workspace.d.ts +5 -0
- package/dist/workspace.js +24 -0
- package/dist/workspace.js.map +1 -1
- package/dist/workspace.provider.js +5 -1
- package/dist/workspace.provider.js.map +1 -1
- package/dist/workspace.ui-root.d.ts +1 -0
- package/dist/workspace.ui-root.js +2 -1
- package/dist/workspace.ui-root.js.map +1 -1
- package/dist/workspace.ui.drawer.js +1 -1
- package/dist/workspace.ui.drawer.js.map +1 -1
- package/package-tar/teambit-workspace-0.0.1052.tgz +0 -0
- package/package.json +35 -35
- package/workspace-component/workspace-component-loader.ts +1 -1
- package/workspace.ui.drawer.tsx +1 -1
- package/package-tar/teambit-workspace-0.0.1050.tgz +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.workspace_workspace@0.0.
|
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.workspace_workspace@0.0.
|
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.workspace_workspace@0.0.1052/dist/workspace.composition.js';
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.workspace_workspace@0.0.1052/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
|
@@ -39,5 +39,22 @@ export interface WorkspaceExtConfig {
|
|
|
39
39
|
* from the scope aspects capsule.
|
|
40
40
|
*/
|
|
41
41
|
resolveAspectsFromNodeModules?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* If set to `true`, bit will try to load aspects dependencies automatically.
|
|
44
|
+
* even if the aspects dependencies are not configured in the workspace.jsonc root config.
|
|
45
|
+
* for example having the aspect
|
|
46
|
+
* main aspect
|
|
47
|
+
* export class MainAspectMain {
|
|
48
|
+
* ...
|
|
49
|
+
* static dependencies = [MyDepAspect];
|
|
50
|
+
* }
|
|
51
|
+
* and the in the workspace.jsonc file:
|
|
52
|
+
* {
|
|
53
|
+
* ...
|
|
54
|
+
* main-aspect: {}
|
|
55
|
+
* }
|
|
56
|
+
* when set to true, bit will try to load MyDepAspect automatically.
|
|
57
|
+
*/
|
|
58
|
+
autoLoadAspectsDeps?: boolean;
|
|
42
59
|
}
|
|
43
60
|
export {};
|
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 * applies only on bit.dev. configure the main owner of your workspace\n */\n defaultOwner: 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"],"mappings":""}
|
|
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 * applies only on bit.dev. configure the main owner of your workspace\n */\n defaultOwner: 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`, 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":""}
|
package/dist/use.cmd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["UseCmd","constructor","workspace","name","description","report","id","aspectIdAdded","use","chalk","green"],"sources":["use.cmd.ts"],"sourcesContent":["import { Command, CommandOptions } from '@teambit/cli';\nimport chalk from 'chalk';\nimport { Workspace } from './workspace';\n\nexport class UseCmd implements Command {\n name = 'use <component-id>';\n group = 'collaborate';\n description = 'set aspects in the workspace/scope config to make them loadable by the workspace/scope';\n helpUrl = 'docs/workspace/workspace-json#adding-an-aspect-to-the-workspace';\n arguments = [{ name: 'component-id', description: 'the component ID of the aspect' }];\n alias = '';\n options = [] as CommandOptions;\n loader = true;\n migration = true;\n remoteOp = true;\n\n constructor(private workspace: Workspace) {}\n\n async report([id]: [string]): Promise<any> {\n const aspectIdAdded = await this.workspace.use(id);\n return chalk.green(`workspace.jsonc updated successfully! features and extensions from \"${aspectIdAdded}\" are now available
|
|
1
|
+
{"version":3,"names":["UseCmd","constructor","workspace","name","description","report","id","aspectIdAdded","use","chalk","green"],"sources":["use.cmd.ts"],"sourcesContent":["import { Command, CommandOptions } from '@teambit/cli';\nimport chalk from 'chalk';\nimport { Workspace } from './workspace';\n\nexport class UseCmd implements Command {\n name = 'use <component-id>';\n group = 'collaborate';\n description = 'set aspects in the workspace/scope config to make them loadable by the workspace/scope';\n helpUrl = 'docs/workspace/workspace-json#adding-an-aspect-to-the-workspace';\n arguments = [{ name: 'component-id', description: 'the component ID of the aspect' }];\n alias = '';\n options = [] as CommandOptions;\n loader = true;\n migration = true;\n remoteOp = true;\n\n constructor(private workspace: Workspace) {}\n\n async report([id]: [string]): Promise<any> {\n const aspectIdAdded = await this.workspace.use(id);\n return chalk.green(\n `workspace.jsonc updated successfully! features and extensions from \"${aspectIdAdded}\" are now available.`\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGO,MAAMA,MAAM,CAAoB;EAYrCC,WAAW,CAASC,SAAoB,EAAE;IAAA,KAAtBA,SAAoB,GAApBA,SAAoB;IAAA,8CAXjC,oBAAoB;IAAA,+CACnB,aAAa;IAAA,qDACP,wFAAwF;IAAA,iDAC5F,iEAAiE;IAAA,mDAC/D,CAAC;MAAEC,IAAI,EAAE,cAAc;MAAEC,WAAW,EAAE;IAAiC,CAAC,CAAC;IAAA,+CAC7E,EAAE;IAAA,iDACA,EAAE;IAAA,gDACH,IAAI;IAAA,mDACD,IAAI;IAAA,kDACL,IAAI;EAE4B;EAE3C,MAAMC,MAAM,CAAC,CAACC,EAAE,CAAW,EAAgB;IACzC,MAAMC,aAAa,GAAG,MAAM,IAAI,CAACL,SAAS,CAACM,GAAG,CAACF,EAAE,CAAC;IAClD,OAAOG,gBAAK,CAACC,KAAK,CACf,uEAAsEH,aAAc,sBAAqB,CAC3G;EACH;AACF;AAAC"}
|
|
@@ -13,6 +13,8 @@ export declare type GetConfiguredUserAspectsPackagesOptions = {
|
|
|
13
13
|
};
|
|
14
14
|
export declare type WorkspaceLoadAspectsOptions = LoadAspectsOptions & {
|
|
15
15
|
useScopeAspectsCapsule?: boolean;
|
|
16
|
+
runSubscribers?: boolean;
|
|
17
|
+
skipDeps?: boolean;
|
|
16
18
|
};
|
|
17
19
|
export declare type AspectPackage = {
|
|
18
20
|
packageName: string;
|
|
@@ -127,6 +127,8 @@ class WorkspaceAspectsLoader {
|
|
|
127
127
|
const defaultOpts = {
|
|
128
128
|
useScopeAspectsCapsule: false,
|
|
129
129
|
throwOnError: calculatedThrowOnError,
|
|
130
|
+
runSubscribers: true,
|
|
131
|
+
skipDeps: false,
|
|
130
132
|
hideMissingModuleError: !!this.workspace.inInstallContext,
|
|
131
133
|
ignoreErrors: false
|
|
132
134
|
};
|
|
@@ -189,7 +191,7 @@ needed-for: ${neededFor || '<unknown>'}. using opts: ${JSON.stringify(mergedOpts
|
|
|
189
191
|
const {
|
|
190
192
|
manifests,
|
|
191
193
|
requireableComponents
|
|
192
|
-
} = await this.loadAspectDefsByOrder(aspectsDefs, idsWithoutCore, mergedOpts.throwOnError, mergedOpts.hideMissingModuleError, neededFor);
|
|
194
|
+
} = await this.loadAspectDefsByOrder(aspectsDefs, idsWithoutCore, mergedOpts.throwOnError, mergedOpts.hideMissingModuleError, neededFor, mergedOpts.runSubscribers);
|
|
193
195
|
const potentialPluginsIndexes = (0, _lodash().compact)(manifests.map((manifest, index) => {
|
|
194
196
|
if (this.aspectLoader.isValidAspect(manifest)) return undefined;
|
|
195
197
|
return index;
|
|
@@ -200,7 +202,7 @@ needed-for: ${neededFor || '<unknown>'}. using opts: ${JSON.stringify(mergedOpts
|
|
|
200
202
|
return requireableComponents[index];
|
|
201
203
|
});
|
|
202
204
|
// Do the require again now that the plugins defs already registered
|
|
203
|
-
const pluginsManifests = await this.aspectLoader.getManifestsFromRequireableExtensions(pluginsRequireableComponents, throwOnError);
|
|
205
|
+
const pluginsManifests = await this.aspectLoader.getManifestsFromRequireableExtensions(pluginsRequireableComponents, throwOnError, opts.runSubscribers);
|
|
204
206
|
await this.aspectLoader.loadExtensionsByManifests(pluginsManifests, undefined, {
|
|
205
207
|
throwOnError
|
|
206
208
|
});
|
|
@@ -208,7 +210,7 @@ needed-for: ${neededFor || '<unknown>'}. using opts: ${JSON.stringify(mergedOpts
|
|
|
208
210
|
const manifestIds = manifests.map(manifest => manifest.id);
|
|
209
211
|
return (0, _lodash().compact)(manifestIds.concat(scopeAspectIds));
|
|
210
212
|
}
|
|
211
|
-
async loadAspectDefsByOrder(aspectsDefs, seeders, throwOnError, hideMissingModuleError, neededFor) {
|
|
213
|
+
async loadAspectDefsByOrder(aspectsDefs, seeders, throwOnError, hideMissingModuleError, neededFor, runSubscribers = true) {
|
|
212
214
|
const {
|
|
213
215
|
nonWorkspaceDefs
|
|
214
216
|
} = await this.groupAspectDefsByWorkspaceExistence(aspectsDefs);
|
|
@@ -218,11 +220,11 @@ needed-for: ${neededFor || '<unknown>'}. using opts: ${JSON.stringify(mergedOpts
|
|
|
218
220
|
|
|
219
221
|
// Make sure to first load envs from the list otherwise it will fail when trying to load other aspects
|
|
220
222
|
// as their envs might not be loaded yet
|
|
221
|
-
if (scopeIdsGrouped.envs && scopeIdsGrouped.envs.length) {
|
|
223
|
+
if (scopeIdsGrouped.envs && scopeIdsGrouped.envs.length && !runSubscribers) {
|
|
222
224
|
await this.scope.loadAspects(scopeIdsGrouped.envs, throwOnError, 'workspace.loadAspects loading scope aspects');
|
|
223
225
|
}
|
|
224
226
|
const requireableComponents = this.aspectDefsToRequireableComponents(aspectsDefs);
|
|
225
|
-
const manifests = await this.aspectLoader.getManifestsFromRequireableExtensions(requireableComponents, throwOnError);
|
|
227
|
+
const manifests = await this.aspectLoader.getManifestsFromRequireableExtensions(requireableComponents, throwOnError, runSubscribers);
|
|
226
228
|
await this.aspectLoader.loadExtensionsByManifests(manifests, {
|
|
227
229
|
seeders,
|
|
228
230
|
neededFor
|
|
@@ -260,6 +262,17 @@ needed-for: ${neededFor || '<unknown>'}. using opts: ${JSON.stringify(mergedOpts
|
|
|
260
262
|
|
|
261
263
|
// Run the on load slot
|
|
262
264
|
await this.runOnAspectsResolveFunctions(components);
|
|
265
|
+
if (opts !== null && opts !== void 0 && opts.skipDeps) {
|
|
266
|
+
const wsAspectDefs = await this.aspectLoader.resolveAspects(components, this.getWorkspaceAspectResolver([], runtimeName));
|
|
267
|
+
const coreAspectDefs = await Promise.all(coreAspectsIds.map(async coreId => {
|
|
268
|
+
const rawDef = await (0, _aspectLoader().getAspectDef)(coreId, runtimeName);
|
|
269
|
+
return this.aspectLoader.loadDefinition(rawDef);
|
|
270
|
+
}));
|
|
271
|
+
const idsToFilter = idsToResolve.map(idStr => _component().ComponentID.fromString(idStr));
|
|
272
|
+
const targetDefs = wsAspectDefs.concat(coreAspectDefs);
|
|
273
|
+
const finalDefs = this.aspectLoader.filterAspectDefs(targetDefs, idsToFilter, runtimeName, mergedOpts);
|
|
274
|
+
return finalDefs;
|
|
275
|
+
}
|
|
263
276
|
const graph = await this.getAspectsGraphWithoutCore(components, this.isAspect.bind(this));
|
|
264
277
|
const aspects = graph.nodes.map(node => node.attr);
|
|
265
278
|
this.logger.debug(`${loggerPrefix} found ${aspects.length} aspects in the aspects-graph`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["WorkspaceAspectsLoader","constructor","workspace","scope","aspectLoader","envs","dependencyResolver","logger","harmony","onAspectsResolveSlot","onRootAspectAddedSlot","resolveAspectsFromNodeModules","consumer","resolvedInstalledAspects","Map","loadAspects","ids","throwOnError","neededFor","opts","calculatedThrowOnError","defaultOpts","useScopeAspectsCapsule","hideMissingModuleError","inInstallContext","ignoreErrors","mergedOpts","callId","Math","floor","random","loggerPrefix","info","length","join","JSON","stringify","notLoadedIds","filter","id","isAspectLoaded","coreAspectsStringIds","getCoreAspectIds","idsWithoutCore","difference","componentIds","resolveMultipleComponentIds","workspaceIds","nonWorkspaceIds","groupIdsByWorkspaceExistence","logFoundWorkspaceVsScope","idsToLoadFromWs","scopeAspectIds","currentLane","getCurrentLaneObject","nonWorkspaceIdsString","map","toString","undefined","packageManagerConfigRootDir","path","workspaceName","name","err","ComponentNotFound","config","get","configStr","workspaceConfig","raw","includes","BitError","aspectsDefs","resolveAspects","excludeCore","requestedOnly","manifests","requireableComponents","loadAspectDefsByOrder","potentialPluginsIndexes","compact","manifest","index","isValidAspect","pluginsRequireableComponents","pluginsManifests","getManifestsFromRequireableExtensions","loadExtensionsByManifests","debug","manifestIds","concat","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","graph","getAspectsGraphWithoutCore","isAspect","bind","aspects","nodes","node","attr","workspaceComps","nonWorkspaceComps","groupComponentsByWorkspaceExistence","workspaceCompsIds","c","nonWorkspaceCompsIds","stringIds","wsAspectDefs","getWorkspaceAspectResolver","linkIfMissingWorkspaceAspects","componentsToResolveFromScope","componentsToResolveFromInstalled","nonWorkspaceCompsGroups","groupBy","component","isEnv","true","false","scopeAspectsDefs","installedAspectsDefs","getInstalledAspectResolver","coreAspectDefs","Promise","all","coreId","rawDef","getAspectDef","loadDefinition","coreAspect","runtimePath","allDefs","idsToFilter","idStr","ComponentID","fromString","filteredDefs","filterAspectDefs","workspaceIdsStr","nonWorkspaceIdsStr","use","aspectIdStr","aspectId","resolveComponentId","inWs","hasId","aspectIdToAdd","aspectsComponent","aspectsComponents","Error","setExtension","overrideExisting","ignoreVersion","write","addInMemoryConfiguredAspect","runOnRootAspectAddedFunctions","getConfiguredUserAspectsPackages","options","componentsToGetPackages","externalsOnly","packages","aspectComponent","packageName","getPackageName","version","aspectDefs","localPath","aspectPath","requireFunc","plugins","getPlugins","has","load","MainRuntime","aspect","require","getRuntimePath","RequireableComponent","missingPaths","existsP","exist","fs","pathExists","bitIds","_legacy","linkToNodeModulesByIds","resolve","workspaceAspectResolver","compStringId","push","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","importAndGetMany","existOnWorkspace","workspaceDefs"],"sources":["workspace-aspects-loader.ts"],"sourcesContent":["import 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 { BitId } from '@teambit/legacy-bit-id';\nimport { ComponentNotFound } from '@teambit/legacy/dist/scope/exceptions';\nimport pMapSeries from 'p-map-series';\nimport { difference, compact, groupBy } from 'lodash';\nimport { Consumer } from '@teambit/legacy/dist/consumer';\nimport { Component, ComponentID, 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 { OnAspectsResolve, OnAspectsResolveSlot, OnRootAspectAdded, OnRootAspectAddedSlot } from './workspace.provider';\n\nexport type GetConfiguredUserAspectsPackagesOptions = {\n externalsOnly?: boolean;\n};\n\nexport type WorkspaceLoadAspectsOptions = LoadAspectsOptions & {\n useScopeAspectsCapsule?: 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 harmony: Harmony,\n private onAspectsResolveSlot: OnAspectsResolveSlot,\n private onRootAspectAddedSlot: OnRootAspectAddedSlot,\n private resolveAspectsFromNodeModules = false\n ) {\n this.consumer = this.workspace.consumer;\n this.resolvedInstalledAspects = new Map();\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 hideMissingModuleError: !!this.workspace.inInstallContext,\n ignoreErrors: false,\n };\n const mergedOpts: Required<WorkspaceLoadAspectsOptions> = { ...defaultOpts, ...opts };\n\n // generate a random callId to be able to identify the call from the logs\n const callId = Math.floor(Math.random() * 1000);\n const loggerPrefix = `[${callId}] loadAspects,`;\n this.logger.info(`${loggerPrefix} loading ${ids.length} aspects.\nids: ${ids.join(', ')}\nneeded-for: ${neededFor || '<unknown>'}. using opts: ${JSON.stringify(mergedOpts, null, 2)}`);\n const notLoadedIds = ids.filter((id) => !this.aspectLoader.isAspectLoaded(id));\n if (!notLoadedIds.length) return [];\n const coreAspectsStringIds = this.aspectLoader.getCoreAspectIds();\n const idsWithoutCore: string[] = difference(notLoadedIds, coreAspectsStringIds);\n\n const componentIds = await this.workspace.resolveMultipleComponentIds(idsWithoutCore);\n const { workspaceIds, nonWorkspaceIds } = await this.groupIdsByWorkspaceExistence(componentIds);\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 if (!this.resolveAspectsFromNodeModules) {\n mergedOpts.useScopeAspectsCapsule = true;\n }\n }\n\n if (mergedOpts.useScopeAspectsCapsule) {\n idsToLoadFromWs = workspaceIds;\n const currentLane = await this.consumer.getCurrentLaneObject();\n\n const nonWorkspaceIdsString = nonWorkspaceIds.map((id) => id.toString());\n try {\n scopeAspectIds = await this.scope.loadAspects(\n nonWorkspaceIdsString,\n throwOnError,\n neededFor,\n currentLane || undefined,\n {\n packageManagerConfigRootDir: this.workspace.path,\n workspaceName: this.workspace.name,\n }\n );\n } catch (err: any) {\n if (err instanceof ComponentNotFound) {\n const config = this.harmony.get<ConfigMain>('teambit.harmony/config');\n const configStr = JSON.stringify(config.workspaceConfig?.raw || {});\n if (configStr.includes(err.id)) {\n throw new BitError(`error: a component \"${err.id}\" was not found\n your workspace.jsonc has this component-id set. you might want to remove/change it.`);\n }\n }\n\n throw err;\n }\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 );\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 );\n await this.aspectLoader.loadExtensionsByManifests(pluginsManifests, undefined, { throwOnError });\n this.logger.debug(`${loggerPrefix} finish loading aspects`);\n const manifestIds = manifests.map((manifest) => manifest.id);\n return compact(manifestIds.concat(scopeAspectIds));\n }\n\n private async loadAspectDefsByOrder(\n aspectsDefs: AspectDefinition[],\n seeders: string[],\n throwOnError: boolean,\n hideMissingModuleError: boolean,\n neededFor?: string\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) {\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 );\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 };\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);\n\n // Run the on load slot\n await this.runOnAspectsResolveFunctions(components);\n\n const graph = await this.getAspectsGraphWithoutCore(components, this.isAspect.bind(this));\n const aspects = graph.nodes.map((node) => node.attr);\n this.logger.debug(`${loggerPrefix} found ${aspects.length} aspects in the aspects-graph`);\n const { workspaceComps, nonWorkspaceComps } = await this.groupComponentsByWorkspaceExistence(aspects);\n const workspaceCompsIds = workspaceComps.map((c) => c.id);\n const nonWorkspaceCompsIds = workspaceComps.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, workspaceCompsIds);\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 allDefs = wsAspectDefs.concat(coreAspectDefs).concat(scopeAspectsDefs).concat(installedAspectsDefs);\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 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();\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(userAspectsIds);\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 // eslint-disable-next-line global-require, import/no-dynamic-require\n const aspect = require(localPath);\n // require aspect runtimes\n const runtimePath = await this.aspectLoader.getRuntimePath(component, localPath, MainRuntime.name);\n // eslint-disable-next-line global-require, import/no-dynamic-require\n if (runtimePath) require(runtimePath);\n return aspect;\n };\n return new RequireableComponent(component, requireFunc);\n });\n return compact(requireableComponents);\n }\n\n private async linkIfMissingWorkspaceAspects(aspects: AspectDefinition[], ids: ComponentID[]) {\n let missingPaths = false;\n const existsP = aspects.map(async (aspect) => {\n const exist = await fs.pathExists(aspect.aspectPath);\n if (!exist) {\n missingPaths = true;\n }\n });\n await Promise.all(existsP);\n // TODO: this should be done properly by the install aspect by slot\n if (missingPaths) {\n const bitIds: BitId[] = ids.map((id) => id._legacy);\n return linkToNodeModulesByIds(this.workspace, bitIds);\n }\n return Promise.resolve();\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._legacy.toString();\n stringIds.push(compStringId);\n const localPath = 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._legacy.toString();\n // stringIds.push(compStringId);\n const localPath = 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 resolveInstalledAspectRecursively(\n aspectComponent: Component,\n rootIds: string[],\n graph: Graph<Component, string>,\n opts: { throwOnError: boolean } = { throwOnError: false }\n ): string | null | undefined {\n const aspectStringId = aspectComponent.id._legacy.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 = this.workspace.getComponentPackagePath(aspectComponent);\n this.resolvedInstalledAspects.set(aspectStringId, localPath);\n return localPath;\n }\n const parent = graph.predecessors(aspectStringId)[0];\n const parentPath = 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) => BitId.parse(id, true));\n // const aspectsIds = components.reduce((acc, curr) => {\n // const currIds = curr.state.aspects.ids;\n // acc = acc.concat(currIds);\n // return acc;\n // }, [] as any);\n // const otherDependenciesMap = components.reduce((acc, curr) => {\n // // const currIds = curr.state.dependencies.dependencies.map(dep => dep.id.toString());\n // const currMap = curr.state.dependencies.getIdsMap();\n // Object.assign(acc, currMap);\n // return acc;\n // }, {});\n\n // const depsWhichAreNotAspects = difference(Object.keys(otherDependenciesMap), aspectsIds);\n // const depsWhichAreNotAspectsBitIds = depsWhichAreNotAspects.map((strId) => otherDependenciesMap[strId]);\n // We only want to load into the graph components which are aspects and not regular dependencies\n // This come to solve a circular loop when an env aspect use an aspect (as regular dep) and the aspect use the env aspect as its env\n 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 becasuse 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 };\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[]): Promise<Component[]> {\n try {\n return await this.workspace.importAndGetMany(componentIds);\n } catch (err: any) {\n if (err instanceof ComponentNotFound) {\n const config = this.harmony.get<ConfigMain>('teambit.harmony/config');\n const configStr = JSON.stringify(config.workspaceConfig?.raw || {});\n if (configStr.includes(err.id)) {\n throw new BitError(`error: a component \"${err.id}\" was not found\nyour workspace.jsonc has this component-id set. you might want to remove/change it.`);\n }\n }\n\n throw err;\n }\n }\n\n /**\n * 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 ): Promise<{ workspaceComps: Component[]; nonWorkspaceComps: Component[] }> {\n const workspaceComps: Component[] = [];\n const 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 return { workspaceComps, nonWorkspaceComps };\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 existOnWorkspace ? workspaceDefs.push(aspectDef) : nonWorkspaceDefs.push(aspectDef);\n })\n );\n return { workspaceDefs, nonWorkspaceDefs };\n }\n\n private async groupIdsByWorkspaceExistence(\n ids: ComponentID[]\n ): Promise<{ workspaceIds: ComponentID[]; nonWorkspaceIds: ComponentID[] }> {\n const workspaceIds: ComponentID[] = [];\n const nonWorkspaceIds: ComponentID[] = [];\n await Promise.all(\n ids.map(async (id) => {\n const existOnWorkspace = await this.workspace.hasId(id);\n existOnWorksp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L,gBAAgB,CAACwH,IAAI,CAACnH,SAAS,CAAC;IACrF,CAAC,CAAC,CACH;IACD,OAAO;MAAE+J,aAAa;MAAEpK;IAAiB,CAAC;EAC5C;EAEA,MAAc3C,4BAA4B,CACxCjC,GAAkB,EACwD;IAC1E,MAAM+B,YAA2B,GAAG,EAAE;IACtC,MAAMC,eAA8B,GAAG,EAAE;IACzC,MAAMkG,OAAO,CAACC,GAAG,CACfnI,GAAG,CAACwC,GAAG,CAAC,MAAOjB,EAAE,IAAK;MACpB,MAAMwN,gBAAgB,GAAG,MAAM,IAAI,CAAC7P,SAAS,CAACsK,KAAK,CAACjI,EAAE,CAAC;MACvDwN,gBAAgB,GAAGhN,YAAY,CAACqK,IAAI,CAAC7K,EAAE,CAAC,GAAGS,eAAe,CAACoK,IAAI,CAAC7K,EAAE,CAAC;IACrE,CAAC,CAAC,CACH;IACD,OAAO;MAAEQ,YAAY;MAAEC;IAAgB,CAAC;EAC1C;AACF;AAAC"}
|
|
1
|
+
{"version":3,"names":["WorkspaceAspectsLoader","constructor","workspace","scope","aspectLoader","envs","dependencyResolver","logger","harmony","onAspectsResolveSlot","onRootAspectAddedSlot","resolveAspectsFromNodeModules","consumer","resolvedInstalledAspects","Map","loadAspects","ids","throwOnError","neededFor","opts","calculatedThrowOnError","defaultOpts","useScopeAspectsCapsule","runSubscribers","skipDeps","hideMissingModuleError","inInstallContext","ignoreErrors","mergedOpts","callId","Math","floor","random","loggerPrefix","info","length","join","JSON","stringify","notLoadedIds","filter","id","isAspectLoaded","coreAspectsStringIds","getCoreAspectIds","idsWithoutCore","difference","componentIds","resolveMultipleComponentIds","workspaceIds","nonWorkspaceIds","groupIdsByWorkspaceExistence","logFoundWorkspaceVsScope","idsToLoadFromWs","scopeAspectIds","currentLane","getCurrentLaneObject","nonWorkspaceIdsString","map","toString","undefined","packageManagerConfigRootDir","path","workspaceName","name","err","ComponentNotFound","config","get","configStr","workspaceConfig","raw","includes","BitError","aspectsDefs","resolveAspects","excludeCore","requestedOnly","manifests","requireableComponents","loadAspectDefsByOrder","potentialPluginsIndexes","compact","manifest","index","isValidAspect","pluginsRequireableComponents","pluginsManifests","getManifestsFromRequireableExtensions","loadExtensionsByManifests","debug","manifestIds","concat","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","graph","getAspectsGraphWithoutCore","isAspect","bind","aspects","nodes","node","attr","workspaceComps","nonWorkspaceComps","groupComponentsByWorkspaceExistence","workspaceCompsIds","c","nonWorkspaceCompsIds","stringIds","linkIfMissingWorkspaceAspects","componentsToResolveFromScope","componentsToResolveFromInstalled","nonWorkspaceCompsGroups","groupBy","component","isEnv","true","false","scopeAspectsDefs","installedAspectsDefs","getInstalledAspectResolver","coreAspect","runtimePath","allDefs","filteredDefs","workspaceIdsStr","nonWorkspaceIdsStr","use","aspectIdStr","aspectId","resolveComponentId","inWs","hasId","aspectIdToAdd","aspectsComponent","aspectsComponents","Error","setExtension","overrideExisting","ignoreVersion","write","addInMemoryConfiguredAspect","runOnRootAspectAddedFunctions","getConfiguredUserAspectsPackages","options","componentsToGetPackages","externalsOnly","packages","aspectComponent","packageName","getPackageName","version","aspectDefs","localPath","aspectPath","requireFunc","plugins","getPlugins","has","load","MainRuntime","aspect","require","getRuntimePath","RequireableComponent","missingPaths","existsP","exist","fs","pathExists","bitIds","_legacy","linkToNodeModulesByIds","resolve","workspaceAspectResolver","compStringId","push","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","importAndGetMany","existOnWorkspace","workspaceDefs"],"sources":["workspace-aspects-loader.ts"],"sourcesContent":["import 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 { BitId } from '@teambit/legacy-bit-id';\nimport { ComponentNotFound } from '@teambit/legacy/dist/scope/exceptions';\nimport pMapSeries from 'p-map-series';\nimport { difference, compact, groupBy } from 'lodash';\nimport { Consumer } from '@teambit/legacy/dist/consumer';\nimport { Component, ComponentID, 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 { OnAspectsResolve, OnAspectsResolveSlot, OnRootAspectAdded, OnRootAspectAddedSlot } from './workspace.provider';\n\nexport type GetConfiguredUserAspectsPackagesOptions = {\n externalsOnly?: boolean;\n};\n\nexport type WorkspaceLoadAspectsOptions = LoadAspectsOptions & {\n useScopeAspectsCapsule?: boolean;\n runSubscribers?: boolean;\n skipDeps?: 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 harmony: Harmony,\n private onAspectsResolveSlot: OnAspectsResolveSlot,\n private onRootAspectAddedSlot: OnRootAspectAddedSlot,\n private resolveAspectsFromNodeModules = false\n ) {\n this.consumer = this.workspace.consumer;\n this.resolvedInstalledAspects = new Map();\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 };\n const mergedOpts: Required<WorkspaceLoadAspectsOptions> = { ...defaultOpts, ...opts };\n\n // generate a random callId to be able to identify the call from the logs\n const callId = Math.floor(Math.random() * 1000);\n const loggerPrefix = `[${callId}] loadAspects,`;\n this.logger.info(`${loggerPrefix} loading ${ids.length} aspects.\nids: ${ids.join(', ')}\nneeded-for: ${neededFor || '<unknown>'}. using opts: ${JSON.stringify(mergedOpts, null, 2)}`);\n const notLoadedIds = ids.filter((id) => !this.aspectLoader.isAspectLoaded(id));\n if (!notLoadedIds.length) return [];\n const coreAspectsStringIds = this.aspectLoader.getCoreAspectIds();\n const idsWithoutCore: string[] = difference(notLoadedIds, coreAspectsStringIds);\n\n const componentIds = await this.workspace.resolveMultipleComponentIds(idsWithoutCore);\n const { workspaceIds, nonWorkspaceIds } = await this.groupIdsByWorkspaceExistence(componentIds);\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 if (!this.resolveAspectsFromNodeModules) {\n mergedOpts.useScopeAspectsCapsule = true;\n }\n }\n\n if (mergedOpts.useScopeAspectsCapsule) {\n idsToLoadFromWs = workspaceIds;\n const currentLane = await this.consumer.getCurrentLaneObject();\n\n const nonWorkspaceIdsString = nonWorkspaceIds.map((id) => id.toString());\n try {\n scopeAspectIds = await this.scope.loadAspects(\n nonWorkspaceIdsString,\n throwOnError,\n neededFor,\n currentLane || undefined,\n {\n packageManagerConfigRootDir: this.workspace.path,\n workspaceName: this.workspace.name,\n }\n );\n } catch (err: any) {\n if (err instanceof ComponentNotFound) {\n const config = this.harmony.get<ConfigMain>('teambit.harmony/config');\n const configStr = JSON.stringify(config.workspaceConfig?.raw || {});\n if (configStr.includes(err.id)) {\n throw new BitError(`error: a component \"${err.id}\" was not found\n your workspace.jsonc has this component-id set. you might want to remove/change it.`);\n }\n }\n\n throw err;\n }\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 await this.aspectLoader.loadExtensionsByManifests(pluginsManifests, undefined, { throwOnError });\n this.logger.debug(`${loggerPrefix} finish loading aspects`);\n const manifestIds = manifests.map((manifest) => manifest.id);\n return compact(manifestIds.concat(scopeAspectIds));\n }\n\n private async 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 };\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);\n\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 graph = await this.getAspectsGraphWithoutCore(components, this.isAspect.bind(this));\n const aspects = graph.nodes.map((node) => node.attr);\n this.logger.debug(`${loggerPrefix} found ${aspects.length} aspects in the aspects-graph`);\n const { workspaceComps, nonWorkspaceComps } = await this.groupComponentsByWorkspaceExistence(aspects);\n const workspaceCompsIds = workspaceComps.map((c) => c.id);\n const nonWorkspaceCompsIds = workspaceComps.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, workspaceCompsIds);\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 allDefs = wsAspectDefs.concat(coreAspectDefs).concat(scopeAspectsDefs).concat(installedAspectsDefs);\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 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();\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(userAspectsIds);\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 // eslint-disable-next-line global-require, import/no-dynamic-require\n const aspect = require(localPath);\n // require aspect runtimes\n const runtimePath = await this.aspectLoader.getRuntimePath(component, localPath, MainRuntime.name);\n // eslint-disable-next-line global-require, import/no-dynamic-require\n if (runtimePath) require(runtimePath);\n return aspect;\n };\n return new RequireableComponent(component, requireFunc);\n });\n return compact(requireableComponents);\n }\n\n private async linkIfMissingWorkspaceAspects(aspects: AspectDefinition[], ids: ComponentID[]) {\n let missingPaths = false;\n const existsP = aspects.map(async (aspect) => {\n const exist = await fs.pathExists(aspect.aspectPath);\n if (!exist) {\n missingPaths = true;\n }\n });\n await Promise.all(existsP);\n // TODO: this should be done properly by the install aspect by slot\n if (missingPaths) {\n const bitIds: BitId[] = ids.map((id) => id._legacy);\n return linkToNodeModulesByIds(this.workspace, bitIds);\n }\n return Promise.resolve();\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._legacy.toString();\n stringIds.push(compStringId);\n const localPath = 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._legacy.toString();\n // stringIds.push(compStringId);\n const localPath = 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 resolveInstalledAspectRecursively(\n aspectComponent: Component,\n rootIds: string[],\n graph: Graph<Component, string>,\n opts: { throwOnError: boolean } = { throwOnError: false }\n ): string | null | undefined {\n const aspectStringId = aspectComponent.id._legacy.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 = this.workspace.getComponentPackagePath(aspectComponent);\n this.resolvedInstalledAspects.set(aspectStringId, localPath);\n return localPath;\n }\n const parent = graph.predecessors(aspectStringId)[0];\n const parentPath = 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) => BitId.parse(id, true));\n // const aspectsIds = components.reduce((acc, curr) => {\n // const currIds = curr.state.aspects.ids;\n // acc = acc.concat(currIds);\n // return acc;\n // }, [] as any);\n // const otherDependenciesMap = components.reduce((acc, curr) => {\n // // const currIds = curr.state.dependencies.dependencies.map(dep => dep.id.toString());\n // const currMap = curr.state.dependencies.getIdsMap();\n // Object.assign(acc, currMap);\n // return acc;\n // }, {});\n\n // const depsWhichAreNotAspects = difference(Object.keys(otherDependenciesMap), aspectsIds);\n // const depsWhichAreNotAspectsBitIds = depsWhichAreNotAspects.map((strId) => otherDependenciesMap[strId]);\n // We only want to load into the graph components which are aspects and not regular dependencies\n // This come to solve a circular loop when an env aspect use an aspect (as regular dep) and the aspect use the env aspect as its env\n 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 becasuse 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 };\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[]): Promise<Component[]> {\n try {\n return await this.workspace.importAndGetMany(componentIds);\n } catch (err: any) {\n if (err instanceof ComponentNotFound) {\n const config = this.harmony.get<ConfigMain>('teambit.harmony/config');\n const configStr = JSON.stringify(config.workspaceConfig?.raw || {});\n if (configStr.includes(err.id)) {\n throw new BitError(`error: a component \"${err.id}\" was not found\nyour workspace.jsonc has this component-id set. you might want to remove/change it.`);\n }\n }\n\n throw err;\n }\n }\n\n /**\n * 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 ): Promise<{ workspaceComps: Component[]; nonWorkspaceComps: Component[] }> {\n const workspaceComps: Component[] = [];\n const 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 return { workspaceComps, nonWorkspaceComps };\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 existOnWorkspace ? workspaceDefs.push(aspectDef) : nonWorkspaceDefs.push(aspectDef);\n })\n );\n return { workspaceDefs, nonWorkspaceDefs };\n }\n\n private async groupIdsByWorkspaceExistence(\n ids: ComponentID[]\n ): Promise<{ workspaceIds: ComponentID[]; nonWorkspaceIds: ComponentID[] }> {\n const workspaceIds: ComponentID[] = [];\n const nonWorkspaceIds: ComponentID[] = [];\n await Promise.all(\n ids.map(async (id) => {\n const existOnWorkspace = await this.workspace.hasId(id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8B,GAAG,EAAE;IACzC,MAAMuE,OAAO,CAACC,GAAG,CACf1G,GAAG,CAAC0C,GAAG,CAAC,MAAOjB,EAAE,IAAK;MACpB,MAAM0N,gBAAgB,GAAG,MAAM,IAAI,CAACjQ,SAAS,CAAC0K,KAAK,CAACnI,EAAE,CAAC;MACvD0N,gBAAgB,GAAGlN,YAAY,CAACuK,IAAI,CAAC/K,EAAE,CAAC,GAAGS,eAAe,CAACsK,IAAI,CAAC/K,EAAE,CAAC;IACrE,CAAC,CAAC,CACH;IACD,OAAO;MAAEQ,YAAY;MAAEC;IAAgB,CAAC;EAC1C;AACF;AAAC"}
|
|
@@ -29,7 +29,7 @@ export declare class WorkspaceComponentLoader {
|
|
|
29
29
|
* legacy-id, the component is the cache has the old id.
|
|
30
30
|
*/
|
|
31
31
|
private getFromCache;
|
|
32
|
-
|
|
32
|
+
getConsumerComponent(id: ComponentID): Promise<ConsumerComponent | undefined>;
|
|
33
33
|
private isComponentNotExistsError;
|
|
34
34
|
private executeLoadSlot;
|
|
35
35
|
private newComponentFromState;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["WorkspaceComponentLoader","constructor","workspace","logger","dependencyResolver","envs","componentsCache","createInMemoryCache","maxSize","getMaxSizeForComponents","getMany","ids","loadOpts","idsWithoutEmpty","compact","errors","longProcessLogger","createLongProcessLogger","length","componentsP","mapSeries","id","logProgress","toString","get","undefined","catch","err","isComponentNotExistsError","push","components","forEach","console","warn","filteredComponents","end","getInvalid","consumer","loadComponent","_legacy","ConsumerComponent","isComponentInvalidByErrorType","componentId","legacyComponent","useCache","storeInCache","bitIdWithVersion","getLatestVersionNumber","bitmapIdsFromCurrentLane","version","changeVersion","fromCache","getFromCache","consumerComponent","getConsumerComponent","updatedId","ComponentID","fromLegacy","scope","component","loadOne","addMultipleEnvsIssueIfNeeded","saveInCache","getIfExist","getAllEnvsConfiguredOnComponent","envIds","uniq","map","env","state","issues","getOrCreate","IssuesClasses","MultipleEnvs","data","clearCache","deleteAll","clearComponentCache","idStr","cacheKey","keys","startsWith","delete","componentFromScope","MissingBitMapComponent","extensions","componentExtensions","some","MergeConfigConflict","MergeConfigHasConflict","extensionsFromConsumerComponent","ExtensionDataList","extensionDataList","mergeConfigs","filterRemovedExtensions","State","Config","mainFile","createAspectList","ComponentFS","fromVinyls","files","dependencies","workspaceComponent","WorkspaceComponent","head","tags","updatedComp","executeLoadSlot","newComponentFromState","createComponentCacheKey","set","isEqual","debug","name","message","ComponentNotFound","ComponentNotFoundInPath","_consumer","removed","envsData","calcDescriptor","policy","mergeVariantPolicies","config","dependenciesList","extractDepsFromLegacy","depResolverData","packageName","calcPackageName","serialize","Promise","all","upsertExtensionData","EnvsAspect","DependencyResolverAspect","aspectListWithEnvsAndDeps","aspects","entries","onComponentLoadSlot","toArray","promises","extension","onLoad","updatedAspectList","TagMap","existingExtension","findExtension","Object","assign","getDataEntry","ExtensionDataEntry","JSON","stringify","sortKeys","obj","fromPairs","sort","k1","k2","localeCompare"],"sources":["workspace-component-loader.ts"],"sourcesContent":["import { Component, ComponentFS, ComponentID, Config, InvalidComponent, State, TagMap } from '@teambit/component';\nimport { BitId } from '@teambit/legacy-bit-id';\nimport { ExtensionDataList } from '@teambit/legacy/dist/consumer/config/extension-data';\nimport mapSeries from 'p-map-series';\nimport { compact, fromPairs, uniq } from 'lodash';\nimport ConsumerComponent from '@teambit/legacy/dist/consumer/component';\nimport { MissingBitMapComponent } from '@teambit/legacy/dist/consumer/bit-map/exceptions';\nimport { getLatestVersionNumber } from '@teambit/legacy/dist/utils';\nimport { IssuesClasses } from '@teambit/component-issues';\nimport { ComponentNotFound } from '@teambit/legacy/dist/scope/exceptions';\nimport { DependencyResolverAspect, DependencyResolverMain } from '@teambit/dependency-resolver';\nimport { Logger } from '@teambit/logger';\nimport { EnvsAspect, EnvsMain } from '@teambit/envs';\nimport { ExtensionDataEntry } from '@teambit/legacy/dist/consumer/config';\nimport { getMaxSizeForComponents, InMemoryCache } from '@teambit/legacy/dist/cache/in-memory-cache';\nimport { createInMemoryCache } from '@teambit/legacy/dist/cache/cache-factory';\nimport ComponentNotFoundInPath from '@teambit/legacy/dist/consumer/component/exceptions/component-not-found-in-path';\nimport { ComponentLoadOptions } from '@teambit/legacy/dist/consumer/component/component-loader';\nimport { Workspace } from '../workspace';\nimport { WorkspaceComponent } from './workspace-component';\nimport { MergeConfigConflict } from '../exceptions/merge-config-conflict';\n\nexport class WorkspaceComponentLoader {\n private componentsCache: InMemoryCache<Component>; // cache loaded components\n constructor(\n private workspace: Workspace,\n private logger: Logger,\n private dependencyResolver: DependencyResolverMain,\n private envs: EnvsMain\n ) {\n this.componentsCache = createInMemoryCache({ maxSize: getMaxSizeForComponents() });\n }\n\n async getMany(ids: Array<ComponentID>, loadOpts?: ComponentLoadOptions): Promise<Component[]> {\n const idsWithoutEmpty = compact(ids);\n const errors: { id: ComponentID; err: Error }[] = [];\n const longProcessLogger = this.logger.createLongProcessLogger('loading components', ids.length);\n const componentsP = mapSeries(idsWithoutEmpty, async (id: ComponentID) => {\n longProcessLogger.logProgress(id.toString());\n return this.get(id, undefined, undefined, undefined, loadOpts).catch((err) => {\n if (this.isComponentNotExistsError(err)) {\n errors.push({\n id,\n err,\n });\n return undefined;\n }\n throw err;\n });\n });\n const components = await componentsP;\n errors.forEach((err) => {\n this.logger.console(`failed loading component ${err.id.toString()}, see full error in debug.log file`);\n this.logger.warn(`failed loading component ${err.id.toString()}`, err.err);\n });\n // remove errored components\n const filteredComponents: Component[] = compact(components);\n longProcessLogger.end();\n return filteredComponents;\n }\n\n async getInvalid(ids: Array<ComponentID>): Promise<InvalidComponent[]> {\n const idsWithoutEmpty = compact(ids);\n const errors: InvalidComponent[] = [];\n const longProcessLogger = this.logger.createLongProcessLogger('loading components', ids.length);\n await mapSeries(idsWithoutEmpty, async (id: ComponentID) => {\n longProcessLogger.logProgress(id.toString());\n try {\n await this.workspace.consumer.loadComponent(id._legacy);\n } catch (err: any) {\n if (ConsumerComponent.isComponentInvalidByErrorType(err)) {\n errors.push({\n id,\n err,\n });\n return;\n }\n throw err;\n }\n });\n return errors;\n }\n\n async get(\n componentId: ComponentID,\n legacyComponent?: ConsumerComponent,\n useCache = true,\n storeInCache = true,\n loadOpts?: ComponentLoadOptions\n ): Promise<Component> {\n const bitIdWithVersion: BitId = getLatestVersionNumber(\n this.workspace.consumer.bitmapIdsFromCurrentLane,\n componentId._legacy\n );\n const id = bitIdWithVersion.version ? componentId.changeVersion(bitIdWithVersion.version) : componentId;\n const fromCache = this.getFromCache(id, loadOpts);\n if (fromCache && useCache) {\n return fromCache;\n }\n const consumerComponent = legacyComponent || (await this.getConsumerComponent(id));\n // in case of out-of-sync, the id may changed during the load process\n const updatedId = consumerComponent ? ComponentID.fromLegacy(consumerComponent.id, id.scope) : id;\n const component = await this.loadOne(updatedId, consumerComponent, loadOpts);\n if (storeInCache) {\n this.addMultipleEnvsIssueIfNeeded(component); // it's in storeInCache block, otherwise, it wasn't fully loaded\n this.saveInCache(component, loadOpts);\n }\n return component;\n }\n\n async getIfExist(componentId: ComponentID) {\n try {\n return await this.get(componentId);\n } catch (err: any) {\n if (this.isComponentNotExistsError(err)) {\n return undefined;\n }\n throw err;\n }\n }\n\n private addMultipleEnvsIssueIfNeeded(component: Component) {\n const envs = this.envs.getAllEnvsConfiguredOnComponent(component);\n const envIds = uniq(envs.map((env) => env.id));\n if (envIds.length < 2) {\n return;\n }\n component.state.issues.getOrCreate(IssuesClasses.MultipleEnvs).data = envIds;\n }\n\n clearCache() {\n this.componentsCache.deleteAll();\n }\n clearComponentCache(id: ComponentID) {\n const idStr = id.toString();\n for (const cacheKey of this.componentsCache.keys()) {\n if (cacheKey === idStr || cacheKey.startsWith(`${idStr}:`)) {\n this.componentsCache.delete(cacheKey);\n }\n }\n }\n\n private async loadOne(id: ComponentID, consumerComponent?: ConsumerComponent, loadOpts?: ComponentLoadOptions) {\n const componentFromScope = await this.workspace.scope.get(id);\n if (!consumerComponent) {\n if (!componentFromScope) throw new MissingBitMapComponent(id.toString());\n return componentFromScope;\n }\n const { extensions, errors } = await this.workspace.componentExtensions(id, componentFromScope);\n if (errors?.some((err) => err instanceof MergeConfigConflict)) {\n consumerComponent.issues.getOrCreate(IssuesClasses.MergeConfigHasConflict).data = true;\n }\n\n const extensionsFromConsumerComponent = consumerComponent.extensions || new ExtensionDataList();\n // Merge extensions added by the legacy code in memory (for example data of dependency resolver)\n const extensionDataList = ExtensionDataList.mergeConfigs([\n extensionsFromConsumerComponent,\n extensions,\n ]).filterRemovedExtensions();\n\n // temporarily mutate consumer component extensions until we remove all direct access from legacy to extensions data\n // TODO: remove this once we remove all direct access from legacy code to extensions data\n consumerComponent.extensions = extensionDataList;\n\n const state = new State(\n new Config(consumerComponent.mainFile, extensionDataList),\n await this.workspace.createAspectList(extensionDataList),\n ComponentFS.fromVinyls(consumerComponent.files),\n consumerComponent.dependencies,\n consumerComponent\n );\n if (componentFromScope) {\n // Removed by @gilad. do not mutate the component from the scope\n // componentFromScope.state = state;\n // const workspaceComponent = WorkspaceComponent.fromComponent(componentFromScope, this.workspace);\n const workspaceComponent = new WorkspaceComponent(\n componentFromScope.id,\n componentFromScope.head,\n state,\n componentFromScope.tags,\n this.workspace\n );\n const updatedComp = await this.executeLoadSlot(workspaceComponent, loadOpts);\n return updatedComp;\n }\n return this.executeLoadSlot(this.newComponentFromState(id, state), loadOpts);\n }\n\n private saveInCache(component: Component, loadOpts?: ComponentLoadOptions): void {\n const cacheKey = createComponentCacheKey(component.id, loadOpts);\n this.componentsCache.set(cacheKey, component);\n }\n\n /**\n * make sure that not only the id-str match, but also the legacy-id.\n * this is needed because the ComponentID.toString() is the same whether or not the legacy-id has\n * scope-name, as it includes the defaultScope if the scope is empty.\n * as a result, when out-of-sync is happening and the id is changed to include scope-name in the\n * legacy-id, the component is the cache has the old id.\n */\n private getFromCache(id: ComponentID, loadOpts?: ComponentLoadOptions): Component | undefined {\n const cacheKey = createComponentCacheKey(id, loadOpts);\n const fromCache = this.componentsCache.get(cacheKey);\n if (fromCache && fromCache.id._legacy.isEqual(id._legacy)) {\n return fromCache;\n }\n return undefined;\n }\n\n private async getConsumerComponent(id: ComponentID): Promise<ConsumerComponent | undefined> {\n try {\n return await this.workspace.consumer.loadComponent(id._legacy);\n } catch (err: any) {\n // don't return undefined for any error. otherwise, if the component is invalid (e.g. main\n // file is missing) it returns the model component later unexpectedly, or if it's new, it\n // shows MissingBitMapComponent error incorrectly.\n if (this.isComponentNotExistsError(err)) {\n this.logger.debug(\n `failed loading component \"${id.toString()}\" from the workspace due to \"${err.name}\" error\\n${err.message}`\n );\n return undefined;\n }\n throw err;\n }\n }\n\n private isComponentNotExistsError(err: Error): boolean {\n return (\n err instanceof ComponentNotFound ||\n err instanceof MissingBitMapComponent ||\n err instanceof ComponentNotFoundInPath\n );\n }\n\n private async executeLoadSlot(component: Component, loadOpts?: ComponentLoadOptions) {\n if (component.state._consumer.removed) {\n // if it was soft-removed now, the component is not in the FS. loading aspects such as composition ends up with\n // errors as they try to read component files from the filesystem.\n return component;\n }\n\n // Special load events which runs from the workspace but should run from the correct aspect\n // TODO: remove this once those extensions dependent on workspace\n const envsData = await this.envs.calcDescriptor(component);\n\n // Move to deps resolver main runtime once we switch ws<> deps resolver direction\n const policy = await this.dependencyResolver.mergeVariantPolicies(\n component.config.extensions,\n component.id._legacy,\n component.state._consumer.files\n );\n const dependenciesList = await this.dependencyResolver.extractDepsFromLegacy(component, policy);\n\n const depResolverData = {\n packageName: this.dependencyResolver.calcPackageName(component),\n dependencies: dependenciesList.serialize(),\n policy: policy.serialize(),\n };\n\n // Make sure we are adding the envs / deps data first because other on load events might depend on it\n await Promise.all([\n this.upsertExtensionData(component, EnvsAspect.id, envsData),\n this.upsertExtensionData(component, DependencyResolverAspect.id, depResolverData),\n ]);\n\n // We are updating the component state with the envs and deps data here, so in case we have other slots that depend on this data\n // they will be able to get it, as it's very common use case that during on load someone want to access to the component env for example\n const aspectListWithEnvsAndDeps = await this.workspace.createAspectList(component.state.config.extensions);\n component.state.aspects = aspectListWithEnvsAndDeps;\n\n const entries = this.workspace.onComponentLoadSlot.toArray();\n const promises = entries.map(async ([extension, onLoad]) => {\n const data = await onLoad(component, loadOpts);\n return this.upsertExtensionData(component, extension, data);\n });\n\n await Promise.all(promises);\n\n // Update the aspect list to have changes happened during the on load slot (new data added above)\n const updatedAspectList = await this.workspace.createAspectList(component.state.config.extensions);\n component.state.aspects = updatedAspectList;\n return component;\n }\n\n private newComponentFromState(id: ComponentID, state: State): Component {\n return new WorkspaceComponent(id, null, state, new TagMap(), this.workspace);\n }\n\n private async upsertExtensionData(component: Component, extension: string, data: any) {\n if (!data) return;\n const existingExtension = component.state.config.extensions.findExtension(extension);\n if (existingExtension) {\n // Only merge top level of extension data\n Object.assign(existingExtension.data, data);\n return;\n }\n component.state.config.extensions.push(await this.getDataEntry(extension, data));\n }\n\n private async getDataEntry(extension: string, data: { [key: string]: any }): Promise<ExtensionDataEntry> {\n // TODO: @gilad we need to refactor the extension data entry api.\n return new ExtensionDataEntry(undefined, undefined, extension, undefined, data);\n }\n}\n\nfunction createComponentCacheKey(id: ComponentID, loadOpts?: ComponentLoadOptions): string {\n return `${id.toString()}:${JSON.stringify(sortKeys(loadOpts ?? {}))}`;\n}\n\nfunction sortKeys(obj: Object) {\n return fromPairs(Object.entries(obj).sort(([k1], [k2]) => k1.localeCompare(k2)));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAA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ACvC,UAAU,CAAC8D,aAAa,CAACL,SAAS,CAAC;IACpF,IAAII,iBAAiB,EAAE;MACrB;MACAE,MAAM,CAACC,MAAM,CAACH,iBAAiB,CAACxE,IAAI,EAAEA,IAAI,CAAC;MAC3C;IACF;IACAf,SAAS,CAACU,KAAK,CAACuD,MAAM,CAACvC,UAAU,CAACxD,IAAI,CAAC,MAAM,IAAI,CAACyH,YAAY,CAACR,SAAS,EAAEpE,IAAI,CAAC,CAAC;EAClF;EAEA,MAAc4E,YAAY,CAACR,SAAiB,EAAEpE,IAA4B,EAA+B;IACvG;IACA,OAAO,KAAI6E,4BAAkB,EAAC9H,SAAS,EAAEA,SAAS,EAAEqH,SAAS,EAAErH,SAAS,EAAEiD,IAAI,CAAC;EACjF;AACF;AAAC;AAED,SAASoC,uBAAuB,CAACzF,EAAe,EAAET,QAA+B,EAAU;EACzF,OAAQ,GAAES,EAAE,CAACE,QAAQ,EAAG,IAAGiI,IAAI,CAACC,SAAS,CAACC,QAAQ,CAAC9I,QAAQ,aAARA,QAAQ,cAARA,QAAQ,GAAI,CAAC,CAAC,CAAC,CAAE,EAAC;AACvE;AAEA,SAAS8I,QAAQ,CAACC,GAAW,EAAE;EAC7B,OAAO,IAAAC,mBAAS,EAACR,MAAM,CAACV,OAAO,CAACiB,GAAG,CAAC,CAACE,IAAI,CAAC,CAAC,CAACC,EAAE,CAAC,EAAE,CAACC,EAAE,CAAC,KAAKD,EAAE,CAACE,aAAa,CAACD,EAAE,CAAC,CAAC,CAAC;AAClF"}
|
|
1
|
+
{"version":3,"names":["WorkspaceComponentLoader","constructor","workspace","logger","dependencyResolver","envs","componentsCache","createInMemoryCache","maxSize","getMaxSizeForComponents","getMany","ids","loadOpts","idsWithoutEmpty","compact","errors","longProcessLogger","createLongProcessLogger","length","componentsP","mapSeries","id","logProgress","toString","get","undefined","catch","err","isComponentNotExistsError","push","components","forEach","console","warn","filteredComponents","end","getInvalid","consumer","loadComponent","_legacy","ConsumerComponent","isComponentInvalidByErrorType","componentId","legacyComponent","useCache","storeInCache","bitIdWithVersion","getLatestVersionNumber","bitmapIdsFromCurrentLane","version","changeVersion","fromCache","getFromCache","consumerComponent","getConsumerComponent","updatedId","ComponentID","fromLegacy","scope","component","loadOne","addMultipleEnvsIssueIfNeeded","saveInCache","getIfExist","getAllEnvsConfiguredOnComponent","envIds","uniq","map","env","state","issues","getOrCreate","IssuesClasses","MultipleEnvs","data","clearCache","deleteAll","clearComponentCache","idStr","cacheKey","keys","startsWith","delete","componentFromScope","MissingBitMapComponent","extensions","componentExtensions","some","MergeConfigConflict","MergeConfigHasConflict","extensionsFromConsumerComponent","ExtensionDataList","extensionDataList","mergeConfigs","filterRemovedExtensions","State","Config","mainFile","createAspectList","ComponentFS","fromVinyls","files","dependencies","workspaceComponent","WorkspaceComponent","head","tags","updatedComp","executeLoadSlot","newComponentFromState","createComponentCacheKey","set","isEqual","debug","name","message","ComponentNotFound","ComponentNotFoundInPath","_consumer","removed","envsData","calcDescriptor","policy","mergeVariantPolicies","config","dependenciesList","extractDepsFromLegacy","depResolverData","packageName","calcPackageName","serialize","Promise","all","upsertExtensionData","EnvsAspect","DependencyResolverAspect","aspectListWithEnvsAndDeps","aspects","entries","onComponentLoadSlot","toArray","promises","extension","onLoad","updatedAspectList","TagMap","existingExtension","findExtension","Object","assign","getDataEntry","ExtensionDataEntry","JSON","stringify","sortKeys","obj","fromPairs","sort","k1","k2","localeCompare"],"sources":["workspace-component-loader.ts"],"sourcesContent":["import { Component, ComponentFS, ComponentID, Config, InvalidComponent, State, TagMap } from '@teambit/component';\nimport { BitId } from '@teambit/legacy-bit-id';\nimport { ExtensionDataList } from '@teambit/legacy/dist/consumer/config/extension-data';\nimport mapSeries from 'p-map-series';\nimport { compact, fromPairs, uniq } from 'lodash';\nimport ConsumerComponent from '@teambit/legacy/dist/consumer/component';\nimport { MissingBitMapComponent } from '@teambit/legacy/dist/consumer/bit-map/exceptions';\nimport { getLatestVersionNumber } from '@teambit/legacy/dist/utils';\nimport { IssuesClasses } from '@teambit/component-issues';\nimport { ComponentNotFound } from '@teambit/legacy/dist/scope/exceptions';\nimport { DependencyResolverAspect, DependencyResolverMain } from '@teambit/dependency-resolver';\nimport { Logger } from '@teambit/logger';\nimport { EnvsAspect, EnvsMain } from '@teambit/envs';\nimport { ExtensionDataEntry } from '@teambit/legacy/dist/consumer/config';\nimport { getMaxSizeForComponents, InMemoryCache } from '@teambit/legacy/dist/cache/in-memory-cache';\nimport { createInMemoryCache } from '@teambit/legacy/dist/cache/cache-factory';\nimport ComponentNotFoundInPath from '@teambit/legacy/dist/consumer/component/exceptions/component-not-found-in-path';\nimport { ComponentLoadOptions } from '@teambit/legacy/dist/consumer/component/component-loader';\nimport { Workspace } from '../workspace';\nimport { WorkspaceComponent } from './workspace-component';\nimport { MergeConfigConflict } from '../exceptions/merge-config-conflict';\n\nexport class WorkspaceComponentLoader {\n private componentsCache: InMemoryCache<Component>; // cache loaded components\n constructor(\n private workspace: Workspace,\n private logger: Logger,\n private dependencyResolver: DependencyResolverMain,\n private envs: EnvsMain\n ) {\n this.componentsCache = createInMemoryCache({ maxSize: getMaxSizeForComponents() });\n }\n\n async getMany(ids: Array<ComponentID>, loadOpts?: ComponentLoadOptions): Promise<Component[]> {\n const idsWithoutEmpty = compact(ids);\n const errors: { id: ComponentID; err: Error }[] = [];\n const longProcessLogger = this.logger.createLongProcessLogger('loading components', ids.length);\n const componentsP = mapSeries(idsWithoutEmpty, async (id: ComponentID) => {\n longProcessLogger.logProgress(id.toString());\n return this.get(id, undefined, undefined, undefined, loadOpts).catch((err) => {\n if (this.isComponentNotExistsError(err)) {\n errors.push({\n id,\n err,\n });\n return undefined;\n }\n throw err;\n });\n });\n const components = await componentsP;\n errors.forEach((err) => {\n this.logger.console(`failed loading component ${err.id.toString()}, see full error in debug.log file`);\n this.logger.warn(`failed loading component ${err.id.toString()}`, err.err);\n });\n // remove errored components\n const filteredComponents: Component[] = compact(components);\n longProcessLogger.end();\n return filteredComponents;\n }\n\n async getInvalid(ids: Array<ComponentID>): Promise<InvalidComponent[]> {\n const idsWithoutEmpty = compact(ids);\n const errors: InvalidComponent[] = [];\n const longProcessLogger = this.logger.createLongProcessLogger('loading components', ids.length);\n await mapSeries(idsWithoutEmpty, async (id: ComponentID) => {\n longProcessLogger.logProgress(id.toString());\n try {\n await this.workspace.consumer.loadComponent(id._legacy);\n } catch (err: any) {\n if (ConsumerComponent.isComponentInvalidByErrorType(err)) {\n errors.push({\n id,\n err,\n });\n return;\n }\n throw err;\n }\n });\n return errors;\n }\n\n async get(\n componentId: ComponentID,\n legacyComponent?: ConsumerComponent,\n useCache = true,\n storeInCache = true,\n loadOpts?: ComponentLoadOptions\n ): Promise<Component> {\n const bitIdWithVersion: BitId = getLatestVersionNumber(\n this.workspace.consumer.bitmapIdsFromCurrentLane,\n componentId._legacy\n );\n const id = bitIdWithVersion.version ? componentId.changeVersion(bitIdWithVersion.version) : componentId;\n const fromCache = this.getFromCache(id, loadOpts);\n if (fromCache && useCache) {\n return fromCache;\n }\n const consumerComponent = legacyComponent || (await this.getConsumerComponent(id));\n // in case of out-of-sync, the id may changed during the load process\n const updatedId = consumerComponent ? ComponentID.fromLegacy(consumerComponent.id, id.scope) : id;\n const component = await this.loadOne(updatedId, consumerComponent, loadOpts);\n if (storeInCache) {\n this.addMultipleEnvsIssueIfNeeded(component); // it's in storeInCache block, otherwise, it wasn't fully loaded\n this.saveInCache(component, loadOpts);\n }\n return component;\n }\n\n async getIfExist(componentId: ComponentID) {\n try {\n return await this.get(componentId);\n } catch (err: any) {\n if (this.isComponentNotExistsError(err)) {\n return undefined;\n }\n throw err;\n }\n }\n\n private addMultipleEnvsIssueIfNeeded(component: Component) {\n const envs = this.envs.getAllEnvsConfiguredOnComponent(component);\n const envIds = uniq(envs.map((env) => env.id));\n if (envIds.length < 2) {\n return;\n }\n component.state.issues.getOrCreate(IssuesClasses.MultipleEnvs).data = envIds;\n }\n\n clearCache() {\n this.componentsCache.deleteAll();\n }\n clearComponentCache(id: ComponentID) {\n const idStr = id.toString();\n for (const cacheKey of this.componentsCache.keys()) {\n if (cacheKey === idStr || cacheKey.startsWith(`${idStr}:`)) {\n this.componentsCache.delete(cacheKey);\n }\n }\n }\n\n private async loadOne(id: ComponentID, consumerComponent?: ConsumerComponent, loadOpts?: ComponentLoadOptions) {\n const componentFromScope = await this.workspace.scope.get(id);\n if (!consumerComponent) {\n if (!componentFromScope) throw new MissingBitMapComponent(id.toString());\n return componentFromScope;\n }\n const { extensions, errors } = await this.workspace.componentExtensions(id, componentFromScope);\n if (errors?.some((err) => err instanceof MergeConfigConflict)) {\n consumerComponent.issues.getOrCreate(IssuesClasses.MergeConfigHasConflict).data = true;\n }\n\n const extensionsFromConsumerComponent = consumerComponent.extensions || new ExtensionDataList();\n // Merge extensions added by the legacy code in memory (for example data of dependency resolver)\n const extensionDataList = ExtensionDataList.mergeConfigs([\n extensionsFromConsumerComponent,\n extensions,\n ]).filterRemovedExtensions();\n\n // temporarily mutate consumer component extensions until we remove all direct access from legacy to extensions data\n // TODO: remove this once we remove all direct access from legacy code to extensions data\n consumerComponent.extensions = extensionDataList;\n\n const state = new State(\n new Config(consumerComponent.mainFile, extensionDataList),\n await this.workspace.createAspectList(extensionDataList),\n ComponentFS.fromVinyls(consumerComponent.files),\n consumerComponent.dependencies,\n consumerComponent\n );\n if (componentFromScope) {\n // Removed by @gilad. do not mutate the component from the scope\n // componentFromScope.state = state;\n // const workspaceComponent = WorkspaceComponent.fromComponent(componentFromScope, this.workspace);\n const workspaceComponent = new WorkspaceComponent(\n componentFromScope.id,\n componentFromScope.head,\n state,\n componentFromScope.tags,\n this.workspace\n );\n const updatedComp = await this.executeLoadSlot(workspaceComponent, loadOpts);\n return updatedComp;\n }\n return this.executeLoadSlot(this.newComponentFromState(id, state), loadOpts);\n }\n\n private saveInCache(component: Component, loadOpts?: ComponentLoadOptions): void {\n const cacheKey = createComponentCacheKey(component.id, loadOpts);\n this.componentsCache.set(cacheKey, component);\n }\n\n /**\n * make sure that not only the id-str match, but also the legacy-id.\n * this is needed because the ComponentID.toString() is the same whether or not the legacy-id has\n * scope-name, as it includes the defaultScope if the scope is empty.\n * as a result, when out-of-sync is happening and the id is changed to include scope-name in the\n * legacy-id, the component is the cache has the old id.\n */\n private getFromCache(id: ComponentID, loadOpts?: ComponentLoadOptions): Component | undefined {\n const cacheKey = createComponentCacheKey(id, loadOpts);\n const fromCache = this.componentsCache.get(cacheKey);\n if (fromCache && fromCache.id._legacy.isEqual(id._legacy)) {\n return fromCache;\n }\n return undefined;\n }\n\n async getConsumerComponent(id: ComponentID): Promise<ConsumerComponent | undefined> {\n try {\n return await this.workspace.consumer.loadComponent(id._legacy);\n } catch (err: any) {\n // don't return undefined for any error. otherwise, if the component is invalid (e.g. main\n // file is missing) it returns the model component later unexpectedly, or if it's new, it\n // shows MissingBitMapComponent error incorrectly.\n if (this.isComponentNotExistsError(err)) {\n this.logger.debug(\n `failed loading component \"${id.toString()}\" from the workspace due to \"${err.name}\" error\\n${err.message}`\n );\n return undefined;\n }\n throw err;\n }\n }\n\n private isComponentNotExistsError(err: Error): boolean {\n return (\n err instanceof ComponentNotFound ||\n err instanceof MissingBitMapComponent ||\n err instanceof ComponentNotFoundInPath\n );\n }\n\n private async executeLoadSlot(component: Component, loadOpts?: ComponentLoadOptions) {\n if (component.state._consumer.removed) {\n // if it was soft-removed now, the component is not in the FS. loading aspects such as composition ends up with\n // errors as they try to read component files from the filesystem.\n return component;\n }\n\n // Special load events which runs from the workspace but should run from the correct aspect\n // TODO: remove this once those extensions dependent on workspace\n const envsData = await this.envs.calcDescriptor(component);\n\n // Move to deps resolver main runtime once we switch ws<> deps resolver direction\n const policy = await this.dependencyResolver.mergeVariantPolicies(\n component.config.extensions,\n component.id._legacy,\n component.state._consumer.files\n );\n const dependenciesList = await this.dependencyResolver.extractDepsFromLegacy(component, policy);\n\n const depResolverData = {\n packageName: this.dependencyResolver.calcPackageName(component),\n dependencies: dependenciesList.serialize(),\n policy: policy.serialize(),\n };\n\n // Make sure we are adding the envs / deps data first because other on load events might depend on it\n await Promise.all([\n this.upsertExtensionData(component, EnvsAspect.id, envsData),\n this.upsertExtensionData(component, DependencyResolverAspect.id, depResolverData),\n ]);\n\n // We are updating the component state with the envs and deps data here, so in case we have other slots that depend on this data\n // they will be able to get it, as it's very common use case that during on load someone want to access to the component env for example\n const aspectListWithEnvsAndDeps = await this.workspace.createAspectList(component.state.config.extensions);\n component.state.aspects = aspectListWithEnvsAndDeps;\n\n const entries = this.workspace.onComponentLoadSlot.toArray();\n const promises = entries.map(async ([extension, onLoad]) => {\n const data = await onLoad(component, loadOpts);\n return this.upsertExtensionData(component, extension, data);\n });\n\n await Promise.all(promises);\n\n // Update the aspect list to have changes happened during the on load slot (new data added above)\n const updatedAspectList = await this.workspace.createAspectList(component.state.config.extensions);\n component.state.aspects = updatedAspectList;\n return component;\n }\n\n private newComponentFromState(id: ComponentID, state: State): Component {\n return new WorkspaceComponent(id, null, state, new TagMap(), this.workspace);\n }\n\n private async upsertExtensionData(component: Component, extension: string, data: any) {\n if (!data) return;\n const existingExtension = component.state.config.extensions.findExtension(extension);\n if (existingExtension) {\n // Only merge top level of extension data\n Object.assign(existingExtension.data, data);\n return;\n }\n component.state.config.extensions.push(await this.getDataEntry(extension, data));\n }\n\n private async getDataEntry(extension: string, data: { [key: string]: any }): Promise<ExtensionDataEntry> {\n // TODO: @gilad we need to refactor the extension data entry api.\n return new ExtensionDataEntry(undefined, undefined, extension, undefined, data);\n }\n}\n\nfunction createComponentCacheKey(id: ComponentID, loadOpts?: ComponentLoadOptions): string {\n return `${id.toString()}:${JSON.stringify(sortKeys(loadOpts ?? {}))}`;\n}\n\nfunction sortKeys(obj: Object) {\n return fromPairs(Object.entries(obj).sort(([k1], [k2]) => k1.localeCompare(k2)));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AA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|
@@ -229,6 +229,11 @@ export declare class Workspace implements ComponentFactory {
|
|
|
229
229
|
getDependentsIds(ids: ComponentID[]): Promise<ComponentID[]>;
|
|
230
230
|
createAspectList(extensionDataList: ExtensionDataList): Promise<AspectList>;
|
|
231
231
|
private extensionDataEntryToAspectEntry;
|
|
232
|
+
/**
|
|
233
|
+
* this is not the complete legacy component (ConsumerComponent), it's missing dependencies and hooks from Harmony
|
|
234
|
+
* are skipped. do not trust the data you get from this method unless you know what you're doing.
|
|
235
|
+
*/
|
|
236
|
+
getLegacyMinimal(id: ComponentID): Promise<ConsumerComponent | undefined>;
|
|
232
237
|
/**
|
|
233
238
|
* get a component from workspace
|
|
234
239
|
* @param id component ID
|