@teambit/ipc-events 1.0.228 → 1.0.229

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.
@@ -1,4 +1,4 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <testsuites tests="0" failures="0" errors="0" skipped="0">
3
- <testsuite name="teambit.harmony/ipc-events@1.0.228" tests="0" failures="0" errors="0" skipped="0"/>
3
+ <testsuite name="teambit.harmony/ipc-events@1.0.229" tests="0" failures="0" errors="0" skipped="0"/>
4
4
  </testsuites>
@@ -58,7 +58,11 @@
58
58
  "line": 33,
59
59
  "character": 30
60
60
  },
61
- "name": "ScopeMain"
61
+ "name": "ScopeMain",
62
+ "componentId": {
63
+ "scope": "teambit.scope",
64
+ "name": "scope"
65
+ }
62
66
  },
63
67
  "isOptional": false,
64
68
  "isSpread": false
@@ -78,7 +82,8 @@
78
82
  "line": 33,
79
83
  "character": 63
80
84
  },
81
- "name": "GotEventSlot"
85
+ "name": "GotEventSlot",
86
+ "internalFilePath": "ipc-events.main.runtime.ts"
82
87
  },
83
88
  "isOptional": false,
84
89
  "isSpread": false
@@ -98,7 +103,11 @@
98
103
  "line": 33,
99
104
  "character": 93
100
105
  },
101
- "name": "Logger"
106
+ "name": "Logger",
107
+ "componentId": {
108
+ "scope": "teambit.harmony",
109
+ "name": "logger"
110
+ }
102
111
  },
103
112
  "isOptional": false,
104
113
  "isSpread": false
@@ -140,7 +149,8 @@
140
149
  "line": 35,
141
150
  "character": 28
142
151
  },
143
- "name": "GotEvent"
152
+ "name": "GotEvent",
153
+ "internalFilePath": "ipc-events.main.runtime.ts"
144
154
  },
145
155
  "isOptional": false,
146
156
  "isSpread": false
@@ -192,7 +202,8 @@
192
202
  "line": 43,
193
203
  "character": 36
194
204
  },
195
- "name": "EventName"
205
+ "name": "EventName",
206
+ "internalFilePath": "ipc-events.main.runtime.ts"
196
207
  },
197
208
  "isOptional": false,
198
209
  "isSpread": false
@@ -246,7 +257,8 @@
246
257
  "line": 52,
247
258
  "character": 36
248
259
  },
249
- "name": "EventName"
260
+ "name": "EventName",
261
+ "internalFilePath": "ipc-events.main.runtime.ts"
250
262
  },
251
263
  "isOptional": false,
252
264
  "isSpread": false
@@ -420,7 +432,11 @@
420
432
  "line": 66,
421
433
  "character": 47
422
434
  },
423
- "name": "ScopeMain"
435
+ "name": "ScopeMain",
436
+ "componentId": {
437
+ "scope": "teambit.scope",
438
+ "name": "scope"
439
+ }
424
440
  },
425
441
  {
426
442
  "__schema": "TypeRefSchema",
@@ -429,7 +445,11 @@
429
445
  "line": 66,
430
446
  "character": 58
431
447
  },
432
- "name": "LoggerMain"
448
+ "name": "LoggerMain",
449
+ "componentId": {
450
+ "scope": "teambit.harmony",
451
+ "name": "logger"
452
+ }
433
453
  }
434
454
  ]
435
455
  },
@@ -479,7 +499,8 @@
479
499
  "line": 66,
480
500
  "character": 91
481
501
  },
482
- "name": "GotEventSlot"
502
+ "name": "GotEventSlot",
503
+ "internalFilePath": "ipc-events.main.runtime.ts"
483
504
  }
484
505
  ]
485
506
  },
@@ -598,7 +619,11 @@
598
619
  "line": 33,
599
620
  "character": 30
600
621
  },
601
- "name": "ScopeMain"
622
+ "name": "ScopeMain",
623
+ "componentId": {
624
+ "scope": "teambit.scope",
625
+ "name": "scope"
626
+ }
602
627
  },
603
628
  "isOptional": false,
604
629
  "isSpread": false
@@ -618,7 +643,8 @@
618
643
  "line": 33,
619
644
  "character": 63
620
645
  },
621
- "name": "GotEventSlot"
646
+ "name": "GotEventSlot",
647
+ "internalFilePath": "ipc-events.main.runtime.ts"
622
648
  },
623
649
  "isOptional": false,
624
650
  "isSpread": false
@@ -638,7 +664,11 @@
638
664
  "line": 33,
639
665
  "character": 93
640
666
  },
641
- "name": "Logger"
667
+ "name": "Logger",
668
+ "componentId": {
669
+ "scope": "teambit.harmony",
670
+ "name": "logger"
671
+ }
642
672
  },
643
673
  "isOptional": false,
644
674
  "isSpread": false
@@ -680,7 +710,8 @@
680
710
  "line": 35,
681
711
  "character": 28
682
712
  },
683
- "name": "GotEvent"
713
+ "name": "GotEvent",
714
+ "internalFilePath": "ipc-events.main.runtime.ts"
684
715
  },
685
716
  "isOptional": false,
686
717
  "isSpread": false
@@ -732,7 +763,8 @@
732
763
  "line": 43,
733
764
  "character": 36
734
765
  },
735
- "name": "EventName"
766
+ "name": "EventName",
767
+ "internalFilePath": "ipc-events.main.runtime.ts"
736
768
  },
737
769
  "isOptional": false,
738
770
  "isSpread": false
@@ -786,7 +818,8 @@
786
818
  "line": 52,
787
819
  "character": 36
788
820
  },
789
- "name": "EventName"
821
+ "name": "EventName",
822
+ "internalFilePath": "ipc-events.main.runtime.ts"
790
823
  },
791
824
  "isOptional": false,
792
825
  "isSpread": false
@@ -960,7 +993,11 @@
960
993
  "line": 66,
961
994
  "character": 47
962
995
  },
963
- "name": "ScopeMain"
996
+ "name": "ScopeMain",
997
+ "componentId": {
998
+ "scope": "teambit.scope",
999
+ "name": "scope"
1000
+ }
964
1001
  },
965
1002
  {
966
1003
  "__schema": "TypeRefSchema",
@@ -969,7 +1006,11 @@
969
1006
  "line": 66,
970
1007
  "character": 58
971
1008
  },
972
- "name": "LoggerMain"
1009
+ "name": "LoggerMain",
1010
+ "componentId": {
1011
+ "scope": "teambit.harmony",
1012
+ "name": "logger"
1013
+ }
973
1014
  }
974
1015
  ]
975
1016
  },
@@ -1019,7 +1060,8 @@
1019
1060
  "line": 66,
1020
1061
  "character": 91
1021
1062
  },
1022
- "name": "GotEventSlot"
1063
+ "name": "GotEventSlot",
1064
+ "internalFilePath": "ipc-events.main.runtime.ts"
1023
1065
  }
1024
1066
  ]
1025
1067
  },
@@ -1129,7 +1171,8 @@
1129
1171
  "line": 12,
1130
1172
  "character": 29
1131
1173
  },
1132
- "name": "EventName"
1174
+ "name": "EventName",
1175
+ "internalFilePath": "ipc-events.main.runtime.ts"
1133
1176
  },
1134
1177
  "isOptional": false,
1135
1178
  "isSpread": false
@@ -1175,6 +1218,11 @@
1175
1218
  "character": 21
1176
1219
  },
1177
1220
  "name": "SlotRegistry",
1221
+ "componentId": {
1222
+ "scope": "teambit.harmony",
1223
+ "name": "harmony",
1224
+ "version": "0.4.6"
1225
+ },
1178
1226
  "typeArgs": [
1179
1227
  {
1180
1228
  "__schema": "TypeRefSchema",
@@ -1183,7 +1231,8 @@
1183
1231
  "line": 13,
1184
1232
  "character": 34
1185
1233
  },
1186
- "name": "GotEvent"
1234
+ "name": "GotEvent",
1235
+ "internalFilePath": "ipc-events.main.runtime.ts"
1187
1236
  }
1188
1237
  ]
1189
1238
  }
@@ -1273,7 +1322,7 @@
1273
1322
  "componentId": {
1274
1323
  "scope": "teambit.harmony",
1275
1324
  "name": "ipc-events",
1276
- "version": "1.0.228"
1325
+ "version": "1.0.229"
1277
1326
  },
1278
1327
  "taggedModuleExports": []
1279
1328
  }
@@ -0,0 +1,4 @@
1
+ import { IpcEventsAspect } from './ipc-events.aspect';
2
+ export type { IpcEventsMain } from './ipc-events.main.runtime';
3
+ export default IpcEventsAspect;
4
+ export { IpcEventsAspect };
@@ -0,0 +1,2 @@
1
+ import { Aspect } from '@teambit/harmony';
2
+ export declare const IpcEventsAspect: Aspect;
@@ -0,0 +1,44 @@
1
+ import { ScopeMain } from '@teambit/scope';
2
+ import { SlotRegistry } from '@teambit/harmony';
3
+ import { Logger, LoggerMain } from '@teambit/logger';
4
+ type EventName = 'onPostInstall' | 'onPostObjectsPersist';
5
+ type GotEvent = (eventName: EventName) => Promise<void>;
6
+ type GotEventSlot = SlotRegistry<GotEvent>;
7
+ /**
8
+ * imagine you have multiple processes running in the background, such as `bit watch`, `bit start`, `bit server`.
9
+ * the user is running `bit install` from the cli, how do you let these processes know that the installation is complete?
10
+ * `bit start` for instance could use ths info to clear the "component issues" of the components that were missing packages.
11
+ *
12
+ * this class provides a mechanism to achieve this by writing the event into the filesystem (`.bit/events/event-name`),
13
+ * while each one of the processes has a watcher in the background watch this file. once they got the data from the watcher,
14
+ * they can act upon it.
15
+ *
16
+ * in the previous example, when the user is running `bit install`, the install aspect runs `this.publishIpcEvent` to
17
+ * write `.bit/events/onPostInstall` to the filesystem. then, the watcher of `bit start` process got a notification
18
+ * that this file has changed/added and it runs `triggerGotEvent` to run all aspects registered to its gotEventSlot.
19
+ * the installer in turn is registered to this slot and once its function is triggered, it check whether the eventName
20
+ * is onPostInstall and then triggers its own OnPostInstall slot.
21
+ */
22
+ export declare class IpcEventsMain {
23
+ private scope;
24
+ private gotEventSlot;
25
+ private logger;
26
+ constructor(scope: ScopeMain, gotEventSlot: GotEventSlot, logger: Logger);
27
+ registerGotEventSlot(fn: GotEvent): void;
28
+ /**
29
+ * this gets called from the watcher only.
30
+ * as soon as the watcher finds out that a new event has been written to the filesystem, it triggers this function
31
+ */
32
+ triggerGotEvent(eventName: EventName): Promise<void>;
33
+ /**
34
+ * write event data into the filesystem, so then other processes, such as "bit start", "bit watch", could use the
35
+ * watcher to get the event data.
36
+ */
37
+ publishIpcEvent(eventName: EventName, data?: Record<string, any>): Promise<void>;
38
+ get eventsDir(): string;
39
+ static slots: ((registerFn: () => string) => SlotRegistry<GotEventSlot>)[];
40
+ static dependencies: import("@teambit/harmony").Aspect[];
41
+ static runtime: import("@teambit/harmony").RuntimeDefinition;
42
+ static provider([scope, loggerMain]: [ScopeMain, LoggerMain], _: any, [gotEventSlot]: [GotEventSlot]): Promise<IpcEventsMain>;
43
+ }
44
+ export default IpcEventsMain;
package/package.json CHANGED
@@ -1,26 +1,26 @@
1
1
  {
2
2
  "name": "@teambit/ipc-events",
3
- "version": "1.0.228",
3
+ "version": "1.0.229",
4
4
  "homepage": "https://bit.cloud/teambit/harmony/ipc-events",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.harmony",
8
8
  "name": "ipc-events",
9
- "version": "1.0.228"
9
+ "version": "1.0.229"
10
10
  },
11
11
  "dependencies": {
12
12
  "fs-extra": "10.0.0",
13
13
  "p-map-series": "2.1.0",
14
14
  "@teambit/harmony": "0.4.6",
15
- "@teambit/cli": "0.0.861",
16
- "@teambit/logger": "0.0.954",
17
- "@teambit/scope": "1.0.228"
15
+ "@teambit/cli": "0.0.862",
16
+ "@teambit/logger": "0.0.955",
17
+ "@teambit/scope": "1.0.229"
18
18
  },
19
19
  "devDependencies": {
20
20
  "@types/fs-extra": "9.0.7",
21
21
  "@types/mocha": "9.1.0",
22
22
  "chai": "4.3.0",
23
- "@teambit/harmony.envs.core-aspect-env": "0.0.30"
23
+ "@teambit/harmony.envs.core-aspect-env": "0.0.33"
24
24
  },
25
25
  "peerDependencies": {
26
26
  "@teambit/legacy": "1.0.624"
package/tsconfig.json CHANGED
@@ -20,8 +20,7 @@
20
20
  "emitDeclarationOnly": true,
21
21
  "strict": true,
22
22
  "strictPropertyInitialization": false,
23
- "noImplicitAny": false,
24
- "composite": true
23
+ "noImplicitAny": false
25
24
  },
26
25
  "exclude": [
27
26
  "artifacts",
@@ -36,16 +35,5 @@
36
35
  "include": [
37
36
  "**/*",
38
37
  "**/*.json"
39
- ],
40
- "references": [
41
- {
42
- "path": "/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_cli@0.0.861"
43
- },
44
- {
45
- "path": "/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_logger@0.0.954"
46
- },
47
- {
48
- "path": "/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.scope_scope@1.0.228"
49
- }
50
38
  ]
51
39
  }