@teambit/aspect-loader 0.0.1002 → 0.0.1006

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  import { ExtensionManifest, Harmony, Aspect, SlotRegistry } from '@teambit/harmony';
2
2
  import type { LoggerMain } from '@teambit/logger';
3
- import { ComponentID, Component } from '@teambit/component';
3
+ import { ComponentID, Component, FilterAspectsOptions } from '@teambit/component';
4
4
  import { Logger } from '@teambit/logger';
5
5
  import { RequireableComponent } from '@teambit/harmony.modules.requireable-component';
6
6
  import { EnvsMain } from '@teambit/envs';
@@ -18,7 +18,7 @@ export declare type AspectDescriptor = {
18
18
  */
19
19
  icon?: string;
20
20
  };
21
- export declare type AspectResolver = (component: Component) => Promise<ResolvedAspect>;
21
+ export declare type AspectResolver = (component: Component) => Promise<ResolvedAspect | undefined>;
22
22
  export declare type ResolvedAspect = {
23
23
  aspectPath: string;
24
24
  runtimePath: string | null;
@@ -65,6 +65,7 @@ export declare class AspectLoaderMain {
65
65
  private onAspectLoadErrorSlot;
66
66
  private onLoadRequireableExtensionSlot;
67
67
  private pluginSlot;
68
+ private inMemoryConfiguredAspects;
68
69
  constructor(logger: Logger, envs: EnvsMain, harmony: Harmony, onAspectLoadErrorSlot: OnAspectLoadErrorSlot, onLoadRequireableExtensionSlot: OnLoadRequireableExtensionSlot, pluginSlot: PluginDefinitionSlot);
69
70
  private getCompiler;
70
71
  registerOnAspectLoadErrorSlot(onAspectLoadError: OnAspectLoadError): void;
@@ -77,6 +78,19 @@ export declare class AspectLoaderMain {
77
78
  getAspectFilePath(component: Component, modulePath: string): Promise<string | null>;
78
79
  isAspectLoaded(id: string): unknown;
79
80
  getDescriptor(id: string): AspectDescriptor | undefined;
81
+ /**
82
+ * This is used when adding aspects to workspace.jsonc during the process (like in bit use command)
83
+ * and we want to make sure that follow operation (like bit install) will recognize those aspects
84
+ * but the harmony config is already in memory.
85
+ * Probably a better to do it is to make sure we can re-load the config somehow
86
+ * ideally by adding the config class in harmony a reload API
87
+ * @param aspectId
88
+ */
89
+ addInMemoryConfiguredAspect(aspectId: string): void;
90
+ /**
91
+ * get all the configured aspects in the config file (workspace.jsonc / bit.jsonc)
92
+ */
93
+ getConfiguredAspects(): string[];
80
94
  getNotLoadedConfiguredExtensions(): string[];
81
95
  loadDefinition(props: AspectDefinitionProps): AspectDefinition;
82
96
  private _coreAspects;
@@ -142,6 +156,7 @@ export declare class AspectLoaderMain {
142
156
  components: Component[];
143
157
  globalScopeHarmony: Harmony;
144
158
  }>;
159
+ filterAspectDefs(allDefs: AspectDefinition[], componentIds: ComponentID[], runtimeName: string | undefined, filterOpts?: FilterAspectsOptions): AspectDefinition[];
145
160
  private prepareManifests;
146
161
  /**
147
162
  * register a plugin.
@@ -172,6 +172,7 @@ class AspectLoaderMain {
172
172
  this.onAspectLoadErrorSlot = onAspectLoadErrorSlot;
173
173
  this.onLoadRequireableExtensionSlot = onLoadRequireableExtensionSlot;
174
174
  this.pluginSlot = pluginSlot;
175
+ (0, _defineProperty2().default)(this, "inMemoryConfiguredAspects", []);
175
176
  (0, _defineProperty2().default)(this, "_coreAspects", []);
176
177
  (0, _defineProperty2().default)(this, "_reserved", ['teambit.harmony/bit', 'teambit.harmony/config']);
177
178
  (0, _defineProperty2().default)(this, "_mainAspect", void 0);
@@ -270,8 +271,29 @@ class AspectLoaderMain {
270
271
  return undefined;
271
272
  }
272
273
  }
273
- getNotLoadedConfiguredExtensions() {
274
+
275
+ /**
276
+ * This is used when adding aspects to workspace.jsonc during the process (like in bit use command)
277
+ * and we want to make sure that follow operation (like bit install) will recognize those aspects
278
+ * but the harmony config is already in memory.
279
+ * Probably a better to do it is to make sure we can re-load the config somehow
280
+ * ideally by adding the config class in harmony a reload API
281
+ * @param aspectId
282
+ */
283
+ addInMemoryConfiguredAspect(aspectId) {
284
+ this.inMemoryConfiguredAspects.push(aspectId);
285
+ }
286
+
287
+ /**
288
+ * get all the configured aspects in the config file (workspace.jsonc / bit.jsonc)
289
+ */
290
+ getConfiguredAspects() {
274
291
  const configuredAspects = Array.from(this.harmony.config.raw.keys());
292
+ const iMemoryConfiguredAspects = this.inMemoryConfiguredAspects;
293
+ return configuredAspects.concat(iMemoryConfiguredAspects);
294
+ }
295
+ getNotLoadedConfiguredExtensions() {
296
+ const configuredAspects = this.getConfiguredAspects();
275
297
  const loadedExtensions = this.harmony.extensionsIds;
276
298
  const extensionsToLoad = (0, _lodash().difference)(configuredAspects, loadedExtensions);
277
299
  return extensionsToLoad;
@@ -322,11 +344,12 @@ class AspectLoaderMain {
322
344
  async resolveAspects(components, resolver) {
323
345
  const promises = components.map(async component => {
324
346
  const resolvedAspect = await resolver(component);
347
+ if (!resolvedAspect) return undefined;
325
348
  return new (_aspectDefinition().AspectDefinition)(resolvedAspect.aspectPath, resolvedAspect.aspectFilePath, resolvedAspect.runtimePath, component);
326
349
  });
327
350
  const aspectDefs = await Promise.all(promises);
328
351
  // return aspectDefs.filter((def) => def.runtimePath);
329
- return aspectDefs;
352
+ return (0, _lodash().compact)(aspectDefs);
330
353
  }
331
354
  get mainAspect() {
332
355
  return this._mainAspect;
@@ -433,7 +456,7 @@ class AspectLoaderMain {
433
456
  if (this.logger.isLoaderStarted) {
434
457
  this.logger.consoleFailure(msg);
435
458
  } else {
436
- this.logger.console(msg);
459
+ this.logger.consoleWarning(msg);
437
460
  }
438
461
  }
439
462
  async runOnLoadRequireableExtensionSubscribers(requireableExtension, manifest) {
@@ -510,6 +533,30 @@ class AspectLoaderMain {
510
533
  globalScopeHarmony
511
534
  };
512
535
  }
536
+ filterAspectDefs(allDefs, componentIds, runtimeName, filterOpts = {}) {
537
+ const coreIds = this.getCoreAspectIds();
538
+ const stringIds = componentIds.map(id => id.toStringWithoutVersion());
539
+ const afterExclusion = filterOpts.excludeCore ? allDefs.filter(def => {
540
+ const isCore = coreIds.includes(def.getId || '');
541
+ const id = _component().ComponentID.fromString(def.getId || '');
542
+ const isTarget = stringIds.includes(id.toStringWithoutVersion());
543
+ if (isTarget) return true;
544
+ return !isCore;
545
+ }) : allDefs;
546
+ const uniqDefs = (0, _lodash().uniqBy)(afterExclusion, def => `${def.aspectPath}-${def.runtimePath}`);
547
+ let defs = uniqDefs;
548
+ if (runtimeName && filterOpts.filterByRuntime) {
549
+ defs = defs.filter(def => def.runtimePath);
550
+ }
551
+ if (componentIds && componentIds.length && filterOpts.requestedOnly) {
552
+ const componentIdsString = componentIds.map(id => id.toString());
553
+ defs = defs.filter(def => {
554
+ var _def$component;
555
+ return def.id && componentIdsString.includes(def.id) || def.component && componentIdsString.includes((_def$component = def.component) === null || _def$component === void 0 ? void 0 : _def$component.id.toString());
556
+ });
557
+ }
558
+ return defs;
559
+ }
513
560
  prepareManifests(manifests) {
514
561
  return manifests.map(manifest => {
515
562
  if (this.isAspect(manifest)) return manifest;
@@ -562,8 +609,8 @@ class AspectLoaderMain {
562
609
  if (this.logger.isLoaderStarted) {
563
610
  this.logger.consoleFailure(warning);
564
611
  } else {
565
- this.logger.console(warning);
566
- this.logger.console(e);
612
+ this.logger.consoleWarning(warning);
613
+ this.logger.consoleWarning(e);
567
614
  }
568
615
  if (throwOnError) {
569
616
  throw e;
@@ -1 +1 @@
1
- {"version":3,"names":["AspectLoaderMain","constructor","logger","envs","harmony","onAspectLoadErrorSlot","onLoadRequireableExtensionSlot","pluginSlot","getCompiler","component","env","getEnv","registerOnAspectLoadErrorSlot","onAspectLoadError","register","registerOnLoadRequireableExtensionSlot","onLoadRequireableExtension","triggerOnAspectLoadError","err","entries","toArray","isFixed","mapSeries","onAspectFailFunc","result","id","getRuntimePath","modulePath","runtime","runtimeFile","filesystem","files","find","file","relative","includes","compiler","join","dist","getDistPathBySrcPath","e","info","distPath","DEFAULT_DIST_DIRNAME","replaceFileExtToJs","getAspectFilePath","aspectFile","isAspectLoaded","failedAspects","get","getDescriptor","instance","iconFn","icon","apply","undefined","getNotLoadedConfiguredExtensions","configuredAspects","Array","from","config","raw","keys","loadedExtensions","extensionsIds","extensionsToLoad","difference","loadDefinition","props","AspectDefinition","coreAspects","_coreAspects","isCoreAspect","ids","getCoreAspectIds","setCoreAspects","aspects","map","aspect","concat","_reserved","getCoreEnvsIds","envsIds","allIds","intersection","isCoreEnv","getUserAspects","coreAspectIds","getCoreAspectDefs","runtimeName","defs","Promise","all","rawDef","getAspectDef","filter","def","runtimePath","resolveAspects","components","resolver","promises","resolvedAspect","aspectPath","aspectFilePath","aspectDefs","mainAspect","_mainAspect","setMainAspect","failedLoadAspect","resetFailedLoadAspects","addFailure","push","cloneManifest","manifest","cloned","Object","assign","create","getPrototypeOf","provider","addRuntime","getRuntime","doRequire","requireableExtension","idStr","toString","require","default","newManifest","runOnLoadRequireableExtensionSubscribers","loadRequireableExtensions","requireableExtensions","throwOnError","manifests","getManifestsFromRequireableExtensions","loadExtensionsByManifests","manifestsP","firstErr","warn","errAfterReLoad","error","handleExtensionLoadingError","compact","errorMsg","message","split","msg","UNABLE_TO_LOAD_EXTENSION","console","CannotLoadExtension","isLoaderStarted","consoleFailure","updatedManifest","onLoadRequireableExtensionFunc","getPluginDefs","flatten","values","getPlugins","componentPath","Plugins","bind","relativePath","isAspect","isValidAspect","isAspectComponent","isUsingAspectEnv","loadAspectsFromGlobalScope","aspectIds","globalScope","LegacyScope","ensure","GLOBAL_SCOPE","ensureDir","globalScopeHarmony","loadBit","path","scope","ScopeAspect","aspectLoader","AspectLoaderAspect","ComponentID","fromLegacy","BitId","parse","hasVersions","every","hasVersion","useCache","import","throwIfNotExist","resolvedAspects","getResolvedAspects","code","resolvedAspectsAgain","skipIfExists","prepareManifests","MainRuntime","Error","Aspect","registerPlugins","pluginDefs","extensionsManifests","seeders","isValid","preparedManifests","getOnlyDeclaredDependenciesManifests","length","manifestGraph","generateManifestGraph","nodes","seeder","successors","flat","seederNodes","node","allNodes","nodesUniq","uniqBy","n","attr","relevantManifests","load","warning","UNABLE_TO_LOAD_EXTENSION_FROM_LIST","graph","Graph","forEach","setNode","Node","deps","dependencies","dep","setEdge","Edge","loggerExt","createLogger","getEnvPlugin","LoggerAspect","EnvsAspect","Slot","withType"],"sources":["aspect-loader.main.runtime.ts"],"sourcesContent":["import { join } from 'path';\nimport { Graph, Node, Edge } from '@teambit/graph.cleargraph';\nimport { BitId } from '@teambit/legacy-bit-id';\nimport LegacyScope from '@teambit/legacy/dist/scope/scope';\nimport { GLOBAL_SCOPE, DEFAULT_DIST_DIRNAME } from '@teambit/legacy/dist/constants';\nimport { MainRuntime } from '@teambit/cli';\nimport { ExtensionManifest, Harmony, Aspect, SlotRegistry, Slot } from '@teambit/harmony';\nimport type { LoggerMain } from '@teambit/logger';\nimport { ComponentID, Component } from '@teambit/component';\nimport { Logger, LoggerAspect } from '@teambit/logger';\nimport { RequireableComponent } from '@teambit/harmony.modules.requireable-component';\nimport { replaceFileExtToJs } from '@teambit/compilation.modules.babel-compiler';\nimport { EnvsAspect, EnvsMain } from '@teambit/envs';\nimport { loadBit } from '@teambit/bit';\nimport { ScopeAspect, ScopeMain } from '@teambit/scope';\nimport mapSeries from 'p-map-series';\nimport { difference, compact, flatten, intersection, uniqBy } from 'lodash';\nimport { AspectDefinition, AspectDefinitionProps } from './aspect-definition';\nimport { PluginDefinition } from './plugin-definition';\nimport { AspectLoaderAspect } from './aspect-loader.aspect';\nimport { UNABLE_TO_LOAD_EXTENSION, UNABLE_TO_LOAD_EXTENSION_FROM_LIST } from './constants';\nimport { CannotLoadExtension } from './exceptions';\nimport { getAspectDef } from './core-aspects';\nimport { Plugins } from './plugins';\n\nexport type PluginDefinitionSlot = SlotRegistry<PluginDefinition[]>;\n\nexport type AspectDescriptor = {\n /**\n * name of the extension.\n */\n id: string;\n\n /**\n * icon of the extension.\n */\n icon?: string;\n};\n\nexport type AspectResolver = (component: Component) => Promise<ResolvedAspect>;\n\nexport type ResolvedAspect = {\n aspectPath: string;\n runtimePath: string | null;\n aspectFilePath: string | null;\n};\n\ntype OnAspectLoadError = (err: Error, id: ComponentID) => Promise<boolean>;\nexport type OnAspectLoadErrorSlot = SlotRegistry<OnAspectLoadError>;\n\nexport type OnAspectLoadErrorHandler = (err: Error, component: Component) => Promise<boolean>;\n\nexport type OnLoadRequireableExtension = (\n requireableExtension: RequireableComponent,\n manifest: ExtensionManifest | Aspect\n) => Promise<ExtensionManifest | Aspect>;\n/**\n * A slot which run during loading the requirable extension (after first manifest calculation)\n */\nexport type OnLoadRequireableExtensionSlot = SlotRegistry<OnLoadRequireableExtension>;\n\nexport type MainAspect = {\n /**\n * path to the main aspect.\n */\n path: string;\n\n /**\n * version of the aspect.\n */\n version: string | undefined;\n\n /**\n * package name of the aspect\n */\n packageName: string | undefined;\n\n /**\n * reference to aspect manifest.\n */\n aspect: Aspect;\n\n /**\n * The name of the aspect (without the scope prefix)\n */\n name: string;\n\n /**\n * The name of the aspect\n */\n id: string;\n};\n\nexport class AspectLoaderMain {\n constructor(\n private logger: Logger,\n private envs: EnvsMain,\n private harmony: Harmony,\n private onAspectLoadErrorSlot: OnAspectLoadErrorSlot,\n private onLoadRequireableExtensionSlot: OnLoadRequireableExtensionSlot,\n private pluginSlot: PluginDefinitionSlot\n ) {}\n\n private getCompiler(component: Component) {\n const env = this.envs.getEnv(component)?.env;\n return env?.getCompiler();\n }\n\n registerOnAspectLoadErrorSlot(onAspectLoadError: OnAspectLoadError) {\n this.onAspectLoadErrorSlot.register(onAspectLoadError);\n }\n\n registerOnLoadRequireableExtensionSlot(onLoadRequireableExtension: OnLoadRequireableExtension) {\n this.onLoadRequireableExtensionSlot.register(onLoadRequireableExtension);\n }\n\n /**\n * returns whether the aspect-load issue has been fixed.\n */\n async triggerOnAspectLoadError(err: Error, component: Component): Promise<boolean> {\n const entries = this.onAspectLoadErrorSlot.toArray(); // e.g. [ [ 'teambit.bit/compiler', [Function: bound onAspectLoadError] ] ]\n let isFixed = false;\n await mapSeries(entries, async ([, onAspectFailFunc]) => {\n const result = await onAspectFailFunc(err, component.id);\n if (result) isFixed = true;\n });\n\n return isFixed;\n }\n\n async getRuntimePath(component: Component, modulePath: string, runtime: string): Promise<string | null> {\n const runtimeFile = component.filesystem.files.find((file: any) => {\n return file.relative.includes(`.${runtime}.runtime`);\n });\n\n // @david we should add a compiler api for this.\n if (!runtimeFile) return null;\n try {\n const compiler = this.getCompiler(component);\n\n if (!compiler) {\n return join(modulePath, runtimeFile.relative);\n }\n\n const dist = compiler.getDistPathBySrcPath(runtimeFile.relative);\n return join(modulePath, dist);\n } catch (e) {\n this.logger.info(`got an error during get runtime path, probably the env is not loaded yet ${e}`);\n // TODO: we are manually adding the dist here and replace the file name to handle case when\n // we load aspects from scope, and their env in the same iteration, but we get into the aspect before its\n // env, so it's env doesn't exist yet\n // we should make sure to first load the env correctly before loading the aspect\n const distPath = join(modulePath, DEFAULT_DIST_DIRNAME, replaceFileExtToJs(runtimeFile.relative));\n return distPath;\n }\n }\n\n async getAspectFilePath(component: Component, modulePath: string): Promise<string | null> {\n const aspectFile = component.filesystem.files.find((file: any) => {\n return file.relative.includes(`.aspect.ts`) || file.relative.includes(`.aspect.js`);\n });\n\n // @david we should add a compiler api for this.\n if (!aspectFile) return null;\n try {\n const compiler = this.getCompiler(component);\n\n if (!compiler) {\n return join(modulePath, aspectFile.relative);\n }\n\n const dist = compiler.getDistPathBySrcPath(aspectFile.relative);\n return join(modulePath, dist);\n } catch (e) {\n this.logger.info(`got an error during get runtime path, probably the env is not loaded yet ${e}`);\n // TODO: we are manually adding the dist here and replace the file name to handle case when\n // we load aspects from scope, and their env in the same iteration, but we get into the aspect before its\n // env, so it's env doesn't exist yet\n // we should make sure to first load the env correctly before loading the aspect\n const distPath = join(modulePath, DEFAULT_DIST_DIRNAME, replaceFileExtToJs(aspectFile.relative));\n return distPath;\n }\n }\n\n isAspectLoaded(id: string) {\n if (this.failedAspects.includes(id)) return true;\n try {\n return this.harmony.get(id);\n } catch (err: any) {\n return false;\n }\n }\n\n getDescriptor(id: string): AspectDescriptor | undefined {\n try {\n const instance = this.harmony.get<any>(id);\n const iconFn = instance.icon;\n\n const icon = iconFn ? iconFn.apply(instance) : undefined;\n\n return {\n id,\n icon,\n };\n } catch (err) {\n return undefined;\n }\n }\n\n getNotLoadedConfiguredExtensions() {\n const configuredAspects = Array.from(this.harmony.config.raw.keys());\n const loadedExtensions = this.harmony.extensionsIds;\n const extensionsToLoad = difference(configuredAspects, loadedExtensions);\n return extensionsToLoad;\n }\n\n loadDefinition(props: AspectDefinitionProps): AspectDefinition {\n return AspectDefinition.from(props);\n }\n\n private _coreAspects: Aspect[] = [];\n\n get coreAspects() {\n return this._coreAspects;\n }\n\n isCoreAspect(id: string) {\n const ids = this.getCoreAspectIds();\n return ids.includes(id);\n }\n\n setCoreAspects(aspects: Aspect[]) {\n this._coreAspects = aspects;\n return this;\n }\n\n getCoreAspectIds() {\n const ids = this.coreAspects.map((aspect) => aspect.id);\n return ids.concat(this._reserved);\n }\n\n /**\n * Get all the core envs ids which is still register in the bit manifest as core aspect\n */\n getCoreEnvsIds(): string[] {\n const envsIds = this.envs.getCoreEnvsIds();\n const allIds = this.getCoreAspectIds();\n return intersection(allIds, envsIds);\n }\n\n isCoreEnv(id: string): boolean {\n const ids = this.getCoreEnvsIds();\n return ids.includes(id);\n }\n\n private _reserved = ['teambit.harmony/bit', 'teambit.harmony/config'];\n\n getUserAspects(): string[] {\n const coreAspectIds = this.getCoreAspectIds();\n return difference(this.harmony.extensionsIds, coreAspectIds);\n }\n\n async getCoreAspectDefs(runtimeName?: string) {\n const defs = await Promise.all(\n this.coreAspects.map(async (aspect) => {\n const id = aspect.id;\n const rawDef = await getAspectDef(id, runtimeName);\n return this.loadDefinition(rawDef);\n })\n );\n\n return defs.filter((def) => def.runtimePath);\n }\n\n async resolveAspects(components: Component[], resolver: AspectResolver): Promise<AspectDefinition[]> {\n const promises = components.map(async (component) => {\n const resolvedAspect = await resolver(component);\n return new AspectDefinition(\n resolvedAspect.aspectPath,\n resolvedAspect.aspectFilePath,\n resolvedAspect.runtimePath,\n component\n );\n });\n\n const aspectDefs = await Promise.all(promises);\n // return aspectDefs.filter((def) => def.runtimePath);\n return aspectDefs;\n }\n\n private _mainAspect: MainAspect;\n\n get mainAspect() {\n return this._mainAspect;\n }\n\n setMainAspect(mainAspect: MainAspect) {\n this._mainAspect = mainAspect;\n return this;\n }\n\n private failedLoadAspect: string[] = [];\n\n get failedAspects() {\n return this.failedLoadAspect;\n }\n\n public resetFailedLoadAspects() {\n this.failedLoadAspect = [];\n }\n\n private addFailure(id: string): void {\n if (this.failedAspects.includes(id)) return;\n this.failedLoadAspect.push(id);\n }\n\n cloneManifest(manifest: any) {\n const cloned = Object.assign(Object.create(Object.getPrototypeOf(manifest)), manifest);\n cloned.provider = manifest.provider;\n cloned.addRuntime = manifest.addRuntime;\n cloned.getRuntime = manifest.getRuntime;\n return cloned;\n }\n\n /**\n * run \"require\" of the component code to get the manifest\n */\n async doRequire(requireableExtension: RequireableComponent): Promise<ExtensionManifest | Aspect> {\n const idStr = requireableExtension.component.id.toString();\n const aspect = await requireableExtension.require();\n const manifest = aspect.default || aspect;\n manifest.id = idStr;\n // It's important to clone deep the manifest here to prevent mutate dependencies of other manifests as they point to the same location in memory\n const cloned = this.cloneManifest(manifest);\n const newManifest = await this.runOnLoadRequireableExtensionSubscribers(requireableExtension, cloned);\n return newManifest;\n }\n\n /**\n * in case the extension failed to load, prefer to throw an error, unless `throwOnError` param\n * passed as `false`.\n * there are cases when throwing an error blocks the user from doing anything else. for example,\n * when a user develops an extension and deletes the node-modules, the extension on the workspace\n * cannot be loaded anymore until \"bit compile\" is running. however, if this function throws an\n * error, it'll throw for \"bit compile\" as well, which blocks the user.\n * for the CI, it is important to throw an error because errors on console can be ignored.\n * for now, when loading the extension from the workspace the throwOnError is passed as false.\n * when loading from the scope (CI) it should be true.\n *\n * the console printing here is done directly by \"console.error\" and not by the logger. the reason\n * is that the logger.console only prints when the loader started (which, btw, happens after\n * entering this function, so it can't work) and here we want it to be printed regardless of the\n * rules of starting the loader. e.g. if by mistake the CI got it as throwOnError=false, it's ok\n * to break the output by the console.error.\n *\n * @todo: this is not the final word however about throwing/non throwing errors here.\n * in some cases, such as \"bit tag\", it's better not to tag if an extension changes the model.\n */\n async loadRequireableExtensions(requireableExtensions: RequireableComponent[], throwOnError = false): Promise<void> {\n const manifests = await this.getManifestsFromRequireableExtensions(requireableExtensions, throwOnError);\n return this.loadExtensionsByManifests(manifests, throwOnError);\n }\n\n async getManifestsFromRequireableExtensions(\n requireableExtensions: RequireableComponent[],\n throwOnError = false\n ): Promise<Array<ExtensionManifest | Aspect>> {\n const manifestsP = mapSeries(requireableExtensions, async (requireableExtension) => {\n if (!requireableExtensions) return undefined;\n const idStr = requireableExtension.component.id.toString();\n try {\n return await this.doRequire(requireableExtension);\n } catch (firstErr: any) {\n this.addFailure(idStr);\n this.logger.warn(`failed loading an aspect \"${idStr}\", will try to fix and reload`, firstErr);\n const isFixed = await this.triggerOnAspectLoadError(firstErr, requireableExtension.component);\n let errAfterReLoad;\n if (isFixed) {\n this.logger.info(`the loading issue might be fixed now, re-loading ${idStr}`);\n try {\n return await this.doRequire(requireableExtension);\n } catch (err: any) {\n this.logger.warn(`re-load of the aspect \"${idStr}\" failed as well`, err);\n errAfterReLoad = err;\n }\n }\n const error = errAfterReLoad || firstErr;\n this.handleExtensionLoadingError(error, idStr, throwOnError);\n }\n return undefined;\n });\n const manifests = await manifestsP;\n\n // Remove empty manifests as a result of loading issue\n return compact(manifests);\n }\n\n handleExtensionLoadingError(error: Error, idStr: string, throwOnError: boolean) {\n const errorMsg = error.message.split('\\n')[0]; // show only the first line if the error is long (e.g. happens with MODULE_NOT_FOUND errors)\n const msg = UNABLE_TO_LOAD_EXTENSION(idStr, errorMsg);\n if (throwOnError) {\n // @ts-ignore\n this.logger.console(error);\n throw new CannotLoadExtension(idStr, error);\n }\n this.logger.error(msg, error);\n if (this.logger.isLoaderStarted) {\n this.logger.consoleFailure(msg);\n } else {\n this.logger.console(msg);\n }\n }\n\n async runOnLoadRequireableExtensionSubscribers(\n requireableExtension: RequireableComponent,\n manifest: ExtensionManifest | Aspect\n ): Promise<ExtensionManifest | Aspect> {\n let updatedManifest = manifest;\n const entries = this.onLoadRequireableExtensionSlot.toArray();\n await mapSeries(entries, async ([, onLoadRequireableExtensionFunc]) => {\n updatedManifest = await onLoadRequireableExtensionFunc(requireableExtension, updatedManifest);\n });\n return updatedManifest;\n }\n\n getPluginDefs() {\n return flatten(this.pluginSlot.values());\n }\n\n getPlugins(component: Component, componentPath: string): Plugins {\n const defs = this.getPluginDefs();\n return Plugins.from(component, defs, this.triggerOnAspectLoadError.bind(this), this.logger, (relativePath) => {\n const compiler = this.getCompiler(component);\n if (!compiler) {\n return join(componentPath, relativePath);\n }\n\n const dist = compiler.getDistPathBySrcPath(relativePath);\n return join(componentPath, dist);\n });\n }\n\n isAspect(manifest: any) {\n return !!(manifest.addRuntime && manifest.getRuntime);\n }\n\n isValidAspect(manifest: any): boolean {\n return this.isAspect(manifest) || manifest.provider;\n }\n\n isAspectComponent(component: Component): boolean {\n return this.envs.isUsingAspectEnv(component);\n }\n\n /**\n * get or create a global scope, import the non-core aspects, load bit from that scope, create\n * capsules for the aspects and load them from the capsules.\n */\n async loadAspectsFromGlobalScope(\n aspectIds: string[]\n ): Promise<{ components: Component[]; globalScopeHarmony: Harmony }> {\n const globalScope = await LegacyScope.ensure(GLOBAL_SCOPE, 'global-scope');\n await globalScope.ensureDir();\n const globalScopeHarmony = await loadBit(globalScope.path);\n const scope = globalScopeHarmony.get<ScopeMain>(ScopeAspect.id);\n const aspectLoader = globalScopeHarmony.get<AspectLoaderMain>(AspectLoaderAspect.id);\n // @todo: Gilad make this work\n // const ids = await scope.resolveMultipleComponentIds(aspectIds);\n const ids = aspectIds.map((id) => ComponentID.fromLegacy(BitId.parse(id, true)));\n const hasVersions = ids.every((id) => id.hasVersion());\n const useCache = hasVersions; // if all components has versions, try to use the cached aspects\n const components = await scope.import(ids, { useCache, throwIfNotExist: true });\n\n // don't use `await scope.loadAspectsFromCapsules(components, true);`\n // it won't work for globalScope because `this !== scope.aspectLoader` (this instance\n // is not the same as the aspectLoader instance Scope has)\n const resolvedAspects = await scope.getResolvedAspects(components);\n try {\n await aspectLoader.loadRequireableExtensions(resolvedAspects, true);\n } catch (err: any) {\n if (err?.error?.code === 'MODULE_NOT_FOUND') {\n const resolvedAspectsAgain = await scope.getResolvedAspects(components, { skipIfExists: false });\n await aspectLoader.loadRequireableExtensions(resolvedAspectsAgain, true);\n } else {\n throw err;\n }\n }\n\n return { components, globalScopeHarmony };\n }\n\n private prepareManifests(manifests: Array<ExtensionManifest | Aspect>): Aspect[] {\n return manifests.map((manifest: any) => {\n if (this.isAspect(manifest)) return manifest as Aspect;\n manifest.runtime = MainRuntime;\n if (!manifest.id) throw new Error('manifest must have static id');\n const aspect = Aspect.create({\n id: manifest.id,\n });\n aspect.addRuntime(manifest);\n return aspect;\n });\n }\n\n /**\n * register a plugin.\n */\n registerPlugins(pluginDefs: PluginDefinition[]) {\n this.pluginSlot.register(pluginDefs);\n }\n\n async loadExtensionsByManifests(\n extensionsManifests: Array<ExtensionManifest | Aspect>,\n throwOnError = true,\n seeders: string[] = []\n ) {\n try {\n const manifests = extensionsManifests.filter((manifest) => {\n const isValid = this.isValidAspect(manifest);\n if (!isValid) this.logger.warn(`${manifest.id} is invalid. please make sure the extension is valid.`);\n return isValid;\n });\n const preparedManifests = this.prepareManifests(manifests);\n // don't let harmony load all aspects. if seeders were sent, find their manifests, check for their static\n // dependencies, and load only them.\n const getOnlyDeclaredDependenciesManifests = () => {\n if (!seeders.length || seeders.length === preparedManifests.length) {\n return preparedManifests;\n }\n const manifestGraph = this.generateManifestGraph(preparedManifests);\n const nodes = seeders.map((seeder) => manifestGraph.successors(seeder)).flat();\n const seederNodes = compact(seeders.map((seeder) => manifestGraph.node(seeder)));\n const allNodes = [...nodes, ...seederNodes];\n const nodesUniq = uniqBy(allNodes, 'id');\n return nodesUniq.map((n) => n.attr);\n };\n const relevantManifests = getOnlyDeclaredDependenciesManifests();\n // @ts-ignore TODO: fix this\n await this.harmony.load(relevantManifests);\n } catch (e: any) {\n const ids = extensionsManifests.map((manifest) => manifest.id || 'unknown');\n // TODO: improve texts\n const errorMsg = e.message.split('\\n')[0];\n const warning = UNABLE_TO_LOAD_EXTENSION_FROM_LIST(ids, errorMsg);\n this.logger.error(warning, e);\n if (this.logger.isLoaderStarted) {\n this.logger.consoleFailure(warning);\n } else {\n this.logger.console(warning);\n this.logger.console(e);\n }\n if (throwOnError) {\n throw e;\n }\n }\n }\n\n private generateManifestGraph(manifests: Aspect[]) {\n const graph = new Graph<Aspect, string>();\n manifests.forEach((manifest) => graph.setNode(new Node(manifest.id, manifest)));\n manifests.forEach((manifest) => {\n const deps = manifest.getRuntime(MainRuntime)?.dependencies?.map((dep) => dep.id);\n deps?.forEach((dep) => {\n if (graph.node(dep)) {\n graph.setEdge(new Edge(manifest.id, dep, 'dep'));\n }\n });\n });\n return graph;\n }\n\n static runtime = MainRuntime;\n static dependencies = [LoggerAspect, EnvsAspect];\n static slots = [\n Slot.withType<OnAspectLoadError>(),\n Slot.withType<OnLoadRequireableExtension>(),\n Slot.withType<PluginDefinition[]>(),\n ];\n\n static async provider(\n [loggerExt, envs]: [LoggerMain, EnvsMain],\n config,\n [onAspectLoadErrorSlot, onLoadRequireableExtensionSlot, pluginSlot]: [\n OnAspectLoadErrorSlot,\n OnLoadRequireableExtensionSlot,\n PluginDefinitionSlot\n ],\n harmony: Harmony\n ) {\n const logger = loggerExt.createLogger(AspectLoaderAspect.id);\n const aspectLoader = new AspectLoaderMain(\n logger,\n envs,\n harmony,\n onAspectLoadErrorSlot,\n onLoadRequireableExtensionSlot,\n pluginSlot\n );\n\n aspectLoader.registerPlugins([envs.getEnvPlugin()]);\n\n return aspectLoader;\n }\n}\n\nAspectLoaderAspect.addRuntime(AspectLoaderMain);\n\nexport default AspectLoaderMain;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AA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IAAI,CAAC0O,YAAY,EAAE,CAAC,CAAC;IAEnD,OAAO1D,YAAY;EACrB;AACF;AAAC;AAAA,gCA9fYnL,gBAAgB,aA8dVqM,kBAAW;AAAA,gCA9djBrM,gBAAgB,kBA+dL,CAAC8O,sBAAY,EAAEC,kBAAU,CAAC;AAAA,gCA/drC/O,gBAAgB,WAgeZ,CACbgP,eAAI,CAACC,QAAQ,EAAqB,EAClCD,eAAI,CAACC,QAAQ,EAA8B,EAC3CD,eAAI,CAACC,QAAQ,EAAsB,CACpC;AA4BH7D,kCAAkB,CAAC3D,UAAU,CAACzH,gBAAgB,CAAC;AAAC,eAEjCA,gBAAgB;AAAA"}
1
+ {"version":3,"names":["AspectLoaderMain","constructor","logger","envs","harmony","onAspectLoadErrorSlot","onLoadRequireableExtensionSlot","pluginSlot","getCompiler","component","env","getEnv","registerOnAspectLoadErrorSlot","onAspectLoadError","register","registerOnLoadRequireableExtensionSlot","onLoadRequireableExtension","triggerOnAspectLoadError","err","entries","toArray","isFixed","mapSeries","onAspectFailFunc","result","id","getRuntimePath","modulePath","runtime","runtimeFile","filesystem","files","find","file","relative","includes","compiler","join","dist","getDistPathBySrcPath","e","info","distPath","DEFAULT_DIST_DIRNAME","replaceFileExtToJs","getAspectFilePath","aspectFile","isAspectLoaded","failedAspects","get","getDescriptor","instance","iconFn","icon","apply","undefined","addInMemoryConfiguredAspect","aspectId","inMemoryConfiguredAspects","push","getConfiguredAspects","configuredAspects","Array","from","config","raw","keys","iMemoryConfiguredAspects","concat","getNotLoadedConfiguredExtensions","loadedExtensions","extensionsIds","extensionsToLoad","difference","loadDefinition","props","AspectDefinition","coreAspects","_coreAspects","isCoreAspect","ids","getCoreAspectIds","setCoreAspects","aspects","map","aspect","_reserved","getCoreEnvsIds","envsIds","allIds","intersection","isCoreEnv","getUserAspects","coreAspectIds","getCoreAspectDefs","runtimeName","defs","Promise","all","rawDef","getAspectDef","filter","def","runtimePath","resolveAspects","components","resolver","promises","resolvedAspect","aspectPath","aspectFilePath","aspectDefs","compact","mainAspect","_mainAspect","setMainAspect","failedLoadAspect","resetFailedLoadAspects","addFailure","cloneManifest","manifest","cloned","Object","assign","create","getPrototypeOf","provider","addRuntime","getRuntime","doRequire","requireableExtension","idStr","toString","require","default","newManifest","runOnLoadRequireableExtensionSubscribers","loadRequireableExtensions","requireableExtensions","throwOnError","manifests","getManifestsFromRequireableExtensions","loadExtensionsByManifests","manifestsP","firstErr","warn","errAfterReLoad","error","handleExtensionLoadingError","errorMsg","message","split","msg","UNABLE_TO_LOAD_EXTENSION","console","CannotLoadExtension","isLoaderStarted","consoleFailure","consoleWarning","updatedManifest","onLoadRequireableExtensionFunc","getPluginDefs","flatten","values","getPlugins","componentPath","Plugins","bind","relativePath","isAspect","isValidAspect","isAspectComponent","isUsingAspectEnv","loadAspectsFromGlobalScope","aspectIds","globalScope","LegacyScope","ensure","GLOBAL_SCOPE","ensureDir","globalScopeHarmony","loadBit","path","scope","ScopeAspect","aspectLoader","AspectLoaderAspect","ComponentID","fromLegacy","BitId","parse","hasVersions","every","hasVersion","useCache","import","throwIfNotExist","resolvedAspects","getResolvedAspects","code","resolvedAspectsAgain","skipIfExists","filterAspectDefs","allDefs","componentIds","filterOpts","coreIds","stringIds","toStringWithoutVersion","afterExclusion","excludeCore","isCore","getId","fromString","isTarget","uniqDefs","uniqBy","filterByRuntime","length","requestedOnly","componentIdsString","prepareManifests","MainRuntime","Error","Aspect","registerPlugins","pluginDefs","extensionsManifests","seeders","isValid","preparedManifests","getOnlyDeclaredDependenciesManifests","manifestGraph","generateManifestGraph","nodes","seeder","successors","flat","seederNodes","node","allNodes","nodesUniq","n","attr","relevantManifests","load","warning","UNABLE_TO_LOAD_EXTENSION_FROM_LIST","graph","Graph","forEach","setNode","Node","deps","dependencies","dep","setEdge","Edge","loggerExt","createLogger","getEnvPlugin","LoggerAspect","EnvsAspect","Slot","withType"],"sources":["aspect-loader.main.runtime.ts"],"sourcesContent":["import { join } from 'path';\nimport { Graph, Node, Edge } from '@teambit/graph.cleargraph';\nimport { BitId } from '@teambit/legacy-bit-id';\nimport LegacyScope from '@teambit/legacy/dist/scope/scope';\nimport { GLOBAL_SCOPE, DEFAULT_DIST_DIRNAME } from '@teambit/legacy/dist/constants';\nimport { MainRuntime } from '@teambit/cli';\nimport { ExtensionManifest, Harmony, Aspect, SlotRegistry, Slot } from '@teambit/harmony';\nimport type { LoggerMain } from '@teambit/logger';\nimport { ComponentID, Component, FilterAspectsOptions } from '@teambit/component';\nimport { Logger, LoggerAspect } from '@teambit/logger';\nimport { RequireableComponent } from '@teambit/harmony.modules.requireable-component';\nimport { replaceFileExtToJs } from '@teambit/compilation.modules.babel-compiler';\nimport { EnvsAspect, EnvsMain } from '@teambit/envs';\nimport { loadBit } from '@teambit/bit';\nimport { ScopeAspect, ScopeMain } from '@teambit/scope';\nimport mapSeries from 'p-map-series';\nimport { difference, compact, flatten, intersection, uniqBy } from 'lodash';\nimport { AspectDefinition, AspectDefinitionProps } from './aspect-definition';\nimport { PluginDefinition } from './plugin-definition';\nimport { AspectLoaderAspect } from './aspect-loader.aspect';\nimport { UNABLE_TO_LOAD_EXTENSION, UNABLE_TO_LOAD_EXTENSION_FROM_LIST } from './constants';\nimport { CannotLoadExtension } from './exceptions';\nimport { getAspectDef } from './core-aspects';\nimport { Plugins } from './plugins';\n\nexport type PluginDefinitionSlot = SlotRegistry<PluginDefinition[]>;\n\nexport type AspectDescriptor = {\n /**\n * name of the extension.\n */\n id: string;\n\n /**\n * icon of the extension.\n */\n icon?: string;\n};\n\nexport type AspectResolver = (component: Component) => Promise<ResolvedAspect | undefined>;\n\nexport type ResolvedAspect = {\n aspectPath: string;\n runtimePath: string | null;\n aspectFilePath: string | null;\n};\n\ntype OnAspectLoadError = (err: Error, id: ComponentID) => Promise<boolean>;\nexport type OnAspectLoadErrorSlot = SlotRegistry<OnAspectLoadError>;\n\nexport type OnAspectLoadErrorHandler = (err: Error, component: Component) => Promise<boolean>;\n\nexport type OnLoadRequireableExtension = (\n requireableExtension: RequireableComponent,\n manifest: ExtensionManifest | Aspect\n) => Promise<ExtensionManifest | Aspect>;\n/**\n * A slot which run during loading the requirable extension (after first manifest calculation)\n */\nexport type OnLoadRequireableExtensionSlot = SlotRegistry<OnLoadRequireableExtension>;\n\nexport type MainAspect = {\n /**\n * path to the main aspect.\n */\n path: string;\n\n /**\n * version of the aspect.\n */\n version: string | undefined;\n\n /**\n * package name of the aspect\n */\n packageName: string | undefined;\n\n /**\n * reference to aspect manifest.\n */\n aspect: Aspect;\n\n /**\n * The name of the aspect (without the scope prefix)\n */\n name: string;\n\n /**\n * The name of the aspect\n */\n id: string;\n};\n\nexport class AspectLoaderMain {\n private inMemoryConfiguredAspects: string[] = [];\n\n constructor(\n private logger: Logger,\n private envs: EnvsMain,\n private harmony: Harmony,\n private onAspectLoadErrorSlot: OnAspectLoadErrorSlot,\n private onLoadRequireableExtensionSlot: OnLoadRequireableExtensionSlot,\n private pluginSlot: PluginDefinitionSlot\n ) {}\n\n private getCompiler(component: Component) {\n const env = this.envs.getEnv(component)?.env;\n return env?.getCompiler();\n }\n\n registerOnAspectLoadErrorSlot(onAspectLoadError: OnAspectLoadError) {\n this.onAspectLoadErrorSlot.register(onAspectLoadError);\n }\n\n registerOnLoadRequireableExtensionSlot(onLoadRequireableExtension: OnLoadRequireableExtension) {\n this.onLoadRequireableExtensionSlot.register(onLoadRequireableExtension);\n }\n\n /**\n * returns whether the aspect-load issue has been fixed.\n */\n async triggerOnAspectLoadError(err: Error, component: Component): Promise<boolean> {\n const entries = this.onAspectLoadErrorSlot.toArray(); // e.g. [ [ 'teambit.bit/compiler', [Function: bound onAspectLoadError] ] ]\n let isFixed = false;\n await mapSeries(entries, async ([, onAspectFailFunc]) => {\n const result = await onAspectFailFunc(err, component.id);\n if (result) isFixed = true;\n });\n\n return isFixed;\n }\n\n async getRuntimePath(component: Component, modulePath: string, runtime: string): Promise<string | null> {\n const runtimeFile = component.filesystem.files.find((file: any) => {\n return file.relative.includes(`.${runtime}.runtime`);\n });\n\n // @david we should add a compiler api for this.\n if (!runtimeFile) return null;\n try {\n const compiler = this.getCompiler(component);\n\n if (!compiler) {\n return join(modulePath, runtimeFile.relative);\n }\n\n const dist = compiler.getDistPathBySrcPath(runtimeFile.relative);\n return join(modulePath, dist);\n } catch (e) {\n this.logger.info(`got an error during get runtime path, probably the env is not loaded yet ${e}`);\n // TODO: we are manually adding the dist here and replace the file name to handle case when\n // we load aspects from scope, and their env in the same iteration, but we get into the aspect before its\n // env, so it's env doesn't exist yet\n // we should make sure to first load the env correctly before loading the aspect\n const distPath = join(modulePath, DEFAULT_DIST_DIRNAME, replaceFileExtToJs(runtimeFile.relative));\n return distPath;\n }\n }\n\n async getAspectFilePath(component: Component, modulePath: string): Promise<string | null> {\n const aspectFile = component.filesystem.files.find((file: any) => {\n return file.relative.includes(`.aspect.ts`) || file.relative.includes(`.aspect.js`);\n });\n\n // @david we should add a compiler api for this.\n if (!aspectFile) return null;\n try {\n const compiler = this.getCompiler(component);\n\n if (!compiler) {\n return join(modulePath, aspectFile.relative);\n }\n\n const dist = compiler.getDistPathBySrcPath(aspectFile.relative);\n return join(modulePath, dist);\n } catch (e) {\n this.logger.info(`got an error during get runtime path, probably the env is not loaded yet ${e}`);\n // TODO: we are manually adding the dist here and replace the file name to handle case when\n // we load aspects from scope, and their env in the same iteration, but we get into the aspect before its\n // env, so it's env doesn't exist yet\n // we should make sure to first load the env correctly before loading the aspect\n const distPath = join(modulePath, DEFAULT_DIST_DIRNAME, replaceFileExtToJs(aspectFile.relative));\n return distPath;\n }\n }\n\n isAspectLoaded(id: string) {\n if (this.failedAspects.includes(id)) return true;\n try {\n return this.harmony.get(id);\n } catch (err: any) {\n return false;\n }\n }\n\n getDescriptor(id: string): AspectDescriptor | undefined {\n try {\n const instance = this.harmony.get<any>(id);\n const iconFn = instance.icon;\n\n const icon = iconFn ? iconFn.apply(instance) : undefined;\n\n return {\n id,\n icon,\n };\n } catch (err) {\n return undefined;\n }\n }\n\n /**\n * This is used when adding aspects to workspace.jsonc during the process (like in bit use command)\n * and we want to make sure that follow operation (like bit install) will recognize those aspects\n * but the harmony config is already in memory.\n * Probably a better to do it is to make sure we can re-load the config somehow\n * ideally by adding the config class in harmony a reload API\n * @param aspectId \n */\n addInMemoryConfiguredAspect(aspectId: string): void {\n this.inMemoryConfiguredAspects.push(aspectId);\n }\n\n /**\n * get all the configured aspects in the config file (workspace.jsonc / bit.jsonc)\n */\n getConfiguredAspects(): string[] {\n const configuredAspects = Array.from(this.harmony.config.raw.keys());\n const iMemoryConfiguredAspects = this.inMemoryConfiguredAspects;\n return configuredAspects.concat(iMemoryConfiguredAspects);\n }\n getNotLoadedConfiguredExtensions() {\n const configuredAspects = this.getConfiguredAspects();\n const loadedExtensions = this.harmony.extensionsIds;\n const extensionsToLoad = difference(configuredAspects, loadedExtensions);\n return extensionsToLoad;\n }\n\n loadDefinition(props: AspectDefinitionProps): AspectDefinition {\n return AspectDefinition.from(props);\n }\n\n private _coreAspects: Aspect[] = [];\n\n get coreAspects() {\n return this._coreAspects;\n }\n\n isCoreAspect(id: string) {\n const ids = this.getCoreAspectIds();\n return ids.includes(id);\n }\n\n setCoreAspects(aspects: Aspect[]) {\n this._coreAspects = aspects;\n return this;\n }\n\n getCoreAspectIds() {\n const ids = this.coreAspects.map((aspect) => aspect.id);\n return ids.concat(this._reserved);\n }\n\n /**\n * Get all the core envs ids which is still register in the bit manifest as core aspect\n */\n getCoreEnvsIds(): string[] {\n const envsIds = this.envs.getCoreEnvsIds();\n const allIds = this.getCoreAspectIds();\n return intersection(allIds, envsIds);\n }\n\n isCoreEnv(id: string): boolean {\n const ids = this.getCoreEnvsIds();\n return ids.includes(id);\n }\n\n private _reserved = ['teambit.harmony/bit', 'teambit.harmony/config'];\n\n getUserAspects(): string[] {\n const coreAspectIds = this.getCoreAspectIds();\n return difference(this.harmony.extensionsIds, coreAspectIds);\n }\n\n async getCoreAspectDefs(runtimeName?: string) {\n const defs = await Promise.all(\n this.coreAspects.map(async (aspect) => {\n const id = aspect.id;\n const rawDef = await getAspectDef(id, runtimeName);\n return this.loadDefinition(rawDef);\n })\n );\n\n return defs.filter((def) => def.runtimePath);\n }\n\n async resolveAspects(components: Component[], resolver: AspectResolver): Promise<AspectDefinition[]> {\n const promises = components.map(async (component) => {\n const resolvedAspect = await resolver(component);\n if (!resolvedAspect) return undefined;\n return new AspectDefinition(\n resolvedAspect.aspectPath,\n resolvedAspect.aspectFilePath,\n resolvedAspect.runtimePath,\n component\n );\n });\n\n const aspectDefs = await Promise.all(promises);\n // return aspectDefs.filter((def) => def.runtimePath);\n return compact(aspectDefs);\n }\n\n private _mainAspect: MainAspect;\n\n get mainAspect() {\n return this._mainAspect;\n }\n\n setMainAspect(mainAspect: MainAspect) {\n this._mainAspect = mainAspect;\n return this;\n }\n\n private failedLoadAspect: string[] = [];\n\n get failedAspects() {\n return this.failedLoadAspect;\n }\n\n public resetFailedLoadAspects() {\n this.failedLoadAspect = [];\n }\n\n private addFailure(id: string): void {\n if (this.failedAspects.includes(id)) return;\n this.failedLoadAspect.push(id);\n }\n\n cloneManifest(manifest: any) {\n const cloned = Object.assign(Object.create(Object.getPrototypeOf(manifest)), manifest);\n cloned.provider = manifest.provider;\n cloned.addRuntime = manifest.addRuntime;\n cloned.getRuntime = manifest.getRuntime;\n return cloned;\n }\n\n /**\n * run \"require\" of the component code to get the manifest\n */\n async doRequire(requireableExtension: RequireableComponent): Promise<ExtensionManifest | Aspect> {\n const idStr = requireableExtension.component.id.toString();\n const aspect = await requireableExtension.require();\n const manifest = aspect.default || aspect;\n manifest.id = idStr;\n // It's important to clone deep the manifest here to prevent mutate dependencies of other manifests as they point to the same location in memory\n const cloned = this.cloneManifest(manifest);\n const newManifest = await this.runOnLoadRequireableExtensionSubscribers(requireableExtension, cloned);\n return newManifest;\n }\n\n /**\n * in case the extension failed to load, prefer to throw an error, unless `throwOnError` param\n * passed as `false`.\n * there are cases when throwing an error blocks the user from doing anything else. for example,\n * when a user develops an extension and deletes the node-modules, the extension on the workspace\n * cannot be loaded anymore until \"bit compile\" is running. however, if this function throws an\n * error, it'll throw for \"bit compile\" as well, which blocks the user.\n * for the CI, it is important to throw an error because errors on console can be ignored.\n * for now, when loading the extension from the workspace the throwOnError is passed as false.\n * when loading from the scope (CI) it should be true.\n *\n * the console printing here is done directly by \"console.error\" and not by the logger. the reason\n * is that the logger.console only prints when the loader started (which, btw, happens after\n * entering this function, so it can't work) and here we want it to be printed regardless of the\n * rules of starting the loader. e.g. if by mistake the CI got it as throwOnError=false, it's ok\n * to break the output by the console.error.\n *\n * @todo: this is not the final word however about throwing/non throwing errors here.\n * in some cases, such as \"bit tag\", it's better not to tag if an extension changes the model.\n */\n async loadRequireableExtensions(requireableExtensions: RequireableComponent[], throwOnError = false): Promise<void> {\n const manifests = await this.getManifestsFromRequireableExtensions(requireableExtensions, throwOnError);\n return this.loadExtensionsByManifests(manifests, throwOnError);\n }\n\n async getManifestsFromRequireableExtensions(\n requireableExtensions: RequireableComponent[],\n throwOnError = false\n ): Promise<Array<ExtensionManifest | Aspect>> {\n const manifestsP = mapSeries(requireableExtensions, async (requireableExtension) => {\n if (!requireableExtensions) return undefined;\n const idStr = requireableExtension.component.id.toString();\n try {\n return await this.doRequire(requireableExtension);\n } catch (firstErr: any) {\n this.addFailure(idStr);\n this.logger.warn(`failed loading an aspect \"${idStr}\", will try to fix and reload`, firstErr);\n const isFixed = await this.triggerOnAspectLoadError(firstErr, requireableExtension.component);\n let errAfterReLoad;\n if (isFixed) {\n this.logger.info(`the loading issue might be fixed now, re-loading ${idStr}`);\n try {\n return await this.doRequire(requireableExtension);\n } catch (err: any) {\n this.logger.warn(`re-load of the aspect \"${idStr}\" failed as well`, err);\n errAfterReLoad = err;\n }\n }\n const error = errAfterReLoad || firstErr;\n this.handleExtensionLoadingError(error, idStr, throwOnError);\n }\n return undefined;\n });\n const manifests = await manifestsP;\n\n // Remove empty manifests as a result of loading issue\n return compact(manifests);\n }\n\n handleExtensionLoadingError(error: Error, idStr: string, throwOnError: boolean) {\n const errorMsg = error.message.split('\\n')[0]; // show only the first line if the error is long (e.g. happens with MODULE_NOT_FOUND errors)\n const msg = UNABLE_TO_LOAD_EXTENSION(idStr, errorMsg);\n if (throwOnError) {\n // @ts-ignore\n this.logger.console(error);\n throw new CannotLoadExtension(idStr, error);\n }\n this.logger.error(msg, error);\n if (this.logger.isLoaderStarted) {\n this.logger.consoleFailure(msg);\n } else {\n this.logger.consoleWarning(msg);\n }\n }\n\n async runOnLoadRequireableExtensionSubscribers(\n requireableExtension: RequireableComponent,\n manifest: ExtensionManifest | Aspect\n ): Promise<ExtensionManifest | Aspect> {\n let updatedManifest = manifest;\n const entries = this.onLoadRequireableExtensionSlot.toArray();\n await mapSeries(entries, async ([, onLoadRequireableExtensionFunc]) => {\n updatedManifest = await onLoadRequireableExtensionFunc(requireableExtension, updatedManifest);\n });\n return updatedManifest;\n }\n\n getPluginDefs() {\n return flatten(this.pluginSlot.values());\n }\n\n getPlugins(component: Component, componentPath: string): Plugins {\n const defs = this.getPluginDefs();\n return Plugins.from(component, defs, this.triggerOnAspectLoadError.bind(this), this.logger, (relativePath) => {\n const compiler = this.getCompiler(component);\n if (!compiler) {\n return join(componentPath, relativePath);\n }\n\n const dist = compiler.getDistPathBySrcPath(relativePath);\n return join(componentPath, dist);\n });\n }\n\n isAspect(manifest: any) {\n return !!(manifest.addRuntime && manifest.getRuntime);\n }\n\n isValidAspect(manifest: any): boolean {\n return this.isAspect(manifest) || manifest.provider;\n }\n\n isAspectComponent(component: Component): boolean {\n return this.envs.isUsingAspectEnv(component);\n }\n\n /**\n * get or create a global scope, import the non-core aspects, load bit from that scope, create\n * capsules for the aspects and load them from the capsules.\n */\n async loadAspectsFromGlobalScope(\n aspectIds: string[]\n ): Promise<{ components: Component[]; globalScopeHarmony: Harmony }> {\n const globalScope = await LegacyScope.ensure(GLOBAL_SCOPE, 'global-scope');\n await globalScope.ensureDir();\n const globalScopeHarmony = await loadBit(globalScope.path);\n const scope = globalScopeHarmony.get<ScopeMain>(ScopeAspect.id);\n const aspectLoader = globalScopeHarmony.get<AspectLoaderMain>(AspectLoaderAspect.id);\n // @todo: Gilad make this work\n // const ids = await scope.resolveMultipleComponentIds(aspectIds);\n const ids = aspectIds.map((id) => ComponentID.fromLegacy(BitId.parse(id, true)));\n const hasVersions = ids.every((id) => id.hasVersion());\n const useCache = hasVersions; // if all components has versions, try to use the cached aspects\n const components = await scope.import(ids, { useCache, throwIfNotExist: true });\n\n // don't use `await scope.loadAspectsFromCapsules(components, true);`\n // it won't work for globalScope because `this !== scope.aspectLoader` (this instance\n // is not the same as the aspectLoader instance Scope has)\n const resolvedAspects = await scope.getResolvedAspects(components);\n try {\n await aspectLoader.loadRequireableExtensions(resolvedAspects, true);\n } catch (err: any) {\n if (err?.error?.code === 'MODULE_NOT_FOUND') {\n const resolvedAspectsAgain = await scope.getResolvedAspects(components, { skipIfExists: false });\n await aspectLoader.loadRequireableExtensions(resolvedAspectsAgain, true);\n } else {\n throw err;\n }\n }\n\n return { components, globalScopeHarmony };\n }\n\n filterAspectDefs(\n allDefs: AspectDefinition[],\n componentIds: ComponentID[],\n runtimeName: string | undefined,\n filterOpts: FilterAspectsOptions = {}\n ) {\n const coreIds = this.getCoreAspectIds();\n const stringIds = componentIds.map((id) => id.toStringWithoutVersion());\n const afterExclusion = filterOpts.excludeCore\n ? allDefs.filter((def) => {\n const isCore = coreIds.includes(def.getId || '');\n const id = ComponentID.fromString(def.getId || '');\n const isTarget = stringIds.includes(id.toStringWithoutVersion());\n if (isTarget) return true;\n return !isCore;\n })\n : allDefs;\n\n const uniqDefs = uniqBy(afterExclusion, (def) => `${def.aspectPath}-${def.runtimePath}`);\n let defs = uniqDefs;\n if (runtimeName && filterOpts.filterByRuntime) {\n defs = defs.filter((def) => def.runtimePath);\n }\n\n if (componentIds && componentIds.length && filterOpts.requestedOnly) {\n const componentIdsString = componentIds.map((id) => id.toString());\n defs = defs.filter((def) => {\n return (\n (def.id && componentIdsString.includes(def.id)) ||\n (def.component && componentIdsString.includes(def.component?.id.toString()))\n );\n });\n }\n\n return defs;\n }\n\n private prepareManifests(manifests: Array<ExtensionManifest | Aspect>): Aspect[] {\n return manifests.map((manifest: any) => {\n if (this.isAspect(manifest)) return manifest as Aspect;\n manifest.runtime = MainRuntime;\n if (!manifest.id) throw new Error('manifest must have static id');\n const aspect = Aspect.create({\n id: manifest.id,\n });\n aspect.addRuntime(manifest);\n return aspect;\n });\n }\n\n /**\n * register a plugin.\n */\n registerPlugins(pluginDefs: PluginDefinition[]) {\n this.pluginSlot.register(pluginDefs);\n }\n\n async loadExtensionsByManifests(\n extensionsManifests: Array<ExtensionManifest | Aspect>,\n throwOnError = true,\n seeders: string[] = []\n ) {\n try {\n const manifests = extensionsManifests.filter((manifest) => {\n const isValid = this.isValidAspect(manifest);\n if (!isValid) this.logger.warn(`${manifest.id} is invalid. please make sure the extension is valid.`);\n return isValid;\n });\n const preparedManifests = this.prepareManifests(manifests);\n // don't let harmony load all aspects. if seeders were sent, find their manifests, check for their static\n // dependencies, and load only them.\n const getOnlyDeclaredDependenciesManifests = () => {\n if (!seeders.length || seeders.length === preparedManifests.length) {\n return preparedManifests;\n }\n const manifestGraph = this.generateManifestGraph(preparedManifests);\n const nodes = seeders.map((seeder) => manifestGraph.successors(seeder)).flat();\n const seederNodes = compact(seeders.map((seeder) => manifestGraph.node(seeder)));\n const allNodes = [...nodes, ...seederNodes];\n const nodesUniq = uniqBy(allNodes, 'id');\n return nodesUniq.map((n) => n.attr);\n };\n const relevantManifests = getOnlyDeclaredDependenciesManifests();\n // @ts-ignore TODO: fix this\n await this.harmony.load(relevantManifests);\n } catch (e: any) {\n const ids = extensionsManifests.map((manifest) => manifest.id || 'unknown');\n // TODO: improve texts\n const errorMsg = e.message.split('\\n')[0];\n const warning = UNABLE_TO_LOAD_EXTENSION_FROM_LIST(ids, errorMsg);\n this.logger.error(warning, e);\n if (this.logger.isLoaderStarted) {\n this.logger.consoleFailure(warning);\n } else {\n this.logger.consoleWarning(warning);\n this.logger.consoleWarning(e);\n }\n if (throwOnError) {\n throw e;\n }\n }\n }\n\n private generateManifestGraph(manifests: Aspect[]) {\n const graph = new Graph<Aspect, string>();\n manifests.forEach((manifest) => graph.setNode(new Node(manifest.id, manifest)));\n manifests.forEach((manifest) => {\n const deps = manifest.getRuntime(MainRuntime)?.dependencies?.map((dep) => dep.id);\n deps?.forEach((dep) => {\n if (graph.node(dep)) {\n graph.setEdge(new Edge(manifest.id, dep, 'dep'));\n }\n });\n });\n return graph;\n }\n\n static runtime = MainRuntime;\n static dependencies = [LoggerAspect, EnvsAspect];\n static slots = [\n Slot.withType<OnAspectLoadError>(),\n Slot.withType<OnLoadRequireableExtension>(),\n Slot.withType<PluginDefinition[]>(),\n ];\n\n static async provider(\n [loggerExt, envs]: [LoggerMain, EnvsMain],\n config,\n [onAspectLoadErrorSlot, onLoadRequireableExtensionSlot, pluginSlot]: [\n OnAspectLoadErrorSlot,\n OnLoadRequireableExtensionSlot,\n PluginDefinitionSlot\n ],\n harmony: Harmony\n ) {\n const logger = loggerExt.createLogger(AspectLoaderAspect.id);\n const aspectLoader = new AspectLoaderMain(\n logger,\n envs,\n harmony,\n onAspectLoadErrorSlot,\n onLoadRequireableExtensionSlot,\n pluginSlot\n );\n\n aspectLoader.registerPlugins([envs.getEnvPlugin()]);\n\n return aspectLoader;\n }\n}\n\nAspectLoaderAspect.addRuntime(AspectLoaderMain);\n\nexport default AspectLoaderMain;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;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;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AAI,EAACzI,QAAQ,CAAC/F,EAAE,EAAEsO,GAAG,EAAE,KAAK,CAAC,CAAC;QAClD;MACF,CAAC,CAAC;IACJ,CAAC,CAAC;IACF,OAAOP,KAAK;EACd;EAUA,aAAa1H,QAAQ,CACnB,CAACoI,SAAS,EAAE/P,IAAI,CAAyB,EACzC6D,MAAM,EACN,CAAC3D,qBAAqB,EAAEC,8BAA8B,EAAEC,UAAU,CAIjE,EACDH,OAAgB,EAChB;IACA,MAAMF,MAAM,GAAGgQ,SAAS,CAACC,YAAY,CAACzE,kCAAkB,CAACjK,EAAE,CAAC;IAC5D,MAAMgK,YAAY,GAAG,IAAIzL,gBAAgB,CACvCE,MAAM,EACNC,IAAI,EACJC,OAAO,EACPC,qBAAqB,EACrBC,8BAA8B,EAC9BC,UAAU,CACX;IAEDkL,YAAY,CAACwC,eAAe,CAAC,CAAC9N,IAAI,CAACiQ,YAAY,EAAE,CAAC,CAAC;IAEnD,OAAO3E,YAAY;EACrB;AACF;AAAC;AAAA,gCA1jBYzL,gBAAgB,aA0hBV8N,kBAAW;AAAA,gCA1hBjB9N,gBAAgB,kBA2hBL,CAACqQ,sBAAY,EAAEC,kBAAU,CAAC;AAAA,gCA3hBrCtQ,gBAAgB,WA4hBZ,CACbuQ,eAAI,CAACC,QAAQ,EAAqB,EAClCD,eAAI,CAACC,QAAQ,EAA8B,EAC3CD,eAAI,CAACC,QAAQ,EAAsB,CACpC;AA4BH9E,kCAAkB,CAAC3D,UAAU,CAAC/H,gBAAgB,CAAC;AAAC,eAEjCA,gBAAgB;AAAA"}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { AspectLoaderAspect } from './aspect-loader.aspect';
2
- export type { AspectLoaderMain, AspectDescriptor, MainAspect, OnLoadRequireableExtension, } from './aspect-loader.main.runtime';
2
+ export type { AspectLoaderMain, AspectDescriptor, MainAspect, OnLoadRequireableExtension, AspectResolver, ResolvedAspect } from './aspect-loader.main.runtime';
3
3
  export { getAspectDef, getAspectDir, getAspectDistDir, getCoreAspectPackageName, getCoreAspectName, getAspectDirFromBvm, } from './core-aspects';
4
4
  export { PluginDefinition } from './plugin-definition';
5
5
  export { AspectDefinition } from './aspect-definition';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["AspectLoaderAspect"],"sources":["index.ts"],"sourcesContent":["import { AspectLoaderAspect } from './aspect-loader.aspect';\n\nexport type {\n AspectLoaderMain,\n AspectDescriptor,\n MainAspect,\n OnLoadRequireableExtension,\n} from './aspect-loader.main.runtime';\nexport {\n getAspectDef,\n getAspectDir,\n getAspectDistDir,\n getCoreAspectPackageName,\n getCoreAspectName,\n getAspectDirFromBvm,\n} from './core-aspects';\nexport { PluginDefinition } from './plugin-definition';\nexport { AspectDefinition } from './aspect-definition';\nexport { AspectLoaderAspect };\nexport default AspectLoaderAspect;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAQA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAQA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAAuD,eAExCA,kCAAkB;AAAA"}
1
+ {"version":3,"names":["AspectLoaderAspect"],"sources":["index.ts"],"sourcesContent":["import { AspectLoaderAspect } from './aspect-loader.aspect';\n\nexport type {\n AspectLoaderMain,\n AspectDescriptor,\n MainAspect,\n OnLoadRequireableExtension,\n AspectResolver,\n ResolvedAspect\n} from './aspect-loader.main.runtime';\nexport {\n getAspectDef,\n getAspectDir,\n getAspectDistDir,\n getCoreAspectPackageName,\n getCoreAspectName,\n getAspectDirFromBvm,\n} from './core-aspects';\nexport { PluginDefinition } from './plugin-definition';\nexport { AspectDefinition } from './aspect-definition';\nexport { AspectLoaderAspect };\nexport default AspectLoaderAspect;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAUA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAQA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAAuD,eAExCA,kCAAkB;AAAA"}
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_aspect-loader@0.0.1002/dist/aspect-loader.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_aspect-loader@0.0.1002/dist/aspect-loader.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_aspect-loader@0.0.1006/dist/aspect-loader.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_aspect-loader@0.0.1006/dist/aspect-loader.docs.mdx';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/aspect-loader",
3
- "version": "0.0.1002",
3
+ "version": "0.0.1006",
4
4
  "homepage": "https://bit.dev/teambit/harmony/aspect-loader",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.harmony",
8
8
  "name": "aspect-loader",
9
- "version": "0.0.1002"
9
+ "version": "0.0.1006"
10
10
  },
11
11
  "dependencies": {
12
12
  "lodash": "4.17.21",
@@ -17,15 +17,15 @@
17
17
  "@teambit/harmony": "0.4.6",
18
18
  "@teambit/graph.cleargraph": "0.0.1",
19
19
  "@teambit/bvm.config": "0.2.2",
20
- "@teambit/component": "0.0.1002",
21
- "@teambit/bit": "0.0.1004",
22
- "@teambit/cli": "0.0.673",
20
+ "@teambit/component": "0.0.1006",
21
+ "@teambit/bit": "0.0.1008",
22
+ "@teambit/cli": "0.0.677",
23
23
  "@teambit/compilation.modules.babel-compiler": "0.0.133",
24
- "@teambit/envs": "0.0.1002",
24
+ "@teambit/envs": "0.0.1006",
25
25
  "@teambit/harmony.modules.requireable-component": "0.0.491",
26
26
  "@teambit/legacy-bit-id": "0.0.423",
27
- "@teambit/logger": "0.0.766",
28
- "@teambit/scope": "0.0.1002",
27
+ "@teambit/logger": "0.0.770",
28
+ "@teambit/scope": "0.0.1006",
29
29
  "@teambit/bit-error": "0.0.402"
30
30
  },
31
31
  "devDependencies": {
@@ -39,7 +39,7 @@
39
39
  "@types/testing-library__jest-dom": "5.9.5"
40
40
  },
41
41
  "peerDependencies": {
42
- "@teambit/legacy": "1.0.454",
42
+ "@teambit/legacy": "1.0.456",
43
43
  "react": "^16.8.0 || ^17.0.0",
44
44
  "react-dom": "^16.8.0 || ^17.0.0"
45
45
  },