@vlian/framework 1.2.59 → 1.2.60
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/analytics/index.cjs +1 -22
- package/dist/analytics.umd.js +1 -1
- package/dist/components/LocaleSwitch.cjs +1 -116
- package/dist/components/ThemeSwitch.cjs +1 -115
- package/dist/components/index.cjs +1 -20
- package/dist/components/persistence.cjs +1 -58
- package/dist/core/Test.cjs +1 -64
- package/dist/core/app/AppContext.cjs +1 -348
- package/dist/core/app/AppContext.types.cjs +1 -4
- package/dist/core/app/BasicLayout.cjs +1 -122
- package/dist/core/app/DefaultApp.cjs +1 -150
- package/dist/core/app/index.cjs +1 -41
- package/dist/core/config/AppConfig.cjs +1 -139
- package/dist/core/config/ConfigLoader.cjs +1 -323
- package/dist/core/config/ConfigValidator.cjs +2 -133
- package/dist/core/config/index.cjs +1 -28
- package/dist/core/dev/DevTools.cjs +1 -226
- package/dist/core/error/ErrorBoundary.cjs +1 -401
- package/dist/core/error/ErrorHandler.cjs +1 -275
- package/dist/core/error/index.cjs +1 -34
- package/dist/core/event/AppEventBus.cjs +1 -444
- package/dist/core/event/frameworkEvents.cjs +1 -141
- package/dist/core/event/hooks.cjs +1 -69
- package/dist/core/event/index.cjs +1 -41
- package/dist/core/event/types.cjs +1 -62
- package/dist/core/event/useEventBus.cjs +1 -25
- package/dist/core/index.cjs +1 -140
- package/dist/core/initialization/InitializationErrorThrower.cjs +1 -75
- package/dist/core/initialization/index.cjs +1 -26
- package/dist/core/initialization/initialization.cjs +1 -64
- package/dist/core/initialization/initializationErrorState.cjs +1 -66
- package/dist/core/kernel/defaultAdapters.cjs +1 -184
- package/dist/core/kernel/errors.cjs +1 -69
- package/dist/core/kernel/index.cjs +1 -20
- package/dist/core/kernel/startKernel.cjs +1 -200
- package/dist/core/kernel/types.cjs +1 -4
- package/dist/core/middleware.cjs +1 -73
- package/dist/core/plugin/PluginEventBus.cjs +1 -298
- package/dist/core/plugin/PluginSandbox.cjs +1 -137
- package/dist/core/plugin.cjs +1 -494
- package/dist/core/router/RouterManager.cjs +1 -286
- package/dist/core/router/adapter/AdapterManager.cjs +1 -235
- package/dist/core/router/adapter/index.cjs +1 -22
- package/dist/core/router/adapter/react-router/ReactRouterAdapter.cjs +1 -128
- package/dist/core/router/adapter/react-router/index.cjs +1 -20
- package/dist/core/router/adapter/types.cjs +1 -6
- package/dist/core/router/dev/RouterDevTools.cjs +1 -260
- package/dist/core/router/dev/index.cjs +1 -20
- package/dist/core/router/dynamic/DynamicRouteManager.cjs +1 -193
- package/dist/core/router/dynamic/index.cjs +1 -20
- package/dist/core/router/errors/RouterError.cjs +1 -61
- package/dist/core/router/errors/index.cjs +1 -20
- package/dist/core/router/index.cjs +1 -36
- package/dist/core/router/lifecycle/RouterLifecycleManager.cjs +1 -144
- package/dist/core/router/lifecycle/index.cjs +1 -20
- package/dist/core/router/middleware/RouterMiddlewareManager.cjs +1 -193
- package/dist/core/router/middleware/auth.cjs +1 -66
- package/dist/core/router/middleware/index.cjs +1 -22
- package/dist/core/router/middleware/types.cjs +1 -6
- package/dist/core/router/monitoring/RouterMonitoring.cjs +1 -227
- package/dist/core/router/monitoring/index.cjs +1 -20
- package/dist/core/router/navigation/RouterNavigation.cjs +1 -239
- package/dist/core/router/navigation/index.cjs +1 -20
- package/dist/core/router/performance/RouteCache.cjs +1 -305
- package/dist/core/router/performance/RoutePreloader.cjs +1 -292
- package/dist/core/router/performance/index.cjs +1 -21
- package/dist/core/router/plugin/RouterPluginManager.cjs +1 -262
- package/dist/core/router/plugin/index.cjs +1 -21
- package/dist/core/router/plugin/types.cjs +1 -39
- package/dist/core/router/types.cjs +1 -4
- package/dist/core/router/utils/adapters/react-router/RouteErrorBoundary.cjs +1 -129
- package/dist/core/router/utils/adapters/react-router/transform.cjs +1 -250
- package/dist/core/router/utils/transform.cjs +1 -780
- package/dist/core/router/validation/RouterConfigValidator.cjs +2 -83
- package/dist/core/router/validation/index.cjs +1 -21
- package/dist/core/router/validation/schema.cjs +1 -159
- package/dist/core/router/version/RouteVersionManager.cjs +1 -205
- package/dist/core/router/version/index.cjs +1 -20
- package/dist/core/splash/SplashScreen.cjs +1 -341
- package/dist/core/splash/index.cjs +1 -22
- package/dist/core/splash/splashScreenUtils.cjs +1 -38
- package/dist/core/startup/AppInstance.cjs +1 -239
- package/dist/core/startup/environment.cjs +1 -169
- package/dist/core/startup/index.cjs +1 -23
- package/dist/core/startup/initializeServices.cjs +1 -226
- package/dist/core/startup/performanceTracker.cjs +1 -179
- package/dist/core/startup/renderApp.cjs +1 -314
- package/dist/core/startup/startApp.cjs +1 -317
- package/dist/core/types.cjs +1 -4
- package/dist/index.cjs +1 -52
- package/dist/index.umd.cjs +1 -27
- package/dist/index.umd.js +1 -1
- package/dist/kernel/constants.cjs +1 -65
- package/dist/kernel/index.cjs +1 -38
- package/dist/kernel/kernel.cjs +1 -295
- package/dist/kernel/manager/cacheManager.cjs +1 -46
- package/dist/kernel/manager/i18n/I18nManager.cjs +1 -91
- package/dist/kernel/manager/i18n/i18n.persistence.cjs +1 -60
- package/dist/kernel/manager/i18n/i18n.schema.cjs +1 -86
- package/dist/kernel/manager/i18n/index.cjs +1 -11
- package/dist/kernel/manager/i18nManager.cjs +1 -11
- package/dist/kernel/manager/index.cjs +1 -28
- package/dist/kernel/manager/logger/LoggerManager.cjs +1 -107
- package/dist/kernel/manager/logger/index.cjs +1 -11
- package/dist/kernel/manager/logger/logger.persistence.cjs +1 -62
- package/dist/kernel/manager/logger/logger.schema.cjs +1 -74
- package/dist/kernel/manager/loggerManager.cjs +1 -11
- package/dist/kernel/manager/theme/ThemeManager.cjs +1 -84
- package/dist/kernel/manager/theme/index.cjs +1 -11
- package/dist/kernel/manager/theme/theme.dom.cjs +1 -61
- package/dist/kernel/manager/theme/theme.persistence.cjs +1 -57
- package/dist/kernel/manager/theme/theme.schema.cjs +1 -122
- package/dist/kernel/manager/themeManager.cjs +1 -11
- package/dist/kernel/types.cjs +1 -4
- package/dist/library/index.cjs +1 -19
- package/dist/library/locale/index.cjs +1 -39
- package/dist/library/locale/langs/en-us/index.cjs +1 -32
- package/dist/library/locale/langs/zh-cn/index.cjs +1 -32
- package/dist/library/locale/types.cjs +1 -4
- package/dist/library/storage/cache.cjs +1 -243
- package/dist/library/storage/encryption.cjs +1 -147
- package/dist/library/storage/index.cjs +1 -124
- package/dist/state/StateManager.cjs +1 -166
- package/dist/state/adapters/AdapterFactory.cjs +1 -89
- package/dist/state/adapters/DefaultAdapter.cjs +1 -75
- package/dist/state/adapters/ReduxAdapter.cjs +1 -443
- package/dist/state/adapters/ZustandAdapter.cjs +1 -69
- package/dist/state/adapters/index.cjs +1 -44
- package/dist/state/adapters/types.cjs +1 -20
- package/dist/state/core/DerivedStateInstance.cjs +1 -174
- package/dist/state/core/StateInstance.cjs +1 -170
- package/dist/state/core/StateRegistry.cjs +1 -110
- package/dist/state/core/StateScope.cjs +1 -137
- package/dist/state/core/index.cjs +1 -30
- package/dist/state/index.cjs +1 -30
- package/dist/state/types.cjs +1 -12
- package/dist/state.umd.js +1 -1
- package/dist/types.cjs +1 -4
- package/dist/utils/analytics.cjs +1 -217
- package/dist/utils/configSecurity.cjs +3 -182
- package/dist/utils/csrf.cjs +1 -18
- package/dist/utils/errors/ErrorCodes.cjs +1 -25
- package/dist/utils/errors.cjs +1 -111
- package/dist/utils/index.cjs +1 -135
- package/dist/utils/logger.cjs +1 -25
- package/dist/utils/logger.types.cjs +1 -11
- package/dist/utils/monitoring.cjs +1 -18
- package/dist/utils/performance.cjs +1 -22
- package/dist/utils/resourceLoader.cjs +1 -22
- package/dist/utils/runtimeSecurity.cjs +1 -11
- package/dist/utils/security.cjs +1 -19
- package/dist/utils/traceId.cjs +1 -37
- package/dist/utils/validation.cjs +1 -19
- package/package.json +7 -3
|
@@ -1,41 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* 应用级事件系统
|
|
3
|
-
* 提供高性能、类型安全、可观测的事件通信能力
|
|
4
|
-
*/ "use strict";
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
function _export(target, all) {
|
|
9
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
10
|
-
enumerable: true,
|
|
11
|
-
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
_export(exports, {
|
|
15
|
-
get AppEventBus () {
|
|
16
|
-
return _AppEventBus.AppEventBus;
|
|
17
|
-
},
|
|
18
|
-
get FrameworkEventManager () {
|
|
19
|
-
return _frameworkEvents.FrameworkEventManager;
|
|
20
|
-
},
|
|
21
|
-
get FrameworkEventType () {
|
|
22
|
-
return _types.FrameworkEventType;
|
|
23
|
-
},
|
|
24
|
-
get useAppEvent () {
|
|
25
|
-
return _hooks.useAppEvent;
|
|
26
|
-
},
|
|
27
|
-
get useAppEventEmitter () {
|
|
28
|
-
return _hooks.useAppEventEmitter;
|
|
29
|
-
},
|
|
30
|
-
get useAppEventOnce () {
|
|
31
|
-
return _hooks.useAppEventOnce;
|
|
32
|
-
},
|
|
33
|
-
get useEventBus () {
|
|
34
|
-
return _useEventBus.useEventBus;
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
const _AppEventBus = require("./AppEventBus");
|
|
38
|
-
const _frameworkEvents = require("./frameworkEvents");
|
|
39
|
-
const _hooks = require("./hooks");
|
|
40
|
-
const _useEventBus = require("./useEventBus");
|
|
41
|
-
const _types = require("./types");
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});function _export(target,all){for(var name in all)Object.defineProperty(target,name,{enumerable:true,get:Object.getOwnPropertyDescriptor(all,name).get})}_export(exports,{get AppEventBus(){return _AppEventBus.AppEventBus},get FrameworkEventManager(){return _frameworkEvents.FrameworkEventManager},get FrameworkEventType(){return _types.FrameworkEventType},get useAppEvent(){return _hooks.useAppEvent},get useAppEventEmitter(){return _hooks.useAppEventEmitter},get useAppEventOnce(){return _hooks.useAppEventOnce},get useEventBus(){return _useEventBus.useEventBus}});const _AppEventBus=require("./AppEventBus");const _frameworkEvents=require("./frameworkEvents");const _hooks=require("./hooks");const _useEventBus=require("./useEventBus");const _types=require("./types");
|
|
@@ -1,62 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* 应用级事件系统类型定义
|
|
3
|
-
* 提供类型安全的事件通信能力
|
|
4
|
-
*/ /**
|
|
5
|
-
* 事件监听器类型
|
|
6
|
-
*
|
|
7
|
-
* @template T - 事件数据类型
|
|
8
|
-
*/ "use strict";
|
|
9
|
-
Object.defineProperty(exports, "__esModule", {
|
|
10
|
-
value: true
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "FrameworkEventType", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function() {
|
|
15
|
-
return FrameworkEventType;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
var FrameworkEventType = /*#__PURE__*/ function(FrameworkEventType) {
|
|
19
|
-
/**
|
|
20
|
-
* 应用启动开始
|
|
21
|
-
*/ FrameworkEventType["APP_START"] = "framework:app:start";
|
|
22
|
-
/**
|
|
23
|
-
* 应用启动完成
|
|
24
|
-
*/ FrameworkEventType["APP_STARTED"] = "framework:app:started";
|
|
25
|
-
/**
|
|
26
|
-
* 应用初始化开始
|
|
27
|
-
*/ FrameworkEventType["APP_INIT_START"] = "framework:app:init:start";
|
|
28
|
-
/**
|
|
29
|
-
* 应用初始化完成
|
|
30
|
-
*/ FrameworkEventType["APP_INIT_COMPLETE"] = "framework:app:init:complete";
|
|
31
|
-
/**
|
|
32
|
-
* 应用初始化失败
|
|
33
|
-
*/ FrameworkEventType["APP_INIT_ERROR"] = "framework:app:init:error";
|
|
34
|
-
/**
|
|
35
|
-
* 应用渲染开始
|
|
36
|
-
*/ FrameworkEventType["APP_RENDER_START"] = "framework:app:render:start";
|
|
37
|
-
/**
|
|
38
|
-
* 应用渲染完成
|
|
39
|
-
*/ FrameworkEventType["APP_RENDER_COMPLETE"] = "framework:app:render:complete";
|
|
40
|
-
/**
|
|
41
|
-
* 路由变化
|
|
42
|
-
*/ FrameworkEventType["ROUTE_CHANGE"] = "framework:route:change";
|
|
43
|
-
/**
|
|
44
|
-
* 路由导航开始
|
|
45
|
-
*/ FrameworkEventType["ROUTE_NAVIGATE_START"] = "framework:route:navigate:start";
|
|
46
|
-
/**
|
|
47
|
-
* 路由导航完成
|
|
48
|
-
*/ FrameworkEventType["ROUTE_NAVIGATE_COMPLETE"] = "framework:route:navigate:complete";
|
|
49
|
-
/**
|
|
50
|
-
* 错误发生
|
|
51
|
-
*/ FrameworkEventType["ERROR_OCCURRED"] = "framework:error:occurred";
|
|
52
|
-
/**
|
|
53
|
-
* 实例创建
|
|
54
|
-
*/ FrameworkEventType["INSTANCE_CREATED"] = "framework:instance:created";
|
|
55
|
-
/**
|
|
56
|
-
* 实例销毁
|
|
57
|
-
*/ FrameworkEventType["INSTANCE_DESTROYED"] = "framework:instance:destroyed";
|
|
58
|
-
/**
|
|
59
|
-
* 性能指标更新
|
|
60
|
-
*/ FrameworkEventType["PERFORMANCE_UPDATE"] = "framework:performance:update";
|
|
61
|
-
return FrameworkEventType;
|
|
62
|
-
}({});
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"FrameworkEventType",{enumerable:true,get:function(){return FrameworkEventType}});var FrameworkEventType=/*#__PURE__*/function(FrameworkEventType){FrameworkEventType["APP_START"]="framework:app:start";FrameworkEventType["APP_STARTED"]="framework:app:started";FrameworkEventType["APP_INIT_START"]="framework:app:init:start";FrameworkEventType["APP_INIT_COMPLETE"]="framework:app:init:complete";FrameworkEventType["APP_INIT_ERROR"]="framework:app:init:error";FrameworkEventType["APP_RENDER_START"]="framework:app:render:start";FrameworkEventType["APP_RENDER_COMPLETE"]="framework:app:render:complete";FrameworkEventType["ROUTE_CHANGE"]="framework:route:change";FrameworkEventType["ROUTE_NAVIGATE_START"]="framework:route:navigate:start";FrameworkEventType["ROUTE_NAVIGATE_COMPLETE"]="framework:route:navigate:complete";FrameworkEventType["ERROR_OCCURRED"]="framework:error:occurred";FrameworkEventType["INSTANCE_CREATED"]="framework:instance:created";FrameworkEventType["INSTANCE_DESTROYED"]="framework:instance:destroyed";FrameworkEventType["PERFORMANCE_UPDATE"]="framework:performance:update";return FrameworkEventType}({});
|
|
@@ -1,25 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* 便捷的 Hook:获取当前应用实例的事件总线
|
|
3
|
-
*/ "use strict";
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
Object.defineProperty(exports, "useEventBus", {
|
|
8
|
-
enumerable: true,
|
|
9
|
-
get: function() {
|
|
10
|
-
return useEventBus;
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
const _AppInstance = require("../startup/AppInstance");
|
|
14
|
-
function useEventBus() {
|
|
15
|
-
const instanceManager = (0, _AppInstance.getAppInstanceManager)();
|
|
16
|
-
const instance = instanceManager.getInstance();
|
|
17
|
-
if (!instance) {
|
|
18
|
-
throw new Error('应用实例未找到');
|
|
19
|
-
}
|
|
20
|
-
const eventBus = instance.getEventBus();
|
|
21
|
-
if (!eventBus) {
|
|
22
|
-
throw new Error('事件总线未初始化');
|
|
23
|
-
}
|
|
24
|
-
return eventBus;
|
|
25
|
-
}
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"useEventBus",{enumerable:true,get:function(){return useEventBus}});const _AppInstance=require("../startup/AppInstance");function useEventBus(){const instanceManager=(0,_AppInstance.getAppInstanceManager)();const instance=instanceManager.getInstance();if(!instance){throw new Error("应用实例未找到")}const eventBus=instance.getEventBus();if(!eventBus){throw new Error("事件总线未初始化")}return eventBus}
|
package/dist/core/index.cjs
CHANGED
|
@@ -1,140 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
function _export(target, all) {
|
|
6
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
_export(exports, {
|
|
12
|
-
get AppContextProvider () {
|
|
13
|
-
return _app.AppContextProvider;
|
|
14
|
-
},
|
|
15
|
-
get DevTools () {
|
|
16
|
-
return _DevTools.DevTools;
|
|
17
|
-
},
|
|
18
|
-
get DevToolsTrigger () {
|
|
19
|
-
return _DevTools.DevToolsTrigger;
|
|
20
|
-
},
|
|
21
|
-
get ErrorBoundary () {
|
|
22
|
-
return _error.ErrorBoundary;
|
|
23
|
-
},
|
|
24
|
-
get MiddlewareManager () {
|
|
25
|
-
return _middleware.MiddlewareManager;
|
|
26
|
-
},
|
|
27
|
-
get PluginManager () {
|
|
28
|
-
return _plugin.PluginManager;
|
|
29
|
-
},
|
|
30
|
-
get appConfig () {
|
|
31
|
-
return _AppConfig.appConfig;
|
|
32
|
-
},
|
|
33
|
-
get getAppInstanceManager () {
|
|
34
|
-
return _AppInstance.getAppInstanceManager;
|
|
35
|
-
},
|
|
36
|
-
get getStateManager () {
|
|
37
|
-
return getStateManager;
|
|
38
|
-
},
|
|
39
|
-
get middlewareManager () {
|
|
40
|
-
return _middleware.middlewareManager;
|
|
41
|
-
},
|
|
42
|
-
get pluginManager () {
|
|
43
|
-
return _plugin.pluginManager;
|
|
44
|
-
},
|
|
45
|
-
get start () {
|
|
46
|
-
return start;
|
|
47
|
-
},
|
|
48
|
-
get startApp () {
|
|
49
|
-
return _startApp.startApp;
|
|
50
|
-
},
|
|
51
|
-
get storage () {
|
|
52
|
-
return _library.storage;
|
|
53
|
-
},
|
|
54
|
-
get useAppContext () {
|
|
55
|
-
return _app.useAppContext;
|
|
56
|
-
},
|
|
57
|
-
get useConfig () {
|
|
58
|
-
return _app.useConfig;
|
|
59
|
-
},
|
|
60
|
-
get useErrorHandler () {
|
|
61
|
-
return _error.useErrorHandler;
|
|
62
|
-
},
|
|
63
|
-
get useLocale () {
|
|
64
|
-
return _app.useLocale;
|
|
65
|
-
},
|
|
66
|
-
get useStateManager () {
|
|
67
|
-
return _app.useStateManager;
|
|
68
|
-
},
|
|
69
|
-
get useTheme () {
|
|
70
|
-
return _app.useTheme;
|
|
71
|
-
},
|
|
72
|
-
get withErrorBoundary () {
|
|
73
|
-
return _error.withErrorBoundary;
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
const _library = require("../library");
|
|
77
|
-
const _startApp = require("./startup/startApp");
|
|
78
|
-
const _AppInstance = require("./startup/AppInstance");
|
|
79
|
-
const _app = require("./app");
|
|
80
|
-
const _error = require("./error");
|
|
81
|
-
const _AppConfig = require("./config/AppConfig");
|
|
82
|
-
const _middleware = require("./middleware");
|
|
83
|
-
const _plugin = require("./plugin");
|
|
84
|
-
_export_star(require("./startup"), exports);
|
|
85
|
-
_export_star(require("./config"), exports);
|
|
86
|
-
_export_star(require("./kernel"), exports);
|
|
87
|
-
_export_star(require("./router"), exports);
|
|
88
|
-
_export_star(require("./event"), exports);
|
|
89
|
-
const _DevTools = require("./dev/DevTools");
|
|
90
|
-
function _export_star(from, to) {
|
|
91
|
-
Object.keys(from).forEach(function(k) {
|
|
92
|
-
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
93
|
-
Object.defineProperty(to, k, {
|
|
94
|
-
enumerable: true,
|
|
95
|
-
get: function() {
|
|
96
|
-
return from[k];
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
return from;
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* 启动框架
|
|
105
|
-
*
|
|
106
|
-
* @param options - 启动配置选项
|
|
107
|
-
* @returns Promise<void>
|
|
108
|
-
*
|
|
109
|
-
* @example
|
|
110
|
-
* ```typescript
|
|
111
|
-
* import { start } from '@vlian/framework';
|
|
112
|
-
*
|
|
113
|
-
* start({
|
|
114
|
-
* loggerLevel: LogLevel.DEBUG,
|
|
115
|
-
* lifecycle: {
|
|
116
|
-
* beforeInitialization: async () => {
|
|
117
|
-
* console.log('初始化前执行');
|
|
118
|
-
* },
|
|
119
|
-
* },
|
|
120
|
-
* });
|
|
121
|
-
* ```
|
|
122
|
-
*/ /**
|
|
123
|
-
* 启动框架(向后兼容的API)
|
|
124
|
-
*
|
|
125
|
-
* @param options - 启动配置选项
|
|
126
|
-
* @returns Promise<void>
|
|
127
|
-
*
|
|
128
|
-
* @deprecated 建议使用 startApp 函数,支持多实例
|
|
129
|
-
*/ const start = async (options = {})=>{
|
|
130
|
-
// 使用新的启动函数,保持向后兼容
|
|
131
|
-
await (0, _startApp.startApp)(options);
|
|
132
|
-
};
|
|
133
|
-
const getStateManager = ()=>{
|
|
134
|
-
const instanceManager = (0, _AppInstance.getAppInstanceManager)();
|
|
135
|
-
const instance = instanceManager.getInstance();
|
|
136
|
-
if (instance) {
|
|
137
|
-
return instance.getServices().stateManager;
|
|
138
|
-
}
|
|
139
|
-
return null;
|
|
140
|
-
};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});function _export(target,all){for(var name in all)Object.defineProperty(target,name,{enumerable:true,get:Object.getOwnPropertyDescriptor(all,name).get})}_export(exports,{get AppContextProvider(){return _app.AppContextProvider},get DevTools(){return _DevTools.DevTools},get DevToolsTrigger(){return _DevTools.DevToolsTrigger},get ErrorBoundary(){return _error.ErrorBoundary},get MiddlewareManager(){return _middleware.MiddlewareManager},get PluginManager(){return _plugin.PluginManager},get appConfig(){return _AppConfig.appConfig},get getAppInstanceManager(){return _AppInstance.getAppInstanceManager},get getStateManager(){return getStateManager},get middlewareManager(){return _middleware.middlewareManager},get pluginManager(){return _plugin.pluginManager},get start(){return start},get startApp(){return _startApp.startApp},get storage(){return _library.storage},get useAppContext(){return _app.useAppContext},get useConfig(){return _app.useConfig},get useErrorHandler(){return _error.useErrorHandler},get useLocale(){return _app.useLocale},get useStateManager(){return _app.useStateManager},get useTheme(){return _app.useTheme},get withErrorBoundary(){return _error.withErrorBoundary}});const _library=require("../library");const _startApp=require("./startup/startApp");const _AppInstance=require("./startup/AppInstance");const _app=require("./app");const _error=require("./error");const _AppConfig=require("./config/AppConfig");const _middleware=require("./middleware");const _plugin=require("./plugin");_export_star(require("./startup"),exports);_export_star(require("./config"),exports);_export_star(require("./kernel"),exports);_export_star(require("./router"),exports);_export_star(require("./event"),exports);const _DevTools=require("./dev/DevTools");function _export_star(from,to){Object.keys(from).forEach(function(k){if(k!=="default"&&!Object.prototype.hasOwnProperty.call(to,k)){Object.defineProperty(to,k,{enumerable:true,get:function(){return from[k]}})}});return from}const start=async(options={})=>{await (0,_startApp.startApp)(options)};const getStateManager=()=>{const instanceManager=(0,_AppInstance.getAppInstanceManager)();const instance=instanceManager.getInstance();if(instance){return instance.getServices().stateManager}return null};
|
|
@@ -1,75 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "InitializationErrorThrower", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return InitializationErrorThrower;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
12
|
-
const _initializationErrorState = require("./initializationErrorState");
|
|
13
|
-
function _getRequireWildcardCache(nodeInterop) {
|
|
14
|
-
if (typeof WeakMap !== "function") return null;
|
|
15
|
-
var cacheBabelInterop = new WeakMap();
|
|
16
|
-
var cacheNodeInterop = new WeakMap();
|
|
17
|
-
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
18
|
-
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
19
|
-
})(nodeInterop);
|
|
20
|
-
}
|
|
21
|
-
function _interop_require_wildcard(obj, nodeInterop) {
|
|
22
|
-
if (!nodeInterop && obj && obj.__esModule) {
|
|
23
|
-
return obj;
|
|
24
|
-
}
|
|
25
|
-
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
26
|
-
return {
|
|
27
|
-
default: obj
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
var cache = _getRequireWildcardCache(nodeInterop);
|
|
31
|
-
if (cache && cache.has(obj)) {
|
|
32
|
-
return cache.get(obj);
|
|
33
|
-
}
|
|
34
|
-
var newObj = {
|
|
35
|
-
__proto__: null
|
|
36
|
-
};
|
|
37
|
-
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
38
|
-
for(var key in obj){
|
|
39
|
-
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
40
|
-
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
41
|
-
if (desc && (desc.get || desc.set)) {
|
|
42
|
-
Object.defineProperty(newObj, key, desc);
|
|
43
|
-
} else {
|
|
44
|
-
newObj[key] = obj[key];
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
newObj.default = obj;
|
|
49
|
-
if (cache) {
|
|
50
|
-
cache.set(obj, newObj);
|
|
51
|
-
}
|
|
52
|
-
return newObj;
|
|
53
|
-
}
|
|
54
|
-
const InitializationErrorThrower = ()=>{
|
|
55
|
-
const [error, setError] = (0, _react.useState)(null);
|
|
56
|
-
(0, _react.useEffect)(()=>{
|
|
57
|
-
// 检查初始错误
|
|
58
|
-
const currentError = _initializationErrorState.initializationErrorState.getError();
|
|
59
|
-
if (currentError) {
|
|
60
|
-
setError(currentError);
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
// 订阅错误变化
|
|
64
|
-
const unsubscribe = _initializationErrorState.initializationErrorState.subscribe(()=>{
|
|
65
|
-
const newError = _initializationErrorState.initializationErrorState.getError();
|
|
66
|
-
setError(newError);
|
|
67
|
-
});
|
|
68
|
-
return unsubscribe;
|
|
69
|
-
}, []);
|
|
70
|
-
// 如果有错误,抛出错误给 ErrorBoundary
|
|
71
|
-
if (error) {
|
|
72
|
-
throw error;
|
|
73
|
-
}
|
|
74
|
-
return null;
|
|
75
|
-
};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"InitializationErrorThrower",{enumerable:true,get:function(){return InitializationErrorThrower}});const _react=/*#__PURE__*/_interop_require_wildcard(require("react"));const _initializationErrorState=require("./initializationErrorState");function _getRequireWildcardCache(nodeInterop){if(typeof WeakMap!=="function")return null;var cacheBabelInterop=new WeakMap;var cacheNodeInterop=new WeakMap;return(_getRequireWildcardCache=function(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop})(nodeInterop)}function _interop_require_wildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule){return obj}if(obj===null||typeof obj!=="object"&&typeof obj!=="function"){return{default:obj}}var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj)){return cache.get(obj)}var newObj={__proto__:null};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(key!=="default"&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc)}else{newObj[key]=obj[key]}}}newObj.default=obj;if(cache){cache.set(obj,newObj)}return newObj}const InitializationErrorThrower=()=>{const[error,setError]=(0,_react.useState)(null);(0,_react.useEffect)(()=>{const currentError=_initializationErrorState.initializationErrorState.getError();if(currentError){setError(currentError);return}const unsubscribe=_initializationErrorState.initializationErrorState.subscribe(()=>{const newError=_initializationErrorState.initializationErrorState.getError();setError(newError)});return unsubscribe},[]);if(error){throw error}return null};
|
|
@@ -1,26 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* 初始化模块统一导出
|
|
3
|
-
*/ "use strict";
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
function _export(target, all) {
|
|
8
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
9
|
-
enumerable: true,
|
|
10
|
-
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
_export(exports, {
|
|
14
|
-
get InitializationErrorThrower () {
|
|
15
|
-
return _InitializationErrorThrower.InitializationErrorThrower;
|
|
16
|
-
},
|
|
17
|
-
get initialization () {
|
|
18
|
-
return _initialization.initialization;
|
|
19
|
-
},
|
|
20
|
-
get initializationErrorState () {
|
|
21
|
-
return _initializationErrorState.initializationErrorState;
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
const _initialization = require("./initialization");
|
|
25
|
-
const _InitializationErrorThrower = require("./InitializationErrorThrower");
|
|
26
|
-
const _initializationErrorState = require("./initializationErrorState");
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});function _export(target,all){for(var name in all)Object.defineProperty(target,name,{enumerable:true,get:Object.getOwnPropertyDescriptor(all,name).get})}_export(exports,{get InitializationErrorThrower(){return _InitializationErrorThrower.InitializationErrorThrower},get initialization(){return _initialization.initialization},get initializationErrorState(){return _initializationErrorState.initializationErrorState}});const _initialization=require("./initialization");const _InitializationErrorThrower=require("./InitializationErrorThrower");const _initializationErrorState=require("./initializationErrorState");
|
|
@@ -1,64 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "initialization", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return initialization;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _logger = require("@vlian/logger");
|
|
12
|
-
const _library = require("../../library");
|
|
13
|
-
const _plugin = require("../plugin");
|
|
14
|
-
async function initialization(options, onProgress) {
|
|
15
|
-
const startTime = Date.now();
|
|
16
|
-
let config = {};
|
|
17
|
-
try {
|
|
18
|
-
// 0. 执行插件初始化前钩子
|
|
19
|
-
await _plugin.pluginManager.executeBeforeInit(options);
|
|
20
|
-
// 1. 设置日志级别
|
|
21
|
-
onProgress?.(5, '初始化日志系统...');
|
|
22
|
-
_logger.logger.setLevel(options.loggerLevel ?? _logger.LogLevel.INFO);
|
|
23
|
-
// 2. 预留配置阶段
|
|
24
|
-
onProgress?.(30);
|
|
25
|
-
// 3. 初始化之前回调
|
|
26
|
-
if (options.lifecycle?.beforeInitialization) {
|
|
27
|
-
onProgress?.(35, '执行初始化前回调...');
|
|
28
|
-
await options.lifecycle.beforeInitialization();
|
|
29
|
-
}
|
|
30
|
-
// 4. 国际化设置
|
|
31
|
-
onProgress?.(40, '设置国际化...');
|
|
32
|
-
(0, _library.setupI18n)(options.locale || undefined);
|
|
33
|
-
// 5. 核心初始化
|
|
34
|
-
if (options.lifecycle?.initialization) {
|
|
35
|
-
onProgress?.(50, '初始化核心功能...');
|
|
36
|
-
await options.lifecycle.initialization();
|
|
37
|
-
onProgress?.(70, '核心功能初始化完成');
|
|
38
|
-
} else {
|
|
39
|
-
onProgress?.(70);
|
|
40
|
-
}
|
|
41
|
-
onProgress?.(80, '准备完成...');
|
|
42
|
-
const duration = Date.now() - startTime;
|
|
43
|
-
const context = {
|
|
44
|
-
config,
|
|
45
|
-
progress: 100,
|
|
46
|
-
isReady: true,
|
|
47
|
-
duration
|
|
48
|
-
};
|
|
49
|
-
// 执行插件初始化钩子
|
|
50
|
-
await _plugin.pluginManager.executeInit(options, context);
|
|
51
|
-
// 执行插件初始化后钩子
|
|
52
|
-
await _plugin.pluginManager.executeAfterInit(options, context);
|
|
53
|
-
// 6. 初始化之后回调(在 context 创建后执行,可以访问完整的初始化上下文)
|
|
54
|
-
if (options.lifecycle?.afterInitialization) {
|
|
55
|
-
onProgress?.(90, '执行初始化后回调...');
|
|
56
|
-
await options.lifecycle.afterInitialization(context);
|
|
57
|
-
}
|
|
58
|
-
onProgress?.(100, '初始化完成');
|
|
59
|
-
return context;
|
|
60
|
-
} catch (error) {
|
|
61
|
-
_logger.logger.error('初始化失败:', error);
|
|
62
|
-
throw error;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"initialization",{enumerable:true,get:function(){return initialization}});const _logger=require("@vlian/logger");const _library=require("../../library");const _plugin=require("../plugin");async function initialization(options,onProgress){const startTime=Date.now();let config={};try{await _plugin.pluginManager.executeBeforeInit(options);onProgress?.(5,"初始化日志系统...");_logger.logger.setLevel(options.loggerLevel??_logger.LogLevel.INFO);onProgress?.(30);if(options.lifecycle?.beforeInitialization){onProgress?.(35,"执行初始化前回调...");await options.lifecycle.beforeInitialization()}onProgress?.(40,"设置国际化...");(0,_library.setupI18n)(options.locale||undefined);if(options.lifecycle?.initialization){onProgress?.(50,"初始化核心功能...");await options.lifecycle.initialization();onProgress?.(70,"核心功能初始化完成")}else{onProgress?.(70)}onProgress?.(80,"准备完成...");const duration=Date.now()-startTime;const context={config,progress:100,isReady:true,duration};await _plugin.pluginManager.executeInit(options,context);await _plugin.pluginManager.executeAfterInit(options,context);if(options.lifecycle?.afterInitialization){onProgress?.(90,"执行初始化后回调...");await options.lifecycle.afterInitialization(context)}onProgress?.(100,"初始化完成");return context}catch(error){_logger.logger.error("初始化失败:",error);throw error}}
|
|
@@ -1,66 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "initializationErrorState", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return initializationErrorState;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _utils = require("@vlian/utils");
|
|
12
|
-
function _define_property(obj, key, value) {
|
|
13
|
-
if (key in obj) {
|
|
14
|
-
Object.defineProperty(obj, key, {
|
|
15
|
-
value: value,
|
|
16
|
-
enumerable: true,
|
|
17
|
-
configurable: true,
|
|
18
|
-
writable: true
|
|
19
|
-
});
|
|
20
|
-
} else {
|
|
21
|
-
obj[key] = value;
|
|
22
|
-
}
|
|
23
|
-
return obj;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* 初始化错误状态管理器
|
|
27
|
-
*
|
|
28
|
-
* 用于在初始化过程中捕获和存储错误,以便 ErrorBoundary 能够捕获并显示
|
|
29
|
-
*/ let InitializationErrorState = class InitializationErrorState {
|
|
30
|
-
/**
|
|
31
|
-
* 设置错误
|
|
32
|
-
*/ setError(error) {
|
|
33
|
-
this.error = _utils.errorUtils.normalizeError(error);
|
|
34
|
-
// 通知所有监听器
|
|
35
|
-
this.listeners.forEach((listener)=>listener());
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* 获取错误
|
|
39
|
-
*/ getError() {
|
|
40
|
-
return this.error;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* 清除错误
|
|
44
|
-
*/ clearError() {
|
|
45
|
-
this.error = null;
|
|
46
|
-
this.listeners.forEach((listener)=>listener());
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* 订阅错误变化
|
|
50
|
-
*/ subscribe(listener) {
|
|
51
|
-
this.listeners.add(listener);
|
|
52
|
-
return ()=>{
|
|
53
|
-
this.listeners.delete(listener);
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* 检查是否有错误
|
|
58
|
-
*/ hasError() {
|
|
59
|
-
return this.error !== null;
|
|
60
|
-
}
|
|
61
|
-
constructor(){
|
|
62
|
-
_define_property(this, "error", null);
|
|
63
|
-
_define_property(this, "listeners", new Set());
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
const initializationErrorState = new InitializationErrorState();
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"initializationErrorState",{enumerable:true,get:function(){return initializationErrorState}});const _utils=require("@vlian/utils");function _define_property(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}let InitializationErrorState=class InitializationErrorState{setError(error){this.error=_utils.errorUtils.normalizeError(error);this.listeners.forEach(listener=>listener())}getError(){return this.error}clearError(){this.error=null;this.listeners.forEach(listener=>listener())}subscribe(listener){this.listeners.add(listener);return()=>{this.listeners.delete(listener)}}hasError(){return this.error!==null}constructor(){_define_property(this,"error",null);_define_property(this,"listeners",new Set)}};const initializationErrorState=new InitializationErrorState;
|