@teambit/component 0.0.555 → 0.0.559
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/component.graphql.d.ts +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -1
- package/package.json +49 -34
- package/tsconfig.json +1 -1
- package/aspect-entry.ts +0 -67
- package/aspect-list.ts +0 -100
- package/aspect.section.tsx +0 -16
- package/component-factory.ts +0 -106
- package/component-fs.ts +0 -60
- package/component-map/component-map.ts +0 -106
- package/component-map/index.ts +0 -1
- package/component-meta.ts +0 -29
- package/component.aspect.ts +0 -9
- package/component.graphql.ts +0 -202
- package/component.main.runtime.ts +0 -162
- package/component.route.ts +0 -26
- package/component.ts +0 -278
- package/component.ui.runtime.tsx +0 -216
- package/config.ts +0 -34
- package/dependencies/dependencies.ts +0 -74
- package/dependencies/index.ts +0 -1
- package/exceptions/could-not-find-latest.ts +0 -8
- package/exceptions/host-not-found.ts +0 -14
- package/exceptions/index.ts +0 -4
- package/exceptions/nothing-to-snap.ts +0 -1
- package/hash.ts +0 -4
- package/head.ts +0 -0
- package/history-graph.ts +0 -1
- package/host/component-host-model.ts +0 -9
- package/host/index.ts +0 -2
- package/host/use-component-host.ts +0 -39
- package/index.ts +0 -32
- package/on-load.ts +0 -0
- package/package-tar/teambit-component-0.0.555.tgz +0 -0
- package/section/index.ts +0 -1
- package/section/section.tsx +0 -8
- package/show/extensions.fragment.ts +0 -23
- package/show/files.fragment.ts +0 -24
- package/show/id.fragment.ts +0 -20
- package/show/index.ts +0 -8
- package/show/main-file.fragment.ts +0 -13
- package/show/name.fragment.ts +0 -13
- package/show/scope.fragment.ts +0 -15
- package/show/show-fragment.ts +0 -44
- package/show/show.cmd.ts +0 -85
- package/snap/author.ts +0 -19
- package/snap/index.ts +0 -2
- package/snap/snap.ts +0 -63
- package/state.ts +0 -73
- package/store.ts +0 -3
- package/tag/index.ts +0 -1
- package/tag/tag.ts +0 -37
- package/tag-map.ts +0 -87
- package/types/asset.d.ts +0 -29
- package/types/style.d.ts +0 -42
- package/ui/aspect-page/aspect-page.tsx +0 -64
- package/ui/aspect-page/index.ts +0 -1
- package/ui/component-error/component-error.tsx +0 -22
- package/ui/component-error/index.ts +0 -1
- package/ui/component-model/component-model.ts +0 -169
- package/ui/component-model/index.ts +0 -1
- package/ui/component.tsx +0 -48
- package/ui/context/component-context.ts +0 -5
- package/ui/context/component-provider.tsx +0 -20
- package/ui/context/index.ts +0 -2
- package/ui/index.ts +0 -3
- package/ui/menu/index.ts +0 -2
- package/ui/menu/menu-nav.tsx +0 -37
- package/ui/menu/menu.tsx +0 -94
- package/ui/menu/nav-plugin.tsx +0 -9
- package/ui/top-bar-nav/index.ts +0 -1
- package/ui/top-bar-nav/top-bar-nav.tsx +0 -26
- package/ui/use-component-query.ts +0 -195
- package/ui/use-component.tsx +0 -34
|
@@ -13,7 +13,7 @@ export declare function componentSchema(componentExtension: ComponentMain): {
|
|
|
13
13
|
path: string;
|
|
14
14
|
}) => string | undefined;
|
|
15
15
|
mainFile: (component: Component) => any;
|
|
16
|
-
headTag: (component: Component) => import("
|
|
16
|
+
headTag: (component: Component) => import(".").TagProps | undefined;
|
|
17
17
|
latest: (component: Component) => string | undefined;
|
|
18
18
|
tags: (component: any) => any;
|
|
19
19
|
aspects: (component: Component) => {
|
package/dist/index.d.ts
CHANGED
|
@@ -7,9 +7,9 @@ export type { default as ComponentConfig } from './config';
|
|
|
7
7
|
export type { ComponentFactory } from './component-factory';
|
|
8
8
|
export type { AspectList } from './aspect-list';
|
|
9
9
|
export { AspectEntry, AspectData } from './aspect-entry';
|
|
10
|
-
export { Snap } from './snap/snap';
|
|
10
|
+
export { Snap, SnapProps } from './snap/snap';
|
|
11
11
|
export type { Author } from './snap/author';
|
|
12
|
-
export { Tag } from './tag/tag';
|
|
12
|
+
export { Tag, TagProps } from './tag/tag';
|
|
13
13
|
export { State } from './state';
|
|
14
14
|
export type { Hash } from './hash';
|
|
15
15
|
export { TagMap } from './tag-map';
|
package/dist/index.js
CHANGED
|
@@ -89,6 +89,12 @@ Object.defineProperty(exports, "Snap", {
|
|
|
89
89
|
return _snap().Snap;
|
|
90
90
|
}
|
|
91
91
|
});
|
|
92
|
+
Object.defineProperty(exports, "SnapProps", {
|
|
93
|
+
enumerable: true,
|
|
94
|
+
get: function () {
|
|
95
|
+
return _snap().SnapProps;
|
|
96
|
+
}
|
|
97
|
+
});
|
|
92
98
|
Object.defineProperty(exports, "State", {
|
|
93
99
|
enumerable: true,
|
|
94
100
|
get: function () {
|
|
@@ -107,6 +113,12 @@ Object.defineProperty(exports, "TagMap", {
|
|
|
107
113
|
return _tagMap().TagMap;
|
|
108
114
|
}
|
|
109
115
|
});
|
|
116
|
+
Object.defineProperty(exports, "TagProps", {
|
|
117
|
+
enumerable: true,
|
|
118
|
+
get: function () {
|
|
119
|
+
return _tag().TagProps;
|
|
120
|
+
}
|
|
121
|
+
});
|
|
110
122
|
exports.default = void 0;
|
|
111
123
|
Object.defineProperty(exports, "useComponentHost", {
|
|
112
124
|
enumerable: true,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":["ComponentAspect"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["index.ts"],"names":["ComponentAspect"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAIA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAIA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAjBA;AACA;AAGA;AACA;AAaA;AACA;eAEeA,4B","sourcesContent":["import { ComponentAspect } from './component.aspect';\n\nexport { useComponentHost } from './host';\nexport { Component, InvalidComponent } from './component';\nexport { ComponentID } from '@teambit/component-id';\nexport { default as ComponentFS } from './component-fs';\nexport type { default as ComponentConfig } from './config';\nexport type { ComponentFactory } from './component-factory';\nexport type { AspectList } from './aspect-list';\nexport { AspectEntry, AspectData } from './aspect-entry';\n// TODO: check why it's not working when using the index in snap dir like this:\n// export { Snap, Author } from './snap';\nexport { Snap, SnapProps } from './snap/snap';\nexport type { Author } from './snap/author';\n// TODO: check why it's not working when using the index in tag dir like this:\n// export { Tag } from './tag';\nexport { Tag, TagProps } from './tag/tag';\nexport { State } from './state';\nexport type { Hash } from './hash';\nexport { TagMap } from './tag-map';\nexport { ComponentMap } from './component-map';\nexport type { ComponentMain } from './component.main.runtime';\nexport type { ComponentUI } from './component.ui.runtime';\nexport { Section } from './section';\nexport { ComponentContext } from './ui/context/component-context';\nexport { ComponentModel, ComponentModelProps } from './ui/component-model';\nexport type { ShowFragment, ShowRow } from './show';\nexport { default as Config } from './config';\n// export { AspectList } from './aspect-list';\n// export { AspectEntry } from './aspect-entry';\nexport { ComponentAspect };\nexport default ComponentAspect;\n"]}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/component",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.559",
|
|
4
4
|
"homepage": "https://bit.dev/teambit/component/component",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.component",
|
|
8
8
|
"name": "component",
|
|
9
|
-
"version": "0.0.
|
|
9
|
+
"version": "0.0.559"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"lodash": "4.17.21",
|
|
@@ -26,38 +26,38 @@
|
|
|
26
26
|
"@teambit/base-ui.routing.nav-link": "1.0.0",
|
|
27
27
|
"@teambit/documenter.ui.heading": "4.1.1",
|
|
28
28
|
"@teambit/documenter.ui.separator": "4.1.1",
|
|
29
|
-
"@teambit/component-id": "0.0.
|
|
30
|
-
"@teambit/ui-foundation.ui.menu-widget-icon": "0.0.
|
|
31
|
-
"@teambit/aspect-loader": "0.0.
|
|
32
|
-
"@teambit/legacy-bit-id": "0.0.
|
|
33
|
-
"@teambit/toolbox.string.capitalize": "0.0.
|
|
34
|
-
"@teambit/cli": "0.0.
|
|
35
|
-
"@teambit/config": "0.0.
|
|
36
|
-
"@teambit/express": "0.0.
|
|
37
|
-
"@teambit/graphql": "0.0.
|
|
38
|
-
"@teambit/bit-error": "0.0.
|
|
39
|
-
"@teambit/command-bar": "0.0.
|
|
40
|
-
"@teambit/preview": "0.0.
|
|
41
|
-
"@teambit/pubsub": "0.0.
|
|
42
|
-
"@teambit/ui-foundation.ui.is-browser": "0.0.
|
|
43
|
-
"@teambit/ui-foundation.ui.main-dropdown": "0.0.
|
|
44
|
-
"@teambit/ui-foundation.ui.react-router.slot-router": "0.0.
|
|
45
|
-
"@teambit/ui": "0.0.
|
|
46
|
-
"@teambit/component-issues": "0.0.
|
|
47
|
-
"@teambit/ui-foundation.ui.hooks.use-data-query": "0.0.
|
|
48
|
-
"@teambit/cli-table": "0.0.
|
|
49
|
-
"@teambit/ui-foundation.ui.react-router.use-query": "0.0.
|
|
29
|
+
"@teambit/component-id": "0.0.379",
|
|
30
|
+
"@teambit/ui-foundation.ui.menu-widget-icon": "0.0.468",
|
|
31
|
+
"@teambit/aspect-loader": "0.0.559",
|
|
32
|
+
"@teambit/legacy-bit-id": "0.0.378",
|
|
33
|
+
"@teambit/toolbox.string.capitalize": "0.0.463",
|
|
34
|
+
"@teambit/cli": "0.0.389",
|
|
35
|
+
"@teambit/config": "0.0.400",
|
|
36
|
+
"@teambit/express": "0.0.478",
|
|
37
|
+
"@teambit/graphql": "0.0.559",
|
|
38
|
+
"@teambit/bit-error": "0.0.375",
|
|
39
|
+
"@teambit/command-bar": "0.0.559",
|
|
40
|
+
"@teambit/preview": "0.0.559",
|
|
41
|
+
"@teambit/pubsub": "0.0.559",
|
|
42
|
+
"@teambit/ui-foundation.ui.is-browser": "0.0.466",
|
|
43
|
+
"@teambit/ui-foundation.ui.main-dropdown": "0.0.466",
|
|
44
|
+
"@teambit/ui-foundation.ui.react-router.slot-router": "0.0.468",
|
|
45
|
+
"@teambit/ui": "0.0.559",
|
|
46
|
+
"@teambit/component-issues": "0.0.24",
|
|
47
|
+
"@teambit/ui-foundation.ui.hooks.use-data-query": "0.0.467",
|
|
48
|
+
"@teambit/cli-table": "0.0.12",
|
|
49
|
+
"@teambit/ui-foundation.ui.react-router.use-query": "0.0.466",
|
|
50
50
|
"@teambit/design.ui.empty-box": "0.0.352",
|
|
51
|
-
"@teambit/harmony.ui.aspect-box": "0.0.
|
|
51
|
+
"@teambit/harmony.ui.aspect-box": "0.0.466",
|
|
52
52
|
"@teambit/design.ui.pages.not-found": "0.0.352",
|
|
53
53
|
"@teambit/design.ui.pages.server-error": "0.0.352",
|
|
54
|
-
"@teambit/compositions": "0.0.
|
|
55
|
-
"@teambit/deprecation": "0.0.
|
|
56
|
-
"@teambit/envs": "0.0.
|
|
57
|
-
"@teambit/component.ui.version-dropdown": "0.0.
|
|
58
|
-
"@teambit/ui-foundation.ui.use-box.dropdown": "0.0.
|
|
59
|
-
"@teambit/ui-foundation.ui.use-box.menu": "0.0.
|
|
60
|
-
"@teambit/ui-foundation.ui.react-router.extend-path": "0.0.
|
|
54
|
+
"@teambit/compositions": "0.0.559",
|
|
55
|
+
"@teambit/deprecation": "0.0.559",
|
|
56
|
+
"@teambit/envs": "0.0.559",
|
|
57
|
+
"@teambit/component.ui.version-dropdown": "0.0.470",
|
|
58
|
+
"@teambit/ui-foundation.ui.use-box.dropdown": "0.0.87",
|
|
59
|
+
"@teambit/ui-foundation.ui.use-box.menu": "0.0.87",
|
|
60
|
+
"@teambit/ui-foundation.ui.react-router.extend-path": "0.0.466"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@types/lodash": "4.14.165",
|
|
@@ -72,11 +72,11 @@
|
|
|
72
72
|
"@types/jest": "^26.0.0",
|
|
73
73
|
"@types/react-dom": "^17.0.5",
|
|
74
74
|
"@types/node": "12.20.4",
|
|
75
|
-
"@teambit/component.aspect-docs.component": "0.0.
|
|
75
|
+
"@teambit/component.aspect-docs.component": "0.0.108"
|
|
76
76
|
},
|
|
77
77
|
"peerDependencies": {
|
|
78
78
|
"@apollo/client": "^3.0.0",
|
|
79
|
-
"@teambit/legacy": "1.0.
|
|
79
|
+
"@teambit/legacy": "1.0.175",
|
|
80
80
|
"react-dom": "^16.8.0 || ^17.0.0",
|
|
81
81
|
"react": "^16.8.0 || ^17.0.0"
|
|
82
82
|
},
|
|
@@ -104,12 +104,27 @@
|
|
|
104
104
|
"react": "-"
|
|
105
105
|
},
|
|
106
106
|
"peerDependencies": {
|
|
107
|
-
"@teambit/legacy": "1.0.
|
|
107
|
+
"@teambit/legacy": "1.0.175",
|
|
108
108
|
"react-dom": "^16.8.0 || ^17.0.0",
|
|
109
109
|
"react": "^16.8.0 || ^17.0.0"
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
},
|
|
113
|
+
"files": [
|
|
114
|
+
"dist",
|
|
115
|
+
"!dist/tsconfig.tsbuildinfo",
|
|
116
|
+
"**/*.md",
|
|
117
|
+
"**/*.mdx",
|
|
118
|
+
"**/*.js",
|
|
119
|
+
"**/*.json",
|
|
120
|
+
"**/*.sass",
|
|
121
|
+
"**/*.scss",
|
|
122
|
+
"**/*.less",
|
|
123
|
+
"**/*.css",
|
|
124
|
+
"**/*.css",
|
|
125
|
+
"**/*.jpeg",
|
|
126
|
+
"**/*.gif"
|
|
127
|
+
],
|
|
113
128
|
"private": false,
|
|
114
129
|
"engines": {
|
|
115
130
|
"node": ">=12.22.0"
|
package/tsconfig.json
CHANGED
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
"skipLibCheck": true,
|
|
16
16
|
"moduleResolution": "node",
|
|
17
17
|
"esModuleInterop": true,
|
|
18
|
-
"outDir": "dist",
|
|
19
18
|
"composite": true,
|
|
20
19
|
"emitDeclarationOnly": true,
|
|
20
|
+
"outDir": "dist",
|
|
21
21
|
"experimentalDecorators": true,
|
|
22
22
|
"emitDecoratorMetadata": true,
|
|
23
23
|
"allowSyntheticDefaultImports": true,
|
package/aspect-entry.ts
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { ExtensionDataEntry } from '@teambit/legacy/dist/consumer/config/extension-data';
|
|
2
|
-
import { ComponentID } from '@teambit/component-id';
|
|
3
|
-
|
|
4
|
-
export type Serializable = {
|
|
5
|
-
toString(): string;
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export type SerializableMap = {
|
|
9
|
-
[key: string]: Serializable;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export type AspectData = {
|
|
13
|
-
[key: string]: any;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export class AspectEntry {
|
|
17
|
-
constructor(public id: ComponentID, private legacyEntry: ExtensionDataEntry) {}
|
|
18
|
-
|
|
19
|
-
get legacy() {
|
|
20
|
-
return this.legacyEntry;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
get isLegacy(): boolean {
|
|
24
|
-
if (this.config?.__legacy) return true;
|
|
25
|
-
return false;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
get config() {
|
|
29
|
-
return this.legacy.config;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
set config(config) {
|
|
33
|
-
this.legacy.config = config;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
get data(): { [key: string]: any } {
|
|
37
|
-
return this.legacy.data;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
get isRemoved(): boolean {
|
|
41
|
-
return this.legacy.isRemoved;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// eslint-disable-next-line @typescript-eslint/adjacent-overload-signatures
|
|
45
|
-
set data(val: { [key: string]: any }) {
|
|
46
|
-
this.legacy.data = val;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
transform(newData: SerializableMap): AspectEntry {
|
|
50
|
-
const newEntry = this.clone();
|
|
51
|
-
newEntry.data = newData;
|
|
52
|
-
return new AspectEntry(this.id, newEntry.legacy);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
clone(): AspectEntry {
|
|
56
|
-
return new AspectEntry(this.id, this.legacyEntry.clone());
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
serialize() {
|
|
60
|
-
return {
|
|
61
|
-
id: this.id.toString(),
|
|
62
|
-
config: this.config,
|
|
63
|
-
data: this.data,
|
|
64
|
-
icon: 'https://static.bit.dev/extensions-icons/default.svg', // TODO @gilad - once you connect the icon here please use this url as the default icon
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
}
|
package/aspect-list.ts
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import { isEmpty } from 'lodash';
|
|
2
|
-
import { ExtensionDataList, ExtensionDataEntry } from '@teambit/legacy/dist/consumer/config/extension-data';
|
|
3
|
-
import { ComponentID } from '@teambit/component-id';
|
|
4
|
-
import { AspectEntry, SerializableMap } from './aspect-entry';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* list of aspects, each may have data and artifacts saved per component.
|
|
8
|
-
*/
|
|
9
|
-
export class AspectList {
|
|
10
|
-
constructor(readonly entries: AspectEntry[]) {}
|
|
11
|
-
|
|
12
|
-
addEntry(aspectId: ComponentID, data: SerializableMap = {}) {
|
|
13
|
-
const extensionDataEntry = new ExtensionDataEntry(undefined, aspectId._legacy, undefined, {}, data);
|
|
14
|
-
const entry = new AspectEntry(aspectId, extensionDataEntry);
|
|
15
|
-
this.entries.push(entry);
|
|
16
|
-
return entry;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* get all ids as strings from the aspect list.
|
|
21
|
-
*/
|
|
22
|
-
get ids(): string[] {
|
|
23
|
-
const list = this.entries.map((entry) => entry.id.toString());
|
|
24
|
-
return list;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* get an aspect from the list using a serialized ID.
|
|
29
|
-
*/
|
|
30
|
-
get(id: string): AspectEntry | undefined {
|
|
31
|
-
return this.entries.find((entry) => {
|
|
32
|
-
return entry.legacy.stringId === id;
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* find aspect by component ID.
|
|
38
|
-
*/
|
|
39
|
-
find(id: ComponentID, ignoreVersion = false): AspectEntry | undefined {
|
|
40
|
-
return this.entries.find((aspectEntry) => {
|
|
41
|
-
return id.isEqual(aspectEntry.id, { ignoreVersion });
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* transform an aspect list into a new one.
|
|
47
|
-
*/
|
|
48
|
-
map(predicate: (entry: AspectEntry) => AspectEntry) {
|
|
49
|
-
const entries = this.entries.map(predicate);
|
|
50
|
-
return new AspectList(entries);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* transform an aspect list into a new one.
|
|
55
|
-
*/
|
|
56
|
-
async pmap(predicate: (entry: AspectEntry) => Promise<AspectEntry>) {
|
|
57
|
-
const entriesP = this.entries.map(predicate);
|
|
58
|
-
const entries = await Promise.all(entriesP);
|
|
59
|
-
return new AspectList(entries);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
toConfigObject() {
|
|
63
|
-
const res = {};
|
|
64
|
-
this.entries.forEach((entry) => {
|
|
65
|
-
if (entry.config && !isEmpty(entry.config)) {
|
|
66
|
-
res[entry.id.toString()] = entry.config;
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
return res;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
serialize() {
|
|
73
|
-
const serializedEntries = this.entries.map((entry) => entry.serialize());
|
|
74
|
-
return serializedEntries;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
toLegacy(): ExtensionDataList {
|
|
78
|
-
const legacyEntries = this.entries.map((entry) => entry.legacy);
|
|
79
|
-
return ExtensionDataList.fromArray(legacyEntries);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
stringIds(): string[] {
|
|
83
|
-
const ids = this.entries.map((entry) => entry.id.toString());
|
|
84
|
-
return ids;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
static fromLegacyExtensions(legacyDataList: ExtensionDataList, scope?: string): AspectList {
|
|
88
|
-
const newEntries = legacyDataList.map((entry) => {
|
|
89
|
-
return new AspectEntry(getAspectId(entry, scope), entry);
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
return new AspectList(newEntries);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
function getAspectId(entry: ExtensionDataEntry, scope?: string) {
|
|
97
|
-
if (!entry.extensionId && entry.name) return ComponentID.fromString(entry.name);
|
|
98
|
-
if (entry.extensionId) return ComponentID.fromLegacy(entry.extensionId, scope);
|
|
99
|
-
throw new Error('aspect cannot be loaded without setting an ID');
|
|
100
|
-
}
|
package/aspect.section.tsx
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { MenuWidgetIcon } from '@teambit/ui-foundation.ui.menu-widget-icon';
|
|
3
|
-
import { Section } from './section';
|
|
4
|
-
import { AspectPage } from './ui/aspect-page';
|
|
5
|
-
|
|
6
|
-
export class AspectSection implements Section {
|
|
7
|
-
route = {
|
|
8
|
-
path: '~aspect',
|
|
9
|
-
children: <AspectPage />,
|
|
10
|
-
};
|
|
11
|
-
navigationLink = {
|
|
12
|
-
href: '~aspect',
|
|
13
|
-
children: <MenuWidgetIcon icon="configuration" tooltipContent="Configuration" />,
|
|
14
|
-
};
|
|
15
|
-
order = 50;
|
|
16
|
-
}
|
package/component-factory.ts
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { BitId } from '@teambit/legacy-bit-id';
|
|
2
|
-
import LegacyGraph from '@teambit/legacy/dist/scope/graph/graph';
|
|
3
|
-
import ConsumerComponent from '@teambit/legacy/dist/consumer/component';
|
|
4
|
-
import type { ComponentLog } from '@teambit/legacy/dist/scope/models/model-component';
|
|
5
|
-
import type { AspectDefinition } from '@teambit/aspect-loader';
|
|
6
|
-
import { ComponentID } from '@teambit/component-id';
|
|
7
|
-
import { Component, InvalidComponent } from './component';
|
|
8
|
-
import { State } from './state';
|
|
9
|
-
import { Snap } from './snap';
|
|
10
|
-
|
|
11
|
-
export interface ComponentFactory {
|
|
12
|
-
/**
|
|
13
|
-
* name of the component host.
|
|
14
|
-
*/
|
|
15
|
-
name: string;
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* path to the component host.
|
|
19
|
-
*/
|
|
20
|
-
path: string;
|
|
21
|
-
|
|
22
|
-
isLegacy: boolean;
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* resolve a `string` component ID to an instance of a ComponentID.
|
|
26
|
-
*/
|
|
27
|
-
resolveComponentId(id: string | ComponentID | BitId): Promise<ComponentID>;
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* resolve multiple `string` component ID to an instance of a ComponentID.
|
|
31
|
-
*/
|
|
32
|
-
resolveMultipleComponentIds(ids: (string | ComponentID | BitId)[]): Promise<ComponentID[]>;
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* returns a component by ID.
|
|
36
|
-
*/
|
|
37
|
-
get(
|
|
38
|
-
id: ComponentID | string,
|
|
39
|
-
withState?: boolean,
|
|
40
|
-
consumerComponent?: ConsumerComponent
|
|
41
|
-
): Promise<Component | undefined>;
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* returns many components by ids.
|
|
45
|
-
*/
|
|
46
|
-
getMany(ids: ComponentID[]): Promise<Component[]>;
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* returns many components by their legacy representation.
|
|
50
|
-
*/
|
|
51
|
-
getManyByLegacy(components: ConsumerComponent[]): Promise<Component[]>;
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* get a component from a remote without importing it
|
|
55
|
-
*/
|
|
56
|
-
getRemoteComponent?: (id: ComponentID) => Promise<Component>;
|
|
57
|
-
|
|
58
|
-
getLegacyGraph(ids?: ComponentID[]): Promise<LegacyGraph>;
|
|
59
|
-
|
|
60
|
-
getLogs(id: ComponentID): Promise<ComponentLog[]>;
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* returns a specific state of a component by hash or semver.
|
|
64
|
-
*/
|
|
65
|
-
getState(id: ComponentID, snapId: string): Promise<State>;
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* returns a specific snap of a component by hash.
|
|
69
|
-
*/
|
|
70
|
-
getSnap(id: ComponentID, snapId: string): Promise<Snap>;
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* load extension.
|
|
74
|
-
*/
|
|
75
|
-
loadAspects: (ids: string[], throwOnError: boolean) => Promise<void>;
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Resolve dirs for aspects
|
|
79
|
-
*/
|
|
80
|
-
resolveAspects: (runtimeName?: string, componentIds?: ComponentID[]) => Promise<AspectDefinition[]>;
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* list all components in the host.
|
|
84
|
-
*/
|
|
85
|
-
list(filter?: { offset: number; limit: number }): Promise<Component[]>;
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* list invalid components, such as components with missing files on the fs.
|
|
89
|
-
*/
|
|
90
|
-
listInvalid(): Promise<InvalidComponent[]>;
|
|
91
|
-
|
|
92
|
-
listIds(): Promise<ComponentID[]>;
|
|
93
|
-
|
|
94
|
-
hasId(componentId: ComponentID): Promise<boolean>;
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Check if the host has the id, if no, search for the id in inner host (for example, workspace will search in the scope)
|
|
98
|
-
* @param componentId
|
|
99
|
-
*/
|
|
100
|
-
hasIdNested(componentId: ComponentID, includeCache?: boolean): Promise<boolean>;
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* determine whether host should be the prior one in case multiple hosts persist.
|
|
104
|
-
*/
|
|
105
|
-
priority?: boolean;
|
|
106
|
-
}
|
package/component-fs.ts
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { MemoryFS } from '@teambit/any-fs';
|
|
2
|
-
import type { AbstractVinyl } from '@teambit/legacy/dist/consumer/component/sources';
|
|
3
|
-
import { auto } from '@teambit/legacy/dist/utils/eol';
|
|
4
|
-
import path from 'path';
|
|
5
|
-
import minimatch from 'minimatch';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* The virtual component filesystem
|
|
9
|
-
*/
|
|
10
|
-
export default class ComponentFS extends MemoryFS {
|
|
11
|
-
constructor(
|
|
12
|
-
/**
|
|
13
|
-
* array of all fs files.
|
|
14
|
-
*/
|
|
15
|
-
readonly files: AbstractVinyl[]
|
|
16
|
-
) {
|
|
17
|
-
super();
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* hash to represent all contents within this filesystem volume.
|
|
21
|
-
*/
|
|
22
|
-
get hash() {
|
|
23
|
-
return '';
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* filter all component files by regex.
|
|
28
|
-
*/
|
|
29
|
-
byRegex(extension: RegExp): AbstractVinyl[] {
|
|
30
|
-
return this.files.filter((file) => file.path.match(extension));
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* filter all files using an array of glob patterns.
|
|
35
|
-
*/
|
|
36
|
-
byGlob(patterns: string[]) {
|
|
37
|
-
return this.files.filter((file) => {
|
|
38
|
-
return patterns.find((pattern) => {
|
|
39
|
-
const match = minimatch(file.relative, pattern);
|
|
40
|
-
return match;
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
toObject() {}
|
|
46
|
-
|
|
47
|
-
toJSON() {}
|
|
48
|
-
|
|
49
|
-
static fromVinyls(files: AbstractVinyl[]) {
|
|
50
|
-
const fs = new ComponentFS(files);
|
|
51
|
-
files.forEach((file) => {
|
|
52
|
-
let dirPath = file.relativeDir;
|
|
53
|
-
if (!dirPath.startsWith('/')) dirPath = path.join('/', dirPath);
|
|
54
|
-
fs.mkdirpSync(dirPath);
|
|
55
|
-
fs.writeFileSync(`/${file.relative}`, auto(file.contents || ''));
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
return fs;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { ComponentID } from '@teambit/component-id';
|
|
2
|
-
import { Component } from '../component';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* allows to index components -> values.
|
|
6
|
-
*/
|
|
7
|
-
export class ComponentMap<T> {
|
|
8
|
-
constructor(readonly hashMap: Map<string, [Component, T]>) {}
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* @deprecated please use `get` instead
|
|
12
|
-
*/
|
|
13
|
-
byComponent(component: Component) {
|
|
14
|
-
return this.hashMap.get(component.id.toString());
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
get components() {
|
|
18
|
-
return this.toArray().map(([component]) => component);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* get a value for a component.
|
|
23
|
-
*/
|
|
24
|
-
get(component: Component) {
|
|
25
|
-
return this.hashMap.get(component.id.toString());
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* get a value by the component-id
|
|
30
|
-
*/
|
|
31
|
-
getValueByComponentId(componentId: ComponentID): T | null {
|
|
32
|
-
const tuple = this.hashMap.get(componentId.toString());
|
|
33
|
-
if (!tuple) return null;
|
|
34
|
-
return tuple[1];
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* returns an array.
|
|
39
|
-
*/
|
|
40
|
-
toArray() {
|
|
41
|
-
return Array.from(this.hashMap.values());
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* map entries and return a new component map.
|
|
46
|
-
*/
|
|
47
|
-
map<NewType>(predicate: (value: T, component: Component) => NewType): ComponentMap<NewType> {
|
|
48
|
-
const tuples: [string, [Component, NewType]][] = this.toArray().map(([component, value]) => {
|
|
49
|
-
const newValue = predicate(value, component);
|
|
50
|
-
return [component.id.toString(), [component, newValue]];
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
return new ComponentMap(new Map(tuples));
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* flatten values of all components into a single array.
|
|
57
|
-
*/
|
|
58
|
-
flattenValue(): T[] {
|
|
59
|
-
return this.toArray().reduce((acc: T[], [, value]) => {
|
|
60
|
-
acc = acc.concat(value);
|
|
61
|
-
return acc;
|
|
62
|
-
}, []);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* filter all components with empty values and return a new map.
|
|
67
|
-
*/
|
|
68
|
-
filter(predicate: (value: T) => boolean): ComponentMap<T> {
|
|
69
|
-
const tuples = this.toArray().filter(([, value]) => {
|
|
70
|
-
return predicate(value);
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
const asMap: [string, [Component, T]][] = tuples.map(([component, value]) => {
|
|
74
|
-
return [component.id.toString(), [component, value]];
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
return new ComponentMap(new Map(asMap));
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* get all component ids.
|
|
82
|
-
*/
|
|
83
|
-
keys() {
|
|
84
|
-
return this.hashMap.keys();
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
static create<U>(rawMap: [Component, U][]) {
|
|
88
|
-
const newMap: [string, [Component, U]][] = rawMap.map(([component, data]) => {
|
|
89
|
-
return [component.id.toString(), [component, data]];
|
|
90
|
-
});
|
|
91
|
-
return new ComponentMap(new Map(newMap));
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* create a component map from components and a value predicate.
|
|
96
|
-
* @param components components to zip into the map.
|
|
97
|
-
* @param predicate predicate for returning desired value.
|
|
98
|
-
*/
|
|
99
|
-
static as<U>(components: Component[], predicate: (component: Component) => U): ComponentMap<U> {
|
|
100
|
-
const tuples: [string, [Component, U]][] = components.map((component) => {
|
|
101
|
-
return [component.id.toString(), [component, predicate(component)]];
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
return new ComponentMap(new Map(tuples));
|
|
105
|
-
}
|
|
106
|
-
}
|
package/component-map/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { ComponentMap } from './component-map';
|