You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

@rozenite/plugin-bridge

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rozenite/plugin-bridge - npm Package Compare versions

Comparing version
1.2.0
to
1.3.0
+20
LICENSE
MIT License
Copyright (c) 2025 Szymon Chmal
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+1
-1

@@ -1,1 +0,1 @@

{"version":3,"file":"cdp-channel.d.ts","sourceRoot":"","sources":["../../../src/channel/device/cdp-channel.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAGtC,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;AAE5D,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACxC,SAAS,EAAE;QACT,gBAAgB,EAAE,CAAC,QAAQ,EAAE,kBAAkB,KAAK,IAAI,CAAC;QACzD,mBAAmB,EAAE,CAAC,QAAQ,EAAE,kBAAkB,KAAK,IAAI,CAAC;KAC7D,CAAC;IACF,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB,CAAC;AA0GF,eAAO,MAAM,aAAa,QAAa,OAAO,CAAC,OAAO,CAMrD,CAAC"}
{"version":3,"file":"cdp-channel.d.ts","sourceRoot":"","sources":["../../../src/channel/device/cdp-channel.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAGtC,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;AAE5D,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACxC,SAAS,EAAE;QACT,gBAAgB,EAAE,CAAC,QAAQ,EAAE,kBAAkB,KAAK,IAAI,CAAC;QACzD,mBAAmB,EAAE,CAAC,QAAQ,EAAE,kBAAkB,KAAK,IAAI,CAAC;KAC7D,CAAC;IACF,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB,CAAC;AA0GF,eAAO,MAAM,aAAa,QAAa,OAAO,CAAC,OAAO,CAUrD,CAAC"}
export declare class UnsupportedPlatformError extends Error {
constructor(platform: string);
}
export declare class MissingRozeniteForWebError extends Error {
constructor();
}
//# sourceMappingURL=errors.d.ts.map

@@ -1,1 +0,1 @@

{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,wBAAyB,SAAQ,KAAK;gBACrC,QAAQ,EAAE,MAAM;CAI7B"}
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,wBAAyB,SAAQ,KAAK;gBACrC,QAAQ,EAAE,MAAM;CAI7B;AAED,qBAAa,0BAA2B,SAAQ,KAAK;;CAOpD"}

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react"),f=()=>typeof window<"u"&&typeof window.document<"u";class E extends Error{constructor(n){super(`Unsupported platform: ${n}`),this.name="UnsupportedPlatformError"}}const _="rozenite",w=()=>{const e=global.__FUSEBOX_REACT_DEVTOOLS_DISPATCHER__,n=e.BINDING_NAME;return global[n]!=null?e.initializeDomain(_):null},m=()=>new Promise(e=>{const n=t=>{t.name===_&&(global.__FUSEBOX_REACT_DEVTOOLS_DISPATCHER__.onDomainInitialization.removeEventListener(n),setTimeout(()=>e(t)))};global.__FUSEBOX_REACT_DEVTOOLS_DISPATCHER__.onDomainInitialization.addEventListener(n)}),D=async()=>{const e=new Set;let n=w();n||(n=await m());const t=()=>{if(!n)throw new Error("Domain not initialized");return n},l=s=>{s.name===_&&(n&&e.forEach(o=>{n.onMessage.removeEventListener(o)}),n=s,e.forEach(o=>{s.onMessage.addEventListener(o)}))};return global.__FUSEBOX_REACT_DEVTOOLS_DISPATCHER__.onDomainInitialization.addEventListener(l),{send:s=>{t().sendMessage(s)},onMessage(s){const o=i=>{setTimeout(()=>{s(i)})};return e.add(o),t().onMessage.addEventListener(o),{remove:()=>{e.delete(o),t().onMessage.removeEventListener(o)}}},close:()=>{global.__FUSEBOX_REACT_DEVTOOLS_DISPATCHER__.onDomainInitialization.removeEventListener(l)}}},v=async()=>{if(f())throw new E("web");return D()},y=async()=>{const e=new Set,n=t=>{e.forEach(l=>{l(t.data)})};return window.addEventListener("message",n),{send:t=>{window.parent.postMessage({type:"rozenite-message",payload:t},"*")},onMessage:t=>(e.add(t),{remove:()=>{e.delete(t)}}),close:()=>{e.clear(),window.removeEventListener("message",n)}}};let c=null;const T=async()=>{if(c)return c;const n="__ROZENITE_PANEL__"in window?y():v();c=n;try{const t=await n;return c=t,t}catch(t){throw c=null,t}},h=e=>typeof e!="object"||e===null||!("type"in e)||!("payload"in e)||!("pluginId"in e)?null:e,C=async e=>{const n=await T(),t=new Map,l=async i=>{const r=h(i);if(!r||r.pluginId!==e)return;const a=t.get(r.type);a!=null&&a.forEach(p=>{p(r.payload)})},d=(i,r)=>{n.send({pluginId:e,type:i,payload:r})},s=n.onMessage(l);return{send:d,onMessage:(i,r)=>{const a=t.get(i)??new Set;return a.add(r),t.set(i,a),{remove:()=>{a.delete(r)}}},close:()=>{t.clear(),s.remove(),n.close()}}},g=async e=>C(e),S=({pluginId:e})=>{const[n,t]=u.useState(null),[l,d]=u.useState(null);if(u.useEffect(()=>{let s=!0,o=null;const i=async()=>{try{o=await g(e),s&&t(o)}catch(a){if(a instanceof E){console.warn(`[Rozenite, ${e}] Unsupported platform, skipping setup.`);return}console.error("Error setting up client",a),s&&d(a)}},r=async()=>{try{o!=null&&o.close()}catch{}};return i(),()=>{s=!1,r()}},[e]),l!=null)throw l;return n};exports.UnsupportedPlatformError=E;exports.getRozeniteDevToolsClient=g;exports.useRozeniteDevToolsClient=S;
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react"),g=()=>typeof window<"u"&&typeof window.document<"u",m=()=>g()&&typeof window.__ROZENITE_WEB__<"u",v=()=>typeof window>"u";class E extends Error{constructor(n){super(`Unsupported platform: ${n}`),this.name="UnsupportedPlatformError"}}class f extends Error{constructor(){super("Rozenite for web is not configured. A separate integration is required for web. Consult Rozenite docs for details."),this.name="MissingRozeniteForWebError"}}const _="rozenite",y=()=>{const e=global.__FUSEBOX_REACT_DEVTOOLS_DISPATCHER__,n=e.BINDING_NAME;return global[n]!=null?e.initializeDomain(_):null},D=()=>new Promise(e=>{const n=t=>{t.name===_&&(global.__FUSEBOX_REACT_DEVTOOLS_DISPATCHER__.onDomainInitialization.removeEventListener(n),setTimeout(()=>e(t)))};global.__FUSEBOX_REACT_DEVTOOLS_DISPATCHER__.onDomainInitialization.addEventListener(n)}),R=async()=>{const e=new Set;let n=y();n||(n=await D());const t=()=>{if(!n)throw new Error("Domain not initialized");return n},l=r=>{r.name===_&&(n&&e.forEach(o=>{n.onMessage.removeEventListener(o)}),n=r,e.forEach(o=>{r.onMessage.addEventListener(o)}))};return global.__FUSEBOX_REACT_DEVTOOLS_DISPATCHER__.onDomainInitialization.addEventListener(l),{send:r=>{t().sendMessage(r)},onMessage(r){const o=a=>{setTimeout(()=>{r(a)})};return e.add(o),t().onMessage.addEventListener(o),{remove:()=>{e.delete(o),t().onMessage.removeEventListener(o)}}},close:()=>{global.__FUSEBOX_REACT_DEVTOOLS_DISPATCHER__.onDomainInitialization.removeEventListener(l)}}},T=async()=>{if(g()&&!m())throw new f;if(v())throw new E("server");return R()},h=async()=>{const e=new Set,n=t=>{e.forEach(l=>{l(t.data)})};return window.addEventListener("message",n),{send:t=>{window.parent.postMessage({type:"rozenite-message",payload:t},"*")},onMessage:t=>(e.add(t),{remove:()=>{e.delete(t)}}),close:()=>{e.clear(),window.removeEventListener("message",n)}}};let c=null;const z=async()=>{if(c)return c;const n="__ROZENITE_PANEL__"in window?h():T();c=n;try{const t=await n;return c=t,t}catch(t){throw c=null,t}},C=e=>typeof e!="object"||e===null||!("type"in e)||!("payload"in e)||!("pluginId"in e)?null:e,S=async e=>{const n=await z(),t=new Map,l=async a=>{const s=C(a);if(!s||s.pluginId!==e)return;const i=t.get(s.type);i?.forEach(p=>{p(s.payload)})},d=(a,s)=>{n.send({pluginId:e,type:a,payload:s})},r=n.onMessage(l);return{send:d,onMessage:(a,s)=>{const i=t.get(a)??new Set;return i.add(s),t.set(a,i),{remove:()=>{i.delete(s)}}},close:()=>{t.clear(),r.remove(),n.close()}}},w=async e=>S(e),b=({pluginId:e})=>{const[n,t]=u.useState(null),[l,d]=u.useState(null);if(u.useEffect(()=>{let r=!0,o=null;const a=async()=>{try{o=await w(e),r&&t(o)}catch(i){if(i instanceof f){console.warn(`[Rozenite, ${e}] Rozenite for web is not configured. A separate integration is required for web. Consult Rozenite docs for details.`);return}if(i instanceof E){console.warn(`[Rozenite, ${e}] Unsupported platform, skipping setup.`);return}console.error(`[Rozenite, ${e}] Error setting up client.`,i),r&&d(i)}},s=async()=>{try{o?.close()}catch{}};return a(),()=>{r=!1,s()}},[e]),l!=null)throw l;return n};exports.MissingRozeniteForWebError=f;exports.UnsupportedPlatformError=E;exports.getRozeniteDevToolsClient=w;exports.useRozeniteDevToolsClient=b;

@@ -6,3 +6,3 @@ export { useRozeniteDevToolsClient } from './useRozeniteDevToolsClient';

export { getRozeniteDevToolsClient } from './client';
export { UnsupportedPlatformError } from './errors';
export { UnsupportedPlatformError, MissingRozeniteForWebError } from './errors';
//# sourceMappingURL=index.d.ts.map

@@ -1,1 +0,1 @@

{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,YAAY,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AACvD,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5C,YAAY,EAAE,gCAAgC,EAAE,MAAM,6BAA6B,CAAC;AACpF,OAAO,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AACrD,OAAO,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC"}
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,YAAY,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AACvD,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5C,YAAY,EAAE,gCAAgC,EAAE,MAAM,6BAA6B,CAAC;AACpF,OAAO,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AACrD,OAAO,EAAE,wBAAwB,EAAE,0BAA0B,EAAE,MAAM,UAAU,CAAC"}

@@ -1,3 +0,3 @@

import { useState as E, useEffect as f } from "react";
const g = () => typeof window < "u" && typeof window.document < "u";
import { useState as E, useEffect as p } from "react";
const f = () => typeof window < "u" && typeof window.document < "u", m = () => f() && typeof window.__ROZENITE_WEB__ < "u", v = () => typeof window > "u";
class _ extends Error {

@@ -8,6 +8,13 @@ constructor(n) {

}
const u = "rozenite", w = () => {
class w extends Error {
constructor() {
super(
"Rozenite for web is not configured. A separate integration is required for web. Consult Rozenite docs for details."
), this.name = "MissingRozeniteForWebError";
}
}
const u = "rozenite", y = () => {
const e = global.__FUSEBOX_REACT_DEVTOOLS_DISPATCHER__, n = e.BINDING_NAME;
return global[n] != null ? e.initializeDomain(u) : null;
}, m = () => new Promise((e) => {
}, D = () => new Promise((e) => {
const n = (t) => {

@@ -21,6 +28,6 @@ t.name === u && (global.__FUSEBOX_REACT_DEVTOOLS_DISPATCHER__.onDomainInitialization.removeEventListener(

);
}), D = async () => {
}), R = async () => {
const e = /* @__PURE__ */ new Set();
let n = w();
n || (n = await m());
let n = y();
n || (n = await D());
const t = () => {

@@ -30,7 +37,7 @@ if (!n)

return n;
}, l = (s) => {
s.name === u && (n && e.forEach((o) => {
}, l = (r) => {
r.name === u && (n && e.forEach((o) => {
n.onMessage.removeEventListener(o);
}), n = s, e.forEach((o) => {
s.onMessage.addEventListener(o);
}), n = r, e.forEach((o) => {
r.onMessage.addEventListener(o);
}));

@@ -41,9 +48,9 @@ };

), {
send: (s) => {
t().sendMessage(s);
send: (r) => {
t().sendMessage(r);
},
onMessage(s) {
const o = (i) => {
onMessage(r) {
const o = (a) => {
setTimeout(() => {
s(i);
r(a);
});

@@ -63,7 +70,9 @@ };

};
}, v = async () => {
if (g())
throw new _("web");
return D();
}, y = async () => {
}, h = async () => {
if (f() && !m())
throw new w();
if (v())
throw new _("server");
return R();
}, T = async () => {
const e = /* @__PURE__ */ new Set(), n = (t) => {

@@ -92,6 +101,6 @@ e.forEach((l) => {

let c = null;
const h = async () => {
const C = async () => {
if (c)
return c;
const n = "__ROZENITE_PANEL__" in window ? y() : v();
const n = "__ROZENITE_PANEL__" in window ? T() : h();
c = n;

@@ -104,25 +113,25 @@ try {

}
}, T = (e) => typeof e != "object" || e === null || !("type" in e) || !("payload" in e) || !("pluginId" in e) ? null : e, C = async (e) => {
const n = await h(), t = /* @__PURE__ */ new Map(), l = async (i) => {
const r = T(i);
if (!r || r.pluginId !== e)
}, z = (e) => typeof e != "object" || e === null || !("type" in e) || !("payload" in e) || !("pluginId" in e) ? null : e, L = async (e) => {
const n = await C(), t = /* @__PURE__ */ new Map(), l = async (a) => {
const s = z(a);
if (!s || s.pluginId !== e)
return;
const a = t.get(r.type);
a != null && a.forEach((p) => {
p(r.payload);
const i = t.get(s.type);
i?.forEach((g) => {
g(s.payload);
});
}, d = (i, r) => {
}, d = (a, s) => {
n.send({
pluginId: e,
type: i,
payload: r
type: a,
payload: s
});
}, s = n.onMessage(l);
}, r = n.onMessage(l);
return {
send: d,
onMessage: (i, r) => {
const a = t.get(i) ?? /* @__PURE__ */ new Set();
return a.add(r), t.set(i, a), {
onMessage: (a, s) => {
const i = t.get(a) ?? /* @__PURE__ */ new Set();
return i.add(s), t.set(a, i), {
remove: () => {
a.delete(r);
i.delete(s);
}

@@ -132,17 +141,23 @@ };

close: () => {
t.clear(), s.remove(), n.close();
t.clear(), r.remove(), n.close();
}
};
}, L = async (e) => C(e), M = ({
}, M = async (e) => L(e), b = ({
pluginId: e
}) => {
const [n, t] = E(null), [l, d] = E(null);
if (f(() => {
let s = !0, o = null;
const i = async () => {
if (p(() => {
let r = !0, o = null;
const a = async () => {
try {
o = await L(e), s && t(o);
} catch (a) {
if (a instanceof _) {
o = await M(e), r && t(o);
} catch (i) {
if (i instanceof w) {
console.warn(
`[Rozenite, ${e}] Rozenite for web is not configured. A separate integration is required for web. Consult Rozenite docs for details.`
);
return;
}
if (i instanceof _) {
console.warn(
`[Rozenite, ${e}] Unsupported platform, skipping setup.`

@@ -152,12 +167,12 @@ );

}
console.error("Error setting up client", a), s && d(a);
console.error(`[Rozenite, ${e}] Error setting up client.`, i), r && d(i);
}
}, r = async () => {
}, s = async () => {
try {
o != null && o.close();
o?.close();
} catch {
}
};
return i(), () => {
s = !1, r();
return a(), () => {
r = !1, s();
};

@@ -169,5 +184,6 @@ }, [e]), l != null)

export {
w as MissingRozeniteForWebError,
_ as UnsupportedPlatformError,
L as getRozeniteDevToolsClient,
M as useRozeniteDevToolsClient
M as getRozeniteDevToolsClient,
b as useRozeniteDevToolsClient
};

@@ -1,1 +0,1 @@

{"version":3,"file":"useRozeniteDevToolsClient.d.ts","sourceRoot":"","sources":["../src/useRozeniteDevToolsClient.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAA6B,MAAM,UAAU,CAAC;AAG7E,MAAM,MAAM,gCAAgC,CAC1C,SAAS,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IACjE;IACF,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,CAAC;AAGF,eAAO,MAAM,yBAAyB,GACpC,SAAS,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACnE,eAEC,gCAAgC,CAAC,SAAS,CAAC,KAAG,sBAAsB,CAAC,SAAS,CAAC,GAAG,IAuDpF,CAAC"}
{"version":3,"file":"useRozeniteDevToolsClient.d.ts","sourceRoot":"","sources":["../src/useRozeniteDevToolsClient.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAA6B,MAAM,UAAU,CAAC;AAG7E,MAAM,MAAM,gCAAgC,CAC1C,SAAS,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IACjE;IACF,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,CAAC;AAGF,eAAO,MAAM,yBAAyB,GACpC,SAAS,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACnE,eAEC,gCAAgC,CAAC,SAAS,CAAC,KAAG,sBAAsB,CAAC,SAAS,CAAC,GAAG,IA+DpF,CAAC"}
export declare const isWeb: () => boolean;
declare global {
var __ROZENITE_WEB__: unknown;
}
export declare const isRozeniteWeb: () => boolean;
export declare const isServer: () => boolean;
//# sourceMappingURL=web.d.ts.map

@@ -1,1 +0,1 @@

{"version":3,"file":"web.d.ts","sourceRoot":"","sources":["../src/web.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,KAAK,QAAO,OAKxB,CAAC"}
{"version":3,"file":"web.d.ts","sourceRoot":"","sources":["../src/web.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,KAAK,QAAO,OAKxB,CAAC;AAGF,OAAO,CAAC,MAAM,CAAC;IACb,IAAI,gBAAgB,EAAE,OAAO,CAAC;CAC/B;AAED,eAAO,MAAM,aAAa,QAAO,OAEhC,CAAC;AAEF,eAAO,MAAM,QAAQ,QAAO,OAE3B,CAAC"}
{
"name": "@rozenite/plugin-bridge",
"version": "1.2.0",
"version": "1.3.0",
"description": "Communication layer for React Native DevTools plugins across React Native and web environments",

@@ -45,3 +45,8 @@ "type": "module",

"node": ">=20"
},
"scripts": {
"build": "vite build",
"typecheck": "tsc -p tsconfig.lib.json --noEmit",
"lint": "eslint ."
}
}
}