catalyst-core 0.3.0-beta.5 → 0.3.0-canary.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (316) hide show
  1. package/changelog.md +185 -71
  2. package/dist/errors/generateDocs.js +100 -0
  3. package/dist/errors/index.js +243 -0
  4. package/dist/errors/registry.js +483 -0
  5. package/dist/errors-index.json +506 -0
  6. package/dist/globals.d.ts +62 -0
  7. package/dist/index.d.ts +5 -0
  8. package/dist/index.jsx +5 -8
  9. package/dist/logger.js +1 -1
  10. package/dist/native/androidProject/app/build.gradle.kts +142 -7
  11. package/dist/native/androidProject/app/src/main/AndroidManifest.xml +4 -0
  12. package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/NativeBridge.kt +2 -2
  13. package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/camera/BarcodeDetector.kt +3 -0
  14. package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/camera/CameraSessionManager.kt +3 -0
  15. package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/utils/FrameworkServerUtils.kt +43 -8
  16. package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/BridgeUtilsTest.kt +181 -1
  17. package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/CameraUtilsTest.kt +156 -236
  18. package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/FileSizeRouterUtilsTest.kt +471 -0
  19. package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/FileUtilsTest.kt +222 -226
  20. package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/FrameworkServerUtilsTest.kt +300 -0
  21. package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/IntentUtilsTest.kt +244 -0
  22. package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/MetricsMonitorTest.kt +359 -0
  23. package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/NativeBridgeTest.kt +108 -63
  24. package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/NotificationUtilsTest.kt +329 -385
  25. package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/OfflineCacheServiceTest.kt +302 -0
  26. package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/PerfEventBufferTest.kt +133 -0
  27. package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/UtilsKtTest.kt +152 -0
  28. package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/WebCacheManagerTest.kt +145 -324
  29. package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/camera/BarcodeDetectorTest.kt +132 -0
  30. package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/camera/HoldControllerTest.kt +155 -0
  31. package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/camera/TorchControllerTest.kt +150 -0
  32. package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/camera/VideoStreamStateMachineTest.kt +120 -0
  33. package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/camera/VideoStreamStateTest.kt +62 -0
  34. package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/camera/ViewfinderMapperTest.kt +143 -0
  35. package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/camera/ZoomControllerTest.kt +421 -0
  36. package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/design/DesignTokensTest.kt +207 -0
  37. package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/plugins/PluginBridgeTest.kt +368 -0
  38. package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/security/FridaDetectorTest.kt +193 -0
  39. package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/security/SecurityCheckManagerTest.kt +260 -0
  40. package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/security/SecurityCheckSchedulerTest.kt +166 -0
  41. package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/utils/DeviceInfoUtilsTest.kt +167 -0
  42. package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/utils/DownloadUtilsTest.kt +197 -0
  43. package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/utils/NetworkMonitorTest.kt +271 -0
  44. package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/utils/PushNotificationUtilsTest.kt +119 -0
  45. package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/utils/SafeAreaUtilsTest.kt +108 -0
  46. package/dist/native/androidProject/build.gradle.kts +1 -0
  47. package/dist/native/androidProject/gradle/libs.versions.toml +26 -0
  48. package/dist/native/androidProject/settings.gradle.kts +11 -8
  49. package/dist/native/androidSetup.js +2 -2
  50. package/dist/native/bridge/WebBridge.d.ts +98 -0
  51. package/dist/native/bridge/WebBridge.js +40 -6
  52. package/dist/native/bridge/constants/NativeInterfaces.d.ts +391 -0
  53. package/dist/native/bridge/errors.d.ts +67 -0
  54. package/dist/native/bridge/errors.js +66 -151
  55. package/dist/native/bridge/hooks/index.d.ts +13 -0
  56. package/dist/native/bridge/hooks/index.js +0 -6
  57. package/dist/native/bridge/hooks/useAI.d.ts +1 -0
  58. package/dist/native/bridge/hooks/useAI.js +3 -1
  59. package/dist/native/bridge/hooks/useCamera.d.ts +86 -0
  60. package/dist/native/bridge/hooks/useCamera.js +35 -6
  61. package/dist/native/bridge/hooks/useDataProtection.d.ts +17 -0
  62. package/dist/native/bridge/hooks/useDeviceInfo.d.ts +34 -0
  63. package/dist/native/bridge/hooks/useDeviceInfo.js +5 -0
  64. package/dist/native/bridge/hooks/useFilePicker.d.ts +53 -0
  65. package/dist/native/bridge/hooks/useFilePicker.js +13 -0
  66. package/dist/native/bridge/hooks/useGoogleSignIn.d.ts +12 -0
  67. package/dist/native/bridge/hooks/useHapticFeedback.d.ts +76 -0
  68. package/dist/native/bridge/hooks/useHapticFeedback.js +6 -1
  69. package/dist/native/bridge/hooks/useIntent.d.ts +33 -0
  70. package/dist/native/bridge/hooks/useIntent.js +2 -0
  71. package/dist/native/bridge/hooks/useNativeTransition.d.ts +53 -0
  72. package/dist/native/bridge/hooks/useNativeTransition.js +12 -5
  73. package/dist/native/bridge/hooks/useNetworkStatus.d.ts +22 -0
  74. package/dist/native/bridge/hooks/useNetworkStatus.js +7 -0
  75. package/dist/native/bridge/hooks/useNotification.d.ts +83 -0
  76. package/dist/native/bridge/hooks/useNotification.js +81 -34
  77. package/dist/native/bridge/hooks/useSafeArea.d.ts +12 -0
  78. package/dist/native/bridge/hooks/useSafeArea.js +8 -0
  79. package/dist/native/bridge/hooks/useVideoStream.d.ts +67 -0
  80. package/dist/native/bridge/hooks/useVideoStream.js +38 -52
  81. package/dist/native/bridge/hooks/utils.d.ts +4 -0
  82. package/dist/native/bridge/hooks.d.ts +1 -0
  83. package/dist/native/bridge/perf/collectors/ApiCollector.d.ts +30 -0
  84. package/dist/native/bridge/perf/collectors/ApiCollector.js +4 -0
  85. package/dist/native/bridge/perf/collectors/CacheCollector.d.ts +43 -0
  86. package/dist/native/bridge/perf/collectors/CacheCollector.js +4 -0
  87. package/dist/native/bridge/perf/collectors/HookCollector.d.ts +37 -0
  88. package/dist/native/bridge/perf/collectors/HookCollector.js +4 -0
  89. package/dist/native/bridge/perf/collectors/InsightsCollector.d.ts +103 -0
  90. package/dist/native/bridge/perf/collectors/InsightsCollector.js +4 -0
  91. package/dist/native/bridge/perf/collectors/InteractionCollector.d.ts +53 -0
  92. package/dist/native/bridge/perf/collectors/InteractionCollector.js +4 -0
  93. package/dist/native/bridge/perf/collectors/KeyboardCollector.d.ts +30 -0
  94. package/dist/native/bridge/perf/collectors/KeyboardCollector.js +4 -0
  95. package/dist/native/bridge/perf/collectors/NavigationCollector.d.ts +37 -0
  96. package/dist/native/bridge/perf/collectors/NavigationCollector.js +4 -0
  97. package/dist/native/bridge/perf/collectors/NetworkTimingCollector.d.ts +30 -0
  98. package/dist/native/bridge/perf/collectors/NetworkTimingCollector.js +4 -0
  99. package/dist/native/bridge/perf/collectors/RenderCollector.d.ts +47 -0
  100. package/dist/native/bridge/perf/collectors/RenderCollector.js +8 -0
  101. package/dist/native/bridge/perf/collectors/ScrollCollector.d.ts +29 -0
  102. package/dist/native/bridge/perf/collectors/ScrollCollector.js +4 -0
  103. package/dist/native/bridge/perf/collectors/ThreadCollector.d.ts +31 -0
  104. package/dist/native/bridge/perf/collectors/ThreadCollector.js +4 -0
  105. package/dist/native/bridge/perf/core/constants.d.ts +76 -0
  106. package/dist/native/bridge/perf/core/measure.d.ts +39 -0
  107. package/dist/native/bridge/perf/core/measure.js +4 -0
  108. package/dist/native/bridge/perf/core/session.d.ts +49 -0
  109. package/dist/native/bridge/perf/core/session.js +4 -0
  110. package/dist/native/bridge/perf/core/store.d.ts +37 -0
  111. package/dist/native/bridge/perf/core/store.js +4 -0
  112. package/dist/native/bridge/perf/core/summary.d.ts +60 -0
  113. package/dist/native/bridge/perf/core/traceExport.d.ts +10 -0
  114. package/dist/native/bridge/perf/core/waterfalls.d.ts +2 -0
  115. package/dist/native/bridge/perf/index.d.ts +63 -0
  116. package/dist/native/bridge/perf/index.js +4 -0
  117. package/dist/native/bridge/safeArea.d.ts +11 -0
  118. package/dist/native/bridge/safeArea.js +2 -0
  119. package/dist/native/bridge/useBaseHook.d.ts +137 -0
  120. package/dist/native/bridge/useBaseHook.js +34 -4
  121. package/dist/native/bridge/utils/CameraUtils.d.ts +94 -0
  122. package/dist/native/bridge/utils/CameraUtils.js +4 -0
  123. package/dist/native/bridge/utils/FileObjectConverter.d.ts +36 -0
  124. package/dist/native/bridge/utils/NativeBridge.d.ts +270 -0
  125. package/dist/native/bridge/utils/NativeBridge.js +10 -0
  126. package/dist/native/buildAndroid/index.js +1 -1
  127. package/dist/native/buildAppAndroid.js +9 -0
  128. package/dist/native/buildAppIos.js +16 -1
  129. package/dist/native/buildErrorFormat.js +57 -0
  130. package/dist/native/buildIos/config.js +15 -1
  131. package/dist/native/buildIos/index.js +1 -1
  132. package/dist/native/buildIos/plugins.js +10 -1
  133. package/dist/native/iosnativeWebView/CoreLogic/Package.swift +36 -0
  134. package/dist/native/iosnativeWebView/{Sources/Core → CoreLogic/Sources/CatalystCoreLogic}/Camera/VideoStreamState.swift +1 -1
  135. package/dist/native/iosnativeWebView/{Sources/Core → CoreLogic/Sources/CatalystCoreLogic}/Camera/VideoStreamStateMachine.swift +6 -4
  136. package/dist/native/iosnativeWebView/{Sources/Core → CoreLogic/Sources/CatalystCoreLogic}/Utils/BootTimingUtility.swift +3 -3
  137. package/dist/native/iosnativeWebView/{Sources/Core → CoreLogic/Sources/CatalystCoreLogic}/Utils/FrameworkServerUtils.swift +14 -9
  138. package/dist/native/iosnativeWebView/{Sources/Core → CoreLogic/Sources/CatalystCoreLogic}/Utils/NetworkMonitor.swift +11 -9
  139. package/dist/native/iosnativeWebView/{Sources/Core → CoreLogic/Sources/CatalystCoreLogic}/Utils/NotificationHandlerProvider.swift +1 -1
  140. package/dist/native/iosnativeWebView/{Sources/Core → CoreLogic/Sources/CatalystCoreLogic}/Utils/URLWhitelistManager.swift +7 -7
  141. package/dist/native/iosnativeWebView/CoreLogic/Tests/CatalystCoreLogicTests/AnyCodableTests.swift +154 -0
  142. package/dist/native/iosnativeWebView/{iosnativeWebViewTests → CoreLogic/Tests/CatalystCoreLogicTests}/BootTimingUtilityTests.swift +23 -5
  143. package/dist/native/iosnativeWebView/CoreLogic/Tests/CatalystCoreLogicTests/CatalystConstantsTests.swift +192 -0
  144. package/dist/native/iosnativeWebView/{iosnativeWebViewTests → CoreLogic/Tests/CatalystCoreLogicTests}/ConfigMappingTests.swift +1 -1
  145. package/dist/native/iosnativeWebView/CoreLogic/Tests/CatalystCoreLogicTests/FrameworkServerUtilsErrorPathTests.swift +106 -0
  146. package/dist/native/iosnativeWebView/CoreLogic/Tests/CatalystCoreLogicTests/FrameworkServerUtilsLoopbackTests.swift +243 -0
  147. package/dist/native/iosnativeWebView/{iosnativeWebViewTests → CoreLogic/Tests/CatalystCoreLogicTests}/FrameworkServerUtilsTests.swift +1 -1
  148. package/dist/native/iosnativeWebView/CoreLogic/Tests/CatalystCoreLogicTests/NetworkMonitorTests.swift +119 -0
  149. package/dist/native/iosnativeWebView/CoreLogic/Tests/CatalystCoreLogicTests/NotificationHandlerProviderTests.swift +59 -0
  150. package/dist/native/iosnativeWebView/{iosnativeWebViewTests → CoreLogic/Tests/CatalystCoreLogicTests}/NotificationHandlerTests.swift +1 -1
  151. package/dist/native/iosnativeWebView/{iosnativeWebViewTests → CoreLogic/Tests/CatalystCoreLogicTests}/URLWhitelistManagerTests.swift +1 -1
  152. package/dist/native/iosnativeWebView/CoreLogic/Tests/CatalystCoreLogicTests/VideoStreamStateMachineTests.swift +171 -0
  153. package/dist/native/iosnativeWebView/CoreLogic/Tests/CatalystCoreLogicTests/VideoStreamStateTests.swift +91 -0
  154. package/dist/native/iosnativeWebView/Package.swift +10 -9
  155. package/dist/native/iosnativeWebView/Sources/CatalystNotifications/LocalNotificationHandler.swift +7 -2
  156. package/dist/native/iosnativeWebView/Sources/CatalystNotifications/NotificationManager.swift +1 -2
  157. package/dist/native/iosnativeWebView/Sources/CatalystNotifications/PushNotificationHandler.swift +5 -4
  158. package/dist/native/iosnativeWebView/Sources/Core/Camera/CameraSessionManager.swift +1 -0
  159. package/dist/native/iosnativeWebView/Sources/Core/Camera/HoldController.swift +1 -0
  160. package/dist/native/iosnativeWebView/Sources/Core/Camera/NativeCameraManager.swift +6 -5
  161. package/dist/native/iosnativeWebView/Sources/Core/Camera/ZoomController.swift +1 -0
  162. package/dist/native/iosnativeWebView/Sources/Core/Plugins/PluginBridge.swift +1 -0
  163. package/dist/native/iosnativeWebView/Sources/Core/Utils/CacheManager.swift +31 -30
  164. package/dist/native/iosnativeWebView/Sources/Core/Utils/CameraTransportUtils.swift +2 -1
  165. package/dist/native/iosnativeWebView/Sources/Core/Utils/DeviceInfoUtils.swift +1 -1
  166. package/dist/native/iosnativeWebView/Sources/Core/Utils/FilePickerHandler.swift +22 -19
  167. package/dist/native/iosnativeWebView/Sources/Core/Utils/ImageHandler.swift +40 -39
  168. package/dist/native/iosnativeWebView/Sources/Core/Utils/PerfEventBuffer.swift +1 -0
  169. package/dist/native/iosnativeWebView/Sources/Core/Utils/ResourceURLProtocol.swift +15 -15
  170. package/dist/native/iosnativeWebView/Sources/Core/Utils/WebKitConfig.swift +4 -3
  171. package/dist/native/iosnativeWebView/Sources/Core/WebView/BridgeCommandHandler.swift +6 -1
  172. package/dist/native/iosnativeWebView/Sources/Core/WebView/BridgeDelegateHandler.swift +1 -0
  173. package/dist/native/iosnativeWebView/Sources/Core/WebView/BridgeFileHandler.swift +2 -1
  174. package/dist/native/iosnativeWebView/Sources/Core/WebView/BridgeJavaScriptInterface.swift +2 -1
  175. package/dist/native/iosnativeWebView/Sources/Core/WebView/BridgeMessageValidator.swift +3 -5
  176. package/dist/native/iosnativeWebView/Sources/Core/WebView/NativeBridge.swift +20 -13
  177. package/dist/native/iosnativeWebView/Sources/Core/WebView/SplashView.swift +6 -5
  178. package/dist/native/iosnativeWebView/Sources/Core/WebView/SplashViewModel.swift +14 -13
  179. package/dist/native/iosnativeWebView/Sources/Core/WebView/TransitionManager.swift +3 -3
  180. package/dist/native/iosnativeWebView/Sources/Core/WebView/WebView.swift +9 -8
  181. package/dist/native/iosnativeWebView/Sources/Core/WebView/WebViewModel.swift +7 -6
  182. package/dist/native/iosnativeWebView/Sources/Core/WebView/WebViewNavigationDelegate.swift +24 -25
  183. package/dist/native/iosnativeWebView/iosnativeWebView/AppDelegate.swift +6 -1
  184. package/dist/native/iosnativeWebView/iosnativeWebView/ContentView.swift +1 -0
  185. package/dist/native/iosnativeWebView/iosnativeWebView/iosnativeWebViewApp.swift +4 -0
  186. package/dist/native/iosnativeWebView/iosnativeWebView.xcodeproj/project.pbxproj +2 -22
  187. package/dist/native/iosnativeWebView/iosnativeWebViewTests/BridgeMessageValidatorTests.swift +1 -0
  188. package/dist/native/iosnativeWebView/iosnativeWebViewTests/CacheManagerTests.swift +1 -0
  189. package/dist/native/iosnativeWebView/iosnativeWebViewTests/FilePickerHandlerTests.swift +2 -1
  190. package/dist/native/iosnativeWebView/iosnativeWebViewTests/NativeBridgeTests.swift +15 -9
  191. package/dist/native/iosnativeWebView/iosnativeWebViewTests/WebViewTests.swift +1 -0
  192. package/dist/native/setupEmulatorIos.js +2 -2
  193. package/dist/native/terminalProgress.js +17 -17
  194. package/dist/router/ClientRouter.d.ts +8 -0
  195. package/dist/router/ClientRouter.js +13 -11
  196. package/dist/router/ServerRouter.d.ts +13 -0
  197. package/dist/router/ServerRouter.js +19 -7
  198. package/dist/scripts/build.js +14 -2
  199. package/dist/scripts/loadEnvironmentVariables.js +3 -2
  200. package/dist/scripts/plugins.js +1 -1
  201. package/dist/scripts/preServerInit.js +49 -3
  202. package/dist/scripts/preflight.js +111 -0
  203. package/dist/scripts/scriptUtils.js +46 -1
  204. package/dist/scripts/serve.js +7 -3
  205. package/dist/scripts/start.js +8 -3
  206. package/dist/server/expressServer.d.ts +1 -0
  207. package/dist/server/expressServer.js +247 -271
  208. package/dist/server/manifestCache.d.ts +2 -0
  209. package/dist/server/manifestCache.js +25 -33
  210. package/dist/server/renderer/ChunkExtractor.d.ts +44 -0
  211. package/dist/server/renderer/ChunkExtractor.js +113 -125
  212. package/dist/server/renderer/document/Body.d.ts +21 -0
  213. package/dist/server/renderer/document/Body.jsx +45 -45
  214. package/dist/server/renderer/document/FastRefresh.d.ts +3 -0
  215. package/dist/server/renderer/document/FastRefresh.jsx +7 -13
  216. package/dist/server/renderer/document/Head.d.ts +20 -0
  217. package/dist/server/renderer/document/Head.jsx +32 -32
  218. package/dist/server/renderer/document/index.d.ts +2 -0
  219. package/dist/server/renderer/document/index.jsx +2 -2
  220. package/dist/server/renderer/extract.d.ts +67 -0
  221. package/dist/server/renderer/extract.js +92 -89
  222. package/dist/server/renderer/handler.d.ts +2 -0
  223. package/dist/server/renderer/handler.jsx +401 -404
  224. package/dist/server/renderer/index.d.ts +2 -0
  225. package/dist/server/renderer/index.js +5 -8
  226. package/dist/server/renderer/render.d.ts +35 -0
  227. package/dist/server/renderer/render.js +25 -32
  228. package/dist/server/utils/botDetectionMiddleware.d.ts +1 -0
  229. package/dist/server/utils/botDetectionMiddleware.js +33 -23
  230. package/dist/server/utils/cjsRequire.d.ts +8 -0
  231. package/dist/server/utils/cjsRequire.js +2 -2
  232. package/dist/server/utils/userAgentUtil.d.ts +7 -0
  233. package/dist/server/utils/userAgentUtil.js +68 -71
  234. package/dist/server/utils/validator.d.ts +31 -0
  235. package/dist/server/utils/validator.js +133 -158
  236. package/dist/vite/inject-cache-key-plugin.js +3 -27
  237. package/dist/vite/moduleAliases.js +36 -0
  238. package/dist/vite/node-loader.mjs +2 -29
  239. package/dist/vite/resolveDevServerConfig.js +4 -1
  240. package/dist/vite/vite.config.js +2 -29
  241. package/dist/web-router/components/MetaTag.d.ts +4 -0
  242. package/dist/web-router/components/MetaTag.jsx +26 -28
  243. package/dist/web-router/components/MetaTag.test.jsx +100 -0
  244. package/dist/web-router/components/RouterDataProvider.d.ts +96 -0
  245. package/dist/web-router/components/RouterDataProvider.jsx +260 -259
  246. package/dist/web-router/components/RouterDataProvider.server.test.jsx +98 -0
  247. package/dist/web-router/components/RouterDataProvider.test.jsx +310 -0
  248. package/dist/web-router/components/Split.d.ts +74 -0
  249. package/dist/web-router/components/Split.jsx +147 -156
  250. package/dist/web-router/components/Split.server.test.jsx +52 -0
  251. package/dist/web-router/components/Split.test.jsx +167 -0
  252. package/dist/web-router/components/SplitInview.d.ts +22 -0
  253. package/dist/web-router/components/SplitInview.jsx +78 -89
  254. package/dist/web-router/components/SplitInview.test.jsx +112 -0
  255. package/dist/web-router/components/SsrRequestContext.d.ts +20 -0
  256. package/dist/web-router/components/SsrRequestContext.jsx +17 -7
  257. package/dist/web-router/components/SsrRequestContext.test.jsx +53 -0
  258. package/dist/web-router/context.d.ts +15 -0
  259. package/dist/web-router/context.jsx +5 -5
  260. package/dist/web-router/context.test.jsx +10 -0
  261. package/dist/web-router/utils/metaDataUtils.d.ts +24 -0
  262. package/dist/web-router/utils/metaDataUtils.jsx +86 -86
  263. package/dist/web-router/utils/metaDataUtils.test.jsx +188 -0
  264. package/dist/web-router/vitest.setup.js +12 -0
  265. package/mcp_v2/knowledge-base.json +115 -17
  266. package/mcp_v2/mcp.js +141 -3
  267. package/mcp_v2/package-lock.json +2031 -0
  268. package/mcp_v2/package.json +13 -2
  269. package/mcp_v2/scripts/copyErrorsIndex.cjs +34 -0
  270. package/mcp_v2/test/errors.test.ts +123 -0
  271. package/mcp_v2/test/github.test.ts +177 -0
  272. package/mcp_v2/tools/errors.d.ts +20 -0
  273. package/mcp_v2/tools/errors.js +63 -0
  274. package/mcp_v2/tools/github.d.ts +41 -0
  275. package/mcp_v2/tools/github.js +231 -0
  276. package/mcp_v2/vitest.config.mjs +22 -0
  277. package/package.json +60 -11
  278. package/test/errors/docsDrift.test.ts +113 -0
  279. package/test/errors/index.test.ts +200 -0
  280. package/test/errors/registry.test.ts +108 -0
  281. package/test/scripts/preflight.test.ts +118 -0
  282. package/test/server/ChunkExtractor.test.ts +97 -0
  283. package/test/server/extract.test.ts +128 -0
  284. package/test/server/fixtures/template/server/document.jsx +19 -0
  285. package/test/server/fixtures/template/server/index.js +10 -0
  286. package/test/server/fixtures/template/src/js/containers/App/index.jsx +33 -0
  287. package/test/server/fixtures/template/src/js/routes/index.jsx +72 -0
  288. package/test/server/fixtures/template/src/js/routes/utils.jsx +39 -0
  289. package/test/server/fixtures/template/src/js/store/index.js +19 -0
  290. package/test/server/handler.assets.test.ts +330 -0
  291. package/test/server/handler.test.ts +208 -0
  292. package/test/server/manifestCache.test.ts +71 -0
  293. package/test/server/render.test.ts +71 -0
  294. package/test/server/scriptUtils.test.ts +103 -0
  295. package/test/server/userAgentUtil.test.ts +48 -0
  296. package/test/server/validator.test.ts +225 -0
  297. package/test/vite/resolveDevServerConfig.test.js +4 -1
  298. package/tsconfig.test.json +23 -0
  299. package/vitest.config.ts +93 -0
  300. package/dist/caching.js +0 -1
  301. package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/DeviceInfoUtilsTest.kt +0 -187
  302. package/dist/native/bridge/standardizedHooks.js +0 -611
  303. package/dist/router.js +0 -1
  304. package/dist/scripts/validator.js +0 -149
  305. package/dist/web-router/hooks.jsx +0 -72
  306. package/dist/web-router/types/components/MetaTag.d.ts +0 -2
  307. package/dist/web-router/types/components/RouterDataProvider.d.ts +0 -95
  308. package/dist/web-router/types/context.d.ts +0 -14
  309. package/dist/web-router/types/hooks.d.ts +0 -1
  310. package/dist/web-router/types/index.d.ts +0 -3
  311. package/dist/web-router/types/utils/metaDataUtils.d.ts +0 -40
  312. /package/dist/native/iosnativeWebView/{Sources/Core → CoreLogic/Sources/CatalystCoreLogic}/Constants/CatalystConstants.swift +0 -0
  313. /package/dist/native/iosnativeWebView/{Sources/Core → CoreLogic/Sources/CatalystCoreLogic}/Constants/ConfigConstants.swift +0 -0
  314. /package/dist/native/iosnativeWebView/{Sources/Core → CoreLogic/Sources/CatalystCoreLogic}/Notifications/NotificationModels.swift +0 -0
  315. /package/dist/native/iosnativeWebView/{Sources/Core → CoreLogic/Sources/CatalystCoreLogic}/Protocols/NotificationHandlerProtocol.swift +0 -0
  316. /package/dist/native/iosnativeWebView/{Sources/Core → CoreLogic/Sources/CatalystCoreLogic}/Utils/NullNotificationHandler.swift +0 -0
@@ -1,304 +1,280 @@
1
- import path from "path"
2
- import express from "express"
3
- import bodyParser from "body-parser"
4
- import compression from "compression"
5
- import cookieParser from "cookie-parser"
6
- import expressStaticGzip from "express-static-gzip"
7
- import { createServer as createViteServer } from "vite"
8
- import util from "node:util"
9
- import pc from "picocolors"
10
- import fs from "fs"
11
- const { cyan, yellow, green } = pc
12
-
13
- import { toMountPathPrefix } from "../vite/resolveDevServerConfig.js"
14
- import { validateMiddleware, safeCall } from "./utils/validator.js"
15
- import { botDetectionMiddleware } from "./utils/botDetectionMiddleware.js"
16
- import { cjsRequire } from "./utils/cjsRequire.js"
17
- const { addMiddlewares } = await import(path.join(process.env.src_path, "server/server.js"))
1
+ import path from "path";
2
+ import express from "express";
3
+ import bodyParser from "body-parser";
4
+ import compression from "compression";
5
+ import cookieParser from "cookie-parser";
6
+ import expressStaticGzip from "express-static-gzip";
7
+ import { createServer as createViteServer } from "vite";
8
+ import util from "node:util";
9
+ import pc from "ansis";
10
+ import fs from "fs";
11
+ const {
12
+ cyan,
13
+ yellow,
14
+ green
15
+ } = pc;
16
+ import { toMountPathPrefix } from "../vite/resolveDevServerConfig.js";
17
+ import { validateMiddleware, handleError, safeCall } from "./utils/validator.js";
18
+ import { botDetectionMiddleware } from "./utils/botDetectionMiddleware.js";
19
+ import { cjsRequire } from "./utils/cjsRequire.js";
20
+ const {
21
+ addMiddlewares
22
+ } = await import(path.join(process.env.src_path, "server/server.js"));
18
23
 
19
24
  // Mount AI route if catalyst-ai is installed
20
25
  function mountAIRouter(app) {
21
- let aiPackagePath
22
- try {
23
- aiPackagePath = cjsRequire.resolve("catalyst-ai/route", {
24
- paths: [process.env.src_path || process.cwd()],
25
- })
26
- } catch (resolveErr) {
27
- if (resolveErr.code !== "MODULE_NOT_FOUND") {
28
- console.error("[catalyst-core/ai] Unexpected error resolving catalyst-ai:", resolveErr)
29
- } else {
30
- console.debug("[catalyst-core/ai] catalyst-ai not installed — AI routes unavailable")
31
- }
32
- return
26
+ let aiPackagePath;
27
+ try {
28
+ aiPackagePath = cjsRequire.resolve("catalyst-ai/route", {
29
+ paths: [process.env.src_path || process.cwd()]
30
+ });
31
+ } catch (resolveErr) {
32
+ if (resolveErr.code !== "MODULE_NOT_FOUND") {
33
+ console.error("[catalyst-core/ai] Unexpected error resolving catalyst-ai:", resolveErr);
34
+ } else {
35
+ console.debug("[catalyst-core/ai] catalyst-ai not installed — AI routes unavailable");
33
36
  }
34
-
37
+ return;
38
+ }
39
+ try {
40
+ const aiRouter = cjsRequire(aiPackagePath);
41
+ let aiConfig = {};
35
42
  try {
36
- const aiRouter = cjsRequire(aiPackagePath)
37
- let aiConfig = {}
38
- try {
39
- const parsedConfig = JSON.parse(process.env.AI_CONFIG || "{}")
40
- if (parsedConfig && typeof parsedConfig === "object" && !Array.isArray(parsedConfig)) {
41
- aiConfig = parsedConfig
42
- } else {
43
- console.warn("[catalyst-core/ai] AI_CONFIG must be a JSON object, ignoring it")
44
- }
45
- } catch (e) {
46
- console.warn(`[catalyst-core/ai] Invalid AI_CONFIG JSON, ignoring: ${e.message}`)
47
- }
48
-
49
- if (aiConfig.enabled === false) {
50
- console.log("[catalyst-core/ai] AI_CONFIG.enabled is false, skipping AI router")
51
- return
52
- }
53
-
54
- const aiBasePath = aiConfig.basePath || "/ai"
55
- console.log(`[catalyst-core/ai] mounting AI router at ${aiBasePath}`)
56
- app.use(aiBasePath, aiRouter)
57
- } catch (mountErr) {
58
- console.error("[catalyst-core/ai] Failed to mount AI router:", mountErr)
43
+ const parsedConfig = JSON.parse(process.env.AI_CONFIG || "{}");
44
+ if (parsedConfig && typeof parsedConfig === "object" && !Array.isArray(parsedConfig)) {
45
+ aiConfig = parsedConfig;
46
+ } else {
47
+ console.warn("[catalyst-core/ai] AI_CONFIG must be a JSON object, ignoring it");
48
+ }
49
+ } catch (e) {
50
+ console.warn(`[catalyst-core/ai] Invalid AI_CONFIG JSON, ignoring: ${e.message}`);
59
51
  }
52
+ if (aiConfig.enabled === false) {
53
+ console.log("[catalyst-core/ai] AI_CONFIG.enabled is false, skipping AI router");
54
+ return;
55
+ }
56
+ const aiBasePath = aiConfig.basePath || "/ai";
57
+ console.log(`[catalyst-core/ai] mounting AI router at ${aiBasePath}`);
58
+ app.use(aiBasePath, aiRouter);
59
+ } catch (mountErr) {
60
+ console.error("[catalyst-core/ai] Failed to mount AI router:", mountErr);
61
+ }
60
62
  }
61
63
 
62
64
  // OpenTelemetry is opt-in (OTEL_ENABLE) — mirrors server/renderer/handler.jsx.
63
65
  // Passthrough no-op middleware when disabled or packages aren't installed.
64
- let responseFlushMiddleware = () => (_req, _res, next) => next()
66
+ let responseFlushMiddleware = () => (_req, _res, next) => next();
67
+ // config.json booleans survive the process.env swap in loadEnvironmentVariables(),
68
+ // so this is genuinely true at runtime when config sets OTEL_ENABLE: true. The cast
69
+ // exists only because TS types process.env values as string | undefined.
65
70
  if (process.env.OTEL_ENABLE === true) {
66
- try {
67
- const otel = await import("../otel.js")
68
- responseFlushMiddleware = otel.responseFlushMiddleware
69
- } catch {
70
- // otel packages not installed — continue without the flush span
71
- }
71
+ try {
72
+ const otel = await import("../otel.js");
73
+ responseFlushMiddleware = otel.responseFlushMiddleware;
74
+ } catch {
75
+ // otel packages not installed — continue without the flush span
76
+ }
72
77
  }
73
-
74
- const SSR_SERVICE = process.env.SERVICE_NAME || `pwa-${process.env.APPLICATION}-node-server`
78
+ const SSR_SERVICE = process.env.SERVICE_NAME || `pwa-${process.env.APPLICATION}-node-server`;
75
79
 
76
80
  // ─── Load app-defined server lifecycle hooks ──────────────────────────────────
77
- let onServerError
81
+ let onServerError;
78
82
  try {
79
- const hooks = await import(path.join(process.env.src_path, "server/index.js"))
80
- onServerError = hooks.onServerError
83
+ const hooks = await import(path.join(process.env.src_path, "server/index.js"));
84
+ onServerError = hooks.onServerError;
81
85
  } catch {
82
- // No hooks file — onServerError remains undefined
86
+ // No hooks file — onServerError remains undefined
83
87
  }
84
88
 
85
89
  // ─── Process-level error handlers ─────────────────────────────────────────────
86
90
 
87
91
  function safeStringify(err) {
88
- try {
89
- return JSON.stringify(err)
90
- } catch (e) {
91
- console.log("error in safeStringify", e)
92
- return err
93
- }
92
+ try {
93
+ return JSON.stringify(err);
94
+ } catch (e) {
95
+ console.log("error in safeStringify", e);
96
+ return err;
97
+ }
94
98
  }
95
-
96
99
  process.on("uncaughtException", (err, origin) => {
97
- console.log(process.stderr.fd)
98
- console.log(`Caught exception: ${err}\n` + `Exception origin: ${origin}`)
99
- })
100
-
100
+ console.log(process.stderr.fd);
101
+ console.log(`Caught exception: ${err}\n` + `Exception origin: ${origin}`);
102
+ });
101
103
  process.on("uncaughtExceptionMonitor", (err, origin) => {
102
- console.log(err, origin)
103
- })
104
-
105
- process.on("unhandledRejection", (err) => console.log("unhandledRejection in Catalyst", safeStringify(err)))
106
-
104
+ console.log(err, origin);
105
+ });
106
+ process.on("unhandledRejection", err => console.log("unhandledRejection in Catalyst", err?.stack || safeStringify(err)));
107
107
  process.on("SIGINT", function () {
108
- console.log("SIGINT")
109
- process.exit(0)
110
- })
111
-
108
+ console.log("SIGINT");
109
+ process.exit(0);
110
+ });
112
111
  process.on("message", function (msg) {
113
- if (msg == "shutdown") {
114
- console.log("Closing all connections...")
115
- setTimeout(function () {
116
- console.log("Finished closing connections")
117
- process.exit(0)
118
- }, 1500)
119
- }
120
- })
121
-
122
- import { fileURLToPath } from "url"
123
- const __filename = fileURLToPath(import.meta.url)
124
- const __dirname = path.dirname(__filename)
125
-
126
- const isProduction = process.env.NODE_ENV === "production"
127
-
112
+ if (msg == "shutdown") {
113
+ console.log("Closing all connections...");
114
+ setTimeout(function () {
115
+ console.log("Finished closing connections");
116
+ process.exit(0);
117
+ }, 1500);
118
+ }
119
+ });
120
+ import { fileURLToPath } from "url";
121
+ const __filename = fileURLToPath(import.meta.url);
122
+ const __dirname = path.dirname(__filename);
123
+ const isProduction = process.env.NODE_ENV === "production";
128
124
  function serveBuildFile(app, buildPath, urlPath, fileName, headers = {}) {
129
- app.get(urlPath, (_req, res, next) => {
130
- // nosemgrep: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal - fileName is always a hardcoded literal passed at each serveBuildFile call site, never derived from the request.
131
- const filePath = path.join(buildPath, fileName)
132
- if (!fs.existsSync(filePath)) return next()
133
- res.set(headers)
134
- res.sendFile(filePath)
135
- })
125
+ app.get(urlPath, (_req, res, next) => {
126
+ // nosemgrep: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal - fileName is always a hardcoded literal passed at each serveBuildFile call site, never derived from the request.
127
+ const filePath = path.join(buildPath, fileName);
128
+ if (!fs.existsSync(filePath)) return next();
129
+ res.set(headers);
130
+ res.sendFile(filePath);
131
+ });
136
132
  }
137
-
138
133
  async function createServer() {
139
- const port = process.env.NODE_SERVER_PORT ?? 3005
140
- const host = process.env.NODE_SERVER_HOSTNAME ?? "localhost"
141
- const app = express()
142
-
143
- // This middleware is being used to extract the body of the request
144
- app.use(bodyParser.json())
145
-
146
- // // This middleware has been added to accommodate "byetstream array"
147
- app.use(bodyParser.raw({ type: "application/*" }))
148
-
149
- // This middleware is being used to parse cookies!
150
- app.use(cookieParser())
151
-
152
- // All the middlewares defined by the user will run here.
153
- if (validateMiddleware(addMiddlewares)) addMiddlewares(app)
154
-
155
- mountAIRouter(app)
156
-
157
- // response.compress + response.flush spans straddle compression — they
158
- // attribute the time past the `handler` span (gzip/brotli, then egress).
159
- // MUST be mounted immediately before compression() so its outer res.end
160
- // hook reliably wraps compression's patch (no-op when OTEL off).
161
- app.use(responseFlushMiddleware(SSR_SERVICE, "response.flush", "response.compress"))
162
-
163
- // The middleware will attempt to compress response bodies for all request that traverse through the middleware
164
- app.use(compression())
165
-
166
- let vite
167
-
168
- if (isProduction) {
169
- // In production, serve built assets. Build manifests themselves are
170
- // loaded once at startup by ./manifestCache.js — handler reads from
171
- // that singleton instead of attaching them to every `req`.
172
- const buildPath = path.join(process.env.src_path, process.env.BUILD_OUTPUT_PATH || "build")
173
- const publicPath = path.join(buildPath, "client", "assets")
174
- const publicAssetBase = `/${(process.env.PUBLIC_STATIC_ASSET_PATH || "/assets/")
175
- .replace(/^\/+|\/+$/g, "")
176
- .replace(/\/+/g, "/")}/client/assets`
177
-
178
- serveBuildFile(app, buildPath, "/catalyst-offline-manifest.json", "catalyst-offline-manifest.json", {
179
- "cache-control": "no-store",
180
- })
181
- serveBuildFile(app, buildPath, "/catalyst-sw.js", "catalyst-sw.js", {
182
- "cache-control": "no-cache",
183
- "service-worker-allowed": "/",
184
- })
185
- serveBuildFile(app, buildPath, "/offline.html", "offline.html", {
186
- "cache-control": "no-cache",
187
- })
188
-
189
- // Serve static assets — prefers pre-compressed .br / .gz files generated at build time
190
- app.use(
191
- publicAssetBase,
192
- expressStaticGzip(publicPath, {
193
- enableBrotli: true,
194
- orderPreference: ["br", "gz"],
195
- serveStatic: {
196
- maxAge: "1y",
197
- etag: true,
198
- lastModified: true,
199
- },
200
- })
201
- )
134
+ const port = process.env.NODE_SERVER_PORT ?? 3005;
135
+ const host = process.env.NODE_SERVER_HOSTNAME ?? "localhost";
136
+ const app = express();
137
+
138
+ // This middleware is being used to extract the body of the request
139
+ app.use(bodyParser.json());
140
+
141
+ // // This middleware has been added to accommodate "byetstream array"
142
+ app.use(bodyParser.raw({
143
+ type: "application/*"
144
+ }));
145
+
146
+ // This middleware is being used to parse cookies!
147
+ app.use(cookieParser());
148
+
149
+ // All the middlewares defined by the user will run here.
150
+ {
151
+ const middlewareErr = validateMiddleware(addMiddlewares);
152
+ if (middlewareErr) handleError(middlewareErr);else addMiddlewares(app);
153
+ }
154
+ mountAIRouter(app);
155
+
156
+ // response.compress + response.flush spans straddle compression — they
157
+ // attribute the time past the `handler` span (gzip/brotli, then egress).
158
+ // MUST be mounted immediately before compression() so its outer res.end
159
+ // hook reliably wraps compression's patch (no-op when OTEL off).
160
+ app.use(responseFlushMiddleware(SSR_SERVICE, "response.flush", "response.compress"));
161
+
162
+ // The middleware will attempt to compress response bodies for all request that traverse through the middleware
163
+ app.use(compression());
164
+ let vite;
165
+ if (isProduction) {
166
+ // In production, serve built assets. Build manifests themselves are
167
+ // loaded once at startup by ./manifestCache.js — handler reads from
168
+ // that singleton instead of attaching them to every `req`.
169
+ const buildPath = path.join(process.env.src_path, process.env.BUILD_OUTPUT_PATH || "build");
170
+ const publicPath = path.join(buildPath, "client", "assets");
171
+ const publicAssetBase = `/${(process.env.PUBLIC_STATIC_ASSET_PATH || "/assets/").replace(/^\/+|\/+$/g, "").replace(/\/+/g, "/")}/client/assets`;
172
+ serveBuildFile(app, buildPath, "/catalyst-offline-manifest.json", "catalyst-offline-manifest.json", {
173
+ "cache-control": "no-store"
174
+ });
175
+ serveBuildFile(app, buildPath, "/catalyst-sw.js", "catalyst-sw.js", {
176
+ "cache-control": "no-cache",
177
+ "service-worker-allowed": "/"
178
+ });
179
+ serveBuildFile(app, buildPath, "/offline.html", "offline.html", {
180
+ "cache-control": "no-cache"
181
+ });
182
+
183
+ // Serve static assets — prefers pre-compressed .br / .gz files generated at build time
184
+ app.use(publicAssetBase, expressStaticGzip(publicPath, {
185
+ enableBrotli: true,
186
+ orderPreference: ["br", "gz"],
187
+ serveStatic: {
188
+ maxAge: "1y",
189
+ etag: true,
190
+ lastModified: true
191
+ }
192
+ }));
193
+ } else {
194
+ // In development, use Vite middleware
195
+ vite = await createViteServer({
196
+ configFile: "./dist/vite/vite.config.js",
197
+ server: {
198
+ middlewareMode: true
199
+ },
200
+ appType: "custom",
201
+ root: process.env.src_path
202
+ });
203
+
204
+ // Expose Vite's resolved base to the SSR renderer so the URLs it injects
205
+ // (client entry, react-refresh preamble) match the path Vite serves under.
206
+ // Vite normalizes base with a trailing slash; trim it for clean URL joins.
207
+ process.env.APP_MOUNT_PATH = toMountPathPrefix(vite.config.base);
208
+ app.use(vite.middlewares);
209
+ }
210
+
211
+ // In production, resolve the render module once at startup so the ESM
212
+ // loader and lazy-chunk cache are not re-entered on every request.
213
+ let productionRender;
214
+ if (isProduction) {
215
+ const serverPath = path.join(process.env.src_path, process.env.BUILD_OUTPUT_PATH || "build", "server", "server.js");
216
+ if (fs.existsSync(serverPath)) {
217
+ productionRender = await import(serverPath);
202
218
  } else {
203
- // In development, use Vite middleware
204
- vite = await createViteServer({
205
- configFile: "./dist/vite/vite.config.js",
206
- server: {
207
- middlewareMode: true,
208
- },
209
- appType: "custom",
210
- root: process.env.src_path,
211
- })
212
-
213
- // Expose Vite's resolved base to the SSR renderer so the URLs it injects
214
- // (client entry, react-refresh preamble) match the path Vite serves under.
215
- // Vite normalizes base with a trailing slash; trim it for clean URL joins.
216
- process.env.APP_MOUNT_PATH = toMountPathPrefix(vite.config.base)
217
-
218
- app.use(vite.middlewares)
219
+ const rendererPath = path.join(process.env.src_path, process.env.BUILD_OUTPUT_PATH || "build", "server", "index.js");
220
+ productionRender = await import(rendererPath);
219
221
  }
220
-
221
- // In production, resolve the render module once at startup so the ESM
222
- // loader and lazy-chunk cache are not re-entered on every request.
223
- let productionRender
224
- if (isProduction) {
225
- const serverPath = path.join(
226
- process.env.src_path,
227
- process.env.BUILD_OUTPUT_PATH || "build",
228
- "server",
229
- "server.js"
230
- )
231
- if (fs.existsSync(serverPath)) {
232
- productionRender = await import(serverPath)
233
- } else {
234
- const rendererPath = path.join(
235
- process.env.src_path,
236
- process.env.BUILD_OUTPUT_PATH || "build",
237
- "server",
238
- "index.js"
239
- )
240
- productionRender = await import(rendererPath)
241
- }
222
+ }
223
+ app.use(botDetectionMiddleware);
224
+ app.use("*", async (req, res, next) => {
225
+ try {
226
+ let render;
227
+ if (isProduction) {
228
+ render = productionRender;
229
+ } else {
230
+ // In development, load through Vite SSR per-request to support HMR
231
+ const rendererPath = path.join(__dirname, "./renderer/index.js");
232
+ render = await vite.ssrLoadModule(rendererPath);
233
+ }
234
+
235
+ // Render your app
236
+ if (render && render.default) {
237
+ await render.default(req, res, next);
238
+ } else {
239
+ console.error("Renderer not found or invalid");
240
+ res.status(500).send("Error loading renderer");
241
+ }
242
+ } catch (err) {
243
+ console.error("SSR Error:", err);
244
+ if (vite) {
245
+ vite.ssrFixStacktrace(err);
246
+ }
247
+ res.status(500).send("Internal Server Error");
242
248
  }
243
-
244
- app.use(botDetectionMiddleware)
245
-
246
- app.use("*", async (req, res, next) => {
247
- try {
248
- let render
249
-
250
- if (isProduction) {
251
- render = productionRender
252
- } else {
253
- // In development, load through Vite SSR per-request to support HMR
254
- const rendererPath = path.join(__dirname, "./renderer/index.js")
255
- render = await vite.ssrLoadModule(rendererPath)
256
- }
257
-
258
- // Render your app
259
- if (render && render.default) {
260
- await render.default(req, res, next)
261
- } else {
262
- console.error("Renderer not found or invalid")
263
- res.status(500).send("Error loading renderer")
264
- }
265
- } catch (err) {
266
- console.error("SSR Error:", err)
267
- if (vite) {
268
- vite.ssrFixStacktrace(err)
269
- }
270
- res.status(500).send("Internal Server Error")
271
- }
272
- })
273
-
274
- app.listen({ port, host }, (error) => {
275
- const { APPLICATION, NODE_SERVER_HOSTNAME, NODE_SERVER_PORT } = process.env
276
-
277
- if (error) {
278
- console.log("An error occured while starting the Application server : ", error)
279
- safeCall(onServerError)
280
- return
281
- }
282
-
283
- if (process.env.NODE_ENV === "development") console.log(green("Compiled successfully!"))
284
-
285
- console.log(`\nYou can now view ${APPLICATION} in the browser.\n`)
286
- console.log(
287
- util.format("\tLocal:".padEnd(8), cyan(`http://${NODE_SERVER_HOSTNAME}:${NODE_SERVER_PORT}`))
288
- )
289
-
290
- if (process.env.NODE_ENV === "development") {
291
- console.log("\nNote that the development build is not optimized.")
292
- console.log("To create a production build, use " + cyan("npm run build"))
293
- } else {
294
- console.log(
295
- green(`\nProduction server running in ${isProduction ? "production" : "development"} mode`)
296
- )
297
- }
298
-
299
- console.log("\nFind out more about deployment here:")
300
- console.log(yellow("\n https://catalyst.1mg.com/public_docs/content/deployment\n"))
301
- })
249
+ });
250
+ app.listen({
251
+ port,
252
+ host
253
+ }, error => {
254
+ const {
255
+ APPLICATION,
256
+ NODE_SERVER_HOSTNAME,
257
+ NODE_SERVER_PORT
258
+ } = process.env;
259
+ if (error) {
260
+ console.log("An error occured while starting the Application server : ", error);
261
+ safeCall(onServerError);
262
+ return;
263
+ }
264
+ if (process.env.NODE_ENV === "development") console.log(green("Compiled successfully!"));
265
+ console.log(`\nYou can now view ${APPLICATION} in the browser.\n`);
266
+ console.log(util.format("\tLocal:".padEnd(8), cyan(`http://${NODE_SERVER_HOSTNAME}:${NODE_SERVER_PORT}`)));
267
+ if (process.env.NODE_ENV === "development") {
268
+ console.log("\nNote that the development build is not optimized.");
269
+ console.log("To create a production build, use " + cyan("npm run build"));
270
+ } else {
271
+ console.log(green(`\nProduction server running in ${isProduction ? "production" : "development"} mode`));
272
+ }
273
+ console.log("\nFind out more about deployment here:");
274
+ console.log(yellow("\n https://catalyst.1mg.com/public_docs/content/deployment\n"));
275
+ });
302
276
  }
303
-
304
- createServer()
277
+ createServer().catch(err => {
278
+ console.error(err?.stack || err);
279
+ process.exit(1);
280
+ });
@@ -0,0 +1,2 @@
1
+ export declare const getManifest: () => any;
2
+ export declare const getAssetManifest: () => any;
@@ -1,36 +1,28 @@
1
- import fs from "fs"
2
- import path from "path"
3
-
4
- let manifest = null
5
- let assetManifest = null
6
- let loaded = false
7
-
8
- const isProduction = process.env.NODE_ENV === "production"
9
-
1
+ import fs from "fs";
2
+ import path from "path";
3
+ let manifest = null;
4
+ let assetManifest = null;
5
+ let loaded = false;
6
+ const isProduction = process.env.NODE_ENV === "production";
10
7
  function loadManifests() {
11
- if (loaded) return
12
-
13
- if (!isProduction) return
14
-
15
- const buildPath = path.join(process.env.src_path, process.env.BUILD_OUTPUT_PATH || "build")
16
- try {
17
- const manifestPath = path.join(buildPath, ".vite", "manifest.json")
18
- const assetManifestPath = path.join(buildPath, ".vite", "asset-categories.json")
19
-
20
- if (fs.existsSync(manifestPath)) {
21
- manifest = JSON.parse(fs.readFileSync(manifestPath, "utf-8"))
22
- }
23
- if (fs.existsSync(assetManifestPath)) {
24
- assetManifest = JSON.parse(fs.readFileSync(assetManifestPath, "utf-8"))
25
- }
26
- loaded = true
27
- } catch (error) {
28
- loaded = false
29
- console.warn("Could not load build manifests:", error.message)
8
+ if (loaded) return;
9
+ if (!isProduction) return;
10
+ const buildPath = path.join(process.env.src_path, process.env.BUILD_OUTPUT_PATH || "build");
11
+ try {
12
+ const manifestPath = path.join(buildPath, ".vite", "manifest.json");
13
+ const assetManifestPath = path.join(buildPath, ".vite", "asset-categories.json");
14
+ if (fs.existsSync(manifestPath)) {
15
+ manifest = JSON.parse(fs.readFileSync(manifestPath, "utf-8"));
30
16
  }
17
+ if (fs.existsSync(assetManifestPath)) {
18
+ assetManifest = JSON.parse(fs.readFileSync(assetManifestPath, "utf-8"));
19
+ }
20
+ loaded = true;
21
+ } catch (error) {
22
+ loaded = false;
23
+ console.warn("Could not load build manifests:", error.message);
24
+ }
31
25
  }
32
-
33
- loadManifests()
34
-
35
- export const getManifest = () => manifest
36
- export const getAssetManifest = () => assetManifest
26
+ loadManifests();
27
+ export const getManifest = () => manifest;
28
+ export const getAssetManifest = () => assetManifest;