vona-module-a-startup 5.0.29 → 5.0.31
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/dist/.metadata/index.d.ts +17 -0
- package/dist/bean/hmr.startup.d.ts +6 -0
- package/dist/index.js +27 -14
- package/package.json +1 -1
|
@@ -73,6 +73,23 @@ declare module 'vona-module-a-startup' {
|
|
|
73
73
|
/** meta redlock: begin */
|
|
74
74
|
import type { MetaRedlock } from '../bean/meta.redlock.ts';
|
|
75
75
|
/** meta redlock: end */
|
|
76
|
+
/** hmr: begin */
|
|
77
|
+
export * from '../bean/hmr.startup.ts';
|
|
78
|
+
import 'vona';
|
|
79
|
+
declare module 'vona' {
|
|
80
|
+
interface IHmrRecord {
|
|
81
|
+
'a-startup:startup': never;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
declare module 'vona-module-a-startup' {
|
|
85
|
+
interface HmrStartup {
|
|
86
|
+
}
|
|
87
|
+
interface HmrStartup {
|
|
88
|
+
get $beanFullName(): 'a-startup.hmr.startup';
|
|
89
|
+
get $onionName(): 'a-startup:startup';
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
/** hmr: end */
|
|
76
93
|
/** config: begin */
|
|
77
94
|
export * from '../config/config.ts';
|
|
78
95
|
import type { config } from '../config/config.ts';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { IDecoratorBeanOptionsBase } from 'vona';
|
|
2
|
+
import type { IHmrReload } from 'vona-module-a-hmr';
|
|
3
|
+
import { BeanBase } from 'vona';
|
|
4
|
+
export declare class HmrStartup extends BeanBase implements IHmrReload {
|
|
5
|
+
reload(_beanOptions: IDecoratorBeanOptionsBase): Promise<void>;
|
|
6
|
+
}
|
package/dist/index.js
CHANGED
|
@@ -6,11 +6,12 @@ import { Service, Scope } from 'vona-module-a-bean';
|
|
|
6
6
|
import { CacheRedis, BeanCacheRedisBase } from 'vona-module-a-cache';
|
|
7
7
|
import { Meta } from 'vona-module-a-meta';
|
|
8
8
|
import { BeanRedlockBase } from 'vona-module-a-redlock';
|
|
9
|
+
import { Hmr } from 'vona-module-a-hmr';
|
|
9
10
|
|
|
10
|
-
var _dec$
|
|
11
|
-
let ServiceStartup = (_dec$
|
|
11
|
+
var _dec$4, _dec2$4, _class$4;
|
|
12
|
+
let ServiceStartup = (_dec$4 = Service(), _dec2$4 = BeanInfo({
|
|
12
13
|
module: "a-startup"
|
|
13
|
-
}), _dec$
|
|
14
|
+
}), _dec$4(_class$4 = _dec2$4(_class$4 = class ServiceStartup extends BeanBase {
|
|
14
15
|
async appStart() {
|
|
15
16
|
// clear keys
|
|
16
17
|
await this._clearResources();
|
|
@@ -37,10 +38,13 @@ let ServiceStartup = (_dec$3 = Service(), _dec2$3 = BeanInfo({
|
|
|
37
38
|
await this._appReadyInstanceStartup('', true);
|
|
38
39
|
} else {
|
|
39
40
|
// only start static instances (defined in config)
|
|
40
|
-
for (const
|
|
41
|
+
for (const key in this.app.config.instance.instances) {
|
|
42
|
+
const instanceName = key;
|
|
43
|
+
const configInstanceBase = this.app.config.instance.instances[instanceName];
|
|
44
|
+
if (configInstanceBase === false) continue;
|
|
41
45
|
// need not await for prod
|
|
42
46
|
const wait = this.app.config.server.listen.disable;
|
|
43
|
-
await this._appReadyInstanceStartup(
|
|
47
|
+
await this._appReadyInstanceStartup(instanceName, wait);
|
|
44
48
|
}
|
|
45
49
|
}
|
|
46
50
|
|
|
@@ -127,7 +131,7 @@ let ServiceStartup = (_dec$3 = Service(), _dec2$3 = BeanInfo({
|
|
|
127
131
|
}
|
|
128
132
|
}
|
|
129
133
|
get _startups() {
|
|
130
|
-
return this.bean.onion.startup.
|
|
134
|
+
return this.bean.onion.startup.getOnionsEnabledCached();
|
|
131
135
|
}
|
|
132
136
|
async _clearResources() {
|
|
133
137
|
if (!this.app.meta.isTest) return;
|
|
@@ -136,20 +140,29 @@ let ServiceStartup = (_dec$3 = Service(), _dec2$3 = BeanInfo({
|
|
|
136
140
|
// .app/public
|
|
137
141
|
await fse.remove(path.join(this.app.config.server.publicDir, '1'));
|
|
138
142
|
}
|
|
139
|
-
}) || _class$
|
|
143
|
+
}) || _class$4) || _class$4);
|
|
140
144
|
|
|
141
|
-
var _dec$
|
|
142
|
-
let CacheRedisStartupDebounce = (_dec$
|
|
145
|
+
var _dec$3, _dec2$3, _class$3;
|
|
146
|
+
let CacheRedisStartupDebounce = (_dec$3 = CacheRedis({
|
|
143
147
|
disableInstance: true,
|
|
144
148
|
disableTransactionCompensate: true
|
|
145
|
-
}), _dec2$
|
|
149
|
+
}), _dec2$3 = BeanInfo({
|
|
146
150
|
module: "a-startup"
|
|
147
|
-
}), _dec$
|
|
151
|
+
}), _dec$3(_class$3 = _dec2$3(_class$3 = class CacheRedisStartupDebounce extends BeanCacheRedisBase {}) || _class$3) || _class$3);
|
|
152
|
+
|
|
153
|
+
var _dec$2, _dec2$2, _class$2;
|
|
154
|
+
let MetaRedlock = (_dec$2 = Meta(), _dec2$2 = BeanInfo({
|
|
155
|
+
module: "a-startup"
|
|
156
|
+
}), _dec$2(_class$2 = _dec2$2(_class$2 = class MetaRedlock extends BeanRedlockBase {}) || _class$2) || _class$2);
|
|
148
157
|
|
|
149
158
|
var _dec$1, _dec2$1, _class$1;
|
|
150
|
-
let
|
|
159
|
+
let HmrStartup = (_dec$1 = Hmr(), _dec2$1 = BeanInfo({
|
|
151
160
|
module: "a-startup"
|
|
152
|
-
}), _dec$1(_class$1 = _dec2$1(_class$1 = class
|
|
161
|
+
}), _dec$1(_class$1 = _dec2$1(_class$1 = class HmrStartup extends BeanBase {
|
|
162
|
+
async reload(_beanOptions) {
|
|
163
|
+
this.app.bean.worker.reload();
|
|
164
|
+
}
|
|
165
|
+
}) || _class$1) || _class$1);
|
|
153
166
|
|
|
154
167
|
function config(_app) {
|
|
155
168
|
return {
|
|
@@ -181,4 +194,4 @@ function Startup(options) {
|
|
|
181
194
|
return createBeanDecorator('startup', options);
|
|
182
195
|
}
|
|
183
196
|
|
|
184
|
-
export { CacheRedisStartupDebounce, MetaRedlock, Monkey, ScopeModuleAStartup, ServiceStartup, Startup, config };
|
|
197
|
+
export { CacheRedisStartupDebounce, HmrStartup, MetaRedlock, Monkey, ScopeModuleAStartup, ServiceStartup, Startup, config };
|