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,149 +0,0 @@
|
|
|
1
|
-
import pc from "picocolors"
|
|
2
|
-
|
|
3
|
-
const handleError = (e) => {
|
|
4
|
-
console.log(pc.red("Failed to start server: "), e)
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
const validatePreInitServer = (fn) => {
|
|
8
|
-
try {
|
|
9
|
-
if (!fn) throw new Error("preServerInit named function should be defined in server/index.js")
|
|
10
|
-
if (typeof fn !== "function")
|
|
11
|
-
throw new Error("preServerInit should be function present in server/index.js")
|
|
12
|
-
return true
|
|
13
|
-
} catch (e) {
|
|
14
|
-
handleError(e)
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const validateMiddleware = (fn) => {
|
|
19
|
-
try {
|
|
20
|
-
if (!fn) throw new Error("addMiddlewares named function not found in server/server.js")
|
|
21
|
-
if (typeof fn !== "function")
|
|
22
|
-
throw new Error("addMiddlewares should be function present in server/server.js")
|
|
23
|
-
return true
|
|
24
|
-
} catch (e) {
|
|
25
|
-
handleError(e)
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const validateReducerFunction = (fn) => {
|
|
30
|
-
try {
|
|
31
|
-
if (!fn) throw new Error("reducer not found in src/js/containers/App/reducer")
|
|
32
|
-
if (typeof fn !== "function")
|
|
33
|
-
throw new Error("reducer should present in src/js/containers/App/reducer")
|
|
34
|
-
return true
|
|
35
|
-
} catch (e) {
|
|
36
|
-
handleError(e)
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const validateConfigFile = (obj) => {
|
|
41
|
-
try {
|
|
42
|
-
if (!obj) throw new Error("config not found in config folder")
|
|
43
|
-
if (typeof obj !== "object")
|
|
44
|
-
throw new Error(
|
|
45
|
-
"config object should be exported from config folder inside your project root directory"
|
|
46
|
-
)
|
|
47
|
-
if (typeof obj === "object") {
|
|
48
|
-
const requiredConfigKeys = {
|
|
49
|
-
NODE_SERVER_HOSTNAME: "",
|
|
50
|
-
NODE_SERVER_PORT: "",
|
|
51
|
-
WEBPACK_DEV_SERVER_HOSTNAME: "",
|
|
52
|
-
WEBPACK_DEV_SERVER_PORT: "",
|
|
53
|
-
BUILD_OUTPUT_PATH: "",
|
|
54
|
-
PUBLIC_STATIC_ASSET_PATH: "",
|
|
55
|
-
PUBLIC_STATIC_ASSET_URL: "",
|
|
56
|
-
CLIENT_ENV_VARIABLES: [],
|
|
57
|
-
ANALYZE_BUNDLE: "",
|
|
58
|
-
}
|
|
59
|
-
for (let key in requiredConfigKeys) {
|
|
60
|
-
if (!(key in obj)) throw new Error(`${key} key not found inside config.json`)
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
return true
|
|
64
|
-
} catch (e) {
|
|
65
|
-
handleError(e)
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
const validatePackageJson = (obj) => {
|
|
70
|
-
try {
|
|
71
|
-
if (!obj) throw new Error("package.json not found in the project")
|
|
72
|
-
if (typeof obj !== "object")
|
|
73
|
-
throw new Error("package.json should be defined in project root directory")
|
|
74
|
-
return true
|
|
75
|
-
} catch (e) {
|
|
76
|
-
handleError(e)
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
const validateModuleAlias = (obj) => {
|
|
81
|
-
try {
|
|
82
|
-
if (!obj) throw new Error("moduleAliases not found in package.json file present in root directory.")
|
|
83
|
-
if (typeof obj !== "object")
|
|
84
|
-
throw new Error("moduleAliases named object should be exported from package.json")
|
|
85
|
-
if (typeof obj === "object") {
|
|
86
|
-
const requiredModuleAliases = {
|
|
87
|
-
"@api": "api.js",
|
|
88
|
-
"@containers": "src/js/containers",
|
|
89
|
-
"@server": "server",
|
|
90
|
-
"@config": "config",
|
|
91
|
-
"@css": "src/static/css",
|
|
92
|
-
"@routes": "src/js/routes/",
|
|
93
|
-
}
|
|
94
|
-
for (let key in requiredModuleAliases) {
|
|
95
|
-
if (key.includes("catalyst"))
|
|
96
|
-
throw new Error(`Catalyst keyword is restricted for defining aliases`)
|
|
97
|
-
if (!(key in obj)) throw new Error(`${key} module alias not defined inside package.json`)
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
return true
|
|
101
|
-
} catch (e) {
|
|
102
|
-
handleError(e)
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
const validateConfigureStore = (fn) => {
|
|
107
|
-
try {
|
|
108
|
-
if (!fn) throw new Error("configureStore not found in file src/js/store/index.js")
|
|
109
|
-
if (typeof fn !== "function")
|
|
110
|
-
throw new Error("configureStore should be function exported from src/js/store/index.js")
|
|
111
|
-
return true
|
|
112
|
-
} catch (e) {
|
|
113
|
-
handleError(e)
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
const validateGetRoutes = (fn) => {
|
|
118
|
-
try {
|
|
119
|
-
if (!fn) throw new Error("getRoutes not found in file src/js/routes/utils.js")
|
|
120
|
-
if (typeof fn !== "function")
|
|
121
|
-
throw new Error("getRoutes should be function exported from src/js/routers/index.js")
|
|
122
|
-
return true
|
|
123
|
-
} catch (e) {
|
|
124
|
-
handleError(e)
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
const validateCustomDocument = (fn) => {
|
|
129
|
-
try {
|
|
130
|
-
if (!fn) throw new Error("document not found in file server/document.js")
|
|
131
|
-
if (typeof fn !== "function")
|
|
132
|
-
throw new Error("document should be a react component exported from server/document.js")
|
|
133
|
-
return true
|
|
134
|
-
} catch (e) {
|
|
135
|
-
handleError(e)
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
export {
|
|
140
|
-
validateConfigFile,
|
|
141
|
-
validateConfigureStore,
|
|
142
|
-
validateCustomDocument,
|
|
143
|
-
validateGetRoutes,
|
|
144
|
-
validatePackageJson,
|
|
145
|
-
validateReducerFunction,
|
|
146
|
-
validateModuleAlias,
|
|
147
|
-
validatePreInitServer,
|
|
148
|
-
validateMiddleware,
|
|
149
|
-
}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { useNavigate, useLocation } from "react-router"
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @param {number} delay
|
|
5
|
-
*/
|
|
6
|
-
function wait(delay) {
|
|
7
|
-
return new Promise((resolve) => {
|
|
8
|
-
setTimeout(resolve, delay)
|
|
9
|
-
})
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
// function navigationDirection(param) {
|
|
13
|
-
// if (typeof param === "string") {
|
|
14
|
-
// return "forward-navigation"
|
|
15
|
-
// } else if (typeof param === "number") {
|
|
16
|
-
// return param < 0 ? "backward-navigation" : param > 0 ? "forward-navigation" : "Same_page_navigation"
|
|
17
|
-
// } else {
|
|
18
|
-
// return "Invalid_param"
|
|
19
|
-
// }
|
|
20
|
-
// }
|
|
21
|
-
|
|
22
|
-
// export function useNavigateWithTransition() {
|
|
23
|
-
// const navigate = useNavigate()
|
|
24
|
-
// const { setIsExitComplete, updateScrollPosition } = useScrollRestorationContext()
|
|
25
|
-
// const location = useLocation()
|
|
26
|
-
// function transition(route, options = {}) {
|
|
27
|
-
// if (document.startViewTransition && options.skipTransition) {
|
|
28
|
-
// const directionForNavigation = navigationDirection(route)
|
|
29
|
-
// //decide whether to use backward transition or forward transition or no transition in case route is 0
|
|
30
|
-
// if (directionForNavigation === "Same_page_navigation") {
|
|
31
|
-
// navigate(route, options)
|
|
32
|
-
// return
|
|
33
|
-
// }
|
|
34
|
-
// //select the root element and give it the viewTransitionNameb by the directionForNavigation
|
|
35
|
-
// const rootElementRef = document.querySelector(":root")
|
|
36
|
-
// rootElementRef.style.viewTransitionName = directionForNavigation
|
|
37
|
-
|
|
38
|
-
// const viewTransition = document.startViewTransition(async function updateCallback() {
|
|
39
|
-
// // Update scroll position for the current route
|
|
40
|
-
// updateScrollPosition(location.key, parseInt(window.scrollY, 10))
|
|
41
|
-
// delete options.skipTransition
|
|
42
|
-
// navigate(route, options)
|
|
43
|
-
// await wait(50)
|
|
44
|
-
// })
|
|
45
|
-
|
|
46
|
-
// // A Promise that fulfills once the pseudo-element tree is created and the transition animation is about to start.
|
|
47
|
-
// viewTransition.ready.then(() => {
|
|
48
|
-
// if (directionForNavigation === "backward-navigation") {
|
|
49
|
-
// setIsExitComplete(true)
|
|
50
|
-
// } else {
|
|
51
|
-
// window.scrollTo({ top: 0, left: 0, behavior: "auto" })
|
|
52
|
-
// }
|
|
53
|
-
// })
|
|
54
|
-
|
|
55
|
-
// //A Promise that fulfills once the transition animation is finished, and the new page view is visible and interactive to the user.
|
|
56
|
-
// viewTransition.finished.finally(() => {
|
|
57
|
-
// // Clear the temporary tag
|
|
58
|
-
// if (rootElementRef) rootElementRef.style.viewTransitionName = ""
|
|
59
|
-
// })
|
|
60
|
-
// } else {
|
|
61
|
-
// // fallback for old browser
|
|
62
|
-
// delete options.skipTransition
|
|
63
|
-
// navigate(route, options)
|
|
64
|
-
// }
|
|
65
|
-
// }
|
|
66
|
-
|
|
67
|
-
// return transition
|
|
68
|
-
// }
|
|
69
|
-
|
|
70
|
-
export const useNavigateWithTransition = () => {
|
|
71
|
-
return useNavigate()
|
|
72
|
-
}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description Router Data
|
|
3
|
-
* @typedef {{data: any, error: any, isFetching: boolean, isFetched:boolean, refetch?:(args:any)=>Promise<void>}} RouteData
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @type {import("react").Context<Object.<string, RouteData>>}
|
|
7
|
-
*/
|
|
8
|
-
export const RouterContext: import("react").Context<{
|
|
9
|
-
[x: string]: RouteData
|
|
10
|
-
}>
|
|
11
|
-
export function serverDataFetcher(
|
|
12
|
-
serverFetchDataProps: ServerFetchDataProps,
|
|
13
|
-
fetcherArgs: {
|
|
14
|
-
[x: string]: any
|
|
15
|
-
}
|
|
16
|
-
): Promise<{
|
|
17
|
-
[x: string]: RouteData
|
|
18
|
-
}>
|
|
19
|
-
export function RouterDataProvider({
|
|
20
|
-
children,
|
|
21
|
-
initialState,
|
|
22
|
-
fetcherArgs,
|
|
23
|
-
config,
|
|
24
|
-
}: RouterDataProviderProps): React.JSX.Element
|
|
25
|
-
export function useCurrentRouteData(): RouteData
|
|
26
|
-
export function useRouterData(): {
|
|
27
|
-
[x: string]: RouteData
|
|
28
|
-
}
|
|
29
|
-
export type RouteData = {
|
|
30
|
-
data: any
|
|
31
|
-
error: any
|
|
32
|
-
isFetching: boolean
|
|
33
|
-
isFetched: boolean
|
|
34
|
-
refetch?: (args: any) => Promise<void>
|
|
35
|
-
}
|
|
36
|
-
export type RouterDataProviderConfig = {
|
|
37
|
-
/**
|
|
38
|
-
* disableCaching disable caching of fetched data - default is false
|
|
39
|
-
*/
|
|
40
|
-
disableCaching?: boolean | undefined
|
|
41
|
-
}
|
|
42
|
-
export type RouterFetcherProps = {
|
|
43
|
-
/**
|
|
44
|
-
* route object
|
|
45
|
-
*/
|
|
46
|
-
route: any
|
|
47
|
-
/**
|
|
48
|
-
* the current location object, which represents the current URL in web browsers.
|
|
49
|
-
*/
|
|
50
|
-
location: import("react-router").Location
|
|
51
|
-
/**
|
|
52
|
-
* object of key/value pairs of the dynamic params from the current URL that were matched by the route path.
|
|
53
|
-
*/
|
|
54
|
-
params: import("react-router").Params
|
|
55
|
-
/**
|
|
56
|
-
* search parameters via URLSearchParams interface.
|
|
57
|
-
*/
|
|
58
|
-
searchParams: URLSearchParams
|
|
59
|
-
/**
|
|
60
|
-
* function to navigate to other pages based on response.
|
|
61
|
-
*/
|
|
62
|
-
navigate: import("react-router").NavigateFunction
|
|
63
|
-
}
|
|
64
|
-
export type ServerFetchDataProps = {
|
|
65
|
-
/**
|
|
66
|
-
* routes Array
|
|
67
|
-
*/
|
|
68
|
-
routes: import("react-router").RouteObject[]
|
|
69
|
-
/**
|
|
70
|
-
* current url
|
|
71
|
-
*/
|
|
72
|
-
url: string
|
|
73
|
-
/**
|
|
74
|
-
* Express request object
|
|
75
|
-
*/
|
|
76
|
-
req: import("express").Request
|
|
77
|
-
}
|
|
78
|
-
export type RouterDataProviderProps = {
|
|
79
|
-
/**
|
|
80
|
-
* Initial State of Data Provider - Mostly used to hydrate client with data from server
|
|
81
|
-
*/
|
|
82
|
-
initialState: any
|
|
83
|
-
children: any
|
|
84
|
-
/**
|
|
85
|
-
* anything passed in fetcherArgs is passed to all the fetcher functions
|
|
86
|
-
*/
|
|
87
|
-
fetcherArgs: {
|
|
88
|
-
[x: string]: any
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Global router data provider config
|
|
92
|
-
*/
|
|
93
|
-
config: RouterDataProviderConfig
|
|
94
|
-
}
|
|
95
|
-
import React from "react"
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @typedef oneMgRouterContext
|
|
3
|
-
* @property {import("react-router").RouteMatch<string, import("react-router").RouteObject>[]=} matchedRoutes
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @description This is internal context made for sharing data among router components
|
|
7
|
-
* @type {import("react").Context<oneMgRouterContext>}
|
|
8
|
-
*/
|
|
9
|
-
export const OneMgRouterContext: import("react").Context<oneMgRouterContext>
|
|
10
|
-
export type oneMgRouterContext = {
|
|
11
|
-
matchedRoutes?:
|
|
12
|
-
| import("react-router").RouteMatch<string, import("react-router").RouteObject>[]
|
|
13
|
-
| undefined
|
|
14
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export function useNavigateWithTransition(): import("react-router").NavigateFunction
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Merges multiple lists of head elements, ensuring that later lists override earlier ones in case of duplicates.
|
|
3
|
-
* Handles all types of head elements, including title, meta, link, etc.
|
|
4
|
-
*
|
|
5
|
-
* @param {...Array<JSX.Element>} lists - Multiple lists of JSX head elements, where the first argument is the parent and the rest are children in order.
|
|
6
|
-
* @returns {Array<JSX.Element>} - The combined list with later lists overriding duplicates from earlier ones.
|
|
7
|
-
*/
|
|
8
|
-
export function mergeHeadElements(...lists: Array<JSX.Element>[]): Array<JSX.Element>
|
|
9
|
-
/**
|
|
10
|
-
* Deletes all elements in the head with a specific data attribute.
|
|
11
|
-
*
|
|
12
|
-
* @param {string} attributeName - The name of the data attribute to search for.
|
|
13
|
-
* @param {string} [attributeValue] - The specific value of the data attribute to match (optional).
|
|
14
|
-
*/
|
|
15
|
-
export function deleteHeadTagsByDataAttribute(attributeName: string, attributeValue?: string): void
|
|
16
|
-
/**
|
|
17
|
-
* Returns resolved array of meta data elements.
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* @param {Array<Match>} matchedRoutes - Array of all matches.
|
|
21
|
-
* @param {Object} routeData - Data returned from Router.
|
|
22
|
-
* @returns {Array<JSX.Element>} - List of all meta tags for the matched location.
|
|
23
|
-
*/
|
|
24
|
-
export function getMetaData(matchedRoutes: Array<Match>, routeData: Object): Array<JSX.Element>
|
|
25
|
-
/**
|
|
26
|
-
* Static function defined on a route component that returns metadata elements
|
|
27
|
-
* to be rendered in the document head for that route.
|
|
28
|
-
* Must return an array of JSX elements (e.g. <title>, <meta>), NOT a plain
|
|
29
|
-
* object. Returning an object fails silently: no error is thrown, but the
|
|
30
|
-
* tags will not appear in the rendered <head>.
|
|
31
|
-
*
|
|
32
|
-
* @param {any} fetcherData - Data returned from the route's fetcher (serverFetcher/clientFetcher).
|
|
33
|
-
* @returns {Array<JSX.Element>} - Array of JSX head elements (title, meta, link, etc).
|
|
34
|
-
*
|
|
35
|
-
* @example
|
|
36
|
-
* HomePage.setMetaData = (apiResponse) => [
|
|
37
|
-
* <title key="title">{apiResponse?.title || "Home"}</title>,
|
|
38
|
-
* ];
|
|
39
|
-
*/
|
|
40
|
-
export type SetMetaData = (fetcherData: any) => Array<JSX.Element>
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|