MCPcopy Create free account
hub / github.com/benjitaylor/agentation / checkSourceLocationSupport

Function checkSourceLocationSupport

package/src/utils/source-location.ts:854–904  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

852 * @returns Object describing support status
853 */
854export function checkSourceLocationSupport(): {
855 supported: boolean;
856 reason: string;
857 suggestions: string[];
858} {
859 const reactInfo = detectReactApp();
860
861 if (!reactInfo.isReact) {
862 return {
863 supported: false,
864 reason: "No React application detected on this page",
865 suggestions: [
866 "Ensure you're on a page built with React",
867 "The page may use a different framework (Vue, Angular, etc.)",
868 ],
869 };
870 }
871
872 if (reactInfo.isProduction) {
873 return {
874 supported: false,
875 reason: "Production build detected - source info is stripped",
876 suggestions: [
877 "Run the application in development mode",
878 "Set NODE_ENV=development",
879 "Ensure your bundler includes source info in development",
880 ],
881 };
882 }
883
884 // Check for DevTools
885 const hasDevTools = typeof window !== "undefined" &&
886 !!(window as unknown as Record<string, unknown>).__REACT_DEVTOOLS_GLOBAL_HOOK__;
887
888 if (!hasDevTools) {
889 return {
890 supported: true,
891 reason: "Development mode detected, but React DevTools not installed",
892 suggestions: [
893 "Install React DevTools browser extension for best results",
894 "Source detection may still work without it",
895 ],
896 };
897 }
898
899 return {
900 supported: true,
901 reason: `React ${reactInfo.version || "unknown"} development mode detected`,
902 suggestions: [],
903 };
904}

Callers

nothing calls this directly

Calls 1

detectReactAppFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…