@popmelt.com/core 0.28.1 → 0.28.3
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/README.md +4 -2
- package/claude-plugin/.claude-plugin/plugin.json +1 -1
- package/codex-plugin/.codex-plugin/plugin.json +1 -1
- package/dist/{ParticipantRuntime-JUOBT3CY.mjs → ParticipantRuntime-R2Q5LRIU.mjs} +10 -10
- package/dist/bridge-entry.mjs +1 -1
- package/dist/{browser-runtime-6KNOQXAJ.mjs → browser-runtime-4CQV2VBX.mjs} +1 -1
- package/dist/browser.mjs +1 -1
- package/dist/chunk-4HMA3W7T.mjs +369 -0
- package/dist/{chunk-W4VRK56P.mjs → chunk-COTSHFE4.mjs} +18 -18
- package/dist/{chunk-VRFM3TLR.mjs → chunk-HVC52TRT.mjs} +1 -1
- package/dist/{chunk-35UEAIRA.mjs → chunk-JOCMNLL7.mjs} +66 -66
- package/dist/cli.mjs +95 -95
- package/dist/index.mjs +1 -1
- package/dist/plugin-astro.mjs +1 -1
- package/dist/plugin-nuxt.mjs +1 -1
- package/dist/plugin-vite.mjs +1 -1
- package/dist/server.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-3THBMCJW.mjs +0 -369
- /package/dist/{chunk-3NTTM74X.mjs → chunk-OF6AFYLB.mjs} +0 -0
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
export{b as PopmeltProvider}from"./chunk-
|
|
2
|
+
export{b as PopmeltProvider}from"./chunk-4HMA3W7T.mjs";import"./chunk-COTSHFE4.mjs";import"./chunk-JQHZFDY5.mjs";export{a as isPopmeltPreview}from"./chunk-EX63NVDN.mjs";import"./chunk-N2ZEZCHO.mjs";export{b as usePopmelt}from"./chunk-J3UIBBU2.mjs";import"./chunk-3LBOX7HQ.mjs";import"./chunk-QUNV5PNI.mjs";import"./chunk-A2UXK7AS.mjs";import"./chunk-MP7S5ALD.mjs";import"./chunk-XTOCFTVW.mjs";import"./chunk-LVEMYZOA.mjs";import"./chunk-XOGBFVWI.mjs";import"./chunk-HGW2U6PD.mjs";
|
package/dist/plugin-astro.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as o}from"./chunk-
|
|
1
|
+
import{a as o}from"./chunk-HVC52TRT.mjs";import"./chunk-OF6AFYLB.mjs";import"./chunk-NOHXTT24.mjs";import{fileURLToPath as d}from"url";function c(t={}){return{name:"popmelt",hooks:{"astro:config:setup"({command:r,config:i,updateConfig:n,injectScript:p}){if(r!=="dev")return;let{client:e=!0,multiplayer:a=!1,...s}=t;n({vite:{plugins:[o({...s,projectRoot:t.projectRoot??d(i.root)})],optimizeDeps:{include:e?["react","react/jsx-runtime","react/jsx-dev-runtime","react-dom","react-dom/client","lucide-react"]:[]}}}),p("page",e?l(a):`
|
|
2
2
|
import { bridgeUrl, projectId } from 'virtual:popmelt/bridge';
|
|
3
3
|
if (bridgeUrl) window.__POPMELT_BRIDGE_URL__ = bridgeUrl;
|
|
4
4
|
if (projectId) window.__POPMELT_PROJECT_ID__ = projectId;
|
package/dist/plugin-nuxt.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as s,b as l}from"./chunk-
|
|
1
|
+
import{a as s,b as l}from"./chunk-OF6AFYLB.mjs";import{b as i}from"./chunk-NOHXTT24.mjs";import{addPluginTemplate as d,defineNuxtModule as m}from"nuxt/kit";var a=m({meta:{name:"@popmelt.com/core/nuxt",configKey:"popmelt"},async setup(o,e){if(!e.options.dev)return;let n={config:{server:e.options.devServer},middlewares:{use(){}}},t=await s({...o,projectRoot:o.projectRoot??e.options.rootDir},n,3e3);if(t.port===null)return;e.hook("vite:extend",({config:p})=>{p.optimizeDeps??={},p.optimizeDeps.include=[...new Set([...p.optimizeDeps.include??[],"react","react/jsx-runtime","react/jsx-dev-runtime","react-dom","react-dom/client","lucide-react"])]});let r=await l(t,n),u=r?i(r):void 0;e.hook("close",async()=>{u?.(),await r?.release()}),d({filename:"popmelt.client.mjs",mode:"client",getContents:()=>`import { defineNuxtPlugin } from '#app';
|
|
2
2
|
export default defineNuxtPlugin((nuxtApp) => {
|
|
3
3
|
let disposed = false;
|
|
4
4
|
let mounting;
|
package/dist/plugin-vite.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a}from"./chunk-HVC52TRT.mjs";import"./chunk-OF6AFYLB.mjs";import"./chunk-NOHXTT24.mjs";export{a as popmelt};
|
package/dist/server.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as $,b as v,c as ee,d as te,e as re,f as oe,g as M,h as B,i as L,j as H}from"./chunk-
|
|
1
|
+
import{a as $,b as v,c as ee,d as te,e as re,f as oe,g as M,h as B,i as L,j as H}from"./chunk-JOCMNLL7.mjs";import{a as X,b as Z}from"./chunk-GL4I4MI6.mjs";import"./chunk-QXVMGZFP.mjs";import{a as J,b as U}from"./chunk-NOHXTT24.mjs";import{spawn as Pe}from"child_process";import{closeSync as ye,openSync as _e}from"fs";import{appendFile as Ee,mkdir as Te,readFile as Oe,realpath as Ie}from"fs/promises";import{dirname as Se,join as A}from"path";import{fileURLToPath as Re}from"url";import{spawn as ne}from"child_process";import{mkdtemp as ie,readFile as ae,rm as se}from"fs/promises";import{tmpdir as ce}from"os";import{join as G}from"path";import V from"ws";async function F(e,t){let c=Date.now()+25e3;for(;Date.now()<c;){let r=await e();if(r)return r;await new Promise(i=>setTimeout(i,100))}throw new Error(`Timed out waiting for ${t}`)}function pe(e){let t=new URL(e);if(t.protocol!=="http:"||!["localhost","127.0.0.1"].includes(t.hostname)||t.username||t.password||t.hash||t.search)throw new Error("Managed participants require an explicit local app URL");return async c=>{let r=await ie(G(ce(),"popmelt-participant-")),i=ne(process.env.CHROME_PATH??(process.platform==="darwin"?"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome":"google-chrome"),["--headless=new","--no-first-run","--no-default-browser-check","--remote-debugging-address=127.0.0.1","--remote-debugging-port=0","--window-size=1440,1000",`--user-data-dir=${r}`,"about:blank"],{stdio:["ignore","ignore","pipe"]}),h,_="",a,d=!1,f=0,l=new Map;i.on("error",o=>{h=o}),i.stderr.on("data",o=>{_=(_+o).slice(-4e3)});let E=()=>{for(let o of l.values())clearTimeout(o.timer),o.reject(new Error("Participant browser disconnected"));l.clear()},n=async()=>{if(!d){if(d=!0,E(),a?.close(),i.pid&&i.exitCode===null&&i.signalCode===null){let o=new Promise(I=>i.once("exit",()=>I()));i.kill("SIGTERM");let T=setTimeout(()=>i.kill("SIGKILL"),3e3);await o,clearTimeout(T)}await se(r,{recursive:!0,force:!0})}};try{let o=await F(async()=>{if(h)throw h;if(i.exitCode!==null||i.signalCode!==null)throw new Error(`Participant browser exited: ${_}`);return ae(G(r,"DevToolsActivePort"),"utf8").then(p=>p.split(`
|
|
2
2
|
`)[0]).catch(()=>null)},"participant browser startup"),D=(await(await fetch(`http://127.0.0.1:${o}/json/list`,{signal:AbortSignal.timeout(3e3)})).json()).find(p=>p.type==="page");if(!D)throw new Error("Participant browser has no page");a=new V(D.webSocketDebuggerUrl,{handshakeTimeout:5e3}),await new Promise((p,s)=>{a.once("open",p),a.once("error",s)}),a.on("close",E),a.on("error",E),a.on("message",p=>{let s=JSON.parse(p.toString()),u=l.get(s.id);u&&(l.delete(s.id),clearTimeout(u.timer),s.error?u.reject(new Error(s.error.message??"Participant browser request failed")):u.resolve(s.result))});let P=(p,s={})=>new Promise((u,O)=>{if(d||a?.readyState!==V.OPEN){O(new Error("Participant browser is closed"));return}let g=++f,R=setTimeout(()=>{l.delete(g),O(new Error(`Participant browser timed out: ${p}. Action was not retried.`))},35e3);l.set(g,{resolve:u,reject:O,timer:R}),a.send(JSON.stringify({id:g,method:p,params:s}))}),y=async(p,s=!1)=>{let u=await P("Runtime.evaluate",{expression:p,userGesture:s,awaitPromise:!0,returnByValue:!0});if(u.exceptionDetails)throw new Error("Participant action failed: "+JSON.stringify(u.exceptionDetails));return u.result?.value};await P("Page.enable"),await P("Runtime.enable");let Y=(await P("Page.getFrameTree")).frameTree.frame.id,S=new Set,b=!1;await P("Runtime.addBinding",{name:"__popmeltCapture"}),a.on("message",p=>{let s=JSON.parse(p.toString());if(s.method==="Runtime.executionContextCreated"){let w=s.params.context;w.auxData?.isDefault&&w.auxData.frameId===Y&&S.add(w.id)}if(s.method==="Runtime.executionContextDestroyed"&&S.delete(s.params.executionContextId),s.method==="Runtime.executionContextsCleared"&&S.clear(),s.method!=="Runtime.bindingCalled"||s.params.name!=="__popmeltCapture"||!S.has(s.params.executionContextId))return;let u=s.params.executionContextId,O=s.params.payload;if(O.length>22e4)return;let g;try{g=JSON.parse(O)}catch{return}if(!Number.isSafeInteger(g.id)||!Array.isArray(g.selectors)||g.selectors.length>200||g.selectors.some(w=>typeof w!="string"||w.length>1024))return;let R=w=>P("Runtime.evaluate",{contextId:u,expression:`window.__POPMELT_CAPTURE_DELIVER__?.(${g.id},${JSON.stringify(w)})`}).catch(()=>{});if(b){R(null);return}b=!0,(async()=>{try{if(!await y(`location.origin + location.pathname === ${JSON.stringify(t.href)}`))return null;let w=await y(`window.__POPMELT_AGENT_VIEW__.geometry(${JSON.stringify(g.selectors)})`),m=w.clip;if(![m.x,m.y,m.width,m.height].every(Number.isFinite)||m.x<0||m.y<0||m.width<=0||m.height<=0||m.width>4096||m.height>4096)return null;await y("window.__POPMELT_CAPTURE_CHROME__ = [...document.querySelectorAll('[data-popmelt-top-layer-host]')].map(element => [element, element.style.opacity]); window.__POPMELT_CAPTURE_CHROME__.forEach(([element]) => element.style.opacity = '0');");try{let C=await P("Page.captureScreenshot",{format:"jpeg",quality:80,captureBeyondViewport:!0,clip:{...m,scale:Math.min(1,1280/Math.max(m.width,m.height))}});return typeof C.data!="string"||C.data.length>5e5?null:{image:"data:image/jpeg;base64,"+C.data,targets:w.targets}}finally{await y("window.__POPMELT_CAPTURE_CHROME__?.forEach(([element, opacity]) => element.style.opacity = opacity); delete window.__POPMELT_CAPTURE_CHROME__;").catch(()=>{})}}catch{return null}})().then(R).finally(()=>{b=!1})}),await P("Page.addScriptToEvaluateOnNewDocument",{source:`if (location.origin + location.pathname === ${JSON.stringify(t.href)}) {
|
|
3
3
|
window.__POPMELT_AGENT_CREDENTIAL__ = ${JSON.stringify(c)};
|
|
4
4
|
const waiting = new Map(); let id = 0;
|
package/package.json
CHANGED