@@ -22,23 +22,26 @@ try {
22
22
}
23
23
24
24
async function applyServer ( ctx : Context ) {
25
- ctx . plugin ( await import ( './service/server' ) ) ;
26
- ctx . plugin ( ( await import ( './service/db' ) ) . default ) ;
25
+ ctx . plugin ( require ( './service/server' ) ) ;
26
+ ctx . plugin ( ( require ( './service/db' ) ) . default ) ;
27
27
if ( config . type !== 'server' ) {
28
28
logger . info ( 'Fetch mode: ' , config . type ) ;
29
- ctx . plugin ( await import ( './service/fetcher' ) ) ;
29
+ ctx . plugin ( require ( './service/fetcher' ) ) ;
30
30
}
31
- ctx . plugin ( await import ( './handler/misc' ) ) ;
32
- ctx . plugin ( await import ( './handler/printer' ) ) ;
33
- ctx . plugin ( await import ( './handler/monitor' ) ) ;
34
- ctx . plugin ( await import ( './handler/client' ) ) ;
35
- ctx . plugin ( await import ( './handler/balloon' ) ) ;
36
- ctx . plugin ( await import ( './handler/commands' ) ) ;
31
+ ctx . plugin ( require ( './handler/misc' ) ) ;
32
+ ctx . plugin ( require ( './handler/printer' ) ) ;
33
+ ctx . plugin ( require ( './handler/monitor' ) ) ;
34
+ ctx . plugin ( require ( './handler/client' ) ) ;
35
+ ctx . plugin ( require ( './handler/balloon' ) ) ;
36
+ ctx . plugin ( require ( './handler/commands' ) ) ;
37
+ ctx . inject ( [ 'server' ] , ( c ) => {
38
+ c . server . listen ( ) ;
39
+ } ) ;
37
40
}
38
41
39
42
async function applyClient ( ctx : Context ) {
40
- if ( config . printers ?. length ) ctx . plugin ( await import ( './client/printer' ) ) ;
41
- if ( config . balloon ) ctx . plugin ( await import ( './client/balloon' ) ) ;
43
+ if ( config . printers ?. length ) ctx . plugin ( require ( './client/printer' ) ) ;
44
+ if ( config . balloon ) ctx . plugin ( require ( './client/balloon' ) ) ;
42
45
}
43
46
44
47
async function apply ( ctx ) {
@@ -48,9 +51,9 @@ async function apply(ctx) {
48
51
await applyServer ( ctx ) ;
49
52
}
50
53
await ctx . lifecycle . flush ( ) ;
51
- await ctx . parallel ( 'app/started' ) ;
52
- process . send ?.( 'ready' ) ;
54
+ await ctx . parallel ( 'app/listen' ) ;
53
55
logger . success ( 'Server started' ) ;
56
+ process . send ?.( 'ready' ) ;
54
57
await ctx . parallel ( 'app/ready' ) ;
55
58
}
56
59
0 commit comments