@midwayjs/core 3.19.0-beta.1 → 3.19.0-beta.2
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.
|
@@ -16,7 +16,6 @@ export declare class MidwayPerformanceManager {
|
|
|
16
16
|
markEnd(key: string): void;
|
|
17
17
|
observeMeasure(callback: (list: PerformanceObserverEntryList) => void): PerformanceObserver;
|
|
18
18
|
disconnect(): void;
|
|
19
|
-
getGroup(): string;
|
|
20
19
|
clean(): void;
|
|
21
20
|
static cleanAll(): void;
|
|
22
21
|
}
|
|
@@ -29,7 +28,8 @@ export declare class MidwayInitializerPerformanceManager {
|
|
|
29
28
|
CONFIG_LOAD: string;
|
|
30
29
|
LOGGER_PREPARE: string;
|
|
31
30
|
FRAMEWORK_PREPARE: string;
|
|
32
|
-
|
|
31
|
+
CUSTOM_FRAMEWORK_INITIALIZE: string;
|
|
32
|
+
CUSTOM_FRAMEWORK_RUN: string;
|
|
33
33
|
LIFECYCLE_PREPARE: string;
|
|
34
34
|
CUSTOM_LIFECYCLE_PREPARE: string;
|
|
35
35
|
PRELOAD_MODULE_PREPARE: string;
|
|
@@ -38,6 +38,8 @@ export declare class MidwayInitializerPerformanceManager {
|
|
|
38
38
|
static markEnd(key: string): void;
|
|
39
39
|
static frameworkInitializeStart(frameworkName: string): void;
|
|
40
40
|
static frameworkInitializeEnd(frameworkName: string): void;
|
|
41
|
+
static frameworkRunStart(frameworkName: string): void;
|
|
42
|
+
static frameworkRunEnd(frameworkName: string): void;
|
|
41
43
|
static lifecycleStart(namespace: string, lifecycleName: string): void;
|
|
42
44
|
static lifecycleEnd(namespace: string, lifecycleName: string): void;
|
|
43
45
|
}
|
|
@@ -55,9 +55,6 @@ class MidwayPerformanceManager {
|
|
|
55
55
|
this.observer = null;
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
getGroup() {
|
|
59
|
-
return this.group;
|
|
60
|
-
}
|
|
61
58
|
clean() {
|
|
62
59
|
this.marks.forEach(mark => {
|
|
63
60
|
try {
|
|
@@ -99,10 +96,16 @@ class MidwayInitializerPerformanceManager {
|
|
|
99
96
|
manager.markEnd(key);
|
|
100
97
|
}
|
|
101
98
|
static frameworkInitializeStart(frameworkName) {
|
|
102
|
-
this.markStart(`${this.MEASURE_KEYS.
|
|
99
|
+
this.markStart(`${this.MEASURE_KEYS.CUSTOM_FRAMEWORK_INITIALIZE}:${frameworkName}`);
|
|
103
100
|
}
|
|
104
101
|
static frameworkInitializeEnd(frameworkName) {
|
|
105
|
-
this.markEnd(`${this.MEASURE_KEYS.
|
|
102
|
+
this.markEnd(`${this.MEASURE_KEYS.CUSTOM_FRAMEWORK_INITIALIZE}:${frameworkName}`);
|
|
103
|
+
}
|
|
104
|
+
static frameworkRunStart(frameworkName) {
|
|
105
|
+
this.markStart(`${this.MEASURE_KEYS.CUSTOM_FRAMEWORK_RUN}:${frameworkName}`);
|
|
106
|
+
}
|
|
107
|
+
static frameworkRunEnd(frameworkName) {
|
|
108
|
+
this.markEnd(`${this.MEASURE_KEYS.CUSTOM_FRAMEWORK_RUN}:${frameworkName}`);
|
|
106
109
|
}
|
|
107
110
|
static lifecycleStart(namespace, lifecycleName) {
|
|
108
111
|
this.markStart(`${this.MEASURE_KEYS.CUSTOM_LIFECYCLE_PREPARE}:${namespace}:${lifecycleName}`);
|
|
@@ -120,7 +123,8 @@ MidwayInitializerPerformanceManager.MEASURE_KEYS = {
|
|
|
120
123
|
CONFIG_LOAD: 'ConfigLoad',
|
|
121
124
|
LOGGER_PREPARE: 'LoggerPrepare',
|
|
122
125
|
FRAMEWORK_PREPARE: 'FrameworkPrepare',
|
|
123
|
-
|
|
126
|
+
CUSTOM_FRAMEWORK_INITIALIZE: 'CustomFrameworkInitialize',
|
|
127
|
+
CUSTOM_FRAMEWORK_RUN: 'CustomFrameworkRun',
|
|
124
128
|
LIFECYCLE_PREPARE: 'LifecyclePrepare',
|
|
125
129
|
CUSTOM_LIFECYCLE_PREPARE: 'CustomLifecyclePrepare',
|
|
126
130
|
PRELOAD_MODULE_PREPARE: 'PreloadModulePrepare',
|
|
@@ -159,9 +159,11 @@ let MidwayFrameworkService = class MidwayFrameworkService {
|
|
|
159
159
|
for (const frameworkInstance of this.globalFrameworkList) {
|
|
160
160
|
// if enable, just init framework
|
|
161
161
|
if (frameworkInstance.isEnable()) {
|
|
162
|
+
performanceManager_1.MidwayInitializerPerformanceManager.frameworkRunStart(frameworkInstance.getFrameworkName());
|
|
162
163
|
// app init
|
|
163
164
|
await frameworkInstance.run();
|
|
164
165
|
debug(`[core]: Found Framework "${frameworkInstance.getFrameworkName()}" and run.`);
|
|
166
|
+
performanceManager_1.MidwayInitializerPerformanceManager.frameworkRunEnd(frameworkInstance.getFrameworkName());
|
|
165
167
|
}
|
|
166
168
|
}
|
|
167
169
|
}
|
|
@@ -101,20 +101,25 @@ let MidwayLifeCycleService = class MidwayLifeCycleService {
|
|
|
101
101
|
for (const cycle of lifecycleInstanceOrList) {
|
|
102
102
|
if (typeof cycle.instance[lifecycle] === 'function') {
|
|
103
103
|
debug(`[core]: Lifecycle run ${cycle.instance.constructor.name} ${lifecycle}`);
|
|
104
|
+
performanceManager_1.MidwayInitializerPerformanceManager.lifecycleStart(cycle.namespace, lifecycle);
|
|
104
105
|
const result = await cycle.instance[lifecycle](this.applicationContext, this.frameworkService.getMainApp());
|
|
105
106
|
if (resultHandler) {
|
|
106
107
|
resultHandler(result);
|
|
107
108
|
}
|
|
109
|
+
performanceManager_1.MidwayInitializerPerformanceManager.lifecycleEnd(cycle.namespace, lifecycle);
|
|
108
110
|
}
|
|
109
111
|
}
|
|
110
112
|
}
|
|
111
113
|
else {
|
|
112
114
|
if (typeof lifecycleInstanceOrList[lifecycle] === 'function') {
|
|
113
|
-
|
|
115
|
+
const name = lifecycleInstanceOrList.constructor.name;
|
|
116
|
+
debug(`[core]: Lifecycle run ${name} ${lifecycle}`);
|
|
117
|
+
performanceManager_1.MidwayInitializerPerformanceManager.lifecycleStart(name, lifecycle);
|
|
114
118
|
const result = await lifecycleInstanceOrList[lifecycle](this.applicationContext, this.frameworkService.getMainApp());
|
|
115
119
|
if (resultHandler) {
|
|
116
120
|
resultHandler(result);
|
|
117
121
|
}
|
|
122
|
+
performanceManager_1.MidwayInitializerPerformanceManager.lifecycleEnd(name, lifecycle);
|
|
118
123
|
}
|
|
119
124
|
}
|
|
120
125
|
}
|
|
@@ -127,10 +132,7 @@ let MidwayLifeCycleService = class MidwayLifeCycleService {
|
|
|
127
132
|
for (const cycle of lifecycleInstanceList) {
|
|
128
133
|
if (typeof cycle.instance[lifecycle] === 'function') {
|
|
129
134
|
debug(`[core]: Lifecycle run ${cycle.instance.constructor.name} ${lifecycle}`);
|
|
130
|
-
|
|
131
|
-
const result = await this.applicationContext[lifecycle](cycle.instance[lifecycle].bind(cycle.instance));
|
|
132
|
-
performanceManager_1.MidwayInitializerPerformanceManager.lifecycleEnd(cycle.namespace, lifecycle);
|
|
133
|
-
return result;
|
|
135
|
+
return await this.applicationContext[lifecycle](cycle.instance[lifecycle].bind(cycle.instance));
|
|
134
136
|
}
|
|
135
137
|
}
|
|
136
138
|
}
|