@lensmcp/client-runtime 1.18.12 → 1.18.14

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/auto.js CHANGED
@@ -1 +1 @@
1
- "use strict";var u=Object.defineProperty;var n=(e,t)=>u(e,"name",{value:t,configurable:!0});var f=Object.defineProperty,i=n((e,t)=>f(e,"name",{value:t,configurable:!0}),"o");import{installClientRuntime as p}from"./install.js";const _=5747,m="127.0.0.1";export function resolveLensmcpWsUrl(e){if(e)return e;const t=globalThis,o=t.__LENSMCP_WS_URL__;if(typeof o=="string"&&o.length>0)return o;const l=r("lensmcp-ws");if(l)return l;const s=t.__LENSMCP_WS_PORT__,a=typeof s=="number"||typeof s=="string"?String(s):r("lensmcp-ws-port")??String(_),c=t.__LENSMCP_WS_HOST__;return`ws://${typeof c=="string"&&c.length>0?c:r("lensmcp-ws-host")??(typeof location<"u"&&location.hostname?location.hostname:m)}:${a}`}n(resolveLensmcpWsUrl,"resolveLensmcpWsUrl"),i(resolveLensmcpWsUrl,"resolveLensmcpWsUrl");export function installLensmcp(e={}){if(typeof window>"u")return;const t={wsUrl:resolveLensmcpWsUrl(e.wsUrl)};e.reconnectIntervalMs!==void 0&&(t.reconnectIntervalMs=e.reconnectIntervalMs),p(t)}n(installLensmcp,"installLensmcp"),i(installLensmcp,"installLensmcp");function r(e){if(!(typeof document>"u"))try{const t=document.querySelector(`meta[name="${e}"]`)?.getAttribute("content");return t&&t.length>0?t:void 0}catch{return}}n(r,"c"),i(r,"readMeta");
1
+ "use strict";var p=Object.defineProperty;var n=(e,t)=>p(e,"name",{value:t,configurable:!0});var m=Object.defineProperty,o=n((e,t)=>m(e,"name",{value:t,configurable:!0}),"n"),f=Object.defineProperty,i=o((e,t)=>f(e,"name",{value:t,configurable:!0}),"o");import{installClientRuntime as _}from"./install.js";const v=5747,g="127.0.0.1";export function resolveLensmcpWsUrl(e){if(e)return e;const t=globalThis,s=t.__LENSMCP_WS_URL__;if(typeof s=="string"&&s.length>0)return s;const a=r("lensmcp-ws");if(a)return a;const c=t.__LENSMCP_WS_PORT__,u=typeof c=="number"||typeof c=="string"?String(c):r("lensmcp-ws-port")??String(v),l=t.__LENSMCP_WS_HOST__;return`ws://${typeof l=="string"&&l.length>0?l:r("lensmcp-ws-host")??(typeof location<"u"&&location.hostname?location.hostname:g)}:${u}`}n(resolveLensmcpWsUrl,"resolveLensmcpWsUrl"),o(resolveLensmcpWsUrl,"resolveLensmcpWsUrl"),i(resolveLensmcpWsUrl,"resolveLensmcpWsUrl");export function installLensmcp(e={}){if(typeof window>"u")return;const t={wsUrl:resolveLensmcpWsUrl(e.wsUrl)};e.reconnectIntervalMs!==void 0&&(t.reconnectIntervalMs=e.reconnectIntervalMs),_(t)}n(installLensmcp,"installLensmcp"),o(installLensmcp,"installLensmcp"),i(installLensmcp,"installLensmcp");function r(e){if(!(typeof document>"u"))try{const t=document.querySelector(`meta[name="${e}"]`)?.getAttribute("content");return t&&t.length>0?t:void 0}catch{return}}n(r,"r"),o(r,"c"),i(r,"readMeta");
package/lib/install.js CHANGED
@@ -1 +1 @@
1
- "use strict";var D=Object.defineProperty;var u=(n,o)=>D(n,"name",{value:o,configurable:!0});var O=Object.defineProperty,a=u((n,o)=>O(n,"name",{value:o,configurable:!0}),"c");const L="__LENSMCP_CLIENT__";export function installClientRuntime(n){if(typeof window>"u"||window[L])return;window[L]=!0;const o=n.wsUrl,y=n.reconnectIntervalMs??1e3;let i=null,p=!1;const f=[];let d=[],h=!1;const S=a(()=>{if(h=!1,!d.length)return;const t=d;if(d=[],i&&i.readyState===1)try{i.send(JSON.stringify(t.length===1?t[0]:{kind:"batch",at:Date.now(),events:t}));return}catch{}for(const e of t)f.push(e)},"flushBatch"),s=a(t=>{t.at=Date.now(),d.push(t),h||(h=!0,setTimeout(S,0))},"send");window.addEventListener("pagehide",S);const g=a(()=>{try{i=new WebSocket(o)}catch{setTimeout(g,y);return}i.addEventListener("open",()=>{for(p=!0;f.length;){const t=f.splice(0,200);try{i.send(JSON.stringify(t.length===1?t[0]:{kind:"batch",at:Date.now(),events:t}))}catch{}}s({kind:"ready",userAgent:navigator.userAgent,url:location.href})}),i.addEventListener("close",()=>{p&&setTimeout(g,y)}),i.addEventListener("error",()=>{})},"open");g(),window.__LENSMCP_PUBLISH__=t=>{s({kind:"publish",...t})},window.addEventListener("error",t=>{const e=t.target;if(e&&e!==window&&e.tagName&&!t.message){s({kind:"resource-error",tagName:e.tagName.toLowerCase(),url:e.currentSrc||e.src||e.href||void 0});return}const r=t.error;s({kind:"error",message:t.message,name:r?.name,stack:l(r?.stack),source:t.filename,lineno:t.lineno,colno:t.colno})},!0),window.addEventListener("unhandledrejection",t=>{const e=t.reason;s({kind:"unhandledrejection",reason:l(E(e)),name:typeof e=="object"&&e?e.name:void 0,stack:typeof e=="object"&&e?l(e.stack):void 0})});const _=["log","info","warn","error","debug"];for(const t of _){const e=console[t];console[t]=function(...r){try{s({kind:"console",level:t,args:r.map(N)})}catch{}e.apply(console,r)}}const T=window.fetch.bind(window);window.fetch=async function(t,e){const r=e?.method??(typeof t=="object"&&t&&"method"in t?t.method:"GET"),k=typeof t=="string"?t:t instanceof URL?t.toString():t.url,v=Date.now();try{const c=await T(t,e);return s({kind:"fetch",method:r,url:k,status:c.status,statusText:c.statusText,ok:c.ok,durationMs:Date.now()-v}),c}catch(c){const b=c;throw s({kind:"fetch",method:r,url:k,error:b.message??String(b),durationMs:Date.now()-v}),c}};const j=history.pushState.bind(history),C=history.replaceState.bind(history),w=a(t=>s({kind:"route",url:location.href,from:t}),"notify");history.pushState=function(...t){const e=location.href,r=j(...t);return w(e),r},history.replaceState=function(...t){const e=location.href,r=C(...t);return w(e),r},window.addEventListener("popstate",()=>w())}u(installClientRuntime,"installClientRuntime"),a(installClientRuntime,"installClientRuntime");const m=4096;function l(n){return n===void 0||n.length<=m?n:`${n.slice(0,m)}\u2026[lensmcp truncated: ${n.length-m} more chars]`}u(l,"w"),a(l,"clipStack");function E(n){if(n==null)return String(n);if(typeof n=="string")return n;if(typeof n.message=="string"&&n.message)return n.message;try{const o=JSON.stringify(n);if(o&&o!=="{}"&&o!=="null")return o}catch{}return String(n)}u(E,"j"),a(E,"describeReason");function N(n){if(n===null)return null;const o=typeof n;if(o==="string"||o==="number"||o==="boolean")return n;try{return JSON.parse(JSON.stringify(n))}catch{return String(n)}}u(N,"A"),a(N,"safe");
1
+ "use strict";var D=Object.defineProperty;var u=(t,r)=>D(t,"name",{value:r,configurable:!0});var J=Object.defineProperty,l=u((t,r)=>J(t,"name",{value:r,configurable:!0}),"u"),M=Object.defineProperty,a=l((t,r)=>M(t,"name",{value:r,configurable:!0}),"c");const _="__LENSMCP_CLIENT__";export function installClientRuntime(t){if(typeof window>"u"||window[_])return;window[_]=!0;const r=t.wsUrl,S=t.reconnectIntervalMs??1e3;let i=null,k=!1;const h=[];let f=[],g=!1;const b=a(()=>{if(g=!1,!f.length)return;const e=f;if(f=[],i&&i.readyState===1)try{i.send(JSON.stringify(e.length===1?e[0]:{kind:"batch",at:Date.now(),events:e}));return}catch{}for(const n of e)h.push(n)},"flushBatch"),s=a(e=>{e.at=Date.now(),f.push(e),g||(g=!0,setTimeout(b,0))},"send");window.addEventListener("pagehide",b);const w=a(()=>{try{i=new WebSocket(r)}catch{setTimeout(w,S);return}i.addEventListener("open",()=>{for(k=!0;h.length;){const e=h.splice(0,200);try{i.send(JSON.stringify(e.length===1?e[0]:{kind:"batch",at:Date.now(),events:e}))}catch{}}s({kind:"ready",userAgent:navigator.userAgent,url:location.href})}),i.addEventListener("close",()=>{k&&setTimeout(w,S)}),i.addEventListener("error",()=>{})},"open");w(),window.__LENSMCP_PUBLISH__=e=>{s({kind:"publish",...e})},window.addEventListener("error",e=>{const n=e.target;if(n&&n!==window&&n.tagName&&!e.message){s({kind:"resource-error",tagName:n.tagName.toLowerCase(),url:n.currentSrc||n.src||n.href||void 0});return}const o=e.error;s({kind:"error",message:e.message,name:o?.name,stack:d(o?.stack),source:e.filename,lineno:e.lineno,colno:e.colno})},!0),window.addEventListener("unhandledrejection",e=>{const n=e.reason;s({kind:"unhandledrejection",reason:d(p(n)),name:typeof n=="object"&&n?n.name:void 0,stack:typeof n=="object"&&n?d(n.stack):void 0})});const j=["log","info","warn","error","debug"];for(const e of j){const n=console[e];console[e]=function(...o){try{s({kind:"console",level:e,args:o.map(v)})}catch{}n.apply(console,o)}}const C=window.fetch.bind(window);window.fetch=async function(e,n){const o=n?.method??(typeof e=="object"&&e&&"method"in e?e.method:"GET"),L=typeof e=="string"?e:e instanceof URL?e.toString():e.url,E=Date.now();try{const c=await C(e,n);return s({kind:"fetch",method:o,url:L,status:c.status,statusText:c.statusText,ok:c.ok,durationMs:Date.now()-E}),c}catch(c){const N=c;throw s({kind:"fetch",method:o,url:L,error:N.message??String(N),durationMs:Date.now()-E}),c}};const O=history.pushState.bind(history),T=history.replaceState.bind(history),m=a(e=>s({kind:"route",url:location.href,from:e}),"notify");history.pushState=function(...e){const n=location.href,o=O(...e);return m(n),o},history.replaceState=function(...e){const n=location.href,o=T(...e);return m(n),o},window.addEventListener("popstate",()=>m())}u(installClientRuntime,"installClientRuntime"),l(installClientRuntime,"installClientRuntime"),a(installClientRuntime,"installClientRuntime");const y=4096;function d(t){return t===void 0||t.length<=y?t:`${t.slice(0,y)}\u2026[lensmcp truncated: ${t.length-y} more chars]`}u(d,"l"),l(d,"w"),a(d,"clipStack");function p(t){if(t==null)return String(t);if(typeof t=="string")return t;if(typeof t.message=="string"&&t.message)return t.message;try{const r=JSON.stringify(t);if(r&&r!=="{}"&&r!=="null")return r}catch{}return String(t)}u(p,"E"),l(p,"j"),a(p,"describeReason");function v(t){if(t===null)return null;const r=typeof t;if(r==="string"||r==="number"||r==="boolean")return t;try{return JSON.parse(JSON.stringify(t))}catch{return String(t)}}u(v,"N"),l(v,"A"),a(v,"safe");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lensmcp/client-runtime",
3
- "version": "1.18.12",
3
+ "version": "1.18.14",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "module": "./index.js",