@teambit/diagnostic 1.0.106 → 1.0.108
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/diagnostic.aspect.ts +5 -0
- package/diagnostic.graphql.ts +22 -0
- package/diagnostic.main.runtime.ts +58 -0
- package/diagnostic.route.ts +17 -0
- package/diagnostic.ts +5 -0
- package/dist/diagnostic.d.ts +1 -1
- package/dist/diagnostic.main.runtime.d.ts +1 -1
- package/index.ts +5 -0
- package/package.json +12 -21
- package/tsconfig.json +16 -21
- package/types/asset.d.ts +15 -3
- /package/dist/{preview-1703505948637.js → preview-1703647408454.js} +0 -0
@@ -0,0 +1,22 @@
|
|
1
|
+
import { Schema } from '@teambit/graphql';
|
2
|
+
import { gql } from 'graphql-tag';
|
3
|
+
import { DiagnosticMain } from './diagnostic.main.runtime';
|
4
|
+
|
5
|
+
export class DiagnosticGraphql implements Schema {
|
6
|
+
constructor(private diagnosticMain: DiagnosticMain) {}
|
7
|
+
|
8
|
+
typeDefs = gql`
|
9
|
+
scalar JSONObject
|
10
|
+
|
11
|
+
type Query {
|
12
|
+
_diagnostic: JSONObject
|
13
|
+
}
|
14
|
+
`;
|
15
|
+
resolvers = {
|
16
|
+
Query: {
|
17
|
+
_diagnostic: () => {
|
18
|
+
return this.diagnosticMain.getDiagnosticData();
|
19
|
+
},
|
20
|
+
},
|
21
|
+
};
|
22
|
+
}
|
@@ -0,0 +1,58 @@
|
|
1
|
+
import { getHarmonyVersion } from '@teambit/legacy/dist/bootstrap';
|
2
|
+
|
3
|
+
import { Slot, SlotRegistry } from '@teambit/harmony';
|
4
|
+
import { MainRuntime } from '@teambit/cli';
|
5
|
+
import { ExpressAspect, ExpressMain } from '@teambit/express';
|
6
|
+
import GraphqlAspect, { GraphqlMain } from '@teambit/graphql';
|
7
|
+
import { DiagnosticAspect } from './diagnostic.aspect';
|
8
|
+
import { DiagnosticRoute } from './diagnostic.route';
|
9
|
+
import { DiagnosticGraphql } from './diagnostic.graphql';
|
10
|
+
import { Diagnostic } from './diagnostic';
|
11
|
+
|
12
|
+
export type DiagnosticSlot = SlotRegistry<Diagnostic[]>;
|
13
|
+
|
14
|
+
export class DiagnosticMain {
|
15
|
+
constructor(
|
16
|
+
/** the diagnostic entity slot */
|
17
|
+
private diagnosticSlot: DiagnosticSlot
|
18
|
+
) {}
|
19
|
+
static slots = [Slot.withType<Diagnostic[]>()];
|
20
|
+
static dependencies = [ExpressAspect, GraphqlAspect];
|
21
|
+
static runtime = MainRuntime;
|
22
|
+
|
23
|
+
register(...diagnostic: Diagnostic[]) {
|
24
|
+
this.diagnosticSlot.register(diagnostic);
|
25
|
+
}
|
26
|
+
|
27
|
+
getDiagnosticData() {
|
28
|
+
const slots = this.diagnosticSlot.toArray();
|
29
|
+
return slots.reduce((prev, cSlot) => {
|
30
|
+
const [aspectId, diagnostic] = cSlot;
|
31
|
+
prev[aspectId] = { reports: [] };
|
32
|
+
diagnostic.forEach((diag) => {
|
33
|
+
const { diagnosticFn } = diag;
|
34
|
+
prev[aspectId].reports.push(diagnosticFn());
|
35
|
+
});
|
36
|
+
return prev;
|
37
|
+
}, {});
|
38
|
+
}
|
39
|
+
|
40
|
+
static getBitVersion() {
|
41
|
+
const version = getHarmonyVersion(true);
|
42
|
+
return { version };
|
43
|
+
}
|
44
|
+
|
45
|
+
static async provider(
|
46
|
+
[express, graphql]: [ExpressMain, GraphqlMain],
|
47
|
+
config: any,
|
48
|
+
[diagnosticSlot]: [DiagnosticSlot]
|
49
|
+
) {
|
50
|
+
const diagnosticMain = new DiagnosticMain(diagnosticSlot);
|
51
|
+
diagnosticMain.register({ diagnosticFn: DiagnosticMain.getBitVersion });
|
52
|
+
express.register([new DiagnosticRoute(diagnosticMain)]);
|
53
|
+
graphql.register(new DiagnosticGraphql(diagnosticMain));
|
54
|
+
return diagnosticMain;
|
55
|
+
}
|
56
|
+
}
|
57
|
+
|
58
|
+
DiagnosticAspect.addRuntime(DiagnosticMain);
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import { Route, Verb, Request, Response } from '@teambit/express';
|
2
|
+
import type { DiagnosticMain } from './diagnostic.main.runtime';
|
3
|
+
|
4
|
+
export class DiagnosticRoute implements Route {
|
5
|
+
constructor(readonly diagnosticMain: DiagnosticMain) {}
|
6
|
+
|
7
|
+
method = 'GET';
|
8
|
+
route = '/_diagnostic';
|
9
|
+
verb = Verb.READ;
|
10
|
+
|
11
|
+
middlewares = [
|
12
|
+
async (req: Request, res: Response) => {
|
13
|
+
const diagnosticData = this.diagnosticMain.getDiagnosticData();
|
14
|
+
res.json(diagnosticData);
|
15
|
+
},
|
16
|
+
];
|
17
|
+
}
|
package/diagnostic.ts
ADDED
package/dist/diagnostic.d.ts
CHANGED
@@ -2,7 +2,7 @@ import { SlotRegistry } from '@teambit/harmony';
|
|
2
2
|
import { ExpressMain } from '@teambit/express';
|
3
3
|
import { GraphqlMain } from '@teambit/graphql';
|
4
4
|
import { Diagnostic } from './diagnostic';
|
5
|
-
export
|
5
|
+
export type DiagnosticSlot = SlotRegistry<Diagnostic[]>;
|
6
6
|
export declare class DiagnosticMain {
|
7
7
|
/** the diagnostic entity slot */
|
8
8
|
private diagnosticSlot;
|
package/index.ts
ADDED
package/package.json
CHANGED
@@ -1,34 +1,28 @@
|
|
1
1
|
{
|
2
2
|
"name": "@teambit/diagnostic",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.108",
|
4
4
|
"homepage": "https://bit.cloud/teambit/harmony/diagnostic",
|
5
5
|
"main": "dist/index.js",
|
6
6
|
"componentId": {
|
7
7
|
"scope": "teambit.harmony",
|
8
8
|
"name": "diagnostic",
|
9
|
-
"version": "1.0.
|
9
|
+
"version": "1.0.108"
|
10
10
|
},
|
11
11
|
"dependencies": {
|
12
12
|
"graphql-tag": "2.12.1",
|
13
|
-
"core-js": "^3.0.0",
|
14
|
-
"@babel/runtime": "7.20.0",
|
15
13
|
"@teambit/harmony": "0.4.6",
|
16
|
-
"@teambit/graphql": "1.0.
|
17
|
-
"@teambit/cli": "0.0.
|
18
|
-
"@teambit/express": "0.0.
|
14
|
+
"@teambit/graphql": "1.0.108",
|
15
|
+
"@teambit/cli": "0.0.840",
|
16
|
+
"@teambit/express": "0.0.939"
|
19
17
|
},
|
20
18
|
"devDependencies": {
|
21
19
|
"@types/mocha": "9.1.0",
|
22
|
-
"@types/
|
23
|
-
"@types/
|
24
|
-
"@
|
25
|
-
"@types/jest": "^26.0.0",
|
26
|
-
"@types/testing-library__jest-dom": "5.9.5"
|
20
|
+
"@types/jest": "^29.2.2",
|
21
|
+
"@types/testing-library__jest-dom": "^5.9.5",
|
22
|
+
"@teambit/harmony.envs.core-aspect-env": "0.0.13"
|
27
23
|
},
|
28
24
|
"peerDependencies": {
|
29
|
-
"@teambit/legacy": "1.0.624"
|
30
|
-
"react": "^16.8.0 || ^17.0.0",
|
31
|
-
"react-dom": "^16.8.0 || ^17.0.0"
|
25
|
+
"@teambit/legacy": "1.0.624"
|
32
26
|
},
|
33
27
|
"license": "Apache-2.0",
|
34
28
|
"optionalDependencies": {},
|
@@ -42,7 +36,7 @@
|
|
42
36
|
},
|
43
37
|
"private": false,
|
44
38
|
"engines": {
|
45
|
-
"node": ">=
|
39
|
+
"node": ">=16.0.0"
|
46
40
|
},
|
47
41
|
"repository": {
|
48
42
|
"type": "git",
|
@@ -51,12 +45,9 @@
|
|
51
45
|
"keywords": [
|
52
46
|
"bit",
|
53
47
|
"bit-aspect",
|
48
|
+
"bit-core-aspect",
|
54
49
|
"components",
|
55
50
|
"collaboration",
|
56
|
-
"web"
|
57
|
-
"react",
|
58
|
-
"react-components",
|
59
|
-
"angular",
|
60
|
-
"angular-components"
|
51
|
+
"web"
|
61
52
|
]
|
62
53
|
}
|
package/tsconfig.json
CHANGED
@@ -1,38 +1,33 @@
|
|
1
1
|
{
|
2
2
|
"compilerOptions": {
|
3
3
|
"lib": [
|
4
|
-
"
|
5
|
-
"
|
6
|
-
"
|
7
|
-
"DOM.Iterable",
|
8
|
-
"ScriptHost"
|
4
|
+
"esnext",
|
5
|
+
"dom",
|
6
|
+
"dom.Iterable"
|
9
7
|
],
|
10
|
-
"target": "
|
11
|
-
"module": "
|
12
|
-
"jsx": "react",
|
13
|
-
"allowJs": true,
|
14
|
-
"composite": true,
|
8
|
+
"target": "es2020",
|
9
|
+
"module": "es2020",
|
10
|
+
"jsx": "react-jsx",
|
15
11
|
"declaration": true,
|
16
12
|
"sourceMap": true,
|
17
|
-
"skipLibCheck": true,
|
18
13
|
"experimentalDecorators": true,
|
19
|
-
"
|
14
|
+
"skipLibCheck": true,
|
20
15
|
"moduleResolution": "node",
|
21
16
|
"esModuleInterop": true,
|
22
|
-
"rootDir": ".",
|
23
17
|
"resolveJsonModule": true,
|
24
|
-
"
|
25
|
-
"
|
26
|
-
"
|
27
|
-
"strictPropertyInitialization": false,
|
28
|
-
"strict": true,
|
29
|
-
"noImplicitAny": false,
|
30
|
-
"preserveConstEnums": true
|
18
|
+
"allowJs": true,
|
19
|
+
"outDir": "dist",
|
20
|
+
"emitDeclarationOnly": true
|
31
21
|
},
|
32
22
|
"exclude": [
|
23
|
+
"artifacts",
|
24
|
+
"public",
|
33
25
|
"dist",
|
26
|
+
"node_modules",
|
27
|
+
"package.json",
|
34
28
|
"esm.mjs",
|
35
|
-
"
|
29
|
+
"**/*.cjs",
|
30
|
+
"./dist"
|
36
31
|
],
|
37
32
|
"include": [
|
38
33
|
"**/*",
|
package/types/asset.d.ts
CHANGED
@@ -5,12 +5,12 @@ declare module '*.png' {
|
|
5
5
|
declare module '*.svg' {
|
6
6
|
import type { FunctionComponent, SVGProps } from 'react';
|
7
7
|
|
8
|
-
export const ReactComponent: FunctionComponent<
|
8
|
+
export const ReactComponent: FunctionComponent<
|
9
|
+
SVGProps<SVGSVGElement> & { title?: string }
|
10
|
+
>;
|
9
11
|
const src: string;
|
10
12
|
export default src;
|
11
13
|
}
|
12
|
-
|
13
|
-
// @TODO Gilad
|
14
14
|
declare module '*.jpg' {
|
15
15
|
const value: any;
|
16
16
|
export = value;
|
@@ -27,3 +27,15 @@ declare module '*.bmp' {
|
|
27
27
|
const value: any;
|
28
28
|
export = value;
|
29
29
|
}
|
30
|
+
declare module '*.otf' {
|
31
|
+
const value: any;
|
32
|
+
export = value;
|
33
|
+
}
|
34
|
+
declare module '*.woff' {
|
35
|
+
const value: any;
|
36
|
+
export = value;
|
37
|
+
}
|
38
|
+
declare module '*.woff2' {
|
39
|
+
const value: any;
|
40
|
+
export = value;
|
41
|
+
}
|
File without changes
|