catalyst-core 0.3.0-beta.4 → 0.3.0-canary.1

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 +80 -0
  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 +14 -7
  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 -1
  205. package/dist/scripts/start.js +8 -1
  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 +33 -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 +13 -31
  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 +52 -8
  266. package/mcp_v2/mcp.js +140 -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 +121 -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 +331 -0
  291. package/test/server/handler.test.ts +210 -0
  292. package/test/server/manifestCache.test.ts +71 -0
  293. package/test/server/render.test.ts +90 -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 +228 -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 -24
  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
@@ -0,0 +1,44 @@
1
+ /**
2
+ * ChunkExtractor — collects JS and CSS assets needed for the current SSR render.
3
+ *
4
+ * Two buckets:
5
+ * critical — loaded in <head> (inline CSS via <style>, entry + route JS)
6
+ * deferred — injected after </body> via onAllReady (external <link> CSS)
7
+ *
8
+ * Critical CSS is inlined as <style> to avoid FOUC/CLS.
9
+ * With natural Vite code-splitting (no mega "main" chunk), critical CSS stays small (~15-25KB).
10
+ */
11
+ export declare class ChunkExtractor {
12
+ manifest: any;
13
+ assetManifest: any;
14
+ components: Set<any>;
15
+ publicPath: string;
16
+ critical: {
17
+ js: Set<any>;
18
+ css: Set<any>;
19
+ };
20
+ deferred: {
21
+ js: Set<any>;
22
+ css: Set<any>;
23
+ };
24
+ _allCssPaths: Set<any>;
25
+ constructor({ manifest, assetManifest }?: any);
26
+ _loadEssentialEntrypoints(): void;
27
+ preloadRouteCss(allMatches?: any): void;
28
+ addComponent(cacheKey: any): void;
29
+ _addAssets(manifestEntry: any, bucket: any): void;
30
+ _toUrl(filePath: string): string;
31
+ _toCssUrl(filePath: string): string;
32
+ /** Critical: CSS as relative file paths (for inlining from disk), JS as URLs */
33
+ getCriticalAssets(): {
34
+ js: any[];
35
+ css: any[];
36
+ };
37
+ /** Deferred: CSS as URLs (external <link>), JS as URLs */
38
+ getDeferredAssets(): {
39
+ js: any[];
40
+ css: any[];
41
+ };
42
+ getRenderedComponentKeys(): any[];
43
+ }
44
+ export default ChunkExtractor;
@@ -9,136 +9,124 @@
9
9
  * With natural Vite code-splitting (no mega "main" chunk), critical CSS stays small (~15-25KB).
10
10
  */
11
11
  export class ChunkExtractor {
12
- constructor({ manifest = {}, assetManifest = {} } = {}) {
13
- this.manifest = manifest
14
- this.assetManifest = assetManifest
15
- this.components = new Set()
16
-
17
- const baseUrl = `${process.env.PUBLIC_STATIC_ASSET_URL || ""}${process.env.PUBLIC_STATIC_ASSET_PATH || ""}`
18
- this.publicPath = `${baseUrl.replace(/\/+$/, "")}/`
19
-
20
- // JS tracked as full URLs, CSS tracked as relative file paths (for disk reading)
21
- this.critical = { js: new Set(), css: new Set() }
22
- this.deferred = { js: new Set(), css: new Set() }
23
- this._allCssPaths = new Set() // dedup across buckets
24
-
25
- this._loadEssentialEntrypoints()
26
-
27
- if (typeof global !== "undefined") {
28
- global.__CHUNK_EXTRACTOR__ = this
29
- }
12
+ constructor({
13
+ manifest = {},
14
+ assetManifest = {}
15
+ } = {}) {
16
+ this.manifest = manifest;
17
+ this.assetManifest = assetManifest;
18
+ this.components = new Set();
19
+ const baseUrl = `${process.env.PUBLIC_STATIC_ASSET_URL || ""}${process.env.PUBLIC_STATIC_ASSET_PATH || ""}`;
20
+ this.publicPath = `${baseUrl.replace(/\/+$/, "")}/`;
21
+
22
+ // JS tracked as full URLs, CSS tracked as relative file paths (for disk reading)
23
+ this.critical = {
24
+ js: new Set(),
25
+ css: new Set()
26
+ };
27
+ this.deferred = {
28
+ js: new Set(),
29
+ css: new Set()
30
+ };
31
+ this._allCssPaths = new Set(); // dedup across buckets
32
+
33
+ this._loadEssentialEntrypoints();
34
+ if (typeof global !== "undefined") {
35
+ ;
36
+ global.__CHUNK_EXTRACTOR__ = this;
30
37
  }
38
+ }
31
39
 
32
- // ── Build-time essential chunks (entry + static deps) ──────────────
33
- _loadEssentialEntrypoints() {
34
- for (const [, entry] of Object.entries(this.assetManifest.essential || {})) {
35
- this._addAssets(entry, this.critical)
36
- }
40
+ // ── Build-time essential chunks (entry + static deps) ──────────────
41
+ _loadEssentialEntrypoints() {
42
+ for (const [, entry] of Object.entries(this.assetManifest.essential || {})) {
43
+ this._addAssets(entry, this.critical);
37
44
  }
38
-
39
- // ── Route-matched split chunks → critical (blocks first paint) ─────
40
- preloadRouteCss(allMatches = []) {
41
- const list = allMatches == null ? [] : Array.isArray(allMatches) ? allMatches : []
42
- for (const match of list) {
43
- const route = match?.route
44
- if (!route) continue
45
-
46
- const component = route.Component || route.component
47
- const cacheKey = component?.__cacheKey
48
- if (!cacheKey) continue
49
-
50
- const entry =
51
- this.assetManifest.ssrTrue?.[cacheKey] ||
52
- this.assetManifest.ssrFalse?.[cacheKey] ||
53
- this.manifest[cacheKey]
54
-
55
- if (entry) {
56
- this._addAssets(entry, this.critical)
57
- }
58
- }
45
+ }
46
+
47
+ // ── Route-matched split chunks → critical (blocks first paint) ─────
48
+ preloadRouteCss(allMatches = []) {
49
+ const list = allMatches == null ? [] : Array.isArray(allMatches) ? allMatches : [];
50
+ for (const match of list) {
51
+ const route = match?.route;
52
+ if (!route) continue;
53
+ const component = route.Component || route.component;
54
+ const cacheKey = component?.__cacheKey;
55
+ if (!cacheKey) continue;
56
+ const entry = this.assetManifest.ssrTrue?.[cacheKey] || this.assetManifest.ssrFalse?.[cacheKey] || this.manifest[cacheKey];
57
+ if (entry) {
58
+ this._addAssets(entry, this.critical);
59
+ }
59
60
  }
60
-
61
- // ── Components discovered during render → deferred ─────────────────
62
- addComponent(cacheKey) {
63
- this.components.add(cacheKey)
64
-
65
- // Try assetManifest first by raw cacheKey — addSourcePathAliases writes
66
- // source-path entries here even when the chunk is anonymous in manifest.json
67
- // (shared / multi-importer dynamic chunks). Falling back to manifest.json
68
- // last keeps the existing prefix-match behavior intact.
69
- let entry =
70
- this.assetManifest.ssrTrue?.[cacheKey] ||
71
- this.assetManifest.ssrFalse?.[cacheKey] ||
72
- this.manifest[cacheKey]
73
-
74
- if (!entry) {
75
- const resolvedKey = Object.keys(this.manifest).find((k) => k.startsWith(cacheKey + "."))
76
- if (resolvedKey) {
77
- entry =
78
- this.assetManifest.ssrTrue?.[resolvedKey] ||
79
- this.assetManifest.ssrFalse?.[resolvedKey] ||
80
- this.manifest[resolvedKey]
81
- }
82
- }
83
-
84
- if (entry) {
85
- this._addAssets(entry, this.deferred)
86
- }
61
+ }
62
+
63
+ // ── Components discovered during render → deferred ─────────────────
64
+ addComponent(cacheKey) {
65
+ this.components.add(cacheKey);
66
+
67
+ // Try assetManifest first by raw cacheKey — addSourcePathAliases writes
68
+ // source-path entries here even when the chunk is anonymous in manifest.json
69
+ // (shared / multi-importer dynamic chunks). Falling back to manifest.json
70
+ // last keeps the existing prefix-match behavior intact.
71
+ let entry = this.assetManifest.ssrTrue?.[cacheKey] || this.assetManifest.ssrFalse?.[cacheKey] || this.manifest[cacheKey];
72
+ if (!entry) {
73
+ const resolvedKey = Object.keys(this.manifest).find(k => k.startsWith(cacheKey + "."));
74
+ if (resolvedKey) {
75
+ entry = this.assetManifest.ssrTrue?.[resolvedKey] || this.assetManifest.ssrFalse?.[resolvedKey] || this.manifest[resolvedKey];
76
+ }
87
77
  }
88
-
89
- // ── Internal: add JS URLs + CSS file paths to a bucket ─────────────
90
- _addAssets(manifestEntry, bucket) {
91
- if (!manifestEntry?.file) return
92
-
93
- const jsUrl = this._toUrl(manifestEntry.file)
94
-
95
- // Skip if already tracked in either bucket
96
- if (this.critical.js.has(jsUrl) || this.deferred.js.has(jsUrl)) return
97
-
98
- bucket.js.add(jsUrl)
99
-
100
- // Collect direct + transitive CSS as relative file paths (not URLs)
101
- const cssPart = Array.isArray(manifestEntry.css) ? manifestEntry.css : []
102
- const allCssPart = Array.isArray(manifestEntry.allCss) ? manifestEntry.allCss : []
103
- const cssFiles = [...cssPart, ...allCssPart]
104
- for (const cssFile of cssFiles) {
105
- if (!this._allCssPaths.has(cssFile)) {
106
- this._allCssPaths.add(cssFile)
107
- bucket.css.add(cssFile)
108
- }
109
- }
78
+ if (entry) {
79
+ this._addAssets(entry, this.deferred);
110
80
  }
111
-
112
- _toUrl(filePath) {
113
- const cleaned = filePath.replace(/^\/+/, "")
114
- return `${this.publicPath}${cleaned}`
115
- }
116
-
117
- _toCssUrl(filePath) {
118
- const cleaned = filePath.replace(/^\/+/, "")
119
- return `${this.publicPath}${cleaned}`
120
- }
121
-
122
- // ── Public getters ─────────────────────────────────────────────────
123
- /** Critical: CSS as relative file paths (for inlining from disk), JS as URLs */
124
- getCriticalAssets() {
125
- return {
126
- js: Array.from(this.critical.js),
127
- css: Array.from(this.critical.css),
128
- }
129
- }
130
-
131
- /** Deferred: CSS as URLs (external <link>), JS as URLs */
132
- getDeferredAssets() {
133
- return {
134
- js: Array.from(this.deferred.js),
135
- css: Array.from(this.deferred.css),
136
- }
137
- }
138
-
139
- getRenderedComponentKeys() {
140
- return Array.from(this.components)
81
+ }
82
+
83
+ // ── Internal: add JS URLs + CSS file paths to a bucket ─────────────
84
+ _addAssets(manifestEntry, bucket) {
85
+ if (!manifestEntry?.file) return;
86
+ const jsUrl = this._toUrl(manifestEntry.file);
87
+
88
+ // Skip if already tracked in either bucket
89
+ if (this.critical.js.has(jsUrl) || this.deferred.js.has(jsUrl)) return;
90
+ bucket.js.add(jsUrl);
91
+
92
+ // Collect direct + transitive CSS as relative file paths (not URLs)
93
+ const cssPart = Array.isArray(manifestEntry.css) ? manifestEntry.css : [];
94
+ const allCssPart = Array.isArray(manifestEntry.allCss) ? manifestEntry.allCss : [];
95
+ const cssFiles = [...cssPart, ...allCssPart];
96
+ for (const cssFile of cssFiles) {
97
+ if (!this._allCssPaths.has(cssFile)) {
98
+ this._allCssPaths.add(cssFile);
99
+ bucket.css.add(cssFile);
100
+ }
141
101
  }
102
+ }
103
+ _toUrl(filePath) {
104
+ const cleaned = filePath.replace(/^\/+/, "");
105
+ return `${this.publicPath}${cleaned}`;
106
+ }
107
+ _toCssUrl(filePath) {
108
+ const cleaned = filePath.replace(/^\/+/, "");
109
+ return `${this.publicPath}${cleaned}`;
110
+ }
111
+
112
+ // ── Public getters ─────────────────────────────────────────────────
113
+ /** Critical: CSS as relative file paths (for inlining from disk), JS as URLs */
114
+ getCriticalAssets() {
115
+ return {
116
+ js: Array.from(this.critical.js),
117
+ css: Array.from(this.critical.css)
118
+ };
119
+ }
120
+
121
+ /** Deferred: CSS as URLs (external <link>), JS as URLs */
122
+ getDeferredAssets() {
123
+ return {
124
+ js: Array.from(this.deferred.js),
125
+ css: Array.from(this.deferred.css)
126
+ };
127
+ }
128
+ getRenderedComponentKeys() {
129
+ return Array.from(this.components);
130
+ }
142
131
  }
143
-
144
- export default ChunkExtractor
132
+ export default ChunkExtractor;
@@ -0,0 +1,21 @@
1
+ import React from "react";
2
+ /**
3
+ * Body component which will be used in page component
4
+ * @param {object} jsx - page jsx code
5
+ * @param {number|string} statusCode - document request status code
6
+ * @param {object} initialState - initial state object for redux store
7
+ * @param {object} fetcherData - contains data from executing serverFetcher function
8
+ * @param {object} children - contains any child elements defined within the component
9
+ */
10
+ export declare function Body(props: any): React.JSX.Element;
11
+ export declare namespace Body {
12
+ var propTypes: {
13
+ initialState: any;
14
+ jsx: any;
15
+ statusCode: any;
16
+ fetcherData: any;
17
+ children: any;
18
+ safeArea: any;
19
+ nativeWebView: any;
20
+ };
21
+ }
@@ -1,62 +1,62 @@
1
- import React from "react"
2
- import PropTypes from "prop-types"
1
+ import React from "react";
2
+ import PropTypes from "prop-types";
3
+ const DEFAULT_SAFE_AREA = {
4
+ top: 0,
5
+ right: 0,
6
+ bottom: 0,
7
+ left: 0
8
+ };
9
+
10
+ // React does not escape the body of an inline <script>, so a "</script>" inside
11
+ // serialized state would end the block early. The JS parser reads \u003c back as
12
+ // "<", so the payload the client sees is unchanged.
13
+ const serialize = value => JSON.stringify(value).replace(/</g, "\\u003c");
3
14
 
4
- const DEFAULT_SAFE_AREA = { top: 0, right: 0, bottom: 0, left: 0 }
5
15
  /**
6
16
  * Body component which will be used in page component
7
17
  * @param {object} jsx - page jsx code
8
- * @param {object} statusCode - document request status code
18
+ * @param {number|string} statusCode - document request status code
9
19
  * @param {object} initialState - initial state object for redux store
10
20
  * @param {object} fetcherData - contains data from executing serverFetcher function
11
21
  * @param {object} children - contains any child elements defined within the component
12
22
  */
13
23
  export function Body(props) {
14
- const {
15
- jsx = "",
16
- statusCode = "",
17
- initialState = {},
18
-
19
- fetcherData = {},
20
- children,
21
- safeArea = DEFAULT_SAFE_AREA,
22
- nativeWebView = false,
23
- } = props
24
-
25
- return (
26
- <body>
24
+ const {
25
+ jsx = "",
26
+ statusCode = "",
27
+ initialState = {},
28
+ fetcherData = {},
29
+ children,
30
+ safeArea = DEFAULT_SAFE_AREA,
31
+ nativeWebView = false
32
+ } = props;
33
+ return <body>
27
34
  <script
28
- /* eslint-disable-next-line risxss/catch-potential-xss-react */
29
- dangerouslySetInnerHTML={{
30
- __html: `window.__SAFE_AREA_INITIAL__ = ${JSON.stringify(safeArea)}; window.__CATALYST_NATIVE_WEBVIEW__ = ${nativeWebView ? "true" : "false"}`,
31
- }}
32
- />
33
- {process.env.NODE_ENV === "development" && (
34
- // Base pinned to Vite's resolved base by server/expressServer.js.
35
- <script type="module" src={`${process.env.APP_MOUNT_PATH || ""}/client/index.js`}></script>
36
- )}
35
+ /* eslint-disable-next-line risxss/catch-potential-xss-react */ dangerouslySetInnerHTML={{
36
+ __html: `window.__SAFE_AREA_INITIAL__ = ${JSON.stringify(safeArea)}; window.__CATALYST_NATIVE_WEBVIEW__ = ${nativeWebView ? "true" : "false"}`
37
+ }} />
38
+ {process.env.NODE_ENV === "development" &&
39
+ // Base pinned to Vite's resolved base by server/expressServer.js.
40
+ <script type="module" src={`${process.env.APP_MOUNT_PATH || ""}/client/index.js`}></script>}
37
41
  {jsx}
38
42
  <script
39
- /* eslint-disable */
40
- dangerouslySetInnerHTML={{
41
- __html: `
42
- window.__INITIAL_STATE__ = ${JSON.stringify(initialState)}
43
+ /* eslint-disable */ dangerouslySetInnerHTML={{
44
+ __html: `
45
+ window.__INITIAL_STATE__ = ${serialize(initialState)}
43
46
  window.__STATUS_CODE__ = ${JSON.stringify(statusCode || null)}
44
- window.__ROUTER_INITIAL_DATA__ = ${JSON.stringify(fetcherData)}
45
- `,
46
- }}
47
- />
47
+ window.__ROUTER_INITIAL_DATA__ = ${serialize(fetcherData)}
48
+ `
49
+ }} />
48
50
 
49
51
  {children}
50
- </body>
51
- )
52
+ </body>;
52
53
  }
53
-
54
54
  Body.propTypes = {
55
- initialState: PropTypes.object,
56
- jsx: PropTypes.any,
57
- statusCode: PropTypes.string,
58
- fetcherData: PropTypes.object,
59
- children: PropTypes.node,
60
- safeArea: PropTypes.object,
61
- nativeWebView: PropTypes.bool,
62
- }
55
+ initialState: PropTypes.object,
56
+ jsx: PropTypes.any,
57
+ statusCode: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
58
+ fetcherData: PropTypes.object,
59
+ children: PropTypes.node,
60
+ safeArea: PropTypes.object,
61
+ nativeWebView: PropTypes.bool
62
+ };
@@ -0,0 +1,3 @@
1
+ import React from "react";
2
+ declare const FastRefresh: () => React.JSX.Element;
3
+ export default FastRefresh;
@@ -1,20 +1,14 @@
1
- import React from "react"
1
+ import React from "react";
2
2
 
3
3
  /* eslint-disable risxss/catch-potential-xss-react */
4
4
  const FastRefresh = () => {
5
- return (
6
- <script
7
- type="module"
8
- dangerouslySetInnerHTML={{
9
- __html: `
5
+ return <script type="module" dangerouslySetInnerHTML={{
6
+ __html: `
10
7
  import { injectIntoGlobalHook } from "/@react-refresh";
11
8
  injectIntoGlobalHook(window);
12
9
  window.$RefreshReg$ = () => {};
13
10
  window.$RefreshSig$ = () => (type) => type;
14
- `,
15
- }}
16
- />
17
- )
18
- }
19
-
20
- export default FastRefresh
11
+ `
12
+ }} />;
13
+ };
14
+ export default FastRefresh;
@@ -0,0 +1,20 @@
1
+ import React from "react";
2
+ /**
3
+ * Head component — inlines critical CSS as <style> and renders JS as <script type="module">.
4
+ * Critical CSS is small (~15-25KB) thanks to natural Vite code-splitting.
5
+ * Route-cached deferred CSS is inlined here on repeat visits; new deferred CSS still appends after body.
6
+ */
7
+ export declare function Head(props: any): React.JSX.Element;
8
+ export declare namespace Head {
9
+ var propTypes: {
10
+ isBot: any;
11
+ inlineCss: any;
12
+ deferredRouteInlineCss: any;
13
+ jsScripts: any;
14
+ criticalPreloadLinks: any;
15
+ deferredPreloadLinks: any;
16
+ metaTags: any;
17
+ publicAssetPath: any;
18
+ children: any;
19
+ };
20
+ }
@@ -1,6 +1,6 @@
1
- import React from "react"
2
- import PropTypes from "prop-types"
3
- import FastRefresh from "../../../vite/FastRefresh.jsx"
1
+ import React from "react";
2
+ import PropTypes from "prop-types";
3
+ import FastRefresh from "../../../vite/FastRefresh.jsx";
4
4
 
5
5
  /**
6
6
  * Head component — inlines critical CSS as <style> and renders JS as <script type="module">.
@@ -8,20 +8,18 @@ import FastRefresh from "../../../vite/FastRefresh.jsx"
8
8
  * Route-cached deferred CSS is inlined here on repeat visits; new deferred CSS still appends after body.
9
9
  */
10
10
  export function Head(props) {
11
- const {
12
- inlineCss,
13
- deferredRouteInlineCss,
14
- jsScripts,
15
- criticalPreloadLinks,
16
- deferredPreloadLinks,
17
- metaTags,
18
- isBot,
19
- publicAssetPath,
20
- children,
21
- } = props
22
-
23
- return (
24
- <head>
11
+ const {
12
+ inlineCss,
13
+ deferredRouteInlineCss,
14
+ jsScripts,
15
+ criticalPreloadLinks,
16
+ deferredPreloadLinks,
17
+ metaTags,
18
+ isBot,
19
+ publicAssetPath,
20
+ children
21
+ } = props;
22
+ return <head>
25
23
  <meta charSet="utf-8" />
26
24
  <meta name="viewport" content="width=device-width, initial-scale=1" />
27
25
  {process.env.NODE_ENV === "development" && <FastRefresh />}
@@ -35,28 +33,30 @@ export function Head(props) {
35
33
 
36
34
  {/* Inline critical CSS — prevents FOUC/CLS */}
37
35
  {/* nosemgrep: typescript.react.security.audit.react-dangerouslysetinnerhtml.react-dangerouslysetinnerhtml - inlineCss is compiled CSS read from disk (readCssFromDisk), sourced from the app's own build output, never from request/user input. */}
38
- {inlineCss && <style dangerouslySetInnerHTML={{ __html: inlineCss }} />}
36
+ {inlineCss && <style dangerouslySetInnerHTML={{
37
+ __html: inlineCss
38
+ }} />}
39
39
 
40
40
  {/* Deferred CSS from prior SSRs on this route — avoids late layout from post-body <style> */}
41
41
  {/* nosemgrep: typescript.react.security.audit.react-dangerouslysetinnerhtml.react-dangerouslysetinnerhtml - deferredRouteInlineCss is compiled CSS read from disk (readCssFromDisk), sourced from the app's own build output, never from request/user input. */}
42
- {deferredRouteInlineCss && <style dangerouslySetInnerHTML={{ __html: deferredRouteInlineCss }} />}
42
+ {deferredRouteInlineCss && <style dangerouslySetInnerHTML={{
43
+ __html: deferredRouteInlineCss
44
+ }} />}
43
45
 
44
46
  {/* JS modules */}
45
47
  {!isBot && jsScripts}
46
48
 
47
49
  {children}
48
- </head>
49
- )
50
+ </head>;
50
51
  }
51
-
52
52
  Head.propTypes = {
53
- isBot: PropTypes.bool,
54
- inlineCss: PropTypes.string,
55
- deferredRouteInlineCss: PropTypes.string,
56
- jsScripts: PropTypes.array,
57
- criticalPreloadLinks: PropTypes.array,
58
- deferredPreloadLinks: PropTypes.array,
59
- metaTags: PropTypes.array,
60
- publicAssetPath: PropTypes.string,
61
- children: PropTypes.node,
62
- }
53
+ isBot: PropTypes.bool,
54
+ inlineCss: PropTypes.string,
55
+ deferredRouteInlineCss: PropTypes.string,
56
+ jsScripts: PropTypes.array,
57
+ criticalPreloadLinks: PropTypes.array,
58
+ deferredPreloadLinks: PropTypes.array,
59
+ metaTags: PropTypes.array,
60
+ publicAssetPath: PropTypes.string,
61
+ children: PropTypes.node
62
+ };
@@ -0,0 +1,2 @@
1
+ export * from "./Head.jsx";
2
+ export * from "./Body.jsx";
@@ -1,2 +1,2 @@
1
- export * from "./Head.jsx"
2
- export * from "./Body.jsx"
1
+ export * from "./Head.jsx";
2
+ export * from "./Body.jsx";
@@ -0,0 +1,67 @@
1
+ import React from "react";
2
+ declare global {
3
+ namespace NodeJS {
4
+ interface Process {
5
+ cssFileCache?: Record<string, string>;
6
+ deferredAssetsByRoute?: Map<any, {
7
+ css: Set<any>;
8
+ js: Set<any>;
9
+ }>;
10
+ }
11
+ }
12
+ }
13
+ /** Stable key for caching deferred chunks — uses the matched route pattern (e.g. "/product/:name/:id")
14
+ * so all pages on the same route share one entry regardless of their actual URL parameters. */
15
+ export declare const getDeferredRouteKey: (req: any, allMatches?: any) => any;
16
+ /** CSS paths (manifest-relative) previously deferred on this route — for <head> inlining. */
17
+ export declare const getCachedDeferredCssPathsForRoute: (routeKey: any) => any[];
18
+ /**
19
+ * Record deferred asset paths/URLs for this route. Returns CSS paths not yet on the route so they
20
+ * can be inlined after </body> only once; on later visits those paths are inlined in <head> instead.
21
+ * JS URLs are always emitted in HTML on every navigation — skipping "cached" scripts would omit modules.
22
+ * @returns {{ newCssPaths: string[] }}
23
+ */
24
+ export declare const registerDeferredAssetsForRoute: (routeKey: any, { css, js }?: any, isBot?: boolean) => {
25
+ newCssPaths: any[];
26
+ };
27
+ /**
28
+ * Cached deferred script URLs for this route, excluding URLs already loaded as critical scripts.
29
+ * @param {string|null} routeKey - Matched route pattern.
30
+ * @param {Iterable<string>} excludeUrls - Critical / head script src URLs.
31
+ * @returns {string[]}
32
+ */
33
+ export declare const getDeferredPreloadScriptUrls: (routeKey: any, excludeUrls?: any) => any[];
34
+ /**
35
+ * React <link rel="modulepreload"> elements (deduped). Use before matching <script type="module">.
36
+ * @param {string[]} jsUrls
37
+ * @param {string} [keyPrefix] - Unique prefix for React keys when rendering multiple lists.
38
+ */
39
+ export declare const generateModulePreloadLinkElements: (jsUrls?: any, keyPrefix?: string) => React.DetailedReactHTMLElement<{
40
+ key: string;
41
+ rel: string;
42
+ href: any;
43
+ fetchPriority: string;
44
+ }, HTMLElement>[];
45
+ /**
46
+ * Read CSS files from disk and return concatenated CSS string for inlining.
47
+ * @param {string[]} cssPaths - Relative CSS paths (from manifest).
48
+ * @param {string} basePath - Build output directory on disk.
49
+ * @returns {string} Concatenated CSS content.
50
+ */
51
+ export declare const readCssFromDisk: (cssPaths?: any, basePath?: string) => string;
52
+ /**
53
+ * <script type="module"> React elements for JS assets.
54
+ */
55
+ export declare const generateScriptElements: (jsUrls?: any) => React.ReactElement<{
56
+ key: string;
57
+ type: string;
58
+ src: any;
59
+ }, string | React.JSXElementConstructor<any>>[];
60
+ /**
61
+ * <link rel="stylesheet"> HTML strings for deferred CSS (non-blocking, after body).
62
+ */
63
+ export declare const generateCssLinkStrings: (cssUrls?: any) => string;
64
+ /**
65
+ * <link rel="modulepreload"> + <script type="module"> HTML strings.
66
+ */
67
+ export declare const generateScriptStrings: (jsUrls?: any) => string;