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
package/changelog.md
CHANGED
|
@@ -1,4 +1,108 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [1.0.0] - unreleased
|
|
4
|
+
|
|
5
|
+
This release freezes the public API. The root entry of `catalyst-core` now exports exactly eight names and nothing else: `RouterDataProvider`, `useCurrentRouteData`, `useRouterData`, `MetaTag`, `split`, `hydrationReady`, `Head`, and `Body`. Anything previously reachable through the root entry but not in that list is no longer public. Applications that import a removed name will fail at build time rather than silently resolving to `undefined`.
|
|
6
|
+
|
|
7
|
+
### React Router is no longer re-exported
|
|
8
|
+
|
|
9
|
+
`catalyst-core` used to re-export the whole of React Router from its root entry, so `Link`, `Outlet`, `RouterProvider`, `useParams`, `useNavigate` and every other router name could be imported from `catalyst-core`. That re-export is gone.
|
|
10
|
+
|
|
11
|
+
React Router is now a peer dependency (`^7.18.2`). Install it in the application:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install react-router@^7.18.2
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Then import router names from `react-router` directly. An import line that mixed both sources splits into two:
|
|
18
|
+
|
|
19
|
+
```js
|
|
20
|
+
// before
|
|
21
|
+
import { useCurrentRouteData, useParams, Link } from "catalyst-core"
|
|
22
|
+
|
|
23
|
+
// after
|
|
24
|
+
import { useCurrentRouteData } from "catalyst-core"
|
|
25
|
+
import { useParams, Link } from "react-router"
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
One exception: `client/index.js` imports `RouterProvider` from `react-router/dom`, not from `react-router`. The `react-router/dom` build passes React DOM's `flushSync` into the router, which view transitions and `flushSync` navigations depend on. The `react-router` export renders the same tree but silently skips that.
|
|
29
|
+
|
|
30
|
+
Because the version is now declared by the application, npm will report a peer dependency conflict if the installed React Router major does not satisfy `^7.18.2`. The server also verifies the resolved version at startup and exits with a clear error if React Router is missing or outside the supported range.
|
|
31
|
+
|
|
32
|
+
### Removed export paths
|
|
33
|
+
|
|
34
|
+
- `catalyst-core/caching` — removed. The caching feature was withdrawn and has no replacement.
|
|
35
|
+
- `catalyst-core/document` — removed. Import `Head` and `Body` from the `catalyst-core` root entry instead.
|
|
36
|
+
|
|
37
|
+
### No default export from the root entry
|
|
38
|
+
|
|
39
|
+
`split` was previously exported both as a named export and as the default. The default export is gone; use the named one.
|
|
40
|
+
|
|
41
|
+
```js
|
|
42
|
+
// before
|
|
43
|
+
import split from "catalyst-core"
|
|
44
|
+
|
|
45
|
+
// after
|
|
46
|
+
import { split } from "catalyst-core"
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Names that are no longer public
|
|
50
|
+
|
|
51
|
+
These were reachable from the root entry and are now internal: `RouterContext`, `serverDataFetcher`, `mergeHeadElements`, `deleteHeadTagsByDataAttribute`, `getMetaData`, and `useNavigateWithTransition`. In addition, `sanitizeFilePickerOptions` is no longer exported from `catalyst-core/hooks`. None of these have a supported replacement. If an application depends on one of them, open an issue describing the use case before upgrading.
|
|
52
|
+
|
|
53
|
+
### Native hooks: canonical keys
|
|
54
|
+
|
|
55
|
+
The native hooks now agree on one set of key names. Every change in this section is additive: no key that a hook returned before has been removed or repointed, so existing components keep working.
|
|
56
|
+
|
|
57
|
+
Several hooks were missing keys that the rest of the surface already had. `useNotificationPermission` gained `loading`, `data`, `error`, `isNative`, and `isWeb`, and it now reports permission failures as a standard error object instead of only logging them. `useCameraPermission` gained `loading`, `data`, `error`, `execute`, `isNative`, and `isWeb` on the same pattern. `useDeviceInfo` gained `data` alongside its existing `deviceInfo`. `useNativeTransition` gained `loading` alongside `transitioning`. The SSR stub returned by `useAI` reported `isWeb: false`, which was wrong on both counts; it now reports `isWeb: true`.
|
|
58
|
+
|
|
59
|
+
Where a hook had two names for one value, the shorter one is canonical and the older one is a deprecated alias that will be removed at 2.0: `loading` over `isLoading` and `transitioning`, `data` over `deviceInfo` and `permission`, and `execute` over `request`.
|
|
60
|
+
|
|
61
|
+
Hooks fall into three categories, and the category decides whether a hook has `execute`. A hook that wraps a single native operation exposes it as `execute` plus a domain-specific alias — `takePhoto`, `pickFile`, `openFile`, `signIn`, `trigger`, `request`. A hook that wraps several distinct operations has no single action to name, so its named functions are the API and it has no `execute` at all: `useVideoStream`, `useDataProtection`, and `useNativeTransition` work this way. A read-only hook reports ambient device state and has no action functions at all: `useNetworkStatus`, `useDeviceInfo`, and `useSafeArea` return state plus the runtime-context keys. `useNotification` is the one exception. It carries `execute` and `schedule` as aliases of `scheduleLocal` for backward compatibility. Both are frozen, both are discouraged, and neither should be read as the pattern for multi-action hooks. `execute` never takes an operation name as a string argument; it takes the arguments of the operation itself.
|
|
62
|
+
|
|
63
|
+
Hook errors are `CatalystError` values from the framework-wide error registry introduced in this release, carrying a `RUNTIME-NATIVE-*` code, a message, a category, a suggested action, a documentation link, and the originating platform error as `cause`. `useVideoStream` in particular used to report seventeen failures as bare `{ message }` objects with no code at all; those now carry real codes, and a camera denial reports the same code whether it comes from the permission hook or the stream. The error object's fields changed with it: `action` is now `suggestedAction`, `nativeError` is now `cause`, `recoverable` and `timestamp` are gone, and `code` values are registry codes such as `RUNTIME-NATIVE-001` instead of names such as `PERMISSION_DENIED`, so compare against `ERROR_CODES` from `catalyst-core/errors` rather than string literals.
|
|
64
|
+
|
|
65
|
+
One consequence for error logging: `CatalystError` extends `Error`, so `message` now lives on the prototype rather than as an own property. Reading `error.message` is unaffected, but `JSON.stringify(error)` no longer includes it. Log `error.message` explicitly, or use the `code` and `docUrl` fields.
|
|
66
|
+
|
|
67
|
+
Two hooks are exempt from the error contract. `useNativeTransition` and `useSafeArea` return no `error` key, because transition failures self-heal into a plain navigation and safe-area insets always resolve to numeric defaults. Two others carry the right key with the wrong type: `error` on `useDeviceInfo` and `useNetworkStatus` is still a plain string rather than an error object, and stays a string until 2.0. The shape of `useAI` is owned by the `catalyst-ai` package and sits outside this contract entirely.
|
|
68
|
+
|
|
69
|
+
`requestHapticFeedback` and `requestCameraPermission` remain available both as `catalyst-core/hooks` exports and as `WebBridge` methods, and the two versions still differ in their defaults and return types. The hooks exports are the ones to prefer in application code: they are SSR-safe and treat a denied permission as a rejection. The two surfaces are unified at 2.0.
|
|
70
|
+
|
|
71
|
+
### Node 22.12 is now the minimum
|
|
72
|
+
|
|
73
|
+
The error registry is loaded from the native bridge, which is built as CommonJS, so the package relies on `require()` of an ES module. That is unflagged only from Node 22.12 onward, and `engines` now declares `>=22.12`. Node 20 installs will warn, and importing `catalyst-core/hooks` or `catalyst-core/WebBridge` there fails with `ERR_REQUIRE_ESM`.
|
|
74
|
+
|
|
75
|
+
### App contract violations are reported at startup
|
|
76
|
+
|
|
77
|
+
The app contract validators in `server/utils/validator.js` used to log a bare message and return `undefined` when an app was missing a required export, which pushed the real failure into an unrelated `TypeError` deep inside a render. They now report through the shared error reporter instead, naming the specific file and export and what the app must provide, with detail governed by the output mode. Reporting is not fatal: startup continues, so an app that is only partly misconfigured still boots and the startup output explains what will fail.
|
|
78
|
+
|
|
79
|
+
The route and store checks moved out of the per-request path. `validateGetRoutes` and `validateConfigureStore` now run once when the renderer module loads — at server startup in production, and on the first SSR request in development, where the handler is loaded lazily — rather than once per request inside the handler's `try`/`catch`. The shape of `addMiddlewares` from `server/server.js` is checked during server setup.
|
|
80
|
+
|
|
81
|
+
Module aliases and `config/config.json` keys are not checked at load time; a missing alias or key still surfaces where it is used. An application that satisfies the contract sees no change. The full contract — the files Catalyst imports by fixed path and the required module aliases — is documented under File Conventions.
|
|
82
|
+
The webpack-era keys `WEBPACK_DEV_SERVER_HOSTNAME`, `WEBPACK_DEV_SERVER_PORT` and `ANALYZE_BUNDLE` are no longer required or read; remove them from `config/config.json`.
|
|
83
|
+
|
|
84
|
+
## [0.3.0-beta.5] - 2026-08-18
|
|
85
|
+
|
|
86
|
+
- Upgrade react-router-dom v6 to v7.18.2 (CVE fixes) (#399).
|
|
87
|
+
- Docs: clarify setMetaData must return array of JSX elements (#327).
|
|
88
|
+
|
|
89
|
+
## [0.3.0-beta.4] - 2026-08-10
|
|
90
|
+
|
|
91
|
+
- Detect CommonJS by parsing, not by matching source text (#397).
|
|
92
|
+
- Sub-path base + HMR config for reverse-proxy dev setups (#379).
|
|
93
|
+
|
|
94
|
+
## [0.3.0-beta.3] - 2026-08-04
|
|
95
|
+
|
|
96
|
+
- Resolve semgrep and dependency findings from security scan (#375).
|
|
97
|
+
|
|
98
|
+
## [0.3.0-beta.2] - 2026-08-03
|
|
99
|
+
|
|
100
|
+
- @catalyst/cloud-ai — multi-provider AI integration with useAI hook (#288).
|
|
101
|
+
- Eliminate SSR streaming race between onShellReady and onAllReady (#323).
|
|
102
|
+
- Update iOS release docs and MCP guidance (#324).
|
|
103
|
+
- Patch @tailwindcss/postcss base so Vite scans the whole app (#326).
|
|
104
|
+
|
|
105
|
+
## [0.3.0-beta.1] - 2026-07-15
|
|
2
106
|
|
|
3
107
|
- Replaced the Webpack build and SSR pipeline with Vite and ESM.
|
|
4
108
|
- Added React 19 Suspense-aware routing, split components, and manifest-based asset loading.
|
|
@@ -6,13 +110,51 @@
|
|
|
6
110
|
- Preserved native application builds, internal plugins, Sentry exports, and safe-area SSR hydration.
|
|
7
111
|
- Removed the legacy `devBuild` and `devServe` commands.
|
|
8
112
|
|
|
9
|
-
|
|
113
|
+
## [0.2.0-beta.3] - 2026-07-14
|
|
114
|
+
|
|
115
|
+
- Catalyst Profiler Runtime (#274).
|
|
116
|
+
|
|
117
|
+
## [0.2.0-beta.2] - 2026-07-09
|
|
118
|
+
|
|
119
|
+
- Route Caching (#287).
|
|
120
|
+
- Android build fixes (#303).
|
|
121
|
+
|
|
122
|
+
## [0.2.0-beta.1] - 2026-07-08
|
|
123
|
+
|
|
124
|
+
- Catalyst react + rendering update (#293).
|
|
125
|
+
- Add GitHub feedback integration to Catalyst MCP v2 (#272).
|
|
126
|
+
- Sync MCP v2: extract seeding, delegate docs sync, add FTS + initial sync (#295).
|
|
127
|
+
|
|
128
|
+
## [0.1.0-beta.7] - 2026-06-29
|
|
129
|
+
|
|
130
|
+
- Syncing dweb branch with main (#283).
|
|
131
|
+
|
|
132
|
+
## [0.1.0-beta.6] - 2026-06-11
|
|
133
|
+
|
|
134
|
+
- Add examples folder with local testing app for catalyst-core (#246).
|
|
135
|
+
|
|
136
|
+
## [0.1.0-beta.5] - 2026-06-09
|
|
137
|
+
|
|
138
|
+
- Semgrep Plugin Fixes (#266).
|
|
139
|
+
|
|
140
|
+
## [0.1.0-beta.4] - 2026-06-03
|
|
141
|
+
|
|
142
|
+
- Merge video hook, web fallback, and plugin system into monorepo (#258).
|
|
143
|
+
|
|
144
|
+
## [0.1.0-beta.3] - 2026-06-02
|
|
145
|
+
|
|
146
|
+
- Security Fixes (semgrep) (#259).
|
|
147
|
+
- Catalyst Docs Mismatches Fix (#244).
|
|
10
148
|
|
|
11
149
|
## [0.1.0-beta.2] - 2026-05-06
|
|
12
150
|
|
|
13
151
|
- Moved Catalyst into a monorepo structure with `catalyst-core`, `create-catalyst-app`, the Catalyst docs app, and the Catalyst core test app managed from one repository.
|
|
14
152
|
- Replaced the internal-package pre-release flow with a local release sandbox that scaffolds a real app using current-branch CCA and a locally packed current-branch `catalyst-core`.
|
|
15
153
|
|
|
154
|
+
## [0.1.0-canary.9] - 2026-05-06
|
|
155
|
+
|
|
156
|
+
- Changelog-only update; same code as 0.1.0-beta.2.
|
|
157
|
+
|
|
16
158
|
## [0.1.0-canary.8] - 2026-04-15
|
|
17
159
|
|
|
18
160
|
- Introduced Catalyst’s internal plugin architecture, adding the `PluginBridge` web API, native plugin runtimes for Android and iOS, and manifest-driven build composition for modular native capabilities.
|
|
@@ -40,7 +182,7 @@
|
|
|
40
182
|
- Improved universal app runtime behavior with safe-area inset support, edge-to-edge rendering, and notification permission override fixes.
|
|
41
183
|
- Expanded platform support with offline fallback handling, notification/access-control refinements, localhost HTTP allowances for local development, and file-picker/HTTPS server improvements.
|
|
42
184
|
|
|
43
|
-
## [0.1.0-canary.4] - 2026-02-
|
|
185
|
+
## [0.1.0-canary.4] - 2026-02-16
|
|
44
186
|
|
|
45
187
|
- Added Google Sign-In support for both Android and iOS in Catalyst, enabling a unified native authentication experience for apps built on the framework.
|
|
46
188
|
- Improved release/build reliability with related bridge and CI updates, making integration smoother and more consistent across platforms.
|
|
@@ -68,26 +210,26 @@
|
|
|
68
210
|
- Notification refactor: streamlined config toggle for local vs push, centralized permission/asset handling, and simpler routing into the web app
|
|
69
211
|
- Access control: combined access control config for ios
|
|
70
212
|
|
|
71
|
-
## [0.0.3-canary.18] - 2025-11-
|
|
213
|
+
## [0.0.3-canary.18] - 2025-11-25
|
|
72
214
|
|
|
73
215
|
- Configuration Files
|
|
74
216
|
- Android Native WebView - MainActivity.kt
|
|
75
217
|
- Android Native WebView - CustomWebview.kt
|
|
76
218
|
|
|
77
|
-
## [0.0.3-canary.17] - 2025-11-
|
|
219
|
+
## [0.0.3-canary.17] - 2025-11-21
|
|
78
220
|
|
|
79
|
-
-
|
|
80
|
-
-
|
|
81
|
-
-
|
|
82
|
-
-
|
|
83
|
-
-
|
|
84
|
-
-
|
|
85
|
-
-
|
|
86
|
-
-
|
|
87
|
-
-
|
|
88
|
-
-
|
|
221
|
+
- Added complete notification system (local & push)
|
|
222
|
+
- New useNotification() React hook
|
|
223
|
+
- Firebase Cloud Messaging conditional build support
|
|
224
|
+
- Android notification handling in MainActivity
|
|
225
|
+
- 5 new notification commands + 5 callbacks in NativeBridge
|
|
226
|
+
- Auto-processing of notification icons & sounds
|
|
227
|
+
- Conditional dependencies based on notification config
|
|
228
|
+
- Updated .gitignore & .npmignore
|
|
229
|
+
- Enhanced build process with automatic permission injection
|
|
230
|
+
- Deep link integration with notifications
|
|
89
231
|
|
|
90
|
-
## [0.0.3-canary.16] - 2025-11-
|
|
232
|
+
## [0.0.3-canary.16] - 2025-11-20
|
|
91
233
|
|
|
92
234
|
- FeaturesGallery Support for File Picker: Enhanced file picker to open native gallery for selecting images and videos
|
|
93
235
|
- HTTPS Framework Server: Enabled HTTPS support for the framework server with self-signed SSL certificate
|
|
@@ -97,17 +239,17 @@
|
|
|
97
239
|
|
|
98
240
|
- Adding Android release support and appInfo key
|
|
99
241
|
|
|
100
|
-
## [0.0.3-canary.14] - 2025-
|
|
242
|
+
## [0.0.3-canary.14] - 2025-10-29
|
|
101
243
|
|
|
102
244
|
- Android custom splashscreen
|
|
103
245
|
|
|
104
|
-
## [0.0.3-canary.13] - 2025-
|
|
246
|
+
## [0.0.3-canary.13] - 2025-10-28
|
|
105
247
|
|
|
106
248
|
- Multi file support in useFilePicker hook
|
|
107
249
|
- Android multiple app icon support
|
|
108
250
|
- Android whitelisting toggle support
|
|
109
251
|
|
|
110
|
-
## [0.0.3-canary.12] - 2025-
|
|
252
|
+
## [0.0.3-canary.12] - 2025-10-13
|
|
111
253
|
|
|
112
254
|
- Universal App Context: Added comprehensive context support for building universal mobile applications
|
|
113
255
|
- OpenTelemetry SDK Integration: Built-in support for observability and performance monitoring with Otel SDK
|
|
@@ -118,70 +260,42 @@
|
|
|
118
260
|
- Enhanced Android native support: Add support for native keyboard and webview resizing in Android
|
|
119
261
|
- Device info API web support: Web support in device info API
|
|
120
262
|
|
|
121
|
-
## [0.0.3-canary.10] - 2025-09-
|
|
263
|
+
## [0.0.3-canary.10] - 2025-09-17
|
|
122
264
|
|
|
123
|
-
-
|
|
124
|
-
-
|
|
265
|
+
- Sentry import bug fix.
|
|
266
|
+
- Open telemetry SDK.
|
|
125
267
|
|
|
126
268
|
## [0.0.3-canary.9] - 2025-09-11
|
|
127
269
|
|
|
128
|
-
-
|
|
129
|
-
-
|
|
130
|
-
-
|
|
131
|
-
|
|
132
|
-
## [0.0.3-canary.8] - 2025-01-06
|
|
270
|
+
- App name configuration.
|
|
271
|
+
- Device Info API.
|
|
272
|
+
- Access control configuration.
|
|
133
273
|
|
|
134
|
-
-
|
|
135
|
-
- **Splash screen integration**
|
|
136
|
-
- **Url Whitelisting**
|
|
274
|
+
## [0.0.3-canary.8] - 2025-08-08
|
|
137
275
|
|
|
138
|
-
|
|
276
|
+
- App icon configuration.
|
|
277
|
+
- Splash screen integration.
|
|
278
|
+
- Url Whitelisting.
|
|
139
279
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
- **Native API Integration**: Enhanced native module integration for better performance
|
|
143
|
-
- **Automated IP Resolution**: Intelligent network detection eliminates manual IP configuration
|
|
144
|
-
- **Universal Build System**: Streamlined one-command builds for both Android and iOS platforms
|
|
145
|
-
- **Enhanced CLI Interface**: Improved command-line tools for better developer experience
|
|
146
|
-
|
|
147
|
-
### 🐛 Bug Fixes
|
|
280
|
+
## [0.0.3-canary.7] - 2025-08-06
|
|
148
281
|
|
|
282
|
+
- Native API Integration: Enhanced native module integration for better performance
|
|
283
|
+
- Automated IP Resolution: Intelligent network detection eliminates manual IP configuration
|
|
284
|
+
- Universal Build System: Streamlined one-command builds for both Android and iOS platforms
|
|
285
|
+
- Enhanced CLI Interface: Improved command-line tools for better developer experience
|
|
149
286
|
- Fixed IP address detection issues on development environments
|
|
150
287
|
- Resolved build configuration conflicts between platforms
|
|
151
288
|
- Improved error handling and recovery mechanisms
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
-
|
|
156
|
-
-
|
|
157
|
-
-
|
|
158
|
-
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
- ✅ **Android Build**: Verified APK generation, installation, and runtime behavior
|
|
163
|
-
- ✅ **iOS Build**: Tested build process and device compatibility
|
|
164
|
-
- ✅ **IP Detection**: Validated automatic network resolution across platforms
|
|
165
|
-
- ✅ **Native Modules**: Confirmed API integration and performance benchmarks
|
|
166
|
-
- ✅ **CLI Operations**: Tested enhanced command-line workflows and error handling
|
|
167
|
-
|
|
168
|
-
### 🔄 Breaking Changes
|
|
169
|
-
|
|
170
|
-
**None** - All changes maintain backward compatibility while enhancing existing functionality
|
|
171
|
-
|
|
172
|
-
### 📝 Technical Details
|
|
173
|
-
|
|
289
|
+
- Performance: Optimized native module loading and execution
|
|
290
|
+
- Developer Experience: Enhanced CLI with better error messages and debugging info
|
|
291
|
+
- Configuration: Dynamic config updates without requiring restarts
|
|
292
|
+
- Build Process: Faster and more reliable build pipeline
|
|
293
|
+
- Android Build: Verified APK generation, installation, and runtime behavior
|
|
294
|
+
- iOS Build: Tested build process and device compatibility
|
|
295
|
+
- IP Detection: Validated automatic network resolution across platforms
|
|
296
|
+
- Native Modules: Confirmed API integration and performance benchmarks
|
|
297
|
+
- CLI Operations: Tested enhanced command-line workflows and error handling
|
|
174
298
|
- Improved native API bridge for better cross-platform communication
|
|
175
299
|
- Enhanced error reporting with detailed stack traces and suggestions
|
|
176
300
|
- Optimized build configuration for faster development cycles
|
|
177
301
|
- Added comprehensive logging for debugging and monitoring
|
|
178
|
-
|
|
179
|
-
### 🔗 Migration Notes
|
|
180
|
-
|
|
181
|
-
- No migration steps required
|
|
182
|
-
- Existing projects will automatically benefit from improvements
|
|
183
|
-
- Optional: Update CLI usage to leverage new enhanced features
|
|
184
|
-
|
|
185
|
-
## Version
|
|
186
|
-
|
|
187
|
-
- Target version: 0.0.3-canary.7
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { mkdirSync, writeFileSync, readFileSync, readdirSync, rmSync, existsSync } from "fs"
|
|
2
|
+
import path from "path"
|
|
3
|
+
import { fileURLToPath } from "url"
|
|
4
|
+
import { ERROR_DEFINITIONS } from "./registry.js"
|
|
5
|
+
|
|
6
|
+
const __filename = fileURLToPath(import.meta.url)
|
|
7
|
+
const __dirname = path.dirname(__filename)
|
|
8
|
+
|
|
9
|
+
// packages/catalyst-core/src/errors -> repo root /errors
|
|
10
|
+
const DEFAULT_ERRORS_DIR = path.resolve(__dirname, "../../../../errors")
|
|
11
|
+
|
|
12
|
+
function renderMarkdown(code, def) {
|
|
13
|
+
return `# ${code}
|
|
14
|
+
|
|
15
|
+
**Category:** ${def.category}
|
|
16
|
+
|
|
17
|
+
## Message
|
|
18
|
+
|
|
19
|
+
${def.defaultMessage}
|
|
20
|
+
|
|
21
|
+
## Details
|
|
22
|
+
|
|
23
|
+
${def.defaultDetails}
|
|
24
|
+
|
|
25
|
+
## Suggested action
|
|
26
|
+
|
|
27
|
+
${def.suggestedAction}
|
|
28
|
+
`
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function clearGeneratedCategoryDirs(errorsDir) {
|
|
32
|
+
if (!existsSync(errorsDir)) return
|
|
33
|
+
const categories = new Set(Object.values(ERROR_DEFINITIONS).map((d) => d.category))
|
|
34
|
+
for (const category of categories) {
|
|
35
|
+
const dir = path.join(errorsDir, category)
|
|
36
|
+
if (existsSync(dir)) {
|
|
37
|
+
for (const file of readdirSync(dir)) {
|
|
38
|
+
if (file.endsWith(".md")) rmSync(path.join(dir, file))
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Other packages (e.g. create-catalyst-app) own their own categories and
|
|
45
|
+
// merge their entries into this same index.json. Only clear/overwrite keys
|
|
46
|
+
// for categories this registry itself defines, so a regen here never wipes
|
|
47
|
+
// entries owned by another package's generator.
|
|
48
|
+
function readExistingIndex(indexPath) {
|
|
49
|
+
if (!existsSync(indexPath)) return {}
|
|
50
|
+
try {
|
|
51
|
+
return JSON.parse(readFileSync(indexPath, "utf8"))
|
|
52
|
+
} catch {
|
|
53
|
+
return {}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Regenerate errors/**\/*.md + errors/index.json from ERROR_DEFINITIONS.
|
|
59
|
+
*
|
|
60
|
+
* `errorsDir` defaults to the real repo-root errors/ dir (the CLI/prepublish
|
|
61
|
+
* use case) but can be overridden — e.g. by the docs-drift contract test
|
|
62
|
+
* (see test/errors/docsDrift.test.js), which regenerates into a temp dir and
|
|
63
|
+
* diffs against the committed output rather than mutating it.
|
|
64
|
+
*/
|
|
65
|
+
export function generateDocs(errorsDir = DEFAULT_ERRORS_DIR) {
|
|
66
|
+
const indexPath = path.join(errorsDir, "index.json")
|
|
67
|
+
|
|
68
|
+
clearGeneratedCategoryDirs(errorsDir)
|
|
69
|
+
|
|
70
|
+
const ownedCategories = new Set(Object.values(ERROR_DEFINITIONS).map((d) => d.category))
|
|
71
|
+
const index = readExistingIndex(indexPath)
|
|
72
|
+
for (const code of Object.keys(index)) {
|
|
73
|
+
if (ownedCategories.has(index[code].category)) delete index[code]
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
for (const [code, def] of Object.entries(ERROR_DEFINITIONS)) {
|
|
77
|
+
const dir = path.join(errorsDir, def.category)
|
|
78
|
+
mkdirSync(dir, { recursive: true })
|
|
79
|
+
const filePath = path.join(dir, `${code}.md`)
|
|
80
|
+
writeFileSync(filePath, renderMarkdown(code, def))
|
|
81
|
+
|
|
82
|
+
index[code] = {
|
|
83
|
+
category: def.category,
|
|
84
|
+
message: def.defaultMessage,
|
|
85
|
+
details: def.defaultDetails,
|
|
86
|
+
suggestedAction: def.suggestedAction,
|
|
87
|
+
docUrl: `https://github.com/tata1mg/catalyst-core/blob/main/errors/${def.category}/${code}.md`,
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
mkdirSync(errorsDir, { recursive: true })
|
|
92
|
+
writeFileSync(indexPath, JSON.stringify(index, null, 4))
|
|
93
|
+
|
|
94
|
+
return { count: Object.keys(ERROR_DEFINITIONS).length, errorsDir }
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
98
|
+
const { count, errorsDir } = generateDocs()
|
|
99
|
+
console.log(`Generated ${count} error doc(s) + index.json in ${errorsDir}`)
|
|
100
|
+
}
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
import pc from "ansis"
|
|
2
|
+
/**
|
|
3
|
+
* The "catalyst-core/errors" subpath export exists so catalyst's own
|
|
4
|
+
* packages (catalyst-ai, create-catalyst-app, etc.) can share this
|
|
5
|
+
* registry/CatalystError shape instead of each defining their own. It is
|
|
6
|
+
* not a recommendation for app code to throw CatalystError instead of
|
|
7
|
+
* Error — apps should keep using plain Error unless they're specifically
|
|
8
|
+
* interoperating with catalyst's own error codes.
|
|
9
|
+
*/
|
|
10
|
+
import { ERROR_CODES, getDefinition, getDocUrl } from "./registry.js"
|
|
11
|
+
|
|
12
|
+
export { ERROR_CODES, getDocUrl }
|
|
13
|
+
|
|
14
|
+
export class CatalystError extends Error {
|
|
15
|
+
constructor(code, { message, details, suggestedAction, category, docUrl, cause } = {}) {
|
|
16
|
+
super(message)
|
|
17
|
+
this.name = "CatalystError"
|
|
18
|
+
this.code = code
|
|
19
|
+
this.category = category
|
|
20
|
+
this.details = details
|
|
21
|
+
this.suggestedAction = suggestedAction
|
|
22
|
+
this.docUrl = docUrl
|
|
23
|
+
if (cause !== undefined) this.cause = cause
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Create a CatalystError for a code we own, using registry.js defaults
|
|
29
|
+
* unless overridden.
|
|
30
|
+
*/
|
|
31
|
+
export function createError(code, overrides = {}) {
|
|
32
|
+
const def = getDefinition(code)
|
|
33
|
+
return new CatalystError(code, {
|
|
34
|
+
category: def.category,
|
|
35
|
+
message: overrides.message || def.defaultMessage,
|
|
36
|
+
details: overrides.details || def.defaultDetails,
|
|
37
|
+
suggestedAction: overrides.suggestedAction || def.suggestedAction,
|
|
38
|
+
docUrl: getDocUrl(code),
|
|
39
|
+
cause: overrides.cause,
|
|
40
|
+
})
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const STAGE_WRAPPER_CODE = {
|
|
44
|
+
BUNDLE: ERROR_CODES.BUNDLE_UPSTREAM_ERROR,
|
|
45
|
+
IOS: ERROR_CODES.IOS_UPSTREAM_ERROR,
|
|
46
|
+
ANDROID: ERROR_CODES.ANDROID_UPSTREAM_ERROR,
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const STAGE_UPSTREAM_NAME = {
|
|
50
|
+
BUNDLE: "Vite/Rollup",
|
|
51
|
+
IOS: "Xcode/CocoaPods",
|
|
52
|
+
ANDROID: "Gradle",
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Wrap a foreign error (Vite/Rollup/native toolchain) that already carries
|
|
57
|
+
* its own code/message. We do not replace or reinterpret it — we attach a
|
|
58
|
+
* generic per-stage wrapper code and preserve the original as `cause`, so
|
|
59
|
+
* the upstream code/message is always what gets shown to the user.
|
|
60
|
+
*/
|
|
61
|
+
export function wrapForeignError(stage, err) {
|
|
62
|
+
const code = STAGE_WRAPPER_CODE[stage]
|
|
63
|
+
if (!code) {
|
|
64
|
+
throw new Error(`wrapForeignError: unknown stage "${stage}"`)
|
|
65
|
+
}
|
|
66
|
+
const upstreamName = STAGE_UPSTREAM_NAME[stage]
|
|
67
|
+
// Only show err.code when it's a real upstream identifier (e.g. Rollup's
|
|
68
|
+
// "PLUGIN_LOAD_ERROR"), not a bare numeric process exit status — a spawned
|
|
69
|
+
// child's exit code is not an "upstream error code" and would be misleading.
|
|
70
|
+
const hasNamedCode = err && typeof err.code === "string"
|
|
71
|
+
const upstreamCode = hasNamedCode ? ` ${upstreamName} ${err.code}` : ` ${upstreamName}`
|
|
72
|
+
const wrapped = createError(code, {
|
|
73
|
+
message: `Build failed (upstream:${upstreamCode})`,
|
|
74
|
+
cause: err,
|
|
75
|
+
})
|
|
76
|
+
return wrapped
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const SSR_STAGE_CODE = {
|
|
80
|
+
RENDER: ERROR_CODES.RUNTIME_WEB_RENDER_FAILED,
|
|
81
|
+
FETCHER: ERROR_CODES.RUNTIME_WEB_FETCHER_FAILED,
|
|
82
|
+
SERVER_SIDE_FUNCTION: ERROR_CODES.RUNTIME_WEB_SERVER_SIDE_FUNCTION_FAILED,
|
|
83
|
+
REQUEST_HANDLING: ERROR_CODES.RUNTIME_WEB_REQUEST_HANDLING_FAILED,
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Wrap an error caught during SSR (handler.jsx). Unlike wrapForeignError's
|
|
88
|
+
* build-stage wrapping, the caught error here could originate from the
|
|
89
|
+
* user's app code, a third-party dependency, or catalyst-core's own
|
|
90
|
+
* pipeline — there is no way to tell from the caught error object which.
|
|
91
|
+
* So, like the BUNDLE/IOS/ANDROID wrappers, we never reinterpret it: we
|
|
92
|
+
* attach a stage-specific code that identifies *where* in the SSR pipeline
|
|
93
|
+
* the failure happened, and preserve the original error as `cause`.
|
|
94
|
+
*/
|
|
95
|
+
export function wrapSSRError(stage, err) {
|
|
96
|
+
const code = SSR_STAGE_CODE[stage]
|
|
97
|
+
if (!code) {
|
|
98
|
+
throw new Error(`wrapSSRError: unknown stage "${stage}"`)
|
|
99
|
+
}
|
|
100
|
+
return createError(code, { cause: err })
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Wrap a failed AI provider HTTP response (OpenAI/Gemini). Unlike
|
|
105
|
+
* wrapForeignError (build toolchains, which carry a named err.code), provider
|
|
106
|
+
* failures are an HTTP status + response body — we preserve both verbatim
|
|
107
|
+
* as `cause` rather than reinterpreting them.
|
|
108
|
+
*/
|
|
109
|
+
export function wrapProviderError(provider, status, bodyText) {
|
|
110
|
+
const cause = new Error(`${provider} API error (${status}): ${bodyText}`)
|
|
111
|
+
cause.provider = provider
|
|
112
|
+
cause.status = status
|
|
113
|
+
return createError(ERROR_CODES.AI_UPSTREAM_ERROR, {
|
|
114
|
+
message: `AI provider request failed (upstream: ${provider} ${status})`,
|
|
115
|
+
cause,
|
|
116
|
+
})
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function formatDefault(err) {
|
|
120
|
+
const lines = [`[${err.code}] ${err.message}`]
|
|
121
|
+
if (err.cause) {
|
|
122
|
+
const causeMessage = err.cause.message || String(err.cause)
|
|
123
|
+
lines.push(`→ ${causeMessage}`)
|
|
124
|
+
} else if (err.details) {
|
|
125
|
+
lines.push(err.details)
|
|
126
|
+
}
|
|
127
|
+
if (err.suggestedAction) {
|
|
128
|
+
lines.push(`Suggested action: ${err.suggestedAction}`)
|
|
129
|
+
}
|
|
130
|
+
if (err.docUrl) {
|
|
131
|
+
lines.push(`Docs: ${err.docUrl}`)
|
|
132
|
+
}
|
|
133
|
+
return lines.join("\n")
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const BOX_WIDTH = 70
|
|
137
|
+
|
|
138
|
+
function box(bodyLines) {
|
|
139
|
+
const top = pc.red(`┌${"─".repeat(BOX_WIDTH)}`)
|
|
140
|
+
const bottom = pc.red(`└${"─".repeat(BOX_WIDTH)}`)
|
|
141
|
+
const body = bodyLines.map((line) => (line === "" ? pc.red("│") : `${pc.red("│")} ${line}`))
|
|
142
|
+
return [top, ...body, bottom].join("\n")
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function formatCauseChain(cause) {
|
|
146
|
+
const lines = []
|
|
147
|
+
let current = cause
|
|
148
|
+
let depth = 0
|
|
149
|
+
while (current) {
|
|
150
|
+
const prefix = depth === 0 ? "Caused by:" : ` ${" ".repeat(depth - 1)}Caused by:`
|
|
151
|
+
lines.push(`${prefix} ${current.message || String(current)}`)
|
|
152
|
+
current = current.cause
|
|
153
|
+
depth += 1
|
|
154
|
+
}
|
|
155
|
+
return lines
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Verbose output: boxed per RFC #155 §3.2 — code, timestamp, problem,
|
|
160
|
+
* suggested action, docs link. Owns its own coloring (the box border and
|
|
161
|
+
* text are colored as a unit here) rather than leaving callers to wrap the
|
|
162
|
+
* whole multi-line block in a color function themselves.
|
|
163
|
+
*/
|
|
164
|
+
function formatVerbose(err) {
|
|
165
|
+
const lines = [
|
|
166
|
+
pc.bold(`❌ ${err.message}`),
|
|
167
|
+
`Code: ${err.code}`,
|
|
168
|
+
`Category: ${err.category || "UNKNOWN"}`,
|
|
169
|
+
`Time: ${new Date().toISOString()}`,
|
|
170
|
+
"",
|
|
171
|
+
]
|
|
172
|
+
if (err.cause) {
|
|
173
|
+
lines.push(`Problem: ${err.cause.message || String(err.cause)}`)
|
|
174
|
+
lines.push("")
|
|
175
|
+
} else if (err.details) {
|
|
176
|
+
lines.push(`Problem: ${err.details}`)
|
|
177
|
+
lines.push("")
|
|
178
|
+
}
|
|
179
|
+
if (err.suggestedAction) {
|
|
180
|
+
lines.push("Solution:", ` ${err.suggestedAction}`, "")
|
|
181
|
+
}
|
|
182
|
+
if (err.docUrl) {
|
|
183
|
+
lines.push(`Docs: ${err.docUrl}`)
|
|
184
|
+
}
|
|
185
|
+
return box(lines)
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Debug output: verbose + full cause chain + stack trace + environment
|
|
190
|
+
* info. Environment gathering happens here (Node-side), not as module-level
|
|
191
|
+
* state, so errors/index.js stays free of os/process imports and safe to
|
|
192
|
+
* bundle into the browser (see formatError's mode parameter below).
|
|
193
|
+
*/
|
|
194
|
+
function formatDebug(err, env) {
|
|
195
|
+
const lines = [
|
|
196
|
+
pc.bold(`❌ ${err.message}`),
|
|
197
|
+
`Code: ${err.code}`,
|
|
198
|
+
`Category: ${err.category || "UNKNOWN"}`,
|
|
199
|
+
`Time: ${new Date().toISOString()}`,
|
|
200
|
+
"",
|
|
201
|
+
]
|
|
202
|
+
if (err.cause) {
|
|
203
|
+
lines.push(...formatCauseChain(err.cause), "")
|
|
204
|
+
} else if (err.details) {
|
|
205
|
+
lines.push(`Problem: ${err.details}`, "")
|
|
206
|
+
}
|
|
207
|
+
if (err.suggestedAction) {
|
|
208
|
+
lines.push("Solution:", ` ${err.suggestedAction}`, "")
|
|
209
|
+
}
|
|
210
|
+
if (err.docUrl) {
|
|
211
|
+
lines.push(`Docs: ${err.docUrl}`, "")
|
|
212
|
+
}
|
|
213
|
+
if (env) {
|
|
214
|
+
lines.push("Environment:")
|
|
215
|
+
for (const [key, value] of Object.entries(env)) {
|
|
216
|
+
lines.push(` ${key}: ${value}`)
|
|
217
|
+
}
|
|
218
|
+
lines.push("")
|
|
219
|
+
}
|
|
220
|
+
lines.push("Stack trace:")
|
|
221
|
+
const stack = err.cause?.stack || err.stack || "(no stack available)"
|
|
222
|
+
lines.push(...stack.split("\n").map((l) => ` ${l}`))
|
|
223
|
+
return box(lines)
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Format a CatalystError for terminal output. Foreign-wrapped errors always
|
|
228
|
+
* show the original upstream message/code, never a paraphrase of it.
|
|
229
|
+
*
|
|
230
|
+
* `mode` is a parameter, not module-level state — WebBridge.js (browser) has
|
|
231
|
+
* no process.argv/TTY and keeps calling formatError(err) unchanged, getting
|
|
232
|
+
* "default". Node call sites resolve their own mode (see
|
|
233
|
+
* scripts/scriptUtils.js#resolveOutputMode) and pass it through explicitly.
|
|
234
|
+
*
|
|
235
|
+
* `env` (debug mode only) is gathered by the caller, not here — keeps this
|
|
236
|
+
* module free of os/process imports so it stays safe to bundle into the
|
|
237
|
+
* browser regardless of which mode a Node caller happens to request.
|
|
238
|
+
*/
|
|
239
|
+
export function formatError(err, mode = "default", env) {
|
|
240
|
+
if (mode === "debug") return formatDebug(err, env)
|
|
241
|
+
if (mode === "verbose") return formatVerbose(err)
|
|
242
|
+
return formatDefault(err)
|
|
243
|
+
}
|