@teambit/component 1.0.281 → 1.0.282
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/artifacts/__bit_junit.xml +1 -1
- package/artifacts/preview/teambit_component_component-preview.js +1 -1
- package/artifacts/schema.json +782 -466
- package/dist/component-factory.d.ts +5 -1
- package/dist/component-factory.js.map +1 -1
- package/dist/component.d.ts +5 -0
- package/dist/component.js +10 -0
- package/dist/component.js.map +1 -1
- package/dist/component.main.runtime.d.ts +2 -1
- package/dist/component.main.runtime.js +11 -3
- package/dist/component.main.runtime.js.map +1 -1
- package/dist/{preview-1716434516635.js → preview-1716520879631.js} +2 -2
- package/dist/show/show.cmd.d.ts +5 -2
- package/dist/show/show.cmd.js +29 -4
- package/dist/show/show.cmd.js.map +1 -1
- package/package.json +22 -20
- package/show/show.cmd.ts +25 -3
|
@@ -126,7 +126,7 @@ export interface ComponentFactory {
|
|
|
126
126
|
* (among others) negate character "!" to exclude ids. See the package page for more supported characters.
|
|
127
127
|
*/
|
|
128
128
|
idsByPattern(pattern: string, throwForNoMatch?: boolean): Promise<ComponentID[]>;
|
|
129
|
-
hasId(componentId: ComponentID): Promise<boolean
|
|
129
|
+
hasId(componentId: ComponentID): Promise<boolean> | boolean;
|
|
130
130
|
/**
|
|
131
131
|
* Check if the host has the id, if no, search for the id in inner host (for example, workspace will search in the scope)
|
|
132
132
|
* @param componentId
|
|
@@ -138,6 +138,10 @@ export interface ComponentFactory {
|
|
|
138
138
|
* this is relevant for component from the workspace, where it can be locally changed. on the scope it's always false
|
|
139
139
|
*/
|
|
140
140
|
isModified(component: Component): Promise<boolean>;
|
|
141
|
+
/**
|
|
142
|
+
* whether the component exists on the remote.
|
|
143
|
+
*/
|
|
144
|
+
isExported(componentId: ComponentID): boolean;
|
|
141
145
|
/**
|
|
142
146
|
* write the component to the filesystem when applicable (no-op for scope).
|
|
143
147
|
* to change the component-path, specify the "rootPath", which should be a relative path inside the workspace.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["component-factory.ts"],"sourcesContent":["import { Graph } from '@teambit/graph.cleargraph';\nimport { BitId } from '@teambit/legacy-bit-id';\nimport { ComponentID } from '@teambit/component-id';\nimport ConsumerComponent from '@teambit/legacy/dist/consumer/component';\nimport { CompIdGraph } from '@teambit/graph';\nimport type { ComponentLog } from '@teambit/legacy/dist/scope/models/model-component';\nimport type { AspectDefinition } from '@teambit/aspect-loader';\nimport type { DependencyList } from '@teambit/dependency-resolver';\nimport { Component, InvalidComponent } from './component';\nimport { State } from './state';\nimport { Snap } from './snap';\n\nexport type ResolveAspectsOptions = FilterAspectsOptions & {\n throwOnError?: boolean;\n useScopeAspectsCapsule?: boolean;\n workspaceName?: string;\n skipDeps?: boolean;\n resolveEnvsFromRoots?: boolean;\n packageManagerConfigRootDir?: string;\n};\n\nexport type LoadAspectsOptions = {\n /* `throwOnError` is an optional parameter that can be passed to the loadAspects method in the `ComponentFactory` interface. If\n set to `true`, it will cause the method to throw an error if an error occurs during its execution. If set to `false`\n or not provided, the method will print a warning instead of throwing it. */\n throwOnError?: boolean;\n /* `hideMissingModuleError` is an optional parameter that can be passed to the `loadAspects` method in the\n `ComponentFactory` interface. If set to `true`, it will prevent the method from throwing/printing an error if a required module\n is missing during the loading of an aspect. Instead, it will continue loading the other\n aspects. If set to `false` or not provided, the method will print/throw an error if a required module is missing.\n (considering throwOnError as well) */\n hideMissingModuleError?: boolean;\n\n /* The `ignoreErrors` property is an optional boolean parameter that can be passed to the `LoadAspectsOptions` object in\n the `ComponentFactory` interface. If set to `true`, it will cause the `loadAspects` method to ignore any errors that\n occur during the loading of aspects and continue loading the other aspects. If set to `false` or not provided, the\n method will print/throw an error if a required module is missing or if any other error occurs during the loading of\n aspects. */\n ignoreErrors?: boolean;\n [key: string]: any;\n};\n\nexport type FilterAspectsOptions = {\n /**\n * Do not return results for the core aspects\n */\n excludeCore?: boolean;\n /**\n * Only return results for the provided list of ids\n */\n requestedOnly?: boolean;\n /**\n * Only return results for aspects that have a path to the specified runtime name\n */\n filterByRuntime?: boolean;\n};\n\nexport interface ComponentFactory {\n /**\n * name of the component host.\n */\n name: string;\n\n /**\n * path to the component host.\n */\n path: string;\n\n isLegacy: boolean;\n\n /**\n * resolve a `string` component ID to an instance of a ComponentID.\n */\n resolveComponentId(id: string | BitId | ComponentID): Promise<ComponentID>;\n\n /**\n * resolve multiple `string` component ID to an instance of a ComponentID.\n */\n resolveMultipleComponentIds(ids: (string | BitId | ComponentID)[]): Promise<ComponentID[]>;\n\n /**\n * returns a component by ID.\n */\n get(id: ComponentID): Promise<Component | undefined>;\n\n /**\n * returns the legacy representation of a component with minimal loading.\n * when loaded from the workspace, it won't run any Harmony hooks and even won't load dependencies.\n * it's good to get raw aspects data or some basic properties.\n * use carefully. prefer using `get()` instead.\n */\n getLegacyMinimal(id: ComponentID): Promise<ConsumerComponent | undefined>;\n\n /**\n * returns many components by ids.\n */\n getMany(ids: ComponentID[]): Promise<Component[]>;\n\n /**\n * returns many components by their legacy representation.\n */\n getManyByLegacy(components: ConsumerComponent[]): Promise<Component[]>;\n\n /**\n * get a component from a remote without importing it\n */\n getRemoteComponent?: (id: ComponentID) => Promise<Component>;\n\n /**\n * important - prefer using `getGraphIds()` if you don't need the component objects.\n * this method has a performance penalty. it must import all flattened-dependencies objects from the remotes.\n */\n getGraph(ids?: ComponentID[], shouldThrowOnMissingDep?: boolean): Promise<Graph<Component, string>>;\n\n /**\n * get graph of the given component-ids and all their dependencies (recursively/flattened).\n * the nodes are ComponentIds and is much faster than `this.getGraph()`.\n */\n getGraphIds(ids?: ComponentID[], shouldThrowOnMissingDep?: boolean): Promise<CompIdGraph>;\n\n getLogs(id: ComponentID, shortHash?: boolean, startsFrom?: string): Promise<ComponentLog[]>;\n\n getDependencies(component: Component): DependencyList;\n\n componentPackageName(component: Component): string;\n\n /**\n * returns a specific state of a component by hash or semver.\n */\n getState(id: ComponentID, snapId: string): Promise<State>;\n\n /**\n * returns a specific snap of a component by hash.\n */\n getSnap(id: ComponentID, snapId: string): Promise<Snap>;\n\n /**\n * load aspects.\n * returns the loaded aspect ids including the loaded versions.\n */\n loadAspects: (ids: string[], throwOnError?: boolean, neededFor?: string, opts?: any) => Promise<string[]>;\n\n /**\n * Resolve dirs for aspects\n */\n resolveAspects: (\n runtimeName?: string,\n componentIds?: ComponentID[],\n opts?: ResolveAspectsOptions\n ) => Promise<AspectDefinition[]>;\n\n /**\n * list all components in the host.\n */\n list(filter?: { offset: number; limit: number }): Promise<Component[]>;\n\n /**\n * list invalid components, such as components with missing files on the fs.\n */\n listInvalid(): Promise<InvalidComponent[]>;\n\n listIds(): Promise<ComponentID[]> | ComponentID[];\n\n /**\n * get component-ids matching the given pattern. a pattern can have multiple patterns separated by a comma.\n * it uses multimatch (https://www.npmjs.com/package/multimatch) package for the matching algorithm, which supports\n * (among others) negate character \"!\" to exclude ids. See the package page for more supported characters.\n */\n idsByPattern(pattern: string, throwForNoMatch?: boolean): Promise<ComponentID[]>;\n\n hasId(componentId: ComponentID): Promise<boolean
|
|
1
|
+
{"version":3,"names":[],"sources":["component-factory.ts"],"sourcesContent":["import { Graph } from '@teambit/graph.cleargraph';\nimport { BitId } from '@teambit/legacy-bit-id';\nimport { ComponentID } from '@teambit/component-id';\nimport ConsumerComponent from '@teambit/legacy/dist/consumer/component';\nimport { CompIdGraph } from '@teambit/graph';\nimport type { ComponentLog } from '@teambit/legacy/dist/scope/models/model-component';\nimport type { AspectDefinition } from '@teambit/aspect-loader';\nimport type { DependencyList } from '@teambit/dependency-resolver';\nimport { Component, InvalidComponent } from './component';\nimport { State } from './state';\nimport { Snap } from './snap';\n\nexport type ResolveAspectsOptions = FilterAspectsOptions & {\n throwOnError?: boolean;\n useScopeAspectsCapsule?: boolean;\n workspaceName?: string;\n skipDeps?: boolean;\n resolveEnvsFromRoots?: boolean;\n packageManagerConfigRootDir?: string;\n};\n\nexport type LoadAspectsOptions = {\n /* `throwOnError` is an optional parameter that can be passed to the loadAspects method in the `ComponentFactory` interface. If\n set to `true`, it will cause the method to throw an error if an error occurs during its execution. If set to `false`\n or not provided, the method will print a warning instead of throwing it. */\n throwOnError?: boolean;\n /* `hideMissingModuleError` is an optional parameter that can be passed to the `loadAspects` method in the\n `ComponentFactory` interface. If set to `true`, it will prevent the method from throwing/printing an error if a required module\n is missing during the loading of an aspect. Instead, it will continue loading the other\n aspects. If set to `false` or not provided, the method will print/throw an error if a required module is missing.\n (considering throwOnError as well) */\n hideMissingModuleError?: boolean;\n\n /* The `ignoreErrors` property is an optional boolean parameter that can be passed to the `LoadAspectsOptions` object in\n the `ComponentFactory` interface. If set to `true`, it will cause the `loadAspects` method to ignore any errors that\n occur during the loading of aspects and continue loading the other aspects. If set to `false` or not provided, the\n method will print/throw an error if a required module is missing or if any other error occurs during the loading of\n aspects. */\n ignoreErrors?: boolean;\n [key: string]: any;\n};\n\nexport type FilterAspectsOptions = {\n /**\n * Do not return results for the core aspects\n */\n excludeCore?: boolean;\n /**\n * Only return results for the provided list of ids\n */\n requestedOnly?: boolean;\n /**\n * Only return results for aspects that have a path to the specified runtime name\n */\n filterByRuntime?: boolean;\n};\n\nexport interface ComponentFactory {\n /**\n * name of the component host.\n */\n name: string;\n\n /**\n * path to the component host.\n */\n path: string;\n\n isLegacy: boolean;\n\n /**\n * resolve a `string` component ID to an instance of a ComponentID.\n */\n resolveComponentId(id: string | BitId | ComponentID): Promise<ComponentID>;\n\n /**\n * resolve multiple `string` component ID to an instance of a ComponentID.\n */\n resolveMultipleComponentIds(ids: (string | BitId | ComponentID)[]): Promise<ComponentID[]>;\n\n /**\n * returns a component by ID.\n */\n get(id: ComponentID): Promise<Component | undefined>;\n\n /**\n * returns the legacy representation of a component with minimal loading.\n * when loaded from the workspace, it won't run any Harmony hooks and even won't load dependencies.\n * it's good to get raw aspects data or some basic properties.\n * use carefully. prefer using `get()` instead.\n */\n getLegacyMinimal(id: ComponentID): Promise<ConsumerComponent | undefined>;\n\n /**\n * returns many components by ids.\n */\n getMany(ids: ComponentID[]): Promise<Component[]>;\n\n /**\n * returns many components by their legacy representation.\n */\n getManyByLegacy(components: ConsumerComponent[]): Promise<Component[]>;\n\n /**\n * get a component from a remote without importing it\n */\n getRemoteComponent?: (id: ComponentID) => Promise<Component>;\n\n /**\n * important - prefer using `getGraphIds()` if you don't need the component objects.\n * this method has a performance penalty. it must import all flattened-dependencies objects from the remotes.\n */\n getGraph(ids?: ComponentID[], shouldThrowOnMissingDep?: boolean): Promise<Graph<Component, string>>;\n\n /**\n * get graph of the given component-ids and all their dependencies (recursively/flattened).\n * the nodes are ComponentIds and is much faster than `this.getGraph()`.\n */\n getGraphIds(ids?: ComponentID[], shouldThrowOnMissingDep?: boolean): Promise<CompIdGraph>;\n\n getLogs(id: ComponentID, shortHash?: boolean, startsFrom?: string): Promise<ComponentLog[]>;\n\n getDependencies(component: Component): DependencyList;\n\n componentPackageName(component: Component): string;\n\n /**\n * returns a specific state of a component by hash or semver.\n */\n getState(id: ComponentID, snapId: string): Promise<State>;\n\n /**\n * returns a specific snap of a component by hash.\n */\n getSnap(id: ComponentID, snapId: string): Promise<Snap>;\n\n /**\n * load aspects.\n * returns the loaded aspect ids including the loaded versions.\n */\n loadAspects: (ids: string[], throwOnError?: boolean, neededFor?: string, opts?: any) => Promise<string[]>;\n\n /**\n * Resolve dirs for aspects\n */\n resolveAspects: (\n runtimeName?: string,\n componentIds?: ComponentID[],\n opts?: ResolveAspectsOptions\n ) => Promise<AspectDefinition[]>;\n\n /**\n * list all components in the host.\n */\n list(filter?: { offset: number; limit: number }): Promise<Component[]>;\n\n /**\n * list invalid components, such as components with missing files on the fs.\n */\n listInvalid(): Promise<InvalidComponent[]>;\n\n listIds(): Promise<ComponentID[]> | ComponentID[];\n\n /**\n * get component-ids matching the given pattern. a pattern can have multiple patterns separated by a comma.\n * it uses multimatch (https://www.npmjs.com/package/multimatch) package for the matching algorithm, which supports\n * (among others) negate character \"!\" to exclude ids. See the package page for more supported characters.\n */\n idsByPattern(pattern: string, throwForNoMatch?: boolean): Promise<ComponentID[]>;\n\n hasId(componentId: ComponentID): Promise<boolean> | boolean;\n\n /**\n * Check if the host has the id, if no, search for the id in inner host (for example, workspace will search in the scope)\n * @param componentId\n */\n hasIdNested(componentId: ComponentID, includeCache?: boolean): Promise<boolean>;\n\n /**\n * whether a component is not the same as its head.\n * for a new component, it'll return \"true\" as it has no head yet.\n * this is relevant for component from the workspace, where it can be locally changed. on the scope it's always false\n */\n isModified(component: Component): Promise<boolean>;\n\n /**\n * whether the component exists on the remote.\n */\n isExported(componentId: ComponentID): boolean;\n\n /**\n * write the component to the filesystem when applicable (no-op for scope).\n * to change the component-path, specify the \"rootPath\", which should be a relative path inside the workspace.\n */\n write(component: Component, rootPath?: string): Promise<void>;\n\n /**\n * determine whether host should be the prior one in case multiple hosts persist.\n */\n priority?: boolean;\n}\n"],"mappings":"","ignoreList":[]}
|
package/dist/component.d.ts
CHANGED
|
@@ -84,6 +84,7 @@ export declare class Component implements IComponent {
|
|
|
84
84
|
* build status of the component
|
|
85
85
|
*/
|
|
86
86
|
get buildStatus(): BuildStatus;
|
|
87
|
+
get homepage(): string | undefined;
|
|
87
88
|
get headTag(): Tag | undefined;
|
|
88
89
|
get latest(): string | undefined;
|
|
89
90
|
/**
|
|
@@ -129,6 +130,10 @@ export declare class Component implements IComponent {
|
|
|
129
130
|
* determines whether this component is new.
|
|
130
131
|
*/
|
|
131
132
|
isNew(): Promise<boolean>;
|
|
133
|
+
/**
|
|
134
|
+
* whether the component exists on the remote.
|
|
135
|
+
*/
|
|
136
|
+
isExported(): boolean;
|
|
132
137
|
loadState(snapId: string): Promise<State>;
|
|
133
138
|
loadSnap(snapId?: string): Promise<Snap>;
|
|
134
139
|
/**
|
package/dist/component.js
CHANGED
|
@@ -108,6 +108,9 @@ class Component {
|
|
|
108
108
|
get buildStatus() {
|
|
109
109
|
return this._state._consumer.buildStatus;
|
|
110
110
|
}
|
|
111
|
+
get homepage() {
|
|
112
|
+
return this._state._consumer._getHomepage();
|
|
113
|
+
}
|
|
111
114
|
get headTag() {
|
|
112
115
|
if (!this.head) return undefined;
|
|
113
116
|
return this.tags.byHash(this.head.hash);
|
|
@@ -226,6 +229,13 @@ class Component {
|
|
|
226
229
|
return Promise.resolve(this.head === null);
|
|
227
230
|
}
|
|
228
231
|
|
|
232
|
+
/**
|
|
233
|
+
* whether the component exists on the remote.
|
|
234
|
+
*/
|
|
235
|
+
isExported() {
|
|
236
|
+
return this.factory.isExported(this.id);
|
|
237
|
+
}
|
|
238
|
+
|
|
229
239
|
// TODO: @david after snap we need to make sure to refactor here.
|
|
230
240
|
loadState(snapId) {
|
|
231
241
|
return this.factory.getState(this.id, snapId);
|
package/dist/component.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_toolboxString","data","require","_bitError","_lodash","_tagMap","_exceptions","Component","constructor","id","head","_state","tags","TagMap","factory","mainFile","state","config","filesystem","buildStatus","_consumer","headTag","undefined","byHash","hash","latest","getLatest","err","CouldNotFindLatest","get","aspects","serialize","getLogs","filter","allLogs","type","limit","offset","sort","typeFilter","snap","tag","filteredLogs","reverse","slice","getDependencies","getPackageName","componentPackageName","stringify","JSON","displayName","tokens","name","split","map","token","capitalize","join","version","isModified","isDeleted","isRemoved","isOutdated","latestTag","byVersion","isNew","Promise","resolve","loadState","snapId","getState","loadSnap","snapToGet","BitError","getSnap","snapsIterable","options","snapToStart","nextSnaps","done","iterator","next","value","currSnapId","shift","parents","length","firstParentOnly","push","concat","stopFn","Symbol","asyncIterator","getClosestTag","snapToStartFrom","tagsHashMap","getHashMap","has","iterable","snaps","hashOfLastSnap","getTag","currentVersion","getSnapHash","hasVersion","getCurrentSnap","checkout","write","path","fs","equals","component","toString","exports"],"sources":["component.ts"],"sourcesContent":["import { AnyFS } from '@teambit/any-fs';\nimport { capitalize } from '@teambit/toolbox.string.capitalize';\nimport { SemVer } from 'semver';\nimport { ComponentID } from '@teambit/component-id';\nimport { BitError } from '@teambit/bit-error';\nimport { BuildStatus } from '@teambit/legacy/dist/constants';\nimport { ComponentLog } from '@teambit/legacy/dist/scope/models/model-component';\nimport type { DependencyList } from '@teambit/dependency-resolver';\nimport { slice } from 'lodash';\nimport { ComponentFactory } from './component-factory';\nimport ComponentFS from './component-fs';\n// import { NothingToSnap } from './exceptions';\nimport { Config as ComponentConfig } from './config';\n// eslint-disable-next-line import/no-cycle\nimport { Snap } from './snap';\nimport { State } from './state';\nimport { TagMap } from './tag-map';\nimport { Tag } from './tag';\nimport { CouldNotFindLatest } from './exceptions';\nimport { IComponent, RawComponentMetadata } from './component-interface';\n// import { Author } from './types';\n\ntype SnapsIterableOpts = {\n firstParentOnly?: boolean;\n stopFn?: (snap: Snap) => Promise<boolean>;\n};\n\nexport type InvalidComponent = { id: ComponentID; err: Error };\n\n/**\n * in-memory representation of a component.\n */\nexport class Component implements IComponent {\n constructor(\n /**\n * component ID represented by the `ComponentId` type.\n */\n readonly id: ComponentID,\n\n /**\n * head version of the component. can be `null` for new components.\n * if on main, returns the head on main.\n * if on a lane, returns the head on the lane.\n */\n readonly head: Snap | null = null,\n\n /**\n * state of the component.\n */\n private _state: State,\n\n /**\n * tags of the component.\n */\n readonly tags: TagMap = new TagMap(),\n\n /**\n * the component factory\n */\n private factory: ComponentFactory\n ) {}\n\n get mainFile() {\n return this.state.mainFile;\n }\n\n get state(): State {\n return this._state;\n }\n\n set state(state: State) {\n this._state = state;\n }\n\n /**\n * component configuration which is later generated to a component `package.json` and `bit.json`.\n */\n get config(): ComponentConfig {\n return this.state.config;\n }\n\n /**\n * in-memory representation of the component current filesystem.\n */\n get filesystem(): ComponentFS {\n return this.state.filesystem;\n }\n\n /**\n * build status of the component\n */\n get buildStatus(): BuildStatus {\n return this._state._consumer.buildStatus;\n }\n\n get headTag() {\n if (!this.head) return undefined;\n return this.tags.byHash(this.head.hash);\n }\n\n get latest(): string | undefined {\n if (!this.head) return undefined;\n try {\n return this.tags.getLatest();\n } catch (err: any) {\n if (err instanceof CouldNotFindLatest) {\n return this.head.hash;\n }\n throw err;\n }\n }\n\n /**\n * get aspect data from current state.\n */\n get(id: string): RawComponentMetadata | undefined {\n return this.state.aspects.get(id)?.serialize();\n }\n\n async getLogs(filter?: {\n type?: string;\n offset?: number;\n limit?: number;\n head?: string;\n sort?: string;\n }): Promise<ComponentLog[]> {\n const allLogs = await this.factory.getLogs(this.id, false, filter?.head);\n\n if (!filter) return allLogs;\n\n const { type, limit, offset, sort } = filter;\n\n const typeFilter = (snap) => {\n if (type === 'tag') return snap.tag;\n if (type === 'snap') return !snap.tag;\n return true;\n };\n\n let filteredLogs = (type && allLogs.filter(typeFilter)) || allLogs;\n if (sort !== 'asc') filteredLogs = filteredLogs.reverse();\n\n if (limit) {\n filteredLogs = slice(filteredLogs, offset, limit + (offset || 0));\n }\n\n return filteredLogs;\n }\n\n getDependencies(): DependencyList {\n return this.factory.getDependencies(this);\n }\n\n getPackageName(): string {\n return this.factory.componentPackageName(this);\n }\n\n stringify(): string {\n return JSON.stringify({\n id: this.id,\n head: this.head,\n });\n }\n\n /**\n * record component changes in the `Scope`.\n */\n // snap(author: Author, message = '') {\n // if (!this.isModified()) throw new NothingToSnap();\n // const snap = new Snap(this, author, message);\n\n // return new Component(this.id, snap, snap.state);\n // }\n\n /**\n * display name of the component.\n */\n get displayName() {\n const tokens = this.id.name.split('-').map((token) => capitalize(token));\n return tokens.join(' ');\n }\n\n /**\n * tag a component `Snap` with a semantic version. we follow SemVer specs as defined [here](https://semver.org/)).\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n tag(version: SemVer) {\n // const snap = this.snap();\n // const tag = new Tag(version, snap);\n // this.tags.set(tag);\n }\n\n /**\n * determines whether this component is modified in the workspace.\n */\n isModified(): Promise<boolean> {\n return this.factory.isModified(this);\n }\n\n /**\n * whether a component is marked as deleted.\n * warning! if this component is not the head, it might be deleted by a range later on.\n * to get accurate results, please use teambit.component/remove aspect, \"isDeleted\" method.\n */\n isDeleted(): boolean {\n return this.state._consumer.isRemoved();\n }\n\n /**\n * is component isOutdated\n */\n isOutdated(): boolean {\n if (!this.latest) return false;\n const latestTag = this.tags.byVersion(this.latest);\n if (!latestTag) return false;\n if (this.head?.hash !== latestTag?.hash) return true;\n return false;\n }\n\n /**\n * determines whether this component is new.\n */\n isNew(): Promise<boolean> {\n return Promise.resolve(this.head === null);\n }\n\n // TODO: @david after snap we need to make sure to refactor here.\n loadState(snapId: string): Promise<State> {\n return this.factory.getState(this.id, snapId);\n }\n\n loadSnap(snapId?: string): Promise<Snap> {\n const snapToGet = snapId || this.head?.hash;\n if (!snapToGet) {\n throw new BitError('could not load snap for new components');\n }\n return this.factory.getSnap(this.id, snapToGet);\n }\n\n /**\n * Get iterable which iterate over snap parents lazily\n * @param snapId\n * @param options\n */\n snapsIterable(snapId?: string, options: SnapsIterableOpts = {}): AsyncIterable<Snap> {\n const snapToStart = snapId || this.head?.hash;\n let nextSnaps = [snapToStart];\n let done;\n if (!snapToStart) {\n done = true;\n }\n\n const iterator: AsyncIterator<Snap> = {\n next: async () => {\n if (done) {\n return { value: undefined, done };\n }\n const currSnapId = nextSnaps.shift();\n const snap = await this.loadSnap(currSnapId);\n if (snap.parents && snap.parents.length) {\n if (options.firstParentOnly) {\n nextSnaps.push(snap.parents[0]);\n } else {\n nextSnaps = nextSnaps.concat(snap.parents);\n }\n }\n if (!nextSnaps.length) {\n done = true;\n } else if (options.stopFn) {\n done = await options.stopFn(snap);\n }\n return { value: snap, done: undefined };\n },\n };\n return {\n [Symbol.asyncIterator]: () => iterator,\n };\n }\n\n /**\n * traverse recursively from the provided snap (or head) upwards until it finds a tag\n * @param snapToStartFrom\n */\n async getClosestTag(snapToStartFrom?: string): Promise<Tag | undefined> {\n const tagsHashMap = this.tags.getHashMap();\n const stopFn = async (snap: Snap) => {\n if (tagsHashMap.has(snap.hash)) {\n return true;\n }\n return false;\n };\n const iterable = this.snapsIterable(snapToStartFrom, { firstParentOnly: true, stopFn });\n const snaps: Snap[] = [];\n for await (const snap of iterable) {\n snaps.push(snap);\n }\n if (snaps.length) {\n const hashOfLastSnap = snaps[snaps.length - 1].hash;\n return tagsHashMap.get(hashOfLastSnap);\n }\n return undefined;\n }\n\n /**\n * id.version can be either a tag or a hash.\n * if it's a hash, it may have a tag point to it. if it does, return the tag.\n */\n getTag(): Tag | undefined {\n const currentVersion = this.id.version;\n if (!currentVersion) return undefined;\n return this.tags.byVersion(currentVersion) || this.tags.byHash(currentVersion);\n }\n\n /**\n * id.version can be either a tag or a hash.\n * if it's a tag, find the hash it points to.\n */\n getSnapHash(): string | undefined {\n if (!this.id.hasVersion()) return undefined;\n const tag = this.tags.byVersion(this.id.version);\n if (tag) return tag.hash;\n return this.id.version;\n }\n\n /**\n * in case a component is new, it returns undefined.\n * otherwise, it returns the Snap object (hash/parents/log) of the current component (according to the version in the id)\n */\n async getCurrentSnap(): Promise<Snap | undefined> {\n const snap = this.getSnapHash();\n if (!snap) return undefined;\n return this.loadSnap(snap);\n }\n\n /**\n * checkout the component to a different version in its working tree.\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n checkout(version: SemVer) {}\n\n /**\n * examine difference between two components.\n */\n // diff(other: Component): Difference {}\n\n /**\n * merge two different components\n */\n // merge(other: Component): Component {}\n\n /**\n * write a component to a given file system.\n * @param path root path to write the component\n * @param fs instance of any fs to use.\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n write(path: string, fs?: AnyFS) {}\n\n /**\n *\n * Check if 2 components are equal\n * @param {Component} component\n * @returns {boolean}\n * @memberof Component\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n equals(component: Component): boolean {\n return component.id.toString() === this.id.toString();\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,eAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,cAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAE,UAAA;EAAA,MAAAF,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GAAG,CAACjB,IAAI;IACxB,OAAO,IAAI,CAACf,EAAE,CAACiD,OAAO;EACxB;;EAEA;AACF;AACA;AACA;EACE,MAAM+C,cAAcA,CAAA,EAA8B;IAChD,MAAMjE,IAAI,GAAG,IAAI,CAAC+D,WAAW,CAAC,CAAC;IAC/B,IAAI,CAAC/D,IAAI,EAAE,OAAOlB,SAAS;IAC3B,OAAO,IAAI,CAACiD,QAAQ,CAAC/B,IAAI,CAAC;EAC5B;;EAEA;AACF;AACA;EACE;EACAkE,QAAQA,CAAChD,OAAe,EAAE,CAAC;;EAE3B;AACF;AACA;EACE;;EAEA;AACF;AACA;EACE;;EAEA;AACF;AACA;AACA;AACA;EACE;EACAiD,KAAKA,CAACC,IAAY,EAAEC,EAAU,EAAE,CAAC;;EAEjC;AACF;AACA;AACA;AACA;AACA;AACA;EACE;EACAC,MAAMA,CAACC,SAAoB,EAAW;IACpC,OAAOA,SAAS,CAACtG,EAAE,CAACuG,QAAQ,CAAC,CAAC,KAAK,IAAI,CAACvG,EAAE,CAACuG,QAAQ,CAAC,CAAC;EACvD;AACF;AAACC,OAAA,CAAA1G,SAAA,GAAAA,SAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_toolboxString","data","require","_bitError","_lodash","_tagMap","_exceptions","Component","constructor","id","head","_state","tags","TagMap","factory","mainFile","state","config","filesystem","buildStatus","_consumer","homepage","_getHomepage","headTag","undefined","byHash","hash","latest","getLatest","err","CouldNotFindLatest","get","aspects","serialize","getLogs","filter","allLogs","type","limit","offset","sort","typeFilter","snap","tag","filteredLogs","reverse","slice","getDependencies","getPackageName","componentPackageName","stringify","JSON","displayName","tokens","name","split","map","token","capitalize","join","version","isModified","isDeleted","isRemoved","isOutdated","latestTag","byVersion","isNew","Promise","resolve","isExported","loadState","snapId","getState","loadSnap","snapToGet","BitError","getSnap","snapsIterable","options","snapToStart","nextSnaps","done","iterator","next","value","currSnapId","shift","parents","length","firstParentOnly","push","concat","stopFn","Symbol","asyncIterator","getClosestTag","snapToStartFrom","tagsHashMap","getHashMap","has","iterable","snaps","hashOfLastSnap","getTag","currentVersion","getSnapHash","hasVersion","getCurrentSnap","checkout","write","path","fs","equals","component","toString","exports"],"sources":["component.ts"],"sourcesContent":["import { AnyFS } from '@teambit/any-fs';\nimport { capitalize } from '@teambit/toolbox.string.capitalize';\nimport { SemVer } from 'semver';\nimport { ComponentID } from '@teambit/component-id';\nimport { BitError } from '@teambit/bit-error';\nimport { BuildStatus } from '@teambit/legacy/dist/constants';\nimport { ComponentLog } from '@teambit/legacy/dist/scope/models/model-component';\nimport type { DependencyList } from '@teambit/dependency-resolver';\nimport { slice } from 'lodash';\nimport { ComponentFactory } from './component-factory';\nimport ComponentFS from './component-fs';\n// import { NothingToSnap } from './exceptions';\nimport { Config as ComponentConfig } from './config';\n// eslint-disable-next-line import/no-cycle\nimport { Snap } from './snap';\nimport { State } from './state';\nimport { TagMap } from './tag-map';\nimport { Tag } from './tag';\nimport { CouldNotFindLatest } from './exceptions';\nimport { IComponent, RawComponentMetadata } from './component-interface';\n// import { Author } from './types';\n\ntype SnapsIterableOpts = {\n firstParentOnly?: boolean;\n stopFn?: (snap: Snap) => Promise<boolean>;\n};\n\nexport type InvalidComponent = { id: ComponentID; err: Error };\n\n/**\n * in-memory representation of a component.\n */\nexport class Component implements IComponent {\n constructor(\n /**\n * component ID represented by the `ComponentId` type.\n */\n readonly id: ComponentID,\n\n /**\n * head version of the component. can be `null` for new components.\n * if on main, returns the head on main.\n * if on a lane, returns the head on the lane.\n */\n readonly head: Snap | null = null,\n\n /**\n * state of the component.\n */\n private _state: State,\n\n /**\n * tags of the component.\n */\n readonly tags: TagMap = new TagMap(),\n\n /**\n * the component factory\n */\n private factory: ComponentFactory\n ) {}\n\n get mainFile() {\n return this.state.mainFile;\n }\n\n get state(): State {\n return this._state;\n }\n\n set state(state: State) {\n this._state = state;\n }\n\n /**\n * component configuration which is later generated to a component `package.json` and `bit.json`.\n */\n get config(): ComponentConfig {\n return this.state.config;\n }\n\n /**\n * in-memory representation of the component current filesystem.\n */\n get filesystem(): ComponentFS {\n return this.state.filesystem;\n }\n\n /**\n * build status of the component\n */\n get buildStatus(): BuildStatus {\n return this._state._consumer.buildStatus;\n }\n\n get homepage(): string | undefined {\n return this._state._consumer._getHomepage();\n }\n\n get headTag() {\n if (!this.head) return undefined;\n return this.tags.byHash(this.head.hash);\n }\n\n get latest(): string | undefined {\n if (!this.head) return undefined;\n try {\n return this.tags.getLatest();\n } catch (err: any) {\n if (err instanceof CouldNotFindLatest) {\n return this.head.hash;\n }\n throw err;\n }\n }\n\n /**\n * get aspect data from current state.\n */\n get(id: string): RawComponentMetadata | undefined {\n return this.state.aspects.get(id)?.serialize();\n }\n\n async getLogs(filter?: {\n type?: string;\n offset?: number;\n limit?: number;\n head?: string;\n sort?: string;\n }): Promise<ComponentLog[]> {\n const allLogs = await this.factory.getLogs(this.id, false, filter?.head);\n\n if (!filter) return allLogs;\n\n const { type, limit, offset, sort } = filter;\n\n const typeFilter = (snap) => {\n if (type === 'tag') return snap.tag;\n if (type === 'snap') return !snap.tag;\n return true;\n };\n\n let filteredLogs = (type && allLogs.filter(typeFilter)) || allLogs;\n if (sort !== 'asc') filteredLogs = filteredLogs.reverse();\n\n if (limit) {\n filteredLogs = slice(filteredLogs, offset, limit + (offset || 0));\n }\n\n return filteredLogs;\n }\n\n getDependencies(): DependencyList {\n return this.factory.getDependencies(this);\n }\n\n getPackageName(): string {\n return this.factory.componentPackageName(this);\n }\n\n stringify(): string {\n return JSON.stringify({\n id: this.id,\n head: this.head,\n });\n }\n\n /**\n * record component changes in the `Scope`.\n */\n // snap(author: Author, message = '') {\n // if (!this.isModified()) throw new NothingToSnap();\n // const snap = new Snap(this, author, message);\n\n // return new Component(this.id, snap, snap.state);\n // }\n\n /**\n * display name of the component.\n */\n get displayName() {\n const tokens = this.id.name.split('-').map((token) => capitalize(token));\n return tokens.join(' ');\n }\n\n /**\n * tag a component `Snap` with a semantic version. we follow SemVer specs as defined [here](https://semver.org/)).\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n tag(version: SemVer) {\n // const snap = this.snap();\n // const tag = new Tag(version, snap);\n // this.tags.set(tag);\n }\n\n /**\n * determines whether this component is modified in the workspace.\n */\n isModified(): Promise<boolean> {\n return this.factory.isModified(this);\n }\n\n /**\n * whether a component is marked as deleted.\n * warning! if this component is not the head, it might be deleted by a range later on.\n * to get accurate results, please use teambit.component/remove aspect, \"isDeleted\" method.\n */\n isDeleted(): boolean {\n return this.state._consumer.isRemoved();\n }\n\n /**\n * is component isOutdated\n */\n isOutdated(): boolean {\n if (!this.latest) return false;\n const latestTag = this.tags.byVersion(this.latest);\n if (!latestTag) return false;\n if (this.head?.hash !== latestTag?.hash) return true;\n return false;\n }\n\n /**\n * determines whether this component is new.\n */\n isNew(): Promise<boolean> {\n return Promise.resolve(this.head === null);\n }\n\n /**\n * whether the component exists on the remote.\n */\n isExported(): boolean {\n return this.factory.isExported(this.id);\n }\n\n // TODO: @david after snap we need to make sure to refactor here.\n loadState(snapId: string): Promise<State> {\n return this.factory.getState(this.id, snapId);\n }\n\n loadSnap(snapId?: string): Promise<Snap> {\n const snapToGet = snapId || this.head?.hash;\n if (!snapToGet) {\n throw new BitError('could not load snap for new components');\n }\n return this.factory.getSnap(this.id, snapToGet);\n }\n\n /**\n * Get iterable which iterate over snap parents lazily\n * @param snapId\n * @param options\n */\n snapsIterable(snapId?: string, options: SnapsIterableOpts = {}): AsyncIterable<Snap> {\n const snapToStart = snapId || this.head?.hash;\n let nextSnaps = [snapToStart];\n let done;\n if (!snapToStart) {\n done = true;\n }\n\n const iterator: AsyncIterator<Snap> = {\n next: async () => {\n if (done) {\n return { value: undefined, done };\n }\n const currSnapId = nextSnaps.shift();\n const snap = await this.loadSnap(currSnapId);\n if (snap.parents && snap.parents.length) {\n if (options.firstParentOnly) {\n nextSnaps.push(snap.parents[0]);\n } else {\n nextSnaps = nextSnaps.concat(snap.parents);\n }\n }\n if (!nextSnaps.length) {\n done = true;\n } else if (options.stopFn) {\n done = await options.stopFn(snap);\n }\n return { value: snap, done: undefined };\n },\n };\n return {\n [Symbol.asyncIterator]: () => iterator,\n };\n }\n\n /**\n * traverse recursively from the provided snap (or head) upwards until it finds a tag\n * @param snapToStartFrom\n */\n async getClosestTag(snapToStartFrom?: string): Promise<Tag | undefined> {\n const tagsHashMap = this.tags.getHashMap();\n const stopFn = async (snap: Snap) => {\n if (tagsHashMap.has(snap.hash)) {\n return true;\n }\n return false;\n };\n const iterable = this.snapsIterable(snapToStartFrom, { firstParentOnly: true, stopFn });\n const snaps: Snap[] = [];\n for await (const snap of iterable) {\n snaps.push(snap);\n }\n if (snaps.length) {\n const hashOfLastSnap = snaps[snaps.length - 1].hash;\n return tagsHashMap.get(hashOfLastSnap);\n }\n return undefined;\n }\n\n /**\n * id.version can be either a tag or a hash.\n * if it's a hash, it may have a tag point to it. if it does, return the tag.\n */\n getTag(): Tag | undefined {\n const currentVersion = this.id.version;\n if (!currentVersion) return undefined;\n return this.tags.byVersion(currentVersion) || this.tags.byHash(currentVersion);\n }\n\n /**\n * id.version can be either a tag or a hash.\n * if it's a tag, find the hash it points to.\n */\n getSnapHash(): string | undefined {\n if (!this.id.hasVersion()) return undefined;\n const tag = this.tags.byVersion(this.id.version);\n if (tag) return tag.hash;\n return this.id.version;\n }\n\n /**\n * in case a component is new, it returns undefined.\n * otherwise, it returns the Snap object (hash/parents/log) of the current component (according to the version in the id)\n */\n async getCurrentSnap(): Promise<Snap | undefined> {\n const snap = this.getSnapHash();\n if (!snap) return undefined;\n return this.loadSnap(snap);\n }\n\n /**\n * checkout the component to a different version in its working tree.\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n checkout(version: SemVer) {}\n\n /**\n * examine difference between two components.\n */\n // diff(other: Component): Difference {}\n\n /**\n * merge two different components\n */\n // merge(other: Component): Component {}\n\n /**\n * write a component to a given file system.\n * @param path root path to write the component\n * @param fs instance of any fs to use.\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n write(path: string, fs?: AnyFS) {}\n\n /**\n *\n * Check if 2 components are equal\n * @param {Component} component\n * @returns {boolean}\n * @memberof Component\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n equals(component: Component): boolean {\n return component.id.toString() === this.id.toString();\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,eAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,cAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAE,UAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,SAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAIA,SAAAG,QAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,OAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAQA,SAAAI,QAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,OAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAK,YAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,WAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAPA;;AAEA;;AAOA;;AASA;AACA;AACA;AACO,MAAMM,SAAS,CAAuB;EAC3CC,WAAWA;EACT;AACJ;AACA;EACaC,EAAe;EAExB;AACJ;AACA;AACA;AACA;EACaC,IAAiB,GAAG,IAAI;EAEjC;AACJ;AACA;EACYC,MAAa;EAErB;AACJ;AACA;EACaC,IAAY,GAAG,KAAIC,gBAAM,EAAC,CAAC;EAEpC;AACJ;AACA;EACYC,OAAyB,EACjC;IAAA,KAvBSL,EAAe,GAAfA,EAAe;IAAA,KAOfC,IAAiB,GAAjBA,IAAiB;IAAA,KAKlBC,MAAa,GA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IAAI,CAAC1G,EAAE,CAAC0G,QAAQ,CAAC,CAAC;EACvD;AACF;AAACC,OAAA,CAAA7G,SAAA,GAAAA,SAAA","ignoreList":[]}
|
|
@@ -3,6 +3,7 @@ import { ExpressMain, Route } from '@teambit/express';
|
|
|
3
3
|
import { GraphqlMain } from '@teambit/graphql';
|
|
4
4
|
import { SlotRegistry } from '@teambit/harmony';
|
|
5
5
|
import { ComponentID } from '@teambit/component-id';
|
|
6
|
+
import { LoggerMain } from '@teambit/logger';
|
|
6
7
|
import { ExtensionDataList } from '@teambit/legacy/dist/consumer/config';
|
|
7
8
|
import { ComponentFactory } from './component-factory';
|
|
8
9
|
import { RegisteredComponentRoute } from './component.route';
|
|
@@ -71,5 +72,5 @@ export declare class ComponentMain {
|
|
|
71
72
|
static slots: (((registerFn: () => string) => SlotRegistry<Route[]>) | ((registerFn: () => string) => SlotRegistry<ComponentFactory>) | ((registerFn: () => string) => SlotRegistry<ShowFragment[]>))[];
|
|
72
73
|
static runtime: import("@teambit/harmony").RuntimeDefinition;
|
|
73
74
|
static dependencies: import("@teambit/harmony").Aspect[];
|
|
74
|
-
static provider([graphql, express, cli]: [GraphqlMain, ExpressMain, CLIMain], config: any, [hostSlot, showFragmentSlot]: [ComponentHostSlot, ShowFragmentSlot]): Promise<ComponentMain>;
|
|
75
|
+
static provider([graphql, express, cli, loggerMain]: [GraphqlMain, ExpressMain, CLIMain, LoggerMain], config: any, [hostSlot, showFragmentSlot]: [ComponentHostSlot, ShowFragmentSlot]): Promise<ComponentMain>;
|
|
75
76
|
}
|
|
@@ -39,6 +39,13 @@ function _lodash() {
|
|
|
39
39
|
};
|
|
40
40
|
return data;
|
|
41
41
|
}
|
|
42
|
+
function _logger() {
|
|
43
|
+
const data = require("@teambit/logger");
|
|
44
|
+
_logger = function () {
|
|
45
|
+
return data;
|
|
46
|
+
};
|
|
47
|
+
return data;
|
|
48
|
+
}
|
|
42
49
|
function _component() {
|
|
43
50
|
const data = require("./component.aspect");
|
|
44
51
|
_component = function () {
|
|
@@ -192,9 +199,10 @@ class ComponentMain {
|
|
|
192
199
|
this.showFragmentSlot.register(showFragments);
|
|
193
200
|
return this;
|
|
194
201
|
}
|
|
195
|
-
static async provider([graphql, express, cli], config, [hostSlot, showFragmentSlot]) {
|
|
202
|
+
static async provider([graphql, express, cli, loggerMain], config, [hostSlot, showFragmentSlot]) {
|
|
203
|
+
const logger = loggerMain.createLogger(_component().ComponentAspect.id);
|
|
196
204
|
const componentExtension = new ComponentMain(hostSlot, express, showFragmentSlot);
|
|
197
|
-
cli.register(new (_show().ShowCmd)(componentExtension));
|
|
205
|
+
cli.register(new (_show().ShowCmd)(componentExtension, logger));
|
|
198
206
|
componentExtension.registerShowFragments([new (_show().NameFragment)(), new (_show().MainFileFragment)(), new (_show().IDFragment)(), new (_show().ScopeFragment)(), new (_show().FilesFragment)(), new (_show().ExtensionsFragment)()]);
|
|
199
207
|
graphql.register((0, _component2().componentSchema)(componentExtension));
|
|
200
208
|
return componentExtension;
|
|
@@ -203,7 +211,7 @@ class ComponentMain {
|
|
|
203
211
|
exports.ComponentMain = ComponentMain;
|
|
204
212
|
_defineProperty(ComponentMain, "slots", [_harmony().Slot.withType(), _harmony().Slot.withType(), _harmony().Slot.withType()]);
|
|
205
213
|
_defineProperty(ComponentMain, "runtime", _cli().MainRuntime);
|
|
206
|
-
_defineProperty(ComponentMain, "dependencies", [_graphql().GraphqlAspect, _express().ExpressAspect, _cli().CLIAspect]);
|
|
214
|
+
_defineProperty(ComponentMain, "dependencies", [_graphql().GraphqlAspect, _express().ExpressAspect, _cli().CLIAspect, _logger().LoggerAspect]);
|
|
207
215
|
_component().ComponentAspect.addRuntime(ComponentMain);
|
|
208
216
|
|
|
209
217
|
//# sourceMappingURL=component.main.runtime.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_cli","data","require","_express","_graphql","_harmony","_lodash","_component","_component2","_component3","_aspectList","_exceptions","_show","_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","r","e","Symbol","toPrimitive","call","TypeError","String","Number","ComponentMain","constructor","hostSlot","express","showFragmentSlot","registerHost","host","register","createAspectListFromLegacy","legacyExtensionDataList","AspectList","fromLegacyExtensions","createAspectListFromEntries","entries","registerRoute","routes","routeEntries","map","route","ComponentRoute","flattenRoutes","flatten","setHostPriority","id","get","HostNotFound","_priorHost","getHost","getPriorHost","getHostIfExist","err","undefined","getRoute","routeName","toString","hosts","values","priorityHost","find","priority","getShowFragments","fragments","orderBy","isHost","name","registerShowFragments","showFragments","provider","graphql","cli","config","componentExtension","ShowCmd","NameFragment","MainFileFragment","IDFragment","ScopeFragment","FilesFragment","ExtensionsFragment","componentSchema","exports","Slot","withType","MainRuntime","GraphqlAspect","ExpressAspect","CLIAspect","ComponentAspect","addRuntime"],"sources":["component.main.runtime.ts"],"sourcesContent":["import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { ExpressAspect, ExpressMain, Route } from '@teambit/express';\nimport { GraphqlAspect, GraphqlMain } from '@teambit/graphql';\nimport { Slot, SlotRegistry } from '@teambit/harmony';\nimport { ComponentID } from '@teambit/component-id';\nimport { flatten, orderBy } from 'lodash';\nimport { ExtensionDataList } from '@teambit/legacy/dist/consumer/config';\nimport { ComponentFactory } from './component-factory';\nimport { ComponentAspect } from './component.aspect';\nimport { componentSchema } from './component.graphql';\nimport { ComponentRoute, RegisteredComponentRoute } from './component.route';\nimport { AspectList } from './aspect-list';\nimport { HostNotFound } from './exceptions';\nimport { AspectEntry } from './aspect-entry';\nimport {\n ShowCmd,\n ShowFragment,\n NameFragment,\n MainFileFragment,\n IDFragment,\n ScopeFragment,\n FilesFragment,\n ExtensionsFragment,\n} from './show';\n\nexport type ComponentHostSlot = SlotRegistry<ComponentFactory>;\n\nexport type ShowFragmentSlot = SlotRegistry<ShowFragment[]>;\n\nexport class ComponentMain {\n constructor(\n /**\n * slot for component hosts to register.\n */\n private hostSlot: ComponentHostSlot,\n\n /**\n * Express Extension\n */\n private express: ExpressMain,\n\n private showFragmentSlot: ShowFragmentSlot\n ) {}\n\n /**\n * register a new component host.\n */\n registerHost(host: ComponentFactory) {\n this.hostSlot.register(host);\n return this;\n }\n\n /**\n * important! avoid using this method.\n * seems like this method was written to work around a very specific case when the ComponentID of the aspects are\n * not available. in case of new components, to get the ComponentID, the workspace-aspect is needed to get the\n * default-scope. when this method is called from the scope, there is no way to get the real component-id.\n * instead, this method asks for the \"scope\", which when called by the scope-aspect is the current scope-name.\n * it may or may not be the real scope-name of the aspect.\n * to fix this possibly incorrect scope-name, the `workspace.resolveScopeAspectListIds()` checks whether the\n * scope-name is the same as scope.name, and if so, resolve it to the correct scope-name.\n */\n createAspectListFromLegacy(legacyExtensionDataList: ExtensionDataList) {\n return AspectList.fromLegacyExtensions(legacyExtensionDataList);\n }\n\n createAspectListFromEntries(entries: AspectEntry[]) {\n return new AspectList(entries);\n }\n\n registerRoute(routes: RegisteredComponentRoute[]) {\n const routeEntries = routes.map((route: RegisteredComponentRoute) => {\n return new ComponentRoute(route, this);\n });\n\n const flattenRoutes = flatten(routeEntries) as any as Route[];\n\n this.express.register(flattenRoutes);\n return this;\n }\n\n /**\n * set the prior host.\n */\n setHostPriority(id: string) {\n const host = this.hostSlot.get(id);\n if (!host) {\n throw new HostNotFound(id);\n }\n\n this._priorHost = host;\n return this;\n }\n\n /**\n * get component host by extension ID.\n */\n getHost(id?: string): ComponentFactory {\n if (id) {\n const host = this.hostSlot.get(id);\n if (!host) throw new HostNotFound(id);\n return host;\n }\n\n return this.getPriorHost();\n }\n\n getHostIfExist(id?: string): ComponentFactory | undefined {\n try {\n return this.getHost(id);\n } catch (err) {\n if (err instanceof HostNotFound) return undefined;\n throw err;\n }\n }\n\n getRoute(id: ComponentID, routeName: string) {\n return `/api/${id.toString()}/~aspect/${routeName}`;\n }\n\n /**\n * get the prior host.\n */\n private getPriorHost() {\n if (this._priorHost) return this._priorHost;\n\n const hosts = this.hostSlot.values();\n const priorityHost = hosts.find((host) => host.priority);\n return priorityHost || hosts[0];\n }\n\n getShowFragments() {\n const fragments = orderBy(flatten(this.showFragmentSlot.values()), ['weight', ['asc']]);\n return fragments;\n }\n\n isHost(name: string) {\n return !!this.hostSlot.get(name);\n }\n\n /**\n * register a show fragment to display further information in the `bit show` command.\n */\n registerShowFragments(showFragments: ShowFragment[]) {\n this.showFragmentSlot.register(showFragments);\n return this;\n }\n\n private _priorHost: ComponentFactory | undefined;\n\n static slots = [Slot.withType<ComponentFactory>(), Slot.withType<Route[]>(), Slot.withType<ShowFragment[]>()];\n\n static runtime = MainRuntime;\n static dependencies = [GraphqlAspect, ExpressAspect, CLIAspect];\n\n static async provider(\n [graphql, express, cli]: [GraphqlMain, ExpressMain, CLIMain],\n config,\n [hostSlot, showFragmentSlot]: [ComponentHostSlot, ShowFragmentSlot]\n ) {\n const componentExtension = new ComponentMain(hostSlot, express, showFragmentSlot);\n cli.register(new ShowCmd(componentExtension));\n\n componentExtension.registerShowFragments([\n new NameFragment(),\n new MainFileFragment(),\n new IDFragment(),\n new ScopeFragment(),\n new FilesFragment(),\n new ExtensionsFragment(),\n ]);\n graphql.register(componentSchema(componentExtension));\n\n return componentExtension;\n }\n}\n\nComponentAspect.addRuntime(ComponentMain);\n"],"mappings":";;;;;;AAAA,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,IAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,SAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,QAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,SAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,QAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,SAAA;EAAA,MAAAJ,IAA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AAC,IAAAoD,6BAAe,EAACR,kBAAkB,CAAC,CAAC;IAErD,OAAOA,kBAAkB;EAC3B;AACF;AAACS,OAAA,CAAA5D,aAAA,GAAAA,aAAA;AAAArB,eAAA,CAlJYqB,aAAa,WAyHT,CAAC6D,eAAI,CAACC,QAAQ,CAAmB,CAAC,EAAED,eAAI,CAACC,QAAQ,CAAU,CAAC,EAAED,eAAI,CAACC,QAAQ,CAAiB,CAAC,CAAC;AAAAnF,eAAA,CAzHlGqB,aAAa,aA2HP+D,kBAAW;AAAApF,eAAA,CA3HjBqB,aAAa,kBA4HF,CAACgE,wBAAa,EAAEC,wBAAa,EAAEC,gBAAS,CAAC;AAwBjEC,4BAAe,CAACC,UAAU,CAACpE,aAAa,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_cli","data","require","_express","_graphql","_harmony","_lodash","_logger","_component","_component2","_component3","_aspectList","_exceptions","_show","_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","r","e","Symbol","toPrimitive","call","TypeError","String","Number","ComponentMain","constructor","hostSlot","express","showFragmentSlot","registerHost","host","register","createAspectListFromLegacy","legacyExtensionDataList","AspectList","fromLegacyExtensions","createAspectListFromEntries","entries","registerRoute","routes","routeEntries","map","route","ComponentRoute","flattenRoutes","flatten","setHostPriority","id","get","HostNotFound","_priorHost","getHost","getPriorHost","getHostIfExist","err","undefined","getRoute","routeName","toString","hosts","values","priorityHost","find","priority","getShowFragments","fragments","orderBy","isHost","name","registerShowFragments","showFragments","provider","graphql","cli","loggerMain","config","logger","createLogger","ComponentAspect","componentExtension","ShowCmd","NameFragment","MainFileFragment","IDFragment","ScopeFragment","FilesFragment","ExtensionsFragment","componentSchema","exports","Slot","withType","MainRuntime","GraphqlAspect","ExpressAspect","CLIAspect","LoggerAspect","addRuntime"],"sources":["component.main.runtime.ts"],"sourcesContent":["import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { ExpressAspect, ExpressMain, Route } from '@teambit/express';\nimport { GraphqlAspect, GraphqlMain } from '@teambit/graphql';\nimport { Slot, SlotRegistry } from '@teambit/harmony';\nimport { ComponentID } from '@teambit/component-id';\nimport { flatten, orderBy } from 'lodash';\nimport { LoggerAspect, LoggerMain } from '@teambit/logger';\nimport { ExtensionDataList } from '@teambit/legacy/dist/consumer/config';\nimport { ComponentFactory } from './component-factory';\nimport { ComponentAspect } from './component.aspect';\nimport { componentSchema } from './component.graphql';\nimport { ComponentRoute, RegisteredComponentRoute } from './component.route';\nimport { AspectList } from './aspect-list';\nimport { HostNotFound } from './exceptions';\nimport { AspectEntry } from './aspect-entry';\nimport {\n ShowCmd,\n ShowFragment,\n NameFragment,\n MainFileFragment,\n IDFragment,\n ScopeFragment,\n FilesFragment,\n ExtensionsFragment,\n} from './show';\n\nexport type ComponentHostSlot = SlotRegistry<ComponentFactory>;\n\nexport type ShowFragmentSlot = SlotRegistry<ShowFragment[]>;\n\nexport class ComponentMain {\n constructor(\n /**\n * slot for component hosts to register.\n */\n private hostSlot: ComponentHostSlot,\n\n /**\n * Express Extension\n */\n private express: ExpressMain,\n\n private showFragmentSlot: ShowFragmentSlot\n ) {}\n\n /**\n * register a new component host.\n */\n registerHost(host: ComponentFactory) {\n this.hostSlot.register(host);\n return this;\n }\n\n /**\n * important! avoid using this method.\n * seems like this method was written to work around a very specific case when the ComponentID of the aspects are\n * not available. in case of new components, to get the ComponentID, the workspace-aspect is needed to get the\n * default-scope. when this method is called from the scope, there is no way to get the real component-id.\n * instead, this method asks for the \"scope\", which when called by the scope-aspect is the current scope-name.\n * it may or may not be the real scope-name of the aspect.\n * to fix this possibly incorrect scope-name, the `workspace.resolveScopeAspectListIds()` checks whether the\n * scope-name is the same as scope.name, and if so, resolve it to the correct scope-name.\n */\n createAspectListFromLegacy(legacyExtensionDataList: ExtensionDataList) {\n return AspectList.fromLegacyExtensions(legacyExtensionDataList);\n }\n\n createAspectListFromEntries(entries: AspectEntry[]) {\n return new AspectList(entries);\n }\n\n registerRoute(routes: RegisteredComponentRoute[]) {\n const routeEntries = routes.map((route: RegisteredComponentRoute) => {\n return new ComponentRoute(route, this);\n });\n\n const flattenRoutes = flatten(routeEntries) as any as Route[];\n\n this.express.register(flattenRoutes);\n return this;\n }\n\n /**\n * set the prior host.\n */\n setHostPriority(id: string) {\n const host = this.hostSlot.get(id);\n if (!host) {\n throw new HostNotFound(id);\n }\n\n this._priorHost = host;\n return this;\n }\n\n /**\n * get component host by extension ID.\n */\n getHost(id?: string): ComponentFactory {\n if (id) {\n const host = this.hostSlot.get(id);\n if (!host) throw new HostNotFound(id);\n return host;\n }\n\n return this.getPriorHost();\n }\n\n getHostIfExist(id?: string): ComponentFactory | undefined {\n try {\n return this.getHost(id);\n } catch (err) {\n if (err instanceof HostNotFound) return undefined;\n throw err;\n }\n }\n\n getRoute(id: ComponentID, routeName: string) {\n return `/api/${id.toString()}/~aspect/${routeName}`;\n }\n\n /**\n * get the prior host.\n */\n private getPriorHost() {\n if (this._priorHost) return this._priorHost;\n\n const hosts = this.hostSlot.values();\n const priorityHost = hosts.find((host) => host.priority);\n return priorityHost || hosts[0];\n }\n\n getShowFragments() {\n const fragments = orderBy(flatten(this.showFragmentSlot.values()), ['weight', ['asc']]);\n return fragments;\n }\n\n isHost(name: string) {\n return !!this.hostSlot.get(name);\n }\n\n /**\n * register a show fragment to display further information in the `bit show` command.\n */\n registerShowFragments(showFragments: ShowFragment[]) {\n this.showFragmentSlot.register(showFragments);\n return this;\n }\n\n private _priorHost: ComponentFactory | undefined;\n\n static slots = [Slot.withType<ComponentFactory>(), Slot.withType<Route[]>(), Slot.withType<ShowFragment[]>()];\n\n static runtime = MainRuntime;\n static dependencies = [GraphqlAspect, ExpressAspect, CLIAspect, LoggerAspect];\n\n static async provider(\n [graphql, express, cli, loggerMain]: [GraphqlMain, ExpressMain, CLIMain, LoggerMain],\n config,\n [hostSlot, showFragmentSlot]: [ComponentHostSlot, ShowFragmentSlot]\n ) {\n const logger = loggerMain.createLogger(ComponentAspect.id);\n const componentExtension = new ComponentMain(hostSlot, express, showFragmentSlot);\n cli.register(new ShowCmd(componentExtension, logger));\n\n componentExtension.registerShowFragments([\n new NameFragment(),\n new MainFileFragment(),\n new IDFragment(),\n new ScopeFragment(),\n new FilesFragment(),\n new ExtensionsFragment(),\n ]);\n graphql.register(componentSchema(componentExtension));\n\n return componentExtension;\n }\n}\n\nComponentAspect.addRuntime(ComponentMain);\n"],"mappings":";;;;;;AAAA,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,IAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,SAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,QAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,SAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,QAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,SAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,QAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAK,QAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,OAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,QAAA;EAAA,MAAAN,IAAA,GAAAC,OAAA;EAAAK,OAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAO,WAAA;EAAA,MAAAP,IAAA,GAAAC,OAAA;EAAAM,UAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAQ,YAAA;EAAA,MAAAR,IAAA,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vF,eAAA,CAzHlGqB,aAAa,aA2HPmE,kBAAW;AAAAxF,eAAA,CA3HjBqB,aAAa,kBA4HF,CAACoE,wBAAa,EAAEC,wBAAa,EAAEC,gBAAS,EAAEC,sBAAY,CAAC;AAyB/EjB,4BAAe,CAACkB,UAAU,CAACxE,aAAa,CAAC","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.component_component@1.0.
|
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.component_component@1.0.
|
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.component_component@1.0.282/dist/component.composition.js';
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.component_component@1.0.282/dist/component.docs.mdx';
|
|
3
3
|
|
|
4
4
|
export const compositions = [compositions_0];
|
|
5
5
|
export const overview = [overview_0];
|
package/dist/show/show.cmd.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { Command, CommandOptions } from '@teambit/cli';
|
|
2
|
+
import { Logger } from '@teambit/logger';
|
|
2
3
|
import { ComponentMain } from '../component.main.runtime';
|
|
3
4
|
export declare class ShowCmd implements Command {
|
|
4
5
|
private component;
|
|
6
|
+
private logger;
|
|
5
7
|
name: string;
|
|
6
8
|
description: string;
|
|
7
9
|
alias: string;
|
|
@@ -11,13 +13,14 @@ export declare class ShowCmd implements Command {
|
|
|
11
13
|
description: string;
|
|
12
14
|
}[];
|
|
13
15
|
options: CommandOptions;
|
|
14
|
-
constructor(component: ComponentMain);
|
|
16
|
+
constructor(component: ComponentMain, logger: Logger);
|
|
15
17
|
private getComponent;
|
|
16
18
|
useLegacy(id: string, json?: boolean, remote?: boolean, compare?: boolean): Promise<string>;
|
|
17
|
-
report([idStr]: [string], { legacy, remote, compare }: {
|
|
19
|
+
report([idStr]: [string], { legacy, remote, compare, browser }: {
|
|
18
20
|
legacy: boolean;
|
|
19
21
|
remote: boolean;
|
|
20
22
|
compare: boolean;
|
|
23
|
+
browser: boolean;
|
|
21
24
|
}): Promise<string>;
|
|
22
25
|
json([idStr]: [string], { remote, legacy }: {
|
|
23
26
|
remote: boolean;
|
package/dist/show/show.cmd.js
CHANGED
|
@@ -4,6 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.ShowCmd = void 0;
|
|
7
|
+
function _open() {
|
|
8
|
+
const data = _interopRequireDefault(require("open"));
|
|
9
|
+
_open = function () {
|
|
10
|
+
return data;
|
|
11
|
+
};
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
7
14
|
function _lodash() {
|
|
8
15
|
const data = require("lodash");
|
|
9
16
|
_lodash = function () {
|
|
@@ -45,8 +52,9 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
45
52
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } // import { Logger } from '@teambit/logger';
|
|
46
53
|
// import chalk from 'chalk';
|
|
47
54
|
class ShowCmd {
|
|
48
|
-
constructor(component) {
|
|
55
|
+
constructor(component, logger) {
|
|
49
56
|
this.component = component;
|
|
57
|
+
this.logger = logger;
|
|
50
58
|
_defineProperty(this, "name", 'show <component-name>');
|
|
51
59
|
_defineProperty(this, "description", "display the component's essential information");
|
|
52
60
|
_defineProperty(this, "alias", '');
|
|
@@ -55,7 +63,7 @@ class ShowCmd {
|
|
|
55
63
|
name: 'component-name',
|
|
56
64
|
description: 'component name or component id'
|
|
57
65
|
}]);
|
|
58
|
-
_defineProperty(this, "options", [['j', 'json', 'return the component data in json format'], ['l', 'legacy', 'use the legacy bit show.'], ['r', 'remote', 'show data for a remote component'], ['c', 'compare', 'legacy-only. compare current file system component to its latest tagged version [default=latest]']]);
|
|
66
|
+
_defineProperty(this, "options", [['j', 'json', 'return the component data in json format'], ['l', 'legacy', 'use the legacy bit show.'], ['r', 'remote', 'show data for a remote component'], ['b', 'browser', 'open the component page in the browser'], ['c', 'compare', 'legacy-only. compare current file system component to its latest tagged version [default=latest]']]);
|
|
59
67
|
}
|
|
60
68
|
async getComponent(idStr, remote) {
|
|
61
69
|
if (remote) {
|
|
@@ -88,7 +96,8 @@ to see the legacy bit show, please use "--legacy" flag`);
|
|
|
88
96
|
async report([idStr], {
|
|
89
97
|
legacy,
|
|
90
98
|
remote,
|
|
91
|
-
compare
|
|
99
|
+
compare,
|
|
100
|
+
browser
|
|
92
101
|
}) {
|
|
93
102
|
if (legacy) return this.useLegacy(idStr, false, remote, compare);
|
|
94
103
|
const component = await this.getComponent(idStr, remote);
|
|
@@ -99,7 +108,23 @@ to see the legacy bit show, please use "--legacy" flag`);
|
|
|
99
108
|
return [row.title, row.content];
|
|
100
109
|
}));
|
|
101
110
|
const table = new (_cliTable().CLITable)([], (0, _lodash().compact)(rows));
|
|
102
|
-
|
|
111
|
+
const renderedTable = table.render();
|
|
112
|
+
if (browser) {
|
|
113
|
+
const isExported = component.isExported();
|
|
114
|
+
if (!isExported) {
|
|
115
|
+
this.logger.consoleWarning(`unable to open the browser, the component "${idStr}" has not been exported yet`);
|
|
116
|
+
return renderedTable;
|
|
117
|
+
}
|
|
118
|
+
const homepageUrl = component.homepage;
|
|
119
|
+
if (!homepageUrl || homepageUrl === '') {
|
|
120
|
+
this.logger.consoleWarning(`unable to open browser, the component ${idStr} does not have a homepage`);
|
|
121
|
+
return renderedTable;
|
|
122
|
+
}
|
|
123
|
+
(0, _open().default)(homepageUrl).catch(err => {
|
|
124
|
+
this.logger.error(`failed to open browser for component ${idStr}, err: ${err}`);
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
return renderedTable;
|
|
103
128
|
}
|
|
104
129
|
async json([idStr], {
|
|
105
130
|
remote,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_lodash","data","require","_cliTable","_exceptions","_componentId","_showCmd","_interopRequireDefault","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","r","e","Symbol","toPrimitive","call","TypeError","String","Number","ShowCmd","constructor","component","name","description","getComponent","idStr","remote","id","ComponentID","fromString","host","getHostIfExist","Error","getRemoteComponent","getHost","resolveComponentId","get","MissingBitMapComponent","useLegacy","json","compare","legacyShow","LegacyShow","showData","action","versions","undefined","report","legacy","fragments","getShowFragments","rows","Promise","all","map","fragment","row","renderRow","content","title","table","CLITable","compact","render","JSON","parse","filter","exports"],"sources":["show.cmd.ts"],"sourcesContent":["import { Command, CommandOptions } from '@teambit/cli';\nimport { compact } from 'lodash';\n// import { Logger } from '@teambit/logger';\n// import chalk from 'chalk';\nimport { CLITable } from '@teambit/cli-table';\nimport { MissingBitMapComponent } from '@teambit/legacy/dist/consumer/bit-map/exceptions';\nimport { ComponentID } from '@teambit/component-id';\nimport LegacyShow from '@teambit/legacy/dist/cli/commands/public-cmds/show-cmd';\nimport { ComponentMain } from '../component.main.runtime';\n\nexport class ShowCmd implements Command {\n name = 'show <component-name>';\n description = \"display the component's essential information\";\n alias = '';\n group = 'info';\n arguments = [{ name: 'component-name', description: 'component name or component id' }];\n options = [\n ['j', 'json', 'return the component data in json format'],\n ['l', 'legacy', 'use the legacy bit show.'],\n ['r', 'remote', 'show data for a remote component'],\n [\n 'c',\n 'compare',\n 'legacy-only. compare current file system component to its latest tagged version [default=latest]',\n ],\n ] as CommandOptions;\n\n constructor(private component: ComponentMain) {}\n\n private async getComponent(idStr: string, remote: boolean) {\n if (remote) {\n const id = ComponentID.fromString(idStr); // user used --remote so we know it has a scope\n const host = this.component.getHostIfExist('teambit.scope/scope');\n if (!host)\n throw new Error(`error: the current directory is not a workspace nor a scope. the full \"bit show\" is not supported.\nto see the legacy bit show, please use \"--legacy\" flag`);\n if (!host.getRemoteComponent) {\n throw new Error('Component Host does not implement getRemoteComponent()');\n }\n const component = await host.getRemoteComponent(id);\n return component;\n }\n const host = this.component.getHost();\n const id = await host.resolveComponentId(idStr);\n const component = await host.get(id);\n if (!component) throw new MissingBitMapComponent(idStr);\n return component;\n }\n\n async useLegacy(id: string, json = false, remote = false, compare = false) {\n const legacyShow = new LegacyShow();\n const showData = await legacyShow.action([id], {\n json,\n versions: undefined,\n remote,\n compare,\n });\n\n return legacyShow.report(showData);\n }\n\n async report([idStr]: [string], { legacy, remote, compare }: { legacy: boolean; remote: boolean; compare: boolean }) {\n if (legacy) return this.useLegacy(idStr, false, remote, compare);\n const component = await this.getComponent(idStr, remote);\n const fragments = this.component.getShowFragments();\n const rows = await Promise.all(\n fragments.map(async (fragment) => {\n const row = await fragment.renderRow(component);\n if (!row.content) return null;\n return [row.title, row.content];\n })\n );\n\n const table = new CLITable([], compact(rows));\n return table.render();\n }\n\n async json([idStr]: [string], { remote, legacy }: { remote: boolean; legacy: boolean }) {\n if (legacy) return JSON.parse(await this.useLegacy(idStr, true, remote));\n const component = await this.getComponent(idStr, remote);\n const fragments = this.component.getShowFragments();\n const rows = await Promise.all(\n fragments.map(async (fragment) => {\n return fragment.json ? fragment.json(component) : undefined;\n })\n );\n\n return rows.filter((row) => !!row);\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAE,UAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,SAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,YAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,WAAA,YAAAA,CAAA;IAAA,OAA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,CAAC,CAAC;EACvB;EAEA,MAAMxB,IAAIA,CAAC,CAACd,KAAK,CAAW,EAAE;IAAEC,MAAM;IAAEsB;EAA6C,CAAC,EAAE;IACtF,IAAIA,MAAM,EAAE,OAAOgB,IAAI,CAACC,KAAK,CAAC,MAAM,IAAI,CAAC3B,SAAS,CAACb,KAAK,EAAE,IAAI,EAAEC,MAAM,CAAC,CAAC;IACxE,MAAML,SAAS,GAAG,MAAM,IAAI,CAACG,YAAY,CAACC,KAAK,EAAEC,MAAM,CAAC;IACxD,MAAMuB,SAAS,GAAG,IAAI,CAAC5B,SAAS,CAAC6B,gBAAgB,CAAC,CAAC;IACnD,MAAMC,IAAI,GAAG,MAAMC,OAAO,CAACC,GAAG,CAC5BJ,SAAS,CAACK,GAAG,CAAC,MAAOC,QAAQ,IAAK;MAChC,OAAOA,QAAQ,CAAChB,IAAI,GAAGgB,QAAQ,CAAChB,IAAI,CAAClB,SAAS,CAAC,GAAGyB,SAAS;IAC7D,CAAC,CACH,CAAC;IAED,OAAOK,IAAI,CAACe,MAAM,CAAEV,GAAG,IAAK,CAAC,CAACA,GAAG,CAAC;EACpC;AACF;AAACW,OAAA,CAAAhD,OAAA,GAAAA,OAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_open","data","_interopRequireDefault","require","_lodash","_cliTable","_exceptions","_componentId","_showCmd","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","r","e","Symbol","toPrimitive","call","TypeError","String","Number","ShowCmd","constructor","component","logger","name","description","getComponent","idStr","remote","id","ComponentID","fromString","host","getHostIfExist","Error","getRemoteComponent","getHost","resolveComponentId","get","MissingBitMapComponent","useLegacy","json","compare","legacyShow","LegacyShow","showData","action","versions","undefined","report","legacy","browser","fragments","getShowFragments","rows","Promise","all","map","fragment","row","renderRow","content","title","table","CLITable","compact","renderedTable","render","isExported","consoleWarning","homepageUrl","homepage","open","catch","err","error","JSON","parse","filter","exports"],"sources":["show.cmd.ts"],"sourcesContent":["import open from 'open';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { compact } from 'lodash';\n// import { Logger } from '@teambit/logger';\n// import chalk from 'chalk';\nimport { CLITable } from '@teambit/cli-table';\nimport { MissingBitMapComponent } from '@teambit/legacy/dist/consumer/bit-map/exceptions';\nimport { ComponentID } from '@teambit/component-id';\nimport LegacyShow from '@teambit/legacy/dist/cli/commands/public-cmds/show-cmd';\nimport { Logger } from '@teambit/logger';\nimport { ComponentMain } from '../component.main.runtime';\n\nexport class ShowCmd implements Command {\n name = 'show <component-name>';\n description = \"display the component's essential information\";\n alias = '';\n group = 'info';\n arguments = [{ name: 'component-name', description: 'component name or component id' }];\n options = [\n ['j', 'json', 'return the component data in json format'],\n ['l', 'legacy', 'use the legacy bit show.'],\n ['r', 'remote', 'show data for a remote component'],\n ['b', 'browser', 'open the component page in the browser'],\n [\n 'c',\n 'compare',\n 'legacy-only. compare current file system component to its latest tagged version [default=latest]',\n ],\n ] as CommandOptions;\n\n constructor(private component: ComponentMain, private logger: Logger) {}\n\n private async getComponent(idStr: string, remote: boolean) {\n if (remote) {\n const id = ComponentID.fromString(idStr); // user used --remote so we know it has a scope\n const host = this.component.getHostIfExist('teambit.scope/scope');\n if (!host)\n throw new Error(`error: the current directory is not a workspace nor a scope. the full \"bit show\" is not supported.\nto see the legacy bit show, please use \"--legacy\" flag`);\n if (!host.getRemoteComponent) {\n throw new Error('Component Host does not implement getRemoteComponent()');\n }\n const component = await host.getRemoteComponent(id);\n return component;\n }\n const host = this.component.getHost();\n const id = await host.resolveComponentId(idStr);\n const component = await host.get(id);\n if (!component) throw new MissingBitMapComponent(idStr);\n return component;\n }\n\n async useLegacy(id: string, json = false, remote = false, compare = false) {\n const legacyShow = new LegacyShow();\n const showData = await legacyShow.action([id], {\n json,\n versions: undefined,\n remote,\n compare,\n });\n\n return legacyShow.report(showData);\n }\n\n async report(\n [idStr]: [string],\n { legacy, remote, compare, browser }: { legacy: boolean; remote: boolean; compare: boolean; browser: boolean }\n ) {\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 const renderedTable = table.render();\n if (browser) {\n const isExported = component.isExported();\n if (!isExported) {\n this.logger.consoleWarning(`unable to open the browser, the component \"${idStr}\" has not been exported yet`);\n return renderedTable;\n }\n const homepageUrl = component.homepage;\n if (!homepageUrl || homepageUrl === '') {\n this.logger.consoleWarning(`unable to open browser, the component ${idStr} does not have a homepage`);\n return renderedTable;\n }\n open(homepageUrl).catch((err) => {\n this.logger.error(`failed to open browser for component ${idStr}, err: ${err}`);\n });\n }\n return renderedTable;\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":";;;;;;AAAA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAG,QAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAI,UAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,SAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,YAAA;EAAA,MAAAL,IAAA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AACC,GAAG,CAC5BJ,SAAS,CAACK,GAAG,CAAC,MAAOC,QAAQ,IAAK;MAChC,OAAOA,QAAQ,CAACjB,IAAI,GAAGiB,QAAQ,CAACjB,IAAI,CAACnB,SAAS,CAAC,GAAG0B,SAAS;IAC7D,CAAC,CACH,CAAC;IAED,OAAOM,IAAI,CAACwB,MAAM,CAAEnB,GAAG,IAAK,CAAC,CAACA,GAAG,CAAC;EACpC;AACF;AAACoB,OAAA,CAAA3D,OAAA,GAAAA,OAAA","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/component",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.282",
|
|
4
4
|
"homepage": "https://bit.cloud/teambit/component/component",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.component",
|
|
8
8
|
"name": "component",
|
|
9
|
-
"version": "1.0.
|
|
9
|
+
"version": "1.0.282"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@teambit/any-fs": "0.0.5",
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"semver": "7.5.2",
|
|
18
18
|
"copy-to-clipboard": "3.3.1",
|
|
19
19
|
"lodash.flatten": "4.4.0",
|
|
20
|
+
"open": "7.4.2",
|
|
20
21
|
"classnames": "2.2.6",
|
|
21
22
|
"lodash.compact": "3.0.1",
|
|
22
23
|
"@teambit/component-id": "1.2.0",
|
|
@@ -31,43 +32,44 @@
|
|
|
31
32
|
"@teambit/ui-foundation.ui.use-box.menu": "1.0.10",
|
|
32
33
|
"@teambit/ui-foundation.ui.hooks.use-data-query": "0.0.505",
|
|
33
34
|
"@teambit/ui-foundation.ui.react-router.use-query": "0.0.501",
|
|
35
|
+
"@teambit/design.ui.pages.not-found": "0.0.371",
|
|
36
|
+
"@teambit/design.ui.pages.server-error": "0.0.368",
|
|
34
37
|
"@teambit/design.ui.empty-box": "0.0.363",
|
|
35
38
|
"@teambit/documenter.ui.heading": "4.1.1",
|
|
36
39
|
"@teambit/documenter.ui.separator": "4.1.1",
|
|
37
|
-
"@teambit/design.ui.
|
|
38
|
-
"@teambit/
|
|
40
|
+
"@teambit/design.ui.styles.ellipsis": "0.0.357",
|
|
41
|
+
"@teambit/explorer.ui.command-bar": "2.0.14",
|
|
39
42
|
"@teambit/design.navigation.responsive-navbar": "0.0.7",
|
|
40
43
|
"@teambit/base-ui.layout.breakpoints": "1.0.0",
|
|
41
44
|
"@teambit/ui-foundation.ui.use-box.dropdown": "0.0.142",
|
|
42
|
-
"@teambit/
|
|
43
|
-
"@teambit/
|
|
44
|
-
"@teambit/
|
|
45
|
-
"@teambit/dependency-resolver": "1.0.281",
|
|
46
|
-
"@teambit/graph": "1.0.281",
|
|
45
|
+
"@teambit/aspect-loader": "1.0.282",
|
|
46
|
+
"@teambit/dependency-resolver": "1.0.282",
|
|
47
|
+
"@teambit/graph": "1.0.282",
|
|
47
48
|
"@teambit/toolbox.path.match-patterns": "0.0.15",
|
|
48
49
|
"@teambit/toolbox.string.capitalize": "0.0.496",
|
|
49
50
|
"@teambit/cli": "0.0.865",
|
|
50
51
|
"@teambit/express": "0.0.964",
|
|
51
|
-
"@teambit/graphql": "1.0.
|
|
52
|
-
"@teambit/
|
|
52
|
+
"@teambit/graphql": "1.0.282",
|
|
53
|
+
"@teambit/logger": "0.0.958",
|
|
54
|
+
"@teambit/command-bar": "1.0.282",
|
|
53
55
|
"@teambit/component-package-version": "0.0.433",
|
|
54
|
-
"@teambit/preview": "1.0.
|
|
55
|
-
"@teambit/pubsub": "1.0.
|
|
56
|
-
"@teambit/react-router": "1.0.
|
|
56
|
+
"@teambit/preview": "1.0.282",
|
|
57
|
+
"@teambit/pubsub": "1.0.282",
|
|
58
|
+
"@teambit/react-router": "1.0.282",
|
|
57
59
|
"@teambit/ui-foundation.ui.react-router.slot-router": "0.0.509",
|
|
58
|
-
"@teambit/ui": "1.0.
|
|
60
|
+
"@teambit/ui": "1.0.282",
|
|
59
61
|
"@teambit/component-issues": "0.0.149",
|
|
60
62
|
"@teambit/cli-table": "0.0.48",
|
|
61
63
|
"@teambit/legacy-component-log": "0.0.403",
|
|
62
64
|
"@teambit/component-descriptor": "0.0.419",
|
|
63
65
|
"@teambit/harmony.ui.aspect-box": "0.0.507",
|
|
64
|
-
"@teambit/compositions": "1.0.
|
|
65
|
-
"@teambit/deprecation": "1.0.
|
|
66
|
-
"@teambit/envs": "1.0.
|
|
66
|
+
"@teambit/compositions": "1.0.282",
|
|
67
|
+
"@teambit/deprecation": "1.0.282",
|
|
68
|
+
"@teambit/envs": "1.0.282",
|
|
69
|
+
"@teambit/envs.ui.env-icon": "0.0.505",
|
|
67
70
|
"@teambit/component.ui.version-dropdown": "0.0.862",
|
|
68
71
|
"@teambit/lanes.hooks.use-lanes": "0.0.264",
|
|
69
|
-
"@teambit/lanes.ui.models.lanes-model": "0.0.216"
|
|
70
|
-
"@teambit/envs.ui.env-icon": "0.0.505"
|
|
72
|
+
"@teambit/lanes.ui.models.lanes-model": "0.0.216"
|
|
71
73
|
},
|
|
72
74
|
"devDependencies": {
|
|
73
75
|
"@types/lodash": "4.14.165",
|