@osdk/react-devtools 0.5.0
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 +79 -0
- package/build/esm/DevToolsContext.js +19 -0
- package/build/esm/DevToolsContext.js.map +1 -0
- package/build/esm/components/ActionMetrics.js +89 -0
- package/build/esm/components/ActionMetrics.js.map +1 -0
- package/build/esm/components/BubbleChart.js +175 -0
- package/build/esm/components/BubbleChart.js.map +1 -0
- package/build/esm/components/BubbleChart.module.scss.js +6 -0
- package/build/esm/components/CacheInspectorTab.js +291 -0
- package/build/esm/components/CacheInspectorTab.js.map +1 -0
- package/build/esm/components/CacheInspectorTab.module.scss.js +39 -0
- package/build/esm/components/CacheMetrics.js +55 -0
- package/build/esm/components/CacheMetrics.js.map +1 -0
- package/build/esm/components/ComponentCard.js +124 -0
- package/build/esm/components/ComponentCard.js.map +1 -0
- package/build/esm/components/ComponentCard.module.scss.js +31 -0
- package/build/esm/components/ComputeTab.js +175 -0
- package/build/esm/components/ComputeTab.js.map +1 -0
- package/build/esm/components/CopyableCodeBlock.js +49 -0
- package/build/esm/components/CopyableCodeBlock.js.map +1 -0
- package/build/esm/components/CopyableCodeBlock.module.scss.js +10 -0
- package/build/esm/components/DebuggingTab.js +342 -0
- package/build/esm/components/DebuggingTab.js.map +1 -0
- package/build/esm/components/DebuggingTab.module.scss.js +18 -0
- package/build/esm/components/HookRow.js +180 -0
- package/build/esm/components/HookRow.js.map +1 -0
- package/build/esm/components/HookRow.module.scss.js +16 -0
- package/build/esm/components/ImprovementsTab.js +138 -0
- package/build/esm/components/ImprovementsTab.js.map +1 -0
- package/build/esm/components/ImprovementsTab.module.scss.js +30 -0
- package/build/esm/components/InspectorSelectionHeader.js +65 -0
- package/build/esm/components/InspectorSelectionHeader.js.map +1 -0
- package/build/esm/components/InterceptTab.js +862 -0
- package/build/esm/components/InterceptTab.js.map +1 -0
- package/build/esm/components/InterceptTab.module.scss.js +49 -0
- package/build/esm/components/IssueCard.js +115 -0
- package/build/esm/components/IssueCard.js.map +1 -0
- package/build/esm/components/IssueCard.module.scss.js +24 -0
- package/build/esm/components/LogEntryCard.js +94 -0
- package/build/esm/components/LogEntryCard.js.map +1 -0
- package/build/esm/components/LogEntryCard.module.scss.js +19 -0
- package/build/esm/components/MockEditor.js +316 -0
- package/build/esm/components/MockEditor.js.map +1 -0
- package/build/esm/components/MonitorErrorBoundary.js +64 -0
- package/build/esm/components/MonitorErrorBoundary.js.map +1 -0
- package/build/esm/components/MonitorErrorBoundary.module.scss.js +9 -0
- package/build/esm/components/MonitoringPanel.js +434 -0
- package/build/esm/components/MonitoringPanel.js.map +1 -0
- package/build/esm/components/MonitoringPanel.module.scss.js +81 -0
- package/build/esm/components/ObjectLoadingMetrics.js +60 -0
- package/build/esm/components/ObjectLoadingMetrics.js.map +1 -0
- package/build/esm/components/OsdkAppErrorBoundary.js +68 -0
- package/build/esm/components/OsdkAppErrorBoundary.js.map +1 -0
- package/build/esm/components/OsdkDevTools.js +40 -0
- package/build/esm/components/OsdkDevTools.js.map +1 -0
- package/build/esm/components/OverrideEditor.js +197 -0
- package/build/esm/components/OverrideEditor.js.map +1 -0
- package/build/esm/components/PerformanceTab.js +297 -0
- package/build/esm/components/PerformanceTab.js.map +1 -0
- package/build/esm/components/PrimitiveSelectionPanel.js +220 -0
- package/build/esm/components/PrimitiveSelectionPanel.js.map +1 -0
- package/build/esm/components/PrimitiveSelectionPanel.module.scss.js +26 -0
- package/build/esm/components/issueTypes.js +2 -0
- package/build/esm/components/issueTypes.js.map +1 -0
- package/build/esm/components/resolveComponentName.js +57 -0
- package/build/esm/components/resolveComponentName.js.map +1 -0
- package/build/esm/components/testHelpers.js +312 -0
- package/build/esm/components/testHelpers.js.map +1 -0
- package/build/esm/css.d.ts +20 -0
- package/build/esm/fiber/DegradationNotice.js +193 -0
- package/build/esm/fiber/DegradationNotice.js.map +1 -0
- package/build/esm/fiber/DevtoolsHook.js +252 -0
- package/build/esm/fiber/DevtoolsHook.js.map +1 -0
- package/build/esm/fiber/FiberAccess.js +65 -0
- package/build/esm/fiber/FiberAccess.js.map +1 -0
- package/build/esm/fiber/FiberInspection.js +140 -0
- package/build/esm/fiber/FiberInspection.js.map +1 -0
- package/build/esm/fiber/FiberTags.js +52 -0
- package/build/esm/fiber/FiberTags.js.map +1 -0
- package/build/esm/fiber/HookStateInspector.js +254 -0
- package/build/esm/fiber/HookStateInspector.js.map +1 -0
- package/build/esm/fiber/SafeFiberOperation.js +35 -0
- package/build/esm/fiber/SafeFiberOperation.js.map +1 -0
- package/build/esm/fiber/capabilities.js +180 -0
- package/build/esm/fiber/capabilities.js.map +1 -0
- package/build/esm/fiber/traverseFiber.js +129 -0
- package/build/esm/fiber/traverseFiber.js.map +1 -0
- package/build/esm/fiber/types.js +2 -0
- package/build/esm/fiber/types.js.map +1 -0
- package/build/esm/fiber/validation.js +155 -0
- package/build/esm/fiber/validation.js.map +1 -0
- package/build/esm/hooks/createPollingStore.js +81 -0
- package/build/esm/hooks/createPollingStore.js.map +1 -0
- package/build/esm/hooks/useActiveComponents.js +27 -0
- package/build/esm/hooks/useActiveComponents.js.map +1 -0
- package/build/esm/hooks/useComponentRegistry.js +25 -0
- package/build/esm/hooks/useComponentRegistry.js.map +1 -0
- package/build/esm/hooks/useComputeSelectors.js +43 -0
- package/build/esm/hooks/useComputeSelectors.js.map +1 -0
- package/build/esm/hooks/useConsoleLogs.js +46 -0
- package/build/esm/hooks/useConsoleLogs.js.map +1 -0
- package/build/esm/hooks/useInspectorSelection.js +93 -0
- package/build/esm/hooks/useInspectorSelection.js.map +1 -0
- package/build/esm/hooks/useMetrics.js +23 -0
- package/build/esm/hooks/useMetrics.js.map +1 -0
- package/build/esm/hooks/usePersistedState.js +89 -0
- package/build/esm/hooks/usePersistedState.js.map +1 -0
- package/build/esm/hooks/useRecommendations.js +123 -0
- package/build/esm/hooks/useRecommendations.js.map +1 -0
- package/build/esm/hooks/useSharedTick.js +49 -0
- package/build/esm/hooks/useSharedTick.js.map +1 -0
- package/build/esm/hooks/useTimeElapsed.js +51 -0
- package/build/esm/hooks/useTimeElapsed.js.map +1 -0
- package/build/esm/hooks/useTrackerSubscription.js +97 -0
- package/build/esm/hooks/useTrackerSubscription.js.map +1 -0
- package/build/esm/hooks/useUnusedFieldAnalysis.js +99 -0
- package/build/esm/hooks/useUnusedFieldAnalysis.js.map +1 -0
- package/build/esm/index.js +31 -0
- package/build/esm/index.js.map +1 -0
- package/build/esm/inspector/ClickToInspectSystem.js +228 -0
- package/build/esm/inspector/ClickToInspectSystem.js.map +1 -0
- package/build/esm/inspector/components/ComponentLabel.js +175 -0
- package/build/esm/inspector/components/ComponentLabel.js.map +1 -0
- package/build/esm/inspector/components/ComponentLabel.module.scss.js +12 -0
- package/build/esm/inspector/components/InspectorBanner.js +79 -0
- package/build/esm/inspector/components/InspectorBanner.js.map +1 -0
- package/build/esm/inspector/components/InspectorOverlay.js +149 -0
- package/build/esm/inspector/components/InspectorOverlay.js.map +1 -0
- package/build/esm/inspector/components/SelectionHighlight.js +74 -0
- package/build/esm/inspector/components/SelectionHighlight.js.map +1 -0
- package/build/esm/inspector/createClickToInspect.js +21 -0
- package/build/esm/inspector/createClickToInspect.js.map +1 -0
- package/build/esm/inspector/hooks/useAnimatedBounds.js +167 -0
- package/build/esm/inspector/hooks/useAnimatedBounds.js.map +1 -0
- package/build/esm/inspector/index.js +40 -0
- package/build/esm/inspector/index.js.map +1 -0
- package/build/esm/inspector/inspectorController.js +328 -0
- package/build/esm/inspector/inspectorController.js.map +1 -0
- package/build/esm/inspector/types.js +2 -0
- package/build/esm/inspector/types.js.map +1 -0
- package/build/esm/inspector/utils/elementBounds.js +72 -0
- package/build/esm/inspector/utils/elementBounds.js.map +1 -0
- package/build/esm/inspector/utils/interpolation.js +26 -0
- package/build/esm/inspector/utils/interpolation.js.map +1 -0
- package/build/esm/inspector/utils/labelPositioning.js +62 -0
- package/build/esm/inspector/utils/labelPositioning.js.map +1 -0
- package/build/esm/mocking/MockCacheKeyGenerator.js +109 -0
- package/build/esm/mocking/MockCacheKeyGenerator.js.map +1 -0
- package/build/esm/mocking/MockManager.js +281 -0
- package/build/esm/mocking/MockManager.js.map +1 -0
- package/build/esm/prototyping/PrototypeOverrideStore.js +66 -0
- package/build/esm/prototyping/PrototypeOverrideStore.js.map +1 -0
- package/build/esm/prototyping/index.js +18 -0
- package/build/esm/prototyping/index.js.map +1 -0
- package/build/esm/public/vite.js +19 -0
- package/build/esm/public/vite.js.map +1 -0
- package/build/esm/register.js +41 -0
- package/build/esm/register.js.map +1 -0
- package/build/esm/scss.d.ts +20 -0
- package/build/esm/store/ComputeStore.js +269 -0
- package/build/esm/store/ComputeStore.js.map +1 -0
- package/build/esm/store/ConsoleLogStore.js +289 -0
- package/build/esm/store/ConsoleLogStore.js.map +1 -0
- package/build/esm/store/MetricsStore.js +428 -0
- package/build/esm/store/MetricsStore.js.map +1 -0
- package/build/esm/store/MonitorStore.js +288 -0
- package/build/esm/store/MonitorStore.js.map +1 -0
- package/build/esm/store/SubscribableStore.js +38 -0
- package/build/esm/store/SubscribableStore.js.map +1 -0
- package/build/esm/store/WindowErrorStore.js +195 -0
- package/build/esm/store/WindowErrorStore.js.map +1 -0
- package/build/esm/styles.css +19441 -0
- package/build/esm/styles.js +31 -0
- package/build/esm/styles.js.map +1 -0
- package/build/esm/types/compute.js +2 -0
- package/build/esm/types/compute.js.map +1 -0
- package/build/esm/types/emissions.js +2 -0
- package/build/esm/types/emissions.js.map +1 -0
- package/build/esm/types/index.js +23 -0
- package/build/esm/types/index.js.map +1 -0
- package/build/esm/utils/ActionLifecycleTracker.js +178 -0
- package/build/esm/utils/ActionLifecycleTracker.js.map +1 -0
- package/build/esm/utils/CacheEfficiencyAnalyzer.js +198 -0
- package/build/esm/utils/CacheEfficiencyAnalyzer.js.map +1 -0
- package/build/esm/utils/CircularBuffer.js +96 -0
- package/build/esm/utils/CircularBuffer.js.map +1 -0
- package/build/esm/utils/ComponentContextCapture.js +215 -0
- package/build/esm/utils/ComponentContextCapture.js.map +1 -0
- package/build/esm/utils/ComponentPrimitiveDiscovery.js +173 -0
- package/build/esm/utils/ComponentPrimitiveDiscovery.js.map +1 -0
- package/build/esm/utils/ComponentQueryRegistry.js +340 -0
- package/build/esm/utils/ComponentQueryRegistry.js.map +1 -0
- package/build/esm/utils/ComputeMonitor.js +199 -0
- package/build/esm/utils/ComputeMonitor.js.map +1 -0
- package/build/esm/utils/EventTimeline.js +130 -0
- package/build/esm/utils/EventTimeline.js.map +1 -0
- package/build/esm/utils/LinkTraversalTracker.js +116 -0
- package/build/esm/utils/LinkTraversalTracker.js.map +1 -0
- package/build/esm/utils/MockDataGenerator.js +473 -0
- package/build/esm/utils/MockDataGenerator.js.map +1 -0
- package/build/esm/utils/ObservableClientMonitor.js +768 -0
- package/build/esm/utils/ObservableClientMonitor.js.map +1 -0
- package/build/esm/utils/PerformanceRecommendationEngine.js +185 -0
- package/build/esm/utils/PerformanceRecommendationEngine.js.map +1 -0
- package/build/esm/utils/PropertyAccessTracker.js +238 -0
- package/build/esm/utils/PropertyAccessTracker.js.map +1 -0
- package/build/esm/utils/RecommendationMatcher.js +53 -0
- package/build/esm/utils/RecommendationMatcher.js.map +1 -0
- package/build/esm/utils/SubscriptionTracker.js +132 -0
- package/build/esm/utils/SubscriptionTracker.js.map +1 -0
- package/build/esm/utils/UnusedFieldAnalyzer.js +186 -0
- package/build/esm/utils/UnusedFieldAnalyzer.js.map +1 -0
- package/build/esm/utils/WaterfallDetector.js +200 -0
- package/build/esm/utils/WaterfallDetector.js.map +1 -0
- package/build/esm/utils/computePayload.js +37 -0
- package/build/esm/utils/computePayload.js.map +1 -0
- package/build/esm/utils/computeRequest.js +29 -0
- package/build/esm/utils/computeRequest.js.map +1 -0
- package/build/esm/utils/format.js +69 -0
- package/build/esm/utils/format.js.map +1 -0
- package/build/esm/utils/logger.js +31 -0
- package/build/esm/utils/logger.js.map +1 -0
- package/build/esm/vite/constants.js +18 -0
- package/build/esm/vite/constants.js.map +1 -0
- package/build/esm/vite/hookInstaller.js +99 -0
- package/build/esm/vite/hookInstaller.js.map +1 -0
- package/build/esm/vite/index.js +77 -0
- package/build/esm/vite/index.js.map +1 -0
- package/build/types/DevToolsContext.d.ts +3 -0
- package/build/types/DevToolsContext.d.ts.map +1 -0
- package/build/types/components/ActionMetrics.d.ts +6 -0
- package/build/types/components/ActionMetrics.d.ts.map +1 -0
- package/build/types/components/BubbleChart.d.ts +10 -0
- package/build/types/components/BubbleChart.d.ts.map +1 -0
- package/build/types/components/CacheInspectorTab.d.ts +6 -0
- package/build/types/components/CacheInspectorTab.d.ts.map +1 -0
- package/build/types/components/CacheMetrics.d.ts +6 -0
- package/build/types/components/CacheMetrics.d.ts.map +1 -0
- package/build/types/components/ComponentCard.d.ts +13 -0
- package/build/types/components/ComponentCard.d.ts.map +1 -0
- package/build/types/components/ComputeTab.d.ts +6 -0
- package/build/types/components/ComputeTab.d.ts.map +1 -0
- package/build/types/components/CopyableCodeBlock.d.ts +7 -0
- package/build/types/components/CopyableCodeBlock.d.ts.map +1 -0
- package/build/types/components/DebuggingTab.d.ts +6 -0
- package/build/types/components/DebuggingTab.d.ts.map +1 -0
- package/build/types/components/HookRow.d.ts +9 -0
- package/build/types/components/HookRow.d.ts.map +1 -0
- package/build/types/components/ImprovementsTab.d.ts +7 -0
- package/build/types/components/ImprovementsTab.d.ts.map +1 -0
- package/build/types/components/InspectorSelectionHeader.d.ts +12 -0
- package/build/types/components/InspectorSelectionHeader.d.ts.map +1 -0
- package/build/types/components/InterceptTab.d.ts +126 -0
- package/build/types/components/InterceptTab.d.ts.map +1 -0
- package/build/types/components/IssueCard.d.ts +8 -0
- package/build/types/components/IssueCard.d.ts.map +1 -0
- package/build/types/components/LogEntryCard.d.ts +7 -0
- package/build/types/components/LogEntryCard.d.ts.map +1 -0
- package/build/types/components/MockEditor.d.ts +58 -0
- package/build/types/components/MockEditor.d.ts.map +1 -0
- package/build/types/components/MonitorErrorBoundary.d.ts +16 -0
- package/build/types/components/MonitorErrorBoundary.d.ts.map +1 -0
- package/build/types/components/MonitoringPanel.d.ts +8 -0
- package/build/types/components/MonitoringPanel.d.ts.map +1 -0
- package/build/types/components/ObjectLoadingMetrics.d.ts +7 -0
- package/build/types/components/ObjectLoadingMetrics.d.ts.map +1 -0
- package/build/types/components/OsdkAppErrorBoundary.d.ts +18 -0
- package/build/types/components/OsdkAppErrorBoundary.d.ts.map +1 -0
- package/build/types/components/OsdkDevTools.d.ts +2 -0
- package/build/types/components/OsdkDevTools.d.ts.map +1 -0
- package/build/types/components/OverrideEditor.d.ts +26 -0
- package/build/types/components/OverrideEditor.d.ts.map +1 -0
- package/build/types/components/PerformanceTab.d.ts +8 -0
- package/build/types/components/PerformanceTab.d.ts.map +1 -0
- package/build/types/components/PrimitiveSelectionPanel.d.ts +28 -0
- package/build/types/components/PrimitiveSelectionPanel.d.ts.map +1 -0
- package/build/types/components/issueTypes.d.ts +16 -0
- package/build/types/components/issueTypes.d.ts.map +1 -0
- package/build/types/components/resolveComponentName.d.ts +3 -0
- package/build/types/components/resolveComponentName.d.ts.map +1 -0
- package/build/types/components/testHelpers.d.ts +2 -0
- package/build/types/components/testHelpers.d.ts.map +1 -0
- package/build/types/css.d.d.ts +4 -0
- package/build/types/css.d.d.ts.map +1 -0
- package/build/types/fiber/DegradationNotice.d.ts +8 -0
- package/build/types/fiber/DegradationNotice.d.ts.map +1 -0
- package/build/types/fiber/DevtoolsHook.d.ts +7 -0
- package/build/types/fiber/DevtoolsHook.d.ts.map +1 -0
- package/build/types/fiber/FiberAccess.d.ts +2 -0
- package/build/types/fiber/FiberAccess.d.ts.map +1 -0
- package/build/types/fiber/FiberInspection.d.ts +6 -0
- package/build/types/fiber/FiberInspection.d.ts.map +1 -0
- package/build/types/fiber/FiberTags.d.ts +33 -0
- package/build/types/fiber/FiberTags.d.ts.map +1 -0
- package/build/types/fiber/HookStateInspector.d.ts +45 -0
- package/build/types/fiber/HookStateInspector.d.ts.map +1 -0
- package/build/types/fiber/SafeFiberOperation.d.ts +7 -0
- package/build/types/fiber/SafeFiberOperation.d.ts.map +1 -0
- package/build/types/fiber/capabilities.d.ts +38 -0
- package/build/types/fiber/capabilities.d.ts.map +1 -0
- package/build/types/fiber/traverseFiber.d.ts +5 -0
- package/build/types/fiber/traverseFiber.d.ts.map +1 -0
- package/build/types/fiber/types.d.ts +87 -0
- package/build/types/fiber/types.d.ts.map +1 -0
- package/build/types/fiber/validation.d.ts +10 -0
- package/build/types/fiber/validation.d.ts.map +1 -0
- package/build/types/hooks/createPollingStore.d.ts +5 -0
- package/build/types/hooks/createPollingStore.d.ts.map +1 -0
- package/build/types/hooks/useActiveComponents.d.ts +3 -0
- package/build/types/hooks/useActiveComponents.d.ts.map +1 -0
- package/build/types/hooks/useComponentRegistry.d.ts +3 -0
- package/build/types/hooks/useComponentRegistry.d.ts.map +1 -0
- package/build/types/hooks/useComputeSelectors.d.ts +7 -0
- package/build/types/hooks/useComputeSelectors.d.ts.map +1 -0
- package/build/types/hooks/useConsoleLogs.d.ts +7 -0
- package/build/types/hooks/useConsoleLogs.d.ts.map +1 -0
- package/build/types/hooks/useInspectorSelection.d.ts +9 -0
- package/build/types/hooks/useInspectorSelection.d.ts.map +1 -0
- package/build/types/hooks/useMetrics.d.ts +3 -0
- package/build/types/hooks/useMetrics.d.ts.map +1 -0
- package/build/types/hooks/usePersistedState.d.ts +1 -0
- package/build/types/hooks/usePersistedState.d.ts.map +1 -0
- package/build/types/hooks/useRecommendations.d.ts +10 -0
- package/build/types/hooks/useRecommendations.d.ts.map +1 -0
- package/build/types/hooks/useSharedTick.d.ts +1 -0
- package/build/types/hooks/useSharedTick.d.ts.map +1 -0
- package/build/types/hooks/useTimeElapsed.d.ts +1 -0
- package/build/types/hooks/useTimeElapsed.d.ts.map +1 -0
- package/build/types/hooks/useTrackerSubscription.d.ts +16 -0
- package/build/types/hooks/useTrackerSubscription.d.ts.map +1 -0
- package/build/types/hooks/useUnusedFieldAnalysis.d.ts +8 -0
- package/build/types/hooks/useUnusedFieldAnalysis.d.ts.map +1 -0
- package/build/types/index.d.ts +21 -0
- package/build/types/index.d.ts.map +1 -0
- package/build/types/inspector/ClickToInspectSystem.d.ts +40 -0
- package/build/types/inspector/ClickToInspectSystem.d.ts.map +1 -0
- package/build/types/inspector/components/ComponentLabel.d.ts +3 -0
- package/build/types/inspector/components/ComponentLabel.d.ts.map +1 -0
- package/build/types/inspector/components/InspectorBanner.d.ts +5 -0
- package/build/types/inspector/components/InspectorBanner.d.ts.map +1 -0
- package/build/types/inspector/components/InspectorOverlay.d.ts +3 -0
- package/build/types/inspector/components/InspectorOverlay.d.ts.map +1 -0
- package/build/types/inspector/components/SelectionHighlight.d.ts +3 -0
- package/build/types/inspector/components/SelectionHighlight.d.ts.map +1 -0
- package/build/types/inspector/createClickToInspect.d.ts +3 -0
- package/build/types/inspector/createClickToInspect.d.ts.map +1 -0
- package/build/types/inspector/hooks/useAnimatedBounds.d.ts +2 -0
- package/build/types/inspector/hooks/useAnimatedBounds.d.ts.map +1 -0
- package/build/types/inspector/index.d.ts +13 -0
- package/build/types/inspector/index.d.ts.map +1 -0
- package/build/types/inspector/inspectorController.d.ts +2 -0
- package/build/types/inspector/inspectorController.d.ts.map +1 -0
- package/build/types/inspector/types.d.ts +94 -0
- package/build/types/inspector/types.d.ts.map +1 -0
- package/build/types/inspector/utils/elementBounds.d.ts +3 -0
- package/build/types/inspector/utils/elementBounds.d.ts.map +1 -0
- package/build/types/inspector/utils/interpolation.d.ts +7 -0
- package/build/types/inspector/utils/interpolation.d.ts.map +1 -0
- package/build/types/inspector/utils/labelPositioning.d.ts +3 -0
- package/build/types/inspector/utils/labelPositioning.d.ts.map +1 -0
- package/build/types/mocking/MockCacheKeyGenerator.d.ts +41 -0
- package/build/types/mocking/MockCacheKeyGenerator.d.ts.map +1 -0
- package/build/types/mocking/MockManager.d.ts +103 -0
- package/build/types/mocking/MockManager.d.ts.map +1 -0
- package/build/types/prototyping/PrototypeOverrideStore.d.ts +33 -0
- package/build/types/prototyping/PrototypeOverrideStore.d.ts.map +1 -0
- package/build/types/prototyping/index.d.ts +1 -0
- package/build/types/prototyping/index.d.ts.map +1 -0
- package/build/types/public/vite.d.ts +2 -0
- package/build/types/public/vite.d.ts.map +1 -0
- package/build/types/register.d.ts +1 -0
- package/build/types/register.d.ts.map +1 -0
- package/build/types/scss.d.d.ts +6 -0
- package/build/types/scss.d.d.ts.map +1 -0
- package/build/types/store/ComputeStore.d.ts +47 -0
- package/build/types/store/ComputeStore.d.ts.map +1 -0
- package/build/types/store/ConsoleLogStore.d.ts +29 -0
- package/build/types/store/ConsoleLogStore.d.ts.map +1 -0
- package/build/types/store/MetricsStore.d.ts +42 -0
- package/build/types/store/MetricsStore.d.ts.map +1 -0
- package/build/types/store/MonitorStore.d.ts +86 -0
- package/build/types/store/MonitorStore.d.ts.map +1 -0
- package/build/types/store/SubscribableStore.d.ts +6 -0
- package/build/types/store/SubscribableStore.d.ts.map +1 -0
- package/build/types/store/WindowErrorStore.d.ts +32 -0
- package/build/types/store/WindowErrorStore.d.ts.map +1 -0
- package/build/types/styles.d.ts +1 -0
- package/build/types/styles.d.ts.map +1 -0
- package/build/types/types/compute.d.ts +73 -0
- package/build/types/types/compute.d.ts.map +1 -0
- package/build/types/types/emissions.d.ts +24 -0
- package/build/types/types/emissions.d.ts.map +1 -0
- package/build/types/types/index.d.ts +143 -0
- package/build/types/types/index.d.ts.map +1 -0
- package/build/types/utils/ActionLifecycleTracker.d.ts +39 -0
- package/build/types/utils/ActionLifecycleTracker.d.ts.map +1 -0
- package/build/types/utils/CacheEfficiencyAnalyzer.d.ts +45 -0
- package/build/types/utils/CacheEfficiencyAnalyzer.d.ts.map +1 -0
- package/build/types/utils/CircularBuffer.d.ts +18 -0
- package/build/types/utils/CircularBuffer.d.ts.map +1 -0
- package/build/types/utils/ComponentContextCapture.d.ts +29 -0
- package/build/types/utils/ComponentContextCapture.d.ts.map +1 -0
- package/build/types/utils/ComponentPrimitiveDiscovery.d.ts +62 -0
- package/build/types/utils/ComponentPrimitiveDiscovery.d.ts.map +1 -0
- package/build/types/utils/ComponentQueryRegistry.d.ts +91 -0
- package/build/types/utils/ComponentQueryRegistry.d.ts.map +1 -0
- package/build/types/utils/ComputeMonitor.d.ts +14 -0
- package/build/types/utils/ComputeMonitor.d.ts.map +1 -0
- package/build/types/utils/EventTimeline.d.ts +102 -0
- package/build/types/utils/EventTimeline.d.ts.map +1 -0
- package/build/types/utils/LinkTraversalTracker.d.ts +43 -0
- package/build/types/utils/LinkTraversalTracker.d.ts.map +1 -0
- package/build/types/utils/MockDataGenerator.d.ts +23 -0
- package/build/types/utils/MockDataGenerator.d.ts.map +1 -0
- package/build/types/utils/ObservableClientMonitor.d.ts +62 -0
- package/build/types/utils/ObservableClientMonitor.d.ts.map +1 -0
- package/build/types/utils/PerformanceRecommendationEngine.d.ts +67 -0
- package/build/types/utils/PerformanceRecommendationEngine.d.ts.map +1 -0
- package/build/types/utils/PropertyAccessTracker.d.ts +50 -0
- package/build/types/utils/PropertyAccessTracker.d.ts.map +1 -0
- package/build/types/utils/RecommendationMatcher.d.ts +5 -0
- package/build/types/utils/RecommendationMatcher.d.ts.map +1 -0
- package/build/types/utils/SubscriptionTracker.d.ts +17 -0
- package/build/types/utils/SubscriptionTracker.d.ts.map +1 -0
- package/build/types/utils/UnusedFieldAnalyzer.d.ts +46 -0
- package/build/types/utils/UnusedFieldAnalyzer.d.ts.map +1 -0
- package/build/types/utils/WaterfallDetector.d.ts +28 -0
- package/build/types/utils/WaterfallDetector.d.ts.map +1 -0
- package/build/types/utils/computePayload.d.ts +3 -0
- package/build/types/utils/computePayload.d.ts.map +1 -0
- package/build/types/utils/computeRequest.d.ts +20 -0
- package/build/types/utils/computeRequest.d.ts.map +1 -0
- package/build/types/utils/format.d.ts +5 -0
- package/build/types/utils/format.d.ts.map +1 -0
- package/build/types/utils/logger.d.ts +2 -0
- package/build/types/utils/logger.d.ts.map +1 -0
- package/build/types/vite/constants.d.ts +1 -0
- package/build/types/vite/constants.d.ts.map +1 -0
- package/build/types/vite/hookInstaller.d.ts +1 -0
- package/build/types/vite/hookInstaller.d.ts.map +1 -0
- package/build/types/vite/index.d.ts +20 -0
- package/build/types/vite/index.d.ts.map +1 -0
- package/package.json +114 -0
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { FIBER_TAG } from "./FiberTags.js";
|
|
18
|
+
import { safeFiberOperation } from "./SafeFiberOperation.js";
|
|
19
|
+
export function getComponentName(fiber) {
|
|
20
|
+
return safeFiberOperation(() => getComponentNameUnsafe(fiber), {
|
|
21
|
+
fallback: "Unknown",
|
|
22
|
+
feature: "component-inspection"
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
function getComponentNameUnsafe(fiber) {
|
|
26
|
+
const {
|
|
27
|
+
type,
|
|
28
|
+
tag
|
|
29
|
+
} = fiber;
|
|
30
|
+
if (tag === FIBER_TAG.HOST_ELEMENT) {
|
|
31
|
+
return typeof type === "string" ? type : "Element";
|
|
32
|
+
}
|
|
33
|
+
if (tag === FIBER_TAG.HOST_TEXT) {
|
|
34
|
+
return "#text";
|
|
35
|
+
}
|
|
36
|
+
if (tag === FIBER_TAG.HOST_ROOT) {
|
|
37
|
+
return "#root";
|
|
38
|
+
}
|
|
39
|
+
if (tag === FIBER_TAG.FRAGMENT) {
|
|
40
|
+
return "Fragment";
|
|
41
|
+
}
|
|
42
|
+
if (tag === FIBER_TAG.SUSPENSE) {
|
|
43
|
+
return "Suspense";
|
|
44
|
+
}
|
|
45
|
+
if (typeof type === "function") {
|
|
46
|
+
return type.displayName || type.name || "Anonymous";
|
|
47
|
+
}
|
|
48
|
+
if (type && typeof type === "object") {
|
|
49
|
+
if ("type" in type && typeof type.type === "function") {
|
|
50
|
+
const innerType = type.type;
|
|
51
|
+
return innerType.displayName || innerType.name || "Memo";
|
|
52
|
+
}
|
|
53
|
+
if ("render" in type && typeof type.render === "function") {
|
|
54
|
+
const render = type.render;
|
|
55
|
+
return render.displayName || render.name || "ForwardRef";
|
|
56
|
+
}
|
|
57
|
+
if ("displayName" in type && typeof type.displayName === "string") {
|
|
58
|
+
return type.displayName;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
if (tag === FIBER_TAG.CONTEXT_PROVIDER) {
|
|
62
|
+
const context = type?._context;
|
|
63
|
+
if (context?.displayName) {
|
|
64
|
+
return `${context.displayName}.Provider`;
|
|
65
|
+
}
|
|
66
|
+
return "Context.Provider";
|
|
67
|
+
}
|
|
68
|
+
if (tag === FIBER_TAG.CONTEXT_CONSUMER) {
|
|
69
|
+
const context = type?._context ?? type;
|
|
70
|
+
if (context?.displayName) {
|
|
71
|
+
return `${context.displayName}.Consumer`;
|
|
72
|
+
}
|
|
73
|
+
return "Context.Consumer";
|
|
74
|
+
}
|
|
75
|
+
return "Unknown";
|
|
76
|
+
}
|
|
77
|
+
export function getComponentId(fiber) {
|
|
78
|
+
return safeFiberOperation(() => {
|
|
79
|
+
const debugId = fiber._debugID;
|
|
80
|
+
if (typeof debugId === "number") {
|
|
81
|
+
return `fiber-debug-${debugId}`;
|
|
82
|
+
}
|
|
83
|
+
if (fiber._debugSource) {
|
|
84
|
+
const name = getComponentNameUnsafe(fiber);
|
|
85
|
+
const {
|
|
86
|
+
fileName,
|
|
87
|
+
lineNumber
|
|
88
|
+
} = fiber._debugSource;
|
|
89
|
+
const shortPath = fileName?.split("/").slice(-2).join("/") || "unknown";
|
|
90
|
+
return `fiber-${name}-${shortPath}-${lineNumber || 0}`;
|
|
91
|
+
}
|
|
92
|
+
const name = getComponentNameUnsafe(fiber);
|
|
93
|
+
const typeHash = typeof fiber.type === "function" ? fiber.type.toString().length : 0;
|
|
94
|
+
return `fiber-${name}-${typeHash}`;
|
|
95
|
+
}, {
|
|
96
|
+
fallback: `fiber-unknown-${Date.now()}`,
|
|
97
|
+
feature: "component-inspection"
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
export function getSourceLocation(fiber) {
|
|
101
|
+
return safeFiberOperation(() => {
|
|
102
|
+
if (fiber._debugSource) {
|
|
103
|
+
return {
|
|
104
|
+
fileName: fiber._debugSource.fileName,
|
|
105
|
+
lineNumber: fiber._debugSource.lineNumber,
|
|
106
|
+
columnNumber: fiber._debugSource.columnNumber
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
return null;
|
|
110
|
+
}, {
|
|
111
|
+
fallback: null,
|
|
112
|
+
feature: "component-inspection"
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
export function getProps(fiber) {
|
|
116
|
+
return safeFiberOperation(() => {
|
|
117
|
+
if (fiber.memoizedProps && typeof fiber.memoizedProps === "object") {
|
|
118
|
+
return fiber.memoizedProps;
|
|
119
|
+
}
|
|
120
|
+
return {};
|
|
121
|
+
}, {
|
|
122
|
+
fallback: {},
|
|
123
|
+
feature: "component-inspection"
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
export function getHookStates(fiber) {
|
|
127
|
+
return safeFiberOperation(() => {
|
|
128
|
+
const states = [];
|
|
129
|
+
let current = fiber.memoizedState;
|
|
130
|
+
while (current) {
|
|
131
|
+
states.push(current.memoizedState);
|
|
132
|
+
current = current.next;
|
|
133
|
+
}
|
|
134
|
+
return states;
|
|
135
|
+
}, {
|
|
136
|
+
fallback: [],
|
|
137
|
+
feature: "state-inspection"
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
//# sourceMappingURL=FiberInspection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FiberInspection.js","names":["FIBER_TAG","safeFiberOperation","getComponentName","fiber","getComponentNameUnsafe","fallback","feature","type","tag","HOST_ELEMENT","HOST_TEXT","HOST_ROOT","FRAGMENT","SUSPENSE","displayName","name","innerType","render","CONTEXT_PROVIDER","context","_context","CONTEXT_CONSUMER","getComponentId","debugId","_debugID","_debugSource","fileName","lineNumber","shortPath","split","slice","join","typeHash","toString","length","Date","now","getSourceLocation","columnNumber","getProps","memoizedProps","getHookStates","states","current","memoizedState","push","next"],"sources":["FiberInspection.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { FIBER_TAG } from \"./FiberTags.js\";\nimport { safeFiberOperation } from \"./SafeFiberOperation.js\";\nimport type { Fiber, SourceLocation } from \"./types.js\";\n\nexport function getComponentName(fiber: Fiber): string {\n return safeFiberOperation(\n () => getComponentNameUnsafe(fiber),\n { fallback: \"Unknown\", feature: \"component-inspection\" },\n );\n}\n\nfunction getComponentNameUnsafe(fiber: Fiber): string {\n const { type, tag } = fiber;\n\n if (tag === FIBER_TAG.HOST_ELEMENT) {\n return typeof type === \"string\" ? type : \"Element\";\n }\n\n if (tag === FIBER_TAG.HOST_TEXT) {\n return \"#text\";\n }\n\n if (tag === FIBER_TAG.HOST_ROOT) {\n return \"#root\";\n }\n\n if (tag === FIBER_TAG.FRAGMENT) {\n return \"Fragment\";\n }\n\n if (tag === FIBER_TAG.SUSPENSE) {\n return \"Suspense\";\n }\n\n if (typeof type === \"function\") {\n return type.displayName || type.name || \"Anonymous\";\n }\n\n if (type && typeof type === \"object\") {\n if (\"type\" in type && typeof type.type === \"function\") {\n const innerType = type.type as { displayName?: string; name?: string };\n return innerType.displayName || innerType.name || \"Memo\";\n }\n\n if (\"render\" in type && typeof type.render === \"function\") {\n const render = type.render as { displayName?: string; name?: string };\n return render.displayName || render.name || \"ForwardRef\";\n }\n\n if (\"displayName\" in type && typeof type.displayName === \"string\") {\n return type.displayName;\n }\n }\n\n if (tag === FIBER_TAG.CONTEXT_PROVIDER) {\n const context = type?._context;\n if (context?.displayName) {\n return `${context.displayName}.Provider`;\n }\n return \"Context.Provider\";\n }\n\n if (tag === FIBER_TAG.CONTEXT_CONSUMER) {\n const context = type?._context ?? type;\n if (context?.displayName) {\n return `${context.displayName}.Consumer`;\n }\n return \"Context.Consumer\";\n }\n\n return \"Unknown\";\n}\n\nexport function getComponentId(fiber: Fiber): string {\n return safeFiberOperation(\n () => {\n const debugId = (fiber as Record<string, unknown>)._debugID;\n if (typeof debugId === \"number\") {\n return `fiber-debug-${debugId}`;\n }\n\n if (fiber._debugSource) {\n const name = getComponentNameUnsafe(fiber);\n const { fileName, lineNumber } = fiber._debugSource;\n const shortPath = fileName?.split(\"/\").slice(-2).join(\"/\") || \"unknown\";\n return `fiber-${name}-${shortPath}-${lineNumber || 0}`;\n }\n\n const name = getComponentNameUnsafe(fiber);\n const typeHash = typeof fiber.type === \"function\"\n ? fiber.type.toString().length\n : 0;\n return `fiber-${name}-${typeHash}`;\n },\n {\n fallback: `fiber-unknown-${Date.now()}`,\n feature: \"component-inspection\",\n },\n );\n}\n\nexport function getSourceLocation(fiber: Fiber): SourceLocation | null {\n return safeFiberOperation(\n () => {\n if (fiber._debugSource) {\n return {\n fileName: fiber._debugSource.fileName,\n lineNumber: fiber._debugSource.lineNumber,\n columnNumber: fiber._debugSource.columnNumber,\n };\n }\n return null;\n },\n { fallback: null, feature: \"component-inspection\" },\n );\n}\n\nexport function getProps(fiber: Fiber): Record<string, unknown> {\n return safeFiberOperation(\n () => {\n if (fiber.memoizedProps && typeof fiber.memoizedProps === \"object\") {\n return fiber.memoizedProps as Record<string, unknown>;\n }\n return {};\n },\n { fallback: {}, feature: \"component-inspection\" },\n );\n}\n\nexport function getHookStates(fiber: Fiber): unknown[] {\n return safeFiberOperation(\n () => {\n const states: unknown[] = [];\n let current = fiber.memoizedState;\n\n while (current) {\n states.push(current.memoizedState);\n current = current.next;\n }\n\n return states;\n },\n { fallback: [], feature: \"state-inspection\" },\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,SAAS,QAAQ,gBAAgB;AAC1C,SAASC,kBAAkB,QAAQ,yBAAyB;AAG5D,OAAO,SAASC,gBAAgBA,CAACC,KAAY,EAAU;EACrD,OAAOF,kBAAkB,CACvB,MAAMG,sBAAsB,CAACD,KAAK,CAAC,EACnC;IAAEE,QAAQ,EAAE,SAAS;IAAEC,OAAO,EAAE;EAAuB,CACzD,CAAC;AACH;AAEA,SAASF,sBAAsBA,CAACD,KAAY,EAAU;EACpD,MAAM;IAAEI,IAAI;IAAEC;EAAI,CAAC,GAAGL,KAAK;EAE3B,IAAIK,GAAG,KAAKR,SAAS,CAACS,YAAY,EAAE;IAClC,OAAO,OAAOF,IAAI,KAAK,QAAQ,GAAGA,IAAI,GAAG,SAAS;EACpD;EAEA,IAAIC,GAAG,KAAKR,SAAS,CAACU,SAAS,EAAE;IAC/B,OAAO,OAAO;EAChB;EAEA,IAAIF,GAAG,KAAKR,SAAS,CAACW,SAAS,EAAE;IAC/B,OAAO,OAAO;EAChB;EAEA,IAAIH,GAAG,KAAKR,SAAS,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;QACrCC,UAAU,EAAExB,KAAK,CAACsB,YAAY,CAACE,UAAU;QACzCW,YAAY,EAAEnC,KAAK,CAACsB,YAAY,CAACa;MACnC,CAAC;IACH;IACA,OAAO,IAAI;EACb,CAAC,EACD;IAAEjC,QAAQ,EAAE,IAAI;IAAEC,OAAO,EAAE;EAAuB,CACpD,CAAC;AACH;AAEA,OAAO,SAASiC,QAAQA,CAACpC,KAAY,EAA2B;EAC9D,OAAOF,kBAAkB,CACvB,MAAM;IACJ,IAAIE,KAAK,CAACqC,aAAa,IAAI,OAAOrC,KAAK,CAACqC,aAAa,KAAK,QAAQ,EAAE;MAClE,OAAOrC,KAAK,CAACqC,aAAa;IAC5B;IACA,OAAO,CAAC,CAAC;EACX,CAAC,EACD;IAAEnC,QAAQ,EAAE,CAAC,CAAC;IAAEC,OAAO,EAAE;EAAuB,CAClD,CAAC;AACH;AAEA,OAAO,SAASmC,aAAaA,CAACtC,KAAY,EAAa;EACrD,OAAOF,kBAAkB,CACvB,MAAM;IACJ,MAAMyC,MAAiB,GAAG,EAAE;IAC5B,IAAIC,OAAO,GAAGxC,KAAK,CAACyC,aAAa;IAEjC,OAAOD,OAAO,EAAE;MACdD,MAAM,CAACG,IAAI,CAACF,OAAO,CAACC,aAAa,CAAC;MAClCD,OAAO,GAAGA,OAAO,CAACG,IAAI;IACxB;IAEA,OAAOJ,MAAM;EACf,CAAC,EACD;IAAErC,QAAQ,EAAE,EAAE;IAAEC,OAAO,EAAE;EAAmB,CAC9C,CAAC;AACH","ignoreList":[]}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
export const FIBER_TAG = {
|
|
18
|
+
FUNCTION_COMPONENT: 0,
|
|
19
|
+
CLASS_COMPONENT: 1,
|
|
20
|
+
INDETERMINATE_COMPONENT: 2,
|
|
21
|
+
HOST_ROOT: 3,
|
|
22
|
+
HOST_PORTAL: 4,
|
|
23
|
+
HOST_ELEMENT: 5,
|
|
24
|
+
HOST_TEXT: 6,
|
|
25
|
+
FRAGMENT: 7,
|
|
26
|
+
MODE: 8,
|
|
27
|
+
CONTEXT_CONSUMER: 9,
|
|
28
|
+
CONTEXT_PROVIDER: 10,
|
|
29
|
+
FORWARD_REF: 11,
|
|
30
|
+
PROFILER: 12,
|
|
31
|
+
SUSPENSE: 13,
|
|
32
|
+
MEMO: 14,
|
|
33
|
+
SIMPLE_MEMO: 15,
|
|
34
|
+
LAZY: 16,
|
|
35
|
+
INCOMPLETE_CLASS: 17,
|
|
36
|
+
DEHYDRATED_FRAGMENT: 18,
|
|
37
|
+
SUSPENSE_LIST: 19,
|
|
38
|
+
SCOPE: 21,
|
|
39
|
+
OFFSCREEN: 22,
|
|
40
|
+
LEGACY_HIDDEN: 23,
|
|
41
|
+
CACHE: 24,
|
|
42
|
+
TRACING_MARKER: 25,
|
|
43
|
+
HOST_HOISTABLE: 26,
|
|
44
|
+
HOST_SINGLETON: 27,
|
|
45
|
+
ACTIVITY: 28,
|
|
46
|
+
VIEW_TRANSITION: 30
|
|
47
|
+
};
|
|
48
|
+
export function isUserComponent(fiber) {
|
|
49
|
+
const tag = fiber.tag;
|
|
50
|
+
return tag === FIBER_TAG.FUNCTION_COMPONENT || tag === FIBER_TAG.CLASS_COMPONENT || tag === FIBER_TAG.FORWARD_REF || tag === FIBER_TAG.MEMO || tag === FIBER_TAG.SIMPLE_MEMO || tag === FIBER_TAG.LAZY;
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=FiberTags.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FiberTags.js","names":["FIBER_TAG","FUNCTION_COMPONENT","CLASS_COMPONENT","INDETERMINATE_COMPONENT","HOST_ROOT","HOST_PORTAL","HOST_ELEMENT","HOST_TEXT","FRAGMENT","MODE","CONTEXT_CONSUMER","CONTEXT_PROVIDER","FORWARD_REF","PROFILER","SUSPENSE","MEMO","SIMPLE_MEMO","LAZY","INCOMPLETE_CLASS","DEHYDRATED_FRAGMENT","SUSPENSE_LIST","SCOPE","OFFSCREEN","LEGACY_HIDDEN","CACHE","TRACING_MARKER","HOST_HOISTABLE","HOST_SINGLETON","ACTIVITY","VIEW_TRANSITION","isUserComponent","fiber","tag"],"sources":["FiberTags.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { Fiber } from \"./types.js\";\n\nexport const FIBER_TAG = {\n FUNCTION_COMPONENT: 0,\n CLASS_COMPONENT: 1,\n INDETERMINATE_COMPONENT: 2,\n HOST_ROOT: 3,\n HOST_PORTAL: 4,\n HOST_ELEMENT: 5,\n HOST_TEXT: 6,\n FRAGMENT: 7,\n MODE: 8,\n CONTEXT_CONSUMER: 9,\n CONTEXT_PROVIDER: 10,\n FORWARD_REF: 11,\n PROFILER: 12,\n SUSPENSE: 13,\n MEMO: 14,\n SIMPLE_MEMO: 15,\n LAZY: 16,\n INCOMPLETE_CLASS: 17,\n DEHYDRATED_FRAGMENT: 18,\n SUSPENSE_LIST: 19,\n SCOPE: 21,\n OFFSCREEN: 22,\n LEGACY_HIDDEN: 23,\n CACHE: 24,\n TRACING_MARKER: 25,\n HOST_HOISTABLE: 26,\n HOST_SINGLETON: 27,\n ACTIVITY: 28,\n VIEW_TRANSITION: 30,\n} as const;\n\nexport function isUserComponent(fiber: Fiber): boolean {\n const tag = fiber.tag;\n return (\n tag === FIBER_TAG.FUNCTION_COMPONENT\n || tag === FIBER_TAG.CLASS_COMPONENT\n || tag === FIBER_TAG.FORWARD_REF\n || tag === FIBER_TAG.MEMO\n || tag === FIBER_TAG.SIMPLE_MEMO\n || tag === FIBER_TAG.LAZY\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,OAAO,MAAMA,SAAS,GAAG;EACvBC,kBAAkB,EAAE,CAAC;EACrBC,eAAe,EAAE,CAAC;EAClBC,uBAAuB,EAAE,CAAC;EAC1BC,SAAS,EAAE,CAAC;EACZC,WAAW,EAAE,CAAC;EACdC,YAAY,EAAE,CAAC;EACfC,SAAS,EAAE,CAAC;EACZC,QAAQ,EAAE,CAAC;EACXC,IAAI,EAAE,CAAC;EACPC,gBAAgB,EAAE,CAAC;EACnBC,gBAAgB,EAAE,EAAE;EACpBC,WAAW,EAAE,EAAE;EACfC,QAAQ,EAAE,EAAE;EACZC,QAAQ,EAAE,EAAE;EACZC,IAAI,EAAE,EAAE;EACRC,WAAW,EAAE,EAAE;EACfC,IAAI,EAAE,EAAE;EACRC,gBAAgB,EAAE,EAAE;EACpBC,mBAAmB,EAAE,EAAE;EACvBC,aAAa,EAAE,EAAE;EACjBC,KAAK,EAAE,EAAE;EACTC,SAAS,EAAE,EAAE;EACbC,aAAa,EAAE,EAAE;EACjBC,KAAK,EAAE,EAAE;EACTC,cAAc,EAAE,EAAE;EAClBC,cAAc,EAAE,EAAE;EAClBC,cAAc,EAAE,EAAE;EAClBC,QAAQ,EAAE,EAAE;EACZC,eAAe,EAAE;AACnB,CAAU;AAEV,OAAO,SAASC,eAAeA,CAACC,KAAY,EAAW;EACrD,MAAMC,GAAG,GAAGD,KAAK,CAACC,GAAG;EACrB,OACEA,GAAG,KAAKhC,SAAS,CAACC,kBAAkB,IACjC+B,GAAG,KAAKhC,SAAS,CAACE,eAAe,IACjC8B,GAAG,KAAKhC,SAAS,CAACY,WAAW,IAC7BoB,GAAG,KAAKhC,SAAS,CAACe,IAAI,IACtBiB,GAAG,KAAKhC,SAAS,CAACgB,WAAW,IAC7BgB,GAAG,KAAKhC,SAAS,CAACiB,IAAI;AAE7B","ignoreList":[]}
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { getComponentId, getComponentName } from "./FiberInspection.js";
|
|
18
|
+
import { safeFiberOperation } from "./SafeFiberOperation.js";
|
|
19
|
+
import { traverseAllFibers, walkFiberTree } from "./traverseFiber.js";
|
|
20
|
+
const OSDK_HOOK_METADATA = Symbol.for("__OSDK_HOOK_METADATA__");
|
|
21
|
+
function isOsdkContextConsumer(fiber) {
|
|
22
|
+
return safeFiberOperation(() => {
|
|
23
|
+
const fibersToCheck = [fiber, fiber.alternate].filter(Boolean);
|
|
24
|
+
for (const f of fibersToCheck) {
|
|
25
|
+
if (!f.dependencies?.firstContext) {
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
let ctx = f.dependencies.firstContext;
|
|
29
|
+
while (ctx) {
|
|
30
|
+
const value = ctx.memoizedValue;
|
|
31
|
+
if (value != null && typeof value === "object" && "observableClient" in value && "client" in value) {
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
ctx = ctx.next;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return false;
|
|
38
|
+
}, {
|
|
39
|
+
fallback: false,
|
|
40
|
+
feature: "hook-discovery"
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
function getSourceBasedId(fiber) {
|
|
44
|
+
const name = getComponentName(fiber);
|
|
45
|
+
const source = fiber._debugSource;
|
|
46
|
+
if (!source) {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
const shortPath = source.fileName?.split("/").slice(-2).join("/") || "unknown";
|
|
50
|
+
return `fiber-${name}-${shortPath}-${source.lineNumber || 0}`;
|
|
51
|
+
}
|
|
52
|
+
function getFiberSourceLocation(fiber) {
|
|
53
|
+
if (!fiber._debugSource) {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
fileName: fiber._debugSource.fileName,
|
|
58
|
+
lineNumber: fiber._debugSource.lineNumber
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function buildConsumerInfo(fiber) {
|
|
62
|
+
return {
|
|
63
|
+
fiber,
|
|
64
|
+
componentName: getComponentName(fiber),
|
|
65
|
+
sourceLocation: getFiberSourceLocation(fiber),
|
|
66
|
+
sourceBasedId: getSourceBasedId(fiber)
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
function isOsdkFunctionComponent(fiber) {
|
|
70
|
+
return typeof fiber.type === "function" && isOsdkContextConsumer(fiber);
|
|
71
|
+
}
|
|
72
|
+
export function findOsdkConsumersInAncestors(fiber, maxDepth = 50) {
|
|
73
|
+
return traverseAllFibers(fiber, node => isOsdkFunctionComponent(node), /* ascending */true, /* maxResults */undefined, maxDepth).map(buildConsumerInfo);
|
|
74
|
+
}
|
|
75
|
+
export function hasOsdkConsumerInTree(fiber, maxDepth = 50) {
|
|
76
|
+
let current = fiber;
|
|
77
|
+
let depth = 0;
|
|
78
|
+
while (current && depth < maxDepth) {
|
|
79
|
+
if (typeof current.type === "function" && isOsdkContextConsumer(current)) {
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
current = current.return;
|
|
83
|
+
depth++;
|
|
84
|
+
}
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
function createSearchBudget(scope) {
|
|
88
|
+
return {
|
|
89
|
+
nodesVisited: 0,
|
|
90
|
+
resultsFound: 0,
|
|
91
|
+
maxNodes: scope.maxAncestorLevels * scope.maxChildDepth * scope.maxSiblingsPerLevel,
|
|
92
|
+
maxResults: scope.maxTotalResults
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
function isBudgetExhausted(budget) {
|
|
96
|
+
return budget.nodesVisited >= budget.maxNodes || budget.resultsFound >= budget.maxResults;
|
|
97
|
+
}
|
|
98
|
+
const DEFAULT_SEARCH_SCOPE = {
|
|
99
|
+
maxAncestorLevels: 10,
|
|
100
|
+
maxChildDepth: 10,
|
|
101
|
+
maxTotalResults: 10,
|
|
102
|
+
maxSiblingsPerLevel: 20
|
|
103
|
+
};
|
|
104
|
+
export function findOsdkConsumersInSiblings(fiber, scope = DEFAULT_SEARCH_SCOPE) {
|
|
105
|
+
return safeFiberOperation(() => {
|
|
106
|
+
const consumers = [];
|
|
107
|
+
const visited = new Set();
|
|
108
|
+
const ancestorPath = new Set();
|
|
109
|
+
const budget = createSearchBudget(scope);
|
|
110
|
+
let pathFiber = fiber;
|
|
111
|
+
while (pathFiber) {
|
|
112
|
+
ancestorPath.add(pathFiber);
|
|
113
|
+
pathFiber = pathFiber.return;
|
|
114
|
+
}
|
|
115
|
+
let currentAncestor = fiber.return;
|
|
116
|
+
let ancestorLevel = 0;
|
|
117
|
+
while (currentAncestor && ancestorLevel < scope.maxAncestorLevels && !isBudgetExhausted(budget)) {
|
|
118
|
+
let child = currentAncestor.child;
|
|
119
|
+
let siblingCount = 0;
|
|
120
|
+
while (child && siblingCount < scope.maxSiblingsPerLevel && !isBudgetExhausted(budget)) {
|
|
121
|
+
if (!ancestorPath.has(child)) {
|
|
122
|
+
const remaining = budget.maxResults - budget.resultsFound;
|
|
123
|
+
const subtreeMatches = traverseAllFibers(child, node => {
|
|
124
|
+
if (visited.has(node)) {
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
visited.add(node);
|
|
128
|
+
budget.nodesVisited++;
|
|
129
|
+
return isOsdkFunctionComponent(node);
|
|
130
|
+
}, /* ascending */false, /* maxResults */remaining, scope.maxChildDepth);
|
|
131
|
+
for (const match of subtreeMatches) {
|
|
132
|
+
consumers.push(buildConsumerInfo(match));
|
|
133
|
+
budget.resultsFound++;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
child = child.sibling;
|
|
137
|
+
siblingCount++;
|
|
138
|
+
}
|
|
139
|
+
currentAncestor = currentAncestor.return;
|
|
140
|
+
ancestorLevel++;
|
|
141
|
+
}
|
|
142
|
+
return consumers;
|
|
143
|
+
}, {
|
|
144
|
+
fallback: [],
|
|
145
|
+
feature: "hook-discovery"
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
export function findOsdkConsumersInDescendants(fiber, scope = DEFAULT_SEARCH_SCOPE) {
|
|
149
|
+
return safeFiberOperation(() => {
|
|
150
|
+
const consumers = [];
|
|
151
|
+
let child = fiber.child;
|
|
152
|
+
let siblingCount = 0;
|
|
153
|
+
while (child && siblingCount < scope.maxSiblingsPerLevel && consumers.length < scope.maxTotalResults) {
|
|
154
|
+
const remaining = scope.maxTotalResults - consumers.length;
|
|
155
|
+
const matches = traverseAllFibers(child, node => isOsdkFunctionComponent(node), /* ascending */false, remaining, scope.maxChildDepth);
|
|
156
|
+
for (const match of matches) {
|
|
157
|
+
consumers.push(buildConsumerInfo(match));
|
|
158
|
+
}
|
|
159
|
+
child = child.sibling;
|
|
160
|
+
siblingCount++;
|
|
161
|
+
}
|
|
162
|
+
return consumers;
|
|
163
|
+
}, {
|
|
164
|
+
fallback: [],
|
|
165
|
+
feature: "hook-discovery"
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
function isOsdkHookMetadata(value) {
|
|
169
|
+
return value != null && typeof value === "object" && OSDK_HOOK_METADATA in value && value[OSDK_HOOK_METADATA] === true;
|
|
170
|
+
}
|
|
171
|
+
function isRefStorage(value) {
|
|
172
|
+
return value != null && typeof value === "object" && "current" in value && Object.keys(value).length <= 2;
|
|
173
|
+
}
|
|
174
|
+
const VALID_HOOK_TYPES = new Set(["useOsdkAction", "useOsdkObjects", "useOsdkObject", "useLinks", "useOsdkAggregation", "useOsdkFunction", "useObjectSet"]);
|
|
175
|
+
function isValidHookType(value) {
|
|
176
|
+
return VALID_HOOK_TYPES.has(value);
|
|
177
|
+
}
|
|
178
|
+
export function extractOsdkMetadataFromFiber(fiber) {
|
|
179
|
+
return safeFiberOperation(() => {
|
|
180
|
+
const results = [];
|
|
181
|
+
let current = fiber.memoizedState;
|
|
182
|
+
while (current) {
|
|
183
|
+
const state = current.memoizedState;
|
|
184
|
+
|
|
185
|
+
// useRef check: state is { current: OsdkHookMetadata }
|
|
186
|
+
if (isRefStorage(state) && isOsdkHookMetadata(state.current)) {
|
|
187
|
+
results.push(state.current);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// useMemo check: state is [memoizedValue, deps]
|
|
191
|
+
// The memoizedValue is the makeExternalStore return object
|
|
192
|
+
// which has OSDK_HOOK_METADATA as a non-enumerable symbol property
|
|
193
|
+
if (Array.isArray(state) && state[0] != null && typeof state[0] === "object") {
|
|
194
|
+
const memoValue = state[0];
|
|
195
|
+
if (OSDK_HOOK_METADATA in memoValue) {
|
|
196
|
+
// `in` validates the key exists; TS can't narrow symbol keys
|
|
197
|
+
const meta = memoValue[OSDK_HOOK_METADATA];
|
|
198
|
+
if (meta != null && typeof meta === "object" && "hookType" in meta && typeof meta.hookType === "string" && isValidHookType(meta.hookType)) {
|
|
199
|
+
const validated = meta;
|
|
200
|
+
results.push({
|
|
201
|
+
[OSDK_HOOK_METADATA]: true,
|
|
202
|
+
hookType: validated.hookType,
|
|
203
|
+
actionName: typeof validated.actionName === "string" ? validated.actionName : undefined,
|
|
204
|
+
objectType: typeof validated.objectType === "string" ? validated.objectType : undefined,
|
|
205
|
+
primaryKey: typeof validated.primaryKey === "string" ? validated.primaryKey : undefined,
|
|
206
|
+
sourceObjectType: typeof validated.sourceObjectType === "string" ? validated.sourceObjectType : undefined,
|
|
207
|
+
linkName: typeof validated.linkName === "string" ? validated.linkName : undefined,
|
|
208
|
+
where: validated.where,
|
|
209
|
+
orderBy: validated.orderBy,
|
|
210
|
+
pageSize: typeof validated.pageSize === "number" ? validated.pageSize : undefined,
|
|
211
|
+
aggregate: validated.aggregate
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
current = current.next;
|
|
217
|
+
}
|
|
218
|
+
return results;
|
|
219
|
+
}, {
|
|
220
|
+
fallback: [],
|
|
221
|
+
feature: "metadata-extraction"
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
export function discoverOsdkComponentsFromRoot(fiberRoot) {
|
|
225
|
+
return safeFiberOperation(() => {
|
|
226
|
+
const components = new Map();
|
|
227
|
+
const rootFiber = fiberRoot.current;
|
|
228
|
+
if (!rootFiber) {
|
|
229
|
+
return components;
|
|
230
|
+
}
|
|
231
|
+
walkFiberTree(rootFiber, fiber => {
|
|
232
|
+
if (typeof fiber.type !== "function") {
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
const metadata = extractOsdkMetadataFromFiber(fiber);
|
|
236
|
+
if (metadata.length > 0) {
|
|
237
|
+
const componentId = getComponentId(fiber);
|
|
238
|
+
const componentName = getComponentName(fiber);
|
|
239
|
+
const sourceLocation = getFiberSourceLocation(fiber);
|
|
240
|
+
components.set(componentId, {
|
|
241
|
+
componentId,
|
|
242
|
+
componentName,
|
|
243
|
+
hooks: metadata,
|
|
244
|
+
sourceLocation
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
return components;
|
|
249
|
+
}, {
|
|
250
|
+
fallback: new Map(),
|
|
251
|
+
feature: "fiber-discovery"
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
//# sourceMappingURL=HookStateInspector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HookStateInspector.js","names":["getComponentId","getComponentName","safeFiberOperation","traverseAllFibers","walkFiberTree","OSDK_HOOK_METADATA","Symbol","for","isOsdkContextConsumer","fiber","fibersToCheck","alternate","filter","Boolean","f","dependencies","firstContext","ctx","value","memoizedValue","next","fallback","feature","getSourceBasedId","name","source","_debugSource","shortPath","fileName","split","slice","join","lineNumber","getFiberSourceLocation","buildConsumerInfo","componentName","sourceLocation","sourceBasedId","isOsdkFunctionComponent","type","findOsdkConsumersInAncestors","maxDepth","node","undefined","map","hasOsdkConsumerInTree","current","depth","return","createSearchBudget","scope","nodesVisited","resultsFound","maxNodes","maxAncestorLevels","maxChildDepth","maxSiblingsPerLevel","maxResults","maxTotalResults","isBudgetExhausted","budget","DEFAULT_SEARCH_SCOPE","findOsdkConsumersInSiblings","consumers","visited","Set","ancestorPath","pathFiber","add","currentAncestor","ancestorLevel","child","siblingCount","has","remaining","subtreeMatches","match","push","sibling","findOsdkConsumersInDescendants","length","matches","isOsdkHookMetadata","isRefStorage","Object","keys","VALID_HOOK_TYPES","isValidHookType","extractOsdkMetadataFromFiber","results","memoizedState","state","Array","isArray","memoValue","meta","hookType","validated","actionName","objectType","primaryKey","sourceObjectType","linkName","where","orderBy","pageSize","aggregate","discoverOsdkComponentsFromRoot","fiberRoot","components","Map","rootFiber","metadata","componentId","set","hooks"],"sources":["HookStateInspector.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { getComponentId, getComponentName } from \"./FiberInspection.js\";\nimport { safeFiberOperation } from \"./SafeFiberOperation.js\";\nimport { traverseAllFibers, walkFiberTree } from \"./traverseFiber.js\";\nimport type {\n ContextDependency,\n Fiber,\n FiberRoot,\n MemoizedState,\n} from \"./types.js\";\n\nconst OSDK_HOOK_METADATA = Symbol.for(\"__OSDK_HOOK_METADATA__\");\n\nexport interface OsdkHookMetadata {\n readonly [key: symbol]: true;\n readonly hookType:\n | \"useOsdkAction\"\n | \"useOsdkObjects\"\n | \"useOsdkObject\"\n | \"useLinks\"\n | \"useOsdkAggregation\"\n | \"useOsdkFunction\"\n | \"useObjectSet\";\n readonly actionName?: string;\n readonly objectType?: string;\n readonly primaryKey?: string;\n readonly sourceObjectType?: string;\n readonly linkName?: string;\n readonly where?: unknown;\n readonly orderBy?: unknown;\n readonly pageSize?: number;\n readonly aggregate?: unknown;\n}\n\nexport interface OsdkConsumerFiber {\n fiber: Fiber;\n componentName: string;\n sourceLocation: { fileName?: string; lineNumber?: number } | null;\n sourceBasedId: string | null;\n}\n\nfunction isOsdkContextConsumer(fiber: Fiber): boolean {\n return safeFiberOperation(\n () => {\n const fibersToCheck = [fiber, fiber.alternate].filter(Boolean) as Fiber[];\n\n for (const f of fibersToCheck) {\n if (!f.dependencies?.firstContext) {\n continue;\n }\n\n let ctx: ContextDependency | null = f.dependencies.firstContext;\n while (ctx) {\n const value = ctx.memoizedValue;\n if (\n value != null\n && typeof value === \"object\"\n && \"observableClient\" in value\n && \"client\" in value\n ) {\n return true;\n }\n ctx = ctx.next;\n }\n }\n return false;\n },\n { fallback: false, feature: \"hook-discovery\" },\n );\n}\n\nfunction getSourceBasedId(fiber: Fiber): string | null {\n const name = getComponentName(fiber);\n const source = fiber._debugSource;\n if (!source) {\n return null;\n }\n\n const shortPath = source.fileName?.split(\"/\").slice(-2).join(\"/\")\n || \"unknown\";\n return `fiber-${name}-${shortPath}-${source.lineNumber || 0}`;\n}\n\nfunction getFiberSourceLocation(fiber: Fiber): {\n fileName?: string;\n lineNumber?: number;\n} | null {\n if (!fiber._debugSource) {\n return null;\n }\n return {\n fileName: fiber._debugSource.fileName,\n lineNumber: fiber._debugSource.lineNumber,\n };\n}\n\nfunction buildConsumerInfo(fiber: Fiber): OsdkConsumerFiber {\n return {\n fiber,\n componentName: getComponentName(fiber),\n sourceLocation: getFiberSourceLocation(fiber),\n sourceBasedId: getSourceBasedId(fiber),\n };\n}\n\nfunction isOsdkFunctionComponent(fiber: Fiber): boolean {\n return typeof fiber.type === \"function\" && isOsdkContextConsumer(fiber);\n}\n\nexport function findOsdkConsumersInAncestors(\n fiber: Fiber,\n maxDepth = 50,\n): OsdkConsumerFiber[] {\n return traverseAllFibers(\n fiber,\n (node) => isOsdkFunctionComponent(node),\n /* ascending */ true,\n /* maxResults */ undefined,\n maxDepth,\n ).map(buildConsumerInfo);\n}\n\nexport function hasOsdkConsumerInTree(fiber: Fiber, maxDepth = 50): boolean {\n let current: Fiber | null = fiber;\n let depth = 0;\n\n while (current && depth < maxDepth) {\n if (typeof current.type === \"function\" && isOsdkContextConsumer(current)) {\n return true;\n }\n current = current.return;\n depth++;\n }\n\n return false;\n}\n\ninterface SearchScope {\n maxAncestorLevels: number;\n maxChildDepth: number;\n maxTotalResults: number;\n maxSiblingsPerLevel: number;\n}\n\ninterface SearchBudget {\n nodesVisited: number;\n resultsFound: number;\n readonly maxNodes: number;\n readonly maxResults: number;\n}\n\nfunction createSearchBudget(scope: SearchScope): SearchBudget {\n return {\n nodesVisited: 0,\n resultsFound: 0,\n maxNodes: scope.maxAncestorLevels * scope.maxChildDepth\n * scope.maxSiblingsPerLevel,\n maxResults: scope.maxTotalResults,\n };\n}\n\nfunction isBudgetExhausted(budget: SearchBudget): boolean {\n return budget.nodesVisited >= budget.maxNodes\n || budget.resultsFound >= budget.maxResults;\n}\n\nconst DEFAULT_SEARCH_SCOPE: SearchScope = {\n maxAncestorLevels: 10,\n maxChildDepth: 10,\n maxTotalResults: 10,\n maxSiblingsPerLevel: 20,\n};\n\nexport function findOsdkConsumersInSiblings(\n fiber: Fiber,\n scope: SearchScope = DEFAULT_SEARCH_SCOPE,\n): OsdkConsumerFiber[] {\n return safeFiberOperation(\n () => {\n const consumers: OsdkConsumerFiber[] = [];\n const visited = new Set<Fiber>();\n const ancestorPath = new Set<Fiber>();\n const budget = createSearchBudget(scope);\n\n let pathFiber: Fiber | null = fiber;\n while (pathFiber) {\n ancestorPath.add(pathFiber);\n pathFiber = pathFiber.return;\n }\n\n let currentAncestor: Fiber | null = fiber.return;\n let ancestorLevel = 0;\n\n while (\n currentAncestor\n && ancestorLevel < scope.maxAncestorLevels\n && !isBudgetExhausted(budget)\n ) {\n let child: Fiber | null = currentAncestor.child;\n let siblingCount = 0;\n while (\n child\n && siblingCount < scope.maxSiblingsPerLevel\n && !isBudgetExhausted(budget)\n ) {\n if (!ancestorPath.has(child)) {\n const remaining = budget.maxResults - budget.resultsFound;\n const subtreeMatches = traverseAllFibers(\n child,\n (node) => {\n if (visited.has(node)) {\n return false;\n }\n visited.add(node);\n budget.nodesVisited++;\n return isOsdkFunctionComponent(node);\n },\n /* ascending */ false,\n /* maxResults */ remaining,\n scope.maxChildDepth,\n );\n\n for (const match of subtreeMatches) {\n consumers.push(buildConsumerInfo(match));\n budget.resultsFound++;\n }\n }\n child = child.sibling;\n siblingCount++;\n }\n\n currentAncestor = currentAncestor.return;\n ancestorLevel++;\n }\n\n return consumers;\n },\n { fallback: [], feature: \"hook-discovery\" },\n );\n}\n\nexport function findOsdkConsumersInDescendants(\n fiber: Fiber,\n scope: SearchScope = DEFAULT_SEARCH_SCOPE,\n): OsdkConsumerFiber[] {\n return safeFiberOperation(\n () => {\n const consumers: OsdkConsumerFiber[] = [];\n\n let child: Fiber | null = fiber.child;\n let siblingCount = 0;\n while (\n child\n && siblingCount < scope.maxSiblingsPerLevel\n && consumers.length < scope.maxTotalResults\n ) {\n const remaining = scope.maxTotalResults - consumers.length;\n const matches = traverseAllFibers(\n child,\n (node) => isOsdkFunctionComponent(node),\n /* ascending */ false,\n remaining,\n scope.maxChildDepth,\n );\n for (const match of matches) {\n consumers.push(buildConsumerInfo(match));\n }\n child = child.sibling;\n siblingCount++;\n }\n\n return consumers;\n },\n { fallback: [], feature: \"hook-discovery\" },\n );\n}\n\nfunction isOsdkHookMetadata(value: unknown): value is OsdkHookMetadata {\n return (\n value != null\n && typeof value === \"object\"\n && OSDK_HOOK_METADATA in value\n && (value as Record<symbol, unknown>)[OSDK_HOOK_METADATA] === true\n );\n}\n\nfunction isRefStorage(value: unknown): value is { current: unknown } {\n return (\n value != null\n && typeof value === \"object\"\n && \"current\" in value\n && Object.keys(value as object).length <= 2\n );\n}\n\nconst VALID_HOOK_TYPES = new Set<OsdkHookMetadata[\"hookType\"]>([\n \"useOsdkAction\",\n \"useOsdkObjects\",\n \"useOsdkObject\",\n \"useLinks\",\n \"useOsdkAggregation\",\n \"useOsdkFunction\",\n \"useObjectSet\",\n]);\n\nfunction isValidHookType(value: string): value is OsdkHookMetadata[\"hookType\"] {\n return VALID_HOOK_TYPES.has(value as OsdkHookMetadata[\"hookType\"]);\n}\n\nexport function extractOsdkMetadataFromFiber(fiber: Fiber): OsdkHookMetadata[] {\n return safeFiberOperation(\n () => {\n const results: OsdkHookMetadata[] = [];\n let current: MemoizedState | null = fiber.memoizedState;\n\n while (current) {\n const state = current.memoizedState;\n\n // useRef check: state is { current: OsdkHookMetadata }\n if (isRefStorage(state) && isOsdkHookMetadata(state.current)) {\n results.push(state.current);\n }\n\n // useMemo check: state is [memoizedValue, deps]\n // The memoizedValue is the makeExternalStore return object\n // which has OSDK_HOOK_METADATA as a non-enumerable symbol property\n if (\n Array.isArray(state)\n && state[0] != null\n && typeof state[0] === \"object\"\n ) {\n const memoValue = state[0];\n if (OSDK_HOOK_METADATA in memoValue) {\n // `in` validates the key exists; TS can't narrow symbol keys\n const meta =\n (memoValue as Record<symbol, unknown>)[OSDK_HOOK_METADATA];\n if (\n meta != null\n && typeof meta === \"object\"\n && \"hookType\" in meta\n && typeof (meta as { hookType: unknown }).hookType === \"string\"\n && isValidHookType(\n (meta as { hookType: string }).hookType,\n )\n ) {\n const validated = meta as {\n hookType: OsdkHookMetadata[\"hookType\"];\n [key: string]: unknown;\n };\n results.push({\n [OSDK_HOOK_METADATA]: true,\n hookType: validated.hookType,\n actionName: typeof validated.actionName === \"string\"\n ? validated.actionName\n : undefined,\n objectType: typeof validated.objectType === \"string\"\n ? validated.objectType\n : undefined,\n primaryKey: typeof validated.primaryKey === \"string\"\n ? validated.primaryKey\n : undefined,\n sourceObjectType: typeof validated.sourceObjectType === \"string\"\n ? validated.sourceObjectType\n : undefined,\n linkName: typeof validated.linkName === \"string\"\n ? validated.linkName\n : undefined,\n where: validated.where,\n orderBy: validated.orderBy,\n pageSize: typeof validated.pageSize === \"number\"\n ? validated.pageSize\n : undefined,\n aggregate: validated.aggregate,\n });\n }\n }\n }\n\n current = current.next;\n }\n\n return results;\n },\n { fallback: [], feature: \"metadata-extraction\" },\n );\n}\n\nexport interface DiscoveredComponent {\n componentId: string;\n componentName: string;\n hooks: OsdkHookMetadata[];\n sourceLocation: { fileName?: string; lineNumber?: number } | null;\n}\n\nexport function discoverOsdkComponentsFromRoot(\n fiberRoot: FiberRoot,\n): Map<string, DiscoveredComponent> {\n return safeFiberOperation(\n () => {\n const components = new Map<string, DiscoveredComponent>();\n const rootFiber = fiberRoot.current;\n\n if (!rootFiber) {\n return components;\n }\n\n walkFiberTree(rootFiber, (fiber) => {\n if (typeof fiber.type !== \"function\") {\n return;\n }\n\n const metadata = extractOsdkMetadataFromFiber(fiber);\n if (metadata.length > 0) {\n const componentId = getComponentId(fiber);\n const componentName = getComponentName(fiber);\n const sourceLocation = getFiberSourceLocation(fiber);\n\n components.set(componentId, {\n componentId,\n componentName,\n hooks: metadata,\n sourceLocation,\n });\n }\n });\n\n return components;\n },\n { fallback: new Map(), feature: \"fiber-discovery\" },\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,cAAc,EAAEC,gBAAgB,QAAQ,sBAAsB;AACvE,SAASC,kBAAkB,QAAQ,yBAAyB;AAC5D,SAASC,iBAAiB,EAAEC,aAAa,QAAQ,oBAAoB;AAQrE,MAAMC,kBAAkB,GAAGC,MAAM,CAACC,GAAG,CAAC,wBAAwB,CAAC;AA8B/D,SAASC,qBAAqBA,CAACC,KAAY,EAAW;EACpD,OAAOP,kBAAkB,CACvB,MAAM;IACJ,MAAMQ,aAAa,GAAG,CAACD,KAAK,EAAEA,KAAK,CAACE,SAAS,CAAC,CAACC,MAAM,CAACC,OAAO,CAAY;IAEzE,KAAK,MAAMC,CAAC,IAAIJ,aAAa,EAAE;MAC7B,IAAI,CAACI,CAAC,CAACC,YAAY,EAAEC,YAAY,EAAE;QACjC;MACF;MAEA,IAAIC,GAA6B,GAAGH,CAAC,CAACC,YAAY,CAACC,YAAY;MAC/D,OAAOC,GAAG,EAAE;QACV,MAAMC,KAAK,GAAGD,GAAG,CAACE,aAAa;QAC/B,IACED,KAAK,IAAI,IAAI,IACV,OAAOA,KAAK,KAAK,QAAQ,IACzB,kBAAkB,IAAIA,KAAK,IAC3B,QAAQ,IAAIA,KAAK,EAC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Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { getCapabilitiesManager } from "./capabilities.js";
|
|
18
|
+
export function safeFiberOperation(operation, options) {
|
|
19
|
+
const manager = getCapabilitiesManager();
|
|
20
|
+
const caps = manager.getCapabilities();
|
|
21
|
+
if (caps.disabledFeatures.has(options.feature)) {
|
|
22
|
+
return options.fallback;
|
|
23
|
+
}
|
|
24
|
+
try {
|
|
25
|
+
const result = operation();
|
|
26
|
+
if (result !== options.fallback && !caps.fiberAccessWorking) {
|
|
27
|
+
manager.setCapability("fiberAccessWorking", true);
|
|
28
|
+
}
|
|
29
|
+
return result;
|
|
30
|
+
} catch (error) {
|
|
31
|
+
manager.recordError(options.feature, error);
|
|
32
|
+
return options.fallback;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=SafeFiberOperation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SafeFiberOperation.js","names":["getCapabilitiesManager","safeFiberOperation","operation","options","manager","caps","getCapabilities","disabledFeatures","has","feature","fallback","result","fiberAccessWorking","setCapability","error","recordError"],"sources":["SafeFiberOperation.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { type FiberFeature, getCapabilitiesManager } from \"./capabilities.js\";\n\ninterface SafeOperationOptions<T> {\n fallback: T;\n feature: FiberFeature;\n}\n\nexport function safeFiberOperation<T>(\n operation: () => T,\n options: SafeOperationOptions<T>,\n): T {\n const manager = getCapabilitiesManager();\n const caps = manager.getCapabilities();\n\n if (caps.disabledFeatures.has(options.feature)) {\n return options.fallback;\n }\n\n try {\n const result = operation();\n\n if (result !== options.fallback && !caps.fiberAccessWorking) {\n manager.setCapability(\"fiberAccessWorking\", true);\n }\n\n return result;\n } catch (error) {\n manager.recordError(options.feature, error);\n return options.fallback;\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAA4BA,sBAAsB,QAAQ,mBAAmB;AAO7E,OAAO,SAASC,kBAAkBA,CAChCC,SAAkB,EAClBC,OAAgC,EAC7B;EACH,MAAMC,OAAO,GAAGJ,sBAAsB,CAAC,CAAC;EACxC,MAAMK,IAAI,GAAGD,OAAO,CAACE,eAAe,CAAC,CAAC;EAEtC,IAAID,IAAI,CAACE,gBAAgB,CAACC,GAAG,CAACL,OAAO,CAACM,OAAO,CAAC,EAAE;IAC9C,OAAON,OAAO,CAACO,QAAQ;EACzB;EAEA,IAAI;IACF,MAAMC,MAAM,GAAGT,SAAS,CAAC,CAAC;IAE1B,IAAIS,MAAM,KAAKR,OAAO,CAACO,QAAQ,IAAI,CAACL,IAAI,CAACO,kBAAkB,EAAE;MAC3DR,OAAO,CAACS,aAAa,CAAC,oBAAoB,EAAE,IAAI,CAAC;IACnD;IAEA,OAAOF,MAAM;EACf,CAAC,CAAC,OAAOG,KAAK,EAAE;IACdV,OAAO,CAACW,WAAW,CAACZ,OAAO,CAACM,OAAO,EAAEK,KAAK,CAAC;IAC3C,OAAOX,OAAO,CAACO,QAAQ;EACzB;AACF","ignoreList":[]}
|