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
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import express from "express"
|
|
2
|
-
import handler from "./handler.jsx"
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
router.use(handler)
|
|
7
|
-
|
|
8
|
-
export default router
|
|
1
|
+
import express from "express";
|
|
2
|
+
import handler from "./handler.jsx";
|
|
3
|
+
const router = express.Router();
|
|
4
|
+
router.use(handler);
|
|
5
|
+
export default router;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { ReactElement } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Returns data used by the Head component for page rendering.
|
|
4
|
+
*/
|
|
5
|
+
export declare const renderStart: ({ inlineCss, deferredRouteInlineCss, jsScripts, criticalPreloadLinks, deferredPreloadLinks, metaTags, isBot, fetcherData, }: {
|
|
6
|
+
inlineCss: string;
|
|
7
|
+
deferredRouteInlineCss: string;
|
|
8
|
+
jsScripts: ReactElement[];
|
|
9
|
+
criticalPreloadLinks: ReactElement[];
|
|
10
|
+
deferredPreloadLinks: ReactElement[];
|
|
11
|
+
metaTags: any[];
|
|
12
|
+
isBot: boolean;
|
|
13
|
+
fetcherData: Record<string, any>;
|
|
14
|
+
}) => {
|
|
15
|
+
inlineCss: string;
|
|
16
|
+
deferredRouteInlineCss: string;
|
|
17
|
+
jsScripts: ReactElement<unknown, string | import("react").JSXElementConstructor<any>>[];
|
|
18
|
+
criticalPreloadLinks: ReactElement<unknown, string | import("react").JSXElementConstructor<any>>[];
|
|
19
|
+
deferredPreloadLinks: ReactElement<unknown, string | import("react").JSXElementConstructor<any>>[];
|
|
20
|
+
metaTags: any[];
|
|
21
|
+
isBot: boolean;
|
|
22
|
+
publicAssetPath: string;
|
|
23
|
+
fetcherData: Record<string, any>;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Returns data used by the Body component for page rendering.
|
|
27
|
+
*/
|
|
28
|
+
export declare const renderEnd: (initialState: Record<string, unknown>, _res: unknown, jsx: ReactElement, errorCode: number | null | undefined, fetcherData: Record<string, any>) => {
|
|
29
|
+
initialState: Record<string, unknown>;
|
|
30
|
+
firstFoldCss: string;
|
|
31
|
+
firstFoldJS: string;
|
|
32
|
+
jsx: ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
33
|
+
errorCode: number;
|
|
34
|
+
fetcherData: Record<string, any>;
|
|
35
|
+
};
|
|
@@ -2,6 +2,17 @@
|
|
|
2
2
|
* Returns data used by the Head component for page rendering.
|
|
3
3
|
*/
|
|
4
4
|
export const renderStart = ({
|
|
5
|
+
inlineCss,
|
|
6
|
+
deferredRouteInlineCss,
|
|
7
|
+
jsScripts,
|
|
8
|
+
criticalPreloadLinks,
|
|
9
|
+
deferredPreloadLinks,
|
|
10
|
+
metaTags,
|
|
11
|
+
isBot,
|
|
12
|
+
fetcherData
|
|
13
|
+
}) => {
|
|
14
|
+
const publicAssetPath = `${process.env.PUBLIC_STATIC_ASSET_URL}${process.env.PUBLIC_STATIC_ASSET_PATH}`;
|
|
15
|
+
return {
|
|
5
16
|
inlineCss,
|
|
6
17
|
deferredRouteInlineCss,
|
|
7
18
|
jsScripts,
|
|
@@ -9,39 +20,21 @@ export const renderStart = ({
|
|
|
9
20
|
deferredPreloadLinks,
|
|
10
21
|
metaTags,
|
|
11
22
|
isBot,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
let publicAssetPath = `${process.env.PUBLIC_STATIC_ASSET_URL}${process.env.PUBLIC_STATIC_ASSET_PATH}`
|
|
17
|
-
|
|
18
|
-
if (JSON.parse(IS_DEV_COMMAND)) {
|
|
19
|
-
publicAssetPath = `http://${WEBPACK_DEV_SERVER_HOSTNAME}:${WEBPACK_DEV_SERVER_PORT}/assets/`
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
return {
|
|
23
|
-
inlineCss,
|
|
24
|
-
deferredRouteInlineCss,
|
|
25
|
-
jsScripts,
|
|
26
|
-
criticalPreloadLinks,
|
|
27
|
-
deferredPreloadLinks,
|
|
28
|
-
metaTags,
|
|
29
|
-
isBot,
|
|
30
|
-
publicAssetPath,
|
|
31
|
-
fetcherData,
|
|
32
|
-
}
|
|
33
|
-
}
|
|
23
|
+
publicAssetPath,
|
|
24
|
+
fetcherData
|
|
25
|
+
};
|
|
26
|
+
};
|
|
34
27
|
|
|
35
28
|
/**
|
|
36
29
|
* Returns data used by the Body component for page rendering.
|
|
37
30
|
*/
|
|
38
|
-
export const renderEnd = (initialState = {},
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
31
|
+
export const renderEnd = (initialState = {}, _res, jsx, errorCode, fetcherData) => {
|
|
32
|
+
return {
|
|
33
|
+
initialState,
|
|
34
|
+
firstFoldCss: "",
|
|
35
|
+
firstFoldJS: "",
|
|
36
|
+
jsx,
|
|
37
|
+
errorCode,
|
|
38
|
+
fetcherData
|
|
39
|
+
};
|
|
40
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function botDetectionMiddleware(req: any, res: any, next: any): void;
|
|
@@ -1,29 +1,39 @@
|
|
|
1
|
-
import { getUserAgentDetails } from "./userAgentUtil.js"
|
|
1
|
+
import { getUserAgentDetails } from "./userAgentUtil.js";
|
|
2
2
|
|
|
3
3
|
// Loaded once at startup when OTEL is enabled; null otherwise.
|
|
4
|
-
let _context, _trace, _IS_BOT_KEY
|
|
4
|
+
let _context, _trace, _IS_BOT_KEY;
|
|
5
|
+
// config.json booleans survive the process.env swap in loadEnvironmentVariables(),
|
|
6
|
+
// so this is genuinely true at runtime when config sets OTEL_ENABLE: true. The cast
|
|
7
|
+
// exists only because TS types process.env values as string | undefined.
|
|
5
8
|
if (process.env.OTEL_ENABLE === true) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
try {
|
|
10
|
+
const {
|
|
11
|
+
context,
|
|
12
|
+
trace
|
|
13
|
+
} = await import("@opentelemetry/api");
|
|
14
|
+
const {
|
|
15
|
+
IS_BOT_KEY
|
|
16
|
+
} = await import("../../otel.js");
|
|
17
|
+
_context = context;
|
|
18
|
+
_trace = trace;
|
|
19
|
+
_IS_BOT_KEY = IS_BOT_KEY;
|
|
20
|
+
} catch {
|
|
21
|
+
// otel packages not installed — context injection skipped
|
|
22
|
+
}
|
|
15
23
|
}
|
|
16
|
-
|
|
17
24
|
export function botDetectionMiddleware(req, res, next) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
const ua = req.headers["user-agent"] || "";
|
|
26
|
+
const {
|
|
27
|
+
googleBot,
|
|
28
|
+
aiBot,
|
|
29
|
+
statusCakeBot
|
|
30
|
+
} = getUserAgentDetails(ua);
|
|
31
|
+
const isBot = !!(googleBot || aiBot || statusCakeBot);
|
|
32
|
+
res.locals.is_bot = isBot;
|
|
33
|
+
if (_context && _IS_BOT_KEY) {
|
|
34
|
+
_trace?.getActiveSpan()?.setAttribute("http.response.is_bot", isBot);
|
|
35
|
+
_context.with(_context.active().setValue(_IS_BOT_KEY, isBot), next);
|
|
36
|
+
} else {
|
|
37
|
+
next();
|
|
38
|
+
}
|
|
29
39
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared helper to bridge ESM server entry files with legacy CommonJS helpers.
|
|
3
|
+
*
|
|
4
|
+
* Usage (in an ESM server file):
|
|
5
|
+
* import { cjsRequire } from "catalyst-core/server/cjsRequire"
|
|
6
|
+
* const legacyHelper = cjsRequire("./legacy/helper")
|
|
7
|
+
*/
|
|
8
|
+
export declare const cjsRequire: NodeJS.Require;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createRequire } from "module"
|
|
1
|
+
import { createRequire } from "module";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Shared helper to bridge ESM server entry files with legacy CommonJS helpers.
|
|
@@ -7,4 +7,4 @@ import { createRequire } from "module"
|
|
|
7
7
|
* import { cjsRequire } from "catalyst-core/server/cjsRequire"
|
|
8
8
|
* const legacyHelper = cjsRequire("./legacy/helper")
|
|
9
9
|
*/
|
|
10
|
-
export const cjsRequire = createRequire(import.meta.url)
|
|
10
|
+
export const cjsRequire = createRequire(import.meta.url);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const STATUS_CAKE_USER_AGENT_MOBILE = "StatusCake_Pagespeed_Indev";
|
|
2
|
+
/**
|
|
3
|
+
* returns object which contains google bot and user-agent info
|
|
4
|
+
* @param {string} ua - user agent
|
|
5
|
+
* @return {object} - returns user agent
|
|
6
|
+
*/
|
|
7
|
+
export declare const getUserAgentDetails: (ua: any) => any;
|
|
@@ -1,93 +1,90 @@
|
|
|
1
|
-
import parser from "ua-parser-js"
|
|
2
|
-
|
|
1
|
+
import parser from "ua-parser-js";
|
|
3
2
|
const googleBots = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
3
|
+
"APIs-Google": "APIs-Google",
|
|
4
|
+
AdSense: "Mediapartners-Google",
|
|
5
|
+
"AdsBot Mobile Web Android": "AdsBot-Google-Mobile",
|
|
6
|
+
"AdsBot Mobile Web": "AdsBot-Google-Mobile",
|
|
7
|
+
AdsBot: "AdsBot-Google",
|
|
8
|
+
"Mobile AdSense": "Mediapartners-Google",
|
|
9
|
+
"Mobile Apps Android": "AdsBot-Google-Mobile-Apps",
|
|
10
|
+
Feedfetcher: "FeedFetcher-Google",
|
|
11
|
+
"Google Read Aloud": "Google-Read-Aloud",
|
|
12
|
+
"Duplex on the Web": "DuplexWeb-Google",
|
|
13
|
+
"Google Favicon": "Google Favicon",
|
|
14
|
+
"Web Light": "googleweblight",
|
|
15
|
+
"Amp crawler": "Google-AMPHTM",
|
|
16
|
+
Googlebot: "Googlebot",
|
|
17
|
+
"Google Inspection Tool": "Google-InspectionTool",
|
|
18
|
+
"Google Agent": "Google-Agent"
|
|
19
|
+
};
|
|
21
20
|
|
|
22
21
|
// AI Crawler bots - for improved SEO with AI search engines
|
|
23
22
|
const aiCrawlerBots = {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
// Meta Crawler bot
|
|
42
|
-
MetaBot: "meta-externalagent",
|
|
43
|
-
}
|
|
23
|
+
// OpenAI/ChatGPT bots
|
|
24
|
+
GPTBot: "GPTBot",
|
|
25
|
+
"ChatGPT-User": "ChatGPT-User",
|
|
26
|
+
"OAI-SearchBot": "OAI-SearchBot",
|
|
27
|
+
// Anthropic/Claude bots
|
|
28
|
+
ClaudeBot: "ClaudeBot",
|
|
29
|
+
"Claude-User": "Claude-User",
|
|
30
|
+
"Claude-SearchBot": "Claude-SearchBot",
|
|
31
|
+
// Perplexity bots
|
|
32
|
+
PerplexityBot: "PerplexityBot",
|
|
33
|
+
"Perplexity-User": "Perplexity-User",
|
|
34
|
+
// Microsoft Bing bot (also powers Bing Chat/Copilot)
|
|
35
|
+
Bingbot: "bingbot",
|
|
36
|
+
// Meta Crawler bot
|
|
37
|
+
MetaBot: "meta-externalagent"
|
|
38
|
+
};
|
|
44
39
|
|
|
45
40
|
// StatusCake synthetic monitoring user agents.
|
|
46
41
|
// STATUS_CAKE_USER_AGENT_MOBILE matches the mobile pagespeed monitor — kept as a
|
|
47
42
|
// named export so apps that compare UAs directly (mweb's document.js, App/index.js)
|
|
48
43
|
// can import the same constant catalyst uses for its bot detection.
|
|
49
|
-
export const STATUS_CAKE_USER_AGENT_MOBILE = "StatusCake_Pagespeed_Indev"
|
|
44
|
+
export const STATUS_CAKE_USER_AGENT_MOBILE = "StatusCake_Pagespeed_Indev";
|
|
50
45
|
const statusCakeBots = {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
46
|
+
"StatusCake Pagespeed Mobile": STATUS_CAKE_USER_AGENT_MOBILE,
|
|
47
|
+
StatusCake: "StatusCake"
|
|
48
|
+
};
|
|
54
49
|
|
|
55
50
|
/**
|
|
56
51
|
* check if user agent contains bot data
|
|
57
52
|
* @param {string} ua - user agent
|
|
58
53
|
* @return {string|null}
|
|
59
54
|
*/
|
|
60
|
-
const getGoogleBot =
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
return null
|
|
79
|
-
}
|
|
55
|
+
const getGoogleBot = ua => {
|
|
56
|
+
for (let key in googleBots) {
|
|
57
|
+
if (ua.includes(googleBots[key])) return key;
|
|
58
|
+
}
|
|
59
|
+
return null;
|
|
60
|
+
};
|
|
61
|
+
const getAICrawlerBot = ua => {
|
|
62
|
+
for (let key in aiCrawlerBots) {
|
|
63
|
+
if (ua.includes(aiCrawlerBots[key])) return key;
|
|
64
|
+
}
|
|
65
|
+
return null;
|
|
66
|
+
};
|
|
67
|
+
const getStatusCakeBot = ua => {
|
|
68
|
+
for (let key in statusCakeBots) {
|
|
69
|
+
if (ua.includes(statusCakeBots[key])) return key;
|
|
70
|
+
}
|
|
71
|
+
return null;
|
|
72
|
+
};
|
|
80
73
|
|
|
81
74
|
/**
|
|
82
75
|
* returns object which contains google bot and user-agent info
|
|
83
76
|
* @param {string} ua - user agent
|
|
84
77
|
* @return {object} - returns user agent
|
|
85
78
|
*/
|
|
86
|
-
export const getUserAgentDetails =
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
79
|
+
export const getUserAgentDetails = ua => {
|
|
80
|
+
const agentDetails = parser(ua);
|
|
81
|
+
const googleBot = getGoogleBot(ua);
|
|
82
|
+
const aiBot = getAICrawlerBot(ua);
|
|
83
|
+
const statusCakeBot = getStatusCakeBot(ua);
|
|
84
|
+
return {
|
|
85
|
+
...agentDetails,
|
|
86
|
+
googleBot,
|
|
87
|
+
aiBot,
|
|
88
|
+
statusCakeBot
|
|
89
|
+
};
|
|
90
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
declare const handleError: (e: any) => void;
|
|
2
|
+
declare const validatePreInitServer: (fn: any) => any;
|
|
3
|
+
declare const validateMiddleware: (fn: any) => any;
|
|
4
|
+
declare const validateReducerFunction: (fn: any) => any;
|
|
5
|
+
declare const validateConfigFile: (obj: any) => any;
|
|
6
|
+
declare const validatePackageJson: (obj: any) => any;
|
|
7
|
+
declare const validateModuleAlias: (obj: any) => any;
|
|
8
|
+
declare const validateConfigureStore: (fn: any) => any;
|
|
9
|
+
declare const validateGetRoutes: (fn: any) => any;
|
|
10
|
+
declare const validateCustomDocument: (fn: any) => any;
|
|
11
|
+
/**
|
|
12
|
+
* Safely call a function, catching and logging any errors — including a
|
|
13
|
+
* rejected promise if `fn` is async. Used for user-defined hooks
|
|
14
|
+
* (preServerInit, onRouteMatch, onFetcherError, onServerError, etc.) that
|
|
15
|
+
* should never crash the SSR pipeline.
|
|
16
|
+
*
|
|
17
|
+
* Async by necessity: awaiting `fn`'s return value is the only way to catch
|
|
18
|
+
* a rejection in the same try/catch as a synchronous throw. Existing call
|
|
19
|
+
* sites that don't await safeCall(...) are unaffected — they already
|
|
20
|
+
* treated its return value as fire-and-forget — but the rejection now
|
|
21
|
+
* reaches the same structured-error path a sync throw does, instead of
|
|
22
|
+
* surfacing as an unhandled promise rejection.
|
|
23
|
+
*/
|
|
24
|
+
declare const safeCall: (fn: any, ...args: any[]) => Promise<any>;
|
|
25
|
+
/**
|
|
26
|
+
* Same as safeCall, but names the specific hook (e.g. "preServerInit") in the
|
|
27
|
+
* error so it's identifiable rather than generic. Used at call sites that know
|
|
28
|
+
* which hook they're invoking.
|
|
29
|
+
*/
|
|
30
|
+
declare const safeCallNamed: (hookName: any, fn: any, ...args: any[]) => Promise<any>;
|
|
31
|
+
export { handleError, validateConfigFile, validateConfigureStore, validateCustomDocument, validateGetRoutes, validatePackageJson, validateReducerFunction, validateModuleAlias, validatePreInitServer, validateMiddleware, safeCall, safeCallNamed, };
|