zova-core 5.1.48 → 5.1.50
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/bean/beanControllerPageBase.d.ts.map +1 -1
- package/dist/core/context/component.d.ts +3 -0
- package/dist/core/context/component.d.ts.map +1 -1
- package/dist/core/context/util.d.ts.map +1 -1
- package/dist/core/sys/config.d.ts +1 -1
- package/dist/core/sys/config.d.ts.map +1 -1
- package/dist/index.js +69 -33
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/bean/beanContainer.ts +3 -3
- package/src/bean/beanControllerPageBase.ts +1 -0
- package/src/core/component/module.ts +16 -16
- package/src/core/context/component.ts +35 -3
- package/src/core/context/util.ts +15 -11
- package/src/core/sys/config.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"beanControllerPageBase.d.ts","sourceRoot":"","sources":["../../src/bean/beanControllerPageBase.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,qBAAa,sBAAuB,SAAQ,QAAQ;IAC3C,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"beanControllerPageBase.d.ts","sourceRoot":"","sources":["../../src/bean/beanControllerPageBase.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,qBAAa,sBAAuB,SAAQ,QAAQ;IAC3C,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;CAoBxB"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { BeanSimple } from '../../bean/beanSimple.ts';
|
|
2
2
|
export declare class CtxComponent extends BeanSimple {
|
|
3
3
|
private _bean_render_original;
|
|
4
|
+
private _instance_ssrRender_original;
|
|
5
|
+
private _renderPatched;
|
|
6
|
+
private _ssrRenderReset;
|
|
4
7
|
activate(): void;
|
|
5
8
|
private _getRender;
|
|
6
9
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/core/context/component.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/core/context/component.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAOtD,qBAAa,YAAa,SAAQ,UAAU;IAC1C,OAAO,CAAC,qBAAqB,CAAM;IACnC,OAAO,CAAC,4BAA4B,CAAM;IAC1C,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,eAAe,CAAS;IAEhC,QAAQ;IAgER,OAAO,CAAC,UAAU;CAOnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../src/core/context/util.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAGtD,qBAAa,OAAQ,SAAQ,UAAU;IACrC,aAAa,CAAC,EAAE,KAAA,EAAE,QAAQ,CAAC,EAAE,OAAO;
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../src/core/context/util.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAGtD,qBAAa,OAAQ,SAAQ,UAAU;IACrC,aAAa,CAAC,EAAE,KAAA,EAAE,QAAQ,CAAC,EAAE,OAAO;CAqBrC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/core/sys/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D,OAAO,KAAK,EACV,aAAa,EACb,sBAAsB,EACtB,yBAA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AAyB;SAC5D,CAAC;QACF,OAAO,EAAE;YACP,UAAU,EAAE,OAAO,CAAC;YACpB,UAAU,EAAE,MAAM,CAAC;SACpB,CAAC;KACH,CAAC;IACF,MAAM,EAAE,gBAAgB,CAAC;IACzB,OAAO,EAAE,gBAAgB,CAAC;CAC3B;AAED,MAAM,MAAM,kBAAkB,GAAG,YAAY,CAAC,UAAU,CAAC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -17,7 +17,7 @@ import '@vue/runtime-dom';
|
|
|
17
17
|
import { Logger, format, NpmConfigSetLevels, print, colorize } from '@cabloy/logger';
|
|
18
18
|
import * as localeutil from '@cabloy/localeutil';
|
|
19
19
|
import * as ModuleInfo from '@cabloy/module-info';
|
|
20
|
-
import {
|
|
20
|
+
import { withCurrentInstanceScopeSSR, withCurrentInstanceScope } from '@cabloy/vue-runtime-core';
|
|
21
21
|
|
|
22
22
|
function cast(source) {
|
|
23
23
|
return source;
|
|
@@ -1183,7 +1183,7 @@ class BeanContainer {
|
|
|
1183
1183
|
} else {
|
|
1184
1184
|
this.app.meta.module._monkeyModuleSync(false, 'beanDispose', undefined, this, beanInstance);
|
|
1185
1185
|
this.runWithInstanceScopeOrAppContext(() => {
|
|
1186
|
-
beanInstance.__dispose__();
|
|
1186
|
+
return beanInstance.__dispose__();
|
|
1187
1187
|
});
|
|
1188
1188
|
this.app.meta.module._monkeyModuleSync(false, 'beanDisposed', undefined, this, beanInstance);
|
|
1189
1189
|
}
|
|
@@ -1518,8 +1518,8 @@ class BeanContainer {
|
|
|
1518
1518
|
await this.app?.meta.module._monkeyModule(true, 'beanInit', undefined, this, beanInstance);
|
|
1519
1519
|
}
|
|
1520
1520
|
if (!(beanInstance instanceof BeanAopBase) && beanInstance.__init__) {
|
|
1521
|
-
await this.runWithInstanceScopeOrAppContext(
|
|
1522
|
-
|
|
1521
|
+
await this.runWithInstanceScopeOrAppContext(() => {
|
|
1522
|
+
return beanInstance.__init__(...args);
|
|
1523
1523
|
});
|
|
1524
1524
|
}
|
|
1525
1525
|
if (this.containerType === 'sys') {
|
|
@@ -2284,6 +2284,7 @@ class BeanControllerPageBase extends BeanBase {
|
|
|
2284
2284
|
|
|
2285
2285
|
/** @internal */
|
|
2286
2286
|
__updateControllerData() {
|
|
2287
|
+
if (!this.app) return;
|
|
2287
2288
|
this.app.meta.module._monkeyModuleSync(true, 'controllerDataUpdate', undefined, this);
|
|
2288
2289
|
}
|
|
2289
2290
|
}
|
|
@@ -3443,17 +3444,22 @@ const ClientOnly = defineComponent({
|
|
|
3443
3444
|
}
|
|
3444
3445
|
});
|
|
3445
3446
|
|
|
3447
|
+
const SymbolTypeSSRRenderOriginal = Symbol('SymbolTypeSSRRenderOriginal');
|
|
3448
|
+
const SymbolTypeSSRRenderResetCount = Symbol('SymbolTypeSSRRenderResetCount');
|
|
3446
3449
|
class CtxComponent extends BeanSimple {
|
|
3447
3450
|
constructor(...args) {
|
|
3448
3451
|
super(...args);
|
|
3449
3452
|
this._bean_render_original = void 0;
|
|
3453
|
+
this._instance_ssrRender_original = void 0;
|
|
3454
|
+
this._renderPatched = false;
|
|
3455
|
+
this._ssrRenderReset = false;
|
|
3450
3456
|
}
|
|
3451
3457
|
activate() {
|
|
3452
3458
|
if (this.ctx.disposed) return;
|
|
3453
3459
|
const renderMethod = 'render';
|
|
3454
|
-
const self = this;
|
|
3455
3460
|
const instance = cast(this.ctx.instance);
|
|
3456
3461
|
this._bean_render_original = instance[renderMethod];
|
|
3462
|
+
const self = this;
|
|
3457
3463
|
instance[renderMethod] = function (...args) {
|
|
3458
3464
|
if (instance.isUnmounted) return;
|
|
3459
3465
|
if (!self.ctx.meta.state.inited.state) {
|
|
@@ -3474,16 +3480,42 @@ class CtxComponent extends BeanSimple {
|
|
|
3474
3480
|
// return render.render();
|
|
3475
3481
|
// }
|
|
3476
3482
|
};
|
|
3477
|
-
|
|
3483
|
+
this._renderPatched = true;
|
|
3484
|
+
const componentType = cast(instance.type);
|
|
3485
|
+
const ssrRenderResetCount = componentType[SymbolTypeSSRRenderResetCount] ?? 0;
|
|
3486
|
+
if (ssrRenderResetCount === 0) {
|
|
3487
|
+
componentType[SymbolTypeSSRRenderOriginal] = componentType.ssrRender;
|
|
3488
|
+
componentType.ssrRender = null;
|
|
3489
|
+
}
|
|
3490
|
+
componentType[SymbolTypeSSRRenderResetCount] = ssrRenderResetCount + 1;
|
|
3491
|
+
this._instance_ssrRender_original = instance.ssrRender;
|
|
3478
3492
|
instance.ssrRender = null;
|
|
3493
|
+
this._ssrRenderReset = true;
|
|
3479
3494
|
}
|
|
3480
3495
|
|
|
3481
3496
|
/** @internal */
|
|
3482
3497
|
dispose() {
|
|
3483
3498
|
const renderMethod = 'render';
|
|
3484
3499
|
const instance = cast(this.ctx.instance);
|
|
3485
|
-
|
|
3500
|
+
if (this._renderPatched) {
|
|
3501
|
+
instance[renderMethod] = this._bean_render_original;
|
|
3502
|
+
}
|
|
3503
|
+
if (this._ssrRenderReset) {
|
|
3504
|
+
instance.ssrRender = this._instance_ssrRender_original;
|
|
3505
|
+
const componentType = cast(instance.type);
|
|
3506
|
+
const ssrRenderResetCount = componentType[SymbolTypeSSRRenderResetCount] ?? 0;
|
|
3507
|
+
if (ssrRenderResetCount <= 1) {
|
|
3508
|
+
componentType.ssrRender = componentType[SymbolTypeSSRRenderOriginal];
|
|
3509
|
+
componentType[SymbolTypeSSRRenderOriginal] = undefined;
|
|
3510
|
+
componentType[SymbolTypeSSRRenderResetCount] = 0;
|
|
3511
|
+
} else {
|
|
3512
|
+
componentType[SymbolTypeSSRRenderResetCount] = ssrRenderResetCount - 1;
|
|
3513
|
+
}
|
|
3514
|
+
}
|
|
3486
3515
|
this._bean_render_original = null;
|
|
3516
|
+
this._instance_ssrRender_original = null;
|
|
3517
|
+
this._renderPatched = false;
|
|
3518
|
+
this._ssrRenderReset = false;
|
|
3487
3519
|
}
|
|
3488
3520
|
_getRender() {
|
|
3489
3521
|
const render = this.bean._getBeanSyncOnly(BeanControllerIdentifier);
|
|
@@ -3584,18 +3616,22 @@ class CtxUtil extends BeanSimple {
|
|
|
3584
3616
|
if (this.ctx.disposed) {
|
|
3585
3617
|
throwErrorComponentUnmounted();
|
|
3586
3618
|
}
|
|
3587
|
-
const
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
}
|
|
3591
|
-
try {
|
|
3592
|
-
return fn();
|
|
3593
|
-
} finally {
|
|
3619
|
+
const instance = this.ctx.instance;
|
|
3620
|
+
const runner = process.env.SERVER ? withCurrentInstanceScopeSSR : withCurrentInstanceScope;
|
|
3621
|
+
const result = runner(instance, () => {
|
|
3594
3622
|
if (!tracking) {
|
|
3595
|
-
|
|
3623
|
+
pauseTracking();
|
|
3596
3624
|
}
|
|
3597
|
-
|
|
3598
|
-
|
|
3625
|
+
try {
|
|
3626
|
+
const result = fn();
|
|
3627
|
+
return result;
|
|
3628
|
+
} finally {
|
|
3629
|
+
if (!tracking) {
|
|
3630
|
+
resetTracking();
|
|
3631
|
+
}
|
|
3632
|
+
}
|
|
3633
|
+
});
|
|
3634
|
+
return result;
|
|
3599
3635
|
}
|
|
3600
3636
|
}
|
|
3601
3637
|
|
|
@@ -4017,8 +4053,8 @@ class AppModule extends BeanSimple {
|
|
|
4017
4053
|
const mainInstance = this.mainInstances[moduleTarget.info.relativeName];
|
|
4018
4054
|
if (mainInstance && mainInstance[monkeyName]) {
|
|
4019
4055
|
// @ts-ignore ignore
|
|
4020
|
-
await this.app.vue.runWithContext(
|
|
4021
|
-
|
|
4056
|
+
await this.app.vue.runWithContext(() => {
|
|
4057
|
+
return mainInstance[monkeyName](...monkeyData);
|
|
4022
4058
|
});
|
|
4023
4059
|
}
|
|
4024
4060
|
}
|
|
@@ -4028,13 +4064,13 @@ class AppModule extends BeanSimple {
|
|
|
4028
4064
|
if (moduleMonkey.info.capabilities?.monkey) {
|
|
4029
4065
|
const monkeyInstance = this.monkeyInstances[key];
|
|
4030
4066
|
if (monkeyInstance && monkeyInstance[monkeyName]) {
|
|
4031
|
-
await this.app.vue.runWithContext(
|
|
4067
|
+
await this.app.vue.runWithContext(() => {
|
|
4032
4068
|
if (moduleTarget === undefined) {
|
|
4033
4069
|
// @ts-ignore ignore
|
|
4034
|
-
|
|
4070
|
+
return monkeyInstance[monkeyName](...monkeyData);
|
|
4035
4071
|
} else {
|
|
4036
4072
|
// @ts-ignore ignore
|
|
4037
|
-
|
|
4073
|
+
return monkeyInstance[monkeyName](moduleTarget, ...monkeyData);
|
|
4038
4074
|
}
|
|
4039
4075
|
});
|
|
4040
4076
|
}
|
|
@@ -4043,13 +4079,13 @@ class AppModule extends BeanSimple {
|
|
|
4043
4079
|
// app monkey
|
|
4044
4080
|
const appMonkey = this.app.meta.appMonkey;
|
|
4045
4081
|
if (appMonkey && appMonkey[monkeyName]) {
|
|
4046
|
-
await this.app.vue.runWithContext(
|
|
4082
|
+
await this.app.vue.runWithContext(() => {
|
|
4047
4083
|
if (moduleTarget === undefined) {
|
|
4048
4084
|
// @ts-ignore ignore
|
|
4049
|
-
|
|
4085
|
+
return appMonkey[monkeyName](...monkeyData);
|
|
4050
4086
|
} else {
|
|
4051
4087
|
// @ts-ignore ignore
|
|
4052
|
-
|
|
4088
|
+
return appMonkey[monkeyName](moduleTarget, ...monkeyData);
|
|
4053
4089
|
}
|
|
4054
4090
|
});
|
|
4055
4091
|
}
|
|
@@ -4064,8 +4100,8 @@ class AppModule extends BeanSimple {
|
|
|
4064
4100
|
const mainInstance = this.mainInstances[moduleTarget.info.relativeName];
|
|
4065
4101
|
if (mainInstance && mainInstance[monkeyName]) {
|
|
4066
4102
|
// @ts-ignore ignore
|
|
4067
|
-
this.app.vue.runWithContext(
|
|
4068
|
-
mainInstance[monkeyName](...monkeyData);
|
|
4103
|
+
this.app.vue.runWithContext(() => {
|
|
4104
|
+
return mainInstance[monkeyName](...monkeyData);
|
|
4069
4105
|
});
|
|
4070
4106
|
}
|
|
4071
4107
|
}
|
|
@@ -4075,13 +4111,13 @@ class AppModule extends BeanSimple {
|
|
|
4075
4111
|
if (moduleMonkey.info.capabilities?.monkey) {
|
|
4076
4112
|
const monkeyInstance = this.monkeyInstances[key];
|
|
4077
4113
|
if (monkeyInstance && monkeyInstance[monkeyName]) {
|
|
4078
|
-
this.app.vue.runWithContext(
|
|
4114
|
+
this.app.vue.runWithContext(() => {
|
|
4079
4115
|
if (moduleTarget === undefined) {
|
|
4080
4116
|
// @ts-ignore ignore
|
|
4081
|
-
monkeyInstance[monkeyName](...monkeyData);
|
|
4117
|
+
return monkeyInstance[monkeyName](...monkeyData);
|
|
4082
4118
|
} else {
|
|
4083
4119
|
// @ts-ignore ignore
|
|
4084
|
-
monkeyInstance[monkeyName](moduleTarget, ...monkeyData);
|
|
4120
|
+
return monkeyInstance[monkeyName](moduleTarget, ...monkeyData);
|
|
4085
4121
|
}
|
|
4086
4122
|
});
|
|
4087
4123
|
}
|
|
@@ -4090,13 +4126,13 @@ class AppModule extends BeanSimple {
|
|
|
4090
4126
|
// app monkey
|
|
4091
4127
|
const appMonkey = this.app.meta.appMonkey;
|
|
4092
4128
|
if (appMonkey && appMonkey[monkeyName]) {
|
|
4093
|
-
this.app.vue.runWithContext(
|
|
4129
|
+
this.app.vue.runWithContext(() => {
|
|
4094
4130
|
if (moduleTarget === undefined) {
|
|
4095
4131
|
// @ts-ignore ignore
|
|
4096
|
-
appMonkey[monkeyName](...monkeyData);
|
|
4132
|
+
return appMonkey[monkeyName](...monkeyData);
|
|
4097
4133
|
} else {
|
|
4098
4134
|
// @ts-ignore ignore
|
|
4099
|
-
appMonkey[monkeyName](moduleTarget, ...monkeyData);
|
|
4135
|
+
return appMonkey[monkeyName](moduleTarget, ...monkeyData);
|
|
4100
4136
|
}
|
|
4101
4137
|
});
|
|
4102
4138
|
}
|