sidakram-bippy 0.2.24

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ import './chunk-XX7FLNAQ.js';
2
+ export { BIPPY_INSTRUMENTATION_STRING, CONCURRENT_MODE_NUMBER, CONCURRENT_MODE_SYMBOL_STRING, ClassComponentTag, ContextConsumerTag, DEPRECATED_ASYNC_MODE_SYMBOL_STRING, DehydratedSuspenseComponentTag, ELEMENT_TYPE_SYMBOL_STRING, ForwardRefTag, FragmentTag, FunctionComponentTag, HostComponentTag, HostHoistableTag, HostRootTag, HostSingletonTag, HostTextTag, INSTALL_ERROR, INSTALL_HOOK_SCRIPT_STRING, LegacyHiddenComponentTag, MemoComponentTag, OffscreenComponentTag, SimpleMemoComponentTag, SuspenseComponentTag, TRANSITIONAL_ELEMENT_TYPE_SYMBOL_STRING, createFiberVisitor, detectReactBuildType, didFiberCommit, didFiberRender, fiberIdMap, getDisplayName, getFiberFromHostInstance, getFiberId, getFiberStack, getMutatedHostFibers, getNearestHostFiber, getNearestHostFibers, getRDTHook, getTimings, getType, hasMemoCache, hasRDTHook, installRDTHook, instrument, isClientEnvironment, isCompositeFiber, isHostFiber, isInstrumentationActive, isReactRefresh, isRealReactDevtools, isValidElement, isValidFiber, mountFiberRecursively, onCommitFiberRoot, patchRDTHook, secure, setFiberId, shouldFilterFiber, traverseContexts, traverseFiber, traverseProps, traverseRenderedFibers, traverseState, unmountFiber, unmountFiberChildrenRecursively, updateFiberRecursively, version } from './chunk-7ROEST76.js';
@@ -0,0 +1,9 @@
1
+ var Shrinkwrap=function(t){"use strict";
2
+ /**
3
+ * @license bippy
4
+ *
5
+ * Copyright (c) Aiden Bai, Million Software, Inc.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var e="bippy-0.2.24",n=Object.defineProperty,o=Object.prototype.hasOwnProperty,i=()=>{},r=t=>{try{Function.prototype.toString.call(t).indexOf("^_^")>-1&&setTimeout((()=>{throw new Error("React is running in production mode, but dead code elimination has not been applied. Read how to correctly configure React for production: https://reactjs.org/link/perf-use-production-build")}))}catch{}},s=!1,c=void 0,a=(t=h())=>!!s||("function"==typeof t.inject&&(c=t.inject.toString()),Boolean(c?.includes("(injected)"))),l=new Set,u=t=>{const o=new Map;let s=0;const c={checkDCE:r,supportsFiber:!0,supportsFlight:!0,hasUnsupportedRendererAttached:!1,renderers:o,onCommitFiberRoot:i,onCommitFiberUnmount:i,onPostCommitFiberRoot:i,inject(t){const e=++s;return o.set(e,t),c._instrumentationIsActive||(c._instrumentationIsActive=!0,l.forEach((t=>t()))),e},_instrumentationSource:e,_instrumentationIsActive:!1};try{n(globalThis,"__REACT_DEVTOOLS_GLOBAL_HOOK__",{value:c,configurable:!0,writable:!0});const t=window.hasOwnProperty;let e=!1;n(window,"hasOwnProperty",{value:function(){return e||"__REACT_DEVTOOLS_GLOBAL_HOOK__"!==arguments[0]?t.apply(this,arguments):(globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__=void 0,e=!0,-0)},configurable:!0,writable:!0})}catch{d(t)}return c},d=t=>{t&&l.add(t);try{const n=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!n)return;if(!n._instrumentationSource){if(s=a(n),n.checkDCE=r,n.supportsFiber=!0,n.supportsFlight=!0,n.hasUnsupportedRendererAttached=!1,n._instrumentationSource=e,n._instrumentationIsActive=!1,n.renderers.size)return n._instrumentationIsActive=!0,void l.forEach((t=>t()));const t=n.inject;if(a(n)&&!((t=h())=>"getFiberRoots"in t)()){s=!0;let t=n.inject(null);t&&(n._instrumentationIsActive=!0),n.inject=()=>t++}else n.inject=e=>{const o=t(e);return n._instrumentationIsActive=!0,l.forEach((t=>t())),o}}(n.renderers.size||n._instrumentationIsActive||a())&&t?.()}catch{}},h=t=>o.call(globalThis,"__REACT_DEVTOOLS_GLOBAL_HOOK__")?(d(t),globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__):u(t),m=t=>{switch(t.tag){case 5:case 26:case 27:return!0;default:return"string"==typeof t.type}},b=(t,e,n=!1)=>{if(!t)return null;if(!0===e(t))return t;let o=n?t.return:t.child;for(;o;){const t=b(o,e,n);if(t)return t;o=n?null:o.sibling}return null},w=[[255,0,0],[0,255,0],[0,0,255],[255,165,0],[128,0,128],[0,128,128],[255,105,180],[75,0,130],[255,69,0],[46,139,87],[220,20,60],[70,130,180]],f=["a","button","details","embed","input","label","menu","menuitem","object","select","textarea","summary"],p=["button","menu","menuitem","link","checkbox","radio","slider","tab","tabpanel","textbox","combobox","grid","listbox","option","progressbar","scrollbar","searchbox","switch","tree","treeitem","spinbutton","tooltip","a-button-inner","a-dropdown-button","click","menuitemcheckbox","menuitemradio","a-button-text","button-text","button-icon","button-icon-only","button-text-icon-only","dropdown","combobox"],g=["click","mousedown","mouseup","touchstart","touchend","keydown","keyup","focus","blur"],_=t=>{const e=(t=>{const e=h();for(const n of e.renderers.values())try{const e=n.findFiberByHostInstance?.(t);if(e)return e}catch{}if("object"==typeof t&&null!=t){if("_reactRootContainer"in t)return t._reactRootContainer?._internalRoot?.current?.child;for(const e in t)if(e.startsWith("__reactInternalInstance$")||e.startsWith("__reactFiber"))return t[e]||null}return null})(t);if(e?.stateNode instanceof Element)for(const t of Object.keys(e.memoizedProps||{})){if(!t.startsWith("on"))continue;const n=t.slice(2).toLowerCase().replace(/capture$/,"");if(g.includes(n)&&e.memoizedProps[t])return!0}for(const e of g){const n=t[`on${e}`],o=t.hasAttribute(`on${e}`),i=t.hasAttribute(`ng-${e}`),r=t.hasAttribute(`@${e}`),s=t.hasAttribute(`v-on:${e}`);if(n||o||i||r||s)return!0}const n=t.tagName.toLowerCase(),o=t.getAttribute("role"),i=t.getAttribute("aria-role"),r=t.getAttribute("tabindex"),s=f.includes(n)||o&&p.includes(o)||i&&p.includes(i)||null!==r&&"-1"!==r,c=t.hasAttribute("aria-expanded")||t.hasAttribute("aria-pressed")||t.hasAttribute("aria-selected")||t.hasAttribute("aria-checked"),a="form"in t&&void 0!==t.form||t.hasAttribute("contenteditable"),l="draggable"in t&&t.draggable||"true"===t.getAttribute("draggable");return s||a||l||c},y=t=>{const e=window.getComputedStyle(t);return t.offsetWidth>0&&t.offsetHeight>0&&"hidden"!==e.visibility&&"none"!==e.display},v=t=>{if(t.ownerDocument!==window.document)return!0;const e=t.getRootNode();if(e instanceof ShadowRoot){const n=t.getBoundingClientRect(),o={x:n.left+n.width/2,y:n.top+n.height/2};try{const n=e.elementFromPoint(o.x,o.y);if(!n)return!1;let i=n;for(;i&&i!==e;){if(i===t)return!0;i=i.parentElement}return!1}catch{return!0}}const n=t.getBoundingClientRect(),o=window.scrollX,i=window.scrollY,r=i,s=o,c=window.innerHeight+i,a=window.innerWidth+o,l=n.top+i,u=n.left+o,d=n.bottom+i,h=n.right+o;if(d<r||l>c||h<s||u>a)return!1;try{const e=n.left+n.width/2,o={x:e,y:n.top+n.height/2};if(o.x<0||o.x>=window.innerWidth||o.y<0||o.y>=window.innerHeight)return!0;const i=document.elementFromPoint(o.x,o.y);if(!i)return!1;let r=i;for(;r&&r!==document.documentElement;){if(r===t)return!0;r=r.parentElement}return!1}catch{return!0}},x=t=>new Promise((e=>{const n=new Map,o=new IntersectionObserver((t=>{for(let e=0,o=t.length;e<o;e++){const o=t[e],i=o.target,r=o.boundingClientRect;o.isIntersecting&&r.width&&r.height&&n.set(i,r)}o.disconnect(),e(n)}));for(let e=0,n=t.length;e<n;e++){const n=t[e];o.observe(n)}}));return t.createShrinkwrap=()=>{const t=()=>{u&&u.clearRect(0,0,i.width/r,i.height/r)},n=document.createElement("div");n.setAttribute("data-react-scan","true");const o=n.attachShadow({mode:"open"});o.innerHTML='<canvas style="position:fixed;top:0;left:0;pointer-events:none;z-index:2147483646" aria-hidden="true"></canvas>';const i=o.firstChild;let r=Math.min(window.devicePixelRatio||1,2);const{innerWidth:s,innerHeight:c}=window;i.style.width=`${s}px`,i.style.height=`${c}px`;const a=s*r,l=c*r;i.width=a,i.height=l;const u=i.getContext("2d",{alpha:!0});u&&u.scale(r,r),o.appendChild(i),document.documentElement.appendChild(n);let d=!1;const f=()=>{d||(d=!0,setTimeout((()=>{const t=window.innerWidth,e=window.innerHeight;r=Math.min(window.devicePixelRatio||1,2),i.style.width=`${t}px`,i.style.height=`${e}px`,i.width=t*r,i.height=e*r,u&&(u.resetTransform(),u.scale(r,r)),O.trackInteractive(),d=!1})))};let p=!1;const g=()=>{p||(p=!0,setTimeout((()=>{requestAnimationFrame((()=>{O.trackInteractive()})),p=!1}),8))},A=new Set,O={draw(e){(async e=>{if(!u)return;const n=await x(e);t();const o=[];let i=0;const r=new Map,s=window.innerWidth,c=window.innerHeight;for(let t=0,a=e.length;t<a;t++){const a=e[t],l=n.get(a);if(!l)continue;const{width:d,height:h}=l,m=l.x,b=l.y;if(d/s>.97&&h/c>.97)continue;const f=`${i+1}`,p=16;u.textRendering="optimizeSpeed",u.font=`${p}px monospace`;const{width:g}=u.measureText(f);let _=b-p-4;_<0&&(_=0);const y={x:m,y:_,width:g+4,height:p+4};if(!o.some((t=>y.x<t.x+t.width&&y.x+y.width>t.x&&y.y<t.y+t.height&&y.y+y.height>t.y))){o.push(y),i++,r.set(a,i),u.beginPath(),u.rect(m,b,d,h);const e=w[t%w.length].join(",");u.fillStyle=`rgba(${e},0.1)`,u.strokeStyle=`rgba(${e})`,u.fill(),u.stroke(),u.fillStyle=`rgba(${e})`,u.fillRect(m,_,g+4,p+4),u.fillStyle="rgba(255,255,255)",u.fillText(f,m+2,_+p)}}return r})(e).then((t=>{if(!t)return;const e={};t.forEach(((t,n)=>{e[t]=n})),window.shrinkwrap={elementMap:e}}))},trackInteractive(){var t;t={onCommitFiberRoot(t,e){A.add(e);const n=[];for(const t of A)b(t.current,(t=>{m(t)&&_(t.stateNode)&&y(t.stateNode)&&v(t.stateNode)&&n.push(t.stateNode)}));O.draw(n)}},h((()=>{const n=h();t.onActive?.(),n._instrumentationSource=t.name??e;const o=n.onCommitFiberRoot;t.onCommitFiberRoot&&(n.onCommitFiberRoot=(e,n,i)=>{o&&o(e,n,i),t.onCommitFiberRoot?.(e,n,i)});const i=n.onCommitFiberUnmount;t.onCommitFiberUnmount&&(n.onCommitFiberUnmount=(e,n)=>{i&&i(e,n),t.onCommitFiberUnmount?.(e,n)});const r=n.onPostCommitFiberRoot;t.onPostCommitFiberRoot&&(n.onPostCommitFiberRoot=(e,n)=>{r&&r(e,n),t.onPostCommitFiberRoot?.(e,n)})}))},cleanup(){A.clear(),window.removeEventListener("scroll",g),window.removeEventListener("resize",f),document.documentElement.removeChild(n)}};return window.addEventListener("scroll",g),window.addEventListener("resize",f),O},t.getRectMap=x,t.isInteractive=_,t.isScrollable=t=>t.hasAttribute("aria-scrollable")||t.hasAttribute("scrollable")||"style"in t&&("auto"===t.style.overflow||"scroll"===t.style.overflow||"auto"===t.style.overflowY||"scroll"===t.style.overflowY||"auto"===t.style.overflowX||"scroll"===t.style.overflowX),t}({});
package/package.json ADDED
@@ -0,0 +1,124 @@
1
+ {
2
+ "name": "sidakram-bippy",
3
+ "version": "0.2.24",
4
+ "description": "hack into react internals",
5
+ "keywords": [
6
+ "bippy",
7
+ "react",
8
+ "react-instrumentation",
9
+ "react instrumentation",
10
+ "fiber",
11
+ "internals"
12
+ ],
13
+ "homepage": "https://bippy.dev",
14
+ "bugs": {
15
+ "url": "https://github.com/sidakram/bippy/issues"
16
+ },
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/sidakram/bippy.git"
20
+ },
21
+ "license": "MIT",
22
+ "author": {
23
+ "name": "Aiden Bai",
24
+ "email": "aiden@million.dev"
25
+ },
26
+ "sideEffects": false,
27
+ "type": "module",
28
+ "exports": {
29
+ "./package.json": "./package.json",
30
+ ".": {
31
+ "import": {
32
+ "types": "./dist/index.d.ts",
33
+ "default": "./dist/index.js"
34
+ },
35
+ "require": {
36
+ "types": "./dist/index.d.cts",
37
+ "default": "./dist/index.cjs"
38
+ }
39
+ },
40
+ "./core": {
41
+ "import": {
42
+ "types": "./dist/core.d.ts",
43
+ "default": "./dist/core.js"
44
+ },
45
+ "require": {
46
+ "types": "./dist/core.d.cts",
47
+ "default": "./dist/core.cjs"
48
+ }
49
+ },
50
+ "./sw": {
51
+ "import": {
52
+ "types": "./dist/sw.d.ts",
53
+ "default": "./dist/sw.js"
54
+ },
55
+ "require": {
56
+ "types": "./dist/sw.d.cts",
57
+ "default": "./dist/sw.cjs"
58
+ }
59
+ },
60
+ "./experiments/inspect": {
61
+ "import": {
62
+ "types": "./dist/experiments/inspect.d.ts",
63
+ "default": "./dist/experiments/inspect.js"
64
+ },
65
+ "require": {
66
+ "types": "./dist/experiments/inspect.d.cts",
67
+ "default": "./dist/experiments/inspect.cjs"
68
+ }
69
+ },
70
+ "./dist/*": "./dist/*.js",
71
+ "./dist/*.js": "./dist/*.js",
72
+ "./dist/*.cjs": "./dist/*.cjs",
73
+ "./dist/*.mjs": "./dist/*.mjs"
74
+ },
75
+ "main": "dist/index.js",
76
+ "module": "dist/index.js",
77
+ "browser": "dist/index.global.js",
78
+ "types": "dist/index.d.ts",
79
+ "files": [
80
+ "dist",
81
+ "bin",
82
+ "package.json",
83
+ "README.md",
84
+ "LICENSE"
85
+ ],
86
+ "devDependencies": {
87
+ "@biomejs/biome": "1.9.4",
88
+ "@testing-library/dom": "^10.4.0",
89
+ "@testing-library/react": "^16.1.0",
90
+ "@types/node": "^20",
91
+ "@types/react": "^19.0.4",
92
+ "@types/react-dom": "^19.0.2",
93
+ "@vitest/coverage-istanbul": "2.1.8",
94
+ "esbuild": "^0.24.2",
95
+ "happy-dom": "^15.11.7",
96
+ "pkg-pr-new": "^0.0.39",
97
+ "publint": "^0.2.12",
98
+ "react": "19.0.0",
99
+ "react-devtools-inline": "^6.0.1",
100
+ "react-dom": "19.0.0",
101
+ "react-inspector": "^6.0.2",
102
+ "react-reconciler": "^0.31.0",
103
+ "react-refresh": "^0.16.0",
104
+ "terser": "^5.36.0",
105
+ "tsup": "^8.2.4",
106
+ "vitest": "^2.1.8"
107
+ },
108
+ "publishConfig": {
109
+ "access": "public"
110
+ },
111
+ "peerDependencies": {
112
+ "react": ">=17.0.1"
113
+ },
114
+ "dependencies": {
115
+ "@types/react-reconciler": "^0.28.9"
116
+ },
117
+ "scripts": {
118
+ "build": "NODE_ENV=production tsup",
119
+ "dev": "NODE_ENV=development tsup --watch",
120
+ "publint": "publint",
121
+ "test": "vitest",
122
+ "coverage": "vitest run --coverage"
123
+ }
124
+ }