@vcp-dev/site-edit-bridge 0.11.4 → 0.11.6
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 +15 -11
- package/dist/auto-bootstrap.d.ts +2 -0
- package/dist/auto-bootstrap.js +15 -15
- package/dist/cms-preview-identity-registry.d.ts +23 -0
- package/dist/cms-preview-probe.d.ts +7 -0
- package/dist/cms-preview-probe.js +1 -0
- package/dist/cms-preview-record.d.ts +7 -0
- package/dist/cms-preview-record.js +1 -0
- package/dist/index.js +10 -10
- package/dist/next-dev-server.js +1 -1
- package/dist/window-message.d.ts +28 -1
- package/dist/window-message.js +1 -1
- package/package.json +25 -3
package/dist/next-dev-server.js
CHANGED
|
@@ -2,6 +2,6 @@ import ve from"node:http";import{existsSync as V,readFileSync as F}from"node:fs"
|
|
|
2
2
|
Connection: close\r
|
|
3
3
|
\r
|
|
4
4
|
`),r.destroy();return}d.authenticatedByHeader&&n.add(s),t.handleUpgrade(s,r,c,a=>{t.emit("connection",a,s)})};return e.server.on("upgrade",o),t.on("connection",(s,r)=>{if(n.has(r)){i(s);return}en(s,e.sessionKey,()=>{i(s)})}),t.stop=()=>{e.server.off("upgrade",o);for(let s of t.clients)s.close(1001,"bridge stopped");t.close()},t}var we=class{constructor(t){this.socket=t,this.onmessage=null,this.onclose=null,t.on("error",()=>{}),t.on("message",n=>{this.onmessage?.({data:n.toString()})}),t.on("close",()=>{this.onclose?.()})}send(t){if(this.socket.readyState===$e.OPEN){if(this.socket.bufferedAmount+Buffer.byteLength(t,"utf8")>Vt){this.socket.close(1013,"bridge backpressure");return}this.socket.send(t)}}close(t,n){this.socket.close(t,n)}};function Yt(e,t){return new URL(e.url??"/","http://localhost").pathname===t.path}function Zt(e,t){if(new URL(e.url??"/","http://localhost").searchParams.has("vcp_bridge_key"))return null;let i=me(e.headers["x-vcp-site-edit-key"]),o=ze(i,t.sessionKey),s=me(e.headers.host),r=me(e.headers.origin);return s&&!tn(s,t.host,r)?null:r?sn(r,s,t.allowedOrigins)?{authenticatedByHeader:o}:null:o?{authenticatedByHeader:!0}:null}function en(e,t,n){let i=setTimeout(()=>{e.close(1008,"bridge authentication timeout")},Lt),o,s=()=>{clearTimeout(i),e.off("message",o),e.off("close",s)},r=()=>{s(),e.close(1008,"bridge authentication failed")};o=c=>{try{let d=C.parseMessage(c.toString());if(d.type!=="auth"||!ze(d.payload.key,t)){r();return}s(),e.readyState===$e.OPEN&&e.send(C.stringifyMessage({type:"auth-ok",payload:{ok:!0}})),n()}catch{r()}},e.on("message",o),e.on("close",s)}function ze(e,t){if(!e)return!1;let n=Buffer.from(e),i=Buffer.from(t);return n.length===i.length&&At(n,i)}function tn(e,t,n){let i=Ue(e),o=Ue(t);return i===o||We(o)&&We(i)&&(!n||Ee(n,e))||nn(o)&&(!n||Ee(n,e))}function nn(e){return e==="0.0.0.0"||e==="::"}function We(e){return e==="localhost"||e==="127.0.0.1"||e==="::1"}function sn(e,t,n){return n.includes(e)||(t?Ee(e,t):!1)}function Ee(e,t){try{return new URL(e).host===Je(t)}catch{return!1}}function Ue(e){let t=Je(e);return t.startsWith("[")?t.slice(1,t.indexOf("]")):t.split(":").length-1===1?t.split(":",1)[0]??"":t}function Je(e){return e.trim().toLowerCase()}function me(e){return Array.isArray(e)?e[0]:e}function on(){return Pt(32).toString("base64url")}function Ge(e){let t=e.replaceAll("\\","/");return t===ye||t.endsWith(`/${ye}`)}function rn(e){let t=e.replaceAll("\\","/");return Ge(e)||t===".vcp/workspace-state.json"||t.startsWith(".vcp/snapshot-store/")}var un="SITE_EDIT_ENGINE_UNAVAILABLE",pn=5e3,hn=1024,ln="VCP_SITE_EDIT_ENGINE_MAX_HEAP_MB",fn=3,gn=10*6e4,mn=1012;function Re(e,t,n={}){let i=Le(t),{onSnapshotIdChanged:o,onHealthChanged:s,...r}=i,c={options:r},d=n.maxHeapMb??Sn(process.env[ln])??hn,a=n.maxRestarts??fn,l=n.restartWindowMs??gn,u="starting",S,p=0,f=[],y=null,b=0,w=new Map,E=new Set,L,D,q=new Promise((h,g)=>{L=h,D=g});q.catch(()=>{});let R=h=>{let g=new Error(`VCP site edit preview bridge runtime is not ready: ${h}`);return g.code=un,g},z=h=>{for(let g of w.values())g.reject(h);w.clear()},P=h=>{switch(h.type){case"ready":y=h.health,u==="starting"?(u="ready",L()):u==="restarting"&&(u="ready",console.warn("[vcp-site-edit] engine worker restarted"));return;case"start-failed":u==="starting"&&A(ce(h.error));return;case"result":{let g=w.get(h.id);if(!g)return;w.delete(h.id),h.ok?g.resolve(h.value):g.reject(ce(h.error));return}case"event":for(let g of E)try{g(h.event)}catch(I){console.warn(`[vcp-site-edit] engine event listener failed: ${I instanceof Error?I.message:String(I)}`)}return;case"health":y=h.health;return;case"snapshot-id-changed":c.options.snapshotId=h.next;try{o?.(h.next,h.previous)}catch(g){console.warn(`[vcp-site-edit] onSnapshotIdChanged callback failed: ${g instanceof Error?g.message:String(g)}`)}return}},j=()=>{let h=p+=1,g=n.workerUrl??new URL("./engine-worker.js",import.meta.url),I=new dn(yn(g),{workerData:c,resourceLimits:{maxOldGenerationSizeMb:d},...n.execArgv?{execArgv:n.execArgv}:{}});I.unref();let N=()=>h===p;I.on("message",_=>{N()&&P(_)}),I.on("error",_=>{N()&&A(_ instanceof Error?_:new Error(String(_)))}),I.on("exit",_=>{N()&&A(new Error(`engine worker exited with code ${_}`))}),S=I,n.onWorker?.(I)},A=h=>{if(u==="stopped"||u==="failed")return;if(z(R(h.message)),y=null,u==="starting"){u="failed",console.error(`[vcp-site-edit] engine worker failed to start: ${h.message}`),D(h);return}let g=Date.now();for(;f.length>0&&g-f[0]>l;)f.shift();if(f.length>=a){u="failed",console.error(`[vcp-site-edit] engine worker stopped unexpectedly and exhausted ${a} restarts: ${h.message}`);return}f.push(g),u="restarting";for(let I of H.clients)I.close(mn,"site edit engine restarting");console.error(`[vcp-site-edit] engine worker stopped unexpectedly, restarting (${f.length}/${a}): ${h.message}`),j()},J=(h,g)=>{if(u==="failed"||u==="stopped"||u==="restarting")return Promise.reject(R(u));let I=b+=1;return new Promise((N,_)=>{w.set(I,{resolve:N,reject:_});let at={type:"call",id:I,method:h,args:g};S.postMessage(at)})},K=Object.fromEntries(Pe.map(h=>[h,(...g)=>J(h,g)])),H=xe({server:e,path:i.path,sessionKey:i.sessionKey,host:i.host,allowedOrigins:i.allowedOrigins,engine:{...K,subscribe(h){return E.add(h),()=>E.delete(h)}}});return j(),{getHealth(){return u==="ready"&&y?y:{ok:!1,bridgePath:i.path,runtimeReady:!1,routesIndexed:y?.routesIndexed??0,sessionRequired:!!i.sessionKey}},stop(){if(u==="stopped")return;let h=u==="starting";u="stopped",H.stop(),h&&D(R("bridge stopped")),z(R("bridge stopped")),E.clear();let g=S,I={type:"stop"};g.postMessage(I);let N=setTimeout(()=>{g.terminate()},pn);N.unref(),g.once("exit",()=>clearTimeout(N))},whenReady(){return q},eventListeners:E}}function yn(e){if(!e.pathname.endsWith(".ts"))return e;let t=cn(an(import.meta.url).resolve("tsx/esm/api")).href,n=[`import { tsImport } from ${JSON.stringify(t)};`,`await tsImport(${JSON.stringify(e.href)}, ${JSON.stringify(e.href)});`].join(`
|
|
5
|
-
`);return new URL(`data:text/javascript,${encodeURIComponent(n)}`)}function Sn(e){if(!e||!/^\d+$/.test(e.trim()))return;let t=Number(e.trim());return Number.isSafeInteger(t)&&t>0?t:void 0}var wn="next",En="VCP_SITE_EDIT_ENGINE_IN_PROCESS",nt="127.0.0.1",bn=3e3,re="/__vcp/site-edit/bridge",it="/__vcp/site-edit/health",xn="probe",Rn="render",Xe="/_error",ae="/__vcp/site-edit/client/",Cn=`${ae}auto-bootstrap.js`,st='data-vcp-site-edit-bootstrap="true"',kn=["next.config.ts","next.config.mts","next.config.cts","next.config.js","next.config.mjs","next.config.cjs"],_n="@vcp-dev/site-edit-engine/webpack-loader",vn=/@vcp\/site-edit-engine\/(?:webpack-loader|site-edit-instrumentation-loader)/,Tn=[/\bconfig\.webpack\s*=/,/\bwebpack\s*\([^)]*\)\s*\{/,/\bwebpack\s*:\s*(?:async\s*)?(?:\([^)]*\)|[A-Za-z_$][\w$]*)?\s*=>/,/\bwebpack\s*:\s*(?:async\s+)?function\b/],Pn=new Set(["auto-bootstrap.js","client.js","composition-key.js","designer-trace.js","document-codec.js","frame-scroll-session.js","frame-text-commit-preview.js","property-preview.js","protocol.js","window-message.js"]);async function Gi(e={},t={}){let n=t.process??process,i=t.createServer??ve.createServer,o=t.attachBridgeServer??(n.env[En]==="1"?Ve:Re),s=t.loadNext??ai,r=Q.resolve(e.projectRoot??process.cwd()),c=e.host??nt,d=e.port??pi(n.env.PORT)??bn,a=e.bridgePath??re,l=Dn(a),u=ni(),S=e.basePath??n.env.VCP_SITE_PREVIEW_BASE_PATH??"/",p=(e.tenantId??n.env.VCP_TENANT_ID)?.trim()||void 0,f=await s(r),y=An(r),b=f({dev:!0,dir:r,hostname:c,port:d,...Hn(y)}),w=b.getRequestHandler(),E=e.siteId??n.env.VCP_SITE_ID??"018f6f4d-a9b8-7120-8000-000000000120",L=e.snapshotId??n.env.VCP_SNAPSHOT_ID??ui(r),D=e.historyRoot??n.env.VCP_SITE_EDIT_HISTORY_ROOT,q=D?.trim()?Q.resolve(D):void 0,R=null,z={launchId:In(),pid:process.pid,snapshotId:L},P=i((H,h)=>{Vn({basePath:S,bridgePath:a,bridgeHealthPath:l,bridgeSessionKey:u,getBridgeHealth:()=>R?.getHealth()??Qn(a),launch:z,runRenderProbe:()=>zn(b),handle:w,request:H,response:h}).catch(g=>{console.error(g),h.headersSent||(h.statusCode=500),h.end("site edit preview request failed")})}),j=null,A=null,J=()=>A||(oe(()=>n.off("SIGINT",K)),oe(()=>n.off("SIGTERM",K)),oe(()=>j?.()),j=null,oe(()=>R?.stop()),R=null,A=Promise.allSettled([li(P),fi(()=>b.close())]).then(()=>{}),A),K=()=>{J()};try{return await b.prepare(),R=o(P,{...p?{tenantId:p}:{},siteId:E,snapshotId:L,projectRoot:r,basePath:S,host:c,port:d,path:a,sessionKey:u,...q?{historyRoot:q}:{},onSnapshotIdChanged:H=>{z.snapshotId=H}}),j=Bn({server:P,bridgePath:a,handleUpgrade:b.getUpgradeHandler()}),n.on("SIGINT",K),n.on("SIGTERM",K),await R.whenReady?.(),await hi(P,d,c),{bundler:y,close:J,host:c,port:gi(P,d),server:P}}catch(H){throw await J(),H}}function An(e){let t=Nn(e);return t&&On(t)?"webpack":"turbopack"}function Hn(e){return e==="webpack"?{webpack:!0}:{turbopack:!0}}function Nn(e){for(let t of kn){let n=Y(e,t);if(V(n))return F(n,"utf8")}return null}function On(e){return e.includes(_n)?!0:vn.test(e)&&Tn.some(t=>t.test(e))}function Bn(e){let t=(n,i,o)=>{Mn(n.url,e.bridgePath)||e.handleUpgrade(n,i,o).catch(s=>{console.error(s),i.destroyed||i.destroy()})};return e.server.on("upgrade",t),()=>e.server.off("upgrade",t)}function Mn(e,t){return new URL(e??"/","http://localhost").pathname===t}function Dn(e=re){if(e===re)return it;let t=(e.startsWith("/")?e:`/${e}`).replace(/\/+$/,"");return t.endsWith("/bridge")?`${t.slice(0,-7)}/health`:t?`${t}/health`:"/health"}function jn(e){let t=JSON.stringify({basePath:e.basePath,launch_id:e.launch?.launchId,snapshot_id:e.launch?.snapshotId,wsPath:e.bridgePath,bridge_session_key:e.bridgeSessionKey,defer_initial_sync:!0,runtime_versions:e.runtimeVersions??Kn()});return`<script type="module" ${st}>import { startSiteEditAutoBootstrap } from ${JSON.stringify(Cn)};void startSiteEditAutoBootstrap(window, ${t}).catch(() => undefined);</script>`}function Kn(){return{bridge:Ce("@vcp-dev/site-edit-bridge"),contracts:Ce("@vcp-dev/contracts"),engine:Ce("@vcp-dev/site-edit-engine")}}function Ce(e){let t=Ze(import.meta.url);try{let n=t.resolve(e),i=Wn(n,e);if(!i)return;let o=JSON.parse(F(i,"utf8"));return typeof o.version=="string"?o.version:void 0}catch{return}}function Wn(e,t){let n=Q.parse(e).root,i=X(e);for(;i&&i!==n;){let o=Y(i,"package.json");if(V(o))try{if(JSON.parse(F(o,"utf8")).name===t)return o}catch{return}i=X(i)}}function Un(e,t){if(e.includes(st))return e;let n=jn(t),i=/<\/body\s*>/i.exec(e);return i?`${e.slice(0,i.index)}${n}${e.slice(i.index)}`:`${e}${n}`}function Qi(e,t=X(tt(import.meta.url)),n=V){return ot(e,t,n)?.path??null}function ot(e,t=X(tt(import.meta.url)),n=V){let i=new URL(e??"/","http://localhost").pathname;if(!i.startsWith(ae))return null;let o=i.slice(ae.length);if(!Pn.has(o))return null;let s=Te(ci(t),o);if(et(t)!=="src")return{path:s,requiresTranspile:!1};let r=Te(t,o.replace(/\.js$/,".ts"));return n(r)?{path:r,requiresTranspile:!0}:{path:s,requiresTranspile:!1}}async function $n(e,t){let n=ot(e.url);if(!n)return!1;if(!V(n.path))return t.writeHead(404),t.end("site edit client asset not found"),!0;let i=n.requiresTranspile?await Fn(F(n.path,"utf8")):F(n.path);return t.writeHead(200,{"cache-control":"no-store","content-type":"text/javascript; charset=utf-8"}),t.end(i),!0}async function Fn(e){let t=await import("typescript");return t.transpileModule(e,{compilerOptions:{module:t.ModuleKind.ES2022,target:t.ScriptTarget.ES2022}}).outputText}async function Vn({basePath:e,bridgePath:t,bridgeHealthPath:n,bridgeSessionKey:i,getBridgeHealth:o,launch:s,runRenderProbe:r,handle:c,request:d,response:a}){if(Ln(d.url,e)){a.statusCode=404,a.end();return}if(await Gn(d,a,n,o,s,r)||await $n(d,a))return;let l=Xn(d),u=Yn(d),S=l||u?ti(a,{basePath:e,bridgePath:t,bridgeSessionKey:i,patchNextDevChunk:u,launch:{...s}}):()=>{};try{await c(d,a)}catch(p){throw S(),p}}function Ln(e,t){let n=(e??"/").split(/[?#]/,1)[0]??"/";if(!/(\\|\/\/)/.test(n))return!1;let i;try{i=decodeURIComponent(n).replace(/\\/g,"/").replace(/\/{2,}/g,"/")}catch{return!1}let o=new URL(i,"http://namespace.invalid").pathname,s=t.replace(/\/+$/,"");return(s&&(o===s||o.startsWith(s+"/"))?o.slice(s.length)||"/":o).startsWith("/.vcp")}function qn(e){let t=e instanceof Error?e.message:String(e),n=e&&typeof e=="object"&&"code"in e?e.code:void 0;return/\.next[/\\]/.test(t)||/chunks[/\\]ssr[/\\]/.test(t)?n==="ENOENT"||n==="MODULE_NOT_FOUND"?{verdict:"artifact_broken",detail:t}:t.includes("Cannot find module")?{verdict:"artifact_broken",detail:t}:{verdict:"inconclusive",detail:t}:{verdict:"inconclusive",detail:t}}async function zn(e){let t=new ve.IncomingMessage(new Qe);t.method="GET",t.url=Xe,t.headers={host:nt};let n=new ve.ServerResponse(t);n.assignSocket(new Qe);try{return await e.renderToHTML(t,n,Xe,{}),{verdict:"ok"}}catch(i){return qn(i)}finally{try{let i=n.socket;i&&(n.detachSocket(i),i.destroy())}catch{}}}function Jn(e){return new URL(e??"/","http://localhost").searchParams.get(xn)===Rn}async function Gn(e,t,n,i,o,s){if(e.method!=="GET"||new URL(e.url??"/","http://localhost").pathname!==n)return!1;let c=i(),d=Jn(e.url)?await s():void 0,a={...c,launch:o,...d?{render:d}:{}};return t.writeHead(c.ok?200:503,{"cache-control":"no-store","content-type":"application/json; charset=utf-8"}),t.end(JSON.stringify(a)),!0}function Qn(e){return{ok:!1,bridgePath:e,runtimeReady:!1,routesIndexed:0,sessionRequired:!0}}function Xn(e){return Zn(e)?(e.headers["accept-encoding"]="identity",!0):!1}function Yn(e){return ei(e)?(e.headers["accept-encoding"]="identity",!0):!1}function Zn(e){if(e.method!=="GET")return!1;let t=new URL(e.url??"/","http://localhost");if(e.headers["x-template-id"]!==void 0&&!t.searchParams.has("template_id"))return!1;let n=t.pathname;if(n.startsWith("/_next/")||n.startsWith(ae)||n===re||n===it)return!1;let i=e.headers.accept??"";return i===""||i.includes("text/html")}function ei(e){if(e.method!=="GET"||!String(e.headers["user-agent"]??"").includes("Firefox"))return!1;let n=new URL(e.url??"/","http://localhost").pathname;return n.startsWith("/_next/static/chunks/")&&n.endsWith(".js")}function ti(e,t){let n=[],i=e,o=i.flushHeaders.bind(e),s=i.write.bind(e),r=i.end.bind(e),c=!1;i.flushHeaders=()=>{};let d=()=>{if(t.patchNextDevChunk||c)return!1;let a=Buffer.concat(n);if(!/<body\b[^>]*>/iu.test(a.toString("utf8")))return!1;let l=Ye(e,a,t);return l!==a&&!e.headersSent&&e.removeHeader("content-length"),s(l),n.length=0,c=!0,!0};return i.write=(a,l,u)=>c?(a!==void 0&&s(ke(a,_e(l))),se(l),se(u),!0):(a!==void 0&&(n.push(ke(a,_e(l))),d()),se(l),se(u),!0),i.end=(a,l,u)=>{let S=typeof a=="function"?void 0:a;if(c)return i.write=s,i.end=r,i.flushHeaders=o,S===void 0?typeof a=="function"?r(a):typeof l=="function"?r(l):typeof u=="function"?r(u):r():typeof l=="function"?r(S,l):typeof u=="function"?r(S,l,u):r(S,l);S!==void 0&&n.push(ke(S,_e(l))),i.write=s,i.end=r,i.flushHeaders=o;let p=Buffer.concat(n),f=Ye(e,p,t);f!==p&&!e.headersSent&&e.removeHeader("content-length");let y=typeof a=="function"?a:typeof l=="function"?l:typeof u=="function"?u:void 0;return y?r(f,y):r(f)},()=>{i.write=s,i.end=r,i.flushHeaders=o}}function Ye(e,t,n){if(ii(e,t))return Buffer.from(Un(t.toString("utf8"),n));if(n.patchNextDevChunk&&si(e)){let i=t.toString("utf8"),o=oi(i);if(o!==i)return Buffer.from(o)}return t}function ni(){let e=new Uint8Array(32);return globalThis.crypto.getRandomValues(e),Buffer.from(e).toString("base64url")}function ii(e,t){if(e.statusCode<200||e.statusCode>=300)return!1;let n=e.getHeader("content-type"),i=Array.isArray(n)?n.join(";"):String(n??"");return t.toString("utf8",0,256).includes("<html")&&(i===""||i.includes("text/html"))}function si(e){if(e.statusCode<200||e.statusCode>=300)return!1;let t=e.getHeader("content-type"),n=Array.isArray(t)?t.join(";"):String(t??"");return n===""||n.includes("javascript")||n.includes("ecmascript")}function oi(e){return[["debugChannel = createDebugChannel(undefined);","debugChannel = undefined;"],["if (isStreamErrorOrUnfinished(ctr)) {","if (false) {"],["return ctr.desiredSize === null || ctr.desiredSize < 0;","return false;"],[["findSourceMapURL: _appfindsourcemapurl.findSourceMapURL,"," debugChannel,"," startTime: 0"].join(`
|
|
5
|
+
`);return new URL(`data:text/javascript,${encodeURIComponent(n)}`)}function Sn(e){if(!e||!/^\d+$/.test(e.trim()))return;let t=Number(e.trim());return Number.isSafeInteger(t)&&t>0?t:void 0}var wn="next",En="VCP_SITE_EDIT_ENGINE_IN_PROCESS",nt="127.0.0.1",bn=3e3,re="/__vcp/site-edit/bridge",it="/__vcp/site-edit/health",xn="probe",Rn="render",Xe="/_error",ae="/__vcp/site-edit/client/",Cn=`${ae}auto-bootstrap.js`,st='data-vcp-site-edit-bootstrap="true"',kn=["next.config.ts","next.config.mts","next.config.cts","next.config.js","next.config.mjs","next.config.cjs"],_n="@vcp-dev/site-edit-engine/webpack-loader",vn=/@vcp\/site-edit-engine\/(?:webpack-loader|site-edit-instrumentation-loader)/,Tn=[/\bconfig\.webpack\s*=/,/\bwebpack\s*\([^)]*\)\s*\{/,/\bwebpack\s*:\s*(?:async\s*)?(?:\([^)]*\)|[A-Za-z_$][\w$]*)?\s*=>/,/\bwebpack\s*:\s*(?:async\s+)?function\b/],Pn=new Set(["auto-bootstrap.js","client.js","cms-preview-identity-registry.js","composition-key.js","designer-trace.js","document-codec.js","frame-scroll-session.js","frame-text-commit-preview.js","property-preview.js","protocol.js","window-message.js"]);async function Gi(e={},t={}){let n=t.process??process,i=t.createServer??ve.createServer,o=t.attachBridgeServer??(n.env[En]==="1"?Ve:Re),s=t.loadNext??ai,r=Q.resolve(e.projectRoot??process.cwd()),c=e.host??nt,d=e.port??pi(n.env.PORT)??bn,a=e.bridgePath??re,l=Dn(a),u=ni(),S=e.basePath??n.env.VCP_SITE_PREVIEW_BASE_PATH??"/",p=(e.tenantId??n.env.VCP_TENANT_ID)?.trim()||void 0,f=await s(r),y=An(r),b=f({dev:!0,dir:r,hostname:c,port:d,...Hn(y)}),w=b.getRequestHandler(),E=e.siteId??n.env.VCP_SITE_ID??"018f6f4d-a9b8-7120-8000-000000000120",L=e.snapshotId??n.env.VCP_SNAPSHOT_ID??ui(r),D=e.historyRoot??n.env.VCP_SITE_EDIT_HISTORY_ROOT,q=D?.trim()?Q.resolve(D):void 0,R=null,z={launchId:In(),pid:process.pid,snapshotId:L},P=i((H,h)=>{Vn({basePath:S,bridgePath:a,bridgeHealthPath:l,bridgeSessionKey:u,getBridgeHealth:()=>R?.getHealth()??Qn(a),launch:z,runRenderProbe:()=>zn(b),handle:w,request:H,response:h}).catch(g=>{console.error(g),h.headersSent||(h.statusCode=500),h.end("site edit preview request failed")})}),j=null,A=null,J=()=>A||(oe(()=>n.off("SIGINT",K)),oe(()=>n.off("SIGTERM",K)),oe(()=>j?.()),j=null,oe(()=>R?.stop()),R=null,A=Promise.allSettled([li(P),fi(()=>b.close())]).then(()=>{}),A),K=()=>{J()};try{return await b.prepare(),R=o(P,{...p?{tenantId:p}:{},siteId:E,snapshotId:L,projectRoot:r,basePath:S,host:c,port:d,path:a,sessionKey:u,...q?{historyRoot:q}:{},onSnapshotIdChanged:H=>{z.snapshotId=H}}),j=Bn({server:P,bridgePath:a,handleUpgrade:b.getUpgradeHandler()}),n.on("SIGINT",K),n.on("SIGTERM",K),await R.whenReady?.(),await hi(P,d,c),{bundler:y,close:J,host:c,port:gi(P,d),server:P}}catch(H){throw await J(),H}}function An(e){let t=Nn(e);return t&&On(t)?"webpack":"turbopack"}function Hn(e){return e==="webpack"?{webpack:!0}:{turbopack:!0}}function Nn(e){for(let t of kn){let n=Y(e,t);if(V(n))return F(n,"utf8")}return null}function On(e){return e.includes(_n)?!0:vn.test(e)&&Tn.some(t=>t.test(e))}function Bn(e){let t=(n,i,o)=>{Mn(n.url,e.bridgePath)||e.handleUpgrade(n,i,o).catch(s=>{console.error(s),i.destroyed||i.destroy()})};return e.server.on("upgrade",t),()=>e.server.off("upgrade",t)}function Mn(e,t){return new URL(e??"/","http://localhost").pathname===t}function Dn(e=re){if(e===re)return it;let t=(e.startsWith("/")?e:`/${e}`).replace(/\/+$/,"");return t.endsWith("/bridge")?`${t.slice(0,-7)}/health`:t?`${t}/health`:"/health"}function jn(e){let t=JSON.stringify({basePath:e.basePath,launch_id:e.launch?.launchId,snapshot_id:e.launch?.snapshotId,wsPath:e.bridgePath,bridge_session_key:e.bridgeSessionKey,defer_initial_sync:!0,runtime_versions:e.runtimeVersions??Kn()});return`<script type="module" ${st}>import { startSiteEditAutoBootstrap } from ${JSON.stringify(Cn)};void startSiteEditAutoBootstrap(window, ${t}).catch(() => undefined);</script>`}function Kn(){return{bridge:Ce("@vcp-dev/site-edit-bridge"),contracts:Ce("@vcp-dev/contracts"),engine:Ce("@vcp-dev/site-edit-engine")}}function Ce(e){let t=Ze(import.meta.url);try{let n=t.resolve(e),i=Wn(n,e);if(!i)return;let o=JSON.parse(F(i,"utf8"));return typeof o.version=="string"?o.version:void 0}catch{return}}function Wn(e,t){let n=Q.parse(e).root,i=X(e);for(;i&&i!==n;){let o=Y(i,"package.json");if(V(o))try{if(JSON.parse(F(o,"utf8")).name===t)return o}catch{return}i=X(i)}}function Un(e,t){if(e.includes(st))return e;let n=jn(t),i=/<\/body\s*>/i.exec(e);return i?`${e.slice(0,i.index)}${n}${e.slice(i.index)}`:`${e}${n}`}function Qi(e,t=X(tt(import.meta.url)),n=V){return ot(e,t,n)?.path??null}function ot(e,t=X(tt(import.meta.url)),n=V){let i=new URL(e??"/","http://localhost").pathname;if(!i.startsWith(ae))return null;let o=i.slice(ae.length);if(!Pn.has(o))return null;let s=Te(ci(t),o);if(et(t)!=="src")return{path:s,requiresTranspile:!1};let r=Te(t,o.replace(/\.js$/,".ts"));return n(r)?{path:r,requiresTranspile:!0}:{path:s,requiresTranspile:!1}}async function $n(e,t){let n=ot(e.url);if(!n)return!1;if(!V(n.path))return t.writeHead(404),t.end("site edit client asset not found"),!0;let i=n.requiresTranspile?await Fn(F(n.path,"utf8")):F(n.path);return t.writeHead(200,{"cache-control":"no-store","content-type":"text/javascript; charset=utf-8"}),t.end(i),!0}async function Fn(e){let t=await import("typescript");return t.transpileModule(e,{compilerOptions:{module:t.ModuleKind.ES2022,target:t.ScriptTarget.ES2022}}).outputText}async function Vn({basePath:e,bridgePath:t,bridgeHealthPath:n,bridgeSessionKey:i,getBridgeHealth:o,launch:s,runRenderProbe:r,handle:c,request:d,response:a}){if(Ln(d.url,e)){a.statusCode=404,a.end();return}if(await Gn(d,a,n,o,s,r)||await $n(d,a))return;let l=Xn(d),u=Yn(d),S=l||u?ti(a,{basePath:e,bridgePath:t,bridgeSessionKey:i,patchNextDevChunk:u,launch:{...s}}):()=>{};try{await c(d,a)}catch(p){throw S(),p}}function Ln(e,t){let n=(e??"/").split(/[?#]/,1)[0]??"/";if(!/(\\|\/\/)/.test(n))return!1;let i;try{i=decodeURIComponent(n).replace(/\\/g,"/").replace(/\/{2,}/g,"/")}catch{return!1}let o=new URL(i,"http://namespace.invalid").pathname,s=t.replace(/\/+$/,"");return(s&&(o===s||o.startsWith(s+"/"))?o.slice(s.length)||"/":o).startsWith("/.vcp")}function qn(e){let t=e instanceof Error?e.message:String(e),n=e&&typeof e=="object"&&"code"in e?e.code:void 0;return/\.next[/\\]/.test(t)||/chunks[/\\]ssr[/\\]/.test(t)?n==="ENOENT"||n==="MODULE_NOT_FOUND"?{verdict:"artifact_broken",detail:t}:t.includes("Cannot find module")?{verdict:"artifact_broken",detail:t}:{verdict:"inconclusive",detail:t}:{verdict:"inconclusive",detail:t}}async function zn(e){let t=new ve.IncomingMessage(new Qe);t.method="GET",t.url=Xe,t.headers={host:nt};let n=new ve.ServerResponse(t);n.assignSocket(new Qe);try{return await e.renderToHTML(t,n,Xe,{}),{verdict:"ok"}}catch(i){return qn(i)}finally{try{let i=n.socket;i&&(n.detachSocket(i),i.destroy())}catch{}}}function Jn(e){return new URL(e??"/","http://localhost").searchParams.get(xn)===Rn}async function Gn(e,t,n,i,o,s){if(e.method!=="GET"||new URL(e.url??"/","http://localhost").pathname!==n)return!1;let c=i(),d=Jn(e.url)?await s():void 0,a={...c,launch:o,...d?{render:d}:{}};return t.writeHead(c.ok?200:503,{"cache-control":"no-store","content-type":"application/json; charset=utf-8"}),t.end(JSON.stringify(a)),!0}function Qn(e){return{ok:!1,bridgePath:e,runtimeReady:!1,routesIndexed:0,sessionRequired:!0}}function Xn(e){return Zn(e)?(e.headers["accept-encoding"]="identity",!0):!1}function Yn(e){return ei(e)?(e.headers["accept-encoding"]="identity",!0):!1}function Zn(e){if(e.method!=="GET")return!1;let t=new URL(e.url??"/","http://localhost");if(e.headers["x-template-id"]!==void 0&&!t.searchParams.has("template_id"))return!1;let n=t.pathname;if(n.startsWith("/_next/")||n.startsWith(ae)||n===re||n===it)return!1;let i=e.headers.accept??"";return i===""||i.includes("text/html")}function ei(e){if(e.method!=="GET"||!String(e.headers["user-agent"]??"").includes("Firefox"))return!1;let n=new URL(e.url??"/","http://localhost").pathname;return n.startsWith("/_next/static/chunks/")&&n.endsWith(".js")}function ti(e,t){let n=[],i=e,o=i.flushHeaders.bind(e),s=i.write.bind(e),r=i.end.bind(e),c=!1;i.flushHeaders=()=>{};let d=()=>{if(t.patchNextDevChunk||c)return!1;let a=Buffer.concat(n);if(!/<body\b[^>]*>/iu.test(a.toString("utf8")))return!1;let l=Ye(e,a,t);return l!==a&&!e.headersSent&&e.removeHeader("content-length"),s(l),n.length=0,c=!0,!0};return i.write=(a,l,u)=>c?(a!==void 0&&s(ke(a,_e(l))),se(l),se(u),!0):(a!==void 0&&(n.push(ke(a,_e(l))),d()),se(l),se(u),!0),i.end=(a,l,u)=>{let S=typeof a=="function"?void 0:a;if(c)return i.write=s,i.end=r,i.flushHeaders=o,S===void 0?typeof a=="function"?r(a):typeof l=="function"?r(l):typeof u=="function"?r(u):r():typeof l=="function"?r(S,l):typeof u=="function"?r(S,l,u):r(S,l);S!==void 0&&n.push(ke(S,_e(l))),i.write=s,i.end=r,i.flushHeaders=o;let p=Buffer.concat(n),f=Ye(e,p,t);f!==p&&!e.headersSent&&e.removeHeader("content-length");let y=typeof a=="function"?a:typeof l=="function"?l:typeof u=="function"?u:void 0;return y?r(f,y):r(f)},()=>{i.write=s,i.end=r,i.flushHeaders=o}}function Ye(e,t,n){if(ii(e,t))return Buffer.from(Un(t.toString("utf8"),n));if(n.patchNextDevChunk&&si(e)){let i=t.toString("utf8"),o=oi(i);if(o!==i)return Buffer.from(o)}return t}function ni(){let e=new Uint8Array(32);return globalThis.crypto.getRandomValues(e),Buffer.from(e).toString("base64url")}function ii(e,t){if(e.statusCode<200||e.statusCode>=300)return!1;let n=e.getHeader("content-type"),i=Array.isArray(n)?n.join(";"):String(n??"");return t.toString("utf8",0,256).includes("<html")&&(i===""||i.includes("text/html"))}function si(e){if(e.statusCode<200||e.statusCode>=300)return!1;let t=e.getHeader("content-type"),n=Array.isArray(t)?t.join(";"):String(t??"");return n===""||n.includes("javascript")||n.includes("ecmascript")}function oi(e){return[["debugChannel = createDebugChannel(undefined);","debugChannel = undefined;"],["if (isStreamErrorOrUnfinished(ctr)) {","if (false) {"],["return ctr.desiredSize === null || ctr.desiredSize < 0;","return false;"],[["findSourceMapURL: _appfindsourcemapurl.findSourceMapURL,"," debugChannel,"," startTime: 0"].join(`
|
|
6
6
|
`),["unstable_allowPartialStream: true,"," debugChannel,"," startTime: 0"].join(`
|
|
7
7
|
`)],[["findSourceMapURL: _appfindsourcemapurl.findSourceMapURL,"," debugChannel,"," startTime: 0"].join("\\n"),["unstable_allowPartialStream: true,"," debugChannel,"," startTime: 0"].join("\\n")],["debugChannel: createDebugChannel && createDebugChannel(requestHeaders)","debugChannel: undefined"],["debugChannel: createDebugChannel && createDebugChannel(headers)","debugChannel: undefined"]].reduce((n,[i,o])=>ri(n,i,o),e)}function ri(e,t,n){if(n.length>t.length)throw new Error("Replacement must not be longer than the search string.");return e.replaceAll(t,n.padEnd(t.length," "))}function ke(e,t){return Buffer.isBuffer(e)?e:e instanceof Uint8Array?Buffer.from(e):Buffer.from(String(e),t)}function _e(e){return typeof e=="string"?e:void 0}function se(e){typeof e=="function"&&e()}async function ai(e){let n=Ze(Y(e,"package.json"))(wn);return n.default??n}function ci(e){return et(e)!=="src"?e:Te(di(e),"dist")}function di(e){return rt(e)?Q.posix.dirname(e):X(e)}function Te(e,t){return rt(e)?Q.posix.join(e,t):Y(e,t)}function rt(e){return e.includes("/")&&!e.includes("\\")}function ui(e){let t=Y(e,".vcp/current-snapshot.json");if(!V(t))return"sandbox_worktree";try{let n=JSON.parse(F(t,"utf8"));return typeof n.snapshot_id=="string"&&n.snapshot_id?n.snapshot_id:typeof n.snapshotId=="string"&&n.snapshotId?n.snapshotId:"sandbox_worktree"}catch{return"sandbox_worktree"}}function pi(e){if(!e)return null;let t=Number.parseInt(e,10);return Number.isInteger(t)&&t>0&&t<=65535?t:null}function hi(e,t,n){return new Promise((i,o)=>{e.once("error",o),e.listen(t,n,()=>{e.off("error",o),i()})})}function li(e){return new Promise(t=>{e.close(()=>t())})}function oe(e){try{e()}catch{}}function fi(e){try{return e()}catch(t){return Promise.reject(t)}}function gi(e,t){let n=e.address();return typeof n=="object"&&n?n.port:t}export{Bn as attachNextDevUpgradeHandler,Re as attachSiteEditBridgeServerInWorker,qn as classifySiteEditRenderProbeError,jn as createSiteEditAutoBootstrapHtmlSnippet,Un as injectSiteEditAutoBootstrap,Jn as isSiteEditRenderProbeRequested,oi as patchNextFirefoxDevChunk,Yn as prepareFirefoxNextDevChunkPatchRequest,Xn as prepareSiteEditHtmlInjectionRequest,Dn as resolveSiteEditBridgeHealthPath,ot as resolveSiteEditClientAsset,Qi as resolveSiteEditClientAssetPath,An as resolveSiteEditNextDevBundler,zn as runSiteEditRenderProbe,Gi as startSiteEditNextDevServer,Fn as transpileSiteEditClientSource};
|
package/dist/window-message.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { SiteEditCommandSuccess, SiteEditClassNameSourceStyleContext, SiteEditCompositionContext, SiteEditCompositionSelector, SiteEditEvent, SiteEditObjectEditContext, SiteEditGetClassNameSourceCommandResult, SiteEditHistoryRequest, SiteEditOperationCommandResult, SiteEditOperationRequest, SiteEditPageBlockPosition, SiteEditPageBlockTarget, SiteEditRenderDocument, SiteEditSourceFileResponse, SiteEditSourceLocation, SiteEditSourceTreeResponse } from "@vcp-dev/contracts";
|
|
2
2
|
import type { SiteEditOperationSelectionRef } from "@vcp-dev/contracts";
|
|
3
3
|
import type { SiteEditHistoryStatus } from "./protocol.js";
|
|
4
|
+
import type { CmsPreviewIdentityCandidate } from "./cms-preview-identity-registry.js";
|
|
4
5
|
export { getPropertyPreviewDomAttributeName, planPropertyPreview, type SiteEditPropertyPreviewElement, type SiteEditPropertyPreviewInput, type SiteEditPropertyPreviewResult, } from "./property-preview.js";
|
|
5
6
|
export declare const VCP_WINDOW_MESSAGE_SOURCE = "vcp-window-message";
|
|
6
7
|
export declare const VCP_WINDOW_MESSAGE_VERSION = 1;
|
|
@@ -304,6 +305,18 @@ export type SiteEditFrameRuntimeRequestBody = {
|
|
|
304
305
|
payload: {
|
|
305
306
|
ref: SiteEditFrameRuntimeRef;
|
|
306
307
|
};
|
|
308
|
+
} | {
|
|
309
|
+
type: "request";
|
|
310
|
+
id: string;
|
|
311
|
+
kind: "get-cms-identity";
|
|
312
|
+
payload: {
|
|
313
|
+
ref: SiteEditFrameRuntimeRef;
|
|
314
|
+
runtimeNodeId: string;
|
|
315
|
+
siteId: string;
|
|
316
|
+
snapshotId: string;
|
|
317
|
+
version: number;
|
|
318
|
+
composition: SiteEditCompositionSelector;
|
|
319
|
+
};
|
|
307
320
|
} | {
|
|
308
321
|
type: "request";
|
|
309
322
|
id: string;
|
|
@@ -533,7 +546,7 @@ export type SiteEditFrameRuntimeResponseBody = {
|
|
|
533
546
|
type: "response";
|
|
534
547
|
id: string;
|
|
535
548
|
ok: boolean;
|
|
536
|
-
result?: SiteEditFrameRuntimeStarted | SiteEditFrameRuntimeHit | SiteEditFrameRuntimeNodePatchAck | SiteEditFrameRuntimeHit[] | SiteEditFrameRuntimeDropTarget | SiteEditFrameRuntimeScrollMetrics | SiteEditCommandSuccess<SiteEditRenderDocument> | SiteEditCommandSuccess<{
|
|
549
|
+
result?: SiteEditFrameRuntimeStarted | SiteEditFrameRuntimeHit | SiteEditFrameRuntimeNodePatchAck | SiteEditFrameRuntimeHit[] | SiteEditFrameRuntimeDropTarget | SiteEditFrameRuntimeScrollMetrics | SiteEditFrameRuntimeCmsIdentityResult | SiteEditCommandSuccess<SiteEditRenderDocument> | SiteEditCommandSuccess<{
|
|
537
550
|
document: SiteEditRenderDocument;
|
|
538
551
|
historyStatus: SiteEditHistoryStatus;
|
|
539
552
|
}> | SiteEditCommandSuccess<SiteEditHistoryStatus> | SiteEditCommandSuccess<SiteEditClassNameSourceStyleContext | null> | SiteEditCommandSuccess<SiteEditObjectEditContext> | SiteEditGetClassNameSourceCommandResult | SiteEditCommandSuccess<SiteEditSourceTreeResponse> | SiteEditCommandSuccess<SiteEditSourceFileResponse> | SiteEditCommandSuccess<SiteEditSourceLocation> | SiteEditOperationCommandResult | null | (SiteEditFrameRuntimeScrollMetrics & {
|
|
@@ -559,6 +572,20 @@ export type SiteEditFrameRuntimeResponseBody = {
|
|
|
559
572
|
};
|
|
560
573
|
error?: string;
|
|
561
574
|
};
|
|
575
|
+
/**
|
|
576
|
+
* Candidate only: never an authorization to read or mutate a CMS record.
|
|
577
|
+
* For a by-URL detail the Engine may verify the selected field without proving
|
|
578
|
+
* the application's identity; candidate.appSlug remains an untrusted claim.
|
|
579
|
+
*/
|
|
580
|
+
export type SiteEditFrameRuntimeCmsIdentityResult = {
|
|
581
|
+
candidate: null;
|
|
582
|
+
} | {
|
|
583
|
+
candidate: CmsPreviewIdentityCandidate & {
|
|
584
|
+
fieldKey: string;
|
|
585
|
+
};
|
|
586
|
+
sourceProof: "field-only" | "collection-and-field";
|
|
587
|
+
};
|
|
588
|
+
export declare function isSiteEditFrameRuntimeCmsIdentityResult(value: unknown): value is SiteEditFrameRuntimeCmsIdentityResult;
|
|
562
589
|
export type SiteEditFrameRuntimeEventBody = {
|
|
563
590
|
type: "event";
|
|
564
591
|
kind: "text-edit-commit" | "text-edit-cancel" | "text-edit-exit" | "text-edit-input";
|
package/dist/window-message.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function E(e){return JSON.stringify([e.routeId,e.effectiveTemplateId??null])}var te={allowFullScreen:"allowfullscreen",acceptCharset:"accept-charset",autoComplete:"autocomplete",autoFocus:"autofocus",autoPlay:"autoplay",cellPadding:"cellpadding",cellSpacing:"cellspacing",charSet:"charset",colSpan:"colspan",crossOrigin:"crossorigin",dateTime:"datetime",encType:"enctype",formAction:"formaction",formEncType:"formenctype",formMethod:"formmethod",formNoValidate:"formnovalidate",formTarget:"formtarget",hrefLang:"hreflang",htmlFor:"for",httpEquiv:"http-equiv",inputMode:"inputmode",itemID:"itemid",itemProp:"itemprop",itemRef:"itemref",itemScope:"itemscope",itemType:"itemtype",keyParams:"keyparams",keyType:"keytype",noModule:"nomodule",playsInline:"playsinline",readOnly:"readonly",rowSpan:"rowspan",srcDoc:"srcdoc",srcLang:"srclang",srcSet:"srcset",tabIndex:"tabindex",useMap:"usemap"},N=new Set(["allowFullScreen","async","autoFocus","autoPlay","controls","default","defer","disabled","formNoValidate","hidden","inert","itemScope","loop","multiple","muted","noModule","noValidate","open","playsInline","readOnly","required","reversed","scoped","seamless"]),P=new Set(["checked","selected","value"]),ne=new Set(["children","key","ref","dangerouslysetinnerhtml"]),re=new Set(["data-designer-hover-outline","data-designer-select-outline"]),oe=/^[A-Za-z_$][A-Za-z0-9_$:-]*$/u,k=new Set(["accept","alt","action","cite","color","content","coords","crossOrigin","dateTime","formAction","formMethod","formTarget","headers","href","hrefLang","id","kind","label","lang","list","max","media","method","min","name","pattern","poster","property","referrerPolicy","rel","role","scope","slot","src","srcDoc","srcLang","srcSet","step","target","title","type","useMap","width","height"]);function ie(e){if(!ce(e))return O("Typed property changes are not previewable");if(e.element.kind!=="host")return O(`The '${e.element.tagName}' component may transform its props before rendering`);let n={};for(let t of e.changes){let i=se(t);if(!i)return O(`The DOM result for '${t.name}' cannot be proven equivalent`);n[i.name]=i.value}return e.runtimeAttributes,{mode:"dom",patch:{attributes:n}}}function se(e){if(!C(e.name))return null;let n=e.name,t=F(n);if(!t||P.has(n))return null;if(e.operation==="remove")return{name:t,value:null};let i=e.value;return n==="download"?de(t,i):N.has(n)?ae(t,i):/^(aria|data)-[A-Za-z0-9_.:-]+$/u.test(n)?pe(t,i):k.has(n)?typeof i=="string"?{name:t,value:i}:typeof i=="number"&&Number.isFinite(i)?{name:t,value:String(i)}:i===null?{name:t,value:null}:null:null}function F(e){return C(e)&&(e==="download"||P.has(e)||N.has(e)||k.has(e)||/^(aria|data)-[A-Za-z0-9_.:-]+$/u.test(e))?te[e]??e:null}function ce(e){if(e.scope!=="selection"&&e.scope!=="template"||!Array.isArray(e.changes)||e.changes.length===0)return!1;let n=new Set;for(let t of e.changes){if(!t||typeof t!="object"||typeof t.name!="string"||t.name.length===0||t.operation!=="set"&&t.operation!=="remove"||n.has(t.name))return!1;n.add(t.name)}return!0}function C(e){if(!oe.test(e))return!1;let n=e.toLowerCase();return ne.has(n)||n.startsWith("data-vcp-")||re.has(n)||/^on[a-z]/iu.test(e)?!1:n!=="classname"&&n!=="class"&&n!=="style"}function ae(e,n){return n===null||n===!1?{name:e,value:null}:n===!0?{name:e,value:""}:null}function de(e,n){return n===null||n===!1?{name:e,value:null}:n===!0?{name:e,value:""}:typeof n=="string"?{name:e,value:n}:null}function pe(e,n){return n===null?{name:e,value:null}:typeof n=="string"||typeof n=="boolean"||typeof n=="number"&&Number.isFinite(n)?{name:e,value:String(n)}:null}function O(e){return{mode:"after-render",reason:e}}var B="vcp-window-message",L=1;function q(e){return{source:B,version:L,namespace:e.namespace,channel:e.channel,...e.sessionKey?{sessionKey:e.sessionKey}:{},body:e.body}}function W(e){try{return o(e)?d(e,"source",B)&&d(e,"version",L)&&s(e,"namespace")&&s(e,"channel")&&p(e,"body")&&(!g(e,"sessionKey")||s(e,"sessionKey")):!1}catch{return!1}}var x="site-edit",z="frame-runtime",G="frame-announce",fe=1,K=1,M=1,ze=24;function Ge(e,n={}){return q({namespace:x,channel:z,sessionKey:n.sessionKey,body:e})}function Ue(){return q({namespace:x,channel:G,body:{type:"announce"}})}function je(e){try{return!W(e)||e.namespace!==x||e.channel!==G?!1:o(e.body)&&d(e.body,"type","announce")&&u(e.body,["type"])}catch{return!1}}function He(e){try{return!W(e)||e.namespace!==x||e.channel!==z?!1:Be(e.body)}catch{return!1}}function l(e){return o(e)&&s(e,"routeId")&&h(e,"templateId")&&u(e,["routeId","templateId"])}function T(e){return o(e)&&s(e,"routeId")&&h(e,"effectiveTemplateId")&&u(e,["routeId","effectiveTemplateId"])}function u(e,n){let t=new Set(n);return Reflect.ownKeys(e).every(i=>typeof i=="string"&&t.has(i))}var g=(e,n)=>Object.prototype.hasOwnProperty.call(e,n);function p(e,n){let t=Object.getOwnPropertyDescriptor(e,n);return t!==void 0&&"value"in t}function r(e,n){return Object.getOwnPropertyDescriptor(e,n)?.value}function d(e,n,t){return p(e,n)&&r(e,n)===t}function s(e,n){return p(e,n)&&typeof r(e,n)=="string"}function _(e,n){return p(e,n)&&typeof r(e,n)=="boolean"}function c(e,n){let t=r(e,n);return p(e,n)&&typeof t=="number"&&Number.isFinite(t)}function U(e,n){let t=r(e,n);return p(e,n)&&typeof t=="number"&&Number.isInteger(t)&&t>0}function h(e,n){return!g(e,n)||r(e,n)===void 0||s(e,n)}function S(e,n){return!g(e,n)||r(e,n)===void 0||c(e,n)}function b(e,n){let t=r(e,n);return!g(e,n)||t===void 0||p(e,n)&&typeof t=="number"&&Number.isInteger(t)&&t>=0}function a(e,n){return!g(e,n)||r(e,n)===void 0}function o(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let n=Object.getPrototypeOf(e);return n===Object.prototype||n===null}function ue(e){return o(e)&&Reflect.ownKeys(e).length===0}function w(e){if(!Array.isArray(e))return!1;for(let n=0;n<e.length;n+=1){let t=Object.getOwnPropertyDescriptor(e,String(n));if(t===void 0||!("value"in t)||typeof t.value!="string")return!1}return!0}function m(e){return o(e)&&s(e,"key")&&b(e,"instanceIndex")&&b(e,"instanceCount")&&b(e,"textSegmentIndex")}function le(e){return o(e)&&s(e,"blockId")&&b(e,"blockIndex")&&m(r(e,"ref"))&&R(r(e,"rect"))&&_(e,"targetIsSectionRoot")&&(a(e,"outlineOnly")||r(e,"outlineOnly")===!0&&r(e,"targetIsSectionRoot")===!1&&a(e,"blockTarget")&&a(e,"blockIndex"))&&(a(e,"blockTarget")||H(r(e,"blockTarget")))}function me(e){if(!o(e))return!1;let n=r(e,"placement"),t=r(e,"boundary");return s(e,"anchorBlockId")&&b(e,"positionIndex")&&m(r(e,"anchorRef"))&&(n==="before"||n==="after")&&(a(e,"blockPosition")||ge(r(e,"blockPosition")))&&o(t)&&c(t,"top")&&c(t,"left")&&c(t,"width")}function R(e){return o(e)&&["top","left","width","height"].every(n=>c(e,n))}function j(e){if(!o(e))return!1;let n=r(e,"rect"),t=r(e,"layout"),i=o(t)?r(t,"containingBlock"):null,f=r(e,"scrollContext"),y=o(i)&&(d(i,"kind","viewport")&&Reflect.ownKeys(i).length===1||d(i,"kind","document")&&Reflect.ownKeys(i).length===1||d(i,"kind","element")&&s(i,"runtimeNodeId"));return d(e,"version",fe)&&s(e,"runtimeNodeId")&&o(n)&&R(r(n,"viewport"))&&R(r(n,"document"))&&o(t)&&s(t,"position")&&s(t,"transform")&&y&&o(f)&&["scrollX","scrollY","viewportWidth","viewportHeight"].every(I=>c(f,I))&&p(f,"scrollContainers")&&ye(r(f,"scrollContainers"))}function ye(e){return Array.isArray(e)&&e.every(n=>o(n)&&s(n,"runtimeNodeId")&&c(n,"scrollLeft")&&c(n,"scrollTop"))}function A(e){return o(e)&&(a(e,"layoutSnapshot")||j(r(e,"layoutSnapshot")))&&(a(e,"blockTarget")||H(r(e,"blockTarget")))}function H(e){if(!o(e)||!u(e,["kind","composition","blockKey"])||!d(e,"kind","page-block")||!X(r(e,"composition"))||!s(e,"blockKey"))return!1;let n=r(e,"blockKey");return n.length>0&&n.length<=256}function ge(e){if(!o(e)||!u(e,["kind","composition","documentVersion","anchorBlockKey","placement"])||!d(e,"kind","block-boundary")||!X(r(e,"composition"))||!p(e,"documentVersion")||!b(e,"documentVersion")||r(e,"documentVersion")===void 0||!s(e,"anchorBlockKey"))return!1;let n=r(e,"anchorBlockKey"),t=r(e,"placement");return n.length>0&&n.length<=256&&(t==="before"||t==="after")}function X(e){return!l(e)||e.routeId.length===0?!1:e.templateId===void 0||he(e.templateId)}function he(e){return e.length>0&&e.length<=191&&!/[^\x20-\x7e\xa0-\xff]/u.test(e)&&!e.startsWith(" ")&&!e.endsWith(" ")&&new TextEncoder().encode(e).byteLength<=191}function Ie(e){return o(e)&&m(r(e,"ref"))&&p(e,"layoutSnapshot")&&j(r(e,"layoutSnapshot"))&&(a(e,"childBoxes")||Ee(r(e,"childBoxes")))&&(a(e,"childRects")||Se(r(e,"childRects")))&&(a(e,"layout")||be(r(e,"layout")))&&(a(e,"spacing")||Re(r(e,"spacing")))}function be(e){if(!o(e))return!1;let n=r(e,"indicatorOrientation");return s(e,"display")&&(n==="horizontal"||n==="vertical")&&h(e,"flexDirection")&&h(e,"gridAutoFlow")}function Se(e){return Array.isArray(e)&&e.every(n=>R(n))}function Ee(e){return Array.isArray(e)&&e.every(n=>o(n)&&R(r(n,"rect"))&&Y(r(n,"margin")))}function Y(e){return o(e)&&["marginTop","marginRight","marginBottom","marginLeft"].every(n=>c(e,n))}function Re(e){return Y(e)&&["paddingTop","paddingRight","paddingBottom","paddingLeft","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","columnGap","rowGap"].every(n=>c(e,n))}function Te(e){if(!Array.isArray(e))return!1;for(let n=0;n<e.length;n+=1){let t=Object.getOwnPropertyDescriptor(e,String(n));if(t===void 0||!("value"in t)||!Ie(t.value))return!1}return!0}function we(e){return o(e)&&Reflect.ownKeys(e).every(n=>typeof n=="string"&&p(e,n)&&(typeof r(e,n)=="string"||r(e,n)===null))}function $(e){return e==null||typeof e=="string"||typeof e=="number"&&Number.isFinite(e)}function xe(e){return o(e)&&Reflect.ownKeys(e).every(n=>typeof n=="string"&&p(e,n)&&$(r(e,n)))}function _e(e){if(!o(e))return!1;let n=r(e,"priority");return s(e,"property")&&p(e,"value")&&$(r(e,"value"))&&(!g(e,"priority")||n===void 0||n==="important")}function Oe(e){return o(e)?(a(e,"attributes")||we(r(e,"attributes")))&&h(e,"className")&&(a(e,"style")||xe(r(e,"style")))&&(a(e,"styleDeclarations")||Array.isArray(r(e,"styleDeclarations"))&&r(e,"styleDeclarations").every(_e)):!1}function D(e){return o(e)&&c(e,"x")&&c(e,"y")&&(a(e,"detailLevel")||d(e,"detailLevel","summary")||d(e,"detailLevel","full"))}function Ae(e){if(!g(e,"emptyTextRef"))return!0;if(!p(e,"emptyTextRef"))return!1;let n=r(e,"emptyTextRef");if(n===void 0)return!0;let t=["key","instanceIndex","instanceCount","textSegmentIndex"];return o(n)&&m(n)&&u(n,t)&&Reflect.ownKeys(n).every(i=>p(n,i))}function Z(e){if(!g(e,"textTarget"))return!0;if(!p(e,"textTarget"))return!1;let n=r(e,"textTarget");if(n===void 0)return!0;if(!o(n)||!u(n,["ref","ownerId","scopeKey","textNodeId"])||!Reflect.ownKeys(n).every(i=>p(n,i))||!s(n,"ownerId")||!r(n,"ownerId").length||!s(n,"scopeKey")||!r(n,"scopeKey").length||!h(n,"textNodeId"))return!1;let t=r(n,"ref");return o(t)&&m(t)&&u(t,["key","instanceIndex","instanceCount","textSegmentIndex"])&&Reflect.ownKeys(t).every(i=>p(t,i))&&c(t,"textSegmentIndex")&&(a(n,"textNodeId")||r(n,"textNodeId").length>0)}function J(e){return g(e,"editSessionId")?p(e,"editSessionId")?r(e,"editSessionId")===void 0||s(e,"editSessionId")&&r(e,"editSessionId").length>0:!1:!0}function Ne(e){return o(e)&&m(r(e,"ref"))}function Pe(e){if(!o(e)||!o(r(e,"variables")))return!1;let n=r(e,"variables");return Reflect.ownKeys(n).every(t=>typeof t=="string"&&s(n,t))?a(e,"stylesheets")||w(r(e,"stylesheets")):!1}function V(e,n,t){if(!o(e)||!u(e,["composition","request"])||!l(r(e,"composition")))return!1;if(n&&a(e,"request"))return!0;let i=r(e,"request");if(!o(i)||!u(i,["request_id","site_id","base_snapshot_id","kind","composition"])||!s(i,"request_id")||!s(i,"site_id")||!s(i,"base_snapshot_id")||!(d(i,"kind","undo")||d(i,"kind","redo"))||!l(r(i,"composition")))return!1;let f=r(i,"request_id");if(!f.length||f.length>128||!r(i,"site_id").length||!r(i,"base_snapshot_id").length||t&&r(i,"kind")!==t)return!1;let y=r(e,"composition"),I=r(i,"composition");return y.routeId===I.routeId&&y.templateId===I.templateId}function ke(e){if(!d(e,"type","request")||!s(e,"id")||!s(e,"kind")||!p(e,"payload"))return!1;let n=r(e,"kind"),t=r(e,"payload");switch(n){case"hit-test-at-point":return D(t);case"start-text-edit-at-point":return D(t)&&o(t)&&Ae(t)&&Z(t)&&J(t)&&!(r(t,"emptyTextRef")&&r(t,"textTarget"));case"cancel-text-edit":return o(t)&&u(t,["editSessionId"])&&p(t,"editSessionId")&&s(t,"editSessionId")&&r(t,"editSessionId").length>0;case"bridge-get-source-tree":return o(t)&&l(r(t,"composition"))&&u(t,["composition"]);case"get-scroll-metrics":case"clear-theme-override":return ue(t);case"bridge-get-history-status":return o(t)&&l(r(t,"composition"))&&u(t,["composition"]);case"bridge-get-history-operation-result":return V(t,!1);case"bridge-undo":case"bridge-redo":return V(t,!0,n==="bridge-undo"?"undo":"redo");case"bridge-get-source-file":return o(t)&&s(t,"path")&&l(r(t,"composition"))&&u(t,["path","composition"]);case"bridge-get-object-edit-context":return o(t)&&s(t,"key")&&l(r(t,"composition"))&&Ve(r(t,"selectionRef"))&&u(t,["key","composition","selectionRef"]);case"bridge-resolve-source-location":case"bridge-get-class-name-source":return o(t)&&s(t,"key")&&l(r(t,"composition"))&&u(t,["key","composition"]);case"scroll-to":return o(t)&&c(t,"x")&&c(t,"y");case"scroll-by":return o(t)&&c(t,"deltaX")&&c(t,"deltaY");case"set-interaction-mode":return o(t)&&_(t,"enabled");case"set-selection-visual":return o(t)&&d(t,"version",K)&&m(r(t,"ref"))&&d(t,"visible",!0);case"clear-selection-visual":return o(t)&&d(t,"version",K);case"set-resize-visual":return o(t)&&d(t,"version",M)&&m(r(t,"ref"))&&d(t,"visible",!0);case"clear-resize-visual":return o(t)&&d(t,"version",M);case"set-theme-override":return Pe(t);case"get-theme-variables":return o(t)&&w(r(t,"names"));case"compute-drop-target-at-point":return o(t)&&c(t,"x")&&c(t,"y")&&(d(t,"dragKind","insert")||d(t,"dragKind","move"))&&(a(t,"movingRef")||m(r(t,"movingRef")));case"observe-node-bounds":case"clear-node-bounds-observer":return o(t)&&(a(t,"ref")||m(r(t,"ref")));case"apply-node-patch":return o(t)&&m(r(t,"ref"))&&Oe(r(t,"patch"))&&(a(t,"preview")||o(r(t,"preview"))&&s(r(t,"preview"),"sessionId")&&b(r(t,"preview"),"revision")&&g(r(t,"preview"),"revision"));case"get-hit-by-ref":case"get-path-by-ref":case"restore-text-edit":case"clear-text-edit-rollback":return Ne(t);case"bridge-initialize-session":case"bridge-get-style-context":return o(t)&&l(r(t,"composition"))&&u(t,["composition"]);case"bridge-get-document":case"bridge-ensure-document-version":case"bridge-acknowledge-document-version":return o(t)&&l(r(t,"composition"))&&S(t,"minVersion")&&S(t,"version")&&u(t,["composition","minVersion","version"]);case"bridge-execute":case"bridge-get-operation-result":{if(!o(t))return!1;let i=r(t,"request"),f=r(t,"composition"),y=o(i)?r(i,"composition"):null;return!l(f)||!o(i)||!l(y)?!1:E({routeId:f.routeId,...f.templateId?{effectiveTemplateId:f.templateId}:{}})===E({routeId:y.routeId,...y.templateId?{effectiveTemplateId:y.templateId}:{}})&&u(t,["composition","request"])}case"bridge-subscribe":case"bridge-unsubscribe":return o(t)&&s(t,"subscriptionId")&&l(r(t,"composition"))&&u(t,["subscriptionId","composition"]);default:return!1}}function Fe(e){return d(e,"type","response")&&s(e,"id")&&_(e,"ok")&&(a(e,"error")||s(e,"error"))}function Ce(e){if(!o(e))return!1;let n=r(e,"type");if(typeof n!="string"||!T(r(e,"composition"))||!s(e,"siteId")||!s(e,"at"))return!1;switch(n){case"site-edit.document.changed":return s(e,"snapshotId")&&c(e,"version");case"site-edit.operation.planned":return s(e,"operationId")&&s(e,"baseSnapshotId")&&w(r(e,"changedFiles"));case"site-edit.operation.completed":return o(r(e,"result"));case"site-edit.operation.failed":return s(e,"requestId")&&o(r(e,"error"));case"site-edit.capability.changed":return w(r(e,"keys"));case"site-edit.graph.invalidated":return!0;case"site-edit.graph.ready":return c(e,"version");case"site-edit.graph.error":return s(e,"message");default:return!1}}var Ke=new Set(["pointer-down","pointer-move","pointer-leave","pointer-up","pointer-cancel","pointer-click","pointer-double-click"]),Q=new Set(["e","s","se"]);function Me(e,n){if(a(e,"resizeSession"))return!0;let t=r(e,"resizeSession");if(!o(t))return!1;let i=r(e,"pointerId"),f=r(t,"pointerId"),y=r(t,"phase"),I=r(t,"edge"),v=n==="pointer-down"?"start":n==="pointer-up"?"commit":n==="pointer-cancel"?"cancel":null;return r(t,"version")===1&&y===v&&s(t,"sessionId")&&String(r(t,"sessionId")).length>0&&typeof i=="number"&&Number.isInteger(i)&&typeof f=="number"&&Number.isInteger(f)&&i===f&&typeof I=="string"&&Q.has(I)&&r(e,"resizeEdge")===I&&m(r(t,"ref"))&&["startWidth","startHeight","width","height"].every(ee=>c(t,ee))}function De(e){if(!d(e,"type","event")||!s(e,"kind")||!o(r(e,"payload")))return!1;let n=r(e,"kind"),t=r(e,"payload");switch(n){case"text-edit-commit":case"text-edit-cancel":case"text-edit-exit":case"text-edit-input":return m(r(t,"ref"))&&J(t)&&h(t,"value")&&(a(t,"hit")||A(r(t,"hit")));case"node-bounds-change":return A(r(t,"hit"));case"geometry-batch":{let i=r(t,"reason");return U(t,"sequence")&&c(t,"sourceEventAt")&&c(t,"captureStartedAt")&&c(t,"capturedAt")&&(i==="scroll"||i==="resize"||i==="mutation")&&Te(r(t,"snapshots"))}case"bridge-event":{let i=r(t,"event"),f=r(t,"composition");return!Ce(i)||!T(f)?!1:s(t,"subscriptionId")&&E(f)===E(i.composition)}case"route-ready":return T(r(t,"composition"))&&s(t,"editEngineVersion")&&c(t,"sequence")&&c(t,"version");case"bridge-status":{let i=r(t,"state");return(i==="connecting"||i==="ready"||i==="reconnecting"||i==="failed"||i==="reload-required")&&T(r(t,"composition"))&&c(t,"sequence")&&S(t,"attempt")&&S(t,"retryInMs")&&h(t,"messageKey")&&h(t,"failureCode")}case"scroll":{let i=r(t,"metrics");return(!Object.prototype.hasOwnProperty.call(t,"phase")||p(t,"phase")&&(r(t,"phase")===void 0||r(t,"phase")==="end"))&&o(i)&&["scrollX","scrollY","scrollWidth","scrollHeight","viewportWidth","viewportHeight"].every(f=>c(i,f))}default:return Ke.has(n)&&c(t,"clientX")&&c(t,"clientY")&&S(t,"buttons")&&S(t,"pointerId")&&Z(t)&&(a(t,"textTarget")||n==="pointer-double-click")&&(a(t,"hoverVisualOwned")||_(t,"hoverVisualOwned"))&&(a(t,"resizeEdge")||s(t,"resizeEdge")&&Q.has(r(t,"resizeEdge")))&&Me(t,n)&&(r(t,"hit")===null||A(r(t,"hit")))&&(a(t,"section")||r(t,"section")===null||le(r(t,"section")))&&(a(t,"sectionGap")||r(t,"sectionGap")===null||me(r(t,"sectionGap")))}}function Ve(e){if(e===void 0)return!0;if(!o(e)||!u(e,["key","instanceIndex","instanceCount"])||!s(e,"key")||r(e,"key").length===0||!b(e,"instanceIndex")||!a(e,"instanceCount")&&!U(e,"instanceCount"))return!1;let n=r(e,"instanceIndex"),t=r(e,"instanceCount");return!(typeof n=="number"&&typeof t=="number"&&n>=t)}function Be(e){if(!o(e))return!1;switch(r(e,"type")){case"request":return ke(e);case"response":return Fe(e);case"event":return De(e);default:return!1}}export{G as SITE_EDIT_FRAME_ANNOUNCE_CHANNEL,z as SITE_EDIT_FRAME_RUNTIME_CHANNEL,fe as SITE_EDIT_FRAME_RUNTIME_LAYOUT_SNAPSHOT_VERSION,M as SITE_EDIT_FRAME_RUNTIME_RESIZE_VISUAL_VERSION,K as SITE_EDIT_FRAME_RUNTIME_SELECTION_VISUAL_VERSION,ze as SITE_EDIT_FRAME_SECTION_GAP_RADIUS_PX,x as SITE_EDIT_WINDOW_MESSAGE_NAMESPACE,B as VCP_WINDOW_MESSAGE_SOURCE,L as VCP_WINDOW_MESSAGE_VERSION,Ue as createSiteEditFrameAnnounceMessage,Ge as createSiteEditFrameRuntimeMessage,q as createVcpWindowMessageEnvelope,F as getPropertyPreviewDomAttributeName,je as isSiteEditFrameAnnounceMessage,j as isSiteEditFrameRuntimeLayoutSnapshot,He as isSiteEditFrameRuntimeMessage,W as isVcpWindowMessageEnvelope,ie as planPropertyPreview};
|
|
1
|
+
function R(e){return JSON.stringify([e.routeId,e.effectiveTemplateId??null])}var te={allowFullScreen:"allowfullscreen",acceptCharset:"accept-charset",autoComplete:"autocomplete",autoFocus:"autofocus",autoPlay:"autoplay",cellPadding:"cellpadding",cellSpacing:"cellspacing",charSet:"charset",colSpan:"colspan",crossOrigin:"crossorigin",dateTime:"datetime",encType:"enctype",formAction:"formaction",formEncType:"formenctype",formMethod:"formmethod",formNoValidate:"formnovalidate",formTarget:"formtarget",hrefLang:"hreflang",htmlFor:"for",httpEquiv:"http-equiv",inputMode:"inputmode",itemID:"itemid",itemProp:"itemprop",itemRef:"itemref",itemScope:"itemscope",itemType:"itemtype",keyParams:"keyparams",keyType:"keytype",noModule:"nomodule",playsInline:"playsinline",readOnly:"readonly",rowSpan:"rowspan",srcDoc:"srcdoc",srcLang:"srclang",srcSet:"srcset",tabIndex:"tabindex",useMap:"usemap"},A=new Set(["allowFullScreen","async","autoFocus","autoPlay","controls","default","defer","disabled","formNoValidate","hidden","inert","itemScope","loop","multiple","muted","noModule","noValidate","open","playsInline","readOnly","required","reversed","scoped","seamless"]),P=new Set(["checked","selected","value"]),ne=new Set(["children","key","ref","dangerouslysetinnerhtml"]),re=new Set(["data-designer-hover-outline","data-designer-select-outline"]),oe=/^[A-Za-z_$][A-Za-z0-9_$:-]*$/u,F=new Set(["accept","alt","action","cite","color","content","coords","crossOrigin","dateTime","formAction","formMethod","formTarget","headers","href","hrefLang","id","kind","label","lang","list","max","media","method","min","name","pattern","poster","property","referrerPolicy","rel","role","scope","slot","src","srcDoc","srcLang","srcSet","step","target","title","type","useMap","width","height"]);function ie(e){if(!ce(e))return N("Typed property changes are not previewable");if(e.element.kind!=="host")return N(`The '${e.element.tagName}' component may transform its props before rendering`);let n={};for(let t of e.changes){let i=se(t);if(!i)return N(`The DOM result for '${t.name}' cannot be proven equivalent`);n[i.name]=i.value}return e.runtimeAttributes,{mode:"dom",patch:{attributes:n}}}function se(e){if(!C(e.name))return null;let n=e.name,t=k(n);if(!t||P.has(n))return null;if(e.operation==="remove")return{name:t,value:null};let i=e.value;return n==="download"?de(t,i):A.has(n)?ae(t,i):/^(aria|data)-[A-Za-z0-9_.:-]+$/u.test(n)?pe(t,i):F.has(n)?typeof i=="string"?{name:t,value:i}:typeof i=="number"&&Number.isFinite(i)?{name:t,value:String(i)}:i===null?{name:t,value:null}:null:null}function k(e){return C(e)&&(e==="download"||P.has(e)||A.has(e)||F.has(e)||/^(aria|data)-[A-Za-z0-9_.:-]+$/u.test(e))?te[e]??e:null}function ce(e){if(e.scope!=="selection"&&e.scope!=="template"||!Array.isArray(e.changes)||e.changes.length===0)return!1;let n=new Set;for(let t of e.changes){if(!t||typeof t!="object"||typeof t.name!="string"||t.name.length===0||t.operation!=="set"&&t.operation!=="remove"||n.has(t.name))return!1;n.add(t.name)}return!0}function C(e){if(!oe.test(e))return!1;let n=e.toLowerCase();return ne.has(n)||n.startsWith("data-vcp-")||re.has(n)||/^on[a-z]/iu.test(e)?!1:n!=="classname"&&n!=="class"&&n!=="style"}function ae(e,n){return n===null||n===!1?{name:e,value:null}:n===!0?{name:e,value:""}:null}function de(e,n){return n===null||n===!1?{name:e,value:null}:n===!0?{name:e,value:""}:typeof n=="string"?{name:e,value:n}:null}function pe(e,n){return n===null?{name:e,value:null}:typeof n=="string"||typeof n=="boolean"||typeof n=="number"&&Number.isFinite(n)?{name:e,value:String(n)}:null}function N(e){return{mode:"after-render",reason:e}}var B="vcp-window-message",L=1;function q(e){return{source:B,version:L,namespace:e.namespace,channel:e.channel,...e.sessionKey?{sessionKey:e.sessionKey}:{},body:e.body}}function U(e){try{return o(e)?d(e,"source",B)&&d(e,"version",L)&&s(e,"namespace")&&s(e,"channel")&&u(e,"body")&&(!g(e,"sessionKey")||s(e,"sessionKey")):!1}catch{return!1}}var w="site-edit",W="frame-runtime",z="frame-announce",fe=1,K=1,M=1,We=24;function ze(e){try{if(!o(e)||!f(e,["candidate","sourceProof"])||!u(e,"candidate"))return!1;let n=r(e,"candidate");if(n===null)return!g(e,"sourceProof");if(!o(n)||!f(n,["appSlug","operation","recordId","recordUrl","fieldKey","mediaIndex","resourceId","currentUrl"]))return!1;let t=l=>s(n,l)&&r(n,l).trim().length>0,i=l=>!g(n,l)||t(l),p=l=>!g(n,l)||t(l)&&/^[1-9]\d*$/.test(r(n,l))&&Number.isSafeInteger(Number(r(n,l)));return t("appSlug")&&(d(n,"operation","list")||d(n,"operation","detail"))&&(d(e,"sourceProof","collection-and-field")||d(e,"sourceProof","field-only")&&d(n,"operation","detail"))&&p("recordId")&&p("resourceId")&&i("recordUrl")&&t("fieldKey")&&i("currentUrl")&&(!g(n,"mediaIndex")||u(n,"mediaIndex")&&Number.isSafeInteger(r(n,"mediaIndex"))&&r(n,"mediaIndex")>=0&&t("fieldKey"))}catch{return!1}}function Ge(e,n={}){return q({namespace:w,channel:W,sessionKey:n.sessionKey,body:e})}function je(){return q({namespace:w,channel:z,body:{type:"announce"}})}function He(e){try{return!U(e)||e.namespace!==w||e.channel!==z?!1:o(e.body)&&d(e.body,"type","announce")&&f(e.body,["type"])}catch{return!1}}function $e(e){try{return!U(e)||e.namespace!==w||e.channel!==W?!1:Be(e.body)}catch{return!1}}function m(e){return o(e)&&s(e,"routeId")&&h(e,"templateId")&&f(e,["routeId","templateId"])}function x(e){return o(e)&&s(e,"routeId")&&h(e,"effectiveTemplateId")&&f(e,["routeId","effectiveTemplateId"])}function f(e,n){let t=new Set(n);return Reflect.ownKeys(e).every(i=>typeof i=="string"&&t.has(i))}var g=(e,n)=>Object.prototype.hasOwnProperty.call(e,n);function u(e,n){let t=Object.getOwnPropertyDescriptor(e,n);return t!==void 0&&"value"in t}function r(e,n){return Object.getOwnPropertyDescriptor(e,n)?.value}function d(e,n,t){return u(e,n)&&r(e,n)===t}function s(e,n){return u(e,n)&&typeof r(e,n)=="string"}function _(e,n){return u(e,n)&&typeof r(e,n)=="boolean"}function c(e,n){let t=r(e,n);return u(e,n)&&typeof t=="number"&&Number.isFinite(t)}function G(e,n){let t=r(e,n);return u(e,n)&&typeof t=="number"&&Number.isInteger(t)&&t>0}function h(e,n){return!g(e,n)||r(e,n)===void 0||s(e,n)}function S(e,n){return!g(e,n)||r(e,n)===void 0||c(e,n)}function b(e,n){let t=r(e,n);return!g(e,n)||t===void 0||u(e,n)&&typeof t=="number"&&Number.isInteger(t)&&t>=0}function a(e,n){return!g(e,n)||r(e,n)===void 0}function o(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let n=Object.getPrototypeOf(e);return n===Object.prototype||n===null}function ue(e){return o(e)&&Reflect.ownKeys(e).length===0}function T(e){if(!Array.isArray(e))return!1;for(let n=0;n<e.length;n+=1){let t=Object.getOwnPropertyDescriptor(e,String(n));if(t===void 0||!("value"in t)||typeof t.value!="string")return!1}return!0}function y(e){return o(e)&&s(e,"key")&&b(e,"instanceIndex")&&b(e,"instanceCount")&&b(e,"textSegmentIndex")}function le(e){return o(e)&&s(e,"blockId")&&b(e,"blockIndex")&&y(r(e,"ref"))&&E(r(e,"rect"))&&_(e,"targetIsSectionRoot")&&(a(e,"outlineOnly")||r(e,"outlineOnly")===!0&&r(e,"targetIsSectionRoot")===!1&&a(e,"blockTarget")&&a(e,"blockIndex"))&&(a(e,"blockTarget")||H(r(e,"blockTarget")))}function me(e){if(!o(e))return!1;let n=r(e,"placement"),t=r(e,"boundary");return s(e,"anchorBlockId")&&b(e,"positionIndex")&&y(r(e,"anchorRef"))&&(n==="before"||n==="after")&&(a(e,"blockPosition")||ge(r(e,"blockPosition")))&&o(t)&&c(t,"top")&&c(t,"left")&&c(t,"width")}function E(e){return o(e)&&["top","left","width","height"].every(n=>c(e,n))}function j(e){if(!o(e))return!1;let n=r(e,"rect"),t=r(e,"layout"),i=o(t)?r(t,"containingBlock"):null,p=r(e,"scrollContext"),l=o(i)&&(d(i,"kind","viewport")&&Reflect.ownKeys(i).length===1||d(i,"kind","document")&&Reflect.ownKeys(i).length===1||d(i,"kind","element")&&s(i,"runtimeNodeId"));return d(e,"version",fe)&&s(e,"runtimeNodeId")&&o(n)&&E(r(n,"viewport"))&&E(r(n,"document"))&&o(t)&&s(t,"position")&&s(t,"transform")&&l&&o(p)&&["scrollX","scrollY","viewportWidth","viewportHeight"].every(I=>c(p,I))&&u(p,"scrollContainers")&&ye(r(p,"scrollContainers"))}function ye(e){return Array.isArray(e)&&e.every(n=>o(n)&&s(n,"runtimeNodeId")&&c(n,"scrollLeft")&&c(n,"scrollTop"))}function O(e){return o(e)&&(a(e,"layoutSnapshot")||j(r(e,"layoutSnapshot")))&&(a(e,"blockTarget")||H(r(e,"blockTarget")))}function H(e){if(!o(e)||!f(e,["kind","composition","blockKey"])||!d(e,"kind","page-block")||!$(r(e,"composition"))||!s(e,"blockKey"))return!1;let n=r(e,"blockKey");return n.length>0&&n.length<=256}function ge(e){if(!o(e)||!f(e,["kind","composition","documentVersion","anchorBlockKey","placement"])||!d(e,"kind","block-boundary")||!$(r(e,"composition"))||!u(e,"documentVersion")||!b(e,"documentVersion")||r(e,"documentVersion")===void 0||!s(e,"anchorBlockKey"))return!1;let n=r(e,"anchorBlockKey"),t=r(e,"placement");return n.length>0&&n.length<=256&&(t==="before"||t==="after")}function $(e){return!m(e)||e.routeId.length===0?!1:e.templateId===void 0||he(e.templateId)}function he(e){return e.length>0&&e.length<=191&&!/[^\x20-\x7e\xa0-\xff]/u.test(e)&&!e.startsWith(" ")&&!e.endsWith(" ")&&new TextEncoder().encode(e).byteLength<=191}function Ie(e){return o(e)&&y(r(e,"ref"))&&u(e,"layoutSnapshot")&&j(r(e,"layoutSnapshot"))&&(a(e,"childBoxes")||Re(r(e,"childBoxes")))&&(a(e,"childRects")||Se(r(e,"childRects")))&&(a(e,"layout")||be(r(e,"layout")))&&(a(e,"spacing")||Ee(r(e,"spacing")))}function be(e){if(!o(e))return!1;let n=r(e,"indicatorOrientation");return s(e,"display")&&(n==="horizontal"||n==="vertical")&&h(e,"flexDirection")&&h(e,"gridAutoFlow")}function Se(e){return Array.isArray(e)&&e.every(n=>E(n))}function Re(e){return Array.isArray(e)&&e.every(n=>o(n)&&E(r(n,"rect"))&&X(r(n,"margin")))}function X(e){return o(e)&&["marginTop","marginRight","marginBottom","marginLeft"].every(n=>c(e,n))}function Ee(e){return X(e)&&["paddingTop","paddingRight","paddingBottom","paddingLeft","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","columnGap","rowGap"].every(n=>c(e,n))}function xe(e){if(!Array.isArray(e))return!1;for(let n=0;n<e.length;n+=1){let t=Object.getOwnPropertyDescriptor(e,String(n));if(t===void 0||!("value"in t)||!Ie(t.value))return!1}return!0}function Te(e){return o(e)&&Reflect.ownKeys(e).every(n=>typeof n=="string"&&u(e,n)&&(typeof r(e,n)=="string"||r(e,n)===null))}function Y(e){return e==null||typeof e=="string"||typeof e=="number"&&Number.isFinite(e)}function we(e){return o(e)&&Reflect.ownKeys(e).every(n=>typeof n=="string"&&u(e,n)&&Y(r(e,n)))}function _e(e){if(!o(e))return!1;let n=r(e,"priority");return s(e,"property")&&u(e,"value")&&Y(r(e,"value"))&&(!g(e,"priority")||n===void 0||n==="important")}function Ne(e){return o(e)?(a(e,"attributes")||Te(r(e,"attributes")))&&h(e,"className")&&(a(e,"style")||we(r(e,"style")))&&(a(e,"styleDeclarations")||Array.isArray(r(e,"styleDeclarations"))&&r(e,"styleDeclarations").every(_e)):!1}function D(e){return o(e)&&c(e,"x")&&c(e,"y")&&(a(e,"detailLevel")||d(e,"detailLevel","summary")||d(e,"detailLevel","full"))}function Oe(e){if(!g(e,"emptyTextRef"))return!0;if(!u(e,"emptyTextRef"))return!1;let n=r(e,"emptyTextRef");if(n===void 0)return!0;let t=["key","instanceIndex","instanceCount","textSegmentIndex"];return o(n)&&y(n)&&f(n,t)&&Reflect.ownKeys(n).every(i=>u(n,i))}function Z(e){if(!g(e,"textTarget"))return!0;if(!u(e,"textTarget"))return!1;let n=r(e,"textTarget");if(n===void 0)return!0;if(!o(n)||!f(n,["ref","ownerId","scopeKey","textNodeId"])||!Reflect.ownKeys(n).every(i=>u(n,i))||!s(n,"ownerId")||!r(n,"ownerId").length||!s(n,"scopeKey")||!r(n,"scopeKey").length||!h(n,"textNodeId"))return!1;let t=r(n,"ref");return o(t)&&y(t)&&f(t,["key","instanceIndex","instanceCount","textSegmentIndex"])&&Reflect.ownKeys(t).every(i=>u(t,i))&&c(t,"textSegmentIndex")&&(a(n,"textNodeId")||r(n,"textNodeId").length>0)}function J(e){return g(e,"editSessionId")?u(e,"editSessionId")?r(e,"editSessionId")===void 0||s(e,"editSessionId")&&r(e,"editSessionId").length>0:!1:!0}function Ae(e){return o(e)&&y(r(e,"ref"))}function Pe(e){if(!o(e)||!o(r(e,"variables")))return!1;let n=r(e,"variables");return Reflect.ownKeys(n).every(t=>typeof t=="string"&&s(n,t))?a(e,"stylesheets")||T(r(e,"stylesheets")):!1}function V(e,n,t){if(!o(e)||!f(e,["composition","request"])||!m(r(e,"composition")))return!1;if(n&&a(e,"request"))return!0;let i=r(e,"request");if(!o(i)||!f(i,["request_id","site_id","base_snapshot_id","kind","composition"])||!s(i,"request_id")||!s(i,"site_id")||!s(i,"base_snapshot_id")||!(d(i,"kind","undo")||d(i,"kind","redo"))||!m(r(i,"composition")))return!1;let p=r(i,"request_id");if(!p.length||p.length>128||!r(i,"site_id").length||!r(i,"base_snapshot_id").length||t&&r(i,"kind")!==t)return!1;let l=r(e,"composition"),I=r(i,"composition");return l.routeId===I.routeId&&l.templateId===I.templateId}function Fe(e){if(!d(e,"type","request")||!s(e,"id")||!s(e,"kind")||!u(e,"payload"))return!1;let n=r(e,"kind"),t=r(e,"payload");switch(n){case"hit-test-at-point":return D(t);case"start-text-edit-at-point":return D(t)&&o(t)&&Oe(t)&&Z(t)&&J(t)&&!(r(t,"emptyTextRef")&&r(t,"textTarget"));case"cancel-text-edit":return o(t)&&f(t,["editSessionId"])&&u(t,"editSessionId")&&s(t,"editSessionId")&&r(t,"editSessionId").length>0;case"bridge-get-source-tree":return o(t)&&m(r(t,"composition"))&&f(t,["composition"]);case"get-scroll-metrics":case"clear-theme-override":return ue(t);case"bridge-get-history-status":return o(t)&&m(r(t,"composition"))&&f(t,["composition"]);case"bridge-get-history-operation-result":return V(t,!1);case"bridge-undo":case"bridge-redo":return V(t,!0,n==="bridge-undo"?"undo":"redo");case"bridge-get-source-file":return o(t)&&s(t,"path")&&m(r(t,"composition"))&&f(t,["path","composition"]);case"bridge-get-object-edit-context":return o(t)&&s(t,"key")&&m(r(t,"composition"))&&Ve(r(t,"selectionRef"))&&f(t,["key","composition","selectionRef"]);case"bridge-resolve-source-location":case"bridge-get-class-name-source":return o(t)&&s(t,"key")&&m(r(t,"composition"))&&f(t,["key","composition"]);case"scroll-to":return o(t)&&c(t,"x")&&c(t,"y");case"scroll-by":return o(t)&&c(t,"deltaX")&&c(t,"deltaY");case"set-interaction-mode":return o(t)&&_(t,"enabled");case"set-selection-visual":return o(t)&&d(t,"version",K)&&y(r(t,"ref"))&&d(t,"visible",!0);case"clear-selection-visual":return o(t)&&d(t,"version",K);case"set-resize-visual":return o(t)&&d(t,"version",M)&&y(r(t,"ref"))&&d(t,"visible",!0);case"clear-resize-visual":return o(t)&&d(t,"version",M);case"set-theme-override":return Pe(t);case"get-theme-variables":return o(t)&&T(r(t,"names"));case"compute-drop-target-at-point":return o(t)&&c(t,"x")&&c(t,"y")&&(d(t,"dragKind","insert")||d(t,"dragKind","move"))&&(a(t,"movingRef")||y(r(t,"movingRef")));case"observe-node-bounds":case"clear-node-bounds-observer":return o(t)&&(a(t,"ref")||y(r(t,"ref")));case"apply-node-patch":return o(t)&&y(r(t,"ref"))&&Ne(r(t,"patch"))&&(a(t,"preview")||o(r(t,"preview"))&&s(r(t,"preview"),"sessionId")&&b(r(t,"preview"),"revision")&&g(r(t,"preview"),"revision"));case"get-hit-by-ref":case"get-path-by-ref":case"restore-text-edit":case"clear-text-edit-rollback":return Ae(t);case"get-cms-identity":return o(t)&&y(r(t,"ref"))&&s(t,"runtimeNodeId")&&r(t,"runtimeNodeId").trim().length>0&&s(t,"siteId")&&r(t,"siteId").trim().length>0&&s(t,"snapshotId")&&r(t,"snapshotId").trim().length>0&&c(t,"version")&&Number.isSafeInteger(r(t,"version"))&&r(t,"version")>=0&&m(r(t,"composition"))&&f(t,["ref","runtimeNodeId","siteId","snapshotId","version","composition"]);case"bridge-initialize-session":case"bridge-get-style-context":return o(t)&&m(r(t,"composition"))&&f(t,["composition"]);case"bridge-get-document":case"bridge-ensure-document-version":case"bridge-acknowledge-document-version":return o(t)&&m(r(t,"composition"))&&S(t,"minVersion")&&S(t,"version")&&f(t,["composition","minVersion","version"]);case"bridge-execute":case"bridge-get-operation-result":{if(!o(t))return!1;let i=r(t,"request"),p=r(t,"composition"),l=o(i)?r(i,"composition"):null;return!m(p)||!o(i)||!m(l)?!1:R({routeId:p.routeId,...p.templateId?{effectiveTemplateId:p.templateId}:{}})===R({routeId:l.routeId,...l.templateId?{effectiveTemplateId:l.templateId}:{}})&&f(t,["composition","request"])}case"bridge-subscribe":case"bridge-unsubscribe":return o(t)&&s(t,"subscriptionId")&&m(r(t,"composition"))&&f(t,["subscriptionId","composition"]);default:return!1}}function ke(e){return d(e,"type","response")&&s(e,"id")&&_(e,"ok")&&(a(e,"error")||s(e,"error"))}function Ce(e){if(!o(e))return!1;let n=r(e,"type");if(typeof n!="string"||!x(r(e,"composition"))||!s(e,"siteId")||!s(e,"at"))return!1;switch(n){case"site-edit.document.changed":return s(e,"snapshotId")&&c(e,"version");case"site-edit.operation.planned":return s(e,"operationId")&&s(e,"baseSnapshotId")&&T(r(e,"changedFiles"));case"site-edit.operation.completed":return o(r(e,"result"));case"site-edit.operation.failed":return s(e,"requestId")&&o(r(e,"error"));case"site-edit.capability.changed":return T(r(e,"keys"));case"site-edit.graph.invalidated":return!0;case"site-edit.graph.ready":return c(e,"version");case"site-edit.graph.error":return s(e,"message");default:return!1}}var Ke=new Set(["pointer-down","pointer-move","pointer-leave","pointer-up","pointer-cancel","pointer-click","pointer-double-click"]),Q=new Set(["e","s","se"]);function Me(e,n){if(a(e,"resizeSession"))return!0;let t=r(e,"resizeSession");if(!o(t))return!1;let i=r(e,"pointerId"),p=r(t,"pointerId"),l=r(t,"phase"),I=r(t,"edge"),v=n==="pointer-down"?"start":n==="pointer-up"?"commit":n==="pointer-cancel"?"cancel":null;return r(t,"version")===1&&l===v&&s(t,"sessionId")&&String(r(t,"sessionId")).length>0&&typeof i=="number"&&Number.isInteger(i)&&typeof p=="number"&&Number.isInteger(p)&&i===p&&typeof I=="string"&&Q.has(I)&&r(e,"resizeEdge")===I&&y(r(t,"ref"))&&["startWidth","startHeight","width","height"].every(ee=>c(t,ee))}function De(e){if(!d(e,"type","event")||!s(e,"kind")||!o(r(e,"payload")))return!1;let n=r(e,"kind"),t=r(e,"payload");switch(n){case"text-edit-commit":case"text-edit-cancel":case"text-edit-exit":case"text-edit-input":return y(r(t,"ref"))&&J(t)&&h(t,"value")&&(a(t,"hit")||O(r(t,"hit")));case"node-bounds-change":return O(r(t,"hit"));case"geometry-batch":{let i=r(t,"reason");return G(t,"sequence")&&c(t,"sourceEventAt")&&c(t,"captureStartedAt")&&c(t,"capturedAt")&&(i==="scroll"||i==="resize"||i==="mutation")&&xe(r(t,"snapshots"))}case"bridge-event":{let i=r(t,"event"),p=r(t,"composition");return!Ce(i)||!x(p)?!1:s(t,"subscriptionId")&&R(p)===R(i.composition)}case"route-ready":return x(r(t,"composition"))&&s(t,"editEngineVersion")&&c(t,"sequence")&&c(t,"version");case"bridge-status":{let i=r(t,"state");return(i==="connecting"||i==="ready"||i==="reconnecting"||i==="failed"||i==="reload-required")&&x(r(t,"composition"))&&c(t,"sequence")&&S(t,"attempt")&&S(t,"retryInMs")&&h(t,"messageKey")&&h(t,"failureCode")}case"scroll":{let i=r(t,"metrics");return(!Object.prototype.hasOwnProperty.call(t,"phase")||u(t,"phase")&&(r(t,"phase")===void 0||r(t,"phase")==="end"))&&o(i)&&["scrollX","scrollY","scrollWidth","scrollHeight","viewportWidth","viewportHeight"].every(p=>c(i,p))}default:return Ke.has(n)&&c(t,"clientX")&&c(t,"clientY")&&S(t,"buttons")&&S(t,"pointerId")&&Z(t)&&(a(t,"textTarget")||n==="pointer-double-click")&&(a(t,"hoverVisualOwned")||_(t,"hoverVisualOwned"))&&(a(t,"resizeEdge")||s(t,"resizeEdge")&&Q.has(r(t,"resizeEdge")))&&Me(t,n)&&(r(t,"hit")===null||O(r(t,"hit")))&&(a(t,"section")||r(t,"section")===null||le(r(t,"section")))&&(a(t,"sectionGap")||r(t,"sectionGap")===null||me(r(t,"sectionGap")))}}function Ve(e){if(e===void 0)return!0;if(!o(e)||!f(e,["key","instanceIndex","instanceCount"])||!s(e,"key")||r(e,"key").length===0||!b(e,"instanceIndex")||!a(e,"instanceCount")&&!G(e,"instanceCount"))return!1;let n=r(e,"instanceIndex"),t=r(e,"instanceCount");return!(typeof n=="number"&&typeof t=="number"&&n>=t)}function Be(e){if(!o(e))return!1;switch(r(e,"type")){case"request":return Fe(e);case"response":return ke(e);case"event":return De(e);default:return!1}}export{z as SITE_EDIT_FRAME_ANNOUNCE_CHANNEL,W as SITE_EDIT_FRAME_RUNTIME_CHANNEL,fe as SITE_EDIT_FRAME_RUNTIME_LAYOUT_SNAPSHOT_VERSION,M as SITE_EDIT_FRAME_RUNTIME_RESIZE_VISUAL_VERSION,K as SITE_EDIT_FRAME_RUNTIME_SELECTION_VISUAL_VERSION,We as SITE_EDIT_FRAME_SECTION_GAP_RADIUS_PX,w as SITE_EDIT_WINDOW_MESSAGE_NAMESPACE,B as VCP_WINDOW_MESSAGE_SOURCE,L as VCP_WINDOW_MESSAGE_VERSION,je as createSiteEditFrameAnnounceMessage,Ge as createSiteEditFrameRuntimeMessage,q as createVcpWindowMessageEnvelope,k as getPropertyPreviewDomAttributeName,He as isSiteEditFrameAnnounceMessage,ze as isSiteEditFrameRuntimeCmsIdentityResult,j as isSiteEditFrameRuntimeLayoutSnapshot,$e as isSiteEditFrameRuntimeMessage,U as isVcpWindowMessageEnvelope,ie as planPropertyPreview};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vcp-dev/site-edit-bridge",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"repository": {
|
|
@@ -35,6 +35,16 @@
|
|
|
35
35
|
"types": "./dist/auto-bootstrap.d.ts",
|
|
36
36
|
"default": "./dist/auto-bootstrap.js"
|
|
37
37
|
},
|
|
38
|
+
"./cms-preview-record": {
|
|
39
|
+
"development": "./src/cms-preview-record.ts",
|
|
40
|
+
"types": "./dist/cms-preview-record.d.ts",
|
|
41
|
+
"default": "./dist/cms-preview-record.js"
|
|
42
|
+
},
|
|
43
|
+
"./cms-preview-probe": {
|
|
44
|
+
"development": "./src/cms-preview-probe.ts",
|
|
45
|
+
"types": "./dist/cms-preview-probe.d.ts",
|
|
46
|
+
"default": "./dist/cms-preview-probe.js"
|
|
47
|
+
},
|
|
38
48
|
"./document-codec": {
|
|
39
49
|
"development": "./src/document-codec.ts",
|
|
40
50
|
"types": "./dist/document-codec.d.ts",
|
|
@@ -79,13 +89,25 @@
|
|
|
79
89
|
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
80
90
|
},
|
|
81
91
|
"dependencies": {
|
|
82
|
-
"@vcp-dev/contracts": "0.11.
|
|
83
|
-
"@vcp-dev/site-edit-engine": "0.11.
|
|
92
|
+
"@vcp-dev/contracts": "0.11.6",
|
|
93
|
+
"@vcp-dev/site-edit-engine": "0.11.6",
|
|
84
94
|
"@types/ws": "^8.18.1",
|
|
85
95
|
"ws": "^8.20.1"
|
|
86
96
|
},
|
|
97
|
+
"peerDependencies": {
|
|
98
|
+
"react": "^19.0.0"
|
|
99
|
+
},
|
|
100
|
+
"peerDependenciesMeta": {
|
|
101
|
+
"react": {
|
|
102
|
+
"optional": true
|
|
103
|
+
}
|
|
104
|
+
},
|
|
87
105
|
"devDependencies": {
|
|
88
106
|
"@types/node": "^24.0.0",
|
|
107
|
+
"@types/react": "19.2.14",
|
|
108
|
+
"@types/react-dom": "19.2.3",
|
|
109
|
+
"react": "19.2.6",
|
|
110
|
+
"react-dom": "19.2.6",
|
|
89
111
|
"typescript": "^5.8.0",
|
|
90
112
|
"vitest": "^3.2.0"
|
|
91
113
|
}
|