@teambit/component 0.0.761 → 0.0.762
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ui/component-model/component-model.d.ts +13 -1
- package/dist/ui/component-model/component-model.js +8 -1
- package/dist/ui/component-model/component-model.js.map +1 -1
- package/dist/ui/use-component-query.js +4 -1
- package/dist/ui/use-component-query.js.map +1 -1
- package/package-tar/teambit-component-0.0.762.tgz +0 -0
- package/package.json +13 -13
- package/{preview-1655263660719.js → preview-1655279906398.js} +2 -2
- package/ui/component-model/component-model.ts +10 -0
- package/ui/use-component-query.ts +4 -1
- package/package-tar/teambit-component-0.0.761.tgz +0 -0
|
@@ -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;;
|
|
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 '',\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;;AAGA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAuCO,MAAMA,cAAN,CAAqB;EAC1BC,WAAW;EACT;AACJ;AACA;EACaC,EAJA;EAMT;AACJ;AACA;EACaC,WATA;EAWT;AACJ;AACA;EACaC,WAdA;EAgBT;AACJ;AACA;EACaC,MAnBA;EAqBT;AACJ;AACA;EACaC,YAxBA;EA0BT;AACJ;AACA;EACaC,IA7BA;EA+BT;AACJ;AACA;EACaC,WAlCA;EAoCT;AACJ;AACA;EACaC,WAvCA;EAwCT;AACJ;AACA;EACaC,WA3CA;EA4CT;AACJ;AACA;EACaC,MA/CA;EAiDT;AACJ;AACA;EACaC,WApDA;EAsDT;AACJ;AACA;EACaC,WAzDA;EA2DT;AACJ;AACA;EAEaC,WAAW,GAAG,EA/Dd,EAiEAC,MAAgB,GAAG,EAjEnB;EAmET;AACJ;AACA;EACaC,IAtEA;EAwET;AACJ;AACA;AACA;EACaC,IA5EA;EA8ET;AACJ;AACA;EACaC,MAjFA,EAmFAC,OAnFA,EAqFAC,IArFA,EAsFT;IAAA,KAlFSlB,EAkFT,GAlFSA,EAkFT;IAAA,KA7ESC,WA6ET,GA7ESA,WA6ET;IAAA,KAxESC,WAwET,GAxESA,WAwET;IAAA,KAnESC,MAmET,GAnESA,MAmET;IAAA,KA9DSC,YA8DT,GA9DSA,YA8DT;IAAA,KAzDSC,IA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AAlB,CAAjB,CANK,EAOLtB,WAPK,EAQLC,WARK,EASLC,WATK,EAULC,MAVK,EAWLC,WAXK,EAYLW,GAZK,EAaLT,WAbK,EAcLC,MAdK,EAeLC,IAfK,EAgBLC,IAhBK,EAiBLC,MAjBK,EAkBLC,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.
|
|
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;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AAY,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"}
|
|
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;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,kDAAG,cAAeC,GAApC;EACA,OAAO,IAAAoB,gBAAA,EAAQ,MAAM;IACnB,MAAMC,UAAU,GAAG;MACjBC,OAAO,EAAEH,YAAF,aAAEA,YAAF,uBAAEA,YAAY,CAAEI;IADN,CAAnB;;IAGA,MAAMvC,EAAE,GAAGmC,YAAY,IAAIV,0BAAA,CAAYe,UAAZ,CAAuBL,YAAY,CAACnC,EAApC,CAA3B;;IACA;MACEyC,mBAAmB,EAAEzC,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"}
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/component",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.762",
|
|
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.
|
|
9
|
+
"version": "0.0.762"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@teambit/any-fs": "0.0.5",
|
|
@@ -31,25 +31,25 @@
|
|
|
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.
|
|
34
|
+
"@teambit/aspect-loader": "0.0.762",
|
|
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
38
|
"@teambit/cli": "0.0.503",
|
|
39
39
|
"@teambit/config": "0.0.516",
|
|
40
40
|
"@teambit/express": "0.0.601",
|
|
41
|
-
"@teambit/graphql": "0.0.
|
|
41
|
+
"@teambit/graphql": "0.0.762",
|
|
42
42
|
"@teambit/bit-error": "0.0.394",
|
|
43
|
-
"@teambit/command-bar": "0.0.
|
|
43
|
+
"@teambit/command-bar": "0.0.762",
|
|
44
44
|
"@teambit/component.ui.deprecation-icon": "0.0.493",
|
|
45
|
-
"@teambit/preview": "0.0.
|
|
46
|
-
"@teambit/pubsub": "0.0.
|
|
47
|
-
"@teambit/react-router": "0.0.
|
|
45
|
+
"@teambit/preview": "0.0.762",
|
|
46
|
+
"@teambit/pubsub": "0.0.762",
|
|
47
|
+
"@teambit/react-router": "0.0.762",
|
|
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.
|
|
52
|
+
"@teambit/ui": "0.0.762",
|
|
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",
|
|
@@ -58,12 +58,12 @@
|
|
|
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.761",
|
|
62
|
-
"@teambit/deprecation": "0.0.761",
|
|
63
|
-
"@teambit/envs": "0.0.761",
|
|
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.762",
|
|
64
|
+
"@teambit/deprecation": "0.0.762",
|
|
65
|
+
"@teambit/envs": "0.0.762",
|
|
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
69
|
"@teambit/component.ui.version-dropdown": "0.0.557",
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const compositions = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_component@0.0.
|
|
2
|
-
export const overview = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_component@0.0.
|
|
1
|
+
export const compositions = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_component@0.0.762/dist/component.composition.js')]
|
|
2
|
+
export const overview = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_component@0.0.762/dist/component.docs.mdx')]
|
|
@@ -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.
|
|
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
|
|
Binary file
|