@teambit/workspace 0.0.867 → 0.0.869
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/component-tree.widget.tsx +5 -11
- package/dist/component-tree.widget.d.ts +1 -1
- package/dist/component-tree.widget.js +4 -17
- package/dist/component-tree.widget.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/workspace-component/workspace-component-loader.js.map +1 -1
- package/dist/workspace.js +3 -1
- package/dist/workspace.js.map +1 -1
- package/dist/workspace.ui.drawer.js +40 -9
- package/dist/workspace.ui.drawer.js.map +1 -1
- package/dist/workspace.ui.runtime.js +12 -2
- package/dist/workspace.ui.runtime.js.map +1 -1
- package/package-tar/teambit-workspace-0.0.869.tgz +0 -0
- package/package.json +34 -32
- package/{preview-1664721514780.js → preview-1664813308287.js} +2 -2
- package/workspace-component/workspace-component-loader.ts +1 -1
- package/workspace.ui.drawer.tsx +28 -5
- package/workspace.ui.runtime.tsx +12 -8
- package/package-tar/teambit-workspace-0.0.867.tgz +0 -0
|
@@ -1,26 +1,20 @@
|
|
|
1
1
|
import { ComponentTreeNode, ComponentTreeNodeProps } from '@teambit/component-tree';
|
|
2
2
|
import { ComponentStatusResolver } from '@teambit/component.ui.component-status-resolver';
|
|
3
3
|
import { useLanes } from '@teambit/lanes.hooks.use-lanes';
|
|
4
|
-
import React, {
|
|
5
|
-
|
|
6
|
-
import { WorkspaceContext } from './ui/workspace/workspace-context';
|
|
4
|
+
import React, { useMemo } from 'react';
|
|
7
5
|
|
|
8
6
|
export class ComponentTreeWidget implements ComponentTreeNode {
|
|
9
7
|
widget = ({ component }: ComponentTreeNodeProps) => {
|
|
10
|
-
const workspace = useContext(WorkspaceContext);
|
|
11
|
-
const workspaceComponent = workspace.getComponent(component.id);
|
|
12
8
|
const { lanesModel } = useLanes();
|
|
13
9
|
|
|
14
10
|
const isInCurrentLane = useMemo(() => {
|
|
15
|
-
return
|
|
16
|
-
}, [lanesModel?.viewedLane,
|
|
17
|
-
|
|
18
|
-
if (!workspaceComponent) return null;
|
|
11
|
+
return component.id && lanesModel?.isComponentOnLaneButNotOnMain(component.id);
|
|
12
|
+
}, [lanesModel?.viewedLane, component.id]);
|
|
19
13
|
|
|
20
14
|
return (
|
|
21
15
|
<ComponentStatusResolver
|
|
22
|
-
status={
|
|
23
|
-
issuesCount={
|
|
16
|
+
status={component.status}
|
|
17
|
+
issuesCount={component.issuesCount}
|
|
24
18
|
isInCurrentLane={isInCurrentLane}
|
|
25
19
|
/>
|
|
26
20
|
);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ComponentTreeNode, ComponentTreeNodeProps } from '@teambit/component-tree';
|
|
3
3
|
export declare class ComponentTreeWidget implements ComponentTreeNode {
|
|
4
|
-
widget: ({ component }: ComponentTreeNodeProps) => JSX.Element
|
|
4
|
+
widget: ({ component }: ComponentTreeNodeProps) => JSX.Element;
|
|
5
5
|
}
|
|
@@ -47,16 +47,6 @@ function _react() {
|
|
|
47
47
|
return data;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
function _workspaceContext() {
|
|
51
|
-
const data = require("./ui/workspace/workspace-context");
|
|
52
|
-
|
|
53
|
-
_workspaceContext = function () {
|
|
54
|
-
return data;
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
return data;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
50
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
61
51
|
|
|
62
52
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -66,18 +56,15 @@ class ComponentTreeWidget {
|
|
|
66
56
|
(0, _defineProperty2().default)(this, "widget", ({
|
|
67
57
|
component
|
|
68
58
|
}) => {
|
|
69
|
-
const workspace = (0, _react().useContext)(_workspaceContext().WorkspaceContext);
|
|
70
|
-
const workspaceComponent = workspace.getComponent(component.id);
|
|
71
59
|
const {
|
|
72
60
|
lanesModel
|
|
73
61
|
} = (0, _lanesHooks().useLanes)();
|
|
74
62
|
const isInCurrentLane = (0, _react().useMemo)(() => {
|
|
75
|
-
return
|
|
76
|
-
}, [lanesModel === null || lanesModel === void 0 ? void 0 : lanesModel.viewedLane,
|
|
77
|
-
if (!workspaceComponent) return null;
|
|
63
|
+
return component.id && (lanesModel === null || lanesModel === void 0 ? void 0 : lanesModel.isComponentOnLaneButNotOnMain(component.id));
|
|
64
|
+
}, [lanesModel === null || lanesModel === void 0 ? void 0 : lanesModel.viewedLane, component.id]);
|
|
78
65
|
return /*#__PURE__*/_react().default.createElement(_componentUi().ComponentStatusResolver, {
|
|
79
|
-
status:
|
|
80
|
-
issuesCount:
|
|
66
|
+
status: component.status,
|
|
67
|
+
issuesCount: component.issuesCount,
|
|
81
68
|
isInCurrentLane: isInCurrentLane
|
|
82
69
|
});
|
|
83
70
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ComponentTreeWidget","component","
|
|
1
|
+
{"version":3,"names":["ComponentTreeWidget","component","lanesModel","useLanes","isInCurrentLane","useMemo","id","isComponentOnLaneButNotOnMain","viewedLane","status","issuesCount"],"sources":["component-tree.widget.tsx"],"sourcesContent":["import { ComponentTreeNode, ComponentTreeNodeProps } from '@teambit/component-tree';\nimport { ComponentStatusResolver } from '@teambit/component.ui.component-status-resolver';\nimport { useLanes } from '@teambit/lanes.hooks.use-lanes';\nimport React, { useMemo } from 'react';\n\nexport class ComponentTreeWidget implements ComponentTreeNode {\n widget = ({ component }: ComponentTreeNodeProps) => {\n const { lanesModel } = useLanes();\n\n const isInCurrentLane = useMemo(() => {\n return component.id && lanesModel?.isComponentOnLaneButNotOnMain(component.id);\n }, [lanesModel?.viewedLane, component.id]);\n\n return (\n <ComponentStatusResolver\n status={component.status}\n issuesCount={component.issuesCount}\n isInCurrentLane={isInCurrentLane}\n />\n );\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;;;;;AAEO,MAAMA,mBAAN,CAAuD;EAAA;IAAA,gDACnD,CAAC;MAAEC;IAAF,CAAD,KAA2C;MAClD,MAAM;QAAEC;MAAF,IAAiB,IAAAC,sBAAA,GAAvB;MAEA,MAAMC,eAAe,GAAG,IAAAC,gBAAA,EAAQ,MAAM;QACpC,OAAOJ,SAAS,CAACK,EAAV,KAAgBJ,UAAhB,aAAgBA,UAAhB,uBAAgBA,UAAU,CAAEK,6BAAZ,CAA0CN,SAAS,CAACK,EAApD,CAAhB,CAAP;MACD,CAFuB,EAErB,CAACJ,UAAD,aAACA,UAAD,uBAACA,UAAU,CAAEM,UAAb,EAAyBP,SAAS,CAACK,EAAnC,CAFqB,CAAxB;MAIA,oBACE,+BAAC,sCAAD;QACE,MAAM,EAAEL,SAAS,CAACQ,MADpB;QAEE,WAAW,EAAER,SAAS,CAACS,WAFzB;QAGE,eAAe,EAAEN;MAHnB,EADF;IAOD,CAf2D;EAAA;;AAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export * from './events';
|
|
|
9
9
|
export type { WorkspaceUI } from './workspace.ui.runtime';
|
|
10
10
|
export type { SerializableResults, OnComponentLoad, OnComponentEventResult } from './on-component-events';
|
|
11
11
|
export { ComponentStatus } from './workspace-component';
|
|
12
|
-
export { WorkspaceModelComponent } from './ui/workspace/workspace-model';
|
|
12
|
+
export { WorkspaceModelComponent, Workspace as WorkspaceModel } from './ui/workspace/workspace-model';
|
|
13
13
|
export { WorkspaceContext } from './ui/workspace/workspace-context';
|
|
14
14
|
export type { WorkspaceComponent } from './workspace-component';
|
|
15
15
|
export type { ComponentConfigFile } from './component-config-file';
|
package/dist/index.js
CHANGED
|
@@ -8,6 +8,7 @@ var _exportNames = {
|
|
|
8
8
|
CheckTypes: true,
|
|
9
9
|
ComponentStatus: true,
|
|
10
10
|
WorkspaceModelComponent: true,
|
|
11
|
+
WorkspaceModel: true,
|
|
11
12
|
WorkspaceContext: true
|
|
12
13
|
};
|
|
13
14
|
Object.defineProperty(exports, "CheckTypes", {
|
|
@@ -34,6 +35,12 @@ Object.defineProperty(exports, "WorkspaceContext", {
|
|
|
34
35
|
return _workspaceContext().WorkspaceContext;
|
|
35
36
|
}
|
|
36
37
|
});
|
|
38
|
+
Object.defineProperty(exports, "WorkspaceModel", {
|
|
39
|
+
enumerable: true,
|
|
40
|
+
get: function () {
|
|
41
|
+
return _workspaceModel().Workspace;
|
|
42
|
+
}
|
|
43
|
+
});
|
|
37
44
|
Object.defineProperty(exports, "WorkspaceModelComponent", {
|
|
38
45
|
enumerable: true,
|
|
39
46
|
get: function () {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["WorkspaceAspect"],"sources":["index.ts"],"sourcesContent":["import { WorkspaceAspect } from './workspace.aspect';\n// eslint-disable-next-line import/prefer-default-export\nexport type { default as Workspace, ExtensionsOrigin } from './workspace';\n// TODO: change to module path once track the utils folder\nexport type { ResolvedComponent } from '@teambit/harmony.modules.resolved-component';\nexport type { AlreadyExistsError as ComponentConfigFileAlreadyExistsError } from './component-config-file';\nexport type { WorkspaceMain } from './workspace.main.runtime';\nexport type { WatchOptions } from './watch/watcher';\nexport { CheckTypes } from './watch/check-types';\nexport * from './events';\nexport type { WorkspaceUI } from './workspace.ui.runtime';\nexport type { SerializableResults, OnComponentLoad, OnComponentEventResult } from './on-component-events';\nexport { ComponentStatus } from './workspace-component';\nexport { WorkspaceModelComponent } from './ui/workspace/workspace-model';\nexport { WorkspaceContext } from './ui/workspace/workspace-context';\nexport type { WorkspaceComponent } from './workspace-component';\nexport type { ComponentConfigFile } from './component-config-file';\n\nexport { WorkspaceAspect };\nexport default WorkspaceAspect;\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["WorkspaceAspect"],"sources":["index.ts"],"sourcesContent":["import { WorkspaceAspect } from './workspace.aspect';\n// eslint-disable-next-line import/prefer-default-export\nexport type { default as Workspace, ExtensionsOrigin } from './workspace';\n// TODO: change to module path once track the utils folder\nexport type { ResolvedComponent } from '@teambit/harmony.modules.resolved-component';\nexport type { AlreadyExistsError as ComponentConfigFileAlreadyExistsError } from './component-config-file';\nexport type { WorkspaceMain } from './workspace.main.runtime';\nexport type { WatchOptions } from './watch/watcher';\nexport { CheckTypes } from './watch/check-types';\nexport * from './events';\nexport type { WorkspaceUI } from './workspace.ui.runtime';\nexport type { SerializableResults, OnComponentLoad, OnComponentEventResult } from './on-component-events';\nexport { ComponentStatus } from './workspace-component';\nexport { WorkspaceModelComponent, Workspace as WorkspaceModel } from './ui/workspace/workspace-model';\nexport { WorkspaceContext } from './ui/workspace/workspace-context';\nexport type { WorkspaceComponent } from './workspace-component';\nexport type { ComponentConfigFile } from './component-config-file';\n\nexport { WorkspaceAspect };\nexport default WorkspaceAspect;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAQA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AAGA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;eAKeA,4B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["WorkspaceComponentLoader","constructor","workspace","logger","dependencyResolver","envs","componentsCache","createInMemoryCache","maxSize","getMaxSizeForComponents","getMany","ids","idsWithoutEmpty","compact","errors","longProcessLogger","createLongProcessLogger","length","componentsP","mapSeries","id","logProgress","toString","get","catch","err","isComponentNotExistsError","push","undefined","components","forEach","console","warn","filteredComponents","end","getInvalid","consumer","loadComponent","_legacy","ConsumerComponent","isComponentInvalidByErrorType","componentId","legacyComponent","useCache","storeInCache","loadOpts","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","extensionsFromConsumerComponent","ExtensionDataList","extensionDataList","mergeConfigs","filterRemovedExtensions","State","Config","mainFile","createAspectList","ComponentFS","fromVinyls","files","dependencies","workspaceComponent","WorkspaceComponent","head","tags","executeLoadSlot","newComponentFromState","createComponentCacheKey","set","isEqual","debug","name","message","ComponentNotFound","ComponentNotFoundInPath","_consumer","removed","envsData","getEnvSystemDescriptor","policy","mergeVariantPolicies","config","extractDepsFromLegacy","depResolverData","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';\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>): 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).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 } = await this.workspace.componentExtensions(id, componentFromScope);\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 return this.executeLoadSlot(workspaceComponent, loadOpts);\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.workspace.getEnvSystemDescriptor(component);\n\n // Move to deps resolver main runtime once we switch ws<> deps resolver direction\n const policy = await this.dependencyResolver.mergeVariantPolicies(component.config.extensions);\n const dependencies = await this.dependencyResolver.extractDepsFromLegacy(component, policy);\n\n const depResolverData = {\n dependencies,\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 const existingExtension = component.state.config.extensions.findExtension(extension);\n if (existingExtension && data) {\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;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;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;;AAGA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEO,MAAMA,wBAAN,CAA+B;EACe;EACnDC,WAAW,CACDC,SADC,EAEDC,MAFC,EAGDC,kBAHC,EAIDC,IAJC,EAKT;IAAA,KAJQH,SAIR,GAJQA,SAIR;IAAA,KAHQC,MAGR,GAHQA,MAGR;IAAA,KAFQC,kBAER,GAFQA,kBAER;IAAA,KADQC,IACR,GADQA,IACR;IAAA;IACA,KAAKC,eAAL,GAAuB,IAAAC,mCAAA,EAAoB;MAAEC,OAAO,EAA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AAMiE,iBAAiB,GAAGhF,SAAS,CAACU,KAAV,CAAgBmD,MAAhB,CAAuBnC,UAAvB,CAAkCuD,aAAlC,CAAgDL,SAAhD,CAA1B;;IACA,IAAII,iBAAiB,IAAIjE,IAAzB,EAA+B;MAC7B;MACAmE,MAAM,CAACC,MAAP,CAAcH,iBAAiB,CAACjE,IAAhC,EAAsCA,IAAtC;MACA;IACD;;IACDf,SAAS,CAACU,KAAV,CAAgBmD,MAAhB,CAAuBnC,UAAvB,CAAkC1D,IAAlC,CAAuC,MAAM,KAAKoH,YAAL,CAAkBR,SAAlB,EAA6B7D,IAA7B,CAA7C;EACD;;EAEyB,MAAZqE,YAAY,CAACR,SAAD,EAAoB7D,IAApB,EAA+E;IACvG;IACA,OAAO,KAAIsE,4BAAJ,EAAuBpH,SAAvB,EAAkCA,SAAlC,EAA6C2G,SAA7C,EAAwD3G,SAAxD,EAAmE8C,IAAnE,CAAP;EACD;;AA7QmC;;;;AAgRtC,SAASgC,uBAAT,CAAiCtF,EAAjC,EAAkDyB,QAAlD,EAA2F;EACzF,OAAQ,GAAEzB,EAAE,CAACE,QAAH,EAAc,IAAG2H,IAAI,CAACC,SAAL,CAAeC,QAAQ,CAACtG,QAAD,aAACA,QAAD,cAACA,QAAD,GAAa,EAAb,CAAvB,CAAyC,EAApE;AACD;;AAED,SAASsG,QAAT,CAAkBC,GAAlB,EAA+B;EAC7B,OAAO,IAAAC,mBAAA,EAAUR,MAAM,CAACV,OAAP,CAAeiB,GAAf,EAAoBE,IAApB,CAAyB,CAAC,CAACC,EAAD,CAAD,EAAO,CAACC,EAAD,CAAP,KAAgBD,EAAE,CAACE,aAAH,CAAiBD,EAAjB,CAAzC,CAAV,CAAP;AACD"}
|
|
1
|
+
{"version":3,"names":["WorkspaceComponentLoader","constructor","workspace","logger","dependencyResolver","envs","componentsCache","createInMemoryCache","maxSize","getMaxSizeForComponents","getMany","ids","idsWithoutEmpty","compact","errors","longProcessLogger","createLongProcessLogger","length","componentsP","mapSeries","id","logProgress","toString","get","catch","err","isComponentNotExistsError","push","undefined","components","forEach","console","warn","filteredComponents","end","getInvalid","consumer","loadComponent","_legacy","ConsumerComponent","isComponentInvalidByErrorType","componentId","legacyComponent","useCache","storeInCache","loadOpts","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","extensionsFromConsumerComponent","ExtensionDataList","extensionDataList","mergeConfigs","filterRemovedExtensions","State","Config","mainFile","createAspectList","ComponentFS","fromVinyls","files","dependencies","workspaceComponent","WorkspaceComponent","head","tags","executeLoadSlot","newComponentFromState","createComponentCacheKey","set","isEqual","debug","name","message","ComponentNotFound","ComponentNotFoundInPath","_consumer","removed","envsData","getEnvSystemDescriptor","policy","mergeVariantPolicies","config","extractDepsFromLegacy","depResolverData","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';\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>): 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).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 } = await this.workspace.componentExtensions(id, componentFromScope);\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 return this.executeLoadSlot(workspaceComponent, loadOpts);\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.workspace.getEnvSystemDescriptor(component);\n\n // Move to deps resolver main runtime once we switch ws<> deps resolver direction\n const policy = await this.dependencyResolver.mergeVariantPolicies(component.config.extensions);\n const dependencies = await this.dependencyResolver.extractDepsFromLegacy(component, policy);\n\n const depResolverData = {\n dependencies,\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 const existingExtension = component.state.config.extensions.findExtension(extension);\n if (existingExtension && data) {\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;EA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H,SAAvB,EAAkCA,SAAlC,EAA6C2G,SAA7C,EAAwD3G,SAAxD,EAAmE8C,IAAnE,CAAP;EACD;;AA7QmC;;;;AAgRtC,SAASgC,uBAAT,CAAiCtF,EAAjC,EAAkDyB,QAAlD,EAA2F;EACzF,OAAQ,GAAEzB,EAAE,CAACE,QAAH,EAAc,IAAG2H,IAAI,CAACC,SAAL,CAAeC,QAAQ,CAACtG,QAAD,aAACA,QAAD,cAACA,QAAD,GAAa,EAAb,CAAvB,CAAyC,EAApE;AACD;;AAED,SAASsG,QAAT,CAAkBC,GAAlB,EAA+B;EAC7B,OAAO,IAAAC,mBAAA,EAAUR,MAAM,CAACV,OAAP,CAAeiB,GAAf,EAAoBE,IAApB,CAAyB,CAAC,CAACC,EAAD,CAAD,EAAO,CAACC,EAAD,CAAP,KAAgBD,EAAE,CAACE,aAAH,CAAiBD,EAAjB,CAAzC,CAAV,CAAP;AACD"}
|
package/dist/workspace.js
CHANGED
|
@@ -830,7 +830,9 @@ class Workspace {
|
|
|
830
830
|
const icon = this.aspectLoader.getDescriptor(env.id).icon || env.env.icon;
|
|
831
831
|
return {
|
|
832
832
|
type: systemDescriptor.type,
|
|
833
|
-
|
|
833
|
+
// Make sure to store the env id in the data without the version
|
|
834
|
+
// The version should always come from the aspect id configured on the component
|
|
835
|
+
id: env.id.split('@')[0],
|
|
834
836
|
name: env.name,
|
|
835
837
|
icon,
|
|
836
838
|
description: env.description,
|