@teambit/component 1.0.176 → 1.0.178
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/artifacts/__bit_junit.xml +1 -1
- package/artifacts/preview/teambit_component_component-preview.js +1 -1
- package/artifacts/schema.json +201 -79
- package/dist/component.main.runtime.d.ts +1 -0
- package/dist/component.main.runtime.js +8 -0
- package/dist/component.main.runtime.js.map +1 -1
- package/dist/{preview-1709090190973.js → preview-1709263126667.js} +2 -2
- package/dist/show/show.cmd.js +3 -1
- package/dist/show/show.cmd.js.map +1 -1
- package/package.json +21 -21
- package/show/show.cmd.ts +4 -1
|
@@ -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,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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AAS,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,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KAAIC,wBAAgB,EAAC,CAAC,EACtB,KAAIC,kBAAU,EAAC,CAAC,EAChB,KAAIC,qBAAa,EAAC,CAAC,EACnB,KAAIC,qBAAa,EAAC,CAAC,EACnB,KAAIC,0BAAkB,EAAC,CAAC,CACzB,CAAC;IACFV,OAAO,CAACzC,QAAQ,CAAC,IAAAoD,6BAAe,EAACR,kBAAkB,CAAC,CAAC;IAErD,OAAOA,kBAAkB;EAC3B;AACF;AAACS,OAAA,CAAA5D,aAAA,GAAAA,aAAA;AAAArB,eAAA,CAlJYqB,aAAa,WAyHT,CAAC6D,eAAI,CAACC,QAAQ,CAAmB,CAAC,EAAED,eAAI,CAACC,QAAQ,CAAU,CAAC,EAAED,eAAI,CAACC,QAAQ,CAAiB,CAAC,CAAC;AAAAnF,eAAA,CAzHlGqB,aAAa,aA2HP+D,kBAAW;AAAApF,eAAA,CA3HjBqB,aAAa,kBA4HF,CAACgE,wBAAa,EAAEC,wBAAa,EAAEC,gBAAS,CAAC;AAwBjEC,4BAAe,CAACC,UAAU,CAACpE,aAAa,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_component@1.0.
|
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_component@1.0.
|
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_component@1.0.178/dist/component.composition.js';
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_component@1.0.178/dist/component.docs.mdx';
|
|
3
3
|
|
|
4
4
|
export const compositions = [compositions_0];
|
|
5
5
|
export const overview = [overview_0];
|
package/dist/show/show.cmd.js
CHANGED
|
@@ -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.
|
|
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","
|
|
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,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,CAAAR,GAAA,EAAAI,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YAAA,QA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K,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.
|
|
3
|
+
"version": "1.0.178",
|
|
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.
|
|
9
|
+
"version": "1.0.178"
|
|
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
|
-
"@teambit/design.ui.styles.ellipsis": "0.0.357",
|
|
39
|
-
"@teambit/explorer.ui.command-bar": "2.0.14",
|
|
40
36
|
"@teambit/design.ui.empty-box": "0.0.363",
|
|
41
37
|
"@teambit/documenter.ui.heading": "4.1.1",
|
|
42
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",
|
|
43
41
|
"@teambit/design.navigation.responsive-navbar": "0.0.7",
|
|
44
42
|
"@teambit/base-ui.layout.breakpoints": "1.0.0",
|
|
45
43
|
"@teambit/ui-foundation.ui.use-box.dropdown": "0.0.142",
|
|
46
|
-
"@teambit/
|
|
47
|
-
"@teambit/
|
|
44
|
+
"@teambit/design.ui.styles.ellipsis": "0.0.357",
|
|
45
|
+
"@teambit/explorer.ui.command-bar": "2.0.14",
|
|
46
|
+
"@teambit/aspect-loader": "1.0.178",
|
|
47
|
+
"@teambit/graph": "1.0.178",
|
|
48
48
|
"@teambit/toolbox.path.match-patterns": "0.0.15",
|
|
49
49
|
"@teambit/toolbox.string.capitalize": "0.0.496",
|
|
50
|
-
"@teambit/cli": "0.0.
|
|
51
|
-
"@teambit/express": "0.0.
|
|
52
|
-
"@teambit/graphql": "1.0.
|
|
53
|
-
"@teambit/command-bar": "1.0.
|
|
50
|
+
"@teambit/cli": "0.0.852",
|
|
51
|
+
"@teambit/express": "0.0.951",
|
|
52
|
+
"@teambit/graphql": "1.0.178",
|
|
53
|
+
"@teambit/command-bar": "1.0.178",
|
|
54
54
|
"@teambit/component-package-version": "0.0.433",
|
|
55
|
-
"@teambit/preview": "1.0.
|
|
56
|
-
"@teambit/pubsub": "1.0.
|
|
57
|
-
"@teambit/react-router": "1.0.
|
|
58
|
-
"@teambit/ui": "1.0.
|
|
55
|
+
"@teambit/preview": "1.0.178",
|
|
56
|
+
"@teambit/pubsub": "1.0.178",
|
|
57
|
+
"@teambit/react-router": "1.0.178",
|
|
58
|
+
"@teambit/ui": "1.0.178",
|
|
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
|
-
"@teambit/compositions": "1.0.176",
|
|
63
|
-
"@teambit/deprecation": "1.0.176",
|
|
64
|
-
"@teambit/envs": "1.0.176",
|
|
65
|
-
"@teambit/envs.ui.env-icon": "0.0.505",
|
|
66
62
|
"@teambit/harmony.ui.aspect-box": "0.0.507",
|
|
63
|
+
"@teambit/compositions": "1.0.178",
|
|
64
|
+
"@teambit/deprecation": "1.0.178",
|
|
65
|
+
"@teambit/envs": "1.0.178",
|
|
67
66
|
"@teambit/component.ui.version-dropdown": "0.0.855",
|
|
68
67
|
"@teambit/lanes.hooks.use-lanes": "0.0.260",
|
|
69
|
-
"@teambit/lanes.ui.models.lanes-model": "0.0.212"
|
|
68
|
+
"@teambit/lanes.ui.models.lanes-model": "0.0.212",
|
|
69
|
+
"@teambit/envs.ui.env-icon": "0.0.505"
|
|
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.
|
|
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
|
}
|