@telepath-computer/television 0.1.146 → 0.1.148
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/dist/cli.cjs +239 -37
- package/dist/views/artifact-missing/index.html +78 -0
- package/dist/web/assets/artifact-bridge-Ce9BPLXH.js +1 -0
- package/dist/web/assets/artifactMissing-B7Big40q.js +1 -0
- package/dist/web/assets/{main-C2MN0DV1.js → main-CBfsRWgt.js} +87 -75
- package/dist/web/assets/main-qun7KJ0j.css +1 -0
- package/dist/web/assets/missing-artifact-page-DVzJ41AE.js +1 -0
- package/dist/web/assets/{urlUnsupported-DBXzijdI.js → urlUnsupported-BqoIG2ob.js} +1 -1
- package/dist/web/index.html +4 -3
- package/dist/web/views/artifact-missing/index.html +78 -0
- package/dist/web/views/url-unsupported/index.html +2 -2
- package/package.json +1 -1
- package/dist/web/assets/artifact-bridge-C9leJZpr.js +0 -1
- package/dist/web/assets/main-DxIXVlLQ.css +0 -1
package/dist/cli.cjs
CHANGED
|
@@ -1192,7 +1192,7 @@ var require_suggestSimilar = __commonJS({
|
|
|
1192
1192
|
// ../../node_modules/commander/lib/command.js
|
|
1193
1193
|
var require_command = __commonJS({
|
|
1194
1194
|
"../../node_modules/commander/lib/command.js"(exports2) {
|
|
1195
|
-
var
|
|
1195
|
+
var EventEmitter2 = require("node:events").EventEmitter;
|
|
1196
1196
|
var childProcess = require("node:child_process");
|
|
1197
1197
|
var path12 = require("node:path");
|
|
1198
1198
|
var fs4 = require("node:fs");
|
|
@@ -1202,7 +1202,7 @@ var require_command = __commonJS({
|
|
|
1202
1202
|
var { Help: Help2, stripColor } = require_help();
|
|
1203
1203
|
var { Option: Option2, DualOptions } = require_option();
|
|
1204
1204
|
var { suggestSimilar } = require_suggestSimilar();
|
|
1205
|
-
var Command2 = class _Command extends
|
|
1205
|
+
var Command2 = class _Command extends EventEmitter2 {
|
|
1206
1206
|
/**
|
|
1207
1207
|
* Initialize a new `Command`.
|
|
1208
1208
|
*
|
|
@@ -8744,7 +8744,7 @@ var require_src = __commonJS({
|
|
|
8744
8744
|
var require_destroy = __commonJS({
|
|
8745
8745
|
"../../node_modules/destroy/index.js"(exports2, module2) {
|
|
8746
8746
|
"use strict";
|
|
8747
|
-
var
|
|
8747
|
+
var EventEmitter2 = require("events").EventEmitter;
|
|
8748
8748
|
var ReadStream = require("fs").ReadStream;
|
|
8749
8749
|
var Stream = require("stream");
|
|
8750
8750
|
var Zlib = require("zlib");
|
|
@@ -8806,7 +8806,7 @@ var require_destroy = __commonJS({
|
|
|
8806
8806
|
return stream instanceof Stream && typeof stream.destroy === "function";
|
|
8807
8807
|
}
|
|
8808
8808
|
function isEventEmitter(val) {
|
|
8809
|
-
return val instanceof
|
|
8809
|
+
return val instanceof EventEmitter2;
|
|
8810
8810
|
}
|
|
8811
8811
|
function isFsReadStream(stream) {
|
|
8812
8812
|
return stream instanceof ReadStream;
|
|
@@ -29559,7 +29559,7 @@ var require_express = __commonJS({
|
|
|
29559
29559
|
"../../node_modules/express/lib/express.js"(exports2, module2) {
|
|
29560
29560
|
"use strict";
|
|
29561
29561
|
var bodyParser = require_body_parser();
|
|
29562
|
-
var
|
|
29562
|
+
var EventEmitter2 = require("events").EventEmitter;
|
|
29563
29563
|
var mixin = require_merge_descriptors();
|
|
29564
29564
|
var proto = require_application();
|
|
29565
29565
|
var Route = require_route();
|
|
@@ -29571,7 +29571,7 @@ var require_express = __commonJS({
|
|
|
29571
29571
|
var app = function(req2, res2, next) {
|
|
29572
29572
|
app.handle(req2, res2, next);
|
|
29573
29573
|
};
|
|
29574
|
-
mixin(app,
|
|
29574
|
+
mixin(app, EventEmitter2.prototype, false);
|
|
29575
29575
|
mixin(app, proto, false);
|
|
29576
29576
|
app.request = Object.create(req, {
|
|
29577
29577
|
app: { configurable: true, enumerable: true, writable: true, value: app }
|
|
@@ -31829,7 +31829,7 @@ var require_extension = __commonJS({
|
|
|
31829
31829
|
var require_websocket = __commonJS({
|
|
31830
31830
|
"../../node_modules/ws/lib/websocket.js"(exports2, module2) {
|
|
31831
31831
|
"use strict";
|
|
31832
|
-
var
|
|
31832
|
+
var EventEmitter2 = require("events");
|
|
31833
31833
|
var https = require("https");
|
|
31834
31834
|
var http2 = require("http");
|
|
31835
31835
|
var net = require("net");
|
|
@@ -31861,7 +31861,7 @@ var require_websocket = __commonJS({
|
|
|
31861
31861
|
var protocolVersions = [8, 13];
|
|
31862
31862
|
var readyStates = ["CONNECTING", "OPEN", "CLOSING", "CLOSED"];
|
|
31863
31863
|
var subprotocolRegex = /^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;
|
|
31864
|
-
var WebSocket2 = class _WebSocket extends
|
|
31864
|
+
var WebSocket2 = class _WebSocket extends EventEmitter2 {
|
|
31865
31865
|
/**
|
|
31866
31866
|
* Create a new `WebSocket`.
|
|
31867
31867
|
*
|
|
@@ -32858,7 +32858,7 @@ var require_subprotocol = __commonJS({
|
|
|
32858
32858
|
var require_websocket_server = __commonJS({
|
|
32859
32859
|
"../../node_modules/ws/lib/websocket-server.js"(exports2, module2) {
|
|
32860
32860
|
"use strict";
|
|
32861
|
-
var
|
|
32861
|
+
var EventEmitter2 = require("events");
|
|
32862
32862
|
var http2 = require("http");
|
|
32863
32863
|
var { Duplex } = require("stream");
|
|
32864
32864
|
var { createHash: createHash3 } = require("crypto");
|
|
@@ -32871,7 +32871,7 @@ var require_websocket_server = __commonJS({
|
|
|
32871
32871
|
var RUNNING = 0;
|
|
32872
32872
|
var CLOSING = 1;
|
|
32873
32873
|
var CLOSED = 2;
|
|
32874
|
-
var WebSocketServer2 = class extends
|
|
32874
|
+
var WebSocketServer2 = class extends EventEmitter2 {
|
|
32875
32875
|
/**
|
|
32876
32876
|
* Create a `WebSocketServer` instance.
|
|
32877
32877
|
*
|
|
@@ -48534,6 +48534,28 @@ function sendNotFound(res) {
|
|
|
48534
48534
|
applyProxyHeaders(res);
|
|
48535
48535
|
res.status(HTTP_NOT_FOUND).type("text/plain").send("Not found");
|
|
48536
48536
|
}
|
|
48537
|
+
function sendArtifactNotFound(req, res, store) {
|
|
48538
|
+
void (async () => {
|
|
48539
|
+
const viewPath = store.getViewPath("artifact-missing");
|
|
48540
|
+
if (viewPath === null) {
|
|
48541
|
+
sendNotFound(res);
|
|
48542
|
+
return;
|
|
48543
|
+
}
|
|
48544
|
+
try {
|
|
48545
|
+
const body = await (0, import_promises2.readFile)(import_node_path3.default.join(viewPath, "index.html"));
|
|
48546
|
+
applyProxyHeaders(res);
|
|
48547
|
+
res.status(HTTP_NOT_FOUND).type("text/html; charset=utf-8");
|
|
48548
|
+
res.setHeader("Content-Length", String(body.byteLength));
|
|
48549
|
+
if (req.method === "HEAD") {
|
|
48550
|
+
res.end();
|
|
48551
|
+
return;
|
|
48552
|
+
}
|
|
48553
|
+
res.end(body);
|
|
48554
|
+
} catch {
|
|
48555
|
+
sendNotFound(res);
|
|
48556
|
+
}
|
|
48557
|
+
})();
|
|
48558
|
+
}
|
|
48537
48559
|
function sendMethodNotAllowed(res) {
|
|
48538
48560
|
applyProxyHeaders(res);
|
|
48539
48561
|
res.setHeader("Allow", "GET, HEAD");
|
|
@@ -48588,7 +48610,7 @@ function sendInjectedHTML(req, res, stream, resolvedPath, stat) {
|
|
|
48588
48610
|
}
|
|
48589
48611
|
})();
|
|
48590
48612
|
}
|
|
48591
|
-
function pipeWithInjection(req, res, subpath, options) {
|
|
48613
|
+
function pipeWithInjection(req, res, subpath, options, notFound) {
|
|
48592
48614
|
applyProxyHeaders(res);
|
|
48593
48615
|
const stream = (0, import_send.default)(req, subpath, { ...options, etag: true });
|
|
48594
48616
|
const sendOriginal = stream.send.bind(stream);
|
|
@@ -48608,33 +48630,40 @@ function pipeWithInjection(req, res, subpath, options) {
|
|
|
48608
48630
|
sendInjectedHTML(req, res, stream, resolvedPath, stat);
|
|
48609
48631
|
};
|
|
48610
48632
|
stream.on("error", (error48) => {
|
|
48633
|
+
if ((error48.status ?? HTTP_NOT_FOUND) === HTTP_NOT_FOUND && notFound) {
|
|
48634
|
+
notFound();
|
|
48635
|
+
return;
|
|
48636
|
+
}
|
|
48611
48637
|
applyProxyHeaders(res);
|
|
48612
48638
|
res.status(error48.status === HTTP_NOT_FOUND ? HTTP_NOT_FOUND : error48.status ?? HTTP_NOT_FOUND).type("text/plain").send(error48.message);
|
|
48613
48639
|
});
|
|
48614
48640
|
stream.pipe(res);
|
|
48615
48641
|
}
|
|
48616
|
-
function serveDirectoryArtifact(req, res, artifact, subpath) {
|
|
48642
|
+
function serveDirectoryArtifact(req, res, store, artifact, subpath) {
|
|
48617
48643
|
if (subpath === "") {
|
|
48618
48644
|
applyProxyHeaders(res);
|
|
48619
48645
|
res.redirect(HTTP_MOVED_PERMANENTLY, `${proxyMountPath(artifact.id)}/`);
|
|
48620
48646
|
return;
|
|
48621
48647
|
}
|
|
48622
|
-
pipeWithInjection(req, res, subpath, { root: artifact.path, index: ["index.html", "index.htm"], dotfiles: "allow" });
|
|
48648
|
+
pipeWithInjection(req, res, subpath, { root: artifact.path, index: ["index.html", "index.htm"], dotfiles: "allow" }, subpath === "/" ? () => sendArtifactNotFound(req, res, store) : void 0);
|
|
48623
48649
|
}
|
|
48624
|
-
function serveFileArtifact(req, res, artifact, subpath) {
|
|
48650
|
+
function serveFileArtifact(req, res, store, artifact, subpath) {
|
|
48625
48651
|
let stat;
|
|
48626
48652
|
try {
|
|
48627
48653
|
stat = import_node_fs3.default.statSync(artifact.path);
|
|
48628
48654
|
} catch {
|
|
48629
|
-
|
|
48655
|
+
const basename2 = artifactBasename(artifact.path);
|
|
48656
|
+
if (subpath === `/${encodeURIComponent(basename2)}`) sendArtifactNotFound(req, res, store);
|
|
48657
|
+
else sendNotFound(res);
|
|
48630
48658
|
return;
|
|
48631
48659
|
}
|
|
48660
|
+
const basename = artifactBasename(artifact.path);
|
|
48661
|
+
const canonical = proxyFilePath(artifact.id, basename);
|
|
48632
48662
|
if (!stat.isFile()) {
|
|
48633
|
-
|
|
48663
|
+
if (subpath === `/${encodeURIComponent(basename)}`) sendArtifactNotFound(req, res, store);
|
|
48664
|
+
else sendNotFound(res);
|
|
48634
48665
|
return;
|
|
48635
48666
|
}
|
|
48636
|
-
const basename = artifactBasename(artifact.path);
|
|
48637
|
-
const canonical = proxyFilePath(artifact.id, basename);
|
|
48638
48667
|
if (subpath === "" || subpath === "/") {
|
|
48639
48668
|
applyProxyHeaders(res);
|
|
48640
48669
|
res.redirect(HTTP_MOVED_PERMANENTLY, canonical);
|
|
@@ -48644,7 +48673,7 @@ function serveFileArtifact(req, res, artifact, subpath) {
|
|
|
48644
48673
|
sendNotFound(res);
|
|
48645
48674
|
return;
|
|
48646
48675
|
}
|
|
48647
|
-
pipeWithInjection(req, res, subpath, { root: import_node_path3.default.dirname(artifact.path), index: false, dotfiles: "allow" });
|
|
48676
|
+
pipeWithInjection(req, res, subpath, { root: import_node_path3.default.dirname(artifact.path), index: false, dotfiles: "allow" }, () => sendArtifactNotFound(req, res, store));
|
|
48648
48677
|
}
|
|
48649
48678
|
function serveArtifactProxy(store) {
|
|
48650
48679
|
return (req, res) => {
|
|
@@ -48663,8 +48692,8 @@ function serveArtifactProxy(store) {
|
|
|
48663
48692
|
sendNotFound(res);
|
|
48664
48693
|
return;
|
|
48665
48694
|
}
|
|
48666
|
-
if (hasTrailingSeparator(artifact.path)) serveDirectoryArtifact(req, res, artifact, subpath);
|
|
48667
|
-
else serveFileArtifact(req, res, artifact, subpath);
|
|
48695
|
+
if (hasTrailingSeparator(artifact.path)) serveDirectoryArtifact(req, res, store, artifact, subpath);
|
|
48696
|
+
else serveFileArtifact(req, res, store, artifact, subpath);
|
|
48668
48697
|
};
|
|
48669
48698
|
}
|
|
48670
48699
|
|
|
@@ -49804,9 +49833,11 @@ var Server = class {
|
|
|
49804
49833
|
const themesDir = getThemesDir(this.store.storagePath);
|
|
49805
49834
|
this.app.get("/themes/:name/theme.css", serveThemeCSS(this.store.storagePath));
|
|
49806
49835
|
this.app.use("/themes", import_express2.default.static(themesDir));
|
|
49807
|
-
const
|
|
49808
|
-
|
|
49809
|
-
|
|
49836
|
+
for (const viewID of ["artifact-missing", "markdown"]) {
|
|
49837
|
+
const viewPath = this.store.getViewPath(viewID);
|
|
49838
|
+
if (viewPath) {
|
|
49839
|
+
this.app.use(`/views/${viewID}`, import_express2.default.static(viewPath));
|
|
49840
|
+
}
|
|
49810
49841
|
}
|
|
49811
49842
|
if (options.staticDir) {
|
|
49812
49843
|
this.app.use(import_express2.default.static(options.staticDir, {
|
|
@@ -49994,17 +50025,176 @@ var import_node_fs9 = require("node:fs");
|
|
|
49994
50025
|
var import_node_path11 = __toESM(require("node:path"), 1);
|
|
49995
50026
|
|
|
49996
50027
|
// ../server/src/file-watcher.ts
|
|
50028
|
+
var import_node_events = require("node:events");
|
|
49997
50029
|
var fs3 = __toESM(require("node:fs"), 1);
|
|
49998
50030
|
var import_node_path8 = __toESM(require("node:path"), 1);
|
|
49999
|
-
var
|
|
50000
|
-
|
|
50001
|
-
|
|
50002
|
-
|
|
50003
|
-
|
|
50004
|
-
|
|
50031
|
+
var DEFAULT_REARM_INTERVAL_MS = 250;
|
|
50032
|
+
function isMissingWatchRootError(error48) {
|
|
50033
|
+
return typeof error48 === "object" && error48 !== null && "code" in error48 && error48.code === "ENOENT";
|
|
50034
|
+
}
|
|
50035
|
+
var ReArmingContentWatcher = class extends import_node_events.EventEmitter {
|
|
50036
|
+
#dir;
|
|
50037
|
+
#watchedBasenames;
|
|
50038
|
+
#watchRootBasename;
|
|
50039
|
+
#onChange;
|
|
50040
|
+
#options;
|
|
50041
|
+
#watcher = null;
|
|
50042
|
+
#ancestorWatchers = [];
|
|
50043
|
+
#closed = false;
|
|
50044
|
+
#dead = false;
|
|
50045
|
+
#rearmTimer = null;
|
|
50046
|
+
#rootEventImmediate = null;
|
|
50047
|
+
constructor(filePath, onChange, basenames, options = {}) {
|
|
50048
|
+
super();
|
|
50049
|
+
this.#dir = basenames === void 0 ? import_node_path8.default.dirname(filePath) : filePath;
|
|
50050
|
+
this.#watchedBasenames = new Set(basenames ?? [import_node_path8.default.basename(filePath)]);
|
|
50051
|
+
this.#watchRootBasename = import_node_path8.default.basename(import_node_path8.default.normalize(this.#dir));
|
|
50052
|
+
this.#onChange = onChange;
|
|
50053
|
+
this.#options = options;
|
|
50054
|
+
try {
|
|
50055
|
+
this.#attach();
|
|
50056
|
+
} catch (error48) {
|
|
50057
|
+
if (!isMissingWatchRootError(error48)) {
|
|
50058
|
+
throw error48;
|
|
50059
|
+
}
|
|
50060
|
+
this.#markDead();
|
|
50005
50061
|
}
|
|
50006
|
-
}
|
|
50007
|
-
|
|
50062
|
+
}
|
|
50063
|
+
close() {
|
|
50064
|
+
this.#closed = true;
|
|
50065
|
+
if (this.#rearmTimer) {
|
|
50066
|
+
clearTimeout(this.#rearmTimer);
|
|
50067
|
+
this.#rearmTimer = null;
|
|
50068
|
+
}
|
|
50069
|
+
if (this.#rootEventImmediate) {
|
|
50070
|
+
clearImmediate(this.#rootEventImmediate);
|
|
50071
|
+
this.#rootEventImmediate = null;
|
|
50072
|
+
}
|
|
50073
|
+
this.#closeActiveWatchers();
|
|
50074
|
+
}
|
|
50075
|
+
#attach() {
|
|
50076
|
+
const watcher = fs3.watch(this.#dir, (_event, filename) => {
|
|
50077
|
+
const basename = filename?.toString();
|
|
50078
|
+
if (basename !== void 0 && this.#watchedBasenames.has(basename)) {
|
|
50079
|
+
this.#onChange();
|
|
50080
|
+
return;
|
|
50081
|
+
}
|
|
50082
|
+
if (basename === void 0 || basename === "" || basename === this.#watchRootBasename) {
|
|
50083
|
+
this.#handleWatchRootEvent();
|
|
50084
|
+
}
|
|
50085
|
+
});
|
|
50086
|
+
watcher.on("error", (error48) => {
|
|
50087
|
+
if (this.#isWatchRootPresent()) {
|
|
50088
|
+
this.emit("error", error48);
|
|
50089
|
+
return;
|
|
50090
|
+
}
|
|
50091
|
+
this.#markDead();
|
|
50092
|
+
});
|
|
50093
|
+
const ancestorWatchers = [];
|
|
50094
|
+
for (const ancestorDir of this.#ancestorDirs()) {
|
|
50095
|
+
const ancestorBasename = import_node_path8.default.basename(import_node_path8.default.normalize(ancestorDir));
|
|
50096
|
+
try {
|
|
50097
|
+
const ancestorWatcher = fs3.watch(ancestorDir, (_event, filename) => {
|
|
50098
|
+
const basename = filename?.toString();
|
|
50099
|
+
if (basename === void 0 || basename === "" || basename === ancestorBasename) {
|
|
50100
|
+
this.#handleWatchRootEvent();
|
|
50101
|
+
}
|
|
50102
|
+
});
|
|
50103
|
+
ancestorWatcher.on("error", (error48) => {
|
|
50104
|
+
if (this.#isWatchRootPresent()) {
|
|
50105
|
+
this.emit("error", error48);
|
|
50106
|
+
return;
|
|
50107
|
+
}
|
|
50108
|
+
this.#markDead();
|
|
50109
|
+
});
|
|
50110
|
+
ancestorWatchers.push(ancestorWatcher);
|
|
50111
|
+
} catch {
|
|
50112
|
+
}
|
|
50113
|
+
}
|
|
50114
|
+
this.#watcher = watcher;
|
|
50115
|
+
this.#ancestorWatchers = ancestorWatchers;
|
|
50116
|
+
this.#dead = false;
|
|
50117
|
+
}
|
|
50118
|
+
#handleWatchRootEvent() {
|
|
50119
|
+
if (this.#rootEventImmediate) return;
|
|
50120
|
+
this.#rootEventImmediate = setImmediate(() => {
|
|
50121
|
+
this.#rootEventImmediate = null;
|
|
50122
|
+
this.#handleWatchRootEventDeferred();
|
|
50123
|
+
});
|
|
50124
|
+
}
|
|
50125
|
+
#handleWatchRootEventDeferred() {
|
|
50126
|
+
if (this.#closed) return;
|
|
50127
|
+
if (!this.#isWatchRootPresent()) {
|
|
50128
|
+
this.#markDead();
|
|
50129
|
+
return;
|
|
50130
|
+
}
|
|
50131
|
+
this.#closeActiveWatchers();
|
|
50132
|
+
try {
|
|
50133
|
+
this.#attach();
|
|
50134
|
+
this.#onChange();
|
|
50135
|
+
} catch {
|
|
50136
|
+
this.#markDead();
|
|
50137
|
+
}
|
|
50138
|
+
}
|
|
50139
|
+
#ancestorDirs() {
|
|
50140
|
+
const ancestors = [];
|
|
50141
|
+
let current = import_node_path8.default.dirname(this.#dir);
|
|
50142
|
+
while (current !== import_node_path8.default.dirname(current)) {
|
|
50143
|
+
ancestors.push(current);
|
|
50144
|
+
current = import_node_path8.default.dirname(current);
|
|
50145
|
+
}
|
|
50146
|
+
return ancestors;
|
|
50147
|
+
}
|
|
50148
|
+
#closeActiveWatchers() {
|
|
50149
|
+
this.#watcher?.close();
|
|
50150
|
+
this.#watcher = null;
|
|
50151
|
+
for (const watcher of this.#ancestorWatchers) {
|
|
50152
|
+
watcher.close();
|
|
50153
|
+
}
|
|
50154
|
+
this.#ancestorWatchers = [];
|
|
50155
|
+
}
|
|
50156
|
+
#isWatchRootPresent() {
|
|
50157
|
+
try {
|
|
50158
|
+
return fs3.statSync(this.#dir).isDirectory();
|
|
50159
|
+
} catch {
|
|
50160
|
+
return false;
|
|
50161
|
+
}
|
|
50162
|
+
}
|
|
50163
|
+
#markDead() {
|
|
50164
|
+
if (this.#closed || this.#dead) return;
|
|
50165
|
+
this.#dead = true;
|
|
50166
|
+
this.#closeActiveWatchers();
|
|
50167
|
+
this.#options.onWatcherDead?.();
|
|
50168
|
+
this.#scheduleRearm();
|
|
50169
|
+
}
|
|
50170
|
+
#scheduleRearm() {
|
|
50171
|
+
if (this.#closed || this.#rearmTimer) return;
|
|
50172
|
+
this.#rearmTimer = setTimeout(() => {
|
|
50173
|
+
this.#rearmTimer = null;
|
|
50174
|
+
this.#tryRearm();
|
|
50175
|
+
}, this.#options.rearmIntervalMs ?? DEFAULT_REARM_INTERVAL_MS);
|
|
50176
|
+
}
|
|
50177
|
+
#tryRearm() {
|
|
50178
|
+
if (this.#closed) return;
|
|
50179
|
+
if (!this.#isWatchRootPresent()) {
|
|
50180
|
+
this.#scheduleRearm();
|
|
50181
|
+
return;
|
|
50182
|
+
}
|
|
50183
|
+
try {
|
|
50184
|
+
this.#attach();
|
|
50185
|
+
this.#options.onWatcherRearmed?.();
|
|
50186
|
+
this.#onChange();
|
|
50187
|
+
} catch (error48) {
|
|
50188
|
+
if (this.#isWatchRootPresent()) {
|
|
50189
|
+
this.emit("error", error48);
|
|
50190
|
+
return;
|
|
50191
|
+
}
|
|
50192
|
+
this.#scheduleRearm();
|
|
50193
|
+
}
|
|
50194
|
+
}
|
|
50195
|
+
};
|
|
50196
|
+
var defaultWatchContentFile = (filePath, onChange, basenames, options) => {
|
|
50197
|
+
return new ReArmingContentWatcher(filePath, onChange, basenames, options);
|
|
50008
50198
|
};
|
|
50009
50199
|
|
|
50010
50200
|
// ../server/src/artifact-paths.ts
|
|
@@ -50062,6 +50252,10 @@ var JSON_INDENT_SPACES = 2;
|
|
|
50062
50252
|
var CONTENT_WATCH_DEBOUNCE_MS = 100;
|
|
50063
50253
|
var JSON_FILE_SUFFIX = ".json";
|
|
50064
50254
|
var DIRECTORY_INDEX_BASENAMES = ["index.html", "index.htm"];
|
|
50255
|
+
var BUNDLED_VIEW_IDS = /* @__PURE__ */ new Set(["artifact-missing", "markdown"]);
|
|
50256
|
+
function isBundledViewID(id) {
|
|
50257
|
+
return BUNDLED_VIEW_IDS.has(id);
|
|
50258
|
+
}
|
|
50065
50259
|
function artifactWatchTarget(artifact) {
|
|
50066
50260
|
if (artifact.kind === "url") {
|
|
50067
50261
|
return null;
|
|
@@ -50118,10 +50312,10 @@ var ServerStore = class extends EventTarget {
|
|
|
50118
50312
|
return [];
|
|
50119
50313
|
}
|
|
50120
50314
|
getViewPath(id) {
|
|
50121
|
-
if (id
|
|
50315
|
+
if (!isBundledViewID(id) || this.bundledViewsPath === void 0) {
|
|
50122
50316
|
return null;
|
|
50123
50317
|
}
|
|
50124
|
-
const viewPath = import_node_path11.default.join(this.bundledViewsPath,
|
|
50318
|
+
const viewPath = import_node_path11.default.join(this.bundledViewsPath, id);
|
|
50125
50319
|
return (0, import_node_fs9.existsSync)(import_node_path11.default.join(viewPath, "index.html")) ? viewPath : null;
|
|
50126
50320
|
}
|
|
50127
50321
|
getScreen(id) {
|
|
@@ -50203,6 +50397,7 @@ var ServerStore = class extends EventTarget {
|
|
|
50203
50397
|
this._artifacts.set(input.artifactID, updated);
|
|
50204
50398
|
if (pointerChanged) {
|
|
50205
50399
|
this.startWatchingArtifactContent(updated);
|
|
50400
|
+
this.scheduleArtifactContentChangedEvent(updated.id);
|
|
50206
50401
|
}
|
|
50207
50402
|
this.dispatchEvent(new ArtifactUpdatedEvent("artifact-updated", { artifact: updated }));
|
|
50208
50403
|
return updated;
|
|
@@ -50430,7 +50625,14 @@ var ServerStore = class extends EventTarget {
|
|
|
50430
50625
|
try {
|
|
50431
50626
|
const watcher = this.watchContentFile(target.watchPath, () => {
|
|
50432
50627
|
this.scheduleArtifactContentChangedEvent(artifact.id);
|
|
50433
|
-
}, target.basenames
|
|
50628
|
+
}, target.basenames, {
|
|
50629
|
+
onWatcherDead: () => {
|
|
50630
|
+
this.scheduleArtifactContentChangedEvent(artifact.id);
|
|
50631
|
+
},
|
|
50632
|
+
onWatcherRearmed: () => {
|
|
50633
|
+
this.scheduleArtifactContentChangedEvent(artifact.id);
|
|
50634
|
+
}
|
|
50635
|
+
});
|
|
50434
50636
|
watcher.on("error", (error48) => {
|
|
50435
50637
|
console.warn(
|
|
50436
50638
|
`Watcher error for artifact ${artifact.id}: ${target.watchPath}`,
|
|
@@ -50843,8 +51045,8 @@ function resolveVercelSkillsInstallerBin() {
|
|
|
50843
51045
|
return localRequire.resolve("skills/bin/cli.mjs");
|
|
50844
51046
|
}
|
|
50845
51047
|
function readCLIVersion() {
|
|
50846
|
-
if ("0.1.
|
|
50847
|
-
return "0.1.
|
|
51048
|
+
if ("0.1.148".length > 0) {
|
|
51049
|
+
return "0.1.148";
|
|
50848
51050
|
}
|
|
50849
51051
|
const devPackageJsonPath = import_node_path12.default.join(getDevPackageDir(), "package.json");
|
|
50850
51052
|
if (!(0, import_node_fs10.existsSync)(devPackageJsonPath)) {
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>Artifact file not found</title>
|
|
7
|
+
<style>
|
|
8
|
+
html, body {
|
|
9
|
+
margin: 0;
|
|
10
|
+
min-height: 100%;
|
|
11
|
+
font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
|
12
|
+
color: #222222;
|
|
13
|
+
background: #dadada;
|
|
14
|
+
}
|
|
15
|
+
body {
|
|
16
|
+
display: grid;
|
|
17
|
+
place-items: center;
|
|
18
|
+
box-sizing: border-box;
|
|
19
|
+
min-height: 100vh;
|
|
20
|
+
padding: 24px;
|
|
21
|
+
}
|
|
22
|
+
main {
|
|
23
|
+
width: 100%;
|
|
24
|
+
}
|
|
25
|
+
.content-wrapper {
|
|
26
|
+
max-width: 520px;
|
|
27
|
+
margin: 0 auto;
|
|
28
|
+
}
|
|
29
|
+
h1 {
|
|
30
|
+
margin: 0 0 0.75rem;
|
|
31
|
+
font-size: 1.125rem;
|
|
32
|
+
line-height: 1.25;
|
|
33
|
+
}
|
|
34
|
+
p {
|
|
35
|
+
margin: 0;
|
|
36
|
+
font-size: 0.875rem;
|
|
37
|
+
line-height: 1.45;
|
|
38
|
+
}
|
|
39
|
+
.path-block {
|
|
40
|
+
margin: 1rem 0;
|
|
41
|
+
}
|
|
42
|
+
.path-label {
|
|
43
|
+
margin-bottom: 0.375rem;
|
|
44
|
+
}
|
|
45
|
+
code {
|
|
46
|
+
display: inline-block;
|
|
47
|
+
max-width: 100%;
|
|
48
|
+
overflow-wrap: anywhere;
|
|
49
|
+
padding: 0.125rem 0.3rem;
|
|
50
|
+
border-radius: 0.35rem;
|
|
51
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
|
|
52
|
+
font-size: 0.85em;
|
|
53
|
+
color: #253040;
|
|
54
|
+
background: #cbcbcb;
|
|
55
|
+
user-select: all;
|
|
56
|
+
}
|
|
57
|
+
[hidden] {
|
|
58
|
+
display: none !important;
|
|
59
|
+
}
|
|
60
|
+
</style>
|
|
61
|
+
<script type="module" crossorigin src="../../assets/artifactMissing-B7Big40q.js"></script>
|
|
62
|
+
<link rel="modulepreload" crossorigin href="../../assets/artifact-bridge-Ce9BPLXH.js">
|
|
63
|
+
<link rel="modulepreload" crossorigin href="../../assets/missing-artifact-page-DVzJ41AE.js">
|
|
64
|
+
</head>
|
|
65
|
+
<body>
|
|
66
|
+
<main>
|
|
67
|
+
<div class="content-wrapper">
|
|
68
|
+
<h1 id="missing-title"></h1>
|
|
69
|
+
<p id="missing-description"></p>
|
|
70
|
+
<section id="path-block" class="path-block" aria-label="Missing artifact path" hidden>
|
|
71
|
+
<p class="path-label">Registered path:</p>
|
|
72
|
+
<p><code id="missing-path"></code></p>
|
|
73
|
+
</section>
|
|
74
|
+
<p id="missing-recovery"></p>
|
|
75
|
+
</div>
|
|
76
|
+
</main>
|
|
77
|
+
</body>
|
|
78
|
+
</html>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(){const h=document.createElement("link").relList;if(h&&h.supports&&h.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))y(c);new MutationObserver(c=>{for(const l of c)if(l.type==="childList")for(const g of l.addedNodes)g.tagName==="LINK"&&g.rel==="modulepreload"&&y(g)}).observe(document,{childList:!0,subtree:!0});function b(c){const l={};return c.integrity&&(l.integrity=c.integrity),c.referrerPolicy&&(l.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?l.credentials="include":c.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function y(c){if(c.ep)return;c.ep=!0;const l=b(c);fetch(c.href,l)}})();const I="url-target-request",R="url-target",T="artifact-missing-request",X="artifact-missing";function p(e){return typeof e=="object"&&e!==null}function D(e){return!p(e)||e.type!==I?!1:!("id"in e)}function N(e){return!p(e)||e.type!==R||typeof e.url!="string"&&e.url!==null?!1:!("id"in e)}function C(e){return!p(e)||e.type!==T?!1:!("id"in e)}function P(e){return!p(e)||e.type!==X||typeof e.title!="string"||typeof e.path!="string"?!1:!("id"in e)}function Y(e){return!p(e)||e.type!=="wheel"||typeof e.deltaX!="number"||typeof e.shiftKey!="boolean"?!1:!("id"in e)}function K(e){return!p(e)||e.type!=="navigation-request"||typeof e.url!="string"||"replace"in e&&typeof e.replace!="boolean"||"sameDocument"in e&&typeof e.sameDocument!="boolean"||"native"in e&&typeof e.native!="boolean"?!1:!("id"in e)}function U(e){return!p(e)||e.type!=="filmstrip-key"||e.direction!==-1&&e.direction!==1?!1:!("id"in e)}function O(e){return!p(e)||e.type!=="swipe-move"||typeof e.deltaX!="number"?!1:!("id"in e)}function q(e){return!p(e)||e.type!=="swipe-end"||typeof e.velocityX!="number"?!1:!("id"in e)}function x(e=window,h={}){if(e.parent===e)return;const b=e;if(b.__televisionArtifactBridgeInstalled===!0)return;b.__televisionArtifactBridgeInstalled=!0;const y=()=>{e.document.documentElement&&(e.document.documentElement.style.touchAction="pan-y",e.document.documentElement.style.overscrollBehaviorX="contain",e.document.documentElement.style.overscrollBehaviorY="contain"),e.document.body&&(e.document.body.style.overscrollBehaviorX="contain",e.document.body.style.overscrollBehaviorY="contain")};if(y(),e.document.body||e.document.addEventListener("DOMContentLoaded",y,{once:!0}),h.reportNavigation!==!1){const o=r=>{e.parent.postMessage({type:"navigation-request",...r},"*")};o({url:e.location.href});const t=e.navigation;if(t)t.addEventListener("navigate",r=>{var d,f;const i=r,a=(d=i.destination)==null?void 0:d.url;if(typeof a!="string")return;const n=((f=i.destination)==null?void 0:f.sameDocument)===!0,s={url:a,...i.navigationType==="replace"?{replace:!0}:{},...n?{sameDocument:!0}:{}};if(n){o(s);return}try{if(new URL(a,e.location.href).origin===e.location.origin){o({...s,native:!0});return}}catch{}i.canIntercept!==!1&&i.preventDefault(),o(s)});else{e.document.addEventListener("click",a=>{var E;const n=a;if(n.metaKey||n.ctrlKey||n.shiftKey||n.altKey)return;const s=(E=e.document.defaultView)==null?void 0:E.Element;if(!s||!(n.target instanceof s))return;const u=n.target.closest("a[href]");if(!u||u.target&&u.target.toLowerCase()!=="_self"||u.hasAttribute("download"))return;const d=u.getAttribute("href");if(!d||d.startsWith("javascript:"))return;let f;try{f=new URL(u.href,e.document.baseURI)}catch{return}if(f.origin===e.location.origin&&f.pathname===e.location.pathname&&f.search===e.location.search&&f.hash!==""){o({url:f.href,sameDocument:!0});return}n.preventDefault(),o({url:f.href})},!0);const r=e.history.pushState.bind(e.history),i=e.history.replaceState.bind(e.history);e.history.pushState=function(...n){r(...n),o({url:e.location.href,sameDocument:!0})},e.history.replaceState=function(...n){i(...n),o({url:e.location.href,replace:!0,sameDocument:!0})},e.addEventListener("popstate",()=>{o({url:e.location.href,sameDocument:!0})}),e.addEventListener("hashchange",()=>{o({url:e.location.href,sameDocument:!0})}),e.document.addEventListener("submit",a=>{var E,S;const n=a,s=n.target,u=(E=e.document.defaultView)==null?void 0:E.HTMLFormElement;if(!u||!(s instanceof u)||s.target&&s.target.toLowerCase()!=="_self")return;n.preventDefault();const d=s.method.toLowerCase(),f=new URL(s.action||e.location.href,e.document.baseURI);if(d==="get"){const L=(S=e.document.defaultView)==null?void 0:S.FormData;if(!L)return;const M=new URLSearchParams;for(const[A,_]of new L(s))typeof _=="string"&&M.append(A,_);f.search=M.toString()}o({url:f.href})},!0)}}const c=o=>{var a,n;const t=(a=e.document.defaultView)==null?void 0:a.Element;if(!t||!(o instanceof t))return!1;const i=o.closest("input, textarea, select, [contenteditable], [role='textbox'], [role='searchbox'], [role='combobox'], [role='spinbutton'], [role='slider']");return i?i.hasAttribute("contenteditable")?((n=i.getAttribute("contenteditable"))==null?void 0:n.toLowerCase())!=="false":!0:!1};e.addEventListener("keydown",o=>{const t=o;t.key!=="ArrowLeft"&&t.key!=="ArrowRight"||t.metaKey||t.ctrlKey||t.altKey||t.shiftKey||c(t.target)||(t.preventDefault(),e.parent.postMessage({type:"filmstrip-key",direction:t.key==="ArrowRight"?1:-1},"*"))},{capture:!0}),e.addEventListener("wheel",o=>{const t=o,r=t.shiftKey&&t.deltaX===0&&t.deltaY!==0,i=r?t.deltaY:t.deltaX,a=Math.abs(i),n=r?0:Math.abs(t.deltaY);a<=n||(t.preventDefault(),e.parent.postMessage({type:"wheel",deltaX:i,shiftKey:t.shiftKey},"*"))},{passive:!1});const l=8,g=100,v=1e3,m=new Map;e.addEventListener("pointerdown",o=>{const t=o;t.pointerType==="touch"&&m.set(t.pointerId,{startX:t.clientX,startY:t.clientY,lastX:t.clientX,offset:0,active:!1,discarded:!1,samples:[{time:t.timeStamp,offset:0}]})},{passive:!0}),e.addEventListener("pointermove",o=>{const t=o,r=m.get(t.pointerId);if(!r||r.discarded)return;if(!r.active){const s=t.clientX-r.startX,u=t.clientY-r.startY,d=Math.abs(s),f=Math.abs(u);if(d<l&&f<l)return;if(f>=d){r.discarded=!0;return}r.active=!0}const i=t.clientX-r.lastX;r.lastX=t.clientX,r.offset+=i,r.samples.push({time:t.timeStamp,offset:r.offset});const a=t.timeStamp-g;let n=0;for(let s=0;s<r.samples.length;s+=1){if(r.samples[s].time>=a){n=s;break}n=s+1}if(n>0){const s=Math.max(0,n-1);r.samples.splice(0,s)}e.parent.postMessage({type:"swipe-move",deltaX:i},"*"),t.preventDefault()},{passive:!1}),e.addEventListener("pointerup",o=>{const t=o,r=m.get(t.pointerId);if(!r||(m.delete(t.pointerId),!r.active))return;let i=0;if(r.samples.length>=2){const a=r.samples[0],n=r.samples[r.samples.length-1],s=n.time-a.time;s>0&&(i=(n.offset-a.offset)/s*v)}e.parent.postMessage({type:"swipe-end",velocityX:i},"*")}),e.addEventListener("pointercancel",o=>{const t=o,r=m.get(t.pointerId);r&&(m.delete(t.pointerId),r.active&&e.parent.postMessage({type:"swipe-end",velocityX:0},"*"))})}export{X as A,R as U,U as a,D as b,C as c,K as d,O as e,q as f,x as g,P as h,Y as i,T as j,N as k,I as l};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{g as d,h as m,j as p}from"./artifact-bridge-Ce9BPLXH.js";import{m as l,a as E,b as f}from"./missing-artifact-page-DVzJ41AE.js";d(window,{reportNavigation:!1});document.getElementById("missing-title")!==null&&i(null);window.addEventListener("message",t=>{t.source===window.parent&&m(t.data)&&i(t.data)});var a;(a=window.__televisionContentBridge)==null||a.onHostMessage(t=>{m(t)&&i(t)});const c={type:p};window.parent.postMessage(c,"*");var g;(g=window.__televisionContentBridge)==null||g.postToHost(c);function i(t,n=document){const e=w(n);if(e.title.textContent=l(),e.description.textContent=E(),e.recovery.textContent=f(),n.title=(t==null?void 0:t.title)||l(),t===null){e.path.textContent="",e.pathBlock.hidden=!0;return}e.path.textContent=t.path,e.pathBlock.hidden=!1}function w(t){const n=t.getElementById("missing-title"),e=t.getElementById("missing-description"),s=t.getElementById("path-block"),o=t.getElementById("missing-path"),r=t.getElementById("missing-recovery");if(!(n instanceof HTMLElement))throw new Error("Missing #missing-title");if(!(e instanceof HTMLElement))throw new Error("Missing #missing-description");if(!(s instanceof HTMLElement))throw new Error("Missing #path-block");if(!(o instanceof HTMLElement))throw new Error("Missing #missing-path");if(!(r instanceof HTMLElement))throw new Error("Missing #missing-recovery");return{title:n,description:e,pathBlock:s,path:o,recovery:r}}
|