@scalebun/react-native 1.1.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/scalebun.full.js +33218 -0
- package/dist/scalebun.full.js.map +1 -0
- package/dist/scalebun.slim.js +30016 -0
- package/dist/scalebun.slim.js.map +1 -0
- package/lib/commonjs/bootstrap/FeatureRegistry.js +4 -4
- package/lib/commonjs/bootstrap/FeatureRegistry.js.map +1 -1
- package/lib/commonjs/bootstrap/SDKBootstrapper.js +8 -8
- package/lib/commonjs/bootstrap/SDKBootstrapper.js.map +1 -1
- package/lib/commonjs/core/config/schema.js +412 -232
- package/lib/commonjs/core/config/schema.js.map +1 -1
- package/lib/commonjs/core/constants/protocol.js +31 -0
- package/lib/commonjs/core/constants/protocol.js.map +1 -0
- package/lib/commonjs/core/constants/timings.js +4 -1
- package/lib/commonjs/core/constants/timings.js.map +1 -1
- package/lib/commonjs/core/lifecycle/appLifecycle.js +1 -1
- package/lib/commonjs/core/lifecycle/appLifecycle.js.map +1 -1
- package/lib/commonjs/debug/bootstrap.js +30 -10
- package/lib/commonjs/debug/bootstrap.js.map +1 -1
- package/lib/commonjs/debug/exportBridge.js +5 -3
- package/lib/commonjs/debug/exportBridge.js.map +1 -1
- package/lib/commonjs/debug/hostResolver.js +2 -2
- package/lib/commonjs/debug/hostResolver.js.map +1 -1
- package/lib/commonjs/debug/perfWiring.js +4 -4
- package/lib/commonjs/debug/perfWiring.js.map +1 -1
- package/lib/commonjs/debug/replayWiring.js +5 -5
- package/lib/commonjs/debug/replayWiring.js.map +1 -1
- package/lib/commonjs/debug/screenTracking.js +2 -2
- package/lib/commonjs/debug/screenTracking.js.map +1 -1
- package/lib/commonjs/debug/sessionWiring.js +2 -2
- package/lib/commonjs/debug/sessionWiring.js.map +1 -1
- package/lib/commonjs/features/crash/NativeCrashFeature.js +1 -1
- package/lib/commonjs/features/crash/NativeCrashFeature.js.map +1 -1
- package/lib/commonjs/features/crash/globalHandler.js +3 -3
- package/lib/commonjs/features/crash/globalHandler.js.map +1 -1
- package/lib/commonjs/features/crash/nativeCrashBridge.js +7 -7
- package/lib/commonjs/features/crash/nativeCrashBridge.js.map +1 -1
- package/lib/commonjs/features/crash/rejectionHandler.js +2 -2
- package/lib/commonjs/features/crash/rejectionHandler.js.map +1 -1
- package/lib/commonjs/features/engage/EngageArchetypeRenderers.js +0 -9
- package/lib/commonjs/features/engage/EngageArchetypeRenderers.js.map +1 -1
- package/lib/commonjs/features/engage/EngageInAppView.js +1 -1
- package/lib/commonjs/features/engage/EngageInAppView.js.map +1 -1
- package/lib/commonjs/features/engage/EngagePromptProvider.js +17 -17
- package/lib/commonjs/features/engage/EngagePromptProvider.js.map +1 -1
- package/lib/commonjs/features/engage/EngageTransport.js +5 -5
- package/lib/commonjs/features/engage/EngageTransport.js.map +1 -1
- package/lib/commonjs/features/engage/engagePushTokenBridge.js +4 -4
- package/lib/commonjs/features/engage/engagePushTokenBridge.js.map +1 -1
- package/lib/commonjs/features/engage/engageShakeBridge.js +2 -2
- package/lib/commonjs/features/engage/engageShakeBridge.js.map +1 -1
- package/lib/commonjs/features/engage/engageSignals.js +1 -1
- package/lib/commonjs/features/engage/engageSignals.js.map +1 -1
- package/lib/commonjs/features/engage/engageStoreReviewBridge.js +2 -2
- package/lib/commonjs/features/engage/engageStoreReviewBridge.js.map +1 -1
- package/lib/commonjs/features/engage/engageTestSeenStore.js +1 -1
- package/lib/commonjs/features/engage/engageTestSeenStore.js.map +1 -1
- package/lib/commonjs/features/engage/engageThrottle.js +4 -4
- package/lib/commonjs/features/engage/engageThrottle.js.map +1 -1
- package/lib/commonjs/features/engage/engageTriggerEngine.js +4 -4
- package/lib/commonjs/features/engage/engageTriggerEngine.js.map +1 -1
- package/lib/commonjs/features/engage/engageWindowInsets.js +1 -1
- package/lib/commonjs/features/engage/engageWindowInsets.js.map +1 -1
- package/lib/commonjs/features/install-referrer/installReferrer.js +3 -3
- package/lib/commonjs/features/install-referrer/installReferrer.js.map +1 -1
- package/lib/commonjs/features/journey/calibrationContext.js +0 -9
- package/lib/commonjs/features/journey/calibrationContext.js.map +1 -1
- package/lib/commonjs/features/journey/journeyManager.js +4 -1
- package/lib/commonjs/features/journey/journeyManager.js.map +1 -1
- package/lib/commonjs/features/navigation/AutoScreenDetector.js +4 -4
- package/lib/commonjs/features/navigation/AutoScreenDetector.js.map +1 -1
- package/lib/commonjs/features/ota/OtaOrchestrator.js +18 -18
- package/lib/commonjs/features/ota/OtaOrchestrator.js.map +1 -1
- package/lib/commonjs/features/ota/geoCountry.js +2 -2
- package/lib/commonjs/features/ota/geoCountry.js.map +1 -1
- package/lib/commonjs/features/ota/retry.js +2 -2
- package/lib/commonjs/features/ota/retry.js.map +1 -1
- package/lib/commonjs/features/performance/PerformanceFeature.js +121 -23
- package/lib/commonjs/features/performance/PerformanceFeature.js.map +1 -1
- package/lib/commonjs/features/replay/core/logger/logger.js +0 -4
- package/lib/commonjs/features/replay/core/logger/logger.js.map +1 -1
- package/lib/commonjs/features/replay/integrations/network/networkAdapter.js +1 -54
- package/lib/commonjs/features/replay/integrations/network/networkAdapter.js.map +1 -1
- package/lib/commonjs/features/replay/integrations/react-navigation/navigationIntegration.js +1 -1
- package/lib/commonjs/features/replay/integrations/react-navigation/navigationIntegration.js.map +1 -1
- package/lib/commonjs/features/replay/integrations/touch/ReplayRoot.js +1 -1
- package/lib/commonjs/features/replay/integrations/touch/ReplayRoot.js.map +1 -1
- package/lib/commonjs/features/replay/pipeline/batching/batchManager.js +1 -1
- package/lib/commonjs/features/replay/pipeline/batching/batchManager.js.map +1 -1
- package/lib/commonjs/features/replay/pipeline/retry/retryPolicy.js +1 -1
- package/lib/commonjs/features/replay/pipeline/retry/retryPolicy.js.map +1 -1
- package/lib/commonjs/features/replay/public/api.js +7 -7
- package/lib/commonjs/features/replay/public/api.js.map +1 -1
- package/lib/commonjs/features/replay/replay/session/sessionOrchestrator.js +9 -9
- package/lib/commonjs/features/replay/replay/session/sessionOrchestrator.js.map +1 -1
- package/lib/commonjs/features/session/BackendSessionAdapter.js +41 -41
- package/lib/commonjs/features/session/BackendSessionAdapter.js.map +1 -1
- package/lib/commonjs/features/session/DesktopSessionTransport.js +5 -2
- package/lib/commonjs/features/session/DesktopSessionTransport.js.map +1 -1
- package/lib/commonjs/features/session/JourneyEventPipeline.js +1 -1
- package/lib/commonjs/features/session/JourneyEventPipeline.js.map +1 -1
- package/lib/commonjs/features/session/ReplayCaptureManager.js +14 -14
- package/lib/commonjs/features/session/ReplayCaptureManager.js.map +1 -1
- package/lib/commonjs/features/session/SessionManager.js +9 -9
- package/lib/commonjs/features/session/SessionManager.js.map +1 -1
- package/lib/commonjs/features/session/SyncDecisionEngine.js +1 -1
- package/lib/commonjs/features/session/SyncDecisionEngine.js.map +1 -1
- package/lib/commonjs/features/skan/skanBridge.js +6 -15
- package/lib/commonjs/features/skan/skanBridge.js.map +1 -1
- package/lib/commonjs/features/skan/skanConversionManager.js +5 -5
- package/lib/commonjs/features/skan/skanConversionManager.js.map +1 -1
- package/lib/commonjs/integrations/fetch/fetchInterceptor.js +1 -1
- package/lib/commonjs/integrations/fetch/fetchInterceptor.js.map +1 -1
- package/lib/commonjs/integrations/xhr/xhrInterceptor.js +1 -1
- package/lib/commonjs/integrations/xhr/xhrInterceptor.js.map +1 -1
- package/lib/commonjs/metro/composeSourceMap.js +105 -0
- package/lib/commonjs/metro/composeSourceMap.js.map +1 -0
- package/lib/commonjs/metro/featureModules.js +131 -0
- package/lib/commonjs/metro/featureModules.js.map +1 -0
- package/lib/commonjs/metro/index.js +123 -2
- package/lib/commonjs/metro/index.js.map +1 -1
- package/lib/commonjs/metro/serializerCompose.js +129 -0
- package/lib/commonjs/metro/serializerCompose.js.map +1 -0
- package/lib/commonjs/pipeline/dispatcher/dispatcher.js +1 -1
- package/lib/commonjs/pipeline/dispatcher/dispatcher.js.map +1 -1
- package/lib/commonjs/pipeline/queue/flushQueue.js +2 -2
- package/lib/commonjs/pipeline/queue/flushQueue.js.map +1 -1
- package/lib/commonjs/pipeline/queue/persistentQueue.js +6 -37
- package/lib/commonjs/pipeline/queue/persistentQueue.js.map +1 -1
- package/lib/commonjs/pipeline/scheduler/flushScheduler.js +1 -1
- package/lib/commonjs/pipeline/scheduler/flushScheduler.js.map +1 -1
- package/lib/commonjs/public/ScaleBunFacade.js +15 -15
- package/lib/commonjs/public/ScaleBunFacade.js.map +1 -1
- package/lib/commonjs/push/PushManager.js +3 -3
- package/lib/commonjs/push/PushManager.js.map +1 -1
- package/lib/commonjs/push/adapters/NativeBridgeAdapter.js +1 -1
- package/lib/commonjs/push/adapters/NativeBridgeAdapter.js.map +1 -1
- package/lib/commonjs/push/native/nativeNotifications.js +7 -18
- package/lib/commonjs/push/native/nativeNotifications.js.map +1 -1
- package/lib/commonjs/storage/StorageBackend.js +1 -1
- package/lib/commonjs/storage/StorageBackend.js.map +1 -1
- package/lib/module/bootstrap/FeatureRegistry.js +4 -4
- package/lib/module/bootstrap/FeatureRegistry.js.map +1 -1
- package/lib/module/bootstrap/SDKBootstrapper.js +8 -8
- package/lib/module/bootstrap/SDKBootstrapper.js.map +1 -1
- package/lib/module/core/config/schema.js +411 -231
- package/lib/module/core/config/schema.js.map +1 -1
- package/lib/module/core/constants/protocol.js +25 -0
- package/lib/module/core/constants/protocol.js.map +1 -0
- package/lib/module/core/constants/timings.js +3 -1
- package/lib/module/core/constants/timings.js.map +1 -1
- package/lib/module/core/lifecycle/appLifecycle.js +1 -1
- package/lib/module/core/lifecycle/appLifecycle.js.map +1 -1
- package/lib/module/debug/bootstrap.js +30 -9
- package/lib/module/debug/bootstrap.js.map +1 -1
- package/lib/module/debug/exportBridge.js +5 -3
- package/lib/module/debug/exportBridge.js.map +1 -1
- package/lib/module/debug/hostResolver.js +2 -2
- package/lib/module/debug/hostResolver.js.map +1 -1
- package/lib/module/debug/perfWiring.js +4 -4
- package/lib/module/debug/perfWiring.js.map +1 -1
- package/lib/module/debug/replayWiring.js +5 -5
- package/lib/module/debug/replayWiring.js.map +1 -1
- package/lib/module/debug/screenTracking.js +2 -2
- package/lib/module/debug/screenTracking.js.map +1 -1
- package/lib/module/debug/sessionWiring.js +2 -2
- package/lib/module/debug/sessionWiring.js.map +1 -1
- package/lib/module/features/crash/NativeCrashFeature.js +1 -1
- package/lib/module/features/crash/NativeCrashFeature.js.map +1 -1
- package/lib/module/features/crash/globalHandler.js +3 -3
- package/lib/module/features/crash/globalHandler.js.map +1 -1
- package/lib/module/features/crash/nativeCrashBridge.js +7 -7
- package/lib/module/features/crash/nativeCrashBridge.js.map +1 -1
- package/lib/module/features/crash/rejectionHandler.js +2 -2
- package/lib/module/features/crash/rejectionHandler.js.map +1 -1
- package/lib/module/features/engage/EngageArchetypeRenderers.js +0 -8
- package/lib/module/features/engage/EngageArchetypeRenderers.js.map +1 -1
- package/lib/module/features/engage/EngageInAppView.js +1 -1
- package/lib/module/features/engage/EngageInAppView.js.map +1 -1
- package/lib/module/features/engage/EngagePromptProvider.js +17 -17
- package/lib/module/features/engage/EngagePromptProvider.js.map +1 -1
- package/lib/module/features/engage/EngageTransport.js +5 -5
- package/lib/module/features/engage/EngageTransport.js.map +1 -1
- package/lib/module/features/engage/engagePushTokenBridge.js +4 -4
- package/lib/module/features/engage/engagePushTokenBridge.js.map +1 -1
- package/lib/module/features/engage/engageShakeBridge.js +2 -2
- package/lib/module/features/engage/engageShakeBridge.js.map +1 -1
- package/lib/module/features/engage/engageSignals.js +1 -1
- package/lib/module/features/engage/engageSignals.js.map +1 -1
- package/lib/module/features/engage/engageStoreReviewBridge.js +2 -2
- package/lib/module/features/engage/engageStoreReviewBridge.js.map +1 -1
- package/lib/module/features/engage/engageTestSeenStore.js +1 -1
- package/lib/module/features/engage/engageTestSeenStore.js.map +1 -1
- package/lib/module/features/engage/engageThrottle.js +4 -4
- package/lib/module/features/engage/engageThrottle.js.map +1 -1
- package/lib/module/features/engage/engageTriggerEngine.js +4 -4
- package/lib/module/features/engage/engageTriggerEngine.js.map +1 -1
- package/lib/module/features/engage/engageWindowInsets.js +1 -1
- package/lib/module/features/engage/engageWindowInsets.js.map +1 -1
- package/lib/module/features/install-referrer/installReferrer.js +3 -3
- package/lib/module/features/install-referrer/installReferrer.js.map +1 -1
- package/lib/module/features/journey/calibrationContext.js +0 -8
- package/lib/module/features/journey/calibrationContext.js.map +1 -1
- package/lib/module/features/journey/journeyManager.js +3 -1
- package/lib/module/features/journey/journeyManager.js.map +1 -1
- package/lib/module/features/navigation/AutoScreenDetector.js +4 -4
- package/lib/module/features/navigation/AutoScreenDetector.js.map +1 -1
- package/lib/module/features/ota/OtaOrchestrator.js +18 -18
- package/lib/module/features/ota/OtaOrchestrator.js.map +1 -1
- package/lib/module/features/ota/geoCountry.js +2 -2
- package/lib/module/features/ota/geoCountry.js.map +1 -1
- package/lib/module/features/ota/retry.js +2 -2
- package/lib/module/features/ota/retry.js.map +1 -1
- package/lib/module/features/performance/PerformanceFeature.js +122 -23
- package/lib/module/features/performance/PerformanceFeature.js.map +1 -1
- package/lib/module/features/replay/core/logger/logger.js +0 -3
- package/lib/module/features/replay/core/logger/logger.js.map +1 -1
- package/lib/module/features/replay/integrations/network/networkAdapter.js +1 -52
- package/lib/module/features/replay/integrations/network/networkAdapter.js.map +1 -1
- package/lib/module/features/replay/integrations/react-navigation/navigationIntegration.js +1 -1
- package/lib/module/features/replay/integrations/react-navigation/navigationIntegration.js.map +1 -1
- package/lib/module/features/replay/integrations/touch/ReplayRoot.js +1 -1
- package/lib/module/features/replay/integrations/touch/ReplayRoot.js.map +1 -1
- package/lib/module/features/replay/pipeline/batching/batchManager.js +1 -1
- package/lib/module/features/replay/pipeline/batching/batchManager.js.map +1 -1
- package/lib/module/features/replay/pipeline/retry/retryPolicy.js +1 -1
- package/lib/module/features/replay/pipeline/retry/retryPolicy.js.map +1 -1
- package/lib/module/features/replay/public/api.js +7 -7
- package/lib/module/features/replay/public/api.js.map +1 -1
- package/lib/module/features/replay/replay/session/sessionOrchestrator.js +9 -9
- package/lib/module/features/replay/replay/session/sessionOrchestrator.js.map +1 -1
- package/lib/module/features/session/BackendSessionAdapter.js +41 -41
- package/lib/module/features/session/BackendSessionAdapter.js.map +1 -1
- package/lib/module/features/session/DesktopSessionTransport.js +4 -2
- package/lib/module/features/session/DesktopSessionTransport.js.map +1 -1
- package/lib/module/features/session/JourneyEventPipeline.js +1 -1
- package/lib/module/features/session/JourneyEventPipeline.js.map +1 -1
- package/lib/module/features/session/ReplayCaptureManager.js +14 -14
- package/lib/module/features/session/ReplayCaptureManager.js.map +1 -1
- package/lib/module/features/session/SessionManager.js +9 -9
- package/lib/module/features/session/SessionManager.js.map +1 -1
- package/lib/module/features/session/SyncDecisionEngine.js +1 -1
- package/lib/module/features/session/SyncDecisionEngine.js.map +1 -1
- package/lib/module/features/skan/skanBridge.js +6 -14
- package/lib/module/features/skan/skanBridge.js.map +1 -1
- package/lib/module/features/skan/skanConversionManager.js +5 -5
- package/lib/module/features/skan/skanConversionManager.js.map +1 -1
- package/lib/module/integrations/fetch/fetchInterceptor.js +1 -1
- package/lib/module/integrations/fetch/fetchInterceptor.js.map +1 -1
- package/lib/module/integrations/xhr/xhrInterceptor.js +1 -1
- package/lib/module/integrations/xhr/xhrInterceptor.js.map +1 -1
- package/lib/module/metro/composeSourceMap.js +97 -0
- package/lib/module/metro/composeSourceMap.js.map +1 -0
- package/lib/module/metro/featureModules.js +123 -0
- package/lib/module/metro/featureModules.js.map +1 -0
- package/lib/module/metro/index.js +122 -2
- package/lib/module/metro/index.js.map +1 -1
- package/lib/module/metro/serializerCompose.js +120 -0
- package/lib/module/metro/serializerCompose.js.map +1 -0
- package/lib/module/pipeline/dispatcher/dispatcher.js +1 -1
- package/lib/module/pipeline/dispatcher/dispatcher.js.map +1 -1
- package/lib/module/pipeline/queue/flushQueue.js +2 -2
- package/lib/module/pipeline/queue/flushQueue.js.map +1 -1
- package/lib/module/pipeline/queue/persistentQueue.js +6 -36
- package/lib/module/pipeline/queue/persistentQueue.js.map +1 -1
- package/lib/module/pipeline/scheduler/flushScheduler.js +1 -1
- package/lib/module/pipeline/scheduler/flushScheduler.js.map +1 -1
- package/lib/module/public/ScaleBunFacade.js +15 -15
- package/lib/module/public/ScaleBunFacade.js.map +1 -1
- package/lib/module/push/PushManager.js +3 -3
- package/lib/module/push/PushManager.js.map +1 -1
- package/lib/module/push/adapters/NativeBridgeAdapter.js +1 -1
- package/lib/module/push/adapters/NativeBridgeAdapter.js.map +1 -1
- package/lib/module/push/native/nativeNotifications.js +7 -17
- package/lib/module/push/native/nativeNotifications.js.map +1 -1
- package/lib/module/storage/StorageBackend.js +1 -1
- package/lib/module/storage/StorageBackend.js.map +1 -1
- package/lib/typescript/core/config/schema.d.ts +61 -40
- package/lib/typescript/core/config/schema.d.ts.map +1 -1
- package/lib/typescript/core/constants/protocol.d.ts +23 -0
- package/lib/typescript/core/constants/protocol.d.ts.map +1 -0
- package/lib/typescript/core/constants/timings.d.ts +1 -1
- package/lib/typescript/core/constants/timings.d.ts.map +1 -1
- package/lib/typescript/debug/bootstrap.d.ts +0 -1
- package/lib/typescript/debug/bootstrap.d.ts.map +1 -1
- package/lib/typescript/debug/exportBridge.d.ts.map +1 -1
- package/lib/typescript/features/engage/EngageArchetypeRenderers.d.ts +0 -2
- package/lib/typescript/features/engage/EngageArchetypeRenderers.d.ts.map +1 -1
- package/lib/typescript/features/journey/calibrationContext.d.ts +0 -1
- package/lib/typescript/features/journey/calibrationContext.d.ts.map +1 -1
- package/lib/typescript/features/journey/journeyManager.d.ts.map +1 -1
- package/lib/typescript/features/performance/PerformanceFeature.d.ts +31 -0
- package/lib/typescript/features/performance/PerformanceFeature.d.ts.map +1 -1
- package/lib/typescript/features/replay/core/logger/logger.d.ts +0 -1
- package/lib/typescript/features/replay/core/logger/logger.d.ts.map +1 -1
- package/lib/typescript/features/replay/integrations/network/networkAdapter.d.ts +0 -10
- package/lib/typescript/features/replay/integrations/network/networkAdapter.d.ts.map +1 -1
- package/lib/typescript/features/session/DesktopSessionTransport.d.ts.map +1 -1
- package/lib/typescript/features/skan/skanBridge.d.ts +0 -2
- package/lib/typescript/features/skan/skanBridge.d.ts.map +1 -1
- package/lib/typescript/metro/composeSourceMap.d.ts +26 -0
- package/lib/typescript/metro/composeSourceMap.d.ts.map +1 -0
- package/lib/typescript/metro/featureModules.d.ts +49 -0
- package/lib/typescript/metro/featureModules.d.ts.map +1 -0
- package/lib/typescript/metro/index.d.ts +22 -0
- package/lib/typescript/metro/index.d.ts.map +1 -1
- package/lib/typescript/metro/serializerCompose.d.ts +46 -0
- package/lib/typescript/metro/serializerCompose.d.ts.map +1 -0
- package/lib/typescript/pipeline/queue/persistentQueue.d.ts +0 -10
- package/lib/typescript/pipeline/queue/persistentQueue.d.ts.map +1 -1
- package/lib/typescript/push/native/nativeNotifications.d.ts +0 -6
- package/lib/typescript/push/native/nativeNotifications.d.ts.map +1 -1
- package/package.json +15 -11
- package/src/bootstrap/FeatureRegistry.ts +4 -4
- package/src/bootstrap/SDKBootstrapper.ts +8 -8
- package/src/core/config/schema.ts +353 -235
- package/src/core/constants/protocol.ts +24 -0
- package/src/core/constants/timings.ts +3 -1
- package/src/core/lifecycle/appLifecycle.ts +1 -1
- package/src/debug/bootstrap.ts +40 -7
- package/src/debug/exportBridge.ts +5 -3
- package/src/debug/hostResolver.ts +2 -2
- package/src/debug/perfWiring.ts +4 -4
- package/src/debug/replayWiring.ts +5 -5
- package/src/debug/screenTracking.ts +2 -2
- package/src/debug/sessionWiring.ts +2 -2
- package/src/features/crash/NativeCrashFeature.ts +1 -1
- package/src/features/crash/globalHandler.ts +3 -3
- package/src/features/crash/nativeCrashBridge.ts +7 -7
- package/src/features/crash/rejectionHandler.ts +2 -2
- package/src/features/engage/EngageArchetypeRenderers.tsx +0 -11
- package/src/features/engage/EngageInAppView.tsx +1 -1
- package/src/features/engage/EngagePromptProvider.tsx +17 -17
- package/src/features/engage/EngageTransport.ts +5 -5
- package/src/features/engage/engagePushTokenBridge.ts +4 -4
- package/src/features/engage/engageShakeBridge.ts +2 -2
- package/src/features/engage/engageSignals.ts +1 -1
- package/src/features/engage/engageStoreReviewBridge.ts +2 -2
- package/src/features/engage/engageTestSeenStore.ts +1 -1
- package/src/features/engage/engageThrottle.ts +4 -4
- package/src/features/engage/engageTriggerEngine.ts +4 -4
- package/src/features/engage/engageWindowInsets.ts +1 -1
- package/src/features/install-referrer/installReferrer.ts +3 -3
- package/src/features/journey/calibrationContext.ts +0 -9
- package/src/features/journey/journeyManager.ts +3 -1
- package/src/features/navigation/AutoScreenDetector.ts +4 -4
- package/src/features/ota/OtaOrchestrator.ts +18 -18
- package/src/features/ota/geoCountry.ts +2 -2
- package/src/features/ota/retry.ts +2 -2
- package/src/features/performance/PerformanceFeature.ts +130 -20
- package/src/features/replay/core/logger/logger.ts +0 -4
- package/src/features/replay/integrations/network/networkAdapter.ts +1 -56
- package/src/features/replay/integrations/react-navigation/navigationIntegration.ts +1 -1
- package/src/features/replay/integrations/touch/ReplayRoot.tsx +1 -1
- package/src/features/replay/pipeline/batching/batchManager.ts +1 -1
- package/src/features/replay/pipeline/retry/retryPolicy.ts +1 -1
- package/src/features/replay/public/api.ts +7 -7
- package/src/features/replay/replay/session/sessionOrchestrator.ts +9 -9
- package/src/features/session/BackendSessionAdapter.ts +41 -41
- package/src/features/session/DesktopSessionTransport.ts +4 -2
- package/src/features/session/JourneyEventPipeline.ts +1 -1
- package/src/features/session/ReplayCaptureManager.ts +14 -14
- package/src/features/session/SessionManager.ts +9 -9
- package/src/features/session/SyncDecisionEngine.ts +1 -1
- package/src/features/skan/skanBridge.ts +6 -14
- package/src/features/skan/skanConversionManager.ts +5 -5
- package/src/integrations/fetch/fetchInterceptor.ts +1 -1
- package/src/integrations/xhr/xhrInterceptor.ts +1 -1
- package/src/metro/composeSourceMap.ts +104 -0
- package/src/metro/featureModules.ts +143 -0
- package/src/metro/index.ts +173 -1
- package/src/metro/serializerCompose.ts +157 -0
- package/src/pipeline/dispatcher/dispatcher.ts +1 -1
- package/src/pipeline/queue/flushQueue.ts +2 -2
- package/src/pipeline/queue/persistentQueue.ts +6 -35
- package/src/pipeline/scheduler/flushScheduler.ts +1 -1
- package/src/public/ScaleBunFacade.ts +15 -15
- package/src/push/PushManager.ts +3 -3
- package/src/push/adapters/NativeBridgeAdapter.ts +1 -1
- package/src/push/native/nativeNotifications.ts +7 -16
- package/src/storage/StorageBackend.ts +1 -1
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.SCALEBUN_FEATURE_MODULES = void 0;
|
|
7
|
+
exports.isExcludedModule = isExcludedModule;
|
|
8
|
+
exports.resolveExcludedModules = resolveExcludedModules;
|
|
9
|
+
/**
|
|
10
|
+
* ScaleBun SDK — Build-time excludable feature registry.
|
|
11
|
+
*
|
|
12
|
+
* Metro has NO tree shaking: every module reachable from the entry point is bundled regardless of
|
|
13
|
+
* whether it is ever imported by name or ever executed. Measured on this SDK, importing a single
|
|
14
|
+
* tiny function instead of the whole facade changed the bundle by 115 bytes. So the only way a
|
|
15
|
+
* consumer can stop paying for a subsystem they do not use is to make it unreachable at RESOLUTION
|
|
16
|
+
* time, which is what `withScaleBun`'s `features` option does.
|
|
17
|
+
*
|
|
18
|
+
* Each entry lists module paths RELATIVE TO THE PACKAGE ROOT, without extension and without the
|
|
19
|
+
* `lib/module` / `lib/commonjs` / `src` prefix, so one list covers every build output.
|
|
20
|
+
*
|
|
21
|
+
* IMPORTANT: a module belongs here only if it is genuinely unreachable when the feature is off.
|
|
22
|
+
* `debug/` is the cautionary case — it also contains PRODUCTION code:
|
|
23
|
+
* - `debug/redaction` → redactBody / redactNetworkEvent, used by SessionManager,
|
|
24
|
+
* persistentQueue and both network interceptors. Removing it would
|
|
25
|
+
* silently disable payload redaction. It is NOT listed here.
|
|
26
|
+
* - `debug/protocol` → PROTOCOL_VERSION, imported as a VALUE by journeyManager and
|
|
27
|
+
* DesktopSessionTransport. NOT listed here.
|
|
28
|
+
* - `debug/screenTracking` → getTrackedScreen, used by NetworkFeature. NOT listed here.
|
|
29
|
+
* - `debug/bootstrap` → re-exported from the package entry point. NOT listed here; it is
|
|
30
|
+
* instead guarded at runtime (see enableDebug).
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* The desktop-debugger tooling: a WebSocket bridge to the ScaleBun desktop app, the command
|
|
35
|
+
* registry it drives, the event stream it consumes, and the profiler that only it initialises.
|
|
36
|
+
*
|
|
37
|
+
* `debug/transport` is included because every importer outside `debug/bootstrap` uses
|
|
38
|
+
* `import type`, which is erased at compile time — bootstrap is its only value consumer, and
|
|
39
|
+
* bootstrap degrades gracefully when the tooling is absent.
|
|
40
|
+
*
|
|
41
|
+
* `features/profiler/` is included because nothing outside `debug/` references ProfilerFeature.
|
|
42
|
+
*/
|
|
43
|
+
const DEV_TOOLS_MODULES = [
|
|
44
|
+
// Reached only from inside enableDebug(), which returns early when the tooling is absent, or
|
|
45
|
+
// through accessors that read a module-level variable left at null (`_getStream`,
|
|
46
|
+
// `_getCommands`, `_getTransport`) or optional-chain it (`_setFlushFn`, `addBreadcrumb`,
|
|
47
|
+
// `ping`, `_perf?.stop()`). None of them call into these modules directly.
|
|
48
|
+
'debug/commands', 'debug/stream', 'debug/transport', 'debug/perf', 'debug/hostResolver', 'debug/perfWiring', 'debug/sessionWiring',
|
|
49
|
+
// Profiler is unreachable once perfWiring is gone — nothing outside debug/ imports it.
|
|
50
|
+
'features/profiler/ProfilerFeature', 'features/profiler/ProfilerTransport', 'features/profiler/index', 'features/profiler/config', 'features/profiler/contracts', 'features/profiler/models'
|
|
51
|
+
|
|
52
|
+
// DELIBERATELY ABSENT, each verified by reading its callers:
|
|
53
|
+
// debug/replayWiring — `_getReplaySdk()` / `_isReplaySdkInitialized()` call into it
|
|
54
|
+
// unconditionally, outside any enable/disable guard.
|
|
55
|
+
// debug/exportBridge — `requestExport()` / `_handleExportResult()` likewise.
|
|
56
|
+
// debug/configBuilder — ScaleBunFacade calls applyFeatureGatesToDebugConfig() BEFORE
|
|
57
|
+
// bootstrap's guard can run.
|
|
58
|
+
// debug/metrics — `ScaleBun.debug.sendMetric()` is public API and is NOT wrapped in
|
|
59
|
+
// noThrow, so a stub would throw straight into caller code.
|
|
60
|
+
];
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Feature name → the modules that become unreachable when it is disabled.
|
|
64
|
+
*
|
|
65
|
+
* Keep this narrow and evidence-backed. Every addition must be justified by checking who actually
|
|
66
|
+
* imports the module, distinguishing `import type` (erased) from a value import (not erased).
|
|
67
|
+
*/
|
|
68
|
+
const SCALEBUN_FEATURE_MODULES = exports.SCALEBUN_FEATURE_MODULES = {
|
|
69
|
+
/**
|
|
70
|
+
* Desktop-debugger tooling. Disabling it means `ScaleBun.init({ debugConnection })` no longer
|
|
71
|
+
* connects in that build; the SDK logs one clear warning and continues. All analytics, session,
|
|
72
|
+
* replay, crash, network and redaction behaviour is unaffected.
|
|
73
|
+
*
|
|
74
|
+
* Measured saving: 52,138 bytes of minified JavaScript in a production Android bundle.
|
|
75
|
+
*/
|
|
76
|
+
devTools: DEV_TOOLS_MODULES
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Per-feature default when the host's config does not mention it.
|
|
80
|
+
*
|
|
81
|
+
* `devTools` defaults to OFF: the desktop debugger it talks to is a future product — no
|
|
82
|
+
* counterpart exists yet anywhere, so today the tooling can only ever dial a socket nobody is
|
|
83
|
+
* listening on, retry, and give up. Shipping 53 KB of that in every app by default was pure waste.
|
|
84
|
+
* When the desktop app ships, hosts opt in with `features: { devTools: true }` (and the default
|
|
85
|
+
* here may flip back).
|
|
86
|
+
*/
|
|
87
|
+
const FEATURE_DEFAULTS = {
|
|
88
|
+
devTools: false
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Build the set of module suffixes to exclude for a given feature configuration.
|
|
93
|
+
*
|
|
94
|
+
* Every known feature is resolved: an explicit `true`/`false` in `features` wins, otherwise the
|
|
95
|
+
* feature's default applies. Unknown names throw — a typo here would silently ship (or silently
|
|
96
|
+
* keep) code the caller believed they had configured, so it is an error rather than a warning.
|
|
97
|
+
*/
|
|
98
|
+
function resolveExcludedModules(features) {
|
|
99
|
+
for (const name of Object.keys(features ?? {})) {
|
|
100
|
+
if (!SCALEBUN_FEATURE_MODULES[name]) {
|
|
101
|
+
throw new Error(`[scalebun/metro] Unknown feature "${name}". Known features: ` + `${Object.keys(SCALEBUN_FEATURE_MODULES).join(', ')}.`);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
const excluded = new Set();
|
|
105
|
+
for (const [name, modules] of Object.entries(SCALEBUN_FEATURE_MODULES)) {
|
|
106
|
+
const enabled = features?.[name] ?? FEATURE_DEFAULTS[name] ?? true;
|
|
107
|
+
if (enabled) continue;
|
|
108
|
+
for (const m of modules) excluded.add(m);
|
|
109
|
+
}
|
|
110
|
+
return excluded;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Does `filePath` correspond to one of the excluded module paths?
|
|
115
|
+
*
|
|
116
|
+
* Matches against the tail of the path so a single registry entry covers `lib/module/….js`,
|
|
117
|
+
* `lib/commonjs/….js` and `src/….ts`. Callers MUST have already confirmed the file lives inside
|
|
118
|
+
* the ScaleBun package — matching on the tail alone would also match a host application's own
|
|
119
|
+
* `debug/commands.js`, which must never be stubbed.
|
|
120
|
+
*/
|
|
121
|
+
function isExcludedModule(filePath, excluded) {
|
|
122
|
+
if (excluded.size === 0) return false;
|
|
123
|
+
const normalized = filePath.replace(/\\/g, '/');
|
|
124
|
+
// Drop the extension so 'debug/commands' matches commands.js, commands.ts and commands.tsx.
|
|
125
|
+
const withoutExt = normalized.replace(/\.[cm]?[jt]sx?$/, '');
|
|
126
|
+
for (const suffix of excluded) {
|
|
127
|
+
if (withoutExt.endsWith('/' + suffix)) return true;
|
|
128
|
+
}
|
|
129
|
+
return false;
|
|
130
|
+
}
|
|
131
|
+
//# sourceMappingURL=featureModules.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["DEV_TOOLS_MODULES","SCALEBUN_FEATURE_MODULES","exports","devTools","FEATURE_DEFAULTS","resolveExcludedModules","features","name","Object","keys","Error","join","excluded","Set","modules","entries","enabled","m","add","isExcludedModule","filePath","size","normalized","replace","withoutExt","suffix","endsWith"],"sourceRoot":"../../../src","sources":["metro/featureModules.ts"],"mappings":";;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,iBAAiB,GAAG;AACtB;AACA;AACA;AACA;AACA,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,oBAAoB,EACpB,kBAAkB,EAClB,qBAAqB;AAErB;AACA,mCAAmC,EACnC,qCAAqC,EACrC,yBAAyB,EACzB,0BAA0B,EAC1B,6BAA6B,EAC7B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA,CACM;;AAEV;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,wBAAqE,GAAAC,OAAA,CAAAD,wBAAA,GAAG;EACjF;AACJ;AACA;AACA;AACA;AACA;AACA;EACIE,QAAQ,EAAEH;AACd,CAAC;AAID;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMI,gBAAgE,GAAG;EACrED,QAAQ,EAAE;AACd,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,sBAAsBA,CAClCC,QAAmE,EAChD;EACnB,KAAK,MAAMC,IAAI,IAAIC,MAAM,CAACC,IAAI,CAACH,QAAQ,IAAI,CAAC,CAAC,CAAC,EAAE;IAC5C,IAAI,CAACL,wBAAwB,CAACM,IAAI,CAAC,EAAE;MACjC,MAAM,IAAIG,KAAK,CACX,qCAAqCH,IAAI,qBAAqB,GAC1D,GAAGC,MAAM,CAACC,IAAI,CAACR,wBAAwB,CAAC,CAACU,IAAI,CAAC,IAAI,CAAC,GAC3D,CAAC;IACL;EACJ;EAEA,MAAMC,QAAQ,GAAG,IAAIC,GAAG,CAAS,CAAC;EAClC,KAAK,MAAM,CAACN,IAAI,EAAEO,OAAO,CAAC,IAAIN,MAAM,CAACO,OAAO,CAACd,wBAAwB,CAAC,EAAE;IACpE,MAAMe,OAAO,GAAGV,QAAQ,GAAGC,IAAI,CAAC,IAAIH,gBAAgB,CAACG,IAAI,CAAwB,IAAI,IAAI;IACzF,IAAIS,OAAO,EAAE;IACb,KAAK,MAAMC,CAAC,IAAIH,OAAO,EAAEF,QAAQ,CAACM,GAAG,CAACD,CAAC,CAAC;EAC5C;EACA,OAAOL,QAAQ;AACnB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASO,gBAAgBA,CAACC,QAAgB,EAAER,QAA6B,EAAW;EACvF,IAAIA,QAAQ,CAACS,IAAI,KAAK,CAAC,EAAE,OAAO,KAAK;EACrC,MAAMC,UAAU,GAAGF,QAAQ,CAACG,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;EAC/C;EACA,MAAMC,UAAU,GAAGF,UAAU,CAACC,OAAO,CAAC,iBAAiB,EAAE,EAAE,CAAC;EAC5D,KAAK,MAAME,MAAM,IAAIb,QAAQ,EAAE;IAC3B,IAAIY,UAAU,CAACE,QAAQ,CAAC,GAAG,GAAGD,MAAM,CAAC,EAAE,OAAO,IAAI;EACtD;EACA,OAAO,KAAK;AAChB","ignoreList":[]}
|
|
@@ -11,7 +11,12 @@ Object.defineProperty(exports, "SCALEBUN_OPTIONAL_MODULES", {
|
|
|
11
11
|
});
|
|
12
12
|
exports.default = void 0;
|
|
13
13
|
exports.withScaleBun = withScaleBun;
|
|
14
|
+
var nodePath = _interopRequireWildcard(require("path"));
|
|
15
|
+
var nodeFs = _interopRequireWildcard(require("fs"));
|
|
14
16
|
var _optionalModules = require("./optionalModules");
|
|
17
|
+
var _featureModules = require("./featureModules");
|
|
18
|
+
var _serializerCompose = require("./serializerCompose");
|
|
19
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
15
20
|
/**
|
|
16
21
|
* ScaleBun SDK — Metro configuration helper.
|
|
17
22
|
*
|
|
@@ -59,6 +64,56 @@ function resolveStubPath() {
|
|
|
59
64
|
}
|
|
60
65
|
}
|
|
61
66
|
|
|
67
|
+
/**
|
|
68
|
+
* Absolute path to this package's root, found by walking up from this file until a package.json
|
|
69
|
+
* naming this package appears.
|
|
70
|
+
*
|
|
71
|
+
* Computed by search rather than a fixed number of `..` segments because this module is emitted to
|
|
72
|
+
* different depths (`lib/commonjs/metro/` when published, `src/metro/` under ts-jest), and a
|
|
73
|
+
* hard-coded depth would silently resolve to the wrong directory in one of them.
|
|
74
|
+
*
|
|
75
|
+
* Returns null if the root cannot be identified, in which case feature exclusion is skipped
|
|
76
|
+
* entirely — stubbing on a tail match alone could hit a host application's own files.
|
|
77
|
+
*/
|
|
78
|
+
function findPackageRoot() {
|
|
79
|
+
let dir = __dirname;
|
|
80
|
+
for (let i = 0; i < 10; i++) {
|
|
81
|
+
try {
|
|
82
|
+
const manifest = nodePath.join(dir, 'package.json');
|
|
83
|
+
if (nodeFs.existsSync(manifest)) {
|
|
84
|
+
const name = JSON.parse(nodeFs.readFileSync(manifest, 'utf8'))?.name;
|
|
85
|
+
if (name === '@scalebun/react-native') return nodeFs.realpathSync(dir);
|
|
86
|
+
}
|
|
87
|
+
} catch {
|
|
88
|
+
// Unreadable/malformed manifest — keep walking rather than failing the whole build.
|
|
89
|
+
}
|
|
90
|
+
const parent = nodePath.dirname(dir);
|
|
91
|
+
if (parent === dir) break;
|
|
92
|
+
dir = parent;
|
|
93
|
+
}
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Is `filePath` inside this package?
|
|
99
|
+
*
|
|
100
|
+
* Both sides are realpath'd because pnpm and npm workspaces symlink the package into
|
|
101
|
+
* `node_modules`, so Metro can hand back a path through the symlink while the package root was
|
|
102
|
+
* discovered through the store — a plain prefix comparison would then miss and quietly disable
|
|
103
|
+
* exclusion. Falls back to the raw path when realpath fails (file may not exist yet).
|
|
104
|
+
*/
|
|
105
|
+
function isInsidePackage(filePath, packageRoot) {
|
|
106
|
+
let real = filePath;
|
|
107
|
+
try {
|
|
108
|
+
real = nodeFs.realpathSync(filePath);
|
|
109
|
+
} catch {
|
|
110
|
+
// Keep the original path; the relative check below still gives a correct answer for
|
|
111
|
+
// anything that genuinely lives under the package root.
|
|
112
|
+
}
|
|
113
|
+
const rel = nodePath.relative(packageRoot, real);
|
|
114
|
+
return rel !== '' && !rel.startsWith('..') && !nodePath.isAbsolute(rel);
|
|
115
|
+
}
|
|
116
|
+
|
|
62
117
|
/**
|
|
63
118
|
* Wrap a Metro configuration so the SDK's optional integration packages resolve
|
|
64
119
|
* to an empty stub when they are not installed.
|
|
@@ -74,6 +129,25 @@ function withScaleBun(config, options = {}) {
|
|
|
74
129
|
const stubPath = resolveStubPath();
|
|
75
130
|
const optionalModules = new Set([..._optionalModules.SCALEBUN_OPTIONAL_MODULES, ...(options.optionalModules ?? [])]);
|
|
76
131
|
|
|
132
|
+
// Throws on an unknown feature name, at config load, rather than silently shipping code the
|
|
133
|
+
// caller believed they had excluded.
|
|
134
|
+
const excludedModules = (0, _featureModules.resolveExcludedModules)(options.features);
|
|
135
|
+
const packageRoot = findPackageRoot();
|
|
136
|
+
if (excludedModules.size > 0 && packageRoot == null) {
|
|
137
|
+
throw new Error('[scalebun/metro] features were requested but the @scalebun/react-native package root ' + 'could not be located from ' + __dirname + '. Refusing to exclude modules by path suffix alone, because that could stub files ' + "belonging to your own app. Reinstall the package, or drop the `features` option.");
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// The pre-bundled artifacts. Package exports resolve "@scalebun/react-native" to the slim one;
|
|
141
|
+
// `features: { devTools: true }` redirects to the full one below. When the package was built
|
|
142
|
+
// without dist/ (working from raw source), both lists are empty and every dist-dependent
|
|
143
|
+
// behaviour degrades to the per-file lib/ path.
|
|
144
|
+
const artifacts = packageRoot ? (0, _serializerCompose.discoverArtifacts)(packageRoot) : [];
|
|
145
|
+
const fullArtifact = artifacts.find(a => a.artifactPath.endsWith('scalebun.full.js'));
|
|
146
|
+
const wantsDevTools = options.features?.devTools === true;
|
|
147
|
+
if (wantsDevTools && artifacts.length > 0 && !fullArtifact) {
|
|
148
|
+
throw new Error('[scalebun/metro] features.devTools is true but dist/scalebun.full.js is missing from ' + 'the installed package. Reinstall @scalebun/react-native.');
|
|
149
|
+
}
|
|
150
|
+
|
|
77
151
|
// Preserve a host-provided resolver so aliases, monorepo/PnP, SVG, NativeWind,
|
|
78
152
|
// Storybook, Expo, etc. keep working. We call it first and only add a fallback.
|
|
79
153
|
const hostResolveRequest = config.resolver?.resolveRequest;
|
|
@@ -83,8 +157,19 @@ function withScaleBun(config, options = {}) {
|
|
|
83
157
|
if (typeof baseResolve !== 'function') {
|
|
84
158
|
throw new Error('[scalebun/metro] This Metro version does not expose a resolver ' + "callback on the resolution context. withScaleBun requires Metro's " + 'custom `resolver.resolveRequest` API (Metro >= 0.64, React Native ' + '>= 0.64). Upgrade Metro/React Native or remove withScaleBun.');
|
|
85
159
|
}
|
|
160
|
+
|
|
161
|
+
// devTools opt-in: the package's exports point at the slim artifact, so the full one is
|
|
162
|
+
// reachable only through this redirect. Matching the bare specifier is safe here — it is
|
|
163
|
+
// the package's own name, which nothing else can legitimately claim.
|
|
164
|
+
if (wantsDevTools && fullArtifact && moduleName === '@scalebun/react-native') {
|
|
165
|
+
return {
|
|
166
|
+
type: 'sourceFile',
|
|
167
|
+
filePath: fullArtifact.artifactPath
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
let resolution;
|
|
86
171
|
try {
|
|
87
|
-
|
|
172
|
+
resolution = baseResolve(context, moduleName, platform);
|
|
88
173
|
} catch (error) {
|
|
89
174
|
if (optionalModules.has(moduleName)) {
|
|
90
175
|
// Known ScaleBun optional integration, not installed → empty stub.
|
|
@@ -96,13 +181,49 @@ function withScaleBun(config, options = {}) {
|
|
|
96
181
|
// Unrelated module: preserve Metro's original failure exactly.
|
|
97
182
|
throw error;
|
|
98
183
|
}
|
|
184
|
+
|
|
185
|
+
// Feature exclusion is decided on the RESOLVED path, never on the request string: one
|
|
186
|
+
// module is reached through many different relative specifiers, and only a resolved path
|
|
187
|
+
// can be confirmed to live inside this package. That containment check is the safety
|
|
188
|
+
// property — a tail match alone would also stub a host app's own `debug/commands.js`.
|
|
189
|
+
if (packageRoot != null && resolution != null && resolution.type === 'sourceFile' && typeof resolution.filePath === 'string' && isInsidePackage(resolution.filePath, packageRoot) && (0, _featureModules.isExcludedModule)(resolution.filePath, excludedModules)) {
|
|
190
|
+
return {
|
|
191
|
+
type: 'sourceFile',
|
|
192
|
+
filePath: stubPath
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
return resolution;
|
|
99
196
|
};
|
|
197
|
+
|
|
198
|
+
// ── Source-map composition (symbolication correct by default) ───────────────────────────
|
|
199
|
+
// The pre-bundled artifact collapses SDK frames to one generated file in Metro's map, and
|
|
200
|
+
// Metro cannot chain input maps. Wrapping the serializer here means the .map every consumer
|
|
201
|
+
// build writes already resolves SDK frames to original TypeScript — wherever it is uploaded.
|
|
202
|
+
let serializerConfig = config.serializer;
|
|
203
|
+
if (artifacts.length > 0) {
|
|
204
|
+
// Anchor metro resolution at the app: its projectRoot when the config carries one, else
|
|
205
|
+
// the bundling process's cwd (react-native CLI runs from the app root).
|
|
206
|
+
const projectRoot = config.projectRoot;
|
|
207
|
+
const internals = (0, _serializerCompose.resolveMetroInternals)([...(typeof projectRoot === 'string' ? [projectRoot] : []), process.cwd()]);
|
|
208
|
+
if (internals == null) {
|
|
209
|
+
// eslint-disable-next-line no-console
|
|
210
|
+
console.warn('[scalebun/metro] Could not load Metro serialization internals from this Metro ' + "version, so ScaleBun's source-map composition is disabled. Builds work, but " + 'SDK stack frames will symbolicate to the bundled artifact instead of original ' + 'sources. Please report your Metro version to ScaleBun.');
|
|
211
|
+
} else {
|
|
212
|
+
serializerConfig = {
|
|
213
|
+
...serializerConfig,
|
|
214
|
+
customSerializer: (0, _serializerCompose.createComposingSerializer)(artifacts, internals, serializerConfig?.customSerializer)
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
}
|
|
100
218
|
return {
|
|
101
219
|
...config,
|
|
102
220
|
resolver: {
|
|
103
221
|
...config.resolver,
|
|
104
222
|
resolveRequest
|
|
105
|
-
}
|
|
223
|
+
},
|
|
224
|
+
...(serializerConfig !== undefined ? {
|
|
225
|
+
serializer: serializerConfig
|
|
226
|
+
} : {})
|
|
106
227
|
};
|
|
107
228
|
}
|
|
108
229
|
var _default = exports.default = withScaleBun;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["nodePath","_interopRequireWildcard","require","nodeFs","_optionalModules","_featureModules","_serializerCompose","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","resolveStubPath","resolve","cause","Error","findPackageRoot","dir","__dirname","manifest","join","existsSync","name","JSON","parse","readFileSync","realpathSync","parent","dirname","isInsidePackage","filePath","packageRoot","real","rel","relative","startsWith","isAbsolute","withScaleBun","config","options","stubPath","optionalModules","Set","SCALEBUN_OPTIONAL_MODULES","excludedModules","resolveExcludedModules","features","size","artifacts","discoverArtifacts","fullArtifact","find","a","artifactPath","endsWith","wantsDevTools","devTools","length","hostResolveRequest","resolver","resolveRequest","context","moduleName","platform","baseResolve","type","resolution","error","isExcludedModule","serializerConfig","serializer","projectRoot","internals","resolveMetroInternals","process","cwd","console","warn","customSerializer","createComposingSerializer","undefined","_default","exports"],"sourceRoot":"../../../src","sources":["metro/index.ts"],"mappings":";;;;;;;;;;;;;AA2BA,IAAAA,QAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAF,uBAAA,CAAAC,OAAA;AAEA,IAAAE,gBAAA,GAAAF,OAAA;AACA,IAAAG,eAAA,GAAAH,OAAA;AACA,IAAAI,kBAAA,GAAAJ,OAAA;AAK6B,SAAAD,wBAAAM,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAR,uBAAA,YAAAA,CAAAM,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAA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AAgB,EAAE,IAAAC,4CAAyB,EACvC/B,SAAS,EACTwB,SAAS,EACTH,gBAAgB,EAAES,gBACtB;MACJ,CAAC;IACL;EACJ;EAEA,OAAO;IACH,GAAGxC,MAAM;IACTqB,QAAQ,EAAE;MACN,GAAGrB,MAAM,CAACqB,QAAQ;MAClBC;IACJ,CAAC;IACD,IAAIS,gBAAgB,KAAKW,SAAS,GAAG;MAAEV,UAAU,EAAED;IAAiB,CAAC,GAAG,CAAC,CAAC;EAC9E,CAAC;AACL;AAAC,IAAAY,QAAA,GAAAC,OAAA,CAAA/E,OAAA,GAKckC,YAAY","ignoreList":[]}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createComposingSerializer = createComposingSerializer;
|
|
7
|
+
exports.discoverArtifacts = discoverArtifacts;
|
|
8
|
+
exports.resolveMetroInternals = resolveMetroInternals;
|
|
9
|
+
var fs = _interopRequireWildcard(require("fs"));
|
|
10
|
+
var path = _interopRequireWildcard(require("path"));
|
|
11
|
+
var _composeSourceMap = require("./composeSourceMap");
|
|
12
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
13
|
+
/**
|
|
14
|
+
* ScaleBun SDK — Metro serializer wrapper that emits a COMPOSED source map.
|
|
15
|
+
*
|
|
16
|
+
* Attached by `withScaleBun`. Reproduces Metro's default serialization (the exact calls
|
|
17
|
+
* Server.js makes when no custom serializer is configured), then rewrites every mapping that
|
|
18
|
+
* lands in a ScaleBun pre-bundled artifact through that artifact's stage-2 map, so the .map the
|
|
19
|
+
* build writes resolves SDK frames to original TypeScript — by default, for every consumer.
|
|
20
|
+
*
|
|
21
|
+
* Cooperation with a host-configured serializer: the host runs first and its code output is
|
|
22
|
+
* respected verbatim. If it returned its own map, that map is composed; if it returned only a
|
|
23
|
+
* string, the map is built from the graph exactly as Metro itself would have, then composed —
|
|
24
|
+
* either way the host loses nothing and gains correct SDK frames.
|
|
25
|
+
*
|
|
26
|
+
* Metro's serialization internals are reached through the "./private/*" exports alias
|
|
27
|
+
* (Metro >= 0.80.6) with a fallback to the bare "./src/*" paths older versions expose. If
|
|
28
|
+
* neither resolves, the wrapper is NOT attached and one warning explains what degrades —
|
|
29
|
+
* bundling must never fail because symbolication couldn't be improved.
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
// ─── Minimal structural types for the slice of Metro's serializer API we touch ─────────────────
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Resolve Metro's serialization helpers from the HOST's Metro install. Returns null when they
|
|
36
|
+
* cannot be found (exotic Metro version/layout) — callers must degrade gracefully.
|
|
37
|
+
*
|
|
38
|
+
* Resolution is anchored at the APP (project root / cwd), never at this package's own location:
|
|
39
|
+
* `metro` is not a dependency of the SDK, so under pnpm's strict layout a bare require from here
|
|
40
|
+
* finds nothing — and even where it would resolve, the app's Metro is the one whose serializer
|
|
41
|
+
* contract must be matched, not whichever copy happens to sit near the SDK.
|
|
42
|
+
*/
|
|
43
|
+
function resolveMetroInternals(searchPaths) {
|
|
44
|
+
const paths = [...searchPaths.filter(Boolean)];
|
|
45
|
+
const req = spec => require(require.resolve(spec, {
|
|
46
|
+
paths
|
|
47
|
+
}));
|
|
48
|
+
for (const prefix of ['metro/private', 'metro/src']) {
|
|
49
|
+
try {
|
|
50
|
+
const base = req(`${prefix}/DeltaBundler/Serializers/baseJSBundle`);
|
|
51
|
+
const bts = req(`${prefix}/lib/bundleToString`);
|
|
52
|
+
const smo = req(`${prefix}/DeltaBundler/Serializers/sourceMapObject`);
|
|
53
|
+
const baseJSBundle = base.default ?? base;
|
|
54
|
+
const bundleToString = bts.default ?? bts;
|
|
55
|
+
const sourceMapObject = smo.sourceMapObject ?? smo.default ?? smo;
|
|
56
|
+
if (typeof baseJSBundle === 'function' && typeof bundleToString === 'function' && typeof sourceMapObject === 'function') {
|
|
57
|
+
return {
|
|
58
|
+
baseJSBundle,
|
|
59
|
+
bundleToString,
|
|
60
|
+
sourceMapObject
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
} catch {
|
|
64
|
+
// try the next prefix
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** The artifacts a package root can contain, with existence checked once at config time. */
|
|
71
|
+
function discoverArtifacts(packageRoot) {
|
|
72
|
+
const out = [];
|
|
73
|
+
for (const name of ['scalebun.slim.js', 'scalebun.full.js']) {
|
|
74
|
+
const artifactPath = path.join(packageRoot, 'dist', name);
|
|
75
|
+
const mapPath = artifactPath + '.map';
|
|
76
|
+
if (fs.existsSync(artifactPath) && fs.existsSync(mapPath)) {
|
|
77
|
+
out.push({
|
|
78
|
+
artifactPath,
|
|
79
|
+
mapPath
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return out;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Build the composing serializer. `hostSerializer` is the app's own customSerializer, if any.
|
|
88
|
+
*/
|
|
89
|
+
function createComposingSerializer(artifacts, internals, hostSerializer) {
|
|
90
|
+
return async (entryPoint, preModules, graph, options) => {
|
|
91
|
+
let code;
|
|
92
|
+
let mapObj = null;
|
|
93
|
+
if (hostSerializer) {
|
|
94
|
+
const hostResult = await hostSerializer(entryPoint, preModules, graph, options);
|
|
95
|
+
if (typeof hostResult === 'string') {
|
|
96
|
+
code = hostResult;
|
|
97
|
+
} else {
|
|
98
|
+
code = hostResult.code;
|
|
99
|
+
try {
|
|
100
|
+
mapObj = JSON.parse(hostResult.map);
|
|
101
|
+
} catch {
|
|
102
|
+
// Host emitted an unparsable map; fall through and rebuild from the graph so
|
|
103
|
+
// the build still succeeds with a correct map rather than failing here.
|
|
104
|
+
mapObj = null;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
} else {
|
|
108
|
+
code = internals.bundleToString(internals.baseJSBundle(entryPoint, preModules, graph, options)).code;
|
|
109
|
+
}
|
|
110
|
+
if (mapObj == null) {
|
|
111
|
+
// Metro's own fallback, replicated: modules sorted by module id, same options.
|
|
112
|
+
const modules = [...graph.dependencies.values()].sort((a, b) => options.createModuleId(a.path) - options.createModuleId(b.path));
|
|
113
|
+
mapObj = internals.sourceMapObject([...preModules, ...modules], {
|
|
114
|
+
excludeSource: options.excludeSource,
|
|
115
|
+
processModuleFilter: options.processModuleFilter,
|
|
116
|
+
shouldAddToIgnoreList: options.shouldAddToIgnoreList,
|
|
117
|
+
getSourceUrl: options.getSourceUrl
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
const {
|
|
121
|
+
map
|
|
122
|
+
} = (0, _composeSourceMap.composeSourceMap)(mapObj, artifacts);
|
|
123
|
+
return {
|
|
124
|
+
code,
|
|
125
|
+
map: JSON.stringify(map)
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=serializerCompose.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["fs","_interopRequireWildcard","require","path","_composeSourceMap","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","resolveMetroInternals","searchPaths","paths","filter","Boolean","req","spec","resolve","prefix","base","bts","smo","baseJSBundle","bundleToString","sourceMapObject","discoverArtifacts","packageRoot","out","name","artifactPath","join","mapPath","existsSync","push","createComposingSerializer","artifacts","internals","hostSerializer","entryPoint","preModules","graph","options","code","mapObj","hostResult","JSON","parse","map","modules","dependencies","values","sort","a","b","createModuleId","excludeSource","processModuleFilter","shouldAddToIgnoreList","getSourceUrl","composeSourceMap","stringify"],"sourceRoot":"../../../src","sources":["metro/serializerCompose.ts"],"mappings":";;;;;;;;AAkBA,IAAAA,EAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,IAAA,GAAAF,uBAAA,CAAAC,OAAA;AAEA,IAAAE,iBAAA,GAAAF,OAAA;AAA4E,SAAAD,wBAAAI,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAN,uBAAA,YAAAA,CAAAI,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,CAAA,EAAAC,CAAA,OAAAM,CAAA,CAAAK,GAAA,IAAAL,CAAA,CAAAM,GAAA,IAAAP,CAAA,CAAAE,CAAA,EAAAP,CAAA,EAAAM,CAAA,IAAAC,CAAA,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;IAEA,IAAIC,MAAM,IAAI,IAAI,EAAE;MAChB;MACA,MAAMK,OAAO,GAAG,CAAC,GAAGR,KAAK,CAACS,YAAY,CAACC,MAAM,CAAC,CAAC,CAAC,CAACC,IAAI,CACjD,CAACC,CAAC,EAAEC,CAAC,KAAKZ,OAAO,CAACa,cAAc,CAACF,CAAC,CAAC/D,IAAI,CAAC,GAAGoD,OAAO,CAACa,cAAc,CAACD,CAAC,CAAChE,IAAI,CAC5E,CAAC;MACDsD,MAAM,GAAGP,SAAS,CAACZ,eAAe,CAAC,CAAC,GAAGe,UAAU,EAAE,GAAGS,OAAO,CAAC,EAAE;QAC5DO,aAAa,EAAEd,OAAO,CAACc,aAAa;QACpCC,mBAAmB,EAAEf,OAAO,CAACe,mBAAmB;QAChDC,qBAAqB,EAAEhB,OAAO,CAACgB,qBAAqB;QACpDC,YAAY,EAAEjB,OAAO,CAACiB;MAC1B,CAAC,CAAC;IACN;IAEA,MAAM;MAAEX;IAAI,CAAC,GAAG,IAAAY,kCAAgB,EAAChB,MAAM,EAAWR,SAAS,CAAC;IAC5D,OAAO;MAAEO,IAAI;MAAEK,GAAG,EAAEF,IAAI,CAACe,SAAS,CAACb,GAAG;IAAE,CAAC;EAC7C,CAAC;AACL","ignoreList":[]}
|
|
@@ -15,7 +15,7 @@ class Dispatcher {
|
|
|
15
15
|
if (batch.length === 0) return;
|
|
16
16
|
try {
|
|
17
17
|
await this.transport(batch);
|
|
18
|
-
_internalLogger.logger.info(`Successfully dispatched batch of ${batch.length} events`);
|
|
18
|
+
__DEV__ && _internalLogger.logger.info(`Successfully dispatched batch of ${batch.length} events`);
|
|
19
19
|
} catch (err) {
|
|
20
20
|
_internalLogger.logger.error('Failed to dispatch batch, returning to queue', err);
|
|
21
21
|
// Re-queue items on failure
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_memoryQueue","require","_internalLogger","Dispatcher","constructor","transport","flush","batch","memoryQueue","popBatch","length","logger","info","err","error","forEach","env","add","exports"],"sourceRoot":"../../../../src","sources":["pipeline/dispatcher/dispatcher.ts"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AAEO,MAAME,UAAU,CAAC;EACpBC,WAAWA,CAASC,SAA+C,EAAE;IAAA,KAAjDA,SAA+C,GAA/CA,SAA+C;EAAI;EAEvE,MAAMC,KAAKA,CAAA,EAAG;IACV,MAAMC,KAAK,GAAGC,wBAAW,CAACC,QAAQ,CAAC,CAAC;IACpC,IAAIF,KAAK,CAACG,MAAM,KAAK,CAAC,EAAE;IAExB,IAAI;MACA,MAAM,IAAI,CAACL,SAAS,CAACE,KAAK,CAAC;MAC3BI,sBAAM,CAACC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"names":["_memoryQueue","require","_internalLogger","Dispatcher","constructor","transport","flush","batch","memoryQueue","popBatch","length","__DEV__","logger","info","err","error","forEach","env","add","exports"],"sourceRoot":"../../../../src","sources":["pipeline/dispatcher/dispatcher.ts"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AAEO,MAAME,UAAU,CAAC;EACpBC,WAAWA,CAASC,SAA+C,EAAE;IAAA,KAAjDA,SAA+C,GAA/CA,SAA+C;EAAI;EAEvE,MAAMC,KAAKA,CAAA,EAAG;IACV,MAAMC,KAAK,GAAGC,wBAAW,CAACC,QAAQ,CAAC,CAAC;IACpC,IAAIF,KAAK,CAACG,MAAM,KAAK,CAAC,EAAE;IAExB,IAAI;MACA,MAAM,IAAI,CAACL,SAAS,CAACE,KAAK,CAAC;MAC3BI,OAAO,IAAIC,sBAAM,CAACC,IAAI,CAAC,oCAAoCN,KAAK,CAACG,MAAM,SAAS,CAAC;IACrF,CAAC,CAAC,OAAOI,GAAG,EAAE;MACVF,sBAAM,CAACG,KAAK,CAAC,8CAA8C,EAAED,GAAG,CAAC;MACjE;MACAP,KAAK,CAACS,OAAO,CAAEC,GAAG,IAAKT,wBAAW,CAACU,GAAG,CAACD,GAAG,CAAC,CAAC;MAC5C,MAAMH,GAAG;IACb;EACJ;AACJ;AAACK,OAAA,CAAAhB,UAAA,GAAAA,UAAA","ignoreList":[]}
|
|
@@ -21,7 +21,7 @@ const inFlight = new WeakSet();
|
|
|
21
21
|
const failureStreak = new WeakMap();
|
|
22
22
|
async function flushQueue(queue, httpClient, deviceId, headers) {
|
|
23
23
|
if (inFlight.has(queue)) {
|
|
24
|
-
_internalLogger.logger.debug('[Flush] Skipped — a flush is already in progress');
|
|
24
|
+
__DEV__ && _internalLogger.logger.debug('[Flush] Skipped — a flush is already in progress');
|
|
25
25
|
return {
|
|
26
26
|
status: 'skipped',
|
|
27
27
|
batchSize: 0
|
|
@@ -58,7 +58,7 @@ async function flushQueue(queue, httpClient, deviceId, headers) {
|
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
60
|
failureStreak.delete(queue);
|
|
61
|
-
_internalLogger.logger.info(`Successfully flushed ${batch.length} events`);
|
|
61
|
+
__DEV__ && _internalLogger.logger.info(`Successfully flushed ${batch.length} events`);
|
|
62
62
|
return {
|
|
63
63
|
status: 'flushed',
|
|
64
64
|
batchSize: batch.length
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_internalLogger","require","_errorClassification","_exponentialJitter","_endpoints","inFlight","WeakSet","failureStreak","WeakMap","flushQueue","queue","httpClient","deviceId","headers","has","logger","debug","status","batchSize","batch","popBatch","length","add","res","post","ENDPOINTS","EVENTS","events","handleRecoverable","undefined","delete","hint","error","info","err","isRecoverableFlushError","handleFatal","requeueBatch","attempt","Math","min","get","set","nextRetryMs","round","getDelayWithJitter","reason","describeErrorReason","warn"],"sourceRoot":"../../../../src","sources":["pipeline/queue/flushQueue.ts"],"mappings":";;;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AACA,IAAAC,oBAAA,GAAAD,OAAA;AAIA,IAAAE,kBAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AAIA;;AASA;AACA;AACA;AACA;AACA;AACA,MAAMI,QAAQ,GAAG,IAAIC,OAAO,CAAkB,CAAC;;AAE/C;AACA,MAAMC,aAAa,GAAG,IAAIC,OAAO,CAA0B,CAAC;AAErD,eAAeC,UAAUA,CAC5BC,KAAsB,EACtBC,UAAsB,EACtBC,QAAgB,EAChBC,OAAgC,EACZ;EACpB,IAAIR,QAAQ,CAACS,GAAG,CAACJ,KAAK,CAAC,EAAE;IACrBK,sBAAM,CAACC,KAAK,CAAC,kDAAkD,CAAC;
|
|
1
|
+
{"version":3,"names":["_internalLogger","require","_errorClassification","_exponentialJitter","_endpoints","inFlight","WeakSet","failureStreak","WeakMap","flushQueue","queue","httpClient","deviceId","headers","has","__DEV__","logger","debug","status","batchSize","batch","popBatch","length","add","res","post","ENDPOINTS","EVENTS","events","handleRecoverable","undefined","delete","hint","error","info","err","isRecoverableFlushError","handleFatal","requeueBatch","attempt","Math","min","get","set","nextRetryMs","round","getDelayWithJitter","reason","describeErrorReason","warn"],"sourceRoot":"../../../../src","sources":["pipeline/queue/flushQueue.ts"],"mappings":";;;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AACA,IAAAC,oBAAA,GAAAD,OAAA;AAIA,IAAAE,kBAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AAIA;;AASA;AACA;AACA;AACA;AACA;AACA,MAAMI,QAAQ,GAAG,IAAIC,OAAO,CAAkB,CAAC;;AAE/C;AACA,MAAMC,aAAa,GAAG,IAAIC,OAAO,CAA0B,CAAC;AAErD,eAAeC,UAAUA,CAC5BC,KAAsB,EACtBC,UAAsB,EACtBC,QAAgB,EAChBC,OAAgC,EACZ;EACpB,IAAIR,QAAQ,CAACS,GAAG,CAACJ,KAAK,CAAC,EAAE;IACrBK,OAAO,IAAIC,sBAAM,CAACC,KAAK,CAAC,kDAAkD,CAAC;IAC3E,OAAO;MAAEC,MAAM,EAAE,SAAS;MAAEC,SAAS,EAAE;IAA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EAAEC,KAAK,CAACE,MAAM;IAAEsB;EAAY,CAAC;AAC1E;AAEA,SAASP,WAAWA,CAChB3B,KAAsB,EACtBU,KAA8C,EAC9Ce,GAAY,EACD;EACX;EACAzB,KAAK,CAAC4B,YAAY,CAAClB,KAAK,CAAC;;EAEzB;EACAJ,sBAAM,CAACiB,KAAK,CACR,2DAA2D,GAC3D,UAAU,GACV,eAAe,GACf,gBAAgB,GAChB,2BAA2B,GAC3B,kCAAkC,GAClC,aAAaP,oBAAS,CAACC,MAAM,EAAE,EAC/BQ,GACJ,CAAC;EAED,OAAO;IAAEjB,MAAM,EAAE,OAAO;IAAEC,SAAS,EAAEC,KAAK,CAACE;EAAO,CAAC;AACvD","ignoreList":[]}
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.PersistentQueue = exports.DEFAULT_PERSISTENCE_CONFIG = void 0;
|
|
7
|
-
exports.createPersistentQueue = createPersistentQueue;
|
|
8
7
|
var _internalLogger = require("../../core/logger/internalLogger");
|
|
9
8
|
var _redaction = require("../../debug/redaction");
|
|
10
9
|
/**
|
|
@@ -73,7 +72,7 @@ class PersistentQueue {
|
|
|
73
72
|
...config
|
|
74
73
|
};
|
|
75
74
|
this.meta = this._loadMeta();
|
|
76
|
-
_internalLogger.logger.debug(`[PersistentQueue] Initialized: count=${this.meta.count}, ` + `bytes=${this.meta.totalBytes}, head=${this.meta.head}, tail=${this.meta.tail}`);
|
|
75
|
+
__DEV__ && _internalLogger.logger.debug(`[PersistentQueue] Initialized: count=${this.meta.count}, ` + `bytes=${this.meta.totalBytes}, head=${this.meta.head}, tail=${this.meta.tail}`);
|
|
77
76
|
}
|
|
78
77
|
|
|
79
78
|
// ─── Public API ─────────────────────────────────────────────────────
|
|
@@ -128,7 +127,7 @@ class PersistentQueue {
|
|
|
128
127
|
this.meta.totalBytes -= raw.length;
|
|
129
128
|
} else {
|
|
130
129
|
// Gap — entry was already evicted or corrupted
|
|
131
|
-
_internalLogger.logger.debug(`[PersistentQueue] Missing entry at seq=${seq}`);
|
|
130
|
+
__DEV__ && _internalLogger.logger.debug(`[PersistentQueue] Missing entry at seq=${seq}`);
|
|
132
131
|
}
|
|
133
132
|
}
|
|
134
133
|
this.meta.head += count;
|
|
@@ -199,7 +198,7 @@ class PersistentQueue {
|
|
|
199
198
|
*/
|
|
200
199
|
drainLeftovers() {
|
|
201
200
|
if (this.meta.count === 0) return [];
|
|
202
|
-
_internalLogger.logger.info(`[PersistentQueue] Draining ${this.meta.count} leftover envelopes ` + `from previous run (${this.meta.totalBytes} bytes)`);
|
|
201
|
+
__DEV__ && _internalLogger.logger.info(`[PersistentQueue] Draining ${this.meta.count} leftover envelopes ` + `from previous run (${this.meta.totalBytes} bytes)`);
|
|
203
202
|
|
|
204
203
|
// Pop everything
|
|
205
204
|
return this.popBatch(this.meta.count);
|
|
@@ -273,7 +272,7 @@ class PersistentQueue {
|
|
|
273
272
|
count: entryKeys.length,
|
|
274
273
|
totalBytes
|
|
275
274
|
};
|
|
276
|
-
_internalLogger.logger.info(`[PersistentQueue] Recovered metadata: ${meta.count} entries, ` + `head=${meta.head}, tail=${meta.tail}, bytes=${meta.totalBytes}`);
|
|
275
|
+
__DEV__ && _internalLogger.logger.info(`[PersistentQueue] Recovered metadata: ${meta.count} entries, ` + `head=${meta.head}, tail=${meta.tail}, bytes=${meta.totalBytes}`);
|
|
277
276
|
this.backend.set(META_KEY, JSON.stringify(meta));
|
|
278
277
|
return meta;
|
|
279
278
|
} catch {
|
|
@@ -337,37 +336,7 @@ class PersistentQueue {
|
|
|
337
336
|
}
|
|
338
337
|
}
|
|
339
338
|
|
|
340
|
-
//
|
|
341
|
-
|
|
342
|
-
/**
|
|
343
|
-
* Create a PersistentQueue with the best available backend.
|
|
344
|
-
*
|
|
345
|
-
* If persistence is disabled in config, uses MemoryBackend.
|
|
346
|
-
* Otherwise uses the shared first-party durable backend from createStorageBackend().
|
|
347
|
-
*
|
|
348
|
-
* @param config - Persistence config from SDK init
|
|
349
|
-
* @param backend - Override backend (for tests). If provided, skips auto-detection.
|
|
350
|
-
*/
|
|
339
|
+
// (A createPersistentQueue factory used to live here; every construction site builds
|
|
340
|
+
// PersistentQueue directly with an explicit backend, so the factory was verified dead and removed.)
|
|
351
341
|
exports.PersistentQueue = PersistentQueue;
|
|
352
|
-
function createPersistentQueue(config = {}, backend) {
|
|
353
|
-
if (backend) {
|
|
354
|
-
return new PersistentQueue(backend, config);
|
|
355
|
-
}
|
|
356
|
-
const mergedConfig = {
|
|
357
|
-
...DEFAULT_PERSISTENCE_CONFIG,
|
|
358
|
-
...config
|
|
359
|
-
};
|
|
360
|
-
if (!mergedConfig.enabled) {
|
|
361
|
-
_internalLogger.logger.info('[PersistentQueue] Persistence disabled — using in-memory queue');
|
|
362
|
-
const {
|
|
363
|
-
MemoryBackend
|
|
364
|
-
} = require('../../storage/StorageBackend');
|
|
365
|
-
return new PersistentQueue(new MemoryBackend(), mergedConfig);
|
|
366
|
-
}
|
|
367
|
-
const {
|
|
368
|
-
createStorageBackend
|
|
369
|
-
} = require('../../storage/StorageBackend');
|
|
370
|
-
const autoBackend = createStorageBackend();
|
|
371
|
-
return new PersistentQueue(autoBackend, mergedConfig);
|
|
372
|
-
}
|
|
373
342
|
//# sourceMappingURL=persistentQueue.js.map
|