@teambit/component 0.0.760 → 0.0.763

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.
@@ -91,7 +91,7 @@ function componentSchema(componentExtension) {
91
91
  timestamp: String!
92
92
 
93
93
  # parents of the snap
94
- parents: [Snap]!
94
+ parents: [String]!
95
95
 
96
96
  # snapper
97
97
  author: Author!
@@ -1 +1 @@
1
- {"version":3,"names":["componentSchema","componentExtension","typeDefs","gql","resolvers","JSONObject","GraphQLJSONObject","Component","id","component","toObject","displayName","fs","state","filesystem","files","map","file","relative","getFile","path","maybeFile","find","pathNormalizeToLinux","undefined","contents","toString","mainFile","_consumer","headTag","latest","tags","toArray","tag","aspects","include","filter","serialize","logs","getLogs","log","hash","ComponentHost","get","host","componentId","resolveComponentId","error","snaps","list","listInvalid","invalidComps","err","errorName","name","errorMessage","message","stripAnsi","Query","getHost","componentExt"],"sources":["component.graphql.ts"],"sourcesContent":["import stripAnsi from 'strip-ansi';\nimport gql from 'graphql-tag';\nimport { GraphQLJSONObject } from 'graphql-type-json';\nimport { pathNormalizeToLinux } from '@teambit/legacy/dist/utils';\nimport { Component } from './component';\nimport { ComponentFactory } from './component-factory';\nimport { ComponentMain } from './component.main.runtime';\n\nexport function componentSchema(componentExtension: ComponentMain) {\n return {\n typeDefs: gql`\n scalar JSON\n scalar JSONObject\n\n type ComponentID {\n name: String!\n version: String\n scope: String\n }\n\n type Tag {\n # semver assigned to the tag.\n version: String!\n\n # tag hash.\n hash: String!\n }\n\n type Snap {\n # hash of the snapshot.\n hash: String!\n\n # time of the snapshot.\n timestamp: String!\n\n # parents of the snap\n parents: [Snap]!\n\n # snapper\n author: Author!\n\n # snapshot message\n message: String\n }\n\n type LogEntry {\n message: String!\n username: String\n email: String\n date: String\n hash: String!\n tag: String\n id: String!\n }\n\n type Author {\n # display name of the snapper.\n displayName: String!\n\n # author of the snapper.\n email: String!\n }\n\n type Component {\n # id of the component.\n id: ComponentID!\n\n # head snap of the component.\n head: Snap\n\n # head tag of the component.\n headTag: Tag\n\n # list of all relative component paths.\n fs: [String]\n\n # relative path to the main file of the component\n mainFile: String\n\n # return specific file contents by relative file path.\n getFile(path: String): String\n\n # latest version of the component.\n latest: String\n\n # display name of the component\n displayName: String!\n\n # component buildStatus\n buildStatus: String\n\n # list of component releases.\n tags: [Tag]!\n\n # component logs\n logs(type: String, offset: Int, limit: Int, head: String, sort: String): [LogEntry]!\n\n aspects(include: [String]): [Aspect]\n }\n\n type Aspect {\n id: String!\n icon: String\n config: JSONObject\n data: JSONObject\n }\n\n type InvalidComponent {\n id: ComponentID!\n errorName: String!\n errorMessage: String!\n }\n\n type ComponentHost {\n id: ID!\n name: String!\n\n # load a component.\n get(id: String!, withState: Boolean): Component\n\n # list components\n list(offset: Int, limit: Int): [Component]!\n\n # list invalid components and their errors\n listInvalid: [InvalidComponent]!\n\n # get component logs(snaps) by component id\n snaps(id: String!): [LogEntry]! @deprecated(reason: \"Use the logs field on Component\")\n }\n\n type Query {\n getHost(id: String): ComponentHost\n }\n `,\n resolvers: {\n JSONObject: GraphQLJSONObject,\n Component: {\n id: (component: Component) => component.id.toObject(),\n displayName: (component: Component) => component.displayName,\n fs: (component: Component) => {\n return component.state.filesystem.files.map((file) => file.relative);\n },\n getFile: (component: Component, { path }: { path: string }) => {\n const maybeFile = component.state.filesystem.files.find(\n (file) => pathNormalizeToLinux(file.relative) === path\n );\n if (!maybeFile) return undefined;\n return maybeFile.contents.toString('utf-8');\n },\n mainFile: (component: Component) => {\n return component.state._consumer.mainFile;\n },\n headTag: (component: Component) => component.headTag?.toObject(),\n latest: (component: Component) => component.latest,\n tags: (component) => {\n // graphql doesn't support map types\n return component.tags.toArray().map((tag) => tag.toObject());\n },\n aspects: (component: Component, { include }: { include?: string[] }) => {\n return component.state.aspects.filter(include).serialize();\n },\n logs: async (\n component: Component,\n filter?: { type?: string; offset?: number; limit?: number; head?: string; sort?: string }\n ) => {\n return (await component.getLogs(filter)).map((log) => ({ ...log, id: log.hash }));\n },\n },\n ComponentHost: {\n get: async (host: ComponentFactory, { id }: { id: string }) => {\n try {\n const componentId = await host.resolveComponentId(id);\n const component = await host.get(componentId);\n return component;\n } catch (error: any) {\n return null;\n }\n },\n snaps: async (host: ComponentFactory, { id }: { id: string }) => {\n const componentId = await host.resolveComponentId(id);\n // return (await host.getLogs(componentId)).map(log => ({...log, id: log.hash}))\n return host.getLogs(componentId);\n },\n list: async (host: ComponentFactory, filter?: { offset: number; limit: number }) => {\n return host.list(filter);\n },\n listInvalid: async (host: ComponentFactory) => {\n const invalidComps = await host.listInvalid();\n return invalidComps.map(({ id, err }) => ({\n id,\n errorName: err.name,\n errorMessage: err.message ? stripAnsi(err.message) : err.name,\n }));\n },\n id: async (host: ComponentFactory) => {\n return host.name;\n },\n name: async (host: ComponentFactory) => {\n return host.name;\n },\n },\n Query: {\n getHost: (componentExt: ComponentMain, { id }: { id: string }) => {\n return componentExtension.getHost(id);\n },\n },\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;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;;;;;;AAKO,SAASA,eAAT,CAAyBC,kBAAzB,EAA4D;EACjE,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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,CAdY;QAebI,IAAI,EAAE,OAAOL,IAAP,EAA+BR,MAA/B,KAA8E;UAClF,OAAOQ,IAAI,CAACK,IAAL,CAAUb,MAAV,CAAP;QACD,CAjBY;QAkBbc,WAAW,EAAE,MAAON,IAAP,IAAkC;UAC7C,MAAMO,YAAY,GAAG,MAAMP,IAAI,CAACM,WAAL,EAA3B;UACA,OAAOC,YAAY,CAACnC,GAAb,CAAiB,CAAC;YAAER,EAAF;YAAM4C;UAAN,CAAD,MAAkB;YACxC5C,EADwC;YAExC6C,SAAS,EAAED,GAAG,CAACE,IAFyB;YAGxCC,YAAY,EAAEH,GAAG,CAACI,OAAJ,GAAc,IAAAC,oBAAA,EAAUL,GAAG,CAACI,OAAd,CAAd,GAAuCJ,GAAG,CAACE;UAHjB,CAAlB,CAAjB,CAAP;QAKD,CAzBY;QA0Bb9C,EAAE,EAAE,MAAOoC,IAAP,IAAkC;UACpC,OAAOA,IAAI,CAACU,IAAZ;QACD,CA5BY;QA6BbA,IAAI,EAAE,MAAOV,IAAP,IAAkC;UACtC,OAAOA,IAAI,CAACU,IAAZ;QACD;MA/BY,CAlCN;MAmETI,KAAK,EAAE;QACLC,OAAO,EAAE,CAACC,YAAD,EAA8B;UAAEpD;QAAF,CAA9B,KAAyD;UAChE,OAAOP,kBAAkB,CAAC0D,OAAnB,CAA2BnD,EAA3B,CAAP;QACD;MAHI;IAnEE;EA7HN,CAAP;AAuMD"}
1
+ {"version":3,"names":["componentSchema","componentExtension","typeDefs","gql","resolvers","JSONObject","GraphQLJSONObject","Component","id","component","toObject","displayName","fs","state","filesystem","files","map","file","relative","getFile","path","maybeFile","find","pathNormalizeToLinux","undefined","contents","toString","mainFile","_consumer","headTag","latest","tags","toArray","tag","aspects","include","filter","serialize","logs","getLogs","log","hash","ComponentHost","get","host","componentId","resolveComponentId","error","snaps","list","listInvalid","invalidComps","err","errorName","name","errorMessage","message","stripAnsi","Query","getHost","componentExt"],"sources":["component.graphql.ts"],"sourcesContent":["import stripAnsi from 'strip-ansi';\nimport gql from 'graphql-tag';\nimport { GraphQLJSONObject } from 'graphql-type-json';\nimport { pathNormalizeToLinux } from '@teambit/legacy/dist/utils';\nimport { Component } from './component';\nimport { ComponentFactory } from './component-factory';\nimport { ComponentMain } from './component.main.runtime';\n\nexport function componentSchema(componentExtension: ComponentMain) {\n return {\n typeDefs: gql`\n scalar JSON\n scalar JSONObject\n\n type ComponentID {\n name: String!\n version: String\n scope: String\n }\n\n type Tag {\n # semver assigned to the tag.\n version: String!\n\n # tag hash.\n hash: String!\n }\n\n type Snap {\n # hash of the snapshot.\n hash: String!\n\n # time of the snapshot.\n timestamp: String!\n\n # parents of the snap\n parents: [String]!\n\n # snapper\n author: Author!\n\n # snapshot message\n message: String\n }\n\n type LogEntry {\n message: String!\n username: String\n email: String\n date: String\n hash: String!\n tag: String\n id: String!\n }\n\n type Author {\n # display name of the snapper.\n displayName: String!\n\n # author of the snapper.\n email: String!\n }\n\n type Component {\n # id of the component.\n id: ComponentID!\n\n # head snap of the component.\n head: Snap\n\n # head tag of the component.\n headTag: Tag\n\n # list of all relative component paths.\n fs: [String]\n\n # relative path to the main file of the component\n mainFile: String\n\n # return specific file contents by relative file path.\n getFile(path: String): String\n\n # latest version of the component.\n latest: String\n\n # display name of the component\n displayName: String!\n\n # component buildStatus\n buildStatus: String\n\n # list of component releases.\n tags: [Tag]!\n\n # component logs\n logs(type: String, offset: Int, limit: Int, head: String, sort: String): [LogEntry]!\n\n aspects(include: [String]): [Aspect]\n }\n\n type Aspect {\n id: String!\n icon: String\n config: JSONObject\n data: JSONObject\n }\n\n type InvalidComponent {\n id: ComponentID!\n errorName: String!\n errorMessage: String!\n }\n\n type ComponentHost {\n id: ID!\n name: String!\n\n # load a component.\n get(id: String!, withState: Boolean): Component\n\n # list components\n list(offset: Int, limit: Int): [Component]!\n\n # list invalid components and their errors\n listInvalid: [InvalidComponent]!\n\n # get component logs(snaps) by component id\n snaps(id: String!): [LogEntry]! @deprecated(reason: \"Use the logs field on Component\")\n }\n\n type Query {\n getHost(id: String): ComponentHost\n }\n `,\n resolvers: {\n JSONObject: GraphQLJSONObject,\n Component: {\n id: (component: Component) => component.id.toObject(),\n displayName: (component: Component) => component.displayName,\n fs: (component: Component) => {\n return component.state.filesystem.files.map((file) => file.relative);\n },\n getFile: (component: Component, { path }: { path: string }) => {\n const maybeFile = component.state.filesystem.files.find(\n (file) => pathNormalizeToLinux(file.relative) === path\n );\n if (!maybeFile) return undefined;\n return maybeFile.contents.toString('utf-8');\n },\n mainFile: (component: Component) => {\n return component.state._consumer.mainFile;\n },\n headTag: (component: Component) => component.headTag?.toObject(),\n latest: (component: Component) => component.latest,\n tags: (component) => {\n // graphql doesn't support map types\n return component.tags.toArray().map((tag) => tag.toObject());\n },\n aspects: (component: Component, { include }: { include?: string[] }) => {\n return component.state.aspects.filter(include).serialize();\n },\n logs: async (\n component: Component,\n filter?: { type?: string; offset?: number; limit?: number; head?: string; sort?: string }\n ) => {\n return (await component.getLogs(filter)).map((log) => ({ ...log, id: log.hash }));\n },\n },\n ComponentHost: {\n get: async (host: ComponentFactory, { id }: { id: string }) => {\n try {\n const componentId = await host.resolveComponentId(id);\n const component = await host.get(componentId);\n return component;\n } catch (error: any) {\n return null;\n }\n },\n snaps: async (host: ComponentFactory, { id }: { id: string }) => {\n const componentId = await host.resolveComponentId(id);\n // return (await host.getLogs(componentId)).map(log => ({...log, id: log.hash}))\n return host.getLogs(componentId);\n },\n list: async (host: ComponentFactory, filter?: { offset: number; limit: number }) => {\n return host.list(filter);\n },\n listInvalid: async (host: ComponentFactory) => {\n const invalidComps = await host.listInvalid();\n return invalidComps.map(({ id, err }) => ({\n id,\n errorName: err.name,\n errorMessage: err.message ? stripAnsi(err.message) : err.name,\n }));\n },\n id: async (host: ComponentFactory) => {\n return host.name;\n },\n name: async (host: ComponentFactory) => {\n return host.name;\n },\n },\n Query: {\n getHost: (componentExt: ComponentMain, { id }: { id: string }) => {\n return componentExtension.getHost(id);\n },\n },\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;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;;;;;;AAKO,SAASA,eAAT,CAAyBC,kBAAzB,EAA4D;EACjE,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;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,KA5HS;IA6HLC,SAAS,EAAE;MACTC,UAAU,EAAEC,oCADH;MAETC,SAAS,EAAE;QACTC,EAAE,EAAGC,SAAD,IAA0BA,SAAS,CAACD,EAAV,CAAaE,QAAb,EADrB;QAETC,WAAW,EAAGF,SAAD,IAA0BA,SAAS,CAACE,WAFxC;QAGTC,EAAE,EAAGH,SAAD,IAA0B;UAC5B,OAAOA,SAAS,CAACI,KAAV,CAAgBC,UAAhB,CAA2BC,KAA3B,CAAiCC,GAAjC,CAAsCC,IA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6BbA,IAAI,EAAE,MAAOV,IAAP,IAAkC;UACtC,OAAOA,IAAI,CAACU,IAAZ;QACD;MA/BY,CAlCN;MAmETI,KAAK,EAAE;QACLC,OAAO,EAAE,CAACC,YAAD,EAA8B;UAAEpD;QAAF,CAA9B,KAAyD;UAChE,OAAOP,kBAAkB,CAAC0D,OAAnB,CAA2BnD,EAA3B,CAAP;QACD;MAHI;IAnEE;EA7HN,CAAP;AAuMD"}
@@ -6,6 +6,10 @@ export declare class ShowCmd implements Command {
6
6
  description: string;
7
7
  alias: string;
8
8
  group: string;
9
+ arguments: {
10
+ name: string;
11
+ description: string;
12
+ }[];
9
13
  options: CommandOptions;
10
14
  constructor(component: ComponentMain);
11
15
  private getComponent;
@@ -76,11 +76,15 @@ function _showCmd() {
76
76
  class ShowCmd {
77
77
  constructor(component) {
78
78
  this.component = component;
79
- (0, _defineProperty2().default)(this, "name", 'show <id>');
80
- (0, _defineProperty2().default)(this, "description", 'show a component');
79
+ (0, _defineProperty2().default)(this, "name", 'show <component-name>');
80
+ (0, _defineProperty2().default)(this, "description", "display the component's essential information");
81
81
  (0, _defineProperty2().default)(this, "alias", '');
82
82
  (0, _defineProperty2().default)(this, "group", 'info');
83
- (0, _defineProperty2().default)(this, "options", [['j', 'json', 'return the component data in json format'], ['l', 'legacy', 'use the legacy bit show.'], ['r', 'remote', 'show a remote component'], ['c', 'compare', 'compare current file system component to latest tagged component [default=latest]. only works in legacy.']]);
83
+ (0, _defineProperty2().default)(this, "arguments", [{
84
+ name: 'component-name',
85
+ description: 'component name or component id'
86
+ }]);
87
+ (0, _defineProperty2().default)(this, "options", [['j', 'json', 'return the component data in a json format'], ['l', 'legacy', 'use the legacy bit show.'], ['r', 'remote', 'show a remote component'], ['c', 'compare', 'compare current file system component to the latest tagged component [default=latest]. only works in legacy.']]);
84
88
  }
85
89
 
86
90
  async getComponent(idStr, remote) {
@@ -1 +1 @@
1
- {"version":3,"names":["ShowCmd","constructor","component","getComponent","idStr","remote","bitId","BitId","parse","host","getHost","id","resolveComponentId","getRemoteComponent","Error","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","filter"],"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 { BitId } from '@teambit/legacy-bit-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 <id>';\n description = 'show a component';\n alias = '';\n group = 'info';\n options = [\n ['j', 'json', 'return the component data in json format'],\n ['l', 'legacy', 'use the legacy bit show.'],\n ['r', 'remote', 'show a remote component'],\n [\n 'c',\n 'compare',\n 'compare current file system component to latest tagged component [default=latest]. only works in legacy.',\n ],\n ] as CommandOptions;\n\n constructor(private component: ComponentMain) {}\n\n private async getComponent(idStr: string, remote: boolean) {\n if (remote) {\n const bitId: BitId = BitId.parse(idStr, true); // user used --remote so we know it has a scope\n const host = this.component.getHost('teambit.scope/scope');\n const id = await host.resolveComponentId(bitId);\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;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGA;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;;AALA;AACA;AAOO,MAAMA,OAAN,CAAiC;EAgBtCC,WAAW,CAASC,SAAT,EAAmC;IAAA,KAA1BA,SAA0B,GAA1BA,SAA0B;IAAA,8CAfvC,WAeuC;IAAA,qDAdhC,kBAcgC;IAAA,+CAbtC,EAasC;IAAA,+CAZtC,MAYsC;IAAA,iDAXpC,CACR,CAAC,GAAD,EAAM,MAAN,EAAc,0CAAd,CADQ,EAER,CAAC,GAAD,EAAM,QAAN,EAAgB,0BAAhB,CAFQ,EAGR,CAAC,GAAD,EAAM,QAAN,EAAgB,yBAAhB,CAHQ,EAIR,CACE,GADF,EAEE,SAFF,EAGE,0GAHF,CAJQ,CAWoC;EAAE;;EAEtB,MAAZC,YAAY,CAACC,KAAD,EAAgBC,MAAhB,EAAiC;IACzD,IAAIA,MAAJ,EAAY;MACV,MAAM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Q,CAAChB,IAAT,GAAgBgB,QAAQ,CAAChB,IAAT,CAAchB,SAAd,CAAhB,GAA2CuB,SAAlD;IACD,CAFD,CADiB,CAAnB;IAMA,OAAOK,IAAI,CAACc,MAAL,CAAaT,GAAD,IAAS,CAAC,CAACA,GAAvB,CAAP;EACD;;AA3EqC"}
1
+ {"version":3,"names":["ShowCmd","constructor","component","name","description","getComponent","idStr","remote","bitId","BitId","parse","host","getHost","id","resolveComponentId","getRemoteComponent","Error","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","filter"],"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 { BitId } from '@teambit/legacy-bit-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 a json format'],\n ['l', 'legacy', 'use the legacy bit show.'],\n ['r', 'remote', 'show a remote component'],\n [\n 'c',\n 'compare',\n 'compare current file system component to the latest tagged component [default=latest]. only works in legacy.',\n ],\n ] as CommandOptions;\n\n constructor(private component: ComponentMain) {}\n\n private async getComponent(idStr: string, remote: boolean) {\n if (remote) {\n const bitId: BitId = BitId.parse(idStr, true); // user used --remote so we know it has a scope\n const host = this.component.getHost('teambit.scope/scope');\n const id = await host.resolveComponentId(bitId);\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;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGA;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;;AALA;AACA;AAOO,MAAMA,OAAN,CAAiC;EAiBtCC,WAAW,CAASC,SAAT,EAAmC;IAAA,KAA1BA,SAA0B,GAA1BA,SAA0B;IAAA,8CAhBvC,uBAgBuC;IAAA,qDAfhC,+CAegC;IAAA,+CAdtC,EAcsC;IAAA,+CAbtC,MAasC;IAAA,mDAZlC,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,IAAIA,MAAJ,EAAY,OAAOgB,IAAI,CAACnC,KAAL,CAAW,MAAM,KAAKS,SAAL,CAAeb,KAAf,EAAsB,IAAtB,EAA4BC,MAA5B,CAAjB,CAAP;IACZ,MAAML,SAAS,GAAG,MAAM,KAAKG,YAAL,CAAkBC,KAAlB,EAAyBC,MAAzB,CAAxB;IACA,MAAMuB,SAAS,GAAG,KAAK5B,SAAL,CAAe6B,gBAAf,EAAlB;IACA,MAAMC,IAAI,GAAG,MAAMC,OAAO,CAACC,GAAR,CACjBJ,SAAS,CAACK,GAAV,CAAc,MAAOC,QAAP,IAAoB;MAChC,OAAOA,QAAQ,CAAChB,IAAT,GAAgBgB,QAAQ,CAAChB,IAAT,CAAclB,SAAd,CAAhB,GAA2CyB,SAAlD;IACD,CAFD,CADiB,CAAnB;IAMA,OAAOK,IAAI,CAACc,MAAL,CAAaT,GAAD,IAAS,CAAC,CAACA,GAAvB,CAAP;EACD;;AA5EqC"}
@@ -3,6 +3,7 @@ import { DeprecationInfo } from '@teambit/deprecation';
3
3
  import { Descriptor } from '@teambit/envs';
4
4
  import { ComponentID, ComponentIdObj } from '@teambit/component-id';
5
5
  import { LegacyComponentLog } from '@teambit/legacy-component-log';
6
+ import { ComponentPreviewSize } from '@teambit/preview';
6
7
  import { TagMap } from '../../tag-map';
7
8
  import { TagProps } from '../../tag/tag';
8
9
  export declare type ComponentModelProps = {
@@ -24,6 +25,7 @@ export declare type ComponentModelProps = {
24
25
  latest?: string;
25
26
  preview?: ComponentPreview;
26
27
  logs?: LegacyComponentLog[];
28
+ size?: ComponentPreviewSize;
27
29
  };
28
30
  export declare type ComponentPreview = {
29
31
  includesEnvTemplate?: boolean;
@@ -91,6 +93,11 @@ export declare class ComponentModel {
91
93
  * host of the component
92
94
  */
93
95
  readonly host?: string | undefined;
96
+ /**
97
+ *
98
+ * size preview
99
+ */
100
+ readonly size?: ComponentPreviewSize | undefined;
94
101
  /**
95
102
  * latest version of component
96
103
  */
@@ -154,6 +161,11 @@ export declare class ComponentModel {
154
161
  * host of the component
155
162
  */
156
163
  host?: string | undefined,
164
+ /**
165
+ *
166
+ * size preview
167
+ */
168
+ size?: ComponentPreviewSize | undefined,
157
169
  /**
158
170
  * latest version of component
159
171
  */
@@ -162,7 +174,7 @@ export declare class ComponentModel {
162
174
  /**
163
175
  * create an instance of a component from a plain object.
164
176
  */
165
- static from({ id, server, displayName, compositions, packageName, elementsUrl, tags, deprecation, buildStatus, env, status, issuesCount, description, labels, host, latest, preview, logs, }: ComponentModelProps): ComponentModel;
177
+ static from({ id, server, displayName, compositions, packageName, elementsUrl, tags, deprecation, buildStatus, env, status, issuesCount, description, labels, host, latest, preview, size, logs, }: ComponentModelProps): ComponentModel;
166
178
  static fromArray(componentsProps: ComponentModelProps[]): ComponentModel[];
167
179
  static empty(): ComponentModel;
168
180
  }
@@ -105,6 +105,11 @@ class ComponentModel {
105
105
  * host of the component
106
106
  */
107
107
  host,
108
+ /**
109
+ *
110
+ * size preview
111
+ */
112
+ size,
108
113
  /**
109
114
  * latest version of component
110
115
  */
@@ -124,6 +129,7 @@ class ComponentModel {
124
129
  this.description = description;
125
130
  this.labels = labels;
126
131
  this.host = host;
132
+ this.size = size;
127
133
  this.latest = latest;
128
134
  this.preview = preview;
129
135
  this.logs = logs;
@@ -156,9 +162,10 @@ class ComponentModel {
156
162
  host,
157
163
  latest,
158
164
  preview,
165
+ size,
159
166
  logs
160
167
  }) {
161
- return new ComponentModel(_componentId().ComponentID.fromObject(id), displayName, packageName, server, _compositions().Composition.fromArray(compositions), _tagMap().TagMap.fromArray(tags.map(tag => _tag().Tag.fromObject(tag))), buildStatus, issuesCount, elementsUrl, status, deprecation, env, description, labels, host, latest, preview, logs);
168
+ return new ComponentModel(_componentId().ComponentID.fromObject(id), displayName, packageName, server, _compositions().Composition.fromArray(compositions), _tagMap().TagMap.fromArray(tags.map(tag => _tag().Tag.fromObject(tag))), buildStatus, issuesCount, elementsUrl, status, deprecation, env, description, labels, host, size, latest, preview, logs);
162
169
  }
163
170
 
164
171
  static fromArray(componentsProps) {
@@ -1 +1 @@
1
- {"version":3,"names":["ComponentModel","constructor","id","displayName","packageName","server","compositions","tags","buildStatus","issuesCount","elementsUrl","status","deprecation","environment","description","labels","host","latest","preview","logs","version","from","env","ComponentID","fromObject","Composition","fromArray","TagMap","map","tag","Tag","componentsProps","rawComponent","empty","name","scope","url"],"sources":["component-model.ts"],"sourcesContent":["import { Composition, CompositionProps } from '@teambit/compositions';\nimport { DeprecationInfo } from '@teambit/deprecation';\nimport { Descriptor } from '@teambit/envs';\nimport { ComponentID, ComponentIdObj } from '@teambit/component-id';\nimport { LegacyComponentLog } from '@teambit/legacy-component-log';\nimport { Tag } from '../../tag';\nimport { TagMap } from '../../tag-map';\nimport { TagProps } from '../../tag/tag';\n// import { Snap } from '../../snap';\n\n// ADDING MORE PROPERTIES HERE IS NOT ALLOWED!!! IF YOU NEED DATA PLEASE ADD A NEW\n// HOOK FROM YOUR ASPECT!!!\n// TODO: remove all properties from here to their rightful place in their aspects.\nexport type ComponentModelProps = {\n id: ComponentIdObj;\n description: string;\n buildStatus?: string;\n server?: ComponentServer;\n displayName: string;\n packageName: string; // pkg aspect\n elementsUrl?: string; // pkg aspect\n compositions?: CompositionProps[];\n tags?: TagProps[];\n issuesCount?: number; // component/issues aspect\n status?: any; // workspace aspect.\n deprecation?: DeprecationInfo; // deprecation aspect\n env?: Descriptor; // env aspect.\n labels?: string[];\n host?: string;\n latest?: string;\n preview?: ComponentPreview;\n logs?: LegacyComponentLog[];\n};\n\nexport type ComponentPreview = {\n includesEnvTemplate?: boolean;\n legacyHeader?: boolean;\n};\n\nexport type ComponentServer = {\n env: string;\n url: string;\n};\n\nexport class ComponentModel {\n constructor(\n /**\n * id of the component\n */\n readonly id: ComponentID,\n\n /**\n * display name of the component.\n */\n readonly displayName: string,\n\n /**\n * package name of the component.\n */\n readonly packageName: string,\n\n /**\n * the component server.\n */\n readonly server: ComponentServer | undefined,\n\n /**\n * array of compositions\n */\n readonly compositions: Composition[],\n\n /**\n * tags of the component.\n */\n readonly tags: TagMap,\n\n /**\n * component build status\n */\n readonly buildStatus?: string,\n\n /**\n * issues of component.\n */\n readonly issuesCount?: number,\n /**\n * elements url\n */\n readonly elementsUrl?: string,\n /**\n * status of component.\n */\n readonly status?: any,\n\n /**\n * deprecation info of the component.\n */\n readonly deprecation?: DeprecationInfo,\n\n /**\n * env descriptor.\n */\n readonly environment?: Descriptor,\n\n /**\n * description of the component.\n */\n\n readonly description = '',\n\n readonly labels: string[] = [],\n\n /**\n * host of the component\n */\n readonly host?: string,\n\n /**\n * latest version of component\n */\n readonly latest?: string,\n\n readonly preview?: ComponentPreview,\n\n readonly logs?: LegacyComponentLog[]\n ) {}\n\n get version() {\n if (!this.id.version) return 'new';\n return this.id.version;\n }\n\n /**\n * create an instance of a component from a plain object.\n */\n static from({\n id,\n server,\n displayName,\n compositions = [],\n packageName,\n elementsUrl,\n tags = [],\n deprecation,\n buildStatus,\n env,\n status,\n issuesCount,\n description,\n labels,\n host,\n latest,\n preview,\n logs,\n }: ComponentModelProps) {\n return new ComponentModel(\n ComponentID.fromObject(id),\n displayName,\n packageName,\n server,\n Composition.fromArray(compositions),\n TagMap.fromArray(tags.map((tag) => Tag.fromObject(tag))),\n buildStatus,\n issuesCount,\n elementsUrl,\n status,\n deprecation,\n env,\n description,\n labels,\n host,\n latest,\n preview,\n logs\n );\n }\n\n static fromArray(componentsProps: ComponentModelProps[]) {\n return componentsProps.map((rawComponent) => ComponentModel.from(rawComponent));\n }\n\n static empty() {\n return new ComponentModel(\n ComponentID.fromObject({ name: 'root', scope: 'temp' }),\n '',\n '',\n { env: '', url: '' },\n [],\n TagMap.empty()\n );\n }\n}\n"],"mappings":";;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;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,CAAvB,CADK,EAEL,EAFK,EAGL,EAHK,EAIL;MAAEb,GAAG,EAAE,EAAP;MAAWc,GAAG,EAAE;IAAhB,CAJK,EAKL,EALK,EAMLT,gBAAA,CAAOM,KAAP,EANK,CAAP;EAQD;;AAlJyB"}
1
+ {"version":3,"names":["ComponentModel","constructor","id","displayName","packageName","server","compositions","tags","buildStatus","issuesCount","elementsUrl","status","deprecation","environment","description","labels","host","size","latest","preview","logs","version","from","env","ComponentID","fromObject","Composition","fromArray","TagMap","map","tag","Tag","componentsProps","rawComponent","empty","name","scope","url"],"sources":["component-model.ts"],"sourcesContent":["import { Composition, CompositionProps } from '@teambit/compositions';\nimport { DeprecationInfo } from '@teambit/deprecation';\nimport { Descriptor } from '@teambit/envs';\nimport { ComponentID, ComponentIdObj } from '@teambit/component-id';\nimport { LegacyComponentLog } from '@teambit/legacy-component-log';\nimport { ComponentPreviewSize } from '@teambit/preview';\nimport { Tag } from '../../tag';\nimport { TagMap } from '../../tag-map';\nimport { TagProps } from '../../tag/tag';\n// import { Snap } from '../../snap';\n\n// ADDING MORE PROPERTIES HERE IS NOT ALLOWED!!! IF YOU NEED DATA PLEASE ADD A NEW\n// HOOK FROM YOUR ASPECT!!!\n// TODO: remove all properties from here to their rightful place in their aspects.\nexport type ComponentModelProps = {\n id: ComponentIdObj;\n description: string;\n buildStatus?: string;\n server?: ComponentServer;\n displayName: string;\n packageName: string; // pkg aspect\n elementsUrl?: string; // pkg aspect\n compositions?: CompositionProps[];\n tags?: TagProps[];\n issuesCount?: number; // component/issues aspect\n status?: any; // workspace aspect.\n deprecation?: DeprecationInfo; // deprecation aspect\n env?: Descriptor; // env aspect.\n labels?: string[];\n host?: string;\n latest?: string;\n preview?: ComponentPreview;\n logs?: LegacyComponentLog[];\n size?: ComponentPreviewSize;\n};\n\nexport type ComponentPreview = {\n includesEnvTemplate?: boolean;\n legacyHeader?: boolean;\n};\n\nexport type ComponentServer = {\n env: string;\n url: string;\n};\n\nexport class ComponentModel {\n constructor(\n /**\n * id of the component\n */\n readonly id: ComponentID,\n\n /**\n * display name of the component.\n */\n readonly displayName: string,\n\n /**\n * package name of the component.\n */\n readonly packageName: string,\n\n /**\n * the component server.\n */\n readonly server: ComponentServer | undefined,\n\n /**\n * array of compositions\n */\n readonly compositions: Composition[],\n\n /**\n * tags of the component.\n */\n readonly tags: TagMap,\n\n /**\n * component build status\n */\n readonly buildStatus?: string,\n\n /**\n * issues of component.\n */\n readonly issuesCount?: number,\n /**\n * elements url\n */\n readonly elementsUrl?: string,\n /**\n * status of component.\n */\n readonly status?: any,\n\n /**\n * deprecation info of the component.\n */\n readonly deprecation?: DeprecationInfo,\n\n /**\n * env descriptor.\n */\n readonly environment?: Descriptor,\n\n /**\n * description of the component.\n */\n\n readonly description = '',\n\n readonly labels: string[] = [],\n\n /**\n * host of the component\n */\n readonly host?: string,\n\n /**\n *\n * size preview\n */\n readonly size?: ComponentPreviewSize,\n\n /**\n * latest version of component\n */\n readonly latest?: string,\n\n readonly preview?: ComponentPreview,\n\n readonly logs?: LegacyComponentLog[]\n ) {}\n\n get version() {\n if (!this.id.version) return 'new';\n return this.id.version;\n }\n\n /**\n * create an instance of a component from a plain object.\n */\n static from({\n id,\n server,\n displayName,\n compositions = [],\n packageName,\n elementsUrl,\n tags = [],\n deprecation,\n buildStatus,\n env,\n status,\n issuesCount,\n description,\n labels,\n host,\n latest,\n preview,\n size,\n logs,\n }: ComponentModelProps) {\n return new ComponentModel(\n ComponentID.fromObject(id),\n displayName,\n packageName,\n server,\n Composition.fromArray(compositions),\n TagMap.fromArray(tags.map((tag) => Tag.fromObject(tag))),\n buildStatus,\n issuesCount,\n elementsUrl,\n status,\n deprecation,\n env,\n description,\n labels,\n host,\n size,\n latest,\n preview,\n logs\n );\n }\n\n static fromArray(componentsProps: ComponentModelProps[]) {\n return componentsProps.map((rawComponent) => ComponentModel.from(rawComponent));\n }\n\n static empty() {\n return new ComponentModel(\n ComponentID.fromObject({ name: 'root', scope: 'temp' }),\n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BLC,OAlBK,EAmBLC,IAnBK,CAAP;EAqBD;;EAEe,OAATO,SAAS,CAACK,eAAD,EAAyC;IACvD,OAAOA,eAAe,CAACH,GAAhB,CAAqBI,YAAD,IAAkBjC,cAAc,CAACsB,IAAf,CAAoBW,YAApB,CAAtC,CAAP;EACD;;EAEW,OAALC,KAAK,GAAG;IACb,OAAO,IAAIlC,cAAJ,CACLwB,0BAAA,CAAYC,UAAZ,CAAuB;MAAEU,IAAI,EAAE,MAAR;MAAgBC,KAAK,EAAE;IAAvB,CAAvB,CADK,EAEL,EAFK,EAGL,EAHK,EAIL;MAAEb,GAAG,EAAE,EAAP;MAAWc,GAAG,EAAE;IAAhB,CAJK,EAKL,EALK,EAMLT,gBAAA,CAAOM,KAAP,EANK,CAAP;EAQD;;AA1JyB"}
@@ -115,7 +115,7 @@ const componentOverviewFields = (0, _client().gql)`
115
115
  id {
116
116
  ...componentIdFields
117
117
  }
118
- aspects(include: ["teambit.preview/preview", "teambit.pipelines/builder", "teambit.envs/envs"]) {
118
+ aspects(include: ["teambit.preview/preview", "teambit.envs/envs"]) {
119
119
  # 'id' property in gql refers to a *global* identifier and used for caching.
120
120
  # this makes aspect data cache under the same key, even when they are under different components.
121
121
  # renaming the property fixes that.
@@ -138,6 +138,9 @@ const componentOverviewFields = (0, _client().gql)`
138
138
  id
139
139
  icon
140
140
  }
141
+ size {
142
+ compressedTotal
143
+ }
141
144
  preview {
142
145
  includesEnvTemplate
143
146
  legacyHeader
@@ -1 +1 @@
1
- {"version":3,"names":["componentIdFields","gql","componentOverviewFields","componentFields","GET_COMPONENT","SUB_SUBSCRIPTION_ADDED","SUB_COMPONENT_CHANGED","SUB_COMPONENT_REMOVED","useComponentQuery","componentId","host","filters","idRef","useRef","current","useDataQuery","variables","id","extensionId","log","data","error","loading","subscribeToMore","rest","useEffect","unsubAddition","document","updateQuery","prev","subscriptionData","prevComponent","getHost","get","addedComponent","componentAdded","component","name","unsubChanges","updatedComponent","componentChanged","isUpdated","ComponentID","isEqualObj","unsubRemoval","removedIds","componentRemoved","componentIds","length","isRemoved","some","removedId","rawComponent","useMemo","aspectList","entries","aspects","fromObject","componentDescriptor","ComponentDescriptor","toString","undefined","ComponentModel","from","ComponentError","message"],"sources":["use-component-query.ts"],"sourcesContent":["import { useMemo, useEffect, useRef } from 'react';\nimport { gql } from '@apollo/client';\nimport { useDataQuery } from '@teambit/ui-foundation.ui.hooks.use-data-query';\nimport { ComponentID, ComponentIdObj } from '@teambit/component-id';\nimport { ComponentDescriptor } from '@teambit/component-descriptor';\n\nimport { ComponentModel } from './component-model';\nimport { ComponentError } from './component-error';\n\nexport const componentIdFields = gql`\n fragment componentIdFields on ComponentID {\n name\n version\n scope\n }\n`;\n\nexport const componentOverviewFields = gql`\n fragment componentOverviewFields on Component {\n id {\n ...componentIdFields\n }\n aspects(include: [\"teambit.preview/preview\", \"teambit.pipelines/builder\", \"teambit.envs/envs\"]) {\n # 'id' property in gql refers to a *global* identifier and used for caching.\n # this makes aspect data cache under the same key, even when they are under different components.\n # renaming the property fixes that.\n aspectId: id\n aspectData: data\n }\n elementsUrl\n description\n deprecation {\n isDeprecate\n }\n labels\n displayName\n server {\n env\n url\n }\n buildStatus\n env {\n id\n icon\n }\n preview {\n includesEnvTemplate\n legacyHeader\n }\n compositions {\n identifier\n displayName\n }\n }\n ${componentIdFields}\n`;\n\nexport const componentFields = gql`\n fragment componentFields on Component {\n id {\n ...componentIdFields\n }\n ...componentOverviewFields\n packageName\n latest\n compositions {\n identifier\n displayName\n }\n tags {\n version\n }\n logs(type: $logType, offset: $logOffset, limit: $logLimit, head: $logHead, sort: $logSort) {\n id\n message\n username\n email\n date\n hash\n tag\n }\n }\n ${componentIdFields}\n ${componentOverviewFields}\n`;\n\nconst GET_COMPONENT = gql`\n query Component(\n $id: String!\n $extensionId: String!\n $logType: String\n $logOffset: Int\n $logLimit: Int\n $logHead: String\n $logSort: String\n ) {\n getHost(id: $extensionId) {\n id # used for GQL caching\n get(id: $id) {\n ...componentFields\n }\n }\n }\n ${componentFields}\n`;\n\nconst SUB_SUBSCRIPTION_ADDED = gql`\n subscription OnComponentAdded($logType: String, $logOffset: Int, $logLimit: Int, $logHead: String, $logSort: String) {\n componentAdded {\n component {\n ...componentFields\n }\n }\n }\n ${componentFields}\n`;\n\nconst SUB_COMPONENT_CHANGED = gql`\n subscription OnComponentChanged(\n $logType: String\n $logOffset: Int\n $logLimit: Int\n $logHead: String\n $logSort: String\n ) {\n componentChanged {\n component {\n ...componentFields\n }\n }\n }\n ${componentFields}\n`;\n\nconst SUB_COMPONENT_REMOVED = gql`\n subscription OnComponentRemoved {\n componentRemoved {\n componentIds {\n ...componentIdFields\n }\n }\n }\n ${componentIdFields}\n`;\nexport type Filters = {\n log?: { logType?: string; logOffset?: number; logLimit?: number; logHead?: string; logSort?: string };\n};\n/** provides data to component ui page, making sure both variables and return value are safely typed and memoized */\nexport function useComponentQuery(componentId: string, host: string, filters?: Filters) {\n const idRef = useRef(componentId);\n idRef.current = componentId;\n const { data, error, loading, subscribeToMore, ...rest } = useDataQuery(GET_COMPONENT, {\n variables: { id: componentId, extensionId: host, ...(filters?.log || {}) },\n });\n\n useEffect(() => {\n // @TODO @Kutner fix subscription for scope\n if (host !== 'teambit.workspace/workspace') {\n return () => {};\n }\n\n const unsubAddition = subscribeToMore({\n document: SUB_SUBSCRIPTION_ADDED,\n updateQuery: (prev, { subscriptionData }) => {\n const prevComponent = prev?.getHost?.get;\n const addedComponent = subscriptionData?.data?.componentAdded?.component;\n\n if (!addedComponent || prevComponent) return prev;\n\n if (idRef.current === addedComponent.id.name) {\n return {\n ...prev,\n getHost: {\n ...prev.getHost,\n get: addedComponent,\n },\n };\n }\n\n return prev;\n },\n });\n\n const unsubChanges = subscribeToMore({\n document: SUB_COMPONENT_CHANGED,\n updateQuery: (prev, { subscriptionData }) => {\n if (!subscriptionData.data) return prev;\n\n const prevComponent = prev?.getHost?.get;\n const updatedComponent = subscriptionData?.data?.componentChanged?.component;\n\n const isUpdated = updatedComponent && ComponentID.isEqualObj(prevComponent?.id, updatedComponent?.id);\n\n if (isUpdated) {\n return {\n ...prev,\n getHost: {\n ...prev.getHost,\n get: updatedComponent,\n },\n };\n }\n\n return prev;\n },\n });\n\n const unsubRemoval = subscribeToMore({\n document: SUB_COMPONENT_REMOVED,\n updateQuery: (prev, { subscriptionData }) => {\n if (!subscriptionData.data) return prev;\n\n const prevComponent = prev?.getHost?.get;\n const removedIds: ComponentIdObj[] | undefined = subscriptionData?.data?.componentRemoved?.componentIds;\n if (!prevComponent || !removedIds?.length) return prev;\n\n const isRemoved = removedIds.some((removedId) => ComponentID.isEqualObj(removedId, prevComponent.id));\n\n if (isRemoved) {\n return {\n ...prev,\n getHost: {\n ...prev.getHost,\n get: null,\n },\n };\n }\n\n return prev;\n },\n });\n\n return () => {\n unsubChanges();\n unsubAddition();\n unsubRemoval();\n };\n }, []);\n\n const rawComponent = data?.getHost?.get;\n return useMemo(() => {\n const aspectList = {\n entries: rawComponent?.aspects,\n };\n const id = rawComponent && ComponentID.fromObject(rawComponent.id);\n return {\n componentDescriptor: id ? ComponentDescriptor.fromObject({ id: id.toString(), aspectList }) : undefined,\n component: rawComponent ? ComponentModel.from({ ...rawComponent, host }) : undefined,\n // eslint-disable-next-line\n error: error\n ? new ComponentError(500, error.message)\n : !rawComponent && !loading\n ? new ComponentError(404)\n : undefined,\n loading,\n ...rest,\n };\n }, [rawComponent, host, error]);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;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;;;;;;AAEO,MAAMA,iBAAiB,GAAG,IAAAC,aAAA,CAAI;AACrC;AACA;AACA;AACA;AACA;AACA,CANO;;AAQA,MAAMC,uBAAuB,GAAG,IAAAD,aAAA,CAAI;AAC3C;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,IAAID,iBAAkB;AACtB,CAtCO;;AAwCA,MAAMG,eAAe,GAAG,IAAAF,aAAA,CAAI;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAID,iBAAkB;AACtB,IAAIE,uBAAwB;AAC5B,CA3BO;;AA6BP,MAAME,aAAa,GAAG,IAAAH,aAAA,CAAI;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAIE,eAAgB;AACpB,CAlBA;AAoBA,MAAME,sBAAsB,GAAG,IAAAJ,aAAA,CAAI;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAIE,eAAgB;AACpB,CATA;AAWA,MAAMG,qBAAqB,GAAG,IAAAL,aAAA,CAAI;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAIE,eAAgB;AACpB,CAfA;AAiBA,MAAMI,qBAAqB,GAAG,IAAAN,aAAA,CAAI;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAID,iBAAkB;AACtB,CATA;;AAaA;AACO,SAASQ,iBAAT,CAA2BC,WAA3B,EAAgDC,IAAhD,EAA8DC,OAA9D,EAAiF;EAAA;;EACtF,MAAMC,KAAK,GAAG,IAAAC,eAAA,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H,SARN;MASEvC;IATF,GAUKE,IAVL;EAYD,CAjBM,EAiBJ,CAAC4B,YAAD,EAAe1C,IAAf,EAAqBW,KAArB,CAjBI,CAAP;AAkBD"}
1
+ {"version":3,"names":["componentIdFields","gql","componentOverviewFields","componentFields","GET_COMPONENT","SUB_SUBSCRIPTION_ADDED","SUB_COMPONENT_CHANGED","SUB_COMPONENT_REMOVED","useComponentQuery","componentId","host","filters","idRef","useRef","current","useDataQuery","variables","id","extensionId","log","data","error","loading","subscribeToMore","rest","useEffect","unsubAddition","document","updateQuery","prev","subscriptionData","prevComponent","getHost","get","addedComponent","componentAdded","component","name","unsubChanges","updatedComponent","componentChanged","isUpdated","ComponentID","isEqualObj","unsubRemoval","removedIds","componentRemoved","componentIds","length","isRemoved","some","removedId","rawComponent","useMemo","aspectList","entries","aspects","fromObject","componentDescriptor","ComponentDescriptor","toString","undefined","ComponentModel","from","ComponentError","message"],"sources":["use-component-query.ts"],"sourcesContent":["import { useMemo, useEffect, useRef } from 'react';\nimport { gql } from '@apollo/client';\nimport { useDataQuery } from '@teambit/ui-foundation.ui.hooks.use-data-query';\nimport { ComponentID, ComponentIdObj } from '@teambit/component-id';\nimport { ComponentDescriptor } from '@teambit/component-descriptor';\n\nimport { ComponentModel } from './component-model';\nimport { ComponentError } from './component-error';\n\nexport const componentIdFields = gql`\n fragment componentIdFields on ComponentID {\n name\n version\n scope\n }\n`;\n\nexport const componentOverviewFields = gql`\n fragment componentOverviewFields on Component {\n id {\n ...componentIdFields\n }\n aspects(include: [\"teambit.preview/preview\", \"teambit.envs/envs\"]) {\n # 'id' property in gql refers to a *global* identifier and used for caching.\n # this makes aspect data cache under the same key, even when they are under different components.\n # renaming the property fixes that.\n aspectId: id\n aspectData: data\n }\n elementsUrl\n description\n deprecation {\n isDeprecate\n }\n labels\n displayName\n server {\n env\n url\n }\n buildStatus\n env {\n id\n icon\n }\n size {\n compressedTotal\n }\n preview {\n includesEnvTemplate\n legacyHeader\n }\n compositions {\n identifier\n displayName\n }\n }\n ${componentIdFields}\n`;\n\nexport const componentFields = gql`\n fragment componentFields on Component {\n id {\n ...componentIdFields\n }\n ...componentOverviewFields\n packageName\n latest\n compositions {\n identifier\n displayName\n }\n tags {\n version\n }\n logs(type: $logType, offset: $logOffset, limit: $logLimit, head: $logHead, sort: $logSort) {\n id\n message\n username\n email\n date\n hash\n tag\n }\n }\n ${componentIdFields}\n ${componentOverviewFields}\n`;\n\nconst GET_COMPONENT = gql`\n query Component(\n $id: String!\n $extensionId: String!\n $logType: String\n $logOffset: Int\n $logLimit: Int\n $logHead: String\n $logSort: String\n ) {\n getHost(id: $extensionId) {\n id # used for GQL caching\n get(id: $id) {\n ...componentFields\n }\n }\n }\n ${componentFields}\n`;\n\nconst SUB_SUBSCRIPTION_ADDED = gql`\n subscription OnComponentAdded($logType: String, $logOffset: Int, $logLimit: Int, $logHead: String, $logSort: String) {\n componentAdded {\n component {\n ...componentFields\n }\n }\n }\n ${componentFields}\n`;\n\nconst SUB_COMPONENT_CHANGED = gql`\n subscription OnComponentChanged(\n $logType: String\n $logOffset: Int\n $logLimit: Int\n $logHead: String\n $logSort: String\n ) {\n componentChanged {\n component {\n ...componentFields\n }\n }\n }\n ${componentFields}\n`;\n\nconst SUB_COMPONENT_REMOVED = gql`\n subscription OnComponentRemoved {\n componentRemoved {\n componentIds {\n ...componentIdFields\n }\n }\n }\n ${componentIdFields}\n`;\nexport type Filters = {\n log?: { logType?: string; logOffset?: number; logLimit?: number; logHead?: string; logSort?: string };\n};\n/** provides data to component ui page, making sure both variables and return value are safely typed and memoized */\nexport function useComponentQuery(componentId: string, host: string, filters?: Filters) {\n const idRef = useRef(componentId);\n idRef.current = componentId;\n const { data, error, loading, subscribeToMore, ...rest } = useDataQuery(GET_COMPONENT, {\n variables: { id: componentId, extensionId: host, ...(filters?.log || {}) },\n });\n\n useEffect(() => {\n // @TODO @Kutner fix subscription for scope\n if (host !== 'teambit.workspace/workspace') {\n return () => {};\n }\n\n const unsubAddition = subscribeToMore({\n document: SUB_SUBSCRIPTION_ADDED,\n updateQuery: (prev, { subscriptionData }) => {\n const prevComponent = prev?.getHost?.get;\n const addedComponent = subscriptionData?.data?.componentAdded?.component;\n\n if (!addedComponent || prevComponent) return prev;\n\n if (idRef.current === addedComponent.id.name) {\n return {\n ...prev,\n getHost: {\n ...prev.getHost,\n get: addedComponent,\n },\n };\n }\n\n return prev;\n },\n });\n\n const unsubChanges = subscribeToMore({\n document: SUB_COMPONENT_CHANGED,\n updateQuery: (prev, { subscriptionData }) => {\n if (!subscriptionData.data) return prev;\n\n const prevComponent = prev?.getHost?.get;\n const updatedComponent = subscriptionData?.data?.componentChanged?.component;\n\n const isUpdated = updatedComponent && ComponentID.isEqualObj(prevComponent?.id, updatedComponent?.id);\n\n if (isUpdated) {\n return {\n ...prev,\n getHost: {\n ...prev.getHost,\n get: updatedComponent,\n },\n };\n }\n\n return prev;\n },\n });\n\n const unsubRemoval = subscribeToMore({\n document: SUB_COMPONENT_REMOVED,\n updateQuery: (prev, { subscriptionData }) => {\n if (!subscriptionData.data) return prev;\n\n const prevComponent = prev?.getHost?.get;\n const removedIds: ComponentIdObj[] | undefined = subscriptionData?.data?.componentRemoved?.componentIds;\n if (!prevComponent || !removedIds?.length) return prev;\n\n const isRemoved = removedIds.some((removedId) => ComponentID.isEqualObj(removedId, prevComponent.id));\n\n if (isRemoved) {\n return {\n ...prev,\n getHost: {\n ...prev.getHost,\n get: null,\n },\n };\n }\n\n return prev;\n },\n });\n\n return () => {\n unsubChanges();\n unsubAddition();\n unsubRemoval();\n };\n }, []);\n\n const rawComponent = data?.getHost?.get;\n return useMemo(() => {\n const aspectList = {\n entries: rawComponent?.aspects,\n };\n const id = rawComponent && ComponentID.fromObject(rawComponent.id);\n return {\n componentDescriptor: id ? ComponentDescriptor.fromObject({ id: id.toString(), aspectList }) : undefined,\n component: rawComponent ? ComponentModel.from({ ...rawComponent, host }) : undefined,\n // eslint-disable-next-line\n error: error\n ? new ComponentError(500, error.message)\n : !rawComponent && !loading\n ? new ComponentError(404)\n : undefined,\n loading,\n ...rest,\n };\n }, [rawComponent, host, error]);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;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;;;;;;AAEO,MAAMA,iBAAiB,GAAG,IAAAC,aAAA,CAAI;AACrC;AACA;AACA;AACA;AACA;AACA,CANO;;AAQA,MAAMC,uBAAuB,GAAG,IAAAD,aAAA,CAAI;AAC3C;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,IAAID,iBAAkB;AACtB,CAzCO;;AA2CA,MAAMG,eAAe,GAAG,IAAAF,aAAA,CAAI;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAID,iBAAkB;AACtB,IAAIE,uBAAwB;AAC5B,CA3BO;;AA6BP,MAAME,aAAa,GAAG,IAAAH,aAAA,CAAI;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAIE,eAAgB;AACpB,CAlBA;AAoBA,MAAME,sBAAsB,GAAG,IAAAJ,aAAA,CAAI;AACnC;A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C,EAAE,GAAG0C,0CAAA,CAAoBF,UAApB,CAA+B;QAAExC,EAAE,EAAEA,EAAE,CAAC2C,QAAH,EAAN;QAAqBN;MAArB,CAA/B,CAAH,GAAuEO,SADhG;MAEEzB,SAAS,EAAEgB,YAAY,GAAGU,gCAAA,CAAeC,IAAf,iCAAyBX,YAAzB;QAAuC1C;MAAvC,GAAH,GAAoDmD,SAF7E;MAGE;MACAxC,KAAK,EAAEA,KAAK,GACR,KAAI2C,gCAAJ,EAAmB,GAAnB,EAAwB3C,KAAK,CAAC4C,OAA9B,CADQ,GAER,CAACb,YAAD,IAAiB,CAAC9B,OAAlB,GACA,KAAI0C,gCAAJ,EAAmB,GAAnB,CADA,GAEAH,SARN;MASEvC;IATF,GAUKE,IAVL;EAYD,CAjBM,EAiBJ,CAAC4B,YAAD,EAAe1C,IAAf,EAAqBW,KAArB,CAjBI,CAAP;AAkBD"}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/component",
3
- "version": "0.0.760",
3
+ "version": "0.0.763",
4
4
  "homepage": "https://bit.dev/teambit/component/component",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.component",
8
8
  "name": "component",
9
- "version": "0.0.760"
9
+ "version": "0.0.763"
10
10
  },
11
11
  "dependencies": {
12
12
  "@teambit/any-fs": "0.0.5",
@@ -31,42 +31,42 @@
31
31
  "@teambit/design.inputs.dropdown": "0.0.7",
32
32
  "@teambit/component-id": "0.0.402",
33
33
  "@teambit/ui-foundation.ui.menu-widget-icon": "0.0.488",
34
- "@teambit/aspect-loader": "0.0.760",
34
+ "@teambit/aspect-loader": "0.0.763",
35
35
  "@teambit/legacy-bit-id": "0.0.399",
36
36
  "@teambit/toolbox.path.match-patterns": "0.0.1",
37
37
  "@teambit/toolbox.string.capitalize": "0.0.483",
38
- "@teambit/cli": "0.0.502",
39
- "@teambit/config": "0.0.515",
40
- "@teambit/express": "0.0.600",
41
- "@teambit/graphql": "0.0.760",
38
+ "@teambit/cli": "0.0.504",
39
+ "@teambit/config": "0.0.517",
40
+ "@teambit/express": "0.0.602",
41
+ "@teambit/graphql": "0.0.763",
42
42
  "@teambit/bit-error": "0.0.394",
43
- "@teambit/command-bar": "0.0.760",
43
+ "@teambit/command-bar": "0.0.763",
44
44
  "@teambit/component.ui.deprecation-icon": "0.0.493",
45
- "@teambit/preview": "0.0.760",
46
- "@teambit/pubsub": "0.0.760",
47
- "@teambit/react-router": "0.0.760",
45
+ "@teambit/preview": "0.0.763",
46
+ "@teambit/pubsub": "0.0.763",
47
+ "@teambit/react-router": "0.0.763",
48
48
  "@teambit/ui-foundation.ui.is-browser": "0.0.486",
49
49
  "@teambit/ui-foundation.ui.main-dropdown": "0.0.487",
50
50
  "@teambit/ui-foundation.ui.react-router.slot-router": "0.0.490",
51
51
  "@teambit/ui-foundation.ui.use-box.menu": "0.0.115",
52
- "@teambit/ui": "0.0.760",
52
+ "@teambit/ui": "0.0.763",
53
53
  "@teambit/component-issues": "0.0.54",
54
54
  "@teambit/ui-foundation.ui.hooks.use-data-query": "0.0.487",
55
55
  "@teambit/cli-table": "0.0.34",
56
- "@teambit/lanes.ui.lanes": "0.0.69",
57
- "@teambit/component-descriptor": "0.0.64",
56
+ "@teambit/lanes.ui.lanes": "0.0.71",
57
+ "@teambit/component-descriptor": "0.0.66",
58
58
  "@teambit/ui-foundation.ui.react-router.use-query": "0.0.487",
59
59
  "@teambit/design.ui.empty-box": "0.0.353",
60
60
  "@teambit/harmony.ui.aspect-box": "0.0.486",
61
- "@teambit/compositions": "0.0.760",
62
- "@teambit/deprecation": "0.0.760",
63
- "@teambit/envs": "0.0.760",
64
- "@teambit/legacy-component-log": "0.0.392",
65
61
  "@teambit/design.ui.pages.not-found": "0.0.355",
66
62
  "@teambit/design.ui.pages.server-error": "0.0.355",
63
+ "@teambit/compositions": "0.0.763",
64
+ "@teambit/deprecation": "0.0.763",
65
+ "@teambit/envs": "0.0.763",
66
+ "@teambit/legacy-component-log": "0.0.392",
67
67
  "@teambit/design.ui.styles.ellipsis": "0.0.347",
68
68
  "@teambit/envs.ui.env-icon": "0.0.486",
69
- "@teambit/component.ui.version-dropdown": "0.0.556",
69
+ "@teambit/component.ui.version-dropdown": "0.0.558",
70
70
  "@teambit/ui-foundation.ui.full-loader": "0.0.486",
71
71
  "@teambit/ui-foundation.ui.use-box.dropdown": "0.0.115",
72
72
  "@teambit/ui-foundation.ui.constants.z-indexes": "0.0.487"
@@ -88,7 +88,7 @@
88
88
  "peerDependencies": {
89
89
  "react-router-dom": "^6.0.0",
90
90
  "@apollo/client": "^3.0.0",
91
- "@teambit/legacy": "1.0.282",
91
+ "@teambit/legacy": "1.0.284",
92
92
  "react-dom": "^16.8.0 || ^17.0.0",
93
93
  "react": "^16.8.0 || ^17.0.0"
94
94
  },
@@ -116,7 +116,7 @@
116
116
  "react": "-"
117
117
  },
118
118
  "peerDependencies": {
119
- "@teambit/legacy": "1.0.282",
119
+ "@teambit/legacy": "1.0.284",
120
120
  "react-dom": "^16.8.0 || ^17.0.0",
121
121
  "react": "^16.8.0 || ^17.0.0"
122
122
  }
@@ -1,2 +1,2 @@
1
- export const compositions = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_component@0.0.760/dist/component.composition.js')]
2
- export const overview = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_component@0.0.760/dist/component.docs.mdx')]
1
+ export const compositions = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_component@0.0.763/dist/component.composition.js')]
2
+ export const overview = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_component@0.0.763/dist/component.docs.mdx')]
package/show/show.cmd.ts CHANGED
@@ -9,18 +9,19 @@ import LegacyShow from '@teambit/legacy/dist/cli/commands/public-cmds/show-cmd';
9
9
  import { ComponentMain } from '../component.main.runtime';
10
10
 
11
11
  export class ShowCmd implements Command {
12
- name = 'show <id>';
13
- description = 'show a component';
12
+ name = 'show <component-name>';
13
+ description = "display the component's essential information";
14
14
  alias = '';
15
15
  group = 'info';
16
+ arguments = [{ name: 'component-name', description: 'component name or component id' }];
16
17
  options = [
17
- ['j', 'json', 'return the component data in json format'],
18
+ ['j', 'json', 'return the component data in a json format'],
18
19
  ['l', 'legacy', 'use the legacy bit show.'],
19
20
  ['r', 'remote', 'show a remote component'],
20
21
  [
21
22
  'c',
22
23
  'compare',
23
- 'compare current file system component to latest tagged component [default=latest]. only works in legacy.',
24
+ 'compare current file system component to the latest tagged component [default=latest]. only works in legacy.',
24
25
  ],
25
26
  ] as CommandOptions;
26
27
 
@@ -3,6 +3,7 @@ import { DeprecationInfo } from '@teambit/deprecation';
3
3
  import { Descriptor } from '@teambit/envs';
4
4
  import { ComponentID, ComponentIdObj } from '@teambit/component-id';
5
5
  import { LegacyComponentLog } from '@teambit/legacy-component-log';
6
+ import { ComponentPreviewSize } from '@teambit/preview';
6
7
  import { Tag } from '../../tag';
7
8
  import { TagMap } from '../../tag-map';
8
9
  import { TagProps } from '../../tag/tag';
@@ -30,6 +31,7 @@ export type ComponentModelProps = {
30
31
  latest?: string;
31
32
  preview?: ComponentPreview;
32
33
  logs?: LegacyComponentLog[];
34
+ size?: ComponentPreviewSize;
33
35
  };
34
36
 
35
37
  export type ComponentPreview = {
@@ -115,6 +117,12 @@ export class ComponentModel {
115
117
  */
116
118
  readonly host?: string,
117
119
 
120
+ /**
121
+ *
122
+ * size preview
123
+ */
124
+ readonly size?: ComponentPreviewSize,
125
+
118
126
  /**
119
127
  * latest version of component
120
128
  */
@@ -151,6 +159,7 @@ export class ComponentModel {
151
159
  host,
152
160
  latest,
153
161
  preview,
162
+ size,
154
163
  logs,
155
164
  }: ComponentModelProps) {
156
165
  return new ComponentModel(
@@ -169,6 +178,7 @@ export class ComponentModel {
169
178
  description,
170
179
  labels,
171
180
  host,
181
+ size,
172
182
  latest,
173
183
  preview,
174
184
  logs
@@ -20,7 +20,7 @@ export const componentOverviewFields = gql`
20
20
  id {
21
21
  ...componentIdFields
22
22
  }
23
- aspects(include: ["teambit.preview/preview", "teambit.pipelines/builder", "teambit.envs/envs"]) {
23
+ aspects(include: ["teambit.preview/preview", "teambit.envs/envs"]) {
24
24
  # 'id' property in gql refers to a *global* identifier and used for caching.
25
25
  # this makes aspect data cache under the same key, even when they are under different components.
26
26
  # renaming the property fixes that.
@@ -43,6 +43,9 @@ export const componentOverviewFields = gql`
43
43
  id
44
44
  icon
45
45
  }
46
+ size {
47
+ compressedTotal
48
+ }
46
49
  preview {
47
50
  includesEnvTemplate
48
51
  legacyHeader