@teambit/workspace 0.0.737 → 0.0.740
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.map +1 -1
- package/dist/build-graph-from-fs.js.map +1 -1
- package/dist/capsule.cmd.js.map +1 -1
- package/dist/component-config-file/component-config-file.js.map +1 -1
- package/dist/component-config-file/exceptions/already-exists.js.map +1 -1
- package/dist/component-config-file/exceptions/index.js.map +1 -1
- package/dist/component-config-file/index.js.map +1 -1
- package/dist/component-tree.widget.js.map +1 -1
- package/dist/constants.js.map +1 -1
- package/dist/eject-conf.cmd.js.map +1 -1
- package/dist/envs-subcommands/envs-replace.cmd.js.map +1 -1
- package/dist/envs-subcommands/envs-set.cmd.js.map +1 -1
- package/dist/envs-subcommands/envs-unset.cmd.js.map +1 -1
- package/dist/events/index.js.map +1 -1
- package/dist/events/on-component-add-event.js.map +1 -1
- package/dist/events/on-component-change-event.js.map +1 -1
- package/dist/events/on-component-removed-event.js.map +1 -1
- package/dist/exceptions/dependency-type-not-supported-in-policy.js.map +1 -1
- package/dist/exceptions/incorrect-env-aspect.js.map +1 -1
- package/dist/exceptions/index.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/install.cmd.js.map +1 -1
- package/dist/link/component-list-links.js.map +1 -1
- package/dist/link/core-aspects-links.js.map +1 -1
- package/dist/link/get-package-name-from-target.js.map +1 -1
- package/dist/link/index.js.map +1 -1
- package/dist/link/link-row.js.map +1 -1
- package/dist/link/link-to-dir.js.map +1 -1
- package/dist/link/link.cmd.js.map +1 -1
- package/dist/link/nested-deps-in-nm-links.js.map +1 -1
- package/dist/link/rewire-row.js.map +1 -1
- package/dist/list.cmd.js.map +1 -1
- package/dist/on-component-events.js.map +1 -1
- package/dist/pattern.cmd.js.map +1 -1
- package/dist/pick-outdated-pkgs.js.map +1 -1
- package/dist/pick-outdated-pkgs.spec.js.map +1 -1
- package/dist/scope-subcommands/scope-set.cmd.js.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/workspace/default-component.js.map +1 -1
- package/dist/ui/workspace/index.js.map +1 -1
- package/dist/ui/workspace/use-workspace.js.map +1 -1
- package/dist/ui/workspace/workspace-context.js.map +1 -1
- package/dist/ui/workspace/workspace-model.js.map +1 -1
- package/dist/ui/workspace/workspace-overview/index.js.map +1 -1
- package/dist/ui/workspace/workspace-overview/workspace-overview.js.map +1 -1
- package/dist/ui/workspace/workspace-provider.js.map +1 -1
- package/dist/ui/workspace/workspace.js.map +1 -1
- package/dist/uninstall.cmd.js.map +1 -1
- package/dist/update.cmd.js.map +1 -1
- package/dist/watch/check-types.js.map +1 -1
- package/dist/watch/output-formatter.js.map +1 -1
- package/dist/watch/watch.cmd.js.map +1 -1
- package/dist/watch/watcher.js.map +1 -1
- package/dist/workspace-component/component-status.js.map +1 -1
- package/dist/workspace-component/index.js.map +1 -1
- package/dist/workspace-component/workspace-component-loader.js.map +1 -1
- package/dist/workspace-component/workspace-component.js.map +1 -1
- package/dist/workspace-section.js.map +1 -1
- package/dist/workspace.aspect.js.map +1 -1
- package/dist/workspace.composition.js.map +1 -1
- package/dist/workspace.d.ts +4 -0
- package/dist/workspace.graphql.js.map +1 -1
- package/dist/workspace.js +36 -10
- package/dist/workspace.js.map +1 -1
- package/dist/workspace.main.runtime.js.map +1 -1
- package/dist/workspace.provider.js.map +1 -1
- package/dist/workspace.ui-root.js.map +1 -1
- package/dist/workspace.ui.drawer.js.map +1 -1
- package/dist/workspace.ui.runtime.js.map +1 -1
- package/package-tar/teambit-workspace-0.0.740.tgz +0 -0
- package/package.json +31 -31
- package/{preview-1652930732694.js → preview-1653449228788.js} +2 -2
- package/package-tar/teambit-workspace-0.0.737.tgz +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["workspace-component-loader.ts"],"names":["WorkspaceComponentLoader","constructor","workspace","logger","dependencyResolver","envs","componentsCache","maxSize","componentsCacheForCapsule","getMany","ids","forCapsule","idsWithoutEmpty","errors","longProcessLogger","createLongProcessLogger","length","componentsP","id","logProgress","toString","get","catch","err","isComponentNotExistsError","push","undefined","components","forEach","consumer","isLegacy","console","warn","filteredComponents","end","getInvalid","loadComponent","_legacy","ConsumerComponent","isComponentInvalidByErrorType","componentId","legacyComponent","useCache","storeInCache","bitIdWithVersion","bitmapIdsFromCurrentLane","version","changeVersion","fromCache","getFromCache","consumerComponent","getConsumerComponent","updatedId","ComponentID","fromLegacy","scope","component","loadOne","addMultipleEnvsIssueIfNeeded","saveInCache","getIfExist","getAllEnvsConfiguredOnComponent","envIds","map","env","state","issues","getOrCreate","IssuesClasses","MultipleEnvs","data","clearCache","deleteAll","clearComponentCache","idStr","delete","componentFromScope","MissingBitMapComponent","extensions","componentExtensions","extensionsFromConsumerComponent","ExtensionDataList","extensionDataList","mergeConfigs","filterRemovedExtensions","State","Config","mainFile","createAspectList","ComponentFS","fromVinyls","files","dependencies","workspaceComponent","WorkspaceComponent","head","tags","executeLoadSlot","newComponentFromState","set","isEqual","loadComponentForCapsule","debug","name","message","ComponentNotFound","ComponentNotFoundInPath","entries","onComponentLoadSlot","toArray","promises","extension","onLoad","upsertExtensionData","envsData","getEnvSystemDescriptor","policy","mergeVariantPolicies","config","extractDepsFromLegacy","depResolverData","serialize","EnvsAspect","DependencyResolverAspect","Promise","all","updatedAspectList","aspects","TagMap","existingExtension","findExtension","Object","assign","getDataEntry","ExtensionDataEntry"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;A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AAO,KAAIgE,4BAAJ,EAAuB5G,SAAvB,EAAkCA,SAAlC,EAA6CqF,SAA7C,EAAwDrF,SAAxD,EAAmE4C,IAAnE,CAAP;AACD;;AAzQmC","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, 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 { Workspace } from '../workspace';\nimport { WorkspaceComponent } from './workspace-component';\n\nexport class WorkspaceComponentLoader {\n private componentsCache: InMemoryCache<Component>; // cache loaded components\n private componentsCacheForCapsule: InMemoryCache<Component>; // cache loaded components for capsule, must not use the cache for the workspace\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 this.componentsCacheForCapsule = createInMemoryCache({ maxSize: getMaxSizeForComponents() });\n }\n\n async getMany(ids: Array<ComponentID>, forCapsule = false): 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, forCapsule).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 if (!this.workspace.consumer.isLegacy) {\n this.logger.console(`failed loading component ${err.id.toString()}, see full error in debug.log file`);\n }\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 forCapsule = false,\n legacyComponent?: ConsumerComponent,\n useCache = true,\n storeInCache = true\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, forCapsule);\n if (fromCache && useCache) {\n return fromCache;\n }\n const consumerComponent = legacyComponent || (await this.getConsumerComponent(id, forCapsule));\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);\n if (storeInCache) {\n this.addMultipleEnvsIssueIfNeeded(component); // it's in storeInCache block, otherwise, it wasn't fully loaded\n this.saveInCache(component, forCapsule);\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 this.componentsCacheForCapsule.deleteAll();\n }\n clearComponentCache(id: ComponentID) {\n const idStr = id.toString();\n this.componentsCache.delete(idStr);\n this.componentsCacheForCapsule.delete(idStr);\n }\n\n private async loadOne(id: ComponentID, consumerComponent?: ConsumerComponent) {\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);\n }\n return this.executeLoadSlot(this.newComponentFromState(id, state));\n }\n\n private saveInCache(component: Component, forCapsule: boolean): void {\n if (forCapsule) {\n this.componentsCacheForCapsule.set(component.id.toString(), component);\n } else {\n this.componentsCache.set(component.id.toString(), component);\n }\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, forCapsule: boolean): Component | undefined {\n const fromCache = forCapsule\n ? this.componentsCacheForCapsule.get(id.toString())\n : this.componentsCache.get(id.toString());\n if (fromCache && fromCache.id._legacy.isEqual(id._legacy)) {\n return fromCache;\n }\n return undefined;\n }\n\n private async getConsumerComponent(id: ComponentID, forCapsule = false): Promise<ConsumerComponent | undefined> {\n try {\n return forCapsule\n ? // eslint-disable-next-line @typescript-eslint/return-await\n await this.workspace.consumer.loadComponentForCapsule(id._legacy)\n : // eslint-disable-next-line @typescript-eslint/return-await\n 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) {\n const entries = this.workspace.onComponentLoadSlot.toArray();\n const promises = entries.map(async ([extension, onLoad]) => {\n const data = await onLoad(component);\n return this.upsertExtensionData(component, extension, data);\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 promises.push(this.upsertExtensionData(component, EnvsAspect.id, envsData));\n promises.push(this.upsertExtensionData(component, DependencyResolverAspect.id, depResolverData));\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"]}
|
|
1
|
+
{"version":3,"names":["WorkspaceComponentLoader","constructor","workspace","logger","dependencyResolver","envs","componentsCache","createInMemoryCache","maxSize","getMaxSizeForComponents","componentsCacheForCapsule","getMany","ids","forCapsule","idsWithoutEmpty","compact","errors","longProcessLogger","createLongProcessLogger","length","componentsP","mapSeries","id","logProgress","toString","get","catch","err","isComponentNotExistsError","push","undefined","components","forEach","consumer","isLegacy","console","warn","filteredComponents","end","getInvalid","loadComponent","_legacy","ConsumerComponent","isComponentInvalidByErrorType","componentId","legacyComponent","useCache","storeInCache","bitIdWithVersion","getLatestVersionNumber","bitmapIdsFromCurrentLane","version","changeVersion","fromCache","getFromCache","consumerComponent","getConsumerComponent","updatedId","ComponentID","fromLegacy","scope","component","loadOne","addMultipleEnvsIssueIfNeeded","saveInCache","getIfExist","getAllEnvsConfiguredOnComponent","envIds","uniq","map","env","state","issues","getOrCreate","IssuesClasses","MultipleEnvs","data","clearCache","deleteAll","clearComponentCache","idStr","delete","componentFromScope","MissingBitMapComponent","extensions","componentExtensions","extensionsFromConsumerComponent","ExtensionDataList","extensionDataList","mergeConfigs","filterRemovedExtensions","State","Config","mainFile","createAspectList","ComponentFS","fromVinyls","files","dependencies","workspaceComponent","WorkspaceComponent","head","tags","executeLoadSlot","newComponentFromState","set","isEqual","loadComponentForCapsule","debug","name","message","ComponentNotFound","ComponentNotFoundInPath","entries","onComponentLoadSlot","toArray","promises","extension","onLoad","upsertExtensionData","envsData","getEnvSystemDescriptor","policy","mergeVariantPolicies","config","extractDepsFromLegacy","depResolverData","serialize","EnvsAspect","DependencyResolverAspect","Promise","all","updatedAspectList","aspects","TagMap","existingExtension","findExtension","Object","assign","getDataEntry","ExtensionDataEntry"],"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, 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 { Workspace } from '../workspace';\nimport { WorkspaceComponent } from './workspace-component';\n\nexport class WorkspaceComponentLoader {\n private componentsCache: InMemoryCache<Component>; // cache loaded components\n private componentsCacheForCapsule: InMemoryCache<Component>; // cache loaded components for capsule, must not use the cache for the workspace\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 this.componentsCacheForCapsule = createInMemoryCache({ maxSize: getMaxSizeForComponents() });\n }\n\n async getMany(ids: Array<ComponentID>, forCapsule = false): 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, forCapsule).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 if (!this.workspace.consumer.isLegacy) {\n this.logger.console(`failed loading component ${err.id.toString()}, see full error in debug.log file`);\n }\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 forCapsule = false,\n legacyComponent?: ConsumerComponent,\n useCache = true,\n storeInCache = true\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, forCapsule);\n if (fromCache && useCache) {\n return fromCache;\n }\n const consumerComponent = legacyComponent || (await this.getConsumerComponent(id, forCapsule));\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);\n if (storeInCache) {\n this.addMultipleEnvsIssueIfNeeded(component); // it's in storeInCache block, otherwise, it wasn't fully loaded\n this.saveInCache(component, forCapsule);\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 this.componentsCacheForCapsule.deleteAll();\n }\n clearComponentCache(id: ComponentID) {\n const idStr = id.toString();\n this.componentsCache.delete(idStr);\n this.componentsCacheForCapsule.delete(idStr);\n }\n\n private async loadOne(id: ComponentID, consumerComponent?: ConsumerComponent) {\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);\n }\n return this.executeLoadSlot(this.newComponentFromState(id, state));\n }\n\n private saveInCache(component: Component, forCapsule: boolean): void {\n if (forCapsule) {\n this.componentsCacheForCapsule.set(component.id.toString(), component);\n } else {\n this.componentsCache.set(component.id.toString(), component);\n }\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, forCapsule: boolean): Component | undefined {\n const fromCache = forCapsule\n ? this.componentsCacheForCapsule.get(id.toString())\n : this.componentsCache.get(id.toString());\n if (fromCache && fromCache.id._legacy.isEqual(id._legacy)) {\n return fromCache;\n }\n return undefined;\n }\n\n private async getConsumerComponent(id: ComponentID, forCapsule = false): Promise<ConsumerComponent | undefined> {\n try {\n return forCapsule\n ? // eslint-disable-next-line @typescript-eslint/return-await\n await this.workspace.consumer.loadComponentForCapsule(id._legacy)\n : // eslint-disable-next-line @typescript-eslint/return-await\n 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) {\n const entries = this.workspace.onComponentLoadSlot.toArray();\n const promises = entries.map(async ([extension, onLoad]) => {\n const data = await onLoad(component);\n return this.upsertExtensionData(component, extension, data);\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 promises.push(this.upsertExtensionData(component, EnvsAspect.id, envsData));\n promises.push(this.upsertExtensionData(component, DependencyResolverAspect.id, depResolverData));\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"],"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;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEO,MAAMA,wBAAN,CAA+B;EACe;EACU;EAC7DC,WAAW,CACDC,SADC,EAEDC,MAFC,EAGDC,kBAHC,EAIDC,IAJC,EAKT;IAAA,KAJ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uB9E,EAAvB,EAA2B,IAA3B,EAAiCiD,KAAjC,EAAwC,KAAI+D,mBAAJ,GAAxC,EAAsD,KAAKpI,SAA3D,CAAP;EACD;;EAEgC,MAAnBqH,mBAAmB,CAAC1D,SAAD,EAAuBwD,SAAvB,EAA0CzC,IAA1C,EAAqD;IACpF,MAAM2D,iBAAiB,GAAG1E,SAAS,CAACU,KAAV,CAAgBqD,MAAhB,CAAuBxC,UAAvB,CAAkCoD,aAAlC,CAAgDnB,SAAhD,CAA1B;;IACA,IAAIkB,iBAAiB,IAAI3D,IAAzB,EAA+B;MAC7B;MACA6D,MAAM,CAACC,MAAP,CAAcH,iBAAiB,CAAC3D,IAAhC,EAAsCA,IAAtC;MACA;IACD;;IACDf,SAAS,CAACU,KAAV,CAAgBqD,MAAhB,CAAuBxC,UAAvB,CAAkCvD,IAAlC,CAAuC,MAAM,KAAK8G,YAAL,CAAkBtB,SAAlB,EAA6BzC,IAA7B,CAA7C;EACD;;EAEyB,MAAZ+D,YAAY,CAACtB,SAAD,EAAoBzC,IAApB,EAA+E;IACvG;IACA,OAAO,KAAIgE,4BAAJ,EAAuB9G,SAAvB,EAAkCA,SAAlC,EAA6CuF,SAA7C,EAAwDvF,SAAxD,EAAmE8C,IAAnE,CAAP;EACD;;AAzQmC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["WorkspaceComponent","Component","constructor","id","head","workspaceState","tags","TagMap","workspace","getStatus","getComponentStatus","getIssues","getComponentIssues","fromComponent","component","state"],"sources":["workspace-component.ts"],"sourcesContent":["import { Component, ComponentID, Snap, State, TagMap } from '@teambit/component';\nimport { IssuesList } from '@teambit/component-issues';\nimport { Workspace } from '../workspace';\nimport { ComponentStatus } from './component-status';\n\n// TODO: refactor this to a composition rather than to use inheritance\nexport class WorkspaceComponent extends Component {\n constructor(\n /**\n * component ID represented by the `ComponentId` type.\n */\n readonly id: ComponentID,\n\n /**\n * head version of the component. can be `null` for new components.\n */\n readonly head: Snap | null = null,\n\n /**\n * state of the component.\n */\n workspaceState: State,\n\n /**\n * tags of the component.\n */\n readonly tags: TagMap = new TagMap(),\n\n /**\n * workspace extension.\n */\n readonly workspace: Workspace\n ) {\n super(id, head, workspaceState, tags, workspace);\n }\n\n async getStatus(): Promise<ComponentStatus> {\n return this.workspace.getComponentStatus(this);\n }\n\n /**\n * get all issues reported on the component.\n */\n getIssues(): IssuesList | null {\n return this.workspace.getComponentIssues(this);\n }\n\n static fromComponent(component: Component, workspace: Workspace) {\n return new WorkspaceComponent(component.id, component.head, component.state, component.tags, workspace);\n }\n}\n"],"mappings":";;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAKA;AACO,MAAMA,kBAAN,SAAiCC,sBAAjC,CAA2C;EAChDC,WAAW;EACT;AACJ;AACA;EACaC,EAJA;EAMT;AACJ;AACA;EACaC,IAAiB,GAAG,IATpB;EAWT;AACJ;AACA;EACIC,cAdS;EAgBT;AACJ;AACA;EACaC,IAAY,GAAG,KAAIC,mBAAJ,GAnBf;EAqBT;AACJ;AACA;EACaC,SAxBA,EAyBT;IACA,MAAML,EAAN,EAAUC,IAAV,EAAgBC,cAAhB,EAAgCC,IAAhC,EAAsCE,SAAtC;IADA,KArBSL,EAqBT,GArBSA,EAqBT;IAAA,KAhBSC,IAgBT,GAhBSA,IAgBT;IAAA,KANSE,IAMT,GANSA,IAMT;IAAA,KADSE,SACT,GADSA,SACT;EAED;;EAEc,MAATC,SAAS,GAA6B;IAC1C,OAAO,KAAKD,SAAL,CAAeE,kBAAf,CAAkC,IAAlC,CAAP;EACD;EAED;AACF;AACA;;;EACEC,SAAS,GAAsB;IAC7B,OAAO,KAAKH,SAAL,CAAeI,kBAAf,CAAkC,IAAlC,CAAP;EACD;;EAEmB,OAAbC,aAAa,CAACC,SAAD,EAAuBN,SAAvB,EAA6C;IAC/D,OAAO,IAAIR,kBAAJ,CAAuBc,SAAS,CAACX,EAAjC,EAAqCW,SAAS,CAACV,IAA/C,EAAqDU,SAAS,CAACC,KAA/D,EAAsED,SAAS,CAACR,IAAhF,EAAsFE,SAAtF,CAAP;EACD;;AA3C+C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["workspace-section.ts"],"
|
|
1
|
+
{"version":3,"names":[],"sources":["workspace-section.ts"],"sourcesContent":["// export class WorkspaceSection {\n// constructor(\n// readonly route: string\n// ) {}\n\n// toRoute() {\n// return {\n// path: this.toRoute\n// children:\n// };\n// }\n// };\n\n// export interface WorkspaceSection {}\n"],"mappings":"AAAA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["WorkspaceAspect","Aspect","create","id","dependencies","defaultConfig"],"sources":["workspace.aspect.ts"],"sourcesContent":["import { Aspect } from '@teambit/harmony';\n\nexport const WorkspaceAspect = Aspect.create({\n id: 'teambit.workspace/workspace',\n dependencies: [],\n defaultConfig: {},\n});\n\nexport default WorkspaceAspect;\n"],"mappings":";;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEO,MAAMA,eAAe,GAAGC,iBAAA,CAAOC,MAAP,CAAc;EAC3CC,EAAE,EAAE,6BADuC;EAE3CC,YAAY,EAAE,EAF6B;EAG3CC,aAAa,EAAE;AAH4B,CAAd,CAAxB;;;eAMQL,e"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["Logo","height","display","justifyContent","width"],"sources":["workspace.composition.tsx"],"sourcesContent":["import React from 'react';\n\nexport const Logo = () => (\n <div style={{ height: '100%', display: 'flex', justifyContent: 'center' }}>\n <img style={{ width: 70 }} src=\"https://static.bit.dev/extensions-icons/workspace.svg\" />\n </div>\n);\n"],"mappings":";;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEO,MAAMA,IAAI,GAAG,mBAClB;EAAK,KAAK,EAAE;IAAEC,MAAM,EAAE,MAAV;IAAkBC,OAAO,EAAE,MAA3B;IAAmCC,cAAc,EAAE;EAAnD;AAAZ,gBACE;EAAK,KAAK,EAAE;IAAEC,KAAK,EAAE;EAAT,CAAZ;EAA2B,GAAG,EAAC;AAA/B,EADF,CADK"}
|
package/dist/workspace.d.ts
CHANGED
|
@@ -448,6 +448,10 @@ export declare class Workspace implements ComponentFactory {
|
|
|
448
448
|
private _saveManyComponentConfigFiles;
|
|
449
449
|
private _installModules;
|
|
450
450
|
link(options?: WorkspaceLinkOptions): Promise<LinkResults>;
|
|
451
|
+
/**
|
|
452
|
+
* @param componentPath can be relative or absolute. supports Linux and Windows
|
|
453
|
+
*/
|
|
454
|
+
getComponentIdByPath(componentPath: PathOsBased): Promise<ComponentID | undefined>;
|
|
451
455
|
/**
|
|
452
456
|
* Generate a filter to pass to the installer
|
|
453
457
|
* This will filter deps which are come from remotes which defined in scope.json
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["workspace","graphql","typeDefs","gql","resolvers","Subscription","componentAdded","subscribe","pubsub","asyncIterator","ComponentAdded","componentChanged","ComponentChanged","componentRemoved","ComponentRemoved","Component","status","wsComponent","getStatus","issuesCount","getIssues","count","issues","toObjectWithDataAsString","Workspace","path","ws","name","icon","components","offset","limit","list","getComponent","id","componentID","resolveComponentId","component","get","error","Query"],"sources":["workspace.graphql.ts"],"sourcesContent":["import { GraphqlMain } from '@teambit/graphql';\nimport gql from 'graphql-tag';\n\nimport { ComponentAdded, ComponentChanged, ComponentRemoved, Workspace } from './workspace';\nimport { WorkspaceComponent } from './workspace-component';\n\nexport default (workspace: Workspace, graphql: GraphqlMain) => {\n return {\n typeDefs: gql`\n type ModifyInfo {\n # is the component modified.\n hasModifiedFiles: Boolean\n\n # the component has Modified Dependencies\n hasModifiedDependencies: Boolean\n }\n\n type ComponentStatus {\n # component is pending to be tagged automatically.\n modifyInfo: ModifyInfo\n\n # is the new component new.\n isNew: Boolean\n\n # is the component deleted from the workspace.\n isDeleted: Boolean\n\n # is the component staged.\n isStaged: Boolean\n\n # does the component exists in the workspace.\n isInWorkspace: Boolean\n\n # does the component exists in the scope.\n isInScope: Boolean\n\n # does the component is outdated (pending for update).\n isOutdated: Boolean\n }\n\n extend type Component {\n status: ComponentStatus\n }\n\n type Issue {\n type: String!\n description: String!\n solution: String\n data: String\n }\n\n extend type Component {\n # the count of errors in component in workspace\n issuesCount: Int\n issues: [Issue]\n }\n\n type Workspace {\n name: String\n path: String\n icon: String\n components(offset: Int, limit: Int): [Component]\n getComponent(id: String!): Component\n }\n\n type Subscription {\n componentAdded: ComponentAdded\n componentChanged: ComponentChanged\n componentRemoved: ComponentRemoved\n }\n\n type ComponentAdded {\n component: Component\n }\n\n type ComponentChanged {\n component: Component\n }\n\n type ComponentRemoved {\n componentIds: [ComponentID]\n }\n\n type Query {\n workspace: Workspace\n }\n `,\n resolvers: {\n Subscription: {\n componentAdded: {\n subscribe: () => graphql.pubsub.asyncIterator(ComponentAdded),\n },\n componentChanged: {\n subscribe: () => graphql.pubsub.asyncIterator(ComponentChanged),\n },\n componentRemoved: {\n subscribe: () => graphql.pubsub.asyncIterator(ComponentRemoved),\n },\n },\n Component: {\n status: async (wsComponent: WorkspaceComponent) => {\n return wsComponent.getStatus();\n },\n issuesCount: (wsComponent: WorkspaceComponent): number => {\n return wsComponent.getIssues()?.count || 0;\n },\n issues: (wsComponent: WorkspaceComponent) => {\n return wsComponent.getIssues()?.toObjectWithDataAsString();\n },\n },\n Workspace: {\n path: (ws) => ws.path,\n name: (ws) => ws.name,\n icon: (ws) => ws.icon,\n components: async (ws: Workspace, { offset, limit }: { offset: number; limit: number }) => {\n return ws.list({ offset, limit });\n },\n getComponent: async (ws: Workspace, { id }: { id: string }) => {\n try {\n const componentID = await ws.resolveComponentId(id);\n const component = await ws.get(componentID);\n return component;\n } catch (error: any) {\n return null;\n }\n },\n },\n Query: {\n workspace: () => workspace,\n },\n },\n };\n};\n"],"mappings":";;;;;;;;;;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;eAGe,CAACA,SAAD,EAAuBC,OAAvB,KAAgD;EAC7D,OAAO;IACLC,QAAQ,EAAE,IAAAC,qBAAA,CAAI;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KA/ES;IAgFLC,SAAS,EAAE;MACTC,YAAY,EAAE;QACZC,cAAc,EAAE;UACdC,SAAS,EAAE,MAAMN,OAAO,CAACO,MAAR,CAAeC,aAAf,CAA6BC,2BAA7B;QADH,CADJ;QAIZC,gBAAgB,EAAE;UAChBJ,SAAS,EAAE,MAAMN,OAAO,CAACO,MAAR,CAAeC,aAAf,CAA6BG,6BAA7B;QADD,CAJN;QAOZC,gBAAgB,EAAE;UAChBN,SAAS,EAAE,MAAMN,OAAO,CAACO,MAAR,CAAeC,aAAf,CAA6BK,6BAA7B;QADD;MAPN,CADL;MAYTC,SAAS,EAAE;QACTC,MAAM,EAAE,MAAOC,WAAP,IAA2C;UACjD,OAAOA,WAAW,CAACC,SAAZ,EAAP;QACD,CAHQ;QAITC,WAAW,EAAGF,WAAD,IAA6C;UAAA;;UACxD,OAAO,0BAAAA,WAAW,CAACG,SAAZ,kFAAyBC,KAAzB,KAAkC,CAAzC;QACD,CANQ;QAOTC,MAAM,EAAGL,WAAD,IAAqC;UAAA;;UAC3C,iCAAOA,WAAW,CAACG,SAAZ,EAAP,2DAAO,uBAAyBG,wBAAzB,EAAP;QACD;MATQ,CAZF;MAuBTC,SAAS,EAAE;QACTC,IAAI,EAAGC,EAAD,IAAQA,EAAE,CAACD,IADR;QAETE,IAAI,EAAGD,EAAD,IAAQA,EAAE,CAACC,IAFR;QAGTC,IAAI,EAAGF,EAAD,IAAQA,EAAE,CAACE,IAHR;QAITC,UAAU,EAAE,OAAOH,EAAP,EAAsB;UAAEI,MAAF;UAAUC;QAAV,CAAtB,KAA+E;UACzF,OAAOL,EAAE,CAACM,IAAH,CAAQ;YAAEF,MAAF;YAAUC;UAAV,CAAR,CAAP;QACD,CANQ;QAOTE,YAAY,EAAE,OAAOP,EAAP,EAAsB;UAAEQ;QAAF,CAAtB,KAAiD;UAC7D,IAAI;YACF,MAAMC,WAAW,GAAG,MAAMT,EAAE,CAACU,kBAAH,CAAsBF,EAAtB,CAA1B;YACA,MAAMG,SAAS,GAAG,MAAMX,EAAE,CAACY,GAAH,CAAOH,WAAP,CAAxB;YACA,OAAOE,SAAP;UACD,CAJD,CAIE,OAAOE,KAAP,EAAmB;YACnB,OAAO,IAAP;UACD;QACF;MAfQ,CAvBF;MAwCTC,KAAK,EAAE;QACLxC,SAAS,EAAE,MAAMA;MADZ;IAxCE;EAhFN,CAAP;AA6HD,C"}
|
package/dist/workspace.js
CHANGED
|
@@ -331,6 +331,16 @@ function _componentIdToPackageName() {
|
|
|
331
331
|
return data;
|
|
332
332
|
}
|
|
333
333
|
|
|
334
|
+
function _path() {
|
|
335
|
+
const data = require("@teambit/legacy/dist/utils/path");
|
|
336
|
+
|
|
337
|
+
_path = function () {
|
|
338
|
+
return data;
|
|
339
|
+
};
|
|
340
|
+
|
|
341
|
+
return data;
|
|
342
|
+
}
|
|
343
|
+
|
|
334
344
|
function _fsExtra() {
|
|
335
345
|
const data = _interopRequireDefault(require("fs-extra"));
|
|
336
346
|
|
|
@@ -351,10 +361,10 @@ function _lodash() {
|
|
|
351
361
|
return data;
|
|
352
362
|
}
|
|
353
363
|
|
|
354
|
-
function
|
|
364
|
+
function _path2() {
|
|
355
365
|
const data = _interopRequireDefault(require("path"));
|
|
356
366
|
|
|
357
|
-
|
|
367
|
+
_path2 = function () {
|
|
358
368
|
return data;
|
|
359
369
|
};
|
|
360
370
|
|
|
@@ -627,7 +637,7 @@ class Workspace {
|
|
|
627
637
|
|
|
628
638
|
|
|
629
639
|
get modulesPath() {
|
|
630
|
-
return
|
|
640
|
+
return _path2().default.join(this.path, 'node_modules');
|
|
631
641
|
}
|
|
632
642
|
|
|
633
643
|
get isLegacy() {
|
|
@@ -1298,7 +1308,7 @@ the following envs are used in this workspace: ${availableEnvs.join(', ')}`);
|
|
|
1298
1308
|
|
|
1299
1309
|
async write(component, rootPath) {
|
|
1300
1310
|
await Promise.all(component.filesystem.files.map(async file => {
|
|
1301
|
-
const pathToWrite = rootPath ?
|
|
1311
|
+
const pathToWrite = rootPath ? _path2().default.join(this.path, rootPath, file.relative) : file.path;
|
|
1302
1312
|
await _fsExtra().default.outputFile(pathToWrite, file.contents);
|
|
1303
1313
|
}));
|
|
1304
1314
|
}
|
|
@@ -1327,7 +1337,7 @@ the following envs are used in this workspace: ${availableEnvs.join(', ')}`);
|
|
|
1327
1337
|
}) {
|
|
1328
1338
|
const packageName = (0, _componentIdToPackageName().default)(component.state._consumer);
|
|
1329
1339
|
|
|
1330
|
-
const packageDir =
|
|
1340
|
+
const packageDir = _path2().default.join('node_modules', packageName);
|
|
1331
1341
|
|
|
1332
1342
|
return options.relative ? packageDir : this.consumer.toAbsolutePath(packageDir);
|
|
1333
1343
|
}
|
|
@@ -1346,11 +1356,11 @@ the following envs are used in this workspace: ${availableEnvs.join(', ')}`);
|
|
|
1346
1356
|
return relativeComponentDir;
|
|
1347
1357
|
}
|
|
1348
1358
|
|
|
1349
|
-
return
|
|
1359
|
+
return _path2().default.join(this.path, relativeComponentDir);
|
|
1350
1360
|
}
|
|
1351
1361
|
|
|
1352
1362
|
componentDirToAbsolute(relativeComponentDir) {
|
|
1353
|
-
return
|
|
1363
|
+
return _path2().default.join(this.path, relativeComponentDir);
|
|
1354
1364
|
}
|
|
1355
1365
|
|
|
1356
1366
|
async componentDefaultScope(componentId) {
|
|
@@ -1636,7 +1646,7 @@ the following envs are used in this workspace: ${availableEnvs.join(', ')}`);
|
|
|
1636
1646
|
ignoreVersion: true
|
|
1637
1647
|
});
|
|
1638
1648
|
await ((_config$workspaceConf2 = config.workspaceConfig) === null || _config$workspaceConf2 === void 0 ? void 0 : _config$workspaceConf2.write({
|
|
1639
|
-
dir:
|
|
1649
|
+
dir: _path2().default.dirname(config.workspaceConfig.path)
|
|
1640
1650
|
}));
|
|
1641
1651
|
}
|
|
1642
1652
|
|
|
@@ -1996,7 +2006,7 @@ needed-for: ${(neededFor === null || neededFor === void 0 ? void 0 : neededFor.t
|
|
|
1996
2006
|
id) {
|
|
1997
2007
|
const PREFIX = 'bit';
|
|
1998
2008
|
|
|
1999
|
-
const cacheDir =
|
|
2009
|
+
const cacheDir = _path2().default.join(this.modulesPath, '.cache', PREFIX, id); // maybe should also check it's a folder and has write permissions
|
|
2000
2010
|
|
|
2001
2011
|
|
|
2002
2012
|
if (!_fsExtra().default.existsSync(cacheDir)) {
|
|
@@ -2283,6 +2293,22 @@ needed-for: ${(neededFor === null || neededFor === void 0 ? void 0 : neededFor.t
|
|
|
2283
2293
|
const res = await linker.link(this.path, mergedRootPolicy, compDirMap, options);
|
|
2284
2294
|
return res;
|
|
2285
2295
|
}
|
|
2296
|
+
/**
|
|
2297
|
+
* @param componentPath can be relative or absolute. supports Linux and Windows
|
|
2298
|
+
*/
|
|
2299
|
+
|
|
2300
|
+
|
|
2301
|
+
async getComponentIdByPath(componentPath) {
|
|
2302
|
+
const relativePath = _path2().default.isAbsolute(componentPath) ? _path2().default.relative(this.path, componentPath) : componentPath;
|
|
2303
|
+
const linuxPath = (0, _path().pathNormalizeToLinux)(relativePath);
|
|
2304
|
+
const bitId = this.consumer.bitMap.getComponentIdByPath(linuxPath);
|
|
2305
|
+
|
|
2306
|
+
if (bitId) {
|
|
2307
|
+
return this.resolveComponentId(bitId);
|
|
2308
|
+
}
|
|
2309
|
+
|
|
2310
|
+
return undefined;
|
|
2311
|
+
}
|
|
2286
2312
|
/**
|
|
2287
2313
|
* Generate a filter to pass to the installer
|
|
2288
2314
|
* This will filter deps which are come from remotes which defined in scope.json
|
|
@@ -2393,7 +2419,7 @@ your workspace.jsonc has this component-id set. you might want to remove/change
|
|
|
2393
2419
|
|
|
2394
2420
|
getComponentPackagePath(component) {
|
|
2395
2421
|
const packageName = (0, _componentIdToPackageName().default)(component instanceof _component2().default ? component : component.state._consumer);
|
|
2396
|
-
return
|
|
2422
|
+
return _path2().default.join(this.modulesPath, packageName);
|
|
2397
2423
|
} // TODO: should we return here the dir as it defined (aka components) or with /{name} prefix (as it used in legacy)
|
|
2398
2424
|
|
|
2399
2425
|
|