@teambit/component 0.0.880 → 0.0.882
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/aspect-entry.js +3 -16
- package/dist/aspect-entry.js.map +1 -1
- package/dist/aspect-list.js +6 -35
- package/dist/aspect-list.js.map +1 -1
- package/dist/aspect.section.js +0 -16
- package/dist/aspect.section.js.map +1 -1
- package/dist/component-fs.js +2 -25
- package/dist/component-fs.js.map +1 -1
- package/dist/component-map/component-map.js +10 -26
- package/dist/component-map/component-map.js.map +1 -1
- package/dist/component-map/index.js +0 -3
- package/dist/component-map/index.js.map +1 -1
- package/dist/component-meta.js +1 -14
- package/dist/component-meta.js.map +1 -1
- package/dist/component.aspect.js +0 -5
- package/dist/component.aspect.js.map +1 -1
- package/dist/component.composition.js +0 -6
- package/dist/component.composition.js.map +1 -1
- package/dist/component.graphql.js +2 -26
- package/dist/component.graphql.js.map +1 -1
- package/dist/component.js +19 -90
- package/dist/component.js.map +1 -1
- package/dist/component.main.runtime.js +6 -64
- package/dist/component.main.runtime.js.map +1 -1
- package/dist/component.route.js +2 -14
- package/dist/component.route.js.map +1 -1
- package/dist/component.ui.runtime.js +3 -83
- package/dist/component.ui.runtime.js.map +1 -1
- package/dist/config.js +0 -3
- package/dist/config.js.map +1 -1
- package/dist/dependencies/dependencies.js +7 -32
- package/dist/dependencies/dependencies.js.map +1 -1
- package/dist/dependencies/index.js +0 -3
- package/dist/dependencies/index.js.map +1 -1
- package/dist/exceptions/could-not-find-latest.js +0 -4
- package/dist/exceptions/could-not-find-latest.js.map +1 -1
- package/dist/exceptions/host-not-found.js +0 -4
- package/dist/exceptions/host-not-found.js.map +1 -1
- package/dist/exceptions/index.js +0 -13
- package/dist/exceptions/index.js.map +1 -1
- package/dist/exceptions/main-file-not-found.js +0 -4
- package/dist/exceptions/main-file-not-found.js.map +1 -1
- package/dist/exceptions/nothing-to-snap.js +0 -2
- package/dist/exceptions/nothing-to-snap.js.map +1 -1
- package/dist/history-graph.js +0 -2
- package/dist/history-graph.js.map +1 -1
- package/dist/host/component-host-model.js +0 -7
- package/dist/host/component-host-model.js.map +1 -1
- package/dist/host/index.js +0 -5
- package/dist/host/index.js.map +1 -1
- package/dist/host/use-component-host.js +0 -14
- package/dist/host/use-component-host.js.map +1 -1
- package/dist/index.js +0 -63
- package/dist/index.js.map +1 -1
- package/dist/section/index.js +0 -3
- package/dist/section/index.js.map +1 -1
- package/dist/show/extensions.fragment.js +0 -8
- package/dist/show/extensions.fragment.js.map +1 -1
- package/dist/show/files.fragment.js +0 -11
- package/dist/show/files.fragment.js.map +1 -1
- package/dist/show/id.fragment.js +0 -10
- package/dist/show/id.fragment.js.map +1 -1
- package/dist/show/index.js +0 -24
- package/dist/show/index.js.map +1 -1
- package/dist/show/main-file.fragment.js +0 -9
- package/dist/show/main-file.fragment.js.map +1 -1
- package/dist/show/name.fragment.js +0 -9
- package/dist/show/name.fragment.js.map +1 -1
- package/dist/show/scope.fragment.js +0 -10
- package/dist/show/scope.fragment.js.map +1 -1
- package/dist/show/show.cmd.js +1 -33
- package/dist/show/show.cmd.js.map +1 -1
- package/dist/snap/index.js +0 -6
- package/dist/snap/index.js.map +1 -1
- package/dist/snap/snap.js +0 -5
- package/dist/snap/snap.js.map +1 -1
- package/dist/state.js +6 -24
- package/dist/state.js.map +1 -1
- package/dist/store.js +0 -5
- package/dist/store.js.map +1 -1
- package/dist/tag/index.js +0 -3
- package/dist/tag/index.js.map +1 -1
- package/dist/tag/tag.js +1 -9
- package/dist/tag/tag.js.map +1 -1
- package/dist/tag-map.js +4 -28
- package/dist/tag-map.js.map +1 -1
- package/dist/ui/aspect-page/aspect-page.js +2 -35
- package/dist/ui/aspect-page/aspect-page.js.map +1 -1
- package/dist/ui/aspect-page/index.js +0 -3
- package/dist/ui/aspect-page/index.js.map +1 -1
- package/dist/ui/component-error/component-error.js +0 -14
- package/dist/ui/component-error/component-error.js.map +1 -1
- package/dist/ui/component-error/index.js +0 -3
- package/dist/ui/component-error/index.js.map +1 -1
- package/dist/ui/component-model/component-model.js +2 -21
- package/dist/ui/component-model/component-model.js.map +1 -1
- package/dist/ui/component-model/index.js +0 -3
- package/dist/ui/component-model/index.js.map +1 -1
- package/dist/ui/component-searcher/component-result.js +0 -20
- package/dist/ui/component-searcher/component-result.js.map +1 -1
- package/dist/ui/component-searcher/component-searcher.js +0 -22
- package/dist/ui/component-searcher/component-searcher.js.map +1 -1
- package/dist/ui/component-searcher/index.js +0 -3
- package/dist/ui/component-searcher/index.js.map +1 -1
- package/dist/ui/component.js +5 -40
- package/dist/ui/component.js.map +1 -1
- package/dist/ui/context/component-context.js +0 -9
- package/dist/ui/context/component-context.js.map +1 -1
- package/dist/ui/context/component-provider.js +0 -9
- package/dist/ui/context/component-provider.js.map +1 -1
- package/dist/ui/context/index.js +0 -6
- package/dist/ui/context/index.js.map +1 -1
- package/dist/ui/index.js +0 -21
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/menu/index.js +0 -3
- package/dist/ui/menu/index.js.map +1 -1
- package/dist/ui/menu/menu-nav.js +4 -23
- package/dist/ui/menu/menu-nav.js.map +1 -1
- package/dist/ui/menu/menu.js +0 -70
- package/dist/ui/menu/menu.js.map +1 -1
- package/dist/ui/menu/mobile-menu-nav.js +6 -49
- package/dist/ui/menu/mobile-menu-nav.js.map +1 -1
- package/dist/ui/top-bar-nav/index.js +0 -2
- package/dist/ui/top-bar-nav/index.js.map +1 -1
- package/dist/ui/top-bar-nav/top-bar-nav.js +8 -32
- package/dist/ui/top-bar-nav/top-bar-nav.js.map +1 -1
- package/dist/ui/use-component-from-location.js +0 -9
- package/dist/ui/use-component-from-location.js.map +1 -1
- package/dist/ui/use-component-query.js +12 -60
- package/dist/ui/use-component-query.js.map +1 -1
- package/dist/ui/use-component.js +0 -11
- package/dist/ui/use-component.js.map +1 -1
- package/package-tar/teambit-component-0.0.882.tgz +0 -0
- package/package.json +20 -20
- package/{preview-1666312873430.js → preview-1666496165706.js} +2 -2
- package/package-tar/teambit-component-0.0.880.tgz +0 -0
package/dist/aspect-entry.js
CHANGED
|
@@ -4,70 +4,57 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.AspectEntry = void 0;
|
|
7
|
-
|
|
8
7
|
/**
|
|
9
8
|
* avoid importing any (non-type) legacy code here. otherwise, PreviewTask will throw cryptic errors
|
|
10
9
|
*/
|
|
10
|
+
|
|
11
11
|
class AspectEntry {
|
|
12
12
|
constructor(id, legacyEntry) {
|
|
13
13
|
this.id = id;
|
|
14
14
|
this.legacyEntry = legacyEntry;
|
|
15
15
|
}
|
|
16
|
-
|
|
17
16
|
get legacy() {
|
|
18
17
|
return this.legacyEntry;
|
|
19
18
|
}
|
|
20
|
-
|
|
21
19
|
get isLegacy() {
|
|
22
20
|
var _this$config;
|
|
23
|
-
|
|
24
21
|
if ((_this$config = this.config) !== null && _this$config !== void 0 && _this$config.__legacy) return true;
|
|
25
22
|
return false;
|
|
26
23
|
}
|
|
27
|
-
|
|
28
24
|
get config() {
|
|
29
25
|
return this.legacy.config;
|
|
30
26
|
}
|
|
31
|
-
|
|
32
27
|
set config(config) {
|
|
33
28
|
this.legacy.config = config;
|
|
34
29
|
}
|
|
35
|
-
|
|
36
30
|
get data() {
|
|
37
31
|
return this.legacy.data;
|
|
38
32
|
}
|
|
39
|
-
|
|
40
33
|
get isRemoved() {
|
|
41
34
|
return this.legacy.isRemoved;
|
|
42
|
-
}
|
|
43
|
-
|
|
35
|
+
}
|
|
44
36
|
|
|
37
|
+
// eslint-disable-next-line @typescript-eslint/adjacent-overload-signatures
|
|
45
38
|
set data(val) {
|
|
46
39
|
this.legacy.data = val;
|
|
47
40
|
}
|
|
48
|
-
|
|
49
41
|
transform(newData) {
|
|
50
42
|
const newEntry = this.clone();
|
|
51
43
|
newEntry.data = newData;
|
|
52
44
|
return new AspectEntry(this.id, newEntry.legacy);
|
|
53
45
|
}
|
|
54
|
-
|
|
55
46
|
clone() {
|
|
56
47
|
return new AspectEntry(this.id, this.legacyEntry.clone());
|
|
57
48
|
}
|
|
58
|
-
|
|
59
49
|
serialize() {
|
|
60
50
|
return {
|
|
61
51
|
id: this.id.toString(),
|
|
62
52
|
config: this.config,
|
|
63
53
|
data: this.data,
|
|
64
54
|
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
55
|
};
|
|
67
56
|
}
|
|
68
|
-
|
|
69
57
|
}
|
|
70
|
-
|
|
71
58
|
exports.AspectEntry = AspectEntry;
|
|
72
59
|
|
|
73
60
|
//# sourceMappingURL=aspect-entry.js.map
|
package/dist/aspect-entry.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["AspectEntry","constructor","id","legacyEntry","legacy","isLegacy","config","__legacy","data","isRemoved","val","transform","newData","newEntry","clone","serialize","toString","icon"],"sources":["aspect-entry.ts"],"sourcesContent":["/**\n * avoid importing any (non-type) legacy code here. otherwise, PreviewTask will throw cryptic errors\n */\n\nimport type { ExtensionDataEntry } from '@teambit/legacy/dist/consumer/config/extension-data';\nimport { ComponentID } from '@teambit/component-id';\nimport { RawComponentMetadata } from './component-interface';\n\nexport type Serializable = {\n toString(): string;\n};\n\nexport type SerializableMap = {\n [key: string]: Serializable;\n};\n\nexport type AspectData = {\n [key: string]: any;\n};\n\nexport type ResolveComponentIdFunc = (id: string) => Promise<ComponentID>;\nexport class AspectEntry {\n constructor(public id: ComponentID, private legacyEntry: ExtensionDataEntry) {}\n\n get legacy() {\n return this.legacyEntry;\n }\n\n get isLegacy(): boolean {\n if (this.config?.__legacy) return true;\n return false;\n }\n\n get config() {\n return this.legacy.config;\n }\n\n set config(config) {\n this.legacy.config = config;\n }\n\n get data(): { [key: string]: any } {\n return this.legacy.data;\n }\n\n get isRemoved(): boolean {\n return this.legacy.isRemoved;\n }\n\n // eslint-disable-next-line @typescript-eslint/adjacent-overload-signatures\n set data(val: { [key: string]: any }) {\n this.legacy.data = val;\n }\n\n transform(newData: SerializableMap): AspectEntry {\n const newEntry = this.clone();\n newEntry.data = newData;\n return new AspectEntry(this.id, newEntry.legacy);\n }\n\n clone(): AspectEntry {\n return new AspectEntry(this.id, this.legacyEntry.clone());\n }\n\n serialize(): RawComponentMetadata {\n return {\n id: this.id.toString(),\n config: this.config,\n data: this.data,\n 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\n };\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["AspectEntry","constructor","id","legacyEntry","legacy","isLegacy","config","__legacy","data","isRemoved","val","transform","newData","newEntry","clone","serialize","toString","icon"],"sources":["aspect-entry.ts"],"sourcesContent":["/**\n * avoid importing any (non-type) legacy code here. otherwise, PreviewTask will throw cryptic errors\n */\n\nimport type { ExtensionDataEntry } from '@teambit/legacy/dist/consumer/config/extension-data';\nimport { ComponentID } from '@teambit/component-id';\nimport { RawComponentMetadata } from './component-interface';\n\nexport type Serializable = {\n toString(): string;\n};\n\nexport type SerializableMap = {\n [key: string]: Serializable;\n};\n\nexport type AspectData = {\n [key: string]: any;\n};\n\nexport type ResolveComponentIdFunc = (id: string) => Promise<ComponentID>;\nexport class AspectEntry {\n constructor(public id: ComponentID, private legacyEntry: ExtensionDataEntry) {}\n\n get legacy() {\n return this.legacyEntry;\n }\n\n get isLegacy(): boolean {\n if (this.config?.__legacy) return true;\n return false;\n }\n\n get config() {\n return this.legacy.config;\n }\n\n set config(config) {\n this.legacy.config = config;\n }\n\n get data(): { [key: string]: any } {\n return this.legacy.data;\n }\n\n get isRemoved(): boolean {\n return this.legacy.isRemoved;\n }\n\n // eslint-disable-next-line @typescript-eslint/adjacent-overload-signatures\n set data(val: { [key: string]: any }) {\n this.legacy.data = val;\n }\n\n transform(newData: SerializableMap): AspectEntry {\n const newEntry = this.clone();\n newEntry.data = newData;\n return new AspectEntry(this.id, newEntry.legacy);\n }\n\n clone(): AspectEntry {\n return new AspectEntry(this.id, this.legacyEntry.clone());\n }\n\n serialize(): RawComponentMetadata {\n return {\n id: this.id.toString(),\n config: this.config,\n data: this.data,\n 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\n };\n }\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;;AAmBO,MAAMA,WAAW,CAAC;EACvBC,WAAW,CAAQC,EAAe,EAAUC,WAA+B,EAAE;IAAA,KAA1DD,EAAe,GAAfA,EAAe;IAAA,KAAUC,WAA+B,GAA/BA,WAA+B;EAAG;EAE9E,IAAIC,MAAM,GAAG;IACX,OAAO,IAAI,CAACD,WAAW;EACzB;EAEA,IAAIE,QAAQ,GAAY;IAAA;IACtB,oBAAI,IAAI,CAACC,MAAM,yCAAX,aAAaC,QAAQ,EAAE,OAAO,IAAI;IACtC,OAAO,KAAK;EACd;EAEA,IAAID,MAAM,GAAG;IACX,OAAO,IAAI,CAACF,MAAM,CAACE,MAAM;EAC3B;EAEA,IAAIA,MAAM,CAACA,MAAM,EAAE;IACjB,IAAI,CAACF,MAAM,CAACE,MAAM,GAAGA,MAAM;EAC7B;EAEA,IAAIE,IAAI,GAA2B;IACjC,OAAO,IAAI,CAACJ,MAAM,CAACI,IAAI;EACzB;EAEA,IAAIC,SAAS,GAAY;IACvB,OAAO,IAAI,CAACL,MAAM,CAACK,SAAS;EAC9B;;EAEA;EACA,IAAID,IAAI,CAACE,GAA2B,EAAE;IACpC,IAAI,CAACN,MAAM,CAACI,IAAI,GAAGE,GAAG;EACxB;EAEAC,SAAS,CAACC,OAAwB,EAAe;IAC/C,MAAMC,QAAQ,GAAG,IAAI,CAACC,KAAK,EAAE;IAC7BD,QAAQ,CAACL,IAAI,GAAGI,OAAO;IACvB,OAAO,IAAIZ,WAAW,CAAC,IAAI,CAACE,EAAE,EAAEW,QAAQ,CAACT,MAAM,CAAC;EAClD;EAEAU,KAAK,GAAgB;IACnB,OAAO,IAAId,WAAW,CAAC,IAAI,CAACE,EAAE,EAAE,IAAI,CAACC,WAAW,CAACW,KAAK,EAAE,CAAC;EAC3D;EAEAC,SAAS,GAAyB;IAChC,OAAO;MACLb,EAAE,EAAE,IAAI,CAACA,EAAE,CAACc,QAAQ,EAAE;MACtBV,MAAM,EAAE,IAAI,CAACA,MAAM;MACnBE,IAAI,EAAE,IAAI,CAACA,IAAI;MACfS,IAAI,EAAE,qDAAqD,CAAE;IAC/D,CAAC;EACH;AACF;AAAC"}
|
package/dist/aspect-list.js
CHANGED
|
@@ -1,44 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
require("core-js/modules/es.array.iterator.js");
|
|
4
|
-
|
|
5
4
|
require("core-js/modules/es.promise.js");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
8
|
exports.AspectList = void 0;
|
|
11
|
-
|
|
12
9
|
function _extensionData() {
|
|
13
10
|
const data = require("@teambit/legacy/dist/consumer/config/extension-data");
|
|
14
|
-
|
|
15
11
|
_extensionData = function () {
|
|
16
12
|
return data;
|
|
17
13
|
};
|
|
18
|
-
|
|
19
14
|
return data;
|
|
20
15
|
}
|
|
21
|
-
|
|
22
16
|
function _componentId() {
|
|
23
17
|
const data = require("@teambit/component-id");
|
|
24
|
-
|
|
25
18
|
_componentId = function () {
|
|
26
19
|
return data;
|
|
27
20
|
};
|
|
28
|
-
|
|
29
21
|
return data;
|
|
30
22
|
}
|
|
31
|
-
|
|
32
23
|
function _aspectEntry() {
|
|
33
24
|
const data = require("./aspect-entry");
|
|
34
|
-
|
|
35
25
|
_aspectEntry = function () {
|
|
36
26
|
return data;
|
|
37
27
|
};
|
|
38
|
-
|
|
39
28
|
return data;
|
|
40
29
|
}
|
|
41
|
-
|
|
42
30
|
/**
|
|
43
31
|
* list of aspects, each may have data and artifacts saved per component.
|
|
44
32
|
*/
|
|
@@ -46,46 +34,41 @@ class AspectList {
|
|
|
46
34
|
constructor(entries) {
|
|
47
35
|
this.entries = entries;
|
|
48
36
|
}
|
|
49
|
-
|
|
50
37
|
addEntry(aspectId, data = {}) {
|
|
51
38
|
const extensionDataEntry = new (_extensionData().ExtensionDataEntry)(undefined, aspectId._legacy, undefined, {}, data);
|
|
52
39
|
const entry = new (_aspectEntry().AspectEntry)(aspectId, extensionDataEntry);
|
|
53
40
|
this.entries.push(entry);
|
|
54
41
|
return entry;
|
|
55
42
|
}
|
|
43
|
+
|
|
56
44
|
/**
|
|
57
45
|
* transform an aspect list into a new one without the given aspect ids
|
|
58
46
|
*/
|
|
59
|
-
|
|
60
|
-
|
|
61
47
|
withoutEntries(aspectIds) {
|
|
62
48
|
const entries = this.entries.filter(entry => !aspectIds.includes(entry.legacy.stringId));
|
|
63
49
|
return new AspectList(entries);
|
|
64
50
|
}
|
|
51
|
+
|
|
65
52
|
/**
|
|
66
53
|
* get all ids as strings from the aspect list.
|
|
67
54
|
*/
|
|
68
|
-
|
|
69
|
-
|
|
70
55
|
get ids() {
|
|
71
56
|
const list = this.entries.map(entry => entry.id.toString());
|
|
72
57
|
return list;
|
|
73
58
|
}
|
|
59
|
+
|
|
74
60
|
/**
|
|
75
61
|
* get an aspect from the list using a serialized ID.
|
|
76
62
|
*/
|
|
77
|
-
|
|
78
|
-
|
|
79
63
|
get(id) {
|
|
80
64
|
return this.entries.find(entry => {
|
|
81
65
|
return entry.legacy.stringId === id || entry.id.toStringWithoutVersion() === id;
|
|
82
66
|
});
|
|
83
67
|
}
|
|
68
|
+
|
|
84
69
|
/**
|
|
85
70
|
* find aspect by component ID.
|
|
86
71
|
*/
|
|
87
|
-
|
|
88
|
-
|
|
89
72
|
find(id, ignoreVersion = false) {
|
|
90
73
|
return this.entries.find(aspectEntry => {
|
|
91
74
|
return id.isEqual(aspectEntry.id, {
|
|
@@ -93,26 +76,23 @@ class AspectList {
|
|
|
93
76
|
});
|
|
94
77
|
});
|
|
95
78
|
}
|
|
79
|
+
|
|
96
80
|
/**
|
|
97
81
|
* transform an aspect list into a new one.
|
|
98
82
|
*/
|
|
99
|
-
|
|
100
|
-
|
|
101
83
|
map(predicate) {
|
|
102
84
|
const entries = this.entries.map(predicate);
|
|
103
85
|
return new AspectList(entries);
|
|
104
86
|
}
|
|
87
|
+
|
|
105
88
|
/**
|
|
106
89
|
* transform an aspect list into a new one.
|
|
107
90
|
*/
|
|
108
|
-
|
|
109
|
-
|
|
110
91
|
async pmap(predicate) {
|
|
111
92
|
const entriesP = this.entries.map(predicate);
|
|
112
93
|
const entries = await Promise.all(entriesP);
|
|
113
94
|
return new AspectList(entries);
|
|
114
95
|
}
|
|
115
|
-
|
|
116
96
|
toConfigObject() {
|
|
117
97
|
const res = {};
|
|
118
98
|
this.entries.forEach(entry => {
|
|
@@ -122,12 +102,10 @@ class AspectList {
|
|
|
122
102
|
});
|
|
123
103
|
return res;
|
|
124
104
|
}
|
|
125
|
-
|
|
126
105
|
serialize() {
|
|
127
106
|
const serializedEntries = this.entries.map(entry => entry.serialize());
|
|
128
107
|
return serializedEntries;
|
|
129
108
|
}
|
|
130
|
-
|
|
131
109
|
filter(ids) {
|
|
132
110
|
if (!(ids !== null && ids !== void 0 && ids.length)) return new AspectList(this.entries);
|
|
133
111
|
const entries = this.entries.filter(aspectEntry => {
|
|
@@ -135,32 +113,25 @@ class AspectList {
|
|
|
135
113
|
});
|
|
136
114
|
return new AspectList(entries);
|
|
137
115
|
}
|
|
138
|
-
|
|
139
116
|
toLegacy() {
|
|
140
117
|
const legacyEntries = this.entries.map(entry => entry.legacy);
|
|
141
118
|
return _extensionData().ExtensionDataList.fromArray(legacyEntries);
|
|
142
119
|
}
|
|
143
|
-
|
|
144
120
|
stringIds() {
|
|
145
121
|
const ids = this.entries.map(entry => entry.id.toString());
|
|
146
122
|
return ids;
|
|
147
123
|
}
|
|
148
|
-
|
|
149
124
|
clone() {
|
|
150
125
|
return new AspectList(this.entries.map(entry => entry.clone()));
|
|
151
126
|
}
|
|
152
|
-
|
|
153
127
|
static fromLegacyExtensions(legacyDataList, scope) {
|
|
154
128
|
const newEntries = legacyDataList.map(entry => {
|
|
155
129
|
return new (_aspectEntry().AspectEntry)(getAspectId(entry, scope), entry);
|
|
156
130
|
});
|
|
157
131
|
return new AspectList(newEntries);
|
|
158
132
|
}
|
|
159
|
-
|
|
160
133
|
}
|
|
161
|
-
|
|
162
134
|
exports.AspectList = AspectList;
|
|
163
|
-
|
|
164
135
|
function getAspectId(entry, scope) {
|
|
165
136
|
if (!entry.extensionId && entry.name) return _componentId().ComponentID.fromString(entry.name);
|
|
166
137
|
if (entry.extensionId) return _componentId().ComponentID.fromLegacy(entry.extensionId, scope);
|
package/dist/aspect-list.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["AspectList","constructor","entries","addEntry","aspectId","data","extensionDataEntry","ExtensionDataEntry","undefined","_legacy","entry","AspectEntry","push","withoutEntries","aspectIds","filter","includes","legacy","stringId","ids","list","map","id","toString","get","find","toStringWithoutVersion","ignoreVersion","aspectEntry","isEqual","predicate","pmap","entriesP","Promise","all","toConfigObject","res","forEach","config","removeInternalConfigFields","serialize","serializedEntries","length","toLegacy","legacyEntries","ExtensionDataList","fromArray","stringIds","clone","fromLegacyExtensions","legacyDataList","scope","newEntries","getAspectId","extensionId","name","ComponentID","fromString","fromLegacy","Error"],"sources":["aspect-list.ts"],"sourcesContent":["import {\n ExtensionDataList,\n ExtensionDataEntry,\n removeInternalConfigFields,\n} from '@teambit/legacy/dist/consumer/config/extension-data';\nimport { ComponentID } from '@teambit/component-id';\nimport { AspectEntry, SerializableMap } from './aspect-entry';\n\n/**\n * list of aspects, each may have data and artifacts saved per component.\n */\nexport class AspectList {\n constructor(readonly entries: AspectEntry[]) {}\n\n addEntry(aspectId: ComponentID, data: SerializableMap = {}) {\n const extensionDataEntry = new ExtensionDataEntry(undefined, aspectId._legacy, undefined, {}, data);\n const entry = new AspectEntry(aspectId, extensionDataEntry);\n this.entries.push(entry);\n return entry;\n }\n\n /**\n * transform an aspect list into a new one without the given aspect ids\n */\n withoutEntries(aspectIds: string[]): AspectList {\n const entries = this.entries.filter((entry) => !aspectIds.includes(entry.legacy.stringId));\n return new AspectList(entries);\n }\n\n /**\n * get all ids as strings from the aspect list.\n */\n get ids(): string[] {\n const list = this.entries.map((entry) => entry.id.toString());\n return list;\n }\n\n /**\n * get an aspect from the list using a serialized ID.\n */\n get(id: string): AspectEntry | undefined {\n return this.entries.find((entry) => {\n return entry.legacy.stringId === id || entry.id.toStringWithoutVersion() === id;\n });\n }\n\n /**\n * find aspect by component ID.\n */\n find(id: ComponentID, ignoreVersion = false): AspectEntry | undefined {\n return this.entries.find((aspectEntry) => {\n return id.isEqual(aspectEntry.id, { ignoreVersion });\n });\n }\n\n /**\n * transform an aspect list into a new one.\n */\n map(predicate: (entry: AspectEntry) => AspectEntry) {\n const entries = this.entries.map(predicate);\n return new AspectList(entries);\n }\n\n /**\n * transform an aspect list into a new one.\n */\n async pmap(predicate: (entry: AspectEntry) => Promise<AspectEntry>) {\n const entriesP = this.entries.map(predicate);\n const entries = await Promise.all(entriesP);\n return new AspectList(entries);\n }\n\n toConfigObject() {\n const res = {};\n this.entries.forEach((entry) => {\n if (entry.config) {\n res[entry.id.toString()] = removeInternalConfigFields(entry.config);\n }\n });\n return res;\n }\n\n serialize() {\n const serializedEntries = this.entries.map((entry) => entry.serialize());\n return serializedEntries;\n }\n\n filter(ids?: string[]): AspectList {\n if (!ids?.length) return new AspectList(this.entries);\n const entries = this.entries.filter((aspectEntry) => {\n return ids?.includes(aspectEntry.id.toStringWithoutVersion());\n });\n return new AspectList(entries);\n }\n\n toLegacy(): ExtensionDataList {\n const legacyEntries = this.entries.map((entry) => entry.legacy);\n return ExtensionDataList.fromArray(legacyEntries);\n }\n\n stringIds(): string[] {\n const ids = this.entries.map((entry) => entry.id.toString());\n return ids;\n }\n\n clone(): AspectList {\n return new AspectList(this.entries.map((entry) => entry.clone()));\n }\n\n static fromLegacyExtensions(legacyDataList: ExtensionDataList, scope?: string): AspectList {\n const newEntries = legacyDataList.map((entry) => {\n return new AspectEntry(getAspectId(entry, scope), entry);\n });\n\n return new AspectList(newEntries);\n }\n}\n\nfunction getAspectId(entry: ExtensionDataEntry, scope?: string) {\n if (!entry.extensionId && entry.name) return ComponentID.fromString(entry.name);\n if (entry.extensionId) return ComponentID.fromLegacy(entry.extensionId, scope);\n throw new Error('aspect cannot be loaded without setting an ID');\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["AspectList","constructor","entries","addEntry","aspectId","data","extensionDataEntry","ExtensionDataEntry","undefined","_legacy","entry","AspectEntry","push","withoutEntries","aspectIds","filter","includes","legacy","stringId","ids","list","map","id","toString","get","find","toStringWithoutVersion","ignoreVersion","aspectEntry","isEqual","predicate","pmap","entriesP","Promise","all","toConfigObject","res","forEach","config","removeInternalConfigFields","serialize","serializedEntries","length","toLegacy","legacyEntries","ExtensionDataList","fromArray","stringIds","clone","fromLegacyExtensions","legacyDataList","scope","newEntries","getAspectId","extensionId","name","ComponentID","fromString","fromLegacy","Error"],"sources":["aspect-list.ts"],"sourcesContent":["import {\n ExtensionDataList,\n ExtensionDataEntry,\n removeInternalConfigFields,\n} from '@teambit/legacy/dist/consumer/config/extension-data';\nimport { ComponentID } from '@teambit/component-id';\nimport { AspectEntry, SerializableMap } from './aspect-entry';\n\n/**\n * list of aspects, each may have data and artifacts saved per component.\n */\nexport class AspectList {\n constructor(readonly entries: AspectEntry[]) {}\n\n addEntry(aspectId: ComponentID, data: SerializableMap = {}) {\n const extensionDataEntry = new ExtensionDataEntry(undefined, aspectId._legacy, undefined, {}, data);\n const entry = new AspectEntry(aspectId, extensionDataEntry);\n this.entries.push(entry);\n return entry;\n }\n\n /**\n * transform an aspect list into a new one without the given aspect ids\n */\n withoutEntries(aspectIds: string[]): AspectList {\n const entries = this.entries.filter((entry) => !aspectIds.includes(entry.legacy.stringId));\n return new AspectList(entries);\n }\n\n /**\n * get all ids as strings from the aspect list.\n */\n get ids(): string[] {\n const list = this.entries.map((entry) => entry.id.toString());\n return list;\n }\n\n /**\n * get an aspect from the list using a serialized ID.\n */\n get(id: string): AspectEntry | undefined {\n return this.entries.find((entry) => {\n return entry.legacy.stringId === id || entry.id.toStringWithoutVersion() === id;\n });\n }\n\n /**\n * find aspect by component ID.\n */\n find(id: ComponentID, ignoreVersion = false): AspectEntry | undefined {\n return this.entries.find((aspectEntry) => {\n return id.isEqual(aspectEntry.id, { ignoreVersion });\n });\n }\n\n /**\n * transform an aspect list into a new one.\n */\n map(predicate: (entry: AspectEntry) => AspectEntry) {\n const entries = this.entries.map(predicate);\n return new AspectList(entries);\n }\n\n /**\n * transform an aspect list into a new one.\n */\n async pmap(predicate: (entry: AspectEntry) => Promise<AspectEntry>) {\n const entriesP = this.entries.map(predicate);\n const entries = await Promise.all(entriesP);\n return new AspectList(entries);\n }\n\n toConfigObject() {\n const res = {};\n this.entries.forEach((entry) => {\n if (entry.config) {\n res[entry.id.toString()] = removeInternalConfigFields(entry.config);\n }\n });\n return res;\n }\n\n serialize() {\n const serializedEntries = this.entries.map((entry) => entry.serialize());\n return serializedEntries;\n }\n\n filter(ids?: string[]): AspectList {\n if (!ids?.length) return new AspectList(this.entries);\n const entries = this.entries.filter((aspectEntry) => {\n return ids?.includes(aspectEntry.id.toStringWithoutVersion());\n });\n return new AspectList(entries);\n }\n\n toLegacy(): ExtensionDataList {\n const legacyEntries = this.entries.map((entry) => entry.legacy);\n return ExtensionDataList.fromArray(legacyEntries);\n }\n\n stringIds(): string[] {\n const ids = this.entries.map((entry) => entry.id.toString());\n return ids;\n }\n\n clone(): AspectList {\n return new AspectList(this.entries.map((entry) => entry.clone()));\n }\n\n static fromLegacyExtensions(legacyDataList: ExtensionDataList, scope?: string): AspectList {\n const newEntries = legacyDataList.map((entry) => {\n return new AspectEntry(getAspectId(entry, scope), entry);\n });\n\n return new AspectList(newEntries);\n }\n}\n\nfunction getAspectId(entry: ExtensionDataEntry, scope?: string) {\n if (!entry.extensionId && entry.name) return ComponentID.fromString(entry.name);\n if (entry.extensionId) return ComponentID.fromLegacy(entry.extensionId, scope);\n throw new Error('aspect cannot be loaded without setting an ID');\n}\n"],"mappings":";;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAKA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;AACA;AACA;AACO,MAAMA,UAAU,CAAC;EACtBC,WAAW,CAAUC,OAAsB,EAAE;IAAA,KAAxBA,OAAsB,GAAtBA,OAAsB;EAAG;EAE9CC,QAAQ,CAACC,QAAqB,EAAEC,IAAqB,GAAG,CAAC,CAAC,EAAE;IAC1D,MAAMC,kBAAkB,GAAG,KAAIC,mCAAkB,EAACC,SAAS,EAAEJ,QAAQ,CAACK,OAAO,EAAED,SAAS,EAAE,CAAC,CAAC,EAAEH,IAAI,CAAC;IACnG,MAAMK,KAAK,GAAG,KAAIC,0BAAW,EAACP,QAAQ,EAAEE,kBAAkB,CAAC;IAC3D,IAAI,CAACJ,OAAO,CAACU,IAAI,CAACF,KAAK,CAAC;IACxB,OAAOA,KAAK;EACd;;EAEA;AACF;AACA;EACEG,cAAc,CAACC,SAAmB,EAAc;IAC9C,MAAMZ,OAAO,GAAG,IAAI,CAACA,OAAO,CAACa,MAAM,CAAEL,KAAK,IAAK,CAACI,SAAS,CAACE,QAAQ,CAACN,KAAK,CAACO,MAAM,CAACC,QAAQ,CAAC,CAAC;IAC1F,OAAO,IAAIlB,UAAU,CAACE,OAAO,CAAC;EAChC;;EAEA;AACF;AACA;EACE,IAAIiB,GAAG,GAAa;IAClB,MAAMC,IAAI,GAAG,IAAI,CAAClB,OAAO,CAACmB,GAAG,CAAEX,KAAK,IAAKA,KAAK,CAACY,EAAE,CAACC,QAAQ,EAAE,CAAC;IAC7D,OAAOH,IAAI;EACb;;EAEA;AACF;AACA;EACEI,GAAG,CAACF,EAAU,EAA2B;IACvC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C,KAAK,CAAC,EAAEzC,KAAK,CAAC;IAC1D,CAAC,CAAC;IAEF,OAAO,IAAIV,UAAU,CAACoD,UAAU,CAAC;EACnC;AACF;AAAC;AAED,SAASC,WAAW,CAAC3C,KAAyB,EAAEyC,KAAc,EAAE;EAC9D,IAAI,CAACzC,KAAK,CAAC4C,WAAW,IAAI5C,KAAK,CAAC6C,IAAI,EAAE,OAAOC,0BAAW,CAACC,UAAU,CAAC/C,KAAK,CAAC6C,IAAI,CAAC;EAC/E,IAAI7C,KAAK,CAAC4C,WAAW,EAAE,OAAOE,0BAAW,CAACE,UAAU,CAAChD,KAAK,CAAC4C,WAAW,EAAEH,KAAK,CAAC;EAC9E,MAAM,IAAIQ,KAAK,CAAC,+CAA+C,CAAC;AAClE"}
|
package/dist/aspect.section.js
CHANGED
|
@@ -1,52 +1,38 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.AspectSection = void 0;
|
|
9
|
-
|
|
10
8
|
function _defineProperty2() {
|
|
11
9
|
const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
|
-
|
|
13
10
|
_defineProperty2 = function () {
|
|
14
11
|
return data;
|
|
15
12
|
};
|
|
16
|
-
|
|
17
13
|
return data;
|
|
18
14
|
}
|
|
19
|
-
|
|
20
15
|
function _react() {
|
|
21
16
|
const data = _interopRequireDefault(require("react"));
|
|
22
|
-
|
|
23
17
|
_react = function () {
|
|
24
18
|
return data;
|
|
25
19
|
};
|
|
26
|
-
|
|
27
20
|
return data;
|
|
28
21
|
}
|
|
29
|
-
|
|
30
22
|
function _uiFoundationUi() {
|
|
31
23
|
const data = require("@teambit/ui-foundation.ui.menu-widget-icon");
|
|
32
|
-
|
|
33
24
|
_uiFoundationUi = function () {
|
|
34
25
|
return data;
|
|
35
26
|
};
|
|
36
|
-
|
|
37
27
|
return data;
|
|
38
28
|
}
|
|
39
|
-
|
|
40
29
|
function _aspectPage() {
|
|
41
30
|
const data = require("./ui/aspect-page");
|
|
42
|
-
|
|
43
31
|
_aspectPage = function () {
|
|
44
32
|
return data;
|
|
45
33
|
};
|
|
46
|
-
|
|
47
34
|
return data;
|
|
48
35
|
}
|
|
49
|
-
|
|
50
36
|
class AspectSection {
|
|
51
37
|
constructor() {
|
|
52
38
|
(0, _defineProperty2().default)(this, "route", {
|
|
@@ -63,9 +49,7 @@ class AspectSection {
|
|
|
63
49
|
});
|
|
64
50
|
(0, _defineProperty2().default)(this, "order", 50);
|
|
65
51
|
}
|
|
66
|
-
|
|
67
52
|
}
|
|
68
|
-
|
|
69
53
|
exports.AspectSection = AspectSection;
|
|
70
54
|
|
|
71
55
|
//# sourceMappingURL=aspect.section.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["AspectSection","path","element","href","children","displayName"],"sources":["aspect.section.tsx"],"sourcesContent":["import React from 'react';\nimport { MenuWidgetIcon } from '@teambit/ui-foundation.ui.menu-widget-icon';\nimport { Section } from './section';\nimport { AspectPage } from './ui/aspect-page';\n\nexport class AspectSection implements Section {\n route = {\n path: '~aspect',\n element: <AspectPage />,\n };\n navigationLink = {\n href: '~aspect',\n children: <MenuWidgetIcon icon=\"configuration\" tooltipContent=\"Configuration\" />,\n displayName: 'Configuration',\n };\n order = 50;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["AspectSection","path","element","href","children","displayName"],"sources":["aspect.section.tsx"],"sourcesContent":["import React from 'react';\nimport { MenuWidgetIcon } from '@teambit/ui-foundation.ui.menu-widget-icon';\nimport { Section } from './section';\nimport { AspectPage } from './ui/aspect-page';\n\nexport class AspectSection implements Section {\n route = {\n path: '~aspect',\n element: <AspectPage />,\n };\n navigationLink = {\n href: '~aspect',\n children: <MenuWidgetIcon icon=\"configuration\" tooltipContent=\"Configuration\" />,\n displayName: 'Configuration',\n };\n order = 50;\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,aAAa,CAAoB;EAAA;IAAA,+CACpC;MACNC,IAAI,EAAE,SAAS;MACfC,OAAO,eAAE,+BAAC,wBAAU;IACtB,CAAC;IAAA,wDACgB;MACfC,IAAI,EAAE,SAAS;MACfC,QAAQ,eAAE,+BAAC,gCAAc;QAAC,IAAI,EAAC,eAAe;QAAC,cAAc,EAAC;MAAe,EAAG;MAChFC,WAAW,EAAE;IACf,CAAC;IAAA,+CACO,EAAE;EAAA;AACZ;AAAC"}
|
package/dist/component-fs.js
CHANGED
|
@@ -1,54 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
require("core-js/modules/es.regexp.exec.js");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
8
|
exports.default = void 0;
|
|
11
|
-
|
|
12
9
|
function _anyFs() {
|
|
13
10
|
const data = require("@teambit/any-fs");
|
|
14
|
-
|
|
15
11
|
_anyFs = function () {
|
|
16
12
|
return data;
|
|
17
13
|
};
|
|
18
|
-
|
|
19
14
|
return data;
|
|
20
15
|
}
|
|
21
|
-
|
|
22
16
|
function _eol() {
|
|
23
17
|
const data = require("@teambit/legacy/dist/utils/eol");
|
|
24
|
-
|
|
25
18
|
_eol = function () {
|
|
26
19
|
return data;
|
|
27
20
|
};
|
|
28
|
-
|
|
29
21
|
return data;
|
|
30
22
|
}
|
|
31
|
-
|
|
32
23
|
function _path() {
|
|
33
24
|
const data = _interopRequireDefault(require("path"));
|
|
34
|
-
|
|
35
25
|
_path = function () {
|
|
36
26
|
return data;
|
|
37
27
|
};
|
|
38
|
-
|
|
39
28
|
return data;
|
|
40
29
|
}
|
|
41
|
-
|
|
42
30
|
function _toolboxPath() {
|
|
43
31
|
const data = require("@teambit/toolbox.path.match-patterns");
|
|
44
|
-
|
|
45
32
|
_toolboxPath = function () {
|
|
46
33
|
return data;
|
|
47
34
|
};
|
|
48
|
-
|
|
49
35
|
return data;
|
|
50
36
|
}
|
|
51
|
-
|
|
52
37
|
/**
|
|
53
38
|
* The virtual component filesystem
|
|
54
39
|
*/
|
|
@@ -64,24 +49,20 @@ class ComponentFS extends _anyFs().MemoryFS {
|
|
|
64
49
|
/**
|
|
65
50
|
* hash to represent all contents within this filesystem volume.
|
|
66
51
|
*/
|
|
67
|
-
|
|
68
|
-
|
|
69
52
|
get hash() {
|
|
70
53
|
return '';
|
|
71
54
|
}
|
|
55
|
+
|
|
72
56
|
/**
|
|
73
57
|
* filter all component files by regex.
|
|
74
58
|
*/
|
|
75
|
-
|
|
76
|
-
|
|
77
59
|
byRegex(extension) {
|
|
78
60
|
return this.files.filter(file => file.path.match(extension));
|
|
79
61
|
}
|
|
62
|
+
|
|
80
63
|
/**
|
|
81
64
|
* filter all files using an array of glob patterns.
|
|
82
65
|
*/
|
|
83
|
-
|
|
84
|
-
|
|
85
66
|
byGlob(patterns) {
|
|
86
67
|
const {
|
|
87
68
|
includePatterns,
|
|
@@ -92,7 +73,6 @@ class ComponentFS extends _anyFs().MemoryFS {
|
|
|
92
73
|
});
|
|
93
74
|
return files;
|
|
94
75
|
}
|
|
95
|
-
|
|
96
76
|
toObject() {
|
|
97
77
|
return this.files.map(file => {
|
|
98
78
|
return {
|
|
@@ -101,7 +81,6 @@ class ComponentFS extends _anyFs().MemoryFS {
|
|
|
101
81
|
};
|
|
102
82
|
});
|
|
103
83
|
}
|
|
104
|
-
|
|
105
84
|
static fromVinyls(files) {
|
|
106
85
|
const fs = new ComponentFS(files);
|
|
107
86
|
files.forEach(file => {
|
|
@@ -112,9 +91,7 @@ class ComponentFS extends _anyFs().MemoryFS {
|
|
|
112
91
|
});
|
|
113
92
|
return fs;
|
|
114
93
|
}
|
|
115
|
-
|
|
116
94
|
}
|
|
117
|
-
|
|
118
95
|
exports.default = ComponentFS;
|
|
119
96
|
|
|
120
97
|
//# sourceMappingURL=component-fs.js.map
|
package/dist/component-fs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ComponentFS","MemoryFS","constructor","files","hash","byRegex","extension","filter","file","path","match","byGlob","patterns","includePatterns","excludePatterns","splitPatterns","matchPatterns","relative","toObject","map","contents","fromVinyls","fs","forEach","dirPath","relativeDir","startsWith","join","mkdirpSync","writeFileSync","auto"],"sources":["component-fs.ts"],"sourcesContent":["import { MemoryFS } from '@teambit/any-fs';\nimport type { AbstractVinyl } from '@teambit/legacy/dist/consumer/component/sources';\nimport { auto } from '@teambit/legacy/dist/utils/eol';\nimport path from 'path';\nimport { matchPatterns, splitPatterns } from '@teambit/toolbox.path.match-patterns';\n\n/**\n * The virtual component filesystem\n */\nexport default class ComponentFS extends MemoryFS {\n constructor(\n /**\n * array of all fs files.\n */\n readonly files: AbstractVinyl[]\n ) {\n super();\n }\n /**\n * hash to represent all contents within this filesystem volume.\n */\n get hash() {\n return '';\n }\n\n /**\n * filter all component files by regex.\n */\n byRegex(extension: RegExp): AbstractVinyl[] {\n return this.files.filter((file) => file.path.match(extension));\n }\n\n /**\n * filter all files using an array of glob patterns.\n */\n byGlob(patterns: string[]) {\n const { includePatterns, excludePatterns } = splitPatterns(patterns);\n\n const files = this.files.filter((file) => {\n return matchPatterns(file.relative, includePatterns, excludePatterns);\n });\n\n return files;\n }\n\n toObject() {\n return this.files.map((file) => {\n return {\n path: file.path,\n contents: file.contents,\n };\n });\n }\n\n static fromVinyls(files: AbstractVinyl[]) {\n const fs = new ComponentFS(files);\n files.forEach((file) => {\n let dirPath = file.relativeDir;\n if (!dirPath.startsWith('/')) dirPath = path.join('/', dirPath);\n fs.mkdirpSync(dirPath);\n fs.writeFileSync(`/${file.relative}`, auto(file.contents || ''));\n });\n\n return fs;\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["ComponentFS","MemoryFS","constructor","files","hash","byRegex","extension","filter","file","path","match","byGlob","patterns","includePatterns","excludePatterns","splitPatterns","matchPatterns","relative","toObject","map","contents","fromVinyls","fs","forEach","dirPath","relativeDir","startsWith","join","mkdirpSync","writeFileSync","auto"],"sources":["component-fs.ts"],"sourcesContent":["import { MemoryFS } from '@teambit/any-fs';\nimport type { AbstractVinyl } from '@teambit/legacy/dist/consumer/component/sources';\nimport { auto } from '@teambit/legacy/dist/utils/eol';\nimport path from 'path';\nimport { matchPatterns, splitPatterns } from '@teambit/toolbox.path.match-patterns';\n\n/**\n * The virtual component filesystem\n */\nexport default class ComponentFS extends MemoryFS {\n constructor(\n /**\n * array of all fs files.\n */\n readonly files: AbstractVinyl[]\n ) {\n super();\n }\n /**\n * hash to represent all contents within this filesystem volume.\n */\n get hash() {\n return '';\n }\n\n /**\n * filter all component files by regex.\n */\n byRegex(extension: RegExp): AbstractVinyl[] {\n return this.files.filter((file) => file.path.match(extension));\n }\n\n /**\n * filter all files using an array of glob patterns.\n */\n byGlob(patterns: string[]) {\n const { includePatterns, excludePatterns } = splitPatterns(patterns);\n\n const files = this.files.filter((file) => {\n return matchPatterns(file.relative, includePatterns, excludePatterns);\n });\n\n return files;\n }\n\n toObject() {\n return this.files.map((file) => {\n return {\n path: file.path,\n contents: file.contents,\n };\n });\n }\n\n static fromVinyls(files: AbstractVinyl[]) {\n const fs = new ComponentFS(files);\n files.forEach((file) => {\n let dirPath = file.relativeDir;\n if (!dirPath.startsWith('/')) dirPath = path.join('/', dirPath);\n fs.mkdirpSync(dirPath);\n fs.writeFileSync(`/${file.relative}`, auto(file.contents || ''));\n });\n\n return fs;\n }\n}\n"],"mappings":";;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA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,CAACiB,WAAW;MAC9B,IAAI,CAACD,OAAO,CAACE,UAAU,CAAC,GAAG,CAAC,EAAEF,OAAO,GAAGf,eAAI,CAACkB,IAAI,CAAC,GAAG,EAAEH,OAAO,CAAC;MAC/DF,EAAE,CAACM,UAAU,CAACJ,OAAO,CAAC;MACtBF,EAAE,CAACO,aAAa,CAAE,IAAGrB,IAAI,CAACS,QAAS,EAAC,EAAE,IAAAa,WAAI,EAACtB,IAAI,CAACY,QAAQ,IAAI,EAAE,CAAC,CAAC;IAClE,CAAC,CAAC;IAEF,OAAOE,EAAE;EACX;AACF;AAAC"}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
require("core-js/modules/es.array.iterator.js");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.ComponentMap = void 0;
|
|
9
|
-
|
|
10
8
|
/**
|
|
11
9
|
* allows to index components -> values.
|
|
12
10
|
*/
|
|
@@ -14,49 +12,43 @@ class ComponentMap {
|
|
|
14
12
|
constructor(hashMap) {
|
|
15
13
|
this.hashMap = hashMap;
|
|
16
14
|
}
|
|
15
|
+
|
|
17
16
|
/**
|
|
18
17
|
* @deprecated please use `get` instead
|
|
19
18
|
*/
|
|
20
|
-
|
|
21
|
-
|
|
22
19
|
byComponent(component) {
|
|
23
20
|
return this.hashMap.get(component.id.toString());
|
|
24
21
|
}
|
|
25
|
-
|
|
26
22
|
get components() {
|
|
27
23
|
return this.toArray().map(([component]) => component);
|
|
28
24
|
}
|
|
25
|
+
|
|
29
26
|
/**
|
|
30
27
|
* get a value for a component.
|
|
31
28
|
*/
|
|
32
|
-
|
|
33
|
-
|
|
34
29
|
get(component) {
|
|
35
30
|
return this.hashMap.get(component.id.toString());
|
|
36
31
|
}
|
|
32
|
+
|
|
37
33
|
/**
|
|
38
34
|
* get a value by the component-id
|
|
39
35
|
*/
|
|
40
|
-
|
|
41
|
-
|
|
42
36
|
getValueByComponentId(componentId) {
|
|
43
37
|
const tuple = this.hashMap.get(componentId.toString());
|
|
44
38
|
if (!tuple) return null;
|
|
45
39
|
return tuple[1];
|
|
46
40
|
}
|
|
41
|
+
|
|
47
42
|
/**
|
|
48
43
|
* returns an array.
|
|
49
44
|
*/
|
|
50
|
-
|
|
51
|
-
|
|
52
45
|
toArray() {
|
|
53
46
|
return Array.from(this.hashMap.values());
|
|
54
47
|
}
|
|
48
|
+
|
|
55
49
|
/**
|
|
56
50
|
* map entries and return a new component map.
|
|
57
51
|
*/
|
|
58
|
-
|
|
59
|
-
|
|
60
52
|
map(predicate) {
|
|
61
53
|
const tuples = this.toArray().map(([component, value]) => {
|
|
62
54
|
const newValue = predicate(value, component);
|
|
@@ -64,32 +56,29 @@ class ComponentMap {
|
|
|
64
56
|
});
|
|
65
57
|
return new ComponentMap(new Map(tuples));
|
|
66
58
|
}
|
|
59
|
+
|
|
67
60
|
/**
|
|
68
61
|
* similar to Array.forEach, but here you get both, the value and the component.
|
|
69
62
|
*/
|
|
70
|
-
|
|
71
|
-
|
|
72
63
|
forEach(predicate) {
|
|
73
64
|
this.toArray().forEach(([component, value]) => {
|
|
74
65
|
predicate(value, component);
|
|
75
66
|
});
|
|
76
67
|
}
|
|
68
|
+
|
|
77
69
|
/**
|
|
78
70
|
* flatten values of all components into a single array.
|
|
79
71
|
*/
|
|
80
|
-
|
|
81
|
-
|
|
82
72
|
flattenValue() {
|
|
83
73
|
return this.toArray().reduce((acc, [, value]) => {
|
|
84
74
|
acc = acc.concat(value);
|
|
85
75
|
return acc;
|
|
86
76
|
}, []);
|
|
87
77
|
}
|
|
78
|
+
|
|
88
79
|
/**
|
|
89
80
|
* filter all components with empty values and return a new map.
|
|
90
81
|
*/
|
|
91
|
-
|
|
92
|
-
|
|
93
82
|
filter(predicate) {
|
|
94
83
|
const tuples = this.toArray().filter(([, value]) => {
|
|
95
84
|
return predicate(value);
|
|
@@ -99,37 +88,32 @@ class ComponentMap {
|
|
|
99
88
|
});
|
|
100
89
|
return new ComponentMap(new Map(asMap));
|
|
101
90
|
}
|
|
91
|
+
|
|
102
92
|
/**
|
|
103
93
|
* get all component ids.
|
|
104
94
|
*/
|
|
105
|
-
|
|
106
|
-
|
|
107
95
|
keys() {
|
|
108
96
|
return this.hashMap.keys();
|
|
109
97
|
}
|
|
110
|
-
|
|
111
98
|
static create(rawMap) {
|
|
112
99
|
const newMap = rawMap.map(([component, data]) => {
|
|
113
100
|
return [component.id.toString(), [component, data]];
|
|
114
101
|
});
|
|
115
102
|
return new ComponentMap(new Map(newMap));
|
|
116
103
|
}
|
|
104
|
+
|
|
117
105
|
/**
|
|
118
106
|
* create a component map from components and a value predicate.
|
|
119
107
|
* @param components components to zip into the map.
|
|
120
108
|
* @param predicate predicate for returning desired value.
|
|
121
109
|
*/
|
|
122
|
-
|
|
123
|
-
|
|
124
110
|
static as(components, predicate) {
|
|
125
111
|
const tuples = components.map(component => {
|
|
126
112
|
return [component.id.toString(), [component, predicate(component)]];
|
|
127
113
|
});
|
|
128
114
|
return new ComponentMap(new Map(tuples));
|
|
129
115
|
}
|
|
130
|
-
|
|
131
116
|
}
|
|
132
|
-
|
|
133
117
|
exports.ComponentMap = ComponentMap;
|
|
134
118
|
|
|
135
119
|
//# sourceMappingURL=component-map.js.map
|