@teambit/workspace 0.0.1144 → 0.0.1146
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bit-map.js +1 -1
- package/dist/bit-map.js.map +1 -1
- package/dist/build-graph-from-fs.js +3 -1
- package/dist/build-graph-from-fs.js.map +1 -1
- package/dist/build-graph-ids-from-fs.js +1 -1
- package/dist/build-graph-ids-from-fs.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js.map +1 -1
- package/dist/{preview-1693279117198.js → preview-1693538278577.js} +2 -2
- package/dist/types.d.ts +1 -1
- package/dist/types.js.map +1 -1
- package/dist/ui/workspace/workspace.js +8 -1
- package/dist/ui/workspace/workspace.js.map +1 -1
- package/dist/ui/workspace/workspace.module.scss +4 -0
- package/dist/workspace-aspects-loader.js +1 -1
- package/dist/workspace-aspects-loader.js.map +1 -1
- package/dist/workspace.d.ts +1 -1
- package/dist/workspace.js +8 -5
- package/dist/workspace.js.map +1 -1
- package/package.json +38 -36
- package/ui/workspace/workspace.module.scss +4 -0
- package/ui/workspace/workspace.tsx +2 -1
package/dist/bit-map.js
CHANGED
|
@@ -251,7 +251,7 @@ class BitMap {
|
|
|
251
251
|
makeComponentsAvailableOnMain(ids) {
|
|
252
252
|
ids.forEach(id => {
|
|
253
253
|
const componentMap = this.getBitmapEntry(id);
|
|
254
|
-
|
|
254
|
+
componentMap.isAvailableOnCurrentLane = true;
|
|
255
255
|
delete componentMap.onLanesOnly;
|
|
256
256
|
});
|
|
257
257
|
this.legacyBitMap.markAsChanged();
|
package/dist/bit-map.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_lodash","data","require","_bitMap","_interopRequireDefault","_config","_bitError","_envs","BitMap","constructor","legacyBitMap","consumer","mergeBitmaps","bitmapContent","otherBitmapContent","opts","LegacyBitMap","mergeContent","addComponentConfig","id","aspectId","config","shouldMergeConfig","Error","bitMapEntry","getBitmapEntry","ignoreScopeAndVersion","currentConfig","isEqual","getNewConfig","merge","newConfig","markAsChanged","removeComponentConfig","markWithMinusIfNotExist","REMOVE_EXTENSION_SPECIAL_SIGN","removeEntireConfig","setEntireConfig","removeDefaultScope","defaultScope","setDefaultScope","write","writeBitMap","ignoreVersion","getComponent","_legacy","getBitmapEntryIfExist","getComponentIfExist","getAspectIdFromConfig","componentId","ignoreAspectVersion","undefined","toString","allVersions","Object","keys","filter","startsWith","toStringWithoutVersion","length","BitError","join","renameNewComponent","sourceId","targetId","hasVersion","fullName","removeComponent","setComponent","scope","renameAspectInConfig","components","forEach","componentMap","EnvsAspect","envConfig","env","getExportedLaneId","isLaneExported","laneId","makeComponentsAvailableOnMain","ids","isAvailableOnCurrentLane","onLanesOnly","hasChanged","takeSnapshot","map","comp","clone","restoreFromSnapshot","componentMaps","_invalidateCache","exports"],"sources":["bit-map.ts"],"sourcesContent":["import { isEqual, merge } from 'lodash';\nimport { ComponentID } from '@teambit/component-id';\nimport LegacyBitMap from '@teambit/legacy/dist/consumer/bit-map';\nimport { Consumer } from '@teambit/legacy/dist/consumer';\nimport { GetBitMapComponentOptions } from '@teambit/legacy/dist/consumer/bit-map/bit-map';\nimport ComponentMap from '@teambit/legacy/dist/consumer/bit-map/component-map';\nimport { REMOVE_EXTENSION_SPECIAL_SIGN } from '@teambit/legacy/dist/consumer/config';\nimport { BitError } from '@teambit/bit-error';\nimport { LaneId } from '@teambit/lane-id';\nimport EnvsAspect from '@teambit/envs';\n\nexport type MergeOptions = {\n mergeStrategy?: 'theirs' | 'ours' | 'manual';\n};\n/**\n * consider extracting to a new component.\n * (pro: making Workspace aspect smaller. con: it's an implementation details of the workspace)\n */\nexport class BitMap {\n constructor(private legacyBitMap: LegacyBitMap, private consumer: Consumer) {}\n\n mergeBitmaps(bitmapContent: string, otherBitmapContent: string, opts: MergeOptions = {}): string {\n return LegacyBitMap.mergeContent(bitmapContent, otherBitmapContent, opts);\n }\n\n /**\n * adds component config to the .bitmap file.\n * later, upon `bit tag`, the data is saved in the scope.\n * returns a boolean indicating whether a change has been made.\n */\n addComponentConfig(\n id: ComponentID,\n aspectId: string,\n config: Record<string, any> = {},\n shouldMergeConfig = false\n ): boolean {\n if (!aspectId || typeof aspectId !== 'string') throw new Error(`expect aspectId to be string, got ${aspectId}`);\n const bitMapEntry = this.getBitmapEntry(id, { ignoreScopeAndVersion: true });\n const currentConfig = (bitMapEntry.config ||= {})[aspectId];\n if (isEqual(currentConfig, config)) {\n return false; // no changes\n }\n const getNewConfig = () => {\n if (!config) return null;\n if (!shouldMergeConfig) return config;\n // should merge\n if (!currentConfig) return config;\n if (currentConfig === '-') return config;\n // lodash merge performs a deep merge. (the native concatenation don't)\n return merge(currentConfig, config);\n };\n const newConfig = getNewConfig();\n if (newConfig) {\n bitMapEntry.config[aspectId] = newConfig;\n } else {\n delete bitMapEntry.config[aspectId];\n }\n this.legacyBitMap.markAsChanged();\n\n return true; // changes have been made\n }\n\n markAsChanged() {\n this.legacyBitMap.markAsChanged();\n }\n\n removeComponentConfig(id: ComponentID, aspectId: string, markWithMinusIfNotExist: boolean): boolean {\n if (!aspectId || typeof aspectId !== 'string') throw new Error(`expect aspectId to be string, got ${aspectId}`);\n const bitMapEntry = this.getBitmapEntry(id, { ignoreScopeAndVersion: true });\n const currentConfig = (bitMapEntry.config ||= {})[aspectId];\n if (currentConfig) {\n delete bitMapEntry.config[aspectId];\n } else {\n if (!markWithMinusIfNotExist) {\n return false; // no changes\n }\n bitMapEntry.config[aspectId] = REMOVE_EXTENSION_SPECIAL_SIGN;\n }\n\n this.legacyBitMap.markAsChanged();\n\n return true; // changes have been made\n }\n\n removeEntireConfig(id: ComponentID): boolean {\n const bitMapEntry = this.getBitmapEntry(id, { ignoreScopeAndVersion: true });\n if (!bitMapEntry.config) return false;\n delete bitMapEntry.config;\n this.legacyBitMap.markAsChanged();\n return true;\n }\n\n setEntireConfig(id: ComponentID, config: Record<string, any>) {\n const bitMapEntry = this.getBitmapEntry(id, { ignoreScopeAndVersion: true });\n bitMapEntry.config = config;\n this.legacyBitMap.markAsChanged();\n }\n\n removeDefaultScope(id: ComponentID) {\n const bitMapEntry = this.getBitmapEntry(id, { ignoreScopeAndVersion: true });\n if (bitMapEntry.defaultScope) {\n delete bitMapEntry.defaultScope;\n this.legacyBitMap.markAsChanged();\n }\n }\n\n setDefaultScope(id: ComponentID, defaultScope: string) {\n const bitMapEntry = this.getBitmapEntry(id, { ignoreScopeAndVersion: true });\n bitMapEntry.defaultScope = defaultScope;\n this.legacyBitMap.markAsChanged();\n }\n\n /**\n * write .bitmap object to the filesystem\n */\n async write() {\n await this.consumer.writeBitMap();\n }\n\n /**\n * get the data saved in the .bitmap file for this component-id.\n * throws if not found\n * @see getBitmapEntryIfExist\n */\n getBitmapEntry(\n id: ComponentID,\n { ignoreVersion, ignoreScopeAndVersion }: GetBitMapComponentOptions = {}\n ): ComponentMap {\n return this.legacyBitMap.getComponent(id._legacy, { ignoreVersion, ignoreScopeAndVersion });\n }\n\n getBitmapEntryIfExist(\n id: ComponentID,\n { ignoreVersion, ignoreScopeAndVersion }: GetBitMapComponentOptions = {}\n ): ComponentMap | undefined {\n return this.legacyBitMap.getComponentIfExist(id._legacy, { ignoreVersion, ignoreScopeAndVersion });\n }\n\n getAspectIdFromConfig(\n componentId: ComponentID,\n aspectId: ComponentID,\n ignoreAspectVersion = false\n ): string | undefined {\n const bitMapEntry = this.getBitmapEntry(componentId);\n const config = bitMapEntry.config;\n if (!config) {\n return undefined;\n }\n if (config[aspectId.toString()]) {\n return aspectId.toString();\n }\n if (!ignoreAspectVersion) {\n return undefined;\n }\n const allVersions = Object.keys(config).filter((id) => id.startsWith(`${aspectId.toStringWithoutVersion()}@`));\n if (allVersions.length > 1) {\n throw new BitError(\n `error: the same aspect ${\n aspectId.toStringWithoutVersion\n } configured multiple times for \"${componentId.toString()}\"\\n${allVersions.join('\\n')}`\n );\n }\n return allVersions.length === 1 ? allVersions[0] : undefined;\n }\n\n /**\n * components that were not tagged yet are safe to rename them from the .bitmap file.\n */\n renameNewComponent(sourceId: ComponentID, targetId: ComponentID) {\n const bitMapEntry = this.getBitmapEntry(sourceId);\n if (bitMapEntry.id.hasVersion()) {\n throw new Error(`unable to rename tagged or exported component: ${bitMapEntry.id.toString()}`);\n }\n if (sourceId.isEqual(targetId)) {\n throw new Error(`source-id and target-id are equal: \"${sourceId.toString()}\"`);\n }\n if (sourceId.fullName !== targetId.fullName) {\n this.legacyBitMap.removeComponent(bitMapEntry.id);\n bitMapEntry.id = targetId._legacy;\n this.legacyBitMap.setComponent(bitMapEntry.id, bitMapEntry);\n }\n if (sourceId.scope !== targetId.scope) {\n this.setDefaultScope(targetId, targetId.scope);\n }\n }\n\n /**\n * helpful when reaming an aspect and this aspect is used in the config of other components.\n */\n renameAspectInConfig(sourceId: ComponentID, targetId: ComponentID) {\n this.legacyBitMap.components.forEach((componentMap) => {\n const config = componentMap.config;\n if (!config) return;\n Object.keys(config).forEach((aspectId) => {\n if (aspectId === sourceId.toString()) {\n config[targetId.toString()] = config[aspectId];\n delete config[aspectId];\n this.markAsChanged();\n }\n if (aspectId === EnvsAspect.id) {\n const envConfig = config[aspectId];\n if (envConfig !== REMOVE_EXTENSION_SPECIAL_SIGN && envConfig.env === sourceId.toString()) {\n envConfig.env = targetId.toString();\n this.markAsChanged();\n }\n }\n });\n componentMap.config = config;\n });\n }\n\n removeComponent(id: ComponentID) {\n this.legacyBitMap.removeComponent(id._legacy);\n }\n\n /**\n * this is the lane-id of the recently exported lane. in case of a new lane, which was not exported yet, this will be\n * empty.\n */\n getExportedLaneId(): LaneId | undefined {\n return this.legacyBitMap.isLaneExported ? this.legacyBitMap.laneId : undefined;\n }\n\n makeComponentsAvailableOnMain(ids: ComponentID[]) {\n ids.forEach((id) => {\n const componentMap = this.getBitmapEntry(id);\n delete componentMap.isAvailableOnCurrentLane;\n delete componentMap.onLanesOnly;\n });\n this.legacyBitMap.markAsChanged();\n }\n\n /**\n * whether .bitmap file has changed in-memory\n */\n hasChanged(): boolean {\n return this.legacyBitMap.hasChanged;\n }\n\n takeSnapshot(): ComponentMap[] {\n return this.legacyBitMap.components.map((comp) => comp.clone());\n }\n\n restoreFromSnapshot(componentMaps: ComponentMap[]) {\n this.legacyBitMap.components = componentMaps;\n this.legacyBitMap._invalidateCache();\n }\n}\n"],"mappings":";;;;;;;;AAAA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAE,QAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAIA,SAAAI,QAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,OAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,UAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,SAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAM,MAAA;EAAA,MAAAN,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAK,KAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAKA;AACA;AACA;AACA;AACO,MAAMO,MAAM,CAAC;EAClBC,WAAWA,CAASC,YAA0B,EAAUC,QAAkB,EAAE;IAAA,KAAxDD,YAA0B,GAA1BA,YAA0B;IAAA,KAAUC,QAAkB,GAAlBA,QAAkB;EAAG;EAE7EC,YAAYA,CAACC,aAAqB,EAAEC,kBAA0B,EAAEC,IAAkB,GAAG,CAAC,CAAC,EAAU;IAC/F,OAAOC,iBAAY,CAACC,YAAY,CAACJ,aAAa,EAAEC,kBAAkB,EAAEC,IAAI,CAAC;EAC3E;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,"names":["_lodash","data","require","_bitMap","_interopRequireDefault","_config","_bitError","_envs","BitMap","constructor","legacyBitMap","consumer","mergeBitmaps","bitmapContent","otherBitmapContent","opts","LegacyBitMap","mergeContent","addComponentConfig","id","aspectId","config","shouldMergeConfig","Error","bitMapEntry","getBitmapEntry","ignoreScopeAndVersion","currentConfig","isEqual","getNewConfig","merge","newConfig","markAsChanged","removeComponentConfig","markWithMinusIfNotExist","REMOVE_EXTENSION_SPECIAL_SIGN","removeEntireConfig","setEntireConfig","removeDefaultScope","defaultScope","setDefaultScope","write","writeBitMap","ignoreVersion","getComponent","_legacy","getBitmapEntryIfExist","getComponentIfExist","getAspectIdFromConfig","componentId","ignoreAspectVersion","undefined","toString","allVersions","Object","keys","filter","startsWith","toStringWithoutVersion","length","BitError","join","renameNewComponent","sourceId","targetId","hasVersion","fullName","removeComponent","setComponent","scope","renameAspectInConfig","components","forEach","componentMap","EnvsAspect","envConfig","env","getExportedLaneId","isLaneExported","laneId","makeComponentsAvailableOnMain","ids","isAvailableOnCurrentLane","onLanesOnly","hasChanged","takeSnapshot","map","comp","clone","restoreFromSnapshot","componentMaps","_invalidateCache","exports"],"sources":["bit-map.ts"],"sourcesContent":["import { isEqual, merge } from 'lodash';\nimport { ComponentID } from '@teambit/component-id';\nimport LegacyBitMap from '@teambit/legacy/dist/consumer/bit-map';\nimport { Consumer } from '@teambit/legacy/dist/consumer';\nimport { GetBitMapComponentOptions } from '@teambit/legacy/dist/consumer/bit-map/bit-map';\nimport ComponentMap from '@teambit/legacy/dist/consumer/bit-map/component-map';\nimport { REMOVE_EXTENSION_SPECIAL_SIGN } from '@teambit/legacy/dist/consumer/config';\nimport { BitError } from '@teambit/bit-error';\nimport { LaneId } from '@teambit/lane-id';\nimport EnvsAspect from '@teambit/envs';\n\nexport type MergeOptions = {\n mergeStrategy?: 'theirs' | 'ours' | 'manual';\n};\n/**\n * consider extracting to a new component.\n * (pro: making Workspace aspect smaller. con: it's an implementation details of the workspace)\n */\nexport class BitMap {\n constructor(private legacyBitMap: LegacyBitMap, private consumer: Consumer) {}\n\n mergeBitmaps(bitmapContent: string, otherBitmapContent: string, opts: MergeOptions = {}): string {\n return LegacyBitMap.mergeContent(bitmapContent, otherBitmapContent, opts);\n }\n\n /**\n * adds component config to the .bitmap file.\n * later, upon `bit tag`, the data is saved in the scope.\n * returns a boolean indicating whether a change has been made.\n */\n addComponentConfig(\n id: ComponentID,\n aspectId: string,\n config: Record<string, any> = {},\n shouldMergeConfig = false\n ): boolean {\n if (!aspectId || typeof aspectId !== 'string') throw new Error(`expect aspectId to be string, got ${aspectId}`);\n const bitMapEntry = this.getBitmapEntry(id, { ignoreScopeAndVersion: true });\n const currentConfig = (bitMapEntry.config ||= {})[aspectId];\n if (isEqual(currentConfig, config)) {\n return false; // no changes\n }\n const getNewConfig = () => {\n if (!config) return null;\n if (!shouldMergeConfig) return config;\n // should merge\n if (!currentConfig) return config;\n if (currentConfig === '-') return config;\n // lodash merge performs a deep merge. (the native concatenation don't)\n return merge(currentConfig, config);\n };\n const newConfig = getNewConfig();\n if (newConfig) {\n bitMapEntry.config[aspectId] = newConfig;\n } else {\n delete bitMapEntry.config[aspectId];\n }\n this.legacyBitMap.markAsChanged();\n\n return true; // changes have been made\n }\n\n markAsChanged() {\n this.legacyBitMap.markAsChanged();\n }\n\n removeComponentConfig(id: ComponentID, aspectId: string, markWithMinusIfNotExist: boolean): boolean {\n if (!aspectId || typeof aspectId !== 'string') throw new Error(`expect aspectId to be string, got ${aspectId}`);\n const bitMapEntry = this.getBitmapEntry(id, { ignoreScopeAndVersion: true });\n const currentConfig = (bitMapEntry.config ||= {})[aspectId];\n if (currentConfig) {\n delete bitMapEntry.config[aspectId];\n } else {\n if (!markWithMinusIfNotExist) {\n return false; // no changes\n }\n bitMapEntry.config[aspectId] = REMOVE_EXTENSION_SPECIAL_SIGN;\n }\n\n this.legacyBitMap.markAsChanged();\n\n return true; // changes have been made\n }\n\n removeEntireConfig(id: ComponentID): boolean {\n const bitMapEntry = this.getBitmapEntry(id, { ignoreScopeAndVersion: true });\n if (!bitMapEntry.config) return false;\n delete bitMapEntry.config;\n this.legacyBitMap.markAsChanged();\n return true;\n }\n\n setEntireConfig(id: ComponentID, config: Record<string, any>) {\n const bitMapEntry = this.getBitmapEntry(id, { ignoreScopeAndVersion: true });\n bitMapEntry.config = config;\n this.legacyBitMap.markAsChanged();\n }\n\n removeDefaultScope(id: ComponentID) {\n const bitMapEntry = this.getBitmapEntry(id, { ignoreScopeAndVersion: true });\n if (bitMapEntry.defaultScope) {\n delete bitMapEntry.defaultScope;\n this.legacyBitMap.markAsChanged();\n }\n }\n\n setDefaultScope(id: ComponentID, defaultScope: string) {\n const bitMapEntry = this.getBitmapEntry(id, { ignoreScopeAndVersion: true });\n bitMapEntry.defaultScope = defaultScope;\n this.legacyBitMap.markAsChanged();\n }\n\n /**\n * write .bitmap object to the filesystem\n */\n async write() {\n await this.consumer.writeBitMap();\n }\n\n /**\n * get the data saved in the .bitmap file for this component-id.\n * throws if not found\n * @see getBitmapEntryIfExist\n */\n getBitmapEntry(\n id: ComponentID,\n { ignoreVersion, ignoreScopeAndVersion }: GetBitMapComponentOptions = {}\n ): ComponentMap {\n return this.legacyBitMap.getComponent(id._legacy, { ignoreVersion, ignoreScopeAndVersion });\n }\n\n getBitmapEntryIfExist(\n id: ComponentID,\n { ignoreVersion, ignoreScopeAndVersion }: GetBitMapComponentOptions = {}\n ): ComponentMap | undefined {\n return this.legacyBitMap.getComponentIfExist(id._legacy, { ignoreVersion, ignoreScopeAndVersion });\n }\n\n getAspectIdFromConfig(\n componentId: ComponentID,\n aspectId: ComponentID,\n ignoreAspectVersion = false\n ): string | undefined {\n const bitMapEntry = this.getBitmapEntry(componentId);\n const config = bitMapEntry.config;\n if (!config) {\n return undefined;\n }\n if (config[aspectId.toString()]) {\n return aspectId.toString();\n }\n if (!ignoreAspectVersion) {\n return undefined;\n }\n const allVersions = Object.keys(config).filter((id) => id.startsWith(`${aspectId.toStringWithoutVersion()}@`));\n if (allVersions.length > 1) {\n throw new BitError(\n `error: the same aspect ${\n aspectId.toStringWithoutVersion\n } configured multiple times for \"${componentId.toString()}\"\\n${allVersions.join('\\n')}`\n );\n }\n return allVersions.length === 1 ? allVersions[0] : undefined;\n }\n\n /**\n * components that were not tagged yet are safe to rename them from the .bitmap file.\n */\n renameNewComponent(sourceId: ComponentID, targetId: ComponentID) {\n const bitMapEntry = this.getBitmapEntry(sourceId);\n if (bitMapEntry.id.hasVersion()) {\n throw new Error(`unable to rename tagged or exported component: ${bitMapEntry.id.toString()}`);\n }\n if (sourceId.isEqual(targetId)) {\n throw new Error(`source-id and target-id are equal: \"${sourceId.toString()}\"`);\n }\n if (sourceId.fullName !== targetId.fullName) {\n this.legacyBitMap.removeComponent(bitMapEntry.id);\n bitMapEntry.id = targetId._legacy;\n this.legacyBitMap.setComponent(bitMapEntry.id, bitMapEntry);\n }\n if (sourceId.scope !== targetId.scope) {\n this.setDefaultScope(targetId, targetId.scope);\n }\n }\n\n /**\n * helpful when reaming an aspect and this aspect is used in the config of other components.\n */\n renameAspectInConfig(sourceId: ComponentID, targetId: ComponentID) {\n this.legacyBitMap.components.forEach((componentMap) => {\n const config = componentMap.config;\n if (!config) return;\n Object.keys(config).forEach((aspectId) => {\n if (aspectId === sourceId.toString()) {\n config[targetId.toString()] = config[aspectId];\n delete config[aspectId];\n this.markAsChanged();\n }\n if (aspectId === EnvsAspect.id) {\n const envConfig = config[aspectId];\n if (envConfig !== REMOVE_EXTENSION_SPECIAL_SIGN && envConfig.env === sourceId.toString()) {\n envConfig.env = targetId.toString();\n this.markAsChanged();\n }\n }\n });\n componentMap.config = config;\n });\n }\n\n removeComponent(id: ComponentID) {\n this.legacyBitMap.removeComponent(id._legacy);\n }\n\n /**\n * this is the lane-id of the recently exported lane. in case of a new lane, which was not exported yet, this will be\n * empty.\n */\n getExportedLaneId(): LaneId | undefined {\n return this.legacyBitMap.isLaneExported ? this.legacyBitMap.laneId : undefined;\n }\n\n makeComponentsAvailableOnMain(ids: ComponentID[]) {\n ids.forEach((id) => {\n const componentMap = this.getBitmapEntry(id);\n componentMap.isAvailableOnCurrentLane = true;\n delete componentMap.onLanesOnly;\n });\n this.legacyBitMap.markAsChanged();\n }\n\n /**\n * whether .bitmap file has changed in-memory\n */\n hasChanged(): boolean {\n return this.legacyBitMap.hasChanged;\n }\n\n takeSnapshot(): ComponentMap[] {\n return this.legacyBitMap.components.map((comp) => comp.clone());\n }\n\n restoreFromSnapshot(componentMaps: ComponentMap[]) {\n this.legacyBitMap.components = componentMaps;\n this.legacyBitMap._invalidateCache();\n }\n}\n"],"mappings":";;;;;;;;AAAA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAE,QAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAIA,SAAAI,QAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,OAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,UAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,SAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAM,MAAA;EAAA,MAAAN,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAK,KAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAKA;AACA;AACA;AACA;AACO,MAAMO,MAAM,CAAC;EAClBC,WAAWA,CAASC,YAA0B,EAAUC,QAAkB,EAAE;IAAA,KAAxDD,YAA0B,GAA1BA,YAA0B;IAAA,KAAUC,QAAkB,GAAlB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C,aAA6B,EAAE;IACjD,IAAI,CAAChF,YAAY,CAAC6D,UAAU,GAAGmB,aAAa;IAC5C,IAAI,CAAChF,YAAY,CAACiF,gBAAgB,CAAC,CAAC;EACtC;AACF;AAACC,OAAA,CAAApF,MAAA,GAAAA,MAAA"}
|
|
@@ -168,10 +168,12 @@ class GraphFromFsBuilder {
|
|
|
168
168
|
const scopeComponentsImporter = this.consumer.scope.scopeImporter;
|
|
169
169
|
await scopeComponentsImporter.importMany({
|
|
170
170
|
ids: _bitIds().default.uniqFromArray(allDepsWithScope),
|
|
171
|
+
preferDependencyGraph: false,
|
|
171
172
|
throwForDependencyNotFound: this.shouldThrowOnMissingDep,
|
|
172
173
|
throwForSeederNotFound: this.shouldThrowOnMissingDep,
|
|
173
174
|
reFetchUnBuiltVersion: false,
|
|
174
|
-
lane: this.currentLane || undefined
|
|
175
|
+
lane: this.currentLane || undefined,
|
|
176
|
+
reason: 'for building a graph from the workspace'
|
|
175
177
|
});
|
|
176
178
|
allDepsNotImported.map(id => this.importedIds.push(id.toString()));
|
|
177
179
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_pMapSeries","data","_interopRequireDefault","require","_graph","_lodash","_bitIds","_exceptions","_scope","_lodash2","_bitError","GraphFromFsBuilder","constructor","workspace","logger","dependencyResolver","ignoreIds","shouldLoadItsDeps","shouldThrowOnMissingDep","_defineProperty2","default","Graph","consumer","buildGraph","ids","debug","length","start","Date","now","components","loadManyComponents","currentLane","getCurrentLaneObject","processManyComponents","graph","getAllDepsUnfiltered","component","deps","getComponentDependencies","depsIds","map","dep","componentId","filter","depId","includes","toString","getAllDepsFiltered","depsWithoutIgnore","shouldLoadFunc","mapSeries","shouldLoad","push","compact","depth","importObjects","allDependencies","processOneComponent","allDependenciesFlattened","flatten","workspaceIds","listIds","compOnWorkspaceOnly","comp","find","id","isEqual","allDeps","Promise","all","c","flat","allDepsNotImported","d","importedIds","allDepsWithScope","_legacy","hasScope","scopeComponentsImporter","scope","scopeImporter","importMany","BitIds","uniqFromArray","throwForDependencyNotFound","throwForSeederNotFound","reFetchUnBuiltVersion","lane","undefined","idStr","completed","allIds","allDependenciesComps","forEach","hasNode","Error","warn","setEdge","Edge","lifecycle","componentsIds","dependenciesOf","_this$graph$node","fromGraph","node","attr","get","setNode","Node","err","ComponentNotFound","ComponentNotFoundInScope","ScopeNotFound","BitError","error","exports"],"sources":["build-graph-from-fs.ts"],"sourcesContent":["import mapSeries from 'p-map-series';\nimport { Graph, Node, Edge } from '@teambit/graph.cleargraph';\nimport { flatten } from 'lodash';\nimport { Consumer } from '@teambit/legacy/dist/consumer';\nimport { Component, ComponentID } from '@teambit/component';\nimport { DependencyResolverMain } from '@teambit/dependency-resolver';\nimport BitIds from '@teambit/legacy/dist/bit-id/bit-ids';\nimport { Lane } from '@teambit/legacy/dist/scope/models';\nimport { ComponentNotFound, ScopeNotFound } from '@teambit/legacy/dist/scope/exceptions';\nimport { ComponentNotFound as ComponentNotFoundInScope } from '@teambit/scope';\nimport compact from 'lodash.compact';\nimport { Logger } from '@teambit/logger';\nimport { BitError } from '@teambit/bit-error';\nimport { Workspace } from './workspace';\n\nexport type ShouldLoadFunc = (id: ComponentID) => Promise<boolean>;\n\nexport class GraphFromFsBuilder {\n private graph = new Graph<Component, string>();\n private completed: string[] = [];\n private depth = 1;\n private consumer: Consumer;\n private importedIds: string[] = [];\n private currentLane: Lane | null;\n constructor(\n private workspace: Workspace,\n private logger: Logger,\n private dependencyResolver: DependencyResolverMain,\n private ignoreIds: string[] = [],\n private shouldLoadItsDeps?: ShouldLoadFunc,\n private shouldThrowOnMissingDep = true\n ) {\n this.consumer = this.workspace.consumer;\n }\n\n /**\n * create a graph with all dependencies and flattened dependencies of the given components.\n * the nodes are components and the edges has a label of the dependency type.\n *\n * the way how it is done is iterations by depths. each depth we gather all the dependencies of\n * that depths, make sure all objects exist and then check their dependencies for the next depth.\n * once there is no dependency left, we're on the last depth level and the graph is ready.\n *\n * for example, imagine the following graph:\n * A1 -> A2 -> A3\n * B1 -> B2 -> B3\n * C1 -> C2 -> C3\n *\n * where the buildGraph is given [A1, B1, C1].\n * first, it saves all these components as nodes in the graph. then, it finds the dependencies of\n * the next level, in this case they're [A2, B2, C2]. it runs `importMany` in case some objects\n * are missing. then, it loads them all (some from FS, some from the model) and sets the edges\n * between the component and the dependencies.\n * once done, it finds all their dependencies, which are [A3, B3, C3] and repeat the process\n * above. since there are no more dependencies, the graph is completed.\n * in this case, the total depth levels are 3.\n *\n * even with a huge project, there are not many depth levels. by iterating through depth levels\n * we keep performance sane as the importMany doesn't run multiple time and therefore the round\n * trips to the remotes are minimal.\n *\n * normally, one importMany of the seeders is enough as importMany knows to fetch all flattened.\n * however, since this buildGraph is performed on the workspace, a dependency may be new or\n * modified and as such, we don't know its flattened yet.\n */\n async buildGraph(ids: ComponentID[]): Promise<Graph<Component, string>> {\n this.logger.debug(`GraphFromFsBuilder, buildGraph with ${ids.length} seeders`);\n const start = Date.now();\n const components = await this.loadManyComponents(ids);\n this.currentLane = await this.workspace.consumer.getCurrentLaneObject();\n await this.processManyComponents(components);\n this.logger.debug(\n `GraphFromFsBuilder, buildGraph with ${ids.length} seeders completed (${(Date.now() - start) / 1000} sec)`\n );\n return this.graph;\n }\n\n private async getAllDepsUnfiltered(component: Component): Promise<ComponentID[]> {\n const deps = await this.dependencyResolver.getComponentDependencies(component);\n const depsIds = deps.map((dep) => dep.componentId);\n\n return depsIds.filter((depId) => !this.ignoreIds.includes(depId.toString()));\n }\n\n private async getAllDepsFiltered(component: Component): Promise<ComponentID[]> {\n const depsWithoutIgnore = await this.getAllDepsUnfiltered(component);\n const shouldLoadFunc = this.shouldLoadItsDeps;\n if (!shouldLoadFunc) return depsWithoutIgnore;\n const deps = await mapSeries(depsWithoutIgnore, async (depId) => {\n const shouldLoad = await shouldLoadFunc(depId);\n if (!shouldLoad) this.ignoreIds.push(depId.toString());\n return shouldLoad ? depId : null;\n });\n return compact(deps);\n }\n\n private async processManyComponents(components: Component[]) {\n this.logger.debug(`GraphFromFsBuilder.processManyComponents depth ${this.depth}, ${components.length} components`);\n this.depth += 1;\n await this.importObjects(components);\n const allDependencies = await mapSeries(components, (component) => this.processOneComponent(component));\n const allDependenciesFlattened = flatten(allDependencies);\n if (allDependenciesFlattened.length) await this.processManyComponents(allDependenciesFlattened);\n }\n\n /**\n * only for components from the workspace that can be modified to add/remove dependencies, we need to make sure that\n * all their dependencies are imported.\n * remember that `importMany` fetches all flattened dependencies. once a component from scope is imported, we know\n * that all its flattened dependencies are there. no need to call importMany again for them.\n */\n private async importObjects(components: Component[]) {\n const workspaceIds = await this.workspace.listIds();\n const compOnWorkspaceOnly = components.filter((comp) => workspaceIds.find((id) => id.isEqual(comp.id)));\n const allDeps = (await Promise.all(compOnWorkspaceOnly.map((c) => this.getAllDepsUnfiltered(c)))).flat();\n const allDepsNotImported = allDeps.filter((d) => !this.importedIds.includes(d.toString()));\n const allDepsWithScope = allDepsNotImported.map((id) => id._legacy).filter((dep) => dep.hasScope());\n const scopeComponentsImporter = this.consumer.scope.scopeImporter;\n await scopeComponentsImporter.importMany({\n ids: BitIds.uniqFromArray(allDepsWithScope),\n throwForDependencyNotFound: this.shouldThrowOnMissingDep,\n throwForSeederNotFound: this.shouldThrowOnMissingDep,\n reFetchUnBuiltVersion: false,\n lane: this.currentLane || undefined,\n });\n allDepsNotImported.map((id) => this.importedIds.push(id.toString()));\n }\n\n private async processOneComponent(component: Component) {\n const idStr = component.id.toString();\n if (this.completed.includes(idStr)) return [];\n const allIds = await this.getAllDepsFiltered(component);\n\n const allDependenciesComps = await this.loadManyComponents(allIds, idStr);\n const deps = await this.dependencyResolver.getComponentDependencies(component);\n deps.forEach((dep) => {\n const depId = dep.componentId;\n if (this.ignoreIds.includes(depId.toString())) return;\n if (!this.graph.hasNode(depId.toString())) {\n if (this.shouldThrowOnMissingDep) {\n throw new Error(`buildOneComponent: missing node of ${depId.toString()}`);\n }\n this.logger.warn(`ignoring missing ${depId.toString()}`);\n return;\n }\n this.graph.setEdge(new Edge(idStr, depId.toString(), dep.lifecycle));\n });\n\n this.completed.push(idStr);\n return allDependenciesComps;\n }\n\n private async loadManyComponents(componentsIds: ComponentID[], dependenciesOf?: string): Promise<Component[]> {\n const components = await mapSeries(componentsIds, async (comp) => {\n const idStr = comp.toString();\n const fromGraph = this.graph.node(idStr)?.attr;\n if (fromGraph) return fromGraph;\n try {\n const component = await this.workspace.get(comp);\n this.graph.setNode(new Node(idStr, component));\n return component;\n } catch (err: any) {\n if (\n err instanceof ComponentNotFound ||\n err instanceof ComponentNotFoundInScope ||\n err instanceof ScopeNotFound\n ) {\n if (dependenciesOf && !this.shouldThrowOnMissingDep) {\n this.logger.warn(\n `component ${idStr}, dependency of ${dependenciesOf} was not found. continuing without it`\n );\n return null;\n }\n throw new BitError(\n `error: component \"${idStr}\" was not found.\\nthis component is a dependency of \"${\n dependenciesOf || '<none>'\n }\" and is needed as part of the graph generation`\n );\n }\n if (dependenciesOf) this.logger.error(`failed loading dependencies of ${dependenciesOf}`);\n throw err;\n }\n });\n return compact(components);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,OAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,MAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,QAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,OAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAIA,SAAAK,QAAA;EAAA,MAAAL,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAG,OAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA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ceptions","_scope","_lodash2","_bitError","GraphFromFsBuilder","constructor","workspace","logger","dependencyResolver","ignoreIds","shouldLoadItsDeps","shouldThrowOnMissingDep","_defineProperty2","default","Graph","consumer","buildGraph","ids","debug","length","start","Date","now","components","loadManyComponents","currentLane","getCurrentLaneObject","processManyComponents","graph","getAllDepsUnfiltered","component","deps","getComponentDependencies","depsIds","map","dep","componentId","filter","depId","includes","toString","getAllDepsFiltered","depsWithoutIgnore","shouldLoadFunc","mapSeries","shouldLoad","push","compact","depth","importObjects","allDependencies","processOneComponent","allDependenciesFlattened","flatten","workspaceIds","listIds","compOnWorkspaceOnly","comp","find","id","isEqual","allDeps","Promise","all","c","flat","allDepsNotImported","d","importedIds","allDepsWithScope","_legacy","hasScope","scopeComponentsImporter","scope","scopeImporter","importMany","BitIds","uniqFromArray","preferDependencyGraph","throwForDependencyNotFound","throwForSeederNotFound","reFetchUnBuiltVersion","lane","undefined","reason","idStr","completed","allIds","allDependenciesComps","forEach","hasNode","Error","warn","setEdge","Edge","lifecycle","componentsIds","dependenciesOf","_this$graph$node","fromGraph","node","attr","get","setNode","Node","err","ComponentNotFound","ComponentNotFoundInScope","ScopeNotFound","BitError","error","exports"],"sources":["build-graph-from-fs.ts"],"sourcesContent":["import mapSeries from 'p-map-series';\nimport { Graph, Node, Edge } from '@teambit/graph.cleargraph';\nimport { flatten } from 'lodash';\nimport { Consumer } from '@teambit/legacy/dist/consumer';\nimport { Component, ComponentID } from '@teambit/component';\nimport { DependencyResolverMain } from '@teambit/dependency-resolver';\nimport BitIds from '@teambit/legacy/dist/bit-id/bit-ids';\nimport { Lane } from '@teambit/legacy/dist/scope/models';\nimport { ComponentNotFound, ScopeNotFound } from '@teambit/legacy/dist/scope/exceptions';\nimport { ComponentNotFound as ComponentNotFoundInScope } from '@teambit/scope';\nimport compact from 'lodash.compact';\nimport { Logger } from '@teambit/logger';\nimport { BitError } from '@teambit/bit-error';\nimport { Workspace } from './workspace';\n\nexport type ShouldLoadFunc = (id: ComponentID) => Promise<boolean>;\n\nexport class GraphFromFsBuilder {\n private graph = new Graph<Component, string>();\n private completed: string[] = [];\n private depth = 1;\n private consumer: Consumer;\n private importedIds: string[] = [];\n private currentLane: Lane | null;\n constructor(\n private workspace: Workspace,\n private logger: Logger,\n private dependencyResolver: DependencyResolverMain,\n private ignoreIds: string[] = [],\n private shouldLoadItsDeps?: ShouldLoadFunc,\n private shouldThrowOnMissingDep = true\n ) {\n this.consumer = this.workspace.consumer;\n }\n\n /**\n * create a graph with all dependencies and flattened dependencies of the given components.\n * the nodes are components and the edges has a label of the dependency type.\n *\n * the way how it is done is iterations by depths. each depth we gather all the dependencies of\n * that depths, make sure all objects exist and then check their dependencies for the next depth.\n * once there is no dependency left, we're on the last depth level and the graph is ready.\n *\n * for example, imagine the following graph:\n * A1 -> A2 -> A3\n * B1 -> B2 -> B3\n * C1 -> C2 -> C3\n *\n * where the buildGraph is given [A1, B1, C1].\n * first, it saves all these components as nodes in the graph. then, it finds the dependencies of\n * the next level, in this case they're [A2, B2, C2]. it runs `importMany` in case some objects\n * are missing. then, it loads them all (some from FS, some from the model) and sets the edges\n * between the component and the dependencies.\n * once done, it finds all their dependencies, which are [A3, B3, C3] and repeat the process\n * above. since there are no more dependencies, the graph is completed.\n * in this case, the total depth levels are 3.\n *\n * even with a huge project, there are not many depth levels. by iterating through depth levels\n * we keep performance sane as the importMany doesn't run multiple time and therefore the round\n * trips to the remotes are minimal.\n *\n * normally, one importMany of the seeders is enough as importMany knows to fetch all flattened.\n * however, since this buildGraph is performed on the workspace, a dependency may be new or\n * modified and as such, we don't know its flattened yet.\n */\n async buildGraph(ids: ComponentID[]): Promise<Graph<Component, string>> {\n this.logger.debug(`GraphFromFsBuilder, buildGraph with ${ids.length} seeders`);\n const start = Date.now();\n const components = await this.loadManyComponents(ids);\n this.currentLane = await this.workspace.consumer.getCurrentLaneObject();\n await this.processManyComponents(components);\n this.logger.debug(\n `GraphFromFsBuilder, buildGraph with ${ids.length} seeders completed (${(Date.now() - start) / 1000} sec)`\n );\n return this.graph;\n }\n\n private async getAllDepsUnfiltered(component: Component): Promise<ComponentID[]> {\n const deps = await this.dependencyResolver.getComponentDependencies(component);\n const depsIds = deps.map((dep) => dep.componentId);\n\n return depsIds.filter((depId) => !this.ignoreIds.includes(depId.toString()));\n }\n\n private async getAllDepsFiltered(component: Component): Promise<ComponentID[]> {\n const depsWithoutIgnore = await this.getAllDepsUnfiltered(component);\n const shouldLoadFunc = this.shouldLoadItsDeps;\n if (!shouldLoadFunc) return depsWithoutIgnore;\n const deps = await mapSeries(depsWithoutIgnore, async (depId) => {\n const shouldLoad = await shouldLoadFunc(depId);\n if (!shouldLoad) this.ignoreIds.push(depId.toString());\n return shouldLoad ? depId : null;\n });\n return compact(deps);\n }\n\n private async processManyComponents(components: Component[]) {\n this.logger.debug(`GraphFromFsBuilder.processManyComponents depth ${this.depth}, ${components.length} components`);\n this.depth += 1;\n await this.importObjects(components);\n const allDependencies = await mapSeries(components, (component) => this.processOneComponent(component));\n const allDependenciesFlattened = flatten(allDependencies);\n if (allDependenciesFlattened.length) await this.processManyComponents(allDependenciesFlattened);\n }\n\n /**\n * only for components from the workspace that can be modified to add/remove dependencies, we need to make sure that\n * all their dependencies are imported.\n * remember that `importMany` fetches all flattened dependencies. once a component from scope is imported, we know\n * that all its flattened dependencies are there. no need to call importMany again for them.\n */\n private async importObjects(components: Component[]) {\n const workspaceIds = await this.workspace.listIds();\n const compOnWorkspaceOnly = components.filter((comp) => workspaceIds.find((id) => id.isEqual(comp.id)));\n const allDeps = (await Promise.all(compOnWorkspaceOnly.map((c) => this.getAllDepsUnfiltered(c)))).flat();\n const allDepsNotImported = allDeps.filter((d) => !this.importedIds.includes(d.toString()));\n const allDepsWithScope = allDepsNotImported.map((id) => id._legacy).filter((dep) => dep.hasScope());\n const scopeComponentsImporter = this.consumer.scope.scopeImporter;\n await scopeComponentsImporter.importMany({\n ids: BitIds.uniqFromArray(allDepsWithScope),\n preferDependencyGraph: false,\n throwForDependencyNotFound: this.shouldThrowOnMissingDep,\n throwForSeederNotFound: this.shouldThrowOnMissingDep,\n reFetchUnBuiltVersion: false,\n lane: this.currentLane || undefined,\n reason: 'for building a graph from the workspace',\n });\n allDepsNotImported.map((id) => this.importedIds.push(id.toString()));\n }\n\n private async processOneComponent(component: Component) {\n const idStr = component.id.toString();\n if (this.completed.includes(idStr)) return [];\n const allIds = await this.getAllDepsFiltered(component);\n\n const allDependenciesComps = await this.loadManyComponents(allIds, idStr);\n const deps = await this.dependencyResolver.getComponentDependencies(component);\n deps.forEach((dep) => {\n const depId = dep.componentId;\n if (this.ignoreIds.includes(depId.toString())) return;\n if (!this.graph.hasNode(depId.toString())) {\n if (this.shouldThrowOnMissingDep) {\n throw new Error(`buildOneComponent: missing node of ${depId.toString()}`);\n }\n this.logger.warn(`ignoring missing ${depId.toString()}`);\n return;\n }\n this.graph.setEdge(new Edge(idStr, depId.toString(), dep.lifecycle));\n });\n\n this.completed.push(idStr);\n return allDependenciesComps;\n }\n\n private async loadManyComponents(componentsIds: ComponentID[], dependenciesOf?: string): Promise<Component[]> {\n const components = await mapSeries(componentsIds, async (comp) => {\n const idStr = comp.toString();\n const fromGraph = this.graph.node(idStr)?.attr;\n if (fromGraph) return fromGraph;\n try {\n const component = await this.workspace.get(comp);\n this.graph.setNode(new Node(idStr, component));\n return component;\n } catch (err: any) {\n if (\n err instanceof ComponentNotFound ||\n err instanceof ComponentNotFoundInScope ||\n err instanceof ScopeNotFound\n ) {\n if (dependenciesOf && !this.shouldThrowOnMissingDep) {\n this.logger.warn(\n `component ${idStr}, dependency of ${dependenciesOf} was not found. continuing without it`\n );\n return null;\n }\n throw new BitError(\n `error: component \"${idStr}\" was not found.\\nthis component is a dependency of \"${\n dependenciesOf || '<none>'\n }\" and is needed as part of the graph generation`\n );\n }\n if (dependenciesOf) this.logger.error(`failed loading dependencies of ${dependenciesOf}`);\n throw err;\n }\n });\n return compact(components);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;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,2BAAa,EAC5B;UACA,IAAIX,cAAc,IAAI,CAAC,IAAI,CAACtF,uBAAuB,EAAE;YACnD,IAAI,CAACJ,MAAM,CAACqF,IAAI,CACb,aAAYP,KAAM,mBAAkBY,cAAe,uCACtD,CAAC;YACD,OAAO,IAAI;UACb;UACA,MAAM,KAAIY,oBAAQ,EACf,qBAAoBxB,KAAM,wDACzBY,cAAc,IAAI,QACnB,iDACH,CAAC;QACH;QACA,IAAIA,cAAc,EAAE,IAAI,CAAC1F,MAAM,CAACuG,KAAK,CAAE,kCAAiCb,cAAe,EAAC,CAAC;QACzF,MAAMQ,GAAG;MACX;IACF,CAAC,CAAC;IACF,OAAO,IAAA1D,kBAAO,EAACxB,UAAU,CAAC;EAC5B;AACF;AAACwF,OAAA,CAAA3G,kBAAA,GAAAA,kBAAA"}
|
|
@@ -145,7 +145,7 @@ class GraphIdsFromFsBuilder {
|
|
|
145
145
|
throwForDependencyNotFound: this.shouldThrowOnMissingDep,
|
|
146
146
|
throwForSeederNotFound: this.shouldThrowOnMissingDep,
|
|
147
147
|
reFetchUnBuiltVersion: false,
|
|
148
|
-
|
|
148
|
+
reason: 'for building graph-ids from the workspace'
|
|
149
149
|
});
|
|
150
150
|
notImported.map(id => this.importedIds.push(id.toString()));
|
|
151
151
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_pMapSeries","data","_interopRequireDefault","require","_graph","_lodash","_component","_bitIds","_exceptions","_scope","_lodash2","_bitError","lifecycleToDepType","compDep","isExtension","lifecycle","Error","GraphIdsFromFsBuilder","constructor","workspace","logger","dependencyResolver","shouldThrowOnMissingDep","_defineProperty2","default","Graph","consumer","shouldThrowOnInvalidDeps","buildGraph","ids","debug","length","start","Date","now","components","loadManyComponents","processManyComponents","graph","depth","importObjects","allDependencies","mapSeries","component","processOneComponent","allDependenciesFlattened","flatten","workspaceIds","listIds","compOnWorkspaceOnly","filter","comp","find","id","isEqual","notImported","map","c","importedIds","includes","toString","withScope","_legacy","dep","hasScope","scopeComponentsImporter","scope","scopeImporter","importMany","BitIds","uniqFromArray","throwForDependencyNotFound","throwForSeederNotFound","reFetchUnBuiltVersion","preferDependencyGraph","push","idStr","completed","graphFromScope","getSavedGraphOfComponentIfExist","edges","isOnWorkspace","hasId","allDependenciesComps","processCompFromWorkspaceWithGraph","merge","deps","getComponentDependencies","allDepsIds","d","componentId","forEach","addDepEdge","depsInScopeGraph","depsNotInScopeGraph","partition","hasNode","depsInScopeGraphIds","depsInScopeGraphIdsNotCompleted","subGraphs","successorsSubgraph","depId","warn","setEdge","Edge","componentsIds","dependenciesOf","fromCache","loadedComponents","get","setNode","Node","err","ComponentNotFound","ComponentNotFoundInScope","ScopeNotFound","BitError","ConsumerComponent","isComponentInvalidByErrorType","message","error","compact","exports"],"sources":["build-graph-ids-from-fs.ts"],"sourcesContent":["import mapSeries from 'p-map-series';\nimport { Graph, Node, Edge } from '@teambit/graph.cleargraph';\nimport { flatten, partition } from 'lodash';\nimport { Consumer } from '@teambit/legacy/dist/consumer';\nimport { Component, ComponentID } from '@teambit/component';\nimport ConsumerComponent from '@teambit/legacy/dist/consumer/component';\nimport BitIds from '@teambit/legacy/dist/bit-id/bit-ids';\nimport { ComponentDependency, DependencyResolverMain } from '@teambit/dependency-resolver';\nimport { CompIdGraph, DepEdgeType } from '@teambit/graph';\nimport { ComponentNotFound, ScopeNotFound } from '@teambit/legacy/dist/scope/exceptions';\nimport { ComponentNotFound as ComponentNotFoundInScope } from '@teambit/scope';\nimport compact from 'lodash.compact';\nimport { Logger } from '@teambit/logger';\nimport { BitError } from '@teambit/bit-error';\nimport { Workspace } from './workspace';\n\nexport function lifecycleToDepType(compDep: ComponentDependency): DepEdgeType {\n if (compDep.isExtension) return 'ext';\n switch (compDep.lifecycle) {\n case 'dev':\n return 'dev';\n case 'runtime':\n return 'prod';\n default:\n throw new Error(`lifecycle ${compDep.lifecycle} is not support`);\n }\n}\n\nexport class GraphIdsFromFsBuilder {\n private graph = new Graph<ComponentID, DepEdgeType>();\n private completed: string[] = [];\n private depth = 1;\n private consumer: Consumer;\n private loadedComponents: { [idStr: string]: Component } = {};\n private importedIds: string[] = [];\n private shouldThrowOnInvalidDeps = true; // for now it has the same value as shouldThrowOnMissingDep. change if needed\n constructor(\n private workspace: Workspace,\n private logger: Logger,\n private dependencyResolver: DependencyResolverMain,\n private shouldThrowOnMissingDep = true\n ) {\n this.consumer = this.workspace.consumer;\n this.shouldThrowOnInvalidDeps = this.shouldThrowOnMissingDep;\n }\n\n /**\n * create a graph with all dependencies and flattened dependencies of the given components.\n * the nodes are component-ids and the edges has a label of the dependency type.\n * to get some info about this the graph build take a look into build-graph-from-fs.buildGraph() docs.\n */\n async buildGraph(ids: ComponentID[]): Promise<Graph<ComponentID, DepEdgeType>> {\n this.logger.debug(`GraphIdsFromFsBuilder, buildGraph with ${ids.length} seeders`);\n const start = Date.now();\n const components = await this.loadManyComponents(ids);\n await this.processManyComponents(components);\n this.logger.debug(\n `GraphIdsFromFsBuilder, buildGraph with ${ids.length} seeders completed (${(Date.now() - start) / 1000} sec)`\n );\n return this.graph;\n }\n\n private async processManyComponents(components: Component[]) {\n this.logger.debug(\n `GraphIdsFromFsBuilder.processManyComponents depth ${this.depth}, ${components.length} components`\n );\n this.depth += 1;\n await this.importObjects(components);\n const allDependencies = await mapSeries(components, (component) => this.processOneComponent(component));\n const allDependenciesFlattened = flatten(allDependencies);\n if (allDependenciesFlattened.length) await this.processManyComponents(allDependenciesFlattened);\n }\n\n /**\n * only for components from the workspace that can be modified to add/remove dependencies, we need to make sure that\n * all their dependencies are imported.\n * once a component from scope is imported, we know that either we have its dependency graph or all flattened deps\n */\n private async importObjects(components: Component[]) {\n const workspaceIds = await this.workspace.listIds();\n const compOnWorkspaceOnly = components.filter((comp) => workspaceIds.find((id) => id.isEqual(comp.id)));\n const notImported = compOnWorkspaceOnly.map((c) => c.id).filter((id) => !this.importedIds.includes(id.toString()));\n const withScope = notImported.map((id) => id._legacy).filter((dep) => dep.hasScope());\n const scopeComponentsImporter = this.consumer.scope.scopeImporter;\n await scopeComponentsImporter.importMany({\n ids: BitIds.uniqFromArray(withScope),\n throwForDependencyNotFound: this.shouldThrowOnMissingDep,\n throwForSeederNotFound: this.shouldThrowOnMissingDep,\n reFetchUnBuiltVersion: false,\n preferDependencyGraph: true,\n });\n notImported.map((id) => this.importedIds.push(id.toString()));\n }\n\n private async processOneComponent(component: Component) {\n const idStr = component.id.toString();\n if (this.completed.includes(idStr)) return [];\n const graphFromScope = await this.workspace.getSavedGraphOfComponentIfExist(component);\n if (graphFromScope?.edges.length) {\n const isOnWorkspace = await this.workspace.hasId(component.id);\n if (isOnWorkspace) {\n const allDependenciesComps = await this.processCompFromWorkspaceWithGraph(graphFromScope, component);\n this.completed.push(idStr);\n return allDependenciesComps;\n }\n this.graph.merge([graphFromScope]);\n this.completed.push(idStr);\n return [];\n }\n\n const deps = await this.dependencyResolver.getComponentDependencies(component);\n const allDepsIds = deps.map((d) => d.componentId);\n const allDependenciesComps = await this.loadManyComponents(allDepsIds, idStr);\n\n deps.forEach((dep) => this.addDepEdge(idStr, dep));\n this.completed.push(idStr);\n\n return allDependenciesComps;\n }\n\n /**\n * this is tricky.\n * the component is in the workspace so it can be modified. dependencies can be added/removed/updated/downgraded.\n * we have the graph-dependencies from the last snap, so we prefer to use it whenever possible for performance reasons.\n * if we can't use it, we have to recursively load dependencies components and get the data from there.\n * to maximize the performance, we iterate the direct dependencies, if we find a dep with the same id in the graph,\n * and that id is not in the workspace then ask the graph for all its successors. otherwise, if it's not there, or\n * it's there but it's also in the workspace (which therefore can be modified), we recursively load the dep components\n * and get its dependencies.\n */\n private async processCompFromWorkspaceWithGraph(\n graphFromScope: CompIdGraph,\n component: Component\n ): Promise<Component[]> {\n const deps = await this.dependencyResolver.getComponentDependencies(component);\n const workspaceIds = await this.workspace.listIds();\n const [depsInScopeGraph, depsNotInScopeGraph] = partition(\n deps,\n (dep) =>\n graphFromScope.hasNode(dep.componentId.toString()) && !workspaceIds.find((id) => id.isEqual(dep.componentId))\n );\n\n const depsInScopeGraphIds = depsInScopeGraph.map((dep) => dep.componentId.toString());\n const depsInScopeGraphIdsNotCompleted = depsInScopeGraphIds.filter((id) => !this.completed.includes(id));\n if (depsInScopeGraphIdsNotCompleted.length) {\n const subGraphs = graphFromScope.successorsSubgraph(depsInScopeGraphIdsNotCompleted);\n this.graph.merge([subGraphs]);\n this.completed.push(...depsInScopeGraphIdsNotCompleted);\n }\n\n const allDepsIds = depsNotInScopeGraph.map((d) => d.componentId);\n const idStr = component.id.toString();\n const allDependenciesComps = await this.loadManyComponents(allDepsIds, idStr);\n deps.forEach((dep) => this.addDepEdge(idStr, dep));\n return allDependenciesComps;\n }\n\n private addDepEdge(idStr: string, dep: ComponentDependency) {\n const depId = dep.componentId;\n if (!this.graph.hasNode(depId.toString())) {\n if (this.shouldThrowOnMissingDep) {\n throw new Error(`buildOneComponent: missing node of ${depId.toString()}`);\n }\n this.logger.warn(`ignoring missing ${depId.toString()}`);\n return;\n }\n this.graph.setEdge(new Edge(idStr, depId.toString(), lifecycleToDepType(dep)));\n }\n\n private async loadManyComponents(componentsIds: ComponentID[], dependenciesOf?: string): Promise<Component[]> {\n const components = await mapSeries(componentsIds, async (comp) => {\n const idStr = comp.toString();\n const fromCache = this.loadedComponents[idStr];\n if (fromCache) return fromCache;\n try {\n const component = await this.workspace.get(comp);\n this.loadedComponents[idStr] = component;\n this.graph.setNode(new Node(idStr, component.id));\n return component;\n } catch (err: any) {\n if (\n err instanceof ComponentNotFound ||\n err instanceof ComponentNotFoundInScope ||\n err instanceof ScopeNotFound\n ) {\n if (dependenciesOf && !this.shouldThrowOnMissingDep) {\n this.logger.warn(\n `component ${idStr}, dependency of ${dependenciesOf} was not found. continuing without it`\n );\n return null;\n }\n throw new BitError(\n `error: component \"${idStr}\" was not found.\\nthis component is a dependency of \"${\n dependenciesOf || '<none>'\n }\" and is needed as part of the graph generation`\n );\n }\n if (ConsumerComponent.isComponentInvalidByErrorType(err)) {\n if (dependenciesOf && !this.shouldThrowOnInvalidDeps) {\n this.logger.warn(`component ${idStr}, dependency of ${dependenciesOf} is invalid. continuing without it`);\n return null;\n }\n throw new BitError(\n `error: component \"${idStr}\" is invalid (${err.message}).\\nthis component is a dependency of \"${\n dependenciesOf || '<none>'\n }\" and is needed as part of the graph generation`\n );\n }\n if (dependenciesOf) this.logger.error(`failed loading dependencies of ${dependenciesOf}`);\n throw err;\n }\n });\n return compact(components);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,OAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,MAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,QAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,OAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAK,WAAA;EAAA,MAAAL,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAG,UAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,QAAA;EAAA,MAAAN,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAI,OAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAO,YAAA;EAAA,MAAAP,IAAA,GAAAE,OAAA;EAAAK,WAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAQ,OAAA;EAAA,MAAAR,IAAA,GAAAE,OAAA;EAAAM,MAAA,YAAAA,CAAA;IAAA,OAAAR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AI,EAACnC,KAAK,EAAEjC,SAAS,CAACU,EAAE,CAAC,CAAC;QACjD,OAAOV,SAAS;MAClB,CAAC,CAAC,OAAOqE,GAAQ,EAAE;QACjB,IACEA,GAAG,YAAYC,+BAAiB,IAChCD,GAAG,YAAYE,0BAAwB,IACvCF,GAAG,YAAYG,2BAAa,EAC5B;UACA,IAAIT,cAAc,IAAI,CAAC,IAAI,CAACpF,uBAAuB,EAAE;YACnD,IAAI,CAACF,MAAM,CAACkF,IAAI,CACb,aAAY1B,KAAM,mBAAkB8B,cAAe,uCACtD,CAAC;YACD,OAAO,IAAI;UACb;UACA,MAAM,KAAIU,oBAAQ,EACf,qBAAoBxC,KAAM,wDACzB8B,cAAc,IAAI,QACnB,iDACH,CAAC;QACH;QACA,IAAIW,oBAAiB,CAACC,6BAA6B,CAACN,GAAG,CAAC,EAAE;UACxD,IAAIN,cAAc,IAAI,CAAC,IAAI,CAAC/E,wBAAwB,EAAE;YACpD,IAAI,CAACP,MAAM,CAACkF,IAAI,CAAE,aAAY1B,KAAM,mBAAkB8B,cAAe,oCAAmC,CAAC;YACzG,OAAO,IAAI;UACb;UACA,MAAM,KAAIU,oBAAQ,EACf,qBAAoBxC,KAAM,iBAAgBoC,GAAG,CAACO,OAAQ,0CACrDb,cAAc,IAAI,QACnB,iDACH,CAAC;QACH;QACA,IAAIA,cAAc,EAAE,IAAI,CAACtF,MAAM,CAACoG,KAAK,CAAE,kCAAiCd,cAAe,EAAC,CAAC;QACzF,MAAMM,GAAG;MACX;IACF,CAAC,CAAC;IACF,OAAO,IAAAS,kBAAO,EAACtF,UAAU,CAAC;EAC5B;AACF;AAACuF,OAAA,CAAAzG,qBAAA,GAAAA,qBAAA"}
|
|
1
|
+
{"version":3,"names":["_pMapSeries","data","_interopRequireDefault","require","_graph","_lodash","_component","_bitIds","_exceptions","_scope","_lodash2","_bitError","lifecycleToDepType","compDep","isExtension","lifecycle","Error","GraphIdsFromFsBuilder","constructor","workspace","logger","dependencyResolver","shouldThrowOnMissingDep","_defineProperty2","default","Graph","consumer","shouldThrowOnInvalidDeps","buildGraph","ids","debug","length","start","Date","now","components","loadManyComponents","processManyComponents","graph","depth","importObjects","allDependencies","mapSeries","component","processOneComponent","allDependenciesFlattened","flatten","workspaceIds","listIds","compOnWorkspaceOnly","filter","comp","find","id","isEqual","notImported","map","c","importedIds","includes","toString","withScope","_legacy","dep","hasScope","scopeComponentsImporter","scope","scopeImporter","importMany","BitIds","uniqFromArray","throwForDependencyNotFound","throwForSeederNotFound","reFetchUnBuiltVersion","reason","push","idStr","completed","graphFromScope","getSavedGraphOfComponentIfExist","edges","isOnWorkspace","hasId","allDependenciesComps","processCompFromWorkspaceWithGraph","merge","deps","getComponentDependencies","allDepsIds","d","componentId","forEach","addDepEdge","depsInScopeGraph","depsNotInScopeGraph","partition","hasNode","depsInScopeGraphIds","depsInScopeGraphIdsNotCompleted","subGraphs","successorsSubgraph","depId","warn","setEdge","Edge","componentsIds","dependenciesOf","fromCache","loadedComponents","get","setNode","Node","err","ComponentNotFound","ComponentNotFoundInScope","ScopeNotFound","BitError","ConsumerComponent","isComponentInvalidByErrorType","message","error","compact","exports"],"sources":["build-graph-ids-from-fs.ts"],"sourcesContent":["import mapSeries from 'p-map-series';\nimport { Graph, Node, Edge } from '@teambit/graph.cleargraph';\nimport { flatten, partition } from 'lodash';\nimport { Consumer } from '@teambit/legacy/dist/consumer';\nimport { Component, ComponentID } from '@teambit/component';\nimport ConsumerComponent from '@teambit/legacy/dist/consumer/component';\nimport BitIds from '@teambit/legacy/dist/bit-id/bit-ids';\nimport { ComponentDependency, DependencyResolverMain } from '@teambit/dependency-resolver';\nimport { CompIdGraph, DepEdgeType } from '@teambit/graph';\nimport { ComponentNotFound, ScopeNotFound } from '@teambit/legacy/dist/scope/exceptions';\nimport { ComponentNotFound as ComponentNotFoundInScope } from '@teambit/scope';\nimport compact from 'lodash.compact';\nimport { Logger } from '@teambit/logger';\nimport { BitError } from '@teambit/bit-error';\nimport { Workspace } from './workspace';\n\nexport function lifecycleToDepType(compDep: ComponentDependency): DepEdgeType {\n if (compDep.isExtension) return 'ext';\n switch (compDep.lifecycle) {\n case 'dev':\n return 'dev';\n case 'runtime':\n return 'prod';\n default:\n throw new Error(`lifecycle ${compDep.lifecycle} is not support`);\n }\n}\n\nexport class GraphIdsFromFsBuilder {\n private graph = new Graph<ComponentID, DepEdgeType>();\n private completed: string[] = [];\n private depth = 1;\n private consumer: Consumer;\n private loadedComponents: { [idStr: string]: Component } = {};\n private importedIds: string[] = [];\n private shouldThrowOnInvalidDeps = true; // for now it has the same value as shouldThrowOnMissingDep. change if needed\n constructor(\n private workspace: Workspace,\n private logger: Logger,\n private dependencyResolver: DependencyResolverMain,\n private shouldThrowOnMissingDep = true\n ) {\n this.consumer = this.workspace.consumer;\n this.shouldThrowOnInvalidDeps = this.shouldThrowOnMissingDep;\n }\n\n /**\n * create a graph with all dependencies and flattened dependencies of the given components.\n * the nodes are component-ids and the edges has a label of the dependency type.\n * to get some info about this the graph build take a look into build-graph-from-fs.buildGraph() docs.\n */\n async buildGraph(ids: ComponentID[]): Promise<Graph<ComponentID, DepEdgeType>> {\n this.logger.debug(`GraphIdsFromFsBuilder, buildGraph with ${ids.length} seeders`);\n const start = Date.now();\n const components = await this.loadManyComponents(ids);\n await this.processManyComponents(components);\n this.logger.debug(\n `GraphIdsFromFsBuilder, buildGraph with ${ids.length} seeders completed (${(Date.now() - start) / 1000} sec)`\n );\n return this.graph;\n }\n\n private async processManyComponents(components: Component[]) {\n this.logger.debug(\n `GraphIdsFromFsBuilder.processManyComponents depth ${this.depth}, ${components.length} components`\n );\n this.depth += 1;\n await this.importObjects(components);\n const allDependencies = await mapSeries(components, (component) => this.processOneComponent(component));\n const allDependenciesFlattened = flatten(allDependencies);\n if (allDependenciesFlattened.length) await this.processManyComponents(allDependenciesFlattened);\n }\n\n /**\n * only for components from the workspace that can be modified to add/remove dependencies, we need to make sure that\n * all their dependencies are imported.\n * once a component from scope is imported, we know that either we have its dependency graph or all flattened deps\n */\n private async importObjects(components: Component[]) {\n const workspaceIds = await this.workspace.listIds();\n const compOnWorkspaceOnly = components.filter((comp) => workspaceIds.find((id) => id.isEqual(comp.id)));\n const notImported = compOnWorkspaceOnly.map((c) => c.id).filter((id) => !this.importedIds.includes(id.toString()));\n const withScope = notImported.map((id) => id._legacy).filter((dep) => dep.hasScope());\n const scopeComponentsImporter = this.consumer.scope.scopeImporter;\n await scopeComponentsImporter.importMany({\n ids: BitIds.uniqFromArray(withScope),\n throwForDependencyNotFound: this.shouldThrowOnMissingDep,\n throwForSeederNotFound: this.shouldThrowOnMissingDep,\n reFetchUnBuiltVersion: false,\n reason: 'for building graph-ids from the workspace',\n });\n notImported.map((id) => this.importedIds.push(id.toString()));\n }\n\n private async processOneComponent(component: Component) {\n const idStr = component.id.toString();\n if (this.completed.includes(idStr)) return [];\n const graphFromScope = await this.workspace.getSavedGraphOfComponentIfExist(component);\n if (graphFromScope?.edges.length) {\n const isOnWorkspace = await this.workspace.hasId(component.id);\n if (isOnWorkspace) {\n const allDependenciesComps = await this.processCompFromWorkspaceWithGraph(graphFromScope, component);\n this.completed.push(idStr);\n return allDependenciesComps;\n }\n this.graph.merge([graphFromScope]);\n this.completed.push(idStr);\n return [];\n }\n\n const deps = await this.dependencyResolver.getComponentDependencies(component);\n const allDepsIds = deps.map((d) => d.componentId);\n const allDependenciesComps = await this.loadManyComponents(allDepsIds, idStr);\n\n deps.forEach((dep) => this.addDepEdge(idStr, dep));\n this.completed.push(idStr);\n\n return allDependenciesComps;\n }\n\n /**\n * this is tricky.\n * the component is in the workspace so it can be modified. dependencies can be added/removed/updated/downgraded.\n * we have the graph-dependencies from the last snap, so we prefer to use it whenever possible for performance reasons.\n * if we can't use it, we have to recursively load dependencies components and get the data from there.\n * to maximize the performance, we iterate the direct dependencies, if we find a dep with the same id in the graph,\n * and that id is not in the workspace then ask the graph for all its successors. otherwise, if it's not there, or\n * it's there but it's also in the workspace (which therefore can be modified), we recursively load the dep components\n * and get its dependencies.\n */\n private async processCompFromWorkspaceWithGraph(\n graphFromScope: CompIdGraph,\n component: Component\n ): Promise<Component[]> {\n const deps = await this.dependencyResolver.getComponentDependencies(component);\n const workspaceIds = await this.workspace.listIds();\n const [depsInScopeGraph, depsNotInScopeGraph] = partition(\n deps,\n (dep) =>\n graphFromScope.hasNode(dep.componentId.toString()) && !workspaceIds.find((id) => id.isEqual(dep.componentId))\n );\n\n const depsInScopeGraphIds = depsInScopeGraph.map((dep) => dep.componentId.toString());\n const depsInScopeGraphIdsNotCompleted = depsInScopeGraphIds.filter((id) => !this.completed.includes(id));\n if (depsInScopeGraphIdsNotCompleted.length) {\n const subGraphs = graphFromScope.successorsSubgraph(depsInScopeGraphIdsNotCompleted);\n this.graph.merge([subGraphs]);\n this.completed.push(...depsInScopeGraphIdsNotCompleted);\n }\n\n const allDepsIds = depsNotInScopeGraph.map((d) => d.componentId);\n const idStr = component.id.toString();\n const allDependenciesComps = await this.loadManyComponents(allDepsIds, idStr);\n deps.forEach((dep) => this.addDepEdge(idStr, dep));\n return allDependenciesComps;\n }\n\n private addDepEdge(idStr: string, dep: ComponentDependency) {\n const depId = dep.componentId;\n if (!this.graph.hasNode(depId.toString())) {\n if (this.shouldThrowOnMissingDep) {\n throw new Error(`buildOneComponent: missing node of ${depId.toString()}`);\n }\n this.logger.warn(`ignoring missing ${depId.toString()}`);\n return;\n }\n this.graph.setEdge(new Edge(idStr, depId.toString(), lifecycleToDepType(dep)));\n }\n\n private async loadManyComponents(componentsIds: ComponentID[], dependenciesOf?: string): Promise<Component[]> {\n const components = await mapSeries(componentsIds, async (comp) => {\n const idStr = comp.toString();\n const fromCache = this.loadedComponents[idStr];\n if (fromCache) return fromCache;\n try {\n const component = await this.workspace.get(comp);\n this.loadedComponents[idStr] = component;\n this.graph.setNode(new Node(idStr, component.id));\n return component;\n } catch (err: any) {\n if (\n err instanceof ComponentNotFound ||\n err instanceof ComponentNotFoundInScope ||\n err instanceof ScopeNotFound\n ) {\n if (dependenciesOf && !this.shouldThrowOnMissingDep) {\n this.logger.warn(\n `component ${idStr}, dependency of ${dependenciesOf} was not found. continuing without it`\n );\n return null;\n }\n throw new BitError(\n `error: component \"${idStr}\" was not found.\\nthis component is a dependency of \"${\n dependenciesOf || '<none>'\n }\" and is needed as part of the graph generation`\n );\n }\n if (ConsumerComponent.isComponentInvalidByErrorType(err)) {\n if (dependenciesOf && !this.shouldThrowOnInvalidDeps) {\n this.logger.warn(`component ${idStr}, dependency of ${dependenciesOf} is invalid. continuing without it`);\n return null;\n }\n throw new BitError(\n `error: component \"${idStr}\" is invalid (${err.message}).\\nthis component is a dependency of \"${\n dependenciesOf || '<none>'\n }\" and is needed as part of the graph generation`\n );\n }\n if (dependenciesOf) this.logger.error(`failed loading dependencies of ${dependenciesOf}`);\n throw err;\n }\n });\n return compact(components);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,OAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,MAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,QAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,OAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAK,WAAA;EAAA,MAAAL,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAG,UAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,QAAA;EAAA,MAAAN,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAI,OAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OA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AC5B;AACF;AAACuF,OAAA,CAAAzG,qBAAA,GAAAA,qBAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -14,5 +14,6 @@ export type { WorkspaceComponent } from './workspace-component';
|
|
|
14
14
|
export type { ComponentConfigFile } from './component-config-file';
|
|
15
15
|
export type { CompFiles, FilesStatus } from './workspace-component/comp-files';
|
|
16
16
|
export type { MergeOptions as BitmapMergeOptions } from './bit-map';
|
|
17
|
+
export type { WorkspaceExtConfig } from './types';
|
|
17
18
|
export { WorkspaceAspect };
|
|
18
19
|
export default WorkspaceAspect;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_workspace","data","require","_events","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_workspaceComponent","_workspaceModel","_workspaceContext","_outsideWorkspace","_default","WorkspaceAspect","default"],"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 * 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 { OutsideWorkspaceError } from './exceptions/outside-workspace';\nexport type { WorkspaceComponent } from './workspace-component';\nexport type { ComponentConfigFile } from './component-config-file';\nexport type { CompFiles, FilesStatus } from './workspace-component/comp-files';\nexport type { MergeOptions as BitmapMergeOptions } from './bit-map';\nexport { WorkspaceAspect };\nexport default WorkspaceAspect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version":3,"names":["_workspace","data","require","_events","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_workspaceComponent","_workspaceModel","_workspaceContext","_outsideWorkspace","_default","WorkspaceAspect","default"],"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 * 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 { OutsideWorkspaceError } from './exceptions/outside-workspace';\nexport type { WorkspaceComponent } from './workspace-component';\nexport type { ComponentConfigFile } from './component-config-file';\nexport type { CompFiles, FilesStatus } from './workspace-component/comp-files';\nexport type { MergeOptions as BitmapMergeOptions } from './bit-map';\nexport type { WorkspaceExtConfig } from './types';\nexport { WorkspaceAspect };\nexport default WorkspaceAspect;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAAA,WAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,UAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAOA,IAAAE,OAAA,GAAAD,OAAA;AAAAE,MAAA,CAAAC,IAAA,CAAAF,OAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,OAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,OAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AAGA,SAAAS,oBAAA;EAAA,MAAAf,IAAA,GAAAC,OAAA;EAAAc,mBAAA,YAAAA,CAAA;IAAA,OAAAf,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAgB,gBAAA;EAAA,MAAAhB,IAAA,GAAAC,OAAA;EAAAe,eAAA,YAAAA,CAAA;IAAA,OAAAhB,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAiB,kBAAA;EAAA,MAAAjB,IAAA,GAAAC,OAAA;EAAAgB,iBAAA,YAAAA,CAAA;IAAA,OAAAjB,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAkB,kBAAA;EAAA,MAAAlB,IAAA,GAAAC,OAAA;EAAAiB,iBAAA,YAAAA,CAAA;IAAA,OAAAlB,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAZA;AAEA;AAAA,IAAAmB,QAAA,GAiBeC,4BAAe;AAAAT,OAAA,CAAAU,OAAA,GAAAF,QAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.workspace_workspace@0.0.
|
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.workspace_workspace@0.0.
|
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.workspace_workspace@0.0.1146/dist/workspace.composition.js';
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.workspace_workspace@0.0.1146/dist/workspace.docs.mdx';
|
|
3
3
|
|
|
4
4
|
export const compositions = [compositions_0];
|
|
5
5
|
export const overview = [overview_0];
|
package/dist/types.d.ts
CHANGED
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["interface VendorConfig {\n directory: string;\n}\n\nexport interface WorkspaceExtConfig {\n /**\n * name of the workspace.\n */\n name: string;\n\n /**\n * path to icon.\n */\n icon: string;\n\n /**\n * applies only on bit.
|
|
1
|
+
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["interface VendorConfig {\n directory: string;\n}\n\nexport interface WorkspaceExtConfig {\n /**\n * name of the workspace.\n */\n name: string;\n\n /**\n * path to icon.\n */\n icon: string;\n\n /**\n * applies only on bit.cloud. configure the main owner of your workspace\n */\n defaultOwner: string;\n\n /**\n * set the default scope when there is no matching for the component in the components array.\n */\n defaultScope: string;\n\n /**\n * set the default directory when there is no matching for the component in the components array.\n */\n defaultDirectory: string;\n\n /**\n * set the default structure of components in your project\n */\n vendor: VendorConfig;\n\n /**\n * All component extensions applied by default on all components in the workspace (except vendor components)\n */\n extensions: { [extensionsId: string]: string };\n\n /**\n * If set to\n * `true`, it allows the workspace to resolve scope's aspects from node modules\n * installed in the workspace's `node_modules` directory. If not set or set to `false`, aspects will only be resolved\n * from the scope aspects capsule.\n */\n resolveAspectsFromNodeModules?: boolean;\n\n /**\n * If set to `true`, it allows the workspace to resolve envs from node modules\n * installed in the workspace's `node_modules` directory.\n * the envs will be resolved from the node_modules of the env's root (workspace/node_modules/.bit_roots/{envId})\n * and if not found (usually when the env was hoisted to the root node_modules) then from the node_modules of the\n * workspace.\n * If not set or set to `false`, envs will only be resolved from the scope envs capsule.\n */\n resolveEnvsFromRoots?: boolean;\n\n /**\n * If set to `true`, bit will try to load aspects dependencies automatically.\n * even if the aspects dependencies are not configured in the workspace.jsonc root config.\n * for example having the aspect\n * main aspect\n * export class MainAspectMain {\n * ...\n * static dependencies = [MyDepAspect];\n * }\n * and the in the workspace.jsonc file:\n * {\n * ...\n * main-aspect: {}\n * }\n * when set to true, bit will try to load MyDepAspect automatically.\n */\n autoLoadAspectsDeps?: boolean;\n}\n"],"mappings":""}
|
|
@@ -77,6 +77,13 @@ function _uiFoundationUi2() {
|
|
|
77
77
|
};
|
|
78
78
|
return data;
|
|
79
79
|
}
|
|
80
|
+
function _classnames() {
|
|
81
|
+
const data = _interopRequireDefault(require("classnames"));
|
|
82
|
+
_classnames = function () {
|
|
83
|
+
return data;
|
|
84
|
+
};
|
|
85
|
+
return data;
|
|
86
|
+
}
|
|
80
87
|
function _useWorkspace() {
|
|
81
88
|
const data = require("./use-workspace");
|
|
82
89
|
_useWorkspace = function () {
|
|
@@ -147,7 +154,7 @@ function Workspace({
|
|
|
147
154
|
size: 264,
|
|
148
155
|
layout: sidebarOpenness
|
|
149
156
|
}, /*#__PURE__*/_react().default.createElement(_baseUiSurfacesSplitPane().Pane, {
|
|
150
|
-
className: _workspaceModule().default.sidebar
|
|
157
|
+
className: (0, _classnames().default)(_workspaceModule().default.sidebar, !isSidebarOpen && _workspaceModule().default.closed)
|
|
151
158
|
}, sidebar), /*#__PURE__*/_react().default.createElement(_baseUiSurfacesSplitPane2().HoverSplitter, {
|
|
152
159
|
className: _workspaceModule().default.splitter
|
|
153
160
|
}, /*#__PURE__*/_react().default.createElement(_uiFoundationUiButtons().Collapser, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["require","_pluralize","data","_interopRequireDefault","_react","_interopRequireWildcard","_reactRouterDom","_uiFoundationUiNotifications","_uiFoundationUiReactRouter","_uiFoundationUi","_uiFoundationUiButtons","_baseUiSurfacesSplitPane","_baseUiSurfacesSplitPane2","_uiFoundationUi2","_useWorkspace","_workspaceOverview","_workspaceProvider","_workspaceModule","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","Workspace","routeSlot","menuSlot","sidebar","workspaceUI","onSidebarTogglerChange","reactions","useComponentNotifications","workspace","useWorkspace","isSidebarOpen","handleSidebarToggle","useReducer","x","sidebarOpenness","Layout","row","right","createElement","className","styles","emptyContainer","setComponents","components","WorkspaceProvider","workspaceWrapper","TopBar","topbar","Corner","corner","name","icon","menu","SplitPane","main","size","layout","Pane","HoverSplitter","splitter","Collapser","isOpen","onMouseDown","e","stopPropagation","onClick","tooltipContent","SlotRouter","slot","Route","index","element","WorkspaceOverview","notifications","useNotifications","useMemo","onComponentAdded","comps","notificationId","log","pluralize","length","map","comp","id","toString","join","setTimeout","dismiss","onComponentRemoved","ids"],"sources":["workspace.tsx"],"sourcesContent":["import 'reset-css';\nimport pluralize from 'pluralize';\nimport React, { useReducer, useMemo } from 'react';\nimport { Route } from 'react-router-dom';\nimport type { ComponentModel } from '@teambit/component';\nimport type { ComponentID } from '@teambit/component-id';\nimport { useNotifications } from '@teambit/ui-foundation.ui.notifications.notification-context';\nimport { RouteSlot, SlotRouter } from '@teambit/ui-foundation.ui.react-router.slot-router';\nimport { Corner } from '@teambit/ui-foundation.ui.corner';\nimport { Collapser } from '@teambit/ui-foundation.ui.buttons.collapser';\nimport { SplitPane, Pane, Layout } from '@teambit/base-ui.surfaces.split-pane.split-pane';\nimport { HoverSplitter } from '@teambit/base-ui.surfaces.split-pane.hover-splitter';\nimport { TopBar } from '@teambit/ui-foundation.ui.top-bar';\n\nimport { useWorkspace } from './use-workspace';\nimport { WorkspaceOverview } from './workspace-overview';\nimport { WorkspaceProvider } from './workspace-provider';\nimport styles from './workspace.module.scss';\nimport WorkspaceUI from '../../workspace.ui.runtime';\n\nexport type WorkspaceProps = {\n routeSlot: RouteSlot;\n menuSlot: RouteSlot;\n sidebar: JSX.Element;\n workspaceUI: WorkspaceUI;\n onSidebarTogglerChange: (callback: () => void) => void;\n};\n\n/**\n * main workspace component.\n */\nexport function Workspace({ routeSlot, menuSlot, sidebar, workspaceUI, onSidebarTogglerChange }: WorkspaceProps) {\n const reactions = useComponentNotifications();\n const { workspace } = useWorkspace(reactions);\n\n const [isSidebarOpen, handleSidebarToggle] = useReducer((x) => !x, true);\n const sidebarOpenness = isSidebarOpen ? Layout.row : Layout.right;\n\n onSidebarTogglerChange(handleSidebarToggle);\n\n if (!workspace) {\n return <div className={styles.emptyContainer}></div>;\n }\n\n workspaceUI.setComponents(workspace.components);\n\n return (\n <WorkspaceProvider workspace={workspace}>\n <div className={styles.workspaceWrapper}>\n <TopBar\n className={styles.topbar}\n Corner={() => <Corner className={styles.corner} name={workspace.name} icon={workspace.icon} />}\n menu={menuSlot}\n />\n\n <SplitPane className={styles.main} size={264} layout={sidebarOpenness}>\n <Pane className={styles.sidebar}>{sidebar}</Pane>\n <HoverSplitter className={styles.splitter}>\n <Collapser\n isOpen={isSidebarOpen}\n onMouseDown={(e) => e.stopPropagation()} // avoid split-pane drag\n onClick={handleSidebarToggle}\n tooltipContent={`${isSidebarOpen ? 'Hide' : 'Show'} side panel`}\n />\n </HoverSplitter>\n <Pane>\n <SlotRouter slot={routeSlot}>\n <Route index element={<WorkspaceOverview />} />\n </SlotRouter>\n </Pane>\n </SplitPane>\n </div>\n </WorkspaceProvider>\n );\n}\nfunction useComponentNotifications() {\n const notifications = useNotifications();\n\n // memo not really needed, but for peace of mind\n return useMemo(\n () => ({\n onComponentAdded: (comps: ComponentModel[]) => {\n const notificationId = notifications.log(\n `added ${pluralize('component', comps.length)}: ${comps.map((comp) => comp.id.toString()).join(', ')}`\n );\n setTimeout(() => notifications.dismiss(notificationId), 12 * 1000);\n },\n\n onComponentRemoved: (ids: ComponentID[]) => {\n const notificationId = notifications.log(\n `removed ${pluralize('component', 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E,EAAE,IAAKA,EAAE,CAACC,QAAQ,CAAC,CAAC,CAAC,CAACC,IAAI,CAAC,IAAI,CAAE,EAC7F,CAAC;MACDC,UAAU,CAAC,MAAMd,aAAa,CAACe,OAAO,CAACV,cAAc,CAAC,EAAE,EAAE,GAAG,IAAI,CAAC;IACpE;EACF,CAAC,CAAC,EACF,CAACL,aAAa,CAChB,CAAC;AACH"}
|
|
1
|
+
{"version":3,"names":["require","_pluralize","data","_interopRequireDefault","_react","_interopRequireWildcard","_reactRouterDom","_uiFoundationUiNotifications","_uiFoundationUiReactRouter","_uiFoundationUi","_uiFoundationUiButtons","_baseUiSurfacesSplitPane","_baseUiSurfacesSplitPane2","_uiFoundationUi2","_classnames","_useWorkspace","_workspaceOverview","_workspaceProvider","_workspaceModule","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","Workspace","routeSlot","menuSlot","sidebar","workspaceUI","onSidebarTogglerChange","reactions","useComponentNotifications","workspace","useWorkspace","isSidebarOpen","handleSidebarToggle","useReducer","x","sidebarOpenness","Layout","row","right","createElement","className","styles","emptyContainer","setComponents","components","WorkspaceProvider","workspaceWrapper","TopBar","topbar","Corner","corner","name","icon","menu","SplitPane","main","size","layout","Pane","classNames","closed","HoverSplitter","splitter","Collapser","isOpen","onMouseDown","e","stopPropagation","onClick","tooltipContent","SlotRouter","slot","Route","index","element","WorkspaceOverview","notifications","useNotifications","useMemo","onComponentAdded","comps","notificationId","log","pluralize","length","map","comp","id","toString","join","setTimeout","dismiss","onComponentRemoved","ids"],"sources":["workspace.tsx"],"sourcesContent":["import 'reset-css';\nimport pluralize from 'pluralize';\nimport React, { useReducer, useMemo } from 'react';\nimport { Route } from 'react-router-dom';\nimport type { ComponentModel } from '@teambit/component';\nimport type { ComponentID } from '@teambit/component-id';\nimport { useNotifications } from '@teambit/ui-foundation.ui.notifications.notification-context';\nimport { RouteSlot, SlotRouter } from '@teambit/ui-foundation.ui.react-router.slot-router';\nimport { Corner } from '@teambit/ui-foundation.ui.corner';\nimport { Collapser } from '@teambit/ui-foundation.ui.buttons.collapser';\nimport { SplitPane, Pane, Layout } from '@teambit/base-ui.surfaces.split-pane.split-pane';\nimport { HoverSplitter } from '@teambit/base-ui.surfaces.split-pane.hover-splitter';\nimport { TopBar } from '@teambit/ui-foundation.ui.top-bar';\nimport classNames from 'classnames';\n\nimport { useWorkspace } from './use-workspace';\nimport { WorkspaceOverview } from './workspace-overview';\nimport { WorkspaceProvider } from './workspace-provider';\nimport styles from './workspace.module.scss';\nimport WorkspaceUI from '../../workspace.ui.runtime';\n\nexport type WorkspaceProps = {\n routeSlot: RouteSlot;\n menuSlot: RouteSlot;\n sidebar: JSX.Element;\n workspaceUI: WorkspaceUI;\n onSidebarTogglerChange: (callback: () => void) => void;\n};\n\n/**\n * main workspace component.\n */\nexport function Workspace({ routeSlot, menuSlot, sidebar, workspaceUI, onSidebarTogglerChange }: WorkspaceProps) {\n const reactions = useComponentNotifications();\n const { workspace } = useWorkspace(reactions);\n\n const [isSidebarOpen, handleSidebarToggle] = useReducer((x) => !x, true);\n const sidebarOpenness = isSidebarOpen ? Layout.row : Layout.right;\n\n onSidebarTogglerChange(handleSidebarToggle);\n\n if (!workspace) {\n return <div className={styles.emptyContainer}></div>;\n }\n\n workspaceUI.setComponents(workspace.components);\n\n return (\n <WorkspaceProvider workspace={workspace}>\n <div className={styles.workspaceWrapper}>\n <TopBar\n className={styles.topbar}\n Corner={() => <Corner className={styles.corner} name={workspace.name} icon={workspace.icon} />}\n menu={menuSlot}\n />\n\n <SplitPane className={styles.main} size={264} layout={sidebarOpenness}>\n <Pane className={classNames(styles.sidebar, !isSidebarOpen && styles.closed)}>{sidebar}</Pane>\n <HoverSplitter className={styles.splitter}>\n <Collapser\n isOpen={isSidebarOpen}\n onMouseDown={(e) => e.stopPropagation()} // avoid split-pane drag\n onClick={handleSidebarToggle}\n tooltipContent={`${isSidebarOpen ? 'Hide' : 'Show'} side panel`}\n />\n </HoverSplitter>\n <Pane>\n <SlotRouter slot={routeSlot}>\n <Route index element={<WorkspaceOverview />} />\n </SlotRouter>\n </Pane>\n </SplitPane>\n </div>\n </WorkspaceProvider>\n );\n}\nfunction useComponentNotifications() {\n const notifications = useNotifications();\n\n // memo not really needed, but for peace of mind\n return useMemo(\n () => ({\n onComponentAdded: (comps: ComponentModel[]) => {\n const notificationId = notifications.log(\n `added ${pluralize('component', comps.length)}: ${comps.map((comp) => comp.id.toString()).join(', ')}`\n );\n setTimeout(() => notifications.dismiss(notificationId), 12 * 1000);\n },\n\n onComponentRemoved: (ids: ComponentID[]) => {\n const notificationId = notifications.log(\n `removed ${pluralize('component', ids.length)} ${ids.map((id) => id.toString()).join(', ')}`\n );\n setTimeout(() => notifications.dismiss(notificationId), 12 * 1000);\n },\n }),\n [notifications]\n );\n}\n"],"mappings":";;;;;;;;AAAAA,OAAA;AACA,SAAAC,WAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAH,OAAA;EAAAC,UAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,OAAA;EAAA,MAAAF,IAAA,GAAAG,uBAAA,CAAAL,OAAA;EAAAI,MAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,gBAAA;EAAA,MAAAJ,IAAA,GAAAF,OAAA;EAAAM,eAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAK,6BAAA;EAAA,MAAAL,IAAA,GAAAF,OAAA;EAAAO,4BAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,2BAAA;EAAA,MAAAN,IAAA,GAAAF,OAAA;EA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C;AAExB;AACA,SAAS/C,yBAAyBA,CAAA,EAAG;EACnC,MAAMgD,aAAa,GAAG,IAAAC,+CAAgB,EAAC,CAAC;;EAExC;EACA,OAAO,IAAAC,gBAAO,EACZ,OAAO;IACLC,gBAAgB,EAAGC,KAAuB,IAAK;MAC7C,MAAMC,cAAc,GAAGL,aAAa,CAACM,GAAG,CACrC,SAAQ,IAAAC,oBAAS,EAAC,WAAW,EAAEH,KAAK,CAACI,MAAM,CAAE,KAAIJ,KAAK,CAACK,GAAG,CAAEC,IAAI,IAAKA,IAAI,CAACC,EAAE,CAACC,QAAQ,CAAC,CAAC,CAAC,CAACC,IAAI,CAAC,IAAI,CAAE,EACvG,CAAC;MACDC,UAAU,CAAC,MAAMd,aAAa,CAACe,OAAO,CAACV,cAAc,CAAC,EAAE,EAAE,GAAG,IAAI,CAAC;IACpE,CAAC;IAEDW,kBAAkB,EAAGC,GAAkB,IAAK;MAC1C,MAAMZ,cAAc,GAAGL,aAAa,CAACM,GAAG,CACrC,WAAU,IAAAC,oBAAS,EAAC,WAAW,EAAEU,GAAG,CAACT,MAAM,CAAE,IAAGS,GAAG,CAACR,GAAG,CAAEE,EAAE,IAAKA,EAAE,CAACC,QAAQ,CAAC,CAAC,CAAC,CAACC,IAAI,CAAC,IAAI,CAAE,EAC7F,CAAC;MACDC,UAAU,CAAC,MAAMd,aAAa,CAACe,OAAO,CAACV,cAAc,CAAC,EAAE,EAAE,GAAG,IAAI,CAAC;IACpE;EACF,CAAC,CAAC,EACF,CAACL,aAAa,CAChB,CAAC;AACH"}
|
|
@@ -657,7 +657,7 @@ needed-for: ${neededFor || '<unknown>'}. using opts: ${JSON.stringify(mergedOpts
|
|
|
657
657
|
*/
|
|
658
658
|
async importAndGetAspects(componentIds) {
|
|
659
659
|
try {
|
|
660
|
-
return await this.workspace.importAndGetMany(componentIds);
|
|
660
|
+
return await this.workspace.importAndGetMany(componentIds, 'to load aspects from the workspace');
|
|
661
661
|
} catch (err) {
|
|
662
662
|
if (err instanceof _exceptions().ComponentNotFound) {
|
|
663
663
|
var _config$workspaceConf2;
|