@teambit/component 1.0.227 → 1.0.229

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.
Files changed (88) hide show
  1. package/artifacts/__bit_junit.xml +1 -1
  2. package/artifacts/preview/teambit_component_component-preview.js +1 -1
  3. package/artifacts/schema.json +1643 -695
  4. package/dist/aspect-entry.d.ts +39 -0
  5. package/dist/aspect-list.d.ts +43 -0
  6. package/dist/aspect.section.d.ts +13 -0
  7. package/dist/component-factory.d.ts +150 -0
  8. package/dist/component-factory.js.map +1 -1
  9. package/dist/component-fs.d.ts +34 -0
  10. package/dist/component-interface.d.ts +22 -0
  11. package/dist/component-map/component-map.d.ts +63 -0
  12. package/dist/component-map/index.d.ts +1 -0
  13. package/dist/component-meta.d.ts +22 -0
  14. package/dist/component.aspect.d.ts +3 -0
  15. package/dist/component.composition.d.ts +1 -0
  16. package/dist/component.d.ts +183 -0
  17. package/dist/component.graphql.d.ts +83 -0
  18. package/dist/component.js +3 -0
  19. package/dist/component.js.map +1 -1
  20. package/dist/component.main.runtime.d.ts +75 -0
  21. package/dist/component.route.d.ts +18 -0
  22. package/dist/component.ui.runtime.d.ts +104 -0
  23. package/dist/config.d.ts +18 -0
  24. package/dist/dependencies/dependencies.d.ts +43 -0
  25. package/dist/dependencies/index.d.ts +1 -0
  26. package/dist/exceptions/could-not-find-latest.d.ts +4 -0
  27. package/dist/exceptions/host-not-found.d.ts +12 -0
  28. package/dist/exceptions/index.d.ts +4 -0
  29. package/dist/exceptions/main-file-not-found.d.ts +14 -0
  30. package/dist/exceptions/nothing-to-snap.d.ts +2 -0
  31. package/dist/get-component-opts.d.ts +13 -0
  32. package/dist/hash.d.ts +4 -0
  33. package/dist/head.d.ts +0 -0
  34. package/dist/history-graph.d.ts +2 -0
  35. package/dist/host/component-host-model.d.ts +7 -0
  36. package/dist/host/index.d.ts +2 -0
  37. package/dist/host/use-component-host.d.ts +6 -0
  38. package/dist/index.d.ts +37 -0
  39. package/dist/on-load.d.ts +0 -0
  40. package/dist/{preview-1712719054377.js → preview-1712822929999.js} +2 -2
  41. package/dist/section/index.d.ts +1 -0
  42. package/dist/section/section.d.ts +11 -0
  43. package/dist/show/extensions.fragment.d.ts +13 -0
  44. package/dist/show/files.fragment.d.ts +14 -0
  45. package/dist/show/id.fragment.d.ts +13 -0
  46. package/dist/show/index.d.ts +8 -0
  47. package/dist/show/main-file.fragment.d.ts +9 -0
  48. package/dist/show/name.fragment.d.ts +9 -0
  49. package/dist/show/scope.fragment.d.ts +10 -0
  50. package/dist/show/show-fragment.d.ts +37 -0
  51. package/dist/show/show.cmd.d.ts +26 -0
  52. package/dist/snap/author.d.ts +17 -0
  53. package/dist/snap/index.d.ts +2 -0
  54. package/dist/snap/snap.d.ts +56 -0
  55. package/dist/state.d.ts +65 -0
  56. package/dist/store.d.ts +3 -0
  57. package/dist/tag/index.d.ts +1 -0
  58. package/dist/tag/tag.d.ts +32 -0
  59. package/dist/tag-map.d.ts +35 -0
  60. package/dist/ui/aspect-page/aspect-page.d.ts +1 -0
  61. package/dist/ui/aspect-page/index.d.ts +1 -0
  62. package/dist/ui/component-error/component-error.d.ts +20 -0
  63. package/dist/ui/component-error/index.d.ts +1 -0
  64. package/dist/ui/component-model/component-model.d.ts +186 -0
  65. package/dist/ui/component-model/index.d.ts +1 -0
  66. package/dist/ui/component-searcher/component-result.d.ts +16 -0
  67. package/dist/ui/component-searcher/component-searcher.d.ts +22 -0
  68. package/dist/ui/component-searcher/index.d.ts +2 -0
  69. package/dist/ui/component.d.ts +26 -0
  70. package/dist/ui/context/component-context.d.ts +6 -0
  71. package/dist/ui/context/component-provider.d.ts +25 -0
  72. package/dist/ui/context/index.d.ts +3 -0
  73. package/dist/ui/index.d.ts +12 -0
  74. package/dist/ui/menu/index.d.ts +3 -0
  75. package/dist/ui/menu/menu-nav.d.ts +23 -0
  76. package/dist/ui/menu/menu.d.ts +97 -0
  77. package/dist/ui/menu/nav-plugin.d.ts +28 -0
  78. package/dist/ui/top-bar-nav/index.d.ts +1 -0
  79. package/dist/ui/top-bar-nav/top-bar-nav.d.ts +2 -0
  80. package/dist/ui/use-component-from-location.d.ts +1 -0
  81. package/dist/ui/use-component-logs.d.ts +16 -0
  82. package/dist/ui/use-component-query.d.ts +3 -0
  83. package/dist/ui/use-component.d.ts +3 -0
  84. package/dist/ui/use-component.fragments.d.ts +10 -0
  85. package/dist/ui/use-component.model.d.ts +44 -0
  86. package/dist/ui/use-component.utils.d.ts +1 -0
  87. package/package.json +20 -20
  88. package/tsconfig.json +1 -46
@@ -0,0 +1,83 @@
1
+ import { ComponentID, ComponentIdObj } from '@teambit/component-id';
2
+ import { ComponentLog } from '@teambit/legacy/dist/scope/models/model-component';
3
+ import { Component } from './component';
4
+ import { ComponentFactory } from './component-factory';
5
+ import { ComponentMain } from './component.main.runtime';
6
+ export declare function componentSchema(componentExtension: ComponentMain): {
7
+ typeDefs: import("graphql").DocumentNode;
8
+ resolvers: {
9
+ JSONObject: import("graphql").GraphQLScalarType;
10
+ Component: {
11
+ id: (component: Component) => ComponentIdObj;
12
+ displayName: (component: Component) => string;
13
+ fs: (component: Component) => string[];
14
+ log: (component: Component) => Promise<{
15
+ date: number;
16
+ email: string;
17
+ username: string | undefined;
18
+ displayName: string;
19
+ id: string;
20
+ hash: string;
21
+ timestamp: Date;
22
+ parents: string[];
23
+ author: import("./snap").Author;
24
+ message: string;
25
+ }>;
26
+ getFile: (component: Component, { path }: {
27
+ path: string;
28
+ }) => string | undefined;
29
+ mainFile: (component: Component) => any;
30
+ headTag: (component: Component) => import(".").TagProps | undefined;
31
+ latest: (component: Component) => string | undefined;
32
+ tags: (component: any) => any;
33
+ aspects: (component: Component, { include }: {
34
+ include?: string[];
35
+ }) => import("./component-interface").RawComponentMetadata[];
36
+ elementsUrl: () => undefined;
37
+ logs: (component: Component, filter?: {
38
+ type?: string;
39
+ offset?: number;
40
+ limit?: number;
41
+ head?: string;
42
+ sort?: string;
43
+ takeHeadFromComponent: boolean;
44
+ }) => Promise<{
45
+ id: string;
46
+ message: string;
47
+ username?: string | undefined;
48
+ displayName?: string | undefined;
49
+ email?: string | undefined;
50
+ date?: string | undefined;
51
+ hash: string;
52
+ tag?: string | undefined;
53
+ parents: string[];
54
+ profileImage?: string | undefined;
55
+ onLane?: boolean | undefined;
56
+ }[]>;
57
+ };
58
+ ComponentHost: {
59
+ get: (host: ComponentFactory, { id }: {
60
+ id: string;
61
+ }) => Promise<Component | null | undefined>;
62
+ snaps: (host: ComponentFactory, { id }: {
63
+ id: string;
64
+ }) => Promise<ComponentLog[]>;
65
+ list: (host: ComponentFactory, filter?: {
66
+ offset: number;
67
+ limit: number;
68
+ }) => Promise<Component[]>;
69
+ listInvalid: (host: ComponentFactory) => Promise<{
70
+ id: ComponentID;
71
+ errorName: string;
72
+ errorMessage: string;
73
+ }[]>;
74
+ id: (host: ComponentFactory) => Promise<string>;
75
+ name: (host: ComponentFactory) => Promise<string>;
76
+ };
77
+ Query: {
78
+ getHost: (componentExt: ComponentMain, { id }: {
79
+ id: string;
80
+ }) => ComponentFactory;
81
+ };
82
+ };
83
+ };
package/dist/component.js CHANGED
@@ -154,6 +154,9 @@ class Component {
154
154
  getDependencies() {
155
155
  return this.factory.getDependencies(this);
156
156
  }
157
+ getPackageName() {
158
+ return this.factory.componentPackageName(this);
159
+ }
157
160
  stringify() {
158
161
  return JSON.stringify({
159
162
  id: this.id,
@@ -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","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 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 */\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,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,GAAbA,MAAa;IAAA,KAKZC,IAAY,GAAZA,IAAY;IAAA,KAKbE,OAAyB,GAAzBA,OAAyB;EAChC;EAEH,IAAIC,Q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AE,OAAOhF,SAAS;IAC3C,MAAMmB,GAAG,GAAG,IAAI,CAAC7B,IAAI,CAACkD,SAAS,CAAC,IAAI,CAACrD,EAAE,CAAC+C,OAAO,CAAC;IAChD,IAAIf,GAAG,EAAE,OAAOA,GAAG,CAACjB,IAAI;IACxB,OAAO,IAAI,CAACf,EAAE,CAAC+C,OAAO;EACxB;;EAEA;AACF;AACA;AACA;EACE,MAAM+C,cAAcA,CAAA,EAA8B;IAChD,MAAM/D,IAAI,GAAG,IAAI,CAAC6D,WAAW,CAAC,CAAC;IAC/B,IAAI,CAAC7D,IAAI,EAAE,OAAOlB,SAAS;IAC3B,OAAO,IAAI,CAAC+C,QAAQ,CAAC7B,IAAI,CAAC;EAC5B;;EAEA;AACF;AACA;EACE;EACAgE,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,CAACpG,EAAE,CAACqG,QAAQ,CAAC,CAAC,KAAK,IAAI,CAACrG,EAAE,CAACqG,QAAQ,CAAC,CAAC;EACvD;AACF;AAACC,OAAA,CAAAxG,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","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 */\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,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,GAAbA,MAAa;IAAA,KAKZC,IAAY,GAAZA,IAAY;IA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I,CAACW,MAAM,CAAC+E,cAAc,CAAC;EAChF;;EAEA;AACF;AACA;AACA;EACEC,WAAWA,CAAA,EAAuB;IAChC,IAAI,CAAC,IAAI,CAAC9F,EAAE,CAAC+F,UAAU,CAAC,CAAC,EAAE,OAAOlF,SAAS;IAC3C,MAAMmB,GAAG,GAAG,IAAI,CAAC7B,IAAI,CAACoD,SAAS,CAAC,IAAI,CAACvD,EAAE,CAACiD,OAAO,CAAC;IAChD,IAAIjB,GAAG,EAAE,OAAOA,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":[]}
@@ -0,0 +1,75 @@
1
+ import { CLIMain } from '@teambit/cli';
2
+ import { ExpressMain, Route } from '@teambit/express';
3
+ import { GraphqlMain } from '@teambit/graphql';
4
+ import { SlotRegistry } from '@teambit/harmony';
5
+ import { ComponentID } from '@teambit/component-id';
6
+ import { ExtensionDataList } from '@teambit/legacy/dist/consumer/config';
7
+ import { ComponentFactory } from './component-factory';
8
+ import { AspectList } from './aspect-list';
9
+ import { AspectEntry } from './aspect-entry';
10
+ import { ShowFragment } from './show';
11
+ import { RegisteredComponentRoute } from '.';
12
+ export type ComponentHostSlot = SlotRegistry<ComponentFactory>;
13
+ export type ShowFragmentSlot = SlotRegistry<ShowFragment[]>;
14
+ export declare class ComponentMain {
15
+ /**
16
+ * slot for component hosts to register.
17
+ */
18
+ private hostSlot;
19
+ /**
20
+ * Express Extension
21
+ */
22
+ private express;
23
+ private showFragmentSlot;
24
+ constructor(
25
+ /**
26
+ * slot for component hosts to register.
27
+ */
28
+ hostSlot: ComponentHostSlot,
29
+ /**
30
+ * Express Extension
31
+ */
32
+ express: ExpressMain, showFragmentSlot: ShowFragmentSlot);
33
+ /**
34
+ * register a new component host.
35
+ */
36
+ registerHost(host: ComponentFactory): this;
37
+ /**
38
+ * important! avoid using this method.
39
+ * seems like this method was written to work around a very specific case when the ComponentID of the aspects are
40
+ * not available. in case of new components, to get the ComponentID, the workspace-aspect is needed to get the
41
+ * default-scope. when this method is called from the scope, there is no way to get the real component-id.
42
+ * instead, this method asks for the "scope", which when called by the scope-aspect is the current scope-name.
43
+ * it may or may not be the real scope-name of the aspect.
44
+ * to fix this possibly incorrect scope-name, the `workspace.resolveScopeAspectListIds()` checks whether the
45
+ * scope-name is the same as scope.name, and if so, resolve it to the correct scope-name.
46
+ */
47
+ createAspectListFromLegacy(legacyExtensionDataList: ExtensionDataList): AspectList;
48
+ createAspectListFromEntries(entries: AspectEntry[]): AspectList;
49
+ registerRoute(routes: RegisteredComponentRoute[]): this;
50
+ /**
51
+ * set the prior host.
52
+ */
53
+ setHostPriority(id: string): this;
54
+ /**
55
+ * get component host by extension ID.
56
+ */
57
+ getHost(id?: string): ComponentFactory;
58
+ getHostIfExist(id?: string): ComponentFactory | undefined;
59
+ getRoute(id: ComponentID, routeName: string): string;
60
+ /**
61
+ * get the prior host.
62
+ */
63
+ private getPriorHost;
64
+ getShowFragments(): ShowFragment[];
65
+ isHost(name: string): boolean;
66
+ /**
67
+ * register a show fragment to display further information in the `bit show` command.
68
+ */
69
+ registerShowFragments(showFragments: ShowFragment[]): this;
70
+ private _priorHost;
71
+ static slots: (((registerFn: () => string) => SlotRegistry<Route[]>) | ((registerFn: () => string) => SlotRegistry<ComponentFactory>) | ((registerFn: () => string) => SlotRegistry<ShowFragment[]>))[];
72
+ static runtime: import("@teambit/harmony").RuntimeDefinition;
73
+ static dependencies: import("@teambit/harmony").Aspect[];
74
+ static provider([graphql, express, cli]: [GraphqlMain, ExpressMain, CLIMain], config: any, [hostSlot, showFragmentSlot]: [ComponentHostSlot, ShowFragmentSlot]): Promise<ComponentMain>;
75
+ }
@@ -0,0 +1,18 @@
1
+ import { NextFunction, Request, Response, Route } from '@teambit/express';
2
+ import { ComponentMain } from './component.main.runtime';
3
+ export type RegisteredComponentRoute = Route & {
4
+ resolveComponent?: boolean;
5
+ };
6
+ export type ComponentUrlParams = {
7
+ componentId: string;
8
+ };
9
+ export declare class ComponentRoute implements Route {
10
+ private registerRoute;
11
+ private componentExtension;
12
+ constructor(registerRoute: RegisteredComponentRoute, componentExtension: ComponentMain);
13
+ dynamicRouteRegex: string;
14
+ readonly route: string;
15
+ get componentMiddlewares(): ((req: Request<ComponentUrlParams>, res: Response, next: NextFunction) => Promise<void>)[];
16
+ method: string;
17
+ middlewares: ((req: Request<ComponentUrlParams>, res: Response, next: NextFunction) => Promise<void>)[];
18
+ }
@@ -0,0 +1,104 @@
1
+ /// <reference types="lodash" />
2
+ import type { RouteProps } from 'react-router-dom';
3
+ import type { LinkProps } from '@teambit/base-react.navigation.link';
4
+ import { CommandBarUI } from '@teambit/command-bar';
5
+ import { SlotRegistry } from '@teambit/harmony';
6
+ import { PubsubUI } from '@teambit/pubsub';
7
+ import { ReactRouterUI } from '@teambit/react-router';
8
+ import { MenuItem, MenuItemSlot } from '@teambit/ui-foundation.ui.main-dropdown';
9
+ import type { NavigationSlot, RouteSlot } from '@teambit/ui-foundation.ui.react-router.slot-router';
10
+ import { ComponentModel } from './ui';
11
+ import { ComponentPageElement, ComponentPageSlot } from './ui/component';
12
+ import { ComponentResultPlugin } from './ui/component-searcher';
13
+ import { ConsumeMethodSlot, ConsumePlugin, NavPlugin, OrderedNavigationSlot, RightSideMenuItem, RightSideMenuSlot } from './ui/menu';
14
+ import { GetComponentsOptions } from './get-component-opts';
15
+ export type ComponentSearchResultSlot = SlotRegistry<ComponentResultPlugin[]>;
16
+ export type ComponentUIConfig = {
17
+ commandBar: boolean;
18
+ };
19
+ export type Server = {
20
+ env: string;
21
+ url: string;
22
+ };
23
+ export type ComponentMeta = {
24
+ id: string;
25
+ };
26
+ export declare class ComponentUI {
27
+ /**
28
+ * Pubsub aspects
29
+ */
30
+ private pubsub;
31
+ private routeSlot;
32
+ private navSlot;
33
+ readonly consumeMethodSlot: ConsumeMethodSlot;
34
+ /**
35
+ * slot for registering a new widget to the menu.
36
+ */
37
+ private widgetSlot;
38
+ /**
39
+ * slot for registering the right section of the menu
40
+ */
41
+ private rightSideMenuSlot;
42
+ private menuItemSlot;
43
+ private pageItemSlot;
44
+ private componentSearchResultSlot;
45
+ private commandBarUI;
46
+ readonly routePath = "/*";
47
+ private componentSearcher;
48
+ constructor(
49
+ /**
50
+ * Pubsub aspects
51
+ */
52
+ pubsub: PubsubUI, routeSlot: RouteSlot, navSlot: OrderedNavigationSlot, consumeMethodSlot: ConsumeMethodSlot,
53
+ /**
54
+ * slot for registering a new widget to the menu.
55
+ */
56
+ widgetSlot: OrderedNavigationSlot,
57
+ /**
58
+ * slot for registering the right section of the menu
59
+ */
60
+ rightSideMenuSlot: RightSideMenuSlot, menuItemSlot: MenuItemSlot, pageItemSlot: ComponentPageSlot, componentSearchResultSlot: ComponentSearchResultSlot, commandBarUI: CommandBarUI, reactRouterUi: ReactRouterUI);
61
+ get routes(): [string, RouteProps[]][];
62
+ /**
63
+ * the current visible component
64
+ */
65
+ private activeComponent?;
66
+ formatToInstallableVersion(version: string): string;
67
+ private copyNpmId;
68
+ /**
69
+ * key bindings used by component aspect
70
+ */
71
+ private keyBindings;
72
+ private menuItems;
73
+ private bitMethod;
74
+ registerPubSub(): void;
75
+ handleComponentChange: (activeComponent?: ComponentModel) => void;
76
+ getComponentUI(host: string, options?: GetComponentsOptions): import("react/jsx-runtime").JSX.Element;
77
+ getMenu(host: string, options?: GetComponentsOptions): import("react/jsx-runtime").JSX.Element;
78
+ listMenuItems(): import("lodash").Dictionary<MenuItem[]>;
79
+ registerRoute(routes: RouteProps[] | RouteProps): this;
80
+ registerNavigation(nav: LinkProps, order?: number): void;
81
+ registerConsumeMethod(...consumeMethods: ConsumePlugin[]): void;
82
+ registerWidget(widget: LinkProps, order?: number): void;
83
+ registerRightSideMenuItem(...rightSideMenuItem: RightSideMenuItem[]): void;
84
+ registerMenuItem: (menuItems: MenuItem[]) => void;
85
+ registerPageItem: (...items: ComponentPageElement[]) => void;
86
+ /** register widgets to the components listed in the command bar */
87
+ registerSearchResultWidget: (...items: ComponentResultPlugin[]) => void;
88
+ updateComponents: (components: ComponentModel[]) => void;
89
+ static dependencies: import("@teambit/harmony").Aspect[];
90
+ static runtime: import("@teambit/harmony").RuntimeDefinition;
91
+ static slots: (((registerFn: () => string) => SlotRegistry<RouteProps>) | ((registerFn: () => string) => SlotRegistry<NavigationSlot>) | ((registerFn: () => string) => SlotRegistry<MenuItemSlot>) | ((registerFn: () => string) => SlotRegistry<NavPlugin>) | ((registerFn: () => string) => SlotRegistry<ConsumeMethodSlot>) | ((registerFn: () => string) => SlotRegistry<ComponentPageSlot>) | ((registerFn: () => string) => SlotRegistry<ComponentSearchResultSlot>) | ((registerFn: () => string) => SlotRegistry<RightSideMenuSlot>))[];
92
+ static defaultConfig: ComponentUIConfig;
93
+ static provider([pubsub, commandBarUI, reactRouterUI]: [PubsubUI, CommandBarUI, ReactRouterUI], config: ComponentUIConfig, [routeSlot, navSlot, consumeMethodSlot, widgetSlot, menuItemSlot, pageSlot, componentSearchResultSlot, rightSideMenuSlot,]: [
94
+ RouteSlot,
95
+ OrderedNavigationSlot,
96
+ ConsumeMethodSlot,
97
+ OrderedNavigationSlot,
98
+ MenuItemSlot,
99
+ ComponentPageSlot,
100
+ ComponentSearchResultSlot,
101
+ RightSideMenuSlot
102
+ ]): Promise<ComponentUI>;
103
+ }
104
+ export default ComponentUI;
@@ -0,0 +1,18 @@
1
+ import { ExtensionDataList } from '@teambit/legacy/dist/consumer/config/extension-data';
2
+ import { PathLinuxRelative, PathOsBasedRelative } from '@teambit/legacy/dist/utils/path';
3
+ /**
4
+ * in-memory representation of the component configuration.
5
+ */
6
+ export declare class Config {
7
+ private consumerComponent;
8
+ constructor(consumerComponent: any);
9
+ /**
10
+ * component main file
11
+ * when loaded from the workspace, it's PathOsBasedRelative. otherwise, PathLinuxRelative.
12
+ */
13
+ get main(): PathLinuxRelative | PathOsBasedRelative;
14
+ /**
15
+ * configured extensions
16
+ */
17
+ get extensions(): ExtensionDataList;
18
+ }
@@ -0,0 +1,43 @@
1
+ import { ComponentID } from '@teambit/component-id';
2
+ export declare class DependencyId extends ComponentID {
3
+ }
4
+ export declare class Dependency {
5
+ id: DependencyId;
6
+ constructor(id: DependencyId);
7
+ }
8
+ export declare class PackageDependency extends Dependency {
9
+ }
10
+ export declare class ComponentDependency extends Dependency {
11
+ }
12
+ export declare class DependencyList extends Array<Dependency> {
13
+ /**
14
+ * Get only package dependencies
15
+ *
16
+ * @readonly
17
+ * @memberof DependencyList
18
+ */
19
+ get packages(): PackageDependency[];
20
+ get components(): ComponentDependency[];
21
+ static fromArray(dependencies: Dependency[]): DependencyList;
22
+ }
23
+ export declare class Dependencies {
24
+ runtime: DependencyList;
25
+ dev: DependencyList;
26
+ peer: DependencyList;
27
+ constructor(runtime: DependencyList, dev: DependencyList, peer: DependencyList);
28
+ private getByEnvironment;
29
+ /**
30
+ * Get dependencies needed for development environnement such as runtime, dev and peer
31
+ *
32
+ * @returns {DependencyList}
33
+ * @memberof Dependencies
34
+ */
35
+ computeDev(): DependencyList;
36
+ /**
37
+ * Get dependencies needed for runtime environnement such as runtime and peer
38
+ *
39
+ * @returns {DependencyList}
40
+ * @memberof Dependencies
41
+ */
42
+ computeRuntime(): DependencyList;
43
+ }
@@ -0,0 +1 @@
1
+ export { Dependencies } from './dependencies';
@@ -0,0 +1,4 @@
1
+ export declare class CouldNotFindLatest extends Error {
2
+ constructor(semverArray: string[]);
3
+ report(): string;
4
+ }
@@ -0,0 +1,12 @@
1
+ export declare class HostNotFound extends Error {
2
+ /**
3
+ * name of the host.
4
+ */
5
+ private hostName;
6
+ constructor(
7
+ /**
8
+ * name of the host.
9
+ */
10
+ hostName: string);
11
+ toString(): string;
12
+ }
@@ -0,0 +1,4 @@
1
+ export { default as NothingToSnap } from './nothing-to-snap';
2
+ export { HostNotFound } from './host-not-found';
3
+ export { CouldNotFindLatest } from './could-not-find-latest';
4
+ export { MainFileNotFound } from './main-file-not-found';
@@ -0,0 +1,14 @@
1
+ import { ComponentID } from '@teambit/component-id';
2
+ export declare class MainFileNotFound extends Error {
3
+ /**
4
+ * name of the host.
5
+ */
6
+ readonly id: ComponentID;
7
+ readonly mainFile: string;
8
+ constructor(
9
+ /**
10
+ * name of the host.
11
+ */
12
+ id: ComponentID, mainFile: string);
13
+ toString(): string;
14
+ }
@@ -0,0 +1,2 @@
1
+ export default class NothingToSnap extends Error {
2
+ }
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import { RouteProps } from 'react-router-dom';
3
+ import type { UseComponentType, Filters } from './ui/use-component';
4
+ export type GetComponentsOptions = {
5
+ useComponent?: UseComponentType;
6
+ componentId?: string | (() => string | undefined);
7
+ useComponentFilters?: () => Filters;
8
+ path?: string;
9
+ skipRightSide?: boolean;
10
+ RightNode?: React.ReactNode;
11
+ className?: string;
12
+ routes?: RouteProps[];
13
+ };
package/dist/hash.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ /**
2
+ * type for representing content-addressable filesystem hashes.
3
+ */
4
+ export type Hash = string;
package/dist/head.d.ts ADDED
File without changes
@@ -0,0 +1,2 @@
1
+ export default class HistoryGraph {
2
+ }
@@ -0,0 +1,7 @@
1
+ import { ComponentModel } from '../ui';
2
+ export declare class ComponentHostModel {
3
+ readonly name: string;
4
+ readonly components: ComponentModel[];
5
+ constructor(name: string, components: ComponentModel[]);
6
+ static from(data: any): ComponentHostModel;
7
+ }
@@ -0,0 +1,2 @@
1
+ export { useComponentHost } from './use-component-host';
2
+ export * from './component-host-model';
@@ -0,0 +1,6 @@
1
+ import { ComponentHostModel } from './component-host-model';
2
+ export declare function useComponentHost(): {
3
+ host?: undefined;
4
+ } | {
5
+ host: ComponentHostModel;
6
+ };
@@ -0,0 +1,37 @@
1
+ import { ComponentAspect } from './component.aspect';
2
+ export type { GetComponentsOptions } from './get-component-opts';
3
+ export type { UseComponentType } from './ui/use-component';
4
+ export { useComponentHost } from './host';
5
+ export { Component, InvalidComponent } from './component';
6
+ export { ComponentID } from '@teambit/component-id';
7
+ export { default as ComponentFS } from './component-fs';
8
+ export type { Config as ComponentConfig } from './config';
9
+ export type { ComponentFactory, ResolveAspectsOptions, FilterAspectsOptions, LoadAspectsOptions, } from './component-factory';
10
+ export type { AspectList } from './aspect-list';
11
+ export { AspectEntry, AspectData, ResolveComponentIdFunc } from './aspect-entry';
12
+ export { Snap, SnapProps } from './snap/snap';
13
+ export type { Author } from './snap/author';
14
+ export { Tag, TagProps } from './tag/tag';
15
+ export type { IComponent } from './component-interface';
16
+ export { State } from './state';
17
+ export type { Hash } from './hash';
18
+ export { TagMap } from './tag-map';
19
+ export { ComponentMap } from './component-map';
20
+ export type { ComponentMain } from './component.main.runtime';
21
+ export type { ComponentUI } from './component.ui.runtime';
22
+ export type { Section } from './section';
23
+ export { ComponentContext, ComponentDescriptorContext, useComponentDescriptor } from './ui/context/component-context';
24
+ export type { ComponentProviderProps, ComponentDescriptorProviderProps } from './ui/context';
25
+ export { ComponentProvider, ComponentDescriptorProvider } from './ui/context';
26
+ export { componentFields, componentIdFields, componentOverviewFields } from './ui';
27
+ export type { NavPlugin, ConsumePlugin, MenuNavProps } from './ui/menu';
28
+ export { CollapsibleMenuNav, ComponentMenu, VersionRelatedDropdowns } from './ui/menu';
29
+ export type { RegisteredComponentRoute, ComponentUrlParams } from './component.route';
30
+ export type { ComponentModelProps } from './ui/component-model';
31
+ export { ComponentModel } from './ui/component-model';
32
+ export { TopBarNav } from './ui/top-bar-nav';
33
+ export type { ShowFragment, ShowRow, ShowJSONRow } from './show';
34
+ export { Config } from './config';
35
+ export { useComponent, useIdFromLocation, useComponentLogs, ComponentLogsResult, Filters } from './ui';
36
+ export { ComponentAspect };
37
+ export default ComponentAspect;
File without changes
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_component@1.0.227/dist/component.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_component@1.0.227/dist/component.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_component@1.0.229/dist/component.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_component@1.0.229/dist/component.docs.mdx';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];
@@ -0,0 +1 @@
1
+ export { Section } from './section';
@@ -0,0 +1,11 @@
1
+ import type { LinkProps } from '@teambit/base-react.navigation.link';
2
+ import { RouteProps } from 'react-router-dom';
3
+ export interface Section {
4
+ route: RouteProps;
5
+ navigationLink: LinkProps;
6
+ /**
7
+ * text to be used in the mobile res dropdown
8
+ */
9
+ displayName?: string;
10
+ order?: number;
11
+ }
@@ -0,0 +1,13 @@
1
+ import { ShowFragment } from './show-fragment';
2
+ import { Component } from '../component';
3
+ export declare class ExtensionsFragment implements ShowFragment {
4
+ private renderList;
5
+ renderRow(component: Component): Promise<{
6
+ title: string;
7
+ content: string;
8
+ }>;
9
+ json(component: Component): Promise<{
10
+ title: string;
11
+ json: any;
12
+ }>;
13
+ }