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.
- package/changelog.md +185 -71
- package/dist/errors/generateDocs.js +100 -0
- package/dist/errors/index.js +243 -0
- package/dist/errors/registry.js +483 -0
- package/dist/errors-index.json +506 -0
- package/dist/globals.d.ts +62 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.jsx +5 -8
- package/dist/logger.js +1 -1
- package/dist/native/androidProject/app/build.gradle.kts +142 -7
- package/dist/native/androidProject/app/src/main/AndroidManifest.xml +4 -0
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/NativeBridge.kt +2 -2
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/camera/BarcodeDetector.kt +3 -0
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/camera/CameraSessionManager.kt +3 -0
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/utils/FrameworkServerUtils.kt +43 -8
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/BridgeUtilsTest.kt +181 -1
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/CameraUtilsTest.kt +156 -236
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/FileSizeRouterUtilsTest.kt +471 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/FileUtilsTest.kt +222 -226
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/FrameworkServerUtilsTest.kt +300 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/IntentUtilsTest.kt +244 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/MetricsMonitorTest.kt +359 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/NativeBridgeTest.kt +108 -63
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/NotificationUtilsTest.kt +329 -385
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/OfflineCacheServiceTest.kt +302 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/PerfEventBufferTest.kt +133 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/UtilsKtTest.kt +152 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/WebCacheManagerTest.kt +145 -324
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/camera/BarcodeDetectorTest.kt +132 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/camera/HoldControllerTest.kt +155 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/camera/TorchControllerTest.kt +150 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/camera/VideoStreamStateMachineTest.kt +120 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/camera/VideoStreamStateTest.kt +62 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/camera/ViewfinderMapperTest.kt +143 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/camera/ZoomControllerTest.kt +421 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/design/DesignTokensTest.kt +207 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/plugins/PluginBridgeTest.kt +368 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/security/FridaDetectorTest.kt +193 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/security/SecurityCheckManagerTest.kt +260 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/security/SecurityCheckSchedulerTest.kt +166 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/utils/DeviceInfoUtilsTest.kt +167 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/utils/DownloadUtilsTest.kt +197 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/utils/NetworkMonitorTest.kt +271 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/utils/PushNotificationUtilsTest.kt +119 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/utils/SafeAreaUtilsTest.kt +108 -0
- package/dist/native/androidProject/build.gradle.kts +1 -0
- package/dist/native/androidProject/gradle/libs.versions.toml +26 -0
- package/dist/native/androidProject/settings.gradle.kts +11 -8
- package/dist/native/androidSetup.js +2 -2
- package/dist/native/bridge/WebBridge.d.ts +98 -0
- package/dist/native/bridge/WebBridge.js +40 -6
- package/dist/native/bridge/constants/NativeInterfaces.d.ts +391 -0
- package/dist/native/bridge/errors.d.ts +67 -0
- package/dist/native/bridge/errors.js +66 -151
- package/dist/native/bridge/hooks/index.d.ts +13 -0
- package/dist/native/bridge/hooks/index.js +0 -6
- package/dist/native/bridge/hooks/useAI.d.ts +1 -0
- package/dist/native/bridge/hooks/useAI.js +3 -1
- package/dist/native/bridge/hooks/useCamera.d.ts +86 -0
- package/dist/native/bridge/hooks/useCamera.js +35 -6
- package/dist/native/bridge/hooks/useDataProtection.d.ts +17 -0
- package/dist/native/bridge/hooks/useDeviceInfo.d.ts +34 -0
- package/dist/native/bridge/hooks/useDeviceInfo.js +5 -0
- package/dist/native/bridge/hooks/useFilePicker.d.ts +53 -0
- package/dist/native/bridge/hooks/useFilePicker.js +13 -0
- package/dist/native/bridge/hooks/useGoogleSignIn.d.ts +12 -0
- package/dist/native/bridge/hooks/useHapticFeedback.d.ts +76 -0
- package/dist/native/bridge/hooks/useHapticFeedback.js +6 -1
- package/dist/native/bridge/hooks/useIntent.d.ts +33 -0
- package/dist/native/bridge/hooks/useIntent.js +2 -0
- package/dist/native/bridge/hooks/useNativeTransition.d.ts +53 -0
- package/dist/native/bridge/hooks/useNativeTransition.js +12 -5
- package/dist/native/bridge/hooks/useNetworkStatus.d.ts +22 -0
- package/dist/native/bridge/hooks/useNetworkStatus.js +7 -0
- package/dist/native/bridge/hooks/useNotification.d.ts +83 -0
- package/dist/native/bridge/hooks/useNotification.js +81 -34
- package/dist/native/bridge/hooks/useSafeArea.d.ts +12 -0
- package/dist/native/bridge/hooks/useSafeArea.js +8 -0
- package/dist/native/bridge/hooks/useVideoStream.d.ts +67 -0
- package/dist/native/bridge/hooks/useVideoStream.js +38 -52
- package/dist/native/bridge/hooks/utils.d.ts +4 -0
- package/dist/native/bridge/hooks.d.ts +1 -0
- package/dist/native/bridge/perf/collectors/ApiCollector.d.ts +30 -0
- package/dist/native/bridge/perf/collectors/ApiCollector.js +4 -0
- package/dist/native/bridge/perf/collectors/CacheCollector.d.ts +43 -0
- package/dist/native/bridge/perf/collectors/CacheCollector.js +4 -0
- package/dist/native/bridge/perf/collectors/HookCollector.d.ts +37 -0
- package/dist/native/bridge/perf/collectors/HookCollector.js +4 -0
- package/dist/native/bridge/perf/collectors/InsightsCollector.d.ts +103 -0
- package/dist/native/bridge/perf/collectors/InsightsCollector.js +4 -0
- package/dist/native/bridge/perf/collectors/InteractionCollector.d.ts +53 -0
- package/dist/native/bridge/perf/collectors/InteractionCollector.js +4 -0
- package/dist/native/bridge/perf/collectors/KeyboardCollector.d.ts +30 -0
- package/dist/native/bridge/perf/collectors/KeyboardCollector.js +4 -0
- package/dist/native/bridge/perf/collectors/NavigationCollector.d.ts +37 -0
- package/dist/native/bridge/perf/collectors/NavigationCollector.js +4 -0
- package/dist/native/bridge/perf/collectors/NetworkTimingCollector.d.ts +30 -0
- package/dist/native/bridge/perf/collectors/NetworkTimingCollector.js +4 -0
- package/dist/native/bridge/perf/collectors/RenderCollector.d.ts +47 -0
- package/dist/native/bridge/perf/collectors/RenderCollector.js +8 -0
- package/dist/native/bridge/perf/collectors/ScrollCollector.d.ts +29 -0
- package/dist/native/bridge/perf/collectors/ScrollCollector.js +4 -0
- package/dist/native/bridge/perf/collectors/ThreadCollector.d.ts +31 -0
- package/dist/native/bridge/perf/collectors/ThreadCollector.js +4 -0
- package/dist/native/bridge/perf/core/constants.d.ts +76 -0
- package/dist/native/bridge/perf/core/measure.d.ts +39 -0
- package/dist/native/bridge/perf/core/measure.js +4 -0
- package/dist/native/bridge/perf/core/session.d.ts +49 -0
- package/dist/native/bridge/perf/core/session.js +4 -0
- package/dist/native/bridge/perf/core/store.d.ts +37 -0
- package/dist/native/bridge/perf/core/store.js +4 -0
- package/dist/native/bridge/perf/core/summary.d.ts +60 -0
- package/dist/native/bridge/perf/core/traceExport.d.ts +10 -0
- package/dist/native/bridge/perf/core/waterfalls.d.ts +2 -0
- package/dist/native/bridge/perf/index.d.ts +63 -0
- package/dist/native/bridge/perf/index.js +4 -0
- package/dist/native/bridge/safeArea.d.ts +11 -0
- package/dist/native/bridge/safeArea.js +2 -0
- package/dist/native/bridge/useBaseHook.d.ts +137 -0
- package/dist/native/bridge/useBaseHook.js +34 -4
- package/dist/native/bridge/utils/CameraUtils.d.ts +94 -0
- package/dist/native/bridge/utils/CameraUtils.js +4 -0
- package/dist/native/bridge/utils/FileObjectConverter.d.ts +36 -0
- package/dist/native/bridge/utils/NativeBridge.d.ts +270 -0
- package/dist/native/bridge/utils/NativeBridge.js +10 -0
- package/dist/native/buildAndroid/index.js +1 -1
- package/dist/native/buildAppAndroid.js +9 -0
- package/dist/native/buildAppIos.js +16 -1
- package/dist/native/buildErrorFormat.js +57 -0
- package/dist/native/buildIos/config.js +15 -1
- package/dist/native/buildIos/index.js +1 -1
- package/dist/native/buildIos/plugins.js +10 -1
- package/dist/native/iosnativeWebView/CoreLogic/Package.swift +36 -0
- package/dist/native/iosnativeWebView/{Sources/Core → CoreLogic/Sources/CatalystCoreLogic}/Camera/VideoStreamState.swift +1 -1
- package/dist/native/iosnativeWebView/{Sources/Core → CoreLogic/Sources/CatalystCoreLogic}/Camera/VideoStreamStateMachine.swift +6 -4
- package/dist/native/iosnativeWebView/{Sources/Core → CoreLogic/Sources/CatalystCoreLogic}/Utils/BootTimingUtility.swift +3 -3
- package/dist/native/iosnativeWebView/{Sources/Core → CoreLogic/Sources/CatalystCoreLogic}/Utils/FrameworkServerUtils.swift +14 -9
- package/dist/native/iosnativeWebView/{Sources/Core → CoreLogic/Sources/CatalystCoreLogic}/Utils/NetworkMonitor.swift +11 -9
- package/dist/native/iosnativeWebView/{Sources/Core → CoreLogic/Sources/CatalystCoreLogic}/Utils/NotificationHandlerProvider.swift +1 -1
- package/dist/native/iosnativeWebView/{Sources/Core → CoreLogic/Sources/CatalystCoreLogic}/Utils/URLWhitelistManager.swift +7 -7
- package/dist/native/iosnativeWebView/CoreLogic/Tests/CatalystCoreLogicTests/AnyCodableTests.swift +154 -0
- package/dist/native/iosnativeWebView/{iosnativeWebViewTests → CoreLogic/Tests/CatalystCoreLogicTests}/BootTimingUtilityTests.swift +23 -5
- package/dist/native/iosnativeWebView/CoreLogic/Tests/CatalystCoreLogicTests/CatalystConstantsTests.swift +192 -0
- package/dist/native/iosnativeWebView/{iosnativeWebViewTests → CoreLogic/Tests/CatalystCoreLogicTests}/ConfigMappingTests.swift +1 -1
- package/dist/native/iosnativeWebView/CoreLogic/Tests/CatalystCoreLogicTests/FrameworkServerUtilsErrorPathTests.swift +106 -0
- package/dist/native/iosnativeWebView/CoreLogic/Tests/CatalystCoreLogicTests/FrameworkServerUtilsLoopbackTests.swift +243 -0
- package/dist/native/iosnativeWebView/{iosnativeWebViewTests → CoreLogic/Tests/CatalystCoreLogicTests}/FrameworkServerUtilsTests.swift +1 -1
- package/dist/native/iosnativeWebView/CoreLogic/Tests/CatalystCoreLogicTests/NetworkMonitorTests.swift +119 -0
- package/dist/native/iosnativeWebView/CoreLogic/Tests/CatalystCoreLogicTests/NotificationHandlerProviderTests.swift +59 -0
- package/dist/native/iosnativeWebView/{iosnativeWebViewTests → CoreLogic/Tests/CatalystCoreLogicTests}/NotificationHandlerTests.swift +1 -1
- package/dist/native/iosnativeWebView/{iosnativeWebViewTests → CoreLogic/Tests/CatalystCoreLogicTests}/URLWhitelistManagerTests.swift +1 -1
- package/dist/native/iosnativeWebView/CoreLogic/Tests/CatalystCoreLogicTests/VideoStreamStateMachineTests.swift +171 -0
- package/dist/native/iosnativeWebView/CoreLogic/Tests/CatalystCoreLogicTests/VideoStreamStateTests.swift +91 -0
- package/dist/native/iosnativeWebView/Package.swift +10 -9
- package/dist/native/iosnativeWebView/Sources/CatalystNotifications/LocalNotificationHandler.swift +7 -2
- package/dist/native/iosnativeWebView/Sources/CatalystNotifications/NotificationManager.swift +1 -2
- package/dist/native/iosnativeWebView/Sources/CatalystNotifications/PushNotificationHandler.swift +5 -4
- package/dist/native/iosnativeWebView/Sources/Core/Camera/CameraSessionManager.swift +1 -0
- package/dist/native/iosnativeWebView/Sources/Core/Camera/HoldController.swift +1 -0
- package/dist/native/iosnativeWebView/Sources/Core/Camera/NativeCameraManager.swift +6 -5
- package/dist/native/iosnativeWebView/Sources/Core/Camera/ZoomController.swift +1 -0
- package/dist/native/iosnativeWebView/Sources/Core/Plugins/PluginBridge.swift +1 -0
- package/dist/native/iosnativeWebView/Sources/Core/Utils/CacheManager.swift +31 -30
- package/dist/native/iosnativeWebView/Sources/Core/Utils/CameraTransportUtils.swift +2 -1
- package/dist/native/iosnativeWebView/Sources/Core/Utils/DeviceInfoUtils.swift +1 -1
- package/dist/native/iosnativeWebView/Sources/Core/Utils/FilePickerHandler.swift +22 -19
- package/dist/native/iosnativeWebView/Sources/Core/Utils/ImageHandler.swift +40 -39
- package/dist/native/iosnativeWebView/Sources/Core/Utils/PerfEventBuffer.swift +1 -0
- package/dist/native/iosnativeWebView/Sources/Core/Utils/ResourceURLProtocol.swift +15 -15
- package/dist/native/iosnativeWebView/Sources/Core/Utils/WebKitConfig.swift +4 -3
- package/dist/native/iosnativeWebView/Sources/Core/WebView/BridgeCommandHandler.swift +6 -1
- package/dist/native/iosnativeWebView/Sources/Core/WebView/BridgeDelegateHandler.swift +1 -0
- package/dist/native/iosnativeWebView/Sources/Core/WebView/BridgeFileHandler.swift +2 -1
- package/dist/native/iosnativeWebView/Sources/Core/WebView/BridgeJavaScriptInterface.swift +2 -1
- package/dist/native/iosnativeWebView/Sources/Core/WebView/BridgeMessageValidator.swift +3 -5
- package/dist/native/iosnativeWebView/Sources/Core/WebView/NativeBridge.swift +20 -13
- package/dist/native/iosnativeWebView/Sources/Core/WebView/SplashView.swift +6 -5
- package/dist/native/iosnativeWebView/Sources/Core/WebView/SplashViewModel.swift +14 -13
- package/dist/native/iosnativeWebView/Sources/Core/WebView/TransitionManager.swift +3 -3
- package/dist/native/iosnativeWebView/Sources/Core/WebView/WebView.swift +9 -8
- package/dist/native/iosnativeWebView/Sources/Core/WebView/WebViewModel.swift +7 -6
- package/dist/native/iosnativeWebView/Sources/Core/WebView/WebViewNavigationDelegate.swift +24 -25
- package/dist/native/iosnativeWebView/iosnativeWebView/AppDelegate.swift +6 -1
- package/dist/native/iosnativeWebView/iosnativeWebView/ContentView.swift +1 -0
- package/dist/native/iosnativeWebView/iosnativeWebView/iosnativeWebViewApp.swift +4 -0
- package/dist/native/iosnativeWebView/iosnativeWebView.xcodeproj/project.pbxproj +2 -22
- package/dist/native/iosnativeWebView/iosnativeWebViewTests/BridgeMessageValidatorTests.swift +1 -0
- package/dist/native/iosnativeWebView/iosnativeWebViewTests/CacheManagerTests.swift +1 -0
- package/dist/native/iosnativeWebView/iosnativeWebViewTests/FilePickerHandlerTests.swift +2 -1
- package/dist/native/iosnativeWebView/iosnativeWebViewTests/NativeBridgeTests.swift +15 -9
- package/dist/native/iosnativeWebView/iosnativeWebViewTests/WebViewTests.swift +1 -0
- package/dist/native/setupEmulatorIos.js +2 -2
- package/dist/native/terminalProgress.js +17 -17
- package/dist/router/ClientRouter.d.ts +8 -0
- package/dist/router/ClientRouter.js +13 -11
- package/dist/router/ServerRouter.d.ts +13 -0
- package/dist/router/ServerRouter.js +19 -7
- package/dist/scripts/build.js +14 -2
- package/dist/scripts/loadEnvironmentVariables.js +3 -2
- package/dist/scripts/plugins.js +1 -1
- package/dist/scripts/preServerInit.js +49 -3
- package/dist/scripts/preflight.js +111 -0
- package/dist/scripts/scriptUtils.js +46 -1
- package/dist/scripts/serve.js +7 -3
- package/dist/scripts/start.js +8 -3
- package/dist/server/expressServer.d.ts +1 -0
- package/dist/server/expressServer.js +247 -271
- package/dist/server/manifestCache.d.ts +2 -0
- package/dist/server/manifestCache.js +25 -33
- package/dist/server/renderer/ChunkExtractor.d.ts +44 -0
- package/dist/server/renderer/ChunkExtractor.js +113 -125
- package/dist/server/renderer/document/Body.d.ts +21 -0
- package/dist/server/renderer/document/Body.jsx +45 -45
- package/dist/server/renderer/document/FastRefresh.d.ts +3 -0
- package/dist/server/renderer/document/FastRefresh.jsx +7 -13
- package/dist/server/renderer/document/Head.d.ts +20 -0
- package/dist/server/renderer/document/Head.jsx +32 -32
- package/dist/server/renderer/document/index.d.ts +2 -0
- package/dist/server/renderer/document/index.jsx +2 -2
- package/dist/server/renderer/extract.d.ts +67 -0
- package/dist/server/renderer/extract.js +92 -89
- package/dist/server/renderer/handler.d.ts +2 -0
- package/dist/server/renderer/handler.jsx +401 -404
- package/dist/server/renderer/index.d.ts +2 -0
- package/dist/server/renderer/index.js +5 -8
- package/dist/server/renderer/render.d.ts +35 -0
- package/dist/server/renderer/render.js +25 -32
- package/dist/server/utils/botDetectionMiddleware.d.ts +1 -0
- package/dist/server/utils/botDetectionMiddleware.js +33 -23
- package/dist/server/utils/cjsRequire.d.ts +8 -0
- package/dist/server/utils/cjsRequire.js +2 -2
- package/dist/server/utils/userAgentUtil.d.ts +7 -0
- package/dist/server/utils/userAgentUtil.js +68 -71
- package/dist/server/utils/validator.d.ts +31 -0
- package/dist/server/utils/validator.js +133 -158
- package/dist/vite/inject-cache-key-plugin.js +3 -27
- package/dist/vite/moduleAliases.js +36 -0
- package/dist/vite/node-loader.mjs +2 -29
- package/dist/vite/resolveDevServerConfig.js +4 -1
- package/dist/vite/vite.config.js +2 -29
- package/dist/web-router/components/MetaTag.d.ts +4 -0
- package/dist/web-router/components/MetaTag.jsx +26 -28
- package/dist/web-router/components/MetaTag.test.jsx +100 -0
- package/dist/web-router/components/RouterDataProvider.d.ts +96 -0
- package/dist/web-router/components/RouterDataProvider.jsx +260 -259
- package/dist/web-router/components/RouterDataProvider.server.test.jsx +98 -0
- package/dist/web-router/components/RouterDataProvider.test.jsx +310 -0
- package/dist/web-router/components/Split.d.ts +74 -0
- package/dist/web-router/components/Split.jsx +147 -156
- package/dist/web-router/components/Split.server.test.jsx +52 -0
- package/dist/web-router/components/Split.test.jsx +167 -0
- package/dist/web-router/components/SplitInview.d.ts +22 -0
- package/dist/web-router/components/SplitInview.jsx +78 -89
- package/dist/web-router/components/SplitInview.test.jsx +112 -0
- package/dist/web-router/components/SsrRequestContext.d.ts +20 -0
- package/dist/web-router/components/SsrRequestContext.jsx +17 -7
- package/dist/web-router/components/SsrRequestContext.test.jsx +53 -0
- package/dist/web-router/context.d.ts +15 -0
- package/dist/web-router/context.jsx +5 -5
- package/dist/web-router/context.test.jsx +10 -0
- package/dist/web-router/utils/metaDataUtils.d.ts +24 -0
- package/dist/web-router/utils/metaDataUtils.jsx +86 -86
- package/dist/web-router/utils/metaDataUtils.test.jsx +188 -0
- package/dist/web-router/vitest.setup.js +12 -0
- package/mcp_v2/knowledge-base.json +115 -17
- package/mcp_v2/mcp.js +141 -3
- package/mcp_v2/package-lock.json +2031 -0
- package/mcp_v2/package.json +13 -2
- package/mcp_v2/scripts/copyErrorsIndex.cjs +34 -0
- package/mcp_v2/test/errors.test.ts +123 -0
- package/mcp_v2/test/github.test.ts +177 -0
- package/mcp_v2/tools/errors.d.ts +20 -0
- package/mcp_v2/tools/errors.js +63 -0
- package/mcp_v2/tools/github.d.ts +41 -0
- package/mcp_v2/tools/github.js +231 -0
- package/mcp_v2/vitest.config.mjs +22 -0
- package/package.json +60 -11
- package/test/errors/docsDrift.test.ts +113 -0
- package/test/errors/index.test.ts +200 -0
- package/test/errors/registry.test.ts +108 -0
- package/test/scripts/preflight.test.ts +118 -0
- package/test/server/ChunkExtractor.test.ts +97 -0
- package/test/server/extract.test.ts +128 -0
- package/test/server/fixtures/template/server/document.jsx +19 -0
- package/test/server/fixtures/template/server/index.js +10 -0
- package/test/server/fixtures/template/src/js/containers/App/index.jsx +33 -0
- package/test/server/fixtures/template/src/js/routes/index.jsx +72 -0
- package/test/server/fixtures/template/src/js/routes/utils.jsx +39 -0
- package/test/server/fixtures/template/src/js/store/index.js +19 -0
- package/test/server/handler.assets.test.ts +330 -0
- package/test/server/handler.test.ts +208 -0
- package/test/server/manifestCache.test.ts +71 -0
- package/test/server/render.test.ts +71 -0
- package/test/server/scriptUtils.test.ts +103 -0
- package/test/server/userAgentUtil.test.ts +48 -0
- package/test/server/validator.test.ts +225 -0
- package/test/vite/resolveDevServerConfig.test.js +4 -1
- package/tsconfig.test.json +23 -0
- package/vitest.config.ts +93 -0
- package/dist/caching.js +0 -1
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/DeviceInfoUtilsTest.kt +0 -187
- package/dist/native/bridge/standardizedHooks.js +0 -611
- package/dist/router.js +0 -1
- package/dist/scripts/validator.js +0 -149
- package/dist/web-router/hooks.jsx +0 -72
- package/dist/web-router/types/components/MetaTag.d.ts +0 -2
- package/dist/web-router/types/components/RouterDataProvider.d.ts +0 -95
- package/dist/web-router/types/context.d.ts +0 -14
- package/dist/web-router/types/hooks.d.ts +0 -1
- package/dist/web-router/types/index.d.ts +0 -3
- package/dist/web-router/types/utils/metaDataUtils.d.ts +0 -40
- /package/dist/native/iosnativeWebView/{Sources/Core → CoreLogic/Sources/CatalystCoreLogic}/Constants/CatalystConstants.swift +0 -0
- /package/dist/native/iosnativeWebView/{Sources/Core → CoreLogic/Sources/CatalystCoreLogic}/Constants/ConfigConstants.swift +0 -0
- /package/dist/native/iosnativeWebView/{Sources/Core → CoreLogic/Sources/CatalystCoreLogic}/Notifications/NotificationModels.swift +0 -0
- /package/dist/native/iosnativeWebView/{Sources/Core → CoreLogic/Sources/CatalystCoreLogic}/Protocols/NotificationHandlerProtocol.swift +0 -0
- /package/dist/native/iosnativeWebView/{Sources/Core → CoreLogic/Sources/CatalystCoreLogic}/Utils/NullNotificationHandler.swift +0 -0
|
@@ -31,6 +31,10 @@ var _session = require("../core/session.js");
|
|
|
31
31
|
*/
|
|
32
32
|
|
|
33
33
|
class NavigationCollector {
|
|
34
|
+
// Internal collector state, assigned in the constructor. The perf module is
|
|
35
|
+
// internal to the bridge and deliberately left loosely typed during the
|
|
36
|
+
// migration, so an index signature stands in for per-field declarations.
|
|
37
|
+
|
|
34
38
|
constructor(measure, nativeToWeb) {
|
|
35
39
|
this._measure = measure;
|
|
36
40
|
this._nativeToWeb = nativeToWeb ?? (t => t);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NetworkTimingCollector.js
|
|
3
|
+
*
|
|
4
|
+
* Adds lightweight Catalyst timeline spans for fetch() and XMLHttpRequest.
|
|
5
|
+
* Chrome already has detailed network timing; these spans exist to attach
|
|
6
|
+
* network work to Catalyst interaction sessions via sessionId.
|
|
7
|
+
*/
|
|
8
|
+
export declare class NetworkTimingCollector {
|
|
9
|
+
[key: string]: any;
|
|
10
|
+
constructor(measure: any);
|
|
11
|
+
setInteractionSource(fn: any): void;
|
|
12
|
+
setWaterfallSource(fn: any): void;
|
|
13
|
+
init(): void;
|
|
14
|
+
_wrapFetch(): void;
|
|
15
|
+
_wrapXhr(): void;
|
|
16
|
+
_start(api: any, method: any, rawUrl: any): {
|
|
17
|
+
api: any;
|
|
18
|
+
method: string;
|
|
19
|
+
url: string;
|
|
20
|
+
label: string;
|
|
21
|
+
requestId: string;
|
|
22
|
+
startMark: string;
|
|
23
|
+
startTime: number;
|
|
24
|
+
interactionId: any;
|
|
25
|
+
};
|
|
26
|
+
_finish(span: any, result?: any): void;
|
|
27
|
+
_normalizeUrl(rawUrl: any): string;
|
|
28
|
+
_labelForUrl(url: any): string;
|
|
29
|
+
_statusOk(status: any): boolean;
|
|
30
|
+
}
|
|
@@ -18,6 +18,10 @@ const XHR_WRAPPED = "__catalystNetworkTimingXhrWrapped";
|
|
|
18
18
|
const XHR_META = "__catalystNetworkTimingMeta";
|
|
19
19
|
const MAX_LABEL_LENGTH = 72;
|
|
20
20
|
class NetworkTimingCollector {
|
|
21
|
+
// Internal collector state, assigned in the constructor. The perf module is
|
|
22
|
+
// internal to the bridge and deliberately left loosely typed during the
|
|
23
|
+
// migration, so an index signature stands in for per-field declarations.
|
|
24
|
+
|
|
21
25
|
constructor(measure) {
|
|
22
26
|
this._measure = measure;
|
|
23
27
|
this._getInteraction = null;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RenderCollector.js
|
|
3
|
+
*
|
|
4
|
+
* Instruments: bugs #1, #6, #10, #14, #15, #16
|
|
5
|
+
* #1 page slowness / cache miss → LoAF during navigation session = render blocked by loading
|
|
6
|
+
* #6 blank screens → LoAF blocks first render; LCP may never fire
|
|
7
|
+
* #10 footer flash on Drug/OTC → layout-shift fires just after navigation session closes
|
|
8
|
+
* #14 transitions not soft → layout-shift during nav = skeleton→content swap too abrupt
|
|
9
|
+
* #15 quantity selector slow → LoAF burst in the 2s after interaction (lazy chunk blocks)
|
|
10
|
+
* #16 prescription screen touch lag → same LoAF burst pattern after tap
|
|
11
|
+
*
|
|
12
|
+
* Spans emitted:
|
|
13
|
+
* catalyst:loaf|<ms>ms — long animation frame (Track: Render)
|
|
14
|
+
* detail: blockingDuration, scriptCount, sessionContext
|
|
15
|
+
* catalyst:layout-shift|<value> — unexpected layout shift (Track: Render)
|
|
16
|
+
* detail: value, sessionContext
|
|
17
|
+
* catalyst:fps-drop|<fps>fps-min|<ms>ms — native fps-drop episode (Track: Render)
|
|
18
|
+
* detail: minFps, avgFps, durationMs, sessionContext
|
|
19
|
+
* closes on recovery >55fps OR after 10s max
|
|
20
|
+
* catalyst:long-task|<ms>ms — native long task > 16ms (Track: Render)
|
|
21
|
+
* catalyst:mem/jvm|<MB>MB — JVM heap PSS — Kotlin/Java objects (Track: Render, blue)
|
|
22
|
+
* catalyst:mem/native|<MB>MB — native heap PSS — V8 + Blink + JNI, WebView proxy (Track: Render, orange)
|
|
23
|
+
* catalyst:mem/total|<MB>MB — total process PSS — what Android OOM killer sees (Track: Render, purple→red)
|
|
24
|
+
*
|
|
25
|
+
* Notifies:
|
|
26
|
+
* ScrollCollector.onLoaf() — so scroll session can increment its loafCount
|
|
27
|
+
* HookCollector.onLoaf() — so hook mount sessions can detect LoAF bursts
|
|
28
|
+
*/
|
|
29
|
+
export declare class RenderCollector {
|
|
30
|
+
[key: string]: any;
|
|
31
|
+
constructor(measure: any, getSessionContext: any, nativeToWeb: any);
|
|
32
|
+
/** Called by index.js to wire up interaction session context. */
|
|
33
|
+
setInteractionSource(fn: any): void;
|
|
34
|
+
/** Called by index.js to wire up insights notifications. */
|
|
35
|
+
setInsightsSource(fn: any): void;
|
|
36
|
+
/** Called by index.js to feed the normalized perf store. */
|
|
37
|
+
setWaterfallSource(fn: any): void;
|
|
38
|
+
addLoafListener(fn: any): void;
|
|
39
|
+
init(): void;
|
|
40
|
+
onNativeEvent(event: any): {
|
|
41
|
+
interactionId: any;
|
|
42
|
+
startTime: number;
|
|
43
|
+
endTime: number;
|
|
44
|
+
};
|
|
45
|
+
_observeLoAF(): void;
|
|
46
|
+
_observeLayoutShift(): void;
|
|
47
|
+
}
|
|
@@ -35,6 +35,10 @@ var _constants = require("../core/constants.js");
|
|
|
35
35
|
*/
|
|
36
36
|
|
|
37
37
|
class RenderCollector {
|
|
38
|
+
// Internal collector state, assigned in the constructor. The perf module is
|
|
39
|
+
// internal to the bridge and deliberately left loosely typed during the
|
|
40
|
+
// migration, so an index signature stands in for per-field declarations.
|
|
41
|
+
|
|
38
42
|
constructor(measure, getSessionContext, nativeToWeb) {
|
|
39
43
|
this._measure = measure;
|
|
40
44
|
// getSessionContext() returns 'navigation'|'scroll'|'keyboard'|'none'
|
|
@@ -204,6 +208,8 @@ class RenderCollector {
|
|
|
204
208
|
_observeLoAF() {
|
|
205
209
|
if (!PerformanceObserver.supportedEntryTypes?.includes("long-animation-frame")) return;
|
|
206
210
|
const obs = new PerformanceObserver(list => {
|
|
211
|
+
// long-animation-frame entries carry blockingDuration/scripts, which the
|
|
212
|
+
// base PerformanceEntry type in lib.dom does not declare.
|
|
207
213
|
for (const entry of list.getEntries()) {
|
|
208
214
|
const start = entry.startTime;
|
|
209
215
|
const end = start + entry.duration;
|
|
@@ -243,6 +249,8 @@ class RenderCollector {
|
|
|
243
249
|
_observeLayoutShift() {
|
|
244
250
|
if (!PerformanceObserver.supportedEntryTypes?.includes("layout-shift")) return;
|
|
245
251
|
const obs = new PerformanceObserver(list => {
|
|
252
|
+
// layout-shift entries carry hadRecentInput/value, which the base
|
|
253
|
+
// PerformanceEntry type in lib.dom does not declare.
|
|
246
254
|
for (const entry of list.getEntries()) {
|
|
247
255
|
if (entry.hadRecentInput) continue; // user-initiated shift, ignore
|
|
248
256
|
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ScrollCollector.js
|
|
3
|
+
*
|
|
4
|
+
* Instruments: bugs #3, #13
|
|
5
|
+
* #3 keyboard sticky scroll bug → scroll fires during keyboard session → sticky recalc → layout thrash
|
|
6
|
+
* #13 cart computation jank → fps-drop-episode during scroll → scroll session marked janky
|
|
7
|
+
*
|
|
8
|
+
* Spans emitted:
|
|
9
|
+
* catalyst:session/scroll — scroll-start → scroll-end (Track: Input, shared with keyboard)
|
|
10
|
+
* detail: frameDropCount, minFps, janky, scrollDuration
|
|
11
|
+
*
|
|
12
|
+
* Native events consumed (via index.js _routeNativeEvent):
|
|
13
|
+
* scroll-start { nativeTime } — GestureDetector first onScroll() in CustomWebview.kt
|
|
14
|
+
* scroll-end { nativeTime } — GestureDetector ACTION_UP / ACTION_CANCEL
|
|
15
|
+
*
|
|
16
|
+
* fps-drop-episode routed here (Option B) when scroll session is open:
|
|
17
|
+
* index.js checks this._scroll._session.isOpen before calling onFpsDrop(event)
|
|
18
|
+
*/
|
|
19
|
+
export declare class ScrollCollector {
|
|
20
|
+
[key: string]: any;
|
|
21
|
+
constructor(measure: any, nativeToWeb: any);
|
|
22
|
+
init(): void;
|
|
23
|
+
setInsightsSource(cb: any): void;
|
|
24
|
+
setWaterfallSource(fn: any): void;
|
|
25
|
+
onLoaf(): void;
|
|
26
|
+
onScrollStart(event: any): void;
|
|
27
|
+
onScrollEnd(event: any): void;
|
|
28
|
+
onFpsDrop(event: any): void;
|
|
29
|
+
}
|
|
@@ -26,6 +26,10 @@ var _session = require("../core/session.js");
|
|
|
26
26
|
*/
|
|
27
27
|
|
|
28
28
|
class ScrollCollector {
|
|
29
|
+
// Internal collector state, assigned in the constructor. The perf module is
|
|
30
|
+
// internal to the bridge and deliberately left loosely typed during the
|
|
31
|
+
// migration, so an index signature stands in for per-field declarations.
|
|
32
|
+
|
|
29
33
|
constructor(measure, nativeToWeb) {
|
|
30
34
|
this._measure = measure;
|
|
31
35
|
this._nativeToWeb = nativeToWeb;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ThreadCollector.js
|
|
3
|
+
*
|
|
4
|
+
* Instruments: thread visibility gap during cache serving.
|
|
5
|
+
*
|
|
6
|
+
* Problem: when shouldInterceptRequest serves from cache it calls
|
|
7
|
+
* disableHardwareAcceleration() / enableHardwareAcceleration() on the WebView.
|
|
8
|
+
* This creates a software-render window that is invisible in the Render track
|
|
9
|
+
* because it happens on a bg thread and neither the thread name nor the
|
|
10
|
+
* hw-accel state appears in any existing span.
|
|
11
|
+
*
|
|
12
|
+
* Native events received (via index.js router):
|
|
13
|
+
* hw-accel-change { state: 'off'|'on', trigger: 'cache-serve'|'cleanup',
|
|
14
|
+
* thread, nativeTime }
|
|
15
|
+
*
|
|
16
|
+
* Spans emitted (on Render track):
|
|
17
|
+
* catalyst:hw-accel/off — software-render window open (error = bad, overlaps frames)
|
|
18
|
+
* catalyst:hw-accel/on — hardware acceleration restored (primary)
|
|
19
|
+
*
|
|
20
|
+
* Overlap detection:
|
|
21
|
+
* If a LoAF overlaps a software-render window → notifyInsights so
|
|
22
|
+
* InsightsCollector can fire an 'hw-accel-during-frame' critical insight.
|
|
23
|
+
*/
|
|
24
|
+
export declare class ThreadCollector {
|
|
25
|
+
[key: string]: any;
|
|
26
|
+
constructor(measure: any, nativeToWeb: any);
|
|
27
|
+
/** Called by index.js to wire up insights notifications. */
|
|
28
|
+
setInsightsSource(fn: any): void;
|
|
29
|
+
init(): void;
|
|
30
|
+
onNativeEvent(event: any): void;
|
|
31
|
+
}
|
|
@@ -30,6 +30,10 @@ var _constants = require("../core/constants.js");
|
|
|
30
30
|
*/
|
|
31
31
|
|
|
32
32
|
class ThreadCollector {
|
|
33
|
+
// Internal collector state, assigned in the constructor. The perf module is
|
|
34
|
+
// internal to the bridge and deliberately left loosely typed during the
|
|
35
|
+
// migration, so an index signature stands in for per-field declarations.
|
|
36
|
+
|
|
33
37
|
constructor(measure, nativeToWeb) {
|
|
34
38
|
this._measure = measure;
|
|
35
39
|
this._nativeToWeb = nativeToWeb;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* constants.js
|
|
3
|
+
*
|
|
4
|
+
* Single source of truth for track names, thresholds, and color rules.
|
|
5
|
+
* All collectors import from here — no magic strings scattered across files.
|
|
6
|
+
*/
|
|
7
|
+
export declare const TRACK_GROUP = "Catalyst";
|
|
8
|
+
export declare const TRACK: {
|
|
9
|
+
NAVIGATION: string;
|
|
10
|
+
SCROLL: string;
|
|
11
|
+
INPUT: string;
|
|
12
|
+
KEYBOARD: string;
|
|
13
|
+
RENDER: string;
|
|
14
|
+
MEMORY: string;
|
|
15
|
+
CACHE: string;
|
|
16
|
+
NETWORK: string;
|
|
17
|
+
HOOK: string;
|
|
18
|
+
INTERACTION: string;
|
|
19
|
+
INSIGHTS: string;
|
|
20
|
+
NATIVE_API: string;
|
|
21
|
+
};
|
|
22
|
+
export declare const PREFIX: {
|
|
23
|
+
SESSION_NAV: string;
|
|
24
|
+
SESSION_SCROLL: string;
|
|
25
|
+
SESSION_INPUT: string;
|
|
26
|
+
SESSION_KEYBOARD: string;
|
|
27
|
+
LCP: string;
|
|
28
|
+
FCP: string;
|
|
29
|
+
LOAF: string;
|
|
30
|
+
LAYOUT_SHIFT: string;
|
|
31
|
+
VIEWPORT_RESIZE: string;
|
|
32
|
+
ROUTE_TRANSITION: string;
|
|
33
|
+
CACHE: string;
|
|
34
|
+
CACHE_GROUP: string;
|
|
35
|
+
NETWORK_TIMING: string;
|
|
36
|
+
NATIVE_API: string;
|
|
37
|
+
HOOK_MOUNT: string;
|
|
38
|
+
HOOK_LAZY: string;
|
|
39
|
+
INTERACTION: string;
|
|
40
|
+
SESSION_INTERACTION: string;
|
|
41
|
+
LONG_PRESS: string;
|
|
42
|
+
INSIGHT: string;
|
|
43
|
+
HW_ACCEL: string;
|
|
44
|
+
PAGE_LOAD: string;
|
|
45
|
+
COLD_START: string;
|
|
46
|
+
FPS_DROP: string;
|
|
47
|
+
LONG_TASK: string;
|
|
48
|
+
MEMORY_JVM: string;
|
|
49
|
+
MEMORY_NATIVE: string;
|
|
50
|
+
MEMORY_TOTAL: string;
|
|
51
|
+
};
|
|
52
|
+
export declare const THRESHOLD: {
|
|
53
|
+
LCP_BAD_MS: number;
|
|
54
|
+
NAV_SESSION_BAD_MS: number;
|
|
55
|
+
FETCH_SLOW_MS: number;
|
|
56
|
+
SCROLL_IDLE_MS: number;
|
|
57
|
+
VIEWPORT_MIN_DELTA: number;
|
|
58
|
+
CACHE_GROUP_IDLE_MS: number;
|
|
59
|
+
LOAF_WINDOW: number;
|
|
60
|
+
LONG_PRESS_MS: number;
|
|
61
|
+
INTERACTION_SLOW_MS: number;
|
|
62
|
+
LAZY_LOAF_WINDOW_MS: number;
|
|
63
|
+
CLS_BAD: number;
|
|
64
|
+
};
|
|
65
|
+
export declare const COLOR: {
|
|
66
|
+
ERROR: string;
|
|
67
|
+
PRIMARY: string;
|
|
68
|
+
PRIMARY_LIGHT: string;
|
|
69
|
+
PRIMARY_DARK: string;
|
|
70
|
+
SECONDARY: string;
|
|
71
|
+
SECONDARY_LIGHT: string;
|
|
72
|
+
SECONDARY_DARK: string;
|
|
73
|
+
TERTIARY: string;
|
|
74
|
+
TERTIARY_LIGHT: string;
|
|
75
|
+
TERTIARY_DARK: string;
|
|
76
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* measure.js
|
|
3
|
+
*
|
|
4
|
+
* Shared _measure() and _colorFor() logic used by every collector.
|
|
5
|
+
* Injected as a dependency — collectors never call performance.measure() directly.
|
|
6
|
+
*
|
|
7
|
+
* Chrome DevTools Extensibility API rules (Chrome 128+):
|
|
8
|
+
* - detail must be { devtools: { dataType:'track-entry', ... } }
|
|
9
|
+
* - custom data goes in properties[] as [key, value] pairs
|
|
10
|
+
* - start AND end must both be numeric ms timestamps — passing a mark name
|
|
11
|
+
* string as start causes silent fallback to Timings row (confirmed Chrome 145)
|
|
12
|
+
*/
|
|
13
|
+
export declare class Measure {
|
|
14
|
+
[key: string]: any;
|
|
15
|
+
constructor();
|
|
16
|
+
/**
|
|
17
|
+
* Record a LoAF entry so overlap detection stays current.
|
|
18
|
+
* Called by RenderCollector whenever a long-animation-frame fires.
|
|
19
|
+
*/
|
|
20
|
+
recordLoaf(start: any, end: any): void;
|
|
21
|
+
overlapsLoaf(startMs: any, endMs: any): any;
|
|
22
|
+
/**
|
|
23
|
+
* Emit a performance.measure() with Chrome DevTools Extensibility API metadata.
|
|
24
|
+
*
|
|
25
|
+
* @param {string} name - measure name (catalyst:...)
|
|
26
|
+
* @param {string} startMark - name of the opening performance.mark()
|
|
27
|
+
* @param {number} endTime - end time in ms (performance.now()-space)
|
|
28
|
+
* @param {object} detail - arbitrary detail fields added as properties[]
|
|
29
|
+
* @param {string} track - Chrome DevTools track name (from TRACK constant)
|
|
30
|
+
* @param {string} [color] - override color; if omitted, derived from name+detail
|
|
31
|
+
* @param {string} [trackGroup] - Chrome DevTools track group
|
|
32
|
+
*/
|
|
33
|
+
emit(name: any, startMark: any, endTime: any, detail: {}, track: any, color?: any, trackGroup?: string): void;
|
|
34
|
+
marker(name: any, startTime: any, detail?: {}, color?: string): void;
|
|
35
|
+
_properties(detail: any): any[][];
|
|
36
|
+
_propertyName(key: any): any;
|
|
37
|
+
_propertyValue(value: any): string;
|
|
38
|
+
_colorFor(name: any, detail: any, startTime: any, endTime: any): string;
|
|
39
|
+
}
|
|
@@ -37,6 +37,10 @@ const PROPERTY_PRIORITY = {
|
|
|
37
37
|
responseMs: 5
|
|
38
38
|
};
|
|
39
39
|
class Measure {
|
|
40
|
+
// Internal collector state, assigned in the constructor. The perf module is
|
|
41
|
+
// internal to the bridge and deliberately left loosely typed during the
|
|
42
|
+
// migration, so an index signature stands in for per-field declarations.
|
|
43
|
+
|
|
40
44
|
constructor() {
|
|
41
45
|
// Rolling window of recent LoAF entries — shared across all collectors
|
|
42
46
|
// so any collector can check loafOverlap without knowing about others.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* session.js
|
|
3
|
+
*
|
|
4
|
+
* Reusable open/close session pattern.
|
|
5
|
+
* A session is a named span that stays open until explicitly closed.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* const session = new Session('catalyst:session/scroll', measure, TRACK.SCROLL)
|
|
9
|
+
* session.open({ loafCount: 0 })
|
|
10
|
+
* session.close({ loafCount: 3, janky: true })
|
|
11
|
+
*
|
|
12
|
+
* The session owns its own start mark so callers don't track mark names.
|
|
13
|
+
*/
|
|
14
|
+
export declare class Session {
|
|
15
|
+
[key: string]: any;
|
|
16
|
+
/**
|
|
17
|
+
* @param {string} name - base measure name (catalyst:session/...)
|
|
18
|
+
* @param {Measure} measure - shared Measure instance
|
|
19
|
+
* @param {string} track - Chrome DevTools track name
|
|
20
|
+
*/
|
|
21
|
+
constructor(name: any, measure: any, track: any);
|
|
22
|
+
get isOpen(): boolean;
|
|
23
|
+
get startTime(): any;
|
|
24
|
+
/**
|
|
25
|
+
* Open the session.
|
|
26
|
+
* @param {object} extra - any fields to carry in state (e.g. loafCount)
|
|
27
|
+
* @param {number} [atTime] - override start time (default: performance.now())
|
|
28
|
+
*/
|
|
29
|
+
open(extra?: {}, atTime?: any): void;
|
|
30
|
+
/**
|
|
31
|
+
* Close the session and emit the measure.
|
|
32
|
+
* @param {object} detail - fields added to properties[] in DevTools
|
|
33
|
+
* @param {number} [atTime] - override end time (default: performance.now())
|
|
34
|
+
* @param {string} [color] - override color
|
|
35
|
+
*/
|
|
36
|
+
close(detail?: {}, atTime?: any, color?: any): void;
|
|
37
|
+
/**
|
|
38
|
+
* Read a value stored in session state (e.g. loafCount).
|
|
39
|
+
*/
|
|
40
|
+
get(key: any): any;
|
|
41
|
+
/**
|
|
42
|
+
* Update a value in session state without closing.
|
|
43
|
+
*/
|
|
44
|
+
set(key: any, value: any): void;
|
|
45
|
+
/**
|
|
46
|
+
* Increment a numeric counter in session state.
|
|
47
|
+
*/
|
|
48
|
+
increment(key: any): void;
|
|
49
|
+
}
|
|
@@ -19,6 +19,10 @@ exports.Session = void 0;
|
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
21
|
class Session {
|
|
22
|
+
// Internal collector state, assigned in the constructor. The perf module is
|
|
23
|
+
// internal to the bridge and deliberately left loosely typed during the
|
|
24
|
+
// migration, so an index signature stands in for per-field declarations.
|
|
25
|
+
|
|
22
26
|
/**
|
|
23
27
|
* @param {string} name - base measure name (catalyst:session/...)
|
|
24
28
|
* @param {Measure} measure - shared Measure instance
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export declare class PerfStore {
|
|
2
|
+
[key: string]: any;
|
|
3
|
+
constructor(nativeToWeb: any);
|
|
4
|
+
expose(): void;
|
|
5
|
+
snapshot(): any;
|
|
6
|
+
clear(): void;
|
|
7
|
+
recordNativeEvent(event: any, source?: string): void;
|
|
8
|
+
recordNavigation(data: any): void;
|
|
9
|
+
recordInteraction(data: any): void;
|
|
10
|
+
recordNetwork(data: any): void;
|
|
11
|
+
recordNativeApi(data: any): void;
|
|
12
|
+
recordRender(data: any): void;
|
|
13
|
+
recordHook(data: any): void;
|
|
14
|
+
recordScroll(data: any): void;
|
|
15
|
+
recordKeyboard(data: any): void;
|
|
16
|
+
recordInsight(data: any): void;
|
|
17
|
+
_recordNativeDerivedData(event: any, time: any): void;
|
|
18
|
+
_recordCacheRequest(event: any, time: any): void;
|
|
19
|
+
_recordHwAccel(event: any, time: any): void;
|
|
20
|
+
_updateMemorySummary(event: any, time: any): void;
|
|
21
|
+
_nativeEventTime(event: any): any;
|
|
22
|
+
_nativeEventLabel(event: any): any;
|
|
23
|
+
_eventKind(type: any): "cache" | "event" | "keyboard" | "page-load" | "render" | "scroll" | "startup";
|
|
24
|
+
_renderLabel(data: any): any;
|
|
25
|
+
_renderUnit(metric: any): "fps" | "ms" | "score";
|
|
26
|
+
_add(bucket: any, record: any): any;
|
|
27
|
+
_id(prefix: any): string;
|
|
28
|
+
_createData(): {
|
|
29
|
+
version: number;
|
|
30
|
+
createdAt: string;
|
|
31
|
+
events: undefined[];
|
|
32
|
+
requests: undefined[];
|
|
33
|
+
sessions: undefined[];
|
|
34
|
+
metrics: undefined[];
|
|
35
|
+
insights: undefined[];
|
|
36
|
+
};
|
|
37
|
+
}
|
|
@@ -40,6 +40,10 @@ function isFiniteNumber(value) {
|
|
|
40
40
|
return Number.isFinite(value);
|
|
41
41
|
}
|
|
42
42
|
class PerfStore {
|
|
43
|
+
// Internal collector state, assigned in the constructor. The perf module is
|
|
44
|
+
// internal to the bridge and deliberately left loosely typed during the
|
|
45
|
+
// migration, so an index signature stands in for per-field declarations.
|
|
46
|
+
|
|
43
47
|
constructor(nativeToWeb) {
|
|
44
48
|
this._nativeToWeb = nativeToWeb ?? (time => time);
|
|
45
49
|
this._seq = 0;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export declare function buildSummary(data: any): {
|
|
2
|
+
generatedAt: string;
|
|
3
|
+
counts: {
|
|
4
|
+
events: any;
|
|
5
|
+
sessions: any;
|
|
6
|
+
requests: any;
|
|
7
|
+
metrics: any;
|
|
8
|
+
insights: any;
|
|
9
|
+
};
|
|
10
|
+
byKind: {
|
|
11
|
+
sessions: any;
|
|
12
|
+
requests: any;
|
|
13
|
+
metrics: any;
|
|
14
|
+
};
|
|
15
|
+
slowest: {
|
|
16
|
+
interactions: {
|
|
17
|
+
id: any;
|
|
18
|
+
label: any;
|
|
19
|
+
durationMs: any;
|
|
20
|
+
}[];
|
|
21
|
+
requests: {
|
|
22
|
+
id: any;
|
|
23
|
+
kind: any;
|
|
24
|
+
label: any;
|
|
25
|
+
durationMs: any;
|
|
26
|
+
}[];
|
|
27
|
+
render: {
|
|
28
|
+
id: any;
|
|
29
|
+
kind: any;
|
|
30
|
+
label: any;
|
|
31
|
+
durationMs: any;
|
|
32
|
+
}[];
|
|
33
|
+
};
|
|
34
|
+
interactions: {
|
|
35
|
+
id: any;
|
|
36
|
+
label: any;
|
|
37
|
+
target: any;
|
|
38
|
+
startTime: any;
|
|
39
|
+
durationMs: any;
|
|
40
|
+
requestCount: any;
|
|
41
|
+
renderIssueCount: any;
|
|
42
|
+
insightCount: any;
|
|
43
|
+
nativeApiTimeMs: any;
|
|
44
|
+
networkTimeMs: any;
|
|
45
|
+
slowestRequest: {
|
|
46
|
+
id: any;
|
|
47
|
+
kind: any;
|
|
48
|
+
label: any;
|
|
49
|
+
durationMs: any;
|
|
50
|
+
};
|
|
51
|
+
severity: string;
|
|
52
|
+
}[];
|
|
53
|
+
memory: {
|
|
54
|
+
label: any;
|
|
55
|
+
latest: any;
|
|
56
|
+
peak: any;
|
|
57
|
+
sampleCount: any;
|
|
58
|
+
};
|
|
59
|
+
findings: any[];
|
|
60
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* perf/index.js — WebPerfCollector
|
|
3
|
+
*
|
|
4
|
+
* Thin orchestrator. Responsibilities:
|
|
5
|
+
* 1. Create all collectors with shared dependencies injected
|
|
6
|
+
* 2. Route native events to the correct collector
|
|
7
|
+
* 3. Wire cross-collector notifications (LoAF → Scroll, Keyboard → Scroll,
|
|
8
|
+
* Render → Interaction session, all events → Insights)
|
|
9
|
+
* 4. Expose WebPerfCollector.init(bridge) — called from WebBridge.init()
|
|
10
|
+
* 5. Drain native batch buffer via __catalystPerfBatch + requestIdleCallback
|
|
11
|
+
* 6. Keep a normalized queryable store for console APIs and future DevTools UI
|
|
12
|
+
*
|
|
13
|
+
* No instrumentation logic lives here. All span logic is in collectors/.
|
|
14
|
+
*
|
|
15
|
+
* Native event routing (live path — __catalystPerfEvent):
|
|
16
|
+
* keyboard-show / keyboard-hide → KeyboardCollector
|
|
17
|
+
* cold-start → NavigationCollector (live — emitted after page finishes, JS is ready)
|
|
18
|
+
* page-load-start / page-load-end / page-load-error → NavigationCollector.onBatchEvent
|
|
19
|
+
* (buffered — emitted during WebView lifecycle before JS is ready, flushed post-load)
|
|
20
|
+
* fps-drop-episode / long-task / memory-snapshot → RenderCollector
|
|
21
|
+
* hw-accel-change → ThreadCollector
|
|
22
|
+
* scroll-start / scroll-end → ScrollCollector
|
|
23
|
+
*
|
|
24
|
+
* Native batch routing (post-load idle drain — __catalystPerfBatch):
|
|
25
|
+
* boot-activity-created / boot-webview-constructed /
|
|
26
|
+
* boot-load-url / boot-page-started / boot-page-finished → NavigationCollector.onBatchEvent
|
|
27
|
+
* cache-hit-* / cache-miss-* / network-fetch-complete → CacheCollector.onBatchEvent
|
|
28
|
+
* cache-summary → CacheCollector.onBatchEvent
|
|
29
|
+
* api-call → ApiCollector.onBatchEvent
|
|
30
|
+
*
|
|
31
|
+
* Web-side instrumentation:
|
|
32
|
+
* fetch / XMLHttpRequest → NetworkTimingCollector
|
|
33
|
+
*
|
|
34
|
+
* Cross-collector wiring:
|
|
35
|
+
* RenderCollector.addLoafListener → ScrollCollector.onLoaf
|
|
36
|
+
* RenderCollector.addLoafListener → HookCollector.onLoaf
|
|
37
|
+
* KeyboardCollector (scroll during keyboard) → ScrollCollector.onScrollDuringKeyboard
|
|
38
|
+
* NavigationCollector.isLoading → RenderCollector session context
|
|
39
|
+
* InteractionCollector interaction range → RenderCollector spans
|
|
40
|
+
* InteractionCollector.activeInteractionId → NetworkTimingCollector fetch/XHR spans
|
|
41
|
+
* RenderCollector → InteractionCollector (onFpsDrop)
|
|
42
|
+
* CacheCollector.cache-summary → InsightsCollector.notifyCacheSummary
|
|
43
|
+
* All collectors → InsightsCollector (reactive warnings + session summary)
|
|
44
|
+
* All high-level collector outputs → PerfStore for waterfalls/tables/export
|
|
45
|
+
*/
|
|
46
|
+
declare class WebPerfCollector {
|
|
47
|
+
[key: string]: any;
|
|
48
|
+
constructor();
|
|
49
|
+
static init(bridge: any): void;
|
|
50
|
+
_setup(bridge: any): void;
|
|
51
|
+
_drainBatch(events: any): void;
|
|
52
|
+
_routeBatchEvent(event: any): void;
|
|
53
|
+
_routeNativeEvent(event: any): void;
|
|
54
|
+
_nativeRange(event: any): {
|
|
55
|
+
startTime?: undefined;
|
|
56
|
+
endTime?: undefined;
|
|
57
|
+
} | {
|
|
58
|
+
startTime: number;
|
|
59
|
+
endTime: any;
|
|
60
|
+
};
|
|
61
|
+
_sessionContext(): "keyboard" | "navigation" | "none" | "scroll";
|
|
62
|
+
}
|
|
63
|
+
export default WebPerfCollector;
|
|
@@ -64,6 +64,10 @@ var _NetworkTimingCollector = require("./collectors/NetworkTimingCollector.js");
|
|
|
64
64
|
*/
|
|
65
65
|
|
|
66
66
|
class WebPerfCollector {
|
|
67
|
+
// Internal collector state, assigned in the constructor. The perf module is
|
|
68
|
+
// internal to the bridge and deliberately left loosely typed during the
|
|
69
|
+
// migration, so an index signature stands in for per-field declarations.
|
|
70
|
+
|
|
67
71
|
constructor() {
|
|
68
72
|
// Align native timestamps (SystemClock.elapsedRealtime) to performance.now() space.
|
|
69
73
|
// Read lazily on each call — __NATIVE_TIME_OFFSET is injected via evaluateJavascript
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Device safe-area insets in CSS pixels. Every value is non-negative. */
|
|
2
|
+
export interface SafeAreaInsets {
|
|
3
|
+
top: number;
|
|
4
|
+
right: number;
|
|
5
|
+
bottom: number;
|
|
6
|
+
left: number;
|
|
7
|
+
}
|
|
8
|
+
export declare const DEFAULT_INSETS: SafeAreaInsets;
|
|
9
|
+
export declare const getSafeAreaFromGlobal: () => SafeAreaInsets | null;
|
|
10
|
+
export declare const setSafeAreaGlobal: (insets: any) => SafeAreaInsets;
|
|
11
|
+
export declare const getSafeArea: () => SafeAreaInsets;
|
|
@@ -4,6 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.setSafeAreaGlobal = exports.getSafeAreaFromGlobal = exports.getSafeArea = exports.DEFAULT_INSETS = void 0;
|
|
7
|
+
/** Device safe-area insets in CSS pixels. Every value is non-negative. */
|
|
8
|
+
|
|
7
9
|
const DEFAULT_INSETS = exports.DEFAULT_INSETS = {
|
|
8
10
|
top: 0,
|
|
9
11
|
right: 0,
|