@lensmcp/react-instrumentation 1.18.7 → 1.18.10
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/lib/identity.d.ts +9 -0
- package/lib/identity.js +1 -1
- package/package.json +2 -2
package/lib/identity.d.ts
CHANGED
|
@@ -16,6 +16,15 @@ export declare function makeInstanceId(logicalId: string): {
|
|
|
16
16
|
* Cheap deterministic hash over an array of dependency values. Used by
|
|
17
17
|
* the traced hooks to compute `depsHash` so the reducer can decide
|
|
18
18
|
* whether a hook re-ran because of a dep change.
|
|
19
|
+
*
|
|
20
|
+
* IDENTITY semantics, deliberately: objects and functions hash by a stable
|
|
21
|
+
* per-reference id (a WeakMap registry), primitives by value — which is
|
|
22
|
+
* exactly how React itself compares deps (`Object.is` per slot). The old
|
|
23
|
+
* value hash (`JSON.stringify` per object dep, `fn.toString()` per function
|
|
24
|
+
* dep, per hook, per render) was BOTH the profiler's top self-time in commit
|
|
25
|
+
* storms AND less truthful: a re-created dep with equal content hashed
|
|
26
|
+
* "unchanged", hiding precisely the referential instability that makes a
|
|
27
|
+
* hook re-run — the thing this field exists to expose.
|
|
19
28
|
*/
|
|
20
29
|
export declare function depsHash(deps: readonly unknown[] | undefined): string;
|
|
21
30
|
/** Test hook to reset generation counters between smoke iterations. */
|
package/lib/identity.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var f=Object.defineProperty;var e=(t
|
|
1
|
+
"use strict";var f=Object.defineProperty;var e=(n,t)=>f(n,"name",{value:t,configurable:!0});var p=Object.defineProperty,o=e((n,t)=>p(n,"name",{value:t,configurable:!0}),"n");const s=new Map;let i=0;export function nextGeneration(n){const t=(s.get(n)??0)+1;return s.set(n,t),t}e(nextGeneration,"nextGeneration"),o(nextGeneration,"nextGeneration");export function shortHash(){return i=(i+1)%4294967295,(Date.now()&4095^i).toString(36).slice(-4)}e(shortHash,"shortHash"),o(shortHash,"shortHash");export function componentLogicalId(n,t){return`react:component:${n}:${t}`}e(componentLogicalId,"componentLogicalId"),o(componentLogicalId,"componentLogicalId");export function hookLogicalId(n,t,a,r){return`react:hook:${n}:${t}:${a}:${r}`}e(hookLogicalId,"hookLogicalId"),o(hookLogicalId,"hookLogicalId");export function slotLogicalId(n,t,a){return`react:slot:${n}:${t}:${a}`}e(slotLogicalId,"slotLogicalId"),o(slotLogicalId,"slotLogicalId");export function makeInstanceId(n){const t=nextGeneration(n);return{instanceId:`${n}#${t}#${shortHash()}`,generation:t}}e(makeInstanceId,"makeInstanceId"),o(makeInstanceId,"makeInstanceId");export function depsHash(n){if(!n)return"no-deps";let t=5381;const a=o(r=>{for(let c=0;c<r.length;c++)t=t*33^r.charCodeAt(c);t=t*33^59},"mix");for(const r of n){if(r===null){a("null");continue}const c=typeof r;a(c==="object"||c==="function"?`ref:${l(r)}`:`${c}:${String(r)}`)}return(t>>>0).toString(36)}e(depsHash,"depsHash"),o(depsHash,"depsHash");const u=new WeakMap;let d=1;function l(n){let t=u.get(n);return t===void 0&&(t=d++,u.set(n,t)),t}e(l,"p"),o(l,"refId");export function resetIdentityState(){s.clear(),i=0}e(resetIdentityState,"resetIdentityState"),o(resetIdentityState,"resetIdentityState");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lensmcp/react-instrumentation",
|
|
3
|
-
"version": "1.18.
|
|
3
|
+
"version": "1.18.10",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
}
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@lensmcp/protocol-types": "1.18.
|
|
22
|
+
"@lensmcp/protocol-types": "1.18.10",
|
|
23
23
|
"tslib": "^2.3.0"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|