@vlian/framework 1.2.57 → 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.
Files changed (685) hide show
  1. package/README.md +15 -3
  2. package/dist/analytics/index.cjs +1 -24
  3. package/dist/analytics/index.js +1 -3
  4. package/dist/analytics.umd.js +8 -208
  5. package/dist/components/LocaleSwitch.cjs +1 -118
  6. package/dist/components/LocaleSwitch.js +1 -103
  7. package/dist/components/ThemeSwitch.cjs +1 -117
  8. package/dist/components/ThemeSwitch.js +1 -102
  9. package/dist/components/index.cjs +1 -22
  10. package/dist/components/index.js +1 -4
  11. package/dist/components/persistence.cjs +1 -60
  12. package/dist/components/persistence.js +1 -39
  13. package/dist/core/Test.cjs +1 -66
  14. package/dist/core/Test.js +1 -15
  15. package/dist/core/app/AppContext.cjs +1 -350
  16. package/dist/core/app/AppContext.js +1 -339
  17. package/dist/core/app/AppContext.types.cjs +1 -6
  18. package/dist/core/app/AppContext.types.js +1 -5
  19. package/dist/core/app/BasicLayout.cjs +1 -124
  20. package/dist/core/app/BasicLayout.js +1 -74
  21. package/dist/core/app/DefaultApp.cjs +1 -152
  22. package/dist/core/app/DefaultApp.js +1 -143
  23. package/dist/core/app/index.cjs +1 -43
  24. package/dist/core/app/index.js +1 -7
  25. package/dist/core/config/AppConfig.cjs +1 -141
  26. package/dist/core/config/AppConfig.js +1 -133
  27. package/dist/core/config/ConfigLoader.cjs +1 -325
  28. package/dist/core/config/ConfigLoader.js +1 -311
  29. package/dist/core/config/ConfigValidator.cjs +2 -135
  30. package/dist/core/config/ConfigValidator.js +2 -121
  31. package/dist/core/config/index.cjs +1 -30
  32. package/dist/core/config/index.js +1 -7
  33. package/dist/core/dev/DevTools.cjs +1 -228
  34. package/dist/core/dev/DevTools.js +1 -210
  35. package/dist/core/error/ErrorBoundary.cjs +1 -403
  36. package/dist/core/error/ErrorBoundary.js +1 -399
  37. package/dist/core/error/ErrorHandler.cjs +1 -277
  38. package/dist/core/error/ErrorHandler.js +1 -261
  39. package/dist/core/error/index.cjs +1 -36
  40. package/dist/core/error/index.js +1 -6
  41. package/dist/core/event/AppEventBus.cjs +1 -446
  42. package/dist/core/event/AppEventBus.js +1 -438
  43. package/dist/core/event/frameworkEvents.cjs +1 -143
  44. package/dist/core/event/frameworkEvents.js +1 -135
  45. package/dist/core/event/hooks.cjs +1 -71
  46. package/dist/core/event/hooks.js +1 -95
  47. package/dist/core/event/index.cjs +1 -43
  48. package/dist/core/event/index.js +1 -10
  49. package/dist/core/event/types.cjs +1 -64
  50. package/dist/core/event/types.js +1 -56
  51. package/dist/core/event/useEventBus.cjs +1 -27
  52. package/dist/core/event/useEventBus.js +1 -39
  53. package/dist/core/index.cjs +1 -142
  54. package/dist/core/index.js +1 -69
  55. package/dist/core/initialization/InitializationErrorThrower.cjs +1 -77
  56. package/dist/core/initialization/InitializationErrorThrower.js +1 -30
  57. package/dist/core/initialization/index.cjs +1 -28
  58. package/dist/core/initialization/index.js +1 -7
  59. package/dist/core/initialization/initialization.cjs +1 -66
  60. package/dist/core/initialization/initialization.js +1 -78
  61. package/dist/core/initialization/initializationErrorState.cjs +1 -68
  62. package/dist/core/initialization/initializationErrorState.js +1 -60
  63. package/dist/core/kernel/defaultAdapters.cjs +1 -186
  64. package/dist/core/kernel/defaultAdapters.js +1 -176
  65. package/dist/core/kernel/errors.cjs +1 -71
  66. package/dist/core/kernel/errors.js +1 -53
  67. package/dist/core/kernel/index.cjs +1 -22
  68. package/dist/core/kernel/index.js +1 -4
  69. package/dist/core/kernel/startKernel.cjs +1 -202
  70. package/dist/core/kernel/startKernel.js +1 -192
  71. package/dist/core/kernel/types.cjs +1 -6
  72. package/dist/core/kernel/types.js +1 -3
  73. package/dist/core/middleware.cjs +1 -75
  74. package/dist/core/middleware.js +1 -61
  75. package/dist/core/plugin/PluginEventBus.cjs +1 -300
  76. package/dist/core/plugin/PluginEventBus.js +1 -286
  77. package/dist/core/plugin/PluginSandbox.cjs +1 -139
  78. package/dist/core/plugin/PluginSandbox.js +1 -125
  79. package/dist/core/plugin.cjs +1 -496
  80. package/dist/core/plugin.js +1 -438
  81. package/dist/core/router/RouterManager.cjs +1 -288
  82. package/dist/core/router/RouterManager.js +1 -272
  83. package/dist/core/router/adapter/AdapterManager.cjs +1 -237
  84. package/dist/core/router/adapter/AdapterManager.js +1 -221
  85. package/dist/core/router/adapter/index.cjs +1 -24
  86. package/dist/core/router/adapter/index.js +1 -7
  87. package/dist/core/router/adapter/react-router/ReactRouterAdapter.cjs +1 -130
  88. package/dist/core/router/adapter/react-router/ReactRouterAdapter.js +1 -116
  89. package/dist/core/router/adapter/react-router/index.cjs +1 -22
  90. package/dist/core/router/adapter/react-router/index.js +1 -5
  91. package/dist/core/router/adapter/types.cjs +1 -8
  92. package/dist/core/router/adapter/types.js +1 -7
  93. package/dist/core/router/dev/RouterDevTools.cjs +1 -262
  94. package/dist/core/router/dev/RouterDevTools.js +1 -211
  95. package/dist/core/router/dev/index.cjs +1 -22
  96. package/dist/core/router/dev/index.js +1 -5
  97. package/dist/core/router/dynamic/DynamicRouteManager.cjs +1 -195
  98. package/dist/core/router/dynamic/DynamicRouteManager.js +1 -179
  99. package/dist/core/router/dynamic/index.cjs +1 -22
  100. package/dist/core/router/dynamic/index.js +1 -5
  101. package/dist/core/router/errors/RouterError.cjs +1 -63
  102. package/dist/core/router/errors/RouterError.js +1 -48
  103. package/dist/core/router/errors/index.cjs +1 -22
  104. package/dist/core/router/errors/index.js +1 -5
  105. package/dist/core/router/index.cjs +1 -38
  106. package/dist/core/router/index.js +1 -32
  107. package/dist/core/router/lifecycle/RouterLifecycleManager.cjs +1 -146
  108. package/dist/core/router/lifecycle/RouterLifecycleManager.js +1 -130
  109. package/dist/core/router/lifecycle/index.cjs +1 -22
  110. package/dist/core/router/lifecycle/index.js +1 -5
  111. package/dist/core/router/middleware/RouterMiddlewareManager.cjs +1 -195
  112. package/dist/core/router/middleware/RouterMiddlewareManager.js +1 -179
  113. package/dist/core/router/middleware/auth.cjs +1 -68
  114. package/dist/core/router/middleware/auth.js +1 -63
  115. package/dist/core/router/middleware/index.cjs +1 -24
  116. package/dist/core/router/middleware/index.js +1 -7
  117. package/dist/core/router/middleware/types.cjs +1 -8
  118. package/dist/core/router/middleware/types.js +1 -7
  119. package/dist/core/router/monitoring/RouterMonitoring.cjs +1 -229
  120. package/dist/core/router/monitoring/RouterMonitoring.js +1 -213
  121. package/dist/core/router/monitoring/index.cjs +1 -22
  122. package/dist/core/router/monitoring/index.js +1 -5
  123. package/dist/core/router/navigation/RouterNavigation.cjs +1 -241
  124. package/dist/core/router/navigation/RouterNavigation.js +1 -192
  125. package/dist/core/router/navigation/index.cjs +1 -22
  126. package/dist/core/router/navigation/index.js +1 -5
  127. package/dist/core/router/performance/RouteCache.cjs +1 -307
  128. package/dist/core/router/performance/RouteCache.js +1 -291
  129. package/dist/core/router/performance/RoutePreloader.cjs +1 -294
  130. package/dist/core/router/performance/RoutePreloader.js +1 -277
  131. package/dist/core/router/performance/index.cjs +1 -23
  132. package/dist/core/router/performance/index.js +1 -6
  133. package/dist/core/router/plugin/RouterPluginManager.cjs +1 -264
  134. package/dist/core/router/plugin/RouterPluginManager.js +1 -248
  135. package/dist/core/router/plugin/index.cjs +1 -23
  136. package/dist/core/router/plugin/index.js +1 -6
  137. package/dist/core/router/plugin/types.cjs +1 -41
  138. package/dist/core/router/plugin/types.js +1 -33
  139. package/dist/core/router/types.cjs +1 -6
  140. package/dist/core/router/types.js +1 -5
  141. package/dist/core/router/utils/adapters/react-router/RouteErrorBoundary.cjs +1 -131
  142. package/dist/core/router/utils/adapters/react-router/RouteErrorBoundary.js +1 -121
  143. package/dist/core/router/utils/adapters/react-router/transform.cjs +1 -252
  144. package/dist/core/router/utils/adapters/react-router/transform.js +1 -242
  145. package/dist/core/router/utils/transform.cjs +1 -782
  146. package/dist/core/router/utils/transform.js +1 -791
  147. package/dist/core/router/validation/RouterConfigValidator.cjs +2 -85
  148. package/dist/core/router/validation/RouterConfigValidator.js +2 -77
  149. package/dist/core/router/validation/index.cjs +1 -23
  150. package/dist/core/router/validation/index.js +1 -6
  151. package/dist/core/router/validation/schema.cjs +1 -161
  152. package/dist/core/router/validation/schema.js +1 -151
  153. package/dist/core/router/version/RouteVersionManager.cjs +1 -207
  154. package/dist/core/router/version/RouteVersionManager.js +1 -191
  155. package/dist/core/router/version/index.cjs +1 -22
  156. package/dist/core/router/version/index.js +1 -5
  157. package/dist/core/splash/SplashScreen.cjs +1 -343
  158. package/dist/core/splash/SplashScreen.js +1 -293
  159. package/dist/core/splash/index.cjs +1 -24
  160. package/dist/core/splash/index.js +1 -6
  161. package/dist/core/splash/splashScreenUtils.cjs +1 -40
  162. package/dist/core/splash/splashScreenUtils.js +1 -30
  163. package/dist/core/startup/AppInstance.cjs +1 -241
  164. package/dist/core/startup/AppInstance.js +1 -226
  165. package/dist/core/startup/environment.cjs +1 -171
  166. package/dist/core/startup/environment.js +1 -154
  167. package/dist/core/startup/index.cjs +1 -25
  168. package/dist/core/startup/index.js +1 -8
  169. package/dist/core/startup/initializeServices.cjs +1 -228
  170. package/dist/core/startup/initializeServices.js +1 -188
  171. package/dist/core/startup/performanceTracker.cjs +1 -181
  172. package/dist/core/startup/performanceTracker.js +1 -167
  173. package/dist/core/startup/renderApp.cjs +1 -316
  174. package/dist/core/startup/renderApp.js +1 -267
  175. package/dist/core/startup/startApp.cjs +1 -319
  176. package/dist/core/startup/startApp.js +1 -315
  177. package/dist/core/types.cjs +1 -6
  178. package/dist/core/types.js +1 -5
  179. package/dist/index.cjs +1 -54
  180. package/dist/index.js +1 -11
  181. package/dist/index.umd.cjs +1 -29
  182. package/dist/index.umd.js +362 -13233
  183. package/dist/kernel/constants.cjs +1 -67
  184. package/dist/kernel/constants.js +1 -43
  185. package/dist/kernel/index.cjs +1 -40
  186. package/dist/kernel/index.js +1 -4
  187. package/dist/kernel/kernel.cjs +1 -297
  188. package/dist/kernel/kernel.js +1 -273
  189. package/dist/kernel/manager/cacheManager.cjs +1 -48
  190. package/dist/kernel/manager/cacheManager.js +1 -38
  191. package/dist/kernel/manager/i18n/I18nManager.cjs +1 -93
  192. package/dist/kernel/manager/i18n/I18nManager.js +1 -83
  193. package/dist/kernel/manager/i18n/i18n.persistence.cjs +1 -62
  194. package/dist/kernel/manager/i18n/i18n.persistence.js +1 -41
  195. package/dist/kernel/manager/i18n/i18n.schema.cjs +1 -88
  196. package/dist/kernel/manager/i18n/i18n.schema.js +1 -64
  197. package/dist/kernel/manager/i18n/index.cjs +1 -13
  198. package/dist/kernel/manager/i18n/index.js +1 -3
  199. package/dist/kernel/manager/i18nManager.cjs +1 -13
  200. package/dist/kernel/manager/i18nManager.js +1 -3
  201. package/dist/kernel/manager/index.cjs +1 -30
  202. package/dist/kernel/manager/index.js +1 -6
  203. package/dist/kernel/manager/logger/LoggerManager.cjs +1 -109
  204. package/dist/kernel/manager/logger/LoggerManager.js +1 -99
  205. package/dist/kernel/manager/logger/index.cjs +1 -13
  206. package/dist/kernel/manager/logger/index.js +1 -3
  207. package/dist/kernel/manager/logger/logger.persistence.cjs +1 -64
  208. package/dist/kernel/manager/logger/logger.persistence.js +1 -43
  209. package/dist/kernel/manager/logger/logger.schema.cjs +1 -76
  210. package/dist/kernel/manager/logger/logger.schema.js +1 -55
  211. package/dist/kernel/manager/loggerManager.cjs +1 -13
  212. package/dist/kernel/manager/loggerManager.js +1 -3
  213. package/dist/kernel/manager/theme/ThemeManager.cjs +1 -86
  214. package/dist/kernel/manager/theme/ThemeManager.js +1 -76
  215. package/dist/kernel/manager/theme/index.cjs +1 -13
  216. package/dist/kernel/manager/theme/index.js +1 -3
  217. package/dist/kernel/manager/theme/theme.dom.cjs +1 -63
  218. package/dist/kernel/manager/theme/theme.dom.js +1 -45
  219. package/dist/kernel/manager/theme/theme.persistence.cjs +1 -59
  220. package/dist/kernel/manager/theme/theme.persistence.js +1 -38
  221. package/dist/kernel/manager/theme/theme.schema.cjs +1 -124
  222. package/dist/kernel/manager/theme/theme.schema.js +1 -97
  223. package/dist/kernel/manager/themeManager.cjs +1 -13
  224. package/dist/kernel/manager/themeManager.js +1 -3
  225. package/dist/kernel/types.cjs +1 -6
  226. package/dist/kernel/types.js +1 -3
  227. package/dist/library/index.cjs +1 -21
  228. package/dist/library/index.js +1 -4
  229. package/dist/library/locale/index.cjs +1 -41
  230. package/dist/library/locale/index.js +1 -12
  231. package/dist/library/locale/langs/en-us/index.cjs +1 -34
  232. package/dist/library/locale/langs/en-us/index.js +1 -24
  233. package/dist/library/locale/langs/zh-cn/index.cjs +1 -34
  234. package/dist/library/locale/langs/zh-cn/index.js +1 -24
  235. package/dist/library/locale/types.cjs +1 -6
  236. package/dist/library/locale/types.js +1 -3
  237. package/dist/library/storage/cache.cjs +1 -245
  238. package/dist/library/storage/cache.js +1 -237
  239. package/dist/library/storage/encryption.cjs +1 -149
  240. package/dist/library/storage/encryption.js +1 -141
  241. package/dist/library/storage/index.cjs +1 -126
  242. package/dist/library/storage/index.js +1 -106
  243. package/dist/state/StateManager.cjs +1 -168
  244. package/dist/state/StateManager.js +1 -160
  245. package/dist/state/adapters/AdapterFactory.cjs +1 -91
  246. package/dist/state/adapters/AdapterFactory.js +1 -85
  247. package/dist/state/adapters/DefaultAdapter.cjs +1 -77
  248. package/dist/state/adapters/DefaultAdapter.js +1 -71
  249. package/dist/state/adapters/ReduxAdapter.cjs +1 -445
  250. package/dist/state/adapters/ReduxAdapter.js +1 -439
  251. package/dist/state/adapters/ZustandAdapter.cjs +1 -71
  252. package/dist/state/adapters/ZustandAdapter.js +1 -70
  253. package/dist/state/adapters/index.cjs +1 -46
  254. package/dist/state/adapters/index.js +1 -9
  255. package/dist/state/adapters/types.cjs +1 -22
  256. package/dist/state/adapters/types.js +1 -5
  257. package/dist/state/core/DerivedStateInstance.cjs +1 -176
  258. package/dist/state/core/DerivedStateInstance.js +1 -173
  259. package/dist/state/core/StateInstance.cjs +1 -172
  260. package/dist/state/core/StateInstance.js +1 -168
  261. package/dist/state/core/StateRegistry.cjs +1 -112
  262. package/dist/state/core/StateRegistry.js +1 -106
  263. package/dist/state/core/StateScope.cjs +1 -139
  264. package/dist/state/core/StateScope.js +1 -133
  265. package/dist/state/core/index.cjs +1 -32
  266. package/dist/state/core/index.js +1 -8
  267. package/dist/state/index.cjs +1 -32
  268. package/dist/state/index.js +1 -12
  269. package/dist/state/types.cjs +1 -14
  270. package/dist/state/types.js +1 -13
  271. package/dist/state.umd.js +22 -1395
  272. package/dist/types.cjs +1 -6
  273. package/dist/types.js +1 -3
  274. package/dist/utils/analytics.cjs +1 -219
  275. package/dist/utils/analytics.js +1 -204
  276. package/dist/utils/configSecurity.cjs +3 -184
  277. package/dist/utils/configSecurity.js +3 -176
  278. package/dist/utils/csrf.cjs +1 -20
  279. package/dist/utils/csrf.js +1 -3
  280. package/dist/utils/errors/ErrorCodes.cjs +1 -27
  281. package/dist/utils/errors/ErrorCodes.js +1 -3
  282. package/dist/utils/errors.cjs +1 -113
  283. package/dist/utils/errors.js +1 -18
  284. package/dist/utils/index.cjs +1 -137
  285. package/dist/utils/index.js +1 -48
  286. package/dist/utils/logger.cjs +1 -27
  287. package/dist/utils/logger.js +1 -3
  288. package/dist/utils/logger.types.cjs +1 -13
  289. package/dist/utils/logger.types.js +1 -3
  290. package/dist/utils/monitoring.cjs +1 -20
  291. package/dist/utils/monitoring.js +1 -3
  292. package/dist/utils/performance.cjs +1 -24
  293. package/dist/utils/performance.js +1 -3
  294. package/dist/utils/resourceLoader.cjs +1 -24
  295. package/dist/utils/resourceLoader.js +1 -3
  296. package/dist/utils/runtimeSecurity.cjs +1 -13
  297. package/dist/utils/runtimeSecurity.js +1 -3
  298. package/dist/utils/security.cjs +1 -21
  299. package/dist/utils/security.js +1 -3
  300. package/dist/utils/traceId.cjs +1 -39
  301. package/dist/utils/traceId.js +1 -3
  302. package/dist/utils/validation.cjs +1 -21
  303. package/dist/utils/validation.js +1 -3
  304. package/package.json +9 -6
  305. package/dist/analytics/index.cjs.map +0 -1
  306. package/dist/analytics/index.js.map +0 -1
  307. package/dist/analytics.umd.js.map +0 -1
  308. package/dist/components/LocaleSwitch.cjs.map +0 -1
  309. package/dist/components/LocaleSwitch.js.map +0 -1
  310. package/dist/components/ThemeSwitch.cjs.map +0 -1
  311. package/dist/components/ThemeSwitch.js.map +0 -1
  312. package/dist/components/index.cjs.map +0 -1
  313. package/dist/components/index.js.map +0 -1
  314. package/dist/components/persistence.cjs.map +0 -1
  315. package/dist/components/persistence.js.map +0 -1
  316. package/dist/core/Test.cjs.map +0 -1
  317. package/dist/core/Test.js.map +0 -1
  318. package/dist/core/app/AppContext.cjs.map +0 -1
  319. package/dist/core/app/AppContext.js.map +0 -1
  320. package/dist/core/app/AppContext.types.cjs.map +0 -1
  321. package/dist/core/app/AppContext.types.js.map +0 -1
  322. package/dist/core/app/BasicLayout.cjs.map +0 -1
  323. package/dist/core/app/BasicLayout.js.map +0 -1
  324. package/dist/core/app/DefaultApp.cjs.map +0 -1
  325. package/dist/core/app/DefaultApp.js.map +0 -1
  326. package/dist/core/app/index.cjs.map +0 -1
  327. package/dist/core/app/index.js.map +0 -1
  328. package/dist/core/config/AppConfig.cjs.map +0 -1
  329. package/dist/core/config/AppConfig.js.map +0 -1
  330. package/dist/core/config/ConfigLoader.cjs.map +0 -1
  331. package/dist/core/config/ConfigLoader.js.map +0 -1
  332. package/dist/core/config/ConfigValidator.cjs.map +0 -1
  333. package/dist/core/config/ConfigValidator.js.map +0 -1
  334. package/dist/core/config/index.cjs.map +0 -1
  335. package/dist/core/config/index.js.map +0 -1
  336. package/dist/core/dev/DevTools.cjs.map +0 -1
  337. package/dist/core/dev/DevTools.js.map +0 -1
  338. package/dist/core/error/ErrorBoundary.cjs.map +0 -1
  339. package/dist/core/error/ErrorBoundary.js.map +0 -1
  340. package/dist/core/error/ErrorHandler.cjs.map +0 -1
  341. package/dist/core/error/ErrorHandler.js.map +0 -1
  342. package/dist/core/error/index.cjs.map +0 -1
  343. package/dist/core/error/index.js.map +0 -1
  344. package/dist/core/event/AppEventBus.cjs.map +0 -1
  345. package/dist/core/event/AppEventBus.js.map +0 -1
  346. package/dist/core/event/frameworkEvents.cjs.map +0 -1
  347. package/dist/core/event/frameworkEvents.js.map +0 -1
  348. package/dist/core/event/hooks.cjs.map +0 -1
  349. package/dist/core/event/hooks.js.map +0 -1
  350. package/dist/core/event/index.cjs.map +0 -1
  351. package/dist/core/event/index.js.map +0 -1
  352. package/dist/core/event/types.cjs.map +0 -1
  353. package/dist/core/event/types.js.map +0 -1
  354. package/dist/core/event/useEventBus.cjs.map +0 -1
  355. package/dist/core/event/useEventBus.js.map +0 -1
  356. package/dist/core/index.cjs.map +0 -1
  357. package/dist/core/index.js.map +0 -1
  358. package/dist/core/initialization/InitializationErrorThrower.cjs.map +0 -1
  359. package/dist/core/initialization/InitializationErrorThrower.js.map +0 -1
  360. package/dist/core/initialization/index.cjs.map +0 -1
  361. package/dist/core/initialization/index.js.map +0 -1
  362. package/dist/core/initialization/initialization.cjs.map +0 -1
  363. package/dist/core/initialization/initialization.js.map +0 -1
  364. package/dist/core/initialization/initializationErrorState.cjs.map +0 -1
  365. package/dist/core/initialization/initializationErrorState.js.map +0 -1
  366. package/dist/core/kernel/defaultAdapters.cjs.map +0 -1
  367. package/dist/core/kernel/defaultAdapters.js.map +0 -1
  368. package/dist/core/kernel/errors.cjs.map +0 -1
  369. package/dist/core/kernel/errors.js.map +0 -1
  370. package/dist/core/kernel/index.cjs.map +0 -1
  371. package/dist/core/kernel/index.js.map +0 -1
  372. package/dist/core/kernel/startKernel.cjs.map +0 -1
  373. package/dist/core/kernel/startKernel.js.map +0 -1
  374. package/dist/core/kernel/types.cjs.map +0 -1
  375. package/dist/core/kernel/types.js.map +0 -1
  376. package/dist/core/middleware.cjs.map +0 -1
  377. package/dist/core/middleware.js.map +0 -1
  378. package/dist/core/plugin/PluginEventBus.cjs.map +0 -1
  379. package/dist/core/plugin/PluginEventBus.js.map +0 -1
  380. package/dist/core/plugin/PluginSandbox.cjs.map +0 -1
  381. package/dist/core/plugin/PluginSandbox.js.map +0 -1
  382. package/dist/core/plugin.cjs.map +0 -1
  383. package/dist/core/plugin.js.map +0 -1
  384. package/dist/core/router/RouterManager.cjs.map +0 -1
  385. package/dist/core/router/RouterManager.js.map +0 -1
  386. package/dist/core/router/adapter/AdapterManager.cjs.map +0 -1
  387. package/dist/core/router/adapter/AdapterManager.js.map +0 -1
  388. package/dist/core/router/adapter/index.cjs.map +0 -1
  389. package/dist/core/router/adapter/index.js.map +0 -1
  390. package/dist/core/router/adapter/react-router/ReactRouterAdapter.cjs.map +0 -1
  391. package/dist/core/router/adapter/react-router/ReactRouterAdapter.js.map +0 -1
  392. package/dist/core/router/adapter/react-router/index.cjs.map +0 -1
  393. package/dist/core/router/adapter/react-router/index.js.map +0 -1
  394. package/dist/core/router/adapter/types.cjs.map +0 -1
  395. package/dist/core/router/adapter/types.js.map +0 -1
  396. package/dist/core/router/dev/RouterDevTools.cjs.map +0 -1
  397. package/dist/core/router/dev/RouterDevTools.js.map +0 -1
  398. package/dist/core/router/dev/index.cjs.map +0 -1
  399. package/dist/core/router/dev/index.js.map +0 -1
  400. package/dist/core/router/dynamic/DynamicRouteManager.cjs.map +0 -1
  401. package/dist/core/router/dynamic/DynamicRouteManager.js.map +0 -1
  402. package/dist/core/router/dynamic/index.cjs.map +0 -1
  403. package/dist/core/router/dynamic/index.js.map +0 -1
  404. package/dist/core/router/errors/RouterError.cjs.map +0 -1
  405. package/dist/core/router/errors/RouterError.js.map +0 -1
  406. package/dist/core/router/errors/index.cjs.map +0 -1
  407. package/dist/core/router/errors/index.js.map +0 -1
  408. package/dist/core/router/index.cjs.map +0 -1
  409. package/dist/core/router/index.js.map +0 -1
  410. package/dist/core/router/lifecycle/RouterLifecycleManager.cjs.map +0 -1
  411. package/dist/core/router/lifecycle/RouterLifecycleManager.js.map +0 -1
  412. package/dist/core/router/lifecycle/index.cjs.map +0 -1
  413. package/dist/core/router/lifecycle/index.js.map +0 -1
  414. package/dist/core/router/middleware/RouterMiddlewareManager.cjs.map +0 -1
  415. package/dist/core/router/middleware/RouterMiddlewareManager.js.map +0 -1
  416. package/dist/core/router/middleware/auth.cjs.map +0 -1
  417. package/dist/core/router/middleware/auth.js.map +0 -1
  418. package/dist/core/router/middleware/index.cjs.map +0 -1
  419. package/dist/core/router/middleware/index.js.map +0 -1
  420. package/dist/core/router/middleware/types.cjs.map +0 -1
  421. package/dist/core/router/middleware/types.js.map +0 -1
  422. package/dist/core/router/monitoring/RouterMonitoring.cjs.map +0 -1
  423. package/dist/core/router/monitoring/RouterMonitoring.js.map +0 -1
  424. package/dist/core/router/monitoring/index.cjs.map +0 -1
  425. package/dist/core/router/monitoring/index.js.map +0 -1
  426. package/dist/core/router/navigation/RouterNavigation.cjs.map +0 -1
  427. package/dist/core/router/navigation/RouterNavigation.js.map +0 -1
  428. package/dist/core/router/navigation/index.cjs.map +0 -1
  429. package/dist/core/router/navigation/index.js.map +0 -1
  430. package/dist/core/router/performance/RouteCache.cjs.map +0 -1
  431. package/dist/core/router/performance/RouteCache.js.map +0 -1
  432. package/dist/core/router/performance/RoutePreloader.cjs.map +0 -1
  433. package/dist/core/router/performance/RoutePreloader.js.map +0 -1
  434. package/dist/core/router/performance/index.cjs.map +0 -1
  435. package/dist/core/router/performance/index.js.map +0 -1
  436. package/dist/core/router/plugin/RouterPluginManager.cjs.map +0 -1
  437. package/dist/core/router/plugin/RouterPluginManager.js.map +0 -1
  438. package/dist/core/router/plugin/index.cjs.map +0 -1
  439. package/dist/core/router/plugin/index.js.map +0 -1
  440. package/dist/core/router/plugin/types.cjs.map +0 -1
  441. package/dist/core/router/plugin/types.js.map +0 -1
  442. package/dist/core/router/types.cjs.map +0 -1
  443. package/dist/core/router/types.js.map +0 -1
  444. package/dist/core/router/utils/adapters/react-router/RouteErrorBoundary.cjs.map +0 -1
  445. package/dist/core/router/utils/adapters/react-router/RouteErrorBoundary.js.map +0 -1
  446. package/dist/core/router/utils/adapters/react-router/transform.cjs.map +0 -1
  447. package/dist/core/router/utils/adapters/react-router/transform.js.map +0 -1
  448. package/dist/core/router/utils/transform.cjs.map +0 -1
  449. package/dist/core/router/utils/transform.js.map +0 -1
  450. package/dist/core/router/validation/RouterConfigValidator.cjs.map +0 -1
  451. package/dist/core/router/validation/RouterConfigValidator.js.map +0 -1
  452. package/dist/core/router/validation/index.cjs.map +0 -1
  453. package/dist/core/router/validation/index.js.map +0 -1
  454. package/dist/core/router/validation/schema.cjs.map +0 -1
  455. package/dist/core/router/validation/schema.js.map +0 -1
  456. package/dist/core/router/version/RouteVersionManager.cjs.map +0 -1
  457. package/dist/core/router/version/RouteVersionManager.js.map +0 -1
  458. package/dist/core/router/version/index.cjs.map +0 -1
  459. package/dist/core/router/version/index.js.map +0 -1
  460. package/dist/core/splash/SplashScreen.cjs.map +0 -1
  461. package/dist/core/splash/SplashScreen.js.map +0 -1
  462. package/dist/core/splash/index.cjs.map +0 -1
  463. package/dist/core/splash/index.js.map +0 -1
  464. package/dist/core/splash/splashScreenUtils.cjs.map +0 -1
  465. package/dist/core/splash/splashScreenUtils.js.map +0 -1
  466. package/dist/core/startup/AppInstance.cjs.map +0 -1
  467. package/dist/core/startup/AppInstance.js.map +0 -1
  468. package/dist/core/startup/environment.cjs.map +0 -1
  469. package/dist/core/startup/environment.js.map +0 -1
  470. package/dist/core/startup/index.cjs.map +0 -1
  471. package/dist/core/startup/index.js.map +0 -1
  472. package/dist/core/startup/initializeServices.cjs.map +0 -1
  473. package/dist/core/startup/initializeServices.js.map +0 -1
  474. package/dist/core/startup/performanceTracker.cjs.map +0 -1
  475. package/dist/core/startup/performanceTracker.js.map +0 -1
  476. package/dist/core/startup/renderApp.cjs.map +0 -1
  477. package/dist/core/startup/renderApp.js.map +0 -1
  478. package/dist/core/startup/startApp.cjs.map +0 -1
  479. package/dist/core/startup/startApp.js.map +0 -1
  480. package/dist/core/types.cjs.map +0 -1
  481. package/dist/core/types.js.map +0 -1
  482. package/dist/index.cjs.map +0 -1
  483. package/dist/index.js.map +0 -1
  484. package/dist/index.umd.cjs.map +0 -1
  485. package/dist/index.umd.js.map +0 -1
  486. package/dist/kernel/constants.cjs.map +0 -1
  487. package/dist/kernel/constants.js.map +0 -1
  488. package/dist/kernel/index.cjs.map +0 -1
  489. package/dist/kernel/index.js.map +0 -1
  490. package/dist/kernel/kernel.cjs.map +0 -1
  491. package/dist/kernel/kernel.js.map +0 -1
  492. package/dist/kernel/manager/cacheManager.cjs.map +0 -1
  493. package/dist/kernel/manager/cacheManager.js.map +0 -1
  494. package/dist/kernel/manager/i18n/I18nManager.cjs.map +0 -1
  495. package/dist/kernel/manager/i18n/I18nManager.js.map +0 -1
  496. package/dist/kernel/manager/i18n/i18n.persistence.cjs.map +0 -1
  497. package/dist/kernel/manager/i18n/i18n.persistence.js.map +0 -1
  498. package/dist/kernel/manager/i18n/i18n.schema.cjs.map +0 -1
  499. package/dist/kernel/manager/i18n/i18n.schema.js.map +0 -1
  500. package/dist/kernel/manager/i18n/index.cjs.map +0 -1
  501. package/dist/kernel/manager/i18n/index.js.map +0 -1
  502. package/dist/kernel/manager/i18nManager.cjs.map +0 -1
  503. package/dist/kernel/manager/i18nManager.js.map +0 -1
  504. package/dist/kernel/manager/index.cjs.map +0 -1
  505. package/dist/kernel/manager/index.js.map +0 -1
  506. package/dist/kernel/manager/logger/LoggerManager.cjs.map +0 -1
  507. package/dist/kernel/manager/logger/LoggerManager.js.map +0 -1
  508. package/dist/kernel/manager/logger/index.cjs.map +0 -1
  509. package/dist/kernel/manager/logger/index.js.map +0 -1
  510. package/dist/kernel/manager/logger/logger.persistence.cjs.map +0 -1
  511. package/dist/kernel/manager/logger/logger.persistence.js.map +0 -1
  512. package/dist/kernel/manager/logger/logger.schema.cjs.map +0 -1
  513. package/dist/kernel/manager/logger/logger.schema.js.map +0 -1
  514. package/dist/kernel/manager/loggerManager.cjs.map +0 -1
  515. package/dist/kernel/manager/loggerManager.js.map +0 -1
  516. package/dist/kernel/manager/persistence.cjs +0 -78
  517. package/dist/kernel/manager/persistence.cjs.map +0 -1
  518. package/dist/kernel/manager/persistence.d.ts +0 -3
  519. package/dist/kernel/manager/persistence.js +0 -60
  520. package/dist/kernel/manager/persistence.js.map +0 -1
  521. package/dist/kernel/manager/theme/ThemeManager.cjs.map +0 -1
  522. package/dist/kernel/manager/theme/ThemeManager.js.map +0 -1
  523. package/dist/kernel/manager/theme/index.cjs.map +0 -1
  524. package/dist/kernel/manager/theme/index.js.map +0 -1
  525. package/dist/kernel/manager/theme/theme.dom.cjs.map +0 -1
  526. package/dist/kernel/manager/theme/theme.dom.js.map +0 -1
  527. package/dist/kernel/manager/theme/theme.persistence.cjs.map +0 -1
  528. package/dist/kernel/manager/theme/theme.persistence.js.map +0 -1
  529. package/dist/kernel/manager/theme/theme.schema.cjs.map +0 -1
  530. package/dist/kernel/manager/theme/theme.schema.js.map +0 -1
  531. package/dist/kernel/manager/themeManager.cjs.map +0 -1
  532. package/dist/kernel/manager/themeManager.js.map +0 -1
  533. package/dist/kernel/types.cjs.map +0 -1
  534. package/dist/kernel/types.js.map +0 -1
  535. package/dist/library/index.cjs.map +0 -1
  536. package/dist/library/index.js.map +0 -1
  537. package/dist/library/locale/index.cjs.map +0 -1
  538. package/dist/library/locale/index.js.map +0 -1
  539. package/dist/library/locale/langs/en-us/index.cjs.map +0 -1
  540. package/dist/library/locale/langs/en-us/index.js.map +0 -1
  541. package/dist/library/locale/langs/zh-cn/index.cjs.map +0 -1
  542. package/dist/library/locale/langs/zh-cn/index.js.map +0 -1
  543. package/dist/library/locale/types.cjs.map +0 -1
  544. package/dist/library/locale/types.js.map +0 -1
  545. package/dist/library/storage/cache.cjs.map +0 -1
  546. package/dist/library/storage/cache.js.map +0 -1
  547. package/dist/library/storage/encryption.cjs.map +0 -1
  548. package/dist/library/storage/encryption.js.map +0 -1
  549. package/dist/library/storage/index.cjs.map +0 -1
  550. package/dist/library/storage/index.js.map +0 -1
  551. package/dist/request/adapter/RequestAdapter.d.ts +0 -85
  552. package/dist/request/adapter/RequestAdapter.js +0 -70
  553. package/dist/request/adapter/RequestAdapter.js.map +0 -1
  554. package/dist/request/adapter/axiosAdapter.d.ts +0 -10
  555. package/dist/request/adapter/axiosAdapter.js +0 -115
  556. package/dist/request/adapter/axiosAdapter.js.map +0 -1
  557. package/dist/request/adapter/fetchAdapter.d.ts +0 -10
  558. package/dist/request/adapter/fetchAdapter.js +0 -126
  559. package/dist/request/adapter/fetchAdapter.js.map +0 -1
  560. package/dist/request/adapter/index.d.ts +0 -9
  561. package/dist/request/adapter/index.js +0 -14
  562. package/dist/request/adapter/index.js.map +0 -1
  563. package/dist/request/adapter/kyAdapter.d.ts +0 -10
  564. package/dist/request/adapter/kyAdapter.js +0 -142
  565. package/dist/request/adapter/kyAdapter.js.map +0 -1
  566. package/dist/request/adapter/undiciAdapter.d.ts +0 -10
  567. package/dist/request/adapter/undiciAdapter.js +0 -164
  568. package/dist/request/adapter/undiciAdapter.js.map +0 -1
  569. package/dist/request/adapter.d.ts +0 -1
  570. package/dist/request/core/RequestClient.d.ts +0 -134
  571. package/dist/request/core/RequestClient.js +0 -509
  572. package/dist/request/core/RequestClient.js.map +0 -1
  573. package/dist/request/core/index.d.ts +0 -5
  574. package/dist/request/core/index.js +0 -5
  575. package/dist/request/core/index.js.map +0 -1
  576. package/dist/request/core.d.ts +0 -1
  577. package/dist/request/index.d.ts +0 -1
  578. package/dist/request/index.js +0 -50
  579. package/dist/request/index.js.map +0 -1
  580. package/dist/request/plugin/RequestPlugin.d.ts +0 -170
  581. package/dist/request/plugin/RequestPlugin.js +0 -203
  582. package/dist/request/plugin/RequestPlugin.js.map +0 -1
  583. package/dist/request/plugin/cache.d.ts +0 -33
  584. package/dist/request/plugin/cache.js +0 -264
  585. package/dist/request/plugin/cache.js.map +0 -1
  586. package/dist/request/plugin/csrfPlugin.d.ts +0 -21
  587. package/dist/request/plugin/csrfPlugin.js +0 -44
  588. package/dist/request/plugin/csrfPlugin.js.map +0 -1
  589. package/dist/request/plugin/index.d.ts +0 -11
  590. package/dist/request/plugin/index.js +0 -12
  591. package/dist/request/plugin/index.js.map +0 -1
  592. package/dist/request/plugin/monitoring.d.ts +0 -112
  593. package/dist/request/plugin/monitoring.js +0 -205
  594. package/dist/request/plugin/monitoring.js.map +0 -1
  595. package/dist/request/plugin/queue.d.ts +0 -91
  596. package/dist/request/plugin/queue.js +0 -156
  597. package/dist/request/plugin/queue.js.map +0 -1
  598. package/dist/request/plugin/retry.d.ts +0 -34
  599. package/dist/request/plugin/retry.js +0 -93
  600. package/dist/request/plugin/retry.js.map +0 -1
  601. package/dist/request/plugin/validation.d.ts +0 -26
  602. package/dist/request/plugin/validation.js +0 -116
  603. package/dist/request/plugin/validation.js.map +0 -1
  604. package/dist/request/plugin.d.ts +0 -1
  605. package/dist/request/runtime/RequestContext.d.ts +0 -50
  606. package/dist/request/runtime/RequestContext.js +0 -86
  607. package/dist/request/runtime/RequestContext.js.map +0 -1
  608. package/dist/request/runtime/index.d.ts +0 -4
  609. package/dist/request/runtime/index.js +0 -5
  610. package/dist/request/runtime/index.js.map +0 -1
  611. package/dist/request/runtime.d.ts +0 -1
  612. package/dist/request/types.d.ts +0 -1
  613. package/dist/request/types.js +0 -97
  614. package/dist/request/types.js.map +0 -1
  615. package/dist/request/utils/RequestQueueManager.d.ts +0 -74
  616. package/dist/request/utils/RequestQueueManager.js +0 -160
  617. package/dist/request/utils/RequestQueueManager.js.map +0 -1
  618. package/dist/request/utils/dependencyCheck.d.ts +0 -63
  619. package/dist/request/utils/dependencyCheck.js +0 -192
  620. package/dist/request/utils/dependencyCheck.js.map +0 -1
  621. package/dist/request/utils/index.d.ts +0 -5
  622. package/dist/request/utils/index.js +0 -6
  623. package/dist/request/utils/index.js.map +0 -1
  624. package/dist/request/utils.d.ts +0 -1
  625. package/dist/state/StateManager.cjs.map +0 -1
  626. package/dist/state/StateManager.js.map +0 -1
  627. package/dist/state/adapters/AdapterFactory.cjs.map +0 -1
  628. package/dist/state/adapters/AdapterFactory.js.map +0 -1
  629. package/dist/state/adapters/DefaultAdapter.cjs.map +0 -1
  630. package/dist/state/adapters/DefaultAdapter.js.map +0 -1
  631. package/dist/state/adapters/ReduxAdapter.cjs.map +0 -1
  632. package/dist/state/adapters/ReduxAdapter.js.map +0 -1
  633. package/dist/state/adapters/ZustandAdapter.cjs.map +0 -1
  634. package/dist/state/adapters/ZustandAdapter.js.map +0 -1
  635. package/dist/state/adapters/index.cjs.map +0 -1
  636. package/dist/state/adapters/index.js.map +0 -1
  637. package/dist/state/adapters/types.cjs.map +0 -1
  638. package/dist/state/adapters/types.js.map +0 -1
  639. package/dist/state/core/DerivedStateInstance.cjs.map +0 -1
  640. package/dist/state/core/DerivedStateInstance.js.map +0 -1
  641. package/dist/state/core/StateInstance.cjs.map +0 -1
  642. package/dist/state/core/StateInstance.js.map +0 -1
  643. package/dist/state/core/StateRegistry.cjs.map +0 -1
  644. package/dist/state/core/StateRegistry.js.map +0 -1
  645. package/dist/state/core/StateScope.cjs.map +0 -1
  646. package/dist/state/core/StateScope.js.map +0 -1
  647. package/dist/state/core/index.cjs.map +0 -1
  648. package/dist/state/core/index.js.map +0 -1
  649. package/dist/state/index.cjs.map +0 -1
  650. package/dist/state/index.js.map +0 -1
  651. package/dist/state/types.cjs.map +0 -1
  652. package/dist/state/types.js.map +0 -1
  653. package/dist/state.umd.js.map +0 -1
  654. package/dist/types.cjs.map +0 -1
  655. package/dist/types.js.map +0 -1
  656. package/dist/utils/analytics.cjs.map +0 -1
  657. package/dist/utils/analytics.js.map +0 -1
  658. package/dist/utils/configSecurity.cjs.map +0 -1
  659. package/dist/utils/configSecurity.js.map +0 -1
  660. package/dist/utils/csrf.cjs.map +0 -1
  661. package/dist/utils/csrf.js.map +0 -1
  662. package/dist/utils/errors/ErrorCodes.cjs.map +0 -1
  663. package/dist/utils/errors/ErrorCodes.js.map +0 -1
  664. package/dist/utils/errors.cjs.map +0 -1
  665. package/dist/utils/errors.js.map +0 -1
  666. package/dist/utils/index.cjs.map +0 -1
  667. package/dist/utils/index.js.map +0 -1
  668. package/dist/utils/logger.cjs.map +0 -1
  669. package/dist/utils/logger.js.map +0 -1
  670. package/dist/utils/logger.types.cjs.map +0 -1
  671. package/dist/utils/logger.types.js.map +0 -1
  672. package/dist/utils/monitoring.cjs.map +0 -1
  673. package/dist/utils/monitoring.js.map +0 -1
  674. package/dist/utils/performance.cjs.map +0 -1
  675. package/dist/utils/performance.js.map +0 -1
  676. package/dist/utils/resourceLoader.cjs.map +0 -1
  677. package/dist/utils/resourceLoader.js.map +0 -1
  678. package/dist/utils/runtimeSecurity.cjs.map +0 -1
  679. package/dist/utils/runtimeSecurity.js.map +0 -1
  680. package/dist/utils/security.cjs.map +0 -1
  681. package/dist/utils/security.js.map +0 -1
  682. package/dist/utils/traceId.cjs.map +0 -1
  683. package/dist/utils/traceId.js.map +0 -1
  684. package/dist/utils/validation.cjs.map +0 -1
  685. package/dist/utils/validation.js.map +0 -1
@@ -1,438 +1 @@
1
- function _define_property(obj, key, value) {
2
- if (key in obj) {
3
- Object.defineProperty(obj, key, {
4
- value: value,
5
- enumerable: true,
6
- configurable: true,
7
- writable: true
8
- });
9
- } else {
10
- obj[key] = value;
11
- }
12
- return obj;
13
- }
14
- import { PluginSandbox } from "./plugin/PluginSandbox";
15
- import { pluginEventBus } from "./plugin/PluginEventBus";
16
- /**
17
- * 插件管理器
18
- *
19
- * 优化:
20
- * 1. 支持插件依赖管理
21
- * 2. 支持插件优先级控制
22
- * 3. 支持插件生命周期管理
23
- * 4. 支持插件热插拔(动态加载/卸载)
24
- */ export class PluginManager {
25
- /**
26
- * 注册插件
27
- *
28
- * 优化:检查插件依赖是否已注册
29
- */ register(plugin) {
30
- if (this.plugins.has(plugin.name)) {
31
- console.warn(`插件 ${plugin.name} 已存在,将被覆盖`);
32
- }
33
- // 检查依赖是否已注册
34
- if (plugin.dependencies && plugin.dependencies.length > 0) {
35
- const missingDeps = plugin.dependencies.filter((dep)=>!this.plugins.has(dep));
36
- if (missingDeps.length > 0) {
37
- console.warn(`插件 ${plugin.name} 的依赖未注册: ${missingDeps.join(', ')}`);
38
- }
39
- }
40
- this.plugins.set(plugin.name, plugin);
41
- this.pluginStatus.set(plugin.name, 'registered');
42
- // 创建插件沙箱
43
- if (plugin.sandbox) {
44
- const sandbox = new PluginSandbox({
45
- ...plugin.sandbox,
46
- name: plugin.name
47
- });
48
- this.sandboxes.set(plugin.name, sandbox);
49
- } else {
50
- // 如果没有配置沙箱,创建默认沙箱(非严格模式)
51
- const sandbox = new PluginSandbox({
52
- strictMode: false,
53
- name: plugin.name
54
- });
55
- this.sandboxes.set(plugin.name, sandbox);
56
- }
57
- }
58
- /**
59
- * 获取插件加载顺序(考虑依赖和优先级)
60
- *
61
- * @returns 插件名称数组,按加载顺序排列
62
- */ getLoadOrder() {
63
- const plugins = Array.from(this.plugins.values());
64
- // 按优先级排序
65
- const sortedPlugins = plugins.sort((a, b)=>{
66
- const priorityA = a.priority ?? 100;
67
- const priorityB = b.priority ?? 100;
68
- return priorityA - priorityB;
69
- });
70
- // 构建依赖图并拓扑排序
71
- const visited = new Set();
72
- const visiting = new Set();
73
- const result = [];
74
- const visit = (pluginName)=>{
75
- if (visiting.has(pluginName)) {
76
- console.warn(`检测到循环依赖,涉及插件: ${pluginName}`);
77
- return;
78
- }
79
- if (visited.has(pluginName)) {
80
- return;
81
- }
82
- visiting.add(pluginName);
83
- const plugin = this.plugins.get(pluginName);
84
- if (plugin?.dependencies) {
85
- for (const dep of plugin.dependencies){
86
- visit(dep);
87
- }
88
- }
89
- visiting.delete(pluginName);
90
- visited.add(pluginName);
91
- result.push(pluginName);
92
- };
93
- for (const plugin of sortedPlugins){
94
- visit(plugin.name);
95
- }
96
- return result;
97
- }
98
- /**
99
- * 注销插件
100
- */ unregister(name) {
101
- const plugin = this.plugins.get(name);
102
- if (plugin && plugin.destroy) {
103
- plugin.destroy();
104
- }
105
- this.plugins.delete(name);
106
- this.sandboxes.delete(name);
107
- this.pluginStatus.delete(name);
108
- this.pluginLoaders.delete(name);
109
- }
110
- /**
111
- * 动态加载插件(热插拔)
112
- *
113
- * @param options - 插件加载选项
114
- * @returns 加载的插件
115
- */ async loadPlugin(options) {
116
- let plugin;
117
- if (options.url) {
118
- // 从URL加载插件
119
- const response = await fetch(options.url);
120
- if (!response.ok) {
121
- throw new Error(`无法加载插件: ${options.url} (${response.status})`);
122
- }
123
- const pluginModule = await response.json();
124
- plugin = pluginModule.default || pluginModule;
125
- } else if (options.modulePath) {
126
- // 从模块路径动态导入
127
- const pluginModule = await import(/* @vite-ignore */ options.modulePath);
128
- plugin = pluginModule.default || pluginModule;
129
- } else {
130
- throw new Error('必须提供 url 或 modulePath');
131
- }
132
- if (!plugin || !plugin.name) {
133
- throw new Error('插件格式无效:必须包含 name 属性');
134
- }
135
- // 检查插件是否已加载
136
- if (this.plugins.has(plugin.name)) {
137
- throw new Error(`插件 ${plugin.name} 已加载`);
138
- }
139
- // 设置加载状态
140
- this.pluginStatus.set(plugin.name, 'loading');
141
- try {
142
- // 注册插件
143
- this.register(plugin);
144
- // 如果要求立即初始化
145
- if (options.initialize && options.initContext && options.startOptions) {
146
- await this.initializePlugin(plugin.name, options.startOptions, options.initContext);
147
- }
148
- return plugin;
149
- } catch (error) {
150
- this.pluginStatus.delete(plugin.name);
151
- throw error;
152
- }
153
- }
154
- /**
155
- * 初始化单个插件
156
- *
157
- * @param name - 插件名称
158
- * @param options - 启动选项
159
- * @param context - 初始化上下文
160
- */ async initializePlugin(name, options, context) {
161
- const plugin = this.plugins.get(name);
162
- if (!plugin) {
163
- throw new Error(`插件 ${name} 未注册`);
164
- }
165
- const status = this.pluginStatus.get(name);
166
- if (status === 'initialized') {
167
- return; // 已经初始化
168
- }
169
- try {
170
- const sandbox = this.sandboxes.get(name);
171
- if (!sandbox) {
172
- throw new Error(`插件 ${name} 的沙箱未找到`);
173
- }
174
- // 执行初始化钩子
175
- if (plugin.init) {
176
- const filteredOptions = sandbox.filterConfig(options);
177
- await plugin.init(filteredOptions, context, sandbox, pluginEventBus);
178
- }
179
- this.pluginStatus.set(name, 'initialized');
180
- } catch (error) {
181
- console.error(`插件 ${name} 初始化失败:`, error);
182
- throw error;
183
- }
184
- }
185
- /**
186
- * 卸载插件(热插拔)
187
- *
188
- * @param name - 插件名称
189
- * @param force - 是否强制卸载(即使有依赖)
190
- */ async unloadPlugin(name, force = false) {
191
- const plugin = this.plugins.get(name);
192
- if (!plugin) {
193
- throw new Error(`插件 ${name} 未加载`);
194
- }
195
- // 检查是否有其他插件依赖此插件
196
- if (!force) {
197
- const dependents = Array.from(this.plugins.values()).filter((p)=>p.dependencies && p.dependencies.includes(name));
198
- if (dependents.length > 0) {
199
- throw new Error(`无法卸载插件 ${name},以下插件依赖它: ${dependents.map((p)=>p.name).join(', ')}`);
200
- }
201
- }
202
- // 执行销毁钩子
203
- if (plugin.destroy) {
204
- try {
205
- await plugin.destroy();
206
- } catch (error) {
207
- console.error(`插件 ${name} 的 destroy 钩子执行失败:`, error);
208
- }
209
- }
210
- // 从事件总线移除相关监听器(如果有)
211
- // 注意:事件总线是全局的,这里只移除插件相关的事件
212
- // 实际实现可能需要更细粒度的控制
213
- // 清理插件
214
- this.unregister(name);
215
- this.pluginStatus.set(name, 'destroyed');
216
- }
217
- /**
218
- * 检查插件是否可以热加载
219
- *
220
- * @param plugin - 插件
221
- * @returns 是否可以热加载
222
- */ canHotLoad(plugin) {
223
- // 检查依赖是否都已加载
224
- if (plugin.dependencies && plugin.dependencies.length > 0) {
225
- const missingDeps = plugin.dependencies.filter((dep)=>!this.plugins.has(dep));
226
- if (missingDeps.length > 0) {
227
- return false;
228
- }
229
- }
230
- return true;
231
- }
232
- /**
233
- * 注册插件加载器(用于延迟加载)
234
- *
235
- * @param name - 插件名称
236
- * @param loader - 加载器函数
237
- */ registerLoader(name, loader) {
238
- this.pluginLoaders.set(name, loader);
239
- }
240
- /**
241
- * 使用加载器加载插件
242
- *
243
- * @param name - 插件名称
244
- * @param options - 加载选项
245
- * @returns 加载的插件
246
- */ async loadPluginByLoader(name, options) {
247
- const loader = this.pluginLoaders.get(name);
248
- if (!loader) {
249
- throw new Error(`插件 ${name} 的加载器未注册`);
250
- }
251
- const plugin = await loader();
252
- if (!plugin || !plugin.name) {
253
- throw new Error('插件格式无效:必须包含 name 属性');
254
- }
255
- if (plugin.name !== name) {
256
- throw new Error(`插件名称不匹配: 期望 ${name},实际 ${plugin.name}`);
257
- }
258
- // 检查插件是否已加载
259
- if (this.plugins.has(plugin.name)) {
260
- return this.plugins.get(plugin.name);
261
- }
262
- // 设置加载状态
263
- this.pluginStatus.set(plugin.name, 'loading');
264
- try {
265
- // 注册插件
266
- this.register(plugin);
267
- // 如果要求立即初始化
268
- if (options?.initialize && options.initContext && options.startOptions) {
269
- await this.initializePlugin(plugin.name, options.startOptions, options.initContext);
270
- }
271
- return plugin;
272
- } catch (error) {
273
- this.pluginStatus.delete(plugin.name);
274
- throw error;
275
- }
276
- }
277
- /**
278
- * 获取插件
279
- */ get(name) {
280
- return this.plugins.get(name);
281
- }
282
- /**
283
- * 获取所有插件
284
- */ getAll() {
285
- return Array.from(this.plugins.values());
286
- }
287
- /**
288
- * 执行初始化前钩子
289
- *
290
- * 优化:按依赖顺序执行
291
- */ async executeBeforeInit(options) {
292
- const loadOrder = this.getLoadOrder();
293
- for (const pluginName of loadOrder){
294
- const plugin = this.plugins.get(pluginName);
295
- if (!plugin || !plugin.beforeInit) {
296
- continue;
297
- }
298
- try {
299
- const sandbox = this.sandboxes.get(plugin.name);
300
- if (!sandbox) {
301
- console.warn(`插件 ${plugin.name} 的沙箱未找到`);
302
- continue;
303
- }
304
- // 根据沙箱配置过滤选项
305
- const filteredOptions = sandbox.filterConfig(options);
306
- await plugin.beforeInit(filteredOptions, sandbox, pluginEventBus);
307
- } catch (error) {
308
- console.error(`插件 ${plugin.name} 的 beforeInit 钩子执行失败:`, error);
309
- }
310
- }
311
- }
312
- /**
313
- * 执行初始化钩子
314
- *
315
- * 优化:按依赖顺序执行,并更新插件状态
316
- */ async executeInit(options, context) {
317
- const loadOrder = this.getLoadOrder();
318
- for (const pluginName of loadOrder){
319
- const plugin = this.plugins.get(pluginName);
320
- if (!plugin || !plugin.init) {
321
- continue;
322
- }
323
- try {
324
- const sandbox = this.sandboxes.get(plugin.name);
325
- if (!sandbox) {
326
- console.warn(`插件 ${plugin.name} 的沙箱未找到`);
327
- continue;
328
- }
329
- // 根据沙箱配置过滤选项
330
- const filteredOptions = sandbox.filterConfig(options);
331
- await plugin.init(filteredOptions, context, sandbox, pluginEventBus);
332
- this.pluginStatus.set(plugin.name, 'initialized');
333
- } catch (error) {
334
- console.error(`插件 ${plugin.name} 的 init 钩子执行失败:`, error);
335
- }
336
- }
337
- }
338
- /**
339
- * 执行初始化后钩子
340
- *
341
- * 优化:按依赖顺序执行(逆序,确保依赖插件先执行)
342
- */ async executeAfterInit(options, context) {
343
- const loadOrder = this.getLoadOrder();
344
- // 逆序执行,确保依赖插件先执行
345
- const reverseOrder = [
346
- ...loadOrder
347
- ].reverse();
348
- for (const pluginName of reverseOrder){
349
- const plugin = this.plugins.get(pluginName);
350
- if (!plugin || !plugin.afterInit) {
351
- continue;
352
- }
353
- try {
354
- const sandbox = this.sandboxes.get(plugin.name);
355
- if (!sandbox) {
356
- console.warn(`插件 ${plugin.name} 的沙箱未找到`);
357
- continue;
358
- }
359
- // 根据沙箱配置过滤选项
360
- const filteredOptions = sandbox.filterConfig(options);
361
- await plugin.afterInit(filteredOptions, context, sandbox, pluginEventBus);
362
- } catch (error) {
363
- console.error(`插件 ${plugin.name} 的 afterInit 钩子执行失败:`, error);
364
- }
365
- }
366
- }
367
- /**
368
- * 获取插件状态
369
- *
370
- * @param name - 插件名称
371
- * @returns 插件状态
372
- */ getPluginStatus(name) {
373
- return this.pluginStatus.get(name);
374
- }
375
- /**
376
- * 检查插件是否已加载
377
- *
378
- * @param name - 插件名称
379
- * @returns 是否已加载
380
- */ isLoaded(name) {
381
- return this.plugins.has(name);
382
- }
383
- /**
384
- * 获取已加载的插件列表
385
- *
386
- * @returns 插件名称数组
387
- */ getLoadedPlugins() {
388
- return Array.from(this.plugins.keys());
389
- }
390
- /**
391
- * 获取所有插件状态
392
- *
393
- * @returns 插件状态映射
394
- */ getAllPluginStatus() {
395
- return new Map(this.pluginStatus);
396
- }
397
- /**
398
- * 获取插件沙箱
399
- *
400
- * @param name - 插件名称
401
- * @returns 插件沙箱或undefined
402
- */ getSandbox(name) {
403
- return this.sandboxes.get(name);
404
- }
405
- /**
406
- * 获取事件总线
407
- */ getEventBus() {
408
- return pluginEventBus;
409
- }
410
- /**
411
- * 销毁所有插件
412
- */ async destroyAll() {
413
- for (const plugin of this.plugins.values()){
414
- if (plugin.destroy) {
415
- try {
416
- await plugin.destroy();
417
- } catch (error) {
418
- console.error(`插件 ${plugin.name} 的 destroy 钩子执行失败:`, error);
419
- }
420
- }
421
- }
422
- this.plugins.clear();
423
- }
424
- constructor(){
425
- _define_property(this, "plugins", new Map());
426
- _define_property(this, "sandboxes", new Map());
427
- _define_property(this, "pluginStatus", new Map());
428
- _define_property(this, "pluginLoaders", new Map());
429
- }
430
- }
431
- /**
432
- * 默认插件管理器
433
- */ export const pluginManager = new PluginManager();
434
- // 导出插件相关类型和工具
435
- export { PluginSandbox, PluginPermission } from "./plugin/PluginSandbox";
436
- export { PluginEventBus, pluginEventBus } from "./plugin/PluginEventBus";
437
-
438
- //# sourceMappingURL=plugin.js.map
1
+ 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}import{PluginSandbox}from"./plugin/PluginSandbox";import{pluginEventBus}from"./plugin/PluginEventBus";export class PluginManager{register(plugin){if(this.plugins.has(plugin.name)){console.warn(`插件 ${plugin.name} 已存在,将被覆盖`)}if(plugin.dependencies&&plugin.dependencies.length>0){const missingDeps=plugin.dependencies.filter(dep=>!this.plugins.has(dep));if(missingDeps.length>0){console.warn(`插件 ${plugin.name} 的依赖未注册: ${missingDeps.join(", ")}`)}}this.plugins.set(plugin.name,plugin);this.pluginStatus.set(plugin.name,"registered");if(plugin.sandbox){const sandbox=new PluginSandbox({...plugin.sandbox,name:plugin.name});this.sandboxes.set(plugin.name,sandbox)}else{const sandbox=new PluginSandbox({strictMode:false,name:plugin.name});this.sandboxes.set(plugin.name,sandbox)}}getLoadOrder(){const plugins=Array.from(this.plugins.values());const sortedPlugins=plugins.sort((a,b)=>{const priorityA=a.priority??100;const priorityB=b.priority??100;return priorityA-priorityB});const visited=new Set;const visiting=new Set;const result=[];const visit=pluginName=>{if(visiting.has(pluginName)){console.warn(`检测到循环依赖,涉及插件: ${pluginName}`);return}if(visited.has(pluginName)){return}visiting.add(pluginName);const plugin=this.plugins.get(pluginName);if(plugin?.dependencies){for(const dep of plugin.dependencies){visit(dep)}}visiting.delete(pluginName);visited.add(pluginName);result.push(pluginName)};for(const plugin of sortedPlugins){visit(plugin.name)}return result}unregister(name){const plugin=this.plugins.get(name);if(plugin&&plugin.destroy){plugin.destroy()}this.plugins.delete(name);this.sandboxes.delete(name);this.pluginStatus.delete(name);this.pluginLoaders.delete(name)}async loadPlugin(options){let plugin;if(options.url){const response=await fetch(options.url);if(!response.ok){throw new Error(`无法加载插件: ${options.url} (${response.status})`)}const pluginModule=await response.json();plugin=pluginModule.default||pluginModule}else if(options.modulePath){const pluginModule=await import(options.modulePath);plugin=pluginModule.default||pluginModule}else{throw new Error("必须提供 url 或 modulePath")}if(!plugin||!plugin.name){throw new Error("插件格式无效:必须包含 name 属性")}if(this.plugins.has(plugin.name)){throw new Error(`插件 ${plugin.name} 已加载`)}this.pluginStatus.set(plugin.name,"loading");try{this.register(plugin);if(options.initialize&&options.initContext&&options.startOptions){await this.initializePlugin(plugin.name,options.startOptions,options.initContext)}return plugin}catch(error){this.pluginStatus.delete(plugin.name);throw error}}async initializePlugin(name,options,context){const plugin=this.plugins.get(name);if(!plugin){throw new Error(`插件 ${name} 未注册`)}const status=this.pluginStatus.get(name);if(status==="initialized"){return}try{const sandbox=this.sandboxes.get(name);if(!sandbox){throw new Error(`插件 ${name} 的沙箱未找到`)}if(plugin.init){const filteredOptions=sandbox.filterConfig(options);await plugin.init(filteredOptions,context,sandbox,pluginEventBus)}this.pluginStatus.set(name,"initialized")}catch(error){console.error(`插件 ${name} 初始化失败:`,error);throw error}}async unloadPlugin(name,force=false){const plugin=this.plugins.get(name);if(!plugin){throw new Error(`插件 ${name} 未加载`)}if(!force){const dependents=Array.from(this.plugins.values()).filter(p=>p.dependencies&&p.dependencies.includes(name));if(dependents.length>0){throw new Error(`无法卸载插件 ${name},以下插件依赖它: ${dependents.map(p=>p.name).join(", ")}`)}}if(plugin.destroy){try{await plugin.destroy()}catch(error){console.error(`插件 ${name} 的 destroy 钩子执行失败:`,error)}}this.unregister(name);this.pluginStatus.set(name,"destroyed")}canHotLoad(plugin){if(plugin.dependencies&&plugin.dependencies.length>0){const missingDeps=plugin.dependencies.filter(dep=>!this.plugins.has(dep));if(missingDeps.length>0){return false}}return true}registerLoader(name,loader){this.pluginLoaders.set(name,loader)}async loadPluginByLoader(name,options){const loader=this.pluginLoaders.get(name);if(!loader){throw new Error(`插件 ${name} 的加载器未注册`)}const plugin=await loader();if(!plugin||!plugin.name){throw new Error("插件格式无效:必须包含 name 属性")}if(plugin.name!==name){throw new Error(`插件名称不匹配: 期望 ${name},实际 ${plugin.name}`)}if(this.plugins.has(plugin.name)){return this.plugins.get(plugin.name)}this.pluginStatus.set(plugin.name,"loading");try{this.register(plugin);if(options?.initialize&&options.initContext&&options.startOptions){await this.initializePlugin(plugin.name,options.startOptions,options.initContext)}return plugin}catch(error){this.pluginStatus.delete(plugin.name);throw error}}get(name){return this.plugins.get(name)}getAll(){return Array.from(this.plugins.values())}async executeBeforeInit(options){const loadOrder=this.getLoadOrder();for(const pluginName of loadOrder){const plugin=this.plugins.get(pluginName);if(!plugin||!plugin.beforeInit){continue}try{const sandbox=this.sandboxes.get(plugin.name);if(!sandbox){console.warn(`插件 ${plugin.name} 的沙箱未找到`);continue}const filteredOptions=sandbox.filterConfig(options);await plugin.beforeInit(filteredOptions,sandbox,pluginEventBus)}catch(error){console.error(`插件 ${plugin.name} 的 beforeInit 钩子执行失败:`,error)}}}async executeInit(options,context){const loadOrder=this.getLoadOrder();for(const pluginName of loadOrder){const plugin=this.plugins.get(pluginName);if(!plugin||!plugin.init){continue}try{const sandbox=this.sandboxes.get(plugin.name);if(!sandbox){console.warn(`插件 ${plugin.name} 的沙箱未找到`);continue}const filteredOptions=sandbox.filterConfig(options);await plugin.init(filteredOptions,context,sandbox,pluginEventBus);this.pluginStatus.set(plugin.name,"initialized")}catch(error){console.error(`插件 ${plugin.name} 的 init 钩子执行失败:`,error)}}}async executeAfterInit(options,context){const loadOrder=this.getLoadOrder();const reverseOrder=[...loadOrder].reverse();for(const pluginName of reverseOrder){const plugin=this.plugins.get(pluginName);if(!plugin||!plugin.afterInit){continue}try{const sandbox=this.sandboxes.get(plugin.name);if(!sandbox){console.warn(`插件 ${plugin.name} 的沙箱未找到`);continue}const filteredOptions=sandbox.filterConfig(options);await plugin.afterInit(filteredOptions,context,sandbox,pluginEventBus)}catch(error){console.error(`插件 ${plugin.name} 的 afterInit 钩子执行失败:`,error)}}}getPluginStatus(name){return this.pluginStatus.get(name)}isLoaded(name){return this.plugins.has(name)}getLoadedPlugins(){return Array.from(this.plugins.keys())}getAllPluginStatus(){return new Map(this.pluginStatus)}getSandbox(name){return this.sandboxes.get(name)}getEventBus(){return pluginEventBus}async destroyAll(){for(const plugin of this.plugins.values()){if(plugin.destroy){try{await plugin.destroy()}catch(error){console.error(`插件 ${plugin.name} 的 destroy 钩子执行失败:`,error)}}}this.plugins.clear()}constructor(){_define_property(this,"plugins",new Map);_define_property(this,"sandboxes",new Map);_define_property(this,"pluginStatus",new Map);_define_property(this,"pluginLoaders",new Map)}}export const pluginManager=new PluginManager;export{PluginSandbox,PluginPermission}from"./plugin/PluginSandbox";export{PluginEventBus,pluginEventBus}from"./plugin/PluginEventBus";