@teambit/component 1.0.177 → 1.0.179

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.
@@ -116,7 +116,7 @@ export interface ComponentFactory {
116
116
  * list invalid components, such as components with missing files on the fs.
117
117
  */
118
118
  listInvalid(): Promise<InvalidComponent[]>;
119
- listIds(): Promise<ComponentID[]>;
119
+ listIds(): Promise<ComponentID[]> | ComponentID[];
120
120
  /**
121
121
  * get component-ids matching the given pattern. a pattern can have multiple patterns separated by a comma.
122
122
  * it uses multimatch (https://www.npmjs.com/package/multimatch) package for the matching algorithm, which supports
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["component-factory.ts"],"sourcesContent":["import { Graph } from '@teambit/graph.cleargraph';\nimport { BitId } from '@teambit/legacy-bit-id';\nimport { ComponentID } from '@teambit/component-id';\nimport ConsumerComponent from '@teambit/legacy/dist/consumer/component';\nimport { CompIdGraph } from '@teambit/graph';\nimport type { ComponentLog } from '@teambit/legacy/dist/scope/models/model-component';\nimport type { AspectDefinition } from '@teambit/aspect-loader';\nimport { Component, InvalidComponent } from './component';\nimport { State } from './state';\nimport { Snap } from './snap';\n\nexport type ResolveAspectsOptions = FilterAspectsOptions & {\n throwOnError?: boolean;\n useScopeAspectsCapsule?: boolean;\n workspaceName?: string;\n skipDeps?: boolean;\n resolveEnvsFromRoots?: boolean;\n packageManagerConfigRootDir?: string;\n};\n\nexport type LoadAspectsOptions = {\n /* `throwOnError` is an optional parameter that can be passed to the loadAspects method in the `ComponentFactory` interface. If\n set to `true`, it will cause the method to throw an error if an error occurs during its execution. If set to `false`\n or not provided, the method will print a warning instead of throwing it. */\n throwOnError?: boolean;\n /* `hideMissingModuleError` is an optional parameter that can be passed to the `loadAspects` method in the\n `ComponentFactory` interface. If set to `true`, it will prevent the method from throwing/printing an error if a required module\n is missing during the loading of an aspect. Instead, it will continue loading the other\n aspects. If set to `false` or not provided, the method will print/throw an error if a required module is missing.\n (considering throwOnError as well) */\n hideMissingModuleError?: boolean;\n\n /* The `ignoreErrors` property is an optional boolean parameter that can be passed to the `LoadAspectsOptions` object in\n the `ComponentFactory` interface. If set to `true`, it will cause the `loadAspects` method to ignore any errors that\n occur during the loading of aspects and continue loading the other aspects. If set to `false` or not provided, the\n method will print/throw an error if a required module is missing or if any other error occurs during the loading of\n aspects. */\n ignoreErrors?: boolean;\n [key: string]: any;\n};\n\nexport type FilterAspectsOptions = {\n /**\n * Do not return results for the core aspects\n */\n excludeCore?: boolean;\n /**\n * Only return results for the provided list of ids\n */\n requestedOnly?: boolean;\n /**\n * Only return results for aspects that have a path to the specified runtime name\n */\n filterByRuntime?: boolean;\n};\n\nexport interface ComponentFactory {\n /**\n * name of the component host.\n */\n name: string;\n\n /**\n * path to the component host.\n */\n path: string;\n\n isLegacy: boolean;\n\n /**\n * resolve a `string` component ID to an instance of a ComponentID.\n */\n resolveComponentId(id: string | BitId | ComponentID): Promise<ComponentID>;\n\n /**\n * resolve multiple `string` component ID to an instance of a ComponentID.\n */\n resolveMultipleComponentIds(ids: (string | BitId | ComponentID)[]): Promise<ComponentID[]>;\n\n /**\n * returns a component by ID.\n */\n get(id: ComponentID): Promise<Component | undefined>;\n\n /**\n * returns the legacy representation of a component with minimal loading.\n * when loaded from the workspace, it won't run any Harmony hooks and even won't load dependencies.\n * it's good to get raw aspects data or some basic properties.\n * use carefully. prefer using `get()` instead.\n */\n getLegacyMinimal(id: ComponentID): Promise<ConsumerComponent | undefined>;\n\n /**\n * returns many components by ids.\n */\n getMany(ids: ComponentID[]): Promise<Component[]>;\n\n /**\n * returns many components by their legacy representation.\n */\n getManyByLegacy(components: ConsumerComponent[]): Promise<Component[]>;\n\n /**\n * get a component from a remote without importing it\n */\n getRemoteComponent?: (id: ComponentID) => Promise<Component>;\n\n /**\n * important - prefer using `getGraphIds()` if you don't need the component objects.\n * this method has a performance penalty. it must import all flattened-dependencies objects from the remotes.\n */\n getGraph(ids?: ComponentID[], shouldThrowOnMissingDep?: boolean): Promise<Graph<Component, string>>;\n\n /**\n * get graph of the given component-ids and all their dependencies (recursively/flattened).\n * the nodes are ComponentIds and is much faster than `this.getGraph()`.\n */\n getGraphIds(ids?: ComponentID[], shouldThrowOnMissingDep?: boolean): Promise<CompIdGraph>;\n\n getLogs(id: ComponentID, shortHash?: boolean, startsFrom?: string): Promise<ComponentLog[]>;\n\n /**\n * returns a specific state of a component by hash or semver.\n */\n getState(id: ComponentID, snapId: string): Promise<State>;\n\n /**\n * returns a specific snap of a component by hash.\n */\n getSnap(id: ComponentID, snapId: string): Promise<Snap>;\n\n /**\n * load aspects.\n * returns the loaded aspect ids including the loaded versions.\n */\n loadAspects: (ids: string[], throwOnError?: boolean, neededFor?: string, opts?: any) => Promise<string[]>;\n\n /**\n * Resolve dirs for aspects\n */\n resolveAspects: (\n runtimeName?: string,\n componentIds?: ComponentID[],\n opts?: ResolveAspectsOptions\n ) => Promise<AspectDefinition[]>;\n\n /**\n * list all components in the host.\n */\n list(filter?: { offset: number; limit: number }): Promise<Component[]>;\n\n /**\n * list invalid components, such as components with missing files on the fs.\n */\n listInvalid(): Promise<InvalidComponent[]>;\n\n listIds(): Promise<ComponentID[]>;\n\n /**\n * get component-ids matching the given pattern. a pattern can have multiple patterns separated by a comma.\n * it uses multimatch (https://www.npmjs.com/package/multimatch) package for the matching algorithm, which supports\n * (among others) negate character \"!\" to exclude ids. See the package page for more supported characters.\n */\n idsByPattern(pattern: string, throwForNoMatch?: boolean): Promise<ComponentID[]>;\n\n hasId(componentId: ComponentID): Promise<boolean>;\n\n /**\n * Check if the host has the id, if no, search for the id in inner host (for example, workspace will search in the scope)\n * @param componentId\n */\n hasIdNested(componentId: ComponentID, includeCache?: boolean): Promise<boolean>;\n\n /**\n * whether a component is not the same as its head.\n * for a new component, it'll return \"true\" as it has no head yet.\n * this is relevant for component from the workspace, where it can be locally changed. on the scope it's always false\n */\n isModified(component: Component): Promise<boolean>;\n\n /**\n * write the component to the filesystem when applicable (no-op for scope).\n * to change the component-path, specify the \"rootPath\", which should be a relative path inside the workspace.\n */\n write(component: Component, rootPath?: string): Promise<void>;\n\n /**\n * determine whether host should be the prior one in case multiple hosts persist.\n */\n priority?: boolean;\n}\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["component-factory.ts"],"sourcesContent":["import { Graph } from '@teambit/graph.cleargraph';\nimport { BitId } from '@teambit/legacy-bit-id';\nimport { ComponentID } from '@teambit/component-id';\nimport ConsumerComponent from '@teambit/legacy/dist/consumer/component';\nimport { CompIdGraph } from '@teambit/graph';\nimport type { ComponentLog } from '@teambit/legacy/dist/scope/models/model-component';\nimport type { AspectDefinition } from '@teambit/aspect-loader';\nimport { Component, InvalidComponent } from './component';\nimport { State } from './state';\nimport { Snap } from './snap';\n\nexport type ResolveAspectsOptions = FilterAspectsOptions & {\n throwOnError?: boolean;\n useScopeAspectsCapsule?: boolean;\n workspaceName?: string;\n skipDeps?: boolean;\n resolveEnvsFromRoots?: boolean;\n packageManagerConfigRootDir?: string;\n};\n\nexport type LoadAspectsOptions = {\n /* `throwOnError` is an optional parameter that can be passed to the loadAspects method in the `ComponentFactory` interface. If\n set to `true`, it will cause the method to throw an error if an error occurs during its execution. If set to `false`\n or not provided, the method will print a warning instead of throwing it. */\n throwOnError?: boolean;\n /* `hideMissingModuleError` is an optional parameter that can be passed to the `loadAspects` method in the\n `ComponentFactory` interface. If set to `true`, it will prevent the method from throwing/printing an error if a required module\n is missing during the loading of an aspect. Instead, it will continue loading the other\n aspects. If set to `false` or not provided, the method will print/throw an error if a required module is missing.\n (considering throwOnError as well) */\n hideMissingModuleError?: boolean;\n\n /* The `ignoreErrors` property is an optional boolean parameter that can be passed to the `LoadAspectsOptions` object in\n the `ComponentFactory` interface. If set to `true`, it will cause the `loadAspects` method to ignore any errors that\n occur during the loading of aspects and continue loading the other aspects. If set to `false` or not provided, the\n method will print/throw an error if a required module is missing or if any other error occurs during the loading of\n aspects. */\n ignoreErrors?: boolean;\n [key: string]: any;\n};\n\nexport type FilterAspectsOptions = {\n /**\n * Do not return results for the core aspects\n */\n excludeCore?: boolean;\n /**\n * Only return results for the provided list of ids\n */\n requestedOnly?: boolean;\n /**\n * Only return results for aspects that have a path to the specified runtime name\n */\n filterByRuntime?: boolean;\n};\n\nexport interface ComponentFactory {\n /**\n * name of the component host.\n */\n name: string;\n\n /**\n * path to the component host.\n */\n path: string;\n\n isLegacy: boolean;\n\n /**\n * resolve a `string` component ID to an instance of a ComponentID.\n */\n resolveComponentId(id: string | BitId | ComponentID): Promise<ComponentID>;\n\n /**\n * resolve multiple `string` component ID to an instance of a ComponentID.\n */\n resolveMultipleComponentIds(ids: (string | BitId | ComponentID)[]): Promise<ComponentID[]>;\n\n /**\n * returns a component by ID.\n */\n get(id: ComponentID): Promise<Component | undefined>;\n\n /**\n * returns the legacy representation of a component with minimal loading.\n * when loaded from the workspace, it won't run any Harmony hooks and even won't load dependencies.\n * it's good to get raw aspects data or some basic properties.\n * use carefully. prefer using `get()` instead.\n */\n getLegacyMinimal(id: ComponentID): Promise<ConsumerComponent | undefined>;\n\n /**\n * returns many components by ids.\n */\n getMany(ids: ComponentID[]): Promise<Component[]>;\n\n /**\n * returns many components by their legacy representation.\n */\n getManyByLegacy(components: ConsumerComponent[]): Promise<Component[]>;\n\n /**\n * get a component from a remote without importing it\n */\n getRemoteComponent?: (id: ComponentID) => Promise<Component>;\n\n /**\n * important - prefer using `getGraphIds()` if you don't need the component objects.\n * this method has a performance penalty. it must import all flattened-dependencies objects from the remotes.\n */\n getGraph(ids?: ComponentID[], shouldThrowOnMissingDep?: boolean): Promise<Graph<Component, string>>;\n\n /**\n * get graph of the given component-ids and all their dependencies (recursively/flattened).\n * the nodes are ComponentIds and is much faster than `this.getGraph()`.\n */\n getGraphIds(ids?: ComponentID[], shouldThrowOnMissingDep?: boolean): Promise<CompIdGraph>;\n\n getLogs(id: ComponentID, shortHash?: boolean, startsFrom?: string): Promise<ComponentLog[]>;\n\n /**\n * returns a specific state of a component by hash or semver.\n */\n getState(id: ComponentID, snapId: string): Promise<State>;\n\n /**\n * returns a specific snap of a component by hash.\n */\n getSnap(id: ComponentID, snapId: string): Promise<Snap>;\n\n /**\n * load aspects.\n * returns the loaded aspect ids including the loaded versions.\n */\n loadAspects: (ids: string[], throwOnError?: boolean, neededFor?: string, opts?: any) => Promise<string[]>;\n\n /**\n * Resolve dirs for aspects\n */\n resolveAspects: (\n runtimeName?: string,\n componentIds?: ComponentID[],\n opts?: ResolveAspectsOptions\n ) => Promise<AspectDefinition[]>;\n\n /**\n * list all components in the host.\n */\n list(filter?: { offset: number; limit: number }): Promise<Component[]>;\n\n /**\n * list invalid components, such as components with missing files on the fs.\n */\n listInvalid(): Promise<InvalidComponent[]>;\n\n listIds(): Promise<ComponentID[]> | ComponentID[];\n\n /**\n * get component-ids matching the given pattern. a pattern can have multiple patterns separated by a comma.\n * it uses multimatch (https://www.npmjs.com/package/multimatch) package for the matching algorithm, which supports\n * (among others) negate character \"!\" to exclude ids. See the package page for more supported characters.\n */\n idsByPattern(pattern: string, throwForNoMatch?: boolean): Promise<ComponentID[]>;\n\n hasId(componentId: ComponentID): Promise<boolean>;\n\n /**\n * Check if the host has the id, if no, search for the id in inner host (for example, workspace will search in the scope)\n * @param componentId\n */\n hasIdNested(componentId: ComponentID, includeCache?: boolean): Promise<boolean>;\n\n /**\n * whether a component is not the same as its head.\n * for a new component, it'll return \"true\" as it has no head yet.\n * this is relevant for component from the workspace, where it can be locally changed. on the scope it's always false\n */\n isModified(component: Component): Promise<boolean>;\n\n /**\n * write the component to the filesystem when applicable (no-op for scope).\n * to change the component-path, specify the \"rootPath\", which should be a relative path inside the workspace.\n */\n write(component: Component, rootPath?: string): Promise<void>;\n\n /**\n * determine whether host should be the prior one in case multiple hosts persist.\n */\n priority?: boolean;\n}\n"],"mappings":""}
@@ -55,6 +55,7 @@ export declare class ComponentMain {
55
55
  * get component host by extension ID.
56
56
  */
57
57
  getHost(id?: string): ComponentFactory;
58
+ getHostIfExist(id?: string): ComponentFactory | undefined;
58
59
  getRoute(id: ComponentID, routeName: string): string;
59
60
  /**
60
61
  * get the prior host.
@@ -156,6 +156,14 @@ class ComponentMain {
156
156
  }
157
157
  return this.getPriorHost();
158
158
  }
159
+ getHostIfExist(id) {
160
+ try {
161
+ return this.getHost(id);
162
+ } catch (err) {
163
+ if (err instanceof _exceptions().HostNotFound) return undefined;
164
+ throw err;
165
+ }
166
+ }
159
167
  getRoute(id, routeName) {
160
168
  return `/api/${id.toString()}/~aspect/${routeName}`;
161
169
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_cli","data","require","_express","_graphql","_harmony","_lodash","_component","_component2","_component3","_aspectList","_exceptions","_show","_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","String","r","e","Symbol","toPrimitive","call","TypeError","Number","ComponentMain","constructor","hostSlot","express","showFragmentSlot","registerHost","host","register","createAspectListFromLegacy","legacyExtensionDataList","AspectList","fromLegacyExtensions","createAspectListFromEntries","entries","registerRoute","routes","routeEntries","map","route","ComponentRoute","flattenRoutes","flatten","setHostPriority","id","get","HostNotFound","_priorHost","getHost","getPriorHost","getRoute","routeName","toString","hosts","values","priorityHost","find","priority","getShowFragments","fragments","orderBy","isHost","name","registerShowFragments","showFragments","provider","graphql","cli","config","componentExtension","ShowCmd","NameFragment","MainFileFragment","IDFragment","ScopeFragment","FilesFragment","ExtensionsFragment","componentSchema","exports","Slot","withType","MainRuntime","GraphqlAspect","ExpressAspect","CLIAspect","ComponentAspect","addRuntime"],"sources":["component.main.runtime.ts"],"sourcesContent":["import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { ExpressAspect, ExpressMain, Route } from '@teambit/express';\nimport { GraphqlAspect, GraphqlMain } from '@teambit/graphql';\nimport { Slot, SlotRegistry } from '@teambit/harmony';\nimport { ComponentID } from '@teambit/component-id';\nimport { flatten, orderBy } from 'lodash';\nimport { ExtensionDataList } from '@teambit/legacy/dist/consumer/config';\nimport { ComponentFactory } from './component-factory';\nimport { ComponentAspect } from './component.aspect';\nimport { componentSchema } from './component.graphql';\nimport { ComponentRoute } from './component.route';\nimport { AspectList } from './aspect-list';\nimport { HostNotFound } from './exceptions';\nimport { AspectEntry } from './aspect-entry';\nimport {\n ShowCmd,\n ShowFragment,\n NameFragment,\n MainFileFragment,\n IDFragment,\n ScopeFragment,\n FilesFragment,\n ExtensionsFragment,\n} from './show';\nimport { RegisteredComponentRoute } from '.';\n\nexport type ComponentHostSlot = SlotRegistry<ComponentFactory>;\n\nexport type ShowFragmentSlot = SlotRegistry<ShowFragment[]>;\n\nexport class ComponentMain {\n constructor(\n /**\n * slot for component hosts to register.\n */\n private hostSlot: ComponentHostSlot,\n\n /**\n * Express Extension\n */\n private express: ExpressMain,\n\n private showFragmentSlot: ShowFragmentSlot\n ) {}\n\n /**\n * register a new component host.\n */\n registerHost(host: ComponentFactory) {\n this.hostSlot.register(host);\n return this;\n }\n\n /**\n * important! avoid using this method.\n * seems like this method was written to work around a very specific case when the ComponentID of the aspects are\n * not available. in case of new components, to get the ComponentID, the workspace-aspect is needed to get the\n * default-scope. when this method is called from the scope, there is no way to get the real component-id.\n * instead, this method asks for the \"scope\", which when called by the scope-aspect is the current scope-name.\n * it may or may not be the real scope-name of the aspect.\n * to fix this possibly incorrect scope-name, the `workspace.resolveScopeAspectListIds()` checks whether the\n * scope-name is the same as scope.name, and if so, resolve it to the correct scope-name.\n */\n createAspectListFromLegacy(legacyExtensionDataList: ExtensionDataList) {\n return AspectList.fromLegacyExtensions(legacyExtensionDataList);\n }\n\n createAspectListFromEntries(entries: AspectEntry[]) {\n return new AspectList(entries);\n }\n\n registerRoute(routes: RegisteredComponentRoute[]) {\n const routeEntries = routes.map((route: RegisteredComponentRoute) => {\n return new ComponentRoute(route, this);\n });\n\n const flattenRoutes = flatten(routeEntries) as any as Route[];\n\n this.express.register(flattenRoutes);\n return this;\n }\n\n /**\n * set the prior host.\n */\n setHostPriority(id: string) {\n const host = this.hostSlot.get(id);\n if (!host) {\n throw new HostNotFound(id);\n }\n\n this._priorHost = host;\n return this;\n }\n\n /**\n * get component host by extension ID.\n */\n getHost(id?: string): ComponentFactory {\n if (id) {\n const host = this.hostSlot.get(id);\n if (!host) throw new HostNotFound(id);\n return host;\n }\n\n return this.getPriorHost();\n }\n\n getRoute(id: ComponentID, routeName: string) {\n return `/api/${id.toString()}/~aspect/${routeName}`;\n }\n\n /**\n * get the prior host.\n */\n private getPriorHost() {\n if (this._priorHost) return this._priorHost;\n\n const hosts = this.hostSlot.values();\n const priorityHost = hosts.find((host) => host.priority);\n return priorityHost || hosts[0];\n }\n\n getShowFragments() {\n const fragments = orderBy(flatten(this.showFragmentSlot.values()), ['weight', ['asc']]);\n return fragments;\n }\n\n isHost(name: string) {\n return !!this.hostSlot.get(name);\n }\n\n /**\n * register a show fragment to display further information in the `bit show` command.\n */\n registerShowFragments(showFragments: ShowFragment[]) {\n this.showFragmentSlot.register(showFragments);\n return this;\n }\n\n private _priorHost: ComponentFactory | undefined;\n\n static slots = [Slot.withType<ComponentFactory>(), Slot.withType<Route[]>(), Slot.withType<ShowFragment[]>()];\n\n static runtime = MainRuntime;\n static dependencies = [GraphqlAspect, ExpressAspect, CLIAspect];\n\n static async provider(\n [graphql, express, cli]: [GraphqlMain, ExpressMain, CLIMain],\n config,\n [hostSlot, showFragmentSlot]: [ComponentHostSlot, ShowFragmentSlot]\n ) {\n const componentExtension = new ComponentMain(hostSlot, express, showFragmentSlot);\n cli.register(new ShowCmd(componentExtension));\n\n componentExtension.registerShowFragments([\n new NameFragment(),\n new MainFileFragment(),\n new IDFragment(),\n new ScopeFragment(),\n new FilesFragment(),\n new ExtensionsFragment(),\n ]);\n graphql.register(componentSchema(componentExtension));\n\n return componentExtension;\n }\n}\n\nComponentAspect.addRuntime(ComponentMain);\n"],"mappings":";;;;;;AAAA,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,IAAA,YAAAA,CAAA;IAAA,OAA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C,EAChB,KAAIC,qBAAa,EAAC,CAAC,EACnB,KAAIC,qBAAa,EAAC,CAAC,EACnB,KAAIC,0BAAkB,EAAC,CAAC,CACzB,CAAC;IACFV,OAAO,CAACtC,QAAQ,CAAC,IAAAiD,6BAAe,EAACR,kBAAkB,CAAC,CAAC;IAErD,OAAOA,kBAAkB;EAC3B;AACF;AAACS,OAAA,CAAAzD,aAAA,GAAAA,aAAA;AAAArB,eAAA,CAzIYqB,aAAa,WAgHT,CAAC0D,eAAI,CAACC,QAAQ,CAAmB,CAAC,EAAED,eAAI,CAACC,QAAQ,CAAU,CAAC,EAAED,eAAI,CAACC,QAAQ,CAAiB,CAAC,CAAC;AAAAhF,eAAA,CAhHlGqB,aAAa,aAkHP4D,kBAAW;AAAAjF,eAAA,CAlHjBqB,aAAa,kBAmHF,CAAC6D,wBAAa,EAAEC,wBAAa,EAAEC,gBAAS,CAAC;AAwBjEC,4BAAe,CAACC,UAAU,CAACjE,aAAa,CAAC"}
1
+ {"version":3,"names":["_cli","data","require","_express","_graphql","_harmony","_lodash","_component","_component2","_component3","_aspectList","_exceptions","_show","_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","String","r","e","Symbol","toPrimitive","call","TypeError","Number","ComponentMain","constructor","hostSlot","express","showFragmentSlot","registerHost","host","register","createAspectListFromLegacy","legacyExtensionDataList","AspectList","fromLegacyExtensions","createAspectListFromEntries","entries","registerRoute","routes","routeEntries","map","route","ComponentRoute","flattenRoutes","flatten","setHostPriority","id","get","HostNotFound","_priorHost","getHost","getPriorHost","getHostIfExist","err","undefined","getRoute","routeName","toString","hosts","values","priorityHost","find","priority","getShowFragments","fragments","orderBy","isHost","name","registerShowFragments","showFragments","provider","graphql","cli","config","componentExtension","ShowCmd","NameFragment","MainFileFragment","IDFragment","ScopeFragment","FilesFragment","ExtensionsFragment","componentSchema","exports","Slot","withType","MainRuntime","GraphqlAspect","ExpressAspect","CLIAspect","ComponentAspect","addRuntime"],"sources":["component.main.runtime.ts"],"sourcesContent":["import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { ExpressAspect, ExpressMain, Route } from '@teambit/express';\nimport { GraphqlAspect, GraphqlMain } from '@teambit/graphql';\nimport { Slot, SlotRegistry } from '@teambit/harmony';\nimport { ComponentID } from '@teambit/component-id';\nimport { flatten, orderBy } from 'lodash';\nimport { ExtensionDataList } from '@teambit/legacy/dist/consumer/config';\nimport { ComponentFactory } from './component-factory';\nimport { ComponentAspect } from './component.aspect';\nimport { componentSchema } from './component.graphql';\nimport { ComponentRoute } from './component.route';\nimport { AspectList } from './aspect-list';\nimport { HostNotFound } from './exceptions';\nimport { AspectEntry } from './aspect-entry';\nimport {\n ShowCmd,\n ShowFragment,\n NameFragment,\n MainFileFragment,\n IDFragment,\n ScopeFragment,\n FilesFragment,\n ExtensionsFragment,\n} from './show';\nimport { RegisteredComponentRoute } from '.';\n\nexport type ComponentHostSlot = SlotRegistry<ComponentFactory>;\n\nexport type ShowFragmentSlot = SlotRegistry<ShowFragment[]>;\n\nexport class ComponentMain {\n constructor(\n /**\n * slot for component hosts to register.\n */\n private hostSlot: ComponentHostSlot,\n\n /**\n * Express Extension\n */\n private express: ExpressMain,\n\n private showFragmentSlot: ShowFragmentSlot\n ) {}\n\n /**\n * register a new component host.\n */\n registerHost(host: ComponentFactory) {\n this.hostSlot.register(host);\n return this;\n }\n\n /**\n * important! avoid using this method.\n * seems like this method was written to work around a very specific case when the ComponentID of the aspects are\n * not available. in case of new components, to get the ComponentID, the workspace-aspect is needed to get the\n * default-scope. when this method is called from the scope, there is no way to get the real component-id.\n * instead, this method asks for the \"scope\", which when called by the scope-aspect is the current scope-name.\n * it may or may not be the real scope-name of the aspect.\n * to fix this possibly incorrect scope-name, the `workspace.resolveScopeAspectListIds()` checks whether the\n * scope-name is the same as scope.name, and if so, resolve it to the correct scope-name.\n */\n createAspectListFromLegacy(legacyExtensionDataList: ExtensionDataList) {\n return AspectList.fromLegacyExtensions(legacyExtensionDataList);\n }\n\n createAspectListFromEntries(entries: AspectEntry[]) {\n return new AspectList(entries);\n }\n\n registerRoute(routes: RegisteredComponentRoute[]) {\n const routeEntries = routes.map((route: RegisteredComponentRoute) => {\n return new ComponentRoute(route, this);\n });\n\n const flattenRoutes = flatten(routeEntries) as any as Route[];\n\n this.express.register(flattenRoutes);\n return this;\n }\n\n /**\n * set the prior host.\n */\n setHostPriority(id: string) {\n const host = this.hostSlot.get(id);\n if (!host) {\n throw new HostNotFound(id);\n }\n\n this._priorHost = host;\n return this;\n }\n\n /**\n * get component host by extension ID.\n */\n getHost(id?: string): ComponentFactory {\n if (id) {\n const host = this.hostSlot.get(id);\n if (!host) throw new HostNotFound(id);\n return host;\n }\n\n return this.getPriorHost();\n }\n\n getHostIfExist(id?: string): ComponentFactory | undefined {\n try {\n return this.getHost(id);\n } catch (err) {\n if (err instanceof HostNotFound) return undefined;\n throw err;\n }\n }\n\n getRoute(id: ComponentID, routeName: string) {\n return `/api/${id.toString()}/~aspect/${routeName}`;\n }\n\n /**\n * get the prior host.\n */\n private getPriorHost() {\n if (this._priorHost) return this._priorHost;\n\n const hosts = this.hostSlot.values();\n const priorityHost = hosts.find((host) => host.priority);\n return priorityHost || hosts[0];\n }\n\n getShowFragments() {\n const fragments = orderBy(flatten(this.showFragmentSlot.values()), ['weight', ['asc']]);\n return fragments;\n }\n\n isHost(name: string) {\n return !!this.hostSlot.get(name);\n }\n\n /**\n * register a show fragment to display further information in the `bit show` command.\n */\n registerShowFragments(showFragments: ShowFragment[]) {\n this.showFragmentSlot.register(showFragments);\n return this;\n }\n\n private _priorHost: ComponentFactory | undefined;\n\n static slots = [Slot.withType<ComponentFactory>(), Slot.withType<Route[]>(), Slot.withType<ShowFragment[]>()];\n\n static runtime = MainRuntime;\n static dependencies = [GraphqlAspect, ExpressAspect, CLIAspect];\n\n static async provider(\n [graphql, express, cli]: [GraphqlMain, ExpressMain, CLIMain],\n config,\n [hostSlot, showFragmentSlot]: [ComponentHostSlot, ShowFragmentSlot]\n ) {\n const componentExtension = new ComponentMain(hostSlot, express, showFragmentSlot);\n cli.register(new ShowCmd(componentExtension));\n\n componentExtension.registerShowFragments([\n new NameFragment(),\n new MainFileFragment(),\n new IDFragment(),\n new ScopeFragment(),\n new FilesFragment(),\n new ExtensionsFragment(),\n ]);\n graphql.register(componentSchema(componentExtension));\n\n return componentExtension;\n }\n}\n\nComponentAspect.addRuntime(ComponentMain);\n"],"mappings":";;;;;;AAAA,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,IAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,SAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,QAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,SAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,QAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,SAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,QAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAK,QAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,OAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAM,WAAA;EAAA,MAAAN,IAAA,GAAAC,OAAA;EAAAK,UAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,YAAA;EAAA,MAAAP,IAAA,GAAAC,OAAA;EAAAM,WAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAQ,YAAA;EAAA,MAAA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ositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_component@1.0.177/dist/component.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_component@1.0.177/dist/component.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_component@1.0.179/dist/component.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_component@1.0.179/dist/component.docs.mdx';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];
@@ -60,7 +60,9 @@ class ShowCmd {
60
60
  async getComponent(idStr, remote) {
61
61
  if (remote) {
62
62
  const id = _componentId().ComponentID.fromString(idStr); // user used --remote so we know it has a scope
63
- const host = this.component.getHost('teambit.scope/scope');
63
+ const host = this.component.getHostIfExist('teambit.scope/scope');
64
+ if (!host) throw new Error(`error: the current directory is not a workspace nor a scope. the full "bit show" is not supported.
65
+ to see the legacy bit show, please use "--legacy" flag`);
64
66
  if (!host.getRemoteComponent) {
65
67
  throw new Error('Component Host does not implement getRemoteComponent()');
66
68
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_lodash","data","require","_cliTable","_exceptions","_componentId","_showCmd","_interopRequireDefault","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","String","r","e","Symbol","toPrimitive","call","TypeError","Number","ShowCmd","constructor","component","name","description","getComponent","idStr","remote","id","ComponentID","fromString","host","getHost","getRemoteComponent","Error","resolveComponentId","get","MissingBitMapComponent","useLegacy","json","compare","legacyShow","LegacyShow","showData","action","versions","undefined","report","legacy","fragments","getShowFragments","rows","Promise","all","map","fragment","row","renderRow","content","title","table","CLITable","compact","render","JSON","parse","filter","exports"],"sources":["show.cmd.ts"],"sourcesContent":["import { Command, CommandOptions } from '@teambit/cli';\nimport { compact } from 'lodash';\n// import { Logger } from '@teambit/logger';\n// import chalk from 'chalk';\nimport { CLITable } from '@teambit/cli-table';\nimport { MissingBitMapComponent } from '@teambit/legacy/dist/consumer/bit-map/exceptions';\nimport { ComponentID } from '@teambit/component-id';\nimport LegacyShow from '@teambit/legacy/dist/cli/commands/public-cmds/show-cmd';\nimport { ComponentMain } from '../component.main.runtime';\n\nexport class ShowCmd implements Command {\n name = 'show <component-name>';\n description = \"display the component's essential information\";\n alias = '';\n group = 'info';\n arguments = [{ name: 'component-name', description: 'component name or component id' }];\n options = [\n ['j', 'json', 'return the component data in json format'],\n ['l', 'legacy', 'use the legacy bit show.'],\n ['r', 'remote', 'show data for a remote component'],\n [\n 'c',\n 'compare',\n 'legacy-only. compare current file system component to its latest tagged version [default=latest]',\n ],\n ] as CommandOptions;\n\n constructor(private component: ComponentMain) {}\n\n private async getComponent(idStr: string, remote: boolean) {\n if (remote) {\n const id = ComponentID.fromString(idStr); // user used --remote so we know it has a scope\n const host = this.component.getHost('teambit.scope/scope');\n if (!host.getRemoteComponent) {\n throw new Error('Component Host does not implement getRemoteComponent()');\n }\n const component = await host.getRemoteComponent(id);\n return component;\n }\n const host = this.component.getHost();\n const id = await host.resolveComponentId(idStr);\n const component = await host.get(id);\n if (!component) throw new MissingBitMapComponent(idStr);\n return component;\n }\n\n async useLegacy(id: string, json = false, remote = false, compare = false) {\n const legacyShow = new LegacyShow();\n const showData = await legacyShow.action([id], {\n json,\n versions: undefined,\n remote,\n compare,\n });\n\n return legacyShow.report(showData);\n }\n\n async report([idStr]: [string], { legacy, remote, compare }: { legacy: boolean; remote: boolean; compare: boolean }) {\n if (legacy) return this.useLegacy(idStr, false, remote, compare);\n const component = await this.getComponent(idStr, remote);\n const fragments = this.component.getShowFragments();\n const rows = await Promise.all(\n fragments.map(async (fragment) => {\n const row = await fragment.renderRow(component);\n if (!row.content) return null;\n return [row.title, row.content];\n })\n );\n\n const table = new CLITable([], compact(rows));\n return table.render();\n }\n\n async json([idStr]: [string], { remote, legacy }: { remote: boolean; legacy: boolean }) {\n if (legacy) return JSON.parse(await this.useLegacy(idStr, true, remote));\n const component = await this.getComponent(idStr, remote);\n const fragments = this.component.getShowFragments();\n const rows = await Promise.all(\n fragments.map(async (fragment) => {\n return fragment.json ? fragment.json(component) : undefined;\n })\n );\n\n return rows.filter((row) => !!row);\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAE,UAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,SAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,YAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,WAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,aAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,YAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,SAAA;EAAA,MAAAL,IAAA,GAAAM,sBAAA,CAAAL,OAAA;EAAAI,QAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAgF,SAAAM,uBAAAC,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,gBAAAH,GAAA,EAAAI,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAJ,GAAA,IAAAO,MAAA,CAAAC,cAAA,CAA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AED,OAAOK,IAAI,CAACe,MAAM,CAAEV,GAAG,IAAK,CAAC,CAACA,GAAG,CAAC;EACpC;AACF;AAACW,OAAA,CAAA/C,OAAA,GAAAA,OAAA"}
1
+ {"version":3,"names":["_lodash","data","require","_cliTable","_exceptions","_componentId","_showCmd","_interopRequireDefault","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","String","r","e","Symbol","toPrimitive","call","TypeError","Number","ShowCmd","constructor","component","name","description","getComponent","idStr","remote","id","ComponentID","fromString","host","getHostIfExist","Error","getRemoteComponent","getHost","resolveComponentId","get","MissingBitMapComponent","useLegacy","json","compare","legacyShow","LegacyShow","showData","action","versions","undefined","report","legacy","fragments","getShowFragments","rows","Promise","all","map","fragment","row","renderRow","content","title","table","CLITable","compact","render","JSON","parse","filter","exports"],"sources":["show.cmd.ts"],"sourcesContent":["import { Command, CommandOptions } from '@teambit/cli';\nimport { compact } from 'lodash';\n// import { Logger } from '@teambit/logger';\n// import chalk from 'chalk';\nimport { CLITable } from '@teambit/cli-table';\nimport { MissingBitMapComponent } from '@teambit/legacy/dist/consumer/bit-map/exceptions';\nimport { ComponentID } from '@teambit/component-id';\nimport LegacyShow from '@teambit/legacy/dist/cli/commands/public-cmds/show-cmd';\nimport { ComponentMain } from '../component.main.runtime';\n\nexport class ShowCmd implements Command {\n name = 'show <component-name>';\n description = \"display the component's essential information\";\n alias = '';\n group = 'info';\n arguments = [{ name: 'component-name', description: 'component name or component id' }];\n options = [\n ['j', 'json', 'return the component data in json format'],\n ['l', 'legacy', 'use the legacy bit show.'],\n ['r', 'remote', 'show data for a remote component'],\n [\n 'c',\n 'compare',\n 'legacy-only. compare current file system component to its latest tagged version [default=latest]',\n ],\n ] as CommandOptions;\n\n constructor(private component: ComponentMain) {}\n\n private async getComponent(idStr: string, remote: boolean) {\n if (remote) {\n const id = ComponentID.fromString(idStr); // user used --remote so we know it has a scope\n const host = this.component.getHostIfExist('teambit.scope/scope');\n if (!host)\n throw new Error(`error: the current directory is not a workspace nor a scope. the full \"bit show\" is not supported.\nto see the legacy bit show, please use \"--legacy\" flag`);\n if (!host.getRemoteComponent) {\n throw new Error('Component Host does not implement getRemoteComponent()');\n }\n const component = await host.getRemoteComponent(id);\n return component;\n }\n const host = this.component.getHost();\n const id = await host.resolveComponentId(idStr);\n const component = await host.get(id);\n if (!component) throw new MissingBitMapComponent(idStr);\n return component;\n }\n\n async useLegacy(id: string, json = false, remote = false, compare = false) {\n const legacyShow = new LegacyShow();\n const showData = await legacyShow.action([id], {\n json,\n versions: undefined,\n remote,\n compare,\n });\n\n return legacyShow.report(showData);\n }\n\n async report([idStr]: [string], { legacy, remote, compare }: { legacy: boolean; remote: boolean; compare: boolean }) {\n if (legacy) return this.useLegacy(idStr, false, remote, compare);\n const component = await this.getComponent(idStr, remote);\n const fragments = this.component.getShowFragments();\n const rows = await Promise.all(\n fragments.map(async (fragment) => {\n const row = await fragment.renderRow(component);\n if (!row.content) return null;\n return [row.title, row.content];\n })\n );\n\n const table = new CLITable([], compact(rows));\n return table.render();\n }\n\n async json([idStr]: [string], { remote, legacy }: { remote: boolean; legacy: boolean }) {\n if (legacy) return JSON.parse(await this.useLegacy(idStr, true, remote));\n const component = await this.getComponent(idStr, remote);\n const fragments = this.component.getShowFragments();\n const rows = await Promise.all(\n fragments.map(async (fragment) => {\n return fragment.json ? fragment.json(component) : undefined;\n })\n );\n\n return rows.filter((row) => !!row);\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAE,UAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,SAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,YAAA;EAAA,MAAAH,IAAA,GAA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BAAO,EAACX,IAAI,CAAC,CAAC;IAC7C,OAAOS,KAAK,CAACG,MAAM,CAAC,CAAC;EACvB;EAEA,MAAMxB,IAAIA,CAAC,CAACd,KAAK,CAAW,EAAE;IAAEC,MAAM;IAAEsB;EAA6C,CAAC,EAAE;IACtF,IAAIA,MAAM,EAAE,OAAOgB,IAAI,CAACC,KAAK,CAAC,MAAM,IAAI,CAAC3B,SAAS,CAACb,KAAK,EAAE,IAAI,EAAEC,MAAM,CAAC,CAAC;IACxE,MAAML,SAAS,GAAG,MAAM,IAAI,CAACG,YAAY,CAACC,KAAK,EAAEC,MAAM,CAAC;IACxD,MAAMuB,SAAS,GAAG,IAAI,CAAC5B,SAAS,CAAC6B,gBAAgB,CAAC,CAAC;IACnD,MAAMC,IAAI,GAAG,MAAMC,OAAO,CAACC,GAAG,CAC5BJ,SAAS,CAACK,GAAG,CAAC,MAAOC,QAAQ,IAAK;MAChC,OAAOA,QAAQ,CAAChB,IAAI,GAAGgB,QAAQ,CAAChB,IAAI,CAAClB,SAAS,CAAC,GAAGyB,SAAS;IAC7D,CAAC,CACH,CAAC;IAED,OAAOK,IAAI,CAACe,MAAM,CAAEV,GAAG,IAAK,CAAC,CAACA,GAAG,CAAC;EACpC;AACF;AAACW,OAAA,CAAAhD,OAAA,GAAAA,OAAA"}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/component",
3
- "version": "1.0.177",
3
+ "version": "1.0.179",
4
4
  "homepage": "https://bit.cloud/teambit/component/component",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.component",
8
8
  "name": "component",
9
- "version": "1.0.177"
9
+ "version": "1.0.179"
10
10
  },
11
11
  "dependencies": {
12
12
  "@teambit/any-fs": "0.0.5",
@@ -33,40 +33,40 @@
33
33
  "@teambit/ui-foundation.ui.hooks.use-data-query": "0.0.505",
34
34
  "@teambit/legacy-component-log": "0.0.402",
35
35
  "@teambit/ui-foundation.ui.react-router.use-query": "0.0.501",
36
- "@teambit/design.ui.pages.not-found": "0.0.366",
37
- "@teambit/design.ui.pages.server-error": "0.0.366",
38
36
  "@teambit/design.ui.empty-box": "0.0.363",
39
37
  "@teambit/documenter.ui.heading": "4.1.1",
40
38
  "@teambit/documenter.ui.separator": "4.1.1",
39
+ "@teambit/design.ui.pages.not-found": "0.0.366",
40
+ "@teambit/design.ui.pages.server-error": "0.0.366",
41
+ "@teambit/design.ui.styles.ellipsis": "0.0.357",
42
+ "@teambit/explorer.ui.command-bar": "2.0.14",
41
43
  "@teambit/design.navigation.responsive-navbar": "0.0.7",
42
44
  "@teambit/base-ui.layout.breakpoints": "1.0.0",
43
45
  "@teambit/ui-foundation.ui.use-box.dropdown": "0.0.142",
44
- "@teambit/design.ui.styles.ellipsis": "0.0.357",
45
- "@teambit/explorer.ui.command-bar": "2.0.14",
46
- "@teambit/aspect-loader": "1.0.177",
47
- "@teambit/graph": "1.0.177",
46
+ "@teambit/aspect-loader": "1.0.179",
47
+ "@teambit/graph": "1.0.179",
48
48
  "@teambit/toolbox.path.match-patterns": "0.0.15",
49
49
  "@teambit/toolbox.string.capitalize": "0.0.496",
50
- "@teambit/cli": "0.0.851",
51
- "@teambit/express": "0.0.950",
52
- "@teambit/graphql": "1.0.177",
53
- "@teambit/command-bar": "1.0.177",
50
+ "@teambit/cli": "0.0.852",
51
+ "@teambit/express": "0.0.951",
52
+ "@teambit/graphql": "1.0.179",
53
+ "@teambit/command-bar": "1.0.179",
54
54
  "@teambit/component-package-version": "0.0.433",
55
- "@teambit/preview": "1.0.177",
56
- "@teambit/pubsub": "1.0.177",
57
- "@teambit/react-router": "1.0.177",
58
- "@teambit/ui": "1.0.177",
55
+ "@teambit/preview": "1.0.179",
56
+ "@teambit/pubsub": "1.0.179",
57
+ "@teambit/react-router": "1.0.179",
58
+ "@teambit/ui": "1.0.179",
59
59
  "@teambit/component-issues": "0.0.141",
60
60
  "@teambit/cli-table": "0.0.48",
61
61
  "@teambit/component-descriptor": "0.0.415",
62
62
  "@teambit/harmony.ui.aspect-box": "0.0.507",
63
- "@teambit/compositions": "1.0.177",
64
- "@teambit/deprecation": "1.0.177",
65
- "@teambit/envs": "1.0.177",
63
+ "@teambit/compositions": "1.0.179",
64
+ "@teambit/deprecation": "1.0.179",
65
+ "@teambit/envs": "1.0.179",
66
+ "@teambit/envs.ui.env-icon": "0.0.505",
66
67
  "@teambit/component.ui.version-dropdown": "0.0.855",
67
68
  "@teambit/lanes.hooks.use-lanes": "0.0.260",
68
- "@teambit/lanes.ui.models.lanes-model": "0.0.212",
69
- "@teambit/envs.ui.env-icon": "0.0.505"
69
+ "@teambit/lanes.ui.models.lanes-model": "0.0.212"
70
70
  },
71
71
  "devDependencies": {
72
72
  "@types/lodash": "4.14.165",
package/show/show.cmd.ts CHANGED
@@ -30,7 +30,10 @@ export class ShowCmd implements Command {
30
30
  private async getComponent(idStr: string, remote: boolean) {
31
31
  if (remote) {
32
32
  const id = ComponentID.fromString(idStr); // user used --remote so we know it has a scope
33
- const host = this.component.getHost('teambit.scope/scope');
33
+ const host = this.component.getHostIfExist('teambit.scope/scope');
34
+ if (!host)
35
+ throw new Error(`error: the current directory is not a workspace nor a scope. the full "bit show" is not supported.
36
+ to see the legacy bit show, please use "--legacy" flag`);
34
37
  if (!host.getRemoteComponent) {
35
38
  throw new Error('Component Host does not implement getRemoteComponent()');
36
39
  }