@teambit/component 0.0.881 → 0.0.883
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.883.tgz +0 -0
- package/package.json +12 -12
- package/{preview-1666409808293.js → preview-1666582798766.js} +2 -2
- package/package-tar/teambit-component-0.0.881.tgz +0 -0
package/dist/state.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["State","constructor","config","_aspects","filesystem","dependencies","_consumer","mainFile","file","files","find","componentFile","relative","MainFileNotFound","ComponentID","fromLegacy","id","hash","issues","IssuesList","isModified","_isModified","aspects"],"sources":["state.ts"],"sourcesContent":["import { IssuesList } from '@teambit/component-issues';\nimport { ComponentID } from '@teambit/component-id';\nimport ComponentFS from './component-fs';\nimport Config from './config';\nimport { AspectList } from './aspect-list';\nimport { MainFileNotFound } from './exceptions';\n\nexport class State {\n constructor(\n /**\n * component configuration which is later generated to a component `package.json` and `bit.json`.\n * @deprecated please use `aspects` instead.\n */\n readonly config: Config,\n\n /**\n * list of aspects configured on the component.\n */\n private _aspects: AspectList,\n\n /**\n * in-memory representation of the component current filesystem.\n */\n readonly filesystem: ComponentFS,\n\n /**\n * dependency graph of the component current. ideally package dependencies would be also placed here.\n */\n // readonly dependencies: Dependencies\n readonly dependencies,\n\n /**\n * instance of legacy consumer component.\n */\n readonly _consumer: any\n ) {}\n\n /**\n * get the main file of the component.\n */\n get mainFile() {\n const file = this.filesystem.files.find((componentFile) => {\n return componentFile.relative === this._consumer.mainFile;\n });\n\n if (!file) throw new MainFileNotFound(ComponentID.fromLegacy(this._consumer.id), this._consumer.mainFile);\n\n return file;\n }\n\n /**\n * calculate the hash of this state\n */\n get hash() {\n return '';\n }\n\n get issues(): IssuesList {\n return (this._consumer.issues ||= new IssuesList());\n }\n\n /**\n * @deprecated please use `component.isModified`.\n * the way it's implemented here is unreliable and will only work if in the legacy the \"isModified\" was calculated.\n */\n get isModified(): boolean {\n return this._consumer._isModified;\n }\n\n get aspects(): AspectList {\n return this._aspects;\n }\n\n set aspects(aspects: AspectList) {\n this._aspects = aspects;\n }\n\n // static fromLegacy(consumerComponent: ConsumerComponent) {\n // return new State(\n // new Config(consumerComponent.mainFile, consumerComponent.extensions),\n // consumerComponent.version || 'new',\n // ComponentFS.fromVinyls(consumerComponent.files),\n // Store.fromArray([]),\n // consumerComponent.dependencies,\n // consumerComponent\n // );\n // }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["State","constructor","config","_aspects","filesystem","dependencies","_consumer","mainFile","file","files","find","componentFile","relative","MainFileNotFound","ComponentID","fromLegacy","id","hash","issues","IssuesList","isModified","_isModified","aspects"],"sources":["state.ts"],"sourcesContent":["import { IssuesList } from '@teambit/component-issues';\nimport { ComponentID } from '@teambit/component-id';\nimport ComponentFS from './component-fs';\nimport Config from './config';\nimport { AspectList } from './aspect-list';\nimport { MainFileNotFound } from './exceptions';\n\nexport class State {\n constructor(\n /**\n * component configuration which is later generated to a component `package.json` and `bit.json`.\n * @deprecated please use `aspects` instead.\n */\n readonly config: Config,\n\n /**\n * list of aspects configured on the component.\n */\n private _aspects: AspectList,\n\n /**\n * in-memory representation of the component current filesystem.\n */\n readonly filesystem: ComponentFS,\n\n /**\n * dependency graph of the component current. ideally package dependencies would be also placed here.\n */\n // readonly dependencies: Dependencies\n readonly dependencies,\n\n /**\n * instance of legacy consumer component.\n */\n readonly _consumer: any\n ) {}\n\n /**\n * get the main file of the component.\n */\n get mainFile() {\n const file = this.filesystem.files.find((componentFile) => {\n return componentFile.relative === this._consumer.mainFile;\n });\n\n if (!file) throw new MainFileNotFound(ComponentID.fromLegacy(this._consumer.id), this._consumer.mainFile);\n\n return file;\n }\n\n /**\n * calculate the hash of this state\n */\n get hash() {\n return '';\n }\n\n get issues(): IssuesList {\n return (this._consumer.issues ||= new IssuesList());\n }\n\n /**\n * @deprecated please use `component.isModified`.\n * the way it's implemented here is unreliable and will only work if in the legacy the \"isModified\" was calculated.\n */\n get isModified(): boolean {\n return this._consumer._isModified;\n }\n\n get aspects(): AspectList {\n return this._aspects;\n }\n\n set aspects(aspects: AspectList) {\n this._aspects = aspects;\n }\n\n // static fromLegacy(consumerComponent: ConsumerComponent) {\n // return new State(\n // new Config(consumerComponent.mainFile, consumerComponent.extensions),\n // consumerComponent.version || 'new',\n // ComponentFS.fromVinyls(consumerComponent.files),\n // Store.fromArray([]),\n // consumerComponent.dependencies,\n // consumerComponent\n // );\n // }\n}\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAIA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,KAAK,CAAC;EACjBC,WAAW;EACT;AACJ;AACA;AACA;EACaC,MAAc;EAEvB;AACJ;AACA;EACYC,QAAoB;EAE5B;AACJ;AACA;EACaC,UAAuB;EAEhC;AACJ;AACA;EACI;EACSC,YAAY;EAErB;AACJ;AACA;EACaC,SAAc,EACvB;IAAA,KAtBSJ,MAAc,GAAdA,MAAc;IAAA,KAKfC,QAAoB,GAApBA,QAAoB;IAAA,KAKnBC,UAAuB,GAAvBA,UAAuB;IAAA,KAMvBC,YAAY,GAAZA,YAAY;IAAA,KAKZC,SAAc,GAAdA,SAAc;EACtB;;EAEH;AACF;AACA;EACE,IAAIC,QAAQ,GAAG;IACb,MAAMC,IAAI,GAAG,IAAI,CAACJ,UAAU,CAACK,KAAK,CAACC,IAAI,CAAEC,aAAa,IAAK;MACzD,OAAOA,aAAa,CAACC,QAAQ,KAAK,IAAI,CAACN,SAAS,CAACC,QAAQ;IAC3D,CAAC,CAAC;IAEF,IAAI,CAACC,IAAI,EAAE,MAAM,KAAIK,8BAAgB,EAACC,0BAAW,CAACC,UAAU,CAAC,IAAI,CAACT,SAAS,CAACU,EAAE,CAAC,EAAE,IAAI,CAACV,SAAS,CAACC,QAAQ,CAAC;IAEzG,OAAOC,IAAI;EACb;;EAEA;AACF;AACA;EACE,IAAIS,IAAI,GAAG;IACT,OAAO,EAAE;EACX;EAEA,IAAIC,MAAM,GAAe;IAAA;IACvB,OAAQ,uBAAI,CAACZ,SAAS,EAACY,MAAM,KAArB,gBAAeA,MAAM,GAAK,KAAIC,6BAAU,GAAE;EACpD;;EAEA;AACF;AACA;AACA;EACE,IAAIC,UAAU,GAAY;IACxB,OAAO,IAAI,CAACd,SAAS,CAACe,WAAW;EACnC;EAEA,IAAIC,OAAO,GAAe;IACxB,OAAO,IAAI,CAACnB,QAAQ;EACtB;EAEA,IAAImB,OAAO,CAACA,OAAmB,EAAE;IAC/B,IAAI,CAACnB,QAAQ,GAAGmB,OAAO;EACzB;;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;AACF;AAAC"}
|
package/dist/store.js
CHANGED
|
@@ -4,19 +4,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.Store = void 0;
|
|
7
|
-
|
|
8
7
|
function _extensionData() {
|
|
9
8
|
const data = require("@teambit/legacy/dist/consumer/config/extension-data");
|
|
10
|
-
|
|
11
9
|
_extensionData = function () {
|
|
12
10
|
return data;
|
|
13
11
|
};
|
|
14
|
-
|
|
15
12
|
return data;
|
|
16
13
|
}
|
|
17
|
-
|
|
18
14
|
class Store extends _extensionData().ExtensionDataList {}
|
|
19
|
-
|
|
20
15
|
exports.Store = Store;
|
|
21
16
|
|
|
22
17
|
//# sourceMappingURL=store.js.map
|
package/dist/store.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Store","ExtensionDataList"],"sources":["store.ts"],"sourcesContent":["import { ExtensionDataList } from '@teambit/legacy/dist/consumer/config/extension-data';\n\nexport class Store extends ExtensionDataList {}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["Store","ExtensionDataList"],"sources":["store.ts"],"sourcesContent":["import { ExtensionDataList } from '@teambit/legacy/dist/consumer/config/extension-data';\n\nexport class Store extends ExtensionDataList {}\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,KAAK,SAASC,kCAAiB,CAAC;AAAE"}
|
package/dist/tag/index.js
CHANGED
package/dist/tag/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { Tag } from './tag';\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { Tag } from './tag';\n"],"mappings":";;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA"}
|
package/dist/tag/tag.js
CHANGED
|
@@ -4,17 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.Tag = void 0;
|
|
7
|
-
|
|
8
7
|
function _semver() {
|
|
9
8
|
const data = require("semver");
|
|
10
|
-
|
|
11
9
|
_semver = function () {
|
|
12
10
|
return data;
|
|
13
11
|
};
|
|
14
|
-
|
|
15
12
|
return data;
|
|
16
13
|
}
|
|
17
|
-
|
|
18
14
|
/**
|
|
19
15
|
* `Tag` provides a sematic reference to a specific state `Snap` in the working tree.
|
|
20
16
|
*/
|
|
@@ -31,24 +27,20 @@ class Tag {
|
|
|
31
27
|
this.hash = hash;
|
|
32
28
|
this.version = version;
|
|
33
29
|
}
|
|
30
|
+
|
|
34
31
|
/**
|
|
35
32
|
* create a plain tag object.
|
|
36
33
|
*/
|
|
37
|
-
|
|
38
|
-
|
|
39
34
|
toObject() {
|
|
40
35
|
return {
|
|
41
36
|
hash: this.hash,
|
|
42
37
|
version: this.version.raw
|
|
43
38
|
};
|
|
44
39
|
}
|
|
45
|
-
|
|
46
40
|
static fromObject(tag) {
|
|
47
41
|
return new Tag(tag.hash, new (_semver().SemVer)(tag.version));
|
|
48
42
|
}
|
|
49
|
-
|
|
50
43
|
}
|
|
51
|
-
|
|
52
44
|
exports.Tag = Tag;
|
|
53
45
|
|
|
54
46
|
//# sourceMappingURL=tag.js.map
|
package/dist/tag/tag.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Tag","constructor","hash","version","toObject","raw","fromObject","tag","SemVer"],"sources":["tag.ts"],"sourcesContent":["import { SemVer } from 'semver';\n\nexport type TagProps = {\n hash: string;\n version: string;\n};\n\n/**\n * `Tag` provides a sematic reference to a specific state `Snap` in the working tree.\n */\nexport class Tag {\n constructor(\n /**\n * tag hash, can be used to load it by component-factory.getSnap\n */\n readonly hash: string,\n\n /**\n * sematic version of the snap.\n */\n readonly version: SemVer\n ) {}\n\n /**\n * create a plain tag object.\n */\n toObject(): TagProps {\n return {\n hash: this.hash,\n version: this.version.raw,\n };\n }\n\n static fromObject(tag: TagProps) {\n return new Tag(tag.hash, new SemVer(tag.version));\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["Tag","constructor","hash","version","toObject","raw","fromObject","tag","SemVer"],"sources":["tag.ts"],"sourcesContent":["import { SemVer } from 'semver';\n\nexport type TagProps = {\n hash: string;\n version: string;\n};\n\n/**\n * `Tag` provides a sematic reference to a specific state `Snap` in the working tree.\n */\nexport class Tag {\n constructor(\n /**\n * tag hash, can be used to load it by component-factory.getSnap\n */\n readonly hash: string,\n\n /**\n * sematic version of the snap.\n */\n readonly version: SemVer\n ) {}\n\n /**\n * create a plain tag object.\n */\n toObject(): TagProps {\n return {\n hash: this.hash,\n version: this.version.raw,\n };\n }\n\n static fromObject(tag: TagProps) {\n return new Tag(tag.hash, new SemVer(tag.version));\n }\n}\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAOA;AACA;AACA;AACO,MAAMA,GAAG,CAAC;EACfC,WAAW;EACT;AACJ;AACA;EACaC,IAAY;EAErB;AACJ;AACA;EACaC,OAAe,EACxB;IAAA,KANSD,IAAY,GAAZA,IAAY;IAAA,KAKZC,OAAe,GAAfA,OAAe;EACvB;;EAEH;AACF;AACA;EACEC,QAAQ,GAAa;IACnB,OAAO;MACLF,IAAI,EAAE,IAAI,CAACA,IAAI;MACfC,OAAO,EAAE,IAAI,CAACA,OAAO,CAACE;IACxB,CAAC;EACH;EAEA,OAAOC,UAAU,CAACC,GAAa,EAAE;IAC/B,OAAO,IAAIP,GAAG,CAACO,GAAG,CAACL,IAAI,EAAE,KAAIM,gBAAM,EAACD,GAAG,CAACJ,OAAO,CAAC,CAAC;EACnD;AACF;AAAC"}
|
package/dist/tag-map.js
CHANGED
|
@@ -1,42 +1,31 @@
|
|
|
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.TagMap = void 0;
|
|
9
|
-
|
|
10
8
|
function _semverHelper() {
|
|
11
9
|
const data = require("@teambit/legacy/dist/utils/semver-helper");
|
|
12
|
-
|
|
13
10
|
_semverHelper = function () {
|
|
14
11
|
return data;
|
|
15
12
|
};
|
|
16
|
-
|
|
17
13
|
return data;
|
|
18
14
|
}
|
|
19
|
-
|
|
20
15
|
function _semver() {
|
|
21
16
|
const data = require("semver");
|
|
22
|
-
|
|
23
17
|
_semver = function () {
|
|
24
18
|
return data;
|
|
25
19
|
};
|
|
26
|
-
|
|
27
20
|
return data;
|
|
28
21
|
}
|
|
29
|
-
|
|
30
22
|
function _exceptions() {
|
|
31
23
|
const data = require("./exceptions");
|
|
32
|
-
|
|
33
24
|
_exceptions = function () {
|
|
34
25
|
return data;
|
|
35
26
|
};
|
|
36
|
-
|
|
37
27
|
return data;
|
|
38
28
|
}
|
|
39
|
-
|
|
40
29
|
class TagMap extends Map {
|
|
41
30
|
/**
|
|
42
31
|
* get snap by hash.
|
|
@@ -45,6 +34,7 @@ class TagMap extends Map {
|
|
|
45
34
|
const tag = Array.from(this.values()).find(currTag => currTag.hash === hash);
|
|
46
35
|
return tag;
|
|
47
36
|
}
|
|
37
|
+
|
|
48
38
|
/**
|
|
49
39
|
* e.g.
|
|
50
40
|
* {
|
|
@@ -52,21 +42,16 @@ class TagMap extends Map {
|
|
|
52
42
|
* dev: '2.2.4-dev.37
|
|
53
43
|
* }
|
|
54
44
|
*/
|
|
55
|
-
|
|
56
|
-
|
|
57
45
|
getPreReleaseLatestTags() {
|
|
58
46
|
const preReleaseTagsWithAllVersions = this.toArray().reduce((acc, current) => {
|
|
59
47
|
var _preReleases$;
|
|
60
|
-
|
|
61
48
|
const preReleases = current.version.prerelease;
|
|
62
49
|
if (!preReleases.length) return acc;
|
|
63
|
-
|
|
64
50
|
if (preReleases.length !== 2) {
|
|
65
51
|
// it could be length 1, e.g. 1.0.0-0, we ignore it.
|
|
66
52
|
// it could also be length > 2, e.g. 1.0.0-dev.1.alpha.1, we don't support it for now.
|
|
67
53
|
return acc;
|
|
68
54
|
}
|
|
69
|
-
|
|
70
55
|
if (typeof preReleases[0] !== 'string') return acc;
|
|
71
56
|
(acc[_preReleases$ = preReleases[0]] || (acc[_preReleases$] = [])).push(current.version.raw);
|
|
72
57
|
return acc;
|
|
@@ -78,11 +63,10 @@ class TagMap extends Map {
|
|
|
78
63
|
return acc;
|
|
79
64
|
}, {});
|
|
80
65
|
}
|
|
66
|
+
|
|
81
67
|
/**
|
|
82
68
|
* Get a map that map snap hash to tag
|
|
83
69
|
*/
|
|
84
|
-
|
|
85
|
-
|
|
86
70
|
getHashMap() {
|
|
87
71
|
const res = new Map();
|
|
88
72
|
this.forEach(tag => {
|
|
@@ -90,45 +74,37 @@ class TagMap extends Map {
|
|
|
90
74
|
});
|
|
91
75
|
return res;
|
|
92
76
|
}
|
|
77
|
+
|
|
93
78
|
/**
|
|
94
79
|
* get the latest semver from the tag map.
|
|
95
80
|
*/
|
|
96
|
-
|
|
97
|
-
|
|
98
81
|
getLatest() {
|
|
99
82
|
const versions = this.toArray().map(tag => tag.version.raw);
|
|
100
83
|
if (this.isEmpty()) throw new (_exceptions().CouldNotFindLatest)(versions);
|
|
101
84
|
return (0, _semverHelper().getLatestVersion)(versions);
|
|
102
85
|
}
|
|
103
|
-
|
|
104
86
|
isEmpty() {
|
|
105
87
|
return this.size === 0;
|
|
106
88
|
}
|
|
89
|
+
|
|
107
90
|
/**
|
|
108
91
|
* get an array of all tags.
|
|
109
92
|
*/
|
|
110
|
-
|
|
111
|
-
|
|
112
93
|
toArray() {
|
|
113
94
|
return Array.from(this.values());
|
|
114
95
|
}
|
|
115
|
-
|
|
116
96
|
byVersion(version) {
|
|
117
97
|
const versions = this.toArray().map(tag => tag);
|
|
118
98
|
return versions.find(tag => tag.version.raw === version);
|
|
119
99
|
}
|
|
120
|
-
|
|
121
100
|
static fromArray(tags) {
|
|
122
101
|
const tuples = tags.map(tag => [tag.version, tag]);
|
|
123
102
|
return new TagMap(tuples);
|
|
124
103
|
}
|
|
125
|
-
|
|
126
104
|
static empty() {
|
|
127
105
|
return new TagMap();
|
|
128
106
|
}
|
|
129
|
-
|
|
130
107
|
}
|
|
131
|
-
|
|
132
108
|
exports.TagMap = TagMap;
|
|
133
109
|
|
|
134
110
|
//# sourceMappingURL=tag-map.js.map
|
package/dist/tag-map.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["TagMap","Map","byHash","hash","tag","Array","from","values","find","currTag","getPreReleaseLatestTags","preReleaseTagsWithAllVersions","toArray","reduce","acc","current","preReleases","version","prerelease","length","push","raw","Object","keys","maxSatisfying","includePrerelease","getHashMap","res","forEach","set","getLatest","versions","map","isEmpty","CouldNotFindLatest","getLatestVersion","size","byVersion","fromArray","tags","tuples","empty"],"sources":["tag-map.ts"],"sourcesContent":["import { getLatestVersion } from '@teambit/legacy/dist/utils/semver-helper';\nimport { SemVer, maxSatisfying } from 'semver';\n\nimport { CouldNotFindLatest } from './exceptions';\nimport { Hash } from './hash';\nimport { Tag } from './tag';\n\nexport class TagMap extends Map<SemVer, Tag> {\n /**\n * get snap by hash.\n */\n byHash(hash: Hash) {\n const tag = Array.from(this.values()).find((currTag) => currTag.hash === hash);\n return tag;\n }\n\n /**\n * e.g.\n * {\n * alpha: '1.0.0-alpha.5',\n * dev: '2.2.4-dev.37\n * }\n */\n getPreReleaseLatestTags(): { [preRelease: string]: string } {\n const preReleaseTagsWithAllVersions = this.toArray().reduce((acc, current) => {\n const preReleases = current.version.prerelease;\n if (!preReleases.length) return acc;\n if (preReleases.length !== 2) {\n // it could be length 1, e.g. 1.0.0-0, we ignore it.\n // it could also be length > 2, e.g. 1.0.0-dev.1.alpha.1, we don't support it for now.\n return acc;\n }\n if (typeof preReleases[0] !== 'string') return acc;\n (acc[preReleases[0]] ||= []).push(current.version.raw);\n return acc;\n }, {});\n return Object.keys(preReleaseTagsWithAllVersions).reduce((acc, current) => {\n acc[current] = maxSatisfying<string>(preReleaseTagsWithAllVersions[current], '*', { includePrerelease: true });\n return acc;\n }, {});\n }\n\n /**\n * Get a map that map snap hash to tag\n */\n getHashMap(): Map<Hash, Tag> {\n const res: Map<Hash, Tag> = new Map();\n this.forEach((tag: Tag) => {\n res.set(tag.hash, tag);\n });\n return res;\n }\n\n /**\n * get the latest semver from the tag map.\n */\n getLatest(): string {\n const versions = this.toArray().map((tag) => tag.version.raw);\n if (this.isEmpty()) throw new CouldNotFindLatest(versions);\n return getLatestVersion(versions);\n }\n\n isEmpty() {\n return this.size === 0;\n }\n\n /**\n * get an array of all tags.\n */\n toArray(): Tag[] {\n return Array.from(this.values());\n }\n\n byVersion(version: string): Tag | undefined {\n const versions = this.toArray().map((tag) => tag);\n return versions.find((tag) => tag.version.raw === version);\n }\n\n static fromArray(tags: Tag[]) {\n const tuples: [SemVer, Tag][] = tags.map((tag) => [tag.version, tag]);\n return new TagMap(tuples);\n }\n\n static empty() {\n return new TagMap();\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["TagMap","Map","byHash","hash","tag","Array","from","values","find","currTag","getPreReleaseLatestTags","preReleaseTagsWithAllVersions","toArray","reduce","acc","current","preReleases","version","prerelease","length","push","raw","Object","keys","maxSatisfying","includePrerelease","getHashMap","res","forEach","set","getLatest","versions","map","isEmpty","CouldNotFindLatest","getLatestVersion","size","byVersion","fromArray","tags","tuples","empty"],"sources":["tag-map.ts"],"sourcesContent":["import { getLatestVersion } from '@teambit/legacy/dist/utils/semver-helper';\nimport { SemVer, maxSatisfying } from 'semver';\n\nimport { CouldNotFindLatest } from './exceptions';\nimport { Hash } from './hash';\nimport { Tag } from './tag';\n\nexport class TagMap extends Map<SemVer, Tag> {\n /**\n * get snap by hash.\n */\n byHash(hash: Hash) {\n const tag = Array.from(this.values()).find((currTag) => currTag.hash === hash);\n return tag;\n }\n\n /**\n * e.g.\n * {\n * alpha: '1.0.0-alpha.5',\n * dev: '2.2.4-dev.37\n * }\n */\n getPreReleaseLatestTags(): { [preRelease: string]: string } {\n const preReleaseTagsWithAllVersions = this.toArray().reduce((acc, current) => {\n const preReleases = current.version.prerelease;\n if (!preReleases.length) return acc;\n if (preReleases.length !== 2) {\n // it could be length 1, e.g. 1.0.0-0, we ignore it.\n // it could also be length > 2, e.g. 1.0.0-dev.1.alpha.1, we don't support it for now.\n return acc;\n }\n if (typeof preReleases[0] !== 'string') return acc;\n (acc[preReleases[0]] ||= []).push(current.version.raw);\n return acc;\n }, {});\n return Object.keys(preReleaseTagsWithAllVersions).reduce((acc, current) => {\n acc[current] = maxSatisfying<string>(preReleaseTagsWithAllVersions[current], '*', { includePrerelease: true });\n return acc;\n }, {});\n }\n\n /**\n * Get a map that map snap hash to tag\n */\n getHashMap(): Map<Hash, Tag> {\n const res: Map<Hash, Tag> = new Map();\n this.forEach((tag: Tag) => {\n res.set(tag.hash, tag);\n });\n return res;\n }\n\n /**\n * get the latest semver from the tag map.\n */\n getLatest(): string {\n const versions = this.toArray().map((tag) => tag.version.raw);\n if (this.isEmpty()) throw new CouldNotFindLatest(versions);\n return getLatestVersion(versions);\n }\n\n isEmpty() {\n return this.size === 0;\n }\n\n /**\n * get an array of all tags.\n */\n toArray(): Tag[] {\n return Array.from(this.values());\n }\n\n byVersion(version: string): Tag | undefined {\n const versions = this.toArray().map((tag) => tag);\n return versions.find((tag) => tag.version.raw === version);\n }\n\n static fromArray(tags: Tag[]) {\n const tuples: [SemVer, Tag][] = tags.map((tag) => [tag.version, tag]);\n return new TagMap(tuples);\n }\n\n static empty() {\n return new TagMap();\n }\n}\n"],"mappings":"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"}
|
|
@@ -1,106 +1,75 @@
|
|
|
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.AspectPage = AspectPage;
|
|
9
|
-
|
|
10
8
|
function _harmonyUi() {
|
|
11
9
|
const data = require("@teambit/harmony.ui.aspect-box");
|
|
12
|
-
|
|
13
10
|
_harmonyUi = function () {
|
|
14
11
|
return data;
|
|
15
12
|
};
|
|
16
|
-
|
|
17
13
|
return data;
|
|
18
14
|
}
|
|
19
|
-
|
|
20
15
|
function _component() {
|
|
21
16
|
const data = require("@teambit/component");
|
|
22
|
-
|
|
23
17
|
_component = function () {
|
|
24
18
|
return data;
|
|
25
19
|
};
|
|
26
|
-
|
|
27
20
|
return data;
|
|
28
21
|
}
|
|
29
|
-
|
|
30
22
|
function _react() {
|
|
31
23
|
const data = _interopRequireWildcard(require("react"));
|
|
32
|
-
|
|
33
24
|
_react = function () {
|
|
34
25
|
return data;
|
|
35
26
|
};
|
|
36
|
-
|
|
37
27
|
return data;
|
|
38
28
|
}
|
|
39
|
-
|
|
40
29
|
function _uiFoundationUiHooks() {
|
|
41
30
|
const data = require("@teambit/ui-foundation.ui.hooks.use-data-query");
|
|
42
|
-
|
|
43
31
|
_uiFoundationUiHooks = function () {
|
|
44
32
|
return data;
|
|
45
33
|
};
|
|
46
|
-
|
|
47
34
|
return data;
|
|
48
35
|
}
|
|
49
|
-
|
|
50
36
|
function _client() {
|
|
51
37
|
const data = require("@apollo/client");
|
|
52
|
-
|
|
53
38
|
_client = function () {
|
|
54
39
|
return data;
|
|
55
40
|
};
|
|
56
|
-
|
|
57
41
|
return data;
|
|
58
42
|
}
|
|
59
|
-
|
|
60
43
|
function _designUi() {
|
|
61
44
|
const data = require("@teambit/design.ui.empty-box");
|
|
62
|
-
|
|
63
45
|
_designUi = function () {
|
|
64
46
|
return data;
|
|
65
47
|
};
|
|
66
|
-
|
|
67
48
|
return data;
|
|
68
49
|
}
|
|
69
|
-
|
|
70
50
|
function _documenterUi() {
|
|
71
51
|
const data = require("@teambit/documenter.ui.heading");
|
|
72
|
-
|
|
73
52
|
_documenterUi = function () {
|
|
74
53
|
return data;
|
|
75
54
|
};
|
|
76
|
-
|
|
77
55
|
return data;
|
|
78
56
|
}
|
|
79
|
-
|
|
80
57
|
function _documenterUi2() {
|
|
81
58
|
const data = require("@teambit/documenter.ui.separator");
|
|
82
|
-
|
|
83
59
|
_documenterUi2 = function () {
|
|
84
60
|
return data;
|
|
85
61
|
};
|
|
86
|
-
|
|
87
62
|
return data;
|
|
88
63
|
}
|
|
89
|
-
|
|
90
64
|
function _aspectPageModule() {
|
|
91
65
|
const data = _interopRequireDefault(require("./aspect-page.module.scss"));
|
|
92
|
-
|
|
93
66
|
_aspectPageModule = function () {
|
|
94
67
|
return data;
|
|
95
68
|
};
|
|
96
|
-
|
|
97
69
|
return data;
|
|
98
70
|
}
|
|
99
|
-
|
|
100
71
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
101
|
-
|
|
102
72
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
103
|
-
|
|
104
73
|
const GET_COMPONENT = (0, _client().gql)`
|
|
105
74
|
query ($id: String!) {
|
|
106
75
|
getHost {
|
|
@@ -114,11 +83,11 @@ const GET_COMPONENT = (0, _client().gql)`
|
|
|
114
83
|
}
|
|
115
84
|
}
|
|
116
85
|
}
|
|
117
|
-
`;
|
|
86
|
+
`;
|
|
118
87
|
|
|
88
|
+
// TODO: get the docs domain from the community aspect and pass it here as a prop
|
|
119
89
|
function AspectPage() {
|
|
120
90
|
var _data$getHost, _data$getHost$get;
|
|
121
|
-
|
|
122
91
|
const component = (0, _react().useContext)(_component().ComponentContext);
|
|
123
92
|
const {
|
|
124
93
|
data
|
|
@@ -128,7 +97,6 @@ function AspectPage() {
|
|
|
128
97
|
}
|
|
129
98
|
});
|
|
130
99
|
const aspectList = data === null || data === void 0 ? void 0 : (_data$getHost = data.getHost) === null || _data$getHost === void 0 ? void 0 : (_data$getHost$get = _data$getHost.get) === null || _data$getHost$get === void 0 ? void 0 : _data$getHost$get.aspects;
|
|
131
|
-
|
|
132
100
|
if (aspectList && aspectList.length === 0) {
|
|
133
101
|
return /*#__PURE__*/_react().default.createElement(_designUi().EmptyBox, {
|
|
134
102
|
title: "This component is new and doesn\u2019t have any aspects.",
|
|
@@ -136,7 +104,6 @@ function AspectPage() {
|
|
|
136
104
|
link: `https://bit.dev/docs/extending-bit/aspect-overview`
|
|
137
105
|
});
|
|
138
106
|
}
|
|
139
|
-
|
|
140
107
|
return /*#__PURE__*/_react().default.createElement("div", {
|
|
141
108
|
className: _aspectPageModule().default.aspectPage
|
|
142
109
|
}, /*#__PURE__*/_react().default.createElement("div", null, /*#__PURE__*/_react().default.createElement(_documenterUi().H1, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["GET_COMPONENT","gql","AspectPage","component","useContext","ComponentContext","data","useDataQuery","variables","id","toString","aspectList","getHost","get","aspects","length","styles","aspectPage","title","separator","map","aspect","aspectBox","icon","config"],"sources":["aspect-page.tsx"],"sourcesContent":["import { AspectBox } from '@teambit/harmony.ui.aspect-box';\nimport { ComponentContext } from '@teambit/component';\nimport React, { useContext } from 'react';\nimport { useDataQuery } from '@teambit/ui-foundation.ui.hooks.use-data-query';\nimport { gql } from '@apollo/client';\nimport { EmptyBox } from '@teambit/design.ui.empty-box';\nimport { H1 } from '@teambit/documenter.ui.heading';\nimport { Separator } from '@teambit/documenter.ui.separator';\nimport styles from './aspect-page.module.scss';\n\nconst GET_COMPONENT = gql`\n query ($id: String!) {\n getHost {\n get(id: $id) {\n aspects {\n id\n config\n data\n icon\n }\n }\n }\n }\n`;\n\n// TODO: get the docs domain from the community aspect and pass it here as a prop\nexport function AspectPage() {\n const component = useContext(ComponentContext);\n const { data } = useDataQuery(GET_COMPONENT, {\n variables: { id: component.id.toString() },\n });\n const aspectList = data?.getHost?.get?.aspects;\n\n if (aspectList && aspectList.length === 0) {\n return (\n <EmptyBox\n title=\"This component is new and doesn’t have any aspects.\"\n linkText=\"Learn more about component aspects\"\n link={`https://bit.dev/docs/extending-bit/aspect-overview`}\n />\n );\n }\n\n return (\n <div className={styles.aspectPage}>\n <div>\n <H1 className={styles.title}>Configuration</H1>\n <Separator className={styles.separator} />\n {aspectList &&\n aspectList.map((aspect) => {\n return (\n <AspectBox\n key={aspect.id}\n className={styles.aspectBox}\n name={aspect.id}\n icon={aspect.icon}\n config={aspect.config}\n data={aspect.data}\n />\n );\n })}\n </div>\n </div>\n );\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["GET_COMPONENT","gql","AspectPage","component","useContext","ComponentContext","data","useDataQuery","variables","id","toString","aspectList","getHost","get","aspects","length","styles","aspectPage","title","separator","map","aspect","aspectBox","icon","config"],"sources":["aspect-page.tsx"],"sourcesContent":["import { AspectBox } from '@teambit/harmony.ui.aspect-box';\nimport { ComponentContext } from '@teambit/component';\nimport React, { useContext } from 'react';\nimport { useDataQuery } from '@teambit/ui-foundation.ui.hooks.use-data-query';\nimport { gql } from '@apollo/client';\nimport { EmptyBox } from '@teambit/design.ui.empty-box';\nimport { H1 } from '@teambit/documenter.ui.heading';\nimport { Separator } from '@teambit/documenter.ui.separator';\nimport styles from './aspect-page.module.scss';\n\nconst GET_COMPONENT = gql`\n query ($id: String!) {\n getHost {\n get(id: $id) {\n aspects {\n id\n config\n data\n icon\n }\n }\n }\n }\n`;\n\n// TODO: get the docs domain from the community aspect and pass it here as a prop\nexport function AspectPage() {\n const component = useContext(ComponentContext);\n const { data } = useDataQuery(GET_COMPONENT, {\n variables: { id: component.id.toString() },\n });\n const aspectList = data?.getHost?.get?.aspects;\n\n if (aspectList && aspectList.length === 0) {\n return (\n <EmptyBox\n title=\"This component is new and doesn’t have any aspects.\"\n linkText=\"Learn more about component aspects\"\n link={`https://bit.dev/docs/extending-bit/aspect-overview`}\n />\n );\n }\n\n return (\n <div className={styles.aspectPage}>\n <div>\n <H1 className={styles.title}>Configuration</H1>\n <Separator className={styles.separator} />\n {aspectList &&\n aspectList.map((aspect) => {\n return (\n <AspectBox\n key={aspect.id}\n className={styles.aspectBox}\n name={aspect.id}\n icon={aspect.icon}\n config={aspect.config}\n data={aspect.data}\n />\n );\n })}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAA+C;AAAA;AAE/C,MAAMA,aAAa,GAAG,IAAAC,aAAG,CAAC;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACO,SAASC,UAAU,GAAG;EAAA;EAC3B,MAAMC,SAAS,GAAG,IAAAC,mBAAU,EAACC,6BAAgB,CAAC;EAC9C,MAAM;IAAEC;EAAK,CAAC,GAAG,IAAAC,mCAAY,EAACP,aAAa,EAAE;IAC3CQ,SAAS,EAAE;MAAEC,EAAE,EAAEN,SAAS,CAACM,EAAE,CAACC,QAAQ;IAAG;EAC3C,CAAC,CAAC;EACF,MAAMC,UAAU,GAAGL,IAAI,aAAJA,IAAI,wCAAJA,IAAI,CAAEM,OAAO,uEAAb,cAAeC,GAAG,sDAAlB,kBAAoBC,OAAO;EAE9C,IAAIH,UAAU,IAAIA,UAAU,CAACI,MAAM,KAAK,CAAC,EAAE;IACzC,oBACE,+BAAC,oBAAQ;MACP,KAAK,EAAC,0DAAqD;MAC3D,QAAQ,EAAC,oCAAoC;MAC7C,IAAI,EAAG;IAAoD,EAC3D;EAEN;EAEA,oBACE;IAAK,SAAS,EAAEC,2BAAM,CAACC;EAAW,gBAChC,yDACE,+BAAC,kBAAE;IAAC,SAAS,EAAED,2BAAM,CAACE;EAAM,mBAAmB,eAC/C,+BAAC,0BAAS;IAAC,SAAS,EAAEF,2BAAM,CAACG;EAAU,EAAG,EACzCR,UAAU,IACTA,UAAU,CAACS,GAAG,CAAEC,MAAM,IAAK;IACzB,oBACE,+BAAC,sBAAS;MACR,GAAG,EAAEA,MAAM,CAACZ,EAAG;MACf,SAAS,EAAEO,2BAAM,CAACM,SAAU;MAC5B,IAAI,EAAED,MAAM,CAACZ,EAAG;MAChB,IAAI,EAAEY,MAAM,CAACE,IAAK;MAClB,MAAM,EAAEF,MAAM,CAACG,MAAO;MACtB,IAAI,EAAEH,MAAM,CAACf;IAAK,EAClB;EAEN,CAAC,CAAC,CACA,CACF;AAEV"}
|
|
@@ -9,14 +9,11 @@ Object.defineProperty(exports, "AspectPage", {
|
|
|
9
9
|
return _aspectPage().AspectPage;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
|
|
13
12
|
function _aspectPage() {
|
|
14
13
|
const data = require("./aspect-page");
|
|
15
|
-
|
|
16
14
|
_aspectPage = function () {
|
|
17
15
|
return data;
|
|
18
16
|
};
|
|
19
|
-
|
|
20
17
|
return data;
|
|
21
18
|
}
|
|
22
19
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { AspectPage } from './aspect-page';\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { AspectPage } from './aspect-page';\n"],"mappings":";;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA"}
|
|
@@ -1,42 +1,31 @@
|
|
|
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.ComponentError = void 0;
|
|
9
|
-
|
|
10
8
|
function _react() {
|
|
11
9
|
const data = _interopRequireDefault(require("react"));
|
|
12
|
-
|
|
13
10
|
_react = function () {
|
|
14
11
|
return data;
|
|
15
12
|
};
|
|
16
|
-
|
|
17
13
|
return data;
|
|
18
14
|
}
|
|
19
|
-
|
|
20
15
|
function _designUiPages() {
|
|
21
16
|
const data = require("@teambit/design.ui.pages.not-found");
|
|
22
|
-
|
|
23
17
|
_designUiPages = function () {
|
|
24
18
|
return data;
|
|
25
19
|
};
|
|
26
|
-
|
|
27
20
|
return data;
|
|
28
21
|
}
|
|
29
|
-
|
|
30
22
|
function _designUiPages2() {
|
|
31
23
|
const data = require("@teambit/design.ui.pages.server-error");
|
|
32
|
-
|
|
33
24
|
_designUiPages2 = function () {
|
|
34
25
|
return data;
|
|
35
26
|
};
|
|
36
|
-
|
|
37
27
|
return data;
|
|
38
28
|
}
|
|
39
|
-
|
|
40
29
|
class ComponentError {
|
|
41
30
|
constructor(
|
|
42
31
|
/**
|
|
@@ -50,14 +39,11 @@ class ComponentError {
|
|
|
50
39
|
this.code = code;
|
|
51
40
|
this.message = message;
|
|
52
41
|
}
|
|
53
|
-
|
|
54
42
|
renderError() {
|
|
55
43
|
if (this.code === 404) return /*#__PURE__*/_react().default.createElement(_designUiPages().NotFoundPage, null);
|
|
56
44
|
return /*#__PURE__*/_react().default.createElement(_designUiPages2().ServerErrorPage, null);
|
|
57
45
|
}
|
|
58
|
-
|
|
59
46
|
}
|
|
60
|
-
|
|
61
47
|
exports.ComponentError = ComponentError;
|
|
62
48
|
|
|
63
49
|
//# sourceMappingURL=component-error.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ComponentError","constructor","code","message","renderError"],"sources":["component-error.tsx"],"sourcesContent":["import React from 'react';\nimport { NotFoundPage } from '@teambit/design.ui.pages.not-found';\nimport { ServerErrorPage } from '@teambit/design.ui.pages.server-error';\n\nexport class ComponentError {\n constructor(\n /**\n * http status code of error\n */\n public readonly code: number,\n\n /**\n * error message of the error\n */\n public readonly message?: string\n ) {}\n\n renderError() {\n if (this.code === 404) return <NotFoundPage />;\n return <ServerErrorPage />;\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["ComponentError","constructor","code","message","renderError"],"sources":["component-error.tsx"],"sourcesContent":["import React from 'react';\nimport { NotFoundPage } from '@teambit/design.ui.pages.not-found';\nimport { ServerErrorPage } from '@teambit/design.ui.pages.server-error';\n\nexport class ComponentError {\n constructor(\n /**\n * http status code of error\n */\n public readonly code: number,\n\n /**\n * error message of the error\n */\n public readonly message?: string\n ) {}\n\n renderError() {\n if (this.code === 404) return <NotFoundPage />;\n return <ServerErrorPage />;\n }\n}\n"],"mappings":";;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,cAAc,CAAC;EAC1BC,WAAW;EACT;AACJ;AACA;EACoBC,IAAY;EAE5B;AACJ;AACA;EACoBC,OAAgB,EAChC;IAAA,KANgBD,IAAY,GAAZA,IAAY;IAAA,KAKZC,OAAgB,GAAhBA,OAAgB;EAC/B;EAEHC,WAAW,GAAG;IACZ,IAAI,IAAI,CAACF,IAAI,KAAK,GAAG,EAAE,oBAAO,+BAAC,6BAAY,OAAG;IAC9C,oBAAO,+BAAC,iCAAe,OAAG;EAC5B;AACF;AAAC"}
|
|
@@ -9,14 +9,11 @@ Object.defineProperty(exports, "ComponentError", {
|
|
|
9
9
|
return _componentError().ComponentError;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
|
|
13
12
|
function _componentError() {
|
|
14
13
|
const data = require("./component-error");
|
|
15
|
-
|
|
16
14
|
_componentError = function () {
|
|
17
15
|
return data;
|
|
18
16
|
};
|
|
19
|
-
|
|
20
17
|
return data;
|
|
21
18
|
}
|
|
22
19
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { ComponentError } from './component-error';\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { ComponentError } from './component-error';\n"],"mappings":";;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA"}
|