apps 0.0.1-beta.18 → 0.0.1-beta.19
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/framework-reference.json +1 -1
- package/js/ui/serving.js +11 -256
- package/package.json +1 -1
- package/runtime.json +1 -1
- package/types/apps/src/implementation/browser-scripts.gen.d.ts +6 -0
- package/types/apps/src/implementation/ui-errors.d.ts +1 -1
- package/types/apps/src/implementation/ui-watch.d.ts +1 -1
package/js/ui/serving.js
CHANGED
|
@@ -19,6 +19,11 @@ import {
|
|
|
19
19
|
} from "../chunk-CDL5PM2Q.js";
|
|
20
20
|
import "../chunk-CZ7CSFO4.js";
|
|
21
21
|
|
|
22
|
+
// src/implementation/browser-scripts.gen.ts
|
|
23
|
+
var appWatchSource = '"use strict";(()=>{var s=()=>{let i=document.getElementById("executor-context")?.textContent;if(!i)return;let n=JSON.parse(i);if(typeof n!="object"||n===null||!("deployment"in n))return;let r=n.deployment;if(typeof r!="string"||r.length===0)return;let t=new EventSource("/_executor/version"),l=!1,o=()=>{l||(l=!0,t.close(),location.reload())};t.addEventListener("version",d=>{let e=JSON.parse(d.data);typeof e=="object"&&e!==null&&"deployment"in e&&(e.deployment===null||typeof e.deployment=="string")&&e.deployment!==r&&o()}),t.addEventListener("revoked",o),window.addEventListener("executor:deployment-changed",o),window.addEventListener("pagehide",()=>t.close(),{once:!0}),window.addEventListener("pageshow",d=>{d.persisted&&o()})};s();})();';
|
|
24
|
+
var appFailureSource = '"use strict";(()=>{var D=()=>{let d,w=Date.now(),m=0,g=0,f=new Map,A=/^(?:chrome|moz|safari-web)-extension:/,R=new Set(["Error","TypeError","ReferenceError","SyntaxError","RangeError","URIError","EvalError","AggregateError"]),x=(e,t=0,i=0)=>{let r=[];if(!URL.canParse(e))return r;let a=new URL(e);return a.origin!==location.origin||!a.pathname.startsWith("/_executor/assets/")||!a.pathname.endsWith(".js")||(r.push({key:"code.file.path",value:{stringValue:a.pathname}}),Number.isSafeInteger(t)&&t>0&&r.push({key:"code.line.number",value:{intValue:String(t)}}),Number.isSafeInteger(i)&&i>0&&r.push({key:"code.column.number",value:{intValue:String(i)}})),r},E=(e,t,i=[])=>{let r=Date.now();r-w>=6e4&&(w=r,m=0,f.clear());let a=`${e}:${t.slice(0,2e3)}`,b=f.get(a);if(b!==void 0&&r-b<1e3||m>=20){g++;return}f.set(a,r),m++,i.push({key:"executor.ui.failure.suppressed",value:{intValue:String(g)}}),g=0;let h=Array.from(crypto.getRandomValues(new Uint8Array(16)),s=>s.toString(16).padStart(2,"0")).join(""),S=`${Date.now()}000000`,n,u="Sending error report\\u2026",k=()=>{if(d?.open)return;let s=document.createElement("div"),V=s.attachShadow({mode:"open"}),o=document.createElement("dialog");d=o,o.setAttribute("aria-labelledby","executor-failure-title");let y=document.createElement("h2");y.id="executor-failure-title",y.textContent=e==="script"?"This app could not load":"This app stopped working";let C=document.createElement("p");C.textContent=e==="script"?"A file needed by this page did not load. Reload the page to try again.":"The app encountered an unexpected error. Reload the page to try again.";let L=document.createElement("p");L.textContent="Copy any unsaved work before reloading.";let T=document.createElement("details"),v=document.createElement("summary");v.textContent="Error details";let c=document.createElement("textarea");c.readOnly=!0,c.rows=10,c.cols=36,c.setAttribute("aria-label","Error details"),c.value=`${t.slice(0,12e3)}\n\nDiagnostic ID: ${h}`,T.append(v,c),n=document.createElement("p"),n.setAttribute("role","status"),n.textContent=u;let l=document.createElement("button");l.type="button",l.textContent="Reload page",l.addEventListener("click",()=>location.reload());let p=document.createElement("button");p.type="button",p.textContent="Close",p.addEventListener("click",()=>o.close()),o.addEventListener("close",()=>{d===o&&(d=void 0),s.remove()}),o.append(y,C,L,T,n,l,p),V.append(o),document.documentElement.append(s),o.showModal()};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",k,{once:!0}):k(),fetch("/_executor/api/telemetry/traces",{method:"POST",headers:{"content-type":"application/json"},credentials:"same-origin",keepalive:!0,body:JSON.stringify({resourceSpans:[{scopeSpans:[{spans:[{traceId:h,spanId:h.slice(0,16),name:"ui.app.failure",kind:1,startTimeUnixNano:S,endTimeUnixNano:S,status:{code:2},attributes:[{key:"executor.ui.failure.kind",value:{stringValue:e}},...i]}]}]}]})}).then(s=>{u=s.ok?"Error report sent.":"Could not send the error report. You can copy the error details.",n&&(n.textContent=u)},()=>{u="Could not send the error report. You can copy the error details.",n&&(n.textContent=u)})};window.addEventListener("error",e=>{if(e instanceof ErrorEvent){if(A.test(e.filename))return;let t=x(e.filename,e.lineno,e.colno);e.error instanceof Error&&R.has(e.error.name)&&t.push({key:"exception.type",value:{stringValue:e.error.name}}),E("runtime",e.error instanceof Error?e.error.stack??e.message:e.message,t)}else e.target instanceof HTMLScriptElement&&E("script",`Could not load script: ${e.target.src}`,x(e.target.src))},!0),window.addEventListener("unhandledrejection",e=>{let t=e.reason;E("rejection",t instanceof Error?t.stack??t.message:"An app operation failed without handling its error.")})};D();})();';
|
|
25
|
+
var accountNoticeSource = '"use strict";(()=>{var g=()=>{let r=document.getElementById("executor-account-notice")?.textContent;if(!r)return;let t=JSON.parse(r);if(typeof t!="object"||t===null||!("items"in t)||!("fix"in t))return;let c=t.items,s=t.fix;if(!Array.isArray(c)||typeof s!="string")return;let a=()=>{let i=document.createElement("div"),x=i.attachShadow({mode:"open"}),d=document.createElement("style");d.textContent="aside{position:fixed;right:16px;bottom:16px;z-index:2147483647;max-width:360px;box-sizing:border-box;padding:14px 16px;border-radius:10px;border:1px solid #fcd34d;background:#fffbeb;color:#451a03;font:14px/1.45 ui-sans-serif,system-ui,sans-serif;box-shadow:0 8px 24px rgb(0 0 0/.12)}strong{display:block;margin-bottom:4px}ul{margin:0 0 10px;padding-left:18px}div{display:flex;gap:12px;align-items:center}a{color:inherit;font-weight:600}button{margin-left:auto;font:inherit;background:none;border:0;padding:0;color:inherit;text-decoration:underline;cursor:pointer}";let e=document.createElement("aside");e.setAttribute("role","status"),e.setAttribute("aria-label","Account warning");let l=document.createElement("strong");l.textContent="Some things might not work";let m=document.createElement("ul");for(let f of c){let p=document.createElement("li");p.textContent=String(f),m.append(p)}let u=document.createElement("div"),n=document.createElement("a");n.href=s,n.target="_top",n.textContent="Review accounts";let o=document.createElement("button");o.type="button",o.textContent="Dismiss",o.addEventListener("click",()=>i.remove()),u.append(n,o),e.append(l,m,u),x.append(d,e),document.documentElement.append(i)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",a,{once:!0}):a()};g();})();';
|
|
26
|
+
|
|
22
27
|
// src/implementation/ui-account-notice.ts
|
|
23
28
|
var escape = (text) => text.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """);
|
|
24
29
|
var accountProblemBlocks = (problem) => problem.reason === "missing" || problem.reason === "removed" || problem.reason === "incompatible" || problem.reason === "credentials_rejected";
|
|
@@ -59,236 +64,13 @@ a{padding:8px 14px;border-radius:8px;border:1px solid #d4d4d8;color:#18181b;text
|
|
|
59
64
|
a.primary{background:#18181b;border-color:#18181b;color:#fff}
|
|
60
65
|
</style></head><body><main><h1>${title}</h1><p>This profile's accounts need attention before the app can work.</p><ul>${items}</ul><div class="actions"><a class="primary" href="${escape(notice.fix)}">Fix accounts</a><a href="${escape(notice.choose)}">Open with another profile</a></div></main></body></html>`;
|
|
61
66
|
};
|
|
62
|
-
var installAccountNotice = () => {
|
|
63
|
-
const data = document.getElementById("executor-account-notice")?.textContent;
|
|
64
|
-
if (!data) return;
|
|
65
|
-
const notice = JSON.parse(data);
|
|
66
|
-
if (typeof notice !== "object" || notice === null || !("items" in notice) || !("fix" in notice))
|
|
67
|
-
return;
|
|
68
|
-
const items = notice.items;
|
|
69
|
-
const fix = notice.fix;
|
|
70
|
-
if (!Array.isArray(items) || typeof fix !== "string") return;
|
|
71
|
-
const show = () => {
|
|
72
|
-
const host = document.createElement("div");
|
|
73
|
-
const root = host.attachShadow({ mode: "open" });
|
|
74
|
-
const style = document.createElement("style");
|
|
75
|
-
style.textContent = `aside{position:fixed;right:16px;bottom:16px;z-index:2147483647;max-width:360px;box-sizing:border-box;padding:14px 16px;border-radius:10px;border:1px solid #fcd34d;background:#fffbeb;color:#451a03;font:14px/1.45 ui-sans-serif,system-ui,sans-serif;box-shadow:0 8px 24px rgb(0 0 0/.12)}strong{display:block;margin-bottom:4px}ul{margin:0 0 10px;padding-left:18px}div{display:flex;gap:12px;align-items:center}a{color:inherit;font-weight:600}button{margin-left:auto;font:inherit;background:none;border:0;padding:0;color:inherit;text-decoration:underline;cursor:pointer}`;
|
|
76
|
-
const card = document.createElement("aside");
|
|
77
|
-
card.setAttribute("role", "status");
|
|
78
|
-
card.setAttribute("aria-label", "Account warning");
|
|
79
|
-
const title = document.createElement("strong");
|
|
80
|
-
title.textContent = "Some things might not work";
|
|
81
|
-
const list = document.createElement("ul");
|
|
82
|
-
for (const item of items) {
|
|
83
|
-
const entry = document.createElement("li");
|
|
84
|
-
entry.textContent = String(item);
|
|
85
|
-
list.append(entry);
|
|
86
|
-
}
|
|
87
|
-
const actions = document.createElement("div");
|
|
88
|
-
const link = document.createElement("a");
|
|
89
|
-
link.href = fix;
|
|
90
|
-
link.target = "_top";
|
|
91
|
-
link.textContent = "Review accounts";
|
|
92
|
-
const close = document.createElement("button");
|
|
93
|
-
close.type = "button";
|
|
94
|
-
close.textContent = "Dismiss";
|
|
95
|
-
close.addEventListener("click", () => host.remove());
|
|
96
|
-
actions.append(link, close);
|
|
97
|
-
card.append(title, list, actions);
|
|
98
|
-
root.append(style, card);
|
|
99
|
-
document.documentElement.append(host);
|
|
100
|
-
};
|
|
101
|
-
if (document.readyState === "loading") {
|
|
102
|
-
document.addEventListener("DOMContentLoaded", show, { once: true });
|
|
103
|
-
} else {
|
|
104
|
-
show();
|
|
105
|
-
}
|
|
106
|
-
};
|
|
107
67
|
var accountNoticeBootstrap = (notice) => `<script type="application/json" id="executor-account-notice">${JSON.stringify({
|
|
108
68
|
items: notice.problems.map(accountProblemText),
|
|
109
69
|
fix: notice.fix
|
|
110
|
-
}).replaceAll("<", "\\u003c")}</script><script
|
|
70
|
+
}).replaceAll("<", "\\u003c")}</script><script>${accountNoticeSource}</script>`;
|
|
111
71
|
|
|
112
72
|
// src/implementation/ui-errors.ts
|
|
113
|
-
var
|
|
114
|
-
let activeDialog;
|
|
115
|
-
let windowStart = Date.now(), reports = 0, dropped = 0;
|
|
116
|
-
const recent = /* @__PURE__ */ new Map();
|
|
117
|
-
const extension = /^(?:chrome|moz|safari-web)-extension:/;
|
|
118
|
-
const errorTypes = /* @__PURE__ */ new Set([
|
|
119
|
-
"Error",
|
|
120
|
-
"TypeError",
|
|
121
|
-
"ReferenceError",
|
|
122
|
-
"SyntaxError",
|
|
123
|
-
"RangeError",
|
|
124
|
-
"URIError",
|
|
125
|
-
"EvalError",
|
|
126
|
-
"AggregateError"
|
|
127
|
-
]);
|
|
128
|
-
const sourceAttributes = (filename, line = 0, column = 0) => {
|
|
129
|
-
const attributes = [];
|
|
130
|
-
if (!URL.canParse(filename)) return attributes;
|
|
131
|
-
const url = new URL(filename);
|
|
132
|
-
if (url.origin !== location.origin || !url.pathname.startsWith("/_executor/assets/") || !url.pathname.endsWith(".js"))
|
|
133
|
-
return attributes;
|
|
134
|
-
attributes.push({ key: "code.file.path", value: { stringValue: url.pathname } });
|
|
135
|
-
if (Number.isSafeInteger(line) && line > 0)
|
|
136
|
-
attributes.push({ key: "code.line.number", value: { intValue: String(line) } });
|
|
137
|
-
if (Number.isSafeInteger(column) && column > 0)
|
|
138
|
-
attributes.push({ key: "code.column.number", value: { intValue: String(column) } });
|
|
139
|
-
return attributes;
|
|
140
|
-
};
|
|
141
|
-
const fail = (kind, details, attributes = []) => {
|
|
142
|
-
const now = Date.now();
|
|
143
|
-
if (now - windowStart >= 6e4) {
|
|
144
|
-
windowStart = now;
|
|
145
|
-
reports = 0;
|
|
146
|
-
recent.clear();
|
|
147
|
-
}
|
|
148
|
-
const signature = `${kind}:${details.slice(0, 2e3)}`;
|
|
149
|
-
const previous = recent.get(signature);
|
|
150
|
-
if (previous !== void 0 && now - previous < 1e3 || reports >= 20) {
|
|
151
|
-
dropped++;
|
|
152
|
-
return;
|
|
153
|
-
}
|
|
154
|
-
recent.set(signature, now);
|
|
155
|
-
reports++;
|
|
156
|
-
attributes.push({
|
|
157
|
-
key: "executor.ui.failure.suppressed",
|
|
158
|
-
value: { intValue: String(dropped) }
|
|
159
|
-
});
|
|
160
|
-
dropped = 0;
|
|
161
|
-
const traceId = Array.from(
|
|
162
|
-
crypto.getRandomValues(new Uint8Array(16)),
|
|
163
|
-
(byte) => byte.toString(16).padStart(2, "0")
|
|
164
|
-
).join("");
|
|
165
|
-
const time = `${Date.now()}000000`;
|
|
166
|
-
let status;
|
|
167
|
-
let deliveryMessage = "Sending error report\u2026";
|
|
168
|
-
const show = () => {
|
|
169
|
-
if (activeDialog?.open) return;
|
|
170
|
-
const host = document.createElement("div");
|
|
171
|
-
const root = host.attachShadow({ mode: "open" });
|
|
172
|
-
const dialog = document.createElement("dialog");
|
|
173
|
-
activeDialog = dialog;
|
|
174
|
-
dialog.setAttribute("aria-labelledby", "executor-failure-title");
|
|
175
|
-
const title = document.createElement("h2");
|
|
176
|
-
title.id = "executor-failure-title";
|
|
177
|
-
title.textContent = kind === "script" ? "This app could not load" : "This app stopped working";
|
|
178
|
-
const message = document.createElement("p");
|
|
179
|
-
message.textContent = kind === "script" ? "A file needed by this page did not load. Reload the page to try again." : "The app encountered an unexpected error. Reload the page to try again.";
|
|
180
|
-
const warning = document.createElement("p");
|
|
181
|
-
warning.textContent = "Copy any unsaved work before reloading.";
|
|
182
|
-
const disclosure = document.createElement("details");
|
|
183
|
-
const summary = document.createElement("summary");
|
|
184
|
-
summary.textContent = "Error details";
|
|
185
|
-
const report = document.createElement("textarea");
|
|
186
|
-
report.readOnly = true;
|
|
187
|
-
report.rows = 10;
|
|
188
|
-
report.cols = 36;
|
|
189
|
-
report.setAttribute("aria-label", "Error details");
|
|
190
|
-
report.value = `${details.slice(0, 12e3)}
|
|
191
|
-
|
|
192
|
-
Diagnostic ID: ${traceId}`;
|
|
193
|
-
disclosure.append(summary, report);
|
|
194
|
-
status = document.createElement("p");
|
|
195
|
-
status.setAttribute("role", "status");
|
|
196
|
-
status.textContent = deliveryMessage;
|
|
197
|
-
const reload = document.createElement("button");
|
|
198
|
-
reload.type = "button";
|
|
199
|
-
reload.textContent = "Reload page";
|
|
200
|
-
reload.addEventListener("click", () => location.reload());
|
|
201
|
-
const close = document.createElement("button");
|
|
202
|
-
close.type = "button";
|
|
203
|
-
close.textContent = "Close";
|
|
204
|
-
close.addEventListener("click", () => dialog.close());
|
|
205
|
-
dialog.addEventListener("close", () => {
|
|
206
|
-
if (activeDialog === dialog) activeDialog = void 0;
|
|
207
|
-
host.remove();
|
|
208
|
-
});
|
|
209
|
-
dialog.append(title, message, warning, disclosure, status, reload, close);
|
|
210
|
-
root.append(dialog);
|
|
211
|
-
document.documentElement.append(host);
|
|
212
|
-
dialog.showModal();
|
|
213
|
-
};
|
|
214
|
-
if (document.readyState === "loading") {
|
|
215
|
-
document.addEventListener("DOMContentLoaded", show, { once: true });
|
|
216
|
-
} else {
|
|
217
|
-
show();
|
|
218
|
-
}
|
|
219
|
-
void fetch("/_executor/api/telemetry/traces", {
|
|
220
|
-
method: "POST",
|
|
221
|
-
headers: { "content-type": "application/json" },
|
|
222
|
-
credentials: "same-origin",
|
|
223
|
-
keepalive: true,
|
|
224
|
-
body: JSON.stringify({
|
|
225
|
-
resourceSpans: [
|
|
226
|
-
{
|
|
227
|
-
scopeSpans: [
|
|
228
|
-
{
|
|
229
|
-
spans: [
|
|
230
|
-
{
|
|
231
|
-
traceId,
|
|
232
|
-
spanId: traceId.slice(0, 16),
|
|
233
|
-
name: "ui.app.failure",
|
|
234
|
-
kind: 1,
|
|
235
|
-
startTimeUnixNano: time,
|
|
236
|
-
endTimeUnixNano: time,
|
|
237
|
-
status: { code: 2 },
|
|
238
|
-
attributes: [
|
|
239
|
-
{ key: "executor.ui.failure.kind", value: { stringValue: kind } },
|
|
240
|
-
...attributes
|
|
241
|
-
]
|
|
242
|
-
}
|
|
243
|
-
]
|
|
244
|
-
}
|
|
245
|
-
]
|
|
246
|
-
}
|
|
247
|
-
]
|
|
248
|
-
})
|
|
249
|
-
}).then(
|
|
250
|
-
(response) => {
|
|
251
|
-
deliveryMessage = response.ok ? "Error report sent." : "Could not send the error report. You can copy the error details.";
|
|
252
|
-
if (status) status.textContent = deliveryMessage;
|
|
253
|
-
},
|
|
254
|
-
() => {
|
|
255
|
-
deliveryMessage = "Could not send the error report. You can copy the error details.";
|
|
256
|
-
if (status) status.textContent = deliveryMessage;
|
|
257
|
-
}
|
|
258
|
-
);
|
|
259
|
-
};
|
|
260
|
-
window.addEventListener(
|
|
261
|
-
"error",
|
|
262
|
-
(event) => {
|
|
263
|
-
if (event instanceof ErrorEvent) {
|
|
264
|
-
if (extension.test(event.filename)) return;
|
|
265
|
-
const attributes = sourceAttributes(event.filename, event.lineno, event.colno);
|
|
266
|
-
if (event.error instanceof Error && errorTypes.has(event.error.name))
|
|
267
|
-
attributes.push({ key: "exception.type", value: { stringValue: event.error.name } });
|
|
268
|
-
fail(
|
|
269
|
-
"runtime",
|
|
270
|
-
event.error instanceof Error ? event.error.stack ?? event.message : event.message,
|
|
271
|
-
attributes
|
|
272
|
-
);
|
|
273
|
-
} else if (event.target instanceof HTMLScriptElement) {
|
|
274
|
-
fail(
|
|
275
|
-
"script",
|
|
276
|
-
`Could not load script: ${event.target.src}`,
|
|
277
|
-
sourceAttributes(event.target.src)
|
|
278
|
-
);
|
|
279
|
-
}
|
|
280
|
-
},
|
|
281
|
-
true
|
|
282
|
-
);
|
|
283
|
-
window.addEventListener("unhandledrejection", (event) => {
|
|
284
|
-
const reason = event.reason;
|
|
285
|
-
fail(
|
|
286
|
-
"rejection",
|
|
287
|
-
reason instanceof Error ? reason.stack ?? reason.message : "An app operation failed without handling its error."
|
|
288
|
-
);
|
|
289
|
-
});
|
|
290
|
-
};
|
|
291
|
-
var appFailureBootstrap = `<script>(${installAppFailureUI.toString()})()</script>`;
|
|
73
|
+
var appFailureBootstrap = `<script>${appFailureSource}</script>`;
|
|
292
74
|
|
|
293
75
|
// src/implementation/ui-serving.ts
|
|
294
76
|
var appDocument = (options) => Effect_exports.gen(function* () {
|
|
@@ -311,8 +93,8 @@ var appDocument = (options) => Effect_exports.gen(function* () {
|
|
|
311
93
|
contentType: "text/html",
|
|
312
94
|
headers: appPrivateHeaders
|
|
313
95
|
});
|
|
314
|
-
const
|
|
315
|
-
if (
|
|
96
|
+
const document = yield* options.asset("index.html");
|
|
97
|
+
if (document === void 0)
|
|
316
98
|
return HttpServerResponse_exports.text("This app has no UI.", {
|
|
317
99
|
status: 404,
|
|
318
100
|
headers: appPrivateHeaders
|
|
@@ -327,7 +109,7 @@ var appDocument = (options) => Effect_exports.gen(function* () {
|
|
|
327
109
|
const metadata = telemetry === void 0 ? "" : `<meta name="executor-build" content="${attribute(telemetry.version)}"><meta name="executor-environment" content="${attribute(telemetry.environment)}">`;
|
|
328
110
|
const boot = `${metadata}<base href="/_executor/assets/${attribute(options.deployment)}/"><script type="application/json" id="executor-context">${context}</script>${appFailureBootstrap}${notice === void 0 || notice.problems.length === 0 ? "" : accountNoticeBootstrap(notice)}<script src="/_executor/watch.js" defer></script>`;
|
|
329
111
|
return HttpServerResponse_exports.text(
|
|
330
|
-
new TextDecoder().decode(
|
|
112
|
+
new TextDecoder().decode(document.body).replace("<!--executor-ui-->", boot),
|
|
331
113
|
{ contentType: "text/html", headers: appPrivateHeaders }
|
|
332
114
|
);
|
|
333
115
|
});
|
|
@@ -349,34 +131,7 @@ var appAsset = (asset, build, path) => Effect_exports.gen(function* () {
|
|
|
349
131
|
});
|
|
350
132
|
|
|
351
133
|
// src/implementation/ui-watch.ts
|
|
352
|
-
var
|
|
353
|
-
const context = document.getElementById("executor-context")?.textContent;
|
|
354
|
-
if (!context) return;
|
|
355
|
-
const pinned = JSON.parse(context);
|
|
356
|
-
if (typeof pinned !== "object" || pinned === null || !("deployment" in pinned)) return;
|
|
357
|
-
const deployment = pinned.deployment;
|
|
358
|
-
if (typeof deployment !== "string" || deployment.length === 0) return;
|
|
359
|
-
const stream = new EventSource("/_executor/version");
|
|
360
|
-
let reloading = false;
|
|
361
|
-
const reload = () => {
|
|
362
|
-
if (reloading) return;
|
|
363
|
-
reloading = true;
|
|
364
|
-
stream.close();
|
|
365
|
-
location.reload();
|
|
366
|
-
};
|
|
367
|
-
stream.addEventListener("version", (event) => {
|
|
368
|
-
const current = JSON.parse(event.data);
|
|
369
|
-
if (typeof current === "object" && current !== null && "deployment" in current && (current.deployment === null || typeof current.deployment === "string") && current.deployment !== deployment)
|
|
370
|
-
reload();
|
|
371
|
-
});
|
|
372
|
-
stream.addEventListener("revoked", reload);
|
|
373
|
-
window.addEventListener("executor:deployment-changed", reload);
|
|
374
|
-
window.addEventListener("pagehide", () => stream.close(), { once: true });
|
|
375
|
-
window.addEventListener("pageshow", (event) => {
|
|
376
|
-
if (event.persisted) reload();
|
|
377
|
-
});
|
|
378
|
-
};
|
|
379
|
-
var appWatchScript = `(${installAppWatch.toString()})()`;
|
|
134
|
+
var appWatchScript = appWatchSource;
|
|
380
135
|
export {
|
|
381
136
|
appAsset,
|
|
382
137
|
appDocument,
|