@teambit/diagnostic 1.0.108 → 1.0.110

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.
@@ -0,0 +1 @@
1
+ !function(e,o){"object"==typeof exports&&"object"==typeof module?module.exports=o():"function"==typeof define&&define.amd?define([],o):"object"==typeof exports?exports["teambit.harmony/diagnostic-preview"]=o():e["teambit.harmony/diagnostic-preview"]=o()}(self,(()=>(()=>{"use strict";var e={d:(o,t)=>{for(var r in t)e.o(t,r)&&!e.o(o,r)&&Object.defineProperty(o,r,{enumerable:!0,get:t[r]})},o:(e,o)=>Object.prototype.hasOwnProperty.call(e,o),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},o={};e.r(o),e.d(o,{compositions:()=>t,compositions_metadata:()=>i,overview:()=>r});const t=[],r=[],i={compositions:[]};return o})()));
package/package.json CHANGED
@@ -1,25 +1,25 @@
1
1
  {
2
2
  "name": "@teambit/diagnostic",
3
- "version": "1.0.108",
3
+ "version": "1.0.110",
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.108"
9
+ "version": "1.0.110"
10
10
  },
11
11
  "dependencies": {
12
12
  "graphql-tag": "2.12.1",
13
13
  "@teambit/harmony": "0.4.6",
14
- "@teambit/graphql": "1.0.108",
15
- "@teambit/cli": "0.0.840",
16
- "@teambit/express": "0.0.939"
14
+ "@teambit/graphql": "1.0.110",
15
+ "@teambit/cli": "0.0.842",
16
+ "@teambit/express": "0.0.941"
17
17
  },
18
18
  "devDependencies": {
19
19
  "@types/mocha": "9.1.0",
20
20
  "@types/jest": "^29.2.2",
21
21
  "@types/testing-library__jest-dom": "^5.9.5",
22
- "@teambit/harmony.envs.core-aspect-env": "0.0.13"
22
+ "@teambit/harmony.envs.core-aspect-env": "0.0.15"
23
23
  },
24
24
  "peerDependencies": {
25
25
  "@teambit/legacy": "1.0.624"
@@ -28,11 +28,15 @@
28
28
  "optionalDependencies": {},
29
29
  "peerDependenciesMeta": {},
30
30
  "exports": {
31
- "node": {
32
- "require": "./dist/index.js",
33
- "import": "./dist/esm.mjs"
31
+ ".": {
32
+ "node": {
33
+ "require": "./dist/index.js",
34
+ "import": "./dist/esm.mjs"
35
+ },
36
+ "default": "./dist/index.js"
34
37
  },
35
- "default": "./dist/index.js"
38
+ "./dist/*": "./dist/*",
39
+ "./artifacts/*": "./artifacts/*"
36
40
  },
37
41
  "private": false,
38
42
  "engines": {
@@ -1,5 +0,0 @@
1
- import { Aspect } from '@teambit/harmony';
2
-
3
- export const DiagnosticAspect = Aspect.create({
4
- id: 'teambit.harmony/diagnostic',
5
- });
@@ -1,22 +0,0 @@
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
- }
@@ -1,58 +0,0 @@
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);
@@ -1,17 +0,0 @@
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 DELETED
@@ -1,5 +0,0 @@
1
- export type DiagnosticFc = () => Object;
2
-
3
- export interface Diagnostic {
4
- diagnosticFn: DiagnosticFc;
5
- }
package/index.ts DELETED
@@ -1,5 +0,0 @@
1
- import { DiagnosticAspect } from './diagnostic.aspect';
2
-
3
- export type { DiagnosticMain } from './diagnostic.main.runtime';
4
- export default DiagnosticAspect;
5
- export { DiagnosticAspect };